barrelize
Version:
Automatically generating index (barrel) files
1,559 lines • 1.16 MB
JavaScript
import * as sp from "node:path";
import { dirname, extname, join, parse, posix, relative, resolve, sep, win32 } from "node:path";
import * as xi from "node:fs";
import { existsSync, readFileSync, stat, statSync, unwatchFile, watch, watchFile } from "node:fs";
import { lstat, open, readFile, readdir, readlink, realpath, stat as stat$1, writeFile } from "node:fs/promises";
import { fileURLToPath } from "node:url";
import { lstatSync, readdir as readdir$1, readdirSync, readlinkSync, realpathSync } from "fs";
import { EventEmitter } from "node:events";
import Pe, { Readable } from "node:stream";
import { StringDecoder } from "node:string_decoder";
import { type } from "node:os";
//#region \0rolldown/runtime.js
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
var __exportAll = (all, no_symbols) => {
let target = {};
for (var name in all) __defProp(target, name, {
get: all[name],
enumerable: true
});
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
return target;
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
//#endregion
//#region node_modules/cac/dist/index.js
function toArr(any) {
return any == null ? [] : Array.isArray(any) ? any : [any];
}
function toVal(out, key, val, opts) {
var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
}
function lib_default(args, opts) {
args = args || [];
opts = opts || {};
var k, arr, arg, name, val, out = { _: [] };
var i = 0, j = 0, idx = 0, len = args.length;
const alibi = opts.alias !== void 0;
const strict = opts.unknown !== void 0;
const defaults = opts.default !== void 0;
opts.alias = opts.alias || {};
opts.string = toArr(opts.string);
opts.boolean = toArr(opts.boolean);
if (alibi) for (k in opts.alias) {
arr = opts.alias[k] = toArr(opts.alias[k]);
for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
}
for (i = opts.boolean.length; i-- > 0;) {
arr = opts.alias[opts.boolean[i]] || [];
for (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);
}
for (i = opts.string.length; i-- > 0;) {
arr = opts.alias[opts.string[i]] || [];
for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
}
if (defaults) for (k in opts.default) {
name = typeof opts.default[k];
arr = opts.alias[k] = opts.alias[k] || [];
if (opts[name] !== void 0) {
opts[name].push(k);
for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
}
}
const keys = strict ? Object.keys(opts.alias) : [];
for (i = 0; i < len; i++) {
arg = args[i];
if (arg === "--") {
out._ = out._.concat(args.slice(++i));
break;
}
for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
if (j === 0) out._.push(arg);
else if (arg.substring(j, j + 3) === "no-") {
name = arg.substring(j + 3);
if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
out[name] = false;
} else {
for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
name = arg.substring(j, idx);
val = arg.substring(++idx) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
arr = j === 2 ? [name] : name;
for (idx = 0; idx < arr.length; idx++) {
name = arr[idx];
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
toVal(out, name, idx + 1 < arr.length || val, opts);
}
}
}
if (defaults) {
for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
}
if (alibi) for (k in out) {
arr = opts.alias[k] || [];
while (arr.length > 0) out[arr.shift()] = out[k];
}
return out;
}
function removeBrackets(v) {
return v.replace(/[<[].+/, "").trim();
}
function findAllBrackets(v) {
const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
const res = [];
const parse = (match) => {
let variadic = false;
let value = match[1];
if (value.startsWith("...")) {
value = value.slice(3);
variadic = true;
}
return {
required: match[0].startsWith("<"),
value,
variadic
};
};
let angledMatch;
while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(angledMatch));
let squareMatch;
while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
return res;
}
function getMriOptions(options) {
const result = {
alias: {},
boolean: []
};
for (const [index, option] of options.entries()) {
if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
if (option.isBoolean) if (option.negated) {
if (!options.some((o, i) => {
return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
})) result.boolean.push(option.names[0]);
} else result.boolean.push(option.names[0]);
}
return result;
}
function findLongest(arr) {
return arr.sort((a, b) => {
return a.length > b.length ? -1 : 1;
})[0];
}
function padRight(str, length) {
return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
}
function camelcase(input) {
return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {
return p1 + p2.toUpperCase();
});
}
function setDotProp(obj, keys, val) {
let current = obj;
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (i === keys.length - 1) {
current[key] = val;
return;
}
if (current[key] == null) {
const nextKeyIsArrayIndex = +keys[i + 1] > -1;
current[key] = nextKeyIsArrayIndex ? [] : {};
}
current = current[key];
}
}
function setByType(obj, transforms) {
for (const key of Object.keys(transforms)) {
const transform = transforms[key];
if (transform.shouldTransform) {
obj[key] = [obj[key]].flat();
if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
}
}
}
function getFileName(input) {
const m = /([^\\/]+)$/.exec(input);
return m ? m[1] : "";
}
function camelcaseOptionName(name) {
return name.split(".").map((v, i) => {
return i === 0 ? camelcase(v) : v;
}).join(".");
}
var CACError = class extends Error {
constructor(message) {
super(message);
this.name = "CACError";
if (typeof Error.captureStackTrace !== "function") this.stack = new Error(message).stack;
}
};
var Option = class {
rawName;
description;
/** Option name */
name;
/** Option name and aliases */
names;
isBoolean;
required;
config;
negated;
constructor(rawName, description, config) {
this.rawName = rawName;
this.description = description;
this.config = Object.assign({}, config);
rawName = rawName.replaceAll(".*", "");
this.negated = false;
this.names = removeBrackets(rawName).split(",").map((v) => {
let name = v.trim().replace(/^-{1,2}/, "");
if (name.startsWith("no-")) {
this.negated = true;
name = name.replace(/^no-/, "");
}
return camelcaseOptionName(name);
}).sort((a, b) => a.length > b.length ? 1 : -1);
this.name = this.names.at(-1);
if (this.negated && this.config.default == null) this.config.default = true;
if (rawName.includes("<")) this.required = true;
else if (rawName.includes("[")) this.required = false;
else this.isBoolean = true;
}
};
var runtimeProcessArgs;
var runtimeInfo;
if (typeof process !== "undefined") {
let runtimeName;
if (typeof Deno !== "undefined" && typeof Deno.version?.deno === "string") runtimeName = "deno";
else if (typeof Bun !== "undefined" && typeof Bun.version === "string") runtimeName = "bun";
else runtimeName = "node";
runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
runtimeProcessArgs = process.argv;
} else if (typeof navigator === "undefined") runtimeInfo = `unknown`;
else runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;
var Command = class {
rawName;
description;
config;
cli;
options;
aliasNames;
name;
args;
commandAction;
usageText;
versionNumber;
examples;
helpCallback;
globalCommand;
constructor(rawName, description, config = {}, cli) {
this.rawName = rawName;
this.description = description;
this.config = config;
this.cli = cli;
this.options = [];
this.aliasNames = [];
this.name = removeBrackets(rawName);
this.args = findAllBrackets(rawName);
this.examples = [];
}
usage(text) {
this.usageText = text;
return this;
}
allowUnknownOptions() {
this.config.allowUnknownOptions = true;
return this;
}
ignoreOptionDefaultValue() {
this.config.ignoreOptionDefaultValue = true;
return this;
}
version(version, customFlags = "-v, --version") {
this.versionNumber = version;
this.option(customFlags, "Display version number");
return this;
}
example(example) {
this.examples.push(example);
return this;
}
/**
* Add a option for this command
* @param rawName Raw option name(s)
* @param description Option description
* @param config Option config
*/
option(rawName, description, config) {
const option = new Option(rawName, description, config);
this.options.push(option);
return this;
}
alias(name) {
this.aliasNames.push(name);
return this;
}
action(callback) {
this.commandAction = callback;
return this;
}
/**
* Check if a command name is matched by this command
* @param name Command name
*/
isMatched(name) {
return this.name === name || this.aliasNames.includes(name);
}
get isDefaultCommand() {
return this.name === "" || this.aliasNames.includes("!");
}
get isGlobalCommand() {
return this instanceof GlobalCommand;
}
/**
* Check if an option is registered in this command
* @param name Option name
*/
hasOption(name) {
name = name.split(".")[0];
return this.options.find((option) => {
return option.names.includes(name);
});
}
outputHelp() {
const { name, commands } = this.cli;
const { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;
let sections = [{ body: `${name}${versionNumber ? `/${versionNumber}` : ""}` }];
sections.push({
title: "Usage",
body: ` $ ${name} ${this.usageText || this.rawName}`
});
if ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {
const longestCommandName = findLongest(commands.map((command) => command.rawName));
sections.push({
title: "Commands",
body: commands.map((command) => {
return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
}).join("\n")
}, {
title: `For more info, run any command with the \`--help\` flag`,
body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
});
}
let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
if (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option) => option.name !== "version");
if (options.length > 0) {
const longestOptionName = findLongest(options.map((option) => option.rawName));
sections.push({
title: "Options",
body: options.map((option) => {
return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
}).join("\n")
});
}
if (this.examples.length > 0) sections.push({
title: "Examples",
body: this.examples.map((example) => {
if (typeof example === "function") return example(name);
return example;
}).join("\n")
});
if (helpCallback) sections = helpCallback(sections) || sections;
console.info(sections.map((section) => {
return section.title ? `${section.title}:\n${section.body}` : section.body;
}).join("\n\n"));
}
outputVersion() {
const { name } = this.cli;
const { versionNumber } = this.cli.globalCommand;
if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
}
checkRequiredArgs() {
const minimalArgsCount = this.args.filter((arg) => arg.required).length;
if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
}
/**
* Check if the parsed options contain any unknown options
*
* Exit and output error when true
*/
checkUnknownOptions() {
const { options, globalCommand } = this.cli;
if (!this.config.allowUnknownOptions) {
for (const name of Object.keys(options)) if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
}
}
/**
* Check if the required string-type options exist
*/
checkOptionValue() {
const { options: parsedOptions, globalCommand } = this.cli;
const options = [...globalCommand.options, ...this.options];
for (const option of options) {
const value = parsedOptions[option.name.split(".")[0]];
if (option.required) {
const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
if (value === true || value === false && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
}
}
}
/**
* Check if the number of args is more than expected
*/
checkUnusedArgs() {
const maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;
if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\`${arg}\``).join(", ")}`);
}
};
var GlobalCommand = class extends Command {
constructor(cli) {
super("@@global@@", "", {}, cli);
}
};
var CAC = class extends EventTarget {
/** The program name to display in help and version message */
name;
commands;
globalCommand;
matchedCommand;
matchedCommandName;
/**
* Raw CLI arguments
*/
rawArgs;
/**
* Parsed CLI arguments
*/
args;
/**
* Parsed CLI options, camelCased
*/
options;
showHelpOnExit;
showVersionOnExit;
/**
* @param name The program name to display in help and version message
*/
constructor(name = "") {
super();
this.name = name;
this.commands = [];
this.rawArgs = [];
this.args = [];
this.options = {};
this.globalCommand = new GlobalCommand(this);
this.globalCommand.usage("<command> [options]");
}
/**
* Add a global usage text.
*
* This is not used by sub-commands.
*/
usage(text) {
this.globalCommand.usage(text);
return this;
}
/**
* Add a sub-command
*/
command(rawName, description, config) {
const command = new Command(rawName, description || "", config, this);
command.globalCommand = this.globalCommand;
this.commands.push(command);
return command;
}
/**
* Add a global CLI option.
*
* Which is also applied to sub-commands.
*/
option(rawName, description, config) {
this.globalCommand.option(rawName, description, config);
return this;
}
/**
* Show help message when `-h, --help` flags appear.
*
*/
help(callback) {
this.globalCommand.option("-h, --help", "Display this message");
this.globalCommand.helpCallback = callback;
this.showHelpOnExit = true;
return this;
}
/**
* Show version number when `-v, --version` flags appear.
*
*/
version(version, customFlags = "-v, --version") {
this.globalCommand.version(version, customFlags);
this.showVersionOnExit = true;
return this;
}
/**
* Add a global example.
*
* This example added here will not be used by sub-commands.
*/
example(example) {
this.globalCommand.example(example);
return this;
}
/**
* Output the corresponding help message
* When a sub-command is matched, output the help message for the command
* Otherwise output the global one.
*
*/
outputHelp() {
if (this.matchedCommand) this.matchedCommand.outputHelp();
else this.globalCommand.outputHelp();
}
/**
* Output the version number.
*
*/
outputVersion() {
this.globalCommand.outputVersion();
}
setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
this.args = args;
this.options = options;
if (matchedCommand) this.matchedCommand = matchedCommand;
if (matchedCommandName) this.matchedCommandName = matchedCommandName;
return this;
}
unsetMatchedCommand() {
this.matchedCommand = void 0;
this.matchedCommandName = void 0;
}
/**
* Parse argv
*/
parse(argv, { run = true } = {}) {
if (!argv) {
if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
argv = runtimeProcessArgs;
}
this.rawArgs = argv;
if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
let shouldParse = true;
for (const command of this.commands) {
const parsed = this.mri(argv.slice(2), command);
const commandName = parsed.args[0];
if (command.isMatched(commandName)) {
shouldParse = false;
const parsedInfo = {
...parsed,
args: parsed.args.slice(1)
};
this.setParsedInfo(parsedInfo, command, commandName);
this.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));
}
}
if (shouldParse) {
for (const command of this.commands) if (command.isDefaultCommand) {
shouldParse = false;
const parsed = this.mri(argv.slice(2), command);
this.setParsedInfo(parsed, command);
this.dispatchEvent(new CustomEvent("command:!", { detail: command }));
}
}
if (shouldParse) {
const parsed = this.mri(argv.slice(2));
this.setParsedInfo(parsed);
}
if (this.options.help && this.showHelpOnExit) {
this.outputHelp();
run = false;
this.unsetMatchedCommand();
}
if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
this.outputVersion();
run = false;
this.unsetMatchedCommand();
}
const parsedArgv = {
args: this.args,
options: this.options
};
if (run) this.runMatchedCommand();
if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", { detail: this.args[0] }));
return parsedArgv;
}
mri(argv, command) {
const cliOptions = [...this.globalCommand.options, ...command ? command.options : []];
const mriOptions = getMriOptions(cliOptions);
let argsAfterDoubleDashes = [];
const doubleDashesIndex = argv.indexOf("--");
if (doubleDashesIndex !== -1) {
argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
argv = argv.slice(0, doubleDashesIndex);
}
let parsed = lib_default(argv, mriOptions);
parsed = Object.keys(parsed).reduce((res, name) => {
return {
...res,
[camelcaseOptionName(name)]: parsed[name]
};
}, { _: [] });
const args = parsed._;
const options = { "--": argsAfterDoubleDashes };
const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
const transforms = Object.create(null);
for (const cliOption of cliOptions) {
if (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;
if (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {
transforms[cliOption.name] = Object.create(null);
transforms[cliOption.name].shouldTransform = true;
transforms[cliOption.name].transformFunction = cliOption.config.type[0];
}
}
for (const key of Object.keys(parsed)) if (key !== "_") {
setDotProp(options, key.split("."), parsed[key]);
setByType(options, transforms);
}
return {
args,
options
};
}
runMatchedCommand() {
const { args, options, matchedCommand: command } = this;
if (!command || !command.commandAction) return;
command.checkUnknownOptions();
command.checkOptionValue();
command.checkRequiredArgs();
command.checkUnusedArgs();
const actionArgs = [];
command.args.forEach((arg, index) => {
if (arg.variadic) actionArgs.push(args.slice(index));
else actionArgs.push(args[index]);
});
actionArgs.push(options);
return command.commandAction.apply(this, actionArgs);
}
};
/**
* @param name The program name to display in help and version message
*/
var cac = (name = "") => new CAC(name);
//#endregion
//#region package.json
var name = "barrelize";
var version$1 = "1.8.1";
//#endregion
//#region src/cli/cli.ts
function cliInit() {
const cli = cac(name);
cli.command("[config path]", "Generate barrel files").option("-w, --watch", "Watch for changes and regenerate barrel files automatically").action((configPath, options) => runGenerateCommand({
configPath: configPath || ".barrelize",
watch: !!options.watch
}).catch(logError));
cli.command("init [config path]", "Create .barrelize config file if does not exist").example("barrelize init").example("barrelize init .barrelize").example("barrelize init root/.barrelize").action((path = ".barrelize") => runInitCommand(path).catch(logError));
cli.help();
cli.version(version$1);
try {
cli.parse();
} catch (error) {
logError(String(error));
}
}
//#endregion
//#region node_modules/zod/v4/core/core.js
var _a$1;
/** A special constant with type `never` */
var NEVER = /* @__PURE__ */ Object.freeze({ status: "aborted" });
function $constructor(name, initializer, params) {
function init(inst, def) {
if (!inst._zod) Object.defineProperty(inst, "_zod", {
value: {
def,
constr: _,
traits: /* @__PURE__ */ new Set()
},
enumerable: false
});
if (inst._zod.traits.has(name)) return;
inst._zod.traits.add(name);
initializer(inst, def);
const proto = _.prototype;
const keys = Object.keys(proto);
for (let i = 0; i < keys.length; i++) {
const k = keys[i];
if (!(k in inst)) inst[k] = proto[k].bind(inst);
}
}
const Parent = params?.Parent ?? Object;
class Definition extends Parent {}
Object.defineProperty(Definition, "name", { value: name });
function _(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(_, "init", { value: init });
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
if (params?.Parent && inst instanceof params.Parent) return true;
return inst?._zod?.traits?.has(name);
} });
Object.defineProperty(_, "name", { value: name });
return _;
}
var $brand = Symbol("zod_brand");
var $ZodAsyncError = class extends Error {
constructor() {
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
}
};
var $ZodEncodeError = class extends Error {
constructor(name) {
super(`Encountered unidirectional transform during encode: ${name}`);
this.name = "ZodEncodeError";
}
};
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
var globalConfig = globalThis.__zod_globalConfig;
function config(newConfig) {
if (newConfig) Object.assign(globalConfig, newConfig);
return globalConfig;
}
//#endregion
//#region node_modules/zod/v4/core/util.js
var util_exports = /* @__PURE__ */ __exportAll({
BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
Class: () => Class,
NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
aborted: () => aborted,
allowsEval: () => allowsEval,
assert: () => assert,
assertEqual: () => assertEqual,
assertIs: () => assertIs,
assertNever: () => assertNever,
assertNotEqual: () => assertNotEqual,
assignProp: () => assignProp,
base64ToUint8Array: () => base64ToUint8Array,
base64urlToUint8Array: () => base64urlToUint8Array,
cached: () => cached,
captureStackTrace: () => captureStackTrace,
cleanEnum: () => cleanEnum,
cleanRegex: () => cleanRegex,
clone: () => clone,
cloneDef: () => cloneDef,
createTransparentProxy: () => createTransparentProxy,
defineLazy: () => defineLazy,
esc: () => esc,
escapeRegex: () => escapeRegex,
explicitlyAborted: () => explicitlyAborted,
extend: () => extend,
finalizeIssue: () => finalizeIssue,
floatSafeRemainder: () => floatSafeRemainder,
getElementAtPath: () => getElementAtPath,
getEnumValues: () => getEnumValues,
getLengthableOrigin: () => getLengthableOrigin,
getParsedType: () => getParsedType,
getSizableOrigin: () => getSizableOrigin,
hexToUint8Array: () => hexToUint8Array,
isObject: () => isObject,
isPlainObject: () => isPlainObject,
issue: () => issue,
joinValues: () => joinValues,
jsonStringifyReplacer: () => jsonStringifyReplacer,
merge: () => merge,
mergeDefs: () => mergeDefs,
normalizeParams: () => normalizeParams,
nullish: () => nullish$1,
numKeys: () => numKeys,
objectClone: () => objectClone,
omit: () => omit,
optionalKeys: () => optionalKeys,
parsedType: () => parsedType,
partial: () => partial,
pick: () => pick,
prefixIssues: () => prefixIssues,
primitiveTypes: () => primitiveTypes,
promiseAllObject: () => promiseAllObject,
propertyKeyTypes: () => propertyKeyTypes,
randomString: () => randomString,
required: () => required,
safeExtend: () => safeExtend,
shallowClone: () => shallowClone,
slugify: () => slugify,
stringifyPrimitive: () => stringifyPrimitive,
uint8ArrayToBase64: () => uint8ArrayToBase64,
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
uint8ArrayToHex: () => uint8ArrayToHex,
unwrapMessage: () => unwrapMessage
});
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(_) {}
function getEnumValues(entries) {
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
}
function joinValues(array, separator = "|") {
return array.map((val) => stringifyPrimitive(val)).join(separator);
}
function jsonStringifyReplacer(_, value) {
if (typeof value === "bigint") return value.toString();
return value;
}
function cached(getter) {
return { get value() {
{
const value = getter();
Object.defineProperty(this, "value", { value });
return value;
}
throw new Error("cached value already set");
} };
}
function nullish$1(input) {
return input === null || input === void 0;
}
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 ratio = val / step;
const roundedRatio = Math.round(ratio);
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
return ratio - roundedRatio;
}
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
function defineLazy(object, key, getter) {
let value = void 0;
Object.defineProperty(object, key, {
get() {
if (value === EVALUATING) return;
if (value === void 0) {
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) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
return Object.defineProperties({}, mergedDescriptors);
}
function cloneDef(schema) {
return mergeDefs(schema._zod.def);
}
function getElementAtPath(obj, path) {
if (!path) return obj;
return path.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 i = 0; i < keys.length; i++) resolvedObj[keys[i]] = results[i];
return resolvedObj;
});
}
function randomString(length = 10) {
const chars = "abcdefghijklmnopqrstuvwxyz";
let str = "";
for (let i = 0; i < length; i++) str += chars[Math.floor(Math.random() * 26)];
return str;
}
function esc(str) {
return JSON.stringify(str);
}
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 isObject(data) {
return typeof data === "object" && data !== null && !Array.isArray(data);
}
var allowsEval = /* @__PURE__ */ cached(() => {
if (globalConfig.jitless) return false;
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
try {
new Function("");
return true;
} catch (_) {
return false;
}
});
function isPlainObject(o) {
if (isObject(o) === false) return false;
const ctor = o.constructor;
if (ctor === void 0) return true;
if (typeof ctor !== "function") return true;
const prot = ctor.prototype;
if (isObject(prot) === false) return false;
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
return true;
}
function shallowClone(o) {
if (isPlainObject(o)) return { ...o };
if (Array.isArray(o)) return [...o];
if (o instanceof Map) return new Map(o);
if (o instanceof Set) return new Set(o);
return o;
}
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 = /* @__PURE__ */ new Set([
"string",
"number",
"symbol"
]);
var primitiveTypes = /* @__PURE__ */ new Set([
"string",
"number",
"bigint",
"boolean",
"symbol",
"undefined"
]);
function escapeRegex(str) {
return str.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 !== void 0) {
if (params?.error !== void 0) 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(_, prop, receiver) {
target ?? (target = getter());
return Reflect.get(target, prop, receiver);
},
set(_, prop, value, receiver) {
target ?? (target = getter());
return Reflect.set(target, prop, value, receiver);
},
has(_, prop) {
target ?? (target = getter());
return Reflect.has(target, prop);
},
deleteProperty(_, prop) {
target ?? (target = getter());
return Reflect.deleteProperty(target, prop);
},
ownKeys(_) {
target ?? (target = getter());
return Reflect.ownKeys(target);
},
getOwnPropertyDescriptor(_, prop) {
target ?? (target = getter());
return Reflect.getOwnPropertyDescriptor(target, prop);
},
defineProperty(_, 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((k) => {
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
});
}
var NUMBER_FORMAT_RANGES = {
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
int32: [-2147483648, 2147483647],
uint32: [0, 4294967295],
float32: [-34028234663852886e22, 34028234663852886e22],
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(schema, mask) {
const currDef = schema._zod.def;
const checks = currDef.checks;
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
return clone(schema, mergeDefs(schema._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: []
}));
}
function omit(schema, mask) {
const currDef = schema._zod.def;
const checks = currDef.checks;
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
return clone(schema, mergeDefs(schema._zod.def, {
get shape() {
const newShape = { ...schema._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: []
}));
}
function extend(schema, shape) {
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
const checks = schema._zod.def.checks;
if (checks && checks.length > 0) {
const existingShape = schema._zod.def.shape;
for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
}
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
const _shape = {
...schema._zod.def.shape,
...shape
};
assignProp(this, "shape", _shape);
return _shape;
} }));
}
function safeExtend(schema, shape) {
if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
const _shape = {
...schema._zod.def.shape,
...shape
};
assignProp(this, "shape", _shape);
return _shape;
} }));
}
function merge(a, b) {
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
return clone(a, mergeDefs(a._zod.def, {
get shape() {
const _shape = {
...a._zod.def.shape,
...b._zod.def.shape
};
assignProp(this, "shape", _shape);
return _shape;
},
get catchall() {
return b._zod.def.catchall;
},
checks: b._zod.def.checks ?? []
}));
}
function partial(Class, schema, mask) {
const checks = schema._zod.def.checks;
if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
return clone(schema, mergeDefs(schema._zod.def, {
get shape() {
const oldShape = schema._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: []
}));
}
function required(Class, schema, mask) {
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
const oldShape = schema._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;
} }));
}
function aborted(x, startIndex = 0) {
if (x.aborted === true) return true;
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
return false;
}
function explicitlyAborted(x, startIndex = 0) {
if (x.aborted === true) return true;
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue === false) return true;
return false;
}
function prefixIssues(path, issues) {
return issues.map((iss) => {
var _a;
(_a = iss).path ?? (_a.path = []);
iss.path.unshift(path);
return iss;
});
}
function unwrapMessage(message) {
return typeof message === "string" ? message : message?.message;
}
function finalizeIssue(iss, ctx, config) {
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
rest.path ?? (rest.path = []);
rest.message = message;
if (ctx?.reportInput) rest.input = _input;
return rest;
}
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(([k, _]) => {
return Number.isNaN(Number.parseInt(k, 10));
}).map((el) => el[1]);
}
function base64ToUint8Array(base64) {
const binaryString = atob(base64);
const bytes = new Uint8Array(binaryString.length);
for (let i = 0; i < binaryString.length; i++) bytes[i] = binaryString.charCodeAt(i);
return bytes;
}
function uint8ArrayToBase64(bytes) {
let binaryString = "";
for (let i = 0; i < bytes.length; i++) binaryString += String.fromCharCode(bytes[i]);
return btoa(binaryString);
}
function base64urlToUint8Array(base64url) {
const base64 = base64url.replace(/-/g, "+").replace(/_/g, "/");
return base64ToUint8Array(base64 + "=".repeat((4 - base64.length % 4) % 4));
}
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 i = 0; i < cleanHex.length; i += 2) bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
return bytes;
}
function uint8ArrayToHex(bytes) {
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
}
var Class = class {
constructor(..._args) {}
};
//#endregion
//#region node_modules/zod/v4/core/errors.js
var initializer$1 = (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$1);
var $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
function flattenError(error, mapper = (issue) => issue.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 formatError(error, mapper = (issue) => issue.message) {
const fieldErrors = { _errors: [] };
const processError = (error, path = []) => {
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]);
else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]);
else {
const fullpath = [...path, ...issue.path];
if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue));
else {
let curr = fieldErrors;
let i = 0;
while (i < fullpath.length) {
const el = fullpath[i];
if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
else {
curr[el] = curr[el] || { _errors: [] };
curr[el]._errors.push(mapper(issue));
}
curr = curr[el];
i++;
}
}
}
};
processError(error);
return fieldErrors;
}
function treeifyError(error, mapper = (issue) => issue.message) {
const result = { errors: [] };
const processError = (error, path = []) => {
var _a, _b;
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]);
else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]);
else {
const fullpath = [...path, ...issue.path];
if (fullpath.length === 0) {
result.errors.push(mapper(issue));
continue;
}
let curr = result;
let i = 0;
while (i < fullpath.length) {
const el = fullpath[i];
const terminal = i === 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(issue));
i++;
}
}
};
processError(error);
return result;
}
/** Format a ZodError as a human-readable string in the following form.
*
* From
*
* ```ts
* ZodError {
* issues: [
* {
* expected: 'string',
* code: 'invalid_type',
* path: [ 'username' ],
* message: 'Invalid input: expected string'
* },
* {
* expected: 'number',
* code: 'invalid_type',
* path: [ 'favoriteNumbers', 1 ],
* message: 'Invalid input: expected number'
* }
* ];
* }
* ```
*
* to
*
* ```
* username
* ✖ Expected number, received string at "username
* favoriteNumbers[0]
* ✖ Invalid input: expected number
* ```
*/
function toDotPath(_path) {
const segs = [];
const path = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
for (const seg of path) 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, b) => (a.path ?? []).length - (b.path ?? []).length);
for (const issue of issues) {
lines.push(`✖ ${issue.message}`);
if (issue.path?.length) lines.push(` → at ${toDotPath(issue.path)}`);
}
return lines.join("\n");
}
//#endregion
//#region node_modules/zod/v4/core/parse.js
var _parse = (_Err) => (schema, value, _ctx, _params) => {
const ctx = _ctx ? {
..._ctx,
async: false
} : { async: false };
const result = schema._zod.run({
value,
issues: []
}, ctx);
if (result instanceof Promise) throw new $ZodAsyncError();
if (result.issues.length) {
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
captureStackTrace(e, _params?.callee);
throw e;
}
return result.value;
};
var parse$3 = /* @__PURE__ */ _parse($ZodRealError);
var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
const ctx = _ctx ? {
..._ctx,
async: true
} : { async: true };
let result = schema._zod.run({
value,
issues: []
}, ctx);
if (result instanceof Promise) result = await result;
if (result.issues.length) {
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
captureStackTrace(e, params?.callee);
throw e;
}
return result.value;
};
var parseAsync$1 = /* @__PURE__ */ _parseAsync($ZodRealError);
var _safeParse = (_Err) => (schema, value, _ctx) => {
const ctx = _ctx ? {
..._ctx,
async: false
} : { async: false };
const result = schema._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$1 = /* @__PURE__ */ _safeParse($ZodRealError);
var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
const ctx = _ctx ? {
..._ctx,
async: true
} : { async: true };
let result = schema._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$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
var _encode = (_Err) => (schema, value, _ctx) => {
const ctx = _ctx ? {
..._ctx,
direction: "backward"
} : { direction: "backward" };
return _parse(_Err)(schema, value, ctx);
};
var encode$1 = /* @__PURE__ */ _encode($ZodRealError);
var _decode = (_Err) => (schema, value, _ctx) => {
return _parse(_Err)(schema, value, _ctx);
};
var decode$1 = /* @__PURE__ */ _decode($ZodRealError);
var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
const ctx = _ctx ? {
..._ctx,
direction: "backward"
} : { direction: "backward" };
return _parseAsync(_Err)(schema, value, ctx);
};
var encodeAsync$1 = /* @__PURE__ */ _encodeAsync($ZodRealError);
var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
return _parseAsync(_Err)(schema, value, _ctx);
};
var decodeAsync$1 = /* @__PURE__ */ _decodeAsync($ZodRealError);
var _safeEncode = (_Err) => (schema, value, _ctx) => {
const ctx = _ctx ? {
..._ctx,
direction: "backward"
} : { direction: "backward" };
return _safeParse(_Err)(schema, value, ctx);
};
var safeEncode$1 = /* @__PURE__ */ _safeEncode($ZodRealError);
var _safeDecode = (_Err) => (schema, value, _ctx) => {
return _safeParse(_Err)(schema, value, _ctx);
};
var safeDecode$1 = /* @__PURE__ */ _safeDecode($ZodRealError);
var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
const ctx = _ctx ? {
..._ctx,
direction: "backward"
} : { direction: "backward" };
return _safeParseAsync(_Err)(schema, value, ctx);
};
var safeEncodeAsync$1 = /* @__PURE__ */ _safeEncodeAsync($ZodRe