@slidev/cli 0.31.2 → 0.32.1

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,7 +1,9 @@
1
+ import {
2
+ ViteSlidevPlugin
3
+ } from "./chunk-2OKC6HYP.mjs";
1
4
  import {
2
5
  __commonJS,
3
6
  __dirname,
4
- __export,
5
7
  __objRest,
6
8
  __privateAdd,
7
9
  __privateGet,
@@ -11,8 +13,9 @@ import {
11
13
  __spreadValues,
12
14
  __toESM,
13
15
  init_esm_shims,
16
+ packageExists,
14
17
  resolveImportPath
15
- } from "./chunk-D6ZT4BYV.mjs";
18
+ } from "./chunk-NOFZO6W4.mjs";
16
19
 
17
20
  // ../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/internal/constants.js
18
21
  var require_constants = __commonJS({
@@ -373,7 +376,7 @@ var require_parse = __commonJS({
373
376
  var { re, t } = require_re();
374
377
  var SemVer = require_semver();
375
378
  var parseOptions = require_parse_options();
376
- var parse3 = (version3, options) => {
379
+ var parse2 = (version3, options) => {
377
380
  options = parseOptions(options);
378
381
  if (version3 instanceof SemVer) {
379
382
  return version3;
@@ -394,7 +397,7 @@ var require_parse = __commonJS({
394
397
  return null;
395
398
  }
396
399
  };
397
- module.exports = parse3;
400
+ module.exports = parse2;
398
401
  }
399
402
  });
400
403
 
@@ -402,9 +405,9 @@ var require_parse = __commonJS({
402
405
  var require_valid = __commonJS({
403
406
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/valid.js"(exports, module) {
404
407
  init_esm_shims();
405
- var parse3 = require_parse();
408
+ var parse2 = require_parse();
406
409
  var valid = (version3, options) => {
407
- const v = parse3(version3, options);
410
+ const v = parse2(version3, options);
408
411
  return v ? v.version : null;
409
412
  };
410
413
  module.exports = valid;
@@ -415,9 +418,9 @@ var require_valid = __commonJS({
415
418
  var require_clean = __commonJS({
416
419
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/clean.js"(exports, module) {
417
420
  init_esm_shims();
418
- var parse3 = require_parse();
421
+ var parse2 = require_parse();
419
422
  var clean = (version3, options) => {
420
- const s = parse3(version3.trim().replace(/^[=v]+/, ""), options);
423
+ const s = parse2(version3.trim().replace(/^[=v]+/, ""), options);
421
424
  return s ? s.version : null;
422
425
  };
423
426
  module.exports = clean;
@@ -468,14 +471,14 @@ var require_eq = __commonJS({
468
471
  var require_diff = __commonJS({
469
472
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/diff.js"(exports, module) {
470
473
  init_esm_shims();
471
- var parse3 = require_parse();
474
+ var parse2 = require_parse();
472
475
  var eq = require_eq();
473
476
  var diff = (version1, version22) => {
474
477
  if (eq(version1, version22)) {
475
478
  return null;
476
479
  } else {
477
- const v1 = parse3(version1);
478
- const v2 = parse3(version22);
480
+ const v1 = parse2(version1);
481
+ const v2 = parse2(version22);
479
482
  const hasPre = v1.prerelease.length || v2.prerelease.length;
480
483
  const prefix = hasPre ? "pre" : "";
481
484
  const defaultResult = hasPre ? "prerelease" : "";
@@ -527,9 +530,9 @@ var require_patch = __commonJS({
527
530
  var require_prerelease = __commonJS({
528
531
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/prerelease.js"(exports, module) {
529
532
  init_esm_shims();
530
- var parse3 = require_parse();
533
+ var parse2 = require_parse();
531
534
  var prerelease = (version3, options) => {
532
- const parsed = parse3(version3, options);
535
+ const parsed = parse2(version3, options);
533
536
  return parsed && parsed.prerelease.length ? parsed.prerelease : null;
534
537
  };
535
538
  module.exports = prerelease;
@@ -695,7 +698,7 @@ var require_coerce = __commonJS({
695
698
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/coerce.js"(exports, module) {
696
699
  init_esm_shims();
697
700
  var SemVer = require_semver();
698
- var parse3 = require_parse();
701
+ var parse2 = require_parse();
699
702
  var { re, t } = require_re();
700
703
  var coerce = (version3, options) => {
701
704
  if (version3 instanceof SemVer) {
@@ -724,7 +727,7 @@ var require_coerce = __commonJS({
724
727
  if (match === null) {
725
728
  return null;
726
729
  }
727
- return parse3(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
730
+ return parse2(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
728
731
  };
729
732
  module.exports = coerce;
730
733
  }
@@ -1389,28 +1392,28 @@ var require_range = __commonJS({
1389
1392
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/classes/range.js"(exports, module) {
1390
1393
  init_esm_shims();
1391
1394
  var Range = class {
1392
- constructor(range2, options) {
1395
+ constructor(range, options) {
1393
1396
  options = parseOptions(options);
1394
- if (range2 instanceof Range) {
1395
- if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) {
1396
- return range2;
1397
+ if (range instanceof Range) {
1398
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
1399
+ return range;
1397
1400
  } else {
1398
- return new Range(range2.raw, options);
1401
+ return new Range(range.raw, options);
1399
1402
  }
1400
1403
  }
1401
- if (range2 instanceof Comparator) {
1402
- this.raw = range2.value;
1403
- this.set = [[range2]];
1404
+ if (range instanceof Comparator) {
1405
+ this.raw = range.value;
1406
+ this.set = [[range]];
1404
1407
  this.format();
1405
1408
  return this;
1406
1409
  }
1407
1410
  this.options = options;
1408
1411
  this.loose = !!options.loose;
1409
1412
  this.includePrerelease = !!options.includePrerelease;
1410
- this.raw = range2;
1411
- this.set = range2.split("||").map((r) => this.parseRange(r.trim())).filter((c2) => c2.length);
1413
+ this.raw = range;
1414
+ this.set = range.split("||").map((r) => this.parseRange(r.trim())).filter((c2) => c2.length);
1412
1415
  if (!this.set.length) {
1413
- throw new TypeError(`Invalid SemVer Range: ${range2}`);
1416
+ throw new TypeError(`Invalid SemVer Range: ${range}`);
1414
1417
  }
1415
1418
  if (this.set.length > 1) {
1416
1419
  const first = this.set[0];
@@ -1437,24 +1440,24 @@ var require_range = __commonJS({
1437
1440
  toString() {
1438
1441
  return this.range;
1439
1442
  }
1440
- parseRange(range2) {
1441
- range2 = range2.trim();
1443
+ parseRange(range) {
1444
+ range = range.trim();
1442
1445
  const memoOpts = Object.keys(this.options).join(",");
1443
- const memoKey = `parseRange:${memoOpts}:${range2}`;
1446
+ const memoKey = `parseRange:${memoOpts}:${range}`;
1444
1447
  const cached = cache.get(memoKey);
1445
1448
  if (cached) {
1446
1449
  return cached;
1447
1450
  }
1448
1451
  const loose = this.options.loose;
1449
1452
  const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1450
- range2 = range2.replace(hr, hyphenReplace(this.options.includePrerelease));
1451
- debug2("hyphen replace", range2);
1452
- range2 = range2.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1453
- debug2("comparator trim", range2);
1454
- range2 = range2.replace(re[t.TILDETRIM], tildeTrimReplace);
1455
- range2 = range2.replace(re[t.CARETTRIM], caretTrimReplace);
1456
- range2 = range2.split(/\s+/).join(" ");
1457
- let rangeList = range2.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
1453
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1454
+ debug2("hyphen replace", range);
1455
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1456
+ debug2("comparator trim", range);
1457
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1458
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1459
+ range = range.split(/\s+/).join(" ");
1460
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
1458
1461
  if (loose) {
1459
1462
  rangeList = rangeList.filter((comp) => {
1460
1463
  debug2("loose invalid filter", comp, this.options);
@@ -1477,12 +1480,12 @@ var require_range = __commonJS({
1477
1480
  cache.set(memoKey, result);
1478
1481
  return result;
1479
1482
  }
1480
- intersects(range2, options) {
1481
- if (!(range2 instanceof Range)) {
1483
+ intersects(range, options) {
1484
+ if (!(range instanceof Range)) {
1482
1485
  throw new TypeError("a Range is required");
1483
1486
  }
1484
1487
  return this.set.some((thisComparators) => {
1485
- return isSatisfiable(thisComparators, options) && range2.set.some((rangeComparators) => {
1488
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
1486
1489
  return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
1487
1490
  return rangeComparators.every((rangeComparator) => {
1488
1491
  return thisComparator.intersects(rangeComparator, options);
@@ -1718,20 +1721,20 @@ var require_range = __commonJS({
1718
1721
  }
1719
1722
  return `${from} ${to}`.trim();
1720
1723
  };
1721
- var testSet = (set2, version3, options) => {
1722
- for (let i = 0; i < set2.length; i++) {
1723
- if (!set2[i].test(version3)) {
1724
+ var testSet = (set, version3, options) => {
1725
+ for (let i = 0; i < set.length; i++) {
1726
+ if (!set[i].test(version3)) {
1724
1727
  return false;
1725
1728
  }
1726
1729
  }
1727
1730
  if (version3.prerelease.length && !options.includePrerelease) {
1728
- for (let i = 0; i < set2.length; i++) {
1729
- debug2(set2[i].semver);
1730
- if (set2[i].semver === Comparator.ANY) {
1731
+ for (let i = 0; i < set.length; i++) {
1732
+ debug2(set[i].semver);
1733
+ if (set[i].semver === Comparator.ANY) {
1731
1734
  continue;
1732
1735
  }
1733
- if (set2[i].semver.prerelease.length > 0) {
1734
- const allowed = set2[i].semver;
1736
+ if (set[i].semver.prerelease.length > 0) {
1737
+ const allowed = set[i].semver;
1735
1738
  if (allowed.major === version3.major && allowed.minor === version3.minor && allowed.patch === version3.patch) {
1736
1739
  return true;
1737
1740
  }
@@ -1851,15 +1854,15 @@ var require_satisfies = __commonJS({
1851
1854
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/functions/satisfies.js"(exports, module) {
1852
1855
  init_esm_shims();
1853
1856
  var Range = require_range();
1854
- var satisfies2 = (version3, range2, options) => {
1857
+ var satisfies3 = (version3, range, options) => {
1855
1858
  try {
1856
- range2 = new Range(range2, options);
1859
+ range = new Range(range, options);
1857
1860
  } catch (er) {
1858
1861
  return false;
1859
1862
  }
1860
- return range2.test(version3);
1863
+ return range.test(version3);
1861
1864
  };
1862
- module.exports = satisfies2;
1865
+ module.exports = satisfies3;
1863
1866
  }
1864
1867
  });
1865
1868
 
@@ -1868,7 +1871,7 @@ var require_to_comparators = __commonJS({
1868
1871
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/ranges/to-comparators.js"(exports, module) {
1869
1872
  init_esm_shims();
1870
1873
  var Range = require_range();
1871
- var toComparators = (range2, options) => new Range(range2, options).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
1874
+ var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c2) => c2.value).join(" ").trim().split(" "));
1872
1875
  module.exports = toComparators;
1873
1876
  }
1874
1877
  });
@@ -1879,12 +1882,12 @@ var require_max_satisfying = __commonJS({
1879
1882
  init_esm_shims();
1880
1883
  var SemVer = require_semver();
1881
1884
  var Range = require_range();
1882
- var maxSatisfying = (versions, range2, options) => {
1885
+ var maxSatisfying = (versions, range, options) => {
1883
1886
  let max = null;
1884
1887
  let maxSV = null;
1885
1888
  let rangeObj = null;
1886
1889
  try {
1887
- rangeObj = new Range(range2, options);
1890
+ rangeObj = new Range(range, options);
1888
1891
  } catch (er) {
1889
1892
  return null;
1890
1893
  }
@@ -1908,12 +1911,12 @@ var require_min_satisfying = __commonJS({
1908
1911
  init_esm_shims();
1909
1912
  var SemVer = require_semver();
1910
1913
  var Range = require_range();
1911
- var minSatisfying = (versions, range2, options) => {
1914
+ var minSatisfying = (versions, range, options) => {
1912
1915
  let min = null;
1913
1916
  let minSV = null;
1914
1917
  let rangeObj = null;
1915
1918
  try {
1916
- rangeObj = new Range(range2, options);
1919
+ rangeObj = new Range(range, options);
1917
1920
  } catch (er) {
1918
1921
  return null;
1919
1922
  }
@@ -1938,19 +1941,19 @@ var require_min_version = __commonJS({
1938
1941
  var SemVer = require_semver();
1939
1942
  var Range = require_range();
1940
1943
  var gt = require_gt();
1941
- var minVersion = (range2, loose) => {
1942
- range2 = new Range(range2, loose);
1944
+ var minVersion = (range, loose) => {
1945
+ range = new Range(range, loose);
1943
1946
  let minver = new SemVer("0.0.0");
1944
- if (range2.test(minver)) {
1947
+ if (range.test(minver)) {
1945
1948
  return minver;
1946
1949
  }
1947
1950
  minver = new SemVer("0.0.0-0");
1948
- if (range2.test(minver)) {
1951
+ if (range.test(minver)) {
1949
1952
  return minver;
1950
1953
  }
1951
1954
  minver = null;
1952
- for (let i = 0; i < range2.set.length; ++i) {
1953
- const comparators = range2.set[i];
1955
+ for (let i = 0; i < range.set.length; ++i) {
1956
+ const comparators = range.set[i];
1954
1957
  let setMin = null;
1955
1958
  comparators.forEach((comparator) => {
1956
1959
  const compver = new SemVer(comparator.semver.version);
@@ -1979,7 +1982,7 @@ var require_min_version = __commonJS({
1979
1982
  minver = setMin;
1980
1983
  }
1981
1984
  }
1982
- if (minver && range2.test(minver)) {
1985
+ if (minver && range.test(minver)) {
1983
1986
  return minver;
1984
1987
  }
1985
1988
  return null;
@@ -1993,9 +1996,9 @@ var require_valid2 = __commonJS({
1993
1996
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/ranges/valid.js"(exports, module) {
1994
1997
  init_esm_shims();
1995
1998
  var Range = require_range();
1996
- var validRange = (range2, options) => {
1999
+ var validRange = (range, options) => {
1997
2000
  try {
1998
- return new Range(range2, options).range || "*";
2001
+ return new Range(range, options).range || "*";
1999
2002
  } catch (er) {
2000
2003
  return null;
2001
2004
  }
@@ -2012,14 +2015,14 @@ var require_outside = __commonJS({
2012
2015
  var Comparator = require_comparator();
2013
2016
  var { ANY } = Comparator;
2014
2017
  var Range = require_range();
2015
- var satisfies2 = require_satisfies();
2018
+ var satisfies3 = require_satisfies();
2016
2019
  var gt = require_gt();
2017
2020
  var lt = require_lt();
2018
2021
  var lte = require_lte();
2019
2022
  var gte = require_gte();
2020
- var outside = (version3, range2, hilo, options) => {
2023
+ var outside = (version3, range, hilo, options) => {
2021
2024
  version3 = new SemVer(version3, options);
2022
- range2 = new Range(range2, options);
2025
+ range = new Range(range, options);
2023
2026
  let gtfn, ltefn, ltfn, comp, ecomp;
2024
2027
  switch (hilo) {
2025
2028
  case ">":
@@ -2039,11 +2042,11 @@ var require_outside = __commonJS({
2039
2042
  default:
2040
2043
  throw new TypeError('Must provide a hilo val of "<" or ">"');
2041
2044
  }
2042
- if (satisfies2(version3, range2, options)) {
2045
+ if (satisfies3(version3, range, options)) {
2043
2046
  return false;
2044
2047
  }
2045
- for (let i = 0; i < range2.set.length; ++i) {
2046
- const comparators = range2.set[i];
2048
+ for (let i = 0; i < range.set.length; ++i) {
2049
+ const comparators = range.set[i];
2047
2050
  let high = null;
2048
2051
  let low = null;
2049
2052
  comparators.forEach((comparator) => {
@@ -2078,7 +2081,7 @@ var require_gtr = __commonJS({
2078
2081
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/ranges/gtr.js"(exports, module) {
2079
2082
  init_esm_shims();
2080
2083
  var outside = require_outside();
2081
- var gtr = (version3, range2, options) => outside(version3, range2, ">", options);
2084
+ var gtr = (version3, range, options) => outside(version3, range, ">", options);
2082
2085
  module.exports = gtr;
2083
2086
  }
2084
2087
  });
@@ -2088,7 +2091,7 @@ var require_ltr = __commonJS({
2088
2091
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/ranges/ltr.js"(exports, module) {
2089
2092
  init_esm_shims();
2090
2093
  var outside = require_outside();
2091
- var ltr = (version3, range2, options) => outside(version3, range2, "<", options);
2094
+ var ltr = (version3, range, options) => outside(version3, range, "<", options);
2092
2095
  module.exports = ltr;
2093
2096
  }
2094
2097
  });
@@ -2111,15 +2114,15 @@ var require_intersects = __commonJS({
2111
2114
  var require_simplify = __commonJS({
2112
2115
  "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/ranges/simplify.js"(exports, module) {
2113
2116
  init_esm_shims();
2114
- var satisfies2 = require_satisfies();
2117
+ var satisfies3 = require_satisfies();
2115
2118
  var compare = require_compare();
2116
- module.exports = (versions, range2, options) => {
2117
- const set2 = [];
2119
+ module.exports = (versions, range, options) => {
2120
+ const set = [];
2118
2121
  let first = null;
2119
2122
  let prev = null;
2120
2123
  const v = versions.sort((a, b) => compare(a, b, options));
2121
2124
  for (const version3 of v) {
2122
- const included = satisfies2(version3, range2, options);
2125
+ const included = satisfies3(version3, range, options);
2123
2126
  if (included) {
2124
2127
  prev = version3;
2125
2128
  if (!first) {
@@ -2127,17 +2130,17 @@ var require_simplify = __commonJS({
2127
2130
  }
2128
2131
  } else {
2129
2132
  if (prev) {
2130
- set2.push([first, prev]);
2133
+ set.push([first, prev]);
2131
2134
  }
2132
2135
  prev = null;
2133
2136
  first = null;
2134
2137
  }
2135
2138
  }
2136
2139
  if (first) {
2137
- set2.push([first, null]);
2140
+ set.push([first, null]);
2138
2141
  }
2139
2142
  const ranges = [];
2140
- for (const [min, max] of set2) {
2143
+ for (const [min, max] of set) {
2141
2144
  if (min === max) {
2142
2145
  ranges.push(min);
2143
2146
  } else if (!max && min === v[0]) {
@@ -2151,8 +2154,8 @@ var require_simplify = __commonJS({
2151
2154
  }
2152
2155
  }
2153
2156
  const simplified = ranges.join(" || ");
2154
- const original = typeof range2.raw === "string" ? range2.raw : String(range2);
2155
- return simplified.length < original.length ? simplified : range2;
2157
+ const original = typeof range.raw === "string" ? range.raw : String(range);
2158
+ return simplified.length < original.length ? simplified : range;
2156
2159
  };
2157
2160
  }
2158
2161
  });
@@ -2164,7 +2167,7 @@ var require_subset = __commonJS({
2164
2167
  var Range = require_range();
2165
2168
  var Comparator = require_comparator();
2166
2169
  var { ANY } = Comparator;
2167
- var satisfies2 = require_satisfies();
2170
+ var satisfies3 = require_satisfies();
2168
2171
  var compare = require_compare();
2169
2172
  var subset = (sub, dom, options = {}) => {
2170
2173
  if (sub === dom) {
@@ -2219,3222 +2222,186 @@ var require_subset = __commonJS({
2219
2222
  eqSet.add(c2.semver);
2220
2223
  }
2221
2224
  }
2222
- if (eqSet.size > 1) {
2223
- return null;
2224
- }
2225
- let gtltComp;
2226
- if (gt && lt) {
2227
- gtltComp = compare(gt.semver, lt.semver, options);
2228
- if (gtltComp > 0) {
2229
- return null;
2230
- } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
2231
- return null;
2232
- }
2233
- }
2234
- for (const eq of eqSet) {
2235
- if (gt && !satisfies2(eq, String(gt), options)) {
2236
- return null;
2237
- }
2238
- if (lt && !satisfies2(eq, String(lt), options)) {
2239
- return null;
2240
- }
2241
- for (const c2 of dom) {
2242
- if (!satisfies2(eq, String(c2), options)) {
2243
- return false;
2244
- }
2245
- }
2246
- return true;
2247
- }
2248
- let higher, lower;
2249
- let hasDomLT, hasDomGT;
2250
- let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
2251
- let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
2252
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
2253
- needDomLTPre = false;
2254
- }
2255
- for (const c2 of dom) {
2256
- hasDomGT = hasDomGT || c2.operator === ">" || c2.operator === ">=";
2257
- hasDomLT = hasDomLT || c2.operator === "<" || c2.operator === "<=";
2258
- if (gt) {
2259
- if (needDomGTPre) {
2260
- if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomGTPre.major && c2.semver.minor === needDomGTPre.minor && c2.semver.patch === needDomGTPre.patch) {
2261
- needDomGTPre = false;
2262
- }
2263
- }
2264
- if (c2.operator === ">" || c2.operator === ">=") {
2265
- higher = higherGT(gt, c2, options);
2266
- if (higher === c2 && higher !== gt) {
2267
- return false;
2268
- }
2269
- } else if (gt.operator === ">=" && !satisfies2(gt.semver, String(c2), options)) {
2270
- return false;
2271
- }
2272
- }
2273
- if (lt) {
2274
- if (needDomLTPre) {
2275
- if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomLTPre.major && c2.semver.minor === needDomLTPre.minor && c2.semver.patch === needDomLTPre.patch) {
2276
- needDomLTPre = false;
2277
- }
2278
- }
2279
- if (c2.operator === "<" || c2.operator === "<=") {
2280
- lower = lowerLT(lt, c2, options);
2281
- if (lower === c2 && lower !== lt) {
2282
- return false;
2283
- }
2284
- } else if (lt.operator === "<=" && !satisfies2(lt.semver, String(c2), options)) {
2285
- return false;
2286
- }
2287
- }
2288
- if (!c2.operator && (lt || gt) && gtltComp !== 0) {
2289
- return false;
2290
- }
2291
- }
2292
- if (gt && hasDomLT && !lt && gtltComp !== 0) {
2293
- return false;
2294
- }
2295
- if (lt && hasDomGT && !gt && gtltComp !== 0) {
2296
- return false;
2297
- }
2298
- if (needDomGTPre || needDomLTPre) {
2299
- return false;
2300
- }
2301
- return true;
2302
- };
2303
- var higherGT = (a, b, options) => {
2304
- if (!a) {
2305
- return b;
2306
- }
2307
- const comp = compare(a.semver, b.semver, options);
2308
- return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
2309
- };
2310
- var lowerLT = (a, b, options) => {
2311
- if (!a) {
2312
- return b;
2313
- }
2314
- const comp = compare(a.semver, b.semver, options);
2315
- return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
2316
- };
2317
- module.exports = subset;
2318
- }
2319
- });
2320
-
2321
- // ../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/index.js
2322
- var require_semver2 = __commonJS({
2323
- "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/index.js"(exports, module) {
2324
- init_esm_shims();
2325
- var internalRe = require_re();
2326
- module.exports = {
2327
- re: internalRe.re,
2328
- src: internalRe.src,
2329
- tokens: internalRe.t,
2330
- SEMVER_SPEC_VERSION: require_constants().SEMVER_SPEC_VERSION,
2331
- SemVer: require_semver(),
2332
- compareIdentifiers: require_identifiers().compareIdentifiers,
2333
- rcompareIdentifiers: require_identifiers().rcompareIdentifiers,
2334
- parse: require_parse(),
2335
- valid: require_valid(),
2336
- clean: require_clean(),
2337
- inc: require_inc(),
2338
- diff: require_diff(),
2339
- major: require_major(),
2340
- minor: require_minor(),
2341
- patch: require_patch(),
2342
- prerelease: require_prerelease(),
2343
- compare: require_compare(),
2344
- rcompare: require_rcompare(),
2345
- compareLoose: require_compare_loose(),
2346
- compareBuild: require_compare_build(),
2347
- sort: require_sort(),
2348
- rsort: require_rsort(),
2349
- gt: require_gt(),
2350
- lt: require_lt(),
2351
- eq: require_eq(),
2352
- neq: require_neq(),
2353
- gte: require_gte(),
2354
- lte: require_lte(),
2355
- cmp: require_cmp(),
2356
- coerce: require_coerce(),
2357
- Comparator: require_comparator(),
2358
- Range: require_range(),
2359
- satisfies: require_satisfies(),
2360
- toComparators: require_to_comparators(),
2361
- maxSatisfying: require_max_satisfying(),
2362
- minSatisfying: require_min_satisfying(),
2363
- minVersion: require_min_version(),
2364
- validRange: require_valid2(),
2365
- outside: require_outside(),
2366
- gtr: require_gtr(),
2367
- ltr: require_ltr(),
2368
- intersects: require_intersects(),
2369
- simplifyRange: require_simplify(),
2370
- subset: require_subset()
2371
- };
2372
- }
2373
- });
2374
-
2375
- // ../parser/src/fs.ts
2376
- var fs_exports = {};
2377
- __export(fs_exports, {
2378
- detectFeatures: () => detectFeatures,
2379
- filterDisabled: () => filterDisabled,
2380
- load: () => load2,
2381
- mergeFeatureFlags: () => mergeFeatureFlags,
2382
- parse: () => parse,
2383
- parseAspectRatio: () => parseAspectRatio,
2384
- parseRangeString: () => parseRangeString,
2385
- parseSlide: () => parseSlide,
2386
- prettify: () => prettify,
2387
- prettifySlide: () => prettifySlide,
2388
- resolveConfig: () => resolveConfig,
2389
- resolveFonts: () => resolveFonts,
2390
- save: () => save,
2391
- saveExternalSlide: () => saveExternalSlide,
2392
- scanMonacoModules: () => scanMonacoModules,
2393
- stringify: () => stringify,
2394
- stringifySlide: () => stringifySlide
2395
- });
2396
- init_esm_shims();
2397
- import { promises as fs } from "fs";
2398
- import { dirname, resolve } from "path";
2399
-
2400
- // ../parser/src/core.ts
2401
- init_esm_shims();
2402
-
2403
- // ../../node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/dist/js-yaml.mjs
2404
- init_esm_shims();
2405
- function isNothing(subject) {
2406
- return typeof subject === "undefined" || subject === null;
2407
- }
2408
- function isObject(subject) {
2409
- return typeof subject === "object" && subject !== null;
2410
- }
2411
- function toArray(sequence) {
2412
- if (Array.isArray(sequence))
2413
- return sequence;
2414
- else if (isNothing(sequence))
2415
- return [];
2416
- return [sequence];
2417
- }
2418
- function extend(target, source) {
2419
- var index, length, key, sourceKeys;
2420
- if (source) {
2421
- sourceKeys = Object.keys(source);
2422
- for (index = 0, length = sourceKeys.length; index < length; index += 1) {
2423
- key = sourceKeys[index];
2424
- target[key] = source[key];
2425
- }
2426
- }
2427
- return target;
2428
- }
2429
- function repeat(string, count) {
2430
- var result = "", cycle;
2431
- for (cycle = 0; cycle < count; cycle += 1) {
2432
- result += string;
2433
- }
2434
- return result;
2435
- }
2436
- function isNegativeZero(number2) {
2437
- return number2 === 0 && Number.NEGATIVE_INFINITY === 1 / number2;
2438
- }
2439
- var isNothing_1 = isNothing;
2440
- var isObject_1 = isObject;
2441
- var toArray_1 = toArray;
2442
- var repeat_1 = repeat;
2443
- var isNegativeZero_1 = isNegativeZero;
2444
- var extend_1 = extend;
2445
- var common = {
2446
- isNothing: isNothing_1,
2447
- isObject: isObject_1,
2448
- toArray: toArray_1,
2449
- repeat: repeat_1,
2450
- isNegativeZero: isNegativeZero_1,
2451
- extend: extend_1
2452
- };
2453
- function formatError(exception2, compact) {
2454
- var where = "", message = exception2.reason || "(unknown reason)";
2455
- if (!exception2.mark)
2456
- return message;
2457
- if (exception2.mark.name) {
2458
- where += 'in "' + exception2.mark.name + '" ';
2459
- }
2460
- where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
2461
- if (!compact && exception2.mark.snippet) {
2462
- where += "\n\n" + exception2.mark.snippet;
2463
- }
2464
- return message + " " + where;
2465
- }
2466
- function YAMLException$1(reason, mark) {
2467
- Error.call(this);
2468
- this.name = "YAMLException";
2469
- this.reason = reason;
2470
- this.mark = mark;
2471
- this.message = formatError(this, false);
2472
- if (Error.captureStackTrace) {
2473
- Error.captureStackTrace(this, this.constructor);
2474
- } else {
2475
- this.stack = new Error().stack || "";
2476
- }
2477
- }
2478
- YAMLException$1.prototype = Object.create(Error.prototype);
2479
- YAMLException$1.prototype.constructor = YAMLException$1;
2480
- YAMLException$1.prototype.toString = function toString(compact) {
2481
- return this.name + ": " + formatError(this, compact);
2482
- };
2483
- var exception = YAMLException$1;
2484
- function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
2485
- var head = "";
2486
- var tail = "";
2487
- var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
2488
- if (position - lineStart > maxHalfLength) {
2489
- head = " ... ";
2490
- lineStart = position - maxHalfLength + head.length;
2491
- }
2492
- if (lineEnd - position > maxHalfLength) {
2493
- tail = " ...";
2494
- lineEnd = position + maxHalfLength - tail.length;
2495
- }
2496
- return {
2497
- str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
2498
- pos: position - lineStart + head.length
2499
- };
2500
- }
2501
- function padStart(string, max) {
2502
- return common.repeat(" ", max - string.length) + string;
2503
- }
2504
- function makeSnippet(mark, options) {
2505
- options = Object.create(options || null);
2506
- if (!mark.buffer)
2507
- return null;
2508
- if (!options.maxLength)
2509
- options.maxLength = 79;
2510
- if (typeof options.indent !== "number")
2511
- options.indent = 1;
2512
- if (typeof options.linesBefore !== "number")
2513
- options.linesBefore = 3;
2514
- if (typeof options.linesAfter !== "number")
2515
- options.linesAfter = 2;
2516
- var re = /\r?\n|\r|\0/g;
2517
- var lineStarts = [0];
2518
- var lineEnds = [];
2519
- var match;
2520
- var foundLineNo = -1;
2521
- while (match = re.exec(mark.buffer)) {
2522
- lineEnds.push(match.index);
2523
- lineStarts.push(match.index + match[0].length);
2524
- if (mark.position <= match.index && foundLineNo < 0) {
2525
- foundLineNo = lineStarts.length - 2;
2526
- }
2527
- }
2528
- if (foundLineNo < 0)
2529
- foundLineNo = lineStarts.length - 1;
2530
- var result = "", i, line;
2531
- var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
2532
- var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
2533
- for (i = 1; i <= options.linesBefore; i++) {
2534
- if (foundLineNo - i < 0)
2535
- break;
2536
- line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
2537
- result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
2538
- }
2539
- line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
2540
- result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
2541
- result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
2542
- for (i = 1; i <= options.linesAfter; i++) {
2543
- if (foundLineNo + i >= lineEnds.length)
2544
- break;
2545
- line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
2546
- result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
2547
- }
2548
- return result.replace(/\n$/, "");
2549
- }
2550
- var snippet = makeSnippet;
2551
- var TYPE_CONSTRUCTOR_OPTIONS = [
2552
- "kind",
2553
- "multi",
2554
- "resolve",
2555
- "construct",
2556
- "instanceOf",
2557
- "predicate",
2558
- "represent",
2559
- "representName",
2560
- "defaultStyle",
2561
- "styleAliases"
2562
- ];
2563
- var YAML_NODE_KINDS = [
2564
- "scalar",
2565
- "sequence",
2566
- "mapping"
2567
- ];
2568
- function compileStyleAliases(map2) {
2569
- var result = {};
2570
- if (map2 !== null) {
2571
- Object.keys(map2).forEach(function(style2) {
2572
- map2[style2].forEach(function(alias) {
2573
- result[String(alias)] = style2;
2574
- });
2575
- });
2576
- }
2577
- return result;
2578
- }
2579
- function Type$1(tag, options) {
2580
- options = options || {};
2581
- Object.keys(options).forEach(function(name) {
2582
- if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
2583
- throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
2584
- }
2585
- });
2586
- this.options = options;
2587
- this.tag = tag;
2588
- this.kind = options["kind"] || null;
2589
- this.resolve = options["resolve"] || function() {
2590
- return true;
2591
- };
2592
- this.construct = options["construct"] || function(data) {
2593
- return data;
2594
- };
2595
- this.instanceOf = options["instanceOf"] || null;
2596
- this.predicate = options["predicate"] || null;
2597
- this.represent = options["represent"] || null;
2598
- this.representName = options["representName"] || null;
2599
- this.defaultStyle = options["defaultStyle"] || null;
2600
- this.multi = options["multi"] || false;
2601
- this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
2602
- if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
2603
- throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
2604
- }
2605
- }
2606
- var type = Type$1;
2607
- function compileList(schema2, name) {
2608
- var result = [];
2609
- schema2[name].forEach(function(currentType) {
2610
- var newIndex = result.length;
2611
- result.forEach(function(previousType, previousIndex) {
2612
- if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
2613
- newIndex = previousIndex;
2614
- }
2615
- });
2616
- result[newIndex] = currentType;
2617
- });
2618
- return result;
2619
- }
2620
- function compileMap() {
2621
- var result = {
2622
- scalar: {},
2623
- sequence: {},
2624
- mapping: {},
2625
- fallback: {},
2626
- multi: {
2627
- scalar: [],
2628
- sequence: [],
2629
- mapping: [],
2630
- fallback: []
2631
- }
2632
- }, index, length;
2633
- function collectType(type2) {
2634
- if (type2.multi) {
2635
- result.multi[type2.kind].push(type2);
2636
- result.multi["fallback"].push(type2);
2637
- } else {
2638
- result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
2639
- }
2640
- }
2641
- for (index = 0, length = arguments.length; index < length; index += 1) {
2642
- arguments[index].forEach(collectType);
2643
- }
2644
- return result;
2645
- }
2646
- function Schema$1(definition) {
2647
- return this.extend(definition);
2648
- }
2649
- Schema$1.prototype.extend = function extend2(definition) {
2650
- var implicit = [];
2651
- var explicit = [];
2652
- if (definition instanceof type) {
2653
- explicit.push(definition);
2654
- } else if (Array.isArray(definition)) {
2655
- explicit = explicit.concat(definition);
2656
- } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
2657
- if (definition.implicit)
2658
- implicit = implicit.concat(definition.implicit);
2659
- if (definition.explicit)
2660
- explicit = explicit.concat(definition.explicit);
2661
- } else {
2662
- throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
2663
- }
2664
- implicit.forEach(function(type$1) {
2665
- if (!(type$1 instanceof type)) {
2666
- throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
2667
- }
2668
- if (type$1.loadKind && type$1.loadKind !== "scalar") {
2669
- throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
2670
- }
2671
- if (type$1.multi) {
2672
- throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
2673
- }
2674
- });
2675
- explicit.forEach(function(type$1) {
2676
- if (!(type$1 instanceof type)) {
2677
- throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
2678
- }
2679
- });
2680
- var result = Object.create(Schema$1.prototype);
2681
- result.implicit = (this.implicit || []).concat(implicit);
2682
- result.explicit = (this.explicit || []).concat(explicit);
2683
- result.compiledImplicit = compileList(result, "implicit");
2684
- result.compiledExplicit = compileList(result, "explicit");
2685
- result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
2686
- return result;
2687
- };
2688
- var schema = Schema$1;
2689
- var str = new type("tag:yaml.org,2002:str", {
2690
- kind: "scalar",
2691
- construct: function(data) {
2692
- return data !== null ? data : "";
2693
- }
2694
- });
2695
- var seq = new type("tag:yaml.org,2002:seq", {
2696
- kind: "sequence",
2697
- construct: function(data) {
2698
- return data !== null ? data : [];
2699
- }
2700
- });
2701
- var map = new type("tag:yaml.org,2002:map", {
2702
- kind: "mapping",
2703
- construct: function(data) {
2704
- return data !== null ? data : {};
2705
- }
2706
- });
2707
- var failsafe = new schema({
2708
- explicit: [
2709
- str,
2710
- seq,
2711
- map
2712
- ]
2713
- });
2714
- function resolveYamlNull(data) {
2715
- if (data === null)
2716
- return true;
2717
- var max = data.length;
2718
- return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
2719
- }
2720
- function constructYamlNull() {
2721
- return null;
2722
- }
2723
- function isNull(object) {
2724
- return object === null;
2725
- }
2726
- var _null = new type("tag:yaml.org,2002:null", {
2727
- kind: "scalar",
2728
- resolve: resolveYamlNull,
2729
- construct: constructYamlNull,
2730
- predicate: isNull,
2731
- represent: {
2732
- canonical: function() {
2733
- return "~";
2734
- },
2735
- lowercase: function() {
2736
- return "null";
2737
- },
2738
- uppercase: function() {
2739
- return "NULL";
2740
- },
2741
- camelcase: function() {
2742
- return "Null";
2743
- },
2744
- empty: function() {
2745
- return "";
2746
- }
2747
- },
2748
- defaultStyle: "lowercase"
2749
- });
2750
- function resolveYamlBoolean(data) {
2751
- if (data === null)
2752
- return false;
2753
- var max = data.length;
2754
- return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
2755
- }
2756
- function constructYamlBoolean(data) {
2757
- return data === "true" || data === "True" || data === "TRUE";
2758
- }
2759
- function isBoolean(object) {
2760
- return Object.prototype.toString.call(object) === "[object Boolean]";
2761
- }
2762
- var bool = new type("tag:yaml.org,2002:bool", {
2763
- kind: "scalar",
2764
- resolve: resolveYamlBoolean,
2765
- construct: constructYamlBoolean,
2766
- predicate: isBoolean,
2767
- represent: {
2768
- lowercase: function(object) {
2769
- return object ? "true" : "false";
2770
- },
2771
- uppercase: function(object) {
2772
- return object ? "TRUE" : "FALSE";
2773
- },
2774
- camelcase: function(object) {
2775
- return object ? "True" : "False";
2776
- }
2777
- },
2778
- defaultStyle: "lowercase"
2779
- });
2780
- function isHexCode(c2) {
2781
- return 48 <= c2 && c2 <= 57 || 65 <= c2 && c2 <= 70 || 97 <= c2 && c2 <= 102;
2782
- }
2783
- function isOctCode(c2) {
2784
- return 48 <= c2 && c2 <= 55;
2785
- }
2786
- function isDecCode(c2) {
2787
- return 48 <= c2 && c2 <= 57;
2788
- }
2789
- function resolveYamlInteger(data) {
2790
- if (data === null)
2791
- return false;
2792
- var max = data.length, index = 0, hasDigits = false, ch;
2793
- if (!max)
2794
- return false;
2795
- ch = data[index];
2796
- if (ch === "-" || ch === "+") {
2797
- ch = data[++index];
2798
- }
2799
- if (ch === "0") {
2800
- if (index + 1 === max)
2801
- return true;
2802
- ch = data[++index];
2803
- if (ch === "b") {
2804
- index++;
2805
- for (; index < max; index++) {
2806
- ch = data[index];
2807
- if (ch === "_")
2808
- continue;
2809
- if (ch !== "0" && ch !== "1")
2810
- return false;
2811
- hasDigits = true;
2812
- }
2813
- return hasDigits && ch !== "_";
2814
- }
2815
- if (ch === "x") {
2816
- index++;
2817
- for (; index < max; index++) {
2818
- ch = data[index];
2819
- if (ch === "_")
2820
- continue;
2821
- if (!isHexCode(data.charCodeAt(index)))
2822
- return false;
2823
- hasDigits = true;
2824
- }
2825
- return hasDigits && ch !== "_";
2826
- }
2827
- if (ch === "o") {
2828
- index++;
2829
- for (; index < max; index++) {
2830
- ch = data[index];
2831
- if (ch === "_")
2832
- continue;
2833
- if (!isOctCode(data.charCodeAt(index)))
2834
- return false;
2835
- hasDigits = true;
2836
- }
2837
- return hasDigits && ch !== "_";
2838
- }
2839
- }
2840
- if (ch === "_")
2841
- return false;
2842
- for (; index < max; index++) {
2843
- ch = data[index];
2844
- if (ch === "_")
2845
- continue;
2846
- if (!isDecCode(data.charCodeAt(index))) {
2847
- return false;
2848
- }
2849
- hasDigits = true;
2850
- }
2851
- if (!hasDigits || ch === "_")
2852
- return false;
2853
- return true;
2854
- }
2855
- function constructYamlInteger(data) {
2856
- var value = data, sign = 1, ch;
2857
- if (value.indexOf("_") !== -1) {
2858
- value = value.replace(/_/g, "");
2859
- }
2860
- ch = value[0];
2861
- if (ch === "-" || ch === "+") {
2862
- if (ch === "-")
2863
- sign = -1;
2864
- value = value.slice(1);
2865
- ch = value[0];
2866
- }
2867
- if (value === "0")
2868
- return 0;
2869
- if (ch === "0") {
2870
- if (value[1] === "b")
2871
- return sign * parseInt(value.slice(2), 2);
2872
- if (value[1] === "x")
2873
- return sign * parseInt(value.slice(2), 16);
2874
- if (value[1] === "o")
2875
- return sign * parseInt(value.slice(2), 8);
2876
- }
2877
- return sign * parseInt(value, 10);
2878
- }
2879
- function isInteger(object) {
2880
- return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
2881
- }
2882
- var int = new type("tag:yaml.org,2002:int", {
2883
- kind: "scalar",
2884
- resolve: resolveYamlInteger,
2885
- construct: constructYamlInteger,
2886
- predicate: isInteger,
2887
- represent: {
2888
- binary: function(obj) {
2889
- return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
2890
- },
2891
- octal: function(obj) {
2892
- return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
2893
- },
2894
- decimal: function(obj) {
2895
- return obj.toString(10);
2896
- },
2897
- hexadecimal: function(obj) {
2898
- return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
2899
- }
2900
- },
2901
- defaultStyle: "decimal",
2902
- styleAliases: {
2903
- binary: [2, "bin"],
2904
- octal: [8, "oct"],
2905
- decimal: [10, "dec"],
2906
- hexadecimal: [16, "hex"]
2907
- }
2908
- });
2909
- 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))$");
2910
- function resolveYamlFloat(data) {
2911
- if (data === null)
2912
- return false;
2913
- if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") {
2914
- return false;
2915
- }
2916
- return true;
2917
- }
2918
- function constructYamlFloat(data) {
2919
- var value, sign;
2920
- value = data.replace(/_/g, "").toLowerCase();
2921
- sign = value[0] === "-" ? -1 : 1;
2922
- if ("+-".indexOf(value[0]) >= 0) {
2923
- value = value.slice(1);
2924
- }
2925
- if (value === ".inf") {
2926
- return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
2927
- } else if (value === ".nan") {
2928
- return NaN;
2929
- }
2930
- return sign * parseFloat(value, 10);
2931
- }
2932
- var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
2933
- function representYamlFloat(object, style2) {
2934
- var res;
2935
- if (isNaN(object)) {
2936
- switch (style2) {
2937
- case "lowercase":
2938
- return ".nan";
2939
- case "uppercase":
2940
- return ".NAN";
2941
- case "camelcase":
2942
- return ".NaN";
2943
- }
2944
- } else if (Number.POSITIVE_INFINITY === object) {
2945
- switch (style2) {
2946
- case "lowercase":
2947
- return ".inf";
2948
- case "uppercase":
2949
- return ".INF";
2950
- case "camelcase":
2951
- return ".Inf";
2952
- }
2953
- } else if (Number.NEGATIVE_INFINITY === object) {
2954
- switch (style2) {
2955
- case "lowercase":
2956
- return "-.inf";
2957
- case "uppercase":
2958
- return "-.INF";
2959
- case "camelcase":
2960
- return "-.Inf";
2961
- }
2962
- } else if (common.isNegativeZero(object)) {
2963
- return "-0.0";
2964
- }
2965
- res = object.toString(10);
2966
- return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
2967
- }
2968
- function isFloat(object) {
2969
- return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
2970
- }
2971
- var float = new type("tag:yaml.org,2002:float", {
2972
- kind: "scalar",
2973
- resolve: resolveYamlFloat,
2974
- construct: constructYamlFloat,
2975
- predicate: isFloat,
2976
- represent: representYamlFloat,
2977
- defaultStyle: "lowercase"
2978
- });
2979
- var json = failsafe.extend({
2980
- implicit: [
2981
- _null,
2982
- bool,
2983
- int,
2984
- float
2985
- ]
2986
- });
2987
- var core = json;
2988
- var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
2989
- 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]))?))?$");
2990
- function resolveYamlTimestamp(data) {
2991
- if (data === null)
2992
- return false;
2993
- if (YAML_DATE_REGEXP.exec(data) !== null)
2994
- return true;
2995
- if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
2996
- return true;
2997
- return false;
2998
- }
2999
- function constructYamlTimestamp(data) {
3000
- var match, year2, month2, day2, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date2;
3001
- match = YAML_DATE_REGEXP.exec(data);
3002
- if (match === null)
3003
- match = YAML_TIMESTAMP_REGEXP.exec(data);
3004
- if (match === null)
3005
- throw new Error("Date resolve error");
3006
- year2 = +match[1];
3007
- month2 = +match[2] - 1;
3008
- day2 = +match[3];
3009
- if (!match[4]) {
3010
- return new Date(Date.UTC(year2, month2, day2));
3011
- }
3012
- hour = +match[4];
3013
- minute = +match[5];
3014
- second = +match[6];
3015
- if (match[7]) {
3016
- fraction = match[7].slice(0, 3);
3017
- while (fraction.length < 3) {
3018
- fraction += "0";
3019
- }
3020
- fraction = +fraction;
3021
- }
3022
- if (match[9]) {
3023
- tz_hour = +match[10];
3024
- tz_minute = +(match[11] || 0);
3025
- delta = (tz_hour * 60 + tz_minute) * 6e4;
3026
- if (match[9] === "-")
3027
- delta = -delta;
3028
- }
3029
- date2 = new Date(Date.UTC(year2, month2, day2, hour, minute, second, fraction));
3030
- if (delta)
3031
- date2.setTime(date2.getTime() - delta);
3032
- return date2;
3033
- }
3034
- function representYamlTimestamp(object) {
3035
- return object.toISOString();
3036
- }
3037
- var timestamp = new type("tag:yaml.org,2002:timestamp", {
3038
- kind: "scalar",
3039
- resolve: resolveYamlTimestamp,
3040
- construct: constructYamlTimestamp,
3041
- instanceOf: Date,
3042
- represent: representYamlTimestamp
3043
- });
3044
- function resolveYamlMerge(data) {
3045
- return data === "<<" || data === null;
3046
- }
3047
- var merge = new type("tag:yaml.org,2002:merge", {
3048
- kind: "scalar",
3049
- resolve: resolveYamlMerge
3050
- });
3051
- var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
3052
- function resolveYamlBinary(data) {
3053
- if (data === null)
3054
- return false;
3055
- var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
3056
- for (idx = 0; idx < max; idx++) {
3057
- code = map2.indexOf(data.charAt(idx));
3058
- if (code > 64)
3059
- continue;
3060
- if (code < 0)
3061
- return false;
3062
- bitlen += 6;
3063
- }
3064
- return bitlen % 8 === 0;
3065
- }
3066
- function constructYamlBinary(data) {
3067
- var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
3068
- for (idx = 0; idx < max; idx++) {
3069
- if (idx % 4 === 0 && idx) {
3070
- result.push(bits >> 16 & 255);
3071
- result.push(bits >> 8 & 255);
3072
- result.push(bits & 255);
3073
- }
3074
- bits = bits << 6 | map2.indexOf(input.charAt(idx));
3075
- }
3076
- tailbits = max % 4 * 6;
3077
- if (tailbits === 0) {
3078
- result.push(bits >> 16 & 255);
3079
- result.push(bits >> 8 & 255);
3080
- result.push(bits & 255);
3081
- } else if (tailbits === 18) {
3082
- result.push(bits >> 10 & 255);
3083
- result.push(bits >> 2 & 255);
3084
- } else if (tailbits === 12) {
3085
- result.push(bits >> 4 & 255);
3086
- }
3087
- return new Uint8Array(result);
3088
- }
3089
- function representYamlBinary(object) {
3090
- var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
3091
- for (idx = 0; idx < max; idx++) {
3092
- if (idx % 3 === 0 && idx) {
3093
- result += map2[bits >> 18 & 63];
3094
- result += map2[bits >> 12 & 63];
3095
- result += map2[bits >> 6 & 63];
3096
- result += map2[bits & 63];
3097
- }
3098
- bits = (bits << 8) + object[idx];
3099
- }
3100
- tail = max % 3;
3101
- if (tail === 0) {
3102
- result += map2[bits >> 18 & 63];
3103
- result += map2[bits >> 12 & 63];
3104
- result += map2[bits >> 6 & 63];
3105
- result += map2[bits & 63];
3106
- } else if (tail === 2) {
3107
- result += map2[bits >> 10 & 63];
3108
- result += map2[bits >> 4 & 63];
3109
- result += map2[bits << 2 & 63];
3110
- result += map2[64];
3111
- } else if (tail === 1) {
3112
- result += map2[bits >> 2 & 63];
3113
- result += map2[bits << 4 & 63];
3114
- result += map2[64];
3115
- result += map2[64];
3116
- }
3117
- return result;
3118
- }
3119
- function isBinary(obj) {
3120
- return Object.prototype.toString.call(obj) === "[object Uint8Array]";
3121
- }
3122
- var binary = new type("tag:yaml.org,2002:binary", {
3123
- kind: "scalar",
3124
- resolve: resolveYamlBinary,
3125
- construct: constructYamlBinary,
3126
- predicate: isBinary,
3127
- represent: representYamlBinary
3128
- });
3129
- var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
3130
- var _toString$2 = Object.prototype.toString;
3131
- function resolveYamlOmap(data) {
3132
- if (data === null)
3133
- return true;
3134
- var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
3135
- for (index = 0, length = object.length; index < length; index += 1) {
3136
- pair = object[index];
3137
- pairHasKey = false;
3138
- if (_toString$2.call(pair) !== "[object Object]")
3139
- return false;
3140
- for (pairKey in pair) {
3141
- if (_hasOwnProperty$3.call(pair, pairKey)) {
3142
- if (!pairHasKey)
3143
- pairHasKey = true;
3144
- else
3145
- return false;
3146
- }
3147
- }
3148
- if (!pairHasKey)
3149
- return false;
3150
- if (objectKeys.indexOf(pairKey) === -1)
3151
- objectKeys.push(pairKey);
3152
- else
3153
- return false;
3154
- }
3155
- return true;
3156
- }
3157
- function constructYamlOmap(data) {
3158
- return data !== null ? data : [];
3159
- }
3160
- var omap = new type("tag:yaml.org,2002:omap", {
3161
- kind: "sequence",
3162
- resolve: resolveYamlOmap,
3163
- construct: constructYamlOmap
3164
- });
3165
- var _toString$1 = Object.prototype.toString;
3166
- function resolveYamlPairs(data) {
3167
- if (data === null)
3168
- return true;
3169
- var index, length, pair, keys, result, object = data;
3170
- result = new Array(object.length);
3171
- for (index = 0, length = object.length; index < length; index += 1) {
3172
- pair = object[index];
3173
- if (_toString$1.call(pair) !== "[object Object]")
3174
- return false;
3175
- keys = Object.keys(pair);
3176
- if (keys.length !== 1)
3177
- return false;
3178
- result[index] = [keys[0], pair[keys[0]]];
3179
- }
3180
- return true;
3181
- }
3182
- function constructYamlPairs(data) {
3183
- if (data === null)
3184
- return [];
3185
- var index, length, pair, keys, result, object = data;
3186
- result = new Array(object.length);
3187
- for (index = 0, length = object.length; index < length; index += 1) {
3188
- pair = object[index];
3189
- keys = Object.keys(pair);
3190
- result[index] = [keys[0], pair[keys[0]]];
3191
- }
3192
- return result;
3193
- }
3194
- var pairs = new type("tag:yaml.org,2002:pairs", {
3195
- kind: "sequence",
3196
- resolve: resolveYamlPairs,
3197
- construct: constructYamlPairs
3198
- });
3199
- var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
3200
- function resolveYamlSet(data) {
3201
- if (data === null)
3202
- return true;
3203
- var key, object = data;
3204
- for (key in object) {
3205
- if (_hasOwnProperty$2.call(object, key)) {
3206
- if (object[key] !== null)
3207
- return false;
3208
- }
3209
- }
3210
- return true;
3211
- }
3212
- function constructYamlSet(data) {
3213
- return data !== null ? data : {};
3214
- }
3215
- var set = new type("tag:yaml.org,2002:set", {
3216
- kind: "mapping",
3217
- resolve: resolveYamlSet,
3218
- construct: constructYamlSet
3219
- });
3220
- var _default = core.extend({
3221
- implicit: [
3222
- timestamp,
3223
- merge
3224
- ],
3225
- explicit: [
3226
- binary,
3227
- omap,
3228
- pairs,
3229
- set
3230
- ]
3231
- });
3232
- var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
3233
- var CONTEXT_FLOW_IN = 1;
3234
- var CONTEXT_FLOW_OUT = 2;
3235
- var CONTEXT_BLOCK_IN = 3;
3236
- var CONTEXT_BLOCK_OUT = 4;
3237
- var CHOMPING_CLIP = 1;
3238
- var CHOMPING_STRIP = 2;
3239
- var CHOMPING_KEEP = 3;
3240
- var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
3241
- var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
3242
- var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
3243
- var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
3244
- var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
3245
- function _class(obj) {
3246
- return Object.prototype.toString.call(obj);
3247
- }
3248
- function is_EOL(c2) {
3249
- return c2 === 10 || c2 === 13;
3250
- }
3251
- function is_WHITE_SPACE(c2) {
3252
- return c2 === 9 || c2 === 32;
3253
- }
3254
- function is_WS_OR_EOL(c2) {
3255
- return c2 === 9 || c2 === 32 || c2 === 10 || c2 === 13;
3256
- }
3257
- function is_FLOW_INDICATOR(c2) {
3258
- return c2 === 44 || c2 === 91 || c2 === 93 || c2 === 123 || c2 === 125;
3259
- }
3260
- function fromHexCode(c2) {
3261
- var lc;
3262
- if (48 <= c2 && c2 <= 57) {
3263
- return c2 - 48;
3264
- }
3265
- lc = c2 | 32;
3266
- if (97 <= lc && lc <= 102) {
3267
- return lc - 97 + 10;
3268
- }
3269
- return -1;
3270
- }
3271
- function escapedHexLen(c2) {
3272
- if (c2 === 120) {
3273
- return 2;
3274
- }
3275
- if (c2 === 117) {
3276
- return 4;
3277
- }
3278
- if (c2 === 85) {
3279
- return 8;
3280
- }
3281
- return 0;
3282
- }
3283
- function fromDecimalCode(c2) {
3284
- if (48 <= c2 && c2 <= 57) {
3285
- return c2 - 48;
3286
- }
3287
- return -1;
3288
- }
3289
- function simpleEscapeSequence(c2) {
3290
- return c2 === 48 ? "\0" : c2 === 97 ? "\x07" : c2 === 98 ? "\b" : c2 === 116 ? " " : c2 === 9 ? " " : c2 === 110 ? "\n" : c2 === 118 ? "\v" : c2 === 102 ? "\f" : c2 === 114 ? "\r" : c2 === 101 ? "\x1B" : c2 === 32 ? " " : c2 === 34 ? '"' : c2 === 47 ? "/" : c2 === 92 ? "\\" : c2 === 78 ? "\x85" : c2 === 95 ? "\xA0" : c2 === 76 ? "\u2028" : c2 === 80 ? "\u2029" : "";
3291
- }
3292
- function charFromCodepoint(c2) {
3293
- if (c2 <= 65535) {
3294
- return String.fromCharCode(c2);
3295
- }
3296
- return String.fromCharCode((c2 - 65536 >> 10) + 55296, (c2 - 65536 & 1023) + 56320);
3297
- }
3298
- var simpleEscapeCheck = new Array(256);
3299
- var simpleEscapeMap = new Array(256);
3300
- for (i = 0; i < 256; i++) {
3301
- simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
3302
- simpleEscapeMap[i] = simpleEscapeSequence(i);
3303
- }
3304
- var i;
3305
- function State$1(input, options) {
3306
- this.input = input;
3307
- this.filename = options["filename"] || null;
3308
- this.schema = options["schema"] || _default;
3309
- this.onWarning = options["onWarning"] || null;
3310
- this.legacy = options["legacy"] || false;
3311
- this.json = options["json"] || false;
3312
- this.listener = options["listener"] || null;
3313
- this.implicitTypes = this.schema.compiledImplicit;
3314
- this.typeMap = this.schema.compiledTypeMap;
3315
- this.length = input.length;
3316
- this.position = 0;
3317
- this.line = 0;
3318
- this.lineStart = 0;
3319
- this.lineIndent = 0;
3320
- this.firstTabInLine = -1;
3321
- this.documents = [];
3322
- }
3323
- function generateError(state, message) {
3324
- var mark = {
3325
- name: state.filename,
3326
- buffer: state.input.slice(0, -1),
3327
- position: state.position,
3328
- line: state.line,
3329
- column: state.position - state.lineStart
3330
- };
3331
- mark.snippet = snippet(mark);
3332
- return new exception(message, mark);
3333
- }
3334
- function throwError(state, message) {
3335
- throw generateError(state, message);
3336
- }
3337
- function throwWarning(state, message) {
3338
- if (state.onWarning) {
3339
- state.onWarning.call(null, generateError(state, message));
3340
- }
3341
- }
3342
- var directiveHandlers = {
3343
- YAML: function handleYamlDirective(state, name, args) {
3344
- var match, major, minor;
3345
- if (state.version !== null) {
3346
- throwError(state, "duplication of %YAML directive");
3347
- }
3348
- if (args.length !== 1) {
3349
- throwError(state, "YAML directive accepts exactly one argument");
3350
- }
3351
- match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
3352
- if (match === null) {
3353
- throwError(state, "ill-formed argument of the YAML directive");
3354
- }
3355
- major = parseInt(match[1], 10);
3356
- minor = parseInt(match[2], 10);
3357
- if (major !== 1) {
3358
- throwError(state, "unacceptable YAML version of the document");
3359
- }
3360
- state.version = args[0];
3361
- state.checkLineBreaks = minor < 2;
3362
- if (minor !== 1 && minor !== 2) {
3363
- throwWarning(state, "unsupported YAML version of the document");
3364
- }
3365
- },
3366
- TAG: function handleTagDirective(state, name, args) {
3367
- var handle, prefix;
3368
- if (args.length !== 2) {
3369
- throwError(state, "TAG directive accepts exactly two arguments");
3370
- }
3371
- handle = args[0];
3372
- prefix = args[1];
3373
- if (!PATTERN_TAG_HANDLE.test(handle)) {
3374
- throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
3375
- }
3376
- if (_hasOwnProperty$1.call(state.tagMap, handle)) {
3377
- throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
3378
- }
3379
- if (!PATTERN_TAG_URI.test(prefix)) {
3380
- throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
3381
- }
3382
- try {
3383
- prefix = decodeURIComponent(prefix);
3384
- } catch (err) {
3385
- throwError(state, "tag prefix is malformed: " + prefix);
3386
- }
3387
- state.tagMap[handle] = prefix;
3388
- }
3389
- };
3390
- function captureSegment(state, start, end, checkJson) {
3391
- var _position, _length, _character, _result;
3392
- if (start < end) {
3393
- _result = state.input.slice(start, end);
3394
- if (checkJson) {
3395
- for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
3396
- _character = _result.charCodeAt(_position);
3397
- if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
3398
- throwError(state, "expected valid JSON character");
3399
- }
3400
- }
3401
- } else if (PATTERN_NON_PRINTABLE.test(_result)) {
3402
- throwError(state, "the stream contains non-printable characters");
3403
- }
3404
- state.result += _result;
3405
- }
3406
- }
3407
- function mergeMappings(state, destination, source, overridableKeys) {
3408
- var sourceKeys, key, index, quantity;
3409
- if (!common.isObject(source)) {
3410
- throwError(state, "cannot merge mappings; the provided source object is unacceptable");
3411
- }
3412
- sourceKeys = Object.keys(source);
3413
- for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
3414
- key = sourceKeys[index];
3415
- if (!_hasOwnProperty$1.call(destination, key)) {
3416
- destination[key] = source[key];
3417
- overridableKeys[key] = true;
3418
- }
3419
- }
3420
- }
3421
- function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
3422
- var index, quantity;
3423
- if (Array.isArray(keyNode)) {
3424
- keyNode = Array.prototype.slice.call(keyNode);
3425
- for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
3426
- if (Array.isArray(keyNode[index])) {
3427
- throwError(state, "nested arrays are not supported inside keys");
3428
- }
3429
- if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
3430
- keyNode[index] = "[object Object]";
3431
- }
3432
- }
3433
- }
3434
- if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
3435
- keyNode = "[object Object]";
3436
- }
3437
- keyNode = String(keyNode);
3438
- if (_result === null) {
3439
- _result = {};
3440
- }
3441
- if (keyTag === "tag:yaml.org,2002:merge") {
3442
- if (Array.isArray(valueNode)) {
3443
- for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
3444
- mergeMappings(state, _result, valueNode[index], overridableKeys);
3445
- }
3446
- } else {
3447
- mergeMappings(state, _result, valueNode, overridableKeys);
3448
- }
3449
- } else {
3450
- if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
3451
- state.line = startLine || state.line;
3452
- state.lineStart = startLineStart || state.lineStart;
3453
- state.position = startPos || state.position;
3454
- throwError(state, "duplicated mapping key");
3455
- }
3456
- if (keyNode === "__proto__") {
3457
- Object.defineProperty(_result, keyNode, {
3458
- configurable: true,
3459
- enumerable: true,
3460
- writable: true,
3461
- value: valueNode
3462
- });
3463
- } else {
3464
- _result[keyNode] = valueNode;
3465
- }
3466
- delete overridableKeys[keyNode];
3467
- }
3468
- return _result;
3469
- }
3470
- function readLineBreak(state) {
3471
- var ch;
3472
- ch = state.input.charCodeAt(state.position);
3473
- if (ch === 10) {
3474
- state.position++;
3475
- } else if (ch === 13) {
3476
- state.position++;
3477
- if (state.input.charCodeAt(state.position) === 10) {
3478
- state.position++;
3479
- }
3480
- } else {
3481
- throwError(state, "a line break is expected");
3482
- }
3483
- state.line += 1;
3484
- state.lineStart = state.position;
3485
- state.firstTabInLine = -1;
3486
- }
3487
- function skipSeparationSpace(state, allowComments, checkIndent) {
3488
- var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
3489
- while (ch !== 0) {
3490
- while (is_WHITE_SPACE(ch)) {
3491
- if (ch === 9 && state.firstTabInLine === -1) {
3492
- state.firstTabInLine = state.position;
3493
- }
3494
- ch = state.input.charCodeAt(++state.position);
3495
- }
3496
- if (allowComments && ch === 35) {
3497
- do {
3498
- ch = state.input.charCodeAt(++state.position);
3499
- } while (ch !== 10 && ch !== 13 && ch !== 0);
3500
- }
3501
- if (is_EOL(ch)) {
3502
- readLineBreak(state);
3503
- ch = state.input.charCodeAt(state.position);
3504
- lineBreaks++;
3505
- state.lineIndent = 0;
3506
- while (ch === 32) {
3507
- state.lineIndent++;
3508
- ch = state.input.charCodeAt(++state.position);
3509
- }
3510
- } else {
3511
- break;
3512
- }
3513
- }
3514
- if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
3515
- throwWarning(state, "deficient indentation");
3516
- }
3517
- return lineBreaks;
3518
- }
3519
- function testDocumentSeparator(state) {
3520
- var _position = state.position, ch;
3521
- ch = state.input.charCodeAt(_position);
3522
- if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
3523
- _position += 3;
3524
- ch = state.input.charCodeAt(_position);
3525
- if (ch === 0 || is_WS_OR_EOL(ch)) {
3526
- return true;
3527
- }
3528
- }
3529
- return false;
3530
- }
3531
- function writeFoldedLines(state, count) {
3532
- if (count === 1) {
3533
- state.result += " ";
3534
- } else if (count > 1) {
3535
- state.result += common.repeat("\n", count - 1);
3536
- }
3537
- }
3538
- function readPlainScalar(state, nodeIndent, withinFlowCollection) {
3539
- var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
3540
- ch = state.input.charCodeAt(state.position);
3541
- 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) {
3542
- return false;
3543
- }
3544
- if (ch === 63 || ch === 45) {
3545
- following = state.input.charCodeAt(state.position + 1);
3546
- if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
3547
- return false;
3548
- }
3549
- }
3550
- state.kind = "scalar";
3551
- state.result = "";
3552
- captureStart = captureEnd = state.position;
3553
- hasPendingContent = false;
3554
- while (ch !== 0) {
3555
- if (ch === 58) {
3556
- following = state.input.charCodeAt(state.position + 1);
3557
- if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
3558
- break;
3559
- }
3560
- } else if (ch === 35) {
3561
- preceding = state.input.charCodeAt(state.position - 1);
3562
- if (is_WS_OR_EOL(preceding)) {
3563
- break;
3564
- }
3565
- } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
3566
- break;
3567
- } else if (is_EOL(ch)) {
3568
- _line = state.line;
3569
- _lineStart = state.lineStart;
3570
- _lineIndent = state.lineIndent;
3571
- skipSeparationSpace(state, false, -1);
3572
- if (state.lineIndent >= nodeIndent) {
3573
- hasPendingContent = true;
3574
- ch = state.input.charCodeAt(state.position);
3575
- continue;
3576
- } else {
3577
- state.position = captureEnd;
3578
- state.line = _line;
3579
- state.lineStart = _lineStart;
3580
- state.lineIndent = _lineIndent;
3581
- break;
3582
- }
3583
- }
3584
- if (hasPendingContent) {
3585
- captureSegment(state, captureStart, captureEnd, false);
3586
- writeFoldedLines(state, state.line - _line);
3587
- captureStart = captureEnd = state.position;
3588
- hasPendingContent = false;
3589
- }
3590
- if (!is_WHITE_SPACE(ch)) {
3591
- captureEnd = state.position + 1;
3592
- }
3593
- ch = state.input.charCodeAt(++state.position);
3594
- }
3595
- captureSegment(state, captureStart, captureEnd, false);
3596
- if (state.result) {
3597
- return true;
3598
- }
3599
- state.kind = _kind;
3600
- state.result = _result;
3601
- return false;
3602
- }
3603
- function readSingleQuotedScalar(state, nodeIndent) {
3604
- var ch, captureStart, captureEnd;
3605
- ch = state.input.charCodeAt(state.position);
3606
- if (ch !== 39) {
3607
- return false;
3608
- }
3609
- state.kind = "scalar";
3610
- state.result = "";
3611
- state.position++;
3612
- captureStart = captureEnd = state.position;
3613
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
3614
- if (ch === 39) {
3615
- captureSegment(state, captureStart, state.position, true);
3616
- ch = state.input.charCodeAt(++state.position);
3617
- if (ch === 39) {
3618
- captureStart = state.position;
3619
- state.position++;
3620
- captureEnd = state.position;
3621
- } else {
3622
- return true;
3623
- }
3624
- } else if (is_EOL(ch)) {
3625
- captureSegment(state, captureStart, captureEnd, true);
3626
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
3627
- captureStart = captureEnd = state.position;
3628
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
3629
- throwError(state, "unexpected end of the document within a single quoted scalar");
3630
- } else {
3631
- state.position++;
3632
- captureEnd = state.position;
3633
- }
3634
- }
3635
- throwError(state, "unexpected end of the stream within a single quoted scalar");
3636
- }
3637
- function readDoubleQuotedScalar(state, nodeIndent) {
3638
- var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
3639
- ch = state.input.charCodeAt(state.position);
3640
- if (ch !== 34) {
3641
- return false;
3642
- }
3643
- state.kind = "scalar";
3644
- state.result = "";
3645
- state.position++;
3646
- captureStart = captureEnd = state.position;
3647
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
3648
- if (ch === 34) {
3649
- captureSegment(state, captureStart, state.position, true);
3650
- state.position++;
3651
- return true;
3652
- } else if (ch === 92) {
3653
- captureSegment(state, captureStart, state.position, true);
3654
- ch = state.input.charCodeAt(++state.position);
3655
- if (is_EOL(ch)) {
3656
- skipSeparationSpace(state, false, nodeIndent);
3657
- } else if (ch < 256 && simpleEscapeCheck[ch]) {
3658
- state.result += simpleEscapeMap[ch];
3659
- state.position++;
3660
- } else if ((tmp = escapedHexLen(ch)) > 0) {
3661
- hexLength = tmp;
3662
- hexResult = 0;
3663
- for (; hexLength > 0; hexLength--) {
3664
- ch = state.input.charCodeAt(++state.position);
3665
- if ((tmp = fromHexCode(ch)) >= 0) {
3666
- hexResult = (hexResult << 4) + tmp;
3667
- } else {
3668
- throwError(state, "expected hexadecimal character");
3669
- }
3670
- }
3671
- state.result += charFromCodepoint(hexResult);
3672
- state.position++;
3673
- } else {
3674
- throwError(state, "unknown escape sequence");
3675
- }
3676
- captureStart = captureEnd = state.position;
3677
- } else if (is_EOL(ch)) {
3678
- captureSegment(state, captureStart, captureEnd, true);
3679
- writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
3680
- captureStart = captureEnd = state.position;
3681
- } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
3682
- throwError(state, "unexpected end of the document within a double quoted scalar");
3683
- } else {
3684
- state.position++;
3685
- captureEnd = state.position;
3686
- }
3687
- }
3688
- throwError(state, "unexpected end of the stream within a double quoted scalar");
3689
- }
3690
- function readFlowCollection(state, nodeIndent) {
3691
- var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
3692
- ch = state.input.charCodeAt(state.position);
3693
- if (ch === 91) {
3694
- terminator = 93;
3695
- isMapping = false;
3696
- _result = [];
3697
- } else if (ch === 123) {
3698
- terminator = 125;
3699
- isMapping = true;
3700
- _result = {};
3701
- } else {
3702
- return false;
3703
- }
3704
- if (state.anchor !== null) {
3705
- state.anchorMap[state.anchor] = _result;
3706
- }
3707
- ch = state.input.charCodeAt(++state.position);
3708
- while (ch !== 0) {
3709
- skipSeparationSpace(state, true, nodeIndent);
3710
- ch = state.input.charCodeAt(state.position);
3711
- if (ch === terminator) {
3712
- state.position++;
3713
- state.tag = _tag;
3714
- state.anchor = _anchor;
3715
- state.kind = isMapping ? "mapping" : "sequence";
3716
- state.result = _result;
3717
- return true;
3718
- } else if (!readNext) {
3719
- throwError(state, "missed comma between flow collection entries");
3720
- } else if (ch === 44) {
3721
- throwError(state, "expected the node content, but found ','");
3722
- }
3723
- keyTag = keyNode = valueNode = null;
3724
- isPair = isExplicitPair = false;
3725
- if (ch === 63) {
3726
- following = state.input.charCodeAt(state.position + 1);
3727
- if (is_WS_OR_EOL(following)) {
3728
- isPair = isExplicitPair = true;
3729
- state.position++;
3730
- skipSeparationSpace(state, true, nodeIndent);
3731
- }
3732
- }
3733
- _line = state.line;
3734
- _lineStart = state.lineStart;
3735
- _pos = state.position;
3736
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
3737
- keyTag = state.tag;
3738
- keyNode = state.result;
3739
- skipSeparationSpace(state, true, nodeIndent);
3740
- ch = state.input.charCodeAt(state.position);
3741
- if ((isExplicitPair || state.line === _line) && ch === 58) {
3742
- isPair = true;
3743
- ch = state.input.charCodeAt(++state.position);
3744
- skipSeparationSpace(state, true, nodeIndent);
3745
- composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
3746
- valueNode = state.result;
3747
- }
3748
- if (isMapping) {
3749
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
3750
- } else if (isPair) {
3751
- _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
3752
- } else {
3753
- _result.push(keyNode);
3754
- }
3755
- skipSeparationSpace(state, true, nodeIndent);
3756
- ch = state.input.charCodeAt(state.position);
3757
- if (ch === 44) {
3758
- readNext = true;
3759
- ch = state.input.charCodeAt(++state.position);
3760
- } else {
3761
- readNext = false;
3762
- }
3763
- }
3764
- throwError(state, "unexpected end of the stream within a flow collection");
3765
- }
3766
- function readBlockScalar(state, nodeIndent) {
3767
- var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
3768
- ch = state.input.charCodeAt(state.position);
3769
- if (ch === 124) {
3770
- folding = false;
3771
- } else if (ch === 62) {
3772
- folding = true;
3773
- } else {
3774
- return false;
3775
- }
3776
- state.kind = "scalar";
3777
- state.result = "";
3778
- while (ch !== 0) {
3779
- ch = state.input.charCodeAt(++state.position);
3780
- if (ch === 43 || ch === 45) {
3781
- if (CHOMPING_CLIP === chomping) {
3782
- chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
3783
- } else {
3784
- throwError(state, "repeat of a chomping mode identifier");
3785
- }
3786
- } else if ((tmp = fromDecimalCode(ch)) >= 0) {
3787
- if (tmp === 0) {
3788
- throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
3789
- } else if (!detectedIndent) {
3790
- textIndent = nodeIndent + tmp - 1;
3791
- detectedIndent = true;
3792
- } else {
3793
- throwError(state, "repeat of an indentation width identifier");
3794
- }
3795
- } else {
3796
- break;
3797
- }
3798
- }
3799
- if (is_WHITE_SPACE(ch)) {
3800
- do {
3801
- ch = state.input.charCodeAt(++state.position);
3802
- } while (is_WHITE_SPACE(ch));
3803
- if (ch === 35) {
3804
- do {
3805
- ch = state.input.charCodeAt(++state.position);
3806
- } while (!is_EOL(ch) && ch !== 0);
3807
- }
3808
- }
3809
- while (ch !== 0) {
3810
- readLineBreak(state);
3811
- state.lineIndent = 0;
3812
- ch = state.input.charCodeAt(state.position);
3813
- while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
3814
- state.lineIndent++;
3815
- ch = state.input.charCodeAt(++state.position);
3816
- }
3817
- if (!detectedIndent && state.lineIndent > textIndent) {
3818
- textIndent = state.lineIndent;
3819
- }
3820
- if (is_EOL(ch)) {
3821
- emptyLines++;
3822
- continue;
3823
- }
3824
- if (state.lineIndent < textIndent) {
3825
- if (chomping === CHOMPING_KEEP) {
3826
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
3827
- } else if (chomping === CHOMPING_CLIP) {
3828
- if (didReadContent) {
3829
- state.result += "\n";
3830
- }
3831
- }
3832
- break;
3833
- }
3834
- if (folding) {
3835
- if (is_WHITE_SPACE(ch)) {
3836
- atMoreIndented = true;
3837
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
3838
- } else if (atMoreIndented) {
3839
- atMoreIndented = false;
3840
- state.result += common.repeat("\n", emptyLines + 1);
3841
- } else if (emptyLines === 0) {
3842
- if (didReadContent) {
3843
- state.result += " ";
3844
- }
3845
- } else {
3846
- state.result += common.repeat("\n", emptyLines);
3847
- }
3848
- } else {
3849
- state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
3850
- }
3851
- didReadContent = true;
3852
- detectedIndent = true;
3853
- emptyLines = 0;
3854
- captureStart = state.position;
3855
- while (!is_EOL(ch) && ch !== 0) {
3856
- ch = state.input.charCodeAt(++state.position);
3857
- }
3858
- captureSegment(state, captureStart, state.position, false);
3859
- }
3860
- return true;
3861
- }
3862
- function readBlockSequence(state, nodeIndent) {
3863
- var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
3864
- if (state.firstTabInLine !== -1)
3865
- return false;
3866
- if (state.anchor !== null) {
3867
- state.anchorMap[state.anchor] = _result;
3868
- }
3869
- ch = state.input.charCodeAt(state.position);
3870
- while (ch !== 0) {
3871
- if (state.firstTabInLine !== -1) {
3872
- state.position = state.firstTabInLine;
3873
- throwError(state, "tab characters must not be used in indentation");
3874
- }
3875
- if (ch !== 45) {
3876
- break;
3877
- }
3878
- following = state.input.charCodeAt(state.position + 1);
3879
- if (!is_WS_OR_EOL(following)) {
3880
- break;
3881
- }
3882
- detected = true;
3883
- state.position++;
3884
- if (skipSeparationSpace(state, true, -1)) {
3885
- if (state.lineIndent <= nodeIndent) {
3886
- _result.push(null);
3887
- ch = state.input.charCodeAt(state.position);
3888
- continue;
3889
- }
3890
- }
3891
- _line = state.line;
3892
- composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
3893
- _result.push(state.result);
3894
- skipSeparationSpace(state, true, -1);
3895
- ch = state.input.charCodeAt(state.position);
3896
- if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
3897
- throwError(state, "bad indentation of a sequence entry");
3898
- } else if (state.lineIndent < nodeIndent) {
3899
- break;
3900
- }
3901
- }
3902
- if (detected) {
3903
- state.tag = _tag;
3904
- state.anchor = _anchor;
3905
- state.kind = "sequence";
3906
- state.result = _result;
3907
- return true;
3908
- }
3909
- return false;
3910
- }
3911
- function readBlockMapping(state, nodeIndent, flowIndent) {
3912
- var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
3913
- if (state.firstTabInLine !== -1)
3914
- return false;
3915
- if (state.anchor !== null) {
3916
- state.anchorMap[state.anchor] = _result;
3917
- }
3918
- ch = state.input.charCodeAt(state.position);
3919
- while (ch !== 0) {
3920
- if (!atExplicitKey && state.firstTabInLine !== -1) {
3921
- state.position = state.firstTabInLine;
3922
- throwError(state, "tab characters must not be used in indentation");
3923
- }
3924
- following = state.input.charCodeAt(state.position + 1);
3925
- _line = state.line;
3926
- if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
3927
- if (ch === 63) {
3928
- if (atExplicitKey) {
3929
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
3930
- keyTag = keyNode = valueNode = null;
3931
- }
3932
- detected = true;
3933
- atExplicitKey = true;
3934
- allowCompact = true;
3935
- } else if (atExplicitKey) {
3936
- atExplicitKey = false;
3937
- allowCompact = true;
3938
- } else {
3939
- throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
3940
- }
3941
- state.position += 1;
3942
- ch = following;
3943
- } else {
3944
- _keyLine = state.line;
3945
- _keyLineStart = state.lineStart;
3946
- _keyPos = state.position;
3947
- if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
3948
- break;
3949
- }
3950
- if (state.line === _line) {
3951
- ch = state.input.charCodeAt(state.position);
3952
- while (is_WHITE_SPACE(ch)) {
3953
- ch = state.input.charCodeAt(++state.position);
3954
- }
3955
- if (ch === 58) {
3956
- ch = state.input.charCodeAt(++state.position);
3957
- if (!is_WS_OR_EOL(ch)) {
3958
- throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
3959
- }
3960
- if (atExplicitKey) {
3961
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
3962
- keyTag = keyNode = valueNode = null;
3963
- }
3964
- detected = true;
3965
- atExplicitKey = false;
3966
- allowCompact = false;
3967
- keyTag = state.tag;
3968
- keyNode = state.result;
3969
- } else if (detected) {
3970
- throwError(state, "can not read an implicit mapping pair; a colon is missed");
3971
- } else {
3972
- state.tag = _tag;
3973
- state.anchor = _anchor;
3974
- return true;
3975
- }
3976
- } else if (detected) {
3977
- throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
3978
- } else {
3979
- state.tag = _tag;
3980
- state.anchor = _anchor;
3981
- return true;
3982
- }
3983
- }
3984
- if (state.line === _line || state.lineIndent > nodeIndent) {
3985
- if (atExplicitKey) {
3986
- _keyLine = state.line;
3987
- _keyLineStart = state.lineStart;
3988
- _keyPos = state.position;
3989
- }
3990
- if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
3991
- if (atExplicitKey) {
3992
- keyNode = state.result;
3993
- } else {
3994
- valueNode = state.result;
3995
- }
3996
- }
3997
- if (!atExplicitKey) {
3998
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
3999
- keyTag = keyNode = valueNode = null;
4000
- }
4001
- skipSeparationSpace(state, true, -1);
4002
- ch = state.input.charCodeAt(state.position);
4003
- }
4004
- if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
4005
- throwError(state, "bad indentation of a mapping entry");
4006
- } else if (state.lineIndent < nodeIndent) {
4007
- break;
4008
- }
4009
- }
4010
- if (atExplicitKey) {
4011
- storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
4012
- }
4013
- if (detected) {
4014
- state.tag = _tag;
4015
- state.anchor = _anchor;
4016
- state.kind = "mapping";
4017
- state.result = _result;
4018
- }
4019
- return detected;
4020
- }
4021
- function readTagProperty(state) {
4022
- var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
4023
- ch = state.input.charCodeAt(state.position);
4024
- if (ch !== 33)
4025
- return false;
4026
- if (state.tag !== null) {
4027
- throwError(state, "duplication of a tag property");
4028
- }
4029
- ch = state.input.charCodeAt(++state.position);
4030
- if (ch === 60) {
4031
- isVerbatim = true;
4032
- ch = state.input.charCodeAt(++state.position);
4033
- } else if (ch === 33) {
4034
- isNamed = true;
4035
- tagHandle = "!!";
4036
- ch = state.input.charCodeAt(++state.position);
4037
- } else {
4038
- tagHandle = "!";
4039
- }
4040
- _position = state.position;
4041
- if (isVerbatim) {
4042
- do {
4043
- ch = state.input.charCodeAt(++state.position);
4044
- } while (ch !== 0 && ch !== 62);
4045
- if (state.position < state.length) {
4046
- tagName = state.input.slice(_position, state.position);
4047
- ch = state.input.charCodeAt(++state.position);
4048
- } else {
4049
- throwError(state, "unexpected end of the stream within a verbatim tag");
4050
- }
4051
- } else {
4052
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
4053
- if (ch === 33) {
4054
- if (!isNamed) {
4055
- tagHandle = state.input.slice(_position - 1, state.position + 1);
4056
- if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
4057
- throwError(state, "named tag handle cannot contain such characters");
4058
- }
4059
- isNamed = true;
4060
- _position = state.position + 1;
4061
- } else {
4062
- throwError(state, "tag suffix cannot contain exclamation marks");
4063
- }
4064
- }
4065
- ch = state.input.charCodeAt(++state.position);
4066
- }
4067
- tagName = state.input.slice(_position, state.position);
4068
- if (PATTERN_FLOW_INDICATORS.test(tagName)) {
4069
- throwError(state, "tag suffix cannot contain flow indicator characters");
4070
- }
4071
- }
4072
- if (tagName && !PATTERN_TAG_URI.test(tagName)) {
4073
- throwError(state, "tag name cannot contain such characters: " + tagName);
4074
- }
4075
- try {
4076
- tagName = decodeURIComponent(tagName);
4077
- } catch (err) {
4078
- throwError(state, "tag name is malformed: " + tagName);
4079
- }
4080
- if (isVerbatim) {
4081
- state.tag = tagName;
4082
- } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
4083
- state.tag = state.tagMap[tagHandle] + tagName;
4084
- } else if (tagHandle === "!") {
4085
- state.tag = "!" + tagName;
4086
- } else if (tagHandle === "!!") {
4087
- state.tag = "tag:yaml.org,2002:" + tagName;
4088
- } else {
4089
- throwError(state, 'undeclared tag handle "' + tagHandle + '"');
4090
- }
4091
- return true;
4092
- }
4093
- function readAnchorProperty(state) {
4094
- var _position, ch;
4095
- ch = state.input.charCodeAt(state.position);
4096
- if (ch !== 38)
4097
- return false;
4098
- if (state.anchor !== null) {
4099
- throwError(state, "duplication of an anchor property");
4100
- }
4101
- ch = state.input.charCodeAt(++state.position);
4102
- _position = state.position;
4103
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
4104
- ch = state.input.charCodeAt(++state.position);
4105
- }
4106
- if (state.position === _position) {
4107
- throwError(state, "name of an anchor node must contain at least one character");
4108
- }
4109
- state.anchor = state.input.slice(_position, state.position);
4110
- return true;
4111
- }
4112
- function readAlias(state) {
4113
- var _position, alias, ch;
4114
- ch = state.input.charCodeAt(state.position);
4115
- if (ch !== 42)
4116
- return false;
4117
- ch = state.input.charCodeAt(++state.position);
4118
- _position = state.position;
4119
- while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
4120
- ch = state.input.charCodeAt(++state.position);
4121
- }
4122
- if (state.position === _position) {
4123
- throwError(state, "name of an alias node must contain at least one character");
4124
- }
4125
- alias = state.input.slice(_position, state.position);
4126
- if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
4127
- throwError(state, 'unidentified alias "' + alias + '"');
4128
- }
4129
- state.result = state.anchorMap[alias];
4130
- skipSeparationSpace(state, true, -1);
4131
- return true;
4132
- }
4133
- function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
4134
- var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
4135
- if (state.listener !== null) {
4136
- state.listener("open", state);
4137
- }
4138
- state.tag = null;
4139
- state.anchor = null;
4140
- state.kind = null;
4141
- state.result = null;
4142
- allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
4143
- if (allowToSeek) {
4144
- if (skipSeparationSpace(state, true, -1)) {
4145
- atNewLine = true;
4146
- if (state.lineIndent > parentIndent) {
4147
- indentStatus = 1;
4148
- } else if (state.lineIndent === parentIndent) {
4149
- indentStatus = 0;
4150
- } else if (state.lineIndent < parentIndent) {
4151
- indentStatus = -1;
4152
- }
4153
- }
4154
- }
4155
- if (indentStatus === 1) {
4156
- while (readTagProperty(state) || readAnchorProperty(state)) {
4157
- if (skipSeparationSpace(state, true, -1)) {
4158
- atNewLine = true;
4159
- allowBlockCollections = allowBlockStyles;
4160
- if (state.lineIndent > parentIndent) {
4161
- indentStatus = 1;
4162
- } else if (state.lineIndent === parentIndent) {
4163
- indentStatus = 0;
4164
- } else if (state.lineIndent < parentIndent) {
4165
- indentStatus = -1;
4166
- }
4167
- } else {
4168
- allowBlockCollections = false;
4169
- }
4170
- }
4171
- }
4172
- if (allowBlockCollections) {
4173
- allowBlockCollections = atNewLine || allowCompact;
4174
- }
4175
- if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
4176
- if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
4177
- flowIndent = parentIndent;
4178
- } else {
4179
- flowIndent = parentIndent + 1;
4180
- }
4181
- blockIndent = state.position - state.lineStart;
4182
- if (indentStatus === 1) {
4183
- if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
4184
- hasContent = true;
4185
- } else {
4186
- if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
4187
- hasContent = true;
4188
- } else if (readAlias(state)) {
4189
- hasContent = true;
4190
- if (state.tag !== null || state.anchor !== null) {
4191
- throwError(state, "alias node should not have any properties");
4192
- }
4193
- } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
4194
- hasContent = true;
4195
- if (state.tag === null) {
4196
- state.tag = "?";
4197
- }
4198
- }
4199
- if (state.anchor !== null) {
4200
- state.anchorMap[state.anchor] = state.result;
4201
- }
4202
- }
4203
- } else if (indentStatus === 0) {
4204
- hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
4205
- }
4206
- }
4207
- if (state.tag === null) {
4208
- if (state.anchor !== null) {
4209
- state.anchorMap[state.anchor] = state.result;
4210
- }
4211
- } else if (state.tag === "?") {
4212
- if (state.result !== null && state.kind !== "scalar") {
4213
- throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
4214
- }
4215
- for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
4216
- type2 = state.implicitTypes[typeIndex];
4217
- if (type2.resolve(state.result)) {
4218
- state.result = type2.construct(state.result);
4219
- state.tag = type2.tag;
4220
- if (state.anchor !== null) {
4221
- state.anchorMap[state.anchor] = state.result;
4222
- }
4223
- break;
4224
- }
4225
- }
4226
- } else if (state.tag !== "!") {
4227
- if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
4228
- type2 = state.typeMap[state.kind || "fallback"][state.tag];
4229
- } else {
4230
- type2 = null;
4231
- typeList = state.typeMap.multi[state.kind || "fallback"];
4232
- for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
4233
- if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
4234
- type2 = typeList[typeIndex];
4235
- break;
4236
- }
4237
- }
4238
- }
4239
- if (!type2) {
4240
- throwError(state, "unknown tag !<" + state.tag + ">");
4241
- }
4242
- if (state.result !== null && type2.kind !== state.kind) {
4243
- throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
4244
- }
4245
- if (!type2.resolve(state.result, state.tag)) {
4246
- throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
4247
- } else {
4248
- state.result = type2.construct(state.result, state.tag);
4249
- if (state.anchor !== null) {
4250
- state.anchorMap[state.anchor] = state.result;
4251
- }
4252
- }
4253
- }
4254
- if (state.listener !== null) {
4255
- state.listener("close", state);
4256
- }
4257
- return state.tag !== null || state.anchor !== null || hasContent;
4258
- }
4259
- function readDocument(state) {
4260
- var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
4261
- state.version = null;
4262
- state.checkLineBreaks = state.legacy;
4263
- state.tagMap = /* @__PURE__ */ Object.create(null);
4264
- state.anchorMap = /* @__PURE__ */ Object.create(null);
4265
- while ((ch = state.input.charCodeAt(state.position)) !== 0) {
4266
- skipSeparationSpace(state, true, -1);
4267
- ch = state.input.charCodeAt(state.position);
4268
- if (state.lineIndent > 0 || ch !== 37) {
4269
- break;
4270
- }
4271
- hasDirectives = true;
4272
- ch = state.input.charCodeAt(++state.position);
4273
- _position = state.position;
4274
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
4275
- ch = state.input.charCodeAt(++state.position);
4276
- }
4277
- directiveName = state.input.slice(_position, state.position);
4278
- directiveArgs = [];
4279
- if (directiveName.length < 1) {
4280
- throwError(state, "directive name must not be less than one character in length");
4281
- }
4282
- while (ch !== 0) {
4283
- while (is_WHITE_SPACE(ch)) {
4284
- ch = state.input.charCodeAt(++state.position);
4285
- }
4286
- if (ch === 35) {
4287
- do {
4288
- ch = state.input.charCodeAt(++state.position);
4289
- } while (ch !== 0 && !is_EOL(ch));
4290
- break;
4291
- }
4292
- if (is_EOL(ch))
4293
- break;
4294
- _position = state.position;
4295
- while (ch !== 0 && !is_WS_OR_EOL(ch)) {
4296
- ch = state.input.charCodeAt(++state.position);
4297
- }
4298
- directiveArgs.push(state.input.slice(_position, state.position));
4299
- }
4300
- if (ch !== 0)
4301
- readLineBreak(state);
4302
- if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
4303
- directiveHandlers[directiveName](state, directiveName, directiveArgs);
4304
- } else {
4305
- throwWarning(state, 'unknown document directive "' + directiveName + '"');
4306
- }
4307
- }
4308
- skipSeparationSpace(state, true, -1);
4309
- if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
4310
- state.position += 3;
4311
- skipSeparationSpace(state, true, -1);
4312
- } else if (hasDirectives) {
4313
- throwError(state, "directives end mark is expected");
4314
- }
4315
- composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
4316
- skipSeparationSpace(state, true, -1);
4317
- if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
4318
- throwWarning(state, "non-ASCII line breaks are interpreted as content");
4319
- }
4320
- state.documents.push(state.result);
4321
- if (state.position === state.lineStart && testDocumentSeparator(state)) {
4322
- if (state.input.charCodeAt(state.position) === 46) {
4323
- state.position += 3;
4324
- skipSeparationSpace(state, true, -1);
4325
- }
4326
- return;
4327
- }
4328
- if (state.position < state.length - 1) {
4329
- throwError(state, "end of the stream or a document separator is expected");
4330
- } else {
4331
- return;
4332
- }
4333
- }
4334
- function loadDocuments(input, options) {
4335
- input = String(input);
4336
- options = options || {};
4337
- if (input.length !== 0) {
4338
- if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
4339
- input += "\n";
4340
- }
4341
- if (input.charCodeAt(0) === 65279) {
4342
- input = input.slice(1);
4343
- }
4344
- }
4345
- var state = new State$1(input, options);
4346
- var nullpos = input.indexOf("\0");
4347
- if (nullpos !== -1) {
4348
- state.position = nullpos;
4349
- throwError(state, "null byte is not allowed in input");
4350
- }
4351
- state.input += "\0";
4352
- while (state.input.charCodeAt(state.position) === 32) {
4353
- state.lineIndent += 1;
4354
- state.position += 1;
4355
- }
4356
- while (state.position < state.length - 1) {
4357
- readDocument(state);
4358
- }
4359
- return state.documents;
4360
- }
4361
- function loadAll$1(input, iterator, options) {
4362
- if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
4363
- options = iterator;
4364
- iterator = null;
4365
- }
4366
- var documents = loadDocuments(input, options);
4367
- if (typeof iterator !== "function") {
4368
- return documents;
4369
- }
4370
- for (var index = 0, length = documents.length; index < length; index += 1) {
4371
- iterator(documents[index]);
4372
- }
4373
- }
4374
- function load$1(input, options) {
4375
- var documents = loadDocuments(input, options);
4376
- if (documents.length === 0) {
4377
- return void 0;
4378
- } else if (documents.length === 1) {
4379
- return documents[0];
4380
- }
4381
- throw new exception("expected a single document in the stream, but found more");
4382
- }
4383
- var loadAll_1 = loadAll$1;
4384
- var load_1 = load$1;
4385
- var loader = {
4386
- loadAll: loadAll_1,
4387
- load: load_1
4388
- };
4389
- var _toString = Object.prototype.toString;
4390
- var _hasOwnProperty = Object.prototype.hasOwnProperty;
4391
- var CHAR_BOM = 65279;
4392
- var CHAR_TAB = 9;
4393
- var CHAR_LINE_FEED = 10;
4394
- var CHAR_CARRIAGE_RETURN = 13;
4395
- var CHAR_SPACE = 32;
4396
- var CHAR_EXCLAMATION = 33;
4397
- var CHAR_DOUBLE_QUOTE = 34;
4398
- var CHAR_SHARP = 35;
4399
- var CHAR_PERCENT = 37;
4400
- var CHAR_AMPERSAND = 38;
4401
- var CHAR_SINGLE_QUOTE = 39;
4402
- var CHAR_ASTERISK = 42;
4403
- var CHAR_COMMA = 44;
4404
- var CHAR_MINUS = 45;
4405
- var CHAR_COLON = 58;
4406
- var CHAR_EQUALS = 61;
4407
- var CHAR_GREATER_THAN = 62;
4408
- var CHAR_QUESTION = 63;
4409
- var CHAR_COMMERCIAL_AT = 64;
4410
- var CHAR_LEFT_SQUARE_BRACKET = 91;
4411
- var CHAR_RIGHT_SQUARE_BRACKET = 93;
4412
- var CHAR_GRAVE_ACCENT = 96;
4413
- var CHAR_LEFT_CURLY_BRACKET = 123;
4414
- var CHAR_VERTICAL_LINE = 124;
4415
- var CHAR_RIGHT_CURLY_BRACKET = 125;
4416
- var ESCAPE_SEQUENCES = {};
4417
- ESCAPE_SEQUENCES[0] = "\\0";
4418
- ESCAPE_SEQUENCES[7] = "\\a";
4419
- ESCAPE_SEQUENCES[8] = "\\b";
4420
- ESCAPE_SEQUENCES[9] = "\\t";
4421
- ESCAPE_SEQUENCES[10] = "\\n";
4422
- ESCAPE_SEQUENCES[11] = "\\v";
4423
- ESCAPE_SEQUENCES[12] = "\\f";
4424
- ESCAPE_SEQUENCES[13] = "\\r";
4425
- ESCAPE_SEQUENCES[27] = "\\e";
4426
- ESCAPE_SEQUENCES[34] = '\\"';
4427
- ESCAPE_SEQUENCES[92] = "\\\\";
4428
- ESCAPE_SEQUENCES[133] = "\\N";
4429
- ESCAPE_SEQUENCES[160] = "\\_";
4430
- ESCAPE_SEQUENCES[8232] = "\\L";
4431
- ESCAPE_SEQUENCES[8233] = "\\P";
4432
- var DEPRECATED_BOOLEANS_SYNTAX = [
4433
- "y",
4434
- "Y",
4435
- "yes",
4436
- "Yes",
4437
- "YES",
4438
- "on",
4439
- "On",
4440
- "ON",
4441
- "n",
4442
- "N",
4443
- "no",
4444
- "No",
4445
- "NO",
4446
- "off",
4447
- "Off",
4448
- "OFF"
4449
- ];
4450
- var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
4451
- function compileStyleMap(schema2, map2) {
4452
- var result, keys, index, length, tag, style2, type2;
4453
- if (map2 === null)
4454
- return {};
4455
- result = {};
4456
- keys = Object.keys(map2);
4457
- for (index = 0, length = keys.length; index < length; index += 1) {
4458
- tag = keys[index];
4459
- style2 = String(map2[tag]);
4460
- if (tag.slice(0, 2) === "!!") {
4461
- tag = "tag:yaml.org,2002:" + tag.slice(2);
4462
- }
4463
- type2 = schema2.compiledTypeMap["fallback"][tag];
4464
- if (type2 && _hasOwnProperty.call(type2.styleAliases, style2)) {
4465
- style2 = type2.styleAliases[style2];
4466
- }
4467
- result[tag] = style2;
4468
- }
4469
- return result;
4470
- }
4471
- function encodeHex(character) {
4472
- var string, handle, length;
4473
- string = character.toString(16).toUpperCase();
4474
- if (character <= 255) {
4475
- handle = "x";
4476
- length = 2;
4477
- } else if (character <= 65535) {
4478
- handle = "u";
4479
- length = 4;
4480
- } else if (character <= 4294967295) {
4481
- handle = "U";
4482
- length = 8;
4483
- } else {
4484
- throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
4485
- }
4486
- return "\\" + handle + common.repeat("0", length - string.length) + string;
4487
- }
4488
- var QUOTING_TYPE_SINGLE = 1;
4489
- var QUOTING_TYPE_DOUBLE = 2;
4490
- function State(options) {
4491
- this.schema = options["schema"] || _default;
4492
- this.indent = Math.max(1, options["indent"] || 2);
4493
- this.noArrayIndent = options["noArrayIndent"] || false;
4494
- this.skipInvalid = options["skipInvalid"] || false;
4495
- this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
4496
- this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
4497
- this.sortKeys = options["sortKeys"] || false;
4498
- this.lineWidth = options["lineWidth"] || 80;
4499
- this.noRefs = options["noRefs"] || false;
4500
- this.noCompatMode = options["noCompatMode"] || false;
4501
- this.condenseFlow = options["condenseFlow"] || false;
4502
- this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
4503
- this.forceQuotes = options["forceQuotes"] || false;
4504
- this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
4505
- this.implicitTypes = this.schema.compiledImplicit;
4506
- this.explicitTypes = this.schema.compiledExplicit;
4507
- this.tag = null;
4508
- this.result = "";
4509
- this.duplicates = [];
4510
- this.usedDuplicates = null;
4511
- }
4512
- function indentString(string, spaces) {
4513
- var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
4514
- while (position < length) {
4515
- next = string.indexOf("\n", position);
4516
- if (next === -1) {
4517
- line = string.slice(position);
4518
- position = length;
4519
- } else {
4520
- line = string.slice(position, next + 1);
4521
- position = next + 1;
4522
- }
4523
- if (line.length && line !== "\n")
4524
- result += ind;
4525
- result += line;
4526
- }
4527
- return result;
4528
- }
4529
- function generateNextLine(state, level) {
4530
- return "\n" + common.repeat(" ", state.indent * level);
4531
- }
4532
- function testImplicitResolving(state, str2) {
4533
- var index, length, type2;
4534
- for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
4535
- type2 = state.implicitTypes[index];
4536
- if (type2.resolve(str2)) {
4537
- return true;
4538
- }
4539
- }
4540
- return false;
4541
- }
4542
- function isWhitespace(c2) {
4543
- return c2 === CHAR_SPACE || c2 === CHAR_TAB;
4544
- }
4545
- function isPrintable(c2) {
4546
- return 32 <= c2 && c2 <= 126 || 161 <= c2 && c2 <= 55295 && c2 !== 8232 && c2 !== 8233 || 57344 <= c2 && c2 <= 65533 && c2 !== CHAR_BOM || 65536 <= c2 && c2 <= 1114111;
4547
- }
4548
- function isNsCharOrWhitespace(c2) {
4549
- return isPrintable(c2) && c2 !== CHAR_BOM && c2 !== CHAR_CARRIAGE_RETURN && c2 !== CHAR_LINE_FEED;
4550
- }
4551
- function isPlainSafe(c2, prev, inblock) {
4552
- var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c2);
4553
- var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c2);
4554
- return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c2 !== CHAR_COMMA && c2 !== CHAR_LEFT_SQUARE_BRACKET && c2 !== CHAR_RIGHT_SQUARE_BRACKET && c2 !== CHAR_LEFT_CURLY_BRACKET && c2 !== CHAR_RIGHT_CURLY_BRACKET) && c2 !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c2 === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
4555
- }
4556
- function isPlainSafeFirst(c2) {
4557
- return isPrintable(c2) && c2 !== CHAR_BOM && !isWhitespace(c2) && c2 !== CHAR_MINUS && c2 !== CHAR_QUESTION && c2 !== CHAR_COLON && c2 !== CHAR_COMMA && c2 !== CHAR_LEFT_SQUARE_BRACKET && c2 !== CHAR_RIGHT_SQUARE_BRACKET && c2 !== CHAR_LEFT_CURLY_BRACKET && c2 !== CHAR_RIGHT_CURLY_BRACKET && c2 !== CHAR_SHARP && c2 !== CHAR_AMPERSAND && c2 !== CHAR_ASTERISK && c2 !== CHAR_EXCLAMATION && c2 !== CHAR_VERTICAL_LINE && c2 !== CHAR_EQUALS && c2 !== CHAR_GREATER_THAN && c2 !== CHAR_SINGLE_QUOTE && c2 !== CHAR_DOUBLE_QUOTE && c2 !== CHAR_PERCENT && c2 !== CHAR_COMMERCIAL_AT && c2 !== CHAR_GRAVE_ACCENT;
4558
- }
4559
- function isPlainSafeLast(c2) {
4560
- return !isWhitespace(c2) && c2 !== CHAR_COLON;
4561
- }
4562
- function codePointAt(string, pos2) {
4563
- var first = string.charCodeAt(pos2), second;
4564
- if (first >= 55296 && first <= 56319 && pos2 + 1 < string.length) {
4565
- second = string.charCodeAt(pos2 + 1);
4566
- if (second >= 56320 && second <= 57343) {
4567
- return (first - 55296) * 1024 + second - 56320 + 65536;
4568
- }
4569
- }
4570
- return first;
4571
- }
4572
- function needIndentIndicator(string) {
4573
- var leadingSpaceRe = /^\n* /;
4574
- return leadingSpaceRe.test(string);
4575
- }
4576
- var STYLE_PLAIN = 1;
4577
- var STYLE_SINGLE = 2;
4578
- var STYLE_LITERAL = 3;
4579
- var STYLE_FOLDED = 4;
4580
- var STYLE_DOUBLE = 5;
4581
- function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
4582
- var i;
4583
- var char = 0;
4584
- var prevChar = null;
4585
- var hasLineBreak = false;
4586
- var hasFoldableLine = false;
4587
- var shouldTrackWidth = lineWidth !== -1;
4588
- var previousLineBreak = -1;
4589
- var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
4590
- if (singleLineOnly || forceQuotes) {
4591
- for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
4592
- char = codePointAt(string, i);
4593
- if (!isPrintable(char)) {
4594
- return STYLE_DOUBLE;
4595
- }
4596
- plain = plain && isPlainSafe(char, prevChar, inblock);
4597
- prevChar = char;
4598
- }
4599
- } else {
4600
- for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
4601
- char = codePointAt(string, i);
4602
- if (char === CHAR_LINE_FEED) {
4603
- hasLineBreak = true;
4604
- if (shouldTrackWidth) {
4605
- hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
4606
- previousLineBreak = i;
4607
- }
4608
- } else if (!isPrintable(char)) {
4609
- return STYLE_DOUBLE;
4610
- }
4611
- plain = plain && isPlainSafe(char, prevChar, inblock);
4612
- prevChar = char;
4613
- }
4614
- hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
4615
- }
4616
- if (!hasLineBreak && !hasFoldableLine) {
4617
- if (plain && !forceQuotes && !testAmbiguousType(string)) {
4618
- return STYLE_PLAIN;
4619
- }
4620
- return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
4621
- }
4622
- if (indentPerLevel > 9 && needIndentIndicator(string)) {
4623
- return STYLE_DOUBLE;
4624
- }
4625
- if (!forceQuotes) {
4626
- return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
4627
- }
4628
- return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
4629
- }
4630
- function writeScalar(state, string, level, iskey, inblock) {
4631
- state.dump = function() {
4632
- if (string.length === 0) {
4633
- return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
4634
- }
4635
- if (!state.noCompatMode) {
4636
- if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
4637
- return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
4638
- }
4639
- }
4640
- var indent = state.indent * Math.max(1, level);
4641
- var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
4642
- var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
4643
- function testAmbiguity(string2) {
4644
- return testImplicitResolving(state, string2);
4645
- }
4646
- switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
4647
- case STYLE_PLAIN:
4648
- return string;
4649
- case STYLE_SINGLE:
4650
- return "'" + string.replace(/'/g, "''") + "'";
4651
- case STYLE_LITERAL:
4652
- return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
4653
- case STYLE_FOLDED:
4654
- return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
4655
- case STYLE_DOUBLE:
4656
- return '"' + escapeString(string) + '"';
4657
- default:
4658
- throw new exception("impossible error: invalid scalar style");
4659
- }
4660
- }();
4661
- }
4662
- function blockHeader(string, indentPerLevel) {
4663
- var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
4664
- var clip = string[string.length - 1] === "\n";
4665
- var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
4666
- var chomp = keep ? "+" : clip ? "" : "-";
4667
- return indentIndicator + chomp + "\n";
4668
- }
4669
- function dropEndingNewline(string) {
4670
- return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
4671
- }
4672
- function foldString(string, width2) {
4673
- var lineRe = /(\n+)([^\n]*)/g;
4674
- var result = function() {
4675
- var nextLF = string.indexOf("\n");
4676
- nextLF = nextLF !== -1 ? nextLF : string.length;
4677
- lineRe.lastIndex = nextLF;
4678
- return foldLine(string.slice(0, nextLF), width2);
4679
- }();
4680
- var prevMoreIndented = string[0] === "\n" || string[0] === " ";
4681
- var moreIndented;
4682
- var match;
4683
- while (match = lineRe.exec(string)) {
4684
- var prefix = match[1], line = match[2];
4685
- moreIndented = line[0] === " ";
4686
- result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width2);
4687
- prevMoreIndented = moreIndented;
4688
- }
4689
- return result;
4690
- }
4691
- function foldLine(line, width2) {
4692
- if (line === "" || line[0] === " ")
4693
- return line;
4694
- var breakRe = / [^ ]/g;
4695
- var match;
4696
- var start = 0, end, curr = 0, next = 0;
4697
- var result = "";
4698
- while (match = breakRe.exec(line)) {
4699
- next = match.index;
4700
- if (next - start > width2) {
4701
- end = curr > start ? curr : next;
4702
- result += "\n" + line.slice(start, end);
4703
- start = end + 1;
4704
- }
4705
- curr = next;
4706
- }
4707
- result += "\n";
4708
- if (line.length - start > width2 && curr > start) {
4709
- result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
4710
- } else {
4711
- result += line.slice(start);
4712
- }
4713
- return result.slice(1);
4714
- }
4715
- function escapeString(string) {
4716
- var result = "";
4717
- var char = 0;
4718
- var escapeSeq;
4719
- for (var i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
4720
- char = codePointAt(string, i);
4721
- escapeSeq = ESCAPE_SEQUENCES[char];
4722
- if (!escapeSeq && isPrintable(char)) {
4723
- result += string[i];
4724
- if (char >= 65536)
4725
- result += string[i + 1];
4726
- } else {
4727
- result += escapeSeq || encodeHex(char);
4728
- }
4729
- }
4730
- return result;
4731
- }
4732
- function writeFlowSequence(state, level, object) {
4733
- var _result = "", _tag = state.tag, index, length, value;
4734
- for (index = 0, length = object.length; index < length; index += 1) {
4735
- value = object[index];
4736
- if (state.replacer) {
4737
- value = state.replacer.call(object, String(index), value);
4738
- }
4739
- if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
4740
- if (_result !== "")
4741
- _result += "," + (!state.condenseFlow ? " " : "");
4742
- _result += state.dump;
4743
- }
4744
- }
4745
- state.tag = _tag;
4746
- state.dump = "[" + _result + "]";
4747
- }
4748
- function writeBlockSequence(state, level, object, compact) {
4749
- var _result = "", _tag = state.tag, index, length, value;
4750
- for (index = 0, length = object.length; index < length; index += 1) {
4751
- value = object[index];
4752
- if (state.replacer) {
4753
- value = state.replacer.call(object, String(index), value);
4754
- }
4755
- if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
4756
- if (!compact || _result !== "") {
4757
- _result += generateNextLine(state, level);
4758
- }
4759
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
4760
- _result += "-";
4761
- } else {
4762
- _result += "- ";
4763
- }
4764
- _result += state.dump;
4765
- }
4766
- }
4767
- state.tag = _tag;
4768
- state.dump = _result || "[]";
4769
- }
4770
- function writeFlowMapping(state, level, object) {
4771
- var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
4772
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
4773
- pairBuffer = "";
4774
- if (_result !== "")
4775
- pairBuffer += ", ";
4776
- if (state.condenseFlow)
4777
- pairBuffer += '"';
4778
- objectKey = objectKeyList[index];
4779
- objectValue = object[objectKey];
4780
- if (state.replacer) {
4781
- objectValue = state.replacer.call(object, objectKey, objectValue);
4782
- }
4783
- if (!writeNode(state, level, objectKey, false, false)) {
4784
- continue;
4785
- }
4786
- if (state.dump.length > 1024)
4787
- pairBuffer += "? ";
4788
- pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
4789
- if (!writeNode(state, level, objectValue, false, false)) {
4790
- continue;
4791
- }
4792
- pairBuffer += state.dump;
4793
- _result += pairBuffer;
4794
- }
4795
- state.tag = _tag;
4796
- state.dump = "{" + _result + "}";
4797
- }
4798
- function writeBlockMapping(state, level, object, compact) {
4799
- var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
4800
- if (state.sortKeys === true) {
4801
- objectKeyList.sort();
4802
- } else if (typeof state.sortKeys === "function") {
4803
- objectKeyList.sort(state.sortKeys);
4804
- } else if (state.sortKeys) {
4805
- throw new exception("sortKeys must be a boolean or a function");
4806
- }
4807
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
4808
- pairBuffer = "";
4809
- if (!compact || _result !== "") {
4810
- pairBuffer += generateNextLine(state, level);
4811
- }
4812
- objectKey = objectKeyList[index];
4813
- objectValue = object[objectKey];
4814
- if (state.replacer) {
4815
- objectValue = state.replacer.call(object, objectKey, objectValue);
4816
- }
4817
- if (!writeNode(state, level + 1, objectKey, true, true, true)) {
4818
- continue;
4819
- }
4820
- explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
4821
- if (explicitPair) {
4822
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
4823
- pairBuffer += "?";
4824
- } else {
4825
- pairBuffer += "? ";
4826
- }
4827
- }
4828
- pairBuffer += state.dump;
4829
- if (explicitPair) {
4830
- pairBuffer += generateNextLine(state, level);
4831
- }
4832
- if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
4833
- continue;
4834
- }
4835
- if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
4836
- pairBuffer += ":";
4837
- } else {
4838
- pairBuffer += ": ";
4839
- }
4840
- pairBuffer += state.dump;
4841
- _result += pairBuffer;
4842
- }
4843
- state.tag = _tag;
4844
- state.dump = _result || "{}";
4845
- }
4846
- function detectType(state, object, explicit) {
4847
- var _result, typeList, index, length, type2, style2;
4848
- typeList = explicit ? state.explicitTypes : state.implicitTypes;
4849
- for (index = 0, length = typeList.length; index < length; index += 1) {
4850
- type2 = typeList[index];
4851
- if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
4852
- if (explicit) {
4853
- if (type2.multi && type2.representName) {
4854
- state.tag = type2.representName(object);
4855
- } else {
4856
- state.tag = type2.tag;
4857
- }
4858
- } else {
4859
- state.tag = "?";
4860
- }
4861
- if (type2.represent) {
4862
- style2 = state.styleMap[type2.tag] || type2.defaultStyle;
4863
- if (_toString.call(type2.represent) === "[object Function]") {
4864
- _result = type2.represent(object, style2);
4865
- } else if (_hasOwnProperty.call(type2.represent, style2)) {
4866
- _result = type2.represent[style2](object, style2);
4867
- } else {
4868
- throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style2 + '" style');
2225
+ if (eqSet.size > 1) {
2226
+ return null;
2227
+ }
2228
+ let gtltComp;
2229
+ if (gt && lt) {
2230
+ gtltComp = compare(gt.semver, lt.semver, options);
2231
+ if (gtltComp > 0) {
2232
+ return null;
2233
+ } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
2234
+ return null;
4869
2235
  }
4870
- state.dump = _result;
4871
2236
  }
4872
- return true;
4873
- }
4874
- }
4875
- return false;
4876
- }
4877
- function writeNode(state, level, object, block, compact, iskey, isblockseq) {
4878
- state.tag = null;
4879
- state.dump = object;
4880
- if (!detectType(state, object, false)) {
4881
- detectType(state, object, true);
4882
- }
4883
- var type2 = _toString.call(state.dump);
4884
- var inblock = block;
4885
- var tagStr;
4886
- if (block) {
4887
- block = state.flowLevel < 0 || state.flowLevel > level;
4888
- }
4889
- var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
4890
- if (objectOrArray) {
4891
- duplicateIndex = state.duplicates.indexOf(object);
4892
- duplicate = duplicateIndex !== -1;
4893
- }
4894
- if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
4895
- compact = false;
4896
- }
4897
- if (duplicate && state.usedDuplicates[duplicateIndex]) {
4898
- state.dump = "*ref_" + duplicateIndex;
4899
- } else {
4900
- if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
4901
- state.usedDuplicates[duplicateIndex] = true;
4902
- }
4903
- if (type2 === "[object Object]") {
4904
- if (block && Object.keys(state.dump).length !== 0) {
4905
- writeBlockMapping(state, level, state.dump, compact);
4906
- if (duplicate) {
4907
- state.dump = "&ref_" + duplicateIndex + state.dump;
2237
+ for (const eq of eqSet) {
2238
+ if (gt && !satisfies3(eq, String(gt), options)) {
2239
+ return null;
4908
2240
  }
4909
- } else {
4910
- writeFlowMapping(state, level, state.dump);
4911
- if (duplicate) {
4912
- state.dump = "&ref_" + duplicateIndex + " " + state.dump;
2241
+ if (lt && !satisfies3(eq, String(lt), options)) {
2242
+ return null;
2243
+ }
2244
+ for (const c2 of dom) {
2245
+ if (!satisfies3(eq, String(c2), options)) {
2246
+ return false;
2247
+ }
4913
2248
  }
2249
+ return true;
4914
2250
  }
4915
- } else if (type2 === "[object Array]") {
4916
- if (block && state.dump.length !== 0) {
4917
- if (state.noArrayIndent && !isblockseq && level > 0) {
4918
- writeBlockSequence(state, level - 1, state.dump, compact);
4919
- } else {
4920
- writeBlockSequence(state, level, state.dump, compact);
2251
+ let higher, lower;
2252
+ let hasDomLT, hasDomGT;
2253
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
2254
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
2255
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
2256
+ needDomLTPre = false;
2257
+ }
2258
+ for (const c2 of dom) {
2259
+ hasDomGT = hasDomGT || c2.operator === ">" || c2.operator === ">=";
2260
+ hasDomLT = hasDomLT || c2.operator === "<" || c2.operator === "<=";
2261
+ if (gt) {
2262
+ if (needDomGTPre) {
2263
+ if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomGTPre.major && c2.semver.minor === needDomGTPre.minor && c2.semver.patch === needDomGTPre.patch) {
2264
+ needDomGTPre = false;
2265
+ }
2266
+ }
2267
+ if (c2.operator === ">" || c2.operator === ">=") {
2268
+ higher = higherGT(gt, c2, options);
2269
+ if (higher === c2 && higher !== gt) {
2270
+ return false;
2271
+ }
2272
+ } else if (gt.operator === ">=" && !satisfies3(gt.semver, String(c2), options)) {
2273
+ return false;
2274
+ }
4921
2275
  }
4922
- if (duplicate) {
4923
- state.dump = "&ref_" + duplicateIndex + state.dump;
2276
+ if (lt) {
2277
+ if (needDomLTPre) {
2278
+ if (c2.semver.prerelease && c2.semver.prerelease.length && c2.semver.major === needDomLTPre.major && c2.semver.minor === needDomLTPre.minor && c2.semver.patch === needDomLTPre.patch) {
2279
+ needDomLTPre = false;
2280
+ }
2281
+ }
2282
+ if (c2.operator === "<" || c2.operator === "<=") {
2283
+ lower = lowerLT(lt, c2, options);
2284
+ if (lower === c2 && lower !== lt) {
2285
+ return false;
2286
+ }
2287
+ } else if (lt.operator === "<=" && !satisfies3(lt.semver, String(c2), options)) {
2288
+ return false;
2289
+ }
4924
2290
  }
4925
- } else {
4926
- writeFlowSequence(state, level, state.dump);
4927
- if (duplicate) {
4928
- state.dump = "&ref_" + duplicateIndex + " " + state.dump;
2291
+ if (!c2.operator && (lt || gt) && gtltComp !== 0) {
2292
+ return false;
4929
2293
  }
4930
2294
  }
4931
- } else if (type2 === "[object String]") {
4932
- if (state.tag !== "?") {
4933
- writeScalar(state, state.dump, level, iskey, inblock);
4934
- }
4935
- } else if (type2 === "[object Undefined]") {
4936
- return false;
4937
- } else {
4938
- if (state.skipInvalid)
2295
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
4939
2296
  return false;
4940
- throw new exception("unacceptable kind of an object to dump " + type2);
4941
- }
4942
- if (state.tag !== null && state.tag !== "?") {
4943
- tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
4944
- if (state.tag[0] === "!") {
4945
- tagStr = "!" + tagStr;
4946
- } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
4947
- tagStr = "!!" + tagStr.slice(18);
4948
- } else {
4949
- tagStr = "!<" + tagStr + ">";
4950
2297
  }
4951
- state.dump = tagStr + " " + state.dump;
4952
- }
4953
- }
4954
- return true;
4955
- }
4956
- function getDuplicateReferences(object, state) {
4957
- var objects = [], duplicatesIndexes = [], index, length;
4958
- inspectNode(object, objects, duplicatesIndexes);
4959
- for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
4960
- state.duplicates.push(objects[duplicatesIndexes[index]]);
4961
- }
4962
- state.usedDuplicates = new Array(length);
4963
- }
4964
- function inspectNode(object, objects, duplicatesIndexes) {
4965
- var objectKeyList, index, length;
4966
- if (object !== null && typeof object === "object") {
4967
- index = objects.indexOf(object);
4968
- if (index !== -1) {
4969
- if (duplicatesIndexes.indexOf(index) === -1) {
4970
- duplicatesIndexes.push(index);
2298
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
2299
+ return false;
4971
2300
  }
4972
- } else {
4973
- objects.push(object);
4974
- if (Array.isArray(object)) {
4975
- for (index = 0, length = object.length; index < length; index += 1) {
4976
- inspectNode(object[index], objects, duplicatesIndexes);
4977
- }
4978
- } else {
4979
- objectKeyList = Object.keys(object);
4980
- for (index = 0, length = objectKeyList.length; index < length; index += 1) {
4981
- inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
4982
- }
2301
+ if (needDomGTPre || needDomLTPre) {
2302
+ return false;
4983
2303
  }
4984
- }
4985
- }
4986
- }
4987
- function dump$1(input, options) {
4988
- options = options || {};
4989
- var state = new State(options);
4990
- if (!state.noRefs)
4991
- getDuplicateReferences(input, state);
4992
- var value = input;
4993
- if (state.replacer) {
4994
- value = state.replacer.call({ "": value }, "", value);
4995
- }
4996
- if (writeNode(state, 0, value, true, true))
4997
- return state.dump + "\n";
4998
- return "";
4999
- }
5000
- var dump_1 = dump$1;
5001
- var dumper = {
5002
- dump: dump_1
5003
- };
5004
- function renamed(from, to) {
5005
- return function() {
5006
- throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
5007
- };
5008
- }
5009
- var Type = type;
5010
- var Schema = schema;
5011
- var FAILSAFE_SCHEMA = failsafe;
5012
- var JSON_SCHEMA = json;
5013
- var CORE_SCHEMA = core;
5014
- var DEFAULT_SCHEMA = _default;
5015
- var load = loader.load;
5016
- var loadAll = loader.loadAll;
5017
- var dump = dumper.dump;
5018
- var YAMLException = exception;
5019
- var types = {
5020
- binary,
5021
- float,
5022
- map,
5023
- null: _null,
5024
- pairs,
5025
- set,
5026
- timestamp,
5027
- bool,
5028
- int,
5029
- merge,
5030
- omap,
5031
- seq,
5032
- str
5033
- };
5034
- var safeLoad = renamed("safeLoad", "load");
5035
- var safeLoadAll = renamed("safeLoadAll", "loadAll");
5036
- var safeDump = renamed("safeDump", "dump");
5037
- var jsYaml = {
5038
- Type,
5039
- Schema,
5040
- FAILSAFE_SCHEMA,
5041
- JSON_SCHEMA,
5042
- CORE_SCHEMA,
5043
- DEFAULT_SCHEMA,
5044
- load,
5045
- loadAll,
5046
- dump,
5047
- YAMLException,
5048
- types,
5049
- safeLoad,
5050
- safeLoadAll,
5051
- safeDump
5052
- };
5053
- var js_yaml_default = jsYaml;
5054
-
5055
- // ../parser/src/core.ts
5056
- import { isObject as isObject2, isTruthy, objectMap } from "@antfu/utils";
5057
-
5058
- // ../parser/src/config.ts
5059
- init_esm_shims();
5060
- import { toArray as toArray2, uniq as uniq2 } from "@antfu/utils";
5061
-
5062
- // ../parser/src/utils.ts
5063
- init_esm_shims();
5064
- import { isNumber, range, uniq } from "@antfu/utils";
5065
- function parseRangeString(total, rangeStr) {
5066
- if (!rangeStr || rangeStr === "all" || rangeStr === "*")
5067
- return range(1, total + 1);
5068
- const pages = [];
5069
- for (const part of rangeStr.split(/[,;]/g)) {
5070
- if (!part.includes("-")) {
5071
- pages.push(+part);
5072
- } else {
5073
- const [start, end] = part.split("-", 2);
5074
- pages.push(...range(+start, !end ? total + 1 : +end + 1));
5075
- }
5076
- }
5077
- return uniq(pages).filter((i) => i <= total).sort((a, b) => a - b);
5078
- }
5079
- function parseAspectRatio(str2) {
5080
- if (isNumber(str2))
5081
- return str2;
5082
- if (!isNaN(+str2))
5083
- return +str2;
5084
- const [wStr = "", hStr = ""] = str2.split(/[:\/x\|]/);
5085
- const w = parseFloat(wStr.trim());
5086
- const h = parseFloat(hStr.trim());
5087
- if (isNaN(w) || isNaN(h) || h === 0)
5088
- throw new Error(`Invalid aspect ratio "${str2}"`);
5089
- return w / h;
5090
- }
5091
-
5092
- // ../parser/src/config.ts
5093
- function resolveConfig(headmatter, themeMeta = {}) {
5094
- var _a, _b;
5095
- const themeHightlighter = ["prism", "shiki"].includes(themeMeta.highlighter || "") ? themeMeta.highlighter : void 0;
5096
- const themeColorSchema = ["light", "dark"].includes(themeMeta.colorSchema || "") ? themeMeta.colorSchema : void 0;
5097
- const defaultConfig2 = {
5098
- theme: "default",
5099
- title: "Slidev",
5100
- titleTemplate: "%s - Slidev",
5101
- remoteAssets: false,
5102
- monaco: "dev",
5103
- download: false,
5104
- info: false,
5105
- highlighter: themeHightlighter || "prism",
5106
- lineNumbers: false,
5107
- colorSchema: themeColorSchema || "auto",
5108
- routerMode: "history",
5109
- aspectRatio: 16 / 9,
5110
- canvasWidth: 980,
5111
- exportFilename: "",
5112
- selectable: false,
5113
- themeConfig: {},
5114
- fonts: {},
5115
- favicon: "https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png",
5116
- drawings: {},
5117
- plantUmlServer: "https://www.plantuml.com/plantuml",
5118
- record: "dev"
5119
- };
5120
- const config2 = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, defaultConfig2), themeMeta.defaults), headmatter.config), headmatter), {
5121
- 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)),
5122
- drawings: resolveDrawings(headmatter.drawings)
5123
- });
5124
- if (config2.colorSchema !== "dark" && config2.colorSchema !== "light")
5125
- config2.colorSchema = "auto";
5126
- if (themeColorSchema && config2.colorSchema === "auto")
5127
- config2.colorSchema = themeColorSchema;
5128
- config2.aspectRatio = parseAspectRatio(config2.aspectRatio);
5129
- if (themeColorSchema && config2.colorSchema !== themeColorSchema)
5130
- console.warn(`[slidev] Color schema "${config2.colorSchema}" does not supported by the theme`);
5131
- if (themeHightlighter && config2.highlighter !== themeHightlighter)
5132
- console.warn(`[slidev] Syntax highlighter "${config2.highlighter}" does not supported by the theme`);
5133
- return config2;
5134
- }
5135
- function resolveFonts(fonts = {}) {
5136
- const {
5137
- fallbacks = true,
5138
- italic = false,
5139
- provider = "google"
5140
- } = fonts;
5141
- let sans = toArray2(fonts.sans).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
5142
- let serif = toArray2(fonts.serif).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
5143
- let mono = toArray2(fonts.mono).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
5144
- const weights = toArray2(fonts.weights || "200,400,600").flatMap((i) => i.toString().split(/,\s*/g)).map((i) => i.trim());
5145
- const custom = toArray2(fonts.custom).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
5146
- const local = toArray2(fonts.local).flatMap((i) => i.split(/,\s*/g)).map((i) => i.trim());
5147
- const webfonts = fonts.webfonts ? fonts.webfonts : fallbacks ? uniq2([...sans, ...serif, ...mono, ...custom]) : [];
5148
- webfonts.filter((i) => local.includes(i));
5149
- function toQuoted(font) {
5150
- if (/^(['"]).*\1$/.test(font))
5151
- return font;
5152
- return `"${font}"`;
5153
- }
5154
- if (fallbacks) {
5155
- sans = uniq2([
5156
- ...sans.map(toQuoted),
5157
- "ui-sans-serif",
5158
- "system-ui",
5159
- "-apple-system",
5160
- "BlinkMacSystemFont",
5161
- '"Segoe UI"',
5162
- "Roboto",
5163
- '"Helvetica Neue"',
5164
- "Arial",
5165
- '"Noto Sans"',
5166
- "sans-serif",
5167
- '"Apple Color Emoji"',
5168
- '"Segoe UI Emoji"',
5169
- '"Segoe UI Symbol"',
5170
- '"Noto Color Emoji"'
5171
- ]);
5172
- serif = uniq2([
5173
- ...serif.map(toQuoted),
5174
- "ui-serif",
5175
- "Georgia",
5176
- "Cambria",
5177
- '"Times New Roman"',
5178
- "Times",
5179
- "serif"
5180
- ]);
5181
- mono = uniq2([
5182
- ...mono.map(toQuoted),
5183
- "ui-monospace",
5184
- "SFMono-Regular",
5185
- "Menlo",
5186
- "Monaco",
5187
- "Consolas",
5188
- '"Liberation Mono"',
5189
- '"Courier New"',
5190
- "monospace"
5191
- ]);
5192
- }
5193
- return {
5194
- sans,
5195
- serif,
5196
- mono,
5197
- webfonts,
5198
- provider,
5199
- local,
5200
- italic,
5201
- weights
5202
- };
5203
- }
5204
- function resolveDrawings(options = {}) {
5205
- const {
5206
- enabled = true,
5207
- persist = false,
5208
- presenterOnly = false,
5209
- syncAll = true
5210
- } = options;
5211
- const persistPath = typeof persist === "string" ? persist : persist ? ".slidev/drawings" : false;
5212
- return {
5213
- enabled,
5214
- persist: persistPath,
5215
- presenterOnly,
5216
- syncAll
5217
- };
5218
- }
5219
-
5220
- // ../parser/src/core.ts
5221
- function stringify(data) {
5222
- return `${data.slides.filter((slide) => slide.source === void 0 || slide.inline !== void 0).map((slide, idx) => stringifySlide(slide.inline || slide, idx)).join("\n").trim()}
5223
- `;
5224
- }
5225
- function filterDisabled(data) {
5226
- data.slides = data.slides.filter((i) => {
5227
- var _a;
5228
- return !((_a = i.frontmatter) == null ? void 0 : _a.disabled);
5229
- });
5230
- return data;
5231
- }
5232
- function stringifySlide(data, idx = 0) {
5233
- if (data.raw == null)
5234
- prettifySlide(data);
5235
- return data.raw.startsWith("---") || idx === 0 ? data.raw : `---
5236
- ${data.raw.startsWith("\n") ? data.raw : `
5237
- ${data.raw}`}`;
5238
- }
5239
- function prettifySlide(data) {
5240
- data.content = `
5241
- ${data.content.trim()}
5242
- `;
5243
- data.raw = Object.keys(data.frontmatter || {}).length ? `---
5244
- ${js_yaml_default.dump(data.frontmatter).trim()}
5245
- ---
5246
- ${data.content}` : data.content;
5247
- if (data.note)
5248
- data.raw += `
5249
- <!--
5250
- ${data.note.trim()}
5251
- -->
5252
- `;
5253
- else
5254
- data.raw += "\n";
5255
- return data;
5256
- }
5257
- function prettify(data) {
5258
- data.slides.forEach(prettifySlide);
5259
- return data;
5260
- }
5261
- function matter(code) {
5262
- let data = {};
5263
- const content = code.replace(/^---.*\r?\n([\s\S]*?)---/, (_, d) => {
5264
- data = js_yaml_default.load(d);
5265
- if (!isObject2(data))
5266
- data = {};
5267
- return "";
5268
- });
5269
- return { data, content };
5270
- }
5271
- function detectFeatures(code) {
5272
- return {
5273
- katex: !!code.match(/\$.*?\$/) || !!code.match(/$\$\$/),
5274
- monaco: !!code.match(/{monaco.*}/),
5275
- tweet: !!code.match(/<Tweet\b/),
5276
- mermaid: !!code.match(/^```mermaid/m)
5277
- };
5278
- }
5279
- function parseSlide(raw) {
5280
- var _a, _b;
5281
- const result = matter(raw);
5282
- let note;
5283
- const frontmatter = result.data || {};
5284
- let content = result.content.trim();
5285
- const comments = Array.from(content.matchAll(/<!--([\s\S]*?)-->/g));
5286
- if (comments.length) {
5287
- const last = comments[comments.length - 1];
5288
- if (last.index && last.index + last[0].length >= content.length) {
5289
- note = last[1].trim();
5290
- content = content.slice(0, last.index).trim();
5291
- }
5292
- }
5293
- let title;
5294
- let level;
5295
- if (frontmatter.title || frontmatter.name) {
5296
- title = frontmatter.title || frontmatter.name;
5297
- level = frontmatter.level || 1;
5298
- } else {
5299
- const match = content.match(/^(#+) (.*)$/m);
5300
- title = (_a = match == null ? void 0 : match[2]) == null ? void 0 : _a.trim();
5301
- level = (_b = match == null ? void 0 : match[1]) == null ? void 0 : _b.length;
5302
- }
5303
- return {
5304
- raw,
5305
- title,
5306
- level,
5307
- content,
5308
- frontmatter,
5309
- note
5310
- };
5311
- }
5312
- function parse(markdown, filepath, themeMeta) {
5313
- var _a, _b;
5314
- const lines2 = markdown.split(/\r?\n/g);
5315
- const slides = [];
5316
- let start = 0;
5317
- function slice(end) {
5318
- if (start === end)
5319
- return;
5320
- const raw = lines2.slice(start, end).join("\n");
5321
- slides.push(__spreadProps(__spreadValues({}, parseSlide(raw)), {
5322
- index: slides.length,
5323
- start,
5324
- end
5325
- }));
5326
- start = end + 1;
5327
- }
5328
- for (let i = 0; i < lines2.length; i++) {
5329
- const line = lines2[i].trimEnd();
5330
- if (line.match(/^---+/)) {
5331
- slice(i);
5332
- const next = lines2[i + 1];
5333
- if (line.match(/^---([^-].*)?$/) && !(next == null ? void 0 : next.match(/^\s*$/))) {
5334
- start = i;
5335
- for (i += 1; i < lines2.length; i++) {
5336
- if (lines2[i].trimEnd().match(/^---$/))
5337
- break;
5338
- }
2304
+ return true;
2305
+ };
2306
+ var higherGT = (a, b, options) => {
2307
+ if (!a) {
2308
+ return b;
5339
2309
  }
5340
- } else if (line.startsWith("```")) {
5341
- for (i += 1; i < lines2.length; i++) {
5342
- if (lines2[i].startsWith("```"))
5343
- break;
2310
+ const comp = compare(a.semver, b.semver, options);
2311
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
2312
+ };
2313
+ var lowerLT = (a, b, options) => {
2314
+ if (!a) {
2315
+ return b;
5344
2316
  }
5345
- }
2317
+ const comp = compare(a.semver, b.semver, options);
2318
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
2319
+ };
2320
+ module.exports = subset;
5346
2321
  }
5347
- if (start <= lines2.length - 1)
5348
- slice(lines2.length);
5349
- const headmatter = ((_a = slides[0]) == null ? void 0 : _a.frontmatter) || {};
5350
- headmatter.title = headmatter.title || ((_b = slides[0]) == null ? void 0 : _b.title);
5351
- const config2 = resolveConfig(headmatter, themeMeta);
5352
- const features = detectFeatures(markdown);
5353
- return {
5354
- raw: markdown,
5355
- filepath,
5356
- slides,
5357
- config: config2,
5358
- features,
5359
- headmatter,
5360
- themeMeta
5361
- };
5362
- }
5363
- function mergeFeatureFlags(a, b) {
5364
- return objectMap(a, (k, v) => [k, v || b[k]]);
5365
- }
5366
- function scanMonacoModules(md) {
5367
- const typeModules = /* @__PURE__ */ new Set();
5368
- md.replace(/^```(\w+?)\s*{monaco([\w:,-]*)}[\s\n]*([\s\S]+?)^```/mg, (full, lang = "ts", options, code) => {
5369
- options = options || "";
5370
- lang = lang.trim();
5371
- if (lang === "ts" || lang === "typescript") {
5372
- Array.from(code.matchAll(/\s+from\s+(["'])([\/\w@-]+)\1/g)).map((i) => i[2]).filter(isTruthy).map((i) => typeModules.add(i));
5373
- }
5374
- return "";
5375
- });
5376
- return Array.from(typeModules);
5377
- }
2322
+ });
5378
2323
 
5379
- // ../parser/src/fs.ts
5380
- async function load2(filepath, themeMeta, content) {
5381
- const dir = dirname(filepath);
5382
- const markdown = content != null ? content : await fs.readFile(filepath, "utf-8");
5383
- const data = parse(markdown, filepath, themeMeta);
5384
- const entries = /* @__PURE__ */ new Set([
5385
- filepath
5386
- ]);
5387
- for (let iSlide = 0; iSlide < data.slides.length; ) {
5388
- const baseSlide = data.slides[iSlide];
5389
- if (!baseSlide.frontmatter.src) {
5390
- iSlide++;
5391
- continue;
5392
- }
5393
- data.slides.splice(iSlide, 1);
5394
- const srcExpression = baseSlide.frontmatter.src;
5395
- const path2 = resolve(dir, srcExpression);
5396
- const raw = await fs.readFile(path2, "utf-8");
5397
- const subSlides = parse(raw, path2, themeMeta);
5398
- for (const [offset, subSlide] of subSlides.slides.entries()) {
5399
- const slide = __spreadValues({}, baseSlide);
5400
- slide.source = __spreadValues({
5401
- filepath: path2
5402
- }, subSlide);
5403
- if (offset === 0 && !baseSlide.frontmatter.srcSequence) {
5404
- slide.inline = __spreadValues({}, baseSlide);
5405
- delete slide.inline.frontmatter.src;
5406
- Object.assign(slide, slide.source, { raw: null });
5407
- } else {
5408
- Object.assign(slide, slide.source);
5409
- }
5410
- const baseSlideFrontMatterWithoutSrc = __spreadValues({}, baseSlide.frontmatter);
5411
- delete baseSlideFrontMatterWithoutSrc.src;
5412
- slide.frontmatter = __spreadProps(__spreadValues(__spreadValues({}, subSlide.frontmatter), baseSlideFrontMatterWithoutSrc), {
5413
- srcSequence: `${baseSlide.frontmatter.srcSequence ? `${baseSlide.frontmatter.srcSequence},` : ""}${srcExpression}`
5414
- });
5415
- data.features = mergeFeatureFlags(data.features, detectFeatures(raw));
5416
- entries.add(path2);
5417
- data.slides.splice(iSlide + offset, 0, slide);
5418
- }
2324
+ // ../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/index.js
2325
+ var require_semver2 = __commonJS({
2326
+ "../../node_modules/.pnpm/semver@7.3.7/node_modules/semver/index.js"(exports, module) {
2327
+ init_esm_shims();
2328
+ var internalRe = require_re();
2329
+ module.exports = {
2330
+ re: internalRe.re,
2331
+ src: internalRe.src,
2332
+ tokens: internalRe.t,
2333
+ SEMVER_SPEC_VERSION: require_constants().SEMVER_SPEC_VERSION,
2334
+ SemVer: require_semver(),
2335
+ compareIdentifiers: require_identifiers().compareIdentifiers,
2336
+ rcompareIdentifiers: require_identifiers().rcompareIdentifiers,
2337
+ parse: require_parse(),
2338
+ valid: require_valid(),
2339
+ clean: require_clean(),
2340
+ inc: require_inc(),
2341
+ diff: require_diff(),
2342
+ major: require_major(),
2343
+ minor: require_minor(),
2344
+ patch: require_patch(),
2345
+ prerelease: require_prerelease(),
2346
+ compare: require_compare(),
2347
+ rcompare: require_rcompare(),
2348
+ compareLoose: require_compare_loose(),
2349
+ compareBuild: require_compare_build(),
2350
+ sort: require_sort(),
2351
+ rsort: require_rsort(),
2352
+ gt: require_gt(),
2353
+ lt: require_lt(),
2354
+ eq: require_eq(),
2355
+ neq: require_neq(),
2356
+ gte: require_gte(),
2357
+ lte: require_lte(),
2358
+ cmp: require_cmp(),
2359
+ coerce: require_coerce(),
2360
+ Comparator: require_comparator(),
2361
+ Range: require_range(),
2362
+ satisfies: require_satisfies(),
2363
+ toComparators: require_to_comparators(),
2364
+ maxSatisfying: require_max_satisfying(),
2365
+ minSatisfying: require_min_satisfying(),
2366
+ minVersion: require_min_version(),
2367
+ validRange: require_valid2(),
2368
+ outside: require_outside(),
2369
+ gtr: require_gtr(),
2370
+ ltr: require_ltr(),
2371
+ intersects: require_intersects(),
2372
+ simplifyRange: require_simplify(),
2373
+ subset: require_subset()
2374
+ };
5419
2375
  }
5420
- for (let iSlide = 0; iSlide < data.slides.length; iSlide++)
5421
- data.slides[iSlide].index = iSlide === 0 ? 0 : 1 + data.slides[iSlide - 1].index;
5422
- data.entries = Array.from(entries);
5423
- return data;
5424
- }
5425
- async function save(data, filepath) {
5426
- filepath = filepath || data.filepath;
5427
- await fs.writeFile(filepath, stringify(data), "utf-8");
5428
- }
5429
- async function saveExternalSlide(slide) {
5430
- await fs.writeFile(slide.filepath, stringifySlide(slide), "utf-8");
2376
+ });
2377
+
2378
+ // node/server.ts
2379
+ init_esm_shims();
2380
+ import { join } from "path";
2381
+ import { createServer as createViteServer, mergeConfig, resolveConfig } from "vite";
2382
+ async function createServer(options, viteConfig = {}, serverOptions = {}) {
2383
+ const rawConfig = await resolveConfig({}, "serve");
2384
+ const pluginOptions = rawConfig.slidev || {};
2385
+ process.env.EDITOR = process.env.EDITOR || "code";
2386
+ const server = await createViteServer(mergeConfig(viteConfig, {
2387
+ optimizeDeps: {
2388
+ entries: [
2389
+ join(options.clientRoot, "main.ts")
2390
+ ]
2391
+ },
2392
+ plugins: [
2393
+ await ViteSlidevPlugin(options, pluginOptions, serverOptions)
2394
+ ]
2395
+ }));
2396
+ return server;
5431
2397
  }
5432
2398
 
5433
2399
  // node/parser.ts
5434
2400
  init_esm_shims();
2401
+ import * as parser from "@slidev/parser/fs";
5435
2402
 
5436
2403
  // package.json
5437
- var version = "0.31.2";
2404
+ var version = "0.32.1";
5438
2405
 
5439
2406
  // node/themes.ts
5440
2407
  init_esm_shims();
@@ -5445,7 +2412,7 @@ init_esm_shims();
5445
2412
 
5446
2413
  // ../../node_modules/.pnpm/@antfu+ni@0.16.2/node_modules/@antfu/ni/dist/chunks/runner.mjs
5447
2414
  init_esm_shims();
5448
- import require$$0, { resolve as resolve2 } from "path";
2415
+ import require$$0, { resolve } from "path";
5449
2416
  import require$$0$5 from "readline";
5450
2417
  import require$$2 from "events";
5451
2418
  import { Buffer as Buffer$1 } from "buffer";
@@ -5598,11 +2565,11 @@ function checkMode(stat, options) {
5598
2565
  var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
5599
2566
  return ret;
5600
2567
  }
5601
- var core2;
2568
+ var core;
5602
2569
  if (process.platform === "win32" || commonjsGlobal.TESTING_WINDOWS) {
5603
- core2 = windows;
2570
+ core = windows;
5604
2571
  } else {
5605
- core2 = mode;
2572
+ core = mode;
5606
2573
  }
5607
2574
  var isexe_1 = isexe$1;
5608
2575
  isexe$1.sync = sync;
@@ -5615,17 +2582,17 @@ function isexe$1(path2, options, cb) {
5615
2582
  if (typeof Promise !== "function") {
5616
2583
  throw new TypeError("callback not provided");
5617
2584
  }
5618
- return new Promise(function(resolve4, reject) {
2585
+ return new Promise(function(resolve3, reject) {
5619
2586
  isexe$1(path2, options || {}, function(er, is) {
5620
2587
  if (er) {
5621
2588
  reject(er);
5622
2589
  } else {
5623
- resolve4(is);
2590
+ resolve3(is);
5624
2591
  }
5625
2592
  });
5626
2593
  });
5627
2594
  }
5628
- core2(path2, options || {}, function(er, is) {
2595
+ core(path2, options || {}, function(er, is) {
5629
2596
  if (er) {
5630
2597
  if (er.code === "EACCES" || options && options.ignoreErrors) {
5631
2598
  er = null;
@@ -5637,7 +2604,7 @@ function isexe$1(path2, options, cb) {
5637
2604
  }
5638
2605
  function sync(path2, options) {
5639
2606
  try {
5640
- return core2.sync(path2, options || {});
2607
+ return core.sync(path2, options || {});
5641
2608
  } catch (er) {
5642
2609
  if (options && options.ignoreErrors || er.code === "EACCES") {
5643
2610
  return false;
@@ -5678,27 +2645,27 @@ var which$1 = (cmd, opt, cb) => {
5678
2645
  opt = {};
5679
2646
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
5680
2647
  const found = [];
5681
- const step = (i) => new Promise((resolve4, reject) => {
2648
+ const step = (i) => new Promise((resolve3, reject) => {
5682
2649
  if (i === pathEnv.length)
5683
- return opt.all && found.length ? resolve4(found) : reject(getNotFoundError(cmd));
2650
+ return opt.all && found.length ? resolve3(found) : reject(getNotFoundError(cmd));
5684
2651
  const ppRaw = pathEnv[i];
5685
2652
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
5686
2653
  const pCmd = path$2.join(pathPart, cmd);
5687
2654
  const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
5688
- resolve4(subStep(p, i, 0));
2655
+ resolve3(subStep(p, i, 0));
5689
2656
  });
5690
- const subStep = (p, i, ii) => new Promise((resolve4, reject) => {
2657
+ const subStep = (p, i, ii) => new Promise((resolve3, reject) => {
5691
2658
  if (ii === pathExt.length)
5692
- return resolve4(step(i + 1));
2659
+ return resolve3(step(i + 1));
5693
2660
  const ext = pathExt[ii];
5694
2661
  isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
5695
2662
  if (!er && is) {
5696
2663
  if (opt.all)
5697
2664
  found.push(p + ext);
5698
2665
  else
5699
- return resolve4(p + ext);
2666
+ return resolve3(p + ext);
5700
2667
  }
5701
- return resolve4(subStep(p, i, ii + 1));
2668
+ return resolve3(subStep(p, i, ii + 1));
5702
2669
  });
5703
2670
  });
5704
2671
  return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
@@ -5828,13 +2795,13 @@ var encode = (obj, opt) => {
5828
2795
  }
5829
2796
  return out;
5830
2797
  };
5831
- var dotSplit = (str2) => str2.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map((part) => part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, ""));
5832
- var decode = (str2) => {
2798
+ var dotSplit = (str) => str.replace(/\1/g, "LITERAL\\1LITERAL").replace(/\\\./g, "").split(/\./).map((part) => part.replace(/\1/g, "\\.").replace(/\2LITERAL\\1LITERAL\2/g, ""));
2799
+ var decode = (str) => {
5833
2800
  const out = /* @__PURE__ */ Object.create(null);
5834
2801
  let p = out;
5835
2802
  let section = null;
5836
2803
  const re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i;
5837
- const lines2 = str2.split(/[\r\n]+/g);
2804
+ const lines2 = str.split(/[\r\n]+/g);
5838
2805
  for (const line of lines2) {
5839
2806
  if (!line || line.match(/^\s*[;#]/)) {
5840
2807
  continue;
@@ -6022,18 +2989,18 @@ function pLimit(concurrency) {
6022
2989
  queue.dequeue()();
6023
2990
  }
6024
2991
  };
6025
- const run2 = async (fn, resolve4, args) => {
2992
+ const run2 = async (fn, resolve3, args) => {
6026
2993
  activeCount++;
6027
2994
  const result = (async () => fn(...args))();
6028
- resolve4(result);
2995
+ resolve3(result);
6029
2996
  try {
6030
2997
  await result;
6031
2998
  } catch {
6032
2999
  }
6033
3000
  next();
6034
3001
  };
6035
- const enqueue = (fn, resolve4, args) => {
6036
- queue.enqueue(run2.bind(void 0, fn, resolve4, args));
3002
+ const enqueue = (fn, resolve3, args) => {
3003
+ queue.enqueue(run2.bind(void 0, fn, resolve3, args));
6037
3004
  (async () => {
6038
3005
  await Promise.resolve();
6039
3006
  if (activeCount < concurrency && queue.size > 0) {
@@ -6041,8 +3008,8 @@ function pLimit(concurrency) {
6041
3008
  }
6042
3009
  })();
6043
3010
  };
6044
- const generator = (fn, ...args) => new Promise((resolve4) => {
6045
- enqueue(fn, resolve4, args);
3011
+ const generator = (fn, ...args) => new Promise((resolve3) => {
3012
+ enqueue(fn, resolve3, args);
6046
3013
  });
6047
3014
  Object.defineProperties(generator, {
6048
3015
  activeCount: {
@@ -6093,28 +3060,28 @@ var typeMappings = {
6093
3060
  directory: "isDirectory",
6094
3061
  file: "isFile"
6095
3062
  };
6096
- function checkType(type2) {
6097
- if (type2 in typeMappings) {
3063
+ function checkType(type) {
3064
+ if (type in typeMappings) {
6098
3065
  return;
6099
3066
  }
6100
- throw new Error(`Invalid type specified: ${type2}`);
3067
+ throw new Error(`Invalid type specified: ${type}`);
6101
3068
  }
6102
- var matchType = (type2, stat) => type2 === void 0 || stat[typeMappings[type2]]();
3069
+ var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
6103
3070
  var toPath$1 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
6104
3071
  async function locatePath(paths, {
6105
3072
  cwd = process$2.cwd(),
6106
- type: type2 = "file",
3073
+ type = "file",
6107
3074
  allowSymlinks = true,
6108
3075
  concurrency,
6109
3076
  preserveOrder
6110
3077
  } = {}) {
6111
- checkType(type2);
3078
+ checkType(type);
6112
3079
  cwd = toPath$1(cwd);
6113
3080
  const statFunction = allowSymlinks ? promises.stat : promises.lstat;
6114
3081
  return pLocate(paths, async (path_) => {
6115
3082
  try {
6116
3083
  const stat = await statFunction(path$3.resolve(cwd, path_));
6117
- return matchType(type2, stat);
3084
+ return matchType(type, stat);
6118
3085
  } catch {
6119
3086
  return false;
6120
3087
  }
@@ -6268,22 +3235,22 @@ var shebangCommand$1 = (string = "") => {
6268
3235
  return null;
6269
3236
  }
6270
3237
  const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
6271
- const binary2 = path2.split("/").pop();
6272
- if (binary2 === "env") {
3238
+ const binary = path2.split("/").pop();
3239
+ if (binary === "env") {
6273
3240
  return argument;
6274
3241
  }
6275
- return argument ? `${binary2} ${argument}` : binary2;
3242
+ return argument ? `${binary} ${argument}` : binary;
6276
3243
  };
6277
- var fs2 = fs$3;
3244
+ var fs = fs$3;
6278
3245
  var shebangCommand = shebangCommand$1;
6279
3246
  function readShebang$1(command) {
6280
3247
  const size = 150;
6281
3248
  const buffer = Buffer.alloc(size);
6282
3249
  let fd;
6283
3250
  try {
6284
- fd = fs2.openSync(command, "r");
6285
- fs2.readSync(fd, buffer, 0, size, 0);
6286
- fs2.closeSync(fd);
3251
+ fd = fs.openSync(command, "r");
3252
+ fs.readSync(fd, buffer, 0, size, 0);
3253
+ fs.closeSync(fd);
6287
3254
  } catch (e) {
6288
3255
  }
6289
3256
  return shebangCommand(buffer.toString());
@@ -6388,16 +3355,16 @@ var enoent$1 = {
6388
3355
  notFoundError
6389
3356
  };
6390
3357
  var cp = require$$0$1;
6391
- var parse2 = parse_1;
3358
+ var parse = parse_1;
6392
3359
  var enoent = enoent$1;
6393
3360
  function spawn(command, args, options) {
6394
- const parsed = parse2(command, args, options);
3361
+ const parsed = parse(command, args, options);
6395
3362
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
6396
3363
  enoent.hookChildProcess(spawned, parsed);
6397
3364
  return spawned;
6398
3365
  }
6399
3366
  function spawnSync(command, args, options) {
6400
- const parsed = parse2(command, args, options);
3367
+ const parsed = parse(command, args, options);
6401
3368
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
6402
3369
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
6403
3370
  return result;
@@ -6405,7 +3372,7 @@ function spawnSync(command, args, options) {
6405
3372
  crossSpawn$1.exports = spawn;
6406
3373
  crossSpawn$1.exports.spawn = spawn;
6407
3374
  crossSpawn$1.exports.sync = spawnSync;
6408
- crossSpawn$1.exports._parse = parse2;
3375
+ crossSpawn$1.exports._parse = parse;
6409
3376
  crossSpawn$1.exports._enoent = enoent;
6410
3377
  var crossSpawn = crossSpawn$1.exports;
6411
3378
  function stripFinalNewline(input) {
@@ -7016,7 +3983,7 @@ if (!processOk(process$1)) {
7016
3983
  }
7017
3984
  assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
7018
3985
  if (loaded === false) {
7019
- load3();
3986
+ load();
7020
3987
  }
7021
3988
  var ev = "exit";
7022
3989
  if (opts && opts.alwaysLast) {
@@ -7076,7 +4043,7 @@ if (!processOk(process$1)) {
7076
4043
  return signals;
7077
4044
  };
7078
4045
  loaded = false;
7079
- load3 = function load4() {
4046
+ load = function load2() {
7080
4047
  if (loaded || !processOk(commonjsGlobal.process)) {
7081
4048
  return;
7082
4049
  }
@@ -7093,7 +4060,7 @@ if (!processOk(process$1)) {
7093
4060
  process$1.emit = processEmit;
7094
4061
  process$1.reallyExit = processReallyExit;
7095
4062
  };
7096
- signalExit.exports.load = load3;
4063
+ signalExit.exports.load = load;
7097
4064
  originalProcessReallyExit = process$1.reallyExit;
7098
4065
  processReallyExit = function processReallyExit2(code) {
7099
4066
  if (!processOk(commonjsGlobal.process)) {
@@ -7128,7 +4095,7 @@ var unload;
7128
4095
  var emit;
7129
4096
  var sigListeners;
7130
4097
  var loaded;
7131
- var load3;
4098
+ var load;
7132
4099
  var originalProcessReallyExit;
7133
4100
  var processReallyExit;
7134
4101
  var originalProcessEmit;
@@ -7178,7 +4145,7 @@ var setupTimeout = (spawned, { timeout, killSignal = "SIGTERM" }, spawnedPromise
7178
4145
  return spawnedPromise;
7179
4146
  }
7180
4147
  let timeoutId;
7181
- const timeoutPromise = new Promise((resolve4, reject) => {
4148
+ const timeoutPromise = new Promise((resolve3, reject) => {
7182
4149
  timeoutId = setTimeout(() => {
7183
4150
  timeoutKill(spawned, killSignal, reject);
7184
4151
  }, timeout);
@@ -7266,7 +4233,7 @@ async function getStream(inputStream, options) {
7266
4233
  }, options);
7267
4234
  const { maxBuffer } = options;
7268
4235
  const stream2 = bufferStream(options);
7269
- await new Promise((resolve4, reject) => {
4236
+ await new Promise((resolve3, reject) => {
7270
4237
  const rejectPromise = (error) => {
7271
4238
  if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
7272
4239
  error.bufferedData = stream2.getBufferedValue();
@@ -7276,7 +4243,7 @@ async function getStream(inputStream, options) {
7276
4243
  (async () => {
7277
4244
  try {
7278
4245
  await streamPipelinePromisified(inputStream, stream2);
7279
- resolve4();
4246
+ resolve3();
7280
4247
  } catch (error) {
7281
4248
  rejectPromise(error);
7282
4249
  }
@@ -7398,9 +4365,9 @@ var mergePromise = (spawned, promise) => {
7398
4365
  }
7399
4366
  return spawned;
7400
4367
  };
7401
- var getSpawnedPromise = (spawned) => new Promise((resolve4, reject) => {
4368
+ var getSpawnedPromise = (spawned) => new Promise((resolve3, reject) => {
7402
4369
  spawned.on("exit", (exitCode, signal) => {
7403
- resolve4({ exitCode, signal });
4370
+ resolve3({ exitCode, signal });
7404
4371
  });
7405
4372
  spawned.on("error", (error) => {
7406
4373
  reject(error);
@@ -7889,17 +4856,17 @@ var $ = {
7889
4856
  bgCyan: init(46, 49),
7890
4857
  bgWhite: init(47, 49)
7891
4858
  };
7892
- function run$1(arr, str2) {
4859
+ function run$1(arr, str) {
7893
4860
  let i = 0, tmp, beg = "", end = "";
7894
4861
  for (; i < arr.length; i++) {
7895
4862
  tmp = arr[i];
7896
4863
  beg += tmp.open;
7897
4864
  end += tmp.close;
7898
- if (str2.includes(tmp.close)) {
7899
- str2 = str2.replace(tmp.rgx, tmp.close + tmp.open);
4865
+ if (str.includes(tmp.close)) {
4866
+ str = str.replace(tmp.rgx, tmp.close + tmp.open);
7900
4867
  }
7901
4868
  }
7902
- return beg + str2 + end;
4869
+ return beg + str + end;
7903
4870
  }
7904
4871
  function chain(has, keys) {
7905
4872
  let ctx = { has, keys };
@@ -7999,10 +4966,10 @@ var action$3 = (key, isSelect) => {
7999
4966
  return "left";
8000
4967
  return false;
8001
4968
  };
8002
- var strip$5 = (str2) => {
4969
+ var strip$5 = (str) => {
8003
4970
  const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|");
8004
4971
  const RGX = new RegExp(pattern, "g");
8005
- return typeof str2 === "string" ? str2.replace(RGX, "") : str2;
4972
+ return typeof str === "string" ? str.replace(RGX, "") : str;
8006
4973
  };
8007
4974
  var ESC = "\x1B";
8008
4975
  var CSI = `${ESC}[`;
@@ -8121,7 +5088,7 @@ var strip$4 = strip$5;
8121
5088
  var _require$a = src;
8122
5089
  var erase$d = _require$a.erase;
8123
5090
  var cursor$l = _require$a.cursor;
8124
- var width$1 = (str2) => [...strip$4(str2)].length;
5091
+ var width$1 = (str) => [...strip$4(str)].length;
8125
5092
  var clear$j = function(prompt2, perLine) {
8126
5093
  if (!perLine)
8127
5094
  return erase$d.line + cursor$l.to(0);
@@ -8190,7 +5157,7 @@ var styles$1 = Object.freeze({
8190
5157
  render: (input) => `${input}`
8191
5158
  }
8192
5159
  });
8193
- var render$1 = (type2) => styles$1[type2] || styles$1.default;
5160
+ var render$1 = (type) => styles$1[type] || styles$1.default;
8194
5161
  var symbols$1 = Object.freeze({
8195
5162
  aborted: c$1.red(figures$g.cross),
8196
5163
  done: c$1.green(figures$g.tick),
@@ -8270,10 +5237,10 @@ var Prompt$h = class extends EventEmitter$1 {
8270
5237
  if (this.in.isTTY)
8271
5238
  this.in.setRawMode(true);
8272
5239
  const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
8273
- const keypress = (str2, key) => {
5240
+ const keypress = (str, key) => {
8274
5241
  let a = action$2(key, isSelect);
8275
5242
  if (a === false) {
8276
- this._ && this._(str2, key);
5243
+ this._ && this._(str, key);
8277
5244
  } else if (typeof this[a] === "function") {
8278
5245
  this[a](key);
8279
5246
  } else {
@@ -8308,7 +5275,7 @@ var Prompt$h = class extends EventEmitter$1 {
8308
5275
  }
8309
5276
  };
8310
5277
  var prompt$3 = Prompt$h;
8311
- function asyncGeneratorStep$4(gen, resolve4, reject, _next, _throw, key, arg) {
5278
+ function asyncGeneratorStep$4(gen, resolve3, reject, _next, _throw, key, arg) {
8312
5279
  try {
8313
5280
  var info = gen[key](arg);
8314
5281
  var value = info.value;
@@ -8317,7 +5284,7 @@ function asyncGeneratorStep$4(gen, resolve4, reject, _next, _throw, key, arg) {
8317
5284
  return;
8318
5285
  }
8319
5286
  if (info.done) {
8320
- resolve4(value);
5287
+ resolve3(value);
8321
5288
  } else {
8322
5289
  Promise.resolve(value).then(_next, _throw);
8323
5290
  }
@@ -8325,13 +5292,13 @@ function asyncGeneratorStep$4(gen, resolve4, reject, _next, _throw, key, arg) {
8325
5292
  function _asyncToGenerator$4(fn) {
8326
5293
  return function() {
8327
5294
  var self2 = this, args = arguments;
8328
- return new Promise(function(resolve4, reject) {
5295
+ return new Promise(function(resolve3, reject) {
8329
5296
  var gen = fn.apply(self2, args);
8330
5297
  function _next(value) {
8331
- asyncGeneratorStep$4(gen, resolve4, reject, _next, _throw, "next", value);
5298
+ asyncGeneratorStep$4(gen, resolve3, reject, _next, _throw, "next", value);
8332
5299
  }
8333
5300
  function _throw(err) {
8334
- asyncGeneratorStep$4(gen, resolve4, reject, _next, _throw, "throw", err);
5301
+ asyncGeneratorStep$4(gen, resolve3, reject, _next, _throw, "throw", err);
8335
5302
  }
8336
5303
  _next(void 0);
8337
5304
  });
@@ -8977,7 +5944,7 @@ var dateparts$1 = {
8977
5944
  Seconds: seconds$1,
8978
5945
  Year: year$1
8979
5946
  };
8980
- function asyncGeneratorStep$3(gen, resolve4, reject, _next, _throw, key, arg) {
5947
+ function asyncGeneratorStep$3(gen, resolve3, reject, _next, _throw, key, arg) {
8981
5948
  try {
8982
5949
  var info = gen[key](arg);
8983
5950
  var value = info.value;
@@ -8986,7 +5953,7 @@ function asyncGeneratorStep$3(gen, resolve4, reject, _next, _throw, key, arg) {
8986
5953
  return;
8987
5954
  }
8988
5955
  if (info.done) {
8989
- resolve4(value);
5956
+ resolve3(value);
8990
5957
  } else {
8991
5958
  Promise.resolve(value).then(_next, _throw);
8992
5959
  }
@@ -8994,13 +5961,13 @@ function asyncGeneratorStep$3(gen, resolve4, reject, _next, _throw, key, arg) {
8994
5961
  function _asyncToGenerator$3(fn) {
8995
5962
  return function() {
8996
5963
  var self2 = this, args = arguments;
8997
- return new Promise(function(resolve4, reject) {
5964
+ return new Promise(function(resolve3, reject) {
8998
5965
  var gen = fn.apply(self2, args);
8999
5966
  function _next(value) {
9000
- asyncGeneratorStep$3(gen, resolve4, reject, _next, _throw, "next", value);
5967
+ asyncGeneratorStep$3(gen, resolve3, reject, _next, _throw, "next", value);
9001
5968
  }
9002
5969
  function _throw(err) {
9003
- asyncGeneratorStep$3(gen, resolve4, reject, _next, _throw, "throw", err);
5970
+ asyncGeneratorStep$3(gen, resolve3, reject, _next, _throw, "throw", err);
9004
5971
  }
9005
5972
  _next(void 0);
9006
5973
  });
@@ -9196,7 +6163,7 @@ ${i ? ` ` : figures$d.pointerSmall} ${color$f.red().italic(l)}`, ``);
9196
6163
  }
9197
6164
  };
9198
6165
  var date$1 = DatePrompt$1;
9199
- function asyncGeneratorStep$2(gen, resolve4, reject, _next, _throw, key, arg) {
6166
+ function asyncGeneratorStep$2(gen, resolve3, reject, _next, _throw, key, arg) {
9200
6167
  try {
9201
6168
  var info = gen[key](arg);
9202
6169
  var value = info.value;
@@ -9205,7 +6172,7 @@ function asyncGeneratorStep$2(gen, resolve4, reject, _next, _throw, key, arg) {
9205
6172
  return;
9206
6173
  }
9207
6174
  if (info.done) {
9208
- resolve4(value);
6175
+ resolve3(value);
9209
6176
  } else {
9210
6177
  Promise.resolve(value).then(_next, _throw);
9211
6178
  }
@@ -9213,13 +6180,13 @@ function asyncGeneratorStep$2(gen, resolve4, reject, _next, _throw, key, arg) {
9213
6180
  function _asyncToGenerator$2(fn) {
9214
6181
  return function() {
9215
6182
  var self2 = this, args = arguments;
9216
- return new Promise(function(resolve4, reject) {
6183
+ return new Promise(function(resolve3, reject) {
9217
6184
  var gen = fn.apply(self2, args);
9218
6185
  function _next(value) {
9219
- asyncGeneratorStep$2(gen, resolve4, reject, _next, _throw, "next", value);
6186
+ asyncGeneratorStep$2(gen, resolve3, reject, _next, _throw, "next", value);
9220
6187
  }
9221
6188
  function _throw(err) {
9222
- asyncGeneratorStep$2(gen, resolve4, reject, _next, _throw, "throw", err);
6189
+ asyncGeneratorStep$2(gen, resolve3, reject, _next, _throw, "throw", err);
9223
6190
  }
9224
6191
  _next(void 0);
9225
6192
  });
@@ -9640,7 +6607,7 @@ Instructions:
9640
6607
  }
9641
6608
  };
9642
6609
  var multiselect$1 = MultiselectPrompt$3;
9643
- function asyncGeneratorStep$1(gen, resolve4, reject, _next, _throw, key, arg) {
6610
+ function asyncGeneratorStep$1(gen, resolve3, reject, _next, _throw, key, arg) {
9644
6611
  try {
9645
6612
  var info = gen[key](arg);
9646
6613
  var value = info.value;
@@ -9649,7 +6616,7 @@ function asyncGeneratorStep$1(gen, resolve4, reject, _next, _throw, key, arg) {
9649
6616
  return;
9650
6617
  }
9651
6618
  if (info.done) {
9652
- resolve4(value);
6619
+ resolve3(value);
9653
6620
  } else {
9654
6621
  Promise.resolve(value).then(_next, _throw);
9655
6622
  }
@@ -9657,13 +6624,13 @@ function asyncGeneratorStep$1(gen, resolve4, reject, _next, _throw, key, arg) {
9657
6624
  function _asyncToGenerator$1(fn) {
9658
6625
  return function() {
9659
6626
  var self2 = this, args = arguments;
9660
- return new Promise(function(resolve4, reject) {
6627
+ return new Promise(function(resolve3, reject) {
9661
6628
  var gen = fn.apply(self2, args);
9662
6629
  function _next(value) {
9663
- asyncGeneratorStep$1(gen, resolve4, reject, _next, _throw, "next", value);
6630
+ asyncGeneratorStep$1(gen, resolve3, reject, _next, _throw, "next", value);
9664
6631
  }
9665
6632
  function _throw(err) {
9666
- asyncGeneratorStep$1(gen, resolve4, reject, _next, _throw, "throw", err);
6633
+ asyncGeneratorStep$1(gen, resolve3, reject, _next, _throw, "throw", err);
9667
6634
  }
9668
6635
  _next(void 0);
9669
6636
  });
@@ -10141,9 +7108,9 @@ var elements$1 = {
10141
7108
  const $2 = exports;
10142
7109
  const el = elements$1;
10143
7110
  const noop2 = (v) => v;
10144
- function toPrompt(type2, args, opts = {}) {
7111
+ function toPrompt(type, args, opts = {}) {
10145
7112
  return new Promise((res, rej) => {
10146
- const p = new el[type2](args);
7113
+ const p = new el[type](args);
10147
7114
  const onAbort = opts.onAbort || noop2;
10148
7115
  const onSubmit = opts.onSubmit || noop2;
10149
7116
  const onExit2 = opts.onExit || noop2;
@@ -10168,7 +7135,7 @@ var elements$1 = {
10168
7135
  $2.list = (args) => {
10169
7136
  const sep = args.separator || ",";
10170
7137
  return toPrompt("TextPrompt", args, {
10171
- onSubmit: (str2) => str2.split(sep).map((s) => s.trim())
7138
+ onSubmit: (str) => str.split(sep).map((s) => s.trim())
10172
7139
  });
10173
7140
  };
10174
7141
  $2.toggle = (args) => toPrompt("TogglePrompt", args);
@@ -10293,7 +7260,7 @@ function _arrayLikeToArray(arr, len) {
10293
7260
  arr2[i] = arr[i];
10294
7261
  return arr2;
10295
7262
  }
10296
- function asyncGeneratorStep(gen, resolve4, reject, _next, _throw, key, arg) {
7263
+ function asyncGeneratorStep(gen, resolve3, reject, _next, _throw, key, arg) {
10297
7264
  try {
10298
7265
  var info = gen[key](arg);
10299
7266
  var value = info.value;
@@ -10302,7 +7269,7 @@ function asyncGeneratorStep(gen, resolve4, reject, _next, _throw, key, arg) {
10302
7269
  return;
10303
7270
  }
10304
7271
  if (info.done) {
10305
- resolve4(value);
7272
+ resolve3(value);
10306
7273
  } else {
10307
7274
  Promise.resolve(value).then(_next, _throw);
10308
7275
  }
@@ -10310,13 +7277,13 @@ function asyncGeneratorStep(gen, resolve4, reject, _next, _throw, key, arg) {
10310
7277
  function _asyncToGenerator(fn) {
10311
7278
  return function() {
10312
7279
  var self2 = this, args = arguments;
10313
- return new Promise(function(resolve4, reject) {
7280
+ return new Promise(function(resolve3, reject) {
10314
7281
  var gen = fn.apply(self2, args);
10315
7282
  function _next(value) {
10316
- asyncGeneratorStep(gen, resolve4, reject, _next, _throw, "next", value);
7283
+ asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "next", value);
10317
7284
  }
10318
7285
  function _throw(err) {
10319
- asyncGeneratorStep(gen, resolve4, reject, _next, _throw, "throw", err);
7286
+ asyncGeneratorStep(gen, resolve3, reject, _next, _throw, "throw", err);
10320
7287
  }
10321
7288
  _next(void 0);
10322
7289
  });
@@ -10337,7 +7304,7 @@ function _prompt() {
10337
7304
  const answers = {};
10338
7305
  const override2 = prompt$2._override || {};
10339
7306
  questions = [].concat(questions);
10340
- let answer, question, quit, name, type2, lastPrompt;
7307
+ let answer, question, quit, name, type, lastPrompt;
10341
7308
  const getFormattedAnswer = /* @__PURE__ */ function() {
10342
7309
  var _ref = _asyncToGenerator(function* (question2, answer2, skipValidation = false) {
10343
7310
  if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
@@ -10355,12 +7322,12 @@ function _prompt() {
10355
7322
  question = _step.value;
10356
7323
  var _question = question;
10357
7324
  name = _question.name;
10358
- type2 = _question.type;
10359
- if (typeof type2 === "function") {
10360
- type2 = yield type2(answer, _objectSpread({}, answers), question);
10361
- question["type"] = type2;
7325
+ type = _question.type;
7326
+ if (typeof type === "function") {
7327
+ type = yield type(answer, _objectSpread({}, answers), question);
7328
+ question["type"] = type;
10362
7329
  }
10363
- if (!type2)
7330
+ if (!type)
10364
7331
  continue;
10365
7332
  for (let key in question) {
10366
7333
  if (passOn$1.includes(key))
@@ -10374,9 +7341,9 @@ function _prompt() {
10374
7341
  }
10375
7342
  var _question2 = question;
10376
7343
  name = _question2.name;
10377
- type2 = _question2.type;
10378
- if (prompts$3[type2] === void 0) {
10379
- throw new Error(`prompt type (${type2}) is not defined`);
7344
+ type = _question2.type;
7345
+ if (prompts$3[type] === void 0) {
7346
+ throw new Error(`prompt type (${type}) is not defined`);
10380
7347
  }
10381
7348
  if (override2[question.name] !== void 0) {
10382
7349
  answer = yield getFormattedAnswer(question, override2[question.name]);
@@ -10386,7 +7353,7 @@ function _prompt() {
10386
7353
  }
10387
7354
  }
10388
7355
  try {
10389
- answer = prompt$2._injected ? getInjectedAnswer$1(prompt$2._injected, question.initial) : yield prompts$3[type2](question);
7356
+ answer = prompt$2._injected ? getInjectedAnswer$1(prompt$2._injected, question.initial) : yield prompts$3[type](question);
10390
7357
  answers[name] = answer = yield getFormattedAnswer(question, answer, true);
10391
7358
  quit = yield onSubmit(question, answer, answers);
10392
7359
  } catch (err) {
@@ -10477,17 +7444,17 @@ var action$1 = (key, isSelect) => {
10477
7444
  return "left";
10478
7445
  return false;
10479
7446
  };
10480
- var strip$2 = (str2) => {
7447
+ var strip$2 = (str) => {
10481
7448
  const pattern = [
10482
7449
  "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
10483
7450
  "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"
10484
7451
  ].join("|");
10485
7452
  const RGX = new RegExp(pattern, "g");
10486
- return typeof str2 === "string" ? str2.replace(RGX, "") : str2;
7453
+ return typeof str === "string" ? str.replace(RGX, "") : str;
10487
7454
  };
10488
7455
  var strip$1 = strip$2;
10489
7456
  var { erase: erase$6, cursor: cursor$a } = src;
10490
- var width = (str2) => [...strip$1(str2)].length;
7457
+ var width = (str) => [...strip$1(str)].length;
10491
7458
  var clear$9 = function(prompt2, perLine) {
10492
7459
  if (!perLine)
10493
7460
  return erase$6.line + cursor$a.to(0);
@@ -10536,7 +7503,7 @@ var styles = Object.freeze({
10536
7503
  invisible: { scale: 0, render: (input) => "" },
10537
7504
  default: { scale: 1, render: (input) => `${input}` }
10538
7505
  });
10539
- var render = (type2) => styles[type2] || styles.default;
7506
+ var render = (type) => styles[type] || styles.default;
10540
7507
  var symbols = Object.freeze({
10541
7508
  aborted: c.red(figures$7.cross),
10542
7509
  done: c.green(figures$7.tick),
@@ -10607,10 +7574,10 @@ var Prompt$8 = class extends EventEmitter {
10607
7574
  if (this.in.isTTY)
10608
7575
  this.in.setRawMode(true);
10609
7576
  const isSelect = ["SelectPrompt", "MultiselectPrompt"].indexOf(this.constructor.name) > -1;
10610
- const keypress = (str2, key) => {
7577
+ const keypress = (str, key) => {
10611
7578
  let a = action(key, isSelect);
10612
7579
  if (a === false) {
10613
- this._ && this._(str2, key);
7580
+ this._ && this._(str, key);
10614
7581
  } else if (typeof this[a] === "function") {
10615
7582
  this[a](key);
10616
7583
  } else {
@@ -11441,7 +8408,7 @@ var color$4 = kleur;
11441
8408
  var Prompt$3 = prompt$1;
11442
8409
  var { cursor: cursor$4, erase: erase$2 } = src;
11443
8410
  var { style: style$4, figures: figures$3, clear: clear$4, lines } = util;
11444
- var isNumber2 = /[0-9]/;
8411
+ var isNumber = /[0-9]/;
11445
8412
  var isDef = (any) => any !== void 0;
11446
8413
  var round = (number2, precision) => {
11447
8414
  let factor = Math.pow(10, precision);
@@ -11485,7 +8452,7 @@ var NumberPrompt = class extends Prompt$3 {
11485
8452
  return this.float ? parseFloat(x) : parseInt(x);
11486
8453
  }
11487
8454
  valid(c2) {
11488
- return c2 === `-` || c2 === `.` && this.float || isNumber2.test(c2);
8455
+ return c2 === `-` || c2 === `.` && this.float || isNumber.test(c2);
11489
8456
  }
11490
8457
  reset() {
11491
8458
  this.typed = ``;
@@ -12294,9 +9261,9 @@ var elements = {
12294
9261
  const $2 = exports;
12295
9262
  const el = elements;
12296
9263
  const noop2 = (v) => v;
12297
- function toPrompt(type2, args, opts = {}) {
9264
+ function toPrompt(type, args, opts = {}) {
12298
9265
  return new Promise((res, rej) => {
12299
- const p = new el[type2](args);
9266
+ const p = new el[type](args);
12300
9267
  const onAbort = opts.onAbort || noop2;
12301
9268
  const onSubmit = opts.onSubmit || noop2;
12302
9269
  const onExit2 = opts.onExit || noop2;
@@ -12321,7 +9288,7 @@ var elements = {
12321
9288
  $2.list = (args) => {
12322
9289
  const sep = args.separator || ",";
12323
9290
  return toPrompt("TextPrompt", args, {
12324
- onSubmit: (str2) => str2.split(sep).map((s) => s.trim())
9291
+ onSubmit: (str) => str.split(sep).map((s) => s.trim())
12325
9292
  });
12326
9293
  };
12327
9294
  $2.toggle = (args) => toPrompt("TogglePrompt", args);
@@ -12357,7 +9324,7 @@ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {})
12357
9324
  const answers = {};
12358
9325
  const override2 = prompt._override || {};
12359
9326
  questions = [].concat(questions);
12360
- let answer, question, quit, name, type2, lastPrompt;
9327
+ let answer, question, quit, name, type, lastPrompt;
12361
9328
  const getFormattedAnswer = async (question2, answer2, skipValidation = false) => {
12362
9329
  if (!skipValidation && question2.validate && question2.validate(answer2) !== true) {
12363
9330
  return;
@@ -12365,12 +9332,12 @@ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {})
12365
9332
  return question2.format ? await question2.format(answer2, answers) : answer2;
12366
9333
  };
12367
9334
  for (question of questions) {
12368
- ({ name, type: type2 } = question);
12369
- if (typeof type2 === "function") {
12370
- type2 = await type2(answer, __spreadValues({}, answers), question);
12371
- question["type"] = type2;
9335
+ ({ name, type } = question);
9336
+ if (typeof type === "function") {
9337
+ type = await type(answer, __spreadValues({}, answers), question);
9338
+ question["type"] = type;
12372
9339
  }
12373
- if (!type2)
9340
+ if (!type)
12374
9341
  continue;
12375
9342
  for (let key in question) {
12376
9343
  if (passOn.includes(key))
@@ -12382,9 +9349,9 @@ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {})
12382
9349
  if (typeof question.message !== "string") {
12383
9350
  throw new Error("prompt message is required");
12384
9351
  }
12385
- ({ name, type: type2 } = question);
12386
- if (prompts$1[type2] === void 0) {
12387
- throw new Error(`prompt type (${type2}) is not defined`);
9352
+ ({ name, type } = question);
9353
+ if (prompts$1[type] === void 0) {
9354
+ throw new Error(`prompt type (${type}) is not defined`);
12388
9355
  }
12389
9356
  if (override2[question.name] !== void 0) {
12390
9357
  answer = await getFormattedAnswer(question, override2[question.name]);
@@ -12394,7 +9361,7 @@ async function prompt(questions = [], { onSubmit = noop, onCancel = noop } = {})
12394
9361
  }
12395
9362
  }
12396
9363
  try {
12397
- answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts$1[type2](question);
9364
+ answer = prompt._injected ? getInjectedAnswer(prompt._injected, question.initial) : await prompts$1[type](question);
12398
9365
  answers[name] = answer = await getFormattedAnswer(question, answer, true);
12399
9366
  quit = await onSubmit(question, answer, answers);
12400
9367
  } catch (err) {
@@ -12485,7 +9452,7 @@ async function run(fn, args, options = {}) {
12485
9452
  let cwd = process.cwd();
12486
9453
  let command;
12487
9454
  if (args[0] === "-C") {
12488
- cwd = resolve2(cwd, args[1]);
9455
+ cwd = resolve(cwd, args[1]);
12489
9456
  args.splice(0, 2);
12490
9457
  }
12491
9458
  const isGlobal = args.includes("-g");
@@ -12521,22 +9488,63 @@ async function run(fn, args, options = {}) {
12521
9488
  }
12522
9489
 
12523
9490
  // node/themes.ts
12524
- var import_semver = __toESM(require_semver2());
9491
+ var import_semver2 = __toESM(require_semver2());
12525
9492
  import isInstalledGlobally from "is-installed-globally";
12526
9493
  import { underline } from "kolorist";
12527
9494
  import fs3 from "fs-extra";
12528
9495
 
12529
9496
  // node/options.ts
12530
9497
  init_esm_shims();
12531
- import { dirname as dirname2, join, resolve as resolve3 } from "path";
12532
- import { uniq as uniq3 } from "@antfu/utils";
9498
+ import { dirname, join as join2, resolve as resolve2 } from "path";
9499
+ import { uniq } from "@antfu/utils";
12533
9500
  import _debug from "debug";
9501
+
9502
+ // node/addons.ts
9503
+ init_esm_shims();
9504
+ var import_semver = __toESM(require_semver2());
9505
+ import fs2 from "fs-extra";
9506
+ function getPackageJson(root) {
9507
+ return fs2.readJSON(resolveImportPath(`${root}/package.json`, true));
9508
+ }
9509
+ async function getAddons(userRoot, config2) {
9510
+ const { slidev = {} } = await getPackageJson(userRoot);
9511
+ const configAddons = config2.addons instanceof Array ? config2.addons : [];
9512
+ const addons = configAddons.concat(slidev.addons instanceof Array ? slidev.addons : []);
9513
+ return getRecursivePlugins(addons.map(resolvePluginName));
9514
+ }
9515
+ async function getRecursivePlugins(addons) {
9516
+ const addonsArray = await Promise.all(addons.map(async (addon) => {
9517
+ const { slidev = {}, engines = {} } = await getPackageJson(addon);
9518
+ checkEngine(addon, engines);
9519
+ let addons2 = slidev.addons instanceof Array ? slidev.addons : [];
9520
+ if (addons2.length > 0)
9521
+ addons2 = await getRecursivePlugins(addons2.map(resolvePluginName));
9522
+ addons2.push(addon);
9523
+ return addons2;
9524
+ }));
9525
+ return addonsArray.flat();
9526
+ }
9527
+ async function checkEngine(name, engines) {
9528
+ if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev))
9529
+ throw new Error(`[slidev] addon "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
9530
+ }
9531
+ function resolvePluginName(name) {
9532
+ if (!name)
9533
+ return "";
9534
+ if (isPath(name))
9535
+ return name;
9536
+ if (packageExists(`slidev-addon-${name}`))
9537
+ return `slidev-addon-${name}`;
9538
+ return name;
9539
+ }
9540
+
9541
+ // node/options.ts
12534
9542
  var debug = _debug("slidev:options");
12535
9543
  function getClientRoot() {
12536
- return dirname2(resolveImportPath("@slidev/client/package.json", true));
9544
+ return dirname(resolveImportPath("@slidev/client/package.json", true));
12537
9545
  }
12538
9546
  function getCLIRoot() {
12539
- return resolve3(__dirname, "..");
9547
+ return resolve2(__dirname, "..");
12540
9548
  }
12541
9549
  function isPath(name) {
12542
9550
  return name.startsWith("/") || /^\.\.?[\/\\]/.test(name);
@@ -12544,27 +9552,30 @@ function isPath(name) {
12544
9552
  function getThemeRoots(name, entry) {
12545
9553
  if (!name)
12546
9554
  return [];
12547
- if (isPath(name)) {
12548
- return [
12549
- resolve3(dirname2(entry), name)
12550
- ];
12551
- } else {
12552
- return [
12553
- dirname2(resolveImportPath(`${name}/package.json`, true))
12554
- ];
12555
- }
9555
+ return [getRoot(name, entry)];
9556
+ }
9557
+ function getAddonRoots(addons, entry) {
9558
+ if (addons.length === 0)
9559
+ return [];
9560
+ return addons.map((name) => getRoot(name, entry));
9561
+ }
9562
+ function getRoot(name, entry) {
9563
+ if (isPath(name))
9564
+ return resolve2(dirname(entry), name);
9565
+ return dirname(resolveImportPath(`${name}/package.json`, true));
12556
9566
  }
12557
9567
  function getUserRoot(options) {
12558
9568
  const { entry: rawEntry = "slides.md", userRoot = process.cwd() } = options;
12559
- const fullEntry = resolve3(userRoot, rawEntry);
12560
- return { entry: fullEntry, userRoot: dirname2(fullEntry) };
9569
+ const fullEntry = resolve2(userRoot, rawEntry);
9570
+ return { entry: fullEntry, userRoot: dirname(fullEntry) };
12561
9571
  }
12562
9572
  async function resolveOptions(options, mode2, promptForInstallation = true) {
9573
+ const { remote } = options;
12563
9574
  const {
12564
9575
  entry,
12565
9576
  userRoot
12566
9577
  } = getUserRoot(options);
12567
- const data = await fs_exports.load(entry);
9578
+ const data = await parser.load(entry);
12568
9579
  const theme = resolveThemeName(options.theme || data.config.theme);
12569
9580
  if (promptForInstallation) {
12570
9581
  if (await promptForThemeInstallation(theme) === false)
@@ -12578,12 +9589,14 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
12578
9589
  const clientRoot = getClientRoot();
12579
9590
  const cliRoot = getCLIRoot();
12580
9591
  const themeRoots = getThemeRoots(theme, entry);
12581
- const roots = uniq3([clientRoot, ...themeRoots, userRoot]);
9592
+ const addons = await getAddons(userRoot, data.config);
9593
+ const addonRoots = getAddonRoots(addons, entry);
9594
+ const roots = uniq([clientRoot, ...themeRoots, userRoot]);
12582
9595
  if (themeRoots.length) {
12583
- const themeMeta = await getThemeMeta(theme, join(themeRoots[0], "package.json"));
9596
+ const themeMeta = await getThemeMeta(theme, join2(themeRoots[0], "package.json"));
12584
9597
  data.themeMeta = themeMeta;
12585
9598
  if (themeMeta)
12586
- data.config = fs_exports.resolveConfig(data.headmatter, themeMeta);
9599
+ data.config = parser.resolveConfig(data.headmatter, themeMeta);
12587
9600
  }
12588
9601
  debug({
12589
9602
  config: data.config,
@@ -12594,7 +9607,9 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
12594
9607
  clientRoot,
12595
9608
  cliRoot,
12596
9609
  themeRoots,
12597
- roots
9610
+ addonRoots,
9611
+ roots,
9612
+ remote
12598
9613
  });
12599
9614
  return {
12600
9615
  data,
@@ -12605,7 +9620,9 @@ async function resolveOptions(options, mode2, promptForInstallation = true) {
12605
9620
  clientRoot,
12606
9621
  cliRoot,
12607
9622
  themeRoots,
12608
- roots
9623
+ addonRoots,
9624
+ roots,
9625
+ remote
12609
9626
  };
12610
9627
  }
12611
9628
 
@@ -12618,17 +9635,12 @@ var officialThemes = {
12618
9635
  "shibainu": "@slidev/theme-shibainu",
12619
9636
  "bricks": "@slidev/theme-bricks"
12620
9637
  };
12621
- function packageExists(name) {
12622
- if (resolveImportPath(`${name}/package.json`))
12623
- return true;
12624
- return false;
12625
- }
12626
9638
  async function getThemeMeta(name, path2) {
12627
9639
  if (!fs3.existsSync(path2))
12628
9640
  return {};
12629
9641
  if (path2) {
12630
9642
  const { slidev = {}, engines = {} } = await fs3.readJSON(path2);
12631
- if (engines.slidev && !(0, import_semver.satisfies)(version, engines.slidev))
9643
+ if (engines.slidev && !(0, import_semver2.satisfies)(version, engines.slidev))
12632
9644
  throw new Error(`[slidev] theme "${name}" requires Slidev version range "${engines.slidev}" but found "${version}"`);
12633
9645
  return slidev;
12634
9646
  }
@@ -12671,15 +9683,16 @@ async function promptForThemeInstallation(name) {
12671
9683
  }
12672
9684
 
12673
9685
  export {
12674
- fs_exports,
9686
+ createServer,
9687
+ parser,
12675
9688
  version,
12676
- packageExists,
12677
9689
  resolveThemeName,
12678
9690
  getClientRoot,
12679
9691
  getCLIRoot,
12680
9692
  isPath,
12681
9693
  getThemeRoots,
9694
+ getAddonRoots,
9695
+ getRoot,
12682
9696
  getUserRoot,
12683
9697
  resolveOptions
12684
9698
  };
12685
- /*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */