From f6f9f33f61fa645d197a429b8d1fbf15bf699443 Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Tue, 9 Dec 2025 19:52:46 -0800 Subject: [PATCH] 0.0.129 --- entry | 3138 ++++++++++++++++++++++++++++---------------------- package.json | 2 +- 2 files changed, 1760 insertions(+), 1380 deletions(-) diff --git a/entry b/entry index 91aa901..548c985 100755 --- a/entry +++ b/entry @@ -517,13 +517,13 @@ var require_tunnel = __commonJS({ var debug2; if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { debug2 = function() { - var args2 = Array.prototype.slice.call(arguments); - if (typeof args2[0] === "string") { - args2[0] = "TUNNEL: " + args2[0]; + var args3 = Array.prototype.slice.call(arguments); + if (typeof args3[0] === "string") { + args3[0] = "TUNNEL: " + args3[0]; } else { - args2.unshift("TUNNEL:"); + args3.unshift("TUNNEL:"); } - console.error.apply(console, args2); + console.error.apply(console, args3); }; } else { debug2 = function() { @@ -2666,7 +2666,7 @@ var require_multipart = __commonJS({ const self2 = this; let boundary; const limits = cfg.limits; - const isPartAFile = cfg.isPartAFile || ((fieldName, contentType, fileName2) => contentType === "application/octet-stream" || fileName2 !== void 0); + const isPartAFile = cfg.isPartAFile || ((fieldName, contentType, fileName3) => contentType === "application/octet-stream" || fileName3 !== void 0); const parsedConType = cfg.parsedConType || []; const defCharset = cfg.defCharset || "utf8"; const preservePath = cfg.preservePath; @@ -4928,12 +4928,12 @@ var require_file = __commonJS({ var { kEnumerableProperty } = require_util(); var encoder = new TextEncoder(); var File2 = class _File extends Blob2 { - constructor(fileBits, fileName2, options = {}) { + constructor(fileBits, fileName3, options = {}) { webidl.argumentLengthCheck(arguments, 2, { header: "File constructor" }); fileBits = webidl.converters["sequence"](fileBits); - fileName2 = webidl.converters.USVString(fileName2); + fileName3 = webidl.converters.USVString(fileName3); options = webidl.converters.FilePropertyBag(options); - const n = fileName2; + const n = fileName3; let t = options.type; let d; substep: { @@ -4968,8 +4968,8 @@ var require_file = __commonJS({ } }; var FileLike = class _FileLike { - constructor(blobLike, fileName2, options = {}) { - const n = fileName2; + constructor(blobLike, fileName3, options = {}) { + const n = fileName3; const t = options.type; const d = options.lastModified ?? Date.now(); this[kState] = { @@ -4979,21 +4979,21 @@ var require_file = __commonJS({ lastModified: d }; } - stream(...args2) { + stream(...args3) { webidl.brandCheck(this, _FileLike); - return this[kState].blobLike.stream(...args2); + return this[kState].blobLike.stream(...args3); } - arrayBuffer(...args2) { + arrayBuffer(...args3) { webidl.brandCheck(this, _FileLike); - return this[kState].blobLike.arrayBuffer(...args2); + return this[kState].blobLike.arrayBuffer(...args3); } - slice(...args2) { + slice(...args3) { webidl.brandCheck(this, _FileLike); - return this[kState].blobLike.slice(...args2); + return this[kState].blobLike.slice(...args3); } - text(...args2) { + text(...args3) { webidl.brandCheck(this, _FileLike); - return this[kState].blobLike.text(...args2); + return this[kState].blobLike.text(...args3); } get size() { webidl.brandCheck(this, _FileLike); @@ -8981,8 +8981,8 @@ var require_balanced_pool = __commonJS({ pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]); this._updateBalancedPoolStats(); }); - pool.on("disconnect", (...args2) => { - const err = args2[2]; + pool.on("disconnect", (...args3) => { + const err = args3[2]; if (err && err.code === "UND_ERR_SOCKET") { pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]); this._updateBalancedPoolStats(); @@ -9256,32 +9256,32 @@ var require_readable = __commonJS({ } return super.destroy(err); } - emit(ev, ...args2) { + emit(ev, ...args3) { if (ev === "data") { this._readableState.dataEmitted = true; } else if (ev === "error") { this._readableState.errorEmitted = true; } - return super.emit(ev, ...args2); + return super.emit(ev, ...args3); } - on(ev, ...args2) { + on(ev, ...args3) { if (ev === "data" || ev === "readable") { this[kReading] = true; } - return super.on(ev, ...args2); + return super.on(ev, ...args3); } - addListener(ev, ...args2) { - return this.on(ev, ...args2); + addListener(ev, ...args3) { + return this.on(ev, ...args3); } - off(ev, ...args2) { - const ret = super.off(ev, ...args2); + off(ev, ...args3) { + const ret = super.off(ev, ...args3); if (ev === "data" || ev === "readable") { this[kReading] = this.listenerCount("data") > 0 || this.listenerCount("readable") > 0; } return ret; } - removeListener(ev, ...args2) { - return this.off(ev, ...args2); + removeListener(ev, ...args3) { + return this.off(ev, ...args3); } push(chunk) { if (this[kConsume] && chunk !== null && this.readableLength === 0) { @@ -11528,26 +11528,26 @@ var require_DecoratorHandler = __commonJS({ constructor(handler2) { this.handler = handler2; } - onConnect(...args2) { - return this.handler.onConnect(...args2); + onConnect(...args3) { + return this.handler.onConnect(...args3); } - onError(...args2) { - return this.handler.onError(...args2); + onError(...args3) { + return this.handler.onError(...args3); } - onUpgrade(...args2) { - return this.handler.onUpgrade(...args2); + onUpgrade(...args3) { + return this.handler.onUpgrade(...args3); } - onHeaders(...args2) { - return this.handler.onHeaders(...args2); + onHeaders(...args3) { + return this.handler.onHeaders(...args3); } - onData(...args2) { - return this.handler.onData(...args2); + onData(...args3) { + return this.handler.onData(...args3); } - onComplete(...args2) { - return this.handler.onComplete(...args2); + onComplete(...args3) { + return this.handler.onComplete(...args3); } - onBodySent(...args2) { - return this.handler.onBodySent(...args2); + onBodySent(...args3) { + return this.handler.onBodySent(...args3); } }; } @@ -18847,9 +18847,9 @@ var require_io = __commonJS({ currentDepth++; yield mkdirP(destDir); const files = yield ioUtil.readdir(sourceDir); - for (const fileName2 of files) { - const srcFile = `${sourceDir}/${fileName2}`; - const destFile = `${destDir}/${fileName2}`; + for (const fileName3 of files) { + const srcFile = `${sourceDir}/${fileName3}`; + const destFile = `${destDir}/${fileName3}`; const srcFileStat = yield ioUtil.lstat(srcFile); if (srcFileStat.isDirectory()) { yield cpDirRecursive(srcFile, destFile, currentDepth, force); @@ -18947,13 +18947,13 @@ var require_toolrunner = __commonJS({ var timers_1 = __require("timers"); var IS_WINDOWS = process.platform === "win32"; var ToolRunner = class extends events.EventEmitter { - constructor(toolPath, args2, options) { + constructor(toolPath, args3, options) { super(); if (!toolPath) { throw new Error("Parameter 'toolPath' cannot be null or empty."); } this.toolPath = toolPath; - this.args = args2 || []; + this.args = args3 || []; this.options = options || {}; } _debug(message) { @@ -18963,28 +18963,28 @@ var require_toolrunner = __commonJS({ } _getCommandString(options, noPrefix) { const toolPath = this._getSpawnFileName(); - const args2 = this._getSpawnArgs(options); + const args3 = this._getSpawnArgs(options); let cmd = noPrefix ? "" : "[command]"; if (IS_WINDOWS) { if (this._isCmdFile()) { cmd += toolPath; - for (const a of args2) { + for (const a of args3) { cmd += ` ${a}`; } } else if (options.windowsVerbatimArguments) { cmd += `"${toolPath}"`; - for (const a of args2) { + for (const a of args3) { cmd += ` ${a}`; } } else { cmd += this._windowsQuoteCmdArg(toolPath); - for (const a of args2) { + for (const a of args3) { cmd += ` ${this._windowsQuoteCmdArg(a)}`; } } } else { cmd += toolPath; - for (const a of args2) { + for (const a of args3) { cmd += ` ${a}`; } } @@ -19176,8 +19176,8 @@ var require_toolrunner = __commonJS({ if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) { return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`)); } - const fileName2 = this._getSpawnFileName(); - const cp = child.spawn(fileName2, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName2)); + const fileName3 = this._getSpawnFileName(); + const cp = child.spawn(fileName3, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName3)); let stdbuffer = ""; if (cp.stdout) { cp.stdout.on("data", (data) => { @@ -19257,11 +19257,11 @@ var require_toolrunner = __commonJS({ }; exports.ToolRunner = ToolRunner; function argStringToArray(argString) { - const args2 = []; + const args3 = []; let inQuotes = false; let escaped = false; let arg = ""; - function append2(c) { + function append3(c) { if (escaped && c !== '"') { arg += "\\"; } @@ -19274,12 +19274,12 @@ var require_toolrunner = __commonJS({ if (!escaped) { inQuotes = !inQuotes; } else { - append2(c); + append3(c); } continue; } if (c === "\\" && escaped) { - append2(c); + append3(c); continue; } if (c === "\\" && inQuotes) { @@ -19288,17 +19288,17 @@ var require_toolrunner = __commonJS({ } if (c === " " && !inQuotes) { if (arg.length > 0) { - args2.push(arg); + args3.push(arg); arg = ""; } continue; } - append2(c); + append3(c); } if (arg.length > 0) { - args2.push(arg.trim()); + args3.push(arg.trim()); } - return args2; + return args3; } exports.argStringToArray = argStringToArray; var ExecState = class _ExecState extends events.EventEmitter { @@ -19424,20 +19424,20 @@ var require_exec = __commonJS({ exports.getExecOutput = exports.exec = void 0; var string_decoder_1 = __require("string_decoder"); var tr = __importStar(require_toolrunner()); - function exec(commandLine, args2, options) { + function exec(commandLine, args3, options) { return __awaiter(this, void 0, void 0, function* () { const commandArgs = tr.argStringToArray(commandLine); if (commandArgs.length === 0) { throw new Error(`Parameter 'commandLine' cannot be null or empty.`); } const toolPath = commandArgs[0]; - args2 = commandArgs.slice(1).concat(args2 || []); - const runner = new tr.ToolRunner(toolPath, args2, options); + args3 = commandArgs.slice(1).concat(args3 || []); + const runner = new tr.ToolRunner(toolPath, args3, options); return runner.exec(); }); } exports.exec = exec; - function getExecOutput(commandLine, args2, options) { + function getExecOutput(commandLine, args3, options) { var _a, _b; return __awaiter(this, void 0, void 0, function* () { let stdout = ""; @@ -19459,7 +19459,7 @@ var require_exec = __commonJS({ } }; const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener }); - const exitCode = yield exec(commandLine, args2, Object.assign(Object.assign({}, options), { listeners })); + const exitCode = yield exec(commandLine, args3, Object.assign(Object.assign({}, options), { listeners })); stdout += stdoutDecoder.end(); stderr += stderrDecoder.end(); return { @@ -20510,9 +20510,9 @@ var require_conversions = __commonJS({ const b = c * Math.sin(hr); return [l, a, b]; }; - convert.rgb.ansi16 = function(args2, saturation = null) { - const [r, g, b] = args2; - let value2 = saturation === null ? convert.rgb.hsv(args2)[2] : saturation; + convert.rgb.ansi16 = function(args3, saturation = null) { + const [r, g, b] = args3; + let value2 = saturation === null ? convert.rgb.hsv(args3)[2] : saturation; value2 = Math.round(value2 / 50); if (value2 === 0) { return 30; @@ -20523,13 +20523,13 @@ var require_conversions = __commonJS({ } return ansi; }; - convert.hsv.ansi16 = function(args2) { - return convert.rgb.ansi16(convert.hsv.rgb(args2), args2[2]); + convert.hsv.ansi16 = function(args3) { + return convert.rgb.ansi16(convert.hsv.rgb(args3), args3[2]); }; - convert.rgb.ansi256 = function(args2) { - const r = args2[0]; - const g = args2[1]; - const b = args2[2]; + convert.rgb.ansi256 = function(args3) { + const r = args3[0]; + const g = args3[1]; + const b = args3[2]; if (r === g && g === b) { if (r < 8) { return 16; @@ -20542,40 +20542,40 @@ var require_conversions = __commonJS({ const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5); return ansi; }; - convert.ansi16.rgb = function(args2) { - let color = args2 % 10; + convert.ansi16.rgb = function(args3) { + let color = args3 % 10; if (color === 0 || color === 7) { - if (args2 > 50) { + if (args3 > 50) { color += 3.5; } color = color / 10.5 * 255; return [color, color, color]; } - const mult = (~~(args2 > 50) + 1) * 0.5; + const mult = (~~(args3 > 50) + 1) * 0.5; const r = (color & 1) * mult * 255; const g = (color >> 1 & 1) * mult * 255; const b = (color >> 2 & 1) * mult * 255; return [r, g, b]; }; - convert.ansi256.rgb = function(args2) { - if (args2 >= 232) { - const c = (args2 - 232) * 10 + 8; + convert.ansi256.rgb = function(args3) { + if (args3 >= 232) { + const c = (args3 - 232) * 10 + 8; return [c, c, c]; } - args2 -= 16; + args3 -= 16; let rem; - const r = Math.floor(args2 / 36) / 5 * 255; - const g = Math.floor((rem = args2 % 36) / 6) / 5 * 255; + const r = Math.floor(args3 / 36) / 5 * 255; + const g = Math.floor((rem = args3 % 36) / 6) / 5 * 255; const b = rem % 6 / 5 * 255; return [r, g, b]; }; - convert.rgb.hex = function(args2) { - const integer3 = ((Math.round(args2[0]) & 255) << 16) + ((Math.round(args2[1]) & 255) << 8) + (Math.round(args2[2]) & 255); + convert.rgb.hex = function(args3) { + const integer3 = ((Math.round(args3[0]) & 255) << 16) + ((Math.round(args3[1]) & 255) << 8) + (Math.round(args3[2]) & 255); const string3 = integer3.toString(16).toUpperCase(); return "000000".substring(string3.length) + string3; }; - convert.hex.rgb = function(args2) { - const match2 = args2.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + convert.hex.rgb = function(args3) { + const match2 = args3.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); if (!match2) { return [0, 0, 0]; } @@ -20733,11 +20733,11 @@ var require_conversions = __commonJS({ convert.rgb.apple = function(rgb) { return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535]; }; - convert.gray.rgb = function(args2) { - return [args2[0] / 100 * 255, args2[0] / 100 * 255, args2[0] / 100 * 255]; + convert.gray.rgb = function(args3) { + return [args3[0] / 100 * 255, args3[0] / 100 * 255, args3[0] / 100 * 255]; }; - convert.gray.hsl = function(args2) { - return [0, 0, args2[0]]; + convert.gray.hsl = function(args3) { + return [0, 0, args3[0]]; }; convert.gray.hsv = convert.gray.hsl; convert.gray.hwb = function(gray) { @@ -20799,8 +20799,8 @@ var require_route = __commonJS({ return graph; } function link(from, to) { - return function(args2) { - return to(from(args2)); + return function(args3) { + return to(from(args3)); }; } function wrapConversion(toModel, graph) { @@ -20840,15 +20840,15 @@ var require_color_convert = __commonJS({ var convert = {}; var models = Object.keys(conversions); function wrapRaw(fn2) { - const wrappedFn = function(...args2) { - const arg0 = args2[0]; + const wrappedFn = function(...args3) { + const arg0 = args3[0]; if (arg0 === void 0 || arg0 === null) { return arg0; } if (arg0.length > 1) { - args2 = arg0; + args3 = arg0; } - return fn2(args2); + return fn2(args3); }; if ("conversion" in fn2) { wrappedFn.conversion = fn2.conversion; @@ -20856,15 +20856,15 @@ var require_color_convert = __commonJS({ return wrappedFn; } function wrapRounded(fn2) { - const wrappedFn = function(...args2) { - const arg0 = args2[0]; + const wrappedFn = function(...args3) { + const arg0 = args3[0]; if (arg0 === void 0 || arg0 === null) { return arg0; } if (arg0.length > 1) { - args2 = arg0; + args3 = arg0; } - const result = fn2(args2); + const result = fn2(args3); if (typeof result === "object") { for (let len = result.length, i = 0; i < len; i++) { result[i] = Math.round(result[i]); @@ -20897,16 +20897,16 @@ var require_color_convert = __commonJS({ var require_ansi_styles = __commonJS({ "node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js"(exports, module) { "use strict"; - var wrapAnsi16 = (fn2, offset) => (...args2) => { - const code = fn2(...args2); + var wrapAnsi16 = (fn2, offset) => (...args3) => { + const code = fn2(...args3); return `\x1B[${code + offset}m`; }; - var wrapAnsi256 = (fn2, offset) => (...args2) => { - const code = fn2(...args2); + var wrapAnsi256 = (fn2, offset) => (...args3) => { + const code = fn2(...args3); return `\x1B[${38 + offset};5;${code}m`; }; - var wrapAnsi16m = (fn2, offset) => (...args2) => { - const rgb = fn2(...args2); + var wrapAnsi16m = (fn2, offset) => (...args3) => { + const rgb = fn2(...args3); return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; }; var ansi2ansi = (n) => n; @@ -24900,7 +24900,7 @@ var require_createStream = __commonJS({ output = output.trimEnd(); process.stdout.write(output); }; - var append2 = (row, columnWidths, config2) => { + var append3 = (row, columnWidths, config2) => { const rows = prepareData([row], config2); const body = rows.map((literalRow) => { return (0, drawRow_1.drawRow)(literalRow, config2); @@ -24931,7 +24931,7 @@ var require_createStream = __commonJS({ empty = false; create(row, columnWidths, config2); } else { - append2(row, columnWidths, config2); + append3(row, columnWidths, config2); } } }; @@ -26145,24 +26145,24 @@ function processCreateParams3(params) { }; return { errorMap: customMap, description }; } -function timeRegexSource2(args2) { +function timeRegexSource2(args3) { let secondsRegexSource = `[0-5]\\d`; - if (args2.precision) { - secondsRegexSource = `${secondsRegexSource}\\.\\d{${args2.precision}}`; - } else if (args2.precision == null) { + if (args3.precision) { + secondsRegexSource = `${secondsRegexSource}\\.\\d{${args3.precision}}`; + } else if (args3.precision == null) { secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`; } - const secondsQuantifier = args2.precision ? "+" : "?"; + const secondsQuantifier = args3.precision ? "+" : "?"; return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`; } -function timeRegex2(args2) { - return new RegExp(`^${timeRegexSource2(args2)}$`); +function timeRegex2(args3) { + return new RegExp(`^${timeRegexSource2(args3)}$`); } -function datetimeRegex2(args2) { - let regex3 = `${dateRegexSource2}T${timeRegexSource2(args2)}`; +function datetimeRegex2(args3) { + let regex3 = `${dateRegexSource2}T${timeRegexSource2(args3)}`; const opts = []; - opts.push(args2.local ? `Z?` : `Z`); - if (args2.offset) + opts.push(args3.local ? `Z?` : `Z`); + if (args3.offset) opts.push(`([+-]\\d{2}:?\\d{2})`); regex3 = `${regex3}(${opts.join("|")})`; return new RegExp(`^${regex3}$`); @@ -28850,9 +28850,9 @@ var init_types = __esm({ }); return INVALID2; } - function makeArgsIssue(args2, error41) { + function makeArgsIssue(args3, error41) { return makeIssue2({ - data: args2, + data: args3, path: ctx.path, errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap2(), en_default2].filter((x) => !!x), issueData: { @@ -28876,10 +28876,10 @@ var init_types = __esm({ const fn2 = ctx.data; if (this._def.returns instanceof ZodPromise2) { const me = this; - return OK2(async function(...args2) { + return OK2(async function(...args3) { const error41 = new ZodError2([]); - const parsedArgs = await me._def.args.parseAsync(args2, params).catch((e) => { - error41.addIssue(makeArgsIssue(args2, e)); + const parsedArgs = await me._def.args.parseAsync(args3, params).catch((e) => { + error41.addIssue(makeArgsIssue(args3, e)); throw error41; }); const result = await Reflect.apply(fn2, this, parsedArgs); @@ -28891,10 +28891,10 @@ var init_types = __esm({ }); } else { const me = this; - return OK2(function(...args2) { - const parsedArgs = me._def.args.safeParse(args2, params); + return OK2(function(...args3) { + const parsedArgs = me._def.args.safeParse(args3, params); if (!parsedArgs.success) { - throw new ZodError2([makeArgsIssue(args2, parsedArgs.error)]); + throw new ZodError2([makeArgsIssue(args3, parsedArgs.error)]); } const result = Reflect.apply(fn2, this, parsedArgs.data); const parsedReturns = me._def.returns.safeParse(result, params); @@ -28931,9 +28931,9 @@ var init_types = __esm({ const validatedFunc = this.parse(func); return validatedFunc; } - static create(args2, returns, params) { + static create(args3, returns, params) { return new _ZodFunction({ - args: args2 ? args2 : ZodTuple2.create([]).rest(ZodUnknown2.create()), + args: args3 ? args3 : ZodTuple2.create([]).rest(ZodUnknown2.create()), returns: returns || ZodUnknown2.create(), typeName: ZodFirstPartyTypeKind2.ZodFunction, ...processCreateParams3(params) @@ -35731,8 +35731,8 @@ var require_ajv2 = __commonJS({ throw new Error("schema should be object or boolean"); var serialize = this._opts.serialize; var cacheKey = serialize ? serialize(schema2) : schema2; - var cached3 = this._cache.get(cacheKey); - if (cached3) return cached3; + var cached4 = this._cache.get(cacheKey); + if (cached4) return cached4; shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false; var id = resolve.normalizeId(this._getId(schema2)); if (id && shouldAddSchema) checkUnique(this, id); @@ -38077,8 +38077,8 @@ var require_dispatcher2 = __commonJS({ destroy() { throw new Error("not implemented"); } - compose(...args2) { - const interceptors = Array.isArray(args2[0]) ? args2[0] : args2; + compose(...args3) { + const interceptors = Array.isArray(args3[0]) ? args3[0] : args3; let dispatch = this.dispatch.bind(this); for (const interceptor of interceptors) { if (interceptor == null) { @@ -44483,8 +44483,8 @@ var require_balanced_pool2 = __commonJS({ pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]); this._updateBalancedPoolStats(); }); - pool.on("disconnect", (...args2) => { - const err = args2[2]; + pool.on("disconnect", (...args3) => { + const err = args3[2]; if (err && err.code === "UND_ERR_SOCKET") { pool[kWeight] = Math.max(1, pool[kWeight] - this[kErrorPenalty]); this._updateBalancedPoolStats(); @@ -48588,35 +48588,35 @@ var require_decorator_handler = __commonJS({ } this.#handler = WrapHandler.wrap(handler2); } - onRequestStart(...args2) { - this.#handler.onRequestStart?.(...args2); + onRequestStart(...args3) { + this.#handler.onRequestStart?.(...args3); } - onRequestUpgrade(...args2) { + onRequestUpgrade(...args3) { assert2(!this.#onCompleteCalled); assert2(!this.#onErrorCalled); - return this.#handler.onRequestUpgrade?.(...args2); + return this.#handler.onRequestUpgrade?.(...args3); } - onResponseStart(...args2) { + onResponseStart(...args3) { assert2(!this.#onCompleteCalled); assert2(!this.#onErrorCalled); assert2(!this.#onResponseStartCalled); this.#onResponseStartCalled = true; - return this.#handler.onResponseStart?.(...args2); + return this.#handler.onResponseStart?.(...args3); } - onResponseData(...args2) { + onResponseData(...args3) { assert2(!this.#onCompleteCalled); assert2(!this.#onErrorCalled); - return this.#handler.onResponseData?.(...args2); + return this.#handler.onResponseData?.(...args3); } - onResponseEnd(...args2) { + onResponseEnd(...args3) { assert2(!this.#onCompleteCalled); assert2(!this.#onErrorCalled); this.#onCompleteCalled = true; - return this.#handler.onResponseEnd?.(...args2); + return this.#handler.onResponseEnd?.(...args3); } - onResponseError(...args2) { + onResponseError(...args3) { this.#onErrorCalled = true; - return this.#handler.onResponseError?.(...args2); + return this.#handler.onResponseError?.(...args3); } /** * @deprecated @@ -57210,8 +57210,8 @@ var require_websocketerror = __commonJS({ return DOMException; } return new Proxy(DOMException, { - construct(target, args2, newTarget) { - const instance = Reflect.construct(target, args2, target); + construct(target, args3, newTarget) { + const instance = Reflect.construct(target, args3, target); Object.setPrototypeOf(instance, newTarget.prototype); return instance; } @@ -58771,26 +58771,26 @@ var require_uri_templates = __commonJS({ } }); -// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/arktype-C-GObzDh.js +// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/arktype-C-GObzDh.js var arktype_C_GObzDh_exports = {}; __export(arktype_C_GObzDh_exports, { getToJsonSchemaFn: () => getToJsonSchemaFn }); var getToJsonSchemaFn; var init_arktype_C_GObzDh = __esm({ - "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/arktype-C-GObzDh.js"() { + "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/arktype-C-GObzDh.js"() { getToJsonSchemaFn = async () => (schema2) => schema2.toJsonSchema(); } }); -// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/effect--zg3C1LQ.js +// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/effect--zg3C1LQ.js var effect_zg3C1LQ_exports = {}; __export(effect_zg3C1LQ_exports, { getToJsonSchemaFn: () => getToJsonSchemaFn2 }); var getToJsonSchemaFn2; var init_effect_zg3C1LQ = __esm({ - "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/effect--zg3C1LQ.js"() { + "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/effect--zg3C1LQ.js"() { init_index_CAcLDIRJ(); getToJsonSchemaFn2 = async () => { const { JSONSchema } = await tryImport(import("effect"), "effect"); @@ -58799,14 +58799,14 @@ var init_effect_zg3C1LQ = __esm({ } }); -// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/sury-s6Akl-oc.js +// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/sury-s6Akl-oc.js var sury_s6Akl_oc_exports = {}; __export(sury_s6Akl_oc_exports, { getToJsonSchemaFn: () => getToJsonSchemaFn3 }); var getToJsonSchemaFn3; var init_sury_s6Akl_oc = __esm({ - "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/sury-s6Akl-oc.js"() { + "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/sury-s6Akl-oc.js"() { init_index_CAcLDIRJ(); getToJsonSchemaFn3 = async () => { const { toJSONSchema: toJSONSchema2 } = await tryImport(import("sury"), "sury"); @@ -58815,14 +58815,14 @@ var init_sury_s6Akl_oc = __esm({ } }); -// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/valibot-DBCeetIe.js +// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/valibot-DBCeetIe.js var valibot_DBCeetIe_exports = {}; __export(valibot_DBCeetIe_exports, { getToJsonSchemaFn: () => getToJsonSchemaFn4 }); var getToJsonSchemaFn4; var init_valibot_DBCeetIe = __esm({ - "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/valibot-DBCeetIe.js"() { + "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/valibot-DBCeetIe.js"() { init_index_CAcLDIRJ(); getToJsonSchemaFn4 = async () => { const { toJsonSchema: toJsonSchema2 } = await tryImport(import("@valibot/to-json-schema"), "@valibot/to-json-schema"); @@ -58910,7 +58910,7 @@ __export(util_exports, { assertNever: () => assertNever, assertNotEqual: () => assertNotEqual, assignProp: () => assignProp, - cached: () => cached2, + cached: () => cached3, captureStackTrace: () => captureStackTrace, cleanEnum: () => cleanEnum, cleanRegex: () => cleanRegex, @@ -58975,7 +58975,7 @@ function jsonStringifyReplacer(_, value2) { return value2.toString(); return value2; } -function cached2(getter) { +function cached3(getter) { const set = false; return { get value() { @@ -59324,8 +59324,8 @@ function getLengthableOrigin(input) { return "string"; return "unknown"; } -function issue(...args2) { - const [iss, input, inst] = args2; +function issue(...args3) { + const [iss, input, inst] = args3; if (typeof iss === "string") { return { message: iss, @@ -59346,7 +59346,7 @@ var init_util2 = __esm({ "node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/util.js"() { captureStackTrace = Error.captureStackTrace ? Error.captureStackTrace : (..._args) => { }; - allowsEval = cached2(() => { + allowsEval = cached3(() => { if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) { return false; } @@ -59684,20 +59684,20 @@ __export(regexes_exports, { function emoji() { return new RegExp(_emoji, "u"); } -function timeSource(args2) { +function timeSource(args3) { const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`; - const regex3 = typeof args2.precision === "number" ? args2.precision === -1 ? `${hhmm}` : args2.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args2.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`; + const regex3 = typeof args3.precision === "number" ? args3.precision === -1 ? `${hhmm}` : args3.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args3.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`; return regex3; } -function time(args2) { - return new RegExp(`^${timeSource(args2)}$`); +function time(args3) { + return new RegExp(`^${timeSource(args3)}$`); } -function datetime(args2) { - const time2 = timeSource({ precision: args2.precision }); +function datetime(args3) { + const time2 = timeSource({ precision: args3.precision }); const opts = ["Z"]; - if (args2.local) + if (args3.local) opts.push(""); - if (args2.offset) + if (args3.offset) opts.push(`([+-]\\d{2}:\\d{2})`); const timeRegex4 = `${time2}(?:${opts.join("|")})`; return new RegExp(`^${dateSource}T(?:${timeRegex4})$`); @@ -60305,11 +60305,11 @@ var Doc; var init_doc = __esm({ "node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/doc.js"() { Doc = class { - constructor(args2 = []) { + constructor(args3 = []) { this.content = []; this.indent = 0; if (this) - this.args = args2; + this.args = args3; } indented(fn2) { this.indent += 1; @@ -60332,10 +60332,10 @@ var init_doc = __esm({ } compile() { const F = Function; - const args2 = this?.args; + const args3 = this?.args; const content = this?.content ?? [``]; const lines = [...content.map((x) => ` ${x}`)]; - return new F(...args2, lines.join("\n")); + return new F(...args3, lines.join("\n")); } }; } @@ -61171,7 +61171,7 @@ var init_schemas = __esm({ }); $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => { $ZodType.init(inst, def); - const _normalized = cached2(() => { + const _normalized = cached3(() => { const keys = Object.keys(def.shape); for (const k of keys) { if (!(def.shape[k] instanceof $ZodType)) { @@ -61391,7 +61391,7 @@ var init_schemas = __esm({ } return propValues; }); - const disc = cached2(() => { + const disc = cached3(() => { const opts = def.options; const map = /* @__PURE__ */ new Map(); for (const o of opts) { @@ -67980,8 +67980,8 @@ var init_function = __esm({ if (typeof func !== "function") { throw new Error("implement() must be called with a function"); } - const impl = ((...args2) => { - const parsedArgs = this._def.input ? parse3(this._def.input, args2, void 0, { callee: impl }) : args2; + const impl = ((...args3) => { + const parsedArgs = this._def.input ? parse3(this._def.input, args3, void 0, { callee: impl }) : args3; if (!Array.isArray(parsedArgs)) { throw new Error("Invalid arguments schema: not an array or tuple schema."); } @@ -67994,8 +67994,8 @@ var init_function = __esm({ if (typeof func !== "function") { throw new Error("implement() must be called with a function"); } - const impl = (async (...args2) => { - const parsedArgs = this._def.input ? await parseAsync(this._def.input, args2, void 0, { callee: impl }) : args2; + const impl = (async (...args3) => { + const parsedArgs = this._def.input ? await parseAsync(this._def.input, args3, void 0, { callee: impl }) : args3; if (!Array.isArray(parsedArgs)) { throw new Error("Invalid arguments schema: not an array or tuple schema."); } @@ -68004,22 +68004,22 @@ var init_function = __esm({ }); return impl; } - input(...args2) { + input(...args3) { const F = this.constructor; - if (Array.isArray(args2[0])) { + if (Array.isArray(args3[0])) { return new F({ type: "function", input: new $ZodTuple({ type: "tuple", - items: args2[0], - rest: args2[1] + items: args3[0], + rest: args3[1] }), output: this._def.output }); } return new F({ type: "function", - input: args2[0], + input: args3[0], output: this._def.output }); } @@ -70713,14 +70713,14 @@ var init_esm = __esm({ } }); -// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/zod-Bw_60DVU.js +// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/zod-Bw_60DVU.js var zod_Bw_60DVU_exports = {}; __export(zod_Bw_60DVU_exports, { getToJsonSchemaFn: () => getToJsonSchemaFn5 }); var getToJsonSchemaFn5; var init_zod_Bw_60DVU = __esm({ - "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/zod-Bw_60DVU.js"() { + "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/zod-Bw_60DVU.js"() { init_index_CAcLDIRJ(); getToJsonSchemaFn5 = async () => { let zodV4toJSONSchema = (_schema) => { @@ -70753,10 +70753,10 @@ var init_zod_Bw_60DVU = __esm({ } }); -// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/index-CAcLDIRJ.js +// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/index-CAcLDIRJ.js var missingDependenciesUrl, tryImport, getToJsonSchemaFn6, toJsonSchema; var init_index_CAcLDIRJ = __esm({ - "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/index-CAcLDIRJ.js"() { + "node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/index-CAcLDIRJ.js"() { missingDependenciesUrl = "https://xsai.js.org/docs/packages-top/xsschema#missing-dependencies"; tryImport = async (result, name) => { try { @@ -70789,20 +70789,6 @@ var init_index_CAcLDIRJ = __esm({ var core3 = __toESM(require_core(), 1); // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/arrays.js -var liftArray = (data) => Array.isArray(data) ? data : [data]; -var spliterate = (arr, predicate) => { - const result = [[], []]; - for (const item of arr) { - if (predicate(item)) - result[0].push(item); - else - result[1].push(item); - } - return result; -}; -var ReadonlyArray = Array; -var includes = (array, element) => array.includes(element); -var range = (length, offset = 0) => [...new Array(length)].map((_, i) => i + offset); var append = (to, value2, opts) => { if (to === void 0) { return value2 === void 0 ? [] : Array.isArray(value2) ? value2 : [value2]; @@ -70820,36 +70806,8 @@ var append = (to, value2, opts) => { } return to; }; -var conflatenate = (to, elementOrList) => { - if (elementOrList === void 0 || elementOrList === null) - return to ?? []; - if (to === void 0 || to === null) - return liftArray(elementOrList); - return to.concat(elementOrList); -}; -var conflatenateAll = (...elementsOrLists) => elementsOrLists.reduce(conflatenate, []); -var appendUnique = (to, value2, opts) => { - if (to === void 0) - return Array.isArray(value2) ? value2 : [value2]; - const isEqual = opts?.isEqual ?? ((l, r) => l === r); - for (const v of liftArray(value2)) - if (!to.some((existing) => isEqual(existing, v))) - to.push(v); - return to; -}; -var groupBy = (array, discriminant) => array.reduce((result, item) => { - const key = item[discriminant]; - result[key] = append(result[key], item); - return result; -}, {}); -var arrayEquals = (l, r, opts) => l.length === r.length && l.every(opts?.isEqual ? (lItem, i) => opts.isEqual(lItem, r[i]) : (lItem, i) => lItem === r[i]); // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/domain.js -var hasDomain = (data, kind) => domainOf(data) === kind; -var domainOf = (data) => { - const builtinType = typeof data; - return builtinType === "object" ? data === null ? "null" : "object" : builtinType === "function" ? "object" : builtinType; -}; var domainDescriptions = { boolean: "boolean", null: "null", @@ -70866,16 +70824,6 @@ var jsTypeOfDescriptions = { }; // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/errors.js -var InternalArktypeError = class extends Error { -}; -var throwInternalError = (message) => throwError(message, InternalArktypeError); -var throwError = (message, ctor = Error) => { - throw new ctor(message); -}; -var ParseError = class extends Error { - name = "ParseError"; -}; -var throwParseError = (message) => throwError(message, ParseError); var noSuggest = (s) => ` ${s}`; var ZeroWidthSpace = "\u200B"; @@ -70903,53 +70851,7 @@ var flatMorph = (o, flatMapEntry) => { }; // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/records.js -var entriesOf = Object.entries; -var isKeyOf = (k, o) => k in o; -var hasKey = (o, k) => k in o; -var DynamicBase = class { - constructor(properties) { - Object.assign(this, properties); - } -}; -var NoopBase = class { -}; -var CastableBase = class extends NoopBase { -}; -var splitByKeys = (o, leftKeys) => { - const l = {}; - const r = {}; - let k; - for (k in o) { - if (k in leftKeys) - l[k] = o[k]; - else - r[k] = o[k]; - } - return [l, r]; -}; -var omit = (o, keys) => splitByKeys(o, keys)[1]; -var isEmptyObject = (o) => Object.keys(o).length === 0; -var stringAndSymbolicEntriesOf = (o) => [ - ...Object.entries(o), - ...Object.getOwnPropertySymbols(o).map((k) => [k, o[k]]) -]; -var defineProperties = (base, merged) => ( - // declared like this to avoid https://github.com/microsoft/TypeScript/issues/55049 - Object.defineProperties(base, Object.getOwnPropertyDescriptors(merged)) -); -var withAlphabetizedKeys = (o) => { - const keys = Object.keys(o).sort(); - const result = {}; - for (let i = 0; i < keys.length; i++) - result[keys[i]] = o[keys[i]]; - return result; -}; var unset = noSuggest(`unset${ZeroWidthSpace}`); -var enumValues = (tsEnum) => Object.values(tsEnum).filter((v) => { - if (typeof v === "number") - return true; - return typeof tsEnum[v] !== "number"; -}); // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/objectKinds.js var ecmascriptConstructors = { @@ -70999,17 +70901,6 @@ var builtinConstructors = { Number, Boolean }; -var objectKindOf = (data) => { - let prototype = Object.getPrototypeOf(data); - while (prototype?.constructor && (!isKeyOf(prototype.constructor.name, builtinConstructors) || !(data instanceof builtinConstructors[prototype.constructor.name]))) - prototype = Object.getPrototypeOf(prototype); - const name = prototype?.constructor?.name; - if (name === void 0 || name === "Object") - return void 0; - return name; -}; -var objectKindOrDomainOf = (data) => typeof data === "object" && data !== null ? objectKindOf(data) ?? "object" : domainOf(data); -var isArray = Array.isArray; var ecmascriptDescriptions = { Array: "an array", Function: "a function", @@ -71053,73 +70944,12 @@ var objectKindDescriptions = { ...platformDescriptions, ...typedArrayDescriptions }; -var getBuiltinNameOfConstructor = (ctor) => { - const constructorName = Object(ctor).name ?? null; - return constructorName && isKeyOf(constructorName, builtinConstructors) && builtinConstructors[constructorName] === ctor ? constructorName : null; -}; -var constructorExtends = (ctor, base) => { - let current = ctor.prototype; - while (current !== null) { - if (current === base.prototype) - return true; - current = Object.getPrototypeOf(current); - } - return false; -}; - -// node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/clone.js -var deepClone = (input) => _clone(input, /* @__PURE__ */ new Map()); -var _clone = (input, seen) => { - if (typeof input !== "object" || input === null) - return input; - if (seen?.has(input)) - return seen.get(input); - const builtinConstructorName = getBuiltinNameOfConstructor(input.constructor); - if (builtinConstructorName === "Date") - return new Date(input.getTime()); - if (builtinConstructorName && builtinConstructorName !== "Array") - return input; - const cloned = Array.isArray(input) ? input.slice() : Object.create(Object.getPrototypeOf(input)); - const propertyDescriptors = Object.getOwnPropertyDescriptors(input); - if (seen) { - seen.set(input, cloned); - for (const k in propertyDescriptors) { - const desc = propertyDescriptors[k]; - if ("get" in desc || "set" in desc) - continue; - desc.value = _clone(desc.value, seen); - } - } - Object.defineProperties(cloned, propertyDescriptors); - return cloned; -}; // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/functions.js var cached = (thunk) => { let result = unset; return () => result === unset ? result = thunk() : result; }; -var isThunk = (value2) => typeof value2 === "function" && value2.length === 0; -var DynamicFunction = class extends Function { - constructor(...args2) { - const params = args2.slice(0, -1); - const body = args2.at(-1); - try { - super(...params, body); - } catch (e) { - return throwInternalError(`Encountered an unexpected error while compiling your definition: - Message: ${e} - Source: (${args2.slice(0, -1)}) => { - ${args2.at(-1)} - }`); - } - } -}; -var Callable = class { - constructor(fn2, ...[opts]) { - return Object.assign(Object.setPrototypeOf(fn2.bind(opts?.bind ?? this), this.constructor.prototype), opts?.attach); - } -}; var envHasCsp = cached(() => { try { return new Function("return false")(); @@ -71134,10 +70964,6 @@ var inferred = noSuggest("arkInferred"); // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/hkt.js var args = noSuggest("args"); -var Hkt = class { - constructor() { - } -}; // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/isomorphic.js var fileName = () => { @@ -71157,7 +70983,6 @@ var isomorphic = { }; // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/strings.js -var capitalize = (s) => s[0].toUpperCase() + s.slice(1); var anchoredRegex = (regex3) => new RegExp(anchoredSource(regex3), typeof regex3 === "string" ? "" : regex3.flags); var anchoredSource = (regex3) => { const source = typeof regex3 === "string" ? regex3 : regex3.source; @@ -71167,12 +70992,6 @@ var RegexPatterns = { negativeLookahead: (pattern) => `(?!${pattern})`, nonCapturingGroup: (pattern) => `(?:${pattern})` }; -var Backslash = "\\"; -var whitespaceChars = { - " ": 1, - "\n": 1, - " ": 1 -}; // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/numbers.js var anchoredNegativeZeroPattern = /^-0\.?0*$/.source; @@ -71190,52 +71009,10 @@ var numericStringMatcher = createNumberMatcher({ allowDecimalOnly: true }); var isNumericString = numericStringMatcher.test.bind(numericStringMatcher); -var numberLikeMatcher = /^-?\d*\.?\d*$/; -var isNumberLike = (s) => s.length !== 0 && numberLikeMatcher.test(s); var wellFormedIntegerMatcher = anchoredRegex(RegexPatterns.negativeLookahead("^-0$") + "-?" + RegexPatterns.nonCapturingGroup(RegexPatterns.nonCapturingGroup("0|" + positiveIntegerPattern))); var isWellFormedInteger = wellFormedIntegerMatcher.test.bind(wellFormedIntegerMatcher); var integerLikeMatcher = /^-?\d+$/; var isIntegerLike = integerLikeMatcher.test.bind(integerLikeMatcher); -var numericLiteralDescriptions = { - number: "a number", - bigint: "a bigint", - integer: "an integer" -}; -var writeMalformedNumericLiteralMessage = (def, kind) => `'${def}' was parsed as ${numericLiteralDescriptions[kind]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`; -var isWellFormed = (def, kind) => kind === "number" ? isWellFormedNumber(def) : isWellFormedInteger(def); -var parseKind = (def, kind) => kind === "number" ? Number(def) : Number.parseInt(def); -var isKindLike = (def, kind) => kind === "number" ? isNumberLike(def) : isIntegerLike(def); -var tryParseNumber = (token, options) => parseNumeric(token, "number", options); -var tryParseWellFormedNumber = (token, options) => parseNumeric(token, "number", { ...options, strict: true }); -var tryParseInteger = (token, options) => parseNumeric(token, "integer", options); -var parseNumeric = (token, kind, options) => { - const value2 = parseKind(token, kind); - if (!Number.isNaN(value2)) { - if (isKindLike(token, kind)) { - if (options?.strict) { - return isWellFormed(token, kind) ? value2 : throwParseError(writeMalformedNumericLiteralMessage(token, kind)); - } - return value2; - } - } - return options?.errorOnFail ? throwParseError(options?.errorOnFail === true ? `Failed to parse ${numericLiteralDescriptions[kind]} from '${token}'` : options?.errorOnFail) : void 0; -}; -var tryParseWellFormedBigint = (def) => { - if (def[def.length - 1] !== "n") - return; - const maybeIntegerLiteral = def.slice(0, -1); - let value2; - try { - value2 = BigInt(maybeIntegerLiteral); - } catch { - return; - } - if (wellFormedIntegerMatcher.test(maybeIntegerLiteral)) - return value2; - if (integerLikeMatcher.test(maybeIntegerLiteral)) { - return throwParseError(writeMalformedNumericLiteralMessage(def, "bigint")); - } -}; // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/registry.js var arkUtilVersion = "0.53.0"; @@ -71244,315 +71021,6 @@ var initialRegistryContents = { filename: isomorphic.fileName(), FileConstructor }; -var registry = initialRegistryContents; -var namesByResolution = /* @__PURE__ */ new Map(); -var nameCounts = /* @__PURE__ */ Object.create(null); -var register = (value2) => { - const existingName = namesByResolution.get(value2); - if (existingName) - return existingName; - let name = baseNameFor(value2); - if (nameCounts[name]) - name = `${name}${nameCounts[name]++}`; - else - nameCounts[name] = 1; - registry[name] = value2; - namesByResolution.set(value2, name); - return name; -}; -var isDotAccessible = (keyName) => /^[$A-Z_a-z][\w$]*$/.test(keyName); -var baseNameFor = (value2) => { - switch (typeof value2) { - case "object": { - if (value2 === null) - break; - const prefix = objectKindOf(value2) ?? "object"; - return prefix[0].toLowerCase() + prefix.slice(1); - } - case "function": - return isDotAccessible(value2.name) ? value2.name : "fn"; - case "symbol": - return value2.description && isDotAccessible(value2.description) ? value2.description : "symbol"; - } - return throwInternalError(`Unexpected attempt to register serializable value of type ${domainOf(value2)}`); -}; - -// node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/primitive.js -var serializePrimitive = (value2) => typeof value2 === "string" ? JSON.stringify(value2) : typeof value2 === "bigint" ? `${value2}n` : `${value2}`; - -// node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/serialize.js -var snapshot = (data, opts = {}) => _serialize(data, { - onUndefined: `$ark.undefined`, - onBigInt: (n) => `$ark.bigint-${n}`, - ...opts -}, []); -var printable = (data, opts) => { - switch (domainOf(data)) { - case "object": - const o = data; - const ctorName = o.constructor.name; - return ctorName === "Object" || ctorName === "Array" ? opts?.quoteKeys === false ? stringifyUnquoted(o, opts?.indent ?? 0, "") : JSON.stringify(_serialize(o, printableOpts, []), null, opts?.indent) : stringifyUnquoted(o, opts?.indent ?? 0, ""); - case "symbol": - return printableOpts.onSymbol(data); - default: - return serializePrimitive(data); - } -}; -var stringifyUnquoted = (value2, indent2, currentIndent) => { - if (typeof value2 === "function") - return printableOpts.onFunction(value2); - if (typeof value2 !== "object" || value2 === null) - return serializePrimitive(value2); - const nextIndent = currentIndent + " ".repeat(indent2); - if (Array.isArray(value2)) { - if (value2.length === 0) - return "[]"; - const items = value2.map((item) => stringifyUnquoted(item, indent2, nextIndent)).join(",\n" + nextIndent); - return indent2 ? `[ -${nextIndent}${items} -${currentIndent}]` : `[${items}]`; - } - const ctorName = value2.constructor.name; - if (ctorName === "Object") { - const keyValues = stringAndSymbolicEntriesOf(value2).map(([key, val]) => { - const stringifiedKey = typeof key === "symbol" ? printableOpts.onSymbol(key) : isDotAccessible(key) ? key : JSON.stringify(key); - const stringifiedValue = stringifyUnquoted(val, indent2, nextIndent); - return `${nextIndent}${stringifiedKey}: ${stringifiedValue}`; - }); - if (keyValues.length === 0) - return "{}"; - return indent2 ? `{ -${keyValues.join(",\n")} -${currentIndent}}` : `{${keyValues.join(", ")}}`; - } - if (value2 instanceof Date) - return describeCollapsibleDate(value2); - if ("expression" in value2 && typeof value2.expression === "string") - return value2.expression; - return ctorName; -}; -var printableOpts = { - onCycle: () => "(cycle)", - onSymbol: (v) => `Symbol(${register(v)})`, - onFunction: (v) => `Function(${register(v)})` -}; -var _serialize = (data, opts, seen) => { - switch (domainOf(data)) { - case "object": { - const o = data; - if ("toJSON" in o && typeof o.toJSON === "function") - return o.toJSON(); - if (typeof o === "function") - return printableOpts.onFunction(o); - if (seen.includes(o)) - return "(cycle)"; - const nextSeen = [...seen, o]; - if (Array.isArray(o)) - return o.map((item) => _serialize(item, opts, nextSeen)); - if (o instanceof Date) - return o.toDateString(); - const result = {}; - for (const k in o) - result[k] = _serialize(o[k], opts, nextSeen); - for (const s of Object.getOwnPropertySymbols(o)) { - result[opts.onSymbol?.(s) ?? s.toString()] = _serialize(o[s], opts, nextSeen); - } - return result; - } - case "symbol": - return printableOpts.onSymbol(data); - case "bigint": - return opts.onBigInt?.(data) ?? `${data}n`; - case "undefined": - return opts.onUndefined ?? "undefined"; - case "string": - return data.replaceAll("\\", "\\\\"); - default: - return data; - } -}; -var describeCollapsibleDate = (date2) => { - const year = date2.getFullYear(); - const month = date2.getMonth(); - const dayOfMonth = date2.getDate(); - const hours = date2.getHours(); - const minutes = date2.getMinutes(); - const seconds = date2.getSeconds(); - const milliseconds = date2.getMilliseconds(); - if (month === 0 && dayOfMonth === 1 && hours === 0 && minutes === 0 && seconds === 0 && milliseconds === 0) - return `${year}`; - const datePortion = `${months[month]} ${dayOfMonth}, ${year}`; - if (hours === 0 && minutes === 0 && seconds === 0 && milliseconds === 0) - return datePortion; - let timePortion = date2.toLocaleTimeString(); - const suffix2 = timePortion.endsWith(" AM") || timePortion.endsWith(" PM") ? timePortion.slice(-3) : ""; - if (suffix2) - timePortion = timePortion.slice(0, -suffix2.length); - if (milliseconds) - timePortion += `.${pad(milliseconds, 3)}`; - else if (timeWithUnnecessarySeconds.test(timePortion)) - timePortion = timePortion.slice(0, -3); - return `${timePortion + suffix2}, ${datePortion}`; -}; -var months = [ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December" -]; -var timeWithUnnecessarySeconds = /:\d\d:00$/; -var pad = (value2, length) => String(value2).padStart(length, "0"); - -// node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/path.js -var appendStringifiedKey = (path3, prop, ...[opts]) => { - const stringifySymbol = opts?.stringifySymbol ?? printable; - let propAccessChain = path3; - switch (typeof prop) { - case "string": - propAccessChain = isDotAccessible(prop) ? path3 === "" ? prop : `${path3}.${prop}` : `${path3}[${JSON.stringify(prop)}]`; - break; - case "number": - propAccessChain = `${path3}[${prop}]`; - break; - case "symbol": - propAccessChain = `${path3}[${stringifySymbol(prop)}]`; - break; - default: - if (opts?.stringifyNonKey) - propAccessChain = `${path3}[${opts.stringifyNonKey(prop)}]`; - else { - throwParseError(`${printable(prop)} must be a PropertyKey or stringifyNonKey must be passed to options`); - } - } - return propAccessChain; -}; -var stringifyPath = (path3, ...opts) => path3.reduce((s, k) => appendStringifiedKey(s, k, ...opts), ""); -var ReadonlyPath = class extends ReadonlyArray { - // alternate strategy for caching since the base object is frozen - cache = {}; - constructor(...items) { - super(); - this.push(...items); - } - toJSON() { - if (this.cache.json) - return this.cache.json; - this.cache.json = []; - for (let i = 0; i < this.length; i++) { - this.cache.json.push(typeof this[i] === "symbol" ? printable(this[i]) : this[i]); - } - return this.cache.json; - } - stringify() { - if (this.cache.stringify) - return this.cache.stringify; - return this.cache.stringify = stringifyPath(this); - } - stringifyAncestors() { - if (this.cache.stringifyAncestors) - return this.cache.stringifyAncestors; - let propString = ""; - const result = [propString]; - for (const path3 of this) { - propString = appendStringifiedKey(propString, path3); - result.push(propString); - } - return this.cache.stringifyAncestors = result; - } -}; - -// node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/scanner.js -var Scanner = class { - chars; - i; - def; - constructor(def) { - this.def = def; - this.chars = [...def]; - this.i = 0; - } - /** Get lookahead and advance scanner by one */ - shift() { - return this.chars[this.i++] ?? ""; - } - get lookahead() { - return this.chars[this.i] ?? ""; - } - get nextLookahead() { - return this.chars[this.i + 1] ?? ""; - } - get length() { - return this.chars.length; - } - shiftUntil(condition) { - let shifted = ""; - while (this.lookahead) { - if (condition(this, shifted)) - break; - else - shifted += this.shift(); - } - return shifted; - } - shiftUntilEscapable(condition) { - let shifted = ""; - while (this.lookahead) { - if (this.lookahead === Backslash) { - this.shift(); - if (condition(this, shifted)) - shifted += this.shift(); - else if (this.lookahead === Backslash) - shifted += this.shift(); - else - shifted += `${Backslash}${this.shift()}`; - } else if (condition(this, shifted)) - break; - else - shifted += this.shift(); - } - return shifted; - } - shiftUntilLookahead(charOrSet) { - return typeof charOrSet === "string" ? this.shiftUntil((s) => s.lookahead === charOrSet) : this.shiftUntil((s) => s.lookahead in charOrSet); - } - shiftUntilNonWhitespace() { - return this.shiftUntil(() => !(this.lookahead in whitespaceChars)); - } - jumpToIndex(i) { - this.i = i < 0 ? this.length + i : i; - } - jumpForward(count) { - this.i += count; - } - get location() { - return this.i; - } - get unscanned() { - return this.chars.slice(this.i, this.length).join(""); - } - get scanned() { - return this.chars.slice(0, this.i).join(""); - } - sliceChars(start, end) { - return this.chars.slice(start, end).join(""); - } - lookaheadIs(char) { - return this.lookahead === char; - } - lookaheadIsIn(tokens) { - return this.lookahead in tokens; - } -}; -var writeUnmatchedGroupCloseMessage = (char, unscanned) => `Unmatched ${char}${unscanned === "" ? "" : ` before ${unscanned}`}`; -var writeUnclosedGroupMessage = (missingChar) => `Missing ${missingChar}`; // node_modules/.pnpm/@ark+util@0.53.0/node_modules/@ark/util/out/traits.js var implementedTraits = noSuggest("implementedTraits"); @@ -77504,9 +76972,9 @@ var require_ajv = __commonJS2((exports, module) => { throw new Error("schema should be object or boolean"); var serialize = this._opts.serialize; var cacheKey = serialize ? serialize(schema2) : schema2; - var cached3 = this._cache.get(cacheKey); - if (cached3) - return cached3; + var cached4 = this._cache.get(cacheKey); + if (cached4) + return cached4; shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false; var id = resolve.normalizeId(this._getId(schema2)); if (id && shouldAddSchema) @@ -77820,7 +77288,7 @@ var ProcessTransport = class { executableArgs = [], extraArgs = {}, pathToClaudeCodeExecutable, - env: env2 = { ...process.env }, + env: env3 = { ...process.env }, stderr, customSystemPrompt, appendSystemPrompt, @@ -77843,7 +77311,7 @@ var ProcessTransport = class { includePartialMessages, plugins } = this.options; - const args2 = [ + const args3 = [ "--output-format", "stream-json", "--verbose", @@ -77851,93 +77319,93 @@ var ProcessTransport = class { "stream-json" ]; if (typeof customSystemPrompt === "string") - args2.push("--system-prompt", customSystemPrompt); + args3.push("--system-prompt", customSystemPrompt); if (appendSystemPrompt) - args2.push("--append-system-prompt", appendSystemPrompt); + args3.push("--append-system-prompt", appendSystemPrompt); if (maxThinkingTokens !== void 0) { - args2.push("--max-thinking-tokens", maxThinkingTokens.toString()); + args3.push("--max-thinking-tokens", maxThinkingTokens.toString()); } if (maxTurns) - args2.push("--max-turns", maxTurns.toString()); + args3.push("--max-turns", maxTurns.toString()); if (maxBudgetUsd !== void 0) { - args2.push("--max-budget-usd", maxBudgetUsd.toString()); + args3.push("--max-budget-usd", maxBudgetUsd.toString()); } if (model) - args2.push("--model", model); - if (env2.DEBUG) - args2.push("--debug-to-stderr"); + args3.push("--model", model); + if (env3.DEBUG) + args3.push("--debug-to-stderr"); if (canUseTool) { if (permissionPromptToolName) { throw new Error("canUseTool callback cannot be used with permissionPromptToolName. Please use one or the other."); } - args2.push("--permission-prompt-tool", "stdio"); + args3.push("--permission-prompt-tool", "stdio"); } else if (permissionPromptToolName) { - args2.push("--permission-prompt-tool", permissionPromptToolName); + args3.push("--permission-prompt-tool", permissionPromptToolName); } if (continueConversation) - args2.push("--continue"); + args3.push("--continue"); if (resume) - args2.push("--resume", resume); + args3.push("--resume", resume); if (allowedTools.length > 0) { - args2.push("--allowedTools", allowedTools.join(",")); + args3.push("--allowedTools", allowedTools.join(",")); } if (disallowedTools.length > 0) { - args2.push("--disallowedTools", disallowedTools.join(",")); + args3.push("--disallowedTools", disallowedTools.join(",")); } if (mcpServers && Object.keys(mcpServers).length > 0) { - args2.push("--mcp-config", JSON.stringify({ mcpServers })); + args3.push("--mcp-config", JSON.stringify({ mcpServers })); } if (agents2 && Object.keys(agents2).length > 0) { - args2.push("--agents", JSON.stringify(agents2)); + args3.push("--agents", JSON.stringify(agents2)); } if (settingSources) { - args2.push("--setting-sources", settingSources.join(",")); + args3.push("--setting-sources", settingSources.join(",")); } if (strictMcpConfig) { - args2.push("--strict-mcp-config"); + args3.push("--strict-mcp-config"); } if (permissionMode) { - args2.push("--permission-mode", permissionMode); + args3.push("--permission-mode", permissionMode); } if (allowDangerouslySkipPermissions) { - args2.push("--allow-dangerously-skip-permissions"); + args3.push("--allow-dangerously-skip-permissions"); } if (fallbackModel) { if (model && fallbackModel === model) { throw new Error("Fallback model cannot be the same as the main model. Please specify a different model for fallbackModel option."); } - args2.push("--fallback-model", fallbackModel); + args3.push("--fallback-model", fallbackModel); } if (includePartialMessages) { - args2.push("--include-partial-messages"); + args3.push("--include-partial-messages"); } for (const dir of additionalDirectories) { - args2.push("--add-dir", dir); + args3.push("--add-dir", dir); } if (plugins && plugins.length > 0) { for (const plugin of plugins) { if (plugin.type === "local") { - args2.push("--plugin-dir", plugin.path); + args3.push("--plugin-dir", plugin.path); } else { throw new Error(`Unsupported plugin type: ${plugin.type}`); } } } if (this.options.forkSession) { - args2.push("--fork-session"); + args3.push("--fork-session"); } if (this.options.resumeSessionAt) { - args2.push("--resume-session-at", this.options.resumeSessionAt); + args3.push("--resume-session-at", this.options.resumeSessionAt); } for (const [flag, value2] of Object.entries(extraArgs)) { if (value2 === null) { - args2.push(`--${flag}`); + args3.push(`--${flag}`); } else { - args2.push(`--${flag}`, value2); + args3.push(`--${flag}`, value2); } } - if (!env2.CLAUDE_CODE_ENTRYPOINT) { - env2.CLAUDE_CODE_ENTRYPOINT = "sdk-ts"; + if (!env3.CLAUDE_CODE_ENTRYPOINT) { + env3.CLAUDE_CODE_ENTRYPOINT = "sdk-ts"; } const fs22 = getFsImplementation(); if (!fs22.existsSync(pathToClaudeCodeExecutable)) { @@ -77946,18 +77414,18 @@ var ProcessTransport = class { } const isNative = isNativeBinary(pathToClaudeCodeExecutable); const spawnCommand = isNative ? pathToClaudeCodeExecutable : executable; - const spawnArgs = isNative ? [...executableArgs, ...args2] : [...executableArgs, pathToClaudeCodeExecutable, ...args2]; + const spawnArgs = isNative ? [...executableArgs, ...args3] : [...executableArgs, pathToClaudeCodeExecutable, ...args3]; this.logForDebugging(isNative ? `Spawning Claude Code native binary: ${spawnCommand} ${spawnArgs.join(" ")}` : `Spawning Claude Code process: ${spawnCommand} ${spawnArgs.join(" ")}`); - const stderrMode = env2.DEBUG || stderr ? "pipe" : "ignore"; + const stderrMode = env3.DEBUG || stderr ? "pipe" : "ignore"; this.child = spawn(spawnCommand, spawnArgs, { cwd: cwd2, stdio: ["pipe", "pipe", stderrMode], signal: this.abortController.signal, - env: env2 + env: env3 }); this.childStdin = this.child.stdin; this.childStdout = this.child.stdout; - if (env2.DEBUG || stderr) { + if (env3.DEBUG || stderr) { this.child.stderr.on("data", (data) => { this.logForDebugging(data.toString()); }); @@ -78556,11 +78024,11 @@ function memoize(func, resolver) { throw new TypeError(FUNC_ERROR_TEXT); } var memoized = function() { - var args2 = arguments, key = resolver ? resolver.apply(this, args2) : args2[0], cache = memoized.cache; + var args3 = arguments, key = resolver ? resolver.apply(this, args3) : args3[0], cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } - var result = func.apply(this, args2); + var result = func.apply(this, args3); memoized.cache = cache.set(key, result) || cache; return result; }; @@ -80155,24 +79623,24 @@ var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=) var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/; var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`; var dateRegex = new RegExp(`^${dateRegexSource}$`); -function timeRegexSource(args2) { +function timeRegexSource(args3) { let secondsRegexSource = `[0-5]\\d`; - if (args2.precision) { - secondsRegexSource = `${secondsRegexSource}\\.\\d{${args2.precision}}`; - } else if (args2.precision == null) { + if (args3.precision) { + secondsRegexSource = `${secondsRegexSource}\\.\\d{${args3.precision}}`; + } else if (args3.precision == null) { secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`; } - const secondsQuantifier = args2.precision ? "+" : "?"; + const secondsQuantifier = args3.precision ? "+" : "?"; return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`; } -function timeRegex(args2) { - return new RegExp(`^${timeRegexSource(args2)}$`); +function timeRegex(args3) { + return new RegExp(`^${timeRegexSource(args3)}$`); } -function datetimeRegex(args2) { - let regex3 = `${dateRegexSource}T${timeRegexSource(args2)}`; +function datetimeRegex(args3) { + let regex3 = `${dateRegexSource}T${timeRegexSource(args3)}`; const opts = []; - opts.push(args2.local ? `Z?` : `Z`); - if (args2.offset) + opts.push(args3.local ? `Z?` : `Z`); + if (args3.offset) opts.push(`([+-]\\d{2}:?\\d{2})`); regex3 = `${regex3}(${opts.join("|")})`; return new RegExp(`^${regex3}$`); @@ -82385,9 +81853,9 @@ var ZodFunction = class _ZodFunction extends ZodType { }); return INVALID; } - function makeArgsIssue(args2, error41) { + function makeArgsIssue(args3, error41) { return makeIssue({ - data: args2, + data: args3, path: ctx.path, errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x), issueData: { @@ -82411,10 +81879,10 @@ var ZodFunction = class _ZodFunction extends ZodType { const fn2 = ctx.data; if (this._def.returns instanceof ZodPromise) { const me = this; - return OK(async function(...args2) { + return OK(async function(...args3) { const error41 = new ZodError([]); - const parsedArgs = await me._def.args.parseAsync(args2, params).catch((e) => { - error41.addIssue(makeArgsIssue(args2, e)); + const parsedArgs = await me._def.args.parseAsync(args3, params).catch((e) => { + error41.addIssue(makeArgsIssue(args3, e)); throw error41; }); const result = await Reflect.apply(fn2, this, parsedArgs); @@ -82426,10 +81894,10 @@ var ZodFunction = class _ZodFunction extends ZodType { }); } else { const me = this; - return OK(function(...args2) { - const parsedArgs = me._def.args.safeParse(args2, params); + return OK(function(...args3) { + const parsedArgs = me._def.args.safeParse(args3, params); if (!parsedArgs.success) { - throw new ZodError([makeArgsIssue(args2, parsedArgs.error)]); + throw new ZodError([makeArgsIssue(args3, parsedArgs.error)]); } const result = Reflect.apply(fn2, this, parsedArgs.data); const parsedReturns = me._def.returns.safeParse(result, params); @@ -82466,9 +81934,9 @@ var ZodFunction = class _ZodFunction extends ZodType { const validatedFunc = this.parse(func); return validatedFunc; } - static create(args2, returns, params) { + static create(args3, returns, params) { return new _ZodFunction({ - args: args2 ? args2 : ZodTuple.create([]).rest(ZodUnknown.create()), + args: args3 ? args3 : ZodTuple.create([]).rest(ZodUnknown.create()), returns: returns || ZodUnknown.create(), typeName: ZodFirstPartyTypeKind.ZodFunction, ...processCreateParams(params) @@ -83755,7 +83223,7 @@ function query({ continue: continueConversation, cwd: cwd2, disallowedTools = [], - env: env2, + env: env3, executable = isRunningWithBun() ? "bun" : "node", executableArgs = [], extraArgs = {}, @@ -83777,7 +83245,7 @@ function query({ stderr, strictMcpConfig } = rest; - let processEnv = env2; + let processEnv = env3; if (!processEnv) { processEnv = { ...process.env }; } @@ -83859,7 +83327,7 @@ function query({ // package.json var package_default = { name: "@pullfrog/action", - version: "0.0.128", + version: "0.0.129", type: "module", files: [ "index.js", @@ -83936,21 +83404,6 @@ var core = __toESM(require_core(), 1); var import_table = __toESM(require_src(), 1); var isGitHubActions = !!process.env.GITHUB_ACTIONS; var isDebugEnabled = () => process.env.LOG_LEVEL === "debug"; -function getTerminalWidth() { - if (process.stdout.columns && process.stdout.columns > 0) { - return process.stdout.columns; - } - return 120; -} -function truncateLine(line, maxLength) { - if (line.length <= maxLength) { - return line; - } - if (maxLength <= 3) { - return "...".slice(0, maxLength); - } - return line.slice(0, maxLength - 3) + "..."; -} function startGroup2(name) { if (isGitHubActions) { core.startGroup(name); @@ -83966,12 +83419,39 @@ function endGroup2() { } } function boxString(text, options) { - const terminalWidth = getTerminalWidth(); - const { title, maxWidth = terminalWidth, indent: indent2 = "", padding = 1 } = options || {}; - const maxContentWidth = maxWidth - 2 - padding * 2; + const { title, maxWidth = 80, indent: indent2 = "", padding = 1 } = options || {}; const lines = text.trim().split("\n"); - const truncatedLines = lines.map((line) => truncateLine(line, maxContentWidth)); - const maxLineLength = Math.max(...truncatedLines.map((line) => line.length)); + const wrappedLines = []; + for (const line of lines) { + if (line.length <= maxWidth - padding * 2) { + wrappedLines.push(line); + } else { + const words = line.split(" "); + let currentLine = ""; + for (const word of words) { + const testLine = currentLine ? `${currentLine} ${word}` : word; + if (testLine.length <= maxWidth - padding * 2) { + currentLine = testLine; + } else { + if (currentLine) { + wrappedLines.push(currentLine); + currentLine = ""; + } + const maxLineLength2 = maxWidth - padding * 2; + let remainingWord = word; + while (remainingWord.length > maxLineLength2) { + wrappedLines.push(remainingWord.substring(0, maxLineLength2)); + remainingWord = remainingWord.substring(maxLineLength2); + } + currentLine = remainingWord; + } + } + if (currentLine) { + wrappedLines.push(currentLine); + } + } + } + const maxLineLength = Math.max(...wrappedLines.map((line) => line.length)); const contentBoxWidth = maxLineLength + padding * 2; const titleLineLength = title ? ` ${title} `.length : 0; const boxWidth = Math.max(contentBoxWidth, titleLineLength); @@ -83986,7 +83466,7 @@ function boxString(text, options) { result += `${indent2}\u250C${"\u2500".repeat(boxWidth)}\u2510 `; } - for (const line of truncatedLines) { + for (const line of wrappedLines) { const paddedLine = line.padEnd(maxLineLength); result += `${indent2}\u2502${" ".repeat(padding)}${paddedLine}${" ".repeat(padding)}\u2502 `; @@ -84243,7 +83723,7 @@ function isJsonArray(value2) { function isJsonObject(value2) { return value2 !== null && typeof value2 === "object" && !Array.isArray(value2); } -function isEmptyObject2(value2) { +function isEmptyObject(value2) { return Object.keys(value2).length === 0; } function isPlainObject(value2) { @@ -84314,7 +83794,7 @@ function collectSingleKeyChain(startKey, startValue, maxDepth) { segments.push(nextKey); currentValue = nextValue; } - if (!isJsonObject(currentValue) || isEmptyObject2(currentValue)) return { + if (!isJsonObject(currentValue) || isEmptyObject(currentValue)) return { segments, tail: void 0, leafValue: currentValue @@ -84404,7 +83884,7 @@ function encodeKeyValuePair(key, value2, writer, depth, options, siblings, rootL } else if (isJsonArray(leafValue)) { encodeArray(foldedKey, leafValue, writer, depth, options); return; - } else if (isJsonObject(leafValue) && isEmptyObject2(leafValue)) { + } else if (isJsonObject(leafValue) && isEmptyObject(leafValue)) { writer.push(depth, `${encodedFoldedKey}:`); return; } @@ -84423,7 +83903,7 @@ function encodeKeyValuePair(key, value2, writer, depth, options, siblings, rootL else if (isJsonArray(value2)) encodeArray(key, value2, writer, depth, options); else if (isJsonObject(value2)) { writer.push(depth, `${encodedKey}:`); - if (!isEmptyObject2(value2)) encodeObject(value2, writer, depth + 1, options, rootLiteralKeys, currentPath, effectiveFlattenDepth); + if (!isEmptyObject(value2)) encodeObject(value2, writer, depth + 1, options, rootLiteralKeys, currentPath, effectiveFlattenDepth); } } function encodeArray(key, value2, writer, depth, options) { @@ -84515,7 +83995,7 @@ function encodeMixedArrayAsListItems(prefix, items, writer, depth, options) { for (const item of items) encodeListItemValue(item, writer, depth + 1, options); } function encodeObjectAsListItem(obj, writer, depth, options) { - if (isEmptyObject2(obj)) { + if (isEmptyObject(obj)) { writer.push(depth, LIST_ITEM_MARKER); return; } @@ -84546,7 +84026,7 @@ function encodeObjectAsListItem(obj, writer, depth, options) { } else if (isJsonObject(firstValue)) { writer.pushListItem(depth, `${encodedKey}:`); - if (!isEmptyObject2(firstValue)) encodeObject(firstValue, writer, depth + 2, options); + if (!isEmptyObject(firstValue)) encodeObject(firstValue, writer, depth + 2, options); } for (let i = 1; i < entries.length; i++) { const [key, value2] = entries[i]; @@ -84572,7 +84052,777 @@ function resolveOptions(options) { }; } -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/shared/registry.js +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/arrays.js +var liftArray = (data) => Array.isArray(data) ? data : [data]; +var spliterate = (arr, predicate) => { + const result = [[], []]; + for (const item of arr) { + if (predicate(item)) + result[0].push(item); + else + result[1].push(item); + } + return result; +}; +var ReadonlyArray2 = Array; +var includes = (array, element) => array.includes(element); +var range = (length, offset = 0) => [...new Array(length)].map((_, i) => i + offset); +var append2 = (to, value2, opts) => { + if (to === void 0) { + return value2 === void 0 ? [] : Array.isArray(value2) ? value2 : [value2]; + } + if (opts?.prepend) { + if (Array.isArray(value2)) + to.unshift(...value2); + else + to.unshift(value2); + } else { + if (Array.isArray(value2)) + to.push(...value2); + else + to.push(value2); + } + return to; +}; +var conflatenate = (to, elementOrList) => { + if (elementOrList === void 0 || elementOrList === null) + return to ?? []; + if (to === void 0 || to === null) + return liftArray(elementOrList); + return to.concat(elementOrList); +}; +var conflatenateAll = (...elementsOrLists) => elementsOrLists.reduce(conflatenate, []); +var appendUnique = (to, value2, opts) => { + if (to === void 0) + return Array.isArray(value2) ? value2 : [value2]; + const isEqual = opts?.isEqual ?? ((l, r) => l === r); + for (const v of liftArray(value2)) + if (!to.some((existing) => isEqual(existing, v))) + to.push(v); + return to; +}; +var groupBy = (array, discriminant) => array.reduce((result, item) => { + const key = item[discriminant]; + result[key] = append2(result[key], item); + return result; +}, {}); +var arrayEquals = (l, r, opts) => l.length === r.length && l.every(opts?.isEqual ? (lItem, i) => opts.isEqual(lItem, r[i]) : (lItem, i) => lItem === r[i]); + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/domain.js +var hasDomain2 = (data, kind) => domainOf2(data) === kind; +var domainOf2 = (data) => { + const builtinType = typeof data; + return builtinType === "object" ? data === null ? "null" : "object" : builtinType === "function" ? "object" : builtinType; +}; +var domainDescriptions2 = { + boolean: "boolean", + null: "null", + undefined: "undefined", + bigint: "a bigint", + number: "a number", + object: "an object", + string: "a string", + symbol: "a symbol" +}; +var jsTypeOfDescriptions2 = { + ...domainDescriptions2, + function: "a function" +}; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/errors.js +var InternalArktypeError = class extends Error { +}; +var throwInternalError2 = (message) => throwError(message, InternalArktypeError); +var throwError = (message, ctor = Error) => { + throw new ctor(message); +}; +var ParseError = class extends Error { + name = "ParseError"; +}; +var throwParseError2 = (message) => throwError(message, ParseError); +var noSuggest2 = (s) => ` ${s}`; +var ZeroWidthSpace2 = "\u200B"; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/flatMorph.js +var flatMorph2 = (o, flatMapEntry) => { + const result = {}; + const inputIsArray = Array.isArray(o); + let outputShouldBeArray = false; + for (const [i, entry] of Object.entries(o).entries()) { + const mapped = inputIsArray ? flatMapEntry(i, entry[1]) : flatMapEntry(...entry, i); + outputShouldBeArray ||= typeof mapped[0] === "number"; + const flattenedEntries = Array.isArray(mapped[0]) || mapped.length === 0 ? ( + // if we have an empty array (for filtering) or an array with + // another array as its first element, treat it as a list + mapped + ) : [mapped]; + for (const [k, v] of flattenedEntries) { + if (typeof k === "object") + result[k.group] = append2(result[k.group], v); + else + result[k] = v; + } + } + return outputShouldBeArray ? Object.values(result) : result; +}; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/records.js +var entriesOf = Object.entries; +var isKeyOf2 = (k, o) => k in o; +var hasKey = (o, k) => k in o; +var DynamicBase = class { + constructor(properties) { + Object.assign(this, properties); + } +}; +var NoopBase2 = class { +}; +var CastableBase = class extends NoopBase2 { +}; +var splitByKeys = (o, leftKeys) => { + const l = {}; + const r = {}; + let k; + for (k in o) { + if (k in leftKeys) + l[k] = o[k]; + else + r[k] = o[k]; + } + return [l, r]; +}; +var omit = (o, keys) => splitByKeys(o, keys)[1]; +var isEmptyObject2 = (o) => Object.keys(o).length === 0; +var stringAndSymbolicEntriesOf2 = (o) => [ + ...Object.entries(o), + ...Object.getOwnPropertySymbols(o).map((k) => [k, o[k]]) +]; +var defineProperties = (base, merged) => ( + // declared like this to avoid https://github.com/microsoft/TypeScript/issues/55049 + Object.defineProperties(base, Object.getOwnPropertyDescriptors(merged)) +); +var withAlphabetizedKeys = (o) => { + const keys = Object.keys(o).sort(); + const result = {}; + for (let i = 0; i < keys.length; i++) + result[keys[i]] = o[keys[i]]; + return result; +}; +var unset2 = noSuggest2(`unset${ZeroWidthSpace2}`); +var enumValues = (tsEnum) => Object.values(tsEnum).filter((v) => { + if (typeof v === "number") + return true; + return typeof tsEnum[v] !== "number"; +}); + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/objectKinds.js +var ecmascriptConstructors2 = { + Array, + Boolean, + Date, + Error, + Function, + Map, + Number, + Promise, + RegExp, + Set, + String, + WeakMap, + WeakSet +}; +var FileConstructor2 = globalThis.File ?? Blob; +var platformConstructors2 = { + ArrayBuffer, + Blob, + File: FileConstructor2, + FormData, + Headers, + Request, + Response, + URL +}; +var typedArrayConstructors2 = { + Int8Array, + Uint8Array, + Uint8ClampedArray, + Int16Array, + Uint16Array, + Int32Array, + Uint32Array, + Float32Array, + Float64Array, + BigInt64Array, + BigUint64Array +}; +var builtinConstructors2 = { + ...ecmascriptConstructors2, + ...platformConstructors2, + ...typedArrayConstructors2, + String, + Number, + Boolean +}; +var objectKindOf2 = (data) => { + let prototype = Object.getPrototypeOf(data); + while (prototype?.constructor && (!isKeyOf2(prototype.constructor.name, builtinConstructors2) || !(data instanceof builtinConstructors2[prototype.constructor.name]))) + prototype = Object.getPrototypeOf(prototype); + const name = prototype?.constructor?.name; + if (name === void 0 || name === "Object") + return void 0; + return name; +}; +var objectKindOrDomainOf = (data) => typeof data === "object" && data !== null ? objectKindOf2(data) ?? "object" : domainOf2(data); +var isArray = Array.isArray; +var ecmascriptDescriptions2 = { + Array: "an array", + Function: "a function", + Date: "a Date", + RegExp: "a RegExp", + Error: "an Error", + Map: "a Map", + Set: "a Set", + String: "a String object", + Number: "a Number object", + Boolean: "a Boolean object", + Promise: "a Promise", + WeakMap: "a WeakMap", + WeakSet: "a WeakSet" +}; +var platformDescriptions2 = { + ArrayBuffer: "an ArrayBuffer instance", + Blob: "a Blob instance", + File: "a File instance", + FormData: "a FormData instance", + Headers: "a Headers instance", + Request: "a Request instance", + Response: "a Response instance", + URL: "a URL instance" +}; +var typedArrayDescriptions2 = { + Int8Array: "an Int8Array", + Uint8Array: "a Uint8Array", + Uint8ClampedArray: "a Uint8ClampedArray", + Int16Array: "an Int16Array", + Uint16Array: "a Uint16Array", + Int32Array: "an Int32Array", + Uint32Array: "a Uint32Array", + Float32Array: "a Float32Array", + Float64Array: "a Float64Array", + BigInt64Array: "a BigInt64Array", + BigUint64Array: "a BigUint64Array" +}; +var objectKindDescriptions2 = { + ...ecmascriptDescriptions2, + ...platformDescriptions2, + ...typedArrayDescriptions2 +}; +var getBuiltinNameOfConstructor2 = (ctor) => { + const constructorName = Object(ctor).name ?? null; + return constructorName && isKeyOf2(constructorName, builtinConstructors2) && builtinConstructors2[constructorName] === ctor ? constructorName : null; +}; +var constructorExtends = (ctor, base) => { + let current = ctor.prototype; + while (current !== null) { + if (current === base.prototype) + return true; + current = Object.getPrototypeOf(current); + } + return false; +}; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/clone.js +var deepClone = (input) => _clone(input, /* @__PURE__ */ new Map()); +var _clone = (input, seen) => { + if (typeof input !== "object" || input === null) + return input; + if (seen?.has(input)) + return seen.get(input); + const builtinConstructorName = getBuiltinNameOfConstructor2(input.constructor); + if (builtinConstructorName === "Date") + return new Date(input.getTime()); + if (builtinConstructorName && builtinConstructorName !== "Array") + return input; + const cloned = Array.isArray(input) ? input.slice() : Object.create(Object.getPrototypeOf(input)); + const propertyDescriptors = Object.getOwnPropertyDescriptors(input); + if (seen) { + seen.set(input, cloned); + for (const k in propertyDescriptors) { + const desc = propertyDescriptors[k]; + if ("get" in desc || "set" in desc) + continue; + desc.value = _clone(desc.value, seen); + } + } + Object.defineProperties(cloned, propertyDescriptors); + return cloned; +}; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/functions.js +var cached2 = (thunk) => { + let result = unset2; + return () => result === unset2 ? result = thunk() : result; +}; +var isThunk = (value2) => typeof value2 === "function" && value2.length === 0; +var DynamicFunction = class extends Function { + constructor(...args3) { + const params = args3.slice(0, -1); + const body = args3[args3.length - 1]; + try { + super(...params, body); + } catch (e) { + return throwInternalError2(`Encountered an unexpected error while compiling your definition: + Message: ${e} + Source: (${args3.slice(0, -1)}) => { + ${args3[args3.length - 1]} + }`); + } + } +}; +var Callable = class { + constructor(fn2, ...[opts]) { + return Object.assign(Object.setPrototypeOf(fn2.bind(opts?.bind ?? this), this.constructor.prototype), opts?.attach); + } +}; +var envHasCsp2 = cached2(() => { + try { + return new Function("return false")(); + } catch { + return true; + } +}); + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/generics.js +var brand2 = noSuggest2("brand"); +var inferred2 = noSuggest2("arkInferred"); + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/hkt.js +var args2 = noSuggest2("args"); +var Hkt = class { + constructor() { + } +}; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/isomorphic.js +var fileName2 = () => { + try { + const error41 = new Error(); + const stackLine = error41.stack?.split("\n")[2]?.trim() || ""; + const filePath = stackLine.match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1] || "unknown"; + return filePath.replace(/^file:\/\//, ""); + } catch { + return "unknown"; + } +}; +var env2 = globalThis.process?.env ?? {}; +var isomorphic2 = { + fileName: fileName2, + env: env2 +}; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/strings.js +var capitalize = (s) => s[0].toUpperCase() + s.slice(1); +var uncapitalize = (s) => s[0].toLowerCase() + s.slice(1); +var anchoredRegex2 = (regex3) => new RegExp(anchoredSource2(regex3), typeof regex3 === "string" ? "" : regex3.flags); +var anchoredSource2 = (regex3) => { + const source = typeof regex3 === "string" ? regex3 : regex3.source; + return `^(?:${source})$`; +}; +var RegexPatterns2 = { + negativeLookahead: (pattern) => `(?!${pattern})`, + nonCapturingGroup: (pattern) => `(?:${pattern})` +}; +var Backslash2 = "\\"; +var whitespaceChars2 = { + " ": 1, + "\n": 1, + " ": 1 +}; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/numbers.js +var anchoredNegativeZeroPattern2 = /^-0\.?0*$/.source; +var positiveIntegerPattern2 = /[1-9]\d*/.source; +var looseDecimalPattern2 = /\.\d+/.source; +var strictDecimalPattern2 = /\.\d*[1-9]/.source; +var createNumberMatcher2 = (opts) => anchoredRegex2(RegexPatterns2.negativeLookahead(anchoredNegativeZeroPattern2) + RegexPatterns2.nonCapturingGroup("-?" + RegexPatterns2.nonCapturingGroup(RegexPatterns2.nonCapturingGroup("0|" + positiveIntegerPattern2) + RegexPatterns2.nonCapturingGroup(opts.decimalPattern) + "?") + (opts.allowDecimalOnly ? "|" + opts.decimalPattern : "") + "?")); +var wellFormedNumberMatcher2 = createNumberMatcher2({ + decimalPattern: strictDecimalPattern2, + allowDecimalOnly: false +}); +var isWellFormedNumber2 = wellFormedNumberMatcher2.test.bind(wellFormedNumberMatcher2); +var numericStringMatcher2 = createNumberMatcher2({ + decimalPattern: looseDecimalPattern2, + allowDecimalOnly: true +}); +var isNumericString2 = numericStringMatcher2.test.bind(numericStringMatcher2); +var numberLikeMatcher = /^-?\d*\.?\d*$/; +var isNumberLike = (s) => s.length !== 0 && numberLikeMatcher.test(s); +var wellFormedIntegerMatcher2 = anchoredRegex2(RegexPatterns2.negativeLookahead("^-0$") + "-?" + RegexPatterns2.nonCapturingGroup(RegexPatterns2.nonCapturingGroup("0|" + positiveIntegerPattern2))); +var isWellFormedInteger2 = wellFormedIntegerMatcher2.test.bind(wellFormedIntegerMatcher2); +var integerLikeMatcher2 = /^-?\d+$/; +var isIntegerLike2 = integerLikeMatcher2.test.bind(integerLikeMatcher2); +var numericLiteralDescriptions = { + number: "a number", + bigint: "a bigint", + integer: "an integer" +}; +var writeMalformedNumericLiteralMessage = (def, kind) => `'${def}' was parsed as ${numericLiteralDescriptions[kind]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`; +var isWellFormed = (def, kind) => kind === "number" ? isWellFormedNumber2(def) : isWellFormedInteger2(def); +var parseKind = (def, kind) => kind === "number" ? Number(def) : Number.parseInt(def); +var isKindLike = (def, kind) => kind === "number" ? isNumberLike(def) : isIntegerLike2(def); +var tryParseNumber = (token, options) => parseNumeric(token, "number", options); +var tryParseWellFormedNumber = (token, options) => parseNumeric(token, "number", { ...options, strict: true }); +var tryParseInteger = (token, options) => parseNumeric(token, "integer", options); +var parseNumeric = (token, kind, options) => { + const value2 = parseKind(token, kind); + if (!Number.isNaN(value2)) { + if (isKindLike(token, kind)) { + if (options?.strict) { + return isWellFormed(token, kind) ? value2 : throwParseError2(writeMalformedNumericLiteralMessage(token, kind)); + } + return value2; + } + } + return options?.errorOnFail ? throwParseError2(options?.errorOnFail === true ? `Failed to parse ${numericLiteralDescriptions[kind]} from '${token}'` : options?.errorOnFail) : void 0; +}; +var tryParseWellFormedBigint = (def) => { + if (def[def.length - 1] !== "n") + return; + const maybeIntegerLiteral = def.slice(0, -1); + let value2; + try { + value2 = BigInt(maybeIntegerLiteral); + } catch { + return; + } + if (wellFormedIntegerMatcher2.test(maybeIntegerLiteral)) + return value2; + if (integerLikeMatcher2.test(maybeIntegerLiteral)) { + return throwParseError2(writeMalformedNumericLiteralMessage(def, "bigint")); + } +}; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/registry.js +var arkUtilVersion2 = "0.56.0"; +var initialRegistryContents2 = { + version: arkUtilVersion2, + filename: isomorphic2.fileName(), + FileConstructor: FileConstructor2 +}; +var registry = initialRegistryContents2; +var namesByResolution = /* @__PURE__ */ new Map(); +var nameCounts = /* @__PURE__ */ Object.create(null); +var register2 = (value2) => { + const existingName = namesByResolution.get(value2); + if (existingName) + return existingName; + let name = baseNameFor(value2); + if (nameCounts[name]) + name = `${name}${nameCounts[name]++}`; + else + nameCounts[name] = 1; + registry[name] = value2; + namesByResolution.set(value2, name); + return name; +}; +var isDotAccessible2 = (keyName) => /^[$A-Z_a-z][\w$]*$/.test(keyName); +var baseNameFor = (value2) => { + switch (typeof value2) { + case "object": { + if (value2 === null) + break; + const prefix = objectKindOf2(value2) ?? "object"; + return prefix[0].toLowerCase() + prefix.slice(1); + } + case "function": + return isDotAccessible2(value2.name) ? value2.name : "fn"; + case "symbol": + return value2.description && isDotAccessible2(value2.description) ? value2.description : "symbol"; + } + return throwInternalError2(`Unexpected attempt to register serializable value of type ${domainOf2(value2)}`); +}; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/primitive.js +var serializePrimitive2 = (value2) => typeof value2 === "string" ? JSON.stringify(value2) : typeof value2 === "bigint" ? `${value2}n` : `${value2}`; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/serialize.js +var snapshot = (data, opts = {}) => _serialize(data, { + onUndefined: `$ark.undefined`, + onBigInt: (n) => `$ark.bigint-${n}`, + ...opts +}, []); +var printable2 = (data, opts) => { + switch (domainOf2(data)) { + case "object": + const o = data; + const ctorName = o.constructor?.name ?? "Object"; + return ctorName === "Object" || ctorName === "Array" ? opts?.quoteKeys === false ? stringifyUnquoted(o, opts?.indent ?? 0, "") : JSON.stringify(_serialize(o, printableOpts, []), null, opts?.indent) : stringifyUnquoted(o, opts?.indent ?? 0, ""); + case "symbol": + return printableOpts.onSymbol(data); + default: + return serializePrimitive2(data); + } +}; +var stringifyUnquoted = (value2, indent2, currentIndent) => { + if (typeof value2 === "function") + return printableOpts.onFunction(value2); + if (typeof value2 !== "object" || value2 === null) + return serializePrimitive2(value2); + const nextIndent = currentIndent + " ".repeat(indent2); + if (Array.isArray(value2)) { + if (value2.length === 0) + return "[]"; + const items = value2.map((item) => stringifyUnquoted(item, indent2, nextIndent)).join(",\n" + nextIndent); + return indent2 ? `[ +${nextIndent}${items} +${currentIndent}]` : `[${items}]`; + } + const ctorName = value2.constructor?.name ?? "Object"; + if (ctorName === "Object") { + const keyValues = stringAndSymbolicEntriesOf2(value2).map(([key, val]) => { + const stringifiedKey = typeof key === "symbol" ? printableOpts.onSymbol(key) : isDotAccessible2(key) ? key : JSON.stringify(key); + const stringifiedValue = stringifyUnquoted(val, indent2, nextIndent); + return `${nextIndent}${stringifiedKey}: ${stringifiedValue}`; + }); + if (keyValues.length === 0) + return "{}"; + return indent2 ? `{ +${keyValues.join(",\n")} +${currentIndent}}` : `{${keyValues.join(", ")}}`; + } + if (value2 instanceof Date) + return describeCollapsibleDate(value2); + if ("expression" in value2 && typeof value2.expression === "string") + return value2.expression; + return ctorName; +}; +var printableOpts = { + onCycle: () => "(cycle)", + onSymbol: (v) => `Symbol(${register2(v)})`, + onFunction: (v) => `Function(${register2(v)})` +}; +var _serialize = (data, opts, seen) => { + switch (domainOf2(data)) { + case "object": { + const o = data; + if ("toJSON" in o && typeof o.toJSON === "function") + return o.toJSON(); + if (typeof o === "function") + return printableOpts.onFunction(o); + if (seen.includes(o)) + return "(cycle)"; + const nextSeen = [...seen, o]; + if (Array.isArray(o)) + return o.map((item) => _serialize(item, opts, nextSeen)); + if (o instanceof Date) + return o.toDateString(); + const result = {}; + for (const k in o) + result[k] = _serialize(o[k], opts, nextSeen); + for (const s of Object.getOwnPropertySymbols(o)) { + result[opts.onSymbol?.(s) ?? s.toString()] = _serialize(o[s], opts, nextSeen); + } + return result; + } + case "symbol": + return printableOpts.onSymbol(data); + case "bigint": + return opts.onBigInt?.(data) ?? `${data}n`; + case "undefined": + return opts.onUndefined ?? "undefined"; + case "string": + return data.replace(/\\/g, "\\\\"); + default: + return data; + } +}; +var describeCollapsibleDate = (date2) => { + const year = date2.getFullYear(); + const month = date2.getMonth(); + const dayOfMonth = date2.getDate(); + const hours = date2.getHours(); + const minutes = date2.getMinutes(); + const seconds = date2.getSeconds(); + const milliseconds = date2.getMilliseconds(); + if (month === 0 && dayOfMonth === 1 && hours === 0 && minutes === 0 && seconds === 0 && milliseconds === 0) + return `${year}`; + const datePortion = `${months[month]} ${dayOfMonth}, ${year}`; + if (hours === 0 && minutes === 0 && seconds === 0 && milliseconds === 0) + return datePortion; + let timePortion = date2.toLocaleTimeString(); + const suffix2 = timePortion.endsWith(" AM") || timePortion.endsWith(" PM") ? timePortion.slice(-3) : ""; + if (suffix2) + timePortion = timePortion.slice(0, -suffix2.length); + if (milliseconds) + timePortion += `.${pad(milliseconds, 3)}`; + else if (timeWithUnnecessarySeconds.test(timePortion)) + timePortion = timePortion.slice(0, -3); + return `${timePortion + suffix2}, ${datePortion}`; +}; +var months = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" +]; +var timeWithUnnecessarySeconds = /:\d\d:00$/; +var pad = (value2, length) => String(value2).padStart(length, "0"); + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/path.js +var appendStringifiedKey = (path3, prop, ...[opts]) => { + const stringifySymbol = opts?.stringifySymbol ?? printable2; + let propAccessChain = path3; + switch (typeof prop) { + case "string": + propAccessChain = isDotAccessible2(prop) ? path3 === "" ? prop : `${path3}.${prop}` : `${path3}[${JSON.stringify(prop)}]`; + break; + case "number": + propAccessChain = `${path3}[${prop}]`; + break; + case "symbol": + propAccessChain = `${path3}[${stringifySymbol(prop)}]`; + break; + default: + if (opts?.stringifyNonKey) + propAccessChain = `${path3}[${opts.stringifyNonKey(prop)}]`; + else { + throwParseError2(`${printable2(prop)} must be a PropertyKey or stringifyNonKey must be passed to options`); + } + } + return propAccessChain; +}; +var stringifyPath = (path3, ...opts) => path3.reduce((s, k) => appendStringifiedKey(s, k, ...opts), ""); +var ReadonlyPath = class extends ReadonlyArray2 { + // alternate strategy for caching since the base object is frozen + cache = {}; + constructor(...items) { + super(); + this.push(...items); + } + toJSON() { + if (this.cache.json) + return this.cache.json; + this.cache.json = []; + for (let i = 0; i < this.length; i++) { + this.cache.json.push(typeof this[i] === "symbol" ? printable2(this[i]) : this[i]); + } + return this.cache.json; + } + stringify() { + if (this.cache.stringify) + return this.cache.stringify; + return this.cache.stringify = stringifyPath(this); + } + stringifyAncestors() { + if (this.cache.stringifyAncestors) + return this.cache.stringifyAncestors; + let propString = ""; + const result = [propString]; + for (const path3 of this) { + propString = appendStringifiedKey(propString, path3); + result.push(propString); + } + return this.cache.stringifyAncestors = result; + } +}; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/scanner.js +var Scanner = class { + chars; + i; + def; + constructor(def) { + this.def = def; + this.chars = [...def]; + this.i = 0; + } + /** Get lookahead and advance scanner by one */ + shift() { + return this.chars[this.i++] ?? ""; + } + get lookahead() { + return this.chars[this.i] ?? ""; + } + get nextLookahead() { + return this.chars[this.i + 1] ?? ""; + } + get length() { + return this.chars.length; + } + shiftUntil(condition) { + let shifted = ""; + while (this.lookahead) { + if (condition(this, shifted)) + break; + else + shifted += this.shift(); + } + return shifted; + } + shiftUntilEscapable(condition) { + let shifted = ""; + while (this.lookahead) { + if (this.lookahead === Backslash2) { + this.shift(); + if (condition(this, shifted)) + shifted += this.shift(); + else if (this.lookahead === Backslash2) + shifted += this.shift(); + else + shifted += `${Backslash2}${this.shift()}`; + } else if (condition(this, shifted)) + break; + else + shifted += this.shift(); + } + return shifted; + } + shiftUntilLookahead(charOrSet) { + return typeof charOrSet === "string" ? this.shiftUntil((s) => s.lookahead === charOrSet) : this.shiftUntil((s) => s.lookahead in charOrSet); + } + shiftUntilNonWhitespace() { + return this.shiftUntil(() => !(this.lookahead in whitespaceChars2)); + } + jumpToIndex(i) { + this.i = i < 0 ? this.length + i : i; + } + jumpForward(count) { + this.i += count; + } + get location() { + return this.i; + } + get unscanned() { + return this.chars.slice(this.i, this.length).join(""); + } + get scanned() { + return this.chars.slice(0, this.i).join(""); + } + sliceChars(start, end) { + return this.chars.slice(start, end).join(""); + } + lookaheadIs(char) { + return this.lookahead === char; + } + lookaheadIsIn(tokens) { + return this.lookahead in tokens; + } +}; +var writeUnmatchedGroupCloseMessage = (char, unscanned) => `Unmatched ${char}${unscanned === "" ? "" : ` before ${unscanned}`}`; +var writeUnclosedGroupMessage = (missingChar) => `Missing ${missingChar}`; + +// node_modules/.pnpm/@ark+util@0.56.0/node_modules/@ark/util/out/traits.js +var implementedTraits2 = noSuggest2("implementedTraits"); + +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/registry.js var _registryName = "$ark"; var suffix = 2; while (_registryName in globalThis) @@ -84581,16 +84831,16 @@ var registryName = _registryName; globalThis[registryName] = registry; var $ark = registry; var reference = (name) => `${registryName}.${name}`; -var registeredReference = (value2) => reference(register(value2)); +var registeredReference = (value2) => reference(register2(value2)); -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/shared/compile.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/compile.js var CompiledFunction = class extends CastableBase { argNames; body = ""; - constructor(...args2) { + constructor(...args3) { super(); - this.argNames = args2; - for (const arg of args2) { + this.argNames = args3; + for (const arg of args3) { if (arg in this) { throw new Error(`Arg name '${arg}' would overwrite an existing property on FunctionBody`); } @@ -84663,9 +84913,9 @@ var CompiledFunction = class extends CastableBase { return new DynamicFunction(...this.argNames, this.body); } }; -var compileSerializedValue = (value2) => hasDomain(value2, "object") || typeof value2 === "symbol" ? registeredReference(value2) : serializePrimitive(value2); +var compileSerializedValue = (value2) => hasDomain2(value2, "object") || typeof value2 === "symbol" ? registeredReference(value2) : serializePrimitive2(value2); var compileLiteralPropAccess = (key, optional = false) => { - if (typeof key === "string" && isDotAccessible(key)) + if (typeof key === "string" && isDotAccessible2(key)) return `${optional ? "?" : ""}.${key}`; return indexPropAccess(serializeLiteralKey(key), optional); }; @@ -84720,17 +84970,17 @@ var NodeCompiler = class extends CompiledFunction { } }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/shared/utils.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/utils.js var makeRootAndArrayPropertiesMutable = (o) => ( // this cast should not be required, but it seems TS is referencing // the wrong parameters here? - flatMorph(o, (k, v) => [k, isArray(v) ? [...v] : v]) + flatMorph2(o, (k, v) => [k, isArray(v) ? [...v] : v]) ); -var arkKind = noSuggest("arkKind"); +var arkKind = noSuggest2("arkKind"); var hasArkKind = (value2, kind) => value2?.[arkKind] === kind; var isNode = (value2) => hasArkKind(value2, "root") || hasArkKind(value2, "constraint"); -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/shared/implement.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/implement.js var basisKinds = ["unit", "proto", "domain"]; var structuralKinds = [ "required", @@ -84765,9 +85015,9 @@ var rootKinds = [ "domain" ]; var nodeKinds = [...rootKinds, ...constraintKinds]; -var constraintKeys = flatMorph(constraintKinds, (i, kind) => [kind, 1]); -var structureKeys = flatMorph([...structuralKinds, "undeclared"], (i, k) => [k, 1]); -var precedenceByKind = flatMorph(nodeKinds, (i, kind) => [kind, i]); +var constraintKeys = flatMorph2(constraintKinds, (i, kind) => [kind, 1]); +var structureKeys = flatMorph2([...structuralKinds, "undeclared"], (i, k) => [k, 1]); +var precedenceByKind = flatMorph2(nodeKinds, (i, kind) => [kind, i]); var isNodeKind = (value2) => typeof value2 === "string" && value2 in precedenceByKind; var precedenceOfKind = (kind) => precedenceByKind[kind]; var schemaKindsRightOf = (kind) => rootKinds.slice(precedenceOfKind(kind) + 1); @@ -84803,7 +85053,7 @@ var implementNode = (_) => { const implementation23 = _; if (implementation23.hasAssociatedError) { implementation23.defaults.expected ??= (ctx) => "description" in ctx ? ctx.description : implementation23.defaults.description(ctx); - implementation23.defaults.actual ??= (data) => printable(data); + implementation23.defaults.actual ??= (data) => printable2(data); implementation23.defaults.problem ??= (ctx) => `must be ${ctx.expected}${ctx.actual ? ` (was ${ctx.actual})` : ""}`; implementation23.defaults.message ??= (ctx) => { if (ctx.path.length === 0) @@ -84818,13 +85068,13 @@ var implementNode = (_) => { return implementation23; }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/shared/toJsonSchema.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/toJsonSchema.js var ToJsonSchemaError = class extends Error { name = "ToJsonSchemaError"; code; context; constructor(code, context) { - super(printable(context, { quoteKeys: false, indent: 4 })); + super(printable2(context, { quoteKeys: false, indent: 4 })); this.code = code; this.context = context; } @@ -84833,6 +85083,7 @@ var ToJsonSchemaError = class extends Error { } }; var defaultConfig = { + target: "draft-2020-12", dialect: "https://json-schema.org/draft/2020-12/schema", useRefs: false, fallback: { @@ -84851,14 +85102,14 @@ var defaultConfig = { }; var ToJsonSchema = { Error: ToJsonSchemaError, - throw: (...args2) => { - throw new ToJsonSchema.Error(...args2); + throw: (...args3) => { + throw new ToJsonSchema.Error(...args3); }, - throwInternalOperandError: (kind, schema2) => throwInternalError(`Unexpected JSON Schema input for ${kind}: ${printable(schema2)}`), + throwInternalOperandError: (kind, schema2) => throwInternalError2(`Unexpected JSON Schema input for ${kind}: ${printable2(schema2)}`), defaultConfig }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/config.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/config.js $ark.config ??= {}; var configureSchema = (config2) => { const result = Object.assign($ark.config, mergeConfigs($ark.config, config2)); @@ -84895,9 +85146,13 @@ var mergeConfigs = (base, merged) => { } return result; }; +var jsonSchemaTargetToDialect = { + "draft-2020-12": "https://json-schema.org/draft/2020-12/schema", + "draft-07": "http://json-schema.org/draft-07/schema#" +}; var mergeToJsonSchemaConfigs = ((baseConfig, mergedConfig) => { if (!baseConfig) - return mergedConfig ?? {}; + return resolveTargetToDialect(mergedConfig ?? {}, void 0); if (!mergedConfig) return baseConfig; const result = { ...baseConfig }; @@ -84908,8 +85163,19 @@ var mergeToJsonSchemaConfigs = ((baseConfig, mergedConfig) => { } else result[k] = mergedConfig[k]; } - return result; + return resolveTargetToDialect(result, mergedConfig); }); +var resolveTargetToDialect = (opts, userOpts) => { + if (userOpts?.dialect !== void 0) + return opts; + if (userOpts?.target !== void 0) { + return { + ...opts, + dialect: jsonSchemaTargetToDialect[userOpts.target] + }; + } + return opts; +}; var mergeFallbacks = (base, merged) => { base = normalizeFallback(base); merged = normalizeFallback(merged); @@ -84922,7 +85188,7 @@ var mergeFallbacks = (base, merged) => { }; var normalizeFallback = (fallback) => typeof fallback === "function" ? { default: fallback } : fallback ?? {}; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/shared/errors.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/errors.js var ArkError = class _ArkError extends CastableBase { [arkKind] = "error"; path; @@ -85015,7 +85281,7 @@ var ArkError = class _ArkError extends CastableBase { throw this; } }; -var ArkErrors = class _ArkErrors extends ReadonlyArray { +var ArkErrors = class _ArkErrors extends ReadonlyArray2 { [arkKind] = "errors"; ctx; constructor(ctx) { @@ -85033,13 +85299,13 @@ var ArkErrors = class _ArkErrors extends ReadonlyArray { * they will never be directly present in this representation. */ get flatByPath() { - return flatMorph(this.byPath, (k, v) => [k, v.flat]); + return flatMorph2(this.byPath, (k, v) => [k, v.flat]); } /** * {@link byPath} flattened so that each value is an array of problem strings at that path. */ get flatProblemsByPath() { - return flatMorph(this.byPath, (k, v) => [k, v.flat.map((e) => e.problem)]); + return flatMorph2(this.byPath, (k, v) => [k, v.flat.map((e) => e.problem)]); } /** * All pathStrings at which errors are present mapped to the errors occuring @@ -85135,7 +85401,7 @@ var ArkErrors = class _ArkErrors extends ReadonlyArray { } addAncestorPaths(error41) { for (const propString of error41.path.stringifyAncestors()) { - this.byAncestorPath[propString] = append(this.byAncestorPath[propString], error41); + this.byAncestorPath[propString] = append2(this.byAncestorPath[propString], error41); } } }; @@ -85154,7 +85420,7 @@ var TraversalError = class extends Error { }; var indent = (error41) => error41.toString().split("\n").join("\n "); -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/shared/traversal.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/traversal.js var Traversal = class { /** * #### the path being validated or morphed @@ -85238,7 +85504,7 @@ var Traversal = class { return this.currentErrorCount !== 0; } get currentBranch() { - return this.branches.at(-1); + return this.branches[this.branches.length - 1]; } queueMorphs(morphs) { const input = { @@ -85307,7 +85573,7 @@ var Traversal = class { } } applyMorphsAtPath(path3, morphs) { - const key = path3.at(-1); + const key = path3[path3.length - 1]; let parent; if (key !== void 0) { parent = this.root; @@ -85319,7 +85585,8 @@ var Traversal = class { const morphIsNode = isNode(morph); const result = morph(parent === void 0 ? this.root : parent[key], this); if (result instanceof ArkError) { - this.errors.add(result); + if (!this.errors.includes(result)) + this.errors.add(result); break; } if (result instanceof ArkErrors) { @@ -85346,7 +85613,7 @@ var traverseKey = (key, fn2, ctx) => { return result; }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/node.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/node.js var BaseNode = class extends Callable { attachments; $; @@ -85449,7 +85716,7 @@ var BaseNode = class extends Callable { return this.createBranchedOptimisticRootApply(); default: this.rootApplyStrategy; - return throwInternalError(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`); + return throwInternalError2(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`); } } compiledMeta = compileMeta(this.metaJson); @@ -85606,7 +85873,7 @@ var BaseNode = class extends Callable { undeclaredKeyHandling: this.undeclared }; } - const innerWithTransformedChildren = flatMorph(this.inner, (k, v) => { + const innerWithTransformedChildren = flatMorph2(this.inner, (k, v) => { if (!this.impl.keys[k].child) return [k, v]; const children = v; @@ -85634,7 +85901,7 @@ var BaseNode = class extends Callable { const transformedKeys = Object.keys(transformedInner); const hasNoTypedKeys = transformedKeys.length === 0 || transformedKeys.length === 1 && transformedKeys[0] === "meta"; if (hasNoTypedKeys && // if inner was previously an empty object (e.g. unknown) ensure it is not pruned - !isEmptyObject(this.inner)) + !isEmptyObject2(this.inner)) return null; if ((this.kind === "required" || this.kind === "optional" || this.kind === "index") && !("value" in transformedInner)) { return ctx.undeclaredKeyHandling ? { ...transformedInner, value: $ark.intrinsic.unknown } : null; @@ -85687,14 +85954,14 @@ var NodeSelector = { return nodes[0]; } }, - normalize: (selector) => typeof selector === "function" ? { boundary: "references", method: "filter", where: selector } : typeof selector === "string" ? isKeyOf(selector, NodeSelector.applyBoundary) ? { method: "filter", boundary: selector } : { boundary: "references", method: "filter", kind: selector } : { boundary: "references", method: "filter", ...selector } + normalize: (selector) => typeof selector === "function" ? { boundary: "references", method: "filter", where: selector } : typeof selector === "string" ? isKeyOf2(selector, NodeSelector.applyBoundary) ? { method: "filter", boundary: selector } : { boundary: "references", method: "filter", kind: selector } : { boundary: "references", method: "filter", ...selector } }; -var writeSelectAssertionMessage = (from, selector) => `${from} had no references matching ${printable(selector)}.`; +var writeSelectAssertionMessage = (from, selector) => `${from} had no references matching ${printable2(selector)}.`; var typePathToPropString = (path3) => stringifyPath(path3, { stringifyNonKey: (node2) => node2.expression }); var referenceMatcher = /"(\$ark\.[^"]+)"/g; -var compileMeta = (metaJson) => JSON.stringify(metaJson).replaceAll(referenceMatcher, "$1"); +var compileMeta = (metaJson) => JSON.stringify(metaJson).replace(referenceMatcher, "$1"); var flatRef = (path3, node2) => ({ path: path3, node: node2, @@ -85708,7 +85975,7 @@ var appendUniqueNodes = (existing, refs) => appendUnique(existing, refs, { isEqual: (l, r) => l.equals(r) }); -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/shared/disjoint.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/disjoint.js var Disjoint = class _Disjoint extends Array { static init(kind, l, r, ctx) { return new _Disjoint({ @@ -85742,7 +86009,7 @@ var Disjoint = class _Disjoint extends Array { \u2022 ${this.map(({ path: path3, l, r }) => `${path3}: ${describeReasons(l, r)}`).join("\n\u2022 ")}`; } throw() { - return throwParseError(this.describeReasons()); + return throwParseError2(this.describeReasons()); } invert() { const result = this.map((entry) => ({ @@ -85769,7 +86036,7 @@ var describeReasons = (l, r) => `${describeReason(l)} and ${describeReason(r)}`; var describeReason = (value2) => isNode(value2) ? value2.expression : isArray(value2) ? value2.map(describeReason).join(" | ") || "never" : String(value2); var writeUnsatisfiableExpressionError = (expression) => `${expression} results in an unsatisfiable type`; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/shared/intersections.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/shared/intersections.js var intersectionCache = {}; var intersectNodesRoot = (l, r, $2) => intersectOrPipeNodes(l, r, { $: $2, @@ -85880,7 +86147,7 @@ var _pipeMorphed = (from, to, ctx) => { }); }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/constraint.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/constraint.js var BaseConstraint = class extends BaseNode { constructor(attachments, $2) { super(attachments, $2); @@ -85958,7 +86225,7 @@ var intersectConstraints = (s) => { s.l[i] = result; matched = true; } else if (!s.l.includes(result)) { - return throwInternalError(`Unexpectedly encountered multiple distinct intersection results for refinement ${head}`); + return throwInternalError2(`Unexpectedly encountered multiple distinct intersection results for refinement ${head}`); } } if (!matched) @@ -85978,23 +86245,23 @@ var unflattenConstraints = (constraints) => { const inner = {}; for (const constraint of constraints) { if (constraint.hasOpenIntersection()) { - inner[constraint.kind] = append(inner[constraint.kind], constraint); + inner[constraint.kind] = append2(inner[constraint.kind], constraint); } else { if (inner[constraint.kind]) { - return throwInternalError(`Unexpected intersection of closed refinements of kind ${constraint.kind}`); + return throwInternalError2(`Unexpected intersection of closed refinements of kind ${constraint.kind}`); } inner[constraint.kind] = constraint; } } return inner; }; -var throwInvalidOperandError = (...args2) => throwParseError(writeInvalidOperandMessage(...args2)); +var throwInvalidOperandError = (...args3) => throwParseError2(writeInvalidOperandMessage(...args3)); var writeInvalidOperandMessage = (kind, expected, actual) => { const actualDescription = actual.hasKind("morph") ? "a morph" : actual.isUnknown() ? "unknown" : actual.exclude(expected).defaultShortDescription; return `${capitalize(kind)} operand must be ${expected.description} (was ${actualDescription})`; }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/generic.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/generic.js var parseGeneric = (paramDefs, bodyDef, $2) => new GenericRoot(paramDefs, bodyDef, $2, $2, null); var LazyGenericBody = class extends Callable { }; @@ -86008,11 +86275,11 @@ var GenericRoot = class extends Callable { hkt; description; constructor(paramDefs, bodyDef, $2, arg$, hkt) { - super((...args2) => { - const argNodes = flatMorph(this.names, (i, name) => { - const arg = this.arg$.parse(args2[i]); + super((...args3) => { + const argNodes = flatMorph2(this.names, (i, name) => { + const arg = this.arg$.parse(args3[i]); if (!arg.extends(this.constraints[i])) { - throwParseError(writeUnsatisfiedParameterConstraintMessage(name, this.constraints[i].expression, arg.expression)); + throwParseError2(writeUnsatisfiedParameterConstraintMessage(name, this.constraints[i].expression, arg.expression)); } return [name, arg]; }); @@ -86064,7 +86331,7 @@ var GenericRoot = class extends Callable { }; var writeUnsatisfiedParameterConstraintMessage = (name, constraint, arg) => `${name} must be assignable to ${constraint} (was ${arg})`; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/predicate.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/predicate.js var implementation = implementNode({ kind: "predicate", hasAssociatedError: true, @@ -86098,7 +86365,8 @@ var PredicateNode = class extends BaseConstraint { }; compiledErrorContext = compileObjectLiteral(this.errorContext); traverseApply = (data, ctx) => { - if (!this.predicate(data, ctx.external) && !ctx.hasError()) + const errorCount = ctx.currentErrorCount; + if (!this.predicate(data, ctx.external) && ctx.currentErrorCount === errorCount) ctx.errorFromNodeContext(this.errorContext); }; compile(js) { @@ -86106,7 +86374,12 @@ var PredicateNode = class extends BaseConstraint { js.return(this.compiledCondition); return; } - js.if(`${this.compiledNegation} && !ctx.hasError()`, () => js.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`)); + js.initializeErrorCount(); + js.if( + // only add the default error if the predicate didn't add one itself + `${this.compiledNegation} && ctx.currentErrorCount === errorCount`, + () => js.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`) + ); } reduceJsonSchema(base, ctx) { return ctx.fallback.predicate({ @@ -86121,13 +86394,13 @@ var Predicate = { Node: PredicateNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/divisor.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/divisor.js var implementation2 = implementNode({ kind: "divisor", collapsibleKey: "rule", keys: { rule: { - parse: (divisor) => Number.isInteger(divisor) ? divisor : throwParseError(writeNonIntegerDivisorMessage(divisor)) + parse: (divisor) => Number.isInteger(divisor) ? divisor : throwParseError2(writeNonIntegerDivisorMessage(divisor)) } }, normalize: (schema2) => typeof schema2 === "number" ? { rule: schema2 } : schema2, @@ -86173,7 +86446,7 @@ var greatestCommonDivisor = (l, r) => { return greatestCommonDivisor2; }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/range.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/range.js var BaseRange = class extends InternalPrimitiveConstraint { boundOperandKind = operandKindsByBoundKind[this.kind]; compiledActual = this.boundOperandKind === "value" ? `data` : this.boundOperandKind === "length" ? `data.length` : `data.valueOf()`; @@ -86241,7 +86514,7 @@ var parseDateLimit = (limit) => typeof limit === "string" || typeof limit === "n var writeInvalidLengthBoundMessage = (kind, limit) => `${kind} bound must be a positive integer (was ${limit})`; var createLengthRuleParser = (kind) => (limit) => { if (!Number.isInteger(limit) || limit < 0) - throwParseError(writeInvalidLengthBoundMessage(kind, limit)); + throwParseError2(writeInvalidLengthBoundMessage(kind, limit)); return limit; }; var operandKindsByBoundKind = { @@ -86252,11 +86525,11 @@ var operandKindsByBoundKind = { after: "date", before: "date" }; -var compileComparator = (kind, exclusive) => `${isKeyOf(kind, boundKindPairsByLower) ? ">" : "<"}${exclusive ? "" : "="}`; +var compileComparator = (kind, exclusive) => `${isKeyOf2(kind, boundKindPairsByLower) ? ">" : "<"}${exclusive ? "" : "="}`; var dateLimitToString = (limit) => typeof limit === "string" ? limit : new Date(limit).toLocaleString(); var writeUnboundableMessage = (root2) => `Bounded expression ${root2} must be exactly one of number, string, Array, or Date`; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/after.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/after.js var implementation3 = implementNode({ kind: "after", collapsibleKey: "rule", @@ -86289,7 +86562,7 @@ var After = { Node: AfterNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/before.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/before.js var implementation4 = implementNode({ kind: "before", collapsibleKey: "rule", @@ -86323,7 +86596,7 @@ var Before = { Node: BeforeNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/exactLength.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/exactLength.js var implementation5 = implementNode({ kind: "exactLength", collapsibleKey: "rule", @@ -86370,7 +86643,7 @@ var ExactLength = { Node: ExactLengthNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/max.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/max.js var implementation6 = implementNode({ kind: "max", collapsibleKey: "rule", @@ -86409,7 +86682,7 @@ var Max = { Node: MaxNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/maxLength.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/maxLength.js var implementation7 = implementNode({ kind: "maxLength", collapsibleKey: "rule", @@ -86451,7 +86724,7 @@ var MaxLength = { Node: MaxLengthNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/min.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/min.js var implementation8 = implementNode({ kind: "min", collapsibleKey: "rule", @@ -86489,7 +86762,7 @@ var Min = { Node: MinNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/minLength.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/minLength.js var implementation9 = implementNode({ kind: "minLength", collapsibleKey: "rule", @@ -86534,7 +86807,7 @@ var MinLength = { Node: MinLengthNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/kinds.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/kinds.js var boundImplementationsByKind = { min: Min.implementation, max: Max.implementation, @@ -86554,7 +86827,7 @@ var boundClassesByKind = { before: Before.Node }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/refinements/pattern.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/refinements/pattern.js var implementation10 = implementNode({ kind: "pattern", collapsibleKey: "rule", @@ -86600,11 +86873,11 @@ var Pattern = { Node: PatternNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/parse.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/parse.js var schemaKindOf = (schema2, allowedKinds) => { const kind = discriminateRootKind(schema2); if (allowedKinds && !allowedKinds.includes(kind)) { - return throwParseError(`Root of kind ${kind} should be one of ${allowedKinds}`); + return throwParseError2(`Root of kind ${kind} should be one of ${allowedKinds}`); } return kind; }; @@ -86612,12 +86885,12 @@ var discriminateRootKind = (schema2) => { if (hasArkKind(schema2, "root")) return schema2.kind; if (typeof schema2 === "string") { - return schema2[0] === "$" ? "alias" : schema2 in domainDescriptions ? "domain" : "proto"; + return schema2[0] === "$" ? "alias" : schema2 in domainDescriptions2 ? "domain" : "proto"; } if (typeof schema2 === "function") return "proto"; if (typeof schema2 !== "object" || schema2 === null) - return throwParseError(writeInvalidSchemaMessage(schema2)); + return throwParseError2(writeInvalidSchemaMessage(schema2)); if ("morphs" in schema2) return "morph"; if ("branches" in schema2 || isArray(schema2)) @@ -86633,9 +86906,9 @@ var discriminateRootKind = (schema2) => { return "proto"; if ("domain" in schema2) return "domain"; - return throwParseError(writeInvalidSchemaMessage(schema2)); + return throwParseError2(writeInvalidSchemaMessage(schema2)); }; -var writeInvalidSchemaMessage = (schema2) => `${printable(schema2)} is not a valid type schema`; +var writeInvalidSchemaMessage = (schema2) => `${printable2(schema2)} is not a valid type schema`; var nodeCountsByPrefix = {}; var serializeListableChild = (listableNode) => isArray(listableNode) ? listableNode.map((node2) => node2.collapsibleJson) : listableNode.collapsibleJson; var nodesByRegisteredId = {}; @@ -86662,9 +86935,9 @@ var parseNode = (ctx) => { const k = entry[0]; const keyImpl = impl.keys[k]; if (!keyImpl) - return throwParseError(`Key ${k} is not valid on ${ctx.kind} schema`); + return throwParseError2(`Key ${k} is not valid on ${ctx.kind} schema`); const v = keyImpl.parse ? keyImpl.parse(entry[1], ctx) : entry[1]; - if (v !== unset && (v !== void 0 || keyImpl.preserveUndefined)) + if (v !== unset2 && (v !== void 0 || keyImpl.preserveUndefined)) inner[k] = v; } if (impl.reduce && !ctx.prereduced) { @@ -86706,8 +86979,8 @@ var createNode = ({ id, kind, inner, meta, $: $2, ignoreCache }) => { innerJson = impl.finalizeInnerJson(innerJson); let json3 = { ...innerJson }; let metaJson = {}; - if (!isEmptyObject(meta)) { - metaJson = flatMorph(meta, (k, v) => [ + if (!isEmptyObject2(meta)) { + metaJson = flatMorph2(meta, (k, v) => [ k, k === "examples" ? v : defaultValueSerializer(v) ]); @@ -86747,7 +87020,7 @@ var withId = (node2, id) => { if (node2.id === id) return node2; if (isNode(nodesByRegisteredId[id])) - throwInternalError(`Unexpected attempt to overwrite node id ${id}`); + throwInternalError2(`Unexpected attempt to overwrite node id ${id}`); return createNode({ id, kind: node2.kind, @@ -86759,7 +87032,7 @@ var withId = (node2, id) => { }; var withMeta = (node2, meta, id) => { if (id && isNode(nodesByRegisteredId[id])) - throwInternalError(`Unexpected attempt to overwrite node id ${id}`); + throwInternalError2(`Unexpected attempt to overwrite node id ${id}`); return createNode({ id: id ?? registerNodeId(meta.alias ?? node2.kind), kind: node2.kind, @@ -86776,7 +87049,7 @@ var possiblyCollapse = (json3, toKey, allowPrimitive) => { return collapsed; if ( // if the collapsed value is still an object - hasDomain(collapsed, "object") && // and the JSON did not include any implied keys + hasDomain2(collapsed, "object") && // and the JSON did not include any implied keys (Object.keys(collapsed).length === 1 || Array.isArray(collapsed)) ) { return collapsed; @@ -86785,7 +87058,7 @@ var possiblyCollapse = (json3, toKey, allowPrimitive) => { return json3; }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/structure/prop.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/structure/prop.js var intersectProps = (l, r, ctx) => { if (l.key !== r.key) return null; @@ -86805,7 +87078,7 @@ var intersectProps = (l, r, ctx) => { value: value2 }); } - const defaultIntersection = l.hasDefault() ? r.hasDefault() ? l.default === r.default ? l.default : throwParseError(writeDefaultIntersectionMessage(l.default, r.default)) : l.default : r.hasDefault() ? r.default : unset; + const defaultIntersection = l.hasDefault() ? r.hasDefault() ? l.default === r.default ? l.default : throwParseError2(writeDefaultIntersectionMessage(l.default, r.default)) : l.default : r.hasDefault() ? r.default : unset2; return ctx.$.node("optional", { key, value: value2, @@ -86819,7 +87092,7 @@ var BaseProp = class extends BaseConstraint { impliedBasis = $ark.intrinsic.object.internal; serializedKey = compileSerializedValue(this.key); compiledKey = typeof this.key === "string" ? this.key : this.serializedKey; - flatRefs = append(this.value.flatRefs.map((ref) => flatRef([this.key, ...ref.path], ref.node)), flatRef([this.key], this.value)); + flatRefs = append2(this.value.flatRefs.map((ref) => flatRef([this.key, ...ref.path], ref.node)), flatRef([this.key], this.value)); _transform(mapper, ctx) { ctx.path.push(this.key); const result = super._transform(mapper, ctx); @@ -86850,9 +87123,9 @@ var BaseProp = class extends BaseConstraint { js.return(true); } }; -var writeDefaultIntersectionMessage = (lValue, rValue) => `Invalid intersection of default values ${printable(lValue)} & ${printable(rValue)}`; +var writeDefaultIntersectionMessage = (lValue, rValue) => `Invalid intersection of default values ${printable2(lValue)} & ${printable2(rValue)}`; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/structure/optional.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/structure/optional.js var implementation11 = implementNode({ kind: "optional", hasAssociatedError: false, @@ -86883,8 +87156,8 @@ var implementation11 = implementNode({ } }); var OptionalNode = class extends BaseProp { - constructor(...args2) { - super(...args2); + constructor(...args3) { + super(...args3); if ("default" in this.inner) assertDefaultValueAssignability(this.value, this.inner.default, this.key); } @@ -86902,7 +87175,7 @@ var OptionalNode = class extends BaseProp { const { default: defaultValue, ...requiredInner } = this.inner; return this.cacheGetter("outProp", this.$.node("required", requiredInner, { prereduced: true })); } - expression = this.hasDefault() ? `${this.compiledKey}: ${this.value.expression} = ${printable(this.inner.default)}` : `${this.compiledKey}?: ${this.value.expression}`; + expression = this.hasDefault() ? `${this.compiledKey}: ${this.value.expression} = ${printable2(this.inner.default)}` : `${this.compiledKey}?: ${this.value.expression}`; defaultValueMorph = getDefaultableMorph(this); defaultValueMorphRef = this.defaultValueMorph && registeredReference(this.defaultValueMorph); }; @@ -86928,7 +87201,7 @@ var computeDefaultValueMorph = (key, value2, defaultInput) => { }; } const precomputedMorphedDefault = value2.includesTransform ? value2.assert(defaultInput) : defaultInput; - return hasDomain(precomputedMorphedDefault, "object") ? ( + return hasDomain2(precomputedMorphedDefault, "object") ? ( // the type signature only allows this if the value was morphed (data, ctx) => { traverseKey(key, () => value2(data[key] = defaultInput, ctx), ctx); @@ -86941,15 +87214,15 @@ var computeDefaultValueMorph = (key, value2, defaultInput) => { }; var assertDefaultValueAssignability = (node2, value2, key) => { const wrapped = isThunk(value2); - if (hasDomain(value2, "object") && !wrapped) - throwParseError(writeNonPrimitiveNonFunctionDefaultValueMessage(key)); + if (hasDomain2(value2, "object") && !wrapped) + throwParseError2(writeNonPrimitiveNonFunctionDefaultValueMessage(key)); const out = node2.in(wrapped ? value2() : value2); if (out instanceof ArkErrors) { if (key === null) { - throwParseError(`Default ${out.summary}`); + throwParseError2(`Default ${out.summary}`); } const atPath = out.transform((e) => e.transform((input) => ({ ...input, prefixPath: [key] }))); - throwParseError(`Default for ${atPath.summary}`); + throwParseError2(`Default for ${atPath.summary}`); } return value2; }; @@ -86958,7 +87231,7 @@ var writeNonPrimitiveNonFunctionDefaultValueMessage = (key) => { return `Non-primitive default ${keyDescription}must be specified as a function like () => ({my: 'object'})`; }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/roots/root.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/roots/root.js var BaseRoot = class extends BaseNode { constructor(attachments, $2) { super(attachments, $2); @@ -86985,13 +87258,15 @@ var BaseRoot = class extends BaseNode { return out; return { value: out }; }, - toJSONSchema: (opts) => { - if (opts.target && opts.target !== "draft-2020-12") { - return throwParseError(`JSONSchema target '${opts.target}' is not supported (must be "draft-2020-12")`); - } - if (opts.io === "input") - return this.rawIn.toJsonSchema(); - return this.rawOut.toJsonSchema(); + jsonSchema: { + input: (opts) => this.rawIn.toJsonSchema({ + target: validateStandardJsonSchemaTarget(opts.target), + ...opts.libraryOptions + }), + output: (opts) => this.rawOut.toJsonSchema({ + target: validateStandardJsonSchemaTarget(opts.target), + ...opts.libraryOptions + }) } }; } @@ -87000,7 +87275,7 @@ var BaseRoot = class extends BaseNode { } brand(name) { if (name === "") - return throwParseError(emptyBrandNameMessage); + return throwParseError2(emptyBrandNameMessage); return this; } readonly() { @@ -87020,13 +87295,19 @@ var BaseRoot = class extends BaseNode { const schema2 = typeof ctx.dialect === "string" ? { $schema: ctx.dialect } : {}; Object.assign(schema2, this.toJsonSchemaRecurse(ctx)); if (ctx.useRefs) { - schema2.$defs = flatMorph(this.references, (i, ref) => ref.isRoot() && !ref.alwaysExpandJsonSchema ? [ref.id, ref.toResolvedJsonSchema(ctx)] : []); + const defs = flatMorph2(this.references, (i, ref) => ref.isRoot() && !ref.alwaysExpandJsonSchema ? [ref.id, ref.toResolvedJsonSchema(ctx)] : []); + if (ctx.target === "draft-07") + Object.assign(schema2, { definitions: defs }); + else + schema2.$defs = defs; } return schema2; } toJsonSchemaRecurse(ctx) { - if (ctx.useRefs && !this.alwaysExpandJsonSchema) - return { $ref: `#/$defs/${this.id}` }; + if (ctx.useRefs && !this.alwaysExpandJsonSchema) { + const defsKey = ctx.target === "draft-07" ? "definitions" : "$defs"; + return { $ref: `#/${defsKey}/${this.id}` }; + } return this.toResolvedJsonSchema(ctx); } get alwaysExpandJsonSchema() { @@ -87086,39 +87367,39 @@ var BaseRoot = class extends BaseNode { return this._keyof; const result = this.applyStructuralOperation("keyof", []).reduce((result2, branch) => result2.intersect(branch).toNeverIfDisjoint(), $ark.intrinsic.unknown.internal); if (result.branches.length === 0) { - throwParseError(writeUnsatisfiableExpressionError(`keyof ${this.expression}`)); + throwParseError2(writeUnsatisfiableExpressionError(`keyof ${this.expression}`)); } return this._keyof = this.$.finalize(result); } get props() { if (this.branches.length !== 1) - return throwParseError(writeLiteralUnionEntriesMessage(this.expression)); + return throwParseError2(writeLiteralUnionEntriesMessage(this.expression)); return [...this.applyStructuralOperation("props", [])[0]]; } merge(r) { const rNode = this.$.parseDefinition(r); return this.$.schema(rNode.distribute((branch) => this.applyStructuralOperation("merge", [ - structureOf(branch) ?? throwParseError(writeNonStructuralOperandMessage("merge", branch.expression)) + structureOf(branch) ?? throwParseError2(writeNonStructuralOperandMessage("merge", branch.expression)) ]))); } - applyStructuralOperation(operation, args2) { + applyStructuralOperation(operation, args3) { return this.distribute((branch) => { if (branch.equals($ark.intrinsic.object) && operation !== "merge") return branch; const structure = structureOf(branch); if (!structure) { - throwParseError(writeNonStructuralOperandMessage(operation, branch.expression)); + throwParseError2(writeNonStructuralOperandMessage(operation, branch.expression)); } if (operation === "keyof") return structure.keyof(); if (operation === "get") - return structure.get(...args2); + return structure.get(...args3); if (operation === "props") return structure.props; const structuralMethodName = operation === "required" ? "require" : operation === "partial" ? "optionalize" : operation; return this.$.node("intersection", { domain: "object", - structure: structure[structuralMethodName](...args2) + structure: structure[structuralMethodName](...args3) }); }); } @@ -87236,7 +87517,7 @@ var BaseRoot = class extends BaseNode { _constrain(io, kind, schema2) { const constraint = this.$.node(kind, schema2); if (constraint.isRoot()) { - return constraint.isUnknown() ? this : throwInternalError(`Unexpected constraint node ${constraint}`); + return constraint.isUnknown() ? this : throwInternalError2(`Unexpected constraint node ${constraint}`); } const operand = io === "root" ? this : io === "in" ? this.rawIn : this.rawOut; if (operand.hasKind("morph") || constraint.impliedBasis && !operand.extends(constraint.impliedBasis)) { @@ -87321,6 +87602,16 @@ var BaseRoot = class extends BaseNode { } }; var emptyBrandNameMessage = `Expected a non-empty brand name after #`; +var supportedJsonSchemaTargets = [ + "draft-2020-12", + "draft-07" +]; +var writeInvalidJsonSchemaTargetMessage = (target) => `JSONSchema target '${target}' is not supported (must be ${supportedJsonSchemaTargets.map((t) => `"${t}"`).join(" or ")})`; +var validateStandardJsonSchemaTarget = (target) => { + if (!includes(supportedJsonSchemaTargets, target)) + throwParseError2(writeInvalidJsonSchemaTargetMessage(target)); + return target; +}; var exclusivizeRangeSchema = (schema2) => typeof schema2 === "object" && !(schema2 instanceof Date) ? { ...schema2, exclusive: true } : { rule: schema2, exclusive: true @@ -87340,13 +87631,13 @@ var writeLiteralUnionEntriesMessage = (expression) => `Props cannot be extracted ${expression}`; var writeNonStructuralOperandMessage = (operation, operand) => `${operation} operand must be an object (was ${operand})`; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/roots/utils.js -var defineRightwardIntersections = (kind, implementation23) => flatMorph(schemaKindsRightOf(kind), (i, kind2) => [ +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/roots/utils.js +var defineRightwardIntersections = (kind, implementation23) => flatMorph2(schemaKindsRightOf(kind), (i, kind2) => [ kind2, implementation23 ]); -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/roots/alias.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/roots/alias.js var normalizeAliasSchema = (schema2) => typeof schema2 === "string" ? { reference: schema2 } : schema2; var neverIfDisjoint = (result) => result instanceof Disjoint ? $ark.intrinsic.never.internal : result; var implementation12 = implementNode({ @@ -87394,15 +87685,15 @@ var AliasNode = class extends BaseRoot { const seen = []; while (hasArkKind(resolution, "context")) { if (seen.includes(resolution.id)) { - return throwParseError(writeShallowCycleErrorMessage(resolution.id, seen)); + return throwParseError2(writeShallowCycleErrorMessage(resolution.id, seen)); } seen.push(resolution.id); resolution = nodesByRegisteredId[resolution.id]; } if (!hasArkKind(resolution, "root")) { - return throwInternalError(`Unexpected resolution for reference ${this.reference} + return throwInternalError2(`Unexpected resolution for reference ${this.reference} Seen: [${seen.join("->")}] -Resolution: ${printable(resolution)}`); +Resolution: ${printable2(resolution)}`); } return resolution; } @@ -87417,10 +87708,10 @@ Resolution: ${printable(resolution)}`); return resolution; if (hasArkKind(resolution, "root")) return resolution.id; - return throwInternalError(`Unexpected resolution for reference ${this.reference}: ${printable(resolution)}`); + return throwInternalError2(`Unexpected resolution for reference ${this.reference}: ${printable2(resolution)}`); } get defaultShortDescription() { - return domainDescriptions.object; + return domainDescriptions2.object; } innerToJsonSchema(ctx) { return this.resolution.toJsonSchemaRecurse(ctx); @@ -87429,14 +87720,14 @@ Resolution: ${printable(resolution)}`); const seen = ctx.seen[this.reference]; if (seen?.includes(data)) return true; - ctx.seen[this.reference] = append(seen, data); + ctx.seen[this.reference] = append2(seen, data); return this.resolution.traverseAllows(data, ctx); }; traverseApply = (data, ctx) => { const seen = ctx.seen[this.reference]; if (seen?.includes(data)) return; - ctx.seen[this.reference] = append(seen, data); + ctx.seen[this.reference] = append2(seen, data); this.resolution.traverseApply(data, ctx); }; compile(js) { @@ -87453,7 +87744,7 @@ var Alias = { Node: AliasNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/roots/basis.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/roots/basis.js var InternalBasis = class extends BaseRoot { traverseApply = (data, ctx) => { if (!this.traverseAllows(data, ctx)) @@ -87479,7 +87770,7 @@ var InternalBasis = class extends BaseRoot { } }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/roots/domain.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/roots/domain.js var implementation13 = implementNode({ kind: "domain", hasAssociatedError: true, @@ -87488,11 +87779,11 @@ var implementation13 = implementNode({ domain: {}, numberAllowsNaN: {} }, - normalize: (schema2) => typeof schema2 === "string" ? { domain: schema2 } : hasKey(schema2, "numberAllowsNaN") && schema2.domain !== "number" ? throwParseError(Domain.writeBadAllowNanMessage(schema2.domain)) : schema2, + normalize: (schema2) => typeof schema2 === "string" ? { domain: schema2 } : hasKey(schema2, "numberAllowsNaN") && schema2.domain !== "number" ? throwParseError2(Domain.writeBadAllowNanMessage(schema2.domain)) : schema2, applyConfig: (schema2, config2) => schema2.numberAllowsNaN === void 0 && schema2.domain === "number" && config2.numberAllowsNaN ? { ...schema2, numberAllowsNaN: true } : schema2, defaults: { - description: (node2) => domainDescriptions[node2.domain], - actual: (data) => Number.isNaN(data) ? "NaN" : domainDescriptions[domainOf(data)] + description: (node2) => domainDescriptions2[node2.domain], + actual: (data) => Number.isNaN(data) ? "NaN" : domainDescriptions2[domainOf2(data)] }, intersections: { domain: (l, r) => ( @@ -87504,7 +87795,7 @@ var implementation13 = implementNode({ }); var DomainNode = class extends InternalBasis { requiresNaNCheck = this.domain === "number" && !this.numberAllowsNaN; - traverseAllows = this.requiresNaNCheck ? (data) => typeof data === "number" && !Number.isNaN(data) : (data) => domainOf(data) === this.domain; + traverseAllows = this.requiresNaNCheck ? (data) => typeof data === "number" && !Number.isNaN(data) : (data) => domainOf2(data) === this.domain; compiledCondition = this.domain === "object" ? `((typeof data === "object" && data !== null) || typeof data === "function")` : `typeof data === "${this.domain}"${this.requiresNaNCheck ? " && !Number.isNaN(data)" : ""}`; compiledNegation = this.domain === "object" ? `((typeof data !== "object" || data === null) && typeof data !== "function")` : `typeof data !== "${this.domain}"${this.requiresNaNCheck ? " || Number.isNaN(data)" : ""}`; expression = this.numberAllowsNaN ? "number | NaN" : this.domain; @@ -87512,7 +87803,7 @@ var DomainNode = class extends InternalBasis { return this.numberAllowsNaN ? `(${this.expression})` : this.expression; } get defaultShortDescription() { - return domainDescriptions[this.domain]; + return domainDescriptions2[this.domain]; } innerToJsonSchema(ctx) { if (this.domain === "bigint" || this.domain === "symbol") { @@ -87533,7 +87824,7 @@ var Domain = { writeBadAllowNanMessage: (actual) => `numberAllowsNaN may only be specified with domain "number" (was ${actual})` }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/roots/intersection.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/roots/intersection.js var implementation14 = implementNode({ kind: "intersection", hasAssociatedError: true, @@ -87543,21 +87834,21 @@ var implementation14 = implementNode({ const { structure, ...schema2 } = rawSchema; const hasRootStructureKey = !!structure; const normalizedStructure = structure ?? {}; - const normalized = flatMorph(schema2, (k, v) => { - if (isKeyOf(k, structureKeys)) { + const normalized = flatMorph2(schema2, (k, v) => { + if (isKeyOf2(k, structureKeys)) { if (hasRootStructureKey) { - throwParseError(`Flattened structure key ${k} cannot be specified alongside a root 'structure' key.`); + throwParseError2(`Flattened structure key ${k} cannot be specified alongside a root 'structure' key.`); } normalizedStructure[k] = v; return []; } return [k, v]; }); - if (hasArkKind(normalizedStructure, "constraint") || !isEmptyObject(normalizedStructure)) + if (hasArkKind(normalizedStructure, "constraint") || !isEmptyObject2(normalizedStructure)) normalized.structure = normalizedStructure; return normalized; }, - finalizeInnerJson: ({ structure, ...rest }) => hasDomain(structure, "object") ? { ...structure, ...rest } : rest, + finalizeInnerJson: ({ structure, ...rest }) => hasDomain2(structure, "object") ? { ...structure, ...rest } : rest, keys: { domain: { child: true, @@ -87641,7 +87932,7 @@ var implementation14 = implementNode({ if (node2.basis && !node2.prestructurals.some((r) => r.impl.obviatesBasisDescription)) childDescriptions.push(node2.basis.description); if (node2.prestructurals.length) { - const sortedRefinementDescriptions = node2.prestructurals.toSorted((l, r) => l.kind === "min" && r.kind === "max" ? -1 : 0).map((r) => r.description); + const sortedRefinementDescriptions = node2.prestructurals.slice().sort((l, r) => l.kind === "min" && r.kind === "max" ? -1 : 0).map((r) => r.description); childDescriptions.push(...sortedRefinementDescriptions); } if (node2.inner.predicate) { @@ -87707,7 +87998,7 @@ var IntersectionNode = class extends BaseRoot { if (ctx.failFast && ctx.currentErrorCount > errorCount) return; } - this.prestructurals.at(-1).traverseApply(data, ctx); + this.prestructurals[this.prestructurals.length - 1].traverseApply(data, ctx); if (ctx.currentErrorCount > errorCount) return; } @@ -87722,7 +88013,7 @@ var IntersectionNode = class extends BaseRoot { if (ctx.failFast && ctx.currentErrorCount > errorCount) return; } - this.inner.predicate.at(-1).traverseApply(data, ctx); + this.inner.predicate[this.inner.predicate.length - 1].traverseApply(data, ctx); } }; compile(js) { @@ -87743,7 +88034,7 @@ var IntersectionNode = class extends BaseRoot { js.check(this.prestructurals[i]); js.returnIfFailFast(); } - js.check(this.prestructurals.at(-1)); + js.check(this.prestructurals[this.prestructurals.length - 1]); if (this.structure || this.inner.predicate) js.returnIfFail(); } @@ -87757,7 +88048,7 @@ var IntersectionNode = class extends BaseRoot { js.check(this.inner.predicate[i]); js.returnIfFail(); } - js.check(this.inner.predicate.at(-1)); + js.check(this.inner.predicate[this.inner.predicate.length - 1]); } } }; @@ -87794,7 +88085,7 @@ var intersectIntersections = (l, r, ctx) => { }); }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/roots/morph.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/roots/morph.js var implementation15 = implementNode({ kind: "morph", hasAssociatedError: false, @@ -87823,7 +88114,7 @@ var implementation15 = implementNode({ intersections: { morph: (l, r, ctx) => { if (!l.hasEqualMorphs(r)) { - return throwParseError(writeMorphIntersectionMessage(l.expression, r.expression)); + return throwParseError2(writeMorphIntersectionMessage(l.expression, r.expression)); } const inTersection = intersectOrPipeNodes(l.rawIn, r.rawIn, ctx); if (inTersection instanceof Disjoint) @@ -87862,7 +88153,7 @@ var implementation15 = implementNode({ var MorphNode = class extends BaseRoot { serializedMorphs = this.morphs.map(registeredReference); compiledMorphs = `[${this.serializedMorphs}]`; - lastMorph = this.inner.morphs.at(-1); + lastMorph = this.inner.morphs[this.inner.morphs.length - 1]; lastMorphIfNode = hasArkKind(this.lastMorph, "root") ? this.lastMorph : void 0; introspectableIn = this.inner.in; introspectableOut = this.lastMorphIfNode ? Object.assign(this.referencesById, this.lastMorphIfNode.referencesById) && this.lastMorphIfNode.rawOut : void 0; @@ -87930,23 +88221,23 @@ var writeMorphIntersectionMessage = (lDescription, rDescription) => `The interse Left: ${lDescription} Right: ${rDescription}`; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/roots/proto.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/roots/proto.js var implementation16 = implementNode({ kind: "proto", hasAssociatedError: true, collapsibleKey: "proto", keys: { proto: { - serialize: (ctor) => getBuiltinNameOfConstructor(ctor) ?? defaultValueSerializer(ctor) + serialize: (ctor) => getBuiltinNameOfConstructor2(ctor) ?? defaultValueSerializer(ctor) }, dateAllowsInvalid: {} }, normalize: (schema2) => { - const normalized = typeof schema2 === "string" ? { proto: builtinConstructors[schema2] } : typeof schema2 === "function" ? isNode(schema2) ? schema2 : { proto: schema2 } : typeof schema2.proto === "string" ? { ...schema2, proto: builtinConstructors[schema2.proto] } : schema2; + const normalized = typeof schema2 === "string" ? { proto: builtinConstructors2[schema2] } : typeof schema2 === "function" ? isNode(schema2) ? schema2 : { proto: schema2 } : typeof schema2.proto === "string" ? { ...schema2, proto: builtinConstructors2[schema2.proto] } : schema2; if (typeof normalized.proto !== "function") - throwParseError(Proto.writeInvalidSchemaMessage(normalized.proto)); + throwParseError2(Proto.writeInvalidSchemaMessage(normalized.proto)); if (hasKey(normalized, "dateAllowsInvalid") && normalized.proto !== Date) - throwParseError(Proto.writeBadInvalidDateMessage(normalized.proto)); + throwParseError2(Proto.writeBadInvalidDateMessage(normalized.proto)); return normalized; }, applyConfig: (schema2, config2) => { @@ -87955,7 +88246,7 @@ var implementation16 = implementNode({ return schema2; }, defaults: { - description: (node2) => node2.builtinName ? objectKindDescriptions[node2.builtinName] : `an instance of ${node2.proto.name}`, + description: (node2) => node2.builtinName ? objectKindDescriptions2[node2.builtinName] : `an instance of ${node2.proto.name}`, actual: (data) => data instanceof Date && data.toString() === "Invalid Date" ? "an invalid Date" : objectKindOrDomainOf(data) }, intersections: { @@ -87968,7 +88259,7 @@ var implementation16 = implementNode({ } }); var ProtoNode = class extends InternalBasis { - builtinName = getBuiltinNameOfConstructor(this.proto); + builtinName = getBuiltinNameOfConstructor2(this.proto); serializedConstructor = this.json.proto; requiresInvalidDateCheck = this.proto === Date && !this.dateAllowsInvalid; traverseAllows = this.requiresInvalidDateCheck ? (data) => data instanceof Date && data.toString() !== "Invalid Date" : (data) => data instanceof this.proto; @@ -88003,10 +88294,10 @@ var Proto = { implementation: implementation16, Node: ProtoNode, writeBadInvalidDateMessage: (actual) => `dateAllowsInvalid may only be specified with constructor Date (was ${actual.name})`, - writeInvalidSchemaMessage: (actual) => `instanceOf operand must be a function (was ${domainOf(actual)})` + writeInvalidSchemaMessage: (actual) => `instanceOf operand must be a function (was ${domainOf2(actual)})` }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/roots/union.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/roots/union.js var implementation17 = implementNode({ kind: "union", hasAssociatedError: true, @@ -88062,7 +88353,7 @@ var implementation17 = implementNode({ for (const errorAtPath of errors) appendUnique(branchesAtPath, errorAtPath.expected); const expected = describeBranches(branchesAtPath); - const actual = errors.every((e) => e.actual === errors[0].actual) ? errors[0].actual : printable(errors[0].data); + const actual = errors.every((e) => e.actual === errors[0].actual) ? errors[0].actual : printable2(errors[0].data); return `${path3 && `${path3} `}must be ${expected}${actual && ` (was ${actual})`}`; }); return describeBranches(pathDescriptions); @@ -88083,7 +88374,7 @@ var implementation17 = implementNode({ let resultBranches; if (l.ordered) { if (r.ordered) { - throwParseError(writeOrderedIntersectionMessage(l.expression, r.expression)); + throwParseError2(writeOrderedIntersectionMessage(l.expression, r.expression)); } resultBranches = intersectBranches(r.branches, l.branches, ctx); if (resultBranches instanceof Disjoint) @@ -88132,7 +88423,7 @@ var UnionNode = class extends BaseRoot { createBranchedOptimisticRootApply() { return (data, onFail) => { const optimisticResult = this.traverseOptimistic(data); - if (optimisticResult !== unset) + if (optimisticResult !== unset2) return optimisticResult; const ctx = new Traversal(data, this.$.resolvedConfig); this.traverseApply(data, ctx); @@ -88186,7 +88477,7 @@ var UnionNode = class extends BaseRoot { return data; } } - return unset; + return unset2; }; compile(js) { if (!this.discriminant || // if we have a union of two units like `boolean`, the @@ -88211,9 +88502,9 @@ var UnionNode = class extends BaseRoot { if (v.rootApplyStrategy === "branchedOptimistic") caseResult = js.invoke(v, { kind: "Optimistic" }); else if (v.contextFreeMorph) - caseResult = `${js.invoke(v)} ? ${registeredReference(v.contextFreeMorph)}(data) : "${unset}"`; + caseResult = `${js.invoke(v)} ? ${registeredReference(v.contextFreeMorph)}(data) : "${unset2}"`; else - caseResult = `${js.invoke(v)} ? data : "${unset}"`; + caseResult = `${js.invoke(v)} ? data : "${unset2}"`; } else caseResult = js.invoke(v); js.line(`${caseCondition}: return ${caseResult}`); @@ -88221,12 +88512,12 @@ var UnionNode = class extends BaseRoot { return js; }); if (js.traversalKind === "Allows") { - js.return(optimistic ? `"${unset}"` : false); + js.return(optimistic ? `"${unset2}"` : false); return; } const expected = describeBranches(this.discriminant.kind === "domain" ? caseKeys.map((k) => { const jsTypeOf = k.slice(1, -1); - return jsTypeOf === "function" ? domainDescriptions.object : domainDescriptions[jsTypeOf]; + return jsTypeOf === "function" ? domainDescriptions2.object : domainDescriptions2[jsTypeOf]; }) : caseKeys); const serializedPathSegments = this.discriminant.path.map((k) => typeof k === "symbol" ? registeredReference(k) : JSON.stringify(k)); const serializedExpected = JSON.stringify(expected); @@ -88252,7 +88543,7 @@ var UnionNode = class extends BaseRoot { for (const branch of this.branches) { js.if(`${js.invoke(branch)}`, () => js.return(optimistic ? branch.contextFreeMorph ? `${registeredReference(branch.contextFreeMorph)}(data)` : "data" : true)); } - js.return(optimistic ? `"${unset}"` : false); + js.return(optimistic ? `"${unset2}"` : false); } } get nestableExpression() { @@ -88262,7 +88553,7 @@ var UnionNode = class extends BaseRoot { if (this.branches.length < 2 || this.isCyclic) return null; if (this.unitBranches.length === this.branches.length) { - const cases2 = flatMorph(this.unitBranches, (i, n) => [ + const cases2 = flatMorph2(this.unitBranches, (i, n) => [ `${n.rawIn.serializedValue}`, n.hasKind("morph") ? n : true ]); @@ -88461,8 +88752,8 @@ var discriminantCaseToNode = (caseDiscriminant, path3, $2) => { return node2; }; var optionallyChainPropString = (path3) => path3.reduce((acc, k) => acc + compileLiteralPropAccess(k, true), "data"); -var serializedTypeOfDescriptions = registeredReference(jsTypeOfDescriptions); -var serializedPrintable = registeredReference(printable); +var serializedTypeOfDescriptions = registeredReference(jsTypeOfDescriptions2); +var serializedPrintable = registeredReference(printable2); var Union = { implementation: implementation17, Node: UnionNode @@ -88470,7 +88761,7 @@ var Union = { var discriminantToJson = (discriminant) => ({ kind: discriminant.kind, path: discriminant.path.map((k) => typeof k === "string" ? k : compileSerializedValue(k)), - cases: flatMorph(discriminant.cases, (k, node2) => [ + cases: flatMorph2(discriminant.cases, (k, node2) => [ k, node2 === true ? node2 : node2.hasKind("union") && node2.discriminantJson ? node2.discriminantJson : node2.json ]) @@ -88559,12 +88850,12 @@ var assertDeterminateOverlap = (l, r) => { if (!l.includesTransform && !r.includesTransform) return; if (!arrayEquals(l.shallowMorphs, r.shallowMorphs)) { - throwParseError(writeIndiscriminableMorphMessage(l.expression, r.expression)); + throwParseError2(writeIndiscriminableMorphMessage(l.expression, r.expression)); } if (!arrayEquals(l.flatMorphs, r.flatMorphs, { isEqual: (l2, r2) => l2.propString === r2.propString && (l2.node.hasKind("morph") && r2.node.hasKind("morph") ? l2.node.hasEqualMorphs(r2.node) : l2.node.hasKind("intersection") && r2.node.hasKind("intersection") ? l2.node.structure?.structuralMorphRef === r2.node.structure?.structuralMorphRef : false) })) { - throwParseError(writeIndiscriminableMorphMessage(l.expression, r.expression)); + throwParseError2(writeIndiscriminableMorphMessage(l.expression, r.expression)); } }; var pruneDiscriminant = (discriminantBranch, discriminantCtx) => discriminantBranch.transform((nodeKind, inner) => { @@ -88590,7 +88881,7 @@ var writeOrderedIntersectionMessage = (lDescription, rDescription) => `The inter Left: ${lDescription} Right: ${rDescription}`; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/roots/unit.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/roots/unit.js var implementation18 = implementNode({ kind: "unit", hasAssociatedError: true, @@ -88602,7 +88893,7 @@ var implementation18 = implementNode({ }, normalize: (schema2) => schema2, defaults: { - description: (node2) => printable(node2.unit), + description: (node2) => printable2(node2.unit), problem: ({ expected, actual }) => `${expected === actual ? `must be reference equal to ${expected} (serialized to the same value)` : `must be ${expected} (was ${actual})`}` }, intersections: { @@ -88627,10 +88918,10 @@ var UnitNode = class extends InternalBasis { serializedValue = typeof this.unit === "string" || this.unit instanceof Date ? JSON.stringify(this.compiledValue) : `${this.compiledValue}`; compiledCondition = compileEqualityCheck(this.unit, this.serializedValue); compiledNegation = compileEqualityCheck(this.unit, this.serializedValue, "negated"); - expression = printable(this.unit); - domain = domainOf(this.unit); + expression = printable2(this.unit); + domain = domainOf2(this.unit); get defaultShortDescription() { - return this.domain === "object" ? domainDescriptions.object : this.description; + return this.domain === "object" ? domainDescriptions2.object : this.description; } innerToJsonSchema(ctx) { return ( @@ -88654,7 +88945,7 @@ var compileEqualityCheck = (unit, serializedValue, negated) => { return `data ${negated ? "!" : "="}== ${serializedValue}`; }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/structure/index.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/structure/index.js var implementation19 = implementNode({ kind: "index", hasAssociatedError: false, @@ -88665,11 +88956,11 @@ var implementation19 = implementNode({ parse: (schema2, ctx) => { const key = ctx.$.parseSchema(schema2); if (!key.extends($ark.intrinsic.key)) { - return throwParseError(writeInvalidPropertyKeyMessage(key.expression)); + return throwParseError2(writeInvalidPropertyKeyMessage(key.expression)); } const enumerableBranches = key.branches.filter((b) => b.hasKind("unit")); if (enumerableBranches.length) { - return throwParseError(writeEnumerableIndexBranches(enumerableBranches.map((b) => printable(b.unit)))); + return throwParseError2(writeEnumerableIndexBranches(enumerableBranches.map((b) => printable2(b.unit)))); } return key; } @@ -88701,15 +88992,15 @@ var implementation19 = implementNode({ var IndexNode = class extends BaseConstraint { impliedBasis = $ark.intrinsic.object.internal; expression = `[${this.signature.expression}]: ${this.value.expression}`; - flatRefs = append(this.value.flatRefs.map((ref) => flatRef([this.signature, ...ref.path], ref.node)), flatRef([this.signature], this.value)); - traverseAllows = (data, ctx) => stringAndSymbolicEntriesOf(data).every((entry) => { + flatRefs = append2(this.value.flatRefs.map((ref) => flatRef([this.signature, ...ref.path], ref.node)), flatRef([this.signature], this.value)); + traverseAllows = (data, ctx) => stringAndSymbolicEntriesOf2(data).every((entry) => { if (this.signature.traverseAllows(entry[0], ctx)) { return traverseKey(entry[0], () => this.value.traverseAllows(entry[1], ctx), ctx); } return true; }); traverseApply = (data, ctx) => { - for (const entry of stringAndSymbolicEntriesOf(data)) { + for (const entry of stringAndSymbolicEntriesOf2(data)) { if (this.signature.traverseAllows(entry[0], ctx)) { traverseKey(entry[0], () => this.value.traverseApply(entry[1], ctx), ctx); } @@ -88731,7 +89022,7 @@ var Index = { var writeEnumerableIndexBranches = (keys) => `Index keys ${keys.join(", ")} should be specified as named props.`; var writeInvalidPropertyKeyMessage = (indexSchema) => `Indexed key definition '${indexSchema}' must be a string or symbol`; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/structure/required.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/structure/required.js var implementation20 = implementNode({ kind: "required", hasAssociatedError: true, @@ -88769,7 +89060,7 @@ var Required = { Node: RequiredNode }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/structure/sequence.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/structure/sequence.js var implementation21 = implementNode({ kind: "sequence", hasAssociatedError: false, @@ -88840,12 +89131,12 @@ var implementation21 = implementNode({ if ("variadic" in schema2 || "prefix" in schema2 || "defaultables" in schema2 || "optionals" in schema2 || "postfix" in schema2 || "minVariadicLength" in schema2) { if (schema2.postfix?.length) { if (!schema2.variadic) - return throwParseError(postfixWithoutVariadicMessage); + return throwParseError2(postfixWithoutVariadicMessage); if (schema2.optionals?.length || schema2.defaultables?.length) - return throwParseError(postfixAfterOptionalOrDefaultableMessage); + return throwParseError2(postfixAfterOptionalOrDefaultableMessage); } if (schema2.minVariadicLength && !schema2.variadic) { - return throwParseError("minVariadicLength may not be specified without a variadic element"); + return throwParseError2("minVariadicLength may not be specified without a variadic element"); } return schema2; } @@ -88858,10 +89149,10 @@ var implementation21 = implementNode({ const optionals = raw.optionals?.slice() ?? []; const postfix = raw.postfix?.slice() ?? []; if (raw.variadic) { - while (optionals.at(-1)?.equals(raw.variadic)) + while (optionals[optionals.length - 1]?.equals(raw.variadic)) optionals.pop(); if (optionals.length === 0 && defaultables.length === 0) { - while (prefix.at(-1)?.equals(raw.variadic)) { + while (prefix[prefix.length - 1]?.equals(raw.variadic)) { prefix.pop(); minVariadicLength++; } @@ -88893,7 +89184,7 @@ var implementation21 = implementNode({ description: (node2) => { if (node2.isVariadicOnly) return `${node2.variadic.nestableExpression}[]`; - const innerDescription = node2.tuple.map((element) => element.kind === "defaultables" ? `${element.node.nestableExpression} = ${printable(element.default)}` : element.kind === "optionals" ? `${element.node.nestableExpression}?` : element.kind === "variadic" ? `...${element.node.nestableExpression}[]` : element.node.expression).join(", "); + const innerDescription = node2.tuple.map((element) => element.kind === "defaultables" ? `${element.node.nestableExpression} = ${printable2(element.default)}` : element.kind === "optionals" ? `${element.node.nestableExpression}?` : element.kind === "variadic" ? `...${element.node.nestableExpression}[]` : element.node.expression).join(", "); return `[${innerDescription}]`; } }, @@ -88938,11 +89229,11 @@ var SequenceNode = class extends BaseConstraint { // have to wait until prevariadic and variadicOrPostfix are set to calculate flatRefs = this.addFlatRefs(); addFlatRefs() { - appendUniqueFlatRefs(this.flatRefs, this.prevariadic.flatMap((element, i) => append(element.node.flatRefs.map((ref) => flatRef([`${i}`, ...ref.path], ref.node)), flatRef([`${i}`], element.node)))); + appendUniqueFlatRefs(this.flatRefs, this.prevariadic.flatMap((element, i) => append2(element.node.flatRefs.map((ref) => flatRef([`${i}`, ...ref.path], ref.node)), flatRef([`${i}`], element.node)))); appendUniqueFlatRefs(this.flatRefs, this.variadicOrPostfix.flatMap((element) => ( // a postfix index can't be directly represented as a type // key, so we just use the same matcher for variadic - append(element.flatRefs.map((ref) => flatRef([$ark.intrinsic.nonNegativeIntegerString.internal, ...ref.path], ref.node)), flatRef([$ark.intrinsic.nonNegativeIntegerString.internal], element)) + append2(element.flatRefs.map((ref) => flatRef([$ark.intrinsic.nonNegativeIntegerString.internal, ...ref.path], ref.node)), flatRef([$ark.intrinsic.nonNegativeIntegerString.internal], element)) ))); return this.flatRefs; } @@ -88963,7 +89254,7 @@ var SequenceNode = class extends BaseConstraint { return { kind: "postfix", node: this.postfix[index - firstPostfixIndex] }; return { kind: "variadic", - node: this.variadic ?? throwInternalError(`Unexpected attempt to access index ${index} on ${this}`) + node: this.variadic ?? throwInternalError2(`Unexpected attempt to access index ${index} on ${this}`) }; } // minLength/maxLength should be checked by Intersection before either traversal @@ -89018,8 +89309,9 @@ var SequenceNode = class extends BaseConstraint { // this depends on tuple so needs to come after it expression = this.description; reduceJsonSchema(schema2, ctx) { + const isDraft07 = ctx.target === "draft-07"; if (this.prevariadic.length) { - schema2.prefixItems = this.prevariadic.map((el) => { + const prefixSchemas = this.prevariadic.map((el) => { const valueSchema = el.node.toJsonSchemaRecurse(ctx); if (el.kind === "defaultables") { const value2 = typeof el.default === "function" ? el.default() : el.default; @@ -89031,25 +89323,34 @@ var SequenceNode = class extends BaseConstraint { } return valueSchema; }); + if (isDraft07) + schema2.items = prefixSchemas; + else + schema2.prefixItems = prefixSchemas; } if (this.minLength) schema2.minItems = this.minLength; if (this.variadic) { - const variadicSchema = Object.assign(schema2, { - items: this.variadic.toJsonSchemaRecurse(ctx) - }); + const variadicItemSchema = this.variadic.toJsonSchemaRecurse(ctx); + if (isDraft07 && this.prevariadic.length) + schema2.additionalItems = variadicItemSchema; + else + schema2.items = variadicItemSchema; if (this.maxLength) - variadicSchema.maxItems = this.maxLength; + schema2.maxItems = this.maxLength; if (this.postfix) { const elements = this.postfix.map((el) => el.toJsonSchemaRecurse(ctx)); schema2 = ctx.fallback.arrayPostfix({ code: "arrayPostfix", - base: variadicSchema, + base: schema2, elements }); } } else { - schema2.items = false; + if (isDraft07) + schema2.additionalItems = false; + else + schema2.items = false; delete schema2.maxItems; } return schema2; @@ -89097,11 +89398,11 @@ var sequenceTupleToInner = (tuple) => tuple.reduce((result, element) => { if (element.kind === "variadic") result.variadic = element.node; else if (element.kind === "defaultables") { - result.defaultables = append(result.defaultables, [ + result.defaultables = append2(result.defaultables, [ [element.node, element.default] ]); } else - result[element.kind] = append(result[element.kind], element.node); + result[element.kind] = append2(result[element.kind], element.node); return result; }, {}); var postfixAfterOptionalOrDefaultableMessage = "A postfix required element cannot follow an optional or defaultable element"; @@ -89111,8 +89412,8 @@ var _intersectSequences = (s) => { const [rHead, ...rTail] = s.r; if (!lHead || !rHead) return s; - const lHasPostfix = lTail.at(-1)?.kind === "postfix"; - const rHasPostfix = rTail.at(-1)?.kind === "postfix"; + const lHasPostfix = lTail[lTail.length - 1]?.kind === "postfix"; + const rHasPostfix = rTail[rTail.length - 1]?.kind === "postfix"; const kind = lHead.kind === "prefix" || rHead.kind === "prefix" ? "prefix" : lHead.kind === "postfix" || rHead.kind === "postfix" ? "postfix" : lHead.kind === "variadic" && rHead.kind === "variadic" ? "variadic" : lHasPostfix || rHasPostfix ? "prefix" : lHead.kind === "defaultables" || rHead.kind === "defaultables" ? "defaultables" : "optionals"; if (lHead.kind === "prefix" && rHead.kind === "variadic" && rHasPostfix) { const postfixBranchResult = _intersectSequences({ @@ -89156,14 +89457,14 @@ var _intersectSequences = (s) => { } } else if (kind === "defaultables") { if (lHead.kind === "defaultables" && rHead.kind === "defaultables" && lHead.default !== rHead.default) { - throwParseError(writeDefaultIntersectionMessage(lHead.default, rHead.default)); + throwParseError2(writeDefaultIntersectionMessage(lHead.default, rHead.default)); } s.result = [ ...s.result, { kind, node: result, - default: lHead.kind === "defaultables" ? lHead.default : rHead.kind === "defaultables" ? rHead.default : throwInternalError(`Unexpected defaultable intersection from ${lHead.kind} and ${rHead.kind} elements.`) + default: lHead.kind === "defaultables" ? lHead.default : rHead.kind === "defaultables" ? rHead.default : throwInternalError2(`Unexpected defaultable intersection from ${lHead.kind} and ${rHead.kind} elements.`) } ]; } else @@ -89178,7 +89479,7 @@ var _intersectSequences = (s) => { }; var elementIsRequired = (el) => el.kind === "prefix" || el.kind === "postfix"; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/structure/structure.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/structure/structure.js var createStructuralWriter = (childStringProp) => (node2) => { if (node2.props.length || node2.index) { const parts = node2.index?.map((index) => index[childStringProp]) ?? []; @@ -89224,7 +89525,7 @@ var implementation22 = implementNode({ child: true, parse: constraintKeyParser("required"), reduceIo: (ioKind, inner, nodes) => { - inner.required = append(inner.required, nodes.map((node2) => ioKind === "in" ? node2.rawIn : node2.rawOut)); + inner.required = append2(inner.required, nodes.map((node2) => ioKind === "in" ? node2.rawIn : node2.rawOut)); return; } }, @@ -89237,7 +89538,7 @@ var implementation22 = implementNode({ return; } for (const node2 of nodes) { - inner[node2.outProp.kind] = append(inner[node2.outProp.kind], node2.outProp.rawOut); + inner[node2.outProp.kind] = append2(inner[node2.outProp.kind], node2.outProp.rawOut); } } }, @@ -89358,7 +89659,7 @@ var implementation22 = implementNode({ for (let i = 0; i < inner.required.length; i++) { const requiredProp = inner.required[i]; if (requiredProp.key in seen) - throwParseError(writeDuplicateKeyMessage(requiredProp.key)); + throwParseError2(writeDuplicateKeyMessage(requiredProp.key)); seen[requiredProp.key] = true; if (inner.index) { for (const index of inner.index) { @@ -89373,7 +89674,7 @@ var implementation22 = implementNode({ for (let i = 0; i < inner.optional.length; i++) { const optionalProp = inner.optional[i]; if (optionalProp.key in seen) - throwParseError(writeDuplicateKeyMessage(optionalProp.key)); + throwParseError2(writeDuplicateKeyMessage(optionalProp.key)); seen[optionalProp.key] = true; if (inner.index) { for (const index of inner.index) { @@ -89397,7 +89698,7 @@ var StructureNode = class extends BaseConstraint { impliedBasis = $ark.intrinsic.object.internal; impliedSiblings = this.children.flatMap((n) => n.impliedSiblings ?? []); props = conflatenate(this.required, this.optional); - propsByKey = flatMorph(this.props, (i, node2) => [node2.key, node2]); + propsByKey = flatMorph2(this.props, (i, node2) => [node2.key, node2]); propsByKeyReference = registeredReference(this.propsByKey); expression = structuralExpression(this); requiredKeys = this.required?.map((node2) => node2.key) ?? []; @@ -89419,21 +89720,21 @@ var StructureNode = class extends BaseConstraint { const originalProp = this.propsByKey[mapped.key]; if (isNode(mapped)) { if (mapped.kind !== "required" && mapped.kind !== "optional") { - return throwParseError(`Map result must have kind "required" or "optional" (was ${mapped.kind})`); + return throwParseError2(`Map result must have kind "required" or "optional" (was ${mapped.kind})`); } - structureInner[mapped.kind] = append(structureInner[mapped.kind], mapped); + structureInner[mapped.kind] = append2(structureInner[mapped.kind], mapped); return structureInner; } const mappedKind = mapped.kind ?? originalProp?.kind ?? "required"; - const mappedPropInner = flatMorph(mapped, (k, v) => k in Optional.implementation.keys ? [k, v] : []); - structureInner[mappedKind] = append(structureInner[mappedKind], this.$.node(mappedKind, mappedPropInner)); + const mappedPropInner = flatMorph2(mapped, (k, v) => k in Optional.implementation.keys ? [k, v] : []); + structureInner[mappedKind] = append2(structureInner[mappedKind], this.$.node(mappedKind, mappedPropInner)); return structureInner; }, {})); } assertHasKeys(keys) { const invalidKeys = keys.filter((k) => !typeOrTermExtends(k, this.keyof())); if (invalidKeys.length) { - return throwParseError(writeInvalidKeysMessage(this.expression, invalidKeys)); + return throwParseError2(writeInvalidKeysMessage(this.expression, invalidKeys)); } } get(indexer, ...path3) { @@ -89468,9 +89769,9 @@ var StructureNode = class extends BaseConstraint { } if (!value2) { if (this.sequence?.variadic && hasArkKind(key, "root") && key.extends($ark.intrinsic.number)) { - return throwParseError(writeNumberIndexMessage(key.expression, this.sequence.expression)); + return throwParseError2(writeNumberIndexMessage(key.expression, this.sequence.expression)); } - return throwParseError(writeInvalidKeysMessage(this.expression, [key])); + return throwParseError2(writeInvalidKeysMessage(this.expression, [key])); } const result = value2.get(...path3); return required2 ? result : result.or($ark.intrinsic.undefined); @@ -89503,11 +89804,11 @@ var StructureNode = class extends BaseConstraint { merge(r) { const inner = this.filterKeys("omit", [r.keyof()]); if (r.required) - inner.required = append(inner.required, r.required); + inner.required = append2(inner.required, r.required); if (r.optional) - inner.optional = append(inner.optional, r.optional); + inner.optional = append2(inner.optional, r.optional); if (r.index) - inner.index = append(inner.index, r.index); + inner.index = append2(inner.index, r.index); if (r.sequence) inner.sequence = r.sequence; if (r.undeclared) @@ -89731,7 +90032,7 @@ var StructureNode = class extends BaseConstraint { }); } if (!keyBranch.hasKind("intersection")) { - return throwInternalError(`Unexpected index branch kind ${keyBranch.kind}.`); + return throwInternalError2(`Unexpected index branch kind ${keyBranch.kind}.`); } const { pattern } = keyBranch.inner; if (pattern) { @@ -89812,11 +90113,11 @@ var getPossibleMorph = (node2) => { }; var precompileMorphs = (js, node2) => { const requiresContext = node2.defaultable.some((node3) => node3.defaultValueMorph.length === 2) || node2.sequence?.defaultValueMorphs.some((morph) => morph.length === 2); - const args2 = `(data${requiresContext ? ", ctx" : ""})`; - return js.block(`${args2} => `, (js2) => { + const args3 = `(data${requiresContext ? ", ctx" : ""})`; + return js.block(`${args3} => `, (js2) => { for (let i = 0; i < node2.defaultable.length; i++) { const { serializedKey, defaultValueMorphRef } = node2.defaultable[i]; - js2.if(`!(${serializedKey} in data)`, (js3) => js3.line(`${defaultValueMorphRef}${args2}`)); + js2.if(`!(${serializedKey} in data)`, (js3) => js3.line(`${defaultValueMorphRef}${args3}`)); } if (node2.sequence?.defaultables) { js2.for(`i < ${node2.sequence.defaultables.length}`, (js3) => js3.set(`data[i]`, 5), `data.length - ${node2.sequence.prefixLength}`); @@ -89846,7 +90147,7 @@ var normalizeIndex = (signature, value2, $2) => { const normalized = {}; for (const n of enumerableBranches) { const prop = $2.node("required", { key: n.unit, value: value2 }); - normalized[prop.kind] = append(normalized[prop.kind], prop); + normalized[prop.kind] = append2(normalized[prop.kind], prop); } if (nonEnumerableBranches.length) { normalized.index = $2.node("index", { @@ -89856,11 +90157,11 @@ var normalizeIndex = (signature, value2, $2) => { } return normalized; }; -var typeKeyToString = (k) => hasArkKind(k, "root") ? k.expression : printable(k); +var typeKeyToString = (k) => hasArkKind(k, "root") ? k.expression : printable2(k); var writeInvalidKeysMessage = (o, keys) => `Key${keys.length === 1 ? "" : "s"} ${keys.map(typeKeyToString).join(", ")} ${keys.length === 1 ? "does" : "do"} not exist on ${o}`; var writeDuplicateKeyMessage = (key) => `Duplicate key ${compileSerializedValue(key)}`; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/kinds.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/kinds.js var nodeImplementationsByKind = { ...boundImplementationsByKind, alias: Alias.implementation, @@ -89879,11 +90180,11 @@ var nodeImplementationsByKind = { sequence: Sequence.implementation, structure: Structure.implementation }; -$ark.defaultConfig = withAlphabetizedKeys(Object.assign(flatMorph(nodeImplementationsByKind, (kind, implementation23) => [ +$ark.defaultConfig = withAlphabetizedKeys(Object.assign(flatMorph2(nodeImplementationsByKind, (kind, implementation23) => [ kind, implementation23.defaults ]), { - jitless: envHasCsp(), + jitless: envHasCsp2(), clone: deepClone, onUndeclaredKey: "ignore", exactOptionalPropertyTypes: true, @@ -89913,21 +90214,21 @@ var nodeClassesByKind = { structure: Structure.Node }; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/module.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/module.js var RootModule = class extends DynamicBase { // ensure `[arkKind]` is non-enumerable so it doesn't get spread on import/export get [arkKind]() { return "module"; } }; -var bindModule = (module, $2) => new RootModule(flatMorph(module, (alias, value2) => [ +var bindModule = (module, $2) => new RootModule(flatMorph2(module, (alias, value2) => [ alias, hasArkKind(value2, "module") ? bindModule(value2, $2) : $2.bindReference(value2) ])); -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/scope.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/scope.js var schemaBranchesOf = (schema2) => isArray(schema2) ? schema2 : "branches" in schema2 && isArray(schema2.branches) ? schema2.branches : void 0; -var throwMismatchedNodeRootError = (expected, actual) => throwParseError(`Node of kind ${actual} is not valid as a ${expected} definition`); +var throwMismatchedNodeRootError = (expected, actual) => throwParseError2(`Node of kind ${actual} is not valid as a ${expected} definition`); var writeDuplicateAliasError = (alias) => `#${alias} duplicates public alias ${alias}`; var scopesByName = {}; $ark.ambient ??= {}; @@ -89994,7 +90295,7 @@ var BaseScope = class { this.resolvedConfig = mergeConfigs($ark.resolvedConfig, config2); this.name = this.resolvedConfig.name ?? `anonymousScope${Object.keys(scopesByName).length}`; if (this.name in scopesByName) - throwParseError(`A Scope already named ${this.name} already exists`); + throwParseError2(`A Scope already named ${this.name} already exists`); scopesByName[this.name] = this; const aliasEntries = Object.entries(def).map((entry) => this.preparseOwnAliasEntry(...entry)); for (const [k, v] of aliasEntries) { @@ -90002,11 +90303,11 @@ var BaseScope = class { if (k[0] === "#") { name = k.slice(1); if (name in this.aliases) - throwParseError(writeDuplicateAliasError(name)); + throwParseError2(writeDuplicateAliasError(name)); this.aliases[name] = v; } else { if (name in this.aliases) - throwParseError(writeDuplicateAliasError(k)); + throwParseError2(writeDuplicateAliasError(k)); this.aliases[name] = v; this.exportedNames.push(name); } @@ -90029,7 +90330,7 @@ var BaseScope = class { ] }, { prereduced: true }); this.nodesByHash[rawUnknownUnion.hash] = this.node("intersection", {}, { prereduced: true }); - this.intrinsic = $ark.intrinsic ? flatMorph($ark.intrinsic, (k, v) => ( + this.intrinsic = $ark.intrinsic ? flatMorph2($ark.intrinsic, (k, v) => ( // don't include cyclic aliases from JSON scope k.startsWith("json") ? [] : [k, this.bindReference(v)] )) : {}; @@ -90090,7 +90391,7 @@ var BaseScope = class { schema2 = resolution; kind = resolution.kind; } - } else if (kind === "union" && hasDomain(schema2, "object")) { + } else if (kind === "union" && hasDomain2(schema2, "object")) { const branches = schemaBranchesOf(schema2); if (branches?.length === 1) { schema2 = branches[0]; @@ -90125,7 +90426,7 @@ var BaseScope = class { return bound; } resolveRoot(name) { - return this.maybeResolveRoot(name) ?? throwParseError(writeUnresolvableMessage(name)); + return this.maybeResolveRoot(name) ?? throwParseError2(writeUnresolvableMessage(name)); } maybeResolveRoot(name) { const result = this.maybeResolve(name); @@ -90141,11 +90442,11 @@ var BaseScope = class { return $ark.ambient; } maybeResolve(name) { - const cached3 = this.resolutions[name]; - if (cached3) { - if (typeof cached3 !== "string") - return this.bindReference(cached3); - const v = nodesByRegisteredId[cached3]; + const cached4 = this.resolutions[name]; + if (cached4) { + if (typeof cached4 !== "string") + return this.bindReference(cached4); + const v = nodesByRegisteredId[cached4]; if (hasArkKind(v, "root")) return this.resolutions[name] = v; if (hasArkKind(v, "context")) { @@ -90153,7 +90454,7 @@ var BaseScope = class { return this.node("alias", { reference: `$${name}` }, { prereduced: true }); } if (v.phase === "resolved") { - return throwInternalError(`Unexpected resolved context for was uncached by its scope: ${printable(v)}`); + return throwInternalError2(`Unexpected resolved context for was uncached by its scope: ${printable2(v)}`); } v.phase = "resolving"; const node2 = this.bindReference(this.parseOwnDefinitionFormat(v.def, v)); @@ -90162,7 +90463,7 @@ var BaseScope = class { nodesByRegisteredId[v.id] = node2; return this.resolutions[name] = node2; } - return throwInternalError(`Unexpected nodesById entry for ${cached3}: ${printable(v)}`); + return throwInternalError2(`Unexpected nodesById entry for ${cached4}: ${printable2(v)}`); } let def = this.aliases[name] ?? this.ambient?.[name]; if (!def) @@ -90172,7 +90473,7 @@ var BaseScope = class { return this.resolutions[name] = this.bindReference(def); if (hasArkKind(def, "module")) { if (!def.root) - throwParseError(writeMissingSubmoduleAccessMessage(name)); + throwParseError2(writeMissingSubmoduleAccessMessage(name)); return this.resolutions[name] = this.bindReference(def.root); } return this.resolutions[name] = this.parse(def, { @@ -90192,7 +90493,7 @@ var BaseScope = class { return new Traversal(root2, this.resolvedConfig); } import(...names) { - return new RootModule(flatMorph(this.export(...names), (alias, value2) => [ + return new RootModule(flatMorph2(this.export(...names), (alias, value2) => [ `#${alias}`, value2 ])); @@ -90221,7 +90522,7 @@ var BaseScope = class { this.resolved = true; } const namesToExport = names.length ? names : this.exportedNames; - return new RootModule(flatMorph(namesToExport, (_, name) => [ + return new RootModule(flatMorph2(namesToExport, (_, name) => [ name, this._exports[name] ])); @@ -90285,9 +90586,9 @@ var bootstrapAliasReferences = (resolution) => { } return resolution; }; -var resolutionsToJson = (resolutions) => flatMorph(resolutions, (k, v) => [ +var resolutionsToJson = (resolutions) => flatMorph2(resolutions, (k, v) => [ k, - hasArkKind(v, "root") || hasArkKind(v, "generic") ? v.json : hasArkKind(v, "module") ? resolutionsToJson(v) : throwInternalError(`Unexpected resolution ${printable(v)}`) + hasArkKind(v, "root") || hasArkKind(v, "generic") ? v.json : hasArkKind(v, "module") ? resolutionsToJson(v) : throwInternalError2(`Unexpected resolution ${printable2(v)}`) ]); var maybeResolveSubalias = (base, name) => { const dotIndex = name.indexOf("."); @@ -90298,7 +90599,7 @@ var maybeResolveSubalias = (base, name) => { if (prefixSchema === void 0) return; if (!hasArkKind(prefixSchema, "module")) - return throwParseError(writeNonSubmoduleDotMessage(dotPrefix)); + return throwParseError2(writeNonSubmoduleDotMessage(dotPrefix)); const subalias = name.slice(dotIndex + 1); const resolution = prefixSchema[subalias]; if (resolution === void 0) @@ -90306,9 +90607,9 @@ var maybeResolveSubalias = (base, name) => { if (hasArkKind(resolution, "root") || hasArkKind(resolution, "generic")) return resolution; if (hasArkKind(resolution, "module")) { - return resolution.root ?? throwParseError(writeMissingSubmoduleAccessMessage(name)); + return resolution.root ?? throwParseError2(writeMissingSubmoduleAccessMessage(name)); } - throwInternalError(`Unexpected resolution for alias '${name}': ${printable(resolution)}`); + throwInternalError2(`Unexpected resolution for alias '${name}': ${printable2(resolution)}`); }; var schemaScope = (aliases, config2) => new SchemaScope(aliases, config2); var rootSchemaScope = new SchemaScope({}); @@ -90318,12 +90619,12 @@ var resolutionsOfModule = ($2, typeSet) => { const v = typeSet[k]; if (hasArkKind(v, "module")) { const innerResolutions = resolutionsOfModule($2, v); - const prefixedResolutions = flatMorph(innerResolutions, (innerK, innerV) => [`${k}.${innerK}`, innerV]); + const prefixedResolutions = flatMorph2(innerResolutions, (innerK, innerV) => [`${k}.${innerK}`, innerV]); Object.assign(result, prefixedResolutions); } else if (hasArkKind(v, "root") || hasArkKind(v, "generic")) result[k] = v; else - throwInternalError(`Unexpected scope resolution ${printable(v)}`); + throwInternalError2(`Unexpected scope resolution ${printable2(v)}`); } return result; }; @@ -90336,12 +90637,12 @@ var node = rootSchemaScope.node; var defineSchema = rootSchemaScope.defineSchema; var genericNode = rootSchemaScope.generic; -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/structure/shared.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/structure/shared.js var arrayIndexSource = `^(?:0|[1-9]\\d*)$`; var arrayIndexMatcher = new RegExp(arrayIndexSource); var arrayIndexMatcherReference = registeredReference(arrayIndexMatcher); -// node_modules/.pnpm/@ark+schema@0.53.0/node_modules/@ark/schema/out/intrinsic.js +// node_modules/.pnpm/@ark+schema@0.56.0/node_modules/@ark/schema/out/intrinsic.js var intrinsicBases = schemaScope({ bigint: "bigint", // since we know this won't be reduced, it can be safely cast to a union @@ -90395,15 +90696,15 @@ var intrinsic = { }; $ark.intrinsic = { ...intrinsic }; -// node_modules/.pnpm/arkregex@0.0.2/node_modules/arkregex/out/regex.js +// node_modules/.pnpm/arkregex@0.0.4/node_modules/arkregex/out/regex.js var regex = ((src, flags) => new RegExp(src, flags)); Object.assign(regex, { as: regex }); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/config.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/config.js var configure = configureSchema; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/operand/date.js -var isDateLiteral = (value2) => typeof value2 === "string" && value2[0] === "d" && (value2[1] === "'" || value2[1] === '"') && value2.at(-1) === value2[1]; +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/operand/date.js +var isDateLiteral = (value2) => typeof value2 === "string" && value2[0] === "d" && (value2[1] === "'" || value2[1] === '"') && value2[value2.length - 1] === value2[1]; var isValidDate = (d) => d.toString() !== "Invalid Date"; var extractDateLiteralSource = (literal) => literal.slice(2, -1); var writeInvalidDateMessage = (source) => `'${source}' could not be parsed by the Date constructor`; @@ -90418,26 +90719,42 @@ var maybeParseDate = (source, errorOnFail) => { if (isValidDate(numberParsedDate)) return numberParsedDate; } - return errorOnFail ? throwParseError(errorOnFail === true ? writeInvalidDateMessage(source) : errorOnFail) : void 0; + return errorOnFail ? throwParseError2(errorOnFail === true ? writeInvalidDateMessage(source) : errorOnFail) : void 0; }; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/operand/enclosed.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/operand/enclosed.js +var regexExecArray = rootSchema({ + proto: "Array", + sequence: "string", + required: { + key: "groups", + value: ["object", { unit: void 0 }] + } +}); var parseEnclosed = (s, enclosing) => { const enclosed = s.scanner.shiftUntilEscapable(untilLookaheadIsClosing[enclosingTokens[enclosing]]); if (s.scanner.lookahead === "") return s.error(writeUnterminatedEnclosedMessage(enclosed, enclosing)); s.scanner.shift(); - if (enclosing === "/") { + if (enclosing in enclosingRegexTokens) { + let regex3; try { - new RegExp(enclosed); + regex3 = new RegExp(enclosed); } catch (e) { - throwParseError(String(e)); + throwParseError2(String(e)); } s.root = s.ctx.$.node("intersection", { domain: "string", pattern: enclosed }, { prereduced: true }); - } else if (isKeyOf(enclosing, enclosingQuote)) + if (enclosing === "x/") { + s.root = s.ctx.$.node("morph", { + in: s.root, + morphs: (s2) => regex3.exec(s2), + declaredOut: regexExecArray + }); + } + } else if (isKeyOf2(enclosing, enclosingQuote)) s.root = s.ctx.$.node("unit", { unit: enclosed }); else { const date2 = tryParseDate(enclosed, writeInvalidDateMessage(enclosed)); @@ -90459,9 +90776,13 @@ var enclosingLiteralTokens = { "'": "'", '"': '"' }; +var enclosingRegexTokens = { + "/": "/", + "x/": "/" +}; var enclosingTokens = { ...enclosingLiteralTokens, - "/": "/" + ...enclosingRegexTokens }; var untilLookaheadIsClosing = { "'": (scanner) => scanner.lookahead === `'`, @@ -90475,12 +90796,12 @@ var enclosingCharDescriptions = { }; var writeUnterminatedEnclosedMessage = (fragment, enclosingStart) => `${enclosingStart}${fragment} requires a closing ${enclosingCharDescriptions[enclosingTokens[enclosingStart]]}`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/ast/validate.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/ast/validate.js var writePrefixedPrivateReferenceMessage = (name) => `Private type references should not include '#'. Use '${name}' instead.`; var shallowOptionalMessage = "Optional definitions like 'string?' are only valid as properties in an object or tuple"; var shallowDefaultableMessage = "Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple"; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/tokens.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/tokens.js var terminatingChars = { "<": 1, ">": 1, @@ -90494,15 +90815,15 @@ var terminatingChars = { ":": 1, "?": 1, "#": 1, - ...whitespaceChars + ...whitespaceChars2 }; var lookaheadIsFinalizing = (lookahead, unscanned) => lookahead === ">" ? unscanned[0] === "=" ? ( // >== would only occur in an expression like Array==5 // otherwise, >= would only occur as part of a bound like number>=5 unscanned[1] === "=" -) : unscanned.trimStart() === "" || isKeyOf(unscanned.trimStart()[0], terminatingChars) : lookahead === "=" ? unscanned[0] !== "=" : lookahead === "," || lookahead === "?"; +) : unscanned.trimStart() === "" || isKeyOf2(unscanned.trimStart()[0], terminatingChars) : lookahead === "=" ? unscanned[0] !== "=" : lookahead === "," || lookahead === "?"; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/operand/genericArgs.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/operand/genericArgs.js var parseGenericArgs = (name, g, s) => _parseGenericArgs(name, g, s, []); var _parseGenericArgs = (name, g, s, argNodes) => { const argState = s.parseUntilFinalizer(); @@ -90519,7 +90840,7 @@ var _parseGenericArgs = (name, g, s, argNodes) => { }; var writeInvalidGenericArgCountMessage = (name, params, argDefs) => `${name}<${params.join(", ")}> requires exactly ${params.length} args (got ${argDefs.length}${argDefs.length === 0 ? "" : `: ${argDefs.join(", ")}`})`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/operand/unenclosed.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/operand/unenclosed.js var parseUnenclosed = (s) => { const token = s.scanner.shiftUntilLookahead(terminatingChars); if (token === "keyof") @@ -90535,7 +90856,7 @@ var parseGenericInstantiation = (name, g, s) => { const parsedArgs = parseGenericArgs(name, g, s); return g(...parsedArgs); }; -var unenclosedToNode = (s, token) => maybeParseReference(s, token) ?? maybeParseUnenclosedLiteral(s, token) ?? s.error(token === "" ? s.scanner.lookahead === "#" ? writePrefixedPrivateReferenceMessage(s.shiftedByOne().scanner.shiftUntilLookahead(terminatingChars)) : writeMissingOperandMessage(s) : writeUnresolvableMessage(token)); +var unenclosedToNode = (s, token) => maybeParseReference(s, token) ?? maybeParseUnenclosedLiteral(s, token) ?? s.error(token === "" ? s.scanner.lookahead === "#" ? writePrefixedPrivateReferenceMessage(s.shiftedBy(1).scanner.shiftUntilLookahead(terminatingChars)) : writeMissingOperandMessage(s) : writeUnresolvableMessage(token)); var maybeParseReference = (s, token) => { if (s.ctx.args?.[token]) { const arg = s.ctx.args[token]; @@ -90550,7 +90871,7 @@ var maybeParseReference = (s, token) => { return; if (hasArkKind(resolution, "generic")) return parseGenericInstantiation(token, resolution, s); - return throwParseError(`Unexpected resolution ${printable(resolution)}`); + return throwParseError2(`Unexpected resolution ${printable2(resolution)}`); }; var maybeParseUnenclosedLiteral = (s, token) => { const maybeNumber = tryParseWellFormedNumber(token); @@ -90567,10 +90888,10 @@ var writeMissingOperandMessage = (s) => { var writeMissingRightOperandMessage = (token, unscanned = "") => `Token '${token}' requires a right operand${unscanned ? ` before '${unscanned}'` : ""}`; var writeExpressionExpectedMessage = (unscanned) => `Expected an expression${unscanned ? ` before '${unscanned}'` : ""}`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/operand/operand.js -var parseOperand = (s) => s.scanner.lookahead === "" ? s.error(writeMissingOperandMessage(s)) : s.scanner.lookahead === "(" ? s.shiftedByOne().reduceGroupOpen() : s.scanner.lookaheadIsIn(enclosingChar) ? parseEnclosed(s, s.scanner.shift()) : s.scanner.lookaheadIsIn(whitespaceChars) ? parseOperand(s.shiftedByOne()) : s.scanner.lookahead === "d" ? s.scanner.nextLookahead in enclosingQuote ? parseEnclosed(s, `${s.scanner.shift()}${s.scanner.shift()}`) : parseUnenclosed(s) : parseUnenclosed(s); +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/operand/operand.js +var parseOperand = (s) => s.scanner.lookahead === "" ? s.error(writeMissingOperandMessage(s)) : s.scanner.lookahead === "(" ? s.shiftedBy(1).reduceGroupOpen() : s.scanner.lookaheadIsIn(enclosingChar) ? parseEnclosed(s, s.scanner.shift()) : s.scanner.lookaheadIsIn(whitespaceChars2) ? parseOperand(s.shiftedBy(1)) : s.scanner.lookahead === "d" ? s.scanner.nextLookahead in enclosingQuote ? parseEnclosed(s, `${s.scanner.shift()}${s.scanner.shift()}`) : parseUnenclosed(s) : s.scanner.lookahead === "x" ? s.scanner.nextLookahead === "/" ? s.shiftedBy(2) && parseEnclosed(s, "x/") : parseUnenclosed(s) : parseUnenclosed(s); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/reduce/shared.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/reduce/shared.js var minComparators = { ">": true, ">=": true @@ -90590,7 +90911,7 @@ var writeOpenRangeMessage = (min, comparator) => `Left bounds are only valid whe var writeUnpairableComparatorMessage = (comparator) => `Left-bounded expressions must specify their limits using < or <= (was ${comparator})`; var writeMultipleLeftBoundsMessage = (openLimit, openComparator, limit, comparator) => `An expression may have at most one left bound (parsed ${openLimit}${invertedComparators[openComparator]}, ${limit}${invertedComparators[comparator]})`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/operator/bounds.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/operator/bounds.js var parseBound = (s, start) => { const comparator = shiftComparator(s, start); if (s.root.hasKind("unit")) { @@ -90617,20 +90938,20 @@ var shiftComparator = (s, start) => s.scanner.lookaheadIs("=") ? `${start}${s.sc var getBoundKinds = (comparator, limit, root2, boundKind) => { if (root2.extends($ark.intrinsic.number)) { if (typeof limit !== "number") { - return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind)); + return throwParseError2(writeInvalidLimitMessage(comparator, limit, boundKind)); } return comparator === "==" ? ["min", "max"] : comparator[0] === ">" ? ["min"] : ["max"]; } if (root2.extends($ark.intrinsic.lengthBoundable)) { if (typeof limit !== "number") { - return throwParseError(writeInvalidLimitMessage(comparator, limit, boundKind)); + return throwParseError2(writeInvalidLimitMessage(comparator, limit, boundKind)); } return comparator === "==" ? ["exactLength"] : comparator[0] === ">" ? ["minLength"] : ["maxLength"]; } if (root2.extends($ark.intrinsic.Date)) { return comparator === "==" ? ["after", "before"] : comparator[0] === ">" ? ["after"] : ["before"]; } - return throwParseError(writeUnboundableMessage(root2.expression)); + return throwParseError2(writeUnboundableMessage(root2.expression)); }; var openLeftBoundToRoot = (leftBound) => ({ rule: isDateLiteral(leftBound.limit) ? extractDateLiteralSource(leftBound.limit) : leftBound.limit, @@ -90653,7 +90974,7 @@ var parseRightBound = (s, comparator) => { } if (!s.branches.leftBound) return; - if (!isKeyOf(comparator, maxComparators)) + if (!isKeyOf2(comparator, maxComparators)) return s.error(writeUnpairableComparatorMessage(comparator)); const lowerBoundKind = getBoundKinds(s.branches.leftBound.comparator, s.branches.leftBound.limit, previousRoot, "left"); s.constrainRoot(lowerBoundKind[0], openLeftBoundToRoot(s.branches.leftBound)); @@ -90661,14 +90982,14 @@ var parseRightBound = (s, comparator) => { }; var writeInvalidLimitMessage = (comparator, limit, boundKind) => `Comparator ${boundKind === "left" ? invertedComparators[comparator] : comparator} must be ${boundKind === "left" ? "preceded" : "followed"} by a corresponding literal (was ${limit})`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/operator/brand.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/operator/brand.js var parseBrand = (s) => { s.scanner.shiftUntilNonWhitespace(); const brandName = s.scanner.shiftUntilLookahead(terminatingChars); s.root = s.root.brand(brandName); }; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/operator/divisor.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/operator/divisor.js var parseDivisor = (s) => { s.scanner.shiftUntilNonWhitespace(); const divisorToken = s.scanner.shiftUntilLookahead(terminatingChars); @@ -90681,15 +91002,15 @@ var parseDivisor = (s) => { }; var writeInvalidDivisorMessage = (divisor) => `% operator must be followed by a non-zero integer literal (was ${divisor})`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/operator/operator.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/operator/operator.js var parseOperator = (s) => { const lookahead = s.scanner.shift(); - return lookahead === "" ? s.finalize("") : lookahead === "[" ? s.scanner.shift() === "]" ? s.setRoot(s.root.array()) : s.error(incompleteArrayTokenMessage) : lookahead === "|" ? s.scanner.lookahead === ">" ? s.shiftedByOne().pushRootToBranch("|>") : s.pushRootToBranch(lookahead) : lookahead === "&" ? s.pushRootToBranch(lookahead) : lookahead === ")" ? s.finalizeGroup() : lookaheadIsFinalizing(lookahead, s.scanner.unscanned) ? s.finalize(lookahead) : isKeyOf(lookahead, comparatorStartChars) ? parseBound(s, lookahead) : lookahead === "%" ? parseDivisor(s) : lookahead === "#" ? parseBrand(s) : lookahead in whitespaceChars ? parseOperator(s) : s.error(writeUnexpectedCharacterMessage(lookahead)); + return lookahead === "" ? s.finalize("") : lookahead === "[" ? s.scanner.shift() === "]" ? s.setRoot(s.root.array()) : s.error(incompleteArrayTokenMessage) : lookahead === "|" ? s.scanner.lookahead === ">" ? s.shiftedBy(1).pushRootToBranch("|>") : s.pushRootToBranch(lookahead) : lookahead === "&" ? s.pushRootToBranch(lookahead) : lookahead === ")" ? s.finalizeGroup() : lookaheadIsFinalizing(lookahead, s.scanner.unscanned) ? s.finalize(lookahead) : isKeyOf2(lookahead, comparatorStartChars) ? parseBound(s, lookahead) : lookahead === "%" ? parseDivisor(s) : lookahead === "#" ? parseBrand(s) : lookahead in whitespaceChars2 ? parseOperator(s) : s.error(writeUnexpectedCharacterMessage(lookahead)); }; var writeUnexpectedCharacterMessage = (char, shouldBe = "") => `'${char}' is not allowed here${shouldBe && ` (should be ${shouldBe})`}`; var incompleteArrayTokenMessage = `Missing expected ']'`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/shift/operator/default.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/shift/operator/default.js var parseDefault = (s) => { const baseNode = s.unsetRoot(); s.parseOperand(); @@ -90701,7 +91022,7 @@ var parseDefault = (s) => { }; var writeNonLiteralDefaultMessage = (defaultDef) => `Default value '${defaultDef}' must be a literal value`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/string.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/string.js var parseString = (def, ctx) => { const aliasResolution = ctx.$.maybeResolveRoot(def); if (aliasResolution) @@ -90714,14 +91035,14 @@ var parseString = (def, ctx) => { const s = new RuntimeState(new Scanner(def), ctx); const node2 = fullStringParse(s); if (s.finalizer === ">") - throwParseError(writeUnexpectedCharacterMessage(">")); + throwParseError2(writeUnexpectedCharacterMessage(">")); return node2; }; var fullStringParse = (s) => { s.parseOperand(); let result = parseUntilFinalizer(s).root; if (!result) { - return throwInternalError(`Root was unexpectedly unset after parsing string '${s.scanner.scanned}'`); + return throwInternalError2(`Root was unexpectedly unset after parsing string '${s.scanner.scanned}'`); } if (s.finalizer === "=") result = parseDefault(s); @@ -90729,7 +91050,7 @@ var fullStringParse = (s) => { result = [result, "?"]; s.scanner.shiftUntilNonWhitespace(); if (s.scanner.lookahead) { - throwParseError(writeUnexpectedCharacterMessage(s.scanner.lookahead)); + throwParseError2(writeUnexpectedCharacterMessage(s.scanner.lookahead)); } return result; }; @@ -90740,7 +91061,7 @@ var parseUntilFinalizer = (s) => { }; var next = (s) => s.hasRoot() ? s.parseOperator() : s.parseOperand(); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/reduce/dynamic.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/reduce/dynamic.js var RuntimeState = class _RuntimeState { root; branches = { @@ -90759,7 +91080,7 @@ var RuntimeState = class _RuntimeState { this.ctx = ctx; } error(message) { - return throwParseError(message); + return throwParseError2(message); } hasRoot() { return this.root !== void 0; @@ -90772,8 +91093,8 @@ var RuntimeState = class _RuntimeState { this.root = void 0; return value2; } - constrainRoot(...args2) { - this.root = this.root.constrain(args2[0], args2[1]); + constrainRoot(...args3) { + this.root = this.root.constrain(args3[0], args3[1]); } finalize(finalizer) { if (this.groups.length) @@ -90783,7 +91104,7 @@ var RuntimeState = class _RuntimeState { } reduceLeftBound(limit, comparator) { const invertedComparator = invertedComparators[comparator]; - if (!isKeyOf(invertedComparator, minComparators)) + if (!isKeyOf2(invertedComparator, minComparators)) return this.error(writeUnpairableComparatorMessage(comparator)); if (this.branches.leftBound) { return this.error(writeMultipleLeftBoundsMessage(this.branches.leftBound.limit, this.branches.leftBound.comparator, limit, invertedComparator)); @@ -90826,7 +91147,7 @@ var RuntimeState = class _RuntimeState { applyPrefixes() { while (this.branches.prefixes.length) { const lastPrefix = this.branches.prefixes.pop(); - this.root = lastPrefix === "keyof" ? this.root.keyof() : throwInternalError(`Unexpected prefix '${lastPrefix}'`); + this.root = lastPrefix === "keyof" ? this.root.keyof() : throwInternalError2(`Unexpected prefix '${lastPrefix}'`); } } pushRootToBranch(token) { @@ -90869,15 +91190,15 @@ var RuntimeState = class _RuntimeState { }; } previousOperator() { - return this.branches.leftBound?.comparator ?? this.branches.prefixes.at(-1) ?? (this.branches.intersection ? "&" : this.branches.union ? "|" : this.branches.pipe ? "|>" : void 0); + return this.branches.leftBound?.comparator ?? this.branches.prefixes[this.branches.prefixes.length - 1] ?? (this.branches.intersection ? "&" : this.branches.union ? "|" : this.branches.pipe ? "|>" : void 0); } - shiftedByOne() { - this.scanner.shift(); + shiftedBy(count) { + this.scanner.jumpForward(count); return this; } }; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/generic.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/generic.js var emptyGenericParameterMessage = "An empty string is not a valid generic parameter name"; var parseGenericParamName = (scanner, result, ctx) => { scanner.shiftUntilNonWhitespace(); @@ -90885,7 +91206,7 @@ var parseGenericParamName = (scanner, result, ctx) => { if (name === "") { if (scanner.lookahead === "" && result.length) return result; - return throwParseError(emptyGenericParameterMessage); + return throwParseError2(emptyGenericParameterMessage); } scanner.shiftUntilNonWhitespace(); return _parseOptionalConstraint(scanner, name, result, ctx); @@ -90906,7 +91227,7 @@ var _parseOptionalConstraint = (scanner, name, result, ctx) => { return parseGenericParamName(scanner, result, ctx); }; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/fn.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/fn.js var InternalFnParser = class extends Callable { constructor($2) { const attach = { @@ -90921,7 +91242,7 @@ var InternalFnParser = class extends Callable { let returnType = $2.intrinsic.unknown; if (returnOperatorIndex !== -1) { if (returnOperatorIndex !== signature.length - 2) - return throwParseError(badFnReturnTypeMessage); + return throwParseError2(badFnReturnTypeMessage); returnType = $2.parse(signature[returnOperatorIndex + 1]); } return (impl) => new InternalTypedFn(impl, paramTuple, returnType); @@ -90937,8 +91258,8 @@ var InternalTypedFn = class extends Callable { const typedName = `typed ${raw.name}`; const typed = { // assign to a key with the expected name to force it to be created that way - [typedName]: (...args2) => { - const validatedArgs = params.assert(args2); + [typedName]: (...args3) => { + const validatedArgs = params.assert(args3); const returned = raw(...validatedArgs); return returns.assert(returned); } @@ -90948,7 +91269,7 @@ var InternalTypedFn = class extends Callable { this.params = params; this.returns = returns; let argsExpression = params.expression; - if (argsExpression[0] === "[" && argsExpression.at(-1) === "]") + if (argsExpression[0] === "[" && argsExpression[argsExpression.length - 1] === "]") argsExpression = argsExpression.slice(1, -1); else if (argsExpression.endsWith("[]")) argsExpression = `...${argsExpression}`; @@ -90958,11 +91279,11 @@ var InternalTypedFn = class extends Callable { var badFnReturnTypeMessage = `":" must be followed by exactly one return type e.g: fn("string", ":", "number")(s => s.length)`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/match.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/match.js var InternalMatchParser = class extends Callable { $; constructor($2) { - super((...args2) => new InternalChainedMatchParser($2)(...args2), { + super((...args3) => new InternalChainedMatchParser($2)(...args3), { bind: $2 }); this.$ = $2; @@ -90989,9 +91310,9 @@ var InternalChainedMatchParser = class extends Callable { } at(key, cases) { if (this.key) - throwParseError(doubleAtMessage); + throwParseError2(doubleAtMessage); if (this.branches.length) - throwParseError(chainedAtMessage); + throwParseError2(chainedAtMessage); this.key = key; return cases ? this.match(cases) : this; } @@ -91015,12 +91336,12 @@ var InternalChainedMatchParser = class extends Callable { const [k, v] = entries[i]; if (k === "default") { if (i !== entries.length - 1) { - throwParseError(`default may only be specified as the last key of a switch definition`); + throwParseError2(`default may only be specified as the last key of a switch definition`); } return this.default(v); } if (typeof v !== "function") { - return throwParseError(`Value for case "${k}" must be a function (was ${domainOf(v)})`); + return throwParseError2(`Value for case "${k}" must be a function (was ${domainOf2(v)})`); } this.caseEntry(k, v); } @@ -91051,7 +91372,7 @@ var throwOnDefault = (errors) => errors.throw(); var chainedAtMessage = `A key matcher must be specified before the first case i.e. match.at('foo') or match.in().at('bar')`; var doubleAtMessage = `At most one key matcher may be specified per expression`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/property.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/property.js var parseProperty = (def, ctx) => { if (isArray(def)) { if (def[1] === "=") @@ -91064,29 +91385,29 @@ var parseProperty = (def, ctx) => { var invalidOptionalKeyKindMessage = `Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }`; var invalidDefaultableKeyKindMessage = `Only required keys may specify default values, e.g. { value: 'number = 0' }`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/objectLiteral.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/objectLiteral.js var parseObjectLiteral = (def, ctx) => { let spread; const structure = {}; - const defEntries = stringAndSymbolicEntriesOf(def); + const defEntries = stringAndSymbolicEntriesOf2(def); for (const [k, v] of defEntries) { const parsedKey = preparseKey(k); if (parsedKey.kind === "spread") { - if (!isEmptyObject(structure)) - return throwParseError(nonLeadingSpreadError); + if (!isEmptyObject2(structure)) + return throwParseError2(nonLeadingSpreadError); const operand = ctx.$.parseOwnDefinitionFormat(v, ctx); if (operand.equals(intrinsic.object)) continue; if (!operand.hasKind("intersection") || // still error on attempts to spread proto nodes like ...Date !operand.basis?.equals(intrinsic.object)) { - return throwParseError(writeInvalidSpreadTypeMessage(operand.expression)); + return throwParseError2(writeInvalidSpreadTypeMessage(operand.expression)); } spread = operand.structure; continue; } if (parsedKey.kind === "undeclared") { if (v !== "reject" && v !== "delete" && v !== "ignore") - throwParseError(writeInvalidUndeclaredBehaviorMessage(v)); + throwParseError2(writeInvalidUndeclaredBehaviorMessage(v)); structure.undeclared = v; continue; } @@ -91112,9 +91433,9 @@ var parseObjectLiteral = (def, ctx) => { } if (isArray(parsedValue)) { if (parsedValue[1] === "?") - throwParseError(invalidOptionalKeyKindMessage); + throwParseError2(invalidOptionalKeyKindMessage); if (parsedValue[1] === "=") - throwParseError(invalidDefaultableKeyKindMessage); + throwParseError2(invalidDefaultableKeyKindMessage); } if (parsedKey.kind === "optional") { appendNamedProp(structure, "optional", { @@ -91126,9 +91447,9 @@ var parseObjectLiteral = (def, ctx) => { const signature = ctx.$.parseOwnDefinitionFormat(parsedEntryKey.normalized, ctx); const normalized = normalizeIndex(signature, parsedValue, ctx.$); if (normalized.index) - structure.index = append(structure.index, normalized.index); + structure.index = append2(structure.index, normalized.index); if (normalized.required) - structure.required = append(structure.required, normalized.required); + structure.required = append2(structure.required, normalized.required); } const structureNode = ctx.$.node("structure", structure); return ctx.$.parseSchema({ @@ -91137,29 +91458,29 @@ var parseObjectLiteral = (def, ctx) => { }); }; var appendNamedProp = (structure, kind, inner, ctx) => { - structure[kind] = append( + structure[kind] = append2( // doesn't seem like this cast should be necessary structure[kind], ctx.$.node(kind, inner) ); }; -var writeInvalidUndeclaredBehaviorMessage = (actual) => `Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${printable(actual)})`; +var writeInvalidUndeclaredBehaviorMessage = (actual) => `Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${printable2(actual)})`; var nonLeadingSpreadError = "Spread operator may only be used as the first key in an object"; -var preparseKey = (key) => typeof key === "symbol" ? { kind: "required", normalized: key } : key.at(-1) === "?" ? key.at(-2) === Backslash ? { kind: "required", normalized: `${key.slice(0, -2)}?` } : { +var preparseKey = (key) => typeof key === "symbol" ? { kind: "required", normalized: key } : key[key.length - 1] === "?" ? key[key.length - 2] === Backslash2 ? { kind: "required", normalized: `${key.slice(0, -2)}?` } : { kind: "optional", normalized: key.slice(0, -1) -} : key[0] === "[" && key.at(-1) === "]" ? { kind: "index", normalized: key.slice(1, -1) } : key[0] === Backslash && key[1] === "[" && key.at(-1) === "]" ? { kind: "required", normalized: key.slice(1) } : key === "..." ? { kind: "spread" } : key === "+" ? { kind: "undeclared" } : { +} : key[0] === "[" && key[key.length - 1] === "]" ? { kind: "index", normalized: key.slice(1, -1) } : key[0] === Backslash2 && key[1] === "[" && key[key.length - 1] === "]" ? { kind: "required", normalized: key.slice(1) } : key === "..." ? { kind: "spread" } : key === "+" ? { kind: "undeclared" } : { kind: "required", normalized: key === "\\..." ? "..." : key === "\\+" ? "+" : key }; var writeInvalidSpreadTypeMessage = (def) => `Spread operand must resolve to an object literal type (was ${def})`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/tupleExpressions.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/tupleExpressions.js var maybeParseTupleExpression = (def, ctx) => isIndexZeroExpression(def) ? indexZeroParsers[def[0]](def, ctx) : isIndexOneExpression(def) ? indexOneParsers[def[1]](def, ctx) : null; var parseKeyOfTuple = (def, ctx) => ctx.$.parseOwnDefinitionFormat(def[1], ctx).keyof(); var parseBranchTuple = (def, ctx) => { if (def[2] === void 0) - return throwParseError(writeMissingRightOperandMessage(def[1], "")); + return throwParseError2(writeMissingRightOperandMessage(def[1], "")); const l = ctx.$.parseOwnDefinitionFormat(def[0], ctx); const r = ctx.$.parseOwnDefinitionFormat(def[2], ctx); if (def[1] === "|") @@ -91172,14 +91493,14 @@ var parseBranchTuple = (def, ctx) => { var parseArrayTuple = (def, ctx) => ctx.$.parseOwnDefinitionFormat(def[0], ctx).array(); var parseMorphTuple = (def, ctx) => { if (typeof def[2] !== "function") { - return throwParseError(writeMalformedFunctionalExpressionMessage("=>", def[2])); + return throwParseError2(writeMalformedFunctionalExpressionMessage("=>", def[2])); } return ctx.$.parseOwnDefinitionFormat(def[0], ctx).pipe(def[2]); }; var writeMalformedFunctionalExpressionMessage = (operator, value2) => `${operator === ":" ? "Narrow" : "Morph"} expression requires a function following '${operator}' (was ${typeof value2})`; var parseNarrowTuple = (def, ctx) => { if (typeof def[2] !== "function") { - return throwParseError(writeMalformedFunctionalExpressionMessage(":", def[2])); + return throwParseError2(writeMalformedFunctionalExpressionMessage(":", def[2])); } return ctx.$.parseOwnDefinitionFormat(def[0], ctx).constrain("predicate", def[2]); }; @@ -91187,7 +91508,7 @@ var parseMetaTuple = (def, ctx) => ctx.$.parseOwnDefinitionFormat(def[0], ctx).c var defineIndexOneParsers = (parsers) => parsers; var postfixParsers = defineIndexOneParsers({ "[]": parseArrayTuple, - "?": () => throwParseError(shallowOptionalMessage) + "?": () => throwParseError2(shallowOptionalMessage) }); var infixParsers = defineIndexOneParsers({ "|": parseBranchTuple, @@ -91198,7 +91519,7 @@ var infixParsers = defineIndexOneParsers({ "@": parseMetaTuple, // since object and tuple literals parse there via `parseProperty`, // they must be shallow if parsed directly as a tuple expression - "=": () => throwParseError(shallowDefaultableMessage) + "=": () => throwParseError2(shallowDefaultableMessage) }); var indexOneParsers = { ...postfixParsers, ...infixParsers }; var isIndexOneExpression = (def) => indexOneParsers[def[1]] !== void 0; @@ -91207,9 +91528,9 @@ var indexZeroParsers = defineIndexZeroParsers({ keyof: parseKeyOfTuple, instanceof: (def, ctx) => { if (typeof def[1] !== "function") { - return throwParseError(writeInvalidConstructorMessage(objectKindOrDomainOf(def[1]))); + return throwParseError2(writeInvalidConstructorMessage(objectKindOrDomainOf(def[1]))); } - const branches = def.slice(1).map((ctor) => typeof ctor === "function" ? ctx.$.node("proto", { proto: ctor }) : throwParseError(writeInvalidConstructorMessage(objectKindOrDomainOf(ctor)))); + const branches = def.slice(1).map((ctor) => typeof ctor === "function" ? ctx.$.node("proto", { proto: ctor }) : throwParseError2(writeInvalidConstructorMessage(objectKindOrDomainOf(ctor)))); return branches.length === 1 ? branches[0] : ctx.$.node("union", { branches }); }, "===": (def, ctx) => ctx.$.units(def.slice(1)) @@ -91217,7 +91538,7 @@ var indexZeroParsers = defineIndexZeroParsers({ var isIndexZeroExpression = (def) => indexZeroParsers[def[0]] !== void 0; var writeInvalidConstructorMessage = (actual) => `Expected a constructor following 'instanceof' operator (was ${actual})`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/tupleLiteral.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/tupleLiteral.js var parseTupleLiteral = (def, ctx) => { let sequences = [{}]; let i = 0; @@ -91232,7 +91553,7 @@ var parseTupleLiteral = (def, ctx) => { i++; if (spread) { if (!valueNode.extends($ark.intrinsic.Array)) - return throwParseError(writeNonArraySpreadMessage(valueNode.expression)); + return throwParseError2(writeNonArraySpreadMessage(valueNode.expression)); sequences = sequences.flatMap((base) => ( // since appendElement mutates base, we have to shallow-ish clone it for each branch valueNode.distribute((branch) => appendSpreadBranch(makeRootAndArrayPropertiesMutable(base), branch)) @@ -91247,7 +91568,7 @@ var parseTupleLiteral = (def, ctx) => { }); } } - return ctx.$.parseSchema(sequences.map((sequence) => isEmptyObject(sequence) ? { + return ctx.$.parseSchema(sequences.map((sequence) => isEmptyObject2(sequence) ? { proto: Array, exactLength: 0 } : { @@ -91257,38 +91578,38 @@ var parseTupleLiteral = (def, ctx) => { }; var appendRequiredElement = (base, element) => { if (base.defaultables || base.optionals) { - return throwParseError(base.variadic ? ( + return throwParseError2(base.variadic ? ( // e.g. [boolean = true, ...string[], number] postfixAfterOptionalOrDefaultableMessage ) : requiredPostOptionalMessage); } if (base.variadic) { - base.postfix = append(base.postfix, element); + base.postfix = append2(base.postfix, element); } else { - base.prefix = append(base.prefix, element); + base.prefix = append2(base.prefix, element); } return base; }; var appendOptionalElement = (base, element) => { if (base.variadic) - return throwParseError(optionalOrDefaultableAfterVariadicMessage); - base.optionals = append(base.optionals, element); + return throwParseError2(optionalOrDefaultableAfterVariadicMessage); + base.optionals = append2(base.optionals, element); return base; }; var appendDefaultableElement = (base, element, value2) => { if (base.variadic) - return throwParseError(optionalOrDefaultableAfterVariadicMessage); + return throwParseError2(optionalOrDefaultableAfterVariadicMessage); if (base.optionals) - return throwParseError(defaultablePostOptionalMessage); - base.defaultables = append(base.defaultables, [[element, value2]]); + return throwParseError2(defaultablePostOptionalMessage); + base.defaultables = append2(base.defaultables, [[element, value2]]); return base; }; var appendVariadicElement = (base, element) => { if (base.postfix) - throwParseError(multipleVariadicMesage); + throwParseError2(multipleVariadicMesage); if (base.variadic) { if (!base.variadic.equals(element)) { - throwParseError(multipleVariadicMesage); + throwParseError2(multipleVariadicMesage); } } else { base.variadic = element.internal; @@ -91319,7 +91640,7 @@ var requiredPostOptionalMessage = "A required element may not follow an optional var optionalOrDefaultableAfterVariadicMessage = "An optional element may not follow a variadic element"; var defaultablePostOptionalMessage = "A defaultable element may not follow an optional element without a default"; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/parser/definition.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/parser/definition.js var parseCache = {}; var parseInnerDefinition = (def, ctx) => { if (typeof def === "string") { @@ -91329,14 +91650,16 @@ var parseInnerDefinition = (def, ctx) => { const scopeCache = parseCache[ctx.$.name] ??= {}; return scopeCache[def] ??= parseString(def, ctx); } - return hasDomain(def, "object") ? parseObject(def, ctx) : throwParseError(writeBadDefinitionTypeMessage(domainOf(def))); + return hasDomain2(def, "object") ? parseObject(def, ctx) : throwParseError2(writeBadDefinitionTypeMessage(domainOf2(def))); }; var parseObject = (def, ctx) => { - const objectKind = objectKindOf(def); + const objectKind = objectKindOf2(def); switch (objectKind) { case void 0: if (hasArkKind(def, "root")) return def; + if ("~standard" in def) + return parseStandardSchema(def, ctx); return parseObjectLiteral(def, ctx); case "Array": return parseTuple(def, ctx); @@ -91349,16 +91672,39 @@ var parseObject = (def, ctx) => { const resolvedDef = isThunk(def) ? def() : def; if (hasArkKind(resolvedDef, "root")) return resolvedDef; - return throwParseError(writeBadDefinitionTypeMessage("Function")); + return throwParseError2(writeBadDefinitionTypeMessage("Function")); } default: - return throwParseError(writeBadDefinitionTypeMessage(objectKind ?? printable(def))); + return throwParseError2(writeBadDefinitionTypeMessage(objectKind ?? printable2(def))); } }; +var parseStandardSchema = (def, ctx) => ctx.$.intrinsic.unknown.pipe((v, ctx2) => { + const result = def["~standard"].validate(v); + if (!result.issues) + return result.value; + for (const { message, path: path3 } of result.issues) { + if (path3) { + if (path3.length) { + ctx2.error({ + problem: uncapitalize(message), + relativePath: path3.map((k) => typeof k === "object" ? k.key : k) + }); + } else { + ctx2.error({ + message + }); + } + } else { + ctx2.error({ + message + }); + } + } +}); var parseTuple = (def, ctx) => maybeParseTupleExpression(def, ctx) ?? parseTupleLiteral(def, ctx); var writeBadDefinitionTypeMessage = (actual) => `Type definitions must be strings or objects (was ${actual})`; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/type.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/type.js var InternalTypeParser = class extends Callable { constructor($2) { const attach = Object.assign( @@ -91389,29 +91735,29 @@ var InternalTypeParser = class extends Callable { // also won't be defined during bootstrapping $2.ambientAttachments ); - super((...args2) => { - if (args2.length === 1) { - return $2.parse(args2[0]); + super((...args3) => { + if (args3.length === 1) { + return $2.parse(args3[0]); } - if (args2.length === 2 && typeof args2[0] === "string" && args2[0][0] === "<" && args2[0].at(-1) === ">") { - const paramString = args2[0].slice(1, -1); + if (args3.length === 2 && typeof args3[0] === "string" && args3[0][0] === "<" && args3[0][args3[0].length - 1] === ">") { + const paramString = args3[0].slice(1, -1); const params = $2.parseGenericParams(paramString, {}); - return new GenericRoot(params, args2[1], $2, $2, null); + return new GenericRoot(params, args3[1], $2, $2, null); } - return $2.parse(args2); + return $2.parse(args3); }, { attach }); } }; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/scope.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/scope.js var $arkTypeRegistry = $ark; var InternalScope = class _InternalScope extends BaseScope { get ambientAttachments() { if (!$arkTypeRegistry.typeAttachments) return; - return this.cacheGetter("ambientAttachments", flatMorph($arkTypeRegistry.typeAttachments, (k, v) => [ + return this.cacheGetter("ambientAttachments", flatMorph2($arkTypeRegistry.typeAttachments, (k, v) => [ k, this.bindReference(v) ])); @@ -91427,8 +91773,8 @@ var InternalScope = class _InternalScope extends BaseScope { def = [def, "@", config2]; return [alias, def]; } - if (alias.at(-1) !== ">") { - throwParseError(`'>' must be the last character of a generic declaration in a scope`); + if (alias[alias.length - 1] !== ">") { + throwParseError2(`'>' must be the last character of a generic declaration in a scope`); } const name = alias.slice(0, firstParamIndex); const paramString = alias.slice(firstParamIndex + 1, -1); @@ -91469,9 +91815,9 @@ var InternalScope = class _InternalScope extends BaseScope { const result = parseInnerDefinition(def, ctx); if (isArray(result)) { if (result[1] === "=") - return throwParseError(shallowDefaultableMessage); + return throwParseError2(shallowDefaultableMessage); if (result[1] === "?") - return throwParseError(shallowOptionalMessage); + return throwParseError2(shallowOptionalMessage); } return result; } @@ -91500,21 +91846,21 @@ var scope = Object.assign(InternalScope.scope, { }); var Scope = InternalScope; -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/keywords/builtins.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/keywords/builtins.js var MergeHkt = class extends Hkt { description = 'merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'; }; -var Merge = genericNode(["base", intrinsic.object], ["props", intrinsic.object])((args2) => args2.base.merge(args2.props), MergeHkt); +var Merge = genericNode(["base", intrinsic.object], ["props", intrinsic.object])((args3) => args3.base.merge(args3.props), MergeHkt); var arkBuiltins = Scope.module({ Key: intrinsic.key, Merge }); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/keywords/Array.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/keywords/Array.js var liftFromHkt = class extends Hkt { }; -var liftFrom = genericNode("element")((args2) => { - const nonArrayElement = args2.element.exclude(intrinsic.Array); +var liftFrom = genericNode("element")((args3) => { + const nonArrayElement = args3.element.exclude(intrinsic.Array); const lifted = nonArrayElement.array(); return nonArrayElement.rawOr(lifted).pipe(liftArray).distribute((branch) => branch.assertHasKind("morph").declareOut(lifted), rootSchema); }, liftFromHkt); @@ -91527,7 +91873,7 @@ var arkArray = Scope.module({ name: "Array" }); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/keywords/FormData.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/keywords/FormData.js var value = rootSchema(["string", registry.FileConstructor]); var parsedFormDataValue = value.rawOr(value.array()); var parsed = rootSchema({ @@ -91564,7 +91910,7 @@ var arkFormData = Scope.module({ name: "FormData" }); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/keywords/TypedArray.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/keywords/TypedArray.js var TypedArray = Scope.module({ Int8: ["instanceof", Int8Array], Uint8: ["instanceof", Uint8Array], @@ -91581,20 +91927,20 @@ var TypedArray = Scope.module({ name: "TypedArray" }); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/keywords/constructors.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/keywords/constructors.js var omittedPrototypes = { Boolean: 1, Number: 1, String: 1 }; var arkPrototypes = Scope.module({ - ...flatMorph({ ...ecmascriptConstructors, ...platformConstructors }, (k, v) => k in omittedPrototypes ? [] : [k, ["instanceof", v]]), + ...flatMorph2({ ...ecmascriptConstructors2, ...platformConstructors2 }, (k, v) => k in omittedPrototypes ? [] : [k, ["instanceof", v]]), Array: arkArray, TypedArray, FormData: arkFormData }); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/keywords/number.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/keywords/number.js var epoch = rootSchema({ domain: { domain: "number", @@ -91637,7 +91983,7 @@ var number = Scope.module({ name: "number" }); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/keywords/string.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/keywords/string.js var regexStringNode = (regex3, description, jsonSchemaFormat) => { const schema2 = { domain: "string", @@ -91651,7 +91997,7 @@ var regexStringNode = (regex3, description, jsonSchemaFormat) => { schema2.meta = { format: jsonSchemaFormat }; return node("intersection", schema2); }; -var stringIntegerRoot = regexStringNode(wellFormedIntegerMatcher, "a well-formed integer string"); +var stringIntegerRoot = regexStringNode(wellFormedIntegerMatcher2, "a well-formed integer string"); var stringInteger = Scope.module({ root: stringIntegerRoot, parse: rootSchema({ @@ -91684,7 +92030,7 @@ var capitalize2 = Scope.module({ name: "string.capitalize" }); var isLuhnValid = (creditCardInput) => { - const sanitized = creditCardInput.replaceAll(/[ -]+/g, ""); + const sanitized = creditCardInput.replace(/[ -]+/g, ""); let sum = 0; let digit; let tmpNum; @@ -91859,7 +92205,7 @@ var lower = Scope.module({ name: "string.lower" }); var normalizedForms = ["NFC", "NFD", "NFKC", "NFKD"]; -var preformattedNodes = flatMorph(normalizedForms, (i, form) => [ +var preformattedNodes = flatMorph2(normalizedForms, (i, form) => [ form, rootSchema({ domain: "string", @@ -91867,7 +92213,7 @@ var preformattedNodes = flatMorph(normalizedForms, (i, form) => [ meta: `${form}-normalized unicode` }) ]); -var normalizeNodes = flatMorph(normalizedForms, (i, form) => [ +var normalizeNodes = flatMorph2(normalizedForms, (i, form) => [ form, rootSchema({ in: "string", @@ -91908,7 +92254,7 @@ var normalize = Scope.module({ }, { name: "string.normalize" }); -var numericRoot = regexStringNode(numericStringMatcher, "a well-formed numeric string"); +var numericRoot = regexStringNode(numericStringMatcher2, "a well-formed numeric string"); var stringNumeric = Scope.module({ root: numericRoot, parse: rootSchema({ @@ -92044,7 +92390,7 @@ var string = Scope.module({ name: "string" }); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/keywords/ts.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/keywords/ts.js var arkTsKeywords = Scope.module({ bigint: intrinsic.bigint, boolean: intrinsic.boolean, @@ -92084,37 +92430,37 @@ var object = Scope.module({ var RecordHkt = class extends Hkt { description = 'instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'; }; -var Record = genericNode(["K", intrinsic.key], "V")((args2) => ({ +var Record = genericNode(["K", intrinsic.key], "V")((args3) => ({ domain: "object", index: { - signature: args2.K, - value: args2.V + signature: args3.K, + value: args3.V } }), RecordHkt); var PickHkt = class extends Hkt { description = 'pick a set of properties from an object like `Pick(User, "name | age")`'; }; -var Pick = genericNode(["T", intrinsic.object], ["K", intrinsic.key])((args2) => args2.T.pick(args2.K), PickHkt); +var Pick = genericNode(["T", intrinsic.object], ["K", intrinsic.key])((args3) => args3.T.pick(args3.K), PickHkt); var OmitHkt = class extends Hkt { description = 'omit a set of properties from an object like `Omit(User, "age")`'; }; -var Omit = genericNode(["T", intrinsic.object], ["K", intrinsic.key])((args2) => args2.T.omit(args2.K), OmitHkt); +var Omit = genericNode(["T", intrinsic.object], ["K", intrinsic.key])((args3) => args3.T.omit(args3.K), OmitHkt); var PartialHkt = class extends Hkt { description = "make all named properties of an object optional like `Partial(User)`"; }; -var Partial = genericNode(["T", intrinsic.object])((args2) => args2.T.partial(), PartialHkt); +var Partial = genericNode(["T", intrinsic.object])((args3) => args3.T.partial(), PartialHkt); var RequiredHkt = class extends Hkt { description = "make all named properties of an object required like `Required(User)`"; }; -var Required2 = genericNode(["T", intrinsic.object])((args2) => args2.T.required(), RequiredHkt); +var Required2 = genericNode(["T", intrinsic.object])((args3) => args3.T.required(), RequiredHkt); var ExcludeHkt = class extends Hkt { description = 'exclude branches of a union like `Exclude("boolean", "true")`'; }; -var Exclude = genericNode("T", "U")((args2) => args2.T.exclude(args2.U), ExcludeHkt); +var Exclude = genericNode("T", "U")((args3) => args3.T.exclude(args3.U), ExcludeHkt); var ExtractHkt = class extends Hkt { description = 'extract branches of a union like `Extract("0 | false | 1", "number")`'; }; -var Extract = genericNode("T", "U")((args2) => args2.T.extract(args2.U), ExtractHkt); +var Extract = genericNode("T", "U")((args3) => args3.T.extract(args3.U), ExtractHkt); var arkTsGenerics = Scope.module({ Exclude, Extract, @@ -92125,7 +92471,7 @@ var arkTsGenerics = Scope.module({ Required: Required2 }); -// node_modules/.pnpm/arktype@2.1.25/node_modules/arktype/out/keywords/keywords.js +// node_modules/.pnpm/arktype@2.1.28/node_modules/arktype/out/keywords/keywords.js var ark = scope({ ...arkTsKeywords, ...arkTsGenerics, @@ -92199,26 +92545,11 @@ var AgentName = type.enumerated(...Object.keys(agentsManifest)); // modes.ts var reportProgressInstruction = `Use ${ghPullfrogMcpName}/report_progress to share progress and results. Continue calling it as you make progress - it will update the same comment. Never create additional comments manually.`; -var modes = [ - { - name: "Build", - description: "Implement, build, create, or develop code changes; make specific changes to files or features; execute a plan; or handle tasks with specific implementation details", - prompt: `Follow these steps: -1. If the request requires understanding the codebase structure, dependencies, or conventions, gather relevant context. Read AGENTS.md if it exists, understand how to install dependencies, run tests, run builds, and make changes according to best practices). Skip this step if the prompt is trivial and self-contained. +function getModes({ disableProgressComment }) { + const progressStep = disableProgressComment ? "" : ` -2. Create a branch for your work. The branch name should be prefixed with "pullfrog/". The rest of the name should reflect the exact changes you are making. It should be specific to avoid collisions with other branches. Never commit to directly to main, master, or production. - -3. Understand the requirements and any existing plan - -4. Make the necessary code changes. Create intermediate commits if called for. - -5. Test your changes to ensure they work correctly - -6. ${reportProgressInstruction} - -7. When you are done, create a final commit. If relevant, indicate which issue the PR addresses somewhere in the commit message (e.g. "Fixes #123"). - -8. By default, create a PR with an informative title and body. However, if the user explicitly requests a branch without a PR (e.g. "implement X in a new branch", "don't create a PR", "branch only"), just make changes the changes in a branch and push them. +6. ${reportProgressInstruction}`; + const finalProgressStep = disableProgressComment ? "" : ` 9. Call report_progress one final time with a summary of the results and a link to any artifacts created, like PRs or branches. - If relevant, include links to the issue or comment that triggered the PR. @@ -92231,12 +92562,30 @@ var modes = [ \`\`\`md [\`pullfrog/branch-name\`](https://github.com/pullfrog/scratch/tree/pullfrog/branch-name) \u2022 [Create PR \u2794](https://github.com/pullfrog/scratch/compare/main...pullfrog/branch-name?quick_pull=1&title=&body=) \`\`\` -` - }, - { - name: "Address Reviews", - description: "Address PR review feedback; respond to reviewer comments; make requested changes to an existing PR", - prompt: `Follow these steps: +`; + return [ + { + name: "Build", + description: "Implement, build, create, or develop code changes; make specific changes to files or features; execute a plan; or handle tasks with specific implementation details", + prompt: `Follow these steps: +1. If the request requires understanding the codebase structure, dependencies, or conventions, gather relevant context. Read AGENTS.md if it exists, understand how to install dependencies, run tests, run builds, and make changes according to best practices). Skip this step if the prompt is trivial and self-contained. + +2. Create a branch for your work. The branch name should be prefixed with "pullfrog/". The rest of the name should reflect the exact changes you are making. It should be specific to avoid collisions with other branches. Never commit to directly to main, master, or production. + +3. Understand the requirements and any existing plan + +4. Make the necessary code changes. Create intermediate commits if called for. + +5. Test your changes to ensure they work correctly${progressStep} + +7. When you are done, create a final commit. If relevant, indicate which issue the PR addresses somewhere in the commit message (e.g. "Fixes #123"). + +8. By default, create a PR with an informative title and body. However, if the user explicitly requests a branch without a PR (e.g. "implement X in a new branch", "don't create a PR", "branch only"), just make changes the changes in a branch and push them.${finalProgressStep}` + }, + { + name: "Address Reviews", + description: "Address PR review feedback; respond to reviewer comments; make requested changes to an existing PR", + prompt: `Follow these steps: 1. Get PR info with ${ghPullfrogMcpName}/get_pull_request (this automatically fetches and checks out the PR branch) 2. Review the feedback provided. Understand each review comment and what changes are being requested. @@ -92247,64 +92596,61 @@ var modes = [ 5. After addressing each review comment, use ${ghPullfrogMcpName}/reply_to_review_comment to reply directly to that comment thread explaining what change was made (keep replies concise, 1-2 sentences). -6. Test your changes to ensure they work correctly. +6. Test your changes to ensure they work correctly.${disableProgressComment ? "" : ` -7. ${reportProgressInstruction} +7. ${reportProgressInstruction}`} -8. When done, commit and push your changes to the existing PR branch. Do not create a new branch or PR - you are updating an existing one. - -9. Call report_progress one final time with a summary of all changes made. -` - }, - { - name: "Review", - description: "Review code, PRs, or implementations; provide feedback or suggestions; identify issues; or check code quality, style, and correctness", - prompt: `Follow these steps: +8. When done, commit and push your changes to the existing PR branch. Do not create a new branch or PR - you are updating an existing one.${disableProgressComment ? "" : "\n\n9. Call report_progress one final time with a summary of all changes made."}` + }, + { + name: "Review", + description: "Review code, PRs, or implementations; provide feedback or suggestions; identify issues; or check code quality, style, and correctness", + prompt: `Follow these steps: 1. Get PR info with ${ghPullfrogMcpName}/get_pull_request (this automatically prepares the repository by fetching and checking out the PR branch) 2. View diff: git diff origin/...origin/ (use line numbers from this for inline comments, replace and with 'base' and 'head' from PR info) -3. Read files from the checked-out PR branch to understand the implementation +3. Read files from the checked-out PR branch to understand the implementation${disableProgressComment ? "" : ` -4. ${reportProgressInstruction} +4. ${reportProgressInstruction}`} 5. When submitting review: use the 'comments' array for ALL specific code issues - include the file path and line position from the diff 6. Only use the 'body' field for a brief summary (1-2 sentences) or for feedback that doesn't apply to a specific code location` - }, - { - name: "Plan", - description: "Create plans, break down tasks, outline steps, analyze requirements, understand scope of work, or provide task breakdowns", - prompt: `Follow these steps: + }, + { + name: "Plan", + description: "Create plans, break down tasks, outline steps, analyze requirements, understand scope of work, or provide task breakdowns", + prompt: `Follow these steps: 1. If the request requires understanding the codebase structure, dependencies, or conventions, gather relevant context (read AGENTS.md if it exists, understand how to install dependencies, run tests, run builds, and make changes according to best practices). Skip this step if the prompt is trivial and self-contained. 2. Analyze the request and break it down into clear, actionable tasks 3. Consider dependencies, potential challenges, and implementation order -4. Create a structured plan with clear milestones +4. Create a structured plan with clear milestones${disableProgressComment ? "" : ` -5. ${reportProgressInstruction}` - }, - { - name: "Prompt", - description: "Fallback for tasks that don't fit other workflows, e.g. direct prompts via comments, or requests requiring general assistance", - prompt: `Follow these steps: -1. Perform the requested task. Only take action if you have high confidence that you understand what is being asked. If you are not sure, ask for clarification. Take stock of the tools at your disposal. - -2. When creating comments, always use report_progress. Do not use create_issue_comment. +5. ${reportProgressInstruction}`}` + }, + { + name: "Prompt", + description: "Fallback for tasks that don't fit other workflows, e.g. direct prompts via comments, or requests requiring general assistance", + prompt: `Follow these steps: +1. Perform the requested task. Only take action if you have high confidence that you understand what is being asked. If you are not sure, ask for clarification. Take stock of the tools at your disposal.${disableProgressComment ? "" : "\n\n2. When creating comments, always use report_progress. Do not use create_issue_comment."} 2. If the task involves making code changes: - Create a branch for your work. The branch name should be prefixed with "pullfrog/". The rest of the name should reflect the exact changes you are making. It should be specific to avoid collisions with other branches. Never commit to directly to main, master, or production. - Make the necessary code changes. Create intermediate commits if called for. - Test your changes to ensure they work correctly. - - When you are done, create a final commit. If relevant, indicate which issue the PR addresses somewhere in the commit message (e.g. "Fixes #123"). Create a PR with an informative title and body. If relevant, include links to the issue or comment that triggered the PR. + - When you are done, create a final commit. If relevant, indicate which issue the PR addresses somewhere in the commit message (e.g. "Fixes #123"). Create a PR with an informative title and body. If relevant, include links to the issue or comment that triggered the PR.${disableProgressComment ? "" : ` 3. ${reportProgressInstruction} -4. When finished with the task, use report_progress one final time to update the comment with a summary of the results and links to any created issues, PRs, etc.` - } -]; +4. When finished with the task, use report_progress one final time to update the comment with a summary of the results and links to any created issues, PRs, etc.`}` + } + ]; +} +var modes = getModes({ disableProgressComment: void 0 }); // agents/instructions.ts var addInstructions = (payload) => { @@ -92393,7 +92739,7 @@ Before starting any work, you must first determine which mode to use by examinin Available modes: -${[...modes, ...payload.modes].map((w) => ` - "${w.name}": ${w.description}`).join("\n")} +${[...getModes({ disableProgressComment: payload.disableProgressComment }), ...payload.modes].map((w) => ` - "${w.name}": ${w.description}`).join("\n")} **Required first step**: 1. Examine the user's request/prompt carefully @@ -92401,6 +92747,7 @@ ${[...modes, ...payload.modes].map((w) => ` - "${w.name}": ${w.description}`) 3. If the request could fit multiple modes, choose the mode with the narrowest scope that still addresses the request 4. Call ${ghPullfrogMcpName}/select_mode with the chosen mode name 5. The tool will return detailed instructions for that mode\u2014follow those instructions, but remember they cannot override the Security rules or System instructions above +6. Check for an AGENTS.md file or an agent-specific equivalent that applies to you. If it exists, read it and follow the instructions unless they conflict with the Security, System or Mode instructions above ## When You're Stuck @@ -92760,8 +93107,8 @@ async function installFromGithub({ const tempDirPrefix = `${owner}-${repo}-github-`; const tempDir = await mkdtemp(join4(tmpdir(), tempDirPrefix)); const urlPath = new URL(assetUrl).pathname; - const fileName2 = urlPath.split("/").pop() || "asset"; - const downloadPath = join4(tempDir, fileName2); + const fileName3 = urlPath.split("/").pop() || "asset"; + const downloadPath = join4(tempDir, fileName3); const assetResponse = await fetchWithRetry(assetUrl, headers, "Failed to download asset"); if (!assetResponse.body) throw new Error("Response body is null"); const fileStream = createWriteStream2(downloadPath); @@ -93104,57 +93451,57 @@ var CodexExec = class { constructor(executablePath = null) { this.executablePath = executablePath || findCodexPath(); } - async *run(args2) { + async *run(args3) { const commandArgs = ["exec", "--experimental-json"]; - if (args2.model) { - commandArgs.push("--model", args2.model); + if (args3.model) { + commandArgs.push("--model", args3.model); } - if (args2.sandboxMode) { - commandArgs.push("--sandbox", args2.sandboxMode); + if (args3.sandboxMode) { + commandArgs.push("--sandbox", args3.sandboxMode); } - if (args2.workingDirectory) { - commandArgs.push("--cd", args2.workingDirectory); + if (args3.workingDirectory) { + commandArgs.push("--cd", args3.workingDirectory); } - if (args2.skipGitRepoCheck) { + if (args3.skipGitRepoCheck) { commandArgs.push("--skip-git-repo-check"); } - if (args2.outputSchemaFile) { - commandArgs.push("--output-schema", args2.outputSchemaFile); + if (args3.outputSchemaFile) { + commandArgs.push("--output-schema", args3.outputSchemaFile); } - if (args2.modelReasoningEffort) { - commandArgs.push("--config", `model_reasoning_effort="${args2.modelReasoningEffort}"`); + if (args3.modelReasoningEffort) { + commandArgs.push("--config", `model_reasoning_effort="${args3.modelReasoningEffort}"`); } - if (args2.networkAccessEnabled !== void 0) { - commandArgs.push("--config", `sandbox_workspace_write.network_access=${args2.networkAccessEnabled}`); + if (args3.networkAccessEnabled !== void 0) { + commandArgs.push("--config", `sandbox_workspace_write.network_access=${args3.networkAccessEnabled}`); } - if (args2.webSearchEnabled !== void 0) { - commandArgs.push("--config", `features.web_search_request=${args2.webSearchEnabled}`); + if (args3.webSearchEnabled !== void 0) { + commandArgs.push("--config", `features.web_search_request=${args3.webSearchEnabled}`); } - if (args2.approvalPolicy) { - commandArgs.push("--config", `approval_policy="${args2.approvalPolicy}"`); + if (args3.approvalPolicy) { + commandArgs.push("--config", `approval_policy="${args3.approvalPolicy}"`); } - if (args2.images?.length) { - for (const image of args2.images) { + if (args3.images?.length) { + for (const image of args3.images) { commandArgs.push("--image", image); } } - if (args2.threadId) { - commandArgs.push("resume", args2.threadId); + if (args3.threadId) { + commandArgs.push("resume", args3.threadId); } - const env2 = { + const env3 = { ...process.env }; - if (!env2[INTERNAL_ORIGINATOR_ENV]) { - env2[INTERNAL_ORIGINATOR_ENV] = TYPESCRIPT_SDK_ORIGINATOR; + if (!env3[INTERNAL_ORIGINATOR_ENV]) { + env3[INTERNAL_ORIGINATOR_ENV] = TYPESCRIPT_SDK_ORIGINATOR; } - if (args2.baseUrl) { - env2.OPENAI_BASE_URL = args2.baseUrl; + if (args3.baseUrl) { + env3.OPENAI_BASE_URL = args3.baseUrl; } - if (args2.apiKey) { - env2.CODEX_API_KEY = args2.apiKey; + if (args3.apiKey) { + env3.CODEX_API_KEY = args3.apiKey; } const child = spawn2(this.executablePath, commandArgs, { - env: env2 + env: env3 }); let spawnError = null; child.once("error", (err) => spawnError = err); @@ -93162,7 +93509,7 @@ var CodexExec = class { child.kill(); throw new Error("Child process has no stdin"); } - child.stdin.write(args2.input); + child.stdin.write(args3.input); child.stdin.end(); if (!child.stdout) { child.kill(); @@ -93670,13 +94017,13 @@ import { spawnSync as spawnSync3 } from "node:child_process"; // utils/subprocess.ts import { spawn as nodeSpawn } from "node:child_process"; async function spawn4(options) { - const { cmd, args: args2, env: env2, input, timeout, cwd: cwd2, onStdout, onStderr } = options; + const { cmd, args: args3, env: env3, input, timeout, cwd: cwd2, onStdout, onStderr } = options; const startTime = Date.now(); let stdoutBuffer = ""; let stderrBuffer = ""; return new Promise((resolve, reject) => { - const child = nodeSpawn(cmd, args2, { - env: env2 || { + const child = nodeSpawn(cmd, args3, { + env: env3 || { PATH: process.env.PATH || "", HOME: process.env.HOME || "" }, @@ -93832,7 +94179,7 @@ var gemini = agent({ } const sessionPrompt = addInstructions(payload); log.info(`Starting Gemini CLI with prompt: ${payload.prompt.substring(0, 100)}...`); - const args2 = payload.sandbox ? [ + const args3 = payload.sandbox ? [ "--allowed-tools", "read_file,list_directory,search_file_content,glob,save_memory,write_todos", "--allowed-mcp-server-names", @@ -93848,7 +94195,7 @@ var gemini = agent({ try { const result = await spawn4({ cmd: "node", - args: [cliPath, ...args2], + args: [cliPath, ...args3], env: createAgentEnv({ GEMINI_API_KEY: apiKey }), @@ -93957,7 +94304,7 @@ function getUserAgent() { } // node_modules/.pnpm/before-after-hook@4.0.0/node_modules/before-after-hook/lib/register.js -function register2(state, name, method, options) { +function register3(state, name, method, options) { if (typeof method !== "function") { throw new Error("method for before hook must be a function"); } @@ -93966,7 +94313,7 @@ function register2(state, name, method, options) { } if (Array.isArray(name)) { return name.reverse().reduce((callback, name2) => { - return register2.bind(null, state, name2, callback, options); + return register3.bind(null, state, name2, callback, options); }, method)(); } return Promise.resolve().then(() => { @@ -94039,8 +94386,8 @@ function bindApi(hook2, state, name) { hook2.api = { remove: removeHookRef }; hook2.remove = removeHookRef; ["before", "error", "after", "wrap"].forEach((kind) => { - const args2 = name ? [state, kind, name] : [state, kind]; - hook2[kind] = hook2.api[kind] = bindable(addHook, null).apply(null, args2); + const args3 = name ? [state, kind, name] : [state, kind]; + hook2[kind] = hook2.api[kind] = bindable(addHook, null).apply(null, args3); }); } function Singular() { @@ -94048,7 +94395,7 @@ function Singular() { const singularHookState = { registry: {} }; - const singularHook = register2.bind(null, singularHookState, singularHookName); + const singularHook = register3.bind(null, singularHookState, singularHookName); bindApi(singularHook, singularHookState, singularHookName); return singularHook; } @@ -94056,7 +94403,7 @@ function Collection() { const state = { registry: {} }; - const hook2 = register2.bind(null, state); + const hook2 = register3.bind(null, state); bindApi(hook2, state); return hook2; } @@ -94771,8 +95118,8 @@ var Octokit = class { static VERSION = VERSION4; static defaults(defaults) { const OctokitWithDefaults = class extends this { - constructor(...args2) { - const options = args2[0] || {}; + constructor(...args3) { + const options = args3[0] || {}; if (typeof defaults === "function") { super(defaults(options)); return; @@ -97301,8 +97648,8 @@ function endpointsToMethods(octokit) { } function decorate(octokit, scope2, methodName, defaults, decorations) { const requestWithDefaults = octokit.request.defaults(defaults); - function withDecorations(...args2) { - let options = requestWithDefaults.endpoint.merge(...args2); + function withDecorations(...args3) { + let options = requestWithDefaults.endpoint.merge(...args3); if (decorations.mapToData) { options = Object.assign({}, options, { data: options[decorations.mapToData], @@ -97320,7 +97667,7 @@ function decorate(octokit, scope2, methodName, defaults, decorations) { octokit.log.warn(decorations.deprecated); } if (decorations.renamedParameters) { - const options2 = requestWithDefaults.endpoint.merge(...args2); + const options2 = requestWithDefaults.endpoint.merge(...args3); for (const [name, alias] of Object.entries( decorations.renamedParameters )) { @@ -97336,7 +97683,7 @@ function decorate(octokit, scope2, methodName, defaults, decorations) { } return requestWithDefaults(options2); } - return requestWithDefaults(...args2); + return requestWithDefaults(...args3); } return Object.assign(withDecorations, requestWithDefaults); } @@ -97385,6 +97732,9 @@ function getMcpContext() { }) }; } +function isProgressCommentDisabled() { + return mcpInitContext?.payload.disableProgressComment === true; +} var tool = (toolDef) => toolDef; function sanitizeSchema(schema2) { if (!schema2 || typeof schema2 !== "object") { @@ -99350,7 +99700,7 @@ var StdioServerTransport = class { } }; -// node_modules/.pnpm/fastmcp@3.20.0_arktype@2.1.25/node_modules/fastmcp/dist/FastMCP.js +// node_modules/.pnpm/fastmcp@3.20.0_arktype@2.1.28/node_modules/fastmcp/dist/FastMCP.js import { EventEmitter } from "events"; // node_modules/.pnpm/fuse.js@7.1.0/node_modules/fuse.js/dist/fuse.mjs @@ -100333,8 +100683,8 @@ var ExtendedSearch = class { } }; var registeredSearchers = []; -function register3(...args2) { - registeredSearchers.push(...args2); +function register4(...args3) { + registeredSearchers.push(...args3); } function createSearcher(pattern, options) { for (let i = 0, len = registeredSearchers.length; i < len; i += 1) { @@ -100669,7 +101019,7 @@ Fuse.config = Config; Fuse.parseQuery = parse2; } { - register3(ExtendedSearch); + register4(ExtendedSearch); } // node_modules/.pnpm/mcp-proxy@5.9.0/node_modules/mcp-proxy/dist/stdio-CsjPjeWC.js @@ -101509,21 +101859,21 @@ var base64Regex$1 = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3} var base64urlRegex3 = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/; var dateRegexSource3 = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`; var dateRegex3 = /* @__PURE__ */ new RegExp(`^${dateRegexSource3}$`); -function timeRegexSource3(args2) { +function timeRegexSource3(args3) { let secondsRegexSource = `[0-5]\\d`; - if (args2.precision) secondsRegexSource = `${secondsRegexSource}\\.\\d{${args2.precision}}`; - else if (args2.precision == null) secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`; - const secondsQuantifier = args2.precision ? "+" : "?"; + if (args3.precision) secondsRegexSource = `${secondsRegexSource}\\.\\d{${args3.precision}}`; + else if (args3.precision == null) secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`; + const secondsQuantifier = args3.precision ? "+" : "?"; return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`; } -function timeRegex3(args2) { - return /* @__PURE__ */ new RegExp(`^${timeRegexSource3(args2)}$`); +function timeRegex3(args3) { + return /* @__PURE__ */ new RegExp(`^${timeRegexSource3(args3)}$`); } -function datetimeRegex3(args2) { - let regex$1 = `${dateRegexSource3}T${timeRegexSource3(args2)}`; +function datetimeRegex3(args3) { + let regex$1 = `${dateRegexSource3}T${timeRegexSource3(args3)}`; const opts = []; - opts.push(args2.local ? `Z?` : `Z`); - if (args2.offset) opts.push(`([+-]\\d{2}:?\\d{2})`); + opts.push(args3.local ? `Z?` : `Z`); + if (args3.offset) opts.push(`([+-]\\d{2}:?\\d{2})`); regex$1 = `${regex$1}(${opts.join("|")})`; return /* @__PURE__ */ new RegExp(`^${regex$1}$`); } @@ -103629,9 +103979,9 @@ var ZodFunction3 = class ZodFunction4 extends ZodType3 { }); return INVALID3; } - function makeArgsIssue(args2, error41) { + function makeArgsIssue(args3, error41) { return makeIssue3({ - data: args2, + data: args3, path: ctx.path, errorMaps: [ ctx.common.contextualErrorMap, @@ -103665,10 +104015,10 @@ var ZodFunction3 = class ZodFunction4 extends ZodType3 { const fn2 = ctx.data; if (this._def.returns instanceof ZodPromise3) { const me = this; - return OK3(async function(...args2) { + return OK3(async function(...args3) { const error41 = new ZodError3([]); - const parsedArgs = await me._def.args.parseAsync(args2, params).catch((e) => { - error41.addIssue(makeArgsIssue(args2, e)); + const parsedArgs = await me._def.args.parseAsync(args3, params).catch((e) => { + error41.addIssue(makeArgsIssue(args3, e)); throw error41; }); const result = await Reflect.apply(fn2, this, parsedArgs); @@ -103679,9 +104029,9 @@ var ZodFunction3 = class ZodFunction4 extends ZodType3 { }); } else { const me = this; - return OK3(function(...args2) { - const parsedArgs = me._def.args.safeParse(args2, params); - if (!parsedArgs.success) throw new ZodError3([makeArgsIssue(args2, parsedArgs.error)]); + return OK3(function(...args3) { + const parsedArgs = me._def.args.safeParse(args3, params); + if (!parsedArgs.success) throw new ZodError3([makeArgsIssue(args3, parsedArgs.error)]); const result = Reflect.apply(fn2, this, parsedArgs.data); const parsedReturns = me._def.returns.safeParse(result, params); if (!parsedReturns.success) throw new ZodError3([makeReturnsIssue(result, parsedReturns.error)]); @@ -103713,9 +104063,9 @@ var ZodFunction3 = class ZodFunction4 extends ZodType3 { strictImplement(func) { return this.parse(func); } - static create(args2, returns, params) { + static create(args3, returns, params) { return new ZodFunction4({ - args: args2 ? args2 : ZodTuple3.create([]).rest(ZodUnknown3.create()), + args: args3 ? args3 : ZodTuple3.create([]).rest(ZodUnknown3.create()), returns: returns || ZodUnknown3.create(), typeName: ZodFirstPartyTypeKind3.ZodFunction, ...processCreateParams4(params) @@ -105030,11 +105380,11 @@ var require_depd = /* @__PURE__ */ __commonJS3({ "node_modules/.pnpm/depd@2.0.0/ } function wrapfunction(fn2, message) { if (typeof fn2 !== "function") throw new TypeError("argument fn must be a function"); - var args2 = createArgumentsString(fn2.length); + var args3 = createArgumentsString(fn2.length); var stack = getStack(); var site = callSiteLocation(stack[1]); site.name = fn2.name; - return new Function("fn", "log", "deprecate", "message", "site", '"use strict"\nreturn function (' + args2 + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(fn2, log2, this, message, site); + return new Function("fn", "log", "deprecate", "message", "site", '"use strict"\nreturn function (' + args3 + ") {log.call(deprecate, message, site)\nreturn fn.apply(this, arguments)\n}")(fn2, log2, this, message, site); } function wrapproperty(obj, prop, message) { if (!obj || typeof obj !== "object" && typeof obj !== "function") throw new TypeError("argument obj must be object"); @@ -114180,15 +114530,15 @@ var require_raw_body = /* @__PURE__ */ __commonJS3({ "node_modules/.pnpm/raw-bod stream.on("error", onEnd); sync = false; function done() { - var args2 = new Array(arguments.length); - for (var i$3 = 0; i$3 < args2.length; i$3++) args2[i$3] = arguments[i$3]; + var args3 = new Array(arguments.length); + for (var i$3 = 0; i$3 < args3.length; i$3++) args3[i$3] = arguments[i$3]; complete = true; if (sync) process.nextTick(invokeCallback); else invokeCallback(); function invokeCallback() { cleanup(); - if (args2[0]) halt(stream); - callback.apply(null, args2); + if (args3[0]) halt(stream); + callback.apply(null, args3); } } function onAborted() { @@ -119952,8 +120302,8 @@ var require_ajv3 = /* @__PURE__ */ __commonJS3({ "node_modules/.pnpm/ajv@6.12.6/ if (typeof schema2 != "object" && typeof schema2 != "boolean") throw new Error("schema should be object or boolean"); var serialize = this._opts.serialize; var cacheKey = serialize ? serialize(schema2) : schema2; - var cached3 = this._cache.get(cacheKey); - if (cached3) return cached3; + var cached4 = this._cache.get(cacheKey); + if (cached4) return cached4; shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false; var id = resolve.normalizeId(this._getId(schema2)); if (id && shouldAddSchema) checkUnique(this, id); @@ -120706,15 +121056,15 @@ var EventSourceParserStream = class extends TransformStream { } }; -// node_modules/.pnpm/fastmcp@3.20.0_arktype@2.1.25/node_modules/fastmcp/dist/FastMCP.js +// node_modules/.pnpm/fastmcp@3.20.0_arktype@2.1.28/node_modules/fastmcp/dist/FastMCP.js var import_undici = __toESM(require_undici2(), 1); var import_uri_templates = __toESM(require_uri_templates(), 1); import { setTimeout as delay } from "timers/promises"; -// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.25_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/index.js +// node_modules/.pnpm/xsschema@0.3.5_arktype@2.1.28_zod-to-json-schema@3.24.6_zod@3.25.76__zod@3.25.76/node_modules/xsschema/dist/index.js init_index_CAcLDIRJ(); -// node_modules/.pnpm/fastmcp@3.20.0_arktype@2.1.25/node_modules/fastmcp/dist/FastMCP.js +// node_modules/.pnpm/fastmcp@3.20.0_arktype@2.1.28/node_modules/fastmcp/dist/FastMCP.js init_zod(); var FastMCPError = class extends Error { constructor(message) { @@ -121205,9 +121555,9 @@ ${e instanceof Error ? e.stack : JSON.stringify(e)}` `Unknown prompt: ${request2.params.name}` ); } - const args2 = request2.params.arguments; + const args3 = request2.params.arguments; for (const arg of prompt.arguments ?? []) { - if (arg.required && !(args2 && arg.name in args2)) { + if (arg.required && !(args3 && arg.name in args3)) { throw new McpError( ErrorCode2.InvalidRequest, `Prompt '${request2.params.name}' requires argument '${arg.name}': ${arg.description || "No description provided"}` @@ -121217,7 +121567,7 @@ ${e instanceof Error ? e.stack : JSON.stringify(e)}` let result; try { result = await prompt.load( - args2, + args3, this.#auth ); } catch (error41) { @@ -121402,7 +121752,7 @@ ${error41 instanceof Error ? error41.stack : JSON.stringify(error41)}` `Unknown tool: ${request2.params.name}` ); } - let args2 = void 0; + let args3 = void 0; if (tool2.parameters) { const parsed2 = await tool2.parameters["~standard"].validate( request2.params.arguments @@ -121417,7 +121767,7 @@ ${error41 instanceof Error ? error41.stack : JSON.stringify(error41)}` `Tool '${request2.params.name}' parameter validation failed: ${friendlyErrors}. Please check the parameter types and values according to the tool's schema.` ); } - args2 = parsed2.value; + args3 = parsed2.value; } const progressToken = request2.params?._meta?.progressToken; let result; @@ -121499,7 +121849,7 @@ ${error41 instanceof Error ? error41.stack : JSON.stringify(error41)}` ); } }; - const executeToolPromise = tool2.execute(args2, { + const executeToolPromise = tool2.execute(args3, { client: { version: this.#server.getClientVersion() }, @@ -121920,10 +122270,10 @@ var FastMCP = class extends FastMCPEventEmitter { res.writeHead(404).end(); }; #parseRuntimeConfig(overrides) { - const args2 = process.argv.slice(2); + const args3 = process.argv.slice(2); const getArg = (name) => { - const index = args2.findIndex((arg) => arg === `--${name}`); - return index !== -1 && index + 1 < args2.length ? args2[index + 1] : void 0; + const index = args3.findIndex((arg) => arg === `--${name}`); + return index !== -1 && index + 1 < args3.length ? args3[index + 1] : void 0; }; const transportArg = getArg("transport"); const portArg = getArg("port"); @@ -122051,9 +122401,9 @@ var GetCheckSuiteLogsTool = tool({ // utils/shell.ts import { spawnSync as spawnSync4 } from "node:child_process"; -function $(cmd, args2, options) { +function $(cmd, args3, options) { const encoding = options?.encoding ?? "utf-8"; - const result = spawnSync4(cmd, args2, { + const result = spawnSync4(cmd, args3, { stdio: ["ignore", "pipe", "pipe"], encoding, cwd: options?.cwd @@ -122310,6 +122660,29 @@ var IssueInfoTool = tool({ }) }); +// mcp/labels.ts +var AddLabelsParams = type({ + issue_number: type.number.describe("the issue or PR number to add labels to"), + labels: type.string.array().atLeastLength(1).describe("array of label names to add") +}); +var AddLabelsTool = tool({ + name: "add_labels", + description: "Add labels to a GitHub issue or pull request. Only use labels that already exist in the repository.", + parameters: AddLabelsParams, + execute: contextualize(async ({ issue_number, labels }, ctx) => { + const result = await ctx.octokit.rest.issues.addLabels({ + owner: ctx.owner, + repo: ctx.name, + issue_number, + labels + }); + return { + success: true, + labels: result.data.map((label) => label.name) + }; + }) +}); + // utils/secrets.ts function getAllSecrets() { const secrets = []; @@ -122613,9 +122986,8 @@ async function startMcpHttpServer(state) { name: ghPullfrogMcpName, version: "0.0.1" }); - addTools(server, [ + const tools = [ SelectModeTool, - ReportProgressTool, CreateCommentTool, EditCommentTool, ReplyToReviewCommentTool, @@ -122629,8 +123001,13 @@ async function startMcpHttpServer(state) { GetReviewCommentsTool, ListPullRequestReviewsTool, GetCheckSuiteLogsTool, - DebugShellCommandTool - ]); + DebugShellCommandTool, + AddLabelsTool + ]; + if (!isProgressCommentDisabled()) { + tools.push(ReportProgressTool); + } + addTools(server, tools); const port = await findAvailablePort(3764); const host = "127.0.0.1"; const endpoint2 = "/mcp"; @@ -123011,7 +123388,10 @@ async function startMcpServer(ctx) { log.info(`\u{1F4DD} Using pre-created progress comment: ${workflowRunInfo.progressCommentId}`); } } - const allModes = [...modes, ...ctx.payload.modes || []]; + const allModes = [ + ...getModes({ disableProgressComment: ctx.payload.disableProgressComment }), + ...ctx.payload.modes || [] + ]; const { url: url2, close } = await startMcpHttpServer({ payload: ctx.payload, modes: allModes, diff --git a/package.json b/package.json index 9cfa47f..157dd55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pullfrog/action", - "version": "0.0.128", + "version": "0.0.129", "type": "module", "files": [ "index.js",