@depup/cloudflare__vite-plugin 1.57.2-depup.0 → 1.57.3-depup.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.
package/dist/index.mjs CHANGED
@@ -136,7 +136,7 @@ function createFatalError$1(message, isJson, options) {
136
136
  __name$6(createFatalError$1, "createFatalError");
137
137
 
138
138
  //#endregion
139
- //#region ../workers-utils/dist/chunk-JTB7VJSC.mjs
139
+ //#region ../workers-utils/dist/chunk-IKXB77SR.mjs
140
140
  function hasKnownExportType(entry) {
141
141
  const type = entry?.type;
142
142
  return type === "durable-object" || type === "worker";
@@ -1440,114 +1440,7 @@ function applyEdits(text, edits) {
1440
1440
  return text;
1441
1441
  }
1442
1442
  __name$6(applyEdits, "applyEdits");
1443
- function getLineColFromPtr$1(string$3, ptr) {
1444
- let lines = string$3.slice(0, ptr).split(/\r\n|\n|\r/g);
1445
- return [lines.length, lines.pop().length + 1];
1446
- }
1447
- __name$6(getLineColFromPtr$1, "getLineColFromPtr");
1448
- function makeCodeBlock$1(string$3, line, column) {
1449
- let lines = string$3.split(/\r\n|\n|\r/g);
1450
- let codeblock = "";
1451
- let numberLen = (Math.log10(line + 1) | 0) + 1;
1452
- for (let i$1 = line - 1; i$1 <= line + 1; i$1++) {
1453
- let l = lines[i$1 - 1];
1454
- if (!l) continue;
1455
- codeblock += i$1.toString().padEnd(numberLen, " ");
1456
- codeblock += ": ";
1457
- codeblock += l;
1458
- codeblock += "\n";
1459
- if (i$1 === line) {
1460
- codeblock += " ".repeat(numberLen + column + 2);
1461
- codeblock += "^\n";
1462
- }
1463
- }
1464
- return codeblock;
1465
- }
1466
- __name$6(makeCodeBlock$1, "makeCodeBlock");
1467
- var TomlError$1 = class extends Error {
1468
- static {
1469
- __name$6(this, "TomlError");
1470
- }
1471
- line;
1472
- column;
1473
- codeblock;
1474
- constructor(message, options) {
1475
- const [line, column] = getLineColFromPtr$1(options.toml, options.ptr);
1476
- const codeblock = makeCodeBlock$1(options.toml, line, column);
1477
- super(`Invalid TOML document: ${message}
1478
-
1479
- ${codeblock}`, options);
1480
- this.line = line;
1481
- this.column = column;
1482
- this.codeblock = codeblock;
1483
- }
1484
- };
1485
- function isEscaped$1(str, ptr) {
1486
- let i$1 = 0;
1487
- while (str[ptr - ++i$1] === "\\");
1488
- return --i$1 && i$1 % 2;
1489
- }
1490
- __name$6(isEscaped$1, "isEscaped");
1491
- function indexOfNewline$1(str, start = 0, end = str.length) {
1492
- let idx = str.indexOf("\n", start);
1493
- if (str[idx - 1] === "\r") idx--;
1494
- return idx <= end ? idx : -1;
1495
- }
1496
- __name$6(indexOfNewline$1, "indexOfNewline");
1497
- function skipComment$1(str, ptr) {
1498
- for (let i$1 = ptr; i$1 < str.length; i$1++) {
1499
- let c$1 = str[i$1];
1500
- if (c$1 === "\n") return i$1;
1501
- if (c$1 === "\r" && str[i$1 + 1] === "\n") return i$1 + 1;
1502
- if (c$1 < " " && c$1 !== " " || c$1 === "") throw new TomlError$1("control characters are not allowed in comments", {
1503
- toml: str,
1504
- ptr
1505
- });
1506
- }
1507
- return str.length;
1508
- }
1509
- __name$6(skipComment$1, "skipComment");
1510
- function skipVoid$1(str, ptr, banNewLines, banComments) {
1511
- let c$1;
1512
- while ((c$1 = str[ptr]) === " " || c$1 === " " || !banNewLines && (c$1 === "\n" || c$1 === "\r" && str[ptr + 1] === "\n")) ptr++;
1513
- return banComments || c$1 !== "#" ? ptr : skipVoid$1(str, skipComment$1(str, ptr), banNewLines);
1514
- }
1515
- __name$6(skipVoid$1, "skipVoid");
1516
- function skipUntil$1(str, ptr, sep$1, end, banNewLines = false) {
1517
- if (!end) {
1518
- ptr = indexOfNewline$1(str, ptr);
1519
- return ptr < 0 ? str.length : ptr;
1520
- }
1521
- for (let i$1 = ptr; i$1 < str.length; i$1++) {
1522
- let c$1 = str[i$1];
1523
- if (c$1 === "#") i$1 = indexOfNewline$1(str, i$1);
1524
- else if (c$1 === sep$1) return i$1 + 1;
1525
- else if (c$1 === end || banNewLines && (c$1 === "\n" || c$1 === "\r" && str[i$1 + 1] === "\n")) return i$1;
1526
- }
1527
- throw new TomlError$1("cannot find end of structure", {
1528
- toml: str,
1529
- ptr
1530
- });
1531
- }
1532
- __name$6(skipUntil$1, "skipUntil");
1533
- function getStringEnd$1(str, seek) {
1534
- let first = str[seek];
1535
- let target$1 = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
1536
- seek += target$1.length - 1;
1537
- do
1538
- seek = str.indexOf(target$1, ++seek);
1539
- while (seek > -1 && first !== "'" && isEscaped$1(str, seek));
1540
- if (seek > -1) {
1541
- seek += target$1.length;
1542
- if (target$1.length > 1) {
1543
- if (str[seek] === first) seek++;
1544
- if (str[seek] === first) seek++;
1545
- }
1546
- }
1547
- return seek;
1548
- }
1549
- __name$6(getStringEnd$1, "getStringEnd");
1550
- var DATE_TIME_RE$1 = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
1443
+ var DATE_TIME_RE$1 = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
1551
1444
  var TomlDate$1 = class _TomlDate extends Date {
1552
1445
  static {
1553
1446
  __name$6(this, "TomlDate");
@@ -1631,305 +1524,380 @@ var TomlDate$1 = class _TomlDate extends Date {
1631
1524
  return date$3;
1632
1525
  }
1633
1526
  };
1527
+ function getLineColFromPtr$1(string$3, ptr) {
1528
+ let lines = string$3.slice(0, ptr).split(/\r\n|\n|\r/g);
1529
+ return [lines.length, lines.pop().length + 1];
1530
+ }
1531
+ __name$6(getLineColFromPtr$1, "getLineColFromPtr");
1532
+ function makeCodeBlock$1(string$3, line, column) {
1533
+ let lines = string$3.split(/\r\n|\n|\r/g);
1534
+ let codeblock = "";
1535
+ let numberLen = (Math.log10(line + 1) | 0) + 1;
1536
+ for (let i$1 = line - 1; i$1 <= line + 1; i$1++) {
1537
+ let l = lines[i$1 - 1];
1538
+ if (!l) continue;
1539
+ codeblock += i$1.toString().padEnd(numberLen, " ");
1540
+ codeblock += ": ";
1541
+ codeblock += l;
1542
+ codeblock += "\n";
1543
+ if (i$1 === line) {
1544
+ codeblock += " ".repeat(numberLen + column + 2);
1545
+ codeblock += "^\n";
1546
+ }
1547
+ }
1548
+ return codeblock;
1549
+ }
1550
+ __name$6(makeCodeBlock$1, "makeCodeBlock");
1551
+ var TomlError$1 = class extends Error {
1552
+ static {
1553
+ __name$6(this, "TomlError");
1554
+ }
1555
+ line;
1556
+ column;
1557
+ codeblock;
1558
+ constructor(message, options) {
1559
+ const [line, column] = getLineColFromPtr$1(options.toml, options.ptr);
1560
+ const codeblock = makeCodeBlock$1(options.toml, line, column);
1561
+ super(`Invalid TOML document: ${message}
1562
+
1563
+ ${codeblock}`, options);
1564
+ this.line = line;
1565
+ this.column = column;
1566
+ this.codeblock = codeblock;
1567
+ }
1568
+ };
1569
+ function indexOfNewline$1(str, start = 0) {
1570
+ let idx = str.indexOf("\n", start);
1571
+ if (str.charCodeAt(idx - 1) === 13) idx--;
1572
+ return idx;
1573
+ }
1574
+ __name$6(indexOfNewline$1, "indexOfNewline");
1575
+ function skipComment$1(ctx) {
1576
+ for (; ctx.p < ctx.s.length; ctx.p++) {
1577
+ let c$1 = ctx.s.charCodeAt(ctx.p);
1578
+ if (c$1 === 10) break;
1579
+ if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
1580
+ ctx.p++;
1581
+ break;
1582
+ }
1583
+ if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError$1("control characters are not allowed in comments", {
1584
+ toml: ctx.s,
1585
+ ptr: ctx.p
1586
+ });
1587
+ }
1588
+ }
1589
+ __name$6(skipComment$1, "skipComment");
1590
+ function skipVoid$1(ctx, banNewLines, banComments) {
1591
+ let c$1;
1592
+ while (1) {
1593
+ while ((c$1 = ctx.s.charCodeAt(ctx.p)) === 32 || c$1 === 9 || !banNewLines && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) ctx.p++;
1594
+ if (banComments || c$1 !== 35) break;
1595
+ skipComment$1(ctx);
1596
+ }
1597
+ }
1598
+ __name$6(skipVoid$1, "skipVoid");
1599
+ function skipUntil$1(ctx, sep$1, end) {
1600
+ let ptr = ctx.p;
1601
+ if (!end) {
1602
+ ptr = indexOfNewline$1(ctx.s, ptr);
1603
+ ctx.p = ptr < 0 ? ctx.s.length : ptr;
1604
+ return;
1605
+ }
1606
+ for (; ctx.p < ctx.s.length; ctx.p++) {
1607
+ let c$1 = ctx.s.charCodeAt(ctx.p);
1608
+ if (c$1 === 35) skipComment$1(ctx);
1609
+ else if (c$1 === end || c$1 === sep$1) return;
1610
+ }
1611
+ throw new TomlError$1("cannot find end of structure", {
1612
+ toml: ctx.s,
1613
+ ptr
1614
+ });
1615
+ }
1616
+ __name$6(skipUntil$1, "skipUntil");
1634
1617
  var INT_REGEX$1 = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
1635
1618
  var FLOAT_REGEX$1 = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
1636
1619
  var LEADING_ZERO$1 = /^[+-]?0[0-9_]/;
1637
- var ESCAPE_REGEX$1 = /^[0-9a-f]{4,8}$/i;
1638
- var ESC_MAP$1 = {
1639
- b: "\b",
1640
- t: " ",
1641
- n: "\n",
1642
- f: "\f",
1643
- r: "\r",
1644
- "\"": "\"",
1645
- "\\": "\\"
1646
- };
1647
- function parseString$1(str, ptr = 0, endPtr = str.length) {
1648
- let isLiteral = str[ptr] === "'";
1649
- let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
1620
+ function parseString$1(ctx) {
1621
+ let start = ctx.p;
1622
+ let c$1 = ctx.s.charCodeAt(ctx.p++);
1623
+ let first = c$1;
1624
+ let isLiteral = c$1 === 39;
1625
+ let isMultiline = c$1 === ctx.s.charCodeAt(ctx.p) && c$1 === ctx.s.charCodeAt(ctx.p + 1);
1650
1626
  if (isMultiline) {
1651
- endPtr -= 2;
1652
- if (str[ptr += 2] === "\r") ptr++;
1653
- if (str[ptr] === "\n") ptr++;
1627
+ if ((c$1 = ctx.s.charCodeAt(ctx.p += 2)) === 10) ctx.p++;
1628
+ else if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) ctx.p += 2;
1654
1629
  }
1655
- let tmp = 0;
1656
- let isEscape;
1657
1630
  let parsed = "";
1658
- let sliceStart = ptr;
1659
- while (ptr < endPtr - 1) {
1660
- let c$1 = str[ptr++];
1661
- if (c$1 === "\n" || c$1 === "\r" && str[ptr] === "\n") {
1662
- if (!isMultiline) throw new TomlError$1("newlines are not allowed in strings", {
1663
- toml: str,
1664
- ptr: ptr - 1
1665
- });
1666
- } else if (c$1 < " " && c$1 !== " " || c$1 === "") throw new TomlError$1("control characters are not allowed in strings", {
1667
- toml: str,
1668
- ptr: ptr - 1
1669
- });
1670
- if (isEscape) {
1671
- isEscape = false;
1672
- if (c$1 === "u" || c$1 === "U") {
1673
- let code = str.slice(ptr, ptr += c$1 === "u" ? 4 : 8);
1674
- if (!ESCAPE_REGEX$1.test(code)) throw new TomlError$1("invalid unicode escape", {
1675
- toml: str,
1676
- ptr: tmp
1631
+ let sliceStart = ctx.p;
1632
+ let state = 0;
1633
+ for (; ctx.p < ctx.s.length; ctx.p++) {
1634
+ c$1 = ctx.s.charCodeAt(ctx.p);
1635
+ if (isMultiline && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) state = state && 3;
1636
+ else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError$1("control characters are not allowed in strings", {
1637
+ toml: ctx.s,
1638
+ ptr: ctx.p
1639
+ });
1640
+ else if ((!state || state === 3) && c$1 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
1641
+ if (isMultiline) {
1642
+ if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
1643
+ if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
1644
+ }
1645
+ if (!state) parsed += ctx.s.slice(sliceStart, ctx.p);
1646
+ ctx.p += isMultiline ? 3 : 1;
1647
+ return parsed;
1648
+ } else if (!state) {
1649
+ if (!isLiteral && c$1 === 92) {
1650
+ parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
1651
+ state = 1;
1652
+ }
1653
+ } else if (state === 1) if (c$1 === 120 || c$1 === 117 || c$1 === 85) {
1654
+ let value = 0;
1655
+ let len = c$1 === 120 ? 2 : c$1 === 117 ? 4 : 8;
1656
+ for (let j$1 = 0; j$1 < len; j$1++, ctx.p++) {
1657
+ let hex$1 = ctx.s.charCodeAt(ctx.p + 1);
1658
+ let digit = hex$1 >= 48 && hex$1 <= 57 ? hex$1 - 48 : hex$1 >= 65 && hex$1 <= 70 ? hex$1 - 65 + 10 : hex$1 >= 97 && hex$1 <= 102 ? hex$1 - 97 + 10 : -1;
1659
+ if (digit < 0) throw new TomlError$1("invalid non-hex character in unicode escape", {
1660
+ toml: ctx.s,
1661
+ ptr: ctx.p + 1
1677
1662
  });
1678
- try {
1679
- parsed += String.fromCodePoint(parseInt(code, 16));
1680
- } catch {
1681
- throw new TomlError$1("invalid unicode escape", {
1682
- toml: str,
1683
- ptr: tmp
1684
- });
1685
- }
1686
- } else if (isMultiline && (c$1 === "\n" || c$1 === " " || c$1 === " " || c$1 === "\r")) {
1687
- ptr = skipVoid$1(str, ptr - 1, true);
1688
- if (str[ptr] !== "\n" && str[ptr] !== "\r") throw new TomlError$1("invalid escape: only line-ending whitespace may be escaped", {
1689
- toml: str,
1690
- ptr: tmp
1691
- });
1692
- ptr = skipVoid$1(str, ptr);
1693
- } else if (c$1 in ESC_MAP$1) parsed += ESC_MAP$1[c$1];
1663
+ value = value << 4 | digit;
1664
+ }
1665
+ if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new TomlError$1("invalid unicode escape", {
1666
+ toml: ctx.s,
1667
+ ptr: ctx.p
1668
+ });
1669
+ parsed += String.fromCodePoint(value);
1670
+ sliceStart = ctx.p + 1;
1671
+ state = 0;
1672
+ } else if (c$1 === 32 || c$1 === 9) state = 2;
1673
+ else {
1674
+ if (c$1 === 98) parsed += "\b";
1675
+ else if (c$1 === 116) parsed += " ";
1676
+ else if (c$1 === 110) parsed += "\n";
1677
+ else if (c$1 === 102) parsed += "\f";
1678
+ else if (c$1 === 114) parsed += "\r";
1679
+ else if (c$1 === 101) parsed += "\x1B";
1680
+ else if (c$1 === 34) parsed += "\"";
1681
+ else if (c$1 === 92) parsed += "\\";
1694
1682
  else throw new TomlError$1("unrecognized escape sequence", {
1695
- toml: str,
1696
- ptr: tmp
1683
+ toml: ctx.s,
1684
+ ptr: ctx.p
1697
1685
  });
1698
- sliceStart = ptr;
1699
- } else if (!isLiteral && c$1 === "\\") {
1700
- tmp = ptr - 1;
1701
- isEscape = true;
1702
- parsed += str.slice(sliceStart, tmp);
1686
+ sliceStart = ctx.p + 1;
1687
+ state = 0;
1688
+ }
1689
+ else if (c$1 !== 32 && c$1 !== 9) {
1690
+ if (state === 2) throw new TomlError$1("invalid escape: only line-ending whitespace may be escaped", {
1691
+ toml: ctx.s,
1692
+ ptr: sliceStart
1693
+ });
1694
+ state = !isLiteral && c$1 === 92 ? 1 : 0;
1695
+ sliceStart = ctx.p;
1703
1696
  }
1704
1697
  }
1705
- return parsed + str.slice(sliceStart, endPtr - 1);
1698
+ throw new TomlError$1("unfinished string", {
1699
+ toml: ctx.s,
1700
+ ptr: start
1701
+ });
1706
1702
  }
1707
1703
  __name$6(parseString$1, "parseString");
1708
- function parseValue$1(value, toml, ptr, integersAsBigInt) {
1709
- if (value === "true") return true;
1710
- if (value === "false") return false;
1704
+ function sliceAndTrimEndOf$1(ctx, start, end) {
1705
+ let value = ctx.s.slice(start, end);
1706
+ let commentIdx = value.indexOf("#");
1707
+ if (commentIdx > 0) {
1708
+ skipComment$1({
1709
+ s: value,
1710
+ p: commentIdx
1711
+ });
1712
+ value = value.slice(0, commentIdx);
1713
+ }
1714
+ return value.trimEnd();
1715
+ }
1716
+ __name$6(sliceAndTrimEndOf$1, "sliceAndTrimEndOf");
1717
+ function parseValue$1(ctx, integersAsBigInt, end) {
1718
+ let ptr = ctx.p;
1719
+ let err = {
1720
+ toml: ctx.s,
1721
+ ptr
1722
+ };
1723
+ skipUntil$1(ctx, 44, end);
1724
+ let value = sliceAndTrimEndOf$1(ctx, ptr, ctx.p);
1725
+ if (!value) throw new TomlError$1("incomplete declaration: value expected", err);
1711
1726
  if (value === "-inf") return -Infinity;
1712
1727
  if (value === "inf" || value === "+inf") return Infinity;
1713
1728
  if (value === "nan" || value === "+nan" || value === "-nan") return NaN;
1714
1729
  if (value === "-0") return integersAsBigInt ? 0n : 0;
1715
1730
  let isInt = INT_REGEX$1.test(value);
1716
1731
  if (isInt || FLOAT_REGEX$1.test(value)) {
1717
- if (LEADING_ZERO$1.test(value)) throw new TomlError$1("leading zeroes are not allowed", {
1718
- toml,
1719
- ptr
1720
- });
1732
+ if (LEADING_ZERO$1.test(value)) throw new TomlError$1("leading zeroes are not allowed", err);
1721
1733
  value = value.replace(/_/g, "");
1722
1734
  let numeric$1 = +value;
1723
- if (isNaN(numeric$1)) throw new TomlError$1("invalid number", {
1724
- toml,
1725
- ptr
1726
- });
1735
+ if (isNaN(numeric$1)) throw new TomlError$1("invalid number", err);
1727
1736
  if (isInt) {
1728
- if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError$1("integer value cannot be represented losslessly", {
1729
- toml,
1730
- ptr
1731
- });
1737
+ if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError$1("integer value cannot be represented losslessly", err);
1732
1738
  if (isInt || integersAsBigInt === true) numeric$1 = BigInt(value);
1733
1739
  }
1734
1740
  return numeric$1;
1735
1741
  }
1736
1742
  const date$3 = new TomlDate$1(value);
1737
- if (!date$3.isValid()) throw new TomlError$1("invalid value", {
1738
- toml,
1739
- ptr
1740
- });
1743
+ if (!date$3.isValid()) throw new TomlError$1("invalid value", err);
1741
1744
  return date$3;
1742
1745
  }
1743
1746
  __name$6(parseValue$1, "parseValue");
1744
- function sliceAndTrimEndOf$1(str, startPtr, endPtr, allowNewLines) {
1745
- let value = str.slice(startPtr, endPtr);
1746
- let commentIdx = value.indexOf("#");
1747
- if (commentIdx > -1) {
1748
- skipComment$1(str, commentIdx);
1749
- value = value.slice(0, commentIdx);
1750
- }
1751
- let trimmed = value.trimEnd();
1752
- if (!allowNewLines) {
1753
- let newlineIdx = value.indexOf("\n", trimmed.length);
1754
- if (newlineIdx > -1) throw new TomlError$1("newlines are not allowed in inline tables", {
1755
- toml: str,
1756
- ptr: startPtr + newlineIdx
1747
+ function extractValue$1(ctx, end, integersAsBigInt) {
1748
+ let ptr = ctx.p;
1749
+ let c$1 = ctx.s.charCodeAt(ptr);
1750
+ if (c$1 === 91 || c$1 === 123) {
1751
+ if (!ctx.d--) throw new TomlError$1("document contains excessively nested structures. aborting.", {
1752
+ toml: ctx.s,
1753
+ ptr
1757
1754
  });
1755
+ let value = c$1 === 91 ? parseArray$1(ctx, integersAsBigInt) : parseInlineTable$1(ctx, integersAsBigInt);
1756
+ ctx.d++;
1757
+ return value;
1758
1758
  }
1759
- return [trimmed, commentIdx];
1760
- }
1761
- __name$6(sliceAndTrimEndOf$1, "sliceAndTrimEndOf");
1762
- function extractValue$1(str, ptr, end, depth$1, integersAsBigInt) {
1763
- if (depth$1 === 0) throw new TomlError$1("document contains excessively nested structures. aborting.", {
1764
- toml: str,
1765
- ptr
1766
- });
1767
- let c$1 = str[ptr];
1768
- if (c$1 === "[" || c$1 === "{") {
1769
- let [value, endPtr2] = c$1 === "[" ? parseArray$1(str, ptr, depth$1, integersAsBigInt) : parseInlineTable$1(str, ptr, depth$1, integersAsBigInt);
1770
- let newPtr = end ? skipUntil$1(str, endPtr2, ",", end) : endPtr2;
1771
- if (endPtr2 - newPtr && end === "}") {
1772
- let nextNewLine = indexOfNewline$1(str, endPtr2, newPtr);
1773
- if (nextNewLine > -1) throw new TomlError$1("newlines are not allowed in inline tables", {
1774
- toml: str,
1775
- ptr: nextNewLine
1776
- });
1777
- }
1778
- return [value, newPtr];
1779
- }
1780
- let endPtr;
1781
- if (c$1 === "\"" || c$1 === "'") {
1782
- endPtr = getStringEnd$1(str, ptr);
1783
- let parsed = parseString$1(str, ptr, endPtr);
1784
- if (end) {
1785
- endPtr = skipVoid$1(str, endPtr, end !== "]");
1786
- if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") throw new TomlError$1("unexpected character encountered", {
1787
- toml: str,
1788
- ptr: endPtr
1789
- });
1790
- endPtr += +(str[endPtr] === ",");
1791
- }
1792
- return [parsed, endPtr];
1759
+ if (c$1 === 34 || c$1 === 39) return parseString$1(ctx);
1760
+ if (c$1 === 116) {
1761
+ if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError$1("invalid value", {
1762
+ toml: ctx.s,
1763
+ ptr
1764
+ });
1765
+ ctx.p++;
1766
+ return true;
1793
1767
  }
1794
- endPtr = skipUntil$1(str, ptr, ",", end);
1795
- let slice = sliceAndTrimEndOf$1(str, ptr, endPtr - +(str[endPtr - 1] === ","), end === "]");
1796
- if (!slice[0]) throw new TomlError$1("incomplete key-value declaration: no value specified", {
1797
- toml: str,
1798
- ptr
1799
- });
1800
- if (end && slice[1] > -1) {
1801
- endPtr = skipVoid$1(str, ptr + slice[1]);
1802
- endPtr += +(str[endPtr] === ",");
1768
+ if (c$1 === 102) {
1769
+ if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError$1("invalid value", {
1770
+ toml: ctx.s,
1771
+ ptr
1772
+ });
1773
+ ctx.p++;
1774
+ return false;
1803
1775
  }
1804
- return [parseValue$1(slice[0], str, ptr, integersAsBigInt), endPtr];
1776
+ return parseValue$1(ctx, integersAsBigInt, end);
1805
1777
  }
1806
1778
  __name$6(extractValue$1, "extractValue");
1807
1779
  var KEY_PART_RE$1 = /^[a-zA-Z0-9-_]+[ \t]*$/;
1808
- function parseKey$1(str, ptr, end = "=") {
1809
- let dot = ptr - 1;
1780
+ function parseKey$1(ctx, end = "=") {
1781
+ let start = ctx.p;
1782
+ let dot = start - 1;
1810
1783
  let parsed = [];
1811
- let endPtr = str.indexOf(end, ptr);
1784
+ let endPtr = ctx.s.indexOf(end, start);
1812
1785
  if (endPtr < 0) throw new TomlError$1("incomplete key-value: cannot find end of key", {
1813
- toml: str,
1814
- ptr
1786
+ toml: ctx.s,
1787
+ ptr: start
1815
1788
  });
1816
1789
  do {
1817
- let c$1 = str[ptr = ++dot];
1818
- if (c$1 !== " " && c$1 !== " ") if (c$1 === "\"" || c$1 === "'") {
1819
- if (c$1 === str[ptr + 1] && c$1 === str[ptr + 2]) throw new TomlError$1("multiline strings are not allowed in keys", {
1820
- toml: str,
1821
- ptr
1790
+ let c$1 = ctx.s.charCodeAt(ctx.p = ++dot);
1791
+ if (c$1 !== 32 && c$1 !== 9) if (c$1 === 34 || c$1 === 39) {
1792
+ if (c$1 === ctx.s.charCodeAt(ctx.p + 1) && c$1 === ctx.s.charCodeAt(ctx.p + 2)) throw new TomlError$1("multiline strings are not allowed in keys", {
1793
+ toml: ctx.s,
1794
+ ptr: ctx.p
1822
1795
  });
1823
- let eos = getStringEnd$1(str, ptr);
1824
- if (eos < 0) throw new TomlError$1("unfinished string encountered", {
1825
- toml: str,
1826
- ptr
1827
- });
1828
- dot = str.indexOf(".", eos);
1829
- let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
1796
+ let part = parseString$1(ctx);
1797
+ dot = ctx.s.indexOf(".", ctx.p);
1798
+ let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
1830
1799
  let newLine = indexOfNewline$1(strEnd);
1831
1800
  if (newLine > -1) throw new TomlError$1("newlines are not allowed in keys", {
1832
- toml: str,
1833
- ptr: ptr + dot + newLine
1801
+ toml: ctx.s,
1802
+ ptr: newLine
1834
1803
  });
1835
1804
  if (strEnd.trimStart()) throw new TomlError$1("found extra tokens after the string part", {
1836
- toml: str,
1837
- ptr: eos
1805
+ toml: ctx.s,
1806
+ ptr: ctx.p
1838
1807
  });
1839
- if (endPtr < eos) {
1840
- endPtr = str.indexOf(end, eos);
1808
+ if (endPtr < ctx.p) {
1809
+ endPtr = ctx.s.indexOf(end, ctx.p);
1841
1810
  if (endPtr < 0) throw new TomlError$1("incomplete key-value: cannot find end of key", {
1842
- toml: str,
1843
- ptr
1811
+ toml: ctx.s,
1812
+ ptr: start
1844
1813
  });
1845
1814
  }
1846
- parsed.push(parseString$1(str, ptr, eos));
1815
+ parsed.push(part);
1847
1816
  } else {
1848
- dot = str.indexOf(".", ptr);
1849
- let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
1817
+ dot = ctx.s.indexOf(".", ctx.p);
1818
+ let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
1850
1819
  if (!KEY_PART_RE$1.test(part)) throw new TomlError$1("only letter, numbers, dashes and underscores are allowed in keys", {
1851
- toml: str,
1852
- ptr
1820
+ toml: ctx.s,
1821
+ ptr: ctx.p
1853
1822
  });
1854
1823
  parsed.push(part.trimEnd());
1855
1824
  }
1856
1825
  } while (dot + 1 && dot < endPtr);
1857
- return [parsed, skipVoid$1(str, endPtr + 1, true, true)];
1826
+ ctx.p = endPtr + 1;
1827
+ skipVoid$1(ctx, true, true);
1828
+ return parsed;
1858
1829
  }
1859
1830
  __name$6(parseKey$1, "parseKey");
1860
- function parseInlineTable$1(str, ptr, depth$1, integersAsBigInt) {
1831
+ function parseInlineTable$1(ctx, integersAsBigInt) {
1861
1832
  let res = {};
1862
1833
  let seen = /* @__PURE__ */ new Set();
1863
1834
  let c$1;
1864
- let comma$1 = 0;
1865
- ptr++;
1866
- while ((c$1 = str[ptr++]) !== "}" && c$1) {
1867
- let err = {
1868
- toml: str,
1869
- ptr: ptr - 1
1870
- };
1871
- if (c$1 === "\n") throw new TomlError$1("newlines are not allowed in inline tables", err);
1872
- else if (c$1 === "#") throw new TomlError$1("inline tables cannot contain comments", err);
1873
- else if (c$1 === ",") throw new TomlError$1("expected key-value, found comma", err);
1874
- else if (c$1 !== " " && c$1 !== " ") {
1875
- let k;
1876
- let t$5 = res;
1877
- let hasOwn$1 = false;
1878
- let [key, keyEndPtr] = parseKey$1(str, ptr - 1);
1879
- for (let i$1 = 0; i$1 < key.length; i$1++) {
1880
- if (i$1) t$5 = hasOwn$1 ? t$5[k] : t$5[k] = {};
1881
- k = key[i$1];
1882
- if ((hasOwn$1 = Object.hasOwn(t$5, k)) && (typeof t$5[k] !== "object" || seen.has(t$5[k]))) throw new TomlError$1("trying to redefine an already defined value", {
1883
- toml: str,
1884
- ptr
1885
- });
1886
- if (!hasOwn$1 && k === "__proto__") Object.defineProperty(t$5, k, {
1887
- enumerable: true,
1888
- configurable: true,
1889
- writable: true
1890
- });
1891
- }
1892
- if (hasOwn$1) throw new TomlError$1("trying to redefine an already defined value", {
1893
- toml: str,
1894
- ptr
1835
+ ctx.p++;
1836
+ while (ctx.p < ctx.s.length) {
1837
+ skipVoid$1(ctx);
1838
+ if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 125) {
1839
+ ctx.p++;
1840
+ return res;
1841
+ }
1842
+ let k;
1843
+ let t$5 = res;
1844
+ let hasOwn$1 = false;
1845
+ let p$2 = ctx.p;
1846
+ let key = parseKey$1(ctx);
1847
+ for (let i$1 = 0; i$1 < key.length; i$1++) {
1848
+ if (i$1) t$5 = hasOwn$1 ? t$5[k] : t$5[k] = {};
1849
+ k = key[i$1];
1850
+ if ((hasOwn$1 = Object.hasOwn(t$5, k)) && (typeof t$5[k] !== "object" || seen.has(t$5[k]))) throw new TomlError$1("trying to redefine an already defined value", {
1851
+ toml: ctx.s,
1852
+ ptr: p$2
1853
+ });
1854
+ if (!hasOwn$1 && k === "__proto__") Object.defineProperty(t$5, k, {
1855
+ enumerable: true,
1856
+ configurable: true,
1857
+ writable: true
1895
1858
  });
1896
- let [value, valueEndPtr] = extractValue$1(str, keyEndPtr, "}", depth$1 - 1, integersAsBigInt);
1897
- seen.add(value);
1898
- t$5[k] = value;
1899
- ptr = valueEndPtr;
1900
- comma$1 = str[ptr - 1] === "," ? ptr - 1 : 0;
1901
1859
  }
1860
+ if (hasOwn$1) throw new TomlError$1("trying to redefine an already defined value", {
1861
+ toml: ctx.s,
1862
+ ptr: ctx.p
1863
+ });
1864
+ let value = extractValue$1(ctx, 125, integersAsBigInt);
1865
+ seen.add(t$5[k] = value);
1866
+ skipVoid$1(ctx);
1867
+ if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 125) return res;
1868
+ if (c$1 !== 44) throw new TomlError$1("expected comma or end of structure", {
1869
+ toml: ctx.s,
1870
+ ptr: ctx.p - 1
1871
+ });
1902
1872
  }
1903
- if (comma$1) throw new TomlError$1("trailing commas are not allowed in inline tables", {
1904
- toml: str,
1905
- ptr: comma$1
1873
+ throw new TomlError$1("unfinished table encountered", {
1874
+ toml: ctx.s,
1875
+ ptr: ctx.p
1906
1876
  });
1907
- if (!c$1) throw new TomlError$1("unfinished table encountered", {
1908
- toml: str,
1909
- ptr
1910
- });
1911
- return [res, ptr];
1912
1877
  }
1913
1878
  __name$6(parseInlineTable$1, "parseInlineTable");
1914
- function parseArray$1(str, ptr, depth$1, integersAsBigInt) {
1879
+ function parseArray$1(ctx, integersAsBigInt) {
1915
1880
  let res = [];
1916
1881
  let c$1;
1917
- ptr++;
1918
- while ((c$1 = str[ptr++]) !== "]" && c$1) if (c$1 === ",") throw new TomlError$1("expected value, found comma", {
1919
- toml: str,
1920
- ptr: ptr - 1
1921
- });
1922
- else if (c$1 === "#") ptr = skipComment$1(str, ptr);
1923
- else if (c$1 !== " " && c$1 !== " " && c$1 !== "\n" && c$1 !== "\r") {
1924
- let e = extractValue$1(str, ptr - 1, "]", depth$1 - 1, integersAsBigInt);
1925
- res.push(e[0]);
1926
- ptr = e[1];
1927
- }
1928
- if (!c$1) throw new TomlError$1("unfinished array encountered", {
1929
- toml: str,
1930
- ptr
1882
+ ctx.p++;
1883
+ while (ctx.p < ctx.s.length) {
1884
+ skipVoid$1(ctx);
1885
+ if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 93) {
1886
+ ctx.p++;
1887
+ return res;
1888
+ }
1889
+ res.push(extractValue$1(ctx, 93, integersAsBigInt));
1890
+ skipVoid$1(ctx);
1891
+ if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 93) return res;
1892
+ if (c$1 !== 44) throw new TomlError$1("expected comma or end of structure", {
1893
+ toml: ctx.s,
1894
+ ptr: ctx.p - 1
1895
+ });
1896
+ }
1897
+ throw new TomlError$1("unfinished array encountered", {
1898
+ toml: ctx.s,
1899
+ ptr: ctx.p
1931
1900
  });
1932
- return [res, ptr];
1933
1901
  }
1934
1902
  __name$6(parseArray$1, "parseArray");
1935
1903
  function peekTable$1(key, table, meta$3, type) {
@@ -1999,46 +1967,51 @@ function peekTable$1(key, table, meta$3, type) {
1999
1967
  }
2000
1968
  __name$6(peekTable$1, "peekTable");
2001
1969
  function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
1970
+ let ctx = {
1971
+ s: toml,
1972
+ p: 0,
1973
+ d: maxDepth
1974
+ };
2002
1975
  let res = {};
2003
1976
  let meta$3 = {};
1977
+ let tmp;
2004
1978
  let tbl = res;
2005
1979
  let m = meta$3;
2006
- for (let ptr = skipVoid$1(toml, 0); ptr < toml.length;) {
2007
- if (toml[ptr] === "[") {
2008
- let isTableArray = toml[++ptr] === "[";
2009
- let k = parseKey$1(toml, ptr += +isTableArray, "]");
1980
+ skipVoid$1(ctx);
1981
+ while (ctx.p < toml.length) {
1982
+ if (toml.charCodeAt(ctx.p) === 91) {
1983
+ let isTableArray = toml.charCodeAt(++ctx.p) === 91;
1984
+ tmp = ctx.p += +isTableArray;
1985
+ let k = parseKey$1(ctx, "]");
2010
1986
  if (isTableArray) {
2011
- if (toml[k[1] - 1] !== "]") throw new TomlError$1("expected end of table declaration", {
1987
+ if (toml.charCodeAt(ctx.p - 1) !== 93) throw new TomlError$1("expected end of table declaration", {
2012
1988
  toml,
2013
- ptr: k[1] - 1
1989
+ ptr: ctx.p - 1
2014
1990
  });
2015
- k[1]++;
1991
+ ctx.p++;
2016
1992
  }
2017
- let p$2 = peekTable$1(k[0], res, meta$3, isTableArray ? 2 : 1);
1993
+ let p$2 = peekTable$1(k, res, meta$3, isTableArray ? 2 : 1);
2018
1994
  if (!p$2) throw new TomlError$1("trying to redefine an already defined table or value", {
2019
1995
  toml,
2020
- ptr
1996
+ ptr: tmp
2021
1997
  });
2022
1998
  m = p$2[2];
2023
1999
  tbl = p$2[1];
2024
- ptr = k[1];
2025
2000
  } else {
2026
- let k = parseKey$1(toml, ptr);
2027
- let p$2 = peekTable$1(k[0], tbl, m, 0);
2001
+ tmp = ctx.p;
2002
+ let p$2 = peekTable$1(parseKey$1(ctx), tbl, m, 0);
2028
2003
  if (!p$2) throw new TomlError$1("trying to redefine an already defined table or value", {
2029
2004
  toml,
2030
- ptr
2005
+ ptr: tmp
2031
2006
  });
2032
- let v = extractValue$1(toml, k[1], void 0, maxDepth, integersAsBigInt);
2033
- p$2[1][p$2[0]] = v[0];
2034
- ptr = v[1];
2007
+ p$2[1][p$2[0]] = extractValue$1(ctx, void 0, integersAsBigInt);
2035
2008
  }
2036
- ptr = skipVoid$1(toml, ptr, true);
2037
- if (toml[ptr] && toml[ptr] !== "\n" && toml[ptr] !== "\r") throw new TomlError$1("each key-value declaration must be followed by an end-of-line", {
2009
+ skipVoid$1(ctx, true);
2010
+ if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) throw new TomlError$1("each key-value declaration must be followed by an end-of-line", {
2038
2011
  toml,
2039
- ptr
2012
+ ptr: ctx.p
2040
2013
  });
2041
- ptr = skipVoid$1(toml, ptr);
2014
+ skipVoid$1(ctx);
2042
2015
  }
2043
2016
  return res;
2044
2017
  }
@@ -2048,7 +2021,8 @@ function extendedTypeOf$1(obj) {
2048
2021
  let type = typeof obj;
2049
2022
  if (type === "object") {
2050
2023
  if (Array.isArray(obj)) return "array";
2051
- if (obj instanceof Date) return "date";
2024
+ if (typeof obj?.getUTCDate === "function" && obj instanceof Date) return "date";
2025
+ if (globalThis.Temporal && typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) return "temporal";
2052
2026
  }
2053
2027
  return type;
2054
2028
  }
@@ -2062,23 +2036,31 @@ function formatString$1(s) {
2062
2036
  return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
2063
2037
  }
2064
2038
  __name$6(formatString$1, "formatString");
2039
+ function stringifyTemporal$1(temporal) {
2040
+ return temporal.toString({
2041
+ calendarName: "never",
2042
+ timeZoneName: "never"
2043
+ });
2044
+ }
2045
+ __name$6(stringifyTemporal$1, "stringifyTemporal");
2065
2046
  function stringifyValue$1(val, type, depth$1, numberAsFloat) {
2066
2047
  if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
2067
- if (type === "number") {
2068
- if (isNaN(val)) return "nan";
2069
- if (val === Infinity) return "inf";
2070
- if (val === -Infinity) return "-inf";
2071
- if (numberAsFloat && Number.isInteger(val)) return val.toFixed(1);
2072
- return val.toString();
2073
- }
2074
- if (type === "bigint" || type === "boolean") return val.toString();
2075
- if (type === "string") return formatString$1(val);
2076
- if (type === "date") {
2077
- if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
2078
- return val.toISOString();
2079
- }
2080
- if (type === "object") return stringifyInlineTable$1(val, depth$1, numberAsFloat);
2081
- if (type === "array") return stringifyArray$1(val, depth$1, numberAsFloat);
2048
+ switch (type) {
2049
+ case "number":
2050
+ if (isNaN(val)) return "nan";
2051
+ if (val === Infinity) return "inf";
2052
+ if (val === -Infinity) return "-inf";
2053
+ if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val))) return val.toFixed(1);
2054
+ case "bigint":
2055
+ case "boolean": return val.toString();
2056
+ case "string": return formatString$1(val);
2057
+ case "date":
2058
+ if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
2059
+ return val.toISOString();
2060
+ case "object": return stringifyInlineTable$1(val, depth$1, numberAsFloat);
2061
+ case "array": return stringifyArray$1(val, depth$1, numberAsFloat);
2062
+ case "temporal": return stringifyTemporal$1(val);
2063
+ }
2082
2064
  }
2083
2065
  __name$6(stringifyValue$1, "stringifyValue");
2084
2066
  function stringifyInlineTable$1(obj, depth$1, numberAsFloat) {
@@ -80082,7 +80064,7 @@ var __name$1 = (target$1, value) => __defProp$1(target$1, "name", {
80082
80064
  });
80083
80065
 
80084
80066
  //#endregion
80085
- //#region ../workers-auth/dist/chunk-LQW53VED.mjs
80067
+ //#region ../workers-auth/dist/chunk-4CJO23DA.mjs
80086
80068
  var import_undici$2 = require_undici();
80087
80069
  var hasWarnedAboutDeprecatedV1ApiToken = false;
80088
80070
  function readStoredAuthState(options) {
@@ -81571,114 +81553,7 @@ function getProfileForDirectoryFromBindings(startDir, bindings) {
81571
81553
  }
81572
81554
  }
81573
81555
  __name$1(getProfileForDirectoryFromBindings, "getProfileForDirectoryFromBindings");
81574
- function getLineColFromPtr(string$3, ptr) {
81575
- let lines = string$3.slice(0, ptr).split(/\r\n|\n|\r/g);
81576
- return [lines.length, lines.pop().length + 1];
81577
- }
81578
- __name$1(getLineColFromPtr, "getLineColFromPtr");
81579
- function makeCodeBlock(string$3, line, column) {
81580
- let lines = string$3.split(/\r\n|\n|\r/g);
81581
- let codeblock = "";
81582
- let numberLen = (Math.log10(line + 1) | 0) + 1;
81583
- for (let i$1 = line - 1; i$1 <= line + 1; i$1++) {
81584
- let l = lines[i$1 - 1];
81585
- if (!l) continue;
81586
- codeblock += i$1.toString().padEnd(numberLen, " ");
81587
- codeblock += ": ";
81588
- codeblock += l;
81589
- codeblock += "\n";
81590
- if (i$1 === line) {
81591
- codeblock += " ".repeat(numberLen + column + 2);
81592
- codeblock += "^\n";
81593
- }
81594
- }
81595
- return codeblock;
81596
- }
81597
- __name$1(makeCodeBlock, "makeCodeBlock");
81598
- var TomlError = class extends Error {
81599
- static {
81600
- __name$1(this, "TomlError");
81601
- }
81602
- line;
81603
- column;
81604
- codeblock;
81605
- constructor(message, options) {
81606
- const [line, column] = getLineColFromPtr(options.toml, options.ptr);
81607
- const codeblock = makeCodeBlock(options.toml, line, column);
81608
- super(`Invalid TOML document: ${message}
81609
-
81610
- ${codeblock}`, options);
81611
- this.line = line;
81612
- this.column = column;
81613
- this.codeblock = codeblock;
81614
- }
81615
- };
81616
- function isEscaped(str, ptr) {
81617
- let i$1 = 0;
81618
- while (str[ptr - ++i$1] === "\\");
81619
- return --i$1 && i$1 % 2;
81620
- }
81621
- __name$1(isEscaped, "isEscaped");
81622
- function indexOfNewline(str, start = 0, end = str.length) {
81623
- let idx = str.indexOf("\n", start);
81624
- if (str[idx - 1] === "\r") idx--;
81625
- return idx <= end ? idx : -1;
81626
- }
81627
- __name$1(indexOfNewline, "indexOfNewline");
81628
- function skipComment(str, ptr) {
81629
- for (let i$1 = ptr; i$1 < str.length; i$1++) {
81630
- let c$1 = str[i$1];
81631
- if (c$1 === "\n") return i$1;
81632
- if (c$1 === "\r" && str[i$1 + 1] === "\n") return i$1 + 1;
81633
- if (c$1 < " " && c$1 !== " " || c$1 === "") throw new TomlError("control characters are not allowed in comments", {
81634
- toml: str,
81635
- ptr
81636
- });
81637
- }
81638
- return str.length;
81639
- }
81640
- __name$1(skipComment, "skipComment");
81641
- function skipVoid(str, ptr, banNewLines, banComments) {
81642
- let c$1;
81643
- while ((c$1 = str[ptr]) === " " || c$1 === " " || !banNewLines && (c$1 === "\n" || c$1 === "\r" && str[ptr + 1] === "\n")) ptr++;
81644
- return banComments || c$1 !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
81645
- }
81646
- __name$1(skipVoid, "skipVoid");
81647
- function skipUntil(str, ptr, sep$1, end, banNewLines = false) {
81648
- if (!end) {
81649
- ptr = indexOfNewline(str, ptr);
81650
- return ptr < 0 ? str.length : ptr;
81651
- }
81652
- for (let i$1 = ptr; i$1 < str.length; i$1++) {
81653
- let c$1 = str[i$1];
81654
- if (c$1 === "#") i$1 = indexOfNewline(str, i$1);
81655
- else if (c$1 === sep$1) return i$1 + 1;
81656
- else if (c$1 === end || banNewLines && (c$1 === "\n" || c$1 === "\r" && str[i$1 + 1] === "\n")) return i$1;
81657
- }
81658
- throw new TomlError("cannot find end of structure", {
81659
- toml: str,
81660
- ptr
81661
- });
81662
- }
81663
- __name$1(skipUntil, "skipUntil");
81664
- function getStringEnd(str, seek) {
81665
- let first = str[seek];
81666
- let target$1 = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
81667
- seek += target$1.length - 1;
81668
- do
81669
- seek = str.indexOf(target$1, ++seek);
81670
- while (seek > -1 && first !== "'" && isEscaped(str, seek));
81671
- if (seek > -1) {
81672
- seek += target$1.length;
81673
- if (target$1.length > 1) {
81674
- if (str[seek] === first) seek++;
81675
- if (str[seek] === first) seek++;
81676
- }
81677
- }
81678
- return seek;
81679
- }
81680
- __name$1(getStringEnd, "getStringEnd");
81681
- var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;
81556
+ var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
81682
81557
  var TomlDate = class _TomlDate extends Date {
81683
81558
  static {
81684
81559
  __name$1(this, "TomlDate");
@@ -81762,305 +81637,380 @@ var TomlDate = class _TomlDate extends Date {
81762
81637
  return date$3;
81763
81638
  }
81764
81639
  };
81640
+ function getLineColFromPtr(string$3, ptr) {
81641
+ let lines = string$3.slice(0, ptr).split(/\r\n|\n|\r/g);
81642
+ return [lines.length, lines.pop().length + 1];
81643
+ }
81644
+ __name$1(getLineColFromPtr, "getLineColFromPtr");
81645
+ function makeCodeBlock(string$3, line, column) {
81646
+ let lines = string$3.split(/\r\n|\n|\r/g);
81647
+ let codeblock = "";
81648
+ let numberLen = (Math.log10(line + 1) | 0) + 1;
81649
+ for (let i$1 = line - 1; i$1 <= line + 1; i$1++) {
81650
+ let l = lines[i$1 - 1];
81651
+ if (!l) continue;
81652
+ codeblock += i$1.toString().padEnd(numberLen, " ");
81653
+ codeblock += ": ";
81654
+ codeblock += l;
81655
+ codeblock += "\n";
81656
+ if (i$1 === line) {
81657
+ codeblock += " ".repeat(numberLen + column + 2);
81658
+ codeblock += "^\n";
81659
+ }
81660
+ }
81661
+ return codeblock;
81662
+ }
81663
+ __name$1(makeCodeBlock, "makeCodeBlock");
81664
+ var TomlError = class extends Error {
81665
+ static {
81666
+ __name$1(this, "TomlError");
81667
+ }
81668
+ line;
81669
+ column;
81670
+ codeblock;
81671
+ constructor(message, options) {
81672
+ const [line, column] = getLineColFromPtr(options.toml, options.ptr);
81673
+ const codeblock = makeCodeBlock(options.toml, line, column);
81674
+ super(`Invalid TOML document: ${message}
81675
+
81676
+ ${codeblock}`, options);
81677
+ this.line = line;
81678
+ this.column = column;
81679
+ this.codeblock = codeblock;
81680
+ }
81681
+ };
81682
+ function indexOfNewline(str, start = 0) {
81683
+ let idx = str.indexOf("\n", start);
81684
+ if (str.charCodeAt(idx - 1) === 13) idx--;
81685
+ return idx;
81686
+ }
81687
+ __name$1(indexOfNewline, "indexOfNewline");
81688
+ function skipComment(ctx) {
81689
+ for (; ctx.p < ctx.s.length; ctx.p++) {
81690
+ let c$1 = ctx.s.charCodeAt(ctx.p);
81691
+ if (c$1 === 10) break;
81692
+ if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
81693
+ ctx.p++;
81694
+ break;
81695
+ }
81696
+ if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError("control characters are not allowed in comments", {
81697
+ toml: ctx.s,
81698
+ ptr: ctx.p
81699
+ });
81700
+ }
81701
+ }
81702
+ __name$1(skipComment, "skipComment");
81703
+ function skipVoid(ctx, banNewLines, banComments) {
81704
+ let c$1;
81705
+ while (1) {
81706
+ while ((c$1 = ctx.s.charCodeAt(ctx.p)) === 32 || c$1 === 9 || !banNewLines && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) ctx.p++;
81707
+ if (banComments || c$1 !== 35) break;
81708
+ skipComment(ctx);
81709
+ }
81710
+ }
81711
+ __name$1(skipVoid, "skipVoid");
81712
+ function skipUntil(ctx, sep$1, end) {
81713
+ let ptr = ctx.p;
81714
+ if (!end) {
81715
+ ptr = indexOfNewline(ctx.s, ptr);
81716
+ ctx.p = ptr < 0 ? ctx.s.length : ptr;
81717
+ return;
81718
+ }
81719
+ for (; ctx.p < ctx.s.length; ctx.p++) {
81720
+ let c$1 = ctx.s.charCodeAt(ctx.p);
81721
+ if (c$1 === 35) skipComment(ctx);
81722
+ else if (c$1 === end || c$1 === sep$1) return;
81723
+ }
81724
+ throw new TomlError("cannot find end of structure", {
81725
+ toml: ctx.s,
81726
+ ptr
81727
+ });
81728
+ }
81729
+ __name$1(skipUntil, "skipUntil");
81765
81730
  var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
81766
81731
  var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
81767
81732
  var LEADING_ZERO = /^[+-]?0[0-9_]/;
81768
- var ESCAPE_REGEX = /^[0-9a-f]{4,8}$/i;
81769
- var ESC_MAP = {
81770
- b: "\b",
81771
- t: " ",
81772
- n: "\n",
81773
- f: "\f",
81774
- r: "\r",
81775
- "\"": "\"",
81776
- "\\": "\\"
81777
- };
81778
- function parseString(str, ptr = 0, endPtr = str.length) {
81779
- let isLiteral = str[ptr] === "'";
81780
- let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
81733
+ function parseString(ctx) {
81734
+ let start = ctx.p;
81735
+ let c$1 = ctx.s.charCodeAt(ctx.p++);
81736
+ let first = c$1;
81737
+ let isLiteral = c$1 === 39;
81738
+ let isMultiline = c$1 === ctx.s.charCodeAt(ctx.p) && c$1 === ctx.s.charCodeAt(ctx.p + 1);
81781
81739
  if (isMultiline) {
81782
- endPtr -= 2;
81783
- if (str[ptr += 2] === "\r") ptr++;
81784
- if (str[ptr] === "\n") ptr++;
81740
+ if ((c$1 = ctx.s.charCodeAt(ctx.p += 2)) === 10) ctx.p++;
81741
+ else if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) ctx.p += 2;
81785
81742
  }
81786
- let tmp = 0;
81787
- let isEscape;
81788
81743
  let parsed = "";
81789
- let sliceStart = ptr;
81790
- while (ptr < endPtr - 1) {
81791
- let c$1 = str[ptr++];
81792
- if (c$1 === "\n" || c$1 === "\r" && str[ptr] === "\n") {
81793
- if (!isMultiline) throw new TomlError("newlines are not allowed in strings", {
81794
- toml: str,
81795
- ptr: ptr - 1
81796
- });
81797
- } else if (c$1 < " " && c$1 !== " " || c$1 === "") throw new TomlError("control characters are not allowed in strings", {
81798
- toml: str,
81799
- ptr: ptr - 1
81800
- });
81801
- if (isEscape) {
81802
- isEscape = false;
81803
- if (c$1 === "u" || c$1 === "U") {
81804
- let code = str.slice(ptr, ptr += c$1 === "u" ? 4 : 8);
81805
- if (!ESCAPE_REGEX.test(code)) throw new TomlError("invalid unicode escape", {
81806
- toml: str,
81807
- ptr: tmp
81808
- });
81809
- try {
81810
- parsed += String.fromCodePoint(parseInt(code, 16));
81811
- } catch {
81812
- throw new TomlError("invalid unicode escape", {
81813
- toml: str,
81814
- ptr: tmp
81815
- });
81816
- }
81817
- } else if (isMultiline && (c$1 === "\n" || c$1 === " " || c$1 === " " || c$1 === "\r")) {
81818
- ptr = skipVoid(str, ptr - 1, true);
81819
- if (str[ptr] !== "\n" && str[ptr] !== "\r") throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
81820
- toml: str,
81821
- ptr: tmp
81744
+ let sliceStart = ctx.p;
81745
+ let state = 0;
81746
+ for (; ctx.p < ctx.s.length; ctx.p++) {
81747
+ c$1 = ctx.s.charCodeAt(ctx.p);
81748
+ if (isMultiline && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) state = state && 3;
81749
+ else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError("control characters are not allowed in strings", {
81750
+ toml: ctx.s,
81751
+ ptr: ctx.p
81752
+ });
81753
+ else if ((!state || state === 3) && c$1 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
81754
+ if (isMultiline) {
81755
+ if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
81756
+ if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
81757
+ }
81758
+ if (!state) parsed += ctx.s.slice(sliceStart, ctx.p);
81759
+ ctx.p += isMultiline ? 3 : 1;
81760
+ return parsed;
81761
+ } else if (!state) {
81762
+ if (!isLiteral && c$1 === 92) {
81763
+ parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
81764
+ state = 1;
81765
+ }
81766
+ } else if (state === 1) if (c$1 === 120 || c$1 === 117 || c$1 === 85) {
81767
+ let value = 0;
81768
+ let len = c$1 === 120 ? 2 : c$1 === 117 ? 4 : 8;
81769
+ for (let j$1 = 0; j$1 < len; j$1++, ctx.p++) {
81770
+ let hex$1 = ctx.s.charCodeAt(ctx.p + 1);
81771
+ let digit = hex$1 >= 48 && hex$1 <= 57 ? hex$1 - 48 : hex$1 >= 65 && hex$1 <= 70 ? hex$1 - 65 + 10 : hex$1 >= 97 && hex$1 <= 102 ? hex$1 - 97 + 10 : -1;
81772
+ if (digit < 0) throw new TomlError("invalid non-hex character in unicode escape", {
81773
+ toml: ctx.s,
81774
+ ptr: ctx.p + 1
81822
81775
  });
81823
- ptr = skipVoid(str, ptr);
81824
- } else if (c$1 in ESC_MAP) parsed += ESC_MAP[c$1];
81776
+ value = value << 4 | digit;
81777
+ }
81778
+ if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new TomlError("invalid unicode escape", {
81779
+ toml: ctx.s,
81780
+ ptr: ctx.p
81781
+ });
81782
+ parsed += String.fromCodePoint(value);
81783
+ sliceStart = ctx.p + 1;
81784
+ state = 0;
81785
+ } else if (c$1 === 32 || c$1 === 9) state = 2;
81786
+ else {
81787
+ if (c$1 === 98) parsed += "\b";
81788
+ else if (c$1 === 116) parsed += " ";
81789
+ else if (c$1 === 110) parsed += "\n";
81790
+ else if (c$1 === 102) parsed += "\f";
81791
+ else if (c$1 === 114) parsed += "\r";
81792
+ else if (c$1 === 101) parsed += "\x1B";
81793
+ else if (c$1 === 34) parsed += "\"";
81794
+ else if (c$1 === 92) parsed += "\\";
81825
81795
  else throw new TomlError("unrecognized escape sequence", {
81826
- toml: str,
81827
- ptr: tmp
81796
+ toml: ctx.s,
81797
+ ptr: ctx.p
81798
+ });
81799
+ sliceStart = ctx.p + 1;
81800
+ state = 0;
81801
+ }
81802
+ else if (c$1 !== 32 && c$1 !== 9) {
81803
+ if (state === 2) throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
81804
+ toml: ctx.s,
81805
+ ptr: sliceStart
81828
81806
  });
81829
- sliceStart = ptr;
81830
- } else if (!isLiteral && c$1 === "\\") {
81831
- tmp = ptr - 1;
81832
- isEscape = true;
81833
- parsed += str.slice(sliceStart, tmp);
81807
+ state = !isLiteral && c$1 === 92 ? 1 : 0;
81808
+ sliceStart = ctx.p;
81834
81809
  }
81835
81810
  }
81836
- return parsed + str.slice(sliceStart, endPtr - 1);
81811
+ throw new TomlError("unfinished string", {
81812
+ toml: ctx.s,
81813
+ ptr: start
81814
+ });
81837
81815
  }
81838
81816
  __name$1(parseString, "parseString");
81839
- function parseValue(value, toml, ptr, integersAsBigInt) {
81840
- if (value === "true") return true;
81841
- if (value === "false") return false;
81817
+ function sliceAndTrimEndOf(ctx, start, end) {
81818
+ let value = ctx.s.slice(start, end);
81819
+ let commentIdx = value.indexOf("#");
81820
+ if (commentIdx > 0) {
81821
+ skipComment({
81822
+ s: value,
81823
+ p: commentIdx
81824
+ });
81825
+ value = value.slice(0, commentIdx);
81826
+ }
81827
+ return value.trimEnd();
81828
+ }
81829
+ __name$1(sliceAndTrimEndOf, "sliceAndTrimEndOf");
81830
+ function parseValue(ctx, integersAsBigInt, end) {
81831
+ let ptr = ctx.p;
81832
+ let err = {
81833
+ toml: ctx.s,
81834
+ ptr
81835
+ };
81836
+ skipUntil(ctx, 44, end);
81837
+ let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
81838
+ if (!value) throw new TomlError("incomplete declaration: value expected", err);
81842
81839
  if (value === "-inf") return -Infinity;
81843
81840
  if (value === "inf" || value === "+inf") return Infinity;
81844
81841
  if (value === "nan" || value === "+nan" || value === "-nan") return NaN;
81845
81842
  if (value === "-0") return integersAsBigInt ? 0n : 0;
81846
81843
  let isInt = INT_REGEX.test(value);
81847
81844
  if (isInt || FLOAT_REGEX.test(value)) {
81848
- if (LEADING_ZERO.test(value)) throw new TomlError("leading zeroes are not allowed", {
81849
- toml,
81850
- ptr
81851
- });
81845
+ if (LEADING_ZERO.test(value)) throw new TomlError("leading zeroes are not allowed", err);
81852
81846
  value = value.replace(/_/g, "");
81853
81847
  let numeric$1 = +value;
81854
- if (isNaN(numeric$1)) throw new TomlError("invalid number", {
81855
- toml,
81856
- ptr
81857
- });
81848
+ if (isNaN(numeric$1)) throw new TomlError("invalid number", err);
81858
81849
  if (isInt) {
81859
- if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError("integer value cannot be represented losslessly", {
81860
- toml,
81861
- ptr
81862
- });
81850
+ if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError("integer value cannot be represented losslessly", err);
81863
81851
  if (isInt || integersAsBigInt === true) numeric$1 = BigInt(value);
81864
81852
  }
81865
81853
  return numeric$1;
81866
81854
  }
81867
81855
  const date$3 = new TomlDate(value);
81868
- if (!date$3.isValid()) throw new TomlError("invalid value", {
81869
- toml,
81870
- ptr
81871
- });
81856
+ if (!date$3.isValid()) throw new TomlError("invalid value", err);
81872
81857
  return date$3;
81873
81858
  }
81874
81859
  __name$1(parseValue, "parseValue");
81875
- function sliceAndTrimEndOf(str, startPtr, endPtr, allowNewLines) {
81876
- let value = str.slice(startPtr, endPtr);
81877
- let commentIdx = value.indexOf("#");
81878
- if (commentIdx > -1) {
81879
- skipComment(str, commentIdx);
81880
- value = value.slice(0, commentIdx);
81881
- }
81882
- let trimmed = value.trimEnd();
81883
- if (!allowNewLines) {
81884
- let newlineIdx = value.indexOf("\n", trimmed.length);
81885
- if (newlineIdx > -1) throw new TomlError("newlines are not allowed in inline tables", {
81886
- toml: str,
81887
- ptr: startPtr + newlineIdx
81860
+ function extractValue(ctx, end, integersAsBigInt) {
81861
+ let ptr = ctx.p;
81862
+ let c$1 = ctx.s.charCodeAt(ptr);
81863
+ if (c$1 === 91 || c$1 === 123) {
81864
+ if (!ctx.d--) throw new TomlError("document contains excessively nested structures. aborting.", {
81865
+ toml: ctx.s,
81866
+ ptr
81888
81867
  });
81868
+ let value = c$1 === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
81869
+ ctx.d++;
81870
+ return value;
81889
81871
  }
81890
- return [trimmed, commentIdx];
81891
- }
81892
- __name$1(sliceAndTrimEndOf, "sliceAndTrimEndOf");
81893
- function extractValue(str, ptr, end, depth$1, integersAsBigInt) {
81894
- if (depth$1 === 0) throw new TomlError("document contains excessively nested structures. aborting.", {
81895
- toml: str,
81896
- ptr
81897
- });
81898
- let c$1 = str[ptr];
81899
- if (c$1 === "[" || c$1 === "{") {
81900
- let [value, endPtr2] = c$1 === "[" ? parseArray(str, ptr, depth$1, integersAsBigInt) : parseInlineTable(str, ptr, depth$1, integersAsBigInt);
81901
- let newPtr = end ? skipUntil(str, endPtr2, ",", end) : endPtr2;
81902
- if (endPtr2 - newPtr && end === "}") {
81903
- let nextNewLine = indexOfNewline(str, endPtr2, newPtr);
81904
- if (nextNewLine > -1) throw new TomlError("newlines are not allowed in inline tables", {
81905
- toml: str,
81906
- ptr: nextNewLine
81907
- });
81908
- }
81909
- return [value, newPtr];
81910
- }
81911
- let endPtr;
81912
- if (c$1 === "\"" || c$1 === "'") {
81913
- endPtr = getStringEnd(str, ptr);
81914
- let parsed = parseString(str, ptr, endPtr);
81915
- if (end) {
81916
- endPtr = skipVoid(str, endPtr, end !== "]");
81917
- if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== "\n" && str[endPtr] !== "\r") throw new TomlError("unexpected character encountered", {
81918
- toml: str,
81919
- ptr: endPtr
81920
- });
81921
- endPtr += +(str[endPtr] === ",");
81922
- }
81923
- return [parsed, endPtr];
81872
+ if (c$1 === 34 || c$1 === 39) return parseString(ctx);
81873
+ if (c$1 === 116) {
81874
+ if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError("invalid value", {
81875
+ toml: ctx.s,
81876
+ ptr
81877
+ });
81878
+ ctx.p++;
81879
+ return true;
81924
81880
  }
81925
- endPtr = skipUntil(str, ptr, ",", end);
81926
- let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","), end === "]");
81927
- if (!slice[0]) throw new TomlError("incomplete key-value declaration: no value specified", {
81928
- toml: str,
81929
- ptr
81930
- });
81931
- if (end && slice[1] > -1) {
81932
- endPtr = skipVoid(str, ptr + slice[1]);
81933
- endPtr += +(str[endPtr] === ",");
81881
+ if (c$1 === 102) {
81882
+ if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError("invalid value", {
81883
+ toml: ctx.s,
81884
+ ptr
81885
+ });
81886
+ ctx.p++;
81887
+ return false;
81934
81888
  }
81935
- return [parseValue(slice[0], str, ptr, integersAsBigInt), endPtr];
81889
+ return parseValue(ctx, integersAsBigInt, end);
81936
81890
  }
81937
81891
  __name$1(extractValue, "extractValue");
81938
81892
  var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
81939
- function parseKey(str, ptr, end = "=") {
81940
- let dot = ptr - 1;
81893
+ function parseKey(ctx, end = "=") {
81894
+ let start = ctx.p;
81895
+ let dot = start - 1;
81941
81896
  let parsed = [];
81942
- let endPtr = str.indexOf(end, ptr);
81897
+ let endPtr = ctx.s.indexOf(end, start);
81943
81898
  if (endPtr < 0) throw new TomlError("incomplete key-value: cannot find end of key", {
81944
- toml: str,
81945
- ptr
81899
+ toml: ctx.s,
81900
+ ptr: start
81946
81901
  });
81947
81902
  do {
81948
- let c$1 = str[ptr = ++dot];
81949
- if (c$1 !== " " && c$1 !== " ") if (c$1 === "\"" || c$1 === "'") {
81950
- if (c$1 === str[ptr + 1] && c$1 === str[ptr + 2]) throw new TomlError("multiline strings are not allowed in keys", {
81951
- toml: str,
81952
- ptr
81903
+ let c$1 = ctx.s.charCodeAt(ctx.p = ++dot);
81904
+ if (c$1 !== 32 && c$1 !== 9) if (c$1 === 34 || c$1 === 39) {
81905
+ if (c$1 === ctx.s.charCodeAt(ctx.p + 1) && c$1 === ctx.s.charCodeAt(ctx.p + 2)) throw new TomlError("multiline strings are not allowed in keys", {
81906
+ toml: ctx.s,
81907
+ ptr: ctx.p
81953
81908
  });
81954
- let eos = getStringEnd(str, ptr);
81955
- if (eos < 0) throw new TomlError("unfinished string encountered", {
81956
- toml: str,
81957
- ptr
81958
- });
81959
- dot = str.indexOf(".", eos);
81960
- let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
81909
+ let part = parseString(ctx);
81910
+ dot = ctx.s.indexOf(".", ctx.p);
81911
+ let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
81961
81912
  let newLine = indexOfNewline(strEnd);
81962
81913
  if (newLine > -1) throw new TomlError("newlines are not allowed in keys", {
81963
- toml: str,
81964
- ptr: ptr + dot + newLine
81914
+ toml: ctx.s,
81915
+ ptr: newLine
81965
81916
  });
81966
81917
  if (strEnd.trimStart()) throw new TomlError("found extra tokens after the string part", {
81967
- toml: str,
81968
- ptr: eos
81918
+ toml: ctx.s,
81919
+ ptr: ctx.p
81969
81920
  });
81970
- if (endPtr < eos) {
81971
- endPtr = str.indexOf(end, eos);
81921
+ if (endPtr < ctx.p) {
81922
+ endPtr = ctx.s.indexOf(end, ctx.p);
81972
81923
  if (endPtr < 0) throw new TomlError("incomplete key-value: cannot find end of key", {
81973
- toml: str,
81974
- ptr
81924
+ toml: ctx.s,
81925
+ ptr: start
81975
81926
  });
81976
81927
  }
81977
- parsed.push(parseString(str, ptr, eos));
81928
+ parsed.push(part);
81978
81929
  } else {
81979
- dot = str.indexOf(".", ptr);
81980
- let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
81930
+ dot = ctx.s.indexOf(".", ctx.p);
81931
+ let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
81981
81932
  if (!KEY_PART_RE.test(part)) throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
81982
- toml: str,
81983
- ptr
81933
+ toml: ctx.s,
81934
+ ptr: ctx.p
81984
81935
  });
81985
81936
  parsed.push(part.trimEnd());
81986
81937
  }
81987
81938
  } while (dot + 1 && dot < endPtr);
81988
- return [parsed, skipVoid(str, endPtr + 1, true, true)];
81939
+ ctx.p = endPtr + 1;
81940
+ skipVoid(ctx, true, true);
81941
+ return parsed;
81989
81942
  }
81990
81943
  __name$1(parseKey, "parseKey");
81991
- function parseInlineTable(str, ptr, depth$1, integersAsBigInt) {
81944
+ function parseInlineTable(ctx, integersAsBigInt) {
81992
81945
  let res = {};
81993
81946
  let seen = /* @__PURE__ */ new Set();
81994
81947
  let c$1;
81995
- let comma$1 = 0;
81996
- ptr++;
81997
- while ((c$1 = str[ptr++]) !== "}" && c$1) {
81998
- let err = {
81999
- toml: str,
82000
- ptr: ptr - 1
82001
- };
82002
- if (c$1 === "\n") throw new TomlError("newlines are not allowed in inline tables", err);
82003
- else if (c$1 === "#") throw new TomlError("inline tables cannot contain comments", err);
82004
- else if (c$1 === ",") throw new TomlError("expected key-value, found comma", err);
82005
- else if (c$1 !== " " && c$1 !== " ") {
82006
- let k;
82007
- let t$5 = res;
82008
- let hasOwn$1 = false;
82009
- let [key, keyEndPtr] = parseKey(str, ptr - 1);
82010
- for (let i$1 = 0; i$1 < key.length; i$1++) {
82011
- if (i$1) t$5 = hasOwn$1 ? t$5[k] : t$5[k] = {};
82012
- k = key[i$1];
82013
- if ((hasOwn$1 = Object.hasOwn(t$5, k)) && (typeof t$5[k] !== "object" || seen.has(t$5[k]))) throw new TomlError("trying to redefine an already defined value", {
82014
- toml: str,
82015
- ptr
82016
- });
82017
- if (!hasOwn$1 && k === "__proto__") Object.defineProperty(t$5, k, {
82018
- enumerable: true,
82019
- configurable: true,
82020
- writable: true
82021
- });
82022
- }
82023
- if (hasOwn$1) throw new TomlError("trying to redefine an already defined value", {
82024
- toml: str,
82025
- ptr
81948
+ ctx.p++;
81949
+ while (ctx.p < ctx.s.length) {
81950
+ skipVoid(ctx);
81951
+ if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 125) {
81952
+ ctx.p++;
81953
+ return res;
81954
+ }
81955
+ let k;
81956
+ let t$5 = res;
81957
+ let hasOwn$1 = false;
81958
+ let p$2 = ctx.p;
81959
+ let key = parseKey(ctx);
81960
+ for (let i$1 = 0; i$1 < key.length; i$1++) {
81961
+ if (i$1) t$5 = hasOwn$1 ? t$5[k] : t$5[k] = {};
81962
+ k = key[i$1];
81963
+ if ((hasOwn$1 = Object.hasOwn(t$5, k)) && (typeof t$5[k] !== "object" || seen.has(t$5[k]))) throw new TomlError("trying to redefine an already defined value", {
81964
+ toml: ctx.s,
81965
+ ptr: p$2
81966
+ });
81967
+ if (!hasOwn$1 && k === "__proto__") Object.defineProperty(t$5, k, {
81968
+ enumerable: true,
81969
+ configurable: true,
81970
+ writable: true
82026
81971
  });
82027
- let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth$1 - 1, integersAsBigInt);
82028
- seen.add(value);
82029
- t$5[k] = value;
82030
- ptr = valueEndPtr;
82031
- comma$1 = str[ptr - 1] === "," ? ptr - 1 : 0;
82032
81972
  }
81973
+ if (hasOwn$1) throw new TomlError("trying to redefine an already defined value", {
81974
+ toml: ctx.s,
81975
+ ptr: ctx.p
81976
+ });
81977
+ let value = extractValue(ctx, 125, integersAsBigInt);
81978
+ seen.add(t$5[k] = value);
81979
+ skipVoid(ctx);
81980
+ if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 125) return res;
81981
+ if (c$1 !== 44) throw new TomlError("expected comma or end of structure", {
81982
+ toml: ctx.s,
81983
+ ptr: ctx.p - 1
81984
+ });
82033
81985
  }
82034
- if (comma$1) throw new TomlError("trailing commas are not allowed in inline tables", {
82035
- toml: str,
82036
- ptr: comma$1
81986
+ throw new TomlError("unfinished table encountered", {
81987
+ toml: ctx.s,
81988
+ ptr: ctx.p
82037
81989
  });
82038
- if (!c$1) throw new TomlError("unfinished table encountered", {
82039
- toml: str,
82040
- ptr
82041
- });
82042
- return [res, ptr];
82043
81990
  }
82044
81991
  __name$1(parseInlineTable, "parseInlineTable");
82045
- function parseArray(str, ptr, depth$1, integersAsBigInt) {
81992
+ function parseArray(ctx, integersAsBigInt) {
82046
81993
  let res = [];
82047
81994
  let c$1;
82048
- ptr++;
82049
- while ((c$1 = str[ptr++]) !== "]" && c$1) if (c$1 === ",") throw new TomlError("expected value, found comma", {
82050
- toml: str,
82051
- ptr: ptr - 1
82052
- });
82053
- else if (c$1 === "#") ptr = skipComment(str, ptr);
82054
- else if (c$1 !== " " && c$1 !== " " && c$1 !== "\n" && c$1 !== "\r") {
82055
- let e = extractValue(str, ptr - 1, "]", depth$1 - 1, integersAsBigInt);
82056
- res.push(e[0]);
82057
- ptr = e[1];
82058
- }
82059
- if (!c$1) throw new TomlError("unfinished array encountered", {
82060
- toml: str,
82061
- ptr
81995
+ ctx.p++;
81996
+ while (ctx.p < ctx.s.length) {
81997
+ skipVoid(ctx);
81998
+ if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 93) {
81999
+ ctx.p++;
82000
+ return res;
82001
+ }
82002
+ res.push(extractValue(ctx, 93, integersAsBigInt));
82003
+ skipVoid(ctx);
82004
+ if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 93) return res;
82005
+ if (c$1 !== 44) throw new TomlError("expected comma or end of structure", {
82006
+ toml: ctx.s,
82007
+ ptr: ctx.p - 1
82008
+ });
82009
+ }
82010
+ throw new TomlError("unfinished array encountered", {
82011
+ toml: ctx.s,
82012
+ ptr: ctx.p
82062
82013
  });
82063
- return [res, ptr];
82064
82014
  }
82065
82015
  __name$1(parseArray, "parseArray");
82066
82016
  function peekTable(key, table, meta$3, type) {
@@ -82130,46 +82080,51 @@ function peekTable(key, table, meta$3, type) {
82130
82080
  }
82131
82081
  __name$1(peekTable, "peekTable");
82132
82082
  function parse$2(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
82083
+ let ctx = {
82084
+ s: toml,
82085
+ p: 0,
82086
+ d: maxDepth
82087
+ };
82133
82088
  let res = {};
82134
82089
  let meta$3 = {};
82090
+ let tmp;
82135
82091
  let tbl = res;
82136
82092
  let m = meta$3;
82137
- for (let ptr = skipVoid(toml, 0); ptr < toml.length;) {
82138
- if (toml[ptr] === "[") {
82139
- let isTableArray = toml[++ptr] === "[";
82140
- let k = parseKey(toml, ptr += +isTableArray, "]");
82093
+ skipVoid(ctx);
82094
+ while (ctx.p < toml.length) {
82095
+ if (toml.charCodeAt(ctx.p) === 91) {
82096
+ let isTableArray = toml.charCodeAt(++ctx.p) === 91;
82097
+ tmp = ctx.p += +isTableArray;
82098
+ let k = parseKey(ctx, "]");
82141
82099
  if (isTableArray) {
82142
- if (toml[k[1] - 1] !== "]") throw new TomlError("expected end of table declaration", {
82100
+ if (toml.charCodeAt(ctx.p - 1) !== 93) throw new TomlError("expected end of table declaration", {
82143
82101
  toml,
82144
- ptr: k[1] - 1
82102
+ ptr: ctx.p - 1
82145
82103
  });
82146
- k[1]++;
82104
+ ctx.p++;
82147
82105
  }
82148
- let p$2 = peekTable(k[0], res, meta$3, isTableArray ? 2 : 1);
82106
+ let p$2 = peekTable(k, res, meta$3, isTableArray ? 2 : 1);
82149
82107
  if (!p$2) throw new TomlError("trying to redefine an already defined table or value", {
82150
82108
  toml,
82151
- ptr
82109
+ ptr: tmp
82152
82110
  });
82153
82111
  m = p$2[2];
82154
82112
  tbl = p$2[1];
82155
- ptr = k[1];
82156
82113
  } else {
82157
- let k = parseKey(toml, ptr);
82158
- let p$2 = peekTable(k[0], tbl, m, 0);
82114
+ tmp = ctx.p;
82115
+ let p$2 = peekTable(parseKey(ctx), tbl, m, 0);
82159
82116
  if (!p$2) throw new TomlError("trying to redefine an already defined table or value", {
82160
82117
  toml,
82161
- ptr
82118
+ ptr: tmp
82162
82119
  });
82163
- let v = extractValue(toml, k[1], void 0, maxDepth, integersAsBigInt);
82164
- p$2[1][p$2[0]] = v[0];
82165
- ptr = v[1];
82120
+ p$2[1][p$2[0]] = extractValue(ctx, void 0, integersAsBigInt);
82166
82121
  }
82167
- ptr = skipVoid(toml, ptr, true);
82168
- if (toml[ptr] && toml[ptr] !== "\n" && toml[ptr] !== "\r") throw new TomlError("each key-value declaration must be followed by an end-of-line", {
82122
+ skipVoid(ctx, true);
82123
+ if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) throw new TomlError("each key-value declaration must be followed by an end-of-line", {
82169
82124
  toml,
82170
- ptr
82125
+ ptr: ctx.p
82171
82126
  });
82172
- ptr = skipVoid(toml, ptr);
82127
+ skipVoid(ctx);
82173
82128
  }
82174
82129
  return res;
82175
82130
  }
@@ -82179,7 +82134,8 @@ function extendedTypeOf(obj) {
82179
82134
  let type = typeof obj;
82180
82135
  if (type === "object") {
82181
82136
  if (Array.isArray(obj)) return "array";
82182
- if (obj instanceof Date) return "date";
82137
+ if (typeof obj?.getUTCDate === "function" && obj instanceof Date) return "date";
82138
+ if (globalThis.Temporal && typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) return "temporal";
82183
82139
  }
82184
82140
  return type;
82185
82141
  }
@@ -82193,23 +82149,31 @@ function formatString(s) {
82193
82149
  return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
82194
82150
  }
82195
82151
  __name$1(formatString, "formatString");
82152
+ function stringifyTemporal(temporal) {
82153
+ return temporal.toString({
82154
+ calendarName: "never",
82155
+ timeZoneName: "never"
82156
+ });
82157
+ }
82158
+ __name$1(stringifyTemporal, "stringifyTemporal");
82196
82159
  function stringifyValue(val, type, depth$1, numberAsFloat) {
82197
82160
  if (depth$1 === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
82198
- if (type === "number") {
82199
- if (isNaN(val)) return "nan";
82200
- if (val === Infinity) return "inf";
82201
- if (val === -Infinity) return "-inf";
82202
- if (numberAsFloat && Number.isInteger(val)) return val.toFixed(1);
82203
- return val.toString();
82204
- }
82205
- if (type === "bigint" || type === "boolean") return val.toString();
82206
- if (type === "string") return formatString(val);
82207
- if (type === "date") {
82208
- if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
82209
- return val.toISOString();
82210
- }
82211
- if (type === "object") return stringifyInlineTable(val, depth$1, numberAsFloat);
82212
- if (type === "array") return stringifyArray(val, depth$1, numberAsFloat);
82161
+ switch (type) {
82162
+ case "number":
82163
+ if (isNaN(val)) return "nan";
82164
+ if (val === Infinity) return "inf";
82165
+ if (val === -Infinity) return "-inf";
82166
+ if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val))) return val.toFixed(1);
82167
+ case "bigint":
82168
+ case "boolean": return val.toString();
82169
+ case "string": return formatString(val);
82170
+ case "date":
82171
+ if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
82172
+ return val.toISOString();
82173
+ case "object": return stringifyInlineTable(val, depth$1, numberAsFloat);
82174
+ case "array": return stringifyArray(val, depth$1, numberAsFloat);
82175
+ case "temporal": return stringifyTemporal(val);
82176
+ }
82213
82177
  }
82214
82178
  __name$1(stringifyValue, "stringifyValue");
82215
82179
  function stringifyInlineTable(obj, depth$1, numberAsFloat) {
@@ -83038,7 +83002,7 @@ function scrubEncryptedCredentials(options) {
83038
83002
  __name$1(scrubEncryptedCredentials, "scrubEncryptedCredentials");
83039
83003
 
83040
83004
  //#endregion
83041
- //#region ../workers-auth/dist/chunk-T63LVVAX.mjs
83005
+ //#region ../workers-auth/dist/chunk-A6F4WXCF.mjs
83042
83006
  function createPreferences(getConfigPath) {
83043
83007
  function getUserPreferencesPath() {
83044
83008
  return path__default.resolve(getConfigPath(), "preferences.json");
@@ -84192,7 +84156,7 @@ function getCfConfigPath() {
84192
84156
  });
84193
84157
  }
84194
84158
  __name$1(getCfConfigPath, "getCfConfigPath");
84195
- var CF_REGISTERED_SCOPES = [
84159
+ var CF_CLIENT_REGISTERED_SCOPES = [
84196
84160
  "access:read",
84197
84161
  "access:write",
84198
84162
  "account:read",
@@ -84668,102 +84632,21 @@ var CF_REGISTERED_SCOPES = [
84668
84632
  "zone.read",
84669
84633
  "zone.write"
84670
84634
  ];
84671
- var DefaultScopeKeys$1 = [...[
84672
- "openid",
84673
- "offline",
84674
- "user:read",
84675
- "account:read",
84676
- "access:read",
84677
- "access:write",
84678
- "agw:read",
84679
- "agw:run",
84680
- "agw:write",
84681
- "ai:read",
84682
- "ai:write",
84683
- "ai-search:read",
84684
- "ai-search:run",
84685
- "ai-search:write",
84686
- "aiaudit:read",
84687
- "aiaudit:write",
84688
- "aig:read",
84689
- "aig:write",
84690
- "auditlogs:read",
84691
- "browser:read",
84692
- "browser:write",
84693
- "cfone:read",
84694
- "cfone:write",
84695
- "cloudchamber:write",
84696
- "connectivity:admin",
84697
- "connectivity:bind",
84698
- "connectivity:read",
84699
- "constellation:write",
84700
- "containers:write",
84701
- "d1:write",
84702
- "dex:read",
84703
- "dex:write",
84704
- "dns_analytics:read",
84705
- "dns_records:edit",
84706
- "dns_records:read",
84707
- "dns_settings:read",
84708
- "email_routing:write",
84709
- "email_sending:write",
84710
- "firstpartytags:write",
84711
- "images:read",
84712
- "images:write",
84713
- "lb:edit",
84714
- "lb:read",
84715
- "logpush:read",
84716
- "logpush:write",
84717
- "mcp_portals:read",
84718
- "mcp_portals:write",
84719
- "notebook-examples:read",
84720
- "notification:read",
84721
- "notification:write",
84722
- "pages:read",
84723
- "pages:write",
84724
- "pipelines:read",
84725
- "pipelines:setup",
84726
- "pipelines:write",
84727
- "query_cache:write",
84728
- "queues:write",
84729
- "r2_catalog:write",
84730
- "radar:read",
84731
- "rag:read",
84732
- "rag:write",
84733
- "registrar:read",
84734
- "registrar:write",
84735
- "secrets_store:read",
84736
- "secrets_store:write",
84737
- "sso-connector:read",
84738
- "sso-connector:write",
84739
- "ssl_certs:write",
84740
- "tag.write",
84741
- "teams:pii",
84742
- "teams:read",
84743
- "teams:secure_location",
84744
- "teams:write",
84745
- "url_scanner:read",
84746
- "url_scanner:write",
84747
- "vectorize:write",
84748
- "workers:read",
84749
- "workers:write",
84750
- "workers_builds:read",
84751
- "workers_builds:write",
84752
- "workers_deployments:read",
84753
- "workers_kv:write",
84754
- "workers_observability:read",
84755
- "workers_observability:write",
84756
- "workers_observability_telemetry:write",
84757
- "workers_routes:write",
84758
- "workers_scripts:write",
84759
- "workers_tail:read",
84760
- "zone:read"
84761
- ]];
84635
+ var CF_UNGRANTABLE_SCOPE_SET = new Set([
84636
+ "billing:read",
84637
+ "billing:write",
84638
+ "email_routing:read",
84639
+ "email_sending:read",
84640
+ "notebook-managed:read",
84641
+ "oauth_account_ssl_and_certificates_write"
84642
+ ]);
84643
+ var CF_REQUESTABLE_SCOPES = CF_CLIENT_REGISTERED_SCOPES.filter((scope) => !CF_UNGRANTABLE_SCOPE_SET.has(scope));
84644
+ var DefaultScopeKeys$1 = [...CF_REQUESTABLE_SCOPES];
84762
84645
  function setLoginScopeKeys$1(scopes) {
84763
84646
  DefaultScopeKeys$1 = scopes;
84764
84647
  }
84765
84648
  __name$1(setLoginScopeKeys$1, "setLoginScopeKeys");
84766
- var CF_SCOPE_SET = new Set(CF_REGISTERED_SCOPES);
84649
+ var CF_SCOPE_SET = new Set(CF_REQUESTABLE_SCOPES);
84767
84650
  function validateScopeKeys$1(scopes) {
84768
84651
  return scopes.every((scope) => CF_SCOPE_SET.has(scope));
84769
84652
  }
@@ -85634,7 +85517,7 @@ __name(createWorkerUploadForm, "createWorkerUploadForm");
85634
85517
  //#endregion
85635
85518
  //#region ../remote-bindings/dist/index.mjs
85636
85519
  var import_undici = require_undici();
85637
- var version$2 = "0.0.30";
85520
+ var version$2 = "0.0.31";
85638
85521
  var NoDefaultValueProvided = class extends UserError {
85639
85522
  constructor() {
85640
85523
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });