@slidev/cli 0.27.20 → 0.28.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.
@@ -1,11 +1,14 @@
1
1
  import {
2
2
  __commonJS,
3
3
  __dirname,
4
+ __export,
4
5
  __require,
6
+ __spreadProps,
7
+ __spreadValues,
5
8
  __toModule,
6
9
  init_esm_shims,
7
10
  resolveImportPath
8
- } from "./chunk-3LH2GTGU.mjs";
11
+ } from "./chunk-OXQUV4ZP.mjs";
9
12
 
10
13
  // ../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/internal/constants.js
11
14
  var require_constants = __commonJS({
@@ -366,7 +369,7 @@ var require_parse2 = __commonJS({
366
369
  var { re, t } = require_re();
367
370
  var SemVer = require_semver();
368
371
  var parseOptions = require_parse_options();
369
- var parse = (version3, options) => {
372
+ var parse2 = (version3, options) => {
370
373
  options = parseOptions(options);
371
374
  if (version3 instanceof SemVer) {
372
375
  return version3;
@@ -387,7 +390,7 @@ var require_parse2 = __commonJS({
387
390
  return null;
388
391
  }
389
392
  };
390
- module.exports = parse;
393
+ module.exports = parse2;
391
394
  }
392
395
  });
393
396
 
@@ -395,9 +398,9 @@ var require_parse2 = __commonJS({
395
398
  var require_valid = __commonJS({
396
399
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/functions/valid.js"(exports, module) {
397
400
  init_esm_shims();
398
- var parse = require_parse2();
401
+ var parse2 = require_parse2();
399
402
  var valid = (version3, options) => {
400
- const v = parse(version3, options);
403
+ const v = parse2(version3, options);
401
404
  return v ? v.version : null;
402
405
  };
403
406
  module.exports = valid;
@@ -408,9 +411,9 @@ var require_valid = __commonJS({
408
411
  var require_clean = __commonJS({
409
412
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/functions/clean.js"(exports, module) {
410
413
  init_esm_shims();
411
- var parse = require_parse2();
414
+ var parse2 = require_parse2();
412
415
  var clean = (version3, options) => {
413
- const s = parse(version3.trim().replace(/^[=v]+/, ""), options);
416
+ const s = parse2(version3.trim().replace(/^[=v]+/, ""), options);
414
417
  return s ? s.version : null;
415
418
  };
416
419
  module.exports = clean;
@@ -461,14 +464,14 @@ var require_eq = __commonJS({
461
464
  var require_diff = __commonJS({
462
465
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/functions/diff.js"(exports, module) {
463
466
  init_esm_shims();
464
- var parse = require_parse2();
467
+ var parse2 = require_parse2();
465
468
  var eq = require_eq();
466
469
  var diff = (version1, version22) => {
467
470
  if (eq(version1, version22)) {
468
471
  return null;
469
472
  } else {
470
- const v1 = parse(version1);
471
- const v2 = parse(version22);
473
+ const v1 = parse2(version1);
474
+ const v2 = parse2(version22);
472
475
  const hasPre = v1.prerelease.length || v2.prerelease.length;
473
476
  const prefix = hasPre ? "pre" : "";
474
477
  const defaultResult = hasPre ? "prerelease" : "";
@@ -520,9 +523,9 @@ var require_patch = __commonJS({
520
523
  var require_prerelease = __commonJS({
521
524
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/functions/prerelease.js"(exports, module) {
522
525
  init_esm_shims();
523
- var parse = require_parse2();
526
+ var parse2 = require_parse2();
524
527
  var prerelease = (version3, options) => {
525
- const parsed = parse(version3, options);
528
+ const parsed = parse2(version3, options);
526
529
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
527
530
  };
528
531
  module.exports = prerelease;
@@ -684,7 +687,7 @@ var require_coerce = __commonJS({
684
687
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/functions/coerce.js"(exports, module) {
685
688
  init_esm_shims();
686
689
  var SemVer = require_semver();
687
- var parse = require_parse2();
690
+ var parse2 = require_parse2();
688
691
  var { re, t } = require_re();
689
692
  var coerce = (version3, options) => {
690
693
  if (version3 instanceof SemVer) {
@@ -712,7 +715,7 @@ var require_coerce = __commonJS({
712
715
  }
713
716
  if (match === null)
714
717
  return null;
715
- return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
718
+ return parse2(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
716
719
  };
717
720
  module.exports = coerce;
718
721
  }
@@ -1377,28 +1380,28 @@ var require_range = __commonJS({
1377
1380
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/classes/range.js"(exports, module) {
1378
1381
  init_esm_shims();
1379
1382
  var Range = class {
1380
- constructor(range, options) {
1383
+ constructor(range2, options) {
1381
1384
  options = parseOptions(options);
1382
- if (range instanceof Range) {
1383
- if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
1384
- return range;
1385
+ if (range2 instanceof Range) {
1386
+ if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) {
1387
+ return range2;
1385
1388
  } else {
1386
- return new Range(range.raw, options);
1389
+ return new Range(range2.raw, options);
1387
1390
  }
1388
1391
  }
1389
- if (range instanceof Comparator) {
1390
- this.raw = range.value;
1391
- this.set = [[range]];
1392
+ if (range2 instanceof Comparator) {
1393
+ this.raw = range2.value;
1394
+ this.set = [[range2]];
1392
1395
  this.format();
1393
1396
  return this;
1394
1397
  }
1395
1398
  this.options = options;
1396
1399
  this.loose = !!options.loose;
1397
1400
  this.includePrerelease = !!options.includePrerelease;
1398
- this.raw = range;
1399
- this.set = range.split(/\s*\|\|\s*/).map((range2) => this.parseRange(range2.trim())).filter((c) => c.length);
1401
+ this.raw = range2;
1402
+ this.set = range2.split(/\s*\|\|\s*/).map((range3) => this.parseRange(range3.trim())).filter((c) => c.length);
1400
1403
  if (!this.set.length) {
1401
- throw new TypeError(`Invalid SemVer Range: ${range}`);
1404
+ throw new TypeError(`Invalid SemVer Range: ${range2}`);
1402
1405
  }
1403
1406
  if (this.set.length > 1) {
1404
1407
  const first = this.set[0];
@@ -1425,24 +1428,24 @@ var require_range = __commonJS({
1425
1428
  toString() {
1426
1429
  return this.range;
1427
1430
  }
1428
- parseRange(range) {
1429
- range = range.trim();
1431
+ parseRange(range2) {
1432
+ range2 = range2.trim();
1430
1433
  const memoOpts = Object.keys(this.options).join(",");
1431
- const memoKey = `parseRange:${memoOpts}:${range}`;
1434
+ const memoKey = `parseRange:${memoOpts}:${range2}`;
1432
1435
  const cached = cache.get(memoKey);
1433
1436
  if (cached)
1434
1437
  return cached;
1435
1438
  const loose = this.options.loose;
1436
1439
  const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1437
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1438
- debug2("hyphen replace", range);
1439
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1440
- debug2("comparator trim", range, re[t.COMPARATORTRIM]);
1441
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1442
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1443
- range = range.split(/\s+/).join(" ");
1440
+ range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease));
1441
+ debug2("hyphen replace", range2);
1442
+ range2 = range2.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1443
+ debug2("comparator trim", range2, re[t.COMPARATORTRIM]);
1444
+ range2 = range2.replace(re[t.TILDETRIM], tildeTrimReplace);
1445
+ range2 = range2.replace(re[t.CARETTRIM], caretTrimReplace);
1446
+ range2 = range2.split(/\s+/).join(" ");
1444
1447
  const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1445
- const rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)).filter(this.options.loose ? (comp) => !!comp.match(compRe) : () => true).map((comp) => new Comparator(comp, this.options));
1448
+ const rangeList = range2.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)).filter(this.options.loose ? (comp) => !!comp.match(compRe) : () => true).map((comp) => new Comparator(comp, this.options));
1446
1449
  const l = rangeList.length;
1447
1450
  const rangeMap = /* @__PURE__ */ new Map();
1448
1451
  for (const comp of rangeList) {
@@ -1456,12 +1459,12 @@ var require_range = __commonJS({
1456
1459
  cache.set(memoKey, result);
1457
1460
  return result;
1458
1461
  }
1459
- intersects(range, options) {
1460
- if (!(range instanceof Range)) {
1462
+ intersects(range2, options) {
1463
+ if (!(range2 instanceof Range)) {
1461
1464
  throw new TypeError("a Range is required");
1462
1465
  }
1463
1466
  return this.set.some((thisComparators) => {
1464
- return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
1467
+ return isSatisfiable(thisComparators, options) && range2.set.some((rangeComparators) => {
1465
1468
  return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
1466
1469
  return rangeComparators.every((rangeComparator) => {
1467
1470
  return thisComparator.intersects(rangeComparator, options);
@@ -1696,20 +1699,20 @@ var require_range = __commonJS({
1696
1699
  }
1697
1700
  return `${from} ${to}`.trim();
1698
1701
  };
1699
- var testSet = (set, version3, options) => {
1700
- for (let i = 0; i < set.length; i++) {
1701
- if (!set[i].test(version3)) {
1702
+ var testSet = (set2, version3, options) => {
1703
+ for (let i = 0; i < set2.length; i++) {
1704
+ if (!set2[i].test(version3)) {
1702
1705
  return false;
1703
1706
  }
1704
1707
  }
1705
1708
  if (version3.prerelease.length && !options.includePrerelease) {
1706
- for (let i = 0; i < set.length; i++) {
1707
- debug2(set[i].semver);
1708
- if (set[i].semver === Comparator.ANY) {
1709
+ for (let i = 0; i < set2.length; i++) {
1710
+ debug2(set2[i].semver);
1711
+ if (set2[i].semver === Comparator.ANY) {
1709
1712
  continue;
1710
1713
  }
1711
- if (set[i].semver.prerelease.length > 0) {
1712
- const allowed = set[i].semver;
1714
+ if (set2[i].semver.prerelease.length > 0) {
1715
+ const allowed = set2[i].semver;
1713
1716
  if (allowed.major === version3.major && allowed.minor === version3.minor && allowed.patch === version3.patch) {
1714
1717
  return true;
1715
1718
  }
@@ -1829,13 +1832,13 @@ var require_satisfies = __commonJS({
1829
1832
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/functions/satisfies.js"(exports, module) {
1830
1833
  init_esm_shims();
1831
1834
  var Range = require_range();
1832
- var satisfies2 = (version3, range, options) => {
1835
+ var satisfies2 = (version3, range2, options) => {
1833
1836
  try {
1834
- range = new Range(range, options);
1837
+ range2 = new Range(range2, options);
1835
1838
  } catch (er) {
1836
1839
  return false;
1837
1840
  }
1838
- return range.test(version3);
1841
+ return range2.test(version3);
1839
1842
  };
1840
1843
  module.exports = satisfies2;
1841
1844
  }
@@ -1846,7 +1849,7 @@ var require_to_comparators = __commonJS({
1846
1849
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/ranges/to-comparators.js"(exports, module) {
1847
1850
  init_esm_shims();
1848
1851
  var Range = require_range();
1849
- var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
1852
+ var toComparators = (range2, options) => new Range(range2, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
1850
1853
  module.exports = toComparators;
1851
1854
  }
1852
1855
  });
@@ -1857,12 +1860,12 @@ var require_max_satisfying = __commonJS({
1857
1860
  init_esm_shims();
1858
1861
  var SemVer = require_semver();
1859
1862
  var Range = require_range();
1860
- var maxSatisfying = (versions, range, options) => {
1863
+ var maxSatisfying = (versions, range2, options) => {
1861
1864
  let max = null;
1862
1865
  let maxSV = null;
1863
1866
  let rangeObj = null;
1864
1867
  try {
1865
- rangeObj = new Range(range, options);
1868
+ rangeObj = new Range(range2, options);
1866
1869
  } catch (er) {
1867
1870
  return null;
1868
1871
  }
@@ -1886,12 +1889,12 @@ var require_min_satisfying = __commonJS({
1886
1889
  init_esm_shims();
1887
1890
  var SemVer = require_semver();
1888
1891
  var Range = require_range();
1889
- var minSatisfying = (versions, range, options) => {
1892
+ var minSatisfying = (versions, range2, options) => {
1890
1893
  let min = null;
1891
1894
  let minSV = null;
1892
1895
  let rangeObj = null;
1893
1896
  try {
1894
- rangeObj = new Range(range, options);
1897
+ rangeObj = new Range(range2, options);
1895
1898
  } catch (er) {
1896
1899
  return null;
1897
1900
  }
@@ -1916,19 +1919,19 @@ var require_min_version = __commonJS({
1916
1919
  var SemVer = require_semver();
1917
1920
  var Range = require_range();
1918
1921
  var gt = require_gt();
1919
- var minVersion = (range, loose) => {
1920
- range = new Range(range, loose);
1922
+ var minVersion = (range2, loose) => {
1923
+ range2 = new Range(range2, loose);
1921
1924
  let minver = new SemVer("0.0.0");
1922
- if (range.test(minver)) {
1925
+ if (range2.test(minver)) {
1923
1926
  return minver;
1924
1927
  }
1925
1928
  minver = new SemVer("0.0.0-0");
1926
- if (range.test(minver)) {
1929
+ if (range2.test(minver)) {
1927
1930
  return minver;
1928
1931
  }
1929
1932
  minver = null;
1930
- for (let i = 0; i < range.set.length; ++i) {
1931
- const comparators = range.set[i];
1933
+ for (let i = 0; i < range2.set.length; ++i) {
1934
+ const comparators = range2.set[i];
1932
1935
  let setMin = null;
1933
1936
  comparators.forEach((comparator) => {
1934
1937
  const compver = new SemVer(comparator.semver.version);
@@ -1956,7 +1959,7 @@ var require_min_version = __commonJS({
1956
1959
  if (setMin && (!minver || gt(minver, setMin)))
1957
1960
  minver = setMin;
1958
1961
  }
1959
- if (minver && range.test(minver)) {
1962
+ if (minver && range2.test(minver)) {
1960
1963
  return minver;
1961
1964
  }
1962
1965
  return null;
@@ -1970,9 +1973,9 @@ var require_valid2 = __commonJS({
1970
1973
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/ranges/valid.js"(exports, module) {
1971
1974
  init_esm_shims();
1972
1975
  var Range = require_range();
1973
- var validRange = (range, options) => {
1976
+ var validRange = (range2, options) => {
1974
1977
  try {
1975
- return new Range(range, options).range || "*";
1978
+ return new Range(range2, options).range || "*";
1976
1979
  } catch (er) {
1977
1980
  return null;
1978
1981
  }
@@ -1994,9 +1997,9 @@ var require_outside = __commonJS({
1994
1997
  var lt = require_lt();
1995
1998
  var lte = require_lte();
1996
1999
  var gte = require_gte();
1997
- var outside = (version3, range, hilo, options) => {
2000
+ var outside = (version3, range2, hilo, options) => {
1998
2001
  version3 = new SemVer(version3, options);
1999
- range = new Range(range, options);
2002
+ range2 = new Range(range2, options);
2000
2003
  let gtfn, ltefn, ltfn, comp, ecomp;
2001
2004
  switch (hilo) {
2002
2005
  case ">":
@@ -2016,11 +2019,11 @@ var require_outside = __commonJS({
2016
2019
  default:
2017
2020
  throw new TypeError('Must provide a hilo val of "<" or ">"');
2018
2021
  }
2019
- if (satisfies2(version3, range, options)) {
2022
+ if (satisfies2(version3, range2, options)) {
2020
2023
  return false;
2021
2024
  }
2022
- for (let i = 0; i < range.set.length; ++i) {
2023
- const comparators = range.set[i];
2025
+ for (let i = 0; i < range2.set.length; ++i) {
2026
+ const comparators = range2.set[i];
2024
2027
  let high = null;
2025
2028
  let low = null;
2026
2029
  comparators.forEach((comparator) => {
@@ -2055,7 +2058,7 @@ var require_gtr = __commonJS({
2055
2058
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/ranges/gtr.js"(exports, module) {
2056
2059
  init_esm_shims();
2057
2060
  var outside = require_outside();
2058
- var gtr = (version3, range, options) => outside(version3, range, ">", options);
2061
+ var gtr = (version3, range2, options) => outside(version3, range2, ">", options);
2059
2062
  module.exports = gtr;
2060
2063
  }
2061
2064
  });
@@ -2065,7 +2068,7 @@ var require_ltr = __commonJS({
2065
2068
  "../../node_modules/.pnpm/semver@7.3.5/node_modules/semver/ranges/ltr.js"(exports, module) {
2066
2069
  init_esm_shims();
2067
2070
  var outside = require_outside();
2068
- var ltr = (version3, range, options) => outside(version3, range, "<", options);
2071
+ var ltr = (version3, range2, options) => outside(version3, range2, "<", options);
2069
2072
  module.exports = ltr;
2070
2073
  }
2071
2074
  });
@@ -2090,29 +2093,29 @@ var require_simplify = __commonJS({
2090
2093
  init_esm_shims();
2091
2094
  var satisfies2 = require_satisfies();
2092
2095
  var compare = require_compare();
2093
- module.exports = (versions, range, options) => {
2094
- const set = [];
2096
+ module.exports = (versions, range2, options) => {
2097
+ const set2 = [];
2095
2098
  let min = null;
2096
2099
  let prev = null;
2097
2100
  const v = versions.sort((a, b) => compare(a, b, options));
2098
2101
  for (const version3 of v) {
2099
- const included = satisfies2(version3, range, options);
2102
+ const included = satisfies2(version3, range2, options);
2100
2103
  if (included) {
2101
2104
  prev = version3;
2102
2105
  if (!min)
2103
2106
  min = version3;
2104
2107
  } else {
2105
2108
  if (prev) {
2106
- set.push([min, prev]);
2109
+ set2.push([min, prev]);
2107
2110
  }
2108
2111
  prev = null;
2109
2112
  min = null;
2110
2113
  }
2111
2114
  }
2112
2115
  if (min)
2113
- set.push([min, null]);
2116
+ set2.push([min, null]);
2114
2117
  const ranges = [];
2115
- for (const [min2, max] of set) {
2118
+ for (const [min2, max] of set2) {
2116
2119
  if (min2 === max)
2117
2120
  ranges.push(min2);
2118
2121
  else if (!max && min2 === v[0])
@@ -2125,8 +2128,8 @@ var require_simplify = __commonJS({
2125
2128
  ranges.push(`${min2} - ${max}`);
2126
2129
  }
2127
2130
  const simplified = ranges.join(" || ");
2128
- const original = typeof range.raw === "string" ? range.raw : String(range);
2129
- return simplified.length < original.length ? simplified : range;
2131
+ const original = typeof range2.raw === "string" ? range2.raw : String(range2);
2132
+ return simplified.length < original.length ? simplified : range2;
2130
2133
  };
2131
2134
  }
2132
2135
  });
@@ -2324,8 +2327,3048 @@ var require_semver2 = __commonJS({
2324
2327
  }
2325
2328
  });
2326
2329
 
2330
+ // ../parser/src/fs.ts
2331
+ var fs_exports = {};
2332
+ __export(fs_exports, {
2333
+ detectFeatures: () => detectFeatures,
2334
+ filterDisabled: () => filterDisabled,
2335
+ load: () => load2,
2336
+ mergeFeatureFlags: () => mergeFeatureFlags,
2337
+ parse: () => parse,
2338
+ parseAspectRatio: () => parseAspectRatio,
2339
+ parseRangeString: () => parseRangeString,
2340
+ parseSlide: () => parseSlide,
2341
+ prettify: () => prettify,
2342
+ prettifySlide: () => prettifySlide,
2343
+ resolveConfig: () => resolveConfig,
2344
+ resolveFonts: () => resolveFonts,
2345
+ save: () => save,
2346
+ saveExternalSlide: () => saveExternalSlide,
2347
+ scanMonacoModules: () => scanMonacoModules,
2348
+ stringify: () => stringify,
2349
+ stringifySlide: () => stringifySlide
2350
+ });
2351
+ init_esm_shims();
2352
+ import { promises as fs } from "fs";
2353
+ import { dirname, resolve } from "path";
2354
+
2355
+ // ../parser/src/core.ts
2356
+ init_esm_shims();
2357
+
2358
+ // ../../node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs
2359
+ init_esm_shims();
2360
+ function isNothing(subject) {
2361
+ return typeof subject === "undefined" || subject === null;
2362
+ }
2363
+ function isObject(subject) {
2364
+ return typeof subject === "object" && subject !== null;
2365
+ }
2366
+ function toArray(sequence) {
2367
+ if (Array.isArray(sequence))
2368
+ return sequence;
2369
+ else if (isNothing(sequence))
2370
+ return [];
2371
+ return [sequence];
2372
+ }
2373
+ function extend(target, source) {
2374
+ var index, length, key, sourceKeys;
2375
+ if (source) {
2376
+ sourceKeys = Object.keys(source);
2377
+ for (index = 0, length = sourceKeys.length; index < length; index += 1) {
2378
+ key = sourceKeys[index];
2379
+ target[key] = source[key];
2380
+ }
2381
+ }
2382
+ return target;
2383
+ }
2384
+ function repeat(string, count) {
2385
+ var result = "", cycle;
2386
+ for (cycle = 0; cycle < count; cycle += 1) {
2387
+ result += string;
2388
+ }
2389
+ return result;
2390
+ }
2391
+ function isNegativeZero(number) {
2392
+ return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
2393
+ }
2394
+ var isNothing_1 = isNothing;
2395
+ var isObject_1 = isObject;
2396
+ var toArray_1 = toArray;
2397
+ var repeat_1 = repeat;
2398
+ var isNegativeZero_1 = isNegativeZero;
2399
+ var extend_1 = extend;
2400
+ var common = {
2401
+ isNothing: isNothing_1,
2402
+ isObject: isObject_1,
2403
+ toArray: toArray_1,
2404
+ repeat: repeat_1,
2405
+ isNegativeZero: isNegativeZero_1,
2406
+ extend: extend_1
2407
+ };
2408
+ function formatError(exception2, compact) {
2409
+ var where = "", message = exception2.reason || "(unknown reason)";
2410
+ if (!exception2.mark)
2411
+ return message;
2412
+ if (exception2.mark.name) {
2413
+ where += 'in "' + exception2.mark.name + '" ';
2414
+ }
2415
+ where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
2416
+ if (!compact && exception2.mark.snippet) {
2417
+ where += "\n\n" + exception2.mark.snippet;
2418
+ }
2419
+ return message + " " + where;
2420
+ }
2421
+ function YAMLException$1(reason, mark) {
2422
+ Error.call(this);
2423
+ this.name = "YAMLException";
2424
+ this.reason = reason;
2425
+ this.mark = mark;
2426
+ this.message = formatError(this, false);
2427
+ if (Error.captureStackTrace) {
2428
+ Error.captureStackTrace(this, this.constructor);
2429
+ } else {
2430
+ this.stack = new Error().stack || "";
2431
+ }
2432
+ }
2433
+ YAMLException$1.prototype = Object.create(Error.prototype);
2434
+ YAMLException$1.prototype.constructor = YAMLException$1;
2435
+ YAMLException$1.prototype.toString = function toString(compact) {
2436
+ return this.name + ": " + formatError(this, compact);
2437
+ };
2438
+ var exception = YAMLException$1;
2439
+ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
2440
+ var head = "";
2441
+ var tail = "";
2442
+ var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
2443
+ if (position - lineStart > maxHalfLength) {
2444
+ head = " ... ";
2445
+ lineStart = position - maxHalfLength + head.length;
2446
+ }
2447
+ if (lineEnd - position > maxHalfLength) {
2448
+ tail = " ...";
2449
+ lineEnd = position + maxHalfLength - tail.length;
2450
+ }
2451
+ return {
2452
+ str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
2453
+ pos: position - lineStart + head.length
2454
+ };
2455
+ }
2456
+ function padStart(string, max) {
2457
+ return common.repeat(" ", max - string.length) + string;
2458
+ }
2459
+ function makeSnippet(mark, options) {
2460
+ options = Object.create(options || null);
2461
+ if (!mark.buffer)
2462
+ return null;
2463
+ if (!options.maxLength)
2464
+ options.maxLength = 79;
2465
+ if (typeof options.indent !== "number")
2466
+ options.indent = 1;
2467
+ if (typeof options.linesBefore !== "number")
2468
+ options.linesBefore = 3;
2469
+ if (typeof options.linesAfter !== "number")
2470
+ options.linesAfter = 2;
2471
+ var re = /\r?\n|\r|\0/g;
2472
+ var lineStarts = [0];
2473
+ var lineEnds = [];
2474
+ var match;
2475
+ var foundLineNo = -1;
2476
+ while (match = re.exec(mark.buffer)) {
2477
+ lineEnds.push(match.index);
2478
+ lineStarts.push(match.index + match[0].length);
2479
+ if (mark.position <= match.index && foundLineNo < 0) {
2480
+ foundLineNo = lineStarts.length - 2;
2481
+ }
2482
+ }
2483
+ if (foundLineNo < 0)
2484
+ foundLineNo = lineStarts.length - 1;
2485
+ var result = "", i, line;
2486
+ var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
2487
+ var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
2488
+ for (i = 1; i <= options.linesBefore; i++) {
2489
+ if (foundLineNo - i < 0)
2490
+ break;
2491
+ line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
2492
+ result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
2493
+ }
2494
+ line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
2495
+ result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
2496
+ result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
2497
+ for (i = 1; i <= options.linesAfter; i++) {
2498
+ if (foundLineNo + i >= lineEnds.length)
2499
+ break;
2500
+ line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
2501
+ result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
2502
+ }
2503
+ return result.replace(/\n$/, "");
2504
+ }
2505
+ var snippet = makeSnippet;
2506
+ var TYPE_CONSTRUCTOR_OPTIONS = [
2507
+ "kind",
2508
+ "multi",
2509
+ "resolve",
2510
+ "construct",
2511
+ "instanceOf",
2512
+ "predicate",
2513
+ "represent",
2514
+ "representName",
2515
+ "defaultStyle",
2516
+ "styleAliases"
2517
+ ];
2518
+ var YAML_NODE_KINDS = [
2519
+ "scalar",
2520
+ "sequence",
2521
+ "mapping"
2522
+ ];
2523
+ function compileStyleAliases(map2) {
2524
+ var result = {};
2525
+ if (map2 !== null) {
2526
+ Object.keys(map2).forEach(function(style) {
2527
+ map2[style].forEach(function(alias) {
2528
+ result[String(alias)] = style;
2529
+ });
2530
+ });
2531
+ }
2532
+ return result;
2533
+ }
2534
+ function Type$1(tag, options) {
2535
+ options = options || {};
2536
+ Object.keys(options).forEach(function(name) {
2537
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
2538
+ throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
2539
+ }
2540
+ });
2541
+ this.options = options;
2542
+ this.tag = tag;
2543
+ this.kind = options["kind"] || null;
2544
+ this.resolve = options["resolve"] || function() {
2545
+ return true;
2546
+ };
2547
+ this.construct = options["construct"] || function(data) {
2548
+ return data;
2549
+ };
2550
+ this.instanceOf = options["instanceOf"] || null;
2551
+ this.predicate = options["predicate"] || null;
2552
+ this.represent = options["represent"] || null;
2553
+ this.representName = options["representName"] || null;
2554
+ this.defaultStyle = options["defaultStyle"] || null;
2555
+ this.multi = options["multi"] || false;
2556
+ this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
2557
+ if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
2558
+ throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
2559
+ }
2560
+ }
2561
+ var type = Type$1;
2562
+ function compileList(schema2, name) {
2563
+ var result = [];
2564
+ schema2[name].forEach(function(currentType) {
2565
+ var newIndex = result.length;
2566
+ result.forEach(function(previousType, previousIndex) {
2567
+ if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
2568
+ newIndex = previousIndex;
2569
+ }
2570
+ });
2571
+ result[newIndex] = currentType;
2572
+ });
2573
+ return result;
2574
+ }
2575
+ function compileMap() {
2576
+ var result = {
2577
+ scalar: {},
2578
+ sequence: {},
2579
+ mapping: {},
2580
+ fallback: {},
2581
+ multi: {
2582
+ scalar: [],
2583
+ sequence: [],
2584
+ mapping: [],
2585
+ fallback: []
2586
+ }
2587
+ }, index, length;
2588
+ function collectType(type2) {
2589
+ if (type2.multi) {
2590
+ result.multi[type2.kind].push(type2);
2591
+ result.multi["fallback"].push(type2);
2592
+ } else {
2593
+ result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
2594
+ }
2595
+ }
2596
+ for (index = 0, length = arguments.length; index < length; index += 1) {
2597
+ arguments[index].forEach(collectType);
2598
+ }
2599
+ return result;
2600
+ }
2601
+ function Schema$1(definition) {
2602
+ return this.extend(definition);
2603
+ }
2604
+ Schema$1.prototype.extend = function extend2(definition) {
2605
+ var implicit = [];
2606
+ var explicit = [];
2607
+ if (definition instanceof type) {
2608
+ explicit.push(definition);
2609
+ } else if (Array.isArray(definition)) {
2610
+ explicit = explicit.concat(definition);
2611
+ } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
2612
+ if (definition.implicit)
2613
+ implicit = implicit.concat(definition.implicit);
2614
+ if (definition.explicit)
2615
+ explicit = explicit.concat(definition.explicit);
2616
+ } else {
2617
+ throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
2618
+ }
2619
+ implicit.forEach(function(type$1) {
2620
+ if (!(type$1 instanceof type)) {
2621
+ throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
2622
+ }
2623
+ if (type$1.loadKind && type$1.loadKind !== "scalar") {
2624
+ throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
2625
+ }
2626
+ if (type$1.multi) {
2627
+ throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
2628
+ }
2629
+ });
2630
+ explicit.forEach(function(type$1) {
2631
+ if (!(type$1 instanceof type)) {
2632
+ throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
2633
+ }
2634
+ });
2635
+ var result = Object.create(Schema$1.prototype);
2636
+ result.implicit = (this.implicit || []).concat(implicit);
2637
+ result.explicit = (this.explicit || []).concat(explicit);
2638
+ result.compiledImplicit = compileList(result, "implicit");
2639
+ result.compiledExplicit = compileList(result, "explicit");
2640
+ result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
2641
+ return result;
2642
+ };
2643
+ var schema = Schema$1;
2644
+ var str = new type("tag:yaml.org,2002:str", {
2645
+ kind: "scalar",
2646
+ construct: function(data) {
2647
+ return data !== null ? data : "";
2648
+ }
2649
+ });
2650
+ var seq = new type("tag:yaml.org,2002:seq", {
2651
+ kind: "sequence",
2652
+ construct: function(data) {
2653
+ return data !== null ? data : [];
2654
+ }
2655
+ });
2656
+ var map = new type("tag:yaml.org,2002:map", {
2657
+ kind: "mapping",
2658
+ construct: function(data) {
2659
+ return data !== null ? data : {};
2660
+ }
2661
+ });
2662
+ var failsafe = new schema({
2663
+ explicit: [
2664
+ str,
2665
+ seq,
2666
+ map
2667
+ ]
2668
+ });
2669
+ function resolveYamlNull(data) {
2670
+ if (data === null)
2671
+ return true;
2672
+ var max = data.length;
2673
+ return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
2674
+ }
2675
+ function constructYamlNull() {
2676
+ return null;
2677
+ }
2678
+ function isNull(object) {
2679
+ return object === null;
2680
+ }
2681
+ var _null = new type("tag:yaml.org,2002:null", {
2682
+ kind: "scalar",
2683
+ resolve: resolveYamlNull,
2684
+ construct: constructYamlNull,
2685
+ predicate: isNull,
2686
+ represent: {
2687
+ canonical: function() {
2688
+ return "~";
2689
+ },
2690
+ lowercase: function() {
2691
+ return "null";
2692
+ },
2693
+ uppercase: function() {
2694
+ return "NULL";
2695
+ },
2696
+ camelcase: function() {
2697
+ return "Null";
2698
+ },
2699
+ empty: function() {
2700
+ return "";
2701
+ }
2702
+ },
2703
+ defaultStyle: "lowercase"
2704
+ });
2705
+ function resolveYamlBoolean(data) {
2706
+ if (data === null)
2707
+ return false;
2708
+ var max = data.length;
2709
+ return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
2710
+ }
2711
+ function constructYamlBoolean(data) {
2712
+ return data === "true" || data === "True" || data === "TRUE";
2713
+ }
2714
+ function isBoolean(object) {
2715
+ return Object.prototype.toString.call(object) === "[object Boolean]";
2716
+ }
2717
+ var bool = new type("tag:yaml.org,2002:bool", {
2718
+ kind: "scalar",
2719
+ resolve: resolveYamlBoolean,
2720
+ construct: constructYamlBoolean,
2721
+ predicate: isBoolean,
2722
+ represent: {
2723
+ lowercase: function(object) {
2724
+ return object ? "true" : "false";
2725
+ },
2726
+ uppercase: function(object) {
2727
+ return object ? "TRUE" : "FALSE";
2728
+ },
2729
+ camelcase: function(object) {
2730
+ return object ? "True" : "False";
2731
+ }
2732
+ },
2733
+ defaultStyle: "lowercase"
2734
+ });
2735
+ function isHexCode(c) {
2736
+ return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
2737
+ }
2738
+ function isOctCode(c) {
2739
+ return 48 <= c && c <= 55;
2740
+ }
2741
+ function isDecCode(c) {
2742
+ return 48 <= c && c <= 57;
2743
+ }
2744
+ function resolveYamlInteger(data) {
2745
+ if (data === null)
2746
+ return false;
2747
+ var max = data.length, index = 0, hasDigits = false, ch;
2748
+ if (!max)
2749
+ return false;
2750
+ ch = data[index];
2751
+ if (ch === "-" || ch === "+") {
2752
+ ch = data[++index];
2753
+ }
2754
+ if (ch === "0") {
2755
+ if (index + 1 === max)
2756
+ return true;
2757
+ ch = data[++index];
2758
+ if (ch === "b") {
2759
+ index++;
2760
+ for (; index < max; index++) {
2761
+ ch = data[index];
2762
+ if (ch === "_")
2763
+ continue;
2764
+ if (ch !== "0" && ch !== "1")
2765
+ return false;
2766
+ hasDigits = true;
2767
+ }
2768
+ return hasDigits && ch !== "_";
2769
+ }
2770
+ if (ch === "x") {
2771
+ index++;
2772
+ for (; index < max; index++) {
2773
+ ch = data[index];
2774
+ if (ch === "_")
2775
+ continue;
2776
+ if (!isHexCode(data.charCodeAt(index)))
2777
+ return false;
2778
+ hasDigits = true;
2779
+ }
2780
+ return hasDigits && ch !== "_";
2781
+ }
2782
+ if (ch === "o") {
2783
+ index++;
2784
+ for (; index < max; index++) {
2785
+ ch = data[index];
2786
+ if (ch === "_")
2787
+ continue;
2788
+ if (!isOctCode(data.charCodeAt(index)))
2789
+ return false;
2790
+ hasDigits = true;
2791
+ }
2792
+ return hasDigits && ch !== "_";
2793
+ }
2794
+ }
2795
+ if (ch === "_")
2796
+ return false;
2797
+ for (; index < max; index++) {
2798
+ ch = data[index];
2799
+ if (ch === "_")
2800
+ continue;
2801
+ if (!isDecCode(data.charCodeAt(index))) {
2802
+ return false;
2803
+ }
2804
+ hasDigits = true;
2805
+ }
2806
+ if (!hasDigits || ch === "_")
2807
+ return false;
2808
+ return true;
2809
+ }
2810
+ function constructYamlInteger(data) {
2811
+ var value = data, sign = 1, ch;
2812
+ if (value.indexOf("_") !== -1) {
2813
+ value = value.replace(/_/g, "");
2814
+ }
2815
+ ch = value[0];
2816
+ if (ch === "-" || ch === "+") {
2817
+ if (ch === "-")
2818
+ sign = -1;
2819
+ value = value.slice(1);
2820
+ ch = value[0];
2821
+ }
2822
+ if (value === "0")
2823
+ return 0;
2824
+ if (ch === "0") {
2825
+ if (value[1] === "b")
2826
+ return sign * parseInt(value.slice(2), 2);
2827
+ if (value[1] === "x")
2828
+ return sign * parseInt(value.slice(2), 16);
2829
+ if (value[1] === "o")
2830
+ return sign * parseInt(value.slice(2), 8);
2831
+ }
2832
+ return sign * parseInt(value, 10);
2833
+ }
2834
+ function isInteger(object) {
2835
+ return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
2836
+ }
2837
+ var int = new type("tag:yaml.org,2002:int", {
2838
+ kind: "scalar",
2839
+ resolve: resolveYamlInteger,
2840
+ construct: constructYamlInteger,
2841
+ predicate: isInteger,
2842
+ represent: {
2843
+ binary: function(obj) {
2844
+ return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
2845
+ },
2846
+ octal: function(obj) {
2847
+ return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
2848
+ },
2849
+ decimal: function(obj) {
2850
+ return obj.toString(10);
2851
+ },
2852
+ hexadecimal: function(obj) {
2853
+ return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
2854
+ }
2855
+ },
2856
+ defaultStyle: "decimal",
2857
+ styleAliases: {
2858
+ binary: [2, "bin"],
2859
+ octal: [8, "oct"],
2860
+ decimal: [10, "dec"],
2861
+ hexadecimal: [16, "hex"]
2862
+ }
2863
+ });
2864
+ var YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
2865
+ function resolveYamlFloat(data) {
2866
+ if (data === null)
2867
+ return false;
2868
+ if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") {
2869
+ return false;
2870
+ }
2871
+ return true;
2872
+ }
2873
+ function constructYamlFloat(data) {
2874
+ var value, sign;
2875
+ value = data.replace(/_/g, "").toLowerCase();
2876
+ sign = value[0] === "-" ? -1 : 1;
2877
+ if ("+-".indexOf(value[0]) >= 0) {
2878
+ value = value.slice(1);
2879
+ }
2880
+ if (value === ".inf") {
2881
+ return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
2882
+ } else if (value === ".nan") {
2883
+ return NaN;
2884
+ }
2885
+ return sign * parseFloat(value, 10);
2886
+ }
2887
+ var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
2888
+ function representYamlFloat(object, style) {
2889
+ var res;
2890
+ if (isNaN(object)) {
2891
+ switch (style) {
2892
+ case "lowercase":
2893
+ return ".nan";
2894
+ case "uppercase":
2895
+ return ".NAN";
2896
+ case "camelcase":
2897
+ return ".NaN";
2898
+ }
2899
+ } else if (Number.POSITIVE_INFINITY === object) {
2900
+ switch (style) {
2901
+ case "lowercase":
2902
+ return ".inf";
2903
+ case "uppercase":
2904
+ return ".INF";
2905
+ case "camelcase":
2906
+ return ".Inf";
2907
+ }
2908
+ } else if (Number.NEGATIVE_INFINITY === object) {
2909
+ switch (style) {
2910
+ case "lowercase":
2911
+ return "-.inf";
2912
+ case "uppercase":
2913
+ return "-.INF";
2914
+ case "camelcase":
2915
+ return "-.Inf";
2916
+ }
2917
+ } else if (common.isNegativeZero(object)) {
2918
+ return "-0.0";
2919
+ }
2920
+ res = object.toString(10);
2921
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
2922
+ }
2923
+ function isFloat(object) {
2924
+ return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
2925
+ }
2926
+ var float = new type("tag:yaml.org,2002:float", {
2927
+ kind: "scalar",
2928
+ resolve: resolveYamlFloat,
2929
+ construct: constructYamlFloat,
2930
+ predicate: isFloat,
2931
+ represent: representYamlFloat,
2932
+ defaultStyle: "lowercase"
2933
+ });
2934
+ var json = failsafe.extend({
2935
+ implicit: [
2936
+ _null,
2937
+ bool,
2938
+ int,
2939
+ float
2940
+ ]
2941
+ });
2942
+ var core = json;
2943
+ var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
2944
+ var YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
2945
+ function resolveYamlTimestamp(data) {
2946
+ if (data === null)
2947
+ return false;
2948
+ if (YAML_DATE_REGEXP.exec(data) !== null)
2949
+ return true;
2950
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
2951
+ return true;
2952
+ return false;
2953
+ }
2954
+ function constructYamlTimestamp(data) {
2955
+ var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
2956
+ match = YAML_DATE_REGEXP.exec(data);
2957
+ if (match === null)
2958
+ match = YAML_TIMESTAMP_REGEXP.exec(data);
2959
+ if (match === null)
2960
+ throw new Error("Date resolve error");
2961
+ year = +match[1];
2962
+ month = +match[2] - 1;
2963
+ day = +match[3];
2964
+ if (!match[4]) {
2965
+ return new Date(Date.UTC(year, month, day));
2966
+ }
2967
+ hour = +match[4];
2968
+ minute = +match[5];
2969
+ second = +match[6];
2970
+ if (match[7]) {
2971
+ fraction = match[7].slice(0, 3);
2972
+ while (fraction.length < 3) {
2973
+ fraction += "0";
2974
+ }
2975
+ fraction = +fraction;
2976
+ }
2977
+ if (match[9]) {
2978
+ tz_hour = +match[10];
2979
+ tz_minute = +(match[11] || 0);
2980
+ delta = (tz_hour * 60 + tz_minute) * 6e4;
2981
+ if (match[9] === "-")
2982
+ delta = -delta;
2983
+ }
2984
+ date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
2985
+ if (delta)
2986
+ date.setTime(date.getTime() - delta);
2987
+ return date;
2988
+ }
2989
+ function representYamlTimestamp(object) {
2990
+ return object.toISOString();
2991
+ }
2992
+ var timestamp = new type("tag:yaml.org,2002:timestamp", {
2993
+ kind: "scalar",
2994
+ resolve: resolveYamlTimestamp,
2995
+ construct: constructYamlTimestamp,
2996
+ instanceOf: Date,
2997
+ represent: representYamlTimestamp
2998
+ });
2999
+ function resolveYamlMerge(data) {
3000
+ return data === "<<" || data === null;
3001
+ }
3002
+ var merge = new type("tag:yaml.org,2002:merge", {
3003
+ kind: "scalar",
3004
+ resolve: resolveYamlMerge
3005
+ });
3006
+ var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
3007
+ function resolveYamlBinary(data) {
3008
+ if (data === null)
3009
+ return false;
3010
+ var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
3011
+ for (idx = 0; idx < max; idx++) {
3012
+ code = map2.indexOf(data.charAt(idx));
3013
+ if (code > 64)
3014
+ continue;
3015
+ if (code < 0)
3016
+ return false;
3017
+ bitlen += 6;
3018
+ }
3019
+ return bitlen % 8 === 0;
3020
+ }
3021
+ function constructYamlBinary(data) {
3022
+ var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
3023
+ for (idx = 0; idx < max; idx++) {
3024
+ if (idx % 4 === 0 && idx) {
3025
+ result.push(bits >> 16 & 255);
3026
+ result.push(bits >> 8 & 255);
3027
+ result.push(bits & 255);
3028
+ }
3029
+ bits = bits << 6 | map2.indexOf(input.charAt(idx));
3030
+ }
3031
+ tailbits = max % 4 * 6;
3032
+ if (tailbits === 0) {
3033
+ result.push(bits >> 16 & 255);
3034
+ result.push(bits >> 8 & 255);
3035
+ result.push(bits & 255);
3036
+ } else if (tailbits === 18) {
3037
+ result.push(bits >> 10 & 255);
3038
+ result.push(bits >> 2 & 255);
3039
+ } else if (tailbits === 12) {
3040
+ result.push(bits >> 4 & 255);
3041
+ }
3042
+ return new Uint8Array(result);
3043
+ }
3044
+ function representYamlBinary(object) {
3045
+ var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
3046
+ for (idx = 0; idx < max; idx++) {
3047
+ if (idx % 3 === 0 && idx) {
3048
+ result += map2[bits >> 18 & 63];
3049
+ result += map2[bits >> 12 & 63];
3050
+ result += map2[bits >> 6 & 63];
3051
+ result += map2[bits & 63];
3052
+ }
3053
+ bits = (bits << 8) + object[idx];
3054
+ }
3055
+ tail = max % 3;
3056
+ if (tail === 0) {
3057
+ result += map2[bits >> 18 & 63];
3058
+ result += map2[bits >> 12 & 63];
3059
+ result += map2[bits >> 6 & 63];
3060
+ result += map2[bits & 63];
3061
+ } else if (tail === 2) {
3062
+ result += map2[bits >> 10 & 63];
3063
+ result += map2[bits >> 4 & 63];
3064
+ result += map2[bits << 2 & 63];
3065
+ result += map2[64];
3066
+ } else if (tail === 1) {
3067
+ result += map2[bits >> 2 & 63];
3068
+ result += map2[bits << 4 & 63];
3069
+ result += map2[64];
3070
+ result += map2[64];
3071
+ }
3072
+ return result;
3073
+ }
3074
+ function isBinary(obj) {
3075
+ return Object.prototype.toString.call(obj) === "[object Uint8Array]";
3076
+ }
3077
+ var binary = new type("tag:yaml.org,2002:binary", {
3078
+ kind: "scalar",
3079
+ resolve: resolveYamlBinary,
3080
+ construct: constructYamlBinary,
3081
+ predicate: isBinary,
3082
+ represent: representYamlBinary
3083
+ });
3084
+ var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
3085
+ var _toString$2 = Object.prototype.toString;
3086
+ function resolveYamlOmap(data) {
3087
+ if (data === null)
3088
+ return true;
3089
+ var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
3090
+ for (index = 0, length = object.length; index < length; index += 1) {
3091
+ pair = object[index];
3092
+ pairHasKey = false;
3093
+ if (_toString$2.call(pair) !== "[object Object]")
3094
+ return false;
3095
+ for (pairKey in pair) {
3096
+ if (_hasOwnProperty$3.call(pair, pairKey)) {
3097
+ if (!pairHasKey)
3098
+ pairHasKey = true;
3099
+ else
3100
+ return false;
3101
+ }
3102
+ }
3103
+ if (!pairHasKey)
3104
+ return false;
3105
+ if (objectKeys.indexOf(pairKey) === -1)
3106
+ objectKeys.push(pairKey);
3107
+ else
3108
+ return false;
3109
+ }
3110
+ return true;
3111
+ }
3112
+ function constructYamlOmap(data) {
3113
+ return data !== null ? data : [];
3114
+ }
3115
+ var omap = new type("tag:yaml.org,2002:omap", {
3116
+ kind: "sequence",
3117
+ resolve: resolveYamlOmap,
3118
+ construct: constructYamlOmap
3119
+ });
3120
+ var _toString$1 = Object.prototype.toString;
3121
+ function resolveYamlPairs(data) {
3122
+ if (data === null)
3123
+ return true;
3124
+ var index, length, pair, keys, result, object = data;
3125
+ result = new Array(object.length);
3126
+ for (index = 0, length = object.length; index < length; index += 1) {
3127
+ pair = object[index];
3128
+ if (_toString$1.call(pair) !== "[object Object]")
3129
+ return false;
3130
+ keys = Object.keys(pair);
3131
+ if (keys.length !== 1)
3132
+ return false;
3133
+ result[index] = [keys[0], pair[keys[0]]];
3134
+ }
3135
+ return true;
3136
+ }
3137
+ function constructYamlPairs(data) {
3138
+ if (data === null)
3139
+ return [];
3140
+ var index, length, pair, keys, result, object = data;
3141
+ result = new Array(object.length);
3142
+ for (index = 0, length = object.length; index < length; index += 1) {
3143
+ pair = object[index];
3144
+ keys = Object.keys(pair);
3145
+ result[index] = [keys[0], pair[keys[0]]];
3146
+ }
3147
+ return result;
3148
+ }
3149
+ var pairs = new type("tag:yaml.org,2002:pairs", {
3150
+ kind: "sequence",
3151
+ resolve: resolveYamlPairs,
3152
+ construct: constructYamlPairs
3153
+ });
3154
+ var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
3155
+ function resolveYamlSet(data) {
3156
+ if (data === null)
3157
+ return true;
3158
+ var key, object = data;
3159
+ for (key in object) {
3160
+ if (_hasOwnProperty$2.call(object, key)) {
3161
+ if (object[key] !== null)
3162
+ return false;
3163
+ }
3164
+ }
3165
+ return true;
3166
+ }
3167
+ function constructYamlSet(data) {
3168
+ return data !== null ? data : {};
3169
+ }
3170
+ var set = new type("tag:yaml.org,2002:set", {
3171
+ kind: "mapping",
3172
+ resolve: resolveYamlSet,
3173
+ construct: constructYamlSet
3174
+ });
3175
+ var _default = core.extend({
3176
+ implicit: [
3177
+ timestamp,
3178
+ merge
3179
+ ],
3180
+ explicit: [
3181
+ binary,
3182
+ omap,
3183
+ pairs,
3184
+ set
3185
+ ]
3186
+ });
3187
+ var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
3188
+ var CONTEXT_FLOW_IN = 1;
3189
+ var CONTEXT_FLOW_OUT = 2;
3190
+ var CONTEXT_BLOCK_IN = 3;
3191
+ var CONTEXT_BLOCK_OUT = 4;
3192
+ var CHOMPING_CLIP = 1;
3193
+ var CHOMPING_STRIP = 2;
3194
+ var CHOMPING_KEEP = 3;
3195
+ var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
3196
+ var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
3197
+ var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
3198
+ var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
3199
+ var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
3200
+ function _class(obj) {
3201
+ return Object.prototype.toString.call(obj);
3202
+ }
3203
+ function is_EOL(c) {
3204
+ return c === 10 || c === 13;
3205
+ }
3206
+ function is_WHITE_SPACE(c) {
3207
+ return c === 9 || c === 32;
3208
+ }
3209
+ function is_WS_OR_EOL(c) {
3210
+ return c === 9 || c === 32 || c === 10 || c === 13;
3211
+ }
3212
+ function is_FLOW_INDICATOR(c) {
3213
+ return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
3214
+ }
3215
+ function fromHexCode(c) {
3216
+ var lc;
3217
+ if (48 <= c && c <= 57) {
3218
+ return c - 48;
3219
+ }
3220
+ lc = c | 32;
3221
+ if (97 <= lc && lc <= 102) {
3222
+ return lc - 97 + 10;
3223
+ }
3224
+ return -1;
3225
+ }
3226
+ function escapedHexLen(c) {
3227
+ if (c === 120) {
3228
+ return 2;
3229
+ }
3230
+ if (c === 117) {
3231
+ return 4;
3232
+ }
3233
+ if (c === 85) {
3234
+ return 8;
3235
+ }
3236
+ return 0;
3237
+ }
3238
+ function fromDecimalCode(c) {
3239
+ if (48 <= c && c <= 57) {
3240
+ return c - 48;
3241
+ }
3242
+ return -1;
3243
+ }
3244
+ function simpleEscapeSequence(c) {
3245
+ return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
3246
+ }
3247
+ function charFromCodepoint(c) {
3248
+ if (c <= 65535) {
3249
+ return String.fromCharCode(c);
3250
+ }
3251
+ return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
3252
+ }
3253
+ var simpleEscapeCheck = new Array(256);
3254
+ var simpleEscapeMap = new Array(256);
3255
+ for (i = 0; i < 256; i++) {
3256
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
3257
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
3258
+ }
3259
+ var i;
3260
+ function State$1(input, options) {
3261
+ this.input = input;
3262
+ this.filename = options["filename"] || null;
3263
+ this.schema = options["schema"] || _default;
3264
+ this.onWarning = options["onWarning"] || null;
3265
+ this.legacy = options["legacy"] || false;
3266
+ this.json = options["json"] || false;
3267
+ this.listener = options["listener"] || null;
3268
+ this.implicitTypes = this.schema.compiledImplicit;
3269
+ this.typeMap = this.schema.compiledTypeMap;
3270
+ this.length = input.length;
3271
+ this.position = 0;
3272
+ this.line = 0;
3273
+ this.lineStart = 0;
3274
+ this.lineIndent = 0;
3275
+ this.firstTabInLine = -1;
3276
+ this.documents = [];
3277
+ }
3278
+ function generateError(state, message) {
3279
+ var mark = {
3280
+ name: state.filename,
3281
+ buffer: state.input.slice(0, -1),
3282
+ position: state.position,
3283
+ line: state.line,
3284
+ column: state.position - state.lineStart
3285
+ };
3286
+ mark.snippet = snippet(mark);
3287
+ return new exception(message, mark);
3288
+ }
3289
+ function throwError(state, message) {
3290
+ throw generateError(state, message);
3291
+ }
3292
+ function throwWarning(state, message) {
3293
+ if (state.onWarning) {
3294
+ state.onWarning.call(null, generateError(state, message));
3295
+ }
3296
+ }
3297
+ var directiveHandlers = {
3298
+ YAML: function handleYamlDirective(state, name, args) {
3299
+ var match, major, minor;
3300
+ if (state.version !== null) {
3301
+ throwError(state, "duplication of %YAML directive");
3302
+ }
3303
+ if (args.length !== 1) {
3304
+ throwError(state, "YAML directive accepts exactly one argument");
3305
+ }
3306
+ match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
3307
+ if (match === null) {
3308
+ throwError(state, "ill-formed argument of the YAML directive");
3309
+ }
3310
+ major = parseInt(match[1], 10);
3311
+ minor = parseInt(match[2], 10);
3312
+ if (major !== 1) {
3313
+ throwError(state, "unacceptable YAML version of the document");
3314
+ }
3315
+ state.version = args[0];
3316
+ state.checkLineBreaks = minor < 2;
3317
+ if (minor !== 1 && minor !== 2) {
3318
+ throwWarning(state, "unsupported YAML version of the document");
3319
+ }
3320
+ },
3321
+ TAG: function handleTagDirective(state, name, args) {
3322
+ var handle, prefix;
3323
+ if (args.length !== 2) {
3324
+ throwError(state, "TAG directive accepts exactly two arguments");
3325
+ }
3326
+ handle = args[0];
3327
+ prefix = args[1];
3328
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
3329
+ throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
3330
+ }
3331
+ if (_hasOwnProperty$1.call(state.tagMap, handle)) {
3332
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
3333
+ }
3334
+ if (!PATTERN_TAG_URI.test(prefix)) {
3335
+ throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
3336
+ }
3337
+ try {
3338
+ prefix = decodeURIComponent(prefix);
3339
+ } catch (err) {
3340
+ throwError(state, "tag prefix is malformed: " + prefix);
3341
+ }
3342
+ state.tagMap[handle] = prefix;
3343
+ }
3344
+ };
3345
+ function captureSegment(state, start, end, checkJson) {
3346
+ var _position, _length, _character, _result;
3347
+ if (start < end) {
3348
+ _result = state.input.slice(start, end);
3349
+ if (checkJson) {
3350
+ for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
3351
+ _character = _result.charCodeAt(_position);
3352
+ if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
3353
+ throwError(state, "expected valid JSON character");
3354
+ }
3355
+ }
3356
+ } else if (PATTERN_NON_PRINTABLE.test(_result)) {
3357
+ throwError(state, "the stream contains non-printable characters");
3358
+ }
3359
+ state.result += _result;
3360
+ }
3361
+ }
3362
+ function mergeMappings(state, destination, source, overridableKeys) {
3363
+ var sourceKeys, key, index, quantity;
3364
+ if (!common.isObject(source)) {
3365
+ throwError(state, "cannot merge mappings; the provided source object is unacceptable");
3366
+ }
3367
+ sourceKeys = Object.keys(source);
3368
+ for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
3369
+ key = sourceKeys[index];
3370
+ if (!_hasOwnProperty$1.call(destination, key)) {
3371
+ destination[key] = source[key];
3372
+ overridableKeys[key] = true;
3373
+ }
3374
+ }
3375
+ }
3376
+ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
3377
+ var index, quantity;
3378
+ if (Array.isArray(keyNode)) {
3379
+ keyNode = Array.prototype.slice.call(keyNode);
3380
+ for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
3381
+ if (Array.isArray(keyNode[index])) {
3382
+ throwError(state, "nested arrays are not supported inside keys");
3383
+ }
3384
+ if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
3385
+ keyNode[index] = "[object Object]";
3386
+ }
3387
+ }
3388
+ }
3389
+ if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
3390
+ keyNode = "[object Object]";
3391
+ }
3392
+ keyNode = String(keyNode);
3393
+ if (_result === null) {
3394
+ _result = {};
3395
+ }
3396
+ if (keyTag === "tag:yaml.org,2002:merge") {
3397
+ if (Array.isArray(valueNode)) {
3398
+ for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
3399
+ mergeMappings(state, _result, valueNode[index], overridableKeys);
3400
+ }
3401
+ } else {
3402
+ mergeMappings(state, _result, valueNode, overridableKeys);
3403
+ }
3404
+ } else {
3405
+ if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
3406
+ state.line = startLine || state.line;
3407
+ state.lineStart = startLineStart || state.lineStart;
3408
+ state.position = startPos || state.position;
3409
+ throwError(state, "duplicated mapping key");
3410
+ }
3411
+ if (keyNode === "__proto__") {
3412
+ Object.defineProperty(_result, keyNode, {
3413
+ configurable: true,
3414
+ enumerable: true,
3415
+ writable: true,
3416
+ value: valueNode
3417
+ });
3418
+ } else {
3419
+ _result[keyNode] = valueNode;
3420
+ }
3421
+ delete overridableKeys[keyNode];
3422
+ }
3423
+ return _result;
3424
+ }
3425
+ function readLineBreak(state) {
3426
+ var ch;
3427
+ ch = state.input.charCodeAt(state.position);
3428
+ if (ch === 10) {
3429
+ state.position++;
3430
+ } else if (ch === 13) {
3431
+ state.position++;
3432
+ if (state.input.charCodeAt(state.position) === 10) {
3433
+ state.position++;
3434
+ }
3435
+ } else {
3436
+ throwError(state, "a line break is expected");
3437
+ }
3438
+ state.line += 1;
3439
+ state.lineStart = state.position;
3440
+ state.firstTabInLine = -1;
3441
+ }
3442
+ function skipSeparationSpace(state, allowComments, checkIndent) {
3443
+ var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
3444
+ while (ch !== 0) {
3445
+ while (is_WHITE_SPACE(ch)) {
3446
+ if (ch === 9 && state.firstTabInLine === -1) {
3447
+ state.firstTabInLine = state.position;
3448
+ }
3449
+ ch = state.input.charCodeAt(++state.position);
3450
+ }
3451
+ if (allowComments && ch === 35) {
3452
+ do {
3453
+ ch = state.input.charCodeAt(++state.position);
3454
+ } while (ch !== 10 && ch !== 13 && ch !== 0);
3455
+ }
3456
+ if (is_EOL(ch)) {
3457
+ readLineBreak(state);
3458
+ ch = state.input.charCodeAt(state.position);
3459
+ lineBreaks++;
3460
+ state.lineIndent = 0;
3461
+ while (ch === 32) {
3462
+ state.lineIndent++;
3463
+ ch = state.input.charCodeAt(++state.position);
3464
+ }
3465
+ } else {
3466
+ break;
3467
+ }
3468
+ }
3469
+ if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
3470
+ throwWarning(state, "deficient indentation");
3471
+ }
3472
+ return lineBreaks;
3473
+ }
3474
+ function testDocumentSeparator(state) {
3475
+ var _position = state.position, ch;
3476
+ ch = state.input.charCodeAt(_position);
3477
+ if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
3478
+ _position += 3;
3479
+ ch = state.input.charCodeAt(_position);
3480
+ if (ch === 0 || is_WS_OR_EOL(ch)) {
3481
+ return true;
3482
+ }
3483
+ }
3484
+ return false;
3485
+ }
3486
+ function writeFoldedLines(state, count) {
3487
+ if (count === 1) {
3488
+ state.result += " ";
3489
+ } else if (count > 1) {
3490
+ state.result += common.repeat("\n", count - 1);
3491
+ }
3492
+ }
3493
+ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
3494
+ var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
3495
+ ch = state.input.charCodeAt(state.position);
3496
+ if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
3497
+ return false;
3498
+ }
3499
+ if (ch === 63 || ch === 45) {
3500
+ following = state.input.charCodeAt(state.position + 1);
3501
+ if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
3502
+ return false;
3503
+ }
3504
+ }
3505
+ state.kind = "scalar";
3506
+ state.result = "";
3507
+ captureStart = captureEnd = state.position;
3508
+ hasPendingContent = false;
3509
+ while (ch !== 0) {
3510
+ if (ch === 58) {
3511
+ following = state.input.charCodeAt(state.position + 1);
3512
+ if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
3513
+ break;
3514
+ }
3515
+ } else if (ch === 35) {
3516
+ preceding = state.input.charCodeAt(state.position - 1);
3517
+ if (is_WS_OR_EOL(preceding)) {
3518
+ break;
3519
+ }
3520
+ } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
3521
+ break;
3522
+ } else if (is_EOL(ch)) {
3523
+ _line = state.line;
3524
+ _lineStart = state.lineStart;
3525
+ _lineIndent = state.lineIndent;
3526
+ skipSeparationSpace(state, false, -1);
3527
+ if (state.lineIndent >= nodeIndent) {
3528
+ hasPendingContent = true;
3529
+ ch = state.input.charCodeAt(state.position);
3530
+ continue;
3531
+ } else {
3532
+ state.position = captureEnd;
3533
+ state.line = _line;
3534
+ state.lineStart = _lineStart;
3535
+ state.lineIndent = _lineIndent;
3536
+ break;
3537
+ }
3538
+ }
3539
+ if (hasPendingContent) {
3540
+ captureSegment(state, captureStart, captureEnd, false);
3541
+ writeFoldedLines(state, state.line - _line);
3542
+ captureStart = captureEnd = state.position;
3543
+ hasPendingContent = false;
3544
+ }
3545
+ if (!is_WHITE_SPACE(ch)) {
3546
+ captureEnd = state.position + 1;
3547
+ }
3548
+ ch = state.input.charCodeAt(++state.position);
3549
+ }
3550
+ captureSegment(state, captureStart, captureEnd, false);
3551
+ if (state.result) {
3552
+ return true;
3553
+ }
3554
+ state.kind = _kind;
3555
+ state.result = _result;
3556
+ return false;
3557
+ }
3558
+ function readSingleQuotedScalar(state, nodeIndent) {
3559
+ var ch, captureStart, captureEnd;
3560
+ ch = state.input.charCodeAt(state.position);
3561
+ if (ch !== 39) {
3562
+ return false;
3563
+ }
3564
+ state.kind = "scalar";
3565
+ state.result = "";
3566
+ state.position++;
3567
+ captureStart = captureEnd = state.position;
3568
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
3569
+ if (ch === 39) {
3570
+ captureSegment(state, captureStart, state.position, true);
3571
+ ch = state.input.charCodeAt(++state.position);
3572
+ if (ch === 39) {
3573
+ captureStart = state.position;
3574
+ state.position++;
3575
+ captureEnd = state.position;
3576
+ } else {
3577
+ return true;
3578
+ }
3579
+ } else if (is_EOL(ch)) {
3580
+ captureSegment(state, captureStart, captureEnd, true);
3581
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
3582
+ captureStart = captureEnd = state.position;
3583
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
3584
+ throwError(state, "unexpected end of the document within a single quoted scalar");
3585
+ } else {
3586
+ state.position++;
3587
+ captureEnd = state.position;
3588
+ }
3589
+ }
3590
+ throwError(state, "unexpected end of the stream within a single quoted scalar");
3591
+ }
3592
+ function readDoubleQuotedScalar(state, nodeIndent) {
3593
+ var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
3594
+ ch = state.input.charCodeAt(state.position);
3595
+ if (ch !== 34) {
3596
+ return false;
3597
+ }
3598
+ state.kind = "scalar";
3599
+ state.result = "";
3600
+ state.position++;
3601
+ captureStart = captureEnd = state.position;
3602
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
3603
+ if (ch === 34) {
3604
+ captureSegment(state, captureStart, state.position, true);
3605
+ state.position++;
3606
+ return true;
3607
+ } else if (ch === 92) {
3608
+ captureSegment(state, captureStart, state.position, true);
3609
+ ch = state.input.charCodeAt(++state.position);
3610
+ if (is_EOL(ch)) {
3611
+ skipSeparationSpace(state, false, nodeIndent);
3612
+ } else if (ch < 256 && simpleEscapeCheck[ch]) {
3613
+ state.result += simpleEscapeMap[ch];
3614
+ state.position++;
3615
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
3616
+ hexLength = tmp;
3617
+ hexResult = 0;
3618
+ for (; hexLength > 0; hexLength--) {
3619
+ ch = state.input.charCodeAt(++state.position);
3620
+ if ((tmp = fromHexCode(ch)) >= 0) {
3621
+ hexResult = (hexResult << 4) + tmp;
3622
+ } else {
3623
+ throwError(state, "expected hexadecimal character");
3624
+ }
3625
+ }
3626
+ state.result += charFromCodepoint(hexResult);
3627
+ state.position++;
3628
+ } else {
3629
+ throwError(state, "unknown escape sequence");
3630
+ }
3631
+ captureStart = captureEnd = state.position;
3632
+ } else if (is_EOL(ch)) {
3633
+ captureSegment(state, captureStart, captureEnd, true);
3634
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
3635
+ captureStart = captureEnd = state.position;
3636
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
3637
+ throwError(state, "unexpected end of the document within a double quoted scalar");
3638
+ } else {
3639
+ state.position++;
3640
+ captureEnd = state.position;
3641
+ }
3642
+ }
3643
+ throwError(state, "unexpected end of the stream within a double quoted scalar");
3644
+ }
3645
+ function readFlowCollection(state, nodeIndent) {
3646
+ var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch;
3647
+ ch = state.input.charCodeAt(state.position);
3648
+ if (ch === 91) {
3649
+ terminator = 93;
3650
+ isMapping = false;
3651
+ _result = [];
3652
+ } else if (ch === 123) {
3653
+ terminator = 125;
3654
+ isMapping = true;
3655
+ _result = {};
3656
+ } else {
3657
+ return false;
3658
+ }
3659
+ if (state.anchor !== null) {
3660
+ state.anchorMap[state.anchor] = _result;
3661
+ }
3662
+ ch = state.input.charCodeAt(++state.position);
3663
+ while (ch !== 0) {
3664
+ skipSeparationSpace(state, true, nodeIndent);
3665
+ ch = state.input.charCodeAt(state.position);
3666
+ if (ch === terminator) {
3667
+ state.position++;
3668
+ state.tag = _tag;
3669
+ state.anchor = _anchor;
3670
+ state.kind = isMapping ? "mapping" : "sequence";
3671
+ state.result = _result;
3672
+ return true;
3673
+ } else if (!readNext) {
3674
+ throwError(state, "missed comma between flow collection entries");
3675
+ } else if (ch === 44) {
3676
+ throwError(state, "expected the node content, but found ','");
3677
+ }
3678
+ keyTag = keyNode = valueNode = null;
3679
+ isPair = isExplicitPair = false;
3680
+ if (ch === 63) {
3681
+ following = state.input.charCodeAt(state.position + 1);
3682
+ if (is_WS_OR_EOL(following)) {
3683
+ isPair = isExplicitPair = true;
3684
+ state.position++;
3685
+ skipSeparationSpace(state, true, nodeIndent);
3686
+ }
3687
+ }
3688
+ _line = state.line;
3689
+ _lineStart = state.lineStart;
3690
+ _pos = state.position;
3691
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
3692
+ keyTag = state.tag;
3693
+ keyNode = state.result;
3694
+ skipSeparationSpace(state, true, nodeIndent);
3695
+ ch = state.input.charCodeAt(state.position);
3696
+ if ((isExplicitPair || state.line === _line) && ch === 58) {
3697
+ isPair = true;
3698
+ ch = state.input.charCodeAt(++state.position);
3699
+ skipSeparationSpace(state, true, nodeIndent);
3700
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
3701
+ valueNode = state.result;
3702
+ }
3703
+ if (isMapping) {
3704
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
3705
+ } else if (isPair) {
3706
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
3707
+ } else {
3708
+ _result.push(keyNode);
3709
+ }
3710
+ skipSeparationSpace(state, true, nodeIndent);
3711
+ ch = state.input.charCodeAt(state.position);
3712
+ if (ch === 44) {
3713
+ readNext = true;
3714
+ ch = state.input.charCodeAt(++state.position);
3715
+ } else {
3716
+ readNext = false;
3717
+ }
3718
+ }
3719
+ throwError(state, "unexpected end of the stream within a flow collection");
3720
+ }
3721
+ function readBlockScalar(state, nodeIndent) {
3722
+ var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
3723
+ ch = state.input.charCodeAt(state.position);
3724
+ if (ch === 124) {
3725
+ folding = false;
3726
+ } else if (ch === 62) {
3727
+ folding = true;
3728
+ } else {
3729
+ return false;
3730
+ }
3731
+ state.kind = "scalar";
3732
+ state.result = "";
3733
+ while (ch !== 0) {
3734
+ ch = state.input.charCodeAt(++state.position);
3735
+ if (ch === 43 || ch === 45) {
3736
+ if (CHOMPING_CLIP === chomping) {
3737
+ chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
3738
+ } else {
3739
+ throwError(state, "repeat of a chomping mode identifier");
3740
+ }
3741
+ } else if ((tmp = fromDecimalCode(ch)) >= 0) {
3742
+ if (tmp === 0) {
3743
+ throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
3744
+ } else if (!detectedIndent) {
3745
+ textIndent = nodeIndent + tmp - 1;
3746
+ detectedIndent = true;
3747
+ } else {
3748
+ throwError(state, "repeat of an indentation width identifier");
3749
+ }
3750
+ } else {
3751
+ break;
3752
+ }
3753
+ }
3754
+ if (is_WHITE_SPACE(ch)) {
3755
+ do {
3756
+ ch = state.input.charCodeAt(++state.position);
3757
+ } while (is_WHITE_SPACE(ch));
3758
+ if (ch === 35) {
3759
+ do {
3760
+ ch = state.input.charCodeAt(++state.position);
3761
+ } while (!is_EOL(ch) && ch !== 0);
3762
+ }
3763
+ }
3764
+ while (ch !== 0) {
3765
+ readLineBreak(state);
3766
+ state.lineIndent = 0;
3767
+ ch = state.input.charCodeAt(state.position);
3768
+ while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
3769
+ state.lineIndent++;
3770
+ ch = state.input.charCodeAt(++state.position);
3771
+ }
3772
+ if (!detectedIndent && state.lineIndent > textIndent) {
3773
+ textIndent = state.lineIndent;
3774
+ }
3775
+ if (is_EOL(ch)) {
3776
+ emptyLines++;
3777
+ continue;
3778
+ }
3779
+ if (state.lineIndent < textIndent) {
3780
+ if (chomping === CHOMPING_KEEP) {
3781
+ state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
3782
+ } else if (chomping === CHOMPING_CLIP) {
3783
+ if (didReadContent) {
3784
+ state.result += "\n";
3785
+ }
3786
+ }
3787
+ break;
3788
+ }
3789
+ if (folding) {
3790
+ if (is_WHITE_SPACE(ch)) {
3791
+ atMoreIndented = true;
3792
+ state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
3793
+ } else if (atMoreIndented) {
3794
+ atMoreIndented = false;
3795
+ state.result += common.repeat("\n", emptyLines + 1);
3796
+ } else if (emptyLines === 0) {
3797
+ if (didReadContent) {
3798
+ state.result += " ";
3799
+ }
3800
+ } else {
3801
+ state.result += common.repeat("\n", emptyLines);
3802
+ }
3803
+ } else {
3804
+ state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
3805
+ }
3806
+ didReadContent = true;
3807
+ detectedIndent = true;
3808
+ emptyLines = 0;
3809
+ captureStart = state.position;
3810
+ while (!is_EOL(ch) && ch !== 0) {
3811
+ ch = state.input.charCodeAt(++state.position);
3812
+ }
3813
+ captureSegment(state, captureStart, state.position, false);
3814
+ }
3815
+ return true;
3816
+ }
3817
+ function readBlockSequence(state, nodeIndent) {
3818
+ var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
3819
+ if (state.firstTabInLine !== -1)
3820
+ return false;
3821
+ if (state.anchor !== null) {
3822
+ state.anchorMap[state.anchor] = _result;
3823
+ }
3824
+ ch = state.input.charCodeAt(state.position);
3825
+ while (ch !== 0) {
3826
+ if (state.firstTabInLine !== -1) {
3827
+ state.position = state.firstTabInLine;
3828
+ throwError(state, "tab characters must not be used in indentation");
3829
+ }
3830
+ if (ch !== 45) {
3831
+ break;
3832
+ }
3833
+ following = state.input.charCodeAt(state.position + 1);
3834
+ if (!is_WS_OR_EOL(following)) {
3835
+ break;
3836
+ }
3837
+ detected = true;
3838
+ state.position++;
3839
+ if (skipSeparationSpace(state, true, -1)) {
3840
+ if (state.lineIndent <= nodeIndent) {
3841
+ _result.push(null);
3842
+ ch = state.input.charCodeAt(state.position);
3843
+ continue;
3844
+ }
3845
+ }
3846
+ _line = state.line;
3847
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
3848
+ _result.push(state.result);
3849
+ skipSeparationSpace(state, true, -1);
3850
+ ch = state.input.charCodeAt(state.position);
3851
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
3852
+ throwError(state, "bad indentation of a sequence entry");
3853
+ } else if (state.lineIndent < nodeIndent) {
3854
+ break;
3855
+ }
3856
+ }
3857
+ if (detected) {
3858
+ state.tag = _tag;
3859
+ state.anchor = _anchor;
3860
+ state.kind = "sequence";
3861
+ state.result = _result;
3862
+ return true;
3863
+ }
3864
+ return false;
3865
+ }
3866
+ function readBlockMapping(state, nodeIndent, flowIndent) {
3867
+ var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
3868
+ if (state.firstTabInLine !== -1)
3869
+ return false;
3870
+ if (state.anchor !== null) {
3871
+ state.anchorMap[state.anchor] = _result;
3872
+ }
3873
+ ch = state.input.charCodeAt(state.position);
3874
+ while (ch !== 0) {
3875
+ if (!atExplicitKey && state.firstTabInLine !== -1) {
3876
+ state.position = state.firstTabInLine;
3877
+ throwError(state, "tab characters must not be used in indentation");
3878
+ }
3879
+ following = state.input.charCodeAt(state.position + 1);
3880
+ _line = state.line;
3881
+ if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
3882
+ if (ch === 63) {
3883
+ if (atExplicitKey) {
3884
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
3885
+ keyTag = keyNode = valueNode = null;
3886
+ }
3887
+ detected = true;
3888
+ atExplicitKey = true;
3889
+ allowCompact = true;
3890
+ } else if (atExplicitKey) {
3891
+ atExplicitKey = false;
3892
+ allowCompact = true;
3893
+ } else {
3894
+ throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
3895
+ }
3896
+ state.position += 1;
3897
+ ch = following;
3898
+ } else {
3899
+ _keyLine = state.line;
3900
+ _keyLineStart = state.lineStart;
3901
+ _keyPos = state.position;
3902
+ if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
3903
+ break;
3904
+ }
3905
+ if (state.line === _line) {
3906
+ ch = state.input.charCodeAt(state.position);
3907
+ while (is_WHITE_SPACE(ch)) {
3908
+ ch = state.input.charCodeAt(++state.position);
3909
+ }
3910
+ if (ch === 58) {
3911
+ ch = state.input.charCodeAt(++state.position);
3912
+ if (!is_WS_OR_EOL(ch)) {
3913
+ throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
3914
+ }
3915
+ if (atExplicitKey) {
3916
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
3917
+ keyTag = keyNode = valueNode = null;
3918
+ }
3919
+ detected = true;
3920
+ atExplicitKey = false;
3921
+ allowCompact = false;
3922
+ keyTag = state.tag;
3923
+ keyNode = state.result;
3924
+ } else if (detected) {
3925
+ throwError(state, "can not read an implicit mapping pair; a colon is missed");
3926
+ } else {
3927
+ state.tag = _tag;
3928
+ state.anchor = _anchor;
3929
+ return true;
3930
+ }
3931
+ } else if (detected) {
3932
+ throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
3933
+ } else {
3934
+ state.tag = _tag;
3935
+ state.anchor = _anchor;
3936
+ return true;
3937
+ }
3938
+ }
3939
+ if (state.line === _line || state.lineIndent > nodeIndent) {
3940
+ if (atExplicitKey) {
3941
+ _keyLine = state.line;
3942
+ _keyLineStart = state.lineStart;
3943
+ _keyPos = state.position;
3944
+ }
3945
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
3946
+ if (atExplicitKey) {
3947
+ keyNode = state.result;
3948
+ } else {
3949
+ valueNode = state.result;
3950
+ }
3951
+ }
3952
+ if (!atExplicitKey) {
3953
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
3954
+ keyTag = keyNode = valueNode = null;
3955
+ }
3956
+ skipSeparationSpace(state, true, -1);
3957
+ ch = state.input.charCodeAt(state.position);
3958
+ }
3959
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
3960
+ throwError(state, "bad indentation of a mapping entry");
3961
+ } else if (state.lineIndent < nodeIndent) {
3962
+ break;
3963
+ }
3964
+ }
3965
+ if (atExplicitKey) {
3966
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
3967
+ }
3968
+ if (detected) {
3969
+ state.tag = _tag;
3970
+ state.anchor = _anchor;
3971
+ state.kind = "mapping";
3972
+ state.result = _result;
3973
+ }
3974
+ return detected;
3975
+ }
3976
+ function readTagProperty(state) {
3977
+ var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
3978
+ ch = state.input.charCodeAt(state.position);
3979
+ if (ch !== 33)
3980
+ return false;
3981
+ if (state.tag !== null) {
3982
+ throwError(state, "duplication of a tag property");
3983
+ }
3984
+ ch = state.input.charCodeAt(++state.position);
3985
+ if (ch === 60) {
3986
+ isVerbatim = true;
3987
+ ch = state.input.charCodeAt(++state.position);
3988
+ } else if (ch === 33) {
3989
+ isNamed = true;
3990
+ tagHandle = "!!";
3991
+ ch = state.input.charCodeAt(++state.position);
3992
+ } else {
3993
+ tagHandle = "!";
3994
+ }
3995
+ _position = state.position;
3996
+ if (isVerbatim) {
3997
+ do {
3998
+ ch = state.input.charCodeAt(++state.position);
3999
+ } while (ch !== 0 && ch !== 62);
4000
+ if (state.position < state.length) {
4001
+ tagName = state.input.slice(_position, state.position);
4002
+ ch = state.input.charCodeAt(++state.position);
4003
+ } else {
4004
+ throwError(state, "unexpected end of the stream within a verbatim tag");
4005
+ }
4006
+ } else {
4007
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
4008
+ if (ch === 33) {
4009
+ if (!isNamed) {
4010
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
4011
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
4012
+ throwError(state, "named tag handle cannot contain such characters");
4013
+ }
4014
+ isNamed = true;
4015
+ _position = state.position + 1;
4016
+ } else {
4017
+ throwError(state, "tag suffix cannot contain exclamation marks");
4018
+ }
4019
+ }
4020
+ ch = state.input.charCodeAt(++state.position);
4021
+ }
4022
+ tagName = state.input.slice(_position, state.position);
4023
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
4024
+ throwError(state, "tag suffix cannot contain flow indicator characters");
4025
+ }
4026
+ }
4027
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
4028
+ throwError(state, "tag name cannot contain such characters: " + tagName);
4029
+ }
4030
+ try {
4031
+ tagName = decodeURIComponent(tagName);
4032
+ } catch (err) {
4033
+ throwError(state, "tag name is malformed: " + tagName);
4034
+ }
4035
+ if (isVerbatim) {
4036
+ state.tag = tagName;
4037
+ } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
4038
+ state.tag = state.tagMap[tagHandle] + tagName;
4039
+ } else if (tagHandle === "!") {
4040
+ state.tag = "!" + tagName;
4041
+ } else if (tagHandle === "!!") {
4042
+ state.tag = "tag:yaml.org,2002:" + tagName;
4043
+ } else {
4044
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"');
4045
+ }
4046
+ return true;
4047
+ }
4048
+ function readAnchorProperty(state) {
4049
+ var _position, ch;
4050
+ ch = state.input.charCodeAt(state.position);
4051
+ if (ch !== 38)
4052
+ return false;
4053
+ if (state.anchor !== null) {
4054
+ throwError(state, "duplication of an anchor property");
4055
+ }
4056
+ ch = state.input.charCodeAt(++state.position);
4057
+ _position = state.position;
4058
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
4059
+ ch = state.input.charCodeAt(++state.position);
4060
+ }
4061
+ if (state.position === _position) {
4062
+ throwError(state, "name of an anchor node must contain at least one character");
4063
+ }
4064
+ state.anchor = state.input.slice(_position, state.position);
4065
+ return true;
4066
+ }
4067
+ function readAlias(state) {
4068
+ var _position, alias, ch;
4069
+ ch = state.input.charCodeAt(state.position);
4070
+ if (ch !== 42)
4071
+ return false;
4072
+ ch = state.input.charCodeAt(++state.position);
4073
+ _position = state.position;
4074
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
4075
+ ch = state.input.charCodeAt(++state.position);
4076
+ }
4077
+ if (state.position === _position) {
4078
+ throwError(state, "name of an alias node must contain at least one character");
4079
+ }
4080
+ alias = state.input.slice(_position, state.position);
4081
+ if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
4082
+ throwError(state, 'unidentified alias "' + alias + '"');
4083
+ }
4084
+ state.result = state.anchorMap[alias];
4085
+ skipSeparationSpace(state, true, -1);
4086
+ return true;
4087
+ }
4088
+ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
4089
+ var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
4090
+ if (state.listener !== null) {
4091
+ state.listener("open", state);
4092
+ }
4093
+ state.tag = null;
4094
+ state.anchor = null;
4095
+ state.kind = null;
4096
+ state.result = null;
4097
+ allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
4098
+ if (allowToSeek) {
4099
+ if (skipSeparationSpace(state, true, -1)) {
4100
+ atNewLine = true;
4101
+ if (state.lineIndent > parentIndent) {
4102
+ indentStatus = 1;
4103
+ } else if (state.lineIndent === parentIndent) {
4104
+ indentStatus = 0;
4105
+ } else if (state.lineIndent < parentIndent) {
4106
+ indentStatus = -1;
4107
+ }
4108
+ }
4109
+ }
4110
+ if (indentStatus === 1) {
4111
+ while (readTagProperty(state) || readAnchorProperty(state)) {
4112
+ if (skipSeparationSpace(state, true, -1)) {
4113
+ atNewLine = true;
4114
+ allowBlockCollections = allowBlockStyles;
4115
+ if (state.lineIndent > parentIndent) {
4116
+ indentStatus = 1;
4117
+ } else if (state.lineIndent === parentIndent) {
4118
+ indentStatus = 0;
4119
+ } else if (state.lineIndent < parentIndent) {
4120
+ indentStatus = -1;
4121
+ }
4122
+ } else {
4123
+ allowBlockCollections = false;
4124
+ }
4125
+ }
4126
+ }
4127
+ if (allowBlockCollections) {
4128
+ allowBlockCollections = atNewLine || allowCompact;
4129
+ }
4130
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
4131
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
4132
+ flowIndent = parentIndent;
4133
+ } else {
4134
+ flowIndent = parentIndent + 1;
4135
+ }
4136
+ blockIndent = state.position - state.lineStart;
4137
+ if (indentStatus === 1) {
4138
+ if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
4139
+ hasContent = true;
4140
+ } else {
4141
+ if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
4142
+ hasContent = true;
4143
+ } else if (readAlias(state)) {
4144
+ hasContent = true;
4145
+ if (state.tag !== null || state.anchor !== null) {
4146
+ throwError(state, "alias node should not have any properties");
4147
+ }
4148
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
4149
+ hasContent = true;
4150
+ if (state.tag === null) {
4151
+ state.tag = "?";
4152
+ }
4153
+ }
4154
+ if (state.anchor !== null) {
4155
+ state.anchorMap[state.anchor] = state.result;
4156
+ }
4157
+ }
4158
+ } else if (indentStatus === 0) {
4159
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
4160
+ }
4161
+ }
4162
+ if (state.tag === null) {
4163
+ if (state.anchor !== null) {
4164
+ state.anchorMap[state.anchor] = state.result;
4165
+ }
4166
+ } else if (state.tag === "?") {
4167
+ if (state.result !== null && state.kind !== "scalar") {
4168
+ throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
4169
+ }
4170
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
4171
+ type2 = state.implicitTypes[typeIndex];
4172
+ if (type2.resolve(state.result)) {
4173
+ state.result = type2.construct(state.result);
4174
+ state.tag = type2.tag;
4175
+ if (state.anchor !== null) {
4176
+ state.anchorMap[state.anchor] = state.result;
4177
+ }
4178
+ break;
4179
+ }
4180
+ }
4181
+ } else if (state.tag !== "!") {
4182
+ if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
4183
+ type2 = state.typeMap[state.kind || "fallback"][state.tag];
4184
+ } else {
4185
+ type2 = null;
4186
+ typeList = state.typeMap.multi[state.kind || "fallback"];
4187
+ for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
4188
+ if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
4189
+ type2 = typeList[typeIndex];
4190
+ break;
4191
+ }
4192
+ }
4193
+ }
4194
+ if (!type2) {
4195
+ throwError(state, "unknown tag !<" + state.tag + ">");
4196
+ }
4197
+ if (state.result !== null && type2.kind !== state.kind) {
4198
+ throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
4199
+ }
4200
+ if (!type2.resolve(state.result, state.tag)) {
4201
+ throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
4202
+ } else {
4203
+ state.result = type2.construct(state.result, state.tag);
4204
+ if (state.anchor !== null) {
4205
+ state.anchorMap[state.anchor] = state.result;
4206
+ }
4207
+ }
4208
+ }
4209
+ if (state.listener !== null) {
4210
+ state.listener("close", state);
4211
+ }
4212
+ return state.tag !== null || state.anchor !== null || hasContent;
4213
+ }
4214
+ function readDocument(state) {
4215
+ var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
4216
+ state.version = null;
4217
+ state.checkLineBreaks = state.legacy;
4218
+ state.tagMap = Object.create(null);
4219
+ state.anchorMap = Object.create(null);
4220
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
4221
+ skipSeparationSpace(state, true, -1);
4222
+ ch = state.input.charCodeAt(state.position);
4223
+ if (state.lineIndent > 0 || ch !== 37) {
4224
+ break;
4225
+ }
4226
+ hasDirectives = true;
4227
+ ch = state.input.charCodeAt(++state.position);
4228
+ _position = state.position;
4229
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
4230
+ ch = state.input.charCodeAt(++state.position);
4231
+ }
4232
+ directiveName = state.input.slice(_position, state.position);
4233
+ directiveArgs = [];
4234
+ if (directiveName.length < 1) {
4235
+ throwError(state, "directive name must not be less than one character in length");
4236
+ }
4237
+ while (ch !== 0) {
4238
+ while (is_WHITE_SPACE(ch)) {
4239
+ ch = state.input.charCodeAt(++state.position);
4240
+ }
4241
+ if (ch === 35) {
4242
+ do {
4243
+ ch = state.input.charCodeAt(++state.position);
4244
+ } while (ch !== 0 && !is_EOL(ch));
4245
+ break;
4246
+ }
4247
+ if (is_EOL(ch))
4248
+ break;
4249
+ _position = state.position;
4250
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
4251
+ ch = state.input.charCodeAt(++state.position);
4252
+ }
4253
+ directiveArgs.push(state.input.slice(_position, state.position));
4254
+ }
4255
+ if (ch !== 0)
4256
+ readLineBreak(state);
4257
+ if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
4258
+ directiveHandlers[directiveName](state, directiveName, directiveArgs);
4259
+ } else {
4260
+ throwWarning(state, 'unknown document directive "' + directiveName + '"');
4261
+ }
4262
+ }
4263
+ skipSeparationSpace(state, true, -1);
4264
+ if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
4265
+ state.position += 3;
4266
+ skipSeparationSpace(state, true, -1);
4267
+ } else if (hasDirectives) {
4268
+ throwError(state, "directives end mark is expected");
4269
+ }
4270
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
4271
+ skipSeparationSpace(state, true, -1);
4272
+ if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
4273
+ throwWarning(state, "non-ASCII line breaks are interpreted as content");
4274
+ }
4275
+ state.documents.push(state.result);
4276
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
4277
+ if (state.input.charCodeAt(state.position) === 46) {
4278
+ state.position += 3;
4279
+ skipSeparationSpace(state, true, -1);
4280
+ }
4281
+ return;
4282
+ }
4283
+ if (state.position < state.length - 1) {
4284
+ throwError(state, "end of the stream or a document separator is expected");
4285
+ } else {
4286
+ return;
4287
+ }
4288
+ }
4289
+ function loadDocuments(input, options) {
4290
+ input = String(input);
4291
+ options = options || {};
4292
+ if (input.length !== 0) {
4293
+ if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
4294
+ input += "\n";
4295
+ }
4296
+ if (input.charCodeAt(0) === 65279) {
4297
+ input = input.slice(1);
4298
+ }
4299
+ }
4300
+ var state = new State$1(input, options);
4301
+ var nullpos = input.indexOf("\0");
4302
+ if (nullpos !== -1) {
4303
+ state.position = nullpos;
4304
+ throwError(state, "null byte is not allowed in input");
4305
+ }
4306
+ state.input += "\0";
4307
+ while (state.input.charCodeAt(state.position) === 32) {
4308
+ state.lineIndent += 1;
4309
+ state.position += 1;
4310
+ }
4311
+ while (state.position < state.length - 1) {
4312
+ readDocument(state);
4313
+ }
4314
+ return state.documents;
4315
+ }
4316
+ function loadAll$1(input, iterator, options) {
4317
+ if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
4318
+ options = iterator;
4319
+ iterator = null;
4320
+ }
4321
+ var documents = loadDocuments(input, options);
4322
+ if (typeof iterator !== "function") {
4323
+ return documents;
4324
+ }
4325
+ for (var index = 0, length = documents.length; index < length; index += 1) {
4326
+ iterator(documents[index]);
4327
+ }
4328
+ }
4329
+ function load$1(input, options) {
4330
+ var documents = loadDocuments(input, options);
4331
+ if (documents.length === 0) {
4332
+ return void 0;
4333
+ } else if (documents.length === 1) {
4334
+ return documents[0];
4335
+ }
4336
+ throw new exception("expected a single document in the stream, but found more");
4337
+ }
4338
+ var loadAll_1 = loadAll$1;
4339
+ var load_1 = load$1;
4340
+ var loader = {
4341
+ loadAll: loadAll_1,
4342
+ load: load_1
4343
+ };
4344
+ var _toString = Object.prototype.toString;
4345
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
4346
+ var CHAR_BOM = 65279;
4347
+ var CHAR_TAB = 9;
4348
+ var CHAR_LINE_FEED = 10;
4349
+ var CHAR_CARRIAGE_RETURN = 13;
4350
+ var CHAR_SPACE = 32;
4351
+ var CHAR_EXCLAMATION = 33;
4352
+ var CHAR_DOUBLE_QUOTE = 34;
4353
+ var CHAR_SHARP = 35;
4354
+ var CHAR_PERCENT = 37;
4355
+ var CHAR_AMPERSAND = 38;
4356
+ var CHAR_SINGLE_QUOTE = 39;
4357
+ var CHAR_ASTERISK = 42;
4358
+ var CHAR_COMMA = 44;
4359
+ var CHAR_MINUS = 45;
4360
+ var CHAR_COLON = 58;
4361
+ var CHAR_EQUALS = 61;
4362
+ var CHAR_GREATER_THAN = 62;
4363
+ var CHAR_QUESTION = 63;
4364
+ var CHAR_COMMERCIAL_AT = 64;
4365
+ var CHAR_LEFT_SQUARE_BRACKET = 91;
4366
+ var CHAR_RIGHT_SQUARE_BRACKET = 93;
4367
+ var CHAR_GRAVE_ACCENT = 96;
4368
+ var CHAR_LEFT_CURLY_BRACKET = 123;
4369
+ var CHAR_VERTICAL_LINE = 124;
4370
+ var CHAR_RIGHT_CURLY_BRACKET = 125;
4371
+ var ESCAPE_SEQUENCES = {};
4372
+ ESCAPE_SEQUENCES[0] = "\\0";
4373
+ ESCAPE_SEQUENCES[7] = "\\a";
4374
+ ESCAPE_SEQUENCES[8] = "\\b";
4375
+ ESCAPE_SEQUENCES[9] = "\\t";
4376
+ ESCAPE_SEQUENCES[10] = "\\n";
4377
+ ESCAPE_SEQUENCES[11] = "\\v";
4378
+ ESCAPE_SEQUENCES[12] = "\\f";
4379
+ ESCAPE_SEQUENCES[13] = "\\r";
4380
+ ESCAPE_SEQUENCES[27] = "\\e";
4381
+ ESCAPE_SEQUENCES[34] = '\\"';
4382
+ ESCAPE_SEQUENCES[92] = "\\\\";
4383
+ ESCAPE_SEQUENCES[133] = "\\N";
4384
+ ESCAPE_SEQUENCES[160] = "\\_";
4385
+ ESCAPE_SEQUENCES[8232] = "\\L";
4386
+ ESCAPE_SEQUENCES[8233] = "\\P";
4387
+ var DEPRECATED_BOOLEANS_SYNTAX = [
4388
+ "y",
4389
+ "Y",
4390
+ "yes",
4391
+ "Yes",
4392
+ "YES",
4393
+ "on",
4394
+ "On",
4395
+ "ON",
4396
+ "n",
4397
+ "N",
4398
+ "no",
4399
+ "No",
4400
+ "NO",
4401
+ "off",
4402
+ "Off",
4403
+ "OFF"
4404
+ ];
4405
+ var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
4406
+ function compileStyleMap(schema2, map2) {
4407
+ var result, keys, index, length, tag, style, type2;
4408
+ if (map2 === null)
4409
+ return {};
4410
+ result = {};
4411
+ keys = Object.keys(map2);
4412
+ for (index = 0, length = keys.length; index < length; index += 1) {
4413
+ tag = keys[index];
4414
+ style = String(map2[tag]);
4415
+ if (tag.slice(0, 2) === "!!") {
4416
+ tag = "tag:yaml.org,2002:" + tag.slice(2);
4417
+ }
4418
+ type2 = schema2.compiledTypeMap["fallback"][tag];
4419
+ if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
4420
+ style = type2.styleAliases[style];
4421
+ }
4422
+ result[tag] = style;
4423
+ }
4424
+ return result;
4425
+ }
4426
+ function encodeHex(character) {
4427
+ var string, handle, length;
4428
+ string = character.toString(16).toUpperCase();
4429
+ if (character <= 255) {
4430
+ handle = "x";
4431
+ length = 2;
4432
+ } else if (character <= 65535) {
4433
+ handle = "u";
4434
+ length = 4;
4435
+ } else if (character <= 4294967295) {
4436
+ handle = "U";
4437
+ length = 8;
4438
+ } else {
4439
+ throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
4440
+ }
4441
+ return "\\" + handle + common.repeat("0", length - string.length) + string;
4442
+ }
4443
+ var QUOTING_TYPE_SINGLE = 1;
4444
+ var QUOTING_TYPE_DOUBLE = 2;
4445
+ function State(options) {
4446
+ this.schema = options["schema"] || _default;
4447
+ this.indent = Math.max(1, options["indent"] || 2);
4448
+ this.noArrayIndent = options["noArrayIndent"] || false;
4449
+ this.skipInvalid = options["skipInvalid"] || false;
4450
+ this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
4451
+ this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
4452
+ this.sortKeys = options["sortKeys"] || false;
4453
+ this.lineWidth = options["lineWidth"] || 80;
4454
+ this.noRefs = options["noRefs"] || false;
4455
+ this.noCompatMode = options["noCompatMode"] || false;
4456
+ this.condenseFlow = options["condenseFlow"] || false;
4457
+ this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
4458
+ this.forceQuotes = options["forceQuotes"] || false;
4459
+ this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
4460
+ this.implicitTypes = this.schema.compiledImplicit;
4461
+ this.explicitTypes = this.schema.compiledExplicit;
4462
+ this.tag = null;
4463
+ this.result = "";
4464
+ this.duplicates = [];
4465
+ this.usedDuplicates = null;
4466
+ }
4467
+ function indentString(string, spaces) {
4468
+ var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
4469
+ while (position < length) {
4470
+ next = string.indexOf("\n", position);
4471
+ if (next === -1) {
4472
+ line = string.slice(position);
4473
+ position = length;
4474
+ } else {
4475
+ line = string.slice(position, next + 1);
4476
+ position = next + 1;
4477
+ }
4478
+ if (line.length && line !== "\n")
4479
+ result += ind;
4480
+ result += line;
4481
+ }
4482
+ return result;
4483
+ }
4484
+ function generateNextLine(state, level) {
4485
+ return "\n" + common.repeat(" ", state.indent * level);
4486
+ }
4487
+ function testImplicitResolving(state, str2) {
4488
+ var index, length, type2;
4489
+ for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
4490
+ type2 = state.implicitTypes[index];
4491
+ if (type2.resolve(str2)) {
4492
+ return true;
4493
+ }
4494
+ }
4495
+ return false;
4496
+ }
4497
+ function isWhitespace(c) {
4498
+ return c === CHAR_SPACE || c === CHAR_TAB;
4499
+ }
4500
+ function isPrintable(c) {
4501
+ return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
4502
+ }
4503
+ function isNsCharOrWhitespace(c) {
4504
+ return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
4505
+ }
4506
+ function isPlainSafe(c, prev, inblock) {
4507
+ var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
4508
+ var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
4509
+ return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
4510
+ }
4511
+ function isPlainSafeFirst(c) {
4512
+ return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
4513
+ }
4514
+ function isPlainSafeLast(c) {
4515
+ return !isWhitespace(c) && c !== CHAR_COLON;
4516
+ }
4517
+ function codePointAt(string, pos) {
4518
+ var first = string.charCodeAt(pos), second;
4519
+ if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
4520
+ second = string.charCodeAt(pos + 1);
4521
+ if (second >= 56320 && second <= 57343) {
4522
+ return (first - 55296) * 1024 + second - 56320 + 65536;
4523
+ }
4524
+ }
4525
+ return first;
4526
+ }
4527
+ function needIndentIndicator(string) {
4528
+ var leadingSpaceRe = /^\n* /;
4529
+ return leadingSpaceRe.test(string);
4530
+ }
4531
+ var STYLE_PLAIN = 1;
4532
+ var STYLE_SINGLE = 2;
4533
+ var STYLE_LITERAL = 3;
4534
+ var STYLE_FOLDED = 4;
4535
+ var STYLE_DOUBLE = 5;
4536
+ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
4537
+ var i;
4538
+ var char = 0;
4539
+ var prevChar = null;
4540
+ var hasLineBreak = false;
4541
+ var hasFoldableLine = false;
4542
+ var shouldTrackWidth = lineWidth !== -1;
4543
+ var previousLineBreak = -1;
4544
+ var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
4545
+ if (singleLineOnly || forceQuotes) {
4546
+ for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
4547
+ char = codePointAt(string, i);
4548
+ if (!isPrintable(char)) {
4549
+ return STYLE_DOUBLE;
4550
+ }
4551
+ plain = plain && isPlainSafe(char, prevChar, inblock);
4552
+ prevChar = char;
4553
+ }
4554
+ } else {
4555
+ for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
4556
+ char = codePointAt(string, i);
4557
+ if (char === CHAR_LINE_FEED) {
4558
+ hasLineBreak = true;
4559
+ if (shouldTrackWidth) {
4560
+ hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
4561
+ previousLineBreak = i;
4562
+ }
4563
+ } else if (!isPrintable(char)) {
4564
+ return STYLE_DOUBLE;
4565
+ }
4566
+ plain = plain && isPlainSafe(char, prevChar, inblock);
4567
+ prevChar = char;
4568
+ }
4569
+ hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
4570
+ }
4571
+ if (!hasLineBreak && !hasFoldableLine) {
4572
+ if (plain && !forceQuotes && !testAmbiguousType(string)) {
4573
+ return STYLE_PLAIN;
4574
+ }
4575
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
4576
+ }
4577
+ if (indentPerLevel > 9 && needIndentIndicator(string)) {
4578
+ return STYLE_DOUBLE;
4579
+ }
4580
+ if (!forceQuotes) {
4581
+ return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
4582
+ }
4583
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
4584
+ }
4585
+ function writeScalar(state, string, level, iskey, inblock) {
4586
+ state.dump = function() {
4587
+ if (string.length === 0) {
4588
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
4589
+ }
4590
+ if (!state.noCompatMode) {
4591
+ if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
4592
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
4593
+ }
4594
+ }
4595
+ var indent = state.indent * Math.max(1, level);
4596
+ var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
4597
+ var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
4598
+ function testAmbiguity(string2) {
4599
+ return testImplicitResolving(state, string2);
4600
+ }
4601
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
4602
+ case STYLE_PLAIN:
4603
+ return string;
4604
+ case STYLE_SINGLE:
4605
+ return "'" + string.replace(/'/g, "''") + "'";
4606
+ case STYLE_LITERAL:
4607
+ return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
4608
+ case STYLE_FOLDED:
4609
+ return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
4610
+ case STYLE_DOUBLE:
4611
+ return '"' + escapeString(string) + '"';
4612
+ default:
4613
+ throw new exception("impossible error: invalid scalar style");
4614
+ }
4615
+ }();
4616
+ }
4617
+ function blockHeader(string, indentPerLevel) {
4618
+ var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
4619
+ var clip = string[string.length - 1] === "\n";
4620
+ var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
4621
+ var chomp = keep ? "+" : clip ? "" : "-";
4622
+ return indentIndicator + chomp + "\n";
4623
+ }
4624
+ function dropEndingNewline(string) {
4625
+ return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
4626
+ }
4627
+ function foldString(string, width) {
4628
+ var lineRe = /(\n+)([^\n]*)/g;
4629
+ var result = function() {
4630
+ var nextLF = string.indexOf("\n");
4631
+ nextLF = nextLF !== -1 ? nextLF : string.length;
4632
+ lineRe.lastIndex = nextLF;
4633
+ return foldLine(string.slice(0, nextLF), width);
4634
+ }();
4635
+ var prevMoreIndented = string[0] === "\n" || string[0] === " ";
4636
+ var moreIndented;
4637
+ var match;
4638
+ while (match = lineRe.exec(string)) {
4639
+ var prefix = match[1], line = match[2];
4640
+ moreIndented = line[0] === " ";
4641
+ result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
4642
+ prevMoreIndented = moreIndented;
4643
+ }
4644
+ return result;
4645
+ }
4646
+ function foldLine(line, width) {
4647
+ if (line === "" || line[0] === " ")
4648
+ return line;
4649
+ var breakRe = / [^ ]/g;
4650
+ var match;
4651
+ var start = 0, end, curr = 0, next = 0;
4652
+ var result = "";
4653
+ while (match = breakRe.exec(line)) {
4654
+ next = match.index;
4655
+ if (next - start > width) {
4656
+ end = curr > start ? curr : next;
4657
+ result += "\n" + line.slice(start, end);
4658
+ start = end + 1;
4659
+ }
4660
+ curr = next;
4661
+ }
4662
+ result += "\n";
4663
+ if (line.length - start > width && curr > start) {
4664
+ result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
4665
+ } else {
4666
+ result += line.slice(start);
4667
+ }
4668
+ return result.slice(1);
4669
+ }
4670
+ function escapeString(string) {
4671
+ var result = "";
4672
+ var char = 0;
4673
+ var escapeSeq;
4674
+ for (var i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
4675
+ char = codePointAt(string, i);
4676
+ escapeSeq = ESCAPE_SEQUENCES[char];
4677
+ if (!escapeSeq && isPrintable(char)) {
4678
+ result += string[i];
4679
+ if (char >= 65536)
4680
+ result += string[i + 1];
4681
+ } else {
4682
+ result += escapeSeq || encodeHex(char);
4683
+ }
4684
+ }
4685
+ return result;
4686
+ }
4687
+ function writeFlowSequence(state, level, object) {
4688
+ var _result = "", _tag = state.tag, index, length, value;
4689
+ for (index = 0, length = object.length; index < length; index += 1) {
4690
+ value = object[index];
4691
+ if (state.replacer) {
4692
+ value = state.replacer.call(object, String(index), value);
4693
+ }
4694
+ if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
4695
+ if (_result !== "")
4696
+ _result += "," + (!state.condenseFlow ? " " : "");
4697
+ _result += state.dump;
4698
+ }
4699
+ }
4700
+ state.tag = _tag;
4701
+ state.dump = "[" + _result + "]";
4702
+ }
4703
+ function writeBlockSequence(state, level, object, compact) {
4704
+ var _result = "", _tag = state.tag, index, length, value;
4705
+ for (index = 0, length = object.length; index < length; index += 1) {
4706
+ value = object[index];
4707
+ if (state.replacer) {
4708
+ value = state.replacer.call(object, String(index), value);
4709
+ }
4710
+ if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
4711
+ if (!compact || _result !== "") {
4712
+ _result += generateNextLine(state, level);
4713
+ }
4714
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
4715
+ _result += "-";
4716
+ } else {
4717
+ _result += "- ";
4718
+ }
4719
+ _result += state.dump;
4720
+ }
4721
+ }
4722
+ state.tag = _tag;
4723
+ state.dump = _result || "[]";
4724
+ }
4725
+ function writeFlowMapping(state, level, object) {
4726
+ var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
4727
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
4728
+ pairBuffer = "";
4729
+ if (_result !== "")
4730
+ pairBuffer += ", ";
4731
+ if (state.condenseFlow)
4732
+ pairBuffer += '"';
4733
+ objectKey = objectKeyList[index];
4734
+ objectValue = object[objectKey];
4735
+ if (state.replacer) {
4736
+ objectValue = state.replacer.call(object, objectKey, objectValue);
4737
+ }
4738
+ if (!writeNode(state, level, objectKey, false, false)) {
4739
+ continue;
4740
+ }
4741
+ if (state.dump.length > 1024)
4742
+ pairBuffer += "? ";
4743
+ pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
4744
+ if (!writeNode(state, level, objectValue, false, false)) {
4745
+ continue;
4746
+ }
4747
+ pairBuffer += state.dump;
4748
+ _result += pairBuffer;
4749
+ }
4750
+ state.tag = _tag;
4751
+ state.dump = "{" + _result + "}";
4752
+ }
4753
+ function writeBlockMapping(state, level, object, compact) {
4754
+ var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
4755
+ if (state.sortKeys === true) {
4756
+ objectKeyList.sort();
4757
+ } else if (typeof state.sortKeys === "function") {
4758
+ objectKeyList.sort(state.sortKeys);
4759
+ } else if (state.sortKeys) {
4760
+ throw new exception("sortKeys must be a boolean or a function");
4761
+ }
4762
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
4763
+ pairBuffer = "";
4764
+ if (!compact || _result !== "") {
4765
+ pairBuffer += generateNextLine(state, level);
4766
+ }
4767
+ objectKey = objectKeyList[index];
4768
+ objectValue = object[objectKey];
4769
+ if (state.replacer) {
4770
+ objectValue = state.replacer.call(object, objectKey, objectValue);
4771
+ }
4772
+ if (!writeNode(state, level + 1, objectKey, true, true, true)) {
4773
+ continue;
4774
+ }
4775
+ explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
4776
+ if (explicitPair) {
4777
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
4778
+ pairBuffer += "?";
4779
+ } else {
4780
+ pairBuffer += "? ";
4781
+ }
4782
+ }
4783
+ pairBuffer += state.dump;
4784
+ if (explicitPair) {
4785
+ pairBuffer += generateNextLine(state, level);
4786
+ }
4787
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
4788
+ continue;
4789
+ }
4790
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
4791
+ pairBuffer += ":";
4792
+ } else {
4793
+ pairBuffer += ": ";
4794
+ }
4795
+ pairBuffer += state.dump;
4796
+ _result += pairBuffer;
4797
+ }
4798
+ state.tag = _tag;
4799
+ state.dump = _result || "{}";
4800
+ }
4801
+ function detectType(state, object, explicit) {
4802
+ var _result, typeList, index, length, type2, style;
4803
+ typeList = explicit ? state.explicitTypes : state.implicitTypes;
4804
+ for (index = 0, length = typeList.length; index < length; index += 1) {
4805
+ type2 = typeList[index];
4806
+ if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
4807
+ if (explicit) {
4808
+ if (type2.multi && type2.representName) {
4809
+ state.tag = type2.representName(object);
4810
+ } else {
4811
+ state.tag = type2.tag;
4812
+ }
4813
+ } else {
4814
+ state.tag = "?";
4815
+ }
4816
+ if (type2.represent) {
4817
+ style = state.styleMap[type2.tag] || type2.defaultStyle;
4818
+ if (_toString.call(type2.represent) === "[object Function]") {
4819
+ _result = type2.represent(object, style);
4820
+ } else if (_hasOwnProperty.call(type2.represent, style)) {
4821
+ _result = type2.represent[style](object, style);
4822
+ } else {
4823
+ throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
4824
+ }
4825
+ state.dump = _result;
4826
+ }
4827
+ return true;
4828
+ }
4829
+ }
4830
+ return false;
4831
+ }
4832
+ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
4833
+ state.tag = null;
4834
+ state.dump = object;
4835
+ if (!detectType(state, object, false)) {
4836
+ detectType(state, object, true);
4837
+ }
4838
+ var type2 = _toString.call(state.dump);
4839
+ var inblock = block;
4840
+ var tagStr;
4841
+ if (block) {
4842
+ block = state.flowLevel < 0 || state.flowLevel > level;
4843
+ }
4844
+ var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
4845
+ if (objectOrArray) {
4846
+ duplicateIndex = state.duplicates.indexOf(object);
4847
+ duplicate = duplicateIndex !== -1;
4848
+ }
4849
+ if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
4850
+ compact = false;
4851
+ }
4852
+ if (duplicate && state.usedDuplicates[duplicateIndex]) {
4853
+ state.dump = "*ref_" + duplicateIndex;
4854
+ } else {
4855
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
4856
+ state.usedDuplicates[duplicateIndex] = true;
4857
+ }
4858
+ if (type2 === "[object Object]") {
4859
+ if (block && Object.keys(state.dump).length !== 0) {
4860
+ writeBlockMapping(state, level, state.dump, compact);
4861
+ if (duplicate) {
4862
+ state.dump = "&ref_" + duplicateIndex + state.dump;
4863
+ }
4864
+ } else {
4865
+ writeFlowMapping(state, level, state.dump);
4866
+ if (duplicate) {
4867
+ state.dump = "&ref_" + duplicateIndex + " " + state.dump;
4868
+ }
4869
+ }
4870
+ } else if (type2 === "[object Array]") {
4871
+ if (block && state.dump.length !== 0) {
4872
+ if (state.noArrayIndent && !isblockseq && level > 0) {
4873
+ writeBlockSequence(state, level - 1, state.dump, compact);
4874
+ } else {
4875
+ writeBlockSequence(state, level, state.dump, compact);
4876
+ }
4877
+ if (duplicate) {
4878
+ state.dump = "&ref_" + duplicateIndex + state.dump;
4879
+ }
4880
+ } else {
4881
+ writeFlowSequence(state, level, state.dump);
4882
+ if (duplicate) {
4883
+ state.dump = "&ref_" + duplicateIndex + " " + state.dump;
4884
+ }
4885
+ }
4886
+ } else if (type2 === "[object String]") {
4887
+ if (state.tag !== "?") {
4888
+ writeScalar(state, state.dump, level, iskey, inblock);
4889
+ }
4890
+ } else if (type2 === "[object Undefined]") {
4891
+ return false;
4892
+ } else {
4893
+ if (state.skipInvalid)
4894
+ return false;
4895
+ throw new exception("unacceptable kind of an object to dump " + type2);
4896
+ }
4897
+ if (state.tag !== null && state.tag !== "?") {
4898
+ tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
4899
+ if (state.tag[0] === "!") {
4900
+ tagStr = "!" + tagStr;
4901
+ } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
4902
+ tagStr = "!!" + tagStr.slice(18);
4903
+ } else {
4904
+ tagStr = "!<" + tagStr + ">";
4905
+ }
4906
+ state.dump = tagStr + " " + state.dump;
4907
+ }
4908
+ }
4909
+ return true;
4910
+ }
4911
+ function getDuplicateReferences(object, state) {
4912
+ var objects = [], duplicatesIndexes = [], index, length;
4913
+ inspectNode(object, objects, duplicatesIndexes);
4914
+ for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
4915
+ state.duplicates.push(objects[duplicatesIndexes[index]]);
4916
+ }
4917
+ state.usedDuplicates = new Array(length);
4918
+ }
4919
+ function inspectNode(object, objects, duplicatesIndexes) {
4920
+ var objectKeyList, index, length;
4921
+ if (object !== null && typeof object === "object") {
4922
+ index = objects.indexOf(object);
4923
+ if (index !== -1) {
4924
+ if (duplicatesIndexes.indexOf(index) === -1) {
4925
+ duplicatesIndexes.push(index);
4926
+ }
4927
+ } else {
4928
+ objects.push(object);
4929
+ if (Array.isArray(object)) {
4930
+ for (index = 0, length = object.length; index < length; index += 1) {
4931
+ inspectNode(object[index], objects, duplicatesIndexes);
4932
+ }
4933
+ } else {
4934
+ objectKeyList = Object.keys(object);
4935
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
4936
+ inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
4937
+ }
4938
+ }
4939
+ }
4940
+ }
4941
+ }
4942
+ function dump$1(input, options) {
4943
+ options = options || {};
4944
+ var state = new State(options);
4945
+ if (!state.noRefs)
4946
+ getDuplicateReferences(input, state);
4947
+ var value = input;
4948
+ if (state.replacer) {
4949
+ value = state.replacer.call({ "": value }, "", value);
4950
+ }
4951
+ if (writeNode(state, 0, value, true, true))
4952
+ return state.dump + "\n";
4953
+ return "";
4954
+ }
4955
+ var dump_1 = dump$1;
4956
+ var dumper = {
4957
+ dump: dump_1
4958
+ };
4959
+ function renamed(from, to) {
4960
+ return function() {
4961
+ throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
4962
+ };
4963
+ }
4964
+ var Type = type;
4965
+ var Schema = schema;
4966
+ var FAILSAFE_SCHEMA = failsafe;
4967
+ var JSON_SCHEMA = json;
4968
+ var CORE_SCHEMA = core;
4969
+ var DEFAULT_SCHEMA = _default;
4970
+ var load = loader.load;
4971
+ var loadAll = loader.loadAll;
4972
+ var dump = dumper.dump;
4973
+ var YAMLException = exception;
4974
+ var types = {
4975
+ binary,
4976
+ float,
4977
+ map,
4978
+ null: _null,
4979
+ pairs,
4980
+ set,
4981
+ timestamp,
4982
+ bool,
4983
+ int,
4984
+ merge,
4985
+ omap,
4986
+ seq,
4987
+ str
4988
+ };
4989
+ var safeLoad = renamed("safeLoad", "load");
4990
+ var safeLoadAll = renamed("safeLoadAll", "loadAll");
4991
+ var safeDump = renamed("safeDump", "dump");
4992
+ var jsYaml = {
4993
+ Type,
4994
+ Schema,
4995
+ FAILSAFE_SCHEMA,
4996
+ JSON_SCHEMA,
4997
+ CORE_SCHEMA,
4998
+ DEFAULT_SCHEMA,
4999
+ load,
5000
+ loadAll,
5001
+ dump,
5002
+ YAMLException,
5003
+ types,
5004
+ safeLoad,
5005
+ safeLoadAll,
5006
+ safeDump
5007
+ };
5008
+ var js_yaml_default = jsYaml;
5009
+
5010
+ // ../parser/src/core.ts
5011
+ import { isObject as isObject2, isTruthy, objectMap } from "@antfu/utils";
5012
+
5013
+ // ../parser/src/config.ts
5014
+ init_esm_shims();
5015
+ import { toArray as toArray2, uniq as uniq2 } from "@antfu/utils";
5016
+
5017
+ // ../parser/src/utils.ts
5018
+ init_esm_shims();
5019
+ import { isNumber, range, uniq } from "@antfu/utils";
5020
+ function parseRangeString(total, rangeStr) {
5021
+ if (!rangeStr || rangeStr === "all" || rangeStr === "*")
5022
+ return range(1, total + 1);
5023
+ const pages = [];
5024
+ for (const part of rangeStr.split(/[,;]/g)) {
5025
+ if (!part.includes("-")) {
5026
+ pages.push(+part);
5027
+ } else {
5028
+ const [start, end] = part.split("-", 2);
5029
+ pages.push(...range(+start, !end ? total + 1 : +end + 1));
5030
+ }
5031
+ }
5032
+ return uniq(pages).filter((i) => i <= total).sort((a, b) => a - b);
5033
+ }
5034
+ function parseAspectRatio(str2) {
5035
+ if (isNumber(str2))
5036
+ return str2;
5037
+ if (!isNaN(+str2))
5038
+ return +str2;
5039
+ const [wStr = "", hStr = ""] = str2.split(/[:\/x\|]/);
5040
+ const w = parseFloat(wStr.trim());
5041
+ const h = parseFloat(hStr.trim());
5042
+ if (isNaN(w) || isNaN(h) || h === 0)
5043
+ throw new Error(`Invalid aspect ratio "${str2}"`);
5044
+ return w / h;
5045
+ }
5046
+
5047
+ // ../parser/src/config.ts
5048
+ function resolveConfig(headmatter, themeMeta = {}) {
5049
+ var _a, _b;
5050
+ const themeHightlighter = ["prism", "shiki"].includes(themeMeta.highlighter || "") ? themeMeta.highlighter : void 0;
5051
+ const themeColorSchema = ["light", "dark"].includes(themeMeta.colorSchema || "") ? themeMeta.colorSchema : void 0;
5052
+ const defaultConfig2 = {
5053
+ theme: "default",
5054
+ title: "Slidev",
5055
+ titleTemplate: "%s - Slidev",
5056
+ remoteAssets: false,
5057
+ monaco: "dev",
5058
+ download: false,
5059
+ info: false,
5060
+ highlighter: themeHightlighter || "prism",
5061
+ lineNumbers: false,
5062
+ colorSchema: themeColorSchema || "auto",
5063
+ routerMode: "history",
5064
+ aspectRatio: 16 / 9,
5065
+ canvasWidth: 980,
5066
+ selectable: false,
5067
+ themeConfig: {},
5068
+ fonts: {},
5069
+ favicon: "https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png",
5070
+ drawings: {},
5071
+ plantUmlServer: "https://www.plantuml.com/plantuml"
5072
+ };
5073
+ const config2 = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, defaultConfig2), themeMeta.defaults), headmatter.config), headmatter), {
5074
+ fonts: resolveFonts(__spreadValues(__spreadValues(__spreadValues({}, (_a = themeMeta.defaults) == null ? void 0 : _a.fonts), (_b = headmatter.config) == null ? void 0 : _b.fonts), headmatter == null ? void 0 : headmatter.fonts)),
5075
+ drawings: resolveDarwings(headmatter.drawings)
5076
+ });
5077
+ if (config2.colorSchema !== "dark" && config2.colorSchema !== "light")
5078
+ config2.colorSchema = "auto";
5079
+ if (themeColorSchema && config2.colorSchema === "auto")
5080
+ config2.colorSchema = themeColorSchema;
5081
+ config2.aspectRatio = parseAspectRatio(config2.aspectRatio);
5082
+ if (themeColorSchema && config2.colorSchema !== themeColorSchema)
5083
+ console.warn(`[slidev] Color schema "${config2.colorSchema}" does not supported by the theme`);
5084
+ if (themeHightlighter && config2.highlighter !== themeHightlighter)
5085
+ console.warn(`[slidev] Syntax highlighter "${config2.highlighter}" does not supported by the theme`);
5086
+ return config2;
5087
+ }
5088
+ function resolveFonts(fonts = {}) {
5089
+ const {
5090
+ fallbacks = true,
5091
+ italic = false,
5092
+ provider = "google"
5093
+ } = fonts;
5094
+ let sans = toArray2(fonts.sans).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
5095
+ let serif = toArray2(fonts.serif).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
5096
+ let mono = toArray2(fonts.mono).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
5097
+ const weights = toArray2(fonts.weights || "200,400,600").flatMap((i) => i.toString().split(/,\s*/g)).map((i) => i.trim());
5098
+ const custom = toArray2(fonts.custom).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
5099
+ const local = toArray2(fonts.local).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
5100
+ const webfonts = fonts.webfonts ? fonts.webfonts : fallbacks ? uniq2([...sans, ...serif, ...mono, ...custom]) : [];
5101
+ webfonts.filter((i) => local.includes(i));
5102
+ function toQuoted(font) {
5103
+ if (/^(['"]).*\1$/.test(font))
5104
+ return font;
5105
+ return `"${font}"`;
5106
+ }
5107
+ if (fallbacks) {
5108
+ sans = uniq2([
5109
+ ...sans.map(toQuoted),
5110
+ "ui-sans-serif",
5111
+ "system-ui",
5112
+ "-apple-system",
5113
+ "BlinkMacSystemFont",
5114
+ '"Segoe UI"',
5115
+ "Roboto",
5116
+ '"Helvetica Neue"',
5117
+ "Arial",
5118
+ '"Noto Sans"',
5119
+ "sans-serif",
5120
+ '"Apple Color Emoji"',
5121
+ '"Segoe UI Emoji"',
5122
+ '"Segoe UI Symbol"',
5123
+ '"Noto Color Emoji"'
5124
+ ]);
5125
+ serif = uniq2([
5126
+ ...serif.map(toQuoted),
5127
+ "ui-serif",
5128
+ "Georgia",
5129
+ "Cambria",
5130
+ '"Times New Roman"',
5131
+ "Times",
5132
+ "serif"
5133
+ ]);
5134
+ mono = uniq2([
5135
+ ...mono.map(toQuoted),
5136
+ "ui-monospace",
5137
+ "SFMono-Regular",
5138
+ "Menlo",
5139
+ "Monaco",
5140
+ "Consolas",
5141
+ '"Liberation Mono"',
5142
+ '"Courier New"',
5143
+ "monospace"
5144
+ ]);
5145
+ }
5146
+ return {
5147
+ sans,
5148
+ serif,
5149
+ mono,
5150
+ webfonts,
5151
+ provider,
5152
+ local,
5153
+ italic,
5154
+ weights
5155
+ };
5156
+ }
5157
+ function resolveDarwings(options = {}) {
5158
+ const {
5159
+ enabled = true,
5160
+ persist = false,
5161
+ presenterOnly = false,
5162
+ syncAll = true
5163
+ } = options;
5164
+ const persistPath = typeof persist === "string" ? persist : persist ? ".slidev/drawings" : false;
5165
+ return {
5166
+ enabled,
5167
+ persist: persistPath,
5168
+ presenterOnly,
5169
+ syncAll
5170
+ };
5171
+ }
5172
+
5173
+ // ../parser/src/core.ts
5174
+ function stringify(data) {
5175
+ return `${data.slides.map((slide, idx) => stringifySlide(slide.inline || slide, idx)).join("\n").trim()}
5176
+ `;
5177
+ }
5178
+ function filterDisabled(data) {
5179
+ data.slides = data.slides.filter((i) => {
5180
+ var _a;
5181
+ return !((_a = i.frontmatter) == null ? void 0 : _a.disabled);
5182
+ });
5183
+ return data;
5184
+ }
5185
+ function stringifySlide(data, idx = 0) {
5186
+ if (data.raw == null)
5187
+ prettifySlide(data);
5188
+ return data.raw.startsWith("---") || idx === 0 ? data.raw : `---
5189
+ ${data.raw.startsWith("\n") ? data.raw : `
5190
+ ${data.raw}`}`;
5191
+ }
5192
+ function prettifySlide(data) {
5193
+ data.content = `
5194
+ ${data.content.trim()}
5195
+ `;
5196
+ data.raw = Object.keys(data.frontmatter || {}).length ? `---
5197
+ ${js_yaml_default.dump(data.frontmatter).trim()}
5198
+ ---
5199
+ ${data.content}` : data.content;
5200
+ if (data.note)
5201
+ data.raw += `
5202
+ <!--
5203
+ ${data.note.trim()}
5204
+ -->
5205
+ `;
5206
+ else
5207
+ data.raw += "\n";
5208
+ return data;
5209
+ }
5210
+ function prettify(data) {
5211
+ data.slides.forEach(prettifySlide);
5212
+ return data;
5213
+ }
5214
+ function matter(code) {
5215
+ let data = {};
5216
+ const content = code.replace(/^---.*\r?\n([\s\S]*?)---/, (_, d) => {
5217
+ data = js_yaml_default.load(d);
5218
+ if (!isObject2(data))
5219
+ data = {};
5220
+ return "";
5221
+ });
5222
+ return { data, content };
5223
+ }
5224
+ function detectFeatures(code) {
5225
+ return {
5226
+ katex: !!code.match(/\$.*?\$/) || !!code.match(/$\$\$/),
5227
+ monaco: !!code.match(/{monaco.*}/),
5228
+ tweet: !!code.match(/<Tweet\b/),
5229
+ mermaid: !!code.match(/^```mermaid/m)
5230
+ };
5231
+ }
5232
+ function parseSlide(raw) {
5233
+ var _a, _b;
5234
+ const result = matter(raw);
5235
+ let note;
5236
+ const frontmatter = result.data || {};
5237
+ let content = result.content.trim();
5238
+ const comments = Array.from(content.matchAll(/<!--([\s\S]*?)-->/g));
5239
+ if (comments.length) {
5240
+ const last = comments[comments.length - 1];
5241
+ if (last.index && last.index + last[0].length >= content.length) {
5242
+ note = last[1].trim();
5243
+ content = content.slice(0, last.index).trim();
5244
+ }
5245
+ }
5246
+ let title;
5247
+ let level;
5248
+ if (frontmatter.title || frontmatter.name) {
5249
+ title = frontmatter.title || frontmatter.name;
5250
+ level = frontmatter.level || 1;
5251
+ } else {
5252
+ const match = content.match(/^(#+) (.*)$/m);
5253
+ title = (_a = match == null ? void 0 : match[2]) == null ? void 0 : _a.trim();
5254
+ level = (_b = match == null ? void 0 : match[1]) == null ? void 0 : _b.length;
5255
+ }
5256
+ return {
5257
+ raw,
5258
+ title,
5259
+ level,
5260
+ content,
5261
+ frontmatter,
5262
+ note
5263
+ };
5264
+ }
5265
+ function parse(markdown, filepath, themeMeta) {
5266
+ var _a, _b;
5267
+ const lines = markdown.split(/\r?\n/g);
5268
+ const slides = [];
5269
+ let start = 0;
5270
+ function slice(end) {
5271
+ if (start === end)
5272
+ return;
5273
+ const raw = lines.slice(start, end).join("\n");
5274
+ slides.push(__spreadProps(__spreadValues({}, parseSlide(raw)), {
5275
+ index: slides.length,
5276
+ start,
5277
+ end
5278
+ }));
5279
+ start = end + 1;
5280
+ }
5281
+ for (let i = 0; i < lines.length; i++) {
5282
+ const line = lines[i].trimEnd();
5283
+ if (line.match(/^---+/)) {
5284
+ slice(i);
5285
+ const next = lines[i + 1];
5286
+ if (line.match(/^---([^-].*)?$/) && !(next == null ? void 0 : next.match(/^\s*$/))) {
5287
+ start = i;
5288
+ for (i += 1; i < lines.length; i++) {
5289
+ if (lines[i].trimEnd().match(/^---$/))
5290
+ break;
5291
+ }
5292
+ }
5293
+ } else if (line.startsWith("```")) {
5294
+ for (i += 1; i < lines.length; i++) {
5295
+ if (lines[i].startsWith("```"))
5296
+ break;
5297
+ }
5298
+ }
5299
+ }
5300
+ if (start <= lines.length - 1)
5301
+ slice(lines.length);
5302
+ const headmatter = ((_a = slides[0]) == null ? void 0 : _a.frontmatter) || {};
5303
+ headmatter.title = headmatter.title || ((_b = slides[0]) == null ? void 0 : _b.title);
5304
+ const config2 = resolveConfig(headmatter, themeMeta);
5305
+ const features = detectFeatures(markdown);
5306
+ return {
5307
+ raw: markdown,
5308
+ filepath,
5309
+ slides,
5310
+ config: config2,
5311
+ features,
5312
+ headmatter,
5313
+ themeMeta
5314
+ };
5315
+ }
5316
+ function mergeFeatureFlags(a, b) {
5317
+ return objectMap(a, (k, v) => [k, v || b[k]]);
5318
+ }
5319
+ function scanMonacoModules(md) {
5320
+ const typeModules = /* @__PURE__ */ new Set();
5321
+ md.replace(/^```(\w+?)\s*{monaco([\w:,-]*)}[\s\n]*([\s\S]+?)^```/mg, (full, lang = "ts", options, code) => {
5322
+ options = options || "";
5323
+ lang = lang.trim();
5324
+ if (lang === "ts" || lang === "typescript") {
5325
+ Array.from(code.matchAll(/\s+from\s+(["'])([\/\w@-]+)\1/g)).map((i) => i[2]).filter(isTruthy).map((i) => typeModules.add(i));
5326
+ }
5327
+ return "";
5328
+ });
5329
+ return Array.from(typeModules);
5330
+ }
5331
+
5332
+ // ../parser/src/fs.ts
5333
+ async function load2(filepath, themeMeta, content) {
5334
+ const dir = dirname(filepath);
5335
+ const markdown = content != null ? content : await fs.readFile(filepath, "utf-8");
5336
+ const data = parse(markdown, filepath, themeMeta);
5337
+ const entries = /* @__PURE__ */ new Set([
5338
+ filepath
5339
+ ]);
5340
+ for (const slide of data.slides) {
5341
+ if (!slide.frontmatter.src)
5342
+ continue;
5343
+ const path3 = resolve(dir, slide.frontmatter.src);
5344
+ const raw = await fs.readFile(path3, "utf-8");
5345
+ const source = parseSlide(raw);
5346
+ const inline = __spreadValues({}, slide);
5347
+ slide.source = __spreadValues({
5348
+ filepath: path3
5349
+ }, source);
5350
+ slide.inline = inline;
5351
+ Object.assign(slide, slide.source);
5352
+ slide.frontmatter = __spreadValues(__spreadValues({}, slide.source.frontmatter), inline.frontmatter);
5353
+ data.features = mergeFeatureFlags(data.features, detectFeatures(raw));
5354
+ entries.add(path3);
5355
+ }
5356
+ data.entries = Array.from(entries);
5357
+ return data;
5358
+ }
5359
+ async function save(data, filepath) {
5360
+ filepath = filepath || data.filepath;
5361
+ await fs.writeFile(filepath, stringify(data), "utf-8");
5362
+ }
5363
+ async function saveExternalSlide(slide) {
5364
+ await fs.writeFile(slide.filepath, stringifySlide(slide), "utf-8");
5365
+ }
5366
+
5367
+ // node/parser.ts
5368
+ init_esm_shims();
5369
+
2327
5370
  // package.json
2328
- var version = "0.27.20";
5371
+ var version = "0.28.0";
2329
5372
 
2330
5373
  // node/themes.ts
2331
5374
  init_esm_shims();
@@ -2338,10 +5381,10 @@ init_esm_shims();
2338
5381
  init_esm_shims();
2339
5382
  import os from "os";
2340
5383
  import { execSync } from "child_process";
2341
- import fs from "fs";
5384
+ import fs2 from "fs";
2342
5385
  import path from "path";
2343
5386
  import path2 from "path";
2344
- import { resolve } from "path";
5387
+ import { resolve as resolve2 } from "path";
2345
5388
  var __create = Object.create;
2346
5389
  var __defProp = Object.defineProperty;
2347
5390
  var __defProps = Object.defineProperties;
@@ -2353,7 +5396,7 @@ var __getProtoOf = Object.getPrototypeOf;
2353
5396
  var __hasOwnProp = Object.prototype.hasOwnProperty;
2354
5397
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
2355
5398
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2356
- var __spreadValues = (a, b) => {
5399
+ var __spreadValues2 = (a, b) => {
2357
5400
  for (var prop in b || (b = {}))
2358
5401
  if (__hasOwnProp.call(b, prop))
2359
5402
  __defNormalProp(a, prop, b[prop]);
@@ -2364,7 +5407,7 @@ var __spreadValues = (a, b) => {
2364
5407
  }
2365
5408
  return a;
2366
5409
  };
2367
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
5410
+ var __spreadProps2 = (a, b) => __defProps(a, __getOwnPropDescs(b));
2368
5411
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
2369
5412
  var __require2 = (x) => {
2370
5413
  if (typeof __require !== "undefined")
@@ -2469,11 +5512,11 @@ var require_mode = __commonJS2({
2469
5512
  var require_isexe = __commonJS2({
2470
5513
  "node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
2471
5514
  var fs22 = __require2("fs");
2472
- var core;
5515
+ var core2;
2473
5516
  if (process.platform === "win32" || global.TESTING_WINDOWS) {
2474
- core = require_windows();
5517
+ core2 = require_windows();
2475
5518
  } else {
2476
- core = require_mode();
5519
+ core2 = require_mode();
2477
5520
  }
2478
5521
  module.exports = isexe;
2479
5522
  isexe.sync = sync;
@@ -2496,7 +5539,7 @@ var require_isexe = __commonJS2({
2496
5539
  });
2497
5540
  });
2498
5541
  }
2499
- core(path3, options || {}, function(er, is) {
5542
+ core2(path3, options || {}, function(er, is) {
2500
5543
  if (er) {
2501
5544
  if (er.code === "EACCES" || options && options.ignoreErrors) {
2502
5545
  er = null;
@@ -2508,7 +5551,7 @@ var require_isexe = __commonJS2({
2508
5551
  }
2509
5552
  function sync(path3, options) {
2510
5553
  try {
2511
- return core.sync(path3, options || {});
5554
+ return core2.sync(path3, options || {});
2512
5555
  } catch (er) {
2513
5556
  if (options && options.ignoreErrors || er.code === "EACCES") {
2514
5557
  return false;
@@ -2644,17 +5687,17 @@ var require_kleur = __commonJS2({
2644
5687
  bgCyan: init(46, 49),
2645
5688
  bgWhite: init(47, 49)
2646
5689
  };
2647
- function run2(arr, str) {
5690
+ function run2(arr, str2) {
2648
5691
  let i = 0, tmp, beg = "", end = "";
2649
5692
  for (; i < arr.length; i++) {
2650
5693
  tmp = arr[i];
2651
5694
  beg += tmp.open;
2652
5695
  end += tmp.close;
2653
- if (str.includes(tmp.close)) {
2654
- str = str.replace(tmp.rgx, tmp.close + tmp.open);
5696
+ if (str2.includes(tmp.close)) {
5697
+ str2 = str2.replace(tmp.rgx, tmp.close + tmp.open);
2655
5698
  }
2656
5699
  }
2657
- return beg + str + end;
5700
+ return beg + str2 + end;
2658
5701
  }
2659
5702
  function chain(has, keys) {
2660
5703
  let ctx = { has, keys };
@@ -2764,10 +5807,10 @@ var require_action = __commonJS2({
2764
5807
  var require_strip = __commonJS2({
2765
5808
  "node_modules/.pnpm/prompts@2.4.1/node_modules/prompts/dist/util/strip.js"(exports, module) {
2766
5809
  "use strict";
2767
- module.exports = (str) => {
5810
+ module.exports = (str2) => {
2768
5811
  const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");
2769
5812
  const RGX = new RegExp(pattern, "g");
2770
- return typeof str === "string" ? str.replace(RGX, "") : str;
5813
+ return typeof str2 === "string" ? str2.replace(RGX, "") : str2;
2771
5814
  };
2772
5815
  }
2773
5816
  });
@@ -2896,7 +5939,7 @@ var require_clear = __commonJS2({
2896
5939
  var _require = require_src();
2897
5940
  var erase = _require.erase;
2898
5941
  var cursor = _require.cursor;
2899
- var width = (str) => [...strip(str)].length;
5942
+ var width = (str2) => [...strip(str2)].length;
2900
5943
  module.exports = function(prompt, perLine) {
2901
5944
  if (!perLine)
2902
5945
  return erase.line + cursor.to(0);
@@ -2975,7 +6018,7 @@ var require_style = __commonJS2({
2975
6018
  render: (input) => `${input}`
2976
6019
  }
2977
6020
  });
2978
- var render = (type) => styles[type] || styles.default;
6021
+ var render = (type2) => styles[type2] || styles.default;
2979
6022
  var symbols = Object.freeze({
2980
6023
  aborted: c.red(figures.cross),
2981
6024
  done: c.green(figures.tick),
@@ -3080,10 +6123,10 @@ var require_prompt = __commonJS2({
3080
6123
  if (this.in.isTTY)
3081
6124
  this.in.setRawMode(true);
3082
6125
  const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
3083
- const keypress = (str, key) => {
6126
+ const keypress = (str2, key) => {
3084
6127
  let a = action(key, isSelect);
3085
6128
  if (a === false) {
3086
- this._ && this._(str, key);
6129
+ this._ && this._(str2, key);
3087
6130
  } else if (typeof this[a] === "function") {
3088
6131
  this[a](key);
3089
6132
  } else {
@@ -4120,7 +7163,7 @@ var require_number = __commonJS2({
4120
7163
  var figures = _require2.figures;
4121
7164
  var clear = _require2.clear;
4122
7165
  var lines = _require2.lines;
4123
- var isNumber = /[0-9]/;
7166
+ var isNumber2 = /[0-9]/;
4124
7167
  var isDef = (any) => any !== void 0;
4125
7168
  var round = (number, precision) => {
4126
7169
  let factor = Math.pow(10, precision);
@@ -4164,7 +7207,7 @@ var require_number = __commonJS2({
4164
7207
  return this.float ? parseFloat(x) : parseInt(x);
4165
7208
  }
4166
7209
  valid(c) {
4167
- return c === `-` || c === `.` && this.float || isNumber.test(c);
7210
+ return c === `-` || c === `.` && this.float || isNumber2.test(c);
4168
7211
  }
4169
7212
  reset() {
4170
7213
  this.typed = ``;
@@ -5055,9 +8098,9 @@ var require_prompts = __commonJS2({
5055
8098
  var $ = exports;
5056
8099
  var el = require_elements();
5057
8100
  var noop = (v) => v;
5058
- function toPrompt(type, args, opts = {}) {
8101
+ function toPrompt(type2, args, opts = {}) {
5059
8102
  return new Promise((res, rej) => {
5060
- const p = new el[type](args);
8103
+ const p = new el[type2](args);
5061
8104
  const onAbort = opts.onAbort || noop;
5062
8105
  const onSubmit = opts.onSubmit || noop;
5063
8106
  const onExit = opts.onExit || noop;
@@ -5082,7 +8125,7 @@ var require_prompts = __commonJS2({
5082
8125
  $.list = (args) => {
5083
8126
  const sep = args.separator || ",";
5084
8127
  return toPrompt("TextPrompt", args, {
5085
- onSubmit: (str) => str.split(sep).map((s) => s.trim())
8128
+ onSubmit: (str2) => str2.split(sep).map((s) => s.trim())
5086
8129
  });
5087
8130
  };
5088
8131
  $.toggle = (args) => toPrompt("TogglePrompt", args);
@@ -5254,7 +8297,7 @@ var require_dist = __commonJS2({
5254
8297
  const answers = {};
5255
8298
  const override2 = prompt._override || {};
5256
8299
  questions = [].concat(questions);
5257
- let answer, question, quit, name, type, lastPrompt;
8300
+ let answer, question, quit, name, type2, lastPrompt;
5258
8301
  const getFormattedAnswer = /* @__PURE__ */ function() {
5259
8302
  var _ref = _asyncToGenerator(function* (question2, answer2, skipValidation = false) {
5260
8303
  if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
@@ -5272,12 +8315,12 @@ var require_dist = __commonJS2({
5272
8315
  question = _step.value;
5273
8316
  var _question = question;
5274
8317
  name = _question.name;
5275
- type = _question.type;
5276
- if (typeof type === "function") {
5277
- type = yield type(answer, _objectSpread({}, answers), question);
5278
- question["type"] = type;
8318
+ type2 = _question.type;
8319
+ if (typeof type2 === "function") {
8320
+ type2 = yield type2(answer, _objectSpread({}, answers), question);
8321
+ question["type"] = type2;
5279
8322
  }
5280
- if (!type)
8323
+ if (!type2)
5281
8324
  continue;
5282
8325
  for (let key in question) {
5283
8326
  if (passOn.includes(key))
@@ -5291,9 +8334,9 @@ var require_dist = __commonJS2({
5291
8334
  }
5292
8335
  var _question2 = question;
5293
8336
  name = _question2.name;
5294
- type = _question2.type;
5295
- if (prompts3[type] === void 0) {
5296
- throw new Error(`prompt type (${type}) is not defined`);
8337
+ type2 = _question2.type;
8338
+ if (prompts3[type2] === void 0) {
8339
+ throw new Error(`prompt type (${type2}) is not defined`);
5297
8340
  }
5298
8341
  if (override2[question.name] !== void 0) {
5299
8342
  answer = yield getFormattedAnswer(question, override2[question.name]);
@@ -5303,7 +8346,7 @@ var require_dist = __commonJS2({
5303
8346
  }
5304
8347
  }
5305
8348
  try {
5306
- answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : yield prompts3[type](question);
8349
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : yield prompts3[type2](question);
5307
8350
  answers[name] = answer = yield getFormattedAnswer(question, answer, true);
5308
8351
  quit = yield onSubmit(question, answer, answers);
5309
8352
  } catch (err) {
@@ -5403,13 +8446,13 @@ var require_action2 = __commonJS2({
5403
8446
  var require_strip2 = __commonJS2({
5404
8447
  "node_modules/.pnpm/prompts@2.4.1/node_modules/prompts/lib/util/strip.js"(exports, module) {
5405
8448
  "use strict";
5406
- module.exports = (str) => {
8449
+ module.exports = (str2) => {
5407
8450
  const pattern = [
5408
8451
  "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)",
5409
8452
  "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
5410
8453
  ].join("|");
5411
8454
  const RGX = new RegExp(pattern, "g");
5412
- return typeof str === "string" ? str.replace(RGX, "") : str;
8455
+ return typeof str2 === "string" ? str2.replace(RGX, "") : str2;
5413
8456
  };
5414
8457
  }
5415
8458
  });
@@ -5418,7 +8461,7 @@ var require_clear2 = __commonJS2({
5418
8461
  "use strict";
5419
8462
  var strip = require_strip2();
5420
8463
  var { erase, cursor } = require_src();
5421
- var width = (str) => [...strip(str)].length;
8464
+ var width = (str2) => [...strip(str2)].length;
5422
8465
  module.exports = function(prompt, perLine) {
5423
8466
  if (!perLine)
5424
8467
  return erase.line + cursor.to(0);
@@ -5477,7 +8520,7 @@ var require_style2 = __commonJS2({
5477
8520
  invisible: { scale: 0, render: (input) => "" },
5478
8521
  default: { scale: 1, render: (input) => `${input}` }
5479
8522
  });
5480
- var render = (type) => styles[type] || styles.default;
8523
+ var render = (type2) => styles[type2] || styles.default;
5481
8524
  var symbols = Object.freeze({
5482
8525
  aborted: c.red(figures.cross),
5483
8526
  done: c.green(figures.tick),
@@ -5573,10 +8616,10 @@ var require_prompt2 = __commonJS2({
5573
8616
  if (this.in.isTTY)
5574
8617
  this.in.setRawMode(true);
5575
8618
  const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
5576
- const keypress = (str, key) => {
8619
+ const keypress = (str2, key) => {
5577
8620
  let a = action(key, isSelect);
5578
8621
  if (a === false) {
5579
- this._ && this._(str, key);
8622
+ this._ && this._(str2, key);
5580
8623
  } else if (typeof this[a] === "function") {
5581
8624
  this[a](key);
5582
8625
  } else {
@@ -6479,7 +9522,7 @@ var require_number2 = __commonJS2({
6479
9522
  var Prompt = require_prompt2();
6480
9523
  var { cursor, erase } = require_src();
6481
9524
  var { style, figures, clear, lines } = require_util2();
6482
- var isNumber = /[0-9]/;
9525
+ var isNumber2 = /[0-9]/;
6483
9526
  var isDef = (any) => any !== void 0;
6484
9527
  var round = (number, precision) => {
6485
9528
  let factor = Math.pow(10, precision);
@@ -6523,7 +9566,7 @@ var require_number2 = __commonJS2({
6523
9566
  return this.float ? parseFloat(x) : parseInt(x);
6524
9567
  }
6525
9568
  valid(c) {
6526
- return c === `-` || c === `.` && this.float || isNumber.test(c);
9569
+ return c === `-` || c === `.` && this.float || isNumber2.test(c);
6527
9570
  }
6528
9571
  reset() {
6529
9572
  this.typed = ``;
@@ -7360,9 +10403,9 @@ var require_prompts2 = __commonJS2({
7360
10403
  var $ = exports;
7361
10404
  var el = require_elements2();
7362
10405
  var noop = (v) => v;
7363
- function toPrompt(type, args, opts = {}) {
10406
+ function toPrompt(type2, args, opts = {}) {
7364
10407
  return new Promise((res, rej) => {
7365
- const p = new el[type](args);
10408
+ const p = new el[type2](args);
7366
10409
  const onAbort = opts.onAbort || noop;
7367
10410
  const onSubmit = opts.onSubmit || noop;
7368
10411
  const onExit = opts.onExit || noop;
@@ -7387,7 +10430,7 @@ var require_prompts2 = __commonJS2({
7387
10430
  $.list = (args) => {
7388
10431
  const sep = args.separator || ",";
7389
10432
  return toPrompt("TextPrompt", args, {
7390
- onSubmit: (str) => str.split(sep).map((s) => s.trim())
10433
+ onSubmit: (str2) => str2.split(sep).map((s) => s.trim())
7391
10434
  });
7392
10435
  };
7393
10436
  $.toggle = (args) => toPrompt("TogglePrompt", args);
@@ -7427,7 +10470,7 @@ var require_lib = __commonJS2({
7427
10470
  const answers = {};
7428
10471
  const override2 = prompt._override || {};
7429
10472
  questions = [].concat(questions);
7430
- let answer, question, quit, name, type, lastPrompt;
10473
+ let answer, question, quit, name, type2, lastPrompt;
7431
10474
  const getFormattedAnswer = async (question2, answer2, skipValidation = false) => {
7432
10475
  if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
7433
10476
  return;
@@ -7435,26 +10478,26 @@ var require_lib = __commonJS2({
7435
10478
  return question2.format ? await question2.format(answer2, answers) : answer2;
7436
10479
  };
7437
10480
  for (question of questions) {
7438
- ({ name, type } = question);
7439
- if (typeof type === "function") {
7440
- type = await type(answer, __spreadValues({}, answers), question);
7441
- question["type"] = type;
10481
+ ({ name, type: type2 } = question);
10482
+ if (typeof type2 === "function") {
10483
+ type2 = await type2(answer, __spreadValues2({}, answers), question);
10484
+ question["type"] = type2;
7442
10485
  }
7443
- if (!type)
10486
+ if (!type2)
7444
10487
  continue;
7445
10488
  for (let key in question) {
7446
10489
  if (passOn.includes(key))
7447
10490
  continue;
7448
10491
  let value = question[key];
7449
- question[key] = typeof value === "function" ? await value(answer, __spreadValues({}, answers), lastPrompt) : value;
10492
+ question[key] = typeof value === "function" ? await value(answer, __spreadValues2({}, answers), lastPrompt) : value;
7450
10493
  }
7451
10494
  lastPrompt = question;
7452
10495
  if (typeof question.message !== "string") {
7453
10496
  throw new Error("prompt message is required");
7454
10497
  }
7455
- ({ name, type } = question);
7456
- if (prompts3[type] === void 0) {
7457
- throw new Error(`prompt type (${type}) is not defined`);
10498
+ ({ name, type: type2 } = question);
10499
+ if (prompts3[type2] === void 0) {
10500
+ throw new Error(`prompt type (${type2}) is not defined`);
7458
10501
  }
7459
10502
  if (override2[question.name] !== void 0) {
7460
10503
  answer = await getFormattedAnswer(question, override2[question.name]);
@@ -7464,7 +10507,7 @@ var require_lib = __commonJS2({
7464
10507
  }
7465
10508
  }
7466
10509
  try {
7467
- answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts3[type](question);
10510
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts3[type2](question);
7468
10511
  answers[name] = answer = await getFormattedAnswer(question, answer, true);
7469
10512
  quit = await onSubmit(question, answer, answers);
7470
10513
  } catch (err) {
@@ -7550,13 +10593,13 @@ var require_ini = __commonJS2({
7550
10593
  }
7551
10594
  return out;
7552
10595
  };
7553
- var dotSplit = (str) => str.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map((part) => part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, ""));
7554
- var decode = (str) => {
10596
+ var dotSplit = (str2) => str2.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map((part) => part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, ""));
10597
+ var decode = (str2) => {
7555
10598
  const out = Object.create(null);
7556
10599
  let p = out;
7557
10600
  let section = null;
7558
10601
  const re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
7559
- const lines = str.split(/[\r\n]+/g);
10602
+ const lines = str2.split(/[\r\n]+/g);
7560
10603
  for (const line of lines) {
7561
10604
  if (!line || line.match(/^\s*[;#]/))
7562
10605
  continue;
@@ -7785,7 +10828,7 @@ var require_p_locate = __commonJS2({
7785
10828
  return false;
7786
10829
  };
7787
10830
  var pLocate = async (iterable, tester, options) => {
7788
- options = __spreadValues({
10831
+ options = __spreadValues2({
7789
10832
  concurrency: Infinity,
7790
10833
  preserveOrder: true
7791
10834
  }, options);
@@ -7817,15 +10860,15 @@ var require_locate_path = __commonJS2({
7817
10860
  directory: "isDirectory",
7818
10861
  file: "isFile"
7819
10862
  };
7820
- function checkType({ type }) {
7821
- if (type in typeMappings) {
10863
+ function checkType({ type: type2 }) {
10864
+ if (type2 in typeMappings) {
7822
10865
  return;
7823
10866
  }
7824
- throw new Error(`Invalid type specified: ${type}`);
10867
+ throw new Error(`Invalid type specified: ${type2}`);
7825
10868
  }
7826
- var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
10869
+ var matchType = (type2, stat) => type2 === void 0 || stat[typeMappings[type2]]();
7827
10870
  module.exports = async (paths, options) => {
7828
- options = __spreadValues({
10871
+ options = __spreadValues2({
7829
10872
  cwd: process.cwd(),
7830
10873
  type: "file",
7831
10874
  allowSymlinks: true
@@ -7842,7 +10885,7 @@ var require_locate_path = __commonJS2({
7842
10885
  }, options);
7843
10886
  };
7844
10887
  module.exports.sync = (paths, options) => {
7845
- options = __spreadValues({
10888
+ options = __spreadValues2({
7846
10889
  cwd: process.cwd(),
7847
10890
  allowSymlinks: true,
7848
10891
  type: "file"
@@ -7907,7 +10950,7 @@ var require_find_up = __commonJS2({
7907
10950
  return foundPath;
7908
10951
  };
7909
10952
  while (true) {
7910
- const foundPath = await runMatcher(__spreadProps(__spreadValues({}, options), { cwd: directory }));
10953
+ const foundPath = await runMatcher(__spreadProps2(__spreadValues2({}, options), { cwd: directory }));
7911
10954
  if (foundPath === stop) {
7912
10955
  return;
7913
10956
  }
@@ -7935,7 +10978,7 @@ var require_find_up = __commonJS2({
7935
10978
  return foundPath;
7936
10979
  };
7937
10980
  while (true) {
7938
- const foundPath = runMatcher(__spreadProps(__spreadValues({}, options), { cwd: directory }));
10981
+ const foundPath = runMatcher(__spreadProps2(__spreadValues2({}, options), { cwd: directory }));
7939
10982
  if (foundPath === stop) {
7940
10983
  return;
7941
10984
  }
@@ -8047,11 +11090,11 @@ var require_shebang_command = __commonJS2({
8047
11090
  return null;
8048
11091
  }
8049
11092
  const [path3, argument] = match[0].replace(/#! ?/, "").split(" ");
8050
- const binary = path3.split("/").pop();
8051
- if (binary === "env") {
11093
+ const binary2 = path3.split("/").pop();
11094
+ if (binary2 === "env") {
8052
11095
  return argument;
8053
11096
  }
8054
- return argument ? `${binary} ${argument}` : binary;
11097
+ return argument ? `${binary2} ${argument}` : binary2;
8055
11098
  };
8056
11099
  }
8057
11100
  });
@@ -8113,7 +11156,7 @@ var require_parse = __commonJS2({
8113
11156
  }
8114
11157
  return parsed;
8115
11158
  }
8116
- function parse(command, args, options) {
11159
+ function parse2(command, args, options) {
8117
11160
  if (args && !Array.isArray(args)) {
8118
11161
  options = args;
8119
11162
  args = null;
@@ -8132,7 +11175,7 @@ var require_parse = __commonJS2({
8132
11175
  };
8133
11176
  return options.shell ? parsed : parseNonShell(parsed);
8134
11177
  }
8135
- module.exports = parse;
11178
+ module.exports = parse2;
8136
11179
  }
8137
11180
  });
8138
11181
  var require_enoent = __commonJS2({
@@ -8187,16 +11230,16 @@ var require_cross_spawn = __commonJS2({
8187
11230
  "node_modules/.pnpm/cross-spawn@7.0.3/node_modules/cross-spawn/index.js"(exports, module) {
8188
11231
  "use strict";
8189
11232
  var cp = __require2("child_process");
8190
- var parse = require_parse();
11233
+ var parse2 = require_parse();
8191
11234
  var enoent = require_enoent();
8192
11235
  function spawn(command, args, options) {
8193
- const parsed = parse(command, args, options);
11236
+ const parsed = parse2(command, args, options);
8194
11237
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
8195
11238
  enoent.hookChildProcess(spawned, parsed);
8196
11239
  return spawned;
8197
11240
  }
8198
11241
  function spawnSync(command, args, options) {
8199
- const parsed = parse(command, args, options);
11242
+ const parsed = parse2(command, args, options);
8200
11243
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
8201
11244
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
8202
11245
  return result;
@@ -8204,7 +11247,7 @@ var require_cross_spawn = __commonJS2({
8204
11247
  module.exports = spawn;
8205
11248
  module.exports.spawn = spawn;
8206
11249
  module.exports.sync = spawnSync;
8207
- module.exports._parse = parse;
11250
+ module.exports._parse = parse2;
8208
11251
  module.exports._enoent = enoent;
8209
11252
  }
8210
11253
  });
@@ -8230,7 +11273,7 @@ var require_npm_run_path = __commonJS2({
8230
11273
  var path3 = __require2("path");
8231
11274
  var pathKey = require_path_key();
8232
11275
  var npmRunPath = (options) => {
8233
- options = __spreadValues({
11276
+ options = __spreadValues2({
8234
11277
  cwd: process.cwd(),
8235
11278
  path: process.env[pathKey()],
8236
11279
  execPath: process.execPath
@@ -8250,10 +11293,10 @@ var require_npm_run_path = __commonJS2({
8250
11293
  module.exports = npmRunPath;
8251
11294
  module.exports.default = npmRunPath;
8252
11295
  module.exports.env = (options) => {
8253
- options = __spreadValues({
11296
+ options = __spreadValues2({
8254
11297
  env: process.env
8255
11298
  }, options);
8256
- const env = __spreadValues({}, options.env);
11299
+ const env = __spreadValues2({}, options.env);
8257
11300
  const path4 = pathKey({ env });
8258
11301
  options.path = env[path4];
8259
11302
  env[path4] = module.exports(options);
@@ -8657,7 +11700,7 @@ var require_main = __commonJS2({
8657
11700
  return signals.reduce(getSignalByName, {});
8658
11701
  };
8659
11702
  var getSignalByName = function(signalByNameMemo, { name, number, description, supported, action, forced, standard }) {
8660
- return __spreadProps(__spreadValues({}, signalByNameMemo), {
11703
+ return __spreadProps2(__spreadValues2({}, signalByNameMemo), {
8661
11704
  [name]: { name, number, description, supported, action, forced, standard }
8662
11705
  });
8663
11706
  };
@@ -8855,7 +11898,7 @@ var require_signal_exit = __commonJS2({
8855
11898
  module.exports = function(cb, opts) {
8856
11899
  assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
8857
11900
  if (loaded === false) {
8858
- load2();
11901
+ load3();
8859
11902
  }
8860
11903
  var ev = "exit";
8861
11904
  if (opts && opts.alwaysLast) {
@@ -8911,9 +11954,9 @@ var require_signal_exit = __commonJS2({
8911
11954
  module.exports.signals = function() {
8912
11955
  return signals;
8913
11956
  };
8914
- module.exports.load = load2;
11957
+ module.exports.load = load3;
8915
11958
  var loaded = false;
8916
- function load2() {
11959
+ function load3() {
8917
11960
  if (loaded) {
8918
11961
  return;
8919
11962
  }
@@ -9057,7 +12100,7 @@ var require_buffer_stream = __commonJS2({
9057
12100
  "use strict";
9058
12101
  var { PassThrough: PassThroughStream } = __require2("stream");
9059
12102
  module.exports = (options) => {
9060
- options = __spreadValues({}, options);
12103
+ options = __spreadValues2({}, options);
9061
12104
  const { array } = options;
9062
12105
  let { encoding } = options;
9063
12106
  const isBuffer = encoding === "buffer";
@@ -9113,7 +12156,7 @@ var require_get_stream = __commonJS2({
9113
12156
  if (!inputStream) {
9114
12157
  throw new Error("Expected a stream");
9115
12158
  }
9116
- options = __spreadValues({
12159
+ options = __spreadValues2({
9117
12160
  maxBuffer: Infinity
9118
12161
  }, options);
9119
12162
  const { maxBuffer } = options;
@@ -9142,8 +12185,8 @@ var require_get_stream = __commonJS2({
9142
12185
  return stream2.getBufferedValue();
9143
12186
  }
9144
12187
  module.exports = getStream;
9145
- module.exports.buffer = (stream2, options) => getStream(stream2, __spreadProps(__spreadValues({}, options), { encoding: "buffer" }));
9146
- module.exports.array = (stream2, options) => getStream(stream2, __spreadProps(__spreadValues({}, options), { array: true }));
12188
+ module.exports.buffer = (stream2, options) => getStream(stream2, __spreadProps2(__spreadValues2({}, options), { encoding: "buffer" }));
12189
+ module.exports.array = (stream2, options) => getStream(stream2, __spreadProps2(__spreadValues2({}, options), { array: true }));
9147
12190
  module.exports.MaxBufferError = MaxBufferError;
9148
12191
  }
9149
12192
  });
@@ -9274,7 +12317,7 @@ var require_promise = __commonJS2({
9274
12317
  var mergePromise = (spawned, promise) => {
9275
12318
  for (const [property, descriptor] of descriptors) {
9276
12319
  const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
9277
- Reflect.defineProperty(spawned, property, __spreadProps(__spreadValues({}, descriptor), { value }));
12320
+ Reflect.defineProperty(spawned, property, __spreadProps2(__spreadValues2({}, descriptor), { value }));
9278
12321
  }
9279
12322
  return spawned;
9280
12323
  };
@@ -9359,7 +12402,7 @@ var require_execa = __commonJS2({
9359
12402
  var { joinCommand, parseCommand, getEscapedCommand } = require_command();
9360
12403
  var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
9361
12404
  var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
9362
- const env = extendEnv ? __spreadValues(__spreadValues({}, process.env), envOption) : envOption;
12405
+ const env = extendEnv ? __spreadValues2(__spreadValues2({}, process.env), envOption) : envOption;
9363
12406
  if (preferLocal) {
9364
12407
  return npmRunPath.env({ env, cwd: localDir, execPath });
9365
12408
  }
@@ -9370,7 +12413,7 @@ var require_execa = __commonJS2({
9370
12413
  file = parsed.command;
9371
12414
  args = parsed.args;
9372
12415
  options = parsed.options;
9373
- options = __spreadValues({
12416
+ options = __spreadValues2({
9374
12417
  maxBuffer: DEFAULT_MAX_BUFFER,
9375
12418
  buffer: true,
9376
12419
  stripFinalNewline: true,
@@ -9552,7 +12595,7 @@ var require_execa = __commonJS2({
9552
12595
  ...nodeOptions,
9553
12596
  scriptPath,
9554
12597
  ...Array.isArray(args) ? args : []
9555
- ], __spreadProps(__spreadValues({}, options), {
12598
+ ], __spreadProps2(__spreadValues2({}, options), {
9556
12599
  stdin: void 0,
9557
12600
  stdout: void 0,
9558
12601
  stderr: void 0,
@@ -9874,14 +12917,14 @@ async function getConfig() {
9874
12917
  const result = await (0, import_find_up.default)("package.json") || "";
9875
12918
  let packageManager = "";
9876
12919
  if (result)
9877
- packageManager = (_a = JSON.parse(fs.readFileSync(result, "utf8")).packageManager) != null ? _a : "";
12920
+ packageManager = (_a = JSON.parse(fs2.readFileSync(result, "utf8")).packageManager) != null ? _a : "";
9878
12921
  const [, agent] = packageManager.match(new RegExp(`^(${Object.values(LOCKS).join("|")})@.*?$`)) || [];
9879
12922
  if (agent)
9880
12923
  config = Object.assign({}, defaultConfig, { defaultAgent: agent });
9881
- else if (!fs.existsSync(rcPath))
12924
+ else if (!fs2.existsSync(rcPath))
9882
12925
  config = defaultConfig;
9883
12926
  else
9884
- config = Object.assign({}, defaultConfig, import_ini.default.parse(fs.readFileSync(rcPath, "utf-8")));
12927
+ config = Object.assign({}, defaultConfig, import_ini.default.parse(fs2.readFileSync(rcPath, "utf-8")));
9885
12928
  }
9886
12929
  return config;
9887
12930
  }
@@ -10023,7 +13066,7 @@ function terminalLink(text, url, _a = {}) {
10023
13066
  return ansi_escapes_default.link(text, url);
10024
13067
  }
10025
13068
  terminalLink.isSupported = import_supports_hyperlinks.default.stdout;
10026
- terminalLink.stderr = (text, url, options = {}) => terminalLink(text, url, __spreadValues({ target: "stderr" }, options));
13069
+ terminalLink.stderr = (text, url, options = {}) => terminalLink(text, url, __spreadValues2({ target: "stderr" }, options));
10027
13070
  terminalLink.stderr.isSupported = import_supports_hyperlinks.default.stderr;
10028
13071
  var import_prompts = __toModule2(require_prompts3());
10029
13072
  async function detect({ autoInstall, cwd }) {
@@ -10058,14 +13101,14 @@ async function run(fn, args, options = {}) {
10058
13101
  let cwd = process.cwd();
10059
13102
  let command;
10060
13103
  if (args[0] === "-C") {
10061
- cwd = resolve(cwd, args[1]);
13104
+ cwd = resolve2(cwd, args[1]);
10062
13105
  args.splice(0, 2);
10063
13106
  }
10064
13107
  const isGlobal = args.includes("-g");
10065
13108
  if (isGlobal) {
10066
13109
  command = await fn(await getGlobalAgent(), args);
10067
13110
  } else {
10068
- let agent = await detect(__spreadProps(__spreadValues({}, options), { cwd })) || await getDefaultAgent();
13111
+ let agent = await detect(__spreadProps2(__spreadValues2({}, options), { cwd })) || await getDefaultAgent();
10069
13112
  if (agent === "prompt") {
10070
13113
  agent = (await (0, import_prompts2.default)({
10071
13114
  name: "agent",
@@ -10097,20 +13140,19 @@ async function run(fn, args, options = {}) {
10097
13140
  var import_semver = __toModule(require_semver2());
10098
13141
  import isInstalledGlobally from "is-installed-globally";
10099
13142
  import { underline } from "kolorist";
10100
- import fs2 from "fs-extra";
13143
+ import fs3 from "fs-extra";
10101
13144
 
10102
13145
  // node/options.ts
10103
13146
  init_esm_shims();
10104
- import { resolve as resolve2, dirname, join } from "path";
10105
- import { uniq } from "@antfu/utils";
10106
- import * as parser from "@slidev/parser/fs";
13147
+ import { dirname as dirname2, join, resolve as resolve3 } from "path";
13148
+ import { uniq as uniq3 } from "@antfu/utils";
10107
13149
  import _debug from "debug";
10108
13150
  var debug = _debug("slidev:options");
10109
13151
  function getClientRoot() {
10110
- return dirname(resolveImportPath("@slidev/client/package.json", true));
13152
+ return dirname2(resolveImportPath("@slidev/client/package.json", true));
10111
13153
  }
10112
13154
  function getCLIRoot() {
10113
- return resolve2(__dirname, "..");
13155
+ return resolve3(__dirname, "..");
10114
13156
  }
10115
13157
  function isPath(name) {
10116
13158
  return name.startsWith("/") || /^\.\.?[\/\\]/.test(name);
@@ -10120,25 +13162,25 @@ function getThemeRoots(name, entry) {
10120
13162
  return [];
10121
13163
  if (isPath(name)) {
10122
13164
  return [
10123
- resolve2(dirname(entry), name)
13165
+ resolve3(dirname2(entry), name)
10124
13166
  ];
10125
13167
  } else {
10126
13168
  return [
10127
- dirname(resolveImportPath(`${name}/package.json`, true))
13169
+ dirname2(resolveImportPath(`${name}/package.json`, true))
10128
13170
  ];
10129
13171
  }
10130
13172
  }
10131
13173
  function getUserRoot(options) {
10132
13174
  const { entry: rawEntry = "slides.md", userRoot = process.cwd() } = options;
10133
- const fullEntry = resolve2(userRoot, rawEntry);
10134
- return { entry: fullEntry, userRoot: dirname(fullEntry) };
13175
+ const fullEntry = resolve3(userRoot, rawEntry);
13176
+ return { entry: fullEntry, userRoot: dirname2(fullEntry) };
10135
13177
  }
10136
13178
  async function resolveOptions(options, mode, promptForInstallation = true) {
10137
13179
  const {
10138
13180
  entry,
10139
13181
  userRoot
10140
13182
  } = getUserRoot(options);
10141
- const data = await parser.load(entry);
13183
+ const data = await fs_exports.load(entry);
10142
13184
  const theme = resolveThemeName(options.theme || data.config.theme);
10143
13185
  if (promptForInstallation) {
10144
13186
  if (await promptForThemeInstallation(theme) === false)
@@ -10152,12 +13194,12 @@ async function resolveOptions(options, mode, promptForInstallation = true) {
10152
13194
  const clientRoot = getClientRoot();
10153
13195
  const cliRoot = getCLIRoot();
10154
13196
  const themeRoots = getThemeRoots(theme, entry);
10155
- const roots = uniq([clientRoot, ...themeRoots, userRoot]);
13197
+ const roots = uniq3([clientRoot, ...themeRoots, userRoot]);
10156
13198
  if (themeRoots.length) {
10157
13199
  const themeMeta = await getThemeMeta(theme, join(themeRoots[0], "package.json"));
10158
13200
  data.themeMeta = themeMeta;
10159
13201
  if (themeMeta)
10160
- data.config = parser.resolveConfig(data.headmatter, themeMeta);
13202
+ data.config = fs_exports.resolveConfig(data.headmatter, themeMeta);
10161
13203
  }
10162
13204
  debug({
10163
13205
  config: data.config,
@@ -10198,10 +13240,10 @@ function packageExists(name) {
10198
13240
  return false;
10199
13241
  }
10200
13242
  async function getThemeMeta(name, path3) {
10201
- if (!fs2.existsSync(path3))
13243
+ if (!fs3.existsSync(path3))
10202
13244
  return {};
10203
13245
  if (path3) {
10204
- const { slidev = {}, engines = {} } = await fs2.readJSON(path3);
13246
+ const { slidev = {}, engines = {} } = await fs3.readJSON(path3);
10205
13247
  if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev))
10206
13248
  throw new Error(`[slidev] theme "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
10207
13249
  return slidev;
@@ -10245,6 +13287,7 @@ async function promptForThemeInstallation(name) {
10245
13287
  }
10246
13288
 
10247
13289
  export {
13290
+ fs_exports,
10248
13291
  version,
10249
13292
  packageExists,
10250
13293
  resolveThemeName,
@@ -10255,3 +13298,4 @@ export {
10255
13298
  getUserRoot,
10256
13299
  resolveOptions
10257
13300
  };
13301
+ /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */