@epam/statgpt-sdmx-toolkit 0.4.0-rc.4 → 0.4.0-rc.41
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/hierarchy-api.d.ts +8 -0
- package/api/index.d.ts +1 -0
- 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 +1274 -1130
- package/models/index.d.ts +1 -0
- package/models/structural-metadata/glossary.d.ts +8 -0
- package/models/structural-metadata/hierarchy.d.ts +27 -0
- package/models/structural-metadata/structural-metadata.d.ts +5 -0
- package/package.json +3 -3
- package/utils/download.d.ts +1 -1
- package/utils/get-dimensions.d.ts +1 -1
- package/utils/hierarchy-utils.d.ts +8 -0
- package/utils/index.d.ts +1 -0
- package/utils/wildcards.d.ts +1 -1
package/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ const K = (t) => {
|
|
|
3
3
|
const e = t.split("=");
|
|
4
4
|
return e.length === 1 ? t : e[1];
|
|
5
5
|
}
|
|
6
|
-
},
|
|
6
|
+
}, C = (t) => {
|
|
7
7
|
if (t == null)
|
|
8
8
|
return {};
|
|
9
9
|
const e = K(t), n = {
|
|
@@ -12,78 +12,80 @@ const K = (t) => {
|
|
|
12
12
|
version: ""
|
|
13
13
|
};
|
|
14
14
|
return e && (e.includes(":") && (n.agency = e.split(":")[0], n.id = e.split(":")[1].split("(")[0]), e.includes("(") && e.includes(")") && (n.version = e.split("(")[1]?.split(")")[0])), n;
|
|
15
|
-
},
|
|
16
|
-
const [e, n] = t.split(")."), { agency: r, id: s, version: a } =
|
|
15
|
+
}, tt = (t) => {
|
|
16
|
+
const [e, n] = t.split(")."), { agency: r, id: s, version: a } = C(e + ")");
|
|
17
17
|
return { childId: n, agency: r, id: s, version: a };
|
|
18
|
-
},
|
|
18
|
+
}, de = (t, e, n) => {
|
|
19
19
|
const r = e === "" ? "" : `(${e})`;
|
|
20
20
|
return `${n}:${t}${r}`;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
23
|
-
function
|
|
22
|
+
var le = /* @__PURE__ */ ((t) => (t.DESCENDANTS = "descendants", t.NONE = "none", t.ALL = "all", t))(le || {}), nt = /* @__PURE__ */ ((t) => (t.EXACT = "exact", t.AVAILABLE = "available", t))(nt || {});
|
|
23
|
+
function At(t) {
|
|
24
24
|
return {
|
|
25
25
|
data: {
|
|
26
26
|
codelists: t.data.codelists,
|
|
27
27
|
conceptSchemes: t.data.conceptSchemes,
|
|
28
|
-
dataConstraints: t.data.dataConstraints?.map(
|
|
28
|
+
dataConstraints: t.data.dataConstraints?.map(Nt),
|
|
29
29
|
dataflows: t.data.dataflows,
|
|
30
30
|
dataStructures: t.data.dataStructures,
|
|
31
31
|
metadataStructures: t.data.metadataStructures
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function Nt(t) {
|
|
36
36
|
return {
|
|
37
37
|
...t,
|
|
38
|
-
cubeRegions: t.cubeRegions?.map(
|
|
38
|
+
cubeRegions: t.cubeRegions?.map(kt)
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
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
|
-
const
|
|
60
|
-
class
|
|
59
|
+
const _t = (t = "", e = "", n = "") => `sdmx/3.0/availability/dataflow/${t}/${e}/${n}`;
|
|
60
|
+
class qa {
|
|
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 } = C(e), i = {
|
|
66
66
|
filters: n || [],
|
|
67
|
-
mode:
|
|
68
|
-
references:
|
|
69
|
-
},
|
|
67
|
+
mode: nt.AVAILABLE,
|
|
68
|
+
references: le.NONE
|
|
69
|
+
}, c = _t(s, a, o);
|
|
70
70
|
if (this.client.config.sdmxProxyUrl) {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
{ body:
|
|
74
|
-
this.client.config.sdmxProxyUrl
|
|
71
|
+
const u = await this.client.postRequest(
|
|
72
|
+
c,
|
|
73
|
+
{ body: i },
|
|
74
|
+
this.client.config.sdmxProxyUrl,
|
|
75
|
+
r
|
|
75
76
|
);
|
|
76
|
-
return
|
|
77
|
+
return At(u);
|
|
77
78
|
}
|
|
78
79
|
return await this.client.postRequest(
|
|
79
|
-
|
|
80
|
-
{ body:
|
|
81
|
-
this.client.config.constrainsApiUrl || this.client.config.apiUrl
|
|
80
|
+
c,
|
|
81
|
+
{ body: i },
|
|
82
|
+
this.client.config.constrainsApiUrl || this.client.config.apiUrl,
|
|
83
|
+
r
|
|
82
84
|
);
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
|
-
var X = /* @__PURE__ */ ((t) => (t.CSV = "csv", t.JSON = "json", t.XML = "xml", t))(X || {}),
|
|
86
|
-
const
|
|
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 Lt = (t, e) => {
|
|
87
89
|
switch (t) {
|
|
88
90
|
case X.CSV:
|
|
89
91
|
return B(
|
|
@@ -104,89 +106,96 @@ const Yt = (t, e) => {
|
|
|
104
106
|
);
|
|
105
107
|
}
|
|
106
108
|
}, B = (t, e) => `${t}; labels=${e}`;
|
|
107
|
-
var
|
|
108
|
-
const
|
|
109
|
-
const { filterKey: r, timeFilter: s } = n, { agency: a, id: o, version: i } =
|
|
110
|
-
return `${`${
|
|
111
|
-
},
|
|
112
|
-
class
|
|
109
|
+
var rt = /* @__PURE__ */ ((t) => (t.REFERENCE_PARTIAL = "referencepartial", t.FULL = "full", t))(rt || {});
|
|
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
|
+
class Ha {
|
|
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 } = C(e);
|
|
118
120
|
return await this.client.getRequest(
|
|
119
|
-
|
|
121
|
+
Ht(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
|
-
attributes:
|
|
130
|
+
attributes: St,
|
|
127
131
|
dimensionAtObservation: "TIME_PERIOD"
|
|
128
132
|
// TODO: use time dimensions
|
|
129
|
-
}).toString(),
|
|
130
|
-
return await this.client.getRequest(
|
|
133
|
+
}).toString(), a = Ye(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, i = !1) {
|
|
133
|
-
const
|
|
140
|
+
async downloadDataSet(e, n, r, s, a, o, i = !1, c) {
|
|
141
|
+
const u = new URLSearchParams({
|
|
134
142
|
format: n,
|
|
135
143
|
compress: "false",
|
|
136
144
|
attributes: i ? "all" : "none",
|
|
137
145
|
limit: "1000"
|
|
138
|
-
}).toString(),
|
|
146
|
+
}).toString(), d = Ye(e, u, a);
|
|
139
147
|
return this.client.streamRequest(
|
|
140
|
-
|
|
148
|
+
d,
|
|
141
149
|
{
|
|
142
150
|
method: "GET",
|
|
143
151
|
headers: {
|
|
144
|
-
Accept:
|
|
152
|
+
Accept: Lt(n, s),
|
|
145
153
|
"Accept-language": r
|
|
146
154
|
}
|
|
147
155
|
},
|
|
148
|
-
o
|
|
156
|
+
o,
|
|
157
|
+
c
|
|
149
158
|
);
|
|
150
159
|
}
|
|
151
160
|
}
|
|
152
|
-
const Qt = (t, e) => t.error || t.message || `${e.status} ${e.statusText}`, Ft = "application/json",
|
|
153
|
-
class
|
|
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
|
+
class Ce 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;
|
|
156
165
|
}
|
|
157
166
|
}
|
|
158
|
-
const
|
|
167
|
+
const at = 6048e5, Gt = 864e5, fe = 6e4, me = 36e5, Xt = 1e3, Le = /* @__PURE__ */ Symbol.for("constructDateFrom");
|
|
159
168
|
function E(t, e) {
|
|
160
|
-
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);
|
|
161
170
|
}
|
|
162
|
-
function
|
|
171
|
+
function p(t, e) {
|
|
163
172
|
return E(e || t, t);
|
|
164
173
|
}
|
|
165
|
-
function
|
|
166
|
-
const r =
|
|
174
|
+
function ot(t, e, n) {
|
|
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
|
-
let
|
|
170
|
-
function
|
|
171
|
-
return
|
|
178
|
+
let jt = {};
|
|
179
|
+
function $() {
|
|
180
|
+
return jt;
|
|
172
181
|
}
|
|
173
182
|
function _(t, e) {
|
|
174
|
-
const n =
|
|
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;
|
|
175
184
|
return s.setDate(s.getDate() - o), s.setHours(0, 0, 0, 0), s;
|
|
176
185
|
}
|
|
177
|
-
function
|
|
186
|
+
function S(t, e) {
|
|
178
187
|
return _(t, { ...e, weekStartsOn: 1 });
|
|
179
188
|
}
|
|
180
|
-
function
|
|
181
|
-
const n =
|
|
189
|
+
function it(t, e) {
|
|
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
|
-
const a =
|
|
192
|
+
const a = S(s), o = E(n, 0);
|
|
184
193
|
o.setFullYear(r, 0, 4), o.setHours(0, 0, 0, 0);
|
|
185
|
-
const i =
|
|
194
|
+
const i = S(o);
|
|
186
195
|
return n.getTime() >= a.getTime() ? r + 1 : n.getTime() >= i.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(),
|
|
@@ -199,40 +208,40 @@ function z(t) {
|
|
|
199
208
|
);
|
|
200
209
|
return n.setUTCFullYear(e.getFullYear()), +t - +n;
|
|
201
210
|
}
|
|
202
|
-
function
|
|
211
|
+
function zt(t, ...e) {
|
|
203
212
|
const n = E.bind(
|
|
204
213
|
null,
|
|
205
214
|
e.find((r) => typeof r == "object")
|
|
206
215
|
);
|
|
207
216
|
return e.map(n);
|
|
208
217
|
}
|
|
209
|
-
function
|
|
210
|
-
const n =
|
|
218
|
+
function Se(t, e) {
|
|
219
|
+
const n = p(t, e?.in);
|
|
211
220
|
return n.setHours(0, 0, 0, 0), n;
|
|
212
221
|
}
|
|
213
|
-
function
|
|
214
|
-
const [r, s] =
|
|
222
|
+
function Kt(t, e, n) {
|
|
223
|
+
const [r, s] = zt(
|
|
215
224
|
n?.in,
|
|
216
225
|
t,
|
|
217
226
|
e
|
|
218
|
-
), a =
|
|
219
|
-
return Math.round((i - c) /
|
|
227
|
+
), a = Se(r), o = Se(s), i = +a - J(a), c = +o - J(o);
|
|
228
|
+
return Math.round((i - c) / Gt);
|
|
220
229
|
}
|
|
221
|
-
function
|
|
222
|
-
const n =
|
|
223
|
-
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0),
|
|
230
|
+
function Jt(t, e) {
|
|
231
|
+
const n = it(t, e), r = E(t, 0);
|
|
232
|
+
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), S(r);
|
|
224
233
|
}
|
|
225
|
-
function
|
|
234
|
+
function Zt(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 !(!Zt(t) && typeof t != "number" || isNaN(+p(t)));
|
|
230
239
|
}
|
|
231
|
-
function
|
|
232
|
-
const n =
|
|
240
|
+
function en(t, e) {
|
|
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
|
-
const
|
|
244
|
+
const tn = {
|
|
236
245
|
lessThanXSeconds: {
|
|
237
246
|
one: "less than a second",
|
|
238
247
|
other: "less than {{count}} seconds"
|
|
@@ -294,9 +303,9 @@ const Zt = {
|
|
|
294
303
|
one: "almost 1 year",
|
|
295
304
|
other: "almost {{count}} years"
|
|
296
305
|
}
|
|
297
|
-
},
|
|
306
|
+
}, nn = (t, e, n) => {
|
|
298
307
|
let r;
|
|
299
|
-
const s =
|
|
308
|
+
const s = tn[t];
|
|
300
309
|
return typeof s == "string" ? r = s : e === 1 ? r = s.one : r = s.other.replace("{{count}}", e.toString()), n?.addSuffix ? n.comparison && n.comparison > 0 ? "in " + r : r + " ago" : r;
|
|
301
310
|
};
|
|
302
311
|
function te(t) {
|
|
@@ -305,43 +314,43 @@ function te(t) {
|
|
|
305
314
|
return t.formats[n] || t.formats[t.defaultWidth];
|
|
306
315
|
};
|
|
307
316
|
}
|
|
308
|
-
const
|
|
317
|
+
const rn = {
|
|
309
318
|
full: "EEEE, MMMM do, y",
|
|
310
319
|
long: "MMMM do, y",
|
|
311
320
|
medium: "MMM d, y",
|
|
312
321
|
short: "MM/dd/yyyy"
|
|
313
|
-
},
|
|
322
|
+
}, sn = {
|
|
314
323
|
full: "h:mm:ss a zzzz",
|
|
315
324
|
long: "h:mm:ss a z",
|
|
316
325
|
medium: "h:mm:ss a",
|
|
317
326
|
short: "h:mm a"
|
|
318
|
-
},
|
|
327
|
+
}, an = {
|
|
319
328
|
full: "{{date}} 'at' {{time}}",
|
|
320
329
|
long: "{{date}} 'at' {{time}}",
|
|
321
330
|
medium: "{{date}}, {{time}}",
|
|
322
331
|
short: "{{date}}, {{time}}"
|
|
323
|
-
},
|
|
332
|
+
}, on = {
|
|
324
333
|
date: te({
|
|
325
|
-
formats:
|
|
334
|
+
formats: rn,
|
|
326
335
|
defaultWidth: "full"
|
|
327
336
|
}),
|
|
328
337
|
time: te({
|
|
329
|
-
formats:
|
|
338
|
+
formats: sn,
|
|
330
339
|
defaultWidth: "full"
|
|
331
340
|
}),
|
|
332
341
|
dateTime: te({
|
|
333
|
-
formats:
|
|
342
|
+
formats: an,
|
|
334
343
|
defaultWidth: "full"
|
|
335
344
|
})
|
|
336
|
-
},
|
|
345
|
+
}, cn = {
|
|
337
346
|
lastWeek: "'last' eeee 'at' p",
|
|
338
347
|
yesterday: "'yesterday at' p",
|
|
339
348
|
today: "'today at' p",
|
|
340
349
|
tomorrow: "'tomorrow at' p",
|
|
341
350
|
nextWeek: "eeee 'at' p",
|
|
342
351
|
other: "P"
|
|
343
|
-
},
|
|
344
|
-
function
|
|
352
|
+
}, un = (t, e, n, r) => cn[t];
|
|
353
|
+
function U(t) {
|
|
345
354
|
return (e, n) => {
|
|
346
355
|
const r = n?.context ? String(n.context) : "standalone";
|
|
347
356
|
let s;
|
|
@@ -356,15 +365,15 @@ function q(t) {
|
|
|
356
365
|
return s[a];
|
|
357
366
|
};
|
|
358
367
|
}
|
|
359
|
-
const
|
|
368
|
+
const dn = {
|
|
360
369
|
narrow: ["B", "A"],
|
|
361
370
|
abbreviated: ["BC", "AD"],
|
|
362
371
|
wide: ["Before Christ", "Anno Domini"]
|
|
363
|
-
},
|
|
372
|
+
}, ln = {
|
|
364
373
|
narrow: ["1", "2", "3", "4"],
|
|
365
374
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
366
375
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
367
|
-
},
|
|
376
|
+
}, fn = {
|
|
368
377
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
369
378
|
abbreviated: [
|
|
370
379
|
"Jan",
|
|
@@ -394,7 +403,7 @@ const cn = {
|
|
|
394
403
|
"November",
|
|
395
404
|
"December"
|
|
396
405
|
]
|
|
397
|
-
},
|
|
406
|
+
}, mn = {
|
|
398
407
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
399
408
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
400
409
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
@@ -407,7 +416,7 @@ const cn = {
|
|
|
407
416
|
"Friday",
|
|
408
417
|
"Saturday"
|
|
409
418
|
]
|
|
410
|
-
},
|
|
419
|
+
}, hn = {
|
|
411
420
|
narrow: {
|
|
412
421
|
am: "a",
|
|
413
422
|
pm: "p",
|
|
@@ -438,7 +447,7 @@ const cn = {
|
|
|
438
447
|
evening: "evening",
|
|
439
448
|
night: "night"
|
|
440
449
|
}
|
|
441
|
-
},
|
|
450
|
+
}, gn = {
|
|
442
451
|
narrow: {
|
|
443
452
|
am: "a",
|
|
444
453
|
pm: "p",
|
|
@@ -469,7 +478,7 @@ const cn = {
|
|
|
469
478
|
evening: "in the evening",
|
|
470
479
|
night: "at night"
|
|
471
480
|
}
|
|
472
|
-
},
|
|
481
|
+
}, wn = (t, e) => {
|
|
473
482
|
const n = Number(t), r = n % 100;
|
|
474
483
|
if (r > 20 || r < 10)
|
|
475
484
|
switch (r % 10) {
|
|
@@ -481,40 +490,40 @@ const cn = {
|
|
|
481
490
|
return n + "rd";
|
|
482
491
|
}
|
|
483
492
|
return n + "th";
|
|
484
|
-
},
|
|
485
|
-
ordinalNumber:
|
|
486
|
-
era:
|
|
487
|
-
values:
|
|
493
|
+
}, yn = {
|
|
494
|
+
ordinalNumber: wn,
|
|
495
|
+
era: U({
|
|
496
|
+
values: dn,
|
|
488
497
|
defaultWidth: "wide"
|
|
489
498
|
}),
|
|
490
|
-
quarter:
|
|
491
|
-
values:
|
|
499
|
+
quarter: U({
|
|
500
|
+
values: ln,
|
|
492
501
|
defaultWidth: "wide",
|
|
493
502
|
argumentCallback: (t) => t - 1
|
|
494
503
|
}),
|
|
495
|
-
month:
|
|
496
|
-
values:
|
|
504
|
+
month: U({
|
|
505
|
+
values: fn,
|
|
497
506
|
defaultWidth: "wide"
|
|
498
507
|
}),
|
|
499
|
-
day:
|
|
500
|
-
values:
|
|
508
|
+
day: U({
|
|
509
|
+
values: mn,
|
|
501
510
|
defaultWidth: "wide"
|
|
502
511
|
}),
|
|
503
|
-
dayPeriod:
|
|
504
|
-
values:
|
|
512
|
+
dayPeriod: U({
|
|
513
|
+
values: hn,
|
|
505
514
|
defaultWidth: "wide",
|
|
506
|
-
formattingValues:
|
|
515
|
+
formattingValues: gn,
|
|
507
516
|
defaultFormattingWidth: "wide"
|
|
508
517
|
})
|
|
509
518
|
};
|
|
510
|
-
function
|
|
519
|
+
function H(t) {
|
|
511
520
|
return (e, n = {}) => {
|
|
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], i = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], c = Array.isArray(i) ?
|
|
524
|
+
const o = a[0], i = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], c = Array.isArray(i) ? bn(i, (l) => l.test(o)) : (
|
|
516
525
|
// [TODO] -- I challenge you to fix the type
|
|
517
|
-
|
|
526
|
+
pn(i, (l) => l.test(o))
|
|
518
527
|
);
|
|
519
528
|
let u;
|
|
520
529
|
u = t.valueCallback ? t.valueCallback(c) : c, u = n.valueCallback ? (
|
|
@@ -525,17 +534,17 @@ function Q(t) {
|
|
|
525
534
|
return { value: u, rest: d };
|
|
526
535
|
};
|
|
527
536
|
}
|
|
528
|
-
function
|
|
537
|
+
function pn(t, e) {
|
|
529
538
|
for (const n in t)
|
|
530
539
|
if (Object.prototype.hasOwnProperty.call(t, n) && e(t[n]))
|
|
531
540
|
return n;
|
|
532
541
|
}
|
|
533
|
-
function
|
|
542
|
+
function bn(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 Dn(t) {
|
|
539
548
|
return (e, n = {}) => {
|
|
540
549
|
const r = e.match(t.matchPattern);
|
|
541
550
|
if (!r) return null;
|
|
@@ -547,23 +556,23 @@ function yn(t) {
|
|
|
547
556
|
return { value: o, rest: i };
|
|
548
557
|
};
|
|
549
558
|
}
|
|
550
|
-
const
|
|
559
|
+
const Tn = /^(\d+)(th|st|nd|rd)?/i, En = /\d+/i, xn = {
|
|
551
560
|
narrow: /^(b|a)/i,
|
|
552
561
|
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
553
562
|
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
554
|
-
},
|
|
563
|
+
}, Pn = {
|
|
555
564
|
any: [/^b/i, /^(a|c)/i]
|
|
556
|
-
},
|
|
565
|
+
}, vn = {
|
|
557
566
|
narrow: /^[1234]/i,
|
|
558
567
|
abbreviated: /^q[1234]/i,
|
|
559
568
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
560
|
-
}, Pn = {
|
|
561
|
-
any: [/1/i, /2/i, /3/i, /4/i]
|
|
562
569
|
}, Mn = {
|
|
570
|
+
any: [/1/i, /2/i, /3/i, /4/i]
|
|
571
|
+
}, On = {
|
|
563
572
|
narrow: /^[jfmasond]/i,
|
|
564
573
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
565
574
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
566
|
-
},
|
|
575
|
+
}, An = {
|
|
567
576
|
narrow: [
|
|
568
577
|
/^j/i,
|
|
569
578
|
/^f/i,
|
|
@@ -592,18 +601,18 @@ const bn = /^(\d+)(th|st|nd|rd)?/i, Dn = /\d+/i, Tn = {
|
|
|
592
601
|
/^n/i,
|
|
593
602
|
/^d/i
|
|
594
603
|
]
|
|
595
|
-
},
|
|
604
|
+
}, Nn = {
|
|
596
605
|
narrow: /^[smtwf]/i,
|
|
597
606
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
598
607
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
599
608
|
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
600
|
-
},
|
|
609
|
+
}, kn = {
|
|
601
610
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
602
611
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
603
|
-
},
|
|
612
|
+
}, Rn = {
|
|
604
613
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
605
614
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
606
|
-
},
|
|
615
|
+
}, In = {
|
|
607
616
|
any: {
|
|
608
617
|
am: /^a/i,
|
|
609
618
|
pm: /^p/i,
|
|
@@ -614,97 +623,97 @@ const bn = /^(\d+)(th|st|nd|rd)?/i, Dn = /\d+/i, Tn = {
|
|
|
614
623
|
evening: /evening/i,
|
|
615
624
|
night: /night/i
|
|
616
625
|
}
|
|
617
|
-
},
|
|
618
|
-
ordinalNumber:
|
|
619
|
-
matchPattern:
|
|
620
|
-
parsePattern:
|
|
626
|
+
}, _n = {
|
|
627
|
+
ordinalNumber: Dn({
|
|
628
|
+
matchPattern: Tn,
|
|
629
|
+
parsePattern: En,
|
|
621
630
|
valueCallback: (t) => parseInt(t, 10)
|
|
622
631
|
}),
|
|
623
|
-
era:
|
|
624
|
-
matchPatterns:
|
|
632
|
+
era: H({
|
|
633
|
+
matchPatterns: xn,
|
|
625
634
|
defaultMatchWidth: "wide",
|
|
626
|
-
parsePatterns:
|
|
635
|
+
parsePatterns: Pn,
|
|
627
636
|
defaultParseWidth: "any"
|
|
628
637
|
}),
|
|
629
|
-
quarter:
|
|
630
|
-
matchPatterns:
|
|
638
|
+
quarter: H({
|
|
639
|
+
matchPatterns: vn,
|
|
631
640
|
defaultMatchWidth: "wide",
|
|
632
|
-
parsePatterns:
|
|
641
|
+
parsePatterns: Mn,
|
|
633
642
|
defaultParseWidth: "any",
|
|
634
643
|
valueCallback: (t) => t + 1
|
|
635
644
|
}),
|
|
636
|
-
month:
|
|
637
|
-
matchPatterns: Mn,
|
|
638
|
-
defaultMatchWidth: "wide",
|
|
639
|
-
parsePatterns: vn,
|
|
640
|
-
defaultParseWidth: "any"
|
|
641
|
-
}),
|
|
642
|
-
day: Q({
|
|
645
|
+
month: H({
|
|
643
646
|
matchPatterns: On,
|
|
644
647
|
defaultMatchWidth: "wide",
|
|
645
648
|
parsePatterns: An,
|
|
646
649
|
defaultParseWidth: "any"
|
|
647
650
|
}),
|
|
648
|
-
|
|
651
|
+
day: H({
|
|
649
652
|
matchPatterns: Nn,
|
|
650
|
-
defaultMatchWidth: "
|
|
653
|
+
defaultMatchWidth: "wide",
|
|
651
654
|
parsePatterns: kn,
|
|
652
655
|
defaultParseWidth: "any"
|
|
656
|
+
}),
|
|
657
|
+
dayPeriod: H({
|
|
658
|
+
matchPatterns: Rn,
|
|
659
|
+
defaultMatchWidth: "any",
|
|
660
|
+
parsePatterns: In,
|
|
661
|
+
defaultParseWidth: "any"
|
|
653
662
|
})
|
|
654
|
-
},
|
|
663
|
+
}, ct = {
|
|
655
664
|
code: "en-US",
|
|
656
|
-
formatDistance:
|
|
657
|
-
formatLong:
|
|
658
|
-
formatRelative:
|
|
659
|
-
localize:
|
|
660
|
-
match:
|
|
665
|
+
formatDistance: nn,
|
|
666
|
+
formatLong: on,
|
|
667
|
+
formatRelative: un,
|
|
668
|
+
localize: yn,
|
|
669
|
+
match: _n,
|
|
661
670
|
options: {
|
|
662
671
|
weekStartsOn: 0,
|
|
663
672
|
firstWeekContainsDate: 1
|
|
664
673
|
}
|
|
665
674
|
};
|
|
666
|
-
function
|
|
667
|
-
const n =
|
|
668
|
-
return
|
|
675
|
+
function Yn(t, e) {
|
|
676
|
+
const n = p(t, e?.in);
|
|
677
|
+
return Kt(n, en(n)) + 1;
|
|
669
678
|
}
|
|
670
|
-
function
|
|
671
|
-
const n =
|
|
672
|
-
return Math.round(r /
|
|
679
|
+
function ut(t, e) {
|
|
680
|
+
const n = p(t, e?.in), r = +S(n) - +Jt(n);
|
|
681
|
+
return Math.round(r / at) + 1;
|
|
673
682
|
}
|
|
674
|
-
function
|
|
675
|
-
const n =
|
|
683
|
+
function he(t, e) {
|
|
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);
|
|
676
685
|
o.setFullYear(r + 1, 0, a), o.setHours(0, 0, 0, 0);
|
|
677
686
|
const i = _(o, e), c = E(e?.in || t, 0);
|
|
678
687
|
c.setFullYear(r, 0, a), c.setHours(0, 0, 0, 0);
|
|
679
688
|
const u = _(c, e);
|
|
680
689
|
return +n >= +i ? r + 1 : +n >= +u ? r : r - 1;
|
|
681
690
|
}
|
|
682
|
-
function
|
|
683
|
-
const n =
|
|
691
|
+
function Cn(t, e) {
|
|
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);
|
|
684
693
|
return a.setFullYear(s, 0, r), a.setHours(0, 0, 0, 0), _(a, e);
|
|
685
694
|
}
|
|
686
|
-
function
|
|
687
|
-
const n =
|
|
688
|
-
return Math.round(r /
|
|
695
|
+
function dt(t, e) {
|
|
696
|
+
const n = p(t, e?.in), r = +_(n, e) - +Cn(n, e);
|
|
697
|
+
return Math.round(r / at) + 1;
|
|
689
698
|
}
|
|
690
|
-
function
|
|
699
|
+
function g(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;
|
|
698
|
-
return
|
|
707
|
+
return g(e === "yy" ? r % 100 : r, e.length);
|
|
699
708
|
},
|
|
700
709
|
// Month
|
|
701
710
|
M(t, e) {
|
|
702
711
|
const n = t.getMonth();
|
|
703
|
-
return e === "M" ? String(n + 1) :
|
|
712
|
+
return e === "M" ? String(n + 1) : g(n + 1, 2);
|
|
704
713
|
},
|
|
705
714
|
// Day of the month
|
|
706
715
|
d(t, e) {
|
|
707
|
-
return
|
|
716
|
+
return g(t.getDate(), e.length);
|
|
708
717
|
},
|
|
709
718
|
// AM or PM
|
|
710
719
|
a(t, e) {
|
|
@@ -723,35 +732,35 @@ const N = {
|
|
|
723
732
|
},
|
|
724
733
|
// Hour [1-12]
|
|
725
734
|
h(t, e) {
|
|
726
|
-
return
|
|
735
|
+
return g(t.getHours() % 12 || 12, e.length);
|
|
727
736
|
},
|
|
728
737
|
// Hour [0-23]
|
|
729
738
|
H(t, e) {
|
|
730
|
-
return
|
|
739
|
+
return g(t.getHours(), e.length);
|
|
731
740
|
},
|
|
732
741
|
// Minute
|
|
733
742
|
m(t, e) {
|
|
734
|
-
return
|
|
743
|
+
return g(t.getMinutes(), e.length);
|
|
735
744
|
},
|
|
736
745
|
// Second
|
|
737
746
|
s(t, e) {
|
|
738
|
-
return
|
|
747
|
+
return g(t.getSeconds(), e.length);
|
|
739
748
|
},
|
|
740
749
|
// Fraction of second
|
|
741
750
|
S(t, e) {
|
|
742
751
|
const n = e.length, r = t.getMilliseconds(), s = Math.trunc(
|
|
743
752
|
r * Math.pow(10, n - 3)
|
|
744
753
|
);
|
|
745
|
-
return
|
|
754
|
+
return g(s, e.length);
|
|
746
755
|
}
|
|
747
|
-
},
|
|
756
|
+
}, L = {
|
|
748
757
|
midnight: "midnight",
|
|
749
758
|
noon: "noon",
|
|
750
759
|
morning: "morning",
|
|
751
760
|
afternoon: "afternoon",
|
|
752
761
|
evening: "evening",
|
|
753
762
|
night: "night"
|
|
754
|
-
},
|
|
763
|
+
}, $e = {
|
|
755
764
|
// Era
|
|
756
765
|
G: function(t, e, n) {
|
|
757
766
|
const r = t.getFullYear() > 0 ? 1 : 0;
|
|
@@ -774,21 +783,21 @@ 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) {
|
|
781
|
-
const s =
|
|
790
|
+
const s = he(t, r), a = s > 0 ? s : 1 - s;
|
|
782
791
|
if (e === "YY") {
|
|
783
792
|
const o = a % 100;
|
|
784
|
-
return
|
|
793
|
+
return g(o, 2);
|
|
785
794
|
}
|
|
786
|
-
return e === "Yo" ? n.ordinalNumber(a, { unit: "year" }) :
|
|
795
|
+
return e === "Yo" ? n.ordinalNumber(a, { unit: "year" }) : g(a, e.length);
|
|
787
796
|
},
|
|
788
797
|
// ISO week-numbering year
|
|
789
798
|
R: function(t, e) {
|
|
790
|
-
const n =
|
|
791
|
-
return
|
|
799
|
+
const n = it(t);
|
|
800
|
+
return g(n, e.length);
|
|
792
801
|
},
|
|
793
802
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
794
803
|
// The main difference between `y` and `u` localizers are B.C. years:
|
|
@@ -801,7 +810,7 @@ const N = {
|
|
|
801
810
|
// while `uu` pads single digit years to 2 characters and returns other years unchanged.
|
|
802
811
|
u: function(t, e) {
|
|
803
812
|
const n = t.getFullYear();
|
|
804
|
-
return
|
|
813
|
+
return g(n, e.length);
|
|
805
814
|
},
|
|
806
815
|
// Quarter
|
|
807
816
|
Q: function(t, e, n) {
|
|
@@ -812,7 +821,7 @@ const N = {
|
|
|
812
821
|
return String(r);
|
|
813
822
|
// 01, 02, 03, 04
|
|
814
823
|
case "QQ":
|
|
815
|
-
return
|
|
824
|
+
return g(r, 2);
|
|
816
825
|
// 1st, 2nd, 3rd, 4th
|
|
817
826
|
case "Qo":
|
|
818
827
|
return n.ordinalNumber(r, { unit: "quarter" });
|
|
@@ -844,7 +853,7 @@ const N = {
|
|
|
844
853
|
return String(r);
|
|
845
854
|
// 01, 02, 03, 04
|
|
846
855
|
case "qq":
|
|
847
|
-
return
|
|
856
|
+
return g(r, 2);
|
|
848
857
|
// 1st, 2nd, 3rd, 4th
|
|
849
858
|
case "qo":
|
|
850
859
|
return n.ordinalNumber(r, { unit: "quarter" });
|
|
@@ -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" });
|
|
@@ -902,7 +911,7 @@ const N = {
|
|
|
902
911
|
return String(r + 1);
|
|
903
912
|
// 01, 02, ..., 12
|
|
904
913
|
case "LL":
|
|
905
|
-
return
|
|
914
|
+
return g(r + 1, 2);
|
|
906
915
|
// 1st, 2nd, ..., 12th
|
|
907
916
|
case "Lo":
|
|
908
917
|
return n.ordinalNumber(r + 1, { unit: "month" });
|
|
@@ -924,22 +933,22 @@ const N = {
|
|
|
924
933
|
},
|
|
925
934
|
// Local week of year
|
|
926
935
|
w: function(t, e, n, r) {
|
|
927
|
-
const s =
|
|
928
|
-
return e === "wo" ? n.ordinalNumber(s, { unit: "week" }) :
|
|
936
|
+
const s = dt(t, r);
|
|
937
|
+
return e === "wo" ? n.ordinalNumber(s, { unit: "week" }) : g(s, e.length);
|
|
929
938
|
},
|
|
930
939
|
// ISO week of year
|
|
931
940
|
I: function(t, e, n) {
|
|
932
|
-
const r =
|
|
933
|
-
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) :
|
|
941
|
+
const r = ut(t);
|
|
942
|
+
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) : g(r, e.length);
|
|
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) {
|
|
941
|
-
const r =
|
|
942
|
-
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) :
|
|
950
|
+
const r = Yn(t);
|
|
951
|
+
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : g(r, e.length);
|
|
943
952
|
},
|
|
944
953
|
// Day of week
|
|
945
954
|
E: function(t, e, n) {
|
|
@@ -981,7 +990,7 @@ const N = {
|
|
|
981
990
|
return String(a);
|
|
982
991
|
// Padded numerical value
|
|
983
992
|
case "ee":
|
|
984
|
-
return
|
|
993
|
+
return g(a, 2);
|
|
985
994
|
// 1st, 2nd, ..., 7th
|
|
986
995
|
case "eo":
|
|
987
996
|
return n.ordinalNumber(a, { unit: "day" });
|
|
@@ -1018,7 +1027,7 @@ const N = {
|
|
|
1018
1027
|
return String(a);
|
|
1019
1028
|
// Padded numerical value
|
|
1020
1029
|
case "cc":
|
|
1021
|
-
return
|
|
1030
|
+
return g(a, e.length);
|
|
1022
1031
|
// 1st, 2nd, ..., 7th
|
|
1023
1032
|
case "co":
|
|
1024
1033
|
return n.ordinalNumber(a, { unit: "day" });
|
|
@@ -1055,7 +1064,7 @@ const N = {
|
|
|
1055
1064
|
return String(s);
|
|
1056
1065
|
// 02
|
|
1057
1066
|
case "ii":
|
|
1058
|
-
return
|
|
1067
|
+
return g(s, e.length);
|
|
1059
1068
|
// 2nd
|
|
1060
1069
|
case "io":
|
|
1061
1070
|
return n.ordinalNumber(s, { unit: "day" });
|
|
@@ -1115,7 +1124,7 @@ const N = {
|
|
|
1115
1124
|
b: function(t, e, n) {
|
|
1116
1125
|
const r = t.getHours();
|
|
1117
1126
|
let s;
|
|
1118
|
-
switch (r === 12 ? s =
|
|
1127
|
+
switch (r === 12 ? s = L.noon : r === 0 ? s = L.midnight : s = r / 12 >= 1 ? "pm" : "am", e) {
|
|
1119
1128
|
case "b":
|
|
1120
1129
|
case "bb":
|
|
1121
1130
|
return n.dayPeriod(s, {
|
|
@@ -1143,7 +1152,7 @@ const N = {
|
|
|
1143
1152
|
B: function(t, e, n) {
|
|
1144
1153
|
const r = t.getHours();
|
|
1145
1154
|
let s;
|
|
1146
|
-
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) {
|
|
1147
1156
|
case "B":
|
|
1148
1157
|
case "BB":
|
|
1149
1158
|
case "BBB":
|
|
@@ -1169,33 +1178,33 @@ 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) {
|
|
1180
1189
|
const r = t.getHours() % 12;
|
|
1181
|
-
return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) :
|
|
1190
|
+
return e === "Ko" ? n.ordinalNumber(r, { unit: "hour" }) : g(r, e.length);
|
|
1182
1191
|
},
|
|
1183
1192
|
// Hour [1-24]
|
|
1184
1193
|
k: function(t, e, n) {
|
|
1185
1194
|
let r = t.getHours();
|
|
1186
|
-
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);
|
|
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) {
|
|
@@ -1205,16 +1214,16 @@ const N = {
|
|
|
1205
1214
|
switch (e) {
|
|
1206
1215
|
// Hours and optional minutes
|
|
1207
1216
|
case "X":
|
|
1208
|
-
return
|
|
1217
|
+
return qe(r);
|
|
1209
1218
|
// Hours, minutes and optional seconds without `:` delimiter
|
|
1210
1219
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
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)
|
|
@@ -1223,16 +1232,16 @@ const N = {
|
|
|
1223
1232
|
switch (e) {
|
|
1224
1233
|
// Hours and optional minutes
|
|
1225
1234
|
case "x":
|
|
1226
|
-
return
|
|
1235
|
+
return qe(r);
|
|
1227
1236
|
// Hours, minutes and optional seconds without `:` delimiter
|
|
1228
1237
|
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
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)
|
|
@@ -1243,9 +1252,9 @@ const N = {
|
|
|
1243
1252
|
case "O":
|
|
1244
1253
|
case "OO":
|
|
1245
1254
|
case "OOO":
|
|
1246
|
-
return "GMT" +
|
|
1255
|
+
return "GMT" + We(r, ":");
|
|
1247
1256
|
default:
|
|
1248
|
-
return "GMT" +
|
|
1257
|
+
return "GMT" + Y(r, ":");
|
|
1249
1258
|
}
|
|
1250
1259
|
},
|
|
1251
1260
|
// Timezone (specific non-location)
|
|
@@ -1256,33 +1265,33 @@ const N = {
|
|
|
1256
1265
|
case "z":
|
|
1257
1266
|
case "zz":
|
|
1258
1267
|
case "zzz":
|
|
1259
|
-
return "GMT" +
|
|
1268
|
+
return "GMT" + We(r, ":");
|
|
1260
1269
|
default:
|
|
1261
|
-
return "GMT" +
|
|
1270
|
+
return "GMT" + Y(r, ":");
|
|
1262
1271
|
}
|
|
1263
1272
|
},
|
|
1264
1273
|
// Seconds timestamp
|
|
1265
1274
|
t: function(t, e, n) {
|
|
1266
1275
|
const r = Math.trunc(+t / 1e3);
|
|
1267
|
-
return
|
|
1276
|
+
return g(r, e.length);
|
|
1268
1277
|
},
|
|
1269
1278
|
// Milliseconds timestamp
|
|
1270
1279
|
T: function(t, e, n) {
|
|
1271
|
-
return
|
|
1280
|
+
return g(+t, e.length);
|
|
1272
1281
|
}
|
|
1273
1282
|
};
|
|
1274
|
-
function
|
|
1283
|
+
function We(t, e = "") {
|
|
1275
1284
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), s = Math.trunc(r / 60), a = r % 60;
|
|
1276
|
-
return a === 0 ? n + String(s) : n + String(s) + e +
|
|
1285
|
+
return a === 0 ? n + String(s) : n + String(s) + e + g(a, 2);
|
|
1277
1286
|
}
|
|
1278
|
-
function
|
|
1279
|
-
return t % 60 === 0 ? (t > 0 ? "-" : "+") +
|
|
1287
|
+
function qe(t, e) {
|
|
1288
|
+
return t % 60 === 0 ? (t > 0 ? "-" : "+") + g(Math.abs(t) / 60, 2) : Y(t, e);
|
|
1280
1289
|
}
|
|
1281
|
-
function
|
|
1282
|
-
const n = t > 0 ? "-" : "+", r = Math.abs(t), s =
|
|
1290
|
+
function Y(t, e = "") {
|
|
1291
|
+
const n = t > 0 ? "-" : "+", r = Math.abs(t), s = g(Math.trunc(r / 60), 2), a = g(r % 60, 2);
|
|
1283
1292
|
return n + s + e + a;
|
|
1284
1293
|
}
|
|
1285
|
-
const
|
|
1294
|
+
const Ue = (t, e) => {
|
|
1286
1295
|
switch (t) {
|
|
1287
1296
|
case "P":
|
|
1288
1297
|
return e.date({ width: "short" });
|
|
@@ -1293,7 +1302,7 @@ const $e = (t, e) => {
|
|
|
1293
1302
|
default:
|
|
1294
1303
|
return e.date({ width: "full" });
|
|
1295
1304
|
}
|
|
1296
|
-
},
|
|
1305
|
+
}, lt = (t, e) => {
|
|
1297
1306
|
switch (t) {
|
|
1298
1307
|
case "p":
|
|
1299
1308
|
return e.time({ width: "short" });
|
|
@@ -1304,10 +1313,10 @@ const $e = (t, e) => {
|
|
|
1304
1313
|
default:
|
|
1305
1314
|
return e.time({ width: "full" });
|
|
1306
1315
|
}
|
|
1307
|
-
},
|
|
1316
|
+
}, Ln = (t, e) => {
|
|
1308
1317
|
const n = t.match(/(P+)(p+)?/) || [], r = n[1], s = n[2];
|
|
1309
1318
|
if (!s)
|
|
1310
|
-
return
|
|
1319
|
+
return Ue(t, e);
|
|
1311
1320
|
let a;
|
|
1312
1321
|
switch (r) {
|
|
1313
1322
|
case "P":
|
|
@@ -1323,46 +1332,46 @@ const $e = (t, e) => {
|
|
|
1323
1332
|
a = e.dateTime({ width: "full" });
|
|
1324
1333
|
break;
|
|
1325
1334
|
}
|
|
1326
|
-
return a.replace("{{date}}",
|
|
1335
|
+
return a.replace("{{date}}", Ue(r, e)).replace("{{time}}", lt(s, e));
|
|
1327
1336
|
}, se = {
|
|
1328
|
-
p:
|
|
1329
|
-
P:
|
|
1330
|
-
},
|
|
1331
|
-
function
|
|
1332
|
-
return
|
|
1337
|
+
p: lt,
|
|
1338
|
+
P: Ln
|
|
1339
|
+
}, Sn = /^D+$/, $n = /^Y+$/, Wn = ["D", "DD", "YY", "YYYY"];
|
|
1340
|
+
function ft(t) {
|
|
1341
|
+
return Sn.test(t);
|
|
1333
1342
|
}
|
|
1334
|
-
function
|
|
1335
|
-
return
|
|
1343
|
+
function mt(t) {
|
|
1344
|
+
return $n.test(t);
|
|
1336
1345
|
}
|
|
1337
1346
|
function ae(t, e, n) {
|
|
1338
|
-
const r =
|
|
1339
|
-
if (console.warn(r),
|
|
1347
|
+
const r = qn(t, e, n);
|
|
1348
|
+
if (console.warn(r), Wn.includes(t)) throw new RangeError(r);
|
|
1340
1349
|
}
|
|
1341
|
-
function
|
|
1350
|
+
function qn(t, e, n) {
|
|
1342
1351
|
const r = t[0] === "Y" ? "years" : "days of the month";
|
|
1343
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`;
|
|
1344
1353
|
}
|
|
1345
|
-
const
|
|
1346
|
-
function
|
|
1347
|
-
const r =
|
|
1354
|
+
const Un = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Hn = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Qn = /^'([^]*?)'?$/, Fn = /''/g, Bn = /[a-zA-Z]/;
|
|
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, i = p(t, n?.in);
|
|
1348
1357
|
if (!re(i))
|
|
1349
1358
|
throw new RangeError("Invalid time value");
|
|
1350
|
-
let c = e.match(
|
|
1359
|
+
let c = e.match(Hn).map((d) => {
|
|
1351
1360
|
const l = d[0];
|
|
1352
1361
|
if (l === "p" || l === "P") {
|
|
1353
|
-
const
|
|
1354
|
-
return
|
|
1362
|
+
const m = se[l];
|
|
1363
|
+
return m(d, s.formatLong);
|
|
1355
1364
|
}
|
|
1356
1365
|
return d;
|
|
1357
|
-
}).join("").match(
|
|
1366
|
+
}).join("").match(Un).map((d) => {
|
|
1358
1367
|
if (d === "''")
|
|
1359
1368
|
return { isToken: !1, value: "'" };
|
|
1360
1369
|
const l = d[0];
|
|
1361
1370
|
if (l === "'")
|
|
1362
|
-
return { isToken: !1, value:
|
|
1363
|
-
if (
|
|
1371
|
+
return { isToken: !1, value: Gn(d) };
|
|
1372
|
+
if ($e[l])
|
|
1364
1373
|
return { isToken: !0, value: d };
|
|
1365
|
-
if (l.match(
|
|
1374
|
+
if (l.match(Bn))
|
|
1366
1375
|
throw new RangeError(
|
|
1367
1376
|
"Format string contains an unescaped latin alphabet character `" + l + "`"
|
|
1368
1377
|
);
|
|
@@ -1377,24 +1386,24 @@ function Un(t, e, n) {
|
|
|
1377
1386
|
return c.map((d) => {
|
|
1378
1387
|
if (!d.isToken) return d.value;
|
|
1379
1388
|
const l = d.value;
|
|
1380
|
-
(
|
|
1381
|
-
const
|
|
1382
|
-
return
|
|
1389
|
+
(mt(l) || ft(l)) && ae(l, e, String(t));
|
|
1390
|
+
const m = $e[l[0]];
|
|
1391
|
+
return m(i, l, s.localize, u);
|
|
1383
1392
|
}).join("");
|
|
1384
1393
|
}
|
|
1385
|
-
function
|
|
1394
|
+
function Gn(t) {
|
|
1386
1395
|
const e = t.match(Qn);
|
|
1387
1396
|
return e ? e[1].replace(Fn, "'") : t;
|
|
1388
1397
|
}
|
|
1389
|
-
function
|
|
1390
|
-
return Object.assign({},
|
|
1398
|
+
function Xn() {
|
|
1399
|
+
return Object.assign({}, $());
|
|
1391
1400
|
}
|
|
1392
|
-
function
|
|
1393
|
-
const n =
|
|
1401
|
+
function jn(t, e) {
|
|
1402
|
+
const n = p(t, e?.in).getDay();
|
|
1394
1403
|
return n === 0 ? 7 : n;
|
|
1395
1404
|
}
|
|
1396
|
-
function
|
|
1397
|
-
const n =
|
|
1405
|
+
function zn(t, e) {
|
|
1406
|
+
const n = Kn(e) ? new e(0) : E(e, 0);
|
|
1398
1407
|
return n.setFullYear(t.getFullYear(), t.getMonth(), t.getDate()), n.setHours(
|
|
1399
1408
|
t.getHours(),
|
|
1400
1409
|
t.getMinutes(),
|
|
@@ -1402,17 +1411,17 @@ function Xn(t, e) {
|
|
|
1402
1411
|
t.getMilliseconds()
|
|
1403
1412
|
), n;
|
|
1404
1413
|
}
|
|
1405
|
-
function
|
|
1414
|
+
function Kn(t) {
|
|
1406
1415
|
return typeof t == "function" && t.prototype?.constructor === t;
|
|
1407
1416
|
}
|
|
1408
|
-
const
|
|
1409
|
-
class
|
|
1417
|
+
const Jn = 10;
|
|
1418
|
+
class ht {
|
|
1410
1419
|
subPriority = 0;
|
|
1411
1420
|
validate(e, n) {
|
|
1412
1421
|
return !0;
|
|
1413
1422
|
}
|
|
1414
1423
|
}
|
|
1415
|
-
class
|
|
1424
|
+
class Zn extends ht {
|
|
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
|
}
|
|
@@ -1423,21 +1432,21 @@ class zn extends lt {
|
|
|
1423
1432
|
return this.setValue(e, n, this.value, r);
|
|
1424
1433
|
}
|
|
1425
1434
|
}
|
|
1426
|
-
class
|
|
1427
|
-
priority =
|
|
1435
|
+
class er extends ht {
|
|
1436
|
+
priority = Jn;
|
|
1428
1437
|
subPriority = -1;
|
|
1429
1438
|
constructor(e, n) {
|
|
1430
1439
|
super(), this.context = e || ((r) => E(n, r));
|
|
1431
1440
|
}
|
|
1432
1441
|
set(e, n) {
|
|
1433
|
-
return n.timestampIsSet ? e : E(e,
|
|
1442
|
+
return n.timestampIsSet ? e : E(e, zn(e, this.context));
|
|
1434
1443
|
}
|
|
1435
1444
|
}
|
|
1436
|
-
class
|
|
1445
|
+
class h {
|
|
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 Zn(
|
|
1441
1450
|
a.value,
|
|
1442
1451
|
this.validate,
|
|
1443
1452
|
this.set,
|
|
@@ -1451,7 +1460,7 @@ class m {
|
|
|
1451
1460
|
return !0;
|
|
1452
1461
|
}
|
|
1453
1462
|
}
|
|
1454
|
-
class
|
|
1463
|
+
class tr extends h {
|
|
1455
1464
|
priority = 140;
|
|
1456
1465
|
parse(e, n, r) {
|
|
1457
1466
|
switch (n) {
|
|
@@ -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),
|
|
@@ -1541,42 +1550,42 @@ function A(t, e) {
|
|
|
1541
1550
|
};
|
|
1542
1551
|
const r = n[1] === "+" ? 1 : -1, s = n[2] ? parseInt(n[2], 10) : 0, a = n[3] ? parseInt(n[3], 10) : 0, o = n[5] ? parseInt(n[5], 10) : 0;
|
|
1543
1552
|
return {
|
|
1544
|
-
value: r * (s *
|
|
1553
|
+
value: r * (s * me + a * fe + o * Xt),
|
|
1545
1554
|
rest: e.slice(n[0].length)
|
|
1546
1555
|
};
|
|
1547
1556
|
}
|
|
1548
|
-
function
|
|
1549
|
-
return
|
|
1557
|
+
function gt(t) {
|
|
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
|
-
function
|
|
1588
|
+
function ge(t) {
|
|
1580
1589
|
switch (t) {
|
|
1581
1590
|
case "morning":
|
|
1582
1591
|
return 4;
|
|
@@ -1590,7 +1599,7 @@ function me(t) {
|
|
|
1590
1599
|
return 0;
|
|
1591
1600
|
}
|
|
1592
1601
|
}
|
|
1593
|
-
function
|
|
1602
|
+
function wt(t, e) {
|
|
1594
1603
|
const n = e > 0, r = n ? e : 1 - e;
|
|
1595
1604
|
let s;
|
|
1596
1605
|
if (r <= 50)
|
|
@@ -1601,10 +1610,10 @@ function mt(t, e) {
|
|
|
1601
1610
|
}
|
|
1602
1611
|
return n ? s : 1 - s;
|
|
1603
1612
|
}
|
|
1604
|
-
function
|
|
1613
|
+
function yt(t) {
|
|
1605
1614
|
return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
|
|
1606
1615
|
}
|
|
1607
|
-
class
|
|
1616
|
+
class nr extends h {
|
|
1608
1617
|
priority = 130;
|
|
1609
1618
|
incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"];
|
|
1610
1619
|
parse(e, n, r) {
|
|
@@ -1632,7 +1641,7 @@ class er extends m {
|
|
|
1632
1641
|
set(e, n, r) {
|
|
1633
1642
|
const s = e.getFullYear();
|
|
1634
1643
|
if (r.isTwoDigitYear) {
|
|
1635
|
-
const o =
|
|
1644
|
+
const o = wt(
|
|
1636
1645
|
r.year,
|
|
1637
1646
|
s
|
|
1638
1647
|
);
|
|
@@ -1642,7 +1651,7 @@ class er extends m {
|
|
|
1642
1651
|
return e.setFullYear(a, 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
1643
1652
|
}
|
|
1644
1653
|
}
|
|
1645
|
-
class
|
|
1654
|
+
class rr extends h {
|
|
1646
1655
|
priority = 130;
|
|
1647
1656
|
parse(e, n, r) {
|
|
1648
1657
|
const s = (a) => ({
|
|
@@ -1667,9 +1676,9 @@ class tr extends m {
|
|
|
1667
1676
|
return n.isTwoDigitYear || n.year > 0;
|
|
1668
1677
|
}
|
|
1669
1678
|
set(e, n, r, s) {
|
|
1670
|
-
const a =
|
|
1679
|
+
const a = he(e, s);
|
|
1671
1680
|
if (r.isTwoDigitYear) {
|
|
1672
|
-
const i =
|
|
1681
|
+
const i = wt(
|
|
1673
1682
|
r.year,
|
|
1674
1683
|
a
|
|
1675
1684
|
);
|
|
@@ -1698,14 +1707,14 @@ class tr extends m {
|
|
|
1698
1707
|
"T"
|
|
1699
1708
|
];
|
|
1700
1709
|
}
|
|
1701
|
-
class
|
|
1710
|
+
class sr extends h {
|
|
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);
|
|
1708
|
-
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);
|
|
1709
1718
|
}
|
|
1710
1719
|
incompatibleTokens = [
|
|
1711
1720
|
"G",
|
|
@@ -1725,17 +1734,17 @@ class nr extends m {
|
|
|
1725
1734
|
"T"
|
|
1726
1735
|
];
|
|
1727
1736
|
}
|
|
1728
|
-
class
|
|
1737
|
+
class ar extends h {
|
|
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;
|
|
1735
1744
|
}
|
|
1736
1745
|
incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"];
|
|
1737
1746
|
}
|
|
1738
|
-
class
|
|
1747
|
+
class or extends h {
|
|
1739
1748
|
priority = 120;
|
|
1740
1749
|
parse(e, n, r) {
|
|
1741
1750
|
switch (n) {
|
|
@@ -1797,7 +1806,7 @@ class sr extends m {
|
|
|
1797
1806
|
"T"
|
|
1798
1807
|
];
|
|
1799
1808
|
}
|
|
1800
|
-
class
|
|
1809
|
+
class ir extends h {
|
|
1801
1810
|
priority = 120;
|
|
1802
1811
|
parse(e, n, r) {
|
|
1803
1812
|
switch (n) {
|
|
@@ -1859,7 +1868,7 @@ class ar extends m {
|
|
|
1859
1868
|
"T"
|
|
1860
1869
|
];
|
|
1861
1870
|
}
|
|
1862
|
-
class
|
|
1871
|
+
class cr extends h {
|
|
1863
1872
|
incompatibleTokens = [
|
|
1864
1873
|
"Y",
|
|
1865
1874
|
"R",
|
|
@@ -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
|
|
@@ -1922,7 +1931,7 @@ class or extends m {
|
|
|
1922
1931
|
return e.setMonth(r, 1), e.setHours(0, 0, 0, 0), e;
|
|
1923
1932
|
}
|
|
1924
1933
|
}
|
|
1925
|
-
class
|
|
1934
|
+
class ur extends h {
|
|
1926
1935
|
priority = 110;
|
|
1927
1936
|
parse(e, n, r) {
|
|
1928
1937
|
const s = (a) => a - 1;
|
|
@@ -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
|
|
@@ -1985,16 +1994,16 @@ class ir extends m {
|
|
|
1985
1994
|
"T"
|
|
1986
1995
|
];
|
|
1987
1996
|
}
|
|
1988
|
-
function
|
|
1989
|
-
const r =
|
|
1990
|
-
return r.setDate(r.getDate() - s * 7),
|
|
1997
|
+
function dr(t, e, n) {
|
|
1998
|
+
const r = p(t, n?.in), s = dt(r, n) - e;
|
|
1999
|
+
return r.setDate(r.getDate() - s * 7), p(r, n?.in);
|
|
1991
2000
|
}
|
|
1992
|
-
class
|
|
2001
|
+
class lr extends h {
|
|
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 _(dr(e, r, s), s);
|
|
2009
2018
|
}
|
|
2010
2019
|
incompatibleTokens = [
|
|
2011
2020
|
"y",
|
|
@@ -2023,16 +2032,16 @@ class ur extends m {
|
|
|
2023
2032
|
"T"
|
|
2024
2033
|
];
|
|
2025
2034
|
}
|
|
2026
|
-
function
|
|
2027
|
-
const r =
|
|
2035
|
+
function fr(t, e, n) {
|
|
2036
|
+
const r = p(t, n?.in), s = ut(r, n) - e;
|
|
2028
2037
|
return r.setDate(r.getDate() - s * 7), r;
|
|
2029
2038
|
}
|
|
2030
|
-
class
|
|
2039
|
+
class mr extends h {
|
|
2031
2040
|
priority = 100;
|
|
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:
|
|
@@ -2043,7 +2052,7 @@ class lr extends m {
|
|
|
2043
2052
|
return n >= 1 && n <= 53;
|
|
2044
2053
|
}
|
|
2045
2054
|
set(e, n, r) {
|
|
2046
|
-
return
|
|
2055
|
+
return S(fr(e, r));
|
|
2047
2056
|
}
|
|
2048
2057
|
incompatibleTokens = [
|
|
2049
2058
|
"y",
|
|
@@ -2062,7 +2071,7 @@ class lr extends m {
|
|
|
2062
2071
|
"T"
|
|
2063
2072
|
];
|
|
2064
2073
|
}
|
|
2065
|
-
const
|
|
2074
|
+
const hr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], gr = [
|
|
2066
2075
|
31,
|
|
2067
2076
|
29,
|
|
2068
2077
|
31,
|
|
@@ -2076,13 +2085,13 @@ const fr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], mr = [
|
|
|
2076
2085
|
30,
|
|
2077
2086
|
31
|
|
2078
2087
|
];
|
|
2079
|
-
class
|
|
2088
|
+
class wr extends h {
|
|
2080
2089
|
priority = 90;
|
|
2081
2090
|
subPriority = 1;
|
|
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:
|
|
@@ -2090,8 +2099,8 @@ class hr extends m {
|
|
|
2090
2099
|
}
|
|
2091
2100
|
}
|
|
2092
2101
|
validate(e, n) {
|
|
2093
|
-
const r = e.getFullYear(), s =
|
|
2094
|
-
return s ? n >= 1 && n <=
|
|
2102
|
+
const r = e.getFullYear(), s = yt(r), a = e.getMonth();
|
|
2103
|
+
return s ? n >= 1 && n <= gr[a] : n >= 1 && n <= hr[a];
|
|
2095
2104
|
}
|
|
2096
2105
|
set(e, n, r) {
|
|
2097
2106
|
return e.setDate(r), e.setHours(0, 0, 0, 0), e;
|
|
@@ -2111,14 +2120,14 @@ class hr extends m {
|
|
|
2111
2120
|
"T"
|
|
2112
2121
|
];
|
|
2113
2122
|
}
|
|
2114
|
-
class
|
|
2123
|
+
class yr extends h {
|
|
2115
2124
|
priority = 90;
|
|
2116
2125
|
subpriority = 1;
|
|
2117
2126
|
parse(e, n, r) {
|
|
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:
|
|
@@ -2127,7 +2136,7 @@ class wr extends m {
|
|
|
2127
2136
|
}
|
|
2128
2137
|
validate(e, n) {
|
|
2129
2138
|
const r = e.getFullYear();
|
|
2130
|
-
return
|
|
2139
|
+
return yt(r) ? n >= 1 && n <= 366 : n >= 1 && n <= 365;
|
|
2131
2140
|
}
|
|
2132
2141
|
set(e, n, r) {
|
|
2133
2142
|
return e.setMonth(0, r), e.setHours(0, 0, 0, 0), e;
|
|
@@ -2150,11 +2159,11 @@ class wr extends m {
|
|
|
2150
2159
|
"T"
|
|
2151
2160
|
];
|
|
2152
2161
|
}
|
|
2153
|
-
function
|
|
2154
|
-
const r =
|
|
2155
|
-
return
|
|
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(), c = (e % 7 + 7) % 7, u = 7 - s, d = e < 0 || e > 6 ? e - (o + u) % 7 : (c + u) % 7 - (o + u) % 7;
|
|
2164
|
+
return ot(a, d, n);
|
|
2156
2165
|
}
|
|
2157
|
-
class
|
|
2166
|
+
class pr extends h {
|
|
2158
2167
|
priority = 90;
|
|
2159
2168
|
parse(e, n, r) {
|
|
2160
2169
|
switch (n) {
|
|
@@ -2186,11 +2195,11 @@ class gr extends m {
|
|
|
2186
2195
|
return n >= 0 && n <= 6;
|
|
2187
2196
|
}
|
|
2188
2197
|
set(e, n, r, s) {
|
|
2189
|
-
return e =
|
|
2198
|
+
return e = we(e, r, s), e.setHours(0, 0, 0, 0), e;
|
|
2190
2199
|
}
|
|
2191
2200
|
incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
|
|
2192
2201
|
}
|
|
2193
|
-
class
|
|
2202
|
+
class br extends h {
|
|
2194
2203
|
priority = 90;
|
|
2195
2204
|
parse(e, n, r, s) {
|
|
2196
2205
|
const a = (o) => {
|
|
@@ -2236,7 +2245,7 @@ class pr extends m {
|
|
|
2236
2245
|
return n >= 0 && n <= 6;
|
|
2237
2246
|
}
|
|
2238
2247
|
set(e, n, r, s) {
|
|
2239
|
-
return e =
|
|
2248
|
+
return e = we(e, r, s), e.setHours(0, 0, 0, 0), e;
|
|
2240
2249
|
}
|
|
2241
2250
|
incompatibleTokens = [
|
|
2242
2251
|
"y",
|
|
@@ -2256,7 +2265,7 @@ class pr extends m {
|
|
|
2256
2265
|
"T"
|
|
2257
2266
|
];
|
|
2258
2267
|
}
|
|
2259
|
-
class
|
|
2268
|
+
class Dr extends h {
|
|
2260
2269
|
priority = 90;
|
|
2261
2270
|
parse(e, n, r, s) {
|
|
2262
2271
|
const a = (o) => {
|
|
@@ -2302,7 +2311,7 @@ class yr extends m {
|
|
|
2302
2311
|
return n >= 0 && n <= 6;
|
|
2303
2312
|
}
|
|
2304
2313
|
set(e, n, r, s) {
|
|
2305
|
-
return e =
|
|
2314
|
+
return e = we(e, r, s), e.setHours(0, 0, 0, 0), e;
|
|
2306
2315
|
}
|
|
2307
2316
|
incompatibleTokens = [
|
|
2308
2317
|
"y",
|
|
@@ -2322,11 +2331,11 @@ class yr extends m {
|
|
|
2322
2331
|
"T"
|
|
2323
2332
|
];
|
|
2324
2333
|
}
|
|
2325
|
-
function
|
|
2326
|
-
const r =
|
|
2327
|
-
return
|
|
2334
|
+
function Tr(t, e, n) {
|
|
2335
|
+
const r = p(t, n?.in), s = jn(r, n), a = e - s;
|
|
2336
|
+
return ot(r, a, n);
|
|
2328
2337
|
}
|
|
2329
|
-
class
|
|
2338
|
+
class Er extends h {
|
|
2330
2339
|
priority = 90;
|
|
2331
2340
|
parse(e, n, r) {
|
|
2332
2341
|
const s = (a) => a === 0 ? 7 : a;
|
|
@@ -2397,7 +2406,7 @@ class Dr extends m {
|
|
|
2397
2406
|
return n >= 1 && n <= 7;
|
|
2398
2407
|
}
|
|
2399
2408
|
set(e, n, r) {
|
|
2400
|
-
return e =
|
|
2409
|
+
return e = Tr(e, r), e.setHours(0, 0, 0, 0), e;
|
|
2401
2410
|
}
|
|
2402
2411
|
incompatibleTokens = [
|
|
2403
2412
|
"y",
|
|
@@ -2417,7 +2426,7 @@ class Dr extends m {
|
|
|
2417
2426
|
"T"
|
|
2418
2427
|
];
|
|
2419
2428
|
}
|
|
2420
|
-
class
|
|
2429
|
+
class xr extends h {
|
|
2421
2430
|
priority = 80;
|
|
2422
2431
|
parse(e, n, r) {
|
|
2423
2432
|
switch (n) {
|
|
@@ -2450,11 +2459,11 @@ class Tr extends m {
|
|
|
2450
2459
|
}
|
|
2451
2460
|
}
|
|
2452
2461
|
set(e, n, r) {
|
|
2453
|
-
return e.setHours(
|
|
2462
|
+
return e.setHours(ge(r), 0, 0, 0), e;
|
|
2454
2463
|
}
|
|
2455
2464
|
incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
|
|
2456
2465
|
}
|
|
2457
|
-
class
|
|
2466
|
+
class Pr extends h {
|
|
2458
2467
|
priority = 80;
|
|
2459
2468
|
parse(e, n, r) {
|
|
2460
2469
|
switch (n) {
|
|
@@ -2487,11 +2496,11 @@ class Er extends m {
|
|
|
2487
2496
|
}
|
|
2488
2497
|
}
|
|
2489
2498
|
set(e, n, r) {
|
|
2490
|
-
return e.setHours(
|
|
2499
|
+
return e.setHours(ge(r), 0, 0, 0), e;
|
|
2491
2500
|
}
|
|
2492
2501
|
incompatibleTokens = ["a", "B", "H", "k", "t", "T"];
|
|
2493
2502
|
}
|
|
2494
|
-
class
|
|
2503
|
+
class vr extends h {
|
|
2495
2504
|
priority = 80;
|
|
2496
2505
|
parse(e, n, r) {
|
|
2497
2506
|
switch (n) {
|
|
@@ -2524,16 +2533,16 @@ class xr extends m {
|
|
|
2524
2533
|
}
|
|
2525
2534
|
}
|
|
2526
2535
|
set(e, n, r) {
|
|
2527
|
-
return e.setHours(
|
|
2536
|
+
return e.setHours(ge(r), 0, 0, 0), e;
|
|
2528
2537
|
}
|
|
2529
2538
|
incompatibleTokens = ["a", "b", "t", "T"];
|
|
2530
2539
|
}
|
|
2531
|
-
class
|
|
2540
|
+
class Mr extends h {
|
|
2532
2541
|
priority = 70;
|
|
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:
|
|
@@ -2549,12 +2558,12 @@ class Pr extends m {
|
|
|
2549
2558
|
}
|
|
2550
2559
|
incompatibleTokens = ["H", "K", "k", "t", "T"];
|
|
2551
2560
|
}
|
|
2552
|
-
class
|
|
2561
|
+
class Or extends h {
|
|
2553
2562
|
priority = 70;
|
|
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:
|
|
@@ -2569,12 +2578,12 @@ class Mr extends m {
|
|
|
2569
2578
|
}
|
|
2570
2579
|
incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"];
|
|
2571
2580
|
}
|
|
2572
|
-
class
|
|
2581
|
+
class Ar extends h {
|
|
2573
2582
|
priority = 70;
|
|
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:
|
|
@@ -2589,12 +2598,12 @@ class vr extends m {
|
|
|
2589
2598
|
}
|
|
2590
2599
|
incompatibleTokens = ["h", "H", "k", "t", "T"];
|
|
2591
2600
|
}
|
|
2592
|
-
class
|
|
2601
|
+
class Nr extends h {
|
|
2593
2602
|
priority = 70;
|
|
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:
|
|
@@ -2610,12 +2619,12 @@ class Or extends m {
|
|
|
2610
2619
|
}
|
|
2611
2620
|
incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
|
|
2612
2621
|
}
|
|
2613
|
-
class
|
|
2622
|
+
class kr extends h {
|
|
2614
2623
|
priority = 60;
|
|
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:
|
|
@@ -2630,12 +2639,12 @@ class Ar extends m {
|
|
|
2630
2639
|
}
|
|
2631
2640
|
incompatibleTokens = ["t", "T"];
|
|
2632
2641
|
}
|
|
2633
|
-
class
|
|
2642
|
+
class Rr extends h {
|
|
2634
2643
|
priority = 50;
|
|
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:
|
|
@@ -2650,7 +2659,7 @@ class Nr extends m {
|
|
|
2650
2659
|
}
|
|
2651
2660
|
incompatibleTokens = ["t", "T"];
|
|
2652
2661
|
}
|
|
2653
|
-
class
|
|
2662
|
+
class Ir extends h {
|
|
2654
2663
|
priority = 30;
|
|
2655
2664
|
parse(e, n) {
|
|
2656
2665
|
const r = (s) => Math.trunc(s * Math.pow(10, -n.length + 3));
|
|
@@ -2661,7 +2670,7 @@ class kr extends m {
|
|
|
2661
2670
|
}
|
|
2662
2671
|
incompatibleTokens = ["t", "T"];
|
|
2663
2672
|
}
|
|
2664
|
-
class
|
|
2673
|
+
class _r extends h {
|
|
2665
2674
|
priority = 10;
|
|
2666
2675
|
parse(e, n) {
|
|
2667
2676
|
switch (n) {
|
|
@@ -2689,12 +2698,12 @@ 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"];
|
|
2696
2705
|
}
|
|
2697
|
-
class
|
|
2706
|
+
class Yr extends h {
|
|
2698
2707
|
priority = 10;
|
|
2699
2708
|
parse(e, n) {
|
|
2700
2709
|
switch (n) {
|
|
@@ -2722,99 +2731,99 @@ 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"];
|
|
2729
2738
|
}
|
|
2730
|
-
class
|
|
2739
|
+
class Cr extends h {
|
|
2731
2740
|
priority = 40;
|
|
2732
2741
|
parse(e) {
|
|
2733
|
-
return
|
|
2742
|
+
return gt(e);
|
|
2734
2743
|
}
|
|
2735
2744
|
set(e, n, r) {
|
|
2736
2745
|
return [E(e, r * 1e3), { timestampIsSet: !0 }];
|
|
2737
2746
|
}
|
|
2738
2747
|
incompatibleTokens = "*";
|
|
2739
2748
|
}
|
|
2740
|
-
class
|
|
2749
|
+
class Lr extends h {
|
|
2741
2750
|
priority = 20;
|
|
2742
2751
|
parse(e) {
|
|
2743
|
-
return
|
|
2752
|
+
return gt(e);
|
|
2744
2753
|
}
|
|
2745
2754
|
set(e, n, r) {
|
|
2746
2755
|
return [E(e, r), { timestampIsSet: !0 }];
|
|
2747
2756
|
}
|
|
2748
2757
|
incompatibleTokens = "*";
|
|
2749
2758
|
}
|
|
2750
|
-
const
|
|
2751
|
-
G: new
|
|
2752
|
-
y: new
|
|
2753
|
-
Y: new
|
|
2754
|
-
R: new
|
|
2755
|
-
u: new
|
|
2756
|
-
Q: new
|
|
2757
|
-
q: new
|
|
2758
|
-
M: new
|
|
2759
|
-
L: new
|
|
2760
|
-
w: new
|
|
2761
|
-
I: new
|
|
2762
|
-
d: new
|
|
2763
|
-
D: new
|
|
2764
|
-
E: new
|
|
2765
|
-
e: new
|
|
2766
|
-
c: new
|
|
2767
|
-
i: new
|
|
2768
|
-
a: new
|
|
2769
|
-
b: new
|
|
2770
|
-
B: new
|
|
2771
|
-
h: new
|
|
2772
|
-
H: new
|
|
2773
|
-
K: new
|
|
2774
|
-
k: new
|
|
2775
|
-
m: new
|
|
2776
|
-
s: new
|
|
2777
|
-
S: new
|
|
2778
|
-
X: new
|
|
2779
|
-
x: new
|
|
2780
|
-
t: new
|
|
2781
|
-
T: new
|
|
2782
|
-
},
|
|
2759
|
+
const Sr = {
|
|
2760
|
+
G: new tr(),
|
|
2761
|
+
y: new nr(),
|
|
2762
|
+
Y: new rr(),
|
|
2763
|
+
R: new sr(),
|
|
2764
|
+
u: new ar(),
|
|
2765
|
+
Q: new or(),
|
|
2766
|
+
q: new ir(),
|
|
2767
|
+
M: new cr(),
|
|
2768
|
+
L: new ur(),
|
|
2769
|
+
w: new lr(),
|
|
2770
|
+
I: new mr(),
|
|
2771
|
+
d: new wr(),
|
|
2772
|
+
D: new yr(),
|
|
2773
|
+
E: new pr(),
|
|
2774
|
+
e: new br(),
|
|
2775
|
+
c: new Dr(),
|
|
2776
|
+
i: new Er(),
|
|
2777
|
+
a: new xr(),
|
|
2778
|
+
b: new Pr(),
|
|
2779
|
+
B: new vr(),
|
|
2780
|
+
h: new Mr(),
|
|
2781
|
+
H: new Or(),
|
|
2782
|
+
K: new Ar(),
|
|
2783
|
+
k: new Nr(),
|
|
2784
|
+
m: new kr(),
|
|
2785
|
+
s: new Rr(),
|
|
2786
|
+
S: new Ir(),
|
|
2787
|
+
X: new _r(),
|
|
2788
|
+
x: new Yr(),
|
|
2789
|
+
t: new Cr(),
|
|
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]/;
|
|
2783
2792
|
function Fr(t, e, n, r) {
|
|
2784
|
-
const s = () => E(n, NaN), a =
|
|
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;
|
|
2785
2794
|
if (!e)
|
|
2786
|
-
return t ? s() :
|
|
2795
|
+
return t ? s() : p(n, r?.in);
|
|
2787
2796
|
const u = {
|
|
2788
2797
|
firstWeekContainsDate: i,
|
|
2789
2798
|
weekStartsOn: c,
|
|
2790
2799
|
locale: o
|
|
2791
|
-
}, d = [new
|
|
2800
|
+
}, d = [new er(r?.in, n)], l = e.match(Wr).map((f) => {
|
|
2792
2801
|
const w = f[0];
|
|
2793
2802
|
if (w in se) {
|
|
2794
|
-
const
|
|
2795
|
-
return
|
|
2803
|
+
const v = se[w];
|
|
2804
|
+
return v(f, o.formatLong);
|
|
2796
2805
|
}
|
|
2797
2806
|
return f;
|
|
2798
|
-
}).join("").match(
|
|
2807
|
+
}).join("").match($r), m = [];
|
|
2799
2808
|
for (let f of l) {
|
|
2800
|
-
|
|
2801
|
-
const w = f[0],
|
|
2802
|
-
if (
|
|
2803
|
-
const { incompatibleTokens:
|
|
2804
|
-
if (Array.isArray(
|
|
2805
|
-
const
|
|
2806
|
-
(
|
|
2809
|
+
mt(f) && ae(f, e, t), ft(f) && ae(f, e, t);
|
|
2810
|
+
const w = f[0], v = Sr[w];
|
|
2811
|
+
if (v) {
|
|
2812
|
+
const { incompatibleTokens: M } = v;
|
|
2813
|
+
if (Array.isArray(M)) {
|
|
2814
|
+
const q = m.find(
|
|
2815
|
+
(F) => M.includes(F.token) || F.token === w
|
|
2807
2816
|
);
|
|
2808
|
-
if (
|
|
2817
|
+
if (q)
|
|
2809
2818
|
throw new RangeError(
|
|
2810
|
-
`The format string mustn't contain \`${
|
|
2819
|
+
`The format string mustn't contain \`${q.fullToken}\` and \`${f}\` at the same time`
|
|
2811
2820
|
);
|
|
2812
|
-
} else if (
|
|
2821
|
+
} else if (v.incompatibleTokens === "*" && m.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
|
-
|
|
2817
|
-
const W =
|
|
2825
|
+
m.push({ token: w, fullToken: f });
|
|
2826
|
+
const W = v.run(
|
|
2818
2827
|
t,
|
|
2819
2828
|
f,
|
|
2820
2829
|
o.match,
|
|
@@ -2828,47 +2837,47 @@ function Fr(t, e, n, r) {
|
|
|
2828
2837
|
throw new RangeError(
|
|
2829
2838
|
"Format string contains an unescaped latin alphabet character `" + w + "`"
|
|
2830
2839
|
);
|
|
2831
|
-
if (f === "''" ? f = "'" : w === "'" && (f =
|
|
2840
|
+
if (f === "''" ? f = "'" : w === "'" && (f = Br(f)), t.indexOf(f) === 0)
|
|
2832
2841
|
t = t.slice(f.length);
|
|
2833
2842
|
else
|
|
2834
2843
|
return s();
|
|
2835
2844
|
}
|
|
2836
2845
|
}
|
|
2837
|
-
if (t.length > 0 &&
|
|
2846
|
+
if (t.length > 0 && Hr.test(t))
|
|
2838
2847
|
return s();
|
|
2839
|
-
const x = d.map((f) => f.priority).sort((f, w) => w - f).filter((f, w,
|
|
2840
|
-
(f) => d.filter((w) => w.priority === f).sort((w,
|
|
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)
|
|
2841
2850
|
).map((f) => f[0]);
|
|
2842
|
-
let P =
|
|
2851
|
+
let P = p(n, r?.in);
|
|
2843
2852
|
if (isNaN(+P)) return s();
|
|
2844
|
-
const
|
|
2853
|
+
const N = {};
|
|
2845
2854
|
for (const f of x) {
|
|
2846
2855
|
if (!f.validate(P, u))
|
|
2847
2856
|
return s();
|
|
2848
|
-
const w = f.set(P,
|
|
2849
|
-
Array.isArray(w) ? (P = w[0], Object.assign(
|
|
2857
|
+
const w = f.set(P, N, u);
|
|
2858
|
+
Array.isArray(w) ? (P = w[0], Object.assign(N, w[1])) : P = w;
|
|
2850
2859
|
}
|
|
2851
2860
|
return P;
|
|
2852
2861
|
}
|
|
2853
|
-
function
|
|
2854
|
-
return t.match(
|
|
2862
|
+
function Br(t) {
|
|
2863
|
+
return t.match(qr)[1].replace(Ur, "'");
|
|
2855
2864
|
}
|
|
2856
|
-
function
|
|
2857
|
-
const n = () => E(e?.in, NaN), s =
|
|
2865
|
+
function Vr(t, e) {
|
|
2866
|
+
const n = () => E(e?.in, NaN), s = zr(t);
|
|
2858
2867
|
let a;
|
|
2859
2868
|
if (s.date) {
|
|
2860
|
-
const u =
|
|
2861
|
-
a =
|
|
2869
|
+
const u = Kr(s.date, 2);
|
|
2870
|
+
a = Jr(u.restDateString, u.year);
|
|
2862
2871
|
}
|
|
2863
2872
|
if (!a || isNaN(+a)) return n();
|
|
2864
2873
|
const o = +a;
|
|
2865
2874
|
let i = 0, c;
|
|
2866
|
-
if (s.time && (i =
|
|
2875
|
+
if (s.time && (i = Zr(s.time), isNaN(i)))
|
|
2867
2876
|
return n();
|
|
2868
2877
|
if (s.timezone) {
|
|
2869
|
-
if (c =
|
|
2878
|
+
if (c = es(s.timezone), isNaN(c)) return n();
|
|
2870
2879
|
} else {
|
|
2871
|
-
const u = new Date(o + i), d =
|
|
2880
|
+
const u = new Date(o + i), d = p(0, e?.in);
|
|
2872
2881
|
return d.setFullYear(
|
|
2873
2882
|
u.getUTCFullYear(),
|
|
2874
2883
|
u.getUTCMonth(),
|
|
@@ -2880,28 +2889,28 @@ function Ur(t, e) {
|
|
|
2880
2889
|
u.getUTCMilliseconds()
|
|
2881
2890
|
), d;
|
|
2882
2891
|
}
|
|
2883
|
-
return
|
|
2892
|
+
return p(o + i + c, e?.in);
|
|
2884
2893
|
}
|
|
2885
|
-
const
|
|
2894
|
+
const V = {
|
|
2886
2895
|
dateTimeDelimiter: /[T ]/,
|
|
2887
2896
|
timeZoneDelimiter: /[Z ]/i,
|
|
2888
2897
|
timezone: /([Z+-].*)$/
|
|
2889
|
-
},
|
|
2890
|
-
function
|
|
2891
|
-
const e = {}, n = t.split(
|
|
2898
|
+
}, Gr = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/, Xr = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/, jr = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
2899
|
+
function zr(t) {
|
|
2900
|
+
const e = {}, n = t.split(V.dateTimeDelimiter);
|
|
2892
2901
|
let r;
|
|
2893
2902
|
if (n.length > 2)
|
|
2894
2903
|
return e;
|
|
2895
|
-
if (/:/.test(n[0]) ? r = n[0] : (e.date = n[0], r = n[1],
|
|
2904
|
+
if (/:/.test(n[0]) ? r = n[0] : (e.date = n[0], r = n[1], V.timeZoneDelimiter.test(e.date) && (e.date = t.split(V.timeZoneDelimiter)[0], r = t.substr(
|
|
2896
2905
|
e.date.length,
|
|
2897
2906
|
t.length
|
|
2898
2907
|
))), r) {
|
|
2899
|
-
const s =
|
|
2908
|
+
const s = V.timezone.exec(r);
|
|
2900
2909
|
s ? (e.time = r.replace(s[1], ""), e.timezone = s[1]) : e.time = r;
|
|
2901
2910
|
}
|
|
2902
2911
|
return e;
|
|
2903
2912
|
}
|
|
2904
|
-
function
|
|
2913
|
+
function Kr(t, e) {
|
|
2905
2914
|
const n = new RegExp(
|
|
2906
2915
|
"^(?:(\\d{4}|[+-]\\d{" + (4 + e) + "})|(\\d{2}|[+-]\\d{" + (2 + e) + "})$)"
|
|
2907
2916
|
), r = t.match(n);
|
|
@@ -2912,84 +2921,84 @@ function jr(t, e) {
|
|
|
2912
2921
|
restDateString: t.slice((r[1] || r[2]).length)
|
|
2913
2922
|
};
|
|
2914
2923
|
}
|
|
2915
|
-
function
|
|
2924
|
+
function Jr(t, e) {
|
|
2916
2925
|
if (e === null) return /* @__PURE__ */ new Date(NaN);
|
|
2917
|
-
const n = t.match(
|
|
2926
|
+
const n = t.match(Gr);
|
|
2918
2927
|
if (!n) return /* @__PURE__ */ new Date(NaN);
|
|
2919
|
-
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;
|
|
2920
2929
|
if (r)
|
|
2921
|
-
return
|
|
2930
|
+
return as(e, i, c) ? ts(e, i, c) : /* @__PURE__ */ new Date(NaN);
|
|
2922
2931
|
{
|
|
2923
2932
|
const u = /* @__PURE__ */ new Date(0);
|
|
2924
|
-
return !
|
|
2933
|
+
return !rs(e, a, o) || !ss(e, s) ? /* @__PURE__ */ new Date(NaN) : (u.setUTCFullYear(e, a, Math.max(s, o)), u);
|
|
2925
2934
|
}
|
|
2926
2935
|
}
|
|
2927
|
-
function
|
|
2936
|
+
function Q(t) {
|
|
2928
2937
|
return t ? parseInt(t) : 1;
|
|
2929
2938
|
}
|
|
2930
|
-
function
|
|
2931
|
-
const e = t.match(
|
|
2939
|
+
function Zr(t) {
|
|
2940
|
+
const e = t.match(Xr);
|
|
2932
2941
|
if (!e) return NaN;
|
|
2933
2942
|
const n = ne(e[1]), r = ne(e[2]), s = ne(e[3]);
|
|
2934
|
-
return
|
|
2943
|
+
return os(n, r, s) ? n * me + r * fe + s * 1e3 : NaN;
|
|
2935
2944
|
}
|
|
2936
2945
|
function ne(t) {
|
|
2937
2946
|
return t && parseFloat(t.replace(",", ".")) || 0;
|
|
2938
2947
|
}
|
|
2939
|
-
function
|
|
2948
|
+
function es(t) {
|
|
2940
2949
|
if (t === "Z") return 0;
|
|
2941
|
-
const e = t.match(
|
|
2950
|
+
const e = t.match(jr);
|
|
2942
2951
|
if (!e) return 0;
|
|
2943
2952
|
const n = e[1] === "+" ? -1 : 1, r = parseInt(e[2]), s = e[3] && parseInt(e[3]) || 0;
|
|
2944
|
-
return
|
|
2953
|
+
return is(r, s) ? n * (r * me + s * fe) : NaN;
|
|
2945
2954
|
}
|
|
2946
|
-
function
|
|
2955
|
+
function ts(t, e, n) {
|
|
2947
2956
|
const r = /* @__PURE__ */ new Date(0);
|
|
2948
2957
|
r.setUTCFullYear(t, 0, 4);
|
|
2949
2958
|
const s = r.getUTCDay() || 7, a = (e - 1) * 7 + n + 1 - s;
|
|
2950
2959
|
return r.setUTCDate(r.getUTCDate() + a), r;
|
|
2951
2960
|
}
|
|
2952
|
-
const
|
|
2953
|
-
function
|
|
2961
|
+
const ns = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
2962
|
+
function pt(t) {
|
|
2954
2963
|
return t % 400 === 0 || t % 4 === 0 && t % 100 !== 0;
|
|
2955
2964
|
}
|
|
2956
|
-
function
|
|
2957
|
-
return e >= 0 && e <= 11 && n >= 1 && n <= (
|
|
2965
|
+
function rs(t, e, n) {
|
|
2966
|
+
return e >= 0 && e <= 11 && n >= 1 && n <= (ns[e] || (pt(t) ? 29 : 28));
|
|
2958
2967
|
}
|
|
2959
|
-
function
|
|
2960
|
-
return e >= 1 && e <= (
|
|
2968
|
+
function ss(t, e) {
|
|
2969
|
+
return e >= 1 && e <= (pt(t) ? 366 : 365);
|
|
2961
2970
|
}
|
|
2962
|
-
function
|
|
2971
|
+
function as(t, e, n) {
|
|
2963
2972
|
return e >= 1 && e <= 53 && n >= 0 && n <= 6;
|
|
2964
2973
|
}
|
|
2965
|
-
function
|
|
2974
|
+
function os(t, e, n) {
|
|
2966
2975
|
return t === 24 ? e === 0 && n === 0 : n >= 0 && n < 60 && e >= 0 && e < 60 && t >= 0 && t < 25;
|
|
2967
2976
|
}
|
|
2968
|
-
function
|
|
2977
|
+
function is(t, e) {
|
|
2969
2978
|
return e >= 0 && e <= 59;
|
|
2970
2979
|
}
|
|
2971
|
-
const
|
|
2980
|
+
const G = (t) => {
|
|
2972
2981
|
if (!t.includes("T")) {
|
|
2973
|
-
for (const n of
|
|
2982
|
+
for (const n of cs) {
|
|
2974
2983
|
const r = Fr(t, n, /* @__PURE__ */ new Date());
|
|
2975
2984
|
if (re(r))
|
|
2976
2985
|
return r;
|
|
2977
2986
|
}
|
|
2978
2987
|
return null;
|
|
2979
2988
|
}
|
|
2980
|
-
const e =
|
|
2989
|
+
const e = Vr(t);
|
|
2981
2990
|
return re(e) ? e : null;
|
|
2982
|
-
},
|
|
2991
|
+
}, cs = ["yyyy-MM-dd", "MM-dd-yyyy"], oe = (t, e, n) => {
|
|
2983
2992
|
const r = {};
|
|
2984
|
-
return e?.contentType !== null && (r[
|
|
2985
|
-
},
|
|
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
|
+
}, us = (t) => {
|
|
2986
2995
|
const e = { ...t };
|
|
2987
|
-
return e[
|
|
2988
|
-
},
|
|
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
|
+
}, He = async (t, e, n) => await fetch(t, {
|
|
2989
2998
|
method: n.method || "GET",
|
|
2990
2999
|
headers: e,
|
|
2991
3000
|
body: n.body ? JSON.stringify(n.body) : void 0
|
|
2992
|
-
}),
|
|
3001
|
+
}), ds = async (t, e, n) => {
|
|
2993
3002
|
const r = n?.body === void 0 ? void 0 : n?.isFormData ? n.body : JSON.stringify(n.body);
|
|
2994
3003
|
return await fetch(t, {
|
|
2995
3004
|
method: n.method,
|
|
@@ -2998,7 +3007,7 @@ const V = (t) => {
|
|
|
2998
3007
|
signal: n?.signal
|
|
2999
3008
|
});
|
|
3000
3009
|
};
|
|
3001
|
-
class
|
|
3010
|
+
class ls {
|
|
3002
3011
|
constructor() {
|
|
3003
3012
|
this.decoder = new TextDecoder();
|
|
3004
3013
|
}
|
|
@@ -3019,7 +3028,7 @@ class us {
|
|
|
3019
3028
|
async initializeStreamRequest(e, n, r, s) {
|
|
3020
3029
|
const a = oe(void 0, {
|
|
3021
3030
|
jwt: s
|
|
3022
|
-
}), o = await
|
|
3031
|
+
}), o = await ds(
|
|
3023
3032
|
e,
|
|
3024
3033
|
{
|
|
3025
3034
|
Accept: "text/event-stream",
|
|
@@ -3039,13 +3048,13 @@ class us {
|
|
|
3039
3048
|
} catch {
|
|
3040
3049
|
c.error = "Failed to parse error body";
|
|
3041
3050
|
}
|
|
3042
|
-
throw new
|
|
3051
|
+
throw new Ce({
|
|
3043
3052
|
status: o.status,
|
|
3044
3053
|
message: c.error ?? "No response body"
|
|
3045
3054
|
});
|
|
3046
3055
|
}
|
|
3047
3056
|
if (!o.body)
|
|
3048
|
-
throw new
|
|
3057
|
+
throw new Ce({
|
|
3049
3058
|
message: "No response body",
|
|
3050
3059
|
status: o.status
|
|
3051
3060
|
});
|
|
@@ -3094,103 +3103,113 @@ class us {
|
|
|
3094
3103
|
}
|
|
3095
3104
|
}
|
|
3096
3105
|
}
|
|
3097
|
-
new
|
|
3098
|
-
class
|
|
3106
|
+
new ls();
|
|
3107
|
+
class Qa {
|
|
3099
3108
|
constructor(e) {
|
|
3100
3109
|
this.config = e, console.info("SdmxApiClient initialized", {
|
|
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), i = new ReadableStream({
|
|
3131
|
+
async start(u) {
|
|
3120
3132
|
try {
|
|
3121
|
-
const
|
|
3122
|
-
if (!
|
|
3123
|
-
const
|
|
3133
|
+
const d = await He(a, o, n);
|
|
3134
|
+
if (!d.ok) {
|
|
3135
|
+
const P = 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: ${P}`
|
|
3138
|
+
), new Error(`Fetch failed with status ${d.status}`);
|
|
3127
3139
|
}
|
|
3128
|
-
const
|
|
3129
|
-
if (!
|
|
3130
|
-
const
|
|
3131
|
-
|
|
3132
|
-
const
|
|
3133
|
-
const { done:
|
|
3134
|
-
|
|
3140
|
+
const l = d.body?.getReader();
|
|
3141
|
+
if (!l) throw new Error("Failed to create stream reader");
|
|
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());
|
|
3135
3147
|
};
|
|
3136
|
-
|
|
3137
|
-
} catch (
|
|
3138
|
-
|
|
3148
|
+
x();
|
|
3149
|
+
} catch (d) {
|
|
3150
|
+
u.error(d);
|
|
3139
3151
|
}
|
|
3140
3152
|
}
|
|
3141
|
-
}),
|
|
3153
|
+
}), c = 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(i, { headers: c });
|
|
3157
|
+
}
|
|
3158
|
+
async request(e, n, r, s) {
|
|
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);
|
|
3154
3161
|
try {
|
|
3155
|
-
const
|
|
3156
|
-
let
|
|
3157
|
-
const
|
|
3162
|
+
const c = await He(o, i, n), u = Date.now() - a;
|
|
3163
|
+
let d;
|
|
3164
|
+
const l = await c.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
|
-
i,
|
|
3165
3171
|
c,
|
|
3166
|
-
|
|
3167
|
-
|
|
3172
|
+
u,
|
|
3173
|
+
l
|
|
3174
|
+
), !c.ok)
|
|
3168
3175
|
throw new Error(
|
|
3169
|
-
`API request failed: ${
|
|
3176
|
+
`API request failed: ${c.status} ${c.statusText} - ${l.substring(0, 100)}`
|
|
3170
3177
|
);
|
|
3171
|
-
|
|
3178
|
+
d = { data: l };
|
|
3172
3179
|
}
|
|
3173
|
-
if (!
|
|
3174
|
-
this.addErrorRequestLog(
|
|
3175
|
-
const
|
|
3176
|
-
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}`);
|
|
3177
3184
|
}
|
|
3178
|
-
return
|
|
3179
|
-
} catch (
|
|
3180
|
-
const
|
|
3185
|
+
return d;
|
|
3186
|
+
} catch (c) {
|
|
3187
|
+
const u = Date.now() - a;
|
|
3181
3188
|
throw console.error("API Request Exception", {
|
|
3182
3189
|
method: n.method,
|
|
3183
|
-
url:
|
|
3184
|
-
duration: `${
|
|
3185
|
-
error:
|
|
3186
|
-
}),
|
|
3190
|
+
url: o,
|
|
3191
|
+
duration: `${u}ms`,
|
|
3192
|
+
error: c instanceof Error ? c.message : String(c)
|
|
3193
|
+
}), c;
|
|
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",
|
|
3192
3211
|
url: n,
|
|
3193
|
-
headers:
|
|
3212
|
+
headers: us(s)
|
|
3194
3213
|
};
|
|
3195
3214
|
r.body && (a.body = r.body), console.info(e, a);
|
|
3196
3215
|
}
|
|
@@ -3216,12 +3235,197 @@ class $a {
|
|
|
3216
3235
|
});
|
|
3217
3236
|
}
|
|
3218
3237
|
}
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3238
|
+
var ye = /* @__PURE__ */ ((t) => (t.LAST_UPDATE_AT = "lastUpdatedAt", t.SERIES_COUNT = "series_count", t))(ye || {});
|
|
3239
|
+
function Fa(t) {
|
|
3240
|
+
return t?.annotations?.find((e) => {
|
|
3241
|
+
if (e.id === ye.LAST_UPDATE_AT)
|
|
3242
|
+
return e;
|
|
3243
|
+
})?.value;
|
|
3244
|
+
}
|
|
3245
|
+
const pe = (t, e) => t?.names && t?.names[e] || t?.name, bt = (t, e, n) => {
|
|
3246
|
+
if (!(!t || e?.has(t?.id)) && (e?.set(t?.id, t), t?.parent)) {
|
|
3247
|
+
const r = n?.get(t?.parent);
|
|
3248
|
+
bt(r, e, n);
|
|
3249
|
+
}
|
|
3250
|
+
}, fs = (t, e) => {
|
|
3251
|
+
const n = /* @__PURE__ */ new Map(), r = new Map(t?.map((s) => [s.id, s]));
|
|
3252
|
+
return e?.forEach((s) => {
|
|
3253
|
+
bt(s, n, r);
|
|
3254
|
+
}), Array.from(n?.values());
|
|
3255
|
+
};
|
|
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
|
+
const e = t?.find(
|
|
3259
|
+
(a) => a.id === ys
|
|
3260
|
+
), n = t?.find(
|
|
3261
|
+
(a) => a.id === ps
|
|
3262
|
+
), r = n?.title ? new Date(n?.title) : null;
|
|
3263
|
+
return {
|
|
3264
|
+
startPeriod: e?.title ? new Date(e?.title) : null,
|
|
3265
|
+
endPeriod: r
|
|
3266
|
+
};
|
|
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, i) => [o, i]);
|
|
3269
|
+
r.sort(
|
|
3270
|
+
(o, i) => bs(o[0], i[0])
|
|
3271
|
+
);
|
|
3272
|
+
const s = [...e];
|
|
3273
|
+
s.sort(Ds);
|
|
3274
|
+
let a = 0;
|
|
3275
|
+
for (const o of r) {
|
|
3276
|
+
const i = o[0];
|
|
3277
|
+
for (; a < s.length && s[a].memberValue.localeCompare(i.id) < 0; )
|
|
3278
|
+
a += 1;
|
|
3279
|
+
a < s.length && s[a].memberValue === i.id && (n[o[1]] = o[0]);
|
|
3280
|
+
}
|
|
3281
|
+
return n.filter((o) => o != null);
|
|
3282
|
+
}, Es = (t) => !!t?.some((e) => e.parent), Ga = (t, e, n, r, s = []) => {
|
|
3283
|
+
let a = t || [];
|
|
3284
|
+
if (xs(n || [], e || "")) {
|
|
3285
|
+
const o = (n || [])[0].cubeRegions?.find(
|
|
3286
|
+
({ isIncluded: i }) => i
|
|
3287
|
+
);
|
|
3288
|
+
if (o) {
|
|
3289
|
+
const i = o.memberSelection?.find(
|
|
3290
|
+
({ componentId: c }) => c === e
|
|
3291
|
+
);
|
|
3292
|
+
i ? a = a.length === 0 ? (i.selectionValues || []).map(({ memberValue: c }) => ({
|
|
3293
|
+
id: c,
|
|
3294
|
+
name: c
|
|
3295
|
+
})) : Ts(a, i.selectionValues) : a = [];
|
|
3296
|
+
}
|
|
3297
|
+
} else s.length !== 0 && (a = a.filter(({ id: o }) => s.includes(o)));
|
|
3298
|
+
return Es(t) && (a = fs(t, a)), a?.map((o) => ({
|
|
3299
|
+
...o,
|
|
3300
|
+
name: r ? pe(o, r) : o?.name
|
|
3301
|
+
}));
|
|
3302
|
+
}, xs = (t, e) => t != null && t.length > 0 && e != null, Ps = (t) => {
|
|
3303
|
+
const e = [];
|
|
3304
|
+
return t?.filters?.forEach((n) => {
|
|
3305
|
+
n.componentCode !== ws && e.push({
|
|
3306
|
+
componentCode: n.componentCode,
|
|
3307
|
+
operator: R.EQUALS,
|
|
3308
|
+
value: n.values.join(",")
|
|
3309
|
+
});
|
|
3310
|
+
}), e;
|
|
3311
|
+
}, Xa = (t) => {
|
|
3312
|
+
const e = /* @__PURE__ */ new Map();
|
|
3313
|
+
return t?.forEach((n) => {
|
|
3314
|
+
e.set(n.urn, Ps(n));
|
|
3315
|
+
}), e;
|
|
3316
|
+
}, vs = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Qe = (t) => {
|
|
3317
|
+
if (typeof t != "string")
|
|
3318
|
+
throw new TypeError("Invalid argument expected string");
|
|
3319
|
+
const e = t.match(vs);
|
|
3320
|
+
if (!e)
|
|
3321
|
+
throw new Error(`Invalid argument not valid semver ('${t}' received)`);
|
|
3322
|
+
return e.shift(), e;
|
|
3323
|
+
}, Fe = (t) => t === "*" || t === "x" || t === "X", Be = (t) => {
|
|
3324
|
+
const e = parseInt(t, 10);
|
|
3325
|
+
return isNaN(e) ? t : e;
|
|
3326
|
+
}, Ms = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], Os = (t, e) => {
|
|
3327
|
+
if (Fe(t) || Fe(e))
|
|
3328
|
+
return 0;
|
|
3329
|
+
const [n, r] = Ms(Be(t), Be(e));
|
|
3330
|
+
return n > r ? 1 : n < r ? -1 : 0;
|
|
3331
|
+
}, Ve = (t, e) => {
|
|
3332
|
+
for (let n = 0; n < Math.max(t.length, e.length); n++) {
|
|
3333
|
+
const r = Os(t[n] || "0", e[n] || "0");
|
|
3334
|
+
if (r !== 0)
|
|
3335
|
+
return r;
|
|
3336
|
+
}
|
|
3337
|
+
return 0;
|
|
3338
|
+
}, As = (t, e) => {
|
|
3339
|
+
const n = Qe(t), r = Qe(e), s = n.pop(), a = r.pop(), o = Ve(n, r);
|
|
3340
|
+
return o !== 0 ? o : s && a ? Ve(s.split("."), a.split(".")) : s || a ? s ? -1 : 1 : 0;
|
|
3341
|
+
}, Ns = (t, e, n) => {
|
|
3342
|
+
ks(n);
|
|
3343
|
+
const r = As(t, e);
|
|
3344
|
+
return Dt[n].includes(r);
|
|
3345
|
+
}, Dt = {
|
|
3346
|
+
">": [1],
|
|
3347
|
+
">=": [0, 1],
|
|
3348
|
+
"=": [0],
|
|
3349
|
+
"<=": [-1, 0],
|
|
3350
|
+
"<": [-1],
|
|
3351
|
+
"!=": [-1, 1]
|
|
3352
|
+
}, Ge = Object.keys(Dt), ks = (t) => {
|
|
3353
|
+
if (Ge.indexOf(t) === -1)
|
|
3354
|
+
throw new Error(`Invalid operator, expected one of ${Ge.join("|")}`);
|
|
3355
|
+
}, ie = "+", be = (t, e) => {
|
|
3356
|
+
const { agency: n, id: r, version: s } = C(t), a = e.filter(
|
|
3357
|
+
(c) => c.agencyID === n && c.id === r && !c?.version?.includes(ie)
|
|
3358
|
+
);
|
|
3359
|
+
if (a.length === 1)
|
|
3360
|
+
return a[0];
|
|
3361
|
+
if (!s?.includes(ie))
|
|
3362
|
+
return a.find((c) => c.version === s);
|
|
3363
|
+
const o = a.map(
|
|
3364
|
+
(c) => c.version
|
|
3365
|
+
), i = Rs(s, o);
|
|
3366
|
+
return a.find(
|
|
3367
|
+
(c) => c.version === i[0]
|
|
3368
|
+
);
|
|
3369
|
+
}, Rs = (t, e) => {
|
|
3370
|
+
const n = Is(t, e);
|
|
3371
|
+
return n.length > 0 ? [n[0]] : [];
|
|
3372
|
+
}, Is = (t, e) => {
|
|
3373
|
+
const n = [];
|
|
3374
|
+
return e.forEach((r) => {
|
|
3375
|
+
Ys(t, r) && n.push(r);
|
|
3376
|
+
}), n;
|
|
3377
|
+
}, _s = (t) => {
|
|
3378
|
+
const e = t.trim(), n = e.indexOf("+");
|
|
3379
|
+
if (n <= 0) return "";
|
|
3380
|
+
let r = n;
|
|
3381
|
+
for (; r > 0 && e[r - 1] >= "0" && e[r - 1] <= "9"; )
|
|
3382
|
+
r--;
|
|
3383
|
+
return r > 0 ? e.slice(0, r) : "";
|
|
3384
|
+
}, Ys = (t, e) => {
|
|
3385
|
+
const n = t.trim().replace(/\+/, ""), r = _s(t);
|
|
3386
|
+
return e.startsWith(r) && Ns(e, n, ">=");
|
|
3387
|
+
}, De = (t, e) => {
|
|
3388
|
+
const { concept: n } = Cs(t, e);
|
|
3389
|
+
return n;
|
|
3390
|
+
}, Cs = (t, e) => {
|
|
3391
|
+
if (t == null)
|
|
3392
|
+
return {
|
|
3393
|
+
concept: void 0,
|
|
3394
|
+
scheme: void 0
|
|
3395
|
+
};
|
|
3396
|
+
const { childId: n, agency: r, id: s, version: a } = tt(t);
|
|
3397
|
+
if (a?.includes(ie)) {
|
|
3398
|
+
const o = be(
|
|
3399
|
+
t,
|
|
3400
|
+
e
|
|
3401
|
+
);
|
|
3402
|
+
return {
|
|
3403
|
+
concept: Xe(o?.concepts || [], n),
|
|
3404
|
+
scheme: o
|
|
3405
|
+
};
|
|
3406
|
+
}
|
|
3407
|
+
for (const o of e)
|
|
3408
|
+
if (Ls(o, s, r, a))
|
|
3409
|
+
return {
|
|
3410
|
+
concept: Xe(o?.concepts || [], n),
|
|
3411
|
+
scheme: o
|
|
3412
|
+
};
|
|
3413
|
+
return {
|
|
3414
|
+
concept: void 0,
|
|
3415
|
+
scheme: void 0
|
|
3416
|
+
};
|
|
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
|
+
const r = n?.conceptIdentity || "", s = De(r, e), a = K(
|
|
3419
|
+
n?.localRepresentation?.enumeration
|
|
3420
|
+
), o = K(
|
|
3421
|
+
s?.coreRepresentation?.enumeration
|
|
3422
|
+
), i = a || o;
|
|
3423
|
+
if (i != null)
|
|
3424
|
+
return be(i, t);
|
|
3425
|
+
}, Ss = (t, e) => {
|
|
3222
3426
|
const n = t?.data?.dataSets?.[0], s = t?.data?.structures?.[0]?.attributes?.dimensionGroup || [], a = n?.dimensionGroupAttributes, o = {};
|
|
3223
3427
|
for (const i of s) {
|
|
3224
|
-
const c = i.relationship.dimensions, { codedSeriesKey: u, decodedSeriesKey: d } =
|
|
3428
|
+
const c = i.relationship.dimensions, { codedSeriesKey: u, decodedSeriesKey: d } = Tt(
|
|
3225
3429
|
t,
|
|
3226
3430
|
e,
|
|
3227
3431
|
c
|
|
@@ -3233,7 +3437,7 @@ const ws = (t, e) => {
|
|
|
3233
3437
|
};
|
|
3234
3438
|
}
|
|
3235
3439
|
return o;
|
|
3236
|
-
},
|
|
3440
|
+
}, Tt = (t, e, n) => {
|
|
3237
3441
|
const r = t?.data?.structures?.[0], s = [
|
|
3238
3442
|
...r?.dimensions.series || [],
|
|
3239
3443
|
...r?.dimensions.observation || []
|
|
@@ -3247,7 +3451,7 @@ const ws = (t, e) => {
|
|
|
3247
3451
|
codedSeriesKey: a.join(":"),
|
|
3248
3452
|
decodedSeriesKey: o.join(":")
|
|
3249
3453
|
};
|
|
3250
|
-
},
|
|
3454
|
+
}, za = (t, e, n) => {
|
|
3251
3455
|
const r = t?.data?.dataSets?.[0], s = t?.data?.structures?.[0], a = (s?.attributes?.dimensionGroup || []).filter(
|
|
3252
3456
|
(l) => l.relationship.dimensions?.length === 1 && l.relationship.dimensions.includes(e || "")
|
|
3253
3457
|
), o = r?.dimensionGroupAttributes, i = [
|
|
@@ -3257,10 +3461,10 @@ const ws = (t, e) => {
|
|
|
3257
3461
|
u[c] = n || "";
|
|
3258
3462
|
const d = {};
|
|
3259
3463
|
for (const l of a) {
|
|
3260
|
-
const
|
|
3464
|
+
const m = l.relationship.dimensions, { codedSeriesKey: x, decodedSeriesKey: P } = Tt(
|
|
3261
3465
|
t,
|
|
3262
3466
|
u,
|
|
3263
|
-
|
|
3467
|
+
m
|
|
3264
3468
|
);
|
|
3265
3469
|
d[l.id] = {
|
|
3266
3470
|
values: o?.[x] || [],
|
|
@@ -3269,67 +3473,243 @@ const ws = (t, e) => {
|
|
|
3269
3473
|
};
|
|
3270
3474
|
}
|
|
3271
3475
|
return d;
|
|
3272
|
-
},
|
|
3476
|
+
}, $s = (t, e) => {
|
|
3273
3477
|
if (e == null)
|
|
3274
3478
|
return;
|
|
3275
3479
|
const n = t.values?.[e];
|
|
3276
3480
|
return n ?? (e instanceof Array ? { values: e } : { value: e.toString() });
|
|
3277
|
-
},
|
|
3278
|
-
const
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
parsedTimeSeriesValue: g,
|
|
3291
|
-
values: d,
|
|
3292
|
-
attributes: [],
|
|
3293
|
-
dataSetAttrs: []
|
|
3294
|
-
});
|
|
3295
|
-
continue;
|
|
3296
|
-
}
|
|
3297
|
-
d.push(
|
|
3298
|
-
...Es(x, n)
|
|
3481
|
+
}, Ka = (t, e, n, r) => {
|
|
3482
|
+
const s = e?.find(
|
|
3483
|
+
(a) => a?.id === t?.id
|
|
3484
|
+
)?.values;
|
|
3485
|
+
return n?.filter((a) => s?.some((o) => o.id === a.id))?.map((a) => ({
|
|
3486
|
+
...a,
|
|
3487
|
+
name: r ? pe(a, r) : a?.name
|
|
3488
|
+
})) || [];
|
|
3489
|
+
}, Ws = (t, e) => {
|
|
3490
|
+
const n = e?.dataStructureComponents?.attributeList, r = t?.metadataStructureComponents?.metadataAttributeList;
|
|
3491
|
+
return n?.metadataAttributeUsages?.map((s) => {
|
|
3492
|
+
const a = r?.metadataAttributes?.find(
|
|
3493
|
+
(o) => o?.id === s?.metadataAttributeReference
|
|
3299
3494
|
);
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3495
|
+
return {
|
|
3496
|
+
...a,
|
|
3497
|
+
attributeRelationship: s.attributeRelationship,
|
|
3498
|
+
isMandatory: Number(a?.minOccurs) > 0
|
|
3499
|
+
};
|
|
3500
|
+
});
|
|
3501
|
+
}, Ja = (t = [], e, n) => {
|
|
3502
|
+
const r = K(e?.conceptIdentity) || "", s = De(r, t);
|
|
3503
|
+
return n ? pe(s, n) : s?.name ?? s?.id ?? e?.id;
|
|
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 || {}), Us = /* @__PURE__ */ ((t) => (t.UNBOUNDED = "unbounded", t))(Us || {});
|
|
3506
|
+
function je(t) {
|
|
3507
|
+
return t?.dataStructures?.[0]?.dataStructureComponents?.dimensionList;
|
|
3508
|
+
}
|
|
3509
|
+
function Za(t) {
|
|
3510
|
+
return t?.data?.structures?.[0]?.dimensions?.series || [];
|
|
3511
|
+
}
|
|
3512
|
+
function eo(t) {
|
|
3513
|
+
return t?.data?.structures?.[0]?.dimensions?.observation?.[0].values.map((e) => e.value ? e.value : e.id).filter((e) => e != null) || [];
|
|
3514
|
+
}
|
|
3515
|
+
function to(t) {
|
|
3516
|
+
return t.find(
|
|
3517
|
+
(e) => e.type === Te.TIME_DIMENSION
|
|
3518
|
+
);
|
|
3519
|
+
}
|
|
3520
|
+
const no = (t) => {
|
|
3521
|
+
const e = /* @__PURE__ */ new Map(), n = t?.dataStructures?.[0], r = t?.metadataStructures?.[0], s = t?.conceptSchemes || [], a = t?.codelists || [];
|
|
3522
|
+
return t && [
|
|
3523
|
+
...je(t)?.dimensions || [],
|
|
3524
|
+
...je(t)?.timeDimensions || [],
|
|
3525
|
+
...Ws(r, n),
|
|
3526
|
+
...n?.dataStructureComponents?.attributeList?.attributes || []
|
|
3527
|
+
].forEach(
|
|
3528
|
+
(i) => {
|
|
3529
|
+
const c = De(
|
|
3530
|
+
i?.conceptIdentity,
|
|
3531
|
+
s
|
|
3532
|
+
), u = i?.localRepresentation?.enumeration || c?.coreRepresentation?.enumeration, d = be(
|
|
3533
|
+
u,
|
|
3534
|
+
a
|
|
3535
|
+
);
|
|
3536
|
+
i?.id && (u ? e.set(i?.id, {
|
|
3537
|
+
...d,
|
|
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
|
+
}));
|
|
3545
|
+
}
|
|
3546
|
+
), e;
|
|
3547
|
+
}, ro = (t) => t?.find(
|
|
3548
|
+
(e) => e.id === ye.SERIES_COUNT
|
|
3549
|
+
)?.title || "", Ee = 1440 * 60 * 1e3, xe = 7 * Ee;
|
|
3550
|
+
function Pe(t) {
|
|
3551
|
+
const e = `${t}-01-01`, n = new Date(e);
|
|
3552
|
+
if (n.getDay() !== 4) {
|
|
3553
|
+
const s = 1 + (4 - n.getDay() + 7) % 7;
|
|
3554
|
+
n.setMonth(0, s);
|
|
3555
|
+
}
|
|
3556
|
+
return n;
|
|
3557
|
+
}
|
|
3558
|
+
function Hs(t) {
|
|
3559
|
+
const e = new Date(t), r = -((e.getDay() + 6) % 7) + 3;
|
|
3560
|
+
return e.setDate(e.getDate() + r), new Date(e.valueOf());
|
|
3561
|
+
}
|
|
3562
|
+
function ze(t, e = "W") {
|
|
3563
|
+
const n = `${t}-12-31`, r = ee(new Date(n), e);
|
|
3564
|
+
if (r.weekYear === t)
|
|
3565
|
+
return r.weekNumber;
|
|
3566
|
+
const s = `${t}-12-24`;
|
|
3567
|
+
return ee(new Date(s), e).weekNumber;
|
|
3568
|
+
}
|
|
3569
|
+
function Et(t, e, n = "W") {
|
|
3570
|
+
return `${t}-${n}${e < 10 ? "0" + e : e}`;
|
|
3571
|
+
}
|
|
3572
|
+
function ee(t, e = "W") {
|
|
3573
|
+
const n = Hs(t), r = n.getFullYear(), s = Pe(r), a = 1 + Math.ceil(
|
|
3574
|
+
(n.getTime() - s.getTime()) / xe
|
|
3575
|
+
);
|
|
3576
|
+
return {
|
|
3577
|
+
code: Et(r, a, e),
|
|
3578
|
+
weekNumber: a,
|
|
3579
|
+
weekYear: r
|
|
3580
|
+
};
|
|
3581
|
+
}
|
|
3582
|
+
function Qs(t) {
|
|
3583
|
+
const [e, n] = t.split("-W"), s = Pe(+e).getTime() + (+n - 1) * xe - 3 * Ee;
|
|
3584
|
+
return new Date(s);
|
|
3585
|
+
}
|
|
3586
|
+
function Fs(t) {
|
|
3587
|
+
const [e, n] = t.split("-W"), s = Pe(+e).getTime() + (+n - 1) * xe + 3 * Ee;
|
|
3588
|
+
return new Date(s);
|
|
3589
|
+
}
|
|
3590
|
+
const Bs = "/api/download", Vs = 6e4, so = async (t, e, n, r, s, a, o) => {
|
|
3591
|
+
const i = new URLSearchParams({
|
|
3592
|
+
urn: t,
|
|
3593
|
+
format: e,
|
|
3594
|
+
compress: "false",
|
|
3595
|
+
filename: a,
|
|
3596
|
+
filters: JSON.stringify(s),
|
|
3597
|
+
attribute: r,
|
|
3598
|
+
language: n,
|
|
3599
|
+
isMetadata: o ? "true" : "none"
|
|
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) => {
|
|
3616
|
+
const n = [];
|
|
3617
|
+
for (const r of t) {
|
|
3618
|
+
if (r.type !== Te.DIMENSION)
|
|
3619
|
+
continue;
|
|
3620
|
+
const s = e.find((a) => a.componentCode === r.id);
|
|
3621
|
+
s != null && s.values?.length > 0 ? n.push(s.values?.join(qt)) : n.push("*");
|
|
3622
|
+
}
|
|
3623
|
+
return n.join(".");
|
|
3624
|
+
}, Gs = (t, e) => {
|
|
3625
|
+
if (!t || !t.startPeriod && !t.endPeriod)
|
|
3626
|
+
return null;
|
|
3627
|
+
const n = [], { startPeriod: r, endPeriod: s } = t;
|
|
3628
|
+
if (r && n.push(
|
|
3629
|
+
`${R.GREATER_OR_EQUAL}${_e}${Ke(r)}`
|
|
3630
|
+
), s && n.push(
|
|
3631
|
+
`${R.LESS_OR_EQUAL}${_e}${Ke(s)}`
|
|
3632
|
+
), n.length === 0)
|
|
3633
|
+
return null;
|
|
3634
|
+
const a = e;
|
|
3635
|
+
return n.map(
|
|
3636
|
+
(o) => `${encodeURIComponent(`c[${a}]`)}${Wt}${encodeURIComponent(o)}`
|
|
3637
|
+
).join(st);
|
|
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) => {
|
|
3642
|
+
const n = e.id, r = t?.filters?.find(
|
|
3643
|
+
(c) => c.componentCode === n
|
|
3644
|
+
);
|
|
3645
|
+
if (!r || !r.values)
|
|
3646
|
+
return null;
|
|
3647
|
+
const s = r.values?.filter((c) => !!c);
|
|
3648
|
+
if (!s.length)
|
|
3649
|
+
return null;
|
|
3650
|
+
const a = r.operator;
|
|
3651
|
+
if (a === R.LESS_OR_EQUAL || a === R.LESS)
|
|
3652
|
+
return { startPeriod: null, endPeriod: G(s[0]) };
|
|
3653
|
+
if (a === R.GREATER_OR_EQUAL || a === R.GREATER)
|
|
3654
|
+
return { startPeriod: G(s[0]), endPeriod: null };
|
|
3655
|
+
const o = G(s[0]), i = G(s[1]);
|
|
3656
|
+
return { startPeriod: o, endPeriod: i };
|
|
3657
|
+
}, js = "Observation", io = (t) => {
|
|
3658
|
+
const e = t?.data?.dataSets, n = t?.data?.structures?.[0];
|
|
3659
|
+
if (!e || !n)
|
|
3660
|
+
return [];
|
|
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 = [];
|
|
3662
|
+
for (const u in o) {
|
|
3663
|
+
const d = [], { name: l, parsedTimeSeriesValue: m } = zs(
|
|
3664
|
+
u,
|
|
3665
|
+
i
|
|
3666
|
+
), x = o[u], P = x.attributes || [];
|
|
3667
|
+
if (Object.keys(x).length === 0) {
|
|
3668
|
+
c.push({
|
|
3669
|
+
name: l,
|
|
3670
|
+
parsedTimeSeriesValue: m,
|
|
3671
|
+
values: d,
|
|
3672
|
+
attributes: [],
|
|
3673
|
+
dataSetAttrs: []
|
|
3674
|
+
});
|
|
3675
|
+
continue;
|
|
3676
|
+
}
|
|
3677
|
+
d.push(
|
|
3678
|
+
...ea(x, n)
|
|
3679
|
+
);
|
|
3680
|
+
const N = ce(
|
|
3681
|
+
r?.series || [],
|
|
3682
|
+
(M) => P[M]
|
|
3683
|
+
), f = ta(
|
|
3684
|
+
n.attributes?.dataSet || [],
|
|
3685
|
+
e[0].attributes?.filter((M) => M != null) || []
|
|
3686
|
+
), w = Ss(
|
|
3687
|
+
t,
|
|
3688
|
+
m
|
|
3689
|
+
), v = a.map((M, W) => {
|
|
3690
|
+
const q = w[M.id], F = $s(
|
|
3691
|
+
M,
|
|
3692
|
+
q.values[W]
|
|
3693
|
+
);
|
|
3694
|
+
return {
|
|
3695
|
+
attribute: M,
|
|
3696
|
+
dimensionGroupValue: F,
|
|
3697
|
+
dimensionGroupData: q
|
|
3698
|
+
};
|
|
3699
|
+
});
|
|
3700
|
+
c.push({
|
|
3701
|
+
name: l,
|
|
3702
|
+
parsedTimeSeriesValue: m,
|
|
3703
|
+
values: d,
|
|
3704
|
+
attributes: N,
|
|
3705
|
+
dataSetAttrs: f,
|
|
3706
|
+
dimensionGroupAttributes: v
|
|
3707
|
+
});
|
|
3708
|
+
}
|
|
3709
|
+
return c;
|
|
3710
|
+
}, zs = (t, e) => {
|
|
3711
|
+
const n = t.split(new RegExp("(?<!\\|):(?!\\||$)")), r = [];
|
|
3712
|
+
for (let s = 0; s < n.length; s++) {
|
|
3333
3713
|
const a = e?.[s], o = Number(n[s]);
|
|
3334
3714
|
if (o < 0 || a == null)
|
|
3335
3715
|
continue;
|
|
@@ -3341,33 +3721,33 @@ const ws = (t, e) => {
|
|
|
3341
3721
|
r.push(i?.id || i?.value || "");
|
|
3342
3722
|
}
|
|
3343
3723
|
return {
|
|
3344
|
-
name:
|
|
3724
|
+
name: Js(r),
|
|
3345
3725
|
parsedTimeSeriesValue: r
|
|
3346
3726
|
};
|
|
3347
|
-
},
|
|
3727
|
+
}, ce = (t, e) => {
|
|
3348
3728
|
const n = [];
|
|
3349
3729
|
for (let r = 0; r < t.length; r++) {
|
|
3350
|
-
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;
|
|
3351
3731
|
n.push({
|
|
3352
3732
|
name: s.id,
|
|
3353
3733
|
value: o
|
|
3354
3734
|
});
|
|
3355
3735
|
}
|
|
3356
3736
|
return n;
|
|
3357
|
-
},
|
|
3737
|
+
}, Ks = (t, e) => {
|
|
3358
3738
|
const n = e.values[t];
|
|
3359
3739
|
return n == null ? typeof t == "object" ? t : t.toString() : n?.id || n?.value || n?.ids || n?.values;
|
|
3360
|
-
},
|
|
3740
|
+
}, Js = (t) => t.map((e) => e ? Zs(e) : "").join("."), Zs = (t) => t.replace(/\./g, "|.").replace(/:/g, "|:"), ea = (t, e) => {
|
|
3361
3741
|
const n = e.measures?.observation?.length;
|
|
3362
3742
|
if (t.observations == null)
|
|
3363
3743
|
return [
|
|
3364
3744
|
{
|
|
3365
|
-
values:
|
|
3366
|
-
obsAttributes:
|
|
3745
|
+
values: Je(t, e.measures),
|
|
3746
|
+
obsAttributes: ce(
|
|
3367
3747
|
e.attributes?.observation || [],
|
|
3368
3748
|
(o) => t[o + n]
|
|
3369
3749
|
),
|
|
3370
|
-
dimensionAtObservation:
|
|
3750
|
+
dimensionAtObservation: js
|
|
3371
3751
|
}
|
|
3372
3752
|
];
|
|
3373
3753
|
const r = t.observations, s = e.dimensions.observation?.[0], a = [];
|
|
@@ -3375,87 +3755,47 @@ const ws = (t, e) => {
|
|
|
3375
3755
|
const i = s?.values[o];
|
|
3376
3756
|
a.push({
|
|
3377
3757
|
dimensionAtObservation: i?.value || i?.id,
|
|
3378
|
-
values:
|
|
3758
|
+
values: Je(
|
|
3379
3759
|
r[o],
|
|
3380
3760
|
e.measures
|
|
3381
3761
|
),
|
|
3382
|
-
obsAttributes:
|
|
3762
|
+
obsAttributes: ce(
|
|
3383
3763
|
e.attributes?.observation || [],
|
|
3384
3764
|
(c) => r[o][c + n]
|
|
3385
3765
|
)
|
|
3386
3766
|
});
|
|
3387
3767
|
}
|
|
3388
3768
|
return a;
|
|
3389
|
-
},
|
|
3769
|
+
}, Je = (t, e) => e?.observation?.map((n, r) => ({ name: n.id, value: t[r] })) || [], ta = (t, e) => t.reduce(
|
|
3390
3770
|
(n, r, s) => {
|
|
3391
3771
|
const a = e[s];
|
|
3392
|
-
return
|
|
3772
|
+
return na(n, r, a, ""), n;
|
|
3393
3773
|
},
|
|
3394
3774
|
[]
|
|
3395
|
-
),
|
|
3775
|
+
), na = (t, e, n, r) => {
|
|
3396
3776
|
const s = n != null ? e?.values?.length > 0 ? e.values[n]?.id || e.values[n]?.value : String(n) : r;
|
|
3397
3777
|
t.push({
|
|
3398
3778
|
name: e.id,
|
|
3399
3779
|
value: s || ""
|
|
3400
3780
|
});
|
|
3401
|
-
},
|
|
3402
|
-
function
|
|
3403
|
-
|
|
3404
|
-
if (n.getDay() !== 4) {
|
|
3405
|
-
const s = 1 + (4 - n.getDay() + 7) % 7;
|
|
3406
|
-
n.setMonth(0, s);
|
|
3407
|
-
}
|
|
3408
|
-
return n;
|
|
3409
|
-
}
|
|
3410
|
-
function Cs(t) {
|
|
3411
|
-
const e = new Date(t), r = -((e.getDay() + 6) % 7) + 3;
|
|
3412
|
-
return e.setDate(e.getDate() + r), new Date(e.valueOf());
|
|
3413
|
-
}
|
|
3414
|
-
function Fe(t, e = "W") {
|
|
3415
|
-
const n = `${t}-12-31`, r = Z(new Date(n), e);
|
|
3416
|
-
if (r.weekYear === t)
|
|
3417
|
-
return r.weekNumber;
|
|
3418
|
-
const s = `${t}-12-24`;
|
|
3419
|
-
return Z(new Date(s), e).weekNumber;
|
|
3420
|
-
}
|
|
3421
|
-
function pt(t, e, n = "W") {
|
|
3422
|
-
return `${t}-${n}${e < 10 ? "0" + e : e}`;
|
|
3423
|
-
}
|
|
3424
|
-
function Z(t, e = "W") {
|
|
3425
|
-
const n = Cs(t), r = n.getFullYear(), s = ve(r), a = 1 + Math.ceil(
|
|
3426
|
-
(n.getTime() - s.getTime()) / Me
|
|
3427
|
-
);
|
|
3428
|
-
return {
|
|
3429
|
-
code: pt(r, a, e),
|
|
3430
|
-
weekNumber: a,
|
|
3431
|
-
weekYear: r
|
|
3432
|
-
};
|
|
3433
|
-
}
|
|
3434
|
-
function Ls(t) {
|
|
3435
|
-
const [e, n] = t.split("-W"), s = ve(+e).getTime() + (+n - 1) * Me - 3 * Pe;
|
|
3436
|
-
return new Date(s);
|
|
3437
|
-
}
|
|
3438
|
-
function Ss(t) {
|
|
3439
|
-
const [e, n] = t.split("-W"), s = ve(+e).getTime() + (+n - 1) * Me + 3 * Pe;
|
|
3440
|
-
return new Date(s);
|
|
3441
|
-
}
|
|
3442
|
-
function yt(t) {
|
|
3443
|
-
return pe(t) ? Ws(t) : ye(t) ? qs(t) : Ee(t) ? Fs(t) : De(t) ? Us(t) : xe(t) ? Ls(t) : Gs(t);
|
|
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);
|
|
3782
|
+
function xt(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);
|
|
3444
3784
|
}
|
|
3445
|
-
function
|
|
3446
|
-
return
|
|
3785
|
+
function Pt(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);
|
|
3447
3787
|
}
|
|
3448
|
-
function
|
|
3449
|
-
const e =
|
|
3788
|
+
function ma(t) {
|
|
3789
|
+
const e = ve(t);
|
|
3450
3790
|
if (e)
|
|
3451
3791
|
return new Date(Number(e[0]), 0, 1);
|
|
3452
3792
|
}
|
|
3453
|
-
function
|
|
3454
|
-
const e =
|
|
3793
|
+
function ha(t) {
|
|
3794
|
+
const e = ve(t);
|
|
3455
3795
|
if (e)
|
|
3456
3796
|
return new Date(Number(e[0]) + 1, 0, 1);
|
|
3457
3797
|
}
|
|
3458
|
-
function
|
|
3798
|
+
function ga(t) {
|
|
3459
3799
|
const [e, n] = t.split("-S");
|
|
3460
3800
|
switch (+n) {
|
|
3461
3801
|
case 1:
|
|
@@ -3464,7 +3804,7 @@ function qs(t) {
|
|
|
3464
3804
|
return new Date(+e, 6, 1);
|
|
3465
3805
|
}
|
|
3466
3806
|
}
|
|
3467
|
-
function
|
|
3807
|
+
function wa(t) {
|
|
3468
3808
|
const [e, n] = t.split("-S");
|
|
3469
3809
|
switch (+n) {
|
|
3470
3810
|
case 1:
|
|
@@ -3473,8 +3813,8 @@ function Qs(t) {
|
|
|
3473
3813
|
return new Date(+e + 1, 0, 1);
|
|
3474
3814
|
}
|
|
3475
3815
|
}
|
|
3476
|
-
function
|
|
3477
|
-
const e =
|
|
3816
|
+
function ya(t) {
|
|
3817
|
+
const e = ke(t);
|
|
3478
3818
|
if (!e)
|
|
3479
3819
|
return;
|
|
3480
3820
|
const [n, r] = e[0].split("-Q");
|
|
@@ -3489,8 +3829,8 @@ function Fs(t) {
|
|
|
3489
3829
|
return new Date(+n, 9, 1);
|
|
3490
3830
|
}
|
|
3491
3831
|
}
|
|
3492
|
-
function
|
|
3493
|
-
const e =
|
|
3832
|
+
function pa(t) {
|
|
3833
|
+
const e = ke(t);
|
|
3494
3834
|
if (!e)
|
|
3495
3835
|
return;
|
|
3496
3836
|
const [n, r] = e[0].split("-Q");
|
|
@@ -3505,45 +3845,45 @@ function Hs(t) {
|
|
|
3505
3845
|
return new Date(+n + 1, 0, 1);
|
|
3506
3846
|
}
|
|
3507
3847
|
}
|
|
3508
|
-
function
|
|
3509
|
-
const e =
|
|
3848
|
+
function ba(t) {
|
|
3849
|
+
const e = Ae(t);
|
|
3510
3850
|
if (!e)
|
|
3511
3851
|
return;
|
|
3512
3852
|
const [n, r] = e[0].split("-M");
|
|
3513
3853
|
return new Date(+n, +r - 1, 1);
|
|
3514
3854
|
}
|
|
3515
|
-
function
|
|
3516
|
-
const e =
|
|
3855
|
+
function Da(t) {
|
|
3856
|
+
const e = Ae(t);
|
|
3517
3857
|
if (!e)
|
|
3518
3858
|
return;
|
|
3519
3859
|
const [n, r] = e[0].split("-M");
|
|
3520
3860
|
return new Date(+n, +r, 1);
|
|
3521
3861
|
}
|
|
3522
|
-
const
|
|
3862
|
+
const Ta = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Ea = (t) => {
|
|
3523
3863
|
const e = /* @__PURE__ */ new Date(`${t}T23:59:00`);
|
|
3524
3864
|
return e.setMinutes(e.getMinutes() + 1), e;
|
|
3525
|
-
},
|
|
3526
|
-
const a = [], o = e && e > 3 ?
|
|
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;
|
|
3527
3867
|
for (let c = o; c <= i; c++)
|
|
3528
3868
|
a.push(`${t}-${s}${c}`);
|
|
3529
3869
|
return a;
|
|
3530
|
-
},
|
|
3870
|
+
}, va = (t, e, n, r = "S") => {
|
|
3531
3871
|
const s = [];
|
|
3532
3872
|
return (e || 1) < 7 && (n || 12) > 6 && s.push(`${t}-${r}1`), n == null && s.push(`${t}-${r}2`), s;
|
|
3533
|
-
},
|
|
3873
|
+
}, co = (t) => Math.ceil(t / 3), vt = (t, e, n = "M") => `${t}-${n}${e.toString().padStart(2, "0")}`, Ma = (t, e, n = "M") => {
|
|
3534
3874
|
const r = [];
|
|
3535
3875
|
for (let s = e; s <= 12; s++)
|
|
3536
|
-
r.push(
|
|
3876
|
+
r.push(vt(t, s, n));
|
|
3537
3877
|
return r;
|
|
3538
|
-
},
|
|
3878
|
+
}, Oa = (t, e, n, r = "M") => {
|
|
3539
3879
|
const s = [];
|
|
3540
3880
|
for (let a = e; a < n; a++)
|
|
3541
|
-
s.push(
|
|
3881
|
+
s.push(vt(t, a, r));
|
|
3542
3882
|
return s;
|
|
3543
|
-
},
|
|
3883
|
+
}, Aa = (t, e, n, r = "M") => {
|
|
3544
3884
|
const s = e || 1, a = n == null, o = n || 12;
|
|
3545
|
-
return a ?
|
|
3546
|
-
},
|
|
3885
|
+
return a ? Ma(t, s, r) : Oa(t, s, o, r);
|
|
3886
|
+
}, uo = (t, e, n = "M") => {
|
|
3547
3887
|
switch (e) {
|
|
3548
3888
|
case 0:
|
|
3549
3889
|
return [
|
|
@@ -3572,345 +3912,42 @@ const Gs = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Vs = (t) => {
|
|
|
3572
3912
|
default:
|
|
3573
3913
|
return [];
|
|
3574
3914
|
}
|
|
3575
|
-
},
|
|
3576
|
-
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;
|
|
3577
3917
|
return Array.from({ length: o }, (c, u) => s + u);
|
|
3578
|
-
},
|
|
3579
|
-
const n =
|
|
3918
|
+
}, I = (t, e = !1) => {
|
|
3919
|
+
const n = ka(t, e);
|
|
3580
3920
|
return n ? (n.getTimezoneOffset() > 0 && n.setMinutes(n.getMinutes() + n.getTimezoneOffset()), n) : /* @__PURE__ */ new Date();
|
|
3581
|
-
},
|
|
3921
|
+
}, ka = (t, e = !1) => {
|
|
3582
3922
|
const n = Number(t);
|
|
3583
|
-
return t.toString().length !== 13 ? e ?
|
|
3584
|
-
},
|
|
3585
|
-
const n =
|
|
3923
|
+
return t.toString().length !== 13 ? e ? xt(t) : Pt(t) : isNaN(n) ? /* @__PURE__ */ new Date(`${t}T00:00:00.000Z`) : new Date(n);
|
|
3924
|
+
}, Ra = (t, e) => e ? Math.floor((t + 1) / 3) : Math.ceil((t + 1) / 3), lo = (t, e) => {
|
|
3925
|
+
const n = et(t) - et(e);
|
|
3586
3926
|
if (n === 0 && t !== e) {
|
|
3587
|
-
const r =
|
|
3927
|
+
const r = Ze(t), s = Ze(e);
|
|
3588
3928
|
return r - s;
|
|
3589
3929
|
}
|
|
3590
3930
|
return n;
|
|
3591
|
-
},
|
|
3592
|
-
|
|
3593
|
-
function Ga(t) {
|
|
3594
|
-
return t?.annotations?.find((e) => {
|
|
3595
|
-
if (e.id === Oe.LAST_UPDATE_AT)
|
|
3596
|
-
return e;
|
|
3597
|
-
})?.value;
|
|
3598
|
-
}
|
|
3599
|
-
const Ae = (t, e) => t?.names && t?.names[e] || t?.name, Tt = (t, e, n) => {
|
|
3600
|
-
if (!(!t || e?.has(t?.id)) && (e?.set(t?.id, t), t?.parent)) {
|
|
3601
|
-
const r = n?.get(t?.parent);
|
|
3602
|
-
Tt(r, e, n);
|
|
3603
|
-
}
|
|
3604
|
-
}, oa = (t, e) => {
|
|
3605
|
-
const n = /* @__PURE__ */ new Map(), r = new Map(t?.map((s) => [s.id, s]));
|
|
3606
|
-
return e?.forEach((s) => {
|
|
3607
|
-
Tt(s, n, r);
|
|
3608
|
-
}), Array.from(n?.values());
|
|
3609
|
-
}, Va = (t) => {
|
|
3610
|
-
const e = t?.find(
|
|
3611
|
-
(a) => a.id === ls
|
|
3612
|
-
), n = t?.find(
|
|
3613
|
-
(a) => a.id === fs
|
|
3614
|
-
), r = n?.title ? new Date(n?.title) : null;
|
|
3615
|
-
return {
|
|
3616
|
-
startPeriod: e?.title ? new Date(e?.title) : null,
|
|
3617
|
-
endPeriod: r
|
|
3618
|
-
};
|
|
3619
|
-
}, 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, i) => [o, i]);
|
|
3621
|
-
r.sort(
|
|
3622
|
-
(o, i) => ia(o[0], i[0])
|
|
3623
|
-
);
|
|
3624
|
-
const s = [...e];
|
|
3625
|
-
s.sort(ca);
|
|
3626
|
-
let a = 0;
|
|
3627
|
-
for (const o of r) {
|
|
3628
|
-
const i = o[0];
|
|
3629
|
-
for (; a < s.length && s[a].memberValue.localeCompare(i.id) < 0; )
|
|
3630
|
-
a += 1;
|
|
3631
|
-
a < s.length && s[a].memberValue === i.id && (n[o[1]] = o[0]);
|
|
3632
|
-
}
|
|
3633
|
-
return n.filter((o) => o != null);
|
|
3634
|
-
}, da = (t) => !!t?.some((e) => e.parent), Xa = (t, e, n, r, s = []) => {
|
|
3635
|
-
let a = t || [];
|
|
3636
|
-
if (la(n || [], e || "")) {
|
|
3637
|
-
const o = (n || [])[0].cubeRegions?.find(
|
|
3638
|
-
({ isIncluded: i }) => i
|
|
3639
|
-
);
|
|
3640
|
-
if (o) {
|
|
3641
|
-
const i = o.memberSelection?.find(
|
|
3642
|
-
({ componentId: c }) => c === e
|
|
3643
|
-
);
|
|
3644
|
-
i ? a = a.length === 0 ? (i.selectionValues || []).map(({ memberValue: c }) => ({
|
|
3645
|
-
id: c,
|
|
3646
|
-
name: c
|
|
3647
|
-
})) : ua(a, i.selectionValues) : a = [];
|
|
3648
|
-
}
|
|
3649
|
-
} else s.length !== 0 && (a = a.filter(({ id: o }) => s.includes(o)));
|
|
3650
|
-
return da(t) && (a = oa(t, a)), a?.map((o) => ({
|
|
3651
|
-
...o,
|
|
3652
|
-
name: r ? Ae(o, r) : o?.name
|
|
3653
|
-
}));
|
|
3654
|
-
}, la = (t, e) => t != null && t.length > 0 && e != null, fa = (t) => {
|
|
3655
|
-
const e = [];
|
|
3656
|
-
return t?.filters?.forEach((n) => {
|
|
3657
|
-
n.componentCode !== ds && e.push({
|
|
3658
|
-
componentCode: n.componentCode,
|
|
3659
|
-
operator: R.EQUALS,
|
|
3660
|
-
value: n.values.join(",")
|
|
3661
|
-
});
|
|
3662
|
-
}), e;
|
|
3663
|
-
}, ja = (t) => {
|
|
3664
|
-
const e = /* @__PURE__ */ new Map();
|
|
3665
|
-
return t?.forEach((n) => {
|
|
3666
|
-
e.set(n.urn, fa(n));
|
|
3667
|
-
}), e;
|
|
3668
|
-
}, ma = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, Be = (t) => {
|
|
3669
|
-
if (typeof t != "string")
|
|
3670
|
-
throw new TypeError("Invalid argument expected string");
|
|
3671
|
-
const e = t.match(ma);
|
|
3672
|
-
if (!e)
|
|
3673
|
-
throw new Error(`Invalid argument not valid semver ('${t}' received)`);
|
|
3674
|
-
return e.shift(), e;
|
|
3675
|
-
}, Ge = (t) => t === "*" || t === "x" || t === "X", Ve = (t) => {
|
|
3676
|
-
const e = parseInt(t, 10);
|
|
3677
|
-
return isNaN(e) ? t : e;
|
|
3678
|
-
}, ha = (t, e) => typeof t != typeof e ? [String(t), String(e)] : [t, e], wa = (t, e) => {
|
|
3679
|
-
if (Ge(t) || Ge(e))
|
|
3680
|
-
return 0;
|
|
3681
|
-
const [n, r] = ha(Ve(t), Ve(e));
|
|
3682
|
-
return n > r ? 1 : n < r ? -1 : 0;
|
|
3683
|
-
}, Xe = (t, e) => {
|
|
3684
|
-
for (let n = 0; n < Math.max(t.length, e.length); n++) {
|
|
3685
|
-
const r = wa(t[n] || "0", e[n] || "0");
|
|
3686
|
-
if (r !== 0)
|
|
3687
|
-
return r;
|
|
3688
|
-
}
|
|
3689
|
-
return 0;
|
|
3690
|
-
}, ga = (t, e) => {
|
|
3691
|
-
const n = Be(t), r = Be(e), s = n.pop(), a = r.pop(), o = Xe(n, r);
|
|
3692
|
-
return o !== 0 ? o : s && a ? Xe(s.split("."), a.split(".")) : s || a ? s ? -1 : 1 : 0;
|
|
3693
|
-
}, pa = (t, e, n) => {
|
|
3694
|
-
ya(n);
|
|
3695
|
-
const r = ga(t, e);
|
|
3696
|
-
return Et[n].includes(r);
|
|
3697
|
-
}, Et = {
|
|
3698
|
-
">": [1],
|
|
3699
|
-
">=": [0, 1],
|
|
3700
|
-
"=": [0],
|
|
3701
|
-
"<=": [-1, 0],
|
|
3702
|
-
"<": [-1],
|
|
3703
|
-
"!=": [-1, 1]
|
|
3704
|
-
}, je = Object.keys(Et), ya = (t) => {
|
|
3705
|
-
if (je.indexOf(t) === -1)
|
|
3706
|
-
throw new Error(`Invalid operator, expected one of ${je.join("|")}`);
|
|
3707
|
-
}, ce = "+", Ne = (t, e) => {
|
|
3708
|
-
const { agency: n, id: r, version: s } = H(t), a = e.filter(
|
|
3709
|
-
(c) => c.agencyID === n && c.id === r && !c?.version?.includes(ce)
|
|
3710
|
-
);
|
|
3711
|
-
if (a.length === 1)
|
|
3712
|
-
return a[0];
|
|
3713
|
-
if (!s?.includes(ce))
|
|
3714
|
-
return a.find((c) => c.version === s);
|
|
3715
|
-
const o = a.map(
|
|
3716
|
-
(c) => c.version
|
|
3717
|
-
), i = ba(s, o);
|
|
3718
|
-
return a.find(
|
|
3719
|
-
(c) => c.version === i[0]
|
|
3720
|
-
);
|
|
3721
|
-
}, ba = (t, e) => {
|
|
3722
|
-
const n = Da(t, e);
|
|
3723
|
-
return n.length > 0 ? [n[0]] : [];
|
|
3724
|
-
}, Da = (t, e) => {
|
|
3725
|
-
const n = [];
|
|
3726
|
-
return e.forEach((r) => {
|
|
3727
|
-
Ea(t, r) && n.push(r);
|
|
3728
|
-
}), n;
|
|
3729
|
-
}, Ta = (t) => {
|
|
3730
|
-
const e = t.trim().replace(/\d+\+/, "*"), [n] = e.split("*");
|
|
3731
|
-
return new RegExp(`^${n}`);
|
|
3732
|
-
}, Ea = (t, e) => {
|
|
3733
|
-
const n = t.trim().replace(/\+/, "");
|
|
3734
|
-
return Ta(t).test(e) && pa(e, n, ">=");
|
|
3735
|
-
}, ke = (t, e) => {
|
|
3736
|
-
const { concept: n } = xa(t, e);
|
|
3737
|
-
return n;
|
|
3738
|
-
}, xa = (t, e) => {
|
|
3739
|
-
if (t == null)
|
|
3740
|
-
return {
|
|
3741
|
-
concept: void 0,
|
|
3742
|
-
scheme: void 0
|
|
3743
|
-
};
|
|
3744
|
-
const { childId: n, agency: r, id: s, version: a } = Pt(t);
|
|
3745
|
-
if (a?.includes(ce)) {
|
|
3746
|
-
const o = Ne(
|
|
3747
|
-
t,
|
|
3748
|
-
e
|
|
3749
|
-
);
|
|
3750
|
-
return {
|
|
3751
|
-
concept: Ke(o?.concepts || [], n),
|
|
3752
|
-
scheme: o
|
|
3753
|
-
};
|
|
3754
|
-
}
|
|
3755
|
-
for (const o of e)
|
|
3756
|
-
if (Pa(o, s, r, a))
|
|
3757
|
-
return {
|
|
3758
|
-
concept: Ke(o?.concepts || [], n),
|
|
3759
|
-
scheme: o
|
|
3760
|
-
};
|
|
3761
|
-
return {
|
|
3762
|
-
concept: void 0,
|
|
3763
|
-
scheme: void 0
|
|
3764
|
-
};
|
|
3765
|
-
}, Ke = (t, e) => t?.find((n) => n.id === e), Pa = (t, e, n, r) => t.id === e && t.agencyID === n && t.version === r, Ka = (t = [], e = [], n) => {
|
|
3766
|
-
const r = n?.conceptIdentity || "", s = ke(r, e), a = K(
|
|
3767
|
-
n?.localRepresentation?.enumeration
|
|
3768
|
-
), o = K(
|
|
3769
|
-
s?.coreRepresentation?.enumeration
|
|
3770
|
-
), i = a || o;
|
|
3771
|
-
if (i != null)
|
|
3772
|
-
return Ne(i, t);
|
|
3773
|
-
}, za = (t, e, n, r) => {
|
|
3774
|
-
const s = e?.find(
|
|
3775
|
-
(a) => a?.id === t?.id
|
|
3776
|
-
)?.values;
|
|
3777
|
-
return n?.filter((a) => s?.some((o) => o.id === a.id))?.map((a) => ({
|
|
3778
|
-
...a,
|
|
3779
|
-
name: r ? Ae(a, r) : a?.name
|
|
3780
|
-
})) || [];
|
|
3781
|
-
}, Ma = (t, e) => {
|
|
3782
|
-
const n = e?.dataStructureComponents?.attributeList, r = t?.metadataStructureComponents?.metadataAttributeList;
|
|
3783
|
-
return n?.metadataAttributeUsages?.map((s) => {
|
|
3784
|
-
const a = r?.metadataAttributes?.find(
|
|
3785
|
-
(o) => o?.id === s?.metadataAttributeReference
|
|
3786
|
-
);
|
|
3787
|
-
return {
|
|
3788
|
-
...a,
|
|
3789
|
-
attributeRelationship: s.attributeRelationship,
|
|
3790
|
-
isMandatory: Number(a?.minOccurs) > 0
|
|
3791
|
-
};
|
|
3792
|
-
});
|
|
3793
|
-
}, Ja = (t = [], e, n) => {
|
|
3794
|
-
const r = K(e?.conceptIdentity) || "", s = ke(r, t);
|
|
3795
|
-
return n ? Ae(s, n) : s?.name ?? s?.id ?? e?.id;
|
|
3796
|
-
};
|
|
3797
|
-
function ze(t) {
|
|
3798
|
-
return t?.dataStructures?.[0]?.dataStructureComponents?.dimensionList;
|
|
3799
|
-
}
|
|
3800
|
-
function Za(t) {
|
|
3801
|
-
return t?.data?.structures?.[0]?.dimensions?.series || [];
|
|
3802
|
-
}
|
|
3803
|
-
function eo(t) {
|
|
3804
|
-
return t?.data?.structures?.[0]?.dimensions?.observation?.[0].values.map((e) => e.value).filter((e) => e != null) || [];
|
|
3805
|
-
}
|
|
3806
|
-
function to(t) {
|
|
3807
|
-
return t.find(
|
|
3808
|
-
(e) => e.type === we.TIME_DIMENSION
|
|
3809
|
-
);
|
|
3810
|
-
}
|
|
3811
|
-
const no = (t) => {
|
|
3812
|
-
const e = /* @__PURE__ */ new Map(), n = t?.dataStructures?.[0], r = t?.metadataStructures?.[0], s = t?.conceptSchemes || [], a = t?.codelists || [];
|
|
3813
|
-
return t && [
|
|
3814
|
-
...ze(t)?.dimensions || [],
|
|
3815
|
-
...ze(t)?.timeDimensions || [],
|
|
3816
|
-
...Ma(r, n),
|
|
3817
|
-
...n?.dataStructureComponents?.attributeList?.attributes || []
|
|
3818
|
-
].forEach(
|
|
3819
|
-
(i) => {
|
|
3820
|
-
const c = ke(
|
|
3821
|
-
i?.conceptIdentity,
|
|
3822
|
-
s
|
|
3823
|
-
), u = i?.localRepresentation?.enumeration || c?.coreRepresentation?.enumeration, d = Ne(
|
|
3824
|
-
u,
|
|
3825
|
-
a
|
|
3826
|
-
);
|
|
3827
|
-
i?.id && (u ? e.set(i?.id, {
|
|
3828
|
-
...d,
|
|
3829
|
-
name: c?.name,
|
|
3830
|
-
names: c?.names
|
|
3831
|
-
}) : e.set(i?.id, {
|
|
3832
|
-
id: i?.id,
|
|
3833
|
-
name: c?.name,
|
|
3834
|
-
names: c?.names
|
|
3835
|
-
}));
|
|
3836
|
-
}
|
|
3837
|
-
), e;
|
|
3838
|
-
}, ro = (t) => t?.find(
|
|
3839
|
-
(e) => e.id === Oe.SERIES_COUNT
|
|
3840
|
-
)?.title || "", va = "/api/download", so = (t, e, n, r, s, a, o) => {
|
|
3841
|
-
const i = new URLSearchParams({
|
|
3842
|
-
urn: t,
|
|
3843
|
-
format: e,
|
|
3844
|
-
compress: "false",
|
|
3845
|
-
filename: a,
|
|
3846
|
-
filters: JSON.stringify(s),
|
|
3847
|
-
attribute: r,
|
|
3848
|
-
language: n,
|
|
3849
|
-
isMetadata: o ? "true" : "none"
|
|
3850
|
-
}).toString(), c = `${va}?${i}`;
|
|
3851
|
-
window.open(c, "_blank");
|
|
3852
|
-
}, ao = (t, e) => {
|
|
3853
|
-
const n = [];
|
|
3854
|
-
for (const r of t) {
|
|
3855
|
-
if (r.type !== we.DIMENSION)
|
|
3856
|
-
continue;
|
|
3857
|
-
const s = e.find((a) => a.componentCode === r.id);
|
|
3858
|
-
s != null && s.values?.length > 0 ? n.push(s.values?.join(Wt)) : n.push("*");
|
|
3859
|
-
}
|
|
3860
|
-
return n.join(".");
|
|
3861
|
-
}, Oa = (t, e) => {
|
|
3862
|
-
if (!t || !t.startPeriod && !t.endPeriod)
|
|
3863
|
-
return null;
|
|
3864
|
-
const n = [], { startPeriod: r, endPeriod: s } = t;
|
|
3865
|
-
if (r && n.push(
|
|
3866
|
-
`${R.GREATER_OR_EQUAL}${Re}${Je(r)}`
|
|
3867
|
-
), s && n.push(
|
|
3868
|
-
`${R.LESS_OR_EQUAL}${Re}${Je(s)}`
|
|
3869
|
-
), n.length === 0)
|
|
3870
|
-
return null;
|
|
3871
|
-
const a = e;
|
|
3872
|
-
return n.map(
|
|
3873
|
-
(o) => `${encodeURIComponent(`c[${a}]`)}${St}${encodeURIComponent(o)}`
|
|
3874
|
-
).join(tt);
|
|
3875
|
-
}, Je = (t) => Un(t, "yyyy-MM-dd"), oo = (t, e) => {
|
|
3876
|
-
const n = Aa(t, e) || null;
|
|
3877
|
-
return n ? Oa(n, e?.id) : null;
|
|
3878
|
-
}, Aa = (t, e) => {
|
|
3879
|
-
const n = e.id, r = t?.filters?.find(
|
|
3880
|
-
(c) => c.componentCode === n
|
|
3881
|
-
);
|
|
3882
|
-
if (!r || !r.values)
|
|
3883
|
-
return null;
|
|
3884
|
-
const s = r.values?.filter((c) => !!c);
|
|
3885
|
-
if (!s.length)
|
|
3886
|
-
return null;
|
|
3887
|
-
const a = r.operator;
|
|
3888
|
-
if (a === R.LESS_OR_EQUAL || a === R.LESS)
|
|
3889
|
-
return { startPeriod: null, endPeriod: V(s[0]) };
|
|
3890
|
-
if (a === R.GREATER_OR_EQUAL || a === R.GREATER)
|
|
3891
|
-
return { startPeriod: V(s[0]), endPeriod: null };
|
|
3892
|
-
const o = V(s[0]), i = V(s[1]);
|
|
3893
|
-
return { startPeriod: o, endPeriod: i };
|
|
3894
|
-
}, xt = (t, e, n) => {
|
|
3895
|
-
const r = k(e, !0), s = k(n), a = k(t, !0), o = k(t), i = r.getTime() > a.getTime() ? r : a, c = s.getTime() < o.getTime() ? s : o;
|
|
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;
|
|
3896
3933
|
return {
|
|
3897
3934
|
start: i,
|
|
3898
3935
|
end: c
|
|
3899
3936
|
};
|
|
3900
|
-
},
|
|
3901
|
-
const s = +t, { start: a, end: o } =
|
|
3937
|
+
}, Ia = (t, e, n, r = "W") => {
|
|
3938
|
+
const s = +t, { start: a, end: o } = Mt(t, e, n);
|
|
3902
3939
|
if (a.getTime() > o.getTime())
|
|
3903
3940
|
return [];
|
|
3904
|
-
const i =
|
|
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 = [];
|
|
3905
3942
|
if (c < d)
|
|
3906
|
-
for (let
|
|
3907
|
-
l.push(
|
|
3943
|
+
for (let m = c; m <= d; m++)
|
|
3944
|
+
l.push(Et(s, m, r));
|
|
3908
3945
|
return l;
|
|
3909
|
-
},
|
|
3946
|
+
}, _a = (t) => {
|
|
3910
3947
|
const e = new Date(t);
|
|
3911
3948
|
return e.setMinutes(e.getMinutes() - e.getTimezoneOffset()), e.toISOString().slice(0, 10);
|
|
3912
|
-
},
|
|
3913
|
-
const { start: r, end: s } =
|
|
3949
|
+
}, Ya = (t, e, n) => {
|
|
3950
|
+
const { start: r, end: s } = Mt(t, e, n);
|
|
3914
3951
|
if (r.getTime() > s.getTime())
|
|
3915
3952
|
return [];
|
|
3916
3953
|
const a = [], o = new Date(
|
|
@@ -3919,11 +3956,11 @@ const no = (t) => {
|
|
|
3919
3956
|
r.getDate()
|
|
3920
3957
|
), i = new Date(s.getFullYear(), s.getMonth(), s.getDate());
|
|
3921
3958
|
for (; o.getTime() < i.getTime(); ) {
|
|
3922
|
-
const c =
|
|
3959
|
+
const c = _a(o);
|
|
3923
3960
|
a.push(c), o.setDate(o.getDate() + 1);
|
|
3924
3961
|
}
|
|
3925
3962
|
return a;
|
|
3926
|
-
},
|
|
3963
|
+
}, Ca = (t) => ({
|
|
3927
3964
|
isDailyExist: !!t?.some(({ memberValue: e }) => e === "D"),
|
|
3928
3965
|
isWeeklyExist: !!t?.some(({ memberValue: e }) => e === "W"),
|
|
3929
3966
|
isMonthlyExist: !!t?.some(({ memberValue: e }) => e === "M"),
|
|
@@ -3932,15 +3969,15 @@ const no = (t) => {
|
|
|
3932
3969
|
isYearlyExist: !!t?.some(
|
|
3933
3970
|
({ memberValue: e }) => e === "A" || e === "Y"
|
|
3934
3971
|
)
|
|
3935
|
-
}),
|
|
3936
|
-
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;
|
|
3937
3974
|
return { startMonth: s, endMonth: a };
|
|
3938
|
-
},
|
|
3975
|
+
}, Sa = ["FREQUENCY", "FREQ"], fo = (t, e) => {
|
|
3939
3976
|
const n = t?.[0]?.cubeRegions?.[0]?.memberSelection?.find(
|
|
3940
|
-
(c) =>
|
|
3941
|
-
)?.selectionValues, r =
|
|
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 = [];
|
|
3942
3979
|
return o.forEach((c, u) => {
|
|
3943
|
-
const d = [], { startMonth: l, endMonth:
|
|
3980
|
+
const d = [], { startMonth: l, endMonth: m } = La(
|
|
3944
3981
|
o,
|
|
3945
3982
|
new Date(s),
|
|
3946
3983
|
new Date(a),
|
|
@@ -3948,142 +3985,249 @@ const no = (t) => {
|
|
|
3948
3985
|
), {
|
|
3949
3986
|
isDailyExist: x,
|
|
3950
3987
|
isWeeklyExist: P,
|
|
3951
|
-
isMonthlyExist:
|
|
3988
|
+
isMonthlyExist: N,
|
|
3952
3989
|
isQuarterlyExist: f,
|
|
3953
3990
|
isSemiAnnualExist: w,
|
|
3954
|
-
isYearlyExist:
|
|
3991
|
+
isYearlyExist: v
|
|
3955
3992
|
} = r;
|
|
3956
|
-
|
|
3957
|
-
...
|
|
3958
|
-
),
|
|
3959
|
-
...
|
|
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())
|
|
3960
3997
|
), x && d.push(
|
|
3961
|
-
...
|
|
3998
|
+
...Ya(c, s.toString(), a.toString())
|
|
3962
3999
|
), i.push(...d);
|
|
3963
4000
|
}), i;
|
|
3964
4001
|
};
|
|
3965
|
-
function
|
|
4002
|
+
function $a(t) {
|
|
3966
4003
|
const { urn: e } = t.details;
|
|
3967
|
-
return
|
|
4004
|
+
return de(e.resourceId, e.version, e.agencyId);
|
|
3968
4005
|
}
|
|
3969
|
-
function
|
|
4006
|
+
function mo(t) {
|
|
3970
4007
|
const e = {};
|
|
3971
4008
|
for (const n of t.datasets) {
|
|
3972
|
-
const r = n.dataset, s =
|
|
4009
|
+
const r = n.dataset, s = $a(r);
|
|
3973
4010
|
e[s] = r.details.dimensions;
|
|
3974
4011
|
}
|
|
3975
4012
|
return e;
|
|
3976
4013
|
}
|
|
4014
|
+
function ho(t) {
|
|
4015
|
+
return t?.codelists?.length ? t.codelists.map((e) => ({
|
|
4016
|
+
id: e.id,
|
|
4017
|
+
agencyID: e.agencyID ?? "",
|
|
4018
|
+
version: e.version ?? "",
|
|
4019
|
+
name: e.name,
|
|
4020
|
+
codes: e.codes?.map((n) => ({
|
|
4021
|
+
id: n.id,
|
|
4022
|
+
name: n.name,
|
|
4023
|
+
description: n.description
|
|
4024
|
+
}))
|
|
4025
|
+
})) : (t?.glossaries ?? []).map((e) => ({
|
|
4026
|
+
id: e.id,
|
|
4027
|
+
agencyID: e.agencyID ?? "",
|
|
4028
|
+
version: e.version ?? "",
|
|
4029
|
+
name: e.name,
|
|
4030
|
+
codes: e.terms?.map((n) => ({
|
|
4031
|
+
id: n.id,
|
|
4032
|
+
name: n.name,
|
|
4033
|
+
description: n.description
|
|
4034
|
+
}))
|
|
4035
|
+
}));
|
|
4036
|
+
}
|
|
4037
|
+
function Wa(t, e) {
|
|
4038
|
+
const n = (r) => {
|
|
4039
|
+
const s = r.indexOf("(");
|
|
4040
|
+
if (s === -1) return r;
|
|
4041
|
+
const a = r.indexOf(")", s);
|
|
4042
|
+
return a === -1 ? r : r.slice(0, s + 1) + "*" + r.slice(a);
|
|
4043
|
+
};
|
|
4044
|
+
return n(t) === n(e);
|
|
4045
|
+
}
|
|
4046
|
+
function ue(t) {
|
|
4047
|
+
return de(
|
|
4048
|
+
t.id,
|
|
4049
|
+
t.version ?? "",
|
|
4050
|
+
t.agencyID ?? ""
|
|
4051
|
+
);
|
|
4052
|
+
}
|
|
4053
|
+
function Ot(t, e, n) {
|
|
4054
|
+
e?.forEach((r) => {
|
|
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))
|
|
4057
|
+
), d = u?.codes?.find((l) => l.id === s);
|
|
4058
|
+
if (d != null) {
|
|
4059
|
+
const l = r.code.replace(
|
|
4060
|
+
c,
|
|
4061
|
+
ue(u)
|
|
4062
|
+
);
|
|
4063
|
+
t.push({ ...d, code: l });
|
|
4064
|
+
}
|
|
4065
|
+
Ot(t, r.hierarchicalCodes, n);
|
|
4066
|
+
});
|
|
4067
|
+
}
|
|
4068
|
+
function go(t, e) {
|
|
4069
|
+
const n = [];
|
|
4070
|
+
return Ot(n, t?.hierarchicalCodes, e), n;
|
|
4071
|
+
}
|
|
4072
|
+
function wo(t) {
|
|
4073
|
+
const e = {};
|
|
4074
|
+
return t?.forEach((n) => {
|
|
4075
|
+
e[ue(n)] = n.codes;
|
|
4076
|
+
}), e;
|
|
4077
|
+
}
|
|
4078
|
+
function yo(t, e, n) {
|
|
4079
|
+
if (!n || n.length === 0 || !e)
|
|
4080
|
+
return t;
|
|
4081
|
+
const r = n[0].cubeRegions?.find(
|
|
4082
|
+
(o) => o.isIncluded
|
|
4083
|
+
);
|
|
4084
|
+
if (!r) return t;
|
|
4085
|
+
const s = r.memberSelection?.find(
|
|
4086
|
+
(o) => o.componentId === e
|
|
4087
|
+
);
|
|
4088
|
+
if (!s) return [];
|
|
4089
|
+
const a = new Set(s.selectionValues.map((o) => o.memberValue));
|
|
4090
|
+
return t.filter((o) => a.has(o.id));
|
|
4091
|
+
}
|
|
4092
|
+
class po {
|
|
4093
|
+
constructor(e) {
|
|
4094
|
+
this.client = e;
|
|
4095
|
+
}
|
|
4096
|
+
async getAvailableHierarchies(e, n) {
|
|
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`;
|
|
4098
|
+
return this.client.request(
|
|
4099
|
+
`${r}/${s}/${a}?references=hierarchy&detail=allcompletestubs`,
|
|
4100
|
+
{ method: "GET" },
|
|
4101
|
+
i,
|
|
4102
|
+
n
|
|
4103
|
+
);
|
|
4104
|
+
}
|
|
4105
|
+
async getHierarchy(e, n) {
|
|
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`;
|
|
4107
|
+
return this.client.request(
|
|
4108
|
+
`${r}/${s}/${a}?references=descendants&detail=full`,
|
|
4109
|
+
{ method: "GET" },
|
|
4110
|
+
i,
|
|
4111
|
+
n
|
|
4112
|
+
);
|
|
4113
|
+
}
|
|
4114
|
+
}
|
|
3977
4115
|
export {
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
4116
|
+
ye as Annotations,
|
|
4117
|
+
qs as AssignmentStatus,
|
|
4118
|
+
qa as AvailabilityApi,
|
|
4119
|
+
$t as DATASET_DATA_URL,
|
|
4120
|
+
Ha as DatasetApi,
|
|
4121
|
+
Te as DimensionType,
|
|
4122
|
+
Ct as DownloadType,
|
|
4123
|
+
Ba as FREQUENCY_DIMENSION_ID,
|
|
4124
|
+
Sa as FREQUENCY_DIM_ID,
|
|
4125
|
+
Yt as FileColumnsAttribute,
|
|
4126
|
+
Ut as GET_v3_FILTER_ALL,
|
|
4127
|
+
Ua as GET_v3_FILTER_AND,
|
|
4128
|
+
qt as GET_v3_FILTER_OR,
|
|
4129
|
+
po as HierarchyApi,
|
|
4130
|
+
js as OBSERVATION_KEY,
|
|
4131
|
+
Us as OccurrenceType,
|
|
4132
|
+
gs as Periods,
|
|
4133
|
+
hs as RepresentationTextType,
|
|
4134
|
+
ms as SDMX_DATA_QUERY_PARAMS,
|
|
4135
|
+
ie as SINGLE_WILDCARD_SYMBOL,
|
|
4136
|
+
Qa as SdmxApiClient,
|
|
4137
|
+
nt as SdmxAvailabilityMode,
|
|
3999
4138
|
X as SdmxDataFormat,
|
|
4000
|
-
|
|
4001
|
-
|
|
4139
|
+
rt as SdmxDetails,
|
|
4140
|
+
le as SdmxReferences,
|
|
4002
4141
|
R as SeriesFilterOperator,
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4142
|
+
ws as TIME_PERIOD,
|
|
4143
|
+
ps as TIME_PERIOD_END_ANNOTATION_KEY,
|
|
4144
|
+
ys as TIME_PERIOD_START_ANNOTATION_KEY,
|
|
4145
|
+
mo as buildDatasetDimensionsMetadataMap,
|
|
4146
|
+
ia as dailyPattern,
|
|
4147
|
+
Zs as decodeDimensionId,
|
|
4148
|
+
ja as findCodelistByDimension,
|
|
4149
|
+
Ye as generateDatasetDataRequest,
|
|
4150
|
+
de as generateShortUrn,
|
|
4151
|
+
fo as getAdditionalColumns,
|
|
4013
4152
|
Va as getAnnotationPeriod,
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4153
|
+
be as getArtifactByUrnWithWildCard,
|
|
4154
|
+
za as getAttachedDimensionsSeriesByDimension,
|
|
4155
|
+
Ss as getAttachedDimensionsSeriesByTsId,
|
|
4156
|
+
Tt as getAttachedDimensionsSeriesKey,
|
|
4157
|
+
$s as getAttributeValueFromDataQueryResponse,
|
|
4158
|
+
Ka as getAvailableCodes,
|
|
4159
|
+
Ga as getAvailableCodesFromConstrains,
|
|
4160
|
+
tt as getChildParsedUrn,
|
|
4161
|
+
wo as getCodeListsData,
|
|
4162
|
+
De as getConcept,
|
|
4163
|
+
Xe as getConceptByUrn,
|
|
4164
|
+
Cs as getConceptWithScheme,
|
|
4165
|
+
Ws as getConvertedMetaAttributes,
|
|
4166
|
+
da as getDailyRegExp,
|
|
4167
|
+
Ya as getDaysColumns,
|
|
4028
4168
|
Ja as getDimensionTitle,
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4169
|
+
je as getDimensions,
|
|
4170
|
+
fs as getFilteredItemsWithParents,
|
|
4171
|
+
Ps as getFiltersDtoFromDataQuery,
|
|
4172
|
+
Xa as getFiltersDtoMapFromDataQuery,
|
|
4173
|
+
yo as getHierarchyAvailableCodes,
|
|
4174
|
+
go as getHierarchyCodes,
|
|
4175
|
+
ee as getISOWeek,
|
|
4034
4176
|
K as getKeyFromUrn,
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4177
|
+
Fa as getLastUpdatedTime,
|
|
4178
|
+
ze as getLastWeekNumberOfYear,
|
|
4179
|
+
pe as getLocalizedName,
|
|
4180
|
+
Aa as getMonthlyData,
|
|
4181
|
+
uo as getMonthlyDataByQuarter,
|
|
4182
|
+
Ae as getMonthlyRegExp,
|
|
4183
|
+
Pt as getParsedEndPeriodDate,
|
|
4184
|
+
io as getParsedResponse,
|
|
4185
|
+
xt as getParsedStartPeriodDate,
|
|
4186
|
+
I as getPeriodDate,
|
|
4187
|
+
Ca as getPeriods,
|
|
4188
|
+
co as getQuarterByMonth,
|
|
4189
|
+
ke as getQuarterlyRegExp,
|
|
4190
|
+
Pa as getQuartersData,
|
|
4191
|
+
Gs as getQueryTimePeriodFilters,
|
|
4192
|
+
Lt as getRequestAcceptHeader,
|
|
4193
|
+
Rs as getResolvedVersionBySingleWildcard,
|
|
4194
|
+
va as getSemiAnnualData,
|
|
4195
|
+
ua as getSemiAnnuallyRegExp,
|
|
4196
|
+
ce as getSeriesAttributes,
|
|
4197
|
+
zs as getSeriesName,
|
|
4056
4198
|
no as getStructureComponentsMap,
|
|
4057
4199
|
Za as getStructureDimensions,
|
|
4058
4200
|
to as getTimeDimension,
|
|
4059
4201
|
eo as getTimePeriods,
|
|
4060
4202
|
oo as getTimeQueryFilter,
|
|
4061
|
-
|
|
4203
|
+
Xs as getTimeRangeFromAttachment,
|
|
4062
4204
|
ro as getTimeSeriesCount,
|
|
4063
4205
|
ao as getTimeSeriesFilterKey,
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4206
|
+
Js as getTimeSeriesId,
|
|
4207
|
+
Et as getWeekCode,
|
|
4208
|
+
Fs as getWeeklyPeriodEndDate,
|
|
4209
|
+
Qs as getWeeklyPeriodStartDate,
|
|
4210
|
+
fa as getWeeklyRegExp,
|
|
4211
|
+
Ia as getWeeksColumns,
|
|
4212
|
+
_s as getWildCardPrefix,
|
|
4213
|
+
Mt as getYearPeriod,
|
|
4214
|
+
ve as getYearlyRegExp,
|
|
4215
|
+
Na as getYears,
|
|
4216
|
+
la as isDaily,
|
|
4217
|
+
Ne as isMonthly,
|
|
4218
|
+
Re as isQuarterly,
|
|
4219
|
+
Oe as isSemiAnnually,
|
|
4220
|
+
Ie as isWeekly,
|
|
4221
|
+
Ys as isWildCardVersionCorrect,
|
|
4222
|
+
Me as isYearly,
|
|
4223
|
+
ca as monthlyPattern,
|
|
4082
4224
|
so as openDownloadWindow,
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4225
|
+
ra as quarterPattern,
|
|
4226
|
+
ho as resolveCodelistsFromResponse,
|
|
4227
|
+
aa as semiAnnuallyPattern,
|
|
4228
|
+
lo as sortPeriods,
|
|
4229
|
+
C as splitUrn,
|
|
4230
|
+
Wa as urnMatchesIgnoreVersion,
|
|
4231
|
+
sa as weeklyPattern,
|
|
4232
|
+
oa as yearlyPattern
|
|
4089
4233
|
};
|