docs: 仓库链接指向本镜像仓库
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:27:07 +08:00
1 parent fa9c73363d
commit 2a69b23b47
18210 files changed
+5101211 -16

No files matched your search

@@ -0,0 +1 @@
{"version":3,"file":"flame.js","sources":["../../../src/icons/flame.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Flame\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNOC41IDE0LjVBMi41IDIuNSAwIDAgMCAxMSAxMmMwLTEuMzgtLjUtMi0xLTMtMS4wNzItMi4xNDMtLjIyNC00LjA1NCAyLTYgLjUgMi41IDIgNC45IDQgNi41IDIgMS42IDMgMy41IDMgNS41YTcgNyAwIDEgMS0xNCAwYzAtMS4xNTMuNDMzLTIuMjk0IDEtM2EyLjUgMi41IDAgMCAwIDIuNSAyLjV6IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/flame\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Flame = createLucideIcon('Flame', [\n [\n 'path',\n {\n d: 'M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z',\n key: '96xj49',\n },\n ],\n]);\n\nexport default Flame;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,iBAAiB,OAAS,CAAA,CAAA,CAAA;AAAA,CACtC,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,170 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const util = __importStar(require("../core/util.cjs"));
const error = () => {
const Sizable = {
string: { unit: "caracteres" },
file: { unit: "bytes" },
array: { unit: "elementos" },
set: { unit: "elementos" },
map: { unit: "entradas" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "a entrada",
email: "o endereço de e-mail",
url: "o URL",
emoji: "o emoji",
uuid: "o UUID",
uuidv4: "o UUIDv4",
uuidv6: "o UUIDv6",
nanoid: "o nanoid",
guid: "o GUID",
cuid: "o cuid",
cuid2: "o cuid2",
ulid: "o ULID",
xid: "o XID",
ksuid: "o KSUID",
datetime: "a data e hora ISO",
date: "a data ISO",
time: "a hora ISO",
duration: "a duração ISO",
ipv4: "o endereço IPv4",
ipv6: "o endereço IPv6",
mac: "o endereço MAC",
cidrv4: "a faixa de endereços IPv4",
cidrv6: "a faixa de endereços IPv6",
base64: "o texto codificado em base64",
base64url: "o texto codificado em base64url",
json_string: "o texto JSON",
e164: "o número E.164",
credit_card: "o número de cartão de crédito",
currency_code: "o código de moeda",
iban: "o IBAN",
jwt: "o JWT",
template_literal: "a entrada",
};
const Gender = {
masculine: { definite: "o", indefinite: "um" },
feminine: { definite: "a", indefinite: "uma" },
};
const TypeDictionary = {
string: { name: "texto", articles: Gender.masculine },
number: { name: "número", articles: Gender.masculine },
int: { name: "número inteiro", articles: Gender.masculine },
boolean: { name: "valor booleano", articles: Gender.masculine },
bigint: { name: "número bigint", articles: Gender.masculine },
symbol: { name: "símbolo", articles: Gender.masculine },
undefined: { name: 'valor "undefined"', articles: Gender.masculine },
null: { name: 'valor "nulo"', articles: Gender.masculine },
never: { name: 'valor "never"', articles: Gender.masculine },
void: { name: 'valor "void"', articles: Gender.masculine },
date: { name: "data", articles: Gender.feminine },
array: { name: "vetor", articles: Gender.masculine },
object: { name: "objeto", articles: Gender.masculine },
tuple: { name: "tupla", articles: Gender.feminine },
record: { name: "registro", articles: Gender.masculine },
map: { name: "mapa", articles: Gender.masculine },
set: { name: "conjunto", articles: Gender.masculine },
file: { name: "arquivo", articles: Gender.masculine },
nonoptional: { name: "valor não opcional", articles: Gender.masculine },
nan: { name: 'valor "NaN"', articles: Gender.masculine }, // Compatibility: "nan" -> "NaN" for display
function: { name: "função", articles: Gender.feminine },
};
function translateOriginWithArticle(type, articleType) {
const translatedValue = TypeDictionary[type] ?? { name: `valor "${type}"`, articles: Gender.masculine };
return `${translatedValue.articles[articleType]} ${translatedValue.name}`;
}
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = translateOriginWithArticle(issue.expected, "indefinite");
const receivedType = util.parsedType(issue.input);
const received = translateOriginWithArticle(receivedType, "indefinite");
return `Entrada inválida: esperava ${expected}, recebeu ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Entrada inválida: esperava ${util.stringifyPrimitive(issue.values[0])}`;
return `Opção inválida: esperava uma das seguintes opções: ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Grande demais: esperava que ${translateOriginWithArticle(issue.origin, "definite")} tivesse ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "elementos"}`;
return `Grande demais: esperava que ${translateOriginWithArticle(issue.origin, "definite")} fosse ${adj} ${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Pequeno demais: esperava que ${translateOriginWithArticle(issue.origin, "definite")} tivesse ${adj} ${issue.minimum.toString()} ${sizing.unit ?? "elementos"}`;
}
return `Pequeno demais: esperava que ${translateOriginWithArticle(issue.origin, "definite")} fosse ${adj} ${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with") {
return `Texto inválido: deve começar com "${_issue.prefix}"`;
}
if (_issue.format === "ends_with")
return `Texto inválido: deve terminar com "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Texto inválido: deve incluir "${_issue.includes}"`;
if (_issue.format === "regex")
return `Texto inválido: deve corresponder ao padrão ${_issue.pattern}`;
return `Formato d${FormatDictionary[_issue.format] ?? issue.format} inválido`;
}
case "not_multiple_of":
return `Número inválido: deve ser múltiplo de ${issue.divisor}`;
case "unrecognized_keys": {
const plural = issue.keys.length > 1 ? "s" : "";
return `Chave${plural} inválida${plural}: ${util.joinValues(issue.keys, ", ")}`;
}
case "invalid_key":
return `Entrada inválida n${translateOriginWithArticle(issue.origin, "definite")}`;
case "invalid_union":
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
return `Valor de discriminação inválido. Esperava ${opts}`;
}
return "Entrada inválida";
case "invalid_element":
return `Entrada inválida n${translateOriginWithArticle(issue.origin, "definite")}`;
default:
return `Entrada inválida`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
module.exports = exports.default;
@@ -0,0 +1,19 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Tally5 = createLucideIcon("Tally5", [
["path", { d: "M4 4v16", key: "6qkkli" }],
["path", { d: "M9 4v16", key: "81ygyz" }],
["path", { d: "M14 4v16", key: "12vmem" }],
["path", { d: "M19 4v16", key: "8ij5ei" }],
["path", { d: "M22 6 2 18", key: "h9moai" }]
]);
export { Tally5 as default };
//# sourceMappingURL=tally-5.js.map
@@ -0,0 +1,136 @@
import type { $ZodStringFormats } from "../core/checks.js";
import type * as errors from "../core/errors.js";
import * as util from "../core/util.js";
const error: () => errors.$ZodErrorMap = () => {
const Sizable: Record<string, { unit: string; verb: string }> = {
string: { unit: "characters", verb: "to have" },
file: { unit: "bytes", verb: "to have" },
array: { unit: "items", verb: "to have" },
set: { unit: "items", verb: "to have" },
map: { unit: "entries", verb: "to have" },
};
function getSizing(origin: string): { unit: string; verb: string } | null {
return Sizable[origin] ?? null;
}
const FormatDictionary: {
[k in $ZodStringFormats | (string & {})]?: string;
} = {
regex: "input",
email: "email address",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO datetime",
date: "ISO date",
time: "ISO time",
duration: "ISO duration",
ipv4: "IPv4 address",
ipv6: "IPv6 address",
mac: "MAC address",
cidrv4: "IPv4 range",
cidrv6: "IPv6 range",
base64: "base64-encoded string",
base64url: "base64url-encoded string",
json_string: "JSON string",
e164: "E.164 number",
currency_code: "currency code",
credit_card: "credit card number",
iban: "IBAN",
jwt: "JWT",
template_literal: "input",
};
// type names: missing keys = do not translate (use raw value via ?? fallback)
const TypeDictionary: {
[k in errors.$ZodInvalidTypeExpected | (string & {})]?: string;
} = {
// Compatibility: "nan" -> "NaN" for display
nan: "NaN",
// All other type names omitted - they fall back to raw values via ?? operator
};
function getTypeName(type: errors.$ZodInvalidTypeExpected, input?: unknown): string {
if (type === "number" && typeof input === "number" && !Number.isFinite(input)) {
return String(input);
}
return TypeDictionary[type] ?? type;
}
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = getTypeName(issue.expected);
const receivedType = util.parsedType(issue.input);
const received = getTypeName(receivedType, issue.input);
return `Invalid input: expected ${expected}, received ${received}`;
}
case "invalid_value":
if (issue.values.length === 1) return `Invalid input: expected ${util.stringifyPrimitive(issue.values[0])}`;
return `Invalid option: expected one of ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue as errors.$ZodStringFormatIssues;
if (_issue.format === "starts_with") {
return `Invalid string: must start with "${_issue.prefix}"`;
}
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Invalid number: must be a multiple of ${issue.divisor}`;
case "unrecognized_keys":
return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Invalid key in ${issue.origin}`;
case "invalid_union":
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
return `Invalid discriminator value. Expected ${opts}`;
}
if (issue.inclusive === false) {
return "Invalid input: more than one option matched";
}
return "Invalid input";
case "invalid_element":
return `Invalid value in ${issue.origin}`;
default:
return `Invalid input`;
}
};
};
export default function (): { localeError: errors.$ZodErrorMap } {
return {
localeError: error(),
};
}
@@ -0,0 +1 @@
{"version":3,"file":"align-horizontal-distribute-start.js","sources":["../../../src/icons/align-horizontal-distribute-start.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name AlignHorizontalDistributeStart\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iNiIgaGVpZ2h0PSIxNCIgeD0iNCIgeT0iNSIgcng9IjIiIC8+CiAgPHJlY3Qgd2lkdGg9IjYiIGhlaWdodD0iMTAiIHg9IjE0IiB5PSI3IiByeD0iMiIgLz4KICA8cGF0aCBkPSJNNCAydjIwIiAvPgogIDxwYXRoIGQ9Ik0xNCAydjIwIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/align-horizontal-distribute-start\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst AlignHorizontalDistributeStart = createLucideIcon('AlignHorizontalDistributeStart', [\n ['rect', { width: '6', height: '14', x: '4', y: '5', rx: '2', key: '1wwnby' }],\n ['rect', { width: '6', height: '10', x: '14', y: '7', rx: '2', key: '1fe6j6' }],\n ['path', { d: 'M4 2v20', key: 'gtpd5x' }],\n ['path', { d: 'M14 2v20', key: 'tg6bpw' }],\n]);\n\nexport default AlignHorizontalDistributeStart;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiC,iBAAiB,gCAAkC,CAAA,CAAA,CAAA;AAAA,CAAA,CACxF,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,KAAK,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC7E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,KAAK,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,GAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC9E,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,397 @@
#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const node_http_1 = require("node:http");
const node_readline_1 = require("node:readline");
const node_url_1 = require("node:url");
const index_js_1 = require("../../client/index.js");
const streamableHttp_js_1 = require("../../client/streamableHttp.js");
const types_js_1 = require("../../types.js");
const auth_js_1 = require("../../client/auth.js");
const simpleOAuthClientProvider_js_1 = require("./simpleOAuthClientProvider.js");
// Configuration
const DEFAULT_SERVER_URL = 'http://localhost:3000/mcp';
const CALLBACK_PORT = 8090; // Use different port than auth server (3001)
const CALLBACK_URL = `http://localhost:${CALLBACK_PORT}/callback`;
/**
* Interactive MCP client with OAuth authentication
* Demonstrates the complete OAuth flow with browser-based authorization
*/
class InteractiveOAuthClient {
constructor(serverUrl, clientMetadataUrl) {
this.serverUrl = serverUrl;
this.clientMetadataUrl = clientMetadataUrl;
this.client = null;
this.rl = (0, node_readline_1.createInterface)({
input: process.stdin,
output: process.stdout
});
}
/**
* Prompts user for input via readline
*/
async question(query) {
return new Promise(resolve => {
this.rl.question(query, resolve);
});
}
/**
* Example OAuth callback handler - in production, use a more robust approach
* for handling callbacks and storing tokens
*/
/**
* Starts a temporary HTTP server to receive the OAuth callback
*/
async waitForOAuthCallback() {
return new Promise((resolve, reject) => {
const server = (0, node_http_1.createServer)((req, res) => {
// Ignore favicon requests
if (req.url === '/favicon.ico') {
res.writeHead(404);
res.end();
return;
}
console.log(`📥 Received callback: ${req.url}`);
const parsedUrl = new node_url_1.URL(req.url || '', 'http://localhost');
const code = parsedUrl.searchParams.get('code');
const error = parsedUrl.searchParams.get('error');
if (code) {
console.log(`✅ Authorization code received: ${code?.substring(0, 10)}...`);
res.writeHead(200, { 'Content-Type': 'text/html' });
res.end(`
<html>
<body>
<h1>Authorization Successful!</h1>
<p>You can close this window and return to the terminal.</p>
<script>setTimeout(() => window.close(), 2000);</script>
</body>
</html>
`);
resolve(code);
setTimeout(() => server.close(), 3000);
}
else if (error) {
console.log(`❌ Authorization error: ${error}`);
res.writeHead(400, { 'Content-Type': 'text/html' });
res.end(`
<html>
<body>
<h1>Authorization Failed</h1>
<p>Error: ${error}</p>
</body>
</html>
`);
reject(new Error(`OAuth authorization failed: ${error}`));
}
else {
console.log(`❌ No authorization code or error in callback`);
res.writeHead(400);
res.end('Bad request');
reject(new Error('No authorization code provided'));
}
});
server.listen(CALLBACK_PORT, () => {
console.log(`OAuth callback server started on http://localhost:${CALLBACK_PORT}`);
});
});
}
async attemptConnection(oauthProvider) {
console.log('🚢 Creating transport with OAuth provider...');
const baseUrl = new node_url_1.URL(this.serverUrl);
const transport = new streamableHttp_js_1.StreamableHTTPClientTransport(baseUrl, {
authProvider: oauthProvider
});
console.log('🚢 Transport created');
try {
console.log('🔌 Attempting connection (this will trigger OAuth redirect)...');
await this.client.connect(transport);
console.log('✅ Connected successfully');
}
catch (error) {
if (error instanceof auth_js_1.UnauthorizedError) {
console.log('🔐 OAuth required - waiting for authorization...');
const callbackPromise = this.waitForOAuthCallback();
const authCode = await callbackPromise;
await transport.finishAuth(authCode);
console.log('🔐 Authorization code received:', authCode);
console.log('🔌 Reconnecting with authenticated transport...');
await this.attemptConnection(oauthProvider);
}
else {
console.error('❌ Connection failed with non-auth error:', error);
throw error;
}
}
}
/**
* Establishes connection to the MCP server with OAuth authentication
*/
async connect() {
console.log(`🔗 Attempting to connect to ${this.serverUrl}...`);
const clientMetadata = {
client_name: 'Simple OAuth MCP Client',
redirect_uris: [CALLBACK_URL],
grant_types: ['authorization_code', 'refresh_token'],
response_types: ['code'],
token_endpoint_auth_method: 'client_secret_post'
};
console.log('🔐 Creating OAuth provider...');
const oauthProvider = new simpleOAuthClientProvider_js_1.InMemoryOAuthClientProvider(CALLBACK_URL, clientMetadata, (redirectUrl) => {
console.log(`\n🔗 Please open this URL in your browser to authorize:\n ${redirectUrl.toString()}`);
}, this.clientMetadataUrl);
console.log('🔐 OAuth provider created');
console.log('👤 Creating MCP client...');
this.client = new index_js_1.Client({
name: 'simple-oauth-client',
version: '1.0.0'
}, { capabilities: {} });
console.log('👤 Client created');
console.log('🔐 Starting OAuth flow...');
await this.attemptConnection(oauthProvider);
// Start interactive loop
await this.interactiveLoop();
}
/**
* Main interactive loop for user commands
*/
async interactiveLoop() {
console.log('\n🎯 Interactive MCP Client with OAuth');
console.log('Commands:');
console.log(' list - List available tools');
console.log(' call <tool_name> [args] - Call a tool');
console.log(' stream <tool_name> [args] - Call a tool with streaming (shows task status)');
console.log(' quit - Exit the client');
console.log();
while (true) {
try {
const command = await this.question('mcp> ');
if (!command.trim()) {
continue;
}
if (command === 'quit') {
console.log('\n👋 Goodbye!');
this.close();
process.exit(0);
}
else if (command === 'list') {
await this.listTools();
}
else if (command.startsWith('call ')) {
await this.handleCallTool(command);
}
else if (command.startsWith('stream ')) {
await this.handleStreamTool(command);
}
else {
console.log("❌ Unknown command. Try 'list', 'call <tool_name>', 'stream <tool_name>', or 'quit'");
}
}
catch (error) {
if (error instanceof Error && error.message === 'SIGINT') {
console.log('\n\n👋 Goodbye!');
break;
}
console.error('❌ Error:', error);
}
}
}
async listTools() {
if (!this.client) {
console.log('❌ Not connected to server');
return;
}
try {
const request = {
method: 'tools/list',
params: {}
};
const result = await this.client.request(request, types_js_1.ListToolsResultSchema);
if (result.tools && result.tools.length > 0) {
console.log('\n📋 Available tools:');
result.tools.forEach((tool, index) => {
console.log(`${index + 1}. ${tool.name}`);
if (tool.description) {
console.log(` Description: ${tool.description}`);
}
console.log();
});
}
else {
console.log('No tools available');
}
}
catch (error) {
console.error('❌ Failed to list tools:', error);
}
}
async handleCallTool(command) {
const parts = command.split(/\s+/);
const toolName = parts[1];
if (!toolName) {
console.log('❌ Please specify a tool name');
return;
}
// Parse arguments (simple JSON-like format)
let toolArgs = {};
if (parts.length > 2) {
const argsString = parts.slice(2).join(' ');
try {
toolArgs = JSON.parse(argsString);
}
catch {
console.log('❌ Invalid arguments format (expected JSON)');
return;
}
}
await this.callTool(toolName, toolArgs);
}
async callTool(toolName, toolArgs) {
if (!this.client) {
console.log('❌ Not connected to server');
return;
}
try {
const request = {
method: 'tools/call',
params: {
name: toolName,
arguments: toolArgs
}
};
const result = await this.client.request(request, types_js_1.CallToolResultSchema);
console.log(`\n🔧 Tool '${toolName}' result:`);
if (result.content) {
result.content.forEach(content => {
if (content.type === 'text') {
console.log(content.text);
}
else {
console.log(content);
}
});
}
else {
console.log(result);
}
}
catch (error) {
console.error(`❌ Failed to call tool '${toolName}':`, error);
}
}
async handleStreamTool(command) {
const parts = command.split(/\s+/);
const toolName = parts[1];
if (!toolName) {
console.log('❌ Please specify a tool name');
return;
}
// Parse arguments (simple JSON-like format)
let toolArgs = {};
if (parts.length > 2) {
const argsString = parts.slice(2).join(' ');
try {
toolArgs = JSON.parse(argsString);
}
catch {
console.log('❌ Invalid arguments format (expected JSON)');
return;
}
}
await this.streamTool(toolName, toolArgs);
}
async streamTool(toolName, toolArgs) {
if (!this.client) {
console.log('❌ Not connected to server');
return;
}
try {
// Using the experimental tasks API - WARNING: may change without notice
console.log(`\n🔧 Streaming tool '${toolName}'...`);
const stream = this.client.experimental.tasks.callToolStream({
name: toolName,
arguments: toolArgs
}, types_js_1.CallToolResultSchema, {
task: {
taskId: `task-${Date.now()}`,
ttl: 60000
}
});
// Iterate through all messages yielded by the generator
for await (const message of stream) {
switch (message.type) {
case 'taskCreated':
console.log(`✓ Task created: ${message.task.taskId}`);
break;
case 'taskStatus':
console.log(`⟳ Status: ${message.task.status}`);
if (message.task.statusMessage) {
console.log(` ${message.task.statusMessage}`);
}
break;
case 'result':
console.log('✓ Completed!');
message.result.content.forEach(content => {
if (content.type === 'text') {
console.log(content.text);
}
else {
console.log(content);
}
});
break;
case 'error':
console.log('✗ Error:');
console.log(` ${message.error.message}`);
break;
}
}
}
catch (error) {
console.error(`❌ Failed to stream tool '${toolName}':`, error);
}
}
close() {
this.rl.close();
if (this.client) {
// Note: Client doesn't have a close method in the current implementation
// This would typically close the transport connection
}
}
}
/**
* Main entry point
*/
async function main() {
const args = process.argv.slice(2);
const serverUrl = args[0] || DEFAULT_SERVER_URL;
const clientMetadataUrl = args[1];
console.log('🚀 Simple MCP OAuth Client');
console.log(`Connecting to: ${serverUrl}`);
if (clientMetadataUrl) {
console.log(`Client Metadata URL: ${clientMetadataUrl}`);
}
console.log();
const client = new InteractiveOAuthClient(serverUrl, clientMetadataUrl);
// Handle graceful shutdown
process.on('SIGINT', () => {
console.log('\n\n👋 Goodbye!');
client.close();
process.exit(0);
});
try {
await client.connect();
}
catch (error) {
console.error('Failed to start client:', error);
process.exit(1);
}
finally {
client.close();
}
}
// Run if this file is executed directly
main().catch(error => {
console.error('Unhandled error:', error);
process.exit(1);
});
//# sourceMappingURL=simpleOAuthClient.js.map
@@ -0,0 +1 @@
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS;AACT,yDAA0C;AAC1C,sDAAwB;AACxB,+BAAqC;AACrC,uDAA+C;AAM/C,yCAAmC;AACnC,2EAAkE;AAElE,MAAM,mBAAmB,GAAG,CAAC,GAAe,EAAE,EAAE;IAC9C,MAAM,WAAW,GAAG,GAAG,CAAC,WAAW,CAAA;IACnC,GAAG,CAAC,WAAW;QACb,WAAW,CAAC,CAAC;YACX,CAAC,CAAC,EAAE;gBACF,WAAW,CAAC,CAAC,CAAC,CAAA;gBACd,CAAC,CAAC,MAAM,EAAE,CAAA;YACZ,CAAC;YACH,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;AACrB,CAAC,CAAA;AAED,yDAAyD;AACzD,6CAA6C;AACtC,MAAM,WAAW,GAAG,CAAC,GAAe,EAAE,KAAe,EAAE,EAAE;IAC9D,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAA,gDAAoB,EAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAChD,CAAA;IACD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAA;IAEzB,gCAAgC;IAChC,MAAM,GAAG,GAAG,GAAG,CAAA;IACf,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,IAAY,EAAE,EAAE,KAAK,GAAG,CAAC,EAAW,EAAE;QAClE,yCAAyC;QACzC,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;YACjB,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;YACpB,OAAO,KAAK,CAAA;QACd,CAAC;QACD,oBAAoB;QACpB,MAAM,IAAI,GAAG,CAAC,IAAI,IAAA,YAAK,EAAC,IAAI,CAAC,CAAC,IAAI,IAAI,GAAG,CAAA;QACzC,IAAI,GAAY,CAAA;QAChB,IAAI,IAAI,KAAK,IAAI;YAAE,GAAG,GAAG,KAAK,CAAA;aACzB,CAAC;YACJ,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACvB,GAAG,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;QACpE,CAAC;QAED,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAClB,OAAO,GAAG,CAAA;IACZ,CAAC,CAAA;IAED,GAAG,CAAC,MAAM;QACR,MAAM,CAAC,CAAC;YACN,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACd,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,IAAA,gDAAoB,EAAC,IAAI,CAAC,CAAC;YAC7D,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAA,gDAAoB,EAAC,IAAI,CAAC,CAAC,CAAA;AAChD,CAAC,CAAA;AAhCY,QAAA,WAAW,eAgCvB;AAED,MAAM,YAAY,GAAG,CAAC,GAAuB,EAAE,EAAE;IAC/C,MAAM,CAAC,GAAG,IAAI,iBAAM,CAAC,GAAG,CAAC,CAAA;IACzB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;IACrB,IAAI,EAAsB,CAAA;IAC1B,IAAI,CAAC;QACH,EAAE,GAAG,iBAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAC3B,MAAM,IAAI,GAAa,iBAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QACvC,MAAM,QAAQ,GAAW,GAAG,CAAC,WAAW,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;QAC5D,IAAI,IAAI,CAAC,IAAI,GAAG,QAAQ,EAAE,CAAC;YACzB,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACzC,MAAM,IAAI,GAAG,iBAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;YAClD,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAA;QAC9D,CAAC;aAAM,CAAC;YACN,IAAI,GAAG,GAAG,CAAC,CAAA;YACX,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;YACxC,OAAO,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;gBACvB,MAAM,SAAS,GAAG,iBAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;gBACxD,IAAI,SAAS,KAAK,CAAC;oBAAE,MAAK;gBAC1B,GAAG,IAAI,SAAS,CAAA;gBAChB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAA;YACrC,CAAC;YACD,CAAC,CAAC,GAAG,EAAE,CAAA;QACT,CAAC;IACH,CAAC;YAAS,CAAC;QACT,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;YAC3B,IAAI,CAAC;gBACH,iBAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;gBAChB,oBAAoB;YACtB,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;QACZ,CAAC;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CACf,GAAmB,EACnB,MAAgB,EACD,EAAE;IACjB,MAAM,KAAK,GAAG,IAAI,iBAAM,CAAC,GAAG,CAAC,CAAA;IAC7B,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,IAAI,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;IAEpD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAA;IACrB,MAAM,CAAC,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QACzB,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAExB,iBAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE;YACzB,IAAI,EAAE,EAAE,CAAC;gBACP,MAAM,CAAC,EAAE,CAAC,CAAA;YACZ,CAAC;iBAAM,CAAC;gBACN,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE;oBACtC,QAAQ,EAAE,QAAQ;oBAClB,IAAI,EAAE,IAAI,CAAC,IAAI;iBAChB,CAAC,CAAA;gBACF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;gBAC1B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACpB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AAEY,QAAA,IAAI,GAAG,IAAA,6BAAW,EAC7B,YAAY,EACZ,QAAQ,EACR,GAAG,CAAC,EAAE,CAAC,IAAI,iBAAM,CAAC,GAAG,CAA4B,EACjD,GAAG,CAAC,EAAE,CAAC,IAAI,iBAAM,CAAC,GAAG,CAAC,EACtB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;IACb,IAAI,KAAK,EAAE,MAAM;QAAE,IAAA,mBAAW,EAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC1C,IAAI,CAAC,GAAG,CAAC,QAAQ;QAAE,mBAAmB,CAAC,GAAG,CAAC,CAAA;AAC7C,CAAC,CACF,CAAA","sourcesContent":["// tar -t\nimport * as fsm from '@isaacs/fs-minipass'\nimport fs from 'node:fs'\nimport { dirname, parse } from 'path'\nimport { makeCommand } from './make-command.js'\nimport type {\n TarOptions,\n TarOptionsFile,\n TarOptionsSyncFile,\n} from './options.js'\nimport { Parser } from './parse.js'\nimport { stripTrailingSlashes } from './strip-trailing-slashes.js'\n\nconst onReadEntryFunction = (opt: TarOptions) => {\n const onReadEntry = opt.onReadEntry\n opt.onReadEntry =\n onReadEntry ?\n e => {\n onReadEntry(e)\n e.resume()\n }\n : e => e.resume()\n}\n\n// construct a filter that limits the file entries listed\n// iLine truncated
@@ -0,0 +1,23 @@
import units from "./units.mjs";
const { DATE, DAY, HOUR, MILLISECOND, MINUTE, MONTH, SECOND, TIME, YEAR } = units;
const compatUnits = {};
function mapUnit(key, ...args) {
for (let i = 0; i < arguments.length; i++) {
compatUnits[arguments[i]] = key;
}
}
mapUnit(YEAR, "Y", "y", "years");
mapUnit(MONTH, "M", "months");
mapUnit(DATE, "D", "dates");
mapUnit(DAY, "d", "days");
mapUnit(HOUR, "h", "hours");
mapUnit(MINUTE, "m", "minutes");
mapUnit(SECOND, "s", "seconds");
mapUnit(MILLISECOND, "ms", "milliseconds");
mapUnit(TIME, "t");
function normalizeUnit(u) {
return compatUnits[u];
}
export {
normalizeUnit as n
};
@@ -0,0 +1 @@
{"version":3,"file":"chevron-left-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,74 @@
function memo(getDeps, fn, opts) {
let deps = opts.initialDeps ?? [];
let result;
let isInitial = true;
function memoizedFunction() {
var _a;
const debugEnabled = process.env.NODE_ENV !== "production" && !!opts.key && !!((_a = opts.debug) == null ? void 0 : _a.call(opts));
let depTime = 0;
if (debugEnabled) depTime = Date.now();
const newDeps = getDeps();
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
if (!depsChanged) {
return result;
}
deps = newDeps;
let resultTime = 0;
if (debugEnabled) resultTime = Date.now();
result = fn(...newDeps);
if (debugEnabled) {
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
const resultFpsPercentage = resultEndTime / 16;
const pad = (str, num) => {
str = String(str);
while (str.length < num) {
str = " " + str;
}
return str;
};
console.info(
`%c⏱ ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
`
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(
0,
Math.min(120 - 120 * resultFpsPercentage, 120)
)}deg 100% 31%);`,
opts == null ? void 0 : opts.key
);
}
if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) {
opts.onChange(result);
}
isInitial = false;
return result;
}
memoizedFunction.updateDeps = (newDeps) => {
deps = newDeps;
};
return memoizedFunction;
}
function notUndefined(value, msg) {
if (value === void 0) {
throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
} else {
return value;
}
}
const approxEqual = (a, b) => Math.abs(a - b) < 1.01;
const debounce = (targetWindow, fn, ms) => {
let timeoutId;
return function(...args) {
targetWindow.clearTimeout(timeoutId);
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
};
};
export {
approxEqual,
debounce,
memo,
notUndefined
};
//# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
{"version":3,"file":"badge-alert.js","sources":["../../../src/icons/badge-alert.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BadgeAlert\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMy44NSA4LjYyYTQgNCAwIDAgMSA0Ljc4LTQuNzcgNCA0IDAgMCAxIDYuNzQgMCA0IDQgMCAwIDEgNC43OCA0Ljc4IDQgNCAwIDAgMSAwIDYuNzQgNCA0IDAgMCAxLTQuNzcgNC43OCA0IDQgMCAwIDEtNi43NSAwIDQgNCAwIDAgMS00Ljc4LTQuNzcgNCA0IDAgMCAxIDAtNi43NloiIC8+CiAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIiIHkxPSI4IiB5Mj0iMTIiIC8+CiAgPGxpbmUgeDE9IjEyIiB4Mj0iMTIuMDEiIHkxPSIxNiIgeTI9IjE2IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/badge-alert\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst BadgeAlert = createLucideIcon('BadgeAlert', [\n [\n 'path',\n {\n d: 'M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z',\n key: '3c2336',\n },\n ],\n ['line', { x1: '12', x2: '12', y1: '8', y2: '12', key: '1pkeuh' }],\n ['line', { x1: '12', x2: '12.01', y1: '16', y2: '16', key: '4dfq90' }],\n]);\n\nexport default BadgeAlert;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAChD,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACjE,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACvE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,6 @@
import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types";
export type ItemsError = ErrorObject<"items", {
limit: number;
}, AnySchema>;
declare const def: CodeKeywordDefinition;
export default def;
@@ -0,0 +1,340 @@
import type { Primitive } from "./helpers/typeAliases.js";
import { util, type ZodParsedType } from "./helpers/util.js";
import type { TypeOf, ZodType } from "./index.js";
type allKeys<T> = T extends any ? keyof T : never;
export type inferFlattenedErrors<T extends ZodType<any, any, any>, U = string> = typeToFlattenedError<TypeOf<T>, U>;
export type typeToFlattenedError<T, U = string> = {
formErrors: U[];
fieldErrors: {
[P in allKeys<T>]?: U[];
};
};
export const ZodIssueCode = util.arrayToEnum([
"invalid_type",
"invalid_literal",
"custom",
"invalid_union",
"invalid_union_discriminator",
"invalid_enum_value",
"unrecognized_keys",
"invalid_arguments",
"invalid_return_type",
"invalid_date",
"invalid_string",
"too_small",
"too_big",
"invalid_intersection_types",
"not_multiple_of",
"not_finite",
]);
export type ZodIssueCode = keyof typeof ZodIssueCode;
export type ZodIssueBase = {
path: (string | number)[];
message?: string | undefined;
};
export interface ZodInvalidTypeIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_type;
expected: ZodParsedType;
received: ZodParsedType;
}
export interface ZodInvalidLiteralIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_literal;
expected: unknown;
received: unknown;
}
export interface ZodUnrecognizedKeysIssue extends ZodIssueBase {
code: typeof ZodIssueCode.unrecognized_keys;
keys: string[];
}
export interface ZodInvalidUnionIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_union;
unionErrors: ZodError[];
}
export interface ZodInvalidUnionDiscriminatorIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_union_discriminator;
options: Primitive[];
}
export interface ZodInvalidEnumValueIssue extends ZodIssueBase {
received: string | number;
code: typeof ZodIssueCode.invalid_enum_value;
options: (string | number)[];
}
export interface ZodInvalidArgumentsIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_arguments;
argumentsError: ZodError;
}
export interface ZodInvalidReturnTypeIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_return_type;
returnTypeError: ZodError;
}
export interface ZodInvalidDateIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_date;
}
export type StringValidation =
| "email"
| "url"
| "emoji"
| "uuid"
| "nanoid"
| "regex"
| "cuid"
| "cuid2"
| "ulid"
| "datetime"
| "date"
| "time"
| "duration"
| "ip"
| "cidr"
| "base64"
| "jwt"
| "base64url"
| { includes: string; position?: number | undefined }
| { startsWith: string }
| { endsWith: string };
export interface ZodInvalidStringIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_string;
validation: StringValidation;
}
export interface ZodTooSmallIssue extends ZodIssueBase {
code: typeof ZodIssueCode.too_small;
minimum: number | bigint;
inclusive: boolean;
exact?: boolean;
type: "array" | "string" | "number" | "set" | "date" | "bigint";
}
export interface ZodTooBigIssue extends ZodIssueBase {
code: typeof ZodIssueCode.too_big;
maximum: number | bigint;
inclusive: boolean;
exact?: boolean;
type: "array" | "string" | "number" | "set" | "date" | "bigint";
}
export interface ZodInvalidIntersectionTypesIssue extends ZodIssueBase {
code: typeof ZodIssueCode.invalid_intersection_types;
}
export interface ZodNotMultipleOfIssue extends ZodIssueBase {
code: typeof ZodIssueCode.not_multiple_of;
multipleOf: number | bigint;
}
export interface ZodNotFiniteIssue extends ZodIssueBase {
code: typeof ZodIssueCode.not_finite;
}
export interface ZodCustomIssue extends ZodIssueBase {
code: typeof ZodIssueCode.custom;
params?: { [k: string]: any };
}
export type DenormalizedError = { [k: string]: DenormalizedError | string[] };
export type ZodIssueOptionalMessage =
| ZodInvalidTypeIssue
| ZodInvalidLiteralIssue
| ZodUnrecognizedKeysIssue
| ZodInvalidUnionIssue
| ZodInvalidUnionDiscriminatorIssue
| ZodInvalidEnumValueIssue
| ZodInvalidArgumentsIssue
| ZodInvalidReturnTypeIssue
| ZodInvalidDateIssue
| ZodInvalidStringIssue
| ZodTooSmallIssue
| ZodTooBigIssue
| ZodInvalidIntersectionTypesIssue
| ZodNotMultipleOfIssue
| ZodNotFiniteIssue
| ZodCustomIssue;
export type ZodIssue = ZodIssueOptionalMessage & {
fatal?: boolean | undefined;
message: string;
};
export const quotelessJson = (obj: any) => {
const json = JSON.stringify(obj, null, 2);
return json.replace(/"([^"]+)":/g, "$1:");
};
type recursiveZodFormattedError<T> = T extends [any, ...any[]]
? { [K in keyof T]?: ZodFormattedError<T[K]> }
: T extends any[]
? { [k: number]: ZodFormattedError<T[number]> }
: T extends object
? { [K in keyof T]?: ZodFormattedError<T[K]> }
: unknown;
export type ZodFormattedError<T, U = string> = {
_errors: U[];
} & recursiveZodFormattedError<NonNullable<T>>;
export type inferFormattedError<T extends ZodType<any, any, any>, U = string> = ZodFormattedError<TypeOf<T>, U>;
export class ZodError<T = any> extends Error {
issues: ZodIssue[] = [];
get errors() {
return this.issues;
}
constructor(issues: ZodIssue[]) {
super();
const actualProto = new.target.prototype;
if (Object.setPrototypeOf) {
// eslint-disable-next-line ban/ban
Object.setPrototypeOf(this, actualProto);
} else {
(this as any).__proto__ = actualProto;
}
this.name = "ZodError";
this.issues = issues;
}
format(): ZodFormattedError<T>;
format<U>(mapper: (issue: ZodIssue) => U): ZodFormattedError<T, U>;
format(_mapper?: any) {
const mapper: (issue: ZodIssue) => any =
_mapper ||
function (issue: ZodIssue) {
return issue.message;
};
const fieldErrors: ZodFormattedError<T> = { _errors: [] } as any;
const processError = (error: ZodError) => {
for (const issue of error.issues) {
if (issue.code === "invalid_union") {
issue.unionErrors.map(processError);
} else if (issue.code === "invalid_return_type") {
processError(issue.returnTypeError);
} else if (issue.code === "invalid_arguments") {
processError(issue.argumentsError);
} else if (issue.path.length === 0) {
(fieldErrors as any)._errors.push(mapper(issue));
} else {
let curr: any = fieldErrors;
let i = 0;
while (i < issue.path.length) {
const el = issue.path[i]!;
const terminal = i === issue.path.length - 1;
// `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead of treating its array as a child.
if (el === "_errors") {
if (terminal) curr._errors.push(mapper(issue));
i++;
continue;
}
// Create `el` as an own data property. A segment naming an inherited member ("toString", "constructor") would otherwise read through to the prototype, and assigning "__proto__" would hit the setter and walk into Object.prototype.
if (!Object.prototype.hasOwnProperty.call(curr, el)) {
if (el === "__proto__") {
Object.defineProperty(curr, el, {
value: { _errors: [] },
writable: true,
enumerable: true,
configurable: true,
});
} else {
curr[el] = { _errors: [] };
}
}
curr = curr[el];
if (terminal) {
curr._errors.push(mapper(issue));
}
i++;
}
}
}
};
processError(this);
return fieldErrors;
}
static create = (issues: ZodIssue[]) => {
const error = new ZodError(issues);
return error;
};
static assert(value: unknown): asserts value is ZodError {
if (!(value instanceof ZodError)) {
throw new Error(`Not a ZodError: ${value}`);
}
}
override toString() {
return this.message;
}
override get message() {
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
}
get isEmpty(): boolean {
return this.issues.length === 0;
}
addIssue = (sub: ZodIssue) => {
this.issues = [...this.issues, sub];
};
addIssues = (subs: ZodIssue[] = []) => {
this.issues = [...this.issues, ...subs];
};
flatten(): typeToFlattenedError<T>;
flatten<U>(mapper?: (issue: ZodIssue) => U): typeToFlattenedError<T, U>;
flatten<U = string>(mapper: (issue: ZodIssue) => U = (issue: ZodIssue) => issue.message as any): any {
const fieldErrors: any = Object.create(null);
const formErrors: U[] = [];
for (const sub of this.issues) {
if (sub.path.length > 0) {
const firstEl = sub.path[0]!;
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
fieldErrors[firstEl].push(mapper(sub));
} else {
formErrors.push(mapper(sub));
}
}
return { formErrors, fieldErrors };
}
get formErrors() {
return this.flatten();
}
}
type stripPath<T extends object> = T extends any ? util.OmitKeys<T, "path"> : never;
export type IssueData = stripPath<ZodIssueOptionalMessage> & {
path?: (string | number)[];
fatal?: boolean | undefined;
};
export type ErrorMapCtx = {
defaultError: string;
data: any;
};
export type ZodErrorMap = (issue: ZodIssueOptionalMessage, _ctx: ErrorMapCtx) => { message: string };
@@ -0,0 +1,69 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Ivan Kopeykin @vankop
*/
"use strict";
const forEachBail = require("./forEachBail");
/** @typedef {import("./Resolver")} Resolver */
/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
class RootsPlugin {
/**
* @param {string | ResolveStepHook} source source hook
* @param {Set<string>} roots roots
* @param {string | ResolveStepHook} target target hook
*/
constructor(source, roots, target) {
this.roots = [...roots];
this.source = source;
this.target = target;
}
/**
* @param {Resolver} resolver the resolver
* @returns {void}
*/
apply(resolver) {
const target = resolver.ensureHook(this.target);
resolver
.getHook(this.source)
.tapAsync("RootsPlugin", (request, resolveContext, callback) => {
const req = request.request;
if (!req) return callback();
if (!req.startsWith("/")) return callback();
forEachBail(
this.roots,
/**
* @param {string} root root
* @param {(err?: null | Error, result?: null | ResolveRequest) => void} callback callback
* @returns {void}
*/
(root, callback) => {
const path = resolver.join(root, req.slice(1));
/** @type {ResolveRequest} */
const obj = {
...request,
path,
relativePath: request.relativePath && path,
};
resolver.doResolve(
target,
obj,
`root path ${root}`,
resolveContext,
callback,
);
},
callback,
);
});
}
}
module.exports = RootsPlugin;
@@ -0,0 +1,91 @@
import { createNullObject } from "../utils.js";
//#region src/router/reg-exp-router/node.ts
const LABEL_REG_EXP_STR = "[^/]+";
const ONLY_WILDCARD_REG_EXP_STR = ".*";
const TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
const PATH_ERROR = Symbol();
const regExpMetaChars = /* @__PURE__ */ new Set(".\\+*[^]$()");
/**
* Sort order:
* 1. literal
* 2. special pattern (e.g. :label{[0-9]+})
* 3. common label pattern (e.g. :label)
* 4. wildcard
*/
function compareKey(a, b) {
if (a.length === 1) return b.length === 1 ? a < b ? -1 : 1 : -1;
if (b.length === 1) return 1;
if (a === ".*" || a === "(?:|/.*)") return b === "(?:|/.*)" ? -1 : 1;
else if (b === ".*" || b === "(?:|/.*)") return -1;
if (a === "[^/]+") return 1;
else if (b === "[^/]+") return -1;
return a.length === b.length ? a < b ? -1 : 1 : b.length - a.length;
}
var Node = class Node {
#index;
#varIndex;
#children = createNullObject();
insert(tokens, index, paramMap, context, isStatic) {
let node = this;
for (let i = 0, len = tokens.length; i < len; i++) {
const token = tokens[i];
const pattern = token.length === 1 ? token === "*" ? i === len - 1 ? [
"",
"",
".*"
] : [
"",
"",
LABEL_REG_EXP_STR
] : null : token === "/*" ? [
"",
"",
TAIL_WILDCARD_REG_EXP_STR
] : token.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);
let nextNode;
if (pattern) {
const name = pattern[1];
let regexpStr = pattern[2] || "[^/]+";
if (name && pattern[2]) {
if (regexpStr === ".*") throw PATH_ERROR;
regexpStr = regexpStr.replace(/^\((?!\?:)(?=[^)]+\)$)/, "(?:");
if (/\((?!\?:)/.test(regexpStr)) throw PATH_ERROR;
if (regexpStr.length === 1 && regExpMetaChars.has(regexpStr)) throw PATH_ERROR;
}
nextNode = node.#children[regexpStr];
if (!nextNode) {
if (regexpStr !== ".*" && regexpStr !== "(?:|/.*)") {
for (const k in node.#children) if ((regexpStr.length > 1 || k.length > 1) && k !== ".*" && k !== "(?:|/.*)") throw PATH_ERROR;
}
nextNode = node.#children[regexpStr] = new Node();
}
if (name !== "") {
nextNode.#varIndex ??= context.varIndex++;
paramMap.push([name, nextNode.#varIndex]);
}
} else {
nextNode = node.#children[token];
if (!nextNode) {
for (const k in node.#children) if (k.length > 1 && k !== ".*" && k !== "(?:|/.*)") throw PATH_ERROR;
nextNode = node.#children[token] = new Node();
}
}
node = nextNode;
}
if (node.#index !== void 0) throw PATH_ERROR;
node.#index = isStatic ? -1 : index;
}
buildRegExpStr() {
const strList = Object.keys(this.#children).sort(compareKey).map((k) => {
const c = this.#children[k];
const childStr = c.buildRegExpStr();
return childStr === "" ? "" : (typeof c.#varIndex === "number" ? `(${k})@${c.#varIndex}` : regExpMetaChars.has(k) ? `\\${k}` : k) + childStr;
}).filter(Boolean);
if (typeof this.#index === "number" && this.#index !== -1) strList.unshift(`#${this.#index}`);
if (strList.length === 0) return "";
if (strList.length === 1) return strList[0];
return "(?:" + strList.join("|") + ")";
}
};
//#endregion
export { LABEL_REG_EXP_STR, Node, ONLY_WILDCARD_REG_EXP_STR, PATH_ERROR, TAIL_WILDCARD_REG_EXP_STR };
@@ -0,0 +1,618 @@
# MockPool
<!--introduced_in=v4.0.0-->
<!--type=module-->
<!-- source_link=lib/mock/mock-pool.js -->
> Stability: 2 - Stable
A `MockPool` is a [`Pool`][] that intercepts requests matching registered routes
and replies with mocked responses instead of contacting the network. It is
created by a [`MockAgent`][] and exposes the same interception API as
[`MockClient`][].
A `MockPool` is not constructed directly in most cases; instead it is obtained
through [`mockAgent.get(origin)`][]. Once registered as the global dispatcher,
any request whose origin matches the pool is matched against the mocks it holds.
```mjs
import { MockAgent } from 'undici'
const mockAgent = new MockAgent()
const mockPool = mockAgent.get('http://localhost:3000')
```
```cjs
const { MockAgent } = require('undici')
const mockAgent = new MockAgent()
const mockPool = mockAgent.get('http://localhost:3000')
```
## Class: `MockPool`
<!-- YAML
added: v4.0.0
-->
* Extends: {Pool}
Extends [`Pool`][] and implements the `Interceptable` interface, allowing
requests made through it to be matched against registered mocks.
### `new MockPool(origin[, options])`
<!-- YAML
added: v4.0.0
-->
* `origin` {string} The origin to associate this mock pool with. It should only
include the protocol, hostname, and port.
* `options` {MockPoolOptions} Extends the [`Pool`][] options.
* Returns: {MockPool}
The `agent` option is required and must implement the `Agent` interface;
otherwise an `InvalidArgumentError` is thrown.
#### Parameter: `MockPoolOptions`
Extends: `PoolOptions`
* `agent` {MockAgent} The agent to associate this mock pool with.
* `ignoreTrailingSlash` {boolean} Whether trailing slashes should be ignored
when matching the path of intercepted requests. **Default:** `false`.
### `mockPool.intercept(options)`
<!-- YAML
added: v4.0.0
-->
* `options` {MockPoolInterceptOptions} The matching criteria for the requests to
intercept.
* Returns: {MockInterceptor} The interceptor used to define the mocked reply.
Registers a route on the mock pool and returns a [`MockInterceptor`][] for any
matching request that uses the same origin as this mock pool. The interceptor is
then used to define the reply, for example with `reply()` or `replyWithError()`.
Each `intercept()` call is consumed by a single matching request. To match more
than one request, call `intercept()` once per expected request, or use
`persist()` or `times()` on the returned [`MockScope`][]. When no registered
mock matches a request, a real request is attempted unless network connections
have been disabled on the [`MockAgent`][], in which case a `MockNotMatchedError`
is thrown.
A request is intercepted only when every defined matcher passes. The accepted
matcher forms behave as follows:
| Matcher type | Condition to pass |
| :----------: | ---------------------------- |
| `string` | Exact match against the value |
| `RegExp` | The expression must match |
| `Function` | The function must return `true` |
#### Parameter: `MockPoolInterceptOptions`
* `path` {string|RegExp|Function} A matcher for the HTTP request path. The
function form has the signature `(path: string) => boolean`. When a `RegExp`
or function is used, it matches against the request path including all query
parameters in alphabetical order. When a `string` is used, query parameters
can instead be supplied through `query`.
* `method` {string|RegExp|Function} A matcher for the HTTP request method. The
function form has the signature `(method: string) => boolean`.
**Default:** `'GET'`.
* `body` {string|RegExp|Function} A matcher for the HTTP request body. The
function form has the signature `(body: string) => boolean`.
* `headers` {Object|Function} A matcher for the HTTP request headers, given
either as a map of header name to a `string`, `RegExp`, or
`(value: string) => boolean` matcher, or as a single function that receives
all headers and returns a `boolean`. When a map is used, the request must
match every defined header; extra headers not listed here do not affect
matching.
* `query` {Object} A matcher for the HTTP request query string parameters. Only
applies when a `string` was provided for `path`.
* `ignoreTrailingSlash` {boolean} Whether a trailing slash on `path` is ignored
when matching. Inherited from the mock pool's `ignoreTrailingSlash` option
when not set.
#### Return: `MockInterceptor`
The reply behaviour of a matching request is defined through the returned
`MockInterceptor`.
* `reply(statusCode[, data[, responseOptions]])` {Function} Defines the reply
for a matching request.
* `statusCode` {number} The status code of the mocked reply.
* `data` {string|Buffer|Object|Function} The body of the mocked reply.
Objects are serialized to JSON; strings and `Buffer`s are sent as-is. The
function form has the signature
`(opts: MockResponseCallbackOptions) => string | Buffer | Object` and is
invoked with the incoming request to compute the reply body.
* `responseOptions` {MockResponseOptions} Additional reply options.
**Default:** `{}`.
* Returns: {MockScope}
* `reply(callback)` {Function} Defines the reply for a matching request,
computing all reply options dynamically rather than just the body.
* `callback` {Function} A `(opts: MockResponseCallbackOptions) =>
{ statusCode, data, responseOptions }` function invoked with the incoming
request. The callback may be asynchronous; a returned promise is awaited
and must resolve to the same shape.
* Returns: {MockScope}
* `replyWithError(error)` {Function} Defines an error for a matching request to
throw.
* `error` {Error} The error thrown when a request matches.
* Returns: {MockScope}
* `defaultReplyHeaders(headers)` {Function} Sets default headers included on
every subsequent reply defined on this interceptor, in addition to any headers
set on a specific reply.
* `headers` {Object} A map of header name to value.
* Returns: {MockInterceptor}
* `defaultReplyTrailers(trailers)` {Function} Sets default trailers included on
every subsequent reply defined on this interceptor, in addition to any
trailers set on a specific reply.
* `trailers` {Object} A map of trailer name to value.
* Returns: {MockInterceptor}
* `replyContentLength()` {Function} Sets an automatically calculated
`content-length` header on every subsequent reply defined on this interceptor.
* Returns: {MockInterceptor}
By default, `reply()` and `replyWithError()` define the behaviour for the first
matching request only; subsequent requests are not affected unless `persist()`
or `times()` is used on the returned [`MockScope`][].
#### Parameter: `MockResponseCallbackOptions`
The argument passed to the `reply()` data and options callbacks.
* `path` {string} The path of the intercepted request.
* `method` {string} The method of the intercepted request.
* `headers` {Object|Headers} The headers of the intercepted request.
* `origin` {string} The origin of the intercepted request.
* `body` {string|null} The body of the intercepted request.
#### Parameter: `MockResponseOptions`
* `headers` {Object} Headers to include on the mocked reply.
* `trailers` {Object} Trailers to include on the mocked reply.
#### Return: `MockScope`
A `MockScope` is associated with a single [`MockInterceptor`][] and configures
how many times the defined reply is used.
* `delay(waitInMs)` {Function} Delays the associated reply by a set amount of
time.
* `waitInMs` {number} The delay in milliseconds.
* Returns: {MockScope}
* `persist()` {Function} Makes the associated reply match indefinitely, so every
matching request receives the defined response.
* Returns: {MockScope}
* `times(repeatTimes)` {Function} Makes the associated reply match a fixed number
of times. This is overridden by `persist()`.
* `repeatTimes` {number} The number of matching requests the reply applies to.
* Returns: {MockScope}
The following examples show common interception patterns.
```mjs displayName="Basic mocked request"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({ path: '/foo' }).reply(200, 'foo')
const { statusCode, body } = await request('http://localhost:3000/foo')
console.log('response received', statusCode) // response received 200
for await (const data of body) {
console.log('data', data.toString('utf8')) // data foo
}
```
```mjs displayName="Reply with a data callback"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/echo',
method: 'GET'
}).reply(200, ({ headers }) => ({ message: headers.message }))
const { statusCode, body } = await request('http://localhost:3000/echo', {
headers: { message: 'hello world!' }
})
console.log('response received', statusCode) // response received 200
for await (const data of body) {
console.log('data', data.toString('utf8')) // {"message":"hello world!"}
}
```
```mjs displayName="Reply with an options callback"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/echo',
method: 'GET'
}).reply(({ headers }) => ({
statusCode: 200,
data: { message: headers.message }
}))
const { statusCode, body } = await request('http://localhost:3000/echo', {
headers: { message: 'hello world!' }
})
console.log('response received', statusCode) // response received 200
for await (const data of body) {
console.log('data', data.toString('utf8')) // {"message":"hello world!"}
}
```
```mjs displayName="Reply with an asynchronous options callback"
import { readFile } from 'node:fs/promises'
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/fixture',
method: 'GET'
}).reply(async ({ path }) => ({
statusCode: 200,
data: await readFile(new URL('./fixture.json', import.meta.url))
}))
const { statusCode, body } = await request('http://localhost:3000/fixture')
console.log('response received', statusCode) // response received 200
for await (const data of body) {
console.log('data', data.toString('utf8')) // contents of fixture.json
}
```
```mjs displayName="Multiple intercepts"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({ path: '/foo', method: 'GET' }).reply(200, 'foo')
mockPool.intercept({ path: '/hello', method: 'GET' }).reply(200, 'hello')
const fooResult = await request('http://localhost:3000/foo')
for await (const data of fooResult.body) {
console.log('data', data.toString('utf8')) // data foo
}
const helloResult = await request('http://localhost:3000/hello')
for await (const data of helloResult.body) {
console.log('data', data.toString('utf8')) // data hello
}
```
```mjs displayName="Match query, body, request headers; reply with headers and trailers"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo?hello=there&see=ya',
method: 'POST',
body: 'form1=data1&form2=data2',
headers: {
'User-Agent': 'undici',
Host: 'example.com'
}
}).reply(200, { foo: 'bar' }, {
headers: { 'content-type': 'application/json' },
trailers: { 'Content-MD5': 'test' }
})
const { statusCode, headers, trailers, body } = await request(
'http://localhost:3000/foo?hello=there&see=ya',
{
method: 'POST',
body: 'form1=data1&form2=data2',
headers: {
foo: 'bar',
'User-Agent': 'undici',
Host: 'example.com'
}
}
)
console.log('response received', statusCode) // response received 200
console.log('headers', headers) // { 'content-type': 'application/json' }
for await (const data of body) {
console.log('data', data.toString('utf8')) // {"foo":"bar"}
}
console.log('trailers', trailers) // { 'content-md5': 'test' }
```
```mjs displayName="Different matcher forms"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: /^GET$/,
body: (value) => value === 'form=data',
headers: {
'User-Agent': 'undici',
Host: /^example\.com$/
}
}).reply(200, 'foo')
const { statusCode, body } = await request('http://localhost:3000/foo', {
method: 'GET',
body: 'form=data',
headers: {
foo: 'bar',
'User-Agent': 'undici',
Host: 'example.com'
}
})
console.log('response received', statusCode) // response received 200
for await (const data of body) {
console.log('data', data.toString('utf8')) // data foo
}
```
```mjs displayName="Reply with an error"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({
path: '/foo',
method: 'GET'
}).replyWithError(new Error('kaboom'))
try {
await request('http://localhost:3000/foo', { method: 'GET' })
} catch (error) {
console.error(error.message) // kaboom
}
```
```mjs displayName="Default reply headers"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({ path: '/foo', method: 'GET' })
.defaultReplyHeaders({ foo: 'bar' })
.reply(200, 'foo')
const { headers } = await request('http://localhost:3000/foo')
console.log('headers', headers) // headers { foo: 'bar' }
```
```mjs displayName="Default reply trailers"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({ path: '/foo', method: 'GET' })
.defaultReplyTrailers({ foo: 'bar' })
.reply(200, 'foo')
const { trailers } = await request('http://localhost:3000/foo')
console.log('trailers', trailers) // trailers { foo: 'bar' }
```
```mjs displayName="Automatic content-length"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({ path: '/foo', method: 'GET' })
.replyContentLength()
.reply(200, 'foo')
const { headers } = await request('http://localhost:3000/foo')
console.log('headers', headers) // headers { 'content-length': '3' }
```
```mjs displayName="Persisted reply"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({ path: '/foo', method: 'GET' }).reply(200, 'foo').persist()
await request('http://localhost:3000/foo') // Matches and returns the mock
await request('http://localhost:3000/foo') // Matches again, indefinitely
```
```mjs displayName="Reply a fixed number of times"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({ path: '/foo', method: 'GET' }).reply(200, 'foo').times(2)
await request('http://localhost:3000/foo') // Matches and returns the mock
await request('http://localhost:3000/foo') // Matches and returns the mock
await request('http://localhost:3000/foo') // No match; a real request is attempted
```
```mjs displayName="Match the path with a function"
import { MockAgent, setGlobalDispatcher, request } from 'undici'
import querystring from 'node:querystring'
const mockAgent = new MockAgent()
setGlobalDispatcher(mockAgent)
const mockPool = mockAgent.get('http://localhost:3000')
const matchPath = (requestPath) => {
const [pathname, search] = requestPath.split('?')
const requestQuery = querystring.parse(search)
if (!pathname.startsWith('/foo')) {
return false
}
return requestQuery.foo === 'bar'
}
mockPool.intercept({ path: matchPath, method: 'GET' }).reply(200, 'foo')
await request('http://localhost:3000/foo?foo=bar') // Matches and returns the mock
```
### `mockPool.close()`
<!-- YAML
added: v4.0.0
-->
* Returns: {Promise} Fulfills with `undefined` once the mock pool is closed.
Closes the mock pool, gracefully waiting for any enqueued requests to complete,
and removes it from the associated [`MockAgent`][].
```mjs
import { MockAgent } from 'undici'
const mockAgent = new MockAgent()
const mockPool = mockAgent.get('http://localhost:3000')
await mockPool.close()
```
### `mockPool.dispatch(options, handlers)`
<!-- YAML
added: v4.0.0
-->
* `options` {DispatchOptions} The request options.
* `handlers` {DispatchHandler} The handlers invoked over the request lifecycle.
* Returns: {boolean} `false` if the dispatcher is busy and the caller should
wait before dispatching further requests, otherwise `true`.
Dispatches a request, matching it against the registered mocks. This override of
[`dispatcher.dispatch(options, handlers)`][] is what drives the mocking
behaviour for every higher-level method such as `request`.
### `mockPool.request(options[, callback])`
<!-- YAML
added: v4.0.0
-->
* `options` {DispatchOptions}
* `callback` {Function} (optional) Invoked with the response when no `Promise`
is requested.
* Returns: {Promise} Fulfills with the mocked response when no `callback` is
provided.
Performs a request and resolves it against the registered mocks. Inherited from
[`Pool`][]; see [`dispatcher.request(options[, callback])`][] for the full
parameter and return value documentation.
```mjs
import { MockAgent } from 'undici'
const mockAgent = new MockAgent()
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({ path: '/foo', method: 'GET' }).reply(200, 'foo')
const { statusCode, body } = await mockPool.request({
origin: 'http://localhost:3000',
path: '/foo',
method: 'GET'
})
console.log('response received', statusCode) // response received 200
for await (const data of body) {
console.log('data', data.toString('utf8')) // data foo
}
```
### `mockPool.cleanMocks()`
<!-- YAML
added: v7.11.0
-->
* Returns: {undefined}
Removes all registered interceptors from the mock pool. Pending mocks defined
before this call no longer match incoming requests.
```mjs
import { MockAgent } from 'undici'
const mockAgent = new MockAgent()
const mockPool = mockAgent.get('http://localhost:3000')
mockPool.intercept({ path: '/foo' }).reply(200, 'foo')
mockPool.cleanMocks()
```
[`MockAgent`]: MockAgent.md#class-mockagent
[`MockClient`]: MockClient.md#class-mockclient
[`MockInterceptor`]: MockPool.md#return-mockinterceptor
[`MockScope`]: MockPool.md#return-mockscope
[`Pool`]: Pool.md#class-pool
[`dispatcher.dispatch(options, handlers)`]: Dispatcher.md#dispatcherdispatchoptions-handler
[`dispatcher.request(options[, callback])`]: Dispatcher.md#dispatcherrequestoptions-callback
[`mockAgent.get(origin)`]: MockAgent.md#mockagentgetorigin
@@ -0,0 +1,154 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const ts_api_utils_1 = require("ts-api-utils");
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'prefer-return-this-type',
meta: {
type: 'suggestion',
docs: {
description: 'Enforce that `this` is used when only `this` type is returned',
recommended: 'strict',
requiresTypeChecking: true,
},
fixable: 'code',
messages: {
useThisType: 'Use `this` type instead.',
},
schema: [],
},
defaultOptions: [],
create(context) {
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
function tryGetNameInType(name, typeNode) {
if (typeNode.type === utils_1.AST_NODE_TYPES.TSTypeReference &&
typeNode.typeName.type === utils_1.AST_NODE_TYPES.Identifier &&
typeNode.typeName.name === name) {
return typeNode;
}
if (typeNode.type === utils_1.AST_NODE_TYPES.TSUnionType) {
for (const type of typeNode.types) {
const found = tryGetNameInType(name, type);
if (found) {
return found;
}
}
}
return undefined;
}
function isThisSpecifiedInParameters(originalFunc) {
const firstArg = originalFunc.params.at(0);
return (firstArg?.type === utils_1.AST_NODE_TYPES.Identifier && firstArg.name === 'this');
}
function isFunctionReturningThis(originalFunc, originalClass) {
if (isThisSpecifiedInParameters(originalFunc)) {
return false;
}
const func = services.esTreeNodeToTSNodeMap.get(originalFunc);
if (!func.body) {
return false;
}
const classType = services.getTypeAtLocation(originalClass);
if (func.body.kind !== ts.SyntaxKind.Block) {
const type = checker.getTypeAtLocation(func.body);
return classType.thisType === type;
}
let hasReturnThis = false;
let hasReturnClassType = false;
(0, util_1.forEachReturnStatement)(func.body, stmt => {
const expr = stmt.expression;
if (!expr) {
return;
}
// fast check
if (expr.kind === ts.SyntaxKind.ThisKeyword) {
hasReturnThis = true;
return;
}
const type = checker.getTypeAtLocation(expr);
if (classType === type) {
hasReturnClassType = true;
return true;
}
if (classType.thisType === type) {
hasReturnThis = true;
return;
}
if ((0, ts_api_utils_1.isUnionType)(type) &&
type.types.some(typePart => typePart === classType)) {
hasReturnClassType = true;
return true;
}
return;
});
return !hasReturnClassType && hasReturnThis;
}
function checkFunction(originalFunc, originalClass) {
const className = originalClass.id?.name;
if (!className || !originalFunc.returnType) {
return;
}
const node = tryGetNameInType(className, originalFunc.returnType.typeAnnotation);
if (!node) {
return;
}
if (isFunctionReturningThis(originalFunc, originalClass)) {
context.report({
node,
messageId: 'useThisType',
fix: fixer => fixer.replaceText(node, 'this'),
});
}
}
function checkProperty(node) {
if (!(node.value?.type === utils_1.AST_NODE_TYPES.FunctionExpression ||
node.value?.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression)) {
return;
}
checkFunction(node.value, node.parent.parent);
}
return {
'ClassBody > AccessorProperty': checkProperty,
'ClassBody > MethodDefinition'(node) {
checkFunction(node.value, node.parent.parent);
},
'ClassBody > PropertyDefinition': checkProperty,
};
},
});
@@ -0,0 +1,77 @@
{
"name": "@humanwhocodes/retry",
"version": "0.4.3",
"description": "A utility to retry failed async methods.",
"type": "module",
"main": "dist/retrier.cjs",
"module": "dist/retrier.js",
"types": "dist/retrier.d.ts",
"exports": {
"require": {
"types": "./dist/retrier.d.cts",
"default": "./dist/retrier.cjs"
},
"import": {
"types": "./dist/retrier.d.ts",
"default": "./dist/retrier.js"
}
},
"files": [
"dist"
],
"engines": {
"node": ">=18.18"
},
"publishConfig": {
"access": "public"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.js": [
"eslint --fix"
]
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/nzakas"
},
"scripts": {
"build:cts-types": "node -e \"fs.copyFileSync('dist/retrier.d.ts', 'dist/retrier.d.cts')\"",
"build": "rollup -c && tsc && npm run build:cts-types",
"prepare": "npm run build",
"lint": "eslint src/ tests/",
"pretest": "npm run build",
"test:unit": "mocha tests/retrier.test.js",
"test:build": "node tests/pkg.test.cjs && node tests/pkg.test.mjs",
"test:jsr": "npx jsr@latest publish --dry-run",
"test:emfile": "node tools/check-emfile-handling.js",
"test": "npm run test:unit && npm run test:build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/humanwhocodes/retry.git"
},
"keywords": [
"nodejs",
"retry",
"async",
"promises"
],
"author": "Nicholas C. Zaks",
"license": "Apache-2.0",
"devDependencies": {
"@eslint/js": "^8.49.0",
"@rollup/plugin-terser": "0.4.4",
"@tsconfig/node16": "^16.1.1",
"@types/mocha": "^10.0.3",
"@types/node": "20.12.6",
"eslint": "^8.21.0",
"lint-staged": "15.2.1",
"mocha": "^10.3.0",
"rollup": "3.29.4",
"typescript": "5.4.4",
"yorkie": "2.0.0"
}
}
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getParsedConfigFileFromTSServer = getParsedConfigFileFromTSServer;
const tsconfig_utils_1 = require("@typescript-eslint/tsconfig-utils");
function getParsedConfigFileFromTSServer(tsserver, defaultProject, throwOnFailure, tsconfigRootDir) {
try {
return (0, tsconfig_utils_1.getParsedConfigFile)(tsserver, defaultProject, tsconfigRootDir);
}
catch (error) {
if (throwOnFailure) {
throw new Error(`Could not read Project Service default project '${defaultProject}': ${error.message}`);
}
}
return undefined;
}
@@ -0,0 +1 @@
{"version":3,"file":"file-user.js","sources":["../../../src/icons/file-user.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name FileUser\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTQgMnY0YTIgMiAwIDAgMCAyIDJoNCIgLz4KICA8cGF0aCBkPSJNMTUgMThhMyAzIDAgMSAwLTYgMCIgLz4KICA8cGF0aCBkPSJNMTUgMkg2YTIgMiAwIDAgMC0yIDJ2MTZhMiAyIDAgMCAwIDIgMmgxMmEyIDIgMCAwIDAgMi0yVjd6IiAvPgogIDxjaXJjbGUgY3g9IjEyIiBjeT0iMTMiIHI9IjIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/file-user\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst FileUser = createLucideIcon('FileUser', [\n ['path', { d: 'M14 2v4a2 2 0 0 0 2 2h4', key: 'tnqrlb' }],\n ['path', { d: 'M15 18a3 3 0 1 0-6 0', key: '16awa0' }],\n ['path', { d: 'M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z', key: '1mlx9k' }],\n ['circle', { cx: '12', cy: '13', r: '2', key: '1c1ljs' }],\n]);\n\nexport default FileUser;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAwB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACrD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA8D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAC3F,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA;AAC1D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// https://mathiasbynens.be/notes/javascript-encoding
// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
function ucs2length(str) {
const len = str.length;
let length = 0;
let pos = 0;
let value;
while (pos < len) {
length++;
value = str.charCodeAt(pos++);
if (value >= 0xd800 && value <= 0xdbff && pos < len) {
// high surrogate, and there is a next character
value = str.charCodeAt(pos);
if ((value & 0xfc00) === 0xdc00)
pos++; // low surrogate
}
}
return length;
}
exports.default = ucs2length;
ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
//# sourceMappingURL=ucs2length.js.map
@@ -0,0 +1,25 @@
import { NoInfer, PickOptional } from './utils.cjs';
import { SearchMiddleware } from './route.cjs';
import { IsRequiredParams } from './link.cjs';
/**
* Retain specified search params across navigations.
*
* If `keys` is `true`, retain all current params. Otherwise, copy only the
* listed keys from the current search into the next search.
*
* @param keys `true` to retain all, or a list of keys to retain.
* @returns A search middleware suitable for route `search.middlewares`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/retainSearchParamsFunction
*/
export declare function retainSearchParams<TSearchSchema extends object>(keys: Array<keyof TSearchSchema> | true): SearchMiddleware<TSearchSchema>;
/**
* Remove optional or default-valued search params from navigations.
*
* - Pass `true` (only if there are no required search params) to strip all.
* - Pass an array to always remove those optional keys.
* - Pass an object of default values; keys equal (deeply) to the defaults are removed.
*
* @returns A search middleware suitable for route `search.middlewares`.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/stripSearchParamsFunction
*/
export declare function stripSearchParams<TSearchSchema, TOptionalProps = PickOptional<NoInfer<TSearchSchema>>, const TValues = Partial<NoInfer<TOptionalProps>> | Array<keyof TOptionalProps>, const TInput = IsRequiredParams<TSearchSchema> extends never ? TValues | true : TValues>(input: NoInfer<TInput>): SearchMiddleware<TSearchSchema>;
@@ -0,0 +1,793 @@
// Incremental BLOB I/O (Deliverable 08). See src/blob.h for the
// threading model and lifetime answers.
#include <cstring>
#include <string>
#include <sqlite3.h>
#include <napi.h>
#include "macros.h"
#include "database.h"
#include "blob.h"
using namespace node_sqlite3;
namespace {
#define BLOB_BEGIN(type) \
assert(baton); \
assert(baton->blob); \
assert(!baton->blob->locked); \
assert(!baton->blob->closed); \
assert(baton->blob->inited); \
assert(baton->blob->_handle != NULL); \
baton->blob->locked = true; \
baton->blob->db->pending++; \
auto env = baton->blob->Env(); \
CREATE_WORK("sqlite3.Blob." #type, Work_##type, Work_After##type);
// A view of a JS binary value with its base pointer and available byte
// count, honouring byteOffset.
struct TargetView {
void* data = NULL;
size_t length = 0;
};
bool GetMutableTarget(napi_env env, const Napi::Value& value,
const std::string& what, TargetView* out) {
if (value.IsDataView()) {
size_t bytes = 0;
void* data = NULL;
napi_get_dataview_info(env, value, &bytes, &data, NULL, NULL);
out->data = data;
out->length = bytes;
return true;
}
if (value.IsBuffer()) {
Napi::Buffer<char> buf = value.As<Napi::Buffer<char>>();
out->data = buf.Data();
out->length = buf.Length();
return true;
}
if (value.IsTypedArray()) {
napi_typedarray_type type;
size_t elements = 0;
void* data = NULL;
napi_get_typedarray_info(env, value, &type, &elements, &data,
NULL, NULL);
switch (type) {
case napi_int8_array:
case napi_uint8_array:
case napi_uint8_clamped_array:
out->data = data;
out->length = elements;
return true;
default:
Napi::TypeError::New(env, "Cannot " + what +
": only byte-sized typed arrays are accepted"
).ThrowAsJavaScriptException();
return false;
}
}
Napi::TypeError::New(env, "Cannot " + what +
": a Buffer or Uint8Array is required"
).ThrowAsJavaScriptException();
return false;
}
// The message accompanying SQLITE_ABORT from blob read/write: the row
// was written after the handle was opened, invalidating it.
std::string BlobAbortMessage() {
return "the row this blob handle was opened on has been modified, "
"so the handle is no longer valid; reopen it (openBlob/reopen) "
"to continue";
}
// Carries a raw sqlite3_blob* whose wrapper is gone (~Blob).
struct BlobHandleBaton : Database::Baton {
sqlite3_blob* handle;
BlobHandleBaton(Database* db_, sqlite3_blob* handle_) :
Baton(db_, Napi::Function()), handle(handle_) {}
virtual ~BlobHandleBaton() override = default;
};
} // namespace
Napi::Object Blob::Init(Napi::Env env, Napi::Object exports) {
Napi::HandleScope scope(env);
auto napi_default_method = static_cast<napi_property_attributes>(
napi_writable | napi_configurable);
auto t = DefineClass(env, "Blob", {
InstanceMethod("read", &Blob::Read, napi_default_method),
InstanceMethod("write", &Blob::Write, napi_default_method),
InstanceMethod("reopen", &Blob::Reopen, napi_default_method),
InstanceMethod("close", &Blob::Close, napi_default_method),
InstanceAccessor("size", &Blob::SizeGetter, nullptr),
InstanceAccessor("closed", &Blob::ClosedGetter, nullptr),
});
// Per-env (see Database::AddonData).
env.GetInstanceData<Database::AddonData>()->blob_ctor =
Napi::Persistent(t);
exports.Set("Blob", t);
return exports;
}
void Blob::Process() {
if ((closed || !inited) && !queue.empty()) {
return CleanQueue();
}
while (inited && !locked && !closed && !queue.empty()) {
auto call = std::unique_ptr<Call>(queue.front());
queue.pop();
call->callback(call->baton);
}
}
void Blob::Schedule(Work_Callback callback, Baton* baton) {
if (closed) {
queue.emplace(new Call(callback, baton));
CleanQueue();
}
else if (!inited || locked || !queue.empty()) {
queue.emplace(new Call(callback, baton));
}
else {
callback(baton);
}
}
template <class T> void Blob::Error(T* baton) {
auto env = baton->blob->Env();
Napi::HandleScope scope(env);
Blob* blob = baton->blob;
assert(blob->status != 0);
EXCEPTION(blob->message, blob->status, exception);
Napi::Function cb = baton->callback.Value();
if (IS_FUNCTION(cb)) {
Napi::Value argv[] = { exception };
TRY_CATCH_CALL(blob->Value(), cb, 1, argv);
}
else {
Napi::Value info[] = { Napi::String::New(env, "error"), exception };
EMIT_EVENT(blob->Value(), 2, info);
}
}
void Blob::CleanQueue() {
auto env = this->Env();
Napi::HandleScope scope(env);
if (queue.empty()) return;
// Environment teardown (worker termination): failing the queued
// calls constructs JS on a dying environment, which is fatal. Drop
// them instead — reference cleanup still works there, so the
// batons are destroyed normally.
if (Database::EnvCannotRunJs(env)) {
while (!queue.empty()) {
auto call = std::unique_ptr<Call>(queue.front());
queue.pop();
delete call->baton;
}
return;
}
EXCEPTION("Blob is already closed", SQLITE_MISUSE, exception);
Napi::Value argv[] = { exception };
bool called = false;
while (!queue.empty()) {
auto call = std::unique_ptr<Call>(queue.front());
queue.pop();
std::unique_ptr<Baton> baton(call->baton);
Napi::Function cb = baton->callback.Value();
if (IS_FUNCTION(cb)) {
TRY_CATCH_CALL(Value(), cb, 1, argv);
called = true;
}
}
if (!called) {
Napi::Value info[] = { Napi::String::New(env, "error"), exception };
EMIT_EVENT(Value(), 2, info);
}
}
// { Database db, String dbName, String table, String column,
// Number rowid, Boolean readOnly, [Function callback] }
Blob::Blob(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Blob>(info) {
auto env = info.Env();
if (!info.IsConstructCall()) {
Napi::TypeError::New(env, "Use the new operator to create new Blob objects").ThrowAsJavaScriptException();
return;
}
if (info.Length() <= 0 || !Database::HasInstance(info[0])) {
Napi::TypeError::New(env, "Database object expected").ThrowAsJavaScriptException();
return;
}
else if (info.Length() <= 1 || !info[1].IsString()
|| info.Length() <= 2 || !info[2].IsString()
|| info.Length() <= 3 || !info[3].IsString()) {
Napi::TypeError::New(env, "Database, table and column names expected").ThrowAsJavaScriptException();
return;
}
else if (info.Length() <= 4 || !info[4].IsNumber()) {
Napi::TypeError::New(env, "Rowid expected").ThrowAsJavaScriptException();
return;
}
else if (info.Length() <= 5 || !info[5].IsBoolean()) {
Napi::TypeError::New(env, "Read-only flag expected").ThrowAsJavaScriptException();
return;
}
else if (info.Length() > 6 && !info[6].IsUndefined() && !info[6].IsFunction()) {
Napi::TypeError::New(env, "Callback expected").ThrowAsJavaScriptException();
return;
}
this->db = Napi::ObjectWrap<Database>::Unwrap(info[0].As<Napi::Object>());
this->db->Ref();
auto dbName = info[1].As<Napi::String>().Utf8Value();
auto table = info[2].As<Napi::String>().Utf8Value();
auto column = info[3].As<Napi::String>().Utf8Value();
sqlite3_int64 rowid = info[4].As<Napi::Number>().Int64Value();
bool readOnly = info[5].As<Napi::Boolean>().Value();
info.This().As<Napi::Object>().DefineProperty(
Napi::PropertyDescriptor::Value("db", info[1]));
info.This().As<Napi::Object>().DefineProperty(
Napi::PropertyDescriptor::Value("table", info[2]));
info.This().As<Napi::Object>().DefineProperty(
Napi::PropertyDescriptor::Value("column", info[3]));
info.This().As<Napi::Object>().DefineProperty(
Napi::PropertyDescriptor::Value("rowid", info[4]));
info.This().As<Napi::Object>().DefineProperty(
Napi::PropertyDescriptor::Value("readOnly", info[5]));
// Tracked from construction so CloseLiveBlobs cannot miss a blob
// whose open is still queued or in flight.
this->db->live_blobs.push_back(this);
auto* baton = new OpenBaton(this->db, info[6].As<Napi::Function>(), this);
baton->dbName = dbName;
baton->table = table;
baton->column = column;
baton->rowid = rowid;
baton->readOnly = readOnly;
this->db->Schedule(Work_BeginOpen, baton);
}
void Blob::Work_BeginOpen(Database::Baton* baton) {
assert(baton->db->IsOpen());
assert(baton->db->_handle);
baton->db->pending++;
auto env = baton->db->Env();
CREATE_WORK("sqlite3.Blob.Open", Work_Open, Work_AfterOpen);
}
void Blob::Work_Open(napi_env e, void* data) {
auto* baton = static_cast<OpenBaton*>(data);
Blob* blob = baton->blob;
// sqlite3_blob_open takes the connection mutex internally (and a
// read/write lock on the row); running here on the worker pool is
// what serializes it against other work.
blob->_handle = NULL;
int rc = sqlite3_blob_open(baton->db->_handle,
baton->dbName.c_str(), baton->table.c_str(),
baton->column.c_str(), baton->rowid,
baton->readOnly ? 0 : 1, &blob->_handle);
blob->status = rc;
if (rc != SQLITE_OK) {
blob->message = std::string(sqlite3_errmsg(baton->db->_handle));
}
}
void Blob::Work_AfterOpen(napi_env e, napi_status status, void* data) {
std::unique_ptr<OpenBaton> baton(static_cast<OpenBaton*>(data));
AFTER_WORK_TEARDOWN_GUARD(baton);
auto* blob = baton->blob;
auto* db = baton->db;
auto env = blob->Env();
Napi::HandleScope scope(env);
db->pending--;
db->Process();
if (blob->status != SQLITE_OK) {
blob->DetachFromDatabase();
Error(baton.get());
}
else {
blob->inited = true;
Napi::Function cb = baton->callback.Value();
if (IS_FUNCTION(cb)) {
Napi::Value argv[] = { env.Null() };
TRY_CATCH_CALL(blob->Value(), cb, 1, argv);
}
}
blob->Process();
}
void Blob::EndCall() {
assert(locked);
assert(db->pending);
locked = false;
db->pending--;
Process();
db->Process();
}
Blob::~Blob() {
// GC safety net, mirroring ~Statement: every queued Baton holds a Ref
// on the blob, so the queue is provably empty and CleanQueue cannot
// fire JS from this finalizer. sqlite3_blob_close takes the
// connection mutex internally; defer through the exclusive queue when
// a worker could be mid-round-trip holding that mutex while waiting
// for this very thread.
CleanQueue();
if (_handle != NULL) {
if (db != NULL && db->MayBlockOnWorkerRoundTrip()) {
db->Schedule(Work_DeferredBlobClose,
new BlobHandleBaton(db, _handle), true);
_handle = NULL;
}
else {
sqlite3_blob_close(_handle);
_handle = NULL;
}
}
// Detached blobs have already released the database (and nulled the
// pointer); this covers the never-detached case only.
if (db != NULL) {
UntrackFromDatabase();
db->Unref();
}
}
void Blob::Work_DeferredBlobClose(Database::Baton* b) {
auto baton = std::unique_ptr<BlobHandleBaton>(
static_cast<BlobHandleBaton*>(b));
auto* db = baton->db;
sqlite3_blob_close(baton->handle);
db->exclusiveHeld = false;
db->Process();
}
void Blob::UntrackFromDatabase() {
if (db == NULL) return;
auto& v = db->live_blobs;
for (auto it = v.begin(); it != v.end(); ++it) {
if (*it == this) {
v.erase(it);
return;
}
}
}
// JS thread, nothing in flight (Work_BeginClose / ~Database) or at a
// completion point where the handle is already gone. Idempotent.
// Severs the link to the Database, and is the single place the blob's
// reference on it is released. Nulling `db` is the point: at environment
// teardown napi finalizes wrappers in an unspecified order, so ~Blob can
// run after ~Database, and a back-pointer left dangling there means
// UntrackFromDatabase walks a destroyed std::vector. (That is a
// segfault, not a stale read — it was reproducible on musl.)
//
// owner_dying is set when ~Database is the caller: the Database is
// already being destroyed, so its refcount is moot and calling Unref on
// a half-destroyed wrapper is exactly the dereference being avoided.
void Blob::DetachFromDatabase(bool owner_dying) {
if (db == NULL) return;
if (_handle != NULL) {
sqlite3_blob_close(_handle);
_handle = NULL;
}
UntrackFromDatabase();
closed = true;
if (owner_dying) {
// ~Database is running. napi finalizes wrappers in an
// unspecified order at environment teardown, so ~Blob can run
// afterwards — and UntrackFromDatabase would then walk a
// destroyed std::vector, which faults rather than reading stale
// data (reproducible on musl). Drop the back-pointer so the
// destructor skips it. The reference is deliberately not
// released: the Database is already being destroyed, and
// Unref'ing a half-destroyed wrapper is the same dereference.
//
// Only on this path: the ordinary close still needs `db` for
// the in-flight bookkeeping that runs after this returns
// (Work_AfterClose's CallGuard decrements db->pending).
db = NULL;
}
}
void Database::CloseLiveBlobs(bool owner_dying) {
// Main thread, nothing in flight (Work_BeginClose / ~Database).
std::vector<Blob*> blobs = live_blobs;
live_blobs.clear();
for (Blob* blob : blobs) {
blob->DetachFromDatabase(owner_dying);
}
}
// --- read ---------------------------------------------------------------------
// read(target[, offset[, callback]]): copies target.length bytes of the
// blob, starting at `offset` within the blob, into the target. The
// callback may sit in the offset's slot (the promise layer appends it
// there when no offset was given), so each slot accepts either its own
// type or the trailing function.
Napi::Value Blob::Read(const Napi::CallbackInfo& info) {
auto env = info.Env();
Blob* blob = this;
if (info.Length() < 1) {
Napi::TypeError::New(env, "Expected at least 1 argument").ThrowAsJavaScriptException();
return env.Null();
}
TargetView target;
if (!GetMutableTarget(env, info[0], "read into a blob target", &target)) {
return env.Null();
}
sqlite3_int64 offset = 0;
Napi::Function callback;
if (info.Length() > 1 && info[1].IsNumber()) {
offset = info[1].As<Napi::Number>().Int64Value();
if (offset < 0) {
Napi::RangeError::New(env, "blob offset must be a non-negative integer").ThrowAsJavaScriptException();
return env.Null();
}
if (info.Length() > 2 && !info[2].IsUndefined()) {
if (!info[2].IsFunction()) {
Napi::TypeError::New(env, "Argument 2 must be a function").ThrowAsJavaScriptException();
return env.Null();
}
callback = info[2].As<Napi::Function>();
}
}
else if (info.Length() > 1 && info[1].IsFunction()) {
callback = info[1].As<Napi::Function>();
}
else if (info.Length() > 1 && !info[1].IsUndefined()) {
Napi::TypeError::New(env, "blob offset must be a non-negative integer").ThrowAsJavaScriptException();
return env.Null();
}
auto* baton = new IoBaton(blob, callback);
baton->target = Napi::Persistent(info[0]);
baton->data = target.data;
baton->length = target.length;
baton->offset = offset;
blob->Schedule(Work_BeginRead, baton);
return info.This();
}
void Blob::Work_BeginRead(Baton* baton) {
BLOB_BEGIN(Read);
}
void Blob::Work_Read(napi_env e, void* data) {
auto* baton = static_cast<IoBaton*>(data);
Blob* blob = baton->blob;
int rc = sqlite3_blob_read(blob->_handle, baton->data,
static_cast<int>(baton->length), static_cast<int>(baton->offset));
blob->status = rc;
if (rc == SQLITE_ABORT) {
blob->message = BlobAbortMessage();
}
else if (rc != SQLITE_OK) {
blob->message = std::string(sqlite3_errmsg(blob->db->_handle));
}
}
void Blob::Work_AfterRead(napi_env e, napi_status status, void* data) {
std::unique_ptr<IoBaton> baton(static_cast<IoBaton*>(data));
AFTER_WORK_TEARDOWN_GUARD(baton);
auto* blob = baton->blob;
auto env = blob->Env();
Napi::HandleScope scope(env);
// Runs the end-of-call bookkeeping on every exit path, including
// TRY_CATCH_CALL's early return when a JS callback throws.
Blob::CallGuard blob_call_guard__(blob);
if (blob->status != SQLITE_OK) {
Error(baton.get());
return;
}
Napi::Function cb = baton->callback.Value();
if (IS_FUNCTION(cb)) {
// The number of bytes actually copied is the full target length:
// sqlite3_blob_read fails (rather than short-reading) when
// offset+length exceeds the blob size.
Napi::Value argv[] = { env.Null(),
Napi::Number::New(env, baton->length) };
TRY_CATCH_CALL(blob->Value(), cb, 2, argv);
}
}
// --- write --------------------------------------------------------------------
// write(source[, offset[, callback]]): copies source.length bytes into
// the blob starting at `offset` within the blob. The callback may sit in
// the offset's slot; see Read.
Napi::Value Blob::Write(const Napi::CallbackInfo& info) {
auto env = info.Env();
Blob* blob = this;
if (info.Length() < 1) {
Napi::TypeError::New(env, "Expected at least 1 argument").ThrowAsJavaScriptException();
return env.Null();
}
TargetView target;
if (!GetMutableTarget(env, info[0], "write from a blob source", &target)) {
return env.Null();
}
sqlite3_int64 offset = 0;
Napi::Function callback;
if (info.Length() > 1 && info[1].IsNumber()) {
offset = info[1].As<Napi::Number>().Int64Value();
if (offset < 0) {
Napi::RangeError::New(env, "blob offset must be a non-negative integer").ThrowAsJavaScriptException();
return env.Null();
}
if (info.Length() > 2 && !info[2].IsUndefined()) {
if (!info[2].IsFunction()) {
Napi::TypeError::New(env, "Argument 2 must be a function").ThrowAsJavaScriptException();
return env.Null();
}
callback = info[2].As<Napi::Function>();
}
}
else if (info.Length() > 1 && info[1].IsFunction()) {
callback = info[1].As<Napi::Function>();
}
else if (info.Length() > 1 && !info[1].IsUndefined()) {
Napi::TypeError::New(env, "blob offset must be a non-negative integer").ThrowAsJavaScriptException();
return env.Null();
}
auto* baton = new IoBaton(blob, callback);
baton->target = Napi::Persistent(info[0]);
baton->data = target.data;
baton->length = target.length;
baton->offset = offset;
blob->Schedule(Work_BeginWrite, baton);
return info.This();
}
void Blob::Work_BeginWrite(Baton* baton) {
BLOB_BEGIN(Write);
}
void Blob::Work_Write(napi_env e, void* data) {
auto* baton = static_cast<IoBaton*>(data);
Blob* blob = baton->blob;
int rc = sqlite3_blob_write(blob->_handle, baton->data,
static_cast<int>(baton->length), static_cast<int>(baton->offset));
blob->status = rc;
if (rc == SQLITE_ABORT) {
blob->message = BlobAbortMessage();
}
else if (rc != SQLITE_OK) {
blob->message = std::string(sqlite3_errmsg(blob->db->_handle));
}
}
void Blob::Work_AfterWrite(napi_env e, napi_status status, void* data) {
std::unique_ptr<IoBaton> baton(static_cast<IoBaton*>(data));
AFTER_WORK_TEARDOWN_GUARD(baton);
auto* blob = baton->blob;
auto env = blob->Env();
Napi::HandleScope scope(env);
Blob::CallGuard blob_call_guard__(blob);
if (blob->status != SQLITE_OK) {
Error(baton.get());
return;
}
Napi::Function cb = baton->callback.Value();
if (IS_FUNCTION(cb)) {
Napi::Value argv[] = { env.Null(),
Napi::Number::New(env, baton->length) };
TRY_CATCH_CALL(blob->Value(), cb, 2, argv);
}
}
// --- reopen --------------------------------------------------------------------
Napi::Value Blob::Reopen(const Napi::CallbackInfo& info) {
auto env = info.Env();
Blob* blob = this;
REQUIRE_ARGUMENT_INTEGER(0, rowid);
OPTIONAL_ARGUMENT_FUNCTION(1, callback);
auto* baton = new Baton(blob, callback);
baton->rowid = rowid;
blob->Schedule(Work_BeginReopen, baton);
return info.This();
}
void Blob::Work_BeginReopen(Baton* baton) {
BLOB_BEGIN(Reopen);
}
void Blob::Work_Reopen(napi_env e, void* data) {
auto* baton = static_cast<Baton*>(data);
Blob* blob = baton->blob;
int rc = sqlite3_blob_reopen(blob->_handle, baton->rowid);
blob->status = rc;
if (rc != SQLITE_OK) {
blob->message = std::string(sqlite3_errmsg(blob->db->_handle));
}
}
void Blob::Work_AfterReopen(napi_env e, napi_status status, void* data) {
std::unique_ptr<Baton> baton(static_cast<Baton*>(data));
AFTER_WORK_TEARDOWN_GUARD(baton);
auto* blob = baton->blob;
auto env = blob->Env();
Napi::HandleScope scope(env);
Blob::CallGuard blob_call_guard__(blob);
if (blob->status != SQLITE_OK) {
Error(baton.get());
return;
}
Napi::Function cb = baton->callback.Value();
if (IS_FUNCTION(cb)) {
Napi::Value argv[] = { env.Null() };
TRY_CATCH_CALL(blob->Value(), cb, 1, argv);
}
}
// --- close ----------------------------------------------------------------------
Napi::Value Blob::Close(const Napi::CallbackInfo& info) {
auto env = info.Env();
Blob* blob = this;
OPTIONAL_ARGUMENT_FUNCTION(0, callback);
if (blob->closed) {
// Dispose contract: a second close is a benign no-op, and one
// after the database closed finds the handle already gone.
if (IS_FUNCTION(callback)) {
Napi::Value argv[] = { env.Null() };
TRY_CATCH_CALL(blob->Value(), callback, 1, argv, info.This());
}
return info.This();
}
auto* baton = new Baton(blob, callback);
blob->Schedule(Work_BeginClose, baton);
return info.This();
}
void Blob::Work_BeginClose(Baton* baton) {
BLOB_BEGIN(Close);
}
void Blob::Work_Close(napi_env e, void* data) {
auto* baton = static_cast<Baton*>(data);
Blob* blob = baton->blob;
sqlite3_blob_close(blob->_handle);
blob->_handle = NULL;
}
void Blob::Work_AfterClose(napi_env e, napi_status status, void* data) {
std::unique_ptr<Baton> baton(static_cast<Baton*>(data));
AFTER_WORK_TEARDOWN_GUARD(baton);
auto* blob = baton->blob;
auto env = blob->Env();
Napi::HandleScope scope(env);
Blob::CallGuard blob_call_guard__(blob);
blob->DetachFromDatabase();
Napi::Function cb = baton->callback.Value();
if (IS_FUNCTION(cb)) {
Napi::Value argv[] = { env.Null() };
TRY_CATCH_CALL(blob->Value(), cb, 1, argv);
}
}
// --- accessors -------------------------------------------------------------------
Napi::Value Blob::SizeGetter(const Napi::CallbackInfo& info) {
auto env = info.Env();
Blob* blob = this;
// read()/write() queue behind the open, but a synchronous getter
// cannot; say which of the two states the caller is actually in,
// because "not open" reads as "closed" when it usually means "not
// open yet".
//
// Decision (D08 finding 5, settled in D09): keep throwing rather than
// join Statement's read-`undefined`-until-ready convention. The
// statement accessors expose derived metadata snapshots; `size` is a
// dimension of a live native handle, and `undefined` would flow into
// arithmetic (`size + offset` → NaN) and buffer sizing silently — the
// silent-coercion bug class this package exists to close. The error
// messages above are state-specific, so the loud path is precise.
// Order matters: _handle is NULL before the open completes as well as
// after a close, so the not-yet-open case has to be tested first.
if (!blob->inited && !blob->closed) {
Napi::Error::New(env,
"blob.size is not available until the handle has finished "
"opening; read it from the openBlob() callback, or after an "
"awaited read/write (those queue behind the open)"
).ThrowAsJavaScriptException();
return env.Null();
}
if (blob->closed || blob->_handle == NULL) {
Napi::Error::New(env, "Blob is already closed")
.ThrowAsJavaScriptException();
return env.Null();
}
if (blob->locked) {
// An op is in flight on this handle; reading the size now could
// observe a torn state.
Napi::Error::New(env,
"cannot read blob.size while an operation on this blob is "
"in flight; read it from a callback or after the operation"
).ThrowAsJavaScriptException();
return env.Null();
}
// The handle's own queue is idle (locked == false). Same gate as the
// other main-thread sqlite reads: refuse while a worker could be
// blocked mid-round-trip on this thread holding the connection mutex.
if (blob->db->MayBlockOnWorkerRoundTrip()) {
Napi::Error::New(env,
"cannot read blob.size while a JavaScript function, "
"collation or progress callback is mid-call on this "
"connection; read it from a callback or after the query"
).ThrowAsJavaScriptException();
return env.Null();
}
return Napi::Number::New(env,
static_cast<double>(sqlite3_blob_bytes(blob->_handle)));
}
Napi::Value Blob::ClosedGetter(const Napi::CallbackInfo& info) {
return Napi::Boolean::New(info.Env(), closed);
}
@@ -0,0 +1,276 @@
{{# def.definitions }}
{{# def.errors }}
{{# def.defaults }}
{{# def.coerce }}
{{ /**
* schema compilation (render) time:
* it = { schema, RULES, _validate, opts }
* it.validate - this template function,
* it is used recursively to generate code for subschemas
*
* runtime:
* "validate" is a variable name to which this function will be assigned
* validateRef etc. are defined in the parent scope in index.js
*/ }}
{{
var $async = it.schema.$async === true
, $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref')
, $id = it.self._getId(it.schema);
}}
{{
if (it.opts.strictKeywords) {
var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords);
if ($unknownKwd) {
var $keywordsMsg = 'unknown keyword: ' + $unknownKwd;
if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg);
else throw new Error($keywordsMsg);
}
}
}}
{{? it.isTop }}
var validate = {{?$async}}{{it.async = true;}}async {{?}}function(data, dataPath, parentData, parentDataProperty, rootData) {
'use strict';
{{? $id && (it.opts.sourceCode || it.opts.processCode) }}
{{= '/\*# sourceURL=' + $id + ' */' }}
{{?}}
{{?}}
{{? typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref) }}
{{ var $keyword = 'false schema'; }}
{{# def.setupKeyword }}
{{? it.schema === false}}
{{? it.isTop}}
{{ $breakOnError = true; }}
{{??}}
var {{=$valid}} = false;
{{?}}
{{# def.error:'false schema' }}
{{??}}
{{? it.isTop}}
{{? $async }}
return data;
{{??}}
validate.errors = null;
return true;
{{?}}
{{??}}
var {{=$valid}} = true;
{{?}}
{{?}}
{{? it.isTop}}
};
return validate;
{{?}}
{{ return out; }}
{{?}}
{{? it.isTop }}
{{
var $top = it.isTop
, $lvl = it.level = 0
, $dataLvl = it.dataLevel = 0
, $data = 'data';
it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
it.baseId = it.baseId || it.rootId;
delete it.isTop;
it.dataPathArr = [""];
if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
var $defaultMsg = 'default is ignored in the schema root';
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
else throw new Error($defaultMsg);
}
}}
var vErrors = null; {{ /* don't edit, used in replace */ }}
var errors = 0; {{ /* don't edit, used in replace */ }}
if (rootData === undefined) rootData = data; {{ /* don't edit, used in replace */ }}
{{??}}
{{
var $lvl = it.level
, $dataLvl = it.dataLevel
, $data = 'data' + ($dataLvl || '');
if ($id) it.baseId = it.resolve.url(it.baseId, $id);
if ($async && !it.async) throw new Error('async schema in sync schema');
}}
var errs_{{=$lvl}} = errors;
{{?}}
{{
var $valid = 'valid' + $lvl
, $breakOnError = !it.opts.allErrors
, $closingBraces1 = ''
, $closingBraces2 = '';
var $errorKeyword;
var $typeSchema = it.schema.type
, $typeIsArray = Array.isArray($typeSchema);
if ($typeSchema && it.opts.nullable && it.schema.nullable === true) {
if ($typeIsArray) {
if ($typeSchema.indexOf('null') == -1)
$typeSchema = $typeSchema.concat('null');
} else if ($typeSchema != 'null') {
$typeSchema = [$typeSchema, 'null'];
$typeIsArray = true;
}
}
if ($typeIsArray && $typeSchema.length == 1) {
$typeSchema = $typeSchema[0];
$typeIsArray = false;
}
}}
{{## def.checkType:
{{
var $schemaPath = it.schemaPath + '.type'
, $errSchemaPath = it.errSchemaPath + '/type'
, $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
}}
if ({{= it.util[$method]($typeSchema, $data, it.opts.strictNumbers, true) }}) {
#}}
{{? it.schema.$ref && $refKeywords }}
{{? it.opts.extendRefs == 'fail' }}
{{ throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); }}
{{?? it.opts.extendRefs !== true }}
{{
$refKeywords = false;
it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
}}
{{?}}
{{?}}
{{? it.schema.$comment && it.opts.$comment }}
{{= it.RULES.all.$comment.code(it, '$comment') }}
{{?}}
{{? $typeSchema }}
{{? it.opts.coerceTypes }}
{{ var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); }}
{{?}}
{{ var $rulesGroup = it.RULES.types[$typeSchema]; }}
{{? $coerceToTypes || $typeIsArray || $rulesGroup === true ||
($rulesGroup && !$shouldUseGroup($rulesGroup)) }}
{{
var $schemaPath = it.schemaPath + '.type'
, $errSchemaPath = it.errSchemaPath + '/type';
}}
{{# def.checkType }}
{{? $coerceToTypes }}
{{# def.coerceType }}
{{??}}
{{# def.error:'type' }}
{{?}}
}
{{?}}
{{?}}
{{? it.schema.$ref && !$refKeywords }}
{{= it.RULES.all.$ref.code(it, '$ref') }}
{{? $breakOnError }}
}
if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) {
{{ $closingBraces2 += '}'; }}
{{?}}
{{??}}
{{~ it.RULES:$rulesGroup }}
{{? $shouldUseGroup($rulesGroup) }}
{{? $rulesGroup.type }}
if ({{= it.util.checkDataType($rulesGroup.type, $data, it.opts.strictNumbers) }}) {
{{?}}
{{? it.opts.useDefaults }}
{{? $rulesGroup.type == 'object' && it.schema.properties }}
{{# def.defaultProperties }}
{{?? $rulesGroup.type == 'array' && Array.isArray(it.schema.items) }}
{{# def.defaultItems }}
{{?}}
{{?}}
{{~ $rulesGroup.rules:$rule }}
{{? $shouldUseRule($rule) }}
{{ var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); }}
{{? $code }}
{{= $code }}
{{? $breakOnError }}
{{ $closingBraces1 += '}'; }}
{{?}}
{{?}}
{{?}}
{{~}}
{{? $breakOnError }}
{{= $closingBraces1 }}
{{ $closingBraces1 = ''; }}
{{?}}
{{? $rulesGroup.type }}
}
{{? $typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes }}
else {
{{
var $schemaPath = it.schemaPath + '.type'
, $errSchemaPath = it.errSchemaPath + '/type';
}}
{{# def.error:'type' }}
}
{{?}}
{{?}}
{{? $breakOnError }}
if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) {
{{ $closingBraces2 += '}'; }}
{{?}}
{{?}}
{{~}}
{{?}}
{{? $breakOnError }} {{= $closingBraces2 }} {{?}}
{{? $top }}
{{? $async }}
if (errors === 0) return data; {{ /* don't edit, used in replace */ }}
else throw new ValidationError(vErrors); {{ /* don't edit, used in replace */ }}
{{??}}
validate.errors = vErrors; {{ /* don't edit, used in replace */ }}
return errors === 0; {{ /* don't edit, used in replace */ }}
{{?}}
};
return validate;
{{??}}
var {{=$valid}} = errors === errs_{{=$lvl}};
{{?}}
{{
function $shouldUseGroup($rulesGroup) {
var rules = $rulesGroup.rules;
for (var i=0; i < rules.length; i++)
if ($shouldUseRule(rules[i]))
return true;
}
function $shouldUseRule($rule) {
return it.schema[$rule.keyword] !== undefined ||
($rule.implements && $ruleImplementsSomeKeyword($rule));
}
function $ruleImplementsSomeKeyword($rule) {
var impl = $rule.implements;
for (var i=0; i < impl.length; i++)
if (it.schema[impl[i]] !== undefined)
return true;
}
}}
@@ -0,0 +1,265 @@
import { useRouter } from "./useRouter.js";
import { useMatch } from "./useMatch.js";
import { useLoaderData } from "./useLoaderData.js";
import { useLoaderDeps } from "./useLoaderDeps.js";
import { useParams } from "./useParams.js";
import { useSearch } from "./useSearch.js";
import { useNavigate } from "./useNavigate.js";
import { useRouteContext } from "./useRouteContext.js";
import { Link } from "./link.js";
import { BaseRootRoute, BaseRoute, BaseRouteApi, notFound } from "@tanstack/router-core";
import React from "react";
import { jsx } from "react/jsx-runtime";
//#region src/route.tsx
/**
* Returns a route-specific API that exposes type-safe hooks pre-bound
* to a single route ID. Useful for consuming a route's APIs from files
* where the route object isn't directly imported (e.g. code-split files).
*
* @param id Route ID string literal for the target route.
* @returns A `RouteApi` instance bound to the given route ID.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/getRouteApiFunction
*/
function getRouteApi(id) {
return new RouteApi({ id });
}
var RouteApi = class extends BaseRouteApi {
/**
* @deprecated Use the `getRouteApi` function instead.
*/
constructor({ id }) {
super({ id });
this.useMatch = (opts) => {
return useMatch({
select: opts?.select,
from: this.id,
structuralSharing: opts?.structuralSharing
});
};
this.useRouteContext = (opts) => {
return useRouteContext({
...opts,
from: this.id
});
};
this.useSearch = (opts) => {
return useSearch({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id
});
};
this.useParams = (opts) => {
return useParams({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id
});
};
this.useLoaderDeps = (opts) => {
return useLoaderDeps({
...opts,
from: this.id,
strict: false
});
};
this.useLoaderData = (opts) => {
return useLoaderData({
...opts,
from: this.id,
strict: false
});
};
this.useNavigate = () => {
return useNavigate({ from: useRouter().routesById[this.id].fullPath });
};
this.notFound = (opts) => {
return notFound({
routeId: this.id,
...opts
});
};
this.Link = React.forwardRef((props, ref) => {
const fullPath = useRouter().routesById[this.id].fullPath;
return /* @__PURE__ */ jsx(Link, {
ref,
from: fullPath,
...props
});
});
}
};
var Route = class extends BaseRoute {
/**
* @deprecated Use the `createRoute` function instead.
*/
constructor(options) {
super(options);
this.useMatch = (opts) => {
return useMatch({
select: opts?.select,
from: this.id,
structuralSharing: opts?.structuralSharing
});
};
this.useRouteContext = (opts) => {
return useRouteContext({
...opts,
from: this.id
});
};
this.useSearch = (opts) => {
return useSearch({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id
});
};
this.useParams = (opts) => {
return useParams({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id
});
};
this.useLoaderDeps = (opts) => {
return useLoaderDeps({
...opts,
from: this.id
});
};
this.useLoaderData = (opts) => {
return useLoaderData({
...opts,
from: this.id
});
};
this.useNavigate = () => {
return useNavigate({ from: this.fullPath });
};
this.Link = React.forwardRef((props, ref) => {
return /* @__PURE__ */ jsx(Link, {
ref,
from: this.fullPath,
...props
});
});
}
};
/**
* Creates a non-root Route instance for code-based routing.
*
* Use this to define a route that will be composed into a route tree
* (typically via a parent route's `addChildren`). If you're using file-based
* routing, prefer `createFileRoute`.
*
* @param options Route options (path, component, loader, context, etc.).
* @returns A Route instance to be attached to the route tree.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRouteFunction
*/
function createRoute(options) {
return new Route(options);
}
/**
* Creates a root route factory that requires a router context type.
*
* Use when your root route expects `context` to be provided to `createRouter`.
* The returned function behaves like `createRootRoute` but enforces a context type.
*
* @returns A factory function to configure and return a root route.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteWithContextFunction
*/
function createRootRouteWithContext() {
return (options) => {
return createRootRoute(options);
};
}
/**
* @deprecated Use the `createRootRouteWithContext` function instead.
*/
var rootRouteWithContext = createRootRouteWithContext;
var RootRoute = class extends BaseRootRoute {
/**
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
*/
constructor(options) {
super(options);
this.useMatch = (opts) => {
return useMatch({
select: opts?.select,
from: this.id,
structuralSharing: opts?.structuralSharing
});
};
this.useRouteContext = (opts) => {
return useRouteContext({
...opts,
from: this.id
});
};
this.useSearch = (opts) => {
return useSearch({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id
});
};
this.useParams = (opts) => {
return useParams({
select: opts?.select,
structuralSharing: opts?.structuralSharing,
from: this.id
});
};
this.useLoaderDeps = (opts) => {
return useLoaderDeps({
...opts,
from: this.id
});
};
this.useLoaderData = (opts) => {
return useLoaderData({
...opts,
from: this.id
});
};
this.useNavigate = () => {
return useNavigate({ from: this.fullPath });
};
this.Link = React.forwardRef((props, ref) => {
return /* @__PURE__ */ jsx(Link, {
ref,
from: this.fullPath,
...props
});
});
}
};
/**
* Creates a root Route instance used to build your route tree.
*
* Typically paired with `createRouter({ routeTree })`. If you need to require
* a typed router context, use `createRootRouteWithContext` instead.
*
* @param options Root route options (component, error, pending, etc.).
* @returns A root route instance.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/createRootRouteFunction
*/
function createRootRoute(options) {
return new RootRoute(options);
}
function createRouteMask(opts) {
return opts;
}
var NotFoundRoute = class extends Route {
constructor(options) {
super({
...options,
id: "404"
});
}
};
//#endregion
export { NotFoundRoute, RootRoute, Route, RouteApi, createRootRoute, createRootRouteWithContext, createRoute, createRouteMask, getRouteApi, rootRouteWithContext };
//# sourceMappingURL=route.js.map
@@ -0,0 +1,24 @@
export {};
// These interfaces are absent from lib.webworker, so the conditionals use `onabort` rather than `onmessage`
type _Storage = typeof globalThis extends { onabort: any } ? {} : Storage;
interface Storage {
readonly length: number;
clear(): void;
getItem(key: string): string | null;
key(index: number): string | null;
removeItem(key: string): void;
setItem(key: string, value: string): void;
[key: string]: any;
}
declare global {
interface Storage extends _Storage {}
var Storage: typeof globalThis extends { onabort: any; Storage: infer T } ? T : {
prototype: Storage;
new(): Storage;
};
var localStorage: Storage;
var sessionStorage: Storage;
}
@@ -0,0 +1,263 @@
'use strict'
const util = require('../core/util')
const assert = require('node:assert')
const { InvalidArgumentError, MaxRedirectsError } = require('../core/errors')
const { kRequestOrigin, kRedirectCacheControl } = require('../core/symbols')
const redirectableStatusCodes = [300, 301, 302, 303, 307, 308]
const noop = () => {}
class RedirectHandler {
static buildDispatch (dispatcher, maxRedirections) {
if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
throw new InvalidArgumentError('maxRedirections must be a positive number')
}
const dispatch = dispatcher.dispatch.bind(dispatcher)
return (opts, originalHandler) => dispatch(opts, new RedirectHandler(dispatch, maxRedirections, opts, originalHandler))
}
constructor (dispatch, maxRedirections, opts, handler) {
if (maxRedirections != null && (!Number.isInteger(maxRedirections) || maxRedirections < 0)) {
throw new InvalidArgumentError('maxRedirections must be a positive number')
}
if (opts.throwOnMaxRedirect != null && typeof opts.throwOnMaxRedirect !== 'boolean') {
throw new InvalidArgumentError('throwOnMaxRedirect must be a boolean')
}
this.dispatch = dispatch
this.location = null
const { maxRedirections: _, stripHeadersOnRedirect, stripHeadersOnCrossOriginRedirect, ...cleanOpts } = opts
this.opts = cleanOpts // opts must be a copy, exclude maxRedirections
this.opts.body = util.wrapRequestBody(this.opts.body)
this.stripHeadersOnRedirect = normalizeStripHeaders(stripHeadersOnRedirect, 'stripHeadersOnRedirect')
this.stripHeadersOnCrossOriginRedirect = normalizeStripHeaders(stripHeadersOnCrossOriginRedirect, 'stripHeadersOnCrossOriginRedirect')
this.maxRedirections = maxRedirections
this.handler = handler
this.history = []
// `cache-control` of each intermediate (suppressed) redirect hop. An outer
// cache uses it to preserve a hop's storage policy (e.g. `no-store`) that
// would otherwise be lost because the hop's response is not forwarded. It
// travels as a non-enumerable property of the history array so it reaches
// the cache without becoming part of the public request/response context.
Object.defineProperty(this.history, kRedirectCacheControl, {
value: [],
enumerable: false
})
}
onRequestStart (controller, context) {
this.handler.onRequestStart?.(controller, { ...context, history: this.history })
}
onBodySent (chunk) {
this.handler.onBodySent?.(chunk)
}
onRequestSent () {
this.handler.onRequestSent?.()
}
onRequestUpgrade (controller, statusCode, headers, socket) {
this.handler.onRequestUpgrade?.(controller, statusCode, headers, socket)
}
onResponseStart (controller, statusCode, headers, statusMessage) {
if (statusCode < 200) {
this.handler.onResponseStart?.(controller, statusCode, headers, statusMessage)
return
}
let removeContentHeaders = statusCode === 303
// https://tools.ietf.org/html/rfc7231#section-6.4.2
// https://fetch.spec.whatwg.org/#http-redirect-fetch
// In case of HTTP 301 or 302 with POST, change the method to GET
// QUERY is safe (RFC 10008) and should not change method like GET.
if ((statusCode === 301 || statusCode === 302) && this.opts.method === 'POST') {
this.opts.method = 'GET'
if (util.isStream(this.opts.body)) {
util.destroy(this.opts.body.on('error', noop))
}
this.opts.body = null
removeContentHeaders = true
}
// https://tools.ietf.org/html/rfc7231#section-6.4.4
// In case of HTTP 303, always replace method to be either HEAD or GET
if (statusCode === 303 && this.opts.method !== 'HEAD') {
this.opts.method = 'GET'
if (util.isStream(this.opts.body)) {
util.destroy(this.opts.body.on('error', noop))
}
this.opts.body = null
}
this.location = util.isDisturbed(this.opts.body) || redirectableStatusCodes.indexOf(statusCode) === -1
? null
: headers.location || null
// Only a redirect that would otherwise be followed counts against the
// limit. The final response after exactly maxRedirections redirects, or a
// 3xx without a Location header, is delivered as usual.
if (this.location && this.history.length >= this.maxRedirections) {
if (this.opts.throwOnMaxRedirect) {
throw new MaxRedirectsError()
}
this.location = null
}
const requestOrigin = this.opts[kRequestOrigin] === undefined
? this.opts.origin
: this.opts[kRequestOrigin]
if (requestOrigin) {
this.history.push(new URL(this.opts.path, requestOrigin))
}
if (!this.location) {
this.handler.onResponseStart?.(controller, statusCode, headers, statusMessage)
return
}
// This hop's response is suppressed (only its Location is used). Record its
// cache-control so an outer cache can honor a restrictive policy that would
// otherwise be lost when the final response is stored.
this.history[kRedirectCacheControl].push(headers['cache-control'])
const baseUrl = requestOrigin
? new URL(this.opts.path, requestOrigin)
: undefined
const { origin, pathname, search } = util.parseURL(new URL(this.location, baseUrl))
const path = search ? `${pathname}${search}` : pathname
// Check for redirect loops by seeing if we've already visited this URL in our history
// This catches the case where Client/Pool try to handle cross-origin redirects but fail
// and keep redirecting to the same URL in an infinite loop
const redirectUrlString = `${origin}${path}`
for (const historyUrl of this.history) {
if (historyUrl.toString() === redirectUrlString) {
throw new InvalidArgumentError(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`)
}
}
// Remove headers referring to the original URL.
// By default it is Host only. A 303 or a 301/302 POST-to-GET redirect also removes all Content-* headers.
// https://tools.ietf.org/html/rfc7231#section-6.4
this.opts.headers = cleanRequestHeaders(this.opts.headers, removeContentHeaders, requestOrigin !== origin, this.stripHeadersOnRedirect, this.stripHeadersOnCrossOriginRedirect)
this.opts.path = path
this.opts.origin = origin
this.opts[kRequestOrigin] = origin
this.opts.query = null
}
onResponseData (controller, chunk) {
if (this.location) {
/*
https://tools.ietf.org/html/rfc7231#section-6.4
TLDR: undici always ignores 3xx response bodies.
Redirection is used to serve the requested resource from another URL, so it assumes that
no body is generated (and thus can be ignored). Even though generating a body is not prohibited.
For status 301, 302, 303, 307 and 308 (the latter from RFC 7238), the specs mention that the body usually
(which means it's optional and not mandated) contain just an hyperlink to the value of
the Location response header, so the body can be ignored safely.
For status 300, which is "Multiple Choices", the spec mentions both generating a Location
response header AND a response body with the other possible location to follow.
Since the spec explicitly chooses not to specify a format for such body and leave it to
servers and browsers implementors, we ignore the body as there is no specified way to eventually parse it.
*/
} else {
this.handler.onResponseData?.(controller, chunk)
}
}
onResponseEnd (controller, trailers) {
if (this.location) {
/*
https://tools.ietf.org/html/rfc7231#section-6.4
TLDR: undici always ignores 3xx response trailers as they are not expected in case of redirections
and neither are useful if present.
See comment on onData method above for more detailed information.
*/
this.dispatch(this.opts, this)
} else {
this.handler.onResponseEnd(controller, trailers)
}
}
onResponseError (controller, error) {
this.handler.onResponseError?.(controller, error)
}
}
// https://tools.ietf.org/html/rfc7231#section-6.4.4
function shouldRemoveHeader (header, removeContent, unknownOrigin, stripHeaders, stripHeadersOnCrossOrigin) {
const name = util.headerNameToString(header)
if (name === 'host') {
return true
}
if (stripHeaders?.has(name) || (unknownOrigin && stripHeadersOnCrossOrigin?.has(name))) {
return true
}
if (removeContent && name.startsWith('content-')) {
return true
}
if (unknownOrigin) {
return name === 'authorization' || name === 'cookie' || name === 'proxy-authorization'
}
return false
}
// https://tools.ietf.org/html/rfc7231#section-6.4
function normalizeStripHeaders (headers, optionName) {
if (headers == null) {
return null
}
if (!Array.isArray(headers)) {
throw new InvalidArgumentError(`${optionName} must be an array`)
}
const normalized = new Set()
for (const header of headers) {
if (typeof header !== 'string') {
throw new InvalidArgumentError(`${optionName} must contain header names`)
}
normalized.add(util.headerNameToString(header))
}
return normalized
}
function cleanRequestHeaders (headers, removeContent, unknownOrigin, stripHeaders, stripHeadersOnCrossOrigin) {
const ret = []
if (Array.isArray(headers)) {
for (let i = 0; i < headers.length; i += 2) {
if (!shouldRemoveHeader(headers[i], removeContent, unknownOrigin, stripHeaders, stripHeadersOnCrossOrigin)) {
ret.push(headers[i], headers[i + 1])
}
}
} else if (headers && typeof headers === 'object') {
const entries = util.hasSafeIterator(headers) ? headers : Object.entries(headers)
for (const [key, value] of entries) {
if (!shouldRemoveHeader(key, removeContent, unknownOrigin, stripHeaders, stripHeadersOnCrossOrigin)) {
ret.push(key, value)
}
}
} else {
assert(headers == null, 'headers must be an object or an array')
}
return ret
}
module.exports = RedirectHandler
@@ -0,0 +1,134 @@
import { ModuleEvaluator, ModuleRunnerImportMeta, ModuleRunnerContext, EvaluatedModuleNode } from 'vite/module-runner';
import { V as VitestEvaluatedModules } from './chunks/evaluatedModules.d.BxJ5omdx.js';
import vm from 'node:vm';
import { R as RuntimeRPC } from './chunks/rpc.d.B_8sPU0w.js';
import '@vitest/runner';
import '@vitest/snapshot';
import './chunks/traces.d.D2T_R8rx.js';
type ModuleExecutionInfo = Map<string, ModuleExecutionInfoEntry>;
interface ModuleExecutionInfoEntry {
startOffset: number;
/** The duration that was spent executing the module. */
duration: number;
/** The time that was spent executing the module itself and externalized imports. */
selfTime: number;
external?: boolean;
importer?: string;
}
declare class FileMap {
private fsCache;
private fsBufferCache;
readFileAsync(path: string): Promise<string>;
readFile(path: string): string;
readBuffer(path: string): Buffer<ArrayBuffer>;
}
interface ModuleEvaluateOptions {
timeout?: vm.RunningScriptOptions["timeout"] | undefined;
breakOnSigint?: vm.RunningScriptOptions["breakOnSigint"] | undefined;
}
type ModuleLinker = (specifier: string, referencingModule: VMModule, extra: {
assert: object;
}) => VMModule | Promise<VMModule>;
type ModuleStatus = "unlinked" | "linking" | "linked" | "evaluating" | "evaluated" | "errored";
declare class VMModule {
dependencySpecifiers: readonly string[];
error: any;
identifier: string;
context: vm.Context;
namespace: object;
status: ModuleStatus;
evaluate(options?: ModuleEvaluateOptions): Promise<void>;
link(linker: ModuleLinker): Promise<void>;
}
interface ExternalModulesExecutorOptions {
context: vm.Context;
fileMap: FileMap;
packageCache: Map<string, any>;
transform: RuntimeRPC["transform"];
interopDefault?: boolean;
viteClientModule: Record<string, unknown>;
}
declare class ExternalModulesExecutor {
#private;
private options;
private cjs;
private esm;
private vite;
private context;
private fs;
private resolvers;
constructor(options: ExternalModulesExecutorOptions);
import(identifier: string): Promise<object>;
require(identifier: string): any;
createRequire(identifier: string): NodeJS.Require;
importModuleDynamically: (specifier: string, referencer: VMModule) => Promise<VMModule>;
resolveModule: (specifier: string, referencer: string) => Promise<VMModule>;
resolve(specifier: string, parent: string): string;
private getModuleInformation;
private createModule;
private get isNetworkSupported();
}
declare module "vite/module-runner" {
interface EvaluatedModuleNode {
/**
* @internal
*/
mockedExports?: Record<string, any>;
}
}
declare module "vite/module-runner" {
interface EvaluatedModuleNode {
/**
* @internal
*/
mockedExports?: Record<string, any>;
}
}
interface VitestVmOptions {
context: vm.Context;
externalModulesExecutor: ExternalModulesExecutor;
}
interface VitestModuleEvaluatorOptions {
evaluatedModules?: VitestEvaluatedModules;
interopDefault?: boolean | undefined;
moduleExecutionInfo?: ModuleExecutionInfo;
getCurrentTestFilepath?: () => string | undefined;
compiledFunctionArgumentsNames?: string[];
compiledFunctionArgumentsValues?: unknown[];
}
declare class VitestModuleEvaluator implements ModuleEvaluator {
private options;
stubs: Record<string, any>;
env: ModuleRunnerImportMeta["env"];
private vm;
private compiledFunctionArgumentsNames?;
private compiledFunctionArgumentsValues;
private primitives;
private debug;
private _otel;
private _evaluatedModules?;
constructor(vmOptions?: VitestVmOptions | undefined, options?: VitestModuleEvaluatorOptions);
private convertIdToImportUrl;
runExternalModule(id: string): Promise<any>;
runInlinedModule(context: ModuleRunnerContext, code: string, module: Readonly<EvaluatedModuleNode>): Promise<any>;
private _createCJSGlobals;
private _runInlinedModule;
private createRequire;
private shouldInterop;
}
declare function createImportMetaEnvProxy(): ModuleRunnerImportMeta["env"];
declare function getDefaultRequestStubs(context?: vm.Context): Record<string, any>;
declare function isPrimitive(v: any): boolean;
declare function wrapId(id: string): string;
declare function unwrapId(id: string): string;
export { VitestModuleEvaluator, createImportMetaEnvProxy, getDefaultRequestStubs, isPrimitive, unwrapId, wrapId };
export type { VitestModuleEvaluatorOptions };
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const CircleOff = createLucideIcon("CircleOff", [
["path", { d: "m2 2 20 20", key: "1ooewy" }],
["path", { d: "M8.35 2.69A10 10 0 0 1 21.3 15.65", key: "1pfsoa" }],
["path", { d: "M19.08 19.08A10 10 0 1 1 4.92 4.92", key: "1ablyi" }]
]);
export { CircleOff as default };
//# sourceMappingURL=circle-off.js.map
@@ -0,0 +1 @@
{"version":3,"file":"sourcemap-codec.d.ts","sourceRoot":"","sources":["../src/sourcemap-codec.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEhG,MAAM,MAAM,gBAAgB,GACxB,CAAC,MAAM,CAAC,GACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC/C,MAAM,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC;AAEhD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAiD1D;AAUD,wBAAgB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;AAC3D,wBAAgB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC"}
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Colin McDonnell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,4 @@
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
export { isSVGTag };
//# sourceMappingURL=is-svg-tag.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["src/hmac.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAML,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,qBAAa,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAE,YAAW,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7D,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,UAAS;IACf,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,SAAS,CAAS;gBAEd,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC;IAsBpD,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI;IAKnC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI;IAYvC,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC;IAK1B,UAAU,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAcnC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC;IAGjB,OAAO,IAAI,IAAI;CAKhB;AAED;;;;;;;;;;;;;GAaG;AACH,KAAK,MAAM,GAAG;IACZ,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;IACxF,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;CACpE,CAAC;AACF,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,MAAM,CAS1B,CAAC"}
@@ -0,0 +1,22 @@
import { MiddlewareHandler } from "../../types.js";
//#region src/middleware/logger/index.d.ts
type PrintFunc = (str: string, ...rest: string[]) => void;
/**
* Logger Middleware for Hono.
*
* @see {@link https://hono.dev/docs/middleware/builtin/logger}
*
* @param {PrintFunc} [fn=console.log] - Optional function for customized logging behavior.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
*
* app.use(logger())
* app.get('/', (c) => c.text('Hello Hono!'))
* ```
*/
export declare const logger: (fn?: PrintFunc) => MiddlewareHandler;
//#endregion
export {};
@@ -0,0 +1,30 @@
import { PrettyFormatOptions } from '@vitest/pretty-format';
type Inspect = (value: unknown, options: Options) => string;
interface Options {
showHidden: boolean;
depth: number;
colors: boolean;
customInspect: boolean;
showProxy: boolean;
maxArrayLength: number;
breakLength: number;
truncate: number;
seen: unknown[];
inspect: Inspect;
stylize: (value: string, styleType: string) => string;
}
type LoupeOptions = Partial<Options>;
interface StringifyOptions extends PrettyFormatOptions {
maxLength?: number;
filterNode?: string | ((node: any) => boolean);
}
declare function stringify(object: unknown, maxDepth?: number, { maxLength, filterNode, ...options }?: StringifyOptions): string;
declare const formatRegExp: RegExp;
declare function format(...args: unknown[]): string;
declare function browserFormat(...args: unknown[]): string;
declare function inspect(obj: unknown, options?: LoupeOptions): string;
declare function objDisplay(obj: unknown, options?: LoupeOptions): string;
export { browserFormat, format, formatRegExp, inspect, objDisplay, stringify };
export type { LoupeOptions, StringifyOptions };
@@ -0,0 +1 @@
{"version":3,"file":"WritableStream.js","sourceRoot":"","sources":["../../src/WritableStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAoC,MAAM,aAAa,CAAC;AACvE;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,2GAA2G;AAC3G,SAAS,QAAQ,CAAC,MAAuB,EAAE,QAAgB;IACvD,OAAO,QAAQ,KAAK,QAAQ,CAAC;AACjC,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,QAAQ;IAIxC,YAAY,GAAqB,EAAE,OAAuB;QACtD,KAAK,CAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;QAHnB,aAAQ,GAAG,IAAI,aAAa,EAAE,CAAC;QAI5C,IAAI,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAEQ,MAAM,CACX,KAAsB,EACtB,QAAgB,EAChB,QAAoB;QAEpB,IAAI,CAAC,OAAO,CAAC,KAAK,CACd,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CACjE,CAAC;QACF,QAAQ,EAAE,CAAC;IACf,CAAC;IAEQ,MAAM,CAAC,QAAoB;QAChC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QACtC,QAAQ,EAAE,CAAC;IACf,CAAC;CACJ"}
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Minimize2 = createLucideIcon("Minimize2", [
["polyline", { points: "4 14 10 14 10 20", key: "11kfnr" }],
["polyline", { points: "20 10 14 10 14 4", key: "rlmsce" }],
["line", { x1: "14", x2: "21", y1: "10", y2: "3", key: "o5lafz" }],
["line", { x1: "3", x2: "10", y1: "21", y2: "14", key: "1atl0r" }]
]);
export { Minimize2 as default };
//# sourceMappingURL=minimize-2.js.map
@@ -0,0 +1,20 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const BellElectric = createLucideIcon("BellElectric", [
["path", { d: "M18.8 4A6.3 8.7 0 0 1 20 9", key: "xve1fh" }],
["path", { d: "M9 9h.01", key: "1q5me6" }],
["circle", { cx: "9", cy: "9", r: "7", key: "p2h5vp" }],
["rect", { width: "10", height: "6", x: "4", y: "16", rx: "2", key: "17f3te" }],
["path", { d: "M14 19c3 0 4.6-1.6 4.6-1.6", key: "n7odp6" }],
["circle", { cx: "20", cy: "16", r: "2", key: "1v9bxh" }]
]);
export { BellElectric as default };
//# sourceMappingURL=bell-electric.js.map
@@ -0,0 +1,455 @@
/// <reference types="node" />
import { EventEmitter } from "events";
import {
Agent,
ClientRequest,
ClientRequestArgs,
IncomingMessage,
OutgoingHttpHeaders,
Server as HTTPServer,
} from "http";
import { Server as HTTPSServer } from "https";
import { createConnection } from "net";
import { Duplex, DuplexOptions } from "stream";
import { SecureContextOptions } from "tls";
import { URL } from "url";
import { ZlibOptions } from "zlib";
// can not get all overload of BufferConstructor['from'], need to copy all it's first arguments here
// https://github.com/microsoft/TypeScript/issues/32164
type BufferLike =
| string
| Buffer
| DataView
| number
| ArrayBufferView
| Uint8Array
| ArrayBuffer
| SharedArrayBuffer
| Blob
| readonly any[]
| readonly number[]
| { valueOf(): ArrayBuffer }
| { valueOf(): SharedArrayBuffer }
| { valueOf(): Uint8Array }
| { valueOf(): readonly number[] }
| { valueOf(): string }
| { [Symbol.toPrimitive](hint: string): string };
// WebSocket socket.
declare class WebSocket extends EventEmitter {
/** The connection is not yet open. */
static readonly CONNECTING: 0;
/** The connection is open and ready to communicate. */
static readonly OPEN: 1;
/** The connection is in the process of closing. */
static readonly CLOSING: 2;
/** The connection is closed. */
static readonly CLOSED: 3;
binaryType: "nodebuffer" | "arraybuffer" | "fragments";
readonly bufferedAmount: number;
readonly extensions: string;
/** Indicates whether the websocket is paused */
readonly isPaused: boolean;
readonly protocol: string;
/** The current state of the connection */
readonly readyState:
| typeof WebSocket.CONNECTING
| typeof WebSocket.OPEN
| typeof WebSocket.CLOSING
| typeof WebSocket.CLOSED;
readonly url: string;
/** The connection is not yet open. */
readonly CONNECTING: 0;
/** The connection is open and ready to communicate. */
readonly OPEN: 1;
/** The connection is in the process of closing. */
readonly CLOSING: 2;
/** The connection is closed. */
readonly CLOSED: 3;
onopen: ((event: WebSocket.Event) => void) | null;
onerror: ((event: WebSocket.ErrorEvent) => void) | null;
onclose: ((event: WebSocket.CloseEvent) => void) | null;
onmessage: ((event: WebSocket.MessageEvent) => void) | null;
constructor(address: null);
constructor(address: string | URL, options?: WebSocket.ClientOptions | ClientRequestArgs);
constructor(
address: string | URL,
protocols?: string | string[],
options?: WebSocket.ClientOptions | ClientRequestArgs,
);
close(code?: number, data?: string | Buffer): void;
ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void;
pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void;
// https://github.com/websockets/ws/issues/2076#issuecomment-1250354722
send(data: BufferLike, cb?: (err?: Error) => void): void;
send(
data: BufferLike,
options: {
mask?: boolean | undefined;
binary?: boolean | undefined;
compress?: boolean | undefined;
fin?: boolean | undefined;
},
cb?: (err?: Error) => void,
): void;
terminate(): void;
/**
* Pause the websocket causing it to stop emitting events. Some events can still be
* emitted after this is called, until all buffered data is consumed. This method
* is a noop if the ready state is `CONNECTING` or `CLOSED`.
*/
pause(): void;
/**
* Make a paused socket resume emitting events. This method is a noop if the ready
* state is `CONNECTING` or `CLOSED`.
*/
resume(): void;
// HTML5 WebSocket events
addEventListener<K extends keyof WebSocket.WebSocketEventMap>(
type: K,
listener:
| ((event: WebSocket.WebSocketEventMap[K]) => void)
| { handleEvent(event: WebSocket.WebSocketEventMap[K]): void },
options?: WebSocket.EventListenerOptions,
): void;
removeEventListener<K extends keyof WebSocket.WebSocketEventMap>(
type: K,
listener:
| ((event: WebSocket.WebSocketEventMap[K]) => void)
| { handleEvent(event: WebSocket.WebSocketEventMap[K]): void },
): void;
// Events
on(event: "close", listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
on(event: "error", listener: (this: WebSocket, error: Error) => void): this;
on(event: "upgrade", listener: (this: WebSocket, request: IncomingMessage) => void): this;
on(event: "message", listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;
on(event: "open", listener: (this: WebSocket) => void): this;
on(event: "ping" | "pong", listener: (this: WebSocket, data: Buffer) => void): this;
on(event: "redirect", listener: (this: WebSocket, url: string, request: ClientRequest) => void): this;
on(
event: "unexpected-response",
listener: (this: WebSocket, request: ClientRequest, response: IncomingMessage) => void,
): this;
on(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this;
once(event: "close", listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
once(event: "error", listener: (this: WebSocket, error: Error) => void): this;
once(event: "upgrade", listener: (this: WebSocket, request: IncomingMessage) => void): this;
once(event: "message", listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;
once(event: "open", listener: (this: WebSocket) => void): this;
once(event: "ping" | "pong", listener: (this: WebSocket, data: Buffer) => void): this;
once(event: "redirect", listener: (this: WebSocket, url: string, request: ClientRequest) => void): this;
once(
event: "unexpected-response",
listener: (this: WebSocket, request: ClientRequest, response: IncomingMessage) => void,
): this;
once(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this;
off(event: "close", listener: (this: WebSocket, code: number, reason: Buffer) => void): this;
off(event: "error", listener: (this: WebSocket, error: Error) => void): this;
off(event: "upgrade", listener: (this: WebSocket, request: IncomingMessage) => void): this;
off(event: "message", listener: (this: WebSocket, data: WebSocket.RawData, isBinary: boolean) => void): this;
off(event: "open", listener: (this: WebSocket) => void): this;
off(event: "ping" | "pong", listener: (this: WebSocket, data: Buffer) => void): this;
off(event: "redirect", listener: (this: WebSocket, url: string, request: ClientRequest) => void): this;
off(
event: "unexpected-response",
listener: (this: WebSocket, request: ClientRequest, response: IncomingMessage) => void,
): this;
off(event: string | symbol, listener: (this: WebSocket, ...args: any[]) => void): this;
addListener(event: "close", listener: (code: number, reason: Buffer) => void): this;
addListener(event: "error", listener: (error: Error) => void): this;
addListener(event: "upgrade", listener: (request: IncomingMessage) => void): this;
addListener(event: "message", listener: (data: WebSocket.RawData, isBinary: boolean) => void): this;
addListener(event: "open", listener: () => void): this;
addListener(event: "ping" | "pong", listener: (data: Buffer) => void): this;
addListener(event: "redirect", listener: (url: string, request: ClientRequest) => void): this;
addListener(
event: "unexpected-response",
listener: (request: ClientRequest, response: IncomingMessage) => void,
): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: "close", listener: (code: number, reason: Buffer) => void): this;
removeListener(event: "error", listener: (error: Error) => void): this;
removeListener(event: "upgrade", listener: (request: IncomingMessage) => void): this;
removeListener(event: "message", listener: (data: WebSocket.RawData, isBinary: boolean) => void): this;
removeListener(event: "open", listener: () => void): this;
removeListener(event: "ping" | "pong", listener: (data: Buffer) => void): this;
removeListener(event: "redirect", listener: (url: string, request: ClientRequest) => void): this;
removeListener(
event: "unexpected-response",
listener: (request: ClientRequest, response: IncomingMessage) => void,
): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
declare namespace WebSocket {
/**
* Data represents the raw message payload received over the WebSocket.
*/
type RawData = Buffer | ArrayBuffer | Buffer[];
/**
* Data represents the message payload received over the WebSocket.
*/
type Data = string | Buffer | ArrayBuffer | Buffer[];
/**
* CertMeta represents the accepted types for certificate & key data.
*/
type CertMeta = string | string[] | Buffer | Buffer[];
/**
* VerifyClientCallbackSync is a synchronous callback used to inspect the
* incoming message. The return value (boolean) of the function determines
* whether or not to accept the handshake.
*/
type VerifyClientCallbackSync<Request extends IncomingMessage = IncomingMessage> = (info: {
origin: string;
secure: boolean;
req: Request;
}) => boolean;
/**
* VerifyClientCallbackAsync is an asynchronous callback used to inspect the
* incoming message. The return value (boolean) of the function determines
* whether or not to accept the handshake.
*/
type VerifyClientCallbackAsync<Request extends IncomingMessage = IncomingMessage> = (
info: { origin: string; secure: boolean; req: Request },
callback: (res: boolean, code?: number, message?: string, headers?: OutgoingHttpHeaders) => void,
) => void;
/**
* FinishRequestCallback is a callback for last minute customization of the
* headers. If finishRequest is set, then it has the responsibility to call
* request.end() once it is done setting request headers.
*/
type FinishRequestCallback = (request: ClientRequest, websocket: WebSocket) => void;
interface ClientOptions extends SecureContextOptions {
protocol?: string | undefined;
followRedirects?: boolean | undefined;
generateMask?(mask: Buffer): void;
handshakeTimeout?: number | undefined;
maxRedirects?: number | undefined;
perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined;
localAddress?: string | undefined;
protocolVersion?: number | undefined;
headers?: { [key: string]: string } | undefined;
origin?: string | undefined;
agent?: Agent | undefined;
host?: string | undefined;
family?: number | undefined;
checkServerIdentity?(servername: string, cert: CertMeta): boolean;
rejectUnauthorized?: boolean | undefined;
allowSynchronousEvents?: boolean | undefined;
autoPong?: boolean | undefined;
maxPayload?: number | undefined;
maxBufferedChunks?: number | undefined;
maxFragments?: number | undefined;
skipUTF8Validation?: boolean | undefined;
createConnection?: typeof createConnection | undefined;
finishRequest?: FinishRequestCallback | undefined;
}
interface PerMessageDeflateOptions {
serverNoContextTakeover?: boolean | undefined;
clientNoContextTakeover?: boolean | undefined;
serverMaxWindowBits?: number | undefined;
clientMaxWindowBits?: number | undefined;
zlibDeflateOptions?:
| {
flush?: number | undefined;
finishFlush?: number | undefined;
chunkSize?: number | undefined;
windowBits?: number | undefined;
level?: number | undefined;
memLevel?: number | undefined;
strategy?: number | undefined;
dictionary?: Buffer | Buffer[] | DataView | undefined;
info?: boolean | undefined;
}
| undefined;
zlibInflateOptions?: ZlibOptions | undefined;
threshold?: number | undefined;
concurrencyLimit?: number | undefined;
}
interface Event {
type: string;
target: WebSocket;
}
interface ErrorEvent {
error: any;
message: string;
type: string;
target: WebSocket;
}
interface CloseEvent {
wasClean: boolean;
code: number;
reason: string;
type: string;
target: WebSocket;
}
interface MessageEvent {
data: Data;
type: string;
target: WebSocket;
}
interface WebSocketEventMap {
open: Event;
error: ErrorEvent;
close: CloseEvent;
message: MessageEvent;
}
interface EventListenerOptions {
once?: boolean | undefined;
}
interface ServerOptions<
U extends typeof WebSocket = typeof WebSocket,
V extends typeof IncomingMessage = typeof IncomingMessage,
> {
host?: string | undefined;
port?: number | undefined;
backlog?: number | undefined;
server?: HTTPServer<V> | HTTPSServer<V> | undefined;
verifyClient?:
| VerifyClientCallbackAsync<InstanceType<V>>
| VerifyClientCallbackSync<InstanceType<V>>
| undefined;
handleProtocols?: (protocols: Set<string>, request: InstanceType<V>) => string | false;
path?: string | undefined;
noServer?: boolean | undefined;
allowSynchronousEvents?: boolean | undefined;
autoPong?: boolean | undefined;
clientTracking?: boolean | undefined;
perMessageDeflate?: boolean | PerMessageDeflateOptions | undefined;
maxPayload?: number | undefined;
maxBufferedChunks?: number | undefined;
maxFragments?: number | undefined;
skipUTF8Validation?: boolean | undefined;
WebSocket?: U | undefined;
}
interface AddressInfo {
address: string;
family: string;
port: number;
}
}
export import AddressInfo = WebSocket.AddressInfo;
export import CertMeta = WebSocket.CertMeta;
export import ClientOptions = WebSocket.ClientOptions;
export import CloseEvent = WebSocket.CloseEvent;
export import Data = WebSocket.Data;
export import ErrorEvent = WebSocket.ErrorEvent;
export import Event = WebSocket.Event;
export import EventListenerOptions = WebSocket.EventListenerOptions;
export import FinishRequestCallback = WebSocket.FinishRequestCallback;
export import MessageEvent = WebSocket.MessageEvent;
export import PerMessageDeflateOptions = WebSocket.PerMessageDeflateOptions;
export import RawData = WebSocket.RawData;
export import ServerOptions = WebSocket.ServerOptions;
export import VerifyClientCallbackAsync = WebSocket.VerifyClientCallbackAsync;
export import VerifyClientCallbackSync = WebSocket.VerifyClientCallbackSync;
// WebSocket Server
declare class Server<
T extends typeof WebSocket = typeof WebSocket,
U extends typeof IncomingMessage = typeof IncomingMessage,
> extends EventEmitter {
options: WebSocket.ServerOptions<T, U>;
path: string;
clients: Set<InstanceType<T>>;
constructor(options?: WebSocket.ServerOptions<T, U>, callback?: () => void);
address(): WebSocket.AddressInfo | string | null;
close(cb?: (err?: Error) => void): void;
handleUpgrade(
request: InstanceType<U>,
socket: Duplex,
upgradeHead: Buffer,
callback: (client: InstanceType<T>, request: InstanceType<U>) => void,
): void;
shouldHandle(request: InstanceType<U>): boolean | Promise<boolean>;
// Events
on(event: "connection", cb: (this: Server<T>, websocket: InstanceType<T>, request: InstanceType<U>) => void): this;
on(event: "error", cb: (this: Server<T>, error: Error) => void): this;
on(event: "headers", cb: (this: Server<T>, headers: string[], request: InstanceType<U>) => void): this;
on(event: "close" | "listening", cb: (this: Server<T>) => void): this;
on(
event: "wsClientError",
cb: (this: Server<T>, error: Error, socket: Duplex, request: InstanceType<U>) => void,
): this;
on(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
once(
event: "connection",
cb: (this: Server<T>, websocket: InstanceType<T>, request: InstanceType<U>) => void,
): this;
once(event: "error", cb: (this: Server<T>, error: Error) => void): this;
once(event: "headers", cb: (this: Server<T>, headers: string[], request: InstanceType<U>) => void): this;
once(event: "close" | "listening", cb: (this: Server<T>) => void): this;
once(
event: "wsClientError",
cb: (this: Server<T>, error: Error, socket: Duplex, request: InstanceType<U>) => void,
): this;
once(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
off(event: "connection", cb: (this: Server<T>, websocket: InstanceType<T>, request: InstanceType<U>) => void): this;
off(event: "error", cb: (this: Server<T>, error: Error) => void): this;
off(event: "headers", cb: (this: Server<T>, headers: string[], request: InstanceType<U>) => void): this;
off(event: "close" | "listening", cb: (this: Server<T>) => void): this;
off(
event: "wsClientError",
cb: (this: Server<T>, error: Error, socket: Duplex, request: InstanceType<U>) => void,
): this;
off(event: string | symbol, listener: (this: Server<T>, ...args: any[]) => void): this;
addListener(event: "connection", cb: (websocket: InstanceType<T>, request: InstanceType<U>) => void): this;
addListener(event: "error", cb: (error: Error) => void): this;
addListener(event: "headers", cb: (headers: string[], request: InstanceType<U>) => void): this;
addListener(event: "close" | "listening", cb: () => void): this;
addListener(event: "wsClientError", cb: (error: Error, socket: Duplex, request: InstanceType<U>) => void): this;
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
removeListener(event: "connection", cb: (websocket: InstanceType<T>, request: InstanceType<U>) => void): this;
removeListener(event: "error", cb: (error: Error) => void): this;
removeListener(event: "headers", cb: (headers: string[], request: InstanceType<U>) => void): this;
removeListener(event: "close" | "listening", cb: () => void): this;
removeListener(event: "wsClientError", cb: (error: Error, socket: Duplex, request: InstanceType<U>) => void): this;
removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
}
export { type Server };
export const WebSocketServer: typeof Server;
export interface WebSocketServer extends Server {} // eslint-disable-line @typescript-eslint/no-empty-interface
// WebSocket stream
export function createWebSocketStream(websocket: WebSocket, options?: DuplexOptions): Duplex;
export default WebSocket;
export { WebSocket };
@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const isLength = require("./isLength.js");
function isArrayLike(value) {
return value != null && isLength.isLength(value.length) && typeof value !== "function";
}
exports.isArrayLike = isArrayLike;
@@ -0,0 +1,90 @@
'use strict';
var MissingRefError = require('./error_classes').MissingRef;
module.exports = compileAsync;
/**
* Creates validating function for passed schema with asynchronous loading of missing schemas.
* `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema.
* @this Ajv
* @param {Object} schema schema object
* @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
* @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function.
* @return {Promise} promise that resolves with a validating function.
*/
function compileAsync(schema, meta, callback) {
/* eslint no-shadow: 0 */
/* global Promise */
/* jshint validthis: true */
var self = this;
if (typeof this._opts.loadSchema != 'function')
throw new Error('options.loadSchema should be a function');
if (typeof meta == 'function') {
callback = meta;
meta = undefined;
}
var p = loadMetaSchemaOf(schema).then(function () {
var schemaObj = self._addSchema(schema, undefined, meta);
return schemaObj.validate || _compileAsync(schemaObj);
});
if (callback) {
p.then(
function(v) { callback(null, v); },
callback
);
}
return p;
function loadMetaSchemaOf(sch) {
var $schema = sch.$schema;
return $schema && !self.getSchema($schema)
? compileAsync.call(self, { $ref: $schema }, true)
: Promise.resolve();
}
function _compileAsync(schemaObj) {
try { return self._compile(schemaObj); }
catch(e) {
if (e instanceof MissingRefError) return loadMissingSchema(e);
throw e;
}
function loadMissingSchema(e) {
var ref = e.missingSchema;
if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved');
var schemaPromise = self._loadingSchemas[ref];
if (!schemaPromise) {
schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);
schemaPromise.then(removePromise, removePromise);
}
return schemaPromise.then(function (sch) {
if (!added(ref)) {
return loadMetaSchemaOf(sch).then(function () {
if (!added(ref)) self.addSchema(sch, ref, undefined, meta);
});
}
}).then(function() {
return _compileAsync(schemaObj);
});
function removePromise() {
delete self._loadingSchemas[ref];
}
function added(ref) {
return self._refs[ref] || self._schemas[ref];
}
}
}
}
@@ -0,0 +1,14 @@
var Pt=Object.defineProperty;var f=(s,e)=>Pt(s,"name",{value:e,configurable:!0});import{fileURLToPath as Jt,pathToFileURL as Gt}from"node:url";import{version as Ae,transformSync as qt,transform as zt}from"esbuild";import Ht from"node:crypto";import U from"node:fs";import X from"node:path";import Xt from"node:os";import{t as Kt}from"./temporary-directory-CwHp0_NW.mjs";const Ne=f(s=>Ht.createHash("sha1").update(s).digest("hex"),"sha1"),Ie=44,Yt=59,Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$e=new Uint8Array(64),Ue=new Uint8Array(128);for(let s=0;s<Me.length;s++){const e=Me.charCodeAt(s);$e[s]=e,Ue[e]=s}const me=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(s){return Buffer.from(s.buffer,s.byteOffset,s.byteLength).toString()}}:{decode(s){let e="";for(let n=0;n<s.length;n++)e+=String.fromCharCode(s[n]);return e}};function Qt(s){const e=new Int32Array(5),n=[];let i=0;do{const o=Zt(s,i),c=[];let u=!0,p=0;e[0]=0;for(let g=i;g<o;g++){let b;g=K(s,g,e,0);const d=e[0];d<p&&(u=!1),p=d,je(s,g,o)?(g=K(s,g,e,1),g=K(s,g,e,2),g=K(s,g,e,3),je(s,g,o)?(g=K(s,g,e,4),b=[d,e[1],e[2],e[3],e[4]]):b=[d,e[1],e[2],e[3]]):b=[d],c.push(b)}u||Vt(c),n.push(c),i=o+1}while(i<=s.length);return n}f(Qt,"decode");function Zt(s,e){const n=s.indexOf(";",e);return n===-1?s.length:n}f(Zt,"indexOf");function K(s,e,n,i){let o=0,c=0,u=0;do{const g=s.charCodeAt(e++);u=Ue[g],o|=(u&31)<<c,c+=5}while(u&32);const p=o&1;return o>>>=1,p&&(o=-2147483648|-o),n[i]+=o,e}f(K,"decodeInteger");function je(s,e,n){return e>=n?!1:s.charCodeAt(e)!==Ie}f(je,"hasMoreVlq");function Vt(s){s.sort(en)}f(Vt,"sort");function en(s,e){return s[0]-e[0]}f(en,"sortComparator$1");function De(s){const e=new Int32Array(5),n=1024*16,i=n-36,o=new Uint8Array(n),c=o.subarray(0,i);let u=0,p="";for(let g=0;g<s.length;g++){const b=s[g];if(g>0&&(u===n&&(p+=me.decode(o),u=0),o[u++]=Yt),b.length!==0){e[0]=0;for(let d=0;d<b.length;d++){const r=b[d];u>i&&(p+=me.decode(c),o.copyWithin(0,i,u),u-=i),d>0&&(o[u++]=Ie),u=Y(o,u,e,r,0),r.length!==1&&(u=Y(o,u,e,r,1),u=Y(o,u,e,r,2),u=Y(o,u,e,r,3),r.length!==4&&(u=Y(o,u,e,r,4)))}}}return p+me.decode(o.subarray(0,u))}f(De,"encode");function Y(s,e,n,i,o){const c=i[o];let u=c-n[o];n[o]=c,u=u<0?-u<<1|1:u<<1;do{let p=u&31;u>>>=5,u>0&&(p|=32),s[e++]=$e[p]}while(u>0);return e}f(Y,"encodeInteger");class ae{static{f(this,"BitSet")}constructor(e){this.bits=e instanceof ae?e.bits.slice():[]}add(e){this.bits[e>>5]|=1<<(e&31)}has(e){return!!(this.bits[e>>5]&1<<(e&31))}}class ee{static{f(this,"Chunk")}constructor(e,n,i){this.start=e,this.end=n,this.original=i,this.intro="",this.outro="",this.content=i,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(e){this.outro+=e}appendRight(e){this.intro=this.intro+e}clone(){const e=new ee(this.start,this.end,this.original);return e.intro=this.intro,e.outro=this.outro,e.content=this.content,e.storeName=this.storeName,e.edited=this.edited,e}contains(e){return this.start<e&&e<this.end}eachNext(e){let n=this;for(;n;)e(n),n=n.next}eachPrevious(e){let n=this;for(;n;)e(n),n=n.previous}edit(e,n,i){return this.content=e,i||(this.intro="",this.outro=""),this.storeName=n,this.edited=!0,this}prependLeft(e){this.outro=e+this.outro}prependRight(e){this.intro=e+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(e){const n=e-this.start,i=this.original.slice(0,n),o=this.original.slice(n);this.original=i;const c=new ee(e,this.end,o);return c.outro=this.outro,this.outro="",this.end=e,this.edited?(c.edit("",!1),this.content=""):this.content=i,c.next=this.next,c.next&&(c.next.previous=c),c.previous=this,this.next=c,c}toString(){return this.intro+this.content+this.outro}trimEnd(e){if(this.outro=this.outro.replace(e,""),this.outro.length)return!0;const n=this.content.replace(e,"");if(n.length)return n!==this.content&&(this.split(this.start+n.length).edit("",void 0,!0),this.edited&&this.edit(n,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(e,""),this.intro.length)return!0}trimStart(e){if(this.intro=this.intro.replace(e,""),this.intro.length)return!0;const n=this.content.replace(e,"");if(n.length){if(n!==this.content){const i=this.split(this.end-n.length);this.edited&&i.edit(n,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(e,""),this.outro.length)return!0}}function tn(){return typeof globalThis<"u"&&typeof globalThis.btoa=="function"?s=>globalThis.btoa(unescape(encodeURIComponent(s))):typeof Buffer=="function"?s=>Buffer.from(s,"utf-8").toString("base64"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}f(tn,"getBtoa");const nn=tn();let rn=class{static{f(this,"SourceMap")}constructor(e){this.version=3,this.file=e.file,this.sources=e.sources,this.sourcesContent=e.sourcesContent,this.names=e.names,this.mappings=De(e.mappings),typeof e.x_google_ignoreList<"u"&&(thisLine truncated
`),n=e.filter(c=>/^\t+/.test(c)),i=e.filter(c=>/^ {2,}/.test(c));if(n.length===0&&i.length===0)return null;if(n.length>=i.length)return" ";const o=i.reduce((c,u)=>{const p=/^ +/.exec(u)[0].length;return Math.min(p,c)},1/0);return new Array(o+1).join(" ")}f(sn,"guessIndent");function on(s,e){const n=s.split(/[/\\]/),i=e.split(/[/\\]/);for(n.pop();n[0]===i[0];)n.shift(),i.shift();if(n.length){let o=n.length;for(;o--;)n[o]=".."}return n.concat(i).join("/")}f(on,"getRelativePath");const an=Object.prototype.toString;function cn(s){return an.call(s)==="[object Object]"}f(cn,"isObject");function Te(s){const e=s.split(`
`),n=[];for(let i=0,o=0;i<e.length;i++)n.push(o),o+=e[i].length+1;return f(function(o){let c=0,u=n.length;for(;c<u;){const b=c+u>>1;o<n[b]?u=b:c=b+1}const p=c-1,g=o-n[p];return{line:p,column:g}},"locate")}f(Te,"getLocator");const un=/\w/;class ln{static{f(this,"Mappings")}constructor(e){this.hires=e,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(e,n,i,o){if(n.length){const c=n.length-1;let u=n.indexOf(`
`,0),p=-1;for(;u>=0&&c>u;){const b=[this.generatedCodeColumn,e,i.line,i.column];o>=0&&b.push(o),this.rawSegments.push(b),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,p=u,u=n.indexOf(`
`,u+1)}const g=[this.generatedCodeColumn,e,i.line,i.column];o>=0&&g.push(o),this.rawSegments.push(g),this.advance(n.slice(p+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(n));this.pending=null}addUneditedChunk(e,n,i,o,c){let u=n.start,p=!0,g=!1;for(;u<n.end;){if(this.hires||p||c.has(u)){const b=[this.generatedCodeColumn,e,o.line,o.column];this.hires==="boundary"?un.test(i[u])?g||(this.rawSegments.push(b),g=!0):(this.rawSegments.push(b),g=!1):this.rawSegments.push(b)}i[u]===`
`?(o.line+=1,o.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,p=!0):(o.column+=1,this.generatedCodeColumn+=1,p=!1),u+=1}this.pending=null}advance(e){if(!e)return;const n=e.split(`
`);if(n.length>1){for(let i=0;i<n.length-1;i++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=n[n.length-1].length}}const Q=`
`,J={insertLeft:!1,insertRight:!1,storeName:!1};class _e{static{f(this,"MagicString")}constructor(e,n={}){const i=new ee(0,e.length,e);Object.defineProperties(this,{original:{writable:!0,value:e},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:i},lastChunk:{writable:!0,value:i},lastSearchedChunk:{writable:!0,value:i},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:n.filename},indentExclusionRanges:{writable:!0,value:n.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new ae},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:n.ignoreList}}),this.byStart[0]=i,this.byEnd[e.length]=i}addSourcemapLocation(e){this.sourcemapLocations.add(e)}append(e){if(typeof e!="string")throw new TypeError("outro content must be a string");return this.outro+=e,this}appendLeft(e,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(e);const i=this.byEnd[e];return i?i.appendLeft(n):this.intro+=n,this}appendRight(e,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(e);const i=this.byStart[e];return i?i.appendRight(n):this.outro+=n,this}clone(){const e=new _e(this.original,{filename:this.filename});let n=this.firstChunk,i=e.firstChunk=e.lastSearchedChunk=n.clone();for(;n;){e.byStart[i.start]=i,e.byEnd[i.end]=i;const o=n.next,c=o&&o.clone();c&&(i.next=c,c.previous=i,i=c),n=o}return e.lastChunk=i,this.indentExclusionRanges&&(e.indentExclusionRanges=this.indentExclusionRanges.slice()),e.sourcemapLocations=new ae(this.sourcemapLocations),e.intro=this.intro,e.outro=this.outro,e}generateDecodedMap(e){e=e||{};const n=0,i=Object.keys(this.storedNames),o=new ln(e.hires),c=Te(this.original);return this.intro&&o.advance(this.intro),this.firstChunk.eachNext(u=>{const p=c(u.start);u.intro.length&&o.advance(u.intro),u.edited?o.addEdit(n,u.content,p,u.storeName?i.indexOf(u.original):-1):o.addUneditedChunk(n,u,this.original,p,this.sourcemapLocations),u.outro.length&&o.advance(u.outro)}),{file:e.file?e.file.split(/[/\\]/).pop():void 0,sources:[e.source?on(e.file||"",e.source):e.file||""],sourcesContent:e.includeContent?[this.original]:void 0,names:i,mappings:o.raw,x_google_ignoreList:this.ignoreList?[n]:void 0}}generateMap(e){return new rn(this.generateDecodedMap(e))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=sn(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(e,n){const i=/^[^\r\n]/gm;if(cn(e)&&(n=e,e=void 0),e===void 0&&(this._ensureindentStr(),e=this.indentStr||" "),e==="")return this;n=n||{};const o={};n.exclude&&(typeof n.exclude[0]=="number"?[n.exclude]:n.exclude).forEach(d=>{for(let r=d[0];r<d[1];r+=1)o[r]=!0});let c=n.indentStart!==!1;const u=f(b=>c?`${e}${b}`:(c=!0,b),"replacer");this.intro=this.intro.replace(i,u);let p=0,g=this.firstChunk;for(;g;){const b=g.end;if(g.edited)o[p]||(g.content=g.content.replace(i,u),g.content.length&&(c=g.content[g.content.length-1]===`
`));else for(p=g.start;p<b;){if(!o[p]){const d=this.original[p];d===`
`?c=!0:d!=="\r"&&c&&(c=!1,p===g.start||(this._splitChunk(g,p),g=g.next),g.prependRight(e))}p+=1}p=g.end,g=g.next}return this.outro=this.outro.replace(i,u),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(e,n){return J.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),J.insertLeft=!0),this.appendLeft(e,n)}insertRight(e,n){return J.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),J.insertRight=!0),this.prependRight(e,n)}move(e,n,i){if(i>=e&&i<=n)throw new Error("Cannot move a selection inside itself");this._split(e),this._split(n),this._split(i);const o=this.byStart[e],c=this.byEnd[n],u=o.previous,p=c.next,g=this.byStart[i];if(!g&&c===this.lastChunk)return this;const b=g?g.previous:this.lastChunk;return u&&(u.next=p),p&&(p.previous=u),b&&(b.next=o),g&&(g.previous=c),o.previous||(this.firstChunk=c.next),c.next||(this.lastChunk=o.previous,this.lastChunk.next=null),o.previous=b,c.next=g||null,b||(this.firstChunk=o),g||(this.lastChunk=c),this}overwrite(e,n,i,o){return o=o||{},this.update(e,n,i,{...o,overwrite:!o.contentOnly})}update(e,n,i,o){if(typeof i!="string")throw new TypeError("replacement content must be a string");for(;e<0;)e+=this.original.length;for(;n<0;)n+=this.original.length;if(n>this.original.length)throw new Error("end is out of bounds");if(e===n)throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");this._split(e),this._split(n),o===!0&&(J.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),J.storeName=!0),o={storeName:!0});const c=o!==void 0?o.storeName:!1,u=o!==void 0?o.overwrite:!1;if(c){const b=this.original.slice(e,n);Object.defineProperty(this.storedNames,b,{writable:!0,value:!0,enumerable:!0})}const p=this.byStart[e],g=this.byEnd[n];if(p){let b=p;for(;b!==g;){if(b.next!==this.byStart[b.end])throw new Error("Cannot overwrite across a split point");b=b.next,b.edit("",!1)}p.edit(i,c,!u)}else{const b=new ee(e,n,"").edit(i,c);g.next=b,b.previous=g}return this}prepend(e){if(typeof e!="string")throw new TypeError("outro content must be a string");return this.intro=e+this.intro,this}prependLeft(e,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(e);const i=this.byEnd[e];return i?i.prependLeft(n):this.intro=n+this.intro,this}prependRight(e,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(e);const i=this.byStart[e];return i?i.prependRight(n):this.outro=n+this.outro,this}remove(e,n){for(;e<0;)e+=this.original.length;for(;n<0;)n+=this.original.length;if(e===n)return this;if(e<0||n>this.original.length)throw new Error("Character is out of bounds");if(e>n)throw new Error("end must be greater than start");this._split(e),this._split(n);let i=this.byStart[e];for(;i;)i.intro="",i.outro="",i.edit(""),i=n>i.end?this.byStart[i.end]:null;return this}reset(e,n){for(;e<0;)e+=this.original.length;for(;n<0;)n+=this.original.length;if(e===n)return this;if(e<0||n>this.original.length)throw new Error("Character is out of bounds");if(e>n)throw new Error("end must be greater than start");this._split(e),this._split(n);let i=this.byStart[e];for(;i;)i.reset(),i=n>i.end?this.byStart[i.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let e=this.lastChunk;do{if(e.outro.length)return e.outro[e.outro.length-1];if(e.content.length)return e.content[e.content.length-1];if(e.intro.length)return e.intro[e.intro.length-1]}while(e=e.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let e=this.outro.lastIndexOf(Q);if(e!==-1)return this.outro.substr(e+1);let n=this.outro,i=this.lastChunk;do{if(i.outro.length>0){if(e=i.outro.lastIndexOf(Q),e!==-1)return i.outro.substr(e+1)+n;n=i.outro+n}if(i.content.length>0){if(e=i.content.lastIndexOf(Q),e!==-1)return i.content.substr(e+1)+n;n=i.content+n}if(i.intro.length>0){if(e=i.intro.lastIndexOf(Q),e!==-1)return i.intro.substr(e+1)+n;n=i.intro+n}}while(i=i.previous);return e=this.intro.lastIndexOf(Q),e!==-1?this.intro.substr(e+1)+n:this.intro+n}slice(e=0,n=this.original.length){for(;e<0;)e+=this.original.length;for(;n<0;)n+=this.original.length;let i="",o=this.firstChunk;for(;o&&(o.start>e||o.end<=e);){if(o.start<n&&o.end>=n)return i;o=o.next}if(o&&o.edited&&o.start!==e)throw new Error(`Cannot use replaced character ${e} as slice start anchor.`);const c=o;for(;o;){o.intro&&(c!==o||o.start===e)&&(i+=o.intro);const u=o.start<n&&o.end>=n;if(u&&o.edited&&o.end!==n)throw new Error(`Cannot use replaced character ${n} as slice end anchor.`);const p=c===o?e-o.start:0,g=u?o.content.length+n-o.end:o.content.length;if(i+=o.content.slice(p,g),o.outro&&(!u||o.end===n)&&(i+=o.outro),u)break;o=o.next}retuLine truncated
`;case 114:return"\r";case 120:return String.fromCharCode(Ce(2));case 117:return function(){const e=_.charCodeAt(y);let n;return e===123?(++y,n=Ce(_.indexOf("}",y)-y),++y,n>1114111&&D()):n=Ce(4),n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode(55296+(n>>10),56320+(1023&n)))}();case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:_.charCodeAt(y)===10&&++y;case 10:return"";case 56:case 57:D();default:if(s>=48&&s<=55){let e=_.substr(y-1,3).match(/^[0-7]+/)[0],n=parseInt(e,8);return n>255&&(e=e.slice(0,-1),n=parseInt(e,8)),y+=e.length-1,s=_.charCodeAt(y),e==="0"&&s!==56&&s!==57||D(),String.fromCharCode(n)}return Be(s)?"":String.fromCharCode(s)}}f(dn,"k");function Ce(s){const e=y;let n=0,i=0;for(let o=0;o<s;++o,++y){let c,u=_.charCodeAt(y);if(u!==95){if(u>=97)c=u-97+10;else if(u>=65)c=u-65+10;else{if(!(u>=48&&u<=57))break;c=u-48}if(c>=16)break;i=u,n=16*n+c}else i!==95&&o!==0||D(),i=u}return i!==95&&y-e===s||D(),n}f(Ce,"l");function Be(s){return s===13||s===10}f(Be,"u");function D(){throw Object.assign(Error(`Parse error ${We}:${_.slice(0,y).split(`
`).length}:${y-_.lastIndexOf(`
`,y-1)}`),{idx:y})}f(D,"o");let Se;typeof WebAssembly<"u"&&(async()=>{const{parse:s,init:e}=await import("./lexer-DQCqS3nf.mjs");await e,Se=s})();const Pe=f((s,e)=>Se?Se(s,e):fn(s,e),"parseEsm"),gn=f(s=>{if(!s.includes("import")&&!s.includes("export"))return!1;try{return Pe(s)[3]}catch{return!0}},"isESM"),Je="2",bn=(s=>{const e="default";return s[e]&&typeof s[e]=="object"&&"__esModule"in s[e]?s[e]:s}).toString(),pn=`.then(${bn})`,xe=f((s,e,n)=>{if(n){if(!e.includes("import("))return}else if(!e.includes("import"))return;const o=Pe(e,s)[0].filter(g=>g.d>-1);if(o.length===0)return;const c=new _e(e);for(const g of o)c.appendRight(g.se,pn);const u=c.toString(),p=c.generateMap({source:s,includeContent:!1,hires:"boundary"});return{code:u,map:p}},"transformDynamicImport"),Ge=f(s=>{try{const e=U.readFileSync(s,"utf8");return JSON.parse(e)}catch{}},"readJsonFile"),qe=f(()=>{},"noop"),ze=f(()=>Math.floor(Date.now()/1e8),"getTime");class wn extends Map{static{f(this,"FileCache")}cacheDirectory=Kt;oldCacheDirectory=X.join(Xt.tmpdir(),"tsx");cacheFiles;constructor(){super(),U.mkdirSync(this.cacheDirectory,{recursive:!0}),this.cacheFiles=U.readdirSync(this.cacheDirectory).map(e=>{const[n,i]=e.split("-");return{time:Number(n),key:i,fileName:e}}),setImmediate(()=>{this.expireDiskCache(),this.removeOldCacheDirectory()})}get(e){const n=super.get(e);if(n)return n;const i=this.cacheFiles.find(u=>u.key===e);if(!i)return;const o=X.join(this.cacheDirectory,i.fileName),c=Ge(o);if(!c){U.promises.unlink(o).then(()=>{const u=this.cacheFiles.indexOf(i);this.cacheFiles.splice(u,1)},()=>{});return}return super.set(e,c),c}set(e,n){if(super.set(e,n),n){const i=ze();U.promises.writeFile(X.join(this.cacheDirectory,`${i}-${e}`),JSON.stringify(n)).catch(qe)}return this}expireDiskCache(){const e=ze();for(const n of this.cacheFiles)e-n.time>7&&U.promises.unlink(X.join(this.cacheDirectory,n.fileName)).catch(qe)}async removeOldCacheDirectory(){try{await U.promises.access(this.oldCacheDirectory).then(()=>!0)&&("rm"in U.promises?await U.promises.rm(this.oldCacheDirectory,{recursive:!0,force:!0}):await U.promises.rmdir(this.oldCacheDirectory,{recursive:!0}))}catch{}}}var ie=process.env.TSX_DISABLE_CACHE?new Map:new wn;const mn=/^[\w+.-]+:\/\//,kn=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,yn=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function Cn(s){return mn.test(s)}f(Cn,"isAbsoluteUrl");function Sn(s){return s.startsWith("//")}f(Sn,"isSchemeRelativeUrl");function He(s){return s.startsWith("/")}f(He,"isAbsolutePath");function xn(s){return s.startsWith("file:")}f(xn,"isFileUrl");function Xe(s){return/^[.?#]/.test(s)}f(Xe,"isRelative");function se(s){const e=kn.exec(s);return Ke(e[1],e[2]||"",e[3],e[4]||"",e[5]||"/",e[6]||"",e[7]||"")}f(se,"parseAbsoluteUrl");function vn(s){const e=yn.exec(s),n=e[2];return Ke("file:","",e[1]||"","",He(n)?n:"/"+n,e[3]||"",e[4]||"")}f(vn,"parseFileUrl");function Ke(s,e,n,i,o,c,u){return{scheme:s,user:e,host:n,port:i,path:o,query:c,hash:u,type:7}}f(Ke,"makeUrl");function Ye(s){if(Sn(s)){const n=se("http:"+s);return n.scheme="",n.type=6,n}if(He(s)){const n=se("http://foo.com"+s);return n.scheme="",n.host="",n.type=5,n}if(xn(s))return vn(s);if(Cn(s))return se(s);const e=se("http://foo.com/"+s);return e.scheme="",e.host="",e.type=s?s.startsWith("?")?3:s.startsWith("#")?2:4:1,e}f(Ye,"parseUrl");function _n(s){if(s.endsWith("/.."))return s;const e=s.lastIndexOf("/");return s.slice(0,e+1)}f(_n,"stripPathFilename");function En(s,e){Qe(e,e.type),s.path==="/"?s.path=e.path:s.path=_n(e.path)+s.path}f(En,"mergePaths");function Qe(s,e){const n=e<=4,i=s.path.split("/");let o=1,c=0,u=!1;for(let g=1;g<i.length;g++){const b=i[g];if(!b){u=!0;continue}if(u=!1,b!=="."){if(b===".."){c?(u=!0,c--,o--):n&&(i[o++]=b);continue}i[o++]=b,c++}}let p="";for(let g=1;g<o;g++)p+="/"+i[g];(!p||u&&!p.endsWith("/.."))&&(p+="/"),s.path=p}f(Qe,"normalizePath");function Ln(s,e){if(!s&&!e)return"";const n=Ye(s);let i=n.type;if(e&&i!==7){const c=Ye(e),u=c.type;switch(i){case 1:n.hash=c.hash;case 2:n.query=c.query;case 3:case 4:En(n,c);case 5:n.user=c.user,n.host=c.host,n.port=c.port;case 6:n.scheme=c.scheme}u>i&&(i=u)}Qe(n,i);const o=n.query+n.hash;switch(i){case 2:case 3:return o;case 4:{const c=n.path.slice(1);return c?Xe(e||s)&&!Xe(c)?"./"+c+o:c+o:o||"."}case 5:return n.path+o;default:return n.scheme+"//"+n.user+n.host+n.port+n.path+o}}f(Ln,"resolve$1");function Ze(s,e){return e&&!e.endsWith("/")&&(e+="/"),Ln(s,e)}f(Ze,"resolve");function On(s){if(!s)return"";const e=s.lastIndexOf("/");return s.slice(0,e+1)}f(On,"stripFilename");const F=0;function Rn(s,e){const n=Ve(s,0);if(n===s.length)return s;e||(s=s.slice());for(let i=n;i<s.length;i=Ve(s,i+1))s[i]=Nn(s[i],e);return s}f(Rn,"maybeSort");function Ve(s,e){for(let n=e;n<s.length;n++)if(!An(s[n]))return n;return s.length}f(Ve,"nextUnsortedSegmentLine");function An(s){for(let e=1;e<s.length;e++)if(s[e][F]<s[e-1][F])return!1;return!0}f(An,"isSorted");functiLine truncated
Did you specify these with the most recent transformation maps first?`);let o=ht(i,e,"",0);for(let c=n.length-1;c>=0;c--)o=ut(n[c],[o]);return o}f(or,"buildSourceMapTree");function ht(s,e,n,i){const{resolvedSources:o,sourcesContent:c,ignoreList:u}=s,p=i+1,g=o.map((b,d)=>{const r={importer:n,depth:p,source:b||"",content:void 0,ignore:void 0},R=e(r.source,r),{source:L,content:E,ignore:N}=r;if(R)return ht(new et(R,L),e,L,p);const $=E!==void 0?E:c?c[d]:null,W=N!==void 0?N:u?u.includes(d):!1;return rr(L,$,W)});return ut(s,g)}f(ht,"build");class ar{static{f(this,"SourceMap")}constructor(e,n){const i=n.decodedMappings?it(e):Kn(e);this.version=i.version,this.file=i.file,this.mappings=i.mappings,this.names=i.names,this.ignoreList=i.ignoreList,this.sourceRoot=i.sourceRoot,this.sources=i.sources,n.excludeContent||(this.sourcesContent=i.sourcesContent)}toString(){return JSON.stringify(this)}}function ft(s,e,n){const i={excludeContent:!!n,decodedMappings:!1},o=or(s,e);return new ar(ir(o),i)}f(ft,"remapping");const cr=f((s,e,n)=>{const i=[],o={code:e};for(const c of n){const u=c(s,o.code);u&&(Object.assign(o,u),i.unshift(u.map))}return{...o,map:ft(i,()=>null)}},"applyTransformersSync"),ur=f(async(s,e,n)=>{const i=[],o={code:e};for(const c of n){const u=await c(s,o.code);u&&(Object.assign(o,u),i.unshift(u.map))}return{...o,map:ft(i,()=>null)}},"applyTransformers"),lr=Object.freeze({target:`node${process.versions.node}`,loader:"default"}),hr=/^--inspect(?:-brk|-port|-publish-uid|-wait)?(?:=|$)/,fr=process.execArgv.some(s=>hr.test(s)),dt={...lr,sourcemap:!0,sourcesContent:!!process.env.NODE_V8_COVERAGE||fr,minifyWhitespace:!0,keepNames:!0},gt=f(s=>{const e=s.sourcefile;if(e){const n=X.extname(e.split("?")[0]);n?n===".cts"||n===".mts"?s.sourcefile=`${e.slice(0,-3)}ts`:n===".mjs"&&(s.sourcefile=`${e.slice(0,-3)}js`):s.sourcefile+=".js"}return n=>(n.map&&(s.sourcefile!==e&&(n.map=n.map.replace(JSON.stringify(s.sourcefile),JSON.stringify(e))),n.map=JSON.parse(n.map)),n)},"patchOptions"),bt=f(s=>{throw s.name="TransformError",delete s.errors,delete s.warnings,s},"formatEsbuildError"),dr=f((s,e,n)=>{const i={};let o,c,u;if(e.startsWith("file://")){o=e;const d=new URL(e);c=Jt(d)}else[c,u]=e.split("?"),o=Gt(c)+(u?`?${u}`:"");c.endsWith(".cjs")||c.endsWith(".cts")||(i["import.meta.url"]=JSON.stringify(o));const p={...dt,format:"cjs",sourcefile:c,define:i,banner:`__filename=${JSON.stringify(c)};(()=>{`,footer:"})()",platform:"node",...n},g=Ne([s,JSON.stringify(p),Ae,Je].join("-"));let b=ie.get(g);return b||(b=cr(e,s,[(d,r)=>{const R=gt(p);let L;try{L=qt(r,p)}catch(E){throw bt(E)}return R(L)},(d,r)=>xe(d,r,!0)]),ie.set(g,b)),b},"transformSync"),gr=f(async(s,e,n)=>{const i={...dt,format:"esm",sourcefile:e,...n},o=Ne([s,JSON.stringify(i),Ae,Je].join("-"));let c=ie.get(o);return c||(c=await ur(e,s,[async(u,p)=>{const g=gt(i);let b;try{b=await zt(p,i)}catch(d){throw bt(d)}return g(b)},(u,p)=>xe(u,p,!0)]),ie.set(o,c)),c},"transform");export{dr as a,xe as b,gn as i,Ge as r,gr as t};
@@ -0,0 +1 @@
{"version":3,"file":"clipboard-x.js","sources":["../../../src/icons/clipboard-x.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ClipboardX\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cmVjdCB3aWR0aD0iOCIgaGVpZ2h0PSI0IiB4PSI4IiB5PSIyIiByeD0iMSIgcnk9IjEiIC8+CiAgPHBhdGggZD0iTTE2IDRoMmEyIDIgMCAwIDEgMiAydjE0YTIgMiAwIDAgMS0yIDJINmEyIDIgMCAwIDEtMi0yVjZhMiAyIDAgMCAxIDItMmgyIiAvPgogIDxwYXRoIGQ9Im0xNSAxMS02IDYiIC8+CiAgPHBhdGggZD0ibTkgMTEgNiA2IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/clipboard-x\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ClipboardX = createLucideIcon('ClipboardX', [\n ['rect', { width: '8', height: '4', x: '8', y: '2', rx: '1', ry: '1', key: 'tgr4d6' }],\n [\n 'path',\n {\n d: 'M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2',\n key: '116196',\n },\n ],\n ['path', { d: 'm15 11-6 6', key: '1toa9n' }],\n ['path', { d: 'm9 11 6 6', key: 'wlibny' }],\n]);\n\nexport default ClipboardX;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAAA,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,KAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAQ,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,EAAG,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,KAAK,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAA,EAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAU,CAAA,CAAA;AAAA,CACrF,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC5C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,11 @@
export type Options = [
{
checkLiteralConstAssertions?: boolean;
typesToIgnore?: string[];
}
];
export type MessageIds = 'contextuallyUnnecessary' | 'unnecessaryAssertion';
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1 @@
{"version":3,"file":"shield-check.js","sources":["../../../src/icons/shield-check.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ShieldCheck\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjAgMTNjMCA1LTMuNSA3LjUtNy42NiA4Ljk1YTEgMSAwIDAgMS0uNjctLjAxQzcuNSAyMC41IDQgMTggNCAxM1Y2YTEgMSAwIDAgMSAxLTFjMiAwIDQuNS0xLjIgNi4yNC0yLjcyYTEuMTcgMS4xNyAwIDAgMSAxLjUyIDBDMTQuNTEgMy44MSAxNyA1IDE5IDVhMSAxIDAgMCAxIDEgMXoiIC8+CiAgPHBhdGggZD0ibTkgMTIgMiAyIDQtNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/shield-check\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ShieldCheck = createLucideIcon('ShieldCheck', [\n [\n 'path',\n {\n d: 'M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z',\n key: 'oel41y',\n },\n ],\n ['path', { d: 'm9 12 2 2 4-4', key: 'dzmm74' }],\n]);\n\nexport default ShieldCheck;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAClD,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,98 @@
import { IncomingHttpHeaders } from './header'
import Dispatcher from './dispatcher'
import { BodyInit, Headers } from './fetch'
/** The scope associated with a mock dispatch. */
declare class MockScope<TData extends object = object> {
constructor (mockDispatch: MockInterceptor.MockDispatch<TData>)
/** Delay a reply by a set amount of time in ms. */
delay (waitInMs: number): MockScope<TData>
/** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */
persist (): MockScope<TData>
/** Define a reply for a set amount of matching requests. */
times (repeatTimes: number): MockScope<TData>
}
/** The interceptor for a Mock. */
declare class MockInterceptor {
constructor (options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[])
/** Mock an undici request with the defined reply. */
reply<TData extends object = object>(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback<TData>): MockScope<TData>
reply<TData extends object = object>(
statusCode: number,
data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler<TData>,
responseOptions?: MockInterceptor.MockResponseOptions
): MockScope<TData>
/** Mock an undici request by throwing the defined reply error. */
replyWithError<TError extends Error = Error>(error: TError): MockScope
/** Set default reply headers on the interceptor for subsequent mocked replies. */
defaultReplyHeaders (headers: IncomingHttpHeaders): MockInterceptor
/** Set default reply trailers on the interceptor for subsequent mocked replies. */
defaultReplyTrailers (trailers: Record<string, string>): MockInterceptor
/** Set automatically calculated content-length header on subsequent mocked replies. */
replyContentLength (): MockInterceptor
}
declare namespace MockInterceptor {
/** MockInterceptor options. */
export interface Options {
/** Path to intercept on. */
path: string | RegExp | ((path: string) => boolean);
/** Method to intercept on. Defaults to GET. */
method?: string | RegExp | ((method: string) => boolean);
/** Body to intercept on. */
body?: string | RegExp | ((body: string) => boolean);
/** Headers to intercept on. */
headers?: Record<string, string | RegExp | ((body: string) => boolean)> | ((headers: Record<string, string>) => boolean);
/** Query params to intercept on */
query?: Record<string, any>;
}
export interface MockDispatch<TData extends object = object, TError extends Error = Error> extends Options {
times: number | null;
persist: boolean;
consumed: boolean;
data: MockDispatchData<TData, TError>;
}
export interface MockDispatchData<TData extends object = object, TError extends Error = Error> extends MockResponseOptions {
error: TError | null;
statusCode?: number;
data?: TData | string;
}
export interface MockResponseOptions {
headers?: IncomingHttpHeaders;
trailers?: Record<string, string>;
}
export interface MockResponseCallbackOptions {
path: string;
method: string;
headers?: Headers | Record<string, string>;
origin?: string;
body?: BodyInit | Dispatcher.DispatchOptions['body'] | null;
}
export type MockResponseDataHandler<TData extends object = object> = (
opts: MockResponseCallbackOptions
) => TData | Buffer | string
export type MockReplyOptions<TData extends object = object> = {
statusCode: number, data?: TData | Buffer | string, responseOptions?: MockResponseOptions
}
export type MockReplyOptionsCallback<TData extends object = object> = (
opts: MockResponseCallbackOptions
) => MockReplyOptions<TData> | Promise<MockReplyOptions<TData>>
}
interface Interceptable extends Dispatcher {
/** Intercepts any matching requests that use the same origin as this mock client. */
intercept(options: MockInterceptor.Options): MockInterceptor;
/** Clean up all the prepared mocks. */
cleanMocks (): void
}
export {
Interceptable,
MockInterceptor,
MockScope
}
@@ -0,0 +1,24 @@
"use strict";
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
Object.defineProperty(exports, "__esModule", { value: true });
exports.es2019 = void 0;
const es2018_1 = require("./es2018");
const es2019_array_1 = require("./es2019.array");
const es2019_intl_1 = require("./es2019.intl");
const es2019_object_1 = require("./es2019.object");
const es2019_string_1 = require("./es2019.string");
const es2019_symbol_1 = require("./es2019.symbol");
exports.es2019 = {
libs: [
es2018_1.es2018,
es2019_array_1.es2019_array,
es2019_object_1.es2019_object,
es2019_string_1.es2019_string,
es2019_symbol_1.es2019_symbol,
es2019_intl_1.es2019_intl,
],
variables: [],
};
@@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/v4/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,EAAE,CAAC;AACV,QAAA,MAAM,GAAG,CAAC,CAAC;AAExB,wEAAwE;AACxE,6EAA6E;AAC7E,wEAAwE;AACxE,mEAAmE;AACtD,QAAA,UAAU,GACrB,+LAA+L,CAAC;AAErL,QAAA,gBAAgB,GAAG,YAAY,CAAC;AAE7C;;;;;;;;;;GAUG;AACU,QAAA,eAAe,GAA6D;IACvF,CAAC,WAAW,EAAE,cAAc,EAAE,KAAK,CAAC;IACpC,CAAC,YAAY,EAAE,2BAA2B,EAAE,KAAK,CAAC;IAClD,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,CAAC;IACpC,CAAC,eAAe,EAAE,sBAAsB,EAAE,KAAK,CAAC;IAChD,CAAC,aAAa,EAAE,UAAU,EAAE,KAAK,CAAC;IAClC,CAAC,gBAAgB,EAAE,YAAY,EAAE,KAAK,CAAC;IACvC,CAAC,eAAe,EAAE,aAAa,EAAE,KAAK,CAAC;IACvC,CAAC,cAAc,EAAE,2BAA2B,EAAE,KAAK,CAAC;IACpD,CAAC,cAAc,EAAE,gCAAgC,EAAE,KAAK,CAAC;IACzD,CAAC,cAAc,EAAE,oBAAoB,EAAE,KAAK,CAAC;IAC7C,CAAC,cAAc,EAAE,+BAA+B,EAAE,IAAI,CAAC;IACvD,CAAC,eAAe,EAAE,2CAA2C,EAAE,IAAI,CAAC;IACpE,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,KAAK,CAAC;IAClD,CAAC,gBAAgB,EAAE,uBAAuB,EAAE,KAAK,CAAC;IAClD,CAAC,cAAc,EAAE,4BAA4B,EAAE,KAAK,CAAC;IACrD,CAAC,iBAAiB,EAAE,UAAU,EAAE,IAAI,CAAC;IACrC,CAAC,iBAAiB,EAAE,KAAK,EAAE,IAAI,CAAC;IAChC,CAAC,gBAAgB,EAAE,iCAAiC,EAAE,IAAI,CAAC;IAC3D,CAAC,gBAAgB,EAAE,4BAA4B,EAAE,KAAK,CAAC;IACvD,CAAC,gBAAgB,EAAE,aAAa,EAAE,KAAK,CAAC;IACxC,CAAC,iBAAiB,EAAE,iCAAiC,EAAE,IAAI,CAAC;IAC5D,CAAC,eAAe,EAAE,cAAc,EAAE,KAAK,CAAC;IACxC,CAAC,iBAAiB,EAAE,4BAA4B,EAAE,KAAK,CAAC;IACxD,CAAC,gBAAgB,EAAE,4BAA4B,EAAE,KAAK,CAAC;IACvD,CAAC,aAAa,EAAE,UAAU,EAAE,KAAK,CAAC;IAClC,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,KAAK,CAAC;CACnD,CAAC","sourcesContent":["export const BITS = 32;\nexport const GROUPS = 4;\n\n// Each octet is 0-255 written without a leading zero. A leading zero is\n// octal to the WHATWG URL parser, inet_aton, and getaddrinfo, but decimal to\n// parseInt(part, 10), so accepting the notation would make this library\n// disagree with the network stack about which host a string names.\nexport const RE_ADDRESS =\n /^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/g;\n\nexport const RE_SUBNET_STRING = /\\/\\d{1,2}$/;\n\n/**\n * The IANA IPv4 Special-Purpose Address Registry\n * (https://www.iana.org/assignments/iana-ipv4-special-registry/), one entry\n * per block: `[cidr, name, globallyReachable]`. A `null` reachability means\n * the registry leaves the column blank and the block inherits the answer of\n * the block containing it (or is global when nothing contains it).\n *\n * `Address4.isGlobal()` answers from the most specific entry containing the\n * address. `test/data/iana-corpus.json` is generated from the registry's CSV\n * and pins this table to it.\n */\nexport const SPECIAL_PURPOSE: ReadonlyArray<readonly [string, string, boolean | null]> = [\n ['0.0.0.0/8', 'This network', false],\n ['0.0.0.0/32', 'This host on this network', false],\n ['10.0.0.0/8', 'Private-Use', false],\n ['100.64.0.0/10', 'Shared Address Space', false],\n ['127.0.0.0/8', 'Loopback', false],\n ['169.254.0.0/16', 'Link Local', false],\n ['172.16.0.0/12', 'Private-Use', false],\n ['192.0.0.0/24', 'IETF Protocol Assignments', false],\n ['192.0.0.0/29', 'IPv4 Service Continuity Prefix', false],\n ['192.0.0.8/32', 'IPv4 dummy address', false],\n ['192.0.0.9/32', 'Port Control Protocol Anycast', true],\n ['192.0.0.10/32', 'Traversal Using Relays around NAT Anycast', true],\n ['192.0.0.170/32', 'NAT64/DNS64 Discovery', false],\n ['192.0.0.171/32', 'NAT64/DNS64 Discovery', false],\n ['192.0.2.0/24', 'Documentation (TEST-NET-1)', false],\n ['192.31.196.0/24', 'AS112-v4', true],\n ['192.52.193.0/24', 'AMT', true],\n ['192.88.99.0/24', 'Deprecated (6to4 Relay Anycast)', null],\n ['192.88.99.2/32', '6a44-relay anycast address', false],\n ['192.168.0.0/16', 'Private-Use', false],\n ['192.175.48.0/24', 'Direct Delegation AS112 Service', true],\n ['198.18.0.0/15', 'Benchmarking', false],\n ['198.51.100.0/24', 'Documentation (TEST-NET-2)', false],\n ['203.0.113.0/24', 'Documentation (TEST-NET-3)', false],\n ['240.0.0.0/4', 'Reserved', false],\n ['255.255.255.255/32', 'Limited Broadcast', false],\n];\n"]}
@@ -0,0 +1,24 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const FolderKanban = createLucideIcon("FolderKanban", [
[
"path",
{
d: "M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",
key: "1fr9dc"
}
],
["path", { d: "M8 10v4", key: "tgpxqk" }],
["path", { d: "M12 10v2", key: "hh53o1" }],
["path", { d: "M16 10v6", key: "1d6xys" }]
]);
export { FolderKanban as default };
//# sourceMappingURL=folder-kanban.js.map
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2017_string: LibDefinition;
@@ -0,0 +1,74 @@
var test = require('tape');
var stringify = require('../');
test('replace root', function (t) {
t.plan(1);
var obj = { a: 1, b: 2, c: false };
var replacer = function(key, value) { return 'one'; };
t.equal(stringify(obj, { replacer: replacer }), '"one"');
});
test('replace numbers', function (t) {
t.plan(1);
var obj = { a: 1, b: 2, c: false };
var replacer = function(key, value) {
if(value === 1) return 'one';
if(value === 2) return 'two';
return value;
};
t.equal(stringify(obj, { replacer: replacer }), '{"a":"one","b":"two","c":false}');
});
test('replace with object', function (t) {
t.plan(1);
var obj = { a: 1, b: 2, c: false };
var replacer = function(key, value) {
if(key === 'b') return { d: 1 };
if(value === 1) return 'one';
return value;
};
t.equal(stringify(obj, { replacer: replacer }), '{"a":"one","b":{"d":"one"},"c":false}');
});
test('replace with undefined', function (t) {
t.plan(1);
var obj = { a: 1, b: 2, c: false };
var replacer = function(key, value) {
if(value === false) return;
return value;
};
t.equal(stringify(obj, { replacer: replacer }), '{"a":1,"b":2}');
});
test('replace with array', function (t) {
t.plan(1);
var obj = { a: 1, b: 2, c: false };
var replacer = function(key, value) {
if(key === 'b') return ['one', 'two'];
return value;
};
t.equal(stringify(obj, { replacer: replacer }), '{"a":1,"b":["one","two"],"c":false}');
});
test('replace array item', function (t) {
t.plan(1);
var obj = { a: 1, b: 2, c: [1,2] };
var replacer = function(key, value) {
if(value === 1) return 'one';
if(value === 2) return 'two';
return value;
};
t.equal(stringify(obj, { replacer: replacer }), '{"a":"one","b":"two","c":["one","two"]}');
});
@@ -0,0 +1,19 @@
import { StructuralSharingOption, ValidateSelected } from './structuralSharing.cjs';
import { AnyRouter, RegisteredRouter, ResolveUseLoaderData, StrictOrFrom, UseLoaderDataResult } from '@tanstack/router-core';
export interface UseLoaderDataBaseOptions<TRouter extends AnyRouter, TFrom, TStrict extends boolean, TSelected, TStructuralSharing> {
select?: (match: ResolveUseLoaderData<TRouter, TFrom, TStrict>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
}
export type UseLoaderDataOptions<TRouter extends AnyRouter, TFrom extends string | undefined, TStrict extends boolean, TSelected, TStructuralSharing> = StrictOrFrom<TRouter, TFrom, TStrict> & UseLoaderDataBaseOptions<TRouter, TFrom, TStrict, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>;
export type UseLoaderDataRoute<out TId> = <TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseLoaderDataBaseOptions<TRouter, TId, true, TSelected, TStructuralSharing> & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>) => UseLoaderDataResult<TRouter, TId, true, TSelected>;
/**
* Read and select the current route's loader data with type‑safety.
*
* Options:
* - `from`/`strict`: Choose which route's data to read and strictness
* - `select`: Map the loader data to a derived value
* - `structuralSharing`: Enable structural sharing for stable references
*
* @returns The loader data (or selected value) for the matched route.
* @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook
*/
export declare function useLoaderData<TRouter extends AnyRouter = RegisteredRouter, const TFrom extends string | undefined = undefined, TStrict extends boolean = true, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts: UseLoaderDataOptions<TRouter, TFrom, TStrict, TSelected, TStructuralSharing>): UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>;
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const AlignVerticalDistributeEnd = createLucideIcon("AlignVerticalDistributeEnd", [
["rect", { width: "14", height: "6", x: "5", y: "14", rx: "2", key: "jmoj9s" }],
["rect", { width: "10", height: "6", x: "7", y: "4", rx: "2", key: "aza5on" }],
["path", { d: "M2 20h20", key: "owomy5" }],
["path", { d: "M2 10h20", key: "1ir3d8" }]
]);
export { AlignVerticalDistributeEnd as default };
//# sourceMappingURL=align-vertical-distribute-end.js.map
@@ -0,0 +1,46 @@
const DT_SEPARATOR = /t|\s/i
const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/
const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i
const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
export default function validTimestamp(str: string, allowDate: boolean): boolean {
// http://tools.ietf.org/html/rfc3339#section-5.6
const dt: string[] = str.split(DT_SEPARATOR)
return (
(dt.length === 2 && validDate(dt[0]) && validTime(dt[1])) ||
(allowDate && dt.length === 1 && validDate(dt[0]))
)
}
function validDate(str: string): boolean {
const matches: string[] | null = DATE.exec(str)
if (!matches) return false
const y: number = +matches[1]
const m: number = +matches[2]
const d: number = +matches[3]
return (
m >= 1 &&
m <= 12 &&
d >= 1 &&
(d <= DAYS[m] ||
// leap year: https://tools.ietf.org/html/rfc3339#appendix-C
(m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0)))
)
}
function validTime(str: string): boolean {
const matches: string[] | null = TIME.exec(str)
if (!matches) return false
const hr: number = +matches[1]
const min: number = +matches[2]
const sec: number = +matches[3]
const tzH: number = +(matches[4] || 0)
const tzM: number = +(matches[5] || 0)
return (
(hr <= 23 && min <= 59 && sec <= 59) ||
// leap second
(hr - tzH === 23 && min - tzM === 59 && sec === 60)
)
}
validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default'
@@ -0,0 +1 @@
{"version":3,"file":"plus-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _objectWithoutProperties;
var _objectWithoutPropertiesLoose = require("./objectWithoutPropertiesLoose.js");
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = (0, _objectWithoutPropertiesLoose.default)(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) !== -1) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
//# sourceMappingURL=objectWithoutProperties.js.map
@@ -0,0 +1 @@
{"version":3,"file":"webhook-off.js","sources":["../../../src/icons/webhook-off.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name WebhookOff\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTcgMTdoLTVjLTEuMDktLjAyLTEuOTQuOTItMi41IDEuOUEzIDMgMCAxIDEgMi41NyAxNSIgLz4KICA8cGF0aCBkPSJNOSAzLjRhNCA0IDAgMCAxIDYuNTIuNjYiIC8+CiAgPHBhdGggZD0ibTYgMTcgMy4xLTUuOGEyLjUgMi41IDAgMCAwIC4wNTctMi4wNSIgLz4KICA8cGF0aCBkPSJNMjAuMyAyMC4zYTQgNCAwIDAgMS0yLjMuNyIgLz4KICA8cGF0aCBkPSJNMTguNiAxM2E0IDQgMCAwIDEgMy4zNTcgMy40MTQiIC8+CiAgPHBhdGggZD0ibTEyIDYgLjYgMSIgLz4KICA8cGF0aCBkPSJtMiAyIDIwIDIwIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/webhook-off\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst WebhookOff = createLucideIcon('WebhookOff', [\n ['path', { d: 'M17 17h-5c-1.09-.02-1.94.92-2.5 1.9A3 3 0 1 1 2.57 15', key: '1tvl6x' }],\n ['path', { d: 'M9 3.4a4 4 0 0 1 6.52.66', key: 'q04jfq' }],\n ['path', { d: 'm6 17 3.1-5.8a2.5 2.5 0 0 0 .057-2.05', key: 'azowf0' }],\n ['path', { d: 'M20.3 20.3a4 4 0 0 1-2.3.7', key: '5joiws' }],\n ['path', { d: 'M18.6 13a4 4 0 0 1 3.357 3.414', key: 'cangb8' }],\n ['path', { d: 'm12 6 .6 1', key: 'tpjl1n' }],\n ['path', { d: 'm2 2 20 20', key: '1ooewy' }],\n]);\n\nexport default WebhookOff;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAAA,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAyD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACtF,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAyC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACtE,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA8B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAkC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC/D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,19 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Codepen = createLucideIcon("Codepen", [
["polygon", { points: "12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2", key: "srzb37" }],
["line", { x1: "12", x2: "12", y1: "22", y2: "15.5", key: "1t73f2" }],
["polyline", { points: "22 8.5 12 15.5 2 8.5", key: "ajlxae" }],
["polyline", { points: "2 15.5 12 8.5 22 15.5", key: "susrui" }],
["line", { x1: "12", x2: "12", y1: "2", y2: "8.5", key: "2cldga" }]
]);
export { Codepen as default };
//# sourceMappingURL=codepen.js.map
@@ -0,0 +1,12 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"id-length": 0,
"max-lines-per-function": 0,
"multiline-comment-style": 1,
"new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }],
},
}
@@ -0,0 +1,3 @@
# `react-use-controllable-state`
This is an internal utility, not intended for public usage.
@@ -0,0 +1,5 @@
import { RouterManagedTag } from '@tanstack/router-core';
import * as React from 'react';
export declare function Asset(asset: RouterManagedTag & {
nonce?: string;
}): React.ReactElement | null;
@@ -0,0 +1,31 @@
{
"name": "@babel/helper-validator-identifier",
"version": "7.29.7",
"description": "Validate identifier/keywords name",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-validator-identifier"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "./lib/index.js",
"exports": {
".": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"./package.json": "./package.json"
},
"devDependencies": {
"@unicode/unicode-17.0.0": "^1.6.10",
"charcodes": "^0.2.0"
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
}
@@ -0,0 +1 @@
{"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/tasks/stores/in-memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAc,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAW7G;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAkB,YAAW,SAAS;IAC/C,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,aAAa,CAAoD;IAEzE;;;OAGG;IACH,OAAO,CAAC,cAAc;IAItB;;OAEG;IACH,OAAO,CAAC,MAAM;IAQR,UAAU,CAAC,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA2CpH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAKjE,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiClH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAalE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCnH,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IA2BrG;;OAEG;IACH,OAAO,IAAI,IAAI;IAQf;;OAEG;IACH,WAAW,IAAI,IAAI,EAAE;CAGxB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,wBAAyB,YAAW,gBAAgB;IAC7D,OAAO,CAAC,MAAM,CAAsC;IAEpD;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAUhB;;;;;;;;OAQG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW1G;;;;;OAKG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAKrF;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAMjF"}
@@ -0,0 +1 @@
{"version":3,"file":"cloud-lightning.js","sources":["../../../src/icons/cloud-lightning.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CloudLightning\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNiAxNi4zMjZBNyA3IDAgMSAxIDE1LjcxIDhoMS43OWE0LjUgNC41IDAgMCAxIC41IDguOTczIiAvPgogIDxwYXRoIGQ9Im0xMyAxMi0zIDVoNGwtMyA1IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/cloud-lightning\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst CloudLightning = createLucideIcon('CloudLightning', [\n ['path', { d: 'M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973', key: '1cez44' }],\n ['path', { d: 'm13 12-3 5h4l-3 5', key: '1t22er' }],\n]);\n\nexport default CloudLightning;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,iBAAiB,gBAAkB,CAAA,CAAA,CAAA;AAAA,CAAA,CACxD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxF,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAqB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACpD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,23 @@
import { ZodDiscriminatedUnionDef, ZodUnionDef } from "zod/v3";
import { JsonSchema7Type } from "../parseTypes.js";
import { Refs } from "../Refs.js";
export declare const primitiveMappings: {
readonly ZodString: "string";
readonly ZodNumber: "number";
readonly ZodBigInt: "integer";
readonly ZodBoolean: "boolean";
readonly ZodNull: "null";
};
type JsonSchema7Primitive = (typeof primitiveMappings)[keyof typeof primitiveMappings];
export type JsonSchema7UnionType = JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType;
type JsonSchema7PrimitiveUnionType = {
type: JsonSchema7Primitive | JsonSchema7Primitive[];
} | {
type: JsonSchema7Primitive | JsonSchema7Primitive[];
enum: (string | number | bigint | boolean | null)[];
};
type JsonSchema7AnyOfType = {
anyOf: JsonSchema7Type[];
};
export declare function parseUnionDef(def: ZodUnionDef | ZodDiscriminatedUnionDef<any, any>, refs: Refs): JsonSchema7PrimitiveUnionType | JsonSchema7AnyOfType | undefined;
export {};
@@ -0,0 +1,102 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZodRealError = exports.ZodError = void 0;
const core = __importStar(require("../core/index.cjs"));
const index_js_1 = require("../core/index.cjs");
const util = __importStar(require("../core/util.cjs"));
/* Prototypes that already carry the lazy helper methods. Seeded with the
* intrinsics so that `init` on a foreign object — it accepts any object —
* can never install an accessor onto a prototype we do not own. */
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
/* Helper methods live as non-enumerable lazy getters on the shared
* prototype instead of own properties on every instance. On first
* access the getter allocates the per-instance closure and caches it
* as a non-enumerable own property, so detached usage still works and
* the allocation only happens for methods actually touched. */
function _lazyMethod(proto, key, make) {
Object.defineProperty(proto, key, {
configurable: true,
enumerable: false,
get() {
const value = make(this);
Object.defineProperty(this, key, { value, configurable: true, writable: true });
return value;
},
set(value) {
Object.defineProperty(this, key, { value, configurable: true, writable: true });
},
});
}
const initializer = (inst, issues) => {
index_js_1.$ZodError.init(inst, issues);
inst.name = "ZodError";
const proto = Object.getPrototypeOf(inst);
if (_installedErrorProtos.has(proto))
return;
_installedErrorProtos.add(proto);
_lazyMethod(proto, "format", (self) => (mapper) => core.formatError(self, mapper));
_lazyMethod(proto, "flatten", (self) => (mapper) => core.flattenError(self, mapper));
_lazyMethod(proto, "addIssue", (self) => (issue) => {
self.issues.push(issue);
self.message = JSON.stringify(self.issues, util.jsonStringifyReplacer, 2);
});
_lazyMethod(proto, "addIssues", (self) => (issues) => {
self.issues.push(...issues);
self.message = JSON.stringify(self.issues, util.jsonStringifyReplacer, 2);
});
Object.defineProperty(proto, "isEmpty", {
configurable: true,
enumerable: false,
get() {
return this.issues.length === 0;
},
});
};
exports.ZodError = core.$constructor("ZodError", initializer);
exports.ZodRealError = core.$constructor("ZodError", initializer, undefined, {
Parent: Error,
});
// /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */
// export type ErrorMapCtx = core.$ZodErrorMapCtx;
// seal-cjs-exports
(function () {
var keys = Object.getOwnPropertyNames(exports);
for (var i = 0; i < keys.length; i++) {
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
if (!desc || !desc.get || !desc.configurable) continue;
var value;
try {
value = desc.get();
} catch (e) {
continue;
}
// a circular require may not have settled this one yet, so leave it live
if (value === undefined) continue;
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
}
Object.freeze(exports);
})();
@@ -0,0 +1,480 @@
/**
* URI.js
*
* @fileoverview An RFC 3986 compliant, scheme extendable URI parsing/validating/resolving library for JavaScript.
* @author <a href="mailto:gary.court@gmail.com">Gary Court</a>
* @see http://github.com/garycourt/uri-js
*/
/**
* Copyright 2011 Gary Court. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY GARY COURT ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of Gary Court.
*/
import URI_PROTOCOL from "./regexps-uri";
import IRI_PROTOCOL from "./regexps-iri";
import punycode from "punycode";
import { toUpperCase, typeOf, assign } from "./util";
export const SCHEMES = {};
export function pctEncChar(chr) {
const c = chr.charCodeAt(0);
let e;
if (c < 16)
e = "%0" + c.toString(16).toUpperCase();
else if (c < 128)
e = "%" + c.toString(16).toUpperCase();
else if (c < 2048)
e = "%" + ((c >> 6) | 192).toString(16).toUpperCase() + "%" + ((c & 63) | 128).toString(16).toUpperCase();
else
e = "%" + ((c >> 12) | 224).toString(16).toUpperCase() + "%" + (((c >> 6) & 63) | 128).toString(16).toUpperCase() + "%" + ((c & 63) | 128).toString(16).toUpperCase();
return e;
}
export function pctDecChars(str) {
let newStr = "";
let i = 0;
const il = str.length;
while (i < il) {
const c = parseInt(str.substr(i + 1, 2), 16);
if (c < 128) {
newStr += String.fromCharCode(c);
i += 3;
}
else if (c >= 194 && c < 224) {
if ((il - i) >= 6) {
const c2 = parseInt(str.substr(i + 4, 2), 16);
newStr += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
}
else {
newStr += str.substr(i, 6);
}
i += 6;
}
else if (c >= 224) {
if ((il - i) >= 9) {
const c2 = parseInt(str.substr(i + 4, 2), 16);
const c3 = parseInt(str.substr(i + 7, 2), 16);
newStr += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
}
else {
newStr += str.substr(i, 9);
}
i += 9;
}
else {
newStr += str.substr(i, 3);
i += 3;
}
}
return newStr;
}
function _normalizeComponentEncoding(components, protocol) {
function decodeUnreserved(str) {
const decStr = pctDecChars(str);
return (!decStr.match(protocol.UNRESERVED) ? str : decStr);
}
if (components.scheme)
components.scheme = String(components.scheme).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_SCHEME, "");
if (components.userinfo !== undefined)
components.userinfo = String(components.userinfo).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_USERINFO, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.host !== undefined)
components.host = String(components.host).replace(protocol.PCT_ENCODED, decodeUnreserved).toLowerCase().replace(protocol.NOT_HOST, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.path !== undefined)
components.path = String(components.path).replace(protocol.PCT_ENCODED, decodeUnreserved).replace((components.scheme ? protocol.NOT_PATH : protocol.NOT_PATH_NOSCHEME), pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.query !== undefined)
components.query = String(components.query).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_QUERY, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
if (components.fragment !== undefined)
components.fragment = String(components.fragment).replace(protocol.PCT_ENCODED, decodeUnreserved).replace(protocol.NOT_FRAGMENT, pctEncChar).replace(protocol.PCT_ENCODED, toUpperCase);
return components;
}
;
function _stripLeadingZeros(str) {
return str.replace(/^0*(.*)/, "$1") || "0";
}
function _normalizeIPv4(host, protocol) {
const matches = host.match(protocol.IPV4ADDRESS) || [];
const [, address] = matches;
if (address) {
return address.split(".").map(_stripLeadingZeros).join(".");
}
else {
return host;
}
}
function _normalizeIPv6(host, protocol) {
const matches = host.match(protocol.IPV6ADDRESS) || [];
const [, address, zone] = matches;
if (address) {
const [last, first] = address.toLowerCase().split('::').reverse();
const firstFields = first ? first.split(":").map(_stripLeadingZeros) : [];
const lastFields = last.split(":").map(_stripLeadingZeros);
const isLastFieldIPv4Address = protocol.IPV4ADDRESS.test(lastFields[lastFields.length - 1]);
const fieldCount = isLastFieldIPv4Address ? 7 : 8;
const lastFieldsStart = lastFields.length - fieldCount;
const fields = Array(fieldCount);
for (let x = 0; x < fieldCount; ++x) {
fields[x] = firstFields[x] || lastFields[lastFieldsStart + x] || '';
}
if (isLastFieldIPv4Address) {
fields[fieldCount - 1] = _normalizeIPv4(fields[fieldCount - 1], protocol);
}
const allZeroFields = fields.reduce((acc, field, index) => {
if (!field || field === "0") {
const lastLongest = acc[acc.length - 1];
if (lastLongest && lastLongest.index + lastLongest.length === index) {
lastLongest.length++;
}
else {
acc.push({ index, length: 1 });
}
}
return acc;
}, []);
const longestZeroFields = allZeroFields.sort((a, b) => b.length - a.length)[0];
let newHost;
if (longestZeroFields && longestZeroFields.length > 1) {
const newFirst = fields.slice(0, longestZeroFields.index);
const newLast = fields.slice(longestZeroFields.index + longestZeroFields.length);
newHost = newFirst.join(":") + "::" + newLast.join(":");
}
else {
newHost = fields.join(":");
}
if (zone) {
newHost += "%" + zone;
}
return newHost;
}
else {
return host;
}
}
const URI_PARSE = /^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i;
const NO_MATCH_IS_UNDEFINED = ("").match(/(){0}/)[1] === undefined;
export function parse(uriString, options = {}) {
const components = {};
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
if (options.reference === "suffix")
uriString = (options.scheme ? options.scheme + ":" : "") + "//" + uriString;
const matches = uriString.match(URI_PARSE);
if (matches) {
if (NO_MATCH_IS_UNDEFINED) {
//store each component
components.scheme = matches[1];
components.userinfo = matches[3];
components.host = matches[4];
components.port = parseInt(matches[5], 10);
components.path = matches[6] || "";
components.query = matches[7];
components.fragment = matches[8];
//fix port number
if (isNaN(components.port)) {
components.port = matches[5];
}
}
else { //IE FIX for improper RegExp matching
//store each component
components.scheme = matches[1] || undefined;
components.userinfo = (uriString.indexOf("@") !== -1 ? matches[3] : undefined);
components.host = (uriString.indexOf("//") !== -1 ? matches[4] : undefined);
components.port = parseInt(matches[5], 10);
components.path = matches[6] || "";
components.query = (uriString.indexOf("?") !== -1 ? matches[7] : undefined);
components.fragment = (uriString.indexOf("#") !== -1 ? matches[8] : undefined);
//fix port number
if (isNaN(components.port)) {
components.port = (uriString.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/) ? matches[4] : undefined);
}
}
if (components.host) {
//normalize IP hosts
components.host = _normalizeIPv6(_normalizeIPv4(components.host, protocol), protocol);
}
//determine reference type
if (components.scheme === undefined && components.userinfo === undefined && components.host === undefined && components.port === undefined && !components.path && components.query === undefined) {
components.reference = "same-document";
}
else if (components.scheme === undefined) {
components.reference = "relative";
}
else if (components.fragment === undefined) {
components.reference = "absolute";
}
else {
components.reference = "uri";
}
//check for reference errors
if (options.reference && options.reference !== "suffix" && options.reference !== components.reference) {
components.error = components.error || "URI is not a " + options.reference + " reference.";
}
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//check if scheme can't handle IRIs
if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
//if host component is a domain name
if (components.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost))) {
//convert Unicode IDN -> ASCII IDN
try {
components.host = punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase());
}
catch (e) {
components.error = components.error || "Host's domain name can not be converted to ASCII via punycode: " + e;
}
}
//convert IRI -> URI
_normalizeComponentEncoding(components, URI_PROTOCOL);
}
else {
//normalize encodings
_normalizeComponentEncoding(components, protocol);
}
//perform scheme specific parsing
if (schemeHandler && schemeHandler.parse) {
schemeHandler.parse(components, options);
}
}
else {
components.error = components.error || "URI can not be parsed.";
}
return components;
}
;
function _recomposeAuthority(components, options) {
const protocol = (options.iri !== false ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens = [];
if (components.userinfo !== undefined) {
uriTokens.push(components.userinfo);
uriTokens.push("@");
}
if (components.host !== undefined) {
//normalize IP hosts, add brackets and escape zone separator for IPv6
uriTokens.push(_normalizeIPv6(_normalizeIPv4(String(components.host), protocol), protocol).replace(protocol.IPV6ADDRESS, (_, $1, $2) => "[" + $1 + ($2 ? "%25" + $2 : "") + "]"));
}
if (typeof components.port === "number" || typeof components.port === "string") {
uriTokens.push(":");
uriTokens.push(String(components.port));
}
return uriTokens.length ? uriTokens.join("") : undefined;
}
;
const RDS1 = /^\.\.?\//;
const RDS2 = /^\/\.(\/|$)/;
const RDS3 = /^\/\.\.(\/|$)/;
const RDS4 = /^\.\.?$/;
const RDS5 = /^\/?(?:.|\n)*?(?=\/|$)/;
export function removeDotSegments(input) {
const output = [];
while (input.length) {
if (input.match(RDS1)) {
input = input.replace(RDS1, "");
}
else if (input.match(RDS2)) {
input = input.replace(RDS2, "/");
}
else if (input.match(RDS3)) {
input = input.replace(RDS3, "/");
output.pop();
}
else if (input === "." || input === "..") {
input = "";
}
else {
const im = input.match(RDS5);
if (im) {
const s = im[0];
input = input.slice(s.length);
output.push(s);
}
else {
throw new Error("Unexpected dot segment condition");
}
}
}
return output.join("");
}
;
export function serialize(components, options = {}) {
const protocol = (options.iri ? IRI_PROTOCOL : URI_PROTOCOL);
const uriTokens = [];
//find scheme handler
const schemeHandler = SCHEMES[(options.scheme || components.scheme || "").toLowerCase()];
//perform scheme specific serialization
if (schemeHandler && schemeHandler.serialize)
schemeHandler.serialize(components, options);
if (components.host) {
//if host component is an IPv6 address
if (protocol.IPV6ADDRESS.test(components.host)) {
//TODO: normalize IPv6 address as per RFC 5952
}
//if host component is a domain name
else if (options.domainHost || (schemeHandler && schemeHandler.domainHost)) {
//convert IDN via punycode
try {
components.host = (!options.iri ? punycode.toASCII(components.host.replace(protocol.PCT_ENCODED, pctDecChars).toLowerCase()) : punycode.toUnicode(components.host));
}
catch (e) {
components.error = components.error || "Host's domain name can not be converted to " + (!options.iri ? "ASCII" : "Unicode") + " via punycode: " + e;
}
}
}
//normalize encoding
_normalizeComponentEncoding(components, protocol);
if (options.reference !== "suffix" && components.scheme) {
uriTokens.push(components.scheme);
uriTokens.push(":");
}
const authority = _recomposeAuthority(components, options);
if (authority !== undefined) {
if (options.reference !== "suffix") {
uriTokens.push("//");
}
uriTokens.push(authority);
if (components.path && components.path.charAt(0) !== "/") {
uriTokens.push("/");
}
}
if (components.path !== undefined) {
let s = components.path;
if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
s = removeDotSegments(s);
}
if (authority === undefined) {
s = s.replace(/^\/\//, "/%2F"); //don't allow the path to start with "//"
}
uriTokens.push(s);
}
if (components.query !== undefined) {
uriTokens.push("?");
uriTokens.push(components.query);
}
if (components.fragment !== undefined) {
uriTokens.push("#");
uriTokens.push(components.fragment);
}
return uriTokens.join(""); //merge tokens into a string
}
;
export function resolveComponents(base, relative, options = {}, skipNormalization) {
const target = {};
if (!skipNormalization) {
base = parse(serialize(base, options), options); //normalize base components
relative = parse(serialize(relative, options), options); //normalize relative components
}
options = options || {};
if (!options.tolerant && relative.scheme) {
target.scheme = relative.scheme;
//target.authority = relative.authority;
target.userinfo = relative.userinfo;
target.host = relative.host;
target.port = relative.port;
target.path = removeDotSegments(relative.path || "");
target.query = relative.query;
}
else {
if (relative.userinfo !== undefined || relative.host !== undefined || relative.port !== undefined) {
//target.authority = relative.authority;
target.userinfo = relative.userinfo;
target.host = relative.host;
target.port = relative.port;
target.path = removeDotSegments(relative.path || "");
target.query = relative.query;
}
else {
if (!relative.path) {
target.path = base.path;
if (relative.query !== undefined) {
target.query = relative.query;
}
else {
target.query = base.query;
}
}
else {
if (relative.path.charAt(0) === "/") {
target.path = removeDotSegments(relative.path);
}
else {
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
target.path = "/" + relative.path;
}
else if (!base.path) {
target.path = relative.path;
}
else {
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative.path;
}
target.path = removeDotSegments(target.path);
}
target.query = relative.query;
}
//target.authority = base.authority;
target.userinfo = base.userinfo;
target.host = base.host;
target.port = base.port;
}
target.scheme = base.scheme;
}
target.fragment = relative.fragment;
return target;
}
;
export function resolve(baseURI, relativeURI, options) {
const schemelessOptions = assign({ scheme: 'null' }, options);
return serialize(resolveComponents(parse(baseURI, schemelessOptions), parse(relativeURI, schemelessOptions), schemelessOptions, true), schemelessOptions);
}
;
export function normalize(uri, options) {
if (typeof uri === "string") {
uri = serialize(parse(uri, options), options);
}
else if (typeOf(uri) === "object") {
uri = parse(serialize(uri, options), options);
}
return uri;
}
;
export function equal(uriA, uriB, options) {
if (typeof uriA === "string") {
uriA = serialize(parse(uriA, options), options);
}
else if (typeOf(uriA) === "object") {
uriA = serialize(uriA, options);
}
if (typeof uriB === "string") {
uriB = serialize(parse(uriB, options), options);
}
else if (typeOf(uriB) === "object") {
uriB = serialize(uriB, options);
}
return uriA === uriB;
}
;
export function escapeComponent(str, options) {
return str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.ESCAPE : IRI_PROTOCOL.ESCAPE), pctEncChar);
}
;
export function unescapeComponent(str, options) {
return str && str.toString().replace((!options || !options.iri ? URI_PROTOCOL.PCT_ENCODED : IRI_PROTOCOL.PCT_ENCODED), pctDecChars);
}
;
//# sourceMappingURL=uri.js.map
@@ -0,0 +1,6 @@
function isObject(value) {
return value !== null && typeof value === "object";
}
export {
isObject
};
@@ -0,0 +1,39 @@
"use client";
// src/focus-guards.tsx
import * as React from "react";
var count = 0;
function FocusGuards(props) {
useFocusGuards();
return props.children;
}
function useFocusGuards() {
React.useEffect(() => {
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
count++;
return () => {
if (count === 1) {
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
}
count--;
};
}, []);
}
function createFocusGuard() {
const element = document.createElement("span");
element.setAttribute("data-radix-focus-guard", "");
element.tabIndex = 0;
element.style.outline = "none";
element.style.opacity = "0";
element.style.position = "fixed";
element.style.pointerEvents = "none";
return element;
}
export {
FocusGuards,
FocusGuards as Root,
useFocusGuards
};
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
{"version":3,"file":"chevron-down.js","sources":["../../../src/icons/chevron-down.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ChevronDown\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtNiA5IDYgNiA2LTYiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/chevron-down\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst ChevronDown = createLucideIcon('ChevronDown', [\n ['path', { d: 'm6 9 6 6 6-6', key: 'qrunsl' }],\n]);\n\nexport default ChevronDown;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,iBAAiB,aAAe,CAAA,CAAA,CAAA;AAAA,CAAA,CAClD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC/C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"B","2":"_b","132":"_AL"},B:{"1":"_J"},C:{"1":"_zF","2":"_OC"},D:{"1":"_Q"},E:{"1":"_nB","2":"_k"},F:{"1":"_eD","2":"_6C"},G:{"1":"_8S _HU _s","2":"lC","260":"eD"},H:{"1":"1D"},I:{"1":"_P"},J:{"1":"_B"},K:{"1":"_XD","2":"_gB"},L:{"1":"I"},M:{"1":"YC"},N:{"1":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:4,C:"rem (root em) units",D:true};
@@ -0,0 +1 @@
{"version":3,"names":["_semver","data","require","_index","_caching","makeConfigAPI","cache","env","value","using","undefined","envName","assertSimpleType","Array","isArray","some","entry","Error","caller","cb","version","coreVersion","simple","async","assertVersion","makePresetAPI","externalDependencies","targets","JSON","parse","stringify","addExternalDependency","ref","push","Object","assign","makePluginAPI","assumption","name","assumptions","range","Number","isInteger","semver","satisfies","message","limit","stackTraceLimit","err","code"],"sources":["../../../src/config/helpers/config-api.ts"],"sourcesContent":["import semver from \"semver\";\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nimport { version as coreVersion } from \"../../index.ts\";\nimport { assertSimpleType } from \"../caching.ts\";\nimport type {\n CacheConfigurator,\n SimpleCacheConfigurator,\n SimpleType,\n} from \"../caching.ts\";\n\nimport type {\n AssumptionName,\n CallerMetadata,\n InputOptions,\n} from \"../validation/options.ts\";\n\nimport type * as Context from \"../cache-contexts\";\n\ntype EnvName = NonNullable<InputOptions[\"envName\"]>;\ntype EnvFunction = {\n (): string;\n <T extends SimpleType>(extractor: (envName: EnvName) => T): T;\n (envVar: string): boolean;\n (envVars: string[]): boolean;\n};\n\ntype CallerFactory = {\n <T extends SimpleType>(\n extractor: (callerMetadata: CallerMetadata | undefined) => T,\n ): T;\n (\n extractor: (callerMetadata: CallerMetadata | undefined) => unknown,\n ): SimpleType;\n};\ntype TargetsFunction = () => Targets;\ntype AssumptionFunction = (name: AssumptionName) => boolean | undefined;\n\nexport type ConfigAPI = {\n version: string;\n cache: SimpleCacheConfigurator;\n env: EnvFunction;\n async: () => boolean;\n assertVersion: typeof assertVersion;\n caller?: CallerFactory;\n};\n\nexport type PresetAPI = {\n targets: TargetsFunction;\n addExternalDependency: (ref: string) => void;\n} & ConfigAPI;\n\nexport type PluginAPI = {\n assumption: AssumptionFunction;\n} & PresetAPI;\n\nexport function makeConfigAPI<SideChannel extends Context.SimpleConfig>(\n cache: CacheConfigurator<SideChannel>,\n): ConfigAPI {\n // TODO(@nicolo-ribaudo): If we remove the explicit type from `value`\n // and the `as any` type cast, TypeScript crashes in an infinite\n // recursion. After upgrading to TS4.7 and finishing the noImplicitAny\n // PR, we should check if it still crashes and report it to the TS team.\n const env: EnvFunction = ((\n value: string | string[] | (<T>(babelEnv: string) => T),\n ) =>\n cache.using(data => {\n if (value === undefined) return data.envName;\n if (typeof value === \"function\") {\n return assertSimpleType(value(data.envName));\n }\n return (Array.isArray(value) ? value : [value]).some(entry => {\n if (typeof entry !== \"string\") {\n throw new Error(\"Unexpected non-string value\");\n }\n return entry === data.envName;\n });\n })) as any;\n\n const caller = (\n cb: (CallerMetadata: CallerMetadata | undefined) => SimpleType,\n ) => cache.using(data => assertSimpleType(cb(data.caller)));\n\n return {\n version: coreVersion,\n cache: cache.simple(),\n // Expose \".env()\" so people can easily get the same env that we expose using the \"env\" key.\n env,\n async: () => false,\n caller,\n assertVersion,\n };\n}\n\nexport function makePresetAPI<SideChannel extends Context.SimplePreset>(\n cache: CacheConfigurator<SideChannel>,\n externalDependencies: string[],\n): PresetAPI {\n const targets = () =>\n // We are using JSON.parse/JSON.stringify because it's only possible to cache\n // primitive values. We can safely stringify the targets object because it\n // only contains strings as its properties.\n // Please make the Record and Tuple proposal happen!\n JSON.parse(cache.using(data => JSON.stringify(data.targets)));\n\n const addExternalDependency = (ref: string) => {\n externalDependencies.push(ref);\n };\n\n return { ...makeConfigAPI(cache), targets, addExternalDependency };\n}\n\nexport function makePluginAPI<SideChannel extends Context.SimplePlugin>(\n cache: CacheConfigurator<SideChannel>,\n externalDependencies: string[],\n): PluginAPI {\n const assumption = (name: string) =>\n cache.using(data => data.assumptions[name]);\n\n return { ...makePresetAPI(cache, externalDependencies), assumption };\n}\n\nfunction assertVersion(range: string | number): void {\n if (typeof range === \"number\") {\n if (!Number.isInteger(range)) {\n throw new Error(\"Expected string or integer value.\");\n }\n range = `^${range}.0.0-0`;\n }\n if (typeof range !== \"string\") {\n throw new Error(\"Expected string or integer value.\");\n }\n\n // We want \"*\" to also allow any pre-release, but we do not pass\n // the includePrerelease option to semver.satisfies because we\n // do not wantLine truncated
@@ -0,0 +1,215 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
*/
/**
* This transform strips Flow types that are not supported past Babel 7.
*
* It is expected that all transforms create valid ESTree AST output. If
* the transform requires outputting Babel specific AST nodes then it
* should live in `ConvertESTreeToBabel.js`
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.transformProgram = transformProgram;
var _SimpleTransform = require("../transform/SimpleTransform");
var _createSyntaxError = require("../utils/createSyntaxError");
const nodeWith = _SimpleTransform.SimpleTransform.nodeWith; // Rely on the mapper to fix up parent relationships.
const EMPTY_PARENT = null;
function createSimpleGenericTypeAnnotation(name, nodeForLoc) {
return {
type: 'GenericTypeAnnotation',
id: {
type: 'Identifier',
name,
optional: false,
typeAnnotation: null,
loc: nodeForLoc.loc,
range: nodeForLoc.range,
parent: EMPTY_PARENT
},
typeParameters: null,
loc: nodeForLoc.loc,
range: nodeForLoc.range,
parent: nodeForLoc.parent
};
}
function createAnyTypeAnnotation(node) {
return {
type: 'AnyTypeAnnotation',
loc: node.loc,
range: node.range,
parent: node.parent
};
}
/**
* Convert DeclareEnum nodes to DeclareVariable
*/
function mapDeclareEnum(node) {
return {
type: 'DeclareVariable',
kind: 'const',
id: nodeWith(node.id, {
typeAnnotation: {
type: 'TypeAnnotation',
typeAnnotation: createAnyTypeAnnotation(node.body),
loc: node.body.loc,
range: node.body.range,
parent: EMPTY_PARENT
}
}),
loc: node.loc,
range: node.range,
parent: node.parent
};
}
/**
* Convert DeclareNamespace nodes to DeclareVariable
*/
function mapDeclareNamespace(node) {
return {
type: 'DeclareVariable',
kind: 'const',
id: nodeWith(node.id, {
typeAnnotation: {
type: 'TypeAnnotation',
typeAnnotation: createAnyTypeAnnotation(node.body),
loc: node.body.loc,
range: node.body.range,
parent: EMPTY_PARENT
}
}),
loc: node.loc,
range: node.range,
parent: node.parent
};
}
/**
* Remove `this` param from functions.
*/
function mapFunction(node) {
// Remove the first parameter if it is a this-type annotation,
// which is not recognized by Babel.
if (node.params.length !== 0 && node.params[0].name === 'this') {
return nodeWith(node, {
params: node.params.slice(1)
});
}
return node;
}
/**
* Convert to QualifiedTypeIdentifier
*/
function mapQualifiedTypeofIdentifier(node) {
return {
type: 'QualifiedTypeIdentifier',
qualification: node.qualification.type === 'QualifiedTypeofIdentifier' ? mapQualifiedTypeofIdentifier(node.qualification) : node.qualification,
id: node.id,
loc: node.loc,
range: node.range,
parent: node.parent
};
}
function transformProgram(program, _options) {
return _SimpleTransform.SimpleTransform.transformProgram(program, {
transform(node) {
switch (node.type) {
case 'SymbolTypeAnnotation':
{
// Convert to simple generic type annotation
return createSimpleGenericTypeAnnotation('symbol', node);
}
case 'BigIntTypeAnnotation':
{
// Convert to simple generic type annotation
return createSimpleGenericTypeAnnotation('bigint', node);
}
case 'ObjectTypeAnnotation':
{
const shouldStrip = node.properties.some(prop => prop.type === 'ObjectTypeMappedTypeProperty');
if (shouldStrip) {
return createAnyTypeAnnotation(node);
}
return node;
}
case 'ObjectTypeMappedTypeProperty':
{
throw (0, _createSyntaxError.createSyntaxError)(node, `Invalid AST structure, ObjectTypeMappedTypeProperty found outside of an ObjectTypeAnnotation`);
}
case 'IndexedAccessType':
case 'OptionalIndexedAccessType':
case 'KeyofTypeAnnotation':
case 'ConditionalTypeAnnotation':
case 'InferTypeAnnotation':
case 'TupleTypeLabeledElement':
case 'TupleTypeSpreadElement':
case 'ComponentTypeAnnotation':
case 'HookTypeAnnotation':
case 'TypeOperator':
case 'TypePredicate':
{
// Babel does not support these generic types, so convert to any
return createAnyTypeAnnotation(node);
}
case 'QualifiedTypeofIdentifier':
{
return mapQualifiedTypeofIdentifier(node);
}
case 'DeclareEnum':
{
return mapDeclareEnum(node);
}
case 'DeclareNamespace':
{
return mapDeclareNamespace(node);
}
case 'FunctionDeclaration':
case 'FunctionExpression':
{
return mapFunction(node);
}
default:
{
return node;
}
}
}
});
}
@@ -0,0 +1,198 @@
import { getCookie, setCookie } from "../../helper/cookie/index.js";
import { parseAccept } from "../../utils/accept.js";
//#region src/middleware/language/language.ts
const DEFAULT_OPTIONS = {
order: [
"querystring",
"cookie",
"header"
],
lookupQueryString: "lang",
lookupCookie: "language",
lookupFromHeaderKey: "accept-language",
lookupFromPathIndex: 0,
caches: ["cookie"],
ignoreCase: true,
fallbackLanguage: "en",
supportedLanguages: ["en"],
cookieOptions: {
sameSite: "Strict",
secure: true,
maxAge: 31536e3,
httpOnly: true
},
debug: false
};
/**
* Parse Accept-Language header values with quality scores
* @param header Accept-Language header string
* @returns Array of parsed languages with quality scores
*/
function parseAcceptLanguage(header) {
return parseAccept(header).map(({ type, q }) => ({
lang: type,
q
}));
}
/**
* Validate and normalize language codes
* @param lang Language code to normalize
* @param options Detector options
* @returns Normalized language code or undefined
*/
const normalizeLanguage = (lang, options) => {
if (!lang) return;
try {
let normalizedLang = lang.trim();
if (options.convertDetectedLanguage) normalizedLang = options.convertDetectedLanguage(normalizedLang);
const compLang = options.ignoreCase ? normalizedLang.toLowerCase() : normalizedLang;
const compSupported = options.supportedLanguages.map((l) => options.ignoreCase ? l.toLowerCase() : l);
const exactIndex = compSupported.indexOf(compLang);
if (exactIndex !== -1) return options.supportedLanguages[exactIndex];
let longestMatchIndex = -1;
let longestMatchLength = -1;
for (let i = 0; i < compSupported.length; i++) {
const candidate = compSupported[i];
if (candidate.length < compLang.length && candidate.length > longestMatchLength && compLang.startsWith(candidate) && compLang[candidate.length] === "-") {
longestMatchIndex = i;
longestMatchLength = candidate.length;
}
}
if (longestMatchIndex !== -1) return options.supportedLanguages[longestMatchIndex];
return;
} catch {
return;
}
};
/**
* Detects language from query parameter
*/
const detectFromQuery = (c, options) => {
const query = c.req.query(options.lookupQueryString);
return normalizeLanguage(query, options);
};
/**
* Detects language from cookie
*/
const detectFromCookie = (c, options) => {
const cookie = getCookie(c, options.lookupCookie);
return normalizeLanguage(cookie, options);
};
/**
* Detects language from Accept-Language header
*/
function detectFromHeader(c, options) {
try {
const acceptLanguage = c.req.header(options.lookupFromHeaderKey);
if (!acceptLanguage) return;
const languages = parseAcceptLanguage(acceptLanguage);
for (const { lang, q } of languages) {
if (q === 0) continue;
const normalizedLang = normalizeLanguage(lang, options);
if (normalizedLang) return normalizedLang;
}
return;
} catch {
return;
}
}
/**
* Detects language from URL path
*/
function detectFromPath(c, options) {
const langSegment = new URL(c.req.url).pathname.split("/").filter(Boolean)[options.lookupFromPathIndex];
return normalizeLanguage(langSegment, options);
}
/**
* Collection of all language detection strategies
*/
const detectors = {
querystring: detectFromQuery,
cookie: detectFromCookie,
header: detectFromHeader,
path: detectFromPath
};
/**
* Validate detector options
* @param options Detector options to validate
* @throws Error if options are invalid
*/
function validateOptions(options) {
if (!options.supportedLanguages.includes(options.fallbackLanguage)) throw new Error("Fallback language must be included in supported languages");
if (options.lookupFromPathIndex < 0) throw new Error("Path index must be non-negative");
if (!options.order.every((detector) => Object.keys(detectors).includes(detector))) throw new Error("Invalid detector type in order array");
}
/**
* Cache detected language
*/
function cacheLanguage(c, language, options) {
if (!Array.isArray(options.caches) || !options.caches.includes("cookie")) return;
try {
setCookie(c, options.lookupCookie, language, options.cookieOptions);
} catch (error) {
if (options.debug) console.error("Failed to cache language:", error);
}
}
/**
* Detect language from request
*/
const detectLanguage = (c, options) => {
let detectedLang;
for (const detectorName of options.order) {
const detector = detectors[detectorName];
try {
detectedLang = detector(c, options);
if (detectedLang) {
if (options.debug) console.log(`Language detected from ${detectorName}: ${detectedLang}`);
break;
}
} catch (error) {
if (options.debug) console.error(`Error in ${detectorName} detector:`, error);
continue;
}
}
const finalLang = detectedLang || options.fallbackLanguage;
if (detectedLang && options.caches) cacheLanguage(c, finalLang, options);
return finalLang;
};
/**
* Language detector middleware factory
* @param userOptions Configuration options for the language detector
* @returns Hono middleware function
*
* @example
* ```ts
* type Variables = LanguageVariables
* const app = new Hono<{ Variables: Variables }>()
*
* app.use(
* languageDetector({
* supportedLanguages: ['en', 'ja'], // Must include fallback
* fallbackLanguage: 'en', // Required
* })
* )
*
* app.get('/', (c) => {
* const lang = c.get('language')
* return c.text(`Current language: ${lang}`)
* })
* ```
*/
const languageDetector = (userOptions) => {
const options = {
...DEFAULT_OPTIONS,
...userOptions,
cookieOptions: {
...DEFAULT_OPTIONS.cookieOptions,
...userOptions.cookieOptions
}
};
validateOptions(options);
return async function languageDetector(ctx, next) {
const lang = detectLanguage(ctx, options);
ctx.set("language", lang);
await next();
};
};
//#endregion
export { DEFAULT_OPTIONS, detectFromCookie, detectFromHeader, detectFromPath, detectFromQuery, detectors, languageDetector, normalizeLanguage, parseAcceptLanguage, validateOptions };
@@ -0,0 +1 @@
module.exports={C:{"7":0.003,"44":0.006,"49":0.003,"91":0.003,"103":0.003,"113":0.02699,"115":0.07198,"120":0.11996,"121":0.24292,"123":0.012,"124":0.006,"125":0.003,"127":0.003,"128":0.003,"129":0.003,"130":0.003,"135":0.003,"136":0.02099,"140":0.02099,"143":0.003,"144":0.003,"145":0.006,"146":0.006,"148":0.003,"150":0.006,"151":0.006,"152":0.015,"153":0.02399,"154":0.20993,"155":0.45285,"156":0.34788,"157":0.009,_:"2 3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 92 93 94 95 96 97 98 99 100 101 102 104 105 106 107 108 109 110 111 112 114 116 117 118 119 122 126 131 132 133 134 137 138 139 141 142 147 149 158 159 160 3.5 3.6"},D:{"11":0.003,"49":0.06298,"52":0.003,"53":0.02099,"56":0.003,"58":0.003,"61":0.006,"64":0.003,"65":0.003,"67":0.003,"70":0.003,"71":0.006,"73":0.009,"74":0.012,"75":0.009,"76":0.003,"79":0.003,"80":0.003,"81":0.003,"83":0.003,"84":0.003,"85":0.003,"86":0.012,"87":0.012,"88":0.009,"91":0.003,"92":0.003,"93":0.003,"95":0.003,"96":0.003,"98":0.015,"101":0.006,"102":0.009,"103":0.02399,"104":0.012,"105":0.01799,"106":0.02399,"107":0.012,"108":0.01799,"109":0.66878,"110":0.01799,"111":0.02999,"112":0.015,"114":0.5968,"115":0.003,"116":0.05698,"117":0.01799,"118":0.3029,"119":0.23992,"120":0.26091,"121":0.006,"122":0.02099,"123":0.015,"124":0.10197,"125":0.003,"126":0.009,"127":0.006,"128":0.03299,"129":0.003,"130":0.012,"131":0.04798,"132":0.006,"133":0.07797,"134":0.05398,"135":0.05698,"136":0.04798,"137":0.05998,"138":0.13795,"139":0.05698,"140":0.05698,"141":0.09597,"142":0.18594,"143":0.02699,"144":0.03299,"145":0.02999,"146":0.05098,"147":0.05398,"148":0.17694,"149":0.09597,"150":0.27591,"151":1.14562,"152":5.95002,"153":4.11163,"154":0.74075,"155":0.009,"156":0.003,_:"4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 54 55 57 59 60 62 63 66 68 69 72 77 78 89 90 94 97 99 100 113 157"},F:{"37":0.006,"44":0.003,"73":0.003,"79":0.003,"89":0.003,"91":0.003,"93":0.003,"95":0.06598,"96":0.003,"97":0.003,"99":0.003,"100":0.009,"101":0.006,"102":0.006,"105":0.003,"106":0.015,"107":0.003,"111":0.003,"112":0.003,"116":0.003,"118":0.003,"121":0.003,"122":0.003,"126":0.009,"131":0.006,"132":0.006,"133":0.012,"134":0.08997,"135":0.50683,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 74 75 76 77 78 80 81 82 83 84 85 86 87 88 90 92 94 98 103 104 108 109 110 113 114 115 117 119 120 123 124 125 127 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1","9.5-9.6":0.003},B:{"16":0.003,"17":0.009,"18":0.03599,"83":0.006,"84":0.006,"89":0.009,"90":0.006,"92":0.07498,"100":0.009,"109":0.01799,"111":0.003,"114":0.003,"115":0.02099,"119":0.11396,"120":0.11696,"122":0.015,"123":0.006,"125":0.003,"130":0.009,"131":0.006,"133":0.003,"134":0.003,"135":0.003,"136":0.006,"137":0.009,"138":0.12596,"139":0.003,"140":0.02699,"141":0.02399,"142":0.015,"143":0.012,"144":0.006,"145":0.02999,"146":0.07198,"147":0.02699,"148":0.01799,"149":0.03599,"150":0.13795,"151":0.28491,"152":1.75442,"153":1.88937,"154":0.32389,_:"12 13 14 15 79 80 81 85 86 87 88 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 108 110 112 113 116 117 118 121 124 126 127 128 129 132"},E:{"27":0.02399,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.2 16.3 16.4 17.0 17.2 17.3 17.5 18.4 27.1 27.2 TP","13.1":0.006,"14.1":0.003,"15.6":0.02099,"16.5":0.003,"16.6":0.04499,"17.1":0.05098,"17.4":0.006,"17.6":0.02099,"18.0":0.003,"18.1":0.006,"18.2":0.003,"18.3":0.003,"18.5-18.7":0.015,"26.0":0.012,"26.1":0.006,"26.2":0.009,"26.3":0.006,"26.4":0.003,"26.5":0.03299,"26.6":0.15295},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.0005,"5.0-5.1":0.0005,"6.0-6.1":0,"7.0-7.1":0.00099,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00497,"11.0-11.2":0.0005,"11.3-11.4":0.00099,"12.0-12.1":0,"12.2-12.5":0.01292,"13.0-13.1":0,"13.2":0.00249,"13.3":0,"13.4-13.7":0.0005,"14.0-14.4":0.00199,"14.5-14.8":0.00298,"15.0-15.1":0.00298,"15.2-15.3":0.00199,"15.4":0.00249,"15.5":0.00298,"15.6-15.8":0.06461,"16.0":0.00497,"16.1":0.00895,"16.2":0.00497,"16.3":0.01093,"16.4":0.00249,"16.5":0.00398,"16.6-16.7":0.08996,"17.0":0.00348,"17.1":0.00497,"17.2":0.00497,"17.3":0.00746,"17.4":0.01044,"17.5":0.02038,"17.6-17.7":0.05268,"18.0":0.01093,"18.1":0.02187,"18.2":0.02982,"18.3":0.05169,"18.4":0.03231,"18.5-18.7":0.66747,"26.0":0.03231,"26.1":0.0328,"26.2":0.08548,"26.3":0.09244,"26.4":0.06759,"26.5":0.45277,"26.6":2.79364,"27.0":0.21421,"27.1":0,"27.2":0.00547},P:{"20":0.01826,"21":0.00913,"22":0.02739,"23":0.01826,"24":0.09128,"25":0.05477,"26":0.05477,"27":0.09128,"28":0.20082,"29":0.22821,"30":1.80742,_:"4 5.0-5.4 6.2-6.4 8.2 9Line truncated
@@ -0,0 +1 @@
{"version":3,"names":["_isValidIdentifier","require","RESERVED_WORDS_ES3_ONLY","Set","isValidES3Identifier","name","isValidIdentifier","has"],"sources":["../../src/validators/isValidES3Identifier.ts"],"sourcesContent":["import isValidIdentifier from \"./isValidIdentifier.ts\";\n\nconst RESERVED_WORDS_ES3_ONLY = new Set<string>([\n \"abstract\",\n \"boolean\",\n \"byte\",\n \"char\",\n \"double\",\n \"enum\",\n \"final\",\n \"float\",\n \"goto\",\n \"implements\",\n \"int\",\n \"interface\",\n \"long\",\n \"native\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"short\",\n \"static\",\n \"synchronized\",\n \"throws\",\n \"transient\",\n \"volatile\",\n]);\n\n/**\n * Check if the input `name` is a valid identifier name according to the ES3 specification.\n *\n * Additional ES3 reserved words are\n */\nexport default function isValidES3Identifier(name: string): boolean {\n return isValidIdentifier(name) && !RESERVED_WORDS_ES3_ONLY.has(name);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAEA,MAAMC,uBAAuB,GAAG,IAAIC,GAAG,CAAS,CAC9C,UAAU,EACV,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,YAAY,EACZ,KAAK,EACL,WAAW,EACX,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,WAAW,EACX,UAAU,CACX,CAAC;AAOa,SAASC,oBAAoBA,CAACC,IAAY,EAAW;EAClE,OAAO,IAAAC,0BAAiB,EAACD,IAAI,CAAC,IAAI,CAACH,uBAAuB,CAACK,GAAG,CAACF,IAAI,CAAC;AACtE","ignoreList":[]}
@@ -0,0 +1,17 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const RotateCwSquare = createLucideIcon("RotateCwSquare", [
["path", { d: "M12 5H6a2 2 0 0 0-2 2v3", key: "l96uqu" }],
["path", { d: "m9 8 3-3-3-3", key: "1gzgc3" }],
["path", { d: "M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2", key: "1w2k5h" }]
]);
export { RotateCwSquare as default };
//# sourceMappingURL=rotate-cw-square.js.map
@@ -0,0 +1 @@
{"version":3,"file":"can-use-native-timeline.mjs","sources":["../../../../../../src/render/dom/scroll/utils/can-use-native-timeline.ts"],"sourcesContent":["import { supportsScrollTimeline, supportsViewTimeline } from \"motion-dom\"\n\nexport function canUseNativeTimeline(target?: Element) {\n if (typeof window === \"undefined\") return false\n return target ? supportsViewTimeline() : supportsScrollTimeline()\n}\n"],"names":[],"mappings":";;AAEM,SAAU,oBAAoB,CAAC,MAAgB,EAAA;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW;AAAE,QAAA,OAAO,KAAK;IAC/C,OAAO,MAAM,GAAG,oBAAoB,EAAE,GAAG,sBAAsB,EAAE;AACrE;;;;"}
@@ -0,0 +1 @@
{"version":3,"names":["_defaults","obj","defaults","keys","Object","getOwnPropertyNames","i","length","key","value","getOwnPropertyDescriptor","configurable","undefined","defineProperty"],"sources":["../../src/helpers/defaults.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _defaults<T extends object, S extends object>(\n obj: T,\n defaults: S,\n): NonNullable<T & S> {\n for (\n var keys: string[] = Object.getOwnPropertyNames(defaults), i = 0;\n i < keys.length;\n i++\n ) {\n var key: string = keys[i],\n value: PropertyDescriptor | undefined = Object.getOwnPropertyDescriptor(\n defaults,\n key,\n );\n if (value && value.configurable && obj[key as keyof T] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }\n return obj as NonNullable<T & S>;\n}\n"],"mappings":";;;;;;AAEe,SAASA,SAASA,CAC/BC,GAAM,EACNC,QAAW,EACS;EACpB,KACE,IAAIC,IAAc,GAAGC,MAAM,CAACC,mBAAmB,CAACH,QAAQ,CAAC,EAAEI,CAAC,GAAG,CAAC,EAChEA,CAAC,GAAGH,IAAI,CAACI,MAAM,EACfD,CAAC,EAAE,EACH;IACA,IAAIE,GAAW,GAAGL,IAAI,CAACG,CAAC,CAAC;MACvBG,KAAqC,GAAGL,MAAM,CAACM,wBAAwB,CACrER,QAAQ,EACRM,GACF,CAAC;IACH,IAAIC,KAAK,IAAIA,KAAK,CAACE,YAAY,IAAIV,GAAG,CAACO,GAAG,CAAY,KAAKI,SAAS,EAAE;MACpER,MAAM,CAACS,cAAc,CAACZ,GAAG,EAAEO,GAAG,EAAEC,KAAK,CAAC;IACxC;EACF;EACA,OAAOR,GAAG;AACZ","ignoreList":[]}
@@ -0,0 +1,840 @@
tlf2a 6 5 8 -1 17 0 0 0
===============================================================================
This is letter.tlf, or “Letter”, Copyright (c) 2008 Francesco Poli
2008-09-21 -- Francesco Poli <frx@firenze.linux.it>
font creation
This font is free software. It comes without any warranty, to the extent
permitted by applicable law. You can redistribute it and/or modify it under
the terms of the Do What The Fuck You Want To Public License, Version 2,
as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
details.
Missing characters: many...
This font is part of TOIlet’s official distribution. More information
on the TOIlet website at http://caca.zoy.org/wiki/toilet
===============================================================================
@
@
@
@
@
@@
! @
! @
! @
@
! @
@@
" " @
" " @
@
@
@
@@
# # @
##### @
# # @
##### @
# # @
@@
$$$ @
$ $ @
$$$ @
$ $ @
$$$ @
@@
%% % @
%% % @
% @
% %% @
% %% @
@@
& @
& & @
&& & @
& & @
&& & @
@@
' @
' @
@
@
@
@@
( @
( @
( @
( @
( @
@@
) @
) @
) @
) @
) @
@@
* @
* * * @
*** @
* * * @
* @
@@
@
+ @
+++ @
+ @
@
@@
@
@
@
@
, @
,, @@
@
@
--- @
@
@
@@
@
@
@
.. @
.. @
@@
/ @
/ @
/ @
/ @
/ @
@@
000 @
0 0 @
0 0 0 @
0 0 @
000 @
@@
1 @
11 @
1 @
1 @
111 @
@@
222 @
2 2 @
22 @
2 @
22222 @
@@
33333 @
3 @
33 @
3 3 @
333 @
@@
4 @
44 @
4 4 @
44444 @
4 @
@@
55555 @
5 @
5555 @
5 @
5555 @
@@
666 @
6 @
6666 @
6 6 @
666 @
@@
77777 @
7 @
7 @
7 @
7 @
@@
888 @
8 8 @
888 @
8 8 @
888 @
@@
999 @
9 9 @
9999 @
9 @
999 @
@@
@
@
: @
@
: @
@@
@
@
; @
@
; @
;; @@
@
< @
< @
< @
@
@@
@
@
=== @
=== @
@
@@
@
> @
> @
> @
@
@@
??? @
? ? @
? @
@
? @
@@
@@@ #
@ @ #
@ @@ #
@ @@ #
@ #
@@@@ ##
A @
A A @
AAAAA @
A A @
A A @
@@
BBBB @
B B @
BBBB @
B B @
BBBB @
@@
CCC @
C C @
C @
C C @
CCC @
@@
DDDD @
D D @
D D @
D D @
DDDD @
@@
EEEEE @
E @
EEEE @
E @
EEEEE @
@@
FFFFF @
F @
FFFF @
F @
F @
@@
GGG @
G @
G GG @
G G @
GGG @
@@
H H @
H H @
HHHHH @
H H @
H H @
@@
III @
I @
I @
I @
III @
@@
JJJ @
J @
J @
J J @
JJ @
@@
K K @
K K @
KKK @
K K @
K K @
@@
L @
L @
L @
L @
LLLLL @
@@
M M @
MM MM @
M M M @
M M @
M M @
@@
N N @
NN N @
N N N @
N NN @
N N @
@@
OOO @
O O @
O O @
O O @
OOO @
@@
PPPP @
P P @
PPPP @
P @
P @
@@
QQQ @
Q Q @
Q Q Q @
Q QQ @
QQQQ @
@@
RRRR @
R R @
RRRR @
R R @
R R @
@@
SSSS @
S @
SSS @
S @
SSSS @
@@
TTTTT @
T @
T @
T @
T @
@@
U U @
U U @
U U @
U U @
UUU @
@@
V V @
V V @
V V @
V V @
V @
@@
W W @
W W @
W W W @
W W W @
W W @
@@
X X @
X X @
X @
X X @
X X @
@@
Y Y @
Y Y @
Y @
Y @
Y @
@@
ZZZZZ @
Z @
Z @
Z @
ZZZZZ @
@@
[[ @
[ @
[ @
[ @
[[ @
@@
\ @
\ @
\ @
\ @
\ @
@@
]] @
] @
] @
] @
]] @
@@
^ @
^ ^ @
@
@
@
@@
@
@
@
@
_____ @
@@
` @
` @
@
@
@
@@
A a
A A a
AAAAA a
A A a
A A a
aa
BBBB b
B B b
BBBB b
B B b
BBBB b
bb
CCC c
C C c
C c
C C c
CCC c
cc
DDDD d
D D d
D D d
D D d
DDDD d
dd
EEEEE e
E e
EEEE e
E e
EEEEE e
ee
FFFFF f
F f
FFFF f
F f
F f
ff
GGG g
G g
G GG g
G G g
GGG g
gg
H H h
H H h
HHHHH h
H H h
H H h
hh
III i
I i
I i
I i
III i
ii
JJJ j
J j
J j
J J j
JJ j
jj
K K k
K K k
KKK k
K K k
K K k
kk
L l
L l
L l
L l
LLLLL l
ll
M M m
MM MM m
M M M m
M M m
M M m
mm
N N n
NN N n
N N N n
N NN n
N N n
nn
OOO o
O O o
O O o
O O o
OOO o
oo
PPPP p
P P p
PPPP p
P p
P p
pp
QQQ q
Q Q q
Q Q Q q
Q QQ q
QQQQ q
qq
RRRR r
R R r
RRRR r
R R r
R R r
rr
SSSS s
S s
SSS s
S s
SSSS s
ss
TTTTT t
T t
T t
T t
T t
tt
U U u
U U u
U U u
U U u
UUU u
uu
V V v
V V v
V V v
V V v
V v
vv
W W w
W W w
W W W w
W W W w
W W w
ww
X X x
X X x
X x
X X x
X X x
xx
Y Y y
Y Y y
Y y
Y y
Y y
yy
ZZZZZ z
Z z
Z z
Z z
ZZZZZ z
zz
{{ @
{ @
{{ @
{ @
{{ @
@@
| @
| @
| @
| @
| @
@@
}} @
} @
}} @
} @
}} @
@@
~ ~ @
~ ~ @
@
@
@
@@
Ä Ä @
Ä @
Ä Ä @
ÄÄÄÄÄ @
Ä Ä @
@@
Ö Ö @
ÖÖÖ @
Ö Ö @
Ö Ö @
ÖÖÖ @
@@
Ü Ü @
@
Ü Ü @
Ü Ü @
ÜÜÜ @
@@
Ä Ä ä
Ä ä
Ä Ä ä
ÄÄÄÄÄ ä
Ä Ä ä
ää
Ö Ö ö
ÖÖÖ ö
Ö Ö ö
Ö Ö ö
ÖÖÖ ö
öö
Ü Ü ü
ü
Ü Ü ü
Ü Ü ü
ÜÜÜ ü
üü
ßß @
ß ß @
ßßßß @
ß ß @
ß ß @
@@
0x2500 ─ BOX DRAWINGS LIGHT HORIZONTAL
@
@
──────@
@
@
@@
0x2501 ━ BOX DRAWINGS HEAVY HORIZONTAL
@
━━━━━━@
━━━━━━@
━━━━━━@
@
@@
0x2502 │ BOX DRAWINGS LIGHT VERTICAL
│ @
│ @
│ @
│ @
│ @
│ @@
0x2503 ┃ BOX DRAWINGS HEAVY VERTICAL
┃┃┃ @
┃┃┃ @
┃┃┃ @
┃┃┃ @
┃┃┃ @
┃┃┃ @@
0x250C ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT
@
@
┌┌┌┌@
┌ @
┌ @
┌ @@
0x250F ┏ BOX DRAWINGS HEAVY DOWN AND RIGHT
@
┏┏┏┏┏@
┏┏┏┏┏@
┏┏┏┏┏@
┏┏┏ @
┏┏┏ @@
0x2510 ┐ BOX DRAWINGS LIGHT DOWN AND LEFT
@
@
┐┐┐ @
┐ @
┐ @
┐ @@
0x2513 ┓ BOX DRAWINGS HEAVY DOWN AND LEFT
@
┓┓┓┓ @
┓┓┓┓ @
┓┓┓┓ @
┓┓┓ @
┓┓┓ @@
0x2514 └ BOX DRAWINGS LIGHT UP AND RIGHT
└ @
└ @
└└└└@
@
@
@@
0x2517 ┗ BOX DRAWINGS HEAVY UP AND RIGHT
┗┗┗ @
┗┗┗┗┗@
┗┗┗┗┗@
┗┗┗┗┗@
@
@@
0x2518 ┘ BOX DRAWINGS LIGHT UP AND LEFT
┘ @
┘ @
┘┘┘ @
@
@
@@
0x251B ┛ BOX DRAWINGS HEAVY UP AND LEFT
┛┛┛ @
┛┛┛┛ @
┛┛┛┛ @
┛┛┛┛ @
@
@@
0x251c ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT
├ @
├ @
├├├├@
├ @
├ @
├ @@
0x2523 ┣ BOX DRAWINGS HEAVY VERTICAL AND RIGHT
┣┣┣ @
┣┣┣┣┣@
┣┣┣┣┣@
┣┣┣┣┣@
┣┣┣ @
┣┣┣ @@
0x2524 ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT
┤ @
┤ @
┤┤┤ @
┤ @
┤ @
┤ @@
0x252B ┫ BOX DRAWINGS HEAVY VERTICAL AND LEFT
┫┫┫ @
┫┫┫┫ @
┫┫┫┫ @
┫┫┫┫ @
┫┫┫ @
┫┫┫ @@
0x252c ┬ BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
@
@
┬┬┬┬┬┬@
┬ @
┬ @
┬ @@
0x2533 ┳ BOX DRAWINGS HEAVY DOWN AND HORIZONTAL
@
┳┳┳┳┳┳@
┳┳┳┳┳┳@
┳┳┳┳┳┳@
┳┳┳ @
┳┳┳ @@
0x2534 ┴ BOX DRAWINGS LIGHT UP AND HORIZONTAL
┴ @
┴ @
┴┴┴┴┴┴@
@
@
@@
0x253B ┻ BOX DRAWINGS HEAVY UP AND HORIZONTAL
┻┻┻ @
┻┻┻┻┻┻@
┻┻┻┻┻┻@
┻┻┻┻┻┻@
@
@@
0x253c ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
┼ @
┼ @
┼┼┼┼┼┼@
┼ @
┼ @
┼ @@
0x254B ╋ BOX DRAWINGS HEAVY VERTICAL AND HORIZONTAL
╋╋╋ @
╋╋╋╋╋╋@
╋╋╋╋╋╋@
╋╋╋╋╋╋@
╋╋╋ @
╋╋╋ @@
0x2578 ╸ BOX DRAWINGS HEAVY LEFT
@
╸╸╸ @
╸╸╸ @
╸╸╸ @
@
@@
0x2579 ╹ BOX DRAWINGS HEAVY UP
╹╹╹ @
╹╹╹ @
╹╹╹ @
@
@
@@
0x257A ╺ BOX DRAWINGS HEAVY RIGHT
@
╺╺╺╺@
╺╺╺╺@
╺╺╺╺@
@
@@
0x257B ╻ BOX DRAWINGS HEAVY DOWN
@
@
╻╻╻ @
╻╻╻ @
╻╻╻ @
╻╻╻ @@
0x2580 ▀ UPPER HALF BLOCK
▀▀▀▀▀▀@
▀▀▀▀▀▀@
▀▀▀▀▀▀@
@
@
@@
0x2584 ▄ LOWER HALF BLOCK
@
@
▄▄▄▄▄▄@
▄▄▄▄▄▄@
▄▄▄▄▄▄@
▄▄▄▄▄▄@@
0x2588 █ FULL BLOCK
██████@
██████@
██████@
██████@
██████@
██████@@
0x25A0 ■ BLACK SQUARE
@
■■■ @
■■■ @
■■■ @
@
@@
@@ -0,0 +1,826 @@
export default `flf2a$ 8 8 17 -1 8
basic.flf by Craig O'Flaherty <cofl@it.ntu.edu.au>
August 17, 1994
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
db$@
88$@
YP$@
$@
db$@
YP$@
$@
$@@
.o. .o.$@
\`8' \`8'$@
$@
$@
$@
$@
$@
$@@
$@
db db $@
C88888D$@
88 88 $@
C88888D$@
YP YP $@
$@
$@@
A $@
.d8888.$@
88'8 YP$@
\`8b8. $@
\`V8b.$@
db 8 8D$@
\`8888Y'$@
V $@@
db dD$@
YP d8'$@
d8' $@
d8' $@
d8' db$@
d8' YP$@
$@
$@@
.d888b. $@
8P 8D $@
\`Vb d8' $@
d88C dD$@
C8' d8D $@
\`888P Yb$@
$@
$@@
Cb$@
\`D$@
'$@
$@
$@
$@
$@
$@@
dD$@
d8' $@
d8 $@
C88 $@
V8 $@
V8. $@
VD$@
$@@
Cb $@
\`8b $@
8b $@
88D$@
8P $@
.8P $@
CP $@
$@@
$@
8. A .8$@
\`8.8.8'$@
888 $@
.d'8\`b.$@
8' V \`8$@
$@
$@@
$@
db $@
88 $@
C8888D$@
88 $@
VP $@
$@
$@@
$@
$@
$@
$@
db$@
V8$@
P$@
$@@
$@
$@
$@
C8888D$@
$@
$@
$@
$@@
$@
$@
$@
$@
db$@
VP$@
$@
$@@
dD$@
d8'$@
d8' $@
d8' $@
d8' $@
C8' $@
$@
$@@
.d88b. $@
.8P 88.$@
88 d'88$@
88 d' 88$@
\`88 d8'$@
\`Y88P' $@
$@
$@@
db$@
o88$@
88$@
88$@
88$@
VP$@
$@
$@@
.d888b.$@
VP \`8D$@
odD'$@
.88' $@
j88. $@
888888D$@
$@
$@@
d8888b.$@
VP \`8D$@
oooY'$@
~~~b.$@
db 8D$@
Y8888P'$@
$@
$@@
j88D $@
j8~88 $@
j8' 88 $@
V88888D$@
88 $@
VP $@
$@
$@@
ooooo$@
8P~~~~$@
dP $@
V8888b.$@
\`8D$@
88oobY'$@
$@
$@@
dD $@
d8' $@
d8' $@
d8888b.$@
88' \`8D$@
\`8888P $@
$@
$@@
d88888D$@
VP d8'$@
d8' $@
d8' $@
d8' $@
d8' $@
$@
$@@
.d888b.$@
88 8D$@
\`VoooY'$@
.d~~~b.$@
88 8D$@
\`Y888P'$@
$@
$@@
.d888b.$@
88' \`8D$@
\`V8o88'$@
d8' $@
d8' $@
d8' $@
$@
$@@
$@
db$@
VP$@
$@
db$@
VP$@
$@
$@@
$@
db$@
VP$@
$@
db$@
V8$@
P$@
$@@
$@
.dP$@
.d8 $@
,P $@
\`b $@
\`Vb $@
\`Vb$@
$@@
$@
C8888D$@
$@
C8888D$@
$@
$@
$@
$@@
$@
Vb $@
\`Vb $@
\`V.$@
.d'$@
.dP $@
dP $@
$@@
.d888b.$@
VP \`8D$@
odD'$@
8P' $@
oo $@
VP $@
$@
$@@
.o888b.$@
d8' Y8$@
8P db dP$@
8b V8o8P$@
Y8. d$@
\`Y888P'$@
$@
$@@
.d8b. $@
d8' \`8b$@
88ooo88$@
88~~~88$@
88 88$@
YP YP$@
$@
$@@
d8888b.$@
88 \`8D$@
88oooY'$@
88~~~b.$@
88 8D$@
Y8888P'$@
$@
$@@
.o88b.$@
d8P Y8$@
8P $@
8b $@
Y8b d8$@
\`Y88P'$@
$@
$@@
d8888b.$@
88 \`8D$@
88 88$@
88 88$@
88 .8D$@
Y8888D'$@
$@
$@@
d88888b$@
88' $@
88ooooo$@
88~~~~~$@
88. $@
Y88888P$@
$@
$@@
d88888b$@
88' $@
88ooo $@
88~~~ $@
88 $@
YP $@
$@
$@@
d888b $@
88' Y8b$@
88 $@
88 ooo$@
88. ~8~$@
Y888P $@
$@
$@@
db db$@
88 88$@
88ooo88$@
88~~~88$@
88 88$@
YP YP$@
$@
$@@
d888888b$@
\`88' $@
88 $@
88 $@
.88. $@
Y888888P$@
$@
$@@
d88b$@
\`8P'$@
88 $@
88 $@
db. 88 $@
Y8888P $@
$@
$@@
db dD$@
88 ,8P'$@
88,8P $@
88\`8b $@
88 \`88.$@
YP YD$@
$@
$@@
db $@
88 $@
88 $@
88 $@
88booo.$@
Y88888P$@
$@
$@@
.88b d88.$@
88'YbdP\`88$@
88 88 88$@
88 88 88$@
88 88 88$@
YP YP YP$@
$@
$@@
d8b db$@
888o 88$@
88V8o 88$@
88 V8o88$@
88 V888$@
VP V8P$@
$@
$@@
.d88b. $@
.8P Y8.$@
88 88$@
88 88$@
\`8b d8'$@
\`Y88P' $@
$@
$@@
d8888b.$@
88 \`8D$@
88oodD'$@
88~~~ $@
88 $@
88 $@
$@
$@@
.d88b. $@
.8P Y8.$@
88 88$@
88 88$@
\`8P d8'$@
\`Y88'Y8$@
$@
$@@
d8888b.$@
88 \`8D$@
88oobY'$@
88\`8b $@
88 \`88.$@
88 YD$@
$@
$@@
.d8888.$@
88' YP$@
\`8bo. $@
\`Y8b.$@
db 8D$@
\`8888Y'$@
$@
$@@
d888888b$@
\`~~88~~'$@
88 $@
88 $@
88 $@
YP $@
$@
$@@
db db$@
88 88$@
88 88$@
88 88$@
88b d88$@
~Y8888P'$@
$@
$@@
db db$@
88 88$@
Y8 8P$@
\`8b d8'$@
\`8bd8' $@
YP $@
$@
$@@
db d8b db$@
88 I8I 88$@
88 I8I 88$@
Y8 I8I 88$@
\`8b d8'8b d8'$@
\`8b8' \`8d8' $@
$@
$@@
db db$@
\`8b d8'$@
\`8bd8' $@
.dPYb. $@
.8P Y8.$@
YP YP$@
$@
$@@
db db$@
\`8b d8'$@
\`8bd8' $@
88 $@
88 $@
YP $@
$@
$@@
d88888D$@
YP d8'$@
d8' $@
d8' $@
d8' db$@
d88888P$@
$@
$@@
d88D$@
88 $@
88 $@
88 $@
88 $@
L88D$@
$@
$@@
Cb $@
\`8b $@
\`8b $@
\`8b $@
\`8b $@
\`8D$@
$@
$@@
C88D$@
88$@
88$@
88$@
88$@
C888$@
$@
$@@
db $@
.dPVb. $@
dP' \`Vb$@
$@
$@
$@
$@
$@@
$@
$@
$@
$@
$@
C88888D$@
$@
$@@
dD$@
C'$@
\`$@
$@
$@
$@
$@
$@@
.d8b. $@
d8' \`8b$@
88ooo88$@
88~~~88$@
88 88$@
YP YP$@
$@
$@@
d8888b.$@
88 \`8D$@
88oooY'$@
88~~~b.$@
88 8D$@
Y8888P'$@
$@
$@@
.o88b.$@
d8P Y8$@
8P $@
8b $@
Y8b d8$@
\`Y88P'$@
$@
$@@
d8888b.$@
88 \`8D$@
88 88$@
88 88$@
88 .8D$@
Y8888D'$@
$@
$@@
d88888b$@
88' $@
88ooooo$@
88~~~~~$@
88. $@
Y88888P$@
$@
$@@
d88888b$@
88' $@
88ooo $@
88~~~ $@
88 $@
YP $@
$@
$@@
d888b $@
88' Y8b$@
88 $@
88 ooo$@
88. ~8~$@
Y888P $@
$@
$@@
db db$@
88 88$@
88ooo88$@
88~~~88$@
88 88$@
YP YP$@
$@
$@@
d888888b$@
\`88' $@
88 $@
88 $@
.88. $@
Y888888P$@
$@
$@@
d88b$@
\`8P'$@
88 $@
88 $@
db. 88 $@
Y8888P $@
$@
$@@
db dD$@
88 ,8P'$@
88,8P $@
88\`8b $@
88 \`88.$@
YP YD$@
$@
$@@
db $@
88 $@
88 $@
88 $@
88booo.$@
Y88888P$@
$@
$@@
.88b d88.$@
88'YbdP\`88$@
88 88 88$@
88 88 88$@
88 88 88$@
YP YP YP$@
$@
$@@
d8b db$@
888o 88$@
88V8o 88$@
88 V8o88$@
88 V888$@
VP V8P$@
$@
$@@
.d88b. $@
.8P Y8.$@
88 88$@
88 88$@
\`8b d8'$@
\`Y88P' $@
$@
$@@
d8888b.$@
88 \`8D$@
88oodD'$@
88~~~ $@
88 $@
88 $@
$@
$@@
.d88b. $@
.8P Y8.$@
88 88$@
88 88$@
\`8P d8'$@
\`Y88'Y8$@
$@
$@@
d8888b.$@
88 \`8D$@
88oobY'$@
88\`8b $@
88 \`88.$@
88 YD$@
$@
$@@
.d8888.$@
88' YP$@
\`8bo. $@
\`Y8b.$@
db 8D$@
\`8888Y'$@
$@
$@@
d888888b$@
\`~~88~~'$@
88 $@
88 $@
88 $@
YP $@
$@
$@@
db db$@
88 88$@
88 88$@
88 88$@
88b d88$@
~Y8888P'$@
$@
$@@
db db$@
88 88$@
Y8 8P$@
\`8b d8'$@
\`8bd8' $@
YP $@
$@
$@@
db d8b db$@
88 I8I 88$@
88 I8I 88$@
Y8 I8I 88$@
\`8b d8'8b d8'$@
\`8b8' \`8d8' $@
$@
$@@
db db$@
\`8b d8'$@
\`8bd8' $@
.dPYb. $@
.8P Y8.$@
YP YP$@
$@
$@@
db db$@
\`8b d8'$@
\`8bd8' $@
88 $@
88 $@
YP $@
$@
$@@
d88888D$@
YP d8'$@
d8' $@
d8' $@
d8' db$@
d88888P$@
$@
$@@
.8P$@
8' $@
.dP $@
C88 $@
\`Yb $@
8. $@
\`8b$@
$@@
8$@
8$@
8$@
$@
8$@
8$@
8$@
$@@
V8. $@
\`8 $@
Vb. $@
88D$@
dP' $@
.8 $@
C8' $@
$@@
.oo. .$@
P' \`VP'$@
$@
$@
$@
$@
$@
$@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@@
`
@@ -0,0 +1,73 @@
import { URL } from 'node:url'
import Dispatcher from './dispatcher'
import buildConnector from './connector'
type H2ClientOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
/**
* A basic H2C client, mapped on top a single TCP connection. Pipelining is disabled by default.
*/
export class H2CClient extends Dispatcher {
constructor (url: string | URL, options?: H2CClient.Options)
/** Property to get and set the pipelining factor. */
pipelining: number
/** `true` after `client.close()` has been called. */
closed: boolean
/** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */
destroyed: boolean
// Override dispatcher APIs.
override connect (
options: H2ClientOptions
): Promise<Dispatcher.ConnectData>
override connect (
options: H2ClientOptions,
callback: (err: Error | null, data: Dispatcher.ConnectData) => void
): void
}
export declare namespace H2CClient {
export interface Options {
/** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */
maxHeaderSize?: number;
/** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */
headersTimeout?: number;
/** The timeout for establishing a socket connection, in milliseconds. Use `0` to disable it entirely. Default: `10e3` milliseconds (10s). */
connectTimeout?: number;
/** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */
bodyTimeout?: number;
/** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */
keepAliveTimeout?: number;
/** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */
keepAliveMaxTimeout?: number;
/** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */
keepAliveTimeoutThreshold?: number;
/** An IPC endpoint, either a Unix domain socket or Windows named pipe. Default: `null`. */
socketPath?: string;
/** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */
pipelining?: number;
/** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */
strictContentLength?: boolean;
/** Maximum number of TLS cached sessions used by the built-in connector. Use `0` to disable TLS session caching. Default: `100`. */
maxCachedSessions?: number;
/** Connector options passed to `buildConnector`, or a custom connector function. Default: `null`. */
connect?: Omit<Partial<buildConnector.BuildOptions>, 'allowH2'> | buildConnector.connector;
/** The maximum number of requests to send over a single connection before it is reset. Use `0` to disable this limit. Default: `null`. */
maxRequestsPerClient?: number;
/** Local IP address the socket should connect from. */
localAddress?: string;
/** Max response body size in bytes, -1 is disabled */
maxResponseSize?: number;
/** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */
autoSelectFamily?: boolean;
/** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */
autoSelectFamilyAttemptTimeout?: number;
/**
* @description Dictates the maximum number of concurrent streams for a single H2 session. The server's SETTINGS_MAX_CONCURRENT_STREAMS can lower it, but not raise it.
* @default 100
*/
maxConcurrentStreams?: number
}
}
export default H2CClient
@@ -0,0 +1,47 @@
import type {KeywordErrorDefinition, KeywordErrorCxt} from "../../types"
import type {SchemaCxt} from ".."
import {reportError} from "../errors"
import {_, Name} from "../codegen"
import N from "../names"
const boolError: KeywordErrorDefinition = {
message: "boolean schema is false",
}
export function topBoolOrEmptySchema(it: SchemaCxt): void {
const {gen, schema, validateName} = it
if (schema === false) {
falseSchemaError(it, false)
} else if (typeof schema == "object" && schema.$async === true) {
gen.return(N.data)
} else {
gen.assign(_`${validateName}.errors`, null)
gen.return(true)
}
}
export function boolOrEmptySchema(it: SchemaCxt, valid: Name): void {
const {gen, schema} = it
if (schema === false) {
gen.var(valid, false) // TODO var
falseSchemaError(it)
} else {
gen.var(valid, true) // TODO var
}
}
function falseSchemaError(it: SchemaCxt, overrideAllErrors?: boolean): void {
const {gen, data} = it
// TODO maybe some other interface should be used for non-keyword validation errors...
const cxt: KeywordErrorCxt = {
gen,
keyword: "false schema",
data,
schema: false,
schemaCode: false,
schemaValue: false,
params: {},
it,
}
reportError(cxt, boolError, undefined, overrideAllErrors)
}
@@ -0,0 +1,23 @@
/**
* @fileoverview Main package entrypoint.
* @author Nicholas C. Zakas
*/
"use strict";
const { name, version } = require("../package.json");
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
module.exports = {
meta: {
name,
version,
},
configs: {
all: require("./configs/eslint-all"),
recommended: require("./configs/eslint-recommended"),
},
};
@@ -0,0 +1,115 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
string: { unit: "حروف", verb: "ہونا" },
file: { unit: "بائٹس", verb: "ہونا" },
array: { unit: "آئٹمز", verb: "ہونا" },
set: { unit: "آئٹمز", verb: "ہونا" },
map: { unit: "آئٹمز", verb: "ہونا" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "ان پٹ",
email: "ای میل ایڈریس",
url: "یو آر ایل",
emoji: "ایموجی",
uuid: "یو یو آئی ڈی",
uuidv4: "یو یو آئی ڈی وی 4",
uuidv6: "یو یو آئی ڈی وی 6",
nanoid: "نینو آئی ڈی",
guid: "جی یو آئی ڈی",
cuid: "سی یو آئی ڈی",
cuid2: "سی یو آئی ڈی 2",
ulid: "یو ایل آئی ڈی",
xid: "ایکس آئی ڈی",
ksuid: "کے ایس یو آئی ڈی",
datetime: "آئی ایس او ڈیٹ ٹائم",
date: "آئی ایس او تاریخ",
time: "آئی ایس او وقت",
duration: "آئی ایس او مدت",
ipv4: "آئی پی وی 4 ایڈریس",
ipv6: "آئی پی وی 6 ایڈریس",
mac: "ایم اے سی ایڈریس",
cidrv4: "آئی پی وی 4 رینج",
cidrv6: "آئی پی وی 6 رینج",
base64: "بیس 64 ان کوڈڈ سٹرنگ",
base64url: "بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",
json_string: "جے ایس او این سٹرنگ",
e164: "ای 164 نمبر",
credit_card: "کریڈٹ کارڈ نمبر",
currency_code: "کرنسی کوڈ",
iban: "IBAN",
jwt: "جے ڈبلیو ٹی",
template_literal: "ان پٹ",
};
const TypeDictionary = {
nan: "NaN",
number: "نمبر",
array: "آرے",
null: "نل",
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue.expected)) {
return `غلط ان پٹ: instanceof ${issue.expected} متوقع تھا، ${received} موصول ہوا`;
}
return `غلط ان پٹ: ${expected} متوقع تھا، ${received} موصول ہوا`;
}
case "invalid_value":
if (issue.values.length === 1)
return `غلط ان پٹ: ${util.stringifyPrimitive(issue.values[0])} متوقع تھا`;
return `غلط آپشن: ${util.joinValues(issue.values, "|")} میں سے ایک متوقع تھا`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `بہت بڑا: ${issue.origin ?? "ویلیو"} کے ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عناصر"} ہونے متوقع تھے`;
return `بہت بڑا: ${issue.origin ?? "ویلیو"} کا ${adj}${issue.maximum.toString()} ہونا متوقع تھا`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `بہت چھوٹا: ${issue.origin} کے ${adj}${issue.minimum.toString()} ${sizing.unit} ہونے متوقع تھے`;
}
return `بہت چھوٹا: ${issue.origin} کا ${adj}${issue.minimum.toString()} ہونا متوقع تھا`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with") {
return `غلط سٹرنگ: "${_issue.prefix}" سے شروع ہونا چاہیے`;
}
if (_issue.format === "ends_with")
return `غلط سٹرنگ: "${_issue.suffix}" پر ختم ہونا چاہیے`;
if (_issue.format === "includes")
return `غلط سٹرنگ: "${_issue.includes}" شامل ہونا چاہیے`;
if (_issue.format === "regex")
return `غلط سٹرنگ: پیٹرن ${_issue.pattern} سے میچ ہونا چاہیے`;
return `غلط ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `غلط نمبر: ${issue.divisor} کا مضاعف ہونا چاہیے`;
case "unrecognized_keys":
return `غیر تسلیم شدہ کی${issue.keys.length > 1 ? "ز" : ""}: ${util.joinValues(issue.keys, "، ")}`;
case "invalid_key":
return `${issue.origin} میں غلط کی`;
case "invalid_union":
return "غلط ان پٹ";
case "invalid_element":
return `${issue.origin} میں غلط ویلیو`;
default:
return `غلط ان پٹ`;
}
};
};
export default function () {
return {
localeError: error(),
};
}
@@ -0,0 +1,443 @@
semver(1) -- The semantic versioner for npm
===========================================
## Install
```bash
npm install semver
````
## Usage
As a node module:
```js
const semver = require('semver')
semver.valid('1.2.3') // '1.2.3'
semver.valid('a.b.c') // null
semver.clean(' =v1.2.3 ') // '1.2.3'
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
semver.gt('1.2.3', '9.8.7') // false
semver.lt('1.2.3', '9.8.7') // true
semver.minVersion('>=1.0.0') // '1.0.0'
semver.valid(semver.coerce('v2')) // '2.0.0'
semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7'
```
As a command-line utility:
```
$ semver -h
A JavaScript implementation of the https://semver.org/ specification
Copyright Isaac Z. Schlueter
Usage: semver [options] <version> [<version> [...]]
Prints valid versions sorted by SemVer precedence
Options:
-r --range <range>
Print versions that match the specified range.
-i --increment [<level>]
Increment a version by the specified level. Level can
be one of: major, minor, patch, premajor, preminor,
prepatch, or prerelease. Default level is 'patch'.
Only one version may be specified.
--preid <identifier>
Identifier to be used to prefix premajor, preminor,
prepatch or prerelease version increments.
-l --loose
Interpret versions and ranges loosely
-p --include-prerelease
Always include prerelease versions in range matching
-c --coerce
Coerce a string into SemVer if possible
(does not imply --loose)
--rtl
Coerce version strings right to left
--ltr
Coerce version strings left to right (default)
Program exits successfully if any valid version satisfies
all supplied ranges, and prints all satisfying versions.
If no satisfying versions are found, then exits failure.
Versions are printed in ascending order, so supplying
multiple versions to the utility will just sort them.
```
## Versions
A "version" is described by the `v2.0.0` specification found at
<https://semver.org/>.
A leading `"="` or `"v"` character is stripped off and ignored.
## Ranges
A `version range` is a set of `comparators` which specify versions
that satisfy the range.
A `comparator` is composed of an `operator` and a `version`. The set
of primitive `operators` is:
* `<` Less than
* `<=` Less than or equal to
* `>` Greater than
* `>=` Greater than or equal to
* `=` Equal. If no operator is specified, then equality is assumed,
so this operator is optional, but MAY be included.
For example, the comparator `>=1.2.7` would match the versions
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
or `1.1.0`.
Comparators can be joined by whitespace to form a `comparator set`,
which is satisfied by the **intersection** of all of the comparators
it includes.
A range is composed of one or more comparator sets, joined by `||`. A
version matches a range if and only if every comparator in at least
one of the `||`-separated comparator sets is satisfied by the version.
For example, the range `>=1.2.7 <1.3.0` would match the versions
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
or `1.1.0`.
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
### Prerelease Tags
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
it will only be allowed to satisfy comparator sets if at least one
comparator with the same `[major, minor, patch]` tuple also has a
prerelease tag.
For example, the range `>1.2.3-alpha.3` would be allowed to match the
version `1.2.3-alpha.7`, but it would *not* be satisfied by
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
range only accepts prerelease tags on the `1.2.3` version. The
version `3.4.5` *would* satisfy the range, because it does not have a
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
The purpose for this behavior is twofold. First, prerelease versions
frequently are updated very quickly, and contain many breaking changes
that are (by the author's design) not yet fit for public consumption.
Therefore, by default, they are excluded from range matching
semantics.
Second, a user who has opted into using a prerelease version has
clearly indicated the intent to use *that specific* set of
alpha/beta/rc versions. By including a prerelease tag in the range,
the user is indicating that they are aware of the risk. However, it
is still not appropriate to assume that they have opted into taking a
similar risk on the *next* set of prerelease versions.
Note that this behavior can be suppressed (treating all prerelease
versions as if they were normal versions, for the purpose of range
matching) by setting the `includePrerelease` flag on the options
object to any
[functions](https://github.com/npm/node-semver#functions) that do
range matching.
#### Prerelease Identifiers
The method `.inc` takes an additional `identifier` string argument that
will append the value of the string as a prerelease identifier:
```javascript
semver.inc('1.2.3', 'prerelease', 'beta')
// '1.2.4-beta.0'
```
command-line example:
```bash
$ semver 1.2.3 -i prerelease --preid beta
1.2.4-beta.0
```
Which then can be used to increment further:
```bash
$ semver 1.2.4-beta.0 -i prerelease
1.2.4-beta.1
```
### Advanced Range Syntax
Advanced range syntax desugars to primitive comparators in
deterministic ways.
Advanced ranges may be combined in the same way as primitive
comparators using white space or `||`.
#### Hyphen Ranges `X.Y.Z - A.B.C`
Specifies an inclusive set.
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
If a partial version is provided as the first version in the inclusive
range, then the missing pieces are replaced with zeroes.
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
If a partial version is provided as the second version in the
inclusive range, then all versions that start with the supplied parts
of the tuple are accepted, but nothing that would be greater than the
provided tuple parts.
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
numeric values in the `[major, minor, patch]` tuple.
* `*` := `>=0.0.0` (Any version satisfies)
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
A partial version range is treated as an X-Range, so the special
character is in fact optional.
* `""` (empty string) := `*` := `>=0.0.0`
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
Allows patch-level changes if a minor version is specified on the
comparator. Allows minor-level changes if not.
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
the `1.2.3` version will be allowed, if they are greater than or
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
`1.2.4-beta.2` would not, because it is a prerelease of a
different `[major, minor, patch]` tuple.
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
Allows changes that do not modify the left-most non-zero element in the
`[major, minor, patch]` tuple. In other words, this allows patch and
minor updates for versions `1.0.0` and above, patch updates for
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
Many authors treat a `0.x` version as if the `x` were the major
"breaking-change" indicator.
Caret ranges are ideal when an author may make breaking changes
between `0.2.4` and `0.3.0` releases, which is a common practice.
However, it presumes that there will *not* be breaking changes between
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
additive (but non-breaking), according to commonly observed practices.
* `^1.2.3` := `>=1.2.3 <2.0.0`
* `^0.2.3` := `>=0.2.3 <0.3.0`
* `^0.0.3` := `>=0.0.3 <0.0.4`
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
the `1.2.3` version will be allowed, if they are greater than or
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
`1.2.4-beta.2` would not, because it is a prerelease of a
different `[major, minor, patch]` tuple.
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
`0.0.3` version *only* will be allowed, if they are greater than or
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
When parsing caret ranges, a missing `patch` value desugars to the
number `0`, but will allow flexibility within that value, even if the
major and minor versions are both `0`.
* `^1.2.x` := `>=1.2.0 <2.0.0`
* `^0.0.x` := `>=0.0.0 <0.1.0`
* `^0.0` := `>=0.0.0 <0.1.0`
A missing `minor` and `patch` values will desugar to zero, but also
allow flexibility within those values, even if the major version is
zero.
* `^1.x` := `>=1.0.0 <2.0.0`
* `^0.x` := `>=0.0.0 <1.0.0`
### Range Grammar
Putting all this together, here is a Backus-Naur grammar for ranges,
for the benefit of parser authors:
```bnf
range-set ::= range ( logical-or range ) *
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
range ::= hyphen | simple ( ' ' simple ) * | ''
hyphen ::= partial ' - ' partial
simple ::= primitive | partial | tilde | caret
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
xr ::= 'x' | 'X' | '*' | nr
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
tilde ::= '~' partial
caret ::= '^' partial
qualifier ::= ( '-' pre )? ( '+' build )?
pre ::= parts
build ::= parts
parts ::= part ( '.' part ) *
part ::= nr | [-0-9A-Za-z]+
```
## Functions
All methods and classes take a final `options` object argument. All
options in this object are `false` by default. The options supported
are:
- `loose` Be more forgiving about not-quite-valid semver strings.
(Any resulting output will always be 100% strict compliant, of
course.) For backwards compatibility reasons, if the `options`
argument is a boolean value instead of an object, it is interpreted
to be the `loose` param.
- `includePrerelease` Set to suppress the [default
behavior](https://github.com/npm/node-semver#prerelease-tags) of
excluding prerelease tagged versions from ranges unless they are
explicitly opted into.
Strict-mode Comparators and Ranges will be strict about the SemVer
strings that they parse.
* `valid(v)`: Return the parsed version, or null if it's not valid.
* `inc(v, release)`: Return the version incremented by the release
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
`prepatch`, or `prerelease`), or null if it's not valid
* `premajor` in one call will bump the version up to the next major
version and down to a prerelease of that major version.
`preminor`, and `prepatch` work the same way.
* If called from a non-prerelease version, the `prerelease` will work the
same as `prepatch`. It increments the patch version, then makes a
prerelease. If the input version is already a prerelease it simply
increments it.
* `prerelease(v)`: Returns an array of prerelease components, or null
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
* `major(v)`: Return the major version number.
* `minor(v)`: Return the minor version number.
* `patch(v)`: Return the patch version number.
* `intersects(r1, r2, loose)`: Return true if the two supplied ranges
or comparators intersect.
* `parse(v)`: Attempt to parse a string as a semantic version, returning either
a `SemVer` object or `null`.
### Comparison
* `gt(v1, v2)`: `v1 > v2`
* `gte(v1, v2)`: `v1 >= v2`
* `lt(v1, v2)`: `v1 < v2`
* `lte(v1, v2)`: `v1 <= v2`
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
even if they're not the exact same string. You already know how to
compare strings.
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
the corresponding function above. `"==="` and `"!=="` do simple
string comparison, but are included for completeness. Throws if an
invalid comparison string is provided.
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
in descending order when passed to `Array.sort()`.
* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions
are equal. Sorts in ascending order if passed to `Array.sort()`.
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
* `diff(v1, v2)`: Returns difference between two versions by the release type
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
or null if the versions are the same.
### Comparators
* `intersects(comparator)`: Return true if the comparators intersect
### Ranges
* `validRange(range)`: Return the valid range or null if it's not valid
* `satisfies(version, range)`: Return true if the version satisfies the
range.
* `maxSatisfying(versions, range)`: Return the highest version in the list
that satisfies the range, or `null` if none of them do.
* `minSatisfying(versions, range)`: Return the lowest version in the list
that satisfies the range, or `null` if none of them do.
* `minVersion(range)`: Return the lowest version that can possibly match
the given range.
* `gtr(version, range)`: Return `true` if version is greater than all the
versions possible in the range.
* `ltr(version, range)`: Return `true` if version is less than all the
versions possible in the range.
* `outside(version, range, hilo)`: Return true if the version is outside
the bounds of the range in either the high or low direction. The
`hilo` argument must be either the string `'>'` or `'<'`. (This is
the function called by `gtr` and `ltr`.)
* `intersects(range)`: Return true if any of the ranges comparators intersect
Note that, since ranges may be non-contiguous, a version might not be
greater than a range, less than a range, *or* satisfy a range! For
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
until `2.0.0`, so the version `1.2.10` would not be greater than the
range (because `2.0.1` satisfies, which is higher), nor less than the
range (since `1.2.8` satisfies, which is lower), and it also does not
satisfy the range.
If you want to know if a version satisfies or does not satisfy a
range, use the `satisfies(version, range)` function.
### Coercion
* `coerce(version, options)`: Coerces a string to semver if possible
This aims to provide a very forgiving translation of a non-semver string to
semver. It looks for the first digit in a string, and consumes all
remaining characters which satisfy at least a partial semver (e.g., `1`,
`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer
versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All
surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes
`3.4.0`). Only text which lacks digits will fail coercion (`version one`
is not valid). The maximum length for any semver component considered for
coercion is 16 characters; longer components will be ignored
(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any
semver component is `Integer.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value
components are invalid (`9999999999999999.4.7.4` is likely invalid).
If the `options.rtl` flag is set, then `coerce` will return the right-most
coercible tuple that does not share an ending index with a longer coercible
tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not
`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of
any other overlapping SemVer tuple.
### Clean
* `clean(version)`: Clean a string to be a valid semver if possible
This will return a cleaned and trimmed semver version. If the provided version is not valid a null will be returned. This does not work for ranges.
ex.
* `s.clean(' = v 2.1.5foo')`: `null`
* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'`
* `s.clean(' = v 2.1.5-foo')`: `null`
* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'`
* `s.clean('=v2.1.5')`: `'2.1.5'`
* `s.clean(' =v2.1.5')`: `2.1.5`
* `s.clean(' 2.1.5 ')`: `'2.1.5'`
* `s.clean('~1.0.0')`: `null`