Files
oh-my-opencode/dist/cli/index.js
T
2026-03-14 04:56:50 +00:00

29783 lines
1.0 MiB
Plaintext
Executable File

#!/usr/bin/env bun
// @bun
var __create = Object.create;
var __getProtoOf = Object.getPrototypeOf;
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
function __accessProp(key) {
return this[key];
}
var __toESMCache_node;
var __toESMCache_esm;
var __toESM = (mod, isNodeMode, target) => {
var canCache = mod != null && typeof mod === "object";
if (canCache) {
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
var cached = cache.get(mod);
if (cached)
return cached;
}
target = mod != null ? __create(__getProtoOf(mod)) : {};
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
for (let key of __getOwnPropNames(mod))
if (!__hasOwnProp.call(to, key))
__defProp(to, key, {
get: __accessProp.bind(mod, key),
enumerable: true
});
if (canCache)
cache.set(mod, to);
return to;
};
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
var __returnValue = (v) => v;
function __exportSetter(name, newValue) {
this[name] = __returnValue.bind(null, newValue);
}
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: __exportSetter.bind(all, name)
});
};
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
var __require = import.meta.require;
// node_modules/commander/lib/error.js
var require_error = __commonJS((exports) => {
class CommanderError extends Error {
constructor(exitCode, code, message) {
super(message);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.code = code;
this.exitCode = exitCode;
this.nestedError = undefined;
}
}
class InvalidArgumentError extends CommanderError {
constructor(message) {
super(1, "commander.invalidArgument", message);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
}
}
exports.CommanderError = CommanderError;
exports.InvalidArgumentError = InvalidArgumentError;
});
// node_modules/commander/lib/argument.js
var require_argument = __commonJS((exports) => {
var { InvalidArgumentError } = require_error();
class Argument {
constructor(name, description) {
this.description = description || "";
this.variadic = false;
this.parseArg = undefined;
this.defaultValue = undefined;
this.defaultValueDescription = undefined;
this.argChoices = undefined;
switch (name[0]) {
case "<":
this.required = true;
this._name = name.slice(1, -1);
break;
case "[":
this.required = false;
this._name = name.slice(1, -1);
break;
default:
this.required = true;
this._name = name;
break;
}
if (this._name.endsWith("...")) {
this.variadic = true;
this._name = this._name.slice(0, -3);
}
}
name() {
return this._name;
}
_collectValue(value, previous) {
if (previous === this.defaultValue || !Array.isArray(previous)) {
return [value];
}
previous.push(value);
return previous;
}
default(value, description) {
this.defaultValue = value;
this.defaultValueDescription = description;
return this;
}
argParser(fn) {
this.parseArg = fn;
return this;
}
choices(values) {
this.argChoices = values.slice();
this.parseArg = (arg, previous) => {
if (!this.argChoices.includes(arg)) {
throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
}
if (this.variadic) {
return this._collectValue(arg, previous);
}
return arg;
};
return this;
}
argRequired() {
this.required = true;
return this;
}
argOptional() {
this.required = false;
return this;
}
}
function humanReadableArgName(arg) {
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
}
exports.Argument = Argument;
exports.humanReadableArgName = humanReadableArgName;
});
// node_modules/commander/lib/help.js
var require_help = __commonJS((exports) => {
var { humanReadableArgName } = require_argument();
class Help {
constructor() {
this.helpWidth = undefined;
this.minWidthToWrap = 40;
this.sortSubcommands = false;
this.sortOptions = false;
this.showGlobalOptions = false;
}
prepareContext(contextOptions) {
this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
}
visibleCommands(cmd) {
const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
const helpCommand = cmd._getHelpCommand();
if (helpCommand && !helpCommand._hidden) {
visibleCommands.push(helpCommand);
}
if (this.sortSubcommands) {
visibleCommands.sort((a, b) => {
return a.name().localeCompare(b.name());
});
}
return visibleCommands;
}
compareOptions(a, b) {
const getSortKey = (option) => {
return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
};
return getSortKey(a).localeCompare(getSortKey(b));
}
visibleOptions(cmd) {
const visibleOptions = cmd.options.filter((option) => !option.hidden);
const helpOption = cmd._getHelpOption();
if (helpOption && !helpOption.hidden) {
const removeShort = helpOption.short && cmd._findOption(helpOption.short);
const removeLong = helpOption.long && cmd._findOption(helpOption.long);
if (!removeShort && !removeLong) {
visibleOptions.push(helpOption);
} else if (helpOption.long && !removeLong) {
visibleOptions.push(cmd.createOption(helpOption.long, helpOption.description));
} else if (helpOption.short && !removeShort) {
visibleOptions.push(cmd.createOption(helpOption.short, helpOption.description));
}
}
if (this.sortOptions) {
visibleOptions.sort(this.compareOptions);
}
return visibleOptions;
}
visibleGlobalOptions(cmd) {
if (!this.showGlobalOptions)
return [];
const globalOptions = [];
for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
const visibleOptions = ancestorCmd.options.filter((option) => !option.hidden);
globalOptions.push(...visibleOptions);
}
if (this.sortOptions) {
globalOptions.sort(this.compareOptions);
}
return globalOptions;
}
visibleArguments(cmd) {
if (cmd._argsDescription) {
cmd.registeredArguments.forEach((argument) => {
argument.description = argument.description || cmd._argsDescription[argument.name()] || "";
});
}
if (cmd.registeredArguments.find((argument) => argument.description)) {
return cmd.registeredArguments;
}
return [];
}
subcommandTerm(cmd) {
const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + (args ? " " + args : "");
}
optionTerm(option) {
return option.flags;
}
argumentTerm(argument) {
return argument.name();
}
longestSubcommandTermLength(cmd, helper) {
return helper.visibleCommands(cmd).reduce((max, command) => {
return Math.max(max, this.displayWidth(helper.styleSubcommandTerm(helper.subcommandTerm(command))));
}, 0);
}
longestOptionTermLength(cmd, helper) {
return helper.visibleOptions(cmd).reduce((max, option) => {
return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
}, 0);
}
longestGlobalOptionTermLength(cmd, helper) {
return helper.visibleGlobalOptions(cmd).reduce((max, option) => {
return Math.max(max, this.displayWidth(helper.styleOptionTerm(helper.optionTerm(option))));
}, 0);
}
longestArgumentTermLength(cmd, helper) {
return helper.visibleArguments(cmd).reduce((max, argument) => {
return Math.max(max, this.displayWidth(helper.styleArgumentTerm(helper.argumentTerm(argument))));
}, 0);
}
commandUsage(cmd) {
let cmdName = cmd._name;
if (cmd._aliases[0]) {
cmdName = cmdName + "|" + cmd._aliases[0];
}
let ancestorCmdNames = "";
for (let ancestorCmd = cmd.parent;ancestorCmd; ancestorCmd = ancestorCmd.parent) {
ancestorCmdNames = ancestorCmd.name() + " " + ancestorCmdNames;
}
return ancestorCmdNames + cmdName + " " + cmd.usage();
}
commandDescription(cmd) {
return cmd.description();
}
subcommandDescription(cmd) {
return cmd.summary() || cmd.description();
}
optionDescription(option) {
const extraInfo = [];
if (option.argChoices) {
extraInfo.push(`choices: ${option.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`);
}
if (option.defaultValue !== undefined) {
const showDefault = option.required || option.optional || option.isBoolean() && typeof option.defaultValue === "boolean";
if (showDefault) {
extraInfo.push(`default: ${option.defaultValueDescription || JSON.stringify(option.defaultValue)}`);
}
}
if (option.presetArg !== undefined && option.optional) {
extraInfo.push(`preset: ${JSON.stringify(option.presetArg)}`);
}
if (option.envVar !== undefined) {
extraInfo.push(`env: ${option.envVar}`);
}
if (extraInfo.length > 0) {
const extraDescription = `(${extraInfo.join(", ")})`;
if (option.description) {
return `${option.description} ${extraDescription}`;
}
return extraDescription;
}
return option.description;
}
argumentDescription(argument) {
const extraInfo = [];
if (argument.argChoices) {
extraInfo.push(`choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(", ")}`);
}
if (argument.defaultValue !== undefined) {
extraInfo.push(`default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`);
}
if (extraInfo.length > 0) {
const extraDescription = `(${extraInfo.join(", ")})`;
if (argument.description) {
return `${argument.description} ${extraDescription}`;
}
return extraDescription;
}
return argument.description;
}
formatItemList(heading, items, helper) {
if (items.length === 0)
return [];
return [helper.styleTitle(heading), ...items, ""];
}
groupItems(unsortedItems, visibleItems, getGroup) {
const result = new Map;
unsortedItems.forEach((item) => {
const group = getGroup(item);
if (!result.has(group))
result.set(group, []);
});
visibleItems.forEach((item) => {
const group = getGroup(item);
if (!result.has(group)) {
result.set(group, []);
}
result.get(group).push(item);
});
return result;
}
formatHelp(cmd, helper) {
const termWidth = helper.padWidth(cmd, helper);
const helpWidth = helper.helpWidth ?? 80;
function callFormatItem(term, description) {
return helper.formatItem(term, termWidth, description, helper);
}
let output = [
`${helper.styleTitle("Usage:")} ${helper.styleUsage(helper.commandUsage(cmd))}`,
""
];
const commandDescription = helper.commandDescription(cmd);
if (commandDescription.length > 0) {
output = output.concat([
helper.boxWrap(helper.styleCommandDescription(commandDescription), helpWidth),
""
]);
}
const argumentList = helper.visibleArguments(cmd).map((argument) => {
return callFormatItem(helper.styleArgumentTerm(helper.argumentTerm(argument)), helper.styleArgumentDescription(helper.argumentDescription(argument)));
});
output = output.concat(this.formatItemList("Arguments:", argumentList, helper));
const optionGroups = this.groupItems(cmd.options, helper.visibleOptions(cmd), (option) => option.helpGroupHeading ?? "Options:");
optionGroups.forEach((options, group) => {
const optionList = options.map((option) => {
return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
});
output = output.concat(this.formatItemList(group, optionList, helper));
});
if (helper.showGlobalOptions) {
const globalOptionList = helper.visibleGlobalOptions(cmd).map((option) => {
return callFormatItem(helper.styleOptionTerm(helper.optionTerm(option)), helper.styleOptionDescription(helper.optionDescription(option)));
});
output = output.concat(this.formatItemList("Global Options:", globalOptionList, helper));
}
const commandGroups = this.groupItems(cmd.commands, helper.visibleCommands(cmd), (sub) => sub.helpGroup() || "Commands:");
commandGroups.forEach((commands, group) => {
const commandList = commands.map((sub) => {
return callFormatItem(helper.styleSubcommandTerm(helper.subcommandTerm(sub)), helper.styleSubcommandDescription(helper.subcommandDescription(sub)));
});
output = output.concat(this.formatItemList(group, commandList, helper));
});
return output.join(`
`);
}
displayWidth(str) {
return stripColor(str).length;
}
styleTitle(str) {
return str;
}
styleUsage(str) {
return str.split(" ").map((word) => {
if (word === "[options]")
return this.styleOptionText(word);
if (word === "[command]")
return this.styleSubcommandText(word);
if (word[0] === "[" || word[0] === "<")
return this.styleArgumentText(word);
return this.styleCommandText(word);
}).join(" ");
}
styleCommandDescription(str) {
return this.styleDescriptionText(str);
}
styleOptionDescription(str) {
return this.styleDescriptionText(str);
}
styleSubcommandDescription(str) {
return this.styleDescriptionText(str);
}
styleArgumentDescription(str) {
return this.styleDescriptionText(str);
}
styleDescriptionText(str) {
return str;
}
styleOptionTerm(str) {
return this.styleOptionText(str);
}
styleSubcommandTerm(str) {
return str.split(" ").map((word) => {
if (word === "[options]")
return this.styleOptionText(word);
if (word[0] === "[" || word[0] === "<")
return this.styleArgumentText(word);
return this.styleSubcommandText(word);
}).join(" ");
}
styleArgumentTerm(str) {
return this.styleArgumentText(str);
}
styleOptionText(str) {
return str;
}
styleArgumentText(str) {
return str;
}
styleSubcommandText(str) {
return str;
}
styleCommandText(str) {
return str;
}
padWidth(cmd, helper) {
return Math.max(helper.longestOptionTermLength(cmd, helper), helper.longestGlobalOptionTermLength(cmd, helper), helper.longestSubcommandTermLength(cmd, helper), helper.longestArgumentTermLength(cmd, helper));
}
preformatted(str) {
return /\n[^\S\r\n]/.test(str);
}
formatItem(term, termWidth, description, helper) {
const itemIndent = 2;
const itemIndentStr = " ".repeat(itemIndent);
if (!description)
return itemIndentStr + term;
const paddedTerm = term.padEnd(termWidth + term.length - helper.displayWidth(term));
const spacerWidth = 2;
const helpWidth = this.helpWidth ?? 80;
const remainingWidth = helpWidth - termWidth - spacerWidth - itemIndent;
let formattedDescription;
if (remainingWidth < this.minWidthToWrap || helper.preformatted(description)) {
formattedDescription = description;
} else {
const wrappedDescription = helper.boxWrap(description, remainingWidth);
formattedDescription = wrappedDescription.replace(/\n/g, `
` + " ".repeat(termWidth + spacerWidth));
}
return itemIndentStr + paddedTerm + " ".repeat(spacerWidth) + formattedDescription.replace(/\n/g, `
${itemIndentStr}`);
}
boxWrap(str, width) {
if (width < this.minWidthToWrap)
return str;
const rawLines = str.split(/\r\n|\n/);
const chunkPattern = /[\s]*[^\s]+/g;
const wrappedLines = [];
rawLines.forEach((line) => {
const chunks = line.match(chunkPattern);
if (chunks === null) {
wrappedLines.push("");
return;
}
let sumChunks = [chunks.shift()];
let sumWidth = this.displayWidth(sumChunks[0]);
chunks.forEach((chunk) => {
const visibleWidth = this.displayWidth(chunk);
if (sumWidth + visibleWidth <= width) {
sumChunks.push(chunk);
sumWidth += visibleWidth;
return;
}
wrappedLines.push(sumChunks.join(""));
const nextChunk = chunk.trimStart();
sumChunks = [nextChunk];
sumWidth = this.displayWidth(nextChunk);
});
wrappedLines.push(sumChunks.join(""));
});
return wrappedLines.join(`
`);
}
}
function stripColor(str) {
const sgrPattern = /\x1b\[\d*(;\d*)*m/g;
return str.replace(sgrPattern, "");
}
exports.Help = Help;
exports.stripColor = stripColor;
});
// node_modules/commander/lib/option.js
var require_option = __commonJS((exports) => {
var { InvalidArgumentError } = require_error();
class Option {
constructor(flags, description) {
this.flags = flags;
this.description = description || "";
this.required = flags.includes("<");
this.optional = flags.includes("[");
this.variadic = /\w\.\.\.[>\]]$/.test(flags);
this.mandatory = false;
const optionFlags = splitOptionFlags(flags);
this.short = optionFlags.shortFlag;
this.long = optionFlags.longFlag;
this.negate = false;
if (this.long) {
this.negate = this.long.startsWith("--no-");
}
this.defaultValue = undefined;
this.defaultValueDescription = undefined;
this.presetArg = undefined;
this.envVar = undefined;
this.parseArg = undefined;
this.hidden = false;
this.argChoices = undefined;
this.conflictsWith = [];
this.implied = undefined;
this.helpGroupHeading = undefined;
}
default(value, description) {
this.defaultValue = value;
this.defaultValueDescription = description;
return this;
}
preset(arg) {
this.presetArg = arg;
return this;
}
conflicts(names) {
this.conflictsWith = this.conflictsWith.concat(names);
return this;
}
implies(impliedOptionValues) {
let newImplied = impliedOptionValues;
if (typeof impliedOptionValues === "string") {
newImplied = { [impliedOptionValues]: true };
}
this.implied = Object.assign(this.implied || {}, newImplied);
return this;
}
env(name) {
this.envVar = name;
return this;
}
argParser(fn) {
this.parseArg = fn;
return this;
}
makeOptionMandatory(mandatory = true) {
this.mandatory = !!mandatory;
return this;
}
hideHelp(hide = true) {
this.hidden = !!hide;
return this;
}
_collectValue(value, previous) {
if (previous === this.defaultValue || !Array.isArray(previous)) {
return [value];
}
previous.push(value);
return previous;
}
choices(values) {
this.argChoices = values.slice();
this.parseArg = (arg, previous) => {
if (!this.argChoices.includes(arg)) {
throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
}
if (this.variadic) {
return this._collectValue(arg, previous);
}
return arg;
};
return this;
}
name() {
if (this.long) {
return this.long.replace(/^--/, "");
}
return this.short.replace(/^-/, "");
}
attributeName() {
if (this.negate) {
return camelcase(this.name().replace(/^no-/, ""));
}
return camelcase(this.name());
}
helpGroup(heading) {
this.helpGroupHeading = heading;
return this;
}
is(arg) {
return this.short === arg || this.long === arg;
}
isBoolean() {
return !this.required && !this.optional && !this.negate;
}
}
class DualOptions {
constructor(options) {
this.positiveOptions = new Map;
this.negativeOptions = new Map;
this.dualOptions = new Set;
options.forEach((option) => {
if (option.negate) {
this.negativeOptions.set(option.attributeName(), option);
} else {
this.positiveOptions.set(option.attributeName(), option);
}
});
this.negativeOptions.forEach((value, key) => {
if (this.positiveOptions.has(key)) {
this.dualOptions.add(key);
}
});
}
valueFromOption(value, option) {
const optionKey = option.attributeName();
if (!this.dualOptions.has(optionKey))
return true;
const preset = this.negativeOptions.get(optionKey).presetArg;
const negativeValue = preset !== undefined ? preset : false;
return option.negate === (negativeValue === value);
}
}
function camelcase(str) {
return str.split("-").reduce((str2, word) => {
return str2 + word[0].toUpperCase() + word.slice(1);
});
}
function splitOptionFlags(flags) {
let shortFlag;
let longFlag;
const shortFlagExp = /^-[^-]$/;
const longFlagExp = /^--[^-]/;
const flagParts = flags.split(/[ |,]+/).concat("guard");
if (shortFlagExp.test(flagParts[0]))
shortFlag = flagParts.shift();
if (longFlagExp.test(flagParts[0]))
longFlag = flagParts.shift();
if (!shortFlag && shortFlagExp.test(flagParts[0]))
shortFlag = flagParts.shift();
if (!shortFlag && longFlagExp.test(flagParts[0])) {
shortFlag = longFlag;
longFlag = flagParts.shift();
}
if (flagParts[0].startsWith("-")) {
const unsupportedFlag = flagParts[0];
const baseError = `option creation failed due to '${unsupportedFlag}' in option flags '${flags}'`;
if (/^-[^-][^-]/.test(unsupportedFlag))
throw new Error(`${baseError}
- a short flag is a single dash and a single character
- either use a single dash and a single character (for a short flag)
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);
if (shortFlagExp.test(unsupportedFlag))
throw new Error(`${baseError}
- too many short flags`);
if (longFlagExp.test(unsupportedFlag))
throw new Error(`${baseError}
- too many long flags`);
throw new Error(`${baseError}
- unrecognised flag format`);
}
if (shortFlag === undefined && longFlag === undefined)
throw new Error(`option creation failed due to no flags found in '${flags}'.`);
return { shortFlag, longFlag };
}
exports.Option = Option;
exports.DualOptions = DualOptions;
});
// node_modules/commander/lib/suggestSimilar.js
var require_suggestSimilar = __commonJS((exports) => {
var maxDistance = 3;
function editDistance(a, b) {
if (Math.abs(a.length - b.length) > maxDistance)
return Math.max(a.length, b.length);
const d = [];
for (let i = 0;i <= a.length; i++) {
d[i] = [i];
}
for (let j = 0;j <= b.length; j++) {
d[0][j] = j;
}
for (let j = 1;j <= b.length; j++) {
for (let i = 1;i <= a.length; i++) {
let cost = 1;
if (a[i - 1] === b[j - 1]) {
cost = 0;
} else {
cost = 1;
}
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
}
}
}
return d[a.length][b.length];
}
function suggestSimilar(word, candidates) {
if (!candidates || candidates.length === 0)
return "";
candidates = Array.from(new Set(candidates));
const searchingOptions = word.startsWith("--");
if (searchingOptions) {
word = word.slice(2);
candidates = candidates.map((candidate) => candidate.slice(2));
}
let similar = [];
let bestDistance = maxDistance;
const minSimilarity = 0.4;
candidates.forEach((candidate) => {
if (candidate.length <= 1)
return;
const distance = editDistance(word, candidate);
const length = Math.max(word.length, candidate.length);
const similarity = (length - distance) / length;
if (similarity > minSimilarity) {
if (distance < bestDistance) {
bestDistance = distance;
similar = [candidate];
} else if (distance === bestDistance) {
similar.push(candidate);
}
}
});
similar.sort((a, b) => a.localeCompare(b));
if (searchingOptions) {
similar = similar.map((candidate) => `--${candidate}`);
}
if (similar.length > 1) {
return `
(Did you mean one of ${similar.join(", ")}?)`;
}
if (similar.length === 1) {
return `
(Did you mean ${similar[0]}?)`;
}
return "";
}
exports.suggestSimilar = suggestSimilar;
});
// node_modules/commander/lib/command.js
var require_command = __commonJS((exports) => {
var EventEmitter = __require("events").EventEmitter;
var childProcess = __require("child_process");
var path = __require("path");
var fs = __require("fs");
var process2 = __require("process");
var { Argument, humanReadableArgName } = require_argument();
var { CommanderError } = require_error();
var { Help, stripColor } = require_help();
var { Option, DualOptions } = require_option();
var { suggestSimilar } = require_suggestSimilar();
class Command extends EventEmitter {
constructor(name) {
super();
this.commands = [];
this.options = [];
this.parent = null;
this._allowUnknownOption = false;
this._allowExcessArguments = false;
this.registeredArguments = [];
this._args = this.registeredArguments;
this.args = [];
this.rawArgs = [];
this.processedArgs = [];
this._scriptPath = null;
this._name = name || "";
this._optionValues = {};
this._optionValueSources = {};
this._storeOptionsAsProperties = false;
this._actionHandler = null;
this._executableHandler = false;
this._executableFile = null;
this._executableDir = null;
this._defaultCommandName = null;
this._exitCallback = null;
this._aliases = [];
this._combineFlagAndOptionalValue = true;
this._description = "";
this._summary = "";
this._argsDescription = undefined;
this._enablePositionalOptions = false;
this._passThroughOptions = false;
this._lifeCycleHooks = {};
this._showHelpAfterError = false;
this._showSuggestionAfterError = true;
this._savedState = null;
this._outputConfiguration = {
writeOut: (str) => process2.stdout.write(str),
writeErr: (str) => process2.stderr.write(str),
outputError: (str, write) => write(str),
getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : undefined,
getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : undefined,
getOutHasColors: () => useColor() ?? (process2.stdout.isTTY && process2.stdout.hasColors?.()),
getErrHasColors: () => useColor() ?? (process2.stderr.isTTY && process2.stderr.hasColors?.()),
stripColor: (str) => stripColor(str)
};
this._hidden = false;
this._helpOption = undefined;
this._addImplicitHelpCommand = undefined;
this._helpCommand = undefined;
this._helpConfiguration = {};
this._helpGroupHeading = undefined;
this._defaultCommandGroup = undefined;
this._defaultOptionGroup = undefined;
}
copyInheritedSettings(sourceCommand) {
this._outputConfiguration = sourceCommand._outputConfiguration;
this._helpOption = sourceCommand._helpOption;
this._helpCommand = sourceCommand._helpCommand;
this._helpConfiguration = sourceCommand._helpConfiguration;
this._exitCallback = sourceCommand._exitCallback;
this._storeOptionsAsProperties = sourceCommand._storeOptionsAsProperties;
this._combineFlagAndOptionalValue = sourceCommand._combineFlagAndOptionalValue;
this._allowExcessArguments = sourceCommand._allowExcessArguments;
this._enablePositionalOptions = sourceCommand._enablePositionalOptions;
this._showHelpAfterError = sourceCommand._showHelpAfterError;
this._showSuggestionAfterError = sourceCommand._showSuggestionAfterError;
return this;
}
_getCommandAndAncestors() {
const result = [];
for (let command = this;command; command = command.parent) {
result.push(command);
}
return result;
}
command(nameAndArgs, actionOptsOrExecDesc, execOpts) {
let desc = actionOptsOrExecDesc;
let opts = execOpts;
if (typeof desc === "object" && desc !== null) {
opts = desc;
desc = null;
}
opts = opts || {};
const [, name, args] = nameAndArgs.match(/([^ ]+) *(.*)/);
const cmd = this.createCommand(name);
if (desc) {
cmd.description(desc);
cmd._executableHandler = true;
}
if (opts.isDefault)
this._defaultCommandName = cmd._name;
cmd._hidden = !!(opts.noHelp || opts.hidden);
cmd._executableFile = opts.executableFile || null;
if (args)
cmd.arguments(args);
this._registerCommand(cmd);
cmd.parent = this;
cmd.copyInheritedSettings(this);
if (desc)
return this;
return cmd;
}
createCommand(name) {
return new Command(name);
}
createHelp() {
return Object.assign(new Help, this.configureHelp());
}
configureHelp(configuration) {
if (configuration === undefined)
return this._helpConfiguration;
this._helpConfiguration = configuration;
return this;
}
configureOutput(configuration) {
if (configuration === undefined)
return this._outputConfiguration;
this._outputConfiguration = {
...this._outputConfiguration,
...configuration
};
return this;
}
showHelpAfterError(displayHelp = true) {
if (typeof displayHelp !== "string")
displayHelp = !!displayHelp;
this._showHelpAfterError = displayHelp;
return this;
}
showSuggestionAfterError(displaySuggestion = true) {
this._showSuggestionAfterError = !!displaySuggestion;
return this;
}
addCommand(cmd, opts) {
if (!cmd._name) {
throw new Error(`Command passed to .addCommand() must have a name
- specify the name in Command constructor or using .name()`);
}
opts = opts || {};
if (opts.isDefault)
this._defaultCommandName = cmd._name;
if (opts.noHelp || opts.hidden)
cmd._hidden = true;
this._registerCommand(cmd);
cmd.parent = this;
cmd._checkForBrokenPassThrough();
return this;
}
createArgument(name, description) {
return new Argument(name, description);
}
argument(name, description, parseArg, defaultValue) {
const argument = this.createArgument(name, description);
if (typeof parseArg === "function") {
argument.default(defaultValue).argParser(parseArg);
} else {
argument.default(parseArg);
}
this.addArgument(argument);
return this;
}
arguments(names) {
names.trim().split(/ +/).forEach((detail) => {
this.argument(detail);
});
return this;
}
addArgument(argument) {
const previousArgument = this.registeredArguments.slice(-1)[0];
if (previousArgument?.variadic) {
throw new Error(`only the last argument can be variadic '${previousArgument.name()}'`);
}
if (argument.required && argument.defaultValue !== undefined && argument.parseArg === undefined) {
throw new Error(`a default value for a required argument is never used: '${argument.name()}'`);
}
this.registeredArguments.push(argument);
return this;
}
helpCommand(enableOrNameAndArgs, description) {
if (typeof enableOrNameAndArgs === "boolean") {
this._addImplicitHelpCommand = enableOrNameAndArgs;
if (enableOrNameAndArgs && this._defaultCommandGroup) {
this._initCommandGroup(this._getHelpCommand());
}
return this;
}
const nameAndArgs = enableOrNameAndArgs ?? "help [command]";
const [, helpName, helpArgs] = nameAndArgs.match(/([^ ]+) *(.*)/);
const helpDescription = description ?? "display help for command";
const helpCommand = this.createCommand(helpName);
helpCommand.helpOption(false);
if (helpArgs)
helpCommand.arguments(helpArgs);
if (helpDescription)
helpCommand.description(helpDescription);
this._addImplicitHelpCommand = true;
this._helpCommand = helpCommand;
if (enableOrNameAndArgs || description)
this._initCommandGroup(helpCommand);
return this;
}
addHelpCommand(helpCommand, deprecatedDescription) {
if (typeof helpCommand !== "object") {
this.helpCommand(helpCommand, deprecatedDescription);
return this;
}
this._addImplicitHelpCommand = true;
this._helpCommand = helpCommand;
this._initCommandGroup(helpCommand);
return this;
}
_getHelpCommand() {
const hasImplicitHelpCommand = this._addImplicitHelpCommand ?? (this.commands.length && !this._actionHandler && !this._findCommand("help"));
if (hasImplicitHelpCommand) {
if (this._helpCommand === undefined) {
this.helpCommand(undefined, undefined);
}
return this._helpCommand;
}
return null;
}
hook(event, listener) {
const allowedValues = ["preSubcommand", "preAction", "postAction"];
if (!allowedValues.includes(event)) {
throw new Error(`Unexpected value for event passed to hook : '${event}'.
Expecting one of '${allowedValues.join("', '")}'`);
}
if (this._lifeCycleHooks[event]) {
this._lifeCycleHooks[event].push(listener);
} else {
this._lifeCycleHooks[event] = [listener];
}
return this;
}
exitOverride(fn) {
if (fn) {
this._exitCallback = fn;
} else {
this._exitCallback = (err) => {
if (err.code !== "commander.executeSubCommandAsync") {
throw err;
} else {}
};
}
return this;
}
_exit(exitCode, code, message) {
if (this._exitCallback) {
this._exitCallback(new CommanderError(exitCode, code, message));
}
process2.exit(exitCode);
}
action(fn) {
const listener = (args) => {
const expectedArgsCount = this.registeredArguments.length;
const actionArgs = args.slice(0, expectedArgsCount);
if (this._storeOptionsAsProperties) {
actionArgs[expectedArgsCount] = this;
} else {
actionArgs[expectedArgsCount] = this.opts();
}
actionArgs.push(this);
return fn.apply(this, actionArgs);
};
this._actionHandler = listener;
return this;
}
createOption(flags, description) {
return new Option(flags, description);
}
_callParseArg(target, value, previous, invalidArgumentMessage) {
try {
return target.parseArg(value, previous);
} catch (err) {
if (err.code === "commander.invalidArgument") {
const message = `${invalidArgumentMessage} ${err.message}`;
this.error(message, { exitCode: err.exitCode, code: err.code });
}
throw err;
}
}
_registerOption(option) {
const matchingOption = option.short && this._findOption(option.short) || option.long && this._findOption(option.long);
if (matchingOption) {
const matchingFlag = option.long && this._findOption(option.long) ? option.long : option.short;
throw new Error(`Cannot add option '${option.flags}'${this._name && ` to command '${this._name}'`} due to conflicting flag '${matchingFlag}'
- already used by option '${matchingOption.flags}'`);
}
this._initOptionGroup(option);
this.options.push(option);
}
_registerCommand(command) {
const knownBy = (cmd) => {
return [cmd.name()].concat(cmd.aliases());
};
const alreadyUsed = knownBy(command).find((name) => this._findCommand(name));
if (alreadyUsed) {
const existingCmd = knownBy(this._findCommand(alreadyUsed)).join("|");
const newCmd = knownBy(command).join("|");
throw new Error(`cannot add command '${newCmd}' as already have command '${existingCmd}'`);
}
this._initCommandGroup(command);
this.commands.push(command);
}
addOption(option) {
this._registerOption(option);
const oname = option.name();
const name = option.attributeName();
if (option.negate) {
const positiveLongFlag = option.long.replace(/^--no-/, "--");
if (!this._findOption(positiveLongFlag)) {
this.setOptionValueWithSource(name, option.defaultValue === undefined ? true : option.defaultValue, "default");
}
} else if (option.defaultValue !== undefined) {
this.setOptionValueWithSource(name, option.defaultValue, "default");
}
const handleOptionValue = (val, invalidValueMessage, valueSource) => {
if (val == null && option.presetArg !== undefined) {
val = option.presetArg;
}
const oldValue = this.getOptionValue(name);
if (val !== null && option.parseArg) {
val = this._callParseArg(option, val, oldValue, invalidValueMessage);
} else if (val !== null && option.variadic) {
val = option._collectValue(val, oldValue);
}
if (val == null) {
if (option.negate) {
val = false;
} else if (option.isBoolean() || option.optional) {
val = true;
} else {
val = "";
}
}
this.setOptionValueWithSource(name, val, valueSource);
};
this.on("option:" + oname, (val) => {
const invalidValueMessage = `error: option '${option.flags}' argument '${val}' is invalid.`;
handleOptionValue(val, invalidValueMessage, "cli");
});
if (option.envVar) {
this.on("optionEnv:" + oname, (val) => {
const invalidValueMessage = `error: option '${option.flags}' value '${val}' from env '${option.envVar}' is invalid.`;
handleOptionValue(val, invalidValueMessage, "env");
});
}
return this;
}
_optionEx(config, flags, description, fn, defaultValue) {
if (typeof flags === "object" && flags instanceof Option) {
throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
}
const option = this.createOption(flags, description);
option.makeOptionMandatory(!!config.mandatory);
if (typeof fn === "function") {
option.default(defaultValue).argParser(fn);
} else if (fn instanceof RegExp) {
const regex = fn;
fn = (val, def) => {
const m = regex.exec(val);
return m ? m[0] : def;
};
option.default(defaultValue).argParser(fn);
} else {
option.default(fn);
}
return this.addOption(option);
}
option(flags, description, parseArg, defaultValue) {
return this._optionEx({}, flags, description, parseArg, defaultValue);
}
requiredOption(flags, description, parseArg, defaultValue) {
return this._optionEx({ mandatory: true }, flags, description, parseArg, defaultValue);
}
combineFlagAndOptionalValue(combine = true) {
this._combineFlagAndOptionalValue = !!combine;
return this;
}
allowUnknownOption(allowUnknown = true) {
this._allowUnknownOption = !!allowUnknown;
return this;
}
allowExcessArguments(allowExcess = true) {
this._allowExcessArguments = !!allowExcess;
return this;
}
enablePositionalOptions(positional = true) {
this._enablePositionalOptions = !!positional;
return this;
}
passThroughOptions(passThrough = true) {
this._passThroughOptions = !!passThrough;
this._checkForBrokenPassThrough();
return this;
}
_checkForBrokenPassThrough() {
if (this.parent && this._passThroughOptions && !this.parent._enablePositionalOptions) {
throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`);
}
}
storeOptionsAsProperties(storeAsProperties = true) {
if (this.options.length) {
throw new Error("call .storeOptionsAsProperties() before adding options");
}
if (Object.keys(this._optionValues).length) {
throw new Error("call .storeOptionsAsProperties() before setting option values");
}
this._storeOptionsAsProperties = !!storeAsProperties;
return this;
}
getOptionValue(key) {
if (this._storeOptionsAsProperties) {
return this[key];
}
return this._optionValues[key];
}
setOptionValue(key, value) {
return this.setOptionValueWithSource(key, value, undefined);
}
setOptionValueWithSource(key, value, source) {
if (this._storeOptionsAsProperties) {
this[key] = value;
} else {
this._optionValues[key] = value;
}
this._optionValueSources[key] = source;
return this;
}
getOptionValueSource(key) {
return this._optionValueSources[key];
}
getOptionValueSourceWithGlobals(key) {
let source;
this._getCommandAndAncestors().forEach((cmd) => {
if (cmd.getOptionValueSource(key) !== undefined) {
source = cmd.getOptionValueSource(key);
}
});
return source;
}
_prepareUserArgs(argv, parseOptions) {
if (argv !== undefined && !Array.isArray(argv)) {
throw new Error("first parameter to parse must be array or undefined");
}
parseOptions = parseOptions || {};
if (argv === undefined && parseOptions.from === undefined) {
if (process2.versions?.electron) {
parseOptions.from = "electron";
}
const execArgv = process2.execArgv ?? [];
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
parseOptions.from = "eval";
}
}
if (argv === undefined) {
argv = process2.argv;
}
this.rawArgs = argv.slice();
let userArgs;
switch (parseOptions.from) {
case undefined:
case "node":
this._scriptPath = argv[1];
userArgs = argv.slice(2);
break;
case "electron":
if (process2.defaultApp) {
this._scriptPath = argv[1];
userArgs = argv.slice(2);
} else {
userArgs = argv.slice(1);
}
break;
case "user":
userArgs = argv.slice(0);
break;
case "eval":
userArgs = argv.slice(1);
break;
default:
throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
}
if (!this._name && this._scriptPath)
this.nameFromFilename(this._scriptPath);
this._name = this._name || "program";
return userArgs;
}
parse(argv, parseOptions) {
this._prepareForParse();
const userArgs = this._prepareUserArgs(argv, parseOptions);
this._parseCommand([], userArgs);
return this;
}
async parseAsync(argv, parseOptions) {
this._prepareForParse();
const userArgs = this._prepareUserArgs(argv, parseOptions);
await this._parseCommand([], userArgs);
return this;
}
_prepareForParse() {
if (this._savedState === null) {
this.saveStateBeforeParse();
} else {
this.restoreStateBeforeParse();
}
}
saveStateBeforeParse() {
this._savedState = {
_name: this._name,
_optionValues: { ...this._optionValues },
_optionValueSources: { ...this._optionValueSources }
};
}
restoreStateBeforeParse() {
if (this._storeOptionsAsProperties)
throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
- either make a new Command for each call to parse, or stop storing options as properties`);
this._name = this._savedState._name;
this._scriptPath = null;
this.rawArgs = [];
this._optionValues = { ...this._savedState._optionValues };
this._optionValueSources = { ...this._savedState._optionValueSources };
this.args = [];
this.processedArgs = [];
}
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
if (fs.existsSync(executableFile))
return;
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
const executableMissing = `'${executableFile}' does not exist
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
- ${executableDirMessage}`;
throw new Error(executableMissing);
}
_executeSubCommand(subcommand, args) {
args = args.slice();
let launchWithNode = false;
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
function findFile(baseDir, baseName) {
const localBin = path.resolve(baseDir, baseName);
if (fs.existsSync(localBin))
return localBin;
if (sourceExt.includes(path.extname(baseName)))
return;
const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
if (foundExt)
return `${localBin}${foundExt}`;
return;
}
this._checkForMissingMandatoryOptions();
this._checkForConflictingOptions();
let executableFile = subcommand._executableFile || `${this._name}-${subcommand._name}`;
let executableDir = this._executableDir || "";
if (this._scriptPath) {
let resolvedScriptPath;
try {
resolvedScriptPath = fs.realpathSync(this._scriptPath);
} catch {
resolvedScriptPath = this._scriptPath;
}
executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
}
if (executableDir) {
let localFile = findFile(executableDir, executableFile);
if (!localFile && !subcommand._executableFile && this._scriptPath) {
const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
if (legacyName !== this._name) {
localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
}
}
executableFile = localFile || executableFile;
}
launchWithNode = sourceExt.includes(path.extname(executableFile));
let proc;
if (process2.platform !== "win32") {
if (launchWithNode) {
args.unshift(executableFile);
args = incrementNodeInspectorPort(process2.execArgv).concat(args);
proc = childProcess.spawn(process2.argv[0], args, { stdio: "inherit" });
} else {
proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
}
} else {
this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
args.unshift(executableFile);
args = incrementNodeInspectorPort(process2.execArgv).concat(args);
proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
}
if (!proc.killed) {
const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
signals.forEach((signal) => {
process2.on(signal, () => {
if (proc.killed === false && proc.exitCode === null) {
proc.kill(signal);
}
});
});
}
const exitCallback = this._exitCallback;
proc.on("close", (code) => {
code = code ?? 1;
if (!exitCallback) {
process2.exit(code);
} else {
exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
}
});
proc.on("error", (err) => {
if (err.code === "ENOENT") {
this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
} else if (err.code === "EACCES") {
throw new Error(`'${executableFile}' not executable`);
}
if (!exitCallback) {
process2.exit(1);
} else {
const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
wrappedError.nestedError = err;
exitCallback(wrappedError);
}
});
this.runningCommand = proc;
}
_dispatchSubcommand(commandName, operands, unknown) {
const subCommand = this._findCommand(commandName);
if (!subCommand)
this.help({ error: true });
subCommand._prepareForParse();
let promiseChain;
promiseChain = this._chainOrCallSubCommandHook(promiseChain, subCommand, "preSubcommand");
promiseChain = this._chainOrCall(promiseChain, () => {
if (subCommand._executableHandler) {
this._executeSubCommand(subCommand, operands.concat(unknown));
} else {
return subCommand._parseCommand(operands, unknown);
}
});
return promiseChain;
}
_dispatchHelpCommand(subcommandName) {
if (!subcommandName) {
this.help();
}
const subCommand = this._findCommand(subcommandName);
if (subCommand && !subCommand._executableHandler) {
subCommand.help();
}
return this._dispatchSubcommand(subcommandName, [], [this._getHelpOption()?.long ?? this._getHelpOption()?.short ?? "--help"]);
}
_checkNumberOfArguments() {
this.registeredArguments.forEach((arg, i) => {
if (arg.required && this.args[i] == null) {
this.missingArgument(arg.name());
}
});
if (this.registeredArguments.length > 0 && this.registeredArguments[this.registeredArguments.length - 1].variadic) {
return;
}
if (this.args.length > this.registeredArguments.length) {
this._excessArguments(this.args);
}
}
_processArguments() {
const myParseArg = (argument, value, previous) => {
let parsedValue = value;
if (value !== null && argument.parseArg) {
const invalidValueMessage = `error: command-argument value '${value}' is invalid for argument '${argument.name()}'.`;
parsedValue = this._callParseArg(argument, value, previous, invalidValueMessage);
}
return parsedValue;
};
this._checkNumberOfArguments();
const processedArgs = [];
this.registeredArguments.forEach((declaredArg, index) => {
let value = declaredArg.defaultValue;
if (declaredArg.variadic) {
if (index < this.args.length) {
value = this.args.slice(index);
if (declaredArg.parseArg) {
value = value.reduce((processed, v) => {
return myParseArg(declaredArg, v, processed);
}, declaredArg.defaultValue);
}
} else if (value === undefined) {
value = [];
}
} else if (index < this.args.length) {
value = this.args[index];
if (declaredArg.parseArg) {
value = myParseArg(declaredArg, value, declaredArg.defaultValue);
}
}
processedArgs[index] = value;
});
this.processedArgs = processedArgs;
}
_chainOrCall(promise, fn) {
if (promise?.then && typeof promise.then === "function") {
return promise.then(() => fn());
}
return fn();
}
_chainOrCallHooks(promise, event) {
let result = promise;
const hooks = [];
this._getCommandAndAncestors().reverse().filter((cmd) => cmd._lifeCycleHooks[event] !== undefined).forEach((hookedCommand) => {
hookedCommand._lifeCycleHooks[event].forEach((callback) => {
hooks.push({ hookedCommand, callback });
});
});
if (event === "postAction") {
hooks.reverse();
}
hooks.forEach((hookDetail) => {
result = this._chainOrCall(result, () => {
return hookDetail.callback(hookDetail.hookedCommand, this);
});
});
return result;
}
_chainOrCallSubCommandHook(promise, subCommand, event) {
let result = promise;
if (this._lifeCycleHooks[event] !== undefined) {
this._lifeCycleHooks[event].forEach((hook) => {
result = this._chainOrCall(result, () => {
return hook(this, subCommand);
});
});
}
return result;
}
_parseCommand(operands, unknown) {
const parsed = this.parseOptions(unknown);
this._parseOptionsEnv();
this._parseOptionsImplied();
operands = operands.concat(parsed.operands);
unknown = parsed.unknown;
this.args = operands.concat(unknown);
if (operands && this._findCommand(operands[0])) {
return this._dispatchSubcommand(operands[0], operands.slice(1), unknown);
}
if (this._getHelpCommand() && operands[0] === this._getHelpCommand().name()) {
return this._dispatchHelpCommand(operands[1]);
}
if (this._defaultCommandName) {
this._outputHelpIfRequested(unknown);
return this._dispatchSubcommand(this._defaultCommandName, operands, unknown);
}
if (this.commands.length && this.args.length === 0 && !this._actionHandler && !this._defaultCommandName) {
this.help({ error: true });
}
this._outputHelpIfRequested(parsed.unknown);
this._checkForMissingMandatoryOptions();
this._checkForConflictingOptions();
const checkForUnknownOptions = () => {
if (parsed.unknown.length > 0) {
this.unknownOption(parsed.unknown[0]);
}
};
const commandEvent = `command:${this.name()}`;
if (this._actionHandler) {
checkForUnknownOptions();
this._processArguments();
let promiseChain;
promiseChain = this._chainOrCallHooks(promiseChain, "preAction");
promiseChain = this._chainOrCall(promiseChain, () => this._actionHandler(this.processedArgs));
if (this.parent) {
promiseChain = this._chainOrCall(promiseChain, () => {
this.parent.emit(commandEvent, operands, unknown);
});
}
promiseChain = this._chainOrCallHooks(promiseChain, "postAction");
return promiseChain;
}
if (this.parent?.listenerCount(commandEvent)) {
checkForUnknownOptions();
this._processArguments();
this.parent.emit(commandEvent, operands, unknown);
} else if (operands.length) {
if (this._findCommand("*")) {
return this._dispatchSubcommand("*", operands, unknown);
}
if (this.listenerCount("command:*")) {
this.emit("command:*", operands, unknown);
} else if (this.commands.length) {
this.unknownCommand();
} else {
checkForUnknownOptions();
this._processArguments();
}
} else if (this.commands.length) {
checkForUnknownOptions();
this.help({ error: true });
} else {
checkForUnknownOptions();
this._processArguments();
}
}
_findCommand(name) {
if (!name)
return;
return this.commands.find((cmd) => cmd._name === name || cmd._aliases.includes(name));
}
_findOption(arg) {
return this.options.find((option) => option.is(arg));
}
_checkForMissingMandatoryOptions() {
this._getCommandAndAncestors().forEach((cmd) => {
cmd.options.forEach((anOption) => {
if (anOption.mandatory && cmd.getOptionValue(anOption.attributeName()) === undefined) {
cmd.missingMandatoryOptionValue(anOption);
}
});
});
}
_checkForConflictingLocalOptions() {
const definedNonDefaultOptions = this.options.filter((option) => {
const optionKey = option.attributeName();
if (this.getOptionValue(optionKey) === undefined) {
return false;
}
return this.getOptionValueSource(optionKey) !== "default";
});
const optionsWithConflicting = definedNonDefaultOptions.filter((option) => option.conflictsWith.length > 0);
optionsWithConflicting.forEach((option) => {
const conflictingAndDefined = definedNonDefaultOptions.find((defined) => option.conflictsWith.includes(defined.attributeName()));
if (conflictingAndDefined) {
this._conflictingOption(option, conflictingAndDefined);
}
});
}
_checkForConflictingOptions() {
this._getCommandAndAncestors().forEach((cmd) => {
cmd._checkForConflictingLocalOptions();
});
}
parseOptions(args) {
const operands = [];
const unknown = [];
let dest = operands;
function maybeOption(arg) {
return arg.length > 1 && arg[0] === "-";
}
const negativeNumberArg = (arg) => {
if (!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(arg))
return false;
return !this._getCommandAndAncestors().some((cmd) => cmd.options.map((opt) => opt.short).some((short) => /^-\d$/.test(short)));
};
let activeVariadicOption = null;
let activeGroup = null;
let i = 0;
while (i < args.length || activeGroup) {
const arg = activeGroup ?? args[i++];
activeGroup = null;
if (arg === "--") {
if (dest === unknown)
dest.push(arg);
dest.push(...args.slice(i));
break;
}
if (activeVariadicOption && (!maybeOption(arg) || negativeNumberArg(arg))) {
this.emit(`option:${activeVariadicOption.name()}`, arg);
continue;
}
activeVariadicOption = null;
if (maybeOption(arg)) {
const option = this._findOption(arg);
if (option) {
if (option.required) {
const value = args[i++];
if (value === undefined)
this.optionMissingArgument(option);
this.emit(`option:${option.name()}`, value);
} else if (option.optional) {
let value = null;
if (i < args.length && (!maybeOption(args[i]) || negativeNumberArg(args[i]))) {
value = args[i++];
}
this.emit(`option:${option.name()}`, value);
} else {
this.emit(`option:${option.name()}`);
}
activeVariadicOption = option.variadic ? option : null;
continue;
}
}
if (arg.length > 2 && arg[0] === "-" && arg[1] !== "-") {
const option = this._findOption(`-${arg[1]}`);
if (option) {
if (option.required || option.optional && this._combineFlagAndOptionalValue) {
this.emit(`option:${option.name()}`, arg.slice(2));
} else {
this.emit(`option:${option.name()}`);
activeGroup = `-${arg.slice(2)}`;
}
continue;
}
}
if (/^--[^=]+=/.test(arg)) {
const index = arg.indexOf("=");
const option = this._findOption(arg.slice(0, index));
if (option && (option.required || option.optional)) {
this.emit(`option:${option.name()}`, arg.slice(index + 1));
continue;
}
}
if (dest === operands && maybeOption(arg) && !(this.commands.length === 0 && negativeNumberArg(arg))) {
dest = unknown;
}
if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown.length === 0) {
if (this._findCommand(arg)) {
operands.push(arg);
unknown.push(...args.slice(i));
break;
} else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
operands.push(arg, ...args.slice(i));
break;
} else if (this._defaultCommandName) {
unknown.push(arg, ...args.slice(i));
break;
}
}
if (this._passThroughOptions) {
dest.push(arg, ...args.slice(i));
break;
}
dest.push(arg);
}
return { operands, unknown };
}
opts() {
if (this._storeOptionsAsProperties) {
const result = {};
const len = this.options.length;
for (let i = 0;i < len; i++) {
const key = this.options[i].attributeName();
result[key] = key === this._versionOptionName ? this._version : this[key];
}
return result;
}
return this._optionValues;
}
optsWithGlobals() {
return this._getCommandAndAncestors().reduce((combinedOptions, cmd) => Object.assign(combinedOptions, cmd.opts()), {});
}
error(message, errorOptions) {
this._outputConfiguration.outputError(`${message}
`, this._outputConfiguration.writeErr);
if (typeof this._showHelpAfterError === "string") {
this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`);
} else if (this._showHelpAfterError) {
this._outputConfiguration.writeErr(`
`);
this.outputHelp({ error: true });
}
const config = errorOptions || {};
const exitCode = config.exitCode || 1;
const code = config.code || "commander.error";
this._exit(exitCode, code, message);
}
_parseOptionsEnv() {
this.options.forEach((option) => {
if (option.envVar && option.envVar in process2.env) {
const optionKey = option.attributeName();
if (this.getOptionValue(optionKey) === undefined || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
if (option.required || option.optional) {
this.emit(`optionEnv:${option.name()}`, process2.env[option.envVar]);
} else {
this.emit(`optionEnv:${option.name()}`);
}
}
}
});
}
_parseOptionsImplied() {
const dualHelper = new DualOptions(this.options);
const hasCustomOptionValue = (optionKey) => {
return this.getOptionValue(optionKey) !== undefined && !["default", "implied"].includes(this.getOptionValueSource(optionKey));
};
this.options.filter((option) => option.implied !== undefined && hasCustomOptionValue(option.attributeName()) && dualHelper.valueFromOption(this.getOptionValue(option.attributeName()), option)).forEach((option) => {
Object.keys(option.implied).filter((impliedKey) => !hasCustomOptionValue(impliedKey)).forEach((impliedKey) => {
this.setOptionValueWithSource(impliedKey, option.implied[impliedKey], "implied");
});
});
}
missingArgument(name) {
const message = `error: missing required argument '${name}'`;
this.error(message, { code: "commander.missingArgument" });
}
optionMissingArgument(option) {
const message = `error: option '${option.flags}' argument missing`;
this.error(message, { code: "commander.optionMissingArgument" });
}
missingMandatoryOptionValue(option) {
const message = `error: required option '${option.flags}' not specified`;
this.error(message, { code: "commander.missingMandatoryOptionValue" });
}
_conflictingOption(option, conflictingOption) {
const findBestOptionFromValue = (option2) => {
const optionKey = option2.attributeName();
const optionValue = this.getOptionValue(optionKey);
const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
return negativeOption;
}
return positiveOption || option2;
};
const getErrorMessage = (option2) => {
const bestOption = findBestOptionFromValue(option2);
const optionKey = bestOption.attributeName();
const source = this.getOptionValueSource(optionKey);
if (source === "env") {
return `environment variable '${bestOption.envVar}'`;
}
return `option '${bestOption.flags}'`;
};
const message = `error: ${getErrorMessage(option)} cannot be used with ${getErrorMessage(conflictingOption)}`;
this.error(message, { code: "commander.conflictingOption" });
}
unknownOption(flag) {
if (this._allowUnknownOption)
return;
let suggestion = "";
if (flag.startsWith("--") && this._showSuggestionAfterError) {
let candidateFlags = [];
let command = this;
do {
const moreFlags = command.createHelp().visibleOptions(command).filter((option) => option.long).map((option) => option.long);
candidateFlags = candidateFlags.concat(moreFlags);
command = command.parent;
} while (command && !command._enablePositionalOptions);
suggestion = suggestSimilar(flag, candidateFlags);
}
const message = `error: unknown option '${flag}'${suggestion}`;
this.error(message, { code: "commander.unknownOption" });
}
_excessArguments(receivedArgs) {
if (this._allowExcessArguments)
return;
const expected = this.registeredArguments.length;
const s = expected === 1 ? "" : "s";
const forSubcommand = this.parent ? ` for '${this.name()}'` : "";
const message = `error: too many arguments${forSubcommand}. Expected ${expected} argument${s} but got ${receivedArgs.length}.`;
this.error(message, { code: "commander.excessArguments" });
}
unknownCommand() {
const unknownName = this.args[0];
let suggestion = "";
if (this._showSuggestionAfterError) {
const candidateNames = [];
this.createHelp().visibleCommands(this).forEach((command) => {
candidateNames.push(command.name());
if (command.alias())
candidateNames.push(command.alias());
});
suggestion = suggestSimilar(unknownName, candidateNames);
}
const message = `error: unknown command '${unknownName}'${suggestion}`;
this.error(message, { code: "commander.unknownCommand" });
}
version(str, flags, description) {
if (str === undefined)
return this._version;
this._version = str;
flags = flags || "-V, --version";
description = description || "output the version number";
const versionOption = this.createOption(flags, description);
this._versionOptionName = versionOption.attributeName();
this._registerOption(versionOption);
this.on("option:" + versionOption.name(), () => {
this._outputConfiguration.writeOut(`${str}
`);
this._exit(0, "commander.version", str);
});
return this;
}
description(str, argsDescription) {
if (str === undefined && argsDescription === undefined)
return this._description;
this._description = str;
if (argsDescription) {
this._argsDescription = argsDescription;
}
return this;
}
summary(str) {
if (str === undefined)
return this._summary;
this._summary = str;
return this;
}
alias(alias) {
if (alias === undefined)
return this._aliases[0];
let command = this;
if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
command = this.commands[this.commands.length - 1];
}
if (alias === command._name)
throw new Error("Command alias can't be the same as its name");
const matchingCommand = this.parent?._findCommand(alias);
if (matchingCommand) {
const existingCmd = [matchingCommand.name()].concat(matchingCommand.aliases()).join("|");
throw new Error(`cannot add alias '${alias}' to command '${this.name()}' as already have command '${existingCmd}'`);
}
command._aliases.push(alias);
return this;
}
aliases(aliases) {
if (aliases === undefined)
return this._aliases;
aliases.forEach((alias) => this.alias(alias));
return this;
}
usage(str) {
if (str === undefined) {
if (this._usage)
return this._usage;
const args = this.registeredArguments.map((arg) => {
return humanReadableArgName(arg);
});
return [].concat(this.options.length || this._helpOption !== null ? "[options]" : [], this.commands.length ? "[command]" : [], this.registeredArguments.length ? args : []).join(" ");
}
this._usage = str;
return this;
}
name(str) {
if (str === undefined)
return this._name;
this._name = str;
return this;
}
helpGroup(heading) {
if (heading === undefined)
return this._helpGroupHeading ?? "";
this._helpGroupHeading = heading;
return this;
}
commandsGroup(heading) {
if (heading === undefined)
return this._defaultCommandGroup ?? "";
this._defaultCommandGroup = heading;
return this;
}
optionsGroup(heading) {
if (heading === undefined)
return this._defaultOptionGroup ?? "";
this._defaultOptionGroup = heading;
return this;
}
_initOptionGroup(option) {
if (this._defaultOptionGroup && !option.helpGroupHeading)
option.helpGroup(this._defaultOptionGroup);
}
_initCommandGroup(cmd) {
if (this._defaultCommandGroup && !cmd.helpGroup())
cmd.helpGroup(this._defaultCommandGroup);
}
nameFromFilename(filename) {
this._name = path.basename(filename, path.extname(filename));
return this;
}
executableDir(path2) {
if (path2 === undefined)
return this._executableDir;
this._executableDir = path2;
return this;
}
helpInformation(contextOptions) {
const helper = this.createHelp();
const context = this._getOutputContext(contextOptions);
helper.prepareContext({
error: context.error,
helpWidth: context.helpWidth,
outputHasColors: context.hasColors
});
const text = helper.formatHelp(this, helper);
if (context.hasColors)
return text;
return this._outputConfiguration.stripColor(text);
}
_getOutputContext(contextOptions) {
contextOptions = contextOptions || {};
const error = !!contextOptions.error;
let baseWrite;
let hasColors;
let helpWidth;
if (error) {
baseWrite = (str) => this._outputConfiguration.writeErr(str);
hasColors = this._outputConfiguration.getErrHasColors();
helpWidth = this._outputConfiguration.getErrHelpWidth();
} else {
baseWrite = (str) => this._outputConfiguration.writeOut(str);
hasColors = this._outputConfiguration.getOutHasColors();
helpWidth = this._outputConfiguration.getOutHelpWidth();
}
const write = (str) => {
if (!hasColors)
str = this._outputConfiguration.stripColor(str);
return baseWrite(str);
};
return { error, write, hasColors, helpWidth };
}
outputHelp(contextOptions) {
let deprecatedCallback;
if (typeof contextOptions === "function") {
deprecatedCallback = contextOptions;
contextOptions = undefined;
}
const outputContext = this._getOutputContext(contextOptions);
const eventContext = {
error: outputContext.error,
write: outputContext.write,
command: this
};
this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", eventContext));
this.emit("beforeHelp", eventContext);
let helpInformation = this.helpInformation({ error: outputContext.error });
if (deprecatedCallback) {
helpInformation = deprecatedCallback(helpInformation);
if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
throw new Error("outputHelp callback must return a string or a Buffer");
}
}
outputContext.write(helpInformation);
if (this._getHelpOption()?.long) {
this.emit(this._getHelpOption().long);
}
this.emit("afterHelp", eventContext);
this._getCommandAndAncestors().forEach((command) => command.emit("afterAllHelp", eventContext));
}
helpOption(flags, description) {
if (typeof flags === "boolean") {
if (flags) {
if (this._helpOption === null)
this._helpOption = undefined;
if (this._defaultOptionGroup) {
this._initOptionGroup(this._getHelpOption());
}
} else {
this._helpOption = null;
}
return this;
}
this._helpOption = this.createOption(flags ?? "-h, --help", description ?? "display help for command");
if (flags || description)
this._initOptionGroup(this._helpOption);
return this;
}
_getHelpOption() {
if (this._helpOption === undefined) {
this.helpOption(undefined, undefined);
}
return this._helpOption;
}
addHelpOption(option) {
this._helpOption = option;
this._initOptionGroup(option);
return this;
}
help(contextOptions) {
this.outputHelp(contextOptions);
let exitCode = Number(process2.exitCode ?? 0);
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
exitCode = 1;
}
this._exit(exitCode, "commander.help", "(outputHelp)");
}
addHelpText(position, text) {
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
if (!allowedValues.includes(position)) {
throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${allowedValues.join("', '")}'`);
}
const helpEvent = `${position}Help`;
this.on(helpEvent, (context) => {
let helpStr;
if (typeof text === "function") {
helpStr = text({ error: context.error, command: context.command });
} else {
helpStr = text;
}
if (helpStr) {
context.write(`${helpStr}
`);
}
});
return this;
}
_outputHelpIfRequested(args) {
const helpOption = this._getHelpOption();
const helpRequested = helpOption && args.find((arg) => helpOption.is(arg));
if (helpRequested) {
this.outputHelp();
this._exit(0, "commander.helpDisplayed", "(outputHelp)");
}
}
}
function incrementNodeInspectorPort(args) {
return args.map((arg) => {
if (!arg.startsWith("--inspect")) {
return arg;
}
let debugOption;
let debugHost = "127.0.0.1";
let debugPort = "9229";
let match;
if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
debugOption = match[1];
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
debugOption = match[1];
if (/^\d+$/.test(match[3])) {
debugPort = match[3];
} else {
debugHost = match[3];
}
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
debugOption = match[1];
debugHost = match[3];
debugPort = match[4];
}
if (debugOption && debugPort !== "0") {
return `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
}
return arg;
});
}
function useColor() {
if (process2.env.NO_COLOR || process2.env.FORCE_COLOR === "0" || process2.env.FORCE_COLOR === "false")
return false;
if (process2.env.FORCE_COLOR || process2.env.CLICOLOR_FORCE !== undefined)
return true;
return;
}
exports.Command = Command;
exports.useColor = useColor;
});
// node_modules/commander/index.js
var require_commander = __commonJS((exports) => {
var { Argument } = require_argument();
var { Command } = require_command();
var { CommanderError, InvalidArgumentError } = require_error();
var { Help } = require_help();
var { Option } = require_option();
exports.program = new Command;
exports.createCommand = (name) => new Command(name);
exports.createOption = (flags, description) => new Option(flags, description);
exports.createArgument = (name, description) => new Argument(name, description);
exports.Command = Command;
exports.Option = Option;
exports.Argument = Argument;
exports.Help = Help;
exports.CommanderError = CommanderError;
exports.InvalidArgumentError = InvalidArgumentError;
exports.InvalidOptionArgumentError = InvalidArgumentError;
});
// node_modules/picocolors/picocolors.js
var require_picocolors = __commonJS((exports, module) => {
var p = process || {};
var argv = p.argv || [];
var env = p.env || {};
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
var formatter = (open, close, replace = open) => (input) => {
let string = "" + input, index = string.indexOf(close, open.length);
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
};
var replaceClose = (string, close, replace, index) => {
let result = "", cursor = 0;
do {
result += string.substring(cursor, index) + replace;
cursor = index + close.length;
index = string.indexOf(close, cursor);
} while (~index);
return result + string.substring(cursor);
};
var createColors = (enabled = isColorSupported) => {
let f = enabled ? formatter : () => String;
return {
isColorSupported: enabled,
reset: f("\x1B[0m", "\x1B[0m"),
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
italic: f("\x1B[3m", "\x1B[23m"),
underline: f("\x1B[4m", "\x1B[24m"),
inverse: f("\x1B[7m", "\x1B[27m"),
hidden: f("\x1B[8m", "\x1B[28m"),
strikethrough: f("\x1B[9m", "\x1B[29m"),
black: f("\x1B[30m", "\x1B[39m"),
red: f("\x1B[31m", "\x1B[39m"),
green: f("\x1B[32m", "\x1B[39m"),
yellow: f("\x1B[33m", "\x1B[39m"),
blue: f("\x1B[34m", "\x1B[39m"),
magenta: f("\x1B[35m", "\x1B[39m"),
cyan: f("\x1B[36m", "\x1B[39m"),
white: f("\x1B[37m", "\x1B[39m"),
gray: f("\x1B[90m", "\x1B[39m"),
bgBlack: f("\x1B[40m", "\x1B[49m"),
bgRed: f("\x1B[41m", "\x1B[49m"),
bgGreen: f("\x1B[42m", "\x1B[49m"),
bgYellow: f("\x1B[43m", "\x1B[49m"),
bgBlue: f("\x1B[44m", "\x1B[49m"),
bgMagenta: f("\x1B[45m", "\x1B[49m"),
bgCyan: f("\x1B[46m", "\x1B[49m"),
bgWhite: f("\x1B[47m", "\x1B[49m"),
blackBright: f("\x1B[90m", "\x1B[39m"),
redBright: f("\x1B[91m", "\x1B[39m"),
greenBright: f("\x1B[92m", "\x1B[39m"),
yellowBright: f("\x1B[93m", "\x1B[39m"),
blueBright: f("\x1B[94m", "\x1B[39m"),
magentaBright: f("\x1B[95m", "\x1B[39m"),
cyanBright: f("\x1B[96m", "\x1B[39m"),
whiteBright: f("\x1B[97m", "\x1B[39m"),
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
bgRedBright: f("\x1B[101m", "\x1B[49m"),
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
};
};
module.exports = createColors();
module.exports.createColors = createColors;
});
// node_modules/js-yaml/dist/js-yaml.mjs
function isNothing(subject) {
return typeof subject === "undefined" || subject === null;
}
function isObject(subject) {
return typeof subject === "object" && subject !== null;
}
function toArray(sequence) {
if (Array.isArray(sequence))
return sequence;
else if (isNothing(sequence))
return [];
return [sequence];
}
function extend(target, source) {
var index, length, key, sourceKeys;
if (source) {
sourceKeys = Object.keys(source);
for (index = 0, length = sourceKeys.length;index < length; index += 1) {
key = sourceKeys[index];
target[key] = source[key];
}
}
return target;
}
function repeat(string, count) {
var result = "", cycle;
for (cycle = 0;cycle < count; cycle += 1) {
result += string;
}
return result;
}
function isNegativeZero(number) {
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
}
function formatError(exception, compact) {
var where = "", message = exception.reason || "(unknown reason)";
if (!exception.mark)
return message;
if (exception.mark.name) {
where += 'in "' + exception.mark.name + '" ';
}
where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
if (!compact && exception.mark.snippet) {
where += `
` + exception.mark.snippet;
}
return message + " " + where;
}
function YAMLException$1(reason, mark) {
Error.call(this);
this.name = "YAMLException";
this.reason = reason;
this.mark = mark;
this.message = formatError(this, false);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error().stack || "";
}
}
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
var head = "";
var tail = "";
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
if (position - lineStart > maxHalfLength) {
head = " ... ";
lineStart = position - maxHalfLength + head.length;
}
if (lineEnd - position > maxHalfLength) {
tail = " ...";
lineEnd = position + maxHalfLength - tail.length;
}
return {
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
pos: position - lineStart + head.length
};
}
function padStart(string, max) {
return common.repeat(" ", max - string.length) + string;
}
function makeSnippet(mark, options) {
options = Object.create(options || null);
if (!mark.buffer)
return null;
if (!options.maxLength)
options.maxLength = 79;
if (typeof options.indent !== "number")
options.indent = 1;
if (typeof options.linesBefore !== "number")
options.linesBefore = 3;
if (typeof options.linesAfter !== "number")
options.linesAfter = 2;
var re = /\r?\n|\r|\0/g;
var lineStarts = [0];
var lineEnds = [];
var match;
var foundLineNo = -1;
while (match = re.exec(mark.buffer)) {
lineEnds.push(match.index);
lineStarts.push(match.index + match[0].length);
if (mark.position <= match.index && foundLineNo < 0) {
foundLineNo = lineStarts.length - 2;
}
}
if (foundLineNo < 0)
foundLineNo = lineStarts.length - 1;
var result = "", i, line;
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
for (i = 1;i <= options.linesBefore; i++) {
if (foundLineNo - i < 0)
break;
line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + `
` + result;
}
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + `
`;
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^" + `
`;
for (i = 1;i <= options.linesAfter; i++) {
if (foundLineNo + i >= lineEnds.length)
break;
line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + `
`;
}
return result.replace(/\n$/, "");
}
function compileStyleAliases(map) {
var result = {};
if (map !== null) {
Object.keys(map).forEach(function(style) {
map[style].forEach(function(alias) {
result[String(alias)] = style;
});
});
}
return result;
}
function Type$1(tag, options) {
options = options || {};
Object.keys(options).forEach(function(name) {
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
}
});
this.options = options;
this.tag = tag;
this.kind = options["kind"] || null;
this.resolve = options["resolve"] || function() {
return true;
};
this.construct = options["construct"] || function(data) {
return data;
};
this.instanceOf = options["instanceOf"] || null;
this.predicate = options["predicate"] || null;
this.represent = options["represent"] || null;
this.representName = options["representName"] || null;
this.defaultStyle = options["defaultStyle"] || null;
this.multi = options["multi"] || false;
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
}
}
function compileList(schema, name) {
var result = [];
schema[name].forEach(function(currentType) {
var newIndex = result.length;
result.forEach(function(previousType, previousIndex) {
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
newIndex = previousIndex;
}
});
result[newIndex] = currentType;
});
return result;
}
function compileMap() {
var result = {
scalar: {},
sequence: {},
mapping: {},
fallback: {},
multi: {
scalar: [],
sequence: [],
mapping: [],
fallback: []
}
}, index, length;
function collectType(type2) {
if (type2.multi) {
result.multi[type2.kind].push(type2);
result.multi["fallback"].push(type2);
} else {
result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
}
}
for (index = 0, length = arguments.length;index < length; index += 1) {
arguments[index].forEach(collectType);
}
return result;
}
function Schema$1(definition) {
return this.extend(definition);
}
function resolveYamlNull(data) {
if (data === null)
return true;
var max = data.length;
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
}
function constructYamlNull() {
return null;
}
function isNull(object) {
return object === null;
}
function resolveYamlBoolean(data) {
if (data === null)
return false;
var max = data.length;
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
}
function constructYamlBoolean(data) {
return data === "true" || data === "True" || data === "TRUE";
}
function isBoolean(object) {
return Object.prototype.toString.call(object) === "[object Boolean]";
}
function isHexCode(c) {
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
}
function isOctCode(c) {
return 48 <= c && c <= 55;
}
function isDecCode(c) {
return 48 <= c && c <= 57;
}
function resolveYamlInteger(data) {
if (data === null)
return false;
var max = data.length, index = 0, hasDigits = false, ch;
if (!max)
return false;
ch = data[index];
if (ch === "-" || ch === "+") {
ch = data[++index];
}
if (ch === "0") {
if (index + 1 === max)
return true;
ch = data[++index];
if (ch === "b") {
index++;
for (;index < max; index++) {
ch = data[index];
if (ch === "_")
continue;
if (ch !== "0" && ch !== "1")
return false;
hasDigits = true;
}
return hasDigits && ch !== "_";
}
if (ch === "x") {
index++;
for (;index < max; index++) {
ch = data[index];
if (ch === "_")
continue;
if (!isHexCode(data.charCodeAt(index)))
return false;
hasDigits = true;
}
return hasDigits && ch !== "_";
}
if (ch === "o") {
index++;
for (;index < max; index++) {
ch = data[index];
if (ch === "_")
continue;
if (!isOctCode(data.charCodeAt(index)))
return false;
hasDigits = true;
}
return hasDigits && ch !== "_";
}
}
if (ch === "_")
return false;
for (;index < max; index++) {
ch = data[index];
if (ch === "_")
continue;
if (!isDecCode(data.charCodeAt(index))) {
return false;
}
hasDigits = true;
}
if (!hasDigits || ch === "_")
return false;
return true;
}
function constructYamlInteger(data) {
var value = data, sign = 1, ch;
if (value.indexOf("_") !== -1) {
value = value.replace(/_/g, "");
}
ch = value[0];
if (ch === "-" || ch === "+") {
if (ch === "-")
sign = -1;
value = value.slice(1);
ch = value[0];
}
if (value === "0")
return 0;
if (ch === "0") {
if (value[1] === "b")
return sign * parseInt(value.slice(2), 2);
if (value[1] === "x")
return sign * parseInt(value.slice(2), 16);
if (value[1] === "o")
return sign * parseInt(value.slice(2), 8);
}
return sign * parseInt(value, 10);
}
function isInteger(object) {
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
}
function resolveYamlFloat(data) {
if (data === null)
return false;
if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") {
return false;
}
return true;
}
function constructYamlFloat(data) {
var value, sign;
value = data.replace(/_/g, "").toLowerCase();
sign = value[0] === "-" ? -1 : 1;
if ("+-".indexOf(value[0]) >= 0) {
value = value.slice(1);
}
if (value === ".inf") {
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
} else if (value === ".nan") {
return NaN;
}
return sign * parseFloat(value, 10);
}
function representYamlFloat(object, style) {
var res;
if (isNaN(object)) {
switch (style) {
case "lowercase":
return ".nan";
case "uppercase":
return ".NAN";
case "camelcase":
return ".NaN";
}
} else if (Number.POSITIVE_INFINITY === object) {
switch (style) {
case "lowercase":
return ".inf";
case "uppercase":
return ".INF";
case "camelcase":
return ".Inf";
}
} else if (Number.NEGATIVE_INFINITY === object) {
switch (style) {
case "lowercase":
return "-.inf";
case "uppercase":
return "-.INF";
case "camelcase":
return "-.Inf";
}
} else if (common.isNegativeZero(object)) {
return "-0.0";
}
res = object.toString(10);
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
}
function isFloat(object) {
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
}
function resolveYamlTimestamp(data) {
if (data === null)
return false;
if (YAML_DATE_REGEXP.exec(data) !== null)
return true;
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
return true;
return false;
}
function constructYamlTimestamp(data) {
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
match = YAML_DATE_REGEXP.exec(data);
if (match === null)
match = YAML_TIMESTAMP_REGEXP.exec(data);
if (match === null)
throw new Error("Date resolve error");
year = +match[1];
month = +match[2] - 1;
day = +match[3];
if (!match[4]) {
return new Date(Date.UTC(year, month, day));
}
hour = +match[4];
minute = +match[5];
second = +match[6];
if (match[7]) {
fraction = match[7].slice(0, 3);
while (fraction.length < 3) {
fraction += "0";
}
fraction = +fraction;
}
if (match[9]) {
tz_hour = +match[10];
tz_minute = +(match[11] || 0);
delta = (tz_hour * 60 + tz_minute) * 60000;
if (match[9] === "-")
delta = -delta;
}
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
if (delta)
date.setTime(date.getTime() - delta);
return date;
}
function representYamlTimestamp(object) {
return object.toISOString();
}
function resolveYamlMerge(data) {
return data === "<<" || data === null;
}
function resolveYamlBinary(data) {
if (data === null)
return false;
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
for (idx = 0;idx < max; idx++) {
code = map2.indexOf(data.charAt(idx));
if (code > 64)
continue;
if (code < 0)
return false;
bitlen += 6;
}
return bitlen % 8 === 0;
}
function constructYamlBinary(data) {
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
for (idx = 0;idx < max; idx++) {
if (idx % 4 === 0 && idx) {
result.push(bits >> 16 & 255);
result.push(bits >> 8 & 255);
result.push(bits & 255);
}
bits = bits << 6 | map2.indexOf(input.charAt(idx));
}
tailbits = max % 4 * 6;
if (tailbits === 0) {
result.push(bits >> 16 & 255);
result.push(bits >> 8 & 255);
result.push(bits & 255);
} else if (tailbits === 18) {
result.push(bits >> 10 & 255);
result.push(bits >> 2 & 255);
} else if (tailbits === 12) {
result.push(bits >> 4 & 255);
}
return new Uint8Array(result);
}
function representYamlBinary(object) {
var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
for (idx = 0;idx < max; idx++) {
if (idx % 3 === 0 && idx) {
result += map2[bits >> 18 & 63];
result += map2[bits >> 12 & 63];
result += map2[bits >> 6 & 63];
result += map2[bits & 63];
}
bits = (bits << 8) + object[idx];
}
tail = max % 3;
if (tail === 0) {
result += map2[bits >> 18 & 63];
result += map2[bits >> 12 & 63];
result += map2[bits >> 6 & 63];
result += map2[bits & 63];
} else if (tail === 2) {
result += map2[bits >> 10 & 63];
result += map2[bits >> 4 & 63];
result += map2[bits << 2 & 63];
result += map2[64];
} else if (tail === 1) {
result += map2[bits >> 2 & 63];
result += map2[bits << 4 & 63];
result += map2[64];
result += map2[64];
}
return result;
}
function isBinary(obj) {
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
}
function resolveYamlOmap(data) {
if (data === null)
return true;
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
for (index = 0, length = object.length;index < length; index += 1) {
pair = object[index];
pairHasKey = false;
if (_toString$2.call(pair) !== "[object Object]")
return false;
for (pairKey in pair) {
if (_hasOwnProperty$3.call(pair, pairKey)) {
if (!pairHasKey)
pairHasKey = true;
else
return false;
}
}
if (!pairHasKey)
return false;
if (objectKeys.indexOf(pairKey) === -1)
objectKeys.push(pairKey);
else
return false;
}
return true;
}
function constructYamlOmap(data) {
return data !== null ? data : [];
}
function resolveYamlPairs(data) {
if (data === null)
return true;
var index, length, pair, keys, result, object = data;
result = new Array(object.length);
for (index = 0, length = object.length;index < length; index += 1) {
pair = object[index];
if (_toString$1.call(pair) !== "[object Object]")
return false;
keys = Object.keys(pair);
if (keys.length !== 1)
return false;
result[index] = [keys[0], pair[keys[0]]];
}
return true;
}
function constructYamlPairs(data) {
if (data === null)
return [];
var index, length, pair, keys, result, object = data;
result = new Array(object.length);
for (index = 0, length = object.length;index < length; index += 1) {
pair = object[index];
keys = Object.keys(pair);
result[index] = [keys[0], pair[keys[0]]];
}
return result;
}
function resolveYamlSet(data) {
if (data === null)
return true;
var key, object = data;
for (key in object) {
if (_hasOwnProperty$2.call(object, key)) {
if (object[key] !== null)
return false;
}
}
return true;
}
function constructYamlSet(data) {
return data !== null ? data : {};
}
function _class(obj) {
return Object.prototype.toString.call(obj);
}
function is_EOL(c) {
return c === 10 || c === 13;
}
function is_WHITE_SPACE(c) {
return c === 9 || c === 32;
}
function is_WS_OR_EOL(c) {
return c === 9 || c === 32 || c === 10 || c === 13;
}
function is_FLOW_INDICATOR(c) {
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
}
function fromHexCode(c) {
var lc;
if (48 <= c && c <= 57) {
return c - 48;
}
lc = c | 32;
if (97 <= lc && lc <= 102) {
return lc - 97 + 10;
}
return -1;
}
function escapedHexLen(c) {
if (c === 120) {
return 2;
}
if (c === 117) {
return 4;
}
if (c === 85) {
return 8;
}
return 0;
}
function fromDecimalCode(c) {
if (48 <= c && c <= 57) {
return c - 48;
}
return -1;
}
function simpleEscapeSequence(c) {
return c === 48 ? "\x00" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "\t" : c === 9 ? "\t" : c === 110 ? `
` : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
}
function charFromCodepoint(c) {
if (c <= 65535) {
return String.fromCharCode(c);
}
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
}
function setProperty(object, key, value) {
if (key === "__proto__") {
Object.defineProperty(object, key, {
configurable: true,
enumerable: true,
writable: true,
value
});
} else {
object[key] = value;
}
}
function State$1(input, options) {
this.input = input;
this.filename = options["filename"] || null;
this.schema = options["schema"] || _default;
this.onWarning = options["onWarning"] || null;
this.legacy = options["legacy"] || false;
this.json = options["json"] || false;
this.listener = options["listener"] || null;
this.implicitTypes = this.schema.compiledImplicit;
this.typeMap = this.schema.compiledTypeMap;
this.length = input.length;
this.position = 0;
this.line = 0;
this.lineStart = 0;
this.lineIndent = 0;
this.firstTabInLine = -1;
this.documents = [];
}
function generateError(state, message) {
var mark = {
name: state.filename,
buffer: state.input.slice(0, -1),
position: state.position,
line: state.line,
column: state.position - state.lineStart
};
mark.snippet = snippet(mark);
return new exception(message, mark);
}
function throwError(state, message) {
throw generateError(state, message);
}
function throwWarning(state, message) {
if (state.onWarning) {
state.onWarning.call(null, generateError(state, message));
}
}
function captureSegment(state, start, end, checkJson) {
var _position, _length, _character, _result;
if (start < end) {
_result = state.input.slice(start, end);
if (checkJson) {
for (_position = 0, _length = _result.length;_position < _length; _position += 1) {
_character = _result.charCodeAt(_position);
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
throwError(state, "expected valid JSON character");
}
}
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
throwError(state, "the stream contains non-printable characters");
}
state.result += _result;
}
}
function mergeMappings(state, destination, source, overridableKeys) {
var sourceKeys, key, index, quantity;
if (!common.isObject(source)) {
throwError(state, "cannot merge mappings; the provided source object is unacceptable");
}
sourceKeys = Object.keys(source);
for (index = 0, quantity = sourceKeys.length;index < quantity; index += 1) {
key = sourceKeys[index];
if (!_hasOwnProperty$1.call(destination, key)) {
setProperty(destination, key, source[key]);
overridableKeys[key] = true;
}
}
}
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
var index, quantity;
if (Array.isArray(keyNode)) {
keyNode = Array.prototype.slice.call(keyNode);
for (index = 0, quantity = keyNode.length;index < quantity; index += 1) {
if (Array.isArray(keyNode[index])) {
throwError(state, "nested arrays are not supported inside keys");
}
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
keyNode[index] = "[object Object]";
}
}
}
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
keyNode = "[object Object]";
}
keyNode = String(keyNode);
if (_result === null) {
_result = {};
}
if (keyTag === "tag:yaml.org,2002:merge") {
if (Array.isArray(valueNode)) {
for (index = 0, quantity = valueNode.length;index < quantity; index += 1) {
mergeMappings(state, _result, valueNode[index], overridableKeys);
}
} else {
mergeMappings(state, _result, valueNode, overridableKeys);
}
} else {
if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
state.line = startLine || state.line;
state.lineStart = startLineStart || state.lineStart;
state.position = startPos || state.position;
throwError(state, "duplicated mapping key");
}
setProperty(_result, keyNode, valueNode);
delete overridableKeys[keyNode];
}
return _result;
}
function readLineBreak(state) {
var ch;
ch = state.input.charCodeAt(state.position);
if (ch === 10) {
state.position++;
} else if (ch === 13) {
state.position++;
if (state.input.charCodeAt(state.position) === 10) {
state.position++;
}
} else {
throwError(state, "a line break is expected");
}
state.line += 1;
state.lineStart = state.position;
state.firstTabInLine = -1;
}
function skipSeparationSpace(state, allowComments, checkIndent) {
var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
while (ch !== 0) {
while (is_WHITE_SPACE(ch)) {
if (ch === 9 && state.firstTabInLine === -1) {
state.firstTabInLine = state.position;
}
ch = state.input.charCodeAt(++state.position);
}
if (allowComments && ch === 35) {
do {
ch = state.input.charCodeAt(++state.position);
} while (ch !== 10 && ch !== 13 && ch !== 0);
}
if (is_EOL(ch)) {
readLineBreak(state);
ch = state.input.charCodeAt(state.position);
lineBreaks++;
state.lineIndent = 0;
while (ch === 32) {
state.lineIndent++;
ch = state.input.charCodeAt(++state.position);
}
} else {
break;
}
}
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
throwWarning(state, "deficient indentation");
}
return lineBreaks;
}
function testDocumentSeparator(state) {
var _position = state.position, ch;
ch = state.input.charCodeAt(_position);
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
_position += 3;
ch = state.input.charCodeAt(_position);
if (ch === 0 || is_WS_OR_EOL(ch)) {
return true;
}
}
return false;
}
function writeFoldedLines(state, count) {
if (count === 1) {
state.result += " ";
} else if (count > 1) {
state.result += common.repeat(`
`, count - 1);
}
}
function readPlainScalar(state, nodeIndent, withinFlowCollection) {
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
ch = state.input.charCodeAt(state.position);
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
return false;
}
if (ch === 63 || ch === 45) {
following = state.input.charCodeAt(state.position + 1);
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
return false;
}
}
state.kind = "scalar";
state.result = "";
captureStart = captureEnd = state.position;
hasPendingContent = false;
while (ch !== 0) {
if (ch === 58) {
following = state.input.charCodeAt(state.position + 1);
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
break;
}
} else if (ch === 35) {
preceding = state.input.charCodeAt(state.position - 1);
if (is_WS_OR_EOL(preceding)) {
break;
}
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
break;
} else if (is_EOL(ch)) {
_line = state.line;
_lineStart = state.lineStart;
_lineIndent = state.lineIndent;
skipSeparationSpace(state, false, -1);
if (state.lineIndent >= nodeIndent) {
hasPendingContent = true;
ch = state.input.charCodeAt(state.position);
continue;
} else {
state.position = captureEnd;
state.line = _line;
state.lineStart = _lineStart;
state.lineIndent = _lineIndent;
break;
}
}
if (hasPendingContent) {
captureSegment(state, captureStart, captureEnd, false);
writeFoldedLines(state, state.line - _line);
captureStart = captureEnd = state.position;
hasPendingContent = false;
}
if (!is_WHITE_SPACE(ch)) {
captureEnd = state.position + 1;
}
ch = state.input.charCodeAt(++state.position);
}
captureSegment(state, captureStart, captureEnd, false);
if (state.result) {
return true;
}
state.kind = _kind;
state.result = _result;
return false;
}
function readSingleQuotedScalar(state, nodeIndent) {
var ch, captureStart, captureEnd;
ch = state.input.charCodeAt(state.position);
if (ch !== 39) {
return false;
}
state.kind = "scalar";
state.result = "";
state.position++;
captureStart = captureEnd = state.position;
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
if (ch === 39) {
captureSegment(state, captureStart, state.position, true);
ch = state.input.charCodeAt(++state.position);
if (ch === 39) {
captureStart = state.position;
state.position++;
captureEnd = state.position;
} else {
return true;
}
} else if (is_EOL(ch)) {
captureSegment(state, captureStart, captureEnd, true);
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
captureStart = captureEnd = state.position;
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
throwError(state, "unexpected end of the document within a single quoted scalar");
} else {
state.position++;
captureEnd = state.position;
}
}
throwError(state, "unexpected end of the stream within a single quoted scalar");
}
function readDoubleQuotedScalar(state, nodeIndent) {
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
ch = state.input.charCodeAt(state.position);
if (ch !== 34) {
return false;
}
state.kind = "scalar";
state.result = "";
state.position++;
captureStart = captureEnd = state.position;
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
if (ch === 34) {
captureSegment(state, captureStart, state.position, true);
state.position++;
return true;
} else if (ch === 92) {
captureSegment(state, captureStart, state.position, true);
ch = state.input.charCodeAt(++state.position);
if (is_EOL(ch)) {
skipSeparationSpace(state, false, nodeIndent);
} else if (ch < 256 && simpleEscapeCheck[ch]) {
state.result += simpleEscapeMap[ch];
state.position++;
} else if ((tmp = escapedHexLen(ch)) > 0) {
hexLength = tmp;
hexResult = 0;
for (;hexLength > 0; hexLength--) {
ch = state.input.charCodeAt(++state.position);
if ((tmp = fromHexCode(ch)) >= 0) {
hexResult = (hexResult << 4) + tmp;
} else {
throwError(state, "expected hexadecimal character");
}
}
state.result += charFromCodepoint(hexResult);
state.position++;
} else {
throwError(state, "unknown escape sequence");
}
captureStart = captureEnd = state.position;
} else if (is_EOL(ch)) {
captureSegment(state, captureStart, captureEnd, true);
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
captureStart = captureEnd = state.position;
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
throwError(state, "unexpected end of the document within a double quoted scalar");
} else {
state.position++;
captureEnd = state.position;
}
}
throwError(state, "unexpected end of the stream within a double quoted scalar");
}
function readFlowCollection(state, nodeIndent) {
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch;
ch = state.input.charCodeAt(state.position);
if (ch === 91) {
terminator = 93;
isMapping = false;
_result = [];
} else if (ch === 123) {
terminator = 125;
isMapping = true;
_result = {};
} else {
return false;
}
if (state.anchor !== null) {
state.anchorMap[state.anchor] = _result;
}
ch = state.input.charCodeAt(++state.position);
while (ch !== 0) {
skipSeparationSpace(state, true, nodeIndent);
ch = state.input.charCodeAt(state.position);
if (ch === terminator) {
state.position++;
state.tag = _tag;
state.anchor = _anchor;
state.kind = isMapping ? "mapping" : "sequence";
state.result = _result;
return true;
} else if (!readNext) {
throwError(state, "missed comma between flow collection entries");
} else if (ch === 44) {
throwError(state, "expected the node content, but found ','");
}
keyTag = keyNode = valueNode = null;
isPair = isExplicitPair = false;
if (ch === 63) {
following = state.input.charCodeAt(state.position + 1);
if (is_WS_OR_EOL(following)) {
isPair = isExplicitPair = true;
state.position++;
skipSeparationSpace(state, true, nodeIndent);
}
}
_line = state.line;
_lineStart = state.lineStart;
_pos = state.position;
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
keyTag = state.tag;
keyNode = state.result;
skipSeparationSpace(state, true, nodeIndent);
ch = state.input.charCodeAt(state.position);
if ((isExplicitPair || state.line === _line) && ch === 58) {
isPair = true;
ch = state.input.charCodeAt(++state.position);
skipSeparationSpace(state, true, nodeIndent);
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
valueNode = state.result;
}
if (isMapping) {
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
} else if (isPair) {
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
} else {
_result.push(keyNode);
}
skipSeparationSpace(state, true, nodeIndent);
ch = state.input.charCodeAt(state.position);
if (ch === 44) {
readNext = true;
ch = state.input.charCodeAt(++state.position);
} else {
readNext = false;
}
}
throwError(state, "unexpected end of the stream within a flow collection");
}
function readBlockScalar(state, nodeIndent) {
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
ch = state.input.charCodeAt(state.position);
if (ch === 124) {
folding = false;
} else if (ch === 62) {
folding = true;
} else {
return false;
}
state.kind = "scalar";
state.result = "";
while (ch !== 0) {
ch = state.input.charCodeAt(++state.position);
if (ch === 43 || ch === 45) {
if (CHOMPING_CLIP === chomping) {
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
} else {
throwError(state, "repeat of a chomping mode identifier");
}
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
if (tmp === 0) {
throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
} else if (!detectedIndent) {
textIndent = nodeIndent + tmp - 1;
detectedIndent = true;
} else {
throwError(state, "repeat of an indentation width identifier");
}
} else {
break;
}
}
if (is_WHITE_SPACE(ch)) {
do {
ch = state.input.charCodeAt(++state.position);
} while (is_WHITE_SPACE(ch));
if (ch === 35) {
do {
ch = state.input.charCodeAt(++state.position);
} while (!is_EOL(ch) && ch !== 0);
}
}
while (ch !== 0) {
readLineBreak(state);
state.lineIndent = 0;
ch = state.input.charCodeAt(state.position);
while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
state.lineIndent++;
ch = state.input.charCodeAt(++state.position);
}
if (!detectedIndent && state.lineIndent > textIndent) {
textIndent = state.lineIndent;
}
if (is_EOL(ch)) {
emptyLines++;
continue;
}
if (state.lineIndent < textIndent) {
if (chomping === CHOMPING_KEEP) {
state.result += common.repeat(`
`, didReadContent ? 1 + emptyLines : emptyLines);
} else if (chomping === CHOMPING_CLIP) {
if (didReadContent) {
state.result += `
`;
}
}
break;
}
if (folding) {
if (is_WHITE_SPACE(ch)) {
atMoreIndented = true;
state.result += common.repeat(`
`, didReadContent ? 1 + emptyLines : emptyLines);
} else if (atMoreIndented) {
atMoreIndented = false;
state.result += common.repeat(`
`, emptyLines + 1);
} else if (emptyLines === 0) {
if (didReadContent) {
state.result += " ";
}
} else {
state.result += common.repeat(`
`, emptyLines);
}
} else {
state.result += common.repeat(`
`, didReadContent ? 1 + emptyLines : emptyLines);
}
didReadContent = true;
detectedIndent = true;
emptyLines = 0;
captureStart = state.position;
while (!is_EOL(ch) && ch !== 0) {
ch = state.input.charCodeAt(++state.position);
}
captureSegment(state, captureStart, state.position, false);
}
return true;
}
function readBlockSequence(state, nodeIndent) {
var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
if (state.firstTabInLine !== -1)
return false;
if (state.anchor !== null) {
state.anchorMap[state.anchor] = _result;
}
ch = state.input.charCodeAt(state.position);
while (ch !== 0) {
if (state.firstTabInLine !== -1) {
state.position = state.firstTabInLine;
throwError(state, "tab characters must not be used in indentation");
}
if (ch !== 45) {
break;
}
following = state.input.charCodeAt(state.position + 1);
if (!is_WS_OR_EOL(following)) {
break;
}
detected = true;
state.position++;
if (skipSeparationSpace(state, true, -1)) {
if (state.lineIndent <= nodeIndent) {
_result.push(null);
ch = state.input.charCodeAt(state.position);
continue;
}
}
_line = state.line;
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
_result.push(state.result);
skipSeparationSpace(state, true, -1);
ch = state.input.charCodeAt(state.position);
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
throwError(state, "bad indentation of a sequence entry");
} else if (state.lineIndent < nodeIndent) {
break;
}
}
if (detected) {
state.tag = _tag;
state.anchor = _anchor;
state.kind = "sequence";
state.result = _result;
return true;
}
return false;
}
function readBlockMapping(state, nodeIndent, flowIndent) {
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
if (state.firstTabInLine !== -1)
return false;
if (state.anchor !== null) {
state.anchorMap[state.anchor] = _result;
}
ch = state.input.charCodeAt(state.position);
while (ch !== 0) {
if (!atExplicitKey && state.firstTabInLine !== -1) {
state.position = state.firstTabInLine;
throwError(state, "tab characters must not be used in indentation");
}
following = state.input.charCodeAt(state.position + 1);
_line = state.line;
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
if (ch === 63) {
if (atExplicitKey) {
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
keyTag = keyNode = valueNode = null;
}
detected = true;
atExplicitKey = true;
allowCompact = true;
} else if (atExplicitKey) {
atExplicitKey = false;
allowCompact = true;
} else {
throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
}
state.position += 1;
ch = following;
} else {
_keyLine = state.line;
_keyLineStart = state.lineStart;
_keyPos = state.position;
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
break;
}
if (state.line === _line) {
ch = state.input.charCodeAt(state.position);
while (is_WHITE_SPACE(ch)) {
ch = state.input.charCodeAt(++state.position);
}
if (ch === 58) {
ch = state.input.charCodeAt(++state.position);
if (!is_WS_OR_EOL(ch)) {
throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
}
if (atExplicitKey) {
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
keyTag = keyNode = valueNode = null;
}
detected = true;
atExplicitKey = false;
allowCompact = false;
keyTag = state.tag;
keyNode = state.result;
} else if (detected) {
throwError(state, "can not read an implicit mapping pair; a colon is missed");
} else {
state.tag = _tag;
state.anchor = _anchor;
return true;
}
} else if (detected) {
throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
} else {
state.tag = _tag;
state.anchor = _anchor;
return true;
}
}
if (state.line === _line || state.lineIndent > nodeIndent) {
if (atExplicitKey) {
_keyLine = state.line;
_keyLineStart = state.lineStart;
_keyPos = state.position;
}
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
if (atExplicitKey) {
keyNode = state.result;
} else {
valueNode = state.result;
}
}
if (!atExplicitKey) {
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
keyTag = keyNode = valueNode = null;
}
skipSeparationSpace(state, true, -1);
ch = state.input.charCodeAt(state.position);
}
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
throwError(state, "bad indentation of a mapping entry");
} else if (state.lineIndent < nodeIndent) {
break;
}
}
if (atExplicitKey) {
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
}
if (detected) {
state.tag = _tag;
state.anchor = _anchor;
state.kind = "mapping";
state.result = _result;
}
return detected;
}
function readTagProperty(state) {
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
ch = state.input.charCodeAt(state.position);
if (ch !== 33)
return false;
if (state.tag !== null) {
throwError(state, "duplication of a tag property");
}
ch = state.input.charCodeAt(++state.position);
if (ch === 60) {
isVerbatim = true;
ch = state.input.charCodeAt(++state.position);
} else if (ch === 33) {
isNamed = true;
tagHandle = "!!";
ch = state.input.charCodeAt(++state.position);
} else {
tagHandle = "!";
}
_position = state.position;
if (isVerbatim) {
do {
ch = state.input.charCodeAt(++state.position);
} while (ch !== 0 && ch !== 62);
if (state.position < state.length) {
tagName = state.input.slice(_position, state.position);
ch = state.input.charCodeAt(++state.position);
} else {
throwError(state, "unexpected end of the stream within a verbatim tag");
}
} else {
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
if (ch === 33) {
if (!isNamed) {
tagHandle = state.input.slice(_position - 1, state.position + 1);
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
throwError(state, "named tag handle cannot contain such characters");
}
isNamed = true;
_position = state.position + 1;
} else {
throwError(state, "tag suffix cannot contain exclamation marks");
}
}
ch = state.input.charCodeAt(++state.position);
}
tagName = state.input.slice(_position, state.position);
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
throwError(state, "tag suffix cannot contain flow indicator characters");
}
}
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
throwError(state, "tag name cannot contain such characters: " + tagName);
}
try {
tagName = decodeURIComponent(tagName);
} catch (err) {
throwError(state, "tag name is malformed: " + tagName);
}
if (isVerbatim) {
state.tag = tagName;
} else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
state.tag = state.tagMap[tagHandle] + tagName;
} else if (tagHandle === "!") {
state.tag = "!" + tagName;
} else if (tagHandle === "!!") {
state.tag = "tag:yaml.org,2002:" + tagName;
} else {
throwError(state, 'undeclared tag handle "' + tagHandle + '"');
}
return true;
}
function readAnchorProperty(state) {
var _position, ch;
ch = state.input.charCodeAt(state.position);
if (ch !== 38)
return false;
if (state.anchor !== null) {
throwError(state, "duplication of an anchor property");
}
ch = state.input.charCodeAt(++state.position);
_position = state.position;
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
ch = state.input.charCodeAt(++state.position);
}
if (state.position === _position) {
throwError(state, "name of an anchor node must contain at least one character");
}
state.anchor = state.input.slice(_position, state.position);
return true;
}
function readAlias(state) {
var _position, alias, ch;
ch = state.input.charCodeAt(state.position);
if (ch !== 42)
return false;
ch = state.input.charCodeAt(++state.position);
_position = state.position;
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
ch = state.input.charCodeAt(++state.position);
}
if (state.position === _position) {
throwError(state, "name of an alias node must contain at least one character");
}
alias = state.input.slice(_position, state.position);
if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
throwError(state, 'unidentified alias "' + alias + '"');
}
state.result = state.anchorMap[alias];
skipSeparationSpace(state, true, -1);
return true;
}
function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
if (state.listener !== null) {
state.listener("open", state);
}
state.tag = null;
state.anchor = null;
state.kind = null;
state.result = null;
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
if (allowToSeek) {
if (skipSeparationSpace(state, true, -1)) {
atNewLine = true;
if (state.lineIndent > parentIndent) {
indentStatus = 1;
} else if (state.lineIndent === parentIndent) {
indentStatus = 0;
} else if (state.lineIndent < parentIndent) {
indentStatus = -1;
}
}
}
if (indentStatus === 1) {
while (readTagProperty(state) || readAnchorProperty(state)) {
if (skipSeparationSpace(state, true, -1)) {
atNewLine = true;
allowBlockCollections = allowBlockStyles;
if (state.lineIndent > parentIndent) {
indentStatus = 1;
} else if (state.lineIndent === parentIndent) {
indentStatus = 0;
} else if (state.lineIndent < parentIndent) {
indentStatus = -1;
}
} else {
allowBlockCollections = false;
}
}
}
if (allowBlockCollections) {
allowBlockCollections = atNewLine || allowCompact;
}
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
flowIndent = parentIndent;
} else {
flowIndent = parentIndent + 1;
}
blockIndent = state.position - state.lineStart;
if (indentStatus === 1) {
if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
hasContent = true;
} else {
if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
hasContent = true;
} else if (readAlias(state)) {
hasContent = true;
if (state.tag !== null || state.anchor !== null) {
throwError(state, "alias node should not have any properties");
}
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
hasContent = true;
if (state.tag === null) {
state.tag = "?";
}
}
if (state.anchor !== null) {
state.anchorMap[state.anchor] = state.result;
}
}
} else if (indentStatus === 0) {
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
}
}
if (state.tag === null) {
if (state.anchor !== null) {
state.anchorMap[state.anchor] = state.result;
}
} else if (state.tag === "?") {
if (state.result !== null && state.kind !== "scalar") {
throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
}
for (typeIndex = 0, typeQuantity = state.implicitTypes.length;typeIndex < typeQuantity; typeIndex += 1) {
type2 = state.implicitTypes[typeIndex];
if (type2.resolve(state.result)) {
state.result = type2.construct(state.result);
state.tag = type2.tag;
if (state.anchor !== null) {
state.anchorMap[state.anchor] = state.result;
}
break;
}
}
} else if (state.tag !== "!") {
if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
type2 = state.typeMap[state.kind || "fallback"][state.tag];
} else {
type2 = null;
typeList = state.typeMap.multi[state.kind || "fallback"];
for (typeIndex = 0, typeQuantity = typeList.length;typeIndex < typeQuantity; typeIndex += 1) {
if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
type2 = typeList[typeIndex];
break;
}
}
}
if (!type2) {
throwError(state, "unknown tag !<" + state.tag + ">");
}
if (state.result !== null && type2.kind !== state.kind) {
throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
}
if (!type2.resolve(state.result, state.tag)) {
throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
} else {
state.result = type2.construct(state.result, state.tag);
if (state.anchor !== null) {
state.anchorMap[state.anchor] = state.result;
}
}
}
if (state.listener !== null) {
state.listener("close", state);
}
return state.tag !== null || state.anchor !== null || hasContent;
}
function readDocument(state) {
var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
state.version = null;
state.checkLineBreaks = state.legacy;
state.tagMap = Object.create(null);
state.anchorMap = Object.create(null);
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
skipSeparationSpace(state, true, -1);
ch = state.input.charCodeAt(state.position);
if (state.lineIndent > 0 || ch !== 37) {
break;
}
hasDirectives = true;
ch = state.input.charCodeAt(++state.position);
_position = state.position;
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
ch = state.input.charCodeAt(++state.position);
}
directiveName = state.input.slice(_position, state.position);
directiveArgs = [];
if (directiveName.length < 1) {
throwError(state, "directive name must not be less than one character in length");
}
while (ch !== 0) {
while (is_WHITE_SPACE(ch)) {
ch = state.input.charCodeAt(++state.position);
}
if (ch === 35) {
do {
ch = state.input.charCodeAt(++state.position);
} while (ch !== 0 && !is_EOL(ch));
break;
}
if (is_EOL(ch))
break;
_position = state.position;
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
ch = state.input.charCodeAt(++state.position);
}
directiveArgs.push(state.input.slice(_position, state.position));
}
if (ch !== 0)
readLineBreak(state);
if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
directiveHandlers[directiveName](state, directiveName, directiveArgs);
} else {
throwWarning(state, 'unknown document directive "' + directiveName + '"');
}
}
skipSeparationSpace(state, true, -1);
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
state.position += 3;
skipSeparationSpace(state, true, -1);
} else if (hasDirectives) {
throwError(state, "directives end mark is expected");
}
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
skipSeparationSpace(state, true, -1);
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
throwWarning(state, "non-ASCII line breaks are interpreted as content");
}
state.documents.push(state.result);
if (state.position === state.lineStart && testDocumentSeparator(state)) {
if (state.input.charCodeAt(state.position) === 46) {
state.position += 3;
skipSeparationSpace(state, true, -1);
}
return;
}
if (state.position < state.length - 1) {
throwError(state, "end of the stream or a document separator is expected");
} else {
return;
}
}
function loadDocuments(input, options) {
input = String(input);
options = options || {};
if (input.length !== 0) {
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
input += `
`;
}
if (input.charCodeAt(0) === 65279) {
input = input.slice(1);
}
}
var state = new State$1(input, options);
var nullpos = input.indexOf("\x00");
if (nullpos !== -1) {
state.position = nullpos;
throwError(state, "null byte is not allowed in input");
}
state.input += "\x00";
while (state.input.charCodeAt(state.position) === 32) {
state.lineIndent += 1;
state.position += 1;
}
while (state.position < state.length - 1) {
readDocument(state);
}
return state.documents;
}
function loadAll$1(input, iterator, options) {
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
options = iterator;
iterator = null;
}
var documents = loadDocuments(input, options);
if (typeof iterator !== "function") {
return documents;
}
for (var index = 0, length = documents.length;index < length; index += 1) {
iterator(documents[index]);
}
}
function load$1(input, options) {
var documents = loadDocuments(input, options);
if (documents.length === 0) {
return;
} else if (documents.length === 1) {
return documents[0];
}
throw new exception("expected a single document in the stream, but found more");
}
function compileStyleMap(schema2, map2) {
var result, keys, index, length, tag, style, type2;
if (map2 === null)
return {};
result = {};
keys = Object.keys(map2);
for (index = 0, length = keys.length;index < length; index += 1) {
tag = keys[index];
style = String(map2[tag]);
if (tag.slice(0, 2) === "!!") {
tag = "tag:yaml.org,2002:" + tag.slice(2);
}
type2 = schema2.compiledTypeMap["fallback"][tag];
if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
style = type2.styleAliases[style];
}
result[tag] = style;
}
return result;
}
function encodeHex(character) {
var string, handle, length;
string = character.toString(16).toUpperCase();
if (character <= 255) {
handle = "x";
length = 2;
} else if (character <= 65535) {
handle = "u";
length = 4;
} else if (character <= 4294967295) {
handle = "U";
length = 8;
} else {
throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
}
return "\\" + handle + common.repeat("0", length - string.length) + string;
}
function State(options) {
this.schema = options["schema"] || _default;
this.indent = Math.max(1, options["indent"] || 2);
this.noArrayIndent = options["noArrayIndent"] || false;
this.skipInvalid = options["skipInvalid"] || false;
this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
this.sortKeys = options["sortKeys"] || false;
this.lineWidth = options["lineWidth"] || 80;
this.noRefs = options["noRefs"] || false;
this.noCompatMode = options["noCompatMode"] || false;
this.condenseFlow = options["condenseFlow"] || false;
this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
this.forceQuotes = options["forceQuotes"] || false;
this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
this.implicitTypes = this.schema.compiledImplicit;
this.explicitTypes = this.schema.compiledExplicit;
this.tag = null;
this.result = "";
this.duplicates = [];
this.usedDuplicates = null;
}
function indentString(string, spaces) {
var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
while (position < length) {
next = string.indexOf(`
`, position);
if (next === -1) {
line = string.slice(position);
position = length;
} else {
line = string.slice(position, next + 1);
position = next + 1;
}
if (line.length && line !== `
`)
result += ind;
result += line;
}
return result;
}
function generateNextLine(state, level) {
return `
` + common.repeat(" ", state.indent * level);
}
function testImplicitResolving(state, str2) {
var index, length, type2;
for (index = 0, length = state.implicitTypes.length;index < length; index += 1) {
type2 = state.implicitTypes[index];
if (type2.resolve(str2)) {
return true;
}
}
return false;
}
function isWhitespace(c) {
return c === CHAR_SPACE || c === CHAR_TAB;
}
function isPrintable(c) {
return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
}
function isNsCharOrWhitespace(c) {
return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
}
function isPlainSafe(c, prev, inblock) {
var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
}
function isPlainSafeFirst(c) {
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
}
function isPlainSafeLast(c) {
return !isWhitespace(c) && c !== CHAR_COLON;
}
function codePointAt(string, pos) {
var first = string.charCodeAt(pos), second;
if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
second = string.charCodeAt(pos + 1);
if (second >= 56320 && second <= 57343) {
return (first - 55296) * 1024 + second - 56320 + 65536;
}
}
return first;
}
function needIndentIndicator(string) {
var leadingSpaceRe = /^\n* /;
return leadingSpaceRe.test(string);
}
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
var i2;
var char = 0;
var prevChar = null;
var hasLineBreak = false;
var hasFoldableLine = false;
var shouldTrackWidth = lineWidth !== -1;
var previousLineBreak = -1;
var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
if (singleLineOnly || forceQuotes) {
for (i2 = 0;i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
char = codePointAt(string, i2);
if (!isPrintable(char)) {
return STYLE_DOUBLE;
}
plain = plain && isPlainSafe(char, prevChar, inblock);
prevChar = char;
}
} else {
for (i2 = 0;i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
char = codePointAt(string, i2);
if (char === CHAR_LINE_FEED) {
hasLineBreak = true;
if (shouldTrackWidth) {
hasFoldableLine = hasFoldableLine || i2 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
previousLineBreak = i2;
}
} else if (!isPrintable(char)) {
return STYLE_DOUBLE;
}
plain = plain && isPlainSafe(char, prevChar, inblock);
prevChar = char;
}
hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i2 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
}
if (!hasLineBreak && !hasFoldableLine) {
if (plain && !forceQuotes && !testAmbiguousType(string)) {
return STYLE_PLAIN;
}
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
}
if (indentPerLevel > 9 && needIndentIndicator(string)) {
return STYLE_DOUBLE;
}
if (!forceQuotes) {
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
}
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
}
function writeScalar(state, string, level, iskey, inblock) {
state.dump = function() {
if (string.length === 0) {
return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
}
if (!state.noCompatMode) {
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
}
}
var indent = state.indent * Math.max(1, level);
var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
function testAmbiguity(string2) {
return testImplicitResolving(state, string2);
}
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
case STYLE_PLAIN:
return string;
case STYLE_SINGLE:
return "'" + string.replace(/'/g, "''") + "'";
case STYLE_LITERAL:
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
case STYLE_FOLDED:
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
case STYLE_DOUBLE:
return '"' + escapeString(string) + '"';
default:
throw new exception("impossible error: invalid scalar style");
}
}();
}
function blockHeader(string, indentPerLevel) {
var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
var clip = string[string.length - 1] === `
`;
var keep = clip && (string[string.length - 2] === `
` || string === `
`);
var chomp = keep ? "+" : clip ? "" : "-";
return indentIndicator + chomp + `
`;
}
function dropEndingNewline(string) {
return string[string.length - 1] === `
` ? string.slice(0, -1) : string;
}
function foldString(string, width) {
var lineRe = /(\n+)([^\n]*)/g;
var result = function() {
var nextLF = string.indexOf(`
`);
nextLF = nextLF !== -1 ? nextLF : string.length;
lineRe.lastIndex = nextLF;
return foldLine(string.slice(0, nextLF), width);
}();
var prevMoreIndented = string[0] === `
` || string[0] === " ";
var moreIndented;
var match;
while (match = lineRe.exec(string)) {
var prefix = match[1], line = match[2];
moreIndented = line[0] === " ";
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? `
` : "") + foldLine(line, width);
prevMoreIndented = moreIndented;
}
return result;
}
function foldLine(line, width) {
if (line === "" || line[0] === " ")
return line;
var breakRe = / [^ ]/g;
var match;
var start = 0, end, curr = 0, next = 0;
var result = "";
while (match = breakRe.exec(line)) {
next = match.index;
if (next - start > width) {
end = curr > start ? curr : next;
result += `
` + line.slice(start, end);
start = end + 1;
}
curr = next;
}
result += `
`;
if (line.length - start > width && curr > start) {
result += line.slice(start, curr) + `
` + line.slice(curr + 1);
} else {
result += line.slice(start);
}
return result.slice(1);
}
function escapeString(string) {
var result = "";
var char = 0;
var escapeSeq;
for (var i2 = 0;i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
char = codePointAt(string, i2);
escapeSeq = ESCAPE_SEQUENCES[char];
if (!escapeSeq && isPrintable(char)) {
result += string[i2];
if (char >= 65536)
result += string[i2 + 1];
} else {
result += escapeSeq || encodeHex(char);
}
}
return result;
}
function writeFlowSequence(state, level, object) {
var _result = "", _tag = state.tag, index, length, value;
for (index = 0, length = object.length;index < length; index += 1) {
value = object[index];
if (state.replacer) {
value = state.replacer.call(object, String(index), value);
}
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
if (_result !== "")
_result += "," + (!state.condenseFlow ? " " : "");
_result += state.dump;
}
}
state.tag = _tag;
state.dump = "[" + _result + "]";
}
function writeBlockSequence(state, level, object, compact) {
var _result = "", _tag = state.tag, index, length, value;
for (index = 0, length = object.length;index < length; index += 1) {
value = object[index];
if (state.replacer) {
value = state.replacer.call(object, String(index), value);
}
if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
if (!compact || _result !== "") {
_result += generateNextLine(state, level);
}
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
_result += "-";
} else {
_result += "- ";
}
_result += state.dump;
}
}
state.tag = _tag;
state.dump = _result || "[]";
}
function writeFlowMapping(state, level, object) {
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
pairBuffer = "";
if (_result !== "")
pairBuffer += ", ";
if (state.condenseFlow)
pairBuffer += '"';
objectKey = objectKeyList[index];
objectValue = object[objectKey];
if (state.replacer) {
objectValue = state.replacer.call(object, objectKey, objectValue);
}
if (!writeNode(state, level, objectKey, false, false)) {
continue;
}
if (state.dump.length > 1024)
pairBuffer += "? ";
pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
if (!writeNode(state, level, objectValue, false, false)) {
continue;
}
pairBuffer += state.dump;
_result += pairBuffer;
}
state.tag = _tag;
state.dump = "{" + _result + "}";
}
function writeBlockMapping(state, level, object, compact) {
var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
if (state.sortKeys === true) {
objectKeyList.sort();
} else if (typeof state.sortKeys === "function") {
objectKeyList.sort(state.sortKeys);
} else if (state.sortKeys) {
throw new exception("sortKeys must be a boolean or a function");
}
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
pairBuffer = "";
if (!compact || _result !== "") {
pairBuffer += generateNextLine(state, level);
}
objectKey = objectKeyList[index];
objectValue = object[objectKey];
if (state.replacer) {
objectValue = state.replacer.call(object, objectKey, objectValue);
}
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
continue;
}
explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
if (explicitPair) {
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
pairBuffer += "?";
} else {
pairBuffer += "? ";
}
}
pairBuffer += state.dump;
if (explicitPair) {
pairBuffer += generateNextLine(state, level);
}
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
continue;
}
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
pairBuffer += ":";
} else {
pairBuffer += ": ";
}
pairBuffer += state.dump;
_result += pairBuffer;
}
state.tag = _tag;
state.dump = _result || "{}";
}
function detectType(state, object, explicit) {
var _result, typeList, index, length, type2, style;
typeList = explicit ? state.explicitTypes : state.implicitTypes;
for (index = 0, length = typeList.length;index < length; index += 1) {
type2 = typeList[index];
if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
if (explicit) {
if (type2.multi && type2.representName) {
state.tag = type2.representName(object);
} else {
state.tag = type2.tag;
}
} else {
state.tag = "?";
}
if (type2.represent) {
style = state.styleMap[type2.tag] || type2.defaultStyle;
if (_toString.call(type2.represent) === "[object Function]") {
_result = type2.represent(object, style);
} else if (_hasOwnProperty.call(type2.represent, style)) {
_result = type2.represent[style](object, style);
} else {
throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
}
state.dump = _result;
}
return true;
}
}
return false;
}
function writeNode(state, level, object, block, compact, iskey, isblockseq) {
state.tag = null;
state.dump = object;
if (!detectType(state, object, false)) {
detectType(state, object, true);
}
var type2 = _toString.call(state.dump);
var inblock = block;
var tagStr;
if (block) {
block = state.flowLevel < 0 || state.flowLevel > level;
}
var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
if (objectOrArray) {
duplicateIndex = state.duplicates.indexOf(object);
duplicate = duplicateIndex !== -1;
}
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
compact = false;
}
if (duplicate && state.usedDuplicates[duplicateIndex]) {
state.dump = "*ref_" + duplicateIndex;
} else {
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
state.usedDuplicates[duplicateIndex] = true;
}
if (type2 === "[object Object]") {
if (block && Object.keys(state.dump).length !== 0) {
writeBlockMapping(state, level, state.dump, compact);
if (duplicate) {
state.dump = "&ref_" + duplicateIndex + state.dump;
}
} else {
writeFlowMapping(state, level, state.dump);
if (duplicate) {
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
}
}
} else if (type2 === "[object Array]") {
if (block && state.dump.length !== 0) {
if (state.noArrayIndent && !isblockseq && level > 0) {
writeBlockSequence(state, level - 1, state.dump, compact);
} else {
writeBlockSequence(state, level, state.dump, compact);
}
if (duplicate) {
state.dump = "&ref_" + duplicateIndex + state.dump;
}
} else {
writeFlowSequence(state, level, state.dump);
if (duplicate) {
state.dump = "&ref_" + duplicateIndex + " " + state.dump;
}
}
} else if (type2 === "[object String]") {
if (state.tag !== "?") {
writeScalar(state, state.dump, level, iskey, inblock);
}
} else if (type2 === "[object Undefined]") {
return false;
} else {
if (state.skipInvalid)
return false;
throw new exception("unacceptable kind of an object to dump " + type2);
}
if (state.tag !== null && state.tag !== "?") {
tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
if (state.tag[0] === "!") {
tagStr = "!" + tagStr;
} else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
tagStr = "!!" + tagStr.slice(18);
} else {
tagStr = "!<" + tagStr + ">";
}
state.dump = tagStr + " " + state.dump;
}
}
return true;
}
function getDuplicateReferences(object, state) {
var objects = [], duplicatesIndexes = [], index, length;
inspectNode(object, objects, duplicatesIndexes);
for (index = 0, length = duplicatesIndexes.length;index < length; index += 1) {
state.duplicates.push(objects[duplicatesIndexes[index]]);
}
state.usedDuplicates = new Array(length);
}
function inspectNode(object, objects, duplicatesIndexes) {
var objectKeyList, index, length;
if (object !== null && typeof object === "object") {
index = objects.indexOf(object);
if (index !== -1) {
if (duplicatesIndexes.indexOf(index) === -1) {
duplicatesIndexes.push(index);
}
} else {
objects.push(object);
if (Array.isArray(object)) {
for (index = 0, length = object.length;index < length; index += 1) {
inspectNode(object[index], objects, duplicatesIndexes);
}
} else {
objectKeyList = Object.keys(object);
for (index = 0, length = objectKeyList.length;index < length; index += 1) {
inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
}
}
}
}
}
function dump$1(input, options) {
options = options || {};
var state = new State(options);
if (!state.noRefs)
getDuplicateReferences(input, state);
var value = input;
if (state.replacer) {
value = state.replacer.call({ "": value }, "", value);
}
if (writeNode(state, 0, value, true, true))
return state.dump + `
`;
return "";
}
function renamed(from, to) {
return function() {
throw new Error("Function yaml." + from + " is removed in js-yaml 4. " + "Use yaml." + to + " instead, which is now safe by default.");
};
}
var isNothing_1, isObject_1, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type, schema, str, seq, map, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json, core, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge, BASE64_MAP = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
\r`, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN = 1, CONTEXT_FLOW_OUT = 2, CONTEXT_BLOCK_IN = 3, CONTEXT_BLOCK_OUT = 4, CHOMPING_CLIP = 1, CHOMPING_STRIP = 2, CHOMPING_KEEP = 3, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i, directiveHandlers, loadAll_1, load_1, loader, _toString, _hasOwnProperty, CHAR_BOM = 65279, CHAR_TAB = 9, CHAR_LINE_FEED = 10, CHAR_CARRIAGE_RETURN = 13, CHAR_SPACE = 32, CHAR_EXCLAMATION = 33, CHAR_DOUBLE_QUOTE = 34, CHAR_SHARP = 35, CHAR_PERCENT = 37, CHAR_AMPERSAND = 38, CHAR_SINGLE_QUOTE = 39, CHAR_ASTERISK = 42, CHAR_COMMA = 44, CHAR_MINUS = 45, CHAR_COLON = 58, CHAR_EQUALS = 61, CHAR_GREATER_THAN = 62, CHAR_QUESTION = 63, CHAR_COMMERCIAL_AT = 64, CHAR_LEFT_SQUARE_BRACKET = 91, CHAR_RIGHT_SQUARE_BRACKET = 93, CHAR_GRAVE_ACCENT = 96, CHAR_LEFT_CURLY_BRACKET = 123, CHAR_VERTICAL_LINE = 124, CHAR_RIGHT_CURLY_BRACKET = 125, ESCAPE_SEQUENCES, DEPRECATED_BOOLEANS_SYNTAX, DEPRECATED_BASE60_SYNTAX, QUOTING_TYPE_SINGLE = 1, QUOTING_TYPE_DOUBLE = 2, STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5, dump_1, dumper, Type, Schema, FAILSAFE_SCHEMA, JSON_SCHEMA, CORE_SCHEMA, DEFAULT_SCHEMA, load, loadAll, dump, YAMLException, types, safeLoad, safeLoadAll, safeDump, jsYaml;
var init_js_yaml = __esm(() => {
/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
isNothing_1 = isNothing;
isObject_1 = isObject;
toArray_1 = toArray;
repeat_1 = repeat;
isNegativeZero_1 = isNegativeZero;
extend_1 = extend;
common = {
isNothing: isNothing_1,
isObject: isObject_1,
toArray: toArray_1,
repeat: repeat_1,
isNegativeZero: isNegativeZero_1,
extend: extend_1
};
YAMLException$1.prototype = Object.create(Error.prototype);
YAMLException$1.prototype.constructor = YAMLException$1;
YAMLException$1.prototype.toString = function toString(compact) {
return this.name + ": " + formatError(this, compact);
};
exception = YAMLException$1;
snippet = makeSnippet;
TYPE_CONSTRUCTOR_OPTIONS = [
"kind",
"multi",
"resolve",
"construct",
"instanceOf",
"predicate",
"represent",
"representName",
"defaultStyle",
"styleAliases"
];
YAML_NODE_KINDS = [
"scalar",
"sequence",
"mapping"
];
type = Type$1;
Schema$1.prototype.extend = function extend2(definition) {
var implicit = [];
var explicit = [];
if (definition instanceof type) {
explicit.push(definition);
} else if (Array.isArray(definition)) {
explicit = explicit.concat(definition);
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
if (definition.implicit)
implicit = implicit.concat(definition.implicit);
if (definition.explicit)
explicit = explicit.concat(definition.explicit);
} else {
throw new exception("Schema.extend argument should be a Type, [ Type ], " + "or a schema definition ({ implicit: [...], explicit: [...] })");
}
implicit.forEach(function(type$1) {
if (!(type$1 instanceof type)) {
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
}
if (type$1.loadKind && type$1.loadKind !== "scalar") {
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
}
if (type$1.multi) {
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
}
});
explicit.forEach(function(type$1) {
if (!(type$1 instanceof type)) {
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
}
});
var result = Object.create(Schema$1.prototype);
result.implicit = (this.implicit || []).concat(implicit);
result.explicit = (this.explicit || []).concat(explicit);
result.compiledImplicit = compileList(result, "implicit");
result.compiledExplicit = compileList(result, "explicit");
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
return result;
};
schema = Schema$1;
str = new type("tag:yaml.org,2002:str", {
kind: "scalar",
construct: function(data) {
return data !== null ? data : "";
}
});
seq = new type("tag:yaml.org,2002:seq", {
kind: "sequence",
construct: function(data) {
return data !== null ? data : [];
}
});
map = new type("tag:yaml.org,2002:map", {
kind: "mapping",
construct: function(data) {
return data !== null ? data : {};
}
});
failsafe = new schema({
explicit: [
str,
seq,
map
]
});
_null = new type("tag:yaml.org,2002:null", {
kind: "scalar",
resolve: resolveYamlNull,
construct: constructYamlNull,
predicate: isNull,
represent: {
canonical: function() {
return "~";
},
lowercase: function() {
return "null";
},
uppercase: function() {
return "NULL";
},
camelcase: function() {
return "Null";
},
empty: function() {
return "";
}
},
defaultStyle: "lowercase"
});
bool = new type("tag:yaml.org,2002:bool", {
kind: "scalar",
resolve: resolveYamlBoolean,
construct: constructYamlBoolean,
predicate: isBoolean,
represent: {
lowercase: function(object) {
return object ? "true" : "false";
},
uppercase: function(object) {
return object ? "TRUE" : "FALSE";
},
camelcase: function(object) {
return object ? "True" : "False";
}
},
defaultStyle: "lowercase"
});
int = new type("tag:yaml.org,2002:int", {
kind: "scalar",
resolve: resolveYamlInteger,
construct: constructYamlInteger,
predicate: isInteger,
represent: {
binary: function(obj) {
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
},
octal: function(obj) {
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
},
decimal: function(obj) {
return obj.toString(10);
},
hexadecimal: function(obj) {
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
}
},
defaultStyle: "decimal",
styleAliases: {
binary: [2, "bin"],
octal: [8, "oct"],
decimal: [10, "dec"],
hexadecimal: [16, "hex"]
}
});
YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?" + "|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?" + "|[-+]?\\.(?:inf|Inf|INF)" + "|\\.(?:nan|NaN|NAN))$");
SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
float = new type("tag:yaml.org,2002:float", {
kind: "scalar",
resolve: resolveYamlFloat,
construct: constructYamlFloat,
predicate: isFloat,
represent: representYamlFloat,
defaultStyle: "lowercase"
});
json = failsafe.extend({
implicit: [
_null,
bool,
int,
float
]
});
core = json;
YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9])" + "-([0-9][0-9])$");
YAML_TIMESTAMP_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9]?)" + "-([0-9][0-9]?)" + "(?:[Tt]|[ \\t]+)" + "([0-9][0-9]?)" + ":([0-9][0-9])" + ":([0-9][0-9])" + "(?:\\.([0-9]*))?" + "(?:[ \\t]*(Z|([-+])([0-9][0-9]?)" + "(?::([0-9][0-9]))?))?$");
timestamp = new type("tag:yaml.org,2002:timestamp", {
kind: "scalar",
resolve: resolveYamlTimestamp,
construct: constructYamlTimestamp,
instanceOf: Date,
represent: representYamlTimestamp
});
merge = new type("tag:yaml.org,2002:merge", {
kind: "scalar",
resolve: resolveYamlMerge
});
binary = new type("tag:yaml.org,2002:binary", {
kind: "scalar",
resolve: resolveYamlBinary,
construct: constructYamlBinary,
predicate: isBinary,
represent: representYamlBinary
});
_hasOwnProperty$3 = Object.prototype.hasOwnProperty;
_toString$2 = Object.prototype.toString;
omap = new type("tag:yaml.org,2002:omap", {
kind: "sequence",
resolve: resolveYamlOmap,
construct: constructYamlOmap
});
_toString$1 = Object.prototype.toString;
pairs = new type("tag:yaml.org,2002:pairs", {
kind: "sequence",
resolve: resolveYamlPairs,
construct: constructYamlPairs
});
_hasOwnProperty$2 = Object.prototype.hasOwnProperty;
set = new type("tag:yaml.org,2002:set", {
kind: "mapping",
resolve: resolveYamlSet,
construct: constructYamlSet
});
_default = core.extend({
implicit: [
timestamp,
merge
],
explicit: [
binary,
omap,
pairs,
set
]
});
_hasOwnProperty$1 = Object.prototype.hasOwnProperty;
PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
simpleEscapeCheck = new Array(256);
simpleEscapeMap = new Array(256);
for (i = 0;i < 256; i++) {
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
simpleEscapeMap[i] = simpleEscapeSequence(i);
}
directiveHandlers = {
YAML: function handleYamlDirective(state, name, args) {
var match, major, minor;
if (state.version !== null) {
throwError(state, "duplication of %YAML directive");
}
if (args.length !== 1) {
throwError(state, "YAML directive accepts exactly one argument");
}
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
if (match === null) {
throwError(state, "ill-formed argument of the YAML directive");
}
major = parseInt(match[1], 10);
minor = parseInt(match[2], 10);
if (major !== 1) {
throwError(state, "unacceptable YAML version of the document");
}
state.version = args[0];
state.checkLineBreaks = minor < 2;
if (minor !== 1 && minor !== 2) {
throwWarning(state, "unsupported YAML version of the document");
}
},
TAG: function handleTagDirective(state, name, args) {
var handle, prefix;
if (args.length !== 2) {
throwError(state, "TAG directive accepts exactly two arguments");
}
handle = args[0];
prefix = args[1];
if (!PATTERN_TAG_HANDLE.test(handle)) {
throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
}
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
}
if (!PATTERN_TAG_URI.test(prefix)) {
throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
}
try {
prefix = decodeURIComponent(prefix);
} catch (err) {
throwError(state, "tag prefix is malformed: " + prefix);
}
state.tagMap[handle] = prefix;
}
};
loadAll_1 = loadAll$1;
load_1 = load$1;
loader = {
loadAll: loadAll_1,
load: load_1
};
_toString = Object.prototype.toString;
_hasOwnProperty = Object.prototype.hasOwnProperty;
ESCAPE_SEQUENCES = {};
ESCAPE_SEQUENCES[0] = "\\0";
ESCAPE_SEQUENCES[7] = "\\a";
ESCAPE_SEQUENCES[8] = "\\b";
ESCAPE_SEQUENCES[9] = "\\t";
ESCAPE_SEQUENCES[10] = "\\n";
ESCAPE_SEQUENCES[11] = "\\v";
ESCAPE_SEQUENCES[12] = "\\f";
ESCAPE_SEQUENCES[13] = "\\r";
ESCAPE_SEQUENCES[27] = "\\e";
ESCAPE_SEQUENCES[34] = "\\\"";
ESCAPE_SEQUENCES[92] = "\\\\";
ESCAPE_SEQUENCES[133] = "\\N";
ESCAPE_SEQUENCES[160] = "\\_";
ESCAPE_SEQUENCES[8232] = "\\L";
ESCAPE_SEQUENCES[8233] = "\\P";
DEPRECATED_BOOLEANS_SYNTAX = [
"y",
"Y",
"yes",
"Yes",
"YES",
"on",
"On",
"ON",
"n",
"N",
"no",
"No",
"NO",
"off",
"Off",
"OFF"
];
DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
dump_1 = dump$1;
dumper = {
dump: dump_1
};
Type = type;
Schema = schema;
FAILSAFE_SCHEMA = failsafe;
JSON_SCHEMA = json;
CORE_SCHEMA = core;
DEFAULT_SCHEMA = _default;
load = loader.load;
loadAll = loader.loadAll;
dump = dumper.dump;
YAMLException = exception;
types = {
binary,
float,
map,
null: _null,
pairs,
set,
timestamp,
bool,
int,
merge,
omap,
seq,
str
};
safeLoad = renamed("safeLoad", "load");
safeLoadAll = renamed("safeLoadAll", "loadAll");
safeDump = renamed("safeDump", "dump");
jsYaml = {
Type,
Schema,
FAILSAFE_SCHEMA,
JSON_SCHEMA,
CORE_SCHEMA,
DEFAULT_SCHEMA,
load,
loadAll,
dump,
YAMLException,
types,
safeLoad,
safeLoadAll,
safeDump
};
});
// src/shared/frontmatter.ts
function parseFrontmatter(content) {
const frontmatterRegex = /^---\r?\n([\s\S]*?)\r?\n?---\r?\n([\s\S]*)$/;
const match = content.match(frontmatterRegex);
if (!match) {
return { data: {}, body: content, hadFrontmatter: false, parseError: false };
}
const yamlContent = match[1];
const body = match[2];
try {
const parsed = jsYaml.load(yamlContent, { schema: jsYaml.JSON_SCHEMA });
const data = parsed ?? {};
return { data, body, hadFrontmatter: true, parseError: false };
} catch {
return { data: {}, body, hadFrontmatter: true, parseError: true };
}
}
var init_frontmatter = __esm(() => {
init_js_yaml();
});
// src/shared/command-executor/home-directory.ts
var init_home_directory = () => {};
// src/shared/command-executor/shell-path.ts
var init_shell_path = () => {};
// src/shared/command-executor/execute-hook-command.ts
var init_execute_hook_command = __esm(() => {
init_home_directory();
init_shell_path();
});
// src/shared/command-executor/execute-command.ts
import { exec } from "child_process";
import { promisify } from "util";
var execAsync;
var init_execute_command = __esm(() => {
execAsync = promisify(exec);
});
// src/shared/command-executor/embedded-commands.ts
var init_embedded_commands = () => {};
// src/shared/command-executor/resolve-commands-in-text.ts
var init_resolve_commands_in_text = __esm(() => {
init_execute_command();
init_embedded_commands();
});
// src/shared/command-executor.ts
var init_command_executor = __esm(() => {
init_execute_hook_command();
init_execute_command();
init_resolve_commands_in_text();
});
// src/shared/file-reference-resolver.ts
var init_file_reference_resolver = () => {};
// src/shared/logger.ts
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
function log(message, data) {
try {
const timestamp2 = new Date().toISOString();
const logEntry = `[${timestamp2}] ${message} ${data ? JSON.stringify(data) : ""}
`;
fs.appendFileSync(logFile, logEntry);
} catch {}
}
var logFile;
var init_logger = __esm(() => {
logFile = path.join(os.tmpdir(), "oh-my-opencode.log");
});
// src/shared/deep-merge.ts
function isPlainObject(value) {
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value) === "[object Object]";
}
function deepMerge(base, override, depth = 0) {
if (!base && !override)
return;
if (!base)
return override;
if (!override)
return base;
if (depth > MAX_DEPTH)
return override ?? base;
const result = { ...base };
for (const key of Object.keys(override)) {
if (DANGEROUS_KEYS.has(key))
continue;
const baseValue = base[key];
const overrideValue = override[key];
if (overrideValue === undefined)
continue;
if (isPlainObject(baseValue) && isPlainObject(overrideValue)) {
result[key] = deepMerge(baseValue, overrideValue, depth + 1);
} else {
result[key] = overrideValue;
}
}
return result;
}
var DANGEROUS_KEYS, MAX_DEPTH = 50;
var init_deep_merge = __esm(() => {
DANGEROUS_KEYS = new Set(["__proto__", "constructor", "prototype"]);
});
// src/shared/snake-case.ts
var init_snake_case = __esm(() => {
init_deep_merge();
});
// src/shared/tool-name.ts
var init_tool_name = () => {};
// src/shared/file-utils.ts
var init_file_utils = () => {};
// src/shared/context-limit-resolver.ts
var init_context_limit_resolver = () => {};
// src/shared/normalize-sdk-response.ts
function normalizeSDKResponse(response, fallback, options) {
if (response === null || response === undefined) {
return fallback;
}
if (Array.isArray(response)) {
return response;
}
if (typeof response === "object" && "data" in response) {
const data = response.data;
if (data !== null && data !== undefined) {
return data;
}
if (options?.preferResponseOnMissingData === true) {
return response;
}
return fallback;
}
if (options?.preferResponseOnMissingData === true) {
return response;
}
return fallback;
}
// src/shared/dynamic-truncator.ts
var init_dynamic_truncator = __esm(() => {
init_context_limit_resolver();
});
// src/shared/data-path.ts
import * as path2 from "path";
import * as os2 from "os";
function getDataDir() {
return process.env.XDG_DATA_HOME ?? path2.join(os2.homedir(), ".local", "share");
}
function getOpenCodeStorageDir() {
return path2.join(getDataDir(), "opencode", "storage");
}
function getCacheDir() {
return process.env.XDG_CACHE_HOME ?? path2.join(os2.homedir(), ".cache");
}
function getOmoOpenCodeCacheDir() {
return path2.join(getCacheDir(), "oh-my-opencode");
}
function getOpenCodeCacheDir() {
return path2.join(getCacheDir(), "opencode");
}
var init_data_path = () => {};
// src/shared/config-errors.ts
function getConfigLoadErrors() {
return configLoadErrors;
}
function clearConfigLoadErrors() {
configLoadErrors = [];
}
function addConfigLoadError(error) {
configLoadErrors.push(error);
}
var configLoadErrors;
var init_config_errors = __esm(() => {
configLoadErrors = [];
});
// src/shared/claude-config-dir.ts
var init_claude_config_dir = () => {};
// node_modules/jsonc-parser/lib/esm/impl/scanner.js
function createScanner(text, ignoreTrivia = false) {
const len = text.length;
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
function scanHexDigits(count, exact) {
let digits = 0;
let value2 = 0;
while (digits < count || !exact) {
let ch = text.charCodeAt(pos);
if (ch >= 48 && ch <= 57) {
value2 = value2 * 16 + ch - 48;
} else if (ch >= 65 && ch <= 70) {
value2 = value2 * 16 + ch - 65 + 10;
} else if (ch >= 97 && ch <= 102) {
value2 = value2 * 16 + ch - 97 + 10;
} else {
break;
}
pos++;
digits++;
}
if (digits < count) {
value2 = -1;
}
return value2;
}
function setPosition(newPosition) {
pos = newPosition;
value = "";
tokenOffset = 0;
token = 16;
scanError = 0;
}
function scanNumber() {
let start = pos;
if (text.charCodeAt(pos) === 48) {
pos++;
} else {
pos++;
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
pos++;
}
}
if (pos < text.length && text.charCodeAt(pos) === 46) {
pos++;
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
pos++;
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
pos++;
}
} else {
scanError = 3;
return text.substring(start, pos);
}
}
let end = pos;
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
pos++;
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
pos++;
}
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
pos++;
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
pos++;
}
end = pos;
} else {
scanError = 3;
}
}
return text.substring(start, end);
}
function scanString() {
let result = "", start = pos;
while (true) {
if (pos >= len) {
result += text.substring(start, pos);
scanError = 2;
break;
}
const ch = text.charCodeAt(pos);
if (ch === 34) {
result += text.substring(start, pos);
pos++;
break;
}
if (ch === 92) {
result += text.substring(start, pos);
pos++;
if (pos >= len) {
scanError = 2;
break;
}
const ch2 = text.charCodeAt(pos++);
switch (ch2) {
case 34:
result += '"';
break;
case 92:
result += "\\";
break;
case 47:
result += "/";
break;
case 98:
result += "\b";
break;
case 102:
result += "\f";
break;
case 110:
result += `
`;
break;
case 114:
result += "\r";
break;
case 116:
result += "\t";
break;
case 117:
const ch3 = scanHexDigits(4, true);
if (ch3 >= 0) {
result += String.fromCharCode(ch3);
} else {
scanError = 4;
}
break;
default:
scanError = 5;
}
start = pos;
continue;
}
if (ch >= 0 && ch <= 31) {
if (isLineBreak(ch)) {
result += text.substring(start, pos);
scanError = 2;
break;
} else {
scanError = 6;
}
}
pos++;
}
return result;
}
function scanNext() {
value = "";
scanError = 0;
tokenOffset = pos;
lineStartOffset = lineNumber;
prevTokenLineStartOffset = tokenLineStartOffset;
if (pos >= len) {
tokenOffset = len;
return token = 17;
}
let code = text.charCodeAt(pos);
if (isWhiteSpace(code)) {
do {
pos++;
value += String.fromCharCode(code);
code = text.charCodeAt(pos);
} while (isWhiteSpace(code));
return token = 15;
}
if (isLineBreak(code)) {
pos++;
value += String.fromCharCode(code);
if (code === 13 && text.charCodeAt(pos) === 10) {
pos++;
value += `
`;
}
lineNumber++;
tokenLineStartOffset = pos;
return token = 14;
}
switch (code) {
case 123:
pos++;
return token = 1;
case 125:
pos++;
return token = 2;
case 91:
pos++;
return token = 3;
case 93:
pos++;
return token = 4;
case 58:
pos++;
return token = 6;
case 44:
pos++;
return token = 5;
case 34:
pos++;
value = scanString();
return token = 10;
case 47:
const start = pos - 1;
if (text.charCodeAt(pos + 1) === 47) {
pos += 2;
while (pos < len) {
if (isLineBreak(text.charCodeAt(pos))) {
break;
}
pos++;
}
value = text.substring(start, pos);
return token = 12;
}
if (text.charCodeAt(pos + 1) === 42) {
pos += 2;
const safeLength = len - 1;
let commentClosed = false;
while (pos < safeLength) {
const ch = text.charCodeAt(pos);
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
pos += 2;
commentClosed = true;
break;
}
pos++;
if (isLineBreak(ch)) {
if (ch === 13 && text.charCodeAt(pos) === 10) {
pos++;
}
lineNumber++;
tokenLineStartOffset = pos;
}
}
if (!commentClosed) {
pos++;
scanError = 1;
}
value = text.substring(start, pos);
return token = 13;
}
value += String.fromCharCode(code);
pos++;
return token = 16;
case 45:
value += String.fromCharCode(code);
pos++;
if (pos === len || !isDigit(text.charCodeAt(pos))) {
return token = 16;
}
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
value += scanNumber();
return token = 11;
default:
while (pos < len && isUnknownContentCharacter(code)) {
pos++;
code = text.charCodeAt(pos);
}
if (tokenOffset !== pos) {
value = text.substring(tokenOffset, pos);
switch (value) {
case "true":
return token = 8;
case "false":
return token = 9;
case "null":
return token = 7;
}
return token = 16;
}
value += String.fromCharCode(code);
pos++;
return token = 16;
}
}
function isUnknownContentCharacter(code) {
if (isWhiteSpace(code) || isLineBreak(code)) {
return false;
}
switch (code) {
case 125:
case 93:
case 123:
case 91:
case 34:
case 58:
case 44:
case 47:
return false;
}
return true;
}
function scanNextNonTrivia() {
let result;
do {
result = scanNext();
} while (result >= 12 && result <= 15);
return result;
}
return {
setPosition,
getPosition: () => pos,
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
getToken: () => token,
getTokenValue: () => value,
getTokenOffset: () => tokenOffset,
getTokenLength: () => pos - tokenOffset,
getTokenStartLine: () => lineStartOffset,
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
getTokenError: () => scanError
};
}
function isWhiteSpace(ch) {
return ch === 32 || ch === 9;
}
function isLineBreak(ch) {
return ch === 10 || ch === 13;
}
function isDigit(ch) {
return ch >= 48 && ch <= 57;
}
var CharacterCodes;
var init_scanner = __esm(() => {
(function(CharacterCodes2) {
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
})(CharacterCodes || (CharacterCodes = {}));
});
// node_modules/jsonc-parser/lib/esm/impl/string-intern.js
var cachedSpaces, maxCachedValues = 200, cachedBreakLinesWithSpaces;
var init_string_intern = __esm(() => {
cachedSpaces = new Array(20).fill(0).map((_, index) => {
return " ".repeat(index);
});
cachedBreakLinesWithSpaces = {
" ": {
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
return `
` + " ".repeat(index);
}),
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
return "\r" + " ".repeat(index);
}),
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
return `\r
` + " ".repeat(index);
})
},
"\t": {
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
return `
` + "\t".repeat(index);
}),
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
return "\r" + "\t".repeat(index);
}),
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
return `\r
` + "\t".repeat(index);
})
}
};
});
// node_modules/jsonc-parser/lib/esm/impl/format.js
var init_format = __esm(() => {
init_scanner();
init_string_intern();
});
// node_modules/jsonc-parser/lib/esm/impl/parser.js
function parse(text, errors = [], options = ParseOptions.DEFAULT) {
let currentProperty = null;
let currentParent = [];
const previousParents = [];
function onValue(value) {
if (Array.isArray(currentParent)) {
currentParent.push(value);
} else if (currentProperty !== null) {
currentParent[currentProperty] = value;
}
}
const visitor = {
onObjectBegin: () => {
const object = {};
onValue(object);
previousParents.push(currentParent);
currentParent = object;
currentProperty = null;
},
onObjectProperty: (name) => {
currentProperty = name;
},
onObjectEnd: () => {
currentParent = previousParents.pop();
},
onArrayBegin: () => {
const array = [];
onValue(array);
previousParents.push(currentParent);
currentParent = array;
currentProperty = null;
},
onArrayEnd: () => {
currentParent = previousParents.pop();
},
onLiteralValue: onValue,
onError: (error, offset, length) => {
errors.push({ error, offset, length });
}
};
visit(text, visitor, options);
return currentParent[0];
}
function visit(text, visitor, options = ParseOptions.DEFAULT) {
const _scanner = createScanner(text, false);
const _jsonPath = [];
let suppressedCallbacks = 0;
function toNoArgVisit(visitFunction) {
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
}
function toOneArgVisit(visitFunction) {
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
}
function toOneArgVisitWithPath(visitFunction) {
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
}
function toBeginVisit(visitFunction) {
return visitFunction ? () => {
if (suppressedCallbacks > 0) {
suppressedCallbacks++;
} else {
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
if (cbReturn === false) {
suppressedCallbacks = 1;
}
}
} : () => true;
}
function toEndVisit(visitFunction) {
return visitFunction ? () => {
if (suppressedCallbacks > 0) {
suppressedCallbacks--;
}
if (suppressedCallbacks === 0) {
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
}
} : () => true;
}
const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
const disallowComments = options && options.disallowComments;
const allowTrailingComma = options && options.allowTrailingComma;
function scanNext() {
while (true) {
const token = _scanner.scan();
switch (_scanner.getTokenError()) {
case 4:
handleError(14);
break;
case 5:
handleError(15);
break;
case 3:
handleError(13);
break;
case 1:
if (!disallowComments) {
handleError(11);
}
break;
case 2:
handleError(12);
break;
case 6:
handleError(16);
break;
}
switch (token) {
case 12:
case 13:
if (disallowComments) {
handleError(10);
} else {
onComment();
}
break;
case 16:
handleError(1);
break;
case 15:
case 14:
break;
default:
return token;
}
}
}
function handleError(error, skipUntilAfter = [], skipUntil = []) {
onError(error);
if (skipUntilAfter.length + skipUntil.length > 0) {
let token = _scanner.getToken();
while (token !== 17) {
if (skipUntilAfter.indexOf(token) !== -1) {
scanNext();
break;
} else if (skipUntil.indexOf(token) !== -1) {
break;
}
token = scanNext();
}
}
}
function parseString(isValue) {
const value = _scanner.getTokenValue();
if (isValue) {
onLiteralValue(value);
} else {
onObjectProperty(value);
_jsonPath.push(value);
}
scanNext();
return true;
}
function parseLiteral() {
switch (_scanner.getToken()) {
case 11:
const tokenValue = _scanner.getTokenValue();
let value = Number(tokenValue);
if (isNaN(value)) {
handleError(2);
value = 0;
}
onLiteralValue(value);
break;
case 7:
onLiteralValue(null);
break;
case 8:
onLiteralValue(true);
break;
case 9:
onLiteralValue(false);
break;
default:
return false;
}
scanNext();
return true;
}
function parseProperty() {
if (_scanner.getToken() !== 10) {
handleError(3, [], [2, 5]);
return false;
}
parseString(false);
if (_scanner.getToken() === 6) {
onSeparator(":");
scanNext();
if (!parseValue()) {
handleError(4, [], [2, 5]);
}
} else {
handleError(5, [], [2, 5]);
}
_jsonPath.pop();
return true;
}
function parseObject() {
onObjectBegin();
scanNext();
let needsComma = false;
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
if (_scanner.getToken() === 5) {
if (!needsComma) {
handleError(4, [], []);
}
onSeparator(",");
scanNext();
if (_scanner.getToken() === 2 && allowTrailingComma) {
break;
}
} else if (needsComma) {
handleError(6, [], []);
}
if (!parseProperty()) {
handleError(4, [], [2, 5]);
}
needsComma = true;
}
onObjectEnd();
if (_scanner.getToken() !== 2) {
handleError(7, [2], []);
} else {
scanNext();
}
return true;
}
function parseArray() {
onArrayBegin();
scanNext();
let isFirstElement = true;
let needsComma = false;
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
if (_scanner.getToken() === 5) {
if (!needsComma) {
handleError(4, [], []);
}
onSeparator(",");
scanNext();
if (_scanner.getToken() === 4 && allowTrailingComma) {
break;
}
} else if (needsComma) {
handleError(6, [], []);
}
if (isFirstElement) {
_jsonPath.push(0);
isFirstElement = false;
} else {
_jsonPath[_jsonPath.length - 1]++;
}
if (!parseValue()) {
handleError(4, [], [4, 5]);
}
needsComma = true;
}
onArrayEnd();
if (!isFirstElement) {
_jsonPath.pop();
}
if (_scanner.getToken() !== 4) {
handleError(8, [4], []);
} else {
scanNext();
}
return true;
}
function parseValue() {
switch (_scanner.getToken()) {
case 3:
return parseArray();
case 1:
return parseObject();
case 10:
return parseString(true);
default:
return parseLiteral();
}
}
scanNext();
if (_scanner.getToken() === 17) {
if (options.allowEmptyContent) {
return true;
}
handleError(4, [], []);
return false;
}
if (!parseValue()) {
handleError(4, [], []);
return false;
}
if (_scanner.getToken() !== 17) {
handleError(9, [], []);
}
return true;
}
var ParseOptions;
var init_parser = __esm(() => {
init_scanner();
(function(ParseOptions2) {
ParseOptions2.DEFAULT = {
allowTrailingComma: false
};
})(ParseOptions || (ParseOptions = {}));
});
// node_modules/jsonc-parser/lib/esm/impl/edit.js
var init_edit = __esm(() => {
init_format();
init_parser();
});
// node_modules/jsonc-parser/lib/esm/main.js
function printParseErrorCode(code) {
switch (code) {
case 1:
return "InvalidSymbol";
case 2:
return "InvalidNumberFormat";
case 3:
return "PropertyNameExpected";
case 4:
return "ValueExpected";
case 5:
return "ColonExpected";
case 6:
return "CommaExpected";
case 7:
return "CloseBraceExpected";
case 8:
return "CloseBracketExpected";
case 9:
return "EndOfFileExpected";
case 10:
return "InvalidCommentToken";
case 11:
return "UnexpectedEndOfComment";
case 12:
return "UnexpectedEndOfString";
case 13:
return "UnexpectedEndOfNumber";
case 14:
return "InvalidUnicode";
case 15:
return "InvalidEscapeCharacter";
case 16:
return "InvalidCharacter";
}
return "<unknown ParseErrorCode>";
}
var ScanError, SyntaxKind, parse2, ParseErrorCode;
var init_main = __esm(() => {
init_format();
init_edit();
init_scanner();
init_parser();
(function(ScanError2) {
ScanError2[ScanError2["None"] = 0] = "None";
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
})(ScanError || (ScanError = {}));
(function(SyntaxKind2) {
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
})(SyntaxKind || (SyntaxKind = {}));
parse2 = parse;
(function(ParseErrorCode2) {
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
})(ParseErrorCode || (ParseErrorCode = {}));
});
// src/shared/jsonc-parser.ts
import { existsSync, readFileSync } from "fs";
function parseJsonc(content) {
const errors = [];
const result = parse2(content, errors, {
allowTrailingComma: true,
disallowComments: false
});
if (errors.length > 0) {
const errorMessages = errors.map((e) => `${printParseErrorCode(e.error)} at offset ${e.offset}`).join(", ");
throw new SyntaxError(`JSONC parse error: ${errorMessages}`);
}
return result;
}
function detectConfigFile(basePath) {
const jsoncPath = `${basePath}.jsonc`;
const jsonPath = `${basePath}.json`;
if (existsSync(jsoncPath)) {
return { format: "jsonc", path: jsoncPath };
}
if (existsSync(jsonPath)) {
return { format: "json", path: jsonPath };
}
return { format: "none", path: jsonPath };
}
var init_jsonc_parser = __esm(() => {
init_main();
});
// src/shared/migration/agent-names.ts
function migrateAgentNames(agents) {
const migrated = {};
let changed = false;
for (const [key, value] of Object.entries(agents)) {
const newKey = AGENT_NAME_MAP[key.toLowerCase()] ?? AGENT_NAME_MAP[key] ?? key;
if (newKey !== key) {
changed = true;
}
migrated[newKey] = value;
}
return { migrated, changed };
}
var AGENT_NAME_MAP, BUILTIN_AGENT_NAMES;
var init_agent_names = __esm(() => {
AGENT_NAME_MAP = {
omo: "sisyphus",
OmO: "sisyphus",
Sisyphus: "sisyphus",
sisyphus: "sisyphus",
"OmO-Plan": "prometheus",
"omo-plan": "prometheus",
"Planner-Sisyphus": "prometheus",
"planner-sisyphus": "prometheus",
"Prometheus (Planner)": "prometheus",
prometheus: "prometheus",
"orchestrator-sisyphus": "atlas",
Atlas: "atlas",
atlas: "atlas",
"plan-consultant": "metis",
"Metis (Plan Consultant)": "metis",
metis: "metis",
"Momus (Plan Reviewer)": "momus",
momus: "momus",
"Sisyphus-Junior": "sisyphus-junior",
"sisyphus-junior": "sisyphus-junior",
build: "build",
oracle: "oracle",
librarian: "librarian",
explore: "explore",
"multimodal-looker": "multimodal-looker"
};
BUILTIN_AGENT_NAMES = new Set([
"sisyphus",
"oracle",
"librarian",
"explore",
"multimodal-looker",
"metis",
"momus",
"prometheus",
"atlas",
"build"
]);
});
// src/shared/migration/hook-names.ts
function migrateHookNames(hooks) {
const migrated = [];
const removed = [];
let changed = false;
for (const hook of hooks) {
const mapping = HOOK_NAME_MAP[hook];
if (mapping === null) {
removed.push(hook);
changed = true;
continue;
}
const newHook = mapping ?? hook;
if (newHook !== hook) {
changed = true;
}
migrated.push(newHook);
}
return { migrated, changed, removed };
}
var HOOK_NAME_MAP;
var init_hook_names = __esm(() => {
HOOK_NAME_MAP = {
"anthropic-auto-compact": "anthropic-context-window-limit-recovery",
"sisyphus-orchestrator": "atlas",
"sisyphus-gpt-hephaestus-reminder": "no-sisyphus-gpt",
"empty-message-sanitizer": null
};
});
// src/shared/migration/model-versions.ts
function migrationKey(oldModel, newModel) {
return `model-version:${oldModel}->${newModel}`;
}
function migrateModelVersions(configs, appliedMigrations) {
const migrated = {};
let changed = false;
const newMigrations = [];
for (const [key, value] of Object.entries(configs)) {
if (value && typeof value === "object" && !Array.isArray(value)) {
const config = value;
if (typeof config.model === "string" && MODEL_VERSION_MAP[config.model]) {
const oldModel = config.model;
const newModel = MODEL_VERSION_MAP[oldModel];
const mKey = migrationKey(oldModel, newModel);
if (appliedMigrations?.has(mKey)) {
migrated[key] = value;
continue;
}
migrated[key] = { ...config, model: newModel };
changed = true;
newMigrations.push(mKey);
continue;
}
}
migrated[key] = value;
}
return { migrated, changed, newMigrations };
}
var MODEL_VERSION_MAP;
var init_model_versions = __esm(() => {
MODEL_VERSION_MAP = {
"anthropic/claude-opus-4-5": "anthropic/claude-opus-4-6",
"anthropic/claude-sonnet-4-5": "anthropic/claude-sonnet-4-6"
};
});
// src/shared/migration/agent-category.ts
var init_agent_category = () => {};
// src/shared/migration/config-migration.ts
import * as fs2 from "fs";
function migrateConfigFile(configPath, rawConfig) {
const copy = structuredClone(rawConfig);
let needsWrite = false;
const existingMigrations = Array.isArray(copy._migrations) ? new Set(copy._migrations) : new Set;
const allNewMigrations = [];
if (copy.agents && typeof copy.agents === "object") {
const { migrated, changed } = migrateAgentNames(copy.agents);
if (changed) {
copy.agents = migrated;
needsWrite = true;
}
}
if (copy.agents && typeof copy.agents === "object") {
const { migrated, changed, newMigrations } = migrateModelVersions(copy.agents, existingMigrations);
if (changed) {
copy.agents = migrated;
needsWrite = true;
log("Migrated model versions in agents config");
}
allNewMigrations.push(...newMigrations);
}
if (copy.categories && typeof copy.categories === "object") {
const { migrated, changed, newMigrations } = migrateModelVersions(copy.categories, existingMigrations);
if (changed) {
copy.categories = migrated;
needsWrite = true;
log("Migrated model versions in categories config");
}
allNewMigrations.push(...newMigrations);
}
if (allNewMigrations.length > 0) {
const updatedMigrations = Array.from(existingMigrations);
updatedMigrations.push(...allNewMigrations);
copy._migrations = updatedMigrations;
needsWrite = true;
}
if (copy.omo_agent) {
copy.sisyphus_agent = copy.omo_agent;
delete copy.omo_agent;
needsWrite = true;
}
if (copy.experimental && typeof copy.experimental === "object") {
const experimental = copy.experimental;
if ("hashline_edit" in experimental) {
if (copy.hashline_edit === undefined) {
copy.hashline_edit = experimental.hashline_edit;
}
delete experimental.hashline_edit;
if (Object.keys(experimental).length === 0) {
delete copy.experimental;
}
needsWrite = true;
}
}
if (copy.disabled_agents && Array.isArray(copy.disabled_agents)) {
const migrated = [];
let changed = false;
for (const agent of copy.disabled_agents) {
const newAgent = AGENT_NAME_MAP[agent.toLowerCase()] ?? AGENT_NAME_MAP[agent] ?? agent;
if (newAgent !== agent) {
changed = true;
}
migrated.push(newAgent);
}
if (changed) {
copy.disabled_agents = migrated;
needsWrite = true;
}
}
if (copy.disabled_hooks && Array.isArray(copy.disabled_hooks)) {
const { migrated, changed, removed } = migrateHookNames(copy.disabled_hooks);
if (changed) {
copy.disabled_hooks = migrated;
needsWrite = true;
}
if (removed.length > 0) {
log(`Removed obsolete hooks from disabled_hooks: ${removed.join(", ")} (these hooks no longer exist in v3.0.0)`);
}
}
if (needsWrite) {
const timestamp2 = new Date().toISOString().replace(/[:.]/g, "-");
const backupPath = `${configPath}.bak.${timestamp2}`;
let backupSucceeded = false;
try {
fs2.copyFileSync(configPath, backupPath);
backupSucceeded = true;
} catch {}
let writeSucceeded = false;
try {
fs2.writeFileSync(configPath, JSON.stringify(copy, null, 2) + `
`, "utf-8");
writeSucceeded = true;
} catch (err) {
log(`Failed to write migrated config to ${configPath}:`, err);
}
for (const key of Object.keys(rawConfig)) {
delete rawConfig[key];
}
Object.assign(rawConfig, copy);
if (writeSucceeded) {
const backupMessage = backupSucceeded ? ` (backup: ${backupPath})` : "";
log(`Migrated config file: ${configPath}${backupMessage}`);
} else {
const backupMessage = backupSucceeded ? ` (backup: ${backupPath})` : "";
log(`Applied migrated config in-memory for: ${configPath}${backupMessage}`);
}
}
return needsWrite;
}
var init_config_migration = __esm(() => {
init_logger();
init_agent_names();
init_hook_names();
init_model_versions();
});
// src/shared/migration.ts
var init_migration = __esm(() => {
init_agent_names();
init_hook_names();
init_model_versions();
init_agent_category();
init_config_migration();
});
// src/shared/opencode-config-dir.ts
import { existsSync as existsSync2 } from "fs";
import { homedir as homedir2 } from "os";
import { join as join3, resolve } from "path";
function isDevBuild(version) {
if (!version)
return false;
return version.includes("-dev") || version.includes(".dev");
}
function getTauriConfigDir(identifier) {
const platform = process.platform;
switch (platform) {
case "darwin":
return join3(homedir2(), "Library", "Application Support", identifier);
case "win32": {
const appData = process.env.APPDATA || join3(homedir2(), "AppData", "Roaming");
return join3(appData, identifier);
}
case "linux":
default: {
const xdgConfig = process.env.XDG_CONFIG_HOME || join3(homedir2(), ".config");
return join3(xdgConfig, identifier);
}
}
}
function getCliConfigDir() {
const envConfigDir = process.env.OPENCODE_CONFIG_DIR?.trim();
if (envConfigDir) {
return resolve(envConfigDir);
}
if (process.platform === "win32") {
const crossPlatformDir = join3(homedir2(), ".config", "opencode");
const crossPlatformConfig = join3(crossPlatformDir, "opencode.json");
if (existsSync2(crossPlatformConfig)) {
return crossPlatformDir;
}
const appData = process.env.APPDATA || join3(homedir2(), "AppData", "Roaming");
const appdataDir = join3(appData, "opencode");
const appdataConfig = join3(appdataDir, "opencode.json");
if (existsSync2(appdataConfig)) {
return appdataDir;
}
return crossPlatformDir;
}
const xdgConfig = process.env.XDG_CONFIG_HOME || join3(homedir2(), ".config");
return join3(xdgConfig, "opencode");
}
function getOpenCodeConfigDir(options) {
const { binary: binary2, version, checkExisting = true } = options;
if (binary2 === "opencode") {
return getCliConfigDir();
}
const identifier = isDevBuild(version) ? TAURI_APP_IDENTIFIER_DEV : TAURI_APP_IDENTIFIER;
const tauriDir = getTauriConfigDir(identifier);
if (checkExisting) {
const legacyDir = getCliConfigDir();
const legacyConfig = join3(legacyDir, "opencode.json");
const legacyConfigC = join3(legacyDir, "opencode.jsonc");
if (existsSync2(legacyConfig) || existsSync2(legacyConfigC)) {
return legacyDir;
}
}
return tauriDir;
}
function getOpenCodeConfigPaths(options) {
const configDir = getOpenCodeConfigDir(options);
return {
configDir,
configJson: join3(configDir, "opencode.json"),
configJsonc: join3(configDir, "opencode.jsonc"),
packageJson: join3(configDir, "package.json"),
omoConfig: join3(configDir, "oh-my-opencode.json")
};
}
var TAURI_APP_IDENTIFIER = "ai.opencode.desktop", TAURI_APP_IDENTIFIER_DEV = "ai.opencode.desktop.dev";
var init_opencode_config_dir = () => {};
// src/shared/opencode-version.ts
var NOT_CACHED;
var init_opencode_version = __esm(() => {
NOT_CACHED = Symbol("NOT_CACHED");
});
// src/shared/opencode-storage-detection.ts
var NOT_CACHED2, FALSE_PENDING_RETRY;
var init_opencode_storage_detection = __esm(() => {
init_data_path();
init_opencode_version();
NOT_CACHED2 = Symbol("NOT_CACHED");
FALSE_PENDING_RETRY = Symbol("FALSE_PENDING_RETRY");
});
// src/shared/external-plugin-detector.ts
var init_external_plugin_detector = __esm(() => {
init_logger();
init_jsonc_parser();
});
// src/shared/zip-extractor.ts
var init_zip_extractor = () => {};
// src/shared/binary-downloader.ts
var init_binary_downloader = __esm(() => {
init_zip_extractor();
});
// src/shared/model-requirements.ts
var AGENT_MODEL_REQUIREMENTS, CATEGORY_MODEL_REQUIREMENTS;
var init_model_requirements = __esm(() => {
AGENT_MODEL_REQUIREMENTS = {
sisyphus: {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["opencode-go"], model: "kimi-k2.5" },
{ providers: ["kimi-for-coding"], model: "k2p5" },
{
providers: [
"opencode",
"moonshotai",
"moonshotai-cn",
"firmware",
"ollama-cloud",
"aihubmix"
],
model: "kimi-k2.5"
},
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
{ providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
{ providers: ["opencode"], model: "big-pickle" }
],
requiresAnyModel: true
},
hephaestus: {
fallbackChain: [
{
providers: ["openai", "venice", "opencode"],
model: "gpt-5.3-codex",
variant: "medium"
},
{ providers: ["github-copilot"], model: "gpt-5.4", variant: "medium" }
],
requiresProvider: ["openai", "github-copilot", "venice", "opencode"]
},
oracle: {
fallbackChain: [
{
providers: ["openai", "github-copilot", "opencode"],
model: "gpt-5.4",
variant: "high"
},
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["opencode-go"], model: "glm-5" }
]
},
librarian: {
fallbackChain: [
{ providers: ["opencode-go"], model: "minimax-m2.5" },
{ providers: ["opencode"], model: "minimax-m2.5-free" },
{ providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
{ providers: ["opencode"], model: "gpt-5-nano" }
]
},
explore: {
fallbackChain: [
{ providers: ["github-copilot"], model: "grok-code-fast-1" },
{ providers: ["opencode-go"], model: "minimax-m2.5" },
{ providers: ["opencode"], model: "minimax-m2.5-free" },
{ providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
{ providers: ["opencode"], model: "gpt-5-nano" }
]
},
"multimodal-looker": {
fallbackChain: [
{ providers: ["openai", "opencode"], model: "gpt-5.4", variant: "medium" },
{ providers: ["opencode-go"], model: "kimi-k2.5" },
{ providers: ["zai-coding-plan"], model: "glm-4.6v" },
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5-nano" }
]
},
prometheus: {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{
providers: ["openai", "github-copilot", "opencode"],
model: "gpt-5.4",
variant: "high"
},
{ providers: ["opencode-go"], model: "glm-5" },
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro"
}
]
},
metis: {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["opencode-go"], model: "glm-5" },
{ providers: ["kimi-for-coding"], model: "k2p5" }
]
},
momus: {
fallbackChain: [
{
providers: ["openai", "github-copilot", "opencode"],
model: "gpt-5.4",
variant: "xhigh"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
},
{ providers: ["opencode-go"], model: "glm-5" }
]
},
atlas: {
fallbackChain: [
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-4-6" },
{ providers: ["opencode-go"], model: "kimi-k2.5" }
]
},
"sisyphus-junior": {
fallbackChain: [
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-4-6" },
{ providers: ["opencode-go"], model: "kimi-k2.5" },
{ providers: ["opencode"], model: "big-pickle" }
]
}
};
CATEGORY_MODEL_REQUIREMENTS = {
"visual-engineering": {
fallbackChain: [
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
},
{ providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["opencode-go"], model: "glm-5" },
{ providers: ["kimi-for-coding"], model: "k2p5" }
]
},
ultrabrain: {
fallbackChain: [
{
providers: ["openai", "opencode"],
model: "gpt-5.4",
variant: "xhigh"
},
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["opencode-go"], model: "glm-5" }
]
},
deep: {
fallbackChain: [
{
providers: ["openai", "opencode"],
model: "gpt-5.3-codex",
variant: "medium"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
}
],
requiresModel: "gpt-5.3-codex"
},
artistry: {
fallbackChain: [
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4" }
],
requiresModel: "gemini-3.1-pro"
},
quick: {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-haiku-4-5"
},
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3-flash"
},
{ providers: ["opencode-go"], model: "minimax-m2.5" },
{ providers: ["opencode"], model: "gpt-5-nano" }
]
},
"unspecified-low": {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-sonnet-4-6"
},
{
providers: ["openai", "opencode"],
model: "gpt-5.3-codex",
variant: "medium"
},
{ providers: ["opencode-go"], model: "kimi-k2.5" },
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3-flash"
}
]
},
"unspecified-high": {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{
providers: ["openai", "github-copilot", "opencode"],
model: "gpt-5.4",
variant: "high"
},
{ providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
{ providers: ["kimi-for-coding"], model: "k2p5" },
{ providers: ["opencode-go"], model: "glm-5" },
{ providers: ["opencode"], model: "kimi-k2.5" },
{
providers: [
"opencode",
"moonshotai",
"moonshotai-cn",
"firmware",
"ollama-cloud",
"aihubmix"
],
model: "kimi-k2.5"
}
]
},
writing: {
fallbackChain: [
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3-flash"
},
{ providers: ["opencode-go"], model: "kimi-k2.5" },
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-sonnet-4-6"
}
]
}
};
});
// src/shared/agent-variant.ts
var init_agent_variant = __esm(() => {
init_model_requirements();
});
// src/shared/session-cursor.ts
var sessionCursors;
var init_session_cursor = __esm(() => {
sessionCursors = new Map;
});
// src/shared/system-directive.ts
var init_system_directive = () => {};
// src/shared/agent-tool-restrictions.ts
var init_agent_tool_restrictions = () => {};
// src/shared/connected-providers-cache.ts
import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync } from "fs";
import { join as join4 } from "path";
function getCacheFilePath(filename) {
return join4(getOmoOpenCodeCacheDir(), filename);
}
function ensureCacheDir() {
const cacheDir = getOmoOpenCodeCacheDir();
if (!existsSync3(cacheDir)) {
mkdirSync(cacheDir, { recursive: true });
}
}
function writeConnectedProvidersCache(connected) {
ensureCacheDir();
const cacheFile = getCacheFilePath(CONNECTED_PROVIDERS_CACHE_FILE);
const data = {
connected,
updatedAt: new Date().toISOString()
};
try {
writeFileSync2(cacheFile, JSON.stringify(data, null, 2));
log("[connected-providers-cache] Cache written", { count: connected.length });
} catch (err) {
log("[connected-providers-cache] Error writing cache", { error: String(err) });
}
}
function hasProviderModelsCache() {
const cacheFile = getCacheFilePath(PROVIDER_MODELS_CACHE_FILE);
return existsSync3(cacheFile);
}
function writeProviderModelsCache(data) {
ensureCacheDir();
const cacheFile = getCacheFilePath(PROVIDER_MODELS_CACHE_FILE);
const cacheData = {
...data,
updatedAt: new Date().toISOString()
};
try {
writeFileSync2(cacheFile, JSON.stringify(cacheData, null, 2));
log("[connected-providers-cache] Provider-models cache written", {
providerCount: Object.keys(data.models).length
});
} catch (err) {
log("[connected-providers-cache] Error writing provider-models cache", { error: String(err) });
}
}
async function updateConnectedProvidersCache(client) {
if (!client?.provider?.list) {
log("[connected-providers-cache] client.provider.list not available");
return;
}
try {
const result = await client.provider.list();
const connected = result.data?.connected ?? [];
log("[connected-providers-cache] Fetched connected providers", { count: connected.length, providers: connected });
writeConnectedProvidersCache(connected);
const modelsByProvider = {};
const allProviders = result.data?.all ?? [];
for (const provider of allProviders) {
if (provider.models) {
const modelIds = Object.keys(provider.models);
if (modelIds.length > 0) {
modelsByProvider[provider.id] = modelIds;
}
}
}
log("[connected-providers-cache] Extracted models from provider list", {
providerCount: Object.keys(modelsByProvider).length,
totalModels: Object.values(modelsByProvider).reduce((sum, ids) => sum + ids.length, 0)
});
writeProviderModelsCache({
models: modelsByProvider,
connected
});
} catch (err) {
log("[connected-providers-cache] Error updating cache", { error: String(err) });
}
}
var CONNECTED_PROVIDERS_CACHE_FILE = "connected-providers.json", PROVIDER_MODELS_CACHE_FILE = "provider-models.json";
var init_connected_providers_cache = __esm(() => {
init_logger();
init_data_path();
});
// src/shared/model-availability.ts
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
import { join as join5 } from "path";
function isModelCacheAvailable() {
if (hasProviderModelsCache()) {
return true;
}
const cacheFile = join5(getOpenCodeCacheDir(), "models.json");
return existsSync4(cacheFile);
}
var init_model_availability = __esm(() => {
init_logger();
init_data_path();
init_connected_providers_cache();
});
// src/shared/provider-model-id-transform.ts
function transformModelForProvider(provider, model) {
if (provider === "github-copilot") {
return model.replace("claude-opus-4-6", "claude-opus-4.6").replace("claude-sonnet-4-6", "claude-sonnet-4.6").replace("claude-sonnet-4-5", "claude-sonnet-4.5").replace("claude-haiku-4-5", "claude-haiku-4.5").replace("claude-sonnet-4", "claude-sonnet-4").replace(/gemini-3\.1-pro(?!-)/g, "gemini-3.1-pro-preview").replace(/gemini-3-flash(?!-)/g, "gemini-3-flash-preview");
}
if (provider === "google") {
return model.replace(/gemini-3\.1-pro(?!-)/g, "gemini-3.1-pro-preview").replace(/gemini-3-flash(?!-)/g, "gemini-3-flash-preview");
}
return model;
}
// src/shared/model-resolution-pipeline.ts
var init_model_resolution_pipeline = __esm(() => {
init_logger();
init_connected_providers_cache();
init_model_availability();
});
// src/shared/model-resolver.ts
var init_model_resolver = __esm(() => {
init_model_resolution_pipeline();
});
// src/shared/fallback-model-availability.ts
var init_fallback_model_availability = __esm(() => {
init_connected_providers_cache();
init_logger();
init_model_availability();
});
// src/features/hook-message-injector/constants.ts
var init_constants = __esm(() => {
init_shared();
});
// src/features/hook-message-injector/injector.ts
import { randomBytes } from "crypto";
var processPrefix;
var init_injector = __esm(() => {
init_constants();
init_logger();
init_opencode_storage_detection();
init_shared();
processPrefix = randomBytes(4).toString("hex");
});
// src/features/hook-message-injector/index.ts
var init_hook_message_injector = __esm(() => {
init_injector();
init_constants();
});
// src/shared/opencode-storage-paths.ts
import { join as join6 } from "path";
var OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE, SESSION_STORAGE;
var init_opencode_storage_paths = __esm(() => {
init_data_path();
OPENCODE_STORAGE = getOpenCodeStorageDir();
MESSAGE_STORAGE = join6(OPENCODE_STORAGE, "message");
PART_STORAGE = join6(OPENCODE_STORAGE, "part");
SESSION_STORAGE = join6(OPENCODE_STORAGE, "session");
});
// src/shared/opencode-message-dir.ts
var init_opencode_message_dir = __esm(() => {
init_opencode_storage_paths();
init_opencode_storage_detection();
init_logger();
});
// src/shared/agent-display-names.ts
function getAgentDisplayName(configKey) {
const exactMatch = AGENT_DISPLAY_NAMES[configKey];
if (exactMatch !== undefined)
return exactMatch;
const lowerKey = configKey.toLowerCase();
for (const [k, v] of Object.entries(AGENT_DISPLAY_NAMES)) {
if (k.toLowerCase() === lowerKey)
return v;
}
return configKey;
}
function getAgentConfigKey(agentName) {
const lower = agentName.toLowerCase();
const reversed = REVERSE_DISPLAY_NAMES[lower];
if (reversed !== undefined)
return reversed;
if (AGENT_DISPLAY_NAMES[lower] !== undefined)
return lower;
return lower;
}
var AGENT_DISPLAY_NAMES, REVERSE_DISPLAY_NAMES;
var init_agent_display_names = __esm(() => {
AGENT_DISPLAY_NAMES = {
sisyphus: "Sisyphus (Ultraworker)",
hephaestus: "Hephaestus (Deep Agent)",
prometheus: "Prometheus (Plan Builder)",
atlas: "Atlas (Plan Executor)",
"sisyphus-junior": "Sisyphus-Junior",
metis: "Metis (Plan Consultant)",
momus: "Momus (Plan Critic)",
oracle: "oracle",
librarian: "librarian",
explore: "explore",
"multimodal-looker": "multimodal-looker"
};
REVERSE_DISPLAY_NAMES = Object.fromEntries(Object.entries(AGENT_DISPLAY_NAMES).map(([key, displayName]) => [displayName.toLowerCase(), key]));
});
// src/shared/session-utils.ts
var init_session_utils = __esm(() => {
init_hook_message_injector();
init_opencode_message_dir();
init_opencode_storage_detection();
init_logger();
init_agent_display_names();
});
// src/shared/tmux/constants.ts
var SESSION_TIMEOUT_MS;
var init_constants2 = __esm(() => {
SESSION_TIMEOUT_MS = 10 * 60 * 1000;
});
// src/tools/interactive-bash/tmux-path-resolver.ts
var init_tmux_path_resolver = () => {};
// src/shared/tmux/tmux-utils/pane-dimensions.ts
var init_pane_dimensions = __esm(() => {
init_tmux_path_resolver();
});
// src/shared/tmux/tmux-utils/pane-spawn.ts
var init_pane_spawn = __esm(() => {
init_tmux_path_resolver();
});
// src/shared/tmux/tmux-utils/pane-close.ts
var init_pane_close = __esm(() => {
init_tmux_path_resolver();
});
// src/shared/tmux/tmux-utils/pane-replace.ts
var init_pane_replace = __esm(() => {
init_tmux_path_resolver();
});
// src/shared/tmux/tmux-utils/layout.ts
var init_layout = __esm(() => {
init_tmux_path_resolver();
});
// src/shared/tmux/tmux-utils.ts
var init_tmux_utils = __esm(() => {
init_pane_dimensions();
init_pane_spawn();
init_pane_close();
init_pane_replace();
init_layout();
});
// src/shared/tmux/index.ts
var init_tmux = __esm(() => {
init_constants2();
init_tmux_utils();
});
// src/shared/model-suggestion-retry.ts
var init_model_suggestion_retry = __esm(() => {
init_logger();
});
// src/shared/opencode-server-auth.ts
var init_opencode_server_auth = __esm(() => {
init_logger();
});
// src/shared/opencode-http-api.ts
var init_opencode_http_api = __esm(() => {
init_opencode_server_auth();
init_logger();
});
// src/shared/port-utils.ts
async function isPortAvailable(port, hostname = "127.0.0.1") {
try {
const server = Bun.serve({
port,
hostname,
fetch: () => new Response
});
server.stop(true);
return true;
} catch {
return false;
}
}
async function findAvailablePort(startPort = DEFAULT_SERVER_PORT, hostname = "127.0.0.1") {
for (let attempt = 0;attempt < MAX_PORT_ATTEMPTS; attempt++) {
const port = startPort + attempt;
if (await isPortAvailable(port, hostname)) {
return port;
}
}
throw new Error(`No available port found in range ${startPort}-${startPort + MAX_PORT_ATTEMPTS - 1}`);
}
async function getAvailableServerPort(preferredPort = DEFAULT_SERVER_PORT, hostname = "127.0.0.1") {
if (await isPortAvailable(preferredPort, hostname)) {
return { port: preferredPort, wasAutoSelected: false };
}
const port = await findAvailablePort(preferredPort + 1, hostname);
return { port, wasAutoSelected: true };
}
var DEFAULT_SERVER_PORT = 4096, MAX_PORT_ATTEMPTS = 20;
var init_port_utils = () => {};
// src/shared/git-worktree/parse-status-porcelain.ts
var init_parse_status_porcelain = () => {};
// src/shared/git-worktree/collect-git-diff-stats.ts
var init_collect_git_diff_stats = __esm(() => {
init_parse_status_porcelain();
});
// src/shared/git-worktree/index.ts
var init_git_worktree = __esm(() => {
init_parse_status_porcelain();
init_collect_git_diff_stats();
});
// src/shared/safe-create-hook.ts
var init_safe_create_hook = __esm(() => {
init_logger();
});
// src/shared/opencode-command-dirs.ts
var init_opencode_command_dirs = __esm(() => {
init_opencode_config_dir();
});
// src/shared/session-directory-resolver.ts
var init_session_directory_resolver = () => {};
// src/shared/session-tools-store.ts
var store;
var init_session_tools_store = __esm(() => {
store = new Map;
});
// src/shared/prompt-tools.ts
var init_prompt_tools = __esm(() => {
init_session_tools_store();
});
// src/features/claude-code-plugin-loader/discovery.ts
var init_discovery = __esm(() => {
init_logger();
});
// src/features/claude-code-plugin-loader/command-loader.ts
var init_command_loader = __esm(() => {
init_frontmatter();
init_file_utils();
init_logger();
});
// src/shared/skill-path-resolver.ts
var init_skill_path_resolver = () => {};
// src/features/claude-code-plugin-loader/skill-loader.ts
var init_skill_loader = __esm(() => {
init_frontmatter();
init_file_utils();
init_skill_path_resolver();
init_logger();
});
// src/features/claude-code-agent-loader/claude-model-mapper.ts
var ANTHROPIC_PREFIX = "anthropic/", CLAUDE_CODE_ALIAS_MAP;
var init_claude_model_mapper = __esm(() => {
CLAUDE_CODE_ALIAS_MAP = new Map([
["sonnet", `${ANTHROPIC_PREFIX}claude-sonnet-4-6`],
["opus", `${ANTHROPIC_PREFIX}claude-opus-4-6`],
["haiku", `${ANTHROPIC_PREFIX}claude-haiku-4-5`]
]);
});
// src/features/claude-code-plugin-loader/agent-loader.ts
var init_agent_loader = __esm(() => {
init_frontmatter();
init_file_utils();
init_logger();
init_claude_model_mapper();
});
// src/features/claude-code-mcp-loader/transformer.ts
var init_transformer = () => {};
// src/features/claude-code-plugin-loader/mcp-server-loader.ts
var init_mcp_server_loader = __esm(() => {
init_transformer();
init_logger();
});
// src/features/claude-code-plugin-loader/hook-loader.ts
var init_hook_loader = __esm(() => {
init_logger();
});
// src/features/claude-code-plugin-loader/loader.ts
var init_loader = __esm(() => {
init_logger();
init_discovery();
init_command_loader();
init_skill_loader();
init_agent_loader();
init_mcp_server_loader();
init_hook_loader();
init_discovery();
init_command_loader();
init_skill_loader();
init_agent_loader();
init_mcp_server_loader();
init_hook_loader();
});
// src/features/claude-code-plugin-loader/index.ts
var init_claude_code_plugin_loader = __esm(() => {
init_loader();
init_discovery();
init_command_loader();
init_skill_loader();
init_agent_loader();
init_mcp_server_loader();
init_hook_loader();
});
// src/shared/plugin-command-discovery.ts
var init_plugin_command_discovery = __esm(() => {
init_claude_code_plugin_loader();
});
// src/shared/session-category-registry.ts
var sessionCategoryMap;
var init_session_category_registry = __esm(() => {
sessionCategoryMap = new Map;
});
// src/shared/index.ts
var init_shared = __esm(() => {
init_model_resolver();
init_model_resolution_pipeline();
init_session_category_registry();
init_frontmatter();
init_command_executor();
init_file_reference_resolver();
init_logger();
init_snake_case();
init_tool_name();
init_deep_merge();
init_file_utils();
init_dynamic_truncator();
init_data_path();
init_config_errors();
init_claude_config_dir();
init_jsonc_parser();
init_migration();
init_opencode_config_dir();
init_opencode_version();
init_opencode_storage_detection();
init_external_plugin_detector();
init_zip_extractor();
init_binary_downloader();
init_agent_variant();
init_session_cursor();
init_system_directive();
init_agent_tool_restrictions();
init_model_requirements();
init_model_resolver();
init_model_availability();
init_fallback_model_availability();
init_connected_providers_cache();
init_context_limit_resolver();
init_session_utils();
init_tmux();
init_model_suggestion_retry();
init_opencode_server_auth();
init_opencode_http_api();
init_port_utils();
init_git_worktree();
init_safe_create_hook();
init_opencode_storage_paths();
init_opencode_message_dir();
init_opencode_command_dirs();
init_session_directory_resolver();
init_prompt_tools();
init_plugin_command_discovery();
});
// src/cli/config-manager/config-context.ts
function initConfigContext(binary2, version) {
const paths = getOpenCodeConfigPaths({ binary: binary2, version });
configContext = { binary: binary2, version, paths };
}
function getConfigContext() {
if (!configContext) {
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
configContext = { binary: "opencode", version: null, paths };
}
return configContext;
}
function getConfigDir() {
return getConfigContext().paths.configDir;
}
function getConfigJson() {
return getConfigContext().paths.configJson;
}
function getConfigJsonc() {
return getConfigContext().paths.configJsonc;
}
function getOmoConfigPath() {
return getConfigContext().paths.omoConfig;
}
var configContext = null;
var init_config_context = __esm(() => {
init_shared();
});
// src/cli/config-manager/npm-dist-tags.ts
async function fetchNpmDistTags(packageName) {
try {
const res = await fetch(`https://registry.npmjs.org/-/package/${encodeURIComponent(packageName)}/dist-tags`, {
signal: AbortSignal.timeout(NPM_FETCH_TIMEOUT_MS)
});
if (!res.ok)
return null;
const data = await res.json();
return data;
} catch {
return null;
}
}
var NPM_FETCH_TIMEOUT_MS = 5000;
// src/cli/config-manager/plugin-name-with-version.ts
function getFallbackEntry(version, packageName) {
const prereleaseMatch = version.match(/-([a-zA-Z][a-zA-Z0-9-]*)(?:\.|$)/);
if (prereleaseMatch) {
return `${packageName}@${prereleaseMatch[1]}`;
}
return packageName;
}
async function getPluginNameWithVersion(currentVersion, packageName = DEFAULT_PACKAGE_NAME) {
const distTags = await fetchNpmDistTags(NEW_PACKAGE_NAME);
if (distTags) {
const allTags = new Set([...PRIORITIZED_TAGS, ...Object.keys(distTags)]);
for (const tag of allTags) {
if (distTags[tag] === currentVersion) {
return `${packageName}@${tag}`;
}
}
}
return getFallbackEntry(currentVersion, packageName);
}
var DEFAULT_PACKAGE_NAME = "oh-my-opencode", NEW_PACKAGE_NAME = "oh-my-openagent", PRIORITIZED_TAGS;
var init_plugin_name_with_version = __esm(() => {
PRIORITIZED_TAGS = ["latest", "beta", "next"];
});
// src/cli/config-manager/ensure-config-directory-exists.ts
import { existsSync as existsSync5, mkdirSync as mkdirSync2 } from "fs";
function ensureConfigDirectoryExists() {
const configDir = getConfigDir();
if (!existsSync5(configDir)) {
mkdirSync2(configDir, { recursive: true });
}
}
var init_ensure_config_directory_exists = __esm(() => {
init_config_context();
});
// src/cli/config-manager/format-error-with-suggestion.ts
function isPermissionError(err) {
const nodeErr = err;
return nodeErr?.code === "EACCES" || nodeErr?.code === "EPERM";
}
function isFileNotFoundError(err) {
const nodeErr = err;
return nodeErr?.code === "ENOENT";
}
function formatErrorWithSuggestion(err, context) {
if (isPermissionError(err)) {
return `Permission denied: Cannot ${context}. Try running with elevated permissions or check file ownership.`;
}
if (isFileNotFoundError(err)) {
return `File not found while trying to ${context}. The file may have been deleted or moved.`;
}
if (err instanceof SyntaxError) {
return `JSON syntax error while trying to ${context}: ${err.message}. Check for missing commas, brackets, or invalid characters.`;
}
const message = err instanceof Error ? err.message : String(err);
if (message.includes("ENOSPC")) {
return `Disk full: Cannot ${context}. Free up disk space and try again.`;
}
if (message.includes("EROFS")) {
return `Read-only filesystem: Cannot ${context}. Check if the filesystem is mounted read-only.`;
}
return `Failed to ${context}: ${message}`;
}
// src/cli/config-manager/opencode-config-format.ts
import { existsSync as existsSync6 } from "fs";
function detectConfigFormat() {
const configJsonc = getConfigJsonc();
const configJson = getConfigJson();
if (existsSync6(configJsonc)) {
return { format: "jsonc", path: configJsonc };
}
if (existsSync6(configJson)) {
return { format: "json", path: configJson };
}
return { format: "none", path: configJson };
}
var init_opencode_config_format = __esm(() => {
init_config_context();
});
// src/cli/config-manager/parse-opencode-config-file.ts
import { readFileSync as readFileSync4, statSync } from "fs";
function isEmptyOrWhitespace(content) {
return content.trim().length === 0;
}
function parseOpenCodeConfigFileWithError(path3) {
try {
const stat = statSync(path3);
if (stat.size === 0) {
return { config: null, error: `Config file is empty: ${path3}. Delete it or add valid JSON content.` };
}
const content = readFileSync4(path3, "utf-8");
if (isEmptyOrWhitespace(content)) {
return { config: null, error: `Config file contains only whitespace: ${path3}. Delete it or add valid JSON content.` };
}
const config = parseJsonc(content);
if (config === null || config === undefined) {
return { config: null, error: `Config file parsed to null/undefined: ${path3}. Ensure it contains valid JSON.` };
}
if (typeof config !== "object" || Array.isArray(config)) {
return {
config: null,
error: `Config file must contain a JSON object, not ${Array.isArray(config) ? "an array" : typeof config}: ${path3}`
};
}
return { config };
} catch (err) {
return { config: null, error: formatErrorWithSuggestion(err, `parse config file ${path3}`) };
}
}
var init_parse_opencode_config_file = __esm(() => {
init_shared();
});
// src/cli/config-manager/add-plugin-to-opencode-config.ts
import { readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
async function addPluginToOpenCodeConfig(currentVersion) {
try {
ensureConfigDirectoryExists();
} catch (err) {
return {
success: false,
configPath: getConfigDir(),
error: formatErrorWithSuggestion(err, "create config directory")
};
}
const { format: format2, path: path3 } = detectConfigFormat();
const pluginEntry = await getPluginNameWithVersion(currentVersion, NEW_PACKAGE_NAME2);
try {
if (format2 === "none") {
const config2 = { plugin: [pluginEntry] };
writeFileSync3(path3, JSON.stringify(config2, null, 2) + `
`);
return { success: true, configPath: path3 };
}
const parseResult = parseOpenCodeConfigFileWithError(path3);
if (!parseResult.config) {
return {
success: false,
configPath: path3,
error: parseResult.error ?? "Failed to parse config file"
};
}
const config = parseResult.config;
const plugins = config.plugin ?? [];
const existingIndex = plugins.findIndex((p) => p === OLD_PACKAGE_NAME || p.startsWith(`${OLD_PACKAGE_NAME}@`) || p === NEW_PACKAGE_NAME2 || p.startsWith(`${NEW_PACKAGE_NAME2}@`));
if (existingIndex !== -1) {
if (plugins[existingIndex] === pluginEntry) {
return { success: true, configPath: path3 };
}
plugins[existingIndex] = pluginEntry;
} else {
plugins.push(pluginEntry);
}
config.plugin = plugins;
if (format2 === "jsonc") {
const content = readFileSync5(path3, "utf-8");
const pluginArrayRegex = /"plugin"\s*:\s*\[([\s\S]*?)\]/;
const match = content.match(pluginArrayRegex);
if (match) {
const formattedPlugins = plugins.map((p) => `"${p}"`).join(`,
`);
const newContent = content.replace(pluginArrayRegex, `"plugin": [
${formattedPlugins}
]`);
writeFileSync3(path3, newContent);
} else {
const newContent = content.replace(/(\{)/, `$1
"plugin": ["${pluginEntry}"],`);
writeFileSync3(path3, newContent);
}
} else {
writeFileSync3(path3, JSON.stringify(config, null, 2) + `
`);
}
return { success: true, configPath: path3 };
} catch (err) {
return {
success: false,
configPath: path3,
error: formatErrorWithSuggestion(err, "update opencode config")
};
}
}
var OLD_PACKAGE_NAME = "oh-my-opencode", NEW_PACKAGE_NAME2 = "oh-my-openagent";
var init_add_plugin_to_opencode_config = __esm(() => {
init_config_context();
init_ensure_config_directory_exists();
init_opencode_config_format();
init_parse_opencode_config_file();
init_plugin_name_with_version();
});
// src/cli/model-fallback-requirements.ts
var CLI_AGENT_MODEL_REQUIREMENTS, CLI_CATEGORY_MODEL_REQUIREMENTS;
var init_model_fallback_requirements = __esm(() => {
CLI_AGENT_MODEL_REQUIREMENTS = {
sisyphus: {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["opencode-go"], model: "kimi-k2.5" },
{ providers: ["kimi-for-coding"], model: "k2p5" },
{ providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4", variant: "medium" },
{ providers: ["zai-coding-plan", "opencode"], model: "glm-5" }
],
requiresAnyModel: true
},
hephaestus: {
fallbackChain: [
{
providers: ["openai", "opencode"],
model: "gpt-5.3-codex",
variant: "medium"
}
],
requiresProvider: ["openai", "opencode"]
},
oracle: {
fallbackChain: [
{
providers: ["openai", "github-copilot", "opencode"],
model: "gpt-5.4",
variant: "high"
},
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["opencode-go"], model: "glm-5" }
]
},
librarian: {
fallbackChain: [
{ providers: ["opencode-go"], model: "minimax-m2.5" },
{ providers: ["opencode"], model: "minimax-m2.5-free" },
{ providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
{ providers: ["opencode"], model: "gpt-5-nano" }
]
},
explore: {
fallbackChain: [
{ providers: ["github-copilot"], model: "grok-code-fast-1" },
{ providers: ["opencode-go"], model: "minimax-m2.5" },
{ providers: ["anthropic", "opencode"], model: "claude-haiku-4-5" },
{ providers: ["opencode"], model: "gpt-5-nano" }
]
},
"multimodal-looker": {
fallbackChain: [
{ providers: ["openai", "opencode"], model: "gpt-5.4", variant: "medium" },
{ providers: ["opencode-go"], model: "kimi-k2.5" },
{ providers: ["zai-coding-plan"], model: "glm-4.6v" },
{ providers: ["opencode"], model: "gpt-5-nano" }
]
},
prometheus: {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["kimi-for-coding"], model: "k2p5" },
{
providers: ["openai", "github-copilot", "opencode"],
model: "gpt-5.4",
variant: "high"
},
{ providers: ["opencode-go"], model: "glm-5" },
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro"
}
]
},
metis: {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["opencode-go"], model: "glm-5" },
{ providers: ["kimi-for-coding"], model: "k2p5" }
]
},
momus: {
fallbackChain: [
{
providers: ["openai", "github-copilot", "opencode"],
model: "gpt-5.4",
variant: "xhigh"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
},
{ providers: ["opencode-go"], model: "glm-5" }
]
},
atlas: {
fallbackChain: [
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-4-5" },
{ providers: ["opencode-go"], model: "kimi-k2.5" }
]
},
"sisyphus-junior": {
fallbackChain: [
{ providers: ["anthropic", "github-copilot", "opencode"], model: "claude-sonnet-4-6" },
{ providers: ["opencode-go"], model: "kimi-k2.5" },
{ providers: ["opencode"], model: "big-pickle" }
]
}
};
CLI_CATEGORY_MODEL_REQUIREMENTS = {
"visual-engineering": {
fallbackChain: [
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
},
{ providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["kimi-for-coding"], model: "k2p5" },
{ providers: ["opencode-go"], model: "glm-5" }
]
},
ultrabrain: {
fallbackChain: [
{
providers: ["openai", "opencode"],
model: "gpt-5.3-codex",
variant: "xhigh"
},
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["opencode-go"], model: "glm-5" }
]
},
deep: {
fallbackChain: [
{
providers: ["openai", "opencode"],
model: "gpt-5.3-codex",
variant: "medium"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
}
],
requiresModel: "gpt-5.3-codex"
},
artistry: {
fallbackChain: [
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3.1-pro",
variant: "high"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{
providers: ["openai", "github-copilot", "opencode"],
model: "gpt-5.4"
}
],
requiresModel: "gemini-3.1-pro"
},
quick: {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-haiku-4-5"
},
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3-flash"
},
{ providers: ["opencode-go"], model: "minimax-m2.5" },
{ providers: ["opencode"], model: "gpt-5-nano" }
]
},
"unspecified-low": {
fallbackChain: [
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-sonnet-4-5"
},
{
providers: ["openai", "opencode"],
model: "gpt-5.3-codex",
variant: "medium"
},
{ providers: ["opencode-go"], model: "kimi-k2.5" },
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3-flash"
}
]
},
"unspecified-high": {
fallbackChain: [
{
providers: ["openai", "github-copilot", "opencode"],
model: "gpt-5.4",
variant: "high"
},
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-opus-4-6",
variant: "max"
},
{ providers: ["zai-coding-plan", "opencode"], model: "glm-5" },
{ providers: ["kimi-for-coding"], model: "k2p5" },
{ providers: ["opencode"], model: "kimi-k2.5" },
{ providers: ["opencode-go"], model: "glm-5" }
]
},
writing: {
fallbackChain: [
{ providers: ["kimi-for-coding"], model: "k2p5" },
{
providers: ["google", "github-copilot", "opencode"],
model: "gemini-3-flash"
},
{ providers: ["opencode-go"], model: "kimi-k2.5" },
{
providers: ["anthropic", "github-copilot", "opencode"],
model: "claude-sonnet-4-5"
}
]
}
};
});
// src/cli/openai-only-model-catalog.ts
function isOpenAiOnlyAvailability(availability) {
return availability.native.openai && !availability.native.claude && !availability.native.gemini && !availability.opencodeZen && !availability.copilot && !availability.zai && !availability.kimiForCoding;
}
function applyOpenAiOnlyModelCatalog(config) {
return {
...config,
agents: {
...config.agents,
...OPENAI_ONLY_AGENT_OVERRIDES
},
categories: {
...config.categories,
...OPENAI_ONLY_CATEGORY_OVERRIDES
}
};
}
var OPENAI_ONLY_AGENT_OVERRIDES, OPENAI_ONLY_CATEGORY_OVERRIDES;
var init_openai_only_model_catalog = __esm(() => {
OPENAI_ONLY_AGENT_OVERRIDES = {
explore: { model: "openai/gpt-5.4", variant: "medium" },
librarian: { model: "openai/gpt-5.4", variant: "medium" }
};
OPENAI_ONLY_CATEGORY_OVERRIDES = {
artistry: { model: "openai/gpt-5.4", variant: "xhigh" },
quick: { model: "openai/gpt-5.3-codex", variant: "low" },
"visual-engineering": { model: "openai/gpt-5.4", variant: "high" },
writing: { model: "openai/gpt-5.4", variant: "medium" }
};
});
// src/cli/provider-availability.ts
function toProviderAvailability(config) {
return {
native: {
claude: config.hasClaude,
openai: config.hasOpenAI,
gemini: config.hasGemini
},
opencodeZen: config.hasOpencodeZen,
copilot: config.hasCopilot,
zai: config.hasZaiCodingPlan,
kimiForCoding: config.hasKimiForCoding,
opencodeGo: config.hasOpencodeGo,
isMaxPlan: config.isMax20
};
}
function isProviderAvailable(provider, availability) {
const mapping = {
anthropic: availability.native.claude,
openai: availability.native.openai,
google: availability.native.gemini,
"github-copilot": availability.copilot,
opencode: availability.opencodeZen,
"zai-coding-plan": availability.zai,
"kimi-for-coding": availability.kimiForCoding,
"opencode-go": availability.opencodeGo
};
return mapping[provider] ?? false;
}
// src/cli/provider-model-id-transform.ts
var init_provider_model_id_transform = () => {};
// src/cli/fallback-chain-resolution.ts
function resolveModelFromChain(fallbackChain, availability) {
for (const entry of fallbackChain) {
for (const provider of entry.providers) {
if (isProviderAvailable(provider, availability)) {
const transformedModel = transformModelForProvider(provider, entry.model);
return {
model: `${provider}/${transformedModel}`,
variant: entry.variant
};
}
}
}
return null;
}
function getSisyphusFallbackChain() {
return CLI_AGENT_MODEL_REQUIREMENTS.sisyphus.fallbackChain;
}
function isAnyFallbackEntryAvailable(fallbackChain, availability) {
return fallbackChain.some((entry) => entry.providers.some((provider) => isProviderAvailable(provider, availability)));
}
function isRequiredModelAvailable(requiresModel, fallbackChain, availability) {
const matchingEntry = fallbackChain.find((entry) => entry.model === requiresModel);
if (!matchingEntry)
return false;
return matchingEntry.providers.some((provider) => isProviderAvailable(provider, availability));
}
function isRequiredProviderAvailable(requiredProviders, availability) {
return requiredProviders.some((provider) => isProviderAvailable(provider, availability));
}
var init_fallback_chain_resolution = __esm(() => {
init_model_fallback_requirements();
init_provider_model_id_transform();
});
// src/cli/model-fallback.ts
function generateModelConfig(config) {
const avail = toProviderAvailability(config);
const hasAnyProvider = avail.native.claude || avail.native.openai || avail.native.gemini || avail.opencodeZen || avail.copilot || avail.zai || avail.kimiForCoding || avail.opencodeGo;
if (!hasAnyProvider) {
return {
$schema: SCHEMA_URL,
agents: Object.fromEntries(Object.entries(CLI_AGENT_MODEL_REQUIREMENTS).filter(([role, req]) => !(role === "sisyphus" && req.requiresAnyModel)).map(([role]) => [role, { model: ULTIMATE_FALLBACK }])),
categories: Object.fromEntries(Object.keys(CLI_CATEGORY_MODEL_REQUIREMENTS).map((cat) => [cat, { model: ULTIMATE_FALLBACK }]))
};
}
const agents = {};
const categories = {};
for (const [role, req] of Object.entries(CLI_AGENT_MODEL_REQUIREMENTS)) {
if (role === "librarian") {
if (avail.opencodeGo) {
agents[role] = { model: "opencode-go/minimax-m2.5" };
} else if (avail.zai) {
agents[role] = { model: ZAI_MODEL };
}
continue;
}
if (role === "explore") {
if (avail.native.claude) {
agents[role] = { model: "anthropic/claude-haiku-4-5" };
} else if (avail.opencodeZen) {
agents[role] = { model: "opencode/claude-haiku-4-5" };
} else if (avail.opencodeGo) {
agents[role] = { model: "opencode-go/minimax-m2.5" };
} else if (avail.copilot) {
agents[role] = { model: "github-copilot/gpt-5-mini" };
} else {
agents[role] = { model: "opencode/gpt-5-nano" };
}
continue;
}
if (role === "sisyphus") {
const fallbackChain = getSisyphusFallbackChain();
if (req.requiresAnyModel && !isAnyFallbackEntryAvailable(fallbackChain, avail)) {
continue;
}
const resolved2 = resolveModelFromChain(fallbackChain, avail);
if (resolved2) {
const variant = resolved2.variant ?? req.variant;
agents[role] = variant ? { model: resolved2.model, variant } : { model: resolved2.model };
}
continue;
}
if (req.requiresModel && !isRequiredModelAvailable(req.requiresModel, req.fallbackChain, avail)) {
continue;
}
if (req.requiresProvider && !isRequiredProviderAvailable(req.requiresProvider, avail)) {
continue;
}
const resolved = resolveModelFromChain(req.fallbackChain, avail);
if (resolved) {
const variant = resolved.variant ?? req.variant;
agents[role] = variant ? { model: resolved.model, variant } : { model: resolved.model };
} else {
agents[role] = { model: ULTIMATE_FALLBACK };
}
}
for (const [cat, req] of Object.entries(CLI_CATEGORY_MODEL_REQUIREMENTS)) {
const fallbackChain = cat === "unspecified-high" && !avail.isMaxPlan ? CLI_CATEGORY_MODEL_REQUIREMENTS["unspecified-low"].fallbackChain : req.fallbackChain;
if (req.requiresModel && !isRequiredModelAvailable(req.requiresModel, req.fallbackChain, avail)) {
continue;
}
if (req.requiresProvider && !isRequiredProviderAvailable(req.requiresProvider, avail)) {
continue;
}
const resolved = resolveModelFromChain(fallbackChain, avail);
if (resolved) {
const variant = resolved.variant ?? req.variant;
categories[cat] = variant ? { model: resolved.model, variant } : { model: resolved.model };
} else {
categories[cat] = { model: ULTIMATE_FALLBACK };
}
}
const generatedConfig = {
$schema: SCHEMA_URL,
agents,
categories
};
return isOpenAiOnlyAvailability(avail) ? applyOpenAiOnlyModelCatalog(generatedConfig) : generatedConfig;
}
var ZAI_MODEL = "zai-coding-plan/glm-4.7", ULTIMATE_FALLBACK = "opencode/glm-4.7-free", SCHEMA_URL = "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json";
var init_model_fallback = __esm(() => {
init_model_fallback_requirements();
init_openai_only_model_catalog();
init_fallback_chain_resolution();
});
// src/cli/config-manager/generate-omo-config.ts
function generateOmoConfig(installConfig) {
return generateModelConfig(installConfig);
}
var init_generate_omo_config = __esm(() => {
init_model_fallback();
});
// src/cli/config-manager/deep-merge-record.ts
function deepMergeRecord(target, source) {
const result = { ...target };
for (const key of Object.keys(source)) {
if (key === "__proto__" || key === "constructor" || key === "prototype")
continue;
const sourceValue = source[key];
const targetValue = result[key];
if (sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && targetValue !== null && typeof targetValue === "object" && !Array.isArray(targetValue)) {
result[key] = deepMergeRecord(targetValue, sourceValue);
} else if (sourceValue !== undefined) {
result[key] = sourceValue;
}
}
return result;
}
// src/cli/config-manager/write-omo-config.ts
import { existsSync as existsSync7, readFileSync as readFileSync6, statSync as statSync2, writeFileSync as writeFileSync4 } from "fs";
function isEmptyOrWhitespace2(content) {
return content.trim().length === 0;
}
function writeOmoConfig(installConfig) {
try {
ensureConfigDirectoryExists();
} catch (err) {
return {
success: false,
configPath: getConfigDir(),
error: formatErrorWithSuggestion(err, "create config directory")
};
}
const omoConfigPath = getOmoConfigPath();
try {
const newConfig = generateOmoConfig(installConfig);
if (existsSync7(omoConfigPath)) {
try {
const stat = statSync2(omoConfigPath);
const content = readFileSync6(omoConfigPath, "utf-8");
if (stat.size === 0 || isEmptyOrWhitespace2(content)) {
writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
`);
return { success: true, configPath: omoConfigPath };
}
const existing = parseJsonc(content);
if (!existing || typeof existing !== "object" || Array.isArray(existing)) {
writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
`);
return { success: true, configPath: omoConfigPath };
}
const merged = deepMergeRecord(newConfig, existing);
writeFileSync4(omoConfigPath, JSON.stringify(merged, null, 2) + `
`);
} catch (parseErr) {
if (parseErr instanceof SyntaxError) {
writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
`);
return { success: true, configPath: omoConfigPath };
}
throw parseErr;
}
} else {
writeFileSync4(omoConfigPath, JSON.stringify(newConfig, null, 2) + `
`);
}
return { success: true, configPath: omoConfigPath };
} catch (err) {
return {
success: false,
configPath: omoConfigPath,
error: formatErrorWithSuggestion(err, "write oh-my-opencode config")
};
}
}
var init_write_omo_config = __esm(() => {
init_shared();
init_config_context();
init_ensure_config_directory_exists();
init_generate_omo_config();
});
// src/shared/spawn-with-windows-hide.ts
var {spawn: bunSpawn } = globalThis.Bun;
import { spawn as nodeSpawn } from "child_process";
import { Readable } from "stream";
function toReadableStream(stream) {
if (!stream) {
return;
}
return Readable.toWeb(stream);
}
function wrapNodeProcess(proc) {
let resolveExited;
let exitCode = null;
const exited = new Promise((resolve2) => {
resolveExited = resolve2;
});
proc.on("exit", (code) => {
exitCode = code ?? 1;
resolveExited(exitCode);
});
proc.on("error", () => {
if (exitCode === null) {
exitCode = 1;
resolveExited(1);
}
});
return {
get exitCode() {
return exitCode;
},
exited,
stdout: toReadableStream(proc.stdout),
stderr: toReadableStream(proc.stderr),
kill(signal) {
try {
if (!signal) {
proc.kill();
return;
}
proc.kill(signal);
} catch {}
}
};
}
function spawnWithWindowsHide(command, options) {
if (process.platform !== "win32") {
return bunSpawn(command, options);
}
const [cmd, ...args] = command;
const proc = nodeSpawn(cmd, args, {
cwd: options.cwd,
env: options.env,
stdio: [options.stdin ?? "pipe", options.stdout ?? "pipe", options.stderr ?? "pipe"],
windowsHide: true,
shell: true
});
return wrapNodeProcess(proc);
}
var init_spawn_with_windows_hide = () => {};
// src/cli/config-manager/opencode-binary.ts
async function findOpenCodeBinaryWithVersion() {
for (const binary2 of OPENCODE_BINARIES) {
try {
const proc = spawnWithWindowsHide([binary2, "--version"], {
stdout: "pipe",
stderr: "pipe"
});
const output = await new Response(proc.stdout).text();
await proc.exited;
if (proc.exitCode === 0) {
const version = output.trim();
initConfigContext(binary2, version);
return { binary: binary2, version };
}
} catch {
continue;
}
}
return null;
}
async function isOpenCodeInstalled() {
const result = await findOpenCodeBinaryWithVersion();
return result !== null;
}
async function getOpenCodeVersion() {
const result = await findOpenCodeBinaryWithVersion();
return result?.version ?? null;
}
var OPENCODE_BINARIES;
var init_opencode_binary = __esm(() => {
init_spawn_with_windows_hide();
init_config_context();
OPENCODE_BINARIES = ["opencode", "opencode-desktop"];
});
// src/cli/config-manager/detect-current-config.ts
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "fs";
function detectProvidersFromOmoConfig() {
const omoConfigPath = getOmoConfigPath();
if (!existsSync8(omoConfigPath)) {
return { hasOpenAI: true, hasOpencodeZen: true, hasZaiCodingPlan: false, hasKimiForCoding: false };
}
try {
const content = readFileSync7(omoConfigPath, "utf-8");
const omoConfig = parseJsonc(content);
if (!omoConfig || typeof omoConfig !== "object") {
return { hasOpenAI: true, hasOpencodeZen: true, hasZaiCodingPlan: false, hasKimiForCoding: false };
}
const configStr = JSON.stringify(omoConfig);
const hasOpenAI = configStr.includes('"openai/');
const hasOpencodeZen = configStr.includes('"opencode/');
const hasZaiCodingPlan = configStr.includes('"zai-coding-plan/');
const hasKimiForCoding = configStr.includes('"kimi-for-coding/');
return { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding };
} catch {
return { hasOpenAI: true, hasOpencodeZen: true, hasZaiCodingPlan: false, hasKimiForCoding: false };
}
}
function detectCurrentConfig() {
const result = {
isInstalled: false,
hasClaude: true,
isMax20: true,
hasOpenAI: true,
hasGemini: false,
hasCopilot: false,
hasOpencodeZen: true,
hasZaiCodingPlan: false,
hasKimiForCoding: false,
hasOpencodeGo: false
};
const { format: format2, path: path3 } = detectConfigFormat();
if (format2 === "none") {
return result;
}
const parseResult = parseOpenCodeConfigFileWithError(path3);
if (!parseResult.config) {
return result;
}
const openCodeConfig = parseResult.config;
const plugins = openCodeConfig.plugin ?? [];
const OLD_PACKAGE_NAME2 = "oh-my-opencode";
const NEW_PACKAGE_NAME3 = "oh-my-openagent";
result.isInstalled = plugins.some((p) => p.startsWith(OLD_PACKAGE_NAME2) || p.startsWith(NEW_PACKAGE_NAME3));
if (!result.isInstalled) {
return result;
}
const providers = openCodeConfig.provider;
result.hasGemini = providers ? "google" in providers : false;
const { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding } = detectProvidersFromOmoConfig();
result.hasOpenAI = hasOpenAI;
result.hasOpencodeZen = hasOpencodeZen;
result.hasZaiCodingPlan = hasZaiCodingPlan;
result.hasKimiForCoding = hasKimiForCoding;
return result;
}
var init_detect_current_config = __esm(() => {
init_shared();
init_config_context();
init_opencode_config_format();
init_parse_opencode_config_file();
});
// src/cli/config-manager/bun-install.ts
import { existsSync as existsSync9 } from "fs";
function readProcessOutput(stream) {
if (!stream) {
return Promise.resolve("");
}
return Bun.readableStreamToText(stream);
}
function logCapturedOutputOnFailure(outputMode, output) {
if (outputMode !== "pipe") {
return;
}
const stdout = output.stdout.trim();
const stderr = output.stderr.trim();
if (!stdout && !stderr) {
return;
}
log("[bun-install] Captured output from failed bun install", {
stdout,
stderr
});
}
async function runBunInstallWithDetails(options) {
const outputMode = options?.outputMode ?? "pipe";
const cacheDir = getOpenCodeCacheDir();
const packageJsonPath = `${cacheDir}/package.json`;
if (!existsSync9(packageJsonPath)) {
return {
success: false,
error: `Workspace not initialized: ${packageJsonPath} not found. OpenCode should create this on first run.`
};
}
try {
const proc = spawnWithWindowsHide(["bun", "install"], {
cwd: cacheDir,
stdout: outputMode,
stderr: outputMode
});
const outputPromise = Promise.all([readProcessOutput(proc.stdout), readProcessOutput(proc.stderr)]).then(([stdout, stderr]) => ({ stdout, stderr }));
let timeoutId;
const timeoutPromise = new Promise((resolve2) => {
timeoutId = setTimeout(() => resolve2("timeout"), BUN_INSTALL_TIMEOUT_MS);
});
const exitPromise = proc.exited.then(() => "completed");
const result = await Promise.race([exitPromise, timeoutPromise]);
if (timeoutId) {
clearTimeout(timeoutId);
}
if (result === "timeout") {
try {
proc.kill();
} catch (err) {
log("[cli/install] Failed to kill timed out bun install process:", err);
}
if (outputMode === "pipe") {
outputPromise.then((output2) => {
logCapturedOutputOnFailure(outputMode, output2);
}).catch((err) => {
log("[bun-install] Failed to read captured output after timeout:", err);
});
}
return {
success: false,
timedOut: true,
error: `bun install timed out after ${BUN_INSTALL_TIMEOUT_SECONDS} seconds. Try running manually: cd "${cacheDir}" && bun i`
};
}
const output = await outputPromise;
if (proc.exitCode !== 0) {
logCapturedOutputOnFailure(outputMode, output);
return {
success: false,
error: `bun install failed with exit code ${proc.exitCode}`
};
}
return { success: true };
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
return {
success: false,
error: `bun install failed: ${message}. Is bun installed? Try: curl -fsSL https://bun.sh/install | bash`
};
}
}
var BUN_INSTALL_TIMEOUT_SECONDS = 60, BUN_INSTALL_TIMEOUT_MS;
var init_bun_install = __esm(() => {
init_data_path();
init_logger();
init_spawn_with_windows_hide();
BUN_INSTALL_TIMEOUT_MS = BUN_INSTALL_TIMEOUT_SECONDS * 1000;
});
// src/cli/config-manager.ts
var init_config_manager = __esm(() => {
init_config_context();
init_plugin_name_with_version();
init_add_plugin_to_opencode_config();
init_generate_omo_config();
init_write_omo_config();
init_opencode_binary();
init_detect_current_config();
init_bun_install();
});
// node_modules/sisteransi/src/index.js
var require_src = __commonJS((exports, module) => {
var ESC = "\x1B";
var CSI = `${ESC}[`;
var beep = "\x07";
var cursor = {
to(x, y) {
if (!y)
return `${CSI}${x + 1}G`;
return `${CSI}${y + 1};${x + 1}H`;
},
move(x, y) {
let ret = "";
if (x < 0)
ret += `${CSI}${-x}D`;
else if (x > 0)
ret += `${CSI}${x}C`;
if (y < 0)
ret += `${CSI}${-y}A`;
else if (y > 0)
ret += `${CSI}${y}B`;
return ret;
},
up: (count = 1) => `${CSI}${count}A`,
down: (count = 1) => `${CSI}${count}B`,
forward: (count = 1) => `${CSI}${count}C`,
backward: (count = 1) => `${CSI}${count}D`,
nextLine: (count = 1) => `${CSI}E`.repeat(count),
prevLine: (count = 1) => `${CSI}F`.repeat(count),
left: `${CSI}G`,
hide: `${CSI}?25l`,
show: `${CSI}?25h`,
save: `${ESC}7`,
restore: `${ESC}8`
};
var scroll = {
up: (count = 1) => `${CSI}S`.repeat(count),
down: (count = 1) => `${CSI}T`.repeat(count)
};
var erase = {
screen: `${CSI}2J`,
up: (count = 1) => `${CSI}1J`.repeat(count),
down: (count = 1) => `${CSI}J`.repeat(count),
line: `${CSI}2K`,
lineEnd: `${CSI}K`,
lineStart: `${CSI}1K`,
lines(count) {
let clear = "";
for (let i2 = 0;i2 < count; i2++)
clear += this.line + (i2 < count - 1 ? cursor.up() : "");
if (count)
clear += cursor.left;
return clear;
}
};
module.exports = { cursor, scroll, erase, beep };
});
// src/hooks/auto-update-checker/constants.ts
import * as path4 from "path";
import * as os3 from "os";
function getWindowsAppdataDir() {
if (process.platform !== "win32")
return null;
return process.env.APPDATA ?? path4.join(os3.homedir(), "AppData", "Roaming");
}
var PACKAGE_NAME = "oh-my-opencode", NPM_REGISTRY_URL, NPM_FETCH_TIMEOUT = 5000, CACHE_DIR, VERSION_FILE, USER_CONFIG_DIR, USER_OPENCODE_CONFIG, USER_OPENCODE_CONFIG_JSONC, INSTALLED_PACKAGE_JSON;
var init_constants3 = __esm(() => {
init_data_path();
init_opencode_config_dir();
NPM_REGISTRY_URL = `https://registry.npmjs.org/-/package/${PACKAGE_NAME}/dist-tags`;
CACHE_DIR = getOpenCodeCacheDir();
VERSION_FILE = path4.join(CACHE_DIR, "version");
USER_CONFIG_DIR = getOpenCodeConfigDir({ binary: "opencode" });
USER_OPENCODE_CONFIG = path4.join(USER_CONFIG_DIR, "opencode.json");
USER_OPENCODE_CONFIG_JSONC = path4.join(USER_CONFIG_DIR, "opencode.jsonc");
INSTALLED_PACKAGE_JSON = path4.join(CACHE_DIR, "node_modules", PACKAGE_NAME, "package.json");
});
// src/hooks/auto-update-checker/checker/config-paths.ts
import * as os4 from "os";
import * as path5 from "path";
function getConfigPaths(directory) {
const paths = [
path5.join(directory, ".opencode", "opencode.json"),
path5.join(directory, ".opencode", "opencode.jsonc"),
USER_OPENCODE_CONFIG,
USER_OPENCODE_CONFIG_JSONC
];
if (process.platform === "win32") {
const crossPlatformDir = path5.join(os4.homedir(), ".config");
const appdataDir = getWindowsAppdataDir();
if (appdataDir) {
const alternateDir = USER_CONFIG_DIR === crossPlatformDir ? appdataDir : crossPlatformDir;
const alternateConfig = path5.join(alternateDir, "opencode", "opencode.json");
const alternateConfigJsonc = path5.join(alternateDir, "opencode", "opencode.jsonc");
if (!paths.includes(alternateConfig)) {
paths.push(alternateConfig);
}
if (!paths.includes(alternateConfigJsonc)) {
paths.push(alternateConfigJsonc);
}
}
}
return paths;
}
var init_config_paths = __esm(() => {
init_constants3();
});
// src/hooks/auto-update-checker/checker/jsonc-strip.ts
function stripJsonComments(json3) {
return json3.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (match, group) => group ? "" : match).replace(/,(\s*[}\]])/g, "$1");
}
// src/hooks/auto-update-checker/checker/local-dev-path.ts
import * as fs4 from "fs";
import { fileURLToPath } from "url";
function isLocalDevMode(directory) {
return getLocalDevPath(directory) !== null;
}
function getLocalDevPath(directory) {
for (const configPath of getConfigPaths(directory)) {
try {
if (!fs4.existsSync(configPath))
continue;
const content = fs4.readFileSync(configPath, "utf-8");
const config2 = JSON.parse(stripJsonComments(content));
const plugins = config2.plugin ?? [];
for (const entry of plugins) {
if (entry.startsWith("file://") && entry.includes(PACKAGE_NAME)) {
try {
return fileURLToPath(entry);
} catch {
return entry.replace("file://", "");
}
}
}
} catch {
continue;
}
}
return null;
}
var init_local_dev_path = __esm(() => {
init_constants3();
init_config_paths();
});
// src/hooks/auto-update-checker/checker/package-json-locator.ts
import * as fs5 from "fs";
import * as path6 from "path";
function findPackageJsonUp(startPath) {
try {
const stat = fs5.statSync(startPath);
let dir = stat.isDirectory() ? startPath : path6.dirname(startPath);
for (let i2 = 0;i2 < 10; i2++) {
const pkgPath = path6.join(dir, "package.json");
if (fs5.existsSync(pkgPath)) {
try {
const content = fs5.readFileSync(pkgPath, "utf-8");
const pkg = JSON.parse(content);
if (pkg.name === PACKAGE_NAME)
return pkgPath;
} catch {}
}
const parent = path6.dirname(dir);
if (parent === dir)
break;
dir = parent;
}
} catch {}
return null;
}
var init_package_json_locator = __esm(() => {
init_constants3();
});
// src/hooks/auto-update-checker/checker/local-dev-version.ts
import * as fs6 from "fs";
function getLocalDevVersion(directory) {
const localPath = getLocalDevPath(directory);
if (!localPath)
return null;
try {
const pkgPath = findPackageJsonUp(localPath);
if (!pkgPath)
return null;
const content = fs6.readFileSync(pkgPath, "utf-8");
const pkg = JSON.parse(content);
return pkg.version ?? null;
} catch {
return null;
}
}
var init_local_dev_version = __esm(() => {
init_local_dev_path();
init_package_json_locator();
});
// src/hooks/auto-update-checker/checker/plugin-entry.ts
import * as fs7 from "fs";
function findPluginEntry(directory) {
for (const configPath of getConfigPaths(directory)) {
try {
if (!fs7.existsSync(configPath))
continue;
const content = fs7.readFileSync(configPath, "utf-8");
const config2 = JSON.parse(stripJsonComments(content));
const plugins = config2.plugin ?? [];
for (const entry of plugins) {
if (entry === PACKAGE_NAME) {
return { entry, isPinned: false, pinnedVersion: null, configPath };
}
if (entry.startsWith(`${PACKAGE_NAME}@`)) {
const pinnedVersion = entry.slice(PACKAGE_NAME.length + 1);
const isPinned = EXACT_SEMVER_REGEX.test(pinnedVersion.trim());
return { entry, isPinned, pinnedVersion, configPath };
}
}
} catch {
continue;
}
}
return null;
}
var EXACT_SEMVER_REGEX;
var init_plugin_entry = __esm(() => {
init_constants3();
init_config_paths();
EXACT_SEMVER_REGEX = /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/;
});
// src/hooks/auto-update-checker/checker/cached-version.ts
import * as fs8 from "fs";
import * as path7 from "path";
import { fileURLToPath as fileURLToPath2 } from "url";
function getCachedVersion() {
try {
if (fs8.existsSync(INSTALLED_PACKAGE_JSON)) {
const content = fs8.readFileSync(INSTALLED_PACKAGE_JSON, "utf-8");
const pkg = JSON.parse(content);
if (pkg.version)
return pkg.version;
}
} catch {}
try {
const currentDir = path7.dirname(fileURLToPath2(import.meta.url));
const pkgPath = findPackageJsonUp(currentDir);
if (pkgPath) {
const content = fs8.readFileSync(pkgPath, "utf-8");
const pkg = JSON.parse(content);
if (pkg.version)
return pkg.version;
}
} catch (err) {
log("[auto-update-checker] Failed to resolve version from current directory:", err);
}
try {
const execDir = path7.dirname(fs8.realpathSync(process.execPath));
const pkgPath = findPackageJsonUp(execDir);
if (pkgPath) {
const content = fs8.readFileSync(pkgPath, "utf-8");
const pkg = JSON.parse(content);
if (pkg.version)
return pkg.version;
}
} catch (err) {
log("[auto-update-checker] Failed to resolve version from execPath:", err);
}
return null;
}
var init_cached_version = __esm(() => {
init_logger();
init_constants3();
init_package_json_locator();
});
// src/hooks/auto-update-checker/checker/pinned-version-updater.ts
var init_pinned_version_updater = __esm(() => {
init_logger();
init_constants3();
});
// src/hooks/auto-update-checker/checker/latest-version.ts
async function getLatestVersion(channel = "latest") {
const controller = new AbortController;
const timeoutId = setTimeout(() => controller.abort(), NPM_FETCH_TIMEOUT);
try {
const response = await fetch(NPM_REGISTRY_URL, {
signal: controller.signal,
headers: { Accept: "application/json" }
});
if (!response.ok)
return null;
const data = await response.json();
return data[channel] ?? data.latest ?? null;
} catch {
return null;
} finally {
clearTimeout(timeoutId);
}
}
var init_latest_version = __esm(() => {
init_constants3();
});
// src/hooks/auto-update-checker/version-channel.ts
function isPrereleaseVersion(version2) {
return version2.includes("-");
}
function isDistTag(version2) {
const startsWithDigit = /^\d/.test(version2);
return !startsWithDigit;
}
function isPrereleaseOrDistTag(pinnedVersion) {
if (!pinnedVersion)
return false;
return isPrereleaseVersion(pinnedVersion) || isDistTag(pinnedVersion);
}
function extractChannel(version2) {
if (!version2)
return "latest";
if (isDistTag(version2)) {
return version2;
}
if (isPrereleaseVersion(version2)) {
const prereleasePart = version2.split("-")[1];
if (prereleasePart) {
const channelMatch = prereleasePart.match(/^(alpha|beta|rc|canary|next)/);
if (channelMatch) {
return channelMatch[1];
}
}
}
return "latest";
}
// src/hooks/auto-update-checker/checker/check-for-update.ts
async function checkForUpdate(directory) {
if (isLocalDevMode(directory)) {
log("[auto-update-checker] Local dev mode detected, skipping update check");
return {
needsUpdate: false,
currentVersion: null,
latestVersion: null,
isLocalDev: true,
isPinned: false
};
}
const pluginInfo = findPluginEntry(directory);
if (!pluginInfo) {
log("[auto-update-checker] Plugin not found in config");
return {
needsUpdate: false,
currentVersion: null,
latestVersion: null,
isLocalDev: false,
isPinned: false
};
}
const currentVersion = getCachedVersion() ?? pluginInfo.pinnedVersion;
if (!currentVersion) {
log("[auto-update-checker] No cached version found");
return {
needsUpdate: false,
currentVersion: null,
latestVersion: null,
isLocalDev: false,
isPinned: false
};
}
const channel = extractChannel(pluginInfo.pinnedVersion ?? currentVersion);
const latestVersion = await getLatestVersion(channel);
if (!latestVersion) {
log("[auto-update-checker] Failed to fetch latest version for channel:", channel);
return {
needsUpdate: false,
currentVersion,
latestVersion: null,
isLocalDev: false,
isPinned: pluginInfo.isPinned
};
}
const needsUpdate = currentVersion !== latestVersion;
log(`[auto-update-checker] Current: ${currentVersion}, Latest (${channel}): ${latestVersion}, NeedsUpdate: ${needsUpdate}`);
return {
needsUpdate,
currentVersion,
latestVersion,
isLocalDev: false,
isPinned: pluginInfo.isPinned
};
}
var init_check_for_update = __esm(() => {
init_logger();
init_local_dev_path();
init_plugin_entry();
init_cached_version();
init_latest_version();
});
// src/hooks/auto-update-checker/checker/sync-package-json.ts
import * as crypto from "crypto";
import * as fs9 from "fs";
import * as path8 from "path";
function safeUnlink(filePath) {
try {
fs9.unlinkSync(filePath);
} catch (err) {
log(`[auto-update-checker] Failed to cleanup temp file: ${filePath}`, err);
}
}
function getIntentVersion(pluginInfo) {
if (!pluginInfo.pinnedVersion) {
return "latest";
}
return pluginInfo.pinnedVersion;
}
function syncCachePackageJsonToIntent(pluginInfo) {
const cachePackageJsonPath = path8.join(CACHE_DIR, "package.json");
if (!fs9.existsSync(cachePackageJsonPath)) {
log("[auto-update-checker] Cache package.json not found, nothing to sync");
return { synced: false, error: "file_not_found", message: "Cache package.json not found" };
}
let content;
let pkgJson;
try {
content = fs9.readFileSync(cachePackageJsonPath, "utf-8");
} catch (err) {
log("[auto-update-checker] Failed to read cache package.json:", err);
return { synced: false, error: "parse_error", message: "Failed to read cache package.json" };
}
try {
pkgJson = JSON.parse(content);
} catch (err) {
log("[auto-update-checker] Failed to parse cache package.json:", err);
return { synced: false, error: "parse_error", message: "Failed to parse cache package.json (malformed JSON)" };
}
if (!pkgJson || !pkgJson.dependencies?.[PACKAGE_NAME]) {
log("[auto-update-checker] Plugin not in cache package.json dependencies, nothing to sync");
return { synced: false, error: "plugin_not_in_deps", message: "Plugin not in cache package.json dependencies" };
}
const currentVersion = pkgJson.dependencies[PACKAGE_NAME];
const intentVersion = getIntentVersion(pluginInfo);
if (currentVersion === intentVersion) {
log("[auto-update-checker] Cache package.json already matches intent:", intentVersion);
return { synced: false, error: null, message: `Already matches intent: ${intentVersion}` };
}
const intentIsTag = !EXACT_SEMVER_REGEX2.test(intentVersion.trim());
const currentIsSemver = EXACT_SEMVER_REGEX2.test(String(currentVersion).trim());
if (intentIsTag && currentIsSemver) {
log(`[auto-update-checker] Syncing cache package.json: "${currentVersion}" \u2192 "${intentVersion}" (opencode.json intent)`);
} else {
log(`[auto-update-checker] Updating cache package.json: "${currentVersion}" \u2192 "${intentVersion}"`);
}
pkgJson.dependencies[PACKAGE_NAME] = intentVersion;
const tmpPath = `${cachePackageJsonPath}.${crypto.randomUUID()}`;
try {
fs9.writeFileSync(tmpPath, JSON.stringify(pkgJson, null, 2));
fs9.renameSync(tmpPath, cachePackageJsonPath);
return { synced: true, error: null, message: `Updated: "${currentVersion}" \u2192 "${intentVersion}"` };
} catch (err) {
log("[auto-update-checker] Failed to write cache package.json:", err);
safeUnlink(tmpPath);
return { synced: false, error: "write_error", message: "Failed to write cache package.json" };
}
}
var EXACT_SEMVER_REGEX2;
var init_sync_package_json = __esm(() => {
init_constants3();
init_logger();
EXACT_SEMVER_REGEX2 = /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/;
});
// src/hooks/auto-update-checker/checker.ts
var init_checker = __esm(() => {
init_local_dev_path();
init_local_dev_version();
init_plugin_entry();
init_cached_version();
init_pinned_version_updater();
init_latest_version();
init_check_for_update();
init_sync_package_json();
});
// src/hooks/auto-update-checker/cache.ts
import * as fs10 from "fs";
import * as path9 from "path";
function stripTrailingCommas(json3) {
return json3.replace(/,(\s*[}\]])/g, "$1");
}
function removeFromTextBunLock(lockPath, packageName) {
try {
const content = fs10.readFileSync(lockPath, "utf-8");
const lock = JSON.parse(stripTrailingCommas(content));
if (lock.packages?.[packageName]) {
delete lock.packages[packageName];
fs10.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
log(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
return true;
}
return false;
} catch {
return false;
}
}
function deleteBinaryBunLock(lockPath) {
try {
fs10.unlinkSync(lockPath);
log(`[auto-update-checker] Removed bun.lockb to force re-resolution`);
return true;
} catch {
return false;
}
}
function removeFromBunLock(packageName) {
const textLockPath = path9.join(CACHE_DIR, "bun.lock");
const binaryLockPath = path9.join(CACHE_DIR, "bun.lockb");
if (fs10.existsSync(textLockPath)) {
return removeFromTextBunLock(textLockPath, packageName);
}
if (fs10.existsSync(binaryLockPath)) {
return deleteBinaryBunLock(binaryLockPath);
}
return false;
}
function invalidatePackage(packageName = PACKAGE_NAME) {
try {
const pkgDirs = [
path9.join(USER_CONFIG_DIR, "node_modules", packageName),
path9.join(CACHE_DIR, "node_modules", packageName)
];
let packageRemoved = false;
let lockRemoved = false;
for (const pkgDir of pkgDirs) {
if (fs10.existsSync(pkgDir)) {
fs10.rmSync(pkgDir, { recursive: true, force: true });
log(`[auto-update-checker] Package removed: ${pkgDir}`);
packageRemoved = true;
}
}
lockRemoved = removeFromBunLock(packageName);
if (!packageRemoved && !lockRemoved) {
log(`[auto-update-checker] Package not found, nothing to invalidate: ${packageName}`);
return false;
}
return true;
} catch (err) {
log("[auto-update-checker] Failed to invalidate package:", err);
return false;
}
}
function invalidateCache() {
log("[auto-update-checker] WARNING: invalidateCache is deprecated, use invalidatePackage");
return invalidatePackage();
}
var init_cache = __esm(() => {
init_constants3();
init_logger();
});
// src/hooks/auto-update-checker/hook/update-toasts.ts
async function showUpdateAvailableToast(ctx, latestVersion, getToastMessage) {
await ctx.client.tui.showToast({
body: {
title: `OhMyOpenCode ${latestVersion}`,
message: getToastMessage(true, latestVersion),
variant: "info",
duration: 8000
}
}).catch(() => {});
log(`[auto-update-checker] Update available toast shown: v${latestVersion}`);
}
async function showAutoUpdatedToast(ctx, oldVersion, newVersion) {
await ctx.client.tui.showToast({
body: {
title: "OhMyOpenCode Updated!",
message: `v${oldVersion} \u2192 v${newVersion}
Restart OpenCode to apply.`,
variant: "success",
duration: 8000
}
}).catch(() => {});
log(`[auto-update-checker] Auto-updated toast shown: v${oldVersion} \u2192 v${newVersion}`);
}
var init_update_toasts = __esm(() => {
init_logger();
});
// src/hooks/auto-update-checker/hook/background-update-check.ts
function getPinnedVersionToastMessage(latestVersion) {
return `Update available: ${latestVersion} (version pinned, update manually)`;
}
async function runBunInstallSafe() {
try {
const result = await runBunInstallWithDetails({ outputMode: "pipe" });
if (!result.success && result.error) {
log("[auto-update-checker] bun install error:", result.error);
}
return result.success;
} catch (err) {
const errorMessage = err instanceof Error ? err.message : String(err);
log("[auto-update-checker] bun install error:", errorMessage);
return false;
}
}
async function runBackgroundUpdateCheck(ctx, autoUpdate, getToastMessage) {
const pluginInfo = findPluginEntry(ctx.directory);
if (!pluginInfo) {
log("[auto-update-checker] Plugin not found in config");
return;
}
const cachedVersion = getCachedVersion();
const currentVersion = cachedVersion ?? pluginInfo.pinnedVersion;
if (!currentVersion) {
log("[auto-update-checker] No version found (cached or pinned)");
return;
}
const channel = extractChannel(pluginInfo.pinnedVersion ?? currentVersion);
const latestVersion = await getLatestVersion(channel);
if (!latestVersion) {
log("[auto-update-checker] Failed to fetch latest version for channel:", channel);
return;
}
if (currentVersion === latestVersion) {
log("[auto-update-checker] Already on latest version for channel:", channel);
return;
}
log(`[auto-update-checker] Update available (${channel}): ${currentVersion} \u2192 ${latestVersion}`);
if (!autoUpdate) {
await showUpdateAvailableToast(ctx, latestVersion, getToastMessage);
log("[auto-update-checker] Auto-update disabled, notification only");
return;
}
if (pluginInfo.isPinned) {
await showUpdateAvailableToast(ctx, latestVersion, () => getPinnedVersionToastMessage(latestVersion));
log(`[auto-update-checker] User-pinned version detected (${pluginInfo.entry}), skipping auto-update. Notification only.`);
return;
}
const syncResult = syncCachePackageJsonToIntent(pluginInfo);
if (syncResult.error) {
log(`[auto-update-checker] Sync failed with error: ${syncResult.error}`, syncResult.message);
await showUpdateAvailableToast(ctx, latestVersion, getToastMessage);
return;
}
invalidatePackage(PACKAGE_NAME);
const installSuccess = await runBunInstallSafe();
if (installSuccess) {
await showAutoUpdatedToast(ctx, currentVersion, latestVersion);
log(`[auto-update-checker] Update installed: ${currentVersion} \u2192 ${latestVersion}`);
return;
}
await showUpdateAvailableToast(ctx, latestVersion, getToastMessage);
log("[auto-update-checker] bun install failed; update not installed (falling back to notification-only)");
}
var init_background_update_check = __esm(() => {
init_config_manager();
init_logger();
init_cache();
init_constants3();
init_checker();
init_update_toasts();
});
// src/hooks/auto-update-checker/hook/config-errors-toast.ts
async function showConfigErrorsIfAny(ctx) {
const errors3 = getConfigLoadErrors();
if (errors3.length === 0)
return;
const errorMessages = errors3.map((error48) => `${error48.path}: ${error48.error}`).join(`
`);
await ctx.client.tui.showToast({
body: {
title: "Config Load Error",
message: `Failed to load config:
${errorMessages}`,
variant: "error",
duration: 1e4
}
}).catch(() => {});
log(`[auto-update-checker] Config load errors shown: ${errors3.length} error(s)`);
clearConfigLoadErrors();
}
var init_config_errors_toast = __esm(() => {
init_config_errors();
init_logger();
});
// src/hooks/auto-update-checker/hook/connected-providers-status.ts
async function updateAndShowConnectedProvidersCacheStatus(ctx) {
const hadCache = isModelCacheAvailable();
if (!hadCache) {
let timeoutId;
try {
await Promise.race([
updateConnectedProvidersCache(ctx.client),
new Promise((_3, reject) => {
timeoutId = setTimeout(() => reject(new Error("Cache update timed out")), CACHE_UPDATE_TIMEOUT_MS);
})
]);
} catch (err) {
log("[auto-update-checker] Connected providers cache creation failed", { error: String(err) });
} finally {
if (timeoutId)
clearTimeout(timeoutId);
}
if (!isModelCacheAvailable()) {
await ctx.client.tui.showToast({
body: {
title: "Connected Providers Cache",
message: "Failed to build provider cache. Restart OpenCode to retry.",
variant: "warning",
duration: 8000
}
}).catch(() => {});
log("[auto-update-checker] Connected providers cache toast shown (creation failed)");
} else {
log("[auto-update-checker] Connected providers cache created on first run");
}
} else {
updateConnectedProvidersCache(ctx.client).catch((err) => {
log("[auto-update-checker] Background cache update failed", { error: String(err) });
});
log("[auto-update-checker] Connected providers cache exists, updating in background");
}
}
var CACHE_UPDATE_TIMEOUT_MS = 1e4;
var init_connected_providers_status = __esm(() => {
init_connected_providers_cache();
init_model_availability();
init_logger();
});
// src/hooks/auto-update-checker/hook/model-cache-warning.ts
async function showModelCacheWarningIfNeeded(ctx) {
if (isModelCacheAvailable())
return;
await ctx.client.tui.showToast({
body: {
title: "Model Cache Not Found",
message: "Run 'opencode models --refresh' or restart OpenCode to populate the models cache for optimal agent model selection.",
variant: "warning",
duration: 1e4
}
}).catch(() => {});
log("[auto-update-checker] Model cache warning shown");
}
var init_model_cache_warning = __esm(() => {
init_model_availability();
init_logger();
});
// src/hooks/auto-update-checker/hook/spinner-toast.ts
async function showSpinnerToast(ctx, version2, message) {
const totalDuration = 5000;
const frameInterval = 100;
const totalFrames = Math.floor(totalDuration / frameInterval);
for (let i2 = 0;i2 < totalFrames; i2++) {
const spinner = SISYPHUS_SPINNER[i2 % SISYPHUS_SPINNER.length];
await ctx.client.tui.showToast({
body: {
title: `${spinner} OhMyOpenCode ${version2}`,
message,
variant: "info",
duration: frameInterval + 50
}
}).catch(() => {});
await new Promise((resolve2) => setTimeout(resolve2, frameInterval));
}
}
var SISYPHUS_SPINNER;
var init_spinner_toast = __esm(() => {
SISYPHUS_SPINNER = ["\xB7", "\u2022", "\u25CF", "\u25CB", "\u25CC", "\u25E6", " "];
});
// src/hooks/auto-update-checker/hook/startup-toasts.ts
async function showVersionToast(ctx, version2, message) {
const displayVersion = version2 ?? "unknown";
await showSpinnerToast(ctx, displayVersion, message);
log(`[auto-update-checker] Startup toast shown: v${displayVersion}`);
}
async function showLocalDevToast(ctx, version2, isSisyphusEnabled) {
const displayVersion = version2 ?? "dev";
const message = isSisyphusEnabled ? "Sisyphus running in local development mode." : "Running in local development mode. oMoMoMo...";
await showSpinnerToast(ctx, `${displayVersion} (dev)`, message);
log(`[auto-update-checker] Local dev toast shown: v${displayVersion}`);
}
var init_startup_toasts = __esm(() => {
init_logger();
init_spinner_toast();
});
// src/hooks/auto-update-checker/hook.ts
function createAutoUpdateCheckerHook(ctx, options = {}) {
const { showStartupToast = true, isSisyphusEnabled = false, autoUpdate = true } = options;
const isCliRunMode = process.env.OPENCODE_CLI_RUN_MODE === "true";
const getToastMessage = (isUpdate, latestVersion) => {
if (isSisyphusEnabled) {
return isUpdate ? `Sisyphus on steroids is steering OpenCode.
v${latestVersion} available. Restart to apply.` : "Sisyphus on steroids is steering OpenCode.";
}
return isUpdate ? `OpenCode is now on Steroids. oMoMoMoMo...
v${latestVersion} available. Restart OpenCode to apply.` : "OpenCode is now on Steroids. oMoMoMoMo...";
};
let hasChecked = false;
return {
event: ({ event }) => {
if (event.type !== "session.created")
return;
if (isCliRunMode)
return;
if (hasChecked)
return;
const props = event.properties;
if (props?.info?.parentID)
return;
hasChecked = true;
setTimeout(async () => {
const cachedVersion = getCachedVersion();
const localDevVersion = getLocalDevVersion(ctx.directory);
const displayVersion = localDevVersion ?? cachedVersion;
await showConfigErrorsIfAny(ctx);
await updateAndShowConnectedProvidersCacheStatus(ctx);
await showModelCacheWarningIfNeeded(ctx);
if (localDevVersion) {
if (showStartupToast) {
showLocalDevToast(ctx, displayVersion, isSisyphusEnabled).catch(() => {});
}
log("[auto-update-checker] Local development mode");
return;
}
if (showStartupToast) {
showVersionToast(ctx, displayVersion, getToastMessage(false)).catch(() => {});
}
runBackgroundUpdateCheck(ctx, autoUpdate, getToastMessage).catch((err) => {
log("[auto-update-checker] Background update check failed:", err);
});
}, 0);
}
};
}
var init_hook = __esm(() => {
init_logger();
init_checker();
init_background_update_check();
init_config_errors_toast();
init_connected_providers_status();
init_model_cache_warning();
init_startup_toasts();
});
// src/hooks/auto-update-checker/index.ts
var exports_auto_update_checker = {};
__export(exports_auto_update_checker, {
isPrereleaseVersion: () => isPrereleaseVersion,
isPrereleaseOrDistTag: () => isPrereleaseOrDistTag,
isDistTag: () => isDistTag,
invalidatePackage: () => invalidatePackage,
invalidateCache: () => invalidateCache,
extractChannel: () => extractChannel,
createAutoUpdateCheckerHook: () => createAutoUpdateCheckerHook,
checkForUpdate: () => checkForUpdate
});
var init_auto_update_checker = __esm(() => {
init_hook();
init_checker();
init_cache();
});
// node_modules/commander/esm.mjs
var import__ = __toESM(require_commander(), 1);
var {
program,
createCommand,
createArgument,
createOption,
CommanderError,
InvalidArgumentError,
InvalidOptionArgumentError,
Command,
Argument,
Option,
Help
} = import__.default;
// package.json
var package_default = {
name: "oh-my-opencode",
version: "3.11.0",
description: "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
main: "dist/index.js",
types: "dist/index.d.ts",
type: "module",
bin: {
"oh-my-opencode": "bin/oh-my-opencode.js"
},
files: [
"dist",
"bin",
"postinstall.mjs"
],
exports: {
".": {
types: "./dist/index.d.ts",
import: "./dist/index.js"
},
"./schema.json": "./dist/oh-my-opencode.schema.json"
},
scripts: {
build: "bun build src/index.ts --outdir dist --target bun --format esm --external @ast-grep/napi && tsc --emitDeclarationOnly && bun build src/cli/index.ts --outdir dist/cli --target bun --format esm --external @ast-grep/napi && bun run build:schema",
"build:all": "bun run build && bun run build:binaries",
"build:binaries": "bun run script/build-binaries.ts",
"build:schema": "bun run script/build-schema.ts",
clean: "rm -rf dist",
prepare: "bun run build",
postinstall: "node postinstall.mjs",
prepublishOnly: "bun run clean && bun run build",
typecheck: "tsc --noEmit",
test: "bun test"
},
keywords: [
"opencode",
"plugin",
"oracle",
"librarian",
"agents",
"ai",
"llm"
],
author: "YeonGyu-Kim",
license: "SUL-1.0",
repository: {
type: "git",
url: "git+https://github.com/code-yeongyu/oh-my-openagent.git"
},
bugs: {
url: "https://github.com/code-yeongyu/oh-my-openagent/issues"
},
homepage: "https://github.com/code-yeongyu/oh-my-openagent#readme",
dependencies: {
"@ast-grep/cli": "^0.41.1",
"@ast-grep/napi": "^0.41.1",
"@clack/prompts": "^0.11.0",
"@code-yeongyu/comment-checker": "^0.7.0",
"@modelcontextprotocol/sdk": "^1.25.2",
"@opencode-ai/plugin": "^1.2.24",
"@opencode-ai/sdk": "^1.2.24",
commander: "^14.0.2",
"detect-libc": "^2.0.0",
diff: "^8.0.3",
"js-yaml": "^4.1.1",
"jsonc-parser": "^3.3.1",
picocolors: "^1.1.1",
picomatch: "^4.0.2",
"vscode-jsonrpc": "^8.2.0",
zod: "^4.1.8"
},
devDependencies: {
"@types/js-yaml": "^4.0.9",
"@types/picomatch": "^3.0.2",
"bun-types": "1.3.10",
typescript: "^5.7.3"
},
optionalDependencies: {
"oh-my-opencode-darwin-arm64": "3.11.0",
"oh-my-opencode-darwin-x64": "3.11.0",
"oh-my-opencode-darwin-x64-baseline": "3.11.0",
"oh-my-opencode-linux-arm64": "3.11.0",
"oh-my-opencode-linux-arm64-musl": "3.11.0",
"oh-my-opencode-linux-x64": "3.11.0",
"oh-my-opencode-linux-x64-baseline": "3.11.0",
"oh-my-opencode-linux-x64-musl": "3.11.0",
"oh-my-opencode-linux-x64-musl-baseline": "3.11.0",
"oh-my-opencode-windows-x64": "3.11.0",
"oh-my-opencode-windows-x64-baseline": "3.11.0"
},
overrides: {
"@opencode-ai/sdk": "^1.2.24"
},
trustedDependencies: [
"@ast-grep/cli",
"@ast-grep/napi",
"@code-yeongyu/comment-checker"
]
};
// src/cli/cli-installer.ts
init_config_manager();
var import_picocolors2 = __toESM(require_picocolors(), 1);
// src/cli/install-validators.ts
var import_picocolors = __toESM(require_picocolors(), 1);
var SYMBOLS = {
check: import_picocolors.default.green("[OK]"),
cross: import_picocolors.default.red("[X]"),
arrow: import_picocolors.default.cyan("->"),
bullet: import_picocolors.default.dim("*"),
info: import_picocolors.default.blue("[i]"),
warn: import_picocolors.default.yellow("[!]"),
star: import_picocolors.default.yellow("*")
};
function formatProvider(name, enabled, detail) {
const status = enabled ? SYMBOLS.check : import_picocolors.default.dim("\u25CB");
const label = enabled ? import_picocolors.default.white(name) : import_picocolors.default.dim(name);
const suffix = detail ? import_picocolors.default.dim(` (${detail})`) : "";
return ` ${status} ${label}${suffix}`;
}
function formatConfigSummary(config) {
const lines = [];
lines.push(import_picocolors.default.bold(import_picocolors.default.white("Configuration Summary")));
lines.push("");
const claudeDetail = config.hasClaude ? config.isMax20 ? "max20" : "standard" : undefined;
lines.push(formatProvider("Claude", config.hasClaude, claudeDetail));
lines.push(formatProvider("OpenAI/ChatGPT", config.hasOpenAI, "GPT-5.4 for Oracle"));
lines.push(formatProvider("Gemini", config.hasGemini));
lines.push(formatProvider("GitHub Copilot", config.hasCopilot, "fallback"));
lines.push(formatProvider("OpenCode Zen", config.hasOpencodeZen, "opencode/ models"));
lines.push(formatProvider("Z.ai Coding Plan", config.hasZaiCodingPlan, "Librarian/Multimodal"));
lines.push(formatProvider("Kimi For Coding", config.hasKimiForCoding, "Sisyphus/Prometheus fallback"));
lines.push("");
lines.push(import_picocolors.default.dim("\u2500".repeat(40)));
lines.push("");
lines.push(import_picocolors.default.bold(import_picocolors.default.white("Model Assignment")));
lines.push("");
lines.push(` ${SYMBOLS.info} Models auto-configured based on provider priority`);
lines.push(` ${SYMBOLS.bullet} Priority: Native > Copilot > OpenCode Zen > Z.ai`);
return lines.join(`
`);
}
function printHeader(isUpdate) {
const mode = isUpdate ? "Update" : "Install";
console.log();
console.log(import_picocolors.default.bgMagenta(import_picocolors.default.white(` oMoMoMoMo... ${mode} `)));
console.log();
}
function printStep(step, total, message) {
const progress = import_picocolors.default.dim(`[${step}/${total}]`);
console.log(`${progress} ${message}`);
}
function printSuccess(message) {
console.log(`${SYMBOLS.check} ${message}`);
}
function printError(message) {
console.log(`${SYMBOLS.cross} ${import_picocolors.default.red(message)}`);
}
function printInfo(message) {
console.log(`${SYMBOLS.info} ${message}`);
}
function printWarning(message) {
console.log(`${SYMBOLS.warn} ${import_picocolors.default.yellow(message)}`);
}
function printBox(content, title) {
const lines = content.split(`
`);
const maxWidth = Math.max(...lines.map((line) => line.replace(/\x1b\[[0-9;]*m/g, "").length), title?.length ?? 0) + 4;
const border = import_picocolors.default.dim("\u2500".repeat(maxWidth));
console.log();
if (title) {
console.log(import_picocolors.default.dim("\u250C\u2500") + import_picocolors.default.bold(` ${title} `) + import_picocolors.default.dim("\u2500".repeat(maxWidth - title.length - 4)) + import_picocolors.default.dim("\u2510"));
} else {
console.log(import_picocolors.default.dim("\u250C") + border + import_picocolors.default.dim("\u2510"));
}
for (const line of lines) {
const stripped = line.replace(/\x1b\[[0-9;]*m/g, "");
const padding = maxWidth - stripped.length;
console.log(import_picocolors.default.dim("\u2502") + ` ${line}${" ".repeat(padding - 1)}` + import_picocolors.default.dim("\u2502"));
}
console.log(import_picocolors.default.dim("\u2514") + border + import_picocolors.default.dim("\u2518"));
console.log();
}
function validateNonTuiArgs(args) {
const errors = [];
if (args.claude === undefined) {
errors.push("--claude is required (values: no, yes, max20)");
} else if (!["no", "yes", "max20"].includes(args.claude)) {
errors.push(`Invalid --claude value: ${args.claude} (expected: no, yes, max20)`);
}
if (args.gemini === undefined) {
errors.push("--gemini is required (values: no, yes)");
} else if (!["no", "yes"].includes(args.gemini)) {
errors.push(`Invalid --gemini value: ${args.gemini} (expected: no, yes)`);
}
if (args.copilot === undefined) {
errors.push("--copilot is required (values: no, yes)");
} else if (!["no", "yes"].includes(args.copilot)) {
errors.push(`Invalid --copilot value: ${args.copilot} (expected: no, yes)`);
}
if (args.openai !== undefined && !["no", "yes"].includes(args.openai)) {
errors.push(`Invalid --openai value: ${args.openai} (expected: no, yes)`);
}
if (args.opencodeZen !== undefined && !["no", "yes"].includes(args.opencodeZen)) {
errors.push(`Invalid --opencode-zen value: ${args.opencodeZen} (expected: no, yes)`);
}
if (args.zaiCodingPlan !== undefined && !["no", "yes"].includes(args.zaiCodingPlan)) {
errors.push(`Invalid --zai-coding-plan value: ${args.zaiCodingPlan} (expected: no, yes)`);
}
if (args.kimiForCoding !== undefined && !["no", "yes"].includes(args.kimiForCoding)) {
errors.push(`Invalid --kimi-for-coding value: ${args.kimiForCoding} (expected: no, yes)`);
}
return { valid: errors.length === 0, errors };
}
function argsToConfig(args) {
return {
hasClaude: args.claude !== "no",
isMax20: args.claude === "max20",
hasOpenAI: args.openai === "yes",
hasGemini: args.gemini === "yes",
hasCopilot: args.copilot === "yes",
hasOpencodeZen: args.opencodeZen === "yes",
hasZaiCodingPlan: args.zaiCodingPlan === "yes",
hasKimiForCoding: args.kimiForCoding === "yes",
hasOpencodeGo: args.opencodeGo === "yes"
};
}
function detectedToInitialValues(detected) {
let claude = "no";
if (detected.hasClaude) {
claude = detected.isMax20 ? "max20" : "yes";
}
return {
claude,
openai: detected.hasOpenAI ? "yes" : "no",
gemini: detected.hasGemini ? "yes" : "no",
copilot: detected.hasCopilot ? "yes" : "no",
opencodeZen: detected.hasOpencodeZen ? "yes" : "no",
zaiCodingPlan: detected.hasZaiCodingPlan ? "yes" : "no",
kimiForCoding: detected.hasKimiForCoding ? "yes" : "no",
opencodeGo: detected.hasOpencodeGo ? "yes" : "no"
};
}
// src/cli/cli-installer.ts
async function runCliInstaller(args, version) {
const validation = validateNonTuiArgs(args);
if (!validation.valid) {
printHeader(false);
printError("Validation failed:");
for (const err of validation.errors) {
console.log(` ${SYMBOLS.bullet} ${err}`);
}
console.log();
printInfo("Usage: bunx oh-my-opencode install --no-tui --claude=<no|yes|max20> --gemini=<no|yes> --copilot=<no|yes>");
console.log();
return 1;
}
const detected = detectCurrentConfig();
const isUpdate = detected.isInstalled;
printHeader(isUpdate);
const totalSteps = 4;
let step = 1;
printStep(step++, totalSteps, "Checking OpenCode installation...");
const installed = await isOpenCodeInstalled();
const openCodeVersion = await getOpenCodeVersion();
if (!installed) {
printWarning("OpenCode binary not found. Plugin will be configured, but you'll need to install OpenCode to use it.");
printInfo("Visit https://opencode.ai/docs for installation instructions");
} else {
printSuccess(`OpenCode ${openCodeVersion ?? ""} detected`);
}
if (isUpdate) {
const initial = detectedToInitialValues(detected);
printInfo(`Current config: Claude=${initial.claude}, Gemini=${initial.gemini}`);
}
const config = argsToConfig(args);
printStep(step++, totalSteps, "Adding oh-my-opencode plugin...");
const pluginResult = await addPluginToOpenCodeConfig(version);
if (!pluginResult.success) {
printError(`Failed: ${pluginResult.error}`);
return 1;
}
printSuccess(`Plugin ${isUpdate ? "verified" : "added"} ${SYMBOLS.arrow} ${import_picocolors2.default.dim(pluginResult.configPath)}`);
printStep(step++, totalSteps, "Writing oh-my-opencode configuration...");
const omoResult = writeOmoConfig(config);
if (!omoResult.success) {
printError(`Failed: ${omoResult.error}`);
return 1;
}
printSuccess(`Config written ${SYMBOLS.arrow} ${import_picocolors2.default.dim(omoResult.configPath)}`);
printBox(formatConfigSummary(config), isUpdate ? "Updated Configuration" : "Installation Complete");
if (!config.hasClaude) {
console.log();
console.log(import_picocolors2.default.bgRed(import_picocolors2.default.white(import_picocolors2.default.bold(" CRITICAL WARNING "))));
console.log();
console.log(import_picocolors2.default.red(import_picocolors2.default.bold(" Sisyphus agent is STRONGLY optimized for Claude Opus 4.5.")));
console.log(import_picocolors2.default.red(" Without Claude, you may experience significantly degraded performance:"));
console.log(import_picocolors2.default.dim(" \u2022 Reduced orchestration quality"));
console.log(import_picocolors2.default.dim(" \u2022 Weaker tool selection and delegation"));
console.log(import_picocolors2.default.dim(" \u2022 Less reliable task completion"));
console.log();
console.log(import_picocolors2.default.yellow(" Consider subscribing to Claude Pro/Max for the best experience."));
console.log();
}
if (!config.hasClaude && !config.hasOpenAI && !config.hasGemini && !config.hasCopilot && !config.hasOpencodeZen) {
printWarning("No model providers configured. Using opencode/big-pickle as fallback.");
}
console.log(`${SYMBOLS.star} ${import_picocolors2.default.bold(import_picocolors2.default.green(isUpdate ? "Configuration updated!" : "Installation complete!"))}`);
console.log(` Run ${import_picocolors2.default.cyan("opencode")} to start!`);
console.log();
printBox(`${import_picocolors2.default.bold("Pro Tip:")} Include ${import_picocolors2.default.cyan("ultrawork")} (or ${import_picocolors2.default.cyan("ulw")}) in your prompt.
` + `All features work like magic\u2014parallel agents, background tasks,
` + `deep exploration, and relentless execution until completion.`, "The Magic Word");
console.log(`${SYMBOLS.star} ${import_picocolors2.default.yellow("If you found this helpful, consider starring the repo!")}`);
console.log(` ${import_picocolors2.default.dim("gh api --silent --method PUT /user/starred/code-yeongyu/oh-my-openagent >/dev/null 2>&1 || true")}`);
console.log();
console.log(import_picocolors2.default.dim("oMoMoMoMo... Enjoy!"));
console.log();
if ((config.hasClaude || config.hasGemini || config.hasCopilot) && !args.skipAuth) {
printBox(`Run ${import_picocolors2.default.cyan("opencode auth login")} and select your provider:
` + (config.hasClaude ? ` ${SYMBOLS.bullet} Anthropic ${import_picocolors2.default.gray("\u2192 Claude Pro/Max")}
` : "") + (config.hasGemini ? ` ${SYMBOLS.bullet} Google ${import_picocolors2.default.gray("\u2192 Gemini")}
` : "") + (config.hasCopilot ? ` ${SYMBOLS.bullet} GitHub ${import_picocolors2.default.gray("\u2192 Copilot")}` : ""), "Authenticate Your Providers");
}
return 0;
}
// node_modules/@clack/prompts/dist/index.mjs
import { stripVTControlCharacters as S2 } from "util";
// node_modules/@clack/core/dist/index.mjs
var import_sisteransi = __toESM(require_src(), 1);
import { stdin as j, stdout as M } from "process";
import * as g from "readline";
import O from "readline";
import { Writable as X } from "stream";
function DD({ onlyFirst: e = false } = {}) {
const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
return new RegExp(t, e ? undefined : "g");
}
var uD = DD();
function P(e) {
if (typeof e != "string")
throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
return e.replace(uD, "");
}
function L(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var W = { exports: {} };
(function(e) {
var u = {};
e.exports = u, u.eastAsianWidth = function(F) {
var s = F.charCodeAt(0), i2 = F.length == 2 ? F.charCodeAt(1) : 0, D = s;
return 55296 <= s && s <= 56319 && 56320 <= i2 && i2 <= 57343 && (s &= 1023, i2 &= 1023, D = s << 10 | i2, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
}, u.characterLength = function(F) {
var s = this.eastAsianWidth(F);
return s == "F" || s == "W" || s == "A" ? 2 : 1;
};
function t(F) {
return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
}
u.length = function(F) {
for (var s = t(F), i2 = 0, D = 0;D < s.length; D++)
i2 = i2 + this.characterLength(s[D]);
return i2;
}, u.slice = function(F, s, i2) {
textLen = u.length(F), s = s || 0, i2 = i2 || 1, s < 0 && (s = textLen + s), i2 < 0 && (i2 = textLen + i2);
for (var D = "", C = 0, n = t(F), E = 0;E < n.length; E++) {
var a = n[E], o = u.length(a);
if (C >= s - (o == 2 ? 1 : 0))
if (C + o <= i2)
D += a;
else
break;
C += o;
}
return D;
};
})(W);
var tD = W.exports;
var eD = L(tD);
var FD = function() {
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
};
var sD = L(FD);
function p(e, u = {}) {
if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = P(e), e.length === 0))
return 0;
e = e.replace(sD(), " ");
const t = u.ambiguousIsNarrow ? 1 : 2;
let F = 0;
for (const s of e) {
const i2 = s.codePointAt(0);
if (i2 <= 31 || i2 >= 127 && i2 <= 159 || i2 >= 768 && i2 <= 879)
continue;
switch (eD.eastAsianWidth(s)) {
case "F":
case "W":
F += 2;
break;
case "A":
F += t;
break;
default:
F += 1;
}
}
return F;
}
var w = 10;
var N = (e = 0) => (u) => `\x1B[${u + e}m`;
var I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
var R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`;
var r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
Object.keys(r.modifier);
var iD = Object.keys(r.color);
var CD = Object.keys(r.bgColor);
[...iD, ...CD];
function rD() {
const e = new Map;
for (const [u, t] of Object.entries(r)) {
for (const [F, s] of Object.entries(t))
r[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = r[F], e.set(s[0], s[1]);
Object.defineProperty(r, u, { value: t, enumerable: false });
}
return Object.defineProperty(r, "codes", { value: e, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
if (!t)
return [0, 0, 0];
let [F] = t;
F.length === 3 && (F = [...F].map((i2) => i2 + i2).join(""));
const s = Number.parseInt(F, 16);
return [s >> 16 & 255, s >> 8 & 255, s & 255];
}, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
if (u < 8)
return 30 + u;
if (u < 16)
return 90 + (u - 8);
let t, F, s;
if (u >= 232)
t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
else {
u -= 16;
const C = u % 36;
t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
}
const i2 = Math.max(t, F, s) * 2;
if (i2 === 0)
return 30;
let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
return i2 === 2 && (D += 60), D;
}, enumerable: false }, rgbToAnsi: { value: (u, t, F) => r.ansi256ToAnsi(r.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
}
var ED = rD();
var d = new Set(["\x1B", "\x9B"]);
var oD = 39;
var y = "\x07";
var V = "[";
var nD = "]";
var G = "m";
var _ = `${nD}8;;`;
var z = (e) => `${d.values().next().value}${V}${e}${G}`;
var K = (e) => `${d.values().next().value}${_}${e}${y}`;
var aD = (e) => e.split(" ").map((u) => p(u));
var k = (e, u, t) => {
const F = [...u];
let s = false, i2 = false, D = p(P(e[e.length - 1]));
for (const [C, n] of F.entries()) {
const E = p(n);
if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i2 = F.slice(C + 1).join("").startsWith(_)), s) {
i2 ? n === y && (s = false, i2 = false) : n === G && (s = false);
continue;
}
D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
}
!D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
};
var hD = (e) => {
const u = e.split(" ");
let t = u.length;
for (;t > 0 && !(p(u[t - 1]) > 0); )
t--;
return t === u.length ? e : u.slice(0, t).join(" ") + u.slice(t).join("");
};
var lD = (e, u, t = {}) => {
if (t.trim !== false && e.trim() === "")
return "";
let F = "", s, i2;
const D = aD(e);
let C = [""];
for (const [E, a] of e.split(" ").entries()) {
t.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
let o = p(C[C.length - 1]);
if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (C.push(""), o = 0), (o > 0 || t.trim === false) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
continue;
}
if (o + D[E] > u && o > 0 && D[E] > 0) {
if (t.wordWrap === false && o < u) {
k(C, a, u);
continue;
}
C.push("");
}
if (o + D[E] > u && t.wordWrap === false) {
k(C, a, u);
continue;
}
C[C.length - 1] += a;
}
t.trim !== false && (C = C.map((E) => hD(E)));
const n = [...C.join(`
`)];
for (const [E, a] of n.entries()) {
if (F += a, d.has(a)) {
const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
if (c.code !== undefined) {
const f = Number.parseFloat(c.code);
s = f === oD ? undefined : f;
} else
c.uri !== undefined && (i2 = c.uri.length === 0 ? undefined : c.uri);
}
const o = ED.codes.get(Number(s));
n[E + 1] === `
` ? (i2 && (F += K("")), s && o && (F += z(o))) : a === `
` && (s && o && (F += z(s)), i2 && (F += K(i2)));
}
return F;
};
function Y(e, u, t) {
return String(e).normalize().replace(/\r\n/g, `
`).split(`
`).map((F) => lD(F, u, t)).join(`
`);
}
var xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
var B = { actions: new Set(xD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
function $(e, u) {
if (typeof e == "string")
return B.aliases.get(e) === u;
for (const t of e)
if (t !== undefined && $(t, u))
return true;
return false;
}
function BD(e, u) {
if (e === u)
return;
const t = e.split(`
`), F = u.split(`
`), s = [];
for (let i2 = 0;i2 < Math.max(t.length, F.length); i2++)
t[i2] !== F[i2] && s.push(i2);
return s;
}
var AD = globalThis.process.platform.startsWith("win");
var S = Symbol("clack:cancel");
function pD(e) {
return e === S;
}
function m(e, u) {
const t = e;
t.isTTY && t.setRawMode(u);
}
function fD({ input: e = j, output: u = M, overwrite: t = true, hideCursor: F = true } = {}) {
const s = g.createInterface({ input: e, output: u, prompt: "", tabSize: 1 });
g.emitKeypressEvents(e, s), e.isTTY && e.setRawMode(true);
const i2 = (D, { name: C, sequence: n }) => {
const E = String(D);
if ($([E, C, n], "cancel")) {
F && u.write(import_sisteransi.cursor.show), process.exit(0);
return;
}
if (!t)
return;
const a = C === "return" ? 0 : -1, o = C === "return" ? -1 : 0;
g.moveCursor(u, a, o, () => {
g.clearLine(u, 1, () => {
e.once("keypress", i2);
});
});
};
return F && u.write(import_sisteransi.cursor.hide), e.once("keypress", i2), () => {
e.off("keypress", i2), F && u.write(import_sisteransi.cursor.show), e.isTTY && !AD && e.setRawMode(false), s.terminal = false, s.close();
};
}
var gD = Object.defineProperty;
var vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
var h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t);
class x {
constructor(u, t = true) {
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
const { input: F = j, output: s = M, render: i2, signal: D, ...C } = u;
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i2.bind(this), this._track = t, this._abortSignal = D, this.input = F, this.output = s;
}
unsubscribe() {
this._subscribers.clear();
}
setSubscriber(u, t) {
const F = this._subscribers.get(u) ?? [];
F.push(t), this._subscribers.set(u, F);
}
on(u, t) {
this.setSubscriber(u, { cb: t });
}
once(u, t) {
this.setSubscriber(u, { cb: t, once: true });
}
emit(u, ...t) {
const F = this._subscribers.get(u) ?? [], s = [];
for (const i2 of F)
i2.cb(...t), i2.once && s.push(() => F.splice(F.indexOf(i2), 1));
for (const i2 of s)
i2();
}
prompt() {
return new Promise((u, t) => {
if (this._abortSignal) {
if (this._abortSignal.aborted)
return this.state = "cancel", this.close(), u(S);
this._abortSignal.addEventListener("abort", () => {
this.state = "cancel", this.close();
}, { once: true });
}
const F = new X;
F._write = (s, i2, D) => {
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
}, this.input.pipe(F), this.rl = O.createInterface({ input: this.input, output: F, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(this.value);
}), this.once("cancel", () => {
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(S);
});
});
}
onKeypress(u, t) {
if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
if (this.opts.validate) {
const F = this.opts.validate(this.value);
F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
}
this.state !== "error" && (this.state = "submit");
}
$([u, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
}
close() {
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
`), m(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
}
restoreCursor() {
const u = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
`).length - 1;
this.output.write(import_sisteransi.cursor.move(-999, u * -1));
}
render() {
const u = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
if (u !== this._prevFrame) {
if (this.state === "initial")
this.output.write(import_sisteransi.cursor.hide);
else {
const t = BD(this._prevFrame, u);
if (this.restoreCursor(), t && t?.length === 1) {
const F = t[0];
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.lines(1));
const s = u.split(`
`);
this.output.write(s[F]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - F - 1));
return;
}
if (t && t?.length > 1) {
const F = t[0];
this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.down());
const s = u.split(`
`).slice(F);
this.output.write(s.join(`
`)), this._prevFrame = u;
return;
}
this.output.write(import_sisteransi.erase.down());
}
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
}
}
}
var A;
A = new WeakMap;
var OD = Object.defineProperty;
var PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
var J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t);
class LD extends x {
constructor(u) {
super(u, false), J(this, "options"), J(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: t }) => t === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
switch (t) {
case "left":
case "up":
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
break;
case "down":
case "right":
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
break;
}
this.changeValue();
});
}
get _value() {
return this.options[this.cursor];
}
changeValue() {
this.value = this._value.value;
}
}
// node_modules/@clack/prompts/dist/index.mjs
var import_picocolors3 = __toESM(require_picocolors(), 1);
var import_sisteransi2 = __toESM(require_src(), 1);
import y2 from "process";
function ce() {
return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
}
var V2 = ce();
var u = (t, n) => V2 ? t : n;
var le = u("\u25C6", "*");
var L2 = u("\u25A0", "x");
var W2 = u("\u25B2", "x");
var C = u("\u25C7", "o");
var ue = u("\u250C", "T");
var o = u("\u2502", "|");
var d2 = u("\u2514", "\u2014");
var k2 = u("\u25CF", ">");
var P2 = u("\u25CB", " ");
var A2 = u("\u25FB", "[\u2022]");
var T = u("\u25FC", "[+]");
var F = u("\u25FB", "[ ]");
var $e = u("\u25AA", "\u2022");
var _2 = u("\u2500", "-");
var me = u("\u256E", "+");
var de = u("\u251C", "+");
var pe = u("\u256F", "+");
var q = u("\u25CF", "\u2022");
var D = u("\u25C6", "*");
var U = u("\u25B2", "!");
var K2 = u("\u25A0", "x");
var b2 = (t) => {
switch (t) {
case "initial":
case "active":
return import_picocolors3.default.cyan(le);
case "cancel":
return import_picocolors3.default.red(L2);
case "error":
return import_picocolors3.default.yellow(W2);
case "submit":
return import_picocolors3.default.green(C);
}
};
var G2 = (t) => {
const { cursor: n, options: r2, style: i2 } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
let l2 = 0;
n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
return r2.slice(l2, l2 + a).map((p2, v, f) => {
const j2 = v === 0 && $2, E = v === f.length - 1 && g2;
return j2 || E ? import_picocolors3.default.dim("...") : i2(p2, v + l2 === n);
});
};
var ve = (t) => {
const n = (r2, i2) => {
const s = r2.label ?? String(r2.value);
switch (i2) {
case "selected":
return `${import_picocolors3.default.dim(s)}`;
case "active":
return `${import_picocolors3.default.green(k2)} ${s} ${r2.hint ? import_picocolors3.default.dim(`(${r2.hint})`) : ""}`;
case "cancelled":
return `${import_picocolors3.default.strikethrough(import_picocolors3.default.dim(s))}`;
default:
return `${import_picocolors3.default.dim(P2)} ${import_picocolors3.default.dim(s)}`;
}
};
return new LD({ options: t.options, initialValue: t.initialValue, render() {
const r2 = `${import_picocolors3.default.gray(o)}
${b2(this.state)} ${t.message}
`;
switch (this.state) {
case "submit":
return `${r2}${import_picocolors3.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
case "cancel":
return `${r2}${import_picocolors3.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
${import_picocolors3.default.gray(o)}`;
default:
return `${r2}${import_picocolors3.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i2, s) => n(i2, s ? "active" : "inactive") }).join(`
${import_picocolors3.default.cyan(o)} `)}
${import_picocolors3.default.cyan(d2)}
`;
}
} }).prompt();
};
var Me = (t = "", n = "") => {
const r2 = `
${t}
`.split(`
`), i2 = S2(n).length, s = Math.max(r2.reduce((a, l2) => {
const $2 = S2(l2);
return $2.length > a ? $2.length : a;
}, 0), i2) + 2, c = r2.map((a) => `${import_picocolors3.default.gray(o)} ${import_picocolors3.default.dim(a)}${" ".repeat(s - S2(a).length)}${import_picocolors3.default.gray(o)}`).join(`
`);
process.stdout.write(`${import_picocolors3.default.gray(o)}
${import_picocolors3.default.green(C)} ${import_picocolors3.default.reset(n)} ${import_picocolors3.default.gray(_2.repeat(Math.max(s - i2 - 1, 1)) + me)}
${c}
${import_picocolors3.default.gray(de + _2.repeat(s + 2) + pe)}
`);
};
var xe = (t = "") => {
process.stdout.write(`${import_picocolors3.default.gray(d2)} ${import_picocolors3.default.red(t)}
`);
};
var Ie = (t = "") => {
process.stdout.write(`${import_picocolors3.default.gray(ue)} ${t}
`);
};
var Se = (t = "") => {
process.stdout.write(`${import_picocolors3.default.gray(o)}
${import_picocolors3.default.gray(d2)} ${t}
`);
};
var M2 = { message: (t = "", { symbol: n = import_picocolors3.default.gray(o) } = {}) => {
const r2 = [`${import_picocolors3.default.gray(o)}`];
if (t) {
const [i2, ...s] = t.split(`
`);
r2.push(`${n} ${i2}`, ...s.map((c) => `${import_picocolors3.default.gray(o)} ${c}`));
}
process.stdout.write(`${r2.join(`
`)}
`);
}, info: (t) => {
M2.message(t, { symbol: import_picocolors3.default.blue(q) });
}, success: (t) => {
M2.message(t, { symbol: import_picocolors3.default.green(D) });
}, step: (t) => {
M2.message(t, { symbol: import_picocolors3.default.green(C) });
}, warn: (t) => {
M2.message(t, { symbol: import_picocolors3.default.yellow(U) });
}, warning: (t) => {
M2.warn(t);
}, error: (t) => {
M2.message(t, { symbol: import_picocolors3.default.red(K2) });
} };
var J2 = `${import_picocolors3.default.gray(o)} `;
var Y2 = ({ indicator: t = "dots" } = {}) => {
const n = V2 ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], r2 = V2 ? 80 : 120, i2 = process.env.CI === "true";
let s, c, a = false, l2 = "", $2, g2 = performance.now();
const p2 = (m2) => {
const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
a && N2(h2, m2);
}, v = () => p2(2), f = () => p2(1), j2 = () => {
process.on("uncaughtExceptionMonitor", v), process.on("unhandledRejection", v), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p2);
}, E = () => {
process.removeListener("uncaughtExceptionMonitor", v), process.removeListener("unhandledRejection", v), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p2);
}, B2 = () => {
if ($2 === undefined)
return;
i2 && process.stdout.write(`
`);
const m2 = $2.split(`
`);
process.stdout.write(import_sisteransi2.cursor.move(-999, m2.length - 1)), process.stdout.write(import_sisteransi2.erase.down(m2.length));
}, R2 = (m2) => m2.replace(/\.+$/, ""), O2 = (m2) => {
const h2 = (performance.now() - m2) / 1000, w2 = Math.floor(h2 / 60), I2 = Math.floor(h2 % 60);
return w2 > 0 ? `[${w2}m ${I2}s]` : `[${I2}s]`;
}, H = (m2 = "") => {
a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${import_picocolors3.default.gray(o)}
`);
let h2 = 0, w2 = 0;
j2(), c = setInterval(() => {
if (i2 && l2 === $2)
return;
B2(), $2 = l2;
const I2 = import_picocolors3.default.magenta(n[h2]);
if (i2)
process.stdout.write(`${I2} ${l2}...`);
else if (t === "timer")
process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
else {
const z2 = ".".repeat(Math.floor(w2)).slice(0, 3);
process.stdout.write(`${I2} ${l2}${z2}`);
}
h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
}, r2);
}, N2 = (m2 = "", h2 = 0) => {
a = false, clearInterval(c), B2();
const w2 = h2 === 0 ? import_picocolors3.default.green(C) : h2 === 1 ? import_picocolors3.default.red(L2) : import_picocolors3.default.red(W2);
l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
`) : process.stdout.write(`${w2} ${l2}
`), E(), s();
};
return { start: H, stop: N2, message: (m2 = "") => {
l2 = R2(m2 ?? l2);
} };
};
// src/cli/tui-installer.ts
init_config_manager();
var import_picocolors4 = __toESM(require_picocolors(), 1);
// src/cli/tui-install-prompts.ts
async function selectOrCancel(params) {
if (!process.stdin.isTTY || !process.stdout.isTTY)
return null;
const value = await ve({
message: params.message,
options: params.options,
initialValue: params.initialValue
});
if (pD(value)) {
xe("Installation cancelled.");
return null;
}
return value;
}
async function promptInstallConfig(detected) {
const initial = detectedToInitialValues(detected);
const claude = await selectOrCancel({
message: "Do you have a Claude Pro/Max subscription?",
options: [
{ value: "no", label: "No", hint: "Will use opencode/big-pickle as fallback" },
{ value: "yes", label: "Yes (standard)", hint: "Claude Opus 4.5 for orchestration" },
{ value: "max20", label: "Yes (max20 mode)", hint: "Full power with Claude Sonnet 4.6 for Librarian" }
],
initialValue: initial.claude
});
if (!claude)
return null;
const openai = await selectOrCancel({
message: "Do you have an OpenAI/ChatGPT Plus subscription?",
options: [
{ value: "no", label: "No", hint: "Oracle will use fallback models" },
{ value: "yes", label: "Yes", hint: "GPT-5.4 for Oracle (high-IQ debugging)" }
],
initialValue: initial.openai
});
if (!openai)
return null;
const gemini = await selectOrCancel({
message: "Will you integrate Google Gemini?",
options: [
{ value: "no", label: "No", hint: "Frontend/docs agents will use fallback" },
{ value: "yes", label: "Yes", hint: "Beautiful UI generation with Gemini 3 Pro" }
],
initialValue: initial.gemini
});
if (!gemini)
return null;
const copilot = await selectOrCancel({
message: "Do you have a GitHub Copilot subscription?",
options: [
{ value: "no", label: "No", hint: "Only native providers will be used" },
{ value: "yes", label: "Yes", hint: "Fallback option when native providers unavailable" }
],
initialValue: initial.copilot
});
if (!copilot)
return null;
const opencodeZen = await selectOrCancel({
message: "Do you have access to OpenCode Zen (opencode/ models)?",
options: [
{ value: "no", label: "No", hint: "Will use other configured providers" },
{ value: "yes", label: "Yes", hint: "opencode/claude-opus-4-6, opencode/gpt-5.4, etc." }
],
initialValue: initial.opencodeZen
});
if (!opencodeZen)
return null;
const zaiCodingPlan = await selectOrCancel({
message: "Do you have a Z.ai Coding Plan subscription?",
options: [
{ value: "no", label: "No", hint: "Will use other configured providers" },
{ value: "yes", label: "Yes", hint: "Fallback for Librarian and Multimodal Looker" }
],
initialValue: initial.zaiCodingPlan
});
if (!zaiCodingPlan)
return null;
const kimiForCoding = await selectOrCancel({
message: "Do you have a Kimi For Coding subscription?",
options: [
{ value: "no", label: "No", hint: "Will use other configured providers" },
{ value: "yes", label: "Yes", hint: "Kimi K2.5 for Sisyphus/Prometheus fallback" }
],
initialValue: initial.kimiForCoding
});
if (!kimiForCoding)
return null;
const opencodeGo = await selectOrCancel({
message: "Do you have an OpenCode Go subscription?",
options: [
{ value: "no", label: "No", hint: "Will use other configured providers" },
{ value: "yes", label: "Yes", hint: "OpenCode Go for quick tasks" }
],
initialValue: initial.opencodeGo
});
if (!opencodeGo)
return null;
return {
hasClaude: claude !== "no",
isMax20: claude === "max20",
hasOpenAI: openai === "yes",
hasGemini: gemini === "yes",
hasCopilot: copilot === "yes",
hasOpencodeZen: opencodeZen === "yes",
hasZaiCodingPlan: zaiCodingPlan === "yes",
hasKimiForCoding: kimiForCoding === "yes",
hasOpencodeGo: opencodeGo === "yes"
};
}
// src/cli/tui-installer.ts
async function runTuiInstaller(args, version) {
if (!process.stdin.isTTY || !process.stdout.isTTY) {
console.error("Error: Interactive installer requires a TTY. Use --non-interactive or set environment variables directly.");
return 1;
}
const detected = detectCurrentConfig();
const isUpdate = detected.isInstalled;
Ie(import_picocolors4.default.bgMagenta(import_picocolors4.default.white(isUpdate ? " oMoMoMoMo... Update " : " oMoMoMoMo... ")));
if (isUpdate) {
const initial = detectedToInitialValues(detected);
M2.info(`Existing configuration detected: Claude=${initial.claude}, Gemini=${initial.gemini}`);
}
const spinner = Y2();
spinner.start("Checking OpenCode installation");
const installed = await isOpenCodeInstalled();
const openCodeVersion = await getOpenCodeVersion();
if (!installed) {
spinner.stop(`OpenCode binary not found ${import_picocolors4.default.yellow("[!]")}`);
M2.warn("OpenCode binary not found. Plugin will be configured, but you'll need to install OpenCode to use it.");
Me("Visit https://opencode.ai/docs for installation instructions", "Installation Guide");
} else {
spinner.stop(`OpenCode ${openCodeVersion ?? "installed"} ${import_picocolors4.default.green("[OK]")}`);
}
const config = await promptInstallConfig(detected);
if (!config)
return 1;
spinner.start("Adding oh-my-opencode to OpenCode config");
const pluginResult = await addPluginToOpenCodeConfig(version);
if (!pluginResult.success) {
spinner.stop(`Failed to add plugin: ${pluginResult.error}`);
Se(import_picocolors4.default.red("Installation failed."));
return 1;
}
spinner.stop(`Plugin added to ${import_picocolors4.default.cyan(pluginResult.configPath)}`);
spinner.start("Writing oh-my-opencode configuration");
const omoResult = writeOmoConfig(config);
if (!omoResult.success) {
spinner.stop(`Failed to write config: ${omoResult.error}`);
Se(import_picocolors4.default.red("Installation failed."));
return 1;
}
spinner.stop(`Config written to ${import_picocolors4.default.cyan(omoResult.configPath)}`);
if (!config.hasClaude) {
console.log();
console.log(import_picocolors4.default.bgRed(import_picocolors4.default.white(import_picocolors4.default.bold(" CRITICAL WARNING "))));
console.log();
console.log(import_picocolors4.default.red(import_picocolors4.default.bold(" Sisyphus agent is STRONGLY optimized for Claude Opus 4.5.")));
console.log(import_picocolors4.default.red(" Without Claude, you may experience significantly degraded performance:"));
console.log(import_picocolors4.default.dim(" \u2022 Reduced orchestration quality"));
console.log(import_picocolors4.default.dim(" \u2022 Weaker tool selection and delegation"));
console.log(import_picocolors4.default.dim(" \u2022 Less reliable task completion"));
console.log();
console.log(import_picocolors4.default.yellow(" Consider subscribing to Claude Pro/Max for the best experience."));
console.log();
}
if (!config.hasClaude && !config.hasOpenAI && !config.hasGemini && !config.hasCopilot && !config.hasOpencodeZen) {
M2.warn("No model providers configured. Using opencode/big-pickle as fallback.");
}
Me(formatConfigSummary(config), isUpdate ? "Updated Configuration" : "Installation Complete");
M2.success(import_picocolors4.default.bold(isUpdate ? "Configuration updated!" : "Installation complete!"));
M2.message(`Run ${import_picocolors4.default.cyan("opencode")} to start!`);
Me(`Include ${import_picocolors4.default.cyan("ultrawork")} (or ${import_picocolors4.default.cyan("ulw")}) in your prompt.
` + `All features work like magic\u2014parallel agents, background tasks,
` + `deep exploration, and relentless execution until completion.`, "The Magic Word");
M2.message(`${import_picocolors4.default.yellow("\u2605")} If you found this helpful, consider starring the repo!`);
M2.message(` ${import_picocolors4.default.dim("gh api --silent --method PUT /user/starred/code-yeongyu/oh-my-openagent >/dev/null 2>&1 || true")}`);
Se(import_picocolors4.default.green("oMoMoMoMo... Enjoy!"));
if ((config.hasClaude || config.hasGemini || config.hasCopilot) && !args.skipAuth) {
const providers = [];
if (config.hasClaude)
providers.push(`Anthropic ${import_picocolors4.default.gray("\u2192 Claude Pro/Max")}`);
if (config.hasGemini)
providers.push(`Google ${import_picocolors4.default.gray("\u2192 Gemini")}`);
if (config.hasCopilot)
providers.push(`GitHub ${import_picocolors4.default.gray("\u2192 Copilot")}`);
console.log();
console.log(import_picocolors4.default.bold("Authenticate Your Providers"));
console.log();
console.log(` Run ${import_picocolors4.default.cyan("opencode auth login")} and select:`);
for (const provider of providers) {
console.log(` ${SYMBOLS.bullet} ${provider}`);
}
console.log();
}
return 0;
}
// src/cli/install.ts
var VERSION = package_default.version;
async function install(args) {
return args.tui ? runTuiInstaller(args, VERSION) : runCliInstaller(args, VERSION);
}
// src/cli/run/runner.ts
var import_picocolors14 = __toESM(require_picocolors(), 1);
// src/cli/run/event-state.ts
function createEventState() {
return {
mainSessionIdle: false,
mainSessionError: false,
lastError: null,
lastOutput: "",
lastPartText: "",
currentTool: null,
hasReceivedMeaningfulWork: false,
lastEventTimestamp: Date.now(),
messageCount: 0,
currentAgent: null,
currentModel: null,
currentVariant: null,
currentMessageRole: null,
agentColorsByName: {},
partTypesById: {},
inThinkBlock: false,
lastReasoningText: "",
hasPrintedThinkingLine: false,
lastThinkingLineWidth: 0,
messageRoleById: {},
lastThinkingSummary: "",
textAtLineStart: true,
thinkingAtLineStart: false,
currentMessageId: null,
messageStartedAtById: {},
completionMetaPrintedByMessageId: {}
};
}
// src/cli/run/event-formatting.ts
var import_picocolors5 = __toESM(require_picocolors(), 1);
function serializeError(error) {
if (!error)
return "Unknown error";
if (error instanceof Error) {
const parts = [error.message];
if (error.cause) {
parts.push(`Cause: ${serializeError(error.cause)}`);
}
return parts.join(" | ");
}
if (typeof error === "string") {
return error;
}
if (typeof error === "object") {
const obj = error;
const messagePaths = [
obj.message,
obj.error,
obj.data?.message,
obj.data?.error,
obj.error?.message
];
for (const msg of messagePaths) {
if (typeof msg === "string" && msg.length > 0) {
return msg;
}
}
try {
const json2 = JSON.stringify(error, null, 2);
if (json2 !== "{}") {
return json2;
}
} catch (_3) {}
}
return String(error);
}
function getSessionTag(ctx, payload) {
const props = payload.properties;
const info = props?.info;
const part = props?.part;
const sessionID = props?.sessionID ?? props?.sessionId ?? info?.sessionID ?? info?.sessionId ?? part?.sessionID ?? part?.sessionId;
const isMainSession = sessionID === ctx.sessionID;
if (isMainSession)
return import_picocolors5.default.green("[MAIN]");
if (sessionID)
return import_picocolors5.default.yellow(`[${String(sessionID).slice(0, 8)}]`);
return import_picocolors5.default.dim("[system]");
}
function logEventVerbose(ctx, payload) {
const sessionTag = getSessionTag(ctx, payload);
const props = payload.properties;
switch (payload.type) {
case "session.idle":
case "session.status": {
const status = props?.status?.type ?? "idle";
console.error(import_picocolors5.default.dim(`${sessionTag} ${payload.type}: ${status}`));
break;
}
case "message.part.updated": {
const partProps = props;
const part = partProps?.part;
if (part?.type === "tool") {
const status = part.state?.status ?? "unknown";
console.error(import_picocolors5.default.dim(`${sessionTag} message.part (tool): ${part.tool ?? part.name ?? "?"} [${status}]`));
} else if (part?.type === "text" && part.text) {
const preview = part.text.slice(0, 80).replace(/\n/g, "\\n");
console.error(import_picocolors5.default.dim(`${sessionTag} message.part (text): "${preview}${part.text.length > 80 ? "..." : ""}"`));
}
break;
}
case "message.part.delta": {
const deltaProps = props;
const field = deltaProps?.field ?? "unknown";
const delta = deltaProps?.delta ?? "";
const preview = delta.slice(0, 80).replace(/\n/g, "\\n");
console.error(import_picocolors5.default.dim(`${sessionTag} message.part.delta (${field}): "${preview}${delta.length > 80 ? "..." : ""}"`));
break;
}
case "message.updated": {
const msgProps = props;
const role = msgProps?.info?.role ?? "unknown";
const model = msgProps?.info?.modelID;
const agent = msgProps?.info?.agent;
const details = [role, agent, model].filter(Boolean).join(", ");
console.error(import_picocolors5.default.dim(`${sessionTag} message.updated (${details})`));
break;
}
case "tool.execute": {
const toolProps = props;
const toolName = toolProps?.name ?? "unknown";
const input = toolProps?.input ?? {};
let inputStr;
try {
inputStr = JSON.stringify(input);
} catch {
try {
inputStr = String(input);
} catch {
inputStr = "[unserializable]";
}
}
const inputPreview = inputStr.slice(0, 150);
console.error(import_picocolors5.default.cyan(`${sessionTag} TOOL.EXECUTE: ${import_picocolors5.default.bold(toolName)}`));
console.error(import_picocolors5.default.dim(` input: ${inputPreview}${inputStr.length >= 150 ? "..." : ""}`));
break;
}
case "tool.result": {
const resultProps = props;
const output = resultProps?.output ?? "";
const preview = output.slice(0, 200).replace(/\n/g, "\\n");
console.error(import_picocolors5.default.green(`${sessionTag} TOOL.RESULT: "${preview}${output.length > 200 ? "..." : ""}"`));
break;
}
case "session.error": {
const errorProps = props;
const errorMsg = serializeError(errorProps?.error);
console.error(import_picocolors5.default.red(`${sessionTag} SESSION.ERROR: ${errorMsg}`));
break;
}
default:
console.error(import_picocolors5.default.dim(`${sessionTag} ${payload.type}`));
}
}
// src/cli/run/event-stream-processor.ts
var import_picocolors8 = __toESM(require_picocolors(), 1);
// src/cli/run/event-handlers.ts
var import_picocolors7 = __toESM(require_picocolors(), 1);
// src/cli/run/tool-input-preview.ts
function formatToolHeader(toolName, input) {
if (toolName === "glob") {
const pattern = str2(input.pattern);
const root = str2(input.path);
return {
icon: "\u2731",
title: pattern ? `Glob "${pattern}"` : "Glob",
description: root ? `in ${root}` : undefined
};
}
if (toolName === "grep") {
const pattern = str2(input.pattern);
const root = str2(input.path);
return {
icon: "\u2731",
title: pattern ? `Grep "${pattern}"` : "Grep",
description: root ? `in ${root}` : undefined
};
}
if (toolName === "list") {
const path3 = str2(input.path);
return {
icon: "\u2192",
title: path3 ? `List ${path3}` : "List"
};
}
if (toolName === "read") {
const filePath = str2(input.filePath);
return {
icon: "\u2192",
title: filePath ? `Read ${filePath}` : "Read",
description: formatKeyValues(input, ["filePath"])
};
}
if (toolName === "write") {
const filePath = str2(input.filePath);
return {
icon: "\u2190",
title: filePath ? `Write ${filePath}` : "Write"
};
}
if (toolName === "edit") {
const filePath = str2(input.filePath);
return {
icon: "\u2190",
title: filePath ? `Edit ${filePath}` : "Edit",
description: formatKeyValues(input, ["filePath", "oldString", "newString"])
};
}
if (toolName === "webfetch") {
const url = str2(input.url);
return {
icon: "%",
title: url ? `WebFetch ${url}` : "WebFetch",
description: formatKeyValues(input, ["url"])
};
}
if (toolName === "websearch_web_search_exa") {
const query = str2(input.query);
return {
icon: "\u25C8",
title: query ? `Web Search "${query}"` : "Web Search"
};
}
if (toolName === "grep_app_searchGitHub") {
const query = str2(input.query);
return {
icon: "\u25C7",
title: query ? `Code Search "${query}"` : "Code Search"
};
}
if (toolName === "task") {
const desc = str2(input.description);
const subagent = str2(input.subagent_type);
return {
icon: "#",
title: desc || (subagent ? `${subagent} Task` : "Task"),
description: subagent ? `agent=${subagent}` : undefined
};
}
if (toolName === "bash") {
const command = str2(input.command);
return {
icon: "$",
title: command || "bash",
description: formatKeyValues(input, ["command"])
};
}
if (toolName === "skill") {
const name = str2(input.name);
return {
icon: "\u2192",
title: name ? `Skill "${name}"` : "Skill"
};
}
if (toolName === "todowrite") {
return {
icon: "#",
title: "Todos"
};
}
return {
icon: "\u2699",
title: toolName,
description: formatKeyValues(input, [])
};
}
function formatKeyValues(input, exclude) {
const entries = Object.entries(input).filter(([key, value]) => {
if (exclude.includes(key))
return false;
return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
});
if (!entries.length)
return;
return entries.map(([key, value]) => `${key}=${String(value)}`).join(" ");
}
function str2(value) {
if (typeof value !== "string")
return;
const trimmed = value.trim();
return trimmed.length ? trimmed : undefined;
}
// src/cli/run/display-chars.ts
var isCI = Boolean(process.env.CI || process.env.GITHUB_ACTIONS);
var displayChars = {
treeEnd: isCI ? "`-" : "\u2514\u2500",
treeIndent: " ",
treeJoin: isCI ? " " : " "
};
// src/cli/run/output-renderer.ts
var import_picocolors6 = __toESM(require_picocolors(), 1);
function renderAgentHeader(agent, model, variant, agentColorsByName) {
if (!agent && !model)
return;
const agentLabel = agent ? import_picocolors6.default.bold(colorizeWithProfileColor(agent, agentColorsByName[agent])) : "";
const modelBase = model ?? "";
const variantSuffix = variant ? ` (${variant})` : "";
const modelLabel = model ? import_picocolors6.default.dim(`${modelBase}${variantSuffix}`) : "";
process.stdout.write(`
`);
if (modelLabel) {
process.stdout.write(` ${modelLabel}
`);
}
if (agentLabel) {
process.stdout.write(` ${import_picocolors6.default.dim("\u2514\u2500")} ${agentLabel}
`);
}
process.stdout.write(`
`);
}
function openThinkBlock() {
process.stdout.write(`
${import_picocolors6.default.dim("\u2503 Thinking:")} `);
}
function closeThinkBlock() {
process.stdout.write(`
`);
}
function writePaddedText(text, atLineStart) {
const isGitHubActions = process.env.GITHUB_ACTIONS === "true";
if (isGitHubActions) {
return { output: text, atLineStart: text.endsWith(`
`) };
}
let output = "";
let lineStart = atLineStart;
for (let i2 = 0;i2 < text.length; i2++) {
const ch = text[i2];
if (lineStart) {
output += " ";
lineStart = false;
}
if (ch === `
`) {
output += `
`;
lineStart = true;
continue;
}
output += ch;
}
return { output, atLineStart: lineStart };
}
function colorizeWithProfileColor(text, hexColor) {
if (!hexColor)
return import_picocolors6.default.magenta(text);
const rgb = parseHexColor(hexColor);
if (!rgb)
return import_picocolors6.default.magenta(text);
const [r2, g2, b3] = rgb;
return `\x1B[38;2;${r2};${g2};${b3}m${text}\x1B[39m`;
}
function parseHexColor(hexColor) {
const cleaned = hexColor.trim();
const match = cleaned.match(/^#?([A-Fa-f0-9]{6})$/);
if (!match)
return null;
const hex = match[1];
const r2 = Number.parseInt(hex.slice(0, 2), 16);
const g2 = Number.parseInt(hex.slice(2, 4), 16);
const b3 = Number.parseInt(hex.slice(4, 6), 16);
return [r2, g2, b3];
}
// src/cli/run/event-handlers.ts
function getSessionId(props) {
return props?.sessionID ?? props?.sessionId;
}
function getInfoSessionId(props) {
return props?.info?.sessionID ?? props?.info?.sessionId;
}
function getPartSessionId(props) {
return props?.part?.sessionID ?? props?.part?.sessionId;
}
function getPartMessageId(props) {
return props?.part?.messageID;
}
function getDeltaMessageId(props) {
return props?.messageID;
}
function renderCompletionMetaLine(state, messageID) {
if (state.completionMetaPrintedByMessageId[messageID])
return;
const startedAt = state.messageStartedAtById[messageID];
const elapsedSec = startedAt ? ((Date.now() - startedAt) / 1000).toFixed(1) : "0.0";
const agent = state.currentAgent ?? "assistant";
const model = state.currentModel ?? "unknown-model";
const variant = state.currentVariant ? ` (${state.currentVariant})` : "";
process.stdout.write(import_picocolors7.default.dim(`
${displayChars.treeEnd} ${agent} \xB7 ${model}${variant} \xB7 ${elapsedSec}s
`));
state.completionMetaPrintedByMessageId[messageID] = true;
}
function handleSessionIdle(ctx, payload, state) {
if (payload.type !== "session.idle")
return;
const props = payload.properties;
if (getSessionId(props) === ctx.sessionID) {
state.mainSessionIdle = true;
}
}
function handleSessionStatus(ctx, payload, state) {
if (payload.type !== "session.status")
return;
const props = payload.properties;
if (getSessionId(props) !== ctx.sessionID)
return;
if (props?.status?.type === "busy") {
state.mainSessionIdle = false;
} else if (props?.status?.type === "idle") {
state.mainSessionIdle = true;
} else if (props?.status?.type === "retry") {
state.mainSessionIdle = false;
}
}
function handleSessionError(ctx, payload, state) {
if (payload.type !== "session.error")
return;
const props = payload.properties;
if (getSessionId(props) === ctx.sessionID) {
state.mainSessionError = true;
state.lastError = serializeError(props?.error);
console.error(import_picocolors7.default.red(`
[session.error] ${state.lastError}`));
}
}
function handleMessagePartUpdated(ctx, payload, state) {
if (payload.type !== "message.part.updated")
return;
const props = payload.properties;
const partSid = getPartSessionId(props);
const infoSid = getInfoSessionId(props);
if ((partSid ?? infoSid) !== ctx.sessionID)
return;
const role = props?.info?.role;
const mappedRole = getPartMessageId(props) ? state.messageRoleById[getPartMessageId(props) ?? ""] : undefined;
if ((role ?? mappedRole) === "user")
return;
const part = props?.part;
if (!part)
return;
if (part.id && part.type) {
state.partTypesById[part.id] = part.type;
}
if (part.type === "reasoning") {
ensureThinkBlockOpen(state);
const reasoningText = part.text ?? "";
const newText = reasoningText.slice(state.lastReasoningText.length);
if (newText) {
const padded = writePaddedText(newText, state.thinkingAtLineStart);
process.stdout.write(import_picocolors7.default.dim(padded.output));
state.thinkingAtLineStart = padded.atLineStart;
state.hasReceivedMeaningfulWork = true;
}
state.lastReasoningText = reasoningText;
return;
}
closeThinkBlockIfNeeded(state);
if (part.type === "text" && part.text) {
const newText = part.text.slice(state.lastPartText.length);
if (newText) {
const padded = writePaddedText(newText, state.textAtLineStart);
process.stdout.write(padded.output);
state.textAtLineStart = padded.atLineStart;
state.hasReceivedMeaningfulWork = true;
}
state.lastPartText = part.text;
if (part.time?.end) {
const messageID = part.messageID ?? state.currentMessageId;
if (messageID) {
renderCompletionMetaLine(state, messageID);
}
}
}
if (part.type === "tool") {
handleToolPart(ctx, part, state);
}
}
function handleMessagePartDelta(ctx, payload, state) {
if (payload.type !== "message.part.delta")
return;
const props = payload.properties;
const sessionID = props?.sessionID ?? props?.sessionId;
if (sessionID !== ctx.sessionID)
return;
const role = getDeltaMessageId(props) ? state.messageRoleById[getDeltaMessageId(props) ?? ""] : undefined;
if (role === "user")
return;
if (props?.field !== "text")
return;
const partType = props?.partID ? state.partTypesById[props.partID] : undefined;
const delta = props.delta ?? "";
if (!delta)
return;
if (partType === "reasoning") {
ensureThinkBlockOpen(state);
const padded2 = writePaddedText(delta, state.thinkingAtLineStart);
process.stdout.write(import_picocolors7.default.dim(padded2.output));
state.thinkingAtLineStart = padded2.atLineStart;
state.lastReasoningText += delta;
state.hasReceivedMeaningfulWork = true;
return;
}
closeThinkBlockIfNeeded(state);
const padded = writePaddedText(delta, state.textAtLineStart);
process.stdout.write(padded.output);
state.textAtLineStart = padded.atLineStart;
state.lastPartText += delta;
state.hasReceivedMeaningfulWork = true;
}
function handleToolPart(_ctx, part, state) {
const toolName = part.tool || part.name || "unknown";
const status = part.state?.status;
if (status === "running") {
if (state.currentTool !== null)
return;
state.currentTool = toolName;
const header = formatToolHeader(toolName, part.state?.input ?? {});
const suffix = header.description ? ` ${import_picocolors7.default.dim(header.description)}` : "";
state.hasReceivedMeaningfulWork = true;
process.stdout.write(`
${import_picocolors7.default.cyan(header.icon)} ${import_picocolors7.default.bold(header.title)}${suffix}
`);
}
if (status === "completed" || status === "error") {
if (state.currentTool === null)
return;
const output = part.state?.output || "";
if (output.trim()) {
process.stdout.write(import_picocolors7.default.dim(` ${displayChars.treeEnd} output
`));
const padded = writePaddedText(output, true);
process.stdout.write(import_picocolors7.default.dim(padded.output + (padded.atLineStart ? "" : " ")));
process.stdout.write(`
`);
}
state.currentTool = null;
state.lastPartText = "";
state.textAtLineStart = true;
}
}
function handleMessageUpdated(ctx, payload, state) {
if (payload.type !== "message.updated")
return;
const props = payload.properties;
if (getInfoSessionId(props) !== ctx.sessionID)
return;
state.currentMessageRole = props?.info?.role ?? null;
const messageID = props?.info?.id ?? null;
const role = props?.info?.role;
if (messageID && role) {
state.messageRoleById[messageID] = role;
}
if (props?.info?.role !== "assistant")
return;
const isNewMessage = !messageID || messageID !== state.currentMessageId;
if (isNewMessage) {
state.currentMessageId = messageID;
state.hasReceivedMeaningfulWork = true;
state.messageCount++;
state.lastPartText = "";
state.lastReasoningText = "";
state.hasPrintedThinkingLine = false;
state.lastThinkingSummary = "";
state.textAtLineStart = true;
state.thinkingAtLineStart = false;
closeThinkBlockIfNeeded(state);
if (messageID) {
state.messageStartedAtById[messageID] = Date.now();
state.completionMetaPrintedByMessageId[messageID] = false;
}
}
const agent = props?.info?.agent ?? null;
const model = props?.info?.modelID ?? null;
const variant = props?.info?.variant ?? null;
if (agent !== state.currentAgent || model !== state.currentModel || variant !== state.currentVariant) {
state.currentAgent = agent;
state.currentModel = model;
state.currentVariant = variant;
renderAgentHeader(agent, model, variant, state.agentColorsByName);
}
}
function handleToolExecute(ctx, payload, state) {
if (payload.type !== "tool.execute")
return;
const props = payload.properties;
if (getSessionId(props) !== ctx.sessionID)
return;
closeThinkBlockIfNeeded(state);
if (state.currentTool !== null)
return;
const toolName = props?.name || "unknown";
state.currentTool = toolName;
const header = formatToolHeader(toolName, props?.input ?? {});
const suffix = header.description ? ` ${import_picocolors7.default.dim(header.description)}` : "";
state.hasReceivedMeaningfulWork = true;
process.stdout.write(`
${import_picocolors7.default.cyan(header.icon)} ${import_picocolors7.default.bold(header.title)}${suffix}
`);
}
function handleToolResult(ctx, payload, state) {
if (payload.type !== "tool.result")
return;
const props = payload.properties;
if (getSessionId(props) !== ctx.sessionID)
return;
closeThinkBlockIfNeeded(state);
if (state.currentTool === null)
return;
const output = props?.output || "";
if (output.trim()) {
process.stdout.write(import_picocolors7.default.dim(` ${displayChars.treeEnd} output
`));
const padded = writePaddedText(output, true);
process.stdout.write(import_picocolors7.default.dim(padded.output + (padded.atLineStart ? "" : " ")));
process.stdout.write(`
`);
}
state.currentTool = null;
state.lastPartText = "";
state.textAtLineStart = true;
}
function handleTuiToast(_ctx, payload, state) {
if (payload.type !== "tui.toast.show")
return;
const props = payload.properties;
const variant = props?.variant ?? "info";
if (variant === "error") {
const title = props?.title ? `${props.title}: ` : "";
const message = props?.message?.trim();
if (message) {
state.mainSessionError = true;
state.lastError = `${title}${message}`;
}
}
}
function ensureThinkBlockOpen(state) {
if (state.inThinkBlock)
return;
openThinkBlock();
state.inThinkBlock = true;
state.hasPrintedThinkingLine = false;
state.thinkingAtLineStart = false;
}
function closeThinkBlockIfNeeded(state) {
if (!state.inThinkBlock)
return;
closeThinkBlock();
state.inThinkBlock = false;
state.lastThinkingLineWidth = 0;
state.lastThinkingSummary = "";
state.thinkingAtLineStart = false;
}
// src/cli/run/event-stream-processor.ts
async function processEvents(ctx, stream, state) {
for await (const event of stream) {
if (ctx.abortController.signal.aborted)
break;
try {
const payload = event;
if (!payload?.type) {
if (ctx.verbose) {
console.error(import_picocolors8.default.dim(`[event] no type: ${JSON.stringify(event)}`));
}
continue;
}
if (ctx.verbose) {
logEventVerbose(ctx, payload);
}
state.lastEventTimestamp = Date.now();
handleSessionError(ctx, payload, state);
handleSessionIdle(ctx, payload, state);
handleSessionStatus(ctx, payload, state);
handleMessagePartUpdated(ctx, payload, state);
handleMessagePartDelta(ctx, payload, state);
handleMessageUpdated(ctx, payload, state);
handleToolExecute(ctx, payload, state);
handleToolResult(ctx, payload, state);
handleTuiToast(ctx, payload, state);
} catch (err) {
console.error(import_picocolors8.default.red(`[event error] ${err}`));
}
}
}
// src/plugin-config.ts
import * as fs3 from "fs";
import * as path3 from "path";
// node_modules/zod/v4/classic/external.js
var exports_external = {};
__export(exports_external, {
xor: () => xor,
xid: () => xid2,
void: () => _void2,
uuidv7: () => uuidv7,
uuidv6: () => uuidv6,
uuidv4: () => uuidv4,
uuid: () => uuid2,
util: () => exports_util,
url: () => url,
uppercase: () => _uppercase,
unknown: () => unknown,
union: () => union,
undefined: () => _undefined3,
ulid: () => ulid2,
uint64: () => uint64,
uint32: () => uint32,
tuple: () => tuple,
trim: () => _trim,
treeifyError: () => treeifyError,
transform: () => transform,
toUpperCase: () => _toUpperCase,
toLowerCase: () => _toLowerCase,
toJSONSchema: () => toJSONSchema,
templateLiteral: () => templateLiteral,
symbol: () => symbol,
superRefine: () => superRefine,
success: () => success,
stringbool: () => stringbool,
stringFormat: () => stringFormat,
string: () => string2,
strictObject: () => strictObject,
startsWith: () => _startsWith,
slugify: () => _slugify,
size: () => _size,
setErrorMap: () => setErrorMap,
set: () => set2,
safeParseAsync: () => safeParseAsync2,
safeParse: () => safeParse2,
safeEncodeAsync: () => safeEncodeAsync2,
safeEncode: () => safeEncode2,
safeDecodeAsync: () => safeDecodeAsync2,
safeDecode: () => safeDecode2,
registry: () => registry,
regexes: () => exports_regexes,
regex: () => _regex,
refine: () => refine,
record: () => record,
readonly: () => readonly,
property: () => _property,
promise: () => promise,
prettifyError: () => prettifyError,
preprocess: () => preprocess,
prefault: () => prefault,
positive: () => _positive,
pipe: () => pipe,
partialRecord: () => partialRecord,
parseAsync: () => parseAsync2,
parse: () => parse5,
overwrite: () => _overwrite,
optional: () => optional,
object: () => object,
number: () => number2,
nullish: () => nullish2,
nullable: () => nullable,
null: () => _null4,
normalize: () => _normalize,
nonpositive: () => _nonpositive,
nonoptional: () => nonoptional,
nonnegative: () => _nonnegative,
never: () => never,
negative: () => _negative,
nativeEnum: () => nativeEnum,
nanoid: () => nanoid2,
nan: () => nan,
multipleOf: () => _multipleOf,
minSize: () => _minSize,
minLength: () => _minLength,
mime: () => _mime,
meta: () => meta2,
maxSize: () => _maxSize,
maxLength: () => _maxLength,
map: () => map2,
mac: () => mac2,
lte: () => _lte,
lt: () => _lt,
lowercase: () => _lowercase,
looseRecord: () => looseRecord,
looseObject: () => looseObject,
locales: () => exports_locales,
literal: () => literal,
length: () => _length,
lazy: () => lazy,
ksuid: () => ksuid2,
keyof: () => keyof,
jwt: () => jwt,
json: () => json2,
iso: () => exports_iso,
ipv6: () => ipv62,
ipv4: () => ipv42,
intersection: () => intersection,
int64: () => int64,
int32: () => int32,
int: () => int2,
instanceof: () => _instanceof,
includes: () => _includes,
httpUrl: () => httpUrl,
hostname: () => hostname2,
hex: () => hex2,
hash: () => hash,
guid: () => guid2,
gte: () => _gte,
gt: () => _gt,
globalRegistry: () => globalRegistry,
getErrorMap: () => getErrorMap,
function: () => _function,
fromJSONSchema: () => fromJSONSchema,
formatError: () => formatError2,
float64: () => float64,
float32: () => float32,
flattenError: () => flattenError,
file: () => file,
exactOptional: () => exactOptional,
enum: () => _enum2,
endsWith: () => _endsWith,
encodeAsync: () => encodeAsync2,
encode: () => encode2,
emoji: () => emoji2,
email: () => email2,
e164: () => e1642,
discriminatedUnion: () => discriminatedUnion,
describe: () => describe2,
decodeAsync: () => decodeAsync2,
decode: () => decode2,
date: () => date3,
custom: () => custom,
cuid2: () => cuid22,
cuid: () => cuid3,
core: () => exports_core2,
config: () => config,
coerce: () => exports_coerce,
codec: () => codec,
clone: () => clone,
cidrv6: () => cidrv62,
cidrv4: () => cidrv42,
check: () => check,
catch: () => _catch2,
boolean: () => boolean2,
bigint: () => bigint2,
base64url: () => base64url2,
base64: () => base642,
array: () => array,
any: () => any,
_function: () => _function,
_default: () => _default3,
_ZodString: () => _ZodString,
ZodXor: () => ZodXor,
ZodXID: () => ZodXID,
ZodVoid: () => ZodVoid,
ZodUnknown: () => ZodUnknown,
ZodUnion: () => ZodUnion,
ZodUndefined: () => ZodUndefined,
ZodUUID: () => ZodUUID,
ZodURL: () => ZodURL,
ZodULID: () => ZodULID,
ZodType: () => ZodType,
ZodTuple: () => ZodTuple,
ZodTransform: () => ZodTransform,
ZodTemplateLiteral: () => ZodTemplateLiteral,
ZodSymbol: () => ZodSymbol,
ZodSuccess: () => ZodSuccess,
ZodStringFormat: () => ZodStringFormat,
ZodString: () => ZodString,
ZodSet: () => ZodSet,
ZodRecord: () => ZodRecord,
ZodRealError: () => ZodRealError,
ZodReadonly: () => ZodReadonly,
ZodPromise: () => ZodPromise,
ZodPrefault: () => ZodPrefault,
ZodPipe: () => ZodPipe,
ZodOptional: () => ZodOptional,
ZodObject: () => ZodObject,
ZodNumberFormat: () => ZodNumberFormat,
ZodNumber: () => ZodNumber,
ZodNullable: () => ZodNullable,
ZodNull: () => ZodNull,
ZodNonOptional: () => ZodNonOptional,
ZodNever: () => ZodNever,
ZodNanoID: () => ZodNanoID,
ZodNaN: () => ZodNaN,
ZodMap: () => ZodMap,
ZodMAC: () => ZodMAC,
ZodLiteral: () => ZodLiteral,
ZodLazy: () => ZodLazy,
ZodKSUID: () => ZodKSUID,
ZodJWT: () => ZodJWT,
ZodIssueCode: () => ZodIssueCode,
ZodIntersection: () => ZodIntersection,
ZodISOTime: () => ZodISOTime,
ZodISODuration: () => ZodISODuration,
ZodISODateTime: () => ZodISODateTime,
ZodISODate: () => ZodISODate,
ZodIPv6: () => ZodIPv6,
ZodIPv4: () => ZodIPv4,
ZodGUID: () => ZodGUID,
ZodFunction: () => ZodFunction,
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
ZodFile: () => ZodFile,
ZodExactOptional: () => ZodExactOptional,
ZodError: () => ZodError,
ZodEnum: () => ZodEnum,
ZodEmoji: () => ZodEmoji,
ZodEmail: () => ZodEmail,
ZodE164: () => ZodE164,
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
ZodDefault: () => ZodDefault,
ZodDate: () => ZodDate,
ZodCustomStringFormat: () => ZodCustomStringFormat,
ZodCustom: () => ZodCustom,
ZodCodec: () => ZodCodec,
ZodCatch: () => ZodCatch,
ZodCUID2: () => ZodCUID2,
ZodCUID: () => ZodCUID,
ZodCIDRv6: () => ZodCIDRv6,
ZodCIDRv4: () => ZodCIDRv4,
ZodBoolean: () => ZodBoolean,
ZodBigIntFormat: () => ZodBigIntFormat,
ZodBigInt: () => ZodBigInt,
ZodBase64URL: () => ZodBase64URL,
ZodBase64: () => ZodBase64,
ZodArray: () => ZodArray,
ZodAny: () => ZodAny,
TimePrecision: () => TimePrecision,
NEVER: () => NEVER,
$output: () => $output,
$input: () => $input,
$brand: () => $brand
});
// node_modules/zod/v4/core/index.js
var exports_core2 = {};
__export(exports_core2, {
version: () => version,
util: () => exports_util,
treeifyError: () => treeifyError,
toJSONSchema: () => toJSONSchema,
toDotPath: () => toDotPath,
safeParseAsync: () => safeParseAsync,
safeParse: () => safeParse,
safeEncodeAsync: () => safeEncodeAsync,
safeEncode: () => safeEncode,
safeDecodeAsync: () => safeDecodeAsync,
safeDecode: () => safeDecode,
registry: () => registry,
regexes: () => exports_regexes,
process: () => process2,
prettifyError: () => prettifyError,
parseAsync: () => parseAsync,
parse: () => parse3,
meta: () => meta,
locales: () => exports_locales,
isValidJWT: () => isValidJWT,
isValidBase64URL: () => isValidBase64URL,
isValidBase64: () => isValidBase64,
initializeContext: () => initializeContext,
globalRegistry: () => globalRegistry,
globalConfig: () => globalConfig,
formatError: () => formatError2,
flattenError: () => flattenError,
finalize: () => finalize,
extractDefs: () => extractDefs,
encodeAsync: () => encodeAsync,
encode: () => encode,
describe: () => describe,
decodeAsync: () => decodeAsync,
decode: () => decode,
createToJSONSchemaMethod: () => createToJSONSchemaMethod,
createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod,
config: () => config,
clone: () => clone,
_xor: () => _xor,
_xid: () => _xid,
_void: () => _void,
_uuidv7: () => _uuidv7,
_uuidv6: () => _uuidv6,
_uuidv4: () => _uuidv4,
_uuid: () => _uuid,
_url: () => _url,
_uppercase: () => _uppercase,
_unknown: () => _unknown,
_union: () => _union,
_undefined: () => _undefined2,
_ulid: () => _ulid,
_uint64: () => _uint64,
_uint32: () => _uint32,
_tuple: () => _tuple,
_trim: () => _trim,
_transform: () => _transform,
_toUpperCase: () => _toUpperCase,
_toLowerCase: () => _toLowerCase,
_templateLiteral: () => _templateLiteral,
_symbol: () => _symbol,
_superRefine: () => _superRefine,
_success: () => _success,
_stringbool: () => _stringbool,
_stringFormat: () => _stringFormat,
_string: () => _string,
_startsWith: () => _startsWith,
_slugify: () => _slugify,
_size: () => _size,
_set: () => _set,
_safeParseAsync: () => _safeParseAsync,
_safeParse: () => _safeParse,
_safeEncodeAsync: () => _safeEncodeAsync,
_safeEncode: () => _safeEncode,
_safeDecodeAsync: () => _safeDecodeAsync,
_safeDecode: () => _safeDecode,
_regex: () => _regex,
_refine: () => _refine,
_record: () => _record,
_readonly: () => _readonly,
_property: () => _property,
_promise: () => _promise,
_positive: () => _positive,
_pipe: () => _pipe,
_parseAsync: () => _parseAsync,
_parse: () => _parse,
_overwrite: () => _overwrite,
_optional: () => _optional,
_number: () => _number,
_nullable: () => _nullable,
_null: () => _null3,
_normalize: () => _normalize,
_nonpositive: () => _nonpositive,
_nonoptional: () => _nonoptional,
_nonnegative: () => _nonnegative,
_never: () => _never,
_negative: () => _negative,
_nativeEnum: () => _nativeEnum,
_nanoid: () => _nanoid,
_nan: () => _nan,
_multipleOf: () => _multipleOf,
_minSize: () => _minSize,
_minLength: () => _minLength,
_min: () => _gte,
_mime: () => _mime,
_maxSize: () => _maxSize,
_maxLength: () => _maxLength,
_max: () => _lte,
_map: () => _map,
_mac: () => _mac,
_lte: () => _lte,
_lt: () => _lt,
_lowercase: () => _lowercase,
_literal: () => _literal,
_length: () => _length,
_lazy: () => _lazy,
_ksuid: () => _ksuid,
_jwt: () => _jwt,
_isoTime: () => _isoTime,
_isoDuration: () => _isoDuration,
_isoDateTime: () => _isoDateTime,
_isoDate: () => _isoDate,
_ipv6: () => _ipv6,
_ipv4: () => _ipv4,
_intersection: () => _intersection,
_int64: () => _int64,
_int32: () => _int32,
_int: () => _int,
_includes: () => _includes,
_guid: () => _guid,
_gte: () => _gte,
_gt: () => _gt,
_float64: () => _float64,
_float32: () => _float32,
_file: () => _file,
_enum: () => _enum,
_endsWith: () => _endsWith,
_encodeAsync: () => _encodeAsync,
_encode: () => _encode,
_emoji: () => _emoji2,
_email: () => _email,
_e164: () => _e164,
_discriminatedUnion: () => _discriminatedUnion,
_default: () => _default2,
_decodeAsync: () => _decodeAsync,
_decode: () => _decode,
_date: () => _date,
_custom: () => _custom,
_cuid2: () => _cuid2,
_cuid: () => _cuid,
_coercedString: () => _coercedString,
_coercedNumber: () => _coercedNumber,
_coercedDate: () => _coercedDate,
_coercedBoolean: () => _coercedBoolean,
_coercedBigint: () => _coercedBigint,
_cidrv6: () => _cidrv6,
_cidrv4: () => _cidrv4,
_check: () => _check,
_catch: () => _catch,
_boolean: () => _boolean,
_bigint: () => _bigint,
_base64url: () => _base64url,
_base64: () => _base64,
_array: () => _array,
_any: () => _any,
TimePrecision: () => TimePrecision,
NEVER: () => NEVER,
JSONSchemaGenerator: () => JSONSchemaGenerator,
JSONSchema: () => exports_json_schema,
Doc: () => Doc,
$output: () => $output,
$input: () => $input,
$constructor: () => $constructor,
$brand: () => $brand,
$ZodXor: () => $ZodXor,
$ZodXID: () => $ZodXID,
$ZodVoid: () => $ZodVoid,
$ZodUnknown: () => $ZodUnknown,
$ZodUnion: () => $ZodUnion,
$ZodUndefined: () => $ZodUndefined,
$ZodUUID: () => $ZodUUID,
$ZodURL: () => $ZodURL,
$ZodULID: () => $ZodULID,
$ZodType: () => $ZodType,
$ZodTuple: () => $ZodTuple,
$ZodTransform: () => $ZodTransform,
$ZodTemplateLiteral: () => $ZodTemplateLiteral,
$ZodSymbol: () => $ZodSymbol,
$ZodSuccess: () => $ZodSuccess,
$ZodStringFormat: () => $ZodStringFormat,
$ZodString: () => $ZodString,
$ZodSet: () => $ZodSet,
$ZodRegistry: () => $ZodRegistry,
$ZodRecord: () => $ZodRecord,
$ZodRealError: () => $ZodRealError,
$ZodReadonly: () => $ZodReadonly,
$ZodPromise: () => $ZodPromise,
$ZodPrefault: () => $ZodPrefault,
$ZodPipe: () => $ZodPipe,
$ZodOptional: () => $ZodOptional,
$ZodObjectJIT: () => $ZodObjectJIT,
$ZodObject: () => $ZodObject,
$ZodNumberFormat: () => $ZodNumberFormat,
$ZodNumber: () => $ZodNumber,
$ZodNullable: () => $ZodNullable,
$ZodNull: () => $ZodNull,
$ZodNonOptional: () => $ZodNonOptional,
$ZodNever: () => $ZodNever,
$ZodNanoID: () => $ZodNanoID,
$ZodNaN: () => $ZodNaN,
$ZodMap: () => $ZodMap,
$ZodMAC: () => $ZodMAC,
$ZodLiteral: () => $ZodLiteral,
$ZodLazy: () => $ZodLazy,
$ZodKSUID: () => $ZodKSUID,
$ZodJWT: () => $ZodJWT,
$ZodIntersection: () => $ZodIntersection,
$ZodISOTime: () => $ZodISOTime,
$ZodISODuration: () => $ZodISODuration,
$ZodISODateTime: () => $ZodISODateTime,
$ZodISODate: () => $ZodISODate,
$ZodIPv6: () => $ZodIPv6,
$ZodIPv4: () => $ZodIPv4,
$ZodGUID: () => $ZodGUID,
$ZodFunction: () => $ZodFunction,
$ZodFile: () => $ZodFile,
$ZodExactOptional: () => $ZodExactOptional,
$ZodError: () => $ZodError,
$ZodEnum: () => $ZodEnum,
$ZodEncodeError: () => $ZodEncodeError,
$ZodEmoji: () => $ZodEmoji,
$ZodEmail: () => $ZodEmail,
$ZodE164: () => $ZodE164,
$ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion,
$ZodDefault: () => $ZodDefault,
$ZodDate: () => $ZodDate,
$ZodCustomStringFormat: () => $ZodCustomStringFormat,
$ZodCustom: () => $ZodCustom,
$ZodCodec: () => $ZodCodec,
$ZodCheckUpperCase: () => $ZodCheckUpperCase,
$ZodCheckStringFormat: () => $ZodCheckStringFormat,
$ZodCheckStartsWith: () => $ZodCheckStartsWith,
$ZodCheckSizeEquals: () => $ZodCheckSizeEquals,
$ZodCheckRegex: () => $ZodCheckRegex,
$ZodCheckProperty: () => $ZodCheckProperty,
$ZodCheckOverwrite: () => $ZodCheckOverwrite,
$ZodCheckNumberFormat: () => $ZodCheckNumberFormat,
$ZodCheckMultipleOf: () => $ZodCheckMultipleOf,
$ZodCheckMinSize: () => $ZodCheckMinSize,
$ZodCheckMinLength: () => $ZodCheckMinLength,
$ZodCheckMimeType: () => $ZodCheckMimeType,
$ZodCheckMaxSize: () => $ZodCheckMaxSize,
$ZodCheckMaxLength: () => $ZodCheckMaxLength,
$ZodCheckLowerCase: () => $ZodCheckLowerCase,
$ZodCheckLessThan: () => $ZodCheckLessThan,
$ZodCheckLengthEquals: () => $ZodCheckLengthEquals,
$ZodCheckIncludes: () => $ZodCheckIncludes,
$ZodCheckGreaterThan: () => $ZodCheckGreaterThan,
$ZodCheckEndsWith: () => $ZodCheckEndsWith,
$ZodCheckBigIntFormat: () => $ZodCheckBigIntFormat,
$ZodCheck: () => $ZodCheck,
$ZodCatch: () => $ZodCatch,
$ZodCUID2: () => $ZodCUID2,
$ZodCUID: () => $ZodCUID,
$ZodCIDRv6: () => $ZodCIDRv6,
$ZodCIDRv4: () => $ZodCIDRv4,
$ZodBoolean: () => $ZodBoolean,
$ZodBigIntFormat: () => $ZodBigIntFormat,
$ZodBigInt: () => $ZodBigInt,
$ZodBase64URL: () => $ZodBase64URL,
$ZodBase64: () => $ZodBase64,
$ZodAsyncError: () => $ZodAsyncError,
$ZodArray: () => $ZodArray,
$ZodAny: () => $ZodAny
});
// node_modules/zod/v4/core/core.js
var NEVER = Object.freeze({
status: "aborted"
});
function $constructor(name, initializer, params) {
function init(inst, def) {
if (!inst._zod) {
Object.defineProperty(inst, "_zod", {
value: {
def,
constr: _3,
traits: new Set
},
enumerable: false
});
}
if (inst._zod.traits.has(name)) {
return;
}
inst._zod.traits.add(name);
initializer(inst, def);
const proto = _3.prototype;
const keys = Object.keys(proto);
for (let i2 = 0;i2 < keys.length; i2++) {
const k3 = keys[i2];
if (!(k3 in inst)) {
inst[k3] = proto[k3].bind(inst);
}
}
}
const Parent = params?.Parent ?? Object;
class Definition extends Parent {
}
Object.defineProperty(Definition, "name", { value: name });
function _3(def) {
var _a;
const inst = params?.Parent ? new Definition : this;
init(inst, def);
(_a = inst._zod).deferred ?? (_a.deferred = []);
for (const fn of inst._zod.deferred) {
fn();
}
return inst;
}
Object.defineProperty(_3, "init", { value: init });
Object.defineProperty(_3, Symbol.hasInstance, {
value: (inst) => {
if (params?.Parent && inst instanceof params.Parent)
return true;
return inst?._zod?.traits?.has(name);
}
});
Object.defineProperty(_3, "name", { value: name });
return _3;
}
var $brand = Symbol("zod_brand");
class $ZodAsyncError extends Error {
constructor() {
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
}
}
class $ZodEncodeError extends Error {
constructor(name) {
super(`Encountered unidirectional transform during encode: ${name}`);
this.name = "ZodEncodeError";
}
}
var globalConfig = {};
function config(newConfig) {
if (newConfig)
Object.assign(globalConfig, newConfig);
return globalConfig;
}
// node_modules/zod/v4/core/util.js
var exports_util = {};
__export(exports_util, {
unwrapMessage: () => unwrapMessage,
uint8ArrayToHex: () => uint8ArrayToHex,
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
uint8ArrayToBase64: () => uint8ArrayToBase64,
stringifyPrimitive: () => stringifyPrimitive,
slugify: () => slugify,
shallowClone: () => shallowClone,
safeExtend: () => safeExtend,
required: () => required,
randomString: () => randomString,
propertyKeyTypes: () => propertyKeyTypes,
promiseAllObject: () => promiseAllObject,
primitiveTypes: () => primitiveTypes,
prefixIssues: () => prefixIssues,
pick: () => pick,
partial: () => partial,
parsedType: () => parsedType,
optionalKeys: () => optionalKeys,
omit: () => omit,
objectClone: () => objectClone,
numKeys: () => numKeys,
nullish: () => nullish,
normalizeParams: () => normalizeParams,
mergeDefs: () => mergeDefs,
merge: () => merge2,
jsonStringifyReplacer: () => jsonStringifyReplacer,
joinValues: () => joinValues,
issue: () => issue,
isPlainObject: () => isPlainObject2,
isObject: () => isObject2,
hexToUint8Array: () => hexToUint8Array,
getSizableOrigin: () => getSizableOrigin,
getParsedType: () => getParsedType,
getLengthableOrigin: () => getLengthableOrigin,
getEnumValues: () => getEnumValues,
getElementAtPath: () => getElementAtPath,
floatSafeRemainder: () => floatSafeRemainder,
finalizeIssue: () => finalizeIssue,
extend: () => extend3,
escapeRegex: () => escapeRegex,
esc: () => esc,
defineLazy: () => defineLazy,
createTransparentProxy: () => createTransparentProxy,
cloneDef: () => cloneDef,
clone: () => clone,
cleanRegex: () => cleanRegex,
cleanEnum: () => cleanEnum,
captureStackTrace: () => captureStackTrace,
cached: () => cached,
base64urlToUint8Array: () => base64urlToUint8Array,
base64ToUint8Array: () => base64ToUint8Array,
assignProp: () => assignProp,
assertNotEqual: () => assertNotEqual,
assertNever: () => assertNever,
assertIs: () => assertIs,
assertEqual: () => assertEqual,
assert: () => assert,
allowsEval: () => allowsEval,
aborted: () => aborted,
NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
Class: () => Class,
BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES
});
function assertEqual(val) {
return val;
}
function assertNotEqual(val) {
return val;
}
function assertIs(_arg) {}
function assertNever(_x) {
throw new Error("Unexpected value in exhaustive check");
}
function assert(_3) {}
function getEnumValues(entries) {
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
const values = Object.entries(entries).filter(([k3, _3]) => numericValues.indexOf(+k3) === -1).map(([_3, v]) => v);
return values;
}
function joinValues(array, separator = "|") {
return array.map((val) => stringifyPrimitive(val)).join(separator);
}
function jsonStringifyReplacer(_3, value) {
if (typeof value === "bigint")
return value.toString();
return value;
}
function cached(getter) {
const set2 = false;
return {
get value() {
if (!set2) {
const value = getter();
Object.defineProperty(this, "value", { value });
return value;
}
throw new Error("cached value already set");
}
};
}
function nullish(input) {
return input === null || input === undefined;
}
function cleanRegex(source) {
const start = source.startsWith("^") ? 1 : 0;
const end = source.endsWith("$") ? source.length - 1 : source.length;
return source.slice(start, end);
}
function floatSafeRemainder(val, step) {
const valDecCount = (val.toString().split(".")[1] || "").length;
const stepString = step.toString();
let stepDecCount = (stepString.split(".")[1] || "").length;
if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
const match = stepString.match(/\d?e-(\d?)/);
if (match?.[1]) {
stepDecCount = Number.parseInt(match[1]);
}
}
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
return valInt % stepInt / 10 ** decCount;
}
var EVALUATING = Symbol("evaluating");
function defineLazy(object, key, getter) {
let value = undefined;
Object.defineProperty(object, key, {
get() {
if (value === EVALUATING) {
return;
}
if (value === undefined) {
value = EVALUATING;
value = getter();
}
return value;
},
set(v) {
Object.defineProperty(object, key, {
value: v
});
},
configurable: true
});
}
function objectClone(obj) {
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
}
function assignProp(target, prop, value) {
Object.defineProperty(target, prop, {
value,
writable: true,
enumerable: true,
configurable: true
});
}
function mergeDefs(...defs) {
const mergedDescriptors = {};
for (const def of defs) {
const descriptors = Object.getOwnPropertyDescriptors(def);
Object.assign(mergedDescriptors, descriptors);
}
return Object.defineProperties({}, mergedDescriptors);
}
function cloneDef(schema2) {
return mergeDefs(schema2._zod.def);
}
function getElementAtPath(obj, path3) {
if (!path3)
return obj;
return path3.reduce((acc, key) => acc?.[key], obj);
}
function promiseAllObject(promisesObj) {
const keys = Object.keys(promisesObj);
const promises = keys.map((key) => promisesObj[key]);
return Promise.all(promises).then((results) => {
const resolvedObj = {};
for (let i2 = 0;i2 < keys.length; i2++) {
resolvedObj[keys[i2]] = results[i2];
}
return resolvedObj;
});
}
function randomString(length = 10) {
const chars = "abcdefghijklmnopqrstuvwxyz";
let str3 = "";
for (let i2 = 0;i2 < length; i2++) {
str3 += chars[Math.floor(Math.random() * chars.length)];
}
return str3;
}
function esc(str3) {
return JSON.stringify(str3);
}
function slugify(input) {
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
}
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
function isObject2(data) {
return typeof data === "object" && data !== null && !Array.isArray(data);
}
var allowsEval = cached(() => {
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
return false;
}
try {
const F2 = Function;
new F2("");
return true;
} catch (_3) {
return false;
}
});
function isPlainObject2(o2) {
if (isObject2(o2) === false)
return false;
const ctor = o2.constructor;
if (ctor === undefined)
return true;
if (typeof ctor !== "function")
return true;
const prot = ctor.prototype;
if (isObject2(prot) === false)
return false;
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
return false;
}
return true;
}
function shallowClone(o2) {
if (isPlainObject2(o2))
return { ...o2 };
if (Array.isArray(o2))
return [...o2];
return o2;
}
function numKeys(data) {
let keyCount = 0;
for (const key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
keyCount++;
}
}
return keyCount;
}
var getParsedType = (data) => {
const t = typeof data;
switch (t) {
case "undefined":
return "undefined";
case "string":
return "string";
case "number":
return Number.isNaN(data) ? "nan" : "number";
case "boolean":
return "boolean";
case "function":
return "function";
case "bigint":
return "bigint";
case "symbol":
return "symbol";
case "object":
if (Array.isArray(data)) {
return "array";
}
if (data === null) {
return "null";
}
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
return "promise";
}
if (typeof Map !== "undefined" && data instanceof Map) {
return "map";
}
if (typeof Set !== "undefined" && data instanceof Set) {
return "set";
}
if (typeof Date !== "undefined" && data instanceof Date) {
return "date";
}
if (typeof File !== "undefined" && data instanceof File) {
return "file";
}
return "object";
default:
throw new Error(`Unknown data type: ${t}`);
}
};
var propertyKeyTypes = new Set(["string", "number", "symbol"]);
var primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
function escapeRegex(str3) {
return str3.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
function clone(inst, def, params) {
const cl = new inst._zod.constr(def ?? inst._zod.def);
if (!def || params?.parent)
cl._zod.parent = inst;
return cl;
}
function normalizeParams(_params) {
const params = _params;
if (!params)
return {};
if (typeof params === "string")
return { error: () => params };
if (params?.message !== undefined) {
if (params?.error !== undefined)
throw new Error("Cannot specify both `message` and `error` params");
params.error = params.message;
}
delete params.message;
if (typeof params.error === "string")
return { ...params, error: () => params.error };
return params;
}
function createTransparentProxy(getter) {
let target;
return new Proxy({}, {
get(_3, prop, receiver) {
target ?? (target = getter());
return Reflect.get(target, prop, receiver);
},
set(_3, prop, value, receiver) {
target ?? (target = getter());
return Reflect.set(target, prop, value, receiver);
},
has(_3, prop) {
target ?? (target = getter());
return Reflect.has(target, prop);
},
deleteProperty(_3, prop) {
target ?? (target = getter());
return Reflect.deleteProperty(target, prop);
},
ownKeys(_3) {
target ?? (target = getter());
return Reflect.ownKeys(target);
},
getOwnPropertyDescriptor(_3, prop) {
target ?? (target = getter());
return Reflect.getOwnPropertyDescriptor(target, prop);
},
defineProperty(_3, prop, descriptor) {
target ?? (target = getter());
return Reflect.defineProperty(target, prop, descriptor);
}
});
}
function stringifyPrimitive(value) {
if (typeof value === "bigint")
return value.toString() + "n";
if (typeof value === "string")
return `"${value}"`;
return `${value}`;
}
function optionalKeys(shape) {
return Object.keys(shape).filter((k3) => {
return shape[k3]._zod.optin === "optional" && shape[k3]._zod.optout === "optional";
});
}
var NUMBER_FORMAT_RANGES = {
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
int32: [-2147483648, 2147483647],
uint32: [0, 4294967295],
float32: [-340282346638528860000000000000000000000, 340282346638528860000000000000000000000],
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
};
var BIGINT_FORMAT_RANGES = {
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
};
function pick(schema2, mask) {
const currDef = schema2._zod.def;
const checks = currDef.checks;
const hasChecks = checks && checks.length > 0;
if (hasChecks) {
throw new Error(".pick() cannot be used on object schemas containing refinements");
}
const def = mergeDefs(schema2._zod.def, {
get shape() {
const newShape = {};
for (const key in mask) {
if (!(key in currDef.shape)) {
throw new Error(`Unrecognized key: "${key}"`);
}
if (!mask[key])
continue;
newShape[key] = currDef.shape[key];
}
assignProp(this, "shape", newShape);
return newShape;
},
checks: []
});
return clone(schema2, def);
}
function omit(schema2, mask) {
const currDef = schema2._zod.def;
const checks = currDef.checks;
const hasChecks = checks && checks.length > 0;
if (hasChecks) {
throw new Error(".omit() cannot be used on object schemas containing refinements");
}
const def = mergeDefs(schema2._zod.def, {
get shape() {
const newShape = { ...schema2._zod.def.shape };
for (const key in mask) {
if (!(key in currDef.shape)) {
throw new Error(`Unrecognized key: "${key}"`);
}
if (!mask[key])
continue;
delete newShape[key];
}
assignProp(this, "shape", newShape);
return newShape;
},
checks: []
});
return clone(schema2, def);
}
function extend3(schema2, shape) {
if (!isPlainObject2(shape)) {
throw new Error("Invalid input to extend: expected a plain object");
}
const checks = schema2._zod.def.checks;
const hasChecks = checks && checks.length > 0;
if (hasChecks) {
const existingShape = schema2._zod.def.shape;
for (const key in shape) {
if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
}
}
}
const def = mergeDefs(schema2._zod.def, {
get shape() {
const _shape = { ...schema2._zod.def.shape, ...shape };
assignProp(this, "shape", _shape);
return _shape;
}
});
return clone(schema2, def);
}
function safeExtend(schema2, shape) {
if (!isPlainObject2(shape)) {
throw new Error("Invalid input to safeExtend: expected a plain object");
}
const def = mergeDefs(schema2._zod.def, {
get shape() {
const _shape = { ...schema2._zod.def.shape, ...shape };
assignProp(this, "shape", _shape);
return _shape;
}
});
return clone(schema2, def);
}
function merge2(a, b3) {
const def = mergeDefs(a._zod.def, {
get shape() {
const _shape = { ...a._zod.def.shape, ...b3._zod.def.shape };
assignProp(this, "shape", _shape);
return _shape;
},
get catchall() {
return b3._zod.def.catchall;
},
checks: []
});
return clone(a, def);
}
function partial(Class, schema2, mask) {
const currDef = schema2._zod.def;
const checks = currDef.checks;
const hasChecks = checks && checks.length > 0;
if (hasChecks) {
throw new Error(".partial() cannot be used on object schemas containing refinements");
}
const def = mergeDefs(schema2._zod.def, {
get shape() {
const oldShape = schema2._zod.def.shape;
const shape = { ...oldShape };
if (mask) {
for (const key in mask) {
if (!(key in oldShape)) {
throw new Error(`Unrecognized key: "${key}"`);
}
if (!mask[key])
continue;
shape[key] = Class ? new Class({
type: "optional",
innerType: oldShape[key]
}) : oldShape[key];
}
} else {
for (const key in oldShape) {
shape[key] = Class ? new Class({
type: "optional",
innerType: oldShape[key]
}) : oldShape[key];
}
}
assignProp(this, "shape", shape);
return shape;
},
checks: []
});
return clone(schema2, def);
}
function required(Class, schema2, mask) {
const def = mergeDefs(schema2._zod.def, {
get shape() {
const oldShape = schema2._zod.def.shape;
const shape = { ...oldShape };
if (mask) {
for (const key in mask) {
if (!(key in shape)) {
throw new Error(`Unrecognized key: "${key}"`);
}
if (!mask[key])
continue;
shape[key] = new Class({
type: "nonoptional",
innerType: oldShape[key]
});
}
} else {
for (const key in oldShape) {
shape[key] = new Class({
type: "nonoptional",
innerType: oldShape[key]
});
}
}
assignProp(this, "shape", shape);
return shape;
}
});
return clone(schema2, def);
}
function aborted(x2, startIndex = 0) {
if (x2.aborted === true)
return true;
for (let i2 = startIndex;i2 < x2.issues.length; i2++) {
if (x2.issues[i2]?.continue !== true) {
return true;
}
}
return false;
}
function prefixIssues(path3, issues) {
return issues.map((iss) => {
var _a;
(_a = iss).path ?? (_a.path = []);
iss.path.unshift(path3);
return iss;
});
}
function unwrapMessage(message) {
return typeof message === "string" ? message : message?.message;
}
function finalizeIssue(iss, ctx, config2) {
const full = { ...iss, path: iss.path ?? [] };
if (!iss.message) {
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
full.message = message;
}
delete full.inst;
delete full.continue;
if (!ctx?.reportInput) {
delete full.input;
}
return full;
}
function getSizableOrigin(input) {
if (input instanceof Set)
return "set";
if (input instanceof Map)
return "map";
if (input instanceof File)
return "file";
return "unknown";
}
function getLengthableOrigin(input) {
if (Array.isArray(input))
return "array";
if (typeof input === "string")
return "string";
return "unknown";
}
function parsedType(data) {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "nan" : "number";
}
case "object": {
if (data === null) {
return "null";
}
if (Array.isArray(data)) {
return "array";
}
const obj = data;
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
return obj.constructor.name;
}
}
}
return t;
}
function issue(...args) {
const [iss, input, inst] = args;
if (typeof iss === "string") {
return {
message: iss,
code: "custom",
input,
inst
};
}
return { ...iss };
}
function cleanEnum(obj) {
return Object.entries(obj).filter(([k3, _3]) => {
return Number.isNaN(Number.parseInt(k3, 10));
}).map((el) => el[1]);
}
function base64ToUint8Array(base64) {
const binaryString = atob(base64);
const bytes = new Uint8Array(binaryString.length);
for (let i2 = 0;i2 < binaryString.length; i2++) {
bytes[i2] = binaryString.charCodeAt(i2);
}
return bytes;
}
function uint8ArrayToBase64(bytes) {
let binaryString = "";
for (let i2 = 0;i2 < bytes.length; i2++) {
binaryString += String.fromCharCode(bytes[i2]);
}
return btoa(binaryString);
}
function base64urlToUint8Array(base64url) {
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
const padding = "=".repeat((4 - base64.length % 4) % 4);
return base64ToUint8Array(base64 + padding);
}
function uint8ArrayToBase64url(bytes) {
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
}
function hexToUint8Array(hex) {
const cleanHex = hex.replace(/^0x/, "");
if (cleanHex.length % 2 !== 0) {
throw new Error("Invalid hex string length");
}
const bytes = new Uint8Array(cleanHex.length / 2);
for (let i2 = 0;i2 < cleanHex.length; i2 += 2) {
bytes[i2 / 2] = Number.parseInt(cleanHex.slice(i2, i2 + 2), 16);
}
return bytes;
}
function uint8ArrayToHex(bytes) {
return Array.from(bytes).map((b3) => b3.toString(16).padStart(2, "0")).join("");
}
class Class {
constructor(..._args) {}
}
// node_modules/zod/v4/core/errors.js
var initializer = (inst, def) => {
inst.name = "$ZodError";
Object.defineProperty(inst, "_zod", {
value: inst._zod,
enumerable: false
});
Object.defineProperty(inst, "issues", {
value: def,
enumerable: false
});
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
Object.defineProperty(inst, "toString", {
value: () => inst.message,
enumerable: false
});
};
var $ZodError = $constructor("$ZodError", initializer);
var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
function flattenError(error, mapper = (issue2) => issue2.message) {
const fieldErrors = {};
const formErrors = [];
for (const sub of error.issues) {
if (sub.path.length > 0) {
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
fieldErrors[sub.path[0]].push(mapper(sub));
} else {
formErrors.push(mapper(sub));
}
}
return { formErrors, fieldErrors };
}
function formatError2(error, mapper = (issue2) => issue2.message) {
const fieldErrors = { _errors: [] };
const processError = (error2) => {
for (const issue2 of error2.issues) {
if (issue2.code === "invalid_union" && issue2.errors.length) {
issue2.errors.map((issues) => processError({ issues }));
} else if (issue2.code === "invalid_key") {
processError({ issues: issue2.issues });
} else if (issue2.code === "invalid_element") {
processError({ issues: issue2.issues });
} else if (issue2.path.length === 0) {
fieldErrors._errors.push(mapper(issue2));
} else {
let curr = fieldErrors;
let i2 = 0;
while (i2 < issue2.path.length) {
const el = issue2.path[i2];
const terminal = i2 === issue2.path.length - 1;
if (!terminal) {
curr[el] = curr[el] || { _errors: [] };
} else {
curr[el] = curr[el] || { _errors: [] };
curr[el]._errors.push(mapper(issue2));
}
curr = curr[el];
i2++;
}
}
}
};
processError(error);
return fieldErrors;
}
function treeifyError(error, mapper = (issue2) => issue2.message) {
const result = { errors: [] };
const processError = (error2, path3 = []) => {
var _a, _b;
for (const issue2 of error2.issues) {
if (issue2.code === "invalid_union" && issue2.errors.length) {
issue2.errors.map((issues) => processError({ issues }, issue2.path));
} else if (issue2.code === "invalid_key") {
processError({ issues: issue2.issues }, issue2.path);
} else if (issue2.code === "invalid_element") {
processError({ issues: issue2.issues }, issue2.path);
} else {
const fullpath = [...path3, ...issue2.path];
if (fullpath.length === 0) {
result.errors.push(mapper(issue2));
continue;
}
let curr = result;
let i2 = 0;
while (i2 < fullpath.length) {
const el = fullpath[i2];
const terminal = i2 === fullpath.length - 1;
if (typeof el === "string") {
curr.properties ?? (curr.properties = {});
(_a = curr.properties)[el] ?? (_a[el] = { errors: [] });
curr = curr.properties[el];
} else {
curr.items ?? (curr.items = []);
(_b = curr.items)[el] ?? (_b[el] = { errors: [] });
curr = curr.items[el];
}
if (terminal) {
curr.errors.push(mapper(issue2));
}
i2++;
}
}
}
};
processError(error);
return result;
}
function toDotPath(_path) {
const segs = [];
const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
for (const seg of path3) {
if (typeof seg === "number")
segs.push(`[${seg}]`);
else if (typeof seg === "symbol")
segs.push(`[${JSON.stringify(String(seg))}]`);
else if (/[^\w$]/.test(seg))
segs.push(`[${JSON.stringify(seg)}]`);
else {
if (segs.length)
segs.push(".");
segs.push(seg);
}
}
return segs.join("");
}
function prettifyError(error) {
const lines = [];
const issues = [...error.issues].sort((a, b3) => (a.path ?? []).length - (b3.path ?? []).length);
for (const issue2 of issues) {
lines.push(`\u2716 ${issue2.message}`);
if (issue2.path?.length)
lines.push(` \u2192 at ${toDotPath(issue2.path)}`);
}
return lines.join(`
`);
}
// node_modules/zod/v4/core/parse.js
var _parse = (_Err) => (schema2, value, _ctx, _params) => {
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
const result = schema2._zod.run({ value, issues: [] }, ctx);
if (result instanceof Promise) {
throw new $ZodAsyncError;
}
if (result.issues.length) {
const e2 = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
captureStackTrace(e2, _params?.callee);
throw e2;
}
return result.value;
};
var parse3 = /* @__PURE__ */ _parse($ZodRealError);
var _parseAsync = (_Err) => async (schema2, value, _ctx, params) => {
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
let result = schema2._zod.run({ value, issues: [] }, ctx);
if (result instanceof Promise)
result = await result;
if (result.issues.length) {
const e2 = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
captureStackTrace(e2, params?.callee);
throw e2;
}
return result.value;
};
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
var _safeParse = (_Err) => (schema2, value, _ctx) => {
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
const result = schema2._zod.run({ value, issues: [] }, ctx);
if (result instanceof Promise) {
throw new $ZodAsyncError;
}
return result.issues.length ? {
success: false,
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
} : { success: true, data: result.value };
};
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
var _safeParseAsync = (_Err) => async (schema2, value, _ctx) => {
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
let result = schema2._zod.run({ value, issues: [] }, ctx);
if (result instanceof Promise)
result = await result;
return result.issues.length ? {
success: false,
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
} : { success: true, data: result.value };
};
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
var _encode = (_Err) => (schema2, value, _ctx) => {
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
return _parse(_Err)(schema2, value, ctx);
};
var encode = /* @__PURE__ */ _encode($ZodRealError);
var _decode = (_Err) => (schema2, value, _ctx) => {
return _parse(_Err)(schema2, value, _ctx);
};
var decode = /* @__PURE__ */ _decode($ZodRealError);
var _encodeAsync = (_Err) => async (schema2, value, _ctx) => {
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
return _parseAsync(_Err)(schema2, value, ctx);
};
var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
var _decodeAsync = (_Err) => async (schema2, value, _ctx) => {
return _parseAsync(_Err)(schema2, value, _ctx);
};
var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
var _safeEncode = (_Err) => (schema2, value, _ctx) => {
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
return _safeParse(_Err)(schema2, value, ctx);
};
var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
var _safeDecode = (_Err) => (schema2, value, _ctx) => {
return _safeParse(_Err)(schema2, value, _ctx);
};
var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
var _safeEncodeAsync = (_Err) => async (schema2, value, _ctx) => {
const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
return _safeParseAsync(_Err)(schema2, value, ctx);
};
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
var _safeDecodeAsync = (_Err) => async (schema2, value, _ctx) => {
return _safeParseAsync(_Err)(schema2, value, _ctx);
};
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
// node_modules/zod/v4/core/regexes.js
var exports_regexes = {};
__export(exports_regexes, {
xid: () => xid,
uuid7: () => uuid7,
uuid6: () => uuid6,
uuid4: () => uuid4,
uuid: () => uuid,
uppercase: () => uppercase,
unicodeEmail: () => unicodeEmail,
undefined: () => _undefined,
ulid: () => ulid,
time: () => time,
string: () => string,
sha512_hex: () => sha512_hex,
sha512_base64url: () => sha512_base64url,
sha512_base64: () => sha512_base64,
sha384_hex: () => sha384_hex,
sha384_base64url: () => sha384_base64url,
sha384_base64: () => sha384_base64,
sha256_hex: () => sha256_hex,
sha256_base64url: () => sha256_base64url,
sha256_base64: () => sha256_base64,
sha1_hex: () => sha1_hex,
sha1_base64url: () => sha1_base64url,
sha1_base64: () => sha1_base64,
rfc5322Email: () => rfc5322Email,
number: () => number,
null: () => _null2,
nanoid: () => nanoid,
md5_hex: () => md5_hex,
md5_base64url: () => md5_base64url,
md5_base64: () => md5_base64,
mac: () => mac,
lowercase: () => lowercase,
ksuid: () => ksuid,
ipv6: () => ipv6,
ipv4: () => ipv4,
integer: () => integer,
idnEmail: () => idnEmail,
html5Email: () => html5Email,
hostname: () => hostname,
hex: () => hex,
guid: () => guid,
extendedDuration: () => extendedDuration,
emoji: () => emoji,
email: () => email,
e164: () => e164,
duration: () => duration,
domain: () => domain,
datetime: () => datetime,
date: () => date,
cuid2: () => cuid2,
cuid: () => cuid,
cidrv6: () => cidrv6,
cidrv4: () => cidrv4,
browserEmail: () => browserEmail,
boolean: () => boolean,
bigint: () => bigint,
base64url: () => base64url,
base64: () => base64
});
var cuid = /^[cC][^\s-]{8,}$/;
var cuid2 = /^[0-9a-z]+$/;
var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
var xid = /^[0-9a-vA-V]{20}$/;
var ksuid = /^[A-Za-z0-9]{27}$/;
var nanoid = /^[a-zA-Z0-9_-]{21}$/;
var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
var extendedDuration = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
var uuid = (version) => {
if (!version)
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
};
var uuid4 = /* @__PURE__ */ uuid(4);
var uuid6 = /* @__PURE__ */ uuid(6);
var uuid7 = /* @__PURE__ */ uuid(7);
var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
var html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
var rfc5322Email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
var unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
var idnEmail = unicodeEmail;
var browserEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
var _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
function emoji() {
return new RegExp(_emoji, "u");
}
var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
var mac = (delimiter) => {
const escapedDelim = escapeRegex(delimiter ?? ":");
return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`);
};
var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
var base64url = /^[A-Za-z0-9_-]*$/;
var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
var domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
var e164 = /^\+[1-9]\d{6,14}$/;
var dateSource = `(?:(?:\\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 date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
function timeSource(args) {
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
return regex;
}
function time(args) {
return new RegExp(`^${timeSource(args)}$`);
}
function datetime(args) {
const time2 = timeSource({ precision: args.precision });
const opts = ["Z"];
if (args.local)
opts.push("");
if (args.offset)
opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
const timeRegex = `${time2}(?:${opts.join("|")})`;
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
}
var string = (params) => {
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
return new RegExp(`^${regex}$`);
};
var bigint = /^-?\d+n?$/;
var integer = /^-?\d+$/;
var number = /^-?\d+(?:\.\d+)?$/;
var boolean = /^(?:true|false)$/i;
var _null2 = /^null$/i;
var _undefined = /^undefined$/i;
var lowercase = /^[^A-Z]*$/;
var uppercase = /^[^a-z]*$/;
var hex = /^[0-9a-fA-F]*$/;
function fixedBase64(bodyLength, padding) {
return new RegExp(`^[A-Za-z0-9+/]{${bodyLength}}${padding}$`);
}
function fixedBase64url(length) {
return new RegExp(`^[A-Za-z0-9_-]{${length}}$`);
}
var md5_hex = /^[0-9a-fA-F]{32}$/;
var md5_base64 = /* @__PURE__ */ fixedBase64(22, "==");
var md5_base64url = /* @__PURE__ */ fixedBase64url(22);
var sha1_hex = /^[0-9a-fA-F]{40}$/;
var sha1_base64 = /* @__PURE__ */ fixedBase64(27, "=");
var sha1_base64url = /* @__PURE__ */ fixedBase64url(27);
var sha256_hex = /^[0-9a-fA-F]{64}$/;
var sha256_base64 = /* @__PURE__ */ fixedBase64(43, "=");
var sha256_base64url = /* @__PURE__ */ fixedBase64url(43);
var sha384_hex = /^[0-9a-fA-F]{96}$/;
var sha384_base64 = /* @__PURE__ */ fixedBase64(64, "");
var sha384_base64url = /* @__PURE__ */ fixedBase64url(64);
var sha512_hex = /^[0-9a-fA-F]{128}$/;
var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
// node_modules/zod/v4/core/checks.js
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
var _a;
inst._zod ?? (inst._zod = {});
inst._zod.def = def;
(_a = inst._zod).onattach ?? (_a.onattach = []);
});
var numericOriginMap = {
number: "number",
bigint: "bigint",
object: "date"
};
var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
$ZodCheck.init(inst, def);
const origin = numericOriginMap[typeof def.value];
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
if (def.value < curr) {
if (def.inclusive)
bag.maximum = def.value;
else
bag.exclusiveMaximum = def.value;
}
});
inst._zod.check = (payload) => {
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
return;
}
payload.issues.push({
origin,
code: "too_big",
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
input: payload.value,
inclusive: def.inclusive,
inst,
continue: !def.abort
});
};
});
var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
$ZodCheck.init(inst, def);
const origin = numericOriginMap[typeof def.value];
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
if (def.value > curr) {
if (def.inclusive)
bag.minimum = def.value;
else
bag.exclusiveMinimum = def.value;
}
});
inst._zod.check = (payload) => {
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
return;
}
payload.issues.push({
origin,
code: "too_small",
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
input: payload.value,
inclusive: def.inclusive,
inst,
continue: !def.abort
});
};
});
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
$ZodCheck.init(inst, def);
inst._zod.onattach.push((inst2) => {
var _a;
(_a = inst2._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
});
inst._zod.check = (payload) => {
if (typeof payload.value !== typeof def.value)
throw new Error("Cannot mix number and bigint in multiple_of check.");
const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
if (isMultiple)
return;
payload.issues.push({
origin: typeof payload.value,
code: "not_multiple_of",
divisor: def.value,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
$ZodCheck.init(inst, def);
def.format = def.format || "float64";
const isInt = def.format?.includes("int");
const origin = isInt ? "int" : "number";
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.format = def.format;
bag.minimum = minimum;
bag.maximum = maximum;
if (isInt)
bag.pattern = integer;
});
inst._zod.check = (payload) => {
const input = payload.value;
if (isInt) {
if (!Number.isInteger(input)) {
payload.issues.push({
expected: origin,
format: def.format,
code: "invalid_type",
continue: false,
input,
inst
});
return;
}
if (!Number.isSafeInteger(input)) {
if (input > 0) {
payload.issues.push({
input,
code: "too_big",
maximum: Number.MAX_SAFE_INTEGER,
note: "Integers must be within the safe integer range.",
inst,
origin,
inclusive: true,
continue: !def.abort
});
} else {
payload.issues.push({
input,
code: "too_small",
minimum: Number.MIN_SAFE_INTEGER,
note: "Integers must be within the safe integer range.",
inst,
origin,
inclusive: true,
continue: !def.abort
});
}
return;
}
}
if (input < minimum) {
payload.issues.push({
origin: "number",
input,
code: "too_small",
minimum,
inclusive: true,
inst,
continue: !def.abort
});
}
if (input > maximum) {
payload.issues.push({
origin: "number",
input,
code: "too_big",
maximum,
inclusive: true,
inst,
continue: !def.abort
});
}
};
});
var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat", (inst, def) => {
$ZodCheck.init(inst, def);
const [minimum, maximum] = BIGINT_FORMAT_RANGES[def.format];
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.format = def.format;
bag.minimum = minimum;
bag.maximum = maximum;
});
inst._zod.check = (payload) => {
const input = payload.value;
if (input < minimum) {
payload.issues.push({
origin: "bigint",
input,
code: "too_small",
minimum,
inclusive: true,
inst,
continue: !def.abort
});
}
if (input > maximum) {
payload.issues.push({
origin: "bigint",
input,
code: "too_big",
maximum,
inclusive: true,
inst,
continue: !def.abort
});
}
};
});
var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.size !== undefined;
});
inst._zod.onattach.push((inst2) => {
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
if (def.maximum < curr)
inst2._zod.bag.maximum = def.maximum;
});
inst._zod.check = (payload) => {
const input = payload.value;
const size = input.size;
if (size <= def.maximum)
return;
payload.issues.push({
origin: getSizableOrigin(input),
code: "too_big",
maximum: def.maximum,
inclusive: true,
input,
inst,
continue: !def.abort
});
};
});
var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.size !== undefined;
});
inst._zod.onattach.push((inst2) => {
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
if (def.minimum > curr)
inst2._zod.bag.minimum = def.minimum;
});
inst._zod.check = (payload) => {
const input = payload.value;
const size = input.size;
if (size >= def.minimum)
return;
payload.issues.push({
origin: getSizableOrigin(input),
code: "too_small",
minimum: def.minimum,
inclusive: true,
input,
inst,
continue: !def.abort
});
};
});
var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.size !== undefined;
});
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.minimum = def.size;
bag.maximum = def.size;
bag.size = def.size;
});
inst._zod.check = (payload) => {
const input = payload.value;
const size = input.size;
if (size === def.size)
return;
const tooBig = size > def.size;
payload.issues.push({
origin: getSizableOrigin(input),
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
inclusive: true,
exact: true,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.length !== undefined;
});
inst._zod.onattach.push((inst2) => {
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
if (def.maximum < curr)
inst2._zod.bag.maximum = def.maximum;
});
inst._zod.check = (payload) => {
const input = payload.value;
const length = input.length;
if (length <= def.maximum)
return;
const origin = getLengthableOrigin(input);
payload.issues.push({
origin,
code: "too_big",
maximum: def.maximum,
inclusive: true,
input,
inst,
continue: !def.abort
});
};
});
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.length !== undefined;
});
inst._zod.onattach.push((inst2) => {
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
if (def.minimum > curr)
inst2._zod.bag.minimum = def.minimum;
});
inst._zod.check = (payload) => {
const input = payload.value;
const length = input.length;
if (length >= def.minimum)
return;
const origin = getLengthableOrigin(input);
payload.issues.push({
origin,
code: "too_small",
minimum: def.minimum,
inclusive: true,
input,
inst,
continue: !def.abort
});
};
});
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
var _a;
$ZodCheck.init(inst, def);
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
const val = payload.value;
return !nullish(val) && val.length !== undefined;
});
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.minimum = def.length;
bag.maximum = def.length;
bag.length = def.length;
});
inst._zod.check = (payload) => {
const input = payload.value;
const length = input.length;
if (length === def.length)
return;
const origin = getLengthableOrigin(input);
const tooBig = length > def.length;
payload.issues.push({
origin,
...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
inclusive: true,
exact: true,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
var _a, _b;
$ZodCheck.init(inst, def);
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.format = def.format;
if (def.pattern) {
bag.patterns ?? (bag.patterns = new Set);
bag.patterns.add(def.pattern);
}
});
if (def.pattern)
(_a = inst._zod).check ?? (_a.check = (payload) => {
def.pattern.lastIndex = 0;
if (def.pattern.test(payload.value))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: def.format,
input: payload.value,
...def.pattern ? { pattern: def.pattern.toString() } : {},
inst,
continue: !def.abort
});
});
else
(_b = inst._zod).check ?? (_b.check = () => {});
});
var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
$ZodCheckStringFormat.init(inst, def);
inst._zod.check = (payload) => {
def.pattern.lastIndex = 0;
if (def.pattern.test(payload.value))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "regex",
input: payload.value,
pattern: def.pattern.toString(),
inst,
continue: !def.abort
});
};
});
var $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
def.pattern ?? (def.pattern = lowercase);
$ZodCheckStringFormat.init(inst, def);
});
var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
def.pattern ?? (def.pattern = uppercase);
$ZodCheckStringFormat.init(inst, def);
});
var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
$ZodCheck.init(inst, def);
const escapedRegex = escapeRegex(def.includes);
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
def.pattern = pattern;
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.patterns ?? (bag.patterns = new Set);
bag.patterns.add(pattern);
});
inst._zod.check = (payload) => {
if (payload.value.includes(def.includes, def.position))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "includes",
includes: def.includes,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
$ZodCheck.init(inst, def);
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
def.pattern ?? (def.pattern = pattern);
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.patterns ?? (bag.patterns = new Set);
bag.patterns.add(pattern);
});
inst._zod.check = (payload) => {
if (payload.value.startsWith(def.prefix))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "starts_with",
prefix: def.prefix,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
$ZodCheck.init(inst, def);
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
def.pattern ?? (def.pattern = pattern);
inst._zod.onattach.push((inst2) => {
const bag = inst2._zod.bag;
bag.patterns ?? (bag.patterns = new Set);
bag.patterns.add(pattern);
});
inst._zod.check = (payload) => {
if (payload.value.endsWith(def.suffix))
return;
payload.issues.push({
origin: "string",
code: "invalid_format",
format: "ends_with",
suffix: def.suffix,
input: payload.value,
inst,
continue: !def.abort
});
};
});
function handleCheckPropertyResult(result, payload, property) {
if (result.issues.length) {
payload.issues.push(...prefixIssues(property, result.issues));
}
}
var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => {
$ZodCheck.init(inst, def);
inst._zod.check = (payload) => {
const result = def.schema._zod.run({
value: payload.value[def.property],
issues: []
}, {});
if (result instanceof Promise) {
return result.then((result2) => handleCheckPropertyResult(result2, payload, def.property));
}
handleCheckPropertyResult(result, payload, def.property);
return;
};
});
var $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => {
$ZodCheck.init(inst, def);
const mimeSet = new Set(def.mime);
inst._zod.onattach.push((inst2) => {
inst2._zod.bag.mime = def.mime;
});
inst._zod.check = (payload) => {
if (mimeSet.has(payload.value.type))
return;
payload.issues.push({
code: "invalid_value",
values: def.mime,
input: payload.value.type,
inst,
continue: !def.abort
});
};
});
var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
$ZodCheck.init(inst, def);
inst._zod.check = (payload) => {
payload.value = def.tx(payload.value);
};
});
// node_modules/zod/v4/core/doc.js
class Doc {
constructor(args = []) {
this.content = [];
this.indent = 0;
if (this)
this.args = args;
}
indented(fn) {
this.indent += 1;
fn(this);
this.indent -= 1;
}
write(arg) {
if (typeof arg === "function") {
arg(this, { execution: "sync" });
arg(this, { execution: "async" });
return;
}
const content = arg;
const lines = content.split(`
`).filter((x2) => x2);
const minIndent = Math.min(...lines.map((x2) => x2.length - x2.trimStart().length));
const dedented = lines.map((x2) => x2.slice(minIndent)).map((x2) => " ".repeat(this.indent * 2) + x2);
for (const line of dedented) {
this.content.push(line);
}
}
compile() {
const F2 = Function;
const args = this?.args;
const content = this?.content ?? [``];
const lines = [...content.map((x2) => ` ${x2}`)];
return new F2(...args, lines.join(`
`));
}
}
// node_modules/zod/v4/core/versions.js
var version = {
major: 4,
minor: 3,
patch: 6
};
// node_modules/zod/v4/core/schemas.js
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
var _a;
inst ?? (inst = {});
inst._zod.def = def;
inst._zod.bag = inst._zod.bag || {};
inst._zod.version = version;
const checks = [...inst._zod.def.checks ?? []];
if (inst._zod.traits.has("$ZodCheck")) {
checks.unshift(inst);
}
for (const ch of checks) {
for (const fn of ch._zod.onattach) {
fn(inst);
}
}
if (checks.length === 0) {
(_a = inst._zod).deferred ?? (_a.deferred = []);
inst._zod.deferred?.push(() => {
inst._zod.run = inst._zod.parse;
});
} else {
const runChecks = (payload, checks2, ctx) => {
let isAborted = aborted(payload);
let asyncResult;
for (const ch of checks2) {
if (ch._zod.def.when) {
const shouldRun = ch._zod.def.when(payload);
if (!shouldRun)
continue;
} else if (isAborted) {
continue;
}
const currLen = payload.issues.length;
const _3 = ch._zod.check(payload);
if (_3 instanceof Promise && ctx?.async === false) {
throw new $ZodAsyncError;
}
if (asyncResult || _3 instanceof Promise) {
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
await _3;
const nextLen = payload.issues.length;
if (nextLen === currLen)
return;
if (!isAborted)
isAborted = aborted(payload, currLen);
});
} else {
const nextLen = payload.issues.length;
if (nextLen === currLen)
continue;
if (!isAborted)
isAborted = aborted(payload, currLen);
}
}
if (asyncResult) {
return asyncResult.then(() => {
return payload;
});
}
return payload;
};
const handleCanaryResult = (canary, payload, ctx) => {
if (aborted(canary)) {
canary.aborted = true;
return canary;
}
const checkResult = runChecks(payload, checks, ctx);
if (checkResult instanceof Promise) {
if (ctx.async === false)
throw new $ZodAsyncError;
return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
}
return inst._zod.parse(checkResult, ctx);
};
inst._zod.run = (payload, ctx) => {
if (ctx.skipChecks) {
return inst._zod.parse(payload, ctx);
}
if (ctx.direction === "backward") {
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
if (canary instanceof Promise) {
return canary.then((canary2) => {
return handleCanaryResult(canary2, payload, ctx);
});
}
return handleCanaryResult(canary, payload, ctx);
}
const result = inst._zod.parse(payload, ctx);
if (result instanceof Promise) {
if (ctx.async === false)
throw new $ZodAsyncError;
return result.then((result2) => runChecks(result2, checks, ctx));
}
return runChecks(result, checks, ctx);
};
}
defineLazy(inst, "~standard", () => ({
validate: (value) => {
try {
const r2 = safeParse(inst, value);
return r2.success ? { value: r2.data } : { issues: r2.error?.issues };
} catch (_3) {
return safeParseAsync(inst, value).then((r2) => r2.success ? { value: r2.data } : { issues: r2.error?.issues });
}
},
vendor: "zod",
version: 1
}));
});
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
inst._zod.parse = (payload, _3) => {
if (def.coerce)
try {
payload.value = String(payload.value);
} catch (_4) {}
if (typeof payload.value === "string")
return payload;
payload.issues.push({
expected: "string",
code: "invalid_type",
input: payload.value,
inst
});
return payload;
};
});
var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
$ZodCheckStringFormat.init(inst, def);
$ZodString.init(inst, def);
});
var $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
def.pattern ?? (def.pattern = guid);
$ZodStringFormat.init(inst, def);
});
var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
if (def.version) {
const versionMap = {
v1: 1,
v2: 2,
v3: 3,
v4: 4,
v5: 5,
v6: 6,
v7: 7,
v8: 8
};
const v = versionMap[def.version];
if (v === undefined)
throw new Error(`Invalid UUID version: "${def.version}"`);
def.pattern ?? (def.pattern = uuid(v));
} else
def.pattern ?? (def.pattern = uuid());
$ZodStringFormat.init(inst, def);
});
var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
def.pattern ?? (def.pattern = email);
$ZodStringFormat.init(inst, def);
});
var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
$ZodStringFormat.init(inst, def);
inst._zod.check = (payload) => {
try {
const trimmed = payload.value.trim();
const url = new URL(trimmed);
if (def.hostname) {
def.hostname.lastIndex = 0;
if (!def.hostname.test(url.hostname)) {
payload.issues.push({
code: "invalid_format",
format: "url",
note: "Invalid hostname",
pattern: def.hostname.source,
input: payload.value,
inst,
continue: !def.abort
});
}
}
if (def.protocol) {
def.protocol.lastIndex = 0;
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
payload.issues.push({
code: "invalid_format",
format: "url",
note: "Invalid protocol",
pattern: def.protocol.source,
input: payload.value,
inst,
continue: !def.abort
});
}
}
if (def.normalize) {
payload.value = url.href;
} else {
payload.value = trimmed;
}
return;
} catch (_3) {
payload.issues.push({
code: "invalid_format",
format: "url",
input: payload.value,
inst,
continue: !def.abort
});
}
};
});
var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
def.pattern ?? (def.pattern = emoji());
$ZodStringFormat.init(inst, def);
});
var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
def.pattern ?? (def.pattern = nanoid);
$ZodStringFormat.init(inst, def);
});
var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
def.pattern ?? (def.pattern = cuid);
$ZodStringFormat.init(inst, def);
});
var $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
def.pattern ?? (def.pattern = cuid2);
$ZodStringFormat.init(inst, def);
});
var $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
def.pattern ?? (def.pattern = ulid);
$ZodStringFormat.init(inst, def);
});
var $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
def.pattern ?? (def.pattern = xid);
$ZodStringFormat.init(inst, def);
});
var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
def.pattern ?? (def.pattern = ksuid);
$ZodStringFormat.init(inst, def);
});
var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
def.pattern ?? (def.pattern = datetime(def));
$ZodStringFormat.init(inst, def);
});
var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
def.pattern ?? (def.pattern = date);
$ZodStringFormat.init(inst, def);
});
var $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
def.pattern ?? (def.pattern = time(def));
$ZodStringFormat.init(inst, def);
});
var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
def.pattern ?? (def.pattern = duration);
$ZodStringFormat.init(inst, def);
});
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
def.pattern ?? (def.pattern = ipv4);
$ZodStringFormat.init(inst, def);
inst._zod.bag.format = `ipv4`;
});
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
def.pattern ?? (def.pattern = ipv6);
$ZodStringFormat.init(inst, def);
inst._zod.bag.format = `ipv6`;
inst._zod.check = (payload) => {
try {
new URL(`http://[${payload.value}]`);
} catch {
payload.issues.push({
code: "invalid_format",
format: "ipv6",
input: payload.value,
inst,
continue: !def.abort
});
}
};
});
var $ZodMAC = /* @__PURE__ */ $constructor("$ZodMAC", (inst, def) => {
def.pattern ?? (def.pattern = mac(def.delimiter));
$ZodStringFormat.init(inst, def);
inst._zod.bag.format = `mac`;
});
var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
def.pattern ?? (def.pattern = cidrv4);
$ZodStringFormat.init(inst, def);
});
var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
def.pattern ?? (def.pattern = cidrv6);
$ZodStringFormat.init(inst, def);
inst._zod.check = (payload) => {
const parts = payload.value.split("/");
try {
if (parts.length !== 2)
throw new Error;
const [address, prefix] = parts;
if (!prefix)
throw new Error;
const prefixNum = Number(prefix);
if (`${prefixNum}` !== prefix)
throw new Error;
if (prefixNum < 0 || prefixNum > 128)
throw new Error;
new URL(`http://[${address}]`);
} catch {
payload.issues.push({
code: "invalid_format",
format: "cidrv6",
input: payload.value,
inst,
continue: !def.abort
});
}
};
});
function isValidBase64(data) {
if (data === "")
return true;
if (data.length % 4 !== 0)
return false;
try {
atob(data);
return true;
} catch {
return false;
}
}
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
def.pattern ?? (def.pattern = base64);
$ZodStringFormat.init(inst, def);
inst._zod.bag.contentEncoding = "base64";
inst._zod.check = (payload) => {
if (isValidBase64(payload.value))
return;
payload.issues.push({
code: "invalid_format",
format: "base64",
input: payload.value,
inst,
continue: !def.abort
});
};
});
function isValidBase64URL(data) {
if (!base64url.test(data))
return false;
const base642 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
return isValidBase64(padded);
}
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
def.pattern ?? (def.pattern = base64url);
$ZodStringFormat.init(inst, def);
inst._zod.bag.contentEncoding = "base64url";
inst._zod.check = (payload) => {
if (isValidBase64URL(payload.value))
return;
payload.issues.push({
code: "invalid_format",
format: "base64url",
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
def.pattern ?? (def.pattern = e164);
$ZodStringFormat.init(inst, def);
});
function isValidJWT(token, algorithm = null) {
try {
const tokensParts = token.split(".");
if (tokensParts.length !== 3)
return false;
const [header] = tokensParts;
if (!header)
return false;
const parsedHeader = JSON.parse(atob(header));
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
return false;
if (!parsedHeader.alg)
return false;
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
return false;
return true;
} catch {
return false;
}
}
var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
$ZodStringFormat.init(inst, def);
inst._zod.check = (payload) => {
if (isValidJWT(payload.value, def.alg))
return;
payload.issues.push({
code: "invalid_format",
format: "jwt",
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringFormat", (inst, def) => {
$ZodStringFormat.init(inst, def);
inst._zod.check = (payload) => {
if (def.fn(payload.value))
return;
payload.issues.push({
code: "invalid_format",
format: def.format,
input: payload.value,
inst,
continue: !def.abort
});
};
});
var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = inst._zod.bag.pattern ?? number;
inst._zod.parse = (payload, _ctx) => {
if (def.coerce)
try {
payload.value = Number(payload.value);
} catch (_3) {}
const input = payload.value;
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
return payload;
}
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : undefined : undefined;
payload.issues.push({
expected: "number",
code: "invalid_type",
input,
inst,
...received ? { received } : {}
});
return payload;
};
});
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
$ZodCheckNumberFormat.init(inst, def);
$ZodNumber.init(inst, def);
});
var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = boolean;
inst._zod.parse = (payload, _ctx) => {
if (def.coerce)
try {
payload.value = Boolean(payload.value);
} catch (_3) {}
const input = payload.value;
if (typeof input === "boolean")
return payload;
payload.issues.push({
expected: "boolean",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = bigint;
inst._zod.parse = (payload, _ctx) => {
if (def.coerce)
try {
payload.value = BigInt(payload.value);
} catch (_3) {}
if (typeof payload.value === "bigint")
return payload;
payload.issues.push({
expected: "bigint",
code: "invalid_type",
input: payload.value,
inst
});
return payload;
};
});
var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, def) => {
$ZodCheckBigIntFormat.init(inst, def);
$ZodBigInt.init(inst, def);
});
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (typeof input === "symbol")
return payload;
payload.issues.push({
expected: "symbol",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = _undefined;
inst._zod.values = new Set([undefined]);
inst._zod.optin = "optional";
inst._zod.optout = "optional";
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (typeof input === "undefined")
return payload;
payload.issues.push({
expected: "undefined",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.pattern = _null2;
inst._zod.values = new Set([null]);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (input === null)
return payload;
payload.issues.push({
expected: "null",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload) => payload;
});
var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload) => payload;
});
var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
payload.issues.push({
expected: "never",
code: "invalid_type",
input: payload.value,
inst
});
return payload;
};
});
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (typeof input === "undefined")
return payload;
payload.issues.push({
expected: "void",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
if (def.coerce) {
try {
payload.value = new Date(payload.value);
} catch (_err) {}
}
const input = payload.value;
const isDate = input instanceof Date;
const isValidDate = isDate && !Number.isNaN(input.getTime());
if (isValidDate)
return payload;
payload.issues.push({
expected: "date",
code: "invalid_type",
input,
...isDate ? { received: "Invalid Date" } : {},
inst
});
return payload;
};
});
function handleArrayResult(result, final, index) {
if (result.issues.length) {
final.issues.push(...prefixIssues(index, result.issues));
}
final.value[index] = result.value;
}
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!Array.isArray(input)) {
payload.issues.push({
expected: "array",
code: "invalid_type",
input,
inst
});
return payload;
}
payload.value = Array(input.length);
const proms = [];
for (let i2 = 0;i2 < input.length; i2++) {
const item = input[i2];
const result = def.element._zod.run({
value: item,
issues: []
}, ctx);
if (result instanceof Promise) {
proms.push(result.then((result2) => handleArrayResult(result2, payload, i2)));
} else {
handleArrayResult(result, payload, i2);
}
}
if (proms.length) {
return Promise.all(proms).then(() => payload);
}
return payload;
};
});
function handlePropertyResult(result, final, key, input, isOptionalOut) {
if (result.issues.length) {
if (isOptionalOut && !(key in input)) {
return;
}
final.issues.push(...prefixIssues(key, result.issues));
}
if (result.value === undefined) {
if (key in input) {
final.value[key] = undefined;
}
} else {
final.value[key] = result.value;
}
}
function normalizeDef(def) {
const keys = Object.keys(def.shape);
for (const k3 of keys) {
if (!def.shape?.[k3]?._zod?.traits?.has("$ZodType")) {
throw new Error(`Invalid element at key "${k3}": expected a Zod schema`);
}
}
const okeys = optionalKeys(def.shape);
return {
...def,
keys,
keySet: new Set(keys),
numKeys: keys.length,
optionalKeys: new Set(okeys)
};
}
function handleCatchall(proms, input, payload, ctx, def, inst) {
const unrecognized = [];
const keySet = def.keySet;
const _catchall = def.catchall._zod;
const t = _catchall.def.type;
const isOptionalOut = _catchall.optout === "optional";
for (const key in input) {
if (keySet.has(key))
continue;
if (t === "never") {
unrecognized.push(key);
continue;
}
const r2 = _catchall.run({ value: input[key], issues: [] }, ctx);
if (r2 instanceof Promise) {
proms.push(r2.then((r3) => handlePropertyResult(r3, payload, key, input, isOptionalOut)));
} else {
handlePropertyResult(r2, payload, key, input, isOptionalOut);
}
}
if (unrecognized.length) {
payload.issues.push({
code: "unrecognized_keys",
keys: unrecognized,
input,
inst
});
}
if (!proms.length)
return payload;
return Promise.all(proms).then(() => {
return payload;
});
}
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
$ZodType.init(inst, def);
const desc = Object.getOwnPropertyDescriptor(def, "shape");
if (!desc?.get) {
const sh = def.shape;
Object.defineProperty(def, "shape", {
get: () => {
const newSh = { ...sh };
Object.defineProperty(def, "shape", {
value: newSh
});
return newSh;
}
});
}
const _normalized = cached(() => normalizeDef(def));
defineLazy(inst._zod, "propValues", () => {
const shape = def.shape;
const propValues = {};
for (const key in shape) {
const field = shape[key]._zod;
if (field.values) {
propValues[key] ?? (propValues[key] = new Set);
for (const v of field.values)
propValues[key].add(v);
}
}
return propValues;
});
const isObject3 = isObject2;
const catchall = def.catchall;
let value;
inst._zod.parse = (payload, ctx) => {
value ?? (value = _normalized.value);
const input = payload.value;
if (!isObject3(input)) {
payload.issues.push({
expected: "object",
code: "invalid_type",
input,
inst
});
return payload;
}
payload.value = {};
const proms = [];
const shape = value.shape;
for (const key of value.keys) {
const el = shape[key];
const isOptionalOut = el._zod.optout === "optional";
const r2 = el._zod.run({ value: input[key], issues: [] }, ctx);
if (r2 instanceof Promise) {
proms.push(r2.then((r3) => handlePropertyResult(r3, payload, key, input, isOptionalOut)));
} else {
handlePropertyResult(r2, payload, key, input, isOptionalOut);
}
}
if (!catchall) {
return proms.length ? Promise.all(proms).then(() => payload) : payload;
}
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
};
});
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
$ZodObject.init(inst, def);
const superParse = inst._zod.parse;
const _normalized = cached(() => normalizeDef(def));
const generateFastpass = (shape) => {
const doc = new Doc(["shape", "payload", "ctx"]);
const normalized = _normalized.value;
const parseStr = (key) => {
const k3 = esc(key);
return `shape[${k3}]._zod.run({ value: input[${k3}], issues: [] }, ctx)`;
};
doc.write(`const input = payload.value;`);
const ids = Object.create(null);
let counter = 0;
for (const key of normalized.keys) {
ids[key] = `key_${counter++}`;
}
doc.write(`const newResult = {};`);
for (const key of normalized.keys) {
const id = ids[key];
const k3 = esc(key);
const schema2 = shape[key];
const isOptionalOut = schema2?._zod?.optout === "optional";
doc.write(`const ${id} = ${parseStr(key)};`);
if (isOptionalOut) {
doc.write(`
if (${id}.issues.length) {
if (${k3} in input) {
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
...iss,
path: iss.path ? [${k3}, ...iss.path] : [${k3}]
})));
}
}
if (${id}.value === undefined) {
if (${k3} in input) {
newResult[${k3}] = undefined;
}
} else {
newResult[${k3}] = ${id}.value;
}
`);
} else {
doc.write(`
if (${id}.issues.length) {
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
...iss,
path: iss.path ? [${k3}, ...iss.path] : [${k3}]
})));
}
if (${id}.value === undefined) {
if (${k3} in input) {
newResult[${k3}] = undefined;
}
} else {
newResult[${k3}] = ${id}.value;
}
`);
}
}
doc.write(`payload.value = newResult;`);
doc.write(`return payload;`);
const fn = doc.compile();
return (payload, ctx) => fn(shape, payload, ctx);
};
let fastpass;
const isObject3 = isObject2;
const jit = !globalConfig.jitless;
const allowsEval2 = allowsEval;
const fastEnabled = jit && allowsEval2.value;
const catchall = def.catchall;
let value;
inst._zod.parse = (payload, ctx) => {
value ?? (value = _normalized.value);
const input = payload.value;
if (!isObject3(input)) {
payload.issues.push({
expected: "object",
code: "invalid_type",
input,
inst
});
return payload;
}
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
if (!fastpass)
fastpass = generateFastpass(def.shape);
payload = fastpass(payload, ctx);
if (!catchall)
return payload;
return handleCatchall([], input, payload, ctx, value, inst);
}
return superParse(payload, ctx);
};
});
function handleUnionResults(results, final, inst, ctx) {
for (const result of results) {
if (result.issues.length === 0) {
final.value = result.value;
return final;
}
}
const nonaborted = results.filter((r2) => !aborted(r2));
if (nonaborted.length === 1) {
final.value = nonaborted[0].value;
return nonaborted[0];
}
final.issues.push({
code: "invalid_union",
input: final.value,
inst,
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
});
return final;
}
var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "optin", () => def.options.some((o2) => o2._zod.optin === "optional") ? "optional" : undefined);
defineLazy(inst._zod, "optout", () => def.options.some((o2) => o2._zod.optout === "optional") ? "optional" : undefined);
defineLazy(inst._zod, "values", () => {
if (def.options.every((o2) => o2._zod.values)) {
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
}
return;
});
defineLazy(inst._zod, "pattern", () => {
if (def.options.every((o2) => o2._zod.pattern)) {
const patterns = def.options.map((o2) => o2._zod.pattern);
return new RegExp(`^(${patterns.map((p2) => cleanRegex(p2.source)).join("|")})$`);
}
return;
});
const single = def.options.length === 1;
const first = def.options[0]._zod.run;
inst._zod.parse = (payload, ctx) => {
if (single) {
return first(payload, ctx);
}
let async = false;
const results = [];
for (const option of def.options) {
const result = option._zod.run({
value: payload.value,
issues: []
}, ctx);
if (result instanceof Promise) {
results.push(result);
async = true;
} else {
if (result.issues.length === 0)
return result;
results.push(result);
}
}
if (!async)
return handleUnionResults(results, payload, inst, ctx);
return Promise.all(results).then((results2) => {
return handleUnionResults(results2, payload, inst, ctx);
});
};
});
function handleExclusiveUnionResults(results, final, inst, ctx) {
const successes = results.filter((r2) => r2.issues.length === 0);
if (successes.length === 1) {
final.value = successes[0].value;
return final;
}
if (successes.length === 0) {
final.issues.push({
code: "invalid_union",
input: final.value,
inst,
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
});
} else {
final.issues.push({
code: "invalid_union",
input: final.value,
inst,
errors: [],
inclusive: false
});
}
return final;
}
var $ZodXor = /* @__PURE__ */ $constructor("$ZodXor", (inst, def) => {
$ZodUnion.init(inst, def);
def.inclusive = false;
const single = def.options.length === 1;
const first = def.options[0]._zod.run;
inst._zod.parse = (payload, ctx) => {
if (single) {
return first(payload, ctx);
}
let async = false;
const results = [];
for (const option of def.options) {
const result = option._zod.run({
value: payload.value,
issues: []
}, ctx);
if (result instanceof Promise) {
results.push(result);
async = true;
} else {
results.push(result);
}
}
if (!async)
return handleExclusiveUnionResults(results, payload, inst, ctx);
return Promise.all(results).then((results2) => {
return handleExclusiveUnionResults(results2, payload, inst, ctx);
});
};
});
var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
def.inclusive = false;
$ZodUnion.init(inst, def);
const _super = inst._zod.parse;
defineLazy(inst._zod, "propValues", () => {
const propValues = {};
for (const option of def.options) {
const pv = option._zod.propValues;
if (!pv || Object.keys(pv).length === 0)
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
for (const [k3, v] of Object.entries(pv)) {
if (!propValues[k3])
propValues[k3] = new Set;
for (const val of v) {
propValues[k3].add(val);
}
}
}
return propValues;
});
const disc = cached(() => {
const opts = def.options;
const map2 = new Map;
for (const o2 of opts) {
const values = o2._zod.propValues?.[def.discriminator];
if (!values || values.size === 0)
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o2)}"`);
for (const v of values) {
if (map2.has(v)) {
throw new Error(`Duplicate discriminator value "${String(v)}"`);
}
map2.set(v, o2);
}
}
return map2;
});
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!isObject2(input)) {
payload.issues.push({
code: "invalid_type",
expected: "object",
input,
inst
});
return payload;
}
const opt = disc.value.get(input?.[def.discriminator]);
if (opt) {
return opt._zod.run(payload, ctx);
}
if (def.unionFallback) {
return _super(payload, ctx);
}
payload.issues.push({
code: "invalid_union",
errors: [],
note: "No matching discriminator",
discriminator: def.discriminator,
input,
path: [def.discriminator],
inst
});
return payload;
};
});
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
const left = def.left._zod.run({ value: input, issues: [] }, ctx);
const right = def.right._zod.run({ value: input, issues: [] }, ctx);
const async = left instanceof Promise || right instanceof Promise;
if (async) {
return Promise.all([left, right]).then(([left2, right2]) => {
return handleIntersectionResults(payload, left2, right2);
});
}
return handleIntersectionResults(payload, left, right);
};
});
function mergeValues(a, b3) {
if (a === b3) {
return { valid: true, data: a };
}
if (a instanceof Date && b3 instanceof Date && +a === +b3) {
return { valid: true, data: a };
}
if (isPlainObject2(a) && isPlainObject2(b3)) {
const bKeys = Object.keys(b3);
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
const newObj = { ...a, ...b3 };
for (const key of sharedKeys) {
const sharedValue = mergeValues(a[key], b3[key]);
if (!sharedValue.valid) {
return {
valid: false,
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
};
}
newObj[key] = sharedValue.data;
}
return { valid: true, data: newObj };
}
if (Array.isArray(a) && Array.isArray(b3)) {
if (a.length !== b3.length) {
return { valid: false, mergeErrorPath: [] };
}
const newArray = [];
for (let index = 0;index < a.length; index++) {
const itemA = a[index];
const itemB = b3[index];
const sharedValue = mergeValues(itemA, itemB);
if (!sharedValue.valid) {
return {
valid: false,
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
};
}
newArray.push(sharedValue.data);
}
return { valid: true, data: newArray };
}
return { valid: false, mergeErrorPath: [] };
}
function handleIntersectionResults(result, left, right) {
const unrecKeys = new Map;
let unrecIssue;
for (const iss of left.issues) {
if (iss.code === "unrecognized_keys") {
unrecIssue ?? (unrecIssue = iss);
for (const k3 of iss.keys) {
if (!unrecKeys.has(k3))
unrecKeys.set(k3, {});
unrecKeys.get(k3).l = true;
}
} else {
result.issues.push(iss);
}
}
for (const iss of right.issues) {
if (iss.code === "unrecognized_keys") {
for (const k3 of iss.keys) {
if (!unrecKeys.has(k3))
unrecKeys.set(k3, {});
unrecKeys.get(k3).r = true;
}
} else {
result.issues.push(iss);
}
}
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k3]) => k3);
if (bothKeys.length && unrecIssue) {
result.issues.push({ ...unrecIssue, keys: bothKeys });
}
if (aborted(result))
return result;
const merged = mergeValues(left.value, right.value);
if (!merged.valid) {
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
}
result.value = merged.data;
return result;
}
var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
$ZodType.init(inst, def);
const items = def.items;
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!Array.isArray(input)) {
payload.issues.push({
input,
inst,
expected: "tuple",
code: "invalid_type"
});
return payload;
}
payload.value = [];
const proms = [];
const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
if (!def.rest) {
const tooBig = input.length > items.length;
const tooSmall = input.length < optStart - 1;
if (tooBig || tooSmall) {
payload.issues.push({
...tooBig ? { code: "too_big", maximum: items.length, inclusive: true } : { code: "too_small", minimum: items.length },
input,
inst,
origin: "array"
});
return payload;
}
}
let i2 = -1;
for (const item of items) {
i2++;
if (i2 >= input.length) {
if (i2 >= optStart)
continue;
}
const result = item._zod.run({
value: input[i2],
issues: []
}, ctx);
if (result instanceof Promise) {
proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
} else {
handleTupleResult(result, payload, i2);
}
}
if (def.rest) {
const rest = input.slice(items.length);
for (const el of rest) {
i2++;
const result = def.rest._zod.run({
value: el,
issues: []
}, ctx);
if (result instanceof Promise) {
proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
} else {
handleTupleResult(result, payload, i2);
}
}
}
if (proms.length)
return Promise.all(proms).then(() => payload);
return payload;
};
});
function handleTupleResult(result, final, index) {
if (result.issues.length) {
final.issues.push(...prefixIssues(index, result.issues));
}
final.value[index] = result.value;
}
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!isPlainObject2(input)) {
payload.issues.push({
expected: "record",
code: "invalid_type",
input,
inst
});
return payload;
}
const proms = [];
const values = def.keyType._zod.values;
if (values) {
payload.value = {};
const recordKeys = new Set;
for (const key of values) {
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
recordKeys.add(typeof key === "number" ? key.toString() : key);
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
if (result instanceof Promise) {
proms.push(result.then((result2) => {
if (result2.issues.length) {
payload.issues.push(...prefixIssues(key, result2.issues));
}
payload.value[key] = result2.value;
}));
} else {
if (result.issues.length) {
payload.issues.push(...prefixIssues(key, result.issues));
}
payload.value[key] = result.value;
}
}
}
let unrecognized;
for (const key in input) {
if (!recordKeys.has(key)) {
unrecognized = unrecognized ?? [];
unrecognized.push(key);
}
}
if (unrecognized && unrecognized.length > 0) {
payload.issues.push({
code: "unrecognized_keys",
input,
inst,
keys: unrecognized
});
}
} else {
payload.value = {};
for (const key of Reflect.ownKeys(input)) {
if (key === "__proto__")
continue;
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
if (keyResult instanceof Promise) {
throw new Error("Async schemas not supported in object keys currently");
}
const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
if (checkNumericKey) {
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
if (retryResult instanceof Promise) {
throw new Error("Async schemas not supported in object keys currently");
}
if (retryResult.issues.length === 0) {
keyResult = retryResult;
}
}
if (keyResult.issues.length) {
if (def.mode === "loose") {
payload.value[key] = input[key];
} else {
payload.issues.push({
code: "invalid_key",
origin: "record",
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
input: key,
path: [key],
inst
});
}
continue;
}
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
if (result instanceof Promise) {
proms.push(result.then((result2) => {
if (result2.issues.length) {
payload.issues.push(...prefixIssues(key, result2.issues));
}
payload.value[keyResult.value] = result2.value;
}));
} else {
if (result.issues.length) {
payload.issues.push(...prefixIssues(key, result.issues));
}
payload.value[keyResult.value] = result.value;
}
}
}
if (proms.length) {
return Promise.all(proms).then(() => payload);
}
return payload;
};
});
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!(input instanceof Map)) {
payload.issues.push({
expected: "map",
code: "invalid_type",
input,
inst
});
return payload;
}
const proms = [];
payload.value = new Map;
for (const [key, value] of input) {
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
if (keyResult instanceof Promise || valueResult instanceof Promise) {
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx);
}));
} else {
handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
}
}
if (proms.length)
return Promise.all(proms).then(() => payload);
return payload;
};
});
function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
if (keyResult.issues.length) {
if (propertyKeyTypes.has(typeof key)) {
final.issues.push(...prefixIssues(key, keyResult.issues));
} else {
final.issues.push({
code: "invalid_key",
origin: "map",
input,
inst,
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
});
}
}
if (valueResult.issues.length) {
if (propertyKeyTypes.has(typeof key)) {
final.issues.push(...prefixIssues(key, valueResult.issues));
} else {
final.issues.push({
origin: "map",
code: "invalid_element",
input,
inst,
key,
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
});
}
}
final.value.set(keyResult.value, valueResult.value);
}
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
const input = payload.value;
if (!(input instanceof Set)) {
payload.issues.push({
input,
inst,
expected: "set",
code: "invalid_type"
});
return payload;
}
const proms = [];
payload.value = new Set;
for (const item of input) {
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
if (result instanceof Promise) {
proms.push(result.then((result2) => handleSetResult(result2, payload)));
} else
handleSetResult(result, payload);
}
if (proms.length)
return Promise.all(proms).then(() => payload);
return payload;
};
});
function handleSetResult(result, final) {
if (result.issues.length) {
final.issues.push(...result.issues);
}
final.value.add(result.value);
}
var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
$ZodType.init(inst, def);
const values = getEnumValues(def.entries);
const valuesSet = new Set(values);
inst._zod.values = valuesSet;
inst._zod.pattern = new RegExp(`^(${values.filter((k3) => propertyKeyTypes.has(typeof k3)).map((o2) => typeof o2 === "string" ? escapeRegex(o2) : o2.toString()).join("|")})$`);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (valuesSet.has(input)) {
return payload;
}
payload.issues.push({
code: "invalid_value",
values,
input,
inst
});
return payload;
};
});
var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
$ZodType.init(inst, def);
if (def.values.length === 0) {
throw new Error("Cannot create literal schema with no valid values");
}
const values = new Set(def.values);
inst._zod.values = values;
inst._zod.pattern = new RegExp(`^(${def.values.map((o2) => typeof o2 === "string" ? escapeRegex(o2) : o2 ? escapeRegex(o2.toString()) : String(o2)).join("|")})$`);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (values.has(input)) {
return payload;
}
payload.issues.push({
code: "invalid_value",
values: def.values,
input,
inst
});
return payload;
};
});
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
const input = payload.value;
if (input instanceof File)
return payload;
payload.issues.push({
expected: "file",
code: "invalid_type",
input,
inst
});
return payload;
};
});
var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
throw new $ZodEncodeError(inst.constructor.name);
}
const _out = def.transform(payload.value, payload);
if (ctx.async) {
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
return output.then((output2) => {
payload.value = output2;
return payload;
});
}
if (_out instanceof Promise) {
throw new $ZodAsyncError;
}
payload.value = _out;
return payload;
};
});
function handleOptionalResult(result, input) {
if (result.issues.length && input === undefined) {
return { issues: [], value: undefined };
}
return result;
}
var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.optin = "optional";
inst._zod.optout = "optional";
defineLazy(inst._zod, "values", () => {
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
});
defineLazy(inst._zod, "pattern", () => {
const pattern = def.innerType._zod.pattern;
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : undefined;
});
inst._zod.parse = (payload, ctx) => {
if (def.innerType._zod.optin === "optional") {
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise)
return result.then((r2) => handleOptionalResult(r2, payload.value));
return handleOptionalResult(result, payload.value);
}
if (payload.value === undefined) {
return payload;
}
return def.innerType._zod.run(payload, ctx);
};
});
var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
$ZodOptional.init(inst, def);
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
inst._zod.parse = (payload, ctx) => {
return def.innerType._zod.run(payload, ctx);
};
});
var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
defineLazy(inst._zod, "pattern", () => {
const pattern = def.innerType._zod.pattern;
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : undefined;
});
defineLazy(inst._zod, "values", () => {
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
});
inst._zod.parse = (payload, ctx) => {
if (payload.value === null)
return payload;
return def.innerType._zod.run(payload, ctx);
};
});
var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.optin = "optional";
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
return def.innerType._zod.run(payload, ctx);
}
if (payload.value === undefined) {
payload.value = def.defaultValue;
return payload;
}
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise) {
return result.then((result2) => handleDefaultResult(result2, def));
}
return handleDefaultResult(result, def);
};
});
function handleDefaultResult(payload, def) {
if (payload.value === undefined) {
payload.value = def.defaultValue;
}
return payload;
}
var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.optin = "optional";
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
return def.innerType._zod.run(payload, ctx);
}
if (payload.value === undefined) {
payload.value = def.defaultValue;
}
return def.innerType._zod.run(payload, ctx);
};
});
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "values", () => {
const v = def.innerType._zod.values;
return v ? new Set([...v].filter((x2) => x2 !== undefined)) : undefined;
});
inst._zod.parse = (payload, ctx) => {
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise) {
return result.then((result2) => handleNonOptionalResult(result2, inst));
}
return handleNonOptionalResult(result, inst);
};
});
function handleNonOptionalResult(payload, inst) {
if (!payload.issues.length && payload.value === undefined) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: payload.value,
inst
});
}
return payload;
}
var $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
throw new $ZodEncodeError("ZodSuccess");
}
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise) {
return result.then((result2) => {
payload.value = result2.issues.length === 0;
return payload;
});
}
payload.value = result.issues.length === 0;
return payload;
};
});
var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
return def.innerType._zod.run(payload, ctx);
}
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise) {
return result.then((result2) => {
payload.value = result2.value;
if (result2.issues.length) {
payload.value = def.catchValue({
...payload,
error: {
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
},
input: payload.value
});
payload.issues = [];
}
return payload;
});
}
payload.value = result.value;
if (result.issues.length) {
payload.value = def.catchValue({
...payload,
error: {
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
},
input: payload.value
});
payload.issues = [];
}
return payload;
};
});
var $ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, _ctx) => {
if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
payload.issues.push({
input: payload.value,
inst,
expected: "nan",
code: "invalid_type"
});
return payload;
}
return payload;
};
});
var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "values", () => def.in._zod.values);
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
const right = def.out._zod.run(payload, ctx);
if (right instanceof Promise) {
return right.then((right2) => handlePipeResult(right2, def.in, ctx));
}
return handlePipeResult(right, def.in, ctx);
}
const left = def.in._zod.run(payload, ctx);
if (left instanceof Promise) {
return left.then((left2) => handlePipeResult(left2, def.out, ctx));
}
return handlePipeResult(left, def.out, ctx);
};
});
function handlePipeResult(left, next, ctx) {
if (left.issues.length) {
left.aborted = true;
return left;
}
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
}
var $ZodCodec = /* @__PURE__ */ $constructor("$ZodCodec", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "values", () => def.in._zod.values);
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
inst._zod.parse = (payload, ctx) => {
const direction = ctx.direction || "forward";
if (direction === "forward") {
const left = def.in._zod.run(payload, ctx);
if (left instanceof Promise) {
return left.then((left2) => handleCodecAResult(left2, def, ctx));
}
return handleCodecAResult(left, def, ctx);
} else {
const right = def.out._zod.run(payload, ctx);
if (right instanceof Promise) {
return right.then((right2) => handleCodecAResult(right2, def, ctx));
}
return handleCodecAResult(right, def, ctx);
}
};
});
function handleCodecAResult(result, def, ctx) {
if (result.issues.length) {
result.aborted = true;
return result;
}
const direction = ctx.direction || "forward";
if (direction === "forward") {
const transformed = def.transform(result.value, result);
if (transformed instanceof Promise) {
return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));
}
return handleCodecTxResult(result, transformed, def.out, ctx);
} else {
const transformed = def.reverseTransform(result.value, result);
if (transformed instanceof Promise) {
return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));
}
return handleCodecTxResult(result, transformed, def.in, ctx);
}
}
function handleCodecTxResult(left, value, nextSchema, ctx) {
if (left.issues.length) {
left.aborted = true;
return left;
}
return nextSchema._zod.run({ value, issues: left.issues }, ctx);
}
var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
inst._zod.parse = (payload, ctx) => {
if (ctx.direction === "backward") {
return def.innerType._zod.run(payload, ctx);
}
const result = def.innerType._zod.run(payload, ctx);
if (result instanceof Promise) {
return result.then(handleReadonlyResult);
}
return handleReadonlyResult(result);
};
});
function handleReadonlyResult(payload) {
payload.value = Object.freeze(payload.value);
return payload;
}
var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => {
$ZodType.init(inst, def);
const regexParts = [];
for (const part of def.parts) {
if (typeof part === "object" && part !== null) {
if (!part._zod.pattern) {
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
}
const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
if (!source)
throw new Error(`Invalid template literal part: ${part._zod.traits}`);
const start = source.startsWith("^") ? 1 : 0;
const end = source.endsWith("$") ? source.length - 1 : source.length;
regexParts.push(source.slice(start, end));
} else if (part === null || primitiveTypes.has(typeof part)) {
regexParts.push(escapeRegex(`${part}`));
} else {
throw new Error(`Invalid template literal part: ${part}`);
}
}
inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
inst._zod.parse = (payload, _ctx) => {
if (typeof payload.value !== "string") {
payload.issues.push({
input: payload.value,
inst,
expected: "string",
code: "invalid_type"
});
return payload;
}
inst._zod.pattern.lastIndex = 0;
if (!inst._zod.pattern.test(payload.value)) {
payload.issues.push({
input: payload.value,
inst,
code: "invalid_format",
format: def.format ?? "template_literal",
pattern: inst._zod.pattern.source
});
return payload;
}
return payload;
};
});
var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
$ZodType.init(inst, def);
inst._def = def;
inst._zod.def = def;
inst.implement = (func) => {
if (typeof func !== "function") {
throw new Error("implement() must be called with a function");
}
return function(...args) {
const parsedArgs = inst._def.input ? parse3(inst._def.input, args) : args;
const result = Reflect.apply(func, this, parsedArgs);
if (inst._def.output) {
return parse3(inst._def.output, result);
}
return result;
};
};
inst.implementAsync = (func) => {
if (typeof func !== "function") {
throw new Error("implementAsync() must be called with a function");
}
return async function(...args) {
const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
const result = await Reflect.apply(func, this, parsedArgs);
if (inst._def.output) {
return await parseAsync(inst._def.output, result);
}
return result;
};
};
inst._zod.parse = (payload, _ctx) => {
if (typeof payload.value !== "function") {
payload.issues.push({
code: "invalid_type",
expected: "function",
input: payload.value,
inst
});
return payload;
}
const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise";
if (hasPromiseOutput) {
payload.value = inst.implementAsync(payload.value);
} else {
payload.value = inst.implement(payload.value);
}
return payload;
};
inst.input = (...args) => {
const F2 = inst.constructor;
if (Array.isArray(args[0])) {
return new F2({
type: "function",
input: new $ZodTuple({
type: "tuple",
items: args[0],
rest: args[1]
}),
output: inst._def.output
});
}
return new F2({
type: "function",
input: args[0],
output: inst._def.output
});
};
inst.output = (output) => {
const F2 = inst.constructor;
return new F2({
type: "function",
input: inst._def.input,
output
});
};
return inst;
});
var $ZodPromise = /* @__PURE__ */ $constructor("$ZodPromise", (inst, def) => {
$ZodType.init(inst, def);
inst._zod.parse = (payload, ctx) => {
return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
};
});
var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
$ZodType.init(inst, def);
defineLazy(inst._zod, "innerType", () => def.getter());
defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? undefined);
inst._zod.parse = (payload, ctx) => {
const inner = inst._zod.innerType;
return inner._zod.run(payload, ctx);
};
});
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
$ZodCheck.init(inst, def);
$ZodType.init(inst, def);
inst._zod.parse = (payload, _3) => {
return payload;
};
inst._zod.check = (payload) => {
const input = payload.value;
const r2 = def.fn(input);
if (r2 instanceof Promise) {
return r2.then((r3) => handleRefineResult(r3, payload, input, inst));
}
handleRefineResult(r2, payload, input, inst);
return;
};
});
function handleRefineResult(result, payload, input, inst) {
if (!result) {
const _iss = {
code: "custom",
input,
inst,
path: [...inst._zod.def.path ?? []],
continue: !inst._zod.def.abort
};
if (inst._zod.def.params)
_iss.params = inst._zod.def.params;
payload.issues.push(issue(_iss));
}
}
// node_modules/zod/v4/locales/index.js
var exports_locales = {};
__export(exports_locales, {
zhTW: () => zh_TW_default,
zhCN: () => zh_CN_default,
yo: () => yo_default,
vi: () => vi_default,
uz: () => uz_default,
ur: () => ur_default,
uk: () => uk_default,
ua: () => ua_default,
tr: () => tr_default,
th: () => th_default,
ta: () => ta_default,
sv: () => sv_default,
sl: () => sl_default,
ru: () => ru_default,
pt: () => pt_default,
ps: () => ps_default,
pl: () => pl_default,
ota: () => ota_default,
no: () => no_default,
nl: () => nl_default,
ms: () => ms_default,
mk: () => mk_default,
lt: () => lt_default,
ko: () => ko_default,
km: () => km_default,
kh: () => kh_default,
ka: () => ka_default,
ja: () => ja_default,
it: () => it_default,
is: () => is_default,
id: () => id_default,
hy: () => hy_default,
hu: () => hu_default,
he: () => he_default,
frCA: () => fr_CA_default,
fr: () => fr_default,
fi: () => fi_default,
fa: () => fa_default,
es: () => es_default,
eo: () => eo_default,
en: () => en_default,
de: () => de_default,
da: () => da_default,
cs: () => cs_default,
ca: () => ca_default,
bg: () => bg_default,
be: () => be_default,
az: () => az_default,
ar: () => ar_default
});
// node_modules/zod/v4/locales/ar.js
var error = () => {
const Sizable = {
string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
file: { unit: "\u0628\u0627\u064A\u062A", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
array: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
set: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0645\u062F\u062E\u0644",
email: "\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",
url: "\u0631\u0627\u0628\u0637",
emoji: "\u0625\u064A\u0645\u0648\u062C\u064A",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",
date: "\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",
time: "\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",
duration: "\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",
ipv4: "\u0639\u0646\u0648\u0627\u0646 IPv4",
ipv6: "\u0639\u0646\u0648\u0627\u0646 IPv6",
cidrv4: "\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",
cidrv6: "\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",
base64: "\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",
base64url: "\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",
json_string: "\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",
e164: "\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",
jwt: "JWT",
template_literal: "\u0645\u062F\u062E\u0644"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${issue2.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${received}`;
}
return `\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${stringifyPrimitive(issue2.values[0])}`;
return `\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return ` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${issue2.origin ?? "\u0627\u0644\u0642\u064A\u0645\u0629"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0635\u0631"}`;
return `\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${issue2.origin ?? "\u0627\u0644\u0642\u064A\u0645\u0629"} ${adj} ${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${issue2.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
}
return `\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${issue2.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${adj} ${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${issue2.prefix}"`;
if (_issue.format === "ends_with")
return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`;
}
case "not_multiple_of":
return `\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${issue2.divisor}`;
case "unrecognized_keys":
return `\u0645\u0639\u0631\u0641${issue2.keys.length > 1 ? "\u0627\u062A" : ""} \u063A\u0631\u064A\u0628${issue2.keys.length > 1 ? "\u0629" : ""}: ${joinValues(issue2.keys, "\u060C ")}`;
case "invalid_key":
return `\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${issue2.origin}`;
case "invalid_union":
return "\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";
case "invalid_element":
return `\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${issue2.origin}`;
default:
return "\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";
}
};
};
function ar_default() {
return {
localeError: error()
};
}
// node_modules/zod/v4/locales/az.js
var error2 = () => {
const Sizable = {
string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
file: { unit: "bayt", verb: "olmal\u0131d\u0131r" },
array: { unit: "element", verb: "olmal\u0131d\u0131r" },
set: { unit: "element", verb: "olmal\u0131d\u0131r" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "email address",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datetime",
date: "ISO date",
time: "ISO time",
duration: "ISO duration",
ipv4: "IPv4 address",
ipv6: "IPv6 address",
cidrv4: "IPv4 range",
cidrv6: "IPv6 range",
base64: "base64-encoded string",
base64url: "base64url-encoded string",
json_string: "JSON string",
e164: "E.164 number",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${issue2.expected}, daxil olan ${received}`;
}
return `Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${expected}, daxil olan ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${stringifyPrimitive(issue2.values[0])}`;
return `Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${issue2.origin ?? "d\u0259y\u0259r"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`;
return `\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${issue2.origin ?? "d\u0259y\u0259r"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
return `\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Yanl\u0131\u015F m\u0259tn: "${_issue.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`;
if (_issue.format === "ends_with")
return `Yanl\u0131\u015F m\u0259tn: "${_issue.suffix}" il\u0259 bitm\u0259lidir`;
if (_issue.format === "includes")
return `Yanl\u0131\u015F m\u0259tn: "${_issue.includes}" daxil olmal\u0131d\u0131r`;
if (_issue.format === "regex")
return `Yanl\u0131\u015F m\u0259tn: ${_issue.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`;
return `Yanl\u0131\u015F ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Yanl\u0131\u015F \u0259d\u0259d: ${issue2.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;
case "unrecognized_keys":
return `Tan\u0131nmayan a\xE7ar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;
case "invalid_union":
return "Yanl\u0131\u015F d\u0259y\u0259r";
case "invalid_element":
return `${issue2.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;
default:
return `Yanl\u0131\u015F d\u0259y\u0259r`;
}
};
};
function az_default() {
return {
localeError: error2()
};
}
// node_modules/zod/v4/locales/be.js
function getBelarusianPlural(count, one, few, many) {
const absCount = Math.abs(count);
const lastDigit = absCount % 10;
const lastTwoDigits = absCount % 100;
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
return many;
}
if (lastDigit === 1) {
return one;
}
if (lastDigit >= 2 && lastDigit <= 4) {
return few;
}
return many;
}
var error3 = () => {
const Sizable = {
string: {
unit: {
one: "\u0441\u0456\u043C\u0432\u0430\u043B",
few: "\u0441\u0456\u043C\u0432\u0430\u043B\u044B",
many: "\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"
},
verb: "\u043C\u0435\u0446\u044C"
},
array: {
unit: {
one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442",
few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",
many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"
},
verb: "\u043C\u0435\u0446\u044C"
},
set: {
unit: {
one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442",
few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",
many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"
},
verb: "\u043C\u0435\u0446\u044C"
},
file: {
unit: {
one: "\u0431\u0430\u0439\u0442",
few: "\u0431\u0430\u0439\u0442\u044B",
many: "\u0431\u0430\u0439\u0442\u0430\u045E"
},
verb: "\u043C\u0435\u0446\u044C"
}
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0443\u0432\u043E\u0434",
email: "email \u0430\u0434\u0440\u0430\u0441",
url: "URL",
emoji: "\u044D\u043C\u043E\u0434\u0437\u0456",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",
date: "ISO \u0434\u0430\u0442\u0430",
time: "ISO \u0447\u0430\u0441",
duration: "ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",
ipv4: "IPv4 \u0430\u0434\u0440\u0430\u0441",
ipv6: "IPv6 \u0430\u0434\u0440\u0430\u0441",
cidrv4: "IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",
cidrv6: "IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",
base64: "\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",
base64url: "\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",
json_string: "JSON \u0440\u0430\u0434\u043E\u043A",
e164: "\u043D\u0443\u043C\u0430\u0440 E.164",
jwt: "JWT",
template_literal: "\u0443\u0432\u043E\u0434"
};
const TypeDictionary = {
nan: "NaN",
number: "\u043B\u0456\u043A",
array: "\u043C\u0430\u0441\u0456\u045E"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${issue2.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${received}`;
}
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${stringifyPrimitive(issue2.values[0])}`;
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
const maxValue = Number(issue2.maximum);
const unit = getBelarusianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${sizing.verb} ${adj}${issue2.maximum.toString()} ${unit}`;
}
return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
const minValue = Number(issue2.minimum);
const unit = getBelarusianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${sizing.verb} ${adj}${issue2.minimum.toString()} ${unit}`;
}
return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${_issue.pattern}`;
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${issue2.divisor}`;
case "unrecognized_keys":
return `\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${issue2.keys.length > 1 ? "\u043A\u043B\u044E\u0447\u044B" : "\u043A\u043B\u044E\u0447"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${issue2.origin}`;
case "invalid_union":
return "\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";
case "invalid_element":
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${issue2.origin}`;
default:
return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434`;
}
};
};
function be_default() {
return {
localeError: error3()
};
}
// node_modules/zod/v4/locales/bg.js
var error4 = () => {
const Sizable = {
string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
file: { unit: "\u0431\u0430\u0439\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
array: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" },
set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0432\u0445\u043E\u0434",
email: "\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",
url: "URL",
emoji: "\u0435\u043C\u043E\u0434\u0436\u0438",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO \u0432\u0440\u0435\u043C\u0435",
date: "ISO \u0434\u0430\u0442\u0430",
time: "ISO \u0432\u0440\u0435\u043C\u0435",
duration: "ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",
ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441",
ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441",
cidrv4: "IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",
cidrv6: "IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",
base64: "base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",
base64url: "base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",
json_string: "JSON \u043D\u0438\u0437",
e164: "E.164 \u043D\u043E\u043C\u0435\u0440",
jwt: "JWT",
template_literal: "\u0432\u0445\u043E\u0434"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0447\u0438\u0441\u043B\u043E",
array: "\u043C\u0430\u0441\u0438\u0432"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${issue2.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${received}`;
}
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${stringifyPrimitive(issue2.values[0])}`;
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${issue2.origin ?? "\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`;
return `\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${issue2.origin ?? "\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${issue2.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${issue2.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${_issue.pattern}`;
let invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";
if (_issue.format === "emoji")
invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";
if (_issue.format === "datetime")
invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";
if (_issue.format === "date")
invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430";
if (_issue.format === "time")
invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E";
if (_issue.format === "duration")
invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430";
return `${invalid_adj} ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${issue2.divisor}`;
case "unrecognized_keys":
return `\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${issue2.keys.length > 1 ? "\u0438" : ""} \u043A\u043B\u044E\u0447${issue2.keys.length > 1 ? "\u043E\u0432\u0435" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${issue2.origin}`;
case "invalid_union":
return "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";
case "invalid_element":
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${issue2.origin}`;
default:
return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434`;
}
};
};
function bg_default() {
return {
localeError: error4()
};
}
// node_modules/zod/v4/locales/ca.js
var error5 = () => {
const Sizable = {
string: { unit: "car\xE0cters", verb: "contenir" },
file: { unit: "bytes", verb: "contenir" },
array: { unit: "elements", verb: "contenir" },
set: { unit: "elements", verb: "contenir" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "entrada",
email: "adre\xE7a electr\xF2nica",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "data i hora ISO",
date: "data ISO",
time: "hora ISO",
duration: "durada ISO",
ipv4: "adre\xE7a IPv4",
ipv6: "adre\xE7a IPv6",
cidrv4: "rang IPv4",
cidrv6: "rang IPv6",
base64: "cadena codificada en base64",
base64url: "cadena codificada en base64url",
json_string: "cadena JSON",
e164: "n\xFAmero E.164",
jwt: "JWT",
template_literal: "entrada"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Tipus inv\xE0lid: s'esperava instanceof ${issue2.expected}, s'ha rebut ${received}`;
}
return `Tipus inv\xE0lid: s'esperava ${expected}, s'ha rebut ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Valor inv\xE0lid: s'esperava ${stringifyPrimitive(issue2.values[0])}`;
return `Opci\xF3 inv\xE0lida: s'esperava una de ${joinValues(issue2.values, " o ")}`;
case "too_big": {
const adj = issue2.inclusive ? "com a m\xE0xim" : "menys de";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Massa gran: s'esperava que ${issue2.origin ?? "el valor"} contingu\xE9s ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;
return `Massa gran: s'esperava que ${issue2.origin ?? "el valor"} fos ${adj} ${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? "com a m\xEDnim" : "m\xE9s de";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Massa petit: s'esperava que ${issue2.origin} contingu\xE9s ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Massa petit: s'esperava que ${issue2.origin} fos ${adj} ${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Format inv\xE0lid: ha de comen\xE7ar amb "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Format inv\xE0lid: ha d'acabar amb "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Format inv\xE0lid: ha d'incloure "${_issue.includes}"`;
if (_issue.format === "regex")
return `Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${_issue.pattern}`;
return `Format inv\xE0lid per a ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${issue2.divisor}`;
case "unrecognized_keys":
return `Clau${issue2.keys.length > 1 ? "s" : ""} no reconeguda${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Clau inv\xE0lida a ${issue2.origin}`;
case "invalid_union":
return "Entrada inv\xE0lida";
case "invalid_element":
return `Element inv\xE0lid a ${issue2.origin}`;
default:
return `Entrada inv\xE0lida`;
}
};
};
function ca_default() {
return {
localeError: error5()
};
}
// node_modules/zod/v4/locales/cs.js
var error6 = () => {
const Sizable = {
string: { unit: "znak\u016F", verb: "m\xEDt" },
file: { unit: "bajt\u016F", verb: "m\xEDt" },
array: { unit: "prvk\u016F", verb: "m\xEDt" },
set: { unit: "prvk\u016F", verb: "m\xEDt" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "regul\xE1rn\xED v\xFDraz",
email: "e-mailov\xE1 adresa",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "datum a \u010Das ve form\xE1tu ISO",
date: "datum ve form\xE1tu ISO",
time: "\u010Das ve form\xE1tu ISO",
duration: "doba trv\xE1n\xED ISO",
ipv4: "IPv4 adresa",
ipv6: "IPv6 adresa",
cidrv4: "rozsah IPv4",
cidrv6: "rozsah IPv6",
base64: "\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",
base64url: "\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",
json_string: "\u0159et\u011Bzec ve form\xE1tu JSON",
e164: "\u010D\xEDslo E.164",
jwt: "JWT",
template_literal: "vstup"
};
const TypeDictionary = {
nan: "NaN",
number: "\u010D\xEDslo",
string: "\u0159et\u011Bzec",
function: "funkce",
array: "pole"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${issue2.expected}, obdr\u017Eeno ${received}`;
}
return `Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${expected}, obdr\u017Eeno ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${stringifyPrimitive(issue2.values[0])}`;
return `Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${issue2.origin ?? "hodnota"} mus\xED m\xEDt ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "prvk\u016F"}`;
}
return `Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${issue2.origin ?? "hodnota"} mus\xED b\xFDt ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${issue2.origin ?? "hodnota"} mus\xED m\xEDt ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "prvk\u016F"}`;
}
return `Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${issue2.origin ?? "hodnota"} mus\xED b\xFDt ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${_issue.includes}"`;
if (_issue.format === "regex")
return `Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${_issue.pattern}`;
return `Neplatn\xFD form\xE1t ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${issue2.divisor}`;
case "unrecognized_keys":
return `Nezn\xE1m\xE9 kl\xED\u010De: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Neplatn\xFD kl\xED\u010D v ${issue2.origin}`;
case "invalid_union":
return "Neplatn\xFD vstup";
case "invalid_element":
return `Neplatn\xE1 hodnota v ${issue2.origin}`;
default:
return `Neplatn\xFD vstup`;
}
};
};
function cs_default() {
return {
localeError: error6()
};
}
// node_modules/zod/v4/locales/da.js
var error7 = () => {
const Sizable = {
string: { unit: "tegn", verb: "havde" },
file: { unit: "bytes", verb: "havde" },
array: { unit: "elementer", verb: "indeholdt" },
set: { unit: "elementer", verb: "indeholdt" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "e-mailadresse",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO dato- og klokkesl\xE6t",
date: "ISO-dato",
time: "ISO-klokkesl\xE6t",
duration: "ISO-varighed",
ipv4: "IPv4-omr\xE5de",
ipv6: "IPv6-omr\xE5de",
cidrv4: "IPv4-spektrum",
cidrv6: "IPv6-spektrum",
base64: "base64-kodet streng",
base64url: "base64url-kodet streng",
json_string: "JSON-streng",
e164: "E.164-nummer",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN",
string: "streng",
number: "tal",
boolean: "boolean",
array: "liste",
object: "objekt",
set: "s\xE6t",
file: "fil"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ugyldigt input: forventede instanceof ${issue2.expected}, fik ${received}`;
}
return `Ugyldigt input: forventede ${expected}, fik ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ugyldig v\xE6rdi: forventede ${stringifyPrimitive(issue2.values[0])}`;
return `Ugyldigt valg: forventede en af f\xF8lgende ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
if (sizing)
return `For stor: forventede ${origin ?? "value"} ${sizing.verb} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`;
return `For stor: forventede ${origin ?? "value"} havde ${adj} ${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
if (sizing) {
return `For lille: forventede ${origin} ${sizing.verb} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
}
return `For lille: forventede ${origin} havde ${adj} ${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Ugyldig streng: skal starte med "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Ugyldig streng: skal ende med "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Ugyldig streng: skal indeholde "${_issue.includes}"`;
if (_issue.format === "regex")
return `Ugyldig streng: skal matche m\xF8nsteret ${_issue.pattern}`;
return `Ugyldig ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ugyldigt tal: skal v\xE6re deleligt med ${issue2.divisor}`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Ukendte n\xF8gler" : "Ukendt n\xF8gle"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Ugyldig n\xF8gle i ${issue2.origin}`;
case "invalid_union":
return "Ugyldigt input: matcher ingen af de tilladte typer";
case "invalid_element":
return `Ugyldig v\xE6rdi i ${issue2.origin}`;
default:
return `Ugyldigt input`;
}
};
};
function da_default() {
return {
localeError: error7()
};
}
// node_modules/zod/v4/locales/de.js
var error8 = () => {
const Sizable = {
string: { unit: "Zeichen", verb: "zu haben" },
file: { unit: "Bytes", verb: "zu haben" },
array: { unit: "Elemente", verb: "zu haben" },
set: { unit: "Elemente", verb: "zu haben" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "Eingabe",
email: "E-Mail-Adresse",
url: "URL",
emoji: "Emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO-Datum und -Uhrzeit",
date: "ISO-Datum",
time: "ISO-Uhrzeit",
duration: "ISO-Dauer",
ipv4: "IPv4-Adresse",
ipv6: "IPv6-Adresse",
cidrv4: "IPv4-Bereich",
cidrv6: "IPv6-Bereich",
base64: "Base64-codierter String",
base64url: "Base64-URL-codierter String",
json_string: "JSON-String",
e164: "E.164-Nummer",
jwt: "JWT",
template_literal: "Eingabe"
};
const TypeDictionary = {
nan: "NaN",
number: "Zahl",
array: "Array"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ung\xFCltige Eingabe: erwartet instanceof ${issue2.expected}, erhalten ${received}`;
}
return `Ung\xFCltige Eingabe: erwartet ${expected}, erhalten ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ung\xFCltige Eingabe: erwartet ${stringifyPrimitive(issue2.values[0])}`;
return `Ung\xFCltige Option: erwartet eine von ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Zu gro\xDF: erwartet, dass ${issue2.origin ?? "Wert"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "Elemente"} hat`;
return `Zu gro\xDF: erwartet, dass ${issue2.origin ?? "Wert"} ${adj}${issue2.maximum.toString()} ist`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Zu klein: erwartet, dass ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} hat`;
}
return `Zu klein: erwartet, dass ${issue2.origin} ${adj}${issue2.minimum.toString()} ist`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Ung\xFCltiger String: muss mit "${_issue.prefix}" beginnen`;
if (_issue.format === "ends_with")
return `Ung\xFCltiger String: muss mit "${_issue.suffix}" enden`;
if (_issue.format === "includes")
return `Ung\xFCltiger String: muss "${_issue.includes}" enthalten`;
if (_issue.format === "regex")
return `Ung\xFCltiger String: muss dem Muster ${_issue.pattern} entsprechen`;
return `Ung\xFCltig: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ung\xFCltige Zahl: muss ein Vielfaches von ${issue2.divisor} sein`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Unbekannte Schl\xFCssel" : "Unbekannter Schl\xFCssel"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Ung\xFCltiger Schl\xFCssel in ${issue2.origin}`;
case "invalid_union":
return "Ung\xFCltige Eingabe";
case "invalid_element":
return `Ung\xFCltiger Wert in ${issue2.origin}`;
default:
return `Ung\xFCltige Eingabe`;
}
};
};
function de_default() {
return {
localeError: error8()
};
}
// node_modules/zod/v4/locales/en.js
var error9 = () => {
const Sizable = {
string: { unit: "characters", verb: "to have" },
file: { unit: "bytes", verb: "to have" },
array: { unit: "items", verb: "to have" },
set: { unit: "items", verb: "to have" },
map: { unit: "entries", verb: "to have" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "email address",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datetime",
date: "ISO date",
time: "ISO time",
duration: "ISO duration",
ipv4: "IPv4 address",
ipv6: "IPv6 address",
mac: "MAC address",
cidrv4: "IPv4 range",
cidrv6: "IPv6 range",
base64: "base64-encoded string",
base64url: "base64url-encoded string",
json_string: "JSON string",
e164: "E.164 number",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
return `Invalid input: expected ${expected}, received ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;
return `Invalid option: expected one of ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Too big: expected ${issue2.origin ?? "value"} to have ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;
return `Too big: expected ${issue2.origin ?? "value"} to be ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Too small: expected ${issue2.origin} to have ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Too small: expected ${issue2.origin} to be ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Invalid string: must start with "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Invalid string: must end with "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Invalid string: must include "${_issue.includes}"`;
if (_issue.format === "regex")
return `Invalid string: must match pattern ${_issue.pattern}`;
return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Invalid number: must be a multiple of ${issue2.divisor}`;
case "unrecognized_keys":
return `Unrecognized key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Invalid key in ${issue2.origin}`;
case "invalid_union":
return "Invalid input";
case "invalid_element":
return `Invalid value in ${issue2.origin}`;
default:
return `Invalid input`;
}
};
};
function en_default() {
return {
localeError: error9()
};
}
// node_modules/zod/v4/locales/eo.js
var error10 = () => {
const Sizable = {
string: { unit: "karaktrojn", verb: "havi" },
file: { unit: "bajtojn", verb: "havi" },
array: { unit: "elementojn", verb: "havi" },
set: { unit: "elementojn", verb: "havi" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "enigo",
email: "retadreso",
url: "URL",
emoji: "emo\u011Dio",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO-datotempo",
date: "ISO-dato",
time: "ISO-tempo",
duration: "ISO-da\u016Dro",
ipv4: "IPv4-adreso",
ipv6: "IPv6-adreso",
cidrv4: "IPv4-rango",
cidrv6: "IPv6-rango",
base64: "64-ume kodita karaktraro",
base64url: "URL-64-ume kodita karaktraro",
json_string: "JSON-karaktraro",
e164: "E.164-nombro",
jwt: "JWT",
template_literal: "enigo"
};
const TypeDictionary = {
nan: "NaN",
number: "nombro",
array: "tabelo",
null: "senvalora"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Nevalida enigo: atendi\u011Dis instanceof ${issue2.expected}, ricevi\u011Dis ${received}`;
}
return `Nevalida enigo: atendi\u011Dis ${expected}, ricevi\u011Dis ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Nevalida enigo: atendi\u011Dis ${stringifyPrimitive(issue2.values[0])}`;
return `Nevalida opcio: atendi\u011Dis unu el ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Tro granda: atendi\u011Dis ke ${issue2.origin ?? "valoro"} havu ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementojn"}`;
return `Tro granda: atendi\u011Dis ke ${issue2.origin ?? "valoro"} havu ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Tro malgranda: atendi\u011Dis ke ${issue2.origin} havu ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Tro malgranda: atendi\u011Dis ke ${issue2.origin} estu ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Nevalida karaktraro: devas komenci\u011Di per "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Nevalida karaktraro: devas fini\u011Di per "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Nevalida karaktraro: devas inkluzivi "${_issue.includes}"`;
if (_issue.format === "regex")
return `Nevalida karaktraro: devas kongrui kun la modelo ${_issue.pattern}`;
return `Nevalida ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Nevalida nombro: devas esti oblo de ${issue2.divisor}`;
case "unrecognized_keys":
return `Nekonata${issue2.keys.length > 1 ? "j" : ""} \u015Dlosilo${issue2.keys.length > 1 ? "j" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Nevalida \u015Dlosilo en ${issue2.origin}`;
case "invalid_union":
return "Nevalida enigo";
case "invalid_element":
return `Nevalida valoro en ${issue2.origin}`;
default:
return `Nevalida enigo`;
}
};
};
function eo_default() {
return {
localeError: error10()
};
}
// node_modules/zod/v4/locales/es.js
var error11 = () => {
const Sizable = {
string: { unit: "caracteres", verb: "tener" },
file: { unit: "bytes", verb: "tener" },
array: { unit: "elementos", verb: "tener" },
set: { unit: "elementos", verb: "tener" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "entrada",
email: "direcci\xF3n de correo electr\xF3nico",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "fecha y hora ISO",
date: "fecha ISO",
time: "hora ISO",
duration: "duraci\xF3n ISO",
ipv4: "direcci\xF3n IPv4",
ipv6: "direcci\xF3n IPv6",
cidrv4: "rango IPv4",
cidrv6: "rango IPv6",
base64: "cadena codificada en base64",
base64url: "URL codificada en base64",
json_string: "cadena JSON",
e164: "n\xFAmero E.164",
jwt: "JWT",
template_literal: "entrada"
};
const TypeDictionary = {
nan: "NaN",
string: "texto",
number: "n\xFAmero",
boolean: "booleano",
array: "arreglo",
object: "objeto",
set: "conjunto",
file: "archivo",
date: "fecha",
bigint: "n\xFAmero grande",
symbol: "s\xEDmbolo",
undefined: "indefinido",
null: "nulo",
function: "funci\xF3n",
map: "mapa",
record: "registro",
tuple: "tupla",
enum: "enumeraci\xF3n",
union: "uni\xF3n",
literal: "literal",
promise: "promesa",
void: "vac\xEDo",
never: "nunca",
unknown: "desconocido",
any: "cualquiera"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Entrada inv\xE1lida: se esperaba instanceof ${issue2.expected}, recibido ${received}`;
}
return `Entrada inv\xE1lida: se esperaba ${expected}, recibido ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Entrada inv\xE1lida: se esperaba ${stringifyPrimitive(issue2.values[0])}`;
return `Opci\xF3n inv\xE1lida: se esperaba una de ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
if (sizing)
return `Demasiado grande: se esperaba que ${origin ?? "valor"} tuviera ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`;
return `Demasiado grande: se esperaba que ${origin ?? "valor"} fuera ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
if (sizing) {
return `Demasiado peque\xF1o: se esperaba que ${origin} tuviera ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Demasiado peque\xF1o: se esperaba que ${origin} fuera ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Cadena inv\xE1lida: debe comenzar con "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Cadena inv\xE1lida: debe terminar en "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Cadena inv\xE1lida: debe incluir "${_issue.includes}"`;
if (_issue.format === "regex")
return `Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${_issue.pattern}`;
return `Inv\xE1lido ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${issue2.divisor}`;
case "unrecognized_keys":
return `Llave${issue2.keys.length > 1 ? "s" : ""} desconocida${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Llave inv\xE1lida en ${TypeDictionary[issue2.origin] ?? issue2.origin}`;
case "invalid_union":
return "Entrada inv\xE1lida";
case "invalid_element":
return `Valor inv\xE1lido en ${TypeDictionary[issue2.origin] ?? issue2.origin}`;
default:
return `Entrada inv\xE1lida`;
}
};
};
function es_default() {
return {
localeError: error11()
};
}
// node_modules/zod/v4/locales/fa.js
var error12 = () => {
const Sizable = {
string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
file: { unit: "\u0628\u0627\u06CC\u062A", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
array: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
set: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0648\u0631\u0648\u062F\u06CC",
email: "\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",
url: "URL",
emoji: "\u0627\u06CC\u0645\u0648\u062C\u06CC",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",
date: "\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",
time: "\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",
duration: "\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",
ipv4: "IPv4 \u0622\u062F\u0631\u0633",
ipv6: "IPv6 \u0622\u062F\u0631\u0633",
cidrv4: "IPv4 \u062F\u0627\u0645\u0646\u0647",
cidrv6: "IPv6 \u062F\u0627\u0645\u0646\u0647",
base64: "base64-encoded \u0631\u0634\u062A\u0647",
base64url: "base64url-encoded \u0631\u0634\u062A\u0647",
json_string: "JSON \u0631\u0634\u062A\u0647",
e164: "E.164 \u0639\u062F\u062F",
jwt: "JWT",
template_literal: "\u0648\u0631\u0648\u062F\u06CC"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0639\u062F\u062F",
array: "\u0622\u0631\u0627\u06CC\u0647"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${issue2.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${received} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;
}
return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${received} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`;
}
case "invalid_value":
if (issue2.values.length === 1) {
return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${stringifyPrimitive(issue2.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`;
}
return `\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${joinValues(issue2.values, "|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${issue2.origin ?? "\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`;
}
return `\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${issue2.origin ?? "\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} \u0628\u0627\u0634\u062F`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0628\u0627\u0634\u062F`;
}
return `\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} \u0628\u0627\u0634\u062F`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${_issue.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`;
}
if (_issue.format === "ends_with") {
return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${_issue.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`;
}
if (_issue.format === "includes") {
return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${_issue.includes}" \u0628\u0627\u0634\u062F`;
}
if (_issue.format === "regex") {
return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${_issue.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`;
}
return `${FormatDictionary[_issue.format] ?? issue2.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`;
}
case "not_multiple_of":
return `\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${issue2.divisor} \u0628\u0627\u0634\u062F`;
case "unrecognized_keys":
return `\u06A9\u0644\u06CC\u062F${issue2.keys.length > 1 ? "\u0647\u0627\u06CC" : ""} \u0646\u0627\u0634\u0646\u0627\u0633: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${issue2.origin}`;
case "invalid_union":
return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631`;
case "invalid_element":
return `\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${issue2.origin}`;
default:
return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631`;
}
};
};
function fa_default() {
return {
localeError: error12()
};
}
// node_modules/zod/v4/locales/fi.js
var error13 = () => {
const Sizable = {
string: { unit: "merkki\xE4", subject: "merkkijonon" },
file: { unit: "tavua", subject: "tiedoston" },
array: { unit: "alkiota", subject: "listan" },
set: { unit: "alkiota", subject: "joukon" },
number: { unit: "", subject: "luvun" },
bigint: { unit: "", subject: "suuren kokonaisluvun" },
int: { unit: "", subject: "kokonaisluvun" },
date: { unit: "", subject: "p\xE4iv\xE4m\xE4\xE4r\xE4n" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "s\xE4\xE4nn\xF6llinen lauseke",
email: "s\xE4hk\xF6postiosoite",
url: "URL-osoite",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO-aikaleima",
date: "ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",
time: "ISO-aika",
duration: "ISO-kesto",
ipv4: "IPv4-osoite",
ipv6: "IPv6-osoite",
cidrv4: "IPv4-alue",
cidrv6: "IPv6-alue",
base64: "base64-koodattu merkkijono",
base64url: "base64url-koodattu merkkijono",
json_string: "JSON-merkkijono",
e164: "E.164-luku",
jwt: "JWT",
template_literal: "templaattimerkkijono"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Virheellinen tyyppi: odotettiin instanceof ${issue2.expected}, oli ${received}`;
}
return `Virheellinen tyyppi: odotettiin ${expected}, oli ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Virheellinen sy\xF6te: t\xE4ytyy olla ${stringifyPrimitive(issue2.values[0])}`;
return `Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Liian suuri: ${sizing.subject} t\xE4ytyy olla ${adj}${issue2.maximum.toString()} ${sizing.unit}`.trim();
}
return `Liian suuri: arvon t\xE4ytyy olla ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Liian pieni: ${sizing.subject} t\xE4ytyy olla ${adj}${issue2.minimum.toString()} ${sizing.unit}`.trim();
}
return `Liian pieni: arvon t\xE4ytyy olla ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Virheellinen sy\xF6te: t\xE4ytyy alkaa "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Virheellinen sy\xF6te: t\xE4ytyy loppua "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${_issue.includes}"`;
if (_issue.format === "regex") {
return `Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${_issue.pattern}`;
}
return `Virheellinen ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Virheellinen luku: t\xE4ytyy olla luvun ${issue2.divisor} monikerta`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return "Virheellinen avain tietueessa";
case "invalid_union":
return "Virheellinen unioni";
case "invalid_element":
return "Virheellinen arvo joukossa";
default:
return `Virheellinen sy\xF6te`;
}
};
};
function fi_default() {
return {
localeError: error13()
};
}
// node_modules/zod/v4/locales/fr.js
var error14 = () => {
const Sizable = {
string: { unit: "caract\xE8res", verb: "avoir" },
file: { unit: "octets", verb: "avoir" },
array: { unit: "\xE9l\xE9ments", verb: "avoir" },
set: { unit: "\xE9l\xE9ments", verb: "avoir" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "entr\xE9e",
email: "adresse e-mail",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "date et heure ISO",
date: "date ISO",
time: "heure ISO",
duration: "dur\xE9e ISO",
ipv4: "adresse IPv4",
ipv6: "adresse IPv6",
cidrv4: "plage IPv4",
cidrv6: "plage IPv6",
base64: "cha\xEEne encod\xE9e en base64",
base64url: "cha\xEEne encod\xE9e en base64url",
json_string: "cha\xEEne JSON",
e164: "num\xE9ro E.164",
jwt: "JWT",
template_literal: "entr\xE9e"
};
const TypeDictionary = {
nan: "NaN",
number: "nombre",
array: "tableau"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Entr\xE9e invalide : instanceof ${issue2.expected} attendu, ${received} re\xE7u`;
}
return `Entr\xE9e invalide : ${expected} attendu, ${received} re\xE7u`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Entr\xE9e invalide : ${stringifyPrimitive(issue2.values[0])} attendu`;
return `Option invalide : une valeur parmi ${joinValues(issue2.values, "|")} attendue`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Trop grand : ${issue2.origin ?? "valeur"} doit ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\xE9l\xE9ment(s)"}`;
return `Trop grand : ${issue2.origin ?? "valeur"} doit \xEAtre ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Trop petit : ${issue2.origin} doit ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Trop petit : ${issue2.origin} doit \xEAtre ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Cha\xEEne invalide : doit commencer par "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Cha\xEEne invalide : doit se terminer par "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Cha\xEEne invalide : doit inclure "${_issue.includes}"`;
if (_issue.format === "regex")
return `Cha\xEEne invalide : doit correspondre au mod\xE8le ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} invalide`;
}
case "not_multiple_of":
return `Nombre invalide : doit \xEAtre un multiple de ${issue2.divisor}`;
case "unrecognized_keys":
return `Cl\xE9${issue2.keys.length > 1 ? "s" : ""} non reconnue${issue2.keys.length > 1 ? "s" : ""} : ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Cl\xE9 invalide dans ${issue2.origin}`;
case "invalid_union":
return "Entr\xE9e invalide";
case "invalid_element":
return `Valeur invalide dans ${issue2.origin}`;
default:
return `Entr\xE9e invalide`;
}
};
};
function fr_default() {
return {
localeError: error14()
};
}
// node_modules/zod/v4/locales/fr-CA.js
var error15 = () => {
const Sizable = {
string: { unit: "caract\xE8res", verb: "avoir" },
file: { unit: "octets", verb: "avoir" },
array: { unit: "\xE9l\xE9ments", verb: "avoir" },
set: { unit: "\xE9l\xE9ments", verb: "avoir" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "entr\xE9e",
email: "adresse courriel",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "date-heure ISO",
date: "date ISO",
time: "heure ISO",
duration: "dur\xE9e ISO",
ipv4: "adresse IPv4",
ipv6: "adresse IPv6",
cidrv4: "plage IPv4",
cidrv6: "plage IPv6",
base64: "cha\xEEne encod\xE9e en base64",
base64url: "cha\xEEne encod\xE9e en base64url",
json_string: "cha\xEEne JSON",
e164: "num\xE9ro E.164",
jwt: "JWT",
template_literal: "entr\xE9e"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Entr\xE9e invalide : attendu instanceof ${issue2.expected}, re\xE7u ${received}`;
}
return `Entr\xE9e invalide : attendu ${expected}, re\xE7u ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Entr\xE9e invalide : attendu ${stringifyPrimitive(issue2.values[0])}`;
return `Option invalide : attendu l'une des valeurs suivantes ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "\u2264" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Trop grand : attendu que ${issue2.origin ?? "la valeur"} ait ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
return `Trop grand : attendu que ${issue2.origin ?? "la valeur"} soit ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? "\u2265" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Trop petit : attendu que ${issue2.origin} ait ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Trop petit : attendu que ${issue2.origin} soit ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Cha\xEEne invalide : doit commencer par "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Cha\xEEne invalide : doit se terminer par "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Cha\xEEne invalide : doit inclure "${_issue.includes}"`;
if (_issue.format === "regex")
return `Cha\xEEne invalide : doit correspondre au motif ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} invalide`;
}
case "not_multiple_of":
return `Nombre invalide : doit \xEAtre un multiple de ${issue2.divisor}`;
case "unrecognized_keys":
return `Cl\xE9${issue2.keys.length > 1 ? "s" : ""} non reconnue${issue2.keys.length > 1 ? "s" : ""} : ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Cl\xE9 invalide dans ${issue2.origin}`;
case "invalid_union":
return "Entr\xE9e invalide";
case "invalid_element":
return `Valeur invalide dans ${issue2.origin}`;
default:
return `Entr\xE9e invalide`;
}
};
};
function fr_CA_default() {
return {
localeError: error15()
};
}
// node_modules/zod/v4/locales/he.js
var error16 = () => {
const TypeNames = {
string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" },
number: { label: "\u05DE\u05E1\u05E4\u05E8", gender: "m" },
boolean: { label: "\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9", gender: "m" },
bigint: { label: "BigInt", gender: "m" },
date: { label: "\u05EA\u05D0\u05E8\u05D9\u05DA", gender: "m" },
array: { label: "\u05DE\u05E2\u05E8\u05DA", gender: "m" },
object: { label: "\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8", gender: "m" },
null: { label: "\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)", gender: "m" },
undefined: { label: "\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)", gender: "m" },
symbol: { label: "\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)", gender: "m" },
function: { label: "\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4", gender: "f" },
map: { label: "\u05DE\u05E4\u05D4 (Map)", gender: "f" },
set: { label: "\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)", gender: "f" },
file: { label: "\u05E7\u05D5\u05D1\u05E5", gender: "m" },
promise: { label: "Promise", gender: "m" },
NaN: { label: "NaN", gender: "m" },
unknown: { label: "\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2", gender: "m" },
value: { label: "\u05E2\u05E8\u05DA", gender: "m" }
};
const Sizable = {
string: { unit: "\u05EA\u05D5\u05D5\u05D9\u05DD", shortLabel: "\u05E7\u05E6\u05E8", longLabel: "\u05D0\u05E8\u05D5\u05DA" },
file: { unit: "\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" },
array: { unit: "\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" },
set: { unit: "\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" },
number: { unit: "", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" }
};
const typeEntry = (t) => t ? TypeNames[t] : undefined;
const typeLabel = (t) => {
const e2 = typeEntry(t);
if (e2)
return e2.label;
return t ?? TypeNames.unknown.label;
};
const withDefinite = (t) => `\u05D4${typeLabel(t)}`;
const verbFor = (t) => {
const e2 = typeEntry(t);
const gender = e2?.gender ?? "m";
return gender === "f" ? "\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA" : "\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA";
};
const getSizing = (origin) => {
if (!origin)
return null;
return Sizable[origin] ?? null;
};
const FormatDictionary = {
regex: { label: "\u05E7\u05DC\u05D8", gender: "m" },
email: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC", gender: "f" },
url: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA", gender: "f" },
emoji: { label: "\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9", gender: "m" },
uuid: { label: "UUID", gender: "m" },
nanoid: { label: "nanoid", gender: "m" },
guid: { label: "GUID", gender: "m" },
cuid: { label: "cuid", gender: "m" },
cuid2: { label: "cuid2", gender: "m" },
ulid: { label: "ULID", gender: "m" },
xid: { label: "XID", gender: "m" },
ksuid: { label: "KSUID", gender: "m" },
datetime: { label: "\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO", gender: "m" },
date: { label: "\u05EA\u05D0\u05E8\u05D9\u05DA ISO", gender: "m" },
time: { label: "\u05D6\u05DE\u05DF ISO", gender: "m" },
duration: { label: "\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO", gender: "m" },
ipv4: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA IPv4", gender: "f" },
ipv6: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA IPv6", gender: "f" },
cidrv4: { label: "\u05D8\u05D5\u05D5\u05D7 IPv4", gender: "m" },
cidrv6: { label: "\u05D8\u05D5\u05D5\u05D7 IPv6", gender: "m" },
base64: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64", gender: "f" },
base64url: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA", gender: "f" },
json_string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON", gender: "f" },
e164: { label: "\u05DE\u05E1\u05E4\u05E8 E.164", gender: "m" },
jwt: { label: "JWT", gender: "m" },
ends_with: { label: "\u05E7\u05DC\u05D8", gender: "m" },
includes: { label: "\u05E7\u05DC\u05D8", gender: "m" },
lowercase: { label: "\u05E7\u05DC\u05D8", gender: "m" },
starts_with: { label: "\u05E7\u05DC\u05D8", gender: "m" },
uppercase: { label: "\u05E7\u05DC\u05D8", gender: "m" }
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expectedKey = issue2.expected;
const expected = TypeDictionary[expectedKey ?? ""] ?? typeLabel(expectedKey);
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? TypeNames[receivedType]?.label ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${issue2.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${received}`;
}
return `\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${received}`;
}
case "invalid_value": {
if (issue2.values.length === 1) {
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${stringifyPrimitive(issue2.values[0])}`;
}
const stringified = issue2.values.map((v) => stringifyPrimitive(v));
if (issue2.values.length === 2) {
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${stringified[0]} \u05D0\u05D5 ${stringified[1]}`;
}
const lastValue = stringified[stringified.length - 1];
const restValues = stringified.slice(0, -1).join(", ");
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${restValues} \u05D0\u05D5 ${lastValue}`;
}
case "too_big": {
const sizing = getSizing(issue2.origin);
const subject = withDefinite(issue2.origin ?? "value");
if (issue2.origin === "string") {
return `${sizing?.longLabel ?? "\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${issue2.maximum.toString()} ${sizing?.unit ?? ""} ${issue2.inclusive ? "\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA" : "\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();
}
if (issue2.origin === "number") {
const comparison = issue2.inclusive ? `\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${issue2.maximum}` : `\u05E7\u05D8\u05DF \u05DE-${issue2.maximum}`;
return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${comparison}`;
}
if (issue2.origin === "array" || issue2.origin === "set") {
const verb = issue2.origin === "set" ? "\u05E6\u05E8\u05D9\u05DB\u05D4" : "\u05E6\u05E8\u05D9\u05DA";
const comparison = issue2.inclusive ? `${issue2.maximum} ${sizing?.unit ?? ""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA` : `\u05E4\u05D7\u05D5\u05EA \u05DE-${issue2.maximum} ${sizing?.unit ?? ""}`;
return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim();
}
const adj = issue2.inclusive ? "<=" : "<";
const be = verbFor(issue2.origin ?? "value");
if (sizing?.unit) {
return `${sizing.longLabel} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
}
return `${sizing?.longLabel ?? "\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const sizing = getSizing(issue2.origin);
const subject = withDefinite(issue2.origin ?? "value");
if (issue2.origin === "string") {
return `${sizing?.shortLabel ?? "\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${issue2.minimum.toString()} ${sizing?.unit ?? ""} ${issue2.inclusive ? "\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8" : "\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();
}
if (issue2.origin === "number") {
const comparison = issue2.inclusive ? `\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${issue2.minimum}` : `\u05D2\u05D3\u05D5\u05DC \u05DE-${issue2.minimum}`;
return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${comparison}`;
}
if (issue2.origin === "array" || issue2.origin === "set") {
const verb = issue2.origin === "set" ? "\u05E6\u05E8\u05D9\u05DB\u05D4" : "\u05E6\u05E8\u05D9\u05DA";
if (issue2.minimum === 1 && issue2.inclusive) {
const singularPhrase = issue2.origin === "set" ? "\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3" : "\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3";
return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${singularPhrase}`;
}
const comparison = issue2.inclusive ? `${issue2.minimum} ${sizing?.unit ?? ""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8` : `\u05D9\u05D5\u05EA\u05E8 \u05DE-${issue2.minimum} ${sizing?.unit ?? ""}`;
return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim();
}
const adj = issue2.inclusive ? ">=" : ">";
const be = verbFor(issue2.origin ?? "value");
if (sizing?.unit) {
return `${sizing.shortLabel} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `${sizing?.shortLabel ?? "\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${_issue.pattern}`;
const nounEntry = FormatDictionary[_issue.format];
const noun = nounEntry?.label ?? _issue.format;
const gender = nounEntry?.gender ?? "m";
const adjective = gender === "f" ? "\u05EA\u05E7\u05D9\u05E0\u05D4" : "\u05EA\u05E7\u05D9\u05DF";
return `${noun} \u05DC\u05D0 ${adjective}`;
}
case "not_multiple_of":
return `\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${issue2.divisor}`;
case "unrecognized_keys":
return `\u05DE\u05E4\u05EA\u05D7${issue2.keys.length > 1 ? "\u05D5\u05EA" : ""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${issue2.keys.length > 1 ? "\u05D9\u05DD" : "\u05D4"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key": {
return `\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8`;
}
case "invalid_union":
return "\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";
case "invalid_element": {
const place = withDefinite(issue2.origin ?? "array");
return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${place}`;
}
default:
return `\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`;
}
};
};
function he_default() {
return {
localeError: error16()
};
}
// node_modules/zod/v4/locales/hu.js
var error17 = () => {
const Sizable = {
string: { unit: "karakter", verb: "legyen" },
file: { unit: "byte", verb: "legyen" },
array: { unit: "elem", verb: "legyen" },
set: { unit: "elem", verb: "legyen" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "bemenet",
email: "email c\xEDm",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO id\u0151b\xE9lyeg",
date: "ISO d\xE1tum",
time: "ISO id\u0151",
duration: "ISO id\u0151intervallum",
ipv4: "IPv4 c\xEDm",
ipv6: "IPv6 c\xEDm",
cidrv4: "IPv4 tartom\xE1ny",
cidrv6: "IPv6 tartom\xE1ny",
base64: "base64-k\xF3dolt string",
base64url: "base64url-k\xF3dolt string",
json_string: "JSON string",
e164: "E.164 sz\xE1m",
jwt: "JWT",
template_literal: "bemenet"
};
const TypeDictionary = {
nan: "NaN",
number: "sz\xE1m",
array: "t\xF6mb"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${issue2.expected}, a kapott \xE9rt\xE9k ${received}`;
}
return `\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${expected}, a kapott \xE9rt\xE9k ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${stringifyPrimitive(issue2.values[0])}`;
return `\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `T\xFAl nagy: ${issue2.origin ?? "\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elem"}`;
return `T\xFAl nagy: a bemeneti \xE9rt\xE9k ${issue2.origin ?? "\xE9rt\xE9k"} t\xFAl nagy: ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${issue2.origin} m\xE9rete t\xFAl kicsi ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${issue2.origin} t\xFAl kicsi ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\xC9rv\xE9nytelen string: "${_issue.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`;
if (_issue.format === "ends_with")
return `\xC9rv\xE9nytelen string: "${_issue.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`;
if (_issue.format === "includes")
return `\xC9rv\xE9nytelen string: "${_issue.includes}" \xE9rt\xE9ket kell tartalmaznia`;
if (_issue.format === "regex")
return `\xC9rv\xE9nytelen string: ${_issue.pattern} mint\xE1nak kell megfelelnie`;
return `\xC9rv\xE9nytelen ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\xC9rv\xE9nytelen sz\xE1m: ${issue2.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;
case "unrecognized_keys":
return `Ismeretlen kulcs${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\xC9rv\xE9nytelen kulcs ${issue2.origin}`;
case "invalid_union":
return "\xC9rv\xE9nytelen bemenet";
case "invalid_element":
return `\xC9rv\xE9nytelen \xE9rt\xE9k: ${issue2.origin}`;
default:
return `\xC9rv\xE9nytelen bemenet`;
}
};
};
function hu_default() {
return {
localeError: error17()
};
}
// node_modules/zod/v4/locales/hy.js
function getArmenianPlural(count, one, many) {
return Math.abs(count) === 1 ? one : many;
}
function withDefiniteArticle(word) {
if (!word)
return "";
const vowels = ["\u0561", "\u0565", "\u0568", "\u056B", "\u0578", "\u0578\u0582", "\u0585"];
const lastChar = word[word.length - 1];
return word + (vowels.includes(lastChar) ? "\u0576" : "\u0568");
}
var error18 = () => {
const Sizable = {
string: {
unit: {
one: "\u0576\u0577\u0561\u0576",
many: "\u0576\u0577\u0561\u0576\u0576\u0565\u0580"
},
verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C"
},
file: {
unit: {
one: "\u0562\u0561\u0575\u0569",
many: "\u0562\u0561\u0575\u0569\u0565\u0580"
},
verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C"
},
array: {
unit: {
one: "\u057F\u0561\u0580\u0580",
many: "\u057F\u0561\u0580\u0580\u0565\u0580"
},
verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C"
},
set: {
unit: {
one: "\u057F\u0561\u0580\u0580",
many: "\u057F\u0561\u0580\u0580\u0565\u0580"
},
verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C"
}
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0574\u0578\u0582\u057F\u0584",
email: "\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",
url: "URL",
emoji: "\u0567\u0574\u0578\u057B\u056B",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",
date: "ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",
time: "ISO \u056A\u0561\u0574",
duration: "ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",
ipv4: "IPv4 \u0570\u0561\u057D\u0581\u0565",
ipv6: "IPv6 \u0570\u0561\u057D\u0581\u0565",
cidrv4: "IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",
cidrv6: "IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",
base64: "base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",
base64url: "base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",
json_string: "JSON \u057F\u0578\u0572",
e164: "E.164 \u0570\u0561\u0574\u0561\u0580",
jwt: "JWT",
template_literal: "\u0574\u0578\u0582\u057F\u0584"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0569\u056B\u057E",
array: "\u0566\u0561\u0576\u0563\u057E\u0561\u056E"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${issue2.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${received}`;
}
return `\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${stringifyPrimitive(issue2.values[1])}`;
return `\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
const maxValue = Number(issue2.maximum);
const unit = getArmenianPlural(maxValue, sizing.unit.one, sizing.unit.many);
return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin ?? "\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${adj}${issue2.maximum.toString()} ${unit}`;
}
return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin ?? "\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
const minValue = Number(issue2.minimum);
const unit = getArmenianPlural(minValue, sizing.unit.one, sizing.unit.many);
return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${adj}${issue2.minimum.toString()} ${unit}`;
}
return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin)} \u056C\u056B\u0576\u056B ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${_issue.prefix}"-\u0578\u057E`;
if (_issue.format === "ends_with")
return `\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${_issue.suffix}"-\u0578\u057E`;
if (_issue.format === "includes")
return `\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${_issue.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`;
return `\u054D\u056D\u0561\u056C ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${issue2.divisor}-\u056B`;
case "unrecognized_keys":
return `\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${issue2.keys.length > 1 ? "\u0576\u0565\u0580" : ""}. ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${withDefiniteArticle(issue2.origin)}-\u0578\u0582\u0574`;
case "invalid_union":
return "\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";
case "invalid_element":
return `\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${withDefiniteArticle(issue2.origin)}-\u0578\u0582\u0574`;
default:
return `\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574`;
}
};
};
function hy_default() {
return {
localeError: error18()
};
}
// node_modules/zod/v4/locales/id.js
var error19 = () => {
const Sizable = {
string: { unit: "karakter", verb: "memiliki" },
file: { unit: "byte", verb: "memiliki" },
array: { unit: "item", verb: "memiliki" },
set: { unit: "item", verb: "memiliki" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "alamat email",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "tanggal dan waktu format ISO",
date: "tanggal format ISO",
time: "jam format ISO",
duration: "durasi format ISO",
ipv4: "alamat IPv4",
ipv6: "alamat IPv6",
cidrv4: "rentang alamat IPv4",
cidrv6: "rentang alamat IPv6",
base64: "string dengan enkode base64",
base64url: "string dengan enkode base64url",
json_string: "string JSON",
e164: "angka E.164",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Input tidak valid: diharapkan instanceof ${issue2.expected}, diterima ${received}`;
}
return `Input tidak valid: diharapkan ${expected}, diterima ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Input tidak valid: diharapkan ${stringifyPrimitive(issue2.values[0])}`;
return `Pilihan tidak valid: diharapkan salah satu dari ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Terlalu besar: diharapkan ${issue2.origin ?? "value"} memiliki ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemen"}`;
return `Terlalu besar: diharapkan ${issue2.origin ?? "value"} menjadi ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Terlalu kecil: diharapkan ${issue2.origin} memiliki ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Terlalu kecil: diharapkan ${issue2.origin} menjadi ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `String tidak valid: harus dimulai dengan "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `String tidak valid: harus berakhir dengan "${_issue.suffix}"`;
if (_issue.format === "includes")
return `String tidak valid: harus menyertakan "${_issue.includes}"`;
if (_issue.format === "regex")
return `String tidak valid: harus sesuai pola ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} tidak valid`;
}
case "not_multiple_of":
return `Angka tidak valid: harus kelipatan dari ${issue2.divisor}`;
case "unrecognized_keys":
return `Kunci tidak dikenali ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Kunci tidak valid di ${issue2.origin}`;
case "invalid_union":
return "Input tidak valid";
case "invalid_element":
return `Nilai tidak valid di ${issue2.origin}`;
default:
return `Input tidak valid`;
}
};
};
function id_default() {
return {
localeError: error19()
};
}
// node_modules/zod/v4/locales/is.js
var error20 = () => {
const Sizable = {
string: { unit: "stafi", verb: "a\xF0 hafa" },
file: { unit: "b\xE6ti", verb: "a\xF0 hafa" },
array: { unit: "hluti", verb: "a\xF0 hafa" },
set: { unit: "hluti", verb: "a\xF0 hafa" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "gildi",
email: "netfang",
url: "vefsl\xF3\xF0",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO dagsetning og t\xEDmi",
date: "ISO dagsetning",
time: "ISO t\xEDmi",
duration: "ISO t\xEDmalengd",
ipv4: "IPv4 address",
ipv6: "IPv6 address",
cidrv4: "IPv4 range",
cidrv6: "IPv6 range",
base64: "base64-encoded strengur",
base64url: "base64url-encoded strengur",
json_string: "JSON strengur",
e164: "E.164 t\xF6lugildi",
jwt: "JWT",
template_literal: "gildi"
};
const TypeDictionary = {
nan: "NaN",
number: "n\xFAmer",
array: "fylki"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Rangt gildi: \xDE\xFA sl\xF3st inn ${received} \xFEar sem \xE1 a\xF0 vera instanceof ${issue2.expected}`;
}
return `Rangt gildi: \xDE\xFA sl\xF3st inn ${received} \xFEar sem \xE1 a\xF0 vera ${expected}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Rangt gildi: gert r\xE1\xF0 fyrir ${stringifyPrimitive(issue2.values[0])}`;
return `\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin ?? "gildi"} hafi ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "hluti"}`;
return `Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin ?? "gildi"} s\xE9 ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin} hafi ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin} s\xE9 ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${_issue.includes}"`;
if (_issue.format === "regex")
return `\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${_issue.pattern}`;
return `Rangt ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${issue2.divisor}`;
case "unrecognized_keys":
return `\xD3\xFEekkt ${issue2.keys.length > 1 ? "ir lyklar" : "ur lykill"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Rangur lykill \xED ${issue2.origin}`;
case "invalid_union":
return "Rangt gildi";
case "invalid_element":
return `Rangt gildi \xED ${issue2.origin}`;
default:
return `Rangt gildi`;
}
};
};
function is_default() {
return {
localeError: error20()
};
}
// node_modules/zod/v4/locales/it.js
var error21 = () => {
const Sizable = {
string: { unit: "caratteri", verb: "avere" },
file: { unit: "byte", verb: "avere" },
array: { unit: "elementi", verb: "avere" },
set: { unit: "elementi", verb: "avere" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "indirizzo email",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "data e ora ISO",
date: "data ISO",
time: "ora ISO",
duration: "durata ISO",
ipv4: "indirizzo IPv4",
ipv6: "indirizzo IPv6",
cidrv4: "intervallo IPv4",
cidrv6: "intervallo IPv6",
base64: "stringa codificata in base64",
base64url: "URL codificata in base64",
json_string: "stringa JSON",
e164: "numero E.164",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN",
number: "numero",
array: "vettore"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Input non valido: atteso instanceof ${issue2.expected}, ricevuto ${received}`;
}
return `Input non valido: atteso ${expected}, ricevuto ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Input non valido: atteso ${stringifyPrimitive(issue2.values[0])}`;
return `Opzione non valida: atteso uno tra ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Troppo grande: ${issue2.origin ?? "valore"} deve avere ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementi"}`;
return `Troppo grande: ${issue2.origin ?? "valore"} deve essere ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Troppo piccolo: ${issue2.origin} deve avere ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Troppo piccolo: ${issue2.origin} deve essere ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Stringa non valida: deve iniziare con "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Stringa non valida: deve terminare con "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Stringa non valida: deve includere "${_issue.includes}"`;
if (_issue.format === "regex")
return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`;
return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Numero non valido: deve essere un multiplo di ${issue2.divisor}`;
case "unrecognized_keys":
return `Chiav${issue2.keys.length > 1 ? "i" : "e"} non riconosciut${issue2.keys.length > 1 ? "e" : "a"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Chiave non valida in ${issue2.origin}`;
case "invalid_union":
return "Input non valido";
case "invalid_element":
return `Valore non valido in ${issue2.origin}`;
default:
return `Input non valido`;
}
};
};
function it_default() {
return {
localeError: error21()
};
}
// node_modules/zod/v4/locales/ja.js
var error22 = () => {
const Sizable = {
string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
file: { unit: "\u30D0\u30A4\u30C8", verb: "\u3067\u3042\u308B" },
array: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" },
set: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u5165\u529B\u5024",
email: "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",
url: "URL",
emoji: "\u7D75\u6587\u5B57",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO\u65E5\u6642",
date: "ISO\u65E5\u4ED8",
time: "ISO\u6642\u523B",
duration: "ISO\u671F\u9593",
ipv4: "IPv4\u30A2\u30C9\u30EC\u30B9",
ipv6: "IPv6\u30A2\u30C9\u30EC\u30B9",
cidrv4: "IPv4\u7BC4\u56F2",
cidrv6: "IPv6\u7BC4\u56F2",
base64: "base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",
base64url: "base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",
json_string: "JSON\u6587\u5B57\u5217",
e164: "E.164\u756A\u53F7",
jwt: "JWT",
template_literal: "\u5165\u529B\u5024"
};
const TypeDictionary = {
nan: "NaN",
number: "\u6570\u5024",
array: "\u914D\u5217"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u7121\u52B9\u306A\u5165\u529B: instanceof ${issue2.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${received}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;
}
return `\u7121\u52B9\u306A\u5165\u529B: ${expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${received}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u7121\u52B9\u306A\u5165\u529B: ${stringifyPrimitive(issue2.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`;
return `\u7121\u52B9\u306A\u9078\u629E: ${joinValues(issue2.values, "\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;
case "too_big": {
const adj = issue2.inclusive ? "\u4EE5\u4E0B\u3067\u3042\u308B" : "\u3088\u308A\u5C0F\u3055\u3044";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u5927\u304D\u3059\u304E\u308B\u5024: ${issue2.origin ?? "\u5024"}\u306F${issue2.maximum.toString()}${sizing.unit ?? "\u8981\u7D20"}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;
return `\u5927\u304D\u3059\u304E\u308B\u5024: ${issue2.origin ?? "\u5024"}\u306F${issue2.maximum.toString()}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;
}
case "too_small": {
const adj = issue2.inclusive ? "\u4EE5\u4E0A\u3067\u3042\u308B" : "\u3088\u308A\u5927\u304D\u3044";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u5C0F\u3055\u3059\u304E\u308B\u5024: ${issue2.origin}\u306F${issue2.minimum.toString()}${sizing.unit}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;
return `\u5C0F\u3055\u3059\u304E\u308B\u5024: ${issue2.origin}\u306F${issue2.minimum.toString()}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\u7121\u52B9\u306A\u6587\u5B57\u5217: "${_issue.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;
if (_issue.format === "ends_with")
return `\u7121\u52B9\u306A\u6587\u5B57\u5217: "${_issue.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;
if (_issue.format === "includes")
return `\u7121\u52B9\u306A\u6587\u5B57\u5217: "${_issue.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;
if (_issue.format === "regex")
return `\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${_issue.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;
return `\u7121\u52B9\u306A${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u7121\u52B9\u306A\u6570\u5024: ${issue2.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;
case "unrecognized_keys":
return `\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${issue2.keys.length > 1 ? "\u7FA4" : ""}: ${joinValues(issue2.keys, "\u3001")}`;
case "invalid_key":
return `${issue2.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;
case "invalid_union":
return "\u7121\u52B9\u306A\u5165\u529B";
case "invalid_element":
return `${issue2.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;
default:
return `\u7121\u52B9\u306A\u5165\u529B`;
}
};
};
function ja_default() {
return {
localeError: error22()
};
}
// node_modules/zod/v4/locales/ka.js
var error23 = () => {
const Sizable = {
string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
file: { unit: "\u10D1\u10D0\u10D8\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
array: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" },
set: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",
email: "\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",
url: "URL",
emoji: "\u10D4\u10DB\u10DD\u10EF\u10D8",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",
date: "\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",
time: "\u10D3\u10E0\u10DD",
duration: "\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",
ipv4: "IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",
ipv6: "IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",
cidrv4: "IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",
cidrv6: "IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",
base64: "base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",
base64url: "base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",
json_string: "JSON \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",
e164: "E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",
jwt: "JWT",
template_literal: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"
};
const TypeDictionary = {
nan: "NaN",
number: "\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",
string: "\u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8",
boolean: "\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",
function: "\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",
array: "\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${issue2.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${received}`;
}
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${stringifyPrimitive(issue2.values[0])}`;
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${joinValues(issue2.values, "|")}-\u10D3\u10D0\u10DC`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin ?? "\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit}`;
return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin ?? "\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin} \u10D8\u10E7\u10DD\u10E1 ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${_issue.prefix}"-\u10D8\u10D7`;
}
if (_issue.format === "ends_with")
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${_issue.suffix}"-\u10D8\u10D7`;
if (_issue.format === "includes")
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${_issue.includes}"-\u10E1`;
if (_issue.format === "regex")
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E1\u10E2\u10E0\u10D8\u10DC\u10D2\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${_issue.pattern}`;
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${issue2.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;
case "unrecognized_keys":
return `\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${issue2.keys.length > 1 ? "\u10D4\u10D1\u10D8" : "\u10D8"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${issue2.origin}-\u10E8\u10D8`;
case "invalid_union":
return "\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";
case "invalid_element":
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${issue2.origin}-\u10E8\u10D8`;
default:
return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0`;
}
};
};
function ka_default() {
return {
localeError: error23()
};
}
// node_modules/zod/v4/locales/km.js
var error24 = () => {
const Sizable = {
string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
file: { unit: "\u1794\u17C3", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
array: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
set: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",
email: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",
url: "URL",
emoji: "\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",
date: "\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",
time: "\u1798\u17C9\u17C4\u1784 ISO",
duration: "\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",
ipv4: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",
ipv6: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",
cidrv4: "\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",
cidrv6: "\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",
base64: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",
base64url: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",
json_string: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",
e164: "\u179B\u17C1\u1781 E.164",
jwt: "JWT",
template_literal: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"
};
const TypeDictionary = {
nan: "NaN",
number: "\u179B\u17C1\u1781",
array: "\u17A2\u17B6\u179A\u17C1 (Array)",
null: "\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${issue2.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${received}`;
}
return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${stringifyPrimitive(issue2.values[0])}`;
return `\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin ?? "\u178F\u1798\u17D2\u179B\u17C3"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "\u1792\u17B6\u178F\u17BB"}`;
return `\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin ?? "\u178F\u1798\u17D2\u179B\u17C3"} ${adj} ${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
}
return `\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin} ${adj} ${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${_issue.pattern}`;
return `\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${issue2.divisor}`;
case "unrecognized_keys":
return `\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${issue2.origin}`;
case "invalid_union":
return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C`;
case "invalid_element":
return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${issue2.origin}`;
default:
return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C`;
}
};
};
function km_default() {
return {
localeError: error24()
};
}
// node_modules/zod/v4/locales/kh.js
function kh_default() {
return km_default();
}
// node_modules/zod/v4/locales/ko.js
var error25 = () => {
const Sizable = {
string: { unit: "\uBB38\uC790", verb: "to have" },
file: { unit: "\uBC14\uC774\uD2B8", verb: "to have" },
array: { unit: "\uAC1C", verb: "to have" },
set: { unit: "\uAC1C", verb: "to have" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\uC785\uB825",
email: "\uC774\uBA54\uC77C \uC8FC\uC18C",
url: "URL",
emoji: "\uC774\uBAA8\uC9C0",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO \uB0A0\uC9DC\uC2DC\uAC04",
date: "ISO \uB0A0\uC9DC",
time: "ISO \uC2DC\uAC04",
duration: "ISO \uAE30\uAC04",
ipv4: "IPv4 \uC8FC\uC18C",
ipv6: "IPv6 \uC8FC\uC18C",
cidrv4: "IPv4 \uBC94\uC704",
cidrv6: "IPv6 \uBC94\uC704",
base64: "base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",
base64url: "base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",
json_string: "JSON \uBB38\uC790\uC5F4",
e164: "E.164 \uBC88\uD638",
jwt: "JWT",
template_literal: "\uC785\uB825"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${issue2.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${received}\uC785\uB2C8\uB2E4`;
}
return `\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${received}\uC785\uB2C8\uB2E4`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${stringifyPrimitive(issue2.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`;
return `\uC798\uBABB\uB41C \uC635\uC158: ${joinValues(issue2.values, "\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;
case "too_big": {
const adj = issue2.inclusive ? "\uC774\uD558" : "\uBBF8\uB9CC";
const suffix = adj === "\uBBF8\uB9CC" ? "\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4" : "\uC5EC\uC57C \uD569\uB2C8\uB2E4";
const sizing = getSizing(issue2.origin);
const unit = sizing?.unit ?? "\uC694\uC18C";
if (sizing)
return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${issue2.maximum.toString()}${unit} ${adj}${suffix}`;
return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${issue2.maximum.toString()} ${adj}${suffix}`;
}
case "too_small": {
const adj = issue2.inclusive ? "\uC774\uC0C1" : "\uCD08\uACFC";
const suffix = adj === "\uC774\uC0C1" ? "\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4" : "\uC5EC\uC57C \uD569\uB2C8\uB2E4";
const sizing = getSizing(issue2.origin);
const unit = sizing?.unit ?? "\uC694\uC18C";
if (sizing) {
return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${issue2.minimum.toString()}${unit} ${adj}${suffix}`;
}
return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${issue2.minimum.toString()} ${adj}${suffix}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${_issue.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`;
}
if (_issue.format === "ends_with")
return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${_issue.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`;
if (_issue.format === "includes")
return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${_issue.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`;
if (_issue.format === "regex")
return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${_issue.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`;
return `\uC798\uBABB\uB41C ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\uC798\uBABB\uB41C \uC22B\uC790: ${issue2.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;
case "unrecognized_keys":
return `\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\uC798\uBABB\uB41C \uD0A4: ${issue2.origin}`;
case "invalid_union":
return `\uC798\uBABB\uB41C \uC785\uB825`;
case "invalid_element":
return `\uC798\uBABB\uB41C \uAC12: ${issue2.origin}`;
default:
return `\uC798\uBABB\uB41C \uC785\uB825`;
}
};
};
function ko_default() {
return {
localeError: error25()
};
}
// node_modules/zod/v4/locales/lt.js
var capitalizeFirstCharacter = (text) => {
return text.charAt(0).toUpperCase() + text.slice(1);
};
function getUnitTypeFromNumber(number2) {
const abs = Math.abs(number2);
const last = abs % 10;
const last2 = abs % 100;
if (last2 >= 11 && last2 <= 19 || last === 0)
return "many";
if (last === 1)
return "one";
return "few";
}
var error26 = () => {
const Sizable = {
string: {
unit: {
one: "simbolis",
few: "simboliai",
many: "simboli\u0173"
},
verb: {
smaller: {
inclusive: "turi b\u016Bti ne ilgesn\u0117 kaip",
notInclusive: "turi b\u016Bti trumpesn\u0117 kaip"
},
bigger: {
inclusive: "turi b\u016Bti ne trumpesn\u0117 kaip",
notInclusive: "turi b\u016Bti ilgesn\u0117 kaip"
}
}
},
file: {
unit: {
one: "baitas",
few: "baitai",
many: "bait\u0173"
},
verb: {
smaller: {
inclusive: "turi b\u016Bti ne didesnis kaip",
notInclusive: "turi b\u016Bti ma\u017Eesnis kaip"
},
bigger: {
inclusive: "turi b\u016Bti ne ma\u017Eesnis kaip",
notInclusive: "turi b\u016Bti didesnis kaip"
}
}
},
array: {
unit: {
one: "element\u0105",
few: "elementus",
many: "element\u0173"
},
verb: {
smaller: {
inclusive: "turi tur\u0117ti ne daugiau kaip",
notInclusive: "turi tur\u0117ti ma\u017Eiau kaip"
},
bigger: {
inclusive: "turi tur\u0117ti ne ma\u017Eiau kaip",
notInclusive: "turi tur\u0117ti daugiau kaip"
}
}
},
set: {
unit: {
one: "element\u0105",
few: "elementus",
many: "element\u0173"
},
verb: {
smaller: {
inclusive: "turi tur\u0117ti ne daugiau kaip",
notInclusive: "turi tur\u0117ti ma\u017Eiau kaip"
},
bigger: {
inclusive: "turi tur\u0117ti ne ma\u017Eiau kaip",
notInclusive: "turi tur\u0117ti daugiau kaip"
}
}
}
};
function getSizing(origin, unitType, inclusive, targetShouldBe) {
const result = Sizable[origin] ?? null;
if (result === null)
return result;
return {
unit: result.unit[unitType],
verb: result.verb[targetShouldBe][inclusive ? "inclusive" : "notInclusive"]
};
}
const FormatDictionary = {
regex: "\u012Fvestis",
email: "el. pa\u0161to adresas",
url: "URL",
emoji: "jaustukas",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO data ir laikas",
date: "ISO data",
time: "ISO laikas",
duration: "ISO trukm\u0117",
ipv4: "IPv4 adresas",
ipv6: "IPv6 adresas",
cidrv4: "IPv4 tinklo prefiksas (CIDR)",
cidrv6: "IPv6 tinklo prefiksas (CIDR)",
base64: "base64 u\u017Ekoduota eilut\u0117",
base64url: "base64url u\u017Ekoduota eilut\u0117",
json_string: "JSON eilut\u0117",
e164: "E.164 numeris",
jwt: "JWT",
template_literal: "\u012Fvestis"
};
const TypeDictionary = {
nan: "NaN",
number: "skai\u010Dius",
bigint: "sveikasis skai\u010Dius",
string: "eilut\u0117",
boolean: "login\u0117 reik\u0161m\u0117",
undefined: "neapibr\u0117\u017Eta reik\u0161m\u0117",
function: "funkcija",
symbol: "simbolis",
array: "masyvas",
object: "objektas",
null: "nulin\u0117 reik\u0161m\u0117"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Gautas tipas ${received}, o tik\u0117tasi - instanceof ${issue2.expected}`;
}
return `Gautas tipas ${received}, o tik\u0117tasi - ${expected}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Privalo b\u016Bti ${stringifyPrimitive(issue2.values[0])}`;
return `Privalo b\u016Bti vienas i\u0161 ${joinValues(issue2.values, "|")} pasirinkim\u0173`;
case "too_big": {
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
const sizing = getSizing(issue2.origin, getUnitTypeFromNumber(Number(issue2.maximum)), issue2.inclusive ?? false, "smaller");
if (sizing?.verb)
return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} ${sizing.verb} ${issue2.maximum.toString()} ${sizing.unit ?? "element\u0173"}`;
const adj = issue2.inclusive ? "ne didesnis kaip" : "ma\u017Eesnis kaip";
return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} turi b\u016Bti ${adj} ${issue2.maximum.toString()} ${sizing?.unit}`;
}
case "too_small": {
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
const sizing = getSizing(issue2.origin, getUnitTypeFromNumber(Number(issue2.minimum)), issue2.inclusive ?? false, "bigger");
if (sizing?.verb)
return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} ${sizing.verb} ${issue2.minimum.toString()} ${sizing.unit ?? "element\u0173"}`;
const adj = issue2.inclusive ? "ne ma\u017Eesnis kaip" : "didesnis kaip";
return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} turi b\u016Bti ${adj} ${issue2.minimum.toString()} ${sizing?.unit}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Eilut\u0117 privalo prasid\u0117ti "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Eilut\u0117 privalo pasibaigti "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Eilut\u0117 privalo \u012Ftraukti "${_issue.includes}"`;
if (_issue.format === "regex")
return `Eilut\u0117 privalo atitikti ${_issue.pattern}`;
return `Neteisingas ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Skai\u010Dius privalo b\u016Bti ${issue2.divisor} kartotinis.`;
case "unrecognized_keys":
return `Neatpa\u017Eint${issue2.keys.length > 1 ? "i" : "as"} rakt${issue2.keys.length > 1 ? "ai" : "as"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return "Rastas klaidingas raktas";
case "invalid_union":
return "Klaidinga \u012Fvestis";
case "invalid_element": {
const origin = TypeDictionary[issue2.origin] ?? issue2.origin;
return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`;
}
default:
return "Klaidinga \u012Fvestis";
}
};
};
function lt_default() {
return {
localeError: error26()
};
}
// node_modules/zod/v4/locales/mk.js
var error27 = () => {
const Sizable = {
string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
file: { unit: "\u0431\u0430\u0458\u0442\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
array: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
set: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0432\u043D\u0435\u0441",
email: "\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",
url: "URL",
emoji: "\u0435\u043C\u043E\u045F\u0438",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",
date: "ISO \u0434\u0430\u0442\u0443\u043C",
time: "ISO \u0432\u0440\u0435\u043C\u0435",
duration: "ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",
ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",
ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",
cidrv4: "IPv4 \u043E\u043F\u0441\u0435\u0433",
cidrv6: "IPv6 \u043E\u043F\u0441\u0435\u0433",
base64: "base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",
base64url: "base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",
json_string: "JSON \u043D\u0438\u0437\u0430",
e164: "E.164 \u0431\u0440\u043E\u0458",
jwt: "JWT",
template_literal: "\u0432\u043D\u0435\u0441"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0431\u0440\u043E\u0458",
array: "\u043D\u0438\u0437\u0430"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${issue2.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${received}`;
}
return `\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;
return `\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin ?? "\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`;
return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin ?? "\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin} \u0434\u0430 \u0438\u043C\u0430 ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${_issue.pattern}`;
return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${issue2.divisor}`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438" : "\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${issue2.origin}`;
case "invalid_union":
return "\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";
case "invalid_element":
return `\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${issue2.origin}`;
default:
return `\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441`;
}
};
};
function mk_default() {
return {
localeError: error27()
};
}
// node_modules/zod/v4/locales/ms.js
var error28 = () => {
const Sizable = {
string: { unit: "aksara", verb: "mempunyai" },
file: { unit: "bait", verb: "mempunyai" },
array: { unit: "elemen", verb: "mempunyai" },
set: { unit: "elemen", verb: "mempunyai" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "alamat e-mel",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "tarikh masa ISO",
date: "tarikh ISO",
time: "masa ISO",
duration: "tempoh ISO",
ipv4: "alamat IPv4",
ipv6: "alamat IPv6",
cidrv4: "julat IPv4",
cidrv6: "julat IPv6",
base64: "string dikodkan base64",
base64url: "string dikodkan base64url",
json_string: "string JSON",
e164: "nombor E.164",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN",
number: "nombor"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Input tidak sah: dijangka instanceof ${issue2.expected}, diterima ${received}`;
}
return `Input tidak sah: dijangka ${expected}, diterima ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Input tidak sah: dijangka ${stringifyPrimitive(issue2.values[0])}`;
return `Pilihan tidak sah: dijangka salah satu daripada ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Terlalu besar: dijangka ${issue2.origin ?? "nilai"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemen"}`;
return `Terlalu besar: dijangka ${issue2.origin ?? "nilai"} adalah ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Terlalu kecil: dijangka ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Terlalu kecil: dijangka ${issue2.origin} adalah ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `String tidak sah: mesti bermula dengan "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `String tidak sah: mesti berakhir dengan "${_issue.suffix}"`;
if (_issue.format === "includes")
return `String tidak sah: mesti mengandungi "${_issue.includes}"`;
if (_issue.format === "regex")
return `String tidak sah: mesti sepadan dengan corak ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} tidak sah`;
}
case "not_multiple_of":
return `Nombor tidak sah: perlu gandaan ${issue2.divisor}`;
case "unrecognized_keys":
return `Kunci tidak dikenali: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Kunci tidak sah dalam ${issue2.origin}`;
case "invalid_union":
return "Input tidak sah";
case "invalid_element":
return `Nilai tidak sah dalam ${issue2.origin}`;
default:
return `Input tidak sah`;
}
};
};
function ms_default() {
return {
localeError: error28()
};
}
// node_modules/zod/v4/locales/nl.js
var error29 = () => {
const Sizable = {
string: { unit: "tekens", verb: "heeft" },
file: { unit: "bytes", verb: "heeft" },
array: { unit: "elementen", verb: "heeft" },
set: { unit: "elementen", verb: "heeft" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "invoer",
email: "emailadres",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datum en tijd",
date: "ISO datum",
time: "ISO tijd",
duration: "ISO duur",
ipv4: "IPv4-adres",
ipv6: "IPv6-adres",
cidrv4: "IPv4-bereik",
cidrv6: "IPv6-bereik",
base64: "base64-gecodeerde tekst",
base64url: "base64 URL-gecodeerde tekst",
json_string: "JSON string",
e164: "E.164-nummer",
jwt: "JWT",
template_literal: "invoer"
};
const TypeDictionary = {
nan: "NaN",
number: "getal"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ongeldige invoer: verwacht instanceof ${issue2.expected}, ontving ${received}`;
}
return `Ongeldige invoer: verwacht ${expected}, ontving ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ongeldige invoer: verwacht ${stringifyPrimitive(issue2.values[0])}`;
return `Ongeldige optie: verwacht \xE9\xE9n van ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
const longName = issue2.origin === "date" ? "laat" : issue2.origin === "string" ? "lang" : "groot";
if (sizing)
return `Te ${longName}: verwacht dat ${issue2.origin ?? "waarde"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementen"} ${sizing.verb}`;
return `Te ${longName}: verwacht dat ${issue2.origin ?? "waarde"} ${adj}${issue2.maximum.toString()} is`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
const shortName = issue2.origin === "date" ? "vroeg" : issue2.origin === "string" ? "kort" : "klein";
if (sizing) {
return `Te ${shortName}: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
}
return `Te ${shortName}: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} is`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Ongeldige tekst: moet met "${_issue.prefix}" beginnen`;
}
if (_issue.format === "ends_with")
return `Ongeldige tekst: moet op "${_issue.suffix}" eindigen`;
if (_issue.format === "includes")
return `Ongeldige tekst: moet "${_issue.includes}" bevatten`;
if (_issue.format === "regex")
return `Ongeldige tekst: moet overeenkomen met patroon ${_issue.pattern}`;
return `Ongeldig: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ongeldig getal: moet een veelvoud van ${issue2.divisor} zijn`;
case "unrecognized_keys":
return `Onbekende key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Ongeldige key in ${issue2.origin}`;
case "invalid_union":
return "Ongeldige invoer";
case "invalid_element":
return `Ongeldige waarde in ${issue2.origin}`;
default:
return `Ongeldige invoer`;
}
};
};
function nl_default() {
return {
localeError: error29()
};
}
// node_modules/zod/v4/locales/no.js
var error30 = () => {
const Sizable = {
string: { unit: "tegn", verb: "\xE5 ha" },
file: { unit: "bytes", verb: "\xE5 ha" },
array: { unit: "elementer", verb: "\xE5 inneholde" },
set: { unit: "elementer", verb: "\xE5 inneholde" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "input",
email: "e-postadresse",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO dato- og klokkeslett",
date: "ISO-dato",
time: "ISO-klokkeslett",
duration: "ISO-varighet",
ipv4: "IPv4-omr\xE5de",
ipv6: "IPv6-omr\xE5de",
cidrv4: "IPv4-spekter",
cidrv6: "IPv6-spekter",
base64: "base64-enkodet streng",
base64url: "base64url-enkodet streng",
json_string: "JSON-streng",
e164: "E.164-nummer",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN",
number: "tall",
array: "liste"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ugyldig input: forventet instanceof ${issue2.expected}, fikk ${received}`;
}
return `Ugyldig input: forventet ${expected}, fikk ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ugyldig verdi: forventet ${stringifyPrimitive(issue2.values[0])}`;
return `Ugyldig valg: forventet en av ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `For stor(t): forventet ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`;
return `For stor(t): forventet ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `For lite(n): forventet ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `For lite(n): forventet ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Ugyldig streng: m\xE5 starte med "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Ugyldig streng: m\xE5 ende med "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Ugyldig streng: m\xE5 inneholde "${_issue.includes}"`;
if (_issue.format === "regex")
return `Ugyldig streng: m\xE5 matche m\xF8nsteret ${_issue.pattern}`;
return `Ugyldig ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ugyldig tall: m\xE5 v\xE6re et multiplum av ${issue2.divisor}`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Ukjente n\xF8kler" : "Ukjent n\xF8kkel"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Ugyldig n\xF8kkel i ${issue2.origin}`;
case "invalid_union":
return "Ugyldig input";
case "invalid_element":
return `Ugyldig verdi i ${issue2.origin}`;
default:
return `Ugyldig input`;
}
};
};
function no_default() {
return {
localeError: error30()
};
}
// node_modules/zod/v4/locales/ota.js
var error31 = () => {
const Sizable = {
string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
file: { unit: "bayt", verb: "olmal\u0131d\u0131r" },
array: { unit: "unsur", verb: "olmal\u0131d\u0131r" },
set: { unit: "unsur", verb: "olmal\u0131d\u0131r" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "giren",
email: "epostag\xE2h",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO heng\xE2m\u0131",
date: "ISO tarihi",
time: "ISO zaman\u0131",
duration: "ISO m\xFCddeti",
ipv4: "IPv4 ni\u015F\xE2n\u0131",
ipv6: "IPv6 ni\u015F\xE2n\u0131",
cidrv4: "IPv4 menzili",
cidrv6: "IPv6 menzili",
base64: "base64-\u015Fifreli metin",
base64url: "base64url-\u015Fifreli metin",
json_string: "JSON metin",
e164: "E.164 say\u0131s\u0131",
jwt: "JWT",
template_literal: "giren"
};
const TypeDictionary = {
nan: "NaN",
number: "numara",
array: "saf",
null: "gayb"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `F\xE2sit giren: umulan instanceof ${issue2.expected}, al\u0131nan ${received}`;
}
return `F\xE2sit giren: umulan ${expected}, al\u0131nan ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `F\xE2sit giren: umulan ${stringifyPrimitive(issue2.values[0])}`;
return `F\xE2sit tercih: m\xFBteberler ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Fazla b\xFCy\xFCk: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmal\u0131yd\u0131.`;
return `Fazla b\xFCy\xFCk: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} olmal\u0131yd\u0131.`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Fazla k\xFC\xE7\xFCk: ${issue2.origin}, ${adj}${issue2.minimum.toString()} ${sizing.unit} sahip olmal\u0131yd\u0131.`;
}
return `Fazla k\xFC\xE7\xFCk: ${issue2.origin}, ${adj}${issue2.minimum.toString()} olmal\u0131yd\u0131.`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `F\xE2sit metin: "${_issue.prefix}" ile ba\u015Flamal\u0131.`;
if (_issue.format === "ends_with")
return `F\xE2sit metin: "${_issue.suffix}" ile bitmeli.`;
if (_issue.format === "includes")
return `F\xE2sit metin: "${_issue.includes}" ihtiv\xE2 etmeli.`;
if (_issue.format === "regex")
return `F\xE2sit metin: ${_issue.pattern} nak\u015F\u0131na uymal\u0131.`;
return `F\xE2sit ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `F\xE2sit say\u0131: ${issue2.divisor} kat\u0131 olmal\u0131yd\u0131.`;
case "unrecognized_keys":
return `Tan\u0131nmayan anahtar ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} i\xE7in tan\u0131nmayan anahtar var.`;
case "invalid_union":
return "Giren tan\u0131namad\u0131.";
case "invalid_element":
return `${issue2.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;
default:
return `K\u0131ymet tan\u0131namad\u0131.`;
}
};
};
function ota_default() {
return {
localeError: error31()
};
}
// node_modules/zod/v4/locales/ps.js
var error32 = () => {
const Sizable = {
string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
file: { unit: "\u0628\u0627\u06CC\u067C\u0633", verb: "\u0648\u0644\u0631\u064A" },
array: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
set: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0648\u0631\u0648\u062F\u064A",
email: "\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",
url: "\u06CC\u0648 \u0622\u0631 \u0627\u0644",
emoji: "\u0627\u06CC\u0645\u0648\u062C\u064A",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",
date: "\u0646\u06D0\u067C\u0647",
time: "\u0648\u062E\u062A",
duration: "\u0645\u0648\u062F\u0647",
ipv4: "\u062F IPv4 \u067E\u062A\u0647",
ipv6: "\u062F IPv6 \u067E\u062A\u0647",
cidrv4: "\u062F IPv4 \u0633\u0627\u062D\u0647",
cidrv6: "\u062F IPv6 \u0633\u0627\u062D\u0647",
base64: "base64-encoded \u0645\u062A\u0646",
base64url: "base64url-encoded \u0645\u062A\u0646",
json_string: "JSON \u0645\u062A\u0646",
e164: "\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",
jwt: "JWT",
template_literal: "\u0648\u0631\u0648\u062F\u064A"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0639\u062F\u062F",
array: "\u0627\u0631\u06D0"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${issue2.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${received} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;
}
return `\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${received} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`;
}
case "invalid_value":
if (issue2.values.length === 1) {
return `\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${stringifyPrimitive(issue2.values[0])} \u0648\u0627\u06CC`;
}
return `\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${joinValues(issue2.values, "|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${issue2.origin ?? "\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`;
}
return `\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${issue2.origin ?? "\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} \u0648\u064A`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0648\u0644\u0631\u064A`;
}
return `\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} \u0648\u064A`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${_issue.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`;
}
if (_issue.format === "ends_with") {
return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${_issue.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`;
}
if (_issue.format === "includes") {
return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${_issue.includes}" \u0648\u0644\u0631\u064A`;
}
if (_issue.format === "regex") {
return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${_issue.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`;
}
return `${FormatDictionary[_issue.format] ?? issue2.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`;
}
case "not_multiple_of":
return `\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${issue2.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;
case "unrecognized_keys":
return `\u0646\u0627\u0633\u0645 ${issue2.keys.length > 1 ? "\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647" : "\u06A9\u0644\u06CC\u0689"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${issue2.origin} \u06A9\u06D0`;
case "invalid_union":
return `\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A`;
case "invalid_element":
return `\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${issue2.origin} \u06A9\u06D0`;
default:
return `\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A`;
}
};
};
function ps_default() {
return {
localeError: error32()
};
}
// node_modules/zod/v4/locales/pl.js
var error33 = () => {
const Sizable = {
string: { unit: "znak\xF3w", verb: "mie\u0107" },
file: { unit: "bajt\xF3w", verb: "mie\u0107" },
array: { unit: "element\xF3w", verb: "mie\u0107" },
set: { unit: "element\xF3w", verb: "mie\u0107" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "wyra\u017Cenie",
email: "adres email",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "data i godzina w formacie ISO",
date: "data w formacie ISO",
time: "godzina w formacie ISO",
duration: "czas trwania ISO",
ipv4: "adres IPv4",
ipv6: "adres IPv6",
cidrv4: "zakres IPv4",
cidrv6: "zakres IPv6",
base64: "ci\u0105g znak\xF3w zakodowany w formacie base64",
base64url: "ci\u0105g znak\xF3w zakodowany w formacie base64url",
json_string: "ci\u0105g znak\xF3w w formacie JSON",
e164: "liczba E.164",
jwt: "JWT",
template_literal: "wej\u015Bcie"
};
const TypeDictionary = {
nan: "NaN",
number: "liczba",
array: "tablica"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${issue2.expected}, otrzymano ${received}`;
}
return `Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${expected}, otrzymano ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${stringifyPrimitive(issue2.values[0])}`;
return `Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie mie\u0107 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element\xF3w"}`;
}
return `Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie mie\u0107 ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "element\xF3w"}`;
}
return `Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${_issue.includes}"`;
if (_issue.format === "regex")
return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${_issue.pattern}`;
return `Nieprawid\u0142ow(y/a/e) ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${issue2.divisor}`;
case "unrecognized_keys":
return `Nierozpoznane klucze${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Nieprawid\u0142owy klucz w ${issue2.origin}`;
case "invalid_union":
return "Nieprawid\u0142owe dane wej\u015Bciowe";
case "invalid_element":
return `Nieprawid\u0142owa warto\u015B\u0107 w ${issue2.origin}`;
default:
return `Nieprawid\u0142owe dane wej\u015Bciowe`;
}
};
};
function pl_default() {
return {
localeError: error33()
};
}
// node_modules/zod/v4/locales/pt.js
var error34 = () => {
const Sizable = {
string: { unit: "caracteres", verb: "ter" },
file: { unit: "bytes", verb: "ter" },
array: { unit: "itens", verb: "ter" },
set: { unit: "itens", verb: "ter" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "padr\xE3o",
email: "endere\xE7o de e-mail",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "data e hora ISO",
date: "data ISO",
time: "hora ISO",
duration: "dura\xE7\xE3o ISO",
ipv4: "endere\xE7o IPv4",
ipv6: "endere\xE7o IPv6",
cidrv4: "faixa de IPv4",
cidrv6: "faixa de IPv6",
base64: "texto codificado em base64",
base64url: "URL codificada em base64",
json_string: "texto JSON",
e164: "n\xFAmero E.164",
jwt: "JWT",
template_literal: "entrada"
};
const TypeDictionary = {
nan: "NaN",
number: "n\xFAmero",
null: "nulo"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Tipo inv\xE1lido: esperado instanceof ${issue2.expected}, recebido ${received}`;
}
return `Tipo inv\xE1lido: esperado ${expected}, recebido ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Entrada inv\xE1lida: esperado ${stringifyPrimitive(issue2.values[0])}`;
return `Op\xE7\xE3o inv\xE1lida: esperada uma das ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Muito grande: esperado que ${issue2.origin ?? "valor"} tivesse ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`;
return `Muito grande: esperado que ${issue2.origin ?? "valor"} fosse ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Muito pequeno: esperado que ${issue2.origin} tivesse ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Muito pequeno: esperado que ${issue2.origin} fosse ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Texto inv\xE1lido: deve come\xE7ar com "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Texto inv\xE1lido: deve terminar com "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Texto inv\xE1lido: deve incluir "${_issue.includes}"`;
if (_issue.format === "regex")
return `Texto inv\xE1lido: deve corresponder ao padr\xE3o ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} inv\xE1lido`;
}
case "not_multiple_of":
return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
case "unrecognized_keys":
return `Chave${issue2.keys.length > 1 ? "s" : ""} desconhecida${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Chave inv\xE1lida em ${issue2.origin}`;
case "invalid_union":
return "Entrada inv\xE1lida";
case "invalid_element":
return `Valor inv\xE1lido em ${issue2.origin}`;
default:
return `Campo inv\xE1lido`;
}
};
};
function pt_default() {
return {
localeError: error34()
};
}
// node_modules/zod/v4/locales/ru.js
function getRussianPlural(count, one, few, many) {
const absCount = Math.abs(count);
const lastDigit = absCount % 10;
const lastTwoDigits = absCount % 100;
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
return many;
}
if (lastDigit === 1) {
return one;
}
if (lastDigit >= 2 && lastDigit <= 4) {
return few;
}
return many;
}
var error35 = () => {
const Sizable = {
string: {
unit: {
one: "\u0441\u0438\u043C\u0432\u043E\u043B",
few: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430",
many: "\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"
},
verb: "\u0438\u043C\u0435\u0442\u044C"
},
file: {
unit: {
one: "\u0431\u0430\u0439\u0442",
few: "\u0431\u0430\u0439\u0442\u0430",
many: "\u0431\u0430\u0439\u0442"
},
verb: "\u0438\u043C\u0435\u0442\u044C"
},
array: {
unit: {
one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442",
few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",
many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"
},
verb: "\u0438\u043C\u0435\u0442\u044C"
},
set: {
unit: {
one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442",
few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",
many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"
},
verb: "\u0438\u043C\u0435\u0442\u044C"
}
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0432\u0432\u043E\u0434",
email: "email \u0430\u0434\u0440\u0435\u0441",
url: "URL",
emoji: "\u044D\u043C\u043E\u0434\u0437\u0438",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",
date: "ISO \u0434\u0430\u0442\u0430",
time: "ISO \u0432\u0440\u0435\u043C\u044F",
duration: "ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",
ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441",
ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441",
cidrv4: "IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",
cidrv6: "IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",
base64: "\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",
base64url: "\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",
json_string: "JSON \u0441\u0442\u0440\u043E\u043A\u0430",
e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
jwt: "JWT",
template_literal: "\u0432\u0432\u043E\u0434"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0447\u0438\u0441\u043B\u043E",
array: "\u043C\u0430\u0441\u0441\u0438\u0432"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${issue2.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${received}`;
}
return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${stringifyPrimitive(issue2.values[0])}`;
return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
const maxValue = Number(issue2.maximum);
const unit = getRussianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${adj}${issue2.maximum.toString()} ${unit}`;
}
return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
const minValue = Number(issue2.minimum);
const unit = getRussianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${adj}${issue2.minimum.toString()} ${unit}`;
}
return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin} \u0431\u0443\u0434\u0435\u0442 ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${_issue.pattern}`;
return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${issue2.divisor}`;
case "unrecognized_keys":
return `\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${issue2.keys.length > 1 ? "\u044B\u0435" : "\u044B\u0439"} \u043A\u043B\u044E\u0447${issue2.keys.length > 1 ? "\u0438" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${issue2.origin}`;
case "invalid_union":
return "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";
case "invalid_element":
return `\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${issue2.origin}`;
default:
return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435`;
}
};
};
function ru_default() {
return {
localeError: error35()
};
}
// node_modules/zod/v4/locales/sl.js
var error36 = () => {
const Sizable = {
string: { unit: "znakov", verb: "imeti" },
file: { unit: "bajtov", verb: "imeti" },
array: { unit: "elementov", verb: "imeti" },
set: { unit: "elementov", verb: "imeti" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "vnos",
email: "e-po\u0161tni naslov",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datum in \u010Das",
date: "ISO datum",
time: "ISO \u010Das",
duration: "ISO trajanje",
ipv4: "IPv4 naslov",
ipv6: "IPv6 naslov",
cidrv4: "obseg IPv4",
cidrv6: "obseg IPv6",
base64: "base64 kodiran niz",
base64url: "base64url kodiran niz",
json_string: "JSON niz",
e164: "E.164 \u0161tevilka",
jwt: "JWT",
template_literal: "vnos"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0161tevilo",
array: "tabela"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Neveljaven vnos: pri\u010Dakovano instanceof ${issue2.expected}, prejeto ${received}`;
}
return `Neveljaven vnos: pri\u010Dakovano ${expected}, prejeto ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Neveljaven vnos: pri\u010Dakovano ${stringifyPrimitive(issue2.values[0])}`;
return `Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Preveliko: pri\u010Dakovano, da bo ${issue2.origin ?? "vrednost"} imelo ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementov"}`;
return `Preveliko: pri\u010Dakovano, da bo ${issue2.origin ?? "vrednost"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Premajhno: pri\u010Dakovano, da bo ${issue2.origin} imelo ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Premajhno: pri\u010Dakovano, da bo ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Neveljaven niz: mora se za\u010Deti z "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Neveljaven niz: mora se kon\u010Dati z "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Neveljaven niz: mora vsebovati "${_issue.includes}"`;
if (_issue.format === "regex")
return `Neveljaven niz: mora ustrezati vzorcu ${_issue.pattern}`;
return `Neveljaven ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${issue2.divisor}`;
case "unrecognized_keys":
return `Neprepoznan${issue2.keys.length > 1 ? "i klju\u010Di" : " klju\u010D"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Neveljaven klju\u010D v ${issue2.origin}`;
case "invalid_union":
return "Neveljaven vnos";
case "invalid_element":
return `Neveljavna vrednost v ${issue2.origin}`;
default:
return "Neveljaven vnos";
}
};
};
function sl_default() {
return {
localeError: error36()
};
}
// node_modules/zod/v4/locales/sv.js
var error37 = () => {
const Sizable = {
string: { unit: "tecken", verb: "att ha" },
file: { unit: "bytes", verb: "att ha" },
array: { unit: "objekt", verb: "att inneh\xE5lla" },
set: { unit: "objekt", verb: "att inneh\xE5lla" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "regulj\xE4rt uttryck",
email: "e-postadress",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO-datum och tid",
date: "ISO-datum",
time: "ISO-tid",
duration: "ISO-varaktighet",
ipv4: "IPv4-intervall",
ipv6: "IPv6-intervall",
cidrv4: "IPv4-spektrum",
cidrv6: "IPv6-spektrum",
base64: "base64-kodad str\xE4ng",
base64url: "base64url-kodad str\xE4ng",
json_string: "JSON-str\xE4ng",
e164: "E.164-nummer",
jwt: "JWT",
template_literal: "mall-literal"
};
const TypeDictionary = {
nan: "NaN",
number: "antal",
array: "lista"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${issue2.expected}, fick ${received}`;
}
return `Ogiltig inmatning: f\xF6rv\xE4ntat ${expected}, fick ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ogiltig inmatning: f\xF6rv\xE4ntat ${stringifyPrimitive(issue2.values[0])}`;
return `Ogiltigt val: f\xF6rv\xE4ntade en av ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `F\xF6r stor(t): f\xF6rv\xE4ntade ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`;
}
return `F\xF6r stor(t): f\xF6rv\xE4ntat ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `F\xF6r lite(t): f\xF6rv\xE4ntade ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `F\xF6r lite(t): f\xF6rv\xE4ntade ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Ogiltig str\xE4ng: m\xE5ste sluta med "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${_issue.includes}"`;
if (_issue.format === "regex")
return `Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${_issue.pattern}"`;
return `Ogiltig(t) ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ogiltigt tal: m\xE5ste vara en multipel av ${issue2.divisor}`;
case "unrecognized_keys":
return `${issue2.keys.length > 1 ? "Ok\xE4nda nycklar" : "Ok\xE4nd nyckel"}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Ogiltig nyckel i ${issue2.origin ?? "v\xE4rdet"}`;
case "invalid_union":
return "Ogiltig input";
case "invalid_element":
return `Ogiltigt v\xE4rde i ${issue2.origin ?? "v\xE4rdet"}`;
default:
return `Ogiltig input`;
}
};
};
function sv_default() {
return {
localeError: error37()
};
}
// node_modules/zod/v4/locales/ta.js
var error38 = () => {
const Sizable = {
string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
file: { unit: "\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
array: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
set: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",
email: "\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",
date: "ISO \u0BA4\u0BC7\u0BA4\u0BBF",
time: "ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",
duration: "ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",
ipv4: "IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",
ipv6: "IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",
cidrv4: "IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",
cidrv6: "IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",
base64: "base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",
base64url: "base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",
json_string: "JSON \u0B9A\u0BB0\u0BAE\u0BCD",
e164: "E.164 \u0B8E\u0BA3\u0BCD",
jwt: "JWT",
template_literal: "input"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0B8E\u0BA3\u0BCD",
array: "\u0B85\u0BA3\u0BBF",
null: "\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${issue2.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${received}`;
}
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${stringifyPrimitive(issue2.values[0])}`;
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${joinValues(issue2.values, "|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin ?? "\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;
}
return `\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin ?? "\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${adj}${issue2.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;
}
return `\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin} ${adj}${issue2.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${_issue.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;
if (_issue.format === "ends_with")
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${_issue.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;
if (_issue.format === "includes")
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${_issue.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;
if (_issue.format === "regex")
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${_issue.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${issue2.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;
case "unrecognized_keys":
return `\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${issue2.keys.length > 1 ? "\u0B95\u0BB3\u0BCD" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;
case "invalid_union":
return "\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";
case "invalid_element":
return `${issue2.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;
default:
return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1`;
}
};
};
function ta_default() {
return {
localeError: error38()
};
}
// node_modules/zod/v4/locales/th.js
var error39 = () => {
const Sizable = {
string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
file: { unit: "\u0E44\u0E1A\u0E15\u0E4C", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
array: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
set: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",
email: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",
url: "URL",
emoji: "\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
date: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",
time: "\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
duration: "\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",
ipv4: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",
ipv6: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",
cidrv4: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",
cidrv6: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",
base64: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",
base64url: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",
json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",
e164: "\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",
jwt: "\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",
template_literal: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",
array: "\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",
null: "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${issue2.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${received}`;
}
return `\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${stringifyPrimitive(issue2.values[0])}`;
return `\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19" : "\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin ?? "\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`;
return `\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin ?? "\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? "\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22" : "\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.minimum.toString()} ${sizing.unit}`;
}
return `\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${_issue.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`;
if (_issue.format === "regex")
return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${_issue.pattern}`;
return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${issue2.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;
case "unrecognized_keys":
return `\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${issue2.origin}`;
case "invalid_union":
return "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";
case "invalid_element":
return `\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${issue2.origin}`;
default:
return `\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07`;
}
};
};
function th_default() {
return {
localeError: error39()
};
}
// node_modules/zod/v4/locales/tr.js
var error40 = () => {
const Sizable = {
string: { unit: "karakter", verb: "olmal\u0131" },
file: { unit: "bayt", verb: "olmal\u0131" },
array: { unit: "\xF6\u011Fe", verb: "olmal\u0131" },
set: { unit: "\xF6\u011Fe", verb: "olmal\u0131" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "girdi",
email: "e-posta adresi",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO tarih ve saat",
date: "ISO tarih",
time: "ISO saat",
duration: "ISO s\xFCre",
ipv4: "IPv4 adresi",
ipv6: "IPv6 adresi",
cidrv4: "IPv4 aral\u0131\u011F\u0131",
cidrv6: "IPv6 aral\u0131\u011F\u0131",
base64: "base64 ile \u015Fifrelenmi\u015F metin",
base64url: "base64url ile \u015Fifrelenmi\u015F metin",
json_string: "JSON dizesi",
e164: "E.164 say\u0131s\u0131",
jwt: "JWT",
template_literal: "\u015Eablon dizesi"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Ge\xE7ersiz de\u011Fer: beklenen instanceof ${issue2.expected}, al\u0131nan ${received}`;
}
return `Ge\xE7ersiz de\u011Fer: beklenen ${expected}, al\u0131nan ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Ge\xE7ersiz de\u011Fer: beklenen ${stringifyPrimitive(issue2.values[0])}`;
return `Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\xC7ok b\xFCy\xFCk: beklenen ${issue2.origin ?? "de\u011Fer"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\xF6\u011Fe"}`;
return `\xC7ok b\xFCy\xFCk: beklenen ${issue2.origin ?? "de\u011Fer"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\xC7ok k\xFC\xE7\xFCk: beklenen ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
return `\xC7ok k\xFC\xE7\xFCk: beklenen ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Ge\xE7ersiz metin: "${_issue.prefix}" ile ba\u015Flamal\u0131`;
if (_issue.format === "ends_with")
return `Ge\xE7ersiz metin: "${_issue.suffix}" ile bitmeli`;
if (_issue.format === "includes")
return `Ge\xE7ersiz metin: "${_issue.includes}" i\xE7ermeli`;
if (_issue.format === "regex")
return `Ge\xE7ersiz metin: ${_issue.pattern} desenine uymal\u0131`;
return `Ge\xE7ersiz ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Ge\xE7ersiz say\u0131: ${issue2.divisor} ile tam b\xF6l\xFCnebilmeli`;
case "unrecognized_keys":
return `Tan\u0131nmayan anahtar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} i\xE7inde ge\xE7ersiz anahtar`;
case "invalid_union":
return "Ge\xE7ersiz de\u011Fer";
case "invalid_element":
return `${issue2.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;
default:
return `Ge\xE7ersiz de\u011Fer`;
}
};
};
function tr_default() {
return {
localeError: error40()
};
}
// node_modules/zod/v4/locales/uk.js
var error41 = () => {
const Sizable = {
string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
file: { unit: "\u0431\u0430\u0439\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
array: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",
email: "\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",
url: "URL",
emoji: "\u0435\u043C\u043E\u0434\u0437\u0456",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",
date: "\u0434\u0430\u0442\u0430 ISO",
time: "\u0447\u0430\u0441 ISO",
duration: "\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",
ipv4: "\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",
ipv6: "\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",
cidrv4: "\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",
cidrv6: "\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",
base64: "\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",
base64url: "\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",
json_string: "\u0440\u044F\u0434\u043E\u043A JSON",
e164: "\u043D\u043E\u043C\u0435\u0440 E.164",
jwt: "JWT",
template_literal: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0447\u0438\u0441\u043B\u043E",
array: "\u043C\u0430\u0441\u0438\u0432"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${issue2.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${received}`;
}
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${stringifyPrimitive(issue2.values[0])}`;
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`;
return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin} \u0431\u0443\u0434\u0435 ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${_issue.pattern}`;
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${issue2.divisor}`;
case "unrecognized_keys":
return `\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${issue2.keys.length > 1 ? "\u0456" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${issue2.origin}`;
case "invalid_union":
return "\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";
case "invalid_element":
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${issue2.origin}`;
default:
return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456`;
}
};
};
function uk_default() {
return {
localeError: error41()
};
}
// node_modules/zod/v4/locales/ua.js
function ua_default() {
return uk_default();
}
// node_modules/zod/v4/locales/ur.js
var error42 = () => {
const Sizable = {
string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
file: { unit: "\u0628\u0627\u0626\u0679\u0633", verb: "\u06C1\u0648\u0646\u0627" },
array: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" },
set: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0627\u0646 \u067E\u0679",
email: "\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",
url: "\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",
emoji: "\u0627\u06CC\u0645\u0648\u062C\u06CC",
uuid: "\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",
uuidv4: "\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",
uuidv6: "\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",
nanoid: "\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",
guid: "\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",
cuid: "\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",
cuid2: "\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",
ulid: "\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",
xid: "\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",
ksuid: "\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",
datetime: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",
date: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",
time: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",
duration: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",
ipv4: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",
ipv6: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",
cidrv4: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",
cidrv6: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",
base64: "\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",
base64url: "\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",
json_string: "\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",
e164: "\u0627\u06CC 164 \u0646\u0645\u0628\u0631",
jwt: "\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",
template_literal: "\u0627\u0646 \u067E\u0679"
};
const TypeDictionary = {
nan: "NaN",
number: "\u0646\u0645\u0628\u0631",
array: "\u0622\u0631\u06D2",
null: "\u0646\u0644"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${issue2.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${received} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;
}
return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${received} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${stringifyPrimitive(issue2.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;
return `\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${joinValues(issue2.values, "|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u0628\u06C1\u062A \u0628\u0691\u0627: ${issue2.origin ?? "\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;
return `\u0628\u06C1\u062A \u0628\u0691\u0627: ${issue2.origin ?? "\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${adj}${issue2.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${issue2.origin} \u06A9\u06D2 ${adj}${issue2.minimum.toString()} ${sizing.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`;
}
return `\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${issue2.origin} \u06A9\u0627 ${adj}${issue2.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${_issue.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;
}
if (_issue.format === "ends_with")
return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${_issue.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;
if (_issue.format === "includes")
return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${_issue.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;
if (_issue.format === "regex")
return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${_issue.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;
return `\u063A\u0644\u0637 ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${issue2.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;
case "unrecognized_keys":
return `\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${issue2.keys.length > 1 ? "\u0632" : ""}: ${joinValues(issue2.keys, "\u060C ")}`;
case "invalid_key":
return `${issue2.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;
case "invalid_union":
return "\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";
case "invalid_element":
return `${issue2.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;
default:
return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679`;
}
};
};
function ur_default() {
return {
localeError: error42()
};
}
// node_modules/zod/v4/locales/uz.js
var error43 = () => {
const Sizable = {
string: { unit: "belgi", verb: "bo\u2018lishi kerak" },
file: { unit: "bayt", verb: "bo\u2018lishi kerak" },
array: { unit: "element", verb: "bo\u2018lishi kerak" },
set: { unit: "element", verb: "bo\u2018lishi kerak" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "kirish",
email: "elektron pochta manzili",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO sana va vaqti",
date: "ISO sana",
time: "ISO vaqt",
duration: "ISO davomiylik",
ipv4: "IPv4 manzil",
ipv6: "IPv6 manzil",
mac: "MAC manzil",
cidrv4: "IPv4 diapazon",
cidrv6: "IPv6 diapazon",
base64: "base64 kodlangan satr",
base64url: "base64url kodlangan satr",
json_string: "JSON satr",
e164: "E.164 raqam",
jwt: "JWT",
template_literal: "kirish"
};
const TypeDictionary = {
nan: "NaN",
number: "raqam",
array: "massiv"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `Noto\u2018g\u2018ri kirish: kutilgan instanceof ${issue2.expected}, qabul qilingan ${received}`;
}
return `Noto\u2018g\u2018ri kirish: kutilgan ${expected}, qabul qilingan ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `Noto\u2018g\u2018ri kirish: kutilgan ${stringifyPrimitive(issue2.values[0])}`;
return `Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Juda katta: kutilgan ${issue2.origin ?? "qiymat"} ${adj}${issue2.maximum.toString()} ${sizing.unit} ${sizing.verb}`;
return `Juda katta: kutilgan ${issue2.origin ?? "qiymat"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Juda kichik: kutilgan ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
}
return `Juda kichik: kutilgan ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Noto\u2018g\u2018ri satr: "${_issue.prefix}" bilan boshlanishi kerak`;
if (_issue.format === "ends_with")
return `Noto\u2018g\u2018ri satr: "${_issue.suffix}" bilan tugashi kerak`;
if (_issue.format === "includes")
return `Noto\u2018g\u2018ri satr: "${_issue.includes}" ni o\u2018z ichiga olishi kerak`;
if (_issue.format === "regex")
return `Noto\u2018g\u2018ri satr: ${_issue.pattern} shabloniga mos kelishi kerak`;
return `Noto\u2018g\u2018ri ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `Noto\u2018g\u2018ri raqam: ${issue2.divisor} ning karralisi bo\u2018lishi kerak`;
case "unrecognized_keys":
return `Noma\u2019lum kalit${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} dagi kalit noto\u2018g\u2018ri`;
case "invalid_union":
return "Noto\u2018g\u2018ri kirish";
case "invalid_element":
return `${issue2.origin} da noto\u2018g\u2018ri qiymat`;
default:
return `Noto\u2018g\u2018ri kirish`;
}
};
};
function uz_default() {
return {
localeError: error43()
};
}
// node_modules/zod/v4/locales/vi.js
var error44 = () => {
const Sizable = {
string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
file: { unit: "byte", verb: "c\xF3" },
array: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" },
set: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u0111\u1EA7u v\xE0o",
email: "\u0111\u1ECBa ch\u1EC9 email",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ng\xE0y gi\u1EDD ISO",
date: "ng\xE0y ISO",
time: "gi\u1EDD ISO",
duration: "kho\u1EA3ng th\u1EDDi gian ISO",
ipv4: "\u0111\u1ECBa ch\u1EC9 IPv4",
ipv6: "\u0111\u1ECBa ch\u1EC9 IPv6",
cidrv4: "d\u1EA3i IPv4",
cidrv6: "d\u1EA3i IPv6",
base64: "chu\u1ED7i m\xE3 h\xF3a base64",
base64url: "chu\u1ED7i m\xE3 h\xF3a base64url",
json_string: "chu\u1ED7i JSON",
e164: "s\u1ED1 E.164",
jwt: "JWT",
template_literal: "\u0111\u1EA7u v\xE0o"
};
const TypeDictionary = {
nan: "NaN",
number: "s\u1ED1",
array: "m\u1EA3ng"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${issue2.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${received}`;
}
return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${stringifyPrimitive(issue2.values[0])}`;
return `T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${issue2.origin ?? "gi\xE1 tr\u1ECB"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "ph\u1EA7n t\u1EED"}`;
return `Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${issue2.origin ?? "gi\xE1 tr\u1ECB"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${_issue.includes}"`;
if (_issue.format === "regex")
return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${_issue.pattern}`;
return `${FormatDictionary[_issue.format] ?? issue2.format} kh\xF4ng h\u1EE3p l\u1EC7`;
}
case "not_multiple_of":
return `S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${issue2.divisor}`;
case "unrecognized_keys":
return `Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${issue2.origin}`;
case "invalid_union":
return "\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";
case "invalid_element":
return `Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${issue2.origin}`;
default:
return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7`;
}
};
};
function vi_default() {
return {
localeError: error44()
};
}
// node_modules/zod/v4/locales/zh-CN.js
var error45 = () => {
const Sizable = {
string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
file: { unit: "\u5B57\u8282", verb: "\u5305\u542B" },
array: { unit: "\u9879", verb: "\u5305\u542B" },
set: { unit: "\u9879", verb: "\u5305\u542B" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u8F93\u5165",
email: "\u7535\u5B50\u90AE\u4EF6",
url: "URL",
emoji: "\u8868\u60C5\u7B26\u53F7",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO\u65E5\u671F\u65F6\u95F4",
date: "ISO\u65E5\u671F",
time: "ISO\u65F6\u95F4",
duration: "ISO\u65F6\u957F",
ipv4: "IPv4\u5730\u5740",
ipv6: "IPv6\u5730\u5740",
cidrv4: "IPv4\u7F51\u6BB5",
cidrv6: "IPv6\u7F51\u6BB5",
base64: "base64\u7F16\u7801\u5B57\u7B26\u4E32",
base64url: "base64url\u7F16\u7801\u5B57\u7B26\u4E32",
json_string: "JSON\u5B57\u7B26\u4E32",
e164: "E.164\u53F7\u7801",
jwt: "JWT",
template_literal: "\u8F93\u5165"
};
const TypeDictionary = {
nan: "NaN",
number: "\u6570\u5B57",
array: "\u6570\u7EC4",
null: "\u7A7A\u503C(null)"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${issue2.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${received}`;
}
return `\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${stringifyPrimitive(issue2.values[0])}`;
return `\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${issue2.origin ?? "\u503C"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u4E2A\u5143\u7D20"}`;
return `\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${issue2.origin ?? "\u503C"} ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${issue2.origin} ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${_issue.prefix}" \u5F00\u5934`;
if (_issue.format === "ends_with")
return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${_issue.suffix}" \u7ED3\u5C3E`;
if (_issue.format === "includes")
return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${_issue.pattern}`;
return `\u65E0\u6548${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${issue2.divisor} \u7684\u500D\u6570`;
case "unrecognized_keys":
return `\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `${issue2.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;
case "invalid_union":
return "\u65E0\u6548\u8F93\u5165";
case "invalid_element":
return `${issue2.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;
default:
return `\u65E0\u6548\u8F93\u5165`;
}
};
};
function zh_CN_default() {
return {
localeError: error45()
};
}
// node_modules/zod/v4/locales/zh-TW.js
var error46 = () => {
const Sizable = {
string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
file: { unit: "\u4F4D\u5143\u7D44", verb: "\u64C1\u6709" },
array: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" },
set: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u8F38\u5165",
email: "\u90F5\u4EF6\u5730\u5740",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO \u65E5\u671F\u6642\u9593",
date: "ISO \u65E5\u671F",
time: "ISO \u6642\u9593",
duration: "ISO \u671F\u9593",
ipv4: "IPv4 \u4F4D\u5740",
ipv6: "IPv6 \u4F4D\u5740",
cidrv4: "IPv4 \u7BC4\u570D",
cidrv6: "IPv6 \u7BC4\u570D",
base64: "base64 \u7DE8\u78BC\u5B57\u4E32",
base64url: "base64url \u7DE8\u78BC\u5B57\u4E32",
json_string: "JSON \u5B57\u4E32",
e164: "E.164 \u6578\u503C",
jwt: "JWT",
template_literal: "\u8F38\u5165"
};
const TypeDictionary = {
nan: "NaN"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${issue2.expected}\uFF0C\u4F46\u6536\u5230 ${received}`;
}
return `\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${expected}\uFF0C\u4F46\u6536\u5230 ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${stringifyPrimitive(issue2.values[0])}`;
return `\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${issue2.origin ?? "\u503C"} \u61C9\u70BA ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u500B\u5143\u7D20"}`;
return `\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${issue2.origin ?? "\u503C"} \u61C9\u70BA ${adj}${issue2.maximum.toString()}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing) {
return `\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${issue2.origin} \u61C9\u70BA ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
}
return `\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${issue2.origin} \u61C9\u70BA ${adj}${issue2.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with") {
return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${_issue.prefix}" \u958B\u982D`;
}
if (_issue.format === "ends_with")
return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${_issue.suffix}" \u7D50\u5C3E`;
if (_issue.format === "includes")
return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${_issue.pattern}`;
return `\u7121\u6548\u7684 ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${issue2.divisor} \u7684\u500D\u6578`;
case "unrecognized_keys":
return `\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${issue2.keys.length > 1 ? "\u5011" : ""}\uFF1A${joinValues(issue2.keys, "\u3001")}`;
case "invalid_key":
return `${issue2.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;
case "invalid_union":
return "\u7121\u6548\u7684\u8F38\u5165\u503C";
case "invalid_element":
return `${issue2.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;
default:
return `\u7121\u6548\u7684\u8F38\u5165\u503C`;
}
};
};
function zh_TW_default() {
return {
localeError: error46()
};
}
// node_modules/zod/v4/locales/yo.js
var error47 = () => {
const Sizable = {
string: { unit: "\xE0mi", verb: "n\xED" },
file: { unit: "bytes", verb: "n\xED" },
array: { unit: "nkan", verb: "n\xED" },
set: { unit: "nkan", verb: "n\xED" }
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",
email: "\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "\xE0k\xF3k\xF2 ISO",
date: "\u1ECDj\u1ECD\u0301 ISO",
time: "\xE0k\xF3k\xF2 ISO",
duration: "\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",
ipv4: "\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",
ipv6: "\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",
cidrv4: "\xE0gb\xE8gb\xE8 IPv4",
cidrv6: "\xE0gb\xE8gb\xE8 IPv6",
base64: "\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",
base64url: "\u1ECD\u0300r\u1ECD\u0300 base64url",
json_string: "\u1ECD\u0300r\u1ECD\u0300 JSON",
e164: "n\u1ECD\u0301mb\xE0 E.164",
jwt: "JWT",
template_literal: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"
};
const TypeDictionary = {
nan: "NaN",
number: "n\u1ECD\u0301mb\xE0",
array: "akop\u1ECD"
};
return (issue2) => {
switch (issue2.code) {
case "invalid_type": {
const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
const receivedType = parsedType(issue2.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue2.expected)) {
return `\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${issue2.expected}, \xE0m\u1ECD\u0300 a r\xED ${received}`;
}
return `\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${expected}, \xE0m\u1ECD\u0300 a r\xED ${received}`;
}
case "invalid_value":
if (issue2.values.length === 1)
return `\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${stringifyPrimitive(issue2.values[0])}`;
return `\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${joinValues(issue2.values, "|")}`;
case "too_big": {
const adj = issue2.inclusive ? "<=" : "<";
const sizing = getSizing(issue2.origin);
if (sizing)
return `T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${issue2.origin ?? "iye"} ${sizing.verb} ${adj}${issue2.maximum} ${sizing.unit}`;
return `T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${adj}${issue2.maximum}`;
}
case "too_small": {
const adj = issue2.inclusive ? ">=" : ">";
const sizing = getSizing(issue2.origin);
if (sizing)
return `K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum} ${sizing.unit}`;
return `K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${adj}${issue2.minimum}`;
}
case "invalid_format": {
const _issue = issue2;
if (_issue.format === "starts_with")
return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${_issue.suffix}"`;
if (_issue.format === "includes")
return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${_issue.includes}"`;
if (_issue.format === "regex")
return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${_issue.pattern}`;
return `A\u1E63\xEC\u1E63e: ${FormatDictionary[_issue.format] ?? issue2.format}`;
}
case "not_multiple_of":
return `N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${issue2.divisor}`;
case "unrecognized_keys":
return `B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${joinValues(issue2.keys, ", ")}`;
case "invalid_key":
return `B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${issue2.origin}`;
case "invalid_union":
return "\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";
case "invalid_element":
return `Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${issue2.origin}`;
default:
return "\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";
}
};
};
function yo_default() {
return {
localeError: error47()
};
}
// node_modules/zod/v4/core/registries.js
var _a;
var $output = Symbol("ZodOutput");
var $input = Symbol("ZodInput");
class $ZodRegistry {
constructor() {
this._map = new WeakMap;
this._idmap = new Map;
}
add(schema2, ..._meta) {
const meta = _meta[0];
this._map.set(schema2, meta);
if (meta && typeof meta === "object" && "id" in meta) {
this._idmap.set(meta.id, schema2);
}
return this;
}
clear() {
this._map = new WeakMap;
this._idmap = new Map;
return this;
}
remove(schema2) {
const meta = this._map.get(schema2);
if (meta && typeof meta === "object" && "id" in meta) {
this._idmap.delete(meta.id);
}
this._map.delete(schema2);
return this;
}
get(schema2) {
const p2 = schema2._zod.parent;
if (p2) {
const pm = { ...this.get(p2) ?? {} };
delete pm.id;
const f = { ...pm, ...this._map.get(schema2) };
return Object.keys(f).length ? f : undefined;
}
return this._map.get(schema2);
}
has(schema2) {
return this._map.has(schema2);
}
}
function registry() {
return new $ZodRegistry;
}
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
var globalRegistry = globalThis.__zod_globalRegistry;
// node_modules/zod/v4/core/api.js
function _string(Class2, params) {
return new Class2({
type: "string",
...normalizeParams(params)
});
}
function _coercedString(Class2, params) {
return new Class2({
type: "string",
coerce: true,
...normalizeParams(params)
});
}
function _email(Class2, params) {
return new Class2({
type: "string",
format: "email",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _guid(Class2, params) {
return new Class2({
type: "string",
format: "guid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _uuid(Class2, params) {
return new Class2({
type: "string",
format: "uuid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _uuidv4(Class2, params) {
return new Class2({
type: "string",
format: "uuid",
check: "string_format",
abort: false,
version: "v4",
...normalizeParams(params)
});
}
function _uuidv6(Class2, params) {
return new Class2({
type: "string",
format: "uuid",
check: "string_format",
abort: false,
version: "v6",
...normalizeParams(params)
});
}
function _uuidv7(Class2, params) {
return new Class2({
type: "string",
format: "uuid",
check: "string_format",
abort: false,
version: "v7",
...normalizeParams(params)
});
}
function _url(Class2, params) {
return new Class2({
type: "string",
format: "url",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _emoji2(Class2, params) {
return new Class2({
type: "string",
format: "emoji",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _nanoid(Class2, params) {
return new Class2({
type: "string",
format: "nanoid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _cuid(Class2, params) {
return new Class2({
type: "string",
format: "cuid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _cuid2(Class2, params) {
return new Class2({
type: "string",
format: "cuid2",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _ulid(Class2, params) {
return new Class2({
type: "string",
format: "ulid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _xid(Class2, params) {
return new Class2({
type: "string",
format: "xid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _ksuid(Class2, params) {
return new Class2({
type: "string",
format: "ksuid",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _ipv4(Class2, params) {
return new Class2({
type: "string",
format: "ipv4",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _ipv6(Class2, params) {
return new Class2({
type: "string",
format: "ipv6",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _mac(Class2, params) {
return new Class2({
type: "string",
format: "mac",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _cidrv4(Class2, params) {
return new Class2({
type: "string",
format: "cidrv4",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _cidrv6(Class2, params) {
return new Class2({
type: "string",
format: "cidrv6",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _base64(Class2, params) {
return new Class2({
type: "string",
format: "base64",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _base64url(Class2, params) {
return new Class2({
type: "string",
format: "base64url",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _e164(Class2, params) {
return new Class2({
type: "string",
format: "e164",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
function _jwt(Class2, params) {
return new Class2({
type: "string",
format: "jwt",
check: "string_format",
abort: false,
...normalizeParams(params)
});
}
var TimePrecision = {
Any: null,
Minute: -1,
Second: 0,
Millisecond: 3,
Microsecond: 6
};
function _isoDateTime(Class2, params) {
return new Class2({
type: "string",
format: "datetime",
check: "string_format",
offset: false,
local: false,
precision: null,
...normalizeParams(params)
});
}
function _isoDate(Class2, params) {
return new Class2({
type: "string",
format: "date",
check: "string_format",
...normalizeParams(params)
});
}
function _isoTime(Class2, params) {
return new Class2({
type: "string",
format: "time",
check: "string_format",
precision: null,
...normalizeParams(params)
});
}
function _isoDuration(Class2, params) {
return new Class2({
type: "string",
format: "duration",
check: "string_format",
...normalizeParams(params)
});
}
function _number(Class2, params) {
return new Class2({
type: "number",
checks: [],
...normalizeParams(params)
});
}
function _coercedNumber(Class2, params) {
return new Class2({
type: "number",
coerce: true,
checks: [],
...normalizeParams(params)
});
}
function _int(Class2, params) {
return new Class2({
type: "number",
check: "number_format",
abort: false,
format: "safeint",
...normalizeParams(params)
});
}
function _float32(Class2, params) {
return new Class2({
type: "number",
check: "number_format",
abort: false,
format: "float32",
...normalizeParams(params)
});
}
function _float64(Class2, params) {
return new Class2({
type: "number",
check: "number_format",
abort: false,
format: "float64",
...normalizeParams(params)
});
}
function _int32(Class2, params) {
return new Class2({
type: "number",
check: "number_format",
abort: false,
format: "int32",
...normalizeParams(params)
});
}
function _uint32(Class2, params) {
return new Class2({
type: "number",
check: "number_format",
abort: false,
format: "uint32",
...normalizeParams(params)
});
}
function _boolean(Class2, params) {
return new Class2({
type: "boolean",
...normalizeParams(params)
});
}
function _coercedBoolean(Class2, params) {
return new Class2({
type: "boolean",
coerce: true,
...normalizeParams(params)
});
}
function _bigint(Class2, params) {
return new Class2({
type: "bigint",
...normalizeParams(params)
});
}
function _coercedBigint(Class2, params) {
return new Class2({
type: "bigint",
coerce: true,
...normalizeParams(params)
});
}
function _int64(Class2, params) {
return new Class2({
type: "bigint",
check: "bigint_format",
abort: false,
format: "int64",
...normalizeParams(params)
});
}
function _uint64(Class2, params) {
return new Class2({
type: "bigint",
check: "bigint_format",
abort: false,
format: "uint64",
...normalizeParams(params)
});
}
function _symbol(Class2, params) {
return new Class2({
type: "symbol",
...normalizeParams(params)
});
}
function _undefined2(Class2, params) {
return new Class2({
type: "undefined",
...normalizeParams(params)
});
}
function _null3(Class2, params) {
return new Class2({
type: "null",
...normalizeParams(params)
});
}
function _any(Class2) {
return new Class2({
type: "any"
});
}
function _unknown(Class2) {
return new Class2({
type: "unknown"
});
}
function _never(Class2, params) {
return new Class2({
type: "never",
...normalizeParams(params)
});
}
function _void(Class2, params) {
return new Class2({
type: "void",
...normalizeParams(params)
});
}
function _date(Class2, params) {
return new Class2({
type: "date",
...normalizeParams(params)
});
}
function _coercedDate(Class2, params) {
return new Class2({
type: "date",
coerce: true,
...normalizeParams(params)
});
}
function _nan(Class2, params) {
return new Class2({
type: "nan",
...normalizeParams(params)
});
}
function _lt(value, params) {
return new $ZodCheckLessThan({
check: "less_than",
...normalizeParams(params),
value,
inclusive: false
});
}
function _lte(value, params) {
return new $ZodCheckLessThan({
check: "less_than",
...normalizeParams(params),
value,
inclusive: true
});
}
function _gt(value, params) {
return new $ZodCheckGreaterThan({
check: "greater_than",
...normalizeParams(params),
value,
inclusive: false
});
}
function _gte(value, params) {
return new $ZodCheckGreaterThan({
check: "greater_than",
...normalizeParams(params),
value,
inclusive: true
});
}
function _positive(params) {
return _gt(0, params);
}
function _negative(params) {
return _lt(0, params);
}
function _nonpositive(params) {
return _lte(0, params);
}
function _nonnegative(params) {
return _gte(0, params);
}
function _multipleOf(value, params) {
return new $ZodCheckMultipleOf({
check: "multiple_of",
...normalizeParams(params),
value
});
}
function _maxSize(maximum, params) {
return new $ZodCheckMaxSize({
check: "max_size",
...normalizeParams(params),
maximum
});
}
function _minSize(minimum, params) {
return new $ZodCheckMinSize({
check: "min_size",
...normalizeParams(params),
minimum
});
}
function _size(size, params) {
return new $ZodCheckSizeEquals({
check: "size_equals",
...normalizeParams(params),
size
});
}
function _maxLength(maximum, params) {
const ch = new $ZodCheckMaxLength({
check: "max_length",
...normalizeParams(params),
maximum
});
return ch;
}
function _minLength(minimum, params) {
return new $ZodCheckMinLength({
check: "min_length",
...normalizeParams(params),
minimum
});
}
function _length(length, params) {
return new $ZodCheckLengthEquals({
check: "length_equals",
...normalizeParams(params),
length
});
}
function _regex(pattern, params) {
return new $ZodCheckRegex({
check: "string_format",
format: "regex",
...normalizeParams(params),
pattern
});
}
function _lowercase(params) {
return new $ZodCheckLowerCase({
check: "string_format",
format: "lowercase",
...normalizeParams(params)
});
}
function _uppercase(params) {
return new $ZodCheckUpperCase({
check: "string_format",
format: "uppercase",
...normalizeParams(params)
});
}
function _includes(includes, params) {
return new $ZodCheckIncludes({
check: "string_format",
format: "includes",
...normalizeParams(params),
includes
});
}
function _startsWith(prefix, params) {
return new $ZodCheckStartsWith({
check: "string_format",
format: "starts_with",
...normalizeParams(params),
prefix
});
}
function _endsWith(suffix, params) {
return new $ZodCheckEndsWith({
check: "string_format",
format: "ends_with",
...normalizeParams(params),
suffix
});
}
function _property(property, schema2, params) {
return new $ZodCheckProperty({
check: "property",
property,
schema: schema2,
...normalizeParams(params)
});
}
function _mime(types4, params) {
return new $ZodCheckMimeType({
check: "mime_type",
mime: types4,
...normalizeParams(params)
});
}
function _overwrite(tx) {
return new $ZodCheckOverwrite({
check: "overwrite",
tx
});
}
function _normalize(form) {
return _overwrite((input) => input.normalize(form));
}
function _trim() {
return _overwrite((input) => input.trim());
}
function _toLowerCase() {
return _overwrite((input) => input.toLowerCase());
}
function _toUpperCase() {
return _overwrite((input) => input.toUpperCase());
}
function _slugify() {
return _overwrite((input) => slugify(input));
}
function _array(Class2, element, params) {
return new Class2({
type: "array",
element,
...normalizeParams(params)
});
}
function _union(Class2, options, params) {
return new Class2({
type: "union",
options,
...normalizeParams(params)
});
}
function _xor(Class2, options, params) {
return new Class2({
type: "union",
options,
inclusive: false,
...normalizeParams(params)
});
}
function _discriminatedUnion(Class2, discriminator, options, params) {
return new Class2({
type: "union",
options,
discriminator,
...normalizeParams(params)
});
}
function _intersection(Class2, left, right) {
return new Class2({
type: "intersection",
left,
right
});
}
function _tuple(Class2, items, _paramsOrRest, _params) {
const hasRest = _paramsOrRest instanceof $ZodType;
const params = hasRest ? _params : _paramsOrRest;
const rest = hasRest ? _paramsOrRest : null;
return new Class2({
type: "tuple",
items,
rest,
...normalizeParams(params)
});
}
function _record(Class2, keyType, valueType, params) {
return new Class2({
type: "record",
keyType,
valueType,
...normalizeParams(params)
});
}
function _map(Class2, keyType, valueType, params) {
return new Class2({
type: "map",
keyType,
valueType,
...normalizeParams(params)
});
}
function _set(Class2, valueType, params) {
return new Class2({
type: "set",
valueType,
...normalizeParams(params)
});
}
function _enum(Class2, values, params) {
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
return new Class2({
type: "enum",
entries,
...normalizeParams(params)
});
}
function _nativeEnum(Class2, entries, params) {
return new Class2({
type: "enum",
entries,
...normalizeParams(params)
});
}
function _literal(Class2, value, params) {
return new Class2({
type: "literal",
values: Array.isArray(value) ? value : [value],
...normalizeParams(params)
});
}
function _file(Class2, params) {
return new Class2({
type: "file",
...normalizeParams(params)
});
}
function _transform(Class2, fn) {
return new Class2({
type: "transform",
transform: fn
});
}
function _optional(Class2, innerType) {
return new Class2({
type: "optional",
innerType
});
}
function _nullable(Class2, innerType) {
return new Class2({
type: "nullable",
innerType
});
}
function _default2(Class2, innerType, defaultValue) {
return new Class2({
type: "default",
innerType,
get defaultValue() {
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
}
});
}
function _nonoptional(Class2, innerType, params) {
return new Class2({
type: "nonoptional",
innerType,
...normalizeParams(params)
});
}
function _success(Class2, innerType) {
return new Class2({
type: "success",
innerType
});
}
function _catch(Class2, innerType, catchValue) {
return new Class2({
type: "catch",
innerType,
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
});
}
function _pipe(Class2, in_, out) {
return new Class2({
type: "pipe",
in: in_,
out
});
}
function _readonly(Class2, innerType) {
return new Class2({
type: "readonly",
innerType
});
}
function _templateLiteral(Class2, parts, params) {
return new Class2({
type: "template_literal",
parts,
...normalizeParams(params)
});
}
function _lazy(Class2, getter) {
return new Class2({
type: "lazy",
getter
});
}
function _promise(Class2, innerType) {
return new Class2({
type: "promise",
innerType
});
}
function _custom(Class2, fn, _params) {
const norm = normalizeParams(_params);
norm.abort ?? (norm.abort = true);
const schema2 = new Class2({
type: "custom",
check: "custom",
fn,
...norm
});
return schema2;
}
function _refine(Class2, fn, _params) {
const schema2 = new Class2({
type: "custom",
check: "custom",
fn,
...normalizeParams(_params)
});
return schema2;
}
function _superRefine(fn) {
const ch = _check((payload) => {
payload.addIssue = (issue2) => {
if (typeof issue2 === "string") {
payload.issues.push(issue(issue2, payload.value, ch._zod.def));
} else {
const _issue = issue2;
if (_issue.fatal)
_issue.continue = false;
_issue.code ?? (_issue.code = "custom");
_issue.input ?? (_issue.input = payload.value);
_issue.inst ?? (_issue.inst = ch);
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
payload.issues.push(issue(_issue));
}
};
return fn(payload.value, payload);
});
return ch;
}
function _check(fn, params) {
const ch = new $ZodCheck({
check: "custom",
...normalizeParams(params)
});
ch._zod.check = fn;
return ch;
}
function describe(description) {
const ch = new $ZodCheck({ check: "describe" });
ch._zod.onattach = [
(inst) => {
const existing = globalRegistry.get(inst) ?? {};
globalRegistry.add(inst, { ...existing, description });
}
];
ch._zod.check = () => {};
return ch;
}
function meta(metadata) {
const ch = new $ZodCheck({ check: "meta" });
ch._zod.onattach = [
(inst) => {
const existing = globalRegistry.get(inst) ?? {};
globalRegistry.add(inst, { ...existing, ...metadata });
}
];
ch._zod.check = () => {};
return ch;
}
function _stringbool(Classes, _params) {
const params = normalizeParams(_params);
let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"];
if (params.case !== "sensitive") {
truthyArray = truthyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
falsyArray = falsyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v);
}
const truthySet = new Set(truthyArray);
const falsySet = new Set(falsyArray);
const _Codec = Classes.Codec ?? $ZodCodec;
const _Boolean = Classes.Boolean ?? $ZodBoolean;
const _String = Classes.String ?? $ZodString;
const stringSchema = new _String({ type: "string", error: params.error });
const booleanSchema = new _Boolean({ type: "boolean", error: params.error });
const codec = new _Codec({
type: "pipe",
in: stringSchema,
out: booleanSchema,
transform: (input, payload) => {
let data = input;
if (params.case !== "sensitive")
data = data.toLowerCase();
if (truthySet.has(data)) {
return true;
} else if (falsySet.has(data)) {
return false;
} else {
payload.issues.push({
code: "invalid_value",
expected: "stringbool",
values: [...truthySet, ...falsySet],
input: payload.value,
inst: codec,
continue: false
});
return {};
}
},
reverseTransform: (input, _payload) => {
if (input === true) {
return truthyArray[0] || "true";
} else {
return falsyArray[0] || "false";
}
},
error: params.error
});
return codec;
}
function _stringFormat(Class2, format2, fnOrRegex, _params = {}) {
const params = normalizeParams(_params);
const def = {
...normalizeParams(_params),
check: "string_format",
type: "string",
format: format2,
fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
...params
};
if (fnOrRegex instanceof RegExp) {
def.pattern = fnOrRegex;
}
const inst = new Class2(def);
return inst;
}
// node_modules/zod/v4/core/to-json-schema.js
function initializeContext(params) {
let target = params?.target ?? "draft-2020-12";
if (target === "draft-4")
target = "draft-04";
if (target === "draft-7")
target = "draft-07";
return {
processors: params.processors ?? {},
metadataRegistry: params?.metadata ?? globalRegistry,
target,
unrepresentable: params?.unrepresentable ?? "throw",
override: params?.override ?? (() => {}),
io: params?.io ?? "output",
counter: 0,
seen: new Map,
cycles: params?.cycles ?? "ref",
reused: params?.reused ?? "inline",
external: params?.external ?? undefined
};
}
function process2(schema2, ctx, _params = { path: [], schemaPath: [] }) {
var _a2;
const def = schema2._zod.def;
const seen = ctx.seen.get(schema2);
if (seen) {
seen.count++;
const isCycle = _params.schemaPath.includes(schema2);
if (isCycle) {
seen.cycle = _params.path;
}
return seen.schema;
}
const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
ctx.seen.set(schema2, result);
const overrideSchema = schema2._zod.toJSONSchema?.();
if (overrideSchema) {
result.schema = overrideSchema;
} else {
const params = {
..._params,
schemaPath: [..._params.schemaPath, schema2],
path: _params.path
};
if (schema2._zod.processJSONSchema) {
schema2._zod.processJSONSchema(ctx, result.schema, params);
} else {
const _json = result.schema;
const processor = ctx.processors[def.type];
if (!processor) {
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
}
processor(schema2, ctx, _json, params);
}
const parent = schema2._zod.parent;
if (parent) {
if (!result.ref)
result.ref = parent;
process2(parent, ctx, params);
ctx.seen.get(parent).isParent = true;
}
}
const meta2 = ctx.metadataRegistry.get(schema2);
if (meta2)
Object.assign(result.schema, meta2);
if (ctx.io === "input" && isTransforming(schema2)) {
delete result.schema.examples;
delete result.schema.default;
}
if (ctx.io === "input" && result.schema._prefault)
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
delete result.schema._prefault;
const _result = ctx.seen.get(schema2);
return _result.schema;
}
function extractDefs(ctx, schema2) {
const root = ctx.seen.get(schema2);
if (!root)
throw new Error("Unprocessed schema. This is a bug in Zod.");
const idToSchema = new Map;
for (const entry of ctx.seen.entries()) {
const id = ctx.metadataRegistry.get(entry[0])?.id;
if (id) {
const existing = idToSchema.get(id);
if (existing && existing !== entry[0]) {
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
}
idToSchema.set(id, entry[0]);
}
}
const makeURI = (entry) => {
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
if (ctx.external) {
const externalId = ctx.external.registry.get(entry[0])?.id;
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
if (externalId) {
return { ref: uriGenerator(externalId) };
}
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
entry[1].defId = id;
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
}
if (entry[1] === root) {
return { ref: "#" };
}
const uriPrefix = `#`;
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
return { defId, ref: defUriPrefix + defId };
};
const extractToDef = (entry) => {
if (entry[1].schema.$ref) {
return;
}
const seen = entry[1];
const { ref, defId } = makeURI(entry);
seen.def = { ...seen.schema };
if (defId)
seen.defId = defId;
const schema3 = seen.schema;
for (const key in schema3) {
delete schema3[key];
}
schema3.$ref = ref;
};
if (ctx.cycles === "throw") {
for (const entry of ctx.seen.entries()) {
const seen = entry[1];
if (seen.cycle) {
throw new Error("Cycle detected: " + `#/${seen.cycle?.join("/")}/<root>` + '\n\nSet the `cycles` parameter to `"ref"` to resolve cyclical schemas with defs.');
}
}
}
for (const entry of ctx.seen.entries()) {
const seen = entry[1];
if (schema2 === entry[0]) {
extractToDef(entry);
continue;
}
if (ctx.external) {
const ext = ctx.external.registry.get(entry[0])?.id;
if (schema2 !== entry[0] && ext) {
extractToDef(entry);
continue;
}
}
const id = ctx.metadataRegistry.get(entry[0])?.id;
if (id) {
extractToDef(entry);
continue;
}
if (seen.cycle) {
extractToDef(entry);
continue;
}
if (seen.count > 1) {
if (ctx.reused === "ref") {
extractToDef(entry);
continue;
}
}
}
}
function finalize(ctx, schema2) {
const root = ctx.seen.get(schema2);
if (!root)
throw new Error("Unprocessed schema. This is a bug in Zod.");
const flattenRef = (zodSchema) => {
const seen = ctx.seen.get(zodSchema);
if (seen.ref === null)
return;
const schema3 = seen.def ?? seen.schema;
const _cached = { ...schema3 };
const ref = seen.ref;
seen.ref = null;
if (ref) {
flattenRef(ref);
const refSeen = ctx.seen.get(ref);
const refSchema = refSeen.schema;
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
schema3.allOf = schema3.allOf ?? [];
schema3.allOf.push(refSchema);
} else {
Object.assign(schema3, refSchema);
}
Object.assign(schema3, _cached);
const isParentRef = zodSchema._zod.parent === ref;
if (isParentRef) {
for (const key in schema3) {
if (key === "$ref" || key === "allOf")
continue;
if (!(key in _cached)) {
delete schema3[key];
}
}
}
if (refSchema.$ref && refSeen.def) {
for (const key in schema3) {
if (key === "$ref" || key === "allOf")
continue;
if (key in refSeen.def && JSON.stringify(schema3[key]) === JSON.stringify(refSeen.def[key])) {
delete schema3[key];
}
}
}
}
const parent = zodSchema._zod.parent;
if (parent && parent !== ref) {
flattenRef(parent);
const parentSeen = ctx.seen.get(parent);
if (parentSeen?.schema.$ref) {
schema3.$ref = parentSeen.schema.$ref;
if (parentSeen.def) {
for (const key in schema3) {
if (key === "$ref" || key === "allOf")
continue;
if (key in parentSeen.def && JSON.stringify(schema3[key]) === JSON.stringify(parentSeen.def[key])) {
delete schema3[key];
}
}
}
}
}
ctx.override({
zodSchema,
jsonSchema: schema3,
path: seen.path ?? []
});
};
for (const entry of [...ctx.seen.entries()].reverse()) {
flattenRef(entry[0]);
}
const result = {};
if (ctx.target === "draft-2020-12") {
result.$schema = "https://json-schema.org/draft/2020-12/schema";
} else if (ctx.target === "draft-07") {
result.$schema = "http://json-schema.org/draft-07/schema#";
} else if (ctx.target === "draft-04") {
result.$schema = "http://json-schema.org/draft-04/schema#";
} else if (ctx.target === "openapi-3.0") {} else {}
if (ctx.external?.uri) {
const id = ctx.external.registry.get(schema2)?.id;
if (!id)
throw new Error("Schema is missing an `id` property");
result.$id = ctx.external.uri(id);
}
Object.assign(result, root.def ?? root.schema);
const defs = ctx.external?.defs ?? {};
for (const entry of ctx.seen.entries()) {
const seen = entry[1];
if (seen.def && seen.defId) {
defs[seen.defId] = seen.def;
}
}
if (ctx.external) {} else {
if (Object.keys(defs).length > 0) {
if (ctx.target === "draft-2020-12") {
result.$defs = defs;
} else {
result.definitions = defs;
}
}
}
try {
const finalized = JSON.parse(JSON.stringify(result));
Object.defineProperty(finalized, "~standard", {
value: {
...schema2["~standard"],
jsonSchema: {
input: createStandardJSONSchemaMethod(schema2, "input", ctx.processors),
output: createStandardJSONSchemaMethod(schema2, "output", ctx.processors)
}
},
enumerable: false,
writable: false
});
return finalized;
} catch (_err) {
throw new Error("Error converting schema to JSON.");
}
}
function isTransforming(_schema, _ctx) {
const ctx = _ctx ?? { seen: new Set };
if (ctx.seen.has(_schema))
return false;
ctx.seen.add(_schema);
const def = _schema._zod.def;
if (def.type === "transform")
return true;
if (def.type === "array")
return isTransforming(def.element, ctx);
if (def.type === "set")
return isTransforming(def.valueType, ctx);
if (def.type === "lazy")
return isTransforming(def.getter(), ctx);
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
return isTransforming(def.innerType, ctx);
}
if (def.type === "intersection") {
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
}
if (def.type === "record" || def.type === "map") {
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
}
if (def.type === "pipe") {
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
}
if (def.type === "object") {
for (const key in def.shape) {
if (isTransforming(def.shape[key], ctx))
return true;
}
return false;
}
if (def.type === "union") {
for (const option of def.options) {
if (isTransforming(option, ctx))
return true;
}
return false;
}
if (def.type === "tuple") {
for (const item of def.items) {
if (isTransforming(item, ctx))
return true;
}
if (def.rest && isTransforming(def.rest, ctx))
return true;
return false;
}
return false;
}
var createToJSONSchemaMethod = (schema2, processors = {}) => (params) => {
const ctx = initializeContext({ ...params, processors });
process2(schema2, ctx);
extractDefs(ctx, schema2);
return finalize(ctx, schema2);
};
var createStandardJSONSchemaMethod = (schema2, io, processors = {}) => (params) => {
const { libraryOptions, target } = params ?? {};
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
process2(schema2, ctx);
extractDefs(ctx, schema2);
return finalize(ctx, schema2);
};
// node_modules/zod/v4/core/json-schema-processors.js
var formatMap = {
guid: "uuid",
url: "uri",
datetime: "date-time",
json_string: "json-string",
regex: ""
};
var stringProcessor = (schema2, ctx, _json, _params) => {
const json2 = _json;
json2.type = "string";
const { minimum, maximum, format: format2, patterns, contentEncoding } = schema2._zod.bag;
if (typeof minimum === "number")
json2.minLength = minimum;
if (typeof maximum === "number")
json2.maxLength = maximum;
if (format2) {
json2.format = formatMap[format2] ?? format2;
if (json2.format === "")
delete json2.format;
if (format2 === "time") {
delete json2.format;
}
}
if (contentEncoding)
json2.contentEncoding = contentEncoding;
if (patterns && patterns.size > 0) {
const regexes = [...patterns];
if (regexes.length === 1)
json2.pattern = regexes[0].source;
else if (regexes.length > 1) {
json2.allOf = [
...regexes.map((regex) => ({
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
pattern: regex.source
}))
];
}
}
};
var numberProcessor = (schema2, ctx, _json, _params) => {
const json2 = _json;
const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema2._zod.bag;
if (typeof format2 === "string" && format2.includes("int"))
json2.type = "integer";
else
json2.type = "number";
if (typeof exclusiveMinimum === "number") {
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
json2.minimum = exclusiveMinimum;
json2.exclusiveMinimum = true;
} else {
json2.exclusiveMinimum = exclusiveMinimum;
}
}
if (typeof minimum === "number") {
json2.minimum = minimum;
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
if (exclusiveMinimum >= minimum)
delete json2.minimum;
else
delete json2.exclusiveMinimum;
}
}
if (typeof exclusiveMaximum === "number") {
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
json2.maximum = exclusiveMaximum;
json2.exclusiveMaximum = true;
} else {
json2.exclusiveMaximum = exclusiveMaximum;
}
}
if (typeof maximum === "number") {
json2.maximum = maximum;
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
if (exclusiveMaximum <= maximum)
delete json2.maximum;
else
delete json2.exclusiveMaximum;
}
}
if (typeof multipleOf === "number")
json2.multipleOf = multipleOf;
};
var booleanProcessor = (_schema, _ctx, json2, _params) => {
json2.type = "boolean";
};
var bigintProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("BigInt cannot be represented in JSON Schema");
}
};
var symbolProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Symbols cannot be represented in JSON Schema");
}
};
var nullProcessor = (_schema, ctx, json2, _params) => {
if (ctx.target === "openapi-3.0") {
json2.type = "string";
json2.nullable = true;
json2.enum = [null];
} else {
json2.type = "null";
}
};
var undefinedProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Undefined cannot be represented in JSON Schema");
}
};
var voidProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Void cannot be represented in JSON Schema");
}
};
var neverProcessor = (_schema, _ctx, json2, _params) => {
json2.not = {};
};
var anyProcessor = (_schema, _ctx, _json, _params) => {};
var unknownProcessor = (_schema, _ctx, _json, _params) => {};
var dateProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Date cannot be represented in JSON Schema");
}
};
var enumProcessor = (schema2, _ctx, json2, _params) => {
const def = schema2._zod.def;
const values = getEnumValues(def.entries);
if (values.every((v) => typeof v === "number"))
json2.type = "number";
if (values.every((v) => typeof v === "string"))
json2.type = "string";
json2.enum = values;
};
var literalProcessor = (schema2, ctx, json2, _params) => {
const def = schema2._zod.def;
const vals = [];
for (const val of def.values) {
if (val === undefined) {
if (ctx.unrepresentable === "throw") {
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
} else {}
} else if (typeof val === "bigint") {
if (ctx.unrepresentable === "throw") {
throw new Error("BigInt literals cannot be represented in JSON Schema");
} else {
vals.push(Number(val));
}
} else {
vals.push(val);
}
}
if (vals.length === 0) {} else if (vals.length === 1) {
const val = vals[0];
json2.type = val === null ? "null" : typeof val;
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
json2.enum = [val];
} else {
json2.const = val;
}
} else {
if (vals.every((v) => typeof v === "number"))
json2.type = "number";
if (vals.every((v) => typeof v === "string"))
json2.type = "string";
if (vals.every((v) => typeof v === "boolean"))
json2.type = "boolean";
if (vals.every((v) => v === null))
json2.type = "null";
json2.enum = vals;
}
};
var nanProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("NaN cannot be represented in JSON Schema");
}
};
var templateLiteralProcessor = (schema2, _ctx, json2, _params) => {
const _json = json2;
const pattern = schema2._zod.pattern;
if (!pattern)
throw new Error("Pattern not found in template literal");
_json.type = "string";
_json.pattern = pattern.source;
};
var fileProcessor = (schema2, _ctx, json2, _params) => {
const _json = json2;
const file = {
type: "string",
format: "binary",
contentEncoding: "binary"
};
const { minimum, maximum, mime } = schema2._zod.bag;
if (minimum !== undefined)
file.minLength = minimum;
if (maximum !== undefined)
file.maxLength = maximum;
if (mime) {
if (mime.length === 1) {
file.contentMediaType = mime[0];
Object.assign(_json, file);
} else {
Object.assign(_json, file);
_json.anyOf = mime.map((m2) => ({ contentMediaType: m2 }));
}
} else {
Object.assign(_json, file);
}
};
var successProcessor = (_schema, _ctx, json2, _params) => {
json2.type = "boolean";
};
var customProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Custom types cannot be represented in JSON Schema");
}
};
var functionProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Function types cannot be represented in JSON Schema");
}
};
var transformProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Transforms cannot be represented in JSON Schema");
}
};
var mapProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Map cannot be represented in JSON Schema");
}
};
var setProcessor = (_schema, ctx, _json, _params) => {
if (ctx.unrepresentable === "throw") {
throw new Error("Set cannot be represented in JSON Schema");
}
};
var arrayProcessor = (schema2, ctx, _json, params) => {
const json2 = _json;
const def = schema2._zod.def;
const { minimum, maximum } = schema2._zod.bag;
if (typeof minimum === "number")
json2.minItems = minimum;
if (typeof maximum === "number")
json2.maxItems = maximum;
json2.type = "array";
json2.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
};
var objectProcessor = (schema2, ctx, _json, params) => {
const json2 = _json;
const def = schema2._zod.def;
json2.type = "object";
json2.properties = {};
const shape = def.shape;
for (const key in shape) {
json2.properties[key] = process2(shape[key], ctx, {
...params,
path: [...params.path, "properties", key]
});
}
const allKeys = new Set(Object.keys(shape));
const requiredKeys = new Set([...allKeys].filter((key) => {
const v = def.shape[key]._zod;
if (ctx.io === "input") {
return v.optin === undefined;
} else {
return v.optout === undefined;
}
}));
if (requiredKeys.size > 0) {
json2.required = Array.from(requiredKeys);
}
if (def.catchall?._zod.def.type === "never") {
json2.additionalProperties = false;
} else if (!def.catchall) {
if (ctx.io === "output")
json2.additionalProperties = false;
} else if (def.catchall) {
json2.additionalProperties = process2(def.catchall, ctx, {
...params,
path: [...params.path, "additionalProperties"]
});
}
};
var unionProcessor = (schema2, ctx, json2, params) => {
const def = schema2._zod.def;
const isExclusive = def.inclusive === false;
const options = def.options.map((x2, i2) => process2(x2, ctx, {
...params,
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i2]
}));
if (isExclusive) {
json2.oneOf = options;
} else {
json2.anyOf = options;
}
};
var intersectionProcessor = (schema2, ctx, json2, params) => {
const def = schema2._zod.def;
const a = process2(def.left, ctx, {
...params,
path: [...params.path, "allOf", 0]
});
const b3 = process2(def.right, ctx, {
...params,
path: [...params.path, "allOf", 1]
});
const isSimpleIntersection = (val) => ("allOf" in val) && Object.keys(val).length === 1;
const allOf = [
...isSimpleIntersection(a) ? a.allOf : [a],
...isSimpleIntersection(b3) ? b3.allOf : [b3]
];
json2.allOf = allOf;
};
var tupleProcessor = (schema2, ctx, _json, params) => {
const json2 = _json;
const def = schema2._zod.def;
json2.type = "array";
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
const prefixItems = def.items.map((x2, i2) => process2(x2, ctx, {
...params,
path: [...params.path, prefixPath, i2]
}));
const rest = def.rest ? process2(def.rest, ctx, {
...params,
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
}) : null;
if (ctx.target === "draft-2020-12") {
json2.prefixItems = prefixItems;
if (rest) {
json2.items = rest;
}
} else if (ctx.target === "openapi-3.0") {
json2.items = {
anyOf: prefixItems
};
if (rest) {
json2.items.anyOf.push(rest);
}
json2.minItems = prefixItems.length;
if (!rest) {
json2.maxItems = prefixItems.length;
}
} else {
json2.items = prefixItems;
if (rest) {
json2.additionalItems = rest;
}
}
const { minimum, maximum } = schema2._zod.bag;
if (typeof minimum === "number")
json2.minItems = minimum;
if (typeof maximum === "number")
json2.maxItems = maximum;
};
var recordProcessor = (schema2, ctx, _json, params) => {
const json2 = _json;
const def = schema2._zod.def;
json2.type = "object";
const keyType = def.keyType;
const keyBag = keyType._zod.bag;
const patterns = keyBag?.patterns;
if (def.mode === "loose" && patterns && patterns.size > 0) {
const valueSchema = process2(def.valueType, ctx, {
...params,
path: [...params.path, "patternProperties", "*"]
});
json2.patternProperties = {};
for (const pattern of patterns) {
json2.patternProperties[pattern.source] = valueSchema;
}
} else {
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
json2.propertyNames = process2(def.keyType, ctx, {
...params,
path: [...params.path, "propertyNames"]
});
}
json2.additionalProperties = process2(def.valueType, ctx, {
...params,
path: [...params.path, "additionalProperties"]
});
}
const keyValues = keyType._zod.values;
if (keyValues) {
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
if (validKeyValues.length > 0) {
json2.required = validKeyValues;
}
}
};
var nullableProcessor = (schema2, ctx, json2, params) => {
const def = schema2._zod.def;
const inner = process2(def.innerType, ctx, params);
const seen = ctx.seen.get(schema2);
if (ctx.target === "openapi-3.0") {
seen.ref = def.innerType;
json2.nullable = true;
} else {
json2.anyOf = [inner, { type: "null" }];
}
};
var nonoptionalProcessor = (schema2, ctx, _json, params) => {
const def = schema2._zod.def;
process2(def.innerType, ctx, params);
const seen = ctx.seen.get(schema2);
seen.ref = def.innerType;
};
var defaultProcessor = (schema2, ctx, json2, params) => {
const def = schema2._zod.def;
process2(def.innerType, ctx, params);
const seen = ctx.seen.get(schema2);
seen.ref = def.innerType;
json2.default = JSON.parse(JSON.stringify(def.defaultValue));
};
var prefaultProcessor = (schema2, ctx, json2, params) => {
const def = schema2._zod.def;
process2(def.innerType, ctx, params);
const seen = ctx.seen.get(schema2);
seen.ref = def.innerType;
if (ctx.io === "input")
json2._prefault = JSON.parse(JSON.stringify(def.defaultValue));
};
var catchProcessor = (schema2, ctx, json2, params) => {
const def = schema2._zod.def;
process2(def.innerType, ctx, params);
const seen = ctx.seen.get(schema2);
seen.ref = def.innerType;
let catchValue;
try {
catchValue = def.catchValue(undefined);
} catch {
throw new Error("Dynamic catch values are not supported in JSON Schema");
}
json2.default = catchValue;
};
var pipeProcessor = (schema2, ctx, _json, params) => {
const def = schema2._zod.def;
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
process2(innerType, ctx, params);
const seen = ctx.seen.get(schema2);
seen.ref = innerType;
};
var readonlyProcessor = (schema2, ctx, json2, params) => {
const def = schema2._zod.def;
process2(def.innerType, ctx, params);
const seen = ctx.seen.get(schema2);
seen.ref = def.innerType;
json2.readOnly = true;
};
var promiseProcessor = (schema2, ctx, _json, params) => {
const def = schema2._zod.def;
process2(def.innerType, ctx, params);
const seen = ctx.seen.get(schema2);
seen.ref = def.innerType;
};
var optionalProcessor = (schema2, ctx, _json, params) => {
const def = schema2._zod.def;
process2(def.innerType, ctx, params);
const seen = ctx.seen.get(schema2);
seen.ref = def.innerType;
};
var lazyProcessor = (schema2, ctx, _json, params) => {
const innerType = schema2._zod.innerType;
process2(innerType, ctx, params);
const seen = ctx.seen.get(schema2);
seen.ref = innerType;
};
var allProcessors = {
string: stringProcessor,
number: numberProcessor,
boolean: booleanProcessor,
bigint: bigintProcessor,
symbol: symbolProcessor,
null: nullProcessor,
undefined: undefinedProcessor,
void: voidProcessor,
never: neverProcessor,
any: anyProcessor,
unknown: unknownProcessor,
date: dateProcessor,
enum: enumProcessor,
literal: literalProcessor,
nan: nanProcessor,
template_literal: templateLiteralProcessor,
file: fileProcessor,
success: successProcessor,
custom: customProcessor,
function: functionProcessor,
transform: transformProcessor,
map: mapProcessor,
set: setProcessor,
array: arrayProcessor,
object: objectProcessor,
union: unionProcessor,
intersection: intersectionProcessor,
tuple: tupleProcessor,
record: recordProcessor,
nullable: nullableProcessor,
nonoptional: nonoptionalProcessor,
default: defaultProcessor,
prefault: prefaultProcessor,
catch: catchProcessor,
pipe: pipeProcessor,
readonly: readonlyProcessor,
promise: promiseProcessor,
optional: optionalProcessor,
lazy: lazyProcessor
};
function toJSONSchema(input, params) {
if ("_idmap" in input) {
const registry2 = input;
const ctx2 = initializeContext({ ...params, processors: allProcessors });
const defs = {};
for (const entry of registry2._idmap.entries()) {
const [_3, schema2] = entry;
process2(schema2, ctx2);
}
const schemas = {};
const external = {
registry: registry2,
uri: params?.uri,
defs
};
ctx2.external = external;
for (const entry of registry2._idmap.entries()) {
const [key, schema2] = entry;
extractDefs(ctx2, schema2);
schemas[key] = finalize(ctx2, schema2);
}
if (Object.keys(defs).length > 0) {
const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions";
schemas.__shared = {
[defsSegment]: defs
};
}
return { schemas };
}
const ctx = initializeContext({ ...params, processors: allProcessors });
process2(input, ctx);
extractDefs(ctx, input);
return finalize(ctx, input);
}
// node_modules/zod/v4/core/json-schema-generator.js
class JSONSchemaGenerator {
get metadataRegistry() {
return this.ctx.metadataRegistry;
}
get target() {
return this.ctx.target;
}
get unrepresentable() {
return this.ctx.unrepresentable;
}
get override() {
return this.ctx.override;
}
get io() {
return this.ctx.io;
}
get counter() {
return this.ctx.counter;
}
set counter(value) {
this.ctx.counter = value;
}
get seen() {
return this.ctx.seen;
}
constructor(params) {
let normalizedTarget = params?.target ?? "draft-2020-12";
if (normalizedTarget === "draft-4")
normalizedTarget = "draft-04";
if (normalizedTarget === "draft-7")
normalizedTarget = "draft-07";
this.ctx = initializeContext({
processors: allProcessors,
target: normalizedTarget,
...params?.metadata && { metadata: params.metadata },
...params?.unrepresentable && { unrepresentable: params.unrepresentable },
...params?.override && { override: params.override },
...params?.io && { io: params.io }
});
}
process(schema2, _params = { path: [], schemaPath: [] }) {
return process2(schema2, this.ctx, _params);
}
emit(schema2, _params) {
if (_params) {
if (_params.cycles)
this.ctx.cycles = _params.cycles;
if (_params.reused)
this.ctx.reused = _params.reused;
if (_params.external)
this.ctx.external = _params.external;
}
extractDefs(this.ctx, schema2);
const result = finalize(this.ctx, schema2);
const { "~standard": _3, ...plainResult } = result;
return plainResult;
}
}
// node_modules/zod/v4/core/json-schema.js
var exports_json_schema = {};
// node_modules/zod/v4/classic/schemas.js
var exports_schemas2 = {};
__export(exports_schemas2, {
xor: () => xor,
xid: () => xid2,
void: () => _void2,
uuidv7: () => uuidv7,
uuidv6: () => uuidv6,
uuidv4: () => uuidv4,
uuid: () => uuid2,
url: () => url,
unknown: () => unknown,
union: () => union,
undefined: () => _undefined3,
ulid: () => ulid2,
uint64: () => uint64,
uint32: () => uint32,
tuple: () => tuple,
transform: () => transform,
templateLiteral: () => templateLiteral,
symbol: () => symbol,
superRefine: () => superRefine,
success: () => success,
stringbool: () => stringbool,
stringFormat: () => stringFormat,
string: () => string2,
strictObject: () => strictObject,
set: () => set2,
refine: () => refine,
record: () => record,
readonly: () => readonly,
promise: () => promise,
preprocess: () => preprocess,
prefault: () => prefault,
pipe: () => pipe,
partialRecord: () => partialRecord,
optional: () => optional,
object: () => object,
number: () => number2,
nullish: () => nullish2,
nullable: () => nullable,
null: () => _null4,
nonoptional: () => nonoptional,
never: () => never,
nativeEnum: () => nativeEnum,
nanoid: () => nanoid2,
nan: () => nan,
meta: () => meta2,
map: () => map2,
mac: () => mac2,
looseRecord: () => looseRecord,
looseObject: () => looseObject,
literal: () => literal,
lazy: () => lazy,
ksuid: () => ksuid2,
keyof: () => keyof,
jwt: () => jwt,
json: () => json2,
ipv6: () => ipv62,
ipv4: () => ipv42,
intersection: () => intersection,
int64: () => int64,
int32: () => int32,
int: () => int2,
instanceof: () => _instanceof,
httpUrl: () => httpUrl,
hostname: () => hostname2,
hex: () => hex2,
hash: () => hash,
guid: () => guid2,
function: () => _function,
float64: () => float64,
float32: () => float32,
file: () => file,
exactOptional: () => exactOptional,
enum: () => _enum2,
emoji: () => emoji2,
email: () => email2,
e164: () => e1642,
discriminatedUnion: () => discriminatedUnion,
describe: () => describe2,
date: () => date3,
custom: () => custom,
cuid2: () => cuid22,
cuid: () => cuid3,
codec: () => codec,
cidrv6: () => cidrv62,
cidrv4: () => cidrv42,
check: () => check,
catch: () => _catch2,
boolean: () => boolean2,
bigint: () => bigint2,
base64url: () => base64url2,
base64: () => base642,
array: () => array,
any: () => any,
_function: () => _function,
_default: () => _default3,
_ZodString: () => _ZodString,
ZodXor: () => ZodXor,
ZodXID: () => ZodXID,
ZodVoid: () => ZodVoid,
ZodUnknown: () => ZodUnknown,
ZodUnion: () => ZodUnion,
ZodUndefined: () => ZodUndefined,
ZodUUID: () => ZodUUID,
ZodURL: () => ZodURL,
ZodULID: () => ZodULID,
ZodType: () => ZodType,
ZodTuple: () => ZodTuple,
ZodTransform: () => ZodTransform,
ZodTemplateLiteral: () => ZodTemplateLiteral,
ZodSymbol: () => ZodSymbol,
ZodSuccess: () => ZodSuccess,
ZodStringFormat: () => ZodStringFormat,
ZodString: () => ZodString,
ZodSet: () => ZodSet,
ZodRecord: () => ZodRecord,
ZodReadonly: () => ZodReadonly,
ZodPromise: () => ZodPromise,
ZodPrefault: () => ZodPrefault,
ZodPipe: () => ZodPipe,
ZodOptional: () => ZodOptional,
ZodObject: () => ZodObject,
ZodNumberFormat: () => ZodNumberFormat,
ZodNumber: () => ZodNumber,
ZodNullable: () => ZodNullable,
ZodNull: () => ZodNull,
ZodNonOptional: () => ZodNonOptional,
ZodNever: () => ZodNever,
ZodNanoID: () => ZodNanoID,
ZodNaN: () => ZodNaN,
ZodMap: () => ZodMap,
ZodMAC: () => ZodMAC,
ZodLiteral: () => ZodLiteral,
ZodLazy: () => ZodLazy,
ZodKSUID: () => ZodKSUID,
ZodJWT: () => ZodJWT,
ZodIntersection: () => ZodIntersection,
ZodIPv6: () => ZodIPv6,
ZodIPv4: () => ZodIPv4,
ZodGUID: () => ZodGUID,
ZodFunction: () => ZodFunction,
ZodFile: () => ZodFile,
ZodExactOptional: () => ZodExactOptional,
ZodEnum: () => ZodEnum,
ZodEmoji: () => ZodEmoji,
ZodEmail: () => ZodEmail,
ZodE164: () => ZodE164,
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
ZodDefault: () => ZodDefault,
ZodDate: () => ZodDate,
ZodCustomStringFormat: () => ZodCustomStringFormat,
ZodCustom: () => ZodCustom,
ZodCodec: () => ZodCodec,
ZodCatch: () => ZodCatch,
ZodCUID2: () => ZodCUID2,
ZodCUID: () => ZodCUID,
ZodCIDRv6: () => ZodCIDRv6,
ZodCIDRv4: () => ZodCIDRv4,
ZodBoolean: () => ZodBoolean,
ZodBigIntFormat: () => ZodBigIntFormat,
ZodBigInt: () => ZodBigInt,
ZodBase64URL: () => ZodBase64URL,
ZodBase64: () => ZodBase64,
ZodArray: () => ZodArray,
ZodAny: () => ZodAny
});
// node_modules/zod/v4/classic/checks.js
var exports_checks2 = {};
__export(exports_checks2, {
uppercase: () => _uppercase,
trim: () => _trim,
toUpperCase: () => _toUpperCase,
toLowerCase: () => _toLowerCase,
startsWith: () => _startsWith,
slugify: () => _slugify,
size: () => _size,
regex: () => _regex,
property: () => _property,
positive: () => _positive,
overwrite: () => _overwrite,
normalize: () => _normalize,
nonpositive: () => _nonpositive,
nonnegative: () => _nonnegative,
negative: () => _negative,
multipleOf: () => _multipleOf,
minSize: () => _minSize,
minLength: () => _minLength,
mime: () => _mime,
maxSize: () => _maxSize,
maxLength: () => _maxLength,
lte: () => _lte,
lt: () => _lt,
lowercase: () => _lowercase,
length: () => _length,
includes: () => _includes,
gte: () => _gte,
gt: () => _gt,
endsWith: () => _endsWith
});
// node_modules/zod/v4/classic/iso.js
var exports_iso = {};
__export(exports_iso, {
time: () => time2,
duration: () => duration2,
datetime: () => datetime2,
date: () => date2,
ZodISOTime: () => ZodISOTime,
ZodISODuration: () => ZodISODuration,
ZodISODateTime: () => ZodISODateTime,
ZodISODate: () => ZodISODate
});
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
$ZodISODateTime.init(inst, def);
ZodStringFormat.init(inst, def);
});
function datetime2(params) {
return _isoDateTime(ZodISODateTime, params);
}
var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
$ZodISODate.init(inst, def);
ZodStringFormat.init(inst, def);
});
function date2(params) {
return _isoDate(ZodISODate, params);
}
var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
$ZodISOTime.init(inst, def);
ZodStringFormat.init(inst, def);
});
function time2(params) {
return _isoTime(ZodISOTime, params);
}
var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
$ZodISODuration.init(inst, def);
ZodStringFormat.init(inst, def);
});
function duration2(params) {
return _isoDuration(ZodISODuration, params);
}
// node_modules/zod/v4/classic/errors.js
var initializer2 = (inst, issues) => {
$ZodError.init(inst, issues);
inst.name = "ZodError";
Object.defineProperties(inst, {
format: {
value: (mapper) => formatError2(inst, mapper)
},
flatten: {
value: (mapper) => flattenError(inst, mapper)
},
addIssue: {
value: (issue2) => {
inst.issues.push(issue2);
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
}
},
addIssues: {
value: (issues2) => {
inst.issues.push(...issues2);
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
}
},
isEmpty: {
get() {
return inst.issues.length === 0;
}
}
});
};
var ZodError = $constructor("ZodError", initializer2);
var ZodRealError = $constructor("ZodError", initializer2, {
Parent: Error
});
// node_modules/zod/v4/classic/parse.js
var parse5 = /* @__PURE__ */ _parse(ZodRealError);
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
var encode2 = /* @__PURE__ */ _encode(ZodRealError);
var decode2 = /* @__PURE__ */ _decode(ZodRealError);
var encodeAsync2 = /* @__PURE__ */ _encodeAsync(ZodRealError);
var decodeAsync2 = /* @__PURE__ */ _decodeAsync(ZodRealError);
var safeEncode2 = /* @__PURE__ */ _safeEncode(ZodRealError);
var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
// node_modules/zod/v4/classic/schemas.js
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
$ZodType.init(inst, def);
Object.assign(inst["~standard"], {
jsonSchema: {
input: createStandardJSONSchemaMethod(inst, "input"),
output: createStandardJSONSchemaMethod(inst, "output")
}
});
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
inst.def = def;
inst.type = def.type;
Object.defineProperty(inst, "_def", { value: def });
inst.check = (...checks2) => {
return inst.clone(exports_util.mergeDefs(def, {
checks: [
...def.checks ?? [],
...checks2.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
]
}), {
parent: true
});
};
inst.with = inst.check;
inst.clone = (def2, params) => clone(inst, def2, params);
inst.brand = () => inst;
inst.register = (reg, meta2) => {
reg.add(inst, meta2);
return inst;
};
inst.parse = (data, params) => parse5(inst, data, params, { callee: inst.parse });
inst.safeParse = (data, params) => safeParse2(inst, data, params);
inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync });
inst.safeParseAsync = async (data, params) => safeParseAsync2(inst, data, params);
inst.spa = inst.safeParseAsync;
inst.encode = (data, params) => encode2(inst, data, params);
inst.decode = (data, params) => decode2(inst, data, params);
inst.encodeAsync = async (data, params) => encodeAsync2(inst, data, params);
inst.decodeAsync = async (data, params) => decodeAsync2(inst, data, params);
inst.safeEncode = (data, params) => safeEncode2(inst, data, params);
inst.safeDecode = (data, params) => safeDecode2(inst, data, params);
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync2(inst, data, params);
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params);
inst.refine = (check, params) => inst.check(refine(check, params));
inst.superRefine = (refinement) => inst.check(superRefine(refinement));
inst.overwrite = (fn) => inst.check(_overwrite(fn));
inst.optional = () => optional(inst);
inst.exactOptional = () => exactOptional(inst);
inst.nullable = () => nullable(inst);
inst.nullish = () => optional(nullable(inst));
inst.nonoptional = (params) => nonoptional(inst, params);
inst.array = () => array(inst);
inst.or = (arg) => union([inst, arg]);
inst.and = (arg) => intersection(inst, arg);
inst.transform = (tx) => pipe(inst, transform(tx));
inst.default = (def2) => _default3(inst, def2);
inst.prefault = (def2) => prefault(inst, def2);
inst.catch = (params) => _catch2(inst, params);
inst.pipe = (target) => pipe(inst, target);
inst.readonly = () => readonly(inst);
inst.describe = (description) => {
const cl = inst.clone();
globalRegistry.add(cl, { description });
return cl;
};
Object.defineProperty(inst, "description", {
get() {
return globalRegistry.get(inst)?.description;
},
configurable: true
});
inst.meta = (...args) => {
if (args.length === 0) {
return globalRegistry.get(inst);
}
const cl = inst.clone();
globalRegistry.add(cl, args[0]);
return cl;
};
inst.isOptional = () => inst.safeParse(undefined).success;
inst.isNullable = () => inst.safeParse(null).success;
inst.apply = (fn) => fn(inst);
return inst;
});
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
$ZodString.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params);
const bag = inst._zod.bag;
inst.format = bag.format ?? null;
inst.minLength = bag.minimum ?? null;
inst.maxLength = bag.maximum ?? null;
inst.regex = (...args) => inst.check(_regex(...args));
inst.includes = (...args) => inst.check(_includes(...args));
inst.startsWith = (...args) => inst.check(_startsWith(...args));
inst.endsWith = (...args) => inst.check(_endsWith(...args));
inst.min = (...args) => inst.check(_minLength(...args));
inst.max = (...args) => inst.check(_maxLength(...args));
inst.length = (...args) => inst.check(_length(...args));
inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
inst.lowercase = (params) => inst.check(_lowercase(params));
inst.uppercase = (params) => inst.check(_uppercase(params));
inst.trim = () => inst.check(_trim());
inst.normalize = (...args) => inst.check(_normalize(...args));
inst.toLowerCase = () => inst.check(_toLowerCase());
inst.toUpperCase = () => inst.check(_toUpperCase());
inst.slugify = () => inst.check(_slugify());
});
var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
$ZodString.init(inst, def);
_ZodString.init(inst, def);
inst.email = (params) => inst.check(_email(ZodEmail, params));
inst.url = (params) => inst.check(_url(ZodURL, params));
inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params));
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
inst.xid = (params) => inst.check(_xid(ZodXID, params));
inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
inst.e164 = (params) => inst.check(_e164(ZodE164, params));
inst.datetime = (params) => inst.check(datetime2(params));
inst.date = (params) => inst.check(date2(params));
inst.time = (params) => inst.check(time2(params));
inst.duration = (params) => inst.check(duration2(params));
});
function string2(params) {
return _string(ZodString, params);
}
var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
$ZodStringFormat.init(inst, def);
_ZodString.init(inst, def);
});
var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
$ZodEmail.init(inst, def);
ZodStringFormat.init(inst, def);
});
function email2(params) {
return _email(ZodEmail, params);
}
var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
$ZodGUID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function guid2(params) {
return _guid(ZodGUID, params);
}
var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
$ZodUUID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function uuid2(params) {
return _uuid(ZodUUID, params);
}
function uuidv4(params) {
return _uuidv4(ZodUUID, params);
}
function uuidv6(params) {
return _uuidv6(ZodUUID, params);
}
function uuidv7(params) {
return _uuidv7(ZodUUID, params);
}
var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
$ZodURL.init(inst, def);
ZodStringFormat.init(inst, def);
});
function url(params) {
return _url(ZodURL, params);
}
function httpUrl(params) {
return _url(ZodURL, {
protocol: /^https?$/,
hostname: exports_regexes.domain,
...exports_util.normalizeParams(params)
});
}
var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
$ZodEmoji.init(inst, def);
ZodStringFormat.init(inst, def);
});
function emoji2(params) {
return _emoji2(ZodEmoji, params);
}
var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
$ZodNanoID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function nanoid2(params) {
return _nanoid(ZodNanoID, params);
}
var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
$ZodCUID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function cuid3(params) {
return _cuid(ZodCUID, params);
}
var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
$ZodCUID2.init(inst, def);
ZodStringFormat.init(inst, def);
});
function cuid22(params) {
return _cuid2(ZodCUID2, params);
}
var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
$ZodULID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function ulid2(params) {
return _ulid(ZodULID, params);
}
var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
$ZodXID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function xid2(params) {
return _xid(ZodXID, params);
}
var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
$ZodKSUID.init(inst, def);
ZodStringFormat.init(inst, def);
});
function ksuid2(params) {
return _ksuid(ZodKSUID, params);
}
var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
$ZodIPv4.init(inst, def);
ZodStringFormat.init(inst, def);
});
function ipv42(params) {
return _ipv4(ZodIPv4, params);
}
var ZodMAC = /* @__PURE__ */ $constructor("ZodMAC", (inst, def) => {
$ZodMAC.init(inst, def);
ZodStringFormat.init(inst, def);
});
function mac2(params) {
return _mac(ZodMAC, params);
}
var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
$ZodIPv6.init(inst, def);
ZodStringFormat.init(inst, def);
});
function ipv62(params) {
return _ipv6(ZodIPv6, params);
}
var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
$ZodCIDRv4.init(inst, def);
ZodStringFormat.init(inst, def);
});
function cidrv42(params) {
return _cidrv4(ZodCIDRv4, params);
}
var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
$ZodCIDRv6.init(inst, def);
ZodStringFormat.init(inst, def);
});
function cidrv62(params) {
return _cidrv6(ZodCIDRv6, params);
}
var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
$ZodBase64.init(inst, def);
ZodStringFormat.init(inst, def);
});
function base642(params) {
return _base64(ZodBase64, params);
}
var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
$ZodBase64URL.init(inst, def);
ZodStringFormat.init(inst, def);
});
function base64url2(params) {
return _base64url(ZodBase64URL, params);
}
var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
$ZodE164.init(inst, def);
ZodStringFormat.init(inst, def);
});
function e1642(params) {
return _e164(ZodE164, params);
}
var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
$ZodJWT.init(inst, def);
ZodStringFormat.init(inst, def);
});
function jwt(params) {
return _jwt(ZodJWT, params);
}
var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat", (inst, def) => {
$ZodCustomStringFormat.init(inst, def);
ZodStringFormat.init(inst, def);
});
function stringFormat(format2, fnOrRegex, _params = {}) {
return _stringFormat(ZodCustomStringFormat, format2, fnOrRegex, _params);
}
function hostname2(_params) {
return _stringFormat(ZodCustomStringFormat, "hostname", exports_regexes.hostname, _params);
}
function hex2(_params) {
return _stringFormat(ZodCustomStringFormat, "hex", exports_regexes.hex, _params);
}
function hash(alg, params) {
const enc = params?.enc ?? "hex";
const format2 = `${alg}_${enc}`;
const regex = exports_regexes[format2];
if (!regex)
throw new Error(`Unrecognized hash format: ${format2}`);
return _stringFormat(ZodCustomStringFormat, format2, regex, params);
}
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
$ZodNumber.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params);
inst.gt = (value, params) => inst.check(_gt(value, params));
inst.gte = (value, params) => inst.check(_gte(value, params));
inst.min = (value, params) => inst.check(_gte(value, params));
inst.lt = (value, params) => inst.check(_lt(value, params));
inst.lte = (value, params) => inst.check(_lte(value, params));
inst.max = (value, params) => inst.check(_lte(value, params));
inst.int = (params) => inst.check(int2(params));
inst.safe = (params) => inst.check(int2(params));
inst.positive = (params) => inst.check(_gt(0, params));
inst.nonnegative = (params) => inst.check(_gte(0, params));
inst.negative = (params) => inst.check(_lt(0, params));
inst.nonpositive = (params) => inst.check(_lte(0, params));
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
inst.step = (value, params) => inst.check(_multipleOf(value, params));
inst.finite = () => inst;
const bag = inst._zod.bag;
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
inst.isFinite = true;
inst.format = bag.format ?? null;
});
function number2(params) {
return _number(ZodNumber, params);
}
var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
$ZodNumberFormat.init(inst, def);
ZodNumber.init(inst, def);
});
function int2(params) {
return _int(ZodNumberFormat, params);
}
function float32(params) {
return _float32(ZodNumberFormat, params);
}
function float64(params) {
return _float64(ZodNumberFormat, params);
}
function int32(params) {
return _int32(ZodNumberFormat, params);
}
function uint32(params) {
return _uint32(ZodNumberFormat, params);
}
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
$ZodBoolean.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => booleanProcessor(inst, ctx, json2, params);
});
function boolean2(params) {
return _boolean(ZodBoolean, params);
}
var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
$ZodBigInt.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params);
inst.gte = (value, params) => inst.check(_gte(value, params));
inst.min = (value, params) => inst.check(_gte(value, params));
inst.gt = (value, params) => inst.check(_gt(value, params));
inst.gte = (value, params) => inst.check(_gte(value, params));
inst.min = (value, params) => inst.check(_gte(value, params));
inst.lt = (value, params) => inst.check(_lt(value, params));
inst.lte = (value, params) => inst.check(_lte(value, params));
inst.max = (value, params) => inst.check(_lte(value, params));
inst.positive = (params) => inst.check(_gt(BigInt(0), params));
inst.negative = (params) => inst.check(_lt(BigInt(0), params));
inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params));
inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params));
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
const bag = inst._zod.bag;
inst.minValue = bag.minimum ?? null;
inst.maxValue = bag.maximum ?? null;
inst.format = bag.format ?? null;
});
function bigint2(params) {
return _bigint(ZodBigInt, params);
}
var ZodBigIntFormat = /* @__PURE__ */ $constructor("ZodBigIntFormat", (inst, def) => {
$ZodBigIntFormat.init(inst, def);
ZodBigInt.init(inst, def);
});
function int64(params) {
return _int64(ZodBigIntFormat, params);
}
function uint64(params) {
return _uint64(ZodBigIntFormat, params);
}
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
$ZodSymbol.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => symbolProcessor(inst, ctx, json2, params);
});
function symbol(params) {
return _symbol(ZodSymbol, params);
}
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
$ZodUndefined.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => undefinedProcessor(inst, ctx, json2, params);
});
function _undefined3(params) {
return _undefined2(ZodUndefined, params);
}
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
$ZodNull.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => nullProcessor(inst, ctx, json2, params);
});
function _null4(params) {
return _null3(ZodNull, params);
}
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
$ZodAny.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => anyProcessor(inst, ctx, json2, params);
});
function any() {
return _any(ZodAny);
}
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
$ZodUnknown.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => unknownProcessor(inst, ctx, json2, params);
});
function unknown() {
return _unknown(ZodUnknown);
}
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
$ZodNever.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => neverProcessor(inst, ctx, json2, params);
});
function never(params) {
return _never(ZodNever, params);
}
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
$ZodVoid.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => voidProcessor(inst, ctx, json2, params);
});
function _void2(params) {
return _void(ZodVoid, params);
}
var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
$ZodDate.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params);
inst.min = (value, params) => inst.check(_gte(value, params));
inst.max = (value, params) => inst.check(_lte(value, params));
const c = inst._zod.bag;
inst.minDate = c.minimum ? new Date(c.minimum) : null;
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
});
function date3(params) {
return _date(ZodDate, params);
}
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
$ZodArray.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => arrayProcessor(inst, ctx, json2, params);
inst.element = def.element;
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
inst.nonempty = (params) => inst.check(_minLength(1, params));
inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
inst.length = (len, params) => inst.check(_length(len, params));
inst.unwrap = () => inst.element;
});
function array(element, params) {
return _array(ZodArray, element, params);
}
function keyof(schema2) {
const shape = schema2._zod.def.shape;
return _enum2(Object.keys(shape));
}
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
$ZodObjectJIT.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => objectProcessor(inst, ctx, json2, params);
exports_util.defineLazy(inst, "shape", () => {
return def.shape;
});
inst.keyof = () => _enum2(Object.keys(inst._zod.def.shape));
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
inst.extend = (incoming) => {
return exports_util.extend(inst, incoming);
};
inst.safeExtend = (incoming) => {
return exports_util.safeExtend(inst, incoming);
};
inst.merge = (other) => exports_util.merge(inst, other);
inst.pick = (mask) => exports_util.pick(inst, mask);
inst.omit = (mask) => exports_util.omit(inst, mask);
inst.partial = (...args) => exports_util.partial(ZodOptional, inst, args[0]);
inst.required = (...args) => exports_util.required(ZodNonOptional, inst, args[0]);
});
function object(shape, params) {
const def = {
type: "object",
shape: shape ?? {},
...exports_util.normalizeParams(params)
};
return new ZodObject(def);
}
function strictObject(shape, params) {
return new ZodObject({
type: "object",
shape,
catchall: never(),
...exports_util.normalizeParams(params)
});
}
function looseObject(shape, params) {
return new ZodObject({
type: "object",
shape,
catchall: unknown(),
...exports_util.normalizeParams(params)
});
}
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
$ZodUnion.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params);
inst.options = def.options;
});
function union(options, params) {
return new ZodUnion({
type: "union",
options,
...exports_util.normalizeParams(params)
});
}
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
ZodUnion.init(inst, def);
$ZodXor.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params);
inst.options = def.options;
});
function xor(options, params) {
return new ZodXor({
type: "union",
options,
inclusive: false,
...exports_util.normalizeParams(params)
});
}
var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
ZodUnion.init(inst, def);
$ZodDiscriminatedUnion.init(inst, def);
});
function discriminatedUnion(discriminator, options, params) {
return new ZodDiscriminatedUnion({
type: "union",
options,
discriminator,
...exports_util.normalizeParams(params)
});
}
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
$ZodIntersection.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => intersectionProcessor(inst, ctx, json2, params);
});
function intersection(left, right) {
return new ZodIntersection({
type: "intersection",
left,
right
});
}
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
$ZodTuple.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => tupleProcessor(inst, ctx, json2, params);
inst.rest = (rest) => inst.clone({
...inst._zod.def,
rest
});
});
function tuple(items, _paramsOrRest, _params) {
const hasRest = _paramsOrRest instanceof $ZodType;
const params = hasRest ? _params : _paramsOrRest;
const rest = hasRest ? _paramsOrRest : null;
return new ZodTuple({
type: "tuple",
items,
rest,
...exports_util.normalizeParams(params)
});
}
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
$ZodRecord.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => recordProcessor(inst, ctx, json2, params);
inst.keyType = def.keyType;
inst.valueType = def.valueType;
});
function record(keyType, valueType, params) {
return new ZodRecord({
type: "record",
keyType,
valueType,
...exports_util.normalizeParams(params)
});
}
function partialRecord(keyType, valueType, params) {
const k3 = clone(keyType);
k3._zod.values = undefined;
return new ZodRecord({
type: "record",
keyType: k3,
valueType,
...exports_util.normalizeParams(params)
});
}
function looseRecord(keyType, valueType, params) {
return new ZodRecord({
type: "record",
keyType,
valueType,
mode: "loose",
...exports_util.normalizeParams(params)
});
}
var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
$ZodMap.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => mapProcessor(inst, ctx, json2, params);
inst.keyType = def.keyType;
inst.valueType = def.valueType;
inst.min = (...args) => inst.check(_minSize(...args));
inst.nonempty = (params) => inst.check(_minSize(1, params));
inst.max = (...args) => inst.check(_maxSize(...args));
inst.size = (...args) => inst.check(_size(...args));
});
function map2(keyType, valueType, params) {
return new ZodMap({
type: "map",
keyType,
valueType,
...exports_util.normalizeParams(params)
});
}
var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
$ZodSet.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => setProcessor(inst, ctx, json2, params);
inst.min = (...args) => inst.check(_minSize(...args));
inst.nonempty = (params) => inst.check(_minSize(1, params));
inst.max = (...args) => inst.check(_maxSize(...args));
inst.size = (...args) => inst.check(_size(...args));
});
function set2(valueType, params) {
return new ZodSet({
type: "set",
valueType,
...exports_util.normalizeParams(params)
});
}
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
$ZodEnum.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params);
inst.enum = def.entries;
inst.options = Object.values(def.entries);
const keys = new Set(Object.keys(def.entries));
inst.extract = (values, params) => {
const newEntries = {};
for (const value of values) {
if (keys.has(value)) {
newEntries[value] = def.entries[value];
} else
throw new Error(`Key ${value} not found in enum`);
}
return new ZodEnum({
...def,
checks: [],
...exports_util.normalizeParams(params),
entries: newEntries
});
};
inst.exclude = (values, params) => {
const newEntries = { ...def.entries };
for (const value of values) {
if (keys.has(value)) {
delete newEntries[value];
} else
throw new Error(`Key ${value} not found in enum`);
}
return new ZodEnum({
...def,
checks: [],
...exports_util.normalizeParams(params),
entries: newEntries
});
};
});
function _enum2(values, params) {
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
return new ZodEnum({
type: "enum",
entries,
...exports_util.normalizeParams(params)
});
}
function nativeEnum(entries, params) {
return new ZodEnum({
type: "enum",
entries,
...exports_util.normalizeParams(params)
});
}
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
$ZodLiteral.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => literalProcessor(inst, ctx, json2, params);
inst.values = new Set(def.values);
Object.defineProperty(inst, "value", {
get() {
if (def.values.length > 1) {
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
}
return def.values[0];
}
});
});
function literal(value, params) {
return new ZodLiteral({
type: "literal",
values: Array.isArray(value) ? value : [value],
...exports_util.normalizeParams(params)
});
}
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
$ZodFile.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => fileProcessor(inst, ctx, json2, params);
inst.min = (size, params) => inst.check(_minSize(size, params));
inst.max = (size, params) => inst.check(_maxSize(size, params));
inst.mime = (types4, params) => inst.check(_mime(Array.isArray(types4) ? types4 : [types4], params));
});
function file(params) {
return _file(ZodFile, params);
}
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
$ZodTransform.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx, json2, params);
inst._zod.parse = (payload, _ctx) => {
if (_ctx.direction === "backward") {
throw new $ZodEncodeError(inst.constructor.name);
}
payload.addIssue = (issue2) => {
if (typeof issue2 === "string") {
payload.issues.push(exports_util.issue(issue2, payload.value, def));
} else {
const _issue = issue2;
if (_issue.fatal)
_issue.continue = false;
_issue.code ?? (_issue.code = "custom");
_issue.input ?? (_issue.input = payload.value);
_issue.inst ?? (_issue.inst = inst);
payload.issues.push(exports_util.issue(_issue));
}
};
const output = def.transform(payload.value, payload);
if (output instanceof Promise) {
return output.then((output2) => {
payload.value = output2;
return payload;
});
}
payload.value = output;
return payload;
};
});
function transform(fn) {
return new ZodTransform({
type: "transform",
transform: fn
});
}
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
$ZodOptional.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function optional(innerType) {
return new ZodOptional({
type: "optional",
innerType
});
}
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
$ZodExactOptional.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function exactOptional(innerType) {
return new ZodExactOptional({
type: "optional",
innerType
});
}
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
$ZodNullable.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => nullableProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function nullable(innerType) {
return new ZodNullable({
type: "nullable",
innerType
});
}
function nullish2(innerType) {
return optional(nullable(innerType));
}
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
$ZodDefault.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => defaultProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.innerType;
inst.removeDefault = inst.unwrap;
});
function _default3(innerType, defaultValue) {
return new ZodDefault({
type: "default",
innerType,
get defaultValue() {
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
}
});
}
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
$ZodPrefault.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => prefaultProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function prefault(innerType, defaultValue) {
return new ZodPrefault({
type: "prefault",
innerType,
get defaultValue() {
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
}
});
}
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
$ZodNonOptional.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => nonoptionalProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function nonoptional(innerType, params) {
return new ZodNonOptional({
type: "nonoptional",
innerType,
...exports_util.normalizeParams(params)
});
}
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
$ZodSuccess.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => successProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function success(innerType) {
return new ZodSuccess({
type: "success",
innerType
});
}
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
$ZodCatch.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => catchProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.innerType;
inst.removeCatch = inst.unwrap;
});
function _catch2(innerType, catchValue) {
return new ZodCatch({
type: "catch",
innerType,
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
});
}
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
$ZodNaN.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => nanProcessor(inst, ctx, json2, params);
});
function nan(params) {
return _nan(ZodNaN, params);
}
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
$ZodPipe.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => pipeProcessor(inst, ctx, json2, params);
inst.in = def.in;
inst.out = def.out;
});
function pipe(in_, out) {
return new ZodPipe({
type: "pipe",
in: in_,
out
});
}
var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => {
ZodPipe.init(inst, def);
$ZodCodec.init(inst, def);
});
function codec(in_, out, params) {
return new ZodCodec({
type: "pipe",
in: in_,
out,
transform: params.decode,
reverseTransform: params.encode
});
}
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
$ZodReadonly.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => readonlyProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function readonly(innerType) {
return new ZodReadonly({
type: "readonly",
innerType
});
}
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
$ZodTemplateLiteral.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => templateLiteralProcessor(inst, ctx, json2, params);
});
function templateLiteral(parts, params) {
return new ZodTemplateLiteral({
type: "template_literal",
parts,
...exports_util.normalizeParams(params)
});
}
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
$ZodLazy.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => lazyProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.getter();
});
function lazy(getter) {
return new ZodLazy({
type: "lazy",
getter
});
}
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
$ZodPromise.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => promiseProcessor(inst, ctx, json2, params);
inst.unwrap = () => inst._zod.def.innerType;
});
function promise(innerType) {
return new ZodPromise({
type: "promise",
innerType
});
}
var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
$ZodFunction.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => functionProcessor(inst, ctx, json2, params);
});
function _function(params) {
return new ZodFunction({
type: "function",
input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()),
output: params?.output ?? unknown()
});
}
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
$ZodCustom.init(inst, def);
ZodType.init(inst, def);
inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx, json2, params);
});
function check(fn) {
const ch = new $ZodCheck({
check: "custom"
});
ch._zod.check = fn;
return ch;
}
function custom(fn, _params) {
return _custom(ZodCustom, fn ?? (() => true), _params);
}
function refine(fn, _params = {}) {
return _refine(ZodCustom, fn, _params);
}
function superRefine(fn) {
return _superRefine(fn);
}
var describe2 = describe;
var meta2 = meta;
function _instanceof(cls, params = {}) {
const inst = new ZodCustom({
type: "custom",
check: "custom",
fn: (data) => data instanceof cls,
abort: true,
...exports_util.normalizeParams(params)
});
inst._zod.bag.Class = cls;
inst._zod.check = (payload) => {
if (!(payload.value instanceof cls)) {
payload.issues.push({
code: "invalid_type",
expected: cls.name,
input: payload.value,
inst,
path: [...inst._zod.def.path ?? []]
});
}
};
return inst;
}
var stringbool = (...args) => _stringbool({
Codec: ZodCodec,
Boolean: ZodBoolean,
String: ZodString
}, ...args);
function json2(params) {
const jsonSchema = lazy(() => {
return union([string2(params), number2(), boolean2(), _null4(), array(jsonSchema), record(string2(), jsonSchema)]);
});
return jsonSchema;
}
function preprocess(fn, schema2) {
return pipe(transform(fn), schema2);
}
// node_modules/zod/v4/classic/compat.js
var ZodIssueCode = {
invalid_type: "invalid_type",
too_big: "too_big",
too_small: "too_small",
invalid_format: "invalid_format",
not_multiple_of: "not_multiple_of",
unrecognized_keys: "unrecognized_keys",
invalid_union: "invalid_union",
invalid_key: "invalid_key",
invalid_element: "invalid_element",
invalid_value: "invalid_value",
custom: "custom"
};
function setErrorMap(map3) {
config({
customError: map3
});
}
function getErrorMap() {
return config().customError;
}
var ZodFirstPartyTypeKind;
(function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
// node_modules/zod/v4/classic/from-json-schema.js
var z2 = {
...exports_schemas2,
...exports_checks2,
iso: exports_iso
};
var RECOGNIZED_KEYS = new Set([
"$schema",
"$ref",
"$defs",
"definitions",
"$id",
"id",
"$comment",
"$anchor",
"$vocabulary",
"$dynamicRef",
"$dynamicAnchor",
"type",
"enum",
"const",
"anyOf",
"oneOf",
"allOf",
"not",
"properties",
"required",
"additionalProperties",
"patternProperties",
"propertyNames",
"minProperties",
"maxProperties",
"items",
"prefixItems",
"additionalItems",
"minItems",
"maxItems",
"uniqueItems",
"contains",
"minContains",
"maxContains",
"minLength",
"maxLength",
"pattern",
"format",
"minimum",
"maximum",
"exclusiveMinimum",
"exclusiveMaximum",
"multipleOf",
"description",
"default",
"contentEncoding",
"contentMediaType",
"contentSchema",
"unevaluatedItems",
"unevaluatedProperties",
"if",
"then",
"else",
"dependentSchemas",
"dependentRequired",
"nullable",
"readOnly"
]);
function detectVersion(schema2, defaultTarget) {
const $schema = schema2.$schema;
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
return "draft-2020-12";
}
if ($schema === "http://json-schema.org/draft-07/schema#") {
return "draft-7";
}
if ($schema === "http://json-schema.org/draft-04/schema#") {
return "draft-4";
}
return defaultTarget ?? "draft-2020-12";
}
function resolveRef(ref, ctx) {
if (!ref.startsWith("#")) {
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
}
const path3 = ref.slice(1).split("/").filter(Boolean);
if (path3.length === 0) {
return ctx.rootSchema;
}
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
if (path3[0] === defsKey) {
const key = path3[1];
if (!key || !ctx.defs[key]) {
throw new Error(`Reference not found: ${ref}`);
}
return ctx.defs[key];
}
throw new Error(`Reference not found: ${ref}`);
}
function convertBaseSchema(schema2, ctx) {
if (schema2.not !== undefined) {
if (typeof schema2.not === "object" && Object.keys(schema2.not).length === 0) {
return z2.never();
}
throw new Error("not is not supported in Zod (except { not: {} } for never)");
}
if (schema2.unevaluatedItems !== undefined) {
throw new Error("unevaluatedItems is not supported");
}
if (schema2.unevaluatedProperties !== undefined) {
throw new Error("unevaluatedProperties is not supported");
}
if (schema2.if !== undefined || schema2.then !== undefined || schema2.else !== undefined) {
throw new Error("Conditional schemas (if/then/else) are not supported");
}
if (schema2.dependentSchemas !== undefined || schema2.dependentRequired !== undefined) {
throw new Error("dependentSchemas and dependentRequired are not supported");
}
if (schema2.$ref) {
const refPath = schema2.$ref;
if (ctx.refs.has(refPath)) {
return ctx.refs.get(refPath);
}
if (ctx.processing.has(refPath)) {
return z2.lazy(() => {
if (!ctx.refs.has(refPath)) {
throw new Error(`Circular reference not resolved: ${refPath}`);
}
return ctx.refs.get(refPath);
});
}
ctx.processing.add(refPath);
const resolved = resolveRef(refPath, ctx);
const zodSchema2 = convertSchema(resolved, ctx);
ctx.refs.set(refPath, zodSchema2);
ctx.processing.delete(refPath);
return zodSchema2;
}
if (schema2.enum !== undefined) {
const enumValues = schema2.enum;
if (ctx.version === "openapi-3.0" && schema2.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
return z2.null();
}
if (enumValues.length === 0) {
return z2.never();
}
if (enumValues.length === 1) {
return z2.literal(enumValues[0]);
}
if (enumValues.every((v) => typeof v === "string")) {
return z2.enum(enumValues);
}
const literalSchemas = enumValues.map((v) => z2.literal(v));
if (literalSchemas.length < 2) {
return literalSchemas[0];
}
return z2.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
}
if (schema2.const !== undefined) {
return z2.literal(schema2.const);
}
const type2 = schema2.type;
if (Array.isArray(type2)) {
const typeSchemas = type2.map((t) => {
const typeSchema = { ...schema2, type: t };
return convertBaseSchema(typeSchema, ctx);
});
if (typeSchemas.length === 0) {
return z2.never();
}
if (typeSchemas.length === 1) {
return typeSchemas[0];
}
return z2.union(typeSchemas);
}
if (!type2) {
return z2.any();
}
let zodSchema;
switch (type2) {
case "string": {
let stringSchema = z2.string();
if (schema2.format) {
const format2 = schema2.format;
if (format2 === "email") {
stringSchema = stringSchema.check(z2.email());
} else if (format2 === "uri" || format2 === "uri-reference") {
stringSchema = stringSchema.check(z2.url());
} else if (format2 === "uuid" || format2 === "guid") {
stringSchema = stringSchema.check(z2.uuid());
} else if (format2 === "date-time") {
stringSchema = stringSchema.check(z2.iso.datetime());
} else if (format2 === "date") {
stringSchema = stringSchema.check(z2.iso.date());
} else if (format2 === "time") {
stringSchema = stringSchema.check(z2.iso.time());
} else if (format2 === "duration") {
stringSchema = stringSchema.check(z2.iso.duration());
} else if (format2 === "ipv4") {
stringSchema = stringSchema.check(z2.ipv4());
} else if (format2 === "ipv6") {
stringSchema = stringSchema.check(z2.ipv6());
} else if (format2 === "mac") {
stringSchema = stringSchema.check(z2.mac());
} else if (format2 === "cidr") {
stringSchema = stringSchema.check(z2.cidrv4());
} else if (format2 === "cidr-v6") {
stringSchema = stringSchema.check(z2.cidrv6());
} else if (format2 === "base64") {
stringSchema = stringSchema.check(z2.base64());
} else if (format2 === "base64url") {
stringSchema = stringSchema.check(z2.base64url());
} else if (format2 === "e164") {
stringSchema = stringSchema.check(z2.e164());
} else if (format2 === "jwt") {
stringSchema = stringSchema.check(z2.jwt());
} else if (format2 === "emoji") {
stringSchema = stringSchema.check(z2.emoji());
} else if (format2 === "nanoid") {
stringSchema = stringSchema.check(z2.nanoid());
} else if (format2 === "cuid") {
stringSchema = stringSchema.check(z2.cuid());
} else if (format2 === "cuid2") {
stringSchema = stringSchema.check(z2.cuid2());
} else if (format2 === "ulid") {
stringSchema = stringSchema.check(z2.ulid());
} else if (format2 === "xid") {
stringSchema = stringSchema.check(z2.xid());
} else if (format2 === "ksuid") {
stringSchema = stringSchema.check(z2.ksuid());
}
}
if (typeof schema2.minLength === "number") {
stringSchema = stringSchema.min(schema2.minLength);
}
if (typeof schema2.maxLength === "number") {
stringSchema = stringSchema.max(schema2.maxLength);
}
if (schema2.pattern) {
stringSchema = stringSchema.regex(new RegExp(schema2.pattern));
}
zodSchema = stringSchema;
break;
}
case "number":
case "integer": {
let numberSchema = type2 === "integer" ? z2.number().int() : z2.number();
if (typeof schema2.minimum === "number") {
numberSchema = numberSchema.min(schema2.minimum);
}
if (typeof schema2.maximum === "number") {
numberSchema = numberSchema.max(schema2.maximum);
}
if (typeof schema2.exclusiveMinimum === "number") {
numberSchema = numberSchema.gt(schema2.exclusiveMinimum);
} else if (schema2.exclusiveMinimum === true && typeof schema2.minimum === "number") {
numberSchema = numberSchema.gt(schema2.minimum);
}
if (typeof schema2.exclusiveMaximum === "number") {
numberSchema = numberSchema.lt(schema2.exclusiveMaximum);
} else if (schema2.exclusiveMaximum === true && typeof schema2.maximum === "number") {
numberSchema = numberSchema.lt(schema2.maximum);
}
if (typeof schema2.multipleOf === "number") {
numberSchema = numberSchema.multipleOf(schema2.multipleOf);
}
zodSchema = numberSchema;
break;
}
case "boolean": {
zodSchema = z2.boolean();
break;
}
case "null": {
zodSchema = z2.null();
break;
}
case "object": {
const shape = {};
const properties = schema2.properties || {};
const requiredSet = new Set(schema2.required || []);
for (const [key, propSchema] of Object.entries(properties)) {
const propZodSchema = convertSchema(propSchema, ctx);
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
}
if (schema2.propertyNames) {
const keySchema = convertSchema(schema2.propertyNames, ctx);
const valueSchema = schema2.additionalProperties && typeof schema2.additionalProperties === "object" ? convertSchema(schema2.additionalProperties, ctx) : z2.any();
if (Object.keys(shape).length === 0) {
zodSchema = z2.record(keySchema, valueSchema);
break;
}
const objectSchema2 = z2.object(shape).passthrough();
const recordSchema = z2.looseRecord(keySchema, valueSchema);
zodSchema = z2.intersection(objectSchema2, recordSchema);
break;
}
if (schema2.patternProperties) {
const patternProps = schema2.patternProperties;
const patternKeys = Object.keys(patternProps);
const looseRecords = [];
for (const pattern of patternKeys) {
const patternValue = convertSchema(patternProps[pattern], ctx);
const keySchema = z2.string().regex(new RegExp(pattern));
looseRecords.push(z2.looseRecord(keySchema, patternValue));
}
const schemasToIntersect = [];
if (Object.keys(shape).length > 0) {
schemasToIntersect.push(z2.object(shape).passthrough());
}
schemasToIntersect.push(...looseRecords);
if (schemasToIntersect.length === 0) {
zodSchema = z2.object({}).passthrough();
} else if (schemasToIntersect.length === 1) {
zodSchema = schemasToIntersect[0];
} else {
let result = z2.intersection(schemasToIntersect[0], schemasToIntersect[1]);
for (let i2 = 2;i2 < schemasToIntersect.length; i2++) {
result = z2.intersection(result, schemasToIntersect[i2]);
}
zodSchema = result;
}
break;
}
const objectSchema = z2.object(shape);
if (schema2.additionalProperties === false) {
zodSchema = objectSchema.strict();
} else if (typeof schema2.additionalProperties === "object") {
zodSchema = objectSchema.catchall(convertSchema(schema2.additionalProperties, ctx));
} else {
zodSchema = objectSchema.passthrough();
}
break;
}
case "array": {
const prefixItems = schema2.prefixItems;
const items = schema2.items;
if (prefixItems && Array.isArray(prefixItems)) {
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : undefined;
if (rest) {
zodSchema = z2.tuple(tupleItems).rest(rest);
} else {
zodSchema = z2.tuple(tupleItems);
}
if (typeof schema2.minItems === "number") {
zodSchema = zodSchema.check(z2.minLength(schema2.minItems));
}
if (typeof schema2.maxItems === "number") {
zodSchema = zodSchema.check(z2.maxLength(schema2.maxItems));
}
} else if (Array.isArray(items)) {
const tupleItems = items.map((item) => convertSchema(item, ctx));
const rest = schema2.additionalItems && typeof schema2.additionalItems === "object" ? convertSchema(schema2.additionalItems, ctx) : undefined;
if (rest) {
zodSchema = z2.tuple(tupleItems).rest(rest);
} else {
zodSchema = z2.tuple(tupleItems);
}
if (typeof schema2.minItems === "number") {
zodSchema = zodSchema.check(z2.minLength(schema2.minItems));
}
if (typeof schema2.maxItems === "number") {
zodSchema = zodSchema.check(z2.maxLength(schema2.maxItems));
}
} else if (items !== undefined) {
const element = convertSchema(items, ctx);
let arraySchema = z2.array(element);
if (typeof schema2.minItems === "number") {
arraySchema = arraySchema.min(schema2.minItems);
}
if (typeof schema2.maxItems === "number") {
arraySchema = arraySchema.max(schema2.maxItems);
}
zodSchema = arraySchema;
} else {
zodSchema = z2.array(z2.any());
}
break;
}
default:
throw new Error(`Unsupported type: ${type2}`);
}
if (schema2.description) {
zodSchema = zodSchema.describe(schema2.description);
}
if (schema2.default !== undefined) {
zodSchema = zodSchema.default(schema2.default);
}
return zodSchema;
}
function convertSchema(schema2, ctx) {
if (typeof schema2 === "boolean") {
return schema2 ? z2.any() : z2.never();
}
let baseSchema = convertBaseSchema(schema2, ctx);
const hasExplicitType = schema2.type || schema2.enum !== undefined || schema2.const !== undefined;
if (schema2.anyOf && Array.isArray(schema2.anyOf)) {
const options = schema2.anyOf.map((s) => convertSchema(s, ctx));
const anyOfUnion = z2.union(options);
baseSchema = hasExplicitType ? z2.intersection(baseSchema, anyOfUnion) : anyOfUnion;
}
if (schema2.oneOf && Array.isArray(schema2.oneOf)) {
const options = schema2.oneOf.map((s) => convertSchema(s, ctx));
const oneOfUnion = z2.xor(options);
baseSchema = hasExplicitType ? z2.intersection(baseSchema, oneOfUnion) : oneOfUnion;
}
if (schema2.allOf && Array.isArray(schema2.allOf)) {
if (schema2.allOf.length === 0) {
baseSchema = hasExplicitType ? baseSchema : z2.any();
} else {
let result = hasExplicitType ? baseSchema : convertSchema(schema2.allOf[0], ctx);
const startIdx = hasExplicitType ? 0 : 1;
for (let i2 = startIdx;i2 < schema2.allOf.length; i2++) {
result = z2.intersection(result, convertSchema(schema2.allOf[i2], ctx));
}
baseSchema = result;
}
}
if (schema2.nullable === true && ctx.version === "openapi-3.0") {
baseSchema = z2.nullable(baseSchema);
}
if (schema2.readOnly === true) {
baseSchema = z2.readonly(baseSchema);
}
const extraMeta = {};
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
for (const key of coreMetadataKeys) {
if (key in schema2) {
extraMeta[key] = schema2[key];
}
}
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
for (const key of contentMetadataKeys) {
if (key in schema2) {
extraMeta[key] = schema2[key];
}
}
for (const key of Object.keys(schema2)) {
if (!RECOGNIZED_KEYS.has(key)) {
extraMeta[key] = schema2[key];
}
}
if (Object.keys(extraMeta).length > 0) {
ctx.registry.add(baseSchema, extraMeta);
}
return baseSchema;
}
function fromJSONSchema(schema2, params) {
if (typeof schema2 === "boolean") {
return schema2 ? z2.any() : z2.never();
}
const version2 = detectVersion(schema2, params?.defaultTarget);
const defs = schema2.$defs || schema2.definitions || {};
const ctx = {
version: version2,
defs,
refs: new Map,
processing: new Set,
rootSchema: schema2,
registry: params?.registry ?? globalRegistry
};
return convertSchema(schema2, ctx);
}
// node_modules/zod/v4/classic/coerce.js
var exports_coerce = {};
__export(exports_coerce, {
string: () => string3,
number: () => number3,
date: () => date4,
boolean: () => boolean3,
bigint: () => bigint3
});
function string3(params) {
return _coercedString(ZodString, params);
}
function number3(params) {
return _coercedNumber(ZodNumber, params);
}
function boolean3(params) {
return _coercedBoolean(ZodBoolean, params);
}
function bigint3(params) {
return _coercedBigint(ZodBigInt, params);
}
function date4(params) {
return _coercedDate(ZodDate, params);
}
// node_modules/zod/v4/classic/external.js
config(en_default());
// src/config/schema/agent-names.ts
var BuiltinAgentNameSchema = exports_external.enum([
"sisyphus",
"hephaestus",
"prometheus",
"oracle",
"librarian",
"explore",
"multimodal-looker",
"metis",
"momus",
"atlas",
"sisyphus-junior"
]);
var BuiltinSkillNameSchema = exports_external.enum([
"playwright",
"agent-browser",
"dev-browser",
"frontend-ui-ux",
"git-master"
]);
var OverridableAgentNameSchema = exports_external.enum([
"build",
"plan",
"sisyphus",
"hephaestus",
"sisyphus-junior",
"OpenCode-Builder",
"prometheus",
"metis",
"momus",
"oracle",
"librarian",
"explore",
"multimodal-looker",
"atlas"
]);
// src/config/schema/fallback-models.ts
var FallbackModelsSchema = exports_external.union([exports_external.string(), exports_external.array(exports_external.string())]);
// src/config/schema/internal/permission.ts
var PermissionValueSchema = exports_external.enum(["ask", "allow", "deny"]);
var BashPermissionSchema = exports_external.union([
PermissionValueSchema,
exports_external.record(exports_external.string(), PermissionValueSchema)
]);
var AgentPermissionSchema = exports_external.object({
edit: PermissionValueSchema.optional(),
bash: BashPermissionSchema.optional(),
webfetch: PermissionValueSchema.optional(),
task: PermissionValueSchema.optional(),
doom_loop: PermissionValueSchema.optional(),
external_directory: PermissionValueSchema.optional()
});
// src/config/schema/agent-overrides.ts
var AgentOverrideConfigSchema = exports_external.object({
model: exports_external.string().optional(),
fallback_models: FallbackModelsSchema.optional(),
variant: exports_external.string().optional(),
category: exports_external.string().optional(),
skills: exports_external.array(exports_external.string()).optional(),
temperature: exports_external.number().min(0).max(2).optional(),
top_p: exports_external.number().min(0).max(1).optional(),
prompt: exports_external.string().optional(),
prompt_append: exports_external.string().optional(),
tools: exports_external.record(exports_external.string(), exports_external.boolean()).optional(),
disable: exports_external.boolean().optional(),
description: exports_external.string().optional(),
mode: exports_external.enum(["subagent", "primary", "all"]).optional(),
color: exports_external.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),
permission: AgentPermissionSchema.optional(),
maxTokens: exports_external.number().optional(),
thinking: exports_external.object({
type: exports_external.enum(["enabled", "disabled"]),
budgetTokens: exports_external.number().optional()
}).optional(),
reasoningEffort: exports_external.enum(["low", "medium", "high", "xhigh"]).optional(),
textVerbosity: exports_external.enum(["low", "medium", "high"]).optional(),
providerOptions: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
ultrawork: exports_external.object({
model: exports_external.string().optional(),
variant: exports_external.string().optional()
}).optional(),
compaction: exports_external.object({
model: exports_external.string().optional(),
variant: exports_external.string().optional()
}).optional()
});
var AgentOverridesSchema = exports_external.object({
build: AgentOverrideConfigSchema.optional(),
plan: AgentOverrideConfigSchema.optional(),
sisyphus: AgentOverrideConfigSchema.optional(),
hephaestus: AgentOverrideConfigSchema.extend({
allow_non_gpt_model: exports_external.boolean().optional()
}).optional(),
"sisyphus-junior": AgentOverrideConfigSchema.optional(),
"OpenCode-Builder": AgentOverrideConfigSchema.optional(),
prometheus: AgentOverrideConfigSchema.optional(),
metis: AgentOverrideConfigSchema.optional(),
momus: AgentOverrideConfigSchema.optional(),
oracle: AgentOverrideConfigSchema.optional(),
librarian: AgentOverrideConfigSchema.optional(),
explore: AgentOverrideConfigSchema.optional(),
"multimodal-looker": AgentOverrideConfigSchema.optional(),
atlas: AgentOverrideConfigSchema.optional()
});
// src/config/schema/babysitting.ts
var BabysittingConfigSchema = exports_external.object({
timeout_ms: exports_external.number().default(120000)
});
// src/config/schema/background-task.ts
var BackgroundTaskConfigSchema = exports_external.object({
defaultConcurrency: exports_external.number().min(1).optional(),
providerConcurrency: exports_external.record(exports_external.string(), exports_external.number().min(0)).optional(),
modelConcurrency: exports_external.record(exports_external.string(), exports_external.number().min(0)).optional(),
maxDepth: exports_external.number().int().min(1).optional(),
maxDescendants: exports_external.number().int().min(1).optional(),
staleTimeoutMs: exports_external.number().min(60000).optional(),
messageStalenessTimeoutMs: exports_external.number().min(60000).optional(),
syncPollTimeoutMs: exports_external.number().min(60000).optional()
});
// src/config/schema/browser-automation.ts
var BrowserAutomationProviderSchema = exports_external.enum([
"playwright",
"agent-browser",
"dev-browser",
"playwright-cli"
]);
var BrowserAutomationConfigSchema = exports_external.object({
provider: BrowserAutomationProviderSchema.default("playwright")
});
// src/config/schema/categories.ts
var CategoryConfigSchema = exports_external.object({
description: exports_external.string().optional(),
model: exports_external.string().optional(),
fallback_models: FallbackModelsSchema.optional(),
variant: exports_external.string().optional(),
temperature: exports_external.number().min(0).max(2).optional(),
top_p: exports_external.number().min(0).max(1).optional(),
maxTokens: exports_external.number().optional(),
thinking: exports_external.object({
type: exports_external.enum(["enabled", "disabled"]),
budgetTokens: exports_external.number().optional()
}).optional(),
reasoningEffort: exports_external.enum(["low", "medium", "high", "xhigh"]).optional(),
textVerbosity: exports_external.enum(["low", "medium", "high"]).optional(),
tools: exports_external.record(exports_external.string(), exports_external.boolean()).optional(),
prompt_append: exports_external.string().optional(),
max_prompt_tokens: exports_external.number().int().positive().optional(),
is_unstable_agent: exports_external.boolean().optional(),
disable: exports_external.boolean().optional()
});
var BuiltinCategoryNameSchema = exports_external.enum([
"visual-engineering",
"ultrabrain",
"deep",
"artistry",
"quick",
"unspecified-low",
"unspecified-high",
"writing"
]);
var CategoriesConfigSchema = exports_external.record(exports_external.string(), CategoryConfigSchema);
// src/config/schema/claude-code.ts
var ClaudeCodeConfigSchema = exports_external.object({
mcp: exports_external.boolean().optional(),
commands: exports_external.boolean().optional(),
skills: exports_external.boolean().optional(),
agents: exports_external.boolean().optional(),
hooks: exports_external.boolean().optional(),
plugins: exports_external.boolean().optional(),
plugins_override: exports_external.record(exports_external.string(), exports_external.boolean()).optional()
});
// src/config/schema/comment-checker.ts
var CommentCheckerConfigSchema = exports_external.object({
custom_prompt: exports_external.string().optional()
});
// src/config/schema/commands.ts
var BuiltinCommandNameSchema = exports_external.enum([
"init-deep",
"ralph-loop",
"ulw-loop",
"cancel-ralph",
"refactor",
"start-work",
"stop-continuation"
]);
// src/config/schema/dynamic-context-pruning.ts
var DynamicContextPruningConfigSchema = exports_external.object({
enabled: exports_external.boolean().default(false),
notification: exports_external.enum(["off", "minimal", "detailed"]).default("detailed"),
turn_protection: exports_external.object({
enabled: exports_external.boolean().default(true),
turns: exports_external.number().min(1).max(10).default(3)
}).optional(),
protected_tools: exports_external.array(exports_external.string()).default([
"task",
"todowrite",
"todoread",
"lsp_rename",
"session_read",
"session_write",
"session_search"
]),
strategies: exports_external.object({
deduplication: exports_external.object({
enabled: exports_external.boolean().default(true)
}).optional(),
supersede_writes: exports_external.object({
enabled: exports_external.boolean().default(true),
aggressive: exports_external.boolean().default(false)
}).optional(),
purge_errors: exports_external.object({
enabled: exports_external.boolean().default(true),
turns: exports_external.number().min(1).max(20).default(5)
}).optional()
}).optional()
});
// src/config/schema/experimental.ts
var ExperimentalConfigSchema = exports_external.object({
aggressive_truncation: exports_external.boolean().optional(),
auto_resume: exports_external.boolean().optional(),
preemptive_compaction: exports_external.boolean().optional(),
truncate_all_tool_outputs: exports_external.boolean().optional(),
dynamic_context_pruning: DynamicContextPruningConfigSchema.optional(),
task_system: exports_external.boolean().optional(),
plugin_load_timeout_ms: exports_external.number().min(1000).optional(),
safe_hook_creation: exports_external.boolean().optional(),
disable_omo_env: exports_external.boolean().optional(),
hashline_edit: exports_external.boolean().optional(),
model_fallback_title: exports_external.boolean().optional()
});
// src/config/schema/git-env-prefix.ts
var GIT_ENV_ASSIGNMENT_PATTERN = /^(?:[A-Za-z_][A-Za-z0-9_]*=[A-Za-z0-9_-]*)(?: [A-Za-z_][A-Za-z0-9_]*=[A-Za-z0-9_-]*)*$/;
var GIT_ENV_PREFIX_VALIDATION_MESSAGE = 'git_env_prefix must be empty or use shell-safe env assignments like "GIT_MASTER=1"';
function isValidGitEnvPrefix(value) {
if (value === "") {
return true;
}
return GIT_ENV_ASSIGNMENT_PATTERN.test(value);
}
var GitEnvPrefixSchema = exports_external.string().refine(isValidGitEnvPrefix, { message: GIT_ENV_PREFIX_VALIDATION_MESSAGE }).default("GIT_MASTER=1");
// src/config/schema/git-master.ts
var GitMasterConfigSchema = exports_external.object({
commit_footer: exports_external.union([exports_external.boolean(), exports_external.string()]).default(true),
include_co_authored_by: exports_external.boolean().default(true),
git_env_prefix: GitEnvPrefixSchema
});
// src/config/schema/hooks.ts
var HookNameSchema = exports_external.enum([
"gpt-permission-continuation",
"todo-continuation-enforcer",
"context-window-monitor",
"session-recovery",
"session-notification",
"comment-checker",
"tool-output-truncator",
"question-label-truncator",
"directory-agents-injector",
"directory-readme-injector",
"empty-task-response-detector",
"think-mode",
"model-fallback",
"anthropic-context-window-limit-recovery",
"preemptive-compaction",
"rules-injector",
"background-notification",
"auto-update-checker",
"startup-toast",
"keyword-detector",
"agent-usage-reminder",
"non-interactive-env",
"interactive-bash-session",
"thinking-block-validator",
"ralph-loop",
"category-skill-reminder",
"compaction-context-injector",
"compaction-todo-preserver",
"claude-code-hooks",
"auto-slash-command",
"edit-error-recovery",
"json-error-recovery",
"delegate-task-retry",
"prometheus-md-only",
"sisyphus-junior-notepad",
"no-sisyphus-gpt",
"no-hephaestus-non-gpt",
"start-work",
"atlas",
"unstable-agent-babysitter",
"task-resume-info",
"stop-continuation-guard",
"tasks-todowrite-disabler",
"runtime-fallback",
"write-existing-file-guard",
"anthropic-effort",
"hashline-read-enhancer",
"read-image-resizer",
"delegate-task-english-directive"
]);
// src/config/schema/notification.ts
var NotificationConfigSchema = exports_external.object({
force_enable: exports_external.boolean().optional()
});
// src/mcp/types.ts
var McpNameSchema = exports_external.enum(["websearch", "context7", "grep_app"]);
var AnyMcpNameSchema = exports_external.string().min(1);
// src/config/schema/ralph-loop.ts
var RalphLoopConfigSchema = exports_external.object({
enabled: exports_external.boolean().default(false),
default_max_iterations: exports_external.number().min(1).max(1000).default(100),
state_dir: exports_external.string().optional(),
default_strategy: exports_external.enum(["reset", "continue"]).default("continue")
});
// src/config/schema/runtime-fallback.ts
var RuntimeFallbackConfigSchema = exports_external.object({
enabled: exports_external.boolean().optional(),
retry_on_errors: exports_external.array(exports_external.number()).optional(),
max_fallback_attempts: exports_external.number().min(1).max(20).optional(),
cooldown_seconds: exports_external.number().min(0).optional(),
timeout_seconds: exports_external.number().min(0).optional(),
notify_on_fallback: exports_external.boolean().optional()
});
// src/config/schema/skills.ts
var SkillSourceSchema = exports_external.union([
exports_external.string(),
exports_external.object({
path: exports_external.string(),
recursive: exports_external.boolean().optional(),
glob: exports_external.string().optional()
})
]);
var SkillDefinitionSchema = exports_external.object({
description: exports_external.string().optional(),
template: exports_external.string().optional(),
from: exports_external.string().optional(),
model: exports_external.string().optional(),
agent: exports_external.string().optional(),
subtask: exports_external.boolean().optional(),
"argument-hint": exports_external.string().optional(),
license: exports_external.string().optional(),
compatibility: exports_external.string().optional(),
metadata: exports_external.record(exports_external.string(), exports_external.unknown()).optional(),
"allowed-tools": exports_external.array(exports_external.string()).optional(),
disable: exports_external.boolean().optional()
});
var SkillEntrySchema = exports_external.union([exports_external.boolean(), SkillDefinitionSchema]);
var SkillsConfigSchema = exports_external.union([
exports_external.array(exports_external.string()),
exports_external.object({
sources: exports_external.array(SkillSourceSchema).optional(),
enable: exports_external.array(exports_external.string()).optional(),
disable: exports_external.array(exports_external.string()).optional()
}).catchall(SkillEntrySchema)
]);
// src/config/schema/sisyphus.ts
var SisyphusTasksConfigSchema = exports_external.object({
storage_path: exports_external.string().optional(),
task_list_id: exports_external.string().optional(),
claude_code_compat: exports_external.boolean().default(false)
});
var SisyphusConfigSchema = exports_external.object({
tasks: SisyphusTasksConfigSchema.optional()
});
// src/config/schema/sisyphus-agent.ts
var SisyphusAgentConfigSchema = exports_external.object({
disabled: exports_external.boolean().optional(),
default_builder_enabled: exports_external.boolean().optional(),
planner_enabled: exports_external.boolean().optional(),
replace_plan: exports_external.boolean().optional()
});
// src/config/schema/tmux.ts
var TmuxLayoutSchema = exports_external.enum([
"main-horizontal",
"main-vertical",
"tiled",
"even-horizontal",
"even-vertical"
]);
var TmuxConfigSchema = exports_external.object({
enabled: exports_external.boolean().default(false),
layout: TmuxLayoutSchema.default("main-vertical"),
main_pane_size: exports_external.number().min(20).max(80).default(60),
main_pane_min_width: exports_external.number().min(40).default(120),
agent_pane_min_width: exports_external.number().min(20).default(40)
});
// src/config/schema/start-work.ts
var StartWorkConfigSchema = exports_external.object({
auto_commit: exports_external.boolean().default(true)
});
// src/config/schema/websearch.ts
var WebsearchProviderSchema = exports_external.enum(["exa", "tavily"]);
var WebsearchConfigSchema = exports_external.object({
provider: WebsearchProviderSchema.optional()
});
// src/config/schema/oh-my-opencode-config.ts
var OhMyOpenCodeConfigSchema = exports_external.object({
$schema: exports_external.string().optional(),
new_task_system_enabled: exports_external.boolean().optional(),
default_run_agent: exports_external.string().optional(),
disabled_mcps: exports_external.array(AnyMcpNameSchema).optional(),
disabled_agents: exports_external.array(exports_external.string()).optional(),
disabled_skills: exports_external.array(BuiltinSkillNameSchema).optional(),
disabled_hooks: exports_external.array(HookNameSchema).optional(),
disabled_commands: exports_external.array(BuiltinCommandNameSchema).optional(),
disabled_tools: exports_external.array(exports_external.string()).optional(),
hashline_edit: exports_external.boolean().optional(),
model_fallback: exports_external.boolean().optional(),
agents: AgentOverridesSchema.optional(),
categories: CategoriesConfigSchema.optional(),
claude_code: ClaudeCodeConfigSchema.optional(),
sisyphus_agent: SisyphusAgentConfigSchema.optional(),
comment_checker: CommentCheckerConfigSchema.optional(),
experimental: ExperimentalConfigSchema.optional(),
auto_update: exports_external.boolean().optional(),
skills: SkillsConfigSchema.optional(),
ralph_loop: RalphLoopConfigSchema.optional(),
runtime_fallback: exports_external.union([exports_external.boolean(), RuntimeFallbackConfigSchema]).optional(),
background_task: BackgroundTaskConfigSchema.optional(),
notification: NotificationConfigSchema.optional(),
babysitting: BabysittingConfigSchema.optional(),
git_master: GitMasterConfigSchema.optional(),
browser_automation_engine: BrowserAutomationConfigSchema.optional(),
websearch: WebsearchConfigSchema.optional(),
tmux: TmuxConfigSchema.optional(),
sisyphus: SisyphusConfigSchema.optional(),
start_work: StartWorkConfigSchema.optional(),
_migrations: exports_external.array(exports_external.string()).optional()
});
// src/plugin-config.ts
init_shared();
var PARTIAL_STRING_ARRAY_KEYS = new Set([
"disabled_mcps",
"disabled_agents",
"disabled_skills",
"disabled_hooks",
"disabled_commands",
"disabled_tools"
]);
function parseConfigPartially(rawConfig) {
const fullResult = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
if (fullResult.success) {
return fullResult.data;
}
const partialConfig = {};
const invalidSections = [];
for (const key of Object.keys(rawConfig)) {
if (PARTIAL_STRING_ARRAY_KEYS.has(key)) {
const sectionValue = rawConfig[key];
if (Array.isArray(sectionValue) && sectionValue.every((value) => typeof value === "string")) {
partialConfig[key] = sectionValue;
}
continue;
}
const sectionResult = OhMyOpenCodeConfigSchema.safeParse({ [key]: rawConfig[key] });
if (sectionResult.success) {
const parsed = sectionResult.data;
if (parsed[key] !== undefined) {
partialConfig[key] = parsed[key];
}
} else {
const sectionErrors = sectionResult.error.issues.filter((i2) => i2.path[0] === key).map((i2) => `${i2.path.join(".")}: ${i2.message}`).join(", ");
if (sectionErrors) {
invalidSections.push(`${key}: ${sectionErrors}`);
}
}
}
if (invalidSections.length > 0) {
log("Partial config loaded \u2014 invalid sections skipped:", invalidSections);
}
return partialConfig;
}
function loadConfigFromPath(configPath, _ctx) {
try {
if (fs3.existsSync(configPath)) {
const content = fs3.readFileSync(configPath, "utf-8");
const rawConfig = parseJsonc(content);
migrateConfigFile(configPath, rawConfig);
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
if (result.success) {
log(`Config loaded from ${configPath}`, { agents: result.data.agents });
return result.data;
}
const errorMsg = result.error.issues.map((i2) => `${i2.path.join(".")}: ${i2.message}`).join(", ");
log(`Config validation error in ${configPath}:`, result.error.issues);
addConfigLoadError({
path: configPath,
error: `Partial config loaded \u2014 invalid sections skipped: ${errorMsg}`
});
const partialResult = parseConfigPartially(rawConfig);
if (partialResult) {
log(`Partial config loaded from ${configPath}`, { agents: partialResult.agents });
return partialResult;
}
return null;
}
} catch (err) {
const errorMsg = err instanceof Error ? err.message : String(err);
log(`Error loading config from ${configPath}:`, err);
addConfigLoadError({ path: configPath, error: errorMsg });
}
return null;
}
function mergeConfigs(base, override) {
return {
...base,
...override,
agents: deepMerge(base.agents, override.agents),
categories: deepMerge(base.categories, override.categories),
disabled_agents: [
...new Set([
...base.disabled_agents ?? [],
...override.disabled_agents ?? []
])
],
disabled_mcps: [
...new Set([
...base.disabled_mcps ?? [],
...override.disabled_mcps ?? []
])
],
disabled_hooks: [
...new Set([
...base.disabled_hooks ?? [],
...override.disabled_hooks ?? []
])
],
disabled_commands: [
...new Set([
...base.disabled_commands ?? [],
...override.disabled_commands ?? []
])
],
disabled_skills: [
...new Set([
...base.disabled_skills ?? [],
...override.disabled_skills ?? []
])
],
claude_code: deepMerge(base.claude_code, override.claude_code)
};
}
function loadPluginConfig(directory, ctx) {
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
const userBasePath = path3.join(configDir, "oh-my-opencode");
const userDetected = detectConfigFile(userBasePath);
const userConfigPath = userDetected.format !== "none" ? userDetected.path : userBasePath + ".json";
const projectBasePath = path3.join(directory, ".opencode", "oh-my-opencode");
const projectDetected = detectConfigFile(projectBasePath);
const projectConfigPath = projectDetected.format !== "none" ? projectDetected.path : projectBasePath + ".json";
let config2 = loadConfigFromPath(userConfigPath, ctx) ?? {};
const projectConfig = loadConfigFromPath(projectConfigPath, ctx);
if (projectConfig) {
config2 = mergeConfigs(config2, projectConfig);
}
config2 = {
...config2
};
log("Final merged config", {
agents: config2.agents,
disabled_agents: config2.disabled_agents,
disabled_mcps: config2.disabled_mcps,
disabled_hooks: config2.disabled_hooks,
claude_code: config2.claude_code
});
return config2;
}
// node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url: url2, ...options }) => {
let lastEventId;
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
const createStream = async function* () {
let retryDelay = sseDefaultRetryDelay ?? 3000;
let attempt = 0;
const signal = options.signal ?? new AbortController().signal;
while (true) {
if (signal.aborted)
break;
attempt++;
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
if (lastEventId !== undefined) {
headers.set("Last-Event-ID", lastEventId);
}
try {
const response = await fetch(url2, { ...options, headers, signal });
if (!response.ok)
throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
if (!response.body)
throw new Error("No body in SSE response");
const reader = response.body.pipeThrough(new TextDecoderStream).getReader();
let buffer = "";
const abortHandler = () => {
try {
reader.cancel();
} catch {}
};
signal.addEventListener("abort", abortHandler);
try {
while (true) {
const { done, value } = await reader.read();
if (done)
break;
buffer += value;
const chunks = buffer.split(`
`);
buffer = chunks.pop() ?? "";
for (const chunk of chunks) {
const lines = chunk.split(`
`);
const dataLines = [];
let eventName;
for (const line of lines) {
if (line.startsWith("data:")) {
dataLines.push(line.replace(/^data:\s*/, ""));
} else if (line.startsWith("event:")) {
eventName = line.replace(/^event:\s*/, "");
} else if (line.startsWith("id:")) {
lastEventId = line.replace(/^id:\s*/, "");
} else if (line.startsWith("retry:")) {
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
if (!Number.isNaN(parsed)) {
retryDelay = parsed;
}
}
}
let data;
let parsedJson = false;
if (dataLines.length) {
const rawData = dataLines.join(`
`);
try {
data = JSON.parse(rawData);
parsedJson = true;
} catch {
data = rawData;
}
}
if (parsedJson) {
if (responseValidator) {
await responseValidator(data);
}
if (responseTransformer) {
data = await responseTransformer(data);
}
}
onSseEvent?.({
data,
event: eventName,
id: lastEventId,
retry: retryDelay
});
if (dataLines.length) {
yield data;
}
}
}
} finally {
signal.removeEventListener("abort", abortHandler);
reader.releaseLock();
}
break;
} catch (error48) {
onSseError?.(error48);
if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {
break;
}
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
await sleep(backoff);
}
}
};
const stream = createStream();
return { stream };
};
// node_modules/@opencode-ai/sdk/dist/gen/core/auth.gen.js
var getAuthToken = async (auth, callback) => {
const token = typeof callback === "function" ? await callback(auth) : callback;
if (!token) {
return;
}
if (auth.scheme === "bearer") {
return `Bearer ${token}`;
}
if (auth.scheme === "basic") {
return `Basic ${btoa(token)}`;
}
return token;
};
// node_modules/@opencode-ai/sdk/dist/gen/core/bodySerializer.gen.js
var jsonBodySerializer = {
bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
};
// node_modules/@opencode-ai/sdk/dist/gen/core/pathSerializer.gen.js
var separatorArrayExplode = (style) => {
switch (style) {
case "label":
return ".";
case "matrix":
return ";";
case "simple":
return ",";
default:
return "&";
}
};
var separatorArrayNoExplode = (style) => {
switch (style) {
case "form":
return ",";
case "pipeDelimited":
return "|";
case "spaceDelimited":
return "%20";
default:
return ",";
}
};
var separatorObjectExplode = (style) => {
switch (style) {
case "label":
return ".";
case "matrix":
return ";";
case "simple":
return ",";
default:
return "&";
}
};
var serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
if (!explode) {
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
switch (style) {
case "label":
return `.${joinedValues2}`;
case "matrix":
return `;${name}=${joinedValues2}`;
case "simple":
return joinedValues2;
default:
return `${name}=${joinedValues2}`;
}
}
const separator = separatorArrayExplode(style);
const joinedValues = value.map((v) => {
if (style === "label" || style === "simple") {
return allowReserved ? v : encodeURIComponent(v);
}
return serializePrimitiveParam({
allowReserved,
name,
value: v
});
}).join(separator);
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
};
var serializePrimitiveParam = ({ allowReserved, name, value }) => {
if (value === undefined || value === null) {
return "";
}
if (typeof value === "object") {
throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");
}
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
};
var serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
if (value instanceof Date) {
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
}
if (style !== "deepObject" && !explode) {
let values = [];
Object.entries(value).forEach(([key, v]) => {
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
});
const joinedValues2 = values.join(",");
switch (style) {
case "form":
return `${name}=${joinedValues2}`;
case "label":
return `.${joinedValues2}`;
case "matrix":
return `;${name}=${joinedValues2}`;
default:
return joinedValues2;
}
}
const separator = separatorObjectExplode(style);
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
allowReserved,
name: style === "deepObject" ? `${name}[${key}]` : key,
value: v
})).join(separator);
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
};
// node_modules/@opencode-ai/sdk/dist/gen/core/utils.gen.js
var PATH_PARAM_RE = /\{[^{}]+\}/g;
var defaultPathSerializer = ({ path: path4, url: _url2 }) => {
let url2 = _url2;
const matches = _url2.match(PATH_PARAM_RE);
if (matches) {
for (const match of matches) {
let explode = false;
let name = match.substring(1, match.length - 1);
let style = "simple";
if (name.endsWith("*")) {
explode = true;
name = name.substring(0, name.length - 1);
}
if (name.startsWith(".")) {
name = name.substring(1);
style = "label";
} else if (name.startsWith(";")) {
name = name.substring(1);
style = "matrix";
}
const value = path4[name];
if (value === undefined || value === null) {
continue;
}
if (Array.isArray(value)) {
url2 = url2.replace(match, serializeArrayParam({ explode, name, style, value }));
continue;
}
if (typeof value === "object") {
url2 = url2.replace(match, serializeObjectParam({
explode,
name,
style,
value,
valueOnly: true
}));
continue;
}
if (style === "matrix") {
url2 = url2.replace(match, `;${serializePrimitiveParam({
name,
value
})}`);
continue;
}
const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
url2 = url2.replace(match, replaceValue);
}
}
return url2;
};
var getUrl = ({ baseUrl, path: path4, query, querySerializer, url: _url2 }) => {
const pathUrl = _url2.startsWith("/") ? _url2 : `/${_url2}`;
let url2 = (baseUrl ?? "") + pathUrl;
if (path4) {
url2 = defaultPathSerializer({ path: path4, url: url2 });
}
let search = query ? querySerializer(query) : "";
if (search.startsWith("?")) {
search = search.substring(1);
}
if (search) {
url2 += `?${search}`;
}
return url2;
};
// node_modules/@opencode-ai/sdk/dist/gen/client/utils.gen.js
var createQuerySerializer = ({ allowReserved, array: array2, object: object2 } = {}) => {
const querySerializer = (queryParams) => {
const search = [];
if (queryParams && typeof queryParams === "object") {
for (const name in queryParams) {
const value = queryParams[name];
if (value === undefined || value === null) {
continue;
}
if (Array.isArray(value)) {
const serializedArray = serializeArrayParam({
allowReserved,
explode: true,
name,
style: "form",
value,
...array2
});
if (serializedArray)
search.push(serializedArray);
} else if (typeof value === "object") {
const serializedObject = serializeObjectParam({
allowReserved,
explode: true,
name,
style: "deepObject",
value,
...object2
});
if (serializedObject)
search.push(serializedObject);
} else {
const serializedPrimitive = serializePrimitiveParam({
allowReserved,
name,
value
});
if (serializedPrimitive)
search.push(serializedPrimitive);
}
}
}
return search.join("&");
};
return querySerializer;
};
var getParseAs = (contentType) => {
if (!contentType) {
return "stream";
}
const cleanContent = contentType.split(";")[0]?.trim();
if (!cleanContent) {
return;
}
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
return "json";
}
if (cleanContent === "multipart/form-data") {
return "formData";
}
if (["application/", "audio/", "image/", "video/"].some((type2) => cleanContent.startsWith(type2))) {
return "blob";
}
if (cleanContent.startsWith("text/")) {
return "text";
}
return;
};
var checkForExistence = (options, name) => {
if (!name) {
return false;
}
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
return true;
}
return false;
};
var setAuthParams = async ({ security, ...options }) => {
for (const auth of security) {
if (checkForExistence(options, auth.name)) {
continue;
}
const token = await getAuthToken(auth, options.auth);
if (!token) {
continue;
}
const name = auth.name ?? "Authorization";
switch (auth.in) {
case "query":
if (!options.query) {
options.query = {};
}
options.query[name] = token;
break;
case "cookie":
options.headers.append("Cookie", `${name}=${token}`);
break;
case "header":
default:
options.headers.set(name, token);
break;
}
}
};
var buildUrl = (options) => getUrl({
baseUrl: options.baseUrl,
path: options.path,
query: options.query,
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
url: options.url
});
var mergeConfigs2 = (a, b3) => {
const config2 = { ...a, ...b3 };
if (config2.baseUrl?.endsWith("/")) {
config2.baseUrl = config2.baseUrl.substring(0, config2.baseUrl.length - 1);
}
config2.headers = mergeHeaders(a.headers, b3.headers);
return config2;
};
var mergeHeaders = (...headers) => {
const mergedHeaders = new Headers;
for (const header of headers) {
if (!header || typeof header !== "object") {
continue;
}
const iterator = header instanceof Headers ? header.entries() : Object.entries(header);
for (const [key, value] of iterator) {
if (value === null) {
mergedHeaders.delete(key);
} else if (Array.isArray(value)) {
for (const v of value) {
mergedHeaders.append(key, v);
}
} else if (value !== undefined) {
mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
}
}
}
return mergedHeaders;
};
class Interceptors {
_fns;
constructor() {
this._fns = [];
}
clear() {
this._fns = [];
}
getInterceptorIndex(id) {
if (typeof id === "number") {
return this._fns[id] ? id : -1;
} else {
return this._fns.indexOf(id);
}
}
exists(id) {
const index = this.getInterceptorIndex(id);
return !!this._fns[index];
}
eject(id) {
const index = this.getInterceptorIndex(id);
if (this._fns[index]) {
this._fns[index] = null;
}
}
update(id, fn) {
const index = this.getInterceptorIndex(id);
if (this._fns[index]) {
this._fns[index] = fn;
return id;
} else {
return false;
}
}
use(fn) {
this._fns = [...this._fns, fn];
return this._fns.length - 1;
}
}
var createInterceptors = () => ({
error: new Interceptors,
request: new Interceptors,
response: new Interceptors
});
var defaultQuerySerializer = createQuerySerializer({
allowReserved: false,
array: {
explode: true,
style: "form"
},
object: {
explode: true,
style: "deepObject"
}
});
var defaultHeaders = {
"Content-Type": "application/json"
};
var createConfig = (override = {}) => ({
...jsonBodySerializer,
headers: defaultHeaders,
parseAs: "auto",
querySerializer: defaultQuerySerializer,
...override
});
// node_modules/@opencode-ai/sdk/dist/gen/client/client.gen.js
var createClient = (config2 = {}) => {
let _config = mergeConfigs2(createConfig(), config2);
const getConfig = () => ({ ..._config });
const setConfig = (config3) => {
_config = mergeConfigs2(_config, config3);
return getConfig();
};
const interceptors = createInterceptors();
const beforeRequest = async (options) => {
const opts = {
..._config,
...options,
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
headers: mergeHeaders(_config.headers, options.headers),
serializedBody: undefined
};
if (opts.security) {
await setAuthParams({
...opts,
security: opts.security
});
}
if (opts.requestValidator) {
await opts.requestValidator(opts);
}
if (opts.body && opts.bodySerializer) {
opts.serializedBody = opts.bodySerializer(opts.body);
}
if (opts.serializedBody === undefined || opts.serializedBody === "") {
opts.headers.delete("Content-Type");
}
const url2 = buildUrl(opts);
return { opts, url: url2 };
};
const request = async (options) => {
const { opts, url: url2 } = await beforeRequest(options);
const requestInit = {
redirect: "follow",
...opts,
body: opts.serializedBody
};
let request2 = new Request(url2, requestInit);
for (const fn of interceptors.request._fns) {
if (fn) {
request2 = await fn(request2, opts);
}
}
const _fetch = opts.fetch;
let response = await _fetch(request2);
for (const fn of interceptors.response._fns) {
if (fn) {
response = await fn(response, request2, opts);
}
}
const result = {
request: request2,
response
};
if (response.ok) {
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
return opts.responseStyle === "data" ? {} : {
data: {},
...result
};
}
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
let data;
switch (parseAs) {
case "arrayBuffer":
case "blob":
case "formData":
case "json":
case "text":
data = await response[parseAs]();
break;
case "stream":
return opts.responseStyle === "data" ? response.body : {
data: response.body,
...result
};
}
if (parseAs === "json") {
if (opts.responseValidator) {
await opts.responseValidator(data);
}
if (opts.responseTransformer) {
data = await opts.responseTransformer(data);
}
}
return opts.responseStyle === "data" ? data : {
data,
...result
};
}
const textError = await response.text();
let jsonError;
try {
jsonError = JSON.parse(textError);
} catch {}
const error48 = jsonError ?? textError;
let finalError = error48;
for (const fn of interceptors.error._fns) {
if (fn) {
finalError = await fn(error48, response, request2, opts);
}
}
finalError = finalError || {};
if (opts.throwOnError) {
throw finalError;
}
return opts.responseStyle === "data" ? undefined : {
error: finalError,
...result
};
};
const makeMethod = (method) => {
const fn = (options) => request({ ...options, method });
fn.sse = async (options) => {
const { opts, url: url2 } = await beforeRequest(options);
return createSseClient({
...opts,
body: opts.body,
headers: opts.headers,
method,
url: url2
});
};
return fn;
};
return {
buildUrl,
connect: makeMethod("CONNECT"),
delete: makeMethod("DELETE"),
get: makeMethod("GET"),
getConfig,
head: makeMethod("HEAD"),
interceptors,
options: makeMethod("OPTIONS"),
patch: makeMethod("PATCH"),
post: makeMethod("POST"),
put: makeMethod("PUT"),
request,
setConfig,
trace: makeMethod("TRACE")
};
};
// node_modules/@opencode-ai/sdk/dist/gen/core/params.gen.js
var extraPrefixesMap = {
$body_: "body",
$headers_: "headers",
$path_: "path",
$query_: "query"
};
var extraPrefixes = Object.entries(extraPrefixesMap);
// node_modules/@opencode-ai/sdk/dist/gen/client.gen.js
var client = createClient(createConfig({
baseUrl: "http://localhost:4096"
}));
// node_modules/@opencode-ai/sdk/dist/gen/sdk.gen.js
class _HeyApiClient {
_client = client;
constructor(args) {
if (args?.client) {
this._client = args.client;
}
}
}
class Global extends _HeyApiClient {
event(options) {
return (options?.client ?? this._client).get.sse({
url: "/global/event",
...options
});
}
}
class Project extends _HeyApiClient {
list(options) {
return (options?.client ?? this._client).get({
url: "/project",
...options
});
}
current(options) {
return (options?.client ?? this._client).get({
url: "/project/current",
...options
});
}
}
class Pty extends _HeyApiClient {
list(options) {
return (options?.client ?? this._client).get({
url: "/pty",
...options
});
}
create(options) {
return (options?.client ?? this._client).post({
url: "/pty",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
}
remove(options) {
return (options.client ?? this._client).delete({
url: "/pty/{id}",
...options
});
}
get(options) {
return (options.client ?? this._client).get({
url: "/pty/{id}",
...options
});
}
update(options) {
return (options.client ?? this._client).put({
url: "/pty/{id}",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
connect(options) {
return (options.client ?? this._client).get({
url: "/pty/{id}/connect",
...options
});
}
}
class Config extends _HeyApiClient {
get(options) {
return (options?.client ?? this._client).get({
url: "/config",
...options
});
}
update(options) {
return (options?.client ?? this._client).patch({
url: "/config",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
}
providers(options) {
return (options?.client ?? this._client).get({
url: "/config/providers",
...options
});
}
}
class Tool extends _HeyApiClient {
ids(options) {
return (options?.client ?? this._client).get({
url: "/experimental/tool/ids",
...options
});
}
list(options) {
return (options.client ?? this._client).get({
url: "/experimental/tool",
...options
});
}
}
class Instance extends _HeyApiClient {
dispose(options) {
return (options?.client ?? this._client).post({
url: "/instance/dispose",
...options
});
}
}
class Path extends _HeyApiClient {
get(options) {
return (options?.client ?? this._client).get({
url: "/path",
...options
});
}
}
class Vcs extends _HeyApiClient {
get(options) {
return (options?.client ?? this._client).get({
url: "/vcs",
...options
});
}
}
class Session extends _HeyApiClient {
list(options) {
return (options?.client ?? this._client).get({
url: "/session",
...options
});
}
create(options) {
return (options?.client ?? this._client).post({
url: "/session",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
}
status(options) {
return (options?.client ?? this._client).get({
url: "/session/status",
...options
});
}
delete(options) {
return (options.client ?? this._client).delete({
url: "/session/{id}",
...options
});
}
get(options) {
return (options.client ?? this._client).get({
url: "/session/{id}",
...options
});
}
update(options) {
return (options.client ?? this._client).patch({
url: "/session/{id}",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
children(options) {
return (options.client ?? this._client).get({
url: "/session/{id}/children",
...options
});
}
todo(options) {
return (options.client ?? this._client).get({
url: "/session/{id}/todo",
...options
});
}
init(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/init",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
fork(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/fork",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
abort(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/abort",
...options
});
}
unshare(options) {
return (options.client ?? this._client).delete({
url: "/session/{id}/share",
...options
});
}
share(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/share",
...options
});
}
diff(options) {
return (options.client ?? this._client).get({
url: "/session/{id}/diff",
...options
});
}
summarize(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/summarize",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
messages(options) {
return (options.client ?? this._client).get({
url: "/session/{id}/message",
...options
});
}
prompt(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/message",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
message(options) {
return (options.client ?? this._client).get({
url: "/session/{id}/message/{messageID}",
...options
});
}
promptAsync(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/prompt_async",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
command(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/command",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
shell(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/shell",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
revert(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/revert",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
unrevert(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/unrevert",
...options
});
}
}
class Command2 extends _HeyApiClient {
list(options) {
return (options?.client ?? this._client).get({
url: "/command",
...options
});
}
}
class Oauth extends _HeyApiClient {
authorize(options) {
return (options.client ?? this._client).post({
url: "/provider/{id}/oauth/authorize",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
callback(options) {
return (options.client ?? this._client).post({
url: "/provider/{id}/oauth/callback",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
}
class Provider extends _HeyApiClient {
list(options) {
return (options?.client ?? this._client).get({
url: "/provider",
...options
});
}
auth(options) {
return (options?.client ?? this._client).get({
url: "/provider/auth",
...options
});
}
oauth = new Oauth({ client: this._client });
}
class Find extends _HeyApiClient {
text(options) {
return (options.client ?? this._client).get({
url: "/find",
...options
});
}
files(options) {
return (options.client ?? this._client).get({
url: "/find/file",
...options
});
}
symbols(options) {
return (options.client ?? this._client).get({
url: "/find/symbol",
...options
});
}
}
class File2 extends _HeyApiClient {
list(options) {
return (options.client ?? this._client).get({
url: "/file",
...options
});
}
read(options) {
return (options.client ?? this._client).get({
url: "/file/content",
...options
});
}
status(options) {
return (options?.client ?? this._client).get({
url: "/file/status",
...options
});
}
}
class App extends _HeyApiClient {
log(options) {
return (options?.client ?? this._client).post({
url: "/log",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
}
agents(options) {
return (options?.client ?? this._client).get({
url: "/agent",
...options
});
}
}
class Auth extends _HeyApiClient {
remove(options) {
return (options.client ?? this._client).delete({
url: "/mcp/{name}/auth",
...options
});
}
start(options) {
return (options.client ?? this._client).post({
url: "/mcp/{name}/auth",
...options
});
}
callback(options) {
return (options.client ?? this._client).post({
url: "/mcp/{name}/auth/callback",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
authenticate(options) {
return (options.client ?? this._client).post({
url: "/mcp/{name}/auth/authenticate",
...options
});
}
set(options) {
return (options.client ?? this._client).put({
url: "/auth/{id}",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
}
class Mcp extends _HeyApiClient {
status(options) {
return (options?.client ?? this._client).get({
url: "/mcp",
...options
});
}
add(options) {
return (options?.client ?? this._client).post({
url: "/mcp",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
}
connect(options) {
return (options.client ?? this._client).post({
url: "/mcp/{name}/connect",
...options
});
}
disconnect(options) {
return (options.client ?? this._client).post({
url: "/mcp/{name}/disconnect",
...options
});
}
auth = new Auth({ client: this._client });
}
class Lsp extends _HeyApiClient {
status(options) {
return (options?.client ?? this._client).get({
url: "/lsp",
...options
});
}
}
class Formatter extends _HeyApiClient {
status(options) {
return (options?.client ?? this._client).get({
url: "/formatter",
...options
});
}
}
class Control extends _HeyApiClient {
next(options) {
return (options?.client ?? this._client).get({
url: "/tui/control/next",
...options
});
}
response(options) {
return (options?.client ?? this._client).post({
url: "/tui/control/response",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
}
}
class Tui extends _HeyApiClient {
appendPrompt(options) {
return (options?.client ?? this._client).post({
url: "/tui/append-prompt",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
}
openHelp(options) {
return (options?.client ?? this._client).post({
url: "/tui/open-help",
...options
});
}
openSessions(options) {
return (options?.client ?? this._client).post({
url: "/tui/open-sessions",
...options
});
}
openThemes(options) {
return (options?.client ?? this._client).post({
url: "/tui/open-themes",
...options
});
}
openModels(options) {
return (options?.client ?? this._client).post({
url: "/tui/open-models",
...options
});
}
submitPrompt(options) {
return (options?.client ?? this._client).post({
url: "/tui/submit-prompt",
...options
});
}
clearPrompt(options) {
return (options?.client ?? this._client).post({
url: "/tui/clear-prompt",
...options
});
}
executeCommand(options) {
return (options?.client ?? this._client).post({
url: "/tui/execute-command",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
}
showToast(options) {
return (options?.client ?? this._client).post({
url: "/tui/show-toast",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
}
publish(options) {
return (options?.client ?? this._client).post({
url: "/tui/publish",
...options,
headers: {
"Content-Type": "application/json",
...options?.headers
}
});
}
control = new Control({ client: this._client });
}
class Event extends _HeyApiClient {
subscribe(options) {
return (options?.client ?? this._client).get.sse({
url: "/event",
...options
});
}
}
class OpencodeClient extends _HeyApiClient {
postSessionIdPermissionsPermissionId(options) {
return (options.client ?? this._client).post({
url: "/session/{id}/permissions/{permissionID}",
...options,
headers: {
"Content-Type": "application/json",
...options.headers
}
});
}
global = new Global({ client: this._client });
project = new Project({ client: this._client });
pty = new Pty({ client: this._client });
config = new Config({ client: this._client });
tool = new Tool({ client: this._client });
instance = new Instance({ client: this._client });
path = new Path({ client: this._client });
vcs = new Vcs({ client: this._client });
session = new Session({ client: this._client });
command = new Command2({ client: this._client });
provider = new Provider({ client: this._client });
find = new Find({ client: this._client });
file = new File2({ client: this._client });
app = new App({ client: this._client });
mcp = new Mcp({ client: this._client });
lsp = new Lsp({ client: this._client });
formatter = new Formatter({ client: this._client });
tui = new Tui({ client: this._client });
auth = new Auth({ client: this._client });
event = new Event({ client: this._client });
}
// node_modules/@opencode-ai/sdk/dist/client.js
function createOpencodeClient(config2) {
if (!config2?.fetch) {
const customFetch = (req) => {
req.timeout = false;
return fetch(req);
};
config2 = {
...config2,
fetch: customFetch
};
}
if (config2?.directory) {
config2.headers = {
...config2.headers,
"x-opencode-directory": encodeURIComponent(config2.directory)
};
}
const client2 = createClient(config2);
return new OpencodeClient({ client: client2 });
}
// node_modules/@opencode-ai/sdk/dist/server.js
import { spawn } from "child_process";
async function createOpencodeServer(options) {
options = Object.assign({
hostname: "127.0.0.1",
port: 4096,
timeout: 5000
}, options ?? {});
const args = [`serve`, `--hostname=${options.hostname}`, `--port=${options.port}`];
if (options.config?.logLevel)
args.push(`--log-level=${options.config.logLevel}`);
const proc = spawn(`opencode`, args, {
signal: options.signal,
env: {
...process.env,
OPENCODE_CONFIG_CONTENT: JSON.stringify(options.config ?? {})
}
});
const url2 = await new Promise((resolve2, reject) => {
const id = setTimeout(() => {
reject(new Error(`Timeout waiting for server to start after ${options.timeout}ms`));
}, options.timeout);
let output = "";
proc.stdout?.on("data", (chunk) => {
output += chunk.toString();
const lines = output.split(`
`);
for (const line of lines) {
if (line.startsWith("opencode server listening")) {
const match = line.match(/on\s+(https?:\/\/[^\s]+)/);
if (!match) {
throw new Error(`Failed to parse server url from output: ${line}`);
}
clearTimeout(id);
resolve2(match[1]);
return;
}
}
});
proc.stderr?.on("data", (chunk) => {
output += chunk.toString();
});
proc.on("exit", (code) => {
clearTimeout(id);
let msg = `Server exited with code ${code}`;
if (output.trim()) {
msg += `
Server output: ${output}`;
}
reject(new Error(msg));
});
proc.on("error", (error48) => {
clearTimeout(id);
reject(error48);
});
if (options.signal) {
options.signal.addEventListener("abort", () => {
clearTimeout(id);
reject(new Error("Aborted"));
});
}
});
return {
url: url2,
close() {
proc.kill();
}
};
}
// node_modules/@opencode-ai/sdk/dist/index.js
async function createOpencode(options) {
const server2 = await createOpencodeServer({
...options
});
const client3 = createOpencodeClient({
baseUrl: server2.url
});
return {
client: client3,
server: server2
};
}
// src/cli/run/server-connection.ts
init_port_utils();
var import_picocolors9 = __toESM(require_picocolors(), 1);
// src/cli/run/opencode-binary-resolver.ts
init_spawn_with_windows_hide();
import { delimiter, dirname, join as join8 } from "path";
var OPENCODE_COMMANDS = ["opencode", "opencode-desktop"];
var WINDOWS_SUFFIXES = ["", ".exe", ".cmd", ".bat", ".ps1"];
function getCommandCandidates(platform) {
if (platform !== "win32")
return [...OPENCODE_COMMANDS];
return OPENCODE_COMMANDS.flatMap((command) => WINDOWS_SUFFIXES.map((suffix) => `${command}${suffix}`));
}
function collectCandidateBinaryPaths(pathEnv, which = Bun.which, platform = process.platform) {
const seen = new Set;
const candidates = [];
const commandCandidates = getCommandCandidates(platform);
const addCandidate = (binaryPath) => {
if (!binaryPath || seen.has(binaryPath))
return;
seen.add(binaryPath);
candidates.push(binaryPath);
};
for (const command of commandCandidates) {
addCandidate(which(command));
}
for (const entry of (pathEnv ?? "").split(delimiter).filter(Boolean)) {
for (const command of commandCandidates) {
addCandidate(join8(entry, command));
}
}
return candidates;
}
async function canExecuteBinary(binaryPath) {
try {
const proc = spawnWithWindowsHide([binaryPath, "--version"], {
stdout: "pipe",
stderr: "pipe"
});
await proc.exited;
return proc.exitCode === 0;
} catch {
return false;
}
}
async function findWorkingOpencodeBinary(pathEnv = process.env.PATH, probe = canExecuteBinary, which = Bun.which, platform = process.platform) {
const candidates = collectCandidateBinaryPaths(pathEnv, which, platform);
for (const candidate of candidates) {
if (await probe(candidate)) {
return candidate;
}
}
return null;
}
function buildPathWithBinaryFirst(pathEnv, binaryPath) {
const preferredDir = dirname(binaryPath);
const existing = (pathEnv ?? "").split(delimiter).filter((entry) => entry.length > 0 && entry !== preferredDir);
return [preferredDir, ...existing].join(delimiter);
}
async function withWorkingOpencodePath(startServer, finder = findWorkingOpencodeBinary) {
const originalPath = process.env.PATH;
const binaryPath = await finder(originalPath);
if (!binaryPath) {
return startServer();
}
process.env.PATH = buildPathWithBinaryFirst(originalPath, binaryPath);
try {
return await startServer();
} finally {
process.env.PATH = originalPath;
}
}
// src/cli/run/server-connection.ts
function isPortStartFailure(error48, port) {
if (!(error48 instanceof Error)) {
return false;
}
return error48.message.includes(`Failed to start server on port ${port}`);
}
function isPortRangeExhausted(error48) {
if (!(error48 instanceof Error)) {
return false;
}
return error48.message.includes("No available port found in range");
}
async function startServer(options) {
const { signal, port } = options;
const { client: client3, server: server2 } = await withWorkingOpencodePath(() => createOpencode({ signal, port, hostname: "127.0.0.1" }));
console.log(import_picocolors9.default.dim("Server listening at"), import_picocolors9.default.cyan(server2.url));
return { client: client3, cleanup: () => server2.close() };
}
async function createServerConnection(options) {
const { port, attach, signal } = options;
if (attach !== undefined) {
console.log(import_picocolors9.default.dim("Attaching to existing server at"), import_picocolors9.default.cyan(attach));
const client3 = createOpencodeClient({ baseUrl: attach });
return { client: client3, cleanup: () => {} };
}
if (port !== undefined) {
if (port < 1 || port > 65535) {
throw new Error("Port must be between 1 and 65535");
}
const available = await isPortAvailable(port, "127.0.0.1");
if (available) {
console.log(import_picocolors9.default.dim("Starting server on port"), import_picocolors9.default.cyan(port.toString()));
try {
return await startServer({ signal, port });
} catch (error48) {
if (!isPortStartFailure(error48, port)) {
throw error48;
}
const stillAvailable = await isPortAvailable(port, "127.0.0.1");
if (stillAvailable) {
throw error48;
}
console.log(import_picocolors9.default.dim("Port"), import_picocolors9.default.cyan(port.toString()), import_picocolors9.default.dim("became occupied, attaching to existing server"));
const client4 = createOpencodeClient({ baseUrl: `http://127.0.0.1:${port}` });
return { client: client4, cleanup: () => {} };
}
}
console.log(import_picocolors9.default.dim("Port"), import_picocolors9.default.cyan(port.toString()), import_picocolors9.default.dim("is occupied, attaching to existing server"));
const client3 = createOpencodeClient({ baseUrl: `http://127.0.0.1:${port}` });
return { client: client3, cleanup: () => {} };
}
let selectedPort;
let wasAutoSelected;
try {
const selected = await getAvailableServerPort(DEFAULT_SERVER_PORT, "127.0.0.1");
selectedPort = selected.port;
wasAutoSelected = selected.wasAutoSelected;
} catch (error48) {
if (!isPortRangeExhausted(error48)) {
throw error48;
}
const defaultPortIsAvailable = await isPortAvailable(DEFAULT_SERVER_PORT, "127.0.0.1");
if (defaultPortIsAvailable) {
throw error48;
}
console.log(import_picocolors9.default.dim("Port range exhausted, attaching to existing server on"), import_picocolors9.default.cyan(DEFAULT_SERVER_PORT.toString()));
const client3 = createOpencodeClient({ baseUrl: `http://127.0.0.1:${DEFAULT_SERVER_PORT}` });
return { client: client3, cleanup: () => {} };
}
if (wasAutoSelected) {
console.log(import_picocolors9.default.dim("Auto-selected port"), import_picocolors9.default.cyan(selectedPort.toString()));
} else {
console.log(import_picocolors9.default.dim("Starting server on port"), import_picocolors9.default.cyan(selectedPort.toString()));
}
try {
return await startServer({ signal, port: selectedPort });
} catch (error48) {
if (!isPortStartFailure(error48, selectedPort)) {
throw error48;
}
const { port: retryPort } = await getAvailableServerPort(selectedPort + 1, "127.0.0.1");
console.log(import_picocolors9.default.dim("Retrying server start on port"), import_picocolors9.default.cyan(retryPort.toString()));
return await startServer({ signal, port: retryPort });
}
}
// src/cli/run/session-resolver.ts
var import_picocolors10 = __toESM(require_picocolors(), 1);
var SESSION_CREATE_MAX_RETRIES = 3;
var SESSION_CREATE_RETRY_DELAY_MS = 1000;
async function resolveSession(options) {
const { client: client3, sessionId, directory } = options;
if (sessionId) {
const res = await client3.session.get({
path: { id: sessionId },
query: { directory }
});
if (res.error || !res.data) {
throw new Error(`Session not found: ${sessionId}`);
}
return sessionId;
}
for (let attempt = 1;attempt <= SESSION_CREATE_MAX_RETRIES; attempt++) {
const res = await client3.session.create({
body: {
title: "oh-my-opencode run",
permission: [
{ permission: "question", action: "deny", pattern: "*" }
]
},
query: { directory }
});
if (res.error) {
console.error(import_picocolors10.default.yellow(`Session create attempt ${attempt}/${SESSION_CREATE_MAX_RETRIES} failed:`));
console.error(import_picocolors10.default.dim(` Error: ${serializeError(res.error)}`));
if (attempt < SESSION_CREATE_MAX_RETRIES) {
const delay = SESSION_CREATE_RETRY_DELAY_MS * attempt;
console.log(import_picocolors10.default.dim(` Retrying in ${delay}ms...`));
await new Promise((resolve2) => setTimeout(resolve2, delay));
}
continue;
}
if (res.data?.id) {
return res.data.id;
}
console.error(import_picocolors10.default.yellow(`Session create attempt ${attempt}/${SESSION_CREATE_MAX_RETRIES}: No session ID returned`));
if (attempt < SESSION_CREATE_MAX_RETRIES) {
const delay = SESSION_CREATE_RETRY_DELAY_MS * attempt;
console.log(import_picocolors10.default.dim(` Retrying in ${delay}ms...`));
await new Promise((resolve2) => setTimeout(resolve2, delay));
}
}
throw new Error("Failed to create session after all retries");
}
// src/cli/run/json-output.ts
function createJsonOutputManager(options = {}) {
const stdout = options.stdout ?? process.stdout;
const stderr = options.stderr ?? process.stderr;
const originalWrite = stdout.write.bind(stdout);
function redirectToStderr() {
stdout.write = function(chunk, encodingOrCallback, callback) {
if (typeof encodingOrCallback === "function") {
return stderr.write(chunk, encodingOrCallback);
}
if (encodingOrCallback !== undefined) {
return stderr.write(chunk, encodingOrCallback, callback);
}
return stderr.write(chunk);
};
}
function restore() {
stdout.write = originalWrite;
}
function emitResult(result) {
restore();
originalWrite(JSON.stringify(result) + `
`);
}
return {
redirectToStderr,
restore,
emitResult
};
}
// src/cli/run/on-complete-hook.ts
init_spawn_with_windows_hide();
init_shared();
async function readOutput(stream, streamName) {
if (!stream) {
return "";
}
try {
return await new Response(stream).text();
} catch (error48) {
log("Failed to read on-complete hook output", {
stream: streamName,
error: error48 instanceof Error ? error48.message : String(error48)
});
return "";
}
}
async function executeOnCompleteHook(options) {
const { command, sessionId, exitCode, durationMs, messageCount } = options;
const trimmedCommand = command.trim();
if (!trimmedCommand) {
return;
}
log("Running on-complete hook", { command: trimmedCommand });
try {
const proc = spawnWithWindowsHide(["sh", "-c", trimmedCommand], {
env: {
...process.env,
SESSION_ID: sessionId,
EXIT_CODE: String(exitCode),
DURATION_MS: String(durationMs),
MESSAGE_COUNT: String(messageCount)
},
stdout: "pipe",
stderr: "pipe"
});
const [hookExitCode, stdout, stderr] = await Promise.all([
proc.exited,
readOutput(proc.stdout, "stdout"),
readOutput(proc.stderr, "stderr")
]);
if (stdout.trim()) {
log("On-complete hook stdout", { command: trimmedCommand, stdout: stdout.trim() });
}
if (stderr.trim()) {
log("On-complete hook stderr", { command: trimmedCommand, stderr: stderr.trim() });
}
if (hookExitCode !== 0) {
log("On-complete hook exited with non-zero code", {
command: trimmedCommand,
exitCode: hookExitCode
});
}
} catch (error48) {
log("Failed to execute on-complete hook", {
command: trimmedCommand,
error: error48 instanceof Error ? error48.message : String(error48)
});
}
}
// src/cli/run/agent-resolver.ts
init_agent_display_names();
var import_picocolors11 = __toESM(require_picocolors(), 1);
var CORE_AGENT_ORDER = ["sisyphus", "hephaestus", "prometheus", "atlas"];
var DEFAULT_AGENT = "sisyphus";
var normalizeAgentName = (agent) => {
if (!agent)
return;
const trimmed = agent.trim();
if (trimmed.length === 0)
return;
const configKey = getAgentConfigKey(trimmed);
const displayName = getAgentDisplayName(configKey);
const isKnownAgent = displayName !== configKey;
return {
configKey,
resolvedName: isKnownAgent ? displayName : trimmed
};
};
var isAgentDisabled = (agentConfigKey, config2) => {
const lowered = agentConfigKey.toLowerCase();
if (lowered === DEFAULT_AGENT && config2.sisyphus_agent?.disabled === true) {
return true;
}
return (config2.disabled_agents ?? []).some((disabled) => getAgentConfigKey(disabled) === lowered);
};
var pickFallbackAgent = (config2) => {
for (const agent of CORE_AGENT_ORDER) {
if (!isAgentDisabled(agent, config2)) {
return agent;
}
}
return DEFAULT_AGENT;
};
var resolveRunAgent = (options, pluginConfig, env = process.env) => {
const cliAgent = normalizeAgentName(options.agent);
const envAgent = normalizeAgentName(env.OPENCODE_DEFAULT_AGENT);
const configAgent = normalizeAgentName(pluginConfig.default_run_agent);
const resolved = cliAgent ?? envAgent ?? configAgent ?? {
configKey: DEFAULT_AGENT,
resolvedName: getAgentDisplayName(DEFAULT_AGENT)
};
if (isAgentDisabled(resolved.configKey, pluginConfig)) {
const fallback = pickFallbackAgent(pluginConfig);
const fallbackName = getAgentDisplayName(fallback);
const fallbackDisabled = isAgentDisabled(fallback, pluginConfig);
if (fallbackDisabled) {
console.log(import_picocolors11.default.yellow(`Requested agent "${resolved.resolvedName}" is disabled and no enabled core agent was found. Proceeding with "${fallbackName}".`));
return fallbackName;
}
console.log(import_picocolors11.default.yellow(`Requested agent "${resolved.resolvedName}" is disabled. Falling back to "${fallbackName}".`));
return fallbackName;
}
return resolved.resolvedName;
};
// src/cli/run/model-resolver.ts
function resolveRunModel(modelString) {
if (modelString === undefined) {
return;
}
const trimmed = modelString.trim();
if (trimmed.length === 0) {
throw new Error("Model string cannot be empty");
}
const parts = trimmed.split("/");
if (parts.length < 2) {
throw new Error("Model string must be in 'provider/model' format");
}
const providerID = parts[0];
if (providerID.length === 0) {
throw new Error("Provider cannot be empty");
}
const modelID = parts.slice(1).join("/");
if (modelID.length === 0) {
throw new Error("Model ID cannot be empty");
}
return { providerID, modelID };
}
// src/cli/run/poll-for-completion.ts
var import_picocolors13 = __toESM(require_picocolors(), 1);
// src/cli/run/completion.ts
init_shared();
var import_picocolors12 = __toESM(require_picocolors(), 1);
// src/features/boulder-state/constants.ts
var BOULDER_DIR = ".sisyphus";
var BOULDER_FILE = "boulder.json";
var BOULDER_STATE_PATH = `${BOULDER_DIR}/${BOULDER_FILE}`;
var NOTEPAD_DIR = "notepads";
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
// src/features/boulder-state/storage.ts
import { existsSync as existsSync11, readFileSync as readFileSync9, writeFileSync as writeFileSync5, mkdirSync as mkdirSync3, readdirSync } from "fs";
import { dirname as dirname2, join as join9, basename } from "path";
function getBoulderFilePath(directory) {
return join9(directory, BOULDER_DIR, BOULDER_FILE);
}
function readBoulderState(directory) {
const filePath = getBoulderFilePath(directory);
if (!existsSync11(filePath)) {
return null;
}
try {
const content = readFileSync9(filePath, "utf-8");
const parsed = JSON.parse(content);
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
return null;
}
if (!Array.isArray(parsed.session_ids)) {
parsed.session_ids = [];
}
return parsed;
} catch {
return null;
}
}
function getPlanProgress(planPath) {
if (!existsSync11(planPath)) {
return { total: 0, completed: 0, isComplete: true };
}
try {
const content = readFileSync9(planPath, "utf-8");
const uncheckedMatches = content.match(/^\s*[-*]\s*\[\s*\]/gm) || [];
const checkedMatches = content.match(/^\s*[-*]\s*\[[xX]\]/gm) || [];
const total = uncheckedMatches.length + checkedMatches.length;
const completed = checkedMatches.length;
return {
total,
completed,
isComplete: total === 0 || completed === total
};
} catch {
return { total: 0, completed: 0, isComplete: true };
}
}
// src/features/run-continuation-state/constants.ts
var CONTINUATION_MARKER_DIR = ".sisyphus/run-continuation";
// src/features/run-continuation-state/storage.ts
import { existsSync as existsSync12, mkdirSync as mkdirSync4, readFileSync as readFileSync10, rmSync, writeFileSync as writeFileSync6 } from "fs";
import { join as join10 } from "path";
function getMarkerPath(directory, sessionID) {
return join10(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
}
function readContinuationMarker(directory, sessionID) {
const markerPath = getMarkerPath(directory, sessionID);
if (!existsSync12(markerPath))
return null;
try {
const raw = readFileSync10(markerPath, "utf-8");
const parsed = JSON.parse(raw);
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
return null;
return parsed;
} catch {
return null;
}
}
function isContinuationMarkerActive(marker) {
if (!marker)
return false;
return Object.values(marker.sources).some((entry) => entry?.state === "active");
}
function getActiveContinuationMarkerReason(marker) {
if (!marker)
return null;
const active = Object.entries(marker.sources).find(([, entry2]) => entry2?.state === "active");
if (!active || !active[1])
return null;
const [source, entry] = active;
return entry.reason ?? `${source} continuation is active`;
}
// src/hooks/ralph-loop/storage.ts
init_frontmatter();
import { existsSync as existsSync13, readFileSync as readFileSync11, writeFileSync as writeFileSync7, unlinkSync, mkdirSync as mkdirSync5 } from "fs";
import { dirname as dirname3, join as join11 } from "path";
// src/hooks/ralph-loop/constants.ts
var DEFAULT_STATE_FILE = ".sisyphus/ralph-loop.local.md";
var DEFAULT_MAX_ITERATIONS = 100;
var DEFAULT_COMPLETION_PROMISE = "DONE";
// src/hooks/ralph-loop/storage.ts
function getStateFilePath(directory, customPath) {
return customPath ? join11(directory, customPath) : join11(directory, DEFAULT_STATE_FILE);
}
function readState(directory, customPath) {
const filePath = getStateFilePath(directory, customPath);
if (!existsSync13(filePath)) {
return null;
}
try {
const content = readFileSync11(filePath, "utf-8");
const { data, body } = parseFrontmatter(content);
const active = data.active;
const iteration = data.iteration;
if (active === undefined || iteration === undefined) {
return null;
}
const isActive = active === true || active === "true";
const iterationNum = typeof iteration === "number" ? iteration : Number(iteration);
if (isNaN(iterationNum)) {
return null;
}
const stripQuotes = (val) => {
const str3 = String(val ?? "");
return str3.replace(/^["']|["']$/g, "");
};
const ultrawork = data.ultrawork === true || data.ultrawork === "true" ? true : undefined;
const maxIterations = data.max_iterations === undefined || data.max_iterations === "" ? ultrawork ? undefined : DEFAULT_MAX_ITERATIONS : Number(data.max_iterations) || DEFAULT_MAX_ITERATIONS;
return {
active: isActive,
iteration: iterationNum,
max_iterations: maxIterations,
message_count_at_start: typeof data.message_count_at_start === "number" ? data.message_count_at_start : typeof data.message_count_at_start === "string" && data.message_count_at_start.trim() !== "" ? Number(data.message_count_at_start) : undefined,
completion_promise: stripQuotes(data.completion_promise) || DEFAULT_COMPLETION_PROMISE,
initial_completion_promise: data.initial_completion_promise ? stripQuotes(data.initial_completion_promise) : undefined,
verification_attempt_id: data.verification_attempt_id ? stripQuotes(data.verification_attempt_id) : undefined,
verification_session_id: data.verification_session_id ? stripQuotes(data.verification_session_id) : undefined,
started_at: stripQuotes(data.started_at) || new Date().toISOString(),
prompt: body.trim(),
session_id: data.session_id ? stripQuotes(data.session_id) : undefined,
ultrawork,
verification_pending: data.verification_pending === true || data.verification_pending === "true" ? true : undefined,
strategy: data.strategy === "reset" || data.strategy === "continue" ? data.strategy : undefined
};
} catch {
return null;
}
}
// src/cli/run/continuation-state.ts
function getContinuationState(directory, sessionID) {
const marker = readContinuationMarker(directory, sessionID);
return {
hasActiveBoulder: hasActiveBoulderContinuation(directory, sessionID),
hasActiveRalphLoop: hasActiveRalphLoopContinuation(directory, sessionID),
hasHookMarker: marker !== null,
hasTodoHookMarker: marker?.sources.todo !== undefined,
hasActiveHookMarker: isContinuationMarkerActive(marker),
activeHookMarkerReason: getActiveContinuationMarkerReason(marker)
};
}
function hasActiveBoulderContinuation(directory, sessionID) {
const boulder = readBoulderState(directory);
if (!boulder)
return false;
if (!boulder.session_ids.includes(sessionID))
return false;
const progress = getPlanProgress(boulder.active_plan);
return !progress.isComplete;
}
function hasActiveRalphLoopContinuation(directory, sessionID) {
const state = readState(directory);
if (!state || !state.active)
return false;
if (state.session_id && state.session_id !== sessionID) {
return false;
}
return true;
}
// src/cli/run/completion.ts
async function checkCompletionConditions(ctx) {
try {
const continuationState = getContinuationState(ctx.directory, ctx.sessionID);
if (continuationState.hasActiveHookMarker) {
const reason = continuationState.activeHookMarkerReason ?? "continuation hook is active";
logWaiting(ctx, reason);
return false;
}
if (!continuationState.hasTodoHookMarker && !await areAllTodosComplete(ctx)) {
return false;
}
if (!await areAllChildrenIdle(ctx)) {
return false;
}
if (!areContinuationHooksIdle(ctx, continuationState)) {
return false;
}
return true;
} catch (err) {
console.error(import_picocolors12.default.red(`[completion] API error: ${err}`));
return false;
}
}
function areContinuationHooksIdle(ctx, continuationState) {
if (continuationState.hasActiveBoulder) {
logWaiting(ctx, "boulder continuation is active");
return false;
}
if (continuationState.hasActiveRalphLoop) {
logWaiting(ctx, "ralph-loop continuation is active");
return false;
}
return true;
}
async function areAllTodosComplete(ctx) {
const todosRes = await ctx.client.session.todo({
path: { id: ctx.sessionID },
query: { directory: ctx.directory }
});
const todos = normalizeSDKResponse(todosRes, []);
const incompleteTodos = todos.filter((t) => t.status !== "completed" && t.status !== "cancelled");
if (incompleteTodos.length > 0) {
logWaiting(ctx, `${incompleteTodos.length} todos remaining`);
return false;
}
return true;
}
async function areAllChildrenIdle(ctx) {
const allStatuses = await fetchAllStatuses(ctx);
return areAllDescendantsIdle(ctx, ctx.sessionID, allStatuses);
}
async function fetchAllStatuses(ctx) {
const statusRes = await ctx.client.session.status({
query: { directory: ctx.directory }
});
return normalizeSDKResponse(statusRes, {});
}
async function areAllDescendantsIdle(ctx, sessionID, allStatuses) {
const childrenRes = await ctx.client.session.children({
path: { id: sessionID },
query: { directory: ctx.directory }
});
const children = normalizeSDKResponse(childrenRes, []);
for (const child of children) {
const status = allStatuses[child.id];
if (status && status.type !== "idle") {
logWaiting(ctx, `session ${child.id.slice(0, 8)}... is ${status.type}`);
return false;
}
const descendantsIdle = await areAllDescendantsIdle(ctx, child.id, allStatuses);
if (!descendantsIdle) {
return false;
}
}
return true;
}
function logWaiting(ctx, message) {
if (!ctx.verbose) {
return;
}
console.log(import_picocolors12.default.dim(` Waiting: ${message}`));
}
// src/cli/run/poll-for-completion.ts
init_shared();
var DEFAULT_POLL_INTERVAL_MS = 500;
var DEFAULT_REQUIRED_CONSECUTIVE = 1;
var ERROR_GRACE_CYCLES = 3;
var MIN_STABILIZATION_MS = 1000;
var DEFAULT_EVENT_WATCHDOG_MS = 30000;
var DEFAULT_SECONDARY_MEANINGFUL_WORK_TIMEOUT_MS = 60000;
async function pollForCompletion(ctx, eventState, abortController, options = {}) {
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
const requiredConsecutive = options.requiredConsecutive ?? DEFAULT_REQUIRED_CONSECUTIVE;
const rawMinStabilizationMs = options.minStabilizationMs ?? MIN_STABILIZATION_MS;
const minStabilizationMs = rawMinStabilizationMs > 0 ? rawMinStabilizationMs : MIN_STABILIZATION_MS;
const eventWatchdogMs = options.eventWatchdogMs ?? DEFAULT_EVENT_WATCHDOG_MS;
const secondaryMeaningfulWorkTimeoutMs = options.secondaryMeaningfulWorkTimeoutMs ?? DEFAULT_SECONDARY_MEANINGFUL_WORK_TIMEOUT_MS;
let consecutiveCompleteChecks = 0;
let errorCycleCount = 0;
let firstWorkTimestamp = null;
let secondaryTimeoutChecked = false;
const pollStartTimestamp = Date.now();
while (!abortController.signal.aborted) {
await new Promise((resolve2) => setTimeout(resolve2, pollIntervalMs));
if (abortController.signal.aborted) {
return 130;
}
if (eventState.mainSessionError) {
errorCycleCount++;
if (errorCycleCount >= ERROR_GRACE_CYCLES) {
console.error(import_picocolors13.default.red(`
Session ended with error: ${eventState.lastError}`));
console.error(import_picocolors13.default.yellow("Check if todos were completed before the error."));
return 1;
}
continue;
} else {
errorCycleCount = 0;
}
let mainSessionStatus = null;
if (eventState.lastEventTimestamp !== null) {
const timeSinceLastEvent = Date.now() - eventState.lastEventTimestamp;
if (timeSinceLastEvent > eventWatchdogMs) {
console.log(import_picocolors13.default.yellow(`
No events for ${Math.round(timeSinceLastEvent / 1000)}s, verifying session status...`));
mainSessionStatus = await getMainSessionStatus(ctx);
if (mainSessionStatus === "idle") {
eventState.mainSessionIdle = true;
} else if (mainSessionStatus === "busy" || mainSessionStatus === "retry") {
eventState.mainSessionIdle = false;
}
eventState.lastEventTimestamp = Date.now();
}
}
if (mainSessionStatus === null) {
mainSessionStatus = await getMainSessionStatus(ctx);
}
if (mainSessionStatus === "busy" || mainSessionStatus === "retry") {
eventState.mainSessionIdle = false;
} else if (mainSessionStatus === "idle") {
eventState.mainSessionIdle = true;
}
if (!eventState.mainSessionIdle) {
consecutiveCompleteChecks = 0;
continue;
}
if (eventState.currentTool !== null) {
consecutiveCompleteChecks = 0;
continue;
}
if (!eventState.hasReceivedMeaningfulWork) {
if (Date.now() - pollStartTimestamp < minStabilizationMs) {
consecutiveCompleteChecks = 0;
continue;
}
if (Date.now() - pollStartTimestamp > secondaryMeaningfulWorkTimeoutMs && !secondaryTimeoutChecked) {
secondaryTimeoutChecked = true;
const childrenRes = await ctx.client.session.children({
path: { id: ctx.sessionID },
query: { directory: ctx.directory }
});
const children = normalizeSDKResponse(childrenRes, []);
const todosRes = await ctx.client.session.todo({
path: { id: ctx.sessionID },
query: { directory: ctx.directory }
});
const todos = normalizeSDKResponse(todosRes, []);
const hasActiveChildren = Array.isArray(children) && children.length > 0;
const hasActiveTodos = Array.isArray(todos) && todos.some((t) => t?.status !== "completed" && t?.status !== "cancelled");
const hasActiveWork = hasActiveChildren || hasActiveTodos;
if (hasActiveWork) {
eventState.hasReceivedMeaningfulWork = true;
console.log(import_picocolors13.default.yellow(`
No meaningful work events for ${Math.round(secondaryMeaningfulWorkTimeoutMs / 1000)}s but session has active work - assuming in progress`));
}
}
} else {
if (firstWorkTimestamp === null) {
firstWorkTimestamp = Date.now();
}
if (Date.now() - firstWorkTimestamp < minStabilizationMs) {
consecutiveCompleteChecks = 0;
continue;
}
}
const shouldExit = await checkCompletionConditions(ctx);
if (shouldExit) {
if (abortController.signal.aborted) {
return 130;
}
consecutiveCompleteChecks++;
if (consecutiveCompleteChecks >= requiredConsecutive) {
console.log(import_picocolors13.default.green(`
All tasks completed.`));
return 0;
}
} else {
consecutiveCompleteChecks = 0;
}
}
return 130;
}
async function getMainSessionStatus(ctx) {
try {
const statusesRes = await ctx.client.session.status({
query: { directory: ctx.directory }
});
const statuses = normalizeSDKResponse(statusesRes, {});
const status = statuses[ctx.sessionID]?.type;
if (status === "idle" || status === "busy" || status === "retry") {
return status;
}
return null;
} catch {
return null;
}
}
// src/cli/run/agent-profile-colors.ts
init_shared();
async function loadAgentProfileColors(client3) {
try {
const agentsRes = await client3.app.agents();
const agents = normalizeSDKResponse(agentsRes, [], {
preferResponseOnMissingData: true
});
const colors = {};
for (const agent of agents) {
if (!agent.name || !agent.color)
continue;
colors[agent.name] = agent.color;
}
return colors;
} catch {
return {};
}
}
// src/cli/run/stdin-suppression.ts
function includesCtrlC(chunk) {
const text = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
return text.includes("\x03");
}
function suppressRunInput(stdin = process.stdin, onInterrupt = () => {
process.kill(process.pid, "SIGINT");
}) {
if (!stdin.isTTY) {
return () => {};
}
const wasRaw = stdin.isRaw === true;
const wasPaused = stdin.isPaused?.() ?? false;
const canSetRawMode = typeof stdin.setRawMode === "function";
const onData = (chunk) => {
if (includesCtrlC(chunk)) {
onInterrupt();
}
};
if (canSetRawMode) {
stdin.setRawMode(true);
}
stdin.on("data", onData);
stdin.resume();
return () => {
stdin.removeListener("data", onData);
if (canSetRawMode) {
stdin.setRawMode(wasRaw);
}
if (wasPaused) {
stdin.pause();
}
};
}
// src/cli/run/timestamp-output.ts
function formatTimestamp(date5) {
const hh = String(date5.getHours()).padStart(2, "0");
const mm = String(date5.getMinutes()).padStart(2, "0");
const ss = String(date5.getSeconds()).padStart(2, "0");
return `${hh}:${mm}:${ss}`;
}
function createTimestampTransformer(now = () => new Date) {
let atLineStart = true;
return (chunk) => {
if (!chunk)
return "";
let output = "";
for (let i2 = 0;i2 < chunk.length; i2++) {
const ch = chunk[i2];
if (atLineStart) {
output += `[${formatTimestamp(now())}] `;
atLineStart = false;
}
output += ch;
if (ch === `
`) {
atLineStart = true;
}
}
return output;
};
}
function createTimestampedStdoutController(stdout = process.stdout) {
const originalWrite = stdout.write.bind(stdout);
const transform2 = createTimestampTransformer();
function enable() {
const write = (chunk, encodingOrCallback, callback) => {
const text = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString(typeof encodingOrCallback === "string" ? encodingOrCallback : undefined);
const stamped = transform2(text);
if (typeof encodingOrCallback === "function") {
return originalWrite(stamped, encodingOrCallback);
}
if (encodingOrCallback !== undefined) {
return originalWrite(stamped, encodingOrCallback, callback);
}
return originalWrite(stamped);
};
stdout.write = write;
}
function restore() {
stdout.write = originalWrite;
}
return { enable, restore };
}
// src/cli/run/runner.ts
var EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS = 2000;
async function waitForEventProcessorShutdown(eventProcessor, timeoutMs = EVENT_PROCESSOR_SHUTDOWN_TIMEOUT_MS) {
const completed = await Promise.race([
eventProcessor.then(() => true),
new Promise((resolve2) => setTimeout(() => resolve2(false), timeoutMs))
]);
}
async function run(options) {
process.env.OPENCODE_CLI_RUN_MODE = "true";
const startTime = Date.now();
const {
message,
directory = process.cwd()
} = options;
const jsonManager = options.json ? createJsonOutputManager() : null;
if (jsonManager)
jsonManager.redirectToStderr();
const timestampOutput = options.json || options.timestamp === false ? null : createTimestampedStdoutController();
timestampOutput?.enable();
const pluginConfig = loadPluginConfig(directory, { command: "run" });
const resolvedAgent = resolveRunAgent(options, pluginConfig);
const resolvedModel = resolveRunModel(options.model);
const abortController = new AbortController;
try {
const { client: client3, cleanup: serverCleanup } = await createServerConnection({
port: options.port,
attach: options.attach,
signal: abortController.signal
});
const cleanup = () => {
serverCleanup();
};
const restoreInput = suppressRunInput();
const handleSigint = () => {
console.log(import_picocolors14.default.yellow(`
Interrupted. Shutting down...`));
restoreInput();
cleanup();
process.exit(130);
};
process.on("SIGINT", handleSigint);
try {
const sessionID = await resolveSession({
client: client3,
sessionId: options.sessionId,
directory
});
console.log(import_picocolors14.default.dim(`Session: ${sessionID}`));
if (resolvedModel) {
console.log(import_picocolors14.default.dim(`Model: ${resolvedModel.providerID}/${resolvedModel.modelID}`));
}
const ctx = {
client: client3,
sessionID,
directory,
abortController,
verbose: options.verbose ?? false
};
const events = await client3.event.subscribe({ query: { directory } });
const eventState = createEventState();
eventState.agentColorsByName = await loadAgentProfileColors(client3);
const eventProcessor = processEvents(ctx, events.stream, eventState).catch(() => {});
await client3.session.promptAsync({
path: { id: sessionID },
body: {
agent: resolvedAgent,
...resolvedModel ? { model: resolvedModel } : {},
tools: {
question: false
},
parts: [{ type: "text", text: message }]
},
query: { directory }
});
const exitCode = await pollForCompletion(ctx, eventState, abortController);
abortController.abort();
await waitForEventProcessorShutdown(eventProcessor);
cleanup();
const durationMs = Date.now() - startTime;
if (options.onComplete) {
await executeOnCompleteHook({
command: options.onComplete,
sessionId: sessionID,
exitCode,
durationMs,
messageCount: eventState.messageCount
});
}
if (jsonManager) {
jsonManager.emitResult({
sessionId: sessionID,
success: exitCode === 0,
durationMs,
messageCount: eventState.messageCount,
summary: eventState.lastPartText.slice(0, 200) || "Run completed"
});
}
return exitCode;
} catch (err) {
cleanup();
throw err;
} finally {
process.removeListener("SIGINT", handleSigint);
restoreInput();
}
} catch (err) {
if (jsonManager)
jsonManager.restore();
timestampOutput?.restore();
if (err instanceof Error && err.name === "AbortError") {
return 130;
}
console.error(import_picocolors14.default.red(`Error: ${serializeError(err)}`));
return 1;
} finally {
timestampOutput?.restore();
}
}
// src/cli/get-local-version/get-local-version.ts
init_checker();
// src/cli/get-local-version/formatter.ts
var import_picocolors15 = __toESM(require_picocolors(), 1);
var SYMBOLS2 = {
check: import_picocolors15.default.green("[OK]"),
cross: import_picocolors15.default.red("[X]"),
arrow: import_picocolors15.default.cyan("->"),
info: import_picocolors15.default.blue("[i]"),
warn: import_picocolors15.default.yellow("[!]"),
pin: import_picocolors15.default.magenta("[PINNED]"),
dev: import_picocolors15.default.cyan("[DEV]")
};
function formatVersionOutput(info) {
const lines = [];
lines.push("");
lines.push(import_picocolors15.default.bold(import_picocolors15.default.white("oh-my-opencode Version Information")));
lines.push(import_picocolors15.default.dim("\u2500".repeat(50)));
lines.push("");
if (info.currentVersion) {
lines.push(` Current Version: ${import_picocolors15.default.cyan(info.currentVersion)}`);
} else {
lines.push(` Current Version: ${import_picocolors15.default.dim("unknown")}`);
}
if (!info.isLocalDev && info.latestVersion) {
lines.push(` Latest Version: ${import_picocolors15.default.cyan(info.latestVersion)}`);
}
lines.push("");
switch (info.status) {
case "up-to-date":
lines.push(` ${SYMBOLS2.check} ${import_picocolors15.default.green("You're up to date!")}`);
break;
case "outdated":
lines.push(` ${SYMBOLS2.warn} ${import_picocolors15.default.yellow("Update available")}`);
lines.push(` ${import_picocolors15.default.dim("Run:")} ${import_picocolors15.default.cyan("cd ~/.config/opencode && bun update oh-my-opencode")}`);
break;
case "local-dev":
lines.push(` ${SYMBOLS2.dev} ${import_picocolors15.default.cyan("Running in local development mode")}`);
lines.push(` ${import_picocolors15.default.dim("Using file:// protocol from config")}`);
break;
case "pinned":
lines.push(` ${SYMBOLS2.pin} ${import_picocolors15.default.magenta(`Version pinned to ${info.pinnedVersion}`)}`);
lines.push(` ${import_picocolors15.default.dim("Update check skipped for pinned versions")}`);
break;
case "error":
lines.push(` ${SYMBOLS2.cross} ${import_picocolors15.default.red("Unable to check for updates")}`);
lines.push(` ${import_picocolors15.default.dim("Network error or npm registry unavailable")}`);
break;
case "unknown":
lines.push(` ${SYMBOLS2.info} ${import_picocolors15.default.yellow("Version information unavailable")}`);
break;
}
lines.push("");
return lines.join(`
`);
}
function formatJsonOutput(info) {
return JSON.stringify(info, null, 2);
}
// src/cli/get-local-version/get-local-version.ts
async function getLocalVersion(options = {}) {
const directory = options.directory ?? process.cwd();
try {
if (isLocalDevMode(directory)) {
const currentVersion2 = getLocalDevVersion(directory) ?? getCachedVersion();
const info2 = {
currentVersion: currentVersion2,
latestVersion: null,
isUpToDate: false,
isLocalDev: true,
isPinned: false,
pinnedVersion: null,
status: "local-dev"
};
console.log(options.json ? formatJsonOutput(info2) : formatVersionOutput(info2));
return 0;
}
const pluginInfo = findPluginEntry(directory);
if (pluginInfo?.isPinned) {
const info2 = {
currentVersion: pluginInfo.pinnedVersion,
latestVersion: null,
isUpToDate: false,
isLocalDev: false,
isPinned: true,
pinnedVersion: pluginInfo.pinnedVersion,
status: "pinned"
};
console.log(options.json ? formatJsonOutput(info2) : formatVersionOutput(info2));
return 0;
}
const currentVersion = getCachedVersion();
if (!currentVersion) {
const info2 = {
currentVersion: null,
latestVersion: null,
isUpToDate: false,
isLocalDev: false,
isPinned: false,
pinnedVersion: null,
status: "unknown"
};
console.log(options.json ? formatJsonOutput(info2) : formatVersionOutput(info2));
return 1;
}
const { extractChannel: extractChannel2 } = await Promise.resolve().then(() => (init_auto_update_checker(), exports_auto_update_checker));
const channel = extractChannel2(pluginInfo?.pinnedVersion ?? currentVersion);
const latestVersion = await getLatestVersion(channel);
if (!latestVersion) {
const info2 = {
currentVersion,
latestVersion: null,
isUpToDate: false,
isLocalDev: false,
isPinned: false,
pinnedVersion: null,
status: "error"
};
console.log(options.json ? formatJsonOutput(info2) : formatVersionOutput(info2));
return 0;
}
const isUpToDate = currentVersion === latestVersion;
const info = {
currentVersion,
latestVersion,
isUpToDate,
isLocalDev: false,
isPinned: false,
pinnedVersion: null,
status: isUpToDate ? "up-to-date" : "outdated"
};
console.log(options.json ? formatJsonOutput(info) : formatVersionOutput(info));
return 0;
} catch (error48) {
const info = {
currentVersion: null,
latestVersion: null,
isUpToDate: false,
isLocalDev: false,
isPinned: false,
pinnedVersion: null,
status: "error"
};
console.log(options.json ? formatJsonOutput(info) : formatVersionOutput(info));
return 1;
}
}
// src/cli/doctor/constants.ts
var import_picocolors16 = __toESM(require_picocolors(), 1);
var SYMBOLS3 = {
check: import_picocolors16.default.green("\u2713"),
cross: import_picocolors16.default.red("\u2717"),
warn: import_picocolors16.default.yellow("\u26A0"),
info: import_picocolors16.default.blue("\u2139"),
arrow: import_picocolors16.default.cyan("\u2192"),
bullet: import_picocolors16.default.dim("\u2022"),
skip: import_picocolors16.default.dim("\u25CB")
};
var STATUS_COLORS = {
pass: import_picocolors16.default.green,
fail: import_picocolors16.default.red,
warn: import_picocolors16.default.yellow,
skip: import_picocolors16.default.dim
};
var CHECK_IDS = {
SYSTEM: "system",
CONFIG: "config",
TOOLS: "tools",
MODELS: "models"
};
var CHECK_NAMES = {
[CHECK_IDS.SYSTEM]: "System",
[CHECK_IDS.CONFIG]: "Configuration",
[CHECK_IDS.TOOLS]: "Tools",
[CHECK_IDS.MODELS]: "Models"
};
var EXIT_CODES = {
SUCCESS: 0,
FAILURE: 1
};
var MIN_OPENCODE_VERSION = "1.0.150";
var PACKAGE_NAME2 = "oh-my-opencode";
var OPENCODE_BINARIES2 = ["opencode", "opencode-desktop"];
// src/cli/doctor/checks/system.ts
import { existsSync as existsSync23, readFileSync as readFileSync21 } from "fs";
// src/cli/doctor/checks/system-binary.ts
init_spawn_with_windows_hide();
import { existsSync as existsSync20 } from "fs";
import { homedir as homedir5 } from "os";
import { join as join17 } from "path";
function getDesktopAppPaths(platform) {
const home = homedir5();
switch (platform) {
case "darwin":
return [
"/Applications/OpenCode.app/Contents/MacOS/OpenCode",
join17(home, "Applications", "OpenCode.app", "Contents", "MacOS", "OpenCode")
];
case "win32": {
const programFiles = process.env.ProgramFiles;
const localAppData = process.env.LOCALAPPDATA;
const paths = [];
if (programFiles) {
paths.push(join17(programFiles, "OpenCode", "OpenCode.exe"));
}
if (localAppData) {
paths.push(join17(localAppData, "OpenCode", "OpenCode.exe"));
}
return paths;
}
case "linux":
return [
"/usr/bin/opencode",
"/usr/lib/opencode/opencode",
join17(home, "Applications", "opencode-desktop-linux-x86_64.AppImage"),
join17(home, "Applications", "opencode-desktop-linux-aarch64.AppImage")
];
default:
return [];
}
}
function buildVersionCommand(binaryPath, platform) {
if (platform === "win32" && binaryPath.toLowerCase().endsWith(".ps1")) {
return ["powershell", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", binaryPath, "--version"];
}
return [binaryPath, "--version"];
}
function findDesktopBinary(platform = process.platform, checkExists = existsSync20) {
for (const desktopPath of getDesktopAppPaths(platform)) {
if (checkExists(desktopPath)) {
return { binary: "opencode", path: desktopPath };
}
}
return null;
}
async function findOpenCodeBinary() {
for (const binary2 of OPENCODE_BINARIES2) {
const path10 = Bun.which(binary2);
if (path10) {
return { binary: binary2, path: path10 };
}
}
return findDesktopBinary();
}
async function getOpenCodeVersion2(binaryPath, platform = process.platform) {
try {
const command = buildVersionCommand(binaryPath, platform);
const processResult = spawnWithWindowsHide(command, { stdout: "pipe", stderr: "pipe" });
const output = await new Response(processResult.stdout).text();
await processResult.exited;
if (processResult.exitCode !== 0)
return null;
return output.trim() || null;
} catch {
return null;
}
}
function compareVersions(current, minimum) {
const parseVersion = (version2) => version2.replace(/^v/, "").split("-")[0].split(".").map((part) => Number.parseInt(part, 10) || 0);
const currentParts = parseVersion(current);
const minimumParts = parseVersion(minimum);
const length = Math.max(currentParts.length, minimumParts.length);
for (let index = 0;index < length; index++) {
const currentPart = currentParts[index] ?? 0;
const minimumPart = minimumParts[index] ?? 0;
if (currentPart > minimumPart)
return true;
if (currentPart < minimumPart)
return false;
}
return true;
}
// src/cli/doctor/checks/system-plugin.ts
import { existsSync as existsSync21, readFileSync as readFileSync19 } from "fs";
init_shared();
function detectConfigPath() {
const paths = getOpenCodeConfigPaths({ binary: "opencode", version: null });
if (existsSync21(paths.configJsonc))
return paths.configJsonc;
if (existsSync21(paths.configJson))
return paths.configJson;
return null;
}
function parsePluginVersion(entry) {
if (!entry.startsWith(`${PACKAGE_NAME2}@`))
return null;
const value = entry.slice(PACKAGE_NAME2.length + 1);
if (!value || value === "latest")
return null;
return value;
}
function findPluginEntry2(entries) {
for (const entry of entries) {
if (entry === PACKAGE_NAME2 || entry.startsWith(`${PACKAGE_NAME2}@`)) {
return { entry, isLocalDev: false };
}
if (entry.startsWith("file://") && entry.includes(PACKAGE_NAME2)) {
return { entry, isLocalDev: true };
}
}
return null;
}
function getPluginInfo() {
const configPath = detectConfigPath();
if (!configPath) {
return {
registered: false,
configPath: null,
entry: null,
isPinned: false,
pinnedVersion: null,
isLocalDev: false
};
}
try {
const content = readFileSync19(configPath, "utf-8");
const parsedConfig = parseJsonc(content);
const pluginEntry = findPluginEntry2(parsedConfig.plugin ?? []);
if (!pluginEntry) {
return {
registered: false,
configPath,
entry: null,
isPinned: false,
pinnedVersion: null,
isLocalDev: false
};
}
const pinnedVersion = parsePluginVersion(pluginEntry.entry);
return {
registered: true,
configPath,
entry: pluginEntry.entry,
isPinned: pinnedVersion !== null && /^\d+\.\d+\.\d+/.test(pinnedVersion),
pinnedVersion,
isLocalDev: pluginEntry.isLocalDev
};
} catch {
return {
registered: false,
configPath,
entry: null,
isPinned: false,
pinnedVersion: null,
isLocalDev: false
};
}
}
// src/cli/doctor/checks/system-loaded-version.ts
init_checker();
init_auto_update_checker();
import { existsSync as existsSync22, readFileSync as readFileSync20 } from "fs";
import { homedir as homedir6 } from "os";
import { join as join18 } from "path";
init_shared();
function getPlatformDefaultCacheDir(platform = process.platform) {
if (platform === "darwin")
return join18(homedir6(), "Library", "Caches");
if (platform === "win32")
return process.env.LOCALAPPDATA ?? join18(homedir6(), "AppData", "Local");
return join18(homedir6(), ".cache");
}
function resolveOpenCodeCacheDir() {
const xdgCacheHome = process.env.XDG_CACHE_HOME;
if (xdgCacheHome)
return join18(xdgCacheHome, "opencode");
const fromShared = getOpenCodeCacheDir();
const platformDefault = join18(getPlatformDefaultCacheDir(), "opencode");
if (existsSync22(fromShared) || !existsSync22(platformDefault))
return fromShared;
return platformDefault;
}
function readPackageJson(filePath) {
if (!existsSync22(filePath))
return null;
try {
const content = readFileSync20(filePath, "utf-8");
return parseJsonc(content);
} catch {
return null;
}
}
function normalizeVersion(value) {
if (!value)
return null;
const match = value.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/);
return match?.[0] ?? null;
}
function getLoadedPluginVersion() {
const configPaths = getOpenCodeConfigPaths({ binary: "opencode" });
const cacheDir = resolveOpenCodeCacheDir();
const candidates = [
{
cacheDir: configPaths.configDir,
cachePackagePath: configPaths.packageJson,
installedPackagePath: join18(configPaths.configDir, "node_modules", PACKAGE_NAME2, "package.json")
},
{
cacheDir,
cachePackagePath: join18(cacheDir, "package.json"),
installedPackagePath: join18(cacheDir, "node_modules", PACKAGE_NAME2, "package.json")
}
];
const selectedCandidate = candidates.find((candidate) => existsSync22(candidate.installedPackagePath)) ?? candidates[0];
const { cacheDir: selectedDir, cachePackagePath, installedPackagePath } = selectedCandidate;
const cachePackage = readPackageJson(cachePackagePath);
const installedPackage = readPackageJson(installedPackagePath);
const expectedVersion = normalizeVersion(cachePackage?.dependencies?.[PACKAGE_NAME2]);
const loadedVersion = normalizeVersion(installedPackage?.version);
return {
cacheDir: selectedDir,
cachePackagePath,
installedPackagePath,
expectedVersion,
loadedVersion
};
}
async function getLatestPluginVersion(currentVersion) {
const channel = extractChannel(currentVersion);
return getLatestVersion(channel);
}
function getSuggestedInstallTag(currentVersion) {
return extractChannel(currentVersion);
}
// src/cli/doctor/checks/system.ts
init_shared();
function isConfigValid(configPath) {
if (!configPath)
return true;
if (!existsSync23(configPath))
return false;
try {
parseJsonc(readFileSync21(configPath, "utf-8"));
return true;
} catch {
return false;
}
}
function getResultStatus(issues) {
if (issues.some((issue2) => issue2.severity === "error"))
return "fail";
if (issues.some((issue2) => issue2.severity === "warning"))
return "warn";
return "pass";
}
function buildMessage(status, issues) {
if (status === "pass")
return "System checks passed";
if (status === "fail")
return `${issues.length} system issue(s) detected`;
return `${issues.length} system warning(s) detected`;
}
async function gatherSystemInfo() {
const [binaryInfo, pluginInfo] = await Promise.all([findOpenCodeBinary(), Promise.resolve(getPluginInfo())]);
const loadedInfo = getLoadedPluginVersion();
const opencodeVersion = binaryInfo ? await getOpenCodeVersion2(binaryInfo.path) : null;
const pluginVersion = pluginInfo.pinnedVersion ?? loadedInfo.expectedVersion;
return {
opencodeVersion,
opencodePath: binaryInfo?.path ?? null,
pluginVersion,
loadedVersion: loadedInfo.loadedVersion,
bunVersion: Bun.version,
configPath: pluginInfo.configPath,
configValid: isConfigValid(pluginInfo.configPath),
isLocalDev: pluginInfo.isLocalDev
};
}
async function checkSystem() {
const [systemInfo, pluginInfo] = await Promise.all([gatherSystemInfo(), Promise.resolve(getPluginInfo())]);
const loadedInfo = getLoadedPluginVersion();
const latestVersion = await getLatestPluginVersion(systemInfo.loadedVersion);
const installTag = getSuggestedInstallTag(systemInfo.loadedVersion);
const issues = [];
if (!systemInfo.opencodePath) {
issues.push({
title: "OpenCode binary not found",
description: "Install OpenCode CLI or desktop and ensure the binary is available.",
fix: "Install from https://opencode.ai/docs",
severity: "error",
affects: ["doctor", "run"]
});
}
if (systemInfo.opencodeVersion && !compareVersions(systemInfo.opencodeVersion, MIN_OPENCODE_VERSION)) {
issues.push({
title: "OpenCode version below minimum",
description: `Detected ${systemInfo.opencodeVersion}; required >= ${MIN_OPENCODE_VERSION}.`,
fix: "Update OpenCode to the latest stable release",
severity: "warning",
affects: ["tooling", "doctor"]
});
}
if (!pluginInfo.registered) {
issues.push({
title: "oh-my-opencode is not registered",
description: "Plugin entry is missing from OpenCode configuration.",
fix: "Run: bunx oh-my-opencode install",
severity: "error",
affects: ["all agents"]
});
}
if (loadedInfo.expectedVersion && loadedInfo.loadedVersion && loadedInfo.expectedVersion !== loadedInfo.loadedVersion) {
issues.push({
title: "Loaded plugin version mismatch",
description: `Cache expects ${loadedInfo.expectedVersion} but loaded ${loadedInfo.loadedVersion}.`,
fix: `Reinstall: cd "${loadedInfo.cacheDir}" && bun install`,
severity: "warning",
affects: ["plugin loading"]
});
}
if (systemInfo.loadedVersion && latestVersion && !compareVersions(systemInfo.loadedVersion, latestVersion)) {
issues.push({
title: "Loaded plugin is outdated",
description: `Loaded ${systemInfo.loadedVersion}, latest ${latestVersion}.`,
fix: `Update: cd "${loadedInfo.cacheDir}" && bun add oh-my-opencode@${installTag}`,
severity: "warning",
affects: ["plugin features"]
});
}
const status = getResultStatus(issues);
return {
name: CHECK_NAMES[CHECK_IDS.SYSTEM],
status,
message: buildMessage(status, issues),
details: [
systemInfo.opencodeVersion ? `OpenCode: ${systemInfo.opencodeVersion}` : "OpenCode: not detected",
`Plugin expected: ${systemInfo.pluginVersion ?? "unknown"}`,
`Plugin loaded: ${systemInfo.loadedVersion ?? "unknown"}`,
`Bun: ${systemInfo.bunVersion ?? "unknown"}`
],
issues
};
}
// src/cli/doctor/checks/config.ts
import { readFileSync as readFileSync24 } from "fs";
import { join as join22 } from "path";
init_shared();
// src/cli/doctor/checks/model-resolution-cache.ts
init_shared();
import { existsSync as existsSync24, readFileSync as readFileSync22 } from "fs";
import { homedir as homedir7 } from "os";
import { join as join19 } from "path";
function getOpenCodeCacheDir2() {
const xdgCache = process.env.XDG_CACHE_HOME;
if (xdgCache)
return join19(xdgCache, "opencode");
return join19(homedir7(), ".cache", "opencode");
}
function loadAvailableModelsFromCache() {
const cacheFile = join19(getOpenCodeCacheDir2(), "models.json");
if (!existsSync24(cacheFile)) {
return { providers: [], modelCount: 0, cacheExists: false };
}
try {
const content = readFileSync22(cacheFile, "utf-8");
const data = parseJsonc(content);
const providers = Object.keys(data);
let modelCount = 0;
for (const providerId of providers) {
const models = data[providerId]?.models;
if (models && typeof models === "object") {
modelCount += Object.keys(models).length;
}
}
return { providers, modelCount, cacheExists: true };
} catch {
return { providers: [], modelCount: 0, cacheExists: false };
}
}
// src/cli/doctor/checks/model-resolution.ts
init_model_requirements();
// src/cli/doctor/checks/model-resolution-config.ts
init_shared();
import { readFileSync as readFileSync23 } from "fs";
import { join as join20 } from "path";
var PACKAGE_NAME3 = "oh-my-opencode";
var USER_CONFIG_BASE = join20(getOpenCodeConfigPaths({ binary: "opencode", version: null }).configDir, PACKAGE_NAME3);
var PROJECT_CONFIG_BASE = join20(process.cwd(), ".opencode", PACKAGE_NAME3);
function loadOmoConfig() {
const projectDetected = detectConfigFile(PROJECT_CONFIG_BASE);
if (projectDetected.format !== "none") {
try {
const content = readFileSync23(projectDetected.path, "utf-8");
return parseJsonc(content);
} catch {
return null;
}
}
const userDetected = detectConfigFile(USER_CONFIG_BASE);
if (userDetected.format !== "none") {
try {
const content = readFileSync23(userDetected.path, "utf-8");
return parseJsonc(content);
} catch {
return null;
}
}
return null;
}
// src/cli/doctor/checks/model-resolution-details.ts
init_shared();
import { join as join21 } from "path";
// src/cli/doctor/checks/model-resolution-variant.ts
function formatModelWithVariant(model, variant) {
return variant ? `${model} (${variant})` : model;
}
function getAgentOverride(agentName, config2) {
const agentOverrides = config2.agents;
if (!agentOverrides)
return;
return agentOverrides[agentName] ?? Object.entries(agentOverrides).find(([key]) => key.toLowerCase() === agentName.toLowerCase())?.[1];
}
function getEffectiveVariant(agentName, requirement, config2) {
const agentOverride = getAgentOverride(agentName, config2);
if (agentOverride?.variant) {
return agentOverride.variant;
}
const categoryName = agentOverride?.category;
if (categoryName) {
const categoryVariant = config2.categories?.[categoryName]?.variant;
if (categoryVariant) {
return categoryVariant;
}
}
const firstEntry = requirement.fallbackChain[0];
return firstEntry?.variant ?? requirement.variant;
}
function getCategoryEffectiveVariant(categoryName, requirement, config2) {
const categoryVariant = config2.categories?.[categoryName]?.variant;
if (categoryVariant) {
return categoryVariant;
}
const firstEntry = requirement.fallbackChain[0];
return firstEntry?.variant ?? requirement.variant;
}
// src/cli/doctor/checks/model-resolution-details.ts
function buildModelResolutionDetails(options) {
const details = [];
const cacheFile = join21(getOpenCodeCacheDir(), "models.json");
details.push("\u2550\u2550\u2550 Available Models (from cache) \u2550\u2550\u2550");
details.push("");
if (options.available.cacheExists) {
details.push(` Providers in cache: ${options.available.providers.length}`);
details.push(` Sample: ${options.available.providers.slice(0, 6).join(", ")}${options.available.providers.length > 6 ? "..." : ""}`);
details.push(` Total models: ${options.available.modelCount}`);
details.push(` Cache: ${cacheFile}`);
details.push(` \u2139 Runtime: only connected providers used`);
details.push(` Refresh: opencode models --refresh`);
} else {
details.push(" \u26A0 Cache not found. Run 'opencode' to populate.");
}
details.push("");
details.push("\u2550\u2550\u2550 Configured Models \u2550\u2550\u2550");
details.push("");
details.push("Agents:");
for (const agent of options.info.agents) {
const marker = agent.userOverride ? "\u25CF" : "\u25CB";
const display = formatModelWithVariant(agent.effectiveModel, getEffectiveVariant(agent.name, agent.requirement, options.config));
details.push(` ${marker} ${agent.name}: ${display}`);
}
details.push("");
details.push("Categories:");
for (const category of options.info.categories) {
const marker = category.userOverride ? "\u25CF" : "\u25CB";
const display = formatModelWithVariant(category.effectiveModel, getCategoryEffectiveVariant(category.name, category.requirement, options.config));
details.push(` ${marker} ${category.name}: ${display}`);
}
details.push("");
details.push("\u25CF = user override, \u25CB = provider fallback");
return details;
}
// src/cli/doctor/checks/model-resolution-effective-model.ts
function formatProviderChain(providers) {
return providers.join(" \u2192 ");
}
function getEffectiveModel(requirement, userOverride) {
if (userOverride) {
return userOverride;
}
const firstEntry = requirement.fallbackChain[0];
if (!firstEntry) {
return "unknown";
}
return `${firstEntry.providers[0]}/${firstEntry.model}`;
}
function buildEffectiveResolution(requirement, userOverride) {
if (userOverride) {
return `User override: ${userOverride}`;
}
const firstEntry = requirement.fallbackChain[0];
if (!firstEntry) {
return "No fallback chain defined";
}
return `Provider fallback: ${formatProviderChain(firstEntry.providers)} \u2192 ${firstEntry.model}`;
}
// src/cli/doctor/checks/model-resolution.ts
function getModelResolutionInfoWithOverrides(config2) {
const agents = Object.entries(AGENT_MODEL_REQUIREMENTS).map(([name, requirement]) => {
const userOverride = config2.agents?.[name]?.model;
const userVariant = config2.agents?.[name]?.variant;
return {
name,
requirement,
userOverride,
userVariant,
effectiveModel: getEffectiveModel(requirement, userOverride),
effectiveResolution: buildEffectiveResolution(requirement, userOverride)
};
});
const categories2 = Object.entries(CATEGORY_MODEL_REQUIREMENTS).map(([name, requirement]) => {
const userOverride = config2.categories?.[name]?.model;
const userVariant = config2.categories?.[name]?.variant;
return {
name,
requirement,
userOverride,
userVariant,
effectiveModel: getEffectiveModel(requirement, userOverride),
effectiveResolution: buildEffectiveResolution(requirement, userOverride)
};
});
return { agents, categories: categories2 };
}
async function checkModels() {
const config2 = loadOmoConfig() ?? {};
const info = getModelResolutionInfoWithOverrides(config2);
const available = loadAvailableModelsFromCache();
const issues = [];
if (!available.cacheExists) {
issues.push({
title: "Model cache not found",
description: "OpenCode model cache is missing, so model availability cannot be validated.",
fix: "Run: opencode models --refresh",
severity: "warning",
affects: ["model resolution"]
});
}
const overrideCount = info.agents.filter((agent) => Boolean(agent.userOverride)).length + info.categories.filter((category) => Boolean(category.userOverride)).length;
return {
name: CHECK_NAMES[CHECK_IDS.MODELS],
status: issues.length > 0 ? "warn" : "pass",
message: `${info.agents.length} agents, ${info.categories.length} categories, ${overrideCount} override${overrideCount === 1 ? "" : "s"}`,
details: buildModelResolutionDetails({ info, available, config: config2 }),
issues
};
}
// src/cli/doctor/checks/config.ts
var USER_CONFIG_BASE2 = join22(getOpenCodeConfigDir({ binary: "opencode" }), PACKAGE_NAME2);
var PROJECT_CONFIG_BASE2 = join22(process.cwd(), ".opencode", PACKAGE_NAME2);
function findConfigPath() {
const projectConfig = detectConfigFile(PROJECT_CONFIG_BASE2);
if (projectConfig.format !== "none")
return projectConfig.path;
const userConfig = detectConfigFile(USER_CONFIG_BASE2);
if (userConfig.format !== "none")
return userConfig.path;
return null;
}
function validateConfig() {
const configPath = findConfigPath();
if (!configPath) {
return { exists: false, path: null, valid: true, config: null, errors: [] };
}
try {
const content = readFileSync24(configPath, "utf-8");
const rawConfig = parseJsonc(content);
const schemaResult = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
if (!schemaResult.success) {
return {
exists: true,
path: configPath,
valid: false,
config: rawConfig,
errors: schemaResult.error.issues.map((issue2) => `${issue2.path.join(".")}: ${issue2.message}`)
};
}
return { exists: true, path: configPath, valid: true, config: rawConfig, errors: [] };
} catch (error48) {
return {
exists: true,
path: configPath,
valid: false,
config: null,
errors: [error48 instanceof Error ? error48.message : "Failed to parse config"]
};
}
}
function collectModelResolutionIssues(config2) {
const issues = [];
const availableModels = loadAvailableModelsFromCache();
const resolution = getModelResolutionInfoWithOverrides(config2);
const invalidAgentOverrides = resolution.agents.filter((agent) => agent.userOverride && !agent.userOverride.includes("/"));
const invalidCategoryOverrides = resolution.categories.filter((category) => category.userOverride && !category.userOverride.includes("/"));
for (const invalidAgent of invalidAgentOverrides) {
issues.push({
title: `Invalid agent override: ${invalidAgent.name}`,
description: `Override '${invalidAgent.userOverride}' must be in provider/model format.`,
severity: "warning",
affects: [invalidAgent.name]
});
}
for (const invalidCategory of invalidCategoryOverrides) {
issues.push({
title: `Invalid category override: ${invalidCategory.name}`,
description: `Override '${invalidCategory.userOverride}' must be in provider/model format.`,
severity: "warning",
affects: [invalidCategory.name]
});
}
if (availableModels.cacheExists) {
const providerSet = new Set(availableModels.providers);
const unknownProviders = [
...resolution.agents.map((agent) => agent.userOverride),
...resolution.categories.map((category) => category.userOverride)
].filter((value) => Boolean(value)).map((value) => value.split("/")[0]).filter((provider) => provider.length > 0 && !providerSet.has(provider));
if (unknownProviders.length > 0) {
const uniqueProviders = [...new Set(unknownProviders)];
issues.push({
title: "Model override uses unavailable provider",
description: `Provider(s) not found in OpenCode model cache: ${uniqueProviders.join(", ")}`,
severity: "warning",
affects: ["model resolution"]
});
}
}
return issues;
}
async function checkConfig() {
const validation = validateConfig();
const issues = [];
if (!validation.exists) {
return {
name: CHECK_NAMES[CHECK_IDS.CONFIG],
status: "pass",
message: "No custom config found; defaults are used",
details: undefined,
issues
};
}
if (!validation.valid) {
issues.push(...validation.errors.map((error48) => ({
title: "Invalid configuration",
description: error48,
severity: "error",
affects: ["plugin startup"]
})));
return {
name: CHECK_NAMES[CHECK_IDS.CONFIG],
status: "fail",
message: `Configuration invalid (${issues.length} issue${issues.length > 1 ? "s" : ""})`,
details: validation.path ? [`Path: ${validation.path}`] : undefined,
issues
};
}
if (validation.config) {
issues.push(...collectModelResolutionIssues(validation.config));
}
return {
name: CHECK_NAMES[CHECK_IDS.CONFIG],
status: issues.length > 0 ? "warn" : "pass",
message: issues.length > 0 ? `${issues.length} configuration warning(s)` : "Configuration is valid",
details: validation.path ? [`Path: ${validation.path}`] : undefined,
issues
};
}
// src/cli/doctor/checks/dependencies.ts
init_spawn_with_windows_hide();
import { existsSync as existsSync25 } from "fs";
import { createRequire } from "module";
import { dirname as dirname6, join as join23 } from "path";
async function checkBinaryExists(binary2) {
try {
const path10 = Bun.which(binary2);
if (path10) {
return { exists: true, path: path10 };
}
} catch {}
return { exists: false, path: null };
}
async function getBinaryVersion(binary2) {
try {
const proc = spawnWithWindowsHide([binary2, "--version"], { stdout: "pipe", stderr: "pipe" });
const output = await new Response(proc.stdout).text();
await proc.exited;
if (proc.exitCode === 0) {
return output.trim().split(`
`)[0];
}
} catch {}
return null;
}
async function checkAstGrepCli() {
const binaryCheck = await checkBinaryExists("sg");
const altBinaryCheck = !binaryCheck.exists ? await checkBinaryExists("ast-grep") : null;
const binary2 = binaryCheck.exists ? binaryCheck : altBinaryCheck;
if (!binary2 || !binary2.exists) {
return {
name: "AST-Grep CLI",
required: false,
installed: false,
version: null,
path: null,
installHint: "Install: npm install -g @ast-grep/cli"
};
}
const version2 = await getBinaryVersion(binary2.path);
return {
name: "AST-Grep CLI",
required: false,
installed: true,
version: version2,
path: binary2.path
};
}
async function checkAstGrepNapi() {
try {
await import("@ast-grep/napi");
return {
name: "AST-Grep NAPI",
required: false,
installed: true,
version: null,
path: null
};
} catch {
const { existsSync: existsSync26 } = await import("fs");
const { join: join24 } = await import("path");
const { homedir: homedir8 } = await import("os");
const pathsToCheck = [
join24(homedir8(), ".config", "opencode", "node_modules", "@ast-grep", "napi"),
join24(process.cwd(), "node_modules", "@ast-grep", "napi")
];
for (const napiPath of pathsToCheck) {
if (existsSync26(napiPath)) {
return {
name: "AST-Grep NAPI",
required: false,
installed: true,
version: null,
path: napiPath
};
}
}
return {
name: "AST-Grep NAPI",
required: false,
installed: false,
version: null,
path: null,
installHint: "Will use CLI fallback if available"
};
}
}
function findCommentCheckerPackageBinary() {
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
try {
const require2 = createRequire(import.meta.url);
const pkgPath = require2.resolve("@code-yeongyu/comment-checker/package.json");
const binaryPath = join23(dirname6(pkgPath), "bin", binaryName);
if (existsSync25(binaryPath))
return binaryPath;
} catch {}
return null;
}
async function checkCommentChecker() {
const binaryCheck = await checkBinaryExists("comment-checker");
const resolvedPath = binaryCheck.exists ? binaryCheck.path : findCommentCheckerPackageBinary();
if (!resolvedPath) {
return {
name: "Comment Checker",
required: false,
installed: false,
version: null,
path: null,
installHint: "Hook will be disabled if not available"
};
}
const version2 = await getBinaryVersion(resolvedPath);
return {
name: "Comment Checker",
required: false,
installed: true,
version: version2,
path: resolvedPath
};
}
// src/cli/doctor/checks/tools-gh.ts
init_spawn_with_windows_hide();
async function checkBinaryExists2(binary2) {
try {
const binaryPath = Bun.which(binary2);
return { exists: Boolean(binaryPath), path: binaryPath ?? null };
} catch {
return { exists: false, path: null };
}
}
async function getGhVersion() {
try {
const processResult = spawnWithWindowsHide(["gh", "--version"], { stdout: "pipe", stderr: "pipe" });
const output = await new Response(processResult.stdout).text();
await processResult.exited;
if (processResult.exitCode !== 0)
return null;
const matchedVersion = output.match(/gh version (\S+)/);
return matchedVersion?.[1] ?? output.trim().split(`
`)[0] ?? null;
} catch {
return null;
}
}
async function getGhAuthStatus() {
try {
const processResult = spawnWithWindowsHide(["gh", "auth", "status"], {
stdout: "pipe",
stderr: "pipe",
env: { ...process.env, GH_NO_UPDATE_NOTIFIER: "1" }
});
const stdout = await new Response(processResult.stdout).text();
const stderr = await new Response(processResult.stderr).text();
await processResult.exited;
const output = stderr || stdout;
if (processResult.exitCode === 0) {
const usernameMatch = output.match(/Logged in to github\.com account (\S+)/);
const scopesMatch = output.match(/Token scopes?:\s*(.+)/i);
return {
authenticated: true,
username: usernameMatch?.[1]?.replace(/[()]/g, "") ?? null,
scopes: scopesMatch?.[1]?.split(/,\s*/).map((scope) => scope.trim()).filter(Boolean) ?? [],
error: null
};
}
const errorMatch = output.match(/error[:\s]+(.+)/i);
return {
authenticated: false,
username: null,
scopes: [],
error: errorMatch?.[1]?.trim() ?? "Not authenticated"
};
} catch (error48) {
return {
authenticated: false,
username: null,
scopes: [],
error: error48 instanceof Error ? error48.message : "Failed to check auth status"
};
}
}
async function getGhCliInfo() {
const binaryStatus = await checkBinaryExists2("gh");
if (!binaryStatus.exists) {
return {
installed: false,
version: null,
path: null,
authenticated: false,
username: null,
scopes: [],
error: null
};
}
const [version2, authStatus] = await Promise.all([getGhVersion(), getGhAuthStatus()]);
return {
installed: true,
version: version2,
path: binaryStatus.path,
authenticated: authStatus.authenticated,
username: authStatus.username,
scopes: authStatus.scopes,
error: authStatus.error
};
}
// src/tools/lsp/server-config-loader.ts
init_shared();
init_jsonc_parser();
// src/tools/lsp/server-installation.ts
import { existsSync as existsSync26 } from "fs";
import { delimiter as delimiter2, join as join25 } from "path";
// src/tools/lsp/server-path-bases.ts
init_shared();
import { join as join24 } from "path";
function getLspServerAdditionalPathBases(workingDirectory) {
const configDir = getOpenCodeConfigDir({ binary: "opencode" });
const dataDir = join24(getDataDir(), "opencode");
return [
join24(workingDirectory, "node_modules", ".bin"),
join24(configDir, "bin"),
join24(configDir, "node_modules", ".bin"),
join24(dataDir, "bin"),
join24(dataDir, "bin", "node_modules", ".bin")
];
}
// src/tools/lsp/server-installation.ts
function isServerInstalled(command) {
if (command.length === 0)
return false;
const cmd = command[0];
if (cmd.includes("/") || cmd.includes("\\")) {
if (existsSync26(cmd))
return true;
}
const isWindows = process.platform === "win32";
let exts = [""];
if (isWindows) {
const pathExt = process.env.PATHEXT || "";
if (pathExt) {
const systemExts = pathExt.split(";").filter(Boolean);
exts = [...new Set([...exts, ...systemExts, ".exe", ".cmd", ".bat", ".ps1"])];
} else {
exts = ["", ".exe", ".cmd", ".bat", ".ps1"];
}
}
let pathEnv = process.env.PATH || "";
if (isWindows && !pathEnv) {
pathEnv = process.env.Path || "";
}
const paths = pathEnv.split(delimiter2);
for (const p2 of paths) {
for (const suffix of exts) {
if (existsSync26(join25(p2, cmd + suffix))) {
return true;
}
}
}
for (const base of getLspServerAdditionalPathBases(process.cwd())) {
for (const suffix of exts) {
if (existsSync26(join25(base, cmd + suffix))) {
return true;
}
}
}
if (cmd === "bun" || cmd === "node") {
return true;
}
return false;
}
// src/cli/doctor/checks/tools-lsp.ts
var DEFAULT_LSP_SERVERS = [
{ id: "typescript-language-server", binary: "typescript-language-server", extensions: [".ts", ".tsx", ".js", ".jsx"] },
{ id: "pyright", binary: "pyright-langserver", extensions: [".py"] },
{ id: "rust-analyzer", binary: "rust-analyzer", extensions: [".rs"] },
{ id: "gopls", binary: "gopls", extensions: [".go"] }
];
function getLspServersInfo() {
return DEFAULT_LSP_SERVERS.map((server2) => ({
id: server2.id,
installed: isServerInstalled([server2.binary]),
extensions: server2.extensions,
source: "builtin"
}));
}
function getLspServerStats(servers) {
return {
installed: servers.filter((server2) => server2.installed).length,
total: servers.length
};
}
// src/cli/doctor/checks/tools-mcp.ts
init_shared();
import { existsSync as existsSync27, readFileSync as readFileSync25 } from "fs";
import { homedir as homedir8 } from "os";
import { join as join26 } from "path";
var BUILTIN_MCP_SERVERS = ["context7", "grep_app"];
function getMcpConfigPaths() {
return [
join26(homedir8(), ".claude", ".mcp.json"),
join26(process.cwd(), ".mcp.json"),
join26(process.cwd(), ".claude", ".mcp.json")
];
}
function loadUserMcpConfig() {
const servers = {};
for (const configPath of getMcpConfigPaths()) {
if (!existsSync27(configPath))
continue;
try {
const content = readFileSync25(configPath, "utf-8");
const config2 = parseJsonc(content);
if (config2.mcpServers) {
Object.assign(servers, config2.mcpServers);
}
} catch {
continue;
}
}
return servers;
}
function getBuiltinMcpInfo() {
return BUILTIN_MCP_SERVERS.map((serverId) => ({
id: serverId,
type: "builtin",
enabled: true,
valid: true
}));
}
function getUserMcpInfo() {
return Object.entries(loadUserMcpConfig()).map(([serverId, value]) => {
const valid = typeof value === "object" && value !== null;
return {
id: serverId,
type: "user",
enabled: true,
valid,
error: valid ? undefined : "Invalid configuration format"
};
});
}
// src/cli/doctor/checks/tools.ts
async function gatherToolsSummary() {
const [astGrepCliInfo, astGrepNapiInfo, commentCheckerInfo, ghInfo] = await Promise.all([
checkAstGrepCli(),
checkAstGrepNapi(),
checkCommentChecker(),
getGhCliInfo()
]);
const lspServers = getLspServersInfo();
const lspStats = getLspServerStats(lspServers);
const builtinMcp = getBuiltinMcpInfo();
const userMcp = getUserMcpInfo();
return {
lspInstalled: lspStats.installed,
lspTotal: lspStats.total,
astGrepCli: astGrepCliInfo.installed,
astGrepNapi: astGrepNapiInfo.installed,
commentChecker: commentCheckerInfo.installed,
ghCli: {
installed: ghInfo.installed,
authenticated: ghInfo.authenticated,
username: ghInfo.username
},
mcpBuiltin: builtinMcp.map((server2) => server2.id),
mcpUser: userMcp.map((server2) => server2.id)
};
}
function buildToolIssues(summary) {
const issues = [];
if (!summary.astGrepCli && !summary.astGrepNapi) {
issues.push({
title: "AST-Grep unavailable",
description: "Neither AST-Grep CLI nor NAPI backend is available.",
fix: "Install @ast-grep/cli globally or add @ast-grep/napi",
severity: "warning",
affects: ["ast_grep_search", "ast_grep_replace"]
});
}
if (!summary.commentChecker) {
issues.push({
title: "Comment checker unavailable",
description: "Comment checker binary is not installed.",
fix: "Install @code-yeongyu/comment-checker",
severity: "warning",
affects: ["comment-checker hook"]
});
}
if (summary.lspInstalled === 0) {
issues.push({
title: "No LSP servers detected",
description: "LSP-dependent tools will be limited until at least one server is installed.",
severity: "warning",
affects: ["lsp diagnostics", "rename", "references"]
});
}
if (!summary.ghCli.installed) {
issues.push({
title: "GitHub CLI missing",
description: "gh CLI is not installed.",
fix: "Install from https://cli.github.com/",
severity: "warning",
affects: ["GitHub automation"]
});
} else if (!summary.ghCli.authenticated) {
issues.push({
title: "GitHub CLI not authenticated",
description: "gh CLI is installed but not logged in.",
fix: "Run: gh auth login",
severity: "warning",
affects: ["GitHub automation"]
});
}
return issues;
}
async function checkTools() {
const summary = await gatherToolsSummary();
const userMcpServers = getUserMcpInfo();
const invalidUserMcpServers = userMcpServers.filter((server2) => !server2.valid);
const issues = buildToolIssues(summary);
if (invalidUserMcpServers.length > 0) {
issues.push({
title: "Invalid MCP server configuration",
description: `${invalidUserMcpServers.length} user MCP server(s) have invalid config format.`,
severity: "warning",
affects: ["custom MCP tools"]
});
}
return {
name: CHECK_NAMES[CHECK_IDS.TOOLS],
status: issues.length === 0 ? "pass" : "warn",
message: issues.length === 0 ? "All tools checks passed" : `${issues.length} tools issue(s) detected`,
details: [
`AST-Grep: cli=${summary.astGrepCli ? "yes" : "no"}, napi=${summary.astGrepNapi ? "yes" : "no"}`,
`Comment checker: ${summary.commentChecker ? "yes" : "no"}`,
`LSP: ${summary.lspInstalled}/${summary.lspTotal}`,
`GH CLI: ${summary.ghCli.installed ? "installed" : "missing"}${summary.ghCli.authenticated ? " (authenticated)" : ""}`,
`MCP: builtin=${summary.mcpBuiltin.length}, user=${summary.mcpUser.length}`
],
issues
};
}
// src/cli/doctor/checks/index.ts
function getAllCheckDefinitions() {
return [
{
id: CHECK_IDS.SYSTEM,
name: CHECK_NAMES[CHECK_IDS.SYSTEM],
check: checkSystem,
critical: true
},
{
id: CHECK_IDS.CONFIG,
name: CHECK_NAMES[CHECK_IDS.CONFIG],
check: checkConfig
},
{
id: CHECK_IDS.TOOLS,
name: CHECK_NAMES[CHECK_IDS.TOOLS],
check: checkTools
},
{
id: CHECK_IDS.MODELS,
name: CHECK_NAMES[CHECK_IDS.MODELS],
check: checkModels
}
];
}
// src/cli/doctor/format-default.ts
var import_picocolors18 = __toESM(require_picocolors(), 1);
// src/cli/doctor/format-shared.ts
var import_picocolors17 = __toESM(require_picocolors(), 1);
function formatStatusSymbol(status) {
const colorFn = STATUS_COLORS[status];
switch (status) {
case "pass":
return colorFn(SYMBOLS3.check);
case "fail":
return colorFn(SYMBOLS3.cross);
case "warn":
return colorFn(SYMBOLS3.warn);
case "skip":
return colorFn(SYMBOLS3.skip);
}
}
function formatStatusMark(available) {
return available ? import_picocolors17.default.green(SYMBOLS3.check) : import_picocolors17.default.red(SYMBOLS3.cross);
}
function formatHeader() {
return `
${import_picocolors17.default.bgMagenta(import_picocolors17.default.white(" oMoMoMoMo Doctor "))}
`;
}
function formatIssue(issue2, index) {
const lines = [];
const severityColor = issue2.severity === "error" ? import_picocolors17.default.red : import_picocolors17.default.yellow;
lines.push(`${index}. ${severityColor(issue2.title)}`);
lines.push(` ${import_picocolors17.default.dim(issue2.description)}`);
if (issue2.fix) {
lines.push(` ${import_picocolors17.default.cyan("Fix:")} ${import_picocolors17.default.dim(issue2.fix)}`);
}
if (issue2.affects && issue2.affects.length > 0) {
lines.push(` ${import_picocolors17.default.cyan("Affects:")} ${import_picocolors17.default.dim(issue2.affects.join(", "))}`);
}
return lines.join(`
`);
}
// src/cli/doctor/format-default.ts
function formatDefault(result) {
const lines = [];
lines.push(formatHeader());
const allIssues = result.results.flatMap((r2) => r2.issues);
if (allIssues.length === 0) {
const opencodeVer = result.systemInfo.opencodeVersion ?? "unknown";
const pluginVer = result.systemInfo.pluginVersion ?? "unknown";
lines.push(` ${import_picocolors18.default.green(SYMBOLS3.check)} ${import_picocolors18.default.green(`System OK (opencode ${opencodeVer} \xB7 oh-my-opencode ${pluginVer})`)}`);
} else {
const issueCount = allIssues.filter((i2) => i2.severity === "error").length;
const warnCount = allIssues.filter((i2) => i2.severity === "warning").length;
const totalStr = `${issueCount + warnCount} ${issueCount + warnCount === 1 ? "issue" : "issues"}`;
lines.push(` ${import_picocolors18.default.yellow(SYMBOLS3.warn)} ${totalStr} found:
`);
allIssues.forEach((issue2, index) => {
lines.push(formatIssue(issue2, index + 1));
lines.push("");
});
}
return lines.join(`
`);
}
// src/cli/doctor/format-status.ts
var import_picocolors19 = __toESM(require_picocolors(), 1);
function formatStatus(result) {
const lines = [];
lines.push(formatHeader());
const { systemInfo, tools } = result;
const padding = " ";
const opencodeVer = systemInfo.opencodeVersion ?? "unknown";
const pluginVer = systemInfo.pluginVersion ?? "unknown";
const bunVer = systemInfo.bunVersion ?? "unknown";
lines.push(` ${padding}System ${opencodeVer} \xB7 ${pluginVer} \xB7 Bun ${bunVer}`);
const configPath = systemInfo.configPath ?? "unknown";
const configStatus = systemInfo.configValid ? import_picocolors19.default.green("(valid)") : import_picocolors19.default.red("(invalid)");
lines.push(` ${padding}Config ${configPath} ${configStatus}`);
const lspText = `LSP ${tools.lspInstalled}/${tools.lspTotal}`;
const astGrepMark = formatStatusMark(tools.astGrepCli);
const ghMark = formatStatusMark(tools.ghCli.installed && tools.ghCli.authenticated);
const ghUser = tools.ghCli.username ?? "";
lines.push(` ${padding}Tools ${lspText} \xB7 AST-Grep ${astGrepMark} \xB7 gh ${ghMark}${ghUser ? ` (${ghUser})` : ""}`);
const builtinCount = tools.mcpBuiltin.length;
const userCount = tools.mcpUser.length;
const builtinText = builtinCount > 0 ? tools.mcpBuiltin.join(" \xB7 ") : "none";
const userText = userCount > 0 ? `+ ${userCount} user` : "";
lines.push(` ${padding}MCPs ${builtinText} ${userText}`);
return lines.join(`
`);
}
// src/cli/doctor/format-verbose.ts
var import_picocolors20 = __toESM(require_picocolors(), 1);
function formatVerbose(result) {
const lines = [];
lines.push(formatHeader());
const { systemInfo, tools, results, summary } = result;
lines.push(`${import_picocolors20.default.bold("System Information")}`);
lines.push(`${import_picocolors20.default.dim("\u2500".repeat(40))}`);
lines.push(` ${formatStatusSymbol("pass")} opencode ${systemInfo.opencodeVersion ?? "unknown"}`);
lines.push(` ${formatStatusSymbol("pass")} oh-my-opencode ${systemInfo.pluginVersion ?? "unknown"}`);
if (systemInfo.loadedVersion) {
lines.push(` ${formatStatusSymbol("pass")} loaded ${systemInfo.loadedVersion}`);
}
if (systemInfo.bunVersion) {
lines.push(` ${formatStatusSymbol("pass")} bun ${systemInfo.bunVersion}`);
}
lines.push(` ${formatStatusSymbol("pass")} path ${systemInfo.opencodePath ?? "unknown"}`);
if (systemInfo.isLocalDev) {
lines.push(` ${import_picocolors20.default.yellow("*")} ${import_picocolors20.default.dim("(local development mode)")}`);
}
lines.push("");
lines.push(`${import_picocolors20.default.bold("Configuration")}`);
lines.push(`${import_picocolors20.default.dim("\u2500".repeat(40))}`);
const configStatus = systemInfo.configValid ? import_picocolors20.default.green("valid") : import_picocolors20.default.red("invalid");
lines.push(` ${formatStatusSymbol(systemInfo.configValid ? "pass" : "fail")} ${systemInfo.configPath ?? "unknown"} (${configStatus})`);
lines.push("");
lines.push(`${import_picocolors20.default.bold("Tools")}`);
lines.push(`${import_picocolors20.default.dim("\u2500".repeat(40))}`);
lines.push(` ${formatStatusSymbol("pass")} LSP ${tools.lspInstalled}/${tools.lspTotal} installed`);
lines.push(` ${formatStatusSymbol(tools.astGrepCli ? "pass" : "fail")} ast-grep CLI ${tools.astGrepCli ? "installed" : "not found"}`);
lines.push(` ${formatStatusSymbol(tools.astGrepNapi ? "pass" : "fail")} ast-grep napi ${tools.astGrepNapi ? "installed" : "not found"}`);
lines.push(` ${formatStatusSymbol(tools.commentChecker ? "pass" : "fail")} comment-checker ${tools.commentChecker ? "installed" : "not found"}`);
lines.push(` ${formatStatusSymbol(tools.ghCli.installed && tools.ghCli.authenticated ? "pass" : "fail")} gh CLI ${tools.ghCli.installed ? "installed" : "not found"}${tools.ghCli.authenticated && tools.ghCli.username ? ` (${tools.ghCli.username})` : ""}`);
lines.push("");
lines.push(`${import_picocolors20.default.bold("MCPs")}`);
lines.push(`${import_picocolors20.default.dim("\u2500".repeat(40))}`);
if (tools.mcpBuiltin.length === 0) {
lines.push(` ${import_picocolors20.default.dim("No built-in MCPs")}`);
} else {
for (const mcp of tools.mcpBuiltin) {
lines.push(` ${formatStatusSymbol("pass")} ${mcp}`);
}
}
if (tools.mcpUser.length > 0) {
lines.push(` ${import_picocolors20.default.cyan("+")} ${tools.mcpUser.length} user MCP(s):`);
for (const mcp of tools.mcpUser) {
lines.push(` ${formatStatusSymbol("pass")} ${mcp}`);
}
}
lines.push("");
const allIssues = results.flatMap((r2) => r2.issues);
if (allIssues.length > 0) {
lines.push(`${import_picocolors20.default.bold("Issues")}`);
lines.push(`${import_picocolors20.default.dim("\u2500".repeat(40))}`);
allIssues.forEach((issue2, index) => {
lines.push(formatIssue(issue2, index + 1));
lines.push("");
});
}
lines.push(`${import_picocolors20.default.bold("Summary")}`);
lines.push(`${import_picocolors20.default.dim("\u2500".repeat(40))}`);
const passText = summary.passed > 0 ? import_picocolors20.default.green(`${summary.passed} passed`) : `${summary.passed} passed`;
const failText = summary.failed > 0 ? import_picocolors20.default.red(`${summary.failed} failed`) : `${summary.failed} failed`;
const warnText = summary.warnings > 0 ? import_picocolors20.default.yellow(`${summary.warnings} warnings`) : `${summary.warnings} warnings`;
lines.push(` ${passText}, ${failText}, ${warnText}`);
lines.push(` ${import_picocolors20.default.dim(`Total: ${summary.total} checks in ${summary.duration}ms`)}`);
return lines.join(`
`);
}
// src/cli/doctor/formatter.ts
function formatDoctorOutput(result, mode) {
switch (mode) {
case "default":
return formatDefault(result);
case "status":
return formatStatus(result);
case "verbose":
return formatVerbose(result);
}
}
function formatJsonOutput2(result) {
return JSON.stringify(result, null, 2);
}
// src/cli/doctor/runner.ts
async function runCheck(check2) {
const start = performance.now();
try {
const result = await check2.check();
result.duration = Math.round(performance.now() - start);
return result;
} catch (err) {
return {
name: check2.name,
status: "fail",
message: err instanceof Error ? err.message : "Unknown error",
issues: [{ title: check2.name, description: String(err), severity: "error" }],
duration: Math.round(performance.now() - start)
};
}
}
function calculateSummary(results, duration3) {
return {
total: results.length,
passed: results.filter((r2) => r2.status === "pass").length,
failed: results.filter((r2) => r2.status === "fail").length,
warnings: results.filter((r2) => r2.status === "warn").length,
skipped: results.filter((r2) => r2.status === "skip").length,
duration: Math.round(duration3)
};
}
function determineExitCode(results) {
return results.some((r2) => r2.status === "fail") ? EXIT_CODES.FAILURE : EXIT_CODES.SUCCESS;
}
async function runDoctor(options) {
const start = performance.now();
const allChecks = getAllCheckDefinitions();
const [results, systemInfo, tools] = await Promise.all([
Promise.all(allChecks.map(runCheck)),
gatherSystemInfo(),
gatherToolsSummary()
]);
const duration3 = performance.now() - start;
const summary = calculateSummary(results, duration3);
const exitCode = determineExitCode(results);
const doctorResult = {
results,
systemInfo,
tools,
summary,
exitCode
};
if (options.json) {
console.log(formatJsonOutput2(doctorResult));
} else {
console.log(formatDoctorOutput(doctorResult, options.mode));
}
return doctorResult;
}
// src/cli/doctor/index.ts
async function doctor(options = { mode: "default" }) {
const result = await runDoctor(options);
return result.exitCode;
}
// src/features/mcp-oauth/storage.ts
init_shared();
import { chmodSync, existsSync as existsSync28, mkdirSync as mkdirSync6, readFileSync as readFileSync26, unlinkSync as unlinkSync4, writeFileSync as writeFileSync10 } from "fs";
import { dirname as dirname7, join as join27 } from "path";
var STORAGE_FILE_NAME = "mcp-oauth.json";
function getMcpOauthStoragePath() {
return join27(getOpenCodeConfigDir({ binary: "opencode" }), STORAGE_FILE_NAME);
}
function normalizeHost(serverHost) {
let host = serverHost.trim();
if (!host)
return host;
if (host.includes("://")) {
try {
host = new URL(host).hostname;
} catch {
host = host.split("/")[0];
}
} else {
host = host.split("/")[0];
}
if (host.startsWith("[")) {
const closing = host.indexOf("]");
if (closing !== -1) {
host = host.slice(0, closing + 1);
}
return host;
}
if (host.includes(":")) {
host = host.split(":")[0];
}
return host;
}
function normalizeResource(resource) {
return resource.replace(/^\/+/, "");
}
function buildKey(serverHost, resource) {
const host = normalizeHost(serverHost);
const normalizedResource = normalizeResource(resource);
return `${host}/${normalizedResource}`;
}
function readStore() {
const filePath = getMcpOauthStoragePath();
if (!existsSync28(filePath)) {
return null;
}
try {
const content = readFileSync26(filePath, "utf-8");
return JSON.parse(content);
} catch {
return null;
}
}
function writeStore(store2) {
const filePath = getMcpOauthStoragePath();
try {
const dir = dirname7(filePath);
if (!existsSync28(dir)) {
mkdirSync6(dir, { recursive: true });
}
writeFileSync10(filePath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
chmodSync(filePath, 384);
return true;
} catch {
return false;
}
}
function loadToken(serverHost, resource) {
const store2 = readStore();
if (!store2)
return null;
const key = buildKey(serverHost, resource);
return store2[key] ?? null;
}
function saveToken(serverHost, resource, token) {
const store2 = readStore() ?? {};
const key = buildKey(serverHost, resource);
store2[key] = token;
return writeStore(store2);
}
function deleteToken(serverHost, resource) {
const store2 = readStore();
if (!store2)
return true;
const key = buildKey(serverHost, resource);
if (!(key in store2)) {
return true;
}
delete store2[key];
if (Object.keys(store2).length === 0) {
try {
const filePath = getMcpOauthStoragePath();
if (existsSync28(filePath)) {
unlinkSync4(filePath);
}
return true;
} catch {
return false;
}
}
return writeStore(store2);
}
function listTokensByHost(serverHost) {
const store2 = readStore();
if (!store2)
return {};
const host = normalizeHost(serverHost);
const prefix = `${host}/`;
const result = {};
for (const [key, value] of Object.entries(store2)) {
if (key.startsWith(prefix)) {
result[key] = value;
}
}
return result;
}
function listAllTokens() {
return readStore() ?? {};
}
// src/features/mcp-oauth/discovery.ts
var discoveryCache = new Map;
var pendingDiscovery = new Map;
function parseHttpsUrl(value, label) {
const parsed = new URL(value);
if (parsed.protocol !== "https:") {
throw new Error(`${label} must use https`);
}
return parsed;
}
function readStringField(source, field) {
const value = source[field];
if (typeof value !== "string" || value.length === 0) {
throw new Error(`OAuth metadata missing ${field}`);
}
return value;
}
async function fetchMetadata(url2) {
const response = await fetch(url2, { headers: { accept: "application/json" } });
if (!response.ok) {
return { ok: false, status: response.status };
}
const json3 = await response.json().catch(() => null);
if (!json3 || typeof json3 !== "object") {
throw new Error("OAuth metadata response is not valid JSON");
}
return { ok: true, json: json3 };
}
async function fetchAuthorizationServerMetadata(issuer, resource) {
const issuerUrl = parseHttpsUrl(issuer, "Authorization server URL");
const issuerPath = issuerUrl.pathname.replace(/\/+$/, "");
const metadataUrl = new URL(`/.well-known/oauth-authorization-server${issuerPath}`, issuerUrl).toString();
const metadata = await fetchMetadata(metadataUrl);
if (!metadata.ok) {
if (metadata.status === 404) {
throw new Error("OAuth authorization server metadata not found");
}
throw new Error(`OAuth authorization server metadata fetch failed (${metadata.status})`);
}
const authorizationEndpoint = parseHttpsUrl(readStringField(metadata.json, "authorization_endpoint"), "authorization_endpoint").toString();
const tokenEndpoint = parseHttpsUrl(readStringField(metadata.json, "token_endpoint"), "token_endpoint").toString();
const registrationEndpointValue = metadata.json.registration_endpoint;
const registrationEndpoint = typeof registrationEndpointValue === "string" && registrationEndpointValue.length > 0 ? parseHttpsUrl(registrationEndpointValue, "registration_endpoint").toString() : undefined;
return {
authorizationEndpoint,
tokenEndpoint,
registrationEndpoint,
resource
};
}
function parseAuthorizationServers(metadata) {
const servers = metadata.authorization_servers;
if (!Array.isArray(servers))
return [];
return servers.filter((server2) => typeof server2 === "string" && server2.length > 0);
}
async function discoverOAuthServerMetadata(resource) {
const resourceUrl = parseHttpsUrl(resource, "Resource server URL");
const resourceKey = resourceUrl.toString();
const cached2 = discoveryCache.get(resourceKey);
if (cached2)
return cached2;
const pending = pendingDiscovery.get(resourceKey);
if (pending)
return pending;
const discoveryPromise = (async () => {
const prmUrl = new URL("/.well-known/oauth-protected-resource", resourceUrl).toString();
const prmResponse = await fetchMetadata(prmUrl);
if (prmResponse.ok) {
const authServers = parseAuthorizationServers(prmResponse.json);
if (authServers.length === 0) {
throw new Error("OAuth protected resource metadata missing authorization_servers");
}
return fetchAuthorizationServerMetadata(authServers[0], resource);
}
if (prmResponse.status !== 404) {
throw new Error(`OAuth protected resource metadata fetch failed (${prmResponse.status})`);
}
return fetchAuthorizationServerMetadata(resourceKey, resource);
})();
pendingDiscovery.set(resourceKey, discoveryPromise);
try {
const result = await discoveryPromise;
discoveryCache.set(resourceKey, result);
return result;
} finally {
pendingDiscovery.delete(resourceKey);
}
}
// src/features/mcp-oauth/dcr.ts
async function getOrRegisterClient(options) {
const serverIdentifier = options.serverIdentifier ?? options.registrationEndpoint ?? "default";
const existing = options.storage.getClientRegistration(serverIdentifier);
if (existing)
return existing;
if (!options.registrationEndpoint) {
return options.clientId ? { clientId: options.clientId } : null;
}
const fetchImpl = options.fetch ?? globalThis.fetch;
const request = {
redirect_uris: options.redirectUris,
client_name: options.clientName,
grant_types: ["authorization_code", "refresh_token"],
response_types: ["code"],
token_endpoint_auth_method: options.tokenEndpointAuthMethod
};
try {
const response = await fetchImpl(options.registrationEndpoint, {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(request)
});
if (!response.ok) {
return options.clientId ? { clientId: options.clientId } : null;
}
const data = await response.json();
const parsed = parseRegistrationResponse(data);
if (!parsed) {
return options.clientId ? { clientId: options.clientId } : null;
}
options.storage.setClientRegistration(serverIdentifier, parsed);
return parsed;
} catch {
return options.clientId ? { clientId: options.clientId } : null;
}
}
function parseRegistrationResponse(data) {
if (!isRecord2(data))
return null;
const clientId = data.client_id;
if (typeof clientId !== "string" || clientId.length === 0)
return null;
const clientSecret = data.client_secret;
if (typeof clientSecret === "string" && clientSecret.length > 0) {
return { clientId, clientSecret };
}
return { clientId };
}
function isRecord2(value) {
return typeof value === "object" && value !== null;
}
// src/features/mcp-oauth/callback-server.ts
init_port_utils();
var DEFAULT_PORT = 19877;
var TIMEOUT_MS = 5 * 60 * 1000;
async function findAvailablePort2(startPort = DEFAULT_PORT) {
return findAvailablePort(startPort);
}
// src/features/mcp-oauth/oauth-authorization-flow.ts
import { spawn as spawn2 } from "child_process";
import { createHash, randomBytes as randomBytes2 } from "crypto";
import { createServer } from "http";
function generateCodeVerifier() {
return randomBytes2(32).toString("base64url");
}
function generateCodeChallenge(verifier) {
return createHash("sha256").update(verifier).digest("base64url");
}
function buildAuthorizationUrl(authorizationEndpoint, options) {
const url2 = new URL(authorizationEndpoint);
url2.searchParams.set("response_type", "code");
url2.searchParams.set("client_id", options.clientId);
url2.searchParams.set("redirect_uri", options.redirectUri);
url2.searchParams.set("code_challenge", options.codeChallenge);
url2.searchParams.set("code_challenge_method", "S256");
url2.searchParams.set("state", options.state);
if (options.scopes && options.scopes.length > 0) {
url2.searchParams.set("scope", options.scopes.join(" "));
}
if (options.resource) {
url2.searchParams.set("resource", options.resource);
}
return url2.toString();
}
var CALLBACK_TIMEOUT_MS = 5 * 60 * 1000;
function startCallbackServer(port) {
return new Promise((resolve2, reject) => {
let timeoutId;
const server2 = createServer((request, response) => {
clearTimeout(timeoutId);
const requestUrl = new URL(request.url ?? "/", `http://localhost:${port}`);
const code = requestUrl.searchParams.get("code");
const state = requestUrl.searchParams.get("state");
const error48 = requestUrl.searchParams.get("error");
if (error48) {
const errorDescription = requestUrl.searchParams.get("error_description") ?? error48;
response.writeHead(400, { "content-type": "text/html" });
response.end("<html><body><h1>Authorization failed</h1></body></html>");
server2.close();
reject(new Error(`OAuth authorization error: ${errorDescription}`));
return;
}
if (!code || !state) {
response.writeHead(400, { "content-type": "text/html" });
response.end("<html><body><h1>Missing code or state</h1></body></html>");
server2.close();
reject(new Error("OAuth callback missing code or state parameter"));
return;
}
response.writeHead(200, { "content-type": "text/html" });
response.end("<html><body><h1>Authorization successful. You can close this tab.</h1></body></html>");
server2.close();
resolve2({ code, state });
});
timeoutId = setTimeout(() => {
server2.close();
reject(new Error("OAuth callback timed out after 5 minutes"));
}, CALLBACK_TIMEOUT_MS);
server2.listen(port, "127.0.0.1");
server2.on("error", (err) => {
clearTimeout(timeoutId);
reject(err);
});
});
}
function openBrowser(url2) {
const platform = process.platform;
let command;
let args;
if (platform === "darwin") {
command = "open";
args = [url2];
} else if (platform === "win32") {
command = "explorer";
args = [url2];
} else {
command = "xdg-open";
args = [url2];
}
try {
const child = spawn2(command, args, { stdio: "ignore", detached: true });
child.on("error", () => {});
child.unref();
} catch {}
}
async function runAuthorizationCodeRedirect(options) {
const verifier = generateCodeVerifier();
const challenge = generateCodeChallenge(verifier);
const state = randomBytes2(16).toString("hex");
const authorizationUrl = buildAuthorizationUrl(options.authorizationEndpoint, {
clientId: options.clientId,
redirectUri: options.redirectUri,
codeChallenge: challenge,
state,
scopes: options.scopes,
resource: options.resource
});
const callbackPromise = startCallbackServer(options.callbackPort);
openBrowser(authorizationUrl);
const result = await callbackPromise;
if (result.state !== state) {
throw new Error("OAuth state mismatch");
}
return { code: result.code, verifier };
}
// src/features/mcp-oauth/provider.ts
class McpOAuthProvider {
serverUrl;
configClientId;
scopes;
storedCodeVerifier = null;
storedClientInfo = null;
callbackPort = null;
constructor(options) {
this.serverUrl = options.serverUrl;
this.configClientId = options.clientId;
this.scopes = options.scopes ?? [];
}
tokens() {
return loadToken(this.serverUrl, this.serverUrl);
}
saveTokens(tokenData) {
return saveToken(this.serverUrl, this.serverUrl, tokenData);
}
clientInformation() {
if (this.storedClientInfo)
return this.storedClientInfo;
const tokenData = this.tokens();
if (tokenData?.clientInfo) {
this.storedClientInfo = tokenData.clientInfo;
return this.storedClientInfo;
}
return null;
}
redirectUrl() {
return `http://127.0.0.1:${this.callbackPort ?? 19877}/callback`;
}
saveCodeVerifier(verifier) {
this.storedCodeVerifier = verifier;
}
codeVerifier() {
return this.storedCodeVerifier;
}
async redirectToAuthorization(metadata) {
const clientInfo = this.clientInformation();
if (!clientInfo) {
throw new Error("No client information available. Run login() or register a client first.");
}
if (this.callbackPort === null) {
this.callbackPort = await findAvailablePort2();
}
const result = await runAuthorizationCodeRedirect({
authorizationEndpoint: metadata.authorizationEndpoint,
callbackPort: this.callbackPort,
clientId: clientInfo.clientId,
redirectUri: this.redirectUrl(),
scopes: this.scopes,
resource: metadata.resource
});
this.saveCodeVerifier(result.verifier);
return { code: result.code };
}
async login() {
const metadata = await discoverOAuthServerMetadata(this.serverUrl);
const clientRegistrationStorage = {
getClientRegistration: () => this.storedClientInfo,
setClientRegistration: (_serverIdentifier, credentials) => {
this.storedClientInfo = credentials;
}
};
const clientInfo = await getOrRegisterClient({
registrationEndpoint: metadata.registrationEndpoint,
serverIdentifier: this.serverUrl,
clientName: "oh-my-opencode",
redirectUris: [this.redirectUrl()],
tokenEndpointAuthMethod: "none",
clientId: this.configClientId,
storage: clientRegistrationStorage
});
if (!clientInfo) {
throw new Error("Failed to obtain client credentials. Provide a clientId or ensure the server supports DCR.");
}
this.storedClientInfo = clientInfo;
const { code } = await this.redirectToAuthorization(metadata);
const verifier = this.codeVerifier();
if (!verifier) {
throw new Error("Code verifier not found");
}
const tokenResponse = await fetch(metadata.tokenEndpoint, {
method: "POST",
headers: { "content-type": "application/x-www-form-urlencoded" },
body: new URLSearchParams({
grant_type: "authorization_code",
code,
redirect_uri: this.redirectUrl(),
client_id: clientInfo.clientId,
code_verifier: verifier,
...metadata.resource ? { resource: metadata.resource } : {}
}).toString()
});
if (!tokenResponse.ok) {
let errorDetail = `${tokenResponse.status}`;
try {
const body = await tokenResponse.json();
if (body.error) {
errorDetail = `${tokenResponse.status} ${body.error}`;
if (body.error_description) {
errorDetail += `: ${body.error_description}`;
}
}
} catch {}
throw new Error(`Token exchange failed: ${errorDetail}`);
}
const tokenData = await tokenResponse.json();
const accessToken = tokenData.access_token;
if (typeof accessToken !== "string") {
throw new Error("Token response missing access_token");
}
const oauthTokenData = {
accessToken,
refreshToken: typeof tokenData.refresh_token === "string" ? tokenData.refresh_token : undefined,
expiresAt: typeof tokenData.expires_in === "number" ? Math.floor(Date.now() / 1000) + tokenData.expires_in : undefined,
clientInfo: {
clientId: clientInfo.clientId,
clientSecret: clientInfo.clientSecret
}
};
this.saveTokens(oauthTokenData);
return oauthTokenData;
}
}
// src/cli/mcp-oauth/login.ts
async function login(serverName, options) {
try {
const serverUrl = options.serverUrl;
if (!serverUrl) {
console.error(`Error: --server-url is required for server "${serverName}"`);
return 1;
}
const provider = new McpOAuthProvider({
serverUrl,
clientId: options.clientId,
scopes: options.scopes
});
console.log(`Authenticating with ${serverName}...`);
const tokenData = await provider.login();
console.log(`\u2713 Successfully authenticated with ${serverName}`);
if (tokenData.expiresAt) {
const expiryDate = new Date(tokenData.expiresAt * 1000);
console.log(` Token expires at: ${expiryDate.toISOString()}`);
}
return 0;
} catch (error48) {
const message = error48 instanceof Error ? error48.message : String(error48);
console.error(`Error: Failed to authenticate with ${serverName}: ${message}`);
return 1;
}
}
// src/cli/mcp-oauth/logout.ts
async function logout(serverName, options) {
try {
const serverUrl = options?.serverUrl;
if (!serverUrl) {
console.error(`Error: --server-url is required for logout. Token storage uses server URLs, not names.`);
console.error(` Usage: mcp oauth logout ${serverName} --server-url https://your-server.example.com`);
return 1;
}
const success2 = deleteToken(serverUrl, serverUrl);
if (success2) {
console.log(`\u2713 Successfully removed tokens for ${serverName}`);
return 0;
}
console.error(`Error: Failed to remove tokens for ${serverName}`);
return 1;
} catch (error48) {
const message = error48 instanceof Error ? error48.message : String(error48);
console.error(`Error: Failed to remove tokens for ${serverName}: ${message}`);
return 1;
}
}
// src/cli/mcp-oauth/status.ts
async function status(serverName) {
try {
if (serverName) {
const tokens2 = listTokensByHost(serverName);
if (Object.keys(tokens2).length === 0) {
console.log(`No tokens found for ${serverName}`);
return 0;
}
console.log(`OAuth Status for ${serverName}:`);
for (const [key, token] of Object.entries(tokens2)) {
console.log(` ${key}:`);
console.log(` Access Token: [REDACTED]`);
if (token.refreshToken) {
console.log(` Refresh Token: [REDACTED]`);
}
if (token.expiresAt) {
const expiryDate = new Date(token.expiresAt * 1000);
const now = Date.now() / 1000;
const isExpired = token.expiresAt < now;
const tokenStatus = isExpired ? "EXPIRED" : "VALID";
console.log(` Expiry: ${expiryDate.toISOString()} (${tokenStatus})`);
}
}
return 0;
}
const tokens = listAllTokens();
if (Object.keys(tokens).length === 0) {
console.log("No OAuth tokens stored");
return 0;
}
console.log("Stored OAuth Tokens:");
for (const [key, token] of Object.entries(tokens)) {
const isExpired = token.expiresAt && token.expiresAt < Date.now() / 1000;
const tokenStatus = isExpired ? "EXPIRED" : "VALID";
console.log(` ${key}: ${tokenStatus}`);
}
return 0;
} catch (error48) {
const message = error48 instanceof Error ? error48.message : String(error48);
console.error(`Error: Failed to get token status: ${message}`);
return 1;
}
}
// src/cli/mcp-oauth/index.ts
function createMcpOAuthCommand() {
const mcp = new Command("mcp").description("MCP server management");
const oauth = new Command("oauth").description("OAuth token management for MCP servers");
oauth.command("login <server-name>").description("Authenticate with an MCP server using OAuth").option("--server-url <url>", "OAuth server URL (required if not in config)").option("--client-id <id>", "OAuth client ID (optional, uses DCR if not provided)").option("--scopes <scopes...>", "OAuth scopes to request").action(async (serverName, options) => {
const exitCode = await login(serverName, options);
process.exit(exitCode);
});
oauth.command("logout <server-name>").description("Remove stored OAuth tokens for an MCP server").option("--server-url <url>", "OAuth server URL (use if server name differs from URL)").action(async (serverName, options) => {
const exitCode = await logout(serverName, options);
process.exit(exitCode);
});
oauth.command("status [server-name]").description("Show OAuth token status for MCP servers").action(async (serverName) => {
const exitCode = await status(serverName);
process.exit(exitCode);
});
mcp.addCommand(oauth);
return mcp;
}
// src/cli/cli-program.ts
var VERSION2 = package_default.version;
var program2 = new Command;
program2.name("oh-my-opencode").description("The ultimate OpenCode plugin - multi-model orchestration, LSP tools, and more").version(VERSION2, "-v, --version", "Show version number").enablePositionalOptions();
program2.command("install").description("Install and configure oh-my-opencode with interactive setup").option("--no-tui", "Run in non-interactive mode (requires all options)").option("--claude <value>", "Claude subscription: no, yes, max20").option("--openai <value>", "OpenAI/ChatGPT subscription: no, yes (default: no)").option("--gemini <value>", "Gemini integration: no, yes").option("--copilot <value>", "GitHub Copilot subscription: no, yes").option("--opencode-zen <value>", "OpenCode Zen access: no, yes (default: no)").option("--zai-coding-plan <value>", "Z.ai Coding Plan subscription: no, yes (default: no)").option("--kimi-for-coding <value>", "Kimi For Coding subscription: no, yes (default: no)").option("--opencode-go <value>", "OpenCode Go subscription: no, yes (default: no)").option("--skip-auth", "Skip authentication setup hints").addHelpText("after", `
Examples:
$ bunx oh-my-opencode install
$ bunx oh-my-opencode install --no-tui --claude=max20 --openai=yes --gemini=yes --copilot=no
$ bunx oh-my-opencode install --no-tui --claude=no --gemini=no --copilot=yes --opencode-zen=yes
Model Providers (Priority: Native > Copilot > OpenCode Zen > Z.ai > Kimi):
Claude Native anthropic/ models (Opus, Sonnet, Haiku)
OpenAI Native openai/ models (GPT-5.4 for Oracle)
Gemini Native google/ models (Gemini 3 Pro, Flash)
Copilot github-copilot/ models (fallback)
OpenCode Zen opencode/ models (opencode/claude-opus-4-6, etc.)
Z.ai zai-coding-plan/glm-5 (visual-engineering fallback)
Kimi kimi-for-coding/k2p5 (Sisyphus/Prometheus fallback)
`).action(async (options) => {
const args = {
tui: options.tui !== false,
claude: options.claude,
openai: options.openai,
gemini: options.gemini,
copilot: options.copilot,
opencodeZen: options.opencodeZen,
zaiCodingPlan: options.zaiCodingPlan,
kimiForCoding: options.kimiForCoding,
opencodeGo: options.opencodeGo,
skipAuth: options.skipAuth ?? false
};
const exitCode = await install(args);
process.exit(exitCode);
});
program2.command("run <message>").allowUnknownOption().passThroughOptions().description("Run opencode with todo/background task completion enforcement").option("-a, --agent <name>", "Agent to use (default: from CLI/env/config, fallback: Sisyphus)").option("-m, --model <provider/model>", "Model override (e.g., anthropic/claude-sonnet-4)").option("-d, --directory <path>", "Working directory").option("-p, --port <port>", "Server port (attaches if port already in use)", parseInt).option("--attach <url>", "Attach to existing opencode server URL").option("--on-complete <command>", "Shell command to run after completion").option("--json", "Output structured JSON result to stdout").option("--no-timestamp", "Disable timestamp prefix in run output").option("--verbose", "Show full event stream (default: messages/tools only)").option("--session-id <id>", "Resume existing session instead of creating new one").addHelpText("after", `
Examples:
$ bunx oh-my-opencode run "Fix the bug in index.ts"
$ bunx oh-my-opencode run --agent Sisyphus "Implement feature X"
$ bunx oh-my-opencode run --port 4321 "Fix the bug"
$ bunx oh-my-opencode run --attach http://127.0.0.1:4321 "Fix the bug"
$ bunx oh-my-opencode run --json "Fix the bug" | jq .sessionId
$ bunx oh-my-opencode run --on-complete "notify-send Done" "Fix the bug"
$ bunx oh-my-opencode run --session-id ses_abc123 "Continue the work"
$ bunx oh-my-opencode run --model anthropic/claude-sonnet-4 "Fix the bug"
$ bunx oh-my-opencode run --agent Sisyphus --model openai/gpt-5.4 "Implement feature X"
Agent resolution order:
1) --agent flag
2) OPENCODE_DEFAULT_AGENT
3) oh-my-opencode.json "default_run_agent"
4) Sisyphus (fallback)
Available core agents:
Sisyphus, Hephaestus, Prometheus, Atlas
Unlike 'opencode run', this command waits until:
- All todos are completed or cancelled
- All child sessions (background tasks) are idle
`).action(async (message, options) => {
if (options.port && options.attach) {
console.error("Error: --port and --attach are mutually exclusive");
process.exit(1);
}
const runOptions = {
message,
agent: options.agent,
model: options.model,
directory: options.directory,
port: options.port,
attach: options.attach,
onComplete: options.onComplete,
json: options.json ?? false,
timestamp: options.timestamp ?? true,
verbose: options.verbose ?? false,
sessionId: options.sessionId
};
const exitCode = await run(runOptions);
process.exit(exitCode);
});
program2.command("get-local-version").description("Show current installed version and check for updates").option("-d, --directory <path>", "Working directory to check config from").option("--json", "Output in JSON format for scripting").addHelpText("after", `
Examples:
$ bunx oh-my-opencode get-local-version
$ bunx oh-my-opencode get-local-version --json
$ bunx oh-my-opencode get-local-version --directory /path/to/project
This command shows:
- Current installed version
- Latest available version on npm
- Whether you're up to date
- Special modes (local dev, pinned version)
`).action(async (options) => {
const versionOptions = {
directory: options.directory,
json: options.json ?? false
};
const exitCode = await getLocalVersion(versionOptions);
process.exit(exitCode);
});
program2.command("doctor").description("Check oh-my-opencode installation health and diagnose issues").option("--status", "Show compact system dashboard").option("--verbose", "Show detailed diagnostic information").option("--json", "Output results in JSON format").addHelpText("after", `
Examples:
$ bunx oh-my-opencode doctor # Show problems only
$ bunx oh-my-opencode doctor --status # Compact dashboard
$ bunx oh-my-opencode doctor --verbose # Deep diagnostics
$ bunx oh-my-opencode doctor --json # JSON output
`).action(async (options) => {
const mode = options.status ? "status" : options.verbose ? "verbose" : "default";
const doctorOptions = {
mode,
json: options.json ?? false
};
const exitCode = await doctor(doctorOptions);
process.exit(exitCode);
});
program2.command("version").description("Show version information").action(() => {
console.log(`oh-my-opencode v${VERSION2}`);
});
program2.addCommand(createMcpOAuthCommand());
function runCli() {
program2.parse();
}
// src/cli/index.ts
runCli();