@cloudflare/vitest-plugin 1.2.5 → 1.2.6

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.
@@ -528,7 +528,7 @@ __export(core_exports2, {
528
528
  isValidJWT: () => isValidJWT,
529
529
  locales: () => locales_exports,
530
530
  meta: () => meta,
531
- parse: () => parse$7,
531
+ parse: () => parse$6,
532
532
  parseAsync: () => parseAsync,
533
533
  prettifyError: () => prettifyError,
534
534
  process: () => process$2,
@@ -1363,7 +1363,7 @@ var _parse = /* @__PURE__ */ __name$3((_Err) => (schema, value, _ctx, _params) =
1363
1363
  }
1364
1364
  return result.value;
1365
1365
  }, "_parse");
1366
- var parse$7 = /* @__PURE__ */ _parse($ZodRealError);
1366
+ var parse$6 = /* @__PURE__ */ _parse($ZodRealError);
1367
1367
  var _parseAsync = /* @__PURE__ */ __name$3((_Err) => async (schema, value, _ctx, params) => {
1368
1368
  const ctx = _ctx ? {
1369
1369
  ..._ctx,
@@ -3916,9 +3916,9 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
3916
3916
  inst.implement = (func) => {
3917
3917
  if (typeof func !== "function") throw new Error("implement() must be called with a function");
3918
3918
  return function(...args) {
3919
- const parsedArgs = inst._def.input ? parse$7(inst._def.input, args) : args;
3919
+ const parsedArgs = inst._def.input ? parse$6(inst._def.input, args) : args;
3920
3920
  const result = Reflect.apply(func, this, parsedArgs);
3921
- if (inst._def.output) return parse$7(inst._def.output, result);
3921
+ if (inst._def.output) return parse$6(inst._def.output, result);
3922
3922
  return result;
3923
3923
  };
3924
3924
  };
@@ -13846,16 +13846,17 @@ function createFatalError$1(message, isJson, options) {
13846
13846
  __name$3(createFatalError$1, "createFatalError");
13847
13847
 
13848
13848
  //#endregion
13849
- //#region ../workers-utils/dist/chunk-IKXB77SR.mjs
13849
+ //#region ../workers-utils/dist/chunk-XNN5XXU4.mjs
13850
13850
  function hasKnownExportType(entry) {
13851
13851
  const type = entry?.type;
13852
- return type === "durable-object" || type === "worker";
13852
+ return type === "durable-object" || type === "worker" || type === "workflow";
13853
13853
  }
13854
13854
  __name$3(hasKnownExportType, "hasKnownExportType");
13855
13855
  function partitionExports(exports$1) {
13856
13856
  const partitioned = {
13857
13857
  "durable-object": {},
13858
- worker: {}
13858
+ worker: {},
13859
+ workflow: {}
13859
13860
  };
13860
13861
  if (exports$1 === void 0) return partitioned;
13861
13862
  for (const [name, entry] of Object.entries(exports$1)) {
@@ -14512,7 +14513,7 @@ var ParseOptions;
14512
14513
  (function(ParseOptions2) {
14513
14514
  ParseOptions2.DEFAULT = { allowTrailingComma: false };
14514
14515
  })(ParseOptions || (ParseOptions = {}));
14515
- function parse$6(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14516
+ function parse$5(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14516
14517
  let currentProperty = null;
14517
14518
  let currentParent = [];
14518
14519
  const previousParents = [];
@@ -14556,7 +14557,7 @@ function parse$6(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14556
14557
  }, options);
14557
14558
  return currentParent[0];
14558
14559
  }
14559
- __name$3(parse$6, "parse");
14560
+ __name$3(parse$5, "parse");
14560
14561
  function parseTree(text, errors$1 = [], options = ParseOptions.DEFAULT) {
14561
14562
  let currentParent = {
14562
14563
  type: "array",
@@ -14733,15 +14734,15 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14733
14734
  }
14734
14735
  }
14735
14736
  __name$3(scanNext, "scanNext");
14736
- function handleError(error$2, skipUntilAfter = [], skipUntil2 = []) {
14737
+ function handleError(error$2, skipUntilAfter = [], skipUntil = []) {
14737
14738
  onError$2(error$2);
14738
- if (skipUntilAfter.length + skipUntil2.length > 0) {
14739
+ if (skipUntilAfter.length + skipUntil.length > 0) {
14739
14740
  let token = _scanner.getToken();
14740
14741
  while (token !== 17) {
14741
14742
  if (skipUntilAfter.indexOf(token) !== -1) {
14742
14743
  scanNext();
14743
14744
  break;
14744
- } else if (skipUntil2.indexOf(token) !== -1) break;
14745
+ } else if (skipUntil.indexOf(token) !== -1) break;
14745
14746
  token = scanNext();
14746
14747
  }
14747
14748
  }
@@ -14793,7 +14794,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14793
14794
  if (_scanner.getToken() === 6) {
14794
14795
  onSeparator(":");
14795
14796
  scanNext();
14796
- if (!parseValue2()) handleError(4, [], [2, 5]);
14797
+ if (!parseValue()) handleError(4, [], [2, 5]);
14797
14798
  } else handleError(5, [], [2, 5]);
14798
14799
  _jsonPath.pop();
14799
14800
  return true;
@@ -14835,7 +14836,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14835
14836
  _jsonPath.push(0);
14836
14837
  isFirstElement = false;
14837
14838
  } else _jsonPath[_jsonPath.length - 1]++;
14838
- if (!parseValue2()) handleError(4, [], [4, 5]);
14839
+ if (!parseValue()) handleError(4, [], [4, 5]);
14839
14840
  needsComma = true;
14840
14841
  }
14841
14842
  onArrayEnd();
@@ -14845,7 +14846,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14845
14846
  return true;
14846
14847
  }
14847
14848
  __name$3(parseArray2, "parseArray");
14848
- function parseValue2() {
14849
+ function parseValue() {
14849
14850
  switch (_scanner.getToken()) {
14850
14851
  case 3: return parseArray2();
14851
14852
  case 1: return parseObject();
@@ -14853,14 +14854,14 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
14853
14854
  default: return parseLiteral();
14854
14855
  }
14855
14856
  }
14856
- __name$3(parseValue2, "parseValue");
14857
+ __name$3(parseValue, "parseValue");
14857
14858
  scanNext();
14858
14859
  if (_scanner.getToken() === 17) {
14859
14860
  if (options.allowEmptyContent) return true;
14860
14861
  handleError(4, [], []);
14861
14862
  return false;
14862
14863
  }
14863
- if (!parseValue2()) {
14864
+ if (!parseValue()) {
14864
14865
  handleError(4, [], []);
14865
14866
  return false;
14866
14867
  }
@@ -15084,7 +15085,7 @@ var SyntaxKind;
15084
15085
  SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
15085
15086
  SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
15086
15087
  })(SyntaxKind || (SyntaxKind = {}));
15087
- var parse2 = parse$6;
15088
+ var parse2 = parse$5;
15088
15089
  var ParseErrorCode;
15089
15090
  (function(ParseErrorCode2) {
15090
15091
  ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
@@ -15150,97 +15151,13 @@ function applyEdits(text, edits) {
15150
15151
  return text;
15151
15152
  }
15152
15153
  __name$3(applyEdits, "applyEdits");
15153
- 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;
15154
- var TomlDate$1 = class _TomlDate extends Date {
15155
- static {
15156
- __name$3(this, "TomlDate");
15157
- }
15158
- #hasDate = false;
15159
- #hasTime = false;
15160
- #offset = null;
15161
- constructor(date$1) {
15162
- let hasDate = true;
15163
- let hasTime = true;
15164
- let offset = "Z";
15165
- if (typeof date$1 === "string") {
15166
- let match = date$1.match(DATE_TIME_RE$1);
15167
- if (match) {
15168
- if (!match[1]) {
15169
- hasDate = false;
15170
- date$1 = `0000-01-01T${date$1}`;
15171
- }
15172
- hasTime = !!match[2];
15173
- hasTime && date$1[10] === " " && (date$1 = date$1.replace(" ", "T"));
15174
- if (match[2] && +match[2] > 23) date$1 = "";
15175
- else {
15176
- offset = match[3] || null;
15177
- date$1 = date$1.toUpperCase();
15178
- if (!offset && hasTime) date$1 += "Z";
15179
- }
15180
- } else date$1 = "";
15181
- }
15182
- super(date$1);
15183
- if (!isNaN(this.getTime())) {
15184
- this.#hasDate = hasDate;
15185
- this.#hasTime = hasTime;
15186
- this.#offset = offset;
15187
- }
15188
- }
15189
- isDateTime() {
15190
- return this.#hasDate && this.#hasTime;
15191
- }
15192
- isLocal() {
15193
- return !this.#hasDate || !this.#hasTime || !this.#offset;
15194
- }
15195
- isDate() {
15196
- return this.#hasDate && !this.#hasTime;
15197
- }
15198
- isTime() {
15199
- return this.#hasTime && !this.#hasDate;
15200
- }
15201
- isValid() {
15202
- return this.#hasDate || this.#hasTime;
15203
- }
15204
- toISOString() {
15205
- let iso = super.toISOString();
15206
- if (this.isDate()) return iso.slice(0, 10);
15207
- if (this.isTime()) return iso.slice(11, 23);
15208
- if (this.#offset === null) return iso.slice(0, -1);
15209
- if (this.#offset === "Z") return iso;
15210
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
15211
- offset = this.#offset[0] === "-" ? offset : -offset;
15212
- return (/* @__PURE__ */ new Date(this.getTime() - offset * 6e4)).toISOString().slice(0, -1) + this.#offset;
15213
- }
15214
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
15215
- let date$1 = new _TomlDate(jsDate);
15216
- date$1.#offset = offset;
15217
- return date$1;
15218
- }
15219
- static wrapAsLocalDateTime(jsDate) {
15220
- let date$1 = new _TomlDate(jsDate);
15221
- date$1.#offset = null;
15222
- return date$1;
15223
- }
15224
- static wrapAsLocalDate(jsDate) {
15225
- let date$1 = new _TomlDate(jsDate);
15226
- date$1.#hasTime = false;
15227
- date$1.#offset = null;
15228
- return date$1;
15229
- }
15230
- static wrapAsLocalTime(jsDate) {
15231
- let date$1 = new _TomlDate(jsDate);
15232
- date$1.#hasDate = false;
15233
- date$1.#offset = null;
15234
- return date$1;
15235
- }
15236
- };
15237
- function getLineColFromPtr$1(string$1, ptr) {
15238
- let lines = string$1.slice(0, ptr).split(/\r\n|\n|\r/g);
15154
+ function getLineColFromPtr(string$1, ptr) {
15155
+ let lines = string$1.slice(0, ptr).split(/\r?\n/);
15239
15156
  return [lines.length, lines.pop().length + 1];
15240
15157
  }
15241
- __name$3(getLineColFromPtr$1, "getLineColFromPtr");
15242
- function makeCodeBlock$1(string$1, line, column) {
15243
- let lines = string$1.split(/\r\n|\n|\r/g);
15158
+ __name$3(getLineColFromPtr, "getLineColFromPtr");
15159
+ function makeCodeBlock(string$1, line, column) {
15160
+ let lines = string$1.split(/\r?\n/);
15244
15161
  let codeblock = "";
15245
15162
  let numberLen = (Math.log10(line + 1) | 0) + 1;
15246
15163
  for (let i = line - 1; i <= line + 1; i++) {
@@ -15257,8 +15174,8 @@ function makeCodeBlock$1(string$1, line, column) {
15257
15174
  }
15258
15175
  return codeblock;
15259
15176
  }
15260
- __name$3(makeCodeBlock$1, "makeCodeBlock");
15261
- var TomlError$1 = class extends Error {
15177
+ __name$3(makeCodeBlock, "makeCodeBlock");
15178
+ var TomlError = class _TomlError extends Error {
15262
15179
  static {
15263
15180
  __name$3(this, "TomlError");
15264
15181
  }
@@ -15266,8 +15183,8 @@ var TomlError$1 = class extends Error {
15266
15183
  column;
15267
15184
  codeblock;
15268
15185
  constructor(message, options) {
15269
- const [line, column] = getLineColFromPtr$1(options.toml, options.ptr);
15270
- const codeblock = makeCodeBlock$1(options.toml, line, column);
15186
+ const [line, column] = getLineColFromPtr(options.toml, options.ptr);
15187
+ const codeblock = makeCodeBlock(options.toml, line, column);
15271
15188
  super(`Invalid TOML document: ${message}
15272
15189
 
15273
15190
  ${codeblock}`, options);
@@ -15275,60 +15192,16 @@ ${codeblock}`, options);
15275
15192
  this.column = column;
15276
15193
  this.codeblock = codeblock;
15277
15194
  }
15278
- };
15279
- function indexOfNewline$1(str, start = 0) {
15280
- let idx = str.indexOf("\n", start);
15281
- if (str.charCodeAt(idx - 1) === 13) idx--;
15282
- return idx;
15283
- }
15284
- __name$3(indexOfNewline$1, "indexOfNewline");
15285
- function skipComment$1(ctx) {
15286
- for (; ctx.p < ctx.s.length; ctx.p++) {
15287
- let c$1 = ctx.s.charCodeAt(ctx.p);
15288
- if (c$1 === 10) break;
15289
- if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
15290
- ctx.p++;
15291
- break;
15292
- }
15293
- if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError$1("control characters are not allowed in comments", {
15195
+ /** @internal */
15196
+ static x(message, ctx, ptr) {
15197
+ throw new _TomlError(message, {
15294
15198
  toml: ctx.s,
15295
- ptr: ctx.p
15199
+ ptr: ptr ?? ctx.p
15296
15200
  });
15297
15201
  }
15298
- }
15299
- __name$3(skipComment$1, "skipComment");
15300
- function skipVoid$1(ctx, banNewLines, banComments) {
15301
- let c$1;
15302
- while (1) {
15303
- 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++;
15304
- if (banComments || c$1 !== 35) break;
15305
- skipComment$1(ctx);
15306
- }
15307
- }
15308
- __name$3(skipVoid$1, "skipVoid");
15309
- function skipUntil$1(ctx, sep, end) {
15310
- let ptr = ctx.p;
15311
- if (!end) {
15312
- ptr = indexOfNewline$1(ctx.s, ptr);
15313
- ctx.p = ptr < 0 ? ctx.s.length : ptr;
15314
- return;
15315
- }
15316
- for (; ctx.p < ctx.s.length; ctx.p++) {
15317
- let c$1 = ctx.s.charCodeAt(ctx.p);
15318
- if (c$1 === 35) skipComment$1(ctx);
15319
- else if (c$1 === end || c$1 === sep) return;
15320
- }
15321
- throw new TomlError$1("cannot find end of structure", {
15322
- toml: ctx.s,
15323
- ptr
15324
- });
15325
- }
15326
- __name$3(skipUntil$1, "skipUntil");
15327
- var INT_REGEX$1 = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
15328
- var FLOAT_REGEX$1 = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
15329
- var LEADING_ZERO$1 = /^[+-]?0[0-9_]/;
15330
- function parseString$1(ctx) {
15331
- let start = ctx.p;
15202
+ };
15203
+ function parseString(ctx) {
15204
+ let startPtr = ctx.p;
15332
15205
  let c$1 = ctx.s.charCodeAt(ctx.p++);
15333
15206
  let first = c$1;
15334
15207
  let isLiteral = c$1 === 39;
@@ -15343,16 +15216,16 @@ function parseString$1(ctx) {
15343
15216
  for (; ctx.p < ctx.s.length; ctx.p++) {
15344
15217
  c$1 = ctx.s.charCodeAt(ctx.p);
15345
15218
  if (isMultiline && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) state = state && 3;
15346
- else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError$1("control characters are not allowed in strings", {
15347
- toml: ctx.s,
15348
- ptr: ctx.p
15349
- });
15219
+ else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) TomlError.x("control characters are not allowed in strings", ctx);
15350
15220
  else if ((!state || state === 3) && c$1 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
15351
15221
  if (isMultiline) {
15352
15222
  if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
15353
15223
  if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
15354
15224
  }
15355
- if (!state) parsed += ctx.s.slice(sliceStart, ctx.p);
15225
+ if (!state) {
15226
+ let s = ctx.s.slice(sliceStart, ctx.p);
15227
+ parsed = parsed ? parsed + s : s;
15228
+ }
15356
15229
  ctx.p += isMultiline ? 3 : 1;
15357
15230
  return parsed;
15358
15231
  } else if (!state) {
@@ -15361,25 +15234,20 @@ function parseString$1(ctx) {
15361
15234
  state = 1;
15362
15235
  }
15363
15236
  } else if (state === 1) if (c$1 === 120 || c$1 === 117 || c$1 === 85) {
15237
+ let errPtr = ctx.p++ - 1;
15364
15238
  let value = 0;
15365
15239
  let len = c$1 === 120 ? 2 : c$1 === 117 ? 4 : 8;
15366
15240
  for (let j$1 = 0; j$1 < len; j$1++, ctx.p++) {
15367
- let hex$1 = ctx.s.charCodeAt(ctx.p + 1);
15241
+ let hex$1 = ctx.s.charCodeAt(ctx.p);
15368
15242
  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;
15369
- if (digit < 0) throw new TomlError$1("invalid non-hex character in unicode escape", {
15370
- toml: ctx.s,
15371
- ptr: ctx.p + 1
15372
- });
15243
+ if (digit < 0) TomlError.x("invalid non-hex character in unicode escape", ctx);
15373
15244
  value = value << 4 | digit;
15374
15245
  }
15375
- if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new TomlError$1("invalid unicode escape", {
15376
- toml: ctx.s,
15377
- ptr: ctx.p
15378
- });
15246
+ if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) TomlError.x("invalid unicode escape", ctx, errPtr);
15379
15247
  parsed += String.fromCodePoint(value);
15380
- sliceStart = ctx.p + 1;
15248
+ sliceStart = ctx.p--;
15381
15249
  state = 0;
15382
- } else if (c$1 === 32 || c$1 === 9) state = 2;
15250
+ } else if (isMultiline && (c$1 === 32 || c$1 === 9)) state = 2;
15383
15251
  else {
15384
15252
  if (c$1 === 98) parsed += "\b";
15385
15253
  else if (c$1 === 116) parsed += " ";
@@ -15389,162 +15257,326 @@ function parseString$1(ctx) {
15389
15257
  else if (c$1 === 101) parsed += "\x1B";
15390
15258
  else if (c$1 === 34) parsed += "\"";
15391
15259
  else if (c$1 === 92) parsed += "\\";
15392
- else throw new TomlError$1("unrecognized escape sequence", {
15393
- toml: ctx.s,
15394
- ptr: ctx.p
15395
- });
15260
+ else TomlError.x("unrecognised escape sequence", ctx);
15396
15261
  sliceStart = ctx.p + 1;
15397
15262
  state = 0;
15398
15263
  }
15399
15264
  else if (c$1 !== 32 && c$1 !== 9) {
15400
- if (state === 2) throw new TomlError$1("invalid escape: only line-ending whitespace may be escaped", {
15401
- toml: ctx.s,
15402
- ptr: sliceStart
15403
- });
15265
+ if (state === 2) TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
15404
15266
  state = !isLiteral && c$1 === 92 ? 1 : 0;
15405
15267
  sliceStart = ctx.p;
15406
15268
  }
15407
15269
  }
15408
- throw new TomlError$1("unfinished string", {
15409
- toml: ctx.s,
15410
- ptr: start
15411
- });
15412
- }
15413
- __name$3(parseString$1, "parseString");
15414
- function sliceAndTrimEndOf$1(ctx, start, end) {
15415
- let value = ctx.s.slice(start, end);
15416
- let commentIdx = value.indexOf("#");
15417
- if (commentIdx > 0) {
15418
- skipComment$1({
15419
- s: value,
15420
- p: commentIdx
15421
- });
15422
- value = value.slice(0, commentIdx);
15423
- }
15424
- return value.trimEnd();
15425
- }
15426
- __name$3(sliceAndTrimEndOf$1, "sliceAndTrimEndOf");
15427
- function parseValue$1(ctx, integersAsBigInt, end) {
15428
- let ptr = ctx.p;
15429
- let err = {
15430
- toml: ctx.s,
15431
- ptr
15432
- };
15433
- skipUntil$1(ctx, 44, end);
15434
- let value = sliceAndTrimEndOf$1(ctx, ptr, ctx.p);
15435
- if (!value) throw new TomlError$1("incomplete declaration: value expected", err);
15436
- if (value === "-inf") return -Infinity;
15437
- if (value === "inf" || value === "+inf") return Infinity;
15438
- if (value === "nan" || value === "+nan" || value === "-nan") return NaN;
15439
- if (value === "-0") return integersAsBigInt ? 0n : 0;
15440
- let isInt = INT_REGEX$1.test(value);
15441
- if (isInt || FLOAT_REGEX$1.test(value)) {
15442
- if (LEADING_ZERO$1.test(value)) throw new TomlError$1("leading zeroes are not allowed", err);
15443
- value = value.replace(/_/g, "");
15444
- let numeric$1 = +value;
15445
- if (isNaN(numeric$1)) throw new TomlError$1("invalid number", err);
15446
- if (isInt) {
15447
- if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError$1("integer value cannot be represented losslessly", err);
15448
- if (isInt || integersAsBigInt === true) numeric$1 = BigInt(value);
15270
+ TomlError.x("unfinished string", ctx, startPtr);
15271
+ }
15272
+ __name$3(parseString, "parseString");
15273
+ var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
15274
+ var TomlDate = class _TomlDate extends Date {
15275
+ static {
15276
+ __name$3(this, "TomlDate");
15277
+ }
15278
+ #hasDate = false;
15279
+ #hasTime = false;
15280
+ #offset = null;
15281
+ constructor(date$1, fasttype, unsafeDelim) {
15282
+ let hasDate = true;
15283
+ let hasTime = true;
15284
+ let offset = "Z";
15285
+ let c$1;
15286
+ if (typeof date$1 === "string") if (fasttype) prep: {
15287
+ if (fasttype < 3) {
15288
+ if (+date$1.slice(11, 13) > 23) {
15289
+ date$1 = "";
15290
+ break prep;
15291
+ }
15292
+ if (fasttype === 2) {
15293
+ offset = null;
15294
+ date$1 += "Z";
15295
+ } else if ((c$1 = date$1.charCodeAt(date$1.length - 1)) !== 90 && c$1 !== 122) offset = date$1.slice(date$1.length - 6);
15296
+ if (unsafeDelim) date$1 = date$1.slice(0, 10) + "T" + date$1.slice(11);
15297
+ } else if (fasttype === 4) date$1 = +date$1.slice(0, 2) > 23 ? "" : `0000-01-01T${date$1}Z`;
15298
+ hasDate = fasttype !== 4;
15299
+ hasTime = fasttype !== 3;
15300
+ }
15301
+ else {
15302
+ let match = date$1.match(DATE_TIME_RE);
15303
+ if (match) {
15304
+ if (!match[1]) {
15305
+ hasDate = false;
15306
+ date$1 = `0000-01-01T${date$1}`;
15307
+ }
15308
+ hasTime = !!match[2];
15309
+ hasTime && date$1[10] === " " && (date$1 = date$1.replace(" ", "T"));
15310
+ if (match[2] && +match[2] > 23) date$1 = "";
15311
+ else {
15312
+ offset = match[3] || null;
15313
+ if (!offset && hasTime) date$1 += "Z";
15314
+ }
15315
+ } else date$1 = "";
15316
+ }
15317
+ super(date$1);
15318
+ if (!isNaN(this.getTime())) {
15319
+ this.#hasDate = hasDate;
15320
+ this.#hasTime = hasTime;
15321
+ this.#offset = offset;
15449
15322
  }
15450
- return numeric$1;
15451
15323
  }
15452
- const date$1 = new TomlDate$1(value);
15453
- if (!date$1.isValid()) throw new TomlError$1("invalid value", err);
15454
- return date$1;
15324
+ isDateTime() {
15325
+ return this.#hasDate && this.#hasTime;
15326
+ }
15327
+ isLocal() {
15328
+ return !this.#hasDate || !this.#hasTime || !this.#offset;
15329
+ }
15330
+ isDate() {
15331
+ return this.#hasDate && !this.#hasTime;
15332
+ }
15333
+ isTime() {
15334
+ return this.#hasTime && !this.#hasDate;
15335
+ }
15336
+ isValid() {
15337
+ return this.#hasDate || this.#hasTime;
15338
+ }
15339
+ toISOString() {
15340
+ let iso = super.toISOString();
15341
+ if (this.isDate()) return iso.slice(0, 10);
15342
+ if (this.isTime()) return iso.slice(11, 23);
15343
+ if (this.#offset === null) return iso.slice(0, -1);
15344
+ if (this.#offset === "Z" || this.#offset === "z") return iso;
15345
+ let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
15346
+ offset = this.#offset[0] === "-" ? offset : -offset;
15347
+ return (/* @__PURE__ */ new Date(this.getTime() - offset * 6e4)).toISOString().slice(0, -1) + this.#offset;
15348
+ }
15349
+ static wrapAsOffsetDateTime(jsDate, offset = "Z") {
15350
+ let date$1 = new _TomlDate(jsDate);
15351
+ date$1.#offset = offset;
15352
+ return date$1;
15353
+ }
15354
+ static wrapAsLocalDateTime(jsDate) {
15355
+ let date$1 = new _TomlDate(jsDate);
15356
+ date$1.#offset = null;
15357
+ return date$1;
15358
+ }
15359
+ static wrapAsLocalDate(jsDate) {
15360
+ let date$1 = new _TomlDate(jsDate);
15361
+ date$1.#hasTime = false;
15362
+ date$1.#offset = null;
15363
+ return date$1;
15364
+ }
15365
+ static wrapAsLocalTime(jsDate) {
15366
+ let date$1 = new _TomlDate(jsDate);
15367
+ date$1.#hasDate = false;
15368
+ date$1.#offset = null;
15369
+ return date$1;
15370
+ }
15371
+ };
15372
+ function isDigit2(char, base = 10) {
15373
+ return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
15455
15374
  }
15456
- __name$3(parseValue$1, "parseValue");
15457
- function extractValue$1(ctx, end, integersAsBigInt) {
15458
- let ptr = ctx.p;
15459
- let c$1 = ctx.s.charCodeAt(ptr);
15375
+ __name$3(isDigit2, "isDigit");
15376
+ function isEndOfValue(char, delim) {
15377
+ return char === 32 || char === 9 || char === 10 || char === 13 || delim && (char === delim || char === 44) || char === 35;
15378
+ }
15379
+ __name$3(isEndOfValue, "isEndOfValue");
15380
+ function extractValue(ctx, end) {
15381
+ let errPtr = ctx.p;
15382
+ let c$1 = ctx.s.charCodeAt(ctx.p);
15460
15383
  if (c$1 === 91 || c$1 === 123) {
15461
- if (!ctx.d--) throw new TomlError$1("document contains excessively nested structures. aborting.", {
15462
- toml: ctx.s,
15463
- ptr
15464
- });
15465
- let value = c$1 === 91 ? parseArray$1(ctx, integersAsBigInt) : parseInlineTable$1(ctx, integersAsBigInt);
15384
+ ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
15385
+ let value = c$1 === 91 ? parseArray(ctx) : parseInlineTable(ctx);
15466
15386
  ctx.d++;
15467
15387
  return value;
15468
15388
  }
15469
- if (c$1 === 34 || c$1 === 39) return parseString$1(ctx);
15389
+ if (c$1 === 34 || c$1 === 39) return parseString(ctx);
15470
15390
  if (c$1 === 116) {
15471
- 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", {
15472
- toml: ctx.s,
15473
- ptr
15474
- });
15475
- ctx.p++;
15476
- return true;
15391
+ if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101) TomlError.x("invalid value", ctx, errPtr);
15392
+ return ctx.p++, true;
15477
15393
  }
15478
15394
  if (c$1 === 102) {
15479
- 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", {
15480
- toml: ctx.s,
15481
- ptr
15482
- });
15483
- ctx.p++;
15484
- return false;
15395
+ 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) TomlError.x("invalid value", ctx, errPtr);
15396
+ return ctx.p++, false;
15485
15397
  }
15486
- return parseValue$1(ctx, integersAsBigInt, end);
15398
+ if (c$1 === 43 || c$1 === 45) return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c$1, end);
15399
+ if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) return parseDate$1(ctx, c$1, end);
15400
+ if (ctx.s.charCodeAt(ctx.p + 2) === 58) return parseTime(ctx, c$1, end);
15401
+ return parseNumber(ctx, ctx.p, c$1, 0, end);
15487
15402
  }
15488
- __name$3(extractValue$1, "extractValue");
15489
- var KEY_PART_RE$1 = /^[a-zA-Z0-9-_]+[ \t]*$/;
15490
- function parseKey$1(ctx, end = "=") {
15403
+ __name$3(extractValue, "extractValue");
15404
+ function parseNumber(ctx, startPtr, startChr, sign, endChr) {
15405
+ let c$1 = startChr;
15406
+ let state = 0;
15407
+ let hasUnderscores = false;
15408
+ if (c$1 === 105) {
15409
+ if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102) TomlError.x("invalid value", ctx, startPtr);
15410
+ return ctx.p++, (sign || 1) / 0;
15411
+ }
15412
+ if (c$1 === 110) {
15413
+ if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110) TomlError.x("invalid value", ctx, startPtr);
15414
+ return ctx.p++, NaN;
15415
+ }
15416
+ if (c$1 === 48) {
15417
+ if (++ctx.p >= ctx.s.length || isEndOfValue(c$1 = ctx.s.charCodeAt(ctx.p), endChr)) return ctx.bi === true ? 0n : 0;
15418
+ if (!sign) {
15419
+ if (c$1 === 120) return parseIntegerBaseN(ctx, startPtr, 16, endChr);
15420
+ else if (c$1 === 98) return parseIntegerBaseN(ctx, startPtr, 2, endChr);
15421
+ else if (c$1 === 111) return parseIntegerBaseN(ctx, startPtr, 8, endChr);
15422
+ }
15423
+ if (c$1 === 46) state = 2;
15424
+ else if (c$1 === 101 || c$1 === 69) state = 4;
15425
+ else TomlError.x("illegal leading zero", ctx, startPtr);
15426
+ } else if (!isDigit2(c$1)) TomlError.x("invalid value", ctx, startPtr);
15427
+ while (++ctx.p < ctx.s.length && (c$1 = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c$1, endChr))) {
15428
+ if (!state) state = 1;
15429
+ if (c$1 === 95) {
15430
+ if (!(state & 1)) TomlError.x("illegal underscore", ctx);
15431
+ state += 11;
15432
+ hasUnderscores = true;
15433
+ } else if (state === 1 && c$1 === 46) state = 2;
15434
+ else if ((state === 1 || state === 3) && (c$1 === 101 || c$1 === 69)) state = 4;
15435
+ else if (state === 4 && (c$1 === 43 || c$1 === 45));
15436
+ else if (!isDigit2(c$1)) TomlError.x(`illegal character in numeric literal`, ctx);
15437
+ else if (state > 9) state -= 11;
15438
+ else if (!(state & 1)) state++;
15439
+ }
15440
+ if (!state) {
15441
+ let val = (startChr - 48) * (sign || 1);
15442
+ return ctx.bi === true ? BigInt(val) : val;
15443
+ }
15444
+ if (!(state & 1)) TomlError.x("unfinished numeric value", ctx, startPtr);
15445
+ let str = ctx.s.slice(startPtr, ctx.p);
15446
+ if (hasUnderscores) str = str.replaceAll("_", "");
15447
+ return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
15448
+ }
15449
+ __name$3(parseNumber, "parseNumber");
15450
+ function parseIntegerBaseN(ctx, startPtr, base, endChr) {
15451
+ let c$1, underscore = 1;
15452
+ while (++ctx.p < ctx.s.length && (c$1 = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c$1, endChr))) if (c$1 === 95) {
15453
+ if (underscore & 1) TomlError.x("illegal underscore", ctx);
15454
+ underscore = 3;
15455
+ } else if (!isDigit2(c$1, base)) TomlError.x(`illegal character in numeric literal`, ctx);
15456
+ else if (underscore & 1) underscore--;
15457
+ if (underscore & 1) TomlError.x("unfinished numeric value", ctx);
15458
+ let str = ctx.s.slice(startPtr + 2, ctx.p);
15459
+ if (underscore) str = str.replaceAll("_", "");
15460
+ return parseInteger(ctx, str, base, startPtr);
15461
+ }
15462
+ __name$3(parseIntegerBaseN, "parseIntegerBaseN");
15463
+ function parseInteger(ctx, str, base, startPtr) {
15464
+ if (ctx.bi !== true) int: {
15465
+ let val = parseInt(str, base);
15466
+ if (!Number.isSafeInteger(val)) {
15467
+ if (ctx.bi) break int;
15468
+ TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
15469
+ }
15470
+ return val;
15471
+ }
15472
+ return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
15473
+ }
15474
+ __name$3(parseInteger, "parseInteger");
15475
+ function parseDate$1(ctx, c$1, endChr) {
15476
+ let startPtr = ctx.p++, unsafeSeparator;
15477
+ if (!isDigit2(c$1) || !isDigit2(ctx.s.charCodeAt(ctx.p++)) || !isDigit2(ctx.s.charCodeAt(ctx.p++)) || !isDigit2(ctx.s.charCodeAt(ctx.p++))) return parseNumber(ctx, ctx.p = startPtr, c$1, 0, endChr);
15478
+ ctx.p += 5;
15479
+ if (!isDigit2(ctx.s.charCodeAt(ctx.p++))) TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
15480
+ if (ctx.p >= ctx.s.length || ((c$1 = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit2(ctx.s.charCodeAt(ctx.p + 1)))) && c$1 !== 84 && c$1 !== 116) return readDate(ctx, ctx.s.slice(startPtr, ctx.p), 3, false, startPtr);
15481
+ if (ctx.s.charCodeAt(ctx.p += 3) !== 58) TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
15482
+ if (ctx.s.charCodeAt(ctx.p += 3) === 58) ctx.p += 3;
15483
+ if (ctx.s.charCodeAt(ctx.p) === 46) while (isDigit2(ctx.s.charCodeAt(++ctx.p)));
15484
+ if (c$1 = ctx.s.charCodeAt(ctx.p)) {
15485
+ if (c$1 === 90 || c$1 === 122) return readDate(ctx, ctx.s.slice(startPtr, ++ctx.p), 1, unsafeSeparator, startPtr, "[+00:00]");
15486
+ if (c$1 === 43 || c$1 === 45) return readDate(ctx, ctx.s.slice(startPtr, ctx.p += 6), 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
15487
+ }
15488
+ return readDate(ctx, ctx.s.slice(startPtr, ctx.p), 2, unsafeSeparator, startPtr);
15489
+ }
15490
+ __name$3(parseDate$1, "parseDate");
15491
+ function parseTime(ctx, c$1, endChr) {
15491
15492
  let start = ctx.p;
15492
- let dot = start - 1;
15493
+ if (!isDigit2(c$1) || !isDigit2(ctx.s.charCodeAt(++ctx.p))) return parseNumber(ctx, --ctx.p, c$1, 0, endChr);
15494
+ if (ctx.s.charCodeAt(ctx.p += 4) === 58) ctx.p += 3;
15495
+ if (ctx.s.charCodeAt(ctx.p) === 46) while (isDigit2(ctx.s.charCodeAt(++ctx.p)));
15496
+ return readDate(ctx, ctx.s.slice(start, ctx.p), 4, false, start);
15497
+ }
15498
+ __name$3(parseTime, "parseTime");
15499
+ function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
15500
+ if (ctx.ld) {
15501
+ let date$1 = new TomlDate(str, type, unsafeDelim);
15502
+ if (!date$1.isValid()) TomlError.x("invalid date", ctx, errPtr);
15503
+ return date$1;
15504
+ }
15505
+ try {
15506
+ if (temporalSuffix) str += temporalSuffix;
15507
+ switch (type) {
15508
+ case 1: return Temporal.ZonedDateTime.from(str);
15509
+ case 2: return Temporal.PlainDateTime.from(str);
15510
+ case 3: return Temporal.PlainDate.from(str);
15511
+ case 4: return Temporal.PlainTime.from(str);
15512
+ }
15513
+ } catch (e) {
15514
+ TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
15515
+ }
15516
+ }
15517
+ __name$3(readDate, "readDate");
15518
+ function skipComment(ctx) {
15519
+ for (; ctx.p < ctx.s.length; ctx.p++) {
15520
+ let c$1 = ctx.s.charCodeAt(ctx.p);
15521
+ if (c$1 === 10) break;
15522
+ if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
15523
+ ctx.p++;
15524
+ break;
15525
+ }
15526
+ if (c$1 < 32 && c$1 !== 9 || c$1 === 127) TomlError.x("control characters are not allowed in comments", ctx);
15527
+ }
15528
+ }
15529
+ __name$3(skipComment, "skipComment");
15530
+ function skipVoid(ctx, banNewLines, banComments) {
15531
+ let c$1;
15532
+ while (ctx.p < ctx.s.length) {
15533
+ while (ctx.p < ctx.s.length && ((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++;
15534
+ if (banComments || c$1 !== 35) break;
15535
+ skipComment(ctx);
15536
+ }
15537
+ }
15538
+ __name$3(skipVoid, "skipVoid");
15539
+ function parseKey(ctx, end = 61) {
15540
+ let startPtr;
15541
+ let state = 0;
15493
15542
  let parsed = [];
15494
- let endPtr = ctx.s.indexOf(end, start);
15495
- if (endPtr < 0) throw new TomlError$1("incomplete key-value: cannot find end of key", {
15496
- toml: ctx.s,
15497
- ptr: start
15498
- });
15499
- do {
15500
- let c$1 = ctx.s.charCodeAt(ctx.p = ++dot);
15501
- if (c$1 !== 32 && c$1 !== 9) if (c$1 === 34 || c$1 === 39) {
15502
- 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", {
15503
- toml: ctx.s,
15504
- ptr: ctx.p
15505
- });
15506
- let part = parseString$1(ctx);
15507
- dot = ctx.s.indexOf(".", ctx.p);
15508
- let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
15509
- let newLine = indexOfNewline$1(strEnd);
15510
- if (newLine > -1) throw new TomlError$1("newlines are not allowed in keys", {
15511
- toml: ctx.s,
15512
- ptr: newLine
15513
- });
15514
- if (strEnd.trimStart()) throw new TomlError$1("found extra tokens after the string part", {
15515
- toml: ctx.s,
15516
- ptr: ctx.p
15517
- });
15518
- if (endPtr < ctx.p) {
15519
- endPtr = ctx.s.indexOf(end, ctx.p);
15520
- if (endPtr < 0) throw new TomlError$1("incomplete key-value: cannot find end of key", {
15521
- toml: ctx.s,
15522
- ptr: start
15523
- });
15524
- }
15525
- parsed.push(part);
15526
- } else {
15527
- dot = ctx.s.indexOf(".", ctx.p);
15528
- let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
15529
- if (!KEY_PART_RE$1.test(part)) throw new TomlError$1("only letter, numbers, dashes and underscores are allowed in keys", {
15530
- toml: ctx.s,
15531
- ptr: ctx.p
15532
- });
15533
- parsed.push(part.trimEnd());
15543
+ let sliceStart;
15544
+ let c$1 = ctx.s.charCodeAt(startPtr = ctx.p);
15545
+ do
15546
+ if (c$1 === end) {
15547
+ if (!state) TomlError.x("unexpected end of key", ctx);
15548
+ if (state === 1) parsed.push(ctx.s.slice(sliceStart, ctx.p));
15549
+ return ctx.p++, parsed;
15550
+ } else if (c$1 === 46) {
15551
+ if (!state) TomlError.x("illegal empty bare key", ctx);
15552
+ if (state === 1) parsed.push(ctx.s.slice(sliceStart, ctx.p));
15553
+ state = 0;
15554
+ } else if (!state && (c$1 === 34 || c$1 === 39)) {
15555
+ if (c$1 === ctx.s.charCodeAt(ctx.p + 1) && c$1 === ctx.s.charCodeAt(ctx.p + 2)) TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
15556
+ parsed.push(parseString(ctx));
15557
+ state = 2;
15558
+ ctx.p--;
15559
+ } else if (c$1 === 32 || c$1 === 9) {
15560
+ if (state === 1) {
15561
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
15562
+ state = 2;
15563
+ }
15564
+ } else if (state === 2 || c$1 < 48 && c$1 !== 45 || c$1 > 57 && c$1 < 65 || c$1 > 90 && c$1 < 97 && c$1 !== 95 || c$1 > 122) TomlError.x("illegal character in key", ctx);
15565
+ else if (!state) {
15566
+ state = 1;
15567
+ sliceStart = ctx.p;
15534
15568
  }
15535
- } while (dot + 1 && dot < endPtr);
15536
- ctx.p = endPtr + 1;
15537
- skipVoid$1(ctx, true, true);
15538
- return parsed;
15569
+ while (c$1 = ctx.s.charCodeAt(++ctx.p));
15570
+ TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
15539
15571
  }
15540
- __name$3(parseKey$1, "parseKey");
15541
- function parseInlineTable$1(ctx, integersAsBigInt) {
15542
- let res = {};
15572
+ __name$3(parseKey, "parseKey");
15573
+ function parseInlineTable(ctx) {
15574
+ let startPtr = ctx.p++;
15575
+ let res = /* @__PURE__ */ Object.create(null);
15543
15576
  let seen = /* @__PURE__ */ new Set();
15544
15577
  let c$1;
15545
- ctx.p++;
15546
15578
  while (ctx.p < ctx.s.length) {
15547
- skipVoid$1(ctx);
15579
+ skipVoid(ctx);
15548
15580
  if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 125) {
15549
15581
  ctx.p++;
15550
15582
  return res;
@@ -15552,65 +15584,53 @@ function parseInlineTable$1(ctx, integersAsBigInt) {
15552
15584
  let k;
15553
15585
  let t$4 = res;
15554
15586
  let hasOwn = false;
15555
- let p$1 = ctx.p;
15556
- let key = parseKey$1(ctx);
15587
+ let errPtr = ctx.p;
15588
+ let key = parseKey(ctx);
15557
15589
  for (let i = 0; i < key.length; i++) {
15558
- if (i) t$4 = hasOwn ? t$4[k] : t$4[k] = {};
15590
+ if (i) t$4 = hasOwn ? t$4[k] : t$4[k] = /* @__PURE__ */ Object.create(null);
15559
15591
  k = key[i];
15560
- if ((hasOwn = Object.hasOwn(t$4, k)) && (typeof t$4[k] !== "object" || seen.has(t$4[k]))) throw new TomlError$1("trying to redefine an already defined value", {
15561
- toml: ctx.s,
15562
- ptr: p$1
15563
- });
15564
- if (!hasOwn && k === "__proto__") Object.defineProperty(t$4, k, {
15592
+ if ((hasOwn = Object.hasOwn(t$4, k)) && (typeof t$4[k] !== "object" || seen.has(t$4[k]))) TomlError.x("trying to redefine an already defined value", ctx, errPtr);
15593
+ let unsafe = k === "__proto__";
15594
+ if (ctx.uk && (unsafe || k === "constructor")) {
15595
+ t$4 = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
15596
+ break;
15597
+ }
15598
+ if (!hasOwn && unsafe) Object.defineProperty(t$4, k, {
15565
15599
  enumerable: true,
15566
15600
  configurable: true,
15567
15601
  writable: true
15568
15602
  });
15569
15603
  }
15570
- if (hasOwn) throw new TomlError$1("trying to redefine an already defined value", {
15571
- toml: ctx.s,
15572
- ptr: ctx.p
15573
- });
15574
- let value = extractValue$1(ctx, 125, integersAsBigInt);
15575
- seen.add(t$4[k] = value);
15576
- skipVoid$1(ctx);
15604
+ if (hasOwn) TomlError.x("trying to redefine an already defined value", ctx, errPtr);
15605
+ skipVoid(ctx, true, true);
15606
+ let value = extractValue(ctx, 125);
15607
+ if (t$4 && typeof (t$4[k] = value) === "object") seen.add(value);
15608
+ skipVoid(ctx);
15577
15609
  if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 125) return res;
15578
- if (c$1 !== 44) throw new TomlError$1("expected comma or end of structure", {
15579
- toml: ctx.s,
15580
- ptr: ctx.p - 1
15581
- });
15610
+ if (c$1 !== 44) TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
15582
15611
  }
15583
- throw new TomlError$1("unfinished table encountered", {
15584
- toml: ctx.s,
15585
- ptr: ctx.p
15586
- });
15612
+ TomlError.x("unfinished table", ctx, startPtr);
15587
15613
  }
15588
- __name$3(parseInlineTable$1, "parseInlineTable");
15589
- function parseArray$1(ctx, integersAsBigInt) {
15614
+ __name$3(parseInlineTable, "parseInlineTable");
15615
+ function parseArray(ctx) {
15616
+ let startPtr = ctx.p++;
15590
15617
  let res = [];
15591
15618
  let c$1;
15592
- ctx.p++;
15593
15619
  while (ctx.p < ctx.s.length) {
15594
- skipVoid$1(ctx);
15620
+ skipVoid(ctx);
15595
15621
  if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 93) {
15596
15622
  ctx.p++;
15597
15623
  return res;
15598
15624
  }
15599
- res.push(extractValue$1(ctx, 93, integersAsBigInt));
15600
- skipVoid$1(ctx);
15625
+ res.push(extractValue(ctx, 93));
15626
+ skipVoid(ctx);
15601
15627
  if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 93) return res;
15602
- if (c$1 !== 44) throw new TomlError$1("expected comma or end of structure", {
15603
- toml: ctx.s,
15604
- ptr: ctx.p - 1
15605
- });
15628
+ if (c$1 !== 44) TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
15606
15629
  }
15607
- throw new TomlError$1("unfinished array encountered", {
15608
- toml: ctx.s,
15609
- ptr: ctx.p
15610
- });
15630
+ TomlError.x("unfinished array", ctx, startPtr);
15611
15631
  }
15612
- __name$3(parseArray$1, "parseArray");
15613
- function peekTable$1(key, table, meta$1, type) {
15632
+ __name$3(parseArray, "parseArray");
15633
+ function peekTable(ctx, key, table, meta$1, type) {
15614
15634
  let t$4 = table;
15615
15635
  let m = meta$1;
15616
15636
  let k;
@@ -15618,7 +15638,7 @@ function peekTable$1(key, table, meta$1, type) {
15618
15638
  let state;
15619
15639
  for (let i = 0; i < key.length; i++) {
15620
15640
  if (i) {
15621
- t$4 = hasOwn ? t$4[k] : t$4[k] = {};
15641
+ t$4 = hasOwn ? t$4[k] : t$4[k] = /* @__PURE__ */ Object.create(null);
15622
15642
  m = (state = m[k]).c;
15623
15643
  if (type === 0 && (state.t === 1 || state.t === 2)) return null;
15624
15644
  if (state.t === 2) {
@@ -15630,7 +15650,9 @@ function peekTable$1(key, table, meta$1, type) {
15630
15650
  k = key[i];
15631
15651
  if ((hasOwn = Object.hasOwn(t$4, k)) && m[k]?.t === 0 && m[k]?.d) return null;
15632
15652
  if (!hasOwn) {
15633
- if (k === "__proto__") {
15653
+ let unsafe = k === "__proto__";
15654
+ if (ctx.uk && (unsafe || k === "constructor")) return false;
15655
+ if (unsafe) {
15634
15656
  Object.defineProperty(t$4, k, {
15635
15657
  enumerable: true,
15636
15658
  configurable: true,
@@ -15646,7 +15668,7 @@ function peekTable$1(key, table, meta$1, type) {
15646
15668
  t: i < key.length - 1 && type === 2 ? 3 : type,
15647
15669
  d: false,
15648
15670
  i: 0,
15649
- c: {}
15671
+ c: /* @__PURE__ */ Object.create(null)
15650
15672
  };
15651
15673
  }
15652
15674
  }
@@ -15657,17 +15679,17 @@ function peekTable$1(key, table, meta$1, type) {
15657
15679
  state.d = true;
15658
15680
  t$4[k] = [];
15659
15681
  }
15660
- t$4[k].push(t$4 = {});
15682
+ t$4[k].push(t$4 = /* @__PURE__ */ Object.create(null));
15661
15683
  state.c[state.i++] = state = {
15662
15684
  t: 1,
15663
15685
  d: false,
15664
15686
  i: 0,
15665
- c: {}
15687
+ c: /* @__PURE__ */ Object.create(null)
15666
15688
  };
15667
15689
  }
15668
15690
  if (state.d) return null;
15669
15691
  state.d = true;
15670
- if (type === 1) t$4 = hasOwn ? t$4[k] : t$4[k] = {};
15692
+ if (type === 1) t$4 = hasOwn ? t$4[k] : t$4[k] = /* @__PURE__ */ Object.create(null);
15671
15693
  else if (type === 0 && hasOwn) return null;
15672
15694
  return [
15673
15695
  k,
@@ -15675,64 +15697,76 @@ function peekTable$1(key, table, meta$1, type) {
15675
15697
  state.c
15676
15698
  ];
15677
15699
  }
15678
- __name$3(peekTable$1, "peekTable");
15679
- function parse3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
15700
+ __name$3(peekTable, "peekTable");
15701
+ function validateTablePeek(ctx, peek, ptr) {
15702
+ if (peek === null || ctx.uk === 2) TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
15703
+ }
15704
+ __name$3(validateTablePeek, "validateTablePeek");
15705
+ function parse3(toml, options = {}) {
15680
15706
  let ctx = {
15681
15707
  s: toml,
15682
15708
  p: 0,
15683
- d: maxDepth
15709
+ d: options.maxDepth ?? 1e3,
15710
+ bi: options.integersAsBigInt ?? false,
15711
+ ld: options.useLegacyDate ?? true,
15712
+ uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
15684
15713
  };
15685
- let res = {};
15686
- let meta$1 = {};
15714
+ let res = /* @__PURE__ */ Object.create(null);
15715
+ let meta$1 = /* @__PURE__ */ Object.create(null);
15687
15716
  let tmp;
15717
+ let skipping = false;
15688
15718
  let tbl = res;
15689
15719
  let m = meta$1;
15690
- skipVoid$1(ctx);
15720
+ if (toml.charCodeAt(0) === 65279) ctx.p++;
15721
+ skipVoid(ctx);
15691
15722
  while (ctx.p < toml.length) {
15692
15723
  if (toml.charCodeAt(ctx.p) === 91) {
15693
15724
  let isTableArray = toml.charCodeAt(++ctx.p) === 91;
15694
15725
  tmp = ctx.p += +isTableArray;
15695
- let k = parseKey$1(ctx, "]");
15726
+ skipping = false;
15727
+ let k = parseKey(ctx, 93);
15696
15728
  if (isTableArray) {
15697
- if (toml.charCodeAt(ctx.p - 1) !== 93) throw new TomlError$1("expected end of table declaration", {
15698
- toml,
15699
- ptr: ctx.p - 1
15700
- });
15729
+ if (toml.charCodeAt(ctx.p) !== 93) TomlError.x("expected end of table array declaration", ctx);
15701
15730
  ctx.p++;
15702
15731
  }
15703
- let p$1 = peekTable$1(k, res, meta$1, isTableArray ? 2 : 1);
15704
- if (!p$1) throw new TomlError$1("trying to redefine an already defined table or value", {
15705
- toml,
15706
- ptr: tmp
15707
- });
15708
- m = p$1[2];
15709
- tbl = p$1[1];
15732
+ let p$1 = peekTable(ctx, k, res, meta$1, isTableArray ? 2 : 1);
15733
+ if (!p$1) {
15734
+ validateTablePeek(ctx, p$1, tmp);
15735
+ skipping = true;
15736
+ } else {
15737
+ m = p$1[2];
15738
+ tbl = p$1[1];
15739
+ }
15710
15740
  } else {
15711
15741
  tmp = ctx.p;
15712
- let p$1 = peekTable$1(parseKey$1(ctx), tbl, m, 0);
15713
- if (!p$1) throw new TomlError$1("trying to redefine an already defined table or value", {
15714
- toml,
15715
- ptr: tmp
15716
- });
15717
- p$1[1][p$1[0]] = extractValue$1(ctx, void 0, integersAsBigInt);
15742
+ let p$1 = peekTable(ctx, parseKey(ctx), tbl, m, 0);
15743
+ if (!p$1 && !skipping) validateTablePeek(ctx, p$1, tmp);
15744
+ skipVoid(ctx, true, true);
15745
+ let v = extractValue(ctx, void 0);
15746
+ if (p$1 && !skipping) p$1[1][p$1[0]] = v;
15718
15747
  }
15719
- skipVoid$1(ctx, true);
15720
- 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", {
15721
- toml,
15722
- ptr: ctx.p
15723
- });
15724
- skipVoid$1(ctx);
15748
+ skipVoid(ctx, true);
15749
+ if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
15750
+ skipVoid(ctx);
15725
15751
  }
15726
15752
  return res;
15727
15753
  }
15728
15754
  __name$3(parse3, "parse");
15729
15755
  var BARE_KEY$1 = /^[a-z0-9-_]+$/i;
15756
+ var HAS_WELLFORMED$1 = !!"".isWellFormed;
15730
15757
  function extendedTypeOf$1(obj) {
15731
15758
  let type = typeof obj;
15732
15759
  if (type === "object") {
15733
15760
  if (Array.isArray(obj)) return "array";
15734
- if (typeof obj?.getUTCDate === "function" && obj instanceof Date) return "date";
15735
- 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";
15761
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date) return "date";
15762
+ if (globalThis.Temporal) {
15763
+ if (obj.until) {
15764
+ if (obj instanceof Temporal.ZonedDateTime) return "temporal/tz+uc";
15765
+ if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate) return "temporal/uc";
15766
+ if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant) return "temporal";
15767
+ if (obj instanceof Temporal.PlainYearMonth) return "temporal/x";
15768
+ } else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) return "temporal/x";
15769
+ }
15736
15770
  }
15737
15771
  return type;
15738
15772
  }
@@ -15742,18 +15776,21 @@ function isArrayOfTables$1(obj) {
15742
15776
  return obj.length != 0;
15743
15777
  }
15744
15778
  __name$3(isArrayOfTables$1, "isArrayOfTables");
15779
+ function formatWellFormedStringUnchecked$1(s) {
15780
+ return JSON.stringify(s).replaceAll("", "\\u007f");
15781
+ }
15782
+ __name$3(formatWellFormedStringUnchecked$1, "formatWellFormedStringUnchecked");
15745
15783
  function formatString$1(s) {
15746
- return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
15784
+ return formatWellFormedStringUnchecked$1(HAS_WELLFORMED$1 ? s.toWellFormed() : s);
15747
15785
  }
15748
15786
  __name$3(formatString$1, "formatString");
15749
- function stringifyTemporal$1(temporal) {
15750
- return temporal.toString({
15751
- calendarName: "never",
15752
- timeZoneName: "never"
15753
- });
15787
+ function formatKey$1(s) {
15788
+ if (BARE_KEY$1.test(s)) return s;
15789
+ if (HAS_WELLFORMED$1 && !s.isWellFormed()) throw new RangeError("key contains illegal lone surrogates");
15790
+ return formatWellFormedStringUnchecked$1(s);
15754
15791
  }
15755
- __name$3(stringifyTemporal$1, "stringifyTemporal");
15756
- function stringifyValue$1(val, type, depth, numberAsFloat) {
15792
+ __name$3(formatKey$1, "formatKey");
15793
+ function stringifyValue$1(val, type, depth, numberAsFloat, strictTemporal) {
15757
15794
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
15758
15795
  switch (type) {
15759
15796
  case "number":
@@ -15762,54 +15799,64 @@ function stringifyValue$1(val, type, depth, numberAsFloat) {
15762
15799
  if (val === -Infinity) return "-inf";
15763
15800
  if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val))) return val.toFixed(1);
15764
15801
  case "bigint":
15765
- case "boolean": return val.toString();
15802
+ case "boolean":
15803
+ case "temporal": return val.toString();
15766
15804
  case "string": return formatString$1(val);
15767
15805
  case "date":
15768
15806
  if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
15769
15807
  return val.toISOString();
15770
- case "object": return stringifyInlineTable$1(val, depth, numberAsFloat);
15771
- case "array": return stringifyArray$1(val, depth, numberAsFloat);
15772
- case "temporal": return stringifyTemporal$1(val);
15808
+ case "object": return stringifyInlineTable$1(val, depth, numberAsFloat, strictTemporal);
15809
+ case "array": return stringifyArray$1(val, depth, numberAsFloat, strictTemporal);
15810
+ case "temporal/tz+uc": if (strictTemporal) {
15811
+ let tz = val.timeZoneId;
15812
+ let tzc = tz.charCodeAt(0);
15813
+ if (tzc !== 43 && tzc !== 45 && (tzc !== 85 && tzc !== 71 && tzc !== 90 && tzc !== 69 || tz !== "UTC" && tz !== "UCT" && tz !== "Universal" && tz !== "Zulu" && !tz.startsWith("GMT") && tz !== "Greenwich" && !tz.startsWith("Etc/"))) throw new TypeError("Temporal objects with an IANA timezone are not allowed in Temporal strict mode");
15814
+ }
15815
+ case "temporal/uc":
15816
+ if (strictTemporal && val.calendarId !== "iso8601") throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
15817
+ return val.toString({
15818
+ calendarName: "never",
15819
+ timeZoneName: "never"
15820
+ });
15821
+ case "temporal/x": throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
15773
15822
  }
15774
15823
  }
15775
15824
  __name$3(stringifyValue$1, "stringifyValue");
15776
- function stringifyInlineTable$1(obj, depth, numberAsFloat) {
15825
+ function stringifyInlineTable$1(obj, depth, numberAsFloat, strictTemporal) {
15777
15826
  let keys = Object.keys(obj);
15778
15827
  if (keys.length === 0) return "{}";
15779
15828
  let res = "{ ";
15780
15829
  for (let i = 0; i < keys.length; i++) {
15781
15830
  let k = keys[i];
15782
15831
  if (i) res += ", ";
15783
- res += BARE_KEY$1.test(k) ? k : formatString$1(k);
15784
- res += " = ";
15785
- res += stringifyValue$1(obj[k], extendedTypeOf$1(obj[k]), depth - 1, numberAsFloat);
15832
+ res += formatKey$1(k) + " = " + stringifyValue$1(obj[k], extendedTypeOf$1(obj[k]), depth - 1, numberAsFloat, strictTemporal);
15786
15833
  }
15787
15834
  return res + " }";
15788
15835
  }
15789
15836
  __name$3(stringifyInlineTable$1, "stringifyInlineTable");
15790
- function stringifyArray$1(array$1, depth, numberAsFloat) {
15837
+ function stringifyArray$1(array$1, depth, numberAsFloat, strictTemporal) {
15791
15838
  if (array$1.length === 0) return "[]";
15792
15839
  let res = "[ ";
15793
15840
  for (let i = 0; i < array$1.length; i++) {
15794
15841
  if (i) res += ", ";
15795
15842
  if (array$1[i] === null || array$1[i] === void 0) throw new TypeError("arrays cannot contain null or undefined values");
15796
- res += stringifyValue$1(array$1[i], extendedTypeOf$1(array$1[i]), depth - 1, numberAsFloat);
15843
+ res += stringifyValue$1(array$1[i], extendedTypeOf$1(array$1[i]), depth - 1, numberAsFloat, strictTemporal);
15797
15844
  }
15798
15845
  return res + " ]";
15799
15846
  }
15800
15847
  __name$3(stringifyArray$1, "stringifyArray");
15801
- function stringifyArrayTable$1(array$1, key, depth, numberAsFloat) {
15848
+ function stringifyArrayTable$1(array$1, key, depth, numberAsFloat, strictTemporal) {
15802
15849
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
15803
15850
  let res = "";
15804
15851
  for (let i = 0; i < array$1.length; i++) {
15805
15852
  res += `${res && "\n"}[[${key}]]
15806
15853
  `;
15807
- res += stringifyTable$1(0, array$1[i], key, depth, numberAsFloat);
15854
+ res += stringifyTable$1(0, array$1[i], key, depth, numberAsFloat, strictTemporal);
15808
15855
  }
15809
15856
  return res;
15810
15857
  }
15811
15858
  __name$3(stringifyArrayTable$1, "stringifyArrayTable");
15812
- function stringifyTable$1(tableKey, obj, prefix, depth, numberAsFloat) {
15859
+ function stringifyTable$1(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
15813
15860
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
15814
15861
  let preamble = "";
15815
15862
  let tables = "";
@@ -15819,15 +15866,15 @@ function stringifyTable$1(tableKey, obj, prefix, depth, numberAsFloat) {
15819
15866
  if (obj[k] !== null && obj[k] !== void 0) {
15820
15867
  let type = extendedTypeOf$1(obj[k]);
15821
15868
  if (type === "symbol" || type === "function") throw new TypeError(`cannot serialize values of type '${type}'`);
15822
- let key = BARE_KEY$1.test(k) ? k : formatString$1(k);
15823
- if (type === "array" && isArrayOfTables$1(obj[k])) tables += (tables && "\n") + stringifyArrayTable$1(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
15869
+ let key = formatKey$1(k);
15870
+ if (type === "array" && isArrayOfTables$1(obj[k])) tables += (tables && "\n") + stringifyArrayTable$1(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
15824
15871
  else if (type === "object") {
15825
15872
  let tblKey = prefix ? `${prefix}.${key}` : key;
15826
- tables += (tables && "\n") + stringifyTable$1(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
15873
+ tables += (tables && "\n") + stringifyTable$1(tblKey, obj[k], tblKey, depth - 1, numberAsFloat, strictTemporal);
15827
15874
  } else {
15828
15875
  preamble += key;
15829
15876
  preamble += " = ";
15830
- preamble += stringifyValue$1(obj[k], type, depth, numberAsFloat);
15877
+ preamble += stringifyValue$1(obj[k], type, depth, numberAsFloat, strictTemporal);
15831
15878
  preamble += "\n";
15832
15879
  }
15833
15880
  }
@@ -15838,19 +15885,13 @@ ${preamble}` : `[${tableKey}]`;
15838
15885
  ${tables}` : preamble || tables;
15839
15886
  }
15840
15887
  __name$3(stringifyTable$1, "stringifyTable");
15841
- function stringify$5(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
15888
+ function stringify$2(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
15842
15889
  if (extendedTypeOf$1(obj) !== "object") throw new TypeError("stringify can only be called with an object");
15843
- let str = stringifyTable$1(0, obj, "", maxDepth, numbersAsFloat);
15890
+ let str = stringifyTable$1(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
15844
15891
  if (str[str.length - 1] !== "\n") return str + "\n";
15845
15892
  return str;
15846
15893
  }
15847
- __name$3(stringify$5, "stringify");
15848
- var dist_default$3 = {
15849
- parse: parse3,
15850
- stringify: stringify$5,
15851
- TomlDate: TomlDate$1,
15852
- TomlError: TomlError$1
15853
- };
15894
+ __name$3(stringify$2, "stringify");
15854
15895
  var ParseError = class extends UserError$1 {
15855
15896
  static {
15856
15897
  __name$3(this, "ParseError");
@@ -15917,9 +15958,9 @@ var APIError = class extends ParseError {
15917
15958
  };
15918
15959
  function parseTOML(tomlContent, filePath) {
15919
15960
  try {
15920
- return dist_default$3.parse(tomlContent);
15961
+ return parse3(tomlContent);
15921
15962
  } catch (err) {
15922
- if (!(err instanceof TomlError$1)) throw err;
15963
+ if (!(err instanceof TomlError)) throw err;
15923
15964
  const location = {
15924
15965
  lineText: tomlContent.split("\n")[err.line - 1],
15925
15966
  line: err.line,
@@ -16299,14 +16340,14 @@ function configFileName(configPath) {
16299
16340
  }
16300
16341
  __name$3(configFileName, "configFileName");
16301
16342
  function formatConfigSnippet(snippet, configPath, formatted = true) {
16302
- if (configFormat(configPath) === "toml") return dist_default$3.stringify(snippet);
16343
+ if (configFormat(configPath) === "toml") return stringify$2(snippet);
16303
16344
  else return formatted ? JSON.stringify(snippet, null, 2) : JSON.stringify(snippet);
16304
16345
  }
16305
16346
  __name$3(formatConfigSnippet, "formatConfigSnippet");
16306
16347
 
16307
16348
  //#endregion
16308
- //#region ../workers-utils/dist/chunk-4PNP2TCS.mjs
16309
- var DEFAULT_COMPAT_DATE = "2026-09-21";
16349
+ //#region ../workers-utils/dist/chunk-DKSA7K25.mjs
16350
+ var DEFAULT_COMPAT_DATE = "2026-09-23";
16310
16351
  function assertNever(_value) {}
16311
16352
  __name$3(assertNever, "assertNever");
16312
16353
  function mapWorkerMetadataBindings(bindings) {
@@ -18394,7 +18435,7 @@ var require_util$5 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
18394
18435
  const { IncomingMessage } = __require$1("node:http");
18395
18436
  const stream$1 = __require$1("node:stream");
18396
18437
  const net$5 = __require$1("node:net");
18397
- const { stringify: stringify$4 } = __require$1("node:querystring");
18438
+ const { stringify: stringify$5 } = __require$1("node:querystring");
18398
18439
  const { EventEmitter: EE$3 } = __require$1("node:events");
18399
18440
  const timers$1 = require_timers();
18400
18441
  const { InvalidArgumentError: InvalidArgumentError$37, ConnectTimeoutError } = require_errors();
@@ -18469,7 +18510,7 @@ var require_util$5 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
18469
18510
  */
18470
18511
  function serializePathWithQuery$4(url$2, queryParams) {
18471
18512
  if (pathHasQueryOrFragment$1(url$2)) throw new Error("Query params cannot be passed when url already contains \"?\" or \"#\".");
18472
- const stringified = stringify$4(queryParams);
18513
+ const stringified = stringify$5(queryParams);
18473
18514
  if (stringified) url$2 += "?" + stringified;
18474
18515
  return url$2;
18475
18516
  }
@@ -21295,7 +21336,7 @@ var require_data_url = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/
21295
21336
  * @param {{ position: number }} position
21296
21337
  * @param {boolean} [extractValue=false]
21297
21338
  */
21298
- function collectAnHTTPQuotedString$1(input, position, extractValue$2 = false) {
21339
+ function collectAnHTTPQuotedString$1(input, position, extractValue$1 = false) {
21299
21340
  const positionStart = position.position;
21300
21341
  let value = "";
21301
21342
  assert$30(input[position.position] === "\"");
@@ -21317,7 +21358,7 @@ var require_data_url = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/
21317
21358
  break;
21318
21359
  }
21319
21360
  }
21320
- if (extractValue$2) return value;
21361
+ if (extractValue$1) return value;
21321
21362
  return input.slice(positionStart, position.position);
21322
21363
  }
21323
21364
  /**
@@ -36545,7 +36586,7 @@ var require_util$2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
36545
36586
  * @see https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1
36546
36587
  * @param {import('./index').Cookie} cookie
36547
36588
  */
36548
- function stringify$3(cookie) {
36589
+ function stringify$4(cookie) {
36549
36590
  if (cookie.name.length === 0) return null;
36550
36591
  validateCookieName(cookie.name);
36551
36592
  validateCookieValue(cookie.value);
@@ -36589,7 +36630,7 @@ var require_util$2 = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/un
36589
36630
  validateCookiePath,
36590
36631
  validateCookieValue,
36591
36632
  toIMFDate,
36592
- stringify: stringify$3
36633
+ stringify: stringify$4
36593
36634
  };
36594
36635
  }) });
36595
36636
 
@@ -36700,7 +36741,7 @@ var require_parse = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/und
36700
36741
  //#region ../../node_modules/.pnpm/undici@7.29.0/node_modules/undici/lib/web/cookies/index.js
36701
36742
  var require_cookies = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/undici@7.29.0/node_modules/undici/lib/web/cookies/index.js": ((exports, module) => {
36702
36743
  const { parseSetCookie } = require_parse();
36703
- const { stringify: stringify$2 } = require_util$2();
36744
+ const { stringify: stringify$3 } = require_util$2();
36704
36745
  const { webidl: webidl$5 } = require_webidl();
36705
36746
  const { Headers: Headers$2 } = require_headers();
36706
36747
  const brandChecks = webidl$5.brandCheckMultiple([Headers$2, globalThis.Headers].filter(Boolean));
@@ -36781,7 +36822,7 @@ var require_cookies = /* @__PURE__ */ __commonJS$2({ "../../node_modules/.pnpm/u
36781
36822
  webidl$5.argumentLengthCheck(arguments, 2, "setCookie");
36782
36823
  brandChecks(headers);
36783
36824
  cookie = webidl$5.converters.Cookie(cookie);
36784
- const str = stringify$2(cookie);
36825
+ const str = stringify$3(cookie);
36785
36826
  if (str) headers.append("set-cookie", str, true);
36786
36827
  }
36787
36828
  webidl$5.converters.DeleteCookieAttributes = webidl$5.dictionaryConverter([{
@@ -40361,7 +40402,7 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
40361
40402
  var ini = require_ini();
40362
40403
  var path6 = __require("path");
40363
40404
  var stripJsonComments = require_strip_json_comments();
40364
- var parse$8 = exports$1.parse = function(content) {
40405
+ var parse$7 = exports$1.parse = function(content) {
40365
40406
  if (/^\s*{/.test(content)) return JSON.parse(stripJsonComments(content));
40366
40407
  return ini.parse(content);
40367
40408
  };
@@ -40379,7 +40420,7 @@ var require_utils = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modul
40379
40420
  };
40380
40421
  exports$1.json = function() {
40381
40422
  var content = file$2.apply(null, arguments);
40382
- return content ? parse$8(content) : null;
40423
+ return content ? parse$7(content) : null;
40383
40424
  };
40384
40425
  exports$1.env = function(prefix, env2) {
40385
40426
  env2 = env2 || process.env;
@@ -40659,11 +40700,11 @@ var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
40659
40700
  var etc = "/etc";
40660
40701
  var win = process.platform === "win32";
40661
40702
  var home = win ? process.env.USERPROFILE : process.env.HOME;
40662
- module$1.exports = function(name, defaults, argv, parse$8) {
40703
+ module$1.exports = function(name, defaults, argv, parse$7) {
40663
40704
  if ("string" !== typeof name) throw new Error("rc(name): name *must* be string");
40664
40705
  if (!argv) argv = require_minimist()(process.argv.slice(2));
40665
40706
  defaults = ("string" === typeof defaults ? cc.json(defaults) : defaults) || {};
40666
- parse$8 = parse$8 || cc.parse;
40707
+ parse$7 = parse$7 || cc.parse;
40667
40708
  var env$2 = cc.env(name + "_");
40668
40709
  var configs = [defaults];
40669
40710
  var configFiles = [];
@@ -40671,7 +40712,7 @@ var require_rc = __commonJS$1({ "../../node_modules/.pnpm/rc@1.2.8/node_modules/
40671
40712
  if (configFiles.indexOf(file$2) >= 0) return;
40672
40713
  var fileConfig = cc.file(file$2);
40673
40714
  if (fileConfig) {
40674
- configs.push(parse$8(fileConfig));
40715
+ configs.push(parse$7(fileConfig));
40675
40716
  configFiles.push(file$2);
40676
40717
  }
40677
40718
  }
@@ -42668,6 +42709,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
42668
42709
  };
42669
42710
  warnIfDurableObjectsHaveNoLifecycleConfig(diagnostics, environment.durable_objects, environment.migrations, environment.exports, configPath);
42670
42711
  errorIfMigrationsAndExportsBothSet(diagnostics, environment.migrations, environment.exports);
42712
+ validateWorkflowExportConflicts(diagnostics, environment.exports);
42671
42713
  const containersDeclaredElsewhere = rawConfig !== void 0 ? rawConfig.containers !== void 0 : Object.values("env" in rawEnv ? rawEnv.env ?? {} : {}).some((rawNamedEnv) => rawNamedEnv?.containers !== void 0);
42672
42714
  validateContainerExportLinks(diagnostics, environment.containers, environment.exports, containersDeclaredElsewhere);
42673
42715
  if (envName !== "top level") validateAdditionalProperties(diagnostics, "env." + envName, Object.keys(rawEnv), Object.keys(environment));
@@ -42946,14 +42988,93 @@ var validateDurableObjectBinding = /* @__PURE__ */ __name$3((diagnostics, field,
42946
42988
  return isValid;
42947
42989
  }, "validateDurableObjectBinding");
42948
42990
  var workflowNameFormatMessage = `Workflow names must be 1-64 characters long, start with a letter, number, or underscore, and may only contain letters, numbers, underscores, or hyphens.`;
42949
- function validateWorkflowRetentionValue(diagnostics, field, key, value) {
42991
+ function validateWorkflowRetentionValue(diagnostics, field, kind, key, value) {
42950
42992
  const isValidNumber = typeof value === "number" && Number.isInteger(value) && value > 0;
42951
42993
  const isValidString = typeof value === "string" && value.length > 0;
42952
42994
  if (isValidNumber || isValidString) return true;
42953
- diagnostics.errors.push(`"${field}" bindings "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(value)}.`);
42995
+ diagnostics.errors.push(`"${field}" ${kind} "default_retention.${key}" field must be a positive integer of milliseconds or a duration string such as "3 days", but got ${JSON.stringify(value)}.`);
42954
42996
  return false;
42955
42997
  }
42956
42998
  __name$3(validateWorkflowRetentionValue, "validateWorkflowRetentionValue");
42999
+ function validateWorkflowSchedules(diagnostics, field, kind, value) {
43000
+ const { schedules } = value;
43001
+ if (schedules === void 0) return true;
43002
+ if (typeof schedules === "string") {
43003
+ if (schedules.length === 0) {
43004
+ diagnostics.errors.push(`"${field}" ${kind} "schedules" field must not be an empty string.`);
43005
+ return false;
43006
+ }
43007
+ return true;
43008
+ }
43009
+ if (Array.isArray(schedules)) {
43010
+ if (schedules.length === 0) {
43011
+ diagnostics.errors.push(`"${field}" ${kind} "schedules" field must not be an empty array.`);
43012
+ return false;
43013
+ }
43014
+ if (!schedules.every((s) => typeof s === "string")) {
43015
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
43016
+ return false;
43017
+ }
43018
+ if (schedules.some((s) => s === "")) {
43019
+ diagnostics.errors.push(`"${field}" ${kind} "schedules" field must not contain empty strings.`);
43020
+ return false;
43021
+ }
43022
+ return true;
43023
+ }
43024
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
43025
+ return false;
43026
+ }
43027
+ __name$3(validateWorkflowSchedules, "validateWorkflowSchedules");
43028
+ function validateWorkflowLimits(diagnostics, field, kind, value) {
43029
+ const { limits } = value;
43030
+ if (limits === void 0) return true;
43031
+ if (typeof limits !== "object" || limits === null || Array.isArray(limits)) {
43032
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have an object "limits" field but got ${JSON.stringify(value)}.`);
43033
+ return false;
43034
+ }
43035
+ let valid = true;
43036
+ const { steps } = limits;
43037
+ if (steps !== void 0) {
43038
+ if (typeof steps !== "number" || !Number.isInteger(steps) || steps < 1) {
43039
+ diagnostics.errors.push(`"${field}" ${kind} "limits.steps" field must be a positive integer but got ${JSON.stringify(steps)}.`);
43040
+ valid = false;
43041
+ } else if (steps > 25e3) diagnostics.warnings.push(`"${field}" has a step limit of ${steps}, which exceeds the production maximum of 25,000. This configuration may not work when deployed.`);
43042
+ }
43043
+ validateAdditionalProperties(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
43044
+ return valid;
43045
+ }
43046
+ __name$3(validateWorkflowLimits, "validateWorkflowLimits");
43047
+ function validateWorkflowDefaultRetention(diagnostics, field, kind, value) {
43048
+ const { default_retention: defaultRetention } = value;
43049
+ if (defaultRetention === void 0) return true;
43050
+ if (typeof defaultRetention !== "object" || defaultRetention === null || Array.isArray(defaultRetention)) {
43051
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
43052
+ return false;
43053
+ }
43054
+ let valid = true;
43055
+ const retention = defaultRetention;
43056
+ for (const key of ["success_retention", "error_retention"]) if (retention[key] !== void 0 && !validateWorkflowRetentionValue(diagnostics, field, kind, key, retention[key])) valid = false;
43057
+ validateAdditionalProperties(diagnostics, `${field}.default_retention`, Object.keys(retention), ["success_retention", "error_retention"]);
43058
+ return valid;
43059
+ }
43060
+ __name$3(validateWorkflowDefaultRetention, "validateWorkflowDefaultRetention");
43061
+ function validateWorkflowConcurrency(diagnostics, field, kind, value) {
43062
+ const { concurrency } = value;
43063
+ if (concurrency === void 0) return true;
43064
+ if (typeof concurrency !== "object" || concurrency === null || Array.isArray(concurrency)) {
43065
+ diagnostics.errors.push(`"${field}" ${kind} should, optionally, have an object "concurrency" field but got ${JSON.stringify(value)}.`);
43066
+ return false;
43067
+ }
43068
+ let valid = true;
43069
+ const { limit } = concurrency;
43070
+ if (limit !== void 0 && (typeof limit !== "number" || !Number.isInteger(limit) || limit < 1)) {
43071
+ diagnostics.errors.push(`"${field}" ${kind} "concurrency.limit" field must be a positive integer but got ${JSON.stringify(limit)}.`);
43072
+ valid = false;
43073
+ }
43074
+ validateAdditionalProperties(diagnostics, `${field}.concurrency`, Object.keys(concurrency), ["limit"]);
43075
+ return valid;
43076
+ }
43077
+ __name$3(validateWorkflowConcurrency, "validateWorkflowConcurrency");
42957
43078
  var validateWorkflowBinding = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
42958
43079
  if (typeof value !== "object" || value === null) {
42959
43080
  diagnostics.errors.push(`"workflows" bindings should be objects, but got ${JSON.stringify(value)}`);
@@ -42979,58 +43100,11 @@ var validateWorkflowBinding = /* @__PURE__ */ __name$3((diagnostics, field, valu
42979
43100
  diagnostics.errors.push(`"${field}" bindings should, optionally, have a string "script_name" field but got ${JSON.stringify(value)}.`);
42980
43101
  isValid = false;
42981
43102
  }
42982
- if (hasProperty(value, "schedules") && value.schedules !== void 0) if (typeof value.schedules === "string") {
42983
- if (value.schedules.length === 0) {
42984
- diagnostics.errors.push(`"${field}" bindings "schedules" field must not be an empty string.`);
42985
- isValid = false;
42986
- }
42987
- } else if (Array.isArray(value.schedules)) {
42988
- if (value.schedules.length === 0) {
42989
- diagnostics.errors.push(`"${field}" bindings "schedules" field must not be an empty array.`);
42990
- isValid = false;
42991
- } else if (!value.schedules.every((s) => typeof s === "string")) {
42992
- diagnostics.errors.push(`"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
42993
- isValid = false;
42994
- } else if (value.schedules.some((s) => s === "")) {
42995
- diagnostics.errors.push(`"${field}" bindings "schedules" field must not contain empty strings.`);
42996
- isValid = false;
42997
- }
42998
- } else {
42999
- diagnostics.errors.push(`"${field}" bindings should, optionally, have a string or array of strings "schedules" field but got ${JSON.stringify(value)}.`);
43000
- isValid = false;
43001
- }
43002
- if (hasProperty(value, "limits") && value.limits !== void 0) if (typeof value.limits !== "object" || value.limits === null || Array.isArray(value.limits)) {
43003
- diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "limits" field but got ${JSON.stringify(value)}.`);
43004
- isValid = false;
43005
- } else {
43006
- const limits = value.limits;
43007
- if (limits.steps !== void 0) {
43008
- if (typeof limits.steps !== "number" || !Number.isInteger(limits.steps) || limits.steps < 1) {
43009
- diagnostics.errors.push(`"${field}" bindings "limits.steps" field must be a positive integer but got ${JSON.stringify(limits.steps)}.`);
43010
- isValid = false;
43011
- } else if (limits.steps > 25e3) diagnostics.warnings.push(`"${field}" has a step limit of ${limits.steps}, which exceeds the production maximum of 25,000. This configuration may not work when deployed.`);
43012
- }
43013
- validateAdditionalProperties(diagnostics, `${field}.limits`, Object.keys(limits), ["steps"]);
43014
- }
43015
- if (hasProperty(value, "default_retention") && value.default_retention !== void 0) if (typeof value.default_retention !== "object" || value.default_retention === null || Array.isArray(value.default_retention)) {
43016
- diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "default_retention" field but got ${JSON.stringify(value)}.`);
43017
- isValid = false;
43018
- } else {
43019
- const defaultRetention = value.default_retention;
43020
- for (const key of ["success_retention", "error_retention"]) if (defaultRetention[key] !== void 0 && !validateWorkflowRetentionValue(diagnostics, field, key, defaultRetention[key])) isValid = false;
43021
- validateAdditionalProperties(diagnostics, `${field}.default_retention`, Object.keys(defaultRetention), ["success_retention", "error_retention"]);
43022
- }
43023
- if (hasProperty(value, "concurrency") && value.concurrency !== void 0) if (typeof value.concurrency !== "object" || value.concurrency === null || Array.isArray(value.concurrency)) {
43024
- diagnostics.errors.push(`"${field}" bindings should, optionally, have an object "concurrency" field but got ${JSON.stringify(value)}.`);
43025
- isValid = false;
43026
- } else {
43027
- const concurrency = value.concurrency;
43028
- if (concurrency.limit !== void 0 && (typeof concurrency.limit !== "number" || !Number.isInteger(concurrency.limit) || concurrency.limit < 1)) {
43029
- diagnostics.errors.push(`"${field}" bindings "concurrency.limit" field must be a positive integer but got ${JSON.stringify(concurrency.limit)}.`);
43030
- isValid = false;
43031
- }
43032
- validateAdditionalProperties(diagnostics, `${field}.concurrency`, Object.keys(concurrency), ["limit"]);
43033
- }
43103
+ const settings = value;
43104
+ isValid = validateWorkflowSchedules(diagnostics, field, "bindings", settings) && isValid;
43105
+ isValid = validateWorkflowLimits(diagnostics, field, "bindings", settings) && isValid;
43106
+ isValid = validateWorkflowDefaultRetention(diagnostics, field, "bindings", settings) && isValid;
43107
+ isValid = validateWorkflowConcurrency(diagnostics, field, "bindings", settings) && isValid;
43034
43108
  validateAdditionalProperties(diagnostics, field, Object.keys(value), [
43035
43109
  "binding",
43036
43110
  "name",
@@ -43231,6 +43305,13 @@ function validateSshPublicKeys(diagnostics, field, value, nameRequired) {
43231
43305
  }
43232
43306
  }
43233
43307
  __name$3(validateSshPublicKeys, "validateSshPublicKeys");
43308
+ function validateContainerSshConfig(diagnostics, field, value) {
43309
+ const sshConfig = typeof value === "object" && value !== null ? value : {};
43310
+ if (!isRequiredProperty(sshConfig, "enabled", "boolean")) diagnostics.errors.push(`${field}.enabled must be a boolean`);
43311
+ const port = "port" in sshConfig ? sshConfig.port : void 0;
43312
+ if (!isOptionalProperty(sshConfig, "port", "number") || typeof port === "number" && (!Number.isInteger(port) || port < 1 || port > 65535)) diagnostics.errors.push(`${field}.port must be a number between 1 and 65535 inclusive`);
43313
+ }
43314
+ __name$3(validateContainerSshConfig, "validateContainerSshConfig");
43234
43315
  function validatePreviewsContainers(envName, configPath) {
43235
43316
  const innerValidator = validateContainerApp(envName, void 0, configPath, { generateDefaultName: false });
43236
43317
  return (diagnostics, field, value, config$1) => {
@@ -43382,9 +43463,13 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
43382
43463
  "scheduling_policy",
43383
43464
  "images",
43384
43465
  "observability",
43466
+ "ssh",
43467
+ "authorized_keys",
43385
43468
  "unsafe"
43386
43469
  ].includes(key));
43387
- if (unsupportedFields.length > 0) diagnostics.errors.push(`Unsupported fields for Durable Object-managed Containers in ${field}: ${unsupportedFields.map((key) => `"${key}"`).join(",")}. Only "name", "class_name", "scheduling_policy", "images", "observability", and restricted "unsafe" settings are supported.`);
43470
+ if (unsupportedFields.length > 0) diagnostics.errors.push(`Unsupported fields for Durable Object-managed Containers in ${field}: ${unsupportedFields.map((key) => `"${key}"`).join(",")}. Only "name", "class_name", "scheduling_policy", "images", "observability", "ssh", "authorized_keys", and restricted "unsafe" settings are supported.`);
43471
+ if ("ssh" in containerAppOptional) validateContainerSshConfig(diagnostics, `${field}.ssh`, containerAppOptional.ssh);
43472
+ if ("authorized_keys" in containerAppOptional) validateSshPublicKeys(diagnostics, `${field}.authorized_keys`, containerAppOptional.authorized_keys, true);
43388
43473
  continue;
43389
43474
  }
43390
43475
  if (!containerAppOptional.configuration?.image && !containerAppOptional.image) diagnostics.errors.push(`"containers.image" field must be defined for each container app. This should be the path to your Dockerfile or an image URI pointing to the Cloudflare registry.`);
@@ -43495,23 +43580,11 @@ function validateContainerApp(envName, topLevelName, configPath, options = {}) {
43495
43580
  "vcpu",
43496
43581
  "memory_mib"
43497
43582
  ]);
43498
- let sshField;
43499
- let sshConfig;
43500
43583
  if ("ssh" in containerAppOptional) {
43501
- sshField = "ssh";
43502
- sshConfig = containerAppOptional.ssh;
43584
+ validateContainerSshConfig(diagnostics, `${field}.ssh`, containerAppOptional.ssh);
43503
43585
  containerAppOptional.wrangler_ssh = containerAppOptional.ssh;
43504
43586
  delete containerAppOptional.ssh;
43505
- } else if ("wrangler_ssh" in containerAppOptional) {
43506
- sshField = "wrangler_ssh";
43507
- sshConfig = containerAppOptional.wrangler_ssh;
43508
- }
43509
- if (sshField !== void 0) {
43510
- const sshConfigObject = typeof sshConfig === "object" && sshConfig !== null ? sshConfig : {};
43511
- if (!isRequiredProperty(sshConfigObject, "enabled", "boolean")) diagnostics.errors.push(`${field}.${sshField}.enabled must be a boolean`);
43512
- const sshPort = "port" in sshConfigObject ? sshConfigObject.port : void 0;
43513
- if (!isOptionalProperty(sshConfigObject, "port", "number") || typeof sshPort === "number" && (sshPort < 1 || sshPort > 65535)) diagnostics.errors.push(`${field}.${sshField}.port must be a number between 1 and 65535 inclusive`);
43514
- }
43587
+ } else if ("wrangler_ssh" in containerAppOptional) validateContainerSshConfig(diagnostics, `${field}.wrangler_ssh`, containerAppOptional.wrangler_ssh);
43515
43588
  if ("authorized_keys" in containerAppOptional) validateSshPublicKeys(diagnostics, `${field}.authorized_keys`, containerAppOptional.authorized_keys, true);
43516
43589
  if ("trusted_user_ca_keys" in containerAppOptional) validateSshPublicKeys(diagnostics, `${field}.trusted_user_ca_keys`, containerAppOptional.trusted_user_ca_keys, false);
43517
43590
  if (validateOptionalProperty(diagnostics, field, "constraints", containerAppOptional.constraints, "object") && containerAppOptional.constraints) {
@@ -44229,16 +44302,23 @@ var validateConnectHandler = /* @__PURE__ */ __name$3((diagnostics, field, value
44229
44302
  return false;
44230
44303
  }
44231
44304
  let isValid = true;
44232
- if (!validateAdditionalProperties(diagnostics, field, Object.keys(value), [
44305
+ const connectHandler = value;
44306
+ if (!validateAdditionalProperties(diagnostics, field, Object.keys(value), connectHandler.protocol === "udp" ? [
44307
+ "protocol",
44308
+ "port",
44309
+ "address",
44310
+ "idle_timeout_ms",
44311
+ "max_pending_bytes"
44312
+ ] : [
44233
44313
  "protocol",
44234
44314
  "port",
44235
44315
  "address"
44236
44316
  ])) isValid = false;
44237
- if ("protocol" in value && value.protocol !== "tcp") {
44238
- diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" but got ${JSON.stringify(value.protocol)}.`);
44317
+ if ("protocol" in value && value.protocol !== "tcp" && value.protocol !== "udp") {
44318
+ diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" or "udp" but got ${JSON.stringify(value.protocol)}.`);
44239
44319
  isValid = false;
44240
44320
  } else if (!("protocol" in value)) {
44241
- diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" but got ${JSON.stringify(value)}.`);
44321
+ diagnostics.errors.push(`"${field}" should have a "protocol" field of "tcp" or "udp" but got ${JSON.stringify(value)}.`);
44242
44322
  isValid = false;
44243
44323
  }
44244
44324
  if (!isRequiredProperty(value, "port", "number")) {
@@ -44252,6 +44332,14 @@ var validateConnectHandler = /* @__PURE__ */ __name$3((diagnostics, field, value
44252
44332
  diagnostics.errors.push(`"${field}" should, optionally, have a string "address" field but got ${JSON.stringify(value)}.`);
44253
44333
  isValid = false;
44254
44334
  }
44335
+ if (connectHandler.protocol === "udp") for (const option of ["idle_timeout_ms", "max_pending_bytes"]) {
44336
+ if (!(option in connectHandler)) continue;
44337
+ const optionValue = connectHandler[option];
44338
+ if (typeof optionValue !== "number" || !Number.isInteger(optionValue) || optionValue < 0 || optionValue > 4294967295) {
44339
+ diagnostics.errors.push(`"${field}" should have an integer "${option}" field between 0 and 4294967295 but got ${JSON.stringify(value)}.`);
44340
+ isValid = false;
44341
+ }
44342
+ }
44255
44343
  return isValid;
44256
44344
  }, "validateConnectHandler");
44257
44345
  var validateCompatibilityDate = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
@@ -44692,6 +44780,29 @@ function validateWorkerExportCache(diagnostics, field, value) {
44692
44780
  return valid;
44693
44781
  }
44694
44782
  __name$3(validateWorkerExportCache, "validateWorkerExportCache");
44783
+ function validateWorkflowExport(diagnostics, exportName, workflowExport) {
44784
+ const field = `exports.${exportName}`;
44785
+ let valid = true;
44786
+ valid = validateRequiredProperty(diagnostics, field, "name", workflowExport.name, "string") && valid;
44787
+ if (typeof workflowExport.name === "string" && !isValidWorkflowName(workflowExport.name)) {
44788
+ diagnostics.errors.push(`"${field}.name" is invalid. ${workflowNameFormatMessage}`);
44789
+ valid = false;
44790
+ }
44791
+ valid = validateWorkflowSchedules(diagnostics, field, "export", workflowExport) && valid;
44792
+ valid = validateWorkflowLimits(diagnostics, field, "export", workflowExport) && valid;
44793
+ valid = validateWorkflowDefaultRetention(diagnostics, field, "export", workflowExport) && valid;
44794
+ valid = validateWorkflowConcurrency(diagnostics, field, "export", workflowExport) && valid;
44795
+ valid = validateAdditionalProperties(diagnostics, field, Object.keys(workflowExport), [
44796
+ "type",
44797
+ "name",
44798
+ "limits",
44799
+ "concurrency",
44800
+ "schedules",
44801
+ "default_retention"
44802
+ ]) && valid;
44803
+ return valid;
44804
+ }
44805
+ __name$3(validateWorkflowExport, "validateWorkflowExport");
44695
44806
  var validateExports = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
44696
44807
  if (value === void 0 || value === null) return true;
44697
44808
  if (typeof value !== "object" || Array.isArray(value)) {
@@ -44707,9 +44818,10 @@ var validateExports = /* @__PURE__ */ __name$3((diagnostics, field, value) => {
44707
44818
  }
44708
44819
  if (exportConfig.type === "durable-object") valid = validateDurableObjectExport(diagnostics, exportName, exportConfig) && valid;
44709
44820
  else if (exportConfig.type === "worker") valid = validateWorkerExport(diagnostics, exportName, exportConfig) && valid;
44821
+ else if (exportConfig.type === "workflow") valid = validateWorkflowExport(diagnostics, exportName, exportConfig) && valid;
44710
44822
  else {
44711
44823
  valid = false;
44712
- diagnostics.errors.push(`"exports.${exportName}.type" must be "durable-object" or "worker", but got ${JSON.stringify(exportConfig.type)}.`);
44824
+ diagnostics.errors.push(`"exports.${exportName}.type" must be "durable-object", "worker", or "workflow", but got ${JSON.stringify(exportConfig.type)}.`);
44713
44825
  }
44714
44826
  }
44715
44827
  return valid;
@@ -44931,6 +45043,19 @@ function errorIfMigrationsAndExportsBothSet(diagnostics, migrations, exports$1)
44931
45043
  if (migrations.length > 0 && exports$1 !== void 0 && Object.values(exports$1).some((entry) => entry.type === "durable-object")) diagnostics.errors.push(`\`migrations\` and \`exports\` are mutually exclusive. Choose one or the other to declare your Durable Object lifecycle, but not both.`);
44932
45044
  }
44933
45045
  __name$3(errorIfMigrationsAndExportsBothSet, "errorIfMigrationsAndExportsBothSet");
45046
+ function validateWorkflowExportConflicts(diagnostics, exports$1) {
45047
+ const classNamesByWorkflowName = /* @__PURE__ */ new Map();
45048
+ for (const [className, workflowExport] of Object.entries(partitionExports(exports$1).workflow)) {
45049
+ if (typeof workflowExport.name !== "string") continue;
45050
+ const existing = classNamesByWorkflowName.get(workflowExport.name);
45051
+ if (existing !== void 0) {
45052
+ diagnostics.errors.push(`"exports.${existing}" and "exports.${className}" both declare the Workflow "${workflowExport.name}". Workflow names must be unique.`);
45053
+ continue;
45054
+ }
45055
+ classNamesByWorkflowName.set(workflowExport.name, className);
45056
+ }
45057
+ }
45058
+ __name$3(validateWorkflowExportConflicts, "validateWorkflowExportConflicts");
44934
45059
  function validateContainerExportLinks(diagnostics, containers, exports$1, containersDeclaredElsewhere) {
44935
45060
  if (containers !== void 0 && !Array.isArray(containers)) return;
44936
45061
  if (containers === void 0 && containersDeclaredElsewhere) return;
@@ -46800,9 +46925,9 @@ function getInstalledVersion(binPath) {
46800
46925
  }
46801
46926
  __name$3(getInstalledVersion, "getInstalledVersion");
46802
46927
  function isVersionOutdated(installed, latest) {
46803
- const parse$8 = /* @__PURE__ */ __name$3((v) => v.split(".").map(Number), "parse");
46804
- const [iYear, iMonth, iPatch] = parse$8(installed);
46805
- const [lYear, lMonth, lPatch] = parse$8(latest);
46928
+ const parse$7 = /* @__PURE__ */ __name$3((v) => v.split(".").map(Number), "parse");
46929
+ const [iYear, iMonth, iPatch] = parse$7(installed);
46930
+ const [lYear, lMonth, lPatch] = parse$7(latest);
46806
46931
  if (iYear !== lYear) return iYear < lYear;
46807
46932
  if (iMonth !== lMonth) return iMonth < lMonth;
46808
46933
  return iPatch < lPatch;
@@ -47717,7 +47842,7 @@ const SPARSE = -7;
47717
47842
  * @param {string} serialized
47718
47843
  * @param {Record<string, (value: any) => any>} [revivers]
47719
47844
  */
47720
- function parse$5(serialized, revivers) {
47845
+ function parse$4(serialized, revivers) {
47721
47846
  return unflatten(JSON.parse(serialized), revivers);
47722
47847
  }
47723
47848
  /**
@@ -49203,8 +49328,8 @@ var ImportType = function(A$2) {
49203
49328
  return A$2[A$2.Static = 1] = "Static", A$2[A$2.Dynamic = 2] = "Dynamic", A$2[A$2.ImportMeta = 3] = "ImportMeta", A$2[A$2.StaticSourcePhase = 4] = "StaticSourcePhase", A$2[A$2.DynamicSourcePhase = 5] = "DynamicSourcePhase", A$2[A$2.StaticDeferPhase = 6] = "StaticDeferPhase", A$2[A$2.DynamicDeferPhase = 7] = "DynamicDeferPhase", A$2;
49204
49329
  }({});
49205
49330
  const A$1 = 1 === new Uint8Array(new Uint16Array([1]).buffer)[0];
49206
- function parse$4(C$2, g = "@") {
49207
- if (!E) return init.then(() => parse$4(C$2));
49331
+ function parse$3(C$2, g = "@") {
49332
+ if (!E) return init.then(() => parse$3(C$2));
49208
49333
  const I = C$2.length + 1, w$1 = (E.__heap_base.value || E.__heap_base) + 4 * I - E.memory.buffer.byteLength;
49209
49334
  w$1 > 0 && E.memory.grow(Math.ceil(w$1 / 65536));
49210
49335
  const o = E.sa(I - 1);
@@ -50051,7 +50176,7 @@ async function handleV2ModuleFallbackRequest(vite, request$1) {
50051
50176
  */
50052
50177
  async function linkV2VitestModule(vite, contents, modulePath, vitestModulePaths) {
50053
50178
  await init;
50054
- const [imports] = parse$4(contents);
50179
+ const [imports] = parse$3(contents);
50055
50180
  for (let i = imports.length - 1; i >= 0; i--) {
50056
50181
  const imported = imports[i];
50057
50182
  const specifier = imported.n;
@@ -50245,7 +50370,7 @@ const getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {
50245
50370
  ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
50246
50371
  };
50247
50372
  };
50248
- var dist_default$2 = getStringTruncatedWidth;
50373
+ var dist_default$1 = getStringTruncatedWidth;
50249
50374
 
50250
50375
  //#endregion
50251
50376
  //#region ../../node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
@@ -50255,9 +50380,9 @@ const NO_TRUNCATION = {
50255
50380
  ellipsisWidth: 0
50256
50381
  };
50257
50382
  const fastStringWidth = (input, options = {}) => {
50258
- return dist_default$2(input, NO_TRUNCATION, options).width;
50383
+ return dist_default$1(input, NO_TRUNCATION, options).width;
50259
50384
  };
50260
- var dist_default$1 = fastStringWidth;
50385
+ var dist_default = fastStringWidth;
50261
50386
 
50262
50387
  //#endregion
50263
50388
  //#region ../../node_modules/.pnpm/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
@@ -50290,13 +50415,13 @@ const wrapWord$1 = (rows, word, columns) => {
50290
50415
  let isInsideEscape = false;
50291
50416
  let isInsideLinkEscape = false;
50292
50417
  let lastRow = rows.at(-1);
50293
- let visible = lastRow === void 0 ? 0 : dist_default$1(lastRow);
50418
+ let visible = lastRow === void 0 ? 0 : dist_default(lastRow);
50294
50419
  let currentCharacter = characters.next();
50295
50420
  let nextCharacter = characters.next();
50296
50421
  let rawCharacterIndex = 0;
50297
50422
  while (!currentCharacter.done) {
50298
50423
  const character = currentCharacter.value;
50299
- const characterLength = dist_default$1(character);
50424
+ const characterLength = dist_default(character);
50300
50425
  if (visible + characterLength <= columns) rows[rows.length - 1] += character;
50301
50426
  else {
50302
50427
  rows.push(character);
@@ -50331,7 +50456,7 @@ const stringVisibleTrimSpacesRight$1 = (string$1) => {
50331
50456
  const words = string$1.split(" ");
50332
50457
  let last = words.length;
50333
50458
  while (last) {
50334
- if (dist_default$1(words[last - 1])) break;
50459
+ if (dist_default(words[last - 1])) break;
50335
50460
  last--;
50336
50461
  }
50337
50462
  if (last === words.length) return string$1;
@@ -50352,7 +50477,7 @@ const exec$2 = (string$1, columns, options = {}) => {
50352
50477
  const trimmed = row.trimStart();
50353
50478
  if (row.length !== trimmed.length) {
50354
50479
  rows[rows.length - 1] = trimmed;
50355
- rowLength = dist_default$1(trimmed);
50480
+ rowLength = dist_default(trimmed);
50356
50481
  }
50357
50482
  }
50358
50483
  if (index !== 0) {
@@ -50365,19 +50490,19 @@ const exec$2 = (string$1, columns, options = {}) => {
50365
50490
  rowLength++;
50366
50491
  }
50367
50492
  }
50368
- const wordLength = dist_default$1(word);
50493
+ const wordLength = dist_default(word);
50369
50494
  if (options.hard && wordLength > columns) {
50370
50495
  const remainingColumns = columns - rowLength;
50371
50496
  const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
50372
50497
  if (Math.floor((wordLength - 1) / columns) < breaksStartingThisLine) rows.push("");
50373
50498
  wrapWord$1(rows, word, columns);
50374
- rowLength = dist_default$1(rows.at(-1) ?? "");
50499
+ rowLength = dist_default(rows.at(-1) ?? "");
50375
50500
  continue;
50376
50501
  }
50377
50502
  if (rowLength + wordLength > columns && rowLength && wordLength) {
50378
50503
  if (options.wordWrap === false && rowLength < columns) {
50379
50504
  wrapWord$1(rows, word, columns);
50380
- rowLength = dist_default$1(rows.at(-1) ?? "");
50505
+ rowLength = dist_default(rows.at(-1) ?? "");
50381
50506
  continue;
50382
50507
  }
50383
50508
  rows.push("");
@@ -50385,7 +50510,7 @@ const exec$2 = (string$1, columns, options = {}) => {
50385
50510
  }
50386
50511
  if (rowLength + wordLength > columns && options.wordWrap === false) {
50387
50512
  wrapWord$1(rows, word, columns);
50388
- rowLength = dist_default$1(rows.at(-1) ?? "");
50513
+ rowLength = dist_default(rows.at(-1) ?? "");
50389
50514
  continue;
50390
50515
  }
50391
50516
  rows[rows.length - 1] += word;
@@ -52505,7 +52630,7 @@ var __name$2 = (target, value) => __defProp$2(target, "name", {
52505
52630
  });
52506
52631
 
52507
52632
  //#endregion
52508
- //#region ../workers-auth/dist/chunk-XLADBZ7F.mjs
52633
+ //#region ../workers-auth/dist/chunk-WMSASLDV.mjs
52509
52634
  var import_undici$2 = require_undici();
52510
52635
  var hasWarnedAboutDeprecatedV1ApiToken = false;
52511
52636
  function readStoredAuthState(options) {
@@ -54063,589 +54188,21 @@ function getProfileForDirectoryFromBindings(startDir, bindings) {
54063
54188
  }
54064
54189
  }
54065
54190
  __name$2(getProfileForDirectoryFromBindings, "getProfileForDirectoryFromBindings");
54066
- var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
54067
- var TomlDate = class _TomlDate extends Date {
54068
- static {
54069
- __name$2(this, "TomlDate");
54070
- }
54071
- #hasDate = false;
54072
- #hasTime = false;
54073
- #offset = null;
54074
- constructor(date$1) {
54075
- let hasDate = true;
54076
- let hasTime = true;
54077
- let offset = "Z";
54078
- if (typeof date$1 === "string") {
54079
- let match = date$1.match(DATE_TIME_RE);
54080
- if (match) {
54081
- if (!match[1]) {
54082
- hasDate = false;
54083
- date$1 = `0000-01-01T${date$1}`;
54084
- }
54085
- hasTime = !!match[2];
54086
- hasTime && date$1[10] === " " && (date$1 = date$1.replace(" ", "T"));
54087
- if (match[2] && +match[2] > 23) date$1 = "";
54088
- else {
54089
- offset = match[3] || null;
54090
- date$1 = date$1.toUpperCase();
54091
- if (!offset && hasTime) date$1 += "Z";
54092
- }
54093
- } else date$1 = "";
54094
- }
54095
- super(date$1);
54096
- if (!isNaN(this.getTime())) {
54097
- this.#hasDate = hasDate;
54098
- this.#hasTime = hasTime;
54099
- this.#offset = offset;
54100
- }
54101
- }
54102
- isDateTime() {
54103
- return this.#hasDate && this.#hasTime;
54104
- }
54105
- isLocal() {
54106
- return !this.#hasDate || !this.#hasTime || !this.#offset;
54107
- }
54108
- isDate() {
54109
- return this.#hasDate && !this.#hasTime;
54110
- }
54111
- isTime() {
54112
- return this.#hasTime && !this.#hasDate;
54113
- }
54114
- isValid() {
54115
- return this.#hasDate || this.#hasTime;
54116
- }
54117
- toISOString() {
54118
- let iso = super.toISOString();
54119
- if (this.isDate()) return iso.slice(0, 10);
54120
- if (this.isTime()) return iso.slice(11, 23);
54121
- if (this.#offset === null) return iso.slice(0, -1);
54122
- if (this.#offset === "Z") return iso;
54123
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
54124
- offset = this.#offset[0] === "-" ? offset : -offset;
54125
- return (/* @__PURE__ */ new Date(this.getTime() - offset * 6e4)).toISOString().slice(0, -1) + this.#offset;
54126
- }
54127
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
54128
- let date$1 = new _TomlDate(jsDate);
54129
- date$1.#offset = offset;
54130
- return date$1;
54131
- }
54132
- static wrapAsLocalDateTime(jsDate) {
54133
- let date$1 = new _TomlDate(jsDate);
54134
- date$1.#offset = null;
54135
- return date$1;
54136
- }
54137
- static wrapAsLocalDate(jsDate) {
54138
- let date$1 = new _TomlDate(jsDate);
54139
- date$1.#hasTime = false;
54140
- date$1.#offset = null;
54141
- return date$1;
54142
- }
54143
- static wrapAsLocalTime(jsDate) {
54144
- let date$1 = new _TomlDate(jsDate);
54145
- date$1.#hasDate = false;
54146
- date$1.#offset = null;
54147
- return date$1;
54148
- }
54149
- };
54150
- function getLineColFromPtr(string$1, ptr) {
54151
- let lines = string$1.slice(0, ptr).split(/\r\n|\n|\r/g);
54152
- return [lines.length, lines.pop().length + 1];
54153
- }
54154
- __name$2(getLineColFromPtr, "getLineColFromPtr");
54155
- function makeCodeBlock(string$1, line, column) {
54156
- let lines = string$1.split(/\r\n|\n|\r/g);
54157
- let codeblock = "";
54158
- let numberLen = (Math.log10(line + 1) | 0) + 1;
54159
- for (let i = line - 1; i <= line + 1; i++) {
54160
- let l = lines[i - 1];
54161
- if (!l) continue;
54162
- codeblock += i.toString().padEnd(numberLen, " ");
54163
- codeblock += ": ";
54164
- codeblock += l;
54165
- codeblock += "\n";
54166
- if (i === line) {
54167
- codeblock += " ".repeat(numberLen + column + 2);
54168
- codeblock += "^\n";
54169
- }
54170
- }
54171
- return codeblock;
54172
- }
54173
- __name$2(makeCodeBlock, "makeCodeBlock");
54174
- var TomlError = class extends Error {
54175
- static {
54176
- __name$2(this, "TomlError");
54177
- }
54178
- line;
54179
- column;
54180
- codeblock;
54181
- constructor(message, options) {
54182
- const [line, column] = getLineColFromPtr(options.toml, options.ptr);
54183
- const codeblock = makeCodeBlock(options.toml, line, column);
54184
- super(`Invalid TOML document: ${message}
54185
-
54186
- ${codeblock}`, options);
54187
- this.line = line;
54188
- this.column = column;
54189
- this.codeblock = codeblock;
54190
- }
54191
- };
54192
- function indexOfNewline(str, start = 0) {
54193
- let idx = str.indexOf("\n", start);
54194
- if (str.charCodeAt(idx - 1) === 13) idx--;
54195
- return idx;
54196
- }
54197
- __name$2(indexOfNewline, "indexOfNewline");
54198
- function skipComment(ctx) {
54199
- for (; ctx.p < ctx.s.length; ctx.p++) {
54200
- let c$1 = ctx.s.charCodeAt(ctx.p);
54201
- if (c$1 === 10) break;
54202
- if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
54203
- ctx.p++;
54204
- break;
54205
- }
54206
- if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError("control characters are not allowed in comments", {
54207
- toml: ctx.s,
54208
- ptr: ctx.p
54209
- });
54210
- }
54211
- }
54212
- __name$2(skipComment, "skipComment");
54213
- function skipVoid(ctx, banNewLines, banComments) {
54214
- let c$1;
54215
- while (1) {
54216
- 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++;
54217
- if (banComments || c$1 !== 35) break;
54218
- skipComment(ctx);
54219
- }
54220
- }
54221
- __name$2(skipVoid, "skipVoid");
54222
- function skipUntil(ctx, sep, end) {
54223
- let ptr = ctx.p;
54224
- if (!end) {
54225
- ptr = indexOfNewline(ctx.s, ptr);
54226
- ctx.p = ptr < 0 ? ctx.s.length : ptr;
54227
- return;
54228
- }
54229
- for (; ctx.p < ctx.s.length; ctx.p++) {
54230
- let c$1 = ctx.s.charCodeAt(ctx.p);
54231
- if (c$1 === 35) skipComment(ctx);
54232
- else if (c$1 === end || c$1 === sep) return;
54233
- }
54234
- throw new TomlError("cannot find end of structure", {
54235
- toml: ctx.s,
54236
- ptr
54237
- });
54238
- }
54239
- __name$2(skipUntil, "skipUntil");
54240
- var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
54241
- var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
54242
- var LEADING_ZERO = /^[+-]?0[0-9_]/;
54243
- function parseString(ctx) {
54244
- let start = ctx.p;
54245
- let c$1 = ctx.s.charCodeAt(ctx.p++);
54246
- let first = c$1;
54247
- let isLiteral = c$1 === 39;
54248
- let isMultiline = c$1 === ctx.s.charCodeAt(ctx.p) && c$1 === ctx.s.charCodeAt(ctx.p + 1);
54249
- if (isMultiline) {
54250
- if ((c$1 = ctx.s.charCodeAt(ctx.p += 2)) === 10) ctx.p++;
54251
- else if (c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) ctx.p += 2;
54252
- }
54253
- let parsed = "";
54254
- let sliceStart = ctx.p;
54255
- let state = 0;
54256
- for (; ctx.p < ctx.s.length; ctx.p++) {
54257
- c$1 = ctx.s.charCodeAt(ctx.p);
54258
- if (isMultiline && (c$1 === 10 || c$1 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) state = state && 3;
54259
- else if (c$1 < 32 && c$1 !== 9 || c$1 === 127) throw new TomlError("control characters are not allowed in strings", {
54260
- toml: ctx.s,
54261
- ptr: ctx.p
54262
- });
54263
- else if ((!state || state === 3) && c$1 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
54264
- if (isMultiline) {
54265
- if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
54266
- if (ctx.s.charCodeAt(ctx.p + 3) === first) ctx.p++;
54267
- }
54268
- if (!state) parsed += ctx.s.slice(sliceStart, ctx.p);
54269
- ctx.p += isMultiline ? 3 : 1;
54270
- return parsed;
54271
- } else if (!state) {
54272
- if (!isLiteral && c$1 === 92) {
54273
- parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
54274
- state = 1;
54275
- }
54276
- } else if (state === 1) if (c$1 === 120 || c$1 === 117 || c$1 === 85) {
54277
- let value = 0;
54278
- let len = c$1 === 120 ? 2 : c$1 === 117 ? 4 : 8;
54279
- for (let j$1 = 0; j$1 < len; j$1++, ctx.p++) {
54280
- let hex$1 = ctx.s.charCodeAt(ctx.p + 1);
54281
- 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;
54282
- if (digit < 0) throw new TomlError("invalid non-hex character in unicode escape", {
54283
- toml: ctx.s,
54284
- ptr: ctx.p + 1
54285
- });
54286
- value = value << 4 | digit;
54287
- }
54288
- if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new TomlError("invalid unicode escape", {
54289
- toml: ctx.s,
54290
- ptr: ctx.p
54291
- });
54292
- parsed += String.fromCodePoint(value);
54293
- sliceStart = ctx.p + 1;
54294
- state = 0;
54295
- } else if (c$1 === 32 || c$1 === 9) state = 2;
54296
- else {
54297
- if (c$1 === 98) parsed += "\b";
54298
- else if (c$1 === 116) parsed += " ";
54299
- else if (c$1 === 110) parsed += "\n";
54300
- else if (c$1 === 102) parsed += "\f";
54301
- else if (c$1 === 114) parsed += "\r";
54302
- else if (c$1 === 101) parsed += "\x1B";
54303
- else if (c$1 === 34) parsed += "\"";
54304
- else if (c$1 === 92) parsed += "\\";
54305
- else throw new TomlError("unrecognized escape sequence", {
54306
- toml: ctx.s,
54307
- ptr: ctx.p
54308
- });
54309
- sliceStart = ctx.p + 1;
54310
- state = 0;
54311
- }
54312
- else if (c$1 !== 32 && c$1 !== 9) {
54313
- if (state === 2) throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
54314
- toml: ctx.s,
54315
- ptr: sliceStart
54316
- });
54317
- state = !isLiteral && c$1 === 92 ? 1 : 0;
54318
- sliceStart = ctx.p;
54319
- }
54320
- }
54321
- throw new TomlError("unfinished string", {
54322
- toml: ctx.s,
54323
- ptr: start
54324
- });
54325
- }
54326
- __name$2(parseString, "parseString");
54327
- function sliceAndTrimEndOf(ctx, start, end) {
54328
- let value = ctx.s.slice(start, end);
54329
- let commentIdx = value.indexOf("#");
54330
- if (commentIdx > 0) {
54331
- skipComment({
54332
- s: value,
54333
- p: commentIdx
54334
- });
54335
- value = value.slice(0, commentIdx);
54336
- }
54337
- return value.trimEnd();
54338
- }
54339
- __name$2(sliceAndTrimEndOf, "sliceAndTrimEndOf");
54340
- function parseValue(ctx, integersAsBigInt, end) {
54341
- let ptr = ctx.p;
54342
- let err = {
54343
- toml: ctx.s,
54344
- ptr
54345
- };
54346
- skipUntil(ctx, 44, end);
54347
- let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
54348
- if (!value) throw new TomlError("incomplete declaration: value expected", err);
54349
- if (value === "-inf") return -Infinity;
54350
- if (value === "inf" || value === "+inf") return Infinity;
54351
- if (value === "nan" || value === "+nan" || value === "-nan") return NaN;
54352
- if (value === "-0") return integersAsBigInt ? 0n : 0;
54353
- let isInt = INT_REGEX.test(value);
54354
- if (isInt || FLOAT_REGEX.test(value)) {
54355
- if (LEADING_ZERO.test(value)) throw new TomlError("leading zeroes are not allowed", err);
54356
- value = value.replace(/_/g, "");
54357
- let numeric$1 = +value;
54358
- if (isNaN(numeric$1)) throw new TomlError("invalid number", err);
54359
- if (isInt) {
54360
- if ((isInt = !Number.isSafeInteger(numeric$1)) && !integersAsBigInt) throw new TomlError("integer value cannot be represented losslessly", err);
54361
- if (isInt || integersAsBigInt === true) numeric$1 = BigInt(value);
54362
- }
54363
- return numeric$1;
54364
- }
54365
- const date$1 = new TomlDate(value);
54366
- if (!date$1.isValid()) throw new TomlError("invalid value", err);
54367
- return date$1;
54368
- }
54369
- __name$2(parseValue, "parseValue");
54370
- function extractValue(ctx, end, integersAsBigInt) {
54371
- let ptr = ctx.p;
54372
- let c$1 = ctx.s.charCodeAt(ptr);
54373
- if (c$1 === 91 || c$1 === 123) {
54374
- if (!ctx.d--) throw new TomlError("document contains excessively nested structures. aborting.", {
54375
- toml: ctx.s,
54376
- ptr
54377
- });
54378
- let value = c$1 === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
54379
- ctx.d++;
54380
- return value;
54381
- }
54382
- if (c$1 === 34 || c$1 === 39) return parseString(ctx);
54383
- if (c$1 === 116) {
54384
- if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101) throw new TomlError("invalid value", {
54385
- toml: ctx.s,
54386
- ptr
54387
- });
54388
- ctx.p++;
54389
- return true;
54390
- }
54391
- if (c$1 === 102) {
54392
- 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", {
54393
- toml: ctx.s,
54394
- ptr
54395
- });
54396
- ctx.p++;
54397
- return false;
54398
- }
54399
- return parseValue(ctx, integersAsBigInt, end);
54400
- }
54401
- __name$2(extractValue, "extractValue");
54402
- var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
54403
- function parseKey(ctx, end = "=") {
54404
- let start = ctx.p;
54405
- let dot = start - 1;
54406
- let parsed = [];
54407
- let endPtr = ctx.s.indexOf(end, start);
54408
- if (endPtr < 0) throw new TomlError("incomplete key-value: cannot find end of key", {
54409
- toml: ctx.s,
54410
- ptr: start
54411
- });
54412
- do {
54413
- let c$1 = ctx.s.charCodeAt(ctx.p = ++dot);
54414
- if (c$1 !== 32 && c$1 !== 9) if (c$1 === 34 || c$1 === 39) {
54415
- 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", {
54416
- toml: ctx.s,
54417
- ptr: ctx.p
54418
- });
54419
- let part = parseString(ctx);
54420
- dot = ctx.s.indexOf(".", ctx.p);
54421
- let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
54422
- let newLine = indexOfNewline(strEnd);
54423
- if (newLine > -1) throw new TomlError("newlines are not allowed in keys", {
54424
- toml: ctx.s,
54425
- ptr: newLine
54426
- });
54427
- if (strEnd.trimStart()) throw new TomlError("found extra tokens after the string part", {
54428
- toml: ctx.s,
54429
- ptr: ctx.p
54430
- });
54431
- if (endPtr < ctx.p) {
54432
- endPtr = ctx.s.indexOf(end, ctx.p);
54433
- if (endPtr < 0) throw new TomlError("incomplete key-value: cannot find end of key", {
54434
- toml: ctx.s,
54435
- ptr: start
54436
- });
54437
- }
54438
- parsed.push(part);
54439
- } else {
54440
- dot = ctx.s.indexOf(".", ctx.p);
54441
- let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
54442
- if (!KEY_PART_RE.test(part)) throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
54443
- toml: ctx.s,
54444
- ptr: ctx.p
54445
- });
54446
- parsed.push(part.trimEnd());
54447
- }
54448
- } while (dot + 1 && dot < endPtr);
54449
- ctx.p = endPtr + 1;
54450
- skipVoid(ctx, true, true);
54451
- return parsed;
54452
- }
54453
- __name$2(parseKey, "parseKey");
54454
- function parseInlineTable(ctx, integersAsBigInt) {
54455
- let res = {};
54456
- let seen = /* @__PURE__ */ new Set();
54457
- let c$1;
54458
- ctx.p++;
54459
- while (ctx.p < ctx.s.length) {
54460
- skipVoid(ctx);
54461
- if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 125) {
54462
- ctx.p++;
54463
- return res;
54464
- }
54465
- let k;
54466
- let t$4 = res;
54467
- let hasOwn = false;
54468
- let p$1 = ctx.p;
54469
- let key = parseKey(ctx);
54470
- for (let i = 0; i < key.length; i++) {
54471
- if (i) t$4 = hasOwn ? t$4[k] : t$4[k] = {};
54472
- k = key[i];
54473
- if ((hasOwn = Object.hasOwn(t$4, k)) && (typeof t$4[k] !== "object" || seen.has(t$4[k]))) throw new TomlError("trying to redefine an already defined value", {
54474
- toml: ctx.s,
54475
- ptr: p$1
54476
- });
54477
- if (!hasOwn && k === "__proto__") Object.defineProperty(t$4, k, {
54478
- enumerable: true,
54479
- configurable: true,
54480
- writable: true
54481
- });
54482
- }
54483
- if (hasOwn) throw new TomlError("trying to redefine an already defined value", {
54484
- toml: ctx.s,
54485
- ptr: ctx.p
54486
- });
54487
- let value = extractValue(ctx, 125, integersAsBigInt);
54488
- seen.add(t$4[k] = value);
54489
- skipVoid(ctx);
54490
- if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 125) return res;
54491
- if (c$1 !== 44) throw new TomlError("expected comma or end of structure", {
54492
- toml: ctx.s,
54493
- ptr: ctx.p - 1
54494
- });
54495
- }
54496
- throw new TomlError("unfinished table encountered", {
54497
- toml: ctx.s,
54498
- ptr: ctx.p
54499
- });
54500
- }
54501
- __name$2(parseInlineTable, "parseInlineTable");
54502
- function parseArray(ctx, integersAsBigInt) {
54503
- let res = [];
54504
- let c$1;
54505
- ctx.p++;
54506
- while (ctx.p < ctx.s.length) {
54507
- skipVoid(ctx);
54508
- if ((c$1 = ctx.s.charCodeAt(ctx.p)) === 93) {
54509
- ctx.p++;
54510
- return res;
54511
- }
54512
- res.push(extractValue(ctx, 93, integersAsBigInt));
54513
- skipVoid(ctx);
54514
- if ((c$1 = ctx.s.charCodeAt(ctx.p++)) === 93) return res;
54515
- if (c$1 !== 44) throw new TomlError("expected comma or end of structure", {
54516
- toml: ctx.s,
54517
- ptr: ctx.p - 1
54518
- });
54519
- }
54520
- throw new TomlError("unfinished array encountered", {
54521
- toml: ctx.s,
54522
- ptr: ctx.p
54523
- });
54524
- }
54525
- __name$2(parseArray, "parseArray");
54526
- function peekTable(key, table, meta$1, type) {
54527
- let t$4 = table;
54528
- let m = meta$1;
54529
- let k;
54530
- let hasOwn = false;
54531
- let state;
54532
- for (let i = 0; i < key.length; i++) {
54533
- if (i) {
54534
- t$4 = hasOwn ? t$4[k] : t$4[k] = {};
54535
- m = (state = m[k]).c;
54536
- if (type === 0 && (state.t === 1 || state.t === 2)) return null;
54537
- if (state.t === 2) {
54538
- let l = t$4.length - 1;
54539
- t$4 = t$4[l];
54540
- m = m[l].c;
54541
- }
54542
- }
54543
- k = key[i];
54544
- if ((hasOwn = Object.hasOwn(t$4, k)) && m[k]?.t === 0 && m[k]?.d) return null;
54545
- if (!hasOwn) {
54546
- if (k === "__proto__") {
54547
- Object.defineProperty(t$4, k, {
54548
- enumerable: true,
54549
- configurable: true,
54550
- writable: true
54551
- });
54552
- Object.defineProperty(m, k, {
54553
- enumerable: true,
54554
- configurable: true,
54555
- writable: true
54556
- });
54557
- }
54558
- m[k] = {
54559
- t: i < key.length - 1 && type === 2 ? 3 : type,
54560
- d: false,
54561
- i: 0,
54562
- c: {}
54563
- };
54564
- }
54565
- }
54566
- state = m[k];
54567
- if (state.t !== type && !(type === 1 && state.t === 3)) return null;
54568
- if (type === 2) {
54569
- if (!state.d) {
54570
- state.d = true;
54571
- t$4[k] = [];
54572
- }
54573
- t$4[k].push(t$4 = {});
54574
- state.c[state.i++] = state = {
54575
- t: 1,
54576
- d: false,
54577
- i: 0,
54578
- c: {}
54579
- };
54580
- }
54581
- if (state.d) return null;
54582
- state.d = true;
54583
- if (type === 1) t$4 = hasOwn ? t$4[k] : t$4[k] = {};
54584
- else if (type === 0 && hasOwn) return null;
54585
- return [
54586
- k,
54587
- t$4,
54588
- state.c
54589
- ];
54590
- }
54591
- __name$2(peekTable, "peekTable");
54592
- function parse$3(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
54593
- let ctx = {
54594
- s: toml,
54595
- p: 0,
54596
- d: maxDepth
54597
- };
54598
- let res = {};
54599
- let meta$1 = {};
54600
- let tmp;
54601
- let tbl = res;
54602
- let m = meta$1;
54603
- skipVoid(ctx);
54604
- while (ctx.p < toml.length) {
54605
- if (toml.charCodeAt(ctx.p) === 91) {
54606
- let isTableArray = toml.charCodeAt(++ctx.p) === 91;
54607
- tmp = ctx.p += +isTableArray;
54608
- let k = parseKey(ctx, "]");
54609
- if (isTableArray) {
54610
- if (toml.charCodeAt(ctx.p - 1) !== 93) throw new TomlError("expected end of table declaration", {
54611
- toml,
54612
- ptr: ctx.p - 1
54613
- });
54614
- ctx.p++;
54615
- }
54616
- let p$1 = peekTable(k, res, meta$1, isTableArray ? 2 : 1);
54617
- if (!p$1) throw new TomlError("trying to redefine an already defined table or value", {
54618
- toml,
54619
- ptr: tmp
54620
- });
54621
- m = p$1[2];
54622
- tbl = p$1[1];
54623
- } else {
54624
- tmp = ctx.p;
54625
- let p$1 = peekTable(parseKey(ctx), tbl, m, 0);
54626
- if (!p$1) throw new TomlError("trying to redefine an already defined table or value", {
54627
- toml,
54628
- ptr: tmp
54629
- });
54630
- p$1[1][p$1[0]] = extractValue(ctx, void 0, integersAsBigInt);
54631
- }
54632
- skipVoid(ctx, true);
54633
- 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", {
54634
- toml,
54635
- ptr: ctx.p
54636
- });
54637
- skipVoid(ctx);
54638
- }
54639
- return res;
54640
- }
54641
- __name$2(parse$3, "parse");
54642
54191
  var BARE_KEY = /^[a-z0-9-_]+$/i;
54192
+ var HAS_WELLFORMED = !!"".isWellFormed;
54643
54193
  function extendedTypeOf(obj) {
54644
54194
  let type = typeof obj;
54645
54195
  if (type === "object") {
54646
54196
  if (Array.isArray(obj)) return "array";
54647
- if (typeof obj?.getUTCDate === "function" && obj instanceof Date) return "date";
54648
- 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";
54197
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date) return "date";
54198
+ if (globalThis.Temporal) {
54199
+ if (obj.until) {
54200
+ if (obj instanceof Temporal.ZonedDateTime) return "temporal/tz+uc";
54201
+ if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate) return "temporal/uc";
54202
+ if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant) return "temporal";
54203
+ if (obj instanceof Temporal.PlainYearMonth) return "temporal/x";
54204
+ } else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) return "temporal/x";
54205
+ }
54649
54206
  }
54650
54207
  return type;
54651
54208
  }
@@ -54655,18 +54212,21 @@ function isArrayOfTables(obj) {
54655
54212
  return obj.length != 0;
54656
54213
  }
54657
54214
  __name$2(isArrayOfTables, "isArrayOfTables");
54215
+ function formatWellFormedStringUnchecked(s) {
54216
+ return JSON.stringify(s).replaceAll("", "\\u007f");
54217
+ }
54218
+ __name$2(formatWellFormedStringUnchecked, "formatWellFormedStringUnchecked");
54658
54219
  function formatString(s) {
54659
- return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
54220
+ return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
54660
54221
  }
54661
54222
  __name$2(formatString, "formatString");
54662
- function stringifyTemporal(temporal) {
54663
- return temporal.toString({
54664
- calendarName: "never",
54665
- timeZoneName: "never"
54666
- });
54223
+ function formatKey(s) {
54224
+ if (BARE_KEY.test(s)) return s;
54225
+ if (HAS_WELLFORMED && !s.isWellFormed()) throw new RangeError("key contains illegal lone surrogates");
54226
+ return formatWellFormedStringUnchecked(s);
54667
54227
  }
54668
- __name$2(stringifyTemporal, "stringifyTemporal");
54669
- function stringifyValue(val, type, depth, numberAsFloat) {
54228
+ __name$2(formatKey, "formatKey");
54229
+ function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
54670
54230
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
54671
54231
  switch (type) {
54672
54232
  case "number":
@@ -54675,54 +54235,64 @@ function stringifyValue(val, type, depth, numberAsFloat) {
54675
54235
  if (val === -Infinity) return "-inf";
54676
54236
  if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val))) return val.toFixed(1);
54677
54237
  case "bigint":
54678
- case "boolean": return val.toString();
54238
+ case "boolean":
54239
+ case "temporal": return val.toString();
54679
54240
  case "string": return formatString(val);
54680
54241
  case "date":
54681
54242
  if (isNaN(val.getTime())) throw new TypeError("cannot serialize invalid date");
54682
54243
  return val.toISOString();
54683
- case "object": return stringifyInlineTable(val, depth, numberAsFloat);
54684
- case "array": return stringifyArray(val, depth, numberAsFloat);
54685
- case "temporal": return stringifyTemporal(val);
54244
+ case "object": return stringifyInlineTable(val, depth, numberAsFloat, strictTemporal);
54245
+ case "array": return stringifyArray(val, depth, numberAsFloat, strictTemporal);
54246
+ case "temporal/tz+uc": if (strictTemporal) {
54247
+ let tz = val.timeZoneId;
54248
+ let tzc = tz.charCodeAt(0);
54249
+ if (tzc !== 43 && tzc !== 45 && (tzc !== 85 && tzc !== 71 && tzc !== 90 && tzc !== 69 || tz !== "UTC" && tz !== "UCT" && tz !== "Universal" && tz !== "Zulu" && !tz.startsWith("GMT") && tz !== "Greenwich" && !tz.startsWith("Etc/"))) throw new TypeError("Temporal objects with an IANA timezone are not allowed in Temporal strict mode");
54250
+ }
54251
+ case "temporal/uc":
54252
+ if (strictTemporal && val.calendarId !== "iso8601") throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
54253
+ return val.toString({
54254
+ calendarName: "never",
54255
+ timeZoneName: "never"
54256
+ });
54257
+ case "temporal/x": throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
54686
54258
  }
54687
54259
  }
54688
54260
  __name$2(stringifyValue, "stringifyValue");
54689
- function stringifyInlineTable(obj, depth, numberAsFloat) {
54261
+ function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
54690
54262
  let keys = Object.keys(obj);
54691
54263
  if (keys.length === 0) return "{}";
54692
54264
  let res = "{ ";
54693
54265
  for (let i = 0; i < keys.length; i++) {
54694
54266
  let k = keys[i];
54695
54267
  if (i) res += ", ";
54696
- res += BARE_KEY.test(k) ? k : formatString(k);
54697
- res += " = ";
54698
- res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
54268
+ res += formatKey(k) + " = " + stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat, strictTemporal);
54699
54269
  }
54700
54270
  return res + " }";
54701
54271
  }
54702
54272
  __name$2(stringifyInlineTable, "stringifyInlineTable");
54703
- function stringifyArray(array$1, depth, numberAsFloat) {
54273
+ function stringifyArray(array$1, depth, numberAsFloat, strictTemporal) {
54704
54274
  if (array$1.length === 0) return "[]";
54705
54275
  let res = "[ ";
54706
54276
  for (let i = 0; i < array$1.length; i++) {
54707
54277
  if (i) res += ", ";
54708
54278
  if (array$1[i] === null || array$1[i] === void 0) throw new TypeError("arrays cannot contain null or undefined values");
54709
- res += stringifyValue(array$1[i], extendedTypeOf(array$1[i]), depth - 1, numberAsFloat);
54279
+ res += stringifyValue(array$1[i], extendedTypeOf(array$1[i]), depth - 1, numberAsFloat, strictTemporal);
54710
54280
  }
54711
54281
  return res + " ]";
54712
54282
  }
54713
54283
  __name$2(stringifyArray, "stringifyArray");
54714
- function stringifyArrayTable(array$1, key, depth, numberAsFloat) {
54284
+ function stringifyArrayTable(array$1, key, depth, numberAsFloat, strictTemporal) {
54715
54285
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
54716
54286
  let res = "";
54717
54287
  for (let i = 0; i < array$1.length; i++) {
54718
54288
  res += `${res && "\n"}[[${key}]]
54719
54289
  `;
54720
- res += stringifyTable(0, array$1[i], key, depth, numberAsFloat);
54290
+ res += stringifyTable(0, array$1[i], key, depth, numberAsFloat, strictTemporal);
54721
54291
  }
54722
54292
  return res;
54723
54293
  }
54724
54294
  __name$2(stringifyArrayTable, "stringifyArrayTable");
54725
- function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
54295
+ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
54726
54296
  if (depth === 0) throw new Error("Could not stringify the object: maximum object depth exceeded");
54727
54297
  let preamble = "";
54728
54298
  let tables = "";
@@ -54732,15 +54302,15 @@ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
54732
54302
  if (obj[k] !== null && obj[k] !== void 0) {
54733
54303
  let type = extendedTypeOf(obj[k]);
54734
54304
  if (type === "symbol" || type === "function") throw new TypeError(`cannot serialize values of type '${type}'`);
54735
- let key = BARE_KEY.test(k) ? k : formatString(k);
54736
- if (type === "array" && isArrayOfTables(obj[k])) tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
54305
+ let key = formatKey(k);
54306
+ if (type === "array" && isArrayOfTables(obj[k])) tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
54737
54307
  else if (type === "object") {
54738
54308
  let tblKey = prefix ? `${prefix}.${key}` : key;
54739
- tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
54309
+ tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat, strictTemporal);
54740
54310
  } else {
54741
54311
  preamble += key;
54742
54312
  preamble += " = ";
54743
- preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
54313
+ preamble += stringifyValue(obj[k], type, depth, numberAsFloat, strictTemporal);
54744
54314
  preamble += "\n";
54745
54315
  }
54746
54316
  }
@@ -54751,23 +54321,17 @@ ${preamble}` : `[${tableKey}]`;
54751
54321
  ${tables}` : preamble || tables;
54752
54322
  }
54753
54323
  __name$2(stringifyTable, "stringifyTable");
54754
- function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
54324
+ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
54755
54325
  if (extendedTypeOf(obj) !== "object") throw new TypeError("stringify can only be called with an object");
54756
- let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
54326
+ let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
54757
54327
  if (str[str.length - 1] !== "\n") return str + "\n";
54758
54328
  return str;
54759
54329
  }
54760
54330
  __name$2(stringify, "stringify");
54761
- var dist_default = {
54762
- parse: parse$3,
54763
- stringify,
54764
- TomlDate,
54765
- TomlError
54766
- };
54767
54331
  var FILE_FORMATS = {
54768
54332
  toml: {
54769
54333
  parse: /* @__PURE__ */ __name$2((raw) => parseTOML(raw), "parse"),
54770
- stringify: /* @__PURE__ */ __name$2((value) => dist_default.stringify(value), "stringify")
54334
+ stringify: /* @__PURE__ */ __name$2((value) => stringify(value), "stringify")
54771
54335
  },
54772
54336
  json: {
54773
54337
  parse: /* @__PURE__ */ __name$2((raw) => JSON.parse(raw), "parse"),
@@ -55512,7 +55076,7 @@ function scrubEncryptedCredentials(options) {
55512
55076
  __name$2(scrubEncryptedCredentials, "scrubEncryptedCredentials");
55513
55077
 
55514
55078
  //#endregion
55515
- //#region ../workers-auth/dist/chunk-3U6VZT7T.mjs
55079
+ //#region ../workers-auth/dist/chunk-V6MEAFHI.mjs
55516
55080
  function createPreferences(getConfigPath) {
55517
55081
  function getUserPreferencesPath() {
55518
55082
  return path.resolve(getConfigPath(), "preferences.json");
@@ -61608,7 +61172,7 @@ __name$1(createWorkerUploadForm, "createWorkerUploadForm");
61608
61172
  //#endregion
61609
61173
  //#region ../remote-bindings/dist/index.mjs
61610
61174
  var import_undici = require_undici();
61611
- var version = "0.0.33";
61175
+ var version = "0.0.34";
61612
61176
  var NoDefaultValueProvided = class extends UserError$1 {
61613
61177
  constructor() {
61614
61178
  super("This command cannot be run in a non-interactive context", { telemetryMessage: "remote bindings prompt default missing" });
@@ -62932,6 +62496,18 @@ const WorkerEntrypointExportSchema = z$1.strictObject({
62932
62496
  type: z$1.literal("worker"),
62933
62497
  cache: z$1.strictObject({ enabled: z$1.boolean() }).optional()
62934
62498
  });
62499
+ const WorkflowRetentionSchema = z$1.union([z$1.number().int().min(1), z$1.string().min(1)]);
62500
+ const WorkflowExportSchema = z$1.strictObject({
62501
+ type: z$1.literal("workflow"),
62502
+ name: z$1.string(),
62503
+ limits: z$1.strictObject({ steps: z$1.number().int().min(1).optional() }).optional(),
62504
+ concurrency: z$1.strictObject({ limit: z$1.number().int().min(1).optional() }).optional(),
62505
+ schedules: z$1.union([z$1.string().min(1), z$1.array(z$1.string().min(1)).min(1)]).optional(),
62506
+ default_retention: z$1.strictObject({
62507
+ success_retention: WorkflowRetentionSchema.optional(),
62508
+ error_retention: WorkflowRetentionSchema.optional()
62509
+ }).optional()
62510
+ });
62935
62511
  const DurableObjectCreatedSqliteExportSchema = DurableObjectCreatedExportSchema.extend({ storage: z$1.literal("sqlite") });
62936
62512
  const DurableObjectCreatedLegacyKvExportSchema = DurableObjectCreatedExportSchema.omit({ container: true }).extend({ storage: z$1.literal("legacy-kv") });
62937
62513
  const DurableObjectExpectingTransferSqliteExportSchema = DurableObjectExpectingTransferExportSchema.extend({ storage: z$1.literal("sqlite") });
@@ -62944,7 +62520,8 @@ const ExportSchema = z$1.union([
62944
62520
  DurableObjectTransferredExportSchema,
62945
62521
  DurableObjectExpectingTransferSqliteExportSchema,
62946
62522
  DurableObjectExpectingTransferLegacyKvExportSchema,
62947
- WorkerEntrypointExportSchema
62523
+ WorkerEntrypointExportSchema,
62524
+ WorkflowExportSchema
62948
62525
  ]);
62949
62526
  const LimitsSchema = z$1.strictObject({
62950
62527
  cpuMs: z$1.number().optional(),
@@ -63016,12 +62593,19 @@ const TriggerSchema = z$1.discriminatedUnion("type", [
63016
62593
  type: z$1.literal("scheduled"),
63017
62594
  schedule: z$1.string()
63018
62595
  }),
63019
- z$1.strictObject({
62596
+ z$1.discriminatedUnion("protocol", [z$1.strictObject({
63020
62597
  type: z$1.literal("connect"),
63021
- protocol: z$1.enum(["tcp"]),
62598
+ protocol: z$1.literal("tcp"),
63022
62599
  port: z$1.number(),
63023
62600
  address: z$1.string().optional()
63024
- })
62601
+ }), z$1.strictObject({
62602
+ type: z$1.literal("connect"),
62603
+ protocol: z$1.literal("udp"),
62604
+ port: z$1.number(),
62605
+ address: z$1.string().optional(),
62606
+ idleTimeoutMs: z$1.number().int().min(0).max(4294967295).optional(),
62607
+ maxPendingBytes: z$1.number().int().min(0).max(4294967295).optional()
62608
+ })])
63025
62609
  ]);
63026
62610
  const UnsafeSchema = z$1.strictObject({
63027
62611
  metadata: z$1.record(z$1.string(), z$1.unknown()).optional(),
@@ -63696,7 +63280,7 @@ function convertExports(config$1, result) {
63696
63280
  const converted = {};
63697
63281
  const unknownExports = {};
63698
63282
  for (const [exportName, value] of Object.entries(exports$2)) {
63699
- if (value.type === "worker") {
63283
+ if (value.type === "worker" || value.type === "workflow") {
63700
63284
  converted[exportName] = value;
63701
63285
  continue;
63702
63286
  }
@@ -63790,7 +63374,11 @@ function convertTriggers(config$1, result) {
63790
63374
  connectHandlers.push(omitUndefined({
63791
63375
  protocol: trigger.protocol,
63792
63376
  port: trigger.port,
63793
- address: trigger.address
63377
+ address: trigger.address,
63378
+ ...trigger.protocol === "udp" ? {
63379
+ idle_timeout_ms: trigger.idleTimeoutMs,
63380
+ max_pending_bytes: trigger.maxPendingBytes
63381
+ } : {}
63794
63382
  }));
63795
63383
  break;
63796
63384
  }
@@ -64707,7 +64295,7 @@ function structuredSerializableStringify(value) {
64707
64295
  return stringify$1(value, structuredSerializableReducers);
64708
64296
  }
64709
64297
  function structuredSerializableParse(value) {
64710
- return parse$5(value, structuredSerializableRevivers);
64298
+ return parse$4(value, structuredSerializableRevivers);
64711
64299
  }
64712
64300
  const log = new Log(LogLevel.INFO, { prefix: "vpw" });
64713
64301
  const debug = util.debuglog("vitest-plugin");