@epam/statgpt-sdmx-toolkit 0.4.0-rc.40 → 0.4.0-rc.42
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/index.cjs +2 -2
- package/index.mjs +525 -512
- package/package.json +3 -3
- package/utils/download.d.ts +1 -1
package/index.mjs
CHANGED
|
@@ -41,51 +41,51 @@ function Nt(t) {
|
|
|
41
41
|
function kt(t) {
|
|
42
42
|
return {
|
|
43
43
|
isIncluded: t.include,
|
|
44
|
-
memberSelection: t.keyValues.map(
|
|
44
|
+
memberSelection: t.keyValues.map(Rt)
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Rt(t) {
|
|
48
48
|
return {
|
|
49
49
|
included: t.include,
|
|
50
50
|
componentId: t.id,
|
|
51
|
-
selectionValues: t.values.map(
|
|
51
|
+
selectionValues: t.values.map(It)
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function It(t) {
|
|
55
55
|
return {
|
|
56
56
|
memberValue: t.value
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
const _t = (t = "", e = "", n = "") => `sdmx/3.0/availability/dataflow/${t}/${e}/${n}`;
|
|
60
|
-
class
|
|
60
|
+
class qa {
|
|
61
61
|
constructor(e) {
|
|
62
62
|
this.client = e;
|
|
63
63
|
}
|
|
64
64
|
async getConstraints(e, n, r) {
|
|
65
|
-
const { agency: s, id: a, version: o } = C(e),
|
|
65
|
+
const { agency: s, id: a, version: o } = C(e), i = {
|
|
66
66
|
filters: n || [],
|
|
67
67
|
mode: nt.AVAILABLE,
|
|
68
68
|
references: le.NONE
|
|
69
|
-
},
|
|
69
|
+
}, c = _t(s, a, o);
|
|
70
70
|
if (this.client.config.sdmxProxyUrl) {
|
|
71
71
|
const u = await this.client.postRequest(
|
|
72
|
-
|
|
73
|
-
{ body:
|
|
72
|
+
c,
|
|
73
|
+
{ body: i },
|
|
74
74
|
this.client.config.sdmxProxyUrl,
|
|
75
75
|
r
|
|
76
76
|
);
|
|
77
77
|
return At(u);
|
|
78
78
|
}
|
|
79
79
|
return await this.client.postRequest(
|
|
80
|
-
|
|
81
|
-
{ body:
|
|
80
|
+
c,
|
|
81
|
+
{ body: i },
|
|
82
82
|
this.client.config.constrainsApiUrl || this.client.config.apiUrl,
|
|
83
83
|
r
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
var X = /* @__PURE__ */ ((t) => (t.CSV = "csv", t.JSON = "json", t.XML = "xml", t))(X || {}), Yt = /* @__PURE__ */ ((t) => (t.ID = "id", t.NAME = "name", t.ID_NAME = "both", t))(Yt || {}), Ct = /* @__PURE__ */ ((t) => (t.FULL_DATASET = "full", t.DATA_IN_TABLE = "query", t))(Ct || {});
|
|
88
|
-
const
|
|
88
|
+
const Lt = (t, e) => {
|
|
89
89
|
switch (t) {
|
|
90
90
|
case X.CSV:
|
|
91
91
|
return B(
|
|
@@ -107,10 +107,10 @@ const St = (t, e) => {
|
|
|
107
107
|
}
|
|
108
108
|
}, B = (t, e) => `${t}; labels=${e}`;
|
|
109
109
|
var rt = /* @__PURE__ */ ((t) => (t.REFERENCE_PARTIAL = "referencepartial", t.FULL = "full", t))(rt || {});
|
|
110
|
-
const
|
|
111
|
-
const { filterKey: r, timeFilter: s } = n, { agency: a, id: o, version:
|
|
112
|
-
return `${`${$t}/${a}/${o}/${
|
|
113
|
-
},
|
|
110
|
+
const St = "all", $t = "sdmx/3.0/data/dataflow", st = "&", _e = ":", Wt = "=", qt = "+", Ua = ",", Ut = "*", Ye = (t, e, n) => {
|
|
111
|
+
const { filterKey: r, timeFilter: s } = n, { agency: a, id: o, version: i } = C(t), c = [s || "", e].filter((d) => !!d).join(st);
|
|
112
|
+
return `${`${$t}/${a}/${o}/${i}`}/${r || Ut}?${c}`;
|
|
113
|
+
}, Ht = (t = "", e = "", n = "", r = le.DESCENDANTS) => `sdmx/3.0/structure/dataflow/${t}/${e}/${n}?references=${r}&detail=${rt.REFERENCE_PARTIAL}`;
|
|
114
114
|
class Ha {
|
|
115
115
|
constructor(e) {
|
|
116
116
|
this.client = e;
|
|
@@ -118,7 +118,7 @@ class Ha {
|
|
|
118
118
|
async getDataSet(e, n, r) {
|
|
119
119
|
const { agency: s, id: a, version: o } = C(e);
|
|
120
120
|
return await this.client.getRequest(
|
|
121
|
-
|
|
121
|
+
Ht(s, a, o, n),
|
|
122
122
|
void 0,
|
|
123
123
|
r
|
|
124
124
|
);
|
|
@@ -127,7 +127,7 @@ class Ha {
|
|
|
127
127
|
const s = new URLSearchParams({
|
|
128
128
|
includeHistory: "false",
|
|
129
129
|
limit: "1000",
|
|
130
|
-
attributes:
|
|
130
|
+
attributes: St,
|
|
131
131
|
dimensionAtObservation: "TIME_PERIOD"
|
|
132
132
|
// TODO: use time dimensions
|
|
133
133
|
}).toString(), a = Ye(e, s, n);
|
|
@@ -137,11 +137,11 @@ class Ha {
|
|
|
137
137
|
r
|
|
138
138
|
);
|
|
139
139
|
}
|
|
140
|
-
async downloadDataSet(e, n, r, s, a, o,
|
|
140
|
+
async downloadDataSet(e, n, r, s, a, o, i = !1, c) {
|
|
141
141
|
const u = new URLSearchParams({
|
|
142
142
|
format: n,
|
|
143
143
|
compress: "false",
|
|
144
|
-
attributes:
|
|
144
|
+
attributes: i ? "all" : "none",
|
|
145
145
|
limit: "1000"
|
|
146
146
|
}).toString(), d = Ye(e, u, a);
|
|
147
147
|
return this.client.streamRequest(
|
|
@@ -149,24 +149,24 @@ class Ha {
|
|
|
149
149
|
{
|
|
150
150
|
method: "GET",
|
|
151
151
|
headers: {
|
|
152
|
-
Accept:
|
|
152
|
+
Accept: Lt(n, s),
|
|
153
153
|
"Accept-language": r
|
|
154
154
|
}
|
|
155
155
|
},
|
|
156
156
|
o,
|
|
157
|
-
|
|
157
|
+
c
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
const
|
|
161
|
+
const Qt = (t, e) => t.error || t.message || `${e.status} ${e.statusText}`, Ft = "application/json", Bt = "Content-Type", j = "Api-Key", Vt = "X-CONVERSATION-ID", z = "Ocp-Apim-Subscription-Key";
|
|
162
162
|
class Ce extends Error {
|
|
163
163
|
constructor(e) {
|
|
164
164
|
super(e.message), this.isHttpError = !0, this.name = "HttpError", this.code = e.code, this.status = e.status, this.details = e.details, this.displayMessage = e.displayMessage;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
const at = 6048e5, Gt = 864e5, fe = 6e4, me = 36e5, Xt = 1e3,
|
|
167
|
+
const at = 6048e5, Gt = 864e5, fe = 6e4, me = 36e5, Xt = 1e3, Le = /* @__PURE__ */ Symbol.for("constructDateFrom");
|
|
168
168
|
function E(t, e) {
|
|
169
|
-
return typeof t == "function" ? t(e) : t && typeof t == "object" &&
|
|
169
|
+
return typeof t == "function" ? t(e) : t && typeof t == "object" && Le in t ? t[Le](e) : t instanceof Date ? new t.constructor(e) : new Date(e);
|
|
170
170
|
}
|
|
171
171
|
function p(t, e) {
|
|
172
172
|
return E(e || t, t);
|
|
@@ -183,16 +183,16 @@ function _(t, e) {
|
|
|
183
183
|
const n = $(), r = e?.weekStartsOn ?? e?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, s = p(t, e?.in), a = s.getDay(), o = (a < r ? 7 : 0) + a - r;
|
|
184
184
|
return s.setDate(s.getDate() - o), s.setHours(0, 0, 0, 0), s;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function S(t, e) {
|
|
187
187
|
return _(t, { ...e, weekStartsOn: 1 });
|
|
188
188
|
}
|
|
189
189
|
function it(t, e) {
|
|
190
190
|
const n = p(t, e?.in), r = n.getFullYear(), s = E(n, 0);
|
|
191
191
|
s.setFullYear(r + 1, 0, 4), s.setHours(0, 0, 0, 0);
|
|
192
|
-
const a =
|
|
192
|
+
const a = S(s), o = E(n, 0);
|
|
193
193
|
o.setFullYear(r, 0, 4), o.setHours(0, 0, 0, 0);
|
|
194
|
-
const
|
|
195
|
-
return n.getTime() >= a.getTime() ? r + 1 : n.getTime() >=
|
|
194
|
+
const i = S(o);
|
|
195
|
+
return n.getTime() >= a.getTime() ? r + 1 : n.getTime() >= i.getTime() ? r : r - 1;
|
|
196
196
|
}
|
|
197
197
|
function J(t) {
|
|
198
198
|
const e = p(t), n = new Date(
|
|
@@ -215,7 +215,7 @@ function zt(t, ...e) {
|
|
|
215
215
|
);
|
|
216
216
|
return e.map(n);
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function Se(t, e) {
|
|
219
219
|
const n = p(t, e?.in);
|
|
220
220
|
return n.setHours(0, 0, 0, 0), n;
|
|
221
221
|
}
|
|
@@ -224,12 +224,12 @@ function Kt(t, e, n) {
|
|
|
224
224
|
n?.in,
|
|
225
225
|
t,
|
|
226
226
|
e
|
|
227
|
-
), a =
|
|
228
|
-
return Math.round((
|
|
227
|
+
), a = Se(r), o = Se(s), i = +a - J(a), c = +o - J(o);
|
|
228
|
+
return Math.round((i - c) / Gt);
|
|
229
229
|
}
|
|
230
230
|
function Jt(t, e) {
|
|
231
231
|
const n = it(t, e), r = E(t, 0);
|
|
232
|
-
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0),
|
|
232
|
+
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), S(r);
|
|
233
233
|
}
|
|
234
234
|
function Zt(t) {
|
|
235
235
|
return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
|
|
@@ -350,16 +350,16 @@ const rn = {
|
|
|
350
350
|
nextWeek: "eeee 'at' p",
|
|
351
351
|
other: "P"
|
|
352
352
|
}, un = (t, e, n, r) => cn[t];
|
|
353
|
-
function
|
|
353
|
+
function U(t) {
|
|
354
354
|
return (e, n) => {
|
|
355
355
|
const r = n?.context ? String(n.context) : "standalone";
|
|
356
356
|
let s;
|
|
357
357
|
if (r === "formatting" && t.formattingValues) {
|
|
358
|
-
const o = t.defaultFormattingWidth || t.defaultWidth,
|
|
359
|
-
s = t.formattingValues[
|
|
358
|
+
const o = t.defaultFormattingWidth || t.defaultWidth, i = n?.width ? String(n.width) : o;
|
|
359
|
+
s = t.formattingValues[i] || t.formattingValues[o];
|
|
360
360
|
} else {
|
|
361
|
-
const o = t.defaultWidth,
|
|
362
|
-
s = t.values[
|
|
361
|
+
const o = t.defaultWidth, i = n?.width ? String(n.width) : t.defaultWidth;
|
|
362
|
+
s = t.values[i] || t.values[o];
|
|
363
363
|
}
|
|
364
364
|
const a = t.argumentCallback ? t.argumentCallback(e) : e;
|
|
365
365
|
return s[a];
|
|
@@ -492,41 +492,41 @@ const dn = {
|
|
|
492
492
|
return n + "th";
|
|
493
493
|
}, yn = {
|
|
494
494
|
ordinalNumber: wn,
|
|
495
|
-
era:
|
|
495
|
+
era: U({
|
|
496
496
|
values: dn,
|
|
497
497
|
defaultWidth: "wide"
|
|
498
498
|
}),
|
|
499
|
-
quarter:
|
|
499
|
+
quarter: U({
|
|
500
500
|
values: ln,
|
|
501
501
|
defaultWidth: "wide",
|
|
502
502
|
argumentCallback: (t) => t - 1
|
|
503
503
|
}),
|
|
504
|
-
month:
|
|
504
|
+
month: U({
|
|
505
505
|
values: fn,
|
|
506
506
|
defaultWidth: "wide"
|
|
507
507
|
}),
|
|
508
|
-
day:
|
|
508
|
+
day: U({
|
|
509
509
|
values: mn,
|
|
510
510
|
defaultWidth: "wide"
|
|
511
511
|
}),
|
|
512
|
-
dayPeriod:
|
|
512
|
+
dayPeriod: U({
|
|
513
513
|
values: hn,
|
|
514
514
|
defaultWidth: "wide",
|
|
515
515
|
formattingValues: gn,
|
|
516
516
|
defaultFormattingWidth: "wide"
|
|
517
517
|
})
|
|
518
518
|
};
|
|
519
|
-
function
|
|
519
|
+
function H(t) {
|
|
520
520
|
return (e, n = {}) => {
|
|
521
521
|
const r = n.width, s = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], a = e.match(s);
|
|
522
522
|
if (!a)
|
|
523
523
|
return null;
|
|
524
|
-
const o = a[0],
|
|
524
|
+
const o = a[0], i = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], c = Array.isArray(i) ? bn(i, (l) => l.test(o)) : (
|
|
525
525
|
// [TODO] -- I challenge you to fix the type
|
|
526
|
-
pn(
|
|
526
|
+
pn(i, (l) => l.test(o))
|
|
527
527
|
);
|
|
528
528
|
let u;
|
|
529
|
-
u = t.valueCallback ? t.valueCallback(
|
|
529
|
+
u = t.valueCallback ? t.valueCallback(c) : c, u = n.valueCallback ? (
|
|
530
530
|
// [TODO] -- I challenge you to fix the type
|
|
531
531
|
n.valueCallback(u)
|
|
532
532
|
) : u;
|
|
@@ -552,8 +552,8 @@ function Dn(t) {
|
|
|
552
552
|
if (!a) return null;
|
|
553
553
|
let o = t.valueCallback ? t.valueCallback(a[0]) : a[0];
|
|
554
554
|
o = n.valueCallback ? n.valueCallback(o) : o;
|
|
555
|
-
const
|
|
556
|
-
return { value: o, rest:
|
|
555
|
+
const i = e.slice(s.length);
|
|
556
|
+
return { value: o, rest: i };
|
|
557
557
|
};
|
|
558
558
|
}
|
|
559
559
|
const Tn = /^(\d+)(th|st|nd|rd)?/i, En = /\d+/i, xn = {
|
|
@@ -609,10 +609,10 @@ const Tn = /^(\d+)(th|st|nd|rd)?/i, En = /\d+/i, xn = {
|
|
|
609
609
|
}, kn = {
|
|
610
610
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
611
611
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
612
|
-
},
|
|
612
|
+
}, Rn = {
|
|
613
613
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
614
614
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
615
|
-
},
|
|
615
|
+
}, In = {
|
|
616
616
|
any: {
|
|
617
617
|
am: /^a/i,
|
|
618
618
|
pm: /^p/i,
|
|
@@ -629,35 +629,35 @@ const Tn = /^(\d+)(th|st|nd|rd)?/i, En = /\d+/i, xn = {
|
|
|
629
629
|
parsePattern: En,
|
|
630
630
|
valueCallback: (t) => parseInt(t, 10)
|
|
631
631
|
}),
|
|
632
|
-
era:
|
|
632
|
+
era: H({
|
|
633
633
|
matchPatterns: xn,
|
|
634
634
|
defaultMatchWidth: "wide",
|
|
635
635
|
parsePatterns: Pn,
|
|
636
636
|
defaultParseWidth: "any"
|
|
637
637
|
}),
|
|
638
|
-
quarter:
|
|
638
|
+
quarter: H({
|
|
639
639
|
matchPatterns: vn,
|
|
640
640
|
defaultMatchWidth: "wide",
|
|
641
641
|
parsePatterns: Mn,
|
|
642
642
|
defaultParseWidth: "any",
|
|
643
643
|
valueCallback: (t) => t + 1
|
|
644
644
|
}),
|
|
645
|
-
month:
|
|
645
|
+
month: H({
|
|
646
646
|
matchPatterns: On,
|
|
647
647
|
defaultMatchWidth: "wide",
|
|
648
648
|
parsePatterns: An,
|
|
649
649
|
defaultParseWidth: "any"
|
|
650
650
|
}),
|
|
651
|
-
day:
|
|
651
|
+
day: H({
|
|
652
652
|
matchPatterns: Nn,
|
|
653
653
|
defaultMatchWidth: "wide",
|
|
654
654
|
parsePatterns: kn,
|
|
655
655
|
defaultParseWidth: "any"
|
|
656
656
|
}),
|
|
657
|
-
dayPeriod:
|
|
658
|
-
matchPatterns:
|
|
657
|
+
dayPeriod: H({
|
|
658
|
+
matchPatterns: Rn,
|
|
659
659
|
defaultMatchWidth: "any",
|
|
660
|
-
parsePatterns:
|
|
660
|
+
parsePatterns: In,
|
|
661
661
|
defaultParseWidth: "any"
|
|
662
662
|
})
|
|
663
663
|
}, ct = {
|
|
@@ -677,16 +677,16 @@ function Yn(t, e) {
|
|
|
677
677
|
return Kt(n, en(n)) + 1;
|
|
678
678
|
}
|
|
679
679
|
function ut(t, e) {
|
|
680
|
-
const n = p(t, e?.in), r = +
|
|
680
|
+
const n = p(t, e?.in), r = +S(n) - +Jt(n);
|
|
681
681
|
return Math.round(r / at) + 1;
|
|
682
682
|
}
|
|
683
683
|
function he(t, e) {
|
|
684
684
|
const n = p(t, e?.in), r = n.getFullYear(), s = $(), a = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? s.firstWeekContainsDate ?? s.locale?.options?.firstWeekContainsDate ?? 1, o = E(e?.in || t, 0);
|
|
685
685
|
o.setFullYear(r + 1, 0, a), o.setHours(0, 0, 0, 0);
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
const u = _(
|
|
689
|
-
return +n >= +
|
|
686
|
+
const i = _(o, e), c = E(e?.in || t, 0);
|
|
687
|
+
c.setFullYear(r, 0, a), c.setHours(0, 0, 0, 0);
|
|
688
|
+
const u = _(c, e);
|
|
689
|
+
return +n >= +i ? r + 1 : +n >= +u ? r : r - 1;
|
|
690
690
|
}
|
|
691
691
|
function Cn(t, e) {
|
|
692
692
|
const n = $(), r = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, s = he(t, e), a = E(e?.in || t, 0);
|
|
@@ -696,7 +696,7 @@ function dt(t, e) {
|
|
|
696
696
|
const n = p(t, e?.in), r = +_(n, e) - +Cn(n, e);
|
|
697
697
|
return Math.round(r / at) + 1;
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function g(t, e) {
|
|
700
700
|
const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
|
|
701
701
|
return n + r;
|
|
702
702
|
}
|
|
@@ -704,16 +704,16 @@ const k = {
|
|
|
704
704
|
// Year
|
|
705
705
|
y(t, e) {
|
|
706
706
|
const n = t.getFullYear(), r = n > 0 ? n : 1 - n;
|
|
707
|
-
return
|
|
707
|
+
return g(e === "yy" ? r % 100 : r, e.length);
|
|
708
708
|
},
|
|
709
709
|
// Month
|
|
710
710
|
M(t, e) {
|
|
711
711
|
const n = t.getMonth();
|
|
712
|
-
return e === "M" ? String(n + 1) :
|
|
712
|
+
return e === "M" ? String(n + 1) : g(n + 1, 2);
|
|
713
713
|
},
|
|
714
714
|
// Day of the month
|
|
715
715
|
d(t, e) {
|
|
716
|
-
return
|
|
716
|
+
return g(t.getDate(), e.length);
|
|
717
717
|
},
|
|
718
718
|
// AM or PM
|
|
719
719
|
a(t, e) {
|
|
@@ -732,28 +732,28 @@ const k = {
|
|
|
732
732
|
},
|
|
733
733
|
// Hour [1-12]
|
|
734
734
|
h(t, e) {
|
|
735
|
-
return
|
|
735
|
+
return g(t.getHours() % 12 || 12, e.length);
|
|
736
736
|
},
|
|
737
737
|
// Hour [0-23]
|
|
738
738
|
H(t, e) {
|
|
739
|
-
return
|
|
739
|
+
return g(t.getHours(), e.length);
|
|
740
740
|
},
|
|
741
741
|
// Minute
|
|
742
742
|
m(t, e) {
|
|
743
|
-
return
|
|
743
|
+
return g(t.getMinutes(), e.length);
|
|
744
744
|
},
|
|
745
745
|
// Second
|
|
746
746
|
s(t, e) {
|
|
747
|
-
return
|
|
747
|
+
return g(t.getSeconds(), e.length);
|
|
748
748
|
},
|
|
749
749
|
// Fraction of second
|
|
750
750
|
S(t, e) {
|
|
751
751
|
const n = e.length, r = t.getMilliseconds(), s = Math.trunc(
|
|
752
752
|
r * Math.pow(10, n - 3)
|
|
753
753
|
);
|
|
754
|
-
return
|
|
754
|
+
return g(s, e.length);
|
|
755
755
|
}
|
|
756
|
-
},
|
|
756
|
+
}, L = {
|
|
757
757
|
midnight: "midnight",
|
|
758
758
|
noon: "noon",
|
|
759
759
|
morning: "morning",
|
|
@@ -790,14 +790,14 @@ const k = {
|
|
|
790
790
|
const s = he(t, r), a = s > 0 ? s : 1 - s;
|
|
791
791
|
if (e === "YY") {
|
|
792
792
|
const o = a % 100;
|
|
793
|
-
return
|
|
793
|
+
return g(o, 2);
|
|
794
794
|
}
|
|
795
|
-
return e === "Yo" ? n.ordinalNumber(a, { unit: "year" }) :
|
|
795
|
+
return e === "Yo" ? n.ordinalNumber(a, { unit: "year" }) : g(a, e.length);
|
|
796
796
|
},
|
|
797
797
|
// ISO week-numbering year
|
|
798
798
|
R: function(t, e) {
|
|
799
799
|
const n = it(t);
|
|
800
|
-
return
|
|
800
|
+
return g(n, e.length);
|
|
801
801
|
},
|
|
802
802
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
803
803
|
// The main difference between `y` and `u` localizers are B.C. years:
|
|
@@ -810,7 +810,7 @@ const k = {
|
|
|
810
810
|
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
811
811
|
u: function(t, e) {
|
|
812
812
|
const n = t.getFullYear();
|
|
813
|
-
return
|
|
813
|
+
return g(n, e.length);
|
|
814
814
|
},
|
|
815
815
|
// Quarter
|
|
816
816
|
Q: function(t, e, n) {
|
|
@@ -821,7 +821,7 @@ const k = {
|
|
|
821
821
|
return String(r);
|
|
822
822
|
// 01, 02, 03, 04
|
|
823
823
|
case "QQ":
|
|
824
|
-
return
|
|
824
|
+
return g(r, 2);
|
|
825
825
|
// 1st, 2nd, 3rd, 4th
|
|
826
826
|
case "Qo":
|
|
827
827
|
return n.ordinalNumber(r, { unit: "quarter" });
|
|
@@ -853,7 +853,7 @@ const k = {
|
|
|
853
853
|
return String(r);
|
|
854
854
|
// 01, 02, 03, 04
|
|
855
855
|
case "qq":
|
|
856
|
-
return
|
|
856
|
+
return g(r, 2);
|
|
857
857
|
// 1st, 2nd, 3rd, 4th
|
|
858
858
|
case "qo":
|
|
859
859
|
return n.ordinalNumber(r, { unit: "quarter" });
|
|
@@ -911,7 +911,7 @@ const k = {
|
|
|
911
911
|
return String(r + 1);
|
|
912
912
|
// 01, 02, ..., 12
|
|
913
913
|
case "LL":
|
|
914
|
-
return
|
|
914
|
+
return g(r + 1, 2);
|
|
915
915
|
// 1st, 2nd, ..., 12th
|
|
916
916
|
case "Lo":
|
|
917
917
|
return n.ordinalNumber(r + 1, { unit: "month" });
|
|
@@ -934,12 +934,12 @@ const k = {
|
|
|
934
934
|
// Local week of year
|
|
935
935
|
w: function(t, e, n, r) {
|
|
936
936
|
const s = dt(t, r);
|
|
937
|
-
return e === "wo" ? n.ordinalNumber(s, { unit: "week" }) :
|
|
937
|
+
return e === "wo" ? n.ordinalNumber(s, { unit: "week" }) : g(s, e.length);
|
|
938
938
|
},
|
|
939
939
|
// ISO week of year
|
|
940
940
|
I: function(t, e, n) {
|
|
941
941
|
const r = ut(t);
|
|
942
|
-
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) :
|
|
942
|
+
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) : g(r, e.length);
|
|
943
943
|
},
|
|
944
944
|
// Day of the month
|
|
945
945
|
d: function(t, e, n) {
|
|
@@ -948,7 +948,7 @@ const k = {
|
|
|
948
948
|
// Day of year
|
|
949
949
|
D: function(t, e, n) {
|
|
950
950
|
const r = Yn(t);
|
|
951
|
-
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) :
|
|
951
|
+
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : g(r, e.length);
|
|
952
952
|
},
|
|
953
953
|
// Day of week
|
|
954
954
|
E: function(t, e, n) {
|
|
@@ -990,7 +990,7 @@ const k = {
|
|
|
990
990
|
return String(a);
|
|
991
991
|
// Padded numerical value
|
|
992
992
|
case "ee":
|
|
993
|
-
return
|
|
993
|
+
return g(a, 2);
|
|
994
994
|
// 1st, 2nd, ..., 7th
|
|
995
995
|
case "eo":
|
|
996
996
|
return n.ordinalNumber(a, { unit: "day" });
|
|
@@ -1027,7 +1027,7 @@ const k = {
|
|
|
1027
1027
|
return String(a);
|
|
1028
1028
|
// Padded numerical value
|
|
1029
1029
|
case "cc":
|
|
1030
|
-
return
|
|
1030
|
+
return g(a, e.length);
|
|
1031
1031
|
// 1st, 2nd, ..., 7th
|
|
1032
1032
|
case "co":
|
|
1033
1033
|
return n.ordinalNumber(a, { unit: "day" });
|
|
@@ -1064,7 +1064,7 @@ const k = {
|
|
|
1064
1064
|
return String(s);
|
|
1065
1065
|
// 02
|
|
1066
1066
|
case "ii":
|
|
1067
|
-
return
|
|
1067
|
+
return g(s, e.length);
|
|
1068
1068
|
// 2nd
|
|
1069
1069
|
case "io":
|
|
1070
1070
|
return n.ordinalNumber(s, { unit: "day" });
|
|
@@ -1124,7 +1124,7 @@ const k = {
|
|
|
1124
1124
|
b: function(t, e, n) {
|
|
1125
1125
|
const r = t.getHours();
|
|
1126
1126
|
let s;
|
|
1127
|
-
switch (r === 12 ? s =
|
|
1127
|
+
switch (r === 12 ? s = L.noon : r === 0 ? s = L.midnight : s = r / 12 >= 1 ? "pm" : "am", e) {
|
|
1128
1128
|
case "b":
|
|
1129
1129
|
case "bb":
|
|
1130
1130
|
return n.dayPeriod(s, {
|
|
@@ -1152,7 +1152,7 @@ const k = {
|
|
|
1152
1152
|
B: function(t, e, n) {
|
|
1153
1153
|
const r = t.getHours();
|
|
1154
1154
|
let s;
|
|
1155
|
-
switch (r >= 17 ? s =
|
|
1155
|
+
switch (r >= 17 ? s = L.evening : r >= 12 ? s = L.afternoon : r >= 4 ? s = L.morning : s = L.night, e) {
|
|
1156
1156
|
case "B":
|
|
1157
1157
|
case "BB":
|
|
1158
1158
|
case "BBB":
|
|
@@ -1187,12 +1187,12 @@ const k = {
|
|
|
1187
1187
|
// Hour [0-11]
|
|
1188
1188
|
K: function(t, e, n) {
|
|
1189
1189
|
const r = t.getHours() % 12;
|
|
1190
|
-
return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) :
|
|
1190
|
+
return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : g(r, e.length);
|
|
1191
1191
|
},
|
|
1192
1192
|
// Hour [1-24]
|
|
1193
1193
|
k: function(t, e, n) {
|
|
1194
1194
|
let r = t.getHours();
|
|
1195
|
-
return r === 0 && (r = 24), e === "ko" ? n.ordinalNumber(r, { unit: "hour" }) :
|
|
1195
|
+
return r === 0 && (r = 24), e === "ko" ? n.ordinalNumber(r, { unit: "hour" }) : g(r, e.length);
|
|
1196
1196
|
},
|
|
1197
1197
|
// Minute
|
|
1198
1198
|
m: function(t, e, n) {
|
|
@@ -1273,25 +1273,25 @@ const k = {
|
|
|
1273
1273
|
// Seconds timestamp
|
|
1274
1274
|
t: function(t, e, n) {
|
|
1275
1275
|
const r = Math.trunc(+t / 1e3);
|
|
1276
|
-
return
|
|
1276
|
+
return g(r, e.length);
|
|
1277
1277
|
},
|
|
1278
1278
|
// Milliseconds timestamp
|
|
1279
1279
|
T: function(t, e, n) {
|
|
1280
|
-
return
|
|
1280
|
+
return g(+t, e.length);
|
|
1281
1281
|
}
|
|
1282
1282
|
};
|
|
1283
1283
|
function We(t, e = "") {
|
|
1284
1284
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), s = Math.trunc(r / 60), a = r % 60;
|
|
1285
|
-
return a === 0 ? n + String(s) : n + String(s) + e +
|
|
1285
|
+
return a === 0 ? n + String(s) : n + String(s) + e + g(a, 2);
|
|
1286
1286
|
}
|
|
1287
1287
|
function qe(t, e) {
|
|
1288
|
-
return t % 60 === 0 ? (t > 0 ? "-" : "+") +
|
|
1288
|
+
return t % 60 === 0 ? (t > 0 ? "-" : "+") + g(Math.abs(t) / 60, 2) : Y(t, e);
|
|
1289
1289
|
}
|
|
1290
1290
|
function Y(t, e = "") {
|
|
1291
|
-
const n = t > 0 ? "-" : "+", r = Math.abs(t), s =
|
|
1291
|
+
const n = t > 0 ? "-" : "+", r = Math.abs(t), s = g(Math.trunc(r / 60), 2), a = g(r % 60, 2);
|
|
1292
1292
|
return n + s + e + a;
|
|
1293
1293
|
}
|
|
1294
|
-
const
|
|
1294
|
+
const Ue = (t, e) => {
|
|
1295
1295
|
switch (t) {
|
|
1296
1296
|
case "P":
|
|
1297
1297
|
return e.date({ width: "short" });
|
|
@@ -1313,10 +1313,10 @@ const He = (t, e) => {
|
|
|
1313
1313
|
default:
|
|
1314
1314
|
return e.time({ width: "full" });
|
|
1315
1315
|
}
|
|
1316
|
-
},
|
|
1316
|
+
}, Ln = (t, e) => {
|
|
1317
1317
|
const n = t.match(/(P+)(p+)?/) || [], r = n[1], s = n[2];
|
|
1318
1318
|
if (!s)
|
|
1319
|
-
return
|
|
1319
|
+
return Ue(t, e);
|
|
1320
1320
|
let a;
|
|
1321
1321
|
switch (r) {
|
|
1322
1322
|
case "P":
|
|
@@ -1332,13 +1332,13 @@ const He = (t, e) => {
|
|
|
1332
1332
|
a = e.dateTime({ width: "full" });
|
|
1333
1333
|
break;
|
|
1334
1334
|
}
|
|
1335
|
-
return a.replace("{{date}}",
|
|
1335
|
+
return a.replace("{{date}}", Ue(r, e)).replace("{{time}}", lt(s, e));
|
|
1336
1336
|
}, se = {
|
|
1337
1337
|
p: lt,
|
|
1338
|
-
P:
|
|
1339
|
-
},
|
|
1338
|
+
P: Ln
|
|
1339
|
+
}, Sn = /^D+$/, $n = /^Y+$/, Wn = ["D", "DD", "YY", "YYYY"];
|
|
1340
1340
|
function ft(t) {
|
|
1341
|
-
return
|
|
1341
|
+
return Sn.test(t);
|
|
1342
1342
|
}
|
|
1343
1343
|
function mt(t) {
|
|
1344
1344
|
return $n.test(t);
|
|
@@ -1351,19 +1351,19 @@ function qn(t, e, n) {
|
|
|
1351
1351
|
const r = t[0] === "Y" ? "years" : "days of the month";
|
|
1352
1352
|
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`;
|
|
1353
1353
|
}
|
|
1354
|
-
const
|
|
1354
|
+
const Un = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Hn = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Qn = /^'([^]*?)'?$/, Fn = /''/g, Bn = /[a-zA-Z]/;
|
|
1355
1355
|
function Vn(t, e, n) {
|
|
1356
|
-
const r = $(), s = r.locale ?? ct, a = r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, o = r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0,
|
|
1357
|
-
if (!re(
|
|
1356
|
+
const r = $(), s = r.locale ?? ct, a = r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, o = r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, i = p(t, n?.in);
|
|
1357
|
+
if (!re(i))
|
|
1358
1358
|
throw new RangeError("Invalid time value");
|
|
1359
|
-
let
|
|
1359
|
+
let c = e.match(Hn).map((d) => {
|
|
1360
1360
|
const l = d[0];
|
|
1361
1361
|
if (l === "p" || l === "P") {
|
|
1362
|
-
const
|
|
1363
|
-
return
|
|
1362
|
+
const m = se[l];
|
|
1363
|
+
return m(d, s.formatLong);
|
|
1364
1364
|
}
|
|
1365
1365
|
return d;
|
|
1366
|
-
}).join("").match(
|
|
1366
|
+
}).join("").match(Un).map((d) => {
|
|
1367
1367
|
if (d === "''")
|
|
1368
1368
|
return { isToken: !1, value: "'" };
|
|
1369
1369
|
const l = d[0];
|
|
@@ -1377,23 +1377,23 @@ function Vn(t, e, n) {
|
|
|
1377
1377
|
);
|
|
1378
1378
|
return { isToken: !1, value: d };
|
|
1379
1379
|
});
|
|
1380
|
-
s.localize.preprocessor && (
|
|
1380
|
+
s.localize.preprocessor && (c = s.localize.preprocessor(i, c));
|
|
1381
1381
|
const u = {
|
|
1382
1382
|
firstWeekContainsDate: a,
|
|
1383
1383
|
weekStartsOn: o,
|
|
1384
1384
|
locale: s
|
|
1385
1385
|
};
|
|
1386
|
-
return
|
|
1386
|
+
return c.map((d) => {
|
|
1387
1387
|
if (!d.isToken) return d.value;
|
|
1388
1388
|
const l = d.value;
|
|
1389
1389
|
(mt(l) || ft(l)) && ae(l, e, String(t));
|
|
1390
|
-
const
|
|
1391
|
-
return
|
|
1390
|
+
const m = $e[l[0]];
|
|
1391
|
+
return m(i, l, s.localize, u);
|
|
1392
1392
|
}).join("");
|
|
1393
1393
|
}
|
|
1394
1394
|
function Gn(t) {
|
|
1395
|
-
const e = t.match(
|
|
1396
|
-
return e ? e[1].replace(
|
|
1395
|
+
const e = t.match(Qn);
|
|
1396
|
+
return e ? e[1].replace(Fn, "'") : t;
|
|
1397
1397
|
}
|
|
1398
1398
|
function Xn() {
|
|
1399
1399
|
return Object.assign({}, $());
|
|
@@ -1442,7 +1442,7 @@ class er extends ht {
|
|
|
1442
1442
|
return n.timestampIsSet ? e : E(e, zn(e, this.context));
|
|
1443
1443
|
}
|
|
1444
1444
|
}
|
|
1445
|
-
class
|
|
1445
|
+
class h {
|
|
1446
1446
|
run(e, n, r, s) {
|
|
1447
1447
|
const a = this.parse(e, n, r, s);
|
|
1448
1448
|
return a ? {
|
|
@@ -1460,7 +1460,7 @@ class m {
|
|
|
1460
1460
|
return !0;
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
|
-
class tr extends
|
|
1463
|
+
class tr extends h {
|
|
1464
1464
|
priority = 140;
|
|
1465
1465
|
parse(e, n, r) {
|
|
1466
1466
|
switch (n) {
|
|
@@ -1605,15 +1605,15 @@ function wt(t, e) {
|
|
|
1605
1605
|
if (r <= 50)
|
|
1606
1606
|
s = t || 100;
|
|
1607
1607
|
else {
|
|
1608
|
-
const a = r + 50, o = Math.trunc(a / 100) * 100,
|
|
1609
|
-
s = t + o - (
|
|
1608
|
+
const a = r + 50, o = Math.trunc(a / 100) * 100, i = t >= a % 100;
|
|
1609
|
+
s = t + o - (i ? 100 : 0);
|
|
1610
1610
|
}
|
|
1611
1611
|
return n ? s : 1 - s;
|
|
1612
1612
|
}
|
|
1613
1613
|
function yt(t) {
|
|
1614
1614
|
return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
|
|
1615
1615
|
}
|
|
1616
|
-
class nr extends
|
|
1616
|
+
class nr extends h {
|
|
1617
1617
|
priority = 130;
|
|
1618
1618
|
incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"];
|
|
1619
1619
|
parse(e, n, r) {
|
|
@@ -1651,7 +1651,7 @@ class nr extends m {
|
|
|
1651
1651
|
return e.setFullYear(a, 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
1652
1652
|
}
|
|
1653
1653
|
}
|
|
1654
|
-
class rr extends
|
|
1654
|
+
class rr extends h {
|
|
1655
1655
|
priority = 130;
|
|
1656
1656
|
parse(e, n, r) {
|
|
1657
1657
|
const s = (a) => ({
|
|
@@ -1678,12 +1678,12 @@ class rr extends m {
|
|
|
1678
1678
|
set(e, n, r, s) {
|
|
1679
1679
|
const a = he(e, s);
|
|
1680
1680
|
if (r.isTwoDigitYear) {
|
|
1681
|
-
const
|
|
1681
|
+
const i = wt(
|
|
1682
1682
|
r.year,
|
|
1683
1683
|
a
|
|
1684
1684
|
);
|
|
1685
1685
|
return e.setFullYear(
|
|
1686
|
-
|
|
1686
|
+
i,
|
|
1687
1687
|
0,
|
|
1688
1688
|
s.firstWeekContainsDate
|
|
1689
1689
|
), e.setHours(0, 0, 0, 0), _(e, s);
|
|
@@ -1707,14 +1707,14 @@ class rr extends m {
|
|
|
1707
1707
|
"T"
|
|
1708
1708
|
];
|
|
1709
1709
|
}
|
|
1710
|
-
class sr extends
|
|
1710
|
+
class sr extends h {
|
|
1711
1711
|
priority = 130;
|
|
1712
1712
|
parse(e, n) {
|
|
1713
1713
|
return Z(n === "R" ? 4 : n.length, e);
|
|
1714
1714
|
}
|
|
1715
1715
|
set(e, n, r) {
|
|
1716
1716
|
const s = E(e, 0);
|
|
1717
|
-
return s.setFullYear(r, 0, 4), s.setHours(0, 0, 0, 0),
|
|
1717
|
+
return s.setFullYear(r, 0, 4), s.setHours(0, 0, 0, 0), S(s);
|
|
1718
1718
|
}
|
|
1719
1719
|
incompatibleTokens = [
|
|
1720
1720
|
"G",
|
|
@@ -1734,7 +1734,7 @@ class sr extends m {
|
|
|
1734
1734
|
"T"
|
|
1735
1735
|
];
|
|
1736
1736
|
}
|
|
1737
|
-
class ar extends
|
|
1737
|
+
class ar extends h {
|
|
1738
1738
|
priority = 130;
|
|
1739
1739
|
parse(e, n) {
|
|
1740
1740
|
return Z(n === "u" ? 4 : n.length, e);
|
|
@@ -1744,7 +1744,7 @@ class ar extends m {
|
|
|
1744
1744
|
}
|
|
1745
1745
|
incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"];
|
|
1746
1746
|
}
|
|
1747
|
-
class or extends
|
|
1747
|
+
class or extends h {
|
|
1748
1748
|
priority = 120;
|
|
1749
1749
|
parse(e, n, r) {
|
|
1750
1750
|
switch (n) {
|
|
@@ -1806,7 +1806,7 @@ class or extends m {
|
|
|
1806
1806
|
"T"
|
|
1807
1807
|
];
|
|
1808
1808
|
}
|
|
1809
|
-
class ir extends
|
|
1809
|
+
class ir extends h {
|
|
1810
1810
|
priority = 120;
|
|
1811
1811
|
parse(e, n, r) {
|
|
1812
1812
|
switch (n) {
|
|
@@ -1868,7 +1868,7 @@ class ir extends m {
|
|
|
1868
1868
|
"T"
|
|
1869
1869
|
];
|
|
1870
1870
|
}
|
|
1871
|
-
class cr extends
|
|
1871
|
+
class cr extends h {
|
|
1872
1872
|
incompatibleTokens = [
|
|
1873
1873
|
"Y",
|
|
1874
1874
|
"R",
|
|
@@ -1931,7 +1931,7 @@ class cr extends m {
|
|
|
1931
1931
|
return e.setMonth(r, 1), e.setHours(0, 0, 0, 0), e;
|
|
1932
1932
|
}
|
|
1933
1933
|
}
|
|
1934
|
-
class ur extends
|
|
1934
|
+
class ur extends h {
|
|
1935
1935
|
priority = 110;
|
|
1936
1936
|
parse(e, n, r) {
|
|
1937
1937
|
const s = (a) => a - 1;
|
|
@@ -1998,7 +1998,7 @@ function dr(t, e, n) {
|
|
|
1998
1998
|
const r = p(t, n?.in), s = dt(r, n) - e;
|
|
1999
1999
|
return r.setDate(r.getDate() - s * 7), p(r, n?.in);
|
|
2000
2000
|
}
|
|
2001
|
-
class lr extends
|
|
2001
|
+
class lr extends h {
|
|
2002
2002
|
priority = 100;
|
|
2003
2003
|
parse(e, n, r) {
|
|
2004
2004
|
switch (n) {
|
|
@@ -2036,7 +2036,7 @@ function fr(t, e, n) {
|
|
|
2036
2036
|
const r = p(t, n?.in), s = ut(r, n) - e;
|
|
2037
2037
|
return r.setDate(r.getDate() - s * 7), r;
|
|
2038
2038
|
}
|
|
2039
|
-
class mr extends
|
|
2039
|
+
class mr extends h {
|
|
2040
2040
|
priority = 100;
|
|
2041
2041
|
parse(e, n, r) {
|
|
2042
2042
|
switch (n) {
|
|
@@ -2052,7 +2052,7 @@ class mr extends m {
|
|
|
2052
2052
|
return n >= 1 && n <= 53;
|
|
2053
2053
|
}
|
|
2054
2054
|
set(e, n, r) {
|
|
2055
|
-
return
|
|
2055
|
+
return S(fr(e, r));
|
|
2056
2056
|
}
|
|
2057
2057
|
incompatibleTokens = [
|
|
2058
2058
|
"y",
|
|
@@ -2085,7 +2085,7 @@ const hr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], gr = [
|
|
|
2085
2085
|
30,
|
|
2086
2086
|
31
|
|
2087
2087
|
];
|
|
2088
|
-
class wr extends
|
|
2088
|
+
class wr extends h {
|
|
2089
2089
|
priority = 90;
|
|
2090
2090
|
subPriority = 1;
|
|
2091
2091
|
parse(e, n, r) {
|
|
@@ -2120,7 +2120,7 @@ class wr extends m {
|
|
|
2120
2120
|
"T"
|
|
2121
2121
|
];
|
|
2122
2122
|
}
|
|
2123
|
-
class yr extends
|
|
2123
|
+
class yr extends h {
|
|
2124
2124
|
priority = 90;
|
|
2125
2125
|
subpriority = 1;
|
|
2126
2126
|
parse(e, n, r) {
|
|
@@ -2160,10 +2160,10 @@ class yr extends m {
|
|
|
2160
2160
|
];
|
|
2161
2161
|
}
|
|
2162
2162
|
function we(t, e, n) {
|
|
2163
|
-
const r = $(), s = n?.weekStartsOn ?? n?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, a = p(t, n?.in), o = a.getDay(),
|
|
2163
|
+
const r = $(), s = n?.weekStartsOn ?? n?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, a = p(t, n?.in), o = a.getDay(), c = (e % 7 + 7) % 7, u = 7 - s, d = e < 0 || e > 6 ? e - (o + u) % 7 : (c + u) % 7 - (o + u) % 7;
|
|
2164
2164
|
return ot(a, d, n);
|
|
2165
2165
|
}
|
|
2166
|
-
class pr extends
|
|
2166
|
+
class pr extends h {
|
|
2167
2167
|
priority = 90;
|
|
2168
2168
|
parse(e, n, r) {
|
|
2169
2169
|
switch (n) {
|
|
@@ -2199,12 +2199,12 @@ class pr extends m {
|
|
|
2199
2199
|
}
|
|
2200
2200
|
incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
|
|
2201
2201
|
}
|
|
2202
|
-
class br extends
|
|
2202
|
+
class br extends h {
|
|
2203
2203
|
priority = 90;
|
|
2204
2204
|
parse(e, n, r, s) {
|
|
2205
2205
|
const a = (o) => {
|
|
2206
|
-
const
|
|
2207
|
-
return (o + s.weekStartsOn + 6) % 7 +
|
|
2206
|
+
const i = Math.floor((o - 1) / 7) * 7;
|
|
2207
|
+
return (o + s.weekStartsOn + 6) % 7 + i;
|
|
2208
2208
|
};
|
|
2209
2209
|
switch (n) {
|
|
2210
2210
|
// 3
|
|
@@ -2265,12 +2265,12 @@ class br extends m {
|
|
|
2265
2265
|
"T"
|
|
2266
2266
|
];
|
|
2267
2267
|
}
|
|
2268
|
-
class Dr extends
|
|
2268
|
+
class Dr extends h {
|
|
2269
2269
|
priority = 90;
|
|
2270
2270
|
parse(e, n, r, s) {
|
|
2271
2271
|
const a = (o) => {
|
|
2272
|
-
const
|
|
2273
|
-
return (o + s.weekStartsOn + 6) % 7 +
|
|
2272
|
+
const i = Math.floor((o - 1) / 7) * 7;
|
|
2273
|
+
return (o + s.weekStartsOn + 6) % 7 + i;
|
|
2274
2274
|
};
|
|
2275
2275
|
switch (n) {
|
|
2276
2276
|
// 3
|
|
@@ -2335,7 +2335,7 @@ function Tr(t, e, n) {
|
|
|
2335
2335
|
const r = p(t, n?.in), s = jn(r, n), a = e - s;
|
|
2336
2336
|
return ot(r, a, n);
|
|
2337
2337
|
}
|
|
2338
|
-
class Er extends
|
|
2338
|
+
class Er extends h {
|
|
2339
2339
|
priority = 90;
|
|
2340
2340
|
parse(e, n, r) {
|
|
2341
2341
|
const s = (a) => a === 0 ? 7 : a;
|
|
@@ -2426,7 +2426,7 @@ class Er extends m {
|
|
|
2426
2426
|
"T"
|
|
2427
2427
|
];
|
|
2428
2428
|
}
|
|
2429
|
-
class xr extends
|
|
2429
|
+
class xr extends h {
|
|
2430
2430
|
priority = 80;
|
|
2431
2431
|
parse(e, n, r) {
|
|
2432
2432
|
switch (n) {
|
|
@@ -2463,7 +2463,7 @@ class xr extends m {
|
|
|
2463
2463
|
}
|
|
2464
2464
|
incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
|
|
2465
2465
|
}
|
|
2466
|
-
class Pr extends
|
|
2466
|
+
class Pr extends h {
|
|
2467
2467
|
priority = 80;
|
|
2468
2468
|
parse(e, n, r) {
|
|
2469
2469
|
switch (n) {
|
|
@@ -2500,7 +2500,7 @@ class Pr extends m {
|
|
|
2500
2500
|
}
|
|
2501
2501
|
incompatibleTokens = ["a", "B", "H", "k", "t", "T"];
|
|
2502
2502
|
}
|
|
2503
|
-
class vr extends
|
|
2503
|
+
class vr extends h {
|
|
2504
2504
|
priority = 80;
|
|
2505
2505
|
parse(e, n, r) {
|
|
2506
2506
|
switch (n) {
|
|
@@ -2537,7 +2537,7 @@ class vr extends m {
|
|
|
2537
2537
|
}
|
|
2538
2538
|
incompatibleTokens = ["a", "b", "t", "T"];
|
|
2539
2539
|
}
|
|
2540
|
-
class Mr extends
|
|
2540
|
+
class Mr extends h {
|
|
2541
2541
|
priority = 70;
|
|
2542
2542
|
parse(e, n, r) {
|
|
2543
2543
|
switch (n) {
|
|
@@ -2558,7 +2558,7 @@ class Mr extends m {
|
|
|
2558
2558
|
}
|
|
2559
2559
|
incompatibleTokens = ["H", "K", "k", "t", "T"];
|
|
2560
2560
|
}
|
|
2561
|
-
class Or extends
|
|
2561
|
+
class Or extends h {
|
|
2562
2562
|
priority = 70;
|
|
2563
2563
|
parse(e, n, r) {
|
|
2564
2564
|
switch (n) {
|
|
@@ -2578,7 +2578,7 @@ class Or extends m {
|
|
|
2578
2578
|
}
|
|
2579
2579
|
incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"];
|
|
2580
2580
|
}
|
|
2581
|
-
class Ar extends
|
|
2581
|
+
class Ar extends h {
|
|
2582
2582
|
priority = 70;
|
|
2583
2583
|
parse(e, n, r) {
|
|
2584
2584
|
switch (n) {
|
|
@@ -2598,7 +2598,7 @@ class Ar extends m {
|
|
|
2598
2598
|
}
|
|
2599
2599
|
incompatibleTokens = ["h", "H", "k", "t", "T"];
|
|
2600
2600
|
}
|
|
2601
|
-
class Nr extends
|
|
2601
|
+
class Nr extends h {
|
|
2602
2602
|
priority = 70;
|
|
2603
2603
|
parse(e, n, r) {
|
|
2604
2604
|
switch (n) {
|
|
@@ -2619,7 +2619,7 @@ class Nr extends m {
|
|
|
2619
2619
|
}
|
|
2620
2620
|
incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
|
|
2621
2621
|
}
|
|
2622
|
-
class kr extends
|
|
2622
|
+
class kr extends h {
|
|
2623
2623
|
priority = 60;
|
|
2624
2624
|
parse(e, n, r) {
|
|
2625
2625
|
switch (n) {
|
|
@@ -2639,7 +2639,7 @@ class kr extends m {
|
|
|
2639
2639
|
}
|
|
2640
2640
|
incompatibleTokens = ["t", "T"];
|
|
2641
2641
|
}
|
|
2642
|
-
class
|
|
2642
|
+
class Rr extends h {
|
|
2643
2643
|
priority = 50;
|
|
2644
2644
|
parse(e, n, r) {
|
|
2645
2645
|
switch (n) {
|
|
@@ -2659,7 +2659,7 @@ class Ir extends m {
|
|
|
2659
2659
|
}
|
|
2660
2660
|
incompatibleTokens = ["t", "T"];
|
|
2661
2661
|
}
|
|
2662
|
-
class
|
|
2662
|
+
class Ir extends h {
|
|
2663
2663
|
priority = 30;
|
|
2664
2664
|
parse(e, n) {
|
|
2665
2665
|
const r = (s) => Math.trunc(s * Math.pow(10, -n.length + 3));
|
|
@@ -2670,7 +2670,7 @@ class Rr extends m {
|
|
|
2670
2670
|
}
|
|
2671
2671
|
incompatibleTokens = ["t", "T"];
|
|
2672
2672
|
}
|
|
2673
|
-
class _r extends
|
|
2673
|
+
class _r extends h {
|
|
2674
2674
|
priority = 10;
|
|
2675
2675
|
parse(e, n) {
|
|
2676
2676
|
switch (n) {
|
|
@@ -2703,7 +2703,7 @@ class _r extends m {
|
|
|
2703
2703
|
}
|
|
2704
2704
|
incompatibleTokens = ["t", "T", "x"];
|
|
2705
2705
|
}
|
|
2706
|
-
class Yr extends
|
|
2706
|
+
class Yr extends h {
|
|
2707
2707
|
priority = 10;
|
|
2708
2708
|
parse(e, n) {
|
|
2709
2709
|
switch (n) {
|
|
@@ -2736,7 +2736,7 @@ class Yr extends m {
|
|
|
2736
2736
|
}
|
|
2737
2737
|
incompatibleTokens = ["t", "T", "X"];
|
|
2738
2738
|
}
|
|
2739
|
-
class Cr extends
|
|
2739
|
+
class Cr extends h {
|
|
2740
2740
|
priority = 40;
|
|
2741
2741
|
parse(e) {
|
|
2742
2742
|
return gt(e);
|
|
@@ -2746,7 +2746,7 @@ class Cr extends m {
|
|
|
2746
2746
|
}
|
|
2747
2747
|
incompatibleTokens = "*";
|
|
2748
2748
|
}
|
|
2749
|
-
class
|
|
2749
|
+
class Lr extends h {
|
|
2750
2750
|
priority = 20;
|
|
2751
2751
|
parse(e) {
|
|
2752
2752
|
return gt(e);
|
|
@@ -2756,7 +2756,7 @@ class Sr extends m {
|
|
|
2756
2756
|
}
|
|
2757
2757
|
incompatibleTokens = "*";
|
|
2758
2758
|
}
|
|
2759
|
-
const
|
|
2759
|
+
const Sr = {
|
|
2760
2760
|
G: new tr(),
|
|
2761
2761
|
y: new nr(),
|
|
2762
2762
|
Y: new rr(),
|
|
@@ -2782,48 +2782,48 @@ const Lr = {
|
|
|
2782
2782
|
K: new Ar(),
|
|
2783
2783
|
k: new Nr(),
|
|
2784
2784
|
m: new kr(),
|
|
2785
|
-
s: new
|
|
2786
|
-
S: new
|
|
2785
|
+
s: new Rr(),
|
|
2786
|
+
S: new Ir(),
|
|
2787
2787
|
X: new _r(),
|
|
2788
2788
|
x: new Yr(),
|
|
2789
2789
|
t: new Cr(),
|
|
2790
|
-
T: new
|
|
2791
|
-
}, $r = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Wr = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, qr = /^'([^]*?)'?$/,
|
|
2792
|
-
function
|
|
2793
|
-
const s = () => E(n, NaN), a = Xn(), o = a.locale ?? ct,
|
|
2790
|
+
T: new Lr()
|
|
2791
|
+
}, $r = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Wr = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, qr = /^'([^]*?)'?$/, Ur = /''/g, Hr = /\S/, Qr = /[a-zA-Z]/;
|
|
2792
|
+
function Fr(t, e, n, r) {
|
|
2793
|
+
const s = () => E(n, NaN), a = Xn(), o = a.locale ?? ct, i = a.firstWeekContainsDate ?? a.locale?.options?.firstWeekContainsDate ?? 1, c = a.weekStartsOn ?? a.locale?.options?.weekStartsOn ?? 0;
|
|
2794
2794
|
if (!e)
|
|
2795
2795
|
return t ? s() : p(n, r?.in);
|
|
2796
2796
|
const u = {
|
|
2797
|
-
firstWeekContainsDate:
|
|
2798
|
-
weekStartsOn:
|
|
2797
|
+
firstWeekContainsDate: i,
|
|
2798
|
+
weekStartsOn: c,
|
|
2799
2799
|
locale: o
|
|
2800
2800
|
}, d = [new er(r?.in, n)], l = e.match(Wr).map((f) => {
|
|
2801
|
-
const
|
|
2802
|
-
if (
|
|
2803
|
-
const
|
|
2804
|
-
return
|
|
2801
|
+
const w = f[0];
|
|
2802
|
+
if (w in se) {
|
|
2803
|
+
const v = se[w];
|
|
2804
|
+
return v(f, o.formatLong);
|
|
2805
2805
|
}
|
|
2806
2806
|
return f;
|
|
2807
|
-
}).join("").match($r),
|
|
2807
|
+
}).join("").match($r), m = [];
|
|
2808
2808
|
for (let f of l) {
|
|
2809
2809
|
mt(f) && ae(f, e, t), ft(f) && ae(f, e, t);
|
|
2810
|
-
const
|
|
2811
|
-
if (
|
|
2812
|
-
const { incompatibleTokens: M } =
|
|
2810
|
+
const w = f[0], v = Sr[w];
|
|
2811
|
+
if (v) {
|
|
2812
|
+
const { incompatibleTokens: M } = v;
|
|
2813
2813
|
if (Array.isArray(M)) {
|
|
2814
|
-
const q =
|
|
2815
|
-
(
|
|
2814
|
+
const q = m.find(
|
|
2815
|
+
(F) => M.includes(F.token) || F.token === w
|
|
2816
2816
|
);
|
|
2817
2817
|
if (q)
|
|
2818
2818
|
throw new RangeError(
|
|
2819
2819
|
`The format string mustn't contain \`${q.fullToken}\` and \`${f}\` at the same time`
|
|
2820
2820
|
);
|
|
2821
|
-
} else if (
|
|
2821
|
+
} else if (v.incompatibleTokens === "*" && m.length > 0)
|
|
2822
2822
|
throw new RangeError(
|
|
2823
2823
|
`The format string mustn't contain \`${f}\` and any other token at the same time`
|
|
2824
2824
|
);
|
|
2825
|
-
|
|
2826
|
-
const W =
|
|
2825
|
+
m.push({ token: w, fullToken: f });
|
|
2826
|
+
const W = v.run(
|
|
2827
2827
|
t,
|
|
2828
2828
|
f,
|
|
2829
2829
|
o.match,
|
|
@@ -2833,34 +2833,34 @@ function Ur(t, e, n, r) {
|
|
|
2833
2833
|
return s();
|
|
2834
2834
|
d.push(W.setter), t = W.rest;
|
|
2835
2835
|
} else {
|
|
2836
|
-
if (
|
|
2836
|
+
if (w.match(Qr))
|
|
2837
2837
|
throw new RangeError(
|
|
2838
|
-
"Format string contains an unescaped latin alphabet character `" +
|
|
2838
|
+
"Format string contains an unescaped latin alphabet character `" + w + "`"
|
|
2839
2839
|
);
|
|
2840
|
-
if (f === "''" ? f = "'" :
|
|
2840
|
+
if (f === "''" ? f = "'" : w === "'" && (f = Br(f)), t.indexOf(f) === 0)
|
|
2841
2841
|
t = t.slice(f.length);
|
|
2842
2842
|
else
|
|
2843
2843
|
return s();
|
|
2844
2844
|
}
|
|
2845
2845
|
}
|
|
2846
|
-
if (t.length > 0 &&
|
|
2846
|
+
if (t.length > 0 && Hr.test(t))
|
|
2847
2847
|
return s();
|
|
2848
|
-
const
|
|
2849
|
-
(f) => d.filter((
|
|
2848
|
+
const x = d.map((f) => f.priority).sort((f, w) => w - f).filter((f, w, v) => v.indexOf(f) === w).map(
|
|
2849
|
+
(f) => d.filter((w) => w.priority === f).sort((w, v) => v.subPriority - w.subPriority)
|
|
2850
2850
|
).map((f) => f[0]);
|
|
2851
|
-
let
|
|
2852
|
-
if (isNaN(+
|
|
2851
|
+
let P = p(n, r?.in);
|
|
2852
|
+
if (isNaN(+P)) return s();
|
|
2853
2853
|
const N = {};
|
|
2854
|
-
for (const f of
|
|
2855
|
-
if (!f.validate(
|
|
2854
|
+
for (const f of x) {
|
|
2855
|
+
if (!f.validate(P, u))
|
|
2856
2856
|
return s();
|
|
2857
|
-
const
|
|
2858
|
-
Array.isArray(
|
|
2857
|
+
const w = f.set(P, N, u);
|
|
2858
|
+
Array.isArray(w) ? (P = w[0], Object.assign(N, w[1])) : P = w;
|
|
2859
2859
|
}
|
|
2860
|
-
return
|
|
2860
|
+
return P;
|
|
2861
2861
|
}
|
|
2862
2862
|
function Br(t) {
|
|
2863
|
-
return t.match(qr)[1].replace(
|
|
2863
|
+
return t.match(qr)[1].replace(Ur, "'");
|
|
2864
2864
|
}
|
|
2865
2865
|
function Vr(t, e) {
|
|
2866
2866
|
const n = () => E(e?.in, NaN), s = zr(t);
|
|
@@ -2871,13 +2871,13 @@ function Vr(t, e) {
|
|
|
2871
2871
|
}
|
|
2872
2872
|
if (!a || isNaN(+a)) return n();
|
|
2873
2873
|
const o = +a;
|
|
2874
|
-
let
|
|
2875
|
-
if (s.time && (
|
|
2874
|
+
let i = 0, c;
|
|
2875
|
+
if (s.time && (i = Zr(s.time), isNaN(i)))
|
|
2876
2876
|
return n();
|
|
2877
2877
|
if (s.timezone) {
|
|
2878
|
-
if (
|
|
2878
|
+
if (c = es(s.timezone), isNaN(c)) return n();
|
|
2879
2879
|
} else {
|
|
2880
|
-
const u = new Date(o +
|
|
2880
|
+
const u = new Date(o + i), d = p(0, e?.in);
|
|
2881
2881
|
return d.setFullYear(
|
|
2882
2882
|
u.getUTCFullYear(),
|
|
2883
2883
|
u.getUTCMonth(),
|
|
@@ -2889,7 +2889,7 @@ function Vr(t, e) {
|
|
|
2889
2889
|
u.getUTCMilliseconds()
|
|
2890
2890
|
), d;
|
|
2891
2891
|
}
|
|
2892
|
-
return p(o +
|
|
2892
|
+
return p(o + i + c, e?.in);
|
|
2893
2893
|
}
|
|
2894
2894
|
const V = {
|
|
2895
2895
|
dateTimeDelimiter: /[T ]/,
|
|
@@ -2925,15 +2925,15 @@ function Jr(t, e) {
|
|
|
2925
2925
|
if (e === null) return /* @__PURE__ */ new Date(NaN);
|
|
2926
2926
|
const n = t.match(Gr);
|
|
2927
2927
|
if (!n) return /* @__PURE__ */ new Date(NaN);
|
|
2928
|
-
const r = !!n[4], s =
|
|
2928
|
+
const r = !!n[4], s = Q(n[1]), a = Q(n[2]) - 1, o = Q(n[3]), i = Q(n[4]), c = Q(n[5]) - 1;
|
|
2929
2929
|
if (r)
|
|
2930
|
-
return as(e,
|
|
2930
|
+
return as(e, i, c) ? ts(e, i, c) : /* @__PURE__ */ new Date(NaN);
|
|
2931
2931
|
{
|
|
2932
2932
|
const u = /* @__PURE__ */ new Date(0);
|
|
2933
2933
|
return !rs(e, a, o) || !ss(e, s) ? /* @__PURE__ */ new Date(NaN) : (u.setUTCFullYear(e, a, Math.max(s, o)), u);
|
|
2934
2934
|
}
|
|
2935
2935
|
}
|
|
2936
|
-
function
|
|
2936
|
+
function Q(t) {
|
|
2937
2937
|
return t ? parseInt(t) : 1;
|
|
2938
2938
|
}
|
|
2939
2939
|
function Zr(t) {
|
|
@@ -2980,7 +2980,7 @@ function is(t, e) {
|
|
|
2980
2980
|
const G = (t) => {
|
|
2981
2981
|
if (!t.includes("T")) {
|
|
2982
2982
|
for (const n of cs) {
|
|
2983
|
-
const r =
|
|
2983
|
+
const r = Fr(t, n, /* @__PURE__ */ new Date());
|
|
2984
2984
|
if (re(r))
|
|
2985
2985
|
return r;
|
|
2986
2986
|
}
|
|
@@ -2990,11 +2990,11 @@ const G = (t) => {
|
|
|
2990
2990
|
return re(e) ? e : null;
|
|
2991
2991
|
}, cs = ["yyyy-MM-dd", "MM-dd-yyyy"], oe = (t, e, n) => {
|
|
2992
2992
|
const r = {};
|
|
2993
|
-
return e?.contentType !== null && (r[Bt] = e?.contentType ||
|
|
2993
|
+
return e?.contentType !== null && (r[Bt] = e?.contentType || Ft), e?.jwt ? r.Authorization = `Bearer ${e.jwt}` : t && (r[j] = t), e?.chatReference && (r[Vt] = e.chatReference), { ...r, ...n };
|
|
2994
2994
|
}, us = (t) => {
|
|
2995
2995
|
const e = { ...t };
|
|
2996
2996
|
return e[j] && (e[j] = e[j].substring(0, 8) + "...[REDACTED]"), e.Authorization && (e.Authorization = "Bearer [REDACTED]"), e[z] && (e[z] = e[z].substring(0, 8) + "...[REDACTED]"), e;
|
|
2997
|
-
},
|
|
2997
|
+
}, He = async (t, e, n) => await fetch(t, {
|
|
2998
2998
|
method: n.method || "GET",
|
|
2999
2999
|
headers: e,
|
|
3000
3000
|
body: n.body ? JSON.stringify(n.body) : void 0
|
|
@@ -3012,15 +3012,15 @@ class ls {
|
|
|
3012
3012
|
this.decoder = new TextDecoder();
|
|
3013
3013
|
}
|
|
3014
3014
|
async streamChat(e, n, r = {}, s) {
|
|
3015
|
-
const { onMessage: a, onError: o, onComplete:
|
|
3015
|
+
const { onMessage: a, onError: o, onComplete: i, signal: c } = r;
|
|
3016
3016
|
try {
|
|
3017
3017
|
const u = await this.initializeStreamRequest(
|
|
3018
3018
|
e,
|
|
3019
3019
|
n,
|
|
3020
|
-
|
|
3020
|
+
c,
|
|
3021
3021
|
s
|
|
3022
3022
|
);
|
|
3023
|
-
await this.processStreamData(u, a),
|
|
3023
|
+
await this.processStreamData(u, a), i?.();
|
|
3024
3024
|
} catch (u) {
|
|
3025
3025
|
this.handleStreamError(u, o);
|
|
3026
3026
|
}
|
|
@@ -3041,16 +3041,16 @@ class ls {
|
|
|
3041
3041
|
}
|
|
3042
3042
|
);
|
|
3043
3043
|
if (!o.ok) {
|
|
3044
|
-
const
|
|
3045
|
-
let
|
|
3044
|
+
const i = await o.text();
|
|
3045
|
+
let c = {};
|
|
3046
3046
|
try {
|
|
3047
|
-
|
|
3047
|
+
c = JSON.parse(i);
|
|
3048
3048
|
} catch {
|
|
3049
|
-
|
|
3049
|
+
c.error = "Failed to parse error body";
|
|
3050
3050
|
}
|
|
3051
3051
|
throw new Ce({
|
|
3052
3052
|
status: o.status,
|
|
3053
|
-
message:
|
|
3053
|
+
message: c.error ?? "No response body"
|
|
3054
3054
|
});
|
|
3055
3055
|
}
|
|
3056
3056
|
if (!o.body)
|
|
@@ -3071,11 +3071,11 @@ class ls {
|
|
|
3071
3071
|
}
|
|
3072
3072
|
const o = this.decoder.decode(a, { stream: !0 });
|
|
3073
3073
|
r += o;
|
|
3074
|
-
const
|
|
3074
|
+
const i = r.split(`
|
|
3075
3075
|
`);
|
|
3076
|
-
r =
|
|
3077
|
-
for (const
|
|
3078
|
-
this.parseSSEDataLine(
|
|
3076
|
+
r = i.pop() || "";
|
|
3077
|
+
for (const c of i)
|
|
3078
|
+
this.parseSSEDataLine(c, n);
|
|
3079
3079
|
}
|
|
3080
3080
|
} finally {
|
|
3081
3081
|
e.releaseLock();
|
|
@@ -3127,70 +3127,70 @@ class Qa {
|
|
|
3127
3127
|
);
|
|
3128
3128
|
}
|
|
3129
3129
|
async streamRequest(e, n, r, s) {
|
|
3130
|
-
const a = `${this.config.apiUrl}/${e}`, o = this.buildHeaders(s, n.headers),
|
|
3130
|
+
const a = `${this.config.apiUrl}/${e}`, o = this.buildHeaders(s, n.headers), i = new ReadableStream({
|
|
3131
3131
|
async start(u) {
|
|
3132
3132
|
try {
|
|
3133
|
-
const d = await
|
|
3133
|
+
const d = await He(a, o, n);
|
|
3134
3134
|
if (!d.ok) {
|
|
3135
|
-
const
|
|
3135
|
+
const P = await d.text();
|
|
3136
3136
|
throw console.error(
|
|
3137
|
-
`Fetch failed! Status: ${d.status}, Body: ${
|
|
3137
|
+
`Fetch failed! Status: ${d.status}, Body: ${P}`
|
|
3138
3138
|
), new Error(`Fetch failed with status ${d.status}`);
|
|
3139
3139
|
}
|
|
3140
3140
|
const l = d.body?.getReader();
|
|
3141
3141
|
if (!l) throw new Error("Failed to create stream reader");
|
|
3142
|
-
const
|
|
3143
|
-
u.enqueue(
|
|
3144
|
-
const
|
|
3145
|
-
const { done:
|
|
3146
|
-
|
|
3142
|
+
const m = new Uint8Array([239, 187, 191]);
|
|
3143
|
+
u.enqueue(m);
|
|
3144
|
+
const x = async () => {
|
|
3145
|
+
const { done: P, value: N } = await l.read();
|
|
3146
|
+
P ? u.close() : (u.enqueue(N), await x());
|
|
3147
3147
|
};
|
|
3148
|
-
|
|
3148
|
+
x();
|
|
3149
3149
|
} catch (d) {
|
|
3150
3150
|
u.error(d);
|
|
3151
3151
|
}
|
|
3152
3152
|
}
|
|
3153
|
-
}),
|
|
3153
|
+
}), c = new Headers({
|
|
3154
3154
|
"Content-Disposition": `attachment; filename=${encodeURIComponent(r)}`
|
|
3155
3155
|
});
|
|
3156
|
-
return new Response(
|
|
3156
|
+
return new Response(i, { headers: c });
|
|
3157
3157
|
}
|
|
3158
3158
|
async request(e, n, r, s) {
|
|
3159
|
-
const a = Date.now(), o = `${r || this.config.apiUrl}/${e}`,
|
|
3160
|
-
this.addInfoRequestLog("API Request", o, n,
|
|
3159
|
+
const a = Date.now(), o = `${r || this.config.apiUrl}/${e}`, i = this.buildHeaders(s, n.headers);
|
|
3160
|
+
this.addInfoRequestLog("API Request", o, n, i);
|
|
3161
3161
|
try {
|
|
3162
|
-
const
|
|
3162
|
+
const c = await He(o, i, n), u = Date.now() - a;
|
|
3163
3163
|
let d;
|
|
3164
|
-
const l = await
|
|
3164
|
+
const l = await c.text();
|
|
3165
3165
|
try {
|
|
3166
3166
|
d = l ? JSON.parse(l) : {};
|
|
3167
3167
|
} catch {
|
|
3168
3168
|
if (this.addErrorRequestParsing(
|
|
3169
3169
|
o,
|
|
3170
3170
|
n,
|
|
3171
|
-
|
|
3171
|
+
c,
|
|
3172
3172
|
u,
|
|
3173
3173
|
l
|
|
3174
|
-
), !
|
|
3174
|
+
), !c.ok)
|
|
3175
3175
|
throw new Error(
|
|
3176
|
-
`API request failed: ${
|
|
3176
|
+
`API request failed: ${c.status} ${c.statusText} - ${l.substring(0, 100)}`
|
|
3177
3177
|
);
|
|
3178
3178
|
d = { data: l };
|
|
3179
3179
|
}
|
|
3180
|
-
if (!
|
|
3181
|
-
this.addErrorRequestLog(o, n,
|
|
3182
|
-
const
|
|
3183
|
-
throw new Error(`API request failed: ${
|
|
3180
|
+
if (!c.ok) {
|
|
3181
|
+
this.addErrorRequestLog(o, n, c, u, d);
|
|
3182
|
+
const m = Qt(d, c);
|
|
3183
|
+
throw new Error(`API request failed: ${m}`);
|
|
3184
3184
|
}
|
|
3185
3185
|
return d;
|
|
3186
|
-
} catch (
|
|
3186
|
+
} catch (c) {
|
|
3187
3187
|
const u = Date.now() - a;
|
|
3188
3188
|
throw console.error("API Request Exception", {
|
|
3189
3189
|
method: n.method,
|
|
3190
3190
|
url: o,
|
|
3191
3191
|
duration: `${u}ms`,
|
|
3192
|
-
error:
|
|
3193
|
-
}),
|
|
3192
|
+
error: c instanceof Error ? c.message : String(c)
|
|
3193
|
+
}), c;
|
|
3194
3194
|
}
|
|
3195
3195
|
}
|
|
3196
3196
|
buildHeaders(e, n) {
|
|
@@ -3253,8 +3253,8 @@ const pe = (t, e) => t?.names && t?.names[e] || t?.name, bt = (t, e, n) => {
|
|
|
3253
3253
|
bt(s, n, r);
|
|
3254
3254
|
}), Array.from(n?.values());
|
|
3255
3255
|
};
|
|
3256
|
-
var ms = /* @__PURE__ */ ((t) => (t.C = "c", t))(ms || {}),
|
|
3257
|
-
const
|
|
3256
|
+
var ms = /* @__PURE__ */ ((t) => (t.C = "c", t))(ms || {}), R = /* @__PURE__ */ ((t) => (t.EQUALS = "eq", t.NOT_EQUALS = "ne", t.LESS = "lt", t.LESS_OR_EQUAL = "le", t.GREATER = "gt", t.GREATER_OR_EQUAL = "ge", t.CONTAINS = "co", t.NOT_CONTAINS = "nc", t.STARTS = "sw", t.ENDS = "ew", t))(R || {}), hs = /* @__PURE__ */ ((t) => (t.BOOLEAN = "Boolean", t.DATE_TIME = "DateTime", t.DECIMAL = "Decimal", t.INTEGER = "Integer", t.OBSERVATION_TIME_PERIOD = "ObservationalTimePeriod", t.STRING = "String", t.TIME = "Time", t.TIME_RANGE = "TimeRange", t.URI = "URI", t))(hs || {}), gs = /* @__PURE__ */ ((t) => (t.ANNUAL = "A", t.QUARTERLY = "Q", t.MONTHLY = "M", t))(gs || {});
|
|
3257
|
+
const Ba = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start", ps = "time_period_end", Va = (t) => {
|
|
3258
3258
|
const e = t?.find(
|
|
3259
3259
|
(a) => a.id === ys
|
|
3260
3260
|
), n = t?.find(
|
|
@@ -3265,34 +3265,34 @@ const Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start",
|
|
|
3265
3265
|
endPeriod: r
|
|
3266
3266
|
};
|
|
3267
3267
|
}, bs = (t, e) => t.id.localeCompare(e.id), Ds = (t, e) => t.memberValue.localeCompare(e.memberValue), Ts = (t, e) => {
|
|
3268
|
-
const n = new Array(t.length), r = t.map((o,
|
|
3268
|
+
const n = new Array(t.length), r = t.map((o, i) => [o, i]);
|
|
3269
3269
|
r.sort(
|
|
3270
|
-
(o,
|
|
3270
|
+
(o, i) => bs(o[0], i[0])
|
|
3271
3271
|
);
|
|
3272
3272
|
const s = [...e];
|
|
3273
3273
|
s.sort(Ds);
|
|
3274
3274
|
let a = 0;
|
|
3275
3275
|
for (const o of r) {
|
|
3276
|
-
const
|
|
3277
|
-
for (; a < s.length && s[a].memberValue.localeCompare(
|
|
3276
|
+
const i = o[0];
|
|
3277
|
+
for (; a < s.length && s[a].memberValue.localeCompare(i.id) < 0; )
|
|
3278
3278
|
a += 1;
|
|
3279
|
-
a < s.length && s[a].memberValue ===
|
|
3279
|
+
a < s.length && s[a].memberValue === i.id && (n[o[1]] = o[0]);
|
|
3280
3280
|
}
|
|
3281
3281
|
return n.filter((o) => o != null);
|
|
3282
|
-
}, Es = (t) => !!t?.some((e) => e.parent),
|
|
3282
|
+
}, Es = (t) => !!t?.some((e) => e.parent), Ga = (t, e, n, r, s = []) => {
|
|
3283
3283
|
let a = t || [];
|
|
3284
3284
|
if (xs(n || [], e || "")) {
|
|
3285
3285
|
const o = (n || [])[0].cubeRegions?.find(
|
|
3286
|
-
({ isIncluded:
|
|
3286
|
+
({ isIncluded: i }) => i
|
|
3287
3287
|
);
|
|
3288
3288
|
if (o) {
|
|
3289
|
-
const
|
|
3290
|
-
({ componentId:
|
|
3289
|
+
const i = o.memberSelection?.find(
|
|
3290
|
+
({ componentId: c }) => c === e
|
|
3291
3291
|
);
|
|
3292
|
-
|
|
3293
|
-
id:
|
|
3294
|
-
name:
|
|
3295
|
-
})) : Ts(a,
|
|
3292
|
+
i ? a = a.length === 0 ? (i.selectionValues || []).map(({ memberValue: c }) => ({
|
|
3293
|
+
id: c,
|
|
3294
|
+
name: c
|
|
3295
|
+
})) : Ts(a, i.selectionValues) : a = [];
|
|
3296
3296
|
}
|
|
3297
3297
|
} else s.length !== 0 && (a = a.filter(({ id: o }) => s.includes(o)));
|
|
3298
3298
|
return Es(t) && (a = fs(t, a)), a?.map((o) => ({
|
|
@@ -3304,27 +3304,27 @@ const Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start",
|
|
|
3304
3304
|
return t?.filters?.forEach((n) => {
|
|
3305
3305
|
n.componentCode !== ws && e.push({
|
|
3306
3306
|
componentCode: n.componentCode,
|
|
3307
|
-
operator:
|
|
3307
|
+
operator: R.EQUALS,
|
|
3308
3308
|
value: n.values.join(",")
|
|
3309
3309
|
});
|
|
3310
3310
|
}), e;
|
|
3311
|
-
},
|
|
3311
|
+
}, Xa = (t) => {
|
|
3312
3312
|
const e = /* @__PURE__ */ new Map();
|
|
3313
3313
|
return t?.forEach((n) => {
|
|
3314
3314
|
e.set(n.urn, Ps(n));
|
|
3315
3315
|
}), e;
|
|
3316
|
-
}, vs = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,
|
|
3316
|
+
}, vs = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Qe = (t) => {
|
|
3317
3317
|
if (typeof t != "string")
|
|
3318
3318
|
throw new TypeError("Invalid argument expected string");
|
|
3319
3319
|
const e = t.match(vs);
|
|
3320
3320
|
if (!e)
|
|
3321
3321
|
throw new Error(`Invalid argument not valid semver ('${t}' received)`);
|
|
3322
3322
|
return e.shift(), e;
|
|
3323
|
-
},
|
|
3323
|
+
}, Fe = (t) => t === "*" || t === "x" || t === "X", Be = (t) => {
|
|
3324
3324
|
const e = parseInt(t, 10);
|
|
3325
3325
|
return isNaN(e) ? t : e;
|
|
3326
3326
|
}, Ms = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], Os = (t, e) => {
|
|
3327
|
-
if (
|
|
3327
|
+
if (Fe(t) || Fe(e))
|
|
3328
3328
|
return 0;
|
|
3329
3329
|
const [n, r] = Ms(Be(t), Be(e));
|
|
3330
3330
|
return n > r ? 1 : n < r ? -1 : 0;
|
|
@@ -3336,7 +3336,7 @@ const Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start",
|
|
|
3336
3336
|
}
|
|
3337
3337
|
return 0;
|
|
3338
3338
|
}, As = (t, e) => {
|
|
3339
|
-
const n =
|
|
3339
|
+
const n = Qe(t), r = Qe(e), s = n.pop(), a = r.pop(), o = Ve(n, r);
|
|
3340
3340
|
return o !== 0 ? o : s && a ? Ve(s.split("."), a.split(".")) : s || a ? s ? -1 : 1 : 0;
|
|
3341
3341
|
}, Ns = (t, e, n) => {
|
|
3342
3342
|
ks(n);
|
|
@@ -3354,22 +3354,22 @@ const Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start",
|
|
|
3354
3354
|
throw new Error(`Invalid operator, expected one of ${Ge.join("|")}`);
|
|
3355
3355
|
}, ie = "+", be = (t, e) => {
|
|
3356
3356
|
const { agency: n, id: r, version: s } = C(t), a = e.filter(
|
|
3357
|
-
(
|
|
3357
|
+
(c) => c.agencyID === n && c.id === r && !c?.version?.includes(ie)
|
|
3358
3358
|
);
|
|
3359
3359
|
if (a.length === 1)
|
|
3360
3360
|
return a[0];
|
|
3361
3361
|
if (!s?.includes(ie))
|
|
3362
|
-
return a.find((
|
|
3362
|
+
return a.find((c) => c.version === s);
|
|
3363
3363
|
const o = a.map(
|
|
3364
|
-
(
|
|
3365
|
-
),
|
|
3364
|
+
(c) => c.version
|
|
3365
|
+
), i = Rs(s, o);
|
|
3366
3366
|
return a.find(
|
|
3367
|
-
(
|
|
3367
|
+
(c) => c.version === i[0]
|
|
3368
3368
|
);
|
|
3369
|
-
}, Is = (t, e) => {
|
|
3370
|
-
const n = Rs(t, e);
|
|
3371
|
-
return n.length > 0 ? [n[0]] : [];
|
|
3372
3369
|
}, Rs = (t, e) => {
|
|
3370
|
+
const n = Is(t, e);
|
|
3371
|
+
return n.length > 0 ? [n[0]] : [];
|
|
3372
|
+
}, Is = (t, e) => {
|
|
3373
3373
|
const n = [];
|
|
3374
3374
|
return e.forEach((r) => {
|
|
3375
3375
|
Ys(t, r) && n.push(r);
|
|
@@ -3405,7 +3405,7 @@ const Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start",
|
|
|
3405
3405
|
};
|
|
3406
3406
|
}
|
|
3407
3407
|
for (const o of e)
|
|
3408
|
-
if (
|
|
3408
|
+
if (Ls(o, s, r, a))
|
|
3409
3409
|
return {
|
|
3410
3410
|
concept: Xe(o?.concepts || [], n),
|
|
3411
3411
|
scheme: o
|
|
@@ -3414,23 +3414,23 @@ const Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start",
|
|
|
3414
3414
|
concept: void 0,
|
|
3415
3415
|
scheme: void 0
|
|
3416
3416
|
};
|
|
3417
|
-
}, Xe = (t, e) => t?.find((n) => n.id === e),
|
|
3417
|
+
}, Xe = (t, e) => t?.find((n) => n.id === e), Ls = (t, e, n, r) => t.id === e && t.agencyID === n && t.version === r, ja = (t = [], e = [], n) => {
|
|
3418
3418
|
const r = n?.conceptIdentity || "", s = De(r, e), a = K(
|
|
3419
3419
|
n?.localRepresentation?.enumeration
|
|
3420
3420
|
), o = K(
|
|
3421
3421
|
s?.coreRepresentation?.enumeration
|
|
3422
|
-
),
|
|
3423
|
-
if (
|
|
3424
|
-
return be(
|
|
3425
|
-
},
|
|
3422
|
+
), i = a || o;
|
|
3423
|
+
if (i != null)
|
|
3424
|
+
return be(i, t);
|
|
3425
|
+
}, Ss = (t, e) => {
|
|
3426
3426
|
const n = t?.data?.dataSets?.[0], s = t?.data?.structures?.[0]?.attributes?.dimensionGroup || [], a = n?.dimensionGroupAttributes, o = {};
|
|
3427
|
-
for (const
|
|
3428
|
-
const
|
|
3427
|
+
for (const i of s) {
|
|
3428
|
+
const c = i.relationship.dimensions, { codedSeriesKey: u, decodedSeriesKey: d } = Tt(
|
|
3429
3429
|
t,
|
|
3430
3430
|
e,
|
|
3431
|
-
|
|
3431
|
+
c
|
|
3432
3432
|
);
|
|
3433
|
-
o[
|
|
3433
|
+
o[i.id] = {
|
|
3434
3434
|
values: a?.[u] || [],
|
|
3435
3435
|
decodedSeriesKey: d,
|
|
3436
3436
|
codedSeriesKey: u
|
|
@@ -3442,34 +3442,34 @@ const Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start",
|
|
|
3442
3442
|
...r?.dimensions.series || [],
|
|
3443
3443
|
...r?.dimensions.observation || []
|
|
3444
3444
|
], a = new Array(s?.length), o = new Array(s?.length);
|
|
3445
|
-
return n?.forEach((
|
|
3446
|
-
const
|
|
3445
|
+
return n?.forEach((i) => {
|
|
3446
|
+
const c = s?.findIndex((l) => l.id === i) || 0, u = e[c], d = s[c].values.findIndex(
|
|
3447
3447
|
(l) => l.id === u || l.value === u
|
|
3448
3448
|
) || 0;
|
|
3449
|
-
a[
|
|
3449
|
+
a[c] = d >= 0 ? d : u, o[c] = u;
|
|
3450
3450
|
}), {
|
|
3451
3451
|
codedSeriesKey: a.join(":"),
|
|
3452
3452
|
decodedSeriesKey: o.join(":")
|
|
3453
3453
|
};
|
|
3454
|
-
},
|
|
3454
|
+
}, za = (t, e, n) => {
|
|
3455
3455
|
const r = t?.data?.dataSets?.[0], s = t?.data?.structures?.[0], a = (s?.attributes?.dimensionGroup || []).filter(
|
|
3456
3456
|
(l) => l.relationship.dimensions?.length === 1 && l.relationship.dimensions.includes(e || "")
|
|
3457
|
-
), o = r?.dimensionGroupAttributes,
|
|
3457
|
+
), o = r?.dimensionGroupAttributes, i = [
|
|
3458
3458
|
...s?.dimensions.series || [],
|
|
3459
3459
|
...s?.dimensions.observation || []
|
|
3460
|
-
],
|
|
3461
|
-
u[
|
|
3460
|
+
], c = i?.findIndex((l) => l.id === e), u = new Array(i?.length);
|
|
3461
|
+
u[c] = n || "";
|
|
3462
3462
|
const d = {};
|
|
3463
3463
|
for (const l of a) {
|
|
3464
|
-
const
|
|
3464
|
+
const m = l.relationship.dimensions, { codedSeriesKey: x, decodedSeriesKey: P } = Tt(
|
|
3465
3465
|
t,
|
|
3466
3466
|
u,
|
|
3467
|
-
|
|
3467
|
+
m
|
|
3468
3468
|
);
|
|
3469
3469
|
d[l.id] = {
|
|
3470
|
-
values: o?.[
|
|
3471
|
-
decodedSeriesKey:
|
|
3472
|
-
codedSeriesKey:
|
|
3470
|
+
values: o?.[x] || [],
|
|
3471
|
+
decodedSeriesKey: P,
|
|
3472
|
+
codedSeriesKey: x
|
|
3473
3473
|
};
|
|
3474
3474
|
}
|
|
3475
3475
|
return d;
|
|
@@ -3478,7 +3478,7 @@ const Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start",
|
|
|
3478
3478
|
return;
|
|
3479
3479
|
const n = t.values?.[e];
|
|
3480
3480
|
return n ?? (e instanceof Array ? { values: e } : { value: e.toString() });
|
|
3481
|
-
},
|
|
3481
|
+
}, Ka = (t, e, n, r) => {
|
|
3482
3482
|
const s = e?.find(
|
|
3483
3483
|
(a) => a?.id === t?.id
|
|
3484
3484
|
)?.values;
|
|
@@ -3498,26 +3498,26 @@ const Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start",
|
|
|
3498
3498
|
isMandatory: Number(a?.minOccurs) > 0
|
|
3499
3499
|
};
|
|
3500
3500
|
});
|
|
3501
|
-
},
|
|
3501
|
+
}, Ja = (t = [], e, n) => {
|
|
3502
3502
|
const r = K(e?.conceptIdentity) || "", s = De(r, t);
|
|
3503
3503
|
return n ? pe(s, n) : s?.name ?? s?.id ?? e?.id;
|
|
3504
3504
|
};
|
|
3505
|
-
var qs = /* @__PURE__ */ ((t) => (t.CONDITIONAL = "Conditional", t.MANDATORY = "Mandatory", t))(qs || {}), Te = /* @__PURE__ */ ((t) => (t.DIMENSION = "Dimension", t.MEASURE_DIMENSION = "MeasureDimension", t.TIME_DIMENSION = "TimeDimension", t))(Te || {}),
|
|
3505
|
+
var qs = /* @__PURE__ */ ((t) => (t.CONDITIONAL = "Conditional", t.MANDATORY = "Mandatory", t))(qs || {}), Te = /* @__PURE__ */ ((t) => (t.DIMENSION = "Dimension", t.MEASURE_DIMENSION = "MeasureDimension", t.TIME_DIMENSION = "TimeDimension", t))(Te || {}), Us = /* @__PURE__ */ ((t) => (t.UNBOUNDED = "unbounded", t))(Us || {});
|
|
3506
3506
|
function je(t) {
|
|
3507
3507
|
return t?.dataStructures?.[0]?.dataStructureComponents?.dimensionList;
|
|
3508
3508
|
}
|
|
3509
|
-
function
|
|
3509
|
+
function Za(t) {
|
|
3510
3510
|
return t?.data?.structures?.[0]?.dimensions?.series || [];
|
|
3511
3511
|
}
|
|
3512
|
-
function
|
|
3512
|
+
function eo(t) {
|
|
3513
3513
|
return t?.data?.structures?.[0]?.dimensions?.observation?.[0].values.map((e) => e.value ? e.value : e.id).filter((e) => e != null) || [];
|
|
3514
3514
|
}
|
|
3515
|
-
function
|
|
3515
|
+
function to(t) {
|
|
3516
3516
|
return t.find(
|
|
3517
3517
|
(e) => e.type === Te.TIME_DIMENSION
|
|
3518
3518
|
);
|
|
3519
3519
|
}
|
|
3520
|
-
const
|
|
3520
|
+
const no = (t) => {
|
|
3521
3521
|
const e = /* @__PURE__ */ new Map(), n = t?.dataStructures?.[0], r = t?.metadataStructures?.[0], s = t?.conceptSchemes || [], a = t?.codelists || [];
|
|
3522
3522
|
return t && [
|
|
3523
3523
|
...je(t)?.dimensions || [],
|
|
@@ -3525,26 +3525,26 @@ const to = (t) => {
|
|
|
3525
3525
|
...Ws(r, n),
|
|
3526
3526
|
...n?.dataStructureComponents?.attributeList?.attributes || []
|
|
3527
3527
|
].forEach(
|
|
3528
|
-
(
|
|
3529
|
-
const
|
|
3530
|
-
|
|
3528
|
+
(i) => {
|
|
3529
|
+
const c = De(
|
|
3530
|
+
i?.conceptIdentity,
|
|
3531
3531
|
s
|
|
3532
|
-
), u =
|
|
3532
|
+
), u = i?.localRepresentation?.enumeration || c?.coreRepresentation?.enumeration, d = be(
|
|
3533
3533
|
u,
|
|
3534
3534
|
a
|
|
3535
3535
|
);
|
|
3536
|
-
|
|
3536
|
+
i?.id && (u ? e.set(i?.id, {
|
|
3537
3537
|
...d,
|
|
3538
|
-
name:
|
|
3539
|
-
names:
|
|
3540
|
-
}) : e.set(
|
|
3541
|
-
id:
|
|
3542
|
-
name:
|
|
3543
|
-
names:
|
|
3538
|
+
name: c?.name,
|
|
3539
|
+
names: c?.names
|
|
3540
|
+
}) : e.set(i?.id, {
|
|
3541
|
+
id: i?.id,
|
|
3542
|
+
name: c?.name,
|
|
3543
|
+
names: c?.names
|
|
3544
3544
|
}));
|
|
3545
3545
|
}
|
|
3546
3546
|
), e;
|
|
3547
|
-
},
|
|
3547
|
+
}, ro = (t) => t?.find(
|
|
3548
3548
|
(e) => e.id === ye.SERIES_COUNT
|
|
3549
3549
|
)?.title || "", Ee = 1440 * 60 * 1e3, xe = 7 * Ee;
|
|
3550
3550
|
function Pe(t) {
|
|
@@ -3555,7 +3555,7 @@ function Pe(t) {
|
|
|
3555
3555
|
}
|
|
3556
3556
|
return n;
|
|
3557
3557
|
}
|
|
3558
|
-
function
|
|
3558
|
+
function Hs(t) {
|
|
3559
3559
|
const e = new Date(t), r = -((e.getDay() + 6) % 7) + 3;
|
|
3560
3560
|
return e.setDate(e.getDate() + r), new Date(e.valueOf());
|
|
3561
3561
|
}
|
|
@@ -3570,7 +3570,7 @@ function Et(t, e, n = "W") {
|
|
|
3570
3570
|
return `${t}-${n}${e < 10 ? "0" + e : e}`;
|
|
3571
3571
|
}
|
|
3572
3572
|
function ee(t, e = "W") {
|
|
3573
|
-
const n =
|
|
3573
|
+
const n = Hs(t), r = n.getFullYear(), s = Pe(r), a = 1 + Math.ceil(
|
|
3574
3574
|
(n.getTime() - s.getTime()) / xe
|
|
3575
3575
|
);
|
|
3576
3576
|
return {
|
|
@@ -3579,16 +3579,16 @@ function ee(t, e = "W") {
|
|
|
3579
3579
|
weekYear: r
|
|
3580
3580
|
};
|
|
3581
3581
|
}
|
|
3582
|
-
function
|
|
3582
|
+
function Qs(t) {
|
|
3583
3583
|
const [e, n] = t.split("-W"), s = Pe(+e).getTime() + (+n - 1) * xe - 3 * Ee;
|
|
3584
3584
|
return new Date(s);
|
|
3585
3585
|
}
|
|
3586
|
-
function
|
|
3586
|
+
function Fs(t) {
|
|
3587
3587
|
const [e, n] = t.split("-W"), s = Pe(+e).getTime() + (+n - 1) * xe + 3 * Ee;
|
|
3588
3588
|
return new Date(s);
|
|
3589
3589
|
}
|
|
3590
|
-
const Bs = "/api/download",
|
|
3591
|
-
const
|
|
3590
|
+
const Bs = "/api/download", Vs = 6e4, so = async (t, e, n, r, s, a, o) => {
|
|
3591
|
+
const i = new URLSearchParams({
|
|
3592
3592
|
urn: t,
|
|
3593
3593
|
format: e,
|
|
3594
3594
|
compress: "false",
|
|
@@ -3597,9 +3597,22 @@ const Bs = "/api/download", ro = (t, e, n, r, s, a, o) => {
|
|
|
3597
3597
|
attribute: r,
|
|
3598
3598
|
language: n,
|
|
3599
3599
|
isMetadata: o ? "true" : "none"
|
|
3600
|
-
}).toString(),
|
|
3601
|
-
|
|
3602
|
-
|
|
3600
|
+
}).toString(), c = `${Bs}?${i}`, u = await fetch(c, {
|
|
3601
|
+
method: "GET",
|
|
3602
|
+
credentials: "same-origin"
|
|
3603
|
+
});
|
|
3604
|
+
if (!u.ok) {
|
|
3605
|
+
const x = await u.text();
|
|
3606
|
+
throw new Error(
|
|
3607
|
+
`Download request failed: ${u.status} ${u.statusText}${x ? ` - ${x}` : ""}`
|
|
3608
|
+
);
|
|
3609
|
+
}
|
|
3610
|
+
const d = await u.blob(), l = URL.createObjectURL(d), m = document.createElement("a");
|
|
3611
|
+
m.href = l, m.download = a, m.style.display = "none", document.body.appendChild(m), m.click(), document.body.removeChild(m), window.setTimeout(
|
|
3612
|
+
() => URL.revokeObjectURL(l),
|
|
3613
|
+
Vs
|
|
3614
|
+
);
|
|
3615
|
+
}, ao = (t, e) => {
|
|
3603
3616
|
const n = [];
|
|
3604
3617
|
for (const r of t) {
|
|
3605
3618
|
if (r.type !== Te.DIMENSION)
|
|
@@ -3608,53 +3621,53 @@ const Bs = "/api/download", ro = (t, e, n, r, s, a, o) => {
|
|
|
3608
3621
|
s != null && s.values?.length > 0 ? n.push(s.values?.join(qt)) : n.push("*");
|
|
3609
3622
|
}
|
|
3610
3623
|
return n.join(".");
|
|
3611
|
-
},
|
|
3624
|
+
}, Gs = (t, e) => {
|
|
3612
3625
|
if (!t || !t.startPeriod && !t.endPeriod)
|
|
3613
3626
|
return null;
|
|
3614
3627
|
const n = [], { startPeriod: r, endPeriod: s } = t;
|
|
3615
3628
|
if (r && n.push(
|
|
3616
|
-
`${
|
|
3629
|
+
`${R.GREATER_OR_EQUAL}${_e}${Ke(r)}`
|
|
3617
3630
|
), s && n.push(
|
|
3618
|
-
`${
|
|
3631
|
+
`${R.LESS_OR_EQUAL}${_e}${Ke(s)}`
|
|
3619
3632
|
), n.length === 0)
|
|
3620
3633
|
return null;
|
|
3621
3634
|
const a = e;
|
|
3622
3635
|
return n.map(
|
|
3623
3636
|
(o) => `${encodeURIComponent(`c[${a}]`)}${Wt}${encodeURIComponent(o)}`
|
|
3624
3637
|
).join(st);
|
|
3625
|
-
}, Ke = (t) => Vn(t, "yyyy-MM-dd"),
|
|
3626
|
-
const n =
|
|
3627
|
-
return n ?
|
|
3628
|
-
},
|
|
3638
|
+
}, Ke = (t) => Vn(t, "yyyy-MM-dd"), oo = (t, e) => {
|
|
3639
|
+
const n = Xs(t, e) || null;
|
|
3640
|
+
return n ? Gs(n, e?.id) : null;
|
|
3641
|
+
}, Xs = (t, e) => {
|
|
3629
3642
|
const n = e.id, r = t?.filters?.find(
|
|
3630
|
-
(
|
|
3643
|
+
(c) => c.componentCode === n
|
|
3631
3644
|
);
|
|
3632
3645
|
if (!r || !r.values)
|
|
3633
3646
|
return null;
|
|
3634
|
-
const s = r.values?.filter((
|
|
3647
|
+
const s = r.values?.filter((c) => !!c);
|
|
3635
3648
|
if (!s.length)
|
|
3636
3649
|
return null;
|
|
3637
3650
|
const a = r.operator;
|
|
3638
|
-
if (a ===
|
|
3651
|
+
if (a === R.LESS_OR_EQUAL || a === R.LESS)
|
|
3639
3652
|
return { startPeriod: null, endPeriod: G(s[0]) };
|
|
3640
|
-
if (a ===
|
|
3653
|
+
if (a === R.GREATER_OR_EQUAL || a === R.GREATER)
|
|
3641
3654
|
return { startPeriod: G(s[0]), endPeriod: null };
|
|
3642
|
-
const o = G(s[0]),
|
|
3643
|
-
return { startPeriod: o, endPeriod:
|
|
3644
|
-
},
|
|
3655
|
+
const o = G(s[0]), i = G(s[1]);
|
|
3656
|
+
return { startPeriod: o, endPeriod: i };
|
|
3657
|
+
}, js = "Observation", io = (t) => {
|
|
3645
3658
|
const e = t?.data?.dataSets, n = t?.data?.structures?.[0];
|
|
3646
3659
|
if (!e || !n)
|
|
3647
3660
|
return [];
|
|
3648
|
-
const r = n.attributes, s = n.dimensions, a = r?.dimensionGroup || [], o = e[0].series || e[0].observations,
|
|
3661
|
+
const r = n.attributes, s = n.dimensions, a = r?.dimensionGroup || [], o = e[0].series || e[0].observations, i = s.series?.length ? s.series : s.observation, c = [];
|
|
3649
3662
|
for (const u in o) {
|
|
3650
|
-
const d = [], { name: l, parsedTimeSeriesValue:
|
|
3663
|
+
const d = [], { name: l, parsedTimeSeriesValue: m } = zs(
|
|
3651
3664
|
u,
|
|
3652
|
-
|
|
3653
|
-
),
|
|
3654
|
-
if (Object.keys(
|
|
3655
|
-
|
|
3665
|
+
i
|
|
3666
|
+
), x = o[u], P = x.attributes || [];
|
|
3667
|
+
if (Object.keys(x).length === 0) {
|
|
3668
|
+
c.push({
|
|
3656
3669
|
name: l,
|
|
3657
|
-
parsedTimeSeriesValue:
|
|
3670
|
+
parsedTimeSeriesValue: m,
|
|
3658
3671
|
values: d,
|
|
3659
3672
|
attributes: [],
|
|
3660
3673
|
dataSetAttrs: []
|
|
@@ -3662,69 +3675,69 @@ const Bs = "/api/download", ro = (t, e, n, r, s, a, o) => {
|
|
|
3662
3675
|
continue;
|
|
3663
3676
|
}
|
|
3664
3677
|
d.push(
|
|
3665
|
-
...
|
|
3678
|
+
...ea(x, n)
|
|
3666
3679
|
);
|
|
3667
3680
|
const N = ce(
|
|
3668
3681
|
r?.series || [],
|
|
3669
|
-
(M) =>
|
|
3670
|
-
), f =
|
|
3682
|
+
(M) => P[M]
|
|
3683
|
+
), f = ta(
|
|
3671
3684
|
n.attributes?.dataSet || [],
|
|
3672
3685
|
e[0].attributes?.filter((M) => M != null) || []
|
|
3673
|
-
),
|
|
3686
|
+
), w = Ss(
|
|
3674
3687
|
t,
|
|
3675
|
-
|
|
3676
|
-
),
|
|
3677
|
-
const q =
|
|
3688
|
+
m
|
|
3689
|
+
), v = a.map((M, W) => {
|
|
3690
|
+
const q = w[M.id], F = $s(
|
|
3678
3691
|
M,
|
|
3679
3692
|
q.values[W]
|
|
3680
3693
|
);
|
|
3681
3694
|
return {
|
|
3682
3695
|
attribute: M,
|
|
3683
|
-
dimensionGroupValue:
|
|
3696
|
+
dimensionGroupValue: F,
|
|
3684
3697
|
dimensionGroupData: q
|
|
3685
3698
|
};
|
|
3686
3699
|
});
|
|
3687
|
-
|
|
3700
|
+
c.push({
|
|
3688
3701
|
name: l,
|
|
3689
|
-
parsedTimeSeriesValue:
|
|
3702
|
+
parsedTimeSeriesValue: m,
|
|
3690
3703
|
values: d,
|
|
3691
3704
|
attributes: N,
|
|
3692
3705
|
dataSetAttrs: f,
|
|
3693
|
-
dimensionGroupAttributes:
|
|
3706
|
+
dimensionGroupAttributes: v
|
|
3694
3707
|
});
|
|
3695
3708
|
}
|
|
3696
|
-
return
|
|
3697
|
-
},
|
|
3709
|
+
return c;
|
|
3710
|
+
}, zs = (t, e) => {
|
|
3698
3711
|
const n = t.split(new RegExp("(?<!\\|):(?!\\||$)")), r = [];
|
|
3699
3712
|
for (let s = 0; s < n.length; s++) {
|
|
3700
3713
|
const a = e?.[s], o = Number(n[s]);
|
|
3701
3714
|
if (o < 0 || a == null)
|
|
3702
3715
|
continue;
|
|
3703
|
-
const
|
|
3704
|
-
if (
|
|
3716
|
+
const i = a.values[o];
|
|
3717
|
+
if (i == null) {
|
|
3705
3718
|
r.push(n[s].replace("|:", ":"));
|
|
3706
3719
|
continue;
|
|
3707
3720
|
}
|
|
3708
|
-
r.push(
|
|
3721
|
+
r.push(i?.id || i?.value || "");
|
|
3709
3722
|
}
|
|
3710
3723
|
return {
|
|
3711
|
-
name:
|
|
3724
|
+
name: Js(r),
|
|
3712
3725
|
parsedTimeSeriesValue: r
|
|
3713
3726
|
};
|
|
3714
3727
|
}, ce = (t, e) => {
|
|
3715
3728
|
const n = [];
|
|
3716
3729
|
for (let r = 0; r < t.length; r++) {
|
|
3717
|
-
const s = t[r], a = e(r), o = a != null && s.values != null ?
|
|
3730
|
+
const s = t[r], a = e(r), o = a != null && s.values != null ? Ks(a, s) : void 0;
|
|
3718
3731
|
n.push({
|
|
3719
3732
|
name: s.id,
|
|
3720
3733
|
value: o
|
|
3721
3734
|
});
|
|
3722
3735
|
}
|
|
3723
3736
|
return n;
|
|
3724
|
-
},
|
|
3737
|
+
}, Ks = (t, e) => {
|
|
3725
3738
|
const n = e.values[t];
|
|
3726
3739
|
return n == null ? typeof t == "object" ? t : t.toString() : n?.id || n?.value || n?.ids || n?.values;
|
|
3727
|
-
},
|
|
3740
|
+
}, Js = (t) => t.map((e) => e ? Zs(e) : "").join("."), Zs = (t) => t.replace(/\./g, "|.").replace(/:/g, "|:"), ea = (t, e) => {
|
|
3728
3741
|
const n = e.measures?.observation?.length;
|
|
3729
3742
|
if (t.observations == null)
|
|
3730
3743
|
return [
|
|
@@ -3734,55 +3747,55 @@ const Bs = "/api/download", ro = (t, e, n, r, s, a, o) => {
|
|
|
3734
3747
|
e.attributes?.observation || [],
|
|
3735
3748
|
(o) => t[o + n]
|
|
3736
3749
|
),
|
|
3737
|
-
dimensionAtObservation:
|
|
3750
|
+
dimensionAtObservation: js
|
|
3738
3751
|
}
|
|
3739
3752
|
];
|
|
3740
3753
|
const r = t.observations, s = e.dimensions.observation?.[0], a = [];
|
|
3741
3754
|
for (const o in r) {
|
|
3742
|
-
const
|
|
3755
|
+
const i = s?.values[o];
|
|
3743
3756
|
a.push({
|
|
3744
|
-
dimensionAtObservation:
|
|
3757
|
+
dimensionAtObservation: i?.value || i?.id,
|
|
3745
3758
|
values: Je(
|
|
3746
3759
|
r[o],
|
|
3747
3760
|
e.measures
|
|
3748
3761
|
),
|
|
3749
3762
|
obsAttributes: ce(
|
|
3750
3763
|
e.attributes?.observation || [],
|
|
3751
|
-
(
|
|
3764
|
+
(c) => r[o][c + n]
|
|
3752
3765
|
)
|
|
3753
3766
|
});
|
|
3754
3767
|
}
|
|
3755
3768
|
return a;
|
|
3756
|
-
}, Je = (t, e) => e?.observation?.map((n, r) => ({ name: n.id, value: t[r] })) || [],
|
|
3769
|
+
}, Je = (t, e) => e?.observation?.map((n, r) => ({ name: n.id, value: t[r] })) || [], ta = (t, e) => t.reduce(
|
|
3757
3770
|
(n, r, s) => {
|
|
3758
3771
|
const a = e[s];
|
|
3759
|
-
return
|
|
3772
|
+
return na(n, r, a, ""), n;
|
|
3760
3773
|
},
|
|
3761
3774
|
[]
|
|
3762
|
-
),
|
|
3775
|
+
), na = (t, e, n, r) => {
|
|
3763
3776
|
const s = n != null ? e?.values?.length > 0 ? e.values[n]?.id || e.values[n]?.value : String(n) : r;
|
|
3764
3777
|
t.push({
|
|
3765
3778
|
name: e.id,
|
|
3766
3779
|
value: s || ""
|
|
3767
3780
|
});
|
|
3768
|
-
},
|
|
3781
|
+
}, ra = /^[0-9][0-9][0-9][0-9]-Q[1-4]$/, sa = /^[0-9][0-9][0-9][0-9]-W(0[1-9]|[1-4][0-9]|5[0-3])$/, aa = /^[0-9][0-9][0-9][0-9]-S[1-2]$/, oa = /^[0-9][0-9][0-9][0-9]$/, ia = /^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-[0-9][0-9]$/, ca = /^[0-9][0-9][0-9][0-9]-M(0[1-9]|(1[0-2]))$/, ve = (t) => oa.exec(t), Me = (t) => !!ve(t), ua = (t) => aa.exec(t), Oe = (t) => !!ua(t), Ae = (t) => ca.exec(t), Ne = (t) => !!Ae(t), ke = (t) => ra.exec(t), Re = (t) => !!ke(t), da = (t) => ia.exec(t), la = (t) => !!da(t), fa = (t) => sa.exec(t), Ie = (t) => !!fa(t);
|
|
3769
3782
|
function xt(t) {
|
|
3770
|
-
return Me(t) ?
|
|
3783
|
+
return Me(t) ? ma(t) : Oe(t) ? ga(t) : Re(t) ? ya(t) : Ne(t) ? ba(t) : Ie(t) ? Qs(t) : Ta(t);
|
|
3771
3784
|
}
|
|
3772
3785
|
function Pt(t) {
|
|
3773
|
-
return Me(t) ?
|
|
3786
|
+
return Me(t) ? ha(t) : Oe(t) ? wa(t) : Re(t) ? pa(t) : Ne(t) ? Da(t) : Ie(t) ? Fs(t) : Ea(t);
|
|
3774
3787
|
}
|
|
3775
|
-
function
|
|
3788
|
+
function ma(t) {
|
|
3776
3789
|
const e = ve(t);
|
|
3777
3790
|
if (e)
|
|
3778
3791
|
return new Date(Number(e[0]), 0, 1);
|
|
3779
3792
|
}
|
|
3780
|
-
function
|
|
3793
|
+
function ha(t) {
|
|
3781
3794
|
const e = ve(t);
|
|
3782
3795
|
if (e)
|
|
3783
3796
|
return new Date(Number(e[0]) + 1, 0, 1);
|
|
3784
3797
|
}
|
|
3785
|
-
function
|
|
3798
|
+
function ga(t) {
|
|
3786
3799
|
const [e, n] = t.split("-S");
|
|
3787
3800
|
switch (+n) {
|
|
3788
3801
|
case 1:
|
|
@@ -3791,7 +3804,7 @@ function ha(t) {
|
|
|
3791
3804
|
return new Date(+e, 6, 1);
|
|
3792
3805
|
}
|
|
3793
3806
|
}
|
|
3794
|
-
function
|
|
3807
|
+
function wa(t) {
|
|
3795
3808
|
const [e, n] = t.split("-S");
|
|
3796
3809
|
switch (+n) {
|
|
3797
3810
|
case 1:
|
|
@@ -3800,7 +3813,7 @@ function ga(t) {
|
|
|
3800
3813
|
return new Date(+e + 1, 0, 1);
|
|
3801
3814
|
}
|
|
3802
3815
|
}
|
|
3803
|
-
function
|
|
3816
|
+
function ya(t) {
|
|
3804
3817
|
const e = ke(t);
|
|
3805
3818
|
if (!e)
|
|
3806
3819
|
return;
|
|
@@ -3816,7 +3829,7 @@ function wa(t) {
|
|
|
3816
3829
|
return new Date(+n, 9, 1);
|
|
3817
3830
|
}
|
|
3818
3831
|
}
|
|
3819
|
-
function
|
|
3832
|
+
function pa(t) {
|
|
3820
3833
|
const e = ke(t);
|
|
3821
3834
|
if (!e)
|
|
3822
3835
|
return;
|
|
@@ -3832,45 +3845,45 @@ function ya(t) {
|
|
|
3832
3845
|
return new Date(+n + 1, 0, 1);
|
|
3833
3846
|
}
|
|
3834
3847
|
}
|
|
3835
|
-
function
|
|
3848
|
+
function ba(t) {
|
|
3836
3849
|
const e = Ae(t);
|
|
3837
3850
|
if (!e)
|
|
3838
3851
|
return;
|
|
3839
3852
|
const [n, r] = e[0].split("-M");
|
|
3840
3853
|
return new Date(+n, +r - 1, 1);
|
|
3841
3854
|
}
|
|
3842
|
-
function
|
|
3855
|
+
function Da(t) {
|
|
3843
3856
|
const e = Ae(t);
|
|
3844
3857
|
if (!e)
|
|
3845
3858
|
return;
|
|
3846
3859
|
const [n, r] = e[0].split("-M");
|
|
3847
3860
|
return new Date(+n, +r, 1);
|
|
3848
3861
|
}
|
|
3849
|
-
const
|
|
3862
|
+
const Ta = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Ea = (t) => {
|
|
3850
3863
|
const e = /* @__PURE__ */ new Date(`${t}T23:59:00`);
|
|
3851
3864
|
return e.setMinutes(e.getMinutes() + 1), e;
|
|
3852
|
-
},
|
|
3853
|
-
const a = [], o = e && e > 3 ?
|
|
3854
|
-
for (let
|
|
3855
|
-
a.push(`${t}-${s}${
|
|
3865
|
+
}, xa = 1, Pa = (t, e, n, r = !0, s = "Q") => {
|
|
3866
|
+
const a = [], o = e && e > 3 ? Ra(e, r) : 1, i = n ? Math.floor((n - 1) / 3) : 4;
|
|
3867
|
+
for (let c = o; c <= i; c++)
|
|
3868
|
+
a.push(`${t}-${s}${c}`);
|
|
3856
3869
|
return a;
|
|
3857
|
-
},
|
|
3870
|
+
}, va = (t, e, n, r = "S") => {
|
|
3858
3871
|
const s = [];
|
|
3859
3872
|
return (e || 1) < 7 && (n || 12) > 6 && s.push(`${t}-${r}1`), n == null && s.push(`${t}-${r}2`), s;
|
|
3860
|
-
},
|
|
3873
|
+
}, co = (t) => Math.ceil(t / 3), vt = (t, e, n = "M") => `${t}-${n}${e.toString().padStart(2, "0")}`, Ma = (t, e, n = "M") => {
|
|
3861
3874
|
const r = [];
|
|
3862
3875
|
for (let s = e; s <= 12; s++)
|
|
3863
3876
|
r.push(vt(t, s, n));
|
|
3864
3877
|
return r;
|
|
3865
|
-
},
|
|
3878
|
+
}, Oa = (t, e, n, r = "M") => {
|
|
3866
3879
|
const s = [];
|
|
3867
3880
|
for (let a = e; a < n; a++)
|
|
3868
3881
|
s.push(vt(t, a, r));
|
|
3869
3882
|
return s;
|
|
3870
|
-
},
|
|
3883
|
+
}, Aa = (t, e, n, r = "M") => {
|
|
3871
3884
|
const s = e || 1, a = n == null, o = n || 12;
|
|
3872
|
-
return a ?
|
|
3873
|
-
},
|
|
3885
|
+
return a ? Ma(t, s, r) : Oa(t, s, o, r);
|
|
3886
|
+
}, uo = (t, e, n = "M") => {
|
|
3874
3887
|
switch (e) {
|
|
3875
3888
|
case 0:
|
|
3876
3889
|
return [
|
|
@@ -3899,41 +3912,41 @@ const Da = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Ta = (t) => {
|
|
|
3899
3912
|
default:
|
|
3900
3913
|
return [];
|
|
3901
3914
|
}
|
|
3902
|
-
},
|
|
3903
|
-
const n =
|
|
3904
|
-
return Array.from({ length: o }, (
|
|
3905
|
-
},
|
|
3906
|
-
const n =
|
|
3915
|
+
}, Na = (t, e) => {
|
|
3916
|
+
const n = I(e, !0), r = I(t), s = n.getFullYear(), a = r.getFullYear(), o = n.getTime() <= r.getTime() ? a + xa - s : 0;
|
|
3917
|
+
return Array.from({ length: o }, (c, u) => s + u);
|
|
3918
|
+
}, I = (t, e = !1) => {
|
|
3919
|
+
const n = ka(t, e);
|
|
3907
3920
|
return n ? (n.getTimezoneOffset() > 0 && n.setMinutes(n.getMinutes() + n.getTimezoneOffset()), n) : /* @__PURE__ */ new Date();
|
|
3908
|
-
},
|
|
3921
|
+
}, ka = (t, e = !1) => {
|
|
3909
3922
|
const n = Number(t);
|
|
3910
3923
|
return t.toString().length !== 13 ? e ? xt(t) : Pt(t) : isNaN(n) ? /* @__PURE__ */ new Date(`${t}T00:00:00.000Z`) : new Date(n);
|
|
3911
|
-
},
|
|
3924
|
+
}, Ra = (t, e) => e ? Math.floor((t + 1) / 3) : Math.ceil((t + 1) / 3), lo = (t, e) => {
|
|
3912
3925
|
const n = et(t) - et(e);
|
|
3913
3926
|
if (n === 0 && t !== e) {
|
|
3914
3927
|
const r = Ze(t), s = Ze(e);
|
|
3915
3928
|
return r - s;
|
|
3916
3929
|
}
|
|
3917
3930
|
return n;
|
|
3918
|
-
}, Ze = (t) => Me(t) ? 6 : Oe(t) ? 5 :
|
|
3919
|
-
const r =
|
|
3931
|
+
}, Ze = (t) => Me(t) ? 6 : Oe(t) ? 5 : Re(t) ? 4 : Ne(t) ? 3 : Ie(t) ? 2 : la(t) ? 1 : 0, et = (t, e = !1) => (e ? xt(t) : Pt(t))?.getTime() || 0, Mt = (t, e, n) => {
|
|
3932
|
+
const r = I(e, !0), s = I(n), a = I(t, !0), o = I(t), i = r.getTime() > a.getTime() ? r : a, c = s.getTime() < o.getTime() ? s : o;
|
|
3920
3933
|
return {
|
|
3921
|
-
start:
|
|
3922
|
-
end:
|
|
3934
|
+
start: i,
|
|
3935
|
+
end: c
|
|
3923
3936
|
};
|
|
3924
3937
|
}, Ia = (t, e, n, r = "W") => {
|
|
3925
3938
|
const s = +t, { start: a, end: o } = Mt(t, e, n);
|
|
3926
3939
|
if (a.getTime() > o.getTime())
|
|
3927
3940
|
return [];
|
|
3928
|
-
const
|
|
3929
|
-
if (
|
|
3930
|
-
for (let
|
|
3931
|
-
l.push(Et(s,
|
|
3941
|
+
const i = ee(a, r), c = i.weekYear === s ? i.weekNumber : i.weekYear < s ? 1 : ze(s, r), u = ee(o, r), d = u.weekYear === s ? u.weekNumber : u.weekYear > s ? ze(s, r) : 1, l = [];
|
|
3942
|
+
if (c < d)
|
|
3943
|
+
for (let m = c; m <= d; m++)
|
|
3944
|
+
l.push(Et(s, m, r));
|
|
3932
3945
|
return l;
|
|
3933
|
-
},
|
|
3946
|
+
}, _a = (t) => {
|
|
3934
3947
|
const e = new Date(t);
|
|
3935
3948
|
return e.setMinutes(e.getMinutes() - e.getTimezoneOffset()), e.toISOString().slice(0, 10);
|
|
3936
|
-
},
|
|
3949
|
+
}, Ya = (t, e, n) => {
|
|
3937
3950
|
const { start: r, end: s } = Mt(t, e, n);
|
|
3938
3951
|
if (r.getTime() > s.getTime())
|
|
3939
3952
|
return [];
|
|
@@ -3941,13 +3954,13 @@ const Da = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Ta = (t) => {
|
|
|
3941
3954
|
r.getFullYear(),
|
|
3942
3955
|
r.getMonth(),
|
|
3943
3956
|
r.getDate()
|
|
3944
|
-
),
|
|
3945
|
-
for (; o.getTime() <
|
|
3946
|
-
const
|
|
3947
|
-
a.push(
|
|
3957
|
+
), i = new Date(s.getFullYear(), s.getMonth(), s.getDate());
|
|
3958
|
+
for (; o.getTime() < i.getTime(); ) {
|
|
3959
|
+
const c = _a(o);
|
|
3960
|
+
a.push(c), o.setDate(o.getDate() + 1);
|
|
3948
3961
|
}
|
|
3949
3962
|
return a;
|
|
3950
|
-
},
|
|
3963
|
+
}, Ca = (t) => ({
|
|
3951
3964
|
isDailyExist: !!t?.some(({ memberValue: e }) => e === "D"),
|
|
3952
3965
|
isWeeklyExist: !!t?.some(({ memberValue: e }) => e === "W"),
|
|
3953
3966
|
isMonthlyExist: !!t?.some(({ memberValue: e }) => e === "M"),
|
|
@@ -3956,49 +3969,49 @@ const Da = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Ta = (t) => {
|
|
|
3956
3969
|
isYearlyExist: !!t?.some(
|
|
3957
3970
|
({ memberValue: e }) => e === "A" || e === "Y"
|
|
3958
3971
|
)
|
|
3959
|
-
}),
|
|
3960
|
-
const s = r === 0 ?
|
|
3972
|
+
}), La = (t, e, n, r) => {
|
|
3973
|
+
const s = r === 0 ? I(e.toString(), !0)?.getMonth() + 1 : void 0, a = r === t.length - 1 ? I(n.toString())?.getMonth() + 1 || 1 : void 0;
|
|
3961
3974
|
return { startMonth: s, endMonth: a };
|
|
3962
|
-
}, Sa = ["FREQUENCY", "FREQ"],
|
|
3975
|
+
}, Sa = ["FREQUENCY", "FREQ"], fo = (t, e) => {
|
|
3963
3976
|
const n = t?.[0]?.cubeRegions?.[0]?.memberSelection?.find(
|
|
3964
|
-
(
|
|
3965
|
-
)?.selectionValues, r =
|
|
3966
|
-
return o.forEach((
|
|
3967
|
-
const d = [], { startMonth: l, endMonth:
|
|
3977
|
+
(c) => Sa.includes(c.componentId)
|
|
3978
|
+
)?.selectionValues, r = Ca(n || []), s = e?.startPeriod?.getTime() || 1, a = e?.endPeriod?.getTime() || 1, o = Na(a, s), i = [];
|
|
3979
|
+
return o.forEach((c, u) => {
|
|
3980
|
+
const d = [], { startMonth: l, endMonth: m } = La(
|
|
3968
3981
|
o,
|
|
3969
3982
|
new Date(s),
|
|
3970
3983
|
new Date(a),
|
|
3971
3984
|
u
|
|
3972
3985
|
), {
|
|
3973
|
-
isDailyExist:
|
|
3974
|
-
isWeeklyExist:
|
|
3986
|
+
isDailyExist: x,
|
|
3987
|
+
isWeeklyExist: P,
|
|
3975
3988
|
isMonthlyExist: N,
|
|
3976
3989
|
isQuarterlyExist: f,
|
|
3977
|
-
isSemiAnnualExist:
|
|
3978
|
-
isYearlyExist:
|
|
3990
|
+
isSemiAnnualExist: w,
|
|
3991
|
+
isYearlyExist: v
|
|
3979
3992
|
} = r;
|
|
3980
|
-
|
|
3981
|
-
...
|
|
3982
|
-
), N && d.push(...
|
|
3983
|
-
...Ia(
|
|
3984
|
-
),
|
|
3985
|
-
...
|
|
3986
|
-
),
|
|
3987
|
-
}),
|
|
3993
|
+
v && d.push(c.toString()), w && d.push(...va(c, l, m)), f && d.push(
|
|
3994
|
+
...Pa(c, l, m, !1)
|
|
3995
|
+
), N && d.push(...Aa(c, l, m)), P && d.push(
|
|
3996
|
+
...Ia(c, s.toString(), a.toString())
|
|
3997
|
+
), x && d.push(
|
|
3998
|
+
...Ya(c, s.toString(), a.toString())
|
|
3999
|
+
), i.push(...d);
|
|
4000
|
+
}), i;
|
|
3988
4001
|
};
|
|
3989
|
-
function
|
|
4002
|
+
function $a(t) {
|
|
3990
4003
|
const { urn: e } = t.details;
|
|
3991
4004
|
return de(e.resourceId, e.version, e.agencyId);
|
|
3992
4005
|
}
|
|
3993
|
-
function
|
|
4006
|
+
function mo(t) {
|
|
3994
4007
|
const e = {};
|
|
3995
4008
|
for (const n of t.datasets) {
|
|
3996
|
-
const r = n.dataset, s =
|
|
4009
|
+
const r = n.dataset, s = $a(r);
|
|
3997
4010
|
e[s] = r.details.dimensions;
|
|
3998
4011
|
}
|
|
3999
4012
|
return e;
|
|
4000
4013
|
}
|
|
4001
|
-
function
|
|
4014
|
+
function ho(t) {
|
|
4002
4015
|
return t?.codelists?.length ? t.codelists.map((e) => ({
|
|
4003
4016
|
id: e.id,
|
|
4004
4017
|
agencyID: e.agencyID ?? "",
|
|
@@ -4021,7 +4034,7 @@ function mo(t) {
|
|
|
4021
4034
|
}))
|
|
4022
4035
|
}));
|
|
4023
4036
|
}
|
|
4024
|
-
function
|
|
4037
|
+
function Wa(t, e) {
|
|
4025
4038
|
const n = (r) => {
|
|
4026
4039
|
const s = r.indexOf("(");
|
|
4027
4040
|
if (s === -1) return r;
|
|
@@ -4039,12 +4052,12 @@ function ue(t) {
|
|
|
4039
4052
|
}
|
|
4040
4053
|
function Ot(t, e, n) {
|
|
4041
4054
|
e?.forEach((r) => {
|
|
4042
|
-
const { childId: s, agency: a, id: o, version:
|
|
4043
|
-
(l) =>
|
|
4055
|
+
const { childId: s, agency: a, id: o, version: i } = tt(r.code), c = de(o, i, a), u = n?.find(
|
|
4056
|
+
(l) => Wa(c, ue(l))
|
|
4044
4057
|
), d = u?.codes?.find((l) => l.id === s);
|
|
4045
4058
|
if (d != null) {
|
|
4046
4059
|
const l = r.code.replace(
|
|
4047
|
-
|
|
4060
|
+
c,
|
|
4048
4061
|
ue(u)
|
|
4049
4062
|
);
|
|
4050
4063
|
t.push({ ...d, code: l });
|
|
@@ -4052,17 +4065,17 @@ function Ot(t, e, n) {
|
|
|
4052
4065
|
Ot(t, r.hierarchicalCodes, n);
|
|
4053
4066
|
});
|
|
4054
4067
|
}
|
|
4055
|
-
function
|
|
4068
|
+
function go(t, e) {
|
|
4056
4069
|
const n = [];
|
|
4057
4070
|
return Ot(n, t?.hierarchicalCodes, e), n;
|
|
4058
4071
|
}
|
|
4059
|
-
function
|
|
4072
|
+
function wo(t) {
|
|
4060
4073
|
const e = {};
|
|
4061
4074
|
return t?.forEach((n) => {
|
|
4062
4075
|
e[ue(n)] = n.codes;
|
|
4063
4076
|
}), e;
|
|
4064
4077
|
}
|
|
4065
|
-
function
|
|
4078
|
+
function yo(t, e, n) {
|
|
4066
4079
|
if (!n || n.length === 0 || !e)
|
|
4067
4080
|
return t;
|
|
4068
4081
|
const r = n[0].cubeRegions?.find(
|
|
@@ -4076,25 +4089,25 @@ function wo(t, e, n) {
|
|
|
4076
4089
|
const a = new Set(s.selectionValues.map((o) => o.memberValue));
|
|
4077
4090
|
return t.filter((o) => a.has(o.id));
|
|
4078
4091
|
}
|
|
4079
|
-
class
|
|
4092
|
+
class po {
|
|
4080
4093
|
constructor(e) {
|
|
4081
4094
|
this.client = e;
|
|
4082
4095
|
}
|
|
4083
4096
|
async getAvailableHierarchies(e, n) {
|
|
4084
|
-
const { agency: r, id: s, version: a } = C(e),
|
|
4097
|
+
const { agency: r, id: s, version: a } = C(e), i = `${this.client.config.sdmxProxyUrl ? this.client.config.sdmxProxyUrl : this.client.config.apiUrl}/sdmx/3.0/structure/codelist`;
|
|
4085
4098
|
return this.client.request(
|
|
4086
4099
|
`${r}/${s}/${a}?references=hierarchy&detail=allcompletestubs`,
|
|
4087
4100
|
{ method: "GET" },
|
|
4088
|
-
|
|
4101
|
+
i,
|
|
4089
4102
|
n
|
|
4090
4103
|
);
|
|
4091
4104
|
}
|
|
4092
4105
|
async getHierarchy(e, n) {
|
|
4093
|
-
const { agency: r, id: s, version: a } = C(e),
|
|
4106
|
+
const { agency: r, id: s, version: a } = C(e), i = `${this.client.config.sdmxProxyUrl ? this.client.config.sdmxProxyUrl : this.client.config.apiUrl}/sdmx/3.0/structure/hierarchy`;
|
|
4094
4107
|
return this.client.request(
|
|
4095
4108
|
`${r}/${s}/${a}?references=descendants&detail=full`,
|
|
4096
4109
|
{ method: "GET" },
|
|
4097
|
-
|
|
4110
|
+
i,
|
|
4098
4111
|
n
|
|
4099
4112
|
);
|
|
4100
4113
|
}
|
|
@@ -4102,20 +4115,20 @@ class yo {
|
|
|
4102
4115
|
export {
|
|
4103
4116
|
ye as Annotations,
|
|
4104
4117
|
qs as AssignmentStatus,
|
|
4105
|
-
|
|
4118
|
+
qa as AvailabilityApi,
|
|
4106
4119
|
$t as DATASET_DATA_URL,
|
|
4107
4120
|
Ha as DatasetApi,
|
|
4108
4121
|
Te as DimensionType,
|
|
4109
4122
|
Ct as DownloadType,
|
|
4110
|
-
|
|
4123
|
+
Ba as FREQUENCY_DIMENSION_ID,
|
|
4111
4124
|
Sa as FREQUENCY_DIM_ID,
|
|
4112
4125
|
Yt as FileColumnsAttribute,
|
|
4113
|
-
|
|
4114
|
-
|
|
4126
|
+
Ut as GET_v3_FILTER_ALL,
|
|
4127
|
+
Ua as GET_v3_FILTER_AND,
|
|
4115
4128
|
qt as GET_v3_FILTER_OR,
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4129
|
+
po as HierarchyApi,
|
|
4130
|
+
js as OBSERVATION_KEY,
|
|
4131
|
+
Us as OccurrenceType,
|
|
4119
4132
|
gs as Periods,
|
|
4120
4133
|
hs as RepresentationTextType,
|
|
4121
4134
|
ms as SDMX_DATA_QUERY_PARAMS,
|
|
@@ -4125,96 +4138,96 @@ export {
|
|
|
4125
4138
|
X as SdmxDataFormat,
|
|
4126
4139
|
rt as SdmxDetails,
|
|
4127
4140
|
le as SdmxReferences,
|
|
4128
|
-
|
|
4141
|
+
R as SeriesFilterOperator,
|
|
4129
4142
|
ws as TIME_PERIOD,
|
|
4130
4143
|
ps as TIME_PERIOD_END_ANNOTATION_KEY,
|
|
4131
4144
|
ys as TIME_PERIOD_START_ANNOTATION_KEY,
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4145
|
+
mo as buildDatasetDimensionsMetadataMap,
|
|
4146
|
+
ia as dailyPattern,
|
|
4147
|
+
Zs as decodeDimensionId,
|
|
4148
|
+
ja as findCodelistByDimension,
|
|
4136
4149
|
Ye as generateDatasetDataRequest,
|
|
4137
4150
|
de as generateShortUrn,
|
|
4138
|
-
|
|
4139
|
-
|
|
4151
|
+
fo as getAdditionalColumns,
|
|
4152
|
+
Va as getAnnotationPeriod,
|
|
4140
4153
|
be as getArtifactByUrnWithWildCard,
|
|
4141
|
-
|
|
4142
|
-
|
|
4154
|
+
za as getAttachedDimensionsSeriesByDimension,
|
|
4155
|
+
Ss as getAttachedDimensionsSeriesByTsId,
|
|
4143
4156
|
Tt as getAttachedDimensionsSeriesKey,
|
|
4144
4157
|
$s as getAttributeValueFromDataQueryResponse,
|
|
4145
|
-
|
|
4146
|
-
|
|
4158
|
+
Ka as getAvailableCodes,
|
|
4159
|
+
Ga as getAvailableCodesFromConstrains,
|
|
4147
4160
|
tt as getChildParsedUrn,
|
|
4148
|
-
|
|
4161
|
+
wo as getCodeListsData,
|
|
4149
4162
|
De as getConcept,
|
|
4150
4163
|
Xe as getConceptByUrn,
|
|
4151
4164
|
Cs as getConceptWithScheme,
|
|
4152
4165
|
Ws as getConvertedMetaAttributes,
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4166
|
+
da as getDailyRegExp,
|
|
4167
|
+
Ya as getDaysColumns,
|
|
4168
|
+
Ja as getDimensionTitle,
|
|
4156
4169
|
je as getDimensions,
|
|
4157
4170
|
fs as getFilteredItemsWithParents,
|
|
4158
4171
|
Ps as getFiltersDtoFromDataQuery,
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4172
|
+
Xa as getFiltersDtoMapFromDataQuery,
|
|
4173
|
+
yo as getHierarchyAvailableCodes,
|
|
4174
|
+
go as getHierarchyCodes,
|
|
4162
4175
|
ee as getISOWeek,
|
|
4163
4176
|
K as getKeyFromUrn,
|
|
4164
4177
|
Fa as getLastUpdatedTime,
|
|
4165
4178
|
ze as getLastWeekNumberOfYear,
|
|
4166
4179
|
pe as getLocalizedName,
|
|
4167
|
-
|
|
4168
|
-
|
|
4180
|
+
Aa as getMonthlyData,
|
|
4181
|
+
uo as getMonthlyDataByQuarter,
|
|
4169
4182
|
Ae as getMonthlyRegExp,
|
|
4170
4183
|
Pt as getParsedEndPeriodDate,
|
|
4171
|
-
|
|
4184
|
+
io as getParsedResponse,
|
|
4172
4185
|
xt as getParsedStartPeriodDate,
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4186
|
+
I as getPeriodDate,
|
|
4187
|
+
Ca as getPeriods,
|
|
4188
|
+
co as getQuarterByMonth,
|
|
4176
4189
|
ke as getQuarterlyRegExp,
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4190
|
+
Pa as getQuartersData,
|
|
4191
|
+
Gs as getQueryTimePeriodFilters,
|
|
4192
|
+
Lt as getRequestAcceptHeader,
|
|
4193
|
+
Rs as getResolvedVersionBySingleWildcard,
|
|
4194
|
+
va as getSemiAnnualData,
|
|
4195
|
+
ua as getSemiAnnuallyRegExp,
|
|
4183
4196
|
ce as getSeriesAttributes,
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4197
|
+
zs as getSeriesName,
|
|
4198
|
+
no as getStructureComponentsMap,
|
|
4199
|
+
Za as getStructureDimensions,
|
|
4200
|
+
to as getTimeDimension,
|
|
4201
|
+
eo as getTimePeriods,
|
|
4202
|
+
oo as getTimeQueryFilter,
|
|
4203
|
+
Xs as getTimeRangeFromAttachment,
|
|
4204
|
+
ro as getTimeSeriesCount,
|
|
4205
|
+
ao as getTimeSeriesFilterKey,
|
|
4206
|
+
Js as getTimeSeriesId,
|
|
4194
4207
|
Et as getWeekCode,
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4208
|
+
Fs as getWeeklyPeriodEndDate,
|
|
4209
|
+
Qs as getWeeklyPeriodStartDate,
|
|
4210
|
+
fa as getWeeklyRegExp,
|
|
4198
4211
|
Ia as getWeeksColumns,
|
|
4199
4212
|
_s as getWildCardPrefix,
|
|
4200
4213
|
Mt as getYearPeriod,
|
|
4201
4214
|
ve as getYearlyRegExp,
|
|
4202
|
-
|
|
4203
|
-
|
|
4215
|
+
Na as getYears,
|
|
4216
|
+
la as isDaily,
|
|
4204
4217
|
Ne as isMonthly,
|
|
4205
|
-
|
|
4218
|
+
Re as isQuarterly,
|
|
4206
4219
|
Oe as isSemiAnnually,
|
|
4207
|
-
|
|
4220
|
+
Ie as isWeekly,
|
|
4208
4221
|
Ys as isWildCardVersionCorrect,
|
|
4209
4222
|
Me as isYearly,
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4223
|
+
ca as monthlyPattern,
|
|
4224
|
+
so as openDownloadWindow,
|
|
4225
|
+
ra as quarterPattern,
|
|
4226
|
+
ho as resolveCodelistsFromResponse,
|
|
4227
|
+
aa as semiAnnuallyPattern,
|
|
4228
|
+
lo as sortPeriods,
|
|
4216
4229
|
C as splitUrn,
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4230
|
+
Wa as urnMatchesIgnoreVersion,
|
|
4231
|
+
sa as weeklyPattern,
|
|
4232
|
+
oa as yearlyPattern
|
|
4220
4233
|
};
|