@sijanbhattarai/veda-utils 1.0.35

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/dist/index.js ADDED
@@ -0,0 +1,1625 @@
1
+ import { gfmToMarkdown as me } from "mdast-util-gfm";
2
+ import { mdxJsxToMarkdown as J } from "mdast-util-mdx-jsx";
3
+ import { visit as ge, EXIT as xe } from "unist-util-visit";
4
+ import { jsx as p, jsxs as v, Fragment as y } from "react/jsx-runtime";
5
+ import { createContext as N, useContext as q, useState as ke, useRef as Ce, useEffect as be } from "react";
6
+ import { Label as A, Select as L, TextInput as we, Textarea as ve, Checkbox as ye, DatePicker as Ae } from "@trussworks/react-uswds";
7
+ import { Block as kn, Caption as Cn, CatalogContent as bn, Chapter as wn, Chart as vn, CompareImage as yn, DatasetSelectorModal as An, DevseedUiThemeProvider as Fn, ExplorationAndAnalysis as Sn, Figure as Tn, Image as En, LegacyGlobalStyles as Pn, MapBlock as _n, PageFooter as Bn, PageHeader as Mn, PageHero as Ln, Prose as Rn, ReactQueryProvider as Dn, ScrollytellingBlock as In, StoriesHubContent as jn, VedaUIProvider as Hn, externalDatasetsAtom as On, timelineDatasetsAtom as zn, useFiltersWithQS as $n, useTimelineDatasetAtom as Gn } from "@teamimpact/veda-ui";
8
+ const R = {}.hasOwnProperty;
9
+ function Fe(e, n) {
10
+ const t = n || {};
11
+ function r(i, ...c) {
12
+ let o = r.invalid;
13
+ const l = r.handlers;
14
+ if (i && R.call(i, e)) {
15
+ const a = String(i[e]);
16
+ o = R.call(l, a) ? l[a] : r.unknown;
17
+ }
18
+ if (o)
19
+ return o.call(this, i, ...c);
20
+ }
21
+ return r.handlers = t.handlers || {}, r.invalid = t.invalid, r.unknown = t.unknown, r;
22
+ }
23
+ const Se = {}.hasOwnProperty;
24
+ function V(e, n) {
25
+ let t = -1, r;
26
+ if (n.extensions)
27
+ for (; ++t < n.extensions.length; )
28
+ V(e, n.extensions[t]);
29
+ for (r in n)
30
+ if (Se.call(n, r))
31
+ switch (r) {
32
+ case "extensions":
33
+ break;
34
+ case "unsafe": {
35
+ D(e[r], n[r]);
36
+ break;
37
+ }
38
+ case "join": {
39
+ D(e[r], n[r]);
40
+ break;
41
+ }
42
+ case "handlers": {
43
+ Te(e[r], n[r]);
44
+ break;
45
+ }
46
+ default:
47
+ e.options[r] = n[r];
48
+ }
49
+ return e;
50
+ }
51
+ function D(e, n) {
52
+ n && e.push(...n);
53
+ }
54
+ function Te(e, n) {
55
+ n && Object.assign(e, n);
56
+ }
57
+ function Ee(e, n, t, r) {
58
+ const i = t.enter("blockquote"), c = t.createTracker(r);
59
+ c.move("> "), c.shift(2);
60
+ const o = t.indentLines(
61
+ t.containerFlow(e, c.current()),
62
+ Pe
63
+ );
64
+ return i(), o;
65
+ }
66
+ function Pe(e, n, t) {
67
+ return ">" + (t ? "" : " ") + e;
68
+ }
69
+ function U(e, n) {
70
+ return I(e, n.inConstruct, !0) && !I(e, n.notInConstruct, !1);
71
+ }
72
+ function I(e, n, t) {
73
+ if (typeof n == "string" && (n = [n]), !n || n.length === 0)
74
+ return t;
75
+ let r = -1;
76
+ for (; ++r < n.length; )
77
+ if (e.includes(n[r]))
78
+ return !0;
79
+ return !1;
80
+ }
81
+ function j(e, n, t, r) {
82
+ let i = -1;
83
+ for (; ++i < t.unsafe.length; )
84
+ if (t.unsafe[i].character === `
85
+ ` && U(t.stack, t.unsafe[i]))
86
+ return /[ \t]/.test(r.before) ? "" : " ";
87
+ return `\\
88
+ `;
89
+ }
90
+ function _e(e, n) {
91
+ const t = String(e);
92
+ let r = t.indexOf(n), i = r, c = 0, o = 0;
93
+ if (typeof n != "string")
94
+ throw new TypeError("Expected substring");
95
+ for (; r !== -1; )
96
+ r === i ? ++c > o && (o = c) : c = 1, i = r + n.length, r = t.indexOf(n, i);
97
+ return o;
98
+ }
99
+ function P(e, n) {
100
+ return !!(n.options.fences === !1 && e.value && // If there’s no info…
101
+ !e.lang && // And there’s a non-whitespace character…
102
+ /[^ \r\n]/.test(e.value) && // And the value doesn’t start or end in a blank…
103
+ !/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value));
104
+ }
105
+ function Be(e) {
106
+ const n = e.options.fence || "`";
107
+ if (n !== "`" && n !== "~")
108
+ throw new Error(
109
+ "Cannot serialize code with `" + n + "` for `options.fence`, expected `` ` `` or `~`"
110
+ );
111
+ return n;
112
+ }
113
+ function Me(e, n, t, r) {
114
+ const i = Be(t), c = e.value || "", o = i === "`" ? "GraveAccent" : "Tilde";
115
+ if (P(e, t)) {
116
+ const f = t.enter("codeIndented"), h = t.indentLines(c, Le);
117
+ return f(), h;
118
+ }
119
+ const l = t.createTracker(r), a = i.repeat(Math.max(_e(c, i) + 1, 3)), s = t.enter("codeFenced");
120
+ let u = l.move(a);
121
+ if (e.lang) {
122
+ const f = t.enter(`codeFencedLang${o}`);
123
+ u += l.move(
124
+ t.safe(e.lang, {
125
+ before: u,
126
+ after: " ",
127
+ encode: ["`"],
128
+ ...l.current()
129
+ })
130
+ ), f();
131
+ }
132
+ if (e.lang && e.meta) {
133
+ const f = t.enter(`codeFencedMeta${o}`);
134
+ u += l.move(" "), u += l.move(
135
+ t.safe(e.meta, {
136
+ before: u,
137
+ after: `
138
+ `,
139
+ encode: ["`"],
140
+ ...l.current()
141
+ })
142
+ ), f();
143
+ }
144
+ return u += l.move(`
145
+ `), c && (u += l.move(c + `
146
+ `)), u += l.move(a), s(), u;
147
+ }
148
+ function Le(e, n, t) {
149
+ return (t ? "" : " ") + e;
150
+ }
151
+ function _(e) {
152
+ const n = e.options.quote || '"';
153
+ if (n !== '"' && n !== "'")
154
+ throw new Error(
155
+ "Cannot serialize title with `" + n + "` for `options.quote`, expected `\"`, or `'`"
156
+ );
157
+ return n;
158
+ }
159
+ function Re(e, n, t, r) {
160
+ const i = _(t), c = i === '"' ? "Quote" : "Apostrophe", o = t.enter("definition");
161
+ let l = t.enter("label");
162
+ const a = t.createTracker(r);
163
+ let s = a.move("[");
164
+ return s += a.move(
165
+ t.safe(t.associationId(e), {
166
+ before: s,
167
+ after: "]",
168
+ ...a.current()
169
+ })
170
+ ), s += a.move("]: "), l(), // If there’s no url, or…
171
+ !e.url || // If there are control characters or whitespace.
172
+ /[\0- \u007F]/.test(e.url) ? (l = t.enter("destinationLiteral"), s += a.move("<"), s += a.move(
173
+ t.safe(e.url, { before: s, after: ">", ...a.current() })
174
+ ), s += a.move(">")) : (l = t.enter("destinationRaw"), s += a.move(
175
+ t.safe(e.url, {
176
+ before: s,
177
+ after: e.title ? " " : `
178
+ `,
179
+ ...a.current()
180
+ })
181
+ )), l(), e.title && (l = t.enter(`title${c}`), s += a.move(" " + i), s += a.move(
182
+ t.safe(e.title, {
183
+ before: s,
184
+ after: i,
185
+ ...a.current()
186
+ })
187
+ ), s += a.move(i), l()), o(), s;
188
+ }
189
+ function De(e) {
190
+ const n = e.options.emphasis || "*";
191
+ if (n !== "*" && n !== "_")
192
+ throw new Error(
193
+ "Cannot serialize emphasis with `" + n + "` for `options.emphasis`, expected `*`, or `_`"
194
+ );
195
+ return n;
196
+ }
197
+ function b(e) {
198
+ return "&#x" + e.toString(16).toUpperCase() + ";";
199
+ }
200
+ function Ie(e) {
201
+ return e !== null && (e < 0 || e === 32);
202
+ }
203
+ const je = Q(/\p{P}|\p{S}/u), He = Q(/\s/);
204
+ function Q(e) {
205
+ return n;
206
+ function n(t) {
207
+ return t !== null && t > -1 && e.test(String.fromCharCode(t));
208
+ }
209
+ }
210
+ function H(e) {
211
+ if (e === null || Ie(e) || He(e))
212
+ return 1;
213
+ if (je(e))
214
+ return 2;
215
+ }
216
+ function S(e, n, t) {
217
+ const r = H(e), i = H(n);
218
+ return r === void 0 ? i === void 0 ? (
219
+ // Letter inside:
220
+ // we have to encode *both* letters for `_` as it is looser.
221
+ // it already forms for `*` (and GFMs `~`).
222
+ t === "_" ? { inside: !0, outside: !0 } : { inside: !1, outside: !1 }
223
+ ) : i === 1 ? (
224
+ // Whitespace inside: encode both (letter, whitespace).
225
+ { inside: !0, outside: !0 }
226
+ ) : (
227
+ // Punctuation inside: encode outer (letter)
228
+ { inside: !1, outside: !0 }
229
+ ) : r === 1 ? i === void 0 ? (
230
+ // Letter inside: already forms.
231
+ { inside: !1, outside: !1 }
232
+ ) : i === 1 ? (
233
+ // Whitespace inside: encode both (whitespace).
234
+ { inside: !0, outside: !0 }
235
+ ) : (
236
+ // Punctuation inside: already forms.
237
+ { inside: !1, outside: !1 }
238
+ ) : i === void 0 ? (
239
+ // Letter inside: already forms.
240
+ { inside: !1, outside: !1 }
241
+ ) : i === 1 ? (
242
+ // Whitespace inside: encode inner (whitespace).
243
+ { inside: !0, outside: !1 }
244
+ ) : (
245
+ // Punctuation inside: already forms.
246
+ { inside: !1, outside: !1 }
247
+ );
248
+ }
249
+ W.peek = Oe;
250
+ function W(e, n, t, r) {
251
+ const i = De(t), c = t.enter("emphasis"), o = t.createTracker(r), l = o.move(i);
252
+ let a = o.move(
253
+ t.containerPhrasing(e, {
254
+ after: i,
255
+ before: l,
256
+ ...o.current()
257
+ })
258
+ );
259
+ const s = a.charCodeAt(0), u = S(
260
+ r.before.charCodeAt(r.before.length - 1),
261
+ s,
262
+ i
263
+ );
264
+ u.inside && (a = b(s) + a.slice(1));
265
+ const f = a.charCodeAt(a.length - 1), h = S(r.after.charCodeAt(0), f, i);
266
+ h.inside && (a = a.slice(0, -1) + b(f));
267
+ const m = o.move(i);
268
+ return c(), t.attentionEncodeSurroundingInfo = {
269
+ after: h.outside,
270
+ before: u.outside
271
+ }, l + a + m;
272
+ }
273
+ function Oe(e, n, t) {
274
+ return t.options.emphasis || "*";
275
+ }
276
+ const ze = {};
277
+ function Z(e, n) {
278
+ const t = ze, r = typeof t.includeImageAlt == "boolean" ? t.includeImageAlt : !0, i = typeof t.includeHtml == "boolean" ? t.includeHtml : !0;
279
+ return K(e, r, i);
280
+ }
281
+ function K(e, n, t) {
282
+ if ($e(e)) {
283
+ if ("value" in e)
284
+ return e.type === "html" && !t ? "" : e.value;
285
+ if (n && "alt" in e && e.alt)
286
+ return e.alt;
287
+ if ("children" in e)
288
+ return O(e.children, n, t);
289
+ }
290
+ return Array.isArray(e) ? O(e, n, t) : "";
291
+ }
292
+ function O(e, n, t) {
293
+ const r = [];
294
+ let i = -1;
295
+ for (; ++i < e.length; )
296
+ r[i] = K(e[i], n, t);
297
+ return r.join("");
298
+ }
299
+ function $e(e) {
300
+ return !!(e && typeof e == "object");
301
+ }
302
+ function X(e, n) {
303
+ let t = !1;
304
+ return ge(e, function(r) {
305
+ if ("value" in r && /\r?\n|\r/.test(r.value) || r.type === "break")
306
+ return t = !0, xe;
307
+ }), !!((!e.depth || e.depth < 3) && Z(e) && (n.options.setext || t));
308
+ }
309
+ function Ge(e, n, t, r) {
310
+ const i = Math.max(Math.min(6, e.depth || 1), 1), c = t.createTracker(r);
311
+ if (X(e, t)) {
312
+ const u = t.enter("headingSetext"), f = t.enter("phrasing"), h = t.containerPhrasing(e, {
313
+ ...c.current(),
314
+ before: `
315
+ `,
316
+ after: `
317
+ `
318
+ });
319
+ return f(), u(), h + `
320
+ ` + (i === 1 ? "=" : "-").repeat(
321
+ // The whole size…
322
+ h.length - // Minus the position of the character after the last EOL (or
323
+ // 0 if there is none)…
324
+ (Math.max(h.lastIndexOf("\r"), h.lastIndexOf(`
325
+ `)) + 1)
326
+ );
327
+ }
328
+ const o = "#".repeat(i), l = t.enter("headingAtx"), a = t.enter("phrasing");
329
+ c.move(o + " ");
330
+ let s = t.containerPhrasing(e, {
331
+ before: "# ",
332
+ after: `
333
+ `,
334
+ ...c.current()
335
+ });
336
+ return /^[\t ]/.test(s) && (s = b(s.charCodeAt(0)) + s.slice(1)), s = s ? o + " " + s : o, t.options.closeAtx && (s += " " + o), a(), l(), s;
337
+ }
338
+ Y.peek = Je;
339
+ function Y(e) {
340
+ return e.value || "";
341
+ }
342
+ function Je() {
343
+ return "<";
344
+ }
345
+ ee.peek = Ne;
346
+ function ee(e, n, t, r) {
347
+ const i = _(t), c = i === '"' ? "Quote" : "Apostrophe", o = t.enter("image");
348
+ let l = t.enter("label");
349
+ const a = t.createTracker(r);
350
+ let s = a.move("![");
351
+ return s += a.move(
352
+ t.safe(e.alt, { before: s, after: "]", ...a.current() })
353
+ ), s += a.move("]("), l(), // If there’s no url but there is a title…
354
+ !e.url && e.title || // If there are control characters or whitespace.
355
+ /[\0- \u007F]/.test(e.url) ? (l = t.enter("destinationLiteral"), s += a.move("<"), s += a.move(
356
+ t.safe(e.url, { before: s, after: ">", ...a.current() })
357
+ ), s += a.move(">")) : (l = t.enter("destinationRaw"), s += a.move(
358
+ t.safe(e.url, {
359
+ before: s,
360
+ after: e.title ? " " : ")",
361
+ ...a.current()
362
+ })
363
+ )), l(), e.title && (l = t.enter(`title${c}`), s += a.move(" " + i), s += a.move(
364
+ t.safe(e.title, {
365
+ before: s,
366
+ after: i,
367
+ ...a.current()
368
+ })
369
+ ), s += a.move(i), l()), s += a.move(")"), o(), s;
370
+ }
371
+ function Ne() {
372
+ return "!";
373
+ }
374
+ te.peek = qe;
375
+ function te(e, n, t, r) {
376
+ const i = e.referenceType, c = t.enter("imageReference");
377
+ let o = t.enter("label");
378
+ const l = t.createTracker(r);
379
+ let a = l.move("![");
380
+ const s = t.safe(e.alt, {
381
+ before: a,
382
+ after: "]",
383
+ ...l.current()
384
+ });
385
+ a += l.move(s + "]["), o();
386
+ const u = t.stack;
387
+ t.stack = [], o = t.enter("reference");
388
+ const f = t.safe(t.associationId(e), {
389
+ before: a,
390
+ after: "]",
391
+ ...l.current()
392
+ });
393
+ return o(), t.stack = u, c(), i === "full" || !s || s !== f ? a += l.move(f + "]") : i === "shortcut" ? a = a.slice(0, -1) : a += l.move("]"), a;
394
+ }
395
+ function qe() {
396
+ return "!";
397
+ }
398
+ ne.peek = Ve;
399
+ function ne(e, n, t) {
400
+ let r = e.value || "", i = "`", c = -1;
401
+ for (; new RegExp("(^|[^`])" + i + "([^`]|$)").test(r); )
402
+ i += "`";
403
+ for (/[^ \r\n]/.test(r) && (/^[ \r\n]/.test(r) && /[ \r\n]$/.test(r) || /^`|`$/.test(r)) && (r = " " + r + " "); ++c < t.unsafe.length; ) {
404
+ const o = t.unsafe[c], l = t.compilePattern(o);
405
+ let a;
406
+ if (o.atBreak)
407
+ for (; a = l.exec(r); ) {
408
+ let s = a.index;
409
+ r.charCodeAt(s) === 10 && r.charCodeAt(s - 1) === 13 && s--, r = r.slice(0, s) + " " + r.slice(a.index + 1);
410
+ }
411
+ }
412
+ return i + r + i;
413
+ }
414
+ function Ve() {
415
+ return "`";
416
+ }
417
+ function re(e, n) {
418
+ const t = Z(e);
419
+ return !!(!n.options.resourceLink && // If there’s a url…
420
+ e.url && // And there’s a no title…
421
+ !e.title && // And the content of `node` is a single text node…
422
+ e.children && e.children.length === 1 && e.children[0].type === "text" && // And if the url is the same as the content…
423
+ (t === e.url || "mailto:" + t === e.url) && // And that starts w/ a protocol…
424
+ /^[a-z][a-z+.-]+:/i.test(e.url) && // And that doesn’t contain ASCII control codes (character escapes and
425
+ // references don’t work), space, or angle brackets…
426
+ !/[\0- <>\u007F]/.test(e.url));
427
+ }
428
+ ie.peek = Ue;
429
+ function ie(e, n, t, r) {
430
+ const i = _(t), c = i === '"' ? "Quote" : "Apostrophe", o = t.createTracker(r);
431
+ let l, a;
432
+ if (re(e, t)) {
433
+ const u = t.stack;
434
+ t.stack = [], l = t.enter("autolink");
435
+ let f = o.move("<");
436
+ return f += o.move(
437
+ t.containerPhrasing(e, {
438
+ before: f,
439
+ after: ">",
440
+ ...o.current()
441
+ })
442
+ ), f += o.move(">"), l(), t.stack = u, f;
443
+ }
444
+ l = t.enter("link"), a = t.enter("label");
445
+ let s = o.move("[");
446
+ return s += o.move(
447
+ t.containerPhrasing(e, {
448
+ before: s,
449
+ after: "](",
450
+ ...o.current()
451
+ })
452
+ ), s += o.move("]("), a(), // If there’s no url but there is a title…
453
+ !e.url && e.title || // If there are control characters or whitespace.
454
+ /[\0- \u007F]/.test(e.url) ? (a = t.enter("destinationLiteral"), s += o.move("<"), s += o.move(
455
+ t.safe(e.url, { before: s, after: ">", ...o.current() })
456
+ ), s += o.move(">")) : (a = t.enter("destinationRaw"), s += o.move(
457
+ t.safe(e.url, {
458
+ before: s,
459
+ after: e.title ? " " : ")",
460
+ ...o.current()
461
+ })
462
+ )), a(), e.title && (a = t.enter(`title${c}`), s += o.move(" " + i), s += o.move(
463
+ t.safe(e.title, {
464
+ before: s,
465
+ after: i,
466
+ ...o.current()
467
+ })
468
+ ), s += o.move(i), a()), s += o.move(")"), l(), s;
469
+ }
470
+ function Ue(e, n, t) {
471
+ return re(e, t) ? "<" : "[";
472
+ }
473
+ oe.peek = Qe;
474
+ function oe(e, n, t, r) {
475
+ const i = e.referenceType, c = t.enter("linkReference");
476
+ let o = t.enter("label");
477
+ const l = t.createTracker(r);
478
+ let a = l.move("[");
479
+ const s = t.containerPhrasing(e, {
480
+ before: a,
481
+ after: "]",
482
+ ...l.current()
483
+ });
484
+ a += l.move(s + "]["), o();
485
+ const u = t.stack;
486
+ t.stack = [], o = t.enter("reference");
487
+ const f = t.safe(t.associationId(e), {
488
+ before: a,
489
+ after: "]",
490
+ ...l.current()
491
+ });
492
+ return o(), t.stack = u, c(), i === "full" || !s || s !== f ? a += l.move(f + "]") : i === "shortcut" ? a = a.slice(0, -1) : a += l.move("]"), a;
493
+ }
494
+ function Qe() {
495
+ return "[";
496
+ }
497
+ function B(e) {
498
+ const n = e.options.bullet || "*";
499
+ if (n !== "*" && n !== "+" && n !== "-")
500
+ throw new Error(
501
+ "Cannot serialize items with `" + n + "` for `options.bullet`, expected `*`, `+`, or `-`"
502
+ );
503
+ return n;
504
+ }
505
+ function We(e) {
506
+ const n = B(e), t = e.options.bulletOther;
507
+ if (!t)
508
+ return n === "*" ? "-" : "*";
509
+ if (t !== "*" && t !== "+" && t !== "-")
510
+ throw new Error(
511
+ "Cannot serialize items with `" + t + "` for `options.bulletOther`, expected `*`, `+`, or `-`"
512
+ );
513
+ if (t === n)
514
+ throw new Error(
515
+ "Expected `bullet` (`" + n + "`) and `bulletOther` (`" + t + "`) to be different"
516
+ );
517
+ return t;
518
+ }
519
+ function Ze(e) {
520
+ const n = e.options.bulletOrdered || ".";
521
+ if (n !== "." && n !== ")")
522
+ throw new Error(
523
+ "Cannot serialize items with `" + n + "` for `options.bulletOrdered`, expected `.` or `)`"
524
+ );
525
+ return n;
526
+ }
527
+ function ce(e) {
528
+ const n = e.options.rule || "*";
529
+ if (n !== "*" && n !== "-" && n !== "_")
530
+ throw new Error(
531
+ "Cannot serialize rules with `" + n + "` for `options.rule`, expected `*`, `-`, or `_`"
532
+ );
533
+ return n;
534
+ }
535
+ function Ke(e, n, t, r) {
536
+ const i = t.enter("list"), c = t.bulletCurrent;
537
+ let o = e.ordered ? Ze(t) : B(t);
538
+ const l = e.ordered ? o === "." ? ")" : "." : We(t);
539
+ let a = n && t.bulletLastUsed ? o === t.bulletLastUsed : !1;
540
+ if (!e.ordered) {
541
+ const u = e.children ? e.children[0] : void 0;
542
+ if (
543
+ // Bullet could be used as a thematic break marker:
544
+ (o === "*" || o === "-") && // Empty first list item:
545
+ u && (!u.children || !u.children[0]) && // Directly in two other list items:
546
+ t.stack[t.stack.length - 1] === "list" && t.stack[t.stack.length - 2] === "listItem" && t.stack[t.stack.length - 3] === "list" && t.stack[t.stack.length - 4] === "listItem" && // That are each the first child.
547
+ t.indexStack[t.indexStack.length - 1] === 0 && t.indexStack[t.indexStack.length - 2] === 0 && t.indexStack[t.indexStack.length - 3] === 0 && (a = !0), ce(t) === o && u
548
+ ) {
549
+ let f = -1;
550
+ for (; ++f < e.children.length; ) {
551
+ const h = e.children[f];
552
+ if (h && h.type === "listItem" && h.children && h.children[0] && h.children[0].type === "thematicBreak") {
553
+ a = !0;
554
+ break;
555
+ }
556
+ }
557
+ }
558
+ }
559
+ a && (o = l), t.bulletCurrent = o;
560
+ const s = t.containerFlow(e, r);
561
+ return t.bulletLastUsed = o, t.bulletCurrent = c, i(), s;
562
+ }
563
+ function Xe(e) {
564
+ const n = e.options.listItemIndent || "one";
565
+ if (n !== "tab" && n !== "one" && n !== "mixed")
566
+ throw new Error(
567
+ "Cannot serialize items with `" + n + "` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`"
568
+ );
569
+ return n;
570
+ }
571
+ function Ye(e, n, t, r) {
572
+ const i = Xe(t);
573
+ let c = t.bulletCurrent || B(t);
574
+ n && n.type === "list" && n.ordered && (c = (typeof n.start == "number" && n.start > -1 ? n.start : 1) + (t.options.incrementListMarker === !1 ? 0 : n.children.indexOf(e)) + c);
575
+ let o = c.length + 1;
576
+ (i === "tab" || i === "mixed" && (n && n.type === "list" && n.spread || e.spread)) && (o = Math.ceil(o / 4) * 4);
577
+ const l = t.createTracker(r);
578
+ l.move(c + " ".repeat(o - c.length)), l.shift(o);
579
+ const a = t.enter("listItem"), s = t.indentLines(
580
+ t.containerFlow(e, l.current()),
581
+ u
582
+ );
583
+ return a(), s;
584
+ function u(f, h, m) {
585
+ return h ? (m ? "" : " ".repeat(o)) + f : (m ? c : c + " ".repeat(o - c.length)) + f;
586
+ }
587
+ }
588
+ function et(e, n, t, r) {
589
+ const i = t.enter("paragraph"), c = t.enter("phrasing"), o = t.containerPhrasing(e, r);
590
+ return c(), i(), o;
591
+ }
592
+ const ae = (
593
+ // Note: overloads in JSDoc can’t yet use different `@template`s.
594
+ /**
595
+ * @type {(
596
+ * (<Condition extends string>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & {type: Condition}) &
597
+ * (<Condition extends Props>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Condition) &
598
+ * (<Condition extends TestFunction>(test: Condition) => (node: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node & Predicate<Condition, Node>) &
599
+ * ((test?: null | undefined) => (node?: unknown, index?: number | null | undefined, parent?: Parent | null | undefined, context?: unknown) => node is Node) &
600
+ * ((test?: Test) => Check)
601
+ * )}
602
+ */
603
+ /**
604
+ * @param {Test} [test]
605
+ * @returns {Check}
606
+ */
607
+ function(e) {
608
+ if (e == null)
609
+ return it;
610
+ if (typeof e == "function")
611
+ return T(e);
612
+ if (typeof e == "object")
613
+ return Array.isArray(e) ? tt(e) : nt(e);
614
+ if (typeof e == "string")
615
+ return rt(e);
616
+ throw new Error("Expected function, string, or object as test");
617
+ }
618
+ );
619
+ function tt(e) {
620
+ const n = [];
621
+ let t = -1;
622
+ for (; ++t < e.length; )
623
+ n[t] = ae(e[t]);
624
+ return T(r);
625
+ function r(...i) {
626
+ let c = -1;
627
+ for (; ++c < n.length; )
628
+ if (n[c].apply(this, i)) return !0;
629
+ return !1;
630
+ }
631
+ }
632
+ function nt(e) {
633
+ const n = (
634
+ /** @type {Record<string, unknown>} */
635
+ e
636
+ );
637
+ return T(t);
638
+ function t(r) {
639
+ const i = (
640
+ /** @type {Record<string, unknown>} */
641
+ /** @type {unknown} */
642
+ r
643
+ );
644
+ let c;
645
+ for (c in e)
646
+ if (i[c] !== n[c]) return !1;
647
+ return !0;
648
+ }
649
+ }
650
+ function rt(e) {
651
+ return T(n);
652
+ function n(t) {
653
+ return t && t.type === e;
654
+ }
655
+ }
656
+ function T(e) {
657
+ return n;
658
+ function n(t, r, i) {
659
+ return !!(ot(t) && e.call(
660
+ this,
661
+ t,
662
+ typeof r == "number" ? r : void 0,
663
+ i || void 0
664
+ ));
665
+ }
666
+ }
667
+ function it() {
668
+ return !0;
669
+ }
670
+ function ot(e) {
671
+ return e !== null && typeof e == "object" && "type" in e;
672
+ }
673
+ const ct = (
674
+ /** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
675
+ ae([
676
+ "break",
677
+ "delete",
678
+ "emphasis",
679
+ // To do: next major: removed since footnotes were added to GFM.
680
+ "footnote",
681
+ "footnoteReference",
682
+ "image",
683
+ "imageReference",
684
+ "inlineCode",
685
+ // Enabled by `mdast-util-math`:
686
+ "inlineMath",
687
+ "link",
688
+ "linkReference",
689
+ // Enabled by `mdast-util-mdx`:
690
+ "mdxJsxTextElement",
691
+ // Enabled by `mdast-util-mdx`:
692
+ "mdxTextExpression",
693
+ "strong",
694
+ "text",
695
+ // Enabled by `mdast-util-directive`:
696
+ "textDirective"
697
+ ])
698
+ );
699
+ function at(e, n, t, r) {
700
+ return (e.children.some(function(o) {
701
+ return ct(o);
702
+ }) ? t.containerPhrasing : t.containerFlow).call(t, e, r);
703
+ }
704
+ function lt(e) {
705
+ const n = e.options.strong || "*";
706
+ if (n !== "*" && n !== "_")
707
+ throw new Error(
708
+ "Cannot serialize strong with `" + n + "` for `options.strong`, expected `*`, or `_`"
709
+ );
710
+ return n;
711
+ }
712
+ le.peek = st;
713
+ function le(e, n, t, r) {
714
+ const i = lt(t), c = t.enter("strong"), o = t.createTracker(r), l = o.move(i + i);
715
+ let a = o.move(
716
+ t.containerPhrasing(e, {
717
+ after: i,
718
+ before: l,
719
+ ...o.current()
720
+ })
721
+ );
722
+ const s = a.charCodeAt(0), u = S(
723
+ r.before.charCodeAt(r.before.length - 1),
724
+ s,
725
+ i
726
+ );
727
+ u.inside && (a = b(s) + a.slice(1));
728
+ const f = a.charCodeAt(a.length - 1), h = S(r.after.charCodeAt(0), f, i);
729
+ h.inside && (a = a.slice(0, -1) + b(f));
730
+ const m = o.move(i + i);
731
+ return c(), t.attentionEncodeSurroundingInfo = {
732
+ after: h.outside,
733
+ before: u.outside
734
+ }, l + a + m;
735
+ }
736
+ function st(e, n, t) {
737
+ return t.options.strong || "*";
738
+ }
739
+ function ut(e, n, t, r) {
740
+ return t.safe(e.value, r);
741
+ }
742
+ function ft(e) {
743
+ const n = e.options.ruleRepetition || 3;
744
+ if (n < 3)
745
+ throw new Error(
746
+ "Cannot serialize rules with repetition `" + n + "` for `options.ruleRepetition`, expected `3` or more"
747
+ );
748
+ return n;
749
+ }
750
+ function ht(e, n, t) {
751
+ const r = (ce(t) + (t.options.ruleSpaces ? " " : "")).repeat(ft(t));
752
+ return t.options.ruleSpaces ? r.slice(0, -1) : r;
753
+ }
754
+ const dt = {
755
+ blockquote: Ee,
756
+ break: j,
757
+ code: Me,
758
+ definition: Re,
759
+ emphasis: W,
760
+ hardBreak: j,
761
+ heading: Ge,
762
+ html: Y,
763
+ image: ee,
764
+ imageReference: te,
765
+ inlineCode: ne,
766
+ link: ie,
767
+ linkReference: oe,
768
+ list: Ke,
769
+ listItem: Ye,
770
+ paragraph: et,
771
+ root: at,
772
+ strong: le,
773
+ text: ut,
774
+ thematicBreak: ht
775
+ }, pt = [mt];
776
+ function mt(e, n, t, r) {
777
+ if (n.type === "code" && P(n, r) && (e.type === "list" || e.type === n.type && P(e, r)))
778
+ return !1;
779
+ if ("spread" in t && typeof t.spread == "boolean")
780
+ return e.type === "paragraph" && // Two paragraphs.
781
+ (e.type === n.type || n.type === "definition" || // Paragraph followed by a setext heading.
782
+ n.type === "heading" && X(n, r)) ? void 0 : t.spread ? 1 : 0;
783
+ }
784
+ const w = [
785
+ "autolink",
786
+ "destinationLiteral",
787
+ "destinationRaw",
788
+ "reference",
789
+ "titleQuote",
790
+ "titleApostrophe"
791
+ ], gt = [
792
+ { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" },
793
+ { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" },
794
+ {
795
+ character: " ",
796
+ inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde"]
797
+ },
798
+ {
799
+ character: "\r",
800
+ inConstruct: [
801
+ "codeFencedLangGraveAccent",
802
+ "codeFencedLangTilde",
803
+ "codeFencedMetaGraveAccent",
804
+ "codeFencedMetaTilde",
805
+ "destinationLiteral",
806
+ "headingAtx"
807
+ ]
808
+ },
809
+ {
810
+ character: `
811
+ `,
812
+ inConstruct: [
813
+ "codeFencedLangGraveAccent",
814
+ "codeFencedLangTilde",
815
+ "codeFencedMetaGraveAccent",
816
+ "codeFencedMetaTilde",
817
+ "destinationLiteral",
818
+ "headingAtx"
819
+ ]
820
+ },
821
+ { character: " ", after: "[\\r\\n]", inConstruct: "phrasing" },
822
+ { character: " ", before: "[\\r\\n]", inConstruct: "phrasing" },
823
+ {
824
+ character: " ",
825
+ inConstruct: ["codeFencedLangGraveAccent", "codeFencedLangTilde"]
826
+ },
827
+ // An exclamation mark can start an image, if it is followed by a link or
828
+ // a link reference.
829
+ {
830
+ character: "!",
831
+ after: "\\[",
832
+ inConstruct: "phrasing",
833
+ notInConstruct: w
834
+ },
835
+ // A quote can break out of a title.
836
+ { character: '"', inConstruct: "titleQuote" },
837
+ // A number sign could start an ATX heading if it starts a line.
838
+ { atBreak: !0, character: "#" },
839
+ { character: "#", inConstruct: "headingAtx", after: `(?:[\r
840
+ ]|$)` },
841
+ // Dollar sign and percentage are not used in markdown.
842
+ // An ampersand could start a character reference.
843
+ { character: "&", after: "[#A-Za-z]", inConstruct: "phrasing" },
844
+ // An apostrophe can break out of a title.
845
+ { character: "'", inConstruct: "titleApostrophe" },
846
+ // A left paren could break out of a destination raw.
847
+ { character: "(", inConstruct: "destinationRaw" },
848
+ // A left paren followed by `]` could make something into a link or image.
849
+ {
850
+ before: "\\]",
851
+ character: "(",
852
+ inConstruct: "phrasing",
853
+ notInConstruct: w
854
+ },
855
+ // A right paren could start a list item or break out of a destination
856
+ // raw.
857
+ { atBreak: !0, before: "\\d+", character: ")" },
858
+ { character: ")", inConstruct: "destinationRaw" },
859
+ // An asterisk can start thematic breaks, list items, emphasis, strong.
860
+ { atBreak: !0, character: "*", after: `(?:[ \r
861
+ *])` },
862
+ { character: "*", inConstruct: "phrasing", notInConstruct: w },
863
+ // A plus sign could start a list item.
864
+ { atBreak: !0, character: "+", after: `(?:[ \r
865
+ ])` },
866
+ // A dash can start thematic breaks, list items, and setext heading
867
+ // underlines.
868
+ { atBreak: !0, character: "-", after: `(?:[ \r
869
+ -])` },
870
+ // A dot could start a list item.
871
+ { atBreak: !0, before: "\\d+", character: ".", after: `(?:[ \r
872
+ ]|$)` },
873
+ // Slash, colon, and semicolon are not used in markdown for constructs.
874
+ // A less than can start html (flow or text) or an autolink.
875
+ // HTML could start with an exclamation mark (declaration, cdata, comment),
876
+ // slash (closing tag), question mark (instruction), or a letter (tag).
877
+ // An autolink also starts with a letter.
878
+ // Finally, it could break out of a destination literal.
879
+ { atBreak: !0, character: "<", after: "[!/?A-Za-z]" },
880
+ {
881
+ character: "<",
882
+ after: "[!/?A-Za-z]",
883
+ inConstruct: "phrasing",
884
+ notInConstruct: w
885
+ },
886
+ { character: "<", inConstruct: "destinationLiteral" },
887
+ // An equals to can start setext heading underlines.
888
+ { atBreak: !0, character: "=" },
889
+ // A greater than can start block quotes and it can break out of a
890
+ // destination literal.
891
+ { atBreak: !0, character: ">" },
892
+ { character: ">", inConstruct: "destinationLiteral" },
893
+ // Question mark and at sign are not used in markdown for constructs.
894
+ // A left bracket can start definitions, references, labels,
895
+ { atBreak: !0, character: "[" },
896
+ { character: "[", inConstruct: "phrasing", notInConstruct: w },
897
+ { character: "[", inConstruct: ["label", "reference"] },
898
+ // A backslash can start an escape (when followed by punctuation) or a
899
+ // hard break (when followed by an eol).
900
+ // Note: typical escapes are handled in `safe`!
901
+ { character: "\\", after: "[\\r\\n]", inConstruct: "phrasing" },
902
+ // A right bracket can exit labels.
903
+ { character: "]", inConstruct: ["label", "reference"] },
904
+ // Caret is not used in markdown for constructs.
905
+ // An underscore can start emphasis, strong, or a thematic break.
906
+ { atBreak: !0, character: "_" },
907
+ { character: "_", inConstruct: "phrasing", notInConstruct: w },
908
+ // A grave accent can start code (fenced or text), or it can break out of
909
+ // a grave accent code fence.
910
+ { atBreak: !0, character: "`" },
911
+ {
912
+ character: "`",
913
+ inConstruct: ["codeFencedLangGraveAccent", "codeFencedMetaGraveAccent"]
914
+ },
915
+ { character: "`", inConstruct: "phrasing", notInConstruct: w },
916
+ // Left brace, vertical bar, right brace are not used in markdown for
917
+ // constructs.
918
+ // A tilde can start code (fenced).
919
+ { atBreak: !0, character: "~" }
920
+ ], z = document.createElement("i");
921
+ function xt(e) {
922
+ const n = "&" + e + ";";
923
+ z.innerHTML = n;
924
+ const t = z.textContent;
925
+ return (
926
+ // @ts-expect-error: TypeScript is wrong that `textContent` on elements can
927
+ // yield `null`.
928
+ t.charCodeAt(t.length - 1) === 59 && e !== "semi" || t === n ? !1 : t
929
+ );
930
+ }
931
+ function kt(e, n) {
932
+ const t = Number.parseInt(e, n);
933
+ return (
934
+ // C0 except for HT, LF, FF, CR, space.
935
+ t < 9 || t === 11 || t > 13 && t < 32 || // Control character (DEL) of C0, and C1 controls.
936
+ t > 126 && t < 160 || // Lone high surrogates and low surrogates.
937
+ t > 55295 && t < 57344 || // Noncharacters.
938
+ t > 64975 && t < 65008 || /* eslint-disable no-bitwise */
939
+ (t & 65535) === 65535 || (t & 65535) === 65534 || /* eslint-enable no-bitwise */
940
+ // Out of range
941
+ t > 1114111 ? "�" : String.fromCodePoint(t)
942
+ );
943
+ }
944
+ const Ct = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
945
+ function bt(e) {
946
+ return e.replace(Ct, wt);
947
+ }
948
+ function wt(e, n, t) {
949
+ if (n)
950
+ return n;
951
+ if (t.charCodeAt(0) === 35) {
952
+ const i = t.charCodeAt(1), c = i === 120 || i === 88;
953
+ return kt(t.slice(c ? 2 : 1), c ? 16 : 10);
954
+ }
955
+ return xt(t) || e;
956
+ }
957
+ function vt(e) {
958
+ return e.label || !e.identifier ? e.label || "" : bt(e.identifier);
959
+ }
960
+ function yt(e) {
961
+ if (!e._compiled) {
962
+ const n = (e.atBreak ? "[\\r\\n][\\t ]*" : "") + (e.before ? "(?:" + e.before + ")" : "");
963
+ e._compiled = new RegExp(
964
+ (n ? "(" + n + ")" : "") + (/[|\\{}()[\]^$+*?.-]/.test(e.character) ? "\\" : "") + e.character + (e.after ? "(?:" + e.after + ")" : ""),
965
+ "g"
966
+ );
967
+ }
968
+ return e._compiled;
969
+ }
970
+ function At(e, n, t) {
971
+ const r = n.indexStack, i = e.children || [], c = [];
972
+ let o = -1, l = t.before, a;
973
+ r.push(-1);
974
+ let s = n.createTracker(t);
975
+ for (; ++o < i.length; ) {
976
+ const u = i[o];
977
+ let f;
978
+ if (r[r.length - 1] = o, o + 1 < i.length) {
979
+ let g = n.handle.handlers[i[o + 1].type];
980
+ g && g.peek && (g = g.peek), f = g ? g(i[o + 1], e, n, {
981
+ before: "",
982
+ after: "",
983
+ ...s.current()
984
+ }).charAt(0) : "";
985
+ } else
986
+ f = t.after;
987
+ c.length > 0 && (l === "\r" || l === `
988
+ `) && u.type === "html" && (c[c.length - 1] = c[c.length - 1].replace(
989
+ /(\r?\n|\r)$/,
990
+ " "
991
+ ), l = " ", s = n.createTracker(t), s.move(c.join("")));
992
+ let h = n.handle(u, e, n, {
993
+ ...s.current(),
994
+ after: f,
995
+ before: l
996
+ });
997
+ a && a === h.slice(0, 1) && (h = b(a.charCodeAt(0)) + h.slice(1));
998
+ const m = n.attentionEncodeSurroundingInfo;
999
+ n.attentionEncodeSurroundingInfo = void 0, a = void 0, m && (c.length > 0 && m.before && l === c[c.length - 1].slice(-1) && (c[c.length - 1] = c[c.length - 1].slice(0, -1) + b(l.charCodeAt(0))), m.after && (a = f)), s.move(h), c.push(h), l = h.slice(-1);
1000
+ }
1001
+ return r.pop(), c.join("");
1002
+ }
1003
+ function Ft(e, n, t) {
1004
+ const r = n.indexStack, i = e.children || [], c = n.createTracker(t), o = [];
1005
+ let l = -1;
1006
+ for (r.push(-1); ++l < i.length; ) {
1007
+ const a = i[l];
1008
+ r[r.length - 1] = l, o.push(
1009
+ c.move(
1010
+ n.handle(a, e, n, {
1011
+ before: `
1012
+ `,
1013
+ after: `
1014
+ `,
1015
+ ...c.current()
1016
+ })
1017
+ )
1018
+ ), a.type !== "list" && (n.bulletLastUsed = void 0), l < i.length - 1 && o.push(
1019
+ c.move(St(a, i[l + 1], e, n))
1020
+ );
1021
+ }
1022
+ return r.pop(), o.join("");
1023
+ }
1024
+ function St(e, n, t, r) {
1025
+ let i = r.join.length;
1026
+ for (; i--; ) {
1027
+ const c = r.join[i](e, n, t, r);
1028
+ if (c === !0 || c === 1)
1029
+ break;
1030
+ if (typeof c == "number")
1031
+ return `
1032
+ `.repeat(1 + c);
1033
+ if (c === !1)
1034
+ return `
1035
+
1036
+ <!---->
1037
+
1038
+ `;
1039
+ }
1040
+ return `
1041
+
1042
+ `;
1043
+ }
1044
+ const Tt = /\r?\n|\r/g;
1045
+ function Et(e, n) {
1046
+ const t = [];
1047
+ let r = 0, i = 0, c;
1048
+ for (; c = Tt.exec(e); )
1049
+ o(e.slice(r, c.index)), t.push(c[0]), r = c.index + c[0].length, i++;
1050
+ return o(e.slice(r)), t.join("");
1051
+ function o(l) {
1052
+ t.push(n(l, i, !l));
1053
+ }
1054
+ }
1055
+ function Pt(e, n, t) {
1056
+ const r = (t.before || "") + (n || "") + (t.after || ""), i = [], c = [], o = {};
1057
+ let l = -1;
1058
+ for (; ++l < e.unsafe.length; ) {
1059
+ const u = e.unsafe[l];
1060
+ if (!U(e.stack, u))
1061
+ continue;
1062
+ const f = e.compilePattern(u);
1063
+ let h;
1064
+ for (; h = f.exec(r); ) {
1065
+ const m = "before" in u || !!u.atBreak, g = "after" in u, k = h.index + (m ? h[1].length : 0);
1066
+ i.includes(k) ? (o[k].before && !m && (o[k].before = !1), o[k].after && !g && (o[k].after = !1)) : (i.push(k), o[k] = { before: m, after: g });
1067
+ }
1068
+ }
1069
+ i.sort(_t);
1070
+ let a = t.before ? t.before.length : 0;
1071
+ const s = r.length - (t.after ? t.after.length : 0);
1072
+ for (l = -1; ++l < i.length; ) {
1073
+ const u = i[l];
1074
+ u < a || u >= s || u + 1 < s && i[l + 1] === u + 1 && o[u].after && !o[u + 1].before && !o[u + 1].after || i[l - 1] === u - 1 && o[u].before && !o[u - 1].before && !o[u - 1].after || (a !== u && c.push($(r.slice(a, u), "\\")), a = u, /[!-/:-@[-`{-~]/.test(r.charAt(u)) && (!t.encode || !t.encode.includes(r.charAt(u))) ? c.push("\\") : (c.push(b(r.charCodeAt(u))), a++));
1075
+ }
1076
+ return c.push($(r.slice(a, s), t.after)), c.join("");
1077
+ }
1078
+ function _t(e, n) {
1079
+ return e - n;
1080
+ }
1081
+ function $(e, n) {
1082
+ const t = /\\(?=[!-/:-@[-`{-~])/g, r = [], i = [], c = e + n;
1083
+ let o = -1, l = 0, a;
1084
+ for (; a = t.exec(c); )
1085
+ r.push(a.index);
1086
+ for (; ++o < r.length; )
1087
+ l !== r[o] && i.push(e.slice(l, r[o])), i.push("\\"), l = r[o];
1088
+ return i.push(e.slice(l)), i.join("");
1089
+ }
1090
+ function Bt(e) {
1091
+ const n = e || {}, t = n.now || {};
1092
+ let r = n.lineShift || 0, i = t.line || 1, c = t.column || 1;
1093
+ return { move: a, current: o, shift: l };
1094
+ function o() {
1095
+ return { now: { line: i, column: c }, lineShift: r };
1096
+ }
1097
+ function l(s) {
1098
+ r += s;
1099
+ }
1100
+ function a(s) {
1101
+ const u = s || "", f = u.split(/\r?\n|\r/g), h = f[f.length - 1];
1102
+ return i += f.length - 1, c = f.length === 1 ? c + h.length : 1 + h.length + r, u;
1103
+ }
1104
+ }
1105
+ function Mt(e, n) {
1106
+ const t = n || {}, r = {
1107
+ associationId: vt,
1108
+ containerPhrasing: It,
1109
+ containerFlow: jt,
1110
+ createTracker: Bt,
1111
+ compilePattern: yt,
1112
+ enter: c,
1113
+ // @ts-expect-error: GFM / frontmatter are typed in `mdast` but not defined
1114
+ // here.
1115
+ handlers: { ...dt },
1116
+ // @ts-expect-error: add `handle` in a second.
1117
+ handle: void 0,
1118
+ indentLines: Et,
1119
+ indexStack: [],
1120
+ join: [...pt],
1121
+ options: {},
1122
+ safe: Ht,
1123
+ stack: [],
1124
+ unsafe: [...gt]
1125
+ };
1126
+ V(r, t), r.options.tightDefinitions && r.join.push(Dt), r.handle = Fe("type", {
1127
+ invalid: Lt,
1128
+ unknown: Rt,
1129
+ handlers: r.handlers
1130
+ });
1131
+ let i = r.handle(e, void 0, r, {
1132
+ before: `
1133
+ `,
1134
+ after: `
1135
+ `,
1136
+ now: { line: 1, column: 1 },
1137
+ lineShift: 0
1138
+ });
1139
+ return i && i.charCodeAt(i.length - 1) !== 10 && i.charCodeAt(i.length - 1) !== 13 && (i += `
1140
+ `), i;
1141
+ function c(o) {
1142
+ return r.stack.push(o), l;
1143
+ function l() {
1144
+ r.stack.pop();
1145
+ }
1146
+ }
1147
+ }
1148
+ function Lt(e) {
1149
+ throw new Error("Cannot handle value `" + e + "`, expected node");
1150
+ }
1151
+ function Rt(e) {
1152
+ const n = (
1153
+ /** @type {Nodes} */
1154
+ e
1155
+ );
1156
+ throw new Error("Cannot handle unknown node `" + n.type + "`");
1157
+ }
1158
+ function Dt(e, n) {
1159
+ if (e.type === "definition" && e.type === n.type)
1160
+ return 0;
1161
+ }
1162
+ function It(e, n) {
1163
+ return At(e, this, n);
1164
+ }
1165
+ function jt(e, n) {
1166
+ return Ft(e, this, n);
1167
+ }
1168
+ function Ht(e, n) {
1169
+ return Pt(this, e, n);
1170
+ }
1171
+ function Ot() {
1172
+ return {
1173
+ handlers: {
1174
+ mdxFlowExpression: G,
1175
+ mdxTextExpression: G
1176
+ },
1177
+ unsafe: [
1178
+ { character: "{", inConstruct: ["phrasing"] },
1179
+ { atBreak: !0, character: "{" }
1180
+ ]
1181
+ };
1182
+ }
1183
+ function G(e, n, t) {
1184
+ const r = e.value || "";
1185
+ return "{" + t.indentLines(r, function(c, o, l) {
1186
+ return (o === 0 || l ? "" : " ") + c;
1187
+ }) + "}";
1188
+ }
1189
+ function zt() {
1190
+ return { handlers: { mdxjsEsm: $t } };
1191
+ }
1192
+ function $t(e) {
1193
+ return e.value || "";
1194
+ }
1195
+ function Gt(e) {
1196
+ return {
1197
+ extensions: [
1198
+ Ot(),
1199
+ J(e),
1200
+ zt()
1201
+ ]
1202
+ };
1203
+ }
1204
+ const Jt = (e) => {
1205
+ const n = [], t = (r, i, c) => {
1206
+ if (r.type === "text" && r.value && r.value.includes("import") && r.value.includes("from") && i && Array.isArray(i.children) && typeof c == "number") {
1207
+ i.children.splice(c, 1), n.push({
1208
+ type: "paragraph",
1209
+ children: [r]
1210
+ });
1211
+ return;
1212
+ }
1213
+ if (r.children && Array.isArray(r.children)) {
1214
+ const o = [...r.children];
1215
+ for (let l = 0; l < o.length; l++)
1216
+ t(o[l], r, l);
1217
+ }
1218
+ };
1219
+ return t(e, null, null), e.type === "root" && Array.isArray(e.children) && (e.children = [...n, ...e.children]), e;
1220
+ }, se = (e) => {
1221
+ const n = e.attributes.reduce((r, i) => (r[i.name] = i.value, r), {});
1222
+ return {
1223
+ type: "mdxJsxFlowElement",
1224
+ name: "Figure",
1225
+ attributes: [],
1226
+ children: [
1227
+ { ...e },
1228
+ {
1229
+ type: "mdxJsxFlowElement",
1230
+ name: "Caption",
1231
+ attributes: [
1232
+ { name: "attrAuthor", value: n.attrAuthor },
1233
+ { name: "attrUrl", value: n.attrUrl }
1234
+ ],
1235
+ children: [{ type: "text", value: n.caption }]
1236
+ }
1237
+ ]
1238
+ };
1239
+ }, Nt = (e) => {
1240
+ const n = [];
1241
+ for (const t of e.children)
1242
+ if (t.children.some(
1243
+ (r) => r.name === "Chart" || r.name === "Map"
1244
+ ))
1245
+ for (const r of t.children)
1246
+ (r.name === "Chart" || r.name === "Map") && n.push(se(r));
1247
+ else
1248
+ n.push({
1249
+ type: "mdxJsxFlowElement",
1250
+ name: "Prose",
1251
+ attributes: [],
1252
+ children: [...t.children]
1253
+ });
1254
+ return n;
1255
+ }, qt = (e) => {
1256
+ const n = [], t = (i) => ({
1257
+ type: "mdxJsxFlowElement",
1258
+ name: "Prose",
1259
+ children: [...i]
1260
+ }), r = (i) => {
1261
+ const c = [];
1262
+ let o = [];
1263
+ for (const l of i)
1264
+ if (l.type === "mdxJsxTextElement" || l.type === "mdxJsxFlowElement") {
1265
+ if (l.name === "Break")
1266
+ o.length > 0 && (c.push([t(o)]), o = []);
1267
+ else if (l.name === "Block" || l.name === "Chart" || l.name === "Map" || l.name === "MapBlock" || l.name === "TwoColumn") {
1268
+ if (c.push([t(o)]), l.name === "Chart" || l.name === "Map")
1269
+ c.push([se(l)]);
1270
+ else if (l.name === "TwoColumn") {
1271
+ const a = Nt(l);
1272
+ c.push(a);
1273
+ }
1274
+ o = [];
1275
+ }
1276
+ } else
1277
+ o.push(l);
1278
+ return o.length > 0 && c.push([...o]), c;
1279
+ };
1280
+ if (e.type === "root" && Array.isArray(e.children)) {
1281
+ const i = r(e.children);
1282
+ for (const c of i)
1283
+ c.some((o) => o.name === "Prose") ? n.push({
1284
+ type: "mdxJsxFlowElement",
1285
+ name: "Block",
1286
+ children: [...c]
1287
+ }) : n.push({
1288
+ type: "mdxJsxFlowElement",
1289
+ name: "Block",
1290
+ children: [
1291
+ {
1292
+ type: "mdxJsxFlowElement",
1293
+ name: "Prose",
1294
+ children: [...c]
1295
+ }
1296
+ ]
1297
+ });
1298
+ }
1299
+ return n;
1300
+ }, Vt = (e) => {
1301
+ if (!e || e.type !== "root" || !Array.isArray(e.children))
1302
+ return e;
1303
+ const n = [];
1304
+ for (const t of e.children)
1305
+ t.type === "paragraph" && t.children.length === 1 && t.children[0].type === "mdxJsxFlowElement" ? n.push(t.children[0]) : n.push(t);
1306
+ return { ...e, children: n };
1307
+ }, cn = (e) => {
1308
+ const n = Vt(e), t = qt(n);
1309
+ Jt(n);
1310
+ const r = { ...n, children: t };
1311
+ return ((c) => Mt(c, {
1312
+ extensions: [Gt(), me(), J()]
1313
+ }))(r);
1314
+ }, ue = N(null), an = ({
1315
+ children: e,
1316
+ value: n
1317
+ }) => /* @__PURE__ */ p(ue.Provider, { value: n, children: e }), ln = () => {
1318
+ const e = q(ue);
1319
+ if (!e)
1320
+ throw new Error("useChartContext must be used within a ChartContextProvider");
1321
+ return e;
1322
+ }, fe = N(null), sn = ({
1323
+ children: e,
1324
+ value: n
1325
+ }) => /* @__PURE__ */ p(fe.Provider, { value: n, children: e }), un = () => {
1326
+ const e = q(fe);
1327
+ if (!e)
1328
+ throw new Error("useMapContext must be used within a MapContextProvider");
1329
+ return e;
1330
+ }, fn = () => {
1331
+ }, Ut = (e) => {
1332
+ const n = {
1333
+ "%d": "(0[1-9]|[12][0-9]|3[01])",
1334
+ "%m": "(0[1-9]|1[0-2])",
1335
+ "%Y": "\\d{4}",
1336
+ "%y": "\\d{2}",
1337
+ "%H": "([01][0-9]|2[0-3])",
1338
+ "%M": "([0-5][0-9])",
1339
+ "%S": "([0-5][0-9])"
1340
+ }, t = (i) => i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1341
+ let r = "";
1342
+ for (let i = 0; i < e.length; i++)
1343
+ if (e[i] === "%" && i < e.length - 1) {
1344
+ const c = e[i] + e[i + 1];
1345
+ r += n[c] || t(c), i++;
1346
+ } else
1347
+ r += t(e[i]);
1348
+ return new RegExp(`^${r}$`);
1349
+ }, C = (e, n) => !Ut(e).test(n), Qt = (e, n, t, r, i, c, o) => {
1350
+ e === "highlightStart" || e === "highlightEnd" ? C(n.draftDateFormat, i) === !1 ? (t({
1351
+ highlightStart: C(
1352
+ n.draftDateFormat,
1353
+ n.draftHighlightStart
1354
+ ),
1355
+ highlightEnd: C(
1356
+ n.draftDateFormat,
1357
+ n.draftHighlightEnd
1358
+ )
1359
+ }), r.highlightStart == !1 && r.highlightEnd == !1 && c({
1360
+ ...o,
1361
+ dateFormat: n.draftDateFormat,
1362
+ highlightStart: n.draftHighlightStart,
1363
+ highlightEnd: n.draftHighlightEnd
1364
+ })) : t({
1365
+ highlightStart: C(
1366
+ n.draftDateFormat,
1367
+ n.draftHighlightStart
1368
+ ),
1369
+ highlightEnd: C(
1370
+ n.draftDateFormat,
1371
+ n.draftHighlightEnd
1372
+ )
1373
+ }) : e === "dateFormat" ? t({
1374
+ highlightStart: C(i, o.highlightStart),
1375
+ highlightEnd: C(i, o.highlightEnd)
1376
+ }) : r.highlightStart == !1 && r.highlightEnd == !1 && c({
1377
+ ...o,
1378
+ dateFormat: n.draftDateFormat,
1379
+ highlightStart: n.draftHighlightStart,
1380
+ highlightEnd: n.draftHighlightEnd
1381
+ });
1382
+ }, Wt = (e, n, t, r, i, c, o) => {
1383
+ C(n.defaultDateFormat, i) === !1 || i === "" ? (r({ ...t, [e]: !1 }), c({ ...o, [e]: i })) : r({ ...t, [e]: !0 });
1384
+ }, Zt = (e, n, t, r, i, c, o) => {
1385
+ const l = /^\[[+-]?(0|[1-9][0-9]*)(\.[0-9]+)?(?:,\s*[+-]?(0|[1-9][0-9]*)(\.[0-9]+)?)*\]$/, a = i.replace(/\s/g, "");
1386
+ if (l.test(a)) {
1387
+ const s = JSON.parse(a), u = (h) => h <= 180 && h >= -180, f = (h) => h <= 90 && h >= -90;
1388
+ u(s[0]) && f(s[1]) ? (r({ ...t, [e]: !1 }), c({ ...o, [e]: i })) : r({ ...t, [e]: !0 });
1389
+ } else
1390
+ r({ ...t, [e]: !0 });
1391
+ }, F = (e, n) => e && !n ? { validationStatus: "error" } : "", Kt = [
1392
+ "Blues",
1393
+ "Greens",
1394
+ "Greys",
1395
+ "Oranges",
1396
+ "Purples",
1397
+ "Reds",
1398
+ "Turbo",
1399
+ "Viridis",
1400
+ "Inferno",
1401
+ "Magma",
1402
+ "Plasma",
1403
+ "Cividis",
1404
+ "Warm",
1405
+ "Cool",
1406
+ "CubehelixDefault"
1407
+ ], Xt = (e) => {
1408
+ const {
1409
+ value: n,
1410
+ isRequired: t,
1411
+ type: r,
1412
+ fieldName: i,
1413
+ hint: c,
1414
+ onChange: o,
1415
+ componentProps: l,
1416
+ propName: a,
1417
+ placeHolder: s,
1418
+ validateAgainst: u,
1419
+ draftInputs: f,
1420
+ setDraftInputs: h,
1421
+ inputErrors: m,
1422
+ setInputErrors: g,
1423
+ options: k
1424
+ } = e;
1425
+ if (k && Array.isArray(k))
1426
+ return /* @__PURE__ */ v(y, { children: [
1427
+ /* @__PURE__ */ p(A, { htmlFor: a, className: "margin-top-2", children: i }),
1428
+ /* @__PURE__ */ p("span", { className: "usa-hint", children: c }),
1429
+ /* @__PURE__ */ v(
1430
+ L,
1431
+ {
1432
+ id: a,
1433
+ name: a,
1434
+ value: n,
1435
+ onChange: (d) => o({ ...l, [a]: d.target.value }),
1436
+ ...F(t, n),
1437
+ children: [
1438
+ /* @__PURE__ */ p("option", { value: "", children: "- Select option -" }),
1439
+ k.map((d) => {
1440
+ const M = typeof d == "object" ? d.value : d, pe = typeof d == "object" ? d.label : d;
1441
+ return /* @__PURE__ */ p("option", { value: M, children: pe }, M);
1442
+ })
1443
+ ]
1444
+ }
1445
+ )
1446
+ ] });
1447
+ const he = r !== void 0 && r.toLowerCase(), [x, de] = ke(n), E = Ce(null);
1448
+ switch (be(() => (a === "dateFormat" && x != f.draftDateFormat && h({ ...f, draftDateFormat: x }), a === "highlightStart" && x != f.draftHighlightStart && h({ ...f, draftHighlightStart: x }), a === "highlightEnd" && x != f.draftHighlightEnd && h({ ...f, draftHighlightEnd: x }), clearTimeout(E.current), E.current = setTimeout(() => {
1449
+ u && (a === "dateFormat" || a === "highlightStart" || a === "highlightEnd" ? Qt(
1450
+ a,
1451
+ f,
1452
+ g,
1453
+ m,
1454
+ x,
1455
+ o,
1456
+ l
1457
+ ) : u === "defaultDateFormat" ? Wt(
1458
+ a,
1459
+ f,
1460
+ m,
1461
+ g,
1462
+ x,
1463
+ o,
1464
+ l
1465
+ ) : u === "centerFormat" ? Zt(
1466
+ a,
1467
+ f,
1468
+ m,
1469
+ g,
1470
+ x,
1471
+ o,
1472
+ l
1473
+ ) : o({ ...l, [a]: x }));
1474
+ }, 400), () => clearTimeout(E.current)), [x, f]), he) {
1475
+ case "date":
1476
+ return (
1477
+ //CHORE: Need to clean up or delete
1478
+ /* @__PURE__ */ v(y, { children: [
1479
+ /* @__PURE__ */ p(A, { htmlFor: "input-type-text", className: "margin-top-2", children: i }),
1480
+ /* @__PURE__ */ p("span", { className: "usa-hint", children: c }),
1481
+ /* @__PURE__ */ p(
1482
+ Ae,
1483
+ {
1484
+ defaultValue: n,
1485
+ onChange: (d) => console.log("DatePicker", d),
1486
+ ...F(t, n)
1487
+ }
1488
+ )
1489
+ ] })
1490
+ );
1491
+ case "checkbox":
1492
+ return /* @__PURE__ */ p(
1493
+ ye,
1494
+ {
1495
+ id: i,
1496
+ name: "checkbox",
1497
+ label: i,
1498
+ onChange: (d) => o({ ...l, [a]: d.target.value })
1499
+ }
1500
+ );
1501
+ case "select":
1502
+ return /* @__PURE__ */ v(y, { children: [
1503
+ /* @__PURE__ */ p(A, { htmlFor: "input-type-text", className: "margin-top-2", children: i }),
1504
+ /* @__PURE__ */ p("span", { className: "usa-hint", children: c }),
1505
+ /* @__PURE__ */ p(
1506
+ L,
1507
+ {
1508
+ id: i,
1509
+ name: i,
1510
+ onChange: (d) => o({ ...l, [a]: d.target.value }),
1511
+ children: Kt.map((d) => /* @__PURE__ */ p("option", { value: d, children: d }, d))
1512
+ }
1513
+ )
1514
+ ] });
1515
+ case "area":
1516
+ return /* @__PURE__ */ v(y, { children: [
1517
+ /* @__PURE__ */ p(A, { htmlFor: "input-type-text", className: "margin-top-2", children: i }),
1518
+ /* @__PURE__ */ p("span", { className: "usa-hint", children: c }),
1519
+ /* @__PURE__ */ p(
1520
+ ve,
1521
+ {
1522
+ id: "input-type-text",
1523
+ name: "input-type-text",
1524
+ value: n,
1525
+ onChange: (d) => {
1526
+ o({ ...l, [a]: d.target.value });
1527
+ },
1528
+ className: "",
1529
+ ...F(t, n)
1530
+ }
1531
+ )
1532
+ ] });
1533
+ default:
1534
+ return /* @__PURE__ */ v(y, { children: [
1535
+ /* @__PURE__ */ p(A, { htmlFor: "input-type-text", className: "margin-top-2", children: i }),
1536
+ /* @__PURE__ */ p("span", { className: "usa-hint", children: c }),
1537
+ /* @__PURE__ */ p(
1538
+ we,
1539
+ {
1540
+ id: "input-type-text",
1541
+ name: "input-type-text",
1542
+ type: "text",
1543
+ value: u ? x : n,
1544
+ onChange: (d) => {
1545
+ u ? de(d.target.value) : o({ ...l, [a]: d.target.value });
1546
+ },
1547
+ placeholder: s,
1548
+ ...F(t, n),
1549
+ validationStatus: u && (m[a] ? "error" : void 0)
1550
+ }
1551
+ )
1552
+ ] });
1553
+ }
1554
+ }, hn = (e) => {
1555
+ const { propName: n, customClass: t } = e;
1556
+ return /* @__PURE__ */ p("div", { className: t, children: Xt(e) }, n);
1557
+ };
1558
+ function dn(e) {
1559
+ const n = e.taxonomy.map((t) => {
1560
+ const r = t.values.map((i) => ({
1561
+ id: i.replace(/ /g, "_").toLowerCase(),
1562
+ name: i
1563
+ }));
1564
+ return { ...t, values: r };
1565
+ });
1566
+ return { ...e, taxonomy: n };
1567
+ }
1568
+ const pn = (e) => e?.map((n) => ({
1569
+ ...n.metadata
1570
+ })), mn = (e) => {
1571
+ const n = {};
1572
+ return e?.map((t) => {
1573
+ const r = t.metadata.id;
1574
+ n[r] = {
1575
+ data: t.metadata
1576
+ };
1577
+ }), n;
1578
+ };
1579
+ export {
1580
+ kn as Block,
1581
+ Cn as Caption,
1582
+ bn as CatalogContent,
1583
+ wn as Chapter,
1584
+ vn as Chart,
1585
+ an as ChartContextProvider,
1586
+ yn as CompareImage,
1587
+ An as DatasetSelectorModal,
1588
+ Fn as DevseedUiThemeProvider,
1589
+ Sn as ExplorationAndAnalysis,
1590
+ Tn as Figure,
1591
+ En as Image,
1592
+ hn as InputField,
1593
+ Pn as LegacyGlobalStyles,
1594
+ _n as MapBlock,
1595
+ sn as MapContextProvider,
1596
+ Bn as PageFooter,
1597
+ Mn as PageHeader,
1598
+ Ln as PageHero,
1599
+ Rn as Prose,
1600
+ Dn as ReactQueryProvider,
1601
+ In as ScrollytellingBlock,
1602
+ jn as StoriesHubContent,
1603
+ Hn as VedaUIProvider,
1604
+ C as dateFormatValidation,
1605
+ Ut as dateStringToregex,
1606
+ On as externalDatasetsAtom,
1607
+ Jt as extractImports,
1608
+ qt as groupByBreakIntoBlocks,
1609
+ Qt as handleChartDateValidation,
1610
+ Zt as handleMapArrayValidation,
1611
+ Wt as handleMapDateValidation,
1612
+ Nt as handleTwoColumn,
1613
+ fn as inputValidation,
1614
+ dn as processTaxonomies,
1615
+ cn as reserializedMdxContent,
1616
+ zn as timelineDatasetsAtom,
1617
+ pn as transformToDatasetsList,
1618
+ mn as transformToVedaData,
1619
+ ln as useChartContext,
1620
+ $n as useFiltersWithQS,
1621
+ un as useMapContext,
1622
+ Gn as useTimelineDatasetAtom,
1623
+ se as wrapComponent
1624
+ };
1625
+ //# sourceMappingURL=index.js.map