agentschat-mcp 0.36.13 → 0.36.14

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.
@@ -26,6 +26,126 @@ function validateIdentityProfile(profile, file, allowDevToken = false) {
26
26
  }
27
27
  }
28
28
 
29
+ // node_modules/smol-toml/dist/date.js
30
+ /*!
31
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
32
+ * SPDX-License-Identifier: BSD-3-Clause
33
+ *
34
+ * Redistribution and use in source and binary forms, with or without
35
+ * modification, are permitted provided that the following conditions are met:
36
+ *
37
+ * 1. Redistributions of source code must retain the above copyright notice, this
38
+ * list of conditions and the following disclaimer.
39
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
40
+ * this list of conditions and the following disclaimer in the
41
+ * documentation and/or other materials provided with the distribution.
42
+ * 3. Neither the name of the copyright holder nor the names of its contributors
43
+ * may be used to endorse or promote products derived from this software without
44
+ * specific prior written permission.
45
+ *
46
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
47
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
48
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
49
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
50
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
52
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
53
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
55
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
+ */
57
+ var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
58
+
59
+ class TomlDate extends Date {
60
+ #hasDate = false;
61
+ #hasTime = false;
62
+ #offset = null;
63
+ constructor(date) {
64
+ let hasDate = true;
65
+ let hasTime = true;
66
+ let offset = "Z";
67
+ if (typeof date === "string") {
68
+ let match = date.match(DATE_TIME_RE);
69
+ if (match) {
70
+ if (!match[1]) {
71
+ hasDate = false;
72
+ date = `0000-01-01T${date}`;
73
+ }
74
+ hasTime = !!match[2];
75
+ hasTime && date[10] === " " && (date = date.replace(" ", "T"));
76
+ if (match[2] && +match[2] > 23) {
77
+ date = "";
78
+ } else {
79
+ offset = match[3] || null;
80
+ date = date.toUpperCase();
81
+ if (!offset && hasTime)
82
+ date += "Z";
83
+ }
84
+ } else {
85
+ date = "";
86
+ }
87
+ }
88
+ super(date);
89
+ if (!isNaN(this.getTime())) {
90
+ this.#hasDate = hasDate;
91
+ this.#hasTime = hasTime;
92
+ this.#offset = offset;
93
+ }
94
+ }
95
+ isDateTime() {
96
+ return this.#hasDate && this.#hasTime;
97
+ }
98
+ isLocal() {
99
+ return !this.#hasDate || !this.#hasTime || !this.#offset;
100
+ }
101
+ isDate() {
102
+ return this.#hasDate && !this.#hasTime;
103
+ }
104
+ isTime() {
105
+ return this.#hasTime && !this.#hasDate;
106
+ }
107
+ isValid() {
108
+ return this.#hasDate || this.#hasTime;
109
+ }
110
+ toISOString() {
111
+ let iso = super.toISOString();
112
+ if (this.isDate())
113
+ return iso.slice(0, 10);
114
+ if (this.isTime())
115
+ return iso.slice(11, 23);
116
+ if (this.#offset === null)
117
+ return iso.slice(0, -1);
118
+ if (this.#offset === "Z")
119
+ return iso;
120
+ let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
121
+ offset = this.#offset[0] === "-" ? offset : -offset;
122
+ let offsetDate = new Date(this.getTime() - offset * 60000);
123
+ return offsetDate.toISOString().slice(0, -1) + this.#offset;
124
+ }
125
+ static wrapAsOffsetDateTime(jsDate, offset = "Z") {
126
+ let date = new TomlDate(jsDate);
127
+ date.#offset = offset;
128
+ return date;
129
+ }
130
+ static wrapAsLocalDateTime(jsDate) {
131
+ let date = new TomlDate(jsDate);
132
+ date.#offset = null;
133
+ return date;
134
+ }
135
+ static wrapAsLocalDate(jsDate) {
136
+ let date = new TomlDate(jsDate);
137
+ date.#hasTime = false;
138
+ date.#offset = null;
139
+ return date;
140
+ }
141
+ static wrapAsLocalTime(jsDate) {
142
+ let date = new TomlDate(jsDate);
143
+ date.#hasDate = false;
144
+ date.#offset = null;
145
+ return date;
146
+ }
147
+ }
148
+
29
149
  // node_modules/smol-toml/dist/error.js
30
150
  /*!
31
151
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -55,11 +175,11 @@ function validateIdentityProfile(profile, file, allowDevToken = false) {
55
175
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
176
  */
57
177
  function getLineColFromPtr(string, ptr) {
58
- let lines = string.slice(0, ptr).split(/\r?\n/);
178
+ let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
59
179
  return [lines.length, lines.pop().length + 1];
60
180
  }
61
181
  function makeCodeBlock(string, line, column) {
62
- let lines = string.split(/\r?\n/);
182
+ let lines = string.split(/\r\n|\n|\r/g);
63
183
  let codeblock = "";
64
184
  let numberLen = (Math.log10(line + 1) | 0) + 1;
65
185
  for (let i = line - 1;i <= line + 1; i++) {
@@ -94,10 +214,90 @@ ${codeblock}`, options);
94
214
  this.column = column;
95
215
  this.codeblock = codeblock;
96
216
  }
97
- static x(message, ctx, ptr) {
98
- throw new TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
217
+ }
218
+
219
+ // node_modules/smol-toml/dist/util.js
220
+ /*!
221
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
222
+ * SPDX-License-Identifier: BSD-3-Clause
223
+ *
224
+ * Redistribution and use in source and binary forms, with or without
225
+ * modification, are permitted provided that the following conditions are met:
226
+ *
227
+ * 1. Redistributions of source code must retain the above copyright notice, this
228
+ * list of conditions and the following disclaimer.
229
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
230
+ * this list of conditions and the following disclaimer in the
231
+ * documentation and/or other materials provided with the distribution.
232
+ * 3. Neither the name of the copyright holder nor the names of its contributors
233
+ * may be used to endorse or promote products derived from this software without
234
+ * specific prior written permission.
235
+ *
236
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
237
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
238
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
239
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
240
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
241
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
242
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
243
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
244
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
245
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
246
+ */
247
+ function indexOfNewline(str, start = 0) {
248
+ let idx = str.indexOf(`
249
+ `, start);
250
+ if (str.charCodeAt(idx - 1) === 13)
251
+ idx--;
252
+ return idx;
253
+ }
254
+ function skipComment(ctx) {
255
+ for (;ctx.p < ctx.s.length; ctx.p++) {
256
+ let c = ctx.s.charCodeAt(ctx.p);
257
+ if (c === 10)
258
+ break;
259
+ if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
260
+ ctx.p++;
261
+ break;
262
+ }
263
+ if (c < 32 && c !== 9 || c === 127) {
264
+ throw new TomlError("control characters are not allowed in comments", {
265
+ toml: ctx.s,
266
+ ptr: ctx.p
267
+ });
268
+ }
269
+ }
270
+ }
271
+ function skipVoid(ctx, banNewLines, banComments) {
272
+ let c;
273
+ while (true) {
274
+ while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
275
+ ctx.p++;
276
+ if (banComments || c !== 35)
277
+ break;
278
+ skipComment(ctx);
99
279
  }
100
280
  }
281
+ function skipUntil(ctx, sep, end) {
282
+ let ptr = ctx.p;
283
+ if (!end) {
284
+ ptr = indexOfNewline(ctx.s, ptr);
285
+ ctx.p = ptr < 0 ? ctx.s.length : ptr;
286
+ return;
287
+ }
288
+ for (;ctx.p < ctx.s.length; ctx.p++) {
289
+ let c = ctx.s.charCodeAt(ctx.p);
290
+ if (c === 35) {
291
+ skipComment(ctx);
292
+ } else if (c === end || c === sep) {
293
+ return;
294
+ }
295
+ }
296
+ throw new TomlError("cannot find end of structure", {
297
+ toml: ctx.s,
298
+ ptr
299
+ });
300
+ }
101
301
 
102
302
  // node_modules/smol-toml/dist/primitive.js
103
303
  /*!
@@ -127,8 +327,11 @@ ${codeblock}`, options);
127
327
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
128
328
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
129
329
  */
330
+ var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
331
+ var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
332
+ var LEADING_ZERO = /^[+-]?0[0-9_]/;
130
333
  function parseString(ctx) {
131
- let startPtr = ctx.p;
334
+ let start = ctx.p;
132
335
  let c = ctx.s.charCodeAt(ctx.p++);
133
336
  let first = c;
134
337
  let isLiteral = c === 39;
@@ -147,7 +350,10 @@ function parseString(ctx) {
147
350
  if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
148
351
  state = state && 3;
149
352
  } else if (c < 32 && c !== 9 || c === 127) {
150
- TomlError.x("control characters are not allowed in strings", ctx);
353
+ throw new TomlError("control characters are not allowed in strings", {
354
+ toml: ctx.s,
355
+ ptr: ctx.p
356
+ });
151
357
  } else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
152
358
  if (isMultiline) {
153
359
  if (ctx.s.charCodeAt(ctx.p + 3) === first)
@@ -155,10 +361,8 @@ function parseString(ctx) {
155
361
  if (ctx.s.charCodeAt(ctx.p + 3) === first)
156
362
  ctx.p++;
157
363
  }
158
- if (!state) {
159
- let s = ctx.s.slice(sliceStart, ctx.p);
160
- parsed = parsed ? parsed + s : s;
161
- }
364
+ if (!state)
365
+ parsed += ctx.s.slice(sliceStart, ctx.p);
162
366
  ctx.p += isMultiline ? 3 : 1;
163
367
  return parsed;
164
368
  } else if (!state) {
@@ -168,23 +372,22 @@ function parseString(ctx) {
168
372
  }
169
373
  } else if (state === 1) {
170
374
  if (c === 120 || c === 117 || c === 85) {
171
- let errPtr = ctx.p++ - 1;
172
375
  let value = 0;
173
376
  let len = c === 120 ? 2 : c === 117 ? 4 : 8;
174
377
  for (let j = 0;j < len; j++, ctx.p++) {
175
- let hex = ctx.s.charCodeAt(ctx.p);
378
+ let hex = ctx.s.charCodeAt(ctx.p + 1);
176
379
  let digit = hex >= 48 && hex <= 57 ? hex - 48 : hex >= 65 && hex <= 70 ? hex - 65 + 10 : hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1;
177
380
  if (digit < 0)
178
- TomlError.x("invalid non-hex character in unicode escape", ctx);
381
+ throw new TomlError("invalid non-hex character in unicode escape", { toml: ctx.s, ptr: ctx.p + 1 });
179
382
  value = value << 4 | digit;
180
383
  }
181
384
  if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
182
- TomlError.x("invalid unicode escape", ctx, errPtr);
385
+ throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
183
386
  }
184
387
  parsed += String.fromCodePoint(value);
185
- sliceStart = ctx.p--;
388
+ sliceStart = ctx.p + 1;
186
389
  state = 0;
187
- } else if (isMultiline && (c === 32 || c === 9)) {
390
+ } else if (c === 32 || c === 9) {
188
391
  state = 2;
189
392
  } else {
190
393
  if (c === 98)
@@ -205,161 +408,70 @@ function parseString(ctx) {
205
408
  else if (c === 92)
206
409
  parsed += "\\";
207
410
  else
208
- TomlError.x("unrecognised escape sequence", ctx);
411
+ throw new TomlError("unrecognized escape sequence", { toml: ctx.s, ptr: ctx.p });
209
412
  sliceStart = ctx.p + 1;
210
413
  state = 0;
211
414
  }
212
415
  } else if (c !== 32 && c !== 9) {
213
- if (state === 2)
214
- TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
416
+ if (state === 2) {
417
+ throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
418
+ toml: ctx.s,
419
+ ptr: sliceStart
420
+ });
421
+ }
215
422
  state = !isLiteral && c === 92 ? 1 : 0;
216
423
  sliceStart = ctx.p;
217
424
  }
218
425
  }
219
- TomlError.x("unfinished string", ctx, startPtr);
426
+ throw new TomlError("unfinished string", { toml: ctx.s, ptr: start });
220
427
  }
221
-
222
- // node_modules/smol-toml/dist/date.js
223
- /*!
224
- * Copyright (c) Squirrel Chat et al., All rights reserved.
225
- * SPDX-License-Identifier: BSD-3-Clause
226
- *
227
- * Redistribution and use in source and binary forms, with or without
228
- * modification, are permitted provided that the following conditions are met:
229
- *
230
- * 1. Redistributions of source code must retain the above copyright notice, this
231
- * list of conditions and the following disclaimer.
232
- * 2. Redistributions in binary form must reproduce the above copyright notice,
233
- * this list of conditions and the following disclaimer in the
234
- * documentation and/or other materials provided with the distribution.
235
- * 3. Neither the name of the copyright holder nor the names of its contributors
236
- * may be used to endorse or promote products derived from this software without
237
- * specific prior written permission.
238
- *
239
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
240
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
241
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
242
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
243
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
244
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
245
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
246
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
247
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
248
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
249
- */
250
- 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;
251
-
252
- class TomlDate extends Date {
253
- #hasDate = false;
254
- #hasTime = false;
255
- #offset = null;
256
- constructor(date, fasttype, unsafeDelim) {
257
- let hasDate = true;
258
- let hasTime = true;
259
- let offset = "Z";
260
- let c;
261
- if (typeof date === "string") {
262
- if (fasttype)
263
- prep: {
264
- if (fasttype < 3) {
265
- if (+date.slice(11, 13) > 23) {
266
- date = "";
267
- break prep;
268
- }
269
- if (fasttype === 2) {
270
- offset = null;
271
- date += "Z";
272
- } else if ((c = date.charCodeAt(date.length - 1)) !== 90 && c !== 122) {
273
- offset = date.slice(date.length - 6);
274
- }
275
- if (unsafeDelim)
276
- date = date.slice(0, 10) + "T" + date.slice(11);
277
- } else if (fasttype === 4) {
278
- date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
279
- }
280
- hasDate = fasttype !== 4;
281
- hasTime = fasttype !== 3;
282
- }
283
- else {
284
- let match = date.match(DATE_TIME_RE);
285
- if (match) {
286
- if (!match[1]) {
287
- hasDate = false;
288
- date = `0000-01-01T${date}`;
289
- }
290
- hasTime = !!match[2];
291
- hasTime && date[10] === " " && (date = date.replace(" ", "T"));
292
- if (match[2] && +match[2] > 23) {
293
- date = "";
294
- } else {
295
- offset = match[3] || null;
296
- if (!offset && hasTime)
297
- date += "Z";
298
- }
299
- } else {
300
- date = "";
301
- }
302
- }
428
+ function sliceAndTrimEndOf(ctx, start, end) {
429
+ let value = ctx.s.slice(start, end);
430
+ let commentIdx = value.indexOf("#");
431
+ if (commentIdx > 0) {
432
+ skipComment({ s: value, p: commentIdx, d: 0 });
433
+ value = value.slice(0, commentIdx);
434
+ }
435
+ return value.trimEnd();
436
+ }
437
+ function parseValue(ctx, integersAsBigInt, end) {
438
+ let ptr = ctx.p;
439
+ let err = { toml: ctx.s, ptr };
440
+ skipUntil(ctx, 44, end);
441
+ let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
442
+ if (!value)
443
+ throw new TomlError("incomplete declaration: value expected", err);
444
+ if (value === "-inf")
445
+ return -Infinity;
446
+ if (value === "inf" || value === "+inf")
447
+ return Infinity;
448
+ if (value === "nan" || value === "+nan" || value === "-nan")
449
+ return NaN;
450
+ if (value === "-0")
451
+ return integersAsBigInt ? 0n : 0;
452
+ let isInt = INT_REGEX.test(value);
453
+ if (isInt || FLOAT_REGEX.test(value)) {
454
+ if (LEADING_ZERO.test(value)) {
455
+ throw new TomlError("leading zeroes are not allowed", err);
303
456
  }
304
- super(date);
305
- if (!isNaN(this.getTime())) {
306
- this.#hasDate = hasDate;
307
- this.#hasTime = hasTime;
308
- this.#offset = offset;
457
+ value = value.replace(/_/g, "");
458
+ let numeric = +value;
459
+ if (isNaN(numeric)) {
460
+ throw new TomlError("invalid number", err);
309
461
  }
462
+ if (isInt) {
463
+ if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
464
+ throw new TomlError("integer value cannot be represented losslessly", err);
465
+ }
466
+ if (isInt || integersAsBigInt === true)
467
+ numeric = BigInt(value);
468
+ }
469
+ return numeric;
310
470
  }
311
- isDateTime() {
312
- return this.#hasDate && this.#hasTime;
313
- }
314
- isLocal() {
315
- return !this.#hasDate || !this.#hasTime || !this.#offset;
316
- }
317
- isDate() {
318
- return this.#hasDate && !this.#hasTime;
319
- }
320
- isTime() {
321
- return this.#hasTime && !this.#hasDate;
322
- }
323
- isValid() {
324
- return this.#hasDate || this.#hasTime;
325
- }
326
- toISOString() {
327
- let iso = super.toISOString();
328
- if (this.isDate())
329
- return iso.slice(0, 10);
330
- if (this.isTime())
331
- return iso.slice(11, 23);
332
- if (this.#offset === null)
333
- return iso.slice(0, -1);
334
- if (this.#offset === "Z" || this.#offset === "z")
335
- return iso;
336
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
337
- offset = this.#offset[0] === "-" ? offset : -offset;
338
- let offsetDate = new Date(this.getTime() - offset * 60000);
339
- return offsetDate.toISOString().slice(0, -1) + this.#offset;
340
- }
341
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
342
- let date = new TomlDate(jsDate);
343
- date.#offset = offset;
344
- return date;
345
- }
346
- static wrapAsLocalDateTime(jsDate) {
347
- let date = new TomlDate(jsDate);
348
- date.#offset = null;
349
- return date;
350
- }
351
- static wrapAsLocalDate(jsDate) {
352
- let date = new TomlDate(jsDate);
353
- date.#hasTime = false;
354
- date.#offset = null;
355
- return date;
356
- }
357
- static wrapAsLocalTime(jsDate) {
358
- let date = new TomlDate(jsDate);
359
- date.#hasDate = false;
360
- date.#offset = null;
361
- return date;
362
- }
471
+ const date = new TomlDate(value);
472
+ if (!date.isValid())
473
+ throw new TomlError("invalid value", err);
474
+ return date;
363
475
  }
364
476
 
365
477
  // node_modules/smol-toml/dist/extract.js
@@ -390,18 +502,17 @@ class TomlDate extends Date {
390
502
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
391
503
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392
504
  */
393
- function isDigit(char, base = 10) {
394
- return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
395
- }
396
- function isEndOfValue(char, delim) {
397
- return char === 32 || char === 9 || char === 10 || char === 13 || delim && (char === delim || char === 44) || char === 35;
398
- }
399
- function extractValue(ctx, end) {
400
- let errPtr = ctx.p;
401
- let c = ctx.s.charCodeAt(ctx.p);
505
+ function extractValue(ctx, end, integersAsBigInt) {
506
+ let ptr = ctx.p;
507
+ let c = ctx.s.charCodeAt(ptr);
402
508
  if (c === 91 || c === 123) {
403
- ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
404
- let value = c === 91 ? parseArray(ctx) : parseInlineTable(ctx);
509
+ if (!ctx.d--) {
510
+ throw new TomlError("document contains excessively nested structures. aborting.", {
511
+ toml: ctx.s,
512
+ ptr
513
+ });
514
+ }
515
+ let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
405
516
  ctx.d++;
406
517
  return value;
407
518
  }
@@ -410,243 +521,17 @@ function extractValue(ctx, end) {
410
521
  }
411
522
  if (c === 116) {
412
523
  if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
413
- TomlError.x("invalid value", ctx, errPtr);
414
- return ctx.p++, true;
524
+ throw new TomlError("invalid value", { toml: ctx.s, ptr });
525
+ ctx.p++;
526
+ return true;
415
527
  }
416
528
  if (c === 102) {
417
529
  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)
418
- TomlError.x("invalid value", ctx, errPtr);
419
- return ctx.p++, false;
420
- }
421
- if (c === 43 || c === 45) {
422
- return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
423
- }
424
- if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
425
- return parseDate(ctx, c, end);
426
- }
427
- if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
428
- return parseTime(ctx, c, end);
429
- }
430
- return parseNumber(ctx, ctx.p, c, 0, end);
431
- }
432
- function parseNumber(ctx, startPtr, startChr, sign, endChr) {
433
- let c = startChr;
434
- let state = 0;
435
- let hasUnderscores = false;
436
- if (c === 105) {
437
- if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
438
- TomlError.x("invalid value", ctx, startPtr);
439
- return ctx.p++, (sign || 1) / 0;
440
- }
441
- if (c === 110) {
442
- if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
443
- TomlError.x("invalid value", ctx, startPtr);
444
- return ctx.p++, NaN;
445
- }
446
- if (c === 48) {
447
- if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
448
- return ctx.bi === true ? 0n : 0;
449
- if (!sign) {
450
- if (c === 120)
451
- return parseIntegerBaseN(ctx, startPtr, 16, endChr);
452
- else if (c === 98)
453
- return parseIntegerBaseN(ctx, startPtr, 2, endChr);
454
- else if (c === 111)
455
- return parseIntegerBaseN(ctx, startPtr, 8, endChr);
456
- }
457
- if (c === 46)
458
- state = 2;
459
- else if (c === 101 || c === 69)
460
- state = 4;
461
- else
462
- TomlError.x("illegal leading zero", ctx, startPtr);
463
- } else if (!isDigit(c))
464
- TomlError.x("invalid value", ctx, startPtr);
465
- while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
466
- if (!state)
467
- state = 1;
468
- if (c === 95) {
469
- if (!(state & 1))
470
- TomlError.x("illegal underscore", ctx);
471
- state += 11;
472
- hasUnderscores = true;
473
- } else if (state === 1 && c === 46)
474
- state = 2;
475
- else if ((state === 1 || state === 3) && (c === 101 || c === 69))
476
- state = 4;
477
- else if (state === 4 && (c === 43 || c === 45)) {
478
- state = 6;
479
- } else if (!isDigit(c))
480
- TomlError.x(`illegal character in numeric literal`, ctx);
481
- else if (state > 9)
482
- state -= 11;
483
- else if (!(state & 1))
484
- state++;
485
- }
486
- if (!state) {
487
- let val = (startChr - 48) * (sign || 1);
488
- return ctx.bi === true ? BigInt(val) : val;
489
- }
490
- if (!(state & 1))
491
- TomlError.x("unfinished numeric value", ctx, startPtr);
492
- let str = ctx.s.slice(startPtr, ctx.p);
493
- if (hasUnderscores)
494
- str = str.replaceAll("_", "");
495
- return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
496
- }
497
- function parseIntegerBaseN(ctx, startPtr, base, endChr) {
498
- let c, underscore = 1;
499
- while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
500
- if (c === 95) {
501
- if (underscore & 1)
502
- TomlError.x("illegal underscore", ctx);
503
- underscore = 3;
504
- } else if (!isDigit(c, base))
505
- TomlError.x(`illegal character in numeric literal`, ctx);
506
- else if (underscore & 1)
507
- underscore--;
508
- }
509
- if (underscore & 1)
510
- TomlError.x("unfinished numeric value", ctx);
511
- let str = ctx.s.slice(startPtr + 2, ctx.p);
512
- if (underscore)
513
- str = str.replaceAll("_", "");
514
- return parseInteger(ctx, str, base, startPtr);
515
- }
516
- function parseInteger(ctx, str, base, startPtr) {
517
- if (ctx.bi !== true)
518
- int: {
519
- let val = parseInt(str, base);
520
- if (!Number.isSafeInteger(val)) {
521
- if (ctx.bi)
522
- break int;
523
- TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
524
- }
525
- return val;
526
- }
527
- return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
528
- }
529
- function parseDate(ctx, c, endChr) {
530
- let startPtr = ctx.p++, unsafeSeparator;
531
- if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
532
- return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
533
- }
534
- ctx.p += 5;
535
- if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
536
- TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
537
- if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
538
- let t = ctx.s.slice(startPtr, ctx.p);
539
- return readDate(ctx, t, 3, false, startPtr);
540
- }
541
- if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
542
- TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
543
- if (ctx.s.charCodeAt(ctx.p += 3) === 58)
544
- ctx.p += 3;
545
- if (ctx.s.charCodeAt(ctx.p) === 46)
546
- while (isDigit(ctx.s.charCodeAt(++ctx.p)))
547
- ;
548
- if (c = ctx.s.charCodeAt(ctx.p)) {
549
- if (c === 90 || c === 122) {
550
- let t = ctx.s.slice(startPtr, ++ctx.p);
551
- return readDate(ctx, t, 1, unsafeSeparator, startPtr, "[+00:00]");
552
- }
553
- if (c === 43 || c === 45) {
554
- let t = ctx.s.slice(startPtr, ctx.p += 6);
555
- return readDate(ctx, t, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
556
- }
557
- }
558
- let t = ctx.s.slice(startPtr, ctx.p);
559
- return readDate(ctx, t, 2, unsafeSeparator, startPtr);
560
- }
561
- function parseTime(ctx, c, endChr) {
562
- let start = ctx.p;
563
- if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
564
- return parseNumber(ctx, --ctx.p, c, 0, endChr);
565
- }
566
- if (ctx.s.charCodeAt(ctx.p += 4) === 58)
567
- ctx.p += 3;
568
- if (ctx.s.charCodeAt(ctx.p) === 46)
569
- while (isDigit(ctx.s.charCodeAt(++ctx.p)))
570
- ;
571
- let t = ctx.s.slice(start, ctx.p);
572
- return readDate(ctx, t, 4, false, start);
573
- }
574
- function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
575
- if (ctx.ld) {
576
- let date = new TomlDate(str, type, unsafeDelim);
577
- if (!date.isValid())
578
- TomlError.x("invalid date", ctx, errPtr);
579
- return date;
580
- }
581
- try {
582
- if (temporalSuffix)
583
- str += temporalSuffix;
584
- switch (type) {
585
- case 1:
586
- return Temporal.ZonedDateTime.from(str);
587
- case 2:
588
- return Temporal.PlainDateTime.from(str);
589
- case 3:
590
- return Temporal.PlainDate.from(str);
591
- case 4:
592
- return Temporal.PlainTime.from(str);
593
- }
594
- } catch (e) {
595
- TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
596
- }
597
- }
598
-
599
- // node_modules/smol-toml/dist/util.js
600
- /*!
601
- * Copyright (c) Squirrel Chat et al., All rights reserved.
602
- * SPDX-License-Identifier: BSD-3-Clause
603
- *
604
- * Redistribution and use in source and binary forms, with or without
605
- * modification, are permitted provided that the following conditions are met:
606
- *
607
- * 1. Redistributions of source code must retain the above copyright notice, this
608
- * list of conditions and the following disclaimer.
609
- * 2. Redistributions in binary form must reproduce the above copyright notice,
610
- * this list of conditions and the following disclaimer in the
611
- * documentation and/or other materials provided with the distribution.
612
- * 3. Neither the name of the copyright holder nor the names of its contributors
613
- * may be used to endorse or promote products derived from this software without
614
- * specific prior written permission.
615
- *
616
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
617
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
618
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
619
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
620
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
621
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
622
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
623
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
624
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
625
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
626
- */
627
- function skipComment(ctx) {
628
- for (;ctx.p < ctx.s.length; ctx.p++) {
629
- let c = ctx.s.charCodeAt(ctx.p);
630
- if (c === 10)
631
- break;
632
- if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
633
- ctx.p++;
634
- break;
635
- }
636
- if (c < 32 && c !== 9 || c === 127) {
637
- TomlError.x("control characters are not allowed in comments", ctx);
638
- }
639
- }
640
- }
641
- function skipVoid(ctx, banNewLines, banComments) {
642
- let c;
643
- while (ctx.p < ctx.s.length) {
644
- while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
645
- ctx.p++;
646
- if (banComments || c !== 35)
647
- break;
648
- skipComment(ctx);
530
+ throw new TomlError("invalid value", { toml: ctx.s, ptr });
531
+ ctx.p++;
532
+ return false;
649
533
  }
534
+ return parseValue(ctx, integersAsBigInt, end);
650
535
  }
651
536
 
652
537
  // node_modules/smol-toml/dist/struct.js
@@ -677,50 +562,76 @@ function skipVoid(ctx, banNewLines, banComments) {
677
562
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
678
563
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
679
564
  */
680
- function parseKey(ctx, end = 61) {
681
- let startPtr;
682
- let state = 0;
565
+ var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
566
+ function parseKey(ctx, end = "=") {
567
+ let start = ctx.p;
568
+ let dot = start - 1;
683
569
  let parsed = [];
684
- let sliceStart;
685
- let c = ctx.s.charCodeAt(startPtr = ctx.p);
570
+ let endPtr = ctx.s.indexOf(end, start);
571
+ if (endPtr < 0) {
572
+ throw new TomlError("incomplete key-value: cannot find end of key", {
573
+ toml: ctx.s,
574
+ ptr: start
575
+ });
576
+ }
686
577
  do {
687
- if (c === end) {
688
- if (!state)
689
- TomlError.x("unexpected end of key", ctx);
690
- if (state === 1)
691
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
692
- return ctx.p++, parsed;
693
- } else if (c === 46) {
694
- if (!state)
695
- TomlError.x("illegal empty bare key", ctx);
696
- if (state === 1)
697
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
698
- state = 0;
699
- } else if (!state && (c === 34 || c === 39)) {
700
- if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
701
- TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
702
- parsed.push(parseString(ctx));
703
- state = 2;
704
- ctx.p--;
705
- } else if (c === 32 || c === 9) {
706
- if (state === 1) {
707
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
708
- state = 2;
578
+ let c = ctx.s.charCodeAt(ctx.p = ++dot);
579
+ if (c !== 32 && c !== 9) {
580
+ if (c === 34 || c === 39) {
581
+ if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
582
+ throw new TomlError("multiline strings are not allowed in keys", {
583
+ toml: ctx.s,
584
+ ptr: ctx.p
585
+ });
586
+ }
587
+ let part = parseString(ctx);
588
+ dot = ctx.s.indexOf(".", ctx.p);
589
+ let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
590
+ let newLine = indexOfNewline(strEnd);
591
+ if (newLine > -1) {
592
+ throw new TomlError("newlines are not allowed in keys", {
593
+ toml: ctx.s,
594
+ ptr: newLine
595
+ });
596
+ }
597
+ if (strEnd.trimStart()) {
598
+ throw new TomlError("found extra tokens after the string part", {
599
+ toml: ctx.s,
600
+ ptr: ctx.p
601
+ });
602
+ }
603
+ if (endPtr < ctx.p) {
604
+ endPtr = ctx.s.indexOf(end, ctx.p);
605
+ if (endPtr < 0) {
606
+ throw new TomlError("incomplete key-value: cannot find end of key", {
607
+ toml: ctx.s,
608
+ ptr: start
609
+ });
610
+ }
611
+ }
612
+ parsed.push(part);
613
+ } else {
614
+ dot = ctx.s.indexOf(".", ctx.p);
615
+ let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
616
+ if (!KEY_PART_RE.test(part)) {
617
+ throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
618
+ toml: ctx.s,
619
+ ptr: ctx.p
620
+ });
621
+ }
622
+ parsed.push(part.trimEnd());
709
623
  }
710
- } else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
711
- TomlError.x("illegal character in key", ctx);
712
- } else if (!state) {
713
- state = 1;
714
- sliceStart = ctx.p;
715
624
  }
716
- } while (c = ctx.s.charCodeAt(++ctx.p));
717
- TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
625
+ } while (dot + 1 && dot < endPtr);
626
+ ctx.p = endPtr + 1;
627
+ skipVoid(ctx, true, true);
628
+ return parsed;
718
629
  }
719
- function parseInlineTable(ctx) {
720
- let startPtr = ctx.p++;
721
- let res = Object.create(null);
630
+ function parseInlineTable(ctx, integersAsBigInt) {
631
+ let res = {};
722
632
  let seen = new Set;
723
633
  let c;
634
+ ctx.p++;
724
635
  while (ctx.p < ctx.s.length) {
725
636
  skipVoid(ctx);
726
637
  if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
@@ -730,59 +641,66 @@ function parseInlineTable(ctx) {
730
641
  let k;
731
642
  let t = res;
732
643
  let hasOwn = false;
733
- let errPtr = ctx.p;
644
+ let p = ctx.p;
734
645
  let key = parseKey(ctx);
735
646
  for (let i = 0;i < key.length; i++) {
736
647
  if (i)
737
- t = hasOwn ? t[k] : t[k] = Object.create(null);
648
+ t = hasOwn ? t[k] : t[k] = {};
738
649
  k = key[i];
739
650
  if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
740
- TomlError.x("trying to redefine an already defined value", ctx, errPtr);
741
- }
742
- let unsafe = k === "__proto__";
743
- if (ctx.uk && (unsafe || k === "constructor")) {
744
- t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
745
- break;
651
+ throw new TomlError("trying to redefine an already defined value", {
652
+ toml: ctx.s,
653
+ ptr: p
654
+ });
746
655
  }
747
- if (!hasOwn && unsafe) {
656
+ if (!hasOwn && k === "__proto__") {
748
657
  Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
749
658
  }
750
659
  }
751
660
  if (hasOwn) {
752
- TomlError.x("trying to redefine an already defined value", ctx, errPtr);
661
+ throw new TomlError("trying to redefine an already defined value", {
662
+ toml: ctx.s,
663
+ ptr: ctx.p
664
+ });
753
665
  }
754
- skipVoid(ctx, true, true);
755
- let value = extractValue(ctx, 125);
756
- if (t && typeof (t[k] = value) === "object")
757
- seen.add(value);
666
+ let value = extractValue(ctx, 125, integersAsBigInt);
667
+ seen.add(t[k] = value);
758
668
  skipVoid(ctx);
759
669
  if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
760
670
  return res;
761
671
  }
762
- if (c !== 44)
763
- TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
672
+ if (c !== 44) {
673
+ throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
674
+ }
764
675
  }
765
- TomlError.x("unfinished table", ctx, startPtr);
676
+ throw new TomlError("unfinished table encountered", {
677
+ toml: ctx.s,
678
+ ptr: ctx.p
679
+ });
766
680
  }
767
- function parseArray(ctx) {
768
- let startPtr = ctx.p++;
681
+ function parseArray(ctx, integersAsBigInt) {
769
682
  let res = [];
770
683
  let c;
684
+ ctx.p++;
771
685
  while (ctx.p < ctx.s.length) {
772
686
  skipVoid(ctx);
773
687
  if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
774
688
  ctx.p++;
775
689
  return res;
776
690
  }
777
- res.push(extractValue(ctx, 93));
691
+ res.push(extractValue(ctx, 93, integersAsBigInt));
778
692
  skipVoid(ctx);
779
693
  if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
780
694
  return res;
781
695
  }
782
- if (c !== 44)
783
- TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
696
+ if (c !== 44) {
697
+ throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
698
+ }
784
699
  }
785
- TomlError.x("unfinished array", ctx, startPtr);
700
+ throw new TomlError("unfinished array encountered", {
701
+ toml: ctx.s,
702
+ ptr: ctx.p
703
+ });
786
704
  }
787
705
 
788
706
  // node_modules/smol-toml/dist/parse.js
@@ -813,7 +731,7 @@ function parseArray(ctx) {
813
731
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
814
732
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
815
733
  */
816
- function peekTable(ctx, key, table, meta, type) {
734
+ function peekTable(key, table, meta, type) {
817
735
  let t = table;
818
736
  let m = meta;
819
737
  let k;
@@ -821,7 +739,7 @@ function peekTable(ctx, key, table, meta, type) {
821
739
  let state;
822
740
  for (let i = 0;i < key.length; i++) {
823
741
  if (i) {
824
- t = hasOwn ? t[k] : t[k] = Object.create(null);
742
+ t = hasOwn ? t[k] : t[k] = {};
825
743
  m = (state = m[k]).c;
826
744
  if (type === 0 && (state.t === 1 || state.t === 2)) {
827
745
  return null;
@@ -837,10 +755,7 @@ function peekTable(ctx, key, table, meta, type) {
837
755
  return null;
838
756
  }
839
757
  if (!hasOwn) {
840
- let unsafe = k === "__proto__";
841
- if (ctx.uk && (unsafe || k === "constructor"))
842
- return false;
843
- if (unsafe) {
758
+ if (k === "__proto__") {
844
759
  Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
845
760
  Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
846
761
  }
@@ -848,7 +763,7 @@ function peekTable(ctx, key, table, meta, type) {
848
763
  t: i < key.length - 1 && type === 2 ? 3 : type,
849
764
  d: false,
850
765
  i: 0,
851
- c: Object.create(null)
766
+ c: {}
852
767
  };
853
768
  }
854
769
  }
@@ -861,76 +776,69 @@ function peekTable(ctx, key, table, meta, type) {
861
776
  state.d = true;
862
777
  t[k] = [];
863
778
  }
864
- t[k].push(t = Object.create(null));
865
- state.c[state.i++] = state = { t: 1, d: false, i: 0, c: Object.create(null) };
779
+ t[k].push(t = {});
780
+ state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
866
781
  }
867
782
  if (state.d) {
868
783
  return null;
869
784
  }
870
785
  state.d = true;
871
786
  if (type === 1) {
872
- t = hasOwn ? t[k] : t[k] = Object.create(null);
787
+ t = hasOwn ? t[k] : t[k] = {};
873
788
  } else if (type === 0 && hasOwn) {
874
789
  return null;
875
790
  }
876
791
  return [k, t, state.c];
877
792
  }
878
- function validateTablePeek(ctx, peek, ptr) {
879
- if (peek === null || ctx.uk === 2)
880
- TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
881
- }
882
- function parse(toml, options = {}) {
883
- let ctx = {
884
- s: toml,
885
- p: 0,
886
- d: options.maxDepth ?? 1000,
887
- bi: options.integersAsBigInt ?? false,
888
- ld: options.useLegacyDate ?? true,
889
- uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
890
- };
891
- let res = Object.create(null);
892
- let meta = Object.create(null);
793
+ function parse(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
794
+ let ctx = { s: toml, p: 0, d: maxDepth };
795
+ let res = {};
796
+ let meta = {};
893
797
  let tmp;
894
- let skipping = false;
895
798
  let tbl = res;
896
799
  let m = meta;
897
- if (toml.charCodeAt(0) === 65279)
898
- ctx.p++;
899
800
  skipVoid(ctx);
900
801
  while (ctx.p < toml.length) {
901
802
  if (toml.charCodeAt(ctx.p) === 91) {
902
803
  let isTableArray = toml.charCodeAt(++ctx.p) === 91;
903
804
  tmp = ctx.p += +isTableArray;
904
- skipping = false;
905
- let k = parseKey(ctx, 93);
805
+ let k = parseKey(ctx, "]");
906
806
  if (isTableArray) {
907
- if (toml.charCodeAt(ctx.p) !== 93) {
908
- TomlError.x("expected end of table array declaration", ctx);
807
+ if (toml.charCodeAt(ctx.p - 1) !== 93) {
808
+ throw new TomlError("expected end of table declaration", {
809
+ toml,
810
+ ptr: ctx.p - 1
811
+ });
909
812
  }
910
813
  ctx.p++;
911
814
  }
912
- let p = peekTable(ctx, k, res, meta, isTableArray ? 2 : 1);
815
+ let p = peekTable(k, res, meta, isTableArray ? 2 : 1);
913
816
  if (!p) {
914
- validateTablePeek(ctx, p, tmp);
915
- skipping = true;
916
- } else {
917
- m = p[2];
918
- tbl = p[1];
817
+ throw new TomlError("trying to redefine an already defined table or value", {
818
+ toml,
819
+ ptr: tmp
820
+ });
919
821
  }
822
+ m = p[2];
823
+ tbl = p[1];
920
824
  } else {
921
825
  tmp = ctx.p;
922
826
  let k = parseKey(ctx);
923
- let p = peekTable(ctx, k, tbl, m, 0);
924
- if (!p && !skipping)
925
- validateTablePeek(ctx, p, tmp);
926
- skipVoid(ctx, true, true);
927
- let v = extractValue(ctx, undefined);
928
- if (p && !skipping)
929
- p[1][p[0]] = v;
827
+ let p = peekTable(k, tbl, m, 0);
828
+ if (!p) {
829
+ throw new TomlError("trying to redefine an already defined table or value", {
830
+ toml,
831
+ ptr: tmp
832
+ });
833
+ }
834
+ p[1][p[0]] = extractValue(ctx, undefined, integersAsBigInt);
930
835
  }
931
836
  skipVoid(ctx, true);
932
- if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
933
- TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
837
+ if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
838
+ throw new TomlError("each key-value declaration must be followed by an end-of-line", {
839
+ toml,
840
+ ptr: ctx.p
841
+ });
934
842
  }
935
843
  skipVoid(ctx);
936
844
  }
@@ -965,7 +873,6 @@ function parse(toml, options = {}) {
965
873
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
966
874
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
967
875
  */
968
- var HAS_WELLFORMED = !!"".isWellFormed;
969
876
 
970
877
  // node_modules/smol-toml/dist/index.js
971
878
  /*!
@@ -1310,7 +1217,7 @@ async function tick() {
1310
1217
  try {
1311
1218
  const configs = loadBots(registry);
1312
1219
  for (const [name, worker] of workers) {
1313
- const c = configs.find((c) => c.name === name);
1220
+ const c = configs.find((c2) => c2.name === name);
1314
1221
  if (!c || createHash2("sha256").update(JSON.stringify(c)).digest("hex") !== worker.fingerprint) {
1315
1222
  await stop(worker);
1316
1223
  workers.delete(name);