@cloudflare/workers-auth 0.9.1 → 0.9.3

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.
@@ -2108,684 +2108,29 @@ function getProfileForDirectoryFromBindings(startDir, bindings) {
2108
2108
  }
2109
2109
  __name(getProfileForDirectoryFromBindings, "getProfileForDirectoryFromBindings");
2110
2110
 
2111
- // ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/date.js
2112
- var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
2113
- var TomlDate = class _TomlDate extends Date {
2114
- static {
2115
- __name(this, "TomlDate");
2116
- }
2117
- #hasDate = false;
2118
- #hasTime = false;
2119
- #offset = null;
2120
- constructor(date) {
2121
- let hasDate = true;
2122
- let hasTime = true;
2123
- let offset = "Z";
2124
- if (typeof date === "string") {
2125
- let match = date.match(DATE_TIME_RE);
2126
- if (match) {
2127
- if (!match[1]) {
2128
- hasDate = false;
2129
- date = `0000-01-01T${date}`;
2130
- }
2131
- hasTime = !!match[2];
2132
- hasTime && date[10] === " " && (date = date.replace(" ", "T"));
2133
- if (match[2] && +match[2] > 23) {
2134
- date = "";
2135
- } else {
2136
- offset = match[3] || null;
2137
- date = date.toUpperCase();
2138
- if (!offset && hasTime)
2139
- date += "Z";
2140
- }
2141
- } else {
2142
- date = "";
2143
- }
2144
- }
2145
- super(date);
2146
- if (!isNaN(this.getTime())) {
2147
- this.#hasDate = hasDate;
2148
- this.#hasTime = hasTime;
2149
- this.#offset = offset;
2150
- }
2151
- }
2152
- isDateTime() {
2153
- return this.#hasDate && this.#hasTime;
2154
- }
2155
- isLocal() {
2156
- return !this.#hasDate || !this.#hasTime || !this.#offset;
2157
- }
2158
- isDate() {
2159
- return this.#hasDate && !this.#hasTime;
2160
- }
2161
- isTime() {
2162
- return this.#hasTime && !this.#hasDate;
2163
- }
2164
- isValid() {
2165
- return this.#hasDate || this.#hasTime;
2166
- }
2167
- toISOString() {
2168
- let iso = super.toISOString();
2169
- if (this.isDate())
2170
- return iso.slice(0, 10);
2171
- if (this.isTime())
2172
- return iso.slice(11, 23);
2173
- if (this.#offset === null)
2174
- return iso.slice(0, -1);
2175
- if (this.#offset === "Z")
2176
- return iso;
2177
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
2178
- offset = this.#offset[0] === "-" ? offset : -offset;
2179
- let offsetDate = new Date(this.getTime() - offset * 6e4);
2180
- return offsetDate.toISOString().slice(0, -1) + this.#offset;
2181
- }
2182
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
2183
- let date = new _TomlDate(jsDate);
2184
- date.#offset = offset;
2185
- return date;
2186
- }
2187
- static wrapAsLocalDateTime(jsDate) {
2188
- let date = new _TomlDate(jsDate);
2189
- date.#offset = null;
2190
- return date;
2191
- }
2192
- static wrapAsLocalDate(jsDate) {
2193
- let date = new _TomlDate(jsDate);
2194
- date.#hasTime = false;
2195
- date.#offset = null;
2196
- return date;
2197
- }
2198
- static wrapAsLocalTime(jsDate) {
2199
- let date = new _TomlDate(jsDate);
2200
- date.#hasDate = false;
2201
- date.#offset = null;
2202
- return date;
2203
- }
2204
- };
2205
-
2206
- // ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/error.js
2207
- function getLineColFromPtr(string, ptr) {
2208
- let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
2209
- return [lines.length, lines.pop().length + 1];
2210
- }
2211
- __name(getLineColFromPtr, "getLineColFromPtr");
2212
- function makeCodeBlock(string, line, column) {
2213
- let lines = string.split(/\r\n|\n|\r/g);
2214
- let codeblock = "";
2215
- let numberLen = (Math.log10(line + 1) | 0) + 1;
2216
- for (let i = line - 1; i <= line + 1; i++) {
2217
- let l = lines[i - 1];
2218
- if (!l)
2219
- continue;
2220
- codeblock += i.toString().padEnd(numberLen, " ");
2221
- codeblock += ": ";
2222
- codeblock += l;
2223
- codeblock += "\n";
2224
- if (i === line) {
2225
- codeblock += " ".repeat(numberLen + column + 2);
2226
- codeblock += "^\n";
2227
- }
2228
- }
2229
- return codeblock;
2230
- }
2231
- __name(makeCodeBlock, "makeCodeBlock");
2232
- var TomlError = class extends Error {
2233
- static {
2234
- __name(this, "TomlError");
2235
- }
2236
- line;
2237
- column;
2238
- codeblock;
2239
- constructor(message, options) {
2240
- const [line, column] = getLineColFromPtr(options.toml, options.ptr);
2241
- const codeblock = makeCodeBlock(options.toml, line, column);
2242
- super(`Invalid TOML document: ${message}
2243
-
2244
- ${codeblock}`, options);
2245
- this.line = line;
2246
- this.column = column;
2247
- this.codeblock = codeblock;
2248
- }
2249
- };
2250
-
2251
- // ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/util.js
2252
- function indexOfNewline(str, start = 0) {
2253
- let idx = str.indexOf("\n", start);
2254
- if (str.charCodeAt(idx - 1) === 13)
2255
- idx--;
2256
- return idx;
2257
- }
2258
- __name(indexOfNewline, "indexOfNewline");
2259
- function skipComment(ctx) {
2260
- for (; ctx.p < ctx.s.length; ctx.p++) {
2261
- let c = ctx.s.charCodeAt(ctx.p);
2262
- if (c === 10)
2263
- break;
2264
- if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
2265
- ctx.p++;
2266
- break;
2267
- }
2268
- if (c < 32 && c !== 9 || c === 127) {
2269
- throw new TomlError("control characters are not allowed in comments", {
2270
- toml: ctx.s,
2271
- ptr: ctx.p
2272
- });
2273
- }
2274
- }
2275
- }
2276
- __name(skipComment, "skipComment");
2277
- function skipVoid(ctx, banNewLines, banComments) {
2278
- let c;
2279
- while (1) {
2280
- while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
2281
- ctx.p++;
2282
- if (banComments || c !== 35)
2283
- break;
2284
- skipComment(ctx);
2285
- }
2286
- }
2287
- __name(skipVoid, "skipVoid");
2288
- function skipUntil(ctx, sep, end) {
2289
- let ptr = ctx.p;
2290
- if (!end) {
2291
- ptr = indexOfNewline(ctx.s, ptr);
2292
- ctx.p = ptr < 0 ? ctx.s.length : ptr;
2293
- return;
2294
- }
2295
- for (; ctx.p < ctx.s.length; ctx.p++) {
2296
- let c = ctx.s.charCodeAt(ctx.p);
2297
- if (c === 35) {
2298
- skipComment(ctx);
2299
- } else if (c === end || c === sep) {
2300
- return;
2301
- }
2302
- }
2303
- throw new TomlError("cannot find end of structure", {
2304
- toml: ctx.s,
2305
- ptr
2306
- });
2307
- }
2308
- __name(skipUntil, "skipUntil");
2309
-
2310
- // ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/primitive.js
2311
- var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
2312
- var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
2313
- var LEADING_ZERO = /^[+-]?0[0-9_]/;
2314
- function parseString(ctx) {
2315
- let start = ctx.p;
2316
- let c = ctx.s.charCodeAt(ctx.p++);
2317
- let first = c;
2318
- let isLiteral = c === 39;
2319
- let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
2320
- if (isMultiline) {
2321
- if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
2322
- ctx.p++;
2323
- else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
2324
- ctx.p += 2;
2325
- }
2326
- let parsed = "";
2327
- let sliceStart = ctx.p;
2328
- let state = 0;
2329
- for (; ctx.p < ctx.s.length; ctx.p++) {
2330
- c = ctx.s.charCodeAt(ctx.p);
2331
- if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
2332
- state = state && 3;
2333
- } else if (c < 32 && c !== 9 || c === 127) {
2334
- throw new TomlError("control characters are not allowed in strings", {
2335
- toml: ctx.s,
2336
- ptr: ctx.p
2337
- });
2338
- } else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
2339
- if (isMultiline) {
2340
- if (ctx.s.charCodeAt(ctx.p + 3) === first)
2341
- ctx.p++;
2342
- if (ctx.s.charCodeAt(ctx.p + 3) === first)
2343
- ctx.p++;
2344
- }
2345
- if (!state)
2346
- parsed += ctx.s.slice(sliceStart, ctx.p);
2347
- ctx.p += isMultiline ? 3 : 1;
2348
- return parsed;
2349
- } else if (!state) {
2350
- if (!isLiteral && c === 92) {
2351
- parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
2352
- state = 1;
2353
- }
2354
- } else if (state === 1) {
2355
- if (c === 120 || c === 117 || c === 85) {
2356
- let value = 0;
2357
- let len = c === 120 ? 2 : c === 117 ? 4 : 8;
2358
- for (let j = 0; j < len; j++, ctx.p++) {
2359
- let hex = ctx.s.charCodeAt(ctx.p + 1);
2360
- let digit = (
2361
- /* 0-9 */
2362
- hex >= 48 && hex <= 57 ? hex - 48 : (
2363
- /* A-F */
2364
- hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
2365
- /* a-f */
2366
- hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
2367
- )
2368
- )
2369
- );
2370
- if (digit < 0)
2371
- throw new TomlError("invalid non-hex character in unicode escape", { toml: ctx.s, ptr: ctx.p + 1 });
2372
- value = value << 4 | digit;
2373
- }
2374
- if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
2375
- throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
2376
- }
2377
- parsed += String.fromCodePoint(value);
2378
- sliceStart = ctx.p + 1;
2379
- state = 0;
2380
- } else if (c === 32 || c === 9) {
2381
- state = 2;
2382
- } else {
2383
- if (c === 98)
2384
- parsed += "\b";
2385
- else if (c === 116)
2386
- parsed += " ";
2387
- else if (c === 110)
2388
- parsed += "\n";
2389
- else if (c === 102)
2390
- parsed += "\f";
2391
- else if (c === 114)
2392
- parsed += "\r";
2393
- else if (c === 101)
2394
- parsed += "\x1B";
2395
- else if (c === 34)
2396
- parsed += '"';
2397
- else if (c === 92)
2398
- parsed += "\\";
2399
- else
2400
- throw new TomlError("unrecognized escape sequence", { toml: ctx.s, ptr: ctx.p });
2401
- sliceStart = ctx.p + 1;
2402
- state = 0;
2403
- }
2404
- } else if (c !== 32 && c !== 9) {
2405
- if (state === 2) {
2406
- throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
2407
- toml: ctx.s,
2408
- ptr: sliceStart
2409
- });
2410
- }
2411
- state = !isLiteral && c === 92 ? 1 : 0;
2412
- sliceStart = ctx.p;
2413
- }
2414
- }
2415
- throw new TomlError("unfinished string", { toml: ctx.s, ptr: start });
2416
- }
2417
- __name(parseString, "parseString");
2418
- function sliceAndTrimEndOf(ctx, start, end) {
2419
- let value = ctx.s.slice(start, end);
2420
- let commentIdx = value.indexOf("#");
2421
- if (commentIdx > 0) {
2422
- skipComment({ s: value, p: commentIdx});
2423
- value = value.slice(0, commentIdx);
2424
- }
2425
- return value.trimEnd();
2426
- }
2427
- __name(sliceAndTrimEndOf, "sliceAndTrimEndOf");
2428
- function parseValue(ctx, integersAsBigInt, end) {
2429
- let ptr = ctx.p;
2430
- let err = { toml: ctx.s, ptr };
2431
- skipUntil(ctx, 44, end);
2432
- let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
2433
- if (!value)
2434
- throw new TomlError("incomplete declaration: value expected", err);
2435
- if (value === "-inf")
2436
- return -Infinity;
2437
- if (value === "inf" || value === "+inf")
2438
- return Infinity;
2439
- if (value === "nan" || value === "+nan" || value === "-nan")
2440
- return NaN;
2441
- if (value === "-0")
2442
- return integersAsBigInt ? 0n : 0;
2443
- let isInt = INT_REGEX.test(value);
2444
- if (isInt || FLOAT_REGEX.test(value)) {
2445
- if (LEADING_ZERO.test(value)) {
2446
- throw new TomlError("leading zeroes are not allowed", err);
2447
- }
2448
- value = value.replace(/_/g, "");
2449
- let numeric = +value;
2450
- if (isNaN(numeric)) {
2451
- throw new TomlError("invalid number", err);
2452
- }
2453
- if (isInt) {
2454
- if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
2455
- throw new TomlError("integer value cannot be represented losslessly", err);
2456
- }
2457
- if (isInt || integersAsBigInt === true)
2458
- numeric = BigInt(value);
2459
- }
2460
- return numeric;
2461
- }
2462
- const date = new TomlDate(value);
2463
- if (!date.isValid())
2464
- throw new TomlError("invalid value", err);
2465
- return date;
2466
- }
2467
- __name(parseValue, "parseValue");
2468
-
2469
- // ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/extract.js
2470
- function extractValue(ctx, end, integersAsBigInt) {
2471
- let ptr = ctx.p;
2472
- let c = ctx.s.charCodeAt(ptr);
2473
- if (c === 91 || c === 123) {
2474
- if (!ctx.d--) {
2475
- throw new TomlError("document contains excessively nested structures. aborting.", {
2476
- toml: ctx.s,
2477
- ptr
2478
- });
2479
- }
2480
- let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
2481
- ctx.d++;
2482
- return value;
2483
- }
2484
- if (c === 34 || c === 39) {
2485
- return parseString(ctx);
2486
- }
2487
- if (c === 116) {
2488
- if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
2489
- throw new TomlError("invalid value", { toml: ctx.s, ptr });
2490
- ctx.p++;
2491
- return true;
2492
- }
2493
- if (c === 102) {
2494
- 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)
2495
- throw new TomlError("invalid value", { toml: ctx.s, ptr });
2496
- ctx.p++;
2497
- return false;
2498
- }
2499
- return parseValue(ctx, integersAsBigInt, end);
2500
- }
2501
- __name(extractValue, "extractValue");
2502
-
2503
- // ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/struct.js
2504
- var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
2505
- function parseKey(ctx, end = "=") {
2506
- let start = ctx.p;
2507
- let dot = start - 1;
2508
- let parsed = [];
2509
- let endPtr = ctx.s.indexOf(end, start);
2510
- if (endPtr < 0) {
2511
- throw new TomlError("incomplete key-value: cannot find end of key", {
2512
- toml: ctx.s,
2513
- ptr: start
2514
- });
2515
- }
2516
- do {
2517
- let c = ctx.s.charCodeAt(ctx.p = ++dot);
2518
- if (c !== 32 && c !== 9) {
2519
- if (c === 34 || c === 39) {
2520
- if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
2521
- throw new TomlError("multiline strings are not allowed in keys", {
2522
- toml: ctx.s,
2523
- ptr: ctx.p
2524
- });
2525
- }
2526
- let part = parseString(ctx);
2527
- dot = ctx.s.indexOf(".", ctx.p);
2528
- let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
2529
- let newLine = indexOfNewline(strEnd);
2530
- if (newLine > -1) {
2531
- throw new TomlError("newlines are not allowed in keys", {
2532
- toml: ctx.s,
2533
- ptr: newLine
2534
- });
2535
- }
2536
- if (strEnd.trimStart()) {
2537
- throw new TomlError("found extra tokens after the string part", {
2538
- toml: ctx.s,
2539
- ptr: ctx.p
2540
- });
2541
- }
2542
- if (endPtr < ctx.p) {
2543
- endPtr = ctx.s.indexOf(end, ctx.p);
2544
- if (endPtr < 0) {
2545
- throw new TomlError("incomplete key-value: cannot find end of key", {
2546
- toml: ctx.s,
2547
- ptr: start
2548
- });
2549
- }
2550
- }
2551
- parsed.push(part);
2552
- } else {
2553
- dot = ctx.s.indexOf(".", ctx.p);
2554
- let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
2555
- if (!KEY_PART_RE.test(part)) {
2556
- throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
2557
- toml: ctx.s,
2558
- ptr: ctx.p
2559
- });
2560
- }
2561
- parsed.push(part.trimEnd());
2562
- }
2563
- }
2564
- } while (dot + 1 && dot < endPtr);
2565
- ctx.p = endPtr + 1;
2566
- skipVoid(ctx, true, true);
2567
- return parsed;
2568
- }
2569
- __name(parseKey, "parseKey");
2570
- function parseInlineTable(ctx, integersAsBigInt) {
2571
- let res = {};
2572
- let seen = /* @__PURE__ */ new Set();
2573
- let c;
2574
- ctx.p++;
2575
- while (ctx.p < ctx.s.length) {
2576
- skipVoid(ctx);
2577
- if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
2578
- ctx.p++;
2579
- return res;
2580
- }
2581
- let k;
2582
- let t = res;
2583
- let hasOwn = false;
2584
- let p = ctx.p;
2585
- let key = parseKey(ctx);
2586
- for (let i = 0; i < key.length; i++) {
2587
- if (i)
2588
- t = hasOwn ? t[k] : t[k] = {};
2589
- k = key[i];
2590
- if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
2591
- throw new TomlError("trying to redefine an already defined value", {
2592
- toml: ctx.s,
2593
- ptr: p
2594
- });
2595
- }
2596
- if (!hasOwn && k === "__proto__") {
2597
- Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
2598
- }
2599
- }
2600
- if (hasOwn) {
2601
- throw new TomlError("trying to redefine an already defined value", {
2602
- toml: ctx.s,
2603
- ptr: ctx.p
2604
- });
2605
- }
2606
- let value = extractValue(ctx, 125, integersAsBigInt);
2607
- seen.add(t[k] = value);
2608
- skipVoid(ctx);
2609
- if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
2610
- return res;
2611
- }
2612
- if (c !== 44) {
2613
- throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
2614
- }
2615
- }
2616
- throw new TomlError("unfinished table encountered", {
2617
- toml: ctx.s,
2618
- ptr: ctx.p
2619
- });
2620
- }
2621
- __name(parseInlineTable, "parseInlineTable");
2622
- function parseArray(ctx, integersAsBigInt) {
2623
- let res = [];
2624
- let c;
2625
- ctx.p++;
2626
- while (ctx.p < ctx.s.length) {
2627
- skipVoid(ctx);
2628
- if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
2629
- ctx.p++;
2630
- return res;
2631
- }
2632
- res.push(extractValue(ctx, 93, integersAsBigInt));
2633
- skipVoid(ctx);
2634
- if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
2635
- return res;
2636
- }
2637
- if (c !== 44) {
2638
- throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
2639
- }
2640
- }
2641
- throw new TomlError("unfinished array encountered", {
2642
- toml: ctx.s,
2643
- ptr: ctx.p
2644
- });
2645
- }
2646
- __name(parseArray, "parseArray");
2647
-
2648
- // ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/parse.js
2649
- function peekTable(key, table, meta, type) {
2650
- let t = table;
2651
- let m = meta;
2652
- let k;
2653
- let hasOwn = false;
2654
- let state;
2655
- for (let i = 0; i < key.length; i++) {
2656
- if (i) {
2657
- t = hasOwn ? t[k] : t[k] = {};
2658
- m = (state = m[k]).c;
2659
- if (type === 0 && (state.t === 1 || state.t === 2)) {
2660
- return null;
2661
- }
2662
- if (state.t === 2) {
2663
- let l = t.length - 1;
2664
- t = t[l];
2665
- m = m[l].c;
2666
- }
2667
- }
2668
- k = key[i];
2669
- if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
2670
- return null;
2671
- }
2672
- if (!hasOwn) {
2673
- if (k === "__proto__") {
2674
- Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
2675
- Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
2676
- }
2677
- m[k] = {
2678
- t: i < key.length - 1 && type === 2 ? 3 : type,
2679
- d: false,
2680
- i: 0,
2681
- c: {}
2682
- };
2683
- }
2684
- }
2685
- state = m[k];
2686
- if (state.t !== type && !(type === 1 && state.t === 3)) {
2687
- return null;
2688
- }
2689
- if (type === 2) {
2690
- if (!state.d) {
2691
- state.d = true;
2692
- t[k] = [];
2693
- }
2694
- t[k].push(t = {});
2695
- state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
2696
- }
2697
- if (state.d) {
2698
- return null;
2699
- }
2700
- state.d = true;
2701
- if (type === 1) {
2702
- t = hasOwn ? t[k] : t[k] = {};
2703
- } else if (type === 0 && hasOwn) {
2704
- return null;
2705
- }
2706
- return [k, t, state.c];
2707
- }
2708
- __name(peekTable, "peekTable");
2709
- function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
2710
- let ctx = { s: toml, p: 0, d: maxDepth };
2711
- let res = {};
2712
- let meta = {};
2713
- let tmp;
2714
- let tbl = res;
2715
- let m = meta;
2716
- skipVoid(ctx);
2717
- while (ctx.p < toml.length) {
2718
- if (toml.charCodeAt(ctx.p) === 91) {
2719
- let isTableArray = toml.charCodeAt(++ctx.p) === 91;
2720
- tmp = ctx.p += +isTableArray;
2721
- let k = parseKey(ctx, "]");
2722
- if (isTableArray) {
2723
- if (toml.charCodeAt(ctx.p - 1) !== 93) {
2724
- throw new TomlError("expected end of table declaration", {
2725
- toml,
2726
- ptr: ctx.p - 1
2727
- });
2728
- }
2729
- ctx.p++;
2730
- }
2731
- let p = peekTable(
2732
- k,
2733
- res,
2734
- meta,
2735
- isTableArray ? 2 : 1
2736
- /* Type.EXPLICIT */
2737
- );
2738
- if (!p) {
2739
- throw new TomlError("trying to redefine an already defined table or value", {
2740
- toml,
2741
- ptr: tmp
2742
- });
2743
- }
2744
- m = p[2];
2745
- tbl = p[1];
2746
- } else {
2747
- tmp = ctx.p;
2748
- let k = parseKey(ctx);
2749
- let p = peekTable(
2750
- k,
2751
- tbl,
2752
- m,
2753
- 0
2754
- /* Type.DOTTED */
2755
- );
2756
- if (!p) {
2757
- throw new TomlError("trying to redefine an already defined table or value", {
2758
- toml,
2759
- ptr: tmp
2760
- });
2761
- }
2762
- p[1][p[0]] = extractValue(ctx, void 0, integersAsBigInt);
2763
- }
2764
- skipVoid(ctx, true);
2765
- if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
2766
- throw new TomlError("each key-value declaration must be followed by an end-of-line", {
2767
- toml,
2768
- ptr: ctx.p
2769
- });
2770
- }
2771
- skipVoid(ctx);
2772
- }
2773
- return res;
2774
- }
2775
- __name(parse, "parse");
2776
-
2777
- // ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/stringify.js
2111
+ // ../../node_modules/.pnpm/smol-toml@1.9.0/node_modules/smol-toml/dist/stringify.js
2778
2112
  var BARE_KEY = /^[a-z0-9-_]+$/i;
2113
+ var HAS_WELLFORMED = !!"".isWellFormed;
2779
2114
  function extendedTypeOf(obj) {
2780
2115
  let type = typeof obj;
2781
2116
  if (type === "object") {
2782
2117
  if (Array.isArray(obj))
2783
2118
  return "array";
2784
- if (typeof obj?.getUTCDate === "function" && obj instanceof Date)
2119
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date)
2785
2120
  return "date";
2786
- if (globalThis.Temporal && // check for the 'since' property as an early bailout that avoids running all 5 instanceof checks
2787
- typeof obj?.since === "function" && (obj instanceof Temporal.Instant || obj instanceof Temporal.PlainDate || obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainTime || obj instanceof Temporal.ZonedDateTime)) {
2788
- return "temporal";
2121
+ if (globalThis.Temporal) {
2122
+ if (obj.until) {
2123
+ if (obj instanceof Temporal.ZonedDateTime)
2124
+ return "temporal/tz+uc";
2125
+ if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate)
2126
+ return "temporal/uc";
2127
+ if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant)
2128
+ return "temporal";
2129
+ if (obj instanceof Temporal.PlainYearMonth)
2130
+ return "temporal/x";
2131
+ } else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) {
2132
+ return "temporal/x";
2133
+ }
2789
2134
  }
2790
2135
  }
2791
2136
  return type;
@@ -2799,18 +2144,23 @@ function isArrayOfTables(obj) {
2799
2144
  return obj.length != 0;
2800
2145
  }
2801
2146
  __name(isArrayOfTables, "isArrayOfTables");
2147
+ function formatWellFormedStringUnchecked(s) {
2148
+ return JSON.stringify(s).replaceAll("\x7F", "\\u007f");
2149
+ }
2150
+ __name(formatWellFormedStringUnchecked, "formatWellFormedStringUnchecked");
2802
2151
  function formatString(s) {
2803
- return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
2152
+ return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
2804
2153
  }
2805
2154
  __name(formatString, "formatString");
2806
- function stringifyTemporal(temporal) {
2807
- return temporal.toString({
2808
- calendarName: "never",
2809
- timeZoneName: "never"
2810
- });
2811
- }
2812
- __name(stringifyTemporal, "stringifyTemporal");
2813
- function stringifyValue(val, type, depth, numberAsFloat) {
2155
+ function formatKey(s) {
2156
+ if (BARE_KEY.test(s))
2157
+ return s;
2158
+ if (HAS_WELLFORMED && !s.isWellFormed())
2159
+ throw new RangeError("key contains illegal lone surrogates");
2160
+ return formatWellFormedStringUnchecked(s);
2161
+ }
2162
+ __name(formatKey, "formatKey");
2163
+ function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
2814
2164
  if (depth === 0) {
2815
2165
  throw new Error("Could not stringify the object: maximum object depth exceeded");
2816
2166
  }
@@ -2827,6 +2177,7 @@ function stringifyValue(val, type, depth, numberAsFloat) {
2827
2177
  return val.toFixed(1);
2828
2178
  case "bigint":
2829
2179
  case "boolean":
2180
+ case "temporal":
2830
2181
  return val.toString();
2831
2182
  case "string":
2832
2183
  return formatString(val);
@@ -2835,15 +2186,38 @@ function stringifyValue(val, type, depth, numberAsFloat) {
2835
2186
  throw new TypeError("cannot serialize invalid date");
2836
2187
  return val.toISOString();
2837
2188
  case "object":
2838
- return stringifyInlineTable(val, depth, numberAsFloat);
2189
+ return stringifyInlineTable(val, depth, numberAsFloat, strictTemporal);
2839
2190
  case "array":
2840
- return stringifyArray(val, depth, numberAsFloat);
2841
- case "temporal":
2842
- return stringifyTemporal(val);
2191
+ return stringifyArray(val, depth, numberAsFloat, strictTemporal);
2192
+ // @ts-expect-error -- intentional fallthrough case
2193
+ case "temporal/tz+uc":
2194
+ if (strictTemporal) {
2195
+ let tz = val.timeZoneId;
2196
+ let tzc = tz.charCodeAt(0);
2197
+ if (
2198
+ // Classic offset
2199
+ tzc !== 43 && tzc !== 45 && // Fast pre-check pass; see below for the actually accepted values
2200
+ (tzc !== 85 && tzc !== 71 && tzc !== 90 && tzc !== 69 || // UTC and its aliases; Temporal implementations don't all canonicalise unfortunately
2201
+ tz !== "UTC" && tz !== "UCT" && tz !== "Universal" && tz !== "Zulu" && // GMT is a TZ but it's for all intents and purposes equivalent to UTC. Safe to downgrade.
2202
+ !tz.startsWith("GMT") && tz !== "Greenwich" && // Etc/* are all safe to downgrade to offset (either UTC, GMT, or offset)
2203
+ !tz.startsWith("Etc/"))
2204
+ ) {
2205
+ throw new TypeError("Temporal objects with an IANA timezone are not allowed in Temporal strict mode");
2206
+ }
2207
+ }
2208
+ case "temporal/uc":
2209
+ if (strictTemporal && val.calendarId !== "iso8601")
2210
+ throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
2211
+ return val.toString({
2212
+ calendarName: "never",
2213
+ timeZoneName: "never"
2214
+ });
2215
+ case "temporal/x":
2216
+ throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
2843
2217
  }
2844
2218
  }
2845
2219
  __name(stringifyValue, "stringifyValue");
2846
- function stringifyInlineTable(obj, depth, numberAsFloat) {
2220
+ function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
2847
2221
  let keys = Object.keys(obj);
2848
2222
  if (keys.length === 0)
2849
2223
  return "{}";
@@ -2852,14 +2226,12 @@ function stringifyInlineTable(obj, depth, numberAsFloat) {
2852
2226
  let k = keys[i];
2853
2227
  if (i)
2854
2228
  res += ", ";
2855
- res += BARE_KEY.test(k) ? k : formatString(k);
2856
- res += " = ";
2857
- res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
2229
+ res += formatKey(k) + " = " + stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat, strictTemporal);
2858
2230
  }
2859
2231
  return res + " }";
2860
2232
  }
2861
2233
  __name(stringifyInlineTable, "stringifyInlineTable");
2862
- function stringifyArray(array, depth, numberAsFloat) {
2234
+ function stringifyArray(array, depth, numberAsFloat, strictTemporal) {
2863
2235
  if (array.length === 0)
2864
2236
  return "[]";
2865
2237
  let res = "[ ";
@@ -2869,12 +2241,12 @@ function stringifyArray(array, depth, numberAsFloat) {
2869
2241
  if (array[i] === null || array[i] === void 0) {
2870
2242
  throw new TypeError("arrays cannot contain null or undefined values");
2871
2243
  }
2872
- res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
2244
+ res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat, strictTemporal);
2873
2245
  }
2874
2246
  return res + " ]";
2875
2247
  }
2876
2248
  __name(stringifyArray, "stringifyArray");
2877
- function stringifyArrayTable(array, key, depth, numberAsFloat) {
2249
+ function stringifyArrayTable(array, key, depth, numberAsFloat, strictTemporal) {
2878
2250
  if (depth === 0) {
2879
2251
  throw new Error("Could not stringify the object: maximum object depth exceeded");
2880
2252
  }
@@ -2882,12 +2254,12 @@ function stringifyArrayTable(array, key, depth, numberAsFloat) {
2882
2254
  for (let i = 0; i < array.length; i++) {
2883
2255
  res += `${res && "\n"}[[${key}]]
2884
2256
  `;
2885
- res += stringifyTable(0, array[i], key, depth, numberAsFloat);
2257
+ res += stringifyTable(0, array[i], key, depth, numberAsFloat, strictTemporal);
2886
2258
  }
2887
2259
  return res;
2888
2260
  }
2889
2261
  __name(stringifyArrayTable, "stringifyArrayTable");
2890
- function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
2262
+ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
2891
2263
  if (depth === 0) {
2892
2264
  throw new Error("Could not stringify the object: maximum object depth exceeded");
2893
2265
  }
@@ -2901,16 +2273,16 @@ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
2901
2273
  if (type === "symbol" || type === "function") {
2902
2274
  throw new TypeError(`cannot serialize values of type '${type}'`);
2903
2275
  }
2904
- let key = BARE_KEY.test(k) ? k : formatString(k);
2276
+ let key = formatKey(k);
2905
2277
  if (type === "array" && isArrayOfTables(obj[k])) {
2906
- tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
2278
+ tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
2907
2279
  } else if (type === "object") {
2908
2280
  let tblKey = prefix ? `${prefix}.${key}` : key;
2909
- tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
2281
+ tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat, strictTemporal);
2910
2282
  } else {
2911
2283
  preamble += key;
2912
2284
  preamble += " = ";
2913
- preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
2285
+ preamble += stringifyValue(obj[k], type, depth, numberAsFloat, strictTemporal);
2914
2286
  preamble += "\n";
2915
2287
  }
2916
2288
  }
@@ -2922,25 +2294,22 @@ ${preamble}` : `[${tableKey}]`;
2922
2294
  ${tables}` : preamble || tables;
2923
2295
  }
2924
2296
  __name(stringifyTable, "stringifyTable");
2925
- function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
2297
+ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false, strictTemporal = false } = {}) {
2926
2298
  if (extendedTypeOf(obj) !== "object") {
2927
2299
  throw new TypeError("stringify can only be called with an object");
2928
2300
  }
2929
- let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
2301
+ let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
2930
2302
  if (str[str.length - 1] !== "\n")
2931
2303
  return str + "\n";
2932
2304
  return str;
2933
2305
  }
2934
2306
  __name(stringify, "stringify");
2935
2307
 
2936
- // ../../node_modules/.pnpm/smol-toml@1.8.0/node_modules/smol-toml/dist/index.js
2937
- var dist_default = { parse, stringify, TomlDate, TomlError };
2938
-
2939
2308
  // src/core/file-format.ts
2940
2309
  var FILE_FORMATS = {
2941
2310
  toml: {
2942
2311
  parse: /* @__PURE__ */ __name((raw) => parseTOML(raw), "parse"),
2943
- stringify: /* @__PURE__ */ __name((value) => dist_default.stringify(value), "stringify")
2312
+ stringify: /* @__PURE__ */ __name((value) => stringify(value), "stringify")
2944
2313
  },
2945
2314
  json: {
2946
2315
  parse: /* @__PURE__ */ __name((raw) => JSON.parse(raw), "parse"),
@@ -3936,7 +3305,7 @@ function scrubEncryptedCredentials(options) {
3936
3305
  __name(scrubEncryptedCredentials, "scrubEncryptedCredentials");
3937
3306
  /*! Bundled license information:
3938
3307
 
3939
- smol-toml/dist/date.js:
3308
+ smol-toml/dist/error.js:
3940
3309
  (*!
3941
3310
  * Copyright (c) Squirrel Chat et al., All rights reserved.
3942
3311
  * SPDX-License-Identifier: BSD-3-Clause
@@ -3965,7 +3334,7 @@ smol-toml/dist/date.js:
3965
3334
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3966
3335
  *)
3967
3336
 
3968
- smol-toml/dist/error.js:
3337
+ smol-toml/dist/primitive.js:
3969
3338
  (*!
3970
3339
  * Copyright (c) Squirrel Chat et al., All rights reserved.
3971
3340
  * SPDX-License-Identifier: BSD-3-Clause
@@ -3994,7 +3363,7 @@ smol-toml/dist/error.js:
3994
3363
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3995
3364
  *)
3996
3365
 
3997
- smol-toml/dist/util.js:
3366
+ smol-toml/dist/date.js:
3998
3367
  (*!
3999
3368
  * Copyright (c) Squirrel Chat et al., All rights reserved.
4000
3369
  * SPDX-License-Identifier: BSD-3-Clause
@@ -4023,7 +3392,7 @@ smol-toml/dist/util.js:
4023
3392
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4024
3393
  *)
4025
3394
 
4026
- smol-toml/dist/primitive.js:
3395
+ smol-toml/dist/extract.js:
4027
3396
  (*!
4028
3397
  * Copyright (c) Squirrel Chat et al., All rights reserved.
4029
3398
  * SPDX-License-Identifier: BSD-3-Clause
@@ -4052,7 +3421,7 @@ smol-toml/dist/primitive.js:
4052
3421
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4053
3422
  *)
4054
3423
 
4055
- smol-toml/dist/extract.js:
3424
+ smol-toml/dist/util.js:
4056
3425
  (*!
4057
3426
  * Copyright (c) Squirrel Chat et al., All rights reserved.
4058
3427
  * SPDX-License-Identifier: BSD-3-Clause