@epam/statgpt-sdmx-toolkit 0.4.0-rc.4 → 0.4.0-rc.40
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 +1282 -1151
- 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/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(It)
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function It(t) {
|
|
48
48
|
return {
|
|
49
49
|
included: t.include,
|
|
50
50
|
componentId: t.id,
|
|
51
|
-
selectionValues: t.values.map(
|
|
51
|
+
selectionValues: t.values.map(Rt)
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Rt(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 Wa {
|
|
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), c = {
|
|
66
66
|
filters: n || [],
|
|
67
|
-
mode:
|
|
68
|
-
references:
|
|
69
|
-
}, i =
|
|
67
|
+
mode: nt.AVAILABLE,
|
|
68
|
+
references: le.NONE
|
|
69
|
+
}, i = _t(s, a, o);
|
|
70
70
|
if (this.client.config.sdmxProxyUrl) {
|
|
71
|
-
const
|
|
71
|
+
const u = await this.client.postRequest(
|
|
72
72
|
i,
|
|
73
|
-
{ body:
|
|
74
|
-
this.client.config.sdmxProxyUrl
|
|
73
|
+
{ body: c },
|
|
74
|
+
this.client.config.sdmxProxyUrl,
|
|
75
|
+
r
|
|
75
76
|
);
|
|
76
|
-
return
|
|
77
|
+
return At(u);
|
|
77
78
|
}
|
|
78
79
|
return await this.client.postRequest(
|
|
79
80
|
i,
|
|
80
|
-
{ body:
|
|
81
|
-
this.client.config.constrainsApiUrl || this.client.config.apiUrl
|
|
81
|
+
{ body: c },
|
|
82
|
+
this.client.config.constrainsApiUrl || this.client.config.apiUrl,
|
|
83
|
+
r
|
|
82
84
|
);
|
|
83
85
|
}
|
|
84
86
|
}
|
|
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 St = (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:
|
|
110
|
-
return `${`${
|
|
111
|
-
},
|
|
112
|
-
class
|
|
109
|
+
var rt = /* @__PURE__ */ ((t) => (t.REFERENCE_PARTIAL = "referencepartial", t.FULL = "full", t))(rt || {});
|
|
110
|
+
const Lt = "all", $t = "sdmx/3.0/data/dataflow", st = "&", _e = ":", Wt = "=", qt = "+", qa = ",", Ht = "*", Ye = (t, e, n) => {
|
|
111
|
+
const { filterKey: r, timeFilter: s } = n, { agency: a, id: o, version: c } = C(t), i = [s || "", e].filter((d) => !!d).join(st);
|
|
112
|
+
return `${`${$t}/${a}/${o}/${c}`}/${r || Ht}?${i}`;
|
|
113
|
+
}, Qt = (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
|
+
Qt(s, a, o, n),
|
|
122
|
+
void 0,
|
|
123
|
+
r
|
|
120
124
|
);
|
|
121
125
|
}
|
|
122
|
-
async getDatasetData(e, n) {
|
|
123
|
-
const
|
|
126
|
+
async getDatasetData(e, n, r) {
|
|
127
|
+
const s = new URLSearchParams({
|
|
124
128
|
includeHistory: "false",
|
|
125
129
|
limit: "1000",
|
|
126
|
-
attributes:
|
|
130
|
+
attributes: Lt,
|
|
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,
|
|
133
|
-
const
|
|
140
|
+
async downloadDataSet(e, n, r, s, a, o, c = !1, i) {
|
|
141
|
+
const u = new URLSearchParams({
|
|
134
142
|
format: n,
|
|
135
143
|
compress: "false",
|
|
136
|
-
attributes:
|
|
144
|
+
attributes: c ? "all" : "none",
|
|
137
145
|
limit: "1000"
|
|
138
|
-
}).toString(),
|
|
146
|
+
}).toString(), d = 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: St(n, s),
|
|
145
153
|
"Accept-language": r
|
|
146
154
|
}
|
|
147
155
|
},
|
|
148
|
-
o
|
|
156
|
+
o,
|
|
157
|
+
i
|
|
149
158
|
);
|
|
150
159
|
}
|
|
151
160
|
}
|
|
152
|
-
const
|
|
153
|
-
class
|
|
161
|
+
const Ft = (t, e) => t.error || t.message || `${e.status} ${e.statusText}`, Ut = "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, Se = /* @__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" && Se in t ? t[Se](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
186
|
function L(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
192
|
const a = L(s), o = E(n, 0);
|
|
184
193
|
o.setFullYear(r, 0, 4), o.setHours(0, 0, 0, 0);
|
|
185
|
-
const
|
|
186
|
-
return n.getTime() >= a.getTime() ? r + 1 : n.getTime() >=
|
|
194
|
+
const c = L(o);
|
|
195
|
+
return n.getTime() >= a.getTime() ? r + 1 : n.getTime() >= c.getTime() ? r : r - 1;
|
|
187
196
|
}
|
|
188
|
-
function
|
|
189
|
-
const e =
|
|
197
|
+
function J(t) {
|
|
198
|
+
const e = p(t), n = new Date(
|
|
190
199
|
Date.UTC(
|
|
191
200
|
e.getFullYear(),
|
|
192
201
|
e.getMonth(),
|
|
@@ -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 Le(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((
|
|
227
|
+
), a = Le(r), o = Le(s), c = +a - J(a), i = +o - J(o);
|
|
228
|
+
return Math.round((c - i) / Gt);
|
|
220
229
|
}
|
|
221
|
-
function
|
|
222
|
-
const n =
|
|
230
|
+
function Jt(t, e) {
|
|
231
|
+
const n = it(t, e), r = E(t, 0);
|
|
223
232
|
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), L(r);
|
|
224
233
|
}
|
|
225
|
-
function
|
|
234
|
+
function 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,66 +314,66 @@ 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 H(t) {
|
|
345
354
|
return (e, n) => {
|
|
346
355
|
const r = n?.context ? String(n.context) : "standalone";
|
|
347
356
|
let s;
|
|
348
357
|
if (r === "formatting" && t.formattingValues) {
|
|
349
|
-
const o = t.defaultFormattingWidth || t.defaultWidth,
|
|
350
|
-
s = t.formattingValues[
|
|
358
|
+
const o = t.defaultFormattingWidth || t.defaultWidth, c = n?.width ? String(n.width) : o;
|
|
359
|
+
s = t.formattingValues[c] || t.formattingValues[o];
|
|
351
360
|
} else {
|
|
352
|
-
const o = t.defaultWidth,
|
|
353
|
-
s = t.values[
|
|
361
|
+
const o = t.defaultWidth, c = n?.width ? String(n.width) : t.defaultWidth;
|
|
362
|
+
s = t.values[c] || t.values[o];
|
|
354
363
|
}
|
|
355
364
|
const a = t.argumentCallback ? t.argumentCallback(e) : e;
|
|
356
365
|
return s[a];
|
|
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,29 +490,29 @@ 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: H({
|
|
496
|
+
values: dn,
|
|
488
497
|
defaultWidth: "wide"
|
|
489
498
|
}),
|
|
490
|
-
quarter:
|
|
491
|
-
values:
|
|
499
|
+
quarter: H({
|
|
500
|
+
values: ln,
|
|
492
501
|
defaultWidth: "wide",
|
|
493
502
|
argumentCallback: (t) => t - 1
|
|
494
503
|
}),
|
|
495
|
-
month:
|
|
496
|
-
values:
|
|
504
|
+
month: H({
|
|
505
|
+
values: fn,
|
|
497
506
|
defaultWidth: "wide"
|
|
498
507
|
}),
|
|
499
|
-
day:
|
|
500
|
-
values:
|
|
508
|
+
day: H({
|
|
509
|
+
values: mn,
|
|
501
510
|
defaultWidth: "wide"
|
|
502
511
|
}),
|
|
503
|
-
dayPeriod:
|
|
504
|
-
values:
|
|
512
|
+
dayPeriod: H({
|
|
513
|
+
values: hn,
|
|
505
514
|
defaultWidth: "wide",
|
|
506
|
-
formattingValues:
|
|
515
|
+
formattingValues: gn,
|
|
507
516
|
defaultFormattingWidth: "wide"
|
|
508
517
|
})
|
|
509
518
|
};
|
|
@@ -512,12 +521,12 @@ function Q(t) {
|
|
|
512
521
|
const r = n.width, s = r && t.matchPatterns[r] || t.matchPatterns[t.defaultMatchWidth], a = e.match(s);
|
|
513
522
|
if (!a)
|
|
514
523
|
return null;
|
|
515
|
-
const o = a[0],
|
|
524
|
+
const o = a[0], c = r && t.parsePatterns[r] || t.parsePatterns[t.defaultParseWidth], i = Array.isArray(c) ? bn(c, (l) => l.test(o)) : (
|
|
516
525
|
// [TODO] -- I challenge you to fix the type
|
|
517
|
-
|
|
526
|
+
pn(c, (l) => l.test(o))
|
|
518
527
|
);
|
|
519
528
|
let u;
|
|
520
|
-
u = t.valueCallback ? t.valueCallback(
|
|
529
|
+
u = t.valueCallback ? t.valueCallback(i) : i, u = n.valueCallback ? (
|
|
521
530
|
// [TODO] -- I challenge you to fix the type
|
|
522
531
|
n.valueCallback(u)
|
|
523
532
|
) : u;
|
|
@@ -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;
|
|
@@ -543,27 +552,27 @@ function yn(t) {
|
|
|
543
552
|
if (!a) return null;
|
|
544
553
|
let o = t.valueCallback ? t.valueCallback(a[0]) : a[0];
|
|
545
554
|
o = n.valueCallback ? n.valueCallback(o) : o;
|
|
546
|
-
const
|
|
547
|
-
return { value: o, rest:
|
|
555
|
+
const c = e.slice(s.length);
|
|
556
|
+
return { value: o, rest: c };
|
|
548
557
|
};
|
|
549
558
|
}
|
|
550
|
-
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
|
+
}, In = {
|
|
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
|
+
}, Rn = {
|
|
607
616
|
any: {
|
|
608
617
|
am: /^a/i,
|
|
609
618
|
pm: /^p/i,
|
|
@@ -614,84 +623,84 @@ 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
632
|
era: Q({
|
|
624
|
-
matchPatterns:
|
|
633
|
+
matchPatterns: xn,
|
|
625
634
|
defaultMatchWidth: "wide",
|
|
626
|
-
parsePatterns:
|
|
635
|
+
parsePatterns: Pn,
|
|
627
636
|
defaultParseWidth: "any"
|
|
628
637
|
}),
|
|
629
638
|
quarter: Q({
|
|
630
|
-
matchPatterns:
|
|
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
645
|
month: Q({
|
|
637
|
-
matchPatterns:
|
|
646
|
+
matchPatterns: On,
|
|
638
647
|
defaultMatchWidth: "wide",
|
|
639
|
-
parsePatterns:
|
|
648
|
+
parsePatterns: An,
|
|
640
649
|
defaultParseWidth: "any"
|
|
641
650
|
}),
|
|
642
651
|
day: Q({
|
|
643
|
-
matchPatterns:
|
|
652
|
+
matchPatterns: Nn,
|
|
644
653
|
defaultMatchWidth: "wide",
|
|
645
|
-
parsePatterns:
|
|
654
|
+
parsePatterns: kn,
|
|
646
655
|
defaultParseWidth: "any"
|
|
647
656
|
}),
|
|
648
657
|
dayPeriod: Q({
|
|
649
|
-
matchPatterns:
|
|
658
|
+
matchPatterns: In,
|
|
650
659
|
defaultMatchWidth: "any",
|
|
651
|
-
parsePatterns:
|
|
660
|
+
parsePatterns: Rn,
|
|
652
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 = +L(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
|
-
const
|
|
678
|
-
|
|
679
|
-
const u = _(
|
|
680
|
-
return +n >= +
|
|
686
|
+
const c = _(o, e), i = E(e?.in || t, 0);
|
|
687
|
+
i.setFullYear(r, 0, a), i.setHours(0, 0, 0, 0);
|
|
688
|
+
const u = _(i, e);
|
|
689
|
+
return +n >= +c ? 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
699
|
function h(t, e) {
|
|
691
700
|
const n = t < 0 ? "-" : "", r = Math.abs(t).toString().padStart(e, "0");
|
|
692
701
|
return n + r;
|
|
693
702
|
}
|
|
694
|
-
const
|
|
703
|
+
const k = {
|
|
695
704
|
// Year
|
|
696
705
|
y(t, e) {
|
|
697
706
|
const n = t.getFullYear(), r = n > 0 ? n : 1 - n;
|
|
@@ -744,14 +753,14 @@ const N = {
|
|
|
744
753
|
);
|
|
745
754
|
return h(s, e.length);
|
|
746
755
|
}
|
|
747
|
-
},
|
|
756
|
+
}, S = {
|
|
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,11 +783,11 @@ 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
793
|
return h(o, 2);
|
|
@@ -787,7 +796,7 @@ const N = {
|
|
|
787
796
|
},
|
|
788
797
|
// ISO week-numbering year
|
|
789
798
|
R: function(t, e) {
|
|
790
|
-
const n =
|
|
799
|
+
const n = it(t);
|
|
791
800
|
return h(n, e.length);
|
|
792
801
|
},
|
|
793
802
|
// Extended year. This is a single number designating the year of this calendar system.
|
|
@@ -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" });
|
|
@@ -924,21 +933,21 @@ const N = {
|
|
|
924
933
|
},
|
|
925
934
|
// Local week of year
|
|
926
935
|
w: function(t, e, n, r) {
|
|
927
|
-
const s =
|
|
936
|
+
const s = dt(t, r);
|
|
928
937
|
return e === "wo" ? n.ordinalNumber(s, { unit: "week" }) : h(s, e.length);
|
|
929
938
|
},
|
|
930
939
|
// ISO week of year
|
|
931
940
|
I: function(t, e, n) {
|
|
932
|
-
const r =
|
|
941
|
+
const r = ut(t);
|
|
933
942
|
return e === "Io" ? n.ordinalNumber(r, { unit: "week" }) : h(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 =
|
|
950
|
+
const r = Yn(t);
|
|
942
951
|
return e === "Do" ? n.ordinalNumber(r, { unit: "dayOfYear" }) : h(r, e.length);
|
|
943
952
|
},
|
|
944
953
|
// Day of week
|
|
@@ -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 = S.noon : r === 0 ? s = S.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 = S.evening : r >= 12 ? s = S.afternoon : r >= 4 ? s = S.morning : s = S.night, e) {
|
|
1147
1156
|
case "B":
|
|
1148
1157
|
case "BB":
|
|
1149
1158
|
case "BBB":
|
|
@@ -1169,11 +1178,11 @@ const N = {
|
|
|
1169
1178
|
let r = t.getHours() % 12;
|
|
1170
1179
|
return r === 0 && (r = 12), n.ordinalNumber(r, { unit: "hour" });
|
|
1171
1180
|
}
|
|
1172
|
-
return
|
|
1181
|
+
return k.h(t, e);
|
|
1173
1182
|
},
|
|
1174
1183
|
// Hour [0-23]
|
|
1175
1184
|
H: function(t, e, n) {
|
|
1176
|
-
return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) :
|
|
1185
|
+
return e === "Ho" ? n.ordinalNumber(t.getHours(), { unit: "hour" }) : k.H(t, e);
|
|
1177
1186
|
},
|
|
1178
1187
|
// Hour [0-11]
|
|
1179
1188
|
K: function(t, e, n) {
|
|
@@ -1187,15 +1196,15 @@ const N = {
|
|
|
1187
1196
|
},
|
|
1188
1197
|
// Minute
|
|
1189
1198
|
m: function(t, e, n) {
|
|
1190
|
-
return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) :
|
|
1199
|
+
return e === "mo" ? n.ordinalNumber(t.getMinutes(), { unit: "minute" }) : k.m(t, e);
|
|
1191
1200
|
},
|
|
1192
1201
|
// Second
|
|
1193
1202
|
s: function(t, e, n) {
|
|
1194
|
-
return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) :
|
|
1203
|
+
return e === "so" ? n.ordinalNumber(t.getSeconds(), { unit: "second" }) : k.s(t, e);
|
|
1195
1204
|
},
|
|
1196
1205
|
// Fraction of second
|
|
1197
1206
|
S: function(t, e) {
|
|
1198
|
-
return
|
|
1207
|
+
return k.S(t, e);
|
|
1199
1208
|
},
|
|
1200
1209
|
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
1201
1210
|
X: function(t, e, n) {
|
|
@@ -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,9 +1265,9 @@ 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
|
|
@@ -1271,18 +1280,18 @@ const N = {
|
|
|
1271
1280
|
return h(+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
1285
|
return a === 0 ? n + String(s) : n + String(s) + e + h(a, 2);
|
|
1277
1286
|
}
|
|
1278
|
-
function
|
|
1279
|
-
return t % 60 === 0 ? (t > 0 ? "-" : "+") + h(Math.abs(t) / 60, 2) :
|
|
1287
|
+
function qe(t, e) {
|
|
1288
|
+
return t % 60 === 0 ? (t > 0 ? "-" : "+") + h(Math.abs(t) / 60, 2) : Y(t, e);
|
|
1280
1289
|
}
|
|
1281
|
-
function
|
|
1290
|
+
function Y(t, e = "") {
|
|
1282
1291
|
const n = t > 0 ? "-" : "+", r = Math.abs(t), s = h(Math.trunc(r / 60), 2), a = h(r % 60, 2);
|
|
1283
1292
|
return n + s + e + a;
|
|
1284
1293
|
}
|
|
1285
|
-
const
|
|
1294
|
+
const He = (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
|
+
}, Sn = (t, e) => {
|
|
1308
1317
|
const n = t.match(/(P+)(p+)?/) || [], r = n[1], s = n[2];
|
|
1309
1318
|
if (!s)
|
|
1310
|
-
return
|
|
1319
|
+
return He(t, e);
|
|
1311
1320
|
let a;
|
|
1312
1321
|
switch (r) {
|
|
1313
1322
|
case "P":
|
|
@@ -1323,78 +1332,78 @@ 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}}", He(r, e)).replace("{{time}}", lt(s, e));
|
|
1327
1336
|
}, se = {
|
|
1328
|
-
p:
|
|
1329
|
-
P:
|
|
1330
|
-
},
|
|
1331
|
-
function
|
|
1332
|
-
return Cn.test(t);
|
|
1333
|
-
}
|
|
1334
|
-
function dt(t) {
|
|
1337
|
+
p: lt,
|
|
1338
|
+
P: Sn
|
|
1339
|
+
}, Ln = /^D+$/, $n = /^Y+$/, Wn = ["D", "DD", "YY", "YYYY"];
|
|
1340
|
+
function ft(t) {
|
|
1335
1341
|
return Ln.test(t);
|
|
1336
1342
|
}
|
|
1343
|
+
function mt(t) {
|
|
1344
|
+
return $n.test(t);
|
|
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 =
|
|
1348
|
-
if (!re(
|
|
1354
|
+
const Hn = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Qn = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Fn = /^'([^]*?)'?$/, Un = /''/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, c = p(t, n?.in);
|
|
1357
|
+
if (!re(c))
|
|
1349
1358
|
throw new RangeError("Invalid time value");
|
|
1350
|
-
let
|
|
1359
|
+
let i = e.match(Qn).map((d) => {
|
|
1351
1360
|
const l = d[0];
|
|
1352
1361
|
if (l === "p" || l === "P") {
|
|
1353
|
-
const
|
|
1354
|
-
return
|
|
1362
|
+
const w = se[l];
|
|
1363
|
+
return w(d, s.formatLong);
|
|
1355
1364
|
}
|
|
1356
1365
|
return d;
|
|
1357
|
-
}).join("").match(
|
|
1366
|
+
}).join("").match(Hn).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
|
);
|
|
1369
1378
|
return { isToken: !1, value: d };
|
|
1370
1379
|
});
|
|
1371
|
-
s.localize.preprocessor && (
|
|
1380
|
+
s.localize.preprocessor && (i = s.localize.preprocessor(c, i));
|
|
1372
1381
|
const u = {
|
|
1373
1382
|
firstWeekContainsDate: a,
|
|
1374
1383
|
weekStartsOn: o,
|
|
1375
1384
|
locale: s
|
|
1376
1385
|
};
|
|
1377
|
-
return
|
|
1386
|
+
return i.map((d) => {
|
|
1378
1387
|
if (!d.isToken) return d.value;
|
|
1379
1388
|
const l = d.value;
|
|
1380
|
-
(
|
|
1381
|
-
const
|
|
1382
|
-
return
|
|
1389
|
+
(mt(l) || ft(l)) && ae(l, e, String(t));
|
|
1390
|
+
const w = $e[l[0]];
|
|
1391
|
+
return w(c, l, s.localize, u);
|
|
1383
1392
|
}).join("");
|
|
1384
1393
|
}
|
|
1385
|
-
function
|
|
1386
|
-
const e = t.match(
|
|
1387
|
-
return e ? e[1].replace(
|
|
1394
|
+
function Gn(t) {
|
|
1395
|
+
const e = t.match(Fn);
|
|
1396
|
+
return e ? e[1].replace(Un, "'") : 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
1445
|
class m {
|
|
1437
1446
|
run(e, n, r, s) {
|
|
1438
1447
|
const a = this.parse(e, n, r, s);
|
|
1439
1448
|
return a ? {
|
|
1440
|
-
setter: new
|
|
1449
|
+
setter: new 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 m {
|
|
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,21 +1599,21 @@ 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)
|
|
1597
1606
|
s = t || 100;
|
|
1598
1607
|
else {
|
|
1599
|
-
const a = r + 50, o = Math.trunc(a / 100) * 100,
|
|
1600
|
-
s = t + o - (
|
|
1608
|
+
const a = r + 50, o = Math.trunc(a / 100) * 100, c = t >= a % 100;
|
|
1609
|
+
s = t + o - (c ? 100 : 0);
|
|
1601
1610
|
}
|
|
1602
1611
|
return n ? s : 1 - s;
|
|
1603
1612
|
}
|
|
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 m {
|
|
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 m {
|
|
1646
1655
|
priority = 130;
|
|
1647
1656
|
parse(e, n, r) {
|
|
1648
1657
|
const s = (a) => ({
|
|
@@ -1667,14 +1676,14 @@ 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
|
|
1681
|
+
const c = wt(
|
|
1673
1682
|
r.year,
|
|
1674
1683
|
a
|
|
1675
1684
|
);
|
|
1676
1685
|
return e.setFullYear(
|
|
1677
|
-
|
|
1686
|
+
c,
|
|
1678
1687
|
0,
|
|
1679
1688
|
s.firstWeekContainsDate
|
|
1680
1689
|
), e.setHours(0, 0, 0, 0), _(e, s);
|
|
@@ -1698,10 +1707,10 @@ class tr extends m {
|
|
|
1698
1707
|
"T"
|
|
1699
1708
|
];
|
|
1700
1709
|
}
|
|
1701
|
-
class
|
|
1710
|
+
class sr extends m {
|
|
1702
1711
|
priority = 130;
|
|
1703
1712
|
parse(e, n) {
|
|
1704
|
-
return
|
|
1713
|
+
return Z(n === "R" ? 4 : n.length, e);
|
|
1705
1714
|
}
|
|
1706
1715
|
set(e, n, r) {
|
|
1707
1716
|
const s = E(e, 0);
|
|
@@ -1725,17 +1734,17 @@ class nr extends m {
|
|
|
1725
1734
|
"T"
|
|
1726
1735
|
];
|
|
1727
1736
|
}
|
|
1728
|
-
class
|
|
1737
|
+
class ar extends m {
|
|
1729
1738
|
priority = 130;
|
|
1730
1739
|
parse(e, n) {
|
|
1731
|
-
return
|
|
1740
|
+
return Z(n === "u" ? 4 : n.length, e);
|
|
1732
1741
|
}
|
|
1733
1742
|
set(e, n, r) {
|
|
1734
1743
|
return e.setFullYear(r, 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
1735
1744
|
}
|
|
1736
1745
|
incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"];
|
|
1737
1746
|
}
|
|
1738
|
-
class
|
|
1747
|
+
class or extends m {
|
|
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 m {
|
|
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 m {
|
|
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 m {
|
|
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 m {
|
|
1993
2002
|
priority = 100;
|
|
1994
2003
|
parse(e, n, r) {
|
|
1995
2004
|
switch (n) {
|
|
1996
2005
|
case "w":
|
|
1997
|
-
return
|
|
2006
|
+
return y(D.week, e);
|
|
1998
2007
|
case "wo":
|
|
1999
2008
|
return r.ordinalNumber(e, { unit: "week" });
|
|
2000
2009
|
default:
|
|
@@ -2005,7 +2014,7 @@ class ur extends m {
|
|
|
2005
2014
|
return n >= 1 && n <= 53;
|
|
2006
2015
|
}
|
|
2007
2016
|
set(e, n, r, s) {
|
|
2008
|
-
return _(
|
|
2017
|
+
return _(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 m {
|
|
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 L(
|
|
2055
|
+
return L(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 m {
|
|
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 m {
|
|
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(), i = (e % 7 + 7) % 7, u = 7 - s, d = e < 0 || e > 6 ? e - (o + u) % 7 : (i + u) % 7 - (o + u) % 7;
|
|
2164
|
+
return ot(a, d, n);
|
|
2156
2165
|
}
|
|
2157
|
-
class
|
|
2166
|
+
class pr extends m {
|
|
2158
2167
|
priority = 90;
|
|
2159
2168
|
parse(e, n, r) {
|
|
2160
2169
|
switch (n) {
|
|
@@ -2186,16 +2195,16 @@ 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 m {
|
|
2194
2203
|
priority = 90;
|
|
2195
2204
|
parse(e, n, r, s) {
|
|
2196
2205
|
const a = (o) => {
|
|
2197
|
-
const
|
|
2198
|
-
return (o + s.weekStartsOn + 6) % 7 +
|
|
2206
|
+
const c = Math.floor((o - 1) / 7) * 7;
|
|
2207
|
+
return (o + s.weekStartsOn + 6) % 7 + c;
|
|
2199
2208
|
};
|
|
2200
2209
|
switch (n) {
|
|
2201
2210
|
// 3
|
|
@@ -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,12 +2265,12 @@ class pr extends m {
|
|
|
2256
2265
|
"T"
|
|
2257
2266
|
];
|
|
2258
2267
|
}
|
|
2259
|
-
class
|
|
2268
|
+
class Dr extends m {
|
|
2260
2269
|
priority = 90;
|
|
2261
2270
|
parse(e, n, r, s) {
|
|
2262
2271
|
const a = (o) => {
|
|
2263
|
-
const
|
|
2264
|
-
return (o + s.weekStartsOn + 6) % 7 +
|
|
2272
|
+
const c = Math.floor((o - 1) / 7) * 7;
|
|
2273
|
+
return (o + s.weekStartsOn + 6) % 7 + c;
|
|
2265
2274
|
};
|
|
2266
2275
|
switch (n) {
|
|
2267
2276
|
// 3
|
|
@@ -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 m {
|
|
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 m {
|
|
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 m {
|
|
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 m {
|
|
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 m {
|
|
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 m {
|
|
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 m {
|
|
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 m {
|
|
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 m {
|
|
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 Ir extends m {
|
|
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 Rr extends m {
|
|
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 m {
|
|
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 m {
|
|
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 m {
|
|
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 Sr extends m {
|
|
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
|
-
},
|
|
2783
|
-
function
|
|
2784
|
-
const s = () => E(n, NaN), a =
|
|
2759
|
+
const Lr = {
|
|
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 Ir(),
|
|
2786
|
+
S: new Rr(),
|
|
2787
|
+
X: new _r(),
|
|
2788
|
+
x: new Yr(),
|
|
2789
|
+
t: new Cr(),
|
|
2790
|
+
T: new Sr()
|
|
2791
|
+
}, $r = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Wr = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, qr = /^'([^]*?)'?$/, Hr = /''/g, Qr = /\S/, Fr = /[a-zA-Z]/;
|
|
2792
|
+
function Ur(t, e, n, r) {
|
|
2793
|
+
const s = () => E(n, NaN), a = Xn(), o = a.locale ?? ct, c = a.firstWeekContainsDate ?? a.locale?.options?.firstWeekContainsDate ?? 1, i = a.weekStartsOn ?? a.locale?.options?.weekStartsOn ?? 0;
|
|
2785
2794
|
if (!e)
|
|
2786
|
-
return t ? s() :
|
|
2795
|
+
return t ? s() : p(n, r?.in);
|
|
2787
2796
|
const u = {
|
|
2788
|
-
firstWeekContainsDate:
|
|
2789
|
-
weekStartsOn:
|
|
2797
|
+
firstWeekContainsDate: c,
|
|
2798
|
+
weekStartsOn: i,
|
|
2790
2799
|
locale: o
|
|
2791
|
-
}, d = [new
|
|
2792
|
-
const
|
|
2793
|
-
if (
|
|
2794
|
-
const
|
|
2795
|
-
return
|
|
2800
|
+
}, d = [new er(r?.in, n)], l = e.match(Wr).map((f) => {
|
|
2801
|
+
const g = f[0];
|
|
2802
|
+
if (g in se) {
|
|
2803
|
+
const P = se[g];
|
|
2804
|
+
return P(f, o.formatLong);
|
|
2796
2805
|
}
|
|
2797
2806
|
return f;
|
|
2798
|
-
}).join("").match(
|
|
2807
|
+
}).join("").match($r), w = [];
|
|
2799
2808
|
for (let f of l) {
|
|
2800
|
-
|
|
2801
|
-
const
|
|
2802
|
-
if (
|
|
2803
|
-
const { incompatibleTokens:
|
|
2804
|
-
if (Array.isArray(
|
|
2805
|
-
const
|
|
2806
|
-
(U) =>
|
|
2809
|
+
mt(f) && ae(f, e, t), ft(f) && ae(f, e, t);
|
|
2810
|
+
const g = f[0], P = Lr[g];
|
|
2811
|
+
if (P) {
|
|
2812
|
+
const { incompatibleTokens: M } = P;
|
|
2813
|
+
if (Array.isArray(M)) {
|
|
2814
|
+
const q = w.find(
|
|
2815
|
+
(U) => M.includes(U.token) || U.token === g
|
|
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 (P.incompatibleTokens === "*" && w.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
|
+
w.push({ token: g, fullToken: f });
|
|
2826
|
+
const W = P.run(
|
|
2818
2827
|
t,
|
|
2819
2828
|
f,
|
|
2820
2829
|
o.match,
|
|
@@ -2824,51 +2833,51 @@ function Fr(t, e, n, r) {
|
|
|
2824
2833
|
return s();
|
|
2825
2834
|
d.push(W.setter), t = W.rest;
|
|
2826
2835
|
} else {
|
|
2827
|
-
if (
|
|
2836
|
+
if (g.match(Fr))
|
|
2828
2837
|
throw new RangeError(
|
|
2829
|
-
"Format string contains an unescaped latin alphabet character `" +
|
|
2838
|
+
"Format string contains an unescaped latin alphabet character `" + g + "`"
|
|
2830
2839
|
);
|
|
2831
|
-
if (f === "''" ? f = "'" :
|
|
2840
|
+
if (f === "''" ? f = "'" : g === "'" && (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 && Qr.test(t))
|
|
2838
2847
|
return s();
|
|
2839
|
-
const
|
|
2840
|
-
(f) => d.filter((
|
|
2848
|
+
const v = d.map((f) => f.priority).sort((f, g) => g - f).filter((f, g, P) => P.indexOf(f) === g).map(
|
|
2849
|
+
(f) => d.filter((g) => g.priority === f).sort((g, P) => P.subPriority - g.subPriority)
|
|
2841
2850
|
).map((f) => f[0]);
|
|
2842
|
-
let
|
|
2843
|
-
if (isNaN(+
|
|
2844
|
-
const
|
|
2845
|
-
for (const f of
|
|
2846
|
-
if (!f.validate(
|
|
2851
|
+
let x = p(n, r?.in);
|
|
2852
|
+
if (isNaN(+x)) return s();
|
|
2853
|
+
const N = {};
|
|
2854
|
+
for (const f of v) {
|
|
2855
|
+
if (!f.validate(x, u))
|
|
2847
2856
|
return s();
|
|
2848
|
-
const
|
|
2849
|
-
Array.isArray(
|
|
2857
|
+
const g = f.set(x, N, u);
|
|
2858
|
+
Array.isArray(g) ? (x = g[0], Object.assign(N, g[1])) : x = g;
|
|
2850
2859
|
}
|
|
2851
|
-
return
|
|
2860
|
+
return x;
|
|
2852
2861
|
}
|
|
2853
|
-
function
|
|
2854
|
-
return t.match(
|
|
2862
|
+
function Br(t) {
|
|
2863
|
+
return t.match(qr)[1].replace(Hr, "'");
|
|
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
|
-
let
|
|
2866
|
-
if (s.time && (
|
|
2874
|
+
let c = 0, i;
|
|
2875
|
+
if (s.time && (c = Zr(s.time), isNaN(c)))
|
|
2867
2876
|
return n();
|
|
2868
2877
|
if (s.timezone) {
|
|
2869
|
-
if (
|
|
2878
|
+
if (i = es(s.timezone), isNaN(i)) return n();
|
|
2870
2879
|
} else {
|
|
2871
|
-
const u = new Date(o +
|
|
2880
|
+
const u = new Date(o + c), d = p(0, e?.in);
|
|
2872
2881
|
return d.setFullYear(
|
|
2873
2882
|
u.getUTCFullYear(),
|
|
2874
2883
|
u.getUTCMonth(),
|
|
@@ -2880,28 +2889,28 @@ function Ur(t, e) {
|
|
|
2880
2889
|
u.getUTCMilliseconds()
|
|
2881
2890
|
), d;
|
|
2882
2891
|
}
|
|
2883
|
-
return
|
|
2892
|
+
return p(o + c + i, e?.in);
|
|
2884
2893
|
}
|
|
2885
|
-
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 = F(n[1]), a = F(n[2]) - 1, o = F(n[3]),
|
|
2928
|
+
const r = !!n[4], s = F(n[1]), a = F(n[2]) - 1, o = F(n[3]), c = F(n[4]), i = F(n[5]) - 1;
|
|
2920
2929
|
if (r)
|
|
2921
|
-
return
|
|
2930
|
+
return as(e, c, i) ? ts(e, c, i) : /* @__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
2936
|
function F(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
|
|
2974
|
-
const r =
|
|
2982
|
+
for (const n of cs) {
|
|
2983
|
+
const r = Ur(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 || Ut), 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
|
+
}, Qe = 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,20 +3007,20 @@ 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
|
}
|
|
3005
3014
|
async streamChat(e, n, r = {}, s) {
|
|
3006
|
-
const { onMessage: a, onError: o, onComplete:
|
|
3015
|
+
const { onMessage: a, onError: o, onComplete: c, signal: i } = r;
|
|
3007
3016
|
try {
|
|
3008
3017
|
const u = await this.initializeStreamRequest(
|
|
3009
3018
|
e,
|
|
3010
3019
|
n,
|
|
3011
|
-
|
|
3020
|
+
i,
|
|
3012
3021
|
s
|
|
3013
3022
|
);
|
|
3014
|
-
await this.processStreamData(u, a),
|
|
3023
|
+
await this.processStreamData(u, a), c?.();
|
|
3015
3024
|
} catch (u) {
|
|
3016
3025
|
this.handleStreamError(u, o);
|
|
3017
3026
|
}
|
|
@@ -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",
|
|
@@ -3032,20 +3041,20 @@ class us {
|
|
|
3032
3041
|
}
|
|
3033
3042
|
);
|
|
3034
3043
|
if (!o.ok) {
|
|
3035
|
-
const
|
|
3036
|
-
let
|
|
3044
|
+
const c = await o.text();
|
|
3045
|
+
let i = {};
|
|
3037
3046
|
try {
|
|
3038
|
-
|
|
3047
|
+
i = JSON.parse(c);
|
|
3039
3048
|
} catch {
|
|
3040
|
-
|
|
3049
|
+
i.error = "Failed to parse error body";
|
|
3041
3050
|
}
|
|
3042
|
-
throw new
|
|
3051
|
+
throw new Ce({
|
|
3043
3052
|
status: o.status,
|
|
3044
|
-
message:
|
|
3053
|
+
message: i.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
|
});
|
|
@@ -3062,11 +3071,11 @@ class us {
|
|
|
3062
3071
|
}
|
|
3063
3072
|
const o = this.decoder.decode(a, { stream: !0 });
|
|
3064
3073
|
r += o;
|
|
3065
|
-
const
|
|
3074
|
+
const c = r.split(`
|
|
3066
3075
|
`);
|
|
3067
|
-
r =
|
|
3068
|
-
for (const
|
|
3069
|
-
this.parseSSEDataLine(
|
|
3076
|
+
r = c.pop() || "";
|
|
3077
|
+
for (const i of c)
|
|
3078
|
+
this.parseSSEDataLine(i, n);
|
|
3070
3079
|
}
|
|
3071
3080
|
} finally {
|
|
3072
3081
|
e.releaseLock();
|
|
@@ -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), c = new ReadableStream({
|
|
3131
|
+
async start(u) {
|
|
3120
3132
|
try {
|
|
3121
|
-
const
|
|
3122
|
-
if (!
|
|
3123
|
-
const x = await
|
|
3133
|
+
const d = await Qe(a, o, n);
|
|
3134
|
+
if (!d.ok) {
|
|
3135
|
+
const x = await d.text();
|
|
3124
3136
|
throw console.error(
|
|
3125
|
-
`Fetch failed! Status: ${
|
|
3126
|
-
), new Error(`Fetch failed with status ${
|
|
3137
|
+
`Fetch failed! Status: ${d.status}, Body: ${x}`
|
|
3138
|
+
), new Error(`Fetch failed with status ${d.status}`);
|
|
3127
3139
|
}
|
|
3128
|
-
const
|
|
3129
|
-
if (!
|
|
3130
|
-
const
|
|
3131
|
-
|
|
3132
|
-
const
|
|
3133
|
-
const { done: x, value:
|
|
3134
|
-
x ?
|
|
3140
|
+
const l = d.body?.getReader();
|
|
3141
|
+
if (!l) throw new Error("Failed to create stream reader");
|
|
3142
|
+
const w = new Uint8Array([239, 187, 191]);
|
|
3143
|
+
u.enqueue(w);
|
|
3144
|
+
const v = async () => {
|
|
3145
|
+
const { done: x, value: N } = await l.read();
|
|
3146
|
+
x ? u.close() : (u.enqueue(N), await v());
|
|
3135
3147
|
};
|
|
3136
|
-
|
|
3137
|
-
} catch (
|
|
3138
|
-
|
|
3148
|
+
v();
|
|
3149
|
+
} catch (d) {
|
|
3150
|
+
u.error(d);
|
|
3139
3151
|
}
|
|
3140
3152
|
}
|
|
3141
3153
|
}), i = new Headers({
|
|
3142
3154
|
"Content-Disposition": `attachment; filename=${encodeURIComponent(r)}`
|
|
3143
3155
|
});
|
|
3144
|
-
return new Response(
|
|
3145
|
-
}
|
|
3146
|
-
async request(e, n, r) {
|
|
3147
|
-
const
|
|
3148
|
-
|
|
3149
|
-
jwt: this.config.jwt
|
|
3150
|
-
}),
|
|
3151
|
-
...n.headers
|
|
3152
|
-
};
|
|
3153
|
-
this.config.apiKey != null && (o["Ocp-Apim-Subscription-Key"] = this.config.apiKey), this.addInfoRequestLog("API Request", a, n, o);
|
|
3156
|
+
return new Response(c, { headers: i });
|
|
3157
|
+
}
|
|
3158
|
+
async request(e, n, r, s) {
|
|
3159
|
+
const a = Date.now(), o = `${r || this.config.apiUrl}/${e}`, c = this.buildHeaders(s, n.headers);
|
|
3160
|
+
this.addInfoRequestLog("API Request", o, n, c);
|
|
3154
3161
|
try {
|
|
3155
|
-
const i = await
|
|
3156
|
-
let
|
|
3157
|
-
const
|
|
3162
|
+
const i = await Qe(o, c, n), u = Date.now() - a;
|
|
3163
|
+
let d;
|
|
3164
|
+
const l = await i.text();
|
|
3158
3165
|
try {
|
|
3159
|
-
|
|
3166
|
+
d = l ? JSON.parse(l) : {};
|
|
3160
3167
|
} catch {
|
|
3161
3168
|
if (this.addErrorRequestParsing(
|
|
3162
|
-
|
|
3169
|
+
o,
|
|
3163
3170
|
n,
|
|
3164
3171
|
i,
|
|
3165
|
-
|
|
3166
|
-
|
|
3172
|
+
u,
|
|
3173
|
+
l
|
|
3167
3174
|
), !i.ok)
|
|
3168
3175
|
throw new Error(
|
|
3169
|
-
`API request failed: ${i.status} ${i.statusText} - ${
|
|
3176
|
+
`API request failed: ${i.status} ${i.statusText} - ${l.substring(0, 100)}`
|
|
3170
3177
|
);
|
|
3171
|
-
|
|
3178
|
+
d = { data: l };
|
|
3172
3179
|
}
|
|
3173
3180
|
if (!i.ok) {
|
|
3174
|
-
this.addErrorRequestLog(
|
|
3175
|
-
const
|
|
3176
|
-
throw new Error(`API request failed: ${
|
|
3181
|
+
this.addErrorRequestLog(o, n, i, u, d);
|
|
3182
|
+
const w = Ft(d, i);
|
|
3183
|
+
throw new Error(`API request failed: ${w}`);
|
|
3177
3184
|
}
|
|
3178
|
-
return
|
|
3185
|
+
return d;
|
|
3179
3186
|
} catch (i) {
|
|
3180
|
-
const
|
|
3187
|
+
const u = Date.now() - a;
|
|
3181
3188
|
throw console.error("API Request Exception", {
|
|
3182
3189
|
method: n.method,
|
|
3183
|
-
url:
|
|
3184
|
-
duration: `${
|
|
3190
|
+
url: o,
|
|
3191
|
+
duration: `${u}ms`,
|
|
3185
3192
|
error: i instanceof Error ? i.message : String(i)
|
|
3186
3193
|
}), i;
|
|
3187
3194
|
}
|
|
3188
3195
|
}
|
|
3196
|
+
buildHeaders(e, n) {
|
|
3197
|
+
if (this.config.useDialAuth)
|
|
3198
|
+
return {
|
|
3199
|
+
...oe(this.config.dialApiKey, { jwt: e }),
|
|
3200
|
+
...n
|
|
3201
|
+
};
|
|
3202
|
+
const r = {
|
|
3203
|
+
...oe(void 0, { jwt: this.config.jwt }),
|
|
3204
|
+
...n
|
|
3205
|
+
};
|
|
3206
|
+
return this.config.apiKey != null && (r[z] = this.config.apiKey), r;
|
|
3207
|
+
}
|
|
3189
3208
|
addInfoRequestLog(e, n, r, s) {
|
|
3190
3209
|
const a = {
|
|
3191
3210
|
method: r.method || "GET",
|
|
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,78 +3235,426 @@ 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 || {}), I = /* @__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))(I || {}), 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 Ua = ["FREQ", "FREQUENCY"], ws = "TIME_PERIOD", ys = "time_period_start", ps = "time_period_end", Ba = (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, c) => [o, c]);
|
|
3269
|
+
r.sort(
|
|
3270
|
+
(o, c) => bs(o[0], c[0])
|
|
3271
|
+
);
|
|
3272
|
+
const s = [...e];
|
|
3273
|
+
s.sort(Ds);
|
|
3274
|
+
let a = 0;
|
|
3275
|
+
for (const o of r) {
|
|
3276
|
+
const c = o[0];
|
|
3277
|
+
for (; a < s.length && s[a].memberValue.localeCompare(c.id) < 0; )
|
|
3278
|
+
a += 1;
|
|
3279
|
+
a < s.length && s[a].memberValue === c.id && (n[o[1]] = o[0]);
|
|
3280
|
+
}
|
|
3281
|
+
return n.filter((o) => o != null);
|
|
3282
|
+
}, Es = (t) => !!t?.some((e) => e.parent), Va = (t, e, n, r, s = []) => {
|
|
3283
|
+
let a = t || [];
|
|
3284
|
+
if (xs(n || [], e || "")) {
|
|
3285
|
+
const o = (n || [])[0].cubeRegions?.find(
|
|
3286
|
+
({ isIncluded: c }) => c
|
|
3287
|
+
);
|
|
3288
|
+
if (o) {
|
|
3289
|
+
const c = o.memberSelection?.find(
|
|
3290
|
+
({ componentId: i }) => i === e
|
|
3291
|
+
);
|
|
3292
|
+
c ? a = a.length === 0 ? (c.selectionValues || []).map(({ memberValue: i }) => ({
|
|
3293
|
+
id: i,
|
|
3294
|
+
name: i
|
|
3295
|
+
})) : Ts(a, c.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: I.EQUALS,
|
|
3308
|
+
value: n.values.join(",")
|
|
3309
|
+
});
|
|
3310
|
+
}), e;
|
|
3311
|
+
}, Ga = (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, Fe = (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
|
+
}, Ue = (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 (Ue(t) || Ue(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 = Fe(t), r = Fe(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
|
+
(i) => i.agencyID === n && i.id === r && !i?.version?.includes(ie)
|
|
3358
|
+
);
|
|
3359
|
+
if (a.length === 1)
|
|
3360
|
+
return a[0];
|
|
3361
|
+
if (!s?.includes(ie))
|
|
3362
|
+
return a.find((i) => i.version === s);
|
|
3363
|
+
const o = a.map(
|
|
3364
|
+
(i) => i.version
|
|
3365
|
+
), c = Is(s, o);
|
|
3366
|
+
return a.find(
|
|
3367
|
+
(i) => i.version === c[0]
|
|
3368
|
+
);
|
|
3369
|
+
}, Is = (t, e) => {
|
|
3370
|
+
const n = Rs(t, e);
|
|
3371
|
+
return n.length > 0 ? [n[0]] : [];
|
|
3372
|
+
}, Rs = (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 (Ss(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), Ss = (t, e, n, r) => t.id === e && t.agencyID === n && t.version === r, Xa = (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
|
+
), c = a || o;
|
|
3423
|
+
if (c != null)
|
|
3424
|
+
return be(c, t);
|
|
3425
|
+
}, Ls = (t, e) => {
|
|
3222
3426
|
const n = t?.data?.dataSets?.[0], s = t?.data?.structures?.[0]?.attributes?.dimensionGroup || [], a = n?.dimensionGroupAttributes, o = {};
|
|
3223
|
-
for (const
|
|
3224
|
-
const
|
|
3427
|
+
for (const c of s) {
|
|
3428
|
+
const i = c.relationship.dimensions, { codedSeriesKey: u, decodedSeriesKey: d } = Tt(
|
|
3225
3429
|
t,
|
|
3226
3430
|
e,
|
|
3227
|
-
|
|
3431
|
+
i
|
|
3228
3432
|
);
|
|
3229
|
-
o[
|
|
3433
|
+
o[c.id] = {
|
|
3230
3434
|
values: a?.[u] || [],
|
|
3231
3435
|
decodedSeriesKey: d,
|
|
3232
3436
|
codedSeriesKey: u
|
|
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 || []
|
|
3240
3444
|
], a = new Array(s?.length), o = new Array(s?.length);
|
|
3241
|
-
return n?.forEach((
|
|
3242
|
-
const
|
|
3445
|
+
return n?.forEach((c) => {
|
|
3446
|
+
const i = s?.findIndex((l) => l.id === c) || 0, u = e[i], d = s[i].values.findIndex(
|
|
3243
3447
|
(l) => l.id === u || l.value === u
|
|
3244
3448
|
) || 0;
|
|
3245
|
-
a[
|
|
3449
|
+
a[i] = d >= 0 ? d : u, o[i] = u;
|
|
3246
3450
|
}), {
|
|
3247
3451
|
codedSeriesKey: a.join(":"),
|
|
3248
3452
|
decodedSeriesKey: o.join(":")
|
|
3249
3453
|
};
|
|
3250
|
-
},
|
|
3454
|
+
}, ja = (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
|
-
), o = r?.dimensionGroupAttributes,
|
|
3457
|
+
), o = r?.dimensionGroupAttributes, c = [
|
|
3254
3458
|
...s?.dimensions.series || [],
|
|
3255
3459
|
...s?.dimensions.observation || []
|
|
3256
|
-
],
|
|
3257
|
-
u[
|
|
3460
|
+
], i = c?.findIndex((l) => l.id === e), u = new Array(c?.length);
|
|
3461
|
+
u[i] = n || "";
|
|
3258
3462
|
const d = {};
|
|
3259
3463
|
for (const l of a) {
|
|
3260
|
-
const
|
|
3464
|
+
const w = l.relationship.dimensions, { codedSeriesKey: v, decodedSeriesKey: x } = Tt(
|
|
3261
3465
|
t,
|
|
3262
3466
|
u,
|
|
3263
|
-
|
|
3467
|
+
w
|
|
3264
3468
|
);
|
|
3265
3469
|
d[l.id] = {
|
|
3266
|
-
values: o?.[
|
|
3267
|
-
decodedSeriesKey:
|
|
3268
|
-
codedSeriesKey:
|
|
3470
|
+
values: o?.[v] || [],
|
|
3471
|
+
decodedSeriesKey: x,
|
|
3472
|
+
codedSeriesKey: v
|
|
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
|
-
|
|
3481
|
+
}, za = (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
|
|
3494
|
+
);
|
|
3495
|
+
return {
|
|
3496
|
+
...a,
|
|
3497
|
+
attributeRelationship: s.attributeRelationship,
|
|
3498
|
+
isMandatory: Number(a?.minOccurs) > 0
|
|
3499
|
+
};
|
|
3500
|
+
});
|
|
3501
|
+
}, Ka = (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 || {}), Hs = /* @__PURE__ */ ((t) => (t.UNBOUNDED = "unbounded", t))(Hs || {});
|
|
3506
|
+
function je(t) {
|
|
3507
|
+
return t?.dataStructures?.[0]?.dataStructureComponents?.dimensionList;
|
|
3508
|
+
}
|
|
3509
|
+
function Ja(t) {
|
|
3510
|
+
return t?.data?.structures?.[0]?.dimensions?.series || [];
|
|
3511
|
+
}
|
|
3512
|
+
function Za(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 eo(t) {
|
|
3516
|
+
return t.find(
|
|
3517
|
+
(e) => e.type === Te.TIME_DIMENSION
|
|
3518
|
+
);
|
|
3519
|
+
}
|
|
3520
|
+
const to = (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
|
+
(c) => {
|
|
3529
|
+
const i = De(
|
|
3530
|
+
c?.conceptIdentity,
|
|
3531
|
+
s
|
|
3532
|
+
), u = c?.localRepresentation?.enumeration || i?.coreRepresentation?.enumeration, d = be(
|
|
3533
|
+
u,
|
|
3534
|
+
a
|
|
3535
|
+
);
|
|
3536
|
+
c?.id && (u ? e.set(c?.id, {
|
|
3537
|
+
...d,
|
|
3538
|
+
name: i?.name,
|
|
3539
|
+
names: i?.names
|
|
3540
|
+
}) : e.set(c?.id, {
|
|
3541
|
+
id: c?.id,
|
|
3542
|
+
name: i?.name,
|
|
3543
|
+
names: i?.names
|
|
3544
|
+
}));
|
|
3545
|
+
}
|
|
3546
|
+
), e;
|
|
3547
|
+
}, no = (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 Qs(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 = Qs(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 Fs(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 Us(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", ro = (t, e, n, r, s, a, o) => {
|
|
3591
|
+
const c = 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(), i = `${Bs}?${c}`, u = document.createElement("a");
|
|
3601
|
+
u.href = i, u.download = a, document.body.appendChild(u), u.click(), document.body.removeChild(u);
|
|
3602
|
+
}, so = (t, e) => {
|
|
3603
|
+
const n = [];
|
|
3604
|
+
for (const r of t) {
|
|
3605
|
+
if (r.type !== Te.DIMENSION)
|
|
3606
|
+
continue;
|
|
3607
|
+
const s = e.find((a) => a.componentCode === r.id);
|
|
3608
|
+
s != null && s.values?.length > 0 ? n.push(s.values?.join(qt)) : n.push("*");
|
|
3609
|
+
}
|
|
3610
|
+
return n.join(".");
|
|
3611
|
+
}, Vs = (t, e) => {
|
|
3612
|
+
if (!t || !t.startPeriod && !t.endPeriod)
|
|
3613
|
+
return null;
|
|
3614
|
+
const n = [], { startPeriod: r, endPeriod: s } = t;
|
|
3615
|
+
if (r && n.push(
|
|
3616
|
+
`${I.GREATER_OR_EQUAL}${_e}${Ke(r)}`
|
|
3617
|
+
), s && n.push(
|
|
3618
|
+
`${I.LESS_OR_EQUAL}${_e}${Ke(s)}`
|
|
3619
|
+
), n.length === 0)
|
|
3620
|
+
return null;
|
|
3621
|
+
const a = e;
|
|
3622
|
+
return n.map(
|
|
3623
|
+
(o) => `${encodeURIComponent(`c[${a}]`)}${Wt}${encodeURIComponent(o)}`
|
|
3624
|
+
).join(st);
|
|
3625
|
+
}, Ke = (t) => Vn(t, "yyyy-MM-dd"), ao = (t, e) => {
|
|
3626
|
+
const n = Gs(t, e) || null;
|
|
3627
|
+
return n ? Vs(n, e?.id) : null;
|
|
3628
|
+
}, Gs = (t, e) => {
|
|
3629
|
+
const n = e.id, r = t?.filters?.find(
|
|
3630
|
+
(i) => i.componentCode === n
|
|
3631
|
+
);
|
|
3632
|
+
if (!r || !r.values)
|
|
3633
|
+
return null;
|
|
3634
|
+
const s = r.values?.filter((i) => !!i);
|
|
3635
|
+
if (!s.length)
|
|
3636
|
+
return null;
|
|
3637
|
+
const a = r.operator;
|
|
3638
|
+
if (a === I.LESS_OR_EQUAL || a === I.LESS)
|
|
3639
|
+
return { startPeriod: null, endPeriod: G(s[0]) };
|
|
3640
|
+
if (a === I.GREATER_OR_EQUAL || a === I.GREATER)
|
|
3641
|
+
return { startPeriod: G(s[0]), endPeriod: null };
|
|
3642
|
+
const o = G(s[0]), c = G(s[1]);
|
|
3643
|
+
return { startPeriod: o, endPeriod: c };
|
|
3644
|
+
}, Xs = "Observation", oo = (t) => {
|
|
3645
|
+
const e = t?.data?.dataSets, n = t?.data?.structures?.[0];
|
|
3646
|
+
if (!e || !n)
|
|
3647
|
+
return [];
|
|
3648
|
+
const r = n.attributes, s = n.dimensions, a = r?.dimensionGroup || [], o = e[0].series || e[0].observations, c = s.series?.length ? s.series : s.observation, i = [];
|
|
3282
3649
|
for (const u in o) {
|
|
3283
|
-
const d = [], { name: l, parsedTimeSeriesValue:
|
|
3650
|
+
const d = [], { name: l, parsedTimeSeriesValue: w } = js(
|
|
3284
3651
|
u,
|
|
3285
|
-
|
|
3286
|
-
),
|
|
3287
|
-
if (Object.keys(
|
|
3288
|
-
|
|
3652
|
+
c
|
|
3653
|
+
), v = o[u], x = v.attributes || [];
|
|
3654
|
+
if (Object.keys(v).length === 0) {
|
|
3655
|
+
i.push({
|
|
3289
3656
|
name: l,
|
|
3290
|
-
parsedTimeSeriesValue:
|
|
3657
|
+
parsedTimeSeriesValue: w,
|
|
3291
3658
|
values: d,
|
|
3292
3659
|
attributes: [],
|
|
3293
3660
|
dataSetAttrs: []
|
|
@@ -3295,167 +3662,127 @@ const ws = (t, e) => {
|
|
|
3295
3662
|
continue;
|
|
3296
3663
|
}
|
|
3297
3664
|
d.push(
|
|
3298
|
-
...
|
|
3665
|
+
...Zs(v, n)
|
|
3299
3666
|
);
|
|
3300
|
-
const
|
|
3667
|
+
const N = ce(
|
|
3301
3668
|
r?.series || [],
|
|
3302
|
-
(
|
|
3303
|
-
), f =
|
|
3669
|
+
(M) => x[M]
|
|
3670
|
+
), f = ea(
|
|
3304
3671
|
n.attributes?.dataSet || [],
|
|
3305
|
-
e[0].attributes?.filter((
|
|
3306
|
-
),
|
|
3672
|
+
e[0].attributes?.filter((M) => M != null) || []
|
|
3673
|
+
), g = Ls(
|
|
3307
3674
|
t,
|
|
3308
|
-
|
|
3309
|
-
),
|
|
3310
|
-
const
|
|
3311
|
-
|
|
3312
|
-
|
|
3675
|
+
w
|
|
3676
|
+
), P = a.map((M, W) => {
|
|
3677
|
+
const q = g[M.id], U = $s(
|
|
3678
|
+
M,
|
|
3679
|
+
q.values[W]
|
|
3313
3680
|
);
|
|
3314
3681
|
return {
|
|
3315
|
-
attribute:
|
|
3682
|
+
attribute: M,
|
|
3316
3683
|
dimensionGroupValue: U,
|
|
3317
|
-
dimensionGroupData:
|
|
3684
|
+
dimensionGroupData: q
|
|
3318
3685
|
};
|
|
3319
3686
|
});
|
|
3320
|
-
|
|
3687
|
+
i.push({
|
|
3321
3688
|
name: l,
|
|
3322
|
-
parsedTimeSeriesValue:
|
|
3689
|
+
parsedTimeSeriesValue: w,
|
|
3323
3690
|
values: d,
|
|
3324
|
-
attributes:
|
|
3691
|
+
attributes: N,
|
|
3325
3692
|
dataSetAttrs: f,
|
|
3326
|
-
dimensionGroupAttributes:
|
|
3693
|
+
dimensionGroupAttributes: P
|
|
3327
3694
|
});
|
|
3328
3695
|
}
|
|
3329
|
-
return
|
|
3330
|
-
},
|
|
3696
|
+
return i;
|
|
3697
|
+
}, js = (t, e) => {
|
|
3331
3698
|
const n = t.split(new RegExp("(?<!\\|):(?!\\||$)")), r = [];
|
|
3332
3699
|
for (let s = 0; s < n.length; s++) {
|
|
3333
3700
|
const a = e?.[s], o = Number(n[s]);
|
|
3334
3701
|
if (o < 0 || a == null)
|
|
3335
3702
|
continue;
|
|
3336
|
-
const
|
|
3337
|
-
if (
|
|
3703
|
+
const c = a.values[o];
|
|
3704
|
+
if (c == null) {
|
|
3338
3705
|
r.push(n[s].replace("|:", ":"));
|
|
3339
3706
|
continue;
|
|
3340
3707
|
}
|
|
3341
|
-
r.push(
|
|
3708
|
+
r.push(c?.id || c?.value || "");
|
|
3342
3709
|
}
|
|
3343
3710
|
return {
|
|
3344
|
-
name:
|
|
3711
|
+
name: Ks(r),
|
|
3345
3712
|
parsedTimeSeriesValue: r
|
|
3346
3713
|
};
|
|
3347
|
-
},
|
|
3714
|
+
}, ce = (t, e) => {
|
|
3348
3715
|
const n = [];
|
|
3349
3716
|
for (let r = 0; r < t.length; r++) {
|
|
3350
|
-
const s = t[r], a = e(r), o = a != null && s.values != null ?
|
|
3717
|
+
const s = t[r], a = e(r), o = a != null && s.values != null ? zs(a, s) : void 0;
|
|
3351
3718
|
n.push({
|
|
3352
3719
|
name: s.id,
|
|
3353
3720
|
value: o
|
|
3354
3721
|
});
|
|
3355
3722
|
}
|
|
3356
3723
|
return n;
|
|
3357
|
-
},
|
|
3724
|
+
}, zs = (t, e) => {
|
|
3358
3725
|
const n = e.values[t];
|
|
3359
3726
|
return n == null ? typeof t == "object" ? t : t.toString() : n?.id || n?.value || n?.ids || n?.values;
|
|
3360
|
-
},
|
|
3727
|
+
}, Ks = (t) => t.map((e) => e ? Js(e) : "").join("."), Js = (t) => t.replace(/\./g, "|.").replace(/:/g, "|:"), Zs = (t, e) => {
|
|
3361
3728
|
const n = e.measures?.observation?.length;
|
|
3362
3729
|
if (t.observations == null)
|
|
3363
3730
|
return [
|
|
3364
3731
|
{
|
|
3365
|
-
values:
|
|
3366
|
-
obsAttributes:
|
|
3732
|
+
values: Je(t, e.measures),
|
|
3733
|
+
obsAttributes: ce(
|
|
3367
3734
|
e.attributes?.observation || [],
|
|
3368
3735
|
(o) => t[o + n]
|
|
3369
3736
|
),
|
|
3370
|
-
dimensionAtObservation:
|
|
3737
|
+
dimensionAtObservation: Xs
|
|
3371
3738
|
}
|
|
3372
3739
|
];
|
|
3373
3740
|
const r = t.observations, s = e.dimensions.observation?.[0], a = [];
|
|
3374
3741
|
for (const o in r) {
|
|
3375
|
-
const
|
|
3742
|
+
const c = s?.values[o];
|
|
3376
3743
|
a.push({
|
|
3377
|
-
dimensionAtObservation:
|
|
3378
|
-
values:
|
|
3744
|
+
dimensionAtObservation: c?.value || c?.id,
|
|
3745
|
+
values: Je(
|
|
3379
3746
|
r[o],
|
|
3380
3747
|
e.measures
|
|
3381
3748
|
),
|
|
3382
|
-
obsAttributes:
|
|
3749
|
+
obsAttributes: ce(
|
|
3383
3750
|
e.attributes?.observation || [],
|
|
3384
|
-
(
|
|
3751
|
+
(i) => r[o][i + n]
|
|
3385
3752
|
)
|
|
3386
3753
|
});
|
|
3387
3754
|
}
|
|
3388
3755
|
return a;
|
|
3389
|
-
},
|
|
3756
|
+
}, Je = (t, e) => e?.observation?.map((n, r) => ({ name: n.id, value: t[r] })) || [], ea = (t, e) => t.reduce(
|
|
3390
3757
|
(n, r, s) => {
|
|
3391
3758
|
const a = e[s];
|
|
3392
|
-
return
|
|
3759
|
+
return ta(n, r, a, ""), n;
|
|
3393
3760
|
},
|
|
3394
3761
|
[]
|
|
3395
|
-
),
|
|
3762
|
+
), ta = (t, e, n, r) => {
|
|
3396
3763
|
const s = n != null ? e?.values?.length > 0 ? e.values[n]?.id || e.values[n]?.value : String(n) : r;
|
|
3397
3764
|
t.push({
|
|
3398
3765
|
name: e.id,
|
|
3399
3766
|
value: s || ""
|
|
3400
3767
|
});
|
|
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
|
-
};
|
|
3768
|
+
}, na = /^[0-9][0-9][0-9][0-9]-Q[1-4]$/, ra = /^[0-9][0-9][0-9][0-9]-W(0[1-9]|[1-4][0-9]|5[0-3])$/, sa = /^[0-9][0-9][0-9][0-9]-S[1-2]$/, aa = /^[0-9][0-9][0-9][0-9]$/, oa = /^[0-9][0-9][0-9][0-9]-(0[1-9]|1[0-2])-[0-9][0-9]$/, ia = /^[0-9][0-9][0-9][0-9]-M(0[1-9]|(1[0-2]))$/, ve = (t) => aa.exec(t), Me = (t) => !!ve(t), ca = (t) => sa.exec(t), Oe = (t) => !!ca(t), Ae = (t) => ia.exec(t), Ne = (t) => !!Ae(t), ke = (t) => na.exec(t), Ie = (t) => !!ke(t), ua = (t) => oa.exec(t), da = (t) => !!ua(t), la = (t) => ra.exec(t), Re = (t) => !!la(t);
|
|
3769
|
+
function xt(t) {
|
|
3770
|
+
return Me(t) ? fa(t) : Oe(t) ? ha(t) : Ie(t) ? wa(t) : Ne(t) ? pa(t) : Re(t) ? Fs(t) : Da(t);
|
|
3433
3771
|
}
|
|
3434
|
-
function
|
|
3435
|
-
|
|
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);
|
|
3444
|
-
}
|
|
3445
|
-
function bt(t) {
|
|
3446
|
-
return pe(t) ? $s(t) : ye(t) ? Qs(t) : Ee(t) ? Hs(t) : De(t) ? Bs(t) : xe(t) ? Ss(t) : Vs(t);
|
|
3772
|
+
function Pt(t) {
|
|
3773
|
+
return Me(t) ? ma(t) : Oe(t) ? ga(t) : Ie(t) ? ya(t) : Ne(t) ? ba(t) : Re(t) ? Us(t) : Ta(t);
|
|
3447
3774
|
}
|
|
3448
|
-
function
|
|
3449
|
-
const e =
|
|
3775
|
+
function fa(t) {
|
|
3776
|
+
const e = ve(t);
|
|
3450
3777
|
if (e)
|
|
3451
3778
|
return new Date(Number(e[0]), 0, 1);
|
|
3452
3779
|
}
|
|
3453
|
-
function
|
|
3454
|
-
const e =
|
|
3780
|
+
function ma(t) {
|
|
3781
|
+
const e = ve(t);
|
|
3455
3782
|
if (e)
|
|
3456
3783
|
return new Date(Number(e[0]) + 1, 0, 1);
|
|
3457
3784
|
}
|
|
3458
|
-
function
|
|
3785
|
+
function ha(t) {
|
|
3459
3786
|
const [e, n] = t.split("-S");
|
|
3460
3787
|
switch (+n) {
|
|
3461
3788
|
case 1:
|
|
@@ -3464,7 +3791,7 @@ function qs(t) {
|
|
|
3464
3791
|
return new Date(+e, 6, 1);
|
|
3465
3792
|
}
|
|
3466
3793
|
}
|
|
3467
|
-
function
|
|
3794
|
+
function ga(t) {
|
|
3468
3795
|
const [e, n] = t.split("-S");
|
|
3469
3796
|
switch (+n) {
|
|
3470
3797
|
case 1:
|
|
@@ -3473,8 +3800,8 @@ function Qs(t) {
|
|
|
3473
3800
|
return new Date(+e + 1, 0, 1);
|
|
3474
3801
|
}
|
|
3475
3802
|
}
|
|
3476
|
-
function
|
|
3477
|
-
const e =
|
|
3803
|
+
function wa(t) {
|
|
3804
|
+
const e = ke(t);
|
|
3478
3805
|
if (!e)
|
|
3479
3806
|
return;
|
|
3480
3807
|
const [n, r] = e[0].split("-Q");
|
|
@@ -3489,8 +3816,8 @@ function Fs(t) {
|
|
|
3489
3816
|
return new Date(+n, 9, 1);
|
|
3490
3817
|
}
|
|
3491
3818
|
}
|
|
3492
|
-
function
|
|
3493
|
-
const e =
|
|
3819
|
+
function ya(t) {
|
|
3820
|
+
const e = ke(t);
|
|
3494
3821
|
if (!e)
|
|
3495
3822
|
return;
|
|
3496
3823
|
const [n, r] = e[0].split("-Q");
|
|
@@ -3505,45 +3832,45 @@ function Hs(t) {
|
|
|
3505
3832
|
return new Date(+n + 1, 0, 1);
|
|
3506
3833
|
}
|
|
3507
3834
|
}
|
|
3508
|
-
function
|
|
3509
|
-
const e =
|
|
3835
|
+
function pa(t) {
|
|
3836
|
+
const e = Ae(t);
|
|
3510
3837
|
if (!e)
|
|
3511
3838
|
return;
|
|
3512
3839
|
const [n, r] = e[0].split("-M");
|
|
3513
3840
|
return new Date(+n, +r - 1, 1);
|
|
3514
3841
|
}
|
|
3515
|
-
function
|
|
3516
|
-
const e =
|
|
3842
|
+
function ba(t) {
|
|
3843
|
+
const e = Ae(t);
|
|
3517
3844
|
if (!e)
|
|
3518
3845
|
return;
|
|
3519
3846
|
const [n, r] = e[0].split("-M");
|
|
3520
3847
|
return new Date(+n, +r, 1);
|
|
3521
3848
|
}
|
|
3522
|
-
const
|
|
3849
|
+
const Da = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Ta = (t) => {
|
|
3523
3850
|
const e = /* @__PURE__ */ new Date(`${t}T23:59:00`);
|
|
3524
3851
|
return e.setMinutes(e.getMinutes() + 1), e;
|
|
3525
|
-
},
|
|
3526
|
-
const a = [], o = e && e > 3 ?
|
|
3527
|
-
for (let
|
|
3528
|
-
a.push(`${t}-${s}${
|
|
3852
|
+
}, Ea = 1, xa = (t, e, n, r = !0, s = "Q") => {
|
|
3853
|
+
const a = [], o = e && e > 3 ? ka(e, r) : 1, c = n ? Math.floor((n - 1) / 3) : 4;
|
|
3854
|
+
for (let i = o; i <= c; i++)
|
|
3855
|
+
a.push(`${t}-${s}${i}`);
|
|
3529
3856
|
return a;
|
|
3530
|
-
},
|
|
3857
|
+
}, Pa = (t, e, n, r = "S") => {
|
|
3531
3858
|
const s = [];
|
|
3532
3859
|
return (e || 1) < 7 && (n || 12) > 6 && s.push(`${t}-${r}1`), n == null && s.push(`${t}-${r}2`), s;
|
|
3533
|
-
},
|
|
3860
|
+
}, io = (t) => Math.ceil(t / 3), vt = (t, e, n = "M") => `${t}-${n}${e.toString().padStart(2, "0")}`, va = (t, e, n = "M") => {
|
|
3534
3861
|
const r = [];
|
|
3535
3862
|
for (let s = e; s <= 12; s++)
|
|
3536
|
-
r.push(
|
|
3863
|
+
r.push(vt(t, s, n));
|
|
3537
3864
|
return r;
|
|
3538
|
-
},
|
|
3865
|
+
}, Ma = (t, e, n, r = "M") => {
|
|
3539
3866
|
const s = [];
|
|
3540
3867
|
for (let a = e; a < n; a++)
|
|
3541
|
-
s.push(
|
|
3868
|
+
s.push(vt(t, a, r));
|
|
3542
3869
|
return s;
|
|
3543
|
-
},
|
|
3870
|
+
}, Oa = (t, e, n, r = "M") => {
|
|
3544
3871
|
const s = e || 1, a = n == null, o = n || 12;
|
|
3545
|
-
return a ?
|
|
3546
|
-
},
|
|
3872
|
+
return a ? va(t, s, r) : Ma(t, s, o, r);
|
|
3873
|
+
}, co = (t, e, n = "M") => {
|
|
3547
3874
|
switch (e) {
|
|
3548
3875
|
case 0:
|
|
3549
3876
|
return [
|
|
@@ -3572,358 +3899,55 @@ const Gs = (t) => /* @__PURE__ */ new Date(`${t}T00:00:00`), Vs = (t) => {
|
|
|
3572
3899
|
default:
|
|
3573
3900
|
return [];
|
|
3574
3901
|
}
|
|
3575
|
-
},
|
|
3576
|
-
const n =
|
|
3577
|
-
return Array.from({ length: o }, (
|
|
3578
|
-
},
|
|
3579
|
-
const n =
|
|
3902
|
+
}, Aa = (t, e) => {
|
|
3903
|
+
const n = R(e, !0), r = R(t), s = n.getFullYear(), a = r.getFullYear(), o = n.getTime() <= r.getTime() ? a + Ea - s : 0;
|
|
3904
|
+
return Array.from({ length: o }, (i, u) => s + u);
|
|
3905
|
+
}, R = (t, e = !1) => {
|
|
3906
|
+
const n = Na(t, e);
|
|
3580
3907
|
return n ? (n.getTimezoneOffset() > 0 && n.setMinutes(n.getMinutes() + n.getTimezoneOffset()), n) : /* @__PURE__ */ new Date();
|
|
3581
|
-
},
|
|
3908
|
+
}, Na = (t, e = !1) => {
|
|
3582
3909
|
const n = Number(t);
|
|
3583
|
-
return t.toString().length !== 13 ? e ?
|
|
3584
|
-
},
|
|
3585
|
-
const n =
|
|
3910
|
+
return t.toString().length !== 13 ? e ? xt(t) : Pt(t) : isNaN(n) ? /* @__PURE__ */ new Date(`${t}T00:00:00.000Z`) : new Date(n);
|
|
3911
|
+
}, ka = (t, e) => e ? Math.floor((t + 1) / 3) : Math.ceil((t + 1) / 3), uo = (t, e) => {
|
|
3912
|
+
const n = et(t) - et(e);
|
|
3586
3913
|
if (n === 0 && t !== e) {
|
|
3587
|
-
const r =
|
|
3914
|
+
const r = Ze(t), s = Ze(e);
|
|
3588
3915
|
return r - s;
|
|
3589
3916
|
}
|
|
3590
3917
|
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;
|
|
3918
|
+
}, Ze = (t) => Me(t) ? 6 : Oe(t) ? 5 : Ie(t) ? 4 : Ne(t) ? 3 : Re(t) ? 2 : da(t) ? 1 : 0, et = (t, e = !1) => (e ? xt(t) : Pt(t))?.getTime() || 0, Mt = (t, e, n) => {
|
|
3919
|
+
const r = R(e, !0), s = R(n), a = R(t, !0), o = R(t), c = r.getTime() > a.getTime() ? r : a, i = s.getTime() < o.getTime() ? s : o;
|
|
3615
3920
|
return {
|
|
3616
|
-
|
|
3617
|
-
|
|
3921
|
+
start: c,
|
|
3922
|
+
end: i
|
|
3618
3923
|
};
|
|
3619
|
-
},
|
|
3620
|
-
const
|
|
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;
|
|
3896
|
-
return {
|
|
3897
|
-
start: i,
|
|
3898
|
-
end: c
|
|
3899
|
-
};
|
|
3900
|
-
}, Na = (t, e, n, r = "W") => {
|
|
3901
|
-
const s = +t, { start: a, end: o } = xt(t, e, n);
|
|
3924
|
+
}, Ia = (t, e, n, r = "W") => {
|
|
3925
|
+
const s = +t, { start: a, end: o } = Mt(t, e, n);
|
|
3902
3926
|
if (a.getTime() > o.getTime())
|
|
3903
3927
|
return [];
|
|
3904
|
-
const
|
|
3905
|
-
if (
|
|
3906
|
-
for (let
|
|
3907
|
-
l.push(
|
|
3928
|
+
const c = ee(a, r), i = c.weekYear === s ? c.weekNumber : c.weekYear < s ? 1 : ze(s, r), u = ee(o, r), d = u.weekYear === s ? u.weekNumber : u.weekYear > s ? ze(s, r) : 1, l = [];
|
|
3929
|
+
if (i < d)
|
|
3930
|
+
for (let w = i; w <= d; w++)
|
|
3931
|
+
l.push(Et(s, w, r));
|
|
3908
3932
|
return l;
|
|
3909
|
-
},
|
|
3933
|
+
}, Ra = (t) => {
|
|
3910
3934
|
const e = new Date(t);
|
|
3911
3935
|
return e.setMinutes(e.getMinutes() - e.getTimezoneOffset()), e.toISOString().slice(0, 10);
|
|
3912
|
-
},
|
|
3913
|
-
const { start: r, end: s } =
|
|
3936
|
+
}, _a = (t, e, n) => {
|
|
3937
|
+
const { start: r, end: s } = Mt(t, e, n);
|
|
3914
3938
|
if (r.getTime() > s.getTime())
|
|
3915
3939
|
return [];
|
|
3916
3940
|
const a = [], o = new Date(
|
|
3917
3941
|
r.getFullYear(),
|
|
3918
3942
|
r.getMonth(),
|
|
3919
3943
|
r.getDate()
|
|
3920
|
-
),
|
|
3921
|
-
for (; o.getTime() <
|
|
3922
|
-
const
|
|
3923
|
-
a.push(
|
|
3944
|
+
), c = new Date(s.getFullYear(), s.getMonth(), s.getDate());
|
|
3945
|
+
for (; o.getTime() < c.getTime(); ) {
|
|
3946
|
+
const i = Ra(o);
|
|
3947
|
+
a.push(i), o.setDate(o.getDate() + 1);
|
|
3924
3948
|
}
|
|
3925
3949
|
return a;
|
|
3926
|
-
},
|
|
3950
|
+
}, Ya = (t) => ({
|
|
3927
3951
|
isDailyExist: !!t?.some(({ memberValue: e }) => e === "D"),
|
|
3928
3952
|
isWeeklyExist: !!t?.some(({ memberValue: e }) => e === "W"),
|
|
3929
3953
|
isMonthlyExist: !!t?.some(({ memberValue: e }) => e === "M"),
|
|
@@ -3932,158 +3956,265 @@ const no = (t) => {
|
|
|
3932
3956
|
isYearlyExist: !!t?.some(
|
|
3933
3957
|
({ memberValue: e }) => e === "A" || e === "Y"
|
|
3934
3958
|
)
|
|
3935
|
-
}),
|
|
3936
|
-
const s = r === 0 ?
|
|
3959
|
+
}), Ca = (t, e, n, r) => {
|
|
3960
|
+
const s = r === 0 ? R(e.toString(), !0)?.getMonth() + 1 : void 0, a = r === t.length - 1 ? R(n.toString())?.getMonth() + 1 || 1 : void 0;
|
|
3937
3961
|
return { startMonth: s, endMonth: a };
|
|
3938
|
-
},
|
|
3962
|
+
}, Sa = ["FREQUENCY", "FREQ"], lo = (t, e) => {
|
|
3939
3963
|
const n = t?.[0]?.cubeRegions?.[0]?.memberSelection?.find(
|
|
3940
|
-
(
|
|
3941
|
-
)?.selectionValues, r =
|
|
3942
|
-
return o.forEach((
|
|
3943
|
-
const d = [], { startMonth: l, endMonth:
|
|
3964
|
+
(i) => Sa.includes(i.componentId)
|
|
3965
|
+
)?.selectionValues, r = Ya(n || []), s = e?.startPeriod?.getTime() || 1, a = e?.endPeriod?.getTime() || 1, o = Aa(a, s), c = [];
|
|
3966
|
+
return o.forEach((i, u) => {
|
|
3967
|
+
const d = [], { startMonth: l, endMonth: w } = Ca(
|
|
3944
3968
|
o,
|
|
3945
3969
|
new Date(s),
|
|
3946
3970
|
new Date(a),
|
|
3947
3971
|
u
|
|
3948
3972
|
), {
|
|
3949
|
-
isDailyExist:
|
|
3950
|
-
isWeeklyExist:
|
|
3951
|
-
isMonthlyExist:
|
|
3973
|
+
isDailyExist: v,
|
|
3974
|
+
isWeeklyExist: x,
|
|
3975
|
+
isMonthlyExist: N,
|
|
3952
3976
|
isQuarterlyExist: f,
|
|
3953
|
-
isSemiAnnualExist:
|
|
3954
|
-
isYearlyExist:
|
|
3977
|
+
isSemiAnnualExist: g,
|
|
3978
|
+
isYearlyExist: P
|
|
3955
3979
|
} = r;
|
|
3956
|
-
|
|
3957
|
-
...
|
|
3958
|
-
),
|
|
3959
|
-
...
|
|
3960
|
-
),
|
|
3961
|
-
...
|
|
3962
|
-
),
|
|
3963
|
-
}),
|
|
3980
|
+
P && d.push(i.toString()), g && d.push(...Pa(i, l, w)), f && d.push(
|
|
3981
|
+
...xa(i, l, w, !1)
|
|
3982
|
+
), N && d.push(...Oa(i, l, w)), x && d.push(
|
|
3983
|
+
...Ia(i, s.toString(), a.toString())
|
|
3984
|
+
), v && d.push(
|
|
3985
|
+
..._a(i, s.toString(), a.toString())
|
|
3986
|
+
), c.push(...d);
|
|
3987
|
+
}), c;
|
|
3964
3988
|
};
|
|
3965
|
-
function
|
|
3989
|
+
function La(t) {
|
|
3966
3990
|
const { urn: e } = t.details;
|
|
3967
|
-
return
|
|
3991
|
+
return de(e.resourceId, e.version, e.agencyId);
|
|
3968
3992
|
}
|
|
3969
|
-
function
|
|
3993
|
+
function fo(t) {
|
|
3970
3994
|
const e = {};
|
|
3971
3995
|
for (const n of t.datasets) {
|
|
3972
|
-
const r = n.dataset, s =
|
|
3996
|
+
const r = n.dataset, s = La(r);
|
|
3973
3997
|
e[s] = r.details.dimensions;
|
|
3974
3998
|
}
|
|
3975
3999
|
return e;
|
|
3976
4000
|
}
|
|
4001
|
+
function mo(t) {
|
|
4002
|
+
return t?.codelists?.length ? t.codelists.map((e) => ({
|
|
4003
|
+
id: e.id,
|
|
4004
|
+
agencyID: e.agencyID ?? "",
|
|
4005
|
+
version: e.version ?? "",
|
|
4006
|
+
name: e.name,
|
|
4007
|
+
codes: e.codes?.map((n) => ({
|
|
4008
|
+
id: n.id,
|
|
4009
|
+
name: n.name,
|
|
4010
|
+
description: n.description
|
|
4011
|
+
}))
|
|
4012
|
+
})) : (t?.glossaries ?? []).map((e) => ({
|
|
4013
|
+
id: e.id,
|
|
4014
|
+
agencyID: e.agencyID ?? "",
|
|
4015
|
+
version: e.version ?? "",
|
|
4016
|
+
name: e.name,
|
|
4017
|
+
codes: e.terms?.map((n) => ({
|
|
4018
|
+
id: n.id,
|
|
4019
|
+
name: n.name,
|
|
4020
|
+
description: n.description
|
|
4021
|
+
}))
|
|
4022
|
+
}));
|
|
4023
|
+
}
|
|
4024
|
+
function $a(t, e) {
|
|
4025
|
+
const n = (r) => {
|
|
4026
|
+
const s = r.indexOf("(");
|
|
4027
|
+
if (s === -1) return r;
|
|
4028
|
+
const a = r.indexOf(")", s);
|
|
4029
|
+
return a === -1 ? r : r.slice(0, s + 1) + "*" + r.slice(a);
|
|
4030
|
+
};
|
|
4031
|
+
return n(t) === n(e);
|
|
4032
|
+
}
|
|
4033
|
+
function ue(t) {
|
|
4034
|
+
return de(
|
|
4035
|
+
t.id,
|
|
4036
|
+
t.version ?? "",
|
|
4037
|
+
t.agencyID ?? ""
|
|
4038
|
+
);
|
|
4039
|
+
}
|
|
4040
|
+
function Ot(t, e, n) {
|
|
4041
|
+
e?.forEach((r) => {
|
|
4042
|
+
const { childId: s, agency: a, id: o, version: c } = tt(r.code), i = de(o, c, a), u = n?.find(
|
|
4043
|
+
(l) => $a(i, ue(l))
|
|
4044
|
+
), d = u?.codes?.find((l) => l.id === s);
|
|
4045
|
+
if (d != null) {
|
|
4046
|
+
const l = r.code.replace(
|
|
4047
|
+
i,
|
|
4048
|
+
ue(u)
|
|
4049
|
+
);
|
|
4050
|
+
t.push({ ...d, code: l });
|
|
4051
|
+
}
|
|
4052
|
+
Ot(t, r.hierarchicalCodes, n);
|
|
4053
|
+
});
|
|
4054
|
+
}
|
|
4055
|
+
function ho(t, e) {
|
|
4056
|
+
const n = [];
|
|
4057
|
+
return Ot(n, t?.hierarchicalCodes, e), n;
|
|
4058
|
+
}
|
|
4059
|
+
function go(t) {
|
|
4060
|
+
const e = {};
|
|
4061
|
+
return t?.forEach((n) => {
|
|
4062
|
+
e[ue(n)] = n.codes;
|
|
4063
|
+
}), e;
|
|
4064
|
+
}
|
|
4065
|
+
function wo(t, e, n) {
|
|
4066
|
+
if (!n || n.length === 0 || !e)
|
|
4067
|
+
return t;
|
|
4068
|
+
const r = n[0].cubeRegions?.find(
|
|
4069
|
+
(o) => o.isIncluded
|
|
4070
|
+
);
|
|
4071
|
+
if (!r) return t;
|
|
4072
|
+
const s = r.memberSelection?.find(
|
|
4073
|
+
(o) => o.componentId === e
|
|
4074
|
+
);
|
|
4075
|
+
if (!s) return [];
|
|
4076
|
+
const a = new Set(s.selectionValues.map((o) => o.memberValue));
|
|
4077
|
+
return t.filter((o) => a.has(o.id));
|
|
4078
|
+
}
|
|
4079
|
+
class yo {
|
|
4080
|
+
constructor(e) {
|
|
4081
|
+
this.client = e;
|
|
4082
|
+
}
|
|
4083
|
+
async getAvailableHierarchies(e, n) {
|
|
4084
|
+
const { agency: r, id: s, version: a } = C(e), o = `${this.client.config.sdmxProxyUrl}/sdmx/3.0/structure/codelist`;
|
|
4085
|
+
return this.client.request(
|
|
4086
|
+
`${r}/${s}/${a}?references=hierarchy&detail=allcompletestubs`,
|
|
4087
|
+
{ method: "GET" },
|
|
4088
|
+
o,
|
|
4089
|
+
n
|
|
4090
|
+
);
|
|
4091
|
+
}
|
|
4092
|
+
async getHierarchy(e, n) {
|
|
4093
|
+
const { agency: r, id: s, version: a } = C(e), o = `${this.client.config.sdmxProxyUrl}/sdmx/3.0/structure/hierarchy`;
|
|
4094
|
+
return this.client.request(
|
|
4095
|
+
`${r}/${s}/${a}?references=descendants&detail=full`,
|
|
4096
|
+
{ method: "GET" },
|
|
4097
|
+
o,
|
|
4098
|
+
n
|
|
4099
|
+
);
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
3977
4102
|
export {
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
4103
|
+
ye as Annotations,
|
|
4104
|
+
qs as AssignmentStatus,
|
|
4105
|
+
Wa as AvailabilityApi,
|
|
4106
|
+
$t as DATASET_DATA_URL,
|
|
4107
|
+
Ha as DatasetApi,
|
|
4108
|
+
Te as DimensionType,
|
|
4109
|
+
Ct as DownloadType,
|
|
4110
|
+
Ua as FREQUENCY_DIMENSION_ID,
|
|
4111
|
+
Sa as FREQUENCY_DIM_ID,
|
|
4112
|
+
Yt as FileColumnsAttribute,
|
|
4113
|
+
Ht as GET_v3_FILTER_ALL,
|
|
4114
|
+
qa as GET_v3_FILTER_AND,
|
|
4115
|
+
qt as GET_v3_FILTER_OR,
|
|
4116
|
+
yo as HierarchyApi,
|
|
4117
|
+
Xs as OBSERVATION_KEY,
|
|
4118
|
+
Hs as OccurrenceType,
|
|
4119
|
+
gs as Periods,
|
|
4120
|
+
hs as RepresentationTextType,
|
|
4121
|
+
ms as SDMX_DATA_QUERY_PARAMS,
|
|
4122
|
+
ie as SINGLE_WILDCARD_SYMBOL,
|
|
4123
|
+
Qa as SdmxApiClient,
|
|
4124
|
+
nt as SdmxAvailabilityMode,
|
|
3999
4125
|
X as SdmxDataFormat,
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4126
|
+
rt as SdmxDetails,
|
|
4127
|
+
le as SdmxReferences,
|
|
4128
|
+
I as SeriesFilterOperator,
|
|
4129
|
+
ws as TIME_PERIOD,
|
|
4130
|
+
ps as TIME_PERIOD_END_ANNOTATION_KEY,
|
|
4131
|
+
ys as TIME_PERIOD_START_ANNOTATION_KEY,
|
|
4132
|
+
fo as buildDatasetDimensionsMetadataMap,
|
|
4133
|
+
oa as dailyPattern,
|
|
4134
|
+
Js as decodeDimensionId,
|
|
4135
|
+
Xa as findCodelistByDimension,
|
|
4136
|
+
Ye as generateDatasetDataRequest,
|
|
4137
|
+
de as generateShortUrn,
|
|
4138
|
+
lo as getAdditionalColumns,
|
|
4139
|
+
Ba as getAnnotationPeriod,
|
|
4140
|
+
be as getArtifactByUrnWithWildCard,
|
|
4141
|
+
ja as getAttachedDimensionsSeriesByDimension,
|
|
4142
|
+
Ls as getAttachedDimensionsSeriesByTsId,
|
|
4143
|
+
Tt as getAttachedDimensionsSeriesKey,
|
|
4144
|
+
$s as getAttributeValueFromDataQueryResponse,
|
|
4019
4145
|
za as getAvailableCodes,
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4146
|
+
Va as getAvailableCodesFromConstrains,
|
|
4147
|
+
tt as getChildParsedUrn,
|
|
4148
|
+
go as getCodeListsData,
|
|
4149
|
+
De as getConcept,
|
|
4150
|
+
Xe as getConceptByUrn,
|
|
4151
|
+
Cs as getConceptWithScheme,
|
|
4152
|
+
Ws as getConvertedMetaAttributes,
|
|
4153
|
+
ua as getDailyRegExp,
|
|
4154
|
+
_a as getDaysColumns,
|
|
4155
|
+
Ka as getDimensionTitle,
|
|
4156
|
+
je as getDimensions,
|
|
4157
|
+
fs as getFilteredItemsWithParents,
|
|
4158
|
+
Ps as getFiltersDtoFromDataQuery,
|
|
4159
|
+
Ga as getFiltersDtoMapFromDataQuery,
|
|
4160
|
+
wo as getHierarchyAvailableCodes,
|
|
4161
|
+
ho as getHierarchyCodes,
|
|
4162
|
+
ee as getISOWeek,
|
|
4034
4163
|
K as getKeyFromUrn,
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4164
|
+
Fa as getLastUpdatedTime,
|
|
4165
|
+
ze as getLastWeekNumberOfYear,
|
|
4166
|
+
pe as getLocalizedName,
|
|
4167
|
+
Oa as getMonthlyData,
|
|
4168
|
+
co as getMonthlyDataByQuarter,
|
|
4169
|
+
Ae as getMonthlyRegExp,
|
|
4170
|
+
Pt as getParsedEndPeriodDate,
|
|
4171
|
+
oo as getParsedResponse,
|
|
4172
|
+
xt as getParsedStartPeriodDate,
|
|
4173
|
+
R as getPeriodDate,
|
|
4174
|
+
Ya as getPeriods,
|
|
4175
|
+
io as getQuarterByMonth,
|
|
4176
|
+
ke as getQuarterlyRegExp,
|
|
4177
|
+
xa as getQuartersData,
|
|
4178
|
+
Vs as getQueryTimePeriodFilters,
|
|
4179
|
+
St as getRequestAcceptHeader,
|
|
4180
|
+
Is as getResolvedVersionBySingleWildcard,
|
|
4181
|
+
Pa as getSemiAnnualData,
|
|
4182
|
+
ca as getSemiAnnuallyRegExp,
|
|
4183
|
+
ce as getSeriesAttributes,
|
|
4184
|
+
js as getSeriesName,
|
|
4185
|
+
to as getStructureComponentsMap,
|
|
4186
|
+
Ja as getStructureDimensions,
|
|
4187
|
+
eo as getTimeDimension,
|
|
4188
|
+
Za as getTimePeriods,
|
|
4189
|
+
ao as getTimeQueryFilter,
|
|
4190
|
+
Gs as getTimeRangeFromAttachment,
|
|
4191
|
+
no as getTimeSeriesCount,
|
|
4192
|
+
so as getTimeSeriesFilterKey,
|
|
4193
|
+
Ks as getTimeSeriesId,
|
|
4194
|
+
Et as getWeekCode,
|
|
4195
|
+
Us as getWeeklyPeriodEndDate,
|
|
4196
|
+
Fs as getWeeklyPeriodStartDate,
|
|
4197
|
+
la as getWeeklyRegExp,
|
|
4198
|
+
Ia as getWeeksColumns,
|
|
4199
|
+
_s as getWildCardPrefix,
|
|
4200
|
+
Mt as getYearPeriod,
|
|
4201
|
+
ve as getYearlyRegExp,
|
|
4202
|
+
Aa as getYears,
|
|
4203
|
+
da as isDaily,
|
|
4204
|
+
Ne as isMonthly,
|
|
4205
|
+
Ie as isQuarterly,
|
|
4206
|
+
Oe as isSemiAnnually,
|
|
4207
|
+
Re as isWeekly,
|
|
4208
|
+
Ys as isWildCardVersionCorrect,
|
|
4209
|
+
Me as isYearly,
|
|
4210
|
+
ia as monthlyPattern,
|
|
4211
|
+
ro as openDownloadWindow,
|
|
4212
|
+
na as quarterPattern,
|
|
4213
|
+
mo as resolveCodelistsFromResponse,
|
|
4214
|
+
sa as semiAnnuallyPattern,
|
|
4215
|
+
uo as sortPeriods,
|
|
4216
|
+
C as splitUrn,
|
|
4217
|
+
$a as urnMatchesIgnoreVersion,
|
|
4218
|
+
ra as weeklyPattern,
|
|
4219
|
+
aa as yearlyPattern
|
|
4089
4220
|
};
|