@sigtes/ui 0.3.1 → 0.3.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.
@@ -1,2285 +0,0 @@
1
- "use client";
2
- import Rt, { createContext as Ft, useContext as At } from "react";
3
- import { Slot as re } from "@radix-ui/react-slot";
4
- import { cva as ne } from "class-variance-authority";
5
- import { twMerge as ae } from "tailwind-merge";
6
- import "next-themes";
7
- var dt = { exports: {} }, V = {};
8
- var kt;
9
- function oe() {
10
- if (kt) return V;
11
- kt = 1;
12
- var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
13
- function n(t, a, i) {
14
- var u = null;
15
- if (i !== void 0 && (u = "" + i), a.key !== void 0 && (u = "" + a.key), "key" in a) {
16
- i = {};
17
- for (var l in a)
18
- l !== "key" && (i[l] = a[l]);
19
- } else i = a;
20
- return a = i.ref, {
21
- $$typeof: e,
22
- type: t,
23
- key: u,
24
- ref: a !== void 0 ? a : null,
25
- props: i
26
- };
27
- }
28
- return V.Fragment = r, V.jsx = n, V.jsxs = n, V;
29
- }
30
- var K = {};
31
- var St;
32
- function ie() {
33
- return St || (St = 1, process.env.NODE_ENV !== "production" && (function() {
34
- function e(o) {
35
- if (o == null) return null;
36
- if (typeof o == "function")
37
- return o.$$typeof === q ? null : o.displayName || o.name || null;
38
- if (typeof o == "string") return o;
39
- switch (o) {
40
- case x:
41
- return "Fragment";
42
- case I:
43
- return "Profiler";
44
- case N:
45
- return "StrictMode";
46
- case gt:
47
- return "Suspense";
48
- case pt:
49
- return "SuspenseList";
50
- case yt:
51
- return "Activity";
52
- }
53
- if (typeof o == "object")
54
- switch (typeof o.tag == "number" && console.error(
55
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
56
- ), o.$$typeof) {
57
- case E:
58
- return "Portal";
59
- case ht:
60
- return o.displayName || "Context";
61
- case C:
62
- return (o._context.displayName || "Context") + ".Consumer";
63
- case mt:
64
- var c = o.render;
65
- return o = o.displayName, o || (o = c.displayName || c.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
66
- case ct:
67
- return c = o.displayName || null, c !== null ? c : e(o.type) || "Memo";
68
- case H:
69
- c = o._payload, o = o._init;
70
- try {
71
- return e(o(c));
72
- } catch {
73
- }
74
- }
75
- return null;
76
- }
77
- function r(o) {
78
- return "" + o;
79
- }
80
- function n(o) {
81
- try {
82
- r(o);
83
- var c = !1;
84
- } catch {
85
- c = !0;
86
- }
87
- if (c) {
88
- c = console;
89
- var d = c.error, p = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
90
- return d.call(
91
- c,
92
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
93
- p
94
- ), r(o);
95
- }
96
- }
97
- function t(o) {
98
- if (o === x) return "<>";
99
- if (typeof o == "object" && o !== null && o.$$typeof === H)
100
- return "<...>";
101
- try {
102
- var c = e(o);
103
- return c ? "<" + c + ">" : "<...>";
104
- } catch {
105
- return "<...>";
106
- }
107
- }
108
- function a() {
109
- var o = F.A;
110
- return o === null ? null : o.getOwner();
111
- }
112
- function i() {
113
- return Error("react-stack-top-frame");
114
- }
115
- function u(o) {
116
- if (lt.call(o, "key")) {
117
- var c = Object.getOwnPropertyDescriptor(o, "key").get;
118
- if (c && c.isReactWarning) return !1;
119
- }
120
- return o.key !== void 0;
121
- }
122
- function l(o, c) {
123
- function d() {
124
- B || (B = !0, console.error(
125
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
126
- c
127
- ));
128
- }
129
- d.isReactWarning = !0, Object.defineProperty(o, "key", {
130
- get: d,
131
- configurable: !0
132
- });
133
- }
134
- function h() {
135
- var o = e(this.type);
136
- return G[o] || (G[o] = !0, console.error(
137
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
138
- )), o = this.props.ref, o !== void 0 ? o : null;
139
- }
140
- function k(o, c, d, p, M, Y) {
141
- var b = d.ref;
142
- return o = {
143
- $$typeof: R,
144
- type: o,
145
- key: c,
146
- props: d,
147
- _owner: p
148
- }, (b !== void 0 ? b : null) !== null ? Object.defineProperty(o, "ref", {
149
- enumerable: !1,
150
- get: h
151
- }) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
152
- configurable: !1,
153
- enumerable: !1,
154
- writable: !0,
155
- value: 0
156
- }), Object.defineProperty(o, "_debugInfo", {
157
- configurable: !1,
158
- enumerable: !1,
159
- writable: !0,
160
- value: null
161
- }), Object.defineProperty(o, "_debugStack", {
162
- configurable: !1,
163
- enumerable: !1,
164
- writable: !0,
165
- value: M
166
- }), Object.defineProperty(o, "_debugTask", {
167
- configurable: !1,
168
- enumerable: !1,
169
- writable: !0,
170
- value: Y
171
- }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
172
- }
173
- function y(o, c, d, p, M, Y) {
174
- var b = c.children;
175
- if (b !== void 0)
176
- if (p)
177
- if (Z(b)) {
178
- for (p = 0; p < b.length; p++)
179
- m(b[p]);
180
- Object.freeze && Object.freeze(b);
181
- } else
182
- console.error(
183
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
184
- );
185
- else m(b);
186
- if (lt.call(c, "key")) {
187
- b = e(o);
188
- var v = Object.keys(c).filter(function(J) {
189
- return J !== "key";
190
- });
191
- p = 0 < v.length ? "{key: someKey, " + v.join(": ..., ") + ": ...}" : "{key: someKey}", s[b + p] || (v = 0 < v.length ? "{" + v.join(": ..., ") + ": ...}" : "{}", console.error(
192
- `A props object containing a "key" prop is being spread into JSX:
193
- let props = %s;
194
- <%s {...props} />
195
- React keys must be passed directly to JSX without using spread:
196
- let props = %s;
197
- <%s key={someKey} {...props} />`,
198
- p,
199
- b,
200
- v,
201
- b
202
- ), s[b + p] = !0);
203
- }
204
- if (b = null, d !== void 0 && (n(d), b = "" + d), u(c) && (n(c.key), b = "" + c.key), "key" in c) {
205
- d = {};
206
- for (var O in c)
207
- O !== "key" && (d[O] = c[O]);
208
- } else d = c;
209
- return b && l(
210
- d,
211
- typeof o == "function" ? o.displayName || o.name || "Unknown" : o
212
- ), k(
213
- o,
214
- b,
215
- d,
216
- a(),
217
- M,
218
- Y
219
- );
220
- }
221
- function m(o) {
222
- S(o) ? o._store && (o._store.validated = 1) : typeof o == "object" && o !== null && o.$$typeof === H && (o._payload.status === "fulfilled" ? S(o._payload.value) && o._payload.value._store && (o._payload.value._store.validated = 1) : o._store && (o._store.validated = 1));
223
- }
224
- function S(o) {
225
- return typeof o == "object" && o !== null && o.$$typeof === R;
226
- }
227
- var T = Rt, R = /* @__PURE__ */ Symbol.for("react.transitional.element"), E = /* @__PURE__ */ Symbol.for("react.portal"), x = /* @__PURE__ */ Symbol.for("react.fragment"), N = /* @__PURE__ */ Symbol.for("react.strict_mode"), I = /* @__PURE__ */ Symbol.for("react.profiler"), C = /* @__PURE__ */ Symbol.for("react.consumer"), ht = /* @__PURE__ */ Symbol.for("react.context"), mt = /* @__PURE__ */ Symbol.for("react.forward_ref"), gt = /* @__PURE__ */ Symbol.for("react.suspense"), pt = /* @__PURE__ */ Symbol.for("react.suspense_list"), ct = /* @__PURE__ */ Symbol.for("react.memo"), H = /* @__PURE__ */ Symbol.for("react.lazy"), yt = /* @__PURE__ */ Symbol.for("react.activity"), q = /* @__PURE__ */ Symbol.for("react.client.reference"), F = T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, lt = Object.prototype.hasOwnProperty, Z = Array.isArray, A = console.createTask ? console.createTask : function() {
228
- return null;
229
- };
230
- T = {
231
- react_stack_bottom_frame: function(o) {
232
- return o();
233
- }
234
- };
235
- var B, G = {}, X = T.react_stack_bottom_frame.bind(
236
- T,
237
- i
238
- )(), Q = A(t(i)), s = {};
239
- K.Fragment = x, K.jsx = function(o, c, d) {
240
- var p = 1e4 > F.recentlyCreatedOwnerStacks++;
241
- return y(
242
- o,
243
- c,
244
- d,
245
- !1,
246
- p ? Error("react-stack-top-frame") : X,
247
- p ? A(t(o)) : Q
248
- );
249
- }, K.jsxs = function(o, c, d) {
250
- var p = 1e4 > F.recentlyCreatedOwnerStacks++;
251
- return y(
252
- o,
253
- c,
254
- d,
255
- !0,
256
- p ? Error("react-stack-top-frame") : X,
257
- p ? A(t(o)) : Q
258
- );
259
- };
260
- })()), K;
261
- }
262
- var Mt;
263
- function se() {
264
- return Mt || (Mt = 1, process.env.NODE_ENV === "production" ? dt.exports = oe() : dt.exports = ie()), dt.exports;
265
- }
266
- var ue = se();
267
- const ce = ne(
268
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
269
- {
270
- variants: {
271
- variant: {
272
- default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
273
- destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
274
- outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
275
- secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
276
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
277
- link: "text-primary underline-offset-4 hover:underline"
278
- },
279
- size: {
280
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
281
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
282
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
283
- icon: "size-9"
284
- }
285
- },
286
- defaultVariants: {
287
- variant: "default",
288
- size: "default"
289
- }
290
- }
291
- );
292
- function $t(e) {
293
- var r, n, t = "";
294
- if (typeof e == "string" || typeof e == "number") t += e;
295
- else if (typeof e == "object") if (Array.isArray(e)) {
296
- var a = e.length;
297
- for (r = 0; r < a; r++) e[r] && (n = $t(e[r])) && (t && (t += " "), t += n);
298
- } else for (n in e) e[n] && (t && (t += " "), t += n);
299
- return t;
300
- }
301
- function le() {
302
- for (var e, r, n = 0, t = "", a = arguments.length; n < a; n++) (e = arguments[n]) && (r = $t(e)) && (t && (t += " "), t += r);
303
- return t;
304
- }
305
- function de(...e) {
306
- return ae(le(e));
307
- }
308
- function Jr({
309
- className: e,
310
- variant: r,
311
- size: n,
312
- asChild: t = !1,
313
- ...a
314
- }) {
315
- const i = t ? re : "button";
316
- return /* @__PURE__ */ ue.jsx(
317
- i,
318
- {
319
- "data-slot": "button",
320
- className: de(ce({ variant: r, size: n, className: e })),
321
- ...a
322
- }
323
- );
324
- }
325
- var bt = { exports: {} }, tt = {};
326
- var Tt;
327
- function fe() {
328
- if (Tt) return tt;
329
- Tt = 1;
330
- var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
331
- function n(t, a, i) {
332
- var u = null;
333
- if (i !== void 0 && (u = "" + i), a.key !== void 0 && (u = "" + a.key), "key" in a) {
334
- i = {};
335
- for (var l in a)
336
- l !== "key" && (i[l] = a[l]);
337
- } else i = a;
338
- return a = i.ref, {
339
- $$typeof: e,
340
- type: t,
341
- key: u,
342
- ref: a !== void 0 ? a : null,
343
- props: i
344
- };
345
- }
346
- return tt.Fragment = r, tt.jsx = n, tt.jsxs = n, tt;
347
- }
348
- var ft = {};
349
- var Ot;
350
- function he() {
351
- return Ot || (Ot = 1, process.env.NODE_ENV !== "production" && (function() {
352
- function e(s) {
353
- if (s == null) return null;
354
- if (typeof s == "function")
355
- return s.$$typeof === yt ? null : s.displayName || s.name || null;
356
- if (typeof s == "string") return s;
357
- switch (s) {
358
- case E:
359
- return "Fragment";
360
- case N:
361
- return "Profiler";
362
- case x:
363
- return "StrictMode";
364
- case mt:
365
- return "Suspense";
366
- case gt:
367
- return "SuspenseList";
368
- case H:
369
- return "Activity";
370
- }
371
- if (typeof s == "object")
372
- switch (typeof s.tag == "number" && console.error(
373
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
374
- ), s.$$typeof) {
375
- case R:
376
- return "Portal";
377
- case C:
378
- return (s.displayName || "Context") + ".Provider";
379
- case I:
380
- return (s._context.displayName || "Context") + ".Consumer";
381
- case ht:
382
- var o = s.render;
383
- return s = s.displayName, s || (s = o.displayName || o.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
384
- case pt:
385
- return o = s.displayName || null, o !== null ? o : e(s.type) || "Memo";
386
- case ct:
387
- o = s._payload, s = s._init;
388
- try {
389
- return e(s(o));
390
- } catch {
391
- }
392
- }
393
- return null;
394
- }
395
- function r(s) {
396
- return "" + s;
397
- }
398
- function n(s) {
399
- try {
400
- r(s);
401
- var o = !1;
402
- } catch {
403
- o = !0;
404
- }
405
- if (o) {
406
- o = console;
407
- var c = o.error, d = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
408
- return c.call(
409
- o,
410
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
411
- d
412
- ), r(s);
413
- }
414
- }
415
- function t(s) {
416
- if (s === E) return "<>";
417
- if (typeof s == "object" && s !== null && s.$$typeof === ct)
418
- return "<...>";
419
- try {
420
- var o = e(s);
421
- return o ? "<" + o + ">" : "<...>";
422
- } catch {
423
- return "<...>";
424
- }
425
- }
426
- function a() {
427
- var s = q.A;
428
- return s === null ? null : s.getOwner();
429
- }
430
- function i() {
431
- return Error("react-stack-top-frame");
432
- }
433
- function u(s) {
434
- if (F.call(s, "key")) {
435
- var o = Object.getOwnPropertyDescriptor(s, "key").get;
436
- if (o && o.isReactWarning) return !1;
437
- }
438
- return s.key !== void 0;
439
- }
440
- function l(s, o) {
441
- function c() {
442
- A || (A = !0, console.error(
443
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
444
- o
445
- ));
446
- }
447
- c.isReactWarning = !0, Object.defineProperty(s, "key", {
448
- get: c,
449
- configurable: !0
450
- });
451
- }
452
- function h() {
453
- var s = e(this.type);
454
- return B[s] || (B[s] = !0, console.error(
455
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
456
- )), s = this.props.ref, s !== void 0 ? s : null;
457
- }
458
- function k(s, o, c, d, p, M, Y, b) {
459
- return c = M.ref, s = {
460
- $$typeof: T,
461
- type: s,
462
- key: o,
463
- props: M,
464
- _owner: p
465
- }, (c !== void 0 ? c : null) !== null ? Object.defineProperty(s, "ref", {
466
- enumerable: !1,
467
- get: h
468
- }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
469
- configurable: !1,
470
- enumerable: !1,
471
- writable: !0,
472
- value: 0
473
- }), Object.defineProperty(s, "_debugInfo", {
474
- configurable: !1,
475
- enumerable: !1,
476
- writable: !0,
477
- value: null
478
- }), Object.defineProperty(s, "_debugStack", {
479
- configurable: !1,
480
- enumerable: !1,
481
- writable: !0,
482
- value: Y
483
- }), Object.defineProperty(s, "_debugTask", {
484
- configurable: !1,
485
- enumerable: !1,
486
- writable: !0,
487
- value: b
488
- }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
489
- }
490
- function y(s, o, c, d, p, M, Y, b) {
491
- var v = o.children;
492
- if (v !== void 0)
493
- if (d)
494
- if (lt(v)) {
495
- for (d = 0; d < v.length; d++)
496
- m(v[d]);
497
- Object.freeze && Object.freeze(v);
498
- } else
499
- console.error(
500
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
501
- );
502
- else m(v);
503
- if (F.call(o, "key")) {
504
- v = e(s);
505
- var O = Object.keys(o).filter(function(ee) {
506
- return ee !== "key";
507
- });
508
- d = 0 < O.length ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}", Q[v + d] || (O = 0 < O.length ? "{" + O.join(": ..., ") + ": ...}" : "{}", console.error(
509
- `A props object containing a "key" prop is being spread into JSX:
510
- let props = %s;
511
- <%s {...props} />
512
- React keys must be passed directly to JSX without using spread:
513
- let props = %s;
514
- <%s key={someKey} {...props} />`,
515
- d,
516
- v,
517
- O,
518
- v
519
- ), Q[v + d] = !0);
520
- }
521
- if (v = null, c !== void 0 && (n(c), v = "" + c), u(o) && (n(o.key), v = "" + o.key), "key" in o) {
522
- c = {};
523
- for (var J in o)
524
- J !== "key" && (c[J] = o[J]);
525
- } else c = o;
526
- return v && l(
527
- c,
528
- typeof s == "function" ? s.displayName || s.name || "Unknown" : s
529
- ), k(
530
- s,
531
- v,
532
- M,
533
- p,
534
- a(),
535
- c,
536
- Y,
537
- b
538
- );
539
- }
540
- function m(s) {
541
- typeof s == "object" && s !== null && s.$$typeof === T && s._store && (s._store.validated = 1);
542
- }
543
- var S = Rt, T = /* @__PURE__ */ Symbol.for("react.transitional.element"), R = /* @__PURE__ */ Symbol.for("react.portal"), E = /* @__PURE__ */ Symbol.for("react.fragment"), x = /* @__PURE__ */ Symbol.for("react.strict_mode"), N = /* @__PURE__ */ Symbol.for("react.profiler"), I = /* @__PURE__ */ Symbol.for("react.consumer"), C = /* @__PURE__ */ Symbol.for("react.context"), ht = /* @__PURE__ */ Symbol.for("react.forward_ref"), mt = /* @__PURE__ */ Symbol.for("react.suspense"), gt = /* @__PURE__ */ Symbol.for("react.suspense_list"), pt = /* @__PURE__ */ Symbol.for("react.memo"), ct = /* @__PURE__ */ Symbol.for("react.lazy"), H = /* @__PURE__ */ Symbol.for("react.activity"), yt = /* @__PURE__ */ Symbol.for("react.client.reference"), q = S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, F = Object.prototype.hasOwnProperty, lt = Array.isArray, Z = console.createTask ? console.createTask : function() {
544
- return null;
545
- };
546
- S = {
547
- react_stack_bottom_frame: function(s) {
548
- return s();
549
- }
550
- };
551
- var A, B = {}, G = S.react_stack_bottom_frame.bind(
552
- S,
553
- i
554
- )(), X = Z(t(i)), Q = {};
555
- ft.Fragment = E, ft.jsx = function(s, o, c, d, p) {
556
- var M = 1e4 > q.recentlyCreatedOwnerStacks++;
557
- return y(
558
- s,
559
- o,
560
- c,
561
- !1,
562
- d,
563
- p,
564
- M ? Error("react-stack-top-frame") : G,
565
- M ? Z(t(s)) : X
566
- );
567
- }, ft.jsxs = function(s, o, c, d, p) {
568
- var M = 1e4 > q.recentlyCreatedOwnerStacks++;
569
- return y(
570
- s,
571
- o,
572
- c,
573
- !0,
574
- d,
575
- p,
576
- M ? Error("react-stack-top-frame") : G,
577
- M ? Z(t(s)) : X
578
- );
579
- };
580
- })()), ft;
581
- }
582
- var Dt;
583
- function me() {
584
- return Dt || (Dt = 1, process.env.NODE_ENV === "production" ? bt.exports = fe() : bt.exports = he()), bt.exports;
585
- }
586
- me();
587
- const ge = {
588
- id: "",
589
- username: "",
590
- email: "",
591
- created_at: null,
592
- updated_at: null,
593
- features: []
594
- }, pe = Ft({
595
- user: ge,
596
- isLoading: !0,
597
- fetchUser: async () => {
598
- },
599
- logout: async () => {
600
- },
601
- login: async () => !1
602
- });
603
- function Vr() {
604
- return At(pe);
605
- }
606
- function vt(e) {
607
- return (r = {}) => {
608
- const n = r.width ? String(r.width) : e.defaultWidth;
609
- return e.formats[n] || e.formats[e.defaultWidth];
610
- };
611
- }
612
- function et(e) {
613
- return (r, n) => {
614
- const t = n?.context ? String(n.context) : "standalone";
615
- let a;
616
- if (t === "formatting" && e.formattingValues) {
617
- const u = e.defaultFormattingWidth || e.defaultWidth, l = n?.width ? String(n.width) : u;
618
- a = e.formattingValues[l] || e.formattingValues[u];
619
- } else {
620
- const u = e.defaultWidth, l = n?.width ? String(n.width) : e.defaultWidth;
621
- a = e.values[l] || e.values[u];
622
- }
623
- const i = e.argumentCallback ? e.argumentCallback(r) : r;
624
- return a[i];
625
- };
626
- }
627
- function rt(e) {
628
- return (r, n = {}) => {
629
- const t = n.width, a = t && e.matchPatterns[t] || e.matchPatterns[e.defaultMatchWidth], i = r.match(a);
630
- if (!i)
631
- return null;
632
- const u = i[0], l = t && e.parsePatterns[t] || e.parsePatterns[e.defaultParseWidth], h = Array.isArray(l) ? be(l, (m) => m.test(u)) : (
633
- // [TODO] -- I challenge you to fix the type
634
- ye(l, (m) => m.test(u))
635
- );
636
- let k;
637
- k = e.valueCallback ? e.valueCallback(h) : h, k = n.valueCallback ? (
638
- // [TODO] -- I challenge you to fix the type
639
- n.valueCallback(k)
640
- ) : k;
641
- const y = r.slice(u.length);
642
- return { value: k, rest: y };
643
- };
644
- }
645
- function ye(e, r) {
646
- for (const n in e)
647
- if (Object.prototype.hasOwnProperty.call(e, n) && r(e[n]))
648
- return n;
649
- }
650
- function be(e, r) {
651
- for (let n = 0; n < e.length; n++)
652
- if (r(e[n]))
653
- return n;
654
- }
655
- function ve(e) {
656
- return (r, n = {}) => {
657
- const t = r.match(e.matchPattern);
658
- if (!t) return null;
659
- const a = t[0], i = r.match(e.parsePattern);
660
- if (!i) return null;
661
- let u = e.valueCallback ? e.valueCallback(i[0]) : i[0];
662
- u = n.valueCallback ? n.valueCallback(u) : u;
663
- const l = r.slice(a.length);
664
- return { value: u, rest: l };
665
- };
666
- }
667
- const Lt = 6048e5, we = 864e5, xt = /* @__PURE__ */ Symbol.for("constructDateFrom");
668
- function w(e, r) {
669
- return typeof e == "function" ? e(r) : e && typeof e == "object" && xt in e ? e[xt](r) : e instanceof Date ? new e.constructor(r) : new Date(r);
670
- }
671
- function U(e, ...r) {
672
- const n = w.bind(
673
- null,
674
- r.find((t) => typeof t == "object")
675
- );
676
- return r.map(n);
677
- }
678
- let ke = {};
679
- function ut() {
680
- return ke;
681
- }
682
- function g(e, r) {
683
- return w(r || e, e);
684
- }
685
- function z(e, r) {
686
- const n = ut(), t = r?.weekStartsOn ?? r?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, a = g(e, r?.in), i = a.getDay(), u = (i < t ? 7 : 0) + i - t;
687
- return a.setDate(a.getDate() - u), a.setHours(0, 0, 0, 0), a;
688
- }
689
- const Se = {
690
- lessThanXSeconds: {
691
- one: "less than a second",
692
- other: "less than {{count}} seconds"
693
- },
694
- xSeconds: {
695
- one: "1 second",
696
- other: "{{count}} seconds"
697
- },
698
- halfAMinute: "half a minute",
699
- lessThanXMinutes: {
700
- one: "less than a minute",
701
- other: "less than {{count}} minutes"
702
- },
703
- xMinutes: {
704
- one: "1 minute",
705
- other: "{{count}} minutes"
706
- },
707
- aboutXHours: {
708
- one: "about 1 hour",
709
- other: "about {{count}} hours"
710
- },
711
- xHours: {
712
- one: "1 hour",
713
- other: "{{count}} hours"
714
- },
715
- xDays: {
716
- one: "1 day",
717
- other: "{{count}} days"
718
- },
719
- aboutXWeeks: {
720
- one: "about 1 week",
721
- other: "about {{count}} weeks"
722
- },
723
- xWeeks: {
724
- one: "1 week",
725
- other: "{{count}} weeks"
726
- },
727
- aboutXMonths: {
728
- one: "about 1 month",
729
- other: "about {{count}} months"
730
- },
731
- xMonths: {
732
- one: "1 month",
733
- other: "{{count}} months"
734
- },
735
- aboutXYears: {
736
- one: "about 1 year",
737
- other: "about {{count}} years"
738
- },
739
- xYears: {
740
- one: "1 year",
741
- other: "{{count}} years"
742
- },
743
- overXYears: {
744
- one: "over 1 year",
745
- other: "over {{count}} years"
746
- },
747
- almostXYears: {
748
- one: "almost 1 year",
749
- other: "almost {{count}} years"
750
- }
751
- }, Me = (e, r, n) => {
752
- let t;
753
- const a = Se[e];
754
- return typeof a == "string" ? t = a : r === 1 ? t = a.one : t = a.other.replace("{{count}}", r.toString()), n?.addSuffix ? n.comparison && n.comparison > 0 ? "in " + t : t + " ago" : t;
755
- }, Te = {
756
- lastWeek: "'last' eeee 'at' p",
757
- yesterday: "'yesterday at' p",
758
- today: "'today at' p",
759
- tomorrow: "'tomorrow at' p",
760
- nextWeek: "eeee 'at' p",
761
- other: "P"
762
- }, Oe = (e, r, n, t) => Te[e], De = {
763
- narrow: ["B", "A"],
764
- abbreviated: ["BC", "AD"],
765
- wide: ["Before Christ", "Anno Domini"]
766
- }, xe = {
767
- narrow: ["1", "2", "3", "4"],
768
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
769
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
770
- }, Pe = {
771
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
772
- abbreviated: [
773
- "Jan",
774
- "Feb",
775
- "Mar",
776
- "Apr",
777
- "May",
778
- "Jun",
779
- "Jul",
780
- "Aug",
781
- "Sep",
782
- "Oct",
783
- "Nov",
784
- "Dec"
785
- ],
786
- wide: [
787
- "January",
788
- "February",
789
- "March",
790
- "April",
791
- "May",
792
- "June",
793
- "July",
794
- "August",
795
- "September",
796
- "October",
797
- "November",
798
- "December"
799
- ]
800
- }, Ee = {
801
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
802
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
803
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
804
- wide: [
805
- "Sunday",
806
- "Monday",
807
- "Tuesday",
808
- "Wednesday",
809
- "Thursday",
810
- "Friday",
811
- "Saturday"
812
- ]
813
- }, Ne = {
814
- narrow: {
815
- am: "a",
816
- pm: "p",
817
- midnight: "mi",
818
- noon: "n",
819
- morning: "morning",
820
- afternoon: "afternoon",
821
- evening: "evening",
822
- night: "night"
823
- },
824
- abbreviated: {
825
- am: "AM",
826
- pm: "PM",
827
- midnight: "midnight",
828
- noon: "noon",
829
- morning: "morning",
830
- afternoon: "afternoon",
831
- evening: "evening",
832
- night: "night"
833
- },
834
- wide: {
835
- am: "a.m.",
836
- pm: "p.m.",
837
- midnight: "midnight",
838
- noon: "noon",
839
- morning: "morning",
840
- afternoon: "afternoon",
841
- evening: "evening",
842
- night: "night"
843
- }
844
- }, Ce = {
845
- narrow: {
846
- am: "a",
847
- pm: "p",
848
- midnight: "mi",
849
- noon: "n",
850
- morning: "in the morning",
851
- afternoon: "in the afternoon",
852
- evening: "in the evening",
853
- night: "at night"
854
- },
855
- abbreviated: {
856
- am: "AM",
857
- pm: "PM",
858
- midnight: "midnight",
859
- noon: "noon",
860
- morning: "in the morning",
861
- afternoon: "in the afternoon",
862
- evening: "in the evening",
863
- night: "at night"
864
- },
865
- wide: {
866
- am: "a.m.",
867
- pm: "p.m.",
868
- midnight: "midnight",
869
- noon: "noon",
870
- morning: "in the morning",
871
- afternoon: "in the afternoon",
872
- evening: "in the evening",
873
- night: "at night"
874
- }
875
- }, Ye = (e, r) => {
876
- const n = Number(e), t = n % 100;
877
- if (t > 20 || t < 10)
878
- switch (t % 10) {
879
- case 1:
880
- return n + "st";
881
- case 2:
882
- return n + "nd";
883
- case 3:
884
- return n + "rd";
885
- }
886
- return n + "th";
887
- }, _e = {
888
- ordinalNumber: Ye,
889
- era: et({
890
- values: De,
891
- defaultWidth: "wide"
892
- }),
893
- quarter: et({
894
- values: xe,
895
- defaultWidth: "wide",
896
- argumentCallback: (e) => e - 1
897
- }),
898
- month: et({
899
- values: Pe,
900
- defaultWidth: "wide"
901
- }),
902
- day: et({
903
- values: Ee,
904
- defaultWidth: "wide"
905
- }),
906
- dayPeriod: et({
907
- values: Ne,
908
- defaultWidth: "wide",
909
- formattingValues: Ce,
910
- defaultFormattingWidth: "wide"
911
- })
912
- }, je = /^(\d+)(th|st|nd|rd)?/i, We = /\d+/i, Re = {
913
- narrow: /^(b|a)/i,
914
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
915
- wide: /^(before christ|before common era|anno domini|common era)/i
916
- }, Fe = {
917
- any: [/^b/i, /^(a|c)/i]
918
- }, Ae = {
919
- narrow: /^[1234]/i,
920
- abbreviated: /^q[1234]/i,
921
- wide: /^[1234](th|st|nd|rd)? quarter/i
922
- }, $e = {
923
- any: [/1/i, /2/i, /3/i, /4/i]
924
- }, Le = {
925
- narrow: /^[jfmasond]/i,
926
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
927
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
928
- }, ze = {
929
- narrow: [
930
- /^j/i,
931
- /^f/i,
932
- /^m/i,
933
- /^a/i,
934
- /^m/i,
935
- /^j/i,
936
- /^j/i,
937
- /^a/i,
938
- /^s/i,
939
- /^o/i,
940
- /^n/i,
941
- /^d/i
942
- ],
943
- any: [
944
- /^ja/i,
945
- /^f/i,
946
- /^mar/i,
947
- /^ap/i,
948
- /^may/i,
949
- /^jun/i,
950
- /^jul/i,
951
- /^au/i,
952
- /^s/i,
953
- /^o/i,
954
- /^n/i,
955
- /^d/i
956
- ]
957
- }, Ue = {
958
- narrow: /^[smtwf]/i,
959
- short: /^(su|mo|tu|we|th|fr|sa)/i,
960
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
961
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
962
- }, Ie = {
963
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
964
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
965
- }, He = {
966
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
967
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
968
- }, qe = {
969
- any: {
970
- am: /^a/i,
971
- pm: /^p/i,
972
- midnight: /^mi/i,
973
- noon: /^no/i,
974
- morning: /morning/i,
975
- afternoon: /afternoon/i,
976
- evening: /evening/i,
977
- night: /night/i
978
- }
979
- }, Ze = {
980
- ordinalNumber: ve({
981
- matchPattern: je,
982
- parsePattern: We,
983
- valueCallback: (e) => parseInt(e, 10)
984
- }),
985
- era: rt({
986
- matchPatterns: Re,
987
- defaultMatchWidth: "wide",
988
- parsePatterns: Fe,
989
- defaultParseWidth: "any"
990
- }),
991
- quarter: rt({
992
- matchPatterns: Ae,
993
- defaultMatchWidth: "wide",
994
- parsePatterns: $e,
995
- defaultParseWidth: "any",
996
- valueCallback: (e) => e + 1
997
- }),
998
- month: rt({
999
- matchPatterns: Le,
1000
- defaultMatchWidth: "wide",
1001
- parsePatterns: ze,
1002
- defaultParseWidth: "any"
1003
- }),
1004
- day: rt({
1005
- matchPatterns: Ue,
1006
- defaultMatchWidth: "wide",
1007
- parsePatterns: Ie,
1008
- defaultParseWidth: "any"
1009
- }),
1010
- dayPeriod: rt({
1011
- matchPatterns: He,
1012
- defaultMatchWidth: "any",
1013
- parsePatterns: qe,
1014
- defaultParseWidth: "any"
1015
- })
1016
- }, Be = {
1017
- full: "EEEE, MMMM do, y",
1018
- long: "MMMM do, y",
1019
- medium: "MMM d, y",
1020
- short: "MM/dd/yyyy"
1021
- }, Ge = {
1022
- full: "h:mm:ss a zzzz",
1023
- long: "h:mm:ss a z",
1024
- medium: "h:mm:ss a",
1025
- short: "h:mm a"
1026
- }, Xe = {
1027
- full: "{{date}} 'at' {{time}}",
1028
- long: "{{date}} 'at' {{time}}",
1029
- medium: "{{date}}, {{time}}",
1030
- short: "{{date}}, {{time}}"
1031
- }, Qe = {
1032
- date: vt({
1033
- formats: Be,
1034
- defaultWidth: "full"
1035
- }),
1036
- time: vt({
1037
- formats: Ge,
1038
- defaultWidth: "full"
1039
- }),
1040
- dateTime: vt({
1041
- formats: Xe,
1042
- defaultWidth: "full"
1043
- })
1044
- }, L = {
1045
- code: "en-US",
1046
- formatDistance: Me,
1047
- formatLong: Qe,
1048
- formatRelative: Oe,
1049
- localize: _e,
1050
- match: Ze,
1051
- options: {
1052
- weekStartsOn: 0,
1053
- firstWeekContainsDate: 1
1054
- }
1055
- };
1056
- function Je(e, r, n = "long") {
1057
- return new Intl.DateTimeFormat("en-US", {
1058
- // Enforces engine to render the time. Without the option JavaScriptCore omits it.
1059
- hour: "numeric",
1060
- timeZone: e,
1061
- timeZoneName: n
1062
- }).format(r).split(/\s/g).slice(2).join(" ");
1063
- }
1064
- const Ve = {}, nt = {};
1065
- function j(e, r) {
1066
- try {
1067
- const n = (Ve[e] ||= new Intl.DateTimeFormat("en-US", {
1068
- timeZone: e,
1069
- timeZoneName: "longOffset"
1070
- }).format)(r).split("GMT")[1];
1071
- return n in nt ? nt[n] : Pt(n, n.split(":"));
1072
- } catch {
1073
- if (e in nt) return nt[e];
1074
- const n = e?.match(Ke);
1075
- return n ? Pt(e, n.slice(1)) : NaN;
1076
- }
1077
- }
1078
- const Ke = /([+-]\d\d):?(\d\d)?/;
1079
- function Pt(e, r) {
1080
- const n = +(r[0] || 0), t = +(r[1] || 0), a = +(r[2] || 0) / 60;
1081
- return nt[e] = n * 60 + t > 0 ? n * 60 + t + a : n * 60 - t - a;
1082
- }
1083
- class D extends Date {
1084
- //#region static
1085
- constructor(...r) {
1086
- super(), r.length > 1 && typeof r[r.length - 1] == "string" && (this.timeZone = r.pop()), this.internal = /* @__PURE__ */ new Date(), isNaN(j(this.timeZone, this)) ? this.setTime(NaN) : r.length ? typeof r[0] == "number" && (r.length === 1 || r.length === 2 && typeof r[1] != "number") ? this.setTime(r[0]) : typeof r[0] == "string" ? this.setTime(+new Date(r[0])) : r[0] instanceof Date ? this.setTime(+r[0]) : (this.setTime(+new Date(...r)), zt(this), wt(this)) : this.setTime(Date.now());
1087
- }
1088
- static tz(r, ...n) {
1089
- return n.length ? new D(...n, r) : new D(Date.now(), r);
1090
- }
1091
- //#endregion
1092
- //#region time zone
1093
- withTimeZone(r) {
1094
- return new D(+this, r);
1095
- }
1096
- getTimezoneOffset() {
1097
- const r = -j(this.timeZone, this);
1098
- return r > 0 ? Math.floor(r) : Math.ceil(r);
1099
- }
1100
- //#endregion
1101
- //#region time
1102
- setTime(r) {
1103
- return Date.prototype.setTime.apply(this, arguments), wt(this), +this;
1104
- }
1105
- //#endregion
1106
- //#region date-fns integration
1107
- [/* @__PURE__ */ Symbol.for("constructDateFrom")](r) {
1108
- return new D(+new Date(r), this.timeZone);
1109
- }
1110
- //#endregion
1111
- }
1112
- const Et = /^(get|set)(?!UTC)/;
1113
- Object.getOwnPropertyNames(Date.prototype).forEach((e) => {
1114
- if (!Et.test(e)) return;
1115
- const r = e.replace(Et, "$1UTC");
1116
- D.prototype[r] && (e.startsWith("get") ? D.prototype[e] = function() {
1117
- return this.internal[r]();
1118
- } : (D.prototype[e] = function() {
1119
- return Date.prototype[r].apply(this.internal, arguments), tr(this), +this;
1120
- }, D.prototype[r] = function() {
1121
- return Date.prototype[r].apply(this, arguments), wt(this), +this;
1122
- }));
1123
- });
1124
- function wt(e) {
1125
- e.internal.setTime(+e), e.internal.setUTCSeconds(e.internal.getUTCSeconds() - Math.round(-j(e.timeZone, e) * 60));
1126
- }
1127
- function tr(e) {
1128
- Date.prototype.setFullYear.call(e, e.internal.getUTCFullYear(), e.internal.getUTCMonth(), e.internal.getUTCDate()), Date.prototype.setHours.call(e, e.internal.getUTCHours(), e.internal.getUTCMinutes(), e.internal.getUTCSeconds(), e.internal.getUTCMilliseconds()), zt(e);
1129
- }
1130
- function zt(e) {
1131
- const r = j(e.timeZone, e), n = r > 0 ? Math.floor(r) : Math.ceil(r), t = /* @__PURE__ */ new Date(+e);
1132
- t.setUTCHours(t.getUTCHours() - 1);
1133
- const a = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset(), i = -(/* @__PURE__ */ new Date(+t)).getTimezoneOffset(), u = a - i, l = Date.prototype.getHours.apply(e) !== e.internal.getUTCHours();
1134
- u && l && e.internal.setUTCMinutes(e.internal.getUTCMinutes() + u);
1135
- const h = a - n;
1136
- h && Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + h);
1137
- const k = /* @__PURE__ */ new Date(+e);
1138
- k.setUTCSeconds(0);
1139
- const y = a > 0 ? k.getSeconds() : (k.getSeconds() - 60) % 60, m = Math.round(-(j(e.timeZone, e) * 60)) % 60;
1140
- (m || y) && (e.internal.setUTCSeconds(e.internal.getUTCSeconds() + m), Date.prototype.setUTCSeconds.call(e, Date.prototype.getUTCSeconds.call(e) + m + y));
1141
- const S = j(e.timeZone, e), T = S > 0 ? Math.floor(S) : Math.ceil(S), R = -(/* @__PURE__ */ new Date(+e)).getTimezoneOffset() - T, E = T !== n, x = R - h;
1142
- if (E && x) {
1143
- Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + x);
1144
- const N = j(e.timeZone, e), I = N > 0 ? Math.floor(N) : Math.ceil(N), C = T - I;
1145
- C && (e.internal.setUTCMinutes(e.internal.getUTCMinutes() + C), Date.prototype.setUTCMinutes.call(e, Date.prototype.getUTCMinutes.call(e) + C));
1146
- }
1147
- }
1148
- class W extends D {
1149
- //#region static
1150
- static tz(r, ...n) {
1151
- return n.length ? new W(...n, r) : new W(Date.now(), r);
1152
- }
1153
- //#endregion
1154
- //#region representation
1155
- toISOString() {
1156
- const [r, n, t] = this.tzComponents(), a = `${r}${n}:${t}`;
1157
- return this.internal.toISOString().slice(0, -1) + a;
1158
- }
1159
- toString() {
1160
- return `${this.toDateString()} ${this.toTimeString()}`;
1161
- }
1162
- toDateString() {
1163
- const [r, n, t, a] = this.internal.toUTCString().split(" ");
1164
- return `${r?.slice(0, -1)} ${t} ${n} ${a}`;
1165
- }
1166
- toTimeString() {
1167
- const r = this.internal.toUTCString().split(" ")[4], [n, t, a] = this.tzComponents();
1168
- return `${r} GMT${n}${t}${a} (${Je(this.timeZone, this)})`;
1169
- }
1170
- toLocaleString(r, n) {
1171
- return Date.prototype.toLocaleString.call(this, r, {
1172
- ...n,
1173
- timeZone: n?.timeZone || this.timeZone
1174
- });
1175
- }
1176
- toLocaleDateString(r, n) {
1177
- return Date.prototype.toLocaleDateString.call(this, r, {
1178
- ...n,
1179
- timeZone: n?.timeZone || this.timeZone
1180
- });
1181
- }
1182
- toLocaleTimeString(r, n) {
1183
- return Date.prototype.toLocaleTimeString.call(this, r, {
1184
- ...n,
1185
- timeZone: n?.timeZone || this.timeZone
1186
- });
1187
- }
1188
- //#endregion
1189
- //#region private
1190
- tzComponents() {
1191
- const r = this.getTimezoneOffset(), n = r > 0 ? "-" : "+", t = String(Math.floor(Math.abs(r) / 60)).padStart(2, "0"), a = String(Math.abs(r) % 60).padStart(2, "0");
1192
- return [n, t, a];
1193
- }
1194
- //#endregion
1195
- withTimeZone(r) {
1196
- return new W(+this, r);
1197
- }
1198
- //#region date-fns integration
1199
- [/* @__PURE__ */ Symbol.for("constructDateFrom")](r) {
1200
- return new W(+new Date(r), this.timeZone);
1201
- }
1202
- //#endregion
1203
- }
1204
- function Ut(e, r, n) {
1205
- const t = g(e, n?.in);
1206
- return isNaN(r) ? w(e, NaN) : (r && t.setDate(t.getDate() + r), t);
1207
- }
1208
- function It(e, r, n) {
1209
- const t = g(e, n?.in);
1210
- if (isNaN(r)) return w(e, NaN);
1211
- if (!r)
1212
- return t;
1213
- const a = t.getDate(), i = w(e, t.getTime());
1214
- i.setMonth(t.getMonth() + r + 1, 0);
1215
- const u = i.getDate();
1216
- return a >= u ? i : (t.setFullYear(
1217
- i.getFullYear(),
1218
- i.getMonth(),
1219
- a
1220
- ), t);
1221
- }
1222
- function ot(e, r) {
1223
- return z(e, { ...r, weekStartsOn: 1 });
1224
- }
1225
- function Ht(e, r) {
1226
- const n = g(e, r?.in), t = n.getFullYear(), a = w(n, 0);
1227
- a.setFullYear(t + 1, 0, 4), a.setHours(0, 0, 0, 0);
1228
- const i = ot(a), u = w(n, 0);
1229
- u.setFullYear(t, 0, 4), u.setHours(0, 0, 0, 0);
1230
- const l = ot(u);
1231
- return n.getTime() >= i.getTime() ? t + 1 : n.getTime() >= l.getTime() ? t : t - 1;
1232
- }
1233
- function Nt(e) {
1234
- const r = g(e), n = new Date(
1235
- Date.UTC(
1236
- r.getFullYear(),
1237
- r.getMonth(),
1238
- r.getDate(),
1239
- r.getHours(),
1240
- r.getMinutes(),
1241
- r.getSeconds(),
1242
- r.getMilliseconds()
1243
- )
1244
- );
1245
- return n.setUTCFullYear(r.getFullYear()), +e - +n;
1246
- }
1247
- function it(e, r) {
1248
- const n = g(e, r?.in);
1249
- return n.setHours(0, 0, 0, 0), n;
1250
- }
1251
- function qt(e, r, n) {
1252
- const [t, a] = U(
1253
- n?.in,
1254
- e,
1255
- r
1256
- ), i = it(t), u = it(a), l = +i - Nt(i), h = +u - Nt(u);
1257
- return Math.round((l - h) / we);
1258
- }
1259
- function er(e, r) {
1260
- const n = Ht(e, r), t = w(e, 0);
1261
- return t.setFullYear(n, 0, 4), t.setHours(0, 0, 0, 0), ot(t);
1262
- }
1263
- function rr(e, r, n) {
1264
- return Ut(e, r * 7, n);
1265
- }
1266
- function nr(e, r, n) {
1267
- return It(e, r * 12, n);
1268
- }
1269
- function ar(e, r) {
1270
- let n, t = r?.in;
1271
- return e.forEach((a) => {
1272
- !t && typeof a == "object" && (t = w.bind(null, a));
1273
- const i = g(a, t);
1274
- (!n || n < i || isNaN(+i)) && (n = i);
1275
- }), w(t, n || NaN);
1276
- }
1277
- function or(e, r) {
1278
- let n, t = r?.in;
1279
- return e.forEach((a) => {
1280
- !t && typeof a == "object" && (t = w.bind(null, a));
1281
- const i = g(a, t);
1282
- (!n || n > i || isNaN(+i)) && (n = i);
1283
- }), w(t, n || NaN);
1284
- }
1285
- function ir(e, r, n) {
1286
- const [t, a] = U(
1287
- n?.in,
1288
- e,
1289
- r
1290
- );
1291
- return +it(t) == +it(a);
1292
- }
1293
- function Zt(e) {
1294
- return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
1295
- }
1296
- function sr(e) {
1297
- return !(!Zt(e) && typeof e != "number" || isNaN(+g(e)));
1298
- }
1299
- function ur(e, r, n) {
1300
- const [t, a] = U(
1301
- n?.in,
1302
- e,
1303
- r
1304
- ), i = t.getFullYear() - a.getFullYear(), u = t.getMonth() - a.getMonth();
1305
- return i * 12 + u;
1306
- }
1307
- function cr(e, r) {
1308
- const n = g(e, r?.in), t = n.getMonth();
1309
- return n.setFullYear(n.getFullYear(), t + 1, 0), n.setHours(23, 59, 59, 999), n;
1310
- }
1311
- function Bt(e, r) {
1312
- const [n, t] = U(e, r.start, r.end);
1313
- return { start: n, end: t };
1314
- }
1315
- function lr(e, r) {
1316
- const { start: n, end: t } = Bt(r?.in, e);
1317
- let a = +n > +t;
1318
- const i = a ? +n : +t, u = a ? t : n;
1319
- u.setHours(0, 0, 0, 0), u.setDate(1);
1320
- let l = 1;
1321
- const h = [];
1322
- for (; +u <= i; )
1323
- h.push(w(n, u)), u.setMonth(u.getMonth() + l);
1324
- return a ? h.reverse() : h;
1325
- }
1326
- function dr(e, r) {
1327
- const n = g(e, r?.in);
1328
- return n.setDate(1), n.setHours(0, 0, 0, 0), n;
1329
- }
1330
- function fr(e, r) {
1331
- const n = g(e, r?.in), t = n.getFullYear();
1332
- return n.setFullYear(t + 1, 0, 0), n.setHours(23, 59, 59, 999), n;
1333
- }
1334
- function Gt(e, r) {
1335
- const n = g(e, r?.in);
1336
- return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
1337
- }
1338
- function hr(e, r) {
1339
- const { start: n, end: t } = Bt(r?.in, e);
1340
- let a = +n > +t;
1341
- const i = a ? +n : +t, u = a ? t : n;
1342
- u.setHours(0, 0, 0, 0), u.setMonth(0, 1);
1343
- let l = 1;
1344
- const h = [];
1345
- for (; +u <= i; )
1346
- h.push(w(n, u)), u.setFullYear(u.getFullYear() + l);
1347
- return a ? h.reverse() : h;
1348
- }
1349
- function Xt(e, r) {
1350
- const n = ut(), t = r?.weekStartsOn ?? r?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, a = g(e, r?.in), i = a.getDay(), u = (i < t ? -7 : 0) + 6 - (i - t);
1351
- return a.setDate(a.getDate() + u), a.setHours(23, 59, 59, 999), a;
1352
- }
1353
- function mr(e, r) {
1354
- return Xt(e, { ...r, weekStartsOn: 1 });
1355
- }
1356
- function gr(e, r) {
1357
- const n = g(e, r?.in);
1358
- return qt(n, Gt(n)) + 1;
1359
- }
1360
- function Qt(e, r) {
1361
- const n = g(e, r?.in), t = +ot(n) - +er(n);
1362
- return Math.round(t / Lt) + 1;
1363
- }
1364
- function Jt(e, r) {
1365
- const n = g(e, r?.in), t = n.getFullYear(), a = ut(), i = r?.firstWeekContainsDate ?? r?.locale?.options?.firstWeekContainsDate ?? a.firstWeekContainsDate ?? a.locale?.options?.firstWeekContainsDate ?? 1, u = w(r?.in || e, 0);
1366
- u.setFullYear(t + 1, 0, i), u.setHours(0, 0, 0, 0);
1367
- const l = z(u, r), h = w(r?.in || e, 0);
1368
- h.setFullYear(t, 0, i), h.setHours(0, 0, 0, 0);
1369
- const k = z(h, r);
1370
- return +n >= +l ? t + 1 : +n >= +k ? t : t - 1;
1371
- }
1372
- function pr(e, r) {
1373
- const n = ut(), t = r?.firstWeekContainsDate ?? r?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, a = Jt(e, r), i = w(r?.in || e, 0);
1374
- return i.setFullYear(a, 0, t), i.setHours(0, 0, 0, 0), z(i, r);
1375
- }
1376
- function Vt(e, r) {
1377
- const n = g(e, r?.in), t = +z(n, r) - +pr(n, r);
1378
- return Math.round(t / Lt) + 1;
1379
- }
1380
- function f(e, r) {
1381
- const n = e < 0 ? "-" : "", t = Math.abs(e).toString().padStart(r, "0");
1382
- return n + t;
1383
- }
1384
- const P = {
1385
- // Year
1386
- y(e, r) {
1387
- const n = e.getFullYear(), t = n > 0 ? n : 1 - n;
1388
- return f(r === "yy" ? t % 100 : t, r.length);
1389
- },
1390
- // Month
1391
- M(e, r) {
1392
- const n = e.getMonth();
1393
- return r === "M" ? String(n + 1) : f(n + 1, 2);
1394
- },
1395
- // Day of the month
1396
- d(e, r) {
1397
- return f(e.getDate(), r.length);
1398
- },
1399
- // AM or PM
1400
- a(e, r) {
1401
- const n = e.getHours() / 12 >= 1 ? "pm" : "am";
1402
- switch (r) {
1403
- case "a":
1404
- case "aa":
1405
- return n.toUpperCase();
1406
- case "aaa":
1407
- return n;
1408
- case "aaaaa":
1409
- return n[0];
1410
- default:
1411
- return n === "am" ? "a.m." : "p.m.";
1412
- }
1413
- },
1414
- // Hour [1-12]
1415
- h(e, r) {
1416
- return f(e.getHours() % 12 || 12, r.length);
1417
- },
1418
- // Hour [0-23]
1419
- H(e, r) {
1420
- return f(e.getHours(), r.length);
1421
- },
1422
- // Minute
1423
- m(e, r) {
1424
- return f(e.getMinutes(), r.length);
1425
- },
1426
- // Second
1427
- s(e, r) {
1428
- return f(e.getSeconds(), r.length);
1429
- },
1430
- // Fraction of second
1431
- S(e, r) {
1432
- const n = r.length, t = e.getMilliseconds(), a = Math.trunc(
1433
- t * Math.pow(10, n - 3)
1434
- );
1435
- return f(a, r.length);
1436
- }
1437
- }, $ = {
1438
- midnight: "midnight",
1439
- noon: "noon",
1440
- morning: "morning",
1441
- afternoon: "afternoon",
1442
- evening: "evening",
1443
- night: "night"
1444
- }, Ct = {
1445
- // Era
1446
- G: function(e, r, n) {
1447
- const t = e.getFullYear() > 0 ? 1 : 0;
1448
- switch (r) {
1449
- // AD, BC
1450
- case "G":
1451
- case "GG":
1452
- case "GGG":
1453
- return n.era(t, { width: "abbreviated" });
1454
- // A, B
1455
- case "GGGGG":
1456
- return n.era(t, { width: "narrow" });
1457
- default:
1458
- return n.era(t, { width: "wide" });
1459
- }
1460
- },
1461
- // Year
1462
- y: function(e, r, n) {
1463
- if (r === "yo") {
1464
- const t = e.getFullYear(), a = t > 0 ? t : 1 - t;
1465
- return n.ordinalNumber(a, { unit: "year" });
1466
- }
1467
- return P.y(e, r);
1468
- },
1469
- // Local week-numbering year
1470
- Y: function(e, r, n, t) {
1471
- const a = Jt(e, t), i = a > 0 ? a : 1 - a;
1472
- if (r === "YY") {
1473
- const u = i % 100;
1474
- return f(u, 2);
1475
- }
1476
- return r === "Yo" ? n.ordinalNumber(i, { unit: "year" }) : f(i, r.length);
1477
- },
1478
- // ISO week-numbering year
1479
- R: function(e, r) {
1480
- const n = Ht(e);
1481
- return f(n, r.length);
1482
- },
1483
- // Extended year. This is a single number designating the year of this calendar system.
1484
- // The main difference between `y` and `u` localizers are B.C. years:
1485
- // | Year | `y` | `u` |
1486
- // |------|-----|-----|
1487
- // | AC 1 | 1 | 1 |
1488
- // | BC 1 | 1 | 0 |
1489
- // | BC 2 | 2 | -1 |
1490
- // Also `yy` always returns the last two digits of a year,
1491
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
1492
- u: function(e, r) {
1493
- const n = e.getFullYear();
1494
- return f(n, r.length);
1495
- },
1496
- // Quarter
1497
- Q: function(e, r, n) {
1498
- const t = Math.ceil((e.getMonth() + 1) / 3);
1499
- switch (r) {
1500
- // 1, 2, 3, 4
1501
- case "Q":
1502
- return String(t);
1503
- // 01, 02, 03, 04
1504
- case "QQ":
1505
- return f(t, 2);
1506
- // 1st, 2nd, 3rd, 4th
1507
- case "Qo":
1508
- return n.ordinalNumber(t, { unit: "quarter" });
1509
- // Q1, Q2, Q3, Q4
1510
- case "QQQ":
1511
- return n.quarter(t, {
1512
- width: "abbreviated",
1513
- context: "formatting"
1514
- });
1515
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1516
- case "QQQQQ":
1517
- return n.quarter(t, {
1518
- width: "narrow",
1519
- context: "formatting"
1520
- });
1521
- default:
1522
- return n.quarter(t, {
1523
- width: "wide",
1524
- context: "formatting"
1525
- });
1526
- }
1527
- },
1528
- // Stand-alone quarter
1529
- q: function(e, r, n) {
1530
- const t = Math.ceil((e.getMonth() + 1) / 3);
1531
- switch (r) {
1532
- // 1, 2, 3, 4
1533
- case "q":
1534
- return String(t);
1535
- // 01, 02, 03, 04
1536
- case "qq":
1537
- return f(t, 2);
1538
- // 1st, 2nd, 3rd, 4th
1539
- case "qo":
1540
- return n.ordinalNumber(t, { unit: "quarter" });
1541
- // Q1, Q2, Q3, Q4
1542
- case "qqq":
1543
- return n.quarter(t, {
1544
- width: "abbreviated",
1545
- context: "standalone"
1546
- });
1547
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
1548
- case "qqqqq":
1549
- return n.quarter(t, {
1550
- width: "narrow",
1551
- context: "standalone"
1552
- });
1553
- default:
1554
- return n.quarter(t, {
1555
- width: "wide",
1556
- context: "standalone"
1557
- });
1558
- }
1559
- },
1560
- // Month
1561
- M: function(e, r, n) {
1562
- const t = e.getMonth();
1563
- switch (r) {
1564
- case "M":
1565
- case "MM":
1566
- return P.M(e, r);
1567
- // 1st, 2nd, ..., 12th
1568
- case "Mo":
1569
- return n.ordinalNumber(t + 1, { unit: "month" });
1570
- // Jan, Feb, ..., Dec
1571
- case "MMM":
1572
- return n.month(t, {
1573
- width: "abbreviated",
1574
- context: "formatting"
1575
- });
1576
- // J, F, ..., D
1577
- case "MMMMM":
1578
- return n.month(t, {
1579
- width: "narrow",
1580
- context: "formatting"
1581
- });
1582
- default:
1583
- return n.month(t, { width: "wide", context: "formatting" });
1584
- }
1585
- },
1586
- // Stand-alone month
1587
- L: function(e, r, n) {
1588
- const t = e.getMonth();
1589
- switch (r) {
1590
- // 1, 2, ..., 12
1591
- case "L":
1592
- return String(t + 1);
1593
- // 01, 02, ..., 12
1594
- case "LL":
1595
- return f(t + 1, 2);
1596
- // 1st, 2nd, ..., 12th
1597
- case "Lo":
1598
- return n.ordinalNumber(t + 1, { unit: "month" });
1599
- // Jan, Feb, ..., Dec
1600
- case "LLL":
1601
- return n.month(t, {
1602
- width: "abbreviated",
1603
- context: "standalone"
1604
- });
1605
- // J, F, ..., D
1606
- case "LLLLL":
1607
- return n.month(t, {
1608
- width: "narrow",
1609
- context: "standalone"
1610
- });
1611
- default:
1612
- return n.month(t, { width: "wide", context: "standalone" });
1613
- }
1614
- },
1615
- // Local week of year
1616
- w: function(e, r, n, t) {
1617
- const a = Vt(e, t);
1618
- return r === "wo" ? n.ordinalNumber(a, { unit: "week" }) : f(a, r.length);
1619
- },
1620
- // ISO week of year
1621
- I: function(e, r, n) {
1622
- const t = Qt(e);
1623
- return r === "Io" ? n.ordinalNumber(t, { unit: "week" }) : f(t, r.length);
1624
- },
1625
- // Day of the month
1626
- d: function(e, r, n) {
1627
- return r === "do" ? n.ordinalNumber(e.getDate(), { unit: "date" }) : P.d(e, r);
1628
- },
1629
- // Day of year
1630
- D: function(e, r, n) {
1631
- const t = gr(e);
1632
- return r === "Do" ? n.ordinalNumber(t, { unit: "dayOfYear" }) : f(t, r.length);
1633
- },
1634
- // Day of week
1635
- E: function(e, r, n) {
1636
- const t = e.getDay();
1637
- switch (r) {
1638
- // Tue
1639
- case "E":
1640
- case "EE":
1641
- case "EEE":
1642
- return n.day(t, {
1643
- width: "abbreviated",
1644
- context: "formatting"
1645
- });
1646
- // T
1647
- case "EEEEE":
1648
- return n.day(t, {
1649
- width: "narrow",
1650
- context: "formatting"
1651
- });
1652
- // Tu
1653
- case "EEEEEE":
1654
- return n.day(t, {
1655
- width: "short",
1656
- context: "formatting"
1657
- });
1658
- default:
1659
- return n.day(t, {
1660
- width: "wide",
1661
- context: "formatting"
1662
- });
1663
- }
1664
- },
1665
- // Local day of week
1666
- e: function(e, r, n, t) {
1667
- const a = e.getDay(), i = (a - t.weekStartsOn + 8) % 7 || 7;
1668
- switch (r) {
1669
- // Numerical value (Nth day of week with current locale or weekStartsOn)
1670
- case "e":
1671
- return String(i);
1672
- // Padded numerical value
1673
- case "ee":
1674
- return f(i, 2);
1675
- // 1st, 2nd, ..., 7th
1676
- case "eo":
1677
- return n.ordinalNumber(i, { unit: "day" });
1678
- case "eee":
1679
- return n.day(a, {
1680
- width: "abbreviated",
1681
- context: "formatting"
1682
- });
1683
- // T
1684
- case "eeeee":
1685
- return n.day(a, {
1686
- width: "narrow",
1687
- context: "formatting"
1688
- });
1689
- // Tu
1690
- case "eeeeee":
1691
- return n.day(a, {
1692
- width: "short",
1693
- context: "formatting"
1694
- });
1695
- default:
1696
- return n.day(a, {
1697
- width: "wide",
1698
- context: "formatting"
1699
- });
1700
- }
1701
- },
1702
- // Stand-alone local day of week
1703
- c: function(e, r, n, t) {
1704
- const a = e.getDay(), i = (a - t.weekStartsOn + 8) % 7 || 7;
1705
- switch (r) {
1706
- // Numerical value (same as in `e`)
1707
- case "c":
1708
- return String(i);
1709
- // Padded numerical value
1710
- case "cc":
1711
- return f(i, r.length);
1712
- // 1st, 2nd, ..., 7th
1713
- case "co":
1714
- return n.ordinalNumber(i, { unit: "day" });
1715
- case "ccc":
1716
- return n.day(a, {
1717
- width: "abbreviated",
1718
- context: "standalone"
1719
- });
1720
- // T
1721
- case "ccccc":
1722
- return n.day(a, {
1723
- width: "narrow",
1724
- context: "standalone"
1725
- });
1726
- // Tu
1727
- case "cccccc":
1728
- return n.day(a, {
1729
- width: "short",
1730
- context: "standalone"
1731
- });
1732
- default:
1733
- return n.day(a, {
1734
- width: "wide",
1735
- context: "standalone"
1736
- });
1737
- }
1738
- },
1739
- // ISO day of week
1740
- i: function(e, r, n) {
1741
- const t = e.getDay(), a = t === 0 ? 7 : t;
1742
- switch (r) {
1743
- // 2
1744
- case "i":
1745
- return String(a);
1746
- // 02
1747
- case "ii":
1748
- return f(a, r.length);
1749
- // 2nd
1750
- case "io":
1751
- return n.ordinalNumber(a, { unit: "day" });
1752
- // Tue
1753
- case "iii":
1754
- return n.day(t, {
1755
- width: "abbreviated",
1756
- context: "formatting"
1757
- });
1758
- // T
1759
- case "iiiii":
1760
- return n.day(t, {
1761
- width: "narrow",
1762
- context: "formatting"
1763
- });
1764
- // Tu
1765
- case "iiiiii":
1766
- return n.day(t, {
1767
- width: "short",
1768
- context: "formatting"
1769
- });
1770
- default:
1771
- return n.day(t, {
1772
- width: "wide",
1773
- context: "formatting"
1774
- });
1775
- }
1776
- },
1777
- // AM or PM
1778
- a: function(e, r, n) {
1779
- const t = e.getHours() / 12 >= 1 ? "pm" : "am";
1780
- switch (r) {
1781
- case "a":
1782
- case "aa":
1783
- return n.dayPeriod(t, {
1784
- width: "abbreviated",
1785
- context: "formatting"
1786
- });
1787
- case "aaa":
1788
- return n.dayPeriod(t, {
1789
- width: "abbreviated",
1790
- context: "formatting"
1791
- }).toLowerCase();
1792
- case "aaaaa":
1793
- return n.dayPeriod(t, {
1794
- width: "narrow",
1795
- context: "formatting"
1796
- });
1797
- default:
1798
- return n.dayPeriod(t, {
1799
- width: "wide",
1800
- context: "formatting"
1801
- });
1802
- }
1803
- },
1804
- // AM, PM, midnight, noon
1805
- b: function(e, r, n) {
1806
- const t = e.getHours();
1807
- let a;
1808
- switch (t === 12 ? a = $.noon : t === 0 ? a = $.midnight : a = t / 12 >= 1 ? "pm" : "am", r) {
1809
- case "b":
1810
- case "bb":
1811
- return n.dayPeriod(a, {
1812
- width: "abbreviated",
1813
- context: "formatting"
1814
- });
1815
- case "bbb":
1816
- return n.dayPeriod(a, {
1817
- width: "abbreviated",
1818
- context: "formatting"
1819
- }).toLowerCase();
1820
- case "bbbbb":
1821
- return n.dayPeriod(a, {
1822
- width: "narrow",
1823
- context: "formatting"
1824
- });
1825
- default:
1826
- return n.dayPeriod(a, {
1827
- width: "wide",
1828
- context: "formatting"
1829
- });
1830
- }
1831
- },
1832
- // in the morning, in the afternoon, in the evening, at night
1833
- B: function(e, r, n) {
1834
- const t = e.getHours();
1835
- let a;
1836
- switch (t >= 17 ? a = $.evening : t >= 12 ? a = $.afternoon : t >= 4 ? a = $.morning : a = $.night, r) {
1837
- case "B":
1838
- case "BB":
1839
- case "BBB":
1840
- return n.dayPeriod(a, {
1841
- width: "abbreviated",
1842
- context: "formatting"
1843
- });
1844
- case "BBBBB":
1845
- return n.dayPeriod(a, {
1846
- width: "narrow",
1847
- context: "formatting"
1848
- });
1849
- default:
1850
- return n.dayPeriod(a, {
1851
- width: "wide",
1852
- context: "formatting"
1853
- });
1854
- }
1855
- },
1856
- // Hour [1-12]
1857
- h: function(e, r, n) {
1858
- if (r === "ho") {
1859
- let t = e.getHours() % 12;
1860
- return t === 0 && (t = 12), n.ordinalNumber(t, { unit: "hour" });
1861
- }
1862
- return P.h(e, r);
1863
- },
1864
- // Hour [0-23]
1865
- H: function(e, r, n) {
1866
- return r === "Ho" ? n.ordinalNumber(e.getHours(), { unit: "hour" }) : P.H(e, r);
1867
- },
1868
- // Hour [0-11]
1869
- K: function(e, r, n) {
1870
- const t = e.getHours() % 12;
1871
- return r === "Ko" ? n.ordinalNumber(t, { unit: "hour" }) : f(t, r.length);
1872
- },
1873
- // Hour [1-24]
1874
- k: function(e, r, n) {
1875
- let t = e.getHours();
1876
- return t === 0 && (t = 24), r === "ko" ? n.ordinalNumber(t, { unit: "hour" }) : f(t, r.length);
1877
- },
1878
- // Minute
1879
- m: function(e, r, n) {
1880
- return r === "mo" ? n.ordinalNumber(e.getMinutes(), { unit: "minute" }) : P.m(e, r);
1881
- },
1882
- // Second
1883
- s: function(e, r, n) {
1884
- return r === "so" ? n.ordinalNumber(e.getSeconds(), { unit: "second" }) : P.s(e, r);
1885
- },
1886
- // Fraction of second
1887
- S: function(e, r) {
1888
- return P.S(e, r);
1889
- },
1890
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
1891
- X: function(e, r, n) {
1892
- const t = e.getTimezoneOffset();
1893
- if (t === 0)
1894
- return "Z";
1895
- switch (r) {
1896
- // Hours and optional minutes
1897
- case "X":
1898
- return _t(t);
1899
- // Hours, minutes and optional seconds without `:` delimiter
1900
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1901
- // so this token always has the same output as `XX`
1902
- case "XXXX":
1903
- case "XX":
1904
- return _(t);
1905
- // Hours and minutes with `:` delimiter
1906
- default:
1907
- return _(t, ":");
1908
- }
1909
- },
1910
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
1911
- x: function(e, r, n) {
1912
- const t = e.getTimezoneOffset();
1913
- switch (r) {
1914
- // Hours and optional minutes
1915
- case "x":
1916
- return _t(t);
1917
- // Hours, minutes and optional seconds without `:` delimiter
1918
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
1919
- // so this token always has the same output as `xx`
1920
- case "xxxx":
1921
- case "xx":
1922
- return _(t);
1923
- // Hours and minutes with `:` delimiter
1924
- default:
1925
- return _(t, ":");
1926
- }
1927
- },
1928
- // Timezone (GMT)
1929
- O: function(e, r, n) {
1930
- const t = e.getTimezoneOffset();
1931
- switch (r) {
1932
- // Short
1933
- case "O":
1934
- case "OO":
1935
- case "OOO":
1936
- return "GMT" + Yt(t, ":");
1937
- default:
1938
- return "GMT" + _(t, ":");
1939
- }
1940
- },
1941
- // Timezone (specific non-location)
1942
- z: function(e, r, n) {
1943
- const t = e.getTimezoneOffset();
1944
- switch (r) {
1945
- // Short
1946
- case "z":
1947
- case "zz":
1948
- case "zzz":
1949
- return "GMT" + Yt(t, ":");
1950
- default:
1951
- return "GMT" + _(t, ":");
1952
- }
1953
- },
1954
- // Seconds timestamp
1955
- t: function(e, r, n) {
1956
- const t = Math.trunc(+e / 1e3);
1957
- return f(t, r.length);
1958
- },
1959
- // Milliseconds timestamp
1960
- T: function(e, r, n) {
1961
- return f(+e, r.length);
1962
- }
1963
- };
1964
- function Yt(e, r = "") {
1965
- const n = e > 0 ? "-" : "+", t = Math.abs(e), a = Math.trunc(t / 60), i = t % 60;
1966
- return i === 0 ? n + String(a) : n + String(a) + r + f(i, 2);
1967
- }
1968
- function _t(e, r) {
1969
- return e % 60 === 0 ? (e > 0 ? "-" : "+") + f(Math.abs(e) / 60, 2) : _(e, r);
1970
- }
1971
- function _(e, r = "") {
1972
- const n = e > 0 ? "-" : "+", t = Math.abs(e), a = f(Math.trunc(t / 60), 2), i = f(t % 60, 2);
1973
- return n + a + r + i;
1974
- }
1975
- const jt = (e, r) => {
1976
- switch (e) {
1977
- case "P":
1978
- return r.date({ width: "short" });
1979
- case "PP":
1980
- return r.date({ width: "medium" });
1981
- case "PPP":
1982
- return r.date({ width: "long" });
1983
- default:
1984
- return r.date({ width: "full" });
1985
- }
1986
- }, Kt = (e, r) => {
1987
- switch (e) {
1988
- case "p":
1989
- return r.time({ width: "short" });
1990
- case "pp":
1991
- return r.time({ width: "medium" });
1992
- case "ppp":
1993
- return r.time({ width: "long" });
1994
- default:
1995
- return r.time({ width: "full" });
1996
- }
1997
- }, yr = (e, r) => {
1998
- const n = e.match(/(P+)(p+)?/) || [], t = n[1], a = n[2];
1999
- if (!a)
2000
- return jt(e, r);
2001
- let i;
2002
- switch (t) {
2003
- case "P":
2004
- i = r.dateTime({ width: "short" });
2005
- break;
2006
- case "PP":
2007
- i = r.dateTime({ width: "medium" });
2008
- break;
2009
- case "PPP":
2010
- i = r.dateTime({ width: "long" });
2011
- break;
2012
- default:
2013
- i = r.dateTime({ width: "full" });
2014
- break;
2015
- }
2016
- return i.replace("{{date}}", jt(t, r)).replace("{{time}}", Kt(a, r));
2017
- }, br = {
2018
- p: Kt,
2019
- P: yr
2020
- }, vr = /^D+$/, wr = /^Y+$/, kr = ["D", "DD", "YY", "YYYY"];
2021
- function Sr(e) {
2022
- return vr.test(e);
2023
- }
2024
- function Mr(e) {
2025
- return wr.test(e);
2026
- }
2027
- function Tr(e, r, n) {
2028
- const t = Or(e, r, n);
2029
- if (console.warn(t), kr.includes(e)) throw new RangeError(t);
2030
- }
2031
- function Or(e, r, n) {
2032
- const t = e[0] === "Y" ? "years" : "days of the month";
2033
- return `Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${r}\`) for formatting ${t} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
2034
- }
2035
- const Dr = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, xr = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Pr = /^'([^]*?)'?$/, Er = /''/g, Nr = /[a-zA-Z]/;
2036
- function at(e, r, n) {
2037
- const t = ut(), a = n?.locale ?? t.locale ?? L, i = n?.firstWeekContainsDate ?? n?.locale?.options?.firstWeekContainsDate ?? t.firstWeekContainsDate ?? t.locale?.options?.firstWeekContainsDate ?? 1, u = n?.weekStartsOn ?? n?.locale?.options?.weekStartsOn ?? t.weekStartsOn ?? t.locale?.options?.weekStartsOn ?? 0, l = g(e, n?.in);
2038
- if (!sr(l))
2039
- throw new RangeError("Invalid time value");
2040
- let h = r.match(xr).map((y) => {
2041
- const m = y[0];
2042
- if (m === "p" || m === "P") {
2043
- const S = br[m];
2044
- return S(y, a.formatLong);
2045
- }
2046
- return y;
2047
- }).join("").match(Dr).map((y) => {
2048
- if (y === "''")
2049
- return { isToken: !1, value: "'" };
2050
- const m = y[0];
2051
- if (m === "'")
2052
- return { isToken: !1, value: Cr(y) };
2053
- if (Ct[m])
2054
- return { isToken: !0, value: y };
2055
- if (m.match(Nr))
2056
- throw new RangeError(
2057
- "Format string contains an unescaped latin alphabet character `" + m + "`"
2058
- );
2059
- return { isToken: !1, value: y };
2060
- });
2061
- a.localize.preprocessor && (h = a.localize.preprocessor(l, h));
2062
- const k = {
2063
- firstWeekContainsDate: i,
2064
- weekStartsOn: u,
2065
- locale: a
2066
- };
2067
- return h.map((y) => {
2068
- if (!y.isToken) return y.value;
2069
- const m = y.value;
2070
- (!n?.useAdditionalWeekYearTokens && Mr(m) || !n?.useAdditionalDayOfYearTokens && Sr(m)) && Tr(m, r, String(e));
2071
- const S = Ct[m[0]];
2072
- return S(l, m, a.localize, k);
2073
- }).join("");
2074
- }
2075
- function Cr(e) {
2076
- const r = e.match(Pr);
2077
- return r ? r[1].replace(Er, "'") : e;
2078
- }
2079
- function Yr(e, r) {
2080
- const n = g(e, r?.in), t = n.getFullYear(), a = n.getMonth(), i = w(n, 0);
2081
- return i.setFullYear(t, a + 1, 0), i.setHours(0, 0, 0, 0), i.getDate();
2082
- }
2083
- function _r(e, r) {
2084
- return g(e, r?.in).getMonth();
2085
- }
2086
- function jr(e, r) {
2087
- return g(e, r?.in).getFullYear();
2088
- }
2089
- function Wr(e, r) {
2090
- return +g(e) > +g(r);
2091
- }
2092
- function Rr(e, r) {
2093
- return +g(e) < +g(r);
2094
- }
2095
- function Fr(e, r, n) {
2096
- const [t, a] = U(
2097
- n?.in,
2098
- e,
2099
- r
2100
- );
2101
- return t.getFullYear() === a.getFullYear() && t.getMonth() === a.getMonth();
2102
- }
2103
- function Ar(e, r, n) {
2104
- const [t, a] = U(
2105
- n?.in,
2106
- e,
2107
- r
2108
- );
2109
- return t.getFullYear() === a.getFullYear();
2110
- }
2111
- function $r(e, r, n) {
2112
- const t = g(e, n?.in), a = t.getFullYear(), i = t.getDate(), u = w(e, 0);
2113
- u.setFullYear(a, r, 15), u.setHours(0, 0, 0, 0);
2114
- const l = Yr(u);
2115
- return t.setMonth(r, Math.min(i, l)), t;
2116
- }
2117
- function Lr(e, r, n) {
2118
- const t = g(e, n?.in);
2119
- return isNaN(+t) ? w(e, NaN) : (t.setFullYear(r), t);
2120
- }
2121
- const Wt = 5, zr = 4;
2122
- function Ur(e, r) {
2123
- const n = r.startOfMonth(e), t = n.getDay() > 0 ? n.getDay() : 7, a = r.addDays(e, -t + 1), i = r.addDays(a, Wt * 7 - 1);
2124
- return r.getMonth(e) === r.getMonth(i) ? Wt : zr;
2125
- }
2126
- function te(e, r) {
2127
- const n = r.startOfMonth(e), t = n.getDay();
2128
- return t === 1 ? n : t === 0 ? r.addDays(n, -6) : r.addDays(n, -1 * (t - 1));
2129
- }
2130
- function Ir(e, r) {
2131
- const n = te(e, r), t = Ur(e, r);
2132
- return r.addDays(n, t * 7 - 1);
2133
- }
2134
- const Hr = {
2135
- ...L,
2136
- labels: {
2137
- labelDayButton: (e, r, n, t) => {
2138
- let a;
2139
- t && typeof t.format == "function" ? a = t.format.bind(t) : a = (u, l) => at(u, l, { locale: L, ...n });
2140
- let i = a(e, "PPPP");
2141
- return r.today && (i = `Today, ${i}`), r.selected && (i = `${i}, selected`), i;
2142
- },
2143
- labelMonthDropdown: "Choose the Month",
2144
- labelNext: "Go to the Next Month",
2145
- labelPrevious: "Go to the Previous Month",
2146
- labelWeekNumber: (e) => `Week ${e}`,
2147
- labelYearDropdown: "Choose the Year",
2148
- labelGrid: (e, r, n) => {
2149
- let t;
2150
- return n && typeof n.format == "function" ? t = n.format.bind(n) : t = (a, i) => at(a, i, { locale: L, ...r }), t(e, "LLLL yyyy");
2151
- },
2152
- labelGridcell: (e, r, n, t) => {
2153
- let a;
2154
- t && typeof t.format == "function" ? a = t.format.bind(t) : a = (u, l) => at(u, l, { locale: L, ...n });
2155
- let i = a(e, "PPPP");
2156
- return r?.today && (i = `Today, ${i}`), i;
2157
- },
2158
- labelNav: "Navigation bar",
2159
- labelWeekNumberHeader: "Week Number",
2160
- labelWeekday: (e, r, n) => {
2161
- let t;
2162
- return n && typeof n.format == "function" ? t = n.format.bind(n) : t = (a, i) => at(a, i, { locale: L, ...r }), t(e, "cccc");
2163
- }
2164
- }
2165
- };
2166
- class st {
2167
- /**
2168
- * Creates an instance of `DateLib`.
2169
- *
2170
- * @param options Configuration options for the date library.
2171
- * @param overrides Custom overrides for the date library functions.
2172
- */
2173
- constructor(r, n) {
2174
- this.Date = Date, this.today = () => this.overrides?.today ? this.overrides.today() : this.options.timeZone ? W.tz(this.options.timeZone) : new this.Date(), this.newDate = (t, a, i) => this.overrides?.newDate ? this.overrides.newDate(t, a, i) : this.options.timeZone ? new W(t, a, i, this.options.timeZone) : new Date(t, a, i), this.addDays = (t, a) => this.overrides?.addDays ? this.overrides.addDays(t, a) : Ut(t, a), this.addMonths = (t, a) => this.overrides?.addMonths ? this.overrides.addMonths(t, a) : It(t, a), this.addWeeks = (t, a) => this.overrides?.addWeeks ? this.overrides.addWeeks(t, a) : rr(t, a), this.addYears = (t, a) => this.overrides?.addYears ? this.overrides.addYears(t, a) : nr(t, a), this.differenceInCalendarDays = (t, a) => this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(t, a) : qt(t, a), this.differenceInCalendarMonths = (t, a) => this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(t, a) : ur(t, a), this.eachMonthOfInterval = (t) => this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(t) : lr(t), this.eachYearOfInterval = (t) => {
2175
- const a = this.overrides?.eachYearOfInterval ? this.overrides.eachYearOfInterval(t) : hr(t), i = new Set(a.map((l) => this.getYear(l)));
2176
- if (i.size === a.length)
2177
- return a;
2178
- const u = [];
2179
- return i.forEach((l) => {
2180
- u.push(new Date(l, 0, 1));
2181
- }), u;
2182
- }, this.endOfBroadcastWeek = (t) => this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(t) : Ir(t, this), this.endOfISOWeek = (t) => this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(t) : mr(t), this.endOfMonth = (t) => this.overrides?.endOfMonth ? this.overrides.endOfMonth(t) : cr(t), this.endOfWeek = (t, a) => this.overrides?.endOfWeek ? this.overrides.endOfWeek(t, a) : Xt(t, this.options), this.endOfYear = (t) => this.overrides?.endOfYear ? this.overrides.endOfYear(t) : fr(t), this.format = (t, a, i) => {
2183
- const u = this.overrides?.format ? this.overrides.format(t, a, this.options) : at(t, a, this.options);
2184
- return this.options.numerals && this.options.numerals !== "latn" ? this.replaceDigits(u) : u;
2185
- }, this.getISOWeek = (t) => this.overrides?.getISOWeek ? this.overrides.getISOWeek(t) : Qt(t), this.getMonth = (t, a) => this.overrides?.getMonth ? this.overrides.getMonth(t, this.options) : _r(t, this.options), this.getYear = (t, a) => this.overrides?.getYear ? this.overrides.getYear(t, this.options) : jr(t, this.options), this.getWeek = (t, a) => this.overrides?.getWeek ? this.overrides.getWeek(t, this.options) : Vt(t, this.options), this.isAfter = (t, a) => this.overrides?.isAfter ? this.overrides.isAfter(t, a) : Wr(t, a), this.isBefore = (t, a) => this.overrides?.isBefore ? this.overrides.isBefore(t, a) : Rr(t, a), this.isDate = (t) => this.overrides?.isDate ? this.overrides.isDate(t) : Zt(t), this.isSameDay = (t, a) => this.overrides?.isSameDay ? this.overrides.isSameDay(t, a) : ir(t, a), this.isSameMonth = (t, a) => this.overrides?.isSameMonth ? this.overrides.isSameMonth(t, a) : Fr(t, a), this.isSameYear = (t, a) => this.overrides?.isSameYear ? this.overrides.isSameYear(t, a) : Ar(t, a), this.max = (t) => this.overrides?.max ? this.overrides.max(t) : ar(t), this.min = (t) => this.overrides?.min ? this.overrides.min(t) : or(t), this.setMonth = (t, a) => this.overrides?.setMonth ? this.overrides.setMonth(t, a) : $r(t, a), this.setYear = (t, a) => this.overrides?.setYear ? this.overrides.setYear(t, a) : Lr(t, a), this.startOfBroadcastWeek = (t, a) => this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(t, this) : te(t, this), this.startOfDay = (t) => this.overrides?.startOfDay ? this.overrides.startOfDay(t) : it(t), this.startOfISOWeek = (t) => this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(t) : ot(t), this.startOfMonth = (t) => this.overrides?.startOfMonth ? this.overrides.startOfMonth(t) : dr(t), this.startOfWeek = (t, a) => this.overrides?.startOfWeek ? this.overrides.startOfWeek(t, this.options) : z(t, this.options), this.startOfYear = (t) => this.overrides?.startOfYear ? this.overrides.startOfYear(t) : Gt(t), this.options = { locale: Hr, ...r }, this.overrides = n;
2186
- }
2187
- /**
2188
- * Generates a mapping of Arabic digits (0-9) to the target numbering system
2189
- * digits.
2190
- *
2191
- * @since 9.5.0
2192
- * @returns A record mapping Arabic digits to the target numerals.
2193
- */
2194
- getDigitMap() {
2195
- const { numerals: r = "latn" } = this.options, n = new Intl.NumberFormat("en-US", {
2196
- numberingSystem: r
2197
- }), t = {};
2198
- for (let a = 0; a < 10; a++)
2199
- t[a.toString()] = n.format(a);
2200
- return t;
2201
- }
2202
- /**
2203
- * Replaces Arabic digits in a string with the target numbering system digits.
2204
- *
2205
- * @since 9.5.0
2206
- * @param input The string containing Arabic digits.
2207
- * @returns The string with digits replaced.
2208
- */
2209
- replaceDigits(r) {
2210
- const n = this.getDigitMap();
2211
- return r.replace(/\d/g, (t) => n[t] || t);
2212
- }
2213
- /**
2214
- * Formats a number using the configured numbering system.
2215
- *
2216
- * @since 9.5.0
2217
- * @param value The number to format.
2218
- * @returns The formatted number as a string.
2219
- */
2220
- formatNumber(r) {
2221
- return this.replaceDigits(r.toString());
2222
- }
2223
- /**
2224
- * Returns the preferred ordering for month and year labels for the current
2225
- * locale.
2226
- */
2227
- getMonthYearOrder() {
2228
- const r = this.options.locale?.code;
2229
- return r && st.yearFirstLocales.has(r) ? "year-first" : "month-first";
2230
- }
2231
- /**
2232
- * Formats the month/year pair respecting locale conventions.
2233
- *
2234
- * @since 9.11.0
2235
- */
2236
- formatMonthYear(r) {
2237
- const { locale: n, timeZone: t, numerals: a } = this.options, i = n?.code;
2238
- if (i && st.yearFirstLocales.has(i))
2239
- try {
2240
- return new Intl.DateTimeFormat(i, {
2241
- month: "long",
2242
- year: "numeric",
2243
- timeZone: t,
2244
- numberingSystem: a
2245
- }).format(r);
2246
- } catch {
2247
- }
2248
- const u = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y";
2249
- return this.format(r, u);
2250
- }
2251
- }
2252
- st.yearFirstLocales = /* @__PURE__ */ new Set([
2253
- "eu",
2254
- "hu",
2255
- "ja",
2256
- "ja-Hira",
2257
- "ja-JP",
2258
- "ko",
2259
- "ko-KR",
2260
- "lt",
2261
- "lt-LT",
2262
- "lv",
2263
- "lv-LV",
2264
- "mn",
2265
- "mn-MN",
2266
- "zh",
2267
- "zh-CN",
2268
- "zh-HK",
2269
- "zh-TW"
2270
- ]);
2271
- new st();
2272
- const qr = Ft({
2273
- locale: void 0
2274
- });
2275
- function Kr() {
2276
- return At(qr);
2277
- }
2278
- export {
2279
- Jr as B,
2280
- Vr as _,
2281
- ce as b,
2282
- de as c,
2283
- ue as j,
2284
- Kr as x
2285
- };