@epam/statgpt-sdmx-toolkit 0.4.0-rc.32 → 0.4.0-rc.34
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/api/availability-api.d.ts +1 -1
- package/api/dataset-api.d.ts +3 -3
- package/api/sdmx-api-client.d.ts +5 -4
- package/api/sdmx-config.d.ts +2 -0
- package/index.cjs +2 -2
- package/index.mjs +412 -393
- package/package.json +3 -3
package/index.mjs
CHANGED
|
@@ -61,24 +61,26 @@ class La {
|
|
|
61
61
|
constructor(e) {
|
|
62
62
|
this.client = e;
|
|
63
63
|
}
|
|
64
|
-
async getConstraints(e, n) {
|
|
65
|
-
const { agency:
|
|
64
|
+
async getConstraints(e, n, r) {
|
|
65
|
+
const { agency: s, id: a, version: o } = H(e), c = {
|
|
66
66
|
filters: n || [],
|
|
67
67
|
mode: Ze.AVAILABLE,
|
|
68
68
|
references: ue.NONE
|
|
69
|
-
}, i = Rt(
|
|
69
|
+
}, i = Rt(s, a, o);
|
|
70
70
|
if (this.client.config.sdmxProxyUrl) {
|
|
71
|
-
const
|
|
71
|
+
const u = await this.client.postRequest(
|
|
72
72
|
i,
|
|
73
|
-
{ body:
|
|
74
|
-
this.client.config.sdmxProxyUrl
|
|
73
|
+
{ body: c },
|
|
74
|
+
this.client.config.sdmxProxyUrl,
|
|
75
|
+
r
|
|
75
76
|
);
|
|
76
|
-
return vt(
|
|
77
|
+
return vt(u);
|
|
77
78
|
}
|
|
78
79
|
return await this.client.postRequest(
|
|
79
80
|
i,
|
|
80
|
-
{ body:
|
|
81
|
-
this.client.config.constrainsApiUrl || this.client.config.apiUrl
|
|
81
|
+
{ body: c },
|
|
82
|
+
this.client.config.constrainsApiUrl || this.client.config.apiUrl,
|
|
83
|
+
r
|
|
82
84
|
);
|
|
83
85
|
}
|
|
84
86
|
}
|
|
@@ -106,38 +108,44 @@ const Yt = (t, e) => {
|
|
|
106
108
|
}, B = (t, e) => `${t}; labels=${e}`;
|
|
107
109
|
var et = /* @__PURE__ */ ((t) => (t.REFERENCE_PARTIAL = "referencepartial", t.FULL = "full", t))(et || {});
|
|
108
110
|
const Ct = "all", Lt = "sdmx/3.0/data/dataflow", tt = "&", Re = ":", St = "=", Wt = "+", Sa = ",", $t = "*", _e = (t, e, n) => {
|
|
109
|
-
const { filterKey: r, timeFilter: s } = n, { agency: a, id: o, version:
|
|
110
|
-
return `${`${Lt}/${a}/${o}/${
|
|
111
|
+
const { filterKey: r, timeFilter: s } = n, { agency: a, id: o, version: c } = H(t), i = [s || "", e].filter((d) => !!d).join(tt);
|
|
112
|
+
return `${`${Lt}/${a}/${o}/${c}`}/${r || $t}?${i}`;
|
|
111
113
|
}, qt = (t = "", e = "", n = "", r = ue.DESCENDANTS) => `sdmx/3.0/structure/dataflow/${t}/${e}/${n}?references=${r}&detail=${et.REFERENCE_PARTIAL}`;
|
|
112
114
|
class Wa {
|
|
113
115
|
constructor(e) {
|
|
114
116
|
this.client = e;
|
|
115
117
|
}
|
|
116
|
-
async getDataSet(e, n) {
|
|
117
|
-
const { agency:
|
|
118
|
+
async getDataSet(e, n, r) {
|
|
119
|
+
const { agency: s, id: a, version: o } = H(e);
|
|
118
120
|
return await this.client.getRequest(
|
|
119
|
-
qt(
|
|
121
|
+
qt(s, a, o, n),
|
|
122
|
+
void 0,
|
|
123
|
+
r
|
|
120
124
|
);
|
|
121
125
|
}
|
|
122
|
-
async getDatasetData(e, n) {
|
|
123
|
-
const
|
|
126
|
+
async getDatasetData(e, n, r) {
|
|
127
|
+
const s = new URLSearchParams({
|
|
124
128
|
includeHistory: "false",
|
|
125
129
|
limit: "1000",
|
|
126
130
|
attributes: Ct,
|
|
127
131
|
dimensionAtObservation: "TIME_PERIOD"
|
|
128
132
|
// TODO: use time dimensions
|
|
129
|
-
}).toString(),
|
|
130
|
-
return await this.client.getRequest(
|
|
133
|
+
}).toString(), a = _e(e, s, n);
|
|
134
|
+
return await this.client.getRequest(
|
|
135
|
+
a,
|
|
136
|
+
void 0,
|
|
137
|
+
r
|
|
138
|
+
);
|
|
131
139
|
}
|
|
132
|
-
async downloadDataSet(e, n, r, s, a, o,
|
|
133
|
-
const
|
|
140
|
+
async downloadDataSet(e, n, r, s, a, o, c = !1, i) {
|
|
141
|
+
const u = new URLSearchParams({
|
|
134
142
|
format: n,
|
|
135
143
|
compress: "false",
|
|
136
|
-
attributes:
|
|
144
|
+
attributes: c ? "all" : "none",
|
|
137
145
|
limit: "1000"
|
|
138
|
-
}).toString(),
|
|
146
|
+
}).toString(), d = _e(e, u, a);
|
|
139
147
|
return this.client.streamRequest(
|
|
140
|
-
|
|
148
|
+
d,
|
|
141
149
|
{
|
|
142
150
|
method: "GET",
|
|
143
151
|
headers: {
|
|
@@ -145,11 +153,12 @@ class Wa {
|
|
|
145
153
|
"Accept-language": r
|
|
146
154
|
}
|
|
147
155
|
},
|
|
148
|
-
o
|
|
156
|
+
o,
|
|
157
|
+
i
|
|
149
158
|
);
|
|
150
159
|
}
|
|
151
160
|
}
|
|
152
|
-
const Qt = (t, e) => t.error || t.message || `${e.status} ${e.statusText}`, Ft = "application/json", Ht = "Content-Type",
|
|
161
|
+
const Qt = (t, e) => t.error || t.message || `${e.status} ${e.statusText}`, Ft = "application/json", Ht = "Content-Type", j = "Api-Key", Ut = "X-CONVERSATION-ID", z = "Ocp-Apim-Subscription-Key";
|
|
153
162
|
class Ie extends Error {
|
|
154
163
|
constructor(e) {
|
|
155
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;
|
|
@@ -159,34 +168,34 @@ const nt = 6048e5, Bt = 864e5, de = 6e4, le = 36e5, Gt = 1e3, Ye = /* @__PURE__
|
|
|
159
168
|
function E(t, e) {
|
|
160
169
|
return typeof t == "function" ? t(e) : t && typeof t == "object" && Ye in t ? t[Ye](e) : t instanceof Date ? new t.constructor(e) : new Date(e);
|
|
161
170
|
}
|
|
162
|
-
function
|
|
171
|
+
function p(t, e) {
|
|
163
172
|
return E(e || t, t);
|
|
164
173
|
}
|
|
165
174
|
function rt(t, e, n) {
|
|
166
|
-
const r =
|
|
175
|
+
const r = p(t, n?.in);
|
|
167
176
|
return isNaN(e) ? E(n?.in || t, NaN) : (e && r.setDate(r.getDate() + e), r);
|
|
168
177
|
}
|
|
169
178
|
let Vt = {};
|
|
170
179
|
function S() {
|
|
171
180
|
return Vt;
|
|
172
181
|
}
|
|
173
|
-
function
|
|
174
|
-
const n = S(), r = e?.weekStartsOn ?? e?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, s =
|
|
182
|
+
function I(t, e) {
|
|
183
|
+
const n = S(), 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;
|
|
175
184
|
return s.setDate(s.getDate() - o), s.setHours(0, 0, 0, 0), s;
|
|
176
185
|
}
|
|
177
186
|
function L(t, e) {
|
|
178
|
-
return
|
|
187
|
+
return I(t, { ...e, weekStartsOn: 1 });
|
|
179
188
|
}
|
|
180
189
|
function st(t, e) {
|
|
181
|
-
const n =
|
|
190
|
+
const n = p(t, e?.in), r = n.getFullYear(), s = E(n, 0);
|
|
182
191
|
s.setFullYear(r + 1, 0, 4), s.setHours(0, 0, 0, 0);
|
|
183
192
|
const a = L(s), o = E(n, 0);
|
|
184
193
|
o.setFullYear(r, 0, 4), o.setHours(0, 0, 0, 0);
|
|
185
|
-
const
|
|
186
|
-
return n.getTime() >= a.getTime() ? r + 1 : n.getTime() >=
|
|
194
|
+
const c = L(o);
|
|
195
|
+
return n.getTime() >= a.getTime() ? r + 1 : n.getTime() >= c.getTime() ? r : r - 1;
|
|
187
196
|
}
|
|
188
|
-
function
|
|
189
|
-
const e =
|
|
197
|
+
function J(t) {
|
|
198
|
+
const e = p(t), n = new Date(
|
|
190
199
|
Date.UTC(
|
|
191
200
|
e.getFullYear(),
|
|
192
201
|
e.getMonth(),
|
|
@@ -207,7 +216,7 @@ function Xt(t, ...e) {
|
|
|
207
216
|
return e.map(n);
|
|
208
217
|
}
|
|
209
218
|
function Ce(t, e) {
|
|
210
|
-
const n =
|
|
219
|
+
const n = p(t, e?.in);
|
|
211
220
|
return n.setHours(0, 0, 0, 0), n;
|
|
212
221
|
}
|
|
213
222
|
function jt(t, e, n) {
|
|
@@ -215,21 +224,21 @@ function jt(t, e, n) {
|
|
|
215
224
|
n?.in,
|
|
216
225
|
t,
|
|
217
226
|
e
|
|
218
|
-
), a = Ce(r), o = Ce(s),
|
|
219
|
-
return Math.round((
|
|
227
|
+
), a = Ce(r), o = Ce(s), c = +a - J(a), i = +o - J(o);
|
|
228
|
+
return Math.round((c - i) / Bt);
|
|
220
229
|
}
|
|
221
|
-
function
|
|
230
|
+
function zt(t, e) {
|
|
222
231
|
const n = st(t, e), r = E(t, 0);
|
|
223
232
|
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), L(r);
|
|
224
233
|
}
|
|
225
|
-
function
|
|
234
|
+
function Kt(t) {
|
|
226
235
|
return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
|
|
227
236
|
}
|
|
228
237
|
function re(t) {
|
|
229
|
-
return !(!
|
|
238
|
+
return !(!Kt(t) && typeof t != "number" || isNaN(+p(t)));
|
|
230
239
|
}
|
|
231
240
|
function Jt(t, e) {
|
|
232
|
-
const n =
|
|
241
|
+
const n = p(t, e?.in);
|
|
233
242
|
return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
|
|
234
243
|
}
|
|
235
244
|
const Zt = {
|
|
@@ -346,11 +355,11 @@ function q(t) {
|
|
|
346
355
|
const r = n?.context ? String(n.context) : "standalone";
|
|
347
356
|
let s;
|
|
348
357
|
if (r === "formatting" && t.formattingValues) {
|
|
349
|
-
const o = t.defaultFormattingWidth || t.defaultWidth,
|
|
350
|
-
s = t.formattingValues[
|
|
358
|
+
const o = t.defaultFormattingWidth || t.defaultWidth, c = n?.width ? String(n.width) : o;
|
|
359
|
+
s = t.formattingValues[c] || t.formattingValues[o];
|
|
351
360
|
} else {
|
|
352
|
-
const o = t.defaultWidth,
|
|
353
|
-
s = t.values[
|
|
361
|
+
const o = t.defaultWidth, c = n?.width ? String(n.width) : t.defaultWidth;
|
|
362
|
+
s = t.values[c] || t.values[o];
|
|
354
363
|
}
|
|
355
364
|
const a = t.argumentCallback ? t.argumentCallback(e) : e;
|
|
356
365
|
return s[a];
|
|
@@ -512,12 +521,12 @@ function Q(t) {
|
|
|
512
521
|
const r = n.width, s = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], a = e.match(s);
|
|
513
522
|
if (!a)
|
|
514
523
|
return null;
|
|
515
|
-
const o = a[0],
|
|
524
|
+
const o = a[0], c = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], i = Array.isArray(c) ? yn(c, (l) => l.test(o)) : (
|
|
516
525
|
// [TODO] -- I challenge you to fix the type
|
|
517
|
-
gn(
|
|
526
|
+
gn(c, (l) => l.test(o))
|
|
518
527
|
);
|
|
519
528
|
let u;
|
|
520
|
-
u = t.valueCallback ? t.valueCallback(
|
|
529
|
+
u = t.valueCallback ? t.valueCallback(i) : i, u = n.valueCallback ? (
|
|
521
530
|
// [TODO] -- I challenge you to fix the type
|
|
522
531
|
n.valueCallback(u)
|
|
523
532
|
) : u;
|
|
@@ -530,12 +539,12 @@ function gn(t, e) {
|
|
|
530
539
|
if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n]))
|
|
531
540
|
return n;
|
|
532
541
|
}
|
|
533
|
-
function
|
|
542
|
+
function yn(t, e) {
|
|
534
543
|
for (let n = 0; n < t.length; n++)
|
|
535
544
|
if (e(t[n]))
|
|
536
545
|
return n;
|
|
537
546
|
}
|
|
538
|
-
function
|
|
547
|
+
function pn(t) {
|
|
539
548
|
return (e, n = {}) => {
|
|
540
549
|
const r = e.match(t.matchPattern);
|
|
541
550
|
if (!r) return null;
|
|
@@ -543,8 +552,8 @@ function yn(t) {
|
|
|
543
552
|
if (!a) return null;
|
|
544
553
|
let o = t.valueCallback ? t.valueCallback(a[0]) : a[0];
|
|
545
554
|
o = n.valueCallback ? n.valueCallback(o) : o;
|
|
546
|
-
const
|
|
547
|
-
return { value: o, rest:
|
|
555
|
+
const c = e.slice(s.length);
|
|
556
|
+
return { value: o, rest: c };
|
|
548
557
|
};
|
|
549
558
|
}
|
|
550
559
|
const bn = /^(\d+)(th|st|nd|rd)?/i, Dn = /\d+/i, Tn = {
|
|
@@ -615,7 +624,7 @@ const bn = /^(\d+)(th|st|nd|rd)?/i, Dn = /\d+/i, Tn = {
|
|
|
615
624
|
night: /night/i
|
|
616
625
|
}
|
|
617
626
|
}, Rn = {
|
|
618
|
-
ordinalNumber:
|
|
627
|
+
ordinalNumber: pn({
|
|
619
628
|
matchPattern: bn,
|
|
620
629
|
parsePattern: Dn,
|
|
621
630
|
valueCallback: (t) => parseInt(t, 10)
|
|
@@ -664,34 +673,34 @@ const bn = /^(\d+)(th|st|nd|rd)?/i, Dn = /\d+/i, Tn = {
|
|
|
664
673
|
}
|
|
665
674
|
};
|
|
666
675
|
function _n(t, e) {
|
|
667
|
-
const n =
|
|
676
|
+
const n = p(t, e?.in);
|
|
668
677
|
return jt(n, Jt(n)) + 1;
|
|
669
678
|
}
|
|
670
679
|
function ot(t, e) {
|
|
671
|
-
const n =
|
|
680
|
+
const n = p(t, e?.in), r = +L(n) - +zt(n);
|
|
672
681
|
return Math.round(r / nt) + 1;
|
|
673
682
|
}
|
|
674
683
|
function fe(t, e) {
|
|
675
|
-
const n =
|
|
684
|
+
const n = p(t, e?.in), r = n.getFullYear(), s = S(), a = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? s.firstWeekContainsDate ?? s.locale?.options?.firstWeekContainsDate ?? 1, o = E(e?.in || t, 0);
|
|
676
685
|
o.setFullYear(r + 1, 0, a), o.setHours(0, 0, 0, 0);
|
|
677
|
-
const
|
|
678
|
-
|
|
679
|
-
const u =
|
|
680
|
-
return +n >= +
|
|
686
|
+
const c = I(o, e), i = E(e?.in || t, 0);
|
|
687
|
+
i.setFullYear(r, 0, a), i.setHours(0, 0, 0, 0);
|
|
688
|
+
const u = I(i, e);
|
|
689
|
+
return +n >= +c ? r + 1 : +n >= +u ? r : r - 1;
|
|
681
690
|
}
|
|
682
691
|
function In(t, e) {
|
|
683
692
|
const n = S(), r = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, s = fe(t, e), a = E(e?.in || t, 0);
|
|
684
|
-
return a.setFullYear(s, 0, r), a.setHours(0, 0, 0, 0),
|
|
693
|
+
return a.setFullYear(s, 0, r), a.setHours(0, 0, 0, 0), I(a, e);
|
|
685
694
|
}
|
|
686
695
|
function it(t, e) {
|
|
687
|
-
const n =
|
|
696
|
+
const n = p(t, e?.in), r = +I(n, e) - +In(n, e);
|
|
688
697
|
return Math.round(r / nt) + 1;
|
|
689
698
|
}
|
|
690
699
|
function h(t, e) {
|
|
691
700
|
const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
|
|
692
701
|
return n + r;
|
|
693
702
|
}
|
|
694
|
-
const
|
|
703
|
+
const k = {
|
|
695
704
|
// Year
|
|
696
705
|
y(t, e) {
|
|
697
706
|
const n = t.getFullYear(), r = n > 0 ? n : 1 - n;
|
|
@@ -774,7 +783,7 @@ const N = {
|
|
|
774
783
|
const r = t.getFullYear(), s = r > 0 ? r : 1 - r;
|
|
775
784
|
return n.ordinalNumber(s, { unit: "year" });
|
|
776
785
|
}
|
|
777
|
-
return
|
|
786
|
+
return k.y(t, e);
|
|
778
787
|
},
|
|
779
788
|
// Local week-numbering year
|
|
780
789
|
Y: function(t, e, n, r) {
|
|
@@ -873,7 +882,7 @@ const N = {
|
|
|
873
882
|
switch (e) {
|
|
874
883
|
case "M":
|
|
875
884
|
case "MM":
|
|
876
|
-
return
|
|
885
|
+
return k.M(t, e);
|
|
877
886
|
// 1st, 2nd, ..., 12th
|
|
878
887
|
case "Mo":
|
|
879
888
|
return n.ordinalNumber(r + 1, { unit: "month" });
|
|
@@ -934,7 +943,7 @@ const N = {
|
|
|
934
943
|
},
|
|
935
944
|
// Day of the month
|
|
936
945
|
d: function(t, e, n) {
|
|
937
|
-
return e === "do" ? n.ordinalNumber(t.getDate(), { unit: "date" }) :
|
|
946
|
+
return e === "do" ? n.ordinalNumber(t.getDate(), { unit: "date" }) : k.d(t, e);
|
|
938
947
|
},
|
|
939
948
|
// Day of year
|
|
940
949
|
D: function(t, e, n) {
|
|
@@ -1169,11 +1178,11 @@ const N = {
|
|
|
1169
1178
|
let r = t.getHours() % 12;
|
|
1170
1179
|
return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
|
|
1171
1180
|
}
|
|
1172
|
-
return
|
|
1181
|
+
return k.h(t, e);
|
|
1173
1182
|
},
|
|
1174
1183
|
// Hour [0-23]
|
|
1175
1184
|
H: function(t, e, n) {
|
|
1176
|
-
return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) :
|
|
1185
|
+
return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) : k.H(t, e);
|
|
1177
1186
|
},
|
|
1178
1187
|
// Hour [0-11]
|
|
1179
1188
|
K: function(t, e, n) {
|
|
@@ -1187,15 +1196,15 @@ const N = {
|
|
|
1187
1196
|
},
|
|
1188
1197
|
// Minute
|
|
1189
1198
|
m: function(t, e, n) {
|
|
1190
|
-
return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) :
|
|
1199
|
+
return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) : k.m(t, e);
|
|
1191
1200
|
},
|
|
1192
1201
|
// Second
|
|
1193
1202
|
s: function(t, e, n) {
|
|
1194
|
-
return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) :
|
|
1203
|
+
return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) : k.s(t, e);
|
|
1195
1204
|
},
|
|
1196
1205
|
// Fraction of second
|
|
1197
1206
|
S: function(t, e) {
|
|
1198
|
-
return
|
|
1207
|
+
return k.S(t, e);
|
|
1199
1208
|
},
|
|
1200
1209
|
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
1201
1210
|
X: function(t, e, n) {
|
|
@@ -1211,10 +1220,10 @@ const N = {
|
|
|
1211
1220
|
// so this token always has the same output as `XX`
|
|
1212
1221
|
case "XXXX":
|
|
1213
1222
|
case "XX":
|
|
1214
|
-
return
|
|
1223
|
+
return Y(r);
|
|
1215
1224
|
// Hours and minutes with `:` delimiter
|
|
1216
1225
|
default:
|
|
1217
|
-
return
|
|
1226
|
+
return Y(r, ":");
|
|
1218
1227
|
}
|
|
1219
1228
|
},
|
|
1220
1229
|
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
@@ -1229,10 +1238,10 @@ const N = {
|
|
|
1229
1238
|
// so this token always has the same output as `xx`
|
|
1230
1239
|
case "xxxx":
|
|
1231
1240
|
case "xx":
|
|
1232
|
-
return
|
|
1241
|
+
return Y(r);
|
|
1233
1242
|
// Hours and minutes with `:` delimiter
|
|
1234
1243
|
default:
|
|
1235
|
-
return
|
|
1244
|
+
return Y(r, ":");
|
|
1236
1245
|
}
|
|
1237
1246
|
},
|
|
1238
1247
|
// Timezone (GMT)
|
|
@@ -1245,7 +1254,7 @@ const N = {
|
|
|
1245
1254
|
case "OOO":
|
|
1246
1255
|
return "GMT" + Se(r, ":");
|
|
1247
1256
|
default:
|
|
1248
|
-
return "GMT" +
|
|
1257
|
+
return "GMT" + Y(r, ":");
|
|
1249
1258
|
}
|
|
1250
1259
|
},
|
|
1251
1260
|
// Timezone (specific non-location)
|
|
@@ -1258,7 +1267,7 @@ const N = {
|
|
|
1258
1267
|
case "zzz":
|
|
1259
1268
|
return "GMT" + Se(r, ":");
|
|
1260
1269
|
default:
|
|
1261
|
-
return "GMT" +
|
|
1270
|
+
return "GMT" + Y(r, ":");
|
|
1262
1271
|
}
|
|
1263
1272
|
},
|
|
1264
1273
|
// Seconds timestamp
|
|
@@ -1276,9 +1285,9 @@ function Se(t, e = "") {
|
|
|
1276
1285
|
return a === 0 ? n + String(s) : n + String(s) + e + h(a, 2);
|
|
1277
1286
|
}
|
|
1278
1287
|
function We(t, e) {
|
|
1279
|
-
return t % 60 === 0 ? (t > 0 ? "-" : "+") + h(Math.abs(t) / 60, 2) :
|
|
1288
|
+
return t % 60 === 0 ? (t > 0 ? "-" : "+") + h(Math.abs(t) / 60, 2) : Y(t, e);
|
|
1280
1289
|
}
|
|
1281
|
-
function
|
|
1290
|
+
function Y(t, e = "") {
|
|
1282
1291
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), s = h(Math.trunc(r / 60), 2), a = h(r % 60, 2);
|
|
1283
1292
|
return n + s + e + a;
|
|
1284
1293
|
}
|
|
@@ -1344,10 +1353,10 @@ function Wn(t, e, n) {
|
|
|
1344
1353
|
}
|
|
1345
1354
|
const $n = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, qn = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Qn = /^'([^]*?)'?$/, Fn = /''/g, Hn = /[a-zA-Z]/;
|
|
1346
1355
|
function Un(t, e, n) {
|
|
1347
|
-
const r = S(), s = r.locale ?? at, a = r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, o = r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0,
|
|
1348
|
-
if (!re(
|
|
1356
|
+
const r = S(), s = r.locale ?? at, a = r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, o = r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, c = p(t, n?.in);
|
|
1357
|
+
if (!re(c))
|
|
1349
1358
|
throw new RangeError("Invalid time value");
|
|
1350
|
-
let
|
|
1359
|
+
let i = e.match(qn).map((d) => {
|
|
1351
1360
|
const l = d[0];
|
|
1352
1361
|
if (l === "p" || l === "P") {
|
|
1353
1362
|
const g = se[l];
|
|
@@ -1368,18 +1377,18 @@ function Un(t, e, n) {
|
|
|
1368
1377
|
);
|
|
1369
1378
|
return { isToken: !1, value: d };
|
|
1370
1379
|
});
|
|
1371
|
-
s.localize.preprocessor && (
|
|
1380
|
+
s.localize.preprocessor && (i = s.localize.preprocessor(c, i));
|
|
1372
1381
|
const u = {
|
|
1373
1382
|
firstWeekContainsDate: a,
|
|
1374
1383
|
weekStartsOn: o,
|
|
1375
1384
|
locale: s
|
|
1376
1385
|
};
|
|
1377
|
-
return
|
|
1386
|
+
return i.map((d) => {
|
|
1378
1387
|
if (!d.isToken) return d.value;
|
|
1379
1388
|
const l = d.value;
|
|
1380
1389
|
(dt(l) || ut(l)) && ae(l, e, String(t));
|
|
1381
1390
|
const g = Le[l[0]];
|
|
1382
|
-
return g(
|
|
1391
|
+
return g(c, l, s.localize, u);
|
|
1383
1392
|
}).join("");
|
|
1384
1393
|
}
|
|
1385
1394
|
function Bn(t) {
|
|
@@ -1390,7 +1399,7 @@ function Gn() {
|
|
|
1390
1399
|
return Object.assign({}, S());
|
|
1391
1400
|
}
|
|
1392
1401
|
function Vn(t, e) {
|
|
1393
|
-
const n =
|
|
1402
|
+
const n = p(t, e?.in).getDay();
|
|
1394
1403
|
return n === 0 ? 7 : n;
|
|
1395
1404
|
}
|
|
1396
1405
|
function Xn(t, e) {
|
|
@@ -1405,14 +1414,14 @@ function Xn(t, e) {
|
|
|
1405
1414
|
function jn(t) {
|
|
1406
1415
|
return typeof t == "function" && t.prototype?.constructor === t;
|
|
1407
1416
|
}
|
|
1408
|
-
const
|
|
1417
|
+
const zn = 10;
|
|
1409
1418
|
class lt {
|
|
1410
1419
|
subPriority = 0;
|
|
1411
1420
|
validate(e, n) {
|
|
1412
1421
|
return !0;
|
|
1413
1422
|
}
|
|
1414
1423
|
}
|
|
1415
|
-
class
|
|
1424
|
+
class Kn extends lt {
|
|
1416
1425
|
constructor(e, n, r, s, a) {
|
|
1417
1426
|
super(), this.value = e, this.validateValue = n, this.setValue = r, this.priority = s, a && (this.subPriority = a);
|
|
1418
1427
|
}
|
|
@@ -1424,7 +1433,7 @@ class zn extends lt {
|
|
|
1424
1433
|
}
|
|
1425
1434
|
}
|
|
1426
1435
|
class Jn extends lt {
|
|
1427
|
-
priority =
|
|
1436
|
+
priority = zn;
|
|
1428
1437
|
subPriority = -1;
|
|
1429
1438
|
constructor(e, n) {
|
|
1430
1439
|
super(), this.context = e || ((r) => E(n, r));
|
|
@@ -1437,7 +1446,7 @@ class m {
|
|
|
1437
1446
|
run(e, n, r, s) {
|
|
1438
1447
|
const a = this.parse(e, n, r, s);
|
|
1439
1448
|
return a ? {
|
|
1440
|
-
setter: new
|
|
1449
|
+
setter: new Kn(
|
|
1441
1450
|
a.value,
|
|
1442
1451
|
this.validate,
|
|
1443
1452
|
this.set,
|
|
@@ -1523,7 +1532,7 @@ function T(t, e) {
|
|
|
1523
1532
|
rest: t.rest
|
|
1524
1533
|
};
|
|
1525
1534
|
}
|
|
1526
|
-
function
|
|
1535
|
+
function y(t, e) {
|
|
1527
1536
|
const n = e.match(t);
|
|
1528
1537
|
return n ? {
|
|
1529
1538
|
value: parseInt(n[0], 10),
|
|
@@ -1546,34 +1555,34 @@ function A(t, e) {
|
|
|
1546
1555
|
};
|
|
1547
1556
|
}
|
|
1548
1557
|
function ft(t) {
|
|
1549
|
-
return
|
|
1558
|
+
return y(D.anyDigitsSigned, t);
|
|
1550
1559
|
}
|
|
1551
1560
|
function b(t, e) {
|
|
1552
1561
|
switch (t) {
|
|
1553
1562
|
case 1:
|
|
1554
|
-
return
|
|
1563
|
+
return y(D.singleDigit, e);
|
|
1555
1564
|
case 2:
|
|
1556
|
-
return
|
|
1565
|
+
return y(D.twoDigits, e);
|
|
1557
1566
|
case 3:
|
|
1558
|
-
return
|
|
1567
|
+
return y(D.threeDigits, e);
|
|
1559
1568
|
case 4:
|
|
1560
|
-
return
|
|
1569
|
+
return y(D.fourDigits, e);
|
|
1561
1570
|
default:
|
|
1562
|
-
return
|
|
1571
|
+
return y(new RegExp("^\\d{1," + t + "}"), e);
|
|
1563
1572
|
}
|
|
1564
1573
|
}
|
|
1565
|
-
function
|
|
1574
|
+
function Z(t, e) {
|
|
1566
1575
|
switch (t) {
|
|
1567
1576
|
case 1:
|
|
1568
|
-
return
|
|
1577
|
+
return y(D.singleDigitSigned, e);
|
|
1569
1578
|
case 2:
|
|
1570
|
-
return
|
|
1579
|
+
return y(D.twoDigitsSigned, e);
|
|
1571
1580
|
case 3:
|
|
1572
|
-
return
|
|
1581
|
+
return y(D.threeDigitsSigned, e);
|
|
1573
1582
|
case 4:
|
|
1574
|
-
return
|
|
1583
|
+
return y(D.fourDigitsSigned, e);
|
|
1575
1584
|
default:
|
|
1576
|
-
return
|
|
1585
|
+
return y(new RegExp("^-?\\d{1," + t + "}"), e);
|
|
1577
1586
|
}
|
|
1578
1587
|
}
|
|
1579
1588
|
function me(t) {
|
|
@@ -1596,8 +1605,8 @@ function mt(t, e) {
|
|
|
1596
1605
|
if (r <= 50)
|
|
1597
1606
|
s = t || 100;
|
|
1598
1607
|
else {
|
|
1599
|
-
const a = r + 50, o = Math.trunc(a / 100) * 100,
|
|
1600
|
-
s = t + o - (
|
|
1608
|
+
const a = r + 50, o = Math.trunc(a / 100) * 100, c = t >= a % 100;
|
|
1609
|
+
s = t + o - (c ? 100 : 0);
|
|
1601
1610
|
}
|
|
1602
1611
|
return n ? s : 1 - s;
|
|
1603
1612
|
}
|
|
@@ -1669,18 +1678,18 @@ class tr extends m {
|
|
|
1669
1678
|
set(e, n, r, s) {
|
|
1670
1679
|
const a = fe(e, s);
|
|
1671
1680
|
if (r.isTwoDigitYear) {
|
|
1672
|
-
const
|
|
1681
|
+
const c = mt(
|
|
1673
1682
|
r.year,
|
|
1674
1683
|
a
|
|
1675
1684
|
);
|
|
1676
1685
|
return e.setFullYear(
|
|
1677
|
-
|
|
1686
|
+
c,
|
|
1678
1687
|
0,
|
|
1679
1688
|
s.firstWeekContainsDate
|
|
1680
|
-
), e.setHours(0, 0, 0, 0),
|
|
1689
|
+
), e.setHours(0, 0, 0, 0), I(e, s);
|
|
1681
1690
|
}
|
|
1682
1691
|
const o = !("era" in n) || n.era === 1 ? r.year : 1 - r.year;
|
|
1683
|
-
return e.setFullYear(o, 0, s.firstWeekContainsDate), e.setHours(0, 0, 0, 0),
|
|
1692
|
+
return e.setFullYear(o, 0, s.firstWeekContainsDate), e.setHours(0, 0, 0, 0), I(e, s);
|
|
1684
1693
|
}
|
|
1685
1694
|
incompatibleTokens = [
|
|
1686
1695
|
"y",
|
|
@@ -1701,7 +1710,7 @@ class tr extends m {
|
|
|
1701
1710
|
class nr extends m {
|
|
1702
1711
|
priority = 130;
|
|
1703
1712
|
parse(e, n) {
|
|
1704
|
-
return
|
|
1713
|
+
return Z(n === "R" ? 4 : n.length, e);
|
|
1705
1714
|
}
|
|
1706
1715
|
set(e, n, r) {
|
|
1707
1716
|
const s = E(e, 0);
|
|
@@ -1728,7 +1737,7 @@ class nr extends m {
|
|
|
1728
1737
|
class rr extends m {
|
|
1729
1738
|
priority = 130;
|
|
1730
1739
|
parse(e, n) {
|
|
1731
|
-
return
|
|
1740
|
+
return Z(n === "u" ? 4 : n.length, e);
|
|
1732
1741
|
}
|
|
1733
1742
|
set(e, n, r) {
|
|
1734
1743
|
return e.setFullYear(r, 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
@@ -1882,7 +1891,7 @@ class or extends m {
|
|
|
1882
1891
|
// 1, 2, ..., 12
|
|
1883
1892
|
case "M":
|
|
1884
1893
|
return T(
|
|
1885
|
-
|
|
1894
|
+
y(D.month, e),
|
|
1886
1895
|
s
|
|
1887
1896
|
);
|
|
1888
1897
|
// 01, 02, ..., 12
|
|
@@ -1930,7 +1939,7 @@ class ir extends m {
|
|
|
1930
1939
|
// 1, 2, ..., 12
|
|
1931
1940
|
case "L":
|
|
1932
1941
|
return T(
|
|
1933
|
-
|
|
1942
|
+
y(D.month, e),
|
|
1934
1943
|
s
|
|
1935
1944
|
);
|
|
1936
1945
|
// 01, 02, ..., 12
|
|
@@ -1986,15 +1995,15 @@ class ir extends m {
|
|
|
1986
1995
|
];
|
|
1987
1996
|
}
|
|
1988
1997
|
function cr(t, e, n) {
|
|
1989
|
-
const r =
|
|
1990
|
-
return r.setDate(r.getDate() - s * 7),
|
|
1998
|
+
const r = p(t, n?.in), s = it(r, n) - e;
|
|
1999
|
+
return r.setDate(r.getDate() - s * 7), p(r, n?.in);
|
|
1991
2000
|
}
|
|
1992
2001
|
class ur extends m {
|
|
1993
2002
|
priority = 100;
|
|
1994
2003
|
parse(e, n, r) {
|
|
1995
2004
|
switch (n) {
|
|
1996
2005
|
case "w":
|
|
1997
|
-
return
|
|
2006
|
+
return y(D.week, e);
|
|
1998
2007
|
case "wo":
|
|
1999
2008
|
return r.ordinalNumber(e, { unit: "week" });
|
|
2000
2009
|
default:
|
|
@@ -2005,7 +2014,7 @@ class ur extends m {
|
|
|
2005
2014
|
return n >= 1 && n <= 53;
|
|
2006
2015
|
}
|
|
2007
2016
|
set(e, n, r, s) {
|
|
2008
|
-
return
|
|
2017
|
+
return I(cr(e, r, s), s);
|
|
2009
2018
|
}
|
|
2010
2019
|
incompatibleTokens = [
|
|
2011
2020
|
"y",
|
|
@@ -2024,7 +2033,7 @@ class ur extends m {
|
|
|
2024
2033
|
];
|
|
2025
2034
|
}
|
|
2026
2035
|
function dr(t, e, n) {
|
|
2027
|
-
const r =
|
|
2036
|
+
const r = p(t, n?.in), s = ot(r, n) - e;
|
|
2028
2037
|
return r.setDate(r.getDate() - s * 7), r;
|
|
2029
2038
|
}
|
|
2030
2039
|
class lr extends m {
|
|
@@ -2032,7 +2041,7 @@ class lr extends m {
|
|
|
2032
2041
|
parse(e, n, r) {
|
|
2033
2042
|
switch (n) {
|
|
2034
2043
|
case "I":
|
|
2035
|
-
return
|
|
2044
|
+
return y(D.week, e);
|
|
2036
2045
|
case "Io":
|
|
2037
2046
|
return r.ordinalNumber(e, { unit: "week" });
|
|
2038
2047
|
default:
|
|
@@ -2082,7 +2091,7 @@ class hr extends m {
|
|
|
2082
2091
|
parse(e, n, r) {
|
|
2083
2092
|
switch (n) {
|
|
2084
2093
|
case "d":
|
|
2085
|
-
return
|
|
2094
|
+
return y(D.date, e);
|
|
2086
2095
|
case "do":
|
|
2087
2096
|
return r.ordinalNumber(e, { unit: "date" });
|
|
2088
2097
|
default:
|
|
@@ -2118,7 +2127,7 @@ class wr extends m {
|
|
|
2118
2127
|
switch (n) {
|
|
2119
2128
|
case "D":
|
|
2120
2129
|
case "DD":
|
|
2121
|
-
return
|
|
2130
|
+
return y(D.dayOfYear, e);
|
|
2122
2131
|
case "Do":
|
|
2123
2132
|
return r.ordinalNumber(e, { unit: "date" });
|
|
2124
2133
|
default:
|
|
@@ -2151,7 +2160,7 @@ class wr extends m {
|
|
|
2151
2160
|
];
|
|
2152
2161
|
}
|
|
2153
2162
|
function he(t, e, n) {
|
|
2154
|
-
const r = S(), s = n?.weekStartsOn ?? n?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, a =
|
|
2163
|
+
const r = S(), s = n?.weekStartsOn ?? n?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, a = p(t, n?.in), o = a.getDay(), i = (e % 7 + 7) % 7, u = 7 - s, d = e < 0 || e > 6 ? e - (o + u) % 7 : (i + u) % 7 - (o + u) % 7;
|
|
2155
2164
|
return rt(a, d, n);
|
|
2156
2165
|
}
|
|
2157
2166
|
class gr extends m {
|
|
@@ -2190,12 +2199,12 @@ class gr extends m {
|
|
|
2190
2199
|
}
|
|
2191
2200
|
incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
|
|
2192
2201
|
}
|
|
2193
|
-
class
|
|
2202
|
+
class yr extends m {
|
|
2194
2203
|
priority = 90;
|
|
2195
2204
|
parse(e, n, r, s) {
|
|
2196
2205
|
const a = (o) => {
|
|
2197
|
-
const
|
|
2198
|
-
return (o + s.weekStartsOn + 6) % 7 +
|
|
2206
|
+
const c = Math.floor((o - 1) / 7) * 7;
|
|
2207
|
+
return (o + s.weekStartsOn + 6) % 7 + c;
|
|
2199
2208
|
};
|
|
2200
2209
|
switch (n) {
|
|
2201
2210
|
// 3
|
|
@@ -2256,12 +2265,12 @@ class pr extends m {
|
|
|
2256
2265
|
"T"
|
|
2257
2266
|
];
|
|
2258
2267
|
}
|
|
2259
|
-
class
|
|
2268
|
+
class pr extends m {
|
|
2260
2269
|
priority = 90;
|
|
2261
2270
|
parse(e, n, r, s) {
|
|
2262
2271
|
const a = (o) => {
|
|
2263
|
-
const
|
|
2264
|
-
return (o + s.weekStartsOn + 6) % 7 +
|
|
2272
|
+
const c = Math.floor((o - 1) / 7) * 7;
|
|
2273
|
+
return (o + s.weekStartsOn + 6) % 7 + c;
|
|
2265
2274
|
};
|
|
2266
2275
|
switch (n) {
|
|
2267
2276
|
// 3
|
|
@@ -2323,7 +2332,7 @@ class yr extends m {
|
|
|
2323
2332
|
];
|
|
2324
2333
|
}
|
|
2325
2334
|
function br(t, e, n) {
|
|
2326
|
-
const r =
|
|
2335
|
+
const r = p(t, n?.in), s = Vn(r, n), a = e - s;
|
|
2327
2336
|
return rt(r, a, n);
|
|
2328
2337
|
}
|
|
2329
2338
|
class Dr extends m {
|
|
@@ -2533,7 +2542,7 @@ class Pr extends m {
|
|
|
2533
2542
|
parse(e, n, r) {
|
|
2534
2543
|
switch (n) {
|
|
2535
2544
|
case "h":
|
|
2536
|
-
return
|
|
2545
|
+
return y(D.hour12h, e);
|
|
2537
2546
|
case "ho":
|
|
2538
2547
|
return r.ordinalNumber(e, { unit: "hour" });
|
|
2539
2548
|
default:
|
|
@@ -2554,7 +2563,7 @@ class Mr extends m {
|
|
|
2554
2563
|
parse(e, n, r) {
|
|
2555
2564
|
switch (n) {
|
|
2556
2565
|
case "H":
|
|
2557
|
-
return
|
|
2566
|
+
return y(D.hour23h, e);
|
|
2558
2567
|
case "Ho":
|
|
2559
2568
|
return r.ordinalNumber(e, { unit: "hour" });
|
|
2560
2569
|
default:
|
|
@@ -2574,7 +2583,7 @@ class vr extends m {
|
|
|
2574
2583
|
parse(e, n, r) {
|
|
2575
2584
|
switch (n) {
|
|
2576
2585
|
case "K":
|
|
2577
|
-
return
|
|
2586
|
+
return y(D.hour11h, e);
|
|
2578
2587
|
case "Ko":
|
|
2579
2588
|
return r.ordinalNumber(e, { unit: "hour" });
|
|
2580
2589
|
default:
|
|
@@ -2594,7 +2603,7 @@ class Or extends m {
|
|
|
2594
2603
|
parse(e, n, r) {
|
|
2595
2604
|
switch (n) {
|
|
2596
2605
|
case "k":
|
|
2597
|
-
return
|
|
2606
|
+
return y(D.hour24h, e);
|
|
2598
2607
|
case "ko":
|
|
2599
2608
|
return r.ordinalNumber(e, { unit: "hour" });
|
|
2600
2609
|
default:
|
|
@@ -2615,7 +2624,7 @@ class Ar extends m {
|
|
|
2615
2624
|
parse(e, n, r) {
|
|
2616
2625
|
switch (n) {
|
|
2617
2626
|
case "m":
|
|
2618
|
-
return
|
|
2627
|
+
return y(D.minute, e);
|
|
2619
2628
|
case "mo":
|
|
2620
2629
|
return r.ordinalNumber(e, { unit: "minute" });
|
|
2621
2630
|
default:
|
|
@@ -2635,7 +2644,7 @@ class Nr extends m {
|
|
|
2635
2644
|
parse(e, n, r) {
|
|
2636
2645
|
switch (n) {
|
|
2637
2646
|
case "s":
|
|
2638
|
-
return
|
|
2647
|
+
return y(D.second, e);
|
|
2639
2648
|
case "so":
|
|
2640
2649
|
return r.ordinalNumber(e, { unit: "second" });
|
|
2641
2650
|
default:
|
|
@@ -2689,7 +2698,7 @@ class Rr extends m {
|
|
|
2689
2698
|
set(e, n, r) {
|
|
2690
2699
|
return n.timestampIsSet ? e : E(
|
|
2691
2700
|
e,
|
|
2692
|
-
e.getTime() -
|
|
2701
|
+
e.getTime() - J(e) - r
|
|
2693
2702
|
);
|
|
2694
2703
|
}
|
|
2695
2704
|
incompatibleTokens = ["t", "T", "x"];
|
|
@@ -2722,7 +2731,7 @@ class _r extends m {
|
|
|
2722
2731
|
set(e, n, r) {
|
|
2723
2732
|
return n.timestampIsSet ? e : E(
|
|
2724
2733
|
e,
|
|
2725
|
-
e.getTime() -
|
|
2734
|
+
e.getTime() - J(e) - r
|
|
2726
2735
|
);
|
|
2727
2736
|
}
|
|
2728
2737
|
incompatibleTokens = ["t", "T", "X"];
|
|
@@ -2762,8 +2771,8 @@ const Cr = {
|
|
|
2762
2771
|
d: new hr(),
|
|
2763
2772
|
D: new wr(),
|
|
2764
2773
|
E: new gr(),
|
|
2765
|
-
e: new
|
|
2766
|
-
c: new
|
|
2774
|
+
e: new yr(),
|
|
2775
|
+
c: new pr(),
|
|
2767
2776
|
i: new Dr(),
|
|
2768
2777
|
a: new Tr(),
|
|
2769
2778
|
b: new Er(),
|
|
@@ -2781,26 +2790,26 @@ const Cr = {
|
|
|
2781
2790
|
T: new Yr()
|
|
2782
2791
|
}, Lr = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Sr = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Wr = /^'([^]*?)'?$/, $r = /''/g, qr = /\S/, Qr = /[a-zA-Z]/;
|
|
2783
2792
|
function Fr(t, e, n, r) {
|
|
2784
|
-
const s = () => E(n, NaN), a = Gn(), o = a.locale ?? at,
|
|
2793
|
+
const s = () => E(n, NaN), a = Gn(), o = a.locale ?? at, c = a.firstWeekContainsDate ?? a.locale?.options?.firstWeekContainsDate ?? 1, i = a.weekStartsOn ?? a.locale?.options?.weekStartsOn ?? 0;
|
|
2785
2794
|
if (!e)
|
|
2786
|
-
return t ? s() :
|
|
2795
|
+
return t ? s() : p(n, r?.in);
|
|
2787
2796
|
const u = {
|
|
2788
|
-
firstWeekContainsDate:
|
|
2789
|
-
weekStartsOn:
|
|
2797
|
+
firstWeekContainsDate: c,
|
|
2798
|
+
weekStartsOn: i,
|
|
2790
2799
|
locale: o
|
|
2791
2800
|
}, d = [new Jn(r?.in, n)], l = e.match(Sr).map((f) => {
|
|
2792
2801
|
const w = f[0];
|
|
2793
2802
|
if (w in se) {
|
|
2794
|
-
const
|
|
2795
|
-
return
|
|
2803
|
+
const P = se[w];
|
|
2804
|
+
return P(f, o.formatLong);
|
|
2796
2805
|
}
|
|
2797
2806
|
return f;
|
|
2798
2807
|
}).join("").match(Lr), g = [];
|
|
2799
2808
|
for (let f of l) {
|
|
2800
2809
|
dt(f) && ae(f, e, t), ut(f) && ae(f, e, t);
|
|
2801
|
-
const w = f[0],
|
|
2802
|
-
if (
|
|
2803
|
-
const { incompatibleTokens: v } =
|
|
2810
|
+
const w = f[0], P = Cr[w];
|
|
2811
|
+
if (P) {
|
|
2812
|
+
const { incompatibleTokens: v } = P;
|
|
2804
2813
|
if (Array.isArray(v)) {
|
|
2805
2814
|
const $ = g.find(
|
|
2806
2815
|
(U) => v.includes(U.token) || U.token === w
|
|
@@ -2809,12 +2818,12 @@ function Fr(t, e, n, r) {
|
|
|
2809
2818
|
throw new RangeError(
|
|
2810
2819
|
`The format string mustn't contain \`${$.fullToken}\` and \`${f}\` at the same time`
|
|
2811
2820
|
);
|
|
2812
|
-
} else if (
|
|
2821
|
+
} else if (P.incompatibleTokens === "*" && g.length > 0)
|
|
2813
2822
|
throw new RangeError(
|
|
2814
2823
|
`The format string mustn't contain \`${f}\` and any other token at the same time`
|
|
2815
2824
|
);
|
|
2816
2825
|
g.push({ token: w, fullToken: f });
|
|
2817
|
-
const W =
|
|
2826
|
+
const W = P.run(
|
|
2818
2827
|
t,
|
|
2819
2828
|
f,
|
|
2820
2829
|
o.match,
|
|
@@ -2836,19 +2845,19 @@ function Fr(t, e, n, r) {
|
|
|
2836
2845
|
}
|
|
2837
2846
|
if (t.length > 0 && qr.test(t))
|
|
2838
2847
|
return s();
|
|
2839
|
-
const
|
|
2840
|
-
(f) => d.filter((w) => w.priority === f).sort((w,
|
|
2848
|
+
const M = d.map((f) => f.priority).sort((f, w) => w - f).filter((f, w, P) => P.indexOf(f) === w).map(
|
|
2849
|
+
(f) => d.filter((w) => w.priority === f).sort((w, P) => P.subPriority - w.subPriority)
|
|
2841
2850
|
).map((f) => f[0]);
|
|
2842
|
-
let
|
|
2843
|
-
if (isNaN(+
|
|
2844
|
-
const
|
|
2845
|
-
for (const f of
|
|
2846
|
-
if (!f.validate(
|
|
2851
|
+
let x = p(n, r?.in);
|
|
2852
|
+
if (isNaN(+x)) return s();
|
|
2853
|
+
const N = {};
|
|
2854
|
+
for (const f of M) {
|
|
2855
|
+
if (!f.validate(x, u))
|
|
2847
2856
|
return s();
|
|
2848
|
-
const w = f.set(
|
|
2849
|
-
Array.isArray(w) ? (
|
|
2857
|
+
const w = f.set(x, N, u);
|
|
2858
|
+
Array.isArray(w) ? (x = w[0], Object.assign(N, w[1])) : x = w;
|
|
2850
2859
|
}
|
|
2851
|
-
return
|
|
2860
|
+
return x;
|
|
2852
2861
|
}
|
|
2853
2862
|
function Hr(t) {
|
|
2854
2863
|
return t.match(Wr)[1].replace($r, "'");
|
|
@@ -2858,17 +2867,17 @@ function Ur(t, e) {
|
|
|
2858
2867
|
let a;
|
|
2859
2868
|
if (s.date) {
|
|
2860
2869
|
const u = jr(s.date, 2);
|
|
2861
|
-
a =
|
|
2870
|
+
a = zr(u.restDateString, u.year);
|
|
2862
2871
|
}
|
|
2863
2872
|
if (!a || isNaN(+a)) return n();
|
|
2864
2873
|
const o = +a;
|
|
2865
|
-
let
|
|
2866
|
-
if (s.time && (
|
|
2874
|
+
let c = 0, i;
|
|
2875
|
+
if (s.time && (c = Kr(s.time), isNaN(c)))
|
|
2867
2876
|
return n();
|
|
2868
2877
|
if (s.timezone) {
|
|
2869
|
-
if (
|
|
2878
|
+
if (i = Jr(s.timezone), isNaN(i)) return n();
|
|
2870
2879
|
} else {
|
|
2871
|
-
const u = new Date(o +
|
|
2880
|
+
const u = new Date(o + c), d = p(0, e?.in);
|
|
2872
2881
|
return d.setFullYear(
|
|
2873
2882
|
u.getUTCFullYear(),
|
|
2874
2883
|
u.getUTCMonth(),
|
|
@@ -2880,7 +2889,7 @@ function Ur(t, e) {
|
|
|
2880
2889
|
u.getUTCMilliseconds()
|
|
2881
2890
|
), d;
|
|
2882
2891
|
}
|
|
2883
|
-
return
|
|
2892
|
+
return p(o + c + i, e?.in);
|
|
2884
2893
|
}
|
|
2885
2894
|
const G = {
|
|
2886
2895
|
dateTimeDelimiter: /[T ]/,
|
|
@@ -2912,13 +2921,13 @@ function jr(t, e) {
|
|
|
2912
2921
|
restDateString: t.slice((r[1] || r[2]).length)
|
|
2913
2922
|
};
|
|
2914
2923
|
}
|
|
2915
|
-
function
|
|
2924
|
+
function zr(t, e) {
|
|
2916
2925
|
if (e === null) return /* @__PURE__ */ new Date(NaN);
|
|
2917
2926
|
const n = t.match(Br);
|
|
2918
2927
|
if (!n) return /* @__PURE__ */ new Date(NaN);
|
|
2919
|
-
const r = !!n[4], s = F(n[1]), a = F(n[2]) - 1, o = F(n[3]),
|
|
2928
|
+
const r = !!n[4], s = F(n[1]), a = F(n[2]) - 1, o = F(n[3]), c = F(n[4]), i = F(n[5]) - 1;
|
|
2920
2929
|
if (r)
|
|
2921
|
-
return rs(e,
|
|
2930
|
+
return rs(e, c, i) ? Zr(e, c, i) : /* @__PURE__ */ new Date(NaN);
|
|
2922
2931
|
{
|
|
2923
2932
|
const u = /* @__PURE__ */ new Date(0);
|
|
2924
2933
|
return !ts(e, a, o) || !ns(e, s) ? /* @__PURE__ */ new Date(NaN) : (u.setUTCFullYear(e, a, Math.max(s, o)), u);
|
|
@@ -2927,7 +2936,7 @@ function Kr(t, e) {
|
|
|
2927
2936
|
function F(t) {
|
|
2928
2937
|
return t ? parseInt(t) : 1;
|
|
2929
2938
|
}
|
|
2930
|
-
function
|
|
2939
|
+
function Kr(t) {
|
|
2931
2940
|
const e = t.match(Gr);
|
|
2932
2941
|
if (!e) return NaN;
|
|
2933
2942
|
const n = ne(e[1]), r = ne(e[2]), s = ne(e[3]);
|
|
@@ -2981,10 +2990,10 @@ const V = (t) => {
|
|
|
2981
2990
|
return re(e) ? e : null;
|
|
2982
2991
|
}, os = ["yyyy-MM-dd", "MM-dd-yyyy"], oe = (t, e, n) => {
|
|
2983
2992
|
const r = {};
|
|
2984
|
-
return e?.contentType !== null && (r[Ht] = e?.contentType || Ft), e?.jwt
|
|
2993
|
+
return e?.contentType !== null && (r[Ht] = e?.contentType || Ft), e?.jwt ? r.Authorization = `Bearer ${e.jwt}` : t && (r[j] = t), e?.chatReference && (r[Ut] = e.chatReference), { ...r, ...n };
|
|
2985
2994
|
}, is = (t) => {
|
|
2986
2995
|
const e = { ...t };
|
|
2987
|
-
return e[
|
|
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;
|
|
2988
2997
|
}, qe = async (t, e, n) => await fetch(t, {
|
|
2989
2998
|
method: n.method || "GET",
|
|
2990
2999
|
headers: e,
|
|
@@ -3003,15 +3012,15 @@ class us {
|
|
|
3003
3012
|
this.decoder = new TextDecoder();
|
|
3004
3013
|
}
|
|
3005
3014
|
async streamChat(e, n, r = {}, s) {
|
|
3006
|
-
const { onMessage: a, onError: o, onComplete:
|
|
3015
|
+
const { onMessage: a, onError: o, onComplete: c, signal: i } = r;
|
|
3007
3016
|
try {
|
|
3008
3017
|
const u = await this.initializeStreamRequest(
|
|
3009
3018
|
e,
|
|
3010
3019
|
n,
|
|
3011
|
-
|
|
3020
|
+
i,
|
|
3012
3021
|
s
|
|
3013
3022
|
);
|
|
3014
|
-
await this.processStreamData(u, a),
|
|
3023
|
+
await this.processStreamData(u, a), c?.();
|
|
3015
3024
|
} catch (u) {
|
|
3016
3025
|
this.handleStreamError(u, o);
|
|
3017
3026
|
}
|
|
@@ -3032,16 +3041,16 @@ class us {
|
|
|
3032
3041
|
}
|
|
3033
3042
|
);
|
|
3034
3043
|
if (!o.ok) {
|
|
3035
|
-
const
|
|
3036
|
-
let
|
|
3044
|
+
const c = await o.text();
|
|
3045
|
+
let i = {};
|
|
3037
3046
|
try {
|
|
3038
|
-
|
|
3047
|
+
i = JSON.parse(c);
|
|
3039
3048
|
} catch {
|
|
3040
|
-
|
|
3049
|
+
i.error = "Failed to parse error body";
|
|
3041
3050
|
}
|
|
3042
3051
|
throw new Ie({
|
|
3043
3052
|
status: o.status,
|
|
3044
|
-
message:
|
|
3053
|
+
message: i.error ?? "No response body"
|
|
3045
3054
|
});
|
|
3046
3055
|
}
|
|
3047
3056
|
if (!o.body)
|
|
@@ -3062,11 +3071,11 @@ class us {
|
|
|
3062
3071
|
}
|
|
3063
3072
|
const o = this.decoder.decode(a, { stream: !0 });
|
|
3064
3073
|
r += o;
|
|
3065
|
-
const
|
|
3074
|
+
const c = r.split(`
|
|
3066
3075
|
`);
|
|
3067
|
-
r =
|
|
3068
|
-
for (const
|
|
3069
|
-
this.parseSSEDataLine(
|
|
3076
|
+
r = c.pop() || "";
|
|
3077
|
+
for (const i of c)
|
|
3078
|
+
this.parseSSEDataLine(i, n);
|
|
3070
3079
|
}
|
|
3071
3080
|
} finally {
|
|
3072
3081
|
e.releaseLock();
|
|
@@ -3101,91 +3110,101 @@ class $a {
|
|
|
3101
3110
|
apiUrl: e.apiUrl || "NOT SET"
|
|
3102
3111
|
});
|
|
3103
3112
|
}
|
|
3104
|
-
async getRequest(e, n) {
|
|
3105
|
-
return this.request(
|
|
3113
|
+
async getRequest(e, n, r) {
|
|
3114
|
+
return this.request(
|
|
3115
|
+
e,
|
|
3116
|
+
{ ...n, method: "GET" },
|
|
3117
|
+
void 0,
|
|
3118
|
+
r
|
|
3119
|
+
);
|
|
3106
3120
|
}
|
|
3107
|
-
async postRequest(e, n, r) {
|
|
3108
|
-
return this.request(
|
|
3121
|
+
async postRequest(e, n, r, s) {
|
|
3122
|
+
return this.request(
|
|
3123
|
+
e,
|
|
3124
|
+
{ ...n, method: "POST" },
|
|
3125
|
+
r,
|
|
3126
|
+
s
|
|
3127
|
+
);
|
|
3109
3128
|
}
|
|
3110
|
-
async streamRequest(e, n, r) {
|
|
3111
|
-
const
|
|
3112
|
-
|
|
3113
|
-
jwt: this.config.jwt
|
|
3114
|
-
}),
|
|
3115
|
-
...n.headers
|
|
3116
|
-
};
|
|
3117
|
-
this.config.apiKey != null && (a[j] = this.config.apiKey);
|
|
3118
|
-
const o = new ReadableStream({
|
|
3119
|
-
async start(c) {
|
|
3129
|
+
async streamRequest(e, n, r, s) {
|
|
3130
|
+
const a = `${this.config.apiUrl}/${e}`, o = this.buildHeaders(s, n.headers), c = new ReadableStream({
|
|
3131
|
+
async start(u) {
|
|
3120
3132
|
try {
|
|
3121
|
-
const
|
|
3122
|
-
if (!
|
|
3123
|
-
const x = await
|
|
3133
|
+
const d = await qe(a, o, n);
|
|
3134
|
+
if (!d.ok) {
|
|
3135
|
+
const x = await d.text();
|
|
3124
3136
|
throw console.error(
|
|
3125
|
-
`Fetch failed! Status: ${
|
|
3126
|
-
), new Error(`Fetch failed with status ${
|
|
3137
|
+
`Fetch failed! Status: ${d.status}, Body: ${x}`
|
|
3138
|
+
), new Error(`Fetch failed with status ${d.status}`);
|
|
3127
3139
|
}
|
|
3128
|
-
const
|
|
3129
|
-
if (!
|
|
3130
|
-
const
|
|
3131
|
-
|
|
3132
|
-
const
|
|
3133
|
-
const { done: x, value:
|
|
3134
|
-
x ?
|
|
3140
|
+
const l = d.body?.getReader();
|
|
3141
|
+
if (!l) throw new Error("Failed to create stream reader");
|
|
3142
|
+
const g = new Uint8Array([239, 187, 191]);
|
|
3143
|
+
u.enqueue(g);
|
|
3144
|
+
const M = async () => {
|
|
3145
|
+
const { done: x, value: N } = await l.read();
|
|
3146
|
+
x ? u.close() : (u.enqueue(N), await M());
|
|
3135
3147
|
};
|
|
3136
|
-
|
|
3137
|
-
} catch (
|
|
3138
|
-
|
|
3148
|
+
M();
|
|
3149
|
+
} catch (d) {
|
|
3150
|
+
u.error(d);
|
|
3139
3151
|
}
|
|
3140
3152
|
}
|
|
3141
3153
|
}), i = new Headers({
|
|
3142
3154
|
"Content-Disposition": `attachment; filename=${encodeURIComponent(r)}`
|
|
3143
3155
|
});
|
|
3144
|
-
return new Response(
|
|
3145
|
-
}
|
|
3146
|
-
async request(e, n, r) {
|
|
3147
|
-
const
|
|
3148
|
-
|
|
3149
|
-
jwt: this.config.jwt
|
|
3150
|
-
}),
|
|
3151
|
-
...n.headers
|
|
3152
|
-
};
|
|
3153
|
-
this.config.apiKey != null && (o["Ocp-Apim-Subscription-Key"] = this.config.apiKey), this.addInfoRequestLog("API Request", a, n, o);
|
|
3156
|
+
return new Response(c, { headers: i });
|
|
3157
|
+
}
|
|
3158
|
+
async request(e, n, r, s) {
|
|
3159
|
+
const a = Date.now(), o = `${r || this.config.apiUrl}/${e}`, c = this.buildHeaders(s, n.headers);
|
|
3160
|
+
this.addInfoRequestLog("API Request", o, n, c);
|
|
3154
3161
|
try {
|
|
3155
|
-
const i = await qe(
|
|
3156
|
-
let
|
|
3157
|
-
const
|
|
3162
|
+
const i = await qe(o, c, n), u = Date.now() - a;
|
|
3163
|
+
let d;
|
|
3164
|
+
const l = await i.text();
|
|
3158
3165
|
try {
|
|
3159
|
-
|
|
3166
|
+
d = l ? JSON.parse(l) : {};
|
|
3160
3167
|
} catch {
|
|
3161
3168
|
if (this.addErrorRequestParsing(
|
|
3162
|
-
|
|
3169
|
+
o,
|
|
3163
3170
|
n,
|
|
3164
3171
|
i,
|
|
3165
|
-
|
|
3166
|
-
|
|
3172
|
+
u,
|
|
3173
|
+
l
|
|
3167
3174
|
), !i.ok)
|
|
3168
3175
|
throw new Error(
|
|
3169
|
-
`API request failed: ${i.status} ${i.statusText} - ${
|
|
3176
|
+
`API request failed: ${i.status} ${i.statusText} - ${l.substring(0, 100)}`
|
|
3170
3177
|
);
|
|
3171
|
-
|
|
3178
|
+
d = { data: l };
|
|
3172
3179
|
}
|
|
3173
3180
|
if (!i.ok) {
|
|
3174
|
-
this.addErrorRequestLog(
|
|
3175
|
-
const
|
|
3176
|
-
throw new Error(`API request failed: ${
|
|
3181
|
+
this.addErrorRequestLog(o, n, i, u, d);
|
|
3182
|
+
const g = Qt(d, i);
|
|
3183
|
+
throw new Error(`API request failed: ${g}`);
|
|
3177
3184
|
}
|
|
3178
|
-
return
|
|
3185
|
+
return d;
|
|
3179
3186
|
} catch (i) {
|
|
3180
|
-
const
|
|
3187
|
+
const u = Date.now() - a;
|
|
3181
3188
|
throw console.error("API Request Exception", {
|
|
3182
3189
|
method: n.method,
|
|
3183
|
-
url:
|
|
3184
|
-
duration: `${
|
|
3190
|
+
url: o,
|
|
3191
|
+
duration: `${u}ms`,
|
|
3185
3192
|
error: i instanceof Error ? i.message : String(i)
|
|
3186
3193
|
}), i;
|
|
3187
3194
|
}
|
|
3188
3195
|
}
|
|
3196
|
+
buildHeaders(e, n) {
|
|
3197
|
+
if (this.config.useDialAuth)
|
|
3198
|
+
return {
|
|
3199
|
+
...oe(this.config.dialApiKey, { jwt: e }),
|
|
3200
|
+
...n
|
|
3201
|
+
};
|
|
3202
|
+
const r = {
|
|
3203
|
+
...oe(void 0, { jwt: this.config.jwt }),
|
|
3204
|
+
...n
|
|
3205
|
+
};
|
|
3206
|
+
return this.config.apiKey != null && (r[z] = this.config.apiKey), r;
|
|
3207
|
+
}
|
|
3189
3208
|
addInfoRequestLog(e, n, r, s) {
|
|
3190
3209
|
const a = {
|
|
3191
3210
|
method: r.method || "GET",
|
|
@@ -3220,13 +3239,13 @@ const qa = ["FREQ", "FREQUENCY"], ds = "TIME_PERIOD", ls = "time_period_start",
|
|
|
3220
3239
|
var ms = /* @__PURE__ */ ((t) => (t.CONDITIONAL = "Conditional", t.MANDATORY = "Mandatory", t))(ms || {}), we = /* @__PURE__ */ ((t) => (t.DIMENSION = "Dimension", t.MEASURE_DIMENSION = "MeasureDimension", t.TIME_DIMENSION = "TimeDimension", t))(we || {}), hs = /* @__PURE__ */ ((t) => (t.UNBOUNDED = "unbounded", t))(hs || {});
|
|
3221
3240
|
const ws = (t, e) => {
|
|
3222
3241
|
const n = t?.data?.dataSets?.[0], s = t?.data?.structures?.[0]?.attributes?.dimensionGroup || [], a = n?.dimensionGroupAttributes, o = {};
|
|
3223
|
-
for (const
|
|
3224
|
-
const
|
|
3242
|
+
for (const c of s) {
|
|
3243
|
+
const i = c.relationship.dimensions, { codedSeriesKey: u, decodedSeriesKey: d } = gt(
|
|
3225
3244
|
t,
|
|
3226
3245
|
e,
|
|
3227
|
-
|
|
3246
|
+
i
|
|
3228
3247
|
);
|
|
3229
|
-
o[
|
|
3248
|
+
o[c.id] = {
|
|
3230
3249
|
values: a?.[u] || [],
|
|
3231
3250
|
decodedSeriesKey: d,
|
|
3232
3251
|
codedSeriesKey: u
|
|
@@ -3238,11 +3257,11 @@ const ws = (t, e) => {
|
|
|
3238
3257
|
...r?.dimensions.series || [],
|
|
3239
3258
|
...r?.dimensions.observation || []
|
|
3240
3259
|
], a = new Array(s?.length), o = new Array(s?.length);
|
|
3241
|
-
return n?.forEach((
|
|
3242
|
-
const
|
|
3260
|
+
return n?.forEach((c) => {
|
|
3261
|
+
const i = s?.findIndex((l) => l.id === c) || 0, u = e[i], d = s[i].values.findIndex(
|
|
3243
3262
|
(l) => l.id === u || l.value === u
|
|
3244
3263
|
) || 0;
|
|
3245
|
-
a[
|
|
3264
|
+
a[i] = d >= 0 ? d : u, o[i] = u;
|
|
3246
3265
|
}), {
|
|
3247
3266
|
codedSeriesKey: a.join(":"),
|
|
3248
3267
|
decodedSeriesKey: o.join(":")
|
|
@@ -3250,22 +3269,22 @@ const ws = (t, e) => {
|
|
|
3250
3269
|
}, Qa = (t, e, n) => {
|
|
3251
3270
|
const r = t?.data?.dataSets?.[0], s = t?.data?.structures?.[0], a = (s?.attributes?.dimensionGroup || []).filter(
|
|
3252
3271
|
(l) => l.relationship.dimensions?.length === 1 && l.relationship.dimensions.includes(e || "")
|
|
3253
|
-
), o = r?.dimensionGroupAttributes,
|
|
3272
|
+
), o = r?.dimensionGroupAttributes, c = [
|
|
3254
3273
|
...s?.dimensions.series || [],
|
|
3255
3274
|
...s?.dimensions.observation || []
|
|
3256
|
-
],
|
|
3257
|
-
u[
|
|
3275
|
+
], i = c?.findIndex((l) => l.id === e), u = new Array(c?.length);
|
|
3276
|
+
u[i] = n || "";
|
|
3258
3277
|
const d = {};
|
|
3259
3278
|
for (const l of a) {
|
|
3260
|
-
const g = l.relationship.dimensions, { codedSeriesKey:
|
|
3279
|
+
const g = l.relationship.dimensions, { codedSeriesKey: M, decodedSeriesKey: x } = gt(
|
|
3261
3280
|
t,
|
|
3262
3281
|
u,
|
|
3263
3282
|
g
|
|
3264
3283
|
);
|
|
3265
3284
|
d[l.id] = {
|
|
3266
|
-
values: o?.[
|
|
3267
|
-
decodedSeriesKey:
|
|
3268
|
-
codedSeriesKey:
|
|
3285
|
+
values: o?.[M] || [],
|
|
3286
|
+
decodedSeriesKey: x,
|
|
3287
|
+
codedSeriesKey: M
|
|
3269
3288
|
};
|
|
3270
3289
|
}
|
|
3271
3290
|
return d;
|
|
@@ -3274,18 +3293,18 @@ const ws = (t, e) => {
|
|
|
3274
3293
|
return;
|
|
3275
3294
|
const n = t.values?.[e];
|
|
3276
3295
|
return n ?? (e instanceof Array ? { values: e } : { value: e.toString() });
|
|
3277
|
-
},
|
|
3296
|
+
}, ys = "Observation", Fa = (t) => {
|
|
3278
3297
|
const e = t?.data?.dataSets, n = t?.data?.structures?.[0];
|
|
3279
3298
|
if (!e || !n)
|
|
3280
3299
|
return [];
|
|
3281
|
-
const r = n.attributes, s = n.dimensions, a = r?.dimensionGroup || [], o = e[0].series || e[0].observations,
|
|
3300
|
+
const r = n.attributes, s = n.dimensions, a = r?.dimensionGroup || [], o = e[0].series || e[0].observations, c = s.series?.length ? s.series : s.observation, i = [];
|
|
3282
3301
|
for (const u in o) {
|
|
3283
|
-
const d = [], { name: l, parsedTimeSeriesValue: g } =
|
|
3302
|
+
const d = [], { name: l, parsedTimeSeriesValue: g } = ps(
|
|
3284
3303
|
u,
|
|
3285
|
-
|
|
3286
|
-
),
|
|
3287
|
-
if (Object.keys(
|
|
3288
|
-
|
|
3304
|
+
c
|
|
3305
|
+
), M = o[u], x = M.attributes || [];
|
|
3306
|
+
if (Object.keys(M).length === 0) {
|
|
3307
|
+
i.push({
|
|
3289
3308
|
name: l,
|
|
3290
3309
|
parsedTimeSeriesValue: g,
|
|
3291
3310
|
values: d,
|
|
@@ -3295,18 +3314,18 @@ const ws = (t, e) => {
|
|
|
3295
3314
|
continue;
|
|
3296
3315
|
}
|
|
3297
3316
|
d.push(
|
|
3298
|
-
...Es(
|
|
3317
|
+
...Es(M, n)
|
|
3299
3318
|
);
|
|
3300
|
-
const
|
|
3319
|
+
const N = ie(
|
|
3301
3320
|
r?.series || [],
|
|
3302
|
-
(v) =>
|
|
3321
|
+
(v) => x[v]
|
|
3303
3322
|
), f = xs(
|
|
3304
3323
|
n.attributes?.dataSet || [],
|
|
3305
3324
|
e[0].attributes?.filter((v) => v != null) || []
|
|
3306
3325
|
), w = ws(
|
|
3307
3326
|
t,
|
|
3308
3327
|
g
|
|
3309
|
-
),
|
|
3328
|
+
), P = a.map((v, W) => {
|
|
3310
3329
|
const $ = w[v.id], U = gs(
|
|
3311
3330
|
v,
|
|
3312
3331
|
$.values[W]
|
|
@@ -3317,28 +3336,28 @@ const ws = (t, e) => {
|
|
|
3317
3336
|
dimensionGroupData: $
|
|
3318
3337
|
};
|
|
3319
3338
|
});
|
|
3320
|
-
|
|
3339
|
+
i.push({
|
|
3321
3340
|
name: l,
|
|
3322
3341
|
parsedTimeSeriesValue: g,
|
|
3323
3342
|
values: d,
|
|
3324
|
-
attributes:
|
|
3343
|
+
attributes: N,
|
|
3325
3344
|
dataSetAttrs: f,
|
|
3326
|
-
dimensionGroupAttributes:
|
|
3345
|
+
dimensionGroupAttributes: P
|
|
3327
3346
|
});
|
|
3328
3347
|
}
|
|
3329
|
-
return
|
|
3330
|
-
},
|
|
3348
|
+
return i;
|
|
3349
|
+
}, ps = (t, e) => {
|
|
3331
3350
|
const n = t.split(new RegExp("(?<!\\|):(?!\\||$)")), r = [];
|
|
3332
3351
|
for (let s = 0; s < n.length; s++) {
|
|
3333
3352
|
const a = e?.[s], o = Number(n[s]);
|
|
3334
3353
|
if (o < 0 || a == null)
|
|
3335
3354
|
continue;
|
|
3336
|
-
const
|
|
3337
|
-
if (
|
|
3355
|
+
const c = a.values[o];
|
|
3356
|
+
if (c == null) {
|
|
3338
3357
|
r.push(n[s].replace("|:", ":"));
|
|
3339
3358
|
continue;
|
|
3340
3359
|
}
|
|
3341
|
-
r.push(
|
|
3360
|
+
r.push(c?.id || c?.value || "");
|
|
3342
3361
|
}
|
|
3343
3362
|
return {
|
|
3344
3363
|
name: Ds(r),
|
|
@@ -3367,21 +3386,21 @@ const ws = (t, e) => {
|
|
|
3367
3386
|
e.attributes?.observation || [],
|
|
3368
3387
|
(o) => t[o + n]
|
|
3369
3388
|
),
|
|
3370
|
-
dimensionAtObservation:
|
|
3389
|
+
dimensionAtObservation: ys
|
|
3371
3390
|
}
|
|
3372
3391
|
];
|
|
3373
3392
|
const r = t.observations, s = e.dimensions.observation?.[0], a = [];
|
|
3374
3393
|
for (const o in r) {
|
|
3375
|
-
const
|
|
3394
|
+
const c = s?.values[o];
|
|
3376
3395
|
a.push({
|
|
3377
|
-
dimensionAtObservation:
|
|
3396
|
+
dimensionAtObservation: c?.value || c?.id,
|
|
3378
3397
|
values: Qe(
|
|
3379
3398
|
r[o],
|
|
3380
3399
|
e.measures
|
|
3381
3400
|
),
|
|
3382
3401
|
obsAttributes: ie(
|
|
3383
3402
|
e.attributes?.observation || [],
|
|
3384
|
-
(
|
|
3403
|
+
(i) => r[o][i + n]
|
|
3385
3404
|
)
|
|
3386
3405
|
});
|
|
3387
3406
|
}
|
|
@@ -3398,7 +3417,7 @@ const ws = (t, e) => {
|
|
|
3398
3417
|
name: e.id,
|
|
3399
3418
|
value: s || ""
|
|
3400
3419
|
});
|
|
3401
|
-
}, Ms = /^[0-9][0-9][0-9][0-9]-Q[1-4]$/, vs = /^[0-9][0-9][0-9][0-9]-W(0[1-9]|[1-4][0-9]|5[0-3])$/, Os = /^[0-9][0-9][0-9][0-9]-S[1-2]$/, As = /^[0-9][0-9][0-9][0-9]$/, Ns = /^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-[0-9][0-9]$/, ks = /^[0-9][0-9][0-9][0-9]-M(0[1-9]|(1[0-2]))$/, ge = (t) => As.exec(t),
|
|
3420
|
+
}, Ms = /^[0-9][0-9][0-9][0-9]-Q[1-4]$/, vs = /^[0-9][0-9][0-9][0-9]-W(0[1-9]|[1-4][0-9]|5[0-3])$/, Os = /^[0-9][0-9][0-9][0-9]-S[1-2]$/, As = /^[0-9][0-9][0-9][0-9]$/, Ns = /^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-[0-9][0-9]$/, ks = /^[0-9][0-9][0-9][0-9]-M(0[1-9]|(1[0-2]))$/, ge = (t) => As.exec(t), ye = (t) => !!ge(t), Rs = (t) => Os.exec(t), pe = (t) => !!Rs(t), be = (t) => ks.exec(t), De = (t) => !!be(t), Te = (t) => Ms.exec(t), Ee = (t) => !!Te(t), _s = (t) => Ns.exec(t), Is = (t) => !!_s(t), Ys = (t) => vs.exec(t), xe = (t) => !!Ys(t), Pe = 1440 * 60 * 1e3, Me = 7 * Pe;
|
|
3402
3421
|
function ve(t) {
|
|
3403
3422
|
const e = `${t}-01-01`, n = new Date(e);
|
|
3404
3423
|
if (n.getDay() !== 4) {
|
|
@@ -3412,21 +3431,21 @@ function Cs(t) {
|
|
|
3412
3431
|
return e.setDate(e.getDate() + r), new Date(e.valueOf());
|
|
3413
3432
|
}
|
|
3414
3433
|
function Fe(t, e = "W") {
|
|
3415
|
-
const n = `${t}-12-31`, r =
|
|
3434
|
+
const n = `${t}-12-31`, r = ee(new Date(n), e);
|
|
3416
3435
|
if (r.weekYear === t)
|
|
3417
3436
|
return r.weekNumber;
|
|
3418
3437
|
const s = `${t}-12-24`;
|
|
3419
|
-
return
|
|
3438
|
+
return ee(new Date(s), e).weekNumber;
|
|
3420
3439
|
}
|
|
3421
|
-
function
|
|
3440
|
+
function yt(t, e, n = "W") {
|
|
3422
3441
|
return `${t}-${n}${e < 10 ? "0" + e : e}`;
|
|
3423
3442
|
}
|
|
3424
|
-
function
|
|
3443
|
+
function ee(t, e = "W") {
|
|
3425
3444
|
const n = Cs(t), r = n.getFullYear(), s = ve(r), a = 1 + Math.ceil(
|
|
3426
3445
|
(n.getTime() - s.getTime()) / Me
|
|
3427
3446
|
);
|
|
3428
3447
|
return {
|
|
3429
|
-
code:
|
|
3448
|
+
code: yt(r, a, e),
|
|
3430
3449
|
weekNumber: a,
|
|
3431
3450
|
weekYear: r
|
|
3432
3451
|
};
|
|
@@ -3439,11 +3458,11 @@ function Ss(t) {
|
|
|
3439
3458
|
const [e, n] = t.split("-W"), s = ve(+e).getTime() + (+n - 1) * Me + 3 * Pe;
|
|
3440
3459
|
return new Date(s);
|
|
3441
3460
|
}
|
|
3442
|
-
function
|
|
3443
|
-
return
|
|
3461
|
+
function pt(t) {
|
|
3462
|
+
return ye(t) ? Ws(t) : pe(t) ? qs(t) : Ee(t) ? Fs(t) : De(t) ? Us(t) : xe(t) ? Ls(t) : Gs(t);
|
|
3444
3463
|
}
|
|
3445
3464
|
function bt(t) {
|
|
3446
|
-
return
|
|
3465
|
+
return ye(t) ? $s(t) : pe(t) ? Qs(t) : Ee(t) ? Hs(t) : De(t) ? Bs(t) : xe(t) ? Ss(t) : Vs(t);
|
|
3447
3466
|
}
|
|
3448
3467
|
function Ws(t) {
|
|
3449
3468
|
const e = ge(t);
|
|
@@ -3523,14 +3542,14 @@ const Gs = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Vs = (t) => {
|
|
|
3523
3542
|
const e = /* @__PURE__ */ new Date(`${t}T23:59:00`);
|
|
3524
3543
|
return e.setMinutes(e.getMinutes() + 1), e;
|
|
3525
3544
|
}, Xs = 1, js = (t, e, n, r = !0, s = "Q") => {
|
|
3526
|
-
const a = [], o = e && e > 3 ? na(e, r) : 1,
|
|
3527
|
-
for (let
|
|
3528
|
-
a.push(`${t}-${s}${
|
|
3545
|
+
const a = [], o = e && e > 3 ? na(e, r) : 1, c = n ? Math.floor((n - 1) / 3) : 4;
|
|
3546
|
+
for (let i = o; i <= c; i++)
|
|
3547
|
+
a.push(`${t}-${s}${i}`);
|
|
3529
3548
|
return a;
|
|
3530
|
-
},
|
|
3549
|
+
}, zs = (t, e, n, r = "S") => {
|
|
3531
3550
|
const s = [];
|
|
3532
3551
|
return (e || 1) < 7 && (n || 12) > 6 && s.push(`${t}-${r}1`), n == null && s.push(`${t}-${r}2`), s;
|
|
3533
|
-
}, Ha = (t) => Math.ceil(t / 3), Dt = (t, e, n = "M") => `${t}-${n}${e.toString().padStart(2, "0")}`,
|
|
3552
|
+
}, Ha = (t) => Math.ceil(t / 3), Dt = (t, e, n = "M") => `${t}-${n}${e.toString().padStart(2, "0")}`, Ks = (t, e, n = "M") => {
|
|
3534
3553
|
const r = [];
|
|
3535
3554
|
for (let s = e; s <= 12; s++)
|
|
3536
3555
|
r.push(Dt(t, s, n));
|
|
@@ -3542,7 +3561,7 @@ const Gs = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Vs = (t) => {
|
|
|
3542
3561
|
return s;
|
|
3543
3562
|
}, Zs = (t, e, n, r = "M") => {
|
|
3544
3563
|
const s = e || 1, a = n == null, o = n || 12;
|
|
3545
|
-
return a ?
|
|
3564
|
+
return a ? Ks(t, s, r) : Js(t, s, o, r);
|
|
3546
3565
|
}, Ua = (t, e, n = "M") => {
|
|
3547
3566
|
switch (e) {
|
|
3548
3567
|
case 0:
|
|
@@ -3573,14 +3592,14 @@ const Gs = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Vs = (t) => {
|
|
|
3573
3592
|
return [];
|
|
3574
3593
|
}
|
|
3575
3594
|
}, ea = (t, e) => {
|
|
3576
|
-
const n =
|
|
3577
|
-
return Array.from({ length: o }, (
|
|
3578
|
-
},
|
|
3595
|
+
const n = R(e, !0), r = R(t), s = n.getFullYear(), a = r.getFullYear(), o = n.getTime() <= r.getTime() ? a + Xs - s : 0;
|
|
3596
|
+
return Array.from({ length: o }, (i, u) => s + u);
|
|
3597
|
+
}, R = (t, e = !1) => {
|
|
3579
3598
|
const n = ta(t, e);
|
|
3580
3599
|
return n ? (n.getTimezoneOffset() > 0 && n.setMinutes(n.getMinutes() + n.getTimezoneOffset()), n) : /* @__PURE__ */ new Date();
|
|
3581
3600
|
}, ta = (t, e = !1) => {
|
|
3582
3601
|
const n = Number(t);
|
|
3583
|
-
return t.toString().length !== 13 ? e ?
|
|
3602
|
+
return t.toString().length !== 13 ? e ? pt(t) : bt(t) : isNaN(n) ? /* @__PURE__ */ new Date(`${t}T00:00:00.000Z`) : new Date(n);
|
|
3584
3603
|
}, na = (t, e) => e ? Math.floor((t + 1) / 3) : Math.ceil((t + 1) / 3), Ba = (t, e) => {
|
|
3585
3604
|
const n = Ue(t) - Ue(e);
|
|
3586
3605
|
if (n === 0 && t !== e) {
|
|
@@ -3588,8 +3607,8 @@ const Gs = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Vs = (t) => {
|
|
|
3588
3607
|
return r - s;
|
|
3589
3608
|
}
|
|
3590
3609
|
return n;
|
|
3591
|
-
}, He = (t) =>
|
|
3592
|
-
var Oe = /* @__PURE__ */ ((t) => (t.LAST_UPDATE_AT = "lastUpdatedAt", t.SERIES_COUNT = "series_count", t))(Oe || {}), ra = /* @__PURE__ */ ((t) => (t.C = "c", t))(ra || {}),
|
|
3610
|
+
}, He = (t) => ye(t) ? 6 : pe(t) ? 5 : Ee(t) ? 4 : De(t) ? 3 : xe(t) ? 2 : Is(t) ? 1 : 0, Ue = (t, e = !1) => (e ? pt(t) : bt(t))?.getTime() || 0;
|
|
3611
|
+
var Oe = /* @__PURE__ */ ((t) => (t.LAST_UPDATE_AT = "lastUpdatedAt", t.SERIES_COUNT = "series_count", t))(Oe || {}), ra = /* @__PURE__ */ ((t) => (t.C = "c", t))(ra || {}), _ = /* @__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))(_ || {}), sa = /* @__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))(sa || {}), aa = /* @__PURE__ */ ((t) => (t.ANNUAL = "A", t.QUARTERLY = "Q", t.MONTHLY = "M", t))(aa || {});
|
|
3593
3612
|
function Ga(t) {
|
|
3594
3613
|
return t?.annotations?.find((e) => {
|
|
3595
3614
|
if (e.id === Oe.LAST_UPDATE_AT)
|
|
@@ -3617,34 +3636,34 @@ const Ae = (t, e) => t?.names && t?.names[e] || t?.name, Tt = (t, e, n) => {
|
|
|
3617
3636
|
endPeriod: r
|
|
3618
3637
|
};
|
|
3619
3638
|
}, ia = (t, e) => t.id.localeCompare(e.id), ca = (t, e) => t.memberValue.localeCompare(e.memberValue), ua = (t, e) => {
|
|
3620
|
-
const n = new Array(t.length), r = t.map((o,
|
|
3639
|
+
const n = new Array(t.length), r = t.map((o, c) => [o, c]);
|
|
3621
3640
|
r.sort(
|
|
3622
|
-
(o,
|
|
3641
|
+
(o, c) => ia(o[0], c[0])
|
|
3623
3642
|
);
|
|
3624
3643
|
const s = [...e];
|
|
3625
3644
|
s.sort(ca);
|
|
3626
3645
|
let a = 0;
|
|
3627
3646
|
for (const o of r) {
|
|
3628
|
-
const
|
|
3629
|
-
for (; a < s.length && s[a].memberValue.localeCompare(
|
|
3647
|
+
const c = o[0];
|
|
3648
|
+
for (; a < s.length && s[a].memberValue.localeCompare(c.id) < 0; )
|
|
3630
3649
|
a += 1;
|
|
3631
|
-
a < s.length && s[a].memberValue ===
|
|
3650
|
+
a < s.length && s[a].memberValue === c.id && (n[o[1]] = o[0]);
|
|
3632
3651
|
}
|
|
3633
3652
|
return n.filter((o) => o != null);
|
|
3634
3653
|
}, da = (t) => !!t?.some((e) => e.parent), Xa = (t, e, n, r, s = []) => {
|
|
3635
3654
|
let a = t || [];
|
|
3636
3655
|
if (la(n || [], e || "")) {
|
|
3637
3656
|
const o = (n || [])[0].cubeRegions?.find(
|
|
3638
|
-
({ isIncluded:
|
|
3657
|
+
({ isIncluded: c }) => c
|
|
3639
3658
|
);
|
|
3640
3659
|
if (o) {
|
|
3641
|
-
const
|
|
3642
|
-
({ componentId:
|
|
3660
|
+
const c = o.memberSelection?.find(
|
|
3661
|
+
({ componentId: i }) => i === e
|
|
3643
3662
|
);
|
|
3644
|
-
|
|
3645
|
-
id:
|
|
3646
|
-
name:
|
|
3647
|
-
})) : ua(a,
|
|
3663
|
+
c ? a = a.length === 0 ? (c.selectionValues || []).map(({ memberValue: i }) => ({
|
|
3664
|
+
id: i,
|
|
3665
|
+
name: i
|
|
3666
|
+
})) : ua(a, c.selectionValues) : a = [];
|
|
3648
3667
|
}
|
|
3649
3668
|
} else s.length !== 0 && (a = a.filter(({ id: o }) => s.includes(o)));
|
|
3650
3669
|
return da(t) && (a = oa(t, a)), a?.map((o) => ({
|
|
@@ -3656,7 +3675,7 @@ const Ae = (t, e) => t?.names && t?.names[e] || t?.name, Tt = (t, e, n) => {
|
|
|
3656
3675
|
return t?.filters?.forEach((n) => {
|
|
3657
3676
|
n.componentCode !== ds && e.push({
|
|
3658
3677
|
componentCode: n.componentCode,
|
|
3659
|
-
operator:
|
|
3678
|
+
operator: _.EQUALS,
|
|
3660
3679
|
value: n.values.join(",")
|
|
3661
3680
|
});
|
|
3662
3681
|
}), e;
|
|
@@ -3690,8 +3709,8 @@ const Ae = (t, e) => t?.names && t?.names[e] || t?.name, Tt = (t, e, n) => {
|
|
|
3690
3709
|
}, ga = (t, e) => {
|
|
3691
3710
|
const n = Be(t), r = Be(e), s = n.pop(), a = r.pop(), o = Xe(n, r);
|
|
3692
3711
|
return o !== 0 ? o : s && a ? Xe(s.split("."), a.split(".")) : s || a ? s ? -1 : 1 : 0;
|
|
3693
|
-
},
|
|
3694
|
-
|
|
3712
|
+
}, ya = (t, e, n) => {
|
|
3713
|
+
pa(n);
|
|
3695
3714
|
const r = ga(t, e);
|
|
3696
3715
|
return Et[n].includes(r);
|
|
3697
3716
|
}, Et = {
|
|
@@ -3701,22 +3720,22 @@ const Ae = (t, e) => t?.names && t?.names[e] || t?.name, Tt = (t, e, n) => {
|
|
|
3701
3720
|
"<=": [-1, 0],
|
|
3702
3721
|
"<": [-1],
|
|
3703
3722
|
"!=": [-1, 1]
|
|
3704
|
-
}, je = Object.keys(Et),
|
|
3723
|
+
}, je = Object.keys(Et), pa = (t) => {
|
|
3705
3724
|
if (je.indexOf(t) === -1)
|
|
3706
3725
|
throw new Error(`Invalid operator, expected one of ${je.join("|")}`);
|
|
3707
3726
|
}, ce = "+", Ne = (t, e) => {
|
|
3708
3727
|
const { agency: n, id: r, version: s } = H(t), a = e.filter(
|
|
3709
|
-
(
|
|
3728
|
+
(i) => i.agencyID === n && i.id === r && !i?.version?.includes(ce)
|
|
3710
3729
|
);
|
|
3711
3730
|
if (a.length === 1)
|
|
3712
3731
|
return a[0];
|
|
3713
3732
|
if (!s?.includes(ce))
|
|
3714
|
-
return a.find((
|
|
3733
|
+
return a.find((i) => i.version === s);
|
|
3715
3734
|
const o = a.map(
|
|
3716
|
-
(
|
|
3717
|
-
),
|
|
3735
|
+
(i) => i.version
|
|
3736
|
+
), c = ba(s, o);
|
|
3718
3737
|
return a.find(
|
|
3719
|
-
(
|
|
3738
|
+
(i) => i.version === c[0]
|
|
3720
3739
|
);
|
|
3721
3740
|
}, ba = (t, e) => {
|
|
3722
3741
|
const n = Da(t, e);
|
|
@@ -3735,7 +3754,7 @@ const Ae = (t, e) => t?.names && t?.names[e] || t?.name, Tt = (t, e, n) => {
|
|
|
3735
3754
|
return r > 0 ? e.slice(0, r) : "";
|
|
3736
3755
|
}, Ea = (t, e) => {
|
|
3737
3756
|
const n = t.trim().replace(/\+/, ""), r = Ta(t);
|
|
3738
|
-
return e.startsWith(r) &&
|
|
3757
|
+
return e.startsWith(r) && ya(e, n, ">=");
|
|
3739
3758
|
}, ke = (t, e) => {
|
|
3740
3759
|
const { concept: n } = xa(t, e);
|
|
3741
3760
|
return n;
|
|
@@ -3752,29 +3771,29 @@ const Ae = (t, e) => t?.names && t?.names[e] || t?.name, Tt = (t, e, n) => {
|
|
|
3752
3771
|
e
|
|
3753
3772
|
);
|
|
3754
3773
|
return {
|
|
3755
|
-
concept:
|
|
3774
|
+
concept: ze(o?.concepts || [], n),
|
|
3756
3775
|
scheme: o
|
|
3757
3776
|
};
|
|
3758
3777
|
}
|
|
3759
3778
|
for (const o of e)
|
|
3760
3779
|
if (Pa(o, s, r, a))
|
|
3761
3780
|
return {
|
|
3762
|
-
concept:
|
|
3781
|
+
concept: ze(o?.concepts || [], n),
|
|
3763
3782
|
scheme: o
|
|
3764
3783
|
};
|
|
3765
3784
|
return {
|
|
3766
3785
|
concept: void 0,
|
|
3767
3786
|
scheme: void 0
|
|
3768
3787
|
};
|
|
3769
|
-
},
|
|
3788
|
+
}, ze = (t, e) => t?.find((n) => n.id === e), Pa = (t, e, n, r) => t.id === e && t.agencyID === n && t.version === r, za = (t = [], e = [], n) => {
|
|
3770
3789
|
const r = n?.conceptIdentity || "", s = ke(r, e), a = K(
|
|
3771
3790
|
n?.localRepresentation?.enumeration
|
|
3772
3791
|
), o = K(
|
|
3773
3792
|
s?.coreRepresentation?.enumeration
|
|
3774
|
-
),
|
|
3775
|
-
if (
|
|
3776
|
-
return Ne(
|
|
3777
|
-
},
|
|
3793
|
+
), c = a || o;
|
|
3794
|
+
if (c != null)
|
|
3795
|
+
return Ne(c, t);
|
|
3796
|
+
}, Ka = (t, e, n, r) => {
|
|
3778
3797
|
const s = e?.find(
|
|
3779
3798
|
(a) => a?.id === t?.id
|
|
3780
3799
|
)?.values;
|
|
@@ -3798,7 +3817,7 @@ const Ae = (t, e) => t?.names && t?.names[e] || t?.name, Tt = (t, e, n) => {
|
|
|
3798
3817
|
const r = K(e?.conceptIdentity) || "", s = ke(r, t);
|
|
3799
3818
|
return n ? Ae(s, n) : s?.name ?? s?.id ?? e?.id;
|
|
3800
3819
|
};
|
|
3801
|
-
function
|
|
3820
|
+
function Ke(t) {
|
|
3802
3821
|
return t?.dataStructures?.[0]?.dataStructureComponents?.dimensionList;
|
|
3803
3822
|
}
|
|
3804
3823
|
function Za(t) {
|
|
@@ -3815,34 +3834,34 @@ function to(t) {
|
|
|
3815
3834
|
const no = (t) => {
|
|
3816
3835
|
const e = /* @__PURE__ */ new Map(), n = t?.dataStructures?.[0], r = t?.metadataStructures?.[0], s = t?.conceptSchemes || [], a = t?.codelists || [];
|
|
3817
3836
|
return t && [
|
|
3818
|
-
...
|
|
3819
|
-
...
|
|
3837
|
+
...Ke(t)?.dimensions || [],
|
|
3838
|
+
...Ke(t)?.timeDimensions || [],
|
|
3820
3839
|
...Ma(r, n),
|
|
3821
3840
|
...n?.dataStructureComponents?.attributeList?.attributes || []
|
|
3822
3841
|
].forEach(
|
|
3823
|
-
(
|
|
3824
|
-
const
|
|
3825
|
-
|
|
3842
|
+
(c) => {
|
|
3843
|
+
const i = ke(
|
|
3844
|
+
c?.conceptIdentity,
|
|
3826
3845
|
s
|
|
3827
|
-
), u =
|
|
3846
|
+
), u = c?.localRepresentation?.enumeration || i?.coreRepresentation?.enumeration, d = Ne(
|
|
3828
3847
|
u,
|
|
3829
3848
|
a
|
|
3830
3849
|
);
|
|
3831
|
-
|
|
3850
|
+
c?.id && (u ? e.set(c?.id, {
|
|
3832
3851
|
...d,
|
|
3833
|
-
name:
|
|
3834
|
-
names:
|
|
3835
|
-
}) : e.set(
|
|
3836
|
-
id:
|
|
3837
|
-
name:
|
|
3838
|
-
names:
|
|
3852
|
+
name: i?.name,
|
|
3853
|
+
names: i?.names
|
|
3854
|
+
}) : e.set(c?.id, {
|
|
3855
|
+
id: c?.id,
|
|
3856
|
+
name: i?.name,
|
|
3857
|
+
names: i?.names
|
|
3839
3858
|
}));
|
|
3840
3859
|
}
|
|
3841
3860
|
), e;
|
|
3842
3861
|
}, ro = (t) => t?.find(
|
|
3843
3862
|
(e) => e.id === Oe.SERIES_COUNT
|
|
3844
3863
|
)?.title || "", va = "/api/download", so = (t, e, n, r, s, a, o) => {
|
|
3845
|
-
const
|
|
3864
|
+
const c = new URLSearchParams({
|
|
3846
3865
|
urn: t,
|
|
3847
3866
|
format: e,
|
|
3848
3867
|
compress: "false",
|
|
@@ -3851,8 +3870,8 @@ const no = (t) => {
|
|
|
3851
3870
|
attribute: r,
|
|
3852
3871
|
language: n,
|
|
3853
3872
|
isMetadata: o ? "true" : "none"
|
|
3854
|
-
}).toString(),
|
|
3855
|
-
u.href =
|
|
3873
|
+
}).toString(), i = `${va}?${c}`, u = document.createElement("a");
|
|
3874
|
+
u.href = i, u.download = a, document.body.appendChild(u), u.click(), document.body.removeChild(u);
|
|
3856
3875
|
}, ao = (t, e) => {
|
|
3857
3876
|
const n = [];
|
|
3858
3877
|
for (const r of t) {
|
|
@@ -3867,9 +3886,9 @@ const no = (t) => {
|
|
|
3867
3886
|
return null;
|
|
3868
3887
|
const n = [], { startPeriod: r, endPeriod: s } = t;
|
|
3869
3888
|
if (r && n.push(
|
|
3870
|
-
`${
|
|
3889
|
+
`${_.GREATER_OR_EQUAL}${Re}${Je(r)}`
|
|
3871
3890
|
), s && n.push(
|
|
3872
|
-
`${
|
|
3891
|
+
`${_.LESS_OR_EQUAL}${Re}${Je(s)}`
|
|
3873
3892
|
), n.length === 0)
|
|
3874
3893
|
return null;
|
|
3875
3894
|
const a = e;
|
|
@@ -3881,34 +3900,34 @@ const no = (t) => {
|
|
|
3881
3900
|
return n ? Oa(n, e?.id) : null;
|
|
3882
3901
|
}, Aa = (t, e) => {
|
|
3883
3902
|
const n = e.id, r = t?.filters?.find(
|
|
3884
|
-
(
|
|
3903
|
+
(i) => i.componentCode === n
|
|
3885
3904
|
);
|
|
3886
3905
|
if (!r || !r.values)
|
|
3887
3906
|
return null;
|
|
3888
|
-
const s = r.values?.filter((
|
|
3907
|
+
const s = r.values?.filter((i) => !!i);
|
|
3889
3908
|
if (!s.length)
|
|
3890
3909
|
return null;
|
|
3891
3910
|
const a = r.operator;
|
|
3892
|
-
if (a ===
|
|
3911
|
+
if (a === _.LESS_OR_EQUAL || a === _.LESS)
|
|
3893
3912
|
return { startPeriod: null, endPeriod: V(s[0]) };
|
|
3894
|
-
if (a ===
|
|
3913
|
+
if (a === _.GREATER_OR_EQUAL || a === _.GREATER)
|
|
3895
3914
|
return { startPeriod: V(s[0]), endPeriod: null };
|
|
3896
|
-
const o = V(s[0]),
|
|
3897
|
-
return { startPeriod: o, endPeriod:
|
|
3915
|
+
const o = V(s[0]), c = V(s[1]);
|
|
3916
|
+
return { startPeriod: o, endPeriod: c };
|
|
3898
3917
|
}, xt = (t, e, n) => {
|
|
3899
|
-
const r =
|
|
3918
|
+
const r = R(e, !0), s = R(n), a = R(t, !0), o = R(t), c = r.getTime() > a.getTime() ? r : a, i = s.getTime() < o.getTime() ? s : o;
|
|
3900
3919
|
return {
|
|
3901
|
-
start:
|
|
3902
|
-
end:
|
|
3920
|
+
start: c,
|
|
3921
|
+
end: i
|
|
3903
3922
|
};
|
|
3904
3923
|
}, Na = (t, e, n, r = "W") => {
|
|
3905
3924
|
const s = +t, { start: a, end: o } = xt(t, e, n);
|
|
3906
3925
|
if (a.getTime() > o.getTime())
|
|
3907
3926
|
return [];
|
|
3908
|
-
const
|
|
3909
|
-
if (
|
|
3910
|
-
for (let g =
|
|
3911
|
-
l.push(
|
|
3927
|
+
const c = ee(a, r), i = c.weekYear === s ? c.weekNumber : c.weekYear < s ? 1 : Fe(s, r), u = ee(o, r), d = u.weekYear === s ? u.weekNumber : u.weekYear > s ? Fe(s, r) : 1, l = [];
|
|
3928
|
+
if (i < d)
|
|
3929
|
+
for (let g = i; g <= d; g++)
|
|
3930
|
+
l.push(yt(s, g, r));
|
|
3912
3931
|
return l;
|
|
3913
3932
|
}, ka = (t) => {
|
|
3914
3933
|
const e = new Date(t);
|
|
@@ -3921,10 +3940,10 @@ const no = (t) => {
|
|
|
3921
3940
|
r.getFullYear(),
|
|
3922
3941
|
r.getMonth(),
|
|
3923
3942
|
r.getDate()
|
|
3924
|
-
),
|
|
3925
|
-
for (; o.getTime() <
|
|
3926
|
-
const
|
|
3927
|
-
a.push(
|
|
3943
|
+
), c = new Date(s.getFullYear(), s.getMonth(), s.getDate());
|
|
3944
|
+
for (; o.getTime() < c.getTime(); ) {
|
|
3945
|
+
const i = ka(o);
|
|
3946
|
+
a.push(i), o.setDate(o.getDate() + 1);
|
|
3928
3947
|
}
|
|
3929
3948
|
return a;
|
|
3930
3949
|
}, _a = (t) => ({
|
|
@@ -3937,34 +3956,34 @@ const no = (t) => {
|
|
|
3937
3956
|
({ memberValue: e }) => e === "A" || e === "Y"
|
|
3938
3957
|
)
|
|
3939
3958
|
}), Ia = (t, e, n, r) => {
|
|
3940
|
-
const s = r === 0 ?
|
|
3959
|
+
const s = r === 0 ? R(e.toString(), !0)?.getMonth() + 1 : void 0, a = r === t.length - 1 ? R(n.toString())?.getMonth() + 1 || 1 : void 0;
|
|
3941
3960
|
return { startMonth: s, endMonth: a };
|
|
3942
3961
|
}, Ya = ["FREQUENCY", "FREQ"], io = (t, e) => {
|
|
3943
3962
|
const n = t?.[0]?.cubeRegions?.[0]?.memberSelection?.find(
|
|
3944
|
-
(
|
|
3945
|
-
)?.selectionValues, r = _a(n || []), s = e?.startPeriod?.getTime() || 1, a = e?.endPeriod?.getTime() || 1, o = ea(a, s),
|
|
3946
|
-
return o.forEach((
|
|
3963
|
+
(i) => Ya.includes(i.componentId)
|
|
3964
|
+
)?.selectionValues, r = _a(n || []), s = e?.startPeriod?.getTime() || 1, a = e?.endPeriod?.getTime() || 1, o = ea(a, s), c = [];
|
|
3965
|
+
return o.forEach((i, u) => {
|
|
3947
3966
|
const d = [], { startMonth: l, endMonth: g } = Ia(
|
|
3948
3967
|
o,
|
|
3949
3968
|
new Date(s),
|
|
3950
3969
|
new Date(a),
|
|
3951
3970
|
u
|
|
3952
3971
|
), {
|
|
3953
|
-
isDailyExist:
|
|
3954
|
-
isWeeklyExist:
|
|
3955
|
-
isMonthlyExist:
|
|
3972
|
+
isDailyExist: M,
|
|
3973
|
+
isWeeklyExist: x,
|
|
3974
|
+
isMonthlyExist: N,
|
|
3956
3975
|
isQuarterlyExist: f,
|
|
3957
3976
|
isSemiAnnualExist: w,
|
|
3958
|
-
isYearlyExist:
|
|
3977
|
+
isYearlyExist: P
|
|
3959
3978
|
} = r;
|
|
3960
|
-
|
|
3961
|
-
...js(
|
|
3962
|
-
),
|
|
3963
|
-
...Na(
|
|
3964
|
-
),
|
|
3965
|
-
...Ra(
|
|
3966
|
-
),
|
|
3967
|
-
}),
|
|
3979
|
+
P && d.push(i.toString()), w && d.push(...zs(i, l, g)), f && d.push(
|
|
3980
|
+
...js(i, l, g, !1)
|
|
3981
|
+
), N && d.push(...Zs(i, l, g)), x && d.push(
|
|
3982
|
+
...Na(i, s.toString(), a.toString())
|
|
3983
|
+
), M && d.push(
|
|
3984
|
+
...Ra(i, s.toString(), a.toString())
|
|
3985
|
+
), c.push(...d);
|
|
3986
|
+
}), c;
|
|
3968
3987
|
};
|
|
3969
3988
|
function Ca(t) {
|
|
3970
3989
|
const { urn: e } = t.details;
|
|
@@ -3992,7 +4011,7 @@ export {
|
|
|
3992
4011
|
$t as GET_v3_FILTER_ALL,
|
|
3993
4012
|
Sa as GET_v3_FILTER_AND,
|
|
3994
4013
|
Wt as GET_v3_FILTER_OR,
|
|
3995
|
-
|
|
4014
|
+
ys as OBSERVATION_KEY,
|
|
3996
4015
|
hs as OccurrenceType,
|
|
3997
4016
|
aa as Periods,
|
|
3998
4017
|
sa as RepresentationTextType,
|
|
@@ -4003,14 +4022,14 @@ export {
|
|
|
4003
4022
|
X as SdmxDataFormat,
|
|
4004
4023
|
et as SdmxDetails,
|
|
4005
4024
|
ue as SdmxReferences,
|
|
4006
|
-
|
|
4025
|
+
_ as SeriesFilterOperator,
|
|
4007
4026
|
ds as TIME_PERIOD,
|
|
4008
4027
|
fs as TIME_PERIOD_END_ANNOTATION_KEY,
|
|
4009
4028
|
ls as TIME_PERIOD_START_ANNOTATION_KEY,
|
|
4010
4029
|
co as buildDatasetDimensionsMetadataMap,
|
|
4011
4030
|
Ns as dailyPattern,
|
|
4012
4031
|
Ts as decodeDimensionId,
|
|
4013
|
-
|
|
4032
|
+
za as findCodelistByDimension,
|
|
4014
4033
|
_e as generateDatasetDataRequest,
|
|
4015
4034
|
Mt as generateShortUrn,
|
|
4016
4035
|
io as getAdditionalColumns,
|
|
@@ -4020,21 +4039,21 @@ export {
|
|
|
4020
4039
|
ws as getAttachedDimensionsSeriesByTsId,
|
|
4021
4040
|
gt as getAttachedDimensionsSeriesKey,
|
|
4022
4041
|
gs as getAttributeValueFromDataQueryResponse,
|
|
4023
|
-
|
|
4042
|
+
Ka as getAvailableCodes,
|
|
4024
4043
|
Xa as getAvailableCodesFromConstrains,
|
|
4025
4044
|
Pt as getChildParsedUrn,
|
|
4026
4045
|
ke as getConcept,
|
|
4027
|
-
|
|
4046
|
+
ze as getConceptByUrn,
|
|
4028
4047
|
xa as getConceptWithScheme,
|
|
4029
4048
|
Ma as getConvertedMetaAttributes,
|
|
4030
4049
|
_s as getDailyRegExp,
|
|
4031
4050
|
Ra as getDaysColumns,
|
|
4032
4051
|
Ja as getDimensionTitle,
|
|
4033
|
-
|
|
4052
|
+
Ke as getDimensions,
|
|
4034
4053
|
oa as getFilteredItemsWithParents,
|
|
4035
4054
|
fa as getFiltersDtoFromDataQuery,
|
|
4036
4055
|
ja as getFiltersDtoMapFromDataQuery,
|
|
4037
|
-
|
|
4056
|
+
ee as getISOWeek,
|
|
4038
4057
|
K as getKeyFromUrn,
|
|
4039
4058
|
Ga as getLastUpdatedTime,
|
|
4040
4059
|
Fe as getLastWeekNumberOfYear,
|
|
@@ -4044,8 +4063,8 @@ export {
|
|
|
4044
4063
|
be as getMonthlyRegExp,
|
|
4045
4064
|
bt as getParsedEndPeriodDate,
|
|
4046
4065
|
Fa as getParsedResponse,
|
|
4047
|
-
|
|
4048
|
-
|
|
4066
|
+
pt as getParsedStartPeriodDate,
|
|
4067
|
+
R as getPeriodDate,
|
|
4049
4068
|
_a as getPeriods,
|
|
4050
4069
|
Ha as getQuarterByMonth,
|
|
4051
4070
|
Te as getQuarterlyRegExp,
|
|
@@ -4053,10 +4072,10 @@ export {
|
|
|
4053
4072
|
Oa as getQueryTimePeriodFilters,
|
|
4054
4073
|
Yt as getRequestAcceptHeader,
|
|
4055
4074
|
ba as getResolvedVersionBySingleWildcard,
|
|
4056
|
-
|
|
4075
|
+
zs as getSemiAnnualData,
|
|
4057
4076
|
Rs as getSemiAnnuallyRegExp,
|
|
4058
4077
|
ie as getSeriesAttributes,
|
|
4059
|
-
|
|
4078
|
+
ps as getSeriesName,
|
|
4060
4079
|
no as getStructureComponentsMap,
|
|
4061
4080
|
Za as getStructureDimensions,
|
|
4062
4081
|
to as getTimeDimension,
|
|
@@ -4066,7 +4085,7 @@ export {
|
|
|
4066
4085
|
ro as getTimeSeriesCount,
|
|
4067
4086
|
ao as getTimeSeriesFilterKey,
|
|
4068
4087
|
Ds as getTimeSeriesId,
|
|
4069
|
-
|
|
4088
|
+
yt as getWeekCode,
|
|
4070
4089
|
Ss as getWeeklyPeriodEndDate,
|
|
4071
4090
|
Ls as getWeeklyPeriodStartDate,
|
|
4072
4091
|
Ys as getWeeklyRegExp,
|
|
@@ -4078,10 +4097,10 @@ export {
|
|
|
4078
4097
|
Is as isDaily,
|
|
4079
4098
|
De as isMonthly,
|
|
4080
4099
|
Ee as isQuarterly,
|
|
4081
|
-
|
|
4100
|
+
pe as isSemiAnnually,
|
|
4082
4101
|
xe as isWeekly,
|
|
4083
4102
|
Ea as isWildCardVersionCorrect,
|
|
4084
|
-
|
|
4103
|
+
ye as isYearly,
|
|
4085
4104
|
ks as monthlyPattern,
|
|
4086
4105
|
so as openDownloadWindow,
|
|
4087
4106
|
Ms as quarterPattern,
|