@epam/statgpt-sdmx-toolkit 0.4.0-rc.8 → 0.4.0

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