Team Ai
Datasetpublic

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.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
index.mjs7663 linesDownload Raw Back to dist
1//#region src/storages/globalConfig/globalConfig.ts2let store$4;3const DEFAULT_CONFIG = {4	lang: void 0,5	message: void 0,6	abortEarly: void 0,7	abortPipeEarly: void 08};9/**10* Sets the global configuration.11*12* @param config The configuration.13*/14function setGlobalConfig(config$1) {15	store$4 = {16		...store$4,17		...config$118	};19}20/**21* Returns the global configuration.22*23* @param config The config to merge.24*25* @returns The configuration.26*/27/* @__NO_SIDE_EFFECTS__ */28function getGlobalConfig(config$1) {29	if (!config$1 && !store$4) return DEFAULT_CONFIG;30	return {31		lang: config$1?.lang ?? store$4?.lang,32		message: config$1?.message,33		abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,34		abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly35	};36}37/**38* Deletes the global configuration.39*/40function deleteGlobalConfig() {41	store$4 = void 0;42}43 44//#endregion45//#region src/storages/globalMessage/globalMessage.ts46let store$3;47/**48* Sets a global error message.49*50* @param message The error message.51* @param lang The language of the message.52*/53function setGlobalMessage(message$1, lang) {54	if (!store$3) store$3 = /* @__PURE__ */ new Map();55	store$3.set(lang, message$1);56}57/**58* Returns a global error message.59*60* @param lang The language of the message.61*62* @returns The error message.63*/64/* @__NO_SIDE_EFFECTS__ */65function getGlobalMessage(lang) {66	return store$3?.get(lang);67}68/**69* Deletes a global error message.70*71* @param lang The language of the message.72*/73function deleteGlobalMessage(lang) {74	store$3?.delete(lang);75}76 77//#endregion78//#region src/storages/schemaMessage/schemaMessage.ts79let store$2;80/**81* Sets a schema error message.82*83* @param message The error message.84* @param lang The language of the message.85*/86function setSchemaMessage(message$1, lang) {87	if (!store$2) store$2 = /* @__PURE__ */ new Map();88	store$2.set(lang, message$1);89}90/**91* Returns a schema error message.92*93* @param lang The language of the message.94*95* @returns The error message.96*/97/* @__NO_SIDE_EFFECTS__ */98function getSchemaMessage(lang) {99	return store$2?.get(lang);100}101/**102* Deletes a schema error message.103*104* @param lang The language of the message.105*/106function deleteSchemaMessage(lang) {107	store$2?.delete(lang);108}109 110//#endregion111//#region src/storages/specificMessage/specificMessage.ts112let store$1;113/**114* Sets a specific error message.115*116* @param reference The identifier reference.117* @param message The error message.118* @param lang The language of the message.119*/120function setSpecificMessage(reference, message$1, lang) {121	if (!store$1) store$1 = /* @__PURE__ */ new Map();122	if (!store$1.get(reference)) store$1.set(reference, /* @__PURE__ */ new Map());123	store$1.get(reference).set(lang, message$1);124}125/**126* Returns a specific error message.127*128* @param reference The identifier reference.129* @param lang The language of the message.130*131* @returns The error message.132*/133/* @__NO_SIDE_EFFECTS__ */134function getSpecificMessage(reference, lang) {135	return store$1?.get(reference)?.get(lang);136}137/**138* Deletes a specific error message.139*140* @param reference The identifier reference.141* @param lang The language of the message.142*/143function deleteSpecificMessage(reference, lang) {144	store$1?.get(reference)?.delete(lang);145}146 147//#endregion148//#region src/utils/_stringify/_stringify.ts149/**150* Stringifies an unknown input to a literal or type string.151*152* @param input The unknown input.153*154* @returns A literal or type string.155*156* @internal157*/158/* @__NO_SIDE_EFFECTS__ */159function _stringify(input) {160	const type = typeof input;161	if (type === "string") return `"${input}"`;162	if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;163	if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";164	return type;165}166 167//#endregion168//#region src/utils/_addIssue/_addIssue.ts169/**170* Adds an issue to the dataset.171*172* @param context The issue context.173* @param label The issue label.174* @param dataset The input dataset.175* @param config The configuration.176* @param other The optional props.177*178* @internal179*/180function _addIssue(context, label, dataset, config$1, other) {181	const input = other && "input" in other ? other.input : dataset.value;182	const expected = other?.expected ?? context.expects ?? null;183	const received = other?.received ?? /* @__PURE__ */ _stringify(input);184	const issue = {185		kind: context.kind,186		type: context.type,187		input,188		expected,189		received,190		message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,191		requirement: context.requirement,192		path: other?.path,193		issues: other?.issues,194		lang: config$1.lang,195		abortEarly: config$1.abortEarly,196		abortPipeEarly: config$1.abortPipeEarly197	};198	const isSchema = context.kind === "schema";199	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);200	if (message$1 !== void 0) issue.message = typeof message$1 === "function" ? message$1(issue) : message$1;201	if (isSchema) dataset.typed = false;202	if (dataset.issues) dataset.issues.push(issue);203	else dataset.issues = [issue];204}205 206//#endregion207//#region src/utils/_cloneDataset/_cloneDataset.ts208/**209* Creates a shallow copy of a dataset.210*211* Hint: The `value` is copied by reference, but the `issues` array is cloned212* to avoid reusing mutable dataset state across multiple runs. Mutating a213* returned object or array value can therefore affect later cache hits that214* reuse the same cached output.215*216* @param dataset The output dataset.217*218* @returns The copied output dataset.219*/220/* @__NO_SIDE_EFFECTS__ */221function _cloneDataset(dataset) {222	return {223		typed: dataset.typed,224		value: dataset.value,225		issues: dataset.issues && [...dataset.issues]226	};227}228 229//#endregion230//#region src/utils/_formatCase/_formatCase.ts231/**232* Splits a string into lowercase words and rejoins them with the given233* separator and capitalization rules.234*235* Words are separated by `_`, `-` and ASCII whitespace, as well as by case236* and acronym boundaries. Whether the first or subsequent words are237* capitalized is controlled by `capFirst` and `capRest`.238*239* Hint: Implemented in a single pass that emits directly to the result240* string to avoid an intermediate `string[]` allocation. ASCII chars are241* classified via char codes to skip `.toLowerCase()` and `.toUpperCase()`242* method calls in the common case.243*244* Hint: Digits are treated as a separate character class, so `item2Name`245* yields `item2` and `name` rather than `item`, `2` and `name`.246*247* @param input The input string.248* @param separator The string inserted between words.249* @param capFirst Whether to capitalize the first word.250* @param capRest Whether to capitalize subsequent words.251*252* @returns The formatted string.253*254* @internal255*/256/* @__NO_SIDE_EFFECTS__ */257function _formatCase(input, separator, capFirst, capRest) {258	let result = "";259	let firstWord = true;260	let start = 0;261	let prev = 0;262	let prevPrev = 0;263	const flush = (end) => {264		if (end > start) {265			let word = input.slice(start, end).toLowerCase();266			if (firstWord ? capFirst : capRest) {267				const firstCode = word.charCodeAt(0);268				if (firstCode >= 97 && firstCode <= 122) word = String.fromCharCode(firstCode - 32) + word.slice(1);269				else {270					const charLen = firstCode >= 55296 && firstCode <= 56319 ? 2 : 1;271					word = word.slice(0, charLen).toUpperCase() + word.slice(charLen);272				}273			}274			result += firstWord ? word : separator + word;275			firstWord = false;276		}277	};278	for (let index = 0; index < input.length; index++) {279		const code = input.charCodeAt(index);280		let type;281		if (code === 32 || code === 9 || code === 10 || code === 11 || code === 12 || code === 13 || code === 45 || code === 95) {282			flush(index);283			start = index + 1;284			type = 0;285		} else if (code < 128) type = code >= 65 && code <= 90 ? 1 : code >= 97 && code <= 122 ? 2 : 3;286		else {287			const char = input[index];288			const charLower = char.toLowerCase();289			type = charLower === char.toUpperCase() ? 3 : char === charLower ? 2 : 1;290		}291		if (type === 1 && (prev === 2 || prev === 3) && index > start) {292			flush(index);293			start = index;294		} else if (type === 2 && prev === 1 && prevPrev === 1 && index - 1 > start) {295			flush(index - 1);296			start = index - 1;297		}298		prevPrev = prev;299		prev = type;300	}301	flush(input.length);302	return result;303}304 305//#endregion306//#region src/utils/_getByteCount/_getByteCount.ts307let textEncoder;308/**309* Returns the byte count of the input.310*311* @param input The input to be measured.312*313* @returns The byte count.314*315* @internal316*/317/* @__NO_SIDE_EFFECTS__ */318function _getByteCount(input) {319	if (!textEncoder) textEncoder = new TextEncoder();320	return textEncoder.encode(input).length;321}322 323//#endregion324//#region src/utils/_getGraphemeCount/_getGraphemeCount.ts325let segmenter;326/**327* Returns the grapheme count of the input.328*329* @param input The input to be measured.330*331* @returns The grapheme count.332*333* @internal334*/335/* @__NO_SIDE_EFFECTS__ */336function _getGraphemeCount(input) {337	if (!segmenter) segmenter = new Intl.Segmenter();338	const segments = segmenter.segment(input);339	let count = 0;340	for (const _ of segments) count++;341	return count;342}343 344//#endregion345//#region src/utils/_getLastMetadata/_getLastMetadata.ts346/**347* Returns the last top-level value of a given metadata type from a schema348* using a breadth-first search that starts with the last item in the pipeline.349*350* @param schema The schema to search.351* @param type The metadata type.352*353* @returns The value, if any.354*355* @internal356*/357/* @__NO_SIDE_EFFECTS__ */358function _getLastMetadata(schema, type) {359	if ("pipe" in schema) {360		const nestedSchemas = [];361		for (let index = schema.pipe.length - 1; index >= 0; index--) {362			const item = schema.pipe[index];363			if (item.kind === "schema" && "pipe" in item) nestedSchemas.push(item);364			else if (item.kind === "metadata" && item.type === type) return item[type];365		}366		for (const nestedSchema of nestedSchemas) {367			const result = /* @__PURE__ */ _getLastMetadata(nestedSchema, type);368			if (result !== void 0) return result;369		}370	}371}372 373//#endregion374//#region src/utils/_getStandardProps/_getStandardProps.ts375const _standardCache = /* @__PURE__ */ new WeakMap();376/**377* Returns the Standard Schema properties.378*379* @param context The schema context.380*381* @returns The Standard Schema properties.382*/383/* @__NO_SIDE_EFFECTS__ */384function _getStandardProps(context) {385	let cached = _standardCache.get(context);386	if (!cached) {387		cached = {388			version: 1,389			vendor: "valibot",390			validate(value$1) {391				return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());392			}393		};394		_standardCache.set(context, cached);395	}396	return cached;397}398 399//#endregion400//#region src/utils/_getWordCount/_getWordCount.ts401let store;402/**403* Returns the word count of the input.404*405* @param locales The locales to be used.406* @param input The input to be measured.407*408* @returns The word count.409*410* @internal411*/412/* @__NO_SIDE_EFFECTS__ */413function _getWordCount(locales, input) {414	if (!store) store = /* @__PURE__ */ new Map();415	const key = String(locales);416	let segmenter$1 = store.get(key);417	if (!segmenter$1) {418		segmenter$1 = new Intl.Segmenter(locales, { granularity: "word" });419		store.set(key, segmenter$1);420	}421	const segments = segmenter$1.segment(input);422	let count = 0;423	for (const segment of segments) if (segment.isWordLike) count++;424	return count;425}426 427//#endregion428//#region src/utils/_isLuhnAlgo/_isLuhnAlgo.ts429/**430* Non-digit regex.431*/432const NON_DIGIT_REGEX = /\D/gu;433/**434* Checks whether a string with numbers corresponds to the luhn algorithm.435*436* @param input The input to be checked.437*438* @returns Whether input is valid.439*440* @internal441*/442/* @__NO_SIDE_EFFECTS__ */443function _isLuhnAlgo(input) {444	const number$1 = input.replace(NON_DIGIT_REGEX, "");445	let length$1 = number$1.length;446	let bit = 1;447	let sum = 0;448	while (length$1) {449		const value$1 = +number$1[--length$1];450		bit ^= 1;451		sum += bit ? [452			0,453			2,454			4,455			6,456			8,457			1,458			3,459			5,460			7,461			9462		][value$1] : value$1;463	}464	return sum % 10 === 0;465}466 467//#endregion468//#region src/utils/_isValidObjectKey/_isValidObjectKey.ts469/**470* Disallows inherited object properties and prevents object prototype471* pollution by disallowing certain keys.472*473* @param object The object to check.474* @param key The key to check.475*476* @returns Whether the key is allowed.477*478* @internal479*/480/* @__NO_SIDE_EFFECTS__ */481function _isValidObjectKey(object$1, key) {482	return Object.prototype.hasOwnProperty.call(object$1, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";483}484 485//#endregion486//#region src/utils/_joinExpects/_joinExpects.ts487/**488* Joins multiple `expects` values with the given separator.489*490* @param values The `expects` values.491* @param separator The separator.492*493* @returns The joined `expects` property.494*495* @internal496*/497/* @__NO_SIDE_EFFECTS__ */498function _joinExpects(values$1, separator) {499	const list = [...new Set(values$1)];500	if (list.length > 1) return `(${list.join(` ${separator} `)})`;501	return list[0] ?? "never";502}503 504//#endregion505//#region src/utils/entriesFromList/entriesFromList.ts506/**507* Creates an object entries definition from a list of keys and a schema.508*509* @param list A list of keys.510* @param schema The schema of the keys.511*512* @returns The object entries.513*/514/* @__NO_SIDE_EFFECTS__ */515function entriesFromList(list, schema) {516	const entries$1 = {};517	for (const key of list) entries$1[key] = schema;518	return entries$1;519}520 521//#endregion522//#region src/utils/entriesFromObjects/entriesFromObjects.ts523/* @__NO_SIDE_EFFECTS__ */524function entriesFromObjects(schemas) {525	const entries$1 = {};526	for (const schema of schemas) Object.assign(entries$1, schema.entries);527	return entries$1;528}529 530//#endregion531//#region src/utils/getDotPath/getDotPath.ts532/* @__NO_SIDE_EFFECTS__ */533function getDotPath(issue) {534	if (issue.path) {535		let key = "";536		for (const item of issue.path) if (typeof item.key === "string" || typeof item.key === "number") if (key) key += `.${item.key}`;537		else key += item.key;538		else return null;539		return key;540	}541	return null;542}543 544//#endregion545//#region src/utils/isOfKind/isOfKind.ts546/**547* A generic type guard to check the kind of an object.548*549* @param kind The kind to check for.550* @param object The object to check.551*552* @returns Whether it matches.553*/554/* @__NO_SIDE_EFFECTS__ */555function isOfKind(kind, object$1) {556	return object$1.kind === kind;557}558 559//#endregion560//#region src/utils/isOfType/isOfType.ts561/**562* A generic type guard to check the type of an object.563*564* @param type The type to check for.565* @param object The object to check.566*567* @returns Whether it matches.568*/569/* @__NO_SIDE_EFFECTS__ */570function isOfType(type, object$1) {571	return object$1.type === type;572}573 574//#endregion575//#region src/utils/isValiError/isValiError.ts576/**577* A type guard to check if an error is a ValiError.578*579* @param error The error to check.580*581* @returns Whether its a ValiError.582*/583/* @__NO_SIDE_EFFECTS__ */584function isValiError(error) {585	return error instanceof ValiError;586}587 588//#endregion589//#region src/utils/ValiError/ValiError.ts590/**591* A Valibot error with useful information.592*/593var ValiError = class extends Error {594	/**595	* Creates a Valibot error with useful information.596	*597	* @param issues The error issues.598	*/599	constructor(issues) {600		super(issues[0].message);601		this.name = "ValiError";602		this.issues = issues;603	}604};605 606//#endregion607//#region src/actions/args/args.ts608/* @__NO_SIDE_EFFECTS__ */609function args(schema) {610	return {611		kind: "transformation",612		type: "args",613		reference: args,614		async: false,615		schema,616		"~run"(dataset, config$1) {617			const func = dataset.value;618			dataset.value = (...args_) => {619				const argsDataset = this.schema["~run"]({ value: args_ }, config$1);620				if (argsDataset.issues) throw new ValiError(argsDataset.issues);621				return func(...argsDataset.value);622			};623			return dataset;624		}625	};626}627 628//#endregion629//#region src/actions/args/argsAsync.ts630/* @__NO_SIDE_EFFECTS__ */631function argsAsync(schema) {632	return {633		kind: "transformation",634		type: "args",635		reference: argsAsync,636		async: false,637		schema,638		"~run"(dataset, config$1) {639			const func = dataset.value;640			dataset.value = async (...args$1) => {641				const argsDataset = await schema["~run"]({ value: args$1 }, config$1);642				if (argsDataset.issues) throw new ValiError(argsDataset.issues);643				return func(...argsDataset.value);644			};645			return dataset;646		}647	};648}649 650//#endregion651//#region src/actions/await/awaitAsync.ts652/**653* Creates an await transformation action.654*655* @returns An await action.656*/657/* @__NO_SIDE_EFFECTS__ */658function awaitAsync() {659	return {660		kind: "transformation",661		type: "await",662		reference: awaitAsync,663		async: true,664		async "~run"(dataset) {665			dataset.value = await dataset.value;666			return dataset;667		}668	};669}670 671//#endregion672//#region src/regex.ts673/**674* [Base64](https://en.wikipedia.org/wiki/Base64) regex.675*/676const BASE64_REGEX = /^(?:[\da-z+/]{4})*(?:[\da-z+/]{2}==|[\da-z+/]{3}=)?$/iu;677/**678* [BIC](https://en.wikipedia.org/wiki/ISO_9362) regex.679*/680const BIC_REGEX = /^[A-Z]{6}(?!00)[\dA-Z]{2}(?:[\dA-Z]{3})?$/u;681/**682* [Cuid2](https://github.com/paralleldrive/cuid2) regex.683*/684const CUID2_REGEX = /^[a-z][\da-z]*$/u;685/**686* [Decimal](https://en.wikipedia.org/wiki/Decimal) regex.687*/688const DECIMAL_REGEX = /^[+-]?(?:\d*\.)?\d+$/u;689/**690* [Digits](https://en.wikipedia.org/wiki/Numerical_digit) regex.691*/692const DIGITS_REGEX = /^\d+$/u;693/**694* [Domain name](https://en.wikipedia.org/wiki/Domain_name) regex.695*696* Hint: We decided against the `i` flag for better JSON Schema compatibility.697* ASCII-only validation. Internationalized domain names (IDNs) are not698* supported, including Punycode-encoded labels.699*/700const 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;701/**702* [Email address](https://en.wikipedia.org/wiki/Email_address) regex.703*/704const EMAIL_REGEX = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;705/**706* Emoji regex from [emoji-regex-xs](https://github.com/slevithan/emoji-regex-xs) v1.0.0 (MIT license).707*708* Hint: We decided against the newer `/^\p{RGI_Emoji}+$/v` regex because it is709* not supported in older runtimes and does not match all emoji.710*/711const 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;712/**713* [Hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) regex.714*715* Hint: We decided against the `i` flag for better JSON Schema compatibility.716*/717const HEXADECIMAL_REGEX = /^(?:0[hx])?[\da-fA-F]+$/u;718/**719* [Hex color](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) regex.720*721* Hint: We decided against the `i` flag for better JSON Schema compatibility.722*/723const HEX_COLOR_REGEX = /^#(?:[\da-fA-F]{3,4}|[\da-fA-F]{6}|[\da-fA-F]{8})$/u;724/**725* [IMEI](https://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity) regex.726*/727const IMEI_REGEX = /^\d{15}$|^\d{2}-\d{6}-\d{6}-\d$/u;728/**729* [IPv4](https://en.wikipedia.org/wiki/IPv4) regex.730*/731const 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;732/**733* [IPv6](https://en.wikipedia.org/wiki/IPv6) regex.734*/735const 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;736/**737* [IP](https://en.wikipedia.org/wiki/IP_address) regex.738*/739const 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;740/**741* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date regex.742*/743const ISO_DATE_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u;744/**745* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time regex.746*/747const 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;748/**749* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with seconds regex.750*/751const 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;752/**753* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time regex.754*/755const ISO_TIME_REGEX = /^(?:0\d|1\d|2[0-3]):[0-5]\d$/u;756/**757* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time with seconds regex.758*/759const ISO_TIME_SECOND_REGEX = /^(?:0\d|1\d|2[0-3])(?::[0-5]\d){2}$/u;760/**761* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp regex. Allows a762* space as a date/time separator and an optional space before the UTC offset.763*/764const 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;765/**766* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) week regex.767*/768const ISO_WEEK_REGEX = /^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/u;769/**770* [JWS compact serialization](https://datatracker.ietf.org/doc/html/rfc7515#section-3.1)771* regex.772*773* Hint: Empty payload and signature segments are allowed because the774* Base64URL-encoded representation of an empty octet sequence is an empty775* string.776*/777const 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;778/**779* [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code) regex.780*/781const ISRC_REGEX = /^(?:[A-Z]{2}[A-Z\d]{3}\d{7}|[A-Z]{2}-[A-Z\d]{3}-\d{2}-\d{5})$/u;782/**783* [MAC](https://en.wikipedia.org/wiki/MAC_address) 48 bit regex.784*785* Hint: We decided against the `i` flag for better JSON Schema compatibility.786*/787const 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;788/**789* [MAC](https://en.wikipedia.org/wiki/MAC_address) 64 bit regex.790*791* Hint: We decided against the `i` flag for better JSON Schema compatibility.792*/793const 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;794/**795* [MAC](https://en.wikipedia.org/wiki/MAC_address) regex.796*797* Hint: We decided against the `i` flag for better JSON Schema compatibility.798*/799const 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;800/**801* [Nano ID](https://github.com/ai/nanoid) regex.802*/803const NANO_ID_REGEX = /^[\w-]+$/u;804/**805* [Octal](https://en.wikipedia.org/wiki/Octal) regex.806*/807const OCTAL_REGEX = /^(?:0o)?[0-7]+$/u;808/**809* [RFC 5322 email address](https://datatracker.ietf.org/doc/html/rfc5322#section-3.4.1) regex.810*811* 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.812*/813const 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])?)*$/;814/**815* [Slug](https://en.wikipedia.org/wiki/Clean_URL#Slug) regex.816*/817const SLUG_REGEX = /^[\da-z]+(?:[-_][\da-z]+)*$/u;818/**819* [ULID](https://github.com/ulid/spec) regex.820*821* Hint: We decided against the `i` flag for better JSON Schema compatibility.822*/823const ULID_REGEX = /^[\da-hjkmnp-tv-zA-HJKMNP-TV-Z]{26}$/u;824/**825* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) regex.826*/827const UUID_REGEX = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu;828 829//#endregion830//#region src/actions/base64/base64.ts831/* @__NO_SIDE_EFFECTS__ */832function base64(message$1) {833	return {834		kind: "validation",835		type: "base64",836		reference: base64,837		async: false,838		expects: null,839		requirement: BASE64_REGEX,840		message: message$1,841		"~run"(dataset, config$1) {842			if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Base64", dataset, config$1);843			return dataset;844		}845	};846}847 848//#endregion849//#region src/actions/bic/bic.ts850/* @__NO_SIDE_EFFECTS__ */851function bic(message$1) {852	return {853		kind: "validation",854		type: "bic",855		reference: bic,856		async: false,857		expects: null,858		requirement: BIC_REGEX,859		message: message$1,860		"~run"(dataset, config$1) {861			if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "BIC", dataset, config$1);862			return dataset;863		}864	};865}866 867//#endregion868//#region src/actions/brand/brand.ts869/**870* Creates a brand transformation action.871*872* @param name The brand name.873*874* @returns A brand action.875*/876/* @__NO_SIDE_EFFECTS__ */877function brand(name) {878	return {879		kind: "transformation",880		type: "brand",881		reference: brand,882		async: false,883		name,884		"~run"(dataset) {885			return dataset;886		}887	};888}889 890//#endregion891//#region src/actions/bytes/bytes.ts892/* @__NO_SIDE_EFFECTS__ */893function bytes(requirement, message$1) {894	return {895		kind: "validation",896		type: "bytes",897		reference: bytes,898		async: false,899		expects: `${requirement}`,900		requirement,901		message: message$1,902		"~run"(dataset, config$1) {903			if (dataset.typed) {904				const length$1 = /* @__PURE__ */ _getByteCount(dataset.value);905				if (length$1 !== this.requirement) _addIssue(this, "bytes", dataset, config$1, { received: `${length$1}` });906			}907			return dataset;908		}909	};910}911 912//#endregion913//#region src/actions/check/check.ts914/* @__NO_SIDE_EFFECTS__ */915function check(requirement, message$1) {916	return {917		kind: "validation",918		type: "check",919		reference: check,920		async: false,921		expects: null,922		requirement,923		message: message$1,924		"~run"(dataset, config$1) {925			if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);926			return dataset;927		}928	};929}930 931//#endregion932//#region src/actions/check/checkAsync.ts933/* @__NO_SIDE_EFFECTS__ */934function checkAsync(requirement, message$1) {935	return {936		kind: "validation",937		type: "check",938		reference: checkAsync,939		async: true,940		expects: null,941		requirement,942		message: message$1,943		async "~run"(dataset, config$1) {944			if (dataset.typed && !await this.requirement(dataset.value)) _addIssue(this, "input", dataset, config$1);945			return dataset;946		}947	};948}949 950//#endregion951//#region src/actions/checkItems/checkItems.ts952/* @__NO_SIDE_EFFECTS__ */953function checkItems(requirement, message$1) {954	return {955		kind: "validation",956		type: "check_items",957		reference: checkItems,958		async: false,959		expects: null,960		requirement,961		message: message$1,962		"~run"(dataset, config$1) {963			if (dataset.typed) for (let index = 0; index < dataset.value.length; index++) {964				const item = dataset.value[index];965				if (!this.requirement(item, index, dataset.value)) _addIssue(this, "item", dataset, config$1, {966					input: item,967					path: [{968						type: "array",969						origin: "value",970						input: dataset.value,971						key: index,972						value: item973					}]974				});975			}976			return dataset;977		}978	};979}980 981//#endregion982//#region src/actions/checkItems/checkItemsAsync.ts983/* @__NO_SIDE_EFFECTS__ */984function checkItemsAsync(requirement, message$1) {985	return {986		kind: "validation",987		type: "check_items",988		reference: checkItemsAsync,989		async: true,990		expects: null,991		requirement,992		message: message$1,993		async "~run"(dataset, config$1) {994			if (dataset.typed) {995				const requirementResults = await Promise.all(dataset.value.map(this.requirement));996				for (let index = 0; index < dataset.value.length; index++) if (!requirementResults[index]) {997					const item = dataset.value[index];998					_addIssue(this, "item", dataset, config$1, {999						input: item,1000						path: [{1001							type: "array",1002							origin: "value",1003							input: dataset.value,1004							key: index,1005							value: item1006						}]1007					});1008				}1009			}1010			return dataset;1011		}1012	};1013}1014 1015//#endregion1016//#region src/actions/creditCard/creditCard.ts1017/**1018* Credit card regex.1019*/1020const CREDIT_CARD_REGEX = /^(?:\d{13,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u;1021/**1022* Sanitize regex.1023*/1024const SANITIZE_REGEX = /[- ]/gu;1025/**1026* Provider regex list.1027*/1028const PROVIDER_REGEX_LIST = [1029	/^3[47]\d{13}$/u,1030	/^3(?:0[0-5]|[68]\d)\d{11,13}$/u,1031	/^6(?:011|5\d{2})\d{12,15}$/u,1032	/^(?:2131|1800|35\d{3})\d{11}$/u,1033	/^(?:5[1-5]\d{2}|222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u,1034	/^(?:6[27]\d{14,17}|81\d{14,17})$/u,1035	/^4\d{12}(?:\d{3,6})?$/u1036];1037/* @__NO_SIDE_EFFECTS__ */1038function creditCard(message$1) {1039	return {1040		kind: "validation",1041		type: "credit_card",1042		reference: creditCard,1043		async: false,1044		expects: null,1045		requirement(input) {1046			let sanitized;1047			return CREDIT_CARD_REGEX.test(input) && (sanitized = input.replace(SANITIZE_REGEX, "")) && PROVIDER_REGEX_LIST.some((regex$1) => regex$1.test(sanitized)) && /* @__PURE__ */ _isLuhnAlgo(sanitized);1048		},1049		message: message$1,1050		"~run"(dataset, config$1) {1051			if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "credit card", dataset, config$1);1052			return dataset;1053		}1054	};1055}1056 1057//#endregion1058//#region src/actions/cuid2/cuid2.ts1059/* @__NO_SIDE_EFFECTS__ */1060function cuid2(message$1) {1061	return {1062		kind: "validation",1063		type: "cuid2",1064		reference: cuid2,1065		async: false,1066		expects: null,1067		requirement: CUID2_REGEX,1068		message: message$1,1069		"~run"(dataset, config$1) {1070			if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Cuid2", dataset, config$1);1071			return dataset;1072		}1073	};1074}1075 1076//#endregion1077//#region src/actions/decimal/decimal.ts1078/* @__NO_SIDE_EFFECTS__ */1079function decimal(message$1) {1080	return {1081		kind: "validation",1082		type: "decimal",1083		reference: decimal,1084		async: false,1085		expects: null,1086		requirement: DECIMAL_REGEX,1087		message: message$1,1088		"~run"(dataset, config$1) {1089			if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "decimal", dataset, config$1);1090			return dataset;1091		}1092	};1093}1094 1095//#endregion1096//#region src/actions/description/description.ts1097/**1098* Creates a description metadata action.1099*1100* @param description_ The description text.1101*1102* @returns A description action.1103*/1104/* @__NO_SIDE_EFFECTS__ */1105function description(description_) {1106	return {1107		kind: "metadata",1108		type: "description",1109		reference: description,1110		description: description_1111	};1112}1113 1114//#endregion1115//#region src/actions/digits/digits.ts1116/* @__NO_SIDE_EFFECTS__ */1117function digits(message$1) {1118	return {1119		kind: "validation",1120		type: "digits",1121		reference: digits,1122		async: false,1123		expects: null,1124		requirement: DIGITS_REGEX,1125		message: message$1,1126		"~run"(dataset, config$1) {1127			if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "digits", dataset, config$1);1128			return dataset;1129		}1130	};1131}1132 1133//#endregion1134//#region src/actions/domain/domain.ts1135/* @__NO_SIDE_EFFECTS__ */1136function domain(message$1) {1137	return {1138		kind: "validation",1139		type: "domain",1140		reference: domain,1141		expects: null,1142		async: false,1143		requirement: DOMAIN_REGEX,1144		message: message$1,1145		"~run"(dataset, config$1) {1146			if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "domain", dataset, config$1);1147			return dataset;1148		}1149	};1150}1151 1152//#endregion1153//#region src/actions/email/email.ts1154/* @__NO_SIDE_EFFECTS__ */1155function email(message$1) {1156	return {1157		kind: "validation",1158		type: "email",1159		reference: email,1160		expects: null,1161		async: false,1162		requirement: EMAIL_REGEX,1163		message: message$1,1164		"~run"(dataset, config$1) {1165			if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "email", dataset, config$1);1166			return dataset;1167		}1168	};1169}1170 1171//#endregion1172//#region src/actions/emoji/emoji.ts1173/* @__NO_SIDE_EFFECTS__ */1174function emoji(message$1) {1175	return {1176		kind: "validation",1177		type: "emoji",1178		reference: emoji,1179		async: false,1180		expects: null,1181		requirement: EMOJI_REGEX,1182		message: message$1,1183		"~run"(dataset, config$1) {1184			if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "emoji", dataset, config$1);1185			return dataset;1186		}1187	};1188}1189 1190//#endregion1191//#region src/actions/empty/empty.ts1192/* @__NO_SIDE_EFFECTS__ */1193function empty(message$1) {1194	return {1195		kind: "validation",1196		type: "empty",1197		reference: empty,1198		async: false,1199		expects: "0",1200		message: message$1,

Showing the first 1,200 of 7663 lines. Download the file for the rest.

Brunobkr/llama.cpp_AlgMor24_github · Team Ai