UNPKG

@botpress/adk-cli

Version:

Command-line interface for the Botpress Agent Development Kit (ADK)

11,877 lines 422 kB
// @bun
import {
  __export
} from "./chunk-dhs2bg35.js";

// ../../node_modules/.bun/llmz@0.0.79+b49d396f5ed96e7f/node_modules/llmz/dist/chunk-5XC6ZMS5.js
var exports_chunk_5XC6ZMS5 = {};
__export(exports_chunk_5XC6ZMS5, {
  upperFirst_default: () => upperFirst_default,
  uniq_default: () => uniq_default,
  uniqWith_default: () => uniqWith_default,
  toPairs_default: () => toPairs_default,
  take_default: () => take_default,
  startCase_default: () => startCase_default,
  pickBy_default: () => pickBy_default,
  orderBy_default: () => orderBy_default,
  omit_default: () => omit_default,
  maxBy_default: () => maxBy_default,
  map_default: () => map_default,
  mapValues_default: () => mapValues_default,
  mapKeys_default: () => mapKeys_default,
  isString_default: () => isString_default,
  isPlainObject_default: () => isPlainObject_default,
  isNil_default: () => isNil_default,
  isFunction_default: () => isFunction_default,
  isEqual_default: () => isEqual_default,
  isEmpty_default: () => isEmpty_default,
  fromPairs_default: () => fromPairs_default,
  flow_default: () => flow_default,
  filter_default: () => filter_default,
  deburr_default: () => deburr_default,
  countBy_default: () => countBy_default,
  cloneDeep_default: () => cloneDeep_default,
  clamp_default: () => clamp_default,
  camelCase_default: () => camelCase_default,
  __toESM: () => __toESM,
  __commonJS: () => __commonJS
});
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 __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[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));
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
var freeGlobal_default = freeGlobal;
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
var root = freeGlobal_default || freeSelf || Function("return this")();
var root_default = root;
var Symbol2 = root_default.Symbol;
var Symbol_default = Symbol2;
var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
var nativeObjectToString = objectProto.toString;
var symToStringTag = Symbol_default ? Symbol_default.toStringTag : undefined;
function getRawTag(value) {
  var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
  try {
    value[symToStringTag] = undefined;
    var unmasked = true;
  } catch (e) {}
  var result = nativeObjectToString.call(value);
  if (unmasked) {
    if (isOwn) {
      value[symToStringTag] = tag;
    } else {
      delete value[symToStringTag];
    }
  }
  return result;
}
var getRawTag_default = getRawTag;
var objectProto2 = Object.prototype;
var nativeObjectToString2 = objectProto2.toString;
function objectToString(value) {
  return nativeObjectToString2.call(value);
}
var objectToString_default = objectToString;
var nullTag = "[object Null]";
var undefinedTag = "[object Undefined]";
var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : undefined;
function baseGetTag(value) {
  if (value == null) {
    return value === undefined ? undefinedTag : nullTag;
  }
  return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
}
var baseGetTag_default = baseGetTag;
function isObject(value) {
  var type = typeof value;
  return value != null && (type == "object" || type == "function");
}
var isObject_default = isObject;
var asyncTag = "[object AsyncFunction]";
var funcTag = "[object Function]";
var genTag = "[object GeneratorFunction]";
var proxyTag = "[object Proxy]";
function isFunction(value) {
  if (!isObject_default(value)) {
    return false;
  }
  var tag = baseGetTag_default(value);
  return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
var isFunction_default = isFunction;
function overArg(func, transform) {
  return function(arg) {
    return func(transform(arg));
  };
}
var overArg_default = overArg;
var getPrototype = overArg_default(Object.getPrototypeOf, Object);
var getPrototype_default = getPrototype;
function isObjectLike(value) {
  return value != null && typeof value == "object";
}
var isObjectLike_default = isObjectLike;
var objectTag = "[object Object]";
var funcProto = Function.prototype;
var objectProto3 = Object.prototype;
var funcToString = funcProto.toString;
var hasOwnProperty2 = objectProto3.hasOwnProperty;
var objectCtorString = funcToString.call(Object);
function isPlainObject(value) {
  if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag) {
    return false;
  }
  var proto = getPrototype_default(value);
  if (proto === null) {
    return true;
  }
  var Ctor = hasOwnProperty2.call(proto, "constructor") && proto.constructor;
  return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
}
var isPlainObject_default = isPlainObject;
function basePropertyOf(object) {
  return function(key) {
    return object == null ? undefined : object[key];
  };
}
var basePropertyOf_default = basePropertyOf;
var deburredLetters = {
  "\xC0": "A",
  "\xC1": "A",
  "\xC2": "A",
  "\xC3": "A",
  "\xC4": "A",
  "\xC5": "A",
  "\xE0": "a",
  "\xE1": "a",
  "\xE2": "a",
  "\xE3": "a",
  "\xE4": "a",
  "\xE5": "a",
  "\xC7": "C",
  "\xE7": "c",
  "\xD0": "D",
  "\xF0": "d",
  "\xC8": "E",
  "\xC9": "E",
  "\xCA": "E",
  "\xCB": "E",
  "\xE8": "e",
  "\xE9": "e",
  "\xEA": "e",
  "\xEB": "e",
  "\xCC": "I",
  "\xCD": "I",
  "\xCE": "I",
  "\xCF": "I",
  "\xEC": "i",
  "\xED": "i",
  "\xEE": "i",
  "\xEF": "i",
  "\xD1": "N",
  "\xF1": "n",
  "\xD2": "O",
  "\xD3": "O",
  "\xD4": "O",
  "\xD5": "O",
  "\xD6": "O",
  "\xD8": "O",
  "\xF2": "o",
  "\xF3": "o",
  "\xF4": "o",
  "\xF5": "o",
  "\xF6": "o",
  "\xF8": "o",
  "\xD9": "U",
  "\xDA": "U",
  "\xDB": "U",
  "\xDC": "U",
  "\xF9": "u",
  "\xFA": "u",
  "\xFB": "u",
  "\xFC": "u",
  "\xDD": "Y",
  "\xFD": "y",
  "\xFF": "y",
  "\xC6": "Ae",
  "\xE6": "ae",
  "\xDE": "Th",
  "\xFE": "th",
  "\xDF": "ss",
  "\u0100": "A",
  "\u0102": "A",
  "\u0104": "A",
  "\u0101": "a",
  "\u0103": "a",
  "\u0105": "a",
  "\u0106": "C",
  "\u0108": "C",
  "\u010A": "C",
  "\u010C": "C",
  "\u0107": "c",
  "\u0109": "c",
  "\u010B": "c",
  "\u010D": "c",
  "\u010E": "D",
  "\u0110": "D",
  "\u010F": "d",
  "\u0111": "d",
  "\u0112": "E",
  "\u0114": "E",
  "\u0116": "E",
  "\u0118": "E",
  "\u011A": "E",
  "\u0113": "e",
  "\u0115": "e",
  "\u0117": "e",
  "\u0119": "e",
  "\u011B": "e",
  "\u011C": "G",
  "\u011E": "G",
  "\u0120": "G",
  "\u0122": "G",
  "\u011D": "g",
  "\u011F": "g",
  "\u0121": "g",
  "\u0123": "g",
  "\u0124": "H",
  "\u0126": "H",
  "\u0125": "h",
  "\u0127": "h",
  "\u0128": "I",
  "\u012A": "I",
  "\u012C": "I",
  "\u012E": "I",
  "\u0130": "I",
  "\u0129": "i",
  "\u012B": "i",
  "\u012D": "i",
  "\u012F": "i",
  "\u0131": "i",
  "\u0134": "J",
  "\u0135": "j",
  "\u0136": "K",
  "\u0137": "k",
  "\u0138": "k",
  "\u0139": "L",
  "\u013B": "L",
  "\u013D": "L",
  "\u013F": "L",
  "\u0141": "L",
  "\u013A": "l",
  "\u013C": "l",
  "\u013E": "l",
  "\u0140": "l",
  "\u0142": "l",
  "\u0143": "N",
  "\u0145": "N",
  "\u0147": "N",
  "\u014A": "N",
  "\u0144": "n",
  "\u0146": "n",
  "\u0148": "n",
  "\u014B": "n",
  "\u014C": "O",
  "\u014E": "O",
  "\u0150": "O",
  "\u014D": "o",
  "\u014F": "o",
  "\u0151": "o",
  "\u0154": "R",
  "\u0156": "R",
  "\u0158": "R",
  "\u0155": "r",
  "\u0157": "r",
  "\u0159": "r",
  "\u015A": "S",
  "\u015C": "S",
  "\u015E": "S",
  "\u0160": "S",
  "\u015B": "s",
  "\u015D": "s",
  "\u015F": "s",
  "\u0161": "s",
  "\u0162": "T",
  "\u0164": "T",
  "\u0166": "T",
  "\u0163": "t",
  "\u0165": "t",
  "\u0167": "t",
  "\u0168": "U",
  "\u016A": "U",
  "\u016C": "U",
  "\u016E": "U",
  "\u0170": "U",
  "\u0172": "U",
  "\u0169": "u",
  "\u016B": "u",
  "\u016D": "u",
  "\u016F": "u",
  "\u0171": "u",
  "\u0173": "u",
  "\u0174": "W",
  "\u0175": "w",
  "\u0176": "Y",
  "\u0177": "y",
  "\u0178": "Y",
  "\u0179": "Z",
  "\u017B": "Z",
  "\u017D": "Z",
  "\u017A": "z",
  "\u017C": "z",
  "\u017E": "z",
  "\u0132": "IJ",
  "\u0133": "ij",
  "\u0152": "Oe",
  "\u0153": "oe",
  "\u0149": "'n",
  "\u017F": "s"
};
var deburrLetter = basePropertyOf_default(deburredLetters);
var deburrLetter_default = deburrLetter;
function arrayMap(array, iteratee) {
  var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  while (++index < length) {
    result[index] = iteratee(array[index], index, array);
  }
  return result;
}
var arrayMap_default = arrayMap;
var isArray = Array.isArray;
var isArray_default = isArray;
var symbolTag = "[object Symbol]";
function isSymbol(value) {
  return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
}
var isSymbol_default = isSymbol;
var INFINITY = 1 / 0;
var symbolProto = Symbol_default ? Symbol_default.prototype : undefined;
var symbolToString = symbolProto ? symbolProto.toString : undefined;
function baseToString(value) {
  if (typeof value == "string") {
    return value;
  }
  if (isArray_default(value)) {
    return arrayMap_default(value, baseToString) + "";
  }
  if (isSymbol_default(value)) {
    return symbolToString ? symbolToString.call(value) : "";
  }
  var result = value + "";
  return result == "0" && 1 / value == -INFINITY ? "-0" : result;
}
var baseToString_default = baseToString;
function toString(value) {
  return value == null ? "" : baseToString_default(value);
}
var toString_default = toString;
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
var rsComboMarksRange = "\\u0300-\\u036f";
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
var rsCombo = "[" + rsComboRange + "]";
var reComboMark = RegExp(rsCombo, "g");
function deburr(string) {
  string = toString_default(string);
  return string && string.replace(reLatin, deburrLetter_default).replace(reComboMark, "");
}
var deburr_default = deburr;
function baseSlice(array, start, end) {
  var index = -1, length = array.length;
  if (start < 0) {
    start = -start > length ? 0 : length + start;
  }
  end = end > length ? length : end;
  if (end < 0) {
    end += length;
  }
  length = start > end ? 0 : end - start >>> 0;
  start >>>= 0;
  var result = Array(length);
  while (++index < length) {
    result[index] = array[index + start];
  }
  return result;
}
var baseSlice_default = baseSlice;
function castSlice(array, start, end) {
  var length = array.length;
  end = end === undefined ? length : end;
  return !start && end >= length ? array : baseSlice_default(array, start, end);
}
var castSlice_default = castSlice;
var rsAstralRange = "\\ud800-\\udfff";
var rsComboMarksRange2 = "\\u0300-\\u036f";
var reComboHalfMarksRange2 = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange2 = "\\u20d0-\\u20ff";
var rsComboRange2 = rsComboMarksRange2 + reComboHalfMarksRange2 + rsComboSymbolsRange2;
var rsVarRange = "\\ufe0e\\ufe0f";
var rsZWJ = "\\u200d";
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange2 + rsVarRange + "]");
function hasUnicode(string) {
  return reHasUnicode.test(string);
}
var hasUnicode_default = hasUnicode;
function asciiToArray(string) {
  return string.split("");
}
var asciiToArray_default = asciiToArray;
var rsAstralRange2 = "\\ud800-\\udfff";
var rsComboMarksRange3 = "\\u0300-\\u036f";
var reComboHalfMarksRange3 = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange3 = "\\u20d0-\\u20ff";
var rsComboRange3 = rsComboMarksRange3 + reComboHalfMarksRange3 + rsComboSymbolsRange3;
var rsVarRange2 = "\\ufe0e\\ufe0f";
var rsAstral = "[" + rsAstralRange2 + "]";
var rsCombo2 = "[" + rsComboRange3 + "]";
var rsFitz = "\\ud83c[\\udffb-\\udfff]";
var rsModifier = "(?:" + rsCombo2 + "|" + rsFitz + ")";
var rsNonAstral = "[^" + rsAstralRange2 + "]";
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
var rsZWJ2 = "\\u200d";
var reOptMod = rsModifier + "?";
var rsOptVar = "[" + rsVarRange2 + "]?";
var rsOptJoin = "(?:" + rsZWJ2 + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
var rsSymbol = "(?:" + [rsNonAstral + rsCombo2 + "?", rsCombo2, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
function unicodeToArray(string) {
  return string.match(reUnicode) || [];
}
var unicodeToArray_default = unicodeToArray;
function stringToArray(string) {
  return hasUnicode_default(string) ? unicodeToArray_default(string) : asciiToArray_default(string);
}
var stringToArray_default = stringToArray;
function createCaseFirst(methodName) {
  return function(string) {
    string = toString_default(string);
    var strSymbols = hasUnicode_default(string) ? stringToArray_default(string) : undefined;
    var chr = strSymbols ? strSymbols[0] : string.charAt(0);
    var trailing = strSymbols ? castSlice_default(strSymbols, 1).join("") : string.slice(1);
    return chr[methodName]() + trailing;
  };
}
var createCaseFirst_default = createCaseFirst;
var upperFirst = createCaseFirst_default("toUpperCase");
var upperFirst_default = upperFirst;
function capitalize(string) {
  return upperFirst_default(toString_default(string).toLowerCase());
}
var capitalize_default = capitalize;
function arrayReduce(array, iteratee, accumulator, initAccum) {
  var index = -1, length = array == null ? 0 : array.length;
  if (initAccum && length) {
    accumulator = array[++index];
  }
  while (++index < length) {
    accumulator = iteratee(accumulator, array[index], index, array);
  }
  return accumulator;
}
var arrayReduce_default = arrayReduce;
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
function asciiWords(string) {
  return string.match(reAsciiWord) || [];
}
var asciiWords_default = asciiWords;
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
function hasUnicodeWord(string) {
  return reHasUnicodeWord.test(string);
}
var hasUnicodeWord_default = hasUnicodeWord;
var rsAstralRange3 = "\\ud800-\\udfff";
var rsComboMarksRange4 = "\\u0300-\\u036f";
var reComboHalfMarksRange4 = "\\ufe20-\\ufe2f";
var rsComboSymbolsRange4 = "\\u20d0-\\u20ff";
var rsComboRange4 = rsComboMarksRange4 + reComboHalfMarksRange4 + rsComboSymbolsRange4;
var rsDingbatRange = "\\u2700-\\u27bf";
var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
var rsPunctuationRange = "\\u2000-\\u206f";
var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
var rsVarRange3 = "\\ufe0e\\ufe0f";
var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
var rsApos = "['\u2019]";
var rsBreak = "[" + rsBreakRange + "]";
var rsCombo3 = "[" + rsComboRange4 + "]";
var rsDigits = "\\d+";
var rsDingbat = "[" + rsDingbatRange + "]";
var rsLower = "[" + rsLowerRange + "]";
var rsMisc = "[^" + rsAstralRange3 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
var rsFitz2 = "\\ud83c[\\udffb-\\udfff]";
var rsModifier2 = "(?:" + rsCombo3 + "|" + rsFitz2 + ")";
var rsNonAstral2 = "[^" + rsAstralRange3 + "]";
var rsRegional2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
var rsSurrPair2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
var rsUpper = "[" + rsUpperRange + "]";
var rsZWJ3 = "\\u200d";
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
var rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?";
var rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?";
var reOptMod2 = rsModifier2 + "?";
var rsOptVar2 = "[" + rsVarRange3 + "]?";
var rsOptJoin2 = "(?:" + rsZWJ3 + "(?:" + [rsNonAstral2, rsRegional2, rsSurrPair2].join("|") + ")" + rsOptVar2 + reOptMod2 + ")*";
var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
var rsSeq2 = rsOptVar2 + reOptMod2 + rsOptJoin2;
var rsEmoji = "(?:" + [rsDingbat, rsRegional2, rsSurrPair2].join("|") + ")" + rsSeq2;
var reUnicodeWord = RegExp([
  rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
  rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
  rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
  rsUpper + "+" + rsOptContrUpper,
  rsOrdUpper,
  rsOrdLower,
  rsDigits,
  rsEmoji
].join("|"), "g");
function unicodeWords(string) {
  return string.match(reUnicodeWord) || [];
}
var unicodeWords_default = unicodeWords;
function words(string, pattern, guard) {
  string = toString_default(string);
  pattern = guard ? undefined : pattern;
  if (pattern === undefined) {
    return hasUnicodeWord_default(string) ? unicodeWords_default(string) : asciiWords_default(string);
  }
  return string.match(pattern) || [];
}
var words_default = words;
var rsApos2 = "['\u2019]";
var reApos = RegExp(rsApos2, "g");
function createCompounder(callback) {
  return function(string) {
    return arrayReduce_default(words_default(deburr_default(string).replace(reApos, "")), callback, "");
  };
}
var createCompounder_default = createCompounder;
var camelCase = createCompounder_default(function(result, word, index) {
  word = word.toLowerCase();
  return result + (index ? capitalize_default(word) : word);
});
var camelCase_default = camelCase;
function baseClamp(number, lower, upper) {
  if (number === number) {
    if (upper !== undefined) {
      number = number <= upper ? number : upper;
    }
    if (lower !== undefined) {
      number = number >= lower ? number : lower;
    }
  }
  return number;
}
var baseClamp_default = baseClamp;
var reWhitespace = /\s/;
function trimmedEndIndex(string) {
  var index = string.length;
  while (index-- && reWhitespace.test(string.charAt(index))) {}
  return index;
}
var trimmedEndIndex_default = trimmedEndIndex;
var reTrimStart = /^\s+/;
function baseTrim(string) {
  return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
}
var baseTrim_default = baseTrim;
var NAN = 0 / 0;
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
var reIsBinary = /^0b[01]+$/i;
var reIsOctal = /^0o[0-7]+$/i;
var freeParseInt = parseInt;
function toNumber(value) {
  if (typeof value == "number") {
    return value;
  }
  if (isSymbol_default(value)) {
    return NAN;
  }
  if (isObject_default(value)) {
    var other = typeof value.valueOf == "function" ? value.valueOf() : value;
    value = isObject_default(other) ? other + "" : other;
  }
  if (typeof value != "string") {
    return value === 0 ? value : +value;
  }
  value = baseTrim_default(value);
  var isBinary = reIsBinary.test(value);
  return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
}
var toNumber_default = toNumber;
function clamp(number, lower, upper) {
  if (upper === undefined) {
    upper = lower;
    lower = undefined;
  }
  if (upper !== undefined) {
    upper = toNumber_default(upper);
    upper = upper === upper ? upper : 0;
  }
  if (lower !== undefined) {
    lower = toNumber_default(lower);
    lower = lower === lower ? lower : 0;
  }
  return baseClamp_default(toNumber_default(number), lower, upper);
}
var clamp_default = clamp;
var stringTag = "[object String]";
function isString(value) {
  return typeof value == "string" || !isArray_default(value) && isObjectLike_default(value) && baseGetTag_default(value) == stringTag;
}
var isString_default = isString;
var objectProto4 = Object.prototype;
function isPrototype(value) {
  var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto4;
  return value === proto;
}
var isPrototype_default = isPrototype;
var nativeKeys = overArg_default(Object.keys, Object);
var nativeKeys_default = nativeKeys;
var objectProto5 = Object.prototype;
var hasOwnProperty3 = objectProto5.hasOwnProperty;
function baseKeys(object) {
  if (!isPrototype_default(object)) {
    return nativeKeys_default(object);
  }
  var result = [];
  for (var key in Object(object)) {
    if (hasOwnProperty3.call(object, key) && key != "constructor") {
      result.push(key);
    }
  }
  return result;
}
var baseKeys_default = baseKeys;
var coreJsData = root_default["__core-js_shared__"];
var coreJsData_default = coreJsData;
var maskSrcKey = function() {
  var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
  return uid ? "Symbol(src)_1." + uid : "";
}();
function isMasked(func) {
  return !!maskSrcKey && maskSrcKey in func;
}
var isMasked_default = isMasked;
var funcProto2 = Function.prototype;
var funcToString2 = funcProto2.toString;
function toSource(func) {
  if (func != null) {
    try {
      return funcToString2.call(func);
    } catch (e) {}
    try {
      return func + "";
    } catch (e) {}
  }
  return "";
}
var toSource_default = toSource;
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor = /^\[object .+?Constructor\]$/;
var funcProto3 = Function.prototype;
var objectProto6 = Object.prototype;
var funcToString3 = funcProto3.toString;
var hasOwnProperty4 = objectProto6.hasOwnProperty;
var reIsNative = RegExp("^" + funcToString3.call(hasOwnProperty4).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
function baseIsNative(value) {
  if (!isObject_default(value) || isMasked_default(value)) {
    return false;
  }
  var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
  return pattern.test(toSource_default(value));
}
var baseIsNative_default = baseIsNative;
function getValue(object, key) {
  return object == null ? undefined : object[key];
}
var getValue_default = getValue;
function getNative(object, key) {
  var value = getValue_default(object, key);
  return baseIsNative_default(value) ? value : undefined;
}
var getNative_default = getNative;
var DataView = getNative_default(root_default, "DataView");
var DataView_default = DataView;
var Map2 = getNative_default(root_default, "Map");
var Map_default = Map2;
var Promise2 = getNative_default(root_default, "Promise");
var Promise_default = Promise2;
var Set2 = getNative_default(root_default, "Set");
var Set_default = Set2;
var WeakMap = getNative_default(root_default, "WeakMap");
var WeakMap_default = WeakMap;
var mapTag = "[object Map]";
var objectTag2 = "[object Object]";
var promiseTag = "[object Promise]";
var setTag = "[object Set]";
var weakMapTag = "[object WeakMap]";
var dataViewTag = "[object DataView]";
var dataViewCtorString = toSource_default(DataView_default);
var mapCtorString = toSource_default(Map_default);
var promiseCtorString = toSource_default(Promise_default);
var setCtorString = toSource_default(Set_default);
var weakMapCtorString = toSource_default(WeakMap_default);
var getTag = baseGetTag_default;
if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag || Map_default && getTag(new Map_default) != mapTag || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default) != setTag || WeakMap_default && getTag(new WeakMap_default) != weakMapTag) {
  getTag = function(value) {
    var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : undefined, ctorString = Ctor ? toSource_default(Ctor) : "";
    if (ctorString) {
      switch (ctorString) {
        case dataViewCtorString:
          return dataViewTag;
        case mapCtorString:
          return mapTag;
        case promiseCtorString:
          return promiseTag;
        case setCtorString:
          return setTag;
        case weakMapCtorString:
          return weakMapTag;
      }
    }
    return result;
  };
}
var getTag_default = getTag;
var argsTag = "[object Arguments]";
function baseIsArguments(value) {
  return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
}
var baseIsArguments_default = baseIsArguments;
var objectProto7 = Object.prototype;
var hasOwnProperty5 = objectProto7.hasOwnProperty;
var propertyIsEnumerable = objectProto7.propertyIsEnumerable;
var isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
  return arguments;
}()) ? baseIsArguments_default : function(value) {
  return isObjectLike_default(value) && hasOwnProperty5.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
};
var isArguments_default = isArguments;
var MAX_SAFE_INTEGER = 9007199254740991;
function isLength(value) {
  return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
var isLength_default = isLength;
function isArrayLike(value) {
  return value != null && isLength_default(value.length) && !isFunction_default(value);
}
var isArrayLike_default = isArrayLike;
function stubFalse() {
  return false;
}
var stubFalse_default = stubFalse;
var freeExports = typeof exports_chunk_5XC6ZMS5 == "object" && exports_chunk_5XC6ZMS5 && !exports_chunk_5XC6ZMS5.nodeType && exports_chunk_5XC6ZMS5;
var freeModule = freeExports && typeof module_chunk_5XC6ZMS5 == "object" && module_chunk_5XC6ZMS5 && !module_chunk_5XC6ZMS5.nodeType && module_chunk_5XC6ZMS5;
var moduleExports = freeModule && freeModule.exports === freeExports;
var Buffer2 = moduleExports ? root_default.Buffer : undefined;
var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined;
var isBuffer = nativeIsBuffer || stubFalse_default;
var isBuffer_default = isBuffer;
var argsTag2 = "[object Arguments]";
var arrayTag = "[object Array]";
var boolTag = "[object Boolean]";
var dateTag = "[object Date]";
var errorTag = "[object Error]";
var funcTag2 = "[object Function]";
var mapTag2 = "[object Map]";
var numberTag = "[object Number]";
var objectTag3 = "[object Object]";
var regexpTag = "[object RegExp]";
var setTag2 = "[object Set]";
var stringTag2 = "[object String]";
var weakMapTag2 = "[object WeakMap]";
var arrayBufferTag = "[object ArrayBuffer]";
var dataViewTag2 = "[object DataView]";
var float32Tag = "[object Float32Array]";
var float64Tag = "[object Float64Array]";
var int8Tag = "[object Int8Array]";
var int16Tag = "[object Int16Array]";
var int32Tag = "[object Int32Array]";
var uint8Tag = "[object Uint8Array]";
var uint8ClampedTag = "[object Uint8ClampedArray]";
var uint16Tag = "[object Uint16Array]";
var uint32Tag = "[object Uint32Array]";
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag2] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag2] = typedArrayTags[numberTag] = typedArrayTags[objectTag3] = typedArrayTags[regexpTag] = typedArrayTags[setTag2] = typedArrayTags[stringTag2] = typedArrayTags[weakMapTag2] = false;
function baseIsTypedArray(value) {
  return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
}
var baseIsTypedArray_default = baseIsTypedArray;
function baseUnary(func) {
  return function(value) {
    return func(value);
  };
}
var baseUnary_default = baseUnary;
var freeExports2 = typeof exports_chunk_5XC6ZMS5 == "object" && exports_chunk_5XC6ZMS5 && !exports_chunk_5XC6ZMS5.nodeType && exports_chunk_5XC6ZMS5;
var freeModule2 = freeExports2 && typeof module_chunk_5XC6ZMS5 == "object" && module_chunk_5XC6ZMS5 && !module_chunk_5XC6ZMS5.nodeType && module_chunk_5XC6ZMS5;
var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
var freeProcess = moduleExports2 && freeGlobal_default.process;
var nodeUtil = function() {
  try {
    var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
    if (types) {
      return types;
    }
    return freeProcess && freeProcess.binding && freeProcess.binding("util");
  } catch (e) {}
}();
var nodeUtil_default = nodeUtil;
var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
var isTypedArray_default = isTypedArray;
var mapTag3 = "[object Map]";
var setTag3 = "[object Set]";
var objectProto8 = Object.prototype;
var hasOwnProperty6 = objectProto8.hasOwnProperty;
function isEmpty(value) {
  if (value == null) {
    return true;
  }
  if (isArrayLike_default(value) && (isArray_default(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer_default(value) || isTypedArray_default(value) || isArguments_default(value))) {
    return !value.length;
  }
  var tag = getTag_default(value);
  if (tag == mapTag3 || tag == setTag3) {
    return !value.size;
  }
  if (isPrototype_default(value)) {
    return !baseKeys_default(value).length;
  }
  for (var key in value) {
    if (hasOwnProperty6.call(value, key)) {
      return false;
    }
  }
  return true;
}
var isEmpty_default = isEmpty;
function listCacheClear() {
  this.__data__ = [];
  this.size = 0;
}
var listCacheClear_default = listCacheClear;
function eq(value, other) {
  return value === other || value !== value && other !== other;
}
var eq_default = eq;
function assocIndexOf(array, key) {
  var length = array.length;
  while (length--) {
    if (eq_default(array[length][0], key)) {
      return length;
    }
  }
  return -1;
}
var assocIndexOf_default = assocIndexOf;
var arrayProto = Array.prototype;
var splice = arrayProto.splice;
function listCacheDelete(key) {
  var data = this.__data__, index = assocIndexOf_default(data, key);
  if (index < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index == lastIndex) {
    data.pop();
  } else {
    splice.call(data, index, 1);
  }
  --this.size;
  return true;
}
var listCacheDelete_default = listCacheDelete;
function listCacheGet(key) {
  var data = this.__data__, index = assocIndexOf_default(data, key);
  return index < 0 ? undefined : data[index][1];
}
var listCacheGet_default = listCacheGet;
function listCacheHas(key) {
  return assocIndexOf_default(this.__data__, key) > -1;
}
var listCacheHas_default = listCacheHas;
function listCacheSet(key, value) {
  var data = this.__data__, index = assocIndexOf_default(data, key);
  if (index < 0) {
    ++this.size;
    data.push([key, value]);
  } else {
    data[index][1] = value;
  }
  return this;
}
var listCacheSet_default = listCacheSet;
function ListCache(entries) {
  var index = -1, length = entries == null ? 0 : entries.length;
  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}
ListCache.prototype.clear = listCacheClear_default;
ListCache.prototype["delete"] = listCacheDelete_default;
ListCache.prototype.get = listCacheGet_default;
ListCache.prototype.has = listCacheHas_default;
ListCache.prototype.set = listCacheSet_default;
var ListCache_default = ListCache;
function stackClear() {
  this.__data__ = new ListCache_default;
  this.size = 0;
}
var stackClear_default = stackClear;
function stackDelete(key) {
  var data = this.__data__, result = data["delete"](key);
  this.size = data.size;
  return result;
}
var stackDelete_default = stackDelete;
function stackGet(key) {
  return this.__data__.get(key);
}
var stackGet_default = stackGet;
function stackHas(key) {
  return this.__data__.has(key);
}
var stackHas_default = stackHas;
var nativeCreate = getNative_default(Object, "create");
var nativeCreate_default = nativeCreate;
function hashClear() {
  this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
  this.size = 0;
}
var hashClear_default = hashClear;
function hashDelete(key) {
  var result = this.has(key) && delete this.__data__[key];
  this.size -= result ? 1 : 0;
  return result;
}
var hashDelete_default = hashDelete;
var HASH_UNDEFINED = "__lodash_hash_undefined__";
var objectProto9 = Object.prototype;
var hasOwnProperty7 = objectProto9.hasOwnProperty;
function hashGet(key) {
  var data = this.__data__;
  if (nativeCreate_default) {
    var result = data[key];
    return result === HASH_UNDEFINED ? undefined : result;
  }
  return hasOwnProperty7.call(data, key) ? data[key] : undefined;
}
var hashGet_default = hashGet;
var objectProto10 = Object.prototype;
var hasOwnProperty8 = objectProto10.hasOwnProperty;
function hashHas(key) {
  var data = this.__data__;
  return nativeCreate_default ? data[key] !== undefined : hasOwnProperty8.call(data, key);
}
var hashHas_default = hashHas;
var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
function hashSet(key, value) {
  var data = this.__data__;
  this.size += this.has(key) ? 0 : 1;
  data[key] = nativeCreate_default && value === undefined ? HASH_UNDEFINED2 : value;
  return this;
}
var hashSet_default = hashSet;
function Hash(entries) {
  var index = -1, length = entries == null ? 0 : entries.length;
  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}
Hash.prototype.clear = hashClear_default;
Hash.prototype["delete"] = hashDelete_default;
Hash.prototype.get = hashGet_default;
Hash.prototype.has = hashHas_default;
Hash.prototype.set = hashSet_default;
var Hash_default = Hash;
function mapCacheClear() {
  this.size = 0;
  this.__data__ = {
    hash: new Hash_default,
    map: new (Map_default || ListCache_default),
    string: new Hash_default
  };
}
var mapCacheClear_default = mapCacheClear;
function isKeyable(value) {
  var type = typeof value;
  return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
}
var isKeyable_default = isKeyable;
function getMapData(map2, key) {
  var data = map2.__data__;
  return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
var getMapData_default = getMapData;
function mapCacheDelete(key) {
  var result = getMapData_default(this, key)["delete"](key);
  this.size -= result ? 1 : 0;
  return result;
}
var mapCacheDelete_default = mapCacheDelete;
function mapCacheGet(key) {
  return getMapData_default(this, key).get(key);
}
var mapCacheGet_default = mapCacheGet;
function mapCacheHas(key) {
  return getMapData_default(this, key).has(key);
}
var mapCacheHas_default = mapCacheHas;
function mapCacheSet(key, value) {
  var data = getMapData_default(this, key), size = data.size;
  data.set(key, value);
  this.size += data.size == size ? 0 : 1;
  return this;
}
var mapCacheSet_default = mapCacheSet;
function MapCache(entries) {
  var index = -1, length = entries == null ? 0 : entries.length;
  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}
MapCache.prototype.clear = mapCacheClear_default;
MapCache.prototype["delete"] = mapCacheDelete_default;
MapCache.prototype.get = mapCacheGet_default;
MapCache.prototype.has = mapCacheHas_default;
MapCache.prototype.set = mapCacheSet_default;
var MapCache_default = MapCache;
var LARGE_ARRAY_SIZE = 200;
function stackSet(key, value) {
  var data = this.__data__;
  if (data instanceof ListCache_default) {
    var pairs = data.__data__;
    if (!Map_default || pairs.length < LARGE_ARRAY_SIZE - 1) {
      pairs.push([key, value]);
      this.size = ++data.size;
      return this;
    }
    data = this.__data__ = new MapCache_default(pairs);
  }
  data.set(key, value);
  this.size = data.size;
  return this;
}
var stackSet_default = stackSet;
function Stack(entries) {
  var data = this.__data__ = new ListCache_default(entries);
  this.size = data.size;
}
Stack.prototype.clear = stackClear_default;
Stack.prototype["delete"] = stackDelete_default;
Stack.prototype.get = stackGet_default;
Stack.prototype.has = stackHas_default;
Stack.prototype.set = stackSet_default;
var Stack_default = Stack;
var HASH_UNDEFINED3 = "__lodash_hash_undefined__";
function setCacheAdd(value) {
  this.__data__.set(value, HASH_UNDEFINED3);
  return this;
}
var setCacheAdd_default = setCacheAdd;
function setCacheHas(value) {
  return this.__data__.has(value);
}
var setCacheHas_default = setCacheHas;
function SetCache(values) {
  var index = -1, length = values == null ? 0 : values.length;
  this.__data__ = new MapCache_default;
  while (++index < length) {
    this.add(values[index]);
  }
}
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
SetCache.prototype.has = setCacheHas_default;
var SetCache_default = SetCache;
function arraySome(array, predicate) {
  var index = -1, length = array == null ? 0 : array.length;
  while (++index < length) {
    if (predicate(array[index], index, array)) {
      return true;
    }
  }
  return false;
}
var arraySome_default = arraySome;
function cacheHas(cache, key) {
  return cache.has(key);
}
var cacheHas_default = cacheHas;
var COMPARE_PARTIAL_FLAG = 1;
var COMPARE_UNORDERED_FLAG = 2;
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
  if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
    return false;
  }
  var arrStacked = stack.get(array);
  var othStacked = stack.get(other);
  if (arrStacked && othStacked) {
    return arrStacked == other && othStacked == array;
  }
  var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default : undefined;
  stack.set(array, other);
  stack.set(other, array);
  while (++index < arrLength) {
    var arrValue = array[index], othValue = other[index];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
    }
    if (compared !== undefined) {
      if (compared) {
        continue;
      }
      result = false;
      break;
    }
    if (seen) {
      if (!arraySome_default(other, function(othValue2, othIndex) {
        if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
          return seen.push(othIndex);
        }
      })) {
        result = false;
        break;
      }
    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
      result = false;
      break;
    }
  }
  stack["delete"](array);
  stack["delete"](other);
  return result;
}
var equalArrays_default = equalArrays;
var Uint8Array2 = root_default.Uint8Array;
var Uint8Array_default = Uint8Array2;
function mapToArray(map2) {
  var index = -1, result = Array(map2.size);
  map2.forEach(function(value, key) {
    result[++index] = [key, value];
  });
  return result;
}
var mapToArray_default = mapToArray;
function setToArray(set) {
  var index = -1, result = Array(set.size);
  set.forEach(function(value) {
    result[++index] = value;
  });
  return result;
}
var setToArray_default = setToArray;
var COMPARE_PARTIAL_FLAG2 = 1;
var COMPARE_UNORDERED_FLAG2 = 2;
var boolTag2 = "[object Boolean]";
var dateTag2 = "[object Date]";
var errorTag2 = "[object Error]";
var mapTag4 = "[object Map]";
var numberTag2 = "[object Number]";
var regexpTag2 = "[object RegExp]";
var setTag4 = "[object Set]";
var stringTag3 = "[object String]";
var symbolTag2 = "[object Symbol]";
var arrayBufferTag2 = "[object ArrayBuffer]";
var dataViewTag3 = "[object DataView]";
var symbolProto2 = Symbol_default ? Symbol_default.prototype : undefined;
var symbolValueOf = symbolProto2 ? symbolProto2.valueOf : undefined;
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  switch (tag) {
    case dataViewTag3:
      if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
        return false;
      }
      object = object.buffer;
      other = other.buffer;
    case arrayBufferTag2:
      if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
        return false;
      }
      return true;
    case boolTag2:
    case dateTag2:
    case numberTag2:
      return eq_default(+object, +other);
    case errorTag2:
      return object.name == other.name && object.message == other.message;
    case regexpTag2:
    case stringTag3:
      return object == other + "";
    case mapTag4:
      var convert = mapToArray_default;
    case setTag4:
      var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
      convert || (convert = setToArray_default);
      if (object.size != other.size && !isPartial) {
        return false;
      }
      var stacked = stack.get(object);
      if (stacked) {
        return stacked == other;
      }
      bitmask |= COMPARE_UNORDERED_FLAG2;
      stack.set(object, other);
      var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
      stack["delete"](object);
      return result;
    case symbolTag2:
      if (symbolValueOf) {
        return symbolValueOf.call(object) == symbolValueOf.call(other);
      }
  }
  return false;
}
var equalByTag_default = equalByTag;
function arrayPush(array, values) {
  var index = -1, length = values.length, offset = array.length;
  while (++index < length) {
    array[offset + index] = values[index];
  }
  return array;
}
var arrayPush_default = arrayPush;
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  var result = keysFunc(object);
  return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
}
var baseGetAllKeys_default = baseGetAllKeys;
function arrayFilter(array, predicate) {
  var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  while (++index < length) {
    var value = array[index];
    if (predicate(value, index, array)) {
      result[resIndex++] = value;
    }
  }
  return result;
}
var arrayFilter_default = arrayFilter;
function stubArray() {
  return [];
}
var stubArray_default = stubArray;
var objectProto11 = Object.prototype;
var propertyIsEnumerable2 = objectProto11.propertyIsEnumerable;
var nativeGetSymbols = Object.getOwnPropertySymbols;
var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
  if (object == null) {
    return [];
  }
  object = Object(object);
  return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
    return propertyIsEnumerable2.call(object, symbol);
  });
};
var getSymbols_default = getSymbols;
function baseTimes(n, iteratee) {
  var index = -1, result = Array(n);
  while (++index < n) {
    result[index] = iteratee(index);
  }
  return result;
}
var baseTimes_default = baseTimes;
var MAX_SAFE_INTEGER2 = 9007199254740991;
var reIsUint = /^(?:0|[1-9]\d*)$/;
function isIndex(value, length) {
  var type = typeof value;
  length = length == null ? MAX_SAFE_INTEGER2 : length;
  return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
}
var isIndex_default = isIndex;
var objectProto12 = Object.prototype;
var hasOwnProperty9 = objectProto12.hasOwnProperty;
function arrayLikeKeys(value, inherited) {
  var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length;
  for (var key in value) {
    if ((inherited || hasOwnProperty9.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex_default(key, length)))) {
      result.push(key);
    }
  }
  return result;
}
var arrayLikeKeys_default = arrayLikeKeys;
function keys(object) {
  return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
}
var keys_default = keys;
function getAllKeys(object) {
  return baseGetAllKeys_default(object, keys_default, getSymbols_default);
}
var getAllKeys_default = getAllKeys;
var COMPARE_PARTIAL_FLAG3 = 1;
var objectProto13 = Object.prototype;
var hasOwnProperty10 = objectProto13.hasOwnProperty;
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
  if (objLength != othLength && !isPartial) {
    return false;
  }
  var index = objLength;
  while (index--) {
    var key = objProps[index];
    if (!(isPartial ? key in other : hasOwnProperty10.call(other, key))) {
      return false;
    }
  }
  var objStacked = stack.get(object);
  var othStacked = stack.get(other);
  if (objStacked && othStacked) {
    return objStacked == other && othStacked == object;
  }
  var result = true;
  stack.set(object, other);
  stack.set(other, object);
  var skipCtor = isPartial;
  while (++index < objLength) {
    key = objProps[index];
    var objValue = object[key], othValue = other[key];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
    }
    if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
      result = false;
      break;
    }
    skipCtor || (skipCtor = key == "constructor");
  }
  if (result && !skipCtor) {
    var objCtor = object.constructor, othCtor = other.constructor;
    if (objCtor != othCtor && (("constructor" in object) && ("constructor" in other)) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
      result = false;
    }
  }
  stack["delete"](object);
  stack["delete"](other);
  return result;
}
var equalObjects_default = equalObjects;
var COMPARE_PARTIAL_FLAG4 = 1;
var argsTag3 = "[object Arguments]";
var arrayTag2 = "[object Array]";
var objectTag4 = "[object Object]";
var objectProto14 = Object.prototype;
var hasOwnProperty11 = objectProto14.hasOwnProperty;
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other);
  objTag = objTag == argsTag3 ? objectTag4 : objTag;
  othTag = othTag == argsTag3 ? objectTag4 : othTag;
  var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag;
  if (isSameTag && isBuffer_default(object)) {
    if (!isBuffer_default(other)) {
      return false;
    }
    objIsArr = true;
    objIsObj = false;
  }
  if (isSameTag && !objIsObj) {
    stack || (stack = new Stack_default);
    return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
  }
  if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
    var objIsWrapped = objIsObj && hasOwnProperty11.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty11.call(other, "__wrapped__");
    if (objIsWrapped || othIsWrapped) {
      var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
      stack || (stack = new Stack_default);
      return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
    }
  }
  if (!isSameTag) {
    return false;
  }
  stack || (stack = new Stack_default);
  return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
}
var baseIsEqualDeep_default = baseIsEqualDeep;
function baseIsEqual(value, other, bitmask, customizer, stack) {
  if (value === other) {
    return true;
  }
  if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
    return value !== value && other !== other;
  }
  return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
}
var baseIsEqual_default = baseIsEqual;
function isEqual(value, other) {
  return baseIsEqual_default(value, other);
}
var isEqual_default = isEqual;
var defineProperty = function() {
  try {
    var func = getNative_default(Object, "defineProperty");
    func({}, "", {});
    return func;
  } catch (e) {}
}();
var defineProperty_default = defineProperty;
function baseAssignValue(object, key, value) {
  if (key == "__proto__" && defineProperty_default) {
    defineProperty_default(object, key, {
      configurable: true,
      enumerable: true,
      value,
      writable: true
    });
  } else {
    object[key] = value;
  }
}
var baseAssignValue_default = baseAssignValue;
function createBaseFor(fromRight) {
  return function(object, iteratee, keysFunc) {
    var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
    while (length--) {
      var key = props[fromRight ? length : ++index];
      if (iteratee(iterable[key], key, iterable) === false) {
        break;
      }
    }
    return object;
  };
}
var createBaseFor_default = createBaseFor;
var baseFor = createBaseFor_default();
var baseFor_default = baseFor;
function baseForOwn(object, iteratee) {
  return object && baseFor_default(object, iteratee, keys_default);
}
var baseForOwn_default = baseForOwn;
var COMPARE_PARTIAL_FLAG5 = 1;
var COMPARE_UNORDERED_FLAG3 = 2;
function baseIsMatch(object, source, matchData, customizer) {
  var index = matchData.length, length = index, noCustomizer = !customizer;
  if (object == null) {
    return !length;
  }
  object = Object(object);
  while (index--) {
    var data = matchData[index];
    if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
      return false;
    }
  }
  while (++index < length) {
    data = matchData[index];
    var key = data[0], objValue = object[key], srcValue = data[1];
    if (noCustomizer && data[2]) {
      if (objValue === undefined && !(key in object)) {
        return false;
      }
    } else {
      var stack = new Stack_default;
      if (customizer) {
        var result = customizer(objValue, srcValue, key, object, source, stack);
      }
      if (!(result === undefined ? baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result)) {
        return false;
      }
    }
  }
  return true;
}
var baseIsMatch_default = baseIsMatch;
function isStrictComparable(value) {
  return value === value && !isObject_default(value);
}
var isStrictComparable_default = isStrictComparable;
function getMatchData(object) {
  var result = keys_default(object), length = result.length;
  while (length--) {
    var key = result[length], value = object[key];
    result[length] = [key, value, isStrictComparable_default(value)];
  }
  return result;
}
var getMatchData_default = getMatchData;
function matchesStrictComparable(key, srcValue) {
  return function(object) {
    if (object == null) {
      return false;
    }
    return object[key] === srcValue && (srcValue !== undefined || (key in Object(object)));
  };
}
var matchesStrictComparable_default = matchesStrictComparable;
function baseMatches(source) {
  var matchData = getMatchData_default(source);
  if (matchData.length == 1 && matchData[0][2]) {
    return matchesStrictComparable_default(matchData[0][0], matchData[0][1]);
  }
  return function(object) {
    return object === source || baseIsMatch_default(object, source, matchData);
  };
}
var baseMatches_default = baseMatches;
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
var reIsPlainProp = /^\w*$/;
function isKey(value, object) {
  if (isArray_default(value)) {
    return false;
  }
  var type = typeof value;
  if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol_default(value)) {
    return true;
  }
  return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
}
var isKey_default = isKey;
var FUNC_ERROR_TEXT = "Expected a function";
function memoize(func, resolver) {
  if (typeof func != "function" || resolver != null && typeof resolver != "function") {
    throw new TypeError(FUNC_ERROR_TEXT);
  }
  var memoized = function() {
    var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
    if (cache.has(key)) {
      return cache.get(key);
    }
    var result = func.apply(this, args);
    memoized.cache = cache.set(key, result) || cache;
    return result;
  };
  memoized.cache = new (memoize.Cache || MapCache_default);
  return memoized;
}
memoize.Cache = MapCache_default;
var memoize_default = memoize;
var MAX_MEMOIZE_SIZE = 500;
function memoizeCapped(func) {
  var result = memoize_default(func, function(key) {
    if (cache.size === MAX_MEMOIZE_SIZE) {
      cache.clear();
    }
    return key;
  });
  var cache = result.cache;
  return result;
}
var memoizeCapped_default = memoizeCapped;
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar = /\\(\\)?/g;
var stringToPath = memoizeCapped_default(function(string) {
  var result = [];
  if (string.charCodeAt(0) === 46) {
    result.push("");
  }
  string.replace(rePropName, function(match, number, quote, subString) {
    result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  });
  return result;
});
var stringToPath_default = stringToPath;
function castPath(value, object) {
  if (isArray_default(value)) {
    return value;
  }
  return isKey_default(value, object) ? [value] : stringToPath_default(toString_default(value));
}
var castPath_default = castPath;
var INFINITY2 = 1 / 0;
function toKey(value) {
  if (typeof value == "string" || isSymbol_default(value)) {
    return value;
  }
  var result = value + "";
  return result == "0" && 1 / value == -INFINITY2 ? "-0" : result;
}
var toKey_default = toKey;
function baseGet(object, path) {
  path = castPath_default(path, object);
  var index = 0, length = path.length;
  while (object != null && index < length) {
    object = object[toKey_default(path[index++])];
  }
  return index && index == length ? object : undefined;
}
var baseGet_default = baseGet;
function get(object, path, defaultValue) {
  var result = object == null ? undefined : baseGet_default(object, path);
  return result === undefined ? defaultValue : result;
}
var get_default = get;
function baseHasIn(object, key) {
  return object != null && key in Object(object);
}
var baseHasIn_default = baseHasIn;
function hasPath(object, path, hasFunc) {
  path = castPath_default(path, object);
  var index = -1, length = path.length, result = false;
  while (++index < length) {
    var key = toKey_default(path[index]);
    if (!(result = object != null && hasFunc(object, key))) {
      break;
    }
    object = object[key];
  }
  if (result || ++index != length) {
    return result;
  }
  length = object == null ? 0 : object.length;
  return !!length && isLength_default(length) && isIndex_default(key, length) && (isArray_default(object) || isArguments_default(object));
}
var hasPath_default = hasPath;
function hasIn(object, path) {
  return object != null && hasPath_default(object, path, baseHasIn_default);
}
var hasIn_default = hasIn;
var COMPARE_PARTIAL_FLAG6 = 1;
var COMPARE_UNORDERED_FLAG4 = 2;
function baseMatchesProperty(path, srcValue) {
  if (isKey_default(path) && isStrictComparable_default(srcValue)) {
    return matchesStrictComparable_default(toKey_default(path), srcValue);
  }
  return function(object) {
    var objValue = get_default(object, path);
    return objValue === undefined && objValue === srcValue ? hasIn_default(object, path) : baseIsEqual_default(srcValue, objValue, COMPARE_PARTIAL_FLAG6 | COMPARE_UNORDERED_FLAG4);
  };
}
var baseMatchesProperty_default = baseMatchesProperty;
function identity(value) {
  return value;
}
var identity_default = identity;
function baseProperty(key) {
  return function(object) {
    return object == null ? undefined : object[key];
  };
}
var baseProperty_default = baseProperty;
function basePropertyDeep(path) {
  return function(object) {
    return baseGet_default(object, path);
  };
}
var basePropertyDeep_default = basePropertyDeep;
function property(path) {
  return isKey_default(path) ? baseProperty_default(toKey_default(path)) : basePropertyDeep_default(path);
}
var property_default = property;
function baseIteratee(value) {
  if (typeof value == "function") {
    return value;
  }
  if (value == null) {
    return identity_default;
  }
  if (typeof value == "object") {
    return isArray_default(value) ? baseMatchesProperty_default(value[0], value[1]) : baseMatches_default(value);
  }
  return property_default(value);
}
var baseIteratee_default = baseIteratee;
function mapValues(object, iteratee) {
  var result = {};
  iteratee = baseIteratee_default(iteratee, 3);
  baseForOwn_default(object, function(value, key, object2) {
    baseAssignValue_default(result, key, iteratee(value, key, object2));
  });
  return result;
}
var mapValues_default = mapValues;
function baseExtremum(array, iteratee, comparator) {
  var index = -1, length = array.length;
  while (++index < length) {
    var value = array[index], current = iteratee(value);
    if (current != null && (computed === undefined ? current === current && !isSymbol_default(current) : comparator(current, computed))) {
      var computed = current, result = value;
    }
  }
  return result;
}
var baseExtremum_default = baseExtremum;
function baseGt(value, other) {
  return value > other;
}
var baseGt_default = baseGt;
function maxBy(array, iteratee) {
  return array && array.length ? baseExtremum_default(array, baseIteratee_default(iteratee, 2), baseGt_default) : undefined;
}
var maxBy_default = maxBy;
function arrayEach(array, iteratee) {
  var index = -1, length = array == null ? 0 : array.length;
  while (++index < length) {
    if (iteratee(array[index], index, array) === false) {
      break;
    }
  }
  return array;
}
var arrayEach_default = arrayEach;
var objectProto15 = Object.prototype;
var hasOwnProperty12 = objectProto15.hasOwnProperty;
function assignValue(object, key, value) {
  var objValue = object[key];
  if (!(hasOwnProperty12.call(object, key) && eq_default(objValue, value)) || value === undefined && !(key in object)) {
    baseAssignValue_default(object, key, value);
  }
}
var assignValue_default = assignValue;
function copyObject(source, props, object, customizer) {
  var isNew = !object;
  object || (object = {});
  var index = -1, length = props.length;
  while (++index < length) {
    var key = props[index];
    var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
    if (newValue === undefined) {
      newValue = source[key];
    }
    if (isNew) {
      baseAssignValue_default(object, key, newValue);
    } else {
      assignValue_default(object, key, newValue);
    }
  }
  return object;
}
var copyObject_default = copyObject;
function baseAssign(object, source) {
  return object && copyObject_default(source, keys_default(source), object);
}
var baseAssign_default = baseAssign;
function nativeKeysIn(object) {
  var result = [];
  if (object != null) {
    for (var key in Object(object)) {
      result.push(key);
    }
  }
  return result;
}
var nativeKeysIn_default = nativeKeysIn;
var objectProto16 = Object.prototype;
var hasOwnProperty13 = objectProto16.hasOwnProperty;
function baseKeysIn(object) {
  if (!isObject_default(object)) {
    return nativeKeysIn_default(object);
  }
  var isProto = isPrototype_default(object), result = [];
  for (var key in object) {
    if (!(key == "constructor" && (isProto || !hasOwnProperty13.call(object, key)))) {
      result.push(key);
    }
  }
  return result;
}
var baseKeysIn_default = baseKeysIn;
function keysIn(object) {
  return isArrayLike_default(object) ? arrayLikeKeys_default(object, true) : baseKeysIn_default(object);
}
var keysIn_default = keysIn;
function baseAssignIn(object, source) {
  return object && copyObject_default(source, keysIn_default(source), object);
}
var baseAssignIn_default = baseAssignIn;
var freeExports3 = typeof exports_chunk_5XC6ZMS5 == "object" && exports_chunk_5XC6ZMS5 && !exports_chunk_5XC6ZMS5.nodeType && exports_chunk_5XC6ZMS5;
var freeModule3 = freeExports3 && typeof module_chunk_5XC6ZMS5 == "object" && module_chunk_5XC6ZMS5 && !module_chunk_5XC6ZMS5.nodeType && module_chunk_5XC6ZMS5;
var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
var Buffer3 = moduleExports3 ? root_default.Buffer : undefined;
var allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : undefined;
function cloneBuffer(buffer, isDeep) {
  if (isDeep) {
    return buffer.slice();
  }
  var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  buffer.copy(result);
  return result;
}
var cloneBuffer_default = cloneBuffer;
function copyArray(source, array) {
  var index = -1, length = source.length;
  array || (array = Array(length));
  while (++index < length) {
    array[index] = source[index];
  }
  return array;
}
var copyArray_default = copyArray;
function copySymbols(source, object) {
  return copyObject_default(source, getSymbols_default(source), object);
}
var copySymbols_default = copySymbols;
var nativeGetSymbols2 = Object.getOwnPropertySymbols;
var getSymbolsIn = !nativeGetSymbols2 ? stubArray_default : function(object) {
  var result = [];
  while (object) {
    arrayPush_default(result, getSymbols_default(object));
    object = getPrototype_default(object);
  }
  return result;
};
var getSymbolsIn_default = getSymbolsIn;
function copySymbolsIn(source, object) {
  return copyObject_default(source, getSymbolsIn_default(source), object);
}
var copySymbolsIn_default = copySymbolsIn;
function getAllKeysIn(object) {
  return baseGetAllKeys_default(object, keysIn_default, getSymbolsIn_default);
}
var getAllKeysIn_default = getAllKeysIn;
var objectProto17 = Object.prototype;
var hasOwnProperty14 = objectProto17.hasOwnProperty;
function initCloneArray(array) {
  var length = array.length, result = new array.constructor(length);
  if (length && typeof array[0] == "string" && hasOwnProperty14.call(array, "index")) {
    result.index = array.index;
    result.input = array.input;
  }
  return result;
}
var initCloneArray_default = initCloneArray;
function cloneArrayBuffer(arrayBuffer) {
  var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer));
  return result;
}
var cloneArrayBuffer_default = cloneArrayBuffer;
function cloneDataView(dataView, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer_default(dataView.buffer) : dataView.buffer;
  return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
var cloneDataView_default = cloneDataView;
var reFlags = /\w*$/;
function cloneRegExp(regexp) {
  var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  result.lastIndex = regexp.lastIndex;
  return result;
}
var cloneRegExp_default = cloneRegExp;
var symbolProto3 = Symbol_default ? Symbol_default.prototype : undefined;
var symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : undefined;
function cloneSymbol(symbol) {
  return symbolValueOf2 ? Object(symbolValueOf2.call(symbol)) : {};
}
var cloneSymbol_default = cloneSymbol;
function cloneTypedArray(typedArray, isDeep) {
  var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer;
  return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
var cloneTypedArray_default = cloneTypedArray;
var boolTag3 = "[object Boolean]";
var dateTag3 = "[object Date]";
var mapTag5 = "[object Map]";
var numberTag3 = "[object Number]";
var regexpTag3 = "[object RegExp]";
var setTag5 = "[object Set]";
var stringTag4 = "[object String]";
var symbolTag3 = "[object Symbol]";
var arrayBufferTag3 = "[object ArrayBuffer]";
var dataViewTag4 = "[object DataView]";
var float32Tag2 = "[object Float32Array]";
var float64Tag2 = "[object Float64Array]";
var int8Tag2 = "[object Int8Array]";
var int16Tag2 = "[object Int16Array]";
var int32Tag2 = "[object Int32Array]";
var uint8Tag2 = "[object Uint8Array]";
var uint8ClampedTag2 = "[object Uint8ClampedArray]";
var uint16Tag2 = "[object Uint16Array]";
var uint32Tag2 = "[object Uint32Array]";
function initCloneByTag(object, tag, isDeep) {
  var Ctor = object.constructor;
  switch (tag) {
    case arrayBufferTag3:
      return cloneArrayBuffer_default(object);
    case boolTag3:
    case dateTag3:
      return new Ctor(+object);
    case dataViewTag4:
      return cloneDataView_default(object, isDeep);
    case float32Tag2:
    case float64Tag2:
    case int8Tag2:
    case int16Tag2:
    case int32Tag2:
    case uint8Tag2:
    case uint8ClampedTag2:
    case uint16Tag2:
    case uint32Tag2:
      return cloneTypedArray_default(object, isDeep);
    case mapTag5:
      return new Ctor;
    case numberTag3:
    case stringTag4:
      return new Ctor(object);
    case regexpTag3:
      return cloneRegExp_default(object);
    case setTag5:
      return new Ctor;
    case symbolTag3:
      return cloneSymbol_default(object);
  }
}
var initCloneByTag_default = initCloneByTag;
var objectCreate = Object.create;
var baseCreate = /* @__PURE__ */ function() {
  function object() {}
  return function(proto) {
    if (!isObject_default(proto)) {
      return {};
    }
    if (objectCreate) {
      return objectCreate(proto);
    }
    object.prototype = proto;
    var result = new object;
    object.prototype = undefined;
    return result;
  };
}();
var baseCreate_default = baseCreate;
function initCloneObject(object) {
  return typeof object.constructor == "function" && !isPrototype_default(object) ? baseCreate_default(getPrototype_default(object)) : {};
}
var initCloneObject_default = initCloneObject;
var mapTag6 = "[object Map]";
function baseIsMap(value) {
  return isObjectLike_default(value) && getTag_default(value) == mapTag6;
}
var baseIsMap_default = baseIsMap;
var nodeIsMap = nodeUtil_default && nodeUtil_default.isMap;
var isMap = nodeIsMap ? baseUnary_default(nodeIsMap) : baseIsMap_default;
var isMap_default = isMap;
var setTag6 = "[object Set]";
function baseIsSet(value) {
  return isObjectLike_default(value) && getTag_default(value) == setTag6;
}
var baseIsSet_default = baseIsSet;
var nodeIsSet = nodeUtil_default && nodeUtil_default.isSet;
var isSet = nodeIsSet ? baseUnary_default(nodeIsSet) : baseIsSet_default;
var isSet_default = isSet;
var CLONE_DEEP_FLAG = 1;
var CLONE_FLAT_FLAG = 2;
var CLONE_SYMBOLS_FLAG = 4;
var argsTag4 = "[object Arguments]";
var arrayTag3 = "[object Array]";
var boolTag4 = "[object Boolean]";
var dateTag4 = "[object Date]";
var errorTag3 = "[object Error]";
var funcTag3 = "[object Function]";
var genTag2 = "[object GeneratorFunction]";
var mapTag7 = "[object Map]";
var numberTag4 = "[object Number]";
var objectTag5 = "[object Object]";
var regexpTag4 = "[object RegExp]";
var setTag7 = "[object Set]";
var stringTag5 = "[object String]";
var symbolTag4 = "[object Symbol]";
var weakMapTag3 = "[object WeakMap]";
var arrayBufferTag4 = "[object ArrayBuffer]";
var dataViewTag5 = "[object DataView]";
var float32Tag3 = "[object Float32Array]";
var float64Tag3 = "[object Float64Array]";
var int8Tag3 = "[object Int8Array]";
var int16Tag3 = "[object Int16Array]";
var int32Tag3 = "[object Int32Array]";
var uint8Tag3 = "[object Uint8Array]";
var uint8ClampedTag3 = "[object Uint8ClampedArray]";
var uint16Tag3 = "[object Uint16Array]";
var uint32Tag3 = "[object Uint32Array]";
var cloneableTags = {};
cloneableTags[argsTag4] = cloneableTags[arrayTag3] = cloneableTags[arrayBufferTag4] = cloneableTags[dataViewTag5] = cloneableTags[boolTag4] = cloneableTags[dateTag4] = cloneableTags[float32Tag3] = cloneableTags[float64Tag3] = cloneableTags[int8Tag3] = cloneableTags[int16Tag3] = cloneableTags[int32Tag3] = cloneableTags[mapTag7] = cloneableTags[numberTag4] = cloneableTags[objectTag5] = cloneableTags[regexpTag4] = cloneableTags[setTag7] = cloneableTags[stringTag5] = cloneableTags[symbolTag4] = cloneableTags[uint8Tag3] = cloneableTags[uint8ClampedTag3] = cloneableTags[uint16Tag3] = cloneableTags[uint32Tag3] = true;
cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
function baseClone(value, bitmask, customizer, key, object, stack) {
  var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
  if (customizer) {
    result = object ? customizer(value, key, object, stack) : customizer(value);
  }
  if (result !== undefined) {
    return result;
  }
  if (!isObject_default(value)) {
    return value;
  }
  var isArr = isArray_default(value);
  if (isArr) {
    result = initCloneArray_default(value);
    if (!isDeep) {
      return copyArray_default(value, result);
    }
  } else {
    var tag = getTag_default(value), isFunc = tag == funcTag3 || tag == genTag2;
    if (isBuffer_default(value)) {
      return cloneBuffer_default(value, isDeep);
    }
    if (tag == objectTag5 || tag == argsTag4 || isFunc && !object) {
      result = isFlat || isFunc ? {} : initCloneObject_default(value);
      if (!isDeep) {
        return isFlat ? copySymbolsIn_default(value, baseAssignIn_default(result, value)) : copySymbols_default(value, baseAssign_default(result, value));
      }
    } else {
      if (!cloneableTags[tag]) {
        return object ? value : {};
      }
      result = initCloneByTag_default(value, tag, isDeep);
    }
  }
  stack || (stack = new Stack_default);
  var stacked = stack.get(value);
  if (stacked) {
    return stacked;
  }
  stack.set(value, result);
  if (isSet_default(value)) {
    value.forEach(function(subValue) {
      result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
    });
  } else if (isMap_default(value)) {
    value.forEach(function(subValue, key2) {
      result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
    });
  }
  var keysFunc = isFull ? isFlat ? getAllKeysIn_default : getAllKeys_default : isFlat ? keysIn_default : keys_default;
  var props = isArr ? undefined : keysFunc(value);
  arrayEach_default(props || value, function(subValue, key2) {
    if (props) {
      key2 = subValue;
      subValue = value[key2];
    }
    assignValue_default(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  });
  return result;
}
var baseClone_default = baseClone;
function last(array) {
  var length = array == null ? 0 : array.length;
  return length ? array[length - 1] : undefined;
}
var last_default = last;
function parent(object, path) {
  return path.length < 2 ? object : baseGet_default(object, baseSlice_default(path, 0, -1));
}
var parent_default = parent;
function baseUnset(object, path) {
  path = castPath_default(path, object);
  object = parent_default(object, path);
  return object == null || delete object[toKey_default(last_default(path))];
}
var baseUnset_default = baseUnset;
function customOmitClone(value) {
  return isPlainObject_default(value) ? undefined : value;
}
var customOmitClone_default = customOmitClone;
var spreadableSymbol = Symbol_default ? Symbol_default.isConcatSpreadable : undefined;
function isFlattenable(value) {
  return isArray_default(value) || isArguments_default(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
}
var isFlattenable_default = isFlattenable;
function baseFlatten(array, depth, predicate, isStrict, result) {
  var index = -1, length = array.length;
  predicate || (predicate = isFlattenable_default);
  result || (result = []);
  while (++index < length) {
    var value = array[index];
    if (depth > 0 && predicate(value)) {
      if (depth > 1) {
        baseFlatten(value, depth - 1, predicate, isStrict, result);
      } else {
        arrayPush_default(result, value);
      }
    } else if (!isStrict) {
      result[result.length] = value;
    }
  }
  return result;
}
var baseFlatten_default = baseFlatten;
function flatten(array) {
  var length = array == null ? 0 : array.length;
  return length ? baseFlatten_default(array, 1) : [];
}
var flatten_default = flatten;
function apply(func, thisArg, args) {
  switch (args.length) {
    case 0:
      return func.call(thisArg);
    case 1:
      return func.call(thisArg, args[0]);
    case 2:
      return func.call(thisArg, args[0], args[1]);
    case 3:
      return func.call(thisArg, args[0], args[1], args[2]);
  }
  return func.apply(thisArg, args);
}
var apply_default = apply;
var nativeMax = Math.max;
function overRest(func, start, transform) {
  start = nativeMax(start === undefined ? func.length - 1 : start, 0);
  return function() {
    var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
    while (++index < length) {
      array[index] = args[start + index];
    }
    index = -1;
    var otherArgs = Array(start + 1);
    while (++index < start) {
      otherArgs[index] = args[index];
    }
    otherArgs[start] = transform(array);
    return apply_default(func, this, otherArgs);
  };
}
var overRest_default = overRest;
function constant(value) {
  return function() {
    return value;
  };
}
var constant_default = constant;
var baseSetToString = !defineProperty_default ? identity_default : function(func, string) {
  return defineProperty_default(func, "toString", {
    configurable: true,
    enumerable: false,
    value: constant_default(string),
    writable: true
  });
};
var baseSetToString_default = baseSetToString;
var HOT_COUNT = 800;
var HOT_SPAN = 16;
var nativeNow = Date.now;
function shortOut(func) {
  var count = 0, lastCalled = 0;
  return function() {
    var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
    lastCalled = stamp;
    if (remaining > 0) {
      if (++count >= HOT_COUNT) {
        return arguments[0];
      }
    } else {
      count = 0;
    }
    return func.apply(undefined, arguments);
  };
}
var shortOut_default = shortOut;
var setToString = shortOut_default(baseSetToString_default);
var setToString_default = setToString;
function flatRest(func) {
  return setToString_default(overRest_default(func, undefined, flatten_default), func + "");
}
var flatRest_default = flatRest;
var CLONE_DEEP_FLAG2 = 1;
var CLONE_FLAT_FLAG2 = 2;
var CLONE_SYMBOLS_FLAG2 = 4;
var omit = flatRest_default(function(object, paths) {
  var result = {};
  if (object == null) {
    return result;
  }
  var isDeep = false;
  paths = arrayMap_default(paths, function(path) {
    path = castPath_default(path, object);
    isDeep || (isDeep = path.length > 1);
    return path;
  });
  copyObject_default(object, getAllKeysIn_default(object), result);
  if (isDeep) {
    result = baseClone_default(result, CLONE_DEEP_FLAG2 | CLONE_FLAT_FLAG2 | CLONE_SYMBOLS_FLAG2, customOmitClone_default);
  }
  var length = paths.length;
  while (length--) {
    baseUnset_default(result, paths[length]);
  }
  return result;
});
var omit_default = omit;
function baseSet(object, path, value, customizer) {
  if (!isObject_default(object)) {
    return object;
  }
  path = castPath_default(path, object);
  var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  while (nested != null && ++index < length) {
    var key = toKey_default(path[index]), newValue = value;
    if (key === "__proto__" || key === "constructor" || key === "prototype") {
      return object;
    }
    if (index != lastIndex) {
      var objValue = nested[key];
      newValue = customizer ? customizer(objValue, key, nested) : undefined;
      if (newValue === undefined) {
        newValue = isObject_default(objValue) ? objValue : isIndex_default(path[index + 1]) ? [] : {};
      }
    }
    assignValue_default(nested, key, newValue);
    nested = nested[key];
  }
  return object;
}
var baseSet_default = baseSet;
function basePickBy(object, paths, predicate) {
  var index = -1, length = paths.length, result = {};
  while (++index < length) {
    var path = paths[index], value = baseGet_default(object, path);
    if (predicate(value, path)) {
      baseSet_default(result, castPath_default(path, object), value);
    }
  }
  return result;
}
var basePickBy_default = basePickBy;
function pickBy(object, predicate) {
  if (object == null) {
    return {};
  }
  var props = arrayMap_default(getAllKeysIn_default(object), function(prop) {
    return [prop];
  });
  predicate = baseIteratee_default(predicate);
  return basePickBy_default(object, props, function(value, path) {
    return predicate(value, path[0]);
  });
}
var pickBy_default = pickBy;
var startCase = createCompounder_default(function(result, word, index) {
  return result + (index ? " " : "") + upperFirst_default(word);
});
var startCase_default = startCase;
function baseFindIndex(array, predicate, fromIndex, fromRight) {
  var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  while (fromRight ? index-- : ++index < length) {
    if (predicate(array[index], index, array)) {
      return index;
    }
  }
  return -1;
}
var baseFindIndex_default = baseFindIndex;
function baseIsNaN(value) {
  return value !== value;
}
var baseIsNaN_default = baseIsNaN;
function strictIndexOf(array, value, fromIndex) {
  var index = fromIndex - 1, length = array.length;
  while (++index < length) {
    if (array[index] === value) {
      return index;
    }
  }
  return -1;
}
var strictIndexOf_default = strictIndexOf;
function baseIndexOf(array, value, fromIndex) {
  return value === value ? strictIndexOf_default(array, value, fromIndex) : baseFindIndex_default(array, baseIsNaN_default, fromIndex);
}
var baseIndexOf_default = baseIndexOf;
function arrayIncludes(array, value) {
  var length = array == null ? 0 : array.length;
  return !!length && baseIndexOf_default(array, value, 0) > -1;
}
var arrayIncludes_default = arrayIncludes;
function arrayIncludesWith(array, value, comparator) {
  var index = -1, length = array == null ? 0 : array.length;
  while (++index < length) {
    if (comparator(value, array[index])) {
      return true;
    }
  }
  return false;
}
var arrayIncludesWith_default = arrayIncludesWith;
function noop() {}
var noop_default = noop;
var INFINITY3 = 1 / 0;
var createSet = !(Set_default && 1 / setToArray_default(new Set_default([, -0]))[1] == INFINITY3) ? noop_default : function(values) {
  return new Set_default(values);
};
var createSet_default = createSet;
var LARGE_ARRAY_SIZE2 = 200;
function baseUniq(array, iteratee, comparator) {
  var index = -1, includes = arrayIncludes_default, length = array.length, isCommon = true, result = [], seen = result;
  if (comparator) {
    isCommon = false;
    includes = arrayIncludesWith_default;
  } else if (length >= LARGE_ARRAY_SIZE2) {
    var set = iteratee ? null : createSet_default(array);
    if (set) {
      return setToArray_default(set);
    }
    isCommon = false;
    includes = cacheHas_default;
    seen = new SetCache_default;
  } else {
    seen = iteratee ? [] : result;
  }
  outer:
    while (++index < length) {
      var value = array[index], computed = iteratee ? iteratee(value) : value;
      value = comparator || value !== 0 ? value : 0;
      if (isCommon && computed === computed) {
        var seenIndex = seen.length;
        while (seenIndex--) {
          if (seen[seenIndex] === computed) {
            continue outer;
          }
        }
        if (iteratee) {
          seen.push(computed);
        }
        result.push(value);
      } else if (!includes(seen, computed, comparator)) {
        if (seen !== result) {
          seen.push(computed);
        }
        result.push(value);
      }
    }
  return result;
}
var baseUniq_default = baseUniq;
function uniq(array) {
  return array && array.length ? baseUniq_default(array) : [];
}
var uniq_default = uniq;
var INFINITY4 = 1 / 0;
var MAX_INTEGER = 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;
function toFinite(value) {
  if (!value) {
    return value === 0 ? value : 0;
  }
  value = toNumber_default(value);
  if (value === INFINITY4 || value === -INFINITY4) {
    var sign = value < 0 ? -1 : 1;
    return sign * MAX_INTEGER;
  }
  return value === value ? value : 0;
}
var toFinite_default = toFinite;
function toInteger(value) {
  var result = toFinite_default(value), remainder = result % 1;
  return result === result ? remainder ? result - remainder : result : 0;
}
var toInteger_default = toInteger;
var metaMap = WeakMap_default && new WeakMap_default;
var metaMap_default = metaMap;
function baseLodash() {}
var baseLodash_default = baseLodash;
var MAX_ARRAY_LENGTH = 4294967295;
function LazyWrapper(value) {
  this.__wrapped__ = value;
  this.__actions__ = [];
  this.__dir__ = 1;
  this.__filtered__ = false;
  this.__iteratees__ = [];
  this.__takeCount__ = MAX_ARRAY_LENGTH;
  this.__views__ = [];
}
LazyWrapper.prototype = baseCreate_default(baseLodash_default.prototype);
LazyWrapper.prototype.constructor = LazyWrapper;
var LazyWrapper_default = LazyWrapper;
var getData = !metaMap_default ? noop_default : function(func) {
  return metaMap_default.get(func);
};
var getData_default = getData;
var realNames = {};
var realNames_default = realNames;
var objectProto18 = Object.prototype;
var hasOwnProperty15 = objectProto18.hasOwnProperty;
function getFuncName(func) {
  var result = func.name + "", array = realNames_default[result], length = hasOwnProperty15.call(realNames_default, result) ? array.length : 0;
  while (length--) {
    var data = array[length], otherFunc = data.func;
    if (otherFunc == null || otherFunc == func) {
      return data.name;
    }
  }
  return result;
}
var getFuncName_default = getFuncName;
function LodashWrapper(value, chainAll) {
  this.__wrapped__ = value;
  this.__actions__ = [];
  this.__chain__ = !!chainAll;
  this.__index__ = 0;
  this.__values__ = undefined;
}
LodashWrapper.prototype = baseCreate_default(baseLodash_default.prototype);
LodashWrapper.prototype.constructor = LodashWrapper;
var LodashWrapper_default = LodashWrapper;
function wrapperClone(wrapper) {
  if (wrapper instanceof LazyWrapper_default) {
    return wrapper.clone();
  }
  var result = new LodashWrapper_default(wrapper.__wrapped__, wrapper.__chain__);
  result.__actions__ = copyArray_default(wrapper.__actions__);
  result.__index__ = wrapper.__index__;
  result.__values__ = wrapper.__values__;
  return result;
}
var wrapperClone_default = wrapperClone;
var objectProto19 = Object.prototype;
var hasOwnProperty16 = objectProto19.hasOwnProperty;
function lodash(value) {
  if (isObjectLike_default(value) && !isArray_default(value) && !(value instanceof LazyWrapper_default)) {
    if (value instanceof LodashWrapper_default) {
      return value;
    }
    if (hasOwnProperty16.call(value, "__wrapped__")) {
      return wrapperClone_default(value);
    }
  }
  return new LodashWrapper_default(value);
}
lodash.prototype = baseLodash_default.prototype;
lodash.prototype.constructor = lodash;
var wrapperLodash_default = lodash;
function isLaziable(func) {
  var funcName = getFuncName_default(func), other = wrapperLodash_default[funcName];
  if (typeof other != "function" || !(funcName in LazyWrapper_default.prototype)) {
    return false;
  }
  if (func === other) {
    return true;
  }
  var data = getData_default(other);
  return !!data && func === data[0];
}
var isLaziable_default = isLaziable;
var CLONE_DEEP_FLAG3 = 1;
var CLONE_SYMBOLS_FLAG3 = 4;
function cloneDeep(value) {
  return baseClone_default(value, CLONE_DEEP_FLAG3 | CLONE_SYMBOLS_FLAG3);
}
var cloneDeep_default = cloneDeep;
function arrayAggregator(array, setter, iteratee, accumulator) {
  var index = -1, length = array == null ? 0 : array.length;
  while (++index < length) {
    var value = array[index];
    setter(accumulator, value, iteratee(value), array);
  }
  return accumulator;
}
var arrayAggregator_default = arrayAggregator;
function createBaseEach(eachFunc, fromRight) {
  return function(collection, iteratee) {
    if (collection == null) {
      return collection;
    }
    if (!isArrayLike_default(collection)) {
      return eachFunc(collection, iteratee);
    }
    var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
    while (fromRight ? index-- : ++index < length) {
      if (iteratee(iterable[index], index, iterable) === false) {
        break;
      }
    }
    return collection;
  };
}
var createBaseEach_default = createBaseEach;
var baseEach = createBaseEach_default(baseForOwn_default);
var baseEach_default = baseEach;
function baseAggregator(collection, setter, iteratee, accumulator) {
  baseEach_default(collection, function(value, key, collection2) {
    setter(accumulator, value, iteratee(value), collection2);
  });
  return accumulator;
}
var baseAggregator_default = baseAggregator;
function createAggregator(setter, initializer) {
  return function(collection, iteratee) {
    var func = isArray_default(collection) ? arrayAggregator_default : baseAggregator_default, accumulator = initializer ? initializer() : {};
    return func(collection, setter, baseIteratee_default(iteratee, 2), accumulator);
  };
}
var createAggregator_default = createAggregator;
var objectProto20 = Object.prototype;
var hasOwnProperty17 = objectProto20.hasOwnProperty;
var countBy = createAggregator_default(function(result, value, key) {
  if (hasOwnProperty17.call(result, key)) {
    ++result[key];
  } else {
    baseAssignValue_default(result, key, 1);
  }
});
var countBy_default = countBy;
function baseToPairs(object, props) {
  return arrayMap_default(props, function(key) {
    return [key, object[key]];
  });
}
var baseToPairs_default = baseToPairs;
function setToPairs(set) {
  var index = -1, result = Array(set.size);
  set.forEach(function(value) {
    result[++index] = [value, value];
  });
  return result;
}
var setToPairs_default = setToPairs;
var mapTag8 = "[object Map]";
var setTag8 = "[object Set]";
function createToPairs(keysFunc) {
  return function(object) {
    var tag = getTag_default(object);
    if (tag == mapTag8) {
      return mapToArray_default(object);
    }
    if (tag == setTag8) {
      return setToPairs_default(object);
    }
    return baseToPairs_default(object, keysFunc(object));
  };
}
var createToPairs_default = createToPairs;
var toPairs = createToPairs_default(keys_default);
var toPairs_default = toPairs;
function baseFilter(collection, predicate) {
  var result = [];
  baseEach_default(collection, function(value, index, collection2) {
    if (predicate(value, index, collection2)) {
      result.push(value);
    }
  });
  return result;
}
var baseFilter_default = baseFilter;
function filter(collection, predicate) {
  var func = isArray_default(collection) ? arrayFilter_default : baseFilter_default;
  return func(collection, baseIteratee_default(predicate, 3));
}
var filter_default = filter;
function baseMap(collection, iteratee) {
  var index = -1, result = isArrayLike_default(collection) ? Array(collection.length) : [];
  baseEach_default(collection, function(value, key, collection2) {
    result[++index] = iteratee(value, key, collection2);
  });
  return result;
}
var baseMap_default = baseMap;
function map(collection, iteratee) {
  var func = isArray_default(collection) ? arrayMap_default : baseMap_default;
  return func(collection, baseIteratee_default(iteratee, 3));
}
var map_default = map;
var FUNC_ERROR_TEXT2 = "Expected a function";
var WRAP_CURRY_FLAG = 8;
var WRAP_PARTIAL_FLAG = 32;
var WRAP_ARY_FLAG = 128;
var WRAP_REARG_FLAG = 256;
function createFlow(fromRight) {
  return flatRest_default(function(funcs) {
    var length = funcs.length, index = length, prereq = LodashWrapper_default.prototype.thru;
    if (fromRight) {
      funcs.reverse();
    }
    while (index--) {
      var func = funcs[index];
      if (typeof func != "function") {
        throw new TypeError(FUNC_ERROR_TEXT2);
      }
      if (prereq && !wrapper && getFuncName_default(func) == "wrapper") {
        var wrapper = new LodashWrapper_default([], true);
      }
    }
    index = wrapper ? index : length;
    while (++index < length) {
      func = funcs[index];
      var funcName = getFuncName_default(func), data = funcName == "wrapper" ? getData_default(func) : undefined;
      if (data && isLaziable_default(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
        wrapper = wrapper[getFuncName_default(data[0])].apply(wrapper, data[3]);
      } else {
        wrapper = func.length == 1 && isLaziable_default(func) ? wrapper[funcName]() : wrapper.thru(func);
      }
    }
    return function() {
      var args = arguments, value = args[0];
      if (wrapper && args.length == 1 && isArray_default(value)) {
        return wrapper.plant(value).value();
      }
      var index2 = 0, result = length ? funcs[index2].apply(this, args) : value;
      while (++index2 < length) {
        result = funcs[index2].call(this, result);
      }
      return result;
    };
  });
}
var createFlow_default = createFlow;
var flow = createFlow_default();
var flow_default = flow;
function fromPairs(pairs) {
  var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  while (++index < length) {
    var pair = pairs[index];
    result[pair[0]] = pair[1];
  }
  return result;
}
var fromPairs_default = fromPairs;
function isNil(value) {
  return value == null;
}
var isNil_default = isNil;
function mapKeys(object, iteratee) {
  var result = {};
  iteratee = baseIteratee_default(iteratee, 3);
  baseForOwn_default(object, function(value, key, object2) {
    baseAssignValue_default(result, iteratee(value, key, object2), value);
  });
  return result;
}
var mapKeys_default = mapKeys;
function baseSortBy(array, comparer) {
  var length = array.length;
  array.sort(comparer);
  while (length--) {
    array[length] = array[length].value;
  }
  return array;
}
var baseSortBy_default = baseSortBy;
function compareAscending(value, other) {
  if (value !== other) {
    var valIsDefined = value !== undefined, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol_default(value);
    var othIsDefined = other !== undefined, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol_default(other);
    if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
      return 1;
    }
    if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
      return -1;
    }
  }
  return 0;
}
var compareAscending_default = compareAscending;
function compareMultiple(object, other, orders) {
  var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
  while (++index < length) {
    var result = compareAscending_default(objCriteria[index], othCriteria[index]);
    if (result) {
      if (index >= ordersLength) {
        return result;
      }
      var order = orders[index];
      return result * (order == "desc" ? -1 : 1);
    }
  }
  return object.index - other.index;
}
var compareMultiple_default = compareMultiple;
function baseOrderBy(collection, iteratees, orders) {
  if (iteratees.length) {
    iteratees = arrayMap_default(iteratees, function(iteratee) {
      if (isArray_default(iteratee)) {
        return function(value) {
          return baseGet_default(value, iteratee.length === 1 ? iteratee[0] : iteratee);
        };
      }
      return iteratee;
    });
  } else {
    iteratees = [identity_default];
  }
  var index = -1;
  iteratees = arrayMap_default(iteratees, baseUnary_default(baseIteratee_default));
  var result = baseMap_default(collection, function(value, key, collection2) {
    var criteria = arrayMap_default(iteratees, function(iteratee) {
      return iteratee(value);
    });
    return { criteria, index: ++index, value };
  });
  return baseSortBy_default(result, function(object, other) {
    return compareMultiple_default(object, other, orders);
  });
}
var baseOrderBy_default = baseOrderBy;
function orderBy(collection, iteratees, orders, guard) {
  if (collection == null) {
    return [];
  }
  if (!isArray_default(iteratees)) {
    iteratees = iteratees == null ? [] : [iteratees];
  }
  orders = guard ? undefined : orders;
  if (!isArray_default(orders)) {
    orders = orders == null ? [] : [orders];
  }
  return baseOrderBy_default(collection, iteratees, orders);
}
var orderBy_default = orderBy;
function take(array, n, guard) {
  if (!(array && array.length)) {
    return [];
  }
  n = guard || n === undefined ? 1 : toInteger_default(n);
  return baseSlice_default(array, 0, n < 0 ? 0 : n);
}
var take_default = take;
function uniqWith(array, comparator) {
  comparator = typeof comparator == "function" ? comparator : undefined;
  return array && array.length ? baseUniq_default(array, undefined, comparator) : [];
}
var uniqWith_default = uniqWith;
/*! Bundled license information:

lodash-es/lodash.js:
  (**
   * @license
   * Lodash (Custom Build) <https://lodash.com/>
   * Build: `lodash modularize exports="es" -o ./`
   * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
   * Released under MIT license <https://lodash.com/license>
   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
   *)
*/

// ../../node_modules/.bun/@bpinternal+zui@2.3.0/node_modules/@bpinternal/zui/dist/index.js
var exports_dist = {};
__export(exports_dist, {
  zuiKey: () => zuiKey,
  z: () => exports_exports,
  void: () => voidType,
  upstream: () => upstreamType,
  unknown: () => unknownType,
  union: () => unionType,
  undefined: () => undefinedType,
  tuple: () => tupleType,
  transforms: () => transforms_exports,
  symbol: () => symbolType,
  string: () => stringType,
  strictObject: () => strictObjectType,
  set: () => setType,
  ref: () => refType,
  record: () => recordType,
  readonly: () => readonlyType,
  promise: () => promiseType,
  preprocess: () => preprocessType,
  pipeline: () => pipelineType,
  optional: () => optionalType,
  object: () => objectType,
  number: () => numberType,
  nullable: () => nullableType,
  null: () => nullType,
  never: () => neverType,
  nativeEnum: () => nativeEnumType,
  nan: () => nanType,
  map: () => mapType,
  literal: () => literalType,
  lazy: () => lazyType,
  is: () => is,
  intersection: () => intersectionType,
  instanceof: () => instanceOfType,
  function: () => functionType,
  enum: () => enumType,
  downstream: () => downstreamType,
  discriminatedUnion: () => discriminatedUnionType,
  default: () => src_default,
  date: () => dateType,
  custom: () => customType,
  coerce: () => coerce,
  catch: () => catchType,
  branded: () => brandedType,
  boolean: () => booleanType,
  bigint: () => bigIntType,
  array: () => arrayType,
  any: () => anyType,
  OK: () => OK,
  ERR: () => ERR,
  DIRTY: () => DIRTY
});
var __defProp2 = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => (key in obj) ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp2.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __name = (target, value) => __defProp2(target, "name", { value, configurable: true });
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
var __export2 = (target, all) => {
  for (var name in all)
    __defProp2(target, name, { get: all[name], enumerable: true });
};
var exports_exports = {};
__export2(exports_exports, {
  DIRTY: () => DIRTY,
  ERR: () => ERR,
  OK: () => OK,
  any: () => anyType,
  array: () => arrayType,
  bigint: () => bigIntType,
  boolean: () => booleanType,
  branded: () => brandedType,
  catch: () => catchType,
  coerce: () => coerce,
  custom: () => customType,
  date: () => dateType,
  default: () => defaultType,
  discriminatedUnion: () => discriminatedUnionType,
  downstream: () => downstreamType,
  enum: () => enumType,
  function: () => functionType,
  instanceof: () => instanceOfType,
  intersection: () => intersectionType,
  is: () => is,
  lazy: () => lazyType,
  literal: () => literalType,
  map: () => mapType,
  nan: () => nanType,
  nativeEnum: () => nativeEnumType,
  never: () => neverType,
  null: () => nullType,
  nullable: () => nullableType,
  number: () => numberType,
  object: () => objectType,
  optional: () => optionalType,
  pipeline: () => pipelineType,
  preprocess: () => preprocessType,
  promise: () => promiseType,
  readonly: () => readonlyType,
  record: () => recordType,
  ref: () => refType,
  set: () => setType,
  strictObject: () => strictObjectType,
  string: () => stringType,
  symbol: () => symbolType,
  transforms: () => transforms_exports,
  tuple: () => tupleType,
  undefined: () => undefinedType,
  union: () => unionType,
  unknown: () => unknownType,
  upstream: () => upstreamType,
  void: () => voidType,
  zuiKey: () => zuiKey
});
var transforms_exports = {};
__export2(transforms_exports, {
  errors: () => errors_exports,
  fromJSONSchema: () => fromJSONSchema,
  fromJSONSchemaLegacy: () => fromJSONSchemaLegacy,
  fromObject: () => fromObject,
  json: () => json_schema_exports,
  toJSONSchema: () => toJSONSchema,
  toJSONSchemaLegacy: () => toJSONSchemaLegacy,
  toTypescriptSchema: () => toTypescriptSchema,
  toTypescriptType: () => toTypescriptType
});
var z_exports = {};
__export2(z_exports, {
  DIRTY: () => DIRTY,
  ERR: () => ERR,
  OK: () => OK,
  any: () => anyType,
  array: () => arrayType,
  bigint: () => bigIntType,
  boolean: () => booleanType,
  branded: () => brandedType,
  catch: () => catchType,
  coerce: () => coerce,
  custom: () => customType,
  date: () => dateType,
  default: () => defaultType,
  discriminatedUnion: () => discriminatedUnionType,
  downstream: () => downstreamType,
  enum: () => enumType,
  function: () => functionType,
  instanceof: () => instanceOfType,
  intersection: () => intersectionType,
  is: () => is,
  lazy: () => lazyType,
  literal: () => literalType,
  map: () => mapType,
  nan: () => nanType,
  nativeEnum: () => nativeEnumType,
  never: () => neverType,
  null: () => nullType,
  nullable: () => nullableType,
  number: () => numberType,
  object: () => objectType,
  optional: () => optionalType,
  pipeline: () => pipelineType,
  preprocess: () => preprocessType,
  promise: () => promiseType,
  readonly: () => readonlyType,
  record: () => recordType,
  ref: () => refType,
  set: () => setType,
  strictObject: () => strictObjectType,
  string: () => stringType,
  symbol: () => symbolType,
  tuple: () => tupleType,
  undefined: () => undefinedType,
  union: () => unionType,
  unknown: () => unknownType,
  upstream: () => upstreamType,
  void: () => voidType,
  zuiKey: () => zuiKey
});
var zuiKey = "x-zui";
var ds_utils_exports = {};
__export2(ds_utils_exports, {
  CustomSet: () => CustomSet
});
var fn_utils_exports = {};
__export2(fn_utils_exports, {
  isEqual: () => isEqual22,
  unique: () => unique
});
var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
var freeGlobal_default2 = freeGlobal2;
var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
var root2 = freeGlobal_default2 || freeSelf2 || Function("return this")();
var root_default2 = root2;
var Symbol22 = root_default2.Symbol;
var Symbol_default2 = Symbol22;
var objectProto21 = Object.prototype;
var hasOwnProperty18 = objectProto21.hasOwnProperty;
var nativeObjectToString3 = objectProto21.toString;
var symToStringTag3 = Symbol_default2 ? Symbol_default2.toStringTag : undefined;
function getRawTag2(value) {
  var isOwn = hasOwnProperty18.call(value, symToStringTag3), tag = value[symToStringTag3];
  try {
    value[symToStringTag3] = undefined;
    var unmasked = true;
  } catch (e) {}
  var result = nativeObjectToString3.call(value);
  if (unmasked) {
    if (isOwn) {
      value[symToStringTag3] = tag;
    } else {
      delete value[symToStringTag3];
    }
  }
  return result;
}
__name(getRawTag2, "getRawTag");
var getRawTag_default2 = getRawTag2;
var objectProto22 = Object.prototype;
var nativeObjectToString22 = objectProto22.toString;
function objectToString2(value) {
  return nativeObjectToString22.call(value);
}
__name(objectToString2, "objectToString");
var objectToString_default2 = objectToString2;
var nullTag2 = "[object Null]";
var undefinedTag2 = "[object Undefined]";
var symToStringTag22 = Symbol_default2 ? Symbol_default2.toStringTag : undefined;
function baseGetTag2(value) {
  if (value == null) {
    return value === undefined ? undefinedTag2 : nullTag2;
  }
  return symToStringTag22 && symToStringTag22 in Object(value) ? getRawTag_default2(value) : objectToString_default2(value);
}
__name(baseGetTag2, "baseGetTag");
var baseGetTag_default2 = baseGetTag2;
function isObjectLike2(value) {
  return value != null && typeof value == "object";
}
__name(isObjectLike2, "isObjectLike");
var isObjectLike_default2 = isObjectLike2;
var symbolTag5 = "[object Symbol]";
function isSymbol2(value) {
  return typeof value == "symbol" || isObjectLike_default2(value) && baseGetTag_default2(value) == symbolTag5;
}
__name(isSymbol2, "isSymbol");
var isSymbol_default2 = isSymbol2;
function arrayMap2(array, iteratee) {
  var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  while (++index < length) {
    result[index] = iteratee(array[index], index, array);
  }
  return result;
}
__name(arrayMap2, "arrayMap");
var arrayMap_default2 = arrayMap2;
var isArray2 = Array.isArray;
var isArray_default2 = isArray2;
var INFINITY5 = 1 / 0;
var symbolProto4 = Symbol_default2 ? Symbol_default2.prototype : undefined;
var symbolToString2 = symbolProto4 ? symbolProto4.toString : undefined;
function baseToString2(value) {
  if (typeof value == "string") {
    return value;
  }
  if (isArray_default2(value)) {
    return arrayMap_default2(value, baseToString2) + "";
  }
  if (isSymbol_default2(value)) {
    return symbolToString2 ? symbolToString2.call(value) : "";
  }
  var result = value + "";
  return result == "0" && 1 / value == -INFINITY5 ? "-0" : result;
}
__name(baseToString2, "baseToString");
var baseToString_default2 = baseToString2;
function isObject2(value) {
  var type = typeof value;
  return value != null && (type == "object" || type == "function");
}
__name(isObject2, "isObject");
var isObject_default2 = isObject2;
function identity2(value) {
  return value;
}
__name(identity2, "identity");
var identity_default2 = identity2;
var asyncTag2 = "[object AsyncFunction]";
var funcTag4 = "[object Function]";
var genTag3 = "[object GeneratorFunction]";
var proxyTag2 = "[object Proxy]";
function isFunction2(value) {
  if (!isObject_default2(value)) {
    return false;
  }
  var tag = baseGetTag_default2(value);
  return tag == funcTag4 || tag == genTag3 || tag == asyncTag2 || tag == proxyTag2;
}
__name(isFunction2, "isFunction");
var isFunction_default2 = isFunction2;
var coreJsData2 = root_default2["__core-js_shared__"];
var coreJsData_default2 = coreJsData2;
var maskSrcKey2 = function() {
  var uid = /[^.]+$/.exec(coreJsData_default2 && coreJsData_default2.keys && coreJsData_default2.keys.IE_PROTO || "");
  return uid ? "Symbol(src)_1." + uid : "";
}();
function isMasked2(func) {
  return !!maskSrcKey2 && maskSrcKey2 in func;
}
__name(isMasked2, "isMasked");
var isMasked_default2 = isMasked2;
var funcProto4 = Function.prototype;
var funcToString4 = funcProto4.toString;
function toSource2(func) {
  if (func != null) {
    try {
      return funcToString4.call(func);
    } catch (e) {}
    try {
      return func + "";
    } catch (e) {}
  }
  return "";
}
__name(toSource2, "toSource");
var toSource_default2 = toSource2;
var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g;
var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
var funcProto22 = Function.prototype;
var objectProto32 = Object.prototype;
var funcToString22 = funcProto22.toString;
var hasOwnProperty22 = objectProto32.hasOwnProperty;
var reIsNative2 = RegExp("^" + funcToString22.call(hasOwnProperty22).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
function baseIsNative2(value) {
  if (!isObject_default2(value) || isMasked_default2(value)) {
    return false;
  }
  var pattern = isFunction_default2(value) ? reIsNative2 : reIsHostCtor2;
  return pattern.test(toSource_default2(value));
}
__name(baseIsNative2, "baseIsNative");
var baseIsNative_default2 = baseIsNative2;
function getValue2(object, key) {
  return object == null ? undefined : object[key];
}
__name(getValue2, "getValue");
var getValue_default2 = getValue2;
function getNative2(object, key) {
  var value = getValue_default2(object, key);
  return baseIsNative_default2(value) ? value : undefined;
}
__name(getNative2, "getNative");
var getNative_default2 = getNative2;
var WeakMap2 = getNative_default2(root_default2, "WeakMap");
var WeakMap_default2 = WeakMap2;
var defineProperty2 = function() {
  try {
    var func = getNative_default2(Object, "defineProperty");
    func({}, "", {});
    return func;
  } catch (e) {}
}();
var defineProperty_default2 = defineProperty2;
var MAX_SAFE_INTEGER3 = 9007199254740991;
var reIsUint2 = /^(?:0|[1-9]\d*)$/;
function isIndex2(value, length) {
  var type = typeof value;
  length = length == null ? MAX_SAFE_INTEGER3 : length;
  return !!length && (type == "number" || type != "symbol" && reIsUint2.test(value)) && (value > -1 && value % 1 == 0 && value < length);
}
__name(isIndex2, "isIndex");
var isIndex_default2 = isIndex2;
function baseAssignValue2(object, key, value) {
  if (key == "__proto__" && defineProperty_default2) {
    defineProperty_default2(object, key, {
      configurable: true,
      enumerable: true,
      value,
      writable: true
    });
  } else {
    object[key] = value;
  }
}
__name(baseAssignValue2, "baseAssignValue");
var baseAssignValue_default2 = baseAssignValue2;
function eq2(value, other) {
  return value === other || value !== value && other !== other;
}
__name(eq2, "eq");
var eq_default2 = eq2;
var objectProto42 = Object.prototype;
var hasOwnProperty32 = objectProto42.hasOwnProperty;
function assignValue2(object, key, value) {
  var objValue = object[key];
  if (!(hasOwnProperty32.call(object, key) && eq_default2(objValue, value)) || value === undefined && !(key in object)) {
    baseAssignValue_default2(object, key, value);
  }
}
__name(assignValue2, "assignValue");
var assignValue_default2 = assignValue2;
var MAX_SAFE_INTEGER22 = 9007199254740991;
function isLength2(value) {
  return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER22;
}
__name(isLength2, "isLength");
var isLength_default2 = isLength2;
function isArrayLike2(value) {
  return value != null && isLength_default2(value.length) && !isFunction_default2(value);
}
__name(isArrayLike2, "isArrayLike");
var isArrayLike_default2 = isArrayLike2;
var objectProto52 = Object.prototype;
function isPrototype2(value) {
  var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto52;
  return value === proto;
}
__name(isPrototype2, "isPrototype");
var isPrototype_default2 = isPrototype2;
function baseTimes2(n, iteratee) {
  var index = -1, result = Array(n);
  while (++index < n) {
    result[index] = iteratee(index);
  }
  return result;
}
__name(baseTimes2, "baseTimes");
var baseTimes_default2 = baseTimes2;
var argsTag5 = "[object Arguments]";
function baseIsArguments2(value) {
  return isObjectLike_default2(value) && baseGetTag_default2(value) == argsTag5;
}
__name(baseIsArguments2, "baseIsArguments");
var baseIsArguments_default2 = baseIsArguments2;
var objectProto62 = Object.prototype;
var hasOwnProperty42 = objectProto62.hasOwnProperty;
var propertyIsEnumerable3 = objectProto62.propertyIsEnumerable;
var isArguments2 = baseIsArguments_default2(/* @__PURE__ */ function() {
  return arguments;
}()) ? baseIsArguments_default2 : function(value) {
  return isObjectLike_default2(value) && hasOwnProperty42.call(value, "callee") && !propertyIsEnumerable3.call(value, "callee");
};
var isArguments_default2 = isArguments2;
function stubFalse2() {
  return false;
}
__name(stubFalse2, "stubFalse");
var stubFalse_default2 = stubFalse2;
var freeExports4 = typeof exports_dist == "object" && exports_dist && !exports_dist.nodeType && exports_dist;
var freeModule4 = freeExports4 && typeof module_dist == "object" && module_dist && !module_dist.nodeType && module_dist;
var moduleExports4 = freeModule4 && freeModule4.exports === freeExports4;
var Buffer22 = moduleExports4 ? root_default2.Buffer : undefined;
var nativeIsBuffer2 = Buffer22 ? Buffer22.isBuffer : undefined;
var isBuffer2 = nativeIsBuffer2 || stubFalse_default2;
var isBuffer_default2 = isBuffer2;
var argsTag22 = "[object Arguments]";
var arrayTag4 = "[object Array]";
var boolTag5 = "[object Boolean]";
var dateTag5 = "[object Date]";
var errorTag4 = "[object Error]";
var funcTag22 = "[object Function]";
var mapTag9 = "[object Map]";
var numberTag5 = "[object Number]";
var objectTag6 = "[object Object]";
var regexpTag5 = "[object RegExp]";
var setTag9 = "[object Set]";
var stringTag6 = "[object String]";
var weakMapTag4 = "[object WeakMap]";
var arrayBufferTag5 = "[object ArrayBuffer]";
var dataViewTag6 = "[object DataView]";
var float32Tag4 = "[object Float32Array]";
var float64Tag4 = "[object Float64Array]";
var int8Tag4 = "[object Int8Array]";
var int16Tag4 = "[object Int16Array]";
var int32Tag4 = "[object Int32Array]";
var uint8Tag4 = "[object Uint8Array]";
var uint8ClampedTag4 = "[object Uint8ClampedArray]";
var uint16Tag4 = "[object Uint16Array]";
var uint32Tag4 = "[object Uint32Array]";
var typedArrayTags2 = {};
typedArrayTags2[float32Tag4] = typedArrayTags2[float64Tag4] = typedArrayTags2[int8Tag4] = typedArrayTags2[int16Tag4] = typedArrayTags2[int32Tag4] = typedArrayTags2[uint8Tag4] = typedArrayTags2[uint8ClampedTag4] = typedArrayTags2[uint16Tag4] = typedArrayTags2[uint32Tag4] = true;
typedArrayTags2[argsTag22] = typedArrayTags2[arrayTag4] = typedArrayTags2[arrayBufferTag5] = typedArrayTags2[boolTag5] = typedArrayTags2[dataViewTag6] = typedArrayTags2[dateTag5] = typedArrayTags2[errorTag4] = typedArrayTags2[funcTag22] = typedArrayTags2[mapTag9] = typedArrayTags2[numberTag5] = typedArrayTags2[objectTag6] = typedArrayTags2[regexpTag5] = typedArrayTags2[setTag9] = typedArrayTags2[stringTag6] = typedArrayTags2[weakMapTag4] = false;
function baseIsTypedArray2(value) {
  return isObjectLike_default2(value) && isLength_default2(value.length) && !!typedArrayTags2[baseGetTag_default2(value)];
}
__name(baseIsTypedArray2, "baseIsTypedArray");
var baseIsTypedArray_default2 = baseIsTypedArray2;
function baseUnary2(func) {
  return function(value) {
    return func(value);
  };
}
__name(baseUnary2, "baseUnary");
var baseUnary_default2 = baseUnary2;
var freeExports22 = typeof exports_dist == "object" && exports_dist && !exports_dist.nodeType && exports_dist;
var freeModule22 = freeExports22 && typeof module_dist == "object" && module_dist && !module_dist.nodeType && module_dist;
var moduleExports22 = freeModule22 && freeModule22.exports === freeExports22;
var freeProcess2 = moduleExports22 && freeGlobal_default2.process;
var nodeUtil2 = function() {
  try {
    var types = freeModule22 && freeModule22.require && freeModule22.require("util").types;
    if (types) {
      return types;
    }
    return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
  } catch (e) {}
}();
var nodeUtil_default2 = nodeUtil2;
var nodeIsTypedArray2 = nodeUtil_default2 && nodeUtil_default2.isTypedArray;
var isTypedArray2 = nodeIsTypedArray2 ? baseUnary_default2(nodeIsTypedArray2) : baseIsTypedArray_default2;
var isTypedArray_default2 = isTypedArray2;
var objectProto72 = Object.prototype;
var hasOwnProperty52 = objectProto72.hasOwnProperty;
function arrayLikeKeys2(value, inherited) {
  var isArr = isArray_default2(value), isArg = !isArr && isArguments_default2(value), isBuff = !isArr && !isArg && isBuffer_default2(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default2(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default2(value.length, String) : [], length = result.length;
  for (var key in value) {
    if ((inherited || hasOwnProperty52.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex_default2(key, length)))) {
      result.push(key);
    }
  }
  return result;
}
__name(arrayLikeKeys2, "arrayLikeKeys");
var arrayLikeKeys_default2 = arrayLikeKeys2;
function overArg2(func, transform) {
  return function(arg) {
    return func(transform(arg));
  };
}
__name(overArg2, "overArg");
var overArg_default2 = overArg2;
var nativeKeys2 = overArg_default2(Object.keys, Object);
var nativeKeys_default2 = nativeKeys2;
var objectProto82 = Object.prototype;
var hasOwnProperty62 = objectProto82.hasOwnProperty;
function baseKeys2(object) {
  if (!isPrototype_default2(object)) {
    return nativeKeys_default2(object);
  }
  var result = [];
  for (var key in Object(object)) {
    if (hasOwnProperty62.call(object, key) && key != "constructor") {
      result.push(key);
    }
  }
  return result;
}
__name(baseKeys2, "baseKeys");
var baseKeys_default2 = baseKeys2;
function keys2(object) {
  return isArrayLike_default2(object) ? arrayLikeKeys_default2(object) : baseKeys_default2(object);
}
__name(keys2, "keys");
var keys_default2 = keys2;
function nativeKeysIn2(object) {
  var result = [];
  if (object != null) {
    for (var key in Object(object)) {
      result.push(key);
    }
  }
  return result;
}
__name(nativeKeysIn2, "nativeKeysIn");
var nativeKeysIn_default2 = nativeKeysIn2;
var objectProto92 = Object.prototype;
var hasOwnProperty72 = objectProto92.hasOwnProperty;
function baseKeysIn2(object) {
  if (!isObject_default2(object)) {
    return nativeKeysIn_default2(object);
  }
  var isProto = isPrototype_default2(object), result = [];
  for (var key in object) {
    if (!(key == "constructor" && (isProto || !hasOwnProperty72.call(object, key)))) {
      result.push(key);
    }
  }
  return result;
}
__name(baseKeysIn2, "baseKeysIn");
var baseKeysIn_default2 = baseKeysIn2;
function keysIn2(object) {
  return isArrayLike_default2(object) ? arrayLikeKeys_default2(object, true) : baseKeysIn_default2(object);
}
__name(keysIn2, "keysIn");
var keysIn_default2 = keysIn2;
var reIsDeepProp2 = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
var reIsPlainProp2 = /^\w*$/;
function isKey2(value, object) {
  if (isArray_default2(value)) {
    return false;
  }
  var type = typeof value;
  if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol_default2(value)) {
    return true;
  }
  return reIsPlainProp2.test(value) || !reIsDeepProp2.test(value) || object != null && value in Object(object);
}
__name(isKey2, "isKey");
var isKey_default2 = isKey2;
var nativeCreate2 = getNative_default2(Object, "create");
var nativeCreate_default2 = nativeCreate2;
function hashClear2() {
  this.__data__ = nativeCreate_default2 ? nativeCreate_default2(null) : {};
  this.size = 0;
}
__name(hashClear2, "hashClear");
var hashClear_default2 = hashClear2;
function hashDelete2(key) {
  var result = this.has(key) && delete this.__data__[key];
  this.size -= result ? 1 : 0;
  return result;
}
__name(hashDelete2, "hashDelete");
var hashDelete_default2 = hashDelete2;
var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
var objectProto102 = Object.prototype;
var hasOwnProperty82 = objectProto102.hasOwnProperty;
function hashGet2(key) {
  var data = this.__data__;
  if (nativeCreate_default2) {
    var result = data[key];
    return result === HASH_UNDEFINED4 ? undefined : result;
  }
  return hasOwnProperty82.call(data, key) ? data[key] : undefined;
}
__name(hashGet2, "hashGet");
var hashGet_default2 = hashGet2;
var objectProto112 = Object.prototype;
var hasOwnProperty92 = objectProto112.hasOwnProperty;
function hashHas2(key) {
  var data = this.__data__;
  return nativeCreate_default2 ? data[key] !== undefined : hasOwnProperty92.call(data, key);
}
__name(hashHas2, "hashHas");
var hashHas_default2 = hashHas2;
var HASH_UNDEFINED22 = "__lodash_hash_undefined__";
function hashSet2(key, value) {
  var data = this.__data__;
  this.size += this.has(key) ? 0 : 1;
  data[key] = nativeCreate_default2 && value === undefined ? HASH_UNDEFINED22 : value;
  return this;
}
__name(hashSet2, "hashSet");
var hashSet_default2 = hashSet2;
function Hash2(entries) {
  var index = -1, length = entries == null ? 0 : entries.length;
  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}
__name(Hash2, "Hash");
Hash2.prototype.clear = hashClear_default2;
Hash2.prototype["delete"] = hashDelete_default2;
Hash2.prototype.get = hashGet_default2;
Hash2.prototype.has = hashHas_default2;
Hash2.prototype.set = hashSet_default2;
var Hash_default2 = Hash2;
function listCacheClear2() {
  this.__data__ = [];
  this.size = 0;
}
__name(listCacheClear2, "listCacheClear");
var listCacheClear_default2 = listCacheClear2;
function assocIndexOf2(array, key) {
  var length = array.length;
  while (length--) {
    if (eq_default2(array[length][0], key)) {
      return length;
    }
  }
  return -1;
}
__name(assocIndexOf2, "assocIndexOf");
var assocIndexOf_default2 = assocIndexOf2;
var arrayProto2 = Array.prototype;
var splice2 = arrayProto2.splice;
function listCacheDelete2(key) {
  var data = this.__data__, index = assocIndexOf_default2(data, key);
  if (index < 0) {
    return false;
  }
  var lastIndex = data.length - 1;
  if (index == lastIndex) {
    data.pop();
  } else {
    splice2.call(data, index, 1);
  }
  --this.size;
  return true;
}
__name(listCacheDelete2, "listCacheDelete");
var listCacheDelete_default2 = listCacheDelete2;
function listCacheGet2(key) {
  var data = this.__data__, index = assocIndexOf_default2(data, key);
  return index < 0 ? undefined : data[index][1];
}
__name(listCacheGet2, "listCacheGet");
var listCacheGet_default2 = listCacheGet2;
function listCacheHas2(key) {
  return assocIndexOf_default2(this.__data__, key) > -1;
}
__name(listCacheHas2, "listCacheHas");
var listCacheHas_default2 = listCacheHas2;
function listCacheSet2(key, value) {
  var data = this.__data__, index = assocIndexOf_default2(data, key);
  if (index < 0) {
    ++this.size;
    data.push([key, value]);
  } else {
    data[index][1] = value;
  }
  return this;
}
__name(listCacheSet2, "listCacheSet");
var listCacheSet_default2 = listCacheSet2;
function ListCache2(entries) {
  var index = -1, length = entries == null ? 0 : entries.length;
  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}
__name(ListCache2, "ListCache");
ListCache2.prototype.clear = listCacheClear_default2;
ListCache2.prototype["delete"] = listCacheDelete_default2;
ListCache2.prototype.get = listCacheGet_default2;
ListCache2.prototype.has = listCacheHas_default2;
ListCache2.prototype.set = listCacheSet_default2;
var ListCache_default2 = ListCache2;
var Map22 = getNative_default2(root_default2, "Map");
var Map_default2 = Map22;
function mapCacheClear2() {
  this.size = 0;
  this.__data__ = {
    hash: new Hash_default2,
    map: new (Map_default2 || ListCache_default2),
    string: new Hash_default2
  };
}
__name(mapCacheClear2, "mapCacheClear");
var mapCacheClear_default2 = mapCacheClear2;
function isKeyable2(value) {
  var type = typeof value;
  return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
}
__name(isKeyable2, "isKeyable");
var isKeyable_default2 = isKeyable2;
function getMapData2(map2, key) {
  var data = map2.__data__;
  return isKeyable_default2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
}
__name(getMapData2, "getMapData");
var getMapData_default2 = getMapData2;
function mapCacheDelete2(key) {
  var result = getMapData_default2(this, key)["delete"](key);
  this.size -= result ? 1 : 0;
  return result;
}
__name(mapCacheDelete2, "mapCacheDelete");
var mapCacheDelete_default2 = mapCacheDelete2;
function mapCacheGet2(key) {
  return getMapData_default2(this, key).get(key);
}
__name(mapCacheGet2, "mapCacheGet");
var mapCacheGet_default2 = mapCacheGet2;
function mapCacheHas2(key) {
  return getMapData_default2(this, key).has(key);
}
__name(mapCacheHas2, "mapCacheHas");
var mapCacheHas_default2 = mapCacheHas2;
function mapCacheSet2(key, value) {
  var data = getMapData_default2(this, key), size = data.size;
  data.set(key, value);
  this.size += data.size == size ? 0 : 1;
  return this;
}
__name(mapCacheSet2, "mapCacheSet");
var mapCacheSet_default2 = mapCacheSet2;
function MapCache2(entries) {
  var index = -1, length = entries == null ? 0 : entries.length;
  this.clear();
  while (++index < length) {
    var entry = entries[index];
    this.set(entry[0], entry[1]);
  }
}
__name(MapCache2, "MapCache");
MapCache2.prototype.clear = mapCacheClear_default2;
MapCache2.prototype["delete"] = mapCacheDelete_default2;
MapCache2.prototype.get = mapCacheGet_default2;
MapCache2.prototype.has = mapCacheHas_default2;
MapCache2.prototype.set = mapCacheSet_default2;
var MapCache_default2 = MapCache2;
var FUNC_ERROR_TEXT3 = "Expected a function";
function memoize2(func, resolver) {
  if (typeof func != "function" || resolver != null && typeof resolver != "function") {
    throw new TypeError(FUNC_ERROR_TEXT3);
  }
  var memoized = /* @__PURE__ */ __name(function() {
    var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
    if (cache.has(key)) {
      return cache.get(key);
    }
    var result = func.apply(this, args);
    memoized.cache = cache.set(key, result) || cache;
    return result;
  }, "memoized");
  memoized.cache = new (memoize2.Cache || MapCache_default2);
  return memoized;
}
__name(memoize2, "memoize");
memoize2.Cache = MapCache_default2;
var memoize_default2 = memoize2;
var MAX_MEMOIZE_SIZE2 = 500;
function memoizeCapped2(func) {
  var result = memoize_default2(func, function(key) {
    if (cache.size === MAX_MEMOIZE_SIZE2) {
      cache.clear();
    }
    return key;
  });
  var cache = result.cache;
  return result;
}
__name(memoizeCapped2, "memoizeCapped");
var memoizeCapped_default2 = memoizeCapped2;
var rePropName2 = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
var reEscapeChar2 = /\\(\\)?/g;
var stringToPath2 = memoizeCapped_default2(function(string) {
  var result = [];
  if (string.charCodeAt(0) === 46) {
    result.push("");
  }
  string.replace(rePropName2, function(match, number, quote, subString) {
    result.push(quote ? subString.replace(reEscapeChar2, "$1") : number || match);
  });
  return result;
});
var stringToPath_default2 = stringToPath2;
function toString2(value) {
  return value == null ? "" : baseToString_default2(value);
}
__name(toString2, "toString");
var toString_default2 = toString2;
function castPath2(value, object) {
  if (isArray_default2(value)) {
    return value;
  }
  return isKey_default2(value, object) ? [value] : stringToPath_default2(toString_default2(value));
}
__name(castPath2, "castPath");
var castPath_default2 = castPath2;
var INFINITY22 = 1 / 0;
function toKey2(value) {
  if (typeof value == "string" || isSymbol_default2(value)) {
    return value;
  }
  var result = value + "";
  return result == "0" && 1 / value == -INFINITY22 ? "-0" : result;
}
__name(toKey2, "toKey");
var toKey_default2 = toKey2;
function baseGet2(object, path) {
  path = castPath_default2(path, object);
  var index = 0, length = path.length;
  while (object != null && index < length) {
    object = object[toKey_default2(path[index++])];
  }
  return index && index == length ? object : undefined;
}
__name(baseGet2, "baseGet");
var baseGet_default2 = baseGet2;
function get2(object, path, defaultValue) {
  var result = object == null ? undefined : baseGet_default2(object, path);
  return result === undefined ? defaultValue : result;
}
__name(get2, "get");
var get_default2 = get2;
function arrayPush2(array, values) {
  var index = -1, length = values.length, offset = array.length;
  while (++index < length) {
    array[offset + index] = values[index];
  }
  return array;
}
__name(arrayPush2, "arrayPush");
var arrayPush_default2 = arrayPush2;
var getPrototype2 = overArg_default2(Object.getPrototypeOf, Object);
var getPrototype_default2 = getPrototype2;
var objectTag22 = "[object Object]";
var funcProto32 = Function.prototype;
var objectProto122 = Object.prototype;
var funcToString32 = funcProto32.toString;
var hasOwnProperty102 = objectProto122.hasOwnProperty;
var objectCtorString2 = funcToString32.call(Object);
function isPlainObject2(value) {
  if (!isObjectLike_default2(value) || baseGetTag_default2(value) != objectTag22) {
    return false;
  }
  var proto = getPrototype_default2(value);
  if (proto === null) {
    return true;
  }
  var Ctor = hasOwnProperty102.call(proto, "constructor") && proto.constructor;
  return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString32.call(Ctor) == objectCtorString2;
}
__name(isPlainObject2, "isPlainObject");
var isPlainObject_default2 = isPlainObject2;
function stackClear2() {
  this.__data__ = new ListCache_default2;
  this.size = 0;
}
__name(stackClear2, "stackClear");
var stackClear_default2 = stackClear2;
function stackDelete2(key) {
  var data = this.__data__, result = data["delete"](key);
  this.size = data.size;
  return result;
}
__name(stackDelete2, "stackDelete");
var stackDelete_default2 = stackDelete2;
function stackGet2(key) {
  return this.__data__.get(key);
}
__name(stackGet2, "stackGet");
var stackGet_default2 = stackGet2;
function stackHas2(key) {
  return this.__data__.has(key);
}
__name(stackHas2, "stackHas");
var stackHas_default2 = stackHas2;
var LARGE_ARRAY_SIZE3 = 200;
function stackSet2(key, value) {
  var data = this.__data__;
  if (data instanceof ListCache_default2) {
    var pairs = data.__data__;
    if (!Map_default2 || pairs.length < LARGE_ARRAY_SIZE3 - 1) {
      pairs.push([key, value]);
      this.size = ++data.size;
      return this;
    }
    data = this.__data__ = new MapCache_default2(pairs);
  }
  data.set(key, value);
  this.size = data.size;
  return this;
}
__name(stackSet2, "stackSet");
var stackSet_default2 = stackSet2;
function Stack2(entries) {
  var data = this.__data__ = new ListCache_default2(entries);
  this.size = data.size;
}
__name(Stack2, "Stack");
Stack2.prototype.clear = stackClear_default2;
Stack2.prototype["delete"] = stackDelete_default2;
Stack2.prototype.get = stackGet_default2;
Stack2.prototype.has = stackHas_default2;
Stack2.prototype.set = stackSet_default2;
var Stack_default2 = Stack2;
function arrayFilter2(array, predicate) {
  var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  while (++index < length) {
    var value = array[index];
    if (predicate(value, index, array)) {
      result[resIndex++] = value;
    }
  }
  return result;
}
__name(arrayFilter2, "arrayFilter");
var arrayFilter_default2 = arrayFilter2;
function stubArray2() {
  return [];
}
__name(stubArray2, "stubArray");
var stubArray_default2 = stubArray2;
var objectProto132 = Object.prototype;
var propertyIsEnumerable22 = objectProto132.propertyIsEnumerable;
var nativeGetSymbols3 = Object.getOwnPropertySymbols;
var getSymbols2 = !nativeGetSymbols3 ? stubArray_default2 : function(object) {
  if (object == null) {
    return [];
  }
  object = Object(object);
  return arrayFilter_default2(nativeGetSymbols3(object), function(symbol) {
    return propertyIsEnumerable22.call(object, symbol);
  });
};
var getSymbols_default2 = getSymbols2;
var nativeGetSymbols22 = Object.getOwnPropertySymbols;
var getSymbolsIn2 = !nativeGetSymbols22 ? stubArray_default2 : function(object) {
  var result = [];
  while (object) {
    arrayPush_default2(result, getSymbols_default2(object));
    object = getPrototype_default2(object);
  }
  return result;
};
var getSymbolsIn_default2 = getSymbolsIn2;
function baseGetAllKeys2(object, keysFunc, symbolsFunc) {
  var result = keysFunc(object);
  return isArray_default2(object) ? result : arrayPush_default2(result, symbolsFunc(object));
}
__name(baseGetAllKeys2, "baseGetAllKeys");
var baseGetAllKeys_default2 = baseGetAllKeys2;
function getAllKeys2(object) {
  return baseGetAllKeys_default2(object, keys_default2, getSymbols_default2);
}
__name(getAllKeys2, "getAllKeys");
var getAllKeys_default2 = getAllKeys2;
function getAllKeysIn2(object) {
  return baseGetAllKeys_default2(object, keysIn_default2, getSymbolsIn_default2);
}
__name(getAllKeysIn2, "getAllKeysIn");
var getAllKeysIn_default2 = getAllKeysIn2;
var DataView2 = getNative_default2(root_default2, "DataView");
var DataView_default2 = DataView2;
var Promise22 = getNative_default2(root_default2, "Promise");
var Promise_default2 = Promise22;
var Set22 = getNative_default2(root_default2, "Set");
var Set_default2 = Set22;
var mapTag22 = "[object Map]";
var objectTag32 = "[object Object]";
var promiseTag2 = "[object Promise]";
var setTag22 = "[object Set]";
var weakMapTag22 = "[object WeakMap]";
var dataViewTag22 = "[object DataView]";
var dataViewCtorString2 = toSource_default2(DataView_default2);
var mapCtorString2 = toSource_default2(Map_default2);
var promiseCtorString2 = toSource_default2(Promise_default2);
var setCtorString2 = toSource_default2(Set_default2);
var weakMapCtorString2 = toSource_default2(WeakMap_default2);
var getTag2 = baseGetTag_default2;
if (DataView_default2 && getTag2(new DataView_default2(new ArrayBuffer(1))) != dataViewTag22 || Map_default2 && getTag2(new Map_default2) != mapTag22 || Promise_default2 && getTag2(Promise_default2.resolve()) != promiseTag2 || Set_default2 && getTag2(new Set_default2) != setTag22 || WeakMap_default2 && getTag2(new WeakMap_default2) != weakMapTag22) {
  getTag2 = /* @__PURE__ */ __name(function(value) {
    var result = baseGetTag_default2(value), Ctor = result == objectTag32 ? value.constructor : undefined, ctorString = Ctor ? toSource_default2(Ctor) : "";
    if (ctorString) {
      switch (ctorString) {
        case dataViewCtorString2:
          return dataViewTag22;
        case mapCtorString2:
          return mapTag22;
        case promiseCtorString2:
          return promiseTag2;
        case setCtorString2:
          return setTag22;
        case weakMapCtorString2:
          return weakMapTag22;
      }
    }
    return result;
  }, "getTag");
}
var getTag_default2 = getTag2;
var Uint8Array22 = root_default2.Uint8Array;
var Uint8Array_default2 = Uint8Array22;
var HASH_UNDEFINED32 = "__lodash_hash_undefined__";
function setCacheAdd2(value) {
  this.__data__.set(value, HASH_UNDEFINED32);
  return this;
}
__name(setCacheAdd2, "setCacheAdd");
var setCacheAdd_default2 = setCacheAdd2;
function setCacheHas2(value) {
  return this.__data__.has(value);
}
__name(setCacheHas2, "setCacheHas");
var setCacheHas_default2 = setCacheHas2;
function SetCache2(values) {
  var index = -1, length = values == null ? 0 : values.length;
  this.__data__ = new MapCache_default2;
  while (++index < length) {
    this.add(values[index]);
  }
}
__name(SetCache2, "SetCache");
SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd_default2;
SetCache2.prototype.has = setCacheHas_default2;
var SetCache_default2 = SetCache2;
function arraySome2(array, predicate) {
  var index = -1, length = array == null ? 0 : array.length;
  while (++index < length) {
    if (predicate(array[index], index, array)) {
      return true;
    }
  }
  return false;
}
__name(arraySome2, "arraySome");
var arraySome_default2 = arraySome2;
function cacheHas2(cache, key) {
  return cache.has(key);
}
__name(cacheHas2, "cacheHas");
var cacheHas_default2 = cacheHas2;
var COMPARE_PARTIAL_FLAG7 = 1;
var COMPARE_UNORDERED_FLAG5 = 2;
function equalArrays2(array, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG7, arrLength = array.length, othLength = other.length;
  if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
    return false;
  }
  var arrStacked = stack.get(array);
  var othStacked = stack.get(other);
  if (arrStacked && othStacked) {
    return arrStacked == other && othStacked == array;
  }
  var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG5 ? new SetCache_default2 : undefined;
  stack.set(array, other);
  stack.set(other, array);
  while (++index < arrLength) {
    var arrValue = array[index], othValue = other[index];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
    }
    if (compared !== undefined) {
      if (compared) {
        continue;
      }
      result = false;
      break;
    }
    if (seen) {
      if (!arraySome_default2(other, function(othValue2, othIndex) {
        if (!cacheHas_default2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
          return seen.push(othIndex);
        }
      })) {
        result = false;
        break;
      }
    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
      result = false;
      break;
    }
  }
  stack["delete"](array);
  stack["delete"](other);
  return result;
}
__name(equalArrays2, "equalArrays");
var equalArrays_default2 = equalArrays2;
function mapToArray2(map2) {
  var index = -1, result = Array(map2.size);
  map2.forEach(function(value, key) {
    result[++index] = [key, value];
  });
  return result;
}
__name(mapToArray2, "mapToArray");
var mapToArray_default2 = mapToArray2;
function setToArray2(set) {
  var index = -1, result = Array(set.size);
  set.forEach(function(value) {
    result[++index] = value;
  });
  return result;
}
__name(setToArray2, "setToArray");
var setToArray_default2 = setToArray2;
var COMPARE_PARTIAL_FLAG22 = 1;
var COMPARE_UNORDERED_FLAG22 = 2;
var boolTag22 = "[object Boolean]";
var dateTag22 = "[object Date]";
var errorTag22 = "[object Error]";
var mapTag32 = "[object Map]";
var numberTag22 = "[object Number]";
var regexpTag22 = "[object RegExp]";
var setTag32 = "[object Set]";
var stringTag22 = "[object String]";
var symbolTag22 = "[object Symbol]";
var arrayBufferTag22 = "[object ArrayBuffer]";
var dataViewTag32 = "[object DataView]";
var symbolProto22 = Symbol_default2 ? Symbol_default2.prototype : undefined;
var symbolValueOf3 = symbolProto22 ? symbolProto22.valueOf : undefined;
function equalByTag2(object, other, tag, bitmask, customizer, equalFunc, stack) {
  switch (tag) {
    case dataViewTag32:
      if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
        return false;
      }
      object = object.buffer;
      other = other.buffer;
    case arrayBufferTag22:
      if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default2(object), new Uint8Array_default2(other))) {
        return false;
      }
      return true;
    case boolTag22:
    case dateTag22:
    case numberTag22:
      return eq_default2(+object, +other);
    case errorTag22:
      return object.name == other.name && object.message == other.message;
    case regexpTag22:
    case stringTag22:
      return object == other + "";
    case mapTag32:
      var convert = mapToArray_default2;
    case setTag32:
      var isPartial = bitmask & COMPARE_PARTIAL_FLAG22;
      convert || (convert = setToArray_default2);
      if (object.size != other.size && !isPartial) {
        return false;
      }
      var stacked = stack.get(object);
      if (stacked) {
        return stacked == other;
      }
      bitmask |= COMPARE_UNORDERED_FLAG22;
      stack.set(object, other);
      var result = equalArrays_default2(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
      stack["delete"](object);
      return result;
    case symbolTag22:
      if (symbolValueOf3) {
        return symbolValueOf3.call(object) == symbolValueOf3.call(other);
      }
  }
  return false;
}
__name(equalByTag2, "equalByTag");
var equalByTag_default2 = equalByTag2;
var COMPARE_PARTIAL_FLAG32 = 1;
var objectProto142 = Object.prototype;
var hasOwnProperty112 = objectProto142.hasOwnProperty;
function equalObjects2(object, other, bitmask, customizer, equalFunc, stack) {
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG32, objProps = getAllKeys_default2(object), objLength = objProps.length, othProps = getAllKeys_default2(other), othLength = othProps.length;
  if (objLength != othLength && !isPartial) {
    return false;
  }
  var index = objLength;
  while (index--) {
    var key = objProps[index];
    if (!(isPartial ? key in other : hasOwnProperty112.call(other, key))) {
      return false;
    }
  }
  var objStacked = stack.get(object);
  var othStacked = stack.get(other);
  if (objStacked && othStacked) {
    return objStacked == other && othStacked == object;
  }
  var result = true;
  stack.set(object, other);
  stack.set(other, object);
  var skipCtor = isPartial;
  while (++index < objLength) {
    key = objProps[index];
    var objValue = object[key], othValue = other[key];
    if (customizer) {
      var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
    }
    if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
      result = false;
      break;
    }
    skipCtor || (skipCtor = key == "constructor");
  }
  if (result && !skipCtor) {
    var objCtor = object.constructor, othCtor = other.constructor;
    if (objCtor != othCtor && (("constructor" in object) && ("constructor" in other)) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
      result = false;
    }
  }
  stack["delete"](object);
  stack["delete"](other);
  return result;
}
__name(equalObjects2, "equalObjects");
var equalObjects_default2 = equalObjects2;
var COMPARE_PARTIAL_FLAG42 = 1;
var argsTag32 = "[object Arguments]";
var arrayTag22 = "[object Array]";
var objectTag42 = "[object Object]";
var objectProto152 = Object.prototype;
var hasOwnProperty122 = objectProto152.hasOwnProperty;
function baseIsEqualDeep2(object, other, bitmask, customizer, equalFunc, stack) {
  var objIsArr = isArray_default2(object), othIsArr = isArray_default2(other), objTag = objIsArr ? arrayTag22 : getTag_default2(object), othTag = othIsArr ? arrayTag22 : getTag_default2(other);
  objTag = objTag == argsTag32 ? objectTag42 : objTag;
  othTag = othTag == argsTag32 ? objectTag42 : othTag;
  var objIsObj = objTag == objectTag42, othIsObj = othTag == objectTag42, isSameTag = objTag == othTag;
  if (isSameTag && isBuffer_default2(object)) {
    if (!isBuffer_default2(other)) {
      return false;
    }
    objIsArr = true;
    objIsObj = false;
  }
  if (isSameTag && !objIsObj) {
    stack || (stack = new Stack_default2);
    return objIsArr || isTypedArray_default2(object) ? equalArrays_default2(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default2(object, other, objTag, bitmask, customizer, equalFunc, stack);
  }
  if (!(bitmask & COMPARE_PARTIAL_FLAG42)) {
    var objIsWrapped = objIsObj && hasOwnProperty122.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty122.call(other, "__wrapped__");
    if (objIsWrapped || othIsWrapped) {
      var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
      stack || (stack = new Stack_default2);
      return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
    }
  }
  if (!isSameTag) {
    return false;
  }
  stack || (stack = new Stack_default2);
  return equalObjects_default2(object, other, bitmask, customizer, equalFunc, stack);
}
__name(baseIsEqualDeep2, "baseIsEqualDeep");
var baseIsEqualDeep_default2 = baseIsEqualDeep2;
function baseIsEqual2(value, other, bitmask, customizer, stack) {
  if (value === other) {
    return true;
  }
  if (value == null || other == null || !isObjectLike_default2(value) && !isObjectLike_default2(other)) {
    return value !== value && other !== other;
  }
  return baseIsEqualDeep_default2(value, other, bitmask, customizer, baseIsEqual2, stack);
}
__name(baseIsEqual2, "baseIsEqual");
var baseIsEqual_default2 = baseIsEqual2;
var COMPARE_PARTIAL_FLAG52 = 1;
var COMPARE_UNORDERED_FLAG32 = 2;
function baseIsMatch2(object, source, matchData, customizer) {
  var index = matchData.length, length = index, noCustomizer = !customizer;
  if (object == null) {
    return !length;
  }
  object = Object(object);
  while (index--) {
    var data = matchData[index];
    if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
      return false;
    }
  }
  while (++index < length) {
    data = matchData[index];
    var key = data[0], objValue = object[key], srcValue = data[1];
    if (noCustomizer && data[2]) {
      if (objValue === undefined && !(key in object)) {
        return false;
      }
    } else {
      var stack = new Stack_default2;
      if (customizer) {
        var result = customizer(objValue, srcValue, key, object, source, stack);
      }
      if (!(result === undefined ? baseIsEqual_default2(srcValue, objValue, COMPARE_PARTIAL_FLAG52 | COMPARE_UNORDERED_FLAG32, customizer, stack) : result)) {
        return false;
      }
    }
  }
  return true;
}
__name(baseIsMatch2, "baseIsMatch");
var baseIsMatch_default2 = baseIsMatch2;
function isStrictComparable2(value) {
  return value === value && !isObject_default2(value);
}
__name(isStrictComparable2, "isStrictComparable");
var isStrictComparable_default2 = isStrictComparable2;
function getMatchData2(object) {
  var result = keys_default2(object), length = result.length;
  while (length--) {
    var key = result[length], value = object[key];
    result[length] = [key, value, isStrictComparable_default2(value)];
  }
  return result;
}
__name(getMatchData2, "getMatchData");
var getMatchData_default2 = getMatchData2;
function matchesStrictComparable2(key, srcValue) {
  return function(object) {
    if (object == null) {
      return false;
    }
    return object[key] === srcValue && (srcValue !== undefined || (key in Object(object)));
  };
}
__name(matchesStrictComparable2, "matchesStrictComparable");
var matchesStrictComparable_default2 = matchesStrictComparable2;
function baseMatches2(source) {
  var matchData = getMatchData_default2(source);
  if (matchData.length == 1 && matchData[0][2]) {
    return matchesStrictComparable_default2(matchData[0][0], matchData[0][1]);
  }
  return function(object) {
    return object === source || baseIsMatch_default2(object, source, matchData);
  };
}
__name(baseMatches2, "baseMatches");
var baseMatches_default2 = baseMatches2;
function baseHasIn2(object, key) {
  return object != null && key in Object(object);
}
__name(baseHasIn2, "baseHasIn");
var baseHasIn_default2 = baseHasIn2;
function hasPath2(object, path, hasFunc) {
  path = castPath_default2(path, object);
  var index = -1, length = path.length, result = false;
  while (++index < length) {
    var key = toKey_default2(path[index]);
    if (!(result = object != null && hasFunc(object, key))) {
      break;
    }
    object = object[key];
  }
  if (result || ++index != length) {
    return result;
  }
  length = object == null ? 0 : object.length;
  return !!length && isLength_default2(length) && isIndex_default2(key, length) && (isArray_default2(object) || isArguments_default2(object));
}
__name(hasPath2, "hasPath");
var hasPath_default2 = hasPath2;
function hasIn2(object, path) {
  return object != null && hasPath_default2(object, path, baseHasIn_default2);
}
__name(hasIn2, "hasIn");
var hasIn_default2 = hasIn2;
var COMPARE_PARTIAL_FLAG62 = 1;
var COMPARE_UNORDERED_FLAG42 = 2;
function baseMatchesProperty2(path, srcValue) {
  if (isKey_default2(path) && isStrictComparable_default2(srcValue)) {
    return matchesStrictComparable_default2(toKey_default2(path), srcValue);
  }
  return function(object) {
    var objValue = get_default2(object, path);
    return objValue === undefined && objValue === srcValue ? hasIn_default2(object, path) : baseIsEqual_default2(srcValue, objValue, COMPARE_PARTIAL_FLAG62 | COMPARE_UNORDERED_FLAG42);
  };
}
__name(baseMatchesProperty2, "baseMatchesProperty");
var baseMatchesProperty_default2 = baseMatchesProperty2;
function baseProperty2(key) {
  return function(object) {
    return object == null ? undefined : object[key];
  };
}
__name(baseProperty2, "baseProperty");
var baseProperty_default2 = baseProperty2;
function basePropertyDeep2(path) {
  return function(object) {
    return baseGet_default2(object, path);
  };
}
__name(basePropertyDeep2, "basePropertyDeep");
var basePropertyDeep_default2 = basePropertyDeep2;
function property2(path) {
  return isKey_default2(path) ? baseProperty_default2(toKey_default2(path)) : basePropertyDeep_default2(path);
}
__name(property2, "property");
var property_default2 = property2;
function baseIteratee2(value) {
  if (typeof value == "function") {
    return value;
  }
  if (value == null) {
    return identity_default2;
  }
  if (typeof value == "object") {
    return isArray_default2(value) ? baseMatchesProperty_default2(value[0], value[1]) : baseMatches_default2(value);
  }
  return property_default2(value);
}
__name(baseIteratee2, "baseIteratee");
var baseIteratee_default2 = baseIteratee2;
function isEqual2(value, other) {
  return baseIsEqual_default2(value, other);
}
__name(isEqual2, "isEqual");
var isEqual_default2 = isEqual2;
function isEqualWith(value, other, customizer) {
  customizer = typeof customizer == "function" ? customizer : undefined;
  var result = customizer ? customizer(value, other) : undefined;
  return result === undefined ? baseIsEqual_default2(value, other, undefined, customizer) : !!result;
}
__name(isEqualWith, "isEqualWith");
var isEqualWith_default = isEqualWith;
function isUndefined(value) {
  return value === undefined;
}
__name(isUndefined, "isUndefined");
var isUndefined_default = isUndefined;
var FUNC_ERROR_TEXT22 = "Expected a function";
function negate(predicate) {
  if (typeof predicate != "function") {
    throw new TypeError(FUNC_ERROR_TEXT22);
  }
  return function() {
    var args = arguments;
    switch (args.length) {
      case 0:
        return !predicate.call(this);
      case 1:
        return !predicate.call(this, args[0]);
      case 2:
        return !predicate.call(this, args[0], args[1]);
      case 3:
        return !predicate.call(this, args[0], args[1], args[2]);
    }
    return !predicate.apply(this, args);
  };
}
__name(negate, "negate");
var negate_default = negate;
function baseSet2(object, path, value, customizer) {
  if (!isObject_default2(object)) {
    return object;
  }
  path = castPath_default2(path, object);
  var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  while (nested != null && ++index < length) {
    var key = toKey_default2(path[index]), newValue = value;
    if (key === "__proto__" || key === "constructor" || key === "prototype") {
      return object;
    }
    if (index != lastIndex) {
      var objValue = nested[key];
      newValue = customizer ? customizer(objValue, key, nested) : undefined;
      if (newValue === undefined) {
        newValue = isObject_default2(objValue) ? objValue : isIndex_default2(path[index + 1]) ? [] : {};
      }
    }
    assignValue_default2(nested, key, newValue);
    nested = nested[key];
  }
  return object;
}
__name(baseSet2, "baseSet");
var baseSet_default2 = baseSet2;
function basePickBy2(object, paths, predicate) {
  var index = -1, length = paths.length, result = {};
  while (++index < length) {
    var path = paths[index], value = baseGet_default2(object, path);
    if (predicate(value, path)) {
      baseSet_default2(result, castPath_default2(path, object), value);
    }
  }
  return result;
}
__name(basePickBy2, "basePickBy");
var basePickBy_default2 = basePickBy2;
function pickBy2(object, predicate) {
  if (object == null) {
    return {};
  }
  var props = arrayMap_default2(getAllKeysIn_default2(object), function(prop) {
    return [prop];
  });
  predicate = baseIteratee_default2(predicate);
  return basePickBy_default2(object, props, function(value, path) {
    return predicate(value, path[0]);
  });
}
__name(pickBy2, "pickBy");
var pickBy_default2 = pickBy2;
function omitBy(object, predicate) {
  return pickBy_default2(object, negate_default(baseIteratee_default2(predicate)));
}
__name(omitBy, "omitBy");
var omitBy_default = omitBy;
var isEqual22 = /* @__PURE__ */ __name((a, b) => {
  return _isEqualWithVisitedTracking(a, b, /* @__PURE__ */ new WeakSet);
}, "isEqual");
var _isPlainObject = /* @__PURE__ */ __name((x) => isPlainObject_default2(x), "_isPlainObject");
var _isEqualWithVisitedTracking = /* @__PURE__ */ __name((a, b, visited) => isEqualWith_default(a, b, _customizerWithVisitedTracking(visited)), "_isEqualWithVisitedTracking");
var _customizerWithVisitedTracking = /* @__PURE__ */ __name((visited) => (a, b) => {
  if (_isPlainObject(a) && !visited.has(a) && _isPlainObject(b) && !visited.has(b)) {
    const cleanedA = omitBy_default(a, isUndefined_default);
    const cleanedB = omitBy_default(b, isUndefined_default);
    visited.add(cleanedA).add(cleanedB).add(a).add(b);
    return _isEqualWithVisitedTracking(cleanedA, cleanedB, visited);
  }
  return;
}, "_customizerWithVisitedTracking");
var unique = /* @__PURE__ */ __name((arr) => {
  return Array.from(new Set(arr));
}, "unique");
var DEFAULT_OPTIONS = {
  compare: isEqual22
};
var _CustomSet = class _CustomSet2 {
  constructor(items = [], opt = {}) {
    this._options = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), opt);
    this._items = [];
    for (const i of items) {
      this.add(i);
    }
  }
  get items() {
    return [...this._items];
  }
  get size() {
    return this._items.length;
  }
  has(item) {
    return this._items.some((i) => this._options.compare(i, item));
  }
  add(item) {
    if (!this.has(item)) {
      this._items.push(item);
    }
  }
  isEqual(other) {
    if (this.size !== other.size) {
      return false;
    }
    return this.isSubsetOf(other) && other.isSubsetOf(this);
  }
  isSubsetOf(other) {
    if (this.size > other.size) {
      return false;
    }
    return this._items.every((i) => other.has(i));
  }
};
__name(_CustomSet, "CustomSet");
var CustomSet = _CustomSet;
var error_utils_exports = {};
__export2(error_utils_exports, {
  errToObj: () => errToObj,
  toString: () => toString22
});
var errToObj = /* @__PURE__ */ __name((message) => typeof message === "string" ? { message } : message || {}, "errToObj");
var toString22 = /* @__PURE__ */ __name((message) => typeof message === "string" ? message : message == null ? undefined : message.message, "toString");
var assert_utils_exports = {};
__export2(assert_utils_exports, {
  assertNever: () => assertNever
});
function assertNever(_x) {
  throw new Error("assertNever called");
}
__name(assertNever, "assertNever");
var other_utils_exports = {};
__export2(other_utils_exports, {
  compareFunctions: () => compareFunctions,
  joinValues: () => joinValues,
  jsonStringifyReplacer: () => jsonStringifyReplacer
});
function joinValues(array, separator = " | ") {
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
}
__name(joinValues, "joinValues");
var jsonStringifyReplacer = /* @__PURE__ */ __name((_, value) => {
  if (typeof value === "bigint") {
    return value.toString();
  }
  return value;
}, "jsonStringifyReplacer");
var compareFunctions = /* @__PURE__ */ __name((a, b) => {
  return a.toString() === b.toString();
}, "compareFunctions");
var datestring_utils_exports = {};
__export2(datestring_utils_exports, {
  extractPrecisionAndOffset: () => extractPrecisionAndOffset,
  generateDatetimeRegex: () => generateDatetimeRegex
});
var generateDatetimeRegex = /* @__PURE__ */ __name((args) => {
  const precision = args.precision ? DATETIME_REGEX_PRECISION_SPECIFIC_BEGIN + args.precision + DATETIME_REGEX_PRECISION_SPECIFIC_END : args.precision === 0 ? "" : DATETIME_REGEX_PRECISION_ARBITRARY;
  const offset = args.offset ? DATETIME_REGEX_OFFSET : DATETIME_REGEX_OFFSET_NONE;
  return new RegExp(`^${DATETIME_REGEX_BASE}${precision}${offset}$`);
}, "generateDatetimeRegex");
var extractPrecisionAndOffset = /* @__PURE__ */ __name((regexSource) => ({
  precision: _extractPrecision(regexSource),
  offset: regexSource.endsWith(`${DATETIME_REGEX_OFFSET}$`)
}), "extractPrecisionAndOffset");
var DATETIME_REGEX_BASE = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}";
var DATETIME_REGEX_OFFSET = "(([+-]\\d{2}(:?\\d{2})?)|Z)";
var DATETIME_REGEX_OFFSET_NONE = "Z";
var DATETIME_REGEX_PRECISION_ARBITRARY = "(\\.\\d+)?";
var DATETIME_REGEX_PRECISION_SPECIFIC_BEGIN = "\\.\\d{";
var DATETIME_REGEX_PRECISION_SPECIFIC_END = "}";
var _extractPrecision = /* @__PURE__ */ __name((regexSource) => {
  const slicedRegex = regexSource.slice(1 + DATETIME_REGEX_BASE.length);
  if (slicedRegex.startsWith(DATETIME_REGEX_PRECISION_ARBITRARY)) {
    return null;
  } else if (slicedRegex.startsWith(DATETIME_REGEX_PRECISION_SPECIFIC_BEGIN)) {
    return parseInt(slicedRegex.slice(DATETIME_REGEX_PRECISION_SPECIFIC_BEGIN.length));
  }
  return 0;
}, "_extractPrecision");
var errorMap = /* @__PURE__ */ __name((issue, _ctx) => {
  let message;
  switch (issue.code) {
    case "invalid_type":
      if (issue.received === "undefined") {
        message = "Required";
      } else {
        message = `Expected ${issue.expected}, received ${issue.received}`;
      }
      break;
    case "invalid_literal":
      message = `Invalid literal value, expected ${JSON.stringify(issue.expected, other_utils_exports.jsonStringifyReplacer)}`;
      break;
    case "unrecognized_keys":
      message = `Unrecognized key(s) in object: ${other_utils_exports.joinValues(issue.keys, ", ")}`;
      break;
    case "invalid_union":
      message = "Invalid input";
      break;
    case "invalid_union_discriminator":
      message = `Invalid discriminator value. Expected ${other_utils_exports.joinValues(issue.options)}`;
      break;
    case "invalid_enum_value":
      message = `Invalid enum value. Expected ${other_utils_exports.joinValues(issue.options)}, received '${issue.received}'`;
      break;
    case "invalid_arguments":
      message = "Invalid function arguments";
      break;
    case "invalid_return_type":
      message = "Invalid function return type";
      break;
    case "invalid_date":
      message = "Invalid date";
      break;
    case "invalid_string":
      if (typeof issue.validation === "object") {
        if ("includes" in issue.validation) {
          message = `Invalid input: must include "${issue.validation.includes}"`;
          if (typeof issue.validation.position === "number") {
            message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
          }
        } else if ("startsWith" in issue.validation) {
          message = `Invalid input: must start with "${issue.validation.startsWith}"`;
        } else if ("endsWith" in issue.validation) {
          message = `Invalid input: must end with "${issue.validation.endsWith}"`;
        } else {
          assert_utils_exports.assertNever(issue.validation);
        }
      } else if (issue.validation !== "regex") {
        message = `Invalid ${issue.validation}`;
      } else {
        message = "Invalid";
      }
      break;
    case "too_small":
      if (issue.type === "array") {
        message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? "at least" : "more than"} ${issue.minimum} element(s)`;
      } else if (issue.type === "string") {
        message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? "at least" : "over"} ${issue.minimum} character(s)`;
      } else if (issue.type === "number") {
        message = `Number must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${issue.minimum}`;
      } else if (issue.type === "date") {
        message = `Date must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(issue.minimum))}`;
      } else
        message = "Invalid input";
      break;
    case "too_big":
      if (issue.type === "array") {
        message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? "at most" : "less than"} ${issue.maximum} element(s)`;
      } else if (issue.type === "string") {
        message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? "at most" : "under"} ${issue.maximum} character(s)`;
      } else if (issue.type === "number") {
        message = `Number must be ${issue.exact ? "exactly" : issue.inclusive ? "less than or equal to" : "less than"} ${issue.maximum}`;
      } else if (issue.type === "bigint") {
        message = `BigInt must be ${issue.exact ? "exactly" : issue.inclusive ? "less than or equal to" : "less than"} ${issue.maximum}`;
      } else if (issue.type === "date") {
        message = `Date must be ${issue.exact ? "exactly" : issue.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(issue.maximum))}`;
      } else
        message = "Invalid input";
      break;
    case "custom":
      message = "Invalid input";
      break;
    case "invalid_intersection_types":
      message = "Intersection results could not be merged";
      break;
    case "not_multiple_of":
      message = `Number must be a multiple of ${issue.multipleOf}`;
      break;
    case "not_finite":
      message = "Number must be finite";
      break;
    case "unresolved_reference":
      message = "Unresolved reference";
      break;
    default:
      message = _ctx.defaultError;
      assert_utils_exports.assertNever(issue);
  }
  return { message };
}, "errorMap");
var _ZodError = class _ZodError2 extends Error {
  constructor(issues) {
    super();
    this.__type__ = "ZuiError";
    this.issues = [];
    this.addIssue = /* @__PURE__ */ __name((sub) => {
      this.issues = [...this.issues, sub];
    }, "addIssue");
    this.addIssues = /* @__PURE__ */ __name((subs = []) => {
      this.issues = [...this.issues, ...subs];
    }, "addIssues");
    const actualProto = new.target.prototype;
    if (Object.setPrototypeOf) {
      Object.setPrototypeOf(this, actualProto);
    } else {
      this.__proto__ = actualProto;
    }
    this.name = "ZodError";
    this.issues = issues;
  }
  get errors() {
    return this.issues;
  }
  format(_mapper) {
    const mapper = _mapper || function(issue) {
      return issue.message;
    };
    const fieldErrors = { _errors: [] };
    const processError = /* @__PURE__ */ __name((error) => {
      for (const issue of error.issues) {
        if (issue.code === "invalid_union") {
          issue.unionErrors.map(processError);
        } else if (issue.code === "invalid_return_type") {
          processError(issue.returnTypeError);
        } else if (issue.code === "invalid_arguments") {
          processError(issue.argumentsError);
        } else if (issue.path.length === 0) {
          fieldErrors._errors.push(mapper(issue));
        } else {
          let curr = fieldErrors;
          let i = 0;
          while (i < issue.path.length) {
            const el = issue.path[i];
            const terminal = i === issue.path.length - 1;
            if (!terminal) {
              curr[el] = curr[el] || { _errors: [] };
            } else {
              curr[el] = curr[el] || { _errors: [] };
              curr[el]._errors.push(mapper(issue));
            }
            curr = curr[el];
            i++;
          }
        }
      }
    }, "processError");
    processError(this);
    return fieldErrors;
  }
  static assert(value) {
    if (!(value instanceof _ZodError2)) {
      throw new Error(`Not a ZodError: ${value}`);
    }
  }
  toString() {
    return this.message;
  }
  get message() {
    return JSON.stringify(this.issues, other_utils_exports.jsonStringifyReplacer, 2);
  }
  get isEmpty() {
    return this.issues.length === 0;
  }
};
__name(_ZodError, "ZodError");
_ZodError.create = /* @__PURE__ */ __name((issues) => {
  const error = new _ZodError(issues);
  return error;
}, "create");
var ZodError = _ZodError;
var overrideErrorMap = errorMap;
function getErrorMap() {
  return overrideErrorMap;
}
__name(getErrorMap, "getErrorMap");
var builders = {};
function setBuilders(b) {
  Object.assign(builders, b);
}
__name(setBuilders, "setBuilders");
var makeIssue = /* @__PURE__ */ __name((params) => {
  var _a;
  const { data, path, errorMaps, issueData } = params;
  const fullPath = [...path, ...issueData.path || []];
  const fullIssue = __spreadProps(__spreadValues({}, issueData), {
    path: fullPath
  });
  let errorMessage = "";
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
  for (const map2 of maps) {
    errorMessage = map2(fullIssue, { data, defaultError: errorMessage }).message;
  }
  return __spreadProps(__spreadValues({}, issueData), {
    path: fullPath,
    message: (_a = issueData.message) != null ? _a : errorMessage
  });
}, "makeIssue");
function addIssueToContext(ctx, issueData) {
  const issue = makeIssue({
    issueData,
    data: ctx.data,
    path: ctx.path,
    errorMaps: [
      ctx.common.contextualErrorMap,
      ctx.schemaErrorMap,
      getErrorMap(),
      errorMap
    ].filter((x) => !!x)
  });
  ctx.common.issues.push(issue);
}
__name(addIssueToContext, "addIssueToContext");
var _ParseStatus = class _ParseStatus2 {
  constructor() {
    this.value = "valid";
  }
  dirty() {
    if (this.value === "valid")
      this.value = "dirty";
  }
  abort() {
    if (this.value !== "aborted")
      this.value = "aborted";
  }
  static mergeArray(status, results) {
    const arrayValue = [];
    for (const s of results) {
      if (s.status === "aborted")
        return { status: "aborted" };
      if (s.status === "dirty")
        status.dirty();
      arrayValue.push(s.value);
    }
    return { status: status.value, value: arrayValue };
  }
  static async mergeObjectAsync(status, pairs) {
    const syncPairs = [];
    for (const pair of pairs) {
      syncPairs.push({
        key: await pair.key,
        value: await pair.value
      });
    }
    return _ParseStatus2.mergeObjectSync(status, syncPairs);
  }
  static mergeObjectSync(status, pairs) {
    const finalObject = {};
    for (const pair of pairs) {
      const { key, value } = pair;
      if (key.status === "aborted")
        return { status: "aborted" };
      if (value.status === "aborted")
        return { status: "aborted" };
      if (key.status === "dirty")
        status.dirty();
      if (value.status === "dirty")
        status.dirty();
      if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
        finalObject[key.value] = value.value;
      }
    }
    return { status: status.value, value: finalObject };
  }
};
__name(_ParseStatus, "ParseStatus");
var ParseStatus = _ParseStatus;
var isAsync = /* @__PURE__ */ __name((x) => typeof Promise !== "undefined" && x instanceof Promise, "isAsync");
var getParsedType = /* @__PURE__ */ __name((data) => {
  switch (typeof data) {
    case "undefined":
      return "undefined";
    case "string":
      return "string";
    case "number":
      return 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 (typeof Promise !== "undefined" && data instanceof Promise) {
        return "promise";
      }
      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";
      }
      return "object";
    default:
      return "unknown";
  }
}, "getParsedType");
var _ParseInputLazyPath = class _ParseInputLazyPath2 {
  constructor(parent2, value, path, key) {
    this._cachedPath = [];
    this.parent = parent2;
    this.data = value;
    this._path = path;
    this._key = key;
  }
  get path() {
    if (!this._cachedPath.length) {
      if (this._key instanceof Array) {
        this._cachedPath.push(...this._path, ...this._key);
      } else {
        this._cachedPath.push(...this._path, this._key);
      }
    }
    return this._cachedPath;
  }
};
__name(_ParseInputLazyPath, "ParseInputLazyPath");
var ParseInputLazyPath = _ParseInputLazyPath;
var __CircularDependencyError = class __CircularDependencyError2 extends Error {
  constructor(propName) {
    super(`Cannot access property ${propName} before initialization. You're probably importing ZUI incorrectly. If not, reach out to the maintainers.`);
  }
};
__name(__CircularDependencyError, "_CircularDependencyError");
var _CircularDependencyError = __CircularDependencyError;
var _ZodBaseTypeImpl = class _ZodBaseTypeImpl2 {
  constructor(def) {
    this.__type__ = "ZuiType";
    this.spa = this.safeParseAsync;
    this._handleResult = /* @__PURE__ */ __name((ctx, result) => {
      if (result.status === "valid") {
        return { success: true, data: result.value };
      } else {
        if (!ctx.common.issues.length) {
          throw new Error("Validation failed but no issues detected.");
        }
        return {
          success: false,
          get error() {
            if (this._error)
              return this._error;
            const error = new ZodError(ctx.common.issues);
            this._error = error;
            return this._error;
          }
        };
      }
    }, "_handleResult");
    this._def = def;
    this.parse = this.parse.bind(this);
    this.safeParse = this.safeParse.bind(this);
    this.parseAsync = this.parseAsync.bind(this);
    this.safeParseAsync = this.safeParseAsync.bind(this);
    this.spa = this.spa.bind(this);
    this.refine = this.refine.bind(this);
    this.superRefine = this.superRefine.bind(this);
    this.optional = this.optional.bind(this);
    this.nullable = this.nullable.bind(this);
    this.nullish = this.nullish.bind(this);
    this.array = this.array.bind(this);
    this.promise = this.promise.bind(this);
    this.or = this.or.bind(this);
    this.and = this.and.bind(this);
    this.transform = this.transform.bind(this);
    this.brand = this.brand.bind(this);
    this.default = this.default.bind(this);
    this.catch = this.catch.bind(this);
    this.describe = this.describe.bind(this);
    this.pipe = this.pipe.bind(this);
    this.readonly = this.readonly.bind(this);
    this.isNullable = this.isNullable.bind(this);
    this.isOptional = this.isOptional.bind(this);
    this.downstream = this.downstream.bind(this);
  }
  get description() {
    return this._metadataRoot._def.description;
  }
  get typeName() {
    return this._def.typeName;
  }
  dereference(_defs) {
    return this;
  }
  getReferences() {
    return [];
  }
  clone() {
    const This = this.constructor;
    return new This(__spreadValues({}, this._def));
  }
  _getType(input) {
    return getParsedType(input.data);
  }
  _getOrReturnCtx(input, ctx) {
    return ctx || {
      common: input.parent.common,
      data: input.data,
      parsedType: getParsedType(input.data),
      schemaErrorMap: this._def.errorMap,
      path: input.path,
      parent: input.parent
    };
  }
  _processInputParams(input) {
    return {
      status: new ParseStatus,
      ctx: {
        common: input.parent.common,
        data: input.data,
        parsedType: getParsedType(input.data),
        schemaErrorMap: this._def.errorMap,
        path: input.path,
        parent: input.parent
      }
    };
  }
  _parseSync(input) {
    const result = this._parse(input);
    if (isAsync(result)) {
      throw new Error("Synchronous parse encountered promise.");
    }
    return result;
  }
  _parseAsync(input) {
    const result = this._parse(input);
    return Promise.resolve(result);
  }
  parse(data, params) {
    const result = this.safeParse(data, params);
    if (result.success)
      return result.data;
    throw result.error;
  }
  safeParse(data, params) {
    var _a;
    const ctx = {
      common: {
        issues: [],
        async: (_a = params == null ? undefined : params.async) != null ? _a : false,
        contextualErrorMap: params == null ? undefined : params.errorMap
      },
      path: (params == null ? undefined : params.path) || [],
      schemaErrorMap: this._def.errorMap,
      parent: null,
      data,
      parsedType: getParsedType(data)
    };
    const result = this._parseSync({ data, path: ctx.path, parent: ctx });
    return this._handleResult(ctx, result);
  }
  async parseAsync(data, params) {
    const result = await this.safeParseAsync(data, params);
    if (result.success)
      return result.data;
    throw result.error;
  }
  async safeParseAsync(data, params) {
    const ctx = {
      common: {
        issues: [],
        contextualErrorMap: params == null ? undefined : params.errorMap,
        async: true
      },
      path: (params == null ? undefined : params.path) || [],
      schemaErrorMap: this._def.errorMap,
      parent: null,
      data,
      parsedType: getParsedType(data)
    };
    const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
    const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
    return this._handleResult(ctx, result);
  }
  refine(check, message) {
    const getIssueProperties = /* @__PURE__ */ __name((val) => {
      if (typeof message === "string" || typeof message === "undefined") {
        return { message };
      } else if (typeof message === "function") {
        return message(val);
      } else {
        return message;
      }
    }, "getIssueProperties");
    return builders.downstream(this, (val) => {
      const result = check(val);
      const issues = [];
      const setError = /* @__PURE__ */ __name(() => issues.push(__spreadValues({
        code: "custom"
      }, getIssueProperties(val))), "setError");
      if (typeof Promise !== "undefined" && result instanceof Promise) {
        return result.then((data) => {
          if (!data) {
            setError();
            return { status: "dirty", value: val, issues };
          } else {
            return { status: "valid", value: val };
          }
        });
      }
      if (!result) {
        setError();
        return { status: "dirty", value: val, issues };
      } else {
        return { status: "valid", value: val };
      }
    });
  }
  superRefine(refinement) {
    return builders.downstream(this, (val, context) => {
      const issues = [];
      const result = refinement(val, {
        addIssue: (issue) => issues.push(issue),
        path: context.path
      });
      if (typeof Promise !== "undefined" && result instanceof Promise) {
        return result.then(() => {
          if (issues.some((i) => i.fatal)) {
            return { status: "aborted", issues };
          }
          if (issues.length) {
            return { status: "dirty", value: val, issues };
          }
          return { status: "valid", value: val };
        });
      } else {
        if (issues.some((i) => i.fatal)) {
          return { status: "aborted", issues };
        }
        if (issues.length) {
          return { status: "dirty", value: val, issues };
        }
        return { status: "valid", value: val };
      }
    });
  }
  downstream(fn, params) {
    return builders.downstream(this, fn, params);
  }
  optional() {
    return builders.optional(this, this._def);
  }
  nullable() {
    return builders.nullable(this, this._def);
  }
  nullish() {
    return this.nullable().optional();
  }
  array() {
    return builders.array(this, this._def);
  }
  promise() {
    return builders.promise(this, this._def);
  }
  mandatory() {
    return this;
  }
  or(option) {
    return builders.union([this, option]);
  }
  and(incoming) {
    return builders.intersection(this, incoming);
  }
  transform(transform) {
    return builders.downstream(this, (val, context) => {
      const issues = [];
      const result = transform(val, {
        addIssue: (issue) => issues.push(issue),
        path: context.path
      });
      if (result instanceof Promise) {
        return result.then((data) => {
          if (issues.some((i) => i.fatal)) {
            return { status: "aborted", issues };
          }
          if (issues.length) {
            return { status: "dirty", value: data, issues };
          }
          return { status: "valid", value: data };
        });
      } else {
        if (issues.some((i) => i.fatal)) {
          return { status: "aborted", issues };
        }
        if (issues.length) {
          return { status: "dirty", value: result, issues };
        }
        return { status: "valid", value: result };
      }
    }, { failFast: true });
  }
  default(def) {
    const defaultValueFunc = typeof def === "function" ? def : () => def;
    return builders.default(this, defaultValueFunc);
  }
  brand() {
    return builders.branded(this);
  }
  catch(catcher) {
    return builders.catch(this, catcher);
  }
  describe(description) {
    const clone = this.clone();
    clone._metadataRoot._def.description = description;
    return clone;
  }
  pipe(target) {
    return builders.pipeline(this, target);
  }
  readonly() {
    return builders.readonly(this);
  }
  isOptional() {
    return this.safeParse(undefined).success;
  }
  isNullable() {
    return this.safeParse(null).success;
  }
  metadata(data) {
    var _a, _b, _c;
    const clone = this.clone();
    const root22 = clone._metadataRoot;
    (_c = (_a = root22._def)[_b = zuiKey]) != null || (_a[_b] = {});
    for (const [key, value] of Object.entries(data)) {
      root22._def[zuiKey] = __spreadProps(__spreadValues({}, root22._def[zuiKey]), {
        [key]: value
      });
    }
    return clone;
  }
  getMetadata() {
    return __spreadValues({}, this._metadataRoot._def[zuiKey]);
  }
  setMetadata(data) {
    this._metadataRoot._def[zuiKey] = __spreadValues({}, data);
  }
  get ui() {
    return __spreadValues({}, this._metadataRoot._def[zuiKey]);
  }
  get _metadataRoot() {
    return this.naked();
  }
  displayAs(options) {
    return this.metadata({ displayAs: [options.id, options.params] });
  }
  title(title) {
    return this.metadata({ title });
  }
  hidden(value) {
    let data;
    if (value === undefined) {
      data = true;
    } else if (typeof value === "function") {
      data = value.toString();
    } else {
      data = value;
    }
    return this.metadata({ hidden: data });
  }
  disabled(value) {
    let data;
    if (value === undefined) {
      data = true;
    } else if (typeof value === "function") {
      data = value.toString();
    } else {
      data = value;
    }
    return this.metadata({ disabled: data });
  }
  placeholder(placeholder) {
    return this.metadata({ placeholder });
  }
  toJSONSchema(_opts) {
    throw new _CircularDependencyError("toJSONSchema");
  }
  toTypescriptType(_opts) {
    throw new _CircularDependencyError("toTypescriptType");
  }
  toTypescriptSchema() {
    throw new _CircularDependencyError("toTypescriptSchema");
  }
  naked() {
    return this;
  }
};
__name(_ZodBaseTypeImpl, "ZodBaseTypeImpl");
var ZodBaseTypeImpl = _ZodBaseTypeImpl;
var _ZodAnyImpl = class _ZodAnyImpl2 extends ZodBaseTypeImpl {
  constructor() {
    super(...arguments);
    this._any = true;
  }
  _parse(input) {
    return { status: "valid", value: input.data };
  }
  isEqual(schema) {
    return schema instanceof _ZodAnyImpl2;
  }
};
__name(_ZodAnyImpl, "ZodAnyImpl");
var ZodAnyImpl = _ZodAnyImpl;
var _ZodArrayImpl = class _ZodArrayImpl2 extends ZodBaseTypeImpl {
  dereference(defs) {
    return new _ZodArrayImpl2(__spreadProps(__spreadValues({}, this._def), {
      type: this._def.type.dereference(defs)
    }));
  }
  getReferences() {
    return this._def.type.getReferences();
  }
  clone() {
    return new _ZodArrayImpl2(__spreadProps(__spreadValues({}, this._def), {
      type: this._def.type.clone()
    }));
  }
  isEqual(schema) {
    var _a, _b, _c, _d, _e, _f;
    if (!(schema instanceof _ZodArrayImpl2)) {
      return false;
    }
    return isEqual_default2((_a = this._def.exactLength) == null ? undefined : _a.value, (_b = schema._def.exactLength) == null ? undefined : _b.value) && isEqual_default2((_c = this._def.maxLength) == null ? undefined : _c.value, (_d = schema._def.maxLength) == null ? undefined : _d.value) && isEqual_default2((_e = this._def.minLength) == null ? undefined : _e.value, (_f = schema._def.minLength) == null ? undefined : _f.value) && this._def.type.isEqual(schema._def.type);
  }
  _parse(input) {
    const { ctx, status } = this._processInputParams(input);
    const def = this._def;
    if (ctx.parsedType !== "array") {
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "array",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    if (def.exactLength !== null) {
      const tooBig = ctx.data.length > def.exactLength.value;
      const tooSmall = ctx.data.length < def.exactLength.value;
      if (tooBig || tooSmall) {
        addIssueToContext(ctx, {
          code: tooBig ? "too_big" : "too_small",
          minimum: tooSmall ? def.exactLength.value : undefined,
          maximum: tooBig ? def.exactLength.value : undefined,
          type: "array",
          inclusive: true,
          exact: true,
          message: def.exactLength.message
        });
        status.dirty();
      }
    }
    if (def.minLength !== null) {
      if (ctx.data.length < def.minLength.value) {
        addIssueToContext(ctx, {
          code: "too_small",
          minimum: def.minLength.value,
          type: "array",
          inclusive: true,
          exact: false,
          message: def.minLength.message
        });
        status.dirty();
      }
    }
    if (def.maxLength !== null) {
      if (ctx.data.length > def.maxLength.value) {
        addIssueToContext(ctx, {
          code: "too_big",
          maximum: def.maxLength.value,
          type: "array",
          inclusive: true,
          exact: false,
          message: def.maxLength.message
        });
        status.dirty();
      }
    }
    if (ctx.common.async) {
      return Promise.all([...ctx.data].map((item, i) => {
        return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
      })).then((result2) => {
        return ParseStatus.mergeArray(status, result2);
      });
    }
    const result = [...ctx.data].map((item, i) => {
      return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
    });
    return ParseStatus.mergeArray(status, result);
  }
  get element() {
    return this._def.type;
  }
  min(minLength, message) {
    return new _ZodArrayImpl2(__spreadProps(__spreadValues({}, this._def), {
      minLength: { value: minLength, message: error_utils_exports.toString(message) }
    }));
  }
  max(maxLength, message) {
    return new _ZodArrayImpl2(__spreadProps(__spreadValues({}, this._def), {
      maxLength: { value: maxLength, message: error_utils_exports.toString(message) }
    }));
  }
  length(len, message) {
    return new _ZodArrayImpl2(__spreadProps(__spreadValues({}, this._def), {
      exactLength: { value: len, message: error_utils_exports.toString(message) }
    }));
  }
  nonempty(message) {
    return this.min(1, message);
  }
};
__name(_ZodArrayImpl, "ZodArrayImpl");
var ZodArrayImpl = _ZodArrayImpl;
var _ZodBigIntImpl = class _ZodBigIntImpl2 extends ZodBaseTypeImpl {
  constructor() {
    super(...arguments);
    this.min = this.gte;
    this.max = this.lte;
  }
  _parse(input) {
    if (this._def.coerce) {
      input.data = BigInt(input.data);
    }
    const parsedType = this._getType(input);
    if (parsedType !== "bigint") {
      const ctx2 = this._getOrReturnCtx(input);
      addIssueToContext(ctx2, {
        code: "invalid_type",
        expected: "bigint",
        received: ctx2.parsedType
      });
      return { status: "aborted" };
    }
    let ctx = undefined;
    const status = new ParseStatus;
    for (const check of this._def.checks) {
      if (check.kind === "min") {
        const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
        if (tooSmall) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "too_small",
            type: "bigint",
            minimum: check.value,
            inclusive: check.inclusive,
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "max") {
        const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
        if (tooBig) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "too_big",
            type: "bigint",
            maximum: check.value,
            inclusive: check.inclusive,
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "multipleOf") {
        if (input.data % check.value !== BigInt(0)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "not_multiple_of",
            multipleOf: check.value,
            message: check.message
          });
          status.dirty();
        }
      } else {
        assert_utils_exports.assertNever(check);
      }
    }
    return { status: status.value, value: input.data };
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodBigIntImpl2)) {
      return false;
    }
    if (this._def.coerce !== schema._def.coerce)
      return false;
    const thisChecks = new ds_utils_exports.CustomSet(this._def.checks);
    const thatChecks = new ds_utils_exports.CustomSet(schema._def.checks);
    return thisChecks.isEqual(thatChecks);
  }
  gte(value, message) {
    return this.setLimit("min", value, true, error_utils_exports.toString(message));
  }
  gt(value, message) {
    return this.setLimit("min", value, false, error_utils_exports.toString(message));
  }
  lte(value, message) {
    return this.setLimit("max", value, true, error_utils_exports.toString(message));
  }
  lt(value, message) {
    return this.setLimit("max", value, false, error_utils_exports.toString(message));
  }
  setLimit(kind, value, inclusive, message) {
    return new _ZodBigIntImpl2(__spreadProps(__spreadValues({}, this._def), {
      checks: [
        ...this._def.checks,
        {
          kind,
          value,
          inclusive,
          message: error_utils_exports.toString(message)
        }
      ]
    }));
  }
  _addCheck(check) {
    return new _ZodBigIntImpl2(__spreadProps(__spreadValues({}, this._def), {
      checks: [...this._def.checks, check]
    }));
  }
  positive(message) {
    return this._addCheck({
      kind: "min",
      value: BigInt(0),
      inclusive: false,
      message: error_utils_exports.toString(message)
    });
  }
  negative(message) {
    return this._addCheck({
      kind: "max",
      value: BigInt(0),
      inclusive: false,
      message: error_utils_exports.toString(message)
    });
  }
  nonpositive(message) {
    return this._addCheck({
      kind: "max",
      value: BigInt(0),
      inclusive: true,
      message: error_utils_exports.toString(message)
    });
  }
  nonnegative(message) {
    return this._addCheck({
      kind: "min",
      value: BigInt(0),
      inclusive: true,
      message: error_utils_exports.toString(message)
    });
  }
  multipleOf(value, message) {
    return this._addCheck({
      kind: "multipleOf",
      value,
      message: error_utils_exports.toString(message)
    });
  }
  get minValue() {
    let min = null;
    for (const ch of this._def.checks) {
      if (ch.kind === "min") {
        if (min === null || ch.value > min)
          min = ch.value;
      }
    }
    return min;
  }
  get maxValue() {
    let max = null;
    for (const ch of this._def.checks) {
      if (ch.kind === "max") {
        if (max === null || ch.value < max)
          max = ch.value;
      }
    }
    return max;
  }
};
__name(_ZodBigIntImpl, "ZodBigIntImpl");
var ZodBigIntImpl = _ZodBigIntImpl;
var _ZodBooleanImpl = class _ZodBooleanImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    if (this._def.coerce) {
      input.data = Boolean(input.data);
    }
    const parsedType = this._getType(input);
    if (parsedType !== "boolean") {
      const ctx = this._getOrReturnCtx(input);
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "boolean",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    return { status: "valid", value: input.data };
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodBooleanImpl2))
      return false;
    return this._def.coerce === schema._def.coerce;
  }
};
__name(_ZodBooleanImpl, "ZodBooleanImpl");
var ZodBooleanImpl = _ZodBooleanImpl;
var _ZodBrandedImpl = class _ZodBrandedImpl2 extends ZodBaseTypeImpl {
  dereference(defs) {
    return new _ZodBrandedImpl2(__spreadProps(__spreadValues({}, this._def), {
      type: this._def.type.dereference(defs)
    }));
  }
  getReferences() {
    return this._def.type.getReferences();
  }
  clone() {
    return new _ZodBrandedImpl2(__spreadProps(__spreadValues({}, this._def), {
      type: this._def.type.clone()
    }));
  }
  _parse(input) {
    const { ctx } = this._processInputParams(input);
    const data = ctx.data;
    return this._def.type._parse({
      data,
      path: ctx.path,
      parent: ctx
    });
  }
  unwrap() {
    return this._def.type;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodBrandedImpl2))
      return false;
    return this._def.type.isEqual(schema._def.type);
  }
  naked() {
    return this._def.type.naked();
  }
  mandatory() {
    return new _ZodBrandedImpl2(__spreadProps(__spreadValues({}, this._def), {
      type: this._def.type.mandatory()
    }));
  }
};
__name(_ZodBrandedImpl, "ZodBrandedImpl");
var ZodBrandedImpl = _ZodBrandedImpl;
var _ZodCatchImpl = class _ZodCatchImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    const { ctx } = this._processInputParams(input);
    const newCtx = __spreadProps(__spreadValues({}, ctx), {
      common: __spreadProps(__spreadValues({}, ctx.common), {
        issues: []
      })
    });
    const result = this._def.innerType._parse({
      data: newCtx.data,
      path: newCtx.path,
      parent: __spreadValues({}, newCtx)
    });
    if (isAsync(result)) {
      return result.then((result2) => {
        return {
          status: "valid",
          value: result2.status === "valid" ? result2.value : this._def.catchValue({
            get error() {
              return new ZodError(newCtx.common.issues);
            },
            input: newCtx.data
          })
        };
      });
    } else {
      return {
        status: "valid",
        value: result.status === "valid" ? result.value : this._def.catchValue({
          get error() {
            return new ZodError(newCtx.common.issues);
          },
          input: newCtx.data
        })
      };
    }
  }
  removeCatch() {
    return this._def.innerType;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodCatchImpl2))
      return false;
    return this._def.innerType.isEqual(schema._def.innerType) && other_utils_exports.compareFunctions(this._def.catchValue, schema._def.catchValue);
  }
  dereference(defs) {
    return new _ZodCatchImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.dereference(defs)
    }));
  }
  getReferences() {
    return this._def.innerType.getReferences();
  }
  clone() {
    return new _ZodCatchImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.clone()
    }));
  }
  naked() {
    return this._def.innerType.naked();
  }
  mandatory() {
    return new _ZodCatchImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.mandatory()
    }));
  }
};
__name(_ZodCatchImpl, "ZodCatchImpl");
var ZodCatchImpl = _ZodCatchImpl;
var _ZodDateImpl = class _ZodDateImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    if (this._def.coerce) {
      input.data = new Date(input.data);
    }
    const parsedType = this._getType(input);
    if (parsedType !== "date") {
      const ctx2 = this._getOrReturnCtx(input);
      addIssueToContext(ctx2, {
        code: "invalid_type",
        expected: "date",
        received: ctx2.parsedType
      });
      return { status: "aborted" };
    }
    if (isNaN(input.data.getTime())) {
      const ctx2 = this._getOrReturnCtx(input);
      addIssueToContext(ctx2, {
        code: "invalid_date"
      });
      return { status: "aborted" };
    }
    const status = new ParseStatus;
    let ctx = undefined;
    for (const check of this._def.checks) {
      if (check.kind === "min") {
        if (input.data.getTime() < check.value) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "too_small",
            message: check.message,
            inclusive: true,
            exact: false,
            minimum: check.value,
            type: "date"
          });
          status.dirty();
        }
      } else if (check.kind === "max") {
        if (input.data.getTime() > check.value) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "too_big",
            message: check.message,
            inclusive: true,
            exact: false,
            maximum: check.value,
            type: "date"
          });
          status.dirty();
        }
      } else {
        assert_utils_exports.assertNever(check);
      }
    }
    return {
      status: status.value,
      value: new Date(input.data.getTime())
    };
  }
  _addCheck(check) {
    return new _ZodDateImpl2(__spreadProps(__spreadValues({}, this._def), {
      checks: [...this._def.checks, check]
    }));
  }
  min(minDate, message) {
    return this._addCheck({
      kind: "min",
      value: minDate.getTime(),
      message: error_utils_exports.toString(message)
    });
  }
  max(maxDate, message) {
    return this._addCheck({
      kind: "max",
      value: maxDate.getTime(),
      message: error_utils_exports.toString(message)
    });
  }
  get minDate() {
    let min = null;
    for (const ch of this._def.checks) {
      if (ch.kind === "min") {
        if (min === null || ch.value > min)
          min = ch.value;
      }
    }
    return min != null ? new Date(min) : null;
  }
  get maxDate() {
    let max = null;
    for (const ch of this._def.checks) {
      if (ch.kind === "max") {
        if (max === null || ch.value < max)
          max = ch.value;
      }
    }
    return max != null ? new Date(max) : null;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodDateImpl2))
      return false;
    const thisChecks = new ds_utils_exports.CustomSet(this._def.checks);
    const thatChecks = new ds_utils_exports.CustomSet(schema._def.checks);
    return thisChecks.isEqual(thatChecks) && this._def.coerce === schema._def.coerce;
  }
};
__name(_ZodDateImpl, "ZodDateImpl");
var ZodDateImpl = _ZodDateImpl;
var _ZodDefaultImpl = class _ZodDefaultImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    const { ctx } = this._processInputParams(input);
    let data = ctx.data;
    if (ctx.parsedType === "undefined") {
      data = this._def.defaultValue();
    }
    return this._def.innerType._parse({
      data,
      path: ctx.path,
      parent: ctx
    });
  }
  removeDefault() {
    return this._def.innerType;
  }
  dereference(defs) {
    return new _ZodDefaultImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.dereference(defs)
    }));
  }
  getReferences() {
    return this._def.innerType.getReferences();
  }
  clone() {
    return new _ZodDefaultImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.clone()
    }));
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodDefaultImpl2))
      return false;
    return this._def.innerType.isEqual(schema._def.innerType) && isEqual_default2(this._def.defaultValue(), schema._def.defaultValue());
  }
  unwrap() {
    return this._def.innerType;
  }
  naked() {
    return this._def.innerType.naked();
  }
  mandatory() {
    return new _ZodDefaultImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.mandatory()
    }));
  }
};
__name(_ZodDefaultImpl, "ZodDefaultImpl");
var ZodDefaultImpl = _ZodDefaultImpl;
var getDiscriminator = /* @__PURE__ */ __name((_type) => {
  const type = _type;
  if (!type)
    return [];
  if (type.typeName === "ZodLazy") {
    return getDiscriminator(type.schema);
  } else if (type.typeName === "ZodEffects") {
    return getDiscriminator(type.innerType());
  } else if (type.typeName === "ZodLiteral") {
    return [type.value];
  } else if (type.typeName === "ZodEnum") {
    return type.options;
  } else if (type.typeName === "ZodNativeEnum") {
    return Object.values(type.enum);
  } else if (type.typeName === "ZodDefault") {
    return getDiscriminator(type._def.innerType);
  } else if (type.typeName === "ZodUndefined") {
    return [undefined];
  } else if (type.typeName === "ZodNull") {
    return [null];
  } else if (type.typeName === "ZodOptional") {
    return [undefined, ...getDiscriminator(type.unwrap())];
  } else if (type.typeName === "ZodNullable") {
    return [null, ...getDiscriminator(type.unwrap())];
  } else if (type.typeName === "ZodBranded") {
    return getDiscriminator(type.unwrap());
  } else if (type.typeName === "ZodReadonly") {
    return getDiscriminator(type.unwrap());
  } else if (type.typeName === "ZodCatch") {
    return getDiscriminator(type._def.innerType);
  } else {
    return [];
  }
}, "getDiscriminator");
var _ZodDiscriminatedUnionImpl = class _ZodDiscriminatedUnionImpl2 extends ZodBaseTypeImpl {
  constructor(def) {
    const optionsMap = _ZodDiscriminatedUnionImpl2._getOptionsMap(def.discriminator, def.options);
    super(__spreadProps(__spreadValues({}, def), {
      optionsMap
    }));
  }
  dereference(defs) {
    const options = this.options.map((option) => option.dereference(defs));
    return new _ZodDiscriminatedUnionImpl2(__spreadProps(__spreadValues({}, this._def), {
      options
    }));
  }
  getReferences() {
    return fn_utils_exports.unique(this.options.flatMap((option) => option.getReferences()));
  }
  clone() {
    const options = this.options.map((option) => option.clone());
    return new _ZodDiscriminatedUnionImpl2(__spreadProps(__spreadValues({}, this._def), {
      options
    }));
  }
  _parse(input) {
    const { ctx } = this._processInputParams(input);
    if (ctx.parsedType !== "object") {
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "object",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    const discriminator = this.discriminator;
    const discriminatorValue = ctx.data[discriminator];
    const option = this.optionsMap.get(discriminatorValue);
    if (!option) {
      addIssueToContext(ctx, {
        code: "invalid_union_discriminator",
        options: Array.from(this.optionsMap.keys()),
        path: [discriminator]
      });
      return { status: "aborted" };
    }
    if (ctx.common.async) {
      return option._parseAsync({
        data: ctx.data,
        path: ctx.path,
        parent: ctx
      });
    } else {
      return option._parseSync({
        data: ctx.data,
        path: ctx.path,
        parent: ctx
      });
    }
  }
  get discriminator() {
    return this._def.discriminator;
  }
  get options() {
    return this._def.options;
  }
  get optionsMap() {
    return this._def.optionsMap;
  }
  static _getOptionsMap(discriminator, options) {
    const optionsMap = /* @__PURE__ */ new Map;
    for (const type of options) {
      const discriminatorValues = getDiscriminator(type.shape[discriminator]);
      if (!discriminatorValues.length) {
        throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
      }
      for (const value of discriminatorValues) {
        if (optionsMap.has(value)) {
          throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
        }
        optionsMap.set(value, type);
      }
    }
    return optionsMap;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodDiscriminatedUnionImpl2))
      return false;
    if (this._def.discriminator !== schema._def.discriminator)
      return false;
    const compare = /* @__PURE__ */ __name((a, b) => a.isEqual(b), "compare");
    const thisOptions = new ds_utils_exports.CustomSet(this._def.options, { compare });
    const thatOptions = new ds_utils_exports.CustomSet(schema._def.options, { compare });
    return thisOptions.isEqual(thatOptions);
  }
};
__name(_ZodDiscriminatedUnionImpl, "ZodDiscriminatedUnionImpl");
var ZodDiscriminatedUnionImpl = _ZodDiscriminatedUnionImpl;
var _ZodEnumImpl = class _ZodEnumImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    if (typeof input.data !== "string") {
      const ctx = this._getOrReturnCtx(input);
      const expectedValues = this._def.values;
      addIssueToContext(ctx, {
        expected: other_utils_exports.joinValues(expectedValues),
        received: ctx.parsedType,
        code: "invalid_type"
      });
      return { status: "aborted" };
    }
    if (this._def.values.indexOf(input.data) === -1) {
      const ctx = this._getOrReturnCtx(input);
      const expectedValues = this._def.values;
      addIssueToContext(ctx, {
        received: ctx.data,
        code: "invalid_enum_value",
        options: expectedValues
      });
      return { status: "aborted" };
    }
    return { status: "valid", value: input.data };
  }
  get options() {
    return this._def.values;
  }
  get enum() {
    const enumValues = {};
    for (const val of this._def.values) {
      enumValues[val] = val;
    }
    return enumValues;
  }
  get Values() {
    return this.enum;
  }
  get Enum() {
    return this.enum;
  }
  extract(values, newDef = this._def) {
    return builders.enum(values, __spreadValues(__spreadValues({}, this._def), newDef));
  }
  exclude(values, newDef = this._def) {
    return builders.enum(this.options.filter((opt) => !values.includes(opt)), __spreadValues(__spreadValues({}, this._def), newDef));
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodEnumImpl2))
      return false;
    const thisValues = new ds_utils_exports.CustomSet(this._def.values);
    const thatValues = new ds_utils_exports.CustomSet(schema._def.values);
    return thisValues.isEqual(thatValues);
  }
};
__name(_ZodEnumImpl, "ZodEnumImpl");
var ZodEnumImpl = _ZodEnumImpl;
var _ZodFunctionImpl = class _ZodFunctionImpl2 extends ZodBaseTypeImpl {
  constructor() {
    super(...arguments);
    this.validate = this.implement;
  }
  dereference(defs) {
    const args = this._def.args.dereference(defs);
    const returns = this._def.returns.dereference(defs);
    return new _ZodFunctionImpl2(__spreadProps(__spreadValues({}, this._def), {
      args,
      returns
    }));
  }
  getReferences() {
    return fn_utils_exports.unique([...this._def.args.getReferences(), ...this._def.returns.getReferences()]);
  }
  clone() {
    return new _ZodFunctionImpl2(__spreadProps(__spreadValues({}, this._def), {
      args: this._def.args.clone(),
      returns: this._def.returns.clone()
    }));
  }
  _parse(input) {
    const { ctx } = this._processInputParams(input);
    if (ctx.parsedType !== "function") {
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "function",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    function makeArgsIssue(args, error) {
      return makeIssue({
        data: args,
        path: ctx.path,
        errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), errorMap].filter((x) => !!x),
        issueData: {
          code: "invalid_arguments",
          argumentsError: error
        }
      });
    }
    __name(makeArgsIssue, "makeArgsIssue");
    function makeReturnsIssue(returns2, error) {
      return makeIssue({
        data: returns2,
        path: ctx.path,
        errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), errorMap].filter((x) => !!x),
        issueData: {
          code: "invalid_return_type",
          returnTypeError: error
        }
      });
    }
    __name(makeReturnsIssue, "makeReturnsIssue");
    const params = { errorMap: ctx.common.contextualErrorMap };
    const fn = ctx.data;
    const me = this;
    const returns = this._def.returns;
    if (is.zuiPromise(returns)) {
      return {
        status: "valid",
        async value(...args) {
          const error = new ZodError([]);
          const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
            error.addIssue(makeArgsIssue(args, e));
            throw error;
          });
          const result = await Reflect.apply(fn, this, parsedArgs);
          const parsedReturns = await returns._def.type.parseAsync(result, params).catch((e) => {
            if (!is.zuiError(e)) {
              throw e;
            }
            error.addIssue(makeReturnsIssue(result, e));
            throw error;
          });
          return parsedReturns;
        }
      };
    } else {
      return {
        status: "valid",
        value(...args) {
          const parsedArgs = me._def.args.safeParse(args, params);
          if (!parsedArgs.success) {
            throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
          }
          const result = Reflect.apply(fn, this, parsedArgs.data);
          const parsedReturns = me._def.returns.safeParse(result, params);
          if (!parsedReturns.success) {
            throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
          }
          return parsedReturns.data;
        }
      };
    }
  }
  parameters() {
    return this._def.args;
  }
  returnType() {
    return this._def.returns;
  }
  args(...items) {
    return new _ZodFunctionImpl2(__spreadProps(__spreadValues({}, this._def), {
      args: builders.tuple(items).rest(builders.unknown())
    }));
  }
  returns(returnType) {
    return new _ZodFunctionImpl2(__spreadProps(__spreadValues({}, this._def), {
      returns: returnType
    }));
  }
  implement(func) {
    const validatedFunc = this.parse(func);
    return validatedFunc;
  }
  strictImplement(func) {
    const validatedFunc = this.parse(func);
    return validatedFunc;
  }
  isEqual(schema) {
    return schema instanceof _ZodFunctionImpl2 && this._def.args.isEqual(schema._def.args) && this._def.returns.isEqual(schema._def.returns);
  }
};
__name(_ZodFunctionImpl, "ZodFunctionImpl");
var ZodFunctionImpl = _ZodFunctionImpl;
var _ZodIntersectionImpl = class _ZodIntersectionImpl2 extends ZodBaseTypeImpl {
  dereference(defs) {
    return new _ZodIntersectionImpl2(__spreadProps(__spreadValues({}, this._def), {
      left: this._def.left.dereference(defs),
      right: this._def.right.dereference(defs)
    }));
  }
  getReferences() {
    return fn_utils_exports.unique([...this._def.left.getReferences(), ...this._def.right.getReferences()]);
  }
  clone() {
    return new _ZodIntersectionImpl2(__spreadProps(__spreadValues({}, this._def), {
      left: this._def.left.clone(),
      right: this._def.right.clone()
    }));
  }
  _parse(input) {
    const { status, ctx } = this._processInputParams(input);
    const handleParsed = /* @__PURE__ */ __name((parsedLeft, parsedRight) => {
      if (parsedLeft.status === "aborted" || parsedRight.status === "aborted") {
        return { status: "aborted" };
      }
      const merged = this._mergeValues(parsedLeft.value, parsedRight.value);
      if (!merged.valid) {
        addIssueToContext(ctx, {
          code: "invalid_intersection_types"
        });
        return { status: "aborted" };
      }
      if (parsedLeft.status === "dirty" || parsedRight.status === "dirty") {
        status.dirty();
      }
      return { status: status.value, value: merged.data };
    }, "handleParsed");
    if (ctx.common.async) {
      return Promise.all([
        this._def.left._parseAsync({
          data: ctx.data,
          path: ctx.path,
          parent: ctx
        }),
        this._def.right._parseAsync({
          data: ctx.data,
          path: ctx.path,
          parent: ctx
        })
      ]).then(([left, right]) => handleParsed(left, right));
    } else {
      return handleParsed(this._def.left._parseSync({
        data: ctx.data,
        path: ctx.path,
        parent: ctx
      }), this._def.right._parseSync({
        data: ctx.data,
        path: ctx.path,
        parent: ctx
      }));
    }
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodIntersectionImpl2))
      return false;
    const compare = /* @__PURE__ */ __name((a, b) => a.isEqual(b), "compare");
    const thisItems = new ds_utils_exports.CustomSet([this._def.left, this._def.right], { compare });
    const thatItems = new ds_utils_exports.CustomSet([schema._def.left, schema._def.right], { compare });
    return thisItems.isEqual(thatItems);
  }
  _mergeValues(a, b) {
    const aType = getParsedType(a);
    const bType = getParsedType(b);
    if (a === b) {
      return { valid: true, data: a };
    } else if (aType === "object" && bType === "object") {
      const bKeys = Object.keys(b);
      const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
      const newObj = __spreadValues(__spreadValues({}, a), b);
      for (const key of sharedKeys) {
        const sharedValue = this._mergeValues(a[key], b[key]);
        if (!sharedValue.valid) {
          return { valid: false };
        }
        newObj[key] = sharedValue.data;
      }
      return { valid: true, data: newObj };
    } else if (aType === "array" && bType === "array") {
      if (a.length !== b.length) {
        return { valid: false };
      }
      const newArray = [];
      for (let index = 0;index < a.length; index++) {
        const itemA = a[index];
        const itemB = b[index];
        const sharedValue = this._mergeValues(itemA, itemB);
        if (!sharedValue.valid) {
          return { valid: false };
        }
        newArray.push(sharedValue.data);
      }
      return { valid: true, data: newArray };
    } else if (aType === "date" && bType === "date" && +a === +b) {
      return { valid: true, data: a };
    } else {
      return { valid: false };
    }
  }
};
__name(_ZodIntersectionImpl, "ZodIntersectionImpl");
var ZodIntersectionImpl = _ZodIntersectionImpl;
var _ZodLazyImpl = class _ZodLazyImpl2 extends ZodBaseTypeImpl {
  get schema() {
    return this._def.getter();
  }
  dereference(defs) {
    return new _ZodLazyImpl2(__spreadProps(__spreadValues({}, this._def), {
      getter: () => this._def.getter().dereference(defs)
    }));
  }
  getReferences() {
    return this._def.getter().getReferences();
  }
  clone() {
    return new _ZodLazyImpl2(__spreadProps(__spreadValues({}, this._def), {
      getter: () => this._def.getter().clone()
    }));
  }
  _parse(input) {
    const { ctx } = this._processInputParams(input);
    const lazySchema = this._def.getter();
    return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodLazyImpl2))
      return false;
    return this._def.getter().isEqual(schema._def.getter());
  }
  naked() {
    return this._def.getter().naked();
  }
  mandatory() {
    return new _ZodLazyImpl2(__spreadProps(__spreadValues({}, this._def), {
      getter: () => this._def.getter().mandatory()
    }));
  }
};
__name(_ZodLazyImpl, "ZodLazyImpl");
var ZodLazyImpl = _ZodLazyImpl;
var _ZodLiteralImpl = class _ZodLiteralImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    if (input.data !== this._def.value) {
      const ctx = this._getOrReturnCtx(input);
      addIssueToContext(ctx, {
        received: ctx.data,
        code: "invalid_literal",
        expected: this._def.value
      });
      return { status: "aborted" };
    }
    return { status: "valid", value: input.data };
  }
  get value() {
    return this._def.value;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodLiteralImpl2))
      return false;
    return isEqual_default2(this._def.value, schema._def.value);
  }
};
__name(_ZodLiteralImpl, "ZodLiteralImpl");
var ZodLiteralImpl = _ZodLiteralImpl;
var _ZodMapImpl = class _ZodMapImpl2 extends ZodBaseTypeImpl {
  get keySchema() {
    return this._def.keyType;
  }
  get valueSchema() {
    return this._def.valueType;
  }
  dereference(defs) {
    const keyType = this._def.keyType.dereference(defs);
    const valueType = this._def.valueType.dereference(defs);
    return new _ZodMapImpl2(__spreadProps(__spreadValues({}, this._def), {
      keyType,
      valueType
    }));
  }
  getReferences() {
    return fn_utils_exports.unique([...this._def.keyType.getReferences(), ...this._def.valueType.getReferences()]);
  }
  clone() {
    return new _ZodMapImpl2(__spreadProps(__spreadValues({}, this._def), {
      keyType: this._def.keyType.clone(),
      valueType: this._def.valueType.clone()
    }));
  }
  _parse(input) {
    const { status, ctx } = this._processInputParams(input);
    if (ctx.parsedType !== "map") {
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "map",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    const keyType = this._def.keyType;
    const valueType = this._def.valueType;
    const pairs = [...ctx.data.entries()].map(([key, value], index) => {
      return {
        key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
        value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
      };
    });
    if (ctx.common.async) {
      const finalMap = /* @__PURE__ */ new Map;
      return Promise.resolve().then(async () => {
        for (const pair of pairs) {
          const key = await pair.key;
          const value = await pair.value;
          if (key.status === "aborted" || value.status === "aborted") {
            return { status: "aborted" };
          }
          if (key.status === "dirty" || value.status === "dirty") {
            status.dirty();
          }
          finalMap.set(key.value, value.value);
        }
        return { status: status.value, value: finalMap };
      });
    } else {
      const finalMap = /* @__PURE__ */ new Map;
      for (const pair of pairs) {
        const key = pair.key;
        const value = pair.value;
        if (key.status === "aborted" || value.status === "aborted") {
          return { status: "aborted" };
        }
        if (key.status === "dirty" || value.status === "dirty") {
          status.dirty();
        }
        finalMap.set(key.value, value.value);
      }
      return { status: status.value, value: finalMap };
    }
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodMapImpl2))
      return false;
    if (!this._def.keyType.isEqual(schema._def.keyType))
      return false;
    if (!this._def.valueType.isEqual(schema._def.valueType))
      return false;
    return true;
  }
};
__name(_ZodMapImpl, "ZodMapImpl");
var ZodMapImpl = _ZodMapImpl;
var _ZodNaNImpl = class _ZodNaNImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    const parsedType = this._getType(input);
    if (parsedType !== "nan") {
      const ctx = this._getOrReturnCtx(input);
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "nan",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    return { status: "valid", value: input.data };
  }
  isEqual(schema) {
    return schema instanceof _ZodNaNImpl2;
  }
};
__name(_ZodNaNImpl, "ZodNaNImpl");
var ZodNaNImpl = _ZodNaNImpl;
var _ZodNativeEnumImpl = class _ZodNativeEnumImpl2 extends ZodBaseTypeImpl {
  constructor() {
    super(...arguments);
    this._getValidEnumValues = /* @__PURE__ */ __name((obj) => {
      const validKeys = Object.keys(obj).filter((k) => typeof obj[obj[k]] !== "number");
      const filtered = {};
      for (const k of validKeys) {
        filtered[k] = obj[k];
      }
      return Object.values(filtered);
    }, "_getValidEnumValues");
  }
  _parse(input) {
    const nativeEnumValues = this._getValidEnumValues(this._def.values);
    const ctx = this._getOrReturnCtx(input);
    if (ctx.parsedType !== "string" && ctx.parsedType !== "number") {
      const expectedValues = Object.values(nativeEnumValues);
      addIssueToContext(ctx, {
        expected: other_utils_exports.joinValues(expectedValues),
        received: ctx.parsedType,
        code: "invalid_type"
      });
      return { status: "aborted" };
    }
    if (nativeEnumValues.indexOf(input.data) === -1) {
      const expectedValues = Object.values(nativeEnumValues);
      addIssueToContext(ctx, {
        received: ctx.data,
        code: "invalid_enum_value",
        options: expectedValues
      });
      return { status: "aborted" };
    }
    return { status: "valid", value: input.data };
  }
  get enum() {
    return this._def.values;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodNativeEnumImpl2))
      return false;
    return isEqual_default2(this._def.values, schema._def.values);
  }
};
__name(_ZodNativeEnumImpl, "ZodNativeEnumImpl");
var ZodNativeEnumImpl = _ZodNativeEnumImpl;
var _ZodNeverImpl = class _ZodNeverImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    const ctx = this._getOrReturnCtx(input);
    addIssueToContext(ctx, {
      code: "invalid_type",
      expected: "never",
      received: ctx.parsedType
    });
    return { status: "aborted" };
  }
  isEqual(schema) {
    return schema instanceof _ZodNeverImpl2;
  }
};
__name(_ZodNeverImpl, "ZodNeverImpl");
var ZodNeverImpl = _ZodNeverImpl;
var _ZodNullImpl = class _ZodNullImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    const parsedType = this._getType(input);
    if (parsedType !== "null") {
      const ctx = this._getOrReturnCtx(input);
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "null",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    return { status: "valid", value: input.data };
  }
  isEqual(schema) {
    return schema instanceof _ZodNullImpl2;
  }
};
__name(_ZodNullImpl, "ZodNullImpl");
var ZodNullImpl = _ZodNullImpl;
var _ZodNullableImpl = class _ZodNullableImpl2 extends ZodBaseTypeImpl {
  dereference(defs) {
    return new _ZodNullableImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.dereference(defs)
    }));
  }
  getReferences() {
    return this._def.innerType.getReferences();
  }
  clone() {
    return new _ZodNullableImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.clone()
    }));
  }
  _parse(input) {
    const parsedType = this._getType(input);
    if (parsedType === "null") {
      return { status: "valid", value: null };
    }
    return this._def.innerType._parse(input);
  }
  unwrap() {
    return this._def.innerType;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodNullableImpl2))
      return false;
    return this._def.innerType.isEqual(schema._def.innerType);
  }
  naked() {
    return this._def.innerType.naked();
  }
  mandatory() {
    return new _ZodNullableImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.mandatory()
    }));
  }
};
__name(_ZodNullableImpl, "ZodNullableImpl");
var ZodNullableImpl = _ZodNullableImpl;
var _ZodNumberImpl = class _ZodNumberImpl2 extends ZodBaseTypeImpl {
  constructor() {
    super(...arguments);
    this.min = this.gte;
    this.max = this.lte;
    this.step = this.multipleOf;
  }
  _parse(input) {
    if (this._def.coerce) {
      input.data = Number(input.data);
    }
    const parsedType = this._getType(input);
    if (parsedType !== "number") {
      const ctx2 = this._getOrReturnCtx(input);
      addIssueToContext(ctx2, {
        code: "invalid_type",
        expected: "number",
        received: ctx2.parsedType
      });
      return { status: "aborted" };
    }
    let ctx = undefined;
    const status = new ParseStatus;
    for (const check of this._def.checks) {
      if (check.kind === "int") {
        if (!Number.isInteger(input.data)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "invalid_type",
            expected: "integer",
            received: "float",
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "min") {
        const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
        if (tooSmall) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "too_small",
            minimum: check.value,
            type: "number",
            inclusive: check.inclusive,
            exact: false,
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "max") {
        const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
        if (tooBig) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "too_big",
            maximum: check.value,
            type: "number",
            inclusive: check.inclusive,
            exact: false,
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "multipleOf") {
        if (this._floatSafeRemainder(input.data, check.value) !== 0) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "not_multiple_of",
            multipleOf: check.value,
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "finite") {
        if (!Number.isFinite(input.data)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "not_finite",
            message: check.message
          });
          status.dirty();
        }
      } else {
        assert_utils_exports.assertNever(check);
      }
    }
    return { status: status.value, value: input.data };
  }
  gte(value, message) {
    return this.setLimit("min", value, true, error_utils_exports.toString(message));
  }
  gt(value, message) {
    return this.setLimit("min", value, false, error_utils_exports.toString(message));
  }
  lte(value, message) {
    return this.setLimit("max", value, true, error_utils_exports.toString(message));
  }
  lt(value, message) {
    return this.setLimit("max", value, false, error_utils_exports.toString(message));
  }
  setLimit(kind, value, inclusive, message) {
    return new _ZodNumberImpl2(__spreadProps(__spreadValues({}, this._def), {
      checks: [
        ...this._def.checks,
        {
          kind,
          value,
          inclusive,
          message: error_utils_exports.toString(message)
        }
      ]
    }));
  }
  _addCheck(check) {
    return new _ZodNumberImpl2(__spreadProps(__spreadValues({}, this._def), {
      checks: [...this._def.checks, check]
    }));
  }
  int(message) {
    return this._addCheck({
      kind: "int",
      message: error_utils_exports.toString(message)
    });
  }
  positive(message) {
    return this._addCheck({
      kind: "min",
      value: 0,
      inclusive: false,
      message: error_utils_exports.toString(message)
    });
  }
  negative(message) {
    return this._addCheck({
      kind: "max",
      value: 0,
      inclusive: false,
      message: error_utils_exports.toString(message)
    });
  }
  nonpositive(message) {
    return this._addCheck({
      kind: "max",
      value: 0,
      inclusive: true,
      message: error_utils_exports.toString(message)
    });
  }
  nonnegative(message) {
    return this._addCheck({
      kind: "min",
      value: 0,
      inclusive: true,
      message: error_utils_exports.toString(message)
    });
  }
  multipleOf(value, message) {
    return this._addCheck({
      kind: "multipleOf",
      value,
      message: error_utils_exports.toString(message)
    });
  }
  finite(message) {
    return this._addCheck({
      kind: "finite",
      message: error_utils_exports.toString(message)
    });
  }
  safe(message) {
    return this._addCheck({
      kind: "min",
      inclusive: true,
      value: Number.MIN_SAFE_INTEGER,
      message: error_utils_exports.toString(message)
    })._addCheck({
      kind: "max",
      inclusive: true,
      value: Number.MAX_SAFE_INTEGER,
      message: error_utils_exports.toString(message)
    });
  }
  get minValue() {
    let min = null;
    for (const ch of this._def.checks) {
      if (ch.kind === "min") {
        if (min === null || ch.value > min)
          min = ch.value;
      }
    }
    return min;
  }
  get maxValue() {
    let max = null;
    for (const ch of this._def.checks) {
      if (ch.kind === "max") {
        if (max === null || ch.value < max)
          max = ch.value;
      }
    }
    return max;
  }
  get isInt() {
    return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && Number.isInteger(ch.value));
  }
  get isFinite() {
    let max = null, min = null;
    for (const ch of this._def.checks) {
      if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
        return true;
      } else if (ch.kind === "min") {
        if (min === null || ch.value > min)
          min = ch.value;
      } else if (ch.kind === "max") {
        if (max === null || ch.value < max)
          max = ch.value;
      }
    }
    return Number.isFinite(min) && Number.isFinite(max);
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodNumberImpl2))
      return false;
    const thisChecks = new ds_utils_exports.CustomSet(this._def.checks);
    const thatChecks = new ds_utils_exports.CustomSet(schema._def.checks);
    return thisChecks.isEqual(thatChecks);
  }
  _floatSafeRemainder(val, step) {
    const valDecCount = (val.toString().split(".")[1] || "").length;
    const stepDecCount = (step.toString().split(".")[1] || "").length;
    const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
    const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
    const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
    return valInt % stepInt / Math.pow(10, decCount);
  }
};
__name(_ZodNumberImpl, "ZodNumberImpl");
var ZodNumberImpl = _ZodNumberImpl;
var _ZodObjectImpl = class _ZodObjectImpl2 extends ZodBaseTypeImpl {
  constructor() {
    super(...arguments);
    this._cached = null;
    this.nonstrict = this.passthrough;
    this.augment = this.extend;
  }
  _getCached() {
    if (this._cached !== null)
      return this._cached;
    const shape = this._def.shape();
    const keys22 = Object.keys(shape);
    return this._cached = { shape, keys: keys22 };
  }
  dereference(defs) {
    const currentShape = this._def.shape();
    const shape = {};
    for (const key in currentShape) {
      shape[key] = currentShape[key].dereference(defs);
    }
    return new _ZodObjectImpl2(__spreadProps(__spreadValues({}, this._def), {
      shape: () => shape
    }));
  }
  getReferences() {
    const shape = this._def.shape();
    const refs = [];
    for (const key in shape) {
      refs.push(...shape[key].getReferences());
    }
    return fn_utils_exports.unique(refs);
  }
  clone() {
    const newShape = {};
    const currentShape = this._def.shape();
    for (const [key, value] of Object.entries(currentShape)) {
      newShape[key] = value.clone();
    }
    const objSchema = new _ZodObjectImpl2(__spreadProps(__spreadValues({}, this._def), {
      shape: () => newShape
    }));
    return objSchema;
  }
  _parse(input) {
    const parsedType = this._getType(input);
    if (parsedType !== "object") {
      const ctx2 = this._getOrReturnCtx(input);
      addIssueToContext(ctx2, {
        code: "invalid_type",
        expected: "object",
        received: ctx2.parsedType
      });
      return { status: "aborted" };
    }
    const { status, ctx } = this._processInputParams(input);
    const { shape, keys: shapeKeys } = this._getCached();
    const extraKeys = [];
    if (this._def.unknownKeys !== "strip") {
      for (const key in ctx.data) {
        if (!shapeKeys.includes(key)) {
          extraKeys.push(key);
        }
      }
    }
    const pairs = [];
    for (const key of shapeKeys) {
      const keyValidator = shape[key];
      const value = ctx.data[key];
      pairs.push({
        key: { status: "valid", value: key },
        value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
        alwaysSet: key in ctx.data
      });
    }
    const unknownKeys = this._def.unknownKeys;
    if (unknownKeys === "passthrough") {
      for (const key of extraKeys) {
        pairs.push({
          key: { status: "valid", value: key },
          value: { status: "valid", value: ctx.data[key] }
        });
      }
    } else if (unknownKeys === "strict") {
      if (extraKeys.length > 0) {
        addIssueToContext(ctx, {
          code: "unrecognized_keys",
          keys: extraKeys
        });
        status.dirty();
      }
    } else if (unknownKeys === "strip") {} else {
      for (const key of extraKeys) {
        const value = ctx.data[key];
        pairs.push({
          key: { status: "valid", value: key },
          value: unknownKeys._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
          alwaysSet: key in ctx.data
        });
      }
    }
    if (ctx.common.async) {
      return Promise.resolve().then(async () => {
        const syncPairs = [];
        for (const pair of pairs) {
          const key = await pair.key;
          syncPairs.push({
            key,
            value: await pair.value,
            alwaysSet: pair.alwaysSet
          });
        }
        return syncPairs;
      }).then((syncPairs) => {
        return ParseStatus.mergeObjectSync(status, syncPairs);
      });
    } else {
      return ParseStatus.mergeObjectSync(status, pairs);
    }
  }
  get shape() {
    return this._def.shape();
  }
  strict(message) {
    error_utils_exports.errToObj;
    return new _ZodObjectImpl2(__spreadValues(__spreadProps(__spreadValues({}, this._def), {
      unknownKeys: "strict"
    }), message !== undefined ? {
      errorMap: (issue, ctx) => {
        var _a, _b, _c, _d;
        const defaultError = (_c = (_b = (_a = this._def).errorMap) == null ? undefined : _b.call(_a, issue, ctx).message) != null ? _c : ctx.defaultError;
        if (issue.code === "unrecognized_keys") {
          return {
            message: (_d = error_utils_exports.errToObj(message).message) != null ? _d : defaultError
          };
        }
        return {
          message: defaultError
        };
      }
    } : {}));
  }
  strip() {
    return new _ZodObjectImpl2(__spreadProps(__spreadValues({}, this._def), {
      unknownKeys: "strip"
    }));
  }
  passthrough() {
    return new _ZodObjectImpl2(__spreadProps(__spreadValues({}, this._def), {
      unknownKeys: "passthrough"
    }));
  }
  additionalProperties() {
    if (typeof this._def.unknownKeys === "object") {
      return this._def.unknownKeys;
    }
    if (this._def.unknownKeys === "passthrough") {
      return builders.any();
    }
    if (this._def.unknownKeys === "strict") {
      return builders.never();
    }
    return;
  }
  extend(augmentation) {
    return new _ZodObjectImpl2(__spreadProps(__spreadValues({}, this._def), {
      shape: () => __spreadValues(__spreadValues({}, this._def.shape()), augmentation)
    }));
  }
  merge(merging) {
    const merged = new _ZodObjectImpl2({
      unknownKeys: merging._def.unknownKeys,
      shape: () => __spreadValues(__spreadValues({}, this._def.shape()), merging._def.shape()),
      typeName: "ZodObject"
    });
    return merged;
  }
  setKey(key, schema) {
    return this.augment({ [key]: schema });
  }
  catchall(index) {
    return new _ZodObjectImpl2(__spreadProps(__spreadValues({}, this._def), {
      unknownKeys: index
    }));
  }
  pick(mask) {
    const shape = {};
    Object.keys(mask).forEach((key) => {
      if (mask[key] && this.shape[key]) {
        shape[key] = this.shape[key];
      }
    });
    const objSchema = new _ZodObjectImpl2(__spreadProps(__spreadValues({}, this._def), {
      shape: () => shape
    }));
    return objSchema;
  }
  omit(mask) {
    const shape = {};
    Object.entries(this.shape).forEach(([key, value]) => {
      if (!mask[key]) {
        shape[key] = value;
      }
    });
    const objSchema = new _ZodObjectImpl2(__spreadProps(__spreadValues({}, this._def), {
      shape: () => shape
    }));
    return objSchema;
  }
  partial(mask) {
    const newShape = {};
    Object.keys(this.shape).forEach((key) => {
      const fieldSchema = this.shape[key];
      if (mask && !mask[key]) {
        newShape[key] = fieldSchema;
      } else {
        newShape[key] = fieldSchema == null ? undefined : fieldSchema.optional();
      }
    });
    const objSchema = new _ZodObjectImpl2(__spreadProps(__spreadValues({}, this._def), {
      shape: () => newShape
    }));
    return objSchema;
  }
  required(mask) {
    const newShape = {};
    Object.entries(this.shape).forEach(([key, value]) => {
      if (mask && !mask[key]) {
        newShape[key] = value;
      } else {
        const fieldSchema = value;
        let newField = fieldSchema;
        while (is.zuiOptional(newField)) {
          newField = newField._def.innerType;
        }
        newShape[key] = newField;
      }
    });
    return new _ZodObjectImpl2(__spreadProps(__spreadValues({}, this._def), {
      shape: () => newShape
    }));
  }
  keyof() {
    const keys22 = Object.keys(this.shape);
    return builders.enum(keys22);
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodObjectImpl2))
      return false;
    if (!this._unknownKeysEqual(schema))
      return false;
    const thisShape = this._def.shape();
    const thatShape = schema._def.shape();
    const compare = /* @__PURE__ */ __name((a, b) => a[0] === b[0] && a[1].isEqual(b[1]), "compare");
    const thisProps = new ds_utils_exports.CustomSet(Object.entries(thisShape), { compare });
    const thatProps = new ds_utils_exports.CustomSet(Object.entries(thatShape), { compare });
    return thisProps.isEqual(thatProps);
  }
  _unknownKeysEqual(that) {
    const thisAdditionalProperties = this.additionalProperties();
    const thatAdditionalProperties = that.additionalProperties();
    if (thisAdditionalProperties === undefined || thatAdditionalProperties === undefined) {
      return thisAdditionalProperties === thatAdditionalProperties;
    }
    return thisAdditionalProperties.isEqual(thatAdditionalProperties);
  }
};
__name(_ZodObjectImpl, "ZodObjectImpl");
var ZodObjectImpl = _ZodObjectImpl;
var _ZodOptionalImpl = class _ZodOptionalImpl2 extends ZodBaseTypeImpl {
  dereference(defs) {
    return new _ZodOptionalImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.dereference(defs)
    }));
  }
  getReferences() {
    return this._def.innerType.getReferences();
  }
  clone() {
    return new _ZodOptionalImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.clone()
    }));
  }
  _parse(input) {
    const parsedType = this._getType(input);
    if (parsedType === "undefined") {
      return { status: "valid", value: undefined };
    }
    return this._def.innerType._parse(input);
  }
  unwrap() {
    return this._def.innerType;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodOptionalImpl2))
      return false;
    return this._def.innerType.isEqual(schema._def.innerType);
  }
  naked() {
    return this._def.innerType.naked();
  }
  mandatory() {
    return this._def.innerType.mandatory();
  }
};
__name(_ZodOptionalImpl, "ZodOptionalImpl");
var ZodOptionalImpl = _ZodOptionalImpl;
var _ZodPipelineImpl = class _ZodPipelineImpl2 extends ZodBaseTypeImpl {
  dereference(defs) {
    return new _ZodPipelineImpl2(__spreadProps(__spreadValues({}, this._def), {
      in: this._def.in.dereference(defs),
      out: this._def.out.dereference(defs)
    }));
  }
  getReferences() {
    return fn_utils_exports.unique([...this._def.in.getReferences(), ...this._def.out.getReferences()]);
  }
  clone() {
    return new _ZodPipelineImpl2(__spreadProps(__spreadValues({}, this._def), {
      in: this._def.in.clone(),
      out: this._def.out.clone()
    }));
  }
  _parse(input) {
    const { status, ctx } = this._processInputParams(input);
    if (ctx.common.async) {
      const handleAsync = /* @__PURE__ */ __name(async () => {
        const inResult = await this._def.in._parseAsync({
          data: ctx.data,
          path: ctx.path,
          parent: ctx
        });
        if (inResult.status === "aborted")
          return { status: "aborted" };
        if (inResult.status === "dirty") {
          status.dirty();
          return { status: "dirty", value: inResult.value };
        } else {
          return this._def.out._parseAsync({
            data: inResult.value,
            path: ctx.path,
            parent: ctx
          });
        }
      }, "handleAsync");
      return handleAsync();
    } else {
      const inResult = this._def.in._parseSync({
        data: ctx.data,
        path: ctx.path,
        parent: ctx
      });
      if (inResult.status === "aborted")
        return { status: "aborted" };
      if (inResult.status === "dirty") {
        status.dirty();
        return {
          status: "dirty",
          value: inResult.value
        };
      } else {
        return this._def.out._parseSync({
          data: inResult.value,
          path: ctx.path,
          parent: ctx
        });
      }
    }
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodPipelineImpl2))
      return false;
    if (!this._def.in.isEqual(schema._def.in))
      return false;
    if (!this._def.out.isEqual(schema._def.out))
      return false;
    return true;
  }
};
__name(_ZodPipelineImpl, "ZodPipelineImpl");
var ZodPipelineImpl = _ZodPipelineImpl;
var _ZodPromiseImpl = class _ZodPromiseImpl2 extends ZodBaseTypeImpl {
  unwrap() {
    return this._def.type;
  }
  dereference(defs) {
    return new _ZodPromiseImpl2(__spreadProps(__spreadValues({}, this._def), {
      type: this._def.type.dereference(defs)
    }));
  }
  getReferences() {
    return this._def.type.getReferences();
  }
  clone() {
    return new _ZodPromiseImpl2(__spreadProps(__spreadValues({}, this._def), {
      type: this._def.type.clone()
    }));
  }
  _parse(input) {
    const { ctx } = this._processInputParams(input);
    if (ctx.parsedType !== "promise" && ctx.common.async === false) {
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "promise",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    const promisified = ctx.parsedType === "promise" ? ctx.data : Promise.resolve(ctx.data);
    return {
      status: "valid",
      value: promisified.then((data) => {
        return this._def.type.parseAsync(data, {
          path: ctx.path,
          errorMap: ctx.common.contextualErrorMap
        });
      })
    };
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodPromiseImpl2))
      return false;
    return this._def.type.isEqual(schema._def.type);
  }
  naked() {
    return this._def.type.naked();
  }
};
__name(_ZodPromiseImpl, "ZodPromiseImpl");
var ZodPromiseImpl = _ZodPromiseImpl;
var _ZodReadonlyImpl = class _ZodReadonlyImpl2 extends ZodBaseTypeImpl {
  constructor() {
    super(...arguments);
    this._freeze = /* @__PURE__ */ __name((result) => {
      if (result.status !== "valid") {
        return result;
      }
      return __spreadProps(__spreadValues({}, result), { value: Object.freeze(result.value) });
    }, "_freeze");
  }
  dereference(defs) {
    return new _ZodReadonlyImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.dereference(defs)
    }));
  }
  getReferences() {
    return this._def.innerType.getReferences();
  }
  clone() {
    return new _ZodReadonlyImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.clone()
    }));
  }
  _parse(input) {
    const result = this._def.innerType._parse(input);
    if (isAsync(result)) {
      return result.then(this._freeze);
    }
    return this._freeze(result);
  }
  unwrap() {
    return this._def.innerType;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodReadonlyImpl2))
      return false;
    return this._def.innerType.isEqual(schema._def.innerType);
  }
  naked() {
    return this._def.innerType.naked();
  }
  mandatory() {
    return new _ZodReadonlyImpl2(__spreadProps(__spreadValues({}, this._def), {
      innerType: this._def.innerType.mandatory()
    }));
  }
};
__name(_ZodReadonlyImpl, "ZodReadonlyImpl");
var ZodReadonlyImpl = _ZodReadonlyImpl;
var _ZodRecordImpl = class _ZodRecordImpl2 extends ZodBaseTypeImpl {
  get keySchema() {
    return this._def.keyType;
  }
  get valueSchema() {
    return this._def.valueType;
  }
  dereference(defs) {
    const keyType = this._def.keyType.dereference(defs);
    const valueType = this._def.valueType.dereference(defs);
    return new _ZodRecordImpl2(__spreadProps(__spreadValues({}, this._def), {
      keyType,
      valueType
    }));
  }
  getReferences() {
    return fn_utils_exports.unique([...this._def.keyType.getReferences(), ...this._def.valueType.getReferences()]);
  }
  clone() {
    return new _ZodRecordImpl2(__spreadProps(__spreadValues({}, this._def), {
      keyType: this._def.keyType.clone(),
      valueType: this._def.valueType.clone()
    }));
  }
  _parse(input) {
    const { status, ctx } = this._processInputParams(input);
    if (ctx.parsedType !== "object") {
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "object",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    const pairs = [];
    const keyType = this._def.keyType;
    const valueType = this._def.valueType;
    for (const key in ctx.data) {
      pairs.push({
        key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
        value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
      });
    }
    if (ctx.common.async) {
      return ParseStatus.mergeObjectAsync(status, pairs);
    } else {
      return ParseStatus.mergeObjectSync(status, pairs);
    }
  }
  get element() {
    return this._def.valueType;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodRecordImpl2))
      return false;
    if (!this._def.keyType.isEqual(schema._def.keyType))
      return false;
    if (!this._def.valueType.isEqual(schema._def.valueType))
      return false;
    return true;
  }
};
__name(_ZodRecordImpl, "ZodRecordImpl");
var ZodRecordImpl = _ZodRecordImpl;
var _ZodRefImpl = class _ZodRefImpl2 extends ZodBaseTypeImpl {
  dereference(defs) {
    const def = defs[this._def.uri];
    if (!def) {
      return this;
    }
    return def;
  }
  getReferences() {
    return [this._def.uri];
  }
  _parse(input) {
    const ctx = this._getOrReturnCtx(input);
    addIssueToContext(ctx, {
      code: "unresolved_reference"
    });
    return { status: "aborted" };
  }
  isOptional() {
    return false;
  }
  isNullable() {
    return false;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodRefImpl2))
      return false;
    return this._def.uri === schema._def.uri;
  }
};
__name(_ZodRefImpl, "ZodRefImpl");
var ZodRefImpl = _ZodRefImpl;
var _ZodSetImpl = class _ZodSetImpl2 extends ZodBaseTypeImpl {
  dereference(defs) {
    return new _ZodSetImpl2(__spreadProps(__spreadValues({}, this._def), {
      valueType: this._def.valueType.dereference(defs)
    }));
  }
  getReferences() {
    return this._def.valueType.getReferences();
  }
  clone() {
    return new _ZodSetImpl2(__spreadProps(__spreadValues({}, this._def), {
      valueType: this._def.valueType.clone()
    }));
  }
  _parse(input) {
    const { status, ctx } = this._processInputParams(input);
    if (ctx.parsedType !== "set") {
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "set",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    const def = this._def;
    if (def.minSize !== null) {
      if (ctx.data.size < def.minSize.value) {
        addIssueToContext(ctx, {
          code: "too_small",
          minimum: def.minSize.value,
          type: "set",
          inclusive: true,
          exact: false,
          message: def.minSize.message
        });
        status.dirty();
      }
    }
    if (def.maxSize !== null) {
      if (ctx.data.size > def.maxSize.value) {
        addIssueToContext(ctx, {
          code: "too_big",
          maximum: def.maxSize.value,
          type: "set",
          inclusive: true,
          exact: false,
          message: def.maxSize.message
        });
        status.dirty();
      }
    }
    const valueType = this._def.valueType;
    function finalizeSet(elements2) {
      const parsedSet = /* @__PURE__ */ new Set;
      for (const element of elements2) {
        if (element.status === "aborted")
          return { status: "aborted" };
        if (element.status === "dirty")
          status.dirty();
        parsedSet.add(element.value);
      }
      return { status: status.value, value: parsedSet };
    }
    __name(finalizeSet, "finalizeSet");
    const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
    if (ctx.common.async) {
      return Promise.all(elements).then((elements2) => finalizeSet(elements2));
    } else {
      return finalizeSet(elements);
    }
  }
  min(minSize, message) {
    return new _ZodSetImpl2(__spreadProps(__spreadValues({}, this._def), {
      minSize: { value: minSize, message: error_utils_exports.toString(message) }
    }));
  }
  max(maxSize, message) {
    return new _ZodSetImpl2(__spreadProps(__spreadValues({}, this._def), {
      maxSize: { value: maxSize, message: error_utils_exports.toString(message) }
    }));
  }
  size(size, message) {
    return this.min(size, message).max(size, message);
  }
  nonempty(message) {
    return this.min(1, message);
  }
  isEqual(schema) {
    var _a, _b, _c, _d;
    if (!(schema instanceof _ZodSetImpl2))
      return false;
    const thisMin = (_a = this._def.minSize) == null ? undefined : _a.value;
    const thatMin = (_b = schema._def.minSize) == null ? undefined : _b.value;
    if (thisMin !== thatMin)
      return false;
    const thisMax = (_c = this._def.maxSize) == null ? undefined : _c.value;
    const thatMax = (_d = schema._def.maxSize) == null ? undefined : _d.value;
    if (thisMax !== thatMax)
      return false;
    return this._def.valueType.isEqual(schema._def.valueType);
  }
};
__name(_ZodSetImpl, "ZodSetImpl");
var ZodSetImpl = _ZodSetImpl;
var cuidRegex = /^c[^\s-]{8,}$/i;
var cuid2Regex = /^[a-z][a-z0-9]*$/;
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
var _emojiRegex = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
var emojiRegex;
var ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
function isValidIP(ip, version) {
  if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
    return true;
  }
  if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
    return true;
  }
  return false;
}
__name(isValidIP, "isValidIP");
var _ZodStringImpl = class _ZodStringImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    if (this._def.coerce) {
      input.data = String(input.data);
    }
    const parsedType = this._getType(input);
    if (parsedType !== "string") {
      const ctx2 = this._getOrReturnCtx(input);
      addIssueToContext(ctx2, {
        code: "invalid_type",
        expected: "string",
        received: ctx2.parsedType
      });
      return { status: "aborted" };
    }
    const status = new ParseStatus;
    let ctx = undefined;
    for (const check of this._def.checks) {
      if (check.kind === "min") {
        if (input.data.length < check.value) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "too_small",
            minimum: check.value,
            type: "string",
            inclusive: true,
            exact: false,
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "max") {
        if (input.data.length > check.value) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "too_big",
            maximum: check.value,
            type: "string",
            inclusive: true,
            exact: false,
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "length") {
        const tooBig = input.data.length > check.value;
        const tooSmall = input.data.length < check.value;
        if (tooBig || tooSmall) {
          ctx = this._getOrReturnCtx(input, ctx);
          if (tooBig) {
            addIssueToContext(ctx, {
              code: "too_big",
              maximum: check.value,
              type: "string",
              inclusive: true,
              exact: true,
              message: check.message
            });
          } else if (tooSmall) {
            addIssueToContext(ctx, {
              code: "too_small",
              minimum: check.value,
              type: "string",
              inclusive: true,
              exact: true,
              message: check.message
            });
          }
          status.dirty();
        }
      } else if (check.kind === "email") {
        if (!emailRegex.test(input.data)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            validation: "email",
            code: "invalid_string",
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "emoji") {
        if (!emojiRegex) {
          emojiRegex = new RegExp(_emojiRegex, "u");
        }
        if (!emojiRegex.test(input.data)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            validation: "emoji",
            code: "invalid_string",
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "uuid") {
        if (!uuidRegex.test(input.data)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            validation: "uuid",
            code: "invalid_string",
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "cuid") {
        if (!cuidRegex.test(input.data)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            validation: "cuid",
            code: "invalid_string",
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "cuid2") {
        if (!cuid2Regex.test(input.data)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            validation: "cuid2",
            code: "invalid_string",
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "ulid") {
        if (!ulidRegex.test(input.data)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            validation: "ulid",
            code: "invalid_string",
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "url") {
        try {
          new URL(input.data);
        } catch (e) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            validation: "url",
            code: "invalid_string",
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "regex") {
        check.regex.lastIndex = 0;
        const testResult = check.regex.test(input.data);
        if (!testResult) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            validation: "regex",
            code: "invalid_string",
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "trim") {
        input.data = input.data.trim();
      } else if (check.kind === "includes") {
        if (!input.data.includes(check.value, check.position)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "invalid_string",
            validation: { includes: check.value, position: check.position },
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "toLowerCase") {
        input.data = input.data.toLowerCase();
      } else if (check.kind === "toUpperCase") {
        input.data = input.data.toUpperCase();
      } else if (check.kind === "startsWith") {
        if (!input.data.startsWith(check.value)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "invalid_string",
            validation: { startsWith: check.value },
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "endsWith") {
        if (!input.data.endsWith(check.value)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "invalid_string",
            validation: { endsWith: check.value },
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "datetime") {
        const regex = datestring_utils_exports.generateDatetimeRegex(check);
        if (!regex.test(input.data)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            code: "invalid_string",
            validation: "datetime",
            message: check.message
          });
          status.dirty();
        }
      } else if (check.kind === "ip") {
        if (!isValidIP(input.data, check.version)) {
          ctx = this._getOrReturnCtx(input, ctx);
          addIssueToContext(ctx, {
            validation: "ip",
            code: "invalid_string",
            message: check.message
          });
          status.dirty();
        }
      } else {
        assert_utils_exports.assertNever(check);
      }
    }
    return { status: status.value, value: input.data };
  }
  _addCheck(check) {
    return new _ZodStringImpl2(__spreadProps(__spreadValues({}, this._def), {
      checks: [...this._def.checks, check]
    }));
  }
  email(message) {
    return this._addCheck(__spreadValues({ kind: "email" }, error_utils_exports.errToObj(message)));
  }
  url(message) {
    return this._addCheck(__spreadValues({ kind: "url" }, error_utils_exports.errToObj(message)));
  }
  emoji(message) {
    return this._addCheck(__spreadValues({ kind: "emoji" }, error_utils_exports.errToObj(message)));
  }
  uuid(message) {
    return this._addCheck(__spreadValues({ kind: "uuid" }, error_utils_exports.errToObj(message)));
  }
  cuid(message) {
    return this._addCheck(__spreadValues({ kind: "cuid" }, error_utils_exports.errToObj(message)));
  }
  cuid2(message) {
    return this._addCheck(__spreadValues({ kind: "cuid2" }, error_utils_exports.errToObj(message)));
  }
  ulid(message) {
    return this._addCheck(__spreadValues({ kind: "ulid" }, error_utils_exports.errToObj(message)));
  }
  ip(options) {
    return this._addCheck(__spreadValues({ kind: "ip" }, error_utils_exports.errToObj(options)));
  }
  datetime(options) {
    var _a;
    if (typeof options === "string") {
      return this._addCheck({
        kind: "datetime",
        precision: null,
        offset: false,
        message: options
      });
    }
    return this._addCheck(__spreadValues({
      kind: "datetime",
      precision: typeof (options == null ? undefined : options.precision) === "undefined" ? null : options == null ? undefined : options.precision,
      offset: (_a = options == null ? undefined : options.offset) != null ? _a : false
    }, error_utils_exports.errToObj(options == null ? undefined : options.message)));
  }
  regex(regex, message) {
    return this._addCheck(__spreadValues({
      kind: "regex",
      regex
    }, error_utils_exports.errToObj(message)));
  }
  includes(value, options) {
    return this._addCheck(__spreadValues({
      kind: "includes",
      value,
      position: options == null ? undefined : options.position
    }, error_utils_exports.errToObj(options == null ? undefined : options.message)));
  }
  startsWith(value, message) {
    return this._addCheck(__spreadValues({
      kind: "startsWith",
      value
    }, error_utils_exports.errToObj(message)));
  }
  endsWith(value, message) {
    return this._addCheck(__spreadValues({
      kind: "endsWith",
      value
    }, error_utils_exports.errToObj(message)));
  }
  min(minLength, message) {
    return this._addCheck(__spreadValues({
      kind: "min",
      value: minLength
    }, error_utils_exports.errToObj(message)));
  }
  max(maxLength, message) {
    return this._addCheck(__spreadValues({
      kind: "max",
      value: maxLength
    }, error_utils_exports.errToObj(message)));
  }
  length(len, message) {
    return this._addCheck(__spreadValues({
      kind: "length",
      value: len
    }, error_utils_exports.errToObj(message)));
  }
  nonempty(message) {
    return this.min(1, error_utils_exports.errToObj(message));
  }
  trim() {
    return new _ZodStringImpl2(__spreadProps(__spreadValues({}, this._def), {
      checks: [...this._def.checks, { kind: "trim" }]
    }));
  }
  secret() {
    this._def[zuiKey] = __spreadProps(__spreadValues({}, this._def[zuiKey]), { secret: true });
    return this;
  }
  toLowerCase() {
    return new _ZodStringImpl2(__spreadProps(__spreadValues({}, this._def), {
      checks: [...this._def.checks, { kind: "toLowerCase" }]
    }));
  }
  toUpperCase() {
    return new _ZodStringImpl2(__spreadProps(__spreadValues({}, this._def), {
      checks: [...this._def.checks, { kind: "toUpperCase" }]
    }));
  }
  get isDatetime() {
    return !!this._def.checks.find((ch) => ch.kind === "datetime");
  }
  get isEmail() {
    return !!this._def.checks.find((ch) => ch.kind === "email");
  }
  get isURL() {
    return !!this._def.checks.find((ch) => ch.kind === "url");
  }
  get isEmoji() {
    return !!this._def.checks.find((ch) => ch.kind === "emoji");
  }
  get isUUID() {
    return !!this._def.checks.find((ch) => ch.kind === "uuid");
  }
  get isCUID() {
    return !!this._def.checks.find((ch) => ch.kind === "cuid");
  }
  get isCUID2() {
    return !!this._def.checks.find((ch) => ch.kind === "cuid2");
  }
  get isULID() {
    return !!this._def.checks.find((ch) => ch.kind === "ulid");
  }
  get isIP() {
    return !!this._def.checks.find((ch) => ch.kind === "ip");
  }
  get minLength() {
    let min = null;
    for (const ch of this._def.checks) {
      if (ch.kind === "min") {
        if (min === null || ch.value > min)
          min = ch.value;
      }
    }
    return min;
  }
  get maxLength() {
    let max = null;
    for (const ch of this._def.checks) {
      if (ch.kind === "max") {
        if (max === null || ch.value < max)
          max = ch.value;
      }
    }
    return max;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodStringImpl2))
      return false;
    const thisChecks = new ds_utils_exports.CustomSet(this._def.checks);
    const thatChecks = new ds_utils_exports.CustomSet(schema._def.checks);
    return thisChecks.isEqual(thatChecks);
  }
};
__name(_ZodStringImpl, "ZodStringImpl");
var ZodStringImpl = _ZodStringImpl;
var _ZodSymbolImpl = class _ZodSymbolImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    const parsedType = this._getType(input);
    if (parsedType !== "symbol") {
      const ctx = this._getOrReturnCtx(input);
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "symbol",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    return { status: "valid", value: input.data };
  }
  isEqual(schema) {
    return schema instanceof _ZodSymbolImpl2;
  }
};
__name(_ZodSymbolImpl, "ZodSymbolImpl");
var ZodSymbolImpl = _ZodSymbolImpl;
var _ZodEffectsImpl = class _ZodEffectsImpl2 extends ZodBaseTypeImpl {
  innerType() {
    return this._def.schema;
  }
  sourceType() {
    return is.zuiEffects(this._def.schema) ? this._def.schema.sourceType() : this._def.schema;
  }
  dereference(defs) {
    return new _ZodEffectsImpl2(__spreadProps(__spreadValues({}, this._def), {
      schema: this._def.schema.dereference(defs)
    }));
  }
  getReferences() {
    return this._def.schema.getReferences();
  }
  clone() {
    return new _ZodEffectsImpl2(__spreadProps(__spreadValues({}, this._def), {
      schema: this._def.schema.clone()
    }));
  }
  _parse(input) {
    const { ctx } = this._processInputParams(input);
    const effect = this._def.effect;
    if (effect.type === "upstream") {
      let processed = effect.effect(ctx.data, { path: ctx.path });
      if (ctx.common.async) {
        return Promise.resolve(processed).then(async (processed2) => {
          processed2 != null || (processed2 = { status: "valid", value: ctx.data });
          this._processResult(ctx, processed2);
          if (processed2.status === "aborted")
            return { status: "aborted" };
          const result = await this._def.schema._parseAsync({
            data: processed2.value,
            path: ctx.path,
            parent: ctx
          });
          if (result.status === "aborted")
            return { status: "aborted" };
          if (result.status === "dirty")
            return { status: "dirty", value: result.value };
          if (processed2.status === "dirty")
            return { status: "dirty", value: result.value };
          return result;
        });
      } else {
        if (processed instanceof Promise) {
          throw new Error("Asynchronous upstream transform encountered during synchronous parse operation. Use .parseAsync instead.");
        }
        processed != null || (processed = { status: "valid", value: ctx.data });
        this._processResult(ctx, processed);
        if (processed.status === "aborted")
          return { status: "aborted" };
        const result = this._def.schema._parseSync({
          data: processed.value,
          path: ctx.path,
          parent: ctx
        });
        if (result.status === "aborted")
          return { status: "aborted" };
        if (result.status === "dirty")
          return { status: "dirty", value: result.value };
        if (processed.status === "dirty")
          return { status: "dirty", value: result.value };
        return result;
      }
    }
    if (effect.type === "downstream") {
      if (ctx.common.async === false) {
        const base = this._def.schema._parseSync({
          data: ctx.data,
          path: ctx.path,
          parent: ctx
        });
        if (base.status === "aborted")
          return base;
        if (base.status === "dirty") {
          if (effect.failFast) {
            return base;
          }
        }
        let result = effect.effect(base.value, { path: ctx.path });
        if (result instanceof Promise) {
          throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
        }
        result != null || (result = { status: "valid", value: base.value });
        this._processResult(ctx, result);
        if (result.status === "aborted")
          return { status: "aborted" };
        if (result.status === "dirty")
          return { status: "dirty", value: result.value };
        if (base.status === "dirty")
          return { status: "dirty", value: result.value };
        return result;
      } else {
        return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
          if (base.status === "aborted")
            return base;
          if (base.status === "dirty") {
            if (effect.failFast) {
              return base;
            }
          }
          return Promise.resolve(effect.effect(base.value, { path: ctx.path })).then((result) => {
            result != null || (result = { status: "valid", value: base.value });
            this._processResult(ctx, result);
            if (result.status === "aborted")
              return { status: "aborted" };
            if (result.status === "dirty")
              return { status: "dirty", value: result.value };
            if (base.status === "dirty")
              return { status: "dirty", value: result.value };
            return result;
          });
        });
      }
    }
    assert_utils_exports.assertNever(effect);
  }
  _processResult(ctx, result) {
    if (result.status === "valid") {
      return;
    }
    for (const issue of result.issues) {
      addIssueToContext(ctx, issue);
    }
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodEffectsImpl2))
      return false;
    if (!this._def.schema.isEqual(schema._def.schema))
      return false;
    if (this._def.effect.type === "upstream") {
      if (schema._def.effect.type !== "upstream")
        return false;
      return other_utils_exports.compareFunctions(this._def.effect.effect, schema._def.effect.effect);
    }
    if (this._def.effect.type === "downstream") {
      if (schema._def.effect.type !== "downstream")
        return false;
      if (this._def.effect.failFast !== schema._def.effect.failFast)
        return false;
      return other_utils_exports.compareFunctions(this._def.effect.effect, schema._def.effect.effect);
    }
    this._def.effect;
    return false;
  }
  naked() {
    return this._def.schema.naked();
  }
  mandatory() {
    return new _ZodEffectsImpl2(__spreadProps(__spreadValues({}, this._def), {
      schema: this._def.schema.mandatory()
    }));
  }
};
__name(_ZodEffectsImpl, "ZodEffectsImpl");
var ZodEffectsImpl = _ZodEffectsImpl;
var _ZodTupleImpl = class _ZodTupleImpl2 extends ZodBaseTypeImpl {
  dereference(defs) {
    const items = this._def.items.map((item) => item.dereference(defs));
    const rest = this._def.rest ? this._def.rest.dereference(defs) : null;
    return new _ZodTupleImpl2(__spreadProps(__spreadValues({}, this._def), {
      items,
      rest
    }));
  }
  getReferences() {
    return fn_utils_exports.unique([
      ...this._def.items.flatMap((item) => item.getReferences()),
      ...this._def.rest ? this._def.rest.getReferences() : []
    ]);
  }
  clone() {
    const items = this._def.items.map((item) => item.clone());
    const rest = this._def.rest ? this._def.rest.clone() : null;
    return new _ZodTupleImpl2(__spreadProps(__spreadValues({}, this._def), {
      items,
      rest
    }));
  }
  _parse(input) {
    const { status, ctx } = this._processInputParams(input);
    if (ctx.parsedType !== "array") {
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "array",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    if (ctx.data.length < this._def.items.length) {
      addIssueToContext(ctx, {
        code: "too_small",
        minimum: this._def.items.length,
        inclusive: true,
        exact: false,
        type: "array"
      });
      return { status: "aborted" };
    }
    const rest = this._def.rest;
    if (!rest && ctx.data.length > this._def.items.length) {
      addIssueToContext(ctx, {
        code: "too_big",
        maximum: this._def.items.length,
        inclusive: true,
        exact: false,
        type: "array"
      });
      status.dirty();
    }
    const items = [...ctx.data].map((item, itemIndex) => {
      const schema = this._def.items[itemIndex] || this._def.rest;
      if (!schema)
        return null;
      return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
    }).filter((x) => !!x);
    if (ctx.common.async) {
      return Promise.all(items).then((results) => {
        return ParseStatus.mergeArray(status, results);
      });
    } else {
      return ParseStatus.mergeArray(status, items);
    }
  }
  get items() {
    return this._def.items;
  }
  rest(rest) {
    return new _ZodTupleImpl2(__spreadProps(__spreadValues({}, this._def), {
      rest
    }));
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodTupleImpl2))
      return false;
    if (!this._restEquals(schema))
      return false;
    const compare = /* @__PURE__ */ __name((a, b) => a.isEqual(b), "compare");
    const thisItems = new ds_utils_exports.CustomSet(this._def.items, { compare });
    const schemaItems = new ds_utils_exports.CustomSet(schema._def.items, { compare });
    return thisItems.isEqual(schemaItems);
  }
  _restEquals(schema) {
    if (this._def.rest === null) {
      return schema._def.rest === null;
    }
    return schema._def.rest !== null && this._def.rest.isEqual(schema._def.rest);
  }
};
__name(_ZodTupleImpl, "ZodTupleImpl");
var ZodTupleImpl = _ZodTupleImpl;
var _ZodUndefinedImpl = class _ZodUndefinedImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    const parsedType = this._getType(input);
    if (parsedType !== "undefined") {
      const ctx = this._getOrReturnCtx(input);
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "undefined",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    return { status: "valid", value: input.data };
  }
  isEqual(schema) {
    return schema instanceof _ZodUndefinedImpl2;
  }
  mandatory() {
    return builders.never(__spreadValues({}, this._def));
  }
};
__name(_ZodUndefinedImpl, "ZodUndefinedImpl");
var ZodUndefinedImpl = _ZodUndefinedImpl;
var _ZodUnionImpl = class _ZodUnionImpl2 extends ZodBaseTypeImpl {
  dereference(defs) {
    const options = this._def.options.map((option) => option.dereference(defs));
    return new _ZodUnionImpl2(__spreadProps(__spreadValues({}, this._def), {
      options
    }));
  }
  getReferences() {
    return fn_utils_exports.unique(this._def.options.reduce((acc, option) => {
      return [...acc, ...option.getReferences()];
    }, []));
  }
  clone() {
    const options = this._def.options.map((option) => option.clone());
    return new _ZodUnionImpl2(__spreadProps(__spreadValues({}, this._def), {
      options
    }));
  }
  _parse(input) {
    const { ctx } = this._processInputParams(input);
    const options = this._def.options;
    function handleResults(results) {
      for (const result of results) {
        if (result.result.status === "valid") {
          return result.result;
        }
      }
      for (const result of results) {
        if (result.result.status === "dirty") {
          ctx.common.issues.push(...result.ctx.common.issues);
          return result.result;
        }
      }
      const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
      addIssueToContext(ctx, {
        code: "invalid_union",
        unionErrors
      });
      return { status: "aborted" };
    }
    __name(handleResults, "handleResults");
    if (ctx.common.async) {
      return Promise.all(options.map(async (option) => {
        const childCtx = __spreadProps(__spreadValues({}, ctx), {
          common: __spreadProps(__spreadValues({}, ctx.common), {
            issues: []
          }),
          parent: null
        });
        return {
          result: await option._parseAsync({
            data: ctx.data,
            path: ctx.path,
            parent: childCtx
          }),
          ctx: childCtx
        };
      })).then(handleResults);
    } else {
      let dirty = undefined;
      const issues = [];
      for (const option of options) {
        const childCtx = __spreadProps(__spreadValues({}, ctx), {
          common: __spreadProps(__spreadValues({}, ctx.common), {
            issues: []
          }),
          parent: null
        });
        const result = option._parseSync({
          data: ctx.data,
          path: ctx.path,
          parent: childCtx
        });
        if (result.status === "valid") {
          return result;
        } else if (result.status === "dirty" && !dirty) {
          dirty = { result, ctx: childCtx };
        }
        if (childCtx.common.issues.length) {
          issues.push(childCtx.common.issues);
        }
      }
      if (dirty) {
        ctx.common.issues.push(...dirty.ctx.common.issues);
        return dirty.result;
      }
      const unionErrors = issues.map((issues2) => new ZodError(issues2));
      addIssueToContext(ctx, {
        code: "invalid_union",
        unionErrors
      });
      return { status: "aborted" };
    }
  }
  get options() {
    return this._def.options;
  }
  isEqual(schema) {
    if (!(schema instanceof _ZodUnionImpl2))
      return false;
    const compare = /* @__PURE__ */ __name((a, b) => a.isEqual(b), "compare");
    const thisOptions = new ds_utils_exports.CustomSet([...this._def.options], { compare });
    const thatOptions = new ds_utils_exports.CustomSet([...schema._def.options], { compare });
    return thisOptions.isEqual(thatOptions);
  }
  mandatory() {
    const options = this._def.options.filter((o) => !is.zuiUndefined(o)).map((option) => option.mandatory());
    const [first, second, ...others] = options;
    if (!first) {
      return builders.never(__spreadValues({}, this._def));
    }
    if (!second) {
      return first;
    }
    return new _ZodUnionImpl2(__spreadProps(__spreadValues({}, this._def), {
      options: [first, second, ...others]
    }));
  }
};
__name(_ZodUnionImpl, "ZodUnionImpl");
var ZodUnionImpl = _ZodUnionImpl;
var _ZodUnknownImpl = class _ZodUnknownImpl2 extends ZodBaseTypeImpl {
  constructor() {
    super(...arguments);
    this._unknown = true;
  }
  _parse(input) {
    return { status: "valid", value: input.data };
  }
  isEqual(schema) {
    return schema instanceof _ZodUnknownImpl2;
  }
};
__name(_ZodUnknownImpl, "ZodUnknownImpl");
var ZodUnknownImpl = _ZodUnknownImpl;
var _ZodVoidImpl = class _ZodVoidImpl2 extends ZodBaseTypeImpl {
  _parse(input) {
    const parsedType = this._getType(input);
    if (parsedType !== "undefined") {
      const ctx = this._getOrReturnCtx(input);
      addIssueToContext(ctx, {
        code: "invalid_type",
        expected: "void",
        received: ctx.parsedType
      });
      return { status: "aborted" };
    }
    return { status: "valid", value: input.data };
  }
  isEqual(schema) {
    return schema instanceof _ZodVoidImpl2;
  }
};
__name(_ZodVoidImpl, "ZodVoidImpl");
var ZodVoidImpl = _ZodVoidImpl;
var _isError = /* @__PURE__ */ __name((value) => value instanceof Error, "_isError");
var _isObject = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null, "_isObject");
var is = {
  zuiError: (thrown) => thrown instanceof ZodError || _isError(thrown) && ("__type__" in thrown) && thrown.__type__ === "ZuiError",
  zuiType: (value) => value instanceof ZodBaseTypeImpl || _isObject(value) && ("__type__" in value) && value.__type__ === "ZuiType",
  zuiAny: (s) => s.typeName === "ZodAny",
  zuiArray: (s) => s.typeName === "ZodArray",
  zuiBigInt: (s) => s.typeName === "ZodBigInt",
  zuiBoolean: (s) => s.typeName === "ZodBoolean",
  zuiBranded: (s) => s.typeName === "ZodBranded",
  zuiCatch: (s) => s.typeName === "ZodCatch",
  zuiDate: (s) => s.typeName === "ZodDate",
  zuiDefault: (s) => s.typeName === "ZodDefault",
  zuiDiscriminatedUnion: (s) => s.typeName === "ZodDiscriminatedUnion",
  zuiEnum: (s) => s.typeName === "ZodEnum",
  zuiFunction: (s) => s.typeName === "ZodFunction",
  zuiIntersection: (s) => s.typeName === "ZodIntersection",
  zuiLazy: (s) => s.typeName === "ZodLazy",
  zuiLiteral: (s) => s.typeName === "ZodLiteral",
  zuiMap: (s) => s.typeName === "ZodMap",
  zuiNaN: (s) => s.typeName === "ZodNaN",
  zuiNativeEnum: (s) => s.typeName === "ZodNativeEnum",
  zuiNever: (s) => s.typeName === "ZodNever",
  zuiNull: (s) => s.typeName === "ZodNull",
  zuiNullable: (s) => s.typeName === "ZodNullable",
  zuiNumber: (s) => s.typeName === "ZodNumber",
  zuiObject: (s) => s.typeName === "ZodObject",
  zuiOptional: (s) => s.typeName === "ZodOptional",
  zuiPipeline: (s) => s.typeName === "ZodPipeline",
  zuiPromise: (s) => s.typeName === "ZodPromise",
  zuiReadonly: (s) => s.typeName === "ZodReadonly",
  zuiRecord: (s) => s.typeName === "ZodRecord",
  zuiRef: (s) => s.typeName === "ZodRef",
  zuiSet: (s) => s.typeName === "ZodSet",
  zuiString: (s) => s.typeName === "ZodString",
  zuiSymbol: (s) => s.typeName === "ZodSymbol",
  zuiEffects: (s) => s.typeName === "ZodEffects",
  zuiTuple: (s) => s.typeName === "ZodTuple",
  zuiUndefined: (s) => s.typeName === "ZodUndefined",
  zuiUnion: (s) => s.typeName === "ZodUnion",
  zuiUnknown: (s) => s.typeName === "ZodUnknown",
  zuiVoid: (s) => s.typeName === "ZodVoid"
};
var _processCreateParams = /* @__PURE__ */ __name((params) => {
  if (!params)
    return {};
  const {
    errorMap: errorMap2,
    invalid_type_error,
    required_error,
    description,
    supportsExtensions,
    [zuiKey]: zuiExtensions
  } = params;
  if (errorMap2 && (invalid_type_error || required_error)) {
    throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
  }
  const filteredZuiExtensions = zuiExtensions ? Object.fromEntries(Object.entries(zuiExtensions).filter(([key]) => key !== "secret" || (supportsExtensions == null ? undefined : supportsExtensions.includes("secret")))) : undefined;
  if (errorMap2)
    return { errorMap: errorMap2, description, [zuiKey]: filteredZuiExtensions };
  const customMap = /* @__PURE__ */ __name((iss, ctx) => {
    if (iss.code !== "invalid_type")
      return { message: ctx.defaultError };
    if (typeof ctx.data === "undefined") {
      return { message: required_error != null ? required_error : ctx.defaultError };
    }
    return { message: invalid_type_error != null ? invalid_type_error : ctx.defaultError };
  }, "customMap");
  return { errorMap: customMap, description, [zuiKey]: filteredZuiExtensions };
}, "_processCreateParams");
var customType = /* @__PURE__ */ __name((check, params = {}, fatal) => {
  if (check) {
    return anyType().downstream((data) => {
      var _a, _b;
      if (!check(data)) {
        const _params = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
        const _fatal = (_b = (_a = _params.fatal) != null ? _a : fatal) != null ? _b : true;
        return _fatal ? ERR(__spreadValues({ code: "custom" }, _params)) : DIRTY(data, __spreadValues({ code: "custom" }, _params));
      }
    });
  }
  return anyType();
}, "customType");
var instanceOfType = /* @__PURE__ */ __name((cls, params = {
  message: `Input not instance of ${cls.name}`
}) => customType((data) => data instanceof cls, params), "instanceOfType");
var anyType = /* @__PURE__ */ __name((params) => new ZodAnyImpl(__spreadValues({ typeName: "ZodAny" }, _processCreateParams(params))), "anyType");
var unknownType = /* @__PURE__ */ __name((params) => new ZodUnknownImpl(__spreadValues({ typeName: "ZodUnknown" }, _processCreateParams(params))), "unknownType");
var neverType = /* @__PURE__ */ __name((params) => new ZodNeverImpl(__spreadValues({ typeName: "ZodNever" }, _processCreateParams(params))), "neverType");
var voidType = /* @__PURE__ */ __name((params) => new ZodVoidImpl(__spreadValues({ typeName: "ZodVoid" }, _processCreateParams(params))), "voidType");
var nullType = /* @__PURE__ */ __name((params) => new ZodNullImpl(__spreadValues({ typeName: "ZodNull" }, _processCreateParams(params))), "nullType");
var undefinedType = /* @__PURE__ */ __name((params) => new ZodUndefinedImpl(__spreadValues({ typeName: "ZodUndefined" }, _processCreateParams(params))), "undefinedType");
var symbolType = /* @__PURE__ */ __name((params) => new ZodSymbolImpl(__spreadValues({ typeName: "ZodSymbol" }, _processCreateParams(params))), "symbolType");
var nanType = /* @__PURE__ */ __name((params) => new ZodNaNImpl(__spreadValues({ typeName: "ZodNaN" }, _processCreateParams(params))), "nanType");
var stringType = /* @__PURE__ */ __name((params) => {
  var _a;
  return new ZodStringImpl(__spreadValues({
    checks: [],
    typeName: "ZodString",
    coerce: (_a = params == null ? undefined : params.coerce) != null ? _a : false
  }, _processCreateParams(__spreadProps(__spreadValues({}, params), { supportsExtensions: ["secret"] }))));
}, "stringType");
var numberType = /* @__PURE__ */ __name((params) => new ZodNumberImpl(__spreadValues({
  checks: [],
  typeName: "ZodNumber",
  coerce: (params == null ? undefined : params.coerce) || false
}, _processCreateParams(params))), "numberType");
var booleanType = /* @__PURE__ */ __name((params) => new ZodBooleanImpl(__spreadValues({
  typeName: "ZodBoolean",
  coerce: (params == null ? undefined : params.coerce) || false
}, _processCreateParams(params))), "booleanType");
var bigIntType = /* @__PURE__ */ __name((params) => {
  var _a;
  return new ZodBigIntImpl(__spreadValues({
    checks: [],
    typeName: "ZodBigInt",
    coerce: (_a = params == null ? undefined : params.coerce) != null ? _a : false
  }, _processCreateParams(params)));
}, "bigIntType");
var dateType = /* @__PURE__ */ __name((params) => new ZodDateImpl(__spreadValues({
  checks: [],
  coerce: (params == null ? undefined : params.coerce) || false,
  typeName: "ZodDate"
}, _processCreateParams(params))), "dateType");
var refType = /* @__PURE__ */ __name((uri) => new ZodRefImpl({ typeName: "ZodRef", uri }), "refType");
var literalType = /* @__PURE__ */ __name((value, params) => new ZodLiteralImpl(__spreadValues({ value, typeName: "ZodLiteral" }, _processCreateParams(params))), "literalType");
var enumType = /* @__PURE__ */ __name((values, params) => new ZodEnumImpl(__spreadValues({ values, typeName: "ZodEnum" }, _processCreateParams(params))), "enumType");
var nativeEnumType = /* @__PURE__ */ __name((values, params) => new ZodNativeEnumImpl(__spreadValues({ values, typeName: "ZodNativeEnum" }, _processCreateParams(params))), "nativeEnumType");
var arrayType = /* @__PURE__ */ __name((schema, params) => new ZodArrayImpl(__spreadValues({
  type: schema,
  minLength: null,
  maxLength: null,
  exactLength: null,
  typeName: "ZodArray"
}, _processCreateParams(params))), "arrayType");
var objectType = /* @__PURE__ */ __name((shape, params) => new ZodObjectImpl(__spreadValues({
  shape: () => shape,
  unknownKeys: "strip",
  typeName: "ZodObject"
}, _processCreateParams(params))), "objectType");
var strictObjectType = /* @__PURE__ */ __name((shape, params) => new ZodObjectImpl(__spreadValues({
  shape: () => shape,
  unknownKeys: "strict",
  typeName: "ZodObject"
}, _processCreateParams(params))), "strictObjectType");
var unionType = /* @__PURE__ */ __name((types, params) => new ZodUnionImpl(__spreadValues({ options: types, typeName: "ZodUnion" }, _processCreateParams(params))), "unionType");
var discriminatedUnionType = /* @__PURE__ */ __name((discriminator, options, params) => new ZodDiscriminatedUnionImpl(__spreadValues({
  typeName: "ZodDiscriminatedUnion",
  discriminator,
  options
}, _processCreateParams(params))), "discriminatedUnionType");
var intersectionType = /* @__PURE__ */ __name((left, right, params) => new ZodIntersectionImpl(__spreadValues({ left, right, typeName: "ZodIntersection" }, _processCreateParams(params))), "intersectionType");
var tupleType = /* @__PURE__ */ __name((schemas, params) => {
  if (!Array.isArray(schemas)) {
    throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
  }
  return new ZodTupleImpl(__spreadValues({ items: schemas, typeName: "ZodTuple", rest: null }, _processCreateParams(params)));
}, "tupleType");
var recordType = /* @__PURE__ */ __name((first, second, third) => {
  if (second instanceof ZodBaseTypeImpl) {
    return new ZodRecordImpl(__spreadValues({
      keyType: first,
      valueType: second,
      typeName: "ZodRecord"
    }, _processCreateParams(third)));
  }
  return new ZodRecordImpl(__spreadValues({
    keyType: stringType(),
    valueType: first,
    typeName: "ZodRecord"
  }, _processCreateParams(second)));
}, "recordType");
var mapType = /* @__PURE__ */ __name((keyType, valueType, params) => new ZodMapImpl(__spreadValues({ valueType, keyType, typeName: "ZodMap" }, _processCreateParams(params))), "mapType");
var setType = /* @__PURE__ */ __name((valueType, params) => new ZodSetImpl(__spreadValues({ valueType, minSize: null, maxSize: null, typeName: "ZodSet" }, _processCreateParams(params))), "setType");
var lazyType = /* @__PURE__ */ __name((getter, params) => new ZodLazyImpl(__spreadValues({ getter, typeName: "ZodLazy" }, _processCreateParams(params))), "lazyType");
var promiseType = /* @__PURE__ */ __name((schema, params) => new ZodPromiseImpl(__spreadValues({ type: schema, typeName: "ZodPromise" }, _processCreateParams(params))), "promiseType");
var functionType = /* @__PURE__ */ __name((args, returns, params) => {
  return new ZodFunctionImpl(__spreadValues({
    args: args ? args : tupleType([]).rest(unknownType()),
    returns: returns || unknownType(),
    typeName: "ZodFunction"
  }, _processCreateParams(params)));
}, "functionType");
var preprocessType = /* @__PURE__ */ __name((preprocess, schema, params) => new ZodEffectsImpl(__spreadValues({
  schema,
  effect: {
    type: "upstream",
    effect: (arg, ctx) => {
      const result = preprocess(arg, ctx);
      if (result instanceof Promise) {
        return result.then((res) => OK(res));
      }
      return OK(result);
    }
  },
  typeName: "ZodEffects"
}, _processCreateParams(params))), "preprocessType");
var upstreamType = /* @__PURE__ */ __name((effect, schema, params) => new ZodEffectsImpl(__spreadValues({
  schema,
  effect: { type: "upstream", effect },
  typeName: "ZodEffects"
}, _processCreateParams(params))), "upstreamType");
var downstreamType = /* @__PURE__ */ __name((schema, effect, params) => new ZodEffectsImpl(__spreadValues({
  schema,
  effect: { type: "downstream", effect, failFast: params == null ? undefined : params.failFast },
  typeName: "ZodEffects"
}, _processCreateParams(params))), "downstreamType");
var optionalType = /* @__PURE__ */ __name((type, params) => new ZodOptionalImpl(__spreadValues({ innerType: type, typeName: "ZodOptional" }, _processCreateParams(params))), "optionalType");
var nullableType = /* @__PURE__ */ __name((type, params) => new ZodNullableImpl(__spreadValues({ innerType: type, typeName: "ZodNullable" }, _processCreateParams(params))), "nullableType");
var readonlyType = /* @__PURE__ */ __name((type, params) => new ZodReadonlyImpl(__spreadValues({ innerType: type, typeName: "ZodReadonly" }, _processCreateParams(params))), "readonlyType");
var defaultType = /* @__PURE__ */ __name((type, value, params) => new ZodDefaultImpl(__spreadValues({
  innerType: type,
  typeName: "ZodDefault",
  defaultValue: typeof value === "function" ? value : () => value
}, _processCreateParams(params))), "defaultType");
var catchType = /* @__PURE__ */ __name((type, catcher, params) => new ZodCatchImpl(__spreadValues({
  innerType: type,
  typeName: "ZodCatch",
  catchValue: typeof catcher === "function" ? catcher : () => catcher
}, _processCreateParams(params))), "catchType");
var pipelineType = /* @__PURE__ */ __name((a, b) => new ZodPipelineImpl({ in: a, out: b, typeName: "ZodPipeline" }), "pipelineType");
var brandedType = /* @__PURE__ */ __name((type) => new ZodBrandedImpl(__spreadValues({
  typeName: "ZodBranded",
  type
}, _processCreateParams({ supportsExtensions: ["secret"] }))), "brandedType");
setBuilders({
  any: anyType,
  array: arrayType,
  bigint: bigIntType,
  boolean: booleanType,
  branded: brandedType,
  catch: catchType,
  custom: customType,
  date: dateType,
  default: defaultType,
  discriminatedUnion: discriminatedUnionType,
  enum: enumType,
  function: functionType,
  instanceof: instanceOfType,
  intersection: intersectionType,
  lazy: lazyType,
  literal: literalType,
  map: mapType,
  nan: nanType,
  nativeEnum: nativeEnumType,
  never: neverType,
  null: nullType,
  nullable: nullableType,
  number: numberType,
  object: objectType,
  optional: optionalType,
  pipeline: pipelineType,
  preprocess: preprocessType,
  upstream: upstreamType,
  downstream: downstreamType,
  promise: promiseType,
  record: recordType,
  ref: refType,
  readonly: readonlyType,
  set: setType,
  strictObject: strictObjectType,
  string: stringType,
  symbol: symbolType,
  tuple: tupleType,
  undefined: undefinedType,
  union: unionType,
  unknown: unknownType,
  void: voidType
});
var coerce = {
  string(arg) {
    return stringType(__spreadProps(__spreadValues({}, arg), { coerce: true }));
  },
  number(arg) {
    return numberType(__spreadProps(__spreadValues({}, arg), { coerce: true }));
  },
  boolean(arg) {
    return booleanType(__spreadProps(__spreadValues({}, arg), { coerce: true }));
  },
  bigint(arg) {
    return bigIntType(__spreadProps(__spreadValues({}, arg), { coerce: true }));
  },
  date(arg) {
    return dateType(__spreadProps(__spreadValues({}, arg), { coerce: true }));
  }
};
var OK = /* @__PURE__ */ __name((value) => ({ status: "valid", value }), "OK");
var ERR = /* @__PURE__ */ __name((issue, ...issues) => ({
  status: "aborted",
  issues: [issue, ...issues]
}), "ERR");
var DIRTY = /* @__PURE__ */ __name((value, issue, ...issues) => ({
  status: "dirty",
  value,
  issues: [issue, ...issues]
}), "DIRTY");
var errors_exports = {};
__export2(errors_exports, {
  JSONSchemaToZuiError: () => JSONSchemaToZuiError,
  ObjectToZuiError: () => ObjectToZuiError,
  UnrepresentableGenericError: () => UnrepresentableGenericError,
  UnsupportedJSONSchemaToZuiError: () => UnsupportedJSONSchemaToZuiError,
  UnsupportedZuiCheckToJSONSchemaError: () => UnsupportedZuiCheckToJSONSchemaError,
  UnsupportedZuiToJSONSchemaError: () => UnsupportedZuiToJSONSchemaError,
  UnsupportedZuiToTypescriptSchemaError: () => UnsupportedZuiToTypescriptSchemaError,
  UnsupportedZuiToTypescriptTypeError: () => UnsupportedZuiToTypescriptTypeError,
  UntitledDeclarationError: () => UntitledDeclarationError,
  ZuiToJSONSchemaError: () => ZuiToJSONSchemaError,
  ZuiToTypescriptSchemaError: () => ZuiToTypescriptSchemaError,
  ZuiToTypescriptTypeError: () => ZuiToTypescriptTypeError,
  ZuiTransformError: () => ZuiTransformError
});
var _ZuiTransformError = class _ZuiTransformError2 extends Error {
  constructor(transform, message, path) {
    const msg = path ? `${path} : ${message}` : message;
    super(msg);
    this.transform = transform;
    this.path = path;
  }
};
__name(_ZuiTransformError, "ZuiTransformError");
var ZuiTransformError = _ZuiTransformError;
var _JSONSchemaToZuiError = class _JSONSchemaToZuiError2 extends ZuiTransformError {
  constructor(message, path) {
    super("json-schema-to-zui", message, path);
  }
};
__name(_JSONSchemaToZuiError, "JSONSchemaToZuiError");
var JSONSchemaToZuiError = _JSONSchemaToZuiError;
var _UnsupportedJSONSchemaToZuiError = class _UnsupportedJSONSchemaToZuiError2 extends JSONSchemaToZuiError {
  constructor(schema, path) {
    super(`JSON Schema ${JSON.stringify(schema)} cannot be transformed to ZUI type.`, path);
  }
};
__name(_UnsupportedJSONSchemaToZuiError, "UnsupportedJSONSchemaToZuiError");
var UnsupportedJSONSchemaToZuiError = _UnsupportedJSONSchemaToZuiError;
var _ObjectToZuiError = class _ObjectToZuiError2 extends ZuiTransformError {
  constructor(message, path) {
    super("object-to-zui", message, path);
  }
};
__name(_ObjectToZuiError, "ObjectToZuiError");
var ObjectToZuiError = _ObjectToZuiError;
var _ZuiToJSONSchemaError = class _ZuiToJSONSchemaError2 extends ZuiTransformError {
  constructor(message, path) {
    super("zui-to-json-schema", message, path);
  }
};
__name(_ZuiToJSONSchemaError, "ZuiToJSONSchemaError");
var ZuiToJSONSchemaError = _ZuiToJSONSchemaError;
var _UnsupportedZuiToJSONSchemaError = class _UnsupportedZuiToJSONSchemaError2 extends ZuiToJSONSchemaError {
  constructor(type, path, { suggestedAlternative } = {}) {
    const msg = suggestedAlternative ? `Zod type ${type} cannot be transformed to JSON Schema. Suggested alternative: ${suggestedAlternative}` : `Zod type ${type} cannot be transformed to JSON Schema.`;
    super(msg, path);
  }
};
__name(_UnsupportedZuiToJSONSchemaError, "UnsupportedZuiToJSONSchemaError");
var UnsupportedZuiToJSONSchemaError = _UnsupportedZuiToJSONSchemaError;
var _UnsupportedZuiCheckToJSONSchemaError = class _UnsupportedZuiCheckToJSONSchemaError2 extends ZuiToJSONSchemaError {
  constructor(zodType, checkKind, path) {
    super(`Zod check .${checkKind}() of type ${zodType} cannot be transformed to JSON Schema.`, path);
  }
};
__name(_UnsupportedZuiCheckToJSONSchemaError, "UnsupportedZuiCheckToJSONSchemaError");
var UnsupportedZuiCheckToJSONSchemaError = _UnsupportedZuiCheckToJSONSchemaError;
var _ZuiToTypescriptSchemaError = class _ZuiToTypescriptSchemaError2 extends ZuiTransformError {
  constructor(message, path) {
    super("zui-to-typescript-schema", message, path);
  }
};
__name(_ZuiToTypescriptSchemaError, "ZuiToTypescriptSchemaError");
var ZuiToTypescriptSchemaError = _ZuiToTypescriptSchemaError;
var _UnsupportedZuiToTypescriptSchemaError = class _UnsupportedZuiToTypescriptSchemaError2 extends ZuiToTypescriptSchemaError {
  constructor(type, path) {
    super(`Zod type ${type} cannot be transformed to TypeScript schema.`, path);
  }
};
__name(_UnsupportedZuiToTypescriptSchemaError, "UnsupportedZuiToTypescriptSchemaError");
var UnsupportedZuiToTypescriptSchemaError = _UnsupportedZuiToTypescriptSchemaError;
var _ZuiToTypescriptTypeError = class _ZuiToTypescriptTypeError2 extends ZuiTransformError {
  constructor(message, path) {
    super("zui-to-typescript-type", message, path);
  }
};
__name(_ZuiToTypescriptTypeError, "ZuiToTypescriptTypeError");
var ZuiToTypescriptTypeError = _ZuiToTypescriptTypeError;
var _UnsupportedZuiToTypescriptTypeError = class _UnsupportedZuiToTypescriptTypeError2 extends ZuiToTypescriptTypeError {
  constructor(type, path) {
    super(`Zod type ${type} cannot be transformed to TypeScript type.`, path);
  }
};
__name(_UnsupportedZuiToTypescriptTypeError, "UnsupportedZuiToTypescriptTypeError");
var UnsupportedZuiToTypescriptTypeError = _UnsupportedZuiToTypescriptTypeError;
var _UntitledDeclarationError = class _UntitledDeclarationError2 extends ZuiToTypescriptTypeError {
  constructor() {
    super("Schema must have a title to be transformed to a TypeScript type with a declaration.");
  }
};
__name(_UntitledDeclarationError, "UntitledDeclarationError");
var UntitledDeclarationError = _UntitledDeclarationError;
var _UnrepresentableGenericError = class _UnrepresentableGenericError2 extends ZuiToTypescriptTypeError {
  constructor() {
    super('ZodRef can only be transformed to a TypeScript type with a "type" declaration.');
  }
};
__name(_UnrepresentableGenericError, "UnrepresentableGenericError");
var UnrepresentableGenericError = _UnrepresentableGenericError;
var evalZuiString = /* @__PURE__ */ __name((zuiString) => {
  let result;
  try {
    result = new Function("z", `return ${zuiString}`)(z_exports);
  } catch (thrown) {
    const err = thrown instanceof Error ? thrown : new Error(String(thrown));
    return { sucess: false, error: `Failed to evaluate schema: ${err.message}` };
  }
  if (!is.zuiType(result)) {
    return { sucess: false, error: `String "${zuiString}" does not evaluate to a Zod schema` };
  }
  return {
    sucess: true,
    value: result
  };
}, "evalZuiString");
var ZodFirstPartyTypeKind = {
  ZodString: "ZodString",
  ZodNumber: "ZodNumber",
  ZodNaN: "ZodNaN",
  ZodBigInt: "ZodBigInt",
  ZodBoolean: "ZodBoolean",
  ZodDate: "ZodDate",
  ZodSymbol: "ZodSymbol",
  ZodUndefined: "ZodUndefined",
  ZodNull: "ZodNull",
  ZodAny: "ZodAny",
  ZodUnknown: "ZodUnknown",
  ZodNever: "ZodNever",
  ZodVoid: "ZodVoid",
  ZodArray: "ZodArray",
  ZodObject: "ZodObject",
  ZodUnion: "ZodUnion",
  ZodDiscriminatedUnion: "ZodDiscriminatedUnion",
  ZodIntersection: "ZodIntersection",
  ZodTuple: "ZodTuple",
  ZodRecord: "ZodRecord",
  ZodRef: "ZodRef",
  ZodMap: "ZodMap",
  ZodSet: "ZodSet",
  ZodFunction: "ZodFunction",
  ZodLazy: "ZodLazy",
  ZodLiteral: "ZodLiteral",
  ZodEnum: "ZodEnum",
  ZodEffects: "ZodEffects",
  ZodNativeEnum: "ZodNativeEnum",
  ZodOptional: "ZodOptional",
  ZodNullable: "ZodNullable",
  ZodDefault: "ZodDefault",
  ZodCatch: "ZodCatch",
  ZodPromise: "ZodPromise",
  ZodBranded: "ZodBranded",
  ZodPipeline: "ZodPipeline",
  ZodReadonly: "ZodReadonly"
};
var half = /* @__PURE__ */ __name((arr) => {
  return [arr.slice(0, arr.length / 2), arr.slice(arr.length / 2)];
}, "half");
var omit2 = /* @__PURE__ */ __name((obj, ...keys22) => Object.keys(obj).reduce((acc, key) => {
  if (!keys22.includes(key)) {
    acc[key] = obj[key];
  }
  return acc;
}, {}), "omit");
function withMessage(schema, key, get22) {
  var _a;
  const value = schema[key];
  let r = "";
  if (value !== undefined) {
    const got = get22({ value, json: JSON.stringify(value) });
    if (got) {
      const opener = got[0];
      const prefix = got.length === 3 ? got[1] : "";
      const closer = got.length === 3 ? got[2] : got[1];
      r += opener;
      if (((_a = schema.errorMessage) == null ? undefined : _a[key]) !== undefined) {
        r += prefix + JSON.stringify(schema.errorMessage[key]);
      }
      r += closer;
    }
  }
  return r;
}
__name(withMessage, "withMessage");
var originalIndex = Symbol("Original index");
var ensureOriginalIndex = /* @__PURE__ */ __name((arr) => {
  const newArr = [];
  for (let i = 0;i < arr.length; i++) {
    const item = arr[i];
    if (typeof item === "boolean") {
      newArr.push(item ? { [originalIndex]: i } : { [originalIndex]: i, not: {} });
    } else if (originalIndex in item) {
      return arr;
    } else {
      newArr.push(__spreadProps(__spreadValues({}, item), { [originalIndex]: i }));
    }
  }
  return newArr;
}, "ensureOriginalIndex");
function parseAllOf(schema, refs) {
  if (schema.allOf.length === 0) {
    return "z.never()";
  } else if (schema.allOf.length === 1) {
    const item = schema.allOf[0];
    return parseSchema(item, __spreadProps(__spreadValues({}, refs), {
      path: [...refs.path, "allOf", item[originalIndex]]
    }));
  } else {
    const [left, right] = half(ensureOriginalIndex(schema.allOf));
    return `z.intersection(${parseAllOf({ allOf: left }, refs)}, ${parseAllOf({
      allOf: right
    }, refs)})`;
  }
}
__name(parseAllOf, "parseAllOf");
var parseAnyOf = /* @__PURE__ */ __name((schema, refs) => {
  return schema.anyOf.length ? schema.anyOf.length === 1 ? parseSchema(schema.anyOf[0], __spreadProps(__spreadValues({}, refs), {
    path: [...refs.path, "anyOf", 0]
  })) : `z.union([${schema.anyOf.map((schema2, i) => parseSchema(schema2, __spreadProps(__spreadValues({}, refs), { path: [...refs.path, "anyOf", i] }))).join(", ")}])` : "z.any()";
}, "parseAnyOf");
var parseArray = /* @__PURE__ */ __name((schema, refs) => {
  if (Array.isArray(schema.items)) {
    return `z.tuple([${schema.items.map((v, i) => parseSchema(v, __spreadProps(__spreadValues({}, refs), { path: [...refs.path, "items", i] })))}])`;
  }
  let r = !schema.items ? "z.array(z.any())" : `z.array(${parseSchema(schema.items, __spreadProps(__spreadValues({}, refs), {
    path: [...refs.path, "items"]
  }))})`;
  r += withMessage(schema, "minItems", ({ json }) => [`.min(${json}`, ", ", ")"]);
  r += withMessage(schema, "maxItems", ({ json }) => [`.max(${json}`, ", ", ")"]);
  return r;
}, "parseArray");
var parseBoolean = /* @__PURE__ */ __name((_schema) => {
  var _a;
  if ((_a = _schema[zuiKey]) == null ? undefined : _a.coerce) {
    return "z.coerce.boolean()";
  }
  return "z.boolean()";
}, "parseBoolean");
var parseConst = /* @__PURE__ */ __name((schema) => {
  return `z.literal(${JSON.stringify(schema.const)})`;
}, "parseConst");
var parseDefault = /* @__PURE__ */ __name((_schema) => {
  return "z.any()";
}, "parseDefault");
var parseOneOf = /* @__PURE__ */ __name((schema, refs) => {
  return schema.oneOf.length ? schema.oneOf.length === 1 ? parseSchema(schema.oneOf[0], __spreadProps(__spreadValues({}, refs), {
    path: [...refs.path, "oneOf", 0]
  })) : `z.any().superRefine((x, ctx) => {
    const schemas = [${schema.oneOf.map((schema2, i) => parseSchema(schema2, __spreadProps(__spreadValues({}, refs), {
    path: [...refs.path, "oneOf", i]
  }))).join(", ")}];
    const errors = schemas.reduce(
      (errors: z.ZodError[], schema) =>
        ((result) => ("error" in result ? [...errors, result.error] : errors))(
          schema.safeParse(x)
        ),
      []
    );
    if (schemas.length - errors.length !== 1) {
      ctx.addIssue({
        path: ctx.path,
        code: "invalid_union",
        unionErrors: errors,
        message: "Invalid input: Should pass single schema",
      });
    }
  })` : "z.any()";
}, "parseOneOf");
var parseDiscriminator = /* @__PURE__ */ __name((schema, refs) => {
  var _a, _b;
  if (schema.oneOf.length <= 1 || !((_a = schema.discriminator) == null ? undefined : _a.propertyName)) {
    return parseOneOf(schema, refs);
  }
  const schemas = schema.oneOf.map((schema2, i) => parseSchema(schema2, __spreadProps(__spreadValues({}, refs), {
    path: [...refs.path, "oneOf", i]
  })));
  return `z.discriminatedUnion("${(_b = schema.discriminator) == null ? undefined : _b.propertyName}", [${schemas.join(", ")}])`;
}, "parseDiscriminator");
var parseEnum = /* @__PURE__ */ __name((schema) => {
  if (schema.enum.length === 0) {
    return "z.never()";
  } else if (schema.enum.length === 1) {
    return `z.literal(${JSON.stringify(schema.enum[0])})`;
  } else if (schema.enum.every((x) => typeof x === "string")) {
    return `z.enum([${schema.enum.map((x) => JSON.stringify(x))}])`;
  } else {
    return `z.union([${schema.enum.map((x) => `z.literal(${JSON.stringify(x)})`).join(", ")}])`;
  }
}, "parseEnum");
var parseIfThenElse = /* @__PURE__ */ __name((schema, refs) => {
  const $if = parseSchema(schema.if, __spreadProps(__spreadValues({}, refs), { path: [...refs.path, "if"] }));
  const $then = parseSchema(schema.then, __spreadProps(__spreadValues({}, refs), {
    path: [...refs.path, "then"]
  }));
  const $else = parseSchema(schema.else, __spreadProps(__spreadValues({}, refs), {
    path: [...refs.path, "else"]
  }));
  return `z.union([${$then}, ${$else}]).superRefine((value,ctx) => {
  const result = ${$if}.safeParse(value).success
    ? ${$then}.safeParse(value)
    : ${$else}.safeParse(value);
  if (!result.success) {
    result.error.errors.forEach((error) => ctx.addIssue(error))
  }
})`;
}, "parseIfThenElse");
var parseMultipleType = /* @__PURE__ */ __name((schema, refs) => {
  return `z.union([${schema.type.map((type) => parseSchema(__spreadProps(__spreadValues({}, schema), { type }), refs)).join(", ")}])`;
}, "parseMultipleType");
var parseNot = /* @__PURE__ */ __name((schema, refs) => {
  return `z.any().refine((value) => !${parseSchema(schema.not, __spreadProps(__spreadValues({}, refs), {
    path: [...refs.path, "not"]
  }))}.safeParse(value).success, "Invalid input: Should NOT be valid against schema")`;
}, "parseNot");
var parseNull = /* @__PURE__ */ __name((_schema) => {
  return "z.null()";
}, "parseNull");
var parseNullable = /* @__PURE__ */ __name((schema, refs) => {
  return `${parseSchema(omit2(schema, "nullable"), refs, true)}.nullable()`;
}, "parseNullable");
var parseNumber = /* @__PURE__ */ __name((schema) => {
  var _a;
  let r = "z.number()";
  if ((_a = schema[zuiKey]) == null ? undefined : _a.coerce) {
    r = "z.coerce.number()";
  }
  if (schema.type === "integer") {
    r += withMessage(schema, "type", () => [".int(", ")"]);
  } else {
    r += withMessage(schema, "format", ({ value }) => {
      if (value === "int64") {
        return [".int(", ")"];
      }
    });
  }
  r += withMessage(schema, "multipleOf", ({ value, json }) => {
    if (value === 1) {
      if (r.startsWith("z.number().int(")) {
        return;
      }
      return [".int(", ")"];
    }
    return [`.multipleOf(${json}`, ", ", ")"];
  });
  if (typeof schema.minimum === "number") {
    if (schema.exclusiveMinimum === true) {
      r += withMessage(schema, "minimum", ({ json }) => [`.gt(${json}`, ", ", ")"]);
    } else {
      r += withMessage(schema, "minimum", ({ json }) => [`.gte(${json}`, ", ", ")"]);
    }
  } else if (typeof schema.exclusiveMinimum === "number") {
    r += withMessage(schema, "exclusiveMinimum", ({ json }) => [`.gt(${json}`, ", ", ")"]);
  }
  if (typeof schema.maximum === "number") {
    if (schema.exclusiveMaximum === true) {
      r += withMessage(schema, "maximum", ({ json }) => [`.lt(${json}`, ", ", ")"]);
    } else {
      r += withMessage(schema, "maximum", ({ json }) => [`.lte(${json}`, ", ", ")"]);
    }
  } else if (typeof schema.exclusiveMaximum === "number") {
    r += withMessage(schema, "exclusiveMaximum", ({ json }) => [`.lt(${json}`, ", ", ")"]);
  }
  return r;
}, "parseNumber");
function parseObject(objectSchema, refs) {
  let properties = undefined;
  if (objectSchema.properties) {
    if (!Object.keys(objectSchema.properties).length) {
      properties = "z.object({})";
    } else {
      properties = "z.object({ ";
      properties += Object.keys(objectSchema.properties).map((key) => {
        const propSchema = objectSchema.properties[key];
        const result = `${JSON.stringify(key)}: ${parseSchema(propSchema, __spreadProps(__spreadValues({}, refs), {
          path: [...refs.path, "properties", key]
        }))}`;
        const hasDefault = typeof propSchema === "object" && propSchema.default !== undefined || typeof objectSchema.default === "object" && objectSchema.default !== null && key in objectSchema.default;
        const required = Array.isArray(objectSchema.required) ? objectSchema.required.includes(key) : typeof propSchema === "object" && propSchema.required === true;
        const optional = !hasDefault && !required;
        return optional ? `${result}.optional()` : result;
      }).join(", ");
      properties += " })";
    }
  }
  const additionalProperties = objectSchema.additionalProperties !== undefined ? parseSchema(objectSchema.additionalProperties, __spreadProps(__spreadValues({}, refs), {
    path: [...refs.path, "additionalProperties"]
  })) : undefined;
  let patternProperties = undefined;
  if (objectSchema.patternProperties) {
    const parsedPatternProperties = Object.fromEntries(Object.entries(objectSchema.patternProperties).map(([key, value]) => {
      return [
        key,
        parseSchema(value, __spreadProps(__spreadValues({}, refs), {
          path: [...refs.path, "patternProperties", key]
        }))
      ];
    }, {}));
    patternProperties = "";
    if (properties) {
      if (additionalProperties) {
        patternProperties += `.catchall(z.union([${[
          ...Object.values(parsedPatternProperties),
          additionalProperties
        ].join(", ")}]))`;
      } else if (Object.keys(parsedPatternProperties).length > 1) {
        patternProperties += `.catchall(z.union([${Object.values(parsedPatternProperties).join(", ")}]))`;
      } else {
        patternProperties += `.catchall(${Object.values(parsedPatternProperties)})`;
      }
    } else {
      if (additionalProperties) {
        patternProperties += `z.record(z.union([${[
          ...Object.values(parsedPatternProperties),
          additionalProperties
        ].join(", ")}]))`;
      } else if (Object.keys(parsedPatternProperties).length > 1) {
        patternProperties += `z.record(z.union([${Object.values(parsedPatternProperties).join(", ")}]))`;
      } else {
        patternProperties += `z.record(${Object.values(parsedPatternProperties)})`;
      }
    }
    patternProperties += `.superRefine((value, ctx) => {
`;
    patternProperties += `for (const key in value) {
`;
    if (additionalProperties) {
      if (objectSchema.properties) {
        patternProperties += `let evaluated = [${Object.keys(objectSchema.properties).map((key) => JSON.stringify(key)).join(", ")}].includes(key)
`;
      } else {
        patternProperties += `let evaluated = false
`;
      }
    }
    for (const key in objectSchema.patternProperties) {
      patternProperties += "if (key.match(new RegExp(" + JSON.stringify(key) + `))) {
`;
      if (additionalProperties) {
        patternProperties += `evaluated = true
`;
      }
      patternProperties += "const result = " + parsedPatternProperties[key] + `.safeParse(value[key])
`;
      patternProperties += `if (!result.success) {
`;
      patternProperties += `ctx.addIssue({
          path: [...ctx.path, key],
          code: 'custom',
          message: \`Invalid input: Key matching regex /\${key}/ must match schema\`,
          params: {
            issues: result.error.issues
          }
        })
`;
      patternProperties += `}
`;
      patternProperties += `}
`;
    }
    if (additionalProperties) {
      patternProperties += `if (!evaluated) {
`;
      patternProperties += "const result = " + additionalProperties + `.safeParse(value[key])
`;
      patternProperties += `if (!result.success) {
`;
      patternProperties += `ctx.addIssue({
          path: [...ctx.path, key],
          code: 'custom',
          message: \`Invalid input: must match catchall schema\`,
          params: {
            issues: result.error.issues
          }
        })
`;
      patternProperties += `}
`;
      patternProperties += `}
`;
    }
    patternProperties += `}
`;
    patternProperties += "})";
  }
  let output = properties ? patternProperties ? properties + patternProperties : additionalProperties ? additionalProperties === "z.never()" ? properties + ".strict()" : properties + `.catchall(${additionalProperties})` : properties : patternProperties ? patternProperties : additionalProperties ? `z.record(${additionalProperties})` : "z.record(z.any())";
  if (its.an.anyOf(objectSchema)) {
    output += `.and(${parseAnyOf(__spreadProps(__spreadValues({}, objectSchema), {
      anyOf: objectSchema.anyOf.map((x) => typeof x === "object" && !x.type && (x.properties || x.additionalProperties || x.patternProperties) ? __spreadProps(__spreadValues({}, x), { type: "object" }) : x)
    }), refs)})`;
  }
  if (its.a.oneOf(objectSchema)) {
    output += `.and(${parseOneOf(__spreadProps(__spreadValues({}, objectSchema), {
      oneOf: objectSchema.oneOf.map((x) => typeof x === "object" && !x.type && (x.properties || x.additionalProperties || x.patternProperties) ? __spreadProps(__spreadValues({}, x), { type: "object" }) : x)
    }), refs)})`;
  }
  if (its.an.allOf(objectSchema)) {
    output += `.and(${parseAllOf(__spreadProps(__spreadValues({}, objectSchema), {
      allOf: objectSchema.allOf.map((x) => typeof x === "object" && !x.type && (x.properties || x.additionalProperties || x.patternProperties) ? __spreadProps(__spreadValues({}, x), { type: "object" }) : x)
    }), refs)})`;
  }
  return output;
}
__name(parseObject, "parseObject");
var parseRef = /* @__PURE__ */ __name((schema) => {
  return `z.ref('${schema.$ref}')`;
}, "parseRef");
var parseString = /* @__PURE__ */ __name((schema) => {
  var _a;
  let r = "z.string()";
  if ((_a = schema[zuiKey]) == null ? undefined : _a.coerce) {
    if (schema.format === "date-time") {
      return "z.coerce.date()";
    }
    r = "z.coerce.string()";
  }
  r += withMessage(schema, "format", ({ value }) => {
    switch (value) {
      case "email":
        return [".email(", ")"];
      case "ip":
        return [".ip(", ")"];
      case "ipv4":
        return ['.ip({ version: "v4"', ", message: ", " })"];
      case "ipv6":
        return ['.ip({ version: "v6"', ", message: ", " })"];
      case "uri":
        return [".url(", ")"];
      case "uuid":
        return [".uuid(", ")"];
      case "date-time":
        return [".datetime(", ")"];
    }
  });
  r += withMessage(schema, "pattern", ({ json }) => [`.regex(new RegExp(${json})`, ", ", ")"]);
  r += withMessage(schema, "minLength", ({ json }) => [`.min(${json}`, ", ", ")"]);
  r += withMessage(schema, "maxLength", ({ json }) => [`.max(${json}`, ", ", ")"]);
  return r;
}, "parseString");
var parseSchema = /* @__PURE__ */ __name((schema, refs = { seen: /* @__PURE__ */ new Map, path: [] }, blockMeta) => {
  if (typeof schema !== "object")
    return schema ? "z.any()" : "z.never()";
  if (refs.parserOverride) {
    const custom = refs.parserOverride(schema, refs);
    if (typeof custom === "string") {
      return custom;
    }
  }
  let seen = refs.seen.get(schema);
  if (seen) {
    if (seen.r !== undefined) {
      return seen.r;
    }
    if (refs.depth === undefined || seen.n >= refs.depth) {
      return "z.any()";
    }
    seen.n += 1;
  } else {
    seen = { r: undefined, n: 0 };
    refs.seen.set(schema, seen);
  }
  let parsed = selectParser(schema, refs);
  if (!blockMeta) {
    parsed = addMeta(schema, parsed);
    if (!refs.withoutDefaults) {
      parsed = addDefaults(schema, parsed);
    }
  }
  seen.r = parsed;
  return parsed;
}, "parseSchema");
var addMeta = /* @__PURE__ */ __name((schema, parsed) => {
  if (schema.description) {
    parsed += `.describe(${JSON.stringify(schema.description)})`;
  }
  return parsed;
}, "addMeta");
var addDefaults = /* @__PURE__ */ __name((schema, parsed) => {
  if (schema.default !== undefined) {
    parsed += `.default(${JSON.stringify(schema.default)})`;
  }
  return parsed;
}, "addDefaults");
var selectParser = /* @__PURE__ */ __name((schema, refs) => {
  if (its.a.nullable(schema)) {
    return parseNullable(schema, refs);
  } else if (its.an.object(schema)) {
    return parseObject(schema, refs);
  } else if (its.an.array(schema)) {
    return parseArray(schema, refs);
  } else if (its.an.anyOf(schema)) {
    return parseAnyOf(schema, refs);
  } else if (its.an.allOf(schema)) {
    return parseAllOf(schema, refs);
  } else if (its.a.discriminator(schema)) {
    return parseDiscriminator(schema, refs);
  } else if (its.a.oneOf(schema)) {
    return parseOneOf(schema, refs);
  } else if (its.a.not(schema)) {
    return parseNot(schema, refs);
  } else if (its.an.enum(schema)) {
    return parseEnum(schema);
  } else if (its.a.const(schema)) {
    return parseConst(schema);
  } else if (its.a.multipleType(schema)) {
    return parseMultipleType(schema, refs);
  } else if (its.a.primitive(schema, "string")) {
    return parseString(schema);
  } else if (its.a.primitive(schema, "number") || its.a.primitive(schema, "integer")) {
    return parseNumber(schema);
  } else if (its.a.primitive(schema, "boolean")) {
    return parseBoolean(schema);
  } else if (its.a.primitive(schema, "null")) {
    return parseNull(schema);
  } else if (its.a.conditional(schema)) {
    return parseIfThenElse(schema, refs);
  } else if (its.a.ref(schema)) {
    return parseRef(schema);
  } else {
    return parseDefault(schema);
  }
}, "selectParser");
var its = {
  an: {
    object: (x) => x.type === "object",
    array: (x) => x.type === "array",
    anyOf: (x) => x.anyOf !== undefined,
    allOf: (x) => x.allOf !== undefined,
    enum: (x) => x.enum !== undefined
  },
  a: {
    nullable: (x) => x.nullable === true,
    multipleType: (x) => Array.isArray(x.type),
    not: (x) => x.not !== undefined,
    const: (x) => x.const !== undefined,
    primitive: (x, p) => x.type === p,
    conditional: (x) => Boolean("if" in x && x.if && "then" in x && "else" in x && x.then && x.else),
    discriminator: (x) => {
      var _a;
      return x.oneOf !== undefined && ((_a = x.discriminator) == null ? undefined : _a.propertyName) !== undefined;
    },
    oneOf: (x) => x.oneOf !== undefined,
    ref: (x) => x.$ref !== undefined
  }
};
var jsonSchemaToZodStr = /* @__PURE__ */ __name((schema) => {
  return parseSchema(schema, {
    seen: /* @__PURE__ */ new Map,
    path: []
  });
}, "jsonSchemaToZodStr");
var jsonSchemaToZod = /* @__PURE__ */ __name((schema) => {
  let code = jsonSchemaToZodStr(schema);
  code = code.replaceAll("errors: z.ZodError[]", "errors");
  const evaluationResult = evalZuiString(code);
  if (!evaluationResult.sucess) {
    throw new JSONSchemaToZuiError(evaluationResult.error);
  }
  return evaluationResult.value;
}, "jsonSchemaToZod");
var applyZuiPropsRecursively = /* @__PURE__ */ __name((zodField, jsonSchemaField) => {
  var _a, _b;
  if (jsonSchemaField[zuiKey] && zodField._def) {
    zodField.naked()._def[zuiKey] = jsonSchemaField[zuiKey];
  }
  if (((_a = zodField._def) == null ? undefined : _a.typeName) === "ZodObject" && jsonSchemaField.type === "object" && jsonSchemaField.properties) {
    Object.entries(jsonSchemaField.properties).forEach(([key, nestedField]) => {
      const shape = typeof zodField._def.shape === "function" ? zodField._def.shape() : zodField._def.shape;
      if (shape[key]) {
        applyZuiPropsRecursively(shape[key], nestedField);
      }
    });
  }
  if (((_b = zodField._def) == null ? undefined : _b.typeName) === "ZodRecord" && jsonSchemaField.type === "object" && jsonSchemaField.additionalProperties) {
    applyZuiPropsRecursively(zodField._def.valueType, jsonSchemaField.additionalProperties);
  }
  if (jsonSchemaField.type === "array" && jsonSchemaField.items) {
    const items = jsonSchemaField.items;
    if (typeof items === "object" && !Array.isArray(items)) {
      const arrayShape = zodField._def.type;
      if (arrayShape) {
        applyZuiPropsRecursively(arrayShape, items);
      }
    } else if (Array.isArray(items)) {
      items.forEach((item, index) => {
        const def = zodField._def;
        if (def.typeName === ZodFirstPartyTypeKind.ZodTuple) {
          applyZuiPropsRecursively(def.items[index], item);
        }
      });
    }
  }
}, "applyZuiPropsRecursively");
var fromJSONSchemaLegacy = /* @__PURE__ */ __name((schema) => {
  const zodSchema = jsonSchemaToZod(schema);
  applyZuiPropsRecursively(zodSchema, schema);
  return zodSchema;
}, "fromJSONSchemaLegacy");
var _PropertyPath = class _PropertyPath2 {
  constructor(sections = [], wrapper = "") {
    this.type = "propertyPath";
    this._sections = sections;
    this._wrapper = wrapper;
  }
  withIndexType(type, value) {
    return new _PropertyPath2([...this._sections, { type, value }], this._wrapper);
  }
  withWrapper(wrapper) {
    return new _PropertyPath2([new _PropertyPath2([...this._sections], wrapper)]);
  }
  toString() {
    const wrapperBegin = this._wrapper ? `${this._wrapper}<` : "";
    const wrapperEnd = this._wrapper ? ">" : "";
    const rootCarAtBeginning = this._sections.length === 0 || this._sections[0].type !== "propertyPath" ? "#" : "";
    return `${wrapperBegin}${rootCarAtBeginning}${this._sections.map((section) => {
      var _a;
      if (section.type === "propertyPath")
        return section.toString();
      if (section.type === "key")
        return `.${section.value}`;
      if (section.type === "any")
        return "[*]";
      return `[${(_a = section.value) != null ? _a : section.type}]`;
    }).join("")}${wrapperEnd}`;
  }
};
__name(_PropertyPath, "PropertyPath");
var PropertyPath = _PropertyPath;
var isOptionalSchema = /* @__PURE__ */ __name((s) => {
  var _a, _b;
  return s.anyOf !== undefined && s.anyOf.length === 2 && s.anyOf.some((s2) => typeof s2 !== "boolean" && isUndefinedSchema(s2)) && ((_b = (_a = s["x-zui"]) == null ? undefined : _a.def) == null ? undefined : _b.typeName) === "ZodOptional";
}, "isOptionalSchema");
var isNullableSchema = /* @__PURE__ */ __name((s) => {
  var _a, _b;
  return s.anyOf !== undefined && s.anyOf.length === 2 && s.anyOf.some((s2) => typeof s2 !== "boolean" && s2.type === "null") && ((_b = (_a = s["x-zui"]) == null ? undefined : _a.def) == null ? undefined : _b.typeName) === "ZodNullable";
}, "isNullableSchema");
var isUndefinedSchema = /* @__PURE__ */ __name((s) => {
  var _a, _b;
  return s.not === true && ((_b = (_a = s["x-zui"]) == null ? undefined : _a.def) == null ? undefined : _b.typeName) === "ZodUndefined";
}, "isUndefinedSchema");
var isUnknownSchema = /* @__PURE__ */ __name((s) => {
  var _a, _b;
  return !s.not && ((_b = (_a = s["x-zui"]) == null ? undefined : _a.def) == null ? undefined : _b.typeName) === "ZodUnknown";
}, "isUnknownSchema");
var isDiscriminatedUnionSchema = /* @__PURE__ */ __name((s) => {
  var _a, _b;
  return s.anyOf !== undefined && ((_b = (_a = s["x-zui"]) == null ? undefined : _a.def) == null ? undefined : _b.typeName) === "ZodDiscriminatedUnion";
}, "isDiscriminatedUnionSchema");
var isExclusiveDiscriminatedUnionSchema = /* @__PURE__ */ __name((s) => {
  var _a, _b;
  return s.oneOf !== undefined && ((_b = (_a = s["x-zui"]) == null ? undefined : _a.def) == null ? undefined : _b.typeName) === "ZodDiscriminatedUnion";
}, "isExclusiveDiscriminatedUnionSchema");
var arrayJSONSchemaToZuiArray = /* @__PURE__ */ __name((schema, toZui, path) => _isTuple(schema) ? _handleTuple(schema, toZui, path) : _isSet(schema) ? _handleSet(schema, toZui, path) : _handleArray(schema, toZui, path), "arrayJSONSchemaToZuiArray");
var _isTuple = /* @__PURE__ */ __name((schema) => Array.isArray(schema.items), "_isTuple");
var _isSet = /* @__PURE__ */ __name((schema) => schema.items !== undefined && schema.uniqueItems, "_isSet");
var _handleTuple = /* @__PURE__ */ __name(({ items, additionalItems }, toZui, path) => {
  const itemSchemas = items.map((item, index) => toZui(item, path.withIndexType("number", index)));
  let zodTuple = tupleType(itemSchemas);
  if (additionalItems !== undefined) {
    zodTuple = zodTuple.rest(toZui(additionalItems, path.withIndexType("number")));
  }
  return zodTuple;
}, "_handleTuple");
var _handleSet = /* @__PURE__ */ __name(({ items, minItems, maxItems }, toZui, path) => {
  let zodSet = setType(toZui(items, path.withIndexType("number")));
  if (minItems) {
    zodSet = zodSet.min(minItems);
  }
  if (maxItems) {
    zodSet = zodSet.max(maxItems);
  }
  return zodSet;
}, "_handleSet");
var _handleArray = /* @__PURE__ */ __name(({ minItems, maxItems, items }, toZui, path) => {
  let zodArray = arrayType(toZui(items, path.withIndexType("number")));
  if (minItems && minItems === maxItems) {
    return zodArray.length(minItems);
  }
  if (minItems) {
    zodArray = zodArray.min(minItems);
  }
  if (maxItems) {
    zodArray = zodArray.max(maxItems);
  }
  return zodArray;
}, "_handleArray");
var numberJSONSchemaToZuiNumber = /* @__PURE__ */ __name(({
  type,
  minimum,
  exclusiveMinimum,
  maximum,
  exclusiveMaximum,
  multipleOf,
  format
}) => {
  let zodNumber = numberType();
  if (type === "integer") {
    zodNumber = zodNumber.int();
  }
  if (format === "finite") {
    zodNumber = zodNumber.finite();
  }
  if (exclusiveMinimum !== undefined) {
    zodNumber = zodNumber.gt(exclusiveMinimum);
  } else if (minimum !== undefined) {
    zodNumber = zodNumber.gte(minimum);
  }
  if (exclusiveMaximum !== undefined) {
    zodNumber = zodNumber.lt(exclusiveMaximum);
  } else if (maximum !== undefined) {
    zodNumber = zodNumber.lte(maximum);
  }
  if (multipleOf !== undefined) {
    zodNumber = zodNumber.multipleOf(multipleOf);
  }
  return zodNumber;
}, "numberJSONSchemaToZuiNumber");
var regex_utils_exports = {};
__export2(regex_utils_exports, {
  escapeSpecialChars: () => escapeSpecialChars
});
var escapeSpecialChars = /* @__PURE__ */ __name((unsafeString) => unsafeString.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&"), "escapeSpecialChars");
function addErrorMessage(res, key, errorMessage, refs) {
  if (!(refs == null ? undefined : refs.errorMessages))
    return;
  if (errorMessage) {
    res.errorMessage = __spreadProps(__spreadValues({}, res.errorMessage), {
      [key]: errorMessage
    });
  }
}
__name(addErrorMessage, "addErrorMessage");
function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
  res[key] = value;
  addErrorMessage(res, key, errorMessage, refs);
}
__name(setResponseValueAndErrors, "setResponseValueAndErrors");
var zodPatterns = {
  cuid: "^[cC][^\\s-]{8,}$",
  cuid2: "^[a-z][a-z0-9]*$",
  ulid: "^[0-9A-HJKMNP-TV-Z]{26}$",
  email: "^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",
  emoji: "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
  uuid: "^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$",
  ipv4: "^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",
  ipv6: "^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$"
};
function parseStringDef(def, refs) {
  const res = __spreadValues({
    type: "string"
  }, def.coerce ? {
    [zuiKey]: {
      coerce: def.coerce || undefined
    }
  } : {});
  function processPattern(value) {
    return refs.patternStrategy === "escape" ? regex_utils_exports.escapeSpecialChars(value) : value;
  }
  __name(processPattern, "processPattern");
  if (def.checks) {
    for (const check of def.checks) {
      switch (check.kind) {
        case "min":
          setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
          break;
        case "max":
          setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
          break;
        case "email":
          switch (refs.emailStrategy) {
            case "format:email":
              addFormat(res, "email", check.message, refs);
              break;
            case "format:idn-email":
              addFormat(res, "idn-email", check.message, refs);
              break;
            case "pattern:zod":
              addPattern(res, zodPatterns.email, check.message, refs);
              break;
          }
          break;
        case "url":
          addFormat(res, "uri", check.message, refs);
          break;
        case "uuid":
          addFormat(res, "uuid", check.message, refs);
          break;
        case "regex":
          addPattern(res, check.regex.source, check.message, refs);
          break;
        case "cuid":
          addPattern(res, zodPatterns.cuid, check.message, refs);
          break;
        case "cuid2":
          addPattern(res, zodPatterns.cuid2, check.message, refs);
          break;
        case "startsWith":
          addPattern(res, "^" + processPattern(check.value), check.message, refs);
          break;
        case "endsWith":
          addPattern(res, processPattern(check.value) + "$", check.message, refs);
          break;
        case "datetime":
          addFormat(res, "date-time", check.message, refs);
          break;
        case "length":
          setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
          setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
          break;
        case "includes": {
          addPattern(res, processPattern(check.value), check.message, refs);
          break;
        }
        case "ip": {
          if (check.version !== "v6") {
            addFormat(res, "ipv4", check.message, refs);
          }
          if (check.version !== "v4") {
            addFormat(res, "ipv6", check.message, refs);
          }
          break;
        }
        case "emoji":
          addPattern(res, zodPatterns.emoji, check.message, refs);
          break;
        case "ulid": {
          addPattern(res, zodPatterns.ulid, check.message, refs);
          break;
        }
        case "toLowerCase":
        case "toUpperCase":
        case "trim":
          break;
        default:
          ;
      }
    }
  }
  return res;
}
__name(parseStringDef, "parseStringDef");
var addFormat = /* @__PURE__ */ __name((schema, value, message, refs) => {
  var _a;
  if (schema.format || ((_a = schema.anyOf) == null ? undefined : _a.some((x) => x.format))) {
    if (!schema.anyOf) {
      schema.anyOf = [];
    }
    if (schema.format) {
      schema.anyOf.push(__spreadValues({
        format: schema.format
      }, schema.errorMessage && refs.errorMessages && {
        errorMessage: { format: schema.errorMessage.format }
      }));
      delete schema.format;
      if (schema.errorMessage) {
        delete schema.errorMessage.format;
        if (Object.keys(schema.errorMessage).length === 0) {
          delete schema.errorMessage;
        }
      }
    }
    schema.anyOf.push(__spreadValues({
      format: value
    }, message && refs.errorMessages && { errorMessage: { format: message } }));
  } else {
    setResponseValueAndErrors(schema, "format", value, message, refs);
  }
}, "addFormat");
var addPattern = /* @__PURE__ */ __name((schema, value, message, refs) => {
  var _a;
  if (schema.pattern || ((_a = schema.allOf) == null ? undefined : _a.some((x) => x.pattern))) {
    if (!schema.allOf) {
      schema.allOf = [];
    }
    if (schema.pattern) {
      schema.allOf.push(__spreadValues({
        pattern: schema.pattern
      }, schema.errorMessage && refs.errorMessages && {
        errorMessage: { pattern: schema.errorMessage.pattern }
      }));
      delete schema.pattern;
      if (schema.errorMessage) {
        delete schema.errorMessage.pattern;
        if (Object.keys(schema.errorMessage).length === 0) {
          delete schema.errorMessage;
        }
      }
    }
    schema.allOf.push(__spreadValues({
      pattern: value
    }, message && refs.errorMessages && { errorMessage: { pattern: message } }));
  } else {
    setResponseValueAndErrors(schema, "pattern", value, message, refs);
  }
}, "addPattern");
var stringJSONSchemaToZuiString = /* @__PURE__ */ __name(({
  format,
  pattern,
  minLength,
  maxLength
}) => {
  let zodString = stringType();
  if (minLength && maxLength && minLength === maxLength) {
    zodString = zodString.length(minLength);
  } else {
    if (minLength) {
      zodString = zodString.min(minLength);
    }
    if (maxLength) {
      zodString = zodString.max(maxLength);
    }
  }
  if (format === "cuid" || pattern === zodPatterns.cuid) {
    zodString = zodString.cuid();
  } else if (format === "cuid2" || pattern === zodPatterns.cuid2) {
    zodString = zodString.cuid2();
  } else if (format === "emoji" || pattern === zodPatterns.emoji) {
    zodString = zodString.emoji();
  } else if (format === "ulid" || pattern === zodPatterns.ulid) {
    zodString = zodString.ulid();
  } else if (format === "date-time") {
    const { precision, offset } = pattern ? extractPrecisionAndOffset(pattern) : {};
    zodString = zodString.datetime({ precision, offset });
  } else if (format === "email" || pattern === zodPatterns.email) {
    zodString = zodString.email();
  } else if (format === "ipv4" || pattern === zodPatterns.ipv4) {
    zodString = zodString.ip();
  } else if (format === "ipv6" || pattern === zodPatterns.ipv6) {
    zodString = zodString.ip("v6");
  } else if (format === "uri") {
    zodString = zodString.url();
  } else if (format === "uuid" || pattern === zodPatterns.uuid) {
    zodString = zodString.uuid();
  } else if (pattern) {
    zodString = zodString.regex(new RegExp(pattern));
  }
  return zodString;
}, "stringJSONSchemaToZuiString");
var toZuiPrimitive = /* @__PURE__ */ __name((type, schema, path) => {
  const values = [];
  if (schema.enum !== undefined) {
    values.push(...schema.enum);
  }
  if (schema.const !== undefined) {
    values.push(schema.const);
  }
  let zuiPrimitive;
  const primitiveValues = values.filter((value) => typeof value === type);
  const [first] = primitiveValues;
  if (!first) {
    if (type === "string" && schema.type === "string") {
      zuiPrimitive = stringJSONSchemaToZuiString(schema);
    }
    if (type === "number" && (schema.type === "number" || schema.type === "integer")) {
      zuiPrimitive = numberJSONSchemaToZuiNumber(schema);
    }
    if (type === "boolean") {
      zuiPrimitive = booleanType();
    }
    if (type === "null") {
      zuiPrimitive = nullType();
    }
    if (!zuiPrimitive) {
      throw new JSONSchemaToZuiError(`Unknown primitive type: "${type}"`, path == null ? undefined : path.toString());
    }
  } else {
    if (primitiveValues.length === 1) {
      zuiPrimitive = literalType(first);
    } else {
      const items = primitiveValues.map((value) => literalType(value));
      zuiPrimitive = unionType(items);
    }
  }
  if (schema.description) {
    zuiPrimitive = zuiPrimitive.describe(schema.description);
  }
  return zuiPrimitive;
}, "toZuiPrimitive");
var DEFAULT_TYPE = anyType();
function fromJSONSchema(schema) {
  return _fromJSONSchema(schema, new PropertyPath);
}
__name(fromJSONSchema, "fromJSONSchema");
function _fromJSONSchema(schema, path) {
  var _b, _c, _d, _e, _f, _g;
  if (schema === undefined) {
    return DEFAULT_TYPE;
  }
  if (schema === true) {
    return anyType();
  }
  if (schema === false) {
    return neverType();
  }
  if (schema.default !== undefined) {
    const inner = _fromJSONSchema(__spreadProps(__spreadValues({}, schema), { default: undefined }), path);
    return inner.default(schema.default);
  }
  if (schema.readOnly) {
    const inner = _fromJSONSchema(__spreadProps(__spreadValues({}, schema), { readOnly: undefined }), path);
    return inner.readonly();
  }
  if (schema.description !== undefined) {
    const inner = _fromJSONSchema(__spreadProps(__spreadValues({}, schema), { description: undefined }), path);
    return inner.describe(schema.description);
  }
  if (schema.patternProperties !== undefined) {
    throw new UnsupportedJSONSchemaToZuiError({ patternProperties: schema.patternProperties }, path.toString());
  }
  if (schema.propertyNames !== undefined) {
    throw new UnsupportedJSONSchemaToZuiError({ propertyNames: schema.propertyNames }, path.toString());
  }
  if (schema.if !== undefined) {
    throw new UnsupportedJSONSchemaToZuiError({ if: schema.if }, path.toString());
  }
  if (schema.then !== undefined) {
    throw new UnsupportedJSONSchemaToZuiError({ then: schema.then }, path.toString());
  }
  if (schema.else !== undefined) {
    throw new UnsupportedJSONSchemaToZuiError({ else: schema.else }, path.toString());
  }
  if (schema.$ref !== undefined) {
    return refType(schema.$ref);
  }
  if (schema.not !== undefined) {
    if (isUndefinedSchema(schema)) {
      return undefinedType();
    }
    if (schema.not === true) {
      return neverType();
    }
    throw new UnsupportedJSONSchemaToZuiError({ not: schema.not }, path.toString());
  }
  if (Array.isArray(schema.type)) {
    if (schema.type.length === 0) {
      return DEFAULT_TYPE;
    }
    if (schema.type.length === 1) {
      return _fromJSONSchema(__spreadProps(__spreadValues({}, schema), { type: schema.type[0] }), path);
    }
    const _a = schema, { type: _ } = _a, tmp = __objRest(_a, ["type"]);
    const types = schema.type.map((t, index) => _fromJSONSchema(__spreadProps(__spreadValues({}, tmp), { type: t }), path.withIndexType("number", index)));
    return unionType(types);
  }
  if (schema.type === "string") {
    if (schema.enum && schema.enum.length > 0) {
      return enumType(schema.enum);
    }
    return toZuiPrimitive("string", schema, path);
  }
  if (schema.type === "integer") {
    const zSchema = toZuiPrimitive("number", schema, path);
    if (zSchema.typeName === "ZodNumber") {
      return zSchema.int();
    }
    return zSchema;
  }
  if (schema.type === "number") {
    return toZuiPrimitive("number", schema, path);
  }
  if (schema.type === "boolean") {
    return toZuiPrimitive("boolean", schema, path);
  }
  if (schema.type === "null") {
    return toZuiPrimitive("null", schema, path);
  }
  if (schema.type === "array") {
    return arrayJSONSchemaToZuiArray(schema, _fromJSONSchema, path);
  }
  if (schema.type === "object") {
    if (schema.additionalProperties !== undefined && schema.properties !== undefined) {
      const catchAll = _fromJSONSchema(schema.additionalProperties, path.withIndexType("string"));
      const inner = _fromJSONSchema(__spreadProps(__spreadValues({}, schema), { additionalProperties: undefined }), path);
      return inner.catchall(catchAll);
    }
    if (schema.properties !== undefined) {
      const properties = {};
      for (const [key, value] of Object.entries(schema.properties)) {
        const mapped = _fromJSONSchema(value, path.withIndexType("key", key));
        const required = (_b = schema.required) != null ? _b : [];
        properties[key] = required.includes(key) ? mapped : mapped.isOptional() ? mapped : mapped.optional();
      }
      return objectType(properties);
    }
    if (schema.additionalProperties !== undefined) {
      const inner = _fromJSONSchema(schema.additionalProperties, path.withIndexType("string"));
      return recordType(inner);
    }
    return recordType(DEFAULT_TYPE);
  }
  if (schema.anyOf !== undefined) {
    if (schema.anyOf.length === 0) {
      return DEFAULT_TYPE;
    }
    if (schema.anyOf.length === 1) {
      return _fromJSONSchema(schema.anyOf[0], path);
    }
    if (isOptionalSchema(schema)) {
      const inner = _fromJSONSchema(schema.anyOf[0], path);
      return inner.optional();
    }
    if (isNullableSchema(schema)) {
      const inner = _fromJSONSchema(schema.anyOf[0], path);
      return inner.nullable();
    }
    if (isDiscriminatedUnionSchema(schema) && ((_d = (_c = schema["x-zui"]) == null ? undefined : _c.def) == null ? undefined : _d.discriminator)) {
      const { discriminator } = schema["x-zui"].def;
      const options2 = schema.anyOf.map((s, index) => _fromJSONSchema(s, path.withIndexType("number", index)));
      return discriminatedUnionType(discriminator, options2);
    }
    const options = schema.anyOf.map((s, index) => _fromJSONSchema(s, path.withIndexType("number", index)));
    return unionType(options);
  }
  if (schema.oneOf !== undefined) {
    if (schema.oneOf.length === 0) {
      return DEFAULT_TYPE;
    }
    if (schema.oneOf.length === 1) {
      return _fromJSONSchema(schema.oneOf[0], path);
    }
    if (isExclusiveDiscriminatedUnionSchema(schema)) {
      const discriminator = ((_e = schema.discriminator) == null ? undefined : _e.propertyName) || ((_g = (_f = schema["x-zui"]) == null ? undefined : _f.def) == null ? undefined : _g.discriminator);
      if (discriminator) {
        const options2 = schema.oneOf.map((s, index) => _fromJSONSchema(s, path.withIndexType("number", index)));
        return discriminatedUnionType(discriminator, options2);
      }
    }
    const options = schema.oneOf.map((s, index) => _fromJSONSchema(s, path.withIndexType("number", index)));
    return unionType(options);
  }
  if (schema.allOf !== undefined) {
    if (schema.allOf.length === 0) {
      return DEFAULT_TYPE;
    }
    if (schema.allOf.length === 1) {
      return _fromJSONSchema(schema.allOf[0], path);
    }
    const schemas = schema.allOf;
    const zSchemas = schemas.map((s, index) => _fromJSONSchema(s, path.withIndexType("number", index)));
    return zSchemas.slice(2).reduce((acc, s) => intersectionType(acc, s), intersectionType(zSchemas[0], zSchemas[1]));
  }
  schema.type;
  if (isUnknownSchema(schema)) {
    return unknownType();
  }
  return DEFAULT_TYPE;
}
__name(_fromJSONSchema, "_fromJSONSchema");
var dateTimeRegex = /^\d{4}-\d{2}-\d{2}(T|\s)?((\d{2}:\d{2}:\d{2}(\.\d{1,3})?)|(\d{2}:\d{2}))?(\s?([+-]\d{2}:\d{2}|Z))?$/;
var fromObject = /* @__PURE__ */ __name((obj, opts, isRoot = true) => {
  return _fromObject(obj, new PropertyPath, opts, isRoot);
}, "fromObject");
var _fromObject = /* @__PURE__ */ __name((obj, path, opts, isRoot = true) => {
  if (typeof obj !== "object") {
    throw new ObjectToZuiError("Input must be an object", path.toString());
  }
  const applyOptions = /* @__PURE__ */ __name((zodType) => {
    let newType = zodType;
    if (opts == null ? undefined : opts.nullable) {
      newType = newType.nullable();
    }
    if (opts == null ? undefined : opts.optional) {
      newType = newType.optional();
    }
    if ((opts == null ? undefined : opts.passtrough) && is.zuiObject(newType)) {
      newType = newType.passthrough();
    }
    return newType;
  }, "applyOptions");
  const schema = Object.entries(obj).reduce((acc, [key, value]) => {
    const _path = path.withIndexType("key", key);
    if (value === null) {
      acc[key] = applyOptions(nullType());
    } else {
      switch (typeof value) {
        case "string":
          acc[key] = dateTimeRegex.test(value) ? applyOptions(stringType().datetime()) : applyOptions(stringType());
          break;
        case "number":
          acc[key] = applyOptions(numberType());
          break;
        case "boolean":
          acc[key] = applyOptions(booleanType());
          break;
        case "object":
          if (Array.isArray(value)) {
            const [first] = value;
            if (first === undefined || first === null) {
              acc[key] = applyOptions(arrayType(unknownType()));
            } else if (typeof first === "object") {
              acc[key] = applyOptions(arrayType(_fromObject(first, _path.withIndexType("number"), opts, false)));
            } else if (typeof first === "string" || typeof first === "number" || typeof first === "boolean") {
              const inner = _getInnerType(first);
              acc[key] = applyOptions(arrayType(inner));
            }
          } else {
            acc[key] = applyOptions(_fromObject(value, _path, opts, false));
          }
          break;
        default:
          throw new ObjectToZuiError(`Unsupported type for key ${key}`, _path.toString());
      }
    }
    return acc;
  }, {});
  const hasProperties = Object.keys(schema).length > 0;
  if ((opts == null ? undefined : opts.passtrough) || !isRoot && !hasProperties) {
    return objectType(schema).passthrough();
  }
  return objectType(schema);
}, "_fromObject");
var _getInnerType = /* @__PURE__ */ __name((first) => {
  if (typeof first === "string") {
    return stringType();
  }
  if (typeof first === "number") {
    return numberType();
  }
  if (typeof first === "boolean") {
    return booleanType();
  }
  return unknownType();
}, "_getInnerType");
function parseAnyDef() {
  return {};
}
__name(parseAnyDef, "parseAnyDef");
function parseArrayDef(def, refs) {
  var _a, _b;
  const res = {
    type: "array"
  };
  if (((_b = (_a = def.type) == null ? undefined : _a._def) == null ? undefined : _b.typeName) !== ZodFirstPartyTypeKind.ZodAny) {
    res.items = parseDef(def.type._def, __spreadProps(__spreadValues({}, refs), {
      currentPath: [...refs.currentPath, "items"]
    }));
  }
  if (def.minLength) {
    setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
  }
  if (def.maxLength) {
    setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
  }
  if (def.exactLength) {
    setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
    setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
  }
  return res;
}
__name(parseArrayDef, "parseArrayDef");
function parseBigintDef(def, refs) {
  const res = __spreadValues({
    type: "integer",
    format: "int64"
  }, def.coerce ? {
    [zuiKey]: {
      coerce: def.coerce || undefined
    }
  } : {});
  if (!def.checks)
    return res;
  for (const check of def.checks) {
    switch (check.kind) {
      case "min":
        if (refs.target === "jsonSchema7") {
          if (check.inclusive) {
            setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
          } else {
            setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
          }
        } else {
          if (!check.inclusive) {
            res.exclusiveMinimum = true;
          }
          setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
        }
        break;
      case "max":
        if (refs.target === "jsonSchema7") {
          if (check.inclusive) {
            setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
          } else {
            setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
          }
        } else {
          if (!check.inclusive) {
            res.exclusiveMaximum = true;
          }
          setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
        }
        break;
      case "multipleOf":
        setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
        break;
    }
  }
  return res;
}
__name(parseBigintDef, "parseBigintDef");
function parseBooleanDef(def) {
  return __spreadValues({
    type: "boolean"
  }, def.coerce ? {
    [zuiKey]: {
      coerce: def.coerce || undefined
    }
  } : {});
}
__name(parseBooleanDef, "parseBooleanDef");
function parseBrandedDef(_def, refs) {
  return parseDef(_def.type._def, refs);
}
__name(parseBrandedDef, "parseBrandedDef");
var parseCatchDef = /* @__PURE__ */ __name((def, refs) => {
  return parseDef(def.innerType._def, refs);
}, "parseCatchDef");
function parseDateDef(def, refs) {
  if (refs.dateStrategy === "integer") {
    return integerDateParser(def, refs);
  } else {
    return __spreadValues({
      type: "string",
      format: "date-time"
    }, def.coerce ? {
      [zuiKey]: {
        coerce: def.coerce || undefined
      }
    } : {});
  }
}
__name(parseDateDef, "parseDateDef");
var integerDateParser = /* @__PURE__ */ __name((def, refs) => {
  const res = __spreadValues({
    type: "integer",
    format: "unix-time"
  }, def.coerce ? {
    [zuiKey]: {
      coerce: def.coerce || undefined
    }
  } : {});
  for (const check of def.checks) {
    switch (check.kind) {
      case "min":
        if (refs.target === "jsonSchema7") {
          setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
        }
        break;
      case "max":
        if (refs.target === "jsonSchema7") {
          setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
        }
        break;
    }
  }
  return res;
}, "integerDateParser");
function parseDefaultDef(_def, refs) {
  return __spreadProps(__spreadValues({}, parseDef(_def.innerType._def, refs)), {
    default: _def.defaultValue()
  });
}
__name(parseDefaultDef, "parseDefaultDef");
function parseEffectsDef(_def, refs) {
  return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : {};
}
__name(parseEffectsDef, "parseEffectsDef");
function parseEnumDef(def) {
  return {
    type: "string",
    enum: def.values
  };
}
__name(parseEnumDef, "parseEnumDef");
var isJsonSchema7AllOfType = /* @__PURE__ */ __name((type) => {
  if ("type" in type && type.type === "string")
    return false;
  return "allOf" in type;
}, "isJsonSchema7AllOfType");
function parseIntersectionDef(def, refs) {
  const allOf = [
    parseDef(def.left._def, __spreadProps(__spreadValues({}, refs), {
      currentPath: [...refs.currentPath, "allOf", "0"]
    })),
    parseDef(def.right._def, __spreadProps(__spreadValues({}, refs), {
      currentPath: [...refs.currentPath, "allOf", "1"]
    }))
  ].filter((x) => !!x);
  let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : undefined;
  const mergedAllOf = [];
  allOf.forEach((schema) => {
    if (isJsonSchema7AllOfType(schema)) {
      mergedAllOf.push(...schema.allOf);
      if (schema.unevaluatedProperties === undefined) {
        unevaluatedProperties = undefined;
      }
    } else {
      let nestedSchema = schema;
      if ("additionalProperties" in schema && schema.additionalProperties === false) {
        const _a = schema, { additionalProperties: _ } = _a, rest = __objRest(_a, ["additionalProperties"]);
        nestedSchema = rest;
      } else {
        unevaluatedProperties = undefined;
      }
      mergedAllOf.push(nestedSchema);
    }
  });
  return mergedAllOf.length ? __spreadValues({
    allOf: mergedAllOf
  }, unevaluatedProperties) : undefined;
}
__name(parseIntersectionDef, "parseIntersectionDef");
function parseLiteralDef(def, refs) {
  const parsedType = typeof def.value;
  if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
    return {
      type: Array.isArray(def.value) ? "array" : "object"
    };
  }
  if (refs.target === "openApi3") {
    return {
      type: parsedType === "bigint" ? "integer" : parsedType,
      enum: [def.value]
    };
  }
  return {
    type: parsedType === "bigint" ? "integer" : parsedType,
    const: def.value
  };
}
__name(parseLiteralDef, "parseLiteralDef");
function parseRecordDef(def, refs) {
  var _a, _b, _c, _d, _e;
  if (refs.target === "openApi3" && ((_a = def.keyType) == null ? undefined : _a._def.typeName) === ZodFirstPartyTypeKind.ZodEnum) {
    return {
      type: "object",
      required: def.keyType._def.values,
      properties: def.keyType._def.values.reduce((acc, key) => {
        var _a2;
        return __spreadProps(__spreadValues({}, acc), {
          [key]: (_a2 = parseDef(def.valueType._def, __spreadProps(__spreadValues({}, refs), {
            currentPath: [...refs.currentPath, "properties", key]
          }))) != null ? _a2 : {}
        });
      }, {}),
      additionalProperties: false
    };
  }
  const schema = {
    type: "object",
    additionalProperties: (_b = parseDef(def.valueType._def, __spreadProps(__spreadValues({}, refs), {
      currentPath: [...refs.currentPath, "additionalProperties"]
    }))) != null ? _b : {}
  };
  if (refs.target === "openApi3") {
    return schema;
  }
  if (((_c = def.keyType) == null ? undefined : _c._def.typeName) === ZodFirstPartyTypeKind.ZodString && ((_d = def.keyType._def.checks) == null ? undefined : _d.length)) {
    const keyType = Object.entries(parseStringDef(def.keyType._def, refs)).reduce((acc, [key, value]) => key === "type" ? acc : __spreadProps(__spreadValues({}, acc), { [key]: value }), {});
    return __spreadProps(__spreadValues({}, schema), {
      propertyNames: keyType
    });
  } else if (((_e = def.keyType) == null ? undefined : _e._def.typeName) === ZodFirstPartyTypeKind.ZodEnum) {
    return __spreadProps(__spreadValues({}, schema), {
      propertyNames: {
        enum: def.keyType._def.values
      }
    });
  }
  return schema;
}
__name(parseRecordDef, "parseRecordDef");
function parseMapDef(def, refs) {
  if (refs.mapStrategy === "record") {
    return parseRecordDef(def, refs);
  }
  const keys22 = parseDef(def.keyType._def, __spreadProps(__spreadValues({}, refs), {
    currentPath: [...refs.currentPath, "items", "items", "0"]
  })) || {};
  const values = parseDef(def.valueType._def, __spreadProps(__spreadValues({}, refs), {
    currentPath: [...refs.currentPath, "items", "items", "1"]
  })) || {};
  return {
    type: "array",
    maxItems: 125,
    items: {
      type: "array",
      items: [keys22, values],
      minItems: 2,
      maxItems: 2
    }
  };
}
__name(parseMapDef, "parseMapDef");
function parseNativeEnumDef(def) {
  const object = def.values;
  const actualKeys = Object.keys(def.values).filter((key) => {
    return typeof object[object[key]] !== "number";
  });
  const actualValues = actualKeys.map((key) => object[key]);
  const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
  return {
    type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
    enum: actualValues.filter((value) => typeof value === "string" || typeof value === "number")
  };
}
__name(parseNativeEnumDef, "parseNativeEnumDef");
function parseNeverDef() {
  return {
    not: {}
  };
}
__name(parseNeverDef, "parseNeverDef");
function parseNullDef(refs) {
  return refs.target === "openApi3" ? {
    enum: ["null"],
    nullable: true
  } : {
    type: "null"
  };
}
__name(parseNullDef, "parseNullDef");
var primitiveMappings = {
  ZodString: "string",
  ZodNumber: "number",
  ZodBigInt: "integer",
  ZodBoolean: "boolean",
  ZodNull: "null"
};
function parseUnionDef(def, refs) {
  if (refs.target === "openApi3")
    return asUnionOf(def, refs);
  const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
  if (options.every((x) => (x._def.typeName in primitiveMappings) && (!x._def.checks || !x._def.checks.length))) {
    const types = options.reduce((types2, x) => {
      const type = primitiveMappings[x._def.typeName];
      return type && !types2.includes(type) ? [...types2, type] : types2;
    }, []);
    return {
      type: types.length > 1 ? types : types[0]
    };
  } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
    const types = options.reduce((acc, x) => {
      const type = typeof x._def.value;
      switch (type) {
        case "string":
        case "number":
        case "boolean":
          return [...acc, type];
        case "bigint":
          return [...acc, "integer"];
        case "object":
          if (x._def.value === null)
            return [...acc, "null"];
        case "symbol":
        case "undefined":
        case "function":
        default:
          return acc;
      }
    }, []);
    if (types.length === options.length) {
      const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
      return {
        type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
        enum: options.reduce((acc, x) => {
          return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
        }, [])
      };
    }
  } else if (options.every((x) => x._def.typeName === "ZodEnum")) {
    return {
      type: "string",
      enum: options.reduce((acc, x) => [...acc, ...x._def.values.filter((x2) => !acc.includes(x2))], [])
    };
  }
  return asUnionOf(def, refs);
}
__name(parseUnionDef, "parseUnionDef");
var asUnionOf = /* @__PURE__ */ __name((def, refs) => {
  const unionOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, __spreadProps(__spreadValues({}, refs), {
    currentPath: [...refs.currentPath, refs.unionStrategy, `${i}`]
  }))).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
  const discriminator = refs.discriminator && def.typeName === "ZodDiscriminatedUnion" && typeof def.discriminator === "string" ? { discriminator: { propertyName: def.discriminator } } : {};
  if (!unionOf.length) {
    return;
  }
  return refs.unionStrategy === "anyOf" ? __spreadValues({ anyOf: unionOf }, discriminator) : __spreadValues({ oneOf: unionOf }, discriminator);
}, "asUnionOf");
function parseNullableDef(def, refs) {
  const inner = def.innerType;
  if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(inner._def.typeName) && (!inner._def.checks || !inner._def.checks.length)) {
    if (refs.target === "openApi3") {
      const schema2 = {
        type: primitiveMappings[inner._def.typeName],
        nullable: true
      };
      return addMeta2(inner._def, refs, schema2);
    }
    const schema = {
      type: [primitiveMappings[inner._def.typeName], "null"]
    };
    return addMeta2(inner._def, refs, schema);
  }
  if (refs.target === "openApi3") {
    const base2 = parseDef(inner._def, __spreadProps(__spreadValues({}, refs), {
      currentPath: [...refs.currentPath]
    }));
    return base2 && __spreadProps(__spreadValues({}, base2), { nullable: true });
  }
  const base = parseDef(inner._def, __spreadProps(__spreadValues({}, refs), {
    currentPath: [...refs.currentPath, "anyOf", "0"]
  }));
  return base && { anyOf: [base, { type: "null" }] };
}
__name(parseNullableDef, "parseNullableDef");
function parseNumberDef(def, refs) {
  const res = __spreadValues({
    type: "number"
  }, def.coerce ? {
    [zuiKey]: {
      coerce: def.coerce || undefined
    }
  } : {});
  if (!def.checks)
    return res;
  for (const check of def.checks) {
    switch (check.kind) {
      case "int":
        res.type = "integer";
        addErrorMessage(res, "type", check.message, refs);
        break;
      case "min":
        if (refs.target === "jsonSchema7") {
          if (check.inclusive) {
            setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
          } else {
            setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
          }
        } else {
          if (!check.inclusive) {
            res.exclusiveMinimum = true;
          }
          setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
        }
        break;
      case "max":
        if (refs.target === "jsonSchema7") {
          if (check.inclusive) {
            setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
          } else {
            setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
          }
        } else {
          if (!check.inclusive) {
            res.exclusiveMaximum = true;
          }
          setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
        }
        break;
      case "multipleOf":
        setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
        break;
    }
  }
  return res;
}
__name(parseNumberDef, "parseNumberDef");
var getAdditionalProperties = /* @__PURE__ */ __name((def, refs) => {
  var _a;
  if (is.zuiType(def.unknownKeys)) {
    if (def.unknownKeys.typeName === "ZodNever") {
      return false;
    }
    return (_a = parseDef(def.unknownKeys._def, __spreadProps(__spreadValues({}, refs), {
      currentPath: [...refs.currentPath, "additionalProperties"]
    }))) != null ? _a : true;
  }
  if (def.unknownKeys === "passthrough") {
    return true;
  }
  return false;
}, "getAdditionalProperties");
function parseObjectDef(def, refs) {
  const result = __spreadProps(__spreadValues({
    type: "object"
  }, Object.entries(def.shape()).reduce((acc, [propName, propDef]) => {
    if (propDef === undefined || propDef._def === undefined)
      return acc;
    const parsedDef = parseDef(propDef._def, __spreadProps(__spreadValues({}, refs), {
      currentPath: [...refs.currentPath, "properties", propName],
      propertyPath: [...refs.currentPath, "properties", propName]
    }));
    if (parsedDef === undefined)
      return acc;
    return {
      properties: __spreadProps(__spreadValues({}, acc.properties), { [propName]: parsedDef }),
      required: propDef.isOptional() ? acc.required : [...acc.required, propName]
    };
  }, { properties: {}, required: [] })), {
    additionalProperties: getAdditionalProperties(def, refs)
  });
  if (!result.required.length)
    delete result.required;
  return result;
}
__name(parseObjectDef, "parseObjectDef");
var parseOptionalDef = /* @__PURE__ */ __name((def, refs) => {
  var _a;
  if (refs.currentPath.toString() === ((_a = refs.propertyPath) == null ? undefined : _a.toString())) {
    return parseDef(def.innerType._def, refs);
  }
  const innerSchema = parseDef(def.innerType._def, __spreadProps(__spreadValues({}, refs), {
    currentPath: [...refs.currentPath, "anyOf", "1"]
  }));
  return innerSchema ? {
    anyOf: [
      {
        not: {}
      },
      innerSchema
    ]
  } : {};
}, "parseOptionalDef");
var parsePipelineDef = /* @__PURE__ */ __name((def, refs) => {
  if (refs.pipeStrategy === "input") {
    return parseDef(def.in._def, refs);
  } else if (refs.pipeStrategy === "output") {
    return parseDef(def.out._def, refs);
  }
  const a = parseDef(def.in._def, __spreadProps(__spreadValues({}, refs), {
    currentPath: [...refs.currentPath, "allOf", "0"]
  }));
  const b = parseDef(def.out._def, __spreadProps(__spreadValues({}, refs), {
    currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
  }));
  return {
    allOf: [a, b].filter((x) => x !== undefined)
  };
}, "parsePipelineDef");
function parsePromiseDef(def, refs) {
  return parseDef(def.type._def, refs);
}
__name(parsePromiseDef, "parsePromiseDef");
var parseReadonlyDef = /* @__PURE__ */ __name((def, refs) => {
  return parseDef(def.innerType._def, refs);
}, "parseReadonlyDef");
function parseRefDef(def) {
  return {
    $ref: def.uri
  };
}
__name(parseRefDef, "parseRefDef");
function parseSetDef(def, refs) {
  const items = parseDef(def.valueType._def, __spreadProps(__spreadValues({}, refs), {
    currentPath: [...refs.currentPath, "items"]
  }));
  const schema = {
    type: "array",
    uniqueItems: true,
    items
  };
  if (def.minSize) {
    setResponseValueAndErrors(schema, "minItems", def.minSize.value, def.minSize.message, refs);
  }
  if (def.maxSize) {
    setResponseValueAndErrors(schema, "maxItems", def.maxSize.value, def.maxSize.message, refs);
  }
  return schema;
}
__name(parseSetDef, "parseSetDef");
function parseTupleDef(def, refs) {
  if (def.rest) {
    return {
      type: "array",
      minItems: def.items.length,
      items: def.items.map((x, i) => parseDef(x._def, __spreadProps(__spreadValues({}, refs), {
        currentPath: [...refs.currentPath, "items", `${i}`]
      }))).reduce((acc, x) => x === undefined ? acc : [...acc, x], []),
      additionalItems: parseDef(def.rest._def, __spreadProps(__spreadValues({}, refs), {
        currentPath: [...refs.currentPath, "additionalItems"]
      }))
    };
  } else {
    return {
      type: "array",
      minItems: def.items.length,
      maxItems: def.items.length,
      items: def.items.map((x, i) => parseDef(x._def, __spreadProps(__spreadValues({}, refs), {
        currentPath: [...refs.currentPath, "items", `${i}`]
      }))).reduce((acc, x) => x === undefined ? acc : [...acc, x], [])
    };
  }
}
__name(parseTupleDef, "parseTupleDef");
function parseUndefinedDef() {
  return {
    not: {}
  };
}
__name(parseUndefinedDef, "parseUndefinedDef");
function parseUnknownDef() {
  return {};
}
__name(parseUnknownDef, "parseUnknownDef");
function parseDef(def, refs, forceResolution = false) {
  const seenItem = refs.seen.get(def);
  if (seenItem && !forceResolution) {
    const seenSchema = get$ref(seenItem, refs);
    if (seenSchema !== undefined) {
      return seenSchema;
    }
  }
  const newItem = { def, path: refs.currentPath, jsonSchema: undefined };
  refs.seen.set(def, newItem);
  const jsonSchema = selectParser2(def, def.typeName, refs);
  if (jsonSchema) {
    addMeta2(def, refs, jsonSchema);
  }
  newItem.jsonSchema = jsonSchema;
  return jsonSchema;
}
__name(parseDef, "parseDef");
var get$ref = /* @__PURE__ */ __name((item, refs) => {
  switch (refs.$refStrategy) {
    case "root":
      return { $ref: item.path.join("/") };
    case "relative":
      return { $ref: getRelativePath(refs.currentPath, item.path) };
    case "none":
    case "seen": {
      if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
        console.warn(`Recursive reference detected at ${refs.currentPath.join("/")}! Defaulting to any`);
        return {};
      }
      return refs.$refStrategy === "seen" ? {} : undefined;
    }
  }
}, "get$ref");
var getRelativePath = /* @__PURE__ */ __name((pathA, pathB) => {
  let i = 0;
  for (;i < pathA.length && i < pathB.length; i++) {
    if (pathA[i] !== pathB[i])
      break;
  }
  return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
}, "getRelativePath");
var selectParser2 = /* @__PURE__ */ __name((def, typeName, refs) => {
  switch (typeName) {
    case ZodFirstPartyTypeKind.ZodString:
      return parseStringDef(def, refs);
    case ZodFirstPartyTypeKind.ZodNumber:
      return parseNumberDef(def, refs);
    case ZodFirstPartyTypeKind.ZodObject:
      return parseObjectDef(def, refs);
    case ZodFirstPartyTypeKind.ZodBigInt:
      return parseBigintDef(def, refs);
    case ZodFirstPartyTypeKind.ZodBoolean:
      return parseBooleanDef(def);
    case ZodFirstPartyTypeKind.ZodDate:
      return parseDateDef(def, refs);
    case ZodFirstPartyTypeKind.ZodUndefined:
      return parseUndefinedDef();
    case ZodFirstPartyTypeKind.ZodNull:
      return parseNullDef(refs);
    case ZodFirstPartyTypeKind.ZodArray:
      return parseArrayDef(def, refs);
    case ZodFirstPartyTypeKind.ZodUnion:
    case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
      return parseUnionDef(def, refs);
    case ZodFirstPartyTypeKind.ZodIntersection:
      return parseIntersectionDef(def, refs);
    case ZodFirstPartyTypeKind.ZodTuple:
      return parseTupleDef(def, refs);
    case ZodFirstPartyTypeKind.ZodRecord:
      return parseRecordDef(def, refs);
    case ZodFirstPartyTypeKind.ZodRef:
      return parseRefDef(def);
    case ZodFirstPartyTypeKind.ZodLiteral:
      return parseLiteralDef(def, refs);
    case ZodFirstPartyTypeKind.ZodEnum:
      return parseEnumDef(def);
    case ZodFirstPartyTypeKind.ZodNativeEnum:
      return parseNativeEnumDef(def);
    case ZodFirstPartyTypeKind.ZodNullable:
      return parseNullableDef(def, refs);
    case ZodFirstPartyTypeKind.ZodOptional:
      return parseOptionalDef(def, refs);
    case ZodFirstPartyTypeKind.ZodMap:
      return parseMapDef(def, refs);
    case ZodFirstPartyTypeKind.ZodSet:
      return parseSetDef(def, refs);
    case ZodFirstPartyTypeKind.ZodLazy:
      return parseDef(def.getter()._def, refs);
    case ZodFirstPartyTypeKind.ZodPromise:
      return parsePromiseDef(def, refs);
    case ZodFirstPartyTypeKind.ZodNaN:
    case ZodFirstPartyTypeKind.ZodNever:
      return parseNeverDef();
    case ZodFirstPartyTypeKind.ZodEffects:
      return parseEffectsDef(def, refs);
    case ZodFirstPartyTypeKind.ZodAny:
      return parseAnyDef();
    case ZodFirstPartyTypeKind.ZodUnknown:
      return parseUnknownDef();
    case ZodFirstPartyTypeKind.ZodDefault:
      return parseDefaultDef(def, refs);
    case ZodFirstPartyTypeKind.ZodBranded:
      return parseBrandedDef(def, refs);
    case ZodFirstPartyTypeKind.ZodReadonly:
      return parseReadonlyDef(def, refs);
    case ZodFirstPartyTypeKind.ZodCatch:
      return parseCatchDef(def, refs);
    case ZodFirstPartyTypeKind.ZodPipeline:
      return parsePipelineDef(def, refs);
    case ZodFirstPartyTypeKind.ZodFunction:
    case ZodFirstPartyTypeKind.ZodVoid:
    case ZodFirstPartyTypeKind.ZodSymbol:
      return;
    default:
      return /* @__PURE__ */ ((_) => {
        return;
      })(typeName);
  }
}, "selectParser");
var addMeta2 = /* @__PURE__ */ __name((def, refs, jsonSchema) => {
  if (def.description) {
    jsonSchema.description = def.description;
    if (refs.markdownDescription) {
      jsonSchema.markdownDescription = def.description;
    }
  }
  Object.assign(jsonSchema, { [zuiKey]: __spreadValues(__spreadValues({}, def[zuiKey]), jsonSchema[zuiKey]) });
  return jsonSchema;
}, "addMeta");
var defaultOptions = {
  name: undefined,
  $refStrategy: "root",
  basePath: ["#"],
  effectStrategy: "input",
  pipeStrategy: "all",
  dateStrategy: "string",
  mapStrategy: "entries",
  definitionPath: "definitions",
  target: "jsonSchema7",
  strictUnions: false,
  definitions: {},
  errorMessages: false,
  markdownDescription: false,
  patternStrategy: "escape",
  emailStrategy: "format:email",
  discriminator: false,
  unionStrategy: "anyOf"
};
var getDefaultOptions = /* @__PURE__ */ __name((options) => typeof options === "string" ? __spreadProps(__spreadValues({}, defaultOptions), {
  name: options
}) : __spreadValues(__spreadValues({}, defaultOptions), options), "getDefaultOptions");
var getRefs = /* @__PURE__ */ __name((options) => {
  const _options = getDefaultOptions(options);
  const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
  return __spreadProps(__spreadValues({}, _options), {
    currentPath,
    propertyPath: undefined,
    seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [
      def._def,
      {
        def: def._def,
        path: [..._options.basePath, _options.definitionPath, name],
        jsonSchema: undefined
      }
    ]))
  });
}, "getRefs");
var zodToJsonSchema = /* @__PURE__ */ __name((schema, options) => {
  var _a;
  const refs = getRefs(options);
  const definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => {
    var _a2;
    return __spreadProps(__spreadValues({}, acc), {
      [name2]: (_a2 = parseDef(schema2._def, __spreadProps(__spreadValues({}, refs), {
        currentPath: [...refs.basePath, refs.definitionPath, name2]
      }), true)) != null ? _a2 : {}
    });
  }, {}) : undefined;
  const name = typeof options === "string" ? options : options == null ? undefined : options.name;
  const main = (_a = parseDef(schema._def, name === undefined ? refs : __spreadProps(__spreadValues({}, refs), {
    currentPath: [...refs.basePath, refs.definitionPath, name]
  }), false)) != null ? _a : {};
  const combined = name === undefined ? definitions ? __spreadProps(__spreadValues({}, main), {
    [refs.definitionPath]: definitions
  }) : main : {
    $ref: [...refs.$refStrategy === "relative" ? [] : refs.basePath, refs.definitionPath, name].join("/"),
    [refs.definitionPath]: __spreadProps(__spreadValues({}, definitions), {
      [name]: main
    })
  };
  if (refs.target === "jsonSchema7") {
    combined.$schema = "http://json-schema.org/draft-07/schema#";
  } else if (refs.target === "jsonSchema2019-09") {
    combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
  }
  return combined;
}, "zodToJsonSchema");
var toJSONSchemaLegacy = /* @__PURE__ */ __name((zuiType, opts = { target: "openApi3" }) => {
  const jsonSchema = zodToJsonSchema(zuiType, opts);
  if (opts.$schemaUrl === false) {
    delete jsonSchema.$schema;
  } else if (typeof opts.$schemaUrl === "string") {
    jsonSchema.$schema = opts.$schemaUrl;
  }
  return jsonSchema;
}, "toJSONSchemaLegacy");
var { zuiKey: zuiKey3 } = z_exports;
var zodArrayToJsonArray = /* @__PURE__ */ __name((zodArray, toSchema) => {
  const schema = {
    type: "array",
    description: zodArray.description,
    items: toSchema(zodArray._def.type),
    "x-zui": zodArray._def["x-zui"]
  };
  if (zodArray._def[zuiKey3]) {
    schema[zuiKey3] = zodArray._def[zuiKey3];
  }
  if (zodArray._def.minLength) {
    schema.minItems = zodArray._def.minLength.value;
  }
  if (zodArray._def.maxLength) {
    schema.maxItems = zodArray._def.maxLength.value;
  }
  if (zodArray._def.exactLength) {
    schema.minItems = zodArray._def.exactLength.value;
    schema.maxItems = zodArray._def.exactLength.value;
  }
  return schema;
}, "zodArrayToJsonArray");
var { zuiKey: zuiKey4 } = z_exports;
var zodNumberToJsonNumber = /* @__PURE__ */ __name((zodNumber) => {
  const schema = {
    type: "number",
    description: zodNumber.description,
    "x-zui": zodNumber._def["x-zui"]
  };
  if (zodNumber._def[zuiKey4]) {
    schema[zuiKey4] = zodNumber._def[zuiKey4];
  }
  for (const check of zodNumber._def.checks) {
    switch (check.kind) {
      case "min": {
        const key = check.inclusive ? "minimum" : "exclusiveMinimum";
        const oppositeKey = check.inclusive ? "exclusiveMinimum" : "minimum";
        schema[key] = check.value;
        delete schema[oppositeKey];
        break;
      }
      case "max": {
        const key = check.inclusive ? "maximum" : "exclusiveMaximum";
        const oppositeKey = check.inclusive ? "exclusiveMaximum" : "maximum";
        schema[key] = check.value;
        delete schema[oppositeKey];
        break;
      }
      case "int":
        schema.type = "integer";
        break;
      case "finite": {
        schema.format = "finite";
        break;
      }
      case "multipleOf":
        schema.multipleOf = check.value;
        break;
      default:
    }
  }
  return schema;
}, "zodNumberToJsonNumber");
var { zuiKey: zuiKey5 } = z_exports;
var zodSetToJsonSet = /* @__PURE__ */ __name((zodSet, toSchema) => {
  const schema = {
    type: "array",
    description: zodSet.description,
    uniqueItems: true,
    items: toSchema(zodSet._def.valueType),
    "x-zui": zodSet._def["x-zui"]
  };
  if (zodSet._def[zuiKey5]) {
    schema[zuiKey5] = zodSet._def[zuiKey5];
  }
  if (zodSet._def.minSize) {
    schema.minItems = zodSet._def.minSize.value;
  }
  if (zodSet._def.maxSize) {
    schema.maxItems = zodSet._def.maxSize.value;
  }
  return schema;
}, "zodSetToJsonSet");
var { zuiKey: zuiKey6 } = z_exports;
var zodStringToJsonString = /* @__PURE__ */ __name((zodString, path) => {
  const schema = {
    type: "string",
    description: zodString.description,
    "x-zui": zodString._def["x-zui"]
  };
  if (zodString._def[zuiKey6]) {
    schema[zuiKey6] = zodString._def[zuiKey6];
  }
  for (const check of zodString._def.checks) {
    switch (check.kind) {
      case "cuid":
        schema.format = "cuid";
        schema.pattern = zodPatterns.cuid;
        break;
      case "cuid2":
        schema.format = "cuid2";
        schema.pattern = zodPatterns.cuid2;
        break;
      case "ulid":
        schema.format = "ulid";
        schema.pattern = zodPatterns.ulid;
        break;
      case "uuid":
        schema.format = "uuid";
        schema.pattern = zodPatterns.uuid;
        break;
      case "emoji":
        schema.format = "emoji";
        schema.pattern = zodPatterns.emoji;
        break;
      case "email":
        schema.format = "email";
        schema.pattern = zodPatterns.email;
        break;
      case "ip":
        schema.format = check.version === "v6" ? "ipv6" : "ipv4";
        schema.pattern = check.version === "v6" ? zodPatterns.ipv6 : zodPatterns.ipv4;
        break;
      case "datetime":
        schema.format = "date-time";
        if (check.precision !== null || check.offset) {
          schema.pattern = generateDatetimeRegex(check).source;
          schema[zuiKey6] = __spreadProps(__spreadValues({}, schema[zuiKey6]), { precision: check.precision, offset: check.offset });
        }
        break;
      case "url":
        schema.format = "uri";
        break;
      case "endsWith":
        schema.pattern = `${regex_utils_exports.escapeSpecialChars(check.value)}$`;
        break;
      case "startsWith":
        schema.pattern = `^${regex_utils_exports.escapeSpecialChars(check.value)}`;
        break;
      case "includes":
        const positionPredicate = check.position && check.position >= 1 ? `^(?:.{${check.position}}).*` : "";
        schema.pattern = `${positionPredicate}${regex_utils_exports.escapeSpecialChars(check.value)}`;
        break;
      case "regex":
        schema.pattern = check.regex.source;
        break;
      case "length":
        schema.minLength = schema.maxLength = Math.max(0, check.value);
        break;
      case "min":
        schema.minLength = Math.max(0, check.value);
        break;
      case "max":
        schema.maxLength = Math.max(0, check.value);
        break;
      default:
        throw new UnsupportedZuiCheckToJSONSchemaError("ZodString", check.kind, path.toString());
    }
  }
  return schema;
}, "zodStringToJsonString");
var { zuiKey: zuiKey7 } = z_exports;
var zodTupleToJsonTuple = /* @__PURE__ */ __name((zodTuple, toSchema, path) => {
  const schema = {
    type: "array",
    description: zodTuple.description,
    items: zodTuple._def.items.map((item, index) => toSchema(item, path.withIndexType("number", index)))
  };
  if (zodTuple._def[zuiKey7]) {
    schema[zuiKey7] = zodTuple._def[zuiKey7];
  }
  if (zodTuple._def.rest) {
    schema.additionalItems = toSchema(zodTuple._def.rest, path.withIndexType("number"));
  }
  return schema;
}, "zodTupleToJsonTuple");
var DEFAULT_OPTIONS2 = {
  unionStrategy: "anyOf",
  discriminatedUnionStrategy: "oneOf",
  discriminator: true
};
function toJSONSchema(schema, options = {}) {
  return _toJSONSchema(schema, options, new PropertyPath);
}
__name(toJSONSchema, "toJSONSchema");
function _toJSONSchema(schema, options = {}, path) {
  const opts = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS2), options);
  const s = schema;
  switch (s.typeName) {
    case "ZodString":
      return zodStringToJsonString(s, path);
    case "ZodNumber":
      return zodNumberToJsonNumber(s);
    case "ZodNaN":
      throw new UnsupportedZuiToJSONSchemaError("ZodNaN", path.toString());
    case "ZodBigInt":
      throw new UnsupportedZuiToJSONSchemaError("ZodBigInt", path.toString(), {
        suggestedAlternative: "serialize bigint to string"
      });
    case "ZodBoolean":
      return {
        type: "boolean",
        description: s.description,
        "x-zui": s._def["x-zui"]
      };
    case "ZodDate":
      throw new UnsupportedZuiToJSONSchemaError("ZodDate", path.toString(), {
        suggestedAlternative: "use z.string().datetime() instead"
      });
    case "ZodUndefined":
      return undefinedSchema(s);
    case "ZodNull":
      return nullSchema(s);
    case "ZodAny":
      return {
        description: s.description,
        "x-zui": s._def["x-zui"]
      };
    case "ZodUnknown":
      return {
        description: s.description,
        "x-zui": __spreadProps(__spreadValues({}, s._def["x-zui"]), { def: { typeName: "ZodUnknown" } })
      };
    case "ZodNever":
      return {
        not: true,
        description: s.description,
        "x-zui": s._def["x-zui"]
      };
    case "ZodVoid":
      throw new UnsupportedZuiToJSONSchemaError("ZodVoid", path.toString());
    case "ZodArray":
      return zodArrayToJsonArray(s, (i) => _toJSONSchema(i, opts, path.withIndexType("number")));
    case "ZodObject":
      const shape = Object.entries(s.shape);
      const requiredProperties = shape.filter(([_, value]) => !value.isOptional());
      const required = requiredProperties.length ? requiredProperties.map(([key]) => key) : undefined;
      const properties = shape.map(([key, value]) => [key, value.mandatory()]).map(([key, value]) => [key, _toJSONSchema(value, opts, path.withIndexType("key", key))]);
      return {
        type: "object",
        description: s.description,
        properties: Object.fromEntries(properties),
        required,
        additionalProperties: additionalPropertiesSchema(s._def, opts, path),
        "x-zui": s._def["x-zui"]
      };
    case "ZodUnion":
      if (opts.unionStrategy === "oneOf") {
        return {
          description: s.description,
          oneOf: s.options.map((option, index) => _toJSONSchema(option, opts, path.withIndexType("number", index))),
          "x-zui": s._def["x-zui"]
        };
      }
      return {
        description: s.description,
        anyOf: s.options.map((option, index) => _toJSONSchema(option, opts, path.withIndexType("number", index))),
        "x-zui": s._def["x-zui"]
      };
    case "ZodDiscriminatedUnion":
      if (opts.discriminatedUnionStrategy === "oneOf") {
        const discriminator = opts.discriminator ? { propertyName: s.discriminator } : undefined;
        return {
          description: s.description,
          oneOf: s.options.map((option, index) => _toJSONSchema(option, opts, path.withIndexType("number", index))),
          discriminator,
          "x-zui": __spreadProps(__spreadValues({}, s._def["x-zui"]), {
            def: { typeName: "ZodDiscriminatedUnion", discriminator: s.discriminator }
          })
        };
      }
      return {
        description: s.description,
        anyOf: s.options.map((option, index) => _toJSONSchema(option, opts, path.withIndexType("number", index))),
        "x-zui": __spreadProps(__spreadValues({}, s._def["x-zui"]), {
          def: { typeName: "ZodDiscriminatedUnion", discriminator: s.discriminator }
        })
      };
    case "ZodIntersection":
      const left = _toJSONSchema(s._def.left, opts, path.withIndexType("number", 0));
      const right = _toJSONSchema(s._def.right, opts, path.withIndexType("number", 1));
      if ("additionalProperties" in left) {
        delete left.additionalProperties;
      }
      if ("additionalProperties" in right) {
        delete right.additionalProperties;
      }
      return {
        description: s.description,
        allOf: [left, right],
        "x-zui": s._def["x-zui"]
      };
    case "ZodTuple":
      return zodTupleToJsonTuple(s, (i, p) => _toJSONSchema(i, opts, p), path);
    case "ZodRecord": {
      const keyType = s._def.keyType;
      const recordPath = is.zuiString(keyType) ? path.withIndexType("string") : is.zuiNumber(keyType) ? path.withIndexType("number") : path.withIndexType("any");
      return {
        type: "object",
        description: s.description,
        additionalProperties: _toJSONSchema(s._def.valueType, opts, recordPath),
        "x-zui": s._def["x-zui"]
      };
    }
    case "ZodMap":
      throw new UnsupportedZuiToJSONSchemaError("ZodMap", path.toString());
    case "ZodSet":
      return zodSetToJsonSet(s, (i) => _toJSONSchema(i, opts, path.withIndexType("number")));
    case "ZodFunction":
      throw new UnsupportedZuiToJSONSchemaError("ZodFunction", path.toString());
    case "ZodLazy":
      throw new UnsupportedZuiToJSONSchemaError("ZodLazy", path.toString());
    case "ZodLiteral":
      if (typeof s.value === "string") {
        return {
          type: "string",
          description: s.description,
          const: s.value,
          "x-zui": s._def["x-zui"]
        };
      } else if (typeof s.value === "number") {
        return {
          type: "number",
          description: s.description,
          const: s.value,
          "x-zui": s._def["x-zui"]
        };
      } else if (typeof s.value === "boolean") {
        return {
          type: "boolean",
          description: s.description,
          const: s.value,
          "x-zui": s._def["x-zui"]
        };
      } else if (s.value === null) {
        return nullSchema(s._def);
      } else if (s.value === undefined) {
        return undefinedSchema(s._def);
      } else {
        s.value;
        const unsupportedLiteral = typeof s.value;
        throw new ZuiToJSONSchemaError(`Unsupported literal type: "${unsupportedLiteral}"`, path.toString());
      }
    case "ZodEnum":
      return {
        type: "string",
        description: s.description,
        enum: s._def.values,
        "x-zui": s._def["x-zui"]
      };
    case "ZodEffects":
      throw new UnsupportedZuiToJSONSchemaError("ZodEffects", path.toString());
    case "ZodNativeEnum":
      throw new UnsupportedZuiToJSONSchemaError("ZodNativeEnum", path.toString());
    case "ZodOptional":
      return {
        description: s.description,
        anyOf: [_toJSONSchema(s._def.innerType, opts, path), undefinedSchema()],
        "x-zui": __spreadProps(__spreadValues({}, s._def["x-zui"]), {
          def: { typeName: "ZodOptional" }
        })
      };
    case "ZodNullable":
      return {
        anyOf: [_toJSONSchema(s._def.innerType, opts, path), nullSchema()],
        "x-zui": __spreadProps(__spreadValues({}, s._def["x-zui"]), {
          def: { typeName: "ZodNullable" }
        })
      };
    case "ZodDefault":
      return __spreadProps(__spreadValues({}, _toJSONSchema(s._def.innerType, opts, path)), {
        default: s._def.defaultValue()
      });
    case "ZodCatch":
      throw new UnsupportedZuiToJSONSchemaError("ZodCatch", path.toString());
    case "ZodPromise":
      throw new UnsupportedZuiToJSONSchemaError("ZodPromise", path.toString());
    case "ZodBranded":
      throw new UnsupportedZuiToJSONSchemaError("ZodBranded", path.toString());
    case "ZodPipeline":
      throw new UnsupportedZuiToJSONSchemaError("ZodPipeline", path.toString());
    case "ZodSymbol":
      throw new UnsupportedZuiToJSONSchemaError("ZodSymbol", path.toString());
    case "ZodReadonly":
      return __spreadProps(__spreadValues({}, _toJSONSchema(s._def.innerType, opts, path)), {
        readOnly: true
      });
    case "ZodRef":
      return {
        $ref: s._def.uri,
        description: s.description,
        "x-zui": s._def["x-zui"]
      };
    default:
      assert_utils_exports.assertNever(s);
  }
}
__name(_toJSONSchema, "_toJSONSchema");
var undefinedSchema = /* @__PURE__ */ __name((def) => ({
  not: true,
  description: def == null ? undefined : def.description,
  "x-zui": __spreadProps(__spreadValues({}, def == null ? undefined : def["x-zui"]), { def: { typeName: "ZodUndefined" } })
}), "undefinedSchema");
var nullSchema = /* @__PURE__ */ __name((def) => ({
  type: "null",
  description: def == null ? undefined : def.description,
  "x-zui": def == null ? undefined : def["x-zui"]
}), "nullSchema");
var additionalPropertiesSchema = /* @__PURE__ */ __name((def, opts, path) => {
  if (def.unknownKeys === "passthrough") {
    return true;
  }
  if (def.unknownKeys === "strict") {
    return false;
  }
  if (!is.zuiType(def.unknownKeys)) {
    return false;
  }
  if (def.unknownKeys.typeName === "ZodNever") {
    return false;
  }
  return _toJSONSchema(def.unknownKeys, opts, path.withIndexType("string"));
}, "additionalPropertiesSchema");
function primitiveToTypscriptLiteralType(x) {
  if (typeof x === "symbol") {
    return "symbol";
  }
  if (typeof x === "bigint") {
    const str = x.toString();
    return `${str}n`;
  }
  return primitiveToTypescriptValue(x);
}
__name(primitiveToTypscriptLiteralType, "primitiveToTypscriptLiteralType");
function primitiveToTypescriptValue(x) {
  if (typeof x === "undefined") {
    return "undefined";
  }
  if (typeof x === "symbol") {
    if (x.description) {
      return `Symbol(${primitiveToTypescriptValue(x.description)})`;
    }
    return "Symbol()";
  }
  if (typeof x === "bigint") {
    const str = x.toString();
    return `BigInt(${str})`;
  }
  if (typeof x === "string") {
    return escapeString(x);
  }
  return JSON.stringify(x);
}
__name(primitiveToTypescriptValue, "primitiveToTypescriptValue");
function unknownToTypescriptValue(x) {
  if (typeof x === "undefined") {
    return "undefined";
  }
  return JSON.stringify(x);
}
__name(unknownToTypescriptValue, "unknownToTypescriptValue");
var recordOfUnknownToTypescriptRecord = /* @__PURE__ */ __name((record, asConst) => {
  const entries = Object.entries(record);
  const maybeAsConst = asConst ? " as const" : "";
  return `{ ${entries.map(([key, value]) => `${toPropertyKey(key)}: ${unknownToTypescriptValue(value)}`).join(", ")} }${maybeAsConst}`;
}, "recordOfUnknownToTypescriptRecord");
var toPropertyKey = /* @__PURE__ */ __name((key) => {
  if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key)) {
    return key;
  }
  return primitiveToTypescriptValue(key);
}, "toPropertyKey");
var capitalize2 = /* @__PURE__ */ __name((s) => s.charAt(0).toUpperCase() + s.slice(1), "capitalize");
var toTypeArgumentName = /* @__PURE__ */ __name((name) => {
  const nonAlphaNumeric = /[^a-zA-Z0-9_]/g;
  const tokens = name.split(nonAlphaNumeric).map(capitalize2).filter((t) => !!t);
  return tokens.join("");
}, "toTypeArgumentName");
var trimEmptyLinesInPlace = /* @__PURE__ */ __name((lines) => {
  var _a;
  while (lines.length && !((_a = lines[0]) == null ? undefined : _a.trim())) {
    lines.shift();
  }
  while (lines.length && !lines[lines.length - 1].trim()) {
    lines.pop();
  }
}, "trimEmptyLinesInPlace");
var getMultilineComment = /* @__PURE__ */ __name((description) => {
  description = description == null ? undefined : description.replace(/(\n(\s*)?){3,}/g, `

`);
  const ensureLineStartsWithAsterisk = /* @__PURE__ */ __name((line) => line.startsWith("* ") ? ` ${line}` : ` * ${line}`, "ensureLineStartsWithAsterisk");
  const escapeCommentEnd = /* @__PURE__ */ __name((line) => line.replace(/\*\//g, "*\\/"), "escapeCommentEnd");
  const descLines = (description != null ? description : "").split(`
`).map((line) => line.trim());
  trimEmptyLinesInPlace(descLines);
  if (descLines.length) {
    descLines[0] = descLines[0].replace(/^\/\*\*?/, "");
    descLines[descLines.length - 1] = descLines[descLines.length - 1].replace(/\*\/$/, "");
  }
  trimEmptyLinesInPlace(descLines);
  return descLines.length === 0 ? "" : descLines.length === 1 ? `/** ${escapeCommentEnd(descLines[0])} */` : `/**
${descLines.map(ensureLineStartsWithAsterisk).map(escapeCommentEnd).join(`
`)}
 */`;
}, "getMultilineComment");
function escapeString(str) {
  if (typeof str !== "string") {
    return "";
  }
  const rawStr = String.raw`${str}`;
  const escapedStr = rawStr.replace(/\\/g, "\\\\").replace(/\n/g, "\\n").replace(/"/g, "\\\"").replace(/'/g, "\\'");
  if (escapedStr.includes("`")) {
    return `"${escapedStr}"`;
  } else if (escapedStr.includes("'")) {
    return `"${escapedStr}"`;
  } else {
    return `'${escapedStr}'`;
  }
}
__name(escapeString, "escapeString");
var Primitives = [
  "string",
  "number",
  "boolean",
  "unknown",
  "void",
  "any",
  "null",
  "undefined",
  "never",
  "bigint",
  "symbol",
  "object"
];
var LARGE_DECLARATION_LINES = 5;
var isPrimitive = /* @__PURE__ */ __name((type) => Primitives.includes(type), "isPrimitive");
var isArrayOfPrimitives = /* @__PURE__ */ __name((type) => Primitives.map((p) => `${p}[]`).includes(type), "isArrayOfPrimitives");
var stripSpaces = /* @__PURE__ */ __name((typings) => typings.replace(/ +/g, " ").trim(), "stripSpaces");
var _KeyValue = class _KeyValue2 {
  constructor(key, value) {
    this.key = key;
    this.value = value;
  }
};
__name(_KeyValue, "KeyValue");
var KeyValue = _KeyValue;
var _FnParameters = class _FnParameters2 {
  constructor(schema) {
    this.schema = schema;
  }
};
__name(_FnParameters, "FnParameters");
var FnParameters = _FnParameters;
var _FnReturn = class _FnReturn2 {
  constructor(schema) {
    this.schema = schema;
  }
};
__name(_FnReturn, "FnReturn");
var FnReturn = _FnReturn;
var _Declaration = class _Declaration2 {
  constructor(props) {
    this.props = props;
  }
};
__name(_Declaration, "Declaration");
var Declaration = _Declaration;
function toTypescriptType(schema, options = {}) {
  return _toTypescriptType(schema, new PropertyPath, options);
}
__name(toTypescriptType, "toTypescriptType");
function _toTypescriptType(schema, path, options = {}) {
  const wrappedSchema = getDeclarationProps(schema, options);
  let dts = sUnwrapZod(wrappedSchema, path, options);
  if (options.formatter) {
    dts = options.formatter(dts);
  }
  return dts;
}
__name(_toTypescriptType, "_toTypescriptType");
var _optionalKey = /* @__PURE__ */ __name((key) => key.endsWith("?") ? key : `${key}?`, "_optionalKey");
function sUnwrapZod(schema, path, config) {
  var _a, _b, _c;
  const newConfig = __spreadProps(__spreadValues({}, config), {
    declaration: false,
    parent: schema
  });
  if (schema === null) {
    return "";
  }
  if (schema instanceof Declaration) {
    return unwrapDeclaration(schema, path, newConfig);
  }
  if (schema instanceof KeyValue) {
    let optionalValue = undefined;
    if (is.zuiOptional(schema.value)) {
      optionalValue = schema.value;
    } else if (is.zuiDefault(schema.value) && config.treatDefaultAsOptional) {
      optionalValue = schema.value._def.innerType.optional();
    }
    if (optionalValue) {
      let innerType = optionalValue._def.innerType;
      if (is.zuiType(innerType) && !innerType.description && optionalValue.description) {
        innerType = innerType == null ? undefined : innerType.describe(optionalValue.description);
      }
      return sUnwrapZod(new KeyValue(_optionalKey(schema.key), innerType), path, newConfig);
    }
    const description = getMultilineComment(schema.value._def.description || schema.value.description);
    const delimiter = (description == null ? undefined : description.trim().length) > 0 ? `
` : "";
    const withoutDesc = schema.value.describe("");
    const isOptional = is.zuiAny(schema.value);
    const key = isOptional ? _optionalKey(schema.key) : schema.key;
    return `${delimiter}${description}${delimiter}${key}: ${sUnwrapZod(withoutDesc, path, newConfig)}${delimiter}`;
  }
  if (schema instanceof FnParameters) {
    if (is.zuiTuple(schema.schema)) {
      let args = "";
      for (let i = 0;i < schema.schema.items.length; i++) {
        const argName = (_c = (_b = (_a = schema.schema.items[i]) == null ? undefined : _a.ui) == null ? undefined : _b.title) != null ? _c : `arg${i}`;
        const item = schema.schema.items[i];
        args += `${sUnwrapZod(new KeyValue(toPropertyKey(argName), item), path.withIndexType("number", i), newConfig)}${i < schema.schema.items.length - 1 ? ", " : ""} `;
      }
      return args;
    }
    const isLiteral = is.zuiLiteral(schema.schema.naked());
    const typings = sUnwrapZod(schema.schema, path, newConfig).trim();
    const startsWithPairs = typings.startsWith("{") && typings.endsWith("}") || typings.startsWith("[") && typings.endsWith("]") || typings.startsWith("(") && typings.endsWith(")") || typings.startsWith("Array<") && typings.endsWith(">") || typings.startsWith("Record<") && typings.endsWith(">") || isArrayOfPrimitives(typings);
    if (startsWithPairs || isLiteral) {
      return `args: ${typings}`;
    } else {
      return typings;
    }
  }
  if (schema instanceof FnReturn) {
    if (is.zuiOptional(schema.schema)) {
      return `${sUnwrapZod(schema.schema.unwrap(), path, newConfig)} | undefined`;
    }
    return sUnwrapZod(schema.schema, path, newConfig);
  }
  const s = schema;
  switch (s.typeName) {
    case "ZodString":
      return `${getMultilineComment(s.description)} string`.trim();
    case "ZodNumber":
    case "ZodNaN":
    case "ZodBigInt":
      return `${getMultilineComment(s.description)} number`.trim();
    case "ZodBoolean":
      return `${getMultilineComment(s.description)} boolean`.trim();
    case "ZodDate":
      return `${getMultilineComment(s.description)} Date`.trim();
    case "ZodUndefined":
      return `${getMultilineComment(s.description)} undefined`.trim();
    case "ZodNull":
      return `${getMultilineComment(s.description)} null`.trim();
    case "ZodAny":
      return `${getMultilineComment(s.description)} any`.trim();
    case "ZodUnknown":
      return `${getMultilineComment(s.description)} unknown`.trim();
    case "ZodNever":
      return `${getMultilineComment(s.description)} never`.trim();
    case "ZodVoid":
      return `${getMultilineComment(s.description)} void`.trim();
    case "ZodArray":
      const item = sUnwrapZod(s._def.type, path.withIndexType("number"), newConfig);
      if (isPrimitive(item)) {
        return `${item}[]`;
      }
      return `Array<${item}>`;
    case "ZodObject":
      const props = Object.entries(s._def.shape()).map(([key, value2]) => {
        if (is.zuiType(value2)) {
          return sUnwrapZod(new KeyValue(toPropertyKey(key), value2), path.withIndexType("key", key), newConfig);
        }
        return `${key}: unknown`;
      });
      return `{ ${props.join("; ")} }`;
    case "ZodUnion":
      const options = s._def.options.map((option, index) => {
        return sUnwrapZod(option, path.withIndexType("number", index), newConfig);
      });
      return `${getMultilineComment(s.description)}
${options.join(" | ")}`;
    case "ZodDiscriminatedUnion":
      const opts = s._def.options.map((option, index) => {
        return sUnwrapZod(option, path.withIndexType("number", index), newConfig);
      });
      return `${getMultilineComment(s.description)}
${opts.join(" | ")}`;
    case "ZodIntersection":
      return `${sUnwrapZod(s._def.left, path.withIndexType("number", 0), newConfig)} & ${sUnwrapZod(s._def.right, path.withIndexType("number", 1), newConfig)}`;
    case "ZodTuple":
      if (s._def.items.length === 0) {
        return "[]";
      }
      const items = s._def.items.map((i, index) => sUnwrapZod(i, path.withIndexType("number", index), newConfig));
      return `[${items.join(", ")}]`;
    case "ZodRecord": {
      const keyType = sUnwrapZod(s._def.keyType, path.withWrapper("KeyOf"), newConfig);
      const recordPath = is.zuiString(s._def.keyType) ? path.withIndexType("string") : is.zuiNumber(s._def.keyType) ? path.withIndexType("number") : path.withIndexType("any");
      const valueType = sUnwrapZod(s._def.valueType, recordPath, newConfig);
      return `${getMultilineComment(s.description)} { [key: ${keyType}]: ${valueType} }`;
    }
    case "ZodMap": {
      const recordPath = is.zuiString(s._def.keyType) ? path.withIndexType("string") : is.zuiNumber(s._def.keyType) ? path.withIndexType("number") : path.withIndexType("any");
      return `Map<${sUnwrapZod(s._def.keyType, path.withWrapper("KeyOf"), newConfig)}, ${sUnwrapZod(s._def.valueType, recordPath, newConfig)}>`;
    }
    case "ZodSet":
      return `Set<${sUnwrapZod(s._def.valueType, path.withIndexType("number"), newConfig)}>`;
    case "ZodFunction":
      const input = sUnwrapZod(new FnParameters(s._def.args), path.withWrapper("Parameters"), newConfig);
      const output = sUnwrapZod(new FnReturn(s._def.returns), path.withWrapper("ReturnType"), newConfig);
      const parentIsType = (config == null ? undefined : config.parent) instanceof Declaration && (config == null ? undefined : config.parent.props.type) === "type";
      if ((config == null ? undefined : config.declaration) && !parentIsType) {
        return `${getMultilineComment(s.description)}
(${input}): ${output}`;
      }
      return `${getMultilineComment(s.description)}
(${input}) => ${output}`;
    case "ZodLazy":
      return sUnwrapZod(s._def.getter(), path, newConfig);
    case "ZodLiteral":
      const value = primitiveToTypscriptLiteralType(s._def.value);
      return `${getMultilineComment(s.description)}
${value}`.trim();
    case "ZodEnum":
      const values = s._def.values.map(primitiveToTypescriptValue);
      return values.join(" | ");
    case "ZodEffects":
      return sUnwrapZod(s._def.schema, path, newConfig);
    case "ZodNativeEnum":
      throw new UnsupportedZuiToTypescriptTypeError("ZodNativeEnum", path.toString());
    case "ZodOptional":
      return `${sUnwrapZod(s._def.innerType, path, newConfig)} | undefined`;
    case "ZodNullable":
      return `${sUnwrapZod(s._def.innerType, path, newConfig)} | null`;
    case "ZodDefault":
      const defaultInnerType = config.treatDefaultAsOptional ? s._def.innerType.optional() : s._def.innerType;
      return sUnwrapZod(defaultInnerType, path, newConfig);
    case "ZodCatch":
      return sUnwrapZod(s._def.innerType, path, newConfig);
    case "ZodPromise":
      return `Promise<${sUnwrapZod(s._def.type, path, newConfig)}>`;
    case "ZodBranded":
      return sUnwrapZod(s._def.type, path, newConfig);
    case "ZodPipeline":
      return sUnwrapZod(s._def.in, path, newConfig);
    case "ZodSymbol":
      return `${getMultilineComment(s.description)} symbol`.trim();
    case "ZodReadonly":
      return `Readonly<${sUnwrapZod(s._def.innerType, path, newConfig)}>`;
    case "ZodRef":
      return toTypeArgumentName(s._def.uri);
    default:
      assert_utils_exports.assertNever(s);
  }
}
__name(sUnwrapZod, "sUnwrapZod");
var unwrapDeclaration = /* @__PURE__ */ __name((declaration, path, options) => {
  if (declaration.props.type === "none") {
    return sUnwrapZod(declaration.props.schema, path, options);
  }
  const { schema, identifier } = declaration.props;
  const description = getMultilineComment(schema.description);
  const withoutDesc = schema.describe("");
  const typings = sUnwrapZod(withoutDesc, path, __spreadProps(__spreadValues({}, options), { declaration: true }));
  const isLargeDeclaration = typings.split(`
`).length >= LARGE_DECLARATION_LINES;
  const closingTag = isLargeDeclaration && options.includeClosingTags ? `// end of ${identifier}` : "";
  if (declaration.props.type !== "type" && schema.typeName === "ZodFunction") {
    return stripSpaces(`${description}
declare function ${identifier}${typings};${closingTag}`);
  }
  if (declaration.props.type === "variable") {
    return stripSpaces(`${description}declare const ${identifier}: ${typings};${closingTag}`);
  }
  const generics = declaration.props.args.length > 0 ? `<${declaration.props.args.map(toTypeArgumentName).join(", ")}>` : "";
  return stripSpaces(`${description}type ${declaration.props.identifier}${generics} = ${typings};${closingTag}`);
}, "unwrapDeclaration");
var getDeclarationType = /* @__PURE__ */ __name((options) => {
  if (!options.declaration) {
    return "none";
  }
  if (options.declaration === true) {
    return "variable";
  }
  return options.declaration;
}, "getDeclarationType");
var getDeclarationProps = /* @__PURE__ */ __name((schema, options) => {
  const declarationType = getDeclarationType(options);
  const args = schema.getReferences();
  if (declarationType === "none") {
    if (args.length > 0) {
      throw new UnrepresentableGenericError;
    }
    return new Declaration({ type: "none", schema });
  }
  const title = "title" in schema.ui ? schema.ui.title : null;
  if (!title) {
    throw new UntitledDeclarationError;
  }
  if (declarationType === "variable") {
    if (args.length > 0) {
      throw new UnrepresentableGenericError;
    }
    return new Declaration({ type: "variable", identifier: title, schema });
  }
  return new Declaration({ type: "type", identifier: title, schema, args });
}, "getDeclarationProps");
var generateArrayChecks = /* @__PURE__ */ __name((def) => {
  const checks = [];
  if (def.exactLength) {
    const { value, message } = def.exactLength;
    checks.push(`.length(${primitiveToTypescriptValue(value)}, ${primitiveToTypescriptValue(message)})`);
  }
  if (def.minLength) {
    const { value, message } = def.minLength;
    checks.push(`.min(${primitiveToTypescriptValue(value)}, ${primitiveToTypescriptValue(message)})`);
  }
  if (def.maxLength) {
    const { value, message } = def.maxLength;
    checks.push(`.max(${primitiveToTypescriptValue(value)}, ${primitiveToTypescriptValue(message)})`);
  }
  return checks.join("");
}, "generateArrayChecks");
var generateBigIntChecks = /* @__PURE__ */ __name((def) => {
  const checks = def.checks;
  if (checks.length === 0) {
    return "";
  }
  return checks.map(_generateBigIntCheck).join("");
}, "generateBigIntChecks");
var _generateBigIntCheck = /* @__PURE__ */ __name((check) => {
  switch (check.kind) {
    case "min":
      return `.min(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    case "max":
      return `.max(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    case "multipleOf":
      return `.multipleOf(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    default:
      return "";
  }
}, "_generateBigIntCheck");
var generateDateChecks = /* @__PURE__ */ __name((def) => {
  const checks = def.checks;
  if (checks.length === 0) {
    return "";
  }
  return checks.map(_generateDateCheck).join("");
}, "generateDateChecks");
var _generateDateCheck = /* @__PURE__ */ __name((check) => {
  switch (check.kind) {
    case "min":
      const minDate = dateTs(check.value);
      return `.min(${minDate}, ${primitiveToTypescriptValue(check.message)})`;
    case "max":
      const maxDate = dateTs(check.value);
      return `.max(${maxDate}, ${primitiveToTypescriptValue(check.message)})`;
    default:
      return "";
  }
}, "_generateDateCheck");
var dateTs = /* @__PURE__ */ __name((d) => {
  return `new Date(${d})`;
}, "dateTs");
var generateNumberChecks = /* @__PURE__ */ __name((def) => {
  const checks = def.checks;
  if (checks.length === 0) {
    return "";
  }
  return checks.map(_generateNumberCheck).join("");
}, "generateNumberChecks");
var _generateNumberCheck = /* @__PURE__ */ __name((check) => {
  switch (check.kind) {
    case "min":
      return `.min(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    case "max":
      return `.max(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    case "int":
      return `.int(${primitiveToTypescriptValue(check.message)})`;
    case "multipleOf":
      return `.multipleOf(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    case "finite":
      return `.finite(${primitiveToTypescriptValue(check.message)})`;
    default:
      return "";
  }
}, "_generateNumberCheck");
var generateSetChecks = /* @__PURE__ */ __name((def) => {
  const checks = [];
  if (def.minSize) {
    const { value, message } = def.minSize;
    checks.push(`.min(${primitiveToTypescriptValue(value)}, ${primitiveToTypescriptValue(message)})`);
  }
  if (def.maxSize) {
    const { value, message } = def.maxSize;
    checks.push(`.max(${primitiveToTypescriptValue(value)}, ${primitiveToTypescriptValue(message)})`);
  }
  return checks.join("");
}, "generateSetChecks");
var generateStringChecks = /* @__PURE__ */ __name((def) => {
  const checks = def.checks;
  if (checks.length === 0) {
    return "";
  }
  return checks.map(_generateStringCheck).join("");
}, "generateStringChecks");
var _generateStringCheck = /* @__PURE__ */ __name((check) => {
  switch (check.kind) {
    case "min":
      return `.min(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    case "max":
      return `.max(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    case "length":
      return `.length(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    case "email":
      return `.email(${primitiveToTypescriptValue(check.message)})`;
    case "url":
      return `.url(${primitiveToTypescriptValue(check.message)})`;
    case "emoji":
      return `.emoji(${primitiveToTypescriptValue(check.message)})`;
    case "uuid":
      return `.uuid(${primitiveToTypescriptValue(check.message)})`;
    case "cuid":
      return `.cuid(${primitiveToTypescriptValue(check.message)})`;
    case "cuid2":
      return `.cuid2(${primitiveToTypescriptValue(check.message)})`;
    case "ulid":
      return `.ulid(${primitiveToTypescriptValue(check.message)})`;
    case "includes":
      const includesOptions = unknownToTypescriptValue({ message: check.message, position: check.position });
      return `.includes(${primitiveToTypescriptValue(check.value)}, ${includesOptions})`;
    case "startsWith":
      return `.startsWith(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    case "endsWith":
      return `.endsWith(${primitiveToTypescriptValue(check.value)}, ${primitiveToTypescriptValue(check.message)})`;
    case "regex":
      const tsRegex = String(check.regex);
      return `.regex(${tsRegex}, ${primitiveToTypescriptValue(check.message)})`;
    case "trim":
      return ".trim()";
    case "toLowerCase":
      return ".toLowerCase()";
    case "toUpperCase":
      return ".toUpperCase()";
    case "datetime":
      const datetimePrecision = check.precision === null ? undefined : check.precision;
      const dateTimeOptions = unknownToTypescriptValue({
        message: check.message,
        precision: datetimePrecision,
        offset: check.offset
      });
      return `.datetime(${dateTimeOptions})`;
    case "ip":
      const ipOptions = unknownToTypescriptValue({ message: check.message, version: check.version });
      return `.ip(${ipOptions})`;
    default:
      return "";
  }
}, "_generateStringCheck");
var { zuiKey: zuiKey8 } = z_exports;
function toTypescriptSchema(schema) {
  return _toTypescriptSchema(schema, new PropertyPath);
}
__name(toTypescriptSchema, "toTypescriptSchema");
function _toTypescriptSchema(schema, path) {
  const wrappedSchema = schema;
  const dts = sUnwrapZod2(wrappedSchema, path);
  return dts;
}
__name(_toTypescriptSchema, "_toTypescriptSchema");
function sUnwrapZod2(schema, path) {
  const s = schema;
  switch (s.typeName) {
    case "ZodString":
      return `z.string()${generateStringChecks(s._def)}${_addMetadata(s._def)}`.trim();
    case "ZodNumber":
      return `z.number()${generateNumberChecks(s._def)}${_addMetadata(s._def)}`.trim();
    case "ZodNaN":
      return `z.nan()${_addMetadata(s._def)}`.trim();
    case "ZodBigInt":
      return `z.bigint()${generateBigIntChecks(s._def)}${_addMetadata(s._def)}`.trim();
    case "ZodBoolean":
      return `z.boolean()${_addMetadata(s._def)}`.trim();
    case "ZodDate":
      return `z.date()${generateDateChecks(s._def)}${_addMetadata(s._def)}`.trim();
    case "ZodUndefined":
      return `z.undefined()${_addMetadata(s._def)}`.trim();
    case "ZodNull":
      return `z.null()${_addMetadata(s._def)}`.trim();
    case "ZodAny":
      return `z.any()${_addMetadata(s._def)}`.trim();
    case "ZodUnknown":
      return `z.unknown()${_addMetadata(s._def)}`.trim();
    case "ZodNever":
      return `z.never()${_addMetadata(s._def)}`.trim();
    case "ZodVoid":
      return `z.void()${_addMetadata(s._def)}`.trim();
    case "ZodArray":
      return `z.array(${sUnwrapZod2(s._def.type, path.withIndexType("number"))})${generateArrayChecks(s._def)}${_addMetadata(s._def, s._def.type)}`;
    case "ZodObject":
      const props = {};
      for (const [key, value2] of Object.entries(s.shape)) {
        props[key] = sUnwrapZod2(value2, path.withIndexType("key", key));
      }
      const catchall = s.additionalProperties();
      const catchallString = catchall ? `.catchall(${sUnwrapZod2(catchall, path.withIndexType("string"))})` : "";
      return [
        "z.object({",
        ...Object.entries(props).map(([key, value2]) => `  ${key}: ${value2},`),
        `})${catchallString}${_addMetadata(s._def)}`
      ].join(`
`).trim();
    case "ZodUnion":
      const options = s._def.options.map((option, index) => sUnwrapZod2(option, path.withIndexType("number", index)));
      return `z.union([${options.join(", ")}])${_addMetadata(s._def)}`.trim();
    case "ZodDiscriminatedUnion":
      const opts = s._def.options.map((option, index) => sUnwrapZod2(option, path.withIndexType("number", index)));
      const discriminator = primitiveToTypescriptValue(s._def.discriminator);
      return `z.discriminatedUnion(${discriminator}, [${opts.join(", ")}])${_addMetadata(s._def)}`.trim();
    case "ZodIntersection":
      const left = sUnwrapZod2(s._def.left, path.withIndexType("number", 0));
      const right = sUnwrapZod2(s._def.right, path.withIndexType("number", 1));
      return `z.intersection(${left}, ${right})${_addMetadata(s._def)}`.trim();
    case "ZodTuple":
      const items = s._def.items.map((item, index) => sUnwrapZod2(item, path.withIndexType("number", index)));
      return `z.tuple([${items.join(", ")}])${_addMetadata(s._def)}`.trim();
    case "ZodRecord":
      const keyType = sUnwrapZod2(s._def.keyType, path.withWrapper("KeyOf"));
      const recordPath = is.zuiString(s._def.keyType) ? path.withIndexType("string") : is.zuiNumber(s._def.keyType) ? path.withIndexType("number") : path.withIndexType("any");
      const valueType = sUnwrapZod2(s._def.valueType, recordPath);
      return `z.record(${keyType}, ${valueType})${_addMetadata(s._def)}`.trim();
    case "ZodMap":
      const mapKeyType = sUnwrapZod2(s._def.keyType, path.withWrapper("KeyOf"));
      const mapPath = is.zuiString(s._def.keyType) ? path.withIndexType("string") : is.zuiNumber(s._def.keyType) ? path.withIndexType("number") : path.withIndexType("any");
      const mapValueType = sUnwrapZod2(s._def.valueType, mapPath);
      return `z.map(${mapKeyType}, ${mapValueType})${_addMetadata(s._def)}`.trim();
    case "ZodSet":
      return `z.set(${sUnwrapZod2(s._def.valueType, path.withIndexType("number"))})${generateSetChecks(s._def)}${_addMetadata(s._def)}`.trim();
    case "ZodFunction":
      const args = s._def.args.items.map((arg, index) => sUnwrapZod2(arg, path.withWrapper("Parameters").withIndexType("number", index)));
      const argsString = args.length ? `.args(${args.join(", ")})` : "";
      const returns = sUnwrapZod2(s._def.returns, path.withWrapper("ReturnType"));
      return `z.function()${argsString}.returns(${returns})${_addMetadata(s._def)}`.trim();
    case "ZodLazy":
      return `z.lazy(() => ${sUnwrapZod2(s._def.getter(), path)})${_addMetadata(s._def)}`.trim();
    case "ZodLiteral":
      const value = primitiveToTypescriptValue(s._def.value);
      return `z.literal(${value})${_addMetadata(s._def)}`.trim();
    case "ZodEnum":
      const values = s._def.values.map(primitiveToTypescriptValue);
      return `z.enum([${values.join(", ")}])${_addMetadata(s._def)}`.trim();
    case "ZodEffects":
      throw new UnsupportedZuiToTypescriptSchemaError("ZodEffects", path.toString());
    case "ZodNativeEnum":
      throw new UnsupportedZuiToTypescriptSchemaError("ZodNativeEnum", path.toString());
    case "ZodOptional":
      return `z.optional(${sUnwrapZod2(s._def.innerType, path)})${_addMetadata(s._def, s._def.innerType)}`.trim();
    case "ZodNullable":
      return `z.nullable(${sUnwrapZod2(s._def.innerType, path)})${_addMetadata(s._def, s._def.innerType)}`.trim();
    case "ZodDefault":
      const defaultValue = unknownToTypescriptValue(s._def.defaultValue());
      return `z.default(${sUnwrapZod2(s._def.innerType, path)}, ${defaultValue})${_addMetadata(s._def, s._def.innerType)}`.trim();
    case "ZodCatch":
      throw new UnsupportedZuiToTypescriptSchemaError("ZodCatch", path.toString());
    case "ZodPromise":
      return `z.promise(${sUnwrapZod2(s._def.type, path)})${_addMetadata(s._def, s._def.type)}`.trim();
    case "ZodBranded":
      throw new UnsupportedZuiToTypescriptSchemaError("ZodBranded", path.toString());
    case "ZodPipeline":
      throw new UnsupportedZuiToTypescriptSchemaError("ZodPipeline", path.toString());
    case "ZodSymbol":
      throw new UnsupportedZuiToTypescriptSchemaError("ZodSymbol", path.toString());
    case "ZodReadonly":
      return `z.readonly(${sUnwrapZod2(s._def.innerType, path)})${_addMetadata(s._def, s._def.innerType)}`.trim();
    case "ZodRef":
      const uri = primitiveToTypescriptValue(s._def.uri);
      return `z.ref(${uri})${_addMetadata(s._def)}`.trim();
    default:
      assert_utils_exports.assertNever(s);
  }
}
__name(sUnwrapZod2, "sUnwrapZod");
var _addMetadata = /* @__PURE__ */ __name((def, inner) => {
  const innerDef = inner == null ? undefined : inner._def;
  return `${_addZuiExtensions(def, innerDef)}${_maybeDescribe(def, innerDef)}`;
}, "_addMetadata");
var _maybeDescribe = /* @__PURE__ */ __name((def, innerDef) => {
  if (!def.description) {
    return "";
  }
  if (innerDef && innerDef.description === def.description) {
    return "";
  }
  return `.describe(${primitiveToTypescriptValue(def.description)})`;
}, "_maybeDescribe");
var _addZuiExtensions = /* @__PURE__ */ __name((def, innerDef) => `${_maybeTitle(def, innerDef)}${_maybeDisplayAs(def, innerDef)}${_maybeDisabled(def, innerDef)}${_maybeHidden(def, innerDef)}${_maybePlaceholder(def, innerDef)}${_maybeSecret(def, innerDef)}${_maybeSetMetadata(def, innerDef)}`, "_addZuiExtensions");
var _maybeTitle = /* @__PURE__ */ __name((def, innerDef) => {
  var _a, _b;
  const title = (_a = def[zuiKey8]) == null ? undefined : _a.title;
  if (!title) {
    return "";
  }
  if (innerDef && ((_b = innerDef[zuiKey8]) == null ? undefined : _b.title) === title) {
    return "";
  }
  return `.title(${primitiveToTypescriptValue(title)})`;
}, "_maybeTitle");
var _maybeDisplayAs = /* @__PURE__ */ __name((def, innerDef) => {
  var _a, _b;
  const displayAs = (_a = def[zuiKey8]) == null ? undefined : _a.displayAs;
  if (!displayAs) {
    return "";
  }
  if (innerDef && isEqual_default2((_b = innerDef[zuiKey8]) == null ? undefined : _b.displayAs, displayAs)) {
    return "";
  }
  return `.displayAs(${recordOfUnknownToTypescriptRecord({ id: displayAs[0], params: displayAs[1] })})`;
}, "_maybeDisplayAs");
var _maybeDisabled = /* @__PURE__ */ __name((def, innerDef) => {
  var _a, _b;
  const disabled = (_a = def[zuiKey8]) == null ? undefined : _a.disabled;
  if (!disabled) {
    return "";
  }
  if (innerDef && ((_b = innerDef[zuiKey8]) == null ? undefined : _b.disabled) === disabled) {
    return "";
  }
  return `.disabled(${disabled})`;
}, "_maybeDisabled");
var _maybeHidden = /* @__PURE__ */ __name((def, innerDef) => {
  var _a, _b;
  const hidden = (_a = def[zuiKey8]) == null ? undefined : _a.hidden;
  if (!hidden) {
    return "";
  }
  if (innerDef && ((_b = innerDef[zuiKey8]) == null ? undefined : _b.hidden) === hidden) {
    return "";
  }
  return `.hidden(${hidden})`;
}, "_maybeHidden");
var _maybePlaceholder = /* @__PURE__ */ __name((def, innerDef) => {
  var _a, _b;
  const placeholder = (_a = def[zuiKey8]) == null ? undefined : _a.placeholder;
  if (!placeholder) {
    return "";
  }
  if (innerDef && ((_b = innerDef[zuiKey8]) == null ? undefined : _b.placeholder) === placeholder) {
    return "";
  }
  return `.placeholder(${primitiveToTypescriptValue(placeholder)})`;
}, "_maybePlaceholder");
var _maybeSecret = /* @__PURE__ */ __name((def, innerDef) => {
  var _a, _b;
  const secret = (_a = def[zuiKey8]) == null ? undefined : _a.secret;
  if (!secret) {
    return "";
  }
  if (innerDef && ((_b = innerDef[zuiKey8]) == null ? undefined : _b.secret) === secret) {
    return "";
  }
  return ".secret()";
}, "_maybeSecret");
var _maybeSetMetadata = /* @__PURE__ */ __name((def, innerDef) => {
  var _a, _b;
  const reservedKeys = [
    "title",
    "tooltip",
    "displayAs",
    "disabled",
    "hidden",
    "placeholder",
    "secret",
    "coerce"
  ];
  const metadata = Object.entries((_a = def[zuiKey8]) != null ? _a : {}).filter(([key]) => !reservedKeys.includes(key));
  if (metadata.length === 0) {
    return "";
  }
  if (innerDef) {
    const innerMetadata = Object.entries((_b = innerDef[zuiKey8]) != null ? _b : {}).filter(([key]) => !reservedKeys.includes(key));
    if (isEqual_default2(Object.fromEntries(metadata), Object.fromEntries(innerMetadata))) {
      return "";
    }
  }
  return `.metadata(${recordOfUnknownToTypescriptRecord(Object.fromEntries(metadata))})`;
}, "_maybeSetMetadata");
var json_schema_exports = {};
ZodBaseTypeImpl.prototype.toJSONSchema = function(opts = {}) {
  return toJSONSchema(this, opts);
};
ZodBaseTypeImpl.prototype.toTypescriptType = function(opts = {}) {
  return toTypescriptType(this, opts);
};
ZodBaseTypeImpl.prototype.toTypescriptSchema = function() {
  return toTypescriptSchema(this);
};
var src_default = exports_exports;
/*! Bundled license information:

lodash-es/lodash.js:
  (**
   * @license
   * Lodash (Custom Build) <https://lodash.com/>
   * Build: `lodash modularize exports="es" -o ./`
   * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
   * Released under MIT license <https://lodash.com/license>
   * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
   * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
   *)
*/

export { __commonJS, __toESM, isFunction_default, isPlainObject_default, deburr_default, upperFirst_default, camelCase_default, clamp_default, isString_default, isEmpty_default, isEqual_default, mapValues_default, maxBy_default, omit_default, pickBy_default, startCase_default, uniq_default, cloneDeep_default, countBy_default, toPairs_default, filter_default, map_default, flow_default, fromPairs_default, isNil_default, mapKeys_default, orderBy_default, take_default, uniqWith_default, exports_exports, transforms_exports, src_default };