Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1 2//#region src/storages/globalConfig/globalConfig.ts3let store$4;4const DEFAULT_CONFIG = {5 lang: void 0,6 message: void 0,7 abortEarly: void 0,8 abortPipeEarly: void 09};10/**11* Sets the global configuration.12*13* @param config The configuration.14*/15function setGlobalConfig(config$1) {16 store$4 = {17 ...store$4,18 ...config$119 };20}21/**22* Returns the global configuration.23*24* @param config The config to merge.25*26* @returns The configuration.27*/28/* @__NO_SIDE_EFFECTS__ */29function getGlobalConfig(config$1) {30 if (!config$1 && !store$4) return DEFAULT_CONFIG;31 return {32 lang: config$1?.lang ?? store$4?.lang,33 message: config$1?.message,34 abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,35 abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly36 };37}38/**39* Deletes the global configuration.40*/41function deleteGlobalConfig() {42 store$4 = void 0;43}44 45//#endregion46//#region src/storages/globalMessage/globalMessage.ts47let store$3;48/**49* Sets a global error message.50*51* @param message The error message.52* @param lang The language of the message.53*/54function setGlobalMessage(message$1, lang) {55 if (!store$3) store$3 = /* @__PURE__ */ new Map();56 store$3.set(lang, message$1);57}58/**59* Returns a global error message.60*61* @param lang The language of the message.62*63* @returns The error message.64*/65/* @__NO_SIDE_EFFECTS__ */66function getGlobalMessage(lang) {67 return store$3?.get(lang);68}69/**70* Deletes a global error message.71*72* @param lang The language of the message.73*/74function deleteGlobalMessage(lang) {75 store$3?.delete(lang);76}77 78//#endregion79//#region src/storages/schemaMessage/schemaMessage.ts80let store$2;81/**82* Sets a schema error message.83*84* @param message The error message.85* @param lang The language of the message.86*/87function setSchemaMessage(message$1, lang) {88 if (!store$2) store$2 = /* @__PURE__ */ new Map();89 store$2.set(lang, message$1);90}91/**92* Returns a schema error message.93*94* @param lang The language of the message.95*96* @returns The error message.97*/98/* @__NO_SIDE_EFFECTS__ */99function getSchemaMessage(lang) {100 return store$2?.get(lang);101}102/**103* Deletes a schema error message.104*105* @param lang The language of the message.106*/107function deleteSchemaMessage(lang) {108 store$2?.delete(lang);109}110 111//#endregion112//#region src/storages/specificMessage/specificMessage.ts113let store$1;114/**115* Sets a specific error message.116*117* @param reference The identifier reference.118* @param message The error message.119* @param lang The language of the message.120*/121function setSpecificMessage(reference, message$1, lang) {122 if (!store$1) store$1 = /* @__PURE__ */ new Map();123 if (!store$1.get(reference)) store$1.set(reference, /* @__PURE__ */ new Map());124 store$1.get(reference).set(lang, message$1);125}126/**127* Returns a specific error message.128*129* @param reference The identifier reference.130* @param lang The language of the message.131*132* @returns The error message.133*/134/* @__NO_SIDE_EFFECTS__ */135function getSpecificMessage(reference, lang) {136 return store$1?.get(reference)?.get(lang);137}138/**139* Deletes a specific error message.140*141* @param reference The identifier reference.142* @param lang The language of the message.143*/144function deleteSpecificMessage(reference, lang) {145 store$1?.get(reference)?.delete(lang);146}147 148//#endregion149//#region src/utils/_stringify/_stringify.ts150/**151* Stringifies an unknown input to a literal or type string.152*153* @param input The unknown input.154*155* @returns A literal or type string.156*157* @internal158*/159/* @__NO_SIDE_EFFECTS__ */160function _stringify(input) {161 const type = typeof input;162 if (type === "string") return `"${input}"`;163 if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;164 if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";165 return type;166}167 168//#endregion169//#region src/utils/_addIssue/_addIssue.ts170/**171* Adds an issue to the dataset.172*173* @param context The issue context.174* @param label The issue label.175* @param dataset The input dataset.176* @param config The configuration.177* @param other The optional props.178*179* @internal180*/181function _addIssue(context, label, dataset, config$1, other) {182 const input = other && "input" in other ? other.input : dataset.value;183 const expected = other?.expected ?? context.expects ?? null;184 const received = other?.received ?? /* @__PURE__ */ _stringify(input);185 const issue = {186 kind: context.kind,187 type: context.type,188 input,189 expected,190 received,191 message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,192 requirement: context.requirement,193 path: other?.path,194 issues: other?.issues,195 lang: config$1.lang,196 abortEarly: config$1.abortEarly,197 abortPipeEarly: config$1.abortPipeEarly198 };199 const isSchema = context.kind === "schema";200 const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);201 if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;202 if (isSchema) dataset.typed = false;203 if (dataset.issues) dataset.issues.push(issue);204 else dataset.issues = [issue];205}206 207//#endregion208//#region src/utils/_cloneDataset/_cloneDataset.ts209/**210* Creates a shallow copy of a dataset.211*212* Hint: The `value` is copied by reference, but the `issues` array is cloned213* to avoid reusing mutable dataset state across multiple runs. Mutating a214* returned object or array value can therefore affect later cache hits that215* reuse the same cached output.216*217* @param dataset The output dataset.218*219* @returns The copied output dataset.220*/221/* @__NO_SIDE_EFFECTS__ */222function _cloneDataset(dataset) {223 return {224 typed: dataset.typed,225 value: dataset.value,226 issues: dataset.issues && [...dataset.issues]227 };228}229 230//#endregion231//#region src/utils/_formatCase/_formatCase.ts232/**233* Splits a string into lowercase words and rejoins them with the given234* separator and capitalization rules.235*236* Words are separated by `_`, `-` and ASCII whitespace, as well as by case237* and acronym boundaries. Whether the first or subsequent words are238* capitalized is controlled by `capFirst` and `capRest`.239*240* Hint: Implemented in a single pass that emits directly to the result241* string to avoid an intermediate `string[]` allocation. ASCII chars are242* classified via char codes to skip `.toLowerCase()` and `.toUpperCase()`243* method calls in the common case.244*245* Hint: Digits are treated as a separate character class, so `item2Name`246* yields `item2` and `name` rather than `item`, `2` and `name`.247*248* @param input The input string.249* @param separator The string inserted between words.250* @param capFirst Whether to capitalize the first word.251* @param capRest Whether to capitalize subsequent words.252*253* @returns The formatted string.254*255* @internal256*/257/* @__NO_SIDE_EFFECTS__ */258function _formatCase(input, separator, capFirst, capRest) {259 let result = "";260 let firstWord = true;261 let start = 0;262 let prev = 0;263 let prevPrev = 0;264 const flush = (end) => {265 if (end > start) {266 let word = input.slice(start, end).toLowerCase();267 if (firstWord ? capFirst : capRest) {268 const firstCode = word.charCodeAt(0);269 if (firstCode >= 97 && firstCode <= 122) word = String.fromCharCode(firstCode - 32) + word.slice(1);270 else {271 const charLen = firstCode >= 55296 && firstCode <= 56319 ? 2 : 1;272 word = word.slice(0, charLen).toUpperCase() + word.slice(charLen);273 }274 }275 result += firstWord ? word : separator + word;276 firstWord = false;277 }278 };279 for (let index = 0; index < input.length; index++) {280 const code = input.charCodeAt(index);281 let type;282 if (code === 32 || code === 9 || code === 10 || code === 11 || code === 12 || code === 13 || code === 45 || code === 95) {283 flush(index);284 start = index + 1;285 type = 0;286 } else if (code < 128) type = code >= 65 && code <= 90 ? 1 : code >= 97 && code <= 122 ? 2 : 3;287 else {288 const char = input[index];289 const charLower = char.toLowerCase();290 type = charLower === char.toUpperCase() ? 3 : char === charLower ? 2 : 1;291 }292 if (type === 1 && (prev === 2 || prev === 3) && index > start) {293 flush(index);294 start = index;295 } else if (type === 2 && prev === 1 && prevPrev === 1 && index - 1 > start) {296 flush(index - 1);297 start = index - 1;298 }299 prevPrev = prev;300 prev = type;301 }302 flush(input.length);303 return result;304}305 306//#endregion307//#region src/utils/_getByteCount/_getByteCount.ts308let textEncoder;309/**310* Returns the byte count of the input.311*312* @param input The input to be measured.313*314* @returns The byte count.315*316* @internal317*/318/* @__NO_SIDE_EFFECTS__ */319function _getByteCount(input) {320 if (!textEncoder) textEncoder = new TextEncoder();321 return textEncoder.encode(input).length;322}323 324//#endregion325//#region src/utils/_getGraphemeCount/_getGraphemeCount.ts326let segmenter;327/**328* Returns the grapheme count of the input.329*330* @param input The input to be measured.331*332* @returns The grapheme count.333*334* @internal335*/336/* @__NO_SIDE_EFFECTS__ */337function _getGraphemeCount(input) {338 if (!segmenter) segmenter = new Intl.Segmenter();339 const segments = segmenter.segment(input);340 let count = 0;341 for (const _ of segments) count++;342 return count;343}344 345//#endregion346//#region src/utils/_getLastMetadata/_getLastMetadata.ts347/**348* Returns the last top-level value of a given metadata type from a schema349* using a breadth-first search that starts with the last item in the pipeline.350*351* @param schema The schema to search.352* @param type The metadata type.353*354* @returns The value, if any.355*356* @internal357*/358/* @__NO_SIDE_EFFECTS__ */359function _getLastMetadata(schema, type) {360 if ("pipe" in schema) {361 const nestedSchemas = [];362 for (let index = schema.pipe.length - 1; index >= 0; index--) {363 const item = schema.pipe[index];364 if (item.kind === "schema" && "pipe" in item) nestedSchemas.push(item);365 else if (item.kind === "metadata" && item.type === type) return item[type];366 }367 for (const nestedSchema of nestedSchemas) {368 const result = /* @__PURE__ */ _getLastMetadata(nestedSchema, type);369 if (result !== void 0) return result;370 }371 }372}373 374//#endregion375//#region src/utils/_getStandardProps/_getStandardProps.ts376const _standardCache = /* @__PURE__ */ new WeakMap();377/**378* Returns the Standard Schema properties.379*380* @param context The schema context.381*382* @returns The Standard Schema properties.383*/384/* @__NO_SIDE_EFFECTS__ */385function _getStandardProps(context) {386 let cached = _standardCache.get(context);387 if (!cached) {388 cached = {389 version: 1,390 vendor: "valibot",391 validate(value$1) {392 return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());393 }394 };395 _standardCache.set(context, cached);396 }397 return cached;398}399 400//#endregion401//#region src/utils/_getWordCount/_getWordCount.ts402let store;403/**404* Returns the word count of the input.405*406* @param locales The locales to be used.407* @param input The input to be measured.408*409* @returns The word count.410*411* @internal412*/413/* @__NO_SIDE_EFFECTS__ */414function _getWordCount(locales, input) {415 if (!store) store = /* @__PURE__ */ new Map();416 const key = String(locales);417 let segmenter$1 = store.get(key);418 if (!segmenter$1) {419 segmenter$1 = new Intl.Segmenter(locales, { granularity: "word" });420 store.set(key, segmenter$1);421 }422 const segments = segmenter$1.segment(input);423 let count = 0;424 for (const segment of segments) if (segment.isWordLike) count++;425 return count;426}427 428//#endregion429//#region src/utils/_isLuhnAlgo/_isLuhnAlgo.ts430/**431* Non-digit regex.432*/433const NON_DIGIT_REGEX = /\D/gu;434/**435* Checks whether a string with numbers corresponds to the luhn algorithm.436*437* @param input The input to be checked.438*439* @returns Whether input is valid.440*441* @internal442*/443/* @__NO_SIDE_EFFECTS__ */444function _isLuhnAlgo(input) {445 const number$1 = input.replace(NON_DIGIT_REGEX, "");446 let length$1 = number$1.length;447 let bit = 1;448 let sum = 0;449 while (length$1) {450 const value$1 = +number$1[--length$1];451 bit ^= 1;452 sum += bit ? [453 0,454 2,455 4,456 6,457 8,458 1,459 3,460 5,461 7,462 9463 ][value$1] : value$1;464 }465 return sum % 10 === 0;466}467 468//#endregion469//#region src/utils/_isValidObjectKey/_isValidObjectKey.ts470/**471* Disallows inherited object properties and prevents object prototype472* pollution by disallowing certain keys.473*474* @param object The object to check.475* @param key The key to check.476*477* @returns Whether the key is allowed.478*479* @internal480*/481/* @__NO_SIDE_EFFECTS__ */482function _isValidObjectKey(object$1, key) {483 return Object.prototype.hasOwnProperty.call(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";484}485 486//#endregion487//#region src/utils/_joinExpects/_joinExpects.ts488/**489* Joins multiple `expects` values with the given separator.490*491* @param values The `expects` values.492* @param separator The separator.493*494* @returns The joined `expects` property.495*496* @internal497*/498/* @__NO_SIDE_EFFECTS__ */499function _joinExpects(values$1, separator) {500 const list = [...new Set(values$1)];501 if (list.length > 1) return `(${list.join(` ${separator} `)})`;502 return list[0] ?? "never";503}504 505//#endregion506//#region src/utils/entriesFromList/entriesFromList.ts507/**508* Creates an object entries definition from a list of keys and a schema.509*510* @param list A list of keys.511* @param schema The schema of the keys.512*513* @returns The object entries.514*/515/* @__NO_SIDE_EFFECTS__ */516function entriesFromList(list, schema) {517 const entries$1 = {};518 for (const key of list) entries$1[key] = schema;519 return entries$1;520}521 522//#endregion523//#region src/utils/entriesFromObjects/entriesFromObjects.ts524/* @__NO_SIDE_EFFECTS__ */525function entriesFromObjects(schemas) {526 const entries$1 = {};527 for (const schema of schemas) Object.assign(entries$1, schema.entries);528 return entries$1;529}530 531//#endregion532//#region src/utils/getDotPath/getDotPath.ts533/* @__NO_SIDE_EFFECTS__ */534function getDotPath(issue) {535 if (issue.path) {536 let key = "";537 for (const item of issue.path) if (typeof item.key === "string" || typeof item.key === "number") if (key) key += `.${item.key}`;538 else key += item.key;539 else return null;540 return key;541 }542 return null;543}544 545//#endregion546//#region src/utils/isOfKind/isOfKind.ts547/**548* A generic type guard to check the kind of an object.549*550* @param kind The kind to check for.551* @param object The object to check.552*553* @returns Whether it matches.554*/555/* @__NO_SIDE_EFFECTS__ */556function isOfKind(kind, object$1) {557 return object$1.kind === kind;558}559 560//#endregion561//#region src/utils/isOfType/isOfType.ts562/**563* A generic type guard to check the type of an object.564*565* @param type The type to check for.566* @param object The object to check.567*568* @returns Whether it matches.569*/570/* @__NO_SIDE_EFFECTS__ */571function isOfType(type, object$1) {572 return object$1.type === type;573}574 575//#endregion576//#region src/utils/isValiError/isValiError.ts577/**578* A type guard to check if an error is a ValiError.579*580* @param error The error to check.581*582* @returns Whether its a ValiError.583*/584/* @__NO_SIDE_EFFECTS__ */585function isValiError(error) {586 return error instanceof ValiError;587}588 589//#endregion590//#region src/utils/ValiError/ValiError.ts591/**592* A Valibot error with useful information.593*/594var ValiError = class extends Error {595 /**596 * Creates a Valibot error with useful information.597 *598 * @param issues The error issues.599 */600 constructor(issues) {601 super(issues[0].message);602 this.name = "ValiError";603 this.issues = issues;604 }605};606 607//#endregion608//#region src/actions/args/args.ts609/* @__NO_SIDE_EFFECTS__ */610function args(schema) {611 return {612 kind: "transformation",613 type: "args",614 reference: args,615 async: false,616 schema,617 "~run"(dataset, config$1) {618 const func = dataset.value;619 dataset.value = (...args_) => {620 const argsDataset = this.schema["~run"]({ value: args_ }, config$1);621 if (argsDataset.issues) throw new ValiError(argsDataset.issues);622 return func(...argsDataset.value);623 };624 return dataset;625 }626 };627}628 629//#endregion630//#region src/actions/args/argsAsync.ts631/* @__NO_SIDE_EFFECTS__ */632function argsAsync(schema) {633 return {634 kind: "transformation",635 type: "args",636 reference: argsAsync,637 async: false,638 schema,639 "~run"(dataset, config$1) {640 const func = dataset.value;641 dataset.value = async (...args$1) => {642 const argsDataset = await schema["~run"]({ value: args$1 }, config$1);643 if (argsDataset.issues) throw new ValiError(argsDataset.issues);644 return func(...argsDataset.value);645 };646 return dataset;647 }648 };649}650 651//#endregion652//#region src/actions/await/awaitAsync.ts653/**654* Creates an await transformation action.655*656* @returns An await action.657*/658/* @__NO_SIDE_EFFECTS__ */659function awaitAsync() {660 return {661 kind: "transformation",662 type: "await",663 reference: awaitAsync,664 async: true,665 async "~run"(dataset) {666 dataset.value = await dataset.value;667 return dataset;668 }669 };670}671 672//#endregion673//#region src/regex.ts674/**675* [Base64](https://en.wikipedia.org/wiki/Base64) regex.676*/677const BASE64_REGEX = /^(?:[\da-z+/]{4})*(?:[\da-z+/]{2}==|[\da-z+/]{3}=)?$/iu;678/**679* [BIC](https://en.wikipedia.org/wiki/ISO_9362) regex.680*/681const BIC_REGEX = /^[A-Z]{6}(?!00)[\dA-Z]{2}(?:[\dA-Z]{3})?$/u;682/**683* [Cuid2](https://github.com/paralleldrive/cuid2) regex.684*/685const CUID2_REGEX = /^[a-z][\da-z]*$/u;686/**687* [Decimal](https://en.wikipedia.org/wiki/Decimal) regex.688*/689const DECIMAL_REGEX = /^[+-]?(?:\d*\.)?\d+$/u;690/**691* [Digits](https://en.wikipedia.org/wiki/Numerical_digit) regex.692*/693const DIGITS_REGEX = /^\d+$/u;694/**695* [Domain name](https://en.wikipedia.org/wiki/Domain_name) regex.696*697* Hint: We decided against the `i` flag for better JSON Schema compatibility.698* ASCII-only validation. Internationalized domain names (IDNs) are not699* supported, including Punycode-encoded labels.700*/701const DOMAIN_REGEX = /^(?=.{1,253}$)(?:(?![Xx][Nn]--)[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.)+[A-Za-z]{2,63}$/u;702/**703* [Email address](https://en.wikipedia.org/wiki/Email_address) regex.704*/705const EMAIL_REGEX = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;706/**707* Emoji regex from [emoji-regex-xs](https://github.com/slevithan/emoji-regex-xs) v1.0.0 (MIT license).708*709* Hint: We decided against the newer `/^\p{RGI_Emoji}+$/v` regex because it is710* not supported in older runtimes and does not match all emoji.711*/712const EMOJI_REGEX = /^(?:[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|(?![\p{Emoji_Modifier_Base}\u{1F1E6}-\u{1F1FF}])\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|(?![\p{Emoji_Modifier_Base}\u{1F1E6}-\u{1F1FF}])\p{Emoji_Presentation}))*)+$/u;713/**714* [Hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) regex.715*716* Hint: We decided against the `i` flag for better JSON Schema compatibility.717*/718const HEXADECIMAL_REGEX = /^(?:0[hx])?[\da-fA-F]+$/u;719/**720* [Hex color](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) regex.721*722* Hint: We decided against the `i` flag for better JSON Schema compatibility.723*/724const HEX_COLOR_REGEX = /^#(?:[\da-fA-F]{3,4}|[\da-fA-F]{6}|[\da-fA-F]{8})$/u;725/**726* [IMEI](https://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity) regex.727*/728const IMEI_REGEX = /^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u;729/**730* [IPv4](https://en.wikipedia.org/wiki/IPv4) regex.731*/732const IPV4_REGEX = /^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u;733/**734* [IPv6](https://en.wikipedia.org/wiki/IPv6) regex.735*/736const IPV6_REGEX = /^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu;737/**738* [IP](https://en.wikipedia.org/wiki/IP_address) regex.739*/740const IP_REGEX = /^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$|^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu;741/**742* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date regex.743*/744const ISO_DATE_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u;745/**746* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time regex.747*/748const ISO_DATE_TIME_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3]):[0-5]\d$/u;749/**750* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with seconds regex.751*/752const ISO_DATE_TIME_SECOND_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u;753/**754* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time regex.755*/756const ISO_TIME_REGEX = /^(?:0\d|1\d|2[0-3]):[0-5]\d$/u;757/**758* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time with seconds regex.759*/760const ISO_TIME_SECOND_REGEX = /^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u;761/**762* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp regex. Allows a763* space as a date/time separator and an optional space before the UTC offset.764*/765const ISO_TIMESTAMP_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])[T ](?:0\d|1\d|2[0-3])(?::[0-5]\d){2}(?:\.\d{1,9})?(?:Z| ?[+-](?:0\d|1\d|2[0-3])(?::?[0-5]\d)?)$/u;766/**767* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) week regex.768*/769const ISO_WEEK_REGEX = /^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u;770/**771* [JWS compact serialization](https://datatracker.ietf.org/doc/html/rfc7515#section-3.1)772* regex.773*774* Hint: Empty payload and signature segments are allowed because the775* Base64URL-encoded representation of an empty octet sequence is an empty776* string.777*/778const JWS_COMPACT_REGEX = /^(?:[\w-]{2,3}|(?:[\w-]{4})+(?:[\w-]{2,3})?)\.(?:[\w-]{2,3}|(?:[\w-]{4})+(?:[\w-]{2,3})?)?\.(?:[\w-]{2,3}|(?:[\w-]{4})+(?:[\w-]{2,3})?)?$/u;779/**780* [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code) regex.781*/782const ISRC_REGEX = /^(?:[A-Z]{2}[A-Z\d]{3}\d{7}|[A-Z]{2}-[A-Z\d]{3}-\d{2}-\d{5})$/u;783/**784* [MAC](https://en.wikipedia.org/wiki/MAC_address) 48 bit regex.785*786* Hint: We decided against the `i` flag for better JSON Schema compatibility.787*/788const MAC48_REGEX = /^(?:[\da-fA-F]{2}:){5}[\da-fA-F]{2}$|^(?:[\da-fA-F]{2}-){5}[\da-fA-F]{2}$|^(?:[\da-fA-F]{4}\.){2}[\da-fA-F]{4}$/u;789/**790* [MAC](https://en.wikipedia.org/wiki/MAC_address) 64 bit regex.791*792* Hint: We decided against the `i` flag for better JSON Schema compatibility.793*/794const MAC64_REGEX = /^(?:[\da-fA-F]{2}:){7}[\da-fA-F]{2}$|^(?:[\da-fA-F]{2}-){7}[\da-fA-F]{2}$|^(?:[\da-fA-F]{4}\.){3}[\da-fA-F]{4}$|^(?:[\da-fA-F]{4}:){3}[\da-fA-F]{4}$/u;795/**796* [MAC](https://en.wikipedia.org/wiki/MAC_address) regex.797*798* Hint: We decided against the `i` flag for better JSON Schema compatibility.799*/800const MAC_REGEX = /^(?:[\da-fA-F]{2}:){5}[\da-fA-F]{2}$|^(?:[\da-fA-F]{2}-){5}[\da-fA-F]{2}$|^(?:[\da-fA-F]{4}\.){2}[\da-fA-F]{4}$|^(?:[\da-fA-F]{2}:){7}[\da-fA-F]{2}$|^(?:[\da-fA-F]{2}-){7}[\da-fA-F]{2}$|^(?:[\da-fA-F]{4}\.){3}[\da-fA-F]{4}$|^(?:[\da-fA-F]{4}:){3}[\da-fA-F]{4}$/u;801/**802* [Nano ID](https://github.com/ai/nanoid) regex.803*/804const NANO_ID_REGEX = /^[\w-]+$/u;805/**806* [Octal](https://en.wikipedia.org/wiki/Octal) regex.807*/808const OCTAL_REGEX = /^(?:0o)?[0-7]+$/u;809/**810* [RFC 5322 email address](https://datatracker.ietf.org/doc/html/rfc5322#section-3.4.1) regex.811*812* Hint: This regex was taken from the [HTML Living Standard Specification](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) and does not perfectly represent RFC 5322.813*/814const RFC_EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;815/**816* [Slug](https://en.wikipedia.org/wiki/Clean_URL#Slug) regex.817*/818const SLUG_REGEX = /^[\da-z]+(?:[-_][\da-z]+)*$/u;819/**820* [ULID](https://github.com/ulid/spec) regex.821*822* Hint: We decided against the `i` flag for better JSON Schema compatibility.823*/824const ULID_REGEX = /^[\da-hjkmnp-tv-zA-HJKMNP-TV-Z]{26}$/u;825/**826* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) regex.827*/828const UUID_REGEX = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu;829 830//#endregion831//#region src/actions/base64/base64.ts832/* @__NO_SIDE_EFFECTS__ */833function base64(message$1) {834 return {835 kind: "validation",836 type: "base64",837 reference: base64,838 async: false,839 expects: null,840 requirement: BASE64_REGEX,841 message: message$1,842 "~run"(dataset, config$1) {843 if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Base64", dataset, config$1);844 return dataset;845 }846 };847}848 849//#endregion850//#region src/actions/bic/bic.ts851/* @__NO_SIDE_EFFECTS__ */852function bic(message$1) {853 return {854 kind: "validation",855 type: "bic",856 reference: bic,857 async: false,858 expects: null,859 requirement: BIC_REGEX,860 message: message$1,861 "~run"(dataset, config$1) {862 if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "BIC", dataset, config$1);863 return dataset;864 }865 };866}867 868//#endregion869//#region src/actions/brand/brand.ts870/**871* Creates a brand transformation action.872*873* @param name The brand name.874*875* @returns A brand action.876*/877/* @__NO_SIDE_EFFECTS__ */878function brand(name) {879 return {880 kind: "transformation",881 type: "brand",882 reference: brand,883 async: false,884 name,885 "~run"(dataset) {886 return dataset;887 }888 };889}890 891//#endregion892//#region src/actions/bytes/bytes.ts893/* @__NO_SIDE_EFFECTS__ */894function bytes(requirement, message$1) {895 return {896 kind: "validation",897 type: "bytes",898 reference: bytes,899 async: false,900 expects: `${requirement}`,901 requirement,902 message: message$1,903 "~run"(dataset, config$1) {904 if (dataset.typed) {905 const length$1 = /* @__PURE__ */ _getByteCount(dataset.value);906 if (length$1 !== this.requirement) _addIssue(this, "bytes", dataset, config$1, { received: `${length$1}` });907 }908 return dataset;909 }910 };911}912 913//#endregion914//#region src/actions/check/check.ts915/* @__NO_SIDE_EFFECTS__ */916function check(requirement, message$1) {917 return {918 kind: "validation",919 type: "check",920 reference: check,921 async: false,922 expects: null,923 requirement,924 message: message$1,925 "~run"(dataset, config$1) {926 if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);927 return dataset;928 }929 };930}931 932//#endregion933//#region src/actions/check/checkAsync.ts934/* @__NO_SIDE_EFFECTS__ */935function checkAsync(requirement, message$1) {936 return {937 kind: "validation",938 type: "check",939 reference: checkAsync,940 async: true,941 expects: null,942 requirement,943 message: message$1,944 async "~run"(dataset, config$1) {945 if (dataset.typed && !await this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);946 return dataset;947 }948 };949}950 951//#endregion952//#region src/actions/checkItems/checkItems.ts953/* @__NO_SIDE_EFFECTS__ */954function checkItems(requirement, message$1) {955 return {956 kind: "validation",957 type: "check_items",958 reference: checkItems,959 async: false,960 expects: null,961 requirement,962 message: message$1,963 "~run"(dataset, config$1) {964 if (dataset.typed) for (let index = 0; index < dataset.value.length; index++) {965 const item = dataset.value[index];966 if (!this.requirement(item, index, dataset.value)) _addIssue(this, "item", dataset, config$1, {967 input: item,968 path: [{969 type: "array",970 origin: "value",971 input: dataset.value,972 key: index,973 value: item974 }]975 });976 }977 return dataset;978 }979 };980}981 982//#endregion983//#region src/actions/checkItems/checkItemsAsync.ts984/* @__NO_SIDE_EFFECTS__ */985function checkItemsAsync(requirement, message$1) {986 return {987 kind: "validation",988 type: "check_items",989 reference: checkItemsAsync,990 async: true,991 expects: null,992 requirement,993 message: message$1,994 async "~run"(dataset, config$1) {995 if (dataset.typed) {996 const requirementResults = await Promise.all(dataset.value.map(this.requirement));997 for (let index = 0; index < dataset.value.length; index++) if (!requirementResults[index]) {998 const item = dataset.value[index];999 _addIssue(this, "item", dataset, config$1, {1000 input: item,1001 path: [{1002 type: "array",1003 origin: "value",1004 input: dataset.value,1005 key: index,1006 value: item1007 }]1008 });1009 }1010 }1011 return dataset;1012 }1013 };1014}1015 1016//#endregion1017//#region src/actions/creditCard/creditCard.ts1018/**1019* Credit card regex.1020*/1021const CREDIT_CARD_REGEX = /^(?:\d{13,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u;1022/**1023* Sanitize regex.1024*/1025const SANITIZE_REGEX = /[- ]/gu;1026/**1027* Provider regex list.1028*/1029const PROVIDER_REGEX_LIST = [1030 /^3[47]\d{13}$/u,1031 /^3(?:0[0-5]|[68]\d)\d{11,13}$/u,1032 /^6(?:011|5\d{2})\d{12,15}$/u,1033 /^(?:2131|1800|35\d{3})\d{11}$/u,1034 /^(?:5[1-5]\d{2}|222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u,1035 /^(?:6[27]\d{14,17}|81\d{14,17})$/u,1036 /^4\d{12}(?:\d{3,6})?$/u1037];1038/* @__NO_SIDE_EFFECTS__ */1039function creditCard(message$1) {1040 return {1041 kind: "validation",1042 type: "credit_card",1043 reference: creditCard,1044 async: false,1045 expects: null,1046 requirement(input) {1047 let sanitized;1048 return CREDIT_CARD_REGEX.test(input) && (sanitized = input.replace(SANITIZE_REGEX, "")) && PROVIDER_REGEX_LIST.some((regex$1) => regex$1.test(sanitized)) && /* @__PURE__ */ _isLuhnAlgo(sanitized);1049 },1050 message: message$1,1051 "~run"(dataset, config$1) {1052 if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "credit card", dataset, config$1);1053 return dataset;1054 }1055 };1056}1057 1058//#endregion1059//#region src/actions/cuid2/cuid2.ts1060/* @__NO_SIDE_EFFECTS__ */1061function cuid2(message$1) {1062 return {1063 kind: "validation",1064 type: "cuid2",1065 reference: cuid2,1066 async: false,1067 expects: null,1068 requirement: CUID2_REGEX,1069 message: message$1,1070 "~run"(dataset, config$1) {1071 if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Cuid2", dataset, config$1);1072 return dataset;1073 }1074 };1075}1076 1077//#endregion1078//#region src/actions/decimal/decimal.ts1079/* @__NO_SIDE_EFFECTS__ */1080function decimal(message$1) {1081 return {1082 kind: "validation",1083 type: "decimal",1084 reference: decimal,1085 async: false,1086 expects: null,1087 requirement: DECIMAL_REGEX,1088 message: message$1,1089 "~run"(dataset, config$1) {1090 if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "decimal", dataset, config$1);1091 return dataset;1092 }1093 };1094}1095 1096//#endregion1097//#region src/actions/description/description.ts1098/**1099* Creates a description metadata action.1100*1101* @param description_ The description text.1102*1103* @returns A description action.1104*/1105/* @__NO_SIDE_EFFECTS__ */1106function description(description_) {1107 return {1108 kind: "metadata",1109 type: "description",1110 reference: description,1111 description: description_1112 };1113}1114 1115//#endregion1116//#region src/actions/digits/digits.ts1117/* @__NO_SIDE_EFFECTS__ */1118function digits(message$1) {1119 return {1120 kind: "validation",1121 type: "digits",1122 reference: digits,1123 async: false,1124 expects: null,1125 requirement: DIGITS_REGEX,1126 message: message$1,1127 "~run"(dataset, config$1) {1128 if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "digits", dataset, config$1);1129 return dataset;1130 }1131 };1132}1133 1134//#endregion1135//#region src/actions/domain/domain.ts1136/* @__NO_SIDE_EFFECTS__ */1137function domain(message$1) {1138 return {1139 kind: "validation",1140 type: "domain",1141 reference: domain,1142 expects: null,1143 async: false,1144 requirement: DOMAIN_REGEX,1145 message: message$1,1146 "~run"(dataset, config$1) {1147 if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "domain", dataset, config$1);1148 return dataset;1149 }1150 };1151}1152 1153//#endregion1154//#region src/actions/email/email.ts1155/* @__NO_SIDE_EFFECTS__ */1156function email(message$1) {1157 return {1158 kind: "validation",1159 type: "email",1160 reference: email,1161 expects: null,1162 async: false,1163 requirement: EMAIL_REGEX,1164 message: message$1,1165 "~run"(dataset, config$1) {1166 if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "email", dataset, config$1);1167 return dataset;1168 }1169 };1170}1171 1172//#endregion1173//#region src/actions/emoji/emoji.ts1174/* @__NO_SIDE_EFFECTS__ */1175function emoji(message$1) {1176 return {1177 kind: "validation",1178 type: "emoji",1179 reference: emoji,1180 async: false,1181 expects: null,1182 requirement: EMOJI_REGEX,1183 message: message$1,1184 "~run"(dataset, config$1) {1185 if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "emoji", dataset, config$1);1186 return dataset;1187 }1188 };1189}1190 1191//#endregion1192//#region src/actions/empty/empty.ts1193/* @__NO_SIDE_EFFECTS__ */1194function empty(message$1) {1195 return {1196 kind: "validation",1197 type: "empty",1198 reference: empty,1199 async: false,1200 expects: "0",