docs: 仓库链接指向本镜像仓库
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Skipped

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,3 @@
# `react-separator`
View docs [here](https://radix-ui.com/primitives/docs/components/separator).
@@ -0,0 +1,83 @@
"""PEP 656 support.
This module implements logic to detect if the currently running Python is
linked against musl, and what musl version is used.
"""
import functools
import re
import subprocess
import sys
from typing import Iterator, NamedTuple, Optional, Sequence
from ._elffile import ELFFile
class _MuslVersion(NamedTuple):
major: int
minor: int
def _parse_musl_version(output: str) -> Optional[_MuslVersion]:
lines = [n for n in (n.strip() for n in output.splitlines()) if n]
if len(lines) < 2 or lines[0][:4] != "musl":
return None
m = re.match(r"Version (\d+)\.(\d+)", lines[1])
if not m:
return None
return _MuslVersion(major=int(m.group(1)), minor=int(m.group(2)))
@functools.lru_cache()
def _get_musl_version(executable: str) -> Optional[_MuslVersion]:
"""Detect currently-running musl runtime version.
This is done by checking the specified executable's dynamic linking
information, and invoking the loader to parse its output for a version
string. If the loader is musl, the output would be something like::
musl libc (x86_64)
Version 1.2.2
Dynamic Program Loader
"""
try:
with open(executable, "rb") as f:
ld = ELFFile(f).interpreter
except (OSError, TypeError, ValueError):
return None
if ld is None or "musl" not in ld:
return None
proc = subprocess.run([ld], stderr=subprocess.PIPE, text=True)
return _parse_musl_version(proc.stderr)
def platform_tags(archs: Sequence[str]) -> Iterator[str]:
"""Generate musllinux tags compatible to the current platform.
:param archs: Sequence of compatible architectures.
The first one shall be the closest to the actual architecture and be the part of
platform tag after the ``linux_`` prefix, e.g. ``x86_64``.
The ``linux_`` prefix is assumed as a prerequisite for the current platform to
be musllinux-compatible.
:returns: An iterator of compatible musllinux tags.
"""
sys_musl = _get_musl_version(sys.executable)
if sys_musl is None: # Python not dynamically linked against musl.
return
for arch in archs:
for minor in range(sys_musl.minor, -1, -1):
yield f"musllinux_{sys_musl.major}_{minor}_{arch}"
if __name__ == "__main__": # pragma: no cover
import sysconfig
plat = sysconfig.get_platform()
assert plat.startswith("linux-"), "not linux"
print("plat:", plat)
print("musl:", _get_musl_version(sys.executable))
print("tags:", end=" ")
for t in platform_tags(re.sub(r"[.-]", "_", plat.split("-", 1)[-1])):
print(t, end="\n ")
@@ -0,0 +1,64 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.mediaTypeEssence = mediaTypeEssence;
exports.isJsonContentType = isJsonContentType;
const content_type_1 = __importDefault(require("content-type"));
/**
* Extracts the media type (the lowercased `type/subtype` pair, without
* parameters) from a raw `Content-Type` header value, or `undefined` when the
* header is missing or empty.
*
* Content-Type comparisons must use the parsed media type, never a substring
* search of the raw header: a value like `text/plain; a=application/json`
* contains the substring `application/json` but its media type is
* `text/plain`, and case variants or parameters make naive string comparison
* wrong in both directions.
*
* "Essence" is the WHATWG MIME Sniffing standard's term for the bare
* `type/subtype` pair (https://mimesniff.spec.whatwg.org/#mime-type-essence);
* the Fetch standard's request classification is defined against it
* (https://fetch.spec.whatwg.org/#cors-safelisted-request-header).
*
* Parsing is RFC 9110 (`content-type` package) first. When the parameter
* section is malformed (`application/json;`, `application/json; charset=`),
* browsers and most HTTP stacks still derive the media type from the segment
* before the first `;` — the fallback matches that widely-implemented
* behavior, so a header whose media type is unambiguous is not rejected for
* a sloppy parameter section.
*/
function mediaTypeEssence(header) {
if (!header) {
return undefined;
}
try {
return content_type_1.default.parse(header).type;
}
catch {
const essence = (header.split(';', 1)[0] ?? '').trim().toLowerCase();
// A comma in the parameter tail of an unparseable value indicates
// joined duplicate headers — ambiguous, so no essence at all (keeps
// duplicate-header handling uniform whether or not the first copy
// carries parameters).
if (essence === '' || header.slice(essence.length).includes(',')) {
return undefined;
}
return essence;
}
}
/**
* Whether a raw `Content-Type` header value denotes `application/json`.
* Parameters (for example `charset=utf-8`) are allowed and ignored; malformed
* parameter sections do not reject a header whose media type is unambiguously
* `application/json` (see `mediaTypeEssence` for the exact grammar).
*/
function isJsonContentType(header) {
// Fast path: the exact literal is what SDK clients send on every POST.
if (header === 'application/json') {
return true;
}
return mediaTypeEssence(header) === 'application/json';
}
//# sourceMappingURL=mediaType.js.map
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const decorators: LibDefinition;
@@ -0,0 +1 @@
{"version":3,"file":"sword.js","sources":["../../../src/icons/sword.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Sword\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cG9seWxpbmUgcG9pbnRzPSIxNC41IDE3LjUgMyA2IDMgMyA2IDMgMTcuNSAxNC41IiAvPgogIDxsaW5lIHgxPSIxMyIgeDI9IjE5IiB5MT0iMTkiIHkyPSIxMyIgLz4KICA8bGluZSB4MT0iMTYiIHgyPSIyMCIgeTE9IjE2IiB5Mj0iMjAiIC8+CiAgPGxpbmUgeDE9IjE5IiB4Mj0iMjEiIHkxPSIyMSIgeTI9IjE5IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/sword\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 Sword = createLucideIcon('Sword', [\n ['polyline', { points: '14.5 17.5 3 6 3 3 6 3 17.5 14.5', key: '1hfsw2' }],\n ['line', { x1: '13', x2: '19', y1: '19', y2: '13', key: '1vrmhu' }],\n ['line', { x1: '16', x2: '20', y1: '16', y2: '20', key: '1bron3' }],\n ['line', { x1: '19', x2: '21', y1: '21', y2: '19', key: '13pww6' }],\n]);\n\nexport default Sword;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,iBAAiB,OAAS,CAAA,CAAA,CAAA;AAAA,CAAA,CACtC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,CAAA,CAAA,CAAA,CAAE,QAAQ,CAAmC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CACzE,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,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAClE,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,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAClE,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,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACpE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,3 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_router_linear_router_router = require("./router.js");
exports.LinearRouter = require_router_linear_router_router.LinearRouter;
@@ -0,0 +1,74 @@
import { i as jsonSchemaValidator, n as JsonSchemaValidator, t as JsonSchemaType } from "./types-DsbMXNFL.cjs";
//#region ../core-internal/src/validators/cfWorkerProvider.d.ts
/**
* JSON Schema draft version supported by `@cfworker/json-schema`.
*/
type CfWorkerSchemaDraft = '4' | '7' | '2019-09' | '2020-12';
/**
* `@cfworker/json-schema`-backed JSON Schema validator. See
* `@modelcontextprotocol/{client,server}/validators/cf-worker` for the customisation entry point.
*
* Default dispatches on the schema's declared dialect: no `$schema` or 2020-12 → `'2020-12'`
* (SEP-1613); 2019-09 → `'2019-09'`; draft-07 or draft-06 → `'7'`. Schemas declaring any other `$schema` are rejected
* with a plain `Error`. Passing an explicit `draft` to the constructor
* overrides this — that draft is used for every schema regardless of `$schema`.
*
* Known draft-07 engine gap: `@cfworker/json-schema` does not treat draft-07 `dependencies` as
* a name→subschema map during `$ref` collection, so a dependency entry whose KEY collides with
* a JSON Schema keyword (`type`, `default`, `format`, `required`, `pattern`, …) and whose
* subschema contains a `$ref` throws `Unresolved $ref` at validation time when the dependency
* triggers — data-dependently, not at compile. The Node (classic Ajv) engine handles the same
* schema correctly. Callers that hit this receive the SDK's typed validation error (the throw
* is captured by the validation paths), and the deviation is pinned by a recorded-contract test.
*
* @example Use with default configuration (2020-12, shortcircuit on)
* ```ts source="./cfWorkerProvider.examples.ts#CfWorkerJsonSchemaValidator_default"
* const validator = new CfWorkerJsonSchemaValidator();
* ```
*
* @example Use with custom configuration
* ```ts source="./cfWorkerProvider.examples.ts#CfWorkerJsonSchemaValidator_customConfig"
* const validator = new CfWorkerJsonSchemaValidator({
* draft: '2020-12',
* shortcircuit: false // Report all errors
* });
* ```
*/
declare class CfWorkerJsonSchemaValidator implements jsonSchemaValidator {
private readonly shortcircuit;
/** Caller-supplied draft; when set, the `$schema` check is skipped (caller owns dialect). */
private readonly draft?;
/**
* Create a validator
*
* @param options - Configuration options
* @param options.shortcircuit - If `true`, stop validation after first error (default: `true`)
* @param options.draft - JSON Schema draft version to force for every schema. When set, the
* `$schema` dispatch is skipped. When omitted, the provider dispatches on each schema's
* declared `$schema` (2020-12, 2019-09, draft-07, draft-06; absent means 2020-12) and rejects others.
*/
constructor(options?: {
shortcircuit?: boolean;
draft?: CfWorkerSchemaDraft;
});
/**
* Pick the engine draft for a schema's declared dialect (a caller-forced `{draft}` bypasses
* this — do not second-guess by `$schema`). No `$schema` or 2020-12 → `'2020-12'`; 2019-09 →
* `'2019-09'`; draft-07 or draft-06 → `'7'`; anything else → `Error`.
*/
private _draftFor;
/**
* Create a validator for the given JSON Schema
*
* Unlike AJV, this validator is not cached internally
*
* @param schema - Standard JSON Schema object
* @returns A validator function that validates input data
*/
getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T>;
}
//#endregion
export { CfWorkerSchemaDraft as n, CfWorkerJsonSchemaValidator as t };
//# sourceMappingURL=cfWorkerProvider-doTkZbTr.d.cts.map
@@ -0,0 +1 @@
{"version":3,"file":"infinity.js","sources":["../../../src/icons/infinity.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Infinity\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTIgMTJjLTItMi42Ny00LTQtNi00YTQgNCAwIDEgMCAwIDhjMiAwIDQtMS4zMyA2LTRabTAgMGMyIDIuNjcgNCA0IDYgNGE0IDQgMCAwIDAgMC04Yy0yIDAtNCAxLjMzLTYgNFoiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/infinity\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 Infinity = createLucideIcon('Infinity', [\n [\n 'path',\n {\n d: 'M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z',\n key: '1z0uae',\n },\n ],\n]);\n\nexport default Infinity;\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,CAC5C,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;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 @@
{"version":3,"file":"play-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,217 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var picocolors = require('picocolors');
var jsTokens = require('js-tokens');
var helperValidatorIdentifier = require('@babel/helper-validator-identifier');
function isColorSupported() {
return (typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported
);
}
const compose = (f, g) => v => f(g(v));
function buildDefs(colors) {
return {
keyword: colors.cyan,
capitalized: colors.yellow,
jsxIdentifier: colors.yellow,
punctuator: colors.yellow,
number: colors.magenta,
string: colors.green,
regex: colors.magenta,
comment: colors.gray,
invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
gutter: colors.gray,
marker: compose(colors.red, colors.bold),
message: compose(colors.red, colors.bold),
reset: colors.reset
};
}
const defsOn = buildDefs(picocolors.createColors(true));
const defsOff = buildDefs(picocolors.createColors(false));
function getDefs(enabled) {
return enabled ? defsOn : defsOff;
}
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
const BRACKET = /^[()[\]{}]$/;
let tokenize;
const JSX_TAG = /^[a-z][\w-]*$/i;
const getTokenType = function (token, offset, text) {
if (token.type === "name") {
const tokenValue = token.value;
if (helperValidatorIdentifier.isKeyword(tokenValue) || helperValidatorIdentifier.isStrictReservedWord(tokenValue, true) || sometimesKeywords.has(tokenValue)) {
return "keyword";
}
if (JSX_TAG.test(tokenValue) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
return "jsxIdentifier";
}
const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));
if (firstChar !== firstChar.toLowerCase()) {
return "capitalized";
}
}
if (token.type === "punctuator" && BRACKET.test(token.value)) {
return "bracket";
}
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
return "punctuator";
}
return token.type;
};
tokenize = function* (text) {
let match;
while (match = jsTokens.default.exec(text)) {
const token = jsTokens.matchToToken(match);
yield {
type: getTokenType(token, match.index, text),
value: token.value
};
}
};
function highlight(text) {
if (text === "") return "";
const defs = getDefs(true);
let highlighted = "";
for (const {
type,
value
} of tokenize(text)) {
if (type in defs) {
highlighted += value.split(NEWLINE$1).map(str => defs[type](str)).join("\n");
} else {
highlighted += value;
}
}
return highlighted;
}
let deprecationWarningShown = false;
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
function getMarkerLines(loc, source, opts, startLineBaseZero) {
const startLoc = Object.assign({
column: 0,
line: -1
}, loc.start);
const endLoc = Object.assign({}, startLoc, loc.end);
const {
linesAbove = 2,
linesBelow = 3
} = opts || {};
const startLine = startLoc.line - startLineBaseZero;
const startColumn = startLoc.column;
const endLine = endLoc.line - startLineBaseZero;
const endColumn = endLoc.column;
let start = Math.max(startLine - (linesAbove + 1), 0);
let end = Math.min(source.length, endLine + linesBelow);
if (startLine === -1) {
start = 0;
}
if (endLine === -1) {
end = source.length;
}
const lineDiff = endLine - startLine;
const markerLines = {};
if (lineDiff) {
for (let i = 0; i <= lineDiff; i++) {
const lineNumber = i + startLine;
if (!startColumn) {
markerLines[lineNumber] = true;
} else if (i === 0) {
const sourceLength = source[lineNumber - 1].length;
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
} else if (i === lineDiff) {
markerLines[lineNumber] = [0, endColumn];
} else {
const sourceLength = source[lineNumber - i].length;
markerLines[lineNumber] = [0, sourceLength];
}
}
} else {
if (startColumn === endColumn) {
if (startColumn) {
markerLines[startLine] = [startColumn, 0];
} else {
markerLines[startLine] = true;
}
} else {
markerLines[startLine] = [startColumn, endColumn - startColumn];
}
}
return {
start,
end,
markerLines
};
}
function codeFrameColumns(rawLines, loc, opts = {}) {
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
const startLineBaseZero = (opts.startLine || 1) - 1;
const defs = getDefs(shouldHighlight);
const lines = rawLines.split(NEWLINE);
const {
start,
end,
markerLines
} = getMarkerLines(loc, lines, opts, startLineBaseZero);
const hasColumns = loc.start && typeof loc.start.column === "number";
const numberMaxWidth = String(end + startLineBaseZero).length;
const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
const number = start + 1 + index;
const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
const gutter = ` ${paddedNumber} |`;
const hasMarker = markerLines[number];
const lastMarkerLine = !markerLines[number + 1];
if (hasMarker) {
let markerLine = "";
if (Array.isArray(hasMarker)) {
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
const numberOfMarkers = hasMarker[1] || 1;
markerLine = ["\n ", defs.gutter(gutter.replace(/\d/g, " ")), " ", markerSpacing, defs.marker("^").repeat(numberOfMarkers)].join("");
if (lastMarkerLine && opts.message) {
markerLine += " " + defs.message(opts.message);
}
}
return [defs.marker(">"), defs.gutter(gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
} else {
return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
}
}).join("\n");
if (opts.message && !hasColumns) {
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
}
if (shouldHighlight) {
return defs.reset(frame);
} else {
return frame;
}
}
function index (rawLines, lineNumber, colNumber, opts = {}) {
if (!deprecationWarningShown) {
deprecationWarningShown = true;
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
if (process.emitWarning) {
process.emitWarning(message, "DeprecationWarning");
} else {
const deprecationError = new Error(message);
deprecationError.name = "DeprecationWarning";
console.warn(new Error(message));
}
}
colNumber = Math.max(colNumber, 0);
const location = {
start: {
column: colNumber,
line: lineNumber
}
};
return codeFrameColumns(rawLines, location, opts);
}
exports.codeFrameColumns = codeFrameColumns;
exports.default = index;
exports.highlight = highlight;
//# sourceMappingURL=index.js.map
@@ -0,0 +1,75 @@
let crypto;
crypto = globalThis.crypto; // web browsers
/**
* Creates an array of length `size` of random bytes
* @param size
* @returns Array of random ints (0 to 255)
*/
async function getRandomValues(size) {
return (await crypto).getRandomValues(new Uint8Array(size));
}
/** Generate cryptographically strong random string
* @param size The desired length of the string
* @returns The random string
*/
async function random(size) {
const mask = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
const evenDistCutoff = Math.pow(2, 8) - Math.pow(2, 8) % mask.length;
let result = "";
while (result.length < size) {
const randomBytes = await getRandomValues(size - result.length);
for (const randomByte of randomBytes) {
if (randomByte < evenDistCutoff) {
result += mask[randomByte % mask.length];
}
}
}
return result;
}
/** Generate a PKCE challenge verifier
* @param length Length of the verifier
* @returns A random verifier `length` characters long
*/
async function generateVerifier(length) {
return await random(length);
}
/** Generate a PKCE code challenge from a code verifier
* @param code_verifier
* @returns The base64 url encoded code challenge
*/
export async function generateChallenge(code_verifier) {
const buffer = await (await crypto).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
// Generate base64url string
// btoa is deprecated in Node.js but is used here for web browser compatibility
// (which has no good replacement yet, see also https://github.com/whatwg/html/issues/6811)
return btoa(String.fromCharCode(...new Uint8Array(buffer)))
.replace(/\//g, '_')
.replace(/\+/g, '-')
.replace(/=/g, '');
}
/** Generate a PKCE challenge pair
* @param length Length of the verifer (between 43-128). Defaults to 43.
* @returns PKCE challenge pair
*/
export default async function pkceChallenge(length) {
if (!length)
length = 43;
if (length < 43 || length > 128) {
throw `Expected a length between 43 and 128. Received ${length}.`;
}
const verifier = await generateVerifier(length);
const challenge = await generateChallenge(verifier);
return {
code_verifier: verifier,
code_challenge: challenge,
};
}
/** Verify that a code_verifier produces the expected code challenge
* @param code_verifier
* @param expectedChallenge The code challenge to verify
* @returns True if challenges are equal. False otherwise.
*/
export async function verifyChallenge(code_verifier, expectedChallenge) {
const actualChallenge = await generateChallenge(code_verifier);
return actualChallenge === expectedChallenge;
}
@@ -0,0 +1,50 @@
/**
* @fileoverview Interpolate keys from an object into a string with {{ }} markers.
* @author Jed Fox
*/
"use strict";
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
/**
* Returns a global expression matching placeholders in messages.
* @returns {RegExp} Global regular expression matching placeholders
*/
function getPlaceholderMatcher() {
return /\{\{([^{}]+)\}\}/gu;
}
/**
* Replaces {{ placeholders }} in the message with the provided data.
* Does not replace placeholders not available in the data.
* @param {string} text Original message with potential placeholders
* @param {Record<string, string>} data Map of placeholder name to its value
* @returns {string} Message with replaced placeholders
*/
function interpolate(text, data) {
if (!data) {
return text;
}
const matcher = getPlaceholderMatcher();
// Substitution content for any {{ }} markers.
return text.replace(matcher, (fullMatch, termWithWhitespace) => {
const term = termWithWhitespace.trim();
if (term in data) {
return data[term];
}
// Preserve old behavior: If parameter name not provided, don't replace it.
return fullMatch;
});
}
module.exports = {
getPlaceholderMatcher,
interpolate,
};
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: !0 });
var index = require("./index.cjs");
class EventSourceParserStream extends TransformStream {
constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
let parser;
super({
start(controller) {
parser = index.createParser({
onEvent: (event) => {
controller.enqueue(event);
},
onError(error) {
typeof onError == "function" && onError(error), (onError === "terminate" || error.type === "max-buffer-size-exceeded") && controller.error(error);
},
onRetry,
onComment,
maxBufferSize
});
},
transform(chunk) {
parser.feed(chunk);
}
});
}
}
exports.ParseError = index.ParseError;
exports.EventSourceParserStream = EventSourceParserStream;
//# sourceMappingURL=stream.cjs.map
@@ -0,0 +1 @@
{"version":3,"file":"calendar-1.js","sources":["../../../src/icons/calendar-1.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Calendar1\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTEgMTRoMXY0IiAvPgogIDxwYXRoIGQ9Ik0xNiAydjQiIC8+CiAgPHBhdGggZD0iTTMgMTBoMTgiIC8+CiAgPHBhdGggZD0iTTggMnY0IiAvPgogIDxyZWN0IHg9IjMiIHk9IjQiIHdpZHRoPSIxOCIgaGVpZ2h0PSIxOCIgcng9IjIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/calendar-1\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 Calendar1 = createLucideIcon('Calendar1', [\n ['path', { d: 'M11 14h1v4', key: 'fy54vd' }],\n ['path', { d: 'M16 2v4', key: '4m81vk' }],\n ['path', { d: 'M3 10h18', key: '8toen8' }],\n ['path', { d: 'M8 2v4', key: '1cmpym' }],\n ['rect', { x: '3', y: '4', width: '18', height: '18', rx: '2', key: '12vinp' }],\n]);\n\nexport default Calendar1;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,iBAAiB,WAAa,CAAA,CAAA,CAAA;AAAA,CAAA,CAC9C,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,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,CAAA;AAAA,CAAA,CACzC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACvC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAE,CAAA,CAAA,CAAG,KAAK,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,QAAQ,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_VN _i","2":"_I R","578":"_8D _7G","1602":"e _eI _WM _AG"},C:{"2":"_rL","194":"_cT _LD _RG YB","4292":"ZB _fS cB","16580":"dB _EG _uD"},D:{"2":"_7 _3D","578":"_8D _7G","1602":"e _eI _WM _AG","2049":"_VN _kI _aP","32769":"_XL _wC"},E:{"2":"_KG G _PU _BN _7E _pE","322":"_x ZC _DE SD _hP WD _FD","8452":"_JL"},F:{"2":"_XS","578":"SC _LD _GO","2049":"_yN _h"},G:{"1":"_YG","2":"_7O","322":"_kT _FD"},H:{"2":"1D"},I:{"2":"_P"},J:{"2":"_B"},K:{"2":"_D","2049":"H"},L:{"1":"I"},M:{"194":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"1":"_YF","2":"_hT KB _wE"},Q:{"2":"JE"},R:{"2":"KE"},S:{"2":"LE","194":"ME"}},B:5,C:"WebGPU",D:true};
@@ -0,0 +1,12 @@
import { Parser } from 'acorn'
declare const jsx: (options?: jsx.Options) => (BaseParser: typeof Parser) => typeof Parser;
declare namespace jsx {
interface Options {
allowNamespacedObjects?: boolean;
allowNamespaces?: boolean;
}
}
export = jsx;
@@ -0,0 +1,339 @@
/**
SHA1 (RFC 3174), MD5 (RFC 1321), and RIPEMD160 legacy, weak hash functions.
RFC 2286 only covers HMAC-RIPEMD160 wrapper material and test vectors,
not the base RIPEMD-160 compression spec.
Don't use them in a new protocol. What "weak" means:
- Collisions can be made with 2^18 effort in MD5, 2^60 in SHA1, 2^80 in RIPEMD160.
- No practical pre-image attacks (only theoretical, 2^123.4)
- HMAC seems kinda ok: https://www.rfc-editor.org/rfc/rfc6151
* @module
*/
import { Chi, HashMD, Maj } from './_md.ts';
import { type CHash, clean, createHasher, rotl, type TRet } from './utils.ts';
/** Initial SHA-1 state from RFC 3174 §6.1. */
const SHA1_IV = /* @__PURE__ */ Uint32Array.from([
0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0,
]);
// Reusable 80-word SHA-1 message schedule buffer.
const SHA1_W = /* @__PURE__ */ new Uint32Array(80);
/** Internal SHA1 legacy hash class. */
export class _SHA1 extends HashMD<_SHA1> {
private A = SHA1_IV[0] | 0;
private B = SHA1_IV[1] | 0;
private C = SHA1_IV[2] | 0;
private D = SHA1_IV[3] | 0;
private E = SHA1_IV[4] | 0;
constructor() {
super(64, 20, 8, false);
}
protected get(): [number, number, number, number, number] {
const { A, B, C, D, E } = this;
return [A, B, C, D, E];
}
protected set(A: number, B: number, C: number, D: number, E: number): void {
this.A = A | 0;
this.B = B | 0;
this.C = C | 0;
this.D = D | 0;
this.E = E | 0;
}
protected process(view: DataView, offset: number): void {
for (let i = 0; i < 16; i++, offset += 4) SHA1_W[i] = view.getUint32(offset, false);
for (let i = 16; i < 80; i++)
SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1);
// Compression function main loop, 80 rounds
let { A, B, C, D, E } = this;
for (let i = 0; i < 80; i++) {
let F, K;
if (i < 20) {
F = Chi(B, C, D);
K = 0x5a827999;
} else if (i < 40) {
F = B ^ C ^ D;
K = 0x6ed9eba1;
} else if (i < 60) {
F = Maj(B, C, D);
K = 0x8f1bbcdc;
} else {
F = B ^ C ^ D;
K = 0xca62c1d6;
}
const T = (rotl(A, 5) + F + E + K + SHA1_W[i]) | 0;
E = D;
D = C;
C = rotl(B, 30);
B = A;
A = T;
}
// Add the compressed chunk to the current hash value
A = (A + this.A) | 0;
B = (B + this.B) | 0;
C = (C + this.C) | 0;
D = (D + this.D) | 0;
E = (E + this.E) | 0;
this.set(A, B, C, D, E);
}
protected roundClean(): void {
clean(SHA1_W);
}
destroy(): void {
// HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves
// update()/digest() callable on reused instances.
this.destroyed = true;
this.set(0, 0, 0, 0, 0);
clean(this.buffer);
}
}
/**
* SHA1 (RFC 3174) legacy hash function. It was cryptographically broken.
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with SHA1.
* ```ts
* sha1(new Uint8Array([97, 98, 99]));
* ```
*/
export const sha1: TRet<CHash> = /* @__PURE__ */ createHasher(() => new _SHA1());
/** RFC 1321 `T[i]` uses `floor(2^32 * abs(sin(i)))`; this is the shared `2^32` scale factor. */
const p32 = /* @__PURE__ */ Math.pow(2, 32);
/** RFC 1321 `T[1..64]` table. */
const K = /* @__PURE__ */ Array.from({ length: 64 }, (_, i) =>
Math.floor(p32 * Math.abs(Math.sin(i + 1)))
);
/** MD5 initial state from RFC 1321, stored as 4 u32 words. */
const MD5_IV = /* @__PURE__ */ SHA1_IV.slice(0, 4);
// Reusable 16-word MD5 message block buffer.
const MD5_W = /* @__PURE__ */ new Uint32Array(16);
/** Internal MD5 legacy hash class. */
export class _MD5 extends HashMD<_MD5> {
private A = MD5_IV[0] | 0;
private B = MD5_IV[1] | 0;
private C = MD5_IV[2] | 0;
private D = MD5_IV[3] | 0;
constructor() {
super(64, 16, 8, true);
}
protected get(): [number, number, number, number] {
const { A, B, C, D } = this;
return [A, B, C, D];
}
protected set(A: number, B: number, C: number, D: number): void {
this.A = A | 0;
this.B = B | 0;
this.C = C | 0;
this.D = D | 0;
}
protected process(view: DataView, offset: number): void {
for (let i = 0; i < 16; i++, offset += 4) MD5_W[i] = view.getUint32(offset, true);
// Compression function main loop, 64 rounds
let { A, B, C, D } = this;
for (let i = 0; i < 64; i++) {
let F, g, s;
if (i < 16) {
F = Chi(B, C, D);
g = i;
s = [7, 12, 17, 22];
} else if (i < 32) {
// RFC 1321 round 2 uses G(B,C,D) = (B & D) | (C & ~D), which is `Chi(D, B, C)`.
F = Chi(D, B, C);
g = (5 * i + 1) % 16;
s = [5, 9, 14, 20];
} else if (i < 48) {
F = B ^ C ^ D;
g = (3 * i + 5) % 16;
s = [4, 11, 16, 23];
} else {
F = C ^ (B | ~D);
g = (7 * i) % 16;
s = [6, 10, 15, 21];
}
F = F + A + K[i] + MD5_W[g];
A = D;
D = C;
C = B;
B = B + rotl(F, s[i % 4]);
}
// Add the compressed chunk to the current hash value
A = (A + this.A) | 0;
B = (B + this.B) | 0;
C = (C + this.C) | 0;
D = (D + this.D) | 0;
this.set(A, B, C, D);
}
protected roundClean(): void {
clean(MD5_W);
}
destroy(): void {
// HashMD callers route post-destroy usability through `destroyed`; zeroizing alone still leaves
// update()/digest() callable on reused instances.
this.destroyed = true;
this.set(0, 0, 0, 0);
clean(this.buffer);
}
}
/**
* MD5 (RFC 1321) legacy hash function. It was cryptographically broken.
* MD5 architecture is similar to SHA1, with some differences:
* - Reduced output length: 16 bytes (128 bit) instead of 20
* - 64 rounds, instead of 80
* - Little-endian: could be faster, but will require more code
* - Non-linear index selection: huge speed-up for unroll
* - Per round constants: more memory accesses, additional speed-up for unroll
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with MD5.
* ```ts
* md5(new Uint8Array([97, 98, 99]));
* ```
*/
export const md5: TRet<CHash> = /* @__PURE__ */ createHasher(() => new _MD5());
// RIPEMD-160
// Permutation repeatedly applied to derive the later RIPEMD-160 message-order tables.
const Rho160 = /* @__PURE__ */ Uint8Array.from([
7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
]);
const Id160 = /* @__PURE__ */ (() => Uint8Array.from(new Array(16).fill(0).map((_, i) => i)))();
const Pi160 = /* @__PURE__ */ (() => Id160.map((i) => (9 * i + 5) % 16))();
// Five left/right message-word orderings for the RIPEMD-160 dual-lane rounds.
const idxLR = /* @__PURE__ */ (() => {
const L = [Id160];
const R = [Pi160];
const res = [L, R];
for (let i = 0; i < 4; i++) for (let j of res) j.push(j[i].map((k) => Rho160[k]));
return res;
})();
const idxL = /* @__PURE__ */ (() => idxLR[0])();
const idxR = /* @__PURE__ */ (() => idxLR[1])();
// const [idxL, idxR] = idxLR;
// Base per-group shift table before the left/right message-order permutations are applied.
const shifts160 = /* @__PURE__ */ [
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5],
].map((i) => Uint8Array.from(i));
const shiftsL160 = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts160[i][j]));
const shiftsR160 = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts160[i][j]));
// Five left-lane additive constants for RIPEMD-160.
const Kl160 = /* @__PURE__ */ Uint32Array.from([
0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e,
]);
// Five right-lane additive constants for RIPEMD-160.
const Kr160 = /* @__PURE__ */ Uint32Array.from([
0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000,
]);
// Called `f()` in the spec; valid `group` values are 0..4, and out-of-range
// inputs currently fall through to the group-4 branch.
function ripemd_f(group: number, x: number, y: number, z: number): number {
if (group === 0) return x ^ y ^ z;
if (group === 1) return (x & y) | (~x & z);
if (group === 2) return (x | ~y) ^ z;
if (group === 3) return (x & z) | (y & ~z);
return x ^ (y | ~z);
}
// Reusable 16-word RIPEMD-160 message block buffer.
const BUF_160 = /* @__PURE__ */ new Uint32Array(16);
/**
* Internal RIPEMD-160 legacy hash class.
* RFC 2286 only adds HMAC-RIPEMD160 material, not the core hash specification.
*/
export class _RIPEMD160 extends HashMD<_RIPEMD160> {
private h0 = 0x67452301 | 0;
private h1 = 0xefcdab89 | 0;
private h2 = 0x98badcfe | 0;
private h3 = 0x10325476 | 0;
private h4 = 0xc3d2e1f0 | 0;
constructor() {
super(64, 20, 8, true);
}
protected get(): [number, number, number, number, number] {
const { h0, h1, h2, h3, h4 } = this;
return [h0, h1, h2, h3, h4];
}
protected set(h0: number, h1: number, h2: number, h3: number, h4: number): void {
this.h0 = h0 | 0;
this.h1 = h1 | 0;
this.h2 = h2 | 0;
this.h3 = h3 | 0;
this.h4 = h4 | 0;
}
protected process(view: DataView, offset: number): void {
for (let i = 0; i < 16; i++, offset += 4) BUF_160[i] = view.getUint32(offset, true);
// prettier-ignore
let al = this.h0 | 0, ar = al,
bl = this.h1 | 0, br = bl,
cl = this.h2 | 0, cr = cl,
dl = this.h3 | 0, dr = dl,
el = this.h4 | 0, er = el;
// Instead of iterating 0 to 80, we split it into 5 groups
// And use the groups in constants, functions, etc. Much simpler
for (let group = 0; group < 5; group++) {
const rGroup = 4 - group;
const hbl = Kl160[group], hbr = Kr160[group]; // prettier-ignore
const rl = idxL[group], rr = idxR[group]; // prettier-ignore
const sl = shiftsL160[group], sr = shiftsR160[group]; // prettier-ignore
for (let i = 0; i < 16; i++) {
const tl = (rotl(al + ripemd_f(group, bl, cl, dl) + BUF_160[rl[i]] + hbl, sl[i]) + el) | 0;
al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; // prettier-ignore
}
// 2 loops are 10% faster
for (let i = 0; i < 16; i++) {
const tr = (rotl(ar + ripemd_f(rGroup, br, cr, dr) + BUF_160[rr[i]] + hbr, sr[i]) + er) | 0;
ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; // prettier-ignore
}
}
// Add the compressed chunk to the current hash value
// Final recombination cross-adds the left/right lane accumulators into the next h0..h4 order.
this.set(
(this.h1 + cl + dr) | 0,
(this.h2 + dl + er) | 0,
(this.h3 + el + ar) | 0,
(this.h4 + al + br) | 0,
(this.h0 + bl + cr) | 0
);
}
protected roundClean(): void {
clean(BUF_160);
}
destroy(): void {
this.destroyed = true;
clean(this.buffer);
this.set(0, 0, 0, 0, 0);
}
}
/**
* RIPEMD-160 - a legacy hash function from 1990s.
* RFC 2286 only covers HMAC-RIPEMD160 test material; the links below point
* at the base RIPEMD-160 references.
* * {@link https://homes.esat.kuleuven.be/~bosselae/ripemd160.html}
* * {@link https://homes.esat.kuleuven.be/~bosselae/ripemd160/pdf/AB-9601/AB-9601.pdf}
* @param msg - message bytes to hash
* @returns Digest bytes.
* @example
* Hash a message with RIPEMD-160.
* ```ts
* ripemd160(new Uint8Array([97, 98, 99]));
* ```
*/
export const ripemd160: TRet<CHash> = /* @__PURE__ */ createHasher(() => new _RIPEMD160());
@@ -0,0 +1,23 @@
# abbrev-js
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
Usage:
var abbrev = require("abbrev");
abbrev("foo", "fool", "folding", "flop");
// returns:
{ fl: 'flop'
, flo: 'flop'
, flop: 'flop'
, fol: 'folding'
, fold: 'folding'
, foldi: 'folding'
, foldin: 'folding'
, folding: 'folding'
, foo: 'foo'
, fool: 'fool'
}
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
@@ -0,0 +1,59 @@
import { expect, test } from "vitest";
import * as z from "zod/v4";
test("safeExtend chaining preserves and overrides properties", () => {
const schema1 = z.object({
email: z.string(),
});
const schema2 = schema1.safeExtend({
email: schema1.shape.email.check(z.email()),
});
const schema3 = schema2.safeExtend({
email: schema2.shape.email.or(z.literal("")),
});
schema3.parse({ email: "test@example.com" });
});
test("extend with constructor field in shape", () => {
const baseSchema = z.object({
name: z.string(),
});
const extendedSchema = baseSchema.extend({
constructor: z.string(),
age: z.number(),
});
const result = extendedSchema.parse({
name: "John",
constructor: "Person",
age: 30,
});
expect(result).toEqual({
name: "John",
constructor: "Person",
age: 30,
});
const testCases = [
{ name: "Test", constructor: 123, age: 25 },
{ name: "Test", constructor: null, age: 25 },
{ name: "Test", constructor: true, age: 25 },
{ name: "Test", constructor: {}, age: 25 },
];
for (const testCase of testCases) {
const anyConstructorSchema = baseSchema.extend({
constructor: z.any(),
age: z.number(),
});
expect(() => anyConstructorSchema.parse(testCase)).not.toThrow();
const parsed = anyConstructorSchema.parse(testCase);
expect(parsed).toEqual(testCase);
}
});
@@ -0,0 +1,70 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
function isEmptyExport(node) {
return (node.type === utils_1.AST_NODE_TYPES.ExportNamedDeclaration &&
node.specifiers.length === 0 &&
!node.declaration);
}
const exportOrImportNodeTypes = new Set([
utils_1.AST_NODE_TYPES.ExportAllDeclaration,
utils_1.AST_NODE_TYPES.ExportDefaultDeclaration,
utils_1.AST_NODE_TYPES.ExportNamedDeclaration,
utils_1.AST_NODE_TYPES.ExportSpecifier,
utils_1.AST_NODE_TYPES.ImportDeclaration,
utils_1.AST_NODE_TYPES.TSExportAssignment,
utils_1.AST_NODE_TYPES.TSImportEqualsDeclaration,
]);
exports.default = (0, util_1.createRule)({
name: 'no-useless-empty-export',
meta: {
type: 'suggestion',
docs: {
description: "Disallow empty exports that don't change anything in a module file",
},
fixable: 'code',
hasSuggestions: false,
messages: {
uselessExport: 'Empty export does nothing and can be removed.',
},
schema: [],
},
defaultOptions: [],
create(context) {
// In a definition file, export {} is necessary to make the module properly
// encapsulated, even when there are other exports
// https://github.com/typescript-eslint/typescript-eslint/issues/4975
if ((0, util_1.isDefinitionFile)(context.filename)) {
return {};
}
function checkNode(node) {
if (!Array.isArray(node.body)) {
return;
}
const emptyExports = [];
let foundOtherExport = false;
for (const statement of node.body) {
if (isEmptyExport(statement)) {
emptyExports.push(statement);
}
else if (exportOrImportNodeTypes.has(statement.type)) {
foundOtherExport = true;
}
}
if (foundOtherExport) {
for (const emptyExport of emptyExports) {
context.report({
node: emptyExport,
messageId: 'uselessExport',
fix: fixer => fixer.remove(emptyExport),
});
}
}
}
return {
Program: checkNode,
TSModuleDeclaration: checkNode,
};
},
});
@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const codegen_1 = require("../../compile/codegen");
const util_1 = require("../../compile/util");
const error = {
message: "property name must be valid",
params: ({ params }) => (0, codegen_1._) `{propertyName: ${params.propertyName}}`,
};
const def = {
keyword: "propertyNames",
type: "object",
schemaType: ["object", "boolean"],
error,
code(cxt) {
const { gen, schema, data, it } = cxt;
if ((0, util_1.alwaysValidSchema)(it, schema))
return;
const valid = gen.name("valid");
gen.forIn("key", data, (key) => {
cxt.setParams({ propertyName: key });
cxt.subschema({
keyword: "propertyNames",
data: key,
dataTypes: ["string"],
propertyName: key,
compositeRule: true,
}, valid);
gen.if((0, codegen_1.not)(valid), () => {
cxt.error(true);
if (!it.allErrors)
gen.break();
});
});
cxt.ok(valid);
},
};
exports.default = def;
//# sourceMappingURL=propertyNames.js.map
@@ -0,0 +1 @@
{"version":3,"file":"atom.cjs","sources":["../../src/atom.ts"],"sourcesContent":["import { ReactiveFlags, createReactiveSystem } from './alien'\n\nimport type { ReactiveNode } from './alien'\nimport type {\n Atom,\n AtomOptions,\n Observer,\n ReadonlyAtom,\n Subscription,\n} from './types'\n\nexport function toObserver<T>(\n nextHandler?: Observer<T> | ((value: T) => void),\n errorHandler?: (error: any) => void,\n completionHandler?: () => void,\n): Observer<T> {\n const isObserver = typeof nextHandler === 'object'\n const self = isObserver ? nextHandler : undefined\n\n return {\n next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),\n error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),\n complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(\n self,\n ),\n }\n}\n\ninterface InternalAtom<T> extends ReactiveNode {\n _snapshot: T\n _update: (getValue?: T | ((snapshot: T) => T)) => boolean\n get: () => T\n subscribe: (observerOrFn: Observer<T> | ((value: T) => void)) => Subscription\n}\n\nconst queuedEffects: Array<Effect | undefined> = []\nlet cycle = 0\nconst { link, unlink, propagate, checkDirty, shallowPropagate } =\n createReactiveSystem({\n update(atom: InternalAtom<any>): boolean {\n return atom._update()\n },\n // eslint-disable-next-line no-shadow\n notify(effect: Effect): void {\n queuedEffects[queuedEffectsLength++] = effect\n effect.flags &= ~ReactiveFlags.Watching\n },\n unwatched(atom: InternalAtom<any>): void {\n if (atom.depsTail !== undefined) {\n atom.depsTail = undefined\n atom.flags = ReactiveFlags.Mutable | ReactiveFlags.Dirty\n purgeDeps(atom)\n }\n },\n })\n\nlet notifyIndex = 0\nlet queuedEffectsLength = 0\nlet activeSub: ReactiveNode | undefined\nlet batchDepth = 0\n\nexport function batch(fn: () => void) {\n try {\n ++batchDepth\n fn()\n } finally {\n if (!--batchDepth) {\n flush()\n }\n }\n}\n\nfunction purgeDeps(sub: ReactiveNode) {\n const depsTail = sub.depsTail\n let dep = depsTail !== undefined ? depsTail.nextDep : sub.deps\n while (dep !== undefined) {\n dep = unlink(dep, sub)\n }\n}\n\nexport function flush(): void {\n if (batchDepth > 0) {\n return\n }\n while (notifyIndex < queuedEffectsLength) {\n // eslint-disable-next-line no-shadow\n const effect = queuedEffects[notifyIndex]!\n queuedEffects[notifyIndex++] = undefined\n effect.notify()\n }\n notifyIndex = 0\n queuedEffectsLength = 0\n}\n\ntype AsyncAtomState<TData, TError = unknown> =\n | { status: 'pending' }\n | { status: 'done'; data: TData }\n | { status: 'error'; error: TError }\n\nexport function createAsyncAtom<T>(\n getValue: () => Promise<T>,\n options?: AtomOptions<AsyncAtomState<T>>,\n): ReadonlyAtom<AsyncAtomState<T>> {\n const ref: { current?: InternalAtom<AsyncAtomState<T>> } = {}\n const atom = createAtom<AsyncAtomState<T>>(() => {\n getValue().then(\n (data) => {\n const internalAtom = ref.current!\n if (internalAtom._update({ status: 'done', data })) {\n const subs = internalAtom.subs\n if (subs !== undefined) {\n propagate(subs)\n shallowPropagate(subs)\n flush()\n }\n }\n },\n (error) => {\n const internalAtom = ref.current!\n if (internalAtom._update({ status: 'error', error })) {\n const subs = internalAtom.subs\n if (subs !== undefined) {\n propagate(subs)\n shallowPropagate(subs)\n flush()\n }\n }\n },\n )\n\n return { status: 'pending' }\n }, options)\n ref.current = atom as unknown as InternalAtom<AsyncAtomState<T>>\n\n return atom\n}\n\nexport function createAtom<T>(\n getValue: (prev?: NoInfer<T>) => T,\n options?: AtomOptions<T>,\n): ReadonlyAtom<T>\nexport function createAtom<T>(\n initialValue: T,\n options?: AtomOptions<T>,\n): Atom<T>\nexport function createAtom<T>(\n valueOrFn: T | ((prev?: T) => T),\n options?: AtomOptions<T>,\n): Atom<T> | ReadonlyAtom<T> {\n const isComputed = typeof valueOrFn === 'function'\n const getter = valueOrFn as (prev?: T) => T\n\n // Create plain object atom\n const atom: InternalAtom<T> = {\n _snapshot: isComputed ? undefined! : valueOrFn,\n\n subs: undefined,\n subsTail: undefined,\n deps: undefined,\n depsTail: undefined,\n flags: isComputed ? ReactiveFlags.None : ReactiveFlags.Mutable,\n\n get(): T {\n if (activeSub !== undefined) {\n link(atom, activeSub, cycle)\n }\n return atom._snapshot\n },\n\n subscribe(observerOrFn: Observer<T> | ((value: T) => void)) {\n const obs = toObserver(observerOrFn)\n const observed = { current: false }\n const e = effect(() => {\n atom.get()\n if (!observed.current) {\n observed.current = true\n } else {\n obs.next?.(atomLine truncated
@@ -0,0 +1 @@
{"version":3,"names":["circleSet","Set","depth","deepClone","value","cache","allowCircle","has","get","clear","Error","add","cloned","Array","isArray","length","set","i","keys","Object","key","delete","_default","Map","_","structuredClone"],"sources":["../../../src/transformation/util/clone-deep.ts"],"sourcesContent":["const circleSet = new Set();\nlet depth = 0;\n// https://github.com/babel/babel/pull/14583#discussion_r882828856\nfunction deepClone(\n value: any,\n cache: Map<any, any>,\n allowCircle: boolean,\n): any {\n if (value !== null) {\n if (allowCircle) {\n if (cache.has(value)) return cache.get(value);\n } else if (++depth > 250) {\n if (circleSet.has(value)) {\n depth = 0;\n circleSet.clear();\n throw new Error(\"Babel-deepClone: Cycles are not allowed in AST\");\n }\n circleSet.add(value);\n }\n let cloned: any;\n if (Array.isArray(value)) {\n cloned = new Array(value.length);\n if (allowCircle) cache.set(value, cloned);\n for (let i = 0; i < value.length; i++) {\n cloned[i] =\n typeof value[i] !== \"object\"\n ? value[i]\n : deepClone(value[i], cache, allowCircle);\n }\n } else {\n cloned = {};\n if (allowCircle) cache.set(value, cloned);\n const keys = Object.keys(value);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n cloned[key] =\n typeof value[key] !== \"object\"\n ? value[key]\n : deepClone(\n value[key],\n cache,\n allowCircle ||\n key === \"leadingComments\" ||\n key === \"innerComments\" ||\n key === \"trailingComments\" ||\n key === \"extra\",\n );\n }\n }\n if (!allowCircle) {\n if (depth-- > 250) circleSet.delete(value);\n }\n return cloned;\n }\n return value;\n}\n\nexport default function <T>(value: T): T {\n if (typeof value !== \"object\") return value;\n\n if (process.env.BABEL_8_BREAKING) {\n if (!process.env.IS_PUBLISH && depth > 0) {\n throw new Error(\"depth > 0\");\n }\n return deepClone(value, new Map(), false);\n } else {\n try {\n return deepClone(value, new Map(), true);\n } catch (_) {\n return structuredClone(value);\n }\n }\n}\n"],"mappings":";;;;;;AAAA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;AAC3B,IAAIC,KAAK,GAAG,CAAC;AAEb,SAASC,SAASA,CAChBC,KAAU,EACVC,KAAoB,EACpBC,WAAoB,EACf;EACL,IAAIF,KAAK,KAAK,IAAI,EAAE;IAClB,IAAIE,WAAW,EAAE;MACf,IAAID,KAAK,CAACE,GAAG,CAACH,KAAK,CAAC,EAAE,OAAOC,KAAK,CAACG,GAAG,CAACJ,KAAK,CAAC;IAC/C,CAAC,MAAM,IAAI,EAAEF,KAAK,GAAG,GAAG,EAAE;MACxB,IAAIF,SAAS,CAACO,GAAG,CAACH,KAAK,CAAC,EAAE;QACxBF,KAAK,GAAG,CAAC;QACTF,SAAS,CAACS,KAAK,CAAC,CAAC;QACjB,MAAM,IAAIC,KAAK,CAAC,gDAAgD,CAAC;MACnE;MACAV,SAAS,CAACW,GAAG,CAACP,KAAK,CAAC;IACtB;IACA,IAAIQ,MAAW;IACf,IAAIC,KAAK,CAACC,OAAO,CAACV,KAAK,CAAC,EAAE;MACxBQ,MAAM,GAAG,IAAIC,KAAK,CAACT,KAAK,CAACW,MAAM,CAAC;MAChC,IAAIT,WAAW,EAAED,KAAK,CAACW,GAAG,CAACZ,KAAK,EAAEQ,MAAM,CAAC;MACzC,KAAK,IAAIK,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGb,KAAK,CAACW,MAAM,EAAEE,CAAC,EAAE,EAAE;QACrCL,MAAM,CAACK,CAAC,CAAC,GACP,OAAOb,KAAK,CAACa,CAAC,CAAC,KAAK,QAAQ,GACxBb,KAAK,CAACa,CAAC,CAAC,GACRd,SAAS,CAACC,KAAK,CAACa,CAAC,CAAC,EAAEZ,KAAK,EAAEC,WAAW,CAAC;MAC/C;IACF,CAAC,MAAM;MACLM,MAAM,GAAG,CAAC,CAAC;MACX,IAAIN,WAAW,EAAED,KAAK,CAACW,GAAG,CAACZ,KAAK,EAAEQ,MAAM,CAAC;MACzC,MAAMM,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACd,KAAK,CAAC;MAC/B,KAAK,IAAIa,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGC,IAAI,CAACH,MAAM,EAAEE,CAAC,EAAE,EAAE;QACpC,MAAMG,GAAG,GAAGF,IAAI,CAACD,CAAC,CAAC;QACnBL,MAAM,CAACQ,GAAG,CAAC,GACT,OAAOhB,KAAK,CAACgB,GAAG,CAAC,KAAK,QAAQ,GAC1BhB,KAAK,CAACgB,GAAG,CAAC,GACVjB,SAAS,CACPC,KAAK,CAACgB,GAAG,CAAC,EACVf,KAAK,EACLC,WAAW,IACTc,GAAG,KAAK,iBAAiB,IACzBA,GAAG,KAAK,eAAe,IACvBA,GAAG,KAAK,kBAAkB,IAC1BA,GAAG,KAAK,OACZ,CAAC;MACT;IACF;IACA,IAAI,CAACd,WAAW,EAAE;MAChB,IAAIJ,KAAK,EAAE,GAAG,GAAG,EAAEF,SAAS,CAACqB,MAAM,CAACjB,KAAK,CAAC;IAC5C;IACA,OAAOQ,MAAM;EACf;EACA,OAAOR,KAAK;AACd;AAEe,SAAAkB,SAAalB,KAAQ,EAAK;EACvC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAOA,KAAK;EAQzC,IAAI;IACF,OAAOD,SAAS,CAACC,KAAK,EAAE,IAAImB,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC;EAC1C,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,OAAOC,eAAe,CAACrB,KAAK,CAAC;EAC/B;AAEJ;AAAC","ignoreList":[]}
@@ -0,0 +1,3 @@
declare const URLPlugin: any;
export default URLPlugin;
//# sourceMappingURL=url.d.ts.map
@@ -0,0 +1,83 @@
/**
* Cryptographic key import functions
*
* @module
*/
import type * as types from '../types.d.ts';
/** Key Import Function options. */
export interface KeyImportOptions {
/**
* The value to use as {@link !SubtleCrypto.importKey} `extractable` argument. Default is false for
* private keys, true otherwise.
*/
extractable?: boolean;
}
/**
* Imports a PEM-encoded SPKI string as a {@link !CryptoKey}.
*
* > [!NOTE]\
* > The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
* > {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
* > (1.2.840.113549.1.1.1) instead for all RSA algorithms.
*
* This function is exported (as a named export) from the main `'jose'` module entry point as well
* as from its subpath export `'jose/key/import'`.
*
* @param spki PEM-encoded SPKI string
* @param alg JSON Web Algorithm identifier to be used with the imported key. See
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
*/
export declare function importSPKI(spki: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>;
/**
* Imports the SPKI from an X.509 string certificate as a {@link !CryptoKey}.
*
* > [!NOTE]\
* > The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
* > {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
* > (1.2.840.113549.1.1.1) instead for all RSA algorithms.
*
* This function is exported (as a named export) from the main `'jose'` module entry point as well
* as from its subpath export `'jose/key/import'`.
*
* @param x509 X.509 certificate string
* @param alg JSON Web Algorithm identifier to be used with the imported key. See
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
*/
export declare function importX509(x509: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>;
/**
* Imports a PEM-encoded PKCS#8 string as a {@link !CryptoKey}.
*
* > [!NOTE]\
* > The OID id-RSASSA-PSS (1.2.840.113549.1.1.10) is not supported in
* > {@link https://w3c.github.io/webcrypto/ Web Cryptography API}, use the OID rsaEncryption
* > (1.2.840.113549.1.1.1) instead for all RSA algorithms.
*
* This function is exported (as a named export) from the main `'jose'` module entry point as well
* as from its subpath export `'jose/key/import'`.
*
* @param pkcs8 PEM-encoded PKCS#8 string
* @param alg JSON Web Algorithm identifier to be used with the imported key. See
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
*/
export declare function importPKCS8(pkcs8: string, alg: string, options?: KeyImportOptions): Promise<types.CryptoKey>;
/**
* Imports a JWK to a {@link !CryptoKey}. Either the JWK "alg" (Algorithm) Parameter, or the optional
* "alg" argument, must be present for asymmetric JSON Web Key imports.
*
* > [!NOTE]\
* > The JSON Web Key parameters "use", "key_ops", and "ext" are also used in the {@link !CryptoKey}
* > import process.
*
* > [!NOTE]\
* > Symmetric JSON Web Keys (i.e. `kty: "oct"`) yield back an {@link !Uint8Array} instead of a
* > {@link !CryptoKey}.
*
* This function is exported (as a named export) from the main `'jose'` module entry point as well
* as from its subpath export `'jose/key/import'`.
*
* @param jwk JSON Web Key.
* @param alg JSON Web Algorithm identifier to be used with the imported key. Default is the "alg"
* property on the JWK. See
* {@link https://github.com/panva/jose/issues/210 Algorithm Key Requirements}.
*/
export declare function importJWK(jwk: types.JWK, alg?: string, options?: KeyImportOptions): Promise<types.CryptoKey | Uint8Array>;
@@ -0,0 +1,158 @@
"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 tsutils = __importStar(require("ts-api-utils"));
const ts_api_utils_1 = require("ts-api-utils");
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
const promiseUtils_1 = require("../util/promiseUtils");
exports.default = (0, util_1.createRule)({
name: 'only-throw-error',
meta: {
type: 'problem',
docs: {
description: 'Disallow throwing non-`Error` values as exceptions',
extendsBaseRule: 'no-throw-literal',
recommended: 'recommended',
requiresTypeChecking: true,
},
messages: {
object: 'Expected an error object to be thrown.',
undef: 'Do not throw undefined.',
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
allow: {
...util_1.typeOrValueSpecifiersSchema,
description: 'Type specifiers that can be thrown.',
},
allowRethrowing: {
type: 'boolean',
description: 'Whether to allow rethrowing caught values that are not `Error` objects.',
},
allowThrowingAny: {
type: 'boolean',
description: 'Whether to always allow throwing values typed as `any`.',
},
allowThrowingUnknown: {
type: 'boolean',
description: 'Whether to always allow throwing values typed as `unknown`.',
},
},
},
],
},
defaultOptions: [
{
allow: [],
allowRethrowing: true,
allowThrowingAny: true,
allowThrowingUnknown: true,
},
],
create(context, [options]) {
const services = (0, util_1.getParserServices)(context);
const allow = options.allow;
function isRethrownError(node) {
if (node.type !== utils_1.AST_NODE_TYPES.Identifier) {
return false;
}
const scope = context.sourceCode.getScope(node);
const smVariable = (0, util_1.nullThrows)((0, util_1.findVariable)(scope, node), `Variable ${node.name} should exist in scope manager`);
const variableDefinitions = smVariable.defs.filter(def => def.isVariableDefinition);
if (variableDefinitions.length !== 1) {
return false;
}
const def = smVariable.defs[0];
// try { /* ... */ } catch (x) { throw x; }
if (def.node.type === utils_1.AST_NODE_TYPES.CatchClause) {
return true;
}
// promise.catch(x => { throw x; })
// promise.then(onFulfilled, x => { throw x; })
if (def.node.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression &&
def.node.params.length >= 1 &&
def.node.params[0] === def.name &&
def.node.parent.type === utils_1.AST_NODE_TYPES.CallExpression) {
const callExpression = def.node.parent;
const parsedPromiseHandlingCall = (0, promiseUtils_1.parseCatchCall)(callExpression, context) ??
(0, promiseUtils_1.parseThenCall)(callExpression, context);
if (parsedPromiseHandlingCall != null) {
const { object, onRejected } = parsedPromiseHandlingCall;
if (onRejected === def.node) {
const tsObjectNode = services.esTreeNodeToTSNodeMap.get(object);
// make sure we're actually dealing with a promise
if ((0, ts_api_utils_1.isThenableType)(services.program.getTypeChecker(), tsObjectNode)) {
return true;
}
}
}
}
return false;
}
function checkThrowArgument(node) {
if (options.allowRethrowing && isRethrownError(node)) {
return;
}
const type = services.getTypeAtLocation(node);
if ((0, util_1.typeMatchesSomeSpecifier)(type, allow, services.program)) {
return;
}
if (tsutils.isTypeFlagSet(type, ts.TypeFlags.Undefined)) {
context.report({ node, messageId: 'undef' });
return;
}
if (options.allowThrowingAny && (0, util_1.isTypeAnyType)(type)) {
return;
}
if (options.allowThrowingUnknown && (0, util_1.isTypeUnknownType)(type)) {
return;
}
if ((0, util_1.isErrorLike)(services.program, type)) {
return;
}
context.report({ node, messageId: 'object' });
}
return {
ThrowStatement(node) {
checkThrowArgument(node.argument);
},
};
},
});
@@ -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 BluetoothOff = createLucideIcon("BluetoothOff", [
["path", { d: "m17 17-5 5V12l-5 5", key: "v5aci6" }],
["path", { d: "m2 2 20 20", key: "1ooewy" }],
["path", { d: "M14.5 9.5 17 7l-5-5v4.5", key: "1kddfz" }]
]);
export { BluetoothOff as default };
//# sourceMappingURL=bluetooth-off.js.map
@@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../src/index.ts", "../src/switch.tsx"],
"sourcesContent": ["'use client';\nexport {\n createSwitchScope,\n //\n Switch,\n SwitchThumb,\n //\n Root,\n Thumb,\n} from './switch';\nexport type { SwitchProps, SwitchThumbProps } from './switch';\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Switch\n * -----------------------------------------------------------------------------------------------*/\n\nconst SWITCH_NAME = 'Switch';\n\ntype ScopedProps<P> = P & { __scopeSwitch?: Scope };\nconst [createSwitchContext, createSwitchScope] = createContextScope(SWITCH_NAME);\n\ntype SwitchContextValue = { checked: boolean; disabled?: boolean };\nconst [SwitchProvider, useSwitchContext] = createSwitchContext<SwitchContextValue>(SWITCH_NAME);\n\ntype SwitchElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface SwitchProps extends PrimitiveButtonProps {\n checked?: boolean;\n defaultChecked?: boolean;\n required?: boolean;\n onCheckedChange?(checked: boolean): void;\n}\n\nconst Switch = React.forwardRef<SwitchElement, SwitchProps>(\n (props: ScopedProps<SwitchProps>, forwardedRef) => {\n const {\n __scopeSwitch,\n name,\n checked: checkedProp,\n defaultChecked,\n required,\n disabled,\n value = 'on',\n onCheckedChange,\n form,\n ...switchProps\n } = props;\n const [button, setButton] = React.useState<HTMLButtonElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));\n const hasConsumerStoppedPropagationRef = React.useRef(false);\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const isFormControl = button ? form || !!button.closest('form') : true;\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked ?? false,\n onChange: onCheckedChange,\n caller: SWITCH_NAME,\n });\n\n return (\n <SwitchProvider scope={__scopeSwitch} checked={checked} disabled={disabled}>\n <Primitive.button\n type=\"button\"\n role=\"switch\"\n aria-checked={checked}\n aria-required={required}\n data-state={getState(checked)}\n data-disabled={disabled ? '' : undefined}\n disabled={disabled}\n value={value}\n {...switchProps}\n ref={composedRefs}\n onClick={composeEventHandlers(props.onClick, (event) => {\n setChecked((prevChecked) => !prevChecked);\n if (isFormControl) {\n hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n // if switch is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect switch updates.\n if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n }\n })}\n />\n {isFormControl && (\n <SwitchBubbleInput\n control={button}\n bubbles={!hasConsumerStoppedPropagationRef.current}\n name={name}\n value={value}\n checked={checked}\n required={required}\n disabled={disabled}\n form={form}\n // We transform because the input is absolutely positioned but we have\n // rendered it **after** the button. This pulls it back to sit on top\n // of the button.\n style={{ transform: 'translateX(-100%)' }}\n />\n )}\n </SwitchProvider>\n );\n }\n);\n\nSwitch.displayName = SWITCH_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SwitchThumb\n * -----------------------------------------------------------------------------------------------*/\n\nconst THUMB_NAME = 'SwitchThumb';\n\ntype SwitchThumbElement = React.ComponentRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\ninterface SwitchThumbProps extends PrimitiveSpanProps {}\n\nconst SwitchThumb = React.forwardRef<SwitchThumbElement, SwitchThumbProps>(\n (props: ScopedProps<SwitchThumbProps>, forwardedRef) => {\n Line truncated
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,uBAAqC;AACrC,gCAAgC;AAChC,2BAAmC;AACnC,0CAAqC;AACrC,gCAA4B;AAC5B,4BAAwB;AACxB,6BAA0B;AAoDpB;AA5CN,IAAM,cAAc;AAGpB,IAAM,CAAC,qBAAqB,iBAAiB,QAAI,yCAAmB,WAAW;AAG/E,IAAM,CAAC,gBAAgB,gBAAgB,IAAI,oBAAwC,WAAW;AAW9F,IAAM,SAAe;AAAA,EACnB,CAAC,OAAiC,iBAAiB;AACjD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACL,IAAI;AACJ,UAAM,CAAC,QAAQ,SAAS,IAAU,eAAmC,IAAI;AACzE,UAAM,mBAAe,2CAAgB,cAAc,CAAC,SAAS,UAAU,IAAI,CAAC;AAC5E,UAAM,mCAAyC,aAAO,KAAK;AAE3D,UAAM,gBAAgB,SAAS,QAAQ,CAAC,CAAC,OAAO,QAAQ,MAAM,IAAI;AAClE,UAAM,CAAC,SAAS,UAAU,QAAI,0DAAqB;AAAA,MACjD,MAAM;AAAA,MACN,aAAa,kBAAkB;AAAA,MAC/B,UAAU;AAAA,MACV,QAAQ;AAAA,IACV,CAAC;AAED,WACE,6CAAC,kBAAe,OAAO,eAAe,SAAkB,UACtD;AAAA;AAAA,QAAC,iCAAU;AAAA,QAAV;AAAA,UACC,MAAK;AAAA,UACL,MAAK;AAAA,UACL,gBAAc;AAAA,UACd,iBAAe;AAAA,UACf,cAAY,SAAS,OAAO;AAAA,UAC5B,iBAAe,WAAW,KAAK;AAAA,UAC/B;AAAA,UACA;AAAA,UACC,GAAG;AAAA,UACJ,KAAK;AAAA,UACL,aAAS,uCAAqB,MAAM,SAAS,CAAC,UAAU;AACtD,uBAAW,CAAC,gBAAgB,CAAC,WAAW;AACxC,gBAAI,eAAe;AACjB,+CAAiC,UAAU,MAAM,qBAAqB;AAItE,kBAAI,CAAC,iCAAiC,QAAS,OAAM,gBAAgB;AAAA,YACvE;AAAA,UACF,CAAC;AAAA;AAAA,MACH;AAAA,MACC,iBACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAS;AAAA,UACT,SAAS,CAAC,iCAAiC;AAAA,UAC3C;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UAIA,OAAO,EAAE,WAAW,oBAAoB;AAAA;AAAA,MAC1C;AAAA,OAEJ;AAAA,EAEJ;AACF;AAEA,OAAO,cAAc;AAMrB,IAAM,aAAa;AAMnB,IAAM,cAAoB;AAAA,EACxB,CAAC,OAAsC,iBAAiB;AACtD,UAAM,EAAE,eAAe,GAAG,WAAW,IAAI;AACzC,UAAM,UAAU,iBAAiB,YAAY,aAAa;AAC1D,WACE;AAAA,MAAC,iCAAU;AAAA,MAAV;AAAA,QACC,cAAY,SAAS,QAAQ,OAAO;AAAA,QACpC,iBAAe,QAAQ,WAAW,KAAK;AAAA,QACtC,GAAG;AAAA,QACJ,KAAK;AAAA;AAAA,IACP;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;AAM1B,IAAM,oBAAoB;AAS1B,IAAM,oBAA0B;AAAA,EAC9B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,GAAG;AAAA,EACL,GACA,iBACG;AACH,UAAM,MAAY,aAAyB,IAAI;AAC/C,UAAM,mBAAe,2CAAgB,KAAK,YAAY;AACtD,UAAM,kBAAc,uCAAY,OAAO;AACvC,UAAM,kBAAc,+BAAQ,OAAO;AAGnC,IAAM,gBAAU,MAAM;AACpB,YAAM,QAAQ,IAAI;AAClB,UAAI,CAAC,MAAO;AAEZ,YAAM,aAAa,OAAO,iBAAiB;AAC3C,YAAM,aAAa,OAAO;AAAA,QACxB;AAAA,QACA;AAAA,MACF;AACA,YAAM,aAAa,WAAW;AAC9B,UAAI,gBAAgB,WAAW,YAAY;AACzC,cAAM,QAAQ,IAAI,MAAM,SAAS,EAAE,QAAQ,CAAC;AAC5C,mBAAW,KAAK,OAAO,OAAO;AAC9B,cAAM,cAAc,KAAK;AAAA,MAC3B;AAAA,IACF,GAAG,CAAC,aAAa,SAAS,OAAO,CAAC;AAElC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,eAAW;AAAA,QACX,gBAAgB;AAAA,QACf,GAAG;AAAA,QACJ,UAAU;AAAA,QACV,KAAK;AAAA,QACL,OAAO;AAAA,UACL,GAAG,MAAM;AAAA,UACT,GAAG;AAAA,UACH,UAAU;AAAA,UACV,eAAe;AAAA,UACf,SAAS;AAAA,UACT,QAAQ;AAAA,QACV;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,kBAAkB,cAAc;AAIhC,SAAS,SAAS,SAAkB;AAClC,SAAO,UAAU,YAAY;AAC/B;AAEA,IAAM,OAAO;AACb,IAAM,QAAQ;",
"names": []
}
@@ -0,0 +1 @@
{"version":3,"file":"warn-method.d.ts","sourceRoot":"","sources":["../../src/warn-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,wBAAwB;AACxB,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;IAChE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAA;IACzE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAA;CAC5C,CAAA;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,GAAG,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG;IACvD,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;CACtD,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAA;AAEvC,eAAO,MAAM,UAAU,GACrB,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,SAAS,MAAM,GAAG,KAAK,EACvB,OAAM,QAAa,SA2BpB,CAAA"}
@@ -0,0 +1,40 @@
# @jridgewell/resolve-uri
> Resolve a URI relative to an optional base URI
Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths.
## Installation
```sh
npm install @jridgewell/resolve-uri
```
## Usage
```typescript
function resolve(input: string, base?: string): string;
```
```js
import resolve from '@jridgewell/resolve-uri';
resolve('foo', 'https://example.com'); // => 'https://example.com/foo'
```
| Input | Base | Resolution | Explanation |
|-----------------------|-------------------------|--------------------------------|--------------------------------------------------------------|
| `https://example.com` | _any_ | `https://example.com/` | Input is normalized only |
| `//example.com` | `https://base.com/` | `https://example.com/` | Input inherits the base's protocol |
| `//example.com` | _rest_ | `//example.com/` | Input is normalized only |
| `/example` | `https://base.com/` | `https://base.com/example` | Input inherits the base's origin |
| `/example` | `//base.com/` | `//base.com/example` | Input inherits the base's host and remains protocol relative |
| `/example` | _rest_ | `/example` | Input is normalized only |
| `example` | `https://base.com/dir/` | `https://base.com/dir/example` | Input is joined with the base |
| `example` | `https://base.com/file` | `https://base.com/example` | Input is joined with the base without its file |
| `example` | `//base.com/dir/` | `//base.com/dir/example` | Input is joined with the base's last directory |
| `example` | `//base.com/file` | `//base.com/example` | Input is joined with the base without its file |
| `example` | `/base/dir/` | `/base/dir/example` | Input is joined with the base's last directory |
| `example` | `/base/file` | `/base/example` | Input is joined with the base without its file |
| `example` | `base/dir/` | `base/dir/example` | Input is joined with the base's last directory |
| `example` | `base/file` | `base/example` | Input is joined with the base without its file |
@@ -0,0 +1,44 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.1.2](https://github.com/es-shims/es-object-atoms/compare/v1.1.1...v1.1.2) - 2026-05-22
### Commits
- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `auto-changelog`, `eslint`, `npmignore` [`41e3d94`](https://github.com/es-shims/es-object-atoms/commit/41e3d94f6b49237fa490ec598e068f170c8b161e)
- [types] improve `isObject` type [`758edc2`](https://github.com/es-shims/es-object-atoms/commit/758edc2280fa6993a294a55957a43cee5951bf51)
## [v1.1.1](https://github.com/es-shims/es-object-atoms/compare/v1.1.0...v1.1.1) - 2025-01-14
### Commits
- [types] `ToObject`: improve types [`cfe8c8a`](https://github.com/es-shims/es-object-atoms/commit/cfe8c8a105c44820cb22e26f62d12ef0ad9715c8)
## [v1.1.0](https://github.com/es-shims/es-object-atoms/compare/v1.0.1...v1.1.0) - 2025-01-14
### Commits
- [New] add `isObject` [`51e4042`](https://github.com/es-shims/es-object-atoms/commit/51e4042df722eb3165f40dc5f4bf33d0197ecb07)
## [v1.0.1](https://github.com/es-shims/es-object-atoms/compare/v1.0.0...v1.0.1) - 2025-01-13
### Commits
- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/tape`, `auto-changelog`, `tape` [`38ab9eb`](https://github.com/es-shims/es-object-atoms/commit/38ab9eb00b62c2f4668644f5e513d9b414ebd595)
- [types] improve types [`7d1beb8`](https://github.com/es-shims/es-object-atoms/commit/7d1beb887958b78b6a728a210a1c8370ab7e2aa1)
- [Tests] replace `aud` with `npm audit` [`25863ba`](https://github.com/es-shims/es-object-atoms/commit/25863baf99178f1d1ad33d1120498db28631907e)
- [Dev Deps] add missing peer dep [`c012309`](https://github.com/es-shims/es-object-atoms/commit/c0123091287e6132d6f4240496340c427433df28)
## v1.0.0 - 2024-03-16
### Commits
- Initial implementation, tests, readme, types [`f1499db`](https://github.com/es-shims/es-object-atoms/commit/f1499db7d3e1741e64979c61d645ab3137705e82)
- Initial commit [`99eedc7`](https://github.com/es-shims/es-object-atoms/commit/99eedc7b5fde38a50a28d3c8b724706e3e4c5f6a)
- [meta] rename repo [`fc851fa`](https://github.com/es-shims/es-object-atoms/commit/fc851fa70616d2d182aaf0bd02c2ed7084dea8fa)
- npm init [`b909377`](https://github.com/es-shims/es-object-atoms/commit/b909377c50049bd0ec575562d20b0f9ebae8947f)
- Only apps should have lockfiles [`7249edd`](https://github.com/es-shims/es-object-atoms/commit/7249edd2178c1b9ddfc66ffcc6d07fdf0d28efc1)
@@ -0,0 +1 @@
{"version":3,"file":"chevrons-up-down.js","sources":["../../../src/icons/chevrons-up-down.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ChevronsUpDown\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtNyAxNSA1IDUgNS01IiAvPgogIDxwYXRoIGQ9Im03IDkgNS01IDUgNSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/chevrons-up-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 ChevronsUpDown = createLucideIcon('ChevronsUpDown', [\n ['path', { d: 'm7 15 5 5 5-5', key: '1hf1tw' }],\n ['path', { d: 'm7 9 5-5 5 5', key: 'sgt6xg' }],\n]);\n\nexport default ChevronsUpDown;\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,CAAiB,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,CAC9C,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,227 @@
# @jridgewell/gen-mapping
> Generate source maps
`gen-mapping` allows you to generate a source map during transpilation or minification.
With a source map, you're able to trace the original location in the source file, either in Chrome's
DevTools or using a library like [`@jridgewell/trace-mapping`][trace-mapping].
You may already be familiar with the [`source-map`][source-map] package's `SourceMapGenerator`. This
provides the same `addMapping` and `setSourceContent` API.
## Installation
```sh
npm install @jridgewell/gen-mapping
```
## Usage
```typescript
import { GenMapping, addMapping, setSourceContent, toEncodedMap, toDecodedMap } from '@jridgewell/gen-mapping';
const map = new GenMapping({
file: 'output.js',
sourceRoot: 'https://example.com/',
});
setSourceContent(map, 'input.js', `function foo() {}`);
addMapping(map, {
// Lines start at line 1, columns at column 0.
generated: { line: 1, column: 0 },
source: 'input.js',
original: { line: 1, column: 0 },
});
addMapping(map, {
generated: { line: 1, column: 9 },
source: 'input.js',
original: { line: 1, column: 9 },
name: 'foo',
});
assert.deepEqual(toDecodedMap(map), {
version: 3,
file: 'output.js',
names: ['foo'],
sourceRoot: 'https://example.com/',
sources: ['input.js'],
sourcesContent: ['function foo() {}'],
mappings: [
[ [0, 0, 0, 0], [9, 0, 0, 9, 0] ]
],
});
assert.deepEqual(toEncodedMap(map), {
version: 3,
file: 'output.js',
names: ['foo'],
sourceRoot: 'https://example.com/',
sources: ['input.js'],
sourcesContent: ['function foo() {}'],
mappings: 'AAAA,SAASA',
});
```
### Smaller Sourcemaps
Not everything needs to be added to a sourcemap, and needless markings can cause signficantly
larger file sizes. `gen-mapping` exposes `maybeAddSegment`/`maybeAddMapping` APIs that will
intelligently determine if this marking adds useful information. If not, the marking will be
skipped.
```typescript
import { maybeAddMapping } from '@jridgewell/gen-mapping';
const map = new GenMapping();
// Adding a sourceless marking at the beginning of a line isn't useful.
maybeAddMapping(map, {
generated: { line: 1, column: 0 },
});
// Adding a new source marking is useful.
maybeAddMapping(map, {
generated: { line: 1, column: 0 },
source: 'input.js',
original: { line: 1, column: 0 },
});
// But adding another marking pointing to the exact same original location isn't, even if the
// generated column changed.
maybeAddMapping(map, {
generated: { line: 1, column: 9 },
source: 'input.js',
original: { line: 1, column: 0 },
});
assert.deepEqual(toEncodedMap(map), {
version: 3,
names: [],
sources: ['input.js'],
sourcesContent: [null],
mappings: 'AAAA',
});
```
## Benchmarks
```
node v18.0.0
amp.js.map
Memory Usage:
gen-mapping: addSegment 5852872 bytes
gen-mapping: addMapping 7716042 bytes
source-map-js 6143250 bytes
source-map-0.6.1 6124102 bytes
source-map-0.8.0 6121173 bytes
Smallest memory usage is gen-mapping: addSegment
Adding speed:
gen-mapping: addSegment x 441 ops/sec ±2.07% (90 runs sampled)
gen-mapping: addMapping x 350 ops/sec ±2.40% (86 runs sampled)
source-map-js: addMapping x 169 ops/sec ±2.42% (80 runs sampled)
source-map-0.6.1: addMapping x 167 ops/sec ±2.56% (80 runs sampled)
source-map-0.8.0: addMapping x 168 ops/sec ±2.52% (80 runs sampled)
Fastest is gen-mapping: addSegment
Generate speed:
gen-mapping: decoded output x 150,824,370 ops/sec ±0.07% (102 runs sampled)
gen-mapping: encoded output x 663 ops/sec ±0.22% (98 runs sampled)
source-map-js: encoded output x 197 ops/sec ±0.45% (84 runs sampled)
source-map-0.6.1: encoded output x 198 ops/sec ±0.33% (85 runs sampled)
source-map-0.8.0: encoded output x 197 ops/sec ±0.06% (93 runs sampled)
Fastest is gen-mapping: decoded output
***
babel.min.js.map
Memory Usage:
gen-mapping: addSegment 37578063 bytes
gen-mapping: addMapping 37212897 bytes
source-map-js 47638527 bytes
source-map-0.6.1 47690503 bytes
source-map-0.8.0 47470188 bytes
Smallest memory usage is gen-mapping: addMapping
Adding speed:
gen-mapping: addSegment x 31.05 ops/sec ±8.31% (43 runs sampled)
gen-mapping: addMapping x 29.83 ops/sec ±7.36% (51 runs sampled)
source-map-js: addMapping x 20.73 ops/sec ±6.22% (38 runs sampled)
source-map-0.6.1: addMapping x 20.03 ops/sec ±10.51% (38 runs sampled)
source-map-0.8.0: addMapping x 19.30 ops/sec ±8.27% (37 runs sampled)
Fastest is gen-mapping: addSegment
Generate speed:
gen-mapping: decoded output x 381,379,234 ops/sec ±0.29% (96 runs sampled)
gen-mapping: encoded output x 95.15 ops/sec ±2.98% (72 runs sampled)
source-map-js: encoded output x 15.20 ops/sec ±7.41% (33 runs sampled)
source-map-0.6.1: encoded output x 16.36 ops/sec ±10.46% (31 runs sampled)
source-map-0.8.0: encoded output x 16.06 ops/sec ±6.45% (31 runs sampled)
Fastest is gen-mapping: decoded output
***
preact.js.map
Memory Usage:
gen-mapping: addSegment 416247 bytes
gen-mapping: addMapping 419824 bytes
source-map-js 1024619 bytes
source-map-0.6.1 1146004 bytes
source-map-0.8.0 1113250 bytes
Smallest memory usage is gen-mapping: addSegment
Adding speed:
gen-mapping: addSegment x 13,755 ops/sec ±0.15% (98 runs sampled)
gen-mapping: addMapping x 13,013 ops/sec ±0.11% (101 runs sampled)
source-map-js: addMapping x 4,564 ops/sec ±0.21% (98 runs sampled)
source-map-0.6.1: addMapping x 4,562 ops/sec ±0.11% (99 runs sampled)
source-map-0.8.0: addMapping x 4,593 ops/sec ±0.11% (100 runs sampled)
Fastest is gen-mapping: addSegment
Generate speed:
gen-mapping: decoded output x 379,864,020 ops/sec ±0.23% (93 runs sampled)
gen-mapping: encoded output x 14,368 ops/sec ±4.07% (82 runs sampled)
source-map-js: encoded output x 5,261 ops/sec ±0.21% (99 runs sampled)
source-map-0.6.1: encoded output x 5,124 ops/sec ±0.58% (99 runs sampled)
source-map-0.8.0: encoded output x 5,434 ops/sec ±0.33% (96 runs sampled)
Fastest is gen-mapping: decoded output
***
react.js.map
Memory Usage:
gen-mapping: addSegment 975096 bytes
gen-mapping: addMapping 1102981 bytes
source-map-js 2918836 bytes
source-map-0.6.1 2885435 bytes
source-map-0.8.0 2874336 bytes
Smallest memory usage is gen-mapping: addSegment
Adding speed:
gen-mapping: addSegment x 4,772 ops/sec ±0.15% (100 runs sampled)
gen-mapping: addMapping x 4,456 ops/sec ±0.13% (97 runs sampled)
source-map-js: addMapping x 1,618 ops/sec ±0.24% (97 runs sampled)
source-map-0.6.1: addMapping x 1,622 ops/sec ±0.12% (99 runs sampled)
source-map-0.8.0: addMapping x 1,631 ops/sec ±0.12% (100 runs sampled)
Fastest is gen-mapping: addSegment
Generate speed:
gen-mapping: decoded output x 379,107,695 ops/sec ±0.07% (99 runs sampled)
gen-mapping: encoded output x 5,421 ops/sec ±1.60% (89 runs sampled)
source-map-js: encoded output x 2,113 ops/sec ±1.81% (98 runs sampled)
source-map-0.6.1: encoded output x 2,126 ops/sec ±0.10% (100 runs sampled)
source-map-0.8.0: encoded output x 2,176 ops/sec ±0.39% (98 runs sampled)
Fastest is gen-mapping: decoded output
```
[source-map]: https://www.npmjs.com/package/source-map
[trace-mapping]: https://github.com/jridgewell/sourcemaps/tree/main/packages/trace-mapping
@@ -0,0 +1,138 @@
"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: "अक्षर", 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: "URL",
emoji: "इमोजी",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO मिति र समय",
date: "ISO मिति",
time: "ISO समय",
duration: "ISO अवधि",
ipv4: "IPv4 ठेगाना",
ipv6: "IPv6 ठेगाना",
mac: "MAC ठेगाना",
cidrv4: "IPv4 दायरा",
cidrv6: "IPv6 दायरा",
base64: "base64-इन्कोड गरिएको स्ट्रिङ",
base64url: "base64url-इन्कोड गरिएको स्ट्रिङ",
json_string: "JSON स्ट्रिङ",
e164: "E.164 नम्बर",
credit_card: "क्रेडिट कार्ड नम्बर",
currency_code: "मुद्रा कोड",
iban: "IBAN",
jwt: "JWT",
template_literal: "इनपुट",
};
const TypeDictionary = {
nan: "NaN",
};
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;
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} ${sizing.verb}`;
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} ${sizing.verb}`;
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":
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
return `अमान्य डिस्क्रिमिनेटर मान: अपेक्षित ${opts}`;
}
return "अमान्य इनपुट";
case "invalid_element":
return `अमान्य मान: ${issue.origin} मा`;
default:
return `अमान्य इनपुट`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
module.exports = exports.default;
@@ -0,0 +1 @@
{"version":3,"file":"make-none-animatable.mjs","sources":["../../../../../src/animation/keyframes/utils/make-none-animatable.ts"],"sourcesContent":["import { analyseComplexValue } from \"../../../value/types/complex\"\nimport { getAnimatableNone } from \"../../../value/types/utils/animatable-none\"\nimport { AnyResolvedKeyframe } from \"../../types\"\nimport { UnresolvedKeyframes } from \"../KeyframesResolver\"\n\n/**\n * If we encounter keyframes like \"none\" or \"0\" and we also have keyframes like\n * \"#fff\" or \"200px 200px\" we want to find a keyframe to serve as a template for\n * the \"none\" keyframes. In this case \"#fff\" or \"200px 200px\" - then these get turned into\n * zero equivalents, i.e. \"#fff0\" or \"0px 0px\".\n */\nconst invalidTemplates = new Set([\"auto\", \"none\", \"0\"])\n\nexport function makeNoneKeyframesAnimatable(\n unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>,\n noneKeyframeIndexes: number[],\n name?: string\n) {\n let i = 0\n let animatableTemplate: string | undefined = undefined\n while (i < unresolvedKeyframes.length && !animatableTemplate) {\n const keyframe = unresolvedKeyframes[i]\n if (\n typeof keyframe === \"string\" &&\n !invalidTemplates.has(keyframe) &&\n analyseComplexValue(keyframe).values.length\n ) {\n animatableTemplate = unresolvedKeyframes[i] as string\n }\n i++\n }\n\n if (animatableTemplate && name) {\n for (const noneIndex of noneKeyframeIndexes) {\n unresolvedKeyframes[noneIndex] = getAnimatableNone(\n name,\n animatableTemplate\n )\n }\n }\n}\n"],"names":[],"mappings":";;;AAKA;;;;;AAKG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;SAEvC,2BAA2B,CACvC,mBAA6D,EAC7D,mBAA6B,EAC7B,IAAa,EAAA;IAEb,IAAI,CAAC,GAAG,CAAC;IACT,IAAI,kBAAkB,GAAuB,SAAS;IACtD,OAAO,CAAC,GAAG,mBAAmB,CAAC,MAAM,IAAI,CAAC,kBAAkB,EAAE;AAC1D,QAAA,MAAM,QAAQ,GAAG,mBAAmB,CAAC,CAAC,CAAC;QACvC,IACI,OAAO,QAAQ,KAAK,QAAQ;AAC5B,YAAA,CAAC,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC;YAC/B,mBAAmB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,EAC7C;AACE,YAAA,kBAAkB,GAAG,mBAAmB,CAAC,CAAC,CAAW;QACzD;AACA,QAAA,CAAC,EAAE;IACP;AAEA,IAAA,IAAI,kBAAkB,IAAI,IAAI,EAAE;AAC5B,QAAA,KAAK,MAAM,SAAS,IAAI,mBAAmB,EAAE;YACzC,mBAAmB,CAAC,SAAS,CAAC,GAAG,iBAAiB,CAC9C,IAAI,EACJ,kBAAkB,CACrB;QACL;IACJ;AACJ;;;;"}
@@ -0,0 +1,591 @@
const require_chunk = require('./chunk-Bnu9O96Y.cjs');
const require_mcp = require('./mcp-BumlNux0.cjs');
const require_src = require('./src-BhnGYybN.cjs');
let _modelcontextprotocol_server__shims = require("@modelcontextprotocol/server/_shims");
//#region src/server/stdio.ts
/**
* Marks a stdout `'error'` listener that a closed transport left attached purely to
* swallow late write failures (see {@link StdioServerTransport.close}). A fresh
* transport taking over the same stream removes listeners carrying this tag in
* `start()`, so repeated create→close cycles on the process-global `process.stdout`
* don't accumulate listeners.
*/
const swallowsErrorsAfterClose = Symbol("swallowsErrorsAfterClose");
/**
* Server transport for stdio: this communicates with an MCP client by reading from the current process' `stdin` and writing to `stdout`.
*
* This transport is only available in Node.js environments.
*
* When the client closes its end of the pipe (stdin reaches end-of-file), the transport
* closes itself and fires `onclose`, per the MCP stdio binding's guidance that servers
* should exit promptly when their standard input is closed. A server that holds no other
* keep-alive handles will then exit naturally. Requests still in flight when stdin ends are
* aborted and not answered; a client that expects responses keeps stdin open until it has
* read them.
*
* @example
* ```ts source="./stdio.examples.ts#StdioServerTransport_basicUsage"
* const server = new McpServer({ name: 'my-server', version: '1.0.0' });
* const transport = new StdioServerTransport();
* await server.connect(transport);
* ```
*/
var StdioServerTransport = class {
_readBuffer;
_started = false;
_closed = false;
constructor(_stdin = _modelcontextprotocol_server__shims.process.stdin, _stdout = _modelcontextprotocol_server__shims.process.stdout, options) {
this._stdin = _stdin;
this._stdout = _stdout;
this._readBuffer = new require_src.ReadBuffer({ maxBufferSize: options?.maxBufferSize });
}
onclose;
onerror;
onmessage;
_ondata = (chunk) => {
try {
this._readBuffer.append(chunk);
this.processReadBuffer();
} catch (error) {
this.onerror?.(error);
this.close().catch(() => {});
}
};
_onerror = (error) => {
this.onerror?.(error);
};
_onstdouterror = (error) => {
if (this._closed) return;
this.onerror?.(error);
this.close().catch(() => {});
};
_onstdinclose = () => {
this.close().catch(() => {});
};
/**
* Starts listening for messages on `stdin`.
*/
async start() {
if (this._started) throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");
this._started = true;
for (const listener of this._stdout.listeners("error")) if (listener[swallowsErrorsAfterClose]) this._stdout.off("error", listener);
if (this._stdin.readableEnded || this._stdin.destroyed) setImmediate(this._onstdinclose);
this._stdin.on("data", this._ondata);
this._stdin.on("error", this._onerror);
this._stdin.on("end", this._onstdinclose);
this._stdin.on("close", this._onstdinclose);
this._stdout.on("error", this._onstdouterror);
}
processReadBuffer() {
while (true) try {
const message = this._readBuffer.readMessage();
if (message === null) break;
this.onmessage?.(message);
} catch (error) {
this.onerror?.(error);
}
}
async close() {
if (this._closed) return;
this._closed = true;
this._stdin.off("data", this._ondata);
this._stdin.off("error", this._onerror);
this._stdin.off("end", this._onstdinclose);
this._stdin.off("close", this._onstdinclose);
this._onstdouterror[swallowsErrorsAfterClose] = true;
if (this._stdin.listenerCount("data") === 0) this._stdin.pause();
this._readBuffer.clear();
this.onclose?.();
}
send(message) {
if (this._closed) return Promise.reject(/* @__PURE__ */ new Error("StdioServerTransport is closed"));
return new Promise((resolve, reject) => {
const json = require_src.serializeMessage(message);
let settled = false;
const onError = (error) => {
if (settled) return;
settled = true;
this._stdout.off("error", onError);
this._stdout.off("drain", onDrain);
reject(error);
};
const onDrain = () => {
if (settled) return;
settled = true;
this._stdout.off("error", onError);
this._stdout.off("drain", onDrain);
resolve();
};
this._stdout.once("error", onError);
if (this._stdout.write(json)) {
if (settled) return;
settled = true;
this._stdout.off("error", onError);
resolve();
} else if (!settled) this._stdout.once("drain", onDrain);
});
}
};
//#endregion
//#region src/server/serveStdio.ts
/**
* How long the probe-discard path waits for the probe instance to answer the
* requests it was delivered before closing it. The wait normally settles as
* soon as the DiscoverResult is handed to the wire (or immediately, when a
* delivered cancellation already settled the probe); the bound is a backstop
* so no edge can ever hold the connection's inbound pump indefinitely behind
* the discard.
*/
const DISCARD_ANSWER_TIMEOUT_MS = 3e3;
/**
* The transport a pinned instance is connected to: a thin channel that writes
* through to the entry-owned wire transport and receives the messages the
* entry forwards. The wire transport itself is never handed to an instance —
* that is what lets the entry discard an optimistic probe instance (close the
* channel) without tearing down the connection.
*/
var StdioConnectionChannel = class {
onclose;
onerror;
onmessage;
_closed = false;
/** Request ids the entry delivered to the instance that the instance has not yet answered. */
_pendingRequests = /* @__PURE__ */ new Set();
_drainWaiters = [];
constructor(_wire, _onInstanceClose, _outboundIntercept) {
this._wire = _wire;
this._onInstanceClose = _onInstanceClose;
this._outboundIntercept = _outboundIntercept;
}
async start() {}
async send(message, options) {
if (require_src.isJSONRPCResultResponse(message) || require_src.isJSONRPCErrorResponse(message)) {
const { id } = message;
if (id !== void 0) this._settle(id);
}
if (this._closed) return;
if (this._outboundIntercept?.(message) === "handled") return;
return this._wire.send(message, options);
}
setProtocolVersion = (version) => {
this._wire.setProtocolVersion?.(version);
};
/** Forwards one inbound message to the connected instance. */
deliver(message, extra) {
if (this._closed) return;
if (require_src.isJSONRPCRequest(message)) this._pendingRequests.add(message.id);
else if (require_src.isJSONRPCNotification(message) && message.method === "notifications/cancelled") {
const cancelledId = message.params?.requestId;
if (cancelledId !== void 0) this._settle(cancelledId);
}
this.onmessage?.(message, extra);
}
/**
* Resolves once every request delivered to the instance has been answered
* through {@linkcode send}, settled by a delivered cancellation, or the
* channel has been closed and nothing further can be answered. The wait is
* bounded by `timeoutMs` as a backstop so no edge can hold the caller
* indefinitely; resolves `false` only when the bound elapsed with requests
* still unanswered. Used by the probe-discard path so a probe request the
* entry accepted is never silently dropped.
*/
async whenRequestsAnswered(timeoutMs) {
if (this._closed || this._pendingRequests.size === 0) return true;
return await new Promise((resolve) => {
const waiter = () => {
clearTimeout(timer);
resolve(true);
};
const timer = setTimeout(() => {
this._drainWaiters = this._drainWaiters.filter((pending) => pending !== waiter);
resolve(false);
}, timeoutMs);
this._drainWaiters.push(waiter);
});
}
async close() {
if (this._closed) return;
this._closed = true;
this._pendingRequests.clear();
this._releaseDrainWaiters();
try {
this._onInstanceClose();
} finally {
this.onclose?.();
}
}
_settle(id) {
this._pendingRequests.delete(id);
if (this._pendingRequests.size === 0) this._releaseDrainWaiters();
}
_releaseDrainWaiters() {
const waiters = this._drainWaiters;
this._drainWaiters = [];
for (const waiter of waiters) waiter();
}
};
/**
* Classifies one message of the opening exchange with the same body-primary
* rules the HTTP entry applies per request: `initialize` is the legacy
* handshake unless it carries a valid modern envelope claim; a present claim
* is validated (never silently ignored); a claim-less message is 2025-era
* traffic. There is no header layer on stdio, so the body is the only signal.
*/
function classifyOpeningMessage(message) {
const params = message.params;
if (message.method === "initialize" && !require_src.carriesValidModernEnvelopeClaim(params)) {
const requestedVersion = params !== null && typeof params === "object" && typeof params.protocolVersion === "string" ? params.protocolVersion : void 0;
return {
kind: "legacy",
reason: "initialize",
...requestedVersion !== void 0 && { requestedVersion }
};
}
if (!require_src.hasEnvelopeClaim(params)) return {
kind: "legacy",
reason: "no-claim"
};
const meta = require_src.requestMetaOf(params);
const firstIssue = (meta === void 0 ? [] : require_src.validateEnvelopeMeta(meta))[0];
if (firstIssue !== void 0) return {
kind: "invalid-envelope",
issue: firstIssue
};
const claimedVersion = require_src.envelopeClaimVersion(params);
if (claimedVersion === void 0 || !require_src.SUPPORTED_MODERN_PROTOCOL_VERSIONS.includes(claimedVersion)) return {
kind: "unsupported-revision",
requested: claimedVersion ?? "unknown"
};
return {
kind: "modern",
revision: claimedVersion,
classification: {
era: "modern",
revision: claimedVersion
}
};
}
/**
* Serves MCP over stdio from a server factory, owning the era decision for
* the connection: the opening exchange selects the era, ONE instance from the
* factory is pinned for the connection lifetime, and everything after passes
* straight through to it. See the module documentation for the opening rules.
*
* ```ts
* import { serveStdio } from '@modelcontextprotocol/server/stdio';
*
* serveStdio(() => {
* const server = new McpServer({ name: 'my-server', version: '1.0.0' }, { capabilities: { tools: {} } });
* // register tools/resources/prompts once — the same factory serves both eras
* return server;
* });
* ```
*/
function serveStdio(factory, options = {}) {
const legacyMode = options.legacy ?? "serve";
const wire = options.transport ?? new StdioServerTransport();
let state = { phase: "opening" };
/** Channel currently being discarded (its close must not tear the connection down). */
let discarding;
let closing = false;
/**
* Whether the connection has been torn down (`handle.close()` or the wire
* closing). The opening arms re-check this after every await: a close can
* race factory construction, and the continuation must neither resurrect
* the connection state nor keep a late-resolved instance around.
*/
const isTornDown = () => closing || state.phase === "closed";
const reportError = (error) => {
try {
options.onerror?.(error);
} catch {}
};
const writeErrorResponse = (id, code, message, data) => wire.send({
jsonrpc: "2.0",
id,
error: {
code,
message,
...data !== void 0 && { data }
}
}).catch((error) => reportError(toError(error)));
/**
* Entry-handled `subscriptions/listen` for this connection: holds the
* active subscriptions, serves inbound listen / cancelled-of-listen
* before the pinned instance is consulted, and rewrites the instance's
* outbound change notifications onto the active subscriptions. Only
* consulted on a modern-pinned connection — on a legacy connection
* change notifications pass straight through (the 2025 unsolicited
* delivery model is unchanged).
*/
const listenRouter = new require_mcp.StdioListenRouter(options.maxSubscriptions ?? require_mcp.DEFAULT_MAX_SUBSCRIPTIONS);
/** Outbound intercept installed on a modern instance's channel. */
const modernOutboundIntercept = (message) => {
if (!require_src.isJSONRPCNotification(message)) return void 0;
const routed = listenRouter.routeOutbound(message);
if (routed === "passthrough") return void 0;
for (const stamped of routed) wire.send({
jsonrpc: "2.0",
...stamped
}).catch((error) => reportError(toError(error)));
return "handled";
};
/**
* Entry-handled inbound listen routing for a modern-pinned connection.
* Returns `true` when the message was served at the entry and must NOT
* be delivered to the pinned instance.
*/
const tryServeListen = async (message) => {
if (require_src.isJSONRPCRequest(message) && message.method === "subscriptions/listen") {
const meta = require_src.requestMetaOf(message.params);
const issue = require_src.hasEnvelopeClaim(message.params) ? (meta === void 0 ? [] : require_src.validateEnvelopeMeta(meta))[0] : {
key: "_meta",
problem: "the per-request envelope is required on protocol revision 2026-07-28"
};
const claimedVersion = require_src.envelopeClaimVersion(message.params);
let reply;
if (issue !== void 0) reply = {
jsonrpc: "2.0",
id: message.id,
error: {
code: -32602,
message: `Invalid _meta envelope: ${issue.key}: ${issue.problem}`
}
};
else if (claimedVersion === void 0 || !require_src.SUPPORTED_MODERN_PROTOCOL_VERSIONS.includes(claimedVersion)) {
const error = new require_src.UnsupportedProtocolVersionError({
supported: [...require_src.SUPPORTED_MODERN_PROTOCOL_VERSIONS],
requested: claimedVersion ?? "unknown"
});
reply = {
jsonrpc: "2.0",
id: message.id,
error: {
code: error.code,
message: error.message,
data: error.data
}
};
} else reply = listenRouter.serve(message);
await wire.send("error" in reply ? reply : {
jsonrpc: "2.0",
method: reply.method,
params: reply.params
}).catch((error) => reportError(toError(error)));
return true;
}
if (require_src.isJSONRPCNotification(message) && message.method === "notifications/cancelled") {
const cancelledId = message.params?.requestId;
if (cancelledId !== void 0 && listenRouter.cancel(cancelledId)) return true;
}
return false;
};
/** Answers a 2025-era request the entry will not serve (the modern-only rejection cells). */
const answerLegacyRejection = (request, reason, requestedVersion) => {
const rejection = require_src.modernOnlyStrictRejection({
kind: "legacy",
reason,
...requestedVersion !== void 0 && { requestedVersion }
}, require_src.SUPPORTED_MODERN_PROTOCOL_VERSIONS);
if (rejection === void 0) return Promise.resolve();
reportError(/* @__PURE__ */ new Error(`Rejected 2025-era request on a modern-only stdio connection (${rejection.cell}): ${rejection.message}`));
return writeErrorResponse(request.id, rejection.code, rejection.message, rejection.data);
};
const onInstanceClosed = (channel) => {
if (closing || channel === discarding) return;
closeAll();
};
const connectInstance = async (era, revision) => {
const product = await factory({ era });
const server = product instanceof require_mcp.McpServer ? product.server : product;
if (era === "modern") {
require_src.setNegotiatedProtocolVersion(server, revision);
require_mcp.installModernOnlyHandlers(server, require_src.SUPPORTED_MODERN_PROTOCOL_VERSIONS);
listenRouter.setServerCapabilities(server.getCapabilities(), require_mcp.serverIdentityOf(server));
}
const channel = new StdioConnectionChannel(wire, () => onInstanceClosed(channel), era === "modern" ? modernOutboundIntercept : void 0);
await product.connect(channel);
return {
product,
channel
};
};
/** Closes an instance whose factory resolved only after the connection was torn down. */
const disposeLateInstance = (instance) => instance.product.close().catch((error) => reportError(toError(error)));
const discardProbeInstance = async (instance) => {
discarding = instance.channel;
try {
if (!await instance.channel.whenRequestsAnswered(DISCARD_ANSWER_TIMEOUT_MS)) reportError(/* @__PURE__ */ new Error(`Discarded the probe instance with requests still unanswered after ${DISCARD_ANSWER_TIMEOUT_MS}ms; continuing with the fallback`));
await instance.product.close();
} catch (error) {
reportError(toError(error));
} finally {
discarding = void 0;
}
};
const processMessage = async (message) => {
if (state.phase === "closed") return;
if (state.phase === "pinned") {
if (state.era === "modern" && require_src.isJSONRPCRequest(message) && message.method === "initialize" && !require_src.carriesValidModernEnvelopeClaim(message.params)) {
await answerLegacyRejection(message, "initialize", message.params !== null && typeof message.params === "object" && typeof message.params.protocolVersion === "string" ? message.params.protocolVersion : void 0);
return;
}
if (state.era === "modern" && await tryServeListen(message)) return;
if (isTornDown()) return;
state.instance.channel.deliver(message);
return;
}
if (!require_src.isJSONRPCRequest(message) && !require_src.isJSONRPCNotification(message)) {
reportError(/* @__PURE__ */ new Error("Discarded a JSON-RPC response received before the connection negotiated an era"));
return;
}
const opening = classifyOpeningMessage(message);
switch (opening.kind) {
case "invalid-envelope": {
const detail = `Invalid _meta envelope for protocol revision 2026-07-28: ${opening.issue.key}: ${opening.issue.problem}`;
if (require_src.isJSONRPCRequest(message)) await writeErrorResponse(message.id, require_src.ProtocolErrorCode.InvalidParams, detail, { envelope: opening.issue });
else reportError(/* @__PURE__ */ new Error(`Discarded a notification with a malformed envelope: ${detail}`));
return;
}
case "unsupported-revision":
if (require_src.isJSONRPCRequest(message)) {
const error = new require_src.UnsupportedProtocolVersionError({
supported: [...require_src.SUPPORTED_MODERN_PROTOCOL_VERSIONS],
requested: opening.requested
});
reportError(error);
await writeErrorResponse(message.id, error.code, error.message, error.data);
} else reportError(/* @__PURE__ */ new Error(`Discarded a notification claiming unsupported protocol revision ${opening.requested}`));
return;
case "modern":
if (require_src.isJSONRPCRequest(message) && message.method === "server/discover") {
if (state.phase === "probe") {
state.instance.channel.deliver(message, { classification: opening.classification });
return;
}
const instance = await connectInstance("modern", opening.revision);
if (isTornDown()) {
await disposeLateInstance(instance);
return;
}
state = {
phase: "probe",
instance
};
instance.channel.deliver(message, { classification: opening.classification });
return;
}
if (state.phase === "probe") {
if (require_src.isJSONRPCNotification(message)) {
state.instance.channel.deliver(message, { classification: opening.classification });
return;
}
state = {
phase: "pinned",
era: "modern",
instance: state.instance
};
} else {
const instance = await connectInstance("modern", opening.revision);
if (isTornDown()) {
await disposeLateInstance(instance);
return;
}
state = {
phase: "pinned",
era: "modern",
instance
};
}
if (await tryServeListen(message)) return;
if (isTornDown()) return;
state.instance.channel.deliver(message, { classification: opening.classification });
return;
case "legacy": {
if (legacyMode === "reject") {
if (require_src.isJSONRPCRequest(message)) await answerLegacyRejection(message, opening.reason, opening.requestedVersion);
return;
}
if (state.phase === "probe") {
await discardProbeInstance(state.instance);
if (isTornDown()) return;
state = { phase: "opening" };
}
const instance = await connectInstance("legacy");
if (isTornDown()) {
await disposeLateInstance(instance);
return;
}
state = {
phase: "pinned",
era: "legacy",
instance
};
state.instance.channel.deliver(message);
return;
}
}
};
const queue = [];
let pumping = false;
const pump = async () => {
if (pumping) return;
pumping = true;
try {
while (queue.length > 0) {
const message = queue.shift();
try {
await processMessage(message);
} catch (error) {
if (require_src.isJSONRPCRequest(message)) await writeErrorResponse(message.id, require_src.ProtocolErrorCode.InternalError, "Internal server error");
reportError(toError(error));
}
}
} finally {
pumping = false;
}
};
const closeAll = async () => {
if (closing || state.phase === "closed") return;
closing = true;
const current = state;
state = { phase: "closed" };
for (const result of listenRouter.teardownAll()) await wire.send(result).catch((error) => reportError(toError(error)));
if (current.phase === "probe" || current.phase === "pinned") await current.instance.product.close().catch((error) => reportError(toError(error)));
await wire.close().catch((error) => reportError(toError(error)));
};
wire.onmessage = (message) => {
queue.push(message);
pump();
};
wire.onerror = (error) => {
reportError(error);
if (state.phase === "probe" || state.phase === "pinned") state.instance.channel.onerror?.(error);
};
wire.onclose = () => {
if (closing || state.phase === "closed") return;
closing = true;
const current = state;
state = { phase: "closed" };
if (current.phase === "probe" || current.phase === "pinned") current.instance.product.close().catch((error) => reportError(toError(error)));
};
const started = wire.start().catch((error) => {
reportError(toError(error));
throw error;
});
started.catch(() => {});
return { close: async () => {
await started.catch(() => {});
await closeAll();
} };
}
function toError(value) {
return value instanceof Error ? value : new Error(String(value));
}
//#endregion
exports.StdioServerTransport = StdioServerTransport;
exports.serveStdio = serveStdio;
//# sourceMappingURL=stdio.cjs.map
@@ -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.es2024_full = void 0;
const dom_1 = require("./dom");
const dom_asynciterable_1 = require("./dom.asynciterable");
const dom_iterable_1 = require("./dom.iterable");
const es2024_1 = require("./es2024");
const scripthost_1 = require("./scripthost");
const webworker_importscripts_1 = require("./webworker.importscripts");
exports.es2024_full = {
libs: [
es2024_1.es2024,
dom_1.dom,
webworker_importscripts_1.webworker_importscripts,
scripthost_1.scripthost,
dom_iterable_1.dom_iterable,
dom_asynciterable_1.dom_asynciterable,
],
variables: [],
};
@@ -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 FileType2 = createLucideIcon("FileType2", [
["path", { d: "M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4", key: "1pf5j1" }],
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
["path", { d: "M2 13v-1h6v1", key: "1dh9dg" }],
["path", { d: "M5 12v6", key: "150t9c" }],
["path", { d: "M4 18h2", key: "1xrofg" }]
]);
export { FileType2 as default };
//# sourceMappingURL=file-type-2.js.map
@@ -0,0 +1,36 @@
/**
* Signing JSON Web Signature (JWS) in Compact Serialization
*
* @module
*/
import type * as types from '../../types.d.ts';
/**
* The CompactSign class is used to build and sign Compact JWS strings.
*
* This class is exported (as a named export) from the main `'jose'` module entry point as well as
* from its subpath export `'jose/jws/compact/sign'`.
*
*/
export declare class CompactSign {
#private;
/**
* {@link CompactSign} constructor
*
* @param payload Binary representation of the payload to sign.
*/
constructor(payload: Uint8Array);
/**
* Sets the JWS Protected Header on the CompactSign object.
*
* @param protectedHeader JWS Protected Header.
*/
setProtectedHeader(protectedHeader: types.CompactJWSHeaderParameters): this;
/**
* Signs and resolves the value of the Compact JWS string.
*
* @param key Private Key or Secret to sign the JWS with. See
* {@link https://github.com/panva/jose/issues/210#jws-alg Algorithm Key Requirements}.
* @param options JWS Sign options.
*/
sign(key: types.CryptoKey | types.KeyObject | types.JWK | Uint8Array, options?: types.SignOptions): Promise<string>;
}
@@ -0,0 +1,160 @@
{
"name": "@modelcontextprotocol/server",
"version": "2.3.1",
"description": "Model Context Protocol implementation for TypeScript - Server package",
"license": "Apache-2.0",
"author": "Anthropic, PBC (https://anthropic.com)",
"homepage": "https://modelcontextprotocol.io",
"bugs": "https://github.com/modelcontextprotocol/typescript-sdk/issues",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/modelcontextprotocol/typescript-sdk.git"
},
"engines": {
"node": ">=20"
},
"keywords": [
"modelcontextprotocol",
"mcp",
"server"
],
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./stdio": {
"import": {
"types": "./dist/stdio.d.mts",
"default": "./dist/stdio.mjs"
},
"require": {
"types": "./dist/stdio.d.cts",
"default": "./dist/stdio.cjs"
}
},
"./validators/ajv": {
"import": {
"types": "./dist/validators/ajv.d.mts",
"default": "./dist/validators/ajv.mjs"
},
"require": {
"types": "./dist/validators/ajv.d.cts",
"default": "./dist/validators/ajv.cjs"
}
},
"./validators/cf-worker": {
"import": {
"types": "./dist/validators/cfWorker.d.mts",
"default": "./dist/validators/cfWorker.mjs"
},
"require": {
"types": "./dist/validators/cfWorker.d.cts",
"default": "./dist/validators/cfWorker.cjs"
}
},
"./_shims": {
"workerd": {
"import": {
"types": "./dist/shimsWorkerd.d.mts",
"default": "./dist/shimsWorkerd.mjs"
},
"require": {
"types": "./dist/shimsWorkerd.d.cts",
"default": "./dist/shimsWorkerd.cjs"
}
},
"browser": {
"import": {
"types": "./dist/shimsBrowser.d.mts",
"default": "./dist/shimsBrowser.mjs"
},
"require": {
"types": "./dist/shimsBrowser.d.cts",
"default": "./dist/shimsBrowser.cjs"
}
},
"node": {
"import": {
"types": "./dist/shimsNode.d.mts",
"default": "./dist/shimsNode.mjs"
},
"require": {
"types": "./dist/shimsNode.d.cts",
"default": "./dist/shimsNode.cjs"
}
},
"default": {
"import": {
"types": "./dist/shimsNode.d.mts",
"default": "./dist/shimsNode.mjs"
},
"require": {
"types": "./dist/shimsNode.d.cts",
"default": "./dist/shimsNode.cjs"
}
}
}
},
"main": "./dist/index.cjs",
"types": "./dist/index.d.mts",
"typesVersions": {
"*": {
"validators/ajv": [
"dist/validators/ajv.d.mts"
],
"validators/cf-worker": [
"dist/validators/cfWorker.d.mts"
],
"stdio": [
"dist/stdio.d.mts"
]
}
},
"files": [
"dist"
],
"dependencies": {
"zod": "^4.2.0",
"@modelcontextprotocol/core": "2.3.1"
},
"devDependencies": {
"@cfworker/json-schema": "^4.1.1",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"@eslint/js": "^9.39.2",
"@types/eventsource": "^1.1.15",
"@typescript/native-preview": "^7.0.0-dev.20251217.1",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-n": "^17.23.1",
"prettier": "3.6.2",
"supertest": "^7.0.0",
"tsdown": "^0.18.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.48.1",
"vitest": "^4.0.15",
"@modelcontextprotocol/core-internal": "^2.0.4",
"@modelcontextprotocol/eslint-config": "^2.0.0",
"@modelcontextprotocol/test-helpers": "^2.0.0",
"@modelcontextprotocol/tsconfig": "^2.0.0",
"@modelcontextprotocol/vitest-config": "^2.0.0"
},
"scripts": {
"typecheck": "tsgo -p tsconfig.json --noEmit",
"build": "tsdown",
"build:watch": "tsdown --watch",
"lint": "eslint src/ && prettier --ignore-path ../../.prettierignore --check .",
"lint:fix": "eslint src/ --fix && prettier --ignore-path ../../.prettierignore --write .",
"check": "pnpm run typecheck && pnpm run lint",
"test": "vitest run",
"test:watch": "vitest"
}
}
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LINEBREAK_MATCHER = void 0;
exports.isTokenOnSameLine = isTokenOnSameLine;
exports.LINEBREAK_MATCHER = /\r\n|[\r\n\u2028\u2029]/;
/**
* Determines whether two adjacent tokens are on the same line
*/
function isTokenOnSameLine(left, right) {
return left.loc.end.line === right.loc.start.line;
}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_yO","2":"_0 T"},C:{"1":"_IM","2":"_rL"},D:{"1":"_zO","2":"_v T"},E:{"1":"_wF","2":"_iF"},F:{"1":"_pU _qD","2":"_4B _tL _O"},G:{"1":"_JE","2":"_XF"},H:{"2":"1D"},I:{"1":"I","2":"_G"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_yD","2":"_WE"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"ME","2":"LE"}},B:5,C:"gap property for Flexbox",D:true};
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_WG _i","2":"_0 _hF","132":"_lG _CS _gE"},C:{"2":"_S"},D:{"1":"_WG _l","2":"_v _hF","132":"_lG _CS _gE"},E:{"2":"_R"},F:{"16":"_c"},G:{"2":"_M"},H:{"2":"1D"},I:{"2":"_P"},J:{"2":"_B"},K:{"2":"_N"},L:{"194":"I"},M:{"2":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"2":"_F"},Q:{"2":"JE"},R:{"2":"KE"},S:{"2":"_C"}},B:1,C:"CSS Module Scripts",D:false};
@@ -0,0 +1,187 @@
/**
* @fileoverview Rule to check for implicit global variables, functions and classes.
* @author Joshua Peek
*/
"use strict";
const ASSIGNMENT_NODES = new Set([
"AssignmentExpression",
"ForInStatement",
"ForOfStatement",
]);
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: [
{
lexicalBindings: false,
},
],
docs: {
description: "Disallow declarations in the global scope",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-implicit-globals",
},
schema: [
{
type: "object",
properties: {
lexicalBindings: {
type: "boolean",
},
},
additionalProperties: false,
},
],
messages: {
globalNonLexicalBinding:
"Unexpected {{kind}} declaration in the global scope, wrap in an IIFE for a local variable, assign as global property for a global variable.",
globalLexicalBinding:
"Unexpected {{kind}} declaration in the global scope, wrap in a block or in an IIFE.",
globalVariableLeak:
"Global variable leak, declare the variable if it is intended to be local.",
assignmentToReadonlyGlobal:
"Unexpected assignment to read-only global variable.",
redeclarationOfReadonlyGlobal:
"Unexpected redeclaration of read-only global variable.",
},
},
create(context) {
const [{ lexicalBindings: checkLexicalBindings }] = context.options;
const sourceCode = context.sourceCode;
/**
* Reports the node.
* @param {ASTNode} node Node to report.
* @param {string} messageId Id of the message to report.
* @param {string|undefined} kind Declaration kind, can be 'var', 'const', 'let', function or class.
* @returns {void}
*/
function report(node, messageId, kind) {
context.report({
node,
messageId,
data: {
kind,
},
});
}
return {
Program(node) {
const scope = sourceCode.getScope(node);
scope.variables.forEach(variable => {
// Only ESLint global variables have the `writable` key.
const isReadonlyEslintGlobalVariable =
variable.writeable === false;
const isWritableEslintGlobalVariable =
variable.writeable === true;
if (isWritableEslintGlobalVariable) {
// Everything is allowed with writable ESLint global variables.
return;
}
// Variables exported by "exported" block comments
if (variable.eslintExported) {
return;
}
variable.defs.forEach(def => {
const defNode = def.node;
if (
def.type === "FunctionName" ||
(def.type === "Variable" &&
def.parent.kind === "var")
) {
if (isReadonlyEslintGlobalVariable) {
report(
defNode,
"redeclarationOfReadonlyGlobal",
);
} else {
report(
defNode,
"globalNonLexicalBinding",
def.type === "FunctionName"
? "function"
: `'${def.parent.kind}'`,
);
}
}
if (checkLexicalBindings) {
if (
def.type === "ClassName" ||
(def.type === "Variable" &&
(def.parent.kind === "let" ||
def.parent.kind === "const"))
) {
if (isReadonlyEslintGlobalVariable) {
report(
defNode,
"redeclarationOfReadonlyGlobal",
);
} else {
report(
defNode,
"globalLexicalBinding",
def.type === "ClassName"
? "class"
: `'${def.parent.kind}'`,
);
}
}
}
});
if (
isReadonlyEslintGlobalVariable &&
variable.defs.length === 0
) {
variable.references.forEach(reference => {
if (reference.isWrite() && !reference.isRead()) {
let assignmentParent =
reference.identifier.parent;
while (
assignmentParent &&
!ASSIGNMENT_NODES.has(assignmentParent.type)
) {
assignmentParent = assignmentParent.parent;
}
report(
assignmentParent ?? reference.identifier,
"assignmentToReadonlyGlobal",
);
}
});
}
});
// Undeclared assigned variables.
scope.implicit.variables.forEach(variable => {
// def.node is an AssignmentExpression, ForInStatement or ForOfStatement.
variable.defs.forEach(def => {
report(def.node, "globalVariableLeak");
});
});
},
};
},
};
@@ -0,0 +1,361 @@
# SnapshotAgent
<!--introduced_in=v7.13.0-->
<!--type=module-->
<!-- source_link=lib/mock/snapshot-agent.js -->
> Stability: 1 - Experimental
`SnapshotAgent` records real HTTP responses and replays them on later requests,
allowing tests to run against deterministic, captured data instead of a live
network. It extends [`MockAgent`][], so it can be installed with
[`setGlobalDispatcher()`][] or passed explicitly through the `dispatcher`
option, and it works with every undici API (`fetch`, `request`, `stream`,
`pipeline`, and so on).
A `SnapshotAgent` operates in one of three modes. In `'record'` mode it performs
real requests and writes the responses to a snapshot file. In `'playback'` mode
it serves responses from the snapshot file without touching the network. In
`'update'` mode it replays existing snapshots and records any request that has no
matching snapshot.
```mjs
import { SnapshotAgent, setGlobalDispatcher, fetch } from 'undici'
const agent = new SnapshotAgent({
mode: 'record',
snapshotPath: './snapshots/api.json'
})
setGlobalDispatcher(agent)
const response = await fetch('https://api.example.com/users')
const users = await response.json()
await agent.close()
```
Constructing a `SnapshotAgent` emits an `ExperimentalWarning` once per process.
## Class: `SnapshotAgent`
<!-- YAML
added: v7.13.0
-->
* Extends: {MockAgent}
The captured interactions are managed by an internal `SnapshotRecorder`, which
is accessible through [`agent.getRecorder()`][]. Because `SnapshotAgent` extends
[`MockAgent`][], all `MockAgent` and [`Dispatcher`][] methods and events are also
available.
### `new SnapshotAgent([options])`
<!-- YAML
added: v7.13.0
-->
* `options` {Object} (optional) Accepts all [`MockAgent`][] options plus the
following snapshot-specific options.
* `mode` {string} The snapshot mode. One of `'record'`, `'playback'`, or
`'update'`. **Default:** `'record'`.
* `snapshotPath` {string} Path to the snapshot file used for loading and
saving. Required when `mode` is `'playback'` or `'update'`. **Default:**
`null`.
* `maxSnapshots` {number} Maximum number of snapshots to keep in memory.
**Default:** `Infinity`.
* `autoFlush` {boolean} When `true`, snapshots are written to `snapshotPath`
automatically as they are recorded. **Default:** `false`.
* `flushInterval` {number} Interval, in milliseconds, between automatic flushes
when `autoFlush` is enabled. **Default:** `30000`.
* `matchHeaders` {string[]} Names of the only headers to include when matching
a request against a snapshot. When omitted, all headers are matched.
* `ignoreHeaders` {string[]} Header names to ignore when matching a request.
* `excludeHeaders` {string[]} Header names to strip from snapshots entirely,
so that sensitive values are never written to disk.
* `matchBody` {boolean} When `true`, the request body is included in request
matching. **Default:** `true`.
* `normalizeBody` {Function} Normalizes the request body before it is matched
or stored, for example to strip volatile fields such as timestamps. Only
applied when `matchBody` is `true`.
* `body` {string|Buffer|null|undefined} The raw request body.
* Returns: {string} The normalized body used for matching.
* `matchQuery` {boolean} When `true`, query parameters are included in request
matching. **Default:** `true`.
* `normalizeQuery` {Function} Normalizes the query string before it is matched,
for example to strip cache-busting parameters. Only applied when `matchQuery`
is `true`.
* `query` {URLSearchParams} The parsed query parameters.
* Returns: {string} The normalized query string used for matching.
* `caseSensitive` {boolean} When `true`, header matching is case-sensitive.
**Default:** `false`.
* `shouldRecord` {Function} Decides whether a given request is recorded. Only
used in `'record'` and `'update'` modes.
* `requestOpts` {Object} The dispatch options of the request.
* Returns: {boolean} `true` to record the request.
* `shouldPlayback` {Function} Decides whether a given request is served from a
snapshot. Only used in `'playback'` and `'update'` modes.
* `requestOpts` {Object} The dispatch options of the request.
* Returns: {boolean} `true` to play the request back from a snapshot.
* `excludeUrls` {Array<string|RegExp>} URL patterns that are excluded from
recording and playback. String patterns match case-insensitively as
substrings of the URL; `RegExp` patterns are tested against the URL. Matching
requests are passed through to a real [`Agent`][] instead.
Creates a new `SnapshotAgent`. Throws an [`InvalidArgumentError`][] when `mode`
is `'playback'` or `'update'` and `snapshotPath` is not provided, and throws an
`InvalidArgumentError` when `mode` is not one of the supported values.
When `mode` is `'playback'` or `'update'` and `snapshotPath` is set, snapshots
are loaded from the file automatically; a missing file is ignored until the first
request requires it.
```mjs
import { SnapshotAgent, setGlobalDispatcher } from 'undici'
const agent = new SnapshotAgent({
mode: 'playback',
snapshotPath: './snapshots/api.json'
})
setGlobalDispatcher(agent)
```
The mode controls how requests are handled:
* `'record'` performs the real request and stores the response.
```mjs
import { SnapshotAgent, setGlobalDispatcher, fetch } from 'undici'
const agent = new SnapshotAgent({
mode: 'record',
snapshotPath: './snapshots/api.json'
})
setGlobalDispatcher(agent)
await fetch('https://api.example.com/users')
await agent.saveSnapshots()
```
* `'playback'` serves the recorded response without any network access. A
request with no matching snapshot rejects with an [`UndiciError`][] whose
message begins with `No snapshot found`.
```mjs
import { SnapshotAgent, setGlobalDispatcher, fetch } from 'undici'
const agent = new SnapshotAgent({
mode: 'playback',
snapshotPath: './snapshots/api.json'
})
setGlobalDispatcher(agent)
const response = await fetch('https://api.example.com/users')
```
* `'update'` replays an existing snapshot when one is found and otherwise records
the request like `'record'` mode.
```mjs
import { SnapshotAgent, setGlobalDispatcher, fetch } from 'undici'
const agent = new SnapshotAgent({
mode: 'update',
snapshotPath: './snapshots/api.json'
})
setGlobalDispatcher(agent)
await fetch('https://api.example.com/new-endpoint')
```
### `agent.loadSnapshots([filePath])`
<!-- YAML
added: v7.13.0
-->
* `filePath` {string} (optional) Path to read snapshots from. **Default:** the
`snapshotPath` given to the constructor.
* Returns: {Promise<void>} Resolves when the snapshots have been loaded.
Loads snapshots from disk into memory. In `'playback'` mode this also installs
the corresponding [`MockAgent`][] interceptors so that subsequent requests are
matched against the loaded snapshots.
```mjs
await agent.loadSnapshots('./snapshots/api.json')
```
### `agent.saveSnapshots([filePath])`
<!-- YAML
added: v7.13.0
-->
* `filePath` {string} (optional) Path to write snapshots to. **Default:** the
`snapshotPath` given to the constructor.
* Returns: {Promise<void>} Resolves when the snapshots have been written.
Writes all recorded snapshots to disk.
```mjs
await agent.saveSnapshots('./snapshots/api.json')
```
### `agent.getRecorder()`
<!-- YAML
added: v7.13.0
-->
* Returns: {SnapshotRecorder} The internal recorder that stores the captured
interactions.
Returns the underlying `SnapshotRecorder`. The recorder exposes lower-level
operations over the captured data, including `record()`, `findSnapshot()`,
`getSnapshots()`, `size()`, and `clear()`. The recorder is an internal type
returned for inspection; it is not exported from the package root.
```mjs
const recorder = agent.getRecorder()
console.log(`Recorded ${recorder.size()} interactions`)
```
### `agent.getMode()`
<!-- YAML
added: v7.13.0
-->
* Returns: {string} The current mode: `'record'`, `'playback'`, or `'update'`.
Returns the mode the agent was constructed with.
### `agent.clearSnapshots()`
<!-- YAML
added: v7.13.0
-->
* Returns: {undefined}
Removes all snapshots from memory.
```mjs
agent.clearSnapshots()
```
### `agent.resetCallCounts()`
<!-- YAML
added: v7.13.0
-->
* Returns: {undefined}
Resets the call count of every snapshot to zero. Useful between tests when the
same agent is reused, since matching a snapshot in `'playback'` mode increments
its call count.
```mjs
agent.resetCallCounts()
```
### `agent.deleteSnapshot(requestOpts)`
<!-- YAML
added: v7.13.0
-->
* `requestOpts` {Object} Dispatch options identifying the snapshot to remove.
* Returns: {boolean} `true` if a matching snapshot was deleted, `false` if none
was found.
Deletes a single snapshot that matches the given request options.
```mjs
const deleted = agent.deleteSnapshot({
method: 'GET',
origin: 'https://api.example.com',
path: '/users'
})
```
### `agent.getSnapshotInfo(requestOpts)`
<!-- YAML
added: v7.13.0
-->
* `requestOpts` {Object} Dispatch options identifying the snapshot to inspect.
* Returns: {Object|null} Information about the matching snapshot, or `null` when
none is found.
* `hash` {string} The hash used to key the snapshot.
* `request` {Object} The recorded request.
* `method` {string} The request method.
* `url` {string} The request URL.
* `headers` {Record<string, string>} The recorded request headers.
* `body` {string} The recorded request body, when present.
* `responseCount` {number} The number of recorded responses for the request.
* `callCount` {number} The number of times the snapshot has been matched.
* `timestamp` {string} The ISO timestamp at which the snapshot was recorded.
Returns metadata about a snapshot without returning the response payload.
```mjs
const info = agent.getSnapshotInfo({
method: 'GET',
origin: 'https://api.example.com',
path: '/users'
})
```
### `agent.replaceSnapshots(snapshotData)`
<!-- YAML
added: v7.13.0
-->
* `snapshotData` {Array} The snapshot data to load, replacing any existing
snapshots.
* `hash` {string} The hash used to key the snapshot.
* `snapshot` {Object} The snapshot entry.
* Returns: {undefined}
Replaces all in-memory snapshots with the provided data.
```mjs
const recorder = agent.getRecorder()
const snapshots = recorder.getSnapshots()
agent.replaceSnapshots(snapshots.map((snapshot, index) => ({
hash: `snapshot-${index}`,
snapshot
})))
```
### `agent.close()`
<!-- YAML
added: v7.13.0
-->
* Returns: {Promise<void>} Resolves once the agent and its resources are closed.
Closes the agent and releases its resources. In `'record'` and `'update'` modes
the recorder is flushed to disk first. In `'playback'` mode nothing is written,
because matching a snapshot mutates its call count and saving would needlessly
rewrite the snapshot file. The real [`Agent`][], when one was created, and the
underlying [`MockAgent`][] are closed as well.
```mjs
await agent.close()
```
[`Agent`]: Agent.md#class-agent
[`Dispatcher`]: Dispatcher.md#class-dispatcher
[`InvalidArgumentError`]: Errors.md#undicierrorsundiciinvalidargumenterror
[`MockAgent`]: MockAgent.md#class-mockagent
[`UndiciError`]: Errors.md#undicierrorsundicierror
[`agent.getRecorder()`]: #agentgetrecorder
[`setGlobalDispatcher()`]: Dispatcher.md#setglobaldispatcherdispatcher
@@ -0,0 +1,181 @@
import type {
FromPathOption,
NavigateOptions,
PathParamOptions,
SearchParamOptions,
ToPathOption,
} from './link'
import type { RedirectOptions } from './redirect'
import type { RouteIds } from './routeInfo'
import type { AnyRouter, RegisteredRouter } from './router'
import type { UseParamsResult } from './useParams'
import type { UseSearchResult } from './useSearch'
import type { Constrain, ConstrainLiteral } from './utils'
export type ValidateFromPath<
TRouter extends AnyRouter = RegisteredRouter,
TFrom = string,
> = FromPathOption<TRouter, TFrom>
export type ValidateToPath<
TRouter extends AnyRouter = RegisteredRouter,
TTo extends string | undefined = undefined,
TFrom extends string = string,
> = ToPathOption<TRouter, TFrom, TTo>
export type ValidateSearch<
TRouter extends AnyRouter = RegisteredRouter,
TTo extends string | undefined = undefined,
TFrom extends string = string,
> = SearchParamOptions<TRouter, TFrom, TTo>
export type ValidateParams<
TRouter extends AnyRouter = RegisteredRouter,
TTo extends string | undefined = undefined,
TFrom extends string = string,
> = PathParamOptions<TRouter, TFrom, TTo>
/**
* @private
*/
export type InferFrom<
TOptions,
TDefaultFrom extends string = string,
> = TOptions extends {
from: infer TFrom extends string
}
? TFrom
: TDefaultFrom
/**
* @private
*/
export type InferTo<TOptions> = TOptions extends {
to: infer TTo extends string
}
? TTo
: undefined
/**
* @private
*/
export type InferMaskTo<TOptions> = TOptions extends {
mask: { to: infer TTo extends string }
}
? TTo
: ''
export type InferMaskFrom<TOptions> = TOptions extends {
mask: { from: infer TFrom extends string }
}
? TFrom
: string
export type ValidateNavigateOptions<
TRouter extends AnyRouter = RegisteredRouter,
TOptions = unknown,
TDefaultFrom extends string = string,
> = Constrain<
TOptions,
NavigateOptions<
TRouter,
InferFrom<TOptions, TDefaultFrom>,
InferTo<TOptions>,
InferMaskFrom<TOptions>,
InferMaskTo<TOptions>
>
>
export type ValidateNavigateOptionsArray<
TRouter extends AnyRouter = RegisteredRouter,
TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>,
TDefaultFrom extends string = string,
> = {
[K in keyof TOptions]: ValidateNavigateOptions<
TRouter,
TOptions[K],
TDefaultFrom
>
}
export type ValidateRedirectOptions<
TRouter extends AnyRouter = RegisteredRouter,
TOptions = unknown,
TDefaultFrom extends string = string,
> = Constrain<
TOptions,
RedirectOptions<
TRouter,
InferFrom<TOptions, TDefaultFrom>,
InferTo<TOptions>,
InferMaskFrom<TOptions>,
InferMaskTo<TOptions>
>
>
export type ValidateRedirectOptionsArray<
TRouter extends AnyRouter = RegisteredRouter,
TOptions extends ReadonlyArray<any> = ReadonlyArray<unknown>,
TDefaultFrom extends string = string,
> = {
[K in keyof TOptions]: ValidateRedirectOptions<
TRouter,
TOptions[K],
TDefaultFrom
>
}
export type ValidateId<
TRouter extends AnyRouter = RegisteredRouter,
TId extends string = string,
> = ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>
/**
* @private
*/
export type InferStrict<TOptions> = TOptions extends {
strict: infer TStrict extends boolean
}
? TStrict
: true
/**
* @private
*/
export type InferShouldThrow<TOptions> = TOptions extends {
shouldThrow: infer TShouldThrow extends boolean
}
? TShouldThrow
: true
/**
* @private
*/
export type InferSelected<TOptions> = TOptions extends {
select: (...args: Array<any>) => infer TSelected
}
? TSelected
: unknown
export type ValidateUseSearchResult<
TOptions,
TRouter extends AnyRouter = RegisteredRouter,
> = UseSearchResult<
TRouter,
InferFrom<TOptions>,
InferStrict<TOptions>,
InferSelected<TOptions>
>
export type ValidateUseParamsResult<
TOptions,
TRouter extends AnyRouter = RegisteredRouter,
> = Constrain<
TOptions,
UseParamsResult<
TRouter,
InferFrom<TOptions>,
InferStrict<TOptions>,
InferSelected<TOptions>
>
>
@@ -0,0 +1,3 @@
import { RawStream } from './RawStream.cjs';
import { Plugin } from 'seroval';
export declare const defaultSerovalPlugins: (Plugin<Error, any> | Plugin<RawStream, any> | Plugin<ReadableStream<any>, any>)[];
@@ -0,0 +1 @@
{"version":3,"file":"circle-plus.js","sources":["../../../src/icons/circle-plus.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CirclePlus\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgLz4KICA8cGF0aCBkPSJNOCAxMmg4IiAvPgogIDxwYXRoIGQ9Ik0xMiA4djgiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/circle-plus\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 CirclePlus = createLucideIcon('CirclePlus', [\n ['circle', { cx: '12', cy: '12', r: '10', key: '1mglay' }],\n ['path', { d: 'M8 12h8', key: '1wcyev' }],\n ['path', { d: 'M12 8v8', key: 'napkw2' }],\n]);\n\nexport default CirclePlus;\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,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,CAAA,CAAM,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACzD,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,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC1C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,13 @@
import { complex } from './index.mjs';
const mask = {
...complex,
getAnimatableNone: (v) => {
const parsed = complex.parse(v);
const transformer = complex.createTransformer(v);
return transformer(parsed.map((v) => typeof v === "number" ? 0 : typeof v === "object" ? { ...v, alpha: 1 } : v));
},
};
export { mask };
//# sourceMappingURL=mask.mjs.map
@@ -0,0 +1,236 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = applyDecs2311;
var _checkInRHS = require("./checkInRHS.js");
var _setFunctionName = require("./setFunctionName.js");
var _toPropertyKey = require("./toPropertyKey.js");
function applyDecs2311(targetClass, classDecs, memberDecs, classDecsHaveThis, instanceBrand, parentClass) {
var symbolMetadata = Symbol.metadata || Symbol["for"]("Symbol.metadata");
var defineProperty = Object.defineProperty;
var create = Object.create;
var metadata;
var existingNonFields = [create(null), create(null)];
var hasClassDecs = classDecs.length;
var _;
function createRunInitializers(initializers, useStaticThis, hasValue) {
return function (thisArg, value) {
if (useStaticThis) {
value = thisArg;
thisArg = targetClass;
}
for (var i = 0; i < initializers.length; i++) {
value = initializers[i].apply(thisArg, hasValue ? [value] : []);
}
return hasValue ? value : thisArg;
};
}
function assertCallable(fn, hint1, hint2, throwUndefined) {
if (typeof fn !== "function") {
if (throwUndefined || fn !== void 0) {
throw new TypeError(hint1 + " must " + (hint2 || "be") + " a function" + (throwUndefined ? "" : " or undefined"));
}
}
return fn;
}
function applyDec(Class, decInfo, decoratorsHaveThis, name, kind, initializers, ret, isStatic, isPrivate, isField, hasPrivateBrand) {
function assertInstanceIfPrivate(target) {
if (!hasPrivateBrand(target)) {
throw new TypeError("Attempted to access private element on non-instance");
}
}
var decs = [].concat(decInfo[0]),
decVal = decInfo[3],
isClass = !ret;
var isAccessor = kind === 1;
var isGetter = kind === 3;
var isSetter = kind === 4;
var isMethod = kind === 2;
function _bindPropCall(name, useStaticThis, before) {
return function (_this, value) {
if (useStaticThis) {
value = _this;
_this = Class;
}
if (before) {
before(_this);
}
return desc[name].call(_this, value);
};
}
if (!isClass) {
var desc = {},
init = [],
key = isGetter ? "get" : isSetter || isAccessor ? "set" : "value";
if (isPrivate) {
if (isField || isAccessor) {
desc = {
get: (0, _setFunctionName.default)(function () {
return decVal(this);
}, name, "get"),
set: function (value) {
decInfo[4](this, value);
}
};
} else {
desc[key] = decVal;
}
if (!isField) {
(0, _setFunctionName.default)(desc[key], name, isMethod ? "" : key);
}
} else if (!isField) {
desc = Object.getOwnPropertyDescriptor(Class, name);
}
if (!isField && !isPrivate) {
_ = existingNonFields[+isStatic][name];
if (_ && (_ ^ kind) !== 7) {
throw new Error("Decorating two elements with the same name (" + desc[key].name + ") is not supported yet");
}
existingNonFields[+isStatic][name] = kind < 3 ? 1 : kind;
}
}
var newValue = Class;
for (var i = decs.length - 1; i >= 0; i -= decoratorsHaveThis ? 2 : 1) {
var dec = assertCallable(decs[i], "A decorator", "be", true),
decThis = decoratorsHaveThis ? decs[i - 1] : void 0;
var decoratorFinishedRef = {};
var ctx = {
kind: ["field", "accessor", "method", "getter", "setter", "class"][kind],
name: name,
metadata: metadata,
addInitializer: function (decoratorFinishedRef, initializer) {
if (decoratorFinishedRef.v) {
throw new TypeError("attempted to call addInitializer after decoration was finished");
}
assertCallable(initializer, "An initializer", "be", true);
initializers.push(initializer);
}.bind(null, decoratorFinishedRef)
};
if (isClass) {
_ = dec.call(decThis, newValue, ctx);
decoratorFinishedRef.v = 1;
if (assertCallable(_, "class decorators", "return")) {
newValue = _;
}
} else {
ctx["static"] = isStatic;
ctx["private"] = isPrivate;
_ = ctx.access = {
has: isPrivate ? hasPrivateBrand.bind() : function (target) {
return name in target;
}
};
if (!isSetter) {
_.get = isPrivate ? isMethod ? function (_this) {
assertInstanceIfPrivate(_this);
return desc.value;
} : _bindPropCall("get", 0, assertInstanceIfPrivate) : function (target) {
return target[name];
};
}
if (!isMethod && !isGetter) {
_.set = isPrivate ? _bindPropCall("set", 0, assertInstanceIfPrivate) : function (target, v) {
target[name] = v;
};
}
newValue = dec.call(decThis, isAccessor ? {
get: desc.get,
set: desc.set
} : desc[key], ctx);
decoratorFinishedRef.v = 1;
if (isAccessor) {
if (typeof newValue === "object" && newValue) {
if (_ = assertCallable(newValue.get, "accessor.get")) {
desc.get = _;
}
if (_ = assertCallable(newValue.set, "accessor.set")) {
desc.set = _;
}
if (_ = assertCallable(newValue.init, "accessor.init")) {
init.unshift(_);
}
} else if (newValue !== void 0) {
throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
}
} else if (assertCallable(newValue, (isField ? "field" : "method") + " decorators", "return")) {
if (isField) {
init.unshift(newValue);
} else {
desc[key] = newValue;
}
}
}
}
if (kind < 2) {
ret.push(createRunInitializers(init, isStatic, 1), createRunInitializers(initializers, isStatic, 0));
}
if (!isField && !isClass) {
if (isPrivate) {
if (isAccessor) {
ret.splice(-1, 0, _bindPropCall("get", isStatic), _bindPropCall("set", isStatic));
} else {
ret.push(isMethod ? desc[key] : assertCallable.call.bind(desc[key]));
}
} else {
defineProperty(Class, name, desc);
}
}
return newValue;
}
function applyMemberDecs() {
var ret = [];
var protoInitializers;
var staticInitializers;
var pushInitializers = function (initializers) {
if (initializers) {
ret.push(createRunInitializers(initializers));
}
};
var applyMemberDecsOfKind = function (isStatic, isField) {
for (var i = 0; i < memberDecs.length; i++) {
var decInfo = memberDecs[i];
var kind = decInfo[1];
var kindOnly = kind & 7;
if ((kind & 8) == isStatic && !kindOnly == isField) {
var name = decInfo[2];
var isPrivate = !!decInfo[3];
var decoratorsHaveThis = kind & 16;
applyDec(isStatic ? targetClass : targetClass.prototype, decInfo, decoratorsHaveThis, isPrivate ? "#" + name : (0, _toPropertyKey.default)(name), kindOnly, kindOnly < 2 ? [] : isStatic ? staticInitializers = staticInitializers || [] : protoInitializers = protoInitializers || [], ret, !!isStatic, isPrivate, isField, isStatic && isPrivate ? function (_) {
return (0, _checkInRHS.default)(_) === targetClass;
} : instanceBrand);
}
}
};
applyMemberDecsOfKind(8, 0);
applyMemberDecsOfKind(0, 0);
applyMemberDecsOfKind(8, 1);
applyMemberDecsOfKind(0, 1);
pushInitializers(protoInitializers);
pushInitializers(staticInitializers);
return ret;
}
function defineMetadata(Class) {
return defineProperty(Class, symbolMetadata, {
configurable: true,
enumerable: true,
value: metadata
});
}
if (parentClass !== undefined) {
metadata = parentClass[symbolMetadata];
}
metadata = create(metadata == null ? null : metadata);
_ = applyMemberDecs();
if (!hasClassDecs) defineMetadata(targetClass);
return {
e: _,
get c() {
var initializers = [];
return hasClassDecs && [defineMetadata(targetClass = applyDec(targetClass, [classDecs], classDecsHaveThis, targetClass.name, 5, initializers)), createRunInitializers(initializers, 1)];
}
};
}
//# sourceMappingURL=applyDecs2311.js.map
@@ -0,0 +1,26 @@
{
"name": "@istanbuljs/schema",
"version": "0.1.6",
"description": "Schemas describing various structures used by nyc and istanbuljs",
"main": "index.js",
"scripts": {
"test": "nyc node --test test/test.js",
"test:update-snapshots": "nyc node --test --test-update-snapshots test/test.js"
},
"engines": {
"node": ">=8"
},
"author": "Corey Farrell",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/istanbuljs/schema.git"
},
"bugs": {
"url": "https://github.com/istanbuljs/schema/issues"
},
"homepage": "https://github.com/istanbuljs/schema#readme",
"devDependencies": {
"nyc": "^18.0.0"
}
}
@@ -0,0 +1 @@
{"version":3,"file":"arrow-big-down-dash.js","sources":["../../../src/icons/arrow-big-down-dash.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ArrowBigDownDash\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTUgNUg5IiAvPgogIDxwYXRoIGQ9Ik0xNSA5djNoNGwtNyA3LTctN2g0Vjl6IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/arrow-big-down-dash\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 ArrowBigDownDash = createLucideIcon('ArrowBigDownDash', [\n ['path', { d: 'M15 5H9', key: '1tp3ed' }],\n ['path', { d: 'M15 9v3h4l-7 7-7-7h4V9z', key: 'ncdc4b' }],\n]);\n\nexport default ArrowBigDownDash;\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,CAAmB,iBAAiB,kBAAoB,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5D,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,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;AAC1D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,25 @@
/**
* @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 WineOff = createLucideIcon("WineOff", [
["path", { d: "M8 22h8", key: "rmew8v" }],
["path", { d: "M7 10h3m7 0h-1.343", key: "v48bem" }],
["path", { d: "M12 15v7", key: "t2xh3l" }],
[
"path",
{
d: "M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198",
key: "1ymjlu"
}
],
["line", { x1: "2", x2: "22", y1: "2", y2: "22", key: "a6p6uj" }]
]);
export { WineOff as default };
//# sourceMappingURL=wine-off.js.map
@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'no-unsafe-declaration-merging',
meta: {
type: 'problem',
docs: {
description: 'Disallow unsafe declaration merging',
recommended: 'recommended',
requiresTypeChecking: false,
},
messages: {
unsafeMerging: 'Unsafe declaration merging between classes and interfaces.',
},
schema: [],
},
defaultOptions: [],
create(context) {
function checkUnsafeDeclaration(scope, node, unsafeKind) {
const variable = scope.set.get(node.name);
if (!variable) {
return;
}
const defs = variable.defs;
if (defs.length <= 1) {
return;
}
if (defs.some(def => def.node.type === unsafeKind)) {
context.report({
node,
messageId: 'unsafeMerging',
});
}
}
return {
ClassDeclaration(node) {
if (node.id) {
// by default eslint returns the inner class scope for the ClassDeclaration node
// but we want the outer scope within which merged variables will sit
const currentScope = context.sourceCode.getScope(node).upper;
if (currentScope == null) {
return;
}
checkUnsafeDeclaration(currentScope, node.id, utils_1.AST_NODE_TYPES.TSInterfaceDeclaration);
}
},
TSInterfaceDeclaration(node) {
checkUnsafeDeclaration(context.sourceCode.getScope(node), node.id, utils_1.AST_NODE_TYPES.ClassDeclaration);
},
};
},
});
@@ -0,0 +1,6 @@
//#region src/isServer/development.ts
const isServer = void 0;
//#endregion
export { isServer };
//# sourceMappingURL=development.js.map
@@ -0,0 +1,16 @@
/**
* @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 Clock2 = createLucideIcon("Clock2", [
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
["polyline", { points: "12 6 12 12 16 10", key: "1g230d" }]
]);
export { Clock2 as default };
//# sourceMappingURL=clock-2.js.map
@@ -0,0 +1,561 @@
import { createBox, frame, eachAxis, measurePageBox, convertBoxToBoundingBox, convertBoundingBoxToBox, addValueToWillChange, animateMotionValue, mixNumber, addDomEvent, setDragLock, percent, calcLength, resize, isElementTextInput } from 'motion-dom';
import { invariant } from 'motion-utils';
import { addPointerEvent } from '../../events/add-pointer-event.mjs';
import { extractEventInfo } from '../../events/event-info.mjs';
import { getContextWindow } from '../../utils/get-context-window.mjs';
import { isRefObject } from '../../utils/is-ref-object.mjs';
import { PanSession } from '../pan/PanSession.mjs';
import { applyConstraints, calcRelativeConstraints, resolveDragElastic, rebaseAxisConstraints, calcViewportConstraints, calcOrigin, defaultElastic } from './utils/constraints.mjs';
const elementDragControls = new WeakMap();
class VisualElementDragControls {
constructor(visualElement) {
this.openDragLock = null;
this.isDragging = false;
this.currentDirection = null;
this.originPoint = { x: 0, y: 0 };
/**
* The permitted boundaries of travel, in pixels.
*/
this.constraints = false;
this.hasMutatedConstraints = false;
/**
* The per-axis resolved elastic values.
*/
this.elastic = createBox();
/**
* The latest pointer event. Used as fallback when the `cancel` and `stop` functions are called without arguments.
*/
this.latestPointerEvent = null;
/**
* The latest pan info. Used as fallback when the `cancel` and `stop` functions are called without arguments.
*/
this.latestPanInfo = null;
this.visualElement = visualElement;
}
start(originEvent, { snapToCursor = false, distanceThreshold } = {}) {
/**
* Don't start dragging if this component is exiting
*/
const { presenceContext } = this.visualElement;
if (presenceContext && presenceContext.isPresent === false)
return;
const onSessionStart = (event) => {
if (snapToCursor) {
this.snapToCursor(extractEventInfo(event).point);
}
this.stopAnimation();
};
const onStart = (event, info) => {
// Attempt to grab the global drag gesture lock - maybe make this part of PanSession
const { drag, dragPropagation, onDragStart } = this.getProps();
if (drag && !dragPropagation) {
if (this.openDragLock)
this.openDragLock();
this.openDragLock = setDragLock(drag);
// If we don 't have the lock, don't start dragging
if (!this.openDragLock)
return;
}
this.latestPointerEvent = event;
this.latestPanInfo = info;
this.isDragging = true;
this.currentDirection = null;
this.resolveConstraints();
if (this.visualElement.projection) {
this.visualElement.projection.isAnimationBlocked = true;
this.visualElement.projection.target = undefined;
}
/**
* Record gesture origin and pointer offset
*/
eachAxis((axis) => {
let current = this.getAxisMotionValue(axis).get() || 0;
/**
* If the MotionValue is a percentage value convert to px
*/
if (percent.test(current)) {
const { projection } = this.visualElement;
if (projection && projection.layout) {
const measuredAxis = projection.layout.layoutBox[axis];
if (measuredAxis) {
const length = calcLength(measuredAxis);
current = length * (parseFloat(current) / 100);
}
}
}
this.originPoint[axis] = current;
});
// Fire onDragStart event
if (onDragStart) {
frame.update(() => onDragStart(event, info), false, true);
}
addValueToWillChange(this.visualElement, "transform");
const { animationState } = this.visualElement;
animationState && animationState.setActive("whileDrag", true);
};
const onMove = (event, info) => {
this.latestPointerEvent = event;
this.latestPanInfo = info;
const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
// If we didn't successfully receive the gesture lock, early return.
if (!dragPropagation && !this.openDragLock)
return;
const { offset } = info;
// Attempt to detect drag direction if directionLock is true
if (dragDirectionLock && this.currentDirection === null) {
this.currentDirection = getCurrentDirection(offset);
// If we've successfully set a direction, notify listener
if (this.currentDirection !== null) {
onDirectionLock && onDirectionLock(this.currentDirection);
}
return;
}
// Update each point with the latest position
this.updateAxis("x", info.point, offset);
this.updateAxis("y", info.point, offset);
/**
* Ideally we would leave the renderer to fire naturally at the end of
* this frame but if the element is about to change layout as the result
* of a re-render we want to ensure the browser can read the latest
* bounding box to ensure the pointer and element don't fall out of sync.
*/
this.visualElement.render();
/**
* This must fire after the render call as it might trigger a state
* change which itself might trigger a layout update.
*/
if (onDrag) {
frame.update(() => onDrag(event, info), false, true);
}
};
const onSessionEnd = (event, info) => {
this.latestPointerEvent = event;
this.latestPanInfo = info;
this.stop(event, info);
this.latestPointerEvent = null;
this.latestPanInfo = null;
};
const resumeAnimation = () => {
const { dragSnapToOrigin: snap } = this.getProps();
if (snap || this.constraints) {
this.startAnimation({ x: 0, y: 0 });
}
};
const { dragSnapToOrigin } = this.getProps();
this.panSession = new PanSession(originEvent, {
onSessionStart,
onStart,
onMove,
onSessionEnd,
resumeAnimation,
}, {
transformPagePoint: this.visualElement.getTransformPagePoint(),
dragSnapToOrigin,
distanceThreshold,
contextWindow: getContextWindow(this.visualElement),
element: this.visualElement.current,
});
}
/**
* @internal
*/
stop(event, panInfo) {
const finalEvent = event || this.latestPointerEvent;
const finalPanInfo = panInfo || this.latestPanInfo;
const isDragging = this.isDragging;
this.cancel();
if (!isDragging || !finalPanInfo || !finalEvent)
return;
const { velocity } = finalPanInfo;
this.startAnimation(velocity);
const { onDragEnd } = this.getProps();
if (onDragEnd) {
frame.postRender(() => onDragEnd(finalEvent, finalPanInfo));
}
}
/**
* @internal
*/
cancel() {
this.isDragging = false;
const { projection, animationState } = this.visualElement;
if (projection) {
projection.isAnimationBlocked = false;
}
this.endPanSession();
const { dragPropagation } = this.getProps();
if (!dragPropagation && this.openDragLock) {
this.openDragLock();
this.openDragLock = null;
}
animationState && animationState.setActive("whileDrag", false);
}
/**
* Clean up the pan session without modifying other drag state.
* This is used during unmount to ensure event listeners are removed
* without affecting projection animations or drag locks.
* @internal
*/
endPanSession() {
this.panSession && this.panSession.end();
this.panSession = undefined;
}
updateAxis(axis, _point, offset) {
const { drag } = this.getProps();
// If we're not dragging this axis, do an early return.
if (!offset || !shouldDrag(axis, drag, this.currentDirection))
return;
const axisValue = this.getAxisMotionValue(axis);
let next = this.originPoint[axis] + offset[axis];
// Apply constraints
if (this.constraints && this.constraints[axis]) {
next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);
}
axisValue.set(next);
}
resolveConstraints() {
const { dragConstraints, dragElastic } = this.getProps();
const layout = this.visualElement.projection &&
!this.visualElement.projection.layout
? this.visualElement.projection.measure(false)
: this.visualElement.projection?.layout;
const prevConstraints = this.constraints;
if (dragConstraints && isRefObject(dragConstraints)) {
if (!this.constraints) {
this.constraints = this.resolveRefConstraints();
}
}
else {
if (dragConstraints && layout) {
this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints);
}
else {
this.constraints = false;
}
}
this.elastic = resolveDragElastic(dragElastic);
/**
* If we're outputting to external MotionValues, we want to rebase the measured constraints
* from viewport-relative to component-relative. This only applies to relative (non-ref)
* constraints, as ref-based constraints from calcViewportConstraints are already in the
* correct coordinate space for the motion value transform offset.
*/
if (prevConstraints !== this.constraints &&
!isRefObject(dragConstraints) &&
layout &&
this.constraints &&
!this.hasMutatedConstraints) {
eachAxis((axis) => {
if (this.constraints !== false &&
this.getAxisMotionValue(axis)) {
this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]);
}
});
}
}
resolveRefConstraints() {
const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();
if (!constraints || !isRefObject(constraints))
return false;
const constraintsElement = constraints.current;
invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
const { projection } = this.visualElement;
// TODO
if (!projection || !projection.layout)
return false;
const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());
let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox);
/**
* If there's an onMeasureDragConstraints listener we call it and
* if different constraints are returned, set constraints to that
*/
if (onMeasureDragConstraints) {
const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));
this.hasMutatedConstraints = !!userConstraints;
if (userConstraints) {
measuredConstraints = convertBoundingBoxToBox(userConstraints);
}
}
return measuredConstraints;
}
startAnimation(velocity) {
const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps();
const constraints = this.constraints || {};
const momentumAnimations = eachAxis((axis) => {
if (!shouldDrag(axis, drag, this.currentDirection)) {
return;
}
let transition = (constraints && constraints[axis]) || {};
if (dragSnapToOrigin === true ||
dragSnapToOrigin === axis)
transition = { min: 0, max: 0 };
/**
* Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame
* of spring animations so we should look into adding a disable spring option to `inertia`.
* We could do something here where we affect the `bounceStiffness` and `bounceDamping`
* using the value of `dragElastic`.
*/
const bounceStiffness = dragElastic ? 200 : 1000000;
const bounceDamping = dragElastic ? 40 : 10000000;
const inertia = {
type: "inertia",
velocity: dragMomentum ? velocity[axis] : 0,
bounceStiffness,
bounceDamping,
timeConstant: 750,
restDelta: 1,
restSpeed: 10,
...dragTransition,
...transition,
};
// If we're not animating on an externally-provided `MotionValue` we can use the
// component's animation controls which will handle interactions with whileHover (etc),
// otherwise we just have to animate the `MotionValue` itself.
return this.startAxisValueAnimation(axis, inertia);
});
// Run all animations and then resolve the new drag constraints.
return Promise.all(momentumAnimations).then(onDragTransitionEnd);
}
startAxisValueAnimation(axis, transition) {
const axisValue = this.getAxisMotionValue(axis);
addValueToWillChange(this.visualElement, axis);
return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false));
}
stopAnimation() {
eachAxis((axis) => this.getAxisMotionValue(axis).stop());
}
/**
* Drag works differently depending on which props are provided.
*
* - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
* - Otherwise, we apply the delta to the x/y motion values.
*/
getAxisMotionValue(axis) {
const dragKey = `_drag${axis.toUpperCase()}`;
const props = this.visualElement.getProps();
const externalMotionValue = props[dragKey];
return externalMotionValue
? externalMotionValue
: this.visualElement.getValue(axis, (props.initial
? props.initial[axis]
: undefined) || 0);
}
snapToCursor(point) {
eachAxis((axis) => {
const { drag } = this.getProps();
// If we're not dragging this axis, do an early return.
if (!shouldDrag(axis, drag, this.currentDirection))
return;
const { projection } = this.visualElement;
const axisValue = this.getAxisMotionValue(axis);
if (projection && projection.layout) {
const { min, max } = projection.layout.layoutBox[axis];
/**
* The layout measurement includes the current transform value,
* so we need to add it back to get the correct snap position.
* This fixes an issue where elements with initial coordinates
* would snap to the wrong position on the first drag.
*/
const current = axisValue.get() || 0;
axisValue.set(point[axis] - mixNumber(min, max, 0.5) + current);
}
});
}
/**
* When the viewport resizes we want to check if the measured constraints
* have changed and, if so, reposition the element within those new constraints
* relative to where it was before the resize.
*/
scalePositionWithinConstraints() {
if (!this.visualElement.current)
return;
const { drag, dragConstraints } = this.getProps();
const { projection } = this.visualElement;
if (!isRefObject(dragConstraints) || !projection || !this.constraints)
return;
/**
* Stop current animations as there can be visual glitching if we try to do
* this mid-animation
*/
this.stopAnimation();
/**
* Record the relative position of the dragged element relative to the
* constraints box and save as a progress value.
*/
const boxProgress = { x: 0, y: 0 };
eachAxis((axis) => {
const axisValue = this.getAxisMotionValue(axis);
if (axisValue && this.constraints !== false) {
const latest = axisValue.get();
boxProgress[axis] = calcOrigin({ min: latest, max: latest }, this.constraints[axis]);
}
});
/**
* Update the layout of this element and resolve the latest drag constraints
*/
const { transformTemplate } = this.visualElement.getProps();
this.visualElement.current.style.transform = transformTemplate
? transformTemplate({}, "")
: "none";
projection.root && projection.root.updateScroll();
projection.updateLayout();
/**
* Reset constraints so resolveConstraints() will recalculate them
* with the freshly measured layout rather than returning the cached value.
*/
this.constraints = false;
this.resolveConstraints();
/**
* For each axis, calculate the current progress of the layout axis
* within the new constraints.
*/
eachAxis((axis) => {
if (!shouldDrag(axis, drag, null))
return;
/**
* Calculate a new transform based on the previous box progress
*/
const axisValue = this.getAxisMotionValue(axis);
const { min, max } = this.constraints[axis];
axisValue.set(mixNumber(min, max, boxProgress[axis]));
});
/**
* Flush the updated transform to the DOM synchronously to prevent
* a visual flash at the element's CSS layout position (0,0) when
* the transform was stripped for measurement.
*/
this.visualElement.render();
}
addListeners() {
if (!this.visualElement.current)
return;
elementDragControls.set(this.visualElement, this);
const element = this.visualElement.current;
/**
* Attach a pointerdown event listener on this DOM element to initiate drag tracking.
*/
const stopPointerListener = addPointerEvent(element, "pointerdown", (event) => {
const { drag, dragListener = true } = this.getProps();
const target = event.target;
/**
* Only block drag if clicking on a text input child element
* (input, textarea, select, contenteditable) where users might
* want to select text or interact with the control.
*
* Buttons and links don't block drag since they don't have
* click-and-move actions of their own.
*/
const isClickingTextInputChild = target !== element && isElementTextInput(target);
if (drag && dragListener && !isClickingTextInputChild) {
this.start(event);
}
});
/**
* If using ref-based constraints, observe both the draggable element
* and the constraint container for size changes via ResizeObserver.
* Setup is deferred because dragConstraints.current is null when
* addListeners first runs (React hasn't committed the ref yet).
*/
let stopResizeObservers;
const measureDragConstraints = () => {
const { dragConstraints } = this.getProps();
if (isRefObject(dragConstraints) && dragConstraints.current) {
this.constraints = this.resolveRefConstraints();
if (!stopResizeObservers) {
stopResizeObservers = startResizeObservers(element, dragConstraints.current, () => this.scalePositionWithinConstraints());
}
}
};
const { projection } = this.visualElement;
const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints);
if (projection && !projection.layout) {
projection.root && projection.root.updateScroll();
projection.updateLayout();
}
frame.read(measureDragConstraints);
/**
* Attach a window resize listener to scale the draggable target within its defined
* constraints as the window resizes.
*/
const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints());
/**
* If the element's layout changes, calculate the delta and apply that to
* the drag gesture's origin point.
*/
const stopLayoutUpdateListener = projection.addEventListener("didUpdate", (({ delta, hasLayoutChanged }) => {
if (this.isDragging && hasLayoutChanged) {
eachAxis((axis) => {
const motionValue = this.getAxisMotionValue(axis);
if (!motionValue)
return;
this.originPoint[axis] += delta[axis].translate;
motionValue.set(motionValue.get() + delta[axis].translate);
});
this.visualElement.render();
}
}));
return () => {
stopResizeListener();
stopPointerListener();
stopMeasureLayoutListener();
stopLayoutUpdateListener && stopLayoutUpdateListener();
stopResizeObservers && stopResizeObservers();
};
}
getProps() {
const props = this.visualElement.getProps();
const { drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true, } = props;
return {
...props,
drag,
dragDirectionLock,
dragPropagation,
dragConstraints,
dragElastic,
dragMomentum,
};
}
}
function skipFirstCall(callback) {
let isFirst = true;
return () => {
if (isFirst) {
isFirst = false;
return;
}
callback();
};
}
function startResizeObservers(element, constraintsElement, onResize) {
const stopElement = resize(element, skipFirstCall(onResize));
const stopContainer = resize(constraintsElement, skipFirstCall(onResize));
return () => {
stopElement();
stopContainer();
};
}
function shouldDrag(direction, drag, currentDirection) {
return ((drag === true || drag === direction) &&
(currentDirection === null || currentDirection === direction));
}
/**
* Based on an x/y offset determine the current drag direction. If both axis' offsets are lower
* than the provided threshold, return `null`.
*
* @param offset - The x/y offset from origin.
* @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.
*/
function getCurrentDirection(offset, lockThreshold = 10) {
let direction = null;
if (Math.abs(offset.y) > lockThreshold) {
direction = "y";
}
else if (Math.abs(offset.x) > lockThreshold) {
direction = "x";
}
return direction;
}
export { VisualElementDragControls, elementDragControls };
//# sourceMappingURL=VisualElementDragControls.mjs.map
@@ -0,0 +1,4 @@
import { AnyRouter } from '@tanstack/router-core';
export declare function RouterServer<TRouter extends AnyRouter>(props: {
router: TRouter;
}): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_z","132":"B"},B:{"1":"_J"},C:{"1":"_LJ _bF","2":"_TK","66":"_NB _8G yB"},D:{"1":"_H _GC","2":"_6N","33":"_EC","66":"_AC _VQ"},E:{"1":"_VL","2":"_qH"},F:{"1":"_a","2":"_T"},G:{"2":"_IF","260":"_TE"},H:{"2":"1D"},I:{"1":"_YD","2":"_wG"},J:{"2":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"1":"B","2":"A"},O:{"1":"bC"},P:{"1":"_sF","2":"_4F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:2,C:"Media Source Extensions",D:true};
@@ -0,0 +1,27 @@
import { f as createRule } from "../utils.js";
var wrap_regex_default = createRule({
name: "wrap-regex",
meta: {
type: "layout",
docs: { description: "Require parenthesis around regex literals" },
fixable: "code",
schema: [],
messages: { requireParens: "Wrap the regexp literal in parens to disambiguate the slash." }
},
create(context) {
const sourceCode = context.sourceCode;
return { Literal(node) {
if (sourceCode.getFirstToken(node).type === "RegularExpression") {
const beforeToken = sourceCode.getTokenBefore(node);
const afterToken = sourceCode.getTokenAfter(node);
const { parent } = node;
if (parent.type === "MemberExpression" && parent.object === node && !(beforeToken && beforeToken.value === "(" && afterToken && afterToken.value === ")")) context.report({
node,
messageId: "requireParens",
fix: (fixer) => fixer.replaceText(node, `(${sourceCode.getText(node)})`)
});
}
} };
}
});
export { wrap_regex_default as t };
@@ -0,0 +1,305 @@
# Chokidar [![Weekly downloads](https://img.shields.io/npm/dw/chokidar.svg)](https://github.com/paulmillr/chokidar)
> Minimal and efficient cross-platform file watching library
## Why?
There are many reasons to prefer Chokidar to raw fs.watch / fs.watchFile in 2024:
- Events are properly reported
- macOS events report filenames
- events are not reported twice
- changes are reported as add / change / unlink instead of useless `rename`
- Atomic writes are supported, using `atomic` option
- Some file editors use them
- Chunked writes are supported, using `awaitWriteFinish` option
- Large files are commonly written in chunks
- File / dir filtering is supported
- Symbolic links are supported
- Recursive watching is always supported, instead of partial when using raw events
- Includes a way to limit recursion depth
Chokidar relies on the Node.js core `fs` module, but when using
`fs.watch` and `fs.watchFile` for watching, it normalizes the events it
receives, often checking for truth by getting file stats and/or dir contents.
The `fs.watch`-based implementation is the default, which
avoids polling and keeps CPU usage down. Be advised that chokidar will initiate
watchers recursively for everything within scope of the paths that have been
specified, so be judicious about not wasting system resources by watching much
more than needed. For some cases, `fs.watchFile`, which utilizes polling and uses more resources, is used.
Made for [Brunch](https://brunch.io/) in 2012,
it is now used in [~30 million repositories](https://www.npmjs.com/browse/depended/chokidar) and
has proven itself in production environments.
**Sep 2024 update:** v4 is out! It decreases dependency count from 13 to 1, removes
support for globs, adds support for ESM / Common.js modules, and bumps minimum node.js version from v8 to v14.
Check out [upgrading](#upgrading).
## Getting started
Install with npm:
```sh
npm install chokidar
```
Use it in your code:
```javascript
import chokidar from 'chokidar';
// One-liner for current directory
chokidar.watch('.').on('all', (event, path) => {
console.log(event, path);
});
// Extended options
// ----------------
// Initialize watcher.
const watcher = chokidar.watch('file, dir, or array', {
ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js'), // only watch js files
persistent: true
});
// Something to use when events are received.
const log = console.log.bind(console);
// Add event listeners.
watcher
.on('add', path => log(`File ${path} has been added`))
.on('change', path => log(`File ${path} has been changed`))
.on('unlink', path => log(`File ${path} has been removed`));
// More possible events.
watcher
.on('addDir', path => log(`Directory ${path} has been added`))
.on('unlinkDir', path => log(`Directory ${path} has been removed`))
.on('error', error => log(`Watcher error: ${error}`))
.on('ready', () => log('Initial scan complete. Ready for changes'))
.on('raw', (event, path, details) => { // internal
log('Raw event info:', event, path, details);
});
// 'add', 'addDir' and 'change' events also receive stat() results as second
// argument when available: https://nodejs.org/api/fs.html#fs_class_fs_stats
watcher.on('change', (path, stats) => {
if (stats) console.log(`File ${path} changed size to ${stats.size}`);
});
// Watch new files.
watcher.add('new-file');
watcher.add(['new-file-2', 'new-file-3']);
// Get list of actual paths being watched on the filesystem
let watchedPaths = watcher.getWatched();
// Un-watch some files.
await watcher.unwatch('new-file');
// Stop watching. The method is async!
await watcher.close().then(() => console.log('closed'));
// Full list of options. See below for descriptions.
// Do not use this example!
chokidar.watch('file', {
persistent: true,
// ignore .txt files
ignored: (file) => file.endsWith('.txt'),
// watch only .txt files
// ignored: (file, _stats) => _stats?.isFile() && !file.endsWith('.txt'),
awaitWriteFinish: true, // emit single event when chunked writes are completed
atomic: true, // emit proper events when "atomic writes" (mv _tmp file) are used
// The options also allow specifying custom intervals in ms
// awaitWriteFinish: {
// stabilityThreshold: 2000,
// pollInterval: 100
// },
// atomic: 100,
interval: 100,
binaryInterval: 300,
cwd: '.',
depth: 99,
followSymlinks: true,
ignoreInitial: false,
ignorePermissionErrors: false,
usePolling: false,
alwaysStat: false,
});
```
`chokidar.watch(paths, [options])`
* `paths` (string or array of strings). Paths to files, dirs to be watched
recursively.
* `options` (object) Options object as defined below:
#### Persistence
* `persistent` (default: `true`). Indicates whether the process
should continue to run as long as files are being watched.
#### Path filtering
* `ignored` function, regex, or path. Defines files/paths to be ignored.
The whole relative or absolute path is tested, not just filename. If a function with two arguments
is provided, it gets called twice per path - once with a single argument (the path), second
time with two arguments (the path and the
[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
object of that path).
* `ignoreInitial` (default: `false`). If set to `false` then `add`/`addDir` events are also emitted for matching paths while
instantiating the watching as chokidar discovers these file paths (before the `ready` event).
* `followSymlinks` (default: `true`). When `false`, only the
symlinks themselves will be watched for changes instead of following
the link references and bubbling events through the link's path.
* `cwd` (no default). The base directory from which watch `paths` are to be
derived. Paths emitted with events will be relative to this.
#### Performance
* `usePolling` (default: `false`).
Whether to use fs.watchFile (backed by polling), or fs.watch. If polling
leads to high CPU utilization, consider setting this to `false`. It is
typically necessary to **set this to `true` to successfully watch files over
a network**, and it may be necessary to successfully watch files in other
non-standard situations. Setting to `true` explicitly on MacOS overrides the
`useFsEvents` default. You may also set the CHOKIDAR_USEPOLLING env variable
to true (1) or false (0) in order to override this option.
* _Polling-specific settings_ (effective when `usePolling: true`)
* `interval` (default: `100`). Interval of file system polling, in milliseconds. You may also
set the CHOKIDAR_INTERVAL env variable to override this option.
* `binaryInterval` (default: `300`). Interval of file system
polling for binary files.
([see list of binary extensions](https://github.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
* `alwaysStat` (default: `false`). If relying upon the
[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
object that may get passed with `add`, `addDir`, and `change` events, set
this to `true` to ensure it is provided even in cases where it wasn't
already available from the underlying watch events.
* `depth` (default: `undefined`). If set, limits how many levels of
subdirectories will be traversed.
* `awaitWriteFinish` (default: `false`).
By default, the `add` event will fire when a file first appears on disk, before
the entire file has been written. Furthermore, in some cases some `change`
events will be emitted while the file is being written. In some cases,
especially when watching for large files there will be a need to wait for the
write operation to finish before responding to a file creation or modification.
Setting `awaitWriteFinish` to `true` (or a truthy value) will poll file size,
holding its `add` and `change` events until the size does not change for a
configurable amount of time. The appropriate duration setting is heavily
dependent on the OS and hardware. For accurate detection this parameter should
be relatively high, making file watching much less responsive.
Use with caution.
* *`options.awaitWriteFinish` can be set to an object in order to adjust
timing params:*
* `awaitWriteFinish.stabilityThreshold` (default: 2000). Amount of time in
milliseconds for a file size to remain constant before emitting its event.
* `awaitWriteFinish.pollInterval` (default: 100). File size polling interval, in milliseconds.
#### Errors
* `ignorePermissionErrors` (default: `false`). Indicates whether to watch files
that don't have read permissions if possible. If watching fails due to `EPERM`
or `EACCES` with this set to `true`, the errors will be suppressed silently.
* `atomic` (default: `true` if `useFsEvents` and `usePolling` are `false`).
Automatically filters out artifacts that occur when using editors that use
"atomic writes" instead of writing directly to the source file. If a file is
re-added within 100 ms of being deleted, Chokidar emits a `change` event
rather than `unlink` then `add`. If the default of 100 ms does not work well
for you, you can override it by setting `atomic` to a custom value, in
milliseconds.
### Methods & Events
`chokidar.watch()` produces an instance of `FSWatcher`. Methods of `FSWatcher`:
* `.add(path / paths)`: Add files, directories for tracking.
Takes an array of strings or just one string.
* `.on(event, callback)`: Listen for an FS event.
Available events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `ready`,
`raw`, `error`.
Additionally `all` is available which gets emitted with the underlying event
name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully.
* `.unwatch(path / paths)`: Stop watching files or directories.
Takes an array of strings or just one string.
* `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise. Use with `await` to ensure bugs don't happen.
* `.getWatched()`: Returns an object representing all the paths on the file
system being watched by this `FSWatcher` instance. The object's keys are all the
directories (using absolute paths unless the `cwd` option was used), and the
values are arrays of the names of the items contained in each directory.
### CLI
Check out third party [chokidar-cli](https://github.com/open-cli-tools/chokidar-cli),
which allows to execute a command on each change, or get a stdio stream of change events.
## Troubleshooting
Sometimes, Chokidar runs out of file handles, causing `EMFILE` and `ENOSP` errors:
* `bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell`
* `Error: watch /home/ ENOSPC`
There are two things that can cause it.
1. Exhausted file handles for generic fs operations
- Can be solved by using [graceful-fs](https://www.npmjs.com/package/graceful-fs),
which can monkey-patch native `fs` module used by chokidar: `let fs = require('fs'); let grfs = require('graceful-fs'); grfs.gracefulify(fs);`
- Can also be solved by tuning OS: `echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p`.
2. Exhausted file handles for `fs.watch`
- Can't seem to be solved by graceful-fs or OS tuning
- It's possible to start using `usePolling: true`, which will switch backend to resource-intensive `fs.watchFile`
All fsevents-related issues (`WARN optional dep failed`, `fsevents is not a constructor`) are solved by upgrading to v4+.
## Changelog
- **v4 (Sep 2024):** remove glob support and bundled fsevents. Decrease dependency count from 13 to 1. Rewrite in typescript. Bumps minimum node.js requirement to v14+
- **v3 (Apr 2019):** massive CPU & RAM consumption improvements; reduces deps / package size by a factor of 17x and bumps Node.js requirement to v8.16+.
- **v2 (Dec 2017):** globs are now posix-style-only. Tons of bugfixes.
- **v1 (Apr 2015):** glob support, symlink support, tons of bugfixes. Node 0.8+ is supported
- **v0.1 (Apr 2012):** Initial release, extracted from [Brunch](https://github.com/brunch/brunch/blob/9847a065aea300da99bd0753f90354cde9de1261/src/helpers.coffee#L66)
### Upgrading
If you've used globs before and want do replicate the functionality with v4:
```js
// v3
chok.watch('**/*.js');
chok.watch("./directory/**/*");
// v4
chok.watch('.', {
ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js'), // only watch js files
});
chok.watch('./directory');
// other way
import { glob } from 'node:fs/promises';
const watcher = watch(await Array.fromAsync(glob('**/*.js')));
// unwatching
// v3
chok.unwatch('**/*.js');
// v4
chok.unwatch(await glob('**/*.js'));
```
## Also
Why was chokidar named this way? What's the meaning behind it?
>Chowkidar is a transliteration of a Hindi word meaning 'watchman, gatekeeper', चौकीदार. This ultimately comes from Sanskrit _ चतुष्क_ (crossway, quadrangle, consisting-of-four). This word is also used in other languages like Urdu as (چوکیدار) which is widely used in Pakistan and India.
## License
MIT (c) Paul Miller (<https://paulmillr.com>), see [LICENSE](LICENSE) file.
@@ -0,0 +1 @@
{"version":3,"file":"arrow-up.js","sources":["../../../src/icons/arrow-up.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name ArrowUp\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJtNSAxMiA3LTcgNyA3IiAvPgogIDxwYXRoIGQ9Ik0xMiAxOVY1IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/arrow-up\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 ArrowUp = createLucideIcon('ArrowUp', [\n ['path', { d: 'm5 12 7-7 7 7', key: 'hav0vg' }],\n ['path', { d: 'M12 19V5', key: 'x0mq9r' }],\n]);\n\nexport default ArrowUp;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1C,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,CAAA;AAAA,CAAA,CAC9C,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 @@
{"version":3,"file":"parseJson.js","sourceRoot":"","sources":["../../lib/runtime/parseJson.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAW,GAAG,+CAA+C,CAAA;AAEnE,SAAgB,SAAS,CAAC,CAAS,EAAE,GAAW;IAC9C,IAAI,MAA0B,CAAA;IAC9B,SAAS,CAAC,OAAO,GAAG,SAAS,CAAA;IAC7B,IAAI,OAA+B,CAAA;IACnC,IAAI,GAAG;QAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACzB,IAAI,CAAC;QACH,SAAS,CAAC,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC,MAAM,CAAA;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACtB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,GAAG,WAAW,CAAC,IAAI,CAAE,CAAW,CAAC,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,SAAS,CAAC,OAAO,GAAG,gBAAgB,CAAA;YACpC,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;QACnB,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;QACtB,SAAS,CAAC,QAAQ,GAAG,GAAG,GAAG,MAAM,CAAA;QACjC,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACtB,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACZ,SAAS,CAAC,OAAO,GAAG,oBAAoB,CAAC,EAAE,CAAA;YAC3C,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC;AACH,CAAC;AAzBD,8BAyBC;AAED,SAAS,CAAC,OAAO,GAAG,SAA+B,CAAA;AACnD,SAAS,CAAC,QAAQ,GAAG,CAAW,CAAA;AAChC,SAAS,CAAC,IAAI,GAAG,iDAAiD,CAAA;AAElE,SAAgB,eAAe,CAAC,CAAS,EAAE,GAAW,EAAE,SAAkB;IACxE,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,IAAI,CAAS,CAAA;IACb,eAAe,CAAC,OAAO,GAAG,SAAS,CAAA;IACnC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,CAAA;QACb,GAAG,EAAE,CAAA;IACP,CAAC;IACD,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,CAAA;QACb,GAAG,EAAE,CAAA;IACP,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5B,YAAY,EAAE,CAAA;YACd,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC;IACD,IAAI,SAAS,EAAE,CAAC;QACd,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;QAC9B,OAAO,CAAC,MAAM,CAAA;IAChB,CAAC;IACD,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,CAAA;QACb,GAAG,EAAE,CAAA;QACL,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACnB,YAAY,EAAE,CAAA;YACd,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC;IACD,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,CAAA;QACb,GAAG,EAAE,CAAA;QACL,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,CAAC,CAAA;YACX,GAAG,EAAE,CAAA;QACP,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACnB,YAAY,EAAE,CAAA;YACd,OAAO,SAAS,CAAA;QAClB,CAAC;IACH,CAAC;IACD,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;IAC9B,OAAO,CAAC,MAAM,CAAA;IAEd,SAAS,WAAW,CAAC,MAAe;QAClC,IAAI,KAAK,GAAG,KAAK,CAAA;QACjB,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACtF,KAAK,GAAG,IAAI,CAAA;YACZ,MAAM,IAAI,CAAC,CAAA;YACX,GAAG,EAAE,CAAA;QACP,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAED,SAAS,YAAY;QACnB,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;QAC9B,eAAe,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAA;IAC5F,CAAC;AACH,CAAC;AA1DD,0CA0DC;AAED,eAAe,CAAC,OAAO,GAAG,SAA+B,CAAA;AACzD,eAAe,CAAC,QAAQ,GAAG,CAAW,CAAA;AACtC,eAAe,CAAC,IAAI,GAAG,uDAAuD,CAAA;AAE9E,MAAM,YAAY,GAA6B;IAC7C,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,IAAI;IACP,GAAG,EAAE,GAAG;IACR,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,IAAI;CACX,CAAA;AAED,MAAM,MAAM,GAAW,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;AACxC,MAAM,MAAM,GAAW,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;AAExC,SAAgB,eAAe,CAAC,CAAS,EAAE,GAAW;IACpD,IAAI,GAAG,GAAG,EAAE,CAAA;IACZ,IAAI,CAAqB,CAAA;IACzB,eAAe,CAAC,OAAO,GAAG,SAAS,CAAA;IACnC,8FAA8F;IAC9F,OAAO,IAAI,EAAE,CAAC;QACZ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAA;QACZ,IAAI,CAAC,KAAK,GAAG;YAAE,MAAK;QACpB,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACf,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;YACV,IAAI,CAAC,IAAI,YAAY,EAAE,CAAC;gBACtB,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAA;gBACtB,GAAG,EAAE,CAAA;YACP,CAAC;iBAAM,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;gBACrB,GAAG,EAAE,CAAA;gBACL,IAAI,KAAK,GAAG,CAAC,CAAA;gBACb,IAAI,IAAI,GAAG,CAAC,CAAA;gBACZ,OAAO,KAAK,EAAE,EAAE,CAAC;oBACf,IAAI,KAAK,CAAC,CAAA;oBACV,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;oBACV,uEAAuE;oBACvE,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;wBACpB,YAAY,CAAC,gBAAgB,CAAC,CAAA;wBAC9B,OAAO,SAAS,CAAA;oBAClB,CAAC;oBACD,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA;oBACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;wBACzB,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,EAAE,CAAA;oBACvC,CAAC;yBAAM,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;wBAChC,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAA;oBAClC,CAAC;yBAAM,CAAC;wBACN,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;wBACrC,OAAO,SAAS,CAAA;oBAClB,CAAC;oBACD,GAAG,EAAE,CAAA;gBACP,CAAC;gBACD,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;YAClC,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;gBACrC,OAAO,SAAS,CAAA;YAClB,CAAC;YACD,uEAAuE;QACzE,CAAC;aAAM,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YAC3B,YAAY,CAAC,gBAAgB,CAAC,CAAA;YAC9B,OAAO,SAAS,CAAA;QAClB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;gBAC5B,GAAG,IAAI,CAAC,CAAA;YACV,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;gBACrC,OAAOLine truncated
@@ -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 MessageCircleOff = createLucideIcon("MessageCircleOff", [
["path", { d: "M20.5 14.9A9 9 0 0 0 9.1 3.5", key: "1iebmn" }],
["path", { d: "m2 2 20 20", key: "1ooewy" }],
["path", { d: "M5.6 5.6C3 8.3 2.2 12.5 4 16l-2 6 6-2c3.4 1.8 7.6 1.1 10.3-1.7", key: "1ov8ce" }]
]);
export { MessageCircleOff as default };
//# sourceMappingURL=message-circle-off.js.map
@@ -0,0 +1,9 @@
/**
* @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.
*/
export { default } from './square-arrow-out-up-right.js';
//# sourceMappingURL=arrow-up-right-from-square.js.map
@@ -0,0 +1,23 @@
/**
* @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 Clover = createLucideIcon("Clover", [
["path", { d: "M16.17 7.83 2 22", key: "t58vo8" }],
[
"path",
{
d: "M4.02 12a2.827 2.827 0 1 1 3.81-4.17A2.827 2.827 0 1 1 12 4.02a2.827 2.827 0 1 1 4.17 3.81A2.827 2.827 0 1 1 19.98 12a2.827 2.827 0 1 1-3.81 4.17A2.827 2.827 0 1 1 12 19.98a2.827 2.827 0 1 1-4.17-3.81A1 1 0 1 1 4 12",
key: "17k36q"
}
],
["path", { d: "m7.83 7.83 8.34 8.34", key: "1d7sxk" }]
]);
export { Clover as default };
//# sourceMappingURL=clover.js.map
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBaseTypesOfClassMember = getBaseTypesOfClassMember;
/**
* Given a member of a class which extends another class or implements an interface,
* yields the corresponding member type for each of the base class/interfaces.
*/
function* getBaseTypesOfClassMember(services, memberNode) {
const memberTsNode = services.esTreeNodeToTSNodeMap.get(memberNode);
if (memberTsNode.name == null) {
return;
}
const checker = services.program.getTypeChecker();
const memberSymbol = checker.getSymbolAtLocation(memberTsNode.name);
if (memberSymbol == null) {
return;
}
const classNode = memberTsNode.parent;
for (const clauseNode of classNode.heritageClauses ?? []) {
for (const baseTypeNode of clauseNode.types) {
const baseType = checker.getTypeAtLocation(baseTypeNode);
const baseMemberSymbol = checker.getPropertyOfType(baseType, memberSymbol.name);
if (baseMemberSymbol == null) {
continue;
}
const baseMemberType = checker.getTypeOfSymbolAtLocation(baseMemberSymbol, memberTsNode);
const heritageToken = clauseNode.token;
yield { baseMemberType, baseType, heritageToken };
}
}
}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_z","132":"B"},B:{"1":"_2D","16":"C"},C:{"1":"_uO","2":"_ZI"},D:{"1":"_QG _sL","16":"_FC"},E:{"1":"_nB","2":"_k"},F:{"1":"_a","2":"_T"},G:{"1":"_eB","2":"lC"},H:{"2":"1D"},I:{"1":"_SB","16":"_m"},J:{"1":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"2":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:1,C:"Link type \"noreferrer\"",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"user-cog-2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_V","2":"_b"},B:{"1":"_J"},C:{"1":"_w","2":"_OC","36":"LD"},D:{"1":"_ZD","516":"_Y"},E:{"1":"_7C","772":"_ZC"},F:{"1":"_dD","2":"_mB","36":"ZD"},G:{"1":"_2","4":"_d fD","516":"eD"},H:{"132":"1D"},I:{"1":"_X","36":"2D","516":"_GF","548":"_fQ"},J:{"1":"_B"},K:{"1":"_N"},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:"CSS3 Background-image options",D:true};
@@ -0,0 +1,66 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABILITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference lib="es2020.bigint" />
interface Atomics {
/**
* A non-blocking, asynchronous version of wait which is usable on the main thread.
* Waits asynchronously on a shared memory location and returns a Promise
* @param typedArray A shared Int32Array or BigInt64Array.
* @param index The position in the typedArray to wait on.
* @param value The expected value to test.
* @param [timeout] The expected value to test.
*/
waitAsync(typedArray: Int32Array, index: number, value: number, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; };
/**
* A non-blocking, asynchronous version of wait which is usable on the main thread.
* Waits asynchronously on a shared memory location and returns a Promise
* @param typedArray A shared Int32Array or BigInt64Array.
* @param index The position in the typedArray to wait on.
* @param value The expected value to test.
* @param [timeout] The expected value to test.
*/
waitAsync(typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): { async: false; value: "not-equal" | "timed-out"; } | { async: true; value: Promise<"ok" | "timed-out">; };
}
interface SharedArrayBuffer {
/**
* Returns true if this SharedArrayBuffer can be grown.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/growable)
*/
get growable(): boolean;
/**
* If this SharedArrayBuffer is growable, returns the maximum byte length given during construction; returns the byte length if not.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/maxByteLength)
*/
get maxByteLength(): number;
/**
* Grows the SharedArrayBuffer to the specified size (in bytes).
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/grow)
*/
grow(newByteLength?: number): void;
}
interface SharedArrayBufferConstructor {
new (byteLength: number, options?: { maxByteLength?: number; }): SharedArrayBuffer;
}
@@ -0,0 +1,322 @@
'use client'
import * as React from 'react'
import { useRouter } from './useRouter'
import type {
BlockerFnArgs,
HistoryAction,
HistoryLocation,
} from '@tanstack/history'
import type {
AnyRoute,
AnyRouter,
ParseRoute,
RegisteredRouter,
} from '@tanstack/router-core'
type ShouldBlockFnLocation<
out TRouteId,
out TFullPath,
out TAllParams,
out TFullSearchSchema,
> = {
routeId: TRouteId
fullPath: TFullPath
pathname: string
params: TAllParams
search: TFullSearchSchema
}
type AnyShouldBlockFnLocation = ShouldBlockFnLocation<any, any, any, any>
type MakeShouldBlockFnLocationUnion<
TRouter extends AnyRouter = RegisteredRouter,
TRoute extends AnyRoute = ParseRoute<TRouter['routeTree']>,
> = TRoute extends any
? ShouldBlockFnLocation<
TRoute['id'],
TRoute['fullPath'],
TRoute['types']['allParams'],
TRoute['types']['fullSearchSchema']
>
: never
type BlockerResolver<TRouter extends AnyRouter = RegisteredRouter> =
| {
status: 'blocked'
current: MakeShouldBlockFnLocationUnion<TRouter>
next: MakeShouldBlockFnLocationUnion<TRouter>
action: HistoryAction
proceed: () => void
reset: () => void
}
| {
status: 'idle'
current: undefined
next: undefined
action: undefined
proceed: undefined
reset: undefined
}
type ShouldBlockFnArgs<TRouter extends AnyRouter = RegisteredRouter> = {
current: MakeShouldBlockFnLocationUnion<TRouter>
next: MakeShouldBlockFnLocationUnion<TRouter>
action: HistoryAction
}
export type ShouldBlockFn<TRouter extends AnyRouter = RegisteredRouter> = (
args: ShouldBlockFnArgs<TRouter>,
) => boolean | Promise<boolean>
export type UseBlockerOpts<
TRouter extends AnyRouter = RegisteredRouter,
TWithResolver extends boolean = boolean,
> = {
shouldBlockFn: ShouldBlockFn<TRouter>
enableBeforeUnload?: boolean | (() => boolean)
disabled?: boolean
withResolver?: TWithResolver
}
type LegacyBlockerFn = () => Promise<any> | any
type LegacyBlockerOpts = {
blockerFn?: LegacyBlockerFn
condition?: boolean | any
}
function _resolveBlockerOpts(
opts?: UseBlockerOpts | LegacyBlockerOpts | LegacyBlockerFn,
condition?: boolean | any,
): UseBlockerOpts {
if (opts === undefined) {
return {
shouldBlockFn: () => true,
withResolver: false,
}
}
if ('shouldBlockFn' in opts) {
return opts
}
if (typeof opts === 'function') {
const shouldBlock = Boolean(condition ?? true)
const _customBlockerFn = async () => {
if (shouldBlock) return await opts()
return false
}
return {
shouldBlockFn: _customBlockerFn,
enableBeforeUnload: shouldBlock,
withResolver: false,
}
}
const shouldBlock = Boolean(opts.condition ?? true)
const fn = opts.blockerFn
const _customBlockerFn = async () => {
if (shouldBlock && fn !== undefined) {
return await fn()
}
return shouldBlock
}
return {
shouldBlockFn: _customBlockerFn,
enableBeforeUnload: shouldBlock,
withResolver: fn === undefined,
}
}
export function useBlocker<
TRouter extends AnyRouter = RegisteredRouter,
TWithResolver extends boolean = false,
>(
opts: UseBlockerOpts<TRouter, TWithResolver>,
): TWithResolver extends true ? BlockerResolver<TRouter> : void
/**
* @deprecated Use the shouldBlockFn property instead
*/
export function useBlocker(blockerFnOrOpts?: LegacyBlockerOpts): BlockerResolver
/**
* @deprecated Use the UseBlockerOpts object syntax instead
*/
export function useBlocker(
blockerFn?: LegacyBlockerFn,
condition?: boolean | any,
): BlockerResolver
export function useBlocker(
opts?: UseBlockerOpts | LegacyBlockerOpts | LegacyBlockerFn,
condition?: boolean | any,
): BlockerResolver | void {
const {
shouldBlockFn,
enableBeforeUnload = true,
disabled = false,
withResolver = false,
} = _resolveBlockerOpts(opts, condition)
const router = useRouter()
const { history } = router
const [resolver, setResolver] = React.useState<BlockerResolver>({
status: 'idle',
current: undefined,
next: undefined,
action: undefined,
proceed: undefined,
reset: undefined,
})
React.useEffect(() => {
const blockerFnComposed = async (blockerFnArgs: BlockerFnArgs) => {
function getLocation(
location: HistoryLocation,
): AnyShouldBlockFnLocation {
const parsedLocation = router.parseLocation(location)
const matchedRoutes = router.getMatchedRoutes(parsedLocation.pathname)
if (matchedRoutes.foundRoute === undefined) {
return {
routeId: '__notFound__',
fullPath: parsedLocation.pathname,
pathname: parsedLocation.pathname,
params: matchedRoutes.routeParams,
search: router.options.parseSearch(location.search),
}
}
return {
routeId: matchedRoutes.foundRoute.id,
fullPath: matchedRoutes.foundRoute.fullPath,
pathname: parsedLocation.pathname,
params: matchedRoutes.routeParams,
search: router.options.parseSearch(location.search),
}
}
const current = getLocation(blockerFnArgs.currentLocation)
const next = getLocation(blockerFnArgs.nextLocation)
if (
current.routeId === '__notFound__' &&
next.routeId !== '__notFound__'
) {
return false
}
const shouldBlock = await shouldBlockFn({
action: blockerFnArgs.action,
current,
next,
})
if (!withResolver) {
return shouldBlock
}
if (!shouldBlock) {
return false
}
const promise = new Promise<boolean>((resolve) => {
setResolver({
status: 'blocked',
current,
next,
action: blockerFnArgs.action,
proceed: () => resolve(false),
reset: () => resolve(true),
})
})
const canNavigateAsync = await promise
setResolver({
status: 'idle',
current: undefined,
next: undefined,
action: undefined,
proceed: undefined,
reset: undefined,
})
return canNavigateAsync
}
return disabled
? undefined
: history.block({ blockerFn: blockerFnComposed, enableBeforeUnload })
}, [
shouldBlockFn,
enableBeforeUnload,
disabled,
withResolver,
history,
router,
])
return resolver
}
const _resolvePromptBlockerArgs = (
props: PromptProps | LegacyPromptProps,
): UseBlockerOpts => {
if ('shouldBlockFn' in props) {
return { ...props }
}
const shouldBlock = Boolean(props.condition ?? true)
const fn = props.blockerFn
const _customBlockerFn = async () => {
if (shouldBlock && fn !== undefined) {
return await fn()
}
return shouldBlock
}
return {
shouldBlockFn: _customBlockerFn,
enableBeforeUnload: shouldBlock,
withResolver: fn === undefined,
}
}
export function Block<
TRouter extends AnyRouter = RegisteredRouter,
TWithResolver extends boolean = boolean,
>(opts: PromptProps<TRouter, TWithResolver>): React.ReactNode
/**
* @deprecated Use the UseBlockerOpts property instead
*/
export function Block(opts: LegacyPromptProps): React.ReactNode
export function Block(opts: PromptProps | LegacyPromptProps): React.ReactNode {
const { children, ...rest } = opts
const args = _resolvePromptBlockerArgs(rest)
const resolver = useBlocker(args)
return children
? typeof children === 'function'
? children(resolver as any)
: children
: null
}
type LegacyPromptProps = {
blockerFn?: LegacyBlockerFn
condition?: boolean | any
children?: React.ReactNode | ((params: BlockerResolver) => React.ReactNode)
}
type PromptProps<
TRouter extends AnyRouter = RegisteredRouter,
TWithResolver extends boolean = boolean,
TParams = TWithResolver extends true ? BlockerResolver<TRouter> : void,
> = UseBlockerOpts<TRouter, TWithResolver> & {
children?: React.ReactNode | ((params: TParams) => React.ReactNode)
}
@@ -0,0 +1,606 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Natsu @xiaoxiaojx
*/
"use strict";
const { aliasResolveHandler } = require("./AliasUtils");
const { modulesResolveHandler } = require("./ModulesUtils");
const { readJson } = require("./util/fs");
const {
PathType: _PathType,
cachedDirname: dirname,
cachedJoin: join,
isSubPath,
normalize,
} = require("./util/path");
/** @typedef {import("./Resolver")} Resolver */
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
/** @typedef {import("./AliasUtils").AliasOption} AliasOption */
/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */
/** @typedef {import("./Resolver").ResolveContext} ResolveContext */
/** @typedef {import("./Resolver").FileSystem} FileSystem */
/** @typedef {import("./Resolver").TsconfigPathsData} TsconfigPathsData */
/** @typedef {import("./Resolver").TsconfigPathsMap} TsconfigPathsMap */
/** @typedef {import("./ResolverFactory").TsconfigOptions} TsconfigOptions */
/**
* @typedef {object} TsconfigCompilerOptions
* @property {string=} baseUrl Base URL for resolving paths
* @property {{ [key: string]: string[] }=} paths TypeScript paths mapping
*/
/**
* @typedef {object} TsconfigReference
* @property {string} path Path to the referenced project
*/
/**
* @typedef {object} Tsconfig
* @property {TsconfigCompilerOptions=} compilerOptions Compiler options
* @property {string | string[]=} extends Extended configuration paths
* @property {TsconfigReference[]=} references Project references
*/
const DEFAULT_CONFIG_FILE = "tsconfig.json";
/**
* @param {string} pattern Path pattern
* @returns {number} Length of the prefix
*/
function getPrefixLength(pattern) {
const prefixLength = pattern.indexOf("*");
if (prefixLength === -1) {
return pattern.length;
}
return prefixLength;
}
/**
* Sort path patterns.
* If a module name can be matched with multiple patterns then pattern with the longest prefix will be picked.
* @param {string[]} arr Array of path patterns
* @returns {string[]} Array of path patterns sorted by longest prefix
*/
function sortByLongestPrefix(arr) {
return [...arr].sort((a, b) => getPrefixLength(b) - getPrefixLength(a));
}
/**
* Merge two tsconfig objects
* @param {Tsconfig | null} base base config
* @param {Tsconfig | null} config config to merge
* @returns {Tsconfig} merged config
*/
function mergeTsconfigs(base, config) {
base = base || {};
config = config || {};
return {
...base,
...config,
compilerOptions: {
.../** @type {TsconfigCompilerOptions} */ (base.compilerOptions),
.../** @type {TsconfigCompilerOptions} */ (config.compilerOptions),
},
};
}
/**
* Substitute ${configDir} template variable in path
* @param {string} pathValue the path value
* @param {string} configDir the config directory
* @returns {string} the path with substituted template
*/
function substituteConfigDir(pathValue, configDir) {
return pathValue.replace(/\$\{configDir\}/g, configDir);
}
/**
* Convert tsconfig paths to resolver options
* @param {string} configDir Config file directory
* @param {{ [key: string]: string[] }} paths TypeScript paths mapping
* @param {string=} baseUrl Base URL for resolving paths (relative to configDir)
* @returns {TsconfigPathsData} the resolver options
*/
function tsconfigPathsToResolveOptions(configDir, paths, baseUrl) {
// Calculate absolute base URL
const absoluteBaseUrl = !baseUrl ? configDir : join(configDir, baseUrl);
/** @type {string[]} */
const sortedKeys = sortByLongestPrefix(Object.keys(paths));
/** @type {AliasOption[]} */
const alias = [];
/** @type {string[]} */
const modules = [];
for (const pattern of sortedKeys) {
const mappings = paths[pattern];
// Substitute ${configDir} in path mappings
const absolutePaths = mappings.map((mapping) => {
const substituted = substituteConfigDir(mapping, configDir);
return join(absoluteBaseUrl, substituted);
});
if (absolutePaths.length > 0) {
if (pattern === "*") {
modules.push(
...absolutePaths
.map((dir) => {
if (/[/\\]\*$/.test(dir)) {
return dir.replace(/[/\\]\*$/, "");
}
return "";
})
.filter(Boolean),
);
} else {
alias.push({ name: pattern, alias: absolutePaths });
}
}
}
if (absoluteBaseUrl && !modules.includes(absoluteBaseUrl)) {
modules.push(absoluteBaseUrl);
}
return {
alias,
modules,
};
}
/**
* Get the base context for the current project
* @param {string} context the context
* @param {string=} baseUrl base URL for resolving paths
* @returns {string} the base context
*/
function getAbsoluteBaseUrl(context, baseUrl) {
return !baseUrl ? context : join(context, baseUrl);
}
module.exports = class TsconfigPathsPlugin {
/**
* @param {true | string | TsconfigOptions} configFileOrOptions tsconfig file path or options object
*/
constructor(configFileOrOptions) {
if (
typeof configFileOrOptions === "object" &&
configFileOrOptions !== null
) {
// Options object format
this.configFile = configFileOrOptions.configFile || DEFAULT_CONFIG_FILE;
/** @type {string[] | "auto"} */
if (Array.isArray(configFileOrOptions.references)) {
/** @type {TsconfigReference[] | "auto"} */
this.references = configFileOrOptions.references.map((ref) => ({
path: ref,
}));
} else if (configFileOrOptions.references === "auto") {
this.references = "auto";
} else {
this.references = [];
}
/** @type {string | undefined} */
this.baseUrl = configFileOrOptions.baseUrl;
} else {
this.configFile =
configFileOrOptions === true
? DEFAULT_CONFIG_FILE
: /** @type {string} */ (configFileOrOptions);
/** @type {TsconfigReference[] | "auto"} */
this.references = [];
/** @type {string | undefined} */
this.baseUrl = undefined;
}
}
/**
* @param {Resolver} resolver the resolver
* @returns {void}
*/
apply(resolver) {
const aliasTarget = resolver.ensureHook("internal-resolve");
const moduleTarget = resolver.ensureHook("module");
resolver
.getHook("raw-resolve")
.tapAsync(
"TsconfigPathsPlugin",
async (request, resolveContext, callback) => {
try {
const tsconfigPathsMap = await this._getTsconfigPathsMap(
resolver,
request,
resolveContext,
);
if (!tsconfigPathsMap) return callback();
const selectedData = this._selectPathsDataForContext(
request.path,
tsconfigPathsMap,
);
if (!selectedData) return callback();
aliasResolveHandler(
resolver,
selectedData.alias,
aliasTarget,
request,
resolveContext,
callback,
);
} catch (err) {
callback(/** @type {Error} */ (err));
}
},
);
resolver
.getHook("raw-module")
.tapAsync(
"TsconfigPathsPlugin",
async (request, resolveContext, callback) => {
try {
const tsconfigPathsMap = await this._getTsconfigPathsMap(
resolver,
request,
resolveContext,
);
if (!tsconfigPathsMap) return callback();
const selectedData = this._selectPathsDataForContext(
request.path,
tsconfigPathsMap,
);
if (!selectedData) return callback();
modulesResolveHandler(
resolver,
selectedData.modules,
moduleTarget,
request,
resolveContext,
callback,
);
} catch (err) {
callback(/** @type {Error} */ (err));
}
},
);
}
/**
* Get TsconfigPathsMap for the request (with caching)
* @param {Resolver} resolver the resolver
* @param {ResolveRequest} request the request
* @param {ResolveContext} resolveContext the resolve context
* @returns {Promise<TsconfigPathsMap | null>} the tsconfig paths map or null
*/
async _getTsconfigPathsMap(resolver, request, resolveContext) {
if (typeof request.tsconfigPathsMap === "undefined") {
try {
const absTsconfigPath = join(
request.path || process.cwd(),
this.configFile,
);
const result = await this._loadTsconfigPathsMap(
resolver.fileSystem,
absTsconfigPath,
);
request.tsconfigPathsMap = result;
} catch (err) {
request.tsconfigPathsMap = null;
throw err;
}
}
if (!request.tsconfigPathsMap) {
return null;
}
for (const fileDependency of request.tsconfigPathsMap.fileDependencies) {
if (resolveContext.fileDependencies) {
resolveContext.fileDependencies.add(fileDependency);
}
}
return request.tsconfigPathsMap;
}
/**
* Load tsconfig.json and build complete TsconfigPathsMap
* Includes main project paths and all referenced projects
* @param {FileSystem} fileSystem the file system
* @param {string} absTsconfigPath absolute path to tsconfig.json
* @returns {Promise<TsconfigPathsMap>} the complete tsconfig paths map
*/
async _loadTsconfigPathsMap(fileSystem, absTsconfigPath) {
/** @type {Set<string>} */
const fileDependencies = new Set();
const config = await this._loadTsconfig(
fileSystem,
absTsconfigPath,
fileDependencies,
);
const compilerOptions = config.compilerOptions || {};
const mainContext = dirname(absTsconfigPath);
const baseUrl =
this.baseUrl !== undefined ? this.baseUrl : compilerOptions.baseUrl;
const main = tsconfigPathsToResolveOptions(
mainContext,
compilerOptions.paths || {},
baseUrl,
);
/** @type {{ [baseUrl: string]: TsconfigPathsData }} */
const refs = {};
let referencesToUse = null;
if (this.references === "auto") {
referencesToUse = config.references;
} else if (Array.isArray(this.references)) {
referencesToUse = this.references;
}
if (Array.isArray(referencesToUse)) {
await this._loadTsconfigReferences(
fileSystem,
mainContext,
referencesToUse,
fileDependencies,
refs,
);
}
const allContexts =
/** @type {{ [context: string]: TsconfigPathsData }} */ ({
[mainContext]: main,
...refs,
});
return { main, mainContext, refs, allContexts, fileDependencies };
}
/**
* Select the correct TsconfigPathsData based on request.path (context-aware)
* Matches the behavior of tsconfig-paths-webpack-plugin
* @param {string | false} requestPath the request path
* @param {TsconfigPathsMap} tsconfigPathsMap the tsconfig paths map
* @returns {TsconfigPathsData | null} the selected paths data
*/
_selectPathsDataForContext(requestPath, tsconfigPathsMap) {
const { main, allContexts } = tsconfigPathsMap;
if (!requestPath) {
return main;
}
let longestMatch = null;
let longestMatchLength = 0;
for (const [context, data] of Object.entries(allContexts)) {
if (context === requestPath) {
return data;
}
if (
isSubPath(context, requestPath) &&
context.length > longestMatchLength
) {
longestMatch = data;
longestMatchLength = context.length;
}
}
if (longestMatch) {
return longestMatch;
}
return null;
}
/**
* Load tsconfig from extends path
* @param {FileSystem} fileSystem the file system
* @param {string} configFilePath current config file path
* @param {string} extendedConfigValue extends value
* @param {Set<string>} fileDependencies the file dependencies
* @param {Set<string>} visitedConfigPaths config paths being loaded (for circular extends detection)
* @returns {Promise<Tsconfig>} the extended tsconfig
*/
async _loadTsconfigFromExtends(
fileSystem,
configFilePath,
extendedConfigValue,
fileDependencies,
visitedConfigPaths,
) {
const currentDir = dirname(configFilePath);
// Substitute ${configDir} in extends path
extendedConfigValue = substituteConfigDir(extendedConfigValue, currentDir);
// Remember the original value before potentially appending .json
const originalExtendedConfigValue = extendedConfigValue;
if (
typeof extendedConfigValue === "string" &&
!extendedConfigValue.includes(".json")
) {
extendedConfigValue += ".json";
}
let extendedConfigPath = join(currentDir, extendedConfigValue);
const exists = await new Promise((resolve) => {
fileSystem.readFile(extendedConfigPath, (err) => {
resolve(!err);
});
});
if (!exists) {
// Handle scoped package extends like "@scope/name" (no sub-path):
// "@scope/name" should resolve to node_modules/@scope/name/tsconfig.json,
// not node_modules/@scope/name.json
// See: test/fixtures/tsconfig-paths/extends-pkg-entry/
if (
typeof originalExtendedConfigValue === "string" &&
originalExtendedConfigValue.startsWith("@") &&
originalExtendedConfigValue.split("/").length === 2
) {
extendedConfigPath = join(
currentDir,
normalize(
`node_modules/${originalExtendedConfigValue}/${DEFAULT_CONFIG_FILE}`,
),
);
} else if (extendedConfigValue.includes("/")) {
// Handle package sub-path extends like "react/tsconfig":
// "react/tsconfig" resolves to node_modules/react/tsconfig.json
// See: test/fixtures/tsconfig-paths/extends-npm/
extendedConfigPath = join(
currentDir,
normalize(`node_modules/${extendedConfigValue}`),
);
}
}
const config = await this._loadTsconfig(
fileSystem,
extendedConfigPath,
fileDependencies,
visitedConfigPaths,
);
const compilerOptions = config.compilerOptions || { baseUrl: undefined };
if (compilerOptions.baseUrl) {
const extendedConfigDir = dirname(extendedConfigPath);
compilerOptions.baseUrl = getAbsoluteBaseUrl(
extendedConfigDir,
compilerOptions.baseUrl,
);
}
delete config.references;
return /** @type {Tsconfig} */ (config);
}
/**
* Load referenced tsconfig projects and store in referenceMatchMap
* Simple implementation matching tsconfig-paths-webpack-plugin:
* Just load each reference and store independently
* @param {FileSystem} fileSystem the file system
* @param {string} context the context
* @param {TsconfigReference[]} references array of references
* @param {Set<string>} fileDependencies the file dependencies
* @param {{ [baseUrl: string]: TsconfigPathsData }} referenceMatchMap the map to populate
* @returns {Promise<void>}
*/
async _loadTsconfigReferences(
fileSystem,
context,
references,
fileDependencies,
referenceMatchMap,
) {
await Promise.all(
references.map(async (ref) => {
const refPath = substituteConfigDir(ref.path, context);
const refConfigPath = join(join(context, refPath), DEFAULT_CONFIG_FILE);
try {
const refConfig = await this._loadTsconfig(
fileSystem,
refConfigPath,
fileDependencies,
);
if (refConfig.compilerOptions && refConfig.compilerOptions.paths) {
const refContext = dirname(refConfigPath);
referenceMatchMap[refContext] = tsconfigPathsToResolveOptions(
refContext,
refConfig.compilerOptions.paths || {},
refConfig.compilerOptions.baseUrl,
);
}
if (
this.references === "auto" &&
Array.isArray(refConfig.references)
) {
await this._loadTsconfigReferences(
fileSystem,
dirname(refConfigPath),
refConfig.references,
fileDependencies,
referenceMatchMap,
);
}
} catch (_err) {
// continue
}
}),
);
}
/**
* Load tsconfig.json with extends support
* @param {FileSystem} fileSystem the file system
* @param {string} configFilePath absolute path to tsconfig.json
* @param {Set<string>} fileDependencies the file dependencies
* @param {Set<string>=} visitedConfigPaths config paths being loaded (for circular extends detection)
* @returns {Promise<Tsconfig>} the merged tsconfig
*/
async _loadTsconfig(
fileSystem,
configFilePath,
fileDependencies,
visitedConfigPaths = new Set(),
) {
if (visitedConfigPaths.has(configFilePath)) {
return /** @type {Tsconfig} */ ({});
}
visitedConfigPaths.add(configFilePath);
const config = await readJson(fileSystem, configFilePath, {
stripComments: true,
});
fileDependencies.add(configFilePath);
let result = config;
const extendedConfig = config.extends;
if (extendedConfig) {
let base;
if (Array.isArray(extendedConfig)) {
base = {};
for (const extendedConfigElement of extendedConfig) {
const extendedTsconfig = await this._loadTsconfigFromExtends(
fileSystem,
configFilePath,
extendedConfigElement,
fileDependencies,
visitedConfigPaths,
);
base = mergeTsconfigs(base, extendedTsconfig);
}
} else {
base = await this._loadTsconfigFromExtends(
fileSystem,
configFilePath,
extendedConfig,
fileDependencies,
visitedConfigPaths,
);
}
result = /** @type {Tsconfig} */ (mergeTsconfigs(base, config));
}
return result;
}
};
@@ -0,0 +1 @@
{"version":3,"names":["_gensync","data","require","asyncGeneratorStep","n","t","e","r","o","a","c","i","u","value","done","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","runGenerator","gensync","item","isAsync","exports","sync","errback","cb","maybeAsync","fn","message","args","result","isThenable","Error","async","withKind","_ref","_x","forwardAsync","action","g","kind","adapted","onFirstPause","name","arity","firstPause","completed","err","waitFor","x","_ref2","_x2","val"],"sources":["../../src/gensync-utils/async.ts"],"sourcesContent":["import gensync, { type Gensync, type Handler, type Callback } from \"gensync\";\n\ntype MaybePromise<T> = T | Promise<T>;\n\nconst runGenerator: {\n sync<Return>(gen: Handler<Return>): Return;\n async<Return>(gen: Handler<Return>): Promise<Return>;\n errback<Return>(gen: Handler<Return>, cb: Callback<Return>): void;\n} = gensync(function* (item: Handler<any>): Handler<any> {\n return yield* item;\n});\n\n// This Gensync returns true if the current execution context is\n// asynchronous, otherwise it returns false.\nexport const isAsync = gensync({\n sync: () => false,\n errback: cb => cb(null, true),\n});\n\n// This function wraps any functions (which could be either synchronous or\n// asynchronous) with a Gensync. If the wrapped function returns a promise\n// but the current execution context is synchronous, it will throw the\n// provided error.\n// This is used to handle user-provided functions which could be asynchronous.\nexport function maybeAsync<Args extends unknown[], Return>(\n fn: (...args: Args) => Return,\n message: string,\n): Gensync<Args, Return> {\n return gensync({\n sync(...args) {\n const result = fn.apply(this, args);\n if (isThenable(result)) throw new Error(message);\n return result;\n },\n async(...args) {\n return Promise.resolve(fn.apply(this, args));\n },\n });\n}\n\nconst withKind = gensync({\n sync: cb => cb(\"sync\"),\n async: async cb => cb(\"async\"),\n}) as <T>(cb: (kind: \"sync\" | \"async\") => MaybePromise<T>) => Handler<T>;\n\n// This function wraps a generator (or a Gensync) into another function which,\n// when called, will run the provided generator in a sync or async way, depending\n// on the execution context where this forwardAsync function is called.\n// This is useful, for example, when passing a callback to a function which isn't\n// aware of gensync, but it only knows about synchronous and asynchronous functions.\n// An example is cache.using, which being exposed to the user must be as simple as\n// possible:\n// yield* forwardAsync(gensyncFn, wrappedFn =>\n// cache.using(x => {\n// // Here we don't know about gensync. wrappedFn is a\n// // normal sync or async function\n// return wrappedFn(x);\n// })\n// )\nexport function forwardAsync<Args extends unknown[], Return>(\n action: (...args: Args) => Handler<Return>,\n cb: (\n adapted: (...args: Args) => MaybePromise<Return>,\n ) => MaybePromise<Return>,\n): Handler<Return> {\n const g = gensync(action);\n return withKind(kind => {\n const adapted = g[kind];\n return cb(adapted);\n });\n}\n\n// If the given generator is executed asynchronously, the first time that it\n// is paused (i.e. When it yields a gensync generator which can't be run\n// synchronously), call the \"firstPause\" callback.\nexport const onFirstPause = gensync<\n [gen: Handler<unknown>, firstPause: () => void],\n unknown\n>({\n name: \"onFirstPause\",\n arity: 2,\n sync: function (item) {\n return runGenerator.sync(item);\n },\n errback: function (item, firstPause, cb) {\n let completed = false;\n\n runGenerator.errback(item, (err, value) => {\n completed = true;\n cb(err, value);\n });\n\n if (!completed) {\n firstPause();\n }\n },\n}) as <T>(gen: Handler<T>, firstPause: () => void) => Handler<T>;\n\n// Wait for the given promise to be resolved\nexport const waitFor = gensync({\n sync: x => x,\n async: async x => x,\n}) as <T>(p: T | Promise<T>) => Handler<T>;\n\nexport function isThenable<T = any>(val: any): val is PromiseLike<T> {\n return (\n !!val &&\n (typeof val === \"object\" || typeof val === \"function\") &&\n !!val.then &&\n typeof val.then === \"function\"\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6E,SAAAE,mBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,cAAAC,CAAA,GAAAP,CAAA,CAAAK,CAAA,EAAAC,CAAA,GAAAE,CAAA,GAAAD,CAAA,CAAAE,KAAA,WAAAT,CAAA,gBAAAE,CAAA,CAAAF,CAAA,KAAAO,CAAA,CAAAG,IAAA,GAAAT,CAAA,CAAAO,CAAA,IAAAG,OAAA,CAAAC,OAAA,CAAAJ,CAAA,EAAAK,IAAA,CAAAV,CAAA,EAAAC,CAAA;AAAA,SAAAU,kBAAAd,CAAA,6BAAAC,CAAA,SAAAC,CAAA,GAAAa,SAAA,aAAAJ,OAAA,WAAAR,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAL,CAAA,CAAAgB,KAAA,CAAAf,CAAA,EAAAC,CAAA,YAAAe,MAAAjB,CAAA,IAAAD,kBAAA,CAAAM,CAAA,EAAAF,CAAA,EAAAC,CAAA,ELine truncated