"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; 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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // index.ts var akar_exports = {}; __export(akar_exports, { a: () => a }); module.exports = __toCommonJS(akar_exports); // lib/validators/array.ts var array_exports = {}; __export(array_exports, { isArray: () => isArray, isUnique: () => isUnique, length: () => length, maxLength: () => maxLength, minLength: () => minLength, rangeLength: () => rangeLength }); var isArray = /* @__PURE__ */ __name((input) => Array.isArray(input), "isArray"); var length = /* @__PURE__ */ __name((input, expected) => input.length === expected, "length"); var minLength = /* @__PURE__ */ __name((input, min2) => input.length >= min2, "minLength"); var maxLength = /* @__PURE__ */ __name((input, max2) => input.length <= max2, "maxLength"); var rangeLength = /* @__PURE__ */ __name((input, min2, max2) => input.length >= min2 && input.length <= max2, "rangeLength"); var isUnique = /* @__PURE__ */ __name((input) => input.length === new Set(input).size, "isUnique"); // lib/validators/enum.ts var enum_exports = {}; __export(enum_exports, { isEnum: () => isEnum, isNativeEnum: () => isNativeEnum }); var isEnum = /* @__PURE__ */ __name((input, values) => values.includes(input), "isEnum"); var isNativeEnum = /* @__PURE__ */ __name((input, values) => Object.values(values).includes(input), "isNativeEnum"); // lib/validators/number.ts var number_exports = {}; __export(number_exports, { isBinary: () => isBinary, isDivisible: () => isDivisible, isEven: () => isEven, isFloat: () => isFloat, isHex: () => isHex, isInteger: () => isInteger, isNegative: () => isNegative, isNumber: () => isNumber, isOctal: () => isOctal, isOdd: () => isOdd, isPerfect: () => isPerfect, isPort: () => isPort, isPositive: () => isPositive, isPrime: () => isPrime, max: () => max, min: () => min, range: () => range }); var isNumber = /* @__PURE__ */ __name((input) => typeof input === "number" && !isNaN(input), "isNumber"); var isInteger = /* @__PURE__ */ __name((input) => Number.isInteger(input), "isInteger"); var isFloat = /* @__PURE__ */ __name((input) => /^\d+\.\d+$/.test(input.toString()), "isFloat"); var isBinary = /* @__PURE__ */ __name((input) => /^[01]+$/.test(input.toString()), "isBinary"); var isOctal = /* @__PURE__ */ __name((input) => /^[0-7]+$/.test(input.toString()), "isOctal"); var isHex = /* @__PURE__ */ __name((input) => /^[0-9A-F]+$/i.test(input.toString()), "isHex"); var isPositive = /* @__PURE__ */ __name((input) => input >= 0, "isPositive"); var isNegative = /* @__PURE__ */ __name((input) => input < 0, "isNegative"); var min = /* @__PURE__ */ __name((input, min2) => input >= min2, "min"); var max = /* @__PURE__ */ __name((input, max2) => input <= max2, "max"); var range = /* @__PURE__ */ __name((input, min2, max2) => input >= min2 && input <= max2, "range"); var isPort = /* @__PURE__ */ __name((input) => isInteger(input) && range(input, 0, 65535), "isPort"); var isOdd = /* @__PURE__ */ __name((input) => input % 2 !== 0, "isOdd"); var isEven = /* @__PURE__ */ __name((input) => input % 2 === 0, "isEven"); var isDivisible = /* @__PURE__ */ __name((input, divisor) => input % divisor === 0, "isDivisible"); var isPrime = /* @__PURE__ */ __name((input) => { if (input < 2) return false; for (let i = 2; i <= Math.sqrt(input); i++) { if (input % i === 0) return false; } return true; }, "isPrime"); var isPerfect = /* @__PURE__ */ __name((input) => { let sum = 0; for (let i = 1; i < input; i++) { if (input % i === 0) sum += i; } return sum === input; }, "isPerfect"); // lib/validators/object.ts var object_exports = {}; __export(object_exports, { hasKey: () => hasKey, hasKeys: () => hasKeys, hasValues: () => hasValues, isDeepEqual: () => isDeepEqual, isEqual: () => isEqual, isJSON: () => isJSON, isObject: () => isObject, isShallowEqual: () => isShallowEqual }); var isObject = /* @__PURE__ */ __name((input) => typeof input === "object" && !Array.isArray(input) && input !== null, "isObject"); var isJSON = /* @__PURE__ */ __name((input) => { if (typeof input === "string") { try { JSON.parse(input); return true; } catch (_e) { return false; } } return false; }, "isJSON"); var isEqual = /* @__PURE__ */ __name((input, expected) => JSON.stringify(input) === JSON.stringify(expected), "isEqual"); var isDeepEqual = /* @__PURE__ */ __name((input, expected) => { try { return JSON.stringify(input) === JSON.stringify(expected); } catch (e) { return false; } }, "isDeepEqual"); var isShallowEqual = /* @__PURE__ */ __name((input, expected) => Object.keys(input).length === Object.keys(expected).length && Object.keys(input).every((key) => input[key] === expected[key]), "isShallowEqual"); var hasKey = /* @__PURE__ */ __name((input, key) => key in input, "hasKey"); var hasKeys = /* @__PURE__ */ __name((input, keys) => keys.every((key) => key in input), "hasKeys"); var hasValues = /* @__PURE__ */ __name((input, values) => values.every((value) => Object.values(input).includes(value)), "hasValues"); // lib/validators/string.ts var string_exports = {}; __export(string_exports, { contains: () => contains, isAlpha: () => isAlpha, isAlphanumeric: () => isAlphanumeric, isBIC: () => isBIC, isBase: () => isBase, isBase64: () => isBase64, isBase64URL: () => isBase64URL, isCUID: () => isCUID, isCountry: () => isCountry, isCreditCard: () => isCreditCard, isCurrency: () => isCurrency, isDataURI: () => isDataURI, isDate: () => isDate, isDay: () => isDay, isEmail: () => isEmail, isEmpty: () => isEmpty, isFQDN: () => isFQDN, isFullwidth: () => isFullwidth, isGUID: () => isGUID, isHSL: () => isHSL, isHalfwidth: () => isHalfwidth, isHex: () => isHex2, isHour: () => isHour, isIBAN: () => isIBAN, isIP: () => isIP, isIPv6: () => isIPv6, isISBN: () => isISBN, isISIN: () => isISIN, isISSN: () => isISSN, isJSON: () => isJSON2, isJWT: () => isJWT, isLatLng: () => isLatLng, isLocale: () => isLocale, isLowercase: () => isLowercase, isMAC: () => isMAC, isMD5: () => isMD5, isMIME: () => isMIME, isMagnet: () => isMagnet, isMinuteOrSeconds: () => isMinuteOrSeconds, isMongoID: () => isMongoID, isMonth: () => isMonth, isMultibyte: () => isMultibyte, isNumeric: () => isNumeric, isOTP: () => isOTP, isPassport: () => isPassport, isPassword: () => isPassword, isPhone: () => isPhone, isPostalCode: () => isPostalCode, isRGB: () => isRGB, isSHA1: () => isSHA1, isSHA256: () => isSHA256, isSHA512: () => isSHA512, isSemVer: () => isSemVer, isSemver: () => isSemver, isSlug: () => isSlug, isString: () => isString, isTime: () => isTime, isTimezone: () => isTimezone, isURL: () => isURL, isUTC: () => isUTC, isUUID: () => isUUID, isUppercase: () => isUppercase, isVariable: () => isVariable, isWeekday: () => isWeekday, isWhitespace: () => isWhitespace, isYear: () => isYear, length: () => length2, maxLength: () => maxLength2, minLength: () => minLength2, pattern: () => pattern, range: () => range2 }); // lib/helpers/countries.ts var Countries = { afghanistan: { name: "Afghanistan", code: "AF", phoneCode: "+93" }, albania: { name: "Albania", code: "AL", phoneCode: "+355" }, algeria: { name: "Algeria", code: "DZ", phoneCode: "+213" }, andorra: { name: "Andorra", code: "AD", phoneCode: "+376" }, angola: { name: "Angola", code: "AO", phoneCode: "+244" }, antiguaAndBarbuda: { name: "Antigua and Barbuda", code: "AG", phoneCode: "+1268" }, argentina: { name: "Argentina", code: "AR", phoneCode: "+54" }, armenia: { name: "Armenia", code: "AM", phoneCode: "+374" }, australia: { name: "Australia", code: "AU", phoneCode: "+61" }, austria: { name: "Austria", code: "AT", phoneCode: "+43" }, azerbaijan: { name: "Azerbaijan", code: "AZ", phoneCode: "+994" }, bahamas: { name: "Bahamas", code: "BS", phoneCode: "+1242" }, bahrain: { name: "Bahrain", code: "BH", phoneCode: "+973" }, bangladesh: { name: "Bangladesh", code: "BD", phoneCode: "+880" }, barbados: { name: "Barbados", code: "BB", phoneCode: "+1246" }, belarus: { name: "Belarus", code: "BY", phoneCode: "+375" }, belgium: { name: "Belgium", code: "BE", phoneCode: "+32" }, belize: { name: "Belize", code: "BZ", phoneCode: "+501" }, benin: { name: "Benin", code: "BJ", phoneCode: "+229" }, bhutan: { name: "Bhutan", code: "BT", phoneCode: "+975" }, bolivia: { name: "Bolivia", code: "BO", phoneCode: "+591" }, bosniaAndHerzegovina: { name: "Bosnia and Herzegovina", code: "BA", phoneCode: "+387" }, botswana: { name: "Botswana", code: "BW", phoneCode: "+267" }, brazil: { name: "Brazil", code: "BR", phoneCode: "+55" }, brunei: { name: "Brunei", code: "BN", phoneCode: "+673" }, bulgaria: { name: "Bulgaria", code: "BG", phoneCode: "+359" }, burkinaFaso: { name: "Burkina Faso", code: "BF", phoneCode: "+226" }, burundi: { name: "Burundi", code: "BI", phoneCode: "+257" }, cambodia: { name: "Cambodia", code: "KH", phoneCode: "+855" }, cameroon: { name: "Cameroon", code: "CM", phoneCode: "+237" }, canada: { name: "Canada", code: "CA", phoneCode: "+1" }, capeVerde: { name: "Cape Verde", code: "CV", phoneCode: "+238" }, centralAfricanRepublic: { name: "Central African Republic", code: "CF", phoneCode: "+236" }, chad: { name: "Chad", code: "TD", phoneCode: "+235" }, chile: { name: "Chile", code: "CL", phoneCode: "+56" }, china: { name: "China", code: "CN", phoneCode: "+86" }, colombia: { name: "Colombia", code: "CO", phoneCode: "+57" }, comoros: { name: "Comoros", code: "KM", phoneCode: "+269" }, congo: { name: "Congo", code: "CG", phoneCode: "+242" }, costaRica: { name: "Costa Rica", code: "CR", phoneCode: "+506" }, croatia: { name: "Croatia", code: "HR", phoneCode: "+385" }, cuba: { name: "Cuba", code: "CU", phoneCode: "+53" }, cyprus: { name: "Cyprus", code: "CY", phoneCode: "+357" }, czechRepublic: { name: "Czech Republic", code: "CZ", phoneCode: "+420" }, democraticRepublicOfCongo: { name: "Democratic Republic of Congo", code: "CD", phoneCode: "+243" }, denmark: { name: "Denmark", code: "DK", phoneCode: "+45" }, djibouti: { name: "Djibouti", code: "DJ", phoneCode: "+253" }, dominica: { name: "Dominica", code: "DM", phoneCode: "+1767" }, dominicanRepublic: { name: "Dominican Republic", code: "DO", phoneCode: "+1849" }, eastTimor: { name: "East Timor", code: "TL", phoneCode: "+670" }, ecuador: { name: "Ecuador", code: "EC", phoneCode: "+593" }, egypt: { name: "Egypt", code: "EG", phoneCode: "+20" }, elSalvador: { name: "El Salvador", code: "SV", phoneCode: "+503" }, equatorialGuinea: { name: "Equatorial Guinea", code: "GQ", phoneCode: "+240" }, eritrea: { name: "Eritrea", code: "ER", phoneCode: "+291" }, estonia: { name: "Estonia", code: "EE", phoneCode: "+372" }, ethiopia: { name: "Ethiopia", code: "ET", phoneCode: "+251" }, fiji: { name: "Fiji", code: "FJ", phoneCode: "+679" }, finland: { name: "Finland", code: "FI", phoneCode: "+358" }, france: { name: "France", code: "FR", phoneCode: "+33" }, gabon: { name: "Gabon", code: "GA", phoneCode: "+241" }, gambia: { name: "Gambia", code: "GM", phoneCode: "+220" }, georgia: { name: "Georgia", code: "GE", phoneCode: "+995" }, germany: { name: "Germany", code: "DE", phoneCode: "+49" }, ghana: { name: "Ghana", code: "GH", phoneCode: "+233" }, greece: { name: "Greece", code: "GR", phoneCode: "+30" }, grenada: { name: "Grenada", code: "GD", phoneCode: "+1473" }, guatemala: { name: "Guatemala", code: "GT", phoneCode: "+502" }, guinea: { name: "Guinea", code: "GN", phoneCode: "+224" }, guineaBissau: { name: "Guinea-Bissau", code: "GW", phoneCode: "+245" }, guyana: { name: "Guyana", code: "GY", phoneCode: "+592" }, haiti: { name: "Haiti", code: "HT", phoneCode: "+509" }, honduras: { name: "Honduras", code: "HN", phoneCode: "+504" }, hungary: { name: "Hungary", code: "HU", phoneCode: "+36" }, iceland: { name: "Iceland", code: "IS", phoneCode: "+354" }, india: { name: "India", code: "IN", phoneCode: "+91" }, indonesia: { name: "Indonesia", code: "ID", phoneCode: "+62" }, iran: { name: "Iran", code: "IR", phoneCode: "+98" }, iraq: { name: "Iraq", code: "IQ", phoneCode: "+964" }, ireland: { name: "Ireland", code: "IE", phoneCode: "+353" }, israel: { name: "Israel", code: "IL", phoneCode: "+972" }, italy: { name: "Italy", code: "IT", phoneCode: "+39" }, ivoryCoast: { name: "Ivory Coast", code: "CI", phoneCode: "+225" }, jamaica: { name: "Jamaica", code: "JM", phoneCode: "+1876" }, japan: { name: "Japan", code: "JP", phoneCode: "+81" }, jordan: { name: "Jordan", code: "JO", phoneCode: "+962" }, kazakhstan: { name: "Kazakhstan", code: "KZ", phoneCode: "+7" }, kenya: { name: "Kenya", code: "KE", phoneCode: "+254" }, kiribati: { name: "Kiribati", code: "KI", phoneCode: "+686" }, kuwait: { name: "Kuwait", code: "KW", phoneCode: "+965" }, kyrgyzstan: { name: "Kyrgyzstan", code: "KG", phoneCode: "+996" }, laos: { name: "Laos", code: "LA", phoneCode: "+856" }, latvia: { name: "Latvia", code: "LV", phoneCode: "+371" }, lebanon: { name: "Lebanon", code: "LB", phoneCode: "+961" }, lesotho: { name: "Lesotho", code: "LS", phoneCode: "+266" }, liberia: { name: "Liberia", code: "LR", phoneCode: "+231" }, libya: { name: "Libya", code: "LY", phoneCode: "+218" }, liechtenstein: { name: "Liechtenstein", code: "LI", phoneCode: "+423" }, lithuania: { name: "Lithuania", code: "LT", phoneCode: "+370" }, luxembourg: { name: "Luxembourg", code: "LU", phoneCode: "+352" }, madagascar: { name: "Madagascar", code: "MG", phoneCode: "+261" }, malawi: { name: "Malawi", code: "MW", phoneCode: "+265" }, malaysia: { name: "Malaysia", code: "MY", phoneCode: "+60" }, maldives: { name: "Maldives", code: "MV", phoneCode: "+960" }, mali: { name: "Mali", code: "ML", phoneCode: "+223" }, malta: { name: "Malta", code: "MT", phoneCode: "+356" }, marshallIslands: { name: "Marshall Islands", code: "MH", phoneCode: "+692" }, mauritania: { name: "Mauritania", code: "MR", phoneCode: "+222" }, mauritius: { name: "Mauritius", code: "MU", phoneCode: "+230" }, mexico: { name: "Mexico", code: "MX", phoneCode: "+52" }, micronesia: { name: "Micronesia", code: "FM", phoneCode: "+691" }, moldova: { name: "Moldova", code: "MD", phoneCode: "+373" }, monaco: { name: "Monaco", code: "MC", phoneCode: "+377" }, mongolia: { name: "Mongolia", code: "MN", phoneCode: "+976" }, montenegro: { name: "Montenegro", code: "ME", phoneCode: "+382" }, morocco: { name: "Morocco", code: "MA", phoneCode: "+212" }, mozambique: { name: "Mozambique", code: "MZ", phoneCode: "+258" }, myanmar: { name: "Myanmar", code: "MM", phoneCode: "+95" }, namibia: { name: "Namibia", code: "NA", phoneCode: "+264" }, nauru: { name: "Nauru", code: "NR", phoneCode: "+674" }, nepal: { name: "Nepal", code: "NP", phoneCode: "+977" }, netherlands: { name: "Netherlands", code: "NL", phoneCode: "+31" }, newZealand: { name: "New Zealand", code: "NZ", phoneCode: "+64" }, nicaragua: { name: "Nicaragua", code: "NI", phoneCode: "+505" }, niger: { name: "Niger", code: "NE", phoneCode: "+227" }, nigeria: { name: "Nigeria", code: "NG", phoneCode: "+234" }, northKorea: { name: "North Korea", code: "KP", phoneCode: "+850" }, northMacedonia: { name: "North Macedonia", code: "MK", phoneCode: "+389" }, norway: { name: "Norway", code: "NO", phoneCode: "+47" }, oman: { name: "Oman", code: "OM", phoneCode: "+968" }, pakistan: { name: "Pakistan", code: "PK", phoneCode: "+92" }, palau: { name: "Palau", code: "PW", phoneCode: "+680" }, palestine: { name: "Palestine", code: "PS", phoneCode: "+970" }, panama: { name: "Panama", code: "PA", phoneCode: "+507" }, papuaNewGuinea: { name: "Papua New Guinea", code: "PG", phoneCode: "+675" }, paraguay: { name: "Paraguay", code: "PY", phoneCode: "+595" }, peru: { name: "Peru", code: "PE", phoneCode: "+51" }, philippines: { name: "Philippines", code: "PH", phoneCode: "+63" }, poland: { name: "Poland", code: "PL", phoneCode: "+48" }, portugal: { name: "Portugal", code: "PT", phoneCode: "+351" }, qatar: { name: "Qatar", code: "QA", phoneCode: "+974" }, romania: { name: "Romania", code: "RO", phoneCode: "+40" }, russia: { name: "Russia", code: "RU", phoneCode: "+7" }, rwanda: { name: "Rwanda", code: "RW", phoneCode: "+250" }, saintKittsAndNevis: { name: "Saint Kitts and Nevis", code: "KN", phoneCode: "+1869" }, saintLucia: { name: "Saint Lucia", code: "LC", phoneCode: "+1758" }, saintVincentAndTheGrenadines: { name: "Saint Vincent and the Grenadines", code: "VC", phoneCode: "+1784" }, samoa: { name: "Samoa", code: "WS", phoneCode: "+685" }, sanMarino: { name: "San Marino", code: "SM", phoneCode: "+378" }, saoTomeAndPrincipe: { name: "Sao Tome and Principe", code: "ST", phoneCode: "+239" }, saudiArabia: { name: "Saudi Arabia", code: "SA", phoneCode: "+966" }, senegal: { name: "Senegal", code: "SN", phoneCode: "+221" }, serbia: { name: "Serbia", code: "RS", phoneCode: "+381" }, seychelles: { name: "Seychelles", code: "SC", phoneCode: "+248" }, sierraLeone: { name: "Sierra Leone", code: "SL", phoneCode: "+232" }, singapore: { name: "Singapore", code: "SG", phoneCode: "+65" }, slovakia: { name: "Slovakia", code: "SK", phoneCode: "+421" }, slovenia: { name: "Slovenia", code: "SI", phoneCode: "+386" }, solomonIslands: { name: "Solomon Islands", code: "SB", phoneCode: "+677" }, somalia: { name: "Somalia", code: "SO", phoneCode: "+252" }, southAfrica: { name: "South Africa", code: "ZA", phoneCode: "+27" }, southKorea: { name: "South Korea", code: "KR", phoneCode: "+82" }, southSudan: { name: "South Sudan", code: "SS", phoneCode: "+211" }, spain: { name: "Spain", code: "ES", phoneCode: "+34" }, sriLanka: { name: "Sri Lanka", code: "LK", phoneCode: "+94" }, sudan: { name: "Sudan", code: "SD", phoneCode: "+249" }, suriname: { name: "Suriname", code: "SR", phoneCode: "+597" }, swaziland: { name: "Swaziland", code: "SZ", phoneCode: "+268" }, sweden: { name: "Sweden", code: "SE", phoneCode: "+46" }, switzerland: { name: "Switzerland", code: "CH", phoneCode: "+41" }, syria: { name: "Syria", code: "SY", phoneCode: "+963" }, tajikistan: { name: "Tajikistan", code: "TJ", phoneCode: "+992" }, tanzania: { name: "Tanzania", code: "TZ", phoneCode: "+255" }, thailand: { name: "Thailand", code: "TH", phoneCode: "+66" }, togo: { name: "Togo", code: "TG", phoneCode: "+228" }, tonga: { name: "Tonga", code: "TO", phoneCode: "+676" }, trinidadAndTobago: { name: "Trinidad and Tobago", code: "TT", phoneCode: "+1868" }, tunisia: { name: "Tunisia", code: "TN", phoneCode: "+216" }, turkey: { name: "Turkey", code: "TR", phoneCode: "+90" }, turkmenistan: { name: "Turkmenistan", code: "TM", phoneCode: "+993" }, tuvalu: { name: "Tuvalu", code: "TV", phoneCode: "+688" }, uganda: { name: "Uganda", code: "UG", phoneCode: "+256" }, ukraine: { name: "Ukraine", code: "UA", phoneCode: "+380" }, unitedArabEmirates: { name: "United Arab Emirates", code: "AE", phoneCode: "+971" }, unitedKingdom: { name: "United Kingdom", code: "GB", phoneCode: "+44" }, unitedStates: { name: "United States", code: "US", phoneCode: "+1" }, uruguay: { name: "Uruguay", code: "UY", phoneCode: "+598" }, uzbekistan: { name: "Uzbekistan", code: "UZ", phoneCode: "+998" }, vanuatu: { name: "Vanuatu", code: "VU", phoneCode: "+678" }, vaticanCity: { name: "Vatican City", code: "VA", phoneCode: "+379" }, venezuela: { name: "Venezuela", code: "VE", phoneCode: "+58" }, vietnam: { name: "Vietnam", code: "VN", phoneCode: "+84" }, yemen: { name: "Yemen", code: "YE", phoneCode: "+967" }, zambia: { name: "Zambia", code: "ZM", phoneCode: "+260" }, zimbabwe: { name: "Zimbabwe", code: "ZW", phoneCode: "+263" } }; var CountryCodes = Object.keys(Countries); var getCountryByName = /* @__PURE__ */ __name((name) => Countries[name], "getCountryByName"); var getCountryByNameValue = /* @__PURE__ */ __name((name) => Object.values(Countries).find((country) => country.name === name), "getCountryByNameValue"); // lib/validators/string.ts var isString = /* @__PURE__ */ __name((input) => typeof input === "string", "isString"); var isEmpty = /* @__PURE__ */ __name((input) => input.length === 0, "isEmpty"); var length2 = /* @__PURE__ */ __name((input, len) => input.length === len, "length"); var minLength2 = /* @__PURE__ */ __name((input, min2) => input.length >= min2, "minLength"); var maxLength2 = /* @__PURE__ */ __name((input, max2) => input.length <= max2, "maxLength"); var range2 = /* @__PURE__ */ __name((input, min2, max2) => input.length >= min2 && input.length <= max2, "range"); var pattern = /* @__PURE__ */ __name((input, pattern2) => new RegExp(pattern2).test(input), "pattern"); var isAlphanumeric = /* @__PURE__ */ __name((input) => /^[a-z0-9]+$/i.test(input), "isAlphanumeric"); var isAlpha = /* @__PURE__ */ __name((input) => /^[a-z]+$/i.test(input), "isAlpha"); var isNumeric = /* @__PURE__ */ __name((input) => /^[0-9]+$/.test(input), "isNumeric"); var isLowercase = /* @__PURE__ */ __name((input) => /^[a-z]+$/.test(input), "isLowercase"); var isUppercase = /* @__PURE__ */ __name((input) => /^[A-Z]+$/.test(input), "isUppercase"); var isWhitespace = /* @__PURE__ */ __name((input) => /^\s+$/.test(input), "isWhitespace"); var isEmail = /* @__PURE__ */ __name((input) => /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/.test(input), "isEmail"); var isURL = /* @__PURE__ */ __name((input) => /^(https?|ftp):\/\/[^\s/$.?#].[^\s]*$/.test(input), "isURL"); var isIP = /* @__PURE__ */ __name((input) => /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test( input ), "isIP"); var isISIN = /* @__PURE__ */ __name((input) => /^[A-Z]{2}[A-Z0-9]{9}\d$/.test(input), "isISIN"); var isLocale = /* @__PURE__ */ __name((input) => /^[a-z]{2}(-[A-Z]{2})?$/.test(input), "isLocale"); var isLatLng = /* @__PURE__ */ __name((input) => /^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$/.test(input), "isLatLng"); var isSemVer = /* @__PURE__ */ __name((input) => /^\d+\.\d+\.\d+(-[a-z0-9-]+(\.[a-z0-9-]+)*)?$/i.test(input), "isSemVer"); var isIPv6 = /* @__PURE__ */ __name((input) => /^([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})$/.test(input), "isIPv6"); var isMAC = /* @__PURE__ */ __name((input) => /^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$/.test(input), "isMAC"); var isUUID = /* @__PURE__ */ __name((input) => /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i.test(input), "isUUID"); var isGUID = /* @__PURE__ */ __name((input) => /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i.test(input), "isGUID"); var isCUID = /* @__PURE__ */ __name((input) => /^[cdefghijklmnopqrstuvwxyz0123456789]{25}$/.test(input), "isCUID"); var isMongoID = /* @__PURE__ */ __name((input) => /^[a-f0-9]{24}$/i.test(input), "isMongoID"); var isISBN = /* @__PURE__ */ __name((input) => /^(?:\d{9}[\dx]|\d{13})$/i.test(input), "isISBN"); var isISSN = /* @__PURE__ */ __name((input) => /^\d{4}-\d{3}[\dx]$/i.test(input), "isISSN"); var isCreditCard = /* @__PURE__ */ __name((input) => /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/.test( input ), "isCreditCard"); var isPhone = /* @__PURE__ */ __name((input, options) => { let flag = false; if (options.phoneCode) { options.phoneCode.forEach((code) => { if (input.startsWith(code) || input.startsWith(code.slice(1))) flag = true; }); return flag; } else if (options.countryNameKey) { const countries = options.countryNameKey.map((c) => getCountryByName(c)); const phCodes = countries.map((c) => c == null ? void 0 : c.phoneCode).filter((p) => p !== void 0); if (!phCodes.length || phCodes.length < 1) throw new Error("Invalid phone code!"); phCodes.forEach((code) => { if (input.startsWith(code) || input.startsWith(code.slice(1))) flag = true; }); if (!flag) throw new Error("Invalid phone-number format!"); } else if (options.country) { const countries = options.country.map((c) => getCountryByNameValue(c)); if (countries.includes(void 0)) { throw new Error("Invalid country name!"); } const phCodes = countries.map((c) => c == null ? void 0 : c.phoneCode).filter((p) => p !== void 0); if (!phCodes.length || phCodes.length < 1) throw new Error("Invalid phone code!"); phCodes.forEach((code) => { if (input.startsWith(code) || input.startsWith(code.slice(1))) flag = true; }); if (!flag) throw new Error("Invalid phone-number format!"); } return flag; }, "isPhone"); var isCountry = /* @__PURE__ */ __name((input) => { try { const _c = getCountryByNameValue(input); return _c !== void 0 || _c !== null; } catch (_err) { return false; } }, "isCountry"); var isPostalCode = /* @__PURE__ */ __name((input) => /^[a-z0-9\s-]+$/i.test(input), "isPostalCode"); var isPassport = /* @__PURE__ */ __name((input) => /^[A-Z]{2}[a-zA-Z0-9]{3,18}$/.test(input), "isPassport"); var isCurrency = /* @__PURE__ */ __name((input) => /^[a-z]{3}$/i.test(input), "isCurrency"); var isBIC = /* @__PURE__ */ __name((input) => /^[a-z]{6}[a-z0-9]{2}([a-z0-9]{3})?$/.test(input), "isBIC"); var isIBAN = /* @__PURE__ */ __name((input) => /^[a-z]{2}\d{2}[a-z0-9]{4}\d{7}([a-z0-9]{0,3})?$/.test(input), "isIBAN"); var isHex2 = /* @__PURE__ */ __name((input) => /^[0-9A-F]+$/i.test(input), "isHex"); var isRGB = /* @__PURE__ */ __name((input) => /^#([0-9A-F]{3}|[0-9A-F]{6})$/i.test(input), "isRGB"); var isHSL = /* @__PURE__ */ __name((input) => /^hsl\(\d{1,3},\d{1,3}%,\d{1,3}%\)$/i.test(input), "isHSL"); var isPassword = /* @__PURE__ */ __name((input, options) => { var _a, _b, _c, _d, _e, _f, _g, _h; if (options.min && input.length < options.min) return false; if (options.minUppercase && ((_b = (_a = input.match(/[A-Z]/g)) == null ? void 0 : _a.length) != null ? _b : 0) < options.minUppercase) return false; if (options.minLowercase && ((_d = (_c = input.match(/[a-z]/g)) == null ? void 0 : _c.length) != null ? _d : 0) < options.minLowercase) return false; if (options.minNumber && ((_f = (_e = input.match(/[0-9]/g)) == null ? void 0 : _e.length) != null ? _f : 0) < options.minNumber) return false; if (options.minSpecial && ((_h = (_g = input.match(/[^a-zA-Z0-9]/g)) == null ? void 0 : _g.length) != null ? _h : 0) < options.minSpecial) return false; if (options.uppercase) { if (!/[A-Z]/.test(input)) return false; } if (options.lowercase) { if (!/[a-z]/.test(input)) return false; } if (options.number) { if (!/[0-9]/.test(input)) return false; } return true; }, "isPassword"); var isOTP = /* @__PURE__ */ __name((input, options = { length: 6, type: "numeric" }) => { if (options.pattern) { return new RegExp(options.pattern).test(input); } if (options.type === "numeric") { return /^[0-9]+$/.test(input) && input.length === options.length; } return /^[a-z0-9]+$/i.test(input) && input.length === options.length; }, "isOTP"); var isBase64 = /* @__PURE__ */ __name((input) => /^[a-z0-9+/]+={0,2}$/i.test(input), "isBase64"); var isDataURI = /* @__PURE__ */ __name((input) => /^data:[a-z0-9-]+\/[a-z0-9-]+;base64,[a-z0-9+/]+=*$/i.test(input), "isDataURI"); var isMIME = /* @__PURE__ */ __name((input) => /^[a-z0-9-]+\/[a-z0-9-]+(;\s?charset=[a-z0-9-]+)?$/i.test(input) && !input.endsWith(";"), "isMIME"); var isJSON2 = /* @__PURE__ */ __name((input) => { try { JSON.parse(input); return true; } catch (e) { return false; } }, "isJSON"); var isJWT = /* @__PURE__ */ __name((input) => { const parts = input.split("."); const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$/; return parts.length === 3 && jwtRegex.test(input); }, "isJWT"); var isMD5 = /* @__PURE__ */ __name((input) => /^[a-f0-9]{32}$/.test(input), "isMD5"); var isSHA1 = /* @__PURE__ */ __name((input) => /^[a-f0-9]{40}$/.test(input), "isSHA1"); var isSHA256 = /* @__PURE__ */ __name((input) => /^[a-f0-9]{64}$/.test(input), "isSHA256"); var isSHA512 = /* @__PURE__ */ __name((input) => /^[a-f0-9]{128}$/.test(input), "isSHA512"); var isMultibyte = /* @__PURE__ */ __name((input) => /[^\x00-\x7F]/.test(input), "isMultibyte"); var isFullwidth = /* @__PURE__ */ __name((input) => /[^\u0000-\u00FF]/.test(input), "isFullwidth"); var isHalfwidth = /* @__PURE__ */ __name((input) => /^[\u0000-\u00FF]+$/.test(input), "isHalfwidth"); var isVariable = /* @__PURE__ */ __name((input) => /^[a-z_][a-z0-9_]*$/i.test(input), "isVariable"); var isFQDN = /* @__PURE__ */ __name((input) => /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(input), "isFQDN"); var isSlug = /* @__PURE__ */ __name((input) => /^[a-z0-9]{2,}(?:-[a-z0-9]{1,})*$/i.test(input), "isSlug"); var isSemver = /* @__PURE__ */ __name((input) => /^\d+\.\d+\.\d+(-[a-z0-9-]+(\.[a-z0-9-]+)*)?$/i.test(input), "isSemver"); var isBase64URL = /* @__PURE__ */ __name((input) => /^[a-zA-Z0-9_-]+$/i.test(input), "isBase64URL"); var isMagnet = /* @__PURE__ */ __name((input) => /^magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{32,40}&dn=.+&tr=.+$/i.test(input), "isMagnet"); var isDate = /* @__PURE__ */ __name((input) => !isNaN(Date.parse(input)), "isDate"); var isTimezone = /* @__PURE__ */ __name((input) => /^([a-z]+\/[a-z_]+)$/i.test(input), "isTimezone"); var isTime = /* @__PURE__ */ __name((input) => /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$/.test(input), "isTime"); var isUTC = /* @__PURE__ */ __name((input) => !isNaN(Date.parse(input)) && input.endsWith("Z"), "isUTC"); var isYear = /* @__PURE__ */ __name((input) => /^\d{4}$/.test(input), "isYear"); var isMonth = /* @__PURE__ */ __name((input) => /^(0[1-9]|1[0-2])$/.test(input), "isMonth"); var isDay = /* @__PURE__ */ __name((input) => /^(0[1-9]|[12][0-9]|3[01])$/.test(input), "isDay"); var isHour = /* @__PURE__ */ __name((input) => /^(0[0-9]|1[0-9]|2[0-3])$/.test(input), "isHour"); var isMinuteOrSeconds = /* @__PURE__ */ __name((input) => /^[0-6][0-9]$/.test(input) && Number(input) <= 60, "isMinuteOrSeconds"); var isWeekday = /* @__PURE__ */ __name((input) => { const weekdays = [ "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday" ]; return weekdays.includes(input.toLowerCase()); }, "isWeekday"); var isBase = /* @__PURE__ */ __name((input, base) => new RegExp(`^[0-${base - 1}]+$`).test(input), "isBase"); var contains = /* @__PURE__ */ __name((input, target) => input.includes(target), "contains"); // lib/schemas/base.ts var _AkarBase = class _AkarBase { optional() { return new AkarOptionalSchema(this); } }; __name(_AkarBase, "AkarBase"); var AkarBase = _AkarBase; var _AkarOptionalSchema = class _AkarOptionalSchema extends AkarBase { constructor(schema) { super(); this.schema = schema; } parse(input) { if (input === void 0) return { value: void 0 }; return this.schema.parse(input); } }; __name(_AkarOptionalSchema, "AkarOptionalSchema"); var AkarOptionalSchema = _AkarOptionalSchema; // lib/schemas/array.ts var _AkarArray = class _AkarArray extends AkarBase { constructor(schema) { super(); this.schema = schema; this.hasRange = null; } min(min2) { this.miniumLength = min2; return this; } max(max2) { this.maximumLength = max2; return this; } range(min2, max2) { this.hasRange = [min2, max2]; return this; } unique() { this.isUnique = true; return this; } parse(input) { const errors = []; if (!array_exports.isArray(input)) { errors.push({ field: "array", reason: "Invalid type, expected array", value: input }); return { errors }; } if (this.miniumLength && !array_exports.minLength(input, this.miniumLength)) { errors.push({ field: "array", reason: `Expected at least ${this.miniumLength} items`, value: input }); } if (this.maximumLength && !array_exports.maxLength(input, this.maximumLength)) { errors.push({ field: "array", reason: `Expected at most ${this.maximumLength} items`, value: input }); } if (this.hasRange && !array_exports.rangeLength(input, ...this.hasRange)) { errors.push({ field: "array", reason: `Expected between ${this.hasRange[0]} and ${this.hasRange[1]} items`, value: input }); } if (this.isUnique && !array_exports.isUnique(input)) { errors.push({ field: "array", reason: "Expected unique items", value: input }); } const result = []; input.forEach((item, index) => { const parsed = this.schema.parse(item); if (parsed.errors) { parsed.errors.forEach((error) => { errors.push({ field: `${index}`, reason: error.reason, value: error.value }); }); } else { result.push(parsed.value); } }); return errors.length > 0 ? { errors } : { value: result }; } }; __name(_AkarArray, "AkarArray"); var AkarArray = _AkarArray; // lib/schemas/boolean.ts var _AkarBoolean = class _AkarBoolean extends AkarBase { constructor() { super(...arguments); this.exactValue = null; } exact(value) { this.exactValue = value; return this; } parse(input) { const errors = []; if (typeof input !== "boolean") { errors.push({ field: "boolean", reason: "Invalid type, expected boolean", value: input }); } if (this.exactValue !== null && input !== this.exactValue) { errors.push({ field: "boolean", reason: `Value must be ${this.exactValue}`, value: input }); } if (errors.length > 0) { return { errors }; } return { value: input }; } }; __name(_AkarBoolean, "AkarBoolean"); var AkarBoolean = _AkarBoolean; // lib/schemas/enum.ts var _AkarEnum = class _AkarEnum extends AkarBase { constructor(values, defaultValue) { super(); this.values = values; this.defaultValue = defaultValue; } default(value) { this.defaultValue = value; return this; } parse(input) { if (input === void 0 && this.defaultValue !== void 0) { return { value: this.defaultValue }; } const errors = []; if (this.defaultValue === void 0 && !this.optional) { errors.push({ field: "enum", reason: `Required value, no default value provided nor marked as optional`, value: input }); } if (!enum_exports.isEnum(input, this.values)) { errors.push({ field: "enum", reason: `Value must be one of [${this.values.join(", ")}]`, value: input }); } if (this.isNative && !enum_exports.isNativeEnum(input, this.values)) { errors.push({ field: "enum", reason: `Value must be one of [${this.values.join(", ")}]`, value: input }); } if (typeof input !== "string") { errors.push({ field: "enum", reason: `Invalid type, expected string`, value: input }); } if (errors.length > 0) { return { errors }; } return { value: input }; } }; __name(_AkarEnum, "AkarEnum"); var AkarEnum = _AkarEnum; // lib/schemas/number.ts var _AkarNumber = class _AkarNumber extends AkarBase { constructor() { super(...arguments); this.minValue = null; this.maxValue = null; this.integerOnly = false; this.floatOnly = false; this.positiveOnly = false; this.negativeOnly = false; this.oddOnly = false; this.evenOnly = false; this.divisibleByOnly = null; this.portOnly = false; this.binaryOnly = false; this.octalOnly = false; this.hexOnly = false; this.rangeOnly = null; this.primeOnly = false; this.perfectOnly = false; } min(value) { this.minValue = value; return this; } max(value) { this.maxValue = value; return this; } integer() { this.integerOnly = true; return this; } float() { this.floatOnly = true; return this; } unsigned() { this.positiveOnly = true; return this; } signed() { this.negativeOnly = true; return this; } odd() { this.oddOnly = true; return this; } even() { this.evenOnly = true; return this; } divisibleBy(value) { this.divisibleByOnly = value; return this; } port() { this.portOnly = true; return this; } binary() { this.binaryOnly = true; return this; } octal() { this.octalOnly = true; return this; } hex() { this.hexOnly = true; return this; } range(numbers) { this.rangeOnly = [...numbers]; return this; } prime() { this.primeOnly = true; return this; } perfect() { this.perfectOnly = true; return this; } parse(input) { const errors = []; if (!number_exports.isNumber(input) && !this.binaryOnly && !this.octalOnly && !this.hexOnly) { errors.push({ field: "number", reason: "Invalid type, expected number", value: input }); } if (this.minValue !== null && !number_exports.min(input, this.minValue)) { errors.push({ field: "number", reason: `Number is too small. Minimum value is ${this.minValue}`, value: input }); } if (this.maxValue !== null && !number_exports.max(input, this.maxValue)) { errors.push({ field: "number", reason: `Number is too large. Maximum value is ${this.maxValue}`, value: input }); } if (this.floatOnly && !number_exports.isFloat(input)) { errors.push({ field: "number", reason: "Number is not a float", value: input }); } if (this.integerOnly && !number_exports.isInteger(input)) { errors.push({ field: "number", reason: "Number is not an integer", value: input }); } if (this.positiveOnly && !number_exports.isPositive(input)) { errors.push({ field: "number", reason: "Number is not positive", value: input }); } if (this.negativeOnly && !number_exports.isNegative(input)) { errors.push({ field: "number", reason: "Number is not negative", value: input }); } if (this.oddOnly && !number_exports.isOdd(input)) { errors.push({ field: "number", reason: "Number is not odd", value: input }); } if (this.evenOnly && !number_exports.isEven(input)) { errors.push({ field: "number", reason: "Number is not even", value: input }); } if (this.divisibleByOnly !== null && !number_exports.isDivisible(input, this.divisibleByOnly)) { errors.push({ field: "number", reason: `Number is not divisible by ${this.divisibleByOnly}`, value: input }); } if (this.portOnly && !number_exports.isPort(input)) { errors.push({ field: "number", reason: "Number is not a valid port number (0-65535)", value: input }); } if (this.binaryOnly && !number_exports.isBinary(input)) { errors.push({ field: "number", reason: "Number is not a binary number", value: input }); } if (this.octalOnly && !number_exports.isOctal(input)) { errors.push({ field: "number", reason: "Number is not an octal number", value: input }); } if (this.hexOnly && !number_exports.isHex(input)) { errors.push({ field: "number", reason: "Number is not a hexadecimal number", value: input }); } if (this.rangeOnly && !number_exports.range(input, this.rangeOnly[0], this.rangeOnly[1])) { errors.push({ field: "number", reason: "Number is not within the range", value: input }); } if (this.primeOnly && !number_exports.isPrime(input)) { errors.push({ field: "number", reason: "Number is not a prime number", value: input }); } if (this.perfectOnly && !number_exports.isPerfect(input)) { errors.push({ field: "number", reason: "Number is not a perfect number", value: input }); } return errors.length > 0 ? { errors } : { value: input }; } }; __name(_AkarNumber, "AkarNumber"); var AkarNumber = _AkarNumber; // lib/schemas/object.ts var _AkarObject = class _AkarObject extends AkarBase { constructor(shape, defaults = {}) { super(); this.isJson = false; this.compare = null; this.isEqual = false; this.isDeepEqual = false; this.isShallowEqual = false; this.shape = shape; this.defaults = defaults; } equalTo(compare) { this.isEqual = true; this.compare = compare; return this; } deepEqualTo(compare) { this.isDeepEqual = true; this.compare = compare; return this; } shallowEqualTo(compare) { this.isShallowEqual = true; this.compare = compare; return this; } jsonObject() { this.isJson = true; return this; } parse(input) { const errors = []; const result = {}; if (!isObject(input) || input === null || isArray(input)) { errors.push({ field: "object", reason: "Invalid type, expected object", value: input }); return { errors }; } if (this.isJson && !object_exports.isJSON(JSON.stringify(input))) { errors.push({ field: "object", reason: "Invalid JSON object", value: input }); } if (this.isEqual && !object_exports.isEqual(input, this.compare)) { errors.push({ field: "object", reason: `Object must be equal to ${JSON.stringify(this.compare)}`, value: input }); } if (this.isDeepEqual && !object_exports.isDeepEqual(input, this.compare)) { errors.push({ field: "object", reason: `Object must be deeply equal!`, value: input }); } if (this.isShallowEqual && !object_exports.isShallowEqual(input, this.compare)) { errors.push({ field: "object", reason: `Object must be shallowly equal!`, value: input }); } for (const key in this.shape) { const schema = this.shape[key]; const parsed = schema.parse( input[key] !== void 0 ? input[key] : this.defaults[key] ); if (parsed.errors) { parsed.errors.forEach((error) => { errors.push({ field: key, reason: error.reason, value: error.value }); }); } else { result[key] = parsed.value; } } return errors.length > 0 ? { errors } : { value: result }; } }; __name(_AkarObject, "AkarObject"); var AkarObject = _AkarObject; // lib/schemas/string.ts var _AkarString = class _AkarString extends AkarBase { constructor() { super(...arguments); this.minLength = null; this.maxLength = null; this.phoneOptions = null; this.isPattern = null; this.isEmail = false; this.isUrl = false; this.isAlpha = false; this.isAlphaNumeric = false; this.isNumeric = false; this.isLowercase = false; this.isUppercase = false; this.isPhone = false; this.isHex = false; this.isBase64 = false; this.isBase64Url = false; this.isIp = false; this.isIpv4 = false; this.isIpv6 = false; this.isUuid = false; this.isMongoId = false; this.isGuid = false; this.isCuid = false; this.isJson = false; this.isMac = false; this.isCreditCard = false; this.isCountry = false; this.isPostalCode = false; this.isPassport = false; this.isPassword = null; this.isCurrency = false; this.isDataUri = false; this.isMimeType = false; this.isLatLong = false; this.isSemVer = false; this.isMD5 = false; this.isSHA1 = false; this.isSHA256 = false; this.isSHA512 = false; this.isJWT = false; this.isIBAN = false; this.isBIC = false; this.isISIN = false; this.isHexColor = false; this.isRgbColor = false; this.isHslColor = false; this.isLocale = false; this.isOtp = false; this.isSlug = false; this.isFqdn = false; this.isVariableName = false; this.isDate = false; this.isTime = false; this.isHour = false; this.isMinuteOrSeconds = false; this.isTimezone = false; this.isWeekDay = false; this.isBase = null; this.isContains = null; this.isMagnetUri = false; } min(length3) { this.minLength = length3; return this; } max(length3) { this.maxLength = length3; return this; } pattern(regex) { this.isPattern = regex; return this; } email() { this.isEmail = true; return this; } url() { this.isUrl = true; return this; } alpha() { this.isAlpha = true; return this; } alphaNumeric() { this.isAlphaNumeric = true; return this; } numeric() { this.isNumeric = true; return this; } lowercase() { this.isLowercase = true; return this; } uppercase() { this.isUppercase = true; return this; } phone(options) { this.isPhone = true; this.phoneOptions = options; return this; } hex() { this.isHex = true; return this; } base64() { this.isBase64 = true; return this; } base64Url() { this.isBase64Url = true; return this; } ip() { this.isIp = true; return this; } ipv4() { this.isIpv4 = true; return this; } ipv6() { this.isIpv6 = true; return this; } uuid() { this.isUuid = true; return this; } mongoId() { this.isMongoId = true; return this; } guid() { this.isGuid = true; return this; } cuid() { this.isCuid = true; return this; } json() { this.isJson = true; return this; } mac() { this.isMac = true; return this; } creditCard() { this.isCreditCard = true; return this; } country() { this.isCountry = true; return this; } postalCode() { this.isPostalCode = true; return this; } passport() { this.isPassport = true; return this; } password(options) { this.isPassword = options; return this; } currency() { this.isCurrency = true; return this; } dataUri() { this.isDataUri = true; return this; } mimeType() { this.isMimeType = true; return this; } latLong() { this.isLatLong = true; return this; } semVer() { this.isSemVer = true; return this; } md5() { this.isMD5 = true; return this; } sha1() { this.isSHA1 = true; return this; } sha256() { this.isSHA256 = true; return this; } sha512() { this.isSHA512 = true; return this; } jwt() { this.isJWT = true; return this; } iban() { this.isIBAN = true; return this; } bic() { this.isBIC = true; return this; } isin() { this.isISIN = true; return this; } hexColor() { this.isHexColor = true; return this; } rgbColor() { this.isRgbColor = true; return this; } hslColor() { this.isHslColor = true; return this; } locale() { this.isLocale = true; return this; } otp() { this.isOtp = true; return this; } slug() { this.isSlug = true; return this; } fqdn() { this.isFqdn = true; return this; } variableName() { this.isVariableName = true; return this; } date() { this.isDate = true; return this; } time() { this.isTime = true; return this; } hour() { this.isHour = true; return this; } minuteOrSeconds() { this.isMinuteOrSeconds = true; return this; } timezone() { this.isTimezone = true; return this; } weekDay() { this.isWeekDay = true; return this; } base(b) { this.isBase = b; return this; } contains(str) { this.isContains = str; return this; } magnetUri() { this.isMagnetUri = true; return this; } /*--- Parser ---*/ parse(input) { const errors = []; if (!isString(input)) { errors.push({ field: "string", reason: "Invalid type, expected string", value: input }); return { errors }; } if (this.minLength !== null && input.length < this.minLength) { errors.push({ field: "string", reason: `String is too short. Minimum length is ${this.minLength}`, value: input }); } if (this.maxLength !== null && input.length > this.maxLength) { errors.push({ field: "string", reason: `String is too long. Maximum length is ${this.maxLength}`, value: input }); } if (this.isPattern !== null && !this.isPattern.test(input)) { errors.push({ field: "string", reason: "String does not match the pattern", value: input }); } if (this.isEmail && !string_exports.isEmail(input)) { errors.push({ field: "string", reason: "Invalid email", value: input }); } if (this.isUrl && !string_exports.isURL(input)) { errors.push({ field: "string", reason: "Invalid URL", value: input }); } if (this.isAlpha && !string_exports.isAlpha(input)) { errors.push({ field: "string", reason: "String must contain only letters", value: input }); } if (this.isAlphaNumeric && !string_exports.isAlphanumeric(input)) { errors.push({ field: "string", reason: "String must contain only letters and numbers", value: input }); } if (this.isNumeric && !string_exports.isNumeric(input)) { errors.push({ field: "string", reason: "String must contain only numbers", value: input }); } if (this.isLowercase && !string_exports.isLowercase(input)) { errors.push({ field: "string", reason: "String must contain only lowercase letters", value: input }); } if (this.isUppercase && !string_exports.isUppercase(input)) { errors.push({ field: "string", reason: "String must contain only uppercase letters", value: input }); } if (this.isPhone && !string_exports.isPhone(input, this.phoneOptions)) { errors.push({ field: "string", reason: "Invalid phone number", value: input }); } if (this.isHex && !string_exports.isHex(input)) { errors.push({ field: "string", reason: "Invalid hex", value: input }); } if (this.isBase64 && !string_exports.isBase64(input)) { errors.push({ field: "string", reason: "Invalid base64", value: input }); } if (this.isBase64Url && !string_exports.isBase64URL(input)) { errors.push({ field: "string", reason: "Invalid base64 URL", value: input }); } if (this.isIp && (!string_exports.isIP(input) || !string_exports.isIPv6(input))) { errors.push({ field: "string", reason: "Invalid IP", value: input }); } if (this.isIpv4 && !string_exports.isIP(input)) { errors.push({ field: "string", reason: "Invalid IPv4" }); } if (this.isIpv6 && !string_exports.isIPv6(input)) { errors.push({ field: "string", reason: "Invalid IPv6" }); } if (this.isUuid && !string_exports.isUUID(input)) { errors.push({ field: "string", reason: "Invalid UUID" }); } if (this.isMongoId && !string_exports.isMongoID(input)) { errors.push({ field: "string", reason: "Invalid Mongo ID" }); } if (this.isGuid && !string_exports.isGUID(input)) { errors.push({ field: "string", reason: "Invalid GUID" }); } if (this.isCuid && !string_exports.isCUID(input)) { errors.push({ field: "string", reason: "Invalid CUID" }); } if (this.isJson && !string_exports.isJSON(input)) { errors.push({ field: "string", reason: "Invalid JSON" }); } if (this.isMac && !string_exports.isMAC(input)) { errors.push({ field: "string", reason: "Invalid MAC address" }); } if (this.isCreditCard && !string_exports.isCreditCard(input)) { errors.push({ field: "string", reason: "Invalid credit card number" }); } if (this.isCountry && !string_exports.isCountry(input)) { errors.push({ field: "string", reason: "Invalid country" }); } if (this.isPostalCode && !string_exports.isPostalCode(input)) { errors.push({ field: "string", reason: "Invalid postal code" }); } if (this.isPassport && !string_exports.isPassport(input)) { errors.push({ field: "string", reason: "Invalid passport number" }); } if (this.isPassword !== null && !string_exports.isPassword(input, this.isPassword)) { errors.push({ field: "string", reason: "Invalid password" }); } if (this.isCurrency && !string_exports.isCurrency(input)) { errors.push({ field: "string", reason: "Invalid currency" }); } if (this.isDataUri && !string_exports.isDataURI(input)) { errors.push({ field: "string", reason: "Invalid data URI" }); } if (this.isMimeType && !string_exports.isMIME(input)) { errors.push({ field: "string", reason: "Invalid MIME type" }); } if (this.isLatLong && !string_exports.isLatLng(input)) { errors.push({ field: "string", reason: "Invalid latitude or longitude" }); } if (this.isSemVer && !string_exports.isSemVer(input)) { errors.push({ field: "string", reason: "Invalid semantic version" }); } if (this.isMD5 && !string_exports.isMD5(input)) { errors.push({ field: "string", reason: "Invalid MD5 hash" }); } if (this.isSHA1 && !string_exports.isSHA1(input)) { errors.push({ field: "string", reason: "Invalid SHA1 hash" }); } if (this.isSHA256 && !string_exports.isSHA256(input)) { errors.push({ field: "string", reason: "Invalid SHA256 hash" }); } if (this.isSHA512 && !string_exports.isSHA512(input)) { errors.push({ field: "string", reason: "Invalid SHA512 hash" }); } if (this.isJWT && !string_exports.isJWT(input)) { errors.push({ field: "string", reason: "Invalid JWT", value: input }); } if (this.isIBAN && !string_exports.isIBAN(input)) { errors.push({ field: "string", reason: "Invalid IBAN" }); } if (this.isBIC && !string_exports.isBIC(input)) { errors.push({ field: "string", reason: "Invalid BIC" }); } if (this.isISIN && !string_exports.isISIN(input)) { errors.push({ field: "string", reason: "Invalid ISIN" }); } if (this.isHexColor && !string_exports.isHex(input)) { errors.push({ field: "string", reason: "Invalid hex color" }); } if (this.isRgbColor && !string_exports.isRGB(input)) { errors.push({ field: "string", reason: "Invalid RGB color" }); } if (this.isHslColor && !string_exports.isHSL(input)) { errors.push({ field: "string", reason: "Invalid HSL color" }); } if (this.isLocale && !string_exports.isLocale(input)) { errors.push({ field: "string", reason: "Invalid locale" }); } if (this.isOtp && !string_exports.isOTP(input)) { errors.push({ field: "string", reason: "Invalid OTP" }); } if (this.isSlug && !string_exports.isSlug(input)) { errors.push({ field: "string", reason: "Invalid slug" }); } if (this.isFqdn && !string_exports.isFQDN(input)) { errors.push({ field: "string", reason: "Invalid FQDN" }); } if (this.isVariableName && !string_exports.isVariable(input)) { errors.push({ field: "string", reason: "Invalid variable name" }); } if (this.isDate && !string_exports.isDate(input)) { errors.push({ field: "string", reason: "Invalid date" }); } if (this.isTime && !string_exports.isTime(input)) { errors.push({ field: "string", reason: "Invalid time" }); } if (this.isHour && !string_exports.isHour(input)) { errors.push({ field: "string", reason: "Invalid hour" }); } if (this.isMinuteOrSeconds && !string_exports.isMinuteOrSeconds(input)) { errors.push({ field: "string", reason: "Invalid minute or seconds" }); } if (this.isTimezone && !string_exports.isTimezone(input)) { errors.push({ field: "string", reason: "Invalid timezone" }); } if (this.isWeekDay && !string_exports.isWeekday(input)) { errors.push({ field: "string", reason: "Invalid week day" }); } if (this.isBase && !string_exports.isBase(input, this.isBase)) { errors.push({ field: "string", reason: "Invalid base" }); } if (this.isContains && !string_exports.contains(input, this.isContains)) { errors.push({ field: "string", reason: "Invalid contains" }); } if (this.isMagnetUri && !string_exports.isMagnet(input)) { errors.push({ field: "string", reason: "Invalid magnet URI" }); } return errors.length > 0 ? { errors } : { value: input }; } }; __name(_AkarString, "AkarString"); var AkarString = _AkarString; // lib/index.ts var a = { string: /* @__PURE__ */ __name(() => new AkarString(), "string"), number: /* @__PURE__ */ __name(() => new AkarNumber(), "number"), boolean: /* @__PURE__ */ __name(() => new AkarBoolean(), "boolean"), object: /* @__PURE__ */ __name((shape) => new AkarObject(shape), "object"), array: /* @__PURE__ */ __name((schema) => new AkarArray(schema), "array"), enum: /* @__PURE__ */ __name((values) => new AkarEnum(values), "enum") }; var Akar = { ...a }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { a }); /** * Akar.js * (c) 2024, @mahabubx7 * Array validators * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Enum validators * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Number validators * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Object validators * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Country list with code and phone code * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * String validators * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Base schema * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Array schema * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Boolean schema * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Enum schema * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Number schema * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Object schema * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * String schema * @since 1.0.0-beta * @license MIT */ /** * Akar.js * (c) 2024, @mahabubx7 * Main module entry point * @since 1.0.0-beta * @license MIT */