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

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

No files matched your search

@@ -0,0 +1,420 @@
import EE from 'events';
import fs from 'fs';
import { Minipass } from 'minipass';
const writev = fs.writev;
const _autoClose = Symbol('_autoClose');
const _close = Symbol('_close');
const _ended = Symbol('_ended');
const _fd = Symbol('_fd');
const _finished = Symbol('_finished');
const _flags = Symbol('_flags');
const _flush = Symbol('_flush');
const _handleChunk = Symbol('_handleChunk');
const _makeBuf = Symbol('_makeBuf');
const _mode = Symbol('_mode');
const _needDrain = Symbol('_needDrain');
const _onerror = Symbol('_onerror');
const _onopen = Symbol('_onopen');
const _onread = Symbol('_onread');
const _onwrite = Symbol('_onwrite');
const _open = Symbol('_open');
const _path = Symbol('_path');
const _pos = Symbol('_pos');
const _queue = Symbol('_queue');
const _read = Symbol('_read');
const _readSize = Symbol('_readSize');
const _reading = Symbol('_reading');
const _remain = Symbol('_remain');
const _size = Symbol('_size');
const _write = Symbol('_write');
const _writing = Symbol('_writing');
const _defaultFlag = Symbol('_defaultFlag');
const _errored = Symbol('_errored');
export class ReadStream extends Minipass {
[_errored] = false;
[_fd];
[_path];
[_readSize];
[_reading] = false;
[_size];
[_remain];
[_autoClose];
constructor(path, opt) {
opt = opt || {};
super(opt);
this.readable = true;
this.writable = false;
if (typeof path !== 'string') {
throw new TypeError('path must be a string');
}
this[_errored] = false;
this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
this[_path] = path;
this[_readSize] = opt.readSize || 16 * 1024 * 1024;
this[_reading] = false;
this[_size] = typeof opt.size === 'number' ? opt.size : Infinity;
this[_remain] = this[_size];
this[_autoClose] =
typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
if (typeof this[_fd] === 'number') {
this[_read]();
}
else {
this[_open]();
}
}
get fd() {
return this[_fd];
}
get path() {
return this[_path];
}
//@ts-ignore
write() {
throw new TypeError('this is a readable stream');
}
//@ts-ignore
end() {
throw new TypeError('this is a readable stream');
}
[_open]() {
fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd));
}
[_onopen](er, fd) {
if (er) {
this[_onerror](er);
}
else {
this[_fd] = fd;
this.emit('open', fd);
this[_read]();
}
}
[_makeBuf]() {
return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]));
}
[_read]() {
if (!this[_reading]) {
this[_reading] = true;
const buf = this[_makeBuf]();
/* c8 ignore start */
if (buf.length === 0) {
return process.nextTick(() => this[_onread](null, 0, buf));
}
/* c8 ignore stop */
fs.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b));
}
}
[_onread](er, br, buf) {
this[_reading] = false;
if (er) {
this[_onerror](er);
}
else if (this[_handleChunk](br, buf)) {
this[_read]();
}
}
[_close]() {
if (this[_autoClose] && typeof this[_fd] === 'number') {
const fd = this[_fd];
this[_fd] = undefined;
fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
}
}
[_onerror](er) {
this[_reading] = true;
this[_close]();
this.emit('error', er);
}
[_handleChunk](br, buf) {
let ret = false;
// no effect if infinite
this[_remain] -= br;
if (br > 0) {
ret = super.write(br < buf.length ? buf.subarray(0, br) : buf);
}
if (br === 0 || this[_remain] <= 0) {
ret = false;
this[_close]();
super.end();
}
return ret;
}
emit(ev, ...args) {
switch (ev) {
case 'prefinish':
case 'finish':
return false;
case 'drain':
if (typeof this[_fd] === 'number') {
this[_read]();
}
return false;
case 'error':
if (this[_errored]) {
return false;
}
this[_errored] = true;
return super.emit(ev, ...args);
default:
return super.emit(ev, ...args);
}
}
}
export class ReadStreamSync extends ReadStream {
[_open]() {
let threw = true;
try {
this[_onopen](null, fs.openSync(this[_path], 'r'));
threw = false;
}
finally {
if (threw) {
this[_close]();
}
}
}
[_read]() {
let threw = true;
try {
if (!this[_reading]) {
this[_reading] = true;
do {
const buf = this[_makeBuf]();
/* c8 ignore start */
const br = buf.length === 0
? 0
: fs.readSync(this[_fd], buf, 0, buf.length, null);
/* c8 ignore stop */
if (!this[_handleChunk](br, buf)) {
break;
}
} while (true);
this[_reading] = false;
}
threw = false;
}
finally {
if (threw) {
this[_close]();
}
}
}
[_close]() {
if (this[_autoClose] && typeof this[_fd] === 'number') {
const fd = this[_fd];
this[_fd] = undefined;
fs.closeSync(fd);
this.emit('close');
}
}
}
export class WriteStream extends EE {
readable = false;
writable = true;
[_errored] = false;
[_writing] = false;
[_ended] = false;
[_queue] = [];
[_needDrain] = false;
[_path];
[_mode];
[_autoClose];
[_fd];
[_defaultFlag];
[_flags];
[_finished] = false;
[_pos];
constructor(path, opt) {
opt = opt || {};
super(opt);
this[_path] = path;
this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
this[_mode] = opt.mode === undefined ? 0o666 : opt.mode;
this[_pos] = typeof opt.start === 'number' ? opt.start : undefined;
this[_autoClose] =
typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
// truncating makes no sense when writing into the middle
const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w';
this[_defaultFlag] = opt.flags === undefined;
this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags;
if (this[_fd] === undefined) {
this[_open]();
}
}
emit(ev, ...args) {
if (ev === 'error') {
if (this[_errored]) {
return false;
}
this[_errored] = true;
}
return super.emit(ev, ...args);
}
get fd() {
return this[_fd];
}
get path() {
return this[_path];
}
[_onerror](er) {
this[_close]();
this[_writing] = true;
this.emit('error', er);
}
[_open]() {
fs.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd));
}
[_onopen](er, fd) {
if (this[_defaultFlag] &&
this[_flags] === 'r+' &&
er &&
er.code === 'ENOENT') {
this[_flags] = 'w';
this[_open]();
}
else if (er) {
this[_onerror](er);
}
else {
this[_fd] = fd;
this.emit('open', fd);
if (!this[_writing]) {
this[_flush]();
}
}
}
end(buf, enc) {
if (buf) {
//@ts-ignore
this.write(buf, enc);
}
this[_ended] = true;
// synthetic after-write logic, where drain/finish live
if (!this[_writing] &&
!this[_queue].length &&
typeof this[_fd] === 'number') {
this[_onwrite](null, 0);
}
return this;
}
write(buf, enc) {
if (typeof buf === 'string') {
buf = Buffer.from(buf, enc);
}
if (this[_ended]) {
this.emit('error', new Error('write() after end()'));
return false;
}
if (this[_fd] === undefined || this[_writing] || this[_queue].length) {
this[_queue].push(buf);
this[_needDrain] = true;
return false;
}
this[_writing] = true;
this[_write](buf);
return true;
}
[_write](buf) {
fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw));
}
[_onwrite](er, bw) {
if (er) {
this[_onerror](er);
}
else {
if (this[_pos] !== undefined && typeof bw === 'number') {
this[_pos] += bw;
}
if (this[_queue].length) {
this[_flush]();
}
else {
this[_writing] = false;
if (this[_ended] && !this[_finished]) {
this[_finished] = true;
this[_close]();
this.emit('finish');
}
else if (this[_needDrain]) {
this[_needDrain] = false;
this.emit('drain');
}
}
}
}
[_flush]() {
if (this[_queue].length === 0) {
if (this[_ended]) {
this[_onwrite](null, 0);
}
}
else if (this[_queue].length === 1) {
this[_write](this[_queue].pop());
}
else {
const iovec = this[_queue];
this[_queue] = [];
writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw));
}
}
[_close]() {
if (this[_autoClose] && typeof this[_fd] === 'number') {
const fd = this[_fd];
this[_fd] = undefined;
fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
}
}
}
export class WriteStreamSync extends WriteStream {
[_open]() {
let fd;
// only wrap in a try{} block if we know we'll retry, to avoid
// the rethrow obscuring the error's source frame in most cases.
if (this[_defaultFlag] && this[_flags] === 'r+') {
try {
fd = fs.openSync(this[_path], this[_flags], this[_mode]);
}
catch (er) {
if (er?.code === 'ENOENT') {
this[_flags] = 'w';
return this[_open]();
}
else {
throw er;
}
}
}
else {
fd = fs.openSync(this[_path], this[_flags], this[_mode]);
}
this[_onopen](null, fd);
}
[_close]() {
if (this[_autoClose] && typeof this[_fd] === 'number') {
const fd = this[_fd];
this[_fd] = undefined;
fs.closeSync(fd);
this.emit('close');
}
}
[_write](buf) {
// throw the original, but try to close if it fails
let threw = true;
try {
this[_onwrite](null, fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos]));
threw = false;
}
finally {
if (threw) {
try {
this[_close]();
}
catch {
// ok error
}
}
}
}
}
//# sourceMappingURL=index.js.map
@@ -0,0 +1,101 @@
#ifndef PROMISE_RUNNER_H
#define PROMISE_RUNNER_H
#include <node_api.h>
#include "wasm/include.h"
#include <napi.h>
using namespace Napi;
class PromiseRunner {
public:
const Env env;
Promise::Deferred deferred;
PromiseRunner(Env env) : env(env), deferred(Promise::Deferred::New(env)) {
napi_status status = napi_create_async_work(env, nullptr, env.Undefined(),
onExecute, onWorkComplete, this, &work);
if (status != napi_ok) {
work = nullptr;
const napi_extended_error_info *error_info = 0;
napi_get_last_error_info(env, &error_info);
if (error_info->error_message) {
Error::New(env, error_info->error_message).ThrowAsJavaScriptException();
} else {
Error::New(env).ThrowAsJavaScriptException();
}
}
}
virtual ~PromiseRunner() {}
Value queue() {
if (work) {
napi_status status = napi_queue_async_work(env, work);
if (status != napi_ok) {
onError(Error::New(env));
}
}
return deferred.Promise();
}
private:
napi_async_work work;
std::string error;
static void onExecute(napi_env env, void *this_pointer) {
PromiseRunner* self = (PromiseRunner*) this_pointer;
try {
self->execute();
} catch (std::exception &err) {
self->error = err.what();
}
}
static void onWorkComplete(napi_env env, napi_status status, void *this_pointer) {
PromiseRunner* self = (PromiseRunner*) this_pointer;
if (status != napi_cancelled) {
HandleScope scope(self->env);
if (status == napi_ok) {
status = napi_delete_async_work(self->env, self->work);
if (status == napi_ok) {
if (self->error.size() == 0) {
self->onOK();
} else {
self->onError(Error::New(self->env, self->error));
}
delete self;
return;
}
}
}
// fallthrough for error handling
const napi_extended_error_info *error_info = 0;
napi_get_last_error_info(env, &error_info);
if (error_info->error_message){
self->onError(Error::New(env, error_info->error_message));
} else {
self->onError(Error::New(env));
}
delete self;
}
virtual void execute() {}
virtual Value getResult() {
return env.Null();
}
void onOK() {
HandleScope scope(env);
Value result = getResult();
deferred.Resolve(result);
}
void onError(const Error &e) {
deferred.Reject(e.Value());
}
};
#endif
@@ -0,0 +1,63 @@
# es-object-atoms <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
ES Object-related atoms: Object, ToObject, RequireObjectCoercible.
## Example
```js
const assert = require('assert');
const $Object = require('es-object-atoms');
const isObject = require('es-object-atoms/isObject');
const ToObject = require('es-object-atoms/ToObject');
const RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible');
assert.equal($Object, Object);
assert.throws(() => ToObject(null), TypeError);
assert.throws(() => ToObject(undefined), TypeError);
assert.throws(() => RequireObjectCoercible(null), TypeError);
assert.throws(() => RequireObjectCoercible(undefined), TypeError);
assert.equal(isObject(undefined), false);
assert.equal(isObject(null), false);
assert.equal(isObject({}), true);
assert.equal(isObject([]), true);
assert.equal(isObject(function () {}), true);
assert.deepEqual(RequireObjectCoercible(true), true);
assert.deepEqual(ToObject(true), Object(true));
const obj = {};
assert.equal(RequireObjectCoercible(obj), obj);
assert.equal(ToObject(obj), obj);
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
## Security
Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
[package-url]: https://npmjs.org/package/es-object-atoms
[npm-version-svg]: https://versionbadg.es/ljharb/es-object-atoms.svg
[deps-svg]: https://david-dm.org/ljharb/es-object-atoms.svg
[deps-url]: https://david-dm.org/ljharb/es-object-atoms
[dev-deps-svg]: https://david-dm.org/ljharb/es-object-atoms/dev-status.svg
[dev-deps-url]: https://david-dm.org/ljharb/es-object-atoms#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/es-object-atoms.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/es-object-atoms.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/es-object.svg
[downloads-url]: https://npm-stat.com/charts.html?package=es-object-atoms
[codecov-image]: https://codecov.io/gh/ljharb/es-object-atoms/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/ljharb/es-object-atoms/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-object-atoms
[actions-url]: https://github.com/ljharb/es-object-atoms/actions
@@ -0,0 +1 @@
{"version":3,"file":"crop.js","sources":["../../../src/icons/crop.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Crop\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNiAydjE0YTIgMiAwIDAgMCAyIDJoMTQiIC8+CiAgPHBhdGggZD0iTTE4IDIyVjhhMiAyIDAgMCAwLTItMkgyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/crop\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 Crop = createLucideIcon('Crop', [\n ['path', { d: 'M6 2v14a2 2 0 0 0 2 2h14', key: 'ron5a4' }],\n ['path', { d: 'M18 22V8a2 2 0 0 0-2-2H2', key: '7s9ehn' }],\n]);\n\nexport default Crop;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,iBAAiB,MAAQ,CAAA,CAAA,CAAA;AAAA,CAAA,CACpC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC3D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,8 @@
//#region src/utils/accept.d.ts
export interface Accept {
type: string;
params: Record<string, string>;
q: number;
}
export declare const parseAccept: (acceptHeader: string) => Accept[];
//#endregion
@@ -0,0 +1,8 @@
import { CacheType, DetectorOptions, DetectorType, LanguageVariables, detectFromCookie, detectFromHeader, detectFromPath, detectFromQuery, languageDetector } from "./language.js";
//#region src/middleware/language/index.d.ts
declare module '../..' {
interface ContextVariableMap extends LanguageVariables {}
}
//#endregion
export { type CacheType, type DetectorOptions, type DetectorType, type LanguageVariables, detectFromCookie, detectFromHeader, detectFromPath, detectFromQuery, languageDetector };
export {};
@@ -0,0 +1,652 @@
/**
* @fileoverview enforce a particular style for multiline comments
* @author Teddy Katz
* @deprecated in ESLint v9.3.0
*/
"use strict";
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "9.3.0",
availableUntil: "11.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin",
url: "https://eslint.style",
},
rule: {
name: "multiline-comment-style",
url: "https://eslint.style/rules/multiline-comment-style",
},
},
],
},
type: "suggestion",
docs: {
description: "Enforce a particular style for multiline comments",
recommended: false,
url: "https://eslint.org/docs/latest/rules/multiline-comment-style",
},
fixable: "whitespace",
schema: {
anyOf: [
{
type: "array",
items: [
{
enum: ["starred-block", "bare-block"],
},
],
additionalItems: false,
},
{
type: "array",
items: [
{
enum: ["separate-lines"],
},
{
type: "object",
properties: {
checkJSDoc: {
type: "boolean",
},
},
additionalProperties: false,
},
],
additionalItems: false,
},
],
},
messages: {
expectedBlock:
"Expected a block comment instead of consecutive line comments.",
expectedBareBlock:
"Expected a block comment without padding stars.",
startNewline: "Expected a linebreak after '/*'.",
endNewline: "Expected a linebreak before '*/'.",
missingStar: "Expected a '*' at the start of this line.",
alignment:
"Expected this line to be aligned with the start of the comment.",
expectedLines:
"Expected multiple line comments instead of a block comment.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const option = context.options[0] || "starred-block";
const params = context.options[1] || {};
const checkJSDoc = !!params.checkJSDoc;
//----------------------------------------------------------------------
// Helpers
//----------------------------------------------------------------------
/**
* Checks if a comment line is starred.
* @param {string} line A string representing a comment line.
* @returns {boolean} Whether or not the comment line is starred.
*/
function isStarredCommentLine(line) {
return /^\s*\*/u.test(line);
}
/**
* Checks if a comment group is in starred-block form.
* @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment.
* @returns {boolean} Whether or not the comment group is in starred block form.
*/
function isStarredBlockComment([firstComment]) {
if (firstComment.type !== "Block") {
return false;
}
const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER);
// The first and last lines can only contain whitespace.
return (
lines.length > 0 &&
lines.every((line, i) =>
(i === 0 || i === lines.length - 1
? /^\s*$/u
: /^\s*\*/u
).test(line),
)
);
}
/**
* Checks if a comment group is in JSDoc form.
* @param {Token[]} commentGroup A group of comments, containing either multiple line comments or a single block comment.
* @returns {boolean} Whether or not the comment group is in JSDoc form.
*/
function isJSDocComment([firstComment]) {
if (firstComment.type !== "Block") {
return false;
}
const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER);
return (
/^\*\s*$/u.test(lines[0]) &&
lines.slice(1, -1).every(line => /^\s* /u.test(line)) &&
/^\s*$/u.test(lines.at(-1))
);
}
/**
* Processes a comment group that is currently in separate-line form, calculating the offset for each line.
* @param {Token[]} commentGroup A group of comments containing multiple line comments.
* @returns {string[]} An array of the processed lines.
*/
function processSeparateLineComments(commentGroup) {
const allLinesHaveLeadingSpace = commentGroup
.map(({ value }) => value)
.filter(line => line.trim().length)
.every(line => line.startsWith(" "));
return commentGroup.map(({ value }) =>
allLinesHaveLeadingSpace ? value.replace(/^ /u, "") : value,
);
}
/**
* Processes a comment group that is currently in starred-block form, calculating the offset for each line.
* @param {Token} comment A single block comment token in starred-block form.
* @returns {string[]} An array of the processed lines.
*/
function processStarredBlockComment(comment) {
const lines = comment.value
.split(astUtils.LINEBREAK_MATCHER)
.filter(
(line, i, linesArr) =>
!(i === 0 || i === linesArr.length - 1),
)
.map(line => line.replace(/^\s*$/u, ""));
const allLinesHaveLeadingSpace = lines
.map(line => line.replace(/\s*\*/u, ""))
.filter(line => line.trim().length)
.every(line => line.startsWith(" "));
return lines.map(line =>
line.replace(
allLinesHaveLeadingSpace ? /\s*\* ?/u : /\s*\*/u,
"",
),
);
}
/**
* Processes a comment group that is currently in bare-block form, calculating the offset for each line.
* @param {Token} comment A single block comment token in bare-block form.
* @returns {string[]} An array of the processed lines.
*/
function processBareBlockComment(comment) {
const lines = comment.value
.split(astUtils.LINEBREAK_MATCHER)
.map(line => line.replace(/^\s*$/u, ""));
const leadingWhitespace = `${sourceCode.text.slice(comment.range[0] - comment.loc.start.column, comment.range[0])} `;
let offset = "";
/*
* Calculate the offset of the least indented line and use that as the basis for offsetting all the lines.
* The first line should not be checked because it is inline with the opening block comment delimiter.
*/
for (const [i, line] of lines.entries()) {
if (!line.trim().length || i === 0) {
continue;
}
const [, lineOffset] = line.match(/^(\s*\*?\s*)/u);
if (lineOffset.length < leadingWhitespace.length) {
const newOffset = leadingWhitespace.slice(
lineOffset.length - leadingWhitespace.length,
);
if (newOffset.length > offset.length) {
offset = newOffset;
}
}
}
return lines.map(line => {
const match = line.match(/^(\s*\*?\s*)(.*)/u);
const [, lineOffset, lineContents] = match;
if (lineOffset.length > leadingWhitespace.length) {
return `${lineOffset.slice(leadingWhitespace.length - (offset.length + lineOffset.length))}${lineContents}`;
}
if (lineOffset.length < leadingWhitespace.length) {
return `${lineOffset.slice(leadingWhitespace.length)}${lineContents}`;
}
return lineContents;
});
}
/**
* Gets a list of comment lines in a group, formatting leading whitespace as necessary.
* @param {Token[]} commentGroup A group of comments containing either multiple line comments or a single block comment.
* @returns {string[]} A list of comment lines.
*/
function getCommentLines(commentGroup) {
const [firstComment] = commentGroup;
if (firstComment.type === "Line") {
return processSeparateLineComments(commentGroup);
}
if (isStarredBlockComment(commentGroup)) {
return processStarredBlockComment(firstComment);
}
return processBareBlockComment(firstComment);
}
/**
* Gets the initial offset (whitespace) from the beginning of a line to a given comment token.
* @param {Token} comment The token to check.
* @returns {string} The offset from the beginning of a line to the token.
*/
function getInitialOffset(comment) {
return sourceCode.text.slice(
comment.range[0] - comment.loc.start.column,
comment.range[0],
);
}
/**
* Converts a comment into starred-block form
* @param {Token} firstComment The first comment of the group being converted
* @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment
* @returns {string} A representation of the comment value in starred-block form, excluding start and end markers
*/
function convertToStarredBlock(firstComment, commentLinesList) {
const initialOffset = getInitialOffset(firstComment);
return `/*\n${commentLinesList.map(line => `${initialOffset} * ${line}`).join("\n")}\n${initialOffset} */`;
}
/**
* Converts a comment into separate-line form
* @param {Token} firstComment The first comment of the group being converted
* @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment
* @returns {string} A representation of the comment value in separate-line form
*/
function convertToSeparateLines(firstComment, commentLinesList) {
return commentLinesList
.map(line => `// ${line}`)
.join(`\n${getInitialOffset(firstComment)}`);
}
/**
* Converts a comment into bare-block form
* @param {Token} firstComment The first comment of the group being converted
* @param {string[]} commentLinesList A list of lines to appear in the new starred-block comment
* @returns {string} A representation of the comment value in bare-block form
*/
function convertToBlock(firstComment, commentLinesList) {
return `/* ${commentLinesList.join(`\n${getInitialOffset(firstComment)} `)} */`;
}
/**
* Each method checks a group of comments to see if it's valid according to the given option.
* @param {Token[]} commentGroup A list of comments that appear together. This will either contain a single
* block comment or multiple line comments.
* @returns {void}
*/
const commentGroupCheckers = {
"starred-block"(commentGroup) {
const [firstComment] = commentGroup;
const commentLines = getCommentLines(commentGroup);
if (commentLines.some(value => value.includes("*/"))) {
return;
}
if (commentGroup.length > 1) {
context.report({
loc: {
start: firstComment.loc.start,
end: commentGroup.at(-1).loc.end,
},
messageId: "expectedBlock",
fix(fixer) {
const range = [
firstComment.range[0],
commentGroup.at(-1).range[1],
];
return commentLines.some(value =>
value.startsWith("/"),
)
? null
: fixer.replaceTextRange(
range,
convertToStarredBlock(
firstComment,
commentLines,
),
);
},
});
} else {
const lines = firstComment.value.split(
astUtils.LINEBREAK_MATCHER,
);
const expectedLeadingWhitespace =
getInitialOffset(firstComment);
const expectedLinePrefix = `${expectedLeadingWhitespace} *`;
if (!/^\*?\s*$/u.test(lines[0])) {
const start = firstComment.value.startsWith("*")
? firstComment.range[0] + 1
: firstComment.range[0];
context.report({
loc: {
start: firstComment.loc.start,
end: {
line: firstComment.loc.start.line,
column: firstComment.loc.start.column + 2,
},
},
messageId: "startNewline",
fix: fixer =>
fixer.insertTextAfterRange(
[start, start + 2],
`\n${expectedLinePrefix}`,
),
});
}
if (!/^\s*$/u.test(lines.at(-1))) {
context.report({
loc: {
start: {
line: firstComment.loc.end.line,
column: firstComment.loc.end.column - 2,
},
end: firstComment.loc.end,
},
messageId: "endNewline",
fix: fixer =>
fixer.replaceTextRange(
[
firstComment.range[1] - 2,
firstComment.range[1],
],
`\n${expectedLinePrefix}/`,
),
});
}
for (
let lineNumber = firstComment.loc.start.line + 1;
lineNumber <= firstComment.loc.end.line;
lineNumber++
) {
const lineText = sourceCode.lines[lineNumber - 1];
const errorType = isStarredCommentLine(lineText)
? "alignment"
: "missingStar";
if (!lineText.startsWith(expectedLinePrefix)) {
context.report({
loc: {
start: { line: lineNumber, column: 0 },
end: {
line: lineNumber,
column: lineText.length,
},
},
messageId: errorType,
fix(fixer) {
const lineStartIndex =
sourceCode.getIndexFromLoc({
line: lineNumber,
column: 0,
});
if (errorType === "alignment") {
const [, commentTextPrefix = ""] =
lineText.match(/^(\s*\*)/u) || [];
const commentTextStartIndex =
lineStartIndex +
commentTextPrefix.length;
return fixer.replaceTextRange(
[
lineStartIndex,
commentTextStartIndex,
],
expectedLinePrefix,
);
}
const [, commentTextPrefix = ""] =
lineText.match(/^(\s*)/u) || [];
const commentTextStartIndex =
lineStartIndex +
commentTextPrefix.length;
let offset;
for (const [idx, line] of lines.entries()) {
if (!/\S+/u.test(line)) {
continue;
}
const lineTextToAlignWith =
sourceCode.lines[
firstComment.loc.start.line -
1 +
idx
];
const [
,
prefix = "",
initialOffset = "",
] =
lineTextToAlignWith.match(
/^(\s*(?:\/?\*)?(\s*))/u,
) || [];
offset = `${commentTextPrefix.slice(prefix.length)}${initialOffset}`;
if (
/^\s*\//u.test(lineText) &&
offset.length === 0
) {
offset += " ";
}
break;
}
return fixer.replaceTextRange(
[lineStartIndex, commentTextStartIndex],
`${expectedLinePrefix}${offset}`,
);
},
});
}
}
}
},
"separate-lines"(commentGroup) {
const [firstComment] = commentGroup;
const isJSDoc = isJSDocComment(commentGroup);
if (firstComment.type !== "Block" || (!checkJSDoc && isJSDoc)) {
return;
}
let commentLines = getCommentLines(commentGroup);
if (isJSDoc) {
commentLines = commentLines.slice(
1,
commentLines.length - 1,
);
}
const tokenAfter = sourceCode.getTokenAfter(firstComment, {
includeComments: true,
});
if (
tokenAfter &&
firstComment.loc.end.line === tokenAfter.loc.start.line
) {
return;
}
context.report({
loc: {
start: firstComment.loc.start,
end: {
line: firstComment.loc.start.line,
column: firstComment.loc.start.column + 2,
},
},
messageId: "expectedLines",
fix(fixer) {
return fixer.replaceText(
firstComment,
convertToSeparateLines(firstComment, commentLines),
);
},
});
},
"bare-block"(commentGroup) {
if (isJSDocComment(commentGroup)) {
return;
}
const [firstComment] = commentGroup;
const commentLines = getCommentLines(commentGroup);
// Disallows consecutive line comments in favor of using a block comment.
if (
firstComment.type === "Line" &&
commentLines.length > 1 &&
!commentLines.some(value => value.includes("*/"))
) {
context.report({
loc: {
start: firstComment.loc.start,
end: commentGroup.at(-1).loc.end,
},
messageId: "expectedBlock",
fix(fixer) {
return fixer.replaceTextRange(
[
firstComment.range[0],
commentGroup.at(-1).range[1],
],
convertToBlock(firstComment, commentLines),
);
},
});
}
// Prohibits block comments from having a * at the beginning of each line.
if (isStarredBlockComment(commentGroup)) {
context.report({
loc: {
start: firstComment.loc.start,
end: {
line: firstComment.loc.start.line,
column: firstComment.loc.start.column + 2,
},
},
messageId: "expectedBareBlock",
fix(fixer) {
return fixer.replaceText(
firstComment,
convertToBlock(firstComment, commentLines),
);
},
});
}
},
};
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
return {
Program() {
return sourceCode
.getAllComments()
.filter(comment => comment.type !== "Shebang")
.filter(
comment =>
!astUtils.COMMENTS_IGNORE_PATTERN.test(
comment.value,
),
)
.filter(comment => {
const tokenBefore = sourceCode.getTokenBefore(comment, {
includeComments: true,
});
return (
!tokenBefore ||
tokenBefore.loc.end.line < comment.loc.start.line
);
})
.reduce((commentGroups, comment, index, commentList) => {
const tokenBefore = sourceCode.getTokenBefore(comment, {
includeComments: true,
});
if (
comment.type === "Line" &&
index &&
commentList[index - 1].type === "Line" &&
tokenBefore &&
tokenBefore.loc.end.line ===
comment.loc.start.line - 1 &&
tokenBefore === commentList[index - 1]
) {
commentGroups.at(-1).push(comment);
} else {
commentGroups.push([comment]);
}
return commentGroups;
}, [])
.filter(
commentGroup =>
!(
commentGroup.length === 1 &&
commentGroup[0].loc.start.line ===
commentGroup[0].loc.end.line
),
)
.forEach(commentGroupCheckers[option]);
},
};
},
};
@@ -0,0 +1,126 @@
import type { JSONRPCMessage, MessageExtraInfo, Transport, TransportSendOptions } from "@modelcontextprotocol/client";
/**
* JSON-RPC transport using `window.postMessage` for iframe↔parent communication.
*
* This transport enables bidirectional communication between MCP Apps running in
* iframes and their host applications using the browser's `postMessage` API. It
* implements the MCP SDK's `Transport` interface.
*
* ## Security
*
* The `eventSource` parameter is required and validates the message source window
* by checking `event.source`. For views, pass `window.parent`.
* For hosts, pass `iframe.contentWindow` to validate the iframe source.
*
* ## Usage
*
* **View**:
* ```ts source="./message-transport.examples.ts#PostMessageTransport_view"
* const transport = new PostMessageTransport(window.parent, window.parent);
* await app.connect(transport);
* ```
*
* **Host**:
* ```ts source="./message-transport.examples.ts#PostMessageTransport_host"
* const iframe = document.getElementById("app-iframe") as HTMLIFrameElement;
* const transport = new PostMessageTransport(
* iframe.contentWindow!,
* iframe.contentWindow!,
* );
* await bridge.connect(transport);
* ```
*
* @see {@link app!App.connect `App.connect`} for View usage
* @see {@link app-bridge!AppBridge.connect `AppBridge.connect`} for Host usage
*/
export declare class PostMessageTransport implements Transport {
private eventTarget;
private eventSource;
private messageListener;
/**
* Create a new PostMessageTransport.
*
* @param eventTarget - Target window to send messages to (default: `window.parent`)
* @param eventSource - Source window for message validation. For views, pass
* `window.parent`. For hosts, pass `iframe.contentWindow`.
*
* @example View connecting to parent
* ```ts source="./message-transport.examples.ts#PostMessageTransport_constructor_view"
* const transport = new PostMessageTransport(window.parent, window.parent);
* ```
*
* @example Host connecting to iframe
* ```ts source="./message-transport.examples.ts#PostMessageTransport_constructor_host"
* const iframe = document.getElementById("app-iframe") as HTMLIFrameElement;
* const transport = new PostMessageTransport(
* iframe.contentWindow!,
* iframe.contentWindow!,
* );
* ```
*/
constructor(eventTarget: Window | undefined, eventSource: MessageEventSource);
/**
* Begin listening for messages from the event source.
*
* Registers a message event listener on the window. Must be called before
* messages can be received.
*/
start(): Promise<void>;
/**
* Send a JSON-RPC message to the target window.
*
* Messages are sent using `postMessage` with `"*"` origin, meaning they are visible
* to all frames. The receiver should validate the message source for security.
*
* @param message - JSON-RPC message to send
* @param options - Optional send options (currently unused)
*/
send(message: JSONRPCMessage, options?: TransportSendOptions): Promise<void>;
/**
* Stop listening for messages and cleanup.
*
* Removes the message event listener and calls the {@link onclose `onclose`} callback if set.
*/
close(): Promise<void>;
/**
* Called when the transport is closed.
*
* Set this handler to be notified when {@link close `close`} is called.
*/
onclose?: () => void;
/**
* Called when a message parsing error occurs.
*
* This handler is invoked when a received message fails JSON-RPC schema
* validation. The error parameter contains details about the validation failure.
*
* @param error - Error describing the validation failure
*/
onerror?: (error: Error) => void;
/**
* Called when a valid JSON-RPC message is received.
*
* This handler is invoked after message validation succeeds. The {@link start `start`}
* method must be called before messages will be received.
*
* @param message - The validated JSON-RPC message
* @param extra - Optional metadata about the message (unused in this transport)
*/
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
/**
* Optional session identifier for this transport connection.
*
* Set by the MCP SDK to track the connection session. Not required for
* `PostMessageTransport` functionality.
*/
sessionId?: string;
/**
* Callback to set the negotiated protocol version.
*
* The MCP SDK calls this during initialization to communicate the protocol
* version negotiated with the peer.
*
* @param version - The negotiated protocol version string
*/
setProtocolVersion?: (version: string) => void;
}
@@ -0,0 +1,292 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/mini";
test("z.object", () => {
const a = z.object({
name: z.string(),
age: z.number(),
points: z.optional(z.number()),
"test?": z.boolean(),
});
a._zod.def.shape["test?"];
a._zod.def.shape.points._zod.optin;
type a = z.output<typeof a>;
expectTypeOf<a>().toEqualTypeOf<{
name: string;
age: number;
points?: number | undefined;
"test?": boolean;
}>();
expect(z.parse(a, { name: "john", age: 30, "test?": true })).toEqual({
name: "john",
age: 30,
"test?": true,
});
// "test?" is required in ZodObject
expect(() => z.parse(a, { name: "john", age: "30" })).toThrow();
expect(() => z.parse(a, "hello")).toThrow();
// null prototype
const schema = z.object({ a: z.string() });
const obj = Object.create(null);
obj.a = "foo";
expect(schema.parse(obj)).toEqual({ a: "foo" });
});
test("z.object().check()", () => {
const a = z.object({
name: z.string(),
age: z.number(),
points: z.optional(z.number()),
"test?": z.boolean(),
});
type a = z.output<typeof a>;
a.check(({ value }) => {
expectTypeOf(value).toEqualTypeOf<a>();
});
});
test("z.strictObject", () => {
const a = z.strictObject({
name: z.string(),
});
expect(z.parse(a, { name: "john" })).toEqual({ name: "john" });
expect(() => z.parse(a, { name: "john", age: 30 })).toThrow();
expect(() => z.parse(a, "hello")).toThrow();
});
test("z.looseObject", () => {
const a = z.looseObject({
name: z.string(),
age: z.number(),
});
expect(z.parse(a, { name: "john", age: 30 })).toEqual({
name: "john",
age: 30,
});
expect(z.parse(a, { name: "john", age: 30, extra: true })).toEqual({
name: "john",
age: 30,
extra: true,
});
expect(() => z.parse(a, "hello")).toThrow();
});
const userSchema = z.object({
name: z.string(),
age: z.number(),
email: z.optional(z.string()),
});
test("z.keyof", () => {
// z.keyof returns an enum schema of the keys of an object schema
const userKeysSchema = z.keyof(userSchema);
type UserKeys = z.infer<typeof userKeysSchema>;
expectTypeOf<UserKeys>().toEqualTypeOf<"name" | "age" | "email">();
expect(userKeysSchema).toBeDefined();
expect(userKeysSchema._zod.def.type).toBe("enum");
expect(userKeysSchema._zod.def.entries).toEqual({
name: "name",
age: "age",
email: "email",
});
expect(z.safeParse(userKeysSchema, "name").success).toBe(true);
expect(z.safeParse(userKeysSchema, "age").success).toBe(true);
expect(z.safeParse(userKeysSchema, "email").success).toBe(true);
expect(z.safeParse(userKeysSchema, "isAdmin").success).toBe(false);
});
test("z.extend", () => {
const extendedSchema = z.extend(userSchema, {
isAdmin: z.boolean(),
});
type ExtendedUser = z.infer<typeof extendedSchema>;
expectTypeOf<ExtendedUser>().toEqualTypeOf<{
name: string;
age: number;
email?: string | undefined;
isAdmin: boolean;
}>();
expect(extendedSchema).toBeDefined();
expect(z.safeParse(extendedSchema, { name: "John", age: 30, isAdmin: true }).success).toBe(true);
});
test("z.merge", () => {
const mergedSchema = z.merge(userSchema, z.object({ isAdmin: z.boolean() }));
type MergedUser = z.infer<typeof mergedSchema>;
expectTypeOf<MergedUser>().toEqualTypeOf<{
name: string;
age: number;
email?: string | undefined;
isAdmin: boolean;
}>();
expect(z.safeParse(mergedSchema, { name: "John", age: 30, isAdmin: true }).success).toBe(true);
// the second schema's catchall wins, matching classic
const strict = z.merge(userSchema, z.strictObject({ isAdmin: z.boolean() }));
expect(z.safeParse(strict, { name: "John", age: 30, isAdmin: true, extra: 1 }).success).toBe(false);
expect(() =>
// @ts-expect-error second argument is a schema, not a shape
z.merge(userSchema, { isAdmin: z.boolean() })
).toThrow("Invalid input to merge");
});
test("z.safeExtend", () => {
const extended = z.safeExtend(userSchema, { name: z.string() });
expect(z.safeParse(extended, { name: "John", age: 30 }).success).toBe(true);
type Extended = z.infer<typeof extended>;
expectTypeOf<Extended>().toEqualTypeOf<{ name: string; age: number; email?: string | undefined }>();
// @ts-expect-error
z.safeExtend(userSchema, { name: z.number() });
});
test("z.pick", () => {
const pickedSchema = z.pick(userSchema, { name: true, email: true });
type PickedUser = z.infer<typeof pickedSchema>;
expectTypeOf<PickedUser>().toEqualTypeOf<{ name: string; email?: string | undefined }>();
expect(pickedSchema).toBeDefined();
expect(z.safeParse(pickedSchema, { name: "John", email: "john@example.com" }).success).toBe(true);
});
test("z.omit", () => {
const omittedSchema = z.omit(userSchema, { age: true });
type OmittedUser = z.infer<typeof omittedSchema>;
expectTypeOf<OmittedUser>().toEqualTypeOf<{
name: string;
email?: string | undefined;
}>();
expect(omittedSchema).toBeDefined();
expect(Reflect.ownKeys(omittedSchema._zod.def.shape)).toEqual(["name", "email"]);
expect(z.safeParse(omittedSchema, { name: "John", email: "john@example.com" }).success).toBe(true);
});
test("z.partial", () => {
const partialSchema = z.partial(userSchema);
type PartialUser = z.infer<typeof partialSchema>;
expectTypeOf<PartialUser>().toEqualTypeOf<{
name?: string | undefined;
age?: number | undefined;
email?: string | undefined;
}>();
expect(z.safeParse(partialSchema, { name: "John" }).success).toBe(true);
});
test("z.partial with mask", () => {
const partialSchemaWithMask = z.partial(userSchema, { name: true });
type PartialUserWithMask = z.infer<typeof partialSchemaWithMask>;
expectTypeOf<PartialUserWithMask>().toEqualTypeOf<{
name?: string | undefined;
age: number;
email?: string | undefined;
}>();
expect(z.safeParse(partialSchemaWithMask, { age: 30 }).success).toBe(true);
expect(z.safeParse(partialSchemaWithMask, { name: "John" }).success).toBe(false);
});
test("z.exactPartial", () => {
const partialSchema = z.exactPartial(userSchema);
type PartialUser = z.infer<typeof partialSchema>;
expectTypeOf<PartialUser>().toEqualTypeOf<{
name?: string;
age?: number;
email?: string | undefined;
}>();
expect(z.safeParse(partialSchema, { name: "John" }).success).toBe(true);
expect(z.safeParse(partialSchema, {}).success).toBe(true);
expect(z.safeParse(partialSchema, { name: undefined }).success).toBe(false);
expect(z.safeParse(partialSchema, { email: undefined }).success).toBe(true);
});
test("z.exactPartial with mask", () => {
const partialSchemaWithMask = z.exactPartial(userSchema, { name: true });
type PartialUserWithMask = z.infer<typeof partialSchemaWithMask>;
expectTypeOf<PartialUserWithMask>().toEqualTypeOf<{
name?: string;
age: number;
email?: string | undefined;
}>();
expect(z.safeParse(partialSchemaWithMask, { age: 30 }).success).toBe(true);
expect(z.safeParse(partialSchemaWithMask, { age: 30, name: undefined }).success).toBe(false);
});
test("z.required", () => {
const requiredSchema = z.required(userSchema);
type RequiredUser = z.infer<typeof requiredSchema>;
expectTypeOf<RequiredUser>().toEqualTypeOf<{ name: string; age: number; email: string }>();
expect(requiredSchema.shape.email).toBeInstanceOf(z.ZodMiniNonOptional);
expect(z.safeParse(requiredSchema, { name: "John", age: 30 }).success).toBe(false);
expect(z.safeParse(requiredSchema, { name: "John", age: 30, email: "john@example.com" }).success).toBe(true);
});
test("z.required with mask", () => {
const schema = z.object({ name: z.optional(z.string()), age: z.optional(z.number()) });
const requiredSchemaWithMask = z.required(schema, { name: true });
type RequiredWithMask = z.infer<typeof requiredSchemaWithMask>;
expectTypeOf<RequiredWithMask>().toEqualTypeOf<{ name: string; age?: number | undefined }>();
expect(requiredSchemaWithMask.shape.name).toBeInstanceOf(z.ZodMiniNonOptional);
expect(requiredSchemaWithMask.shape.age).toBeInstanceOf(z.ZodMiniOptional);
});
test("z.pick/omit/partial/required - do not allow unknown keys", () => {
const schema = z.object({
name: z.string(),
age: z.number(),
});
// Mixed valid + invalid keys - throws at parse time (lazy evaluation)
// @ts-expect-error
expect(() => z.parse(z.pick(schema, { name: true, asdf: true }), {})).toThrow();
// @ts-expect-error
expect(() => z.parse(z.omit(schema, { name: true, asdf: true }), {})).toThrow();
// @ts-expect-error
expect(() => z.parse(z.partial(schema, { name: true, asdf: true }), {})).toThrow();
// @ts-expect-error
expect(() => z.parse(z.required(schema, { name: true, asdf: true }), {})).toThrow();
// Only invalid keys
// @ts-expect-error
expect(() => z.parse(z.pick(schema, { $unknown: true }), {})).toThrow();
// @ts-expect-error
expect(() => z.parse(z.omit(schema, { $unknown: true }), {})).toThrow();
// @ts-expect-error
expect(() => z.parse(z.partial(schema, { $unknown: true }), {})).toThrow();
// @ts-expect-error
expect(() => z.parse(z.required(schema, { $unknown: true }), {})).toThrow();
});
test("z.catchall", () => {
// z.catchall()
const schema = z.catchall(
z.object({
name: z.string(),
// age: z.number(),
}),
z.string()
);
type schemaIn = z.input<typeof schema>;
type schemaOut = z.output<typeof schema>;
expectTypeOf<schemaIn>().toEqualTypeOf<{
name: string;
[key: string]: string;
}>();
expectTypeOf<schemaOut>().toEqualTypeOf<{
name: string;
[key: string]: string;
}>();
schema.parse({
name: "john",
age: "30",
extra: "extra value",
});
expect(() => schema.parse({ name: "john", age: 30 })).toThrow();
});
@@ -0,0 +1,70 @@
{
"name": "@radix-ui/react-focus-scope",
"version": "1.1.7",
"license": "MIT",
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"dependencies": {
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-use-callback-ref": "1.1.1"
},
"devDependencies": {
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"eslint": "^9.18.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"typescript": "^5.7.3",
"@repo/builder": "0.0.0",
"@repo/eslint-config": "0.0.0",
"@repo/typescript-config": "0.0.0"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"scripts": {
"lint": "eslint --max-warnings 0 src",
"clean": "rm -rf dist",
"typecheck": "tsc --noEmit",
"build": "radix-build"
},
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
}
@@ -0,0 +1,11 @@
Copyright 2011 Gary Court. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY GARY COURT "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARY COURT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Gary Court.
@@ -0,0 +1,21 @@
/**
* @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 ScanBarcode = createLucideIcon("ScanBarcode", [
["path", { d: "M3 7V5a2 2 0 0 1 2-2h2", key: "aa7l1z" }],
["path", { d: "M17 3h2a2 2 0 0 1 2 2v2", key: "4qcy5o" }],
["path", { d: "M21 17v2a2 2 0 0 1-2 2h-2", key: "6vwrx8" }],
["path", { d: "M7 21H5a2 2 0 0 1-2-2v-2", key: "ioqczr" }],
["path", { d: "M8 7v10", key: "23sfjj" }],
["path", { d: "M12 7v10", key: "jspqdw" }],
["path", { d: "M17 7v10", key: "578dap" }]
]);
export { ScanBarcode as default };
//# sourceMappingURL=scan-barcode.js.map
@@ -0,0 +1 @@
{"version":3,"file":"matchContext.cjs","names":[],"sources":["../../src/matchContext.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\n\nexport const matchContext = React.createContext<string | undefined>(undefined)\n\n// N.B. this only exists so we can conditionally call useContext on it when we are not interested in the nearest match\nexport const dummyMatchContext = React.createContext<string | undefined>(\n undefined,\n)\n"],"mappings":";;;;;AAIA,IAAa,eAAe,MAAM,cAAkC,KAAA,EAAU;AAG9E,IAAa,oBAAoB,MAAM,cACrC,KAAA,EACD"}
@@ -0,0 +1,29 @@
export default {
4: [
// for length-4 strings, eg 1191 or 9111, two ways to split:
[1, 2], // 1 1 91 (2nd split starts at index 1, 3rd at index 2)
[2, 3], // 91 1 1
],
5: [
[1, 3], // 1 11 91
[2, 3], // 11 1 91
// [2, 3], // 91 1 11 <- duplicate previous one
[2, 4], // 91 11 1 <- New and must be added as bug fix
],
6: [
[1, 2], // 1 1 1991
[2, 4], // 11 11 91
[4, 5], // 1991 1 1
],
// 1111991
7: [
[1, 3], // 1 11 1991
[2, 3], // 11 1 1991
[4, 5], // 1991 1 11
[4, 6], // 1991 11 1
],
8: [
[2, 4], // 11 11 1991
[4, 6], // 1991 11 11
],
}
@@ -0,0 +1,13 @@
type GeneratedColumn = number;
type SourcesIndex = number;
type SourceLine = number;
type SourceColumn = number;
type NamesIndex = number;
export type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];
export declare const COLUMN = 0;
export declare const SOURCES_INDEX = 1;
export declare const SOURCE_LINE = 2;
export declare const SOURCE_COLUMN = 3;
export declare const NAMES_INDEX = 4;
export {};
//# sourceMappingURL=sourcemap-segment.d.ts.map
@@ -0,0 +1,84 @@
"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 });
exports.getTypeName = getTypeName;
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
/**
* Get the type name of a given type.
* @param typeChecker The context sensitive TypeScript TypeChecker.
* @param type The type to get the name of.
*/
function getTypeName(typeChecker, type) {
// It handles `string` and string literal types as string.
if (tsutils.isTypeFlagSet(type, ts.TypeFlags.StringLike)) {
return 'string';
}
// If the type is a type parameter which extends primitive string types,
// but it was not recognized as a string like. So check the constraint
// type of the type parameter.
if (tsutils.isTypeFlagSet(type, ts.TypeFlags.TypeParameter)) {
// `type.getConstraint()` method doesn't return the constraint type of
// the type parameter for some reason. So this gets the constraint type
// via AST.
const symbol = type.getSymbol();
const decls = symbol?.getDeclarations();
const typeParamDecl = decls?.[0];
if (typeParamDecl != null &&
ts.isTypeParameterDeclaration(typeParamDecl) &&
typeParamDecl.constraint != null) {
return getTypeName(typeChecker, typeChecker.getTypeFromTypeNode(typeParamDecl.constraint));
}
}
// If the type is a union and all types in the union are string like,
// return `string`. For example:
// - `"a" | "b"` is string.
// - `string | string[]` is not string.
if (type.isUnion() &&
type.types
.map(value => getTypeName(typeChecker, value))
.every(t => t === 'string')) {
return 'string';
}
// If the type is an intersection and a type in the intersection is string
// like, return `string`. For example: `string & {__htmlEscaped: void}`
if (type.isIntersection() &&
type.types
.map(value => getTypeName(typeChecker, value))
.some(t => t === 'string')) {
return 'string';
}
return typeChecker.typeToString(type);
}
@@ -0,0 +1,132 @@
'use strict';
/*
Copyright 2012-2015, Yahoo Inc.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
const fs = require('fs');
const FileWriter = require('./file-writer');
const XMLWriter = require('./xml-writer');
const tree = require('./tree');
const watermarks = require('./watermarks');
const SummarizerFactory = require('./summarizer-factory');
function defaultSourceLookup(path) {
try {
return fs.readFileSync(path, 'utf8');
} catch (ex) {
throw new Error(`Unable to lookup source: ${path} (${ex.message})`);
}
}
function normalizeWatermarks(specified = {}) {
Object.entries(watermarks.getDefault()).forEach(([k, value]) => {
const specValue = specified[k];
if (!Array.isArray(specValue) || specValue.length !== 2) {
specified[k] = value;
}
});
return specified;
}
/**
* A reporting context that is passed to report implementations
* @param {Object} [opts=null] opts options
* @param {String} [opts.dir='coverage'] opts.dir the reporting directory
* @param {Object} [opts.watermarks=null] opts.watermarks watermarks for
* statements, lines, branches and functions
* @param {Function} [opts.sourceFinder=fsLookup] opts.sourceFinder a
* function that returns source code given a file path. Defaults to
* filesystem lookups based on path.
* @constructor
*/
class Context {
constructor(opts) {
this.dir = opts.dir || 'coverage';
this.watermarks = normalizeWatermarks(opts.watermarks);
this.sourceFinder = opts.sourceFinder || defaultSourceLookup;
this._summarizerFactory = new SummarizerFactory(
opts.coverageMap,
opts.defaultSummarizer
);
this.data = {};
}
/**
* returns a FileWriter implementation for reporting use. Also available
* as the `writer` property on the context.
* @returns {Writer}
*/
getWriter() {
return this.writer;
}
/**
* returns the source code for the specified file path or throws if
* the source could not be found.
* @param {String} filePath the file path as found in a file coverage object
* @returns {String} the source code
*/
getSource(filePath) {
return this.sourceFinder(filePath);
}
/**
* returns the coverage class given a coverage
* types and a percentage value.
* @param {String} type - the coverage type, one of `statements`, `functions`,
* `branches`, or `lines`
* @param {Number} value - the percentage value
* @returns {String} one of `high`, `medium` or `low`
*/
classForPercent(type, value) {
const watermarks = this.watermarks[type];
if (!watermarks) {
return 'unknown';
}
if (value < watermarks[0]) {
return 'low';
}
if (value >= watermarks[1]) {
return 'high';
}
return 'medium';
}
/**
* returns an XML writer for the supplied content writer
* @param {ContentWriter} contentWriter the content writer to which the returned XML writer
* writes data
* @returns {XMLWriter}
*/
getXMLWriter(contentWriter) {
return new XMLWriter(contentWriter);
}
/**
* returns a full visitor given a partial one.
* @param {Object} partialVisitor a partial visitor only having the functions of
* interest to the caller. These functions are called with a scope that is the
* supplied object.
* @returns {Visitor}
*/
getVisitor(partialVisitor) {
return new tree.Visitor(partialVisitor);
}
getTree(name = 'defaultSummarizer') {
return this._summarizerFactory[name];
}
}
Object.defineProperty(Context.prototype, 'writer', {
enumerable: true,
get() {
if (!this.data.writer) {
this.data.writer = new FileWriter(this.dir);
}
return this.data.writer;
}
});
module.exports = Context;
@@ -0,0 +1,593 @@
'use strict'
const { isIP } = require('node:net')
const { lookup } = require('node:dns')
const DecoratorHandler = require('../handler/decorator-handler')
const { InvalidArgumentError, InformationalError } = require('../core/errors')
const { kRequestOrigin } = require('../core/symbols')
const maxInt = Math.pow(2, 31) - 1
function hasSafeIterator (headers) {
const prototype = Object.getPrototypeOf(headers)
const ownIterator = Object.hasOwn(headers, Symbol.iterator)
return ownIterator || (prototype != null && prototype !== Object.prototype && typeof headers[Symbol.iterator] === 'function')
}
function isHostHeader (key) {
return typeof key === 'string' && key.toLowerCase() === 'host'
}
function normalizeHeaders (headers) {
if (headers == null) {
return null
}
if (Array.isArray(headers)) {
if (headers.length === 0 || !Array.isArray(headers[0])) {
return headers
}
const normalized = []
for (const header of headers) {
if (Array.isArray(header) && header.length === 2) {
normalized.push(header[0], header[1])
} else {
normalized.push(header)
}
}
return normalized
}
if (typeof headers === 'object' && hasSafeIterator(headers)) {
const normalized = []
for (const header of headers) {
if (Array.isArray(header) && header.length === 2) {
normalized.push(header[0], header[1])
} else {
normalized.push(header)
}
}
return normalized
}
return headers
}
function hasHostHeader (headers) {
if (headers == null) {
return false
}
if (Array.isArray(headers)) {
if (headers.length === 0) {
return false
}
for (let i = 0; i < headers.length; i += 2) {
if (isHostHeader(headers[i])) {
return true
}
}
return false
}
if (typeof headers === 'object') {
for (const key in headers) {
if (isHostHeader(key)) {
return true
}
}
}
return false
}
function withHostHeader (host, headers) {
const normalizedHeaders = normalizeHeaders(headers)
if (hasHostHeader(normalizedHeaders)) {
return normalizedHeaders
}
if (Array.isArray(normalizedHeaders)) {
return ['host', host, ...normalizedHeaders]
}
if (normalizedHeaders && typeof normalizedHeaders === 'object') {
return {
host,
...normalizedHeaders
}
}
return { host }
}
class DNSStorage {
#maxItems = 0
#records = new Map()
constructor (opts) {
this.#maxItems = opts.maxItems
}
get size () {
return this.#records.size
}
get (hostname) {
return this.#records.get(hostname) ?? null
}
set (hostname, records) {
this.#records.set(hostname, records)
}
delete (hostname) {
this.#records.delete(hostname)
}
// Delegate to storage decide can we do more lookups or not
full () {
return this.size >= this.#maxItems
}
}
class DNSInstance {
#maxTTL = 0
#maxItems = 0
dualStack = true
affinity = null
lookup = null
pick = null
storage = null
constructor (opts) {
this.#maxTTL = opts.maxTTL
this.#maxItems = opts.maxItems
this.dualStack = opts.dualStack
this.affinity = opts.affinity
this.lookup = opts.lookup ?? this.#defaultLookup
this.pick = opts.pick ?? this.#defaultPick
this.storage = opts.storage ?? new DNSStorage(opts)
}
runLookup (origin, opts, cb) {
const ips = this.storage.get(origin.hostname)
// If full, we just return the origin
if (ips == null && this.storage.full()) {
cb(null, origin)
return
}
const newOpts = {
affinity: this.affinity,
dualStack: this.dualStack,
lookup: this.lookup,
pick: this.pick,
...opts.dns,
maxTTL: this.#maxTTL,
maxItems: this.#maxItems
}
// If no IPs we lookup
if (ips == null) {
this.lookup(origin, newOpts, (err, addresses) => {
if (err || addresses == null || addresses.length === 0) {
cb(err ?? new InformationalError('No DNS entries found'))
return
}
this.setRecords(origin, addresses)
const records = this.storage.get(origin.hostname)
const ip = this.pick(
origin,
records,
newOpts.affinity
)
// The lookup succeeded, but nothing it returned is usable here: with
// dualStack disabled and an affinity set, records of the other family
// cannot be picked. Running the lookup again would return the same
// records, so report it the way an empty result is reported.
if (ip == null) {
this.storage.delete(origin.hostname)
cb(new InformationalError('No DNS entries found'))
return
}
let port
if (typeof ip.port === 'number') {
port = `:${ip.port}`
} else if (origin.port !== '') {
port = `:${origin.port}`
} else {
port = ''
}
cb(
null,
new URL(`${origin.protocol}//${
ip.family === 6 ? `[${ip.address}]` : ip.address
}${port}`)
)
})
} else {
// If there's IPs we pick
const ip = this.pick(
origin,
ips,
newOpts.affinity
)
// If no IPs we lookup - deleting old records
if (ip == null) {
this.storage.delete(origin.hostname)
this.runLookup(origin, opts, cb)
return
}
let port
if (typeof ip.port === 'number') {
port = `:${ip.port}`
} else if (origin.port !== '') {
port = `:${origin.port}`
} else {
port = ''
}
cb(
null,
new URL(`${origin.protocol}//${
ip.family === 6 ? `[${ip.address}]` : ip.address
}${port}`)
)
}
}
#defaultLookup (origin, opts, cb) {
lookup(
origin.hostname,
{
all: true,
family: this.dualStack === false ? this.affinity : 0,
order: 'ipv4first'
},
(err, addresses) => {
if (err) {
return cb(err)
}
const results = new Map()
for (const addr of addresses) {
// On linux we found duplicates, we attempt to remove them with
// the latest record
results.set(`${addr.address}:${addr.family}`, addr)
}
cb(null, results.values())
}
)
}
#defaultPick (origin, hostnameRecords, affinity) {
let ip = null
const { records, offset } = hostnameRecords
let family
if (this.dualStack) {
if (affinity == null) {
// Balance between ip families
if (offset == null || offset === maxInt) {
hostnameRecords.offset = 0
affinity = 4
} else {
hostnameRecords.offset++
affinity = (hostnameRecords.offset & 1) === 1 ? 6 : 4
}
}
if (records[affinity] != null && records[affinity].ips.length > 0) {
family = records[affinity]
} else {
family = records[affinity === 4 ? 6 : 4]
}
} else {
family = records[affinity]
}
// If no IPs we return null
if (family == null || family.ips.length === 0) {
return ip
}
if (family.offset == null || family.offset === maxInt) {
family.offset = 0
} else {
family.offset++
}
const position = family.offset % family.ips.length
ip = family.ips[position] ?? null
if (ip == null) {
return ip
}
if (Date.now() - ip.timestamp > ip.ttl) { // record TTL is already in ms
// We delete expired records
// It is possible that they have different TTL, so we manage them individually
family.ips.splice(position, 1)
return this.pick(origin, hostnameRecords, affinity)
}
return ip
}
pickFamily (origin, ipFamily) {
const records = this.storage.get(origin.hostname)?.records
if (!records) {
return null
}
const family = records[ipFamily]
if (!family) {
return null
}
if (family.offset == null || family.offset === maxInt) {
family.offset = 0
} else {
family.offset++
}
const position = family.offset % family.ips.length
const ip = family.ips[position] ?? null
if (ip == null) {
return ip
}
if (Date.now() - ip.timestamp > ip.ttl) { // record TTL is already in ms
// We delete expired records
// It is possible that they have different TTL, so we manage them individually
family.ips.splice(position, 1)
return this.pickFamily(origin, ipFamily)
}
return ip
}
setRecords (origin, addresses) {
const timestamp = Date.now()
const records = { records: { 4: null, 6: null } }
let minTTL = this.#maxTTL
for (const record of addresses) {
record.timestamp = timestamp
if (typeof record.ttl === 'number') {
// The record TTL is expected to be in ms
record.ttl = Math.min(record.ttl, this.#maxTTL)
minTTL = Math.min(minTTL, record.ttl)
} else {
record.ttl = this.#maxTTL
}
const familyRecords = records.records[record.family] ?? { ips: [] }
familyRecords.ips.push(record)
records.records[record.family] = familyRecords
}
// We provide a default TTL if external storage will be used without TTL per record-level support
this.storage.set(origin.hostname, records, { ttl: minTTL })
}
deleteRecords (origin) {
this.storage.delete(origin.hostname)
}
getHandler (meta, opts) {
return new DNSDispatchHandler(this, meta, opts)
}
}
class DNSDispatchHandler extends DecoratorHandler {
#state = null
#opts = null
#dispatch = null
#origin = null
#controller = null
#newOrigin = null
#firstTry = true
constructor (state, { origin, handler, dispatch, newOrigin }, opts) {
super(handler)
this.#origin = origin
this.#newOrigin = newOrigin
this.#opts = { ...opts }
this.#state = state
this.#dispatch = dispatch
}
onResponseError (controller, err) {
switch (err.code) {
case 'ETIMEDOUT':
case 'ECONNREFUSED': {
if (this.#state.dualStack) {
if (!this.#firstTry) {
super.onResponseError(controller, err)
return
}
this.#firstTry = false
// Pick an ip address from the other family
const otherFamily = this.#newOrigin.hostname[0] === '[' ? 4 : 6
const ip = this.#state.pickFamily(this.#origin, otherFamily)
if (ip == null) {
super.onResponseError(controller, err)
return
}
let port
if (typeof ip.port === 'number') {
port = `:${ip.port}`
} else if (this.#origin.port !== '') {
port = `:${this.#origin.port}`
} else {
port = ''
}
const dispatchOpts = {
...this.#opts,
origin: `${this.#origin.protocol}//${
ip.family === 6 ? `[${ip.address}]` : ip.address
}${port}`,
[kRequestOrigin]: this.#opts[kRequestOrigin] === undefined
? this.#origin
: this.#opts[kRequestOrigin],
headers: withHostHeader(this.#origin.host, this.#opts.headers)
}
this.#dispatch(dispatchOpts, this)
return
}
// if dual-stack disabled, we error out
super.onResponseError(controller, err)
break
}
case 'ENOTFOUND':
this.#state.deleteRecords(this.#origin)
super.onResponseError(controller, err)
break
default:
super.onResponseError(controller, err)
break
}
}
}
module.exports = interceptorOpts => {
if (
interceptorOpts?.maxTTL != null &&
(typeof interceptorOpts?.maxTTL !== 'number' || interceptorOpts?.maxTTL < 0)
) {
throw new InvalidArgumentError('Invalid maxTTL. Must be a positive number')
}
if (
interceptorOpts?.maxItems != null &&
(typeof interceptorOpts?.maxItems !== 'number' ||
interceptorOpts?.maxItems < 1)
) {
throw new InvalidArgumentError(
'Invalid maxItems. Must be a positive number and greater than zero'
)
}
if (
interceptorOpts?.affinity != null &&
interceptorOpts?.affinity !== 4 &&
interceptorOpts?.affinity !== 6
) {
throw new InvalidArgumentError('Invalid affinity. Must be either 4 or 6')
}
if (
interceptorOpts?.dualStack != null &&
typeof interceptorOpts?.dualStack !== 'boolean'
) {
throw new InvalidArgumentError('Invalid dualStack. Must be a boolean')
}
if (
interceptorOpts?.lookup != null &&
typeof interceptorOpts?.lookup !== 'function'
) {
throw new InvalidArgumentError('Invalid lookup. Must be a function')
}
if (
interceptorOpts?.pick != null &&
typeof interceptorOpts?.pick !== 'function'
) {
throw new InvalidArgumentError('Invalid pick. Must be a function')
}
if (
interceptorOpts?.storage != null &&
(typeof interceptorOpts?.storage?.get !== 'function' ||
typeof interceptorOpts?.storage?.set !== 'function' ||
typeof interceptorOpts?.storage?.full !== 'function' ||
typeof interceptorOpts?.storage?.delete !== 'function'
)
) {
throw new InvalidArgumentError('Invalid storage. Must be a object with methods: { get, set, full, delete }')
}
const dualStack = interceptorOpts?.dualStack ?? true
let affinity
if (dualStack) {
affinity = interceptorOpts?.affinity ?? null
} else {
affinity = interceptorOpts?.affinity ?? 4
}
const opts = {
maxTTL: interceptorOpts?.maxTTL ?? 10e3, // Expressed in ms
lookup: interceptorOpts?.lookup ?? null,
pick: interceptorOpts?.pick ?? null,
dualStack,
affinity,
maxItems: interceptorOpts?.maxItems ?? Infinity,
storage: interceptorOpts?.storage
}
const instance = new DNSInstance(opts)
return dispatch => {
return function dnsInterceptor (origDispatchOpts, handler) {
if (origDispatchOpts.origin == null) {
return dispatch(origDispatchOpts, handler)
}
const origin =
origDispatchOpts.origin.constructor === URL
? origDispatchOpts.origin
: new URL(origDispatchOpts.origin)
if (isIP(origin.hostname) !== 0) {
return dispatch(origDispatchOpts, handler)
}
instance.runLookup(origin, origDispatchOpts, (err, newOrigin) => {
if (err) {
return handler.onResponseError(null, err)
}
const dispatchOpts = {
...origDispatchOpts,
servername: origin.hostname, // For SNI on TLS
origin: newOrigin.origin,
[kRequestOrigin]: origDispatchOpts[kRequestOrigin] === undefined
? origin
: origDispatchOpts[kRequestOrigin],
headers: withHostHeader(origin.host, origDispatchOpts.headers)
}
dispatch(
dispatchOpts,
instance.getHandler(
{ origin, dispatch, handler, newOrigin },
origDispatchOpts
)
)
})
return true
}
}
}
@@ -0,0 +1 @@
{"version":3,"names":["_temporalUndefined","require","_tdz","_temporalRef","val","name","undef","err"],"sources":["../../src/helpers/temporalRef.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nimport undef from \"./temporalUndefined.ts\";\nimport err from \"./tdz.ts\";\n\nexport default function _temporalRef<T>(val: T, name: string) {\n return val === undef ? err(name) : val;\n}\n"],"mappings":";;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEe,SAASE,YAAYA,CAAIC,GAAM,EAAEC,IAAY,EAAE;EAC5D,OAAOD,GAAG,KAAKE,0BAAK,GAAG,IAAAC,YAAG,EAACF,IAAI,CAAC,GAAGD,GAAG;AACxC","ignoreList":[]}
@@ -0,0 +1,43 @@
{{# def.definitions }}
{{# def.errors }}
{{# def.setupKeyword }}
{{# def.setupNextLevel }}
{{? {{# def.nonEmptySchema:$schema }} }}
{{
$it.schema = $schema;
$it.schemaPath = $schemaPath;
$it.errSchemaPath = $errSchemaPath;
}}
var {{=$errs}} = errors;
{{# def.setCompositeRule }}
{{
$it.createErrors = false;
var $allErrorsOption;
if ($it.opts.allErrors) {
$allErrorsOption = $it.opts.allErrors;
$it.opts.allErrors = false;
}
}}
{{= it.validate($it) }}
{{
$it.createErrors = true;
if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
}}
{{# def.resetCompositeRule }}
if ({{=$nextValid}}) {
{{# def.error:'not' }}
} else {
{{# def.resetErrors }}
{{? it.opts.allErrors }} } {{?}}
{{??}}
{{# def.addError:'not' }}
{{? $breakOnError}}
if (false) {
{{?}}
{{?}}
@@ -0,0 +1,558 @@
flf2a$ 5 4 15 0 11 0 8063 200
Author : Christian 'CeeJay' Jensen
Date : 2006/5/19
Version: 0.10 beta
-------------------------------------------------
"Cygnet" - A figfont by CeeJay
A cygnet is a baby swan.
The font is named so because it's based on
the Swan font, only smaller.
-------------------------------------------------
$$ #
$$ #
$$ #
$$ #
$$ ##
.#
|#
'#
o#
##
. .#
| |#
$ $#
$ $#
$ $##
#
_|_|_#
_|_|_#
| | #
##
.. #
.|-.#
`-|.#
`|-'#
##
#
o /#
,' #
/ o#
##
( ) #
.-' #
( `.)#
`--'`#
##
.#
|#
$#
$#
##
,#
:$#
:$#
`.#
##
`.#
$:#
$:#
.'#
##
#
| #
`-:-'#
$/ \$#
##
$ $#
$_|_$#
$ | $#
$ $#
##
#
#
o#
-'#
##
#
$___$#
$ $#
$ $#
$##
#
#
#
o#
##
,#
/ #
/ #
' #
##
#
.-.#
| |#
`-'#
##
#
. #
'| #
'-'#
##
#
,-.#
/ #
'--#
##
#
--.#
--|#
--'#
##
#
,.#
'-|#
'#
##
#
.--#
'-.#
`-'#
##
#
,-#
:-.#
`-'#
##
#
--,#
/ #
' #
##
#
,-.#
:-:#
`-'#
##
#
,-.#
`-;#
' #
##
#
#
o #
o #
##
#
o #
o #
-' #
##
#
.'#
`. #
`#
##
$ $#
$--$#
$--$#
$ $#
##
#
`. #
.`#
' #
##
#
.-.#
-'#
' #
##
#
.-.#
|a'#
`- #
##
#
. #
/_\ #
' '#
##
#
.-.#
|< #
'-'#
##
#
.-#
( #
`-#
##
#
.-.#
| :#
'-'#
##
#
.--#
|- #
'--#
##
#
.--#
|- #
' #
##
#
.-. #
|-. #
'-' #
##
#
. .#
|-|#
' '#
##
#
-.-#
| #
-'-#
##
#
.-.#
;#
`' #
##
#
. .#
|< #
' `#
##
#
. #
| #
'-'#
##
#
. .#
|\/|#
' '#
##
#
. .#
|\|#
' '#
##
#
.-.#
| |#
`-'#
##
#
.-.#
|-'#
' #
##
#
.-.#
|.|#
`-`#
##
#
.-.#
|-'#
'`-#
##
#
.-.#
`-.#
`-'#
##
#
---#
| #
' #
##
#
. .#
| |#
`-'#
##
#
. .#
| |#
` #
##
#
. .#
|/\|#
' '#
##
#
. .#
x #
' '#
##
#
. .#
Y #
' #
##
#
--.#
/ #
'--#
##
.--#
| #
| #
'--#
##
#
\ #
\ #
\#
##
--.#
|#
|#
--'#
##
. #
' `#
#
#
##
#
#
#
___#
##
o #
\#
#
#
##
#
#
.-. #
`-`-#
##
#
. #
|-.#
`-'#
##
#
#
.-#
`-#
##
#
. #
.-| #
`-'-#
##
#
#
.-,#
`'-#
##
#
.-#
-|-#
' #
##
#
#
.-.#
`-|#
`-'##
#
. #
|-. #
' '-#
##
#
.#
.#
'#
##
#
.#
.#
|#
`-'##
#
. #
|_,#
' `#
##
#
. #
| #
'-#
##
#
#
.-.-.#
' ' '#
##
#
#
.-.#
' '#
##
#
#
.-.#
`-'#
##
#
#
.-.#
|-'#
' ##
#
#
.-.#
`-|#
'##
#
#
.-.#
' #
##
#
#
.-#
-'#
##
#
. #
-|-#
'-#
##
#
#
. .#
'-'#
##
#
#
. .#
` #
##
#
#
. . .#
` ` #
##
#
#
._.#
' '#
##
#
#
. .#
'-|#
`-'##
#
#
-,#
'-#
##
#
.-#
< #
`-#
##
.#
|#
|#
|#
'##
#
-. #
>#
-' #
##
#
#
,-. #
`-'#
##
. . #
. #
/_\ #
' '#
##
o o#
.--.#
: :#
`--'#
##
o o#
. .#
: :#
`--'#
##
#
. . #
.-. #
`-`-#
##
#
. .#
.-.#
`-'#
##
#
. .#
. .#
'-'#
##
#
,-.#
|< #
|-'#
' ##
197 LATIN CAPITAL LETTER A WITH RING ABOVE
o #
. #
/_\ #
' '#
##
198 LATIN CAPITAL LETTER AE
#
,--#
/+--#
' '--#
##
216 LATIN CAPITAL LETTER O WITH STROKE
#
.-/#
|/|#
/-'#
##
229 LATIN SMALL LETTER A WITH RING ABOVE
#
o #
.-. #
`-`-#
##
230 LATIN SMALL LETTER AE
#
#
.-.-,#
`-`'-#
##
248 LATIN SMALL LETTER O WITH STROKE
#
#
.-;#
;-'#
##
@@ -0,0 +1,21 @@
/**
* @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 FileSearch = createLucideIcon("FileSearch", [
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
[
"path",
{ d: "M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3", key: "ms7g94" }
],
["path", { d: "m9 18-1.5-1.5", key: "1j6qii" }],
["circle", { cx: "5", cy: "14", r: "3", key: "ufru5t" }]
]);
export { FileSearch as default };
//# sourceMappingURL=file-search.js.map
@@ -0,0 +1,30 @@
'use strict';
var callBind = require('call-bind-apply-helpers');
var gOPD = require('gopd');
var hasProtoAccessor;
try {
// eslint-disable-next-line no-extra-parens, no-proto
hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
} catch (e) {
if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
throw e;
}
}
// eslint-disable-next-line no-extra-parens
var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
var $Object = Object;
var $getPrototypeOf = $Object.getPrototypeOf;
/** @type {import('./get')} */
module.exports = desc && typeof desc.get === 'function'
? callBind([desc.get])
: typeof $getPrototypeOf === 'function'
? /** @type {import('./get')} */ function getDunder(value) {
// eslint-disable-next-line eqeqeq
return $getPrototypeOf(value == null ? value : $Object(value));
}
: false;
@@ -0,0 +1,24 @@
(The MIT License)
Copyright (c) 2012-2014 Federico Romero
Copyright (c) 2012-2014 Isaac Z. Schlueter
Copyright (c) 2014-2015 Douglas Christopher Wilson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
{
"name": "is-promise",
"version": "4.0.0",
"description": "Test whether an object looks like a promises-a+ promise",
"main": "./index.js",
"scripts": {
"test": "node test"
},
"files": [
"index.js",
"index.mjs",
"index.d.ts"
],
"exports": {
".": [
{
"import": "./index.mjs",
"require": "./index.js",
"default": "./index.js"
},
"./index.js"
]
},
"repository": {
"type": "git",
"url": "https://github.com/then/is-promise.git"
},
"author": "ForbesLindesay",
"license": "MIT"
}
@@ -0,0 +1,842 @@
(function(global, factory) {
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DateManip = {}));
})(this, function(exports2) {
"use strict";
const MS_IN_SECOND = 1e3;
const MS_IN_MINUTE = 6e4;
const MS_IN_HOUR = 36e5;
const MS_IN_DAY = 864e5;
const rangeOfUnits = [
"time",
"year",
"month",
"date",
"day",
"hour",
"minute",
"second",
"millisecond",
"utcOffset"
];
function addMilliseconds(date, ms) {
date.setTime(+date + ms);
return date;
}
function addDays(date, days) {
return addMilliseconds(date, days * MS_IN_DAY);
}
function addHours(date, hours) {
return addMilliseconds(date, hours * MS_IN_HOUR);
}
function addMinutes(date, minutes) {
return addMilliseconds(date, minutes * MS_IN_MINUTE);
}
function isLeapYear$1(year) {
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
}
const arr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
const arr2 = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function daysOfYear(year) {
return isLeapYear$1(year) ? arr2 : arr;
}
function daysInMonth(date) {
return daysOfYear(date.getFullYear())[date.getMonth()];
}
function addMonths(date, months) {
const expectedMonth = date.getMonth() + months;
const tempMaxDay = daysInMonth(new Date(date.getFullYear(), expectedMonth, 1, 0, 0, 0, 0));
const currentDay = date.getDate();
date.setMonth(expectedMonth, currentDay > tempMaxDay ? tempMaxDay : currentDay);
return date;
}
function addSeconds(date, seconds) {
return addMilliseconds(date, seconds * MS_IN_SECOND);
}
function addYears(date, years) {
return addMonths(date, years * 12);
}
const units = rangeOfUnits.reduce((acc, unit) => {
acc[unit.toUpperCase()] = unit;
return acc;
}, {});
const { DATE: DATE$5, DAY: DAY$6, HOUR: HOUR$7, MILLISECOND: MILLISECOND$3, MINUTE: MINUTE$7, MONTH: MONTH$7, SECOND: SECOND$7, TIME: TIME$1, YEAR: YEAR$7 } = units;
const compatUnits = {};
function mapUnit(key, ...args) {
for (let i = 0; i < arguments.length; i++) {
compatUnits[arguments[i]] = key;
}
}
mapUnit(YEAR$7, "Y", "y", "years");
mapUnit(MONTH$7, "M", "months");
mapUnit(DATE$5, "D", "dates");
mapUnit(DAY$6, "d", "days");
mapUnit(HOUR$7, "h", "hours");
mapUnit(MINUTE$7, "m", "minutes");
mapUnit(SECOND$7, "s", "seconds");
mapUnit(MILLISECOND$3, "ms", "milliseconds");
mapUnit(TIME$1, "t");
function normalizeUnit(u) {
return compatUnits[u];
}
const { DAY: DAY$1$1, HOUR: HOUR$1$1, MINUTE: MINUTE$1$1, MONTH: MONTH$1$1, SECOND: SECOND$1$1, YEAR: YEAR$1$1 } = units;
function addNumber(date, num, unit) {
unit = normalizeUnit(unit);
switch (unit) {
case YEAR$1$1:
return addYears(date, num);
case MONTH$1$1:
return addMonths(date, num);
case DAY$1$1:
return addDays(date, num);
case HOUR$1$1:
return addHours(date, num);
case MINUTE$1$1:
return addMinutes(date, num);
case SECOND$1$1:
return addSeconds(date, num);
default:
return addMilliseconds(date, num);
}
}
const { DAY: DAY$5, HOUR: HOUR$6, MINUTE: MINUTE$6, MONTH: MONTH$6, SECOND: SECOND$6, YEAR: YEAR$6 } = units;
function addObject(date, obj, times) {
let time = 0;
let expectedMonth = 0;
let expectedDay = 0;
Object.entries(obj).forEach(([unit, num]) => {
unit = normalizeUnit(unit);
num *= times;
switch (unit) {
case YEAR$6:
expectedMonth += num * 12;
return;
case MONTH$6:
expectedMonth += date.getMonth() + num;
return;
case DAY$5:
expectedDay = num;
return;
case HOUR$6:
num *= MS_IN_HOUR;
break;
case MINUTE$6:
num *= MS_IN_MINUTE;
break;
case SECOND$6:
num *= MS_IN_SECOND;
break;
}
time += num;
});
if (expectedMonth) {
const tempMaxDay = daysInMonth(new Date(date.getFullYear(), expectedMonth, 1, 0, 0, 0, 0));
const currentDay = date.getDate();
date.setMonth(expectedMonth, (currentDay > tempMaxDay ? tempMaxDay : currentDay) + expectedDay);
}
return addMilliseconds(date, time);
}
function add(date, num, unit) {
return typeof num === "object" && num !== null ? addObject(date, num, 1) : addNumber(date, num, unit);
}
const { YEAR: YEAR$5, MONTH: MONTH$5, DATE: DATE$4, HOUR: HOUR$5, MINUTE: MINUTE$5, SECOND: SECOND$5, MILLISECOND: MILLISECOND$2, UTC_OFFSET: UTC_OFFSET$1 } = units;
function escapeRegex(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
const TOKEN_MAP = {
YYYY: { pattern: "(\\d{1,4})", key: YEAR$5 },
// 年份
// YY: { pattern: '(\\d{1,2})', key: YEAR }, // 年份
MM: { pattern: "(\\d{1,2})", key: MONTH$5 },
// 月份
DD: { pattern: "(\\d{1,2})", key: DATE$4 },
// 日期
HH: { pattern: "(\\d{1,2})", key: HOUR$5 },
// 小时
mm: { pattern: "(\\d{1,2})", key: MINUTE$5 },
// 分钟
ss: { pattern: "(\\d{1,2})", key: SECOND$5 },
// 秒
SSS: { pattern: "(\\d{1,3})", key: MILLISECOND$2 },
// 毫秒
Z: { pattern: "(Z|[+-]\\d{2}(?::?\\d{2})?)", key: UTC_OFFSET$1 }
// 时区
};
const TOKEN_KEYS = Object.keys(TOKEN_MAP).sort((a, b) => b.length - a.length);
const TOKEN_PATTERN = new RegExp(`(${TOKEN_KEYS.join("|")})`, "g");
function compile(formatString) {
const matchedTokens = [];
const pattern2 = escapeRegex(formatString).replace(TOKEN_PATTERN, (m) => {
matchedTokens.push(m);
return TOKEN_MAP[m].pattern;
});
return { pattern: pattern2, tokens: matchedTokens };
}
function dayOfYear(date, val) {
const monthDays = daysOfYear(date.getFullYear());
const currentMonth = date.getMonth();
let dayCount = date.getDate();
for (let i = 0; i < currentMonth; i++) {
dayCount += monthDays[i];
}
if (val === void 0) {
return dayCount;
}
date.setTime(+date + (val - dayCount) * MS_IN_DAY);
return date;
}
function absFloor(v) {
return v < 0 ? Math.ceil(v) || 0 : Math.floor(v);
}
const BASIC_ISO_REGEX = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
const EXTENDED_ISO_REGEX = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
const ISO_TIMES_REGEX = [
/(\d\d):(\d\d):(\d\d)\.(\d+)/,
// 'HH:mm:ss.SSSS'
/(\d\d):(\d\d):(\d\d),(\d+)/,
// 'HH:mm:ss,SSSS'
/(\d\d):(\d\d):(\d\d)/,
// 'HH:mm:ss'
/(\d\d):(\d\d)/,
// 'HH:mm'
/(\d\d)(\d\d)(\d\d)\.(\d+)/,
// 'HHmmss.SSSS'
/(\d\d)(\d\d)(\d\d),(\d+)/,
// 'HHmmss,SSSS'
/(\d\d)(\d\d)(\d\d)/,
// 'HHmmss'
/(\d\d)(\d\d)/,
// 'HHmm'
/(\d\d)/
// 'HH'
];
const TZ_REGEX = /(Z)|([+-]\d\d)(?::?(\d\d))?/;
const ISO_DATES_REGEX = [
/(\d{4})-(\d\d)-(\d\d)/,
// 'YYYY-MM-DD'
/(\d{4})-(\d\d)/,
// 'YYYY-MM'
/(\d{4})(\d\d)(\d\d)/,
// 'YYYYMMDD'
/(\d{4})(\d\d)/,
// 'YYYYMM'
/(\d{4})/
// 'YYYY'
];
function autoExtract(input) {
const dateRet = new Array(8);
let matches;
const match = EXTENDED_ISO_REGEX.exec(input) || BASIC_ISO_REGEX.exec(input);
if (match) {
const datesLen = ISO_DATES_REGEX.length;
for (let i = 0; i < datesLen; i++) {
if (matches = ISO_DATES_REGEX[i].exec(match[1])) {
for (let j = 0; j < 3; j++) {
const matched = matches[j + 1];
dateRet[j] = matched ? +matched : 1;
}
if (dateRet[1]) {
dateRet[1] -= 1;
}
break;
}
}
matches = null;
if (match[3]) {
for (let i = 0, timesLen = ISO_TIMES_REGEX.length; i < timesLen; i++) {
if (matches = ISO_TIMES_REGEX[i].exec(match[3])) {
if (matches[4]) {
matches[4] = matches[4].padEnd(3, "00");
}
for (let j = 1, len = matches.length; j < len; j++) {
dateRet[j + 2] = +matches[j];
}
break;
}
}
}
matches = null;
if (match[4]) {
matches = TZ_REGEX.exec(match[4]);
if (matches) {
dateRet[7] = matches[1] ? NaN : +matches[2] * 60 + (matches[3] ? +matches[3] : 0);
}
}
return dateRet;
}
return input;
}
function createDate(y, m, d, h, minute, s, ms) {
let date;
if (y < 100 && y >= 0) {
date = new Date(y + 400, m, d, h, minute, s, ms);
if (isFinite(date.getFullYear())) {
date.setFullYear(y);
}
} else {
date = new Date(y, m, d, h, minute, s, ms);
}
return date;
}
function createUTCDate(y, m, d, h, minute, s, ms) {
let date;
if (y < 100 && y >= 0) {
y += 400;
date = new Date(Date.UTC(y, m, d, h, minute, s, ms));
if (isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
} else {
date = new Date(Date.UTC(y, m, d, h, minute, s, ms));
}
return date;
}
function createFromArray(input) {
const utcOffset = input[7];
const currentDate = /* @__PURE__ */ new Date();
const isUTC = Number.isNaN(utcOffset);
const flag = isUTC ? "UTC" : "";
const currentStuffing = [
currentDate[`get${flag}FullYear`](),
currentDate[`get${flag}Month`](),
currentDate[`get${flag}Date`]()
];
let i = 0;
const array = new Array(7);
for (; i < 3 && input[i] == null; ++i) {
array[i] = currentStuffing[i];
}
for (; i < 7; i++) {
array[i] = input[i] == null ? 0 : input[i];
}
let day = array[2];
if (day === 0) {
day = 1;
}
let minute = array[4];
if (!isUTC && typeof utcOffset === "number") {
minute -= utcOffset + currentDate.getTimezoneOffset();
}
return (isUTC ? createUTCDate : createDate)(
array[0],
array[1],
day,
array[3],
minute,
array[5],
array[6]
);
}
function toInteger(val) {
return parseInt(val, 10);
}
function toMonth(val) {
return parseInt(val, 10) - 1;
}
function toMilliseconds(val) {
return parseInt(val.padEnd(3, "0"), 10);
}
function parseTimezone(val) {
if (val === "Z") {
return NaN;
}
const matches = TZ_REGEX.exec(val);
return +matches[2] * 60 + (matches[3] ? +matches[3] : 0);
}
function extractWithFormat(input, format2) {
const { pattern: pattern2, tokens: tokens2 } = compile(format2);
const match = new RegExp(pattern2).exec(input);
if (!match) {
return "";
}
const parts = [];
tokens2.forEach((token, i) => {
const value = match[i + 1];
switch (token) {
case "YYYY":
parts[0] = toInteger(value);
break;
// case 'YY':
// parts[0] = toInteger(value);
// break;
case "MM":
parts[1] = toMonth(value);
break;
case "DD":
parts[2] = toInteger(value);
break;
case "HH":
parts[3] = toInteger(value);
break;
case "mm":
parts[4] = toInteger(value);
break;
case "ss":
parts[5] = toInteger(value);
break;
case "SSS":
parts[6] = toMilliseconds(value);
break;
case "Z":
parts[7] = parseTimezone(value);
break;
}
});
return parts;
}
const { DATE: DATE$3, DAY: DAY$4, HOUR: HOUR$4, MILLISECOND: MILLISECOND$1, MINUTE: MINUTE$4, MONTH: MONTH$4, SECOND: SECOND$4, YEAR: YEAR$4, UTC_OFFSET } = units;
const ASP_NET_JSON_REGEX = /^\/?Date\((-?\d+)/i;
function ensureType(value, checked) {
return checked;
}
function parseObject(obj) {
const array = [];
Object.entries(obj).forEach(([unit, value]) => {
unit = normalizeUnit(unit);
switch (unit) {
case YEAR$4:
array[0] = value;
break;
case MONTH$4:
array[1] = value;
break;
case DATE$3:
case DAY$4:
array[2] = value;
break;
case HOUR$4:
array[3] = value;
break;
case MINUTE$4:
array[4] = value;
break;
case SECOND$4:
array[5] = value;
break;
case MILLISECOND$1:
array[6] = value;
break;
case UTC_OFFSET:
array[7] = value;
break;
}
});
if (array.length === 0) {
return /* @__PURE__ */ new Date();
}
return createFromArray(array);
}
function parseString(input, format2) {
const extracted = typeof format2 === "string" && format2 ? extractWithFormat(input, format2) : autoExtract(input);
if (Array.isArray(extracted)) {
return createFromArray(extracted);
}
const matched = ASP_NET_JSON_REGEX.exec(input);
return new Date(matched !== null ? +matched[1] : Date.parse(extracted));
}
function parse(input, format2) {
let ret;
const whatType = typeof input;
if (ensureType(input, whatType === "string")) {
ret = parseString(input, format2);
} else if (Array.isArray(input)) {
ret = createFromArray(input);
} else if (input instanceof Date) {
ret = new Date(input);
} else if (ensureType(input, whatType === "object" && input !== null)) {
if (input.isValid && input.isValid()) {
ret = /* @__PURE__ */ new Date(+input);
} else {
ret = parseObject(input);
}
} else if (ensureType(input, whatType === "number")) {
ret = new Date(input);
} else if (ensureType(input, whatType === "undefined")) {
ret = format2 ? /* @__PURE__ */ new Date(NaN) : /* @__PURE__ */ new Date();
} else {
ret = new Date(Date.parse(input));
}
return ret;
}
function diffInDays(date, input, asFloat) {
const parsed = parse(input);
const output = (+date - +parsed) / MS_IN_DAY;
return asFloat ? output : absFloor(output);
}
function diffInHours(date, input, asFloat) {
const parsed = parse(input);
const output = (+date - +parsed) / MS_IN_HOUR;
return asFloat ? output : absFloor(output);
}
function diffInMilliseconds(date, input, asFloat) {
const parsed = parse(input);
const output = +date - +parsed;
return asFloat ? output : absFloor(output);
}
function diffInMinutes(date, input, asFloat) {
const parsed = parse(input);
const output = (+date - +parsed) / MS_IN_MINUTE;
return asFloat ? output : absFloor(output);
}
function monthDiff(a, b) {
const aTime = +a;
const bTime = +b;
if (aTime < bTime) {
return -monthDiff(b, a);
}
const wholeMonthDiff = (b.getFullYear() - a.getFullYear()) * 12 + (b.getMonth() - a.getMonth());
const anchor = +addMonths(new Date(aTime), wholeMonthDiff);
let anchor2;
let adjust;
if (bTime < anchor) {
anchor2 = +addMonths(new Date(aTime), wholeMonthDiff - 1);
adjust = (bTime - anchor) / (anchor - anchor2);
} else {
anchor2 = +addMonths(new Date(aTime), wholeMonthDiff + 1);
adjust = (bTime - anchor) / (anchor2 - anchor);
}
return -(wholeMonthDiff + adjust) || 0;
}
function diffInMonths(date, input, asFloat) {
const parsed = parse(input);
const output = monthDiff(date, parsed);
return asFloat ? output : absFloor(output);
}
function diffInSeconds(date, input, asFloat) {
const parsed = parse(input);
const output = (+date - +parsed) / MS_IN_SECOND;
return asFloat ? output : absFloor(output);
}
function diffInYears(date, input, asFloat) {
const parsed = parse(input);
const output = monthDiff(date, parsed) / 12;
return asFloat ? output : absFloor(output);
}
const {
DAY: DAY$3,
HOUR: HOUR$3,
MINUTE: MINUTE$3,
MONTH: MONTH$3,
SECOND: SECOND$3,
YEAR: YEAR$3
} = units;
function diff(date, input, unit, asFloat) {
unit = normalizeUnit(unit);
switch (unit) {
case YEAR$3:
return diffInYears(date, input, asFloat);
case MONTH$3:
return diffInMonths(date, input, asFloat);
// case DATE:
case DAY$3:
return diffInDays(date, input, asFloat);
case HOUR$3:
return diffInHours(date, input, asFloat);
case MINUTE$3:
return diffInMinutes(date, input, asFloat);
case SECOND$3:
return diffInSeconds(date, input, asFloat);
default:
return diffInMilliseconds(date, input, asFloat);
}
}
function startOfDate(date, y, m, d) {
return +new Date(
y || date.getFullYear(),
m == null ? date.getMonth() : m,
d || date.getDate()
);
}
function startOfTime(date, ms) {
const input = +date;
return input - input % ms;
}
const { DATE: DATE$2, DAY: DAY$2, HOUR: HOUR$2, MINUTE: MINUTE$2, MONTH: MONTH$2, SECOND: SECOND$2, YEAR: YEAR$2 } = units;
function endOf(date, unit) {
unit = normalizeUnit(unit);
let time = 0;
switch (unit) {
case YEAR$2:
time = startOfDate(date, date.getFullYear() + 1, 0, 1) - 1;
break;
case MONTH$2:
time = startOfDate(date, void 0, date.getMonth() + 1, 1) - 1;
break;
case DATE$2:
case DAY$2:
time = startOfDate(date) + MS_IN_DAY - 1;
break;
case HOUR$2:
time = startOfTime(date, MS_IN_HOUR) + MS_IN_HOUR - 1;
break;
case MINUTE$2:
time = startOfTime(date, MS_IN_MINUTE) + MS_IN_MINUTE - 1;
break;
case SECOND$2:
time = startOfTime(date, MS_IN_SECOND) + MS_IN_SECOND - 1;
break;
}
time && date.setTime(time);
return date;
}
function padLeft(val, len) {
return String(val).padStart(len || 2, "0");
}
function dateTimeFormat(date, opts) {
return new Intl.DateTimeFormat("en-US", opts).format(date);
}
function getOrdinalSuffix(day) {
if (day > 3 && day < 21) {
return "th";
}
switch (day % 10) {
case 1:
return "st";
case 2:
return "nd";
case 3:
return "rd";
default:
return "th";
}
}
function timezone(date, together) {
let offset = date.getTimezoneOffset();
let prefix;
if (offset <= 0) {
prefix = "+";
offset = Math.abs(offset);
} else {
prefix = "-";
}
return `${prefix}${padLeft(Math.floor(offset / 60))}${together ? "" : ":"}${padLeft(Math.floor(offset % 60))}`;
}
const FORMAT_MAP = {
// 年份
yyyy: (d) => d.getFullYear(),
YYYY: (d) => d.getFullYear(),
YY: (d) => padLeft(d.getFullYear() % 100),
// 月份
MMMM: (d) => dateTimeFormat(d, { month: "long" }),
MMM: (d) => dateTimeFormat(d, { month: "short" }),
MM: (d) => padLeft(d.getMonth() + 1),
M: (d) => d.getMonth() + 1,
// 日期
DD: (d) => padLeft(d.getDate()),
D: (d) => d.getDate(),
Do: (d) => {
const day = d.getDate();
return String(day) + getOrdinalSuffix(day);
},
// 星期
dddd: (d) => dateTimeFormat(d, { weekday: "long" }),
ddd: (d) => dateTimeFormat(d, { weekday: "short" }),
dd: (d) => dateTimeFormat(d, { weekday: "narrow" }),
// 时间
HH: (d) => padLeft(d.getHours()),
H: (d) => d.getHours(),
hh: (d) => padLeft(d.getHours() % 12 || 12),
h: (d) => d.getHours() % 12 || 12,
mm: (d) => padLeft(d.getMinutes()),
m: (d) => d.getMinutes(),
ss: (d) => padLeft(d.getSeconds()),
s: (d) => d.getSeconds(),
SSS: (d) => padLeft(d.getMilliseconds(), 3),
// 其他
A: (d) => d.getHours() >= 12 ? "PM" : "AM",
a: (d) => d.getHours() >= 12 ? "pm" : "am",
Z: (d) => timezone(d),
ZZ: (d) => timezone(d, true)
};
const tokens = Object.keys(FORMAT_MAP).sort((a, b) => b.length - a.length).join("|");
const pattern = new RegExp(
`${tokens}|\\[([^\\]]*)]`,
"g"
);
function format(date, formatString) {
if (!formatString || formatString === "ISO") {
return date.toISOString();
}
return formatString.replace(pattern, (match, escapeContent) => {
if (escapeContent) {
return escapeContent;
}
const formatter = FORMAT_MAP[match];
return formatter ? formatter(date) : match;
});
}
const { DATE: DATE$1, DAY: DAY$1, HOUR: HOUR$1, MILLISECOND, MINUTE: MINUTE$1, MONTH: MONTH$1, SECOND: SECOND$1, TIME, YEAR: YEAR$1 } = units;
const mapping = {
[YEAR$1]: "FullYear",
[MONTH$1]: "Month",
[DATE$1]: "Date",
[DAY$1]: "Day",
[HOUR$1]: "Hours",
[MINUTE$1]: "Minutes",
[SECOND$1]: "Seconds",
[MILLISECOND]: "Milliseconds",
[TIME]: "Time"
};
const setting = {};
const getting = {};
Object.entries(mapping).forEach(([key, method]) => {
if (key === DAY$1) {
setting[key] = function(date, val) {
const day = date.getDay();
if (val !== day) {
date.setTime(+date + (val - day) * MS_IN_DAY);
}
};
} else {
setting[key] = function(date, val) {
date[`set${method}`](val);
};
}
getting[key] = function(date) {
return date[`get${method}`]();
};
});
function get(date, unit) {
const fn = getting[normalizeUnit(unit)];
return fn ? fn(date) : 0;
}
function set(date, unit, val) {
const fn = setting[normalizeUnit(unit)];
fn && fn(date, val);
return date;
}
const { DATE, DAY, HOUR, MINUTE, MONTH, SECOND, YEAR } = units;
function startOf(date, unit) {
unit = normalizeUnit(unit);
let time = 0;
switch (unit) {
case YEAR:
time = startOfDate(date, void 0, 0, 1);
break;
case MONTH:
time = startOfDate(date, void 0, void 0, 1);
break;
case DATE:
case DAY:
time = startOfDate(date);
break;
case HOUR:
time = startOfTime(date, MS_IN_HOUR);
break;
case MINUTE:
time = startOfTime(date, MS_IN_MINUTE);
break;
case SECOND:
time = startOfTime(date, MS_IN_SECOND);
break;
}
time && date.setTime(time);
return date;
}
function isAfter(date, input, unit) {
unit = normalizeUnit(unit);
const inputMs = +parse(input);
if (!unit) {
return +date > inputMs;
}
return +startOf(new Date(date), unit) > inputMs;
}
function isBefore(date, input, unit) {
unit = normalizeUnit(unit);
const inputMs = +parse(input);
if (!unit) {
return +date < inputMs;
}
return +endOf(new Date(date), unit) < inputMs;
}
function isBetween(date, from, to, unit, inclusivity) {
inclusivity = inclusivity || "()";
return (inclusivity.startsWith("(") ? isAfter(date, from, unit) : !isBefore(date, from, unit)) && (inclusivity.charAt(1) === ")" ? isBefore(date, to, unit) : !isAfter(date, to, unit));
}
function isLeapYear(date) {
return isLeapYear$1(date.getFullYear());
}
function isSame(date, input, unit) {
unit = normalizeUnit(unit);
const inputMs = +parse(input);
if (!unit) {
return +date === inputMs;
}
return +startOf(new Date(date), unit) <= inputMs && inputMs <= +endOf(new Date(date), unit);
}
function isSameOrAfter(date, input, unit) {
return !isBefore(date, input, unit);
}
function isSameOrBefore(date, input, unit) {
return !isAfter(date, input, unit);
}
function isValid(date) {
return date.toString() !== "Invalid Date";
}
function subDays(date, days) {
return addDays(date, -days);
}
function subHours(date, hours) {
return addHours(date, -hours);
}
function subMilliseconds(date, ms) {
return addMilliseconds(date, -ms);
}
function subMinutes(date, minutes) {
return addMinutes(date, -minutes);
}
function subMonths(date, months) {
return addMonths(date, -months);
}
function subSeconds(date, seconds) {
return addSeconds(date, -seconds);
}
function subYears(date, years) {
return addMonths(date, -years * 12);
}
function subtract(date, num, unit) {
return typeof num === "object" && num !== null ? addObject(date, num, -1) : addNumber(date, -num, unit);
}
exports2.add = add;
exports2.addDays = addDays;
exports2.addHours = addHours;
exports2.addMilliseconds = addMilliseconds;
exports2.addMinutes = addMinutes;
exports2.addMonths = addMonths;
exports2.addSeconds = addSeconds;
exports2.addYears = addYears;
exports2.compile = compile;
exports2.dayOfYear = dayOfYear;
exports2.daysInMonth = daysInMonth;
exports2.diff = diff;
exports2.diffInDays = diffInDays;
exports2.diffInHours = diffInHours;
exports2.diffInMilliseconds = diffInMilliseconds;
exports2.diffInMinutes = diffInMinutes;
exports2.diffInMonths = diffInMonths;
exports2.diffInSeconds = diffInSeconds;
exports2.diffInYears = diffInYears;
exports2.endOf = endOf;
exports2.format = format;
exports2.get = get;
exports2.isAfter = isAfter;
exports2.isBefore = isBefore;
exports2.isBetween = isBetween;
exports2.isLeapYear = isLeapYear;
exports2.isSame = isSame;
exports2.isSameOrAfter = isSameOrAfter;
exports2.isSameOrBefore = isSameOrBefore;
exports2.isValid = isValid;
exports2.parse = parse;
exports2.set = set;
exports2.startOf = startOf;
exports2.subDays = subDays;
exports2.subHours = subHours;
exports2.subMilliseconds = subMilliseconds;
exports2.subMinutes = subMinutes;
exports2.subMonths = subMonths;
exports2.subSeconds = subSeconds;
exports2.subYears = subYears;
exports2.subtract = subtract;
exports2.units = units;
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
});
@@ -0,0 +1,36 @@
import type NameManager from "../NameManager";
import type TokenProcessor from "../TokenProcessor";
import Transformer from "./Transformer";
/**
* Transformer supporting the optional chaining and nullish coalescing operators.
*
* Tech plan here:
* https://github.com/alangpierce/sucrase/wiki/Sucrase-Optional-Chaining-and-Nullish-Coalescing-Technical-Plan
*
* The prefix and suffix code snippets are handled by TokenProcessor, and this transformer handles
* the operators themselves.
*/
export default class OptionalChainingNullishTransformer extends Transformer {
readonly tokens: TokenProcessor;
readonly nameManager: NameManager;
constructor(tokens: TokenProcessor, nameManager: NameManager);
process(): boolean;
/**
* Determine if the current token is the last of its chain, so that we know whether it's eligible
* to have a delete op inserted.
*
* We can do this by walking forward until we determine one way or another. Each
* isOptionalChainStart token must be paired with exactly one isOptionalChainEnd token after it in
* a nesting way, so we can track depth and walk to the end of the chain (the point where the
* depth goes negative) and see if any other subscript token is after us in the chain.
*/
isLastSubscriptInChain(): boolean;
/**
* Determine if we are the open-paren in an expression like super.a()?.b.
*
* We can do this by walking backward to find the previous subscript. If that subscript was
* preceded by a super, then we must be the subscript after it, so if this is a call expression,
* we'll need to attach the right context.
*/
justSkippedSuper(): boolean;
}
@@ -0,0 +1 @@
{"version":3,"file":"gamepad-2.js","sources":["../../../src/icons/gamepad-2.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Gamepad2\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8bGluZSB4MT0iNiIgeDI9IjEwIiB5MT0iMTEiIHkyPSIxMSIgLz4KICA8bGluZSB4MT0iOCIgeDI9IjgiIHkxPSI5IiB5Mj0iMTMiIC8+CiAgPGxpbmUgeDE9IjE1IiB4Mj0iMTUuMDEiIHkxPSIxMiIgeTI9IjEyIiAvPgogIDxsaW5lIHgxPSIxOCIgeDI9IjE4LjAxIiB5MT0iMTAiIHkyPSIxMCIgLz4KICA8cGF0aCBkPSJNMTcuMzIgNUg2LjY4YTQgNCAwIDAgMC0zLjk3OCAzLjU5Yy0uMDA2LjA1Mi0uMDEuMTAxLS4wMTcuMTUyQzIuNjA0IDkuNDE2IDIgMTQuNDU2IDIgMTZhMyAzIDAgMCAwIDMgM2MxIDAgMS41LS41IDItMWwxLjQxNC0xLjQxNEEyIDIgMCAwIDEgOS44MjggMTZoNC4zNDRhMiAyIDAgMCAxIDEuNDE0LjU4NkwxNyAxOGMuNS41IDEgMSAyIDFhMyAzIDAgMCAwIDMtM2MwLTEuNTQ1LS42MDQtNi41ODQtLjY4NS03LjI1OC0uMDA3LS4wNS0uMDExLS4xLS4wMTctLjE1MUE0IDQgMCAwIDAgMTcuMzIgNXoiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/gamepad-2\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 Gamepad2 = createLucideIcon('Gamepad2', [\n ['line', { x1: '6', x2: '10', y1: '11', y2: '11', key: '1gktln' }],\n ['line', { x1: '8', x2: '8', y1: '9', y2: '13', key: 'qnk9ow' }],\n ['line', { x1: '15', x2: '15.01', y1: '12', y2: '12', key: 'krot7o' }],\n ['line', { x1: '18', x2: '18.01', y1: '10', y2: '10', key: '1lcuu1' }],\n [\n 'path',\n {\n d: 'M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z',\n key: 'mfqc10',\n },\n ],\n]);\n\nexport default Gamepad2;\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,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAK,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,CACjE,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAC/D,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACrE,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACrE,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CALine truncated
@@ -0,0 +1 @@
{"version":3,"file":"streamableHttp.js","sourceRoot":"","sources":["../../../src/server/streamableHttp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAIvD,OAAO,EACH,wCAAwC,EAK3C,MAAM,gCAAgC,CAAC;AAYxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,OAAO,6BAA6B;IAMtC,YAAY,UAAgD,EAAE;QAH9D,6EAA6E;QACrE,oBAAe,GAAoE,IAAI,OAAO,EAAE,CAAC;QAGrG,IAAI,CAAC,qBAAqB,GAAG,IAAI,wCAAwC,CAAC,OAAO,CAAC,CAAC;QAEnF,kEAAkE;QAClE,8FAA8F;QAC9F,2FAA2F;QAC3F,kFAAkF;QAClF,IAAI,CAAC,gBAAgB,GAAG,kBAAkB,CACtC,KAAK,EAAE,UAAmB,EAAE,EAAE;YAC1B,sDAAsD;YACtD,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,UAAU,EAAE;gBACxD,QAAQ,EAAE,OAAO,EAAE,QAAQ;gBAC3B,UAAU,EAAE,OAAO,EAAE,UAAU;aAClC,CAAC,CAAC;QACP,CAAC,EACD,EAAE,qBAAqB,EAAE,KAAK,EAAE,CACnC,CAAC;IACN,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,IAAI,OAAO,CAAC,OAAiC;QACzC,IAAI,CAAC,qBAAqB,CAAC,OAAO,GAAG,OAAO,CAAC;IACjD,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,IAAI,OAAO,CAAC,OAA6C;QACrD,IAAI,CAAC,qBAAqB,CAAC,OAAO,GAAG,OAAO,CAAC;IACjD,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,IAAI,SAAS,CAAC,OAAkF;QAC5F,IAAI,CAAC,qBAAqB,CAAC,SAAS,GAAG,OAAO,CAAC;IACnD,CAAC;IAED,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC;IAChD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACP,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACP,OAAO,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB,EAAE,OAA0C;QAC1E,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,aAAa,CAAC,GAA0C,EAAE,GAAmB,EAAE,UAAoB;QACrG,qEAAqE;QACrE,mEAAmE;QACnE,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC;QAE1B,oDAAoD;QACpD,2FAA2F;QAC3F,kFAAkF;QAClF,MAAM,OAAO,GAAG,kBAAkB,CAC9B,KAAK,EAAE,UAAmB,EAAE,EAAE;YAC1B,OAAO,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,UAAU,EAAE;gBACxD,QAAQ;gBACR,UAAU;aACb,CAAC,CAAC;QACP,CAAC,EACD,EAAE,qBAAqB,EAAE,KAAK,EAAE,CACnC,CAAC;QAEF,6FAA6F;QAC7F,yCAAyC;QACzC,MAAM,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,SAAoB;QAC/B,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,wBAAwB;QACpB,IAAI,CAAC,qBAAqB,CAAC,wBAAwB,EAAE,CAAC;IAC1D,CAAC;CACJ"}
@@ -0,0 +1 @@
{"version":3,"file":"message-circle-more.js","sources":["../../../src/icons/message-circle-more.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name MessageCircleMore\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNy45IDIwQTkgOSAwIDEgMCA0IDE2LjFMMiAyMloiIC8+CiAgPHBhdGggZD0iTTggMTJoLjAxIiAvPgogIDxwYXRoIGQ9Ik0xMiAxMmguMDEiIC8+CiAgPHBhdGggZD0iTTE2IDEyaC4wMSIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/message-circle-more\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 MessageCircleMore = createLucideIcon('MessageCircleMore', [\n ['path', { d: 'M7.9 20A9 9 0 1 0 4 16.1L2 22Z', key: 'vv11sd' }],\n ['path', { d: 'M8 12h.01', key: 'czm47f' }],\n ['path', { d: 'M12 12h.01', key: '1mp3jc' }],\n ['path', { d: 'M16 12h.01', key: '1l6xoz' }],\n]);\n\nexport default MessageCircleMore;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoB,iBAAiB,mBAAqB,CAAA,CAAA,CAAA;AAAA,CAAA,CAC9D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAkC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC/D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC3C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_b","260":"_V"},B:{"2":"_SQ _CD","66":"BB _IH _h UB","132":"_H _vH AB","260":"_I"},C:{"2":"_g _5 _tF _L","260":"_VT _UF _WB _RG"},D:{"2":"GB _hI _EF","16":"_Y","66":"BB _1N _SM","132":"_H _UF _eC _VC AB"},E:{"2":"_JL","16":"_e","132":"_FC _UD _lL _FD"},F:{"1":"_FL","2":"_qC","16":"_hG","66":"_VN _h","132":"_MC _MR"},G:{"2":"_YG","16":"_sC","132":"_0O _UI _FD"},H:{"2":"1D"},I:{"2":"I","16":"_m","132":"_CO"},J:{"132":"_B"},K:{"1":"_DL","2":"A","16":"_hG","132":"H"},L:{"2":"I"},M:{"2":"YC"},N:{"260":"_A"},O:{"132":"bC"},P:{"132":"_F"},Q:{"132":"JE"},R:{"132":"KE"},S:{"260":"_C"}},B:7,C:"Mutation events",D:true};
@@ -0,0 +1,6 @@
import { Refs } from "../Refs.js";
import { JsonSchema7AnyType } from "./any.js";
export type JsonSchema7UndefinedType = {
not: JsonSchema7AnyType;
};
export declare function parseUndefinedDef(refs: Refs): JsonSchema7UndefinedType;
@@ -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 Rewind = createLucideIcon("Rewind", [
["polygon", { points: "11 19 2 12 11 5 11 19", key: "14yba5" }],
["polygon", { points: "22 19 13 12 22 5 22 19", key: "1pi1cj" }]
]);
export { Rewind as default };
//# sourceMappingURL=rewind.js.map
@@ -0,0 +1,6 @@
import type { TSESLint } from '@typescript-eslint/utils';
export type MessageId = 'await' | 'awaitUsingOfNonAsyncDisposable' | 'convertToOrdinaryFor' | 'forAwaitOfNonAsyncIterable' | 'invalidPromiseAggregatorInput' | 'removeAwait';
declare const _default: TSESLint.RuleModule<MessageId, [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1,13 @@
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
"use strict";
// Note: This file is overridden in the 'package.json#browser' field to
// substitute lib/url-browser.js instead.
// Use the URL global for Node 10, and the 'url' module for Node 8.
module.exports = typeof URL === "function" ? URL : require("url").URL;
@@ -0,0 +1,22 @@
/**
* @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 CircleDashed = createLucideIcon("CircleDashed", [
["path", { d: "M10.1 2.182a10 10 0 0 1 3.8 0", key: "5ilxe3" }],
["path", { d: "M13.9 21.818a10 10 0 0 1-3.8 0", key: "11zvb9" }],
["path", { d: "M17.609 3.721a10 10 0 0 1 2.69 2.7", key: "1iw5b2" }],
["path", { d: "M2.182 13.9a10 10 0 0 1 0-3.8", key: "c0bmvh" }],
["path", { d: "M20.279 17.609a10 10 0 0 1-2.7 2.69", key: "1ruxm7" }],
["path", { d: "M21.818 10.1a10 10 0 0 1 0 3.8", key: "qkgqxc" }],
["path", { d: "M3.721 6.391a10 10 0 0 1 2.7-2.69", key: "1mcia2" }],
["path", { d: "M6.391 20.279a10 10 0 0 1-2.69-2.7", key: "1fvljs" }]
]);
export { CircleDashed as default };
//# sourceMappingURL=circle-dashed.js.map
@@ -0,0 +1 @@
{"version":3,"file":"order.mjs","sources":["../../../src/frameloop/order.ts"],"sourcesContent":["import { StepId } from \"./types\"\n\nexport const stepsOrder: StepId[] = [\n \"setup\", // Compute\n \"read\", // Read\n \"resolveKeyframes\", // Write/Read/Write/Read\n \"preUpdate\", // Compute\n \"update\", // Compute\n \"preRender\", // Compute\n \"render\", // Write\n \"postRender\", // Compute\n] as const\n\nexport type StepNames = (typeof stepsOrder)[number]\n"],"names":[],"mappings":"AAEO,MAAM,UAAU,GAAa;AAChC,IAAA,OAAO;AACP,IAAA,MAAM;AACN,IAAA,kBAAkB;AAClB,IAAA,WAAW;AACX,IAAA,QAAQ;AACR,IAAA,WAAW;AACX,IAAA,QAAQ;AACR,IAAA,YAAY;;;;;"}
@@ -0,0 +1,32 @@
import { MotionGlobalConfig } from 'motion-utils';
import { frameData } from './frame.mjs';
let now;
function clearTime() {
now = undefined;
}
/**
* An eventloop-synchronous alternative to performance.now().
*
* Ensures that time measurements remain consistent within a synchronous context.
* Usually calling performance.now() twice within the same synchronous context
* will return different values which isn't useful for animations when we're usually
* trying to sync animations to the same frame.
*/
const time = {
now: () => {
if (now === undefined) {
time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming
? frameData.timestamp
: performance.now());
}
return now;
},
set: (newTime) => {
now = newTime;
queueMicrotask(clearTime);
},
};
export { time };
//# sourceMappingURL=sync-time.mjs.map
@@ -0,0 +1,2 @@
import { createSidecarMedium } from 'use-sidecar';
export const effectCar = createSidecarMedium();
@@ -0,0 +1,31 @@
import { analyseComplexValue } from '../../../value/types/complex/index.mjs';
import { getAnimatableNone } from '../../../value/types/utils/animatable-none.mjs';
/**
* If we encounter keyframes like "none" or "0" and we also have keyframes like
* "#fff" or "200px 200px" we want to find a keyframe to serve as a template for
* the "none" keyframes. In this case "#fff" or "200px 200px" - then these get turned into
* zero equivalents, i.e. "#fff0" or "0px 0px".
*/
const invalidTemplates = new Set(["auto", "none", "0"]);
function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name) {
let i = 0;
let animatableTemplate = undefined;
while (i < unresolvedKeyframes.length && !animatableTemplate) {
const keyframe = unresolvedKeyframes[i];
if (typeof keyframe === "string" &&
!invalidTemplates.has(keyframe) &&
analyseComplexValue(keyframe).values.length) {
animatableTemplate = unresolvedKeyframes[i];
}
i++;
}
if (animatableTemplate && name) {
for (const noneIndex of noneKeyframeIndexes) {
unresolvedKeyframes[noneIndex] = getAnimatableNone(name, animatableTemplate);
}
}
}
export { makeNoneKeyframesAnimatable };
//# sourceMappingURL=make-none-animatable.mjs.map
@@ -0,0 +1,181 @@
'use strict'
const { InvalidArgumentError, MaxOriginsReachedError } = require('../core/errors')
const { kBusy, kClients, kConnected, kRunning, kPending, kClose, kDestroy, kDispatch, kUrl } = require('../core/symbols')
const DispatcherBase = require('./dispatcher-base')
const Pool = require('./pool')
const Client = require('./client')
const util = require('../core/util')
const kOnConnect = Symbol('onConnect')
const kOnDisconnect = Symbol('onDisconnect')
const kOnConnectionError = Symbol('onConnectionError')
const kOnDrain = Symbol('onDrain')
const kFactory = Symbol('factory')
const kOptions = Symbol('options')
const kOrigins = Symbol('origins')
function defaultFactory (origin, opts) {
return opts && opts.connections === 1
? new Client(origin, opts)
: new Pool(origin, opts)
}
class Agent extends DispatcherBase {
constructor ({ factory = defaultFactory, maxOrigins = Infinity, connect, tls, ...options } = {}) {
if (typeof factory !== 'function') {
throw new InvalidArgumentError('factory must be a function.')
}
if (connect != null && typeof connect !== 'function' && typeof connect !== 'object') {
throw new InvalidArgumentError('connect must be a function or an object')
}
if (typeof maxOrigins !== 'number' || Number.isNaN(maxOrigins) || maxOrigins <= 0) {
throw new InvalidArgumentError('maxOrigins must be a number greater than 0')
}
super(options)
if (connect && typeof connect !== 'function') {
connect = { ...connect }
}
if (tls && typeof tls !== 'function') {
tls = { ...tls }
}
this[kOptions] = { ...util.deepClone(options), maxOrigins, connect, tls }
this[kFactory] = factory
this[kClients] = new Map()
this[kOrigins] = new Set()
this[kOnDrain] = (origin, targets) => {
this.emit('drain', origin, [this, ...targets])
}
this[kOnConnect] = (origin, targets) => {
this.emit('connect', origin, [this, ...targets])
}
this[kOnDisconnect] = (origin, targets, err) => {
this.emit('disconnect', origin, [this, ...targets], err)
}
this[kOnConnectionError] = (origin, targets, err) => {
this.emit('connectionError', origin, [this, ...targets], err)
}
}
get [kRunning] () {
let ret = 0
for (const dispatcher of this[kClients].values()) {
ret += dispatcher[kRunning]
}
return ret
}
[kDispatch] (opts, handler) {
let origin
if (opts.origin && (typeof opts.origin === 'string' || opts.origin instanceof URL)) {
origin = String(opts.origin)
} else {
throw new InvalidArgumentError('opts.origin must be a non-empty string or URL.')
}
const allowH2 = opts.allowH2 ?? this[kOptions].allowH2
const key = allowH2 === false ? `${origin}#http1-only` : origin
if (this[kOrigins].size >= this[kOptions].maxOrigins && !this[kOrigins].has(origin)) {
throw new MaxOriginsReachedError()
}
let dispatcher = this[kClients].get(key)
if (!dispatcher) {
dispatcher = this[kFactory](opts.origin, allowH2 === false
? { ...this[kOptions], allowH2: false }
: this[kOptions])
const closeClientIfUnused = () => {
if (this[kClients].get(key) !== dispatcher) {
return
}
// A GOAWAY detaches the HTTP/2 session before requeued requests are
// dispatched on a replacement connection. At that point the pool has
// no connected clients and is not busy, but it still has pending work.
// Closing it here lets the replacement Client finish those requests
// and then destroys that new connection with ClientDestroyedError.
if (dispatcher[kConnected] > 0 || dispatcher[kBusy] || dispatcher[kPending] > 0) {
return
}
this[kClients].delete(key)
if (!dispatcher.destroyed) {
dispatcher.close()
}
let hasOrigin = false
for (const k of this[kClients].keys()) {
if (k === origin || k === `${origin}#http1-only`) {
hasOrigin = true
break
}
}
if (!hasOrigin) {
this[kOrigins].delete(origin)
}
}
dispatcher
.on('drain', this[kOnDrain])
.on('connect', this[kOnConnect])
.on('disconnect', (origin, targets, err) => {
closeClientIfUnused()
this[kOnDisconnect](origin, targets, err)
})
.on('connectionError', (origin, targets, err) => {
closeClientIfUnused()
this[kOnConnectionError](origin, targets, err)
})
this[kClients].set(key, dispatcher)
this[kOrigins].add(origin)
}
return dispatcher.dispatch(opts, handler)
}
[kClose] () {
const closePromises = []
for (const dispatcher of this[kClients].values()) {
closePromises.push(dispatcher.close())
}
this[kClients].clear()
return Promise.all(closePromises)
}
[kDestroy] (err) {
const destroyPromises = []
for (const dispatcher of this[kClients].values()) {
destroyPromises.push(dispatcher.destroy(err))
}
this[kClients].clear()
return Promise.all(destroyPromises)
}
get stats () {
const allClientStats = {}
for (const dispatcher of this[kClients].values()) {
if (dispatcher.stats) {
allClientStats[dispatcher[kUrl].origin] = dispatcher.stats
}
}
return allClientStats
}
}
module.exports = Agent
@@ -0,0 +1,375 @@
import { Server, ServerOptions } from './index.js';
import { AnySchema, AnyObjectSchema, ZodRawShapeCompat, SchemaOutput, ShapeOutput } from './zod-compat.js';
import { Implementation, CallToolResult, Resource, ListResourcesResult, GetPromptResult, ReadResourceResult, ServerRequest, ServerNotification, ToolAnnotations, LoggingMessageNotification, Result, ToolExecution } from '../types.js';
import { UriTemplate, Variables } from '../shared/uriTemplate.js';
import { RequestHandlerExtra } from '../shared/protocol.js';
import { Transport } from '../shared/transport.js';
import { ExperimentalMcpServerTasks } from '../experimental/tasks/mcp-server.js';
import type { ToolTaskHandler } from '../experimental/tasks/interfaces.js';
/**
* Options for `McpServer`: everything `ServerOptions` accepts, plus `maxToolInputElements`.
*/
export type McpServerOptions = ServerOptions & {
/**
* Largest combined number of array elements and object members a single `tools/call` `arguments` payload may contain.
* A number of at least 1; unset or `Infinity` means no limit.
*/
maxToolInputElements?: number;
};
/**
* High-level MCP server that provides a simpler API for working with resources, tools, and prompts.
* For advanced usage (like sending notifications or setting custom request handlers), use the underlying
* Server instance available via the `server` property.
*/
export declare class McpServer {
/**
* The underlying Server instance, useful for advanced operations like sending notifications.
*/
readonly server: Server;
private readonly _maxToolInputElements;
private _registeredResources;
private _registeredResourceTemplates;
private _registeredTools;
private _registeredPrompts;
private _experimental?;
constructor(serverInfo: Implementation, options?: McpServerOptions);
/**
* Access experimental features.
*
* WARNING: These APIs are experimental and may change without notice.
*
* @experimental
*/
get experimental(): {
tasks: ExperimentalMcpServerTasks;
};
/**
* Attaches to the given transport, starts it, and starts listening for messages.
*
* The `server` object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
*/
connect(transport: Transport): Promise<void>;
/**
* Closes the connection.
*/
close(): Promise<void>;
private _toolHandlersInitialized;
private setToolRequestHandlers;
/**
* Creates a tool error result.
*
* @param errorMessage - The error message.
* @returns The tool error result.
*/
private createToolError;
/**
* Validates tool input arguments against the tool's input schema.
*/
private validateToolInput;
/**
* Validates tool output against the tool's output schema.
*/
private validateToolOutput;
/**
* Executes a tool handler (either regular or task-based).
*/
private executeToolHandler;
/**
* Handles automatic task polling for tools with taskSupport 'optional'.
*/
private handleAutomaticTaskPolling;
private _completionHandlerInitialized;
private setCompletionRequestHandler;
private handlePromptCompletion;
private handleResourceCompletion;
private _resourceHandlersInitialized;
private setResourceRequestHandlers;
private _promptHandlersInitialized;
private setPromptRequestHandlers;
/**
* Registers a resource `name` at a fixed URI, which will use the given callback to respond to read requests.
* @deprecated Use `registerResource` instead.
*/
resource(name: string, uri: string, readCallback: ReadResourceCallback): RegisteredResource;
/**
* Registers a resource `name` at a fixed URI with metadata, which will use the given callback to respond to read requests.
* @deprecated Use `registerResource` instead.
*/
resource(name: string, uri: string, metadata: ResourceMetadata, readCallback: ReadResourceCallback): RegisteredResource;
/**
* Registers a resource `name` with a template pattern, which will use the given callback to respond to read requests.
* @deprecated Use `registerResource` instead.
*/
resource(name: string, template: ResourceTemplate, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate;
/**
* Registers a resource `name` with a template pattern and metadata, which will use the given callback to respond to read requests.
* @deprecated Use `registerResource` instead.
*/
resource(name: string, template: ResourceTemplate, metadata: ResourceMetadata, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate;
/**
* Registers a resource with a config object and callback.
* For static resources, use a URI string. For dynamic resources, use a ResourceTemplate.
*/
registerResource(name: string, uriOrTemplate: string, config: ResourceMetadata, readCallback: ReadResourceCallback): RegisteredResource;
registerResource(name: string, uriOrTemplate: ResourceTemplate, config: ResourceMetadata, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate;
private _createRegisteredResource;
private _createRegisteredResourceTemplate;
private _createRegisteredPrompt;
private _createRegisteredTool;
/**
* Registers a zero-argument tool `name`, which will run the given function when the client calls it.
* @deprecated Use `registerTool` instead.
*/
tool(name: string, cb: ToolCallback): RegisteredTool;
/**
* Registers a zero-argument tool `name` (with a description) which will run the given function when the client calls it.
* @deprecated Use `registerTool` instead.
*/
tool(name: string, description: string, cb: ToolCallback): RegisteredTool;
/**
* Registers a tool taking either a parameter schema for validation or annotations for additional metadata.
* This unified overload handles both `tool(name, paramsSchema, cb)` and `tool(name, annotations, cb)` cases.
*
* Note: We use a union type for the second parameter because TypeScript cannot reliably disambiguate
* between ToolAnnotations and ZodRawShapeCompat during overload resolution, as both are plain object types.
* @deprecated Use `registerTool` instead.
*/
tool<Args extends ZodRawShapeCompat>(name: string, paramsSchemaOrAnnotations: Args | ToolAnnotations, cb: ToolCallback<Args>): RegisteredTool;
/**
* Registers a tool `name` (with a description) taking either parameter schema or annotations.
* This unified overload handles both `tool(name, description, paramsSchema, cb)` and
* `tool(name, description, annotations, cb)` cases.
*
* Note: We use a union type for the third parameter because TypeScript cannot reliably disambiguate
* between ToolAnnotations and ZodRawShapeCompat during overload resolution, as both are plain object types.
* @deprecated Use `registerTool` instead.
*/
tool<Args extends ZodRawShapeCompat>(name: string, description: string, paramsSchemaOrAnnotations: Args | ToolAnnotations, cb: ToolCallback<Args>): RegisteredTool;
/**
* Registers a tool with both parameter schema and annotations.
* @deprecated Use `registerTool` instead.
*/
tool<Args extends ZodRawShapeCompat>(name: string, paramsSchema: Args, annotations: ToolAnnotations, cb: ToolCallback<Args>): RegisteredTool;
/**
* Registers a tool with description, parameter schema, and annotations.
* @deprecated Use `registerTool` instead.
*/
tool<Args extends ZodRawShapeCompat>(name: string, description: string, paramsSchema: Args, annotations: ToolAnnotations, cb: ToolCallback<Args>): RegisteredTool;
/**
* Registers a tool with a config object and callback.
*/
registerTool<OutputArgs extends ZodRawShapeCompat | AnySchema, InputArgs extends undefined | ZodRawShapeCompat | AnySchema = undefined>(name: string, config: {
title?: string;
description?: string;
inputSchema?: InputArgs;
outputSchema?: OutputArgs;
annotations?: ToolAnnotations;
_meta?: Record<string, unknown>;
}, cb: ToolCallback<InputArgs>): RegisteredTool;
/**
* Registers a zero-argument prompt `name`, which will run the given function when the client calls it.
* @deprecated Use `registerPrompt` instead.
*/
prompt(name: string, cb: PromptCallback): RegisteredPrompt;
/**
* Registers a zero-argument prompt `name` (with a description) which will run the given function when the client calls it.
* @deprecated Use `registerPrompt` instead.
*/
prompt(name: string, description: string, cb: PromptCallback): RegisteredPrompt;
/**
* Registers a prompt `name` accepting the given arguments, which must be an object containing named properties associated with Zod schemas. When the client calls it, the function will be run with the parsed and validated arguments.
* @deprecated Use `registerPrompt` instead.
*/
prompt<Args extends PromptArgsRawShape>(name: string, argsSchema: Args, cb: PromptCallback<Args>): RegisteredPrompt;
/**
* Registers a prompt `name` (with a description) accepting the given arguments, which must be an object containing named properties associated with Zod schemas. When the client calls it, the function will be run with the parsed and validated arguments.
* @deprecated Use `registerPrompt` instead.
*/
prompt<Args extends PromptArgsRawShape>(name: string, description: string, argsSchema: Args, cb: PromptCallback<Args>): RegisteredPrompt;
/**
* Registers a prompt with a config object and callback.
*/
registerPrompt<Args extends PromptArgsRawShape>(name: string, config: {
title?: string;
description?: string;
argsSchema?: Args;
}, cb: PromptCallback<Args>): RegisteredPrompt;
/**
* Checks if the server is connected to a transport.
* @returns True if the server is connected
*/
isConnected(): boolean;
/**
* Sends a logging message to the client, if connected.
* Note: You only need to send the parameters object, not the entire JSON RPC message
* @see LoggingMessageNotification
* @param params
* @param sessionId optional for stateless and backward compatibility
*/
sendLoggingMessage(params: LoggingMessageNotification['params'], sessionId?: string): Promise<void>;
/**
* Sends a resource list changed event to the client, if connected.
*/
sendResourceListChanged(): void;
/**
* Sends a tool list changed event to the client, if connected.
*/
sendToolListChanged(): void;
/**
* Sends a prompt list changed event to the client, if connected.
*/
sendPromptListChanged(): void;
}
/**
* A callback to complete one variable within a resource template's URI template.
*/
export type CompleteResourceTemplateCallback = (value: string, context?: {
arguments?: Record<string, string>;
}) => string[] | Promise<string[]>;
/**
* A resource template combines a URI pattern with optional functionality to enumerate
* all resources matching that pattern.
*/
export declare class ResourceTemplate {
private _callbacks;
private _uriTemplate;
constructor(uriTemplate: string | UriTemplate, _callbacks: {
/**
* A callback to list all resources matching this template. This is required to specified, even if `undefined`, to avoid accidentally forgetting resource listing.
*/
list: ListResourcesCallback | undefined;
/**
* An optional callback to autocomplete variables within the URI template. Useful for clients and users to discover possible values.
*/
complete?: {
[variable: string]: CompleteResourceTemplateCallback;
};
});
/**
* Gets the URI template pattern.
*/
get uriTemplate(): UriTemplate;
/**
* Gets the list callback, if one was provided.
*/
get listCallback(): ListResourcesCallback | undefined;
/**
* Gets the callback for completing a specific URI template variable, if one was provided.
*/
completeCallback(variable: string): CompleteResourceTemplateCallback | undefined;
}
export type BaseToolCallback<SendResultT extends Result, Extra extends RequestHandlerExtra<ServerRequest, ServerNotification>, Args extends undefined | ZodRawShapeCompat | AnySchema> = Args extends ZodRawShapeCompat ? (args: ShapeOutput<Args>, extra: Extra) => SendResultT | Promise<SendResultT> : Args extends AnySchema ? (args: SchemaOutput<Args>, extra: Extra) => SendResultT | Promise<SendResultT> : (extra: Extra) => SendResultT | Promise<SendResultT>;
/**
* Callback for a tool handler registered with Server.tool().
*
* Parameters will include tool arguments, if applicable, as well as other request handler context.
*
* The callback should return:
* - `structuredContent` if the tool has an outputSchema defined
* - `content` if the tool does not have an outputSchema
* - Both fields are optional but typically one should be provided
*/
export type ToolCallback<Args extends undefined | ZodRawShapeCompat | AnySchema = undefined> = BaseToolCallback<CallToolResult, RequestHandlerExtra<ServerRequest, ServerNotification>, Args>;
/**
* Supertype that can handle both regular tools (simple callback) and task-based tools (task handler object).
*/
export type AnyToolHandler<Args extends undefined | ZodRawShapeCompat | AnySchema = undefined> = ToolCallback<Args> | ToolTaskHandler<Args>;
export type RegisteredTool = {
title?: string;
description?: string;
inputSchema?: AnySchema;
outputSchema?: AnySchema;
annotations?: ToolAnnotations;
execution?: ToolExecution;
_meta?: Record<string, unknown>;
handler: AnyToolHandler<undefined | ZodRawShapeCompat>;
enabled: boolean;
enable(): void;
disable(): void;
update<InputArgs extends ZodRawShapeCompat, OutputArgs extends ZodRawShapeCompat>(updates: {
name?: string | null;
title?: string;
description?: string;
paramsSchema?: InputArgs;
outputSchema?: OutputArgs;
annotations?: ToolAnnotations;
_meta?: Record<string, unknown>;
callback?: ToolCallback<InputArgs>;
enabled?: boolean;
}): void;
remove(): void;
};
/**
* Additional, optional information for annotating a resource.
*/
export type ResourceMetadata = Omit<Resource, 'uri' | 'name'>;
/**
* Callback to list all resources matching a given template.
*/
export type ListResourcesCallback = (extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => ListResourcesResult | Promise<ListResourcesResult>;
/**
* Callback to read a resource at a given URI.
*/
export type ReadResourceCallback = (uri: URL, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => ReadResourceResult | Promise<ReadResourceResult>;
export type RegisteredResource = {
name: string;
title?: string;
metadata?: ResourceMetadata;
readCallback: ReadResourceCallback;
enabled: boolean;
enable(): void;
disable(): void;
update(updates: {
name?: string;
title?: string;
uri?: string | null;
metadata?: ResourceMetadata;
callback?: ReadResourceCallback;
enabled?: boolean;
}): void;
remove(): void;
};
/**
* Callback to read a resource at a given URI, following a filled-in URI template.
*/
export type ReadResourceTemplateCallback = (uri: URL, variables: Variables, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => ReadResourceResult | Promise<ReadResourceResult>;
export type RegisteredResourceTemplate = {
resourceTemplate: ResourceTemplate;
title?: string;
metadata?: ResourceMetadata;
readCallback: ReadResourceTemplateCallback;
enabled: boolean;
enable(): void;
disable(): void;
update(updates: {
name?: string | null;
title?: string;
template?: ResourceTemplate;
metadata?: ResourceMetadata;
callback?: ReadResourceTemplateCallback;
enabled?: boolean;
}): void;
remove(): void;
};
type PromptArgsRawShape = ZodRawShapeCompat;
export type PromptCallback<Args extends undefined | PromptArgsRawShape = undefined> = Args extends PromptArgsRawShape ? (args: ShapeOutput<Args>, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => GetPromptResult | Promise<GetPromptResult> : (extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => GetPromptResult | Promise<GetPromptResult>;
export type RegisteredPrompt = {
title?: string;
description?: string;
argsSchema?: AnyObjectSchema;
callback: PromptCallback<undefined | PromptArgsRawShape>;
enabled: boolean;
enable(): void;
disable(): void;
update<Args extends PromptArgsRawShape>(updates: {
name?: string | null;
title?: string;
description?: string;
argsSchema?: Args;
callback?: PromptCallback<Args>;
enabled?: boolean;
}): void;
remove(): void;
};
export {};
//# sourceMappingURL=mcp.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"music-2.js","sources":["../../../src/icons/music-2.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Music2\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSI4IiBjeT0iMTgiIHI9IjQiIC8+CiAgPHBhdGggZD0iTTEyIDE4VjJsNyA0IiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/music-2\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 Music2 = createLucideIcon('Music2', [\n ['circle', { cx: '8', cy: '18', r: '4', key: '1fc0mg' }],\n ['path', { d: 'M12 18V2l7 4', key: 'g04rme' }],\n]);\n\nexport default Music2;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,iBAAiB,QAAU,CAAA,CAAA,CAAA;AAAA,CACxC,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,EAAK,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACvD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC/C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"_K","2":"_I"},C:{"1":"_3L","2":"_KM","194":"_lI"},D:{"1":"_5F","2":"_8H"},E:{"1":"_2L","2":"_TB","16":"A","33":"_6 M _NE"},F:{"1":"_OI","2":"_RK"},G:{"1":"_BB","2":"_OB"},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":"_U","2":"J"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:2,C:"CSS text-orientation",D:true};
@@ -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 UserRoundMinus = createLucideIcon("UserRoundMinus", [
["path", { d: "M2 21a8 8 0 0 1 13.292-6", key: "bjp14o" }],
["circle", { cx: "10", cy: "8", r: "5", key: "o932ke" }],
["path", { d: "M22 19h-6", key: "vcuq98" }]
]);
export { UserRoundMinus as default };
//# sourceMappingURL=user-round-minus.js.map
@@ -0,0 +1,39 @@
import Client from './client'
import TPoolStats from './pool-stats'
import { URL } from 'node:url'
import Dispatcher from './dispatcher'
export default RoundRobinPool
type RoundRobinPoolConnectOptions = Omit<Dispatcher.ConnectOptions, 'origin'>
declare class RoundRobinPool extends Dispatcher {
constructor (url: string | URL, options?: RoundRobinPool.Options)
/** `true` after `pool.close()` has been called. */
closed: boolean
/** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */
destroyed: boolean
/** Aggregate stats for a RoundRobinPool. */
readonly stats: TPoolStats
// Override dispatcher APIs.
override connect (
options: RoundRobinPoolConnectOptions
): Promise<Dispatcher.ConnectData>
override connect (
options: RoundRobinPoolConnectOptions,
callback: (err: Error | null, data: Dispatcher.ConnectData) => void
): void
}
declare namespace RoundRobinPool {
export type RoundRobinPoolStats = TPoolStats
export interface Options extends Client.Options {
/** Default: `(origin, opts) => new Client(origin, opts)`. */
factory?(origin: URL, opts: object): Dispatcher;
/** The max number of clients to create. `null` if no limit. Default `null`. */
connections?: number | null;
/** The amount of time before a client is removed from the pool and closed. `null` if no time limit. Default `null` */
clientTtl?: number | null;
}
}
@@ -0,0 +1,350 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _decorate;
var _toArray = require("toArray");
var _toPropertyKey = require("toPropertyKey");
function _decorate(decorators, factory, superClass, mixins) {
var api = _getDecoratorsApi();
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
api = mixins[i](api);
}
}
var r = factory(function initialize(O) {
api.initializeInstanceElements(O, decorated.elements);
}, superClass);
var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators);
api.initializeClassElements(r.F, decorated.elements);
return api.runClassFinishers(r.F, decorated.finishers);
}
function _getDecoratorsApi() {
_getDecoratorsApi = function () {
return api;
};
var api = {
elementsDefinitionOrder: [["method"], ["field"]],
initializeInstanceElements: function (O, elements) {
["method", "field"].forEach(function (kind) {
elements.forEach(function (element) {
if (element.kind === kind && element.placement === "own") {
this.defineClassElement(O, element);
}
}, this);
}, this);
},
initializeClassElements: function (F, elements) {
var proto = F.prototype;
["method", "field"].forEach(function (kind) {
elements.forEach(function (element) {
var placement = element.placement;
if (element.kind === kind && (placement === "static" || placement === "prototype")) {
var receiver = placement === "static" ? F : proto;
this.defineClassElement(receiver, element);
}
}, this);
}, this);
},
defineClassElement: function (receiver, element) {
var descriptor = element.descriptor;
if (element.kind === "field") {
var initializer = element.initializer;
descriptor = {
enumerable: descriptor.enumerable,
writable: descriptor.writable,
configurable: descriptor.configurable,
value: initializer === void 0 ? void 0 : initializer.call(receiver)
};
}
Object.defineProperty(receiver, element.key, descriptor);
},
decorateClass: function (elements, decorators) {
var newElements = [];
var finishers = [];
var placements = {
static: [],
prototype: [],
own: []
};
elements.forEach(function (element) {
this.addElementPlacement(element, placements);
}, this);
elements.forEach(function (element) {
if (!_hasDecorators(element)) return newElements.push(element);
var elementFinishersExtras = this.decorateElement(element, placements);
newElements.push(elementFinishersExtras.element);
newElements.push.apply(newElements, elementFinishersExtras.extras);
finishers.push.apply(finishers, elementFinishersExtras.finishers);
}, this);
if (!decorators) {
return {
elements: newElements,
finishers: finishers
};
}
var result = this.decorateConstructor(newElements, decorators);
finishers.push.apply(finishers, result.finishers);
result.finishers = finishers;
return result;
},
addElementPlacement: function (element, placements, silent) {
var keys = placements[element.placement];
if (!silent && keys.indexOf(element.key) !== -1) {
throw new TypeError("Duplicated element (" + element.key + ")");
}
keys.push(element.key);
},
decorateElement: function (element, placements) {
var extras = [];
var finishers = [];
for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) {
var keys = placements[element.placement];
keys.splice(keys.indexOf(element.key), 1);
var elementObject = this.fromElementDescriptor(element);
var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject);
element = elementFinisherExtras.element;
this.addElementPlacement(element, placements);
if (elementFinisherExtras.finisher) {
finishers.push(elementFinisherExtras.finisher);
}
var newExtras = elementFinisherExtras.extras;
if (newExtras) {
for (var j = 0; j < newExtras.length; j++) {
this.addElementPlacement(newExtras[j], placements);
}
extras.push.apply(extras, newExtras);
}
}
return {
element: element,
finishers: finishers,
extras: extras
};
},
decorateConstructor: function (elements, decorators) {
var finishers = [];
for (var i = decorators.length - 1; i >= 0; i--) {
var obj = this.fromClassDescriptor(elements);
var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj);
if (elementsAndFinisher.finisher !== undefined) {
finishers.push(elementsAndFinisher.finisher);
}
if (elementsAndFinisher.elements !== undefined) {
elements = elementsAndFinisher.elements;
for (var j = 0; j < elements.length - 1; j++) {
for (var k = j + 1; k < elements.length; k++) {
if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) {
throw new TypeError("Duplicated element (" + elements[j].key + ")");
}
}
}
}
}
return {
elements: elements,
finishers: finishers
};
},
fromElementDescriptor: function (element) {
var obj = {
kind: element.kind,
key: element.key,
placement: element.placement,
descriptor: element.descriptor
};
var desc = {
value: "Descriptor",
configurable: true
};
Object.defineProperty(obj, Symbol.toStringTag, desc);
if (element.kind === "field") obj.initializer = element.initializer;
return obj;
},
toElementDescriptors: function (elementObjects) {
if (elementObjects === undefined) return;
return _toArray(elementObjects).map(function (elementObject) {
var element = this.toElementDescriptor(elementObject);
this.disallowProperty(elementObject, "finisher", "An element descriptor");
this.disallowProperty(elementObject, "extras", "An element descriptor");
return element;
}, this);
},
toElementDescriptor: function (elementObject) {
var kind = String(elementObject.kind);
if (kind !== "method" && kind !== "field") {
throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"');
}
var key = _toPropertyKey(elementObject.key);
var placement = String(elementObject.placement);
if (placement !== "static" && placement !== "prototype" && placement !== "own") {
throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"');
}
var descriptor = elementObject.descriptor;
this.disallowProperty(elementObject, "elements", "An element descriptor");
var element = {
kind: kind,
key: key,
placement: placement,
descriptor: Object.assign({}, descriptor)
};
if (kind !== "field") {
this.disallowProperty(elementObject, "initializer", "A method descriptor");
} else {
this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
element.initializer = elementObject.initializer;
}
return element;
},
toElementFinisherExtras: function (elementObject) {
var element = this.toElementDescriptor(elementObject);
var finisher = _optionalCallableProperty(elementObject, "finisher");
var extras = this.toElementDescriptors(elementObject.extras);
return {
element: element,
finisher: finisher,
extras: extras
};
},
fromClassDescriptor: function (elements) {
var obj = {
kind: "class",
elements: elements.map(this.fromElementDescriptor, this)
};
var desc = {
value: "Descriptor",
configurable: true
};
Object.defineProperty(obj, Symbol.toStringTag, desc);
return obj;
},
toClassDescriptor: function (obj) {
var kind = String(obj.kind);
if (kind !== "class") {
throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"');
}
this.disallowProperty(obj, "key", "A class descriptor");
this.disallowProperty(obj, "placement", "A class descriptor");
this.disallowProperty(obj, "descriptor", "A class descriptor");
this.disallowProperty(obj, "initializer", "A class descriptor");
this.disallowProperty(obj, "extras", "A class descriptor");
var finisher = _optionalCallableProperty(obj, "finisher");
var elements = this.toElementDescriptors(obj.elements);
return {
elements: elements,
finisher: finisher
};
},
runClassFinishers: function (constructor, finishers) {
for (var i = 0; i < finishers.length; i++) {
var newConstructor = (0, finishers[i])(constructor);
if (newConstructor !== undefined) {
if (typeof newConstructor !== "function") {
throw new TypeError("Finishers must return a constructor.");
}
constructor = newConstructor;
}
}
return constructor;
},
disallowProperty: function (obj, name, objectType) {
if (obj[name] !== undefined) {
throw new TypeError(objectType + " can't have a ." + name + " property.");
}
}
};
return api;
}
function _createElementDescriptor(def) {
var key = _toPropertyKey(def.key);
var descriptor;
if (def.kind === "method") {
descriptor = {
value: def.value,
writable: true,
configurable: true,
enumerable: false
};
} else if (def.kind === "get") {
descriptor = {
get: def.value,
configurable: true,
enumerable: false
};
} else if (def.kind === "set") {
descriptor = {
set: def.value,
configurable: true,
enumerable: false
};
} else if (def.kind === "field") {
descriptor = {
configurable: true,
writable: true,
enumerable: true
};
}
var element = {
kind: def.kind === "field" ? "field" : "method",
key: key,
placement: def.static ? "static" : def.kind === "field" ? "own" : "prototype",
descriptor: descriptor
};
if (def.decorators) element.decorators = def.decorators;
if (def.kind === "field") element.initializer = def.value;
return element;
}
function _coalesceGetterSetter(element, other) {
if (element.descriptor.get !== undefined) {
other.descriptor.get = element.descriptor.get;
} else {
other.descriptor.set = element.descriptor.set;
}
}
function _coalesceClassElements(elements) {
var newElements = [];
var isSameElement = function (other) {
return other.kind === "method" && other.key === element.key && other.placement === element.placement;
};
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
var other;
if (element.kind === "method" && (other = newElements.find(isSameElement))) {
if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) {
if (_hasDecorators(element) || _hasDecorators(other)) {
throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated.");
}
other.descriptor = element.descriptor;
} else {
if (_hasDecorators(element)) {
if (_hasDecorators(other)) {
throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ").");
}
other.decorators = element.decorators;
}
_coalesceGetterSetter(element, other);
}
} else {
newElements.push(element);
}
}
return newElements;
}
function _hasDecorators(element) {
return element.decorators && element.decorators.length;
}
function _isDataDescriptor(desc) {
return desc !== undefined && !(desc.value === undefined && desc.writable === undefined);
}
function _optionalCallableProperty(obj, name) {
var value = obj[name];
if (value !== undefined && typeof value !== "function") {
throw new TypeError("Expected '" + name + "' to be a function");
}
return value;
}
//# sourceMappingURL=decorate.js.map
@@ -0,0 +1,36 @@
/**
* @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 Pickaxe = createLucideIcon("Pickaxe", [
["path", { d: "M14.531 12.469 6.619 20.38a1 1 0 1 1-3-3l7.912-7.912", key: "we99rg" }],
[
"path",
{
d: "M15.686 4.314A12.5 12.5 0 0 0 5.461 2.958 1 1 0 0 0 5.58 4.71a22 22 0 0 1 6.318 3.393",
key: "1w6hck"
}
],
[
"path",
{
d: "M17.7 3.7a1 1 0 0 0-1.4 0l-4.6 4.6a1 1 0 0 0 0 1.4l2.6 2.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4z",
key: "15hgfx"
}
],
[
"path",
{
d: "M19.686 8.314a12.501 12.501 0 0 1 1.356 10.225 1 1 0 0 1-1.751-.119 22 22 0 0 0-3.393-6.319",
key: "452b4h"
}
]
]);
export { Pickaxe as default };
//# sourceMappingURL=pickaxe.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_b","132":"_A","388":"F"},B:{"1":"_K","132":"_I"},C:{"1":"_pF","16":"_f","132":"_fC _lD","388":"_5"},D:{"1":"_IS","16":"_Y","132":"_MD vB"},E:{"1":"_JB","16":"_wB _e","132":"_iC A _zB","388":"ND"},F:{"1":"_AN _vB","16":"_6C","132":"_WF","516":"_FL"},G:{"1":"_9","16":"_r","132":"_JC _FF"},H:{"516":"1D"},I:{"1":"I","16":"_LB 7D","132":"6D","388":"_oF"},J:{"16":"D","132":"A"},K:{"1":"H","16":"_cB","516":"aC"},L:{"1":"I"},M:{"1":"YC"},N:{"132":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"ME","132":"LE"}},B:5,C:":indeterminate CSS pseudo-class",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"heading-5.js","sources":["../../../src/icons/heading-5.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Heading5\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNCAxMmg4IiAvPgogIDxwYXRoIGQ9Ik00IDE4VjYiIC8+CiAgPHBhdGggZD0iTTEyIDE4VjYiIC8+CiAgPHBhdGggZD0iTTE3IDEzdi0zaDQiIC8+CiAgPHBhdGggZD0iTTE3IDE3LjdjLjQuMi44LjMgMS4zLjMgMS41IDAgMi43LTEuMSAyLjctMi41UzE5LjggMTMgMTguMyAxM0gxNyIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/heading-5\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 Heading5 = createLucideIcon('Heading5', [\n ['path', { d: 'M4 12h8', key: '17cfdx' }],\n ['path', { d: 'M4 18V6', key: '1rz3zl' }],\n ['path', { d: 'M12 18V6', key: 'zqpxq5' }],\n ['path', { d: 'M17 13v-3h4', key: '1nvgqp' }],\n [\n 'path',\n { d: 'M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17', key: '2nebdn' },\n ],\n]);\n\nexport default Heading5;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,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,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,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAC5C,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoE,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,QAAS,CAAA,CAAA;AAAA,CACzF,CAAA,CAAA;AACF,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,9 @@
'use strict'
const SemVer = require('../classes/semver')
const compareBuild = (a, b, loose) => {
const versionA = new SemVer(a, loose)
const versionB = new SemVer(b, loose)
return versionA.compare(versionB) || versionA.compareBuild(versionB)
}
module.exports = compareBuild
@@ -0,0 +1,247 @@
/**
* @fileoverview Utility functions to locate the source text of each code unit in the value of a string literal or template token.
* @author Francesco Trotta
*/
"use strict";
/**
* Represents a code unit produced by the evaluation of a JavaScript common token like a string
* literal or template token.
*/
class CodeUnit {
constructor(start, source) {
this.start = start;
this.source = source;
}
get end() {
return this.start + this.length;
}
get length() {
return this.source.length;
}
}
/**
* An object used to keep track of the position in a source text where the next characters will be read.
*/
class TextReader {
constructor(source) {
this.source = source;
this.pos = 0;
}
/**
* Advances the reading position of the specified number of characters.
* @param {number} length Number of characters to advance.
* @returns {void}
*/
advance(length) {
this.pos += length;
}
/**
* Reads characters from the source.
* @param {number} [offset=0] The offset where reading starts, relative to the current position.
* @param {number} [length=1] Number of characters to read.
* @returns {string} A substring of source characters.
*/
read(offset = 0, length = 1) {
const start = offset + this.pos;
return this.source.slice(start, start + length);
}
}
const SIMPLE_ESCAPE_SEQUENCES = {
__proto__: null,
b: "\b",
f: "\f",
n: "\n",
r: "\r",
t: "\t",
v: "\v",
};
/**
* Reads a hex escape sequence.
* @param {TextReader} reader The reader should be positioned on the first hexadecimal digit.
* @param {number} length The number of hexadecimal digits.
* @returns {string} A code unit.
*/
function readHexSequence(reader, length) {
const str = reader.read(0, length);
const charCode = parseInt(str, 16);
reader.advance(length);
return String.fromCharCode(charCode);
}
/**
* Reads a Unicode escape sequence.
* @param {TextReader} reader The reader should be positioned after the "u".
* @returns {string} A code unit.
*/
function readUnicodeSequence(reader) {
const regExp = /\{(?<hexDigits>[\dA-F]+)\}/iuy;
regExp.lastIndex = reader.pos;
const match = regExp.exec(reader.source);
if (match) {
const codePoint = parseInt(match.groups.hexDigits, 16);
reader.pos = regExp.lastIndex;
return String.fromCodePoint(codePoint);
}
return readHexSequence(reader, 4);
}
/**
* Reads an octal escape sequence.
* @param {TextReader} reader The reader should be positioned after the first octal digit.
* @param {number} maxLength The maximum number of octal digits.
* @returns {string} A code unit.
*/
function readOctalSequence(reader, maxLength) {
const [octalStr] = reader.read(-1, maxLength).match(/^[0-7]+/u);
reader.advance(octalStr.length - 1);
const octal = parseInt(octalStr, 8);
return String.fromCharCode(octal);
}
/**
* Reads an escape sequence or line continuation.
* @param {TextReader} reader The reader should be positioned on the backslash.
* @returns {string} A string of zero, one or two code units.
*/
function readEscapeSequenceOrLineContinuation(reader) {
const char = reader.read(1);
reader.advance(2);
const unitChar = SIMPLE_ESCAPE_SEQUENCES[char];
if (unitChar) {
return unitChar;
}
switch (char) {
case "x":
return readHexSequence(reader, 2);
case "u":
return readUnicodeSequence(reader);
case "\r":
if (reader.read() === "\n") {
reader.advance(1);
}
// fallthrough
case "\n":
case "\u2028":
case "\u2029":
return "";
case "0":
case "1":
case "2":
case "3":
return readOctalSequence(reader, 3);
case "4":
case "5":
case "6":
case "7":
return readOctalSequence(reader, 2);
default:
return char;
}
}
/**
* Reads an escape sequence or line continuation and generates the respective `CodeUnit` elements.
* @param {TextReader} reader The reader should be positioned on the backslash.
* @returns {Generator<CodeUnit>} Zero, one or two `CodeUnit` elements.
*/
function* mapEscapeSequenceOrLineContinuation(reader) {
const start = reader.pos;
const str = readEscapeSequenceOrLineContinuation(reader);
const end = reader.pos;
const source = reader.source.slice(start, end);
switch (str.length) {
case 0:
break;
case 1:
yield new CodeUnit(start, source);
break;
default:
yield new CodeUnit(start, source);
yield new CodeUnit(start, source);
break;
}
}
/**
* Parses a string literal.
* @param {string} source The string literal to parse, including the delimiting quotes.
* @returns {CodeUnit[]} A list of code units produced by the string literal.
*/
function parseStringLiteral(source) {
const reader = new TextReader(source);
const quote = reader.read();
reader.advance(1);
const codeUnits = [];
for (;;) {
const char = reader.read();
if (char === quote) {
break;
}
if (char === "\\") {
codeUnits.push(...mapEscapeSequenceOrLineContinuation(reader));
} else {
codeUnits.push(new CodeUnit(reader.pos, char));
reader.advance(1);
}
}
return codeUnits;
}
/**
* Parses a template token.
* @param {string} source The template token to parse, including the delimiting sequences `` ` ``, `${` and `}`.
* @returns {CodeUnit[]} A list of code units produced by the template token.
*/
function parseTemplateToken(source) {
const reader = new TextReader(source);
reader.advance(1);
const codeUnits = [];
for (;;) {
const char = reader.read();
if (char === "`" || (char === "$" && reader.read(1) === "{")) {
break;
}
if (char === "\\") {
codeUnits.push(...mapEscapeSequenceOrLineContinuation(reader));
} else {
let unitSource;
if (char === "\r" && reader.read(1) === "\n") {
unitSource = "\r\n";
} else {
unitSource = char;
}
codeUnits.push(new CodeUnit(reader.pos, unitSource));
reader.advance(unitSource.length);
}
}
return codeUnits;
}
module.exports = { parseStringLiteral, parseTemplateToken };
@@ -0,0 +1,221 @@
"use client";
// src/dismissable-layer.tsx
import * as React from "react";
import { composeEventHandlers } from "@radix-ui/primitive";
import { Primitive, dispatchDiscreteCustomEvent } from "@radix-ui/react-primitive";
import { useComposedRefs } from "@radix-ui/react-compose-refs";
import { useCallbackRef } from "@radix-ui/react-use-callback-ref";
import { useEscapeKeydown } from "@radix-ui/react-use-escape-keydown";
import { jsx } from "react/jsx-runtime";
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
var CONTEXT_UPDATE = "dismissableLayer.update";
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
var originalBodyPointerEvents;
var DismissableLayerContext = React.createContext({
layers: /* @__PURE__ */ new Set(),
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
branches: /* @__PURE__ */ new Set()
});
var DismissableLayer = React.forwardRef(
(props, forwardedRef) => {
const {
disableOutsidePointerEvents = false,
onEscapeKeyDown,
onPointerDownOutside,
onFocusOutside,
onInteractOutside,
onDismiss,
...layerProps
} = props;
const context = React.useContext(DismissableLayerContext);
const [node, setNode] = React.useState(null);
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
const [, force] = React.useState({});
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
const layers = Array.from(context.layers);
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
const index = node ? layers.indexOf(node) : -1;
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
const pointerDownOutside = usePointerDownOutside((event) => {
const target = event.target;
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
onPointerDownOutside?.(event);
onInteractOutside?.(event);
if (!event.defaultPrevented) onDismiss?.();
}, ownerDocument);
const focusOutside = useFocusOutside((event) => {
const target = event.target;
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
if (isFocusInBranch) return;
onFocusOutside?.(event);
onInteractOutside?.(event);
if (!event.defaultPrevented) onDismiss?.();
}, ownerDocument);
useEscapeKeydown((event) => {
const isHighestLayer = index === context.layers.size - 1;
if (!isHighestLayer) return;
onEscapeKeyDown?.(event);
if (!event.defaultPrevented && onDismiss) {
event.preventDefault();
onDismiss();
}
}, ownerDocument);
React.useEffect(() => {
if (!node) return;
if (disableOutsidePointerEvents) {
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
ownerDocument.body.style.pointerEvents = "none";
}
context.layersWithOutsidePointerEventsDisabled.add(node);
}
context.layers.add(node);
dispatchUpdate();
return () => {
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
}
};
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
React.useEffect(() => {
return () => {
if (!node) return;
context.layers.delete(node);
context.layersWithOutsidePointerEventsDisabled.delete(node);
dispatchUpdate();
};
}, [node, context]);
React.useEffect(() => {
const handleUpdate = () => force({});
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
}, []);
return /* @__PURE__ */ jsx(
Primitive.div,
{
...layerProps,
ref: composedRefs,
style: {
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
...props.style
},
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
onPointerDownCapture: composeEventHandlers(
props.onPointerDownCapture,
pointerDownOutside.onPointerDownCapture
)
}
);
}
);
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
var BRANCH_NAME = "DismissableLayerBranch";
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
const context = React.useContext(DismissableLayerContext);
const ref = React.useRef(null);
const composedRefs = useComposedRefs(forwardedRef, ref);
React.useEffect(() => {
const node = ref.current;
if (node) {
context.branches.add(node);
return () => {
context.branches.delete(node);
};
}
}, [context.branches]);
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
});
DismissableLayerBranch.displayName = BRANCH_NAME;
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
const isPointerInsideReactTreeRef = React.useRef(false);
const handleClickRef = React.useRef(() => {
});
React.useEffect(() => {
const handlePointerDown = (event) => {
if (event.target && !isPointerInsideReactTreeRef.current) {
let handleAndDispatchPointerDownOutsideEvent2 = function() {
handleAndDispatchCustomEvent(
POINTER_DOWN_OUTSIDE,
handlePointerDownOutside,
eventDetail,
{ discrete: true }
);
};
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
const eventDetail = { originalEvent: event };
if (event.pointerType === "touch") {
ownerDocument.removeEventListener("click", handleClickRef.current);
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
} else {
handleAndDispatchPointerDownOutsideEvent2();
}
} else {
ownerDocument.removeEventListener("click", handleClickRef.current);
}
isPointerInsideReactTreeRef.current = false;
};
const timerId = window.setTimeout(() => {
ownerDocument.addEventListener("pointerdown", handlePointerDown);
}, 0);
return () => {
window.clearTimeout(timerId);
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
ownerDocument.removeEventListener("click", handleClickRef.current);
};
}, [ownerDocument, handlePointerDownOutside]);
return {
// ensures we check React component tree (not just DOM tree)
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
};
}
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
const handleFocusOutside = useCallbackRef(onFocusOutside);
const isFocusInsideReactTreeRef = React.useRef(false);
React.useEffect(() => {
const handleFocus = (event) => {
if (event.target && !isFocusInsideReactTreeRef.current) {
const eventDetail = { originalEvent: event };
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
discrete: false
});
}
};
ownerDocument.addEventListener("focusin", handleFocus);
return () => ownerDocument.removeEventListener("focusin", handleFocus);
}, [ownerDocument, handleFocusOutside]);
return {
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
};
}
function dispatchUpdate() {
const event = new CustomEvent(CONTEXT_UPDATE);
document.dispatchEvent(event);
}
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
const target = detail.originalEvent.target;
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
if (handler) target.addEventListener(name, handler, { once: true });
if (discrete) {
dispatchDiscreteCustomEvent(target, event);
} else {
target.dispatchEvent(event);
}
}
var Root = DismissableLayer;
var Branch = DismissableLayerBranch;
export {
Branch,
DismissableLayer,
DismissableLayerBranch,
Root
};
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,29 @@
/**
* @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 KeySquare = createLucideIcon("KeySquare", [
[
"path",
{
d: "M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z",
key: "165ttr"
}
],
["path", { d: "m14 7 3 3", key: "1r5n42" }],
[
"path",
{
d: "m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814",
key: "1ubxi2"
}
]
]);
export { KeySquare as default };
//# sourceMappingURL=key-square.js.map
@@ -0,0 +1,12 @@
"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.es2025_promise = void 0;
const base_config_1 = require("./base-config");
exports.es2025_promise = {
libs: [],
variables: [['PromiseConstructor', base_config_1.TYPE]],
};
@@ -0,0 +1,82 @@
import { IncomingMessage, ServerResponse } from 'node:http';
import { Transport } from '../shared/transport.js';
import { JSONRPCMessage, MessageExtraInfo } from '../types.js';
import { AuthInfo } from './auth/types.js';
/**
* Configuration options for SSEServerTransport.
*/
export interface SSEServerTransportOptions {
/**
* List of allowed host header values for DNS rebinding protection.
* If not specified, host validation is disabled.
* @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead,
* or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default.
*/
allowedHosts?: string[];
/**
* List of allowed origin header values for DNS rebinding protection.
* If not specified, origin validation is disabled.
* @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead,
* or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default.
*/
allowedOrigins?: string[];
/**
* Enable DNS rebinding protection (requires allowedHosts and/or allowedOrigins to be configured).
* Default is false for backwards compatibility.
* @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead,
* or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default.
*/
enableDnsRebindingProtection?: boolean;
}
/**
* Server transport for SSE: this will send messages over an SSE connection and receive messages from HTTP POST requests.
*
* This transport is only available in Node.js environments.
* @deprecated SSEServerTransport is deprecated. Use StreamableHTTPServerTransport instead.
*/
export declare class SSEServerTransport implements Transport {
private _endpoint;
private res;
private _sseResponse?;
private _sessionId;
private _options;
onclose?: () => void;
onerror?: (error: Error) => void;
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
/**
* Creates a new SSE server transport, which will direct the client to POST messages to the relative or absolute URL identified by `_endpoint`.
*/
constructor(_endpoint: string, res: ServerResponse, options?: SSEServerTransportOptions);
/**
* Validates request headers for DNS rebinding protection.
* @returns Error message if validation fails, undefined if validation passes.
*/
private validateRequestHeaders;
/**
* Handles the initial SSE connection request.
*
* This should be called when a GET request is made to establish the SSE stream.
*/
start(): Promise<void>;
/**
* Handles incoming POST messages.
*
* This should be called when a POST request is made to send a message to the server.
*/
handlePostMessage(req: IncomingMessage & {
auth?: AuthInfo;
}, res: ServerResponse, parsedBody?: unknown): Promise<void>;
/**
* Handle a client message, regardless of how it arrived. This can be used to inform the server of messages that arrive via a means different than HTTP POST.
*/
handleMessage(message: unknown, extra?: MessageExtraInfo): Promise<void>;
close(): Promise<void>;
send(message: JSONRPCMessage): Promise<void>;
/**
* Returns the session ID for this transport.
*
* This can be used to route incoming POST requests.
*/
get sessionId(): string;
}
//# sourceMappingURL=sse.d.ts.map
@@ -0,0 +1,4 @@
import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment.cts';
export type Source = ReverseSegment[][];
export = function buildBySources(decoded: readonly SourceMapSegment[][], memos: unknown[]): Source[];
//# sourceMappingURL=by-source.d.ts.map
@@ -0,0 +1,18 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const SignpostBig = createLucideIcon("SignpostBig", [
["path", { d: "M10 9H4L2 7l2-2h6", key: "1hq7x2" }],
["path", { d: "M14 5h6l2 2-2 2h-6", key: "bv62ej" }],
["path", { d: "M10 22V4a2 2 0 1 1 4 0v18", key: "eqpcf2" }],
["path", { d: "M8 22h8", key: "rmew8v" }]
]);
export { SignpostBig as default };
//# sourceMappingURL=signpost-big.js.map
@@ -0,0 +1,109 @@
import MockAgent from './mock-agent'
declare class SnapshotRecorder {
constructor (options?: SnapshotRecorder.Options)
record (requestOpts: any, response: any): Promise<void>
findSnapshot (requestOpts: any): SnapshotRecorder.Snapshot | undefined
loadSnapshots (filePath?: string): Promise<void>
saveSnapshots (filePath?: string): Promise<void>
clear (): void
getSnapshots (): SnapshotRecorder.Snapshot[]
size (): number
resetCallCounts (): void
deleteSnapshot (requestOpts: any): boolean
getSnapshotInfo (requestOpts: any): SnapshotRecorder.SnapshotInfo | null
replaceSnapshots (snapshotData: SnapshotRecorder.SnapshotData[]): void
destroy (): void
}
declare namespace SnapshotRecorder {
type SnapshotRecorderMode = 'record' | 'playback' | 'update'
export interface Options {
snapshotPath?: string
mode?: SnapshotRecorderMode
maxSnapshots?: number
autoFlush?: boolean
flushInterval?: number
matchHeaders?: string[]
ignoreHeaders?: string[]
excludeHeaders?: string[]
matchBody?: boolean
matchQuery?: boolean
caseSensitive?: boolean
shouldRecord?: (requestOpts: any) => boolean
shouldPlayback?: (requestOpts: any) => boolean
excludeUrls?: (string | RegExp)[]
}
export interface Snapshot {
request: {
method: string
url: string
headers: Record<string, string>
body?: string
}
responses: {
statusCode: number
headers: Record<string, string>
body: string
trailers: Record<string, string>
}[]
callCount: number
timestamp: string
}
export interface SnapshotInfo {
hash: string
request: {
method: string
url: string
headers: Record<string, string>
body?: string
}
responseCount: number
callCount: number
timestamp: string
}
export interface SnapshotData {
hash: string
snapshot: Snapshot
}
}
declare class SnapshotAgent extends MockAgent {
constructor (options?: SnapshotAgent.Options)
saveSnapshots (filePath?: string): Promise<void>
loadSnapshots (filePath?: string): Promise<void>
getRecorder (): SnapshotRecorder
getMode (): SnapshotRecorder.SnapshotRecorderMode
clearSnapshots (): void
resetCallCounts (): void
deleteSnapshot (requestOpts: any): boolean
getSnapshotInfo (requestOpts: any): SnapshotRecorder.SnapshotInfo | null
replaceSnapshots (snapshotData: SnapshotRecorder.SnapshotData[]): void
}
declare namespace SnapshotAgent {
export interface Options extends MockAgent.Options {
mode?: SnapshotRecorder.SnapshotRecorderMode
snapshotPath?: string
maxSnapshots?: number
autoFlush?: boolean
flushInterval?: number
matchHeaders?: string[]
ignoreHeaders?: string[]
excludeHeaders?: string[]
matchBody?: boolean
matchQuery?: boolean
caseSensitive?: boolean
shouldRecord?: (requestOpts: any) => boolean
shouldPlayback?: (requestOpts: any) => boolean
excludeUrls?: (string | RegExp)[]
}
}
export { SnapshotAgent, SnapshotRecorder }
@@ -0,0 +1 @@
{"version":3,"file":"arrow-down-right-from-circle.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,42 @@
import type { AddedKeywordDefinition, AnySchemaObject, KeywordErrorCxt, KeywordCxtParams } from "../../types";
import type { SchemaCxt, SchemaObjCxt } from "..";
import { SubschemaArgs } from "./subschema";
import { Code, Name, CodeGen } from "../codegen";
import type { JSONType } from "../rules";
import { ErrorPaths } from "../errors";
export declare function validateFunctionCode(it: SchemaCxt): void;
export declare class KeywordCxt implements KeywordErrorCxt {
readonly gen: CodeGen;
readonly allErrors?: boolean;
readonly keyword: string;
readonly data: Name;
readonly $data?: string | false;
schema: any;
readonly schemaValue: Code | number | boolean;
readonly schemaCode: Code | number | boolean;
readonly schemaType: JSONType[];
readonly parentSchema: AnySchemaObject;
readonly errsCount?: Name;
params: KeywordCxtParams;
readonly it: SchemaObjCxt;
readonly def: AddedKeywordDefinition;
constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string);
result(condition: Code, successAction?: () => void, failAction?: () => void): void;
failResult(condition: Code, successAction?: () => void, failAction?: () => void): void;
pass(condition: Code, failAction?: () => void): void;
fail(condition?: Code): void;
fail$data(condition: Code): void;
error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void;
private _error;
$dataError(): void;
reset(): void;
ok(cond: Code | boolean): void;
setParams(obj: KeywordCxtParams, assign?: true): void;
block$data(valid: Name, codeBlock: () => void, $dataValid?: Code): void;
check$data(valid?: Name, $dataValid?: Code): void;
invalid$data(): Code;
subschema(appl: SubschemaArgs, valid: Name): SchemaCxt;
mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void;
mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void;
}
export declare function getData($data: string, { dataLevel, dataNames, dataPathArr }: SchemaCxt): Code | number;
@@ -0,0 +1,98 @@
2.4.1 / 2022-02-22
==================
* Fix error on early async hooks implementations
2.4.0 / 2022-02-21
==================
* Prevent loss of async hooks context
2.3.0 / 2015-05-26
==================
* Add defined behavior for HTTP `CONNECT` requests
* Add defined behavior for HTTP `Upgrade` requests
* deps: ee-first@1.1.1
2.2.1 / 2015-04-22
==================
* Fix `isFinished(req)` when data buffered
2.2.0 / 2014-12-22
==================
* Add message object to callback arguments
2.1.1 / 2014-10-22
==================
* Fix handling of pipelined requests
2.1.0 / 2014-08-16
==================
* Check if `socket` is detached
* Return `undefined` for `isFinished` if state unknown
2.0.0 / 2014-08-16
==================
* Add `isFinished` function
* Move to `jshttp` organization
* Remove support for plain socket argument
* Rename to `on-finished`
* Support both `req` and `res` as arguments
* deps: ee-first@1.0.5
1.2.2 / 2014-06-10
==================
* Reduce listeners added to emitters
- avoids "event emitter leak" warnings when used multiple times on same request
1.2.1 / 2014-06-08
==================
* Fix returned value when already finished
1.2.0 / 2014-06-05
==================
* Call callback when called on already-finished socket
1.1.4 / 2014-05-27
==================
* Support node.js 0.8
1.1.3 / 2014-04-30
==================
* Make sure errors passed as instanceof `Error`
1.1.2 / 2014-04-18
==================
* Default the `socket` to passed-in object
1.1.1 / 2014-01-16
==================
* Rename module to `finished`
1.1.0 / 2013-12-25
==================
* Call callback when called on already-errored socket
1.0.1 / 2013-12-20
==================
* Actually pass the error to the callback
1.0.0 / 2013-12-20
==================
* Initial release
@@ -0,0 +1,35 @@
import { MessagePort } from 'node:worker_threads';
import { R as RequiredProperty } from '../../types-Cxp8y2TL.js';
type ScopedImport = (specifier: string, parent: string) => Promise<any>;
type TsconfigOptions = false | string;
type InitializationOptions = {
namespace?: string;
port?: MessagePort;
tsconfig?: TsconfigOptions;
};
type RegisterOptions = {
namespace?: string;
onImport?: (url: string) => void;
tsconfig?: TsconfigOptions;
};
type Unregister = () => Promise<void>;
type NamespacedUnregister = Unregister & {
import: ScopedImport;
unregister: Unregister;
};
type Register = {
(options: RequiredProperty<RegisterOptions, 'namespace'>): NamespacedUnregister;
(options?: RegisterOptions): Unregister;
};
declare const register: Register;
type Options = {
parentURL: string;
onImport?: (url: string) => void;
tsconfig?: TsconfigOptions;
};
declare const tsImport: (specifier: string, options: string | Options) => Promise<any>;
export { type InitializationOptions, type NamespacedUnregister, type Register, type RegisterOptions, type ScopedImport, type Unregister, register, tsImport };
@@ -0,0 +1,55 @@
export default {
warnings: {
straightRow: 'Straight rows of keys on your keyboard are easy to guess.',
keyPattern: 'Short keyboard patterns are easy to guess.',
simpleRepeat: 'Repeated characters like "aaa" are easy to guess.',
extendedRepeat:
'Repeated character patterns like "abcabcabc" are easy to guess.',
sequences: 'Common character sequences like "abc" are easy to guess.',
recentYears: 'Recent years are easy to guess.',
dates: 'Dates are easy to guess.',
topTen: 'This is a heavily used password.',
topHundred: 'This is a frequently used password.',
common: 'This is a commonly used password.',
similarToCommon: 'This is similar to a commonly used password.',
wordByItself: 'Single words are easy to guess.',
namesByThemselves: 'Single names or surnames are easy to guess.',
commonNames: 'Common names and surnames are easy to guess.',
userInputs: 'There should not be any personal or page related data.',
pwned: 'Your password was exposed by a data breach on the Internet.',
},
suggestions: {
l33t: "Avoid predictable letter substitutions like '@' for 'a'.",
reverseWords: 'Avoid reversed spellings of common words.',
allUppercase: 'Capitalize some, but not all letters.',
capitalization: 'Capitalize more than the first letter.',
dates: 'Avoid dates and years that are associated with you.',
recentYears: 'Avoid recent years.',
associatedYears: 'Avoid years that are associated with you.',
sequences: 'Avoid common character sequences.',
repeated: 'Avoid repeated words and characters.',
longerKeyboardPattern:
'Use longer keyboard patterns and change typing direction multiple times.',
anotherWord: 'Add more words that are less common.',
useWords: 'Use multiple words, but avoid common phrases.',
noNeed:
'You can create strong passwords without using symbols, numbers, or uppercase letters.',
pwned: 'If you use this password elsewhere, you should change it.',
},
timeEstimation: {
ltSecond: 'less than a second',
second: '{base} second',
seconds: '{base} seconds',
minute: '{base} minute',
minutes: '{base} minutes',
hour: '{base} hour',
hours: '{base} hours',
day: '{base} day',
days: '{base} days',
month: '{base} month',
months: '{base} months',
year: '{base} year',
years: '{base} years',
centuries: 'centuries',
},
}
@@ -0,0 +1 @@
{"version":3,"names":["_lowercase","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_uppercase"],"sources":["../../../src/builders/generated/index.ts"],"sourcesContent":["/*\n * This file is auto-generated! Do not modify it directly.\n * To re-generate run 'make build'\n */\n\nexport * from \"./lowercase.ts\";\nexport * from \"./uppercase.ts\";\n\n// Uppercase builders and AST types conflict with each other, which is\n// not allowed by TypeScript when using `export * from ...`\n// We instead explicity list the AST types here, so that:\n// - From a TypeScript perspective, the AST types win over the uppercase\n// builders (which is the standard behavior for JS when a named\n// re-export conflicts with a * re-export.)\n// - At runtime, this `export type` is removed, leaving only the uppercase\n// builders behind (which are thus visible to JavaScript code).\n// This ensures compatibility with legacy code that uses the uppercase\n// builders, while allowing TypeScript users to use the lowercase builders\n// together with the AST types.\n\n// prettier-ignore\nexport type {\n ArrayExpression, AssignmentExpression, BinaryExpression, InterpreterDirective, Directive, DirectiveLiteral, BlockStatement, BreakStatement, CallExpression, CatchClause, ConditionalExpression, ContinueStatement, DebuggerStatement, DoWhileStatement, EmptyStatement, ExpressionStatement, File, ForInStatement, ForStatement, FunctionDeclaration, FunctionExpression, Identifier, IfStatement, LabeledStatement, StringLiteral, NumericLiteral, NullLiteral, BooleanLiteral, RegExpLiteral, LogicalExpression, MemberExpression, NewExpression, Program, ObjectExpression, ObjectMethod, ObjectProperty, RestElement, ReturnStatement, SequenceExpression, ParenthesizedExpression, SwitchCase, SwitchStatement, ThisExpression, ThrowStatement, TryStatement, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, AssignmentPattern, ArrayPattern, ArrowFunctionExpression, ClassBody, ClassExpression, ClassDeclaration, ExportAllDeclaration, ExportDefaultDeclaration, ExportNamedDeclaration, ExportSpecifier, ForOfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, ImportExpression, MetaProperty, ClassMethod, ObjectPattern, SpreadElement, Super, TaggedTemplateExpression, TemplateElement, TemplateLiteral, YieldExpression, AwaitExpression, Import, BigIntLiteral, ExportNamespaceSpecifier, OptionalMemberExpression, OptionalCallExpression, ClassProperty, ClassAccessorProperty, ClassPrivateProperty, ClassPrivateMethod, PrivateName, StaticBlock, ImportAttribute, AnyTypeAnnotation, ArrayTypeAnnotation, BooleanTypeAnnotation, BooleanLiteralTypeAnnotation, NullLiteralTypeAnnotation, ClassImplements, DeclareClass, DeclareFunction, DeclareInterface, DeclareModule, DeclareModuleExports, DeclareTypeAlias, DeclareOpaqueType, DeclareVariable, DeclareExportDeclaration, DeclareExportAllDeclaration, DeclaredPredicate, ExistsTypeAnnotation, FunctionTypeAnnotation, FunctionTypeParam, GenericTypeAnnotation, InferredPredicate, InterfaceExtends, InterfaceDeclaration, InterfaceTypeAnnotation, IntersectionTypeAnnotation, MixedTypeAnnotation, EmptyTypeAnnotation, NullableTypeAnnotation, NumberLiteralTypeAnnotation, NumberTypeAnnotation, ObjectTypeAnnotation, ObjectTypeInternalSlot, ObjectTypeCallProperty, ObjectTypeIndexer, ObjectTypeProperty, ObjectTypeSpreadProperty, OpaqueType, QualifiedTypeIdentifier, StringLiteralTypeAnnotation, StringTypeAnnotation, SymbolTypeAnnotation, ThisTypeAnnotation, TupleTypeAnnotation, TypeofTypeAnnotation, TypeAlias, TypeAnnotation, TypeCastExpression, TypeParameter, TypeParameterDeclaration, TypeParameterInstantiation, UnionTypeAnnotation, Variance, VoidTypeAnnotation, EnumDeclaration, EnumBooleanBody, EnumNumberBody, EnumStringBody, EnumSymbolBody, EnumBooleanMember, EnumNumberMember, EnumStringMember, EnumDefaultedMember, IndexedAccessType, OptionalIndexedAccessType, JSXAttribute, JSXClosingElement, JSXElement, JSXEmptyExpression, JSXExpressionContainer, JSXSpreadChild, JSXIdentifier, JSXMemberExpression, JSXNamespacedName, JSXOpeningElement, JSXSpreadAttribute, JSXText, JSXFragment, JSXOpeningFragment, JSXClosingFragment, Noop, Placeholder, V8IntrinsicIdentifier, ArgumentPlaceholder, BindExpression, Decorator, DoExpression, ExportDefaultSpecifier, RecordExpression, TupleExpression, DecimalLiteral, ModuleExpression, TopicReference, PipelineTopicExpression, PipelineBareFunction, PipelinePrimaryTopicReference, VoidPattern, TSParameterProperty, TSDeclareFunction, TSDeclareMethod, TSQualifiedName, TSCallSignatureDeclaration, TSConstructSignatureDeclaration, TSPropertySignature, TSMethodSignature, TSIndexSignature, TSAnyKeyword, TSBooleanKeyword, TSBigIntKeyword, TSIntrinsicKeyword, TSNeverKeyword, TSNullKeyword, TSNumberKeyword, TSObjectKeyword, TSStringKeyword, TSSymbolKeyword, TSUndefinedKeyword, TSUnknownKeyword, TSVoidKeyword, TLine truncated
@@ -0,0 +1,11 @@
import { ReadableStream } from 'node:stream/web';
import { Readable } from 'node:stream';
import { AnyRouter } from '../router.cjs';
export declare function transformReadableStreamWithRouter(router: AnyRouter, routerStream: ReadableStream): ReadableStream<any>;
export declare function transformPipeableStreamWithRouter(router: AnyRouter, routerStream: Readable): Readable;
export declare function transformStreamWithRouter(router: AnyRouter, appStream: ReadableStream, opts?: {
/** Timeout for serialization to complete after app render finishes (default: 60000ms) */
timeoutMs?: number;
/** Maximum lifetime of the stream transform (default: 60000ms). Safety net for cleanup. */
lifetimeMs?: number;
}): ReadableStream<any>;
@@ -0,0 +1,62 @@
"use strict";
exports.__esModule = true;
exports.LinesAndColumns = void 0;
var LF = '\n';
var CR = '\r';
var LinesAndColumns = /** @class */ (function () {
function LinesAndColumns(string) {
this.string = string;
var offsets = [0];
for (var offset = 0; offset < string.length;) {
switch (string[offset]) {
case LF:
offset += LF.length;
offsets.push(offset);
break;
case CR:
offset += CR.length;
if (string[offset] === LF) {
offset += LF.length;
}
offsets.push(offset);
break;
default:
offset++;
break;
}
}
this.offsets = offsets;
}
LinesAndColumns.prototype.locationForIndex = function (index) {
if (index < 0 || index > this.string.length) {
return null;
}
var line = 0;
var offsets = this.offsets;
while (offsets[line + 1] <= index) {
line++;
}
var column = index - offsets[line];
return { line: line, column: column };
};
LinesAndColumns.prototype.indexForLocation = function (location) {
var line = location.line, column = location.column;
if (line < 0 || line >= this.offsets.length) {
return null;
}
if (column < 0 || column > this.lengthOfLine(line)) {
return null;
}
return this.offsets[line] + column;
};
LinesAndColumns.prototype.lengthOfLine = function (line) {
var offset = this.offsets[line];
var nextOffset = line === this.offsets.length - 1
? this.string.length
: this.offsets[line + 1];
return nextOffset - offset;
};
return LinesAndColumns;
}());
exports.LinesAndColumns = LinesAndColumns;
exports["default"] = LinesAndColumns;
@@ -0,0 +1 @@
{"version":3,"file":"Transitioner.cjs","names":[],"sources":["../../src/Transitioner.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { batch, useStore } from '@tanstack/react-store'\nimport {\n getLocationChangeInfo,\n handleHashScroll,\n trimPathRight,\n} from '@tanstack/router-core'\nimport { useLayoutEffect, usePrevious } from './utils'\nimport { useRouter } from './useRouter'\n\nexport function Transitioner() {\n const router = useRouter()\n const mountLoadForRouter = React.useRef({ router, mounted: false })\n\n const [isTransitioning, setIsTransitioning] = React.useState(false)\n // Track pending state changes\n const isLoading = useStore(router.stores.isLoading, (value) => value)\n const hasPending = useStore(router.stores.hasPending, (value) => value)\n\n const previousIsLoading = usePrevious(isLoading)\n\n const isAnyPending = isLoading || isTransitioning || hasPending\n const previousIsAnyPending = usePrevious(isAnyPending)\n\n const isPagePending = isLoading || hasPending\n const previousIsPagePending = usePrevious(isPagePending)\n\n router.startTransition = (fn: () => void) => {\n setIsTransitioning(true)\n React.startTransition(() => {\n fn()\n setIsTransitioning(false)\n })\n }\n\n // Subscribe to location changes\n // and try to load the new location\n React.useEffect(() => {\n const unsub = router.history.subscribe(router.load)\n\n const nextLocation = router.buildLocation({\n to: router.latestLocation.pathname,\n search: true,\n params: true,\n hash: true,\n state: true,\n _includeValidateSearch: true,\n })\n\n // Check if the current URL matches the canonical form.\n // Compare publicHref (browser-facing URL) for consistency with\n // the server-side redirect check in router.beforeLoad.\n if (\n trimPathRight(router.latestLocation.publicHref) !==\n trimPathRight(nextLocation.publicHref)\n ) {\n router.commitLocation({ ...nextLocation, replace: true })\n }\n\n return () => {\n unsub()\n }\n }, [router, router.history])\n\n // Try to load the initial location\n useLayoutEffect(() => {\n if (\n // if we are hydrating from SSR, loading is triggered in ssr-client\n (typeof window !== 'undefined' && router.ssr) ||\n (mountLoadForRouter.current.router === router &&\n mountLoadForRouter.current.mounted)\n ) {\n return\n }\n mountLoadForRouter.current = { router, mounted: true }\n\n const tryLoad = async () => {\n try {\n await router.load()\n } catch (err) {\n console.error(err)\n }\n }\n\n tryLoad()\n }, [router])\n\n useLayoutEffect(() => {\n // The router was loading and now it's not\n if (previousIsLoading && !isLoading) {\n router.emit({\n type: 'onLoad', // When the new URL has committed, when the new matches have been loaded into state.matches\n ...getLocationChangeInfo(\n router.stores.location.get(),\n router.stores.resolvedLocation.get(),\n ),\n })\n }\n }, [previousIsLoading, router, isLoading])\n\n useLayoutEffect(() => {\n // emit onBeforeRouteMount\n if (previousIsPagePending && !isPagePending) {\n router.emit({\n type: 'onBeforeRouteMount',\n ...getLocationChangeInfo(\n router.stores.location.get(),\n router.stores.resolvedLocation.get(),\n ),\n })\n }\n }, [isPagePending, previousIsPagePending, router])\n\n useLayoutEffect(() => {\n if (previousIsAnyPending && !isAnyPending) {\n const changeInfo = getLocationChangeInfo(\n router.stores.location.get(),\n router.stores.resolvedLocation.get(),\n )\n router.emit({\n type: 'onResolved',\n ...changeInfo,\n })\n\n batch(() => {\n router.stores.status.set('idle')\n router.stores.resolvedLocation.set(router.stores.location.get())\n })\n\n if (changeInfo.hrefChanged) {\n handleHashScroll(router)\n }\n }\n }, [isAnyPending, previousIsAnyPending, router])\n\n return null\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,eAAe;CAC7B,MAAM,SAAS,kBAAA,WAAW;CAC1B,MAAM,qBAAqB,MAAM,OAAO;EAAE;EAAQ,SAAS;EAAO,CAAC;CAEnE,MAAM,CAAC,iBAAiB,sBAAsB,MAAM,SAAS,MAAM;CAEnE,MAAM,aAAA,GAAA,sBAAA,UAAqB,OAAO,OAAO,YAAY,UAAU,MAAM;CACrE,MAAM,cAAA,GAAA,sBAAA,UAAsB,OAAO,OAAO,aAAa,UAAU,MAAM;CAEvE,MAAM,oBAAoB,cAAA,YAAY,UAAU;CAEhD,MAAM,eAAe,aAAa,mBAAmB;CACrD,MAAM,uBAAuB,cAAA,YAAY,aAAa;CAEtD,MAAM,gBAAgB,aAAa;CACnC,MAAM,wBAAwB,cAAA,YAAY,cAAc;AAExD,QAAO,mBAAmB,OAAmB;AAC3C,qBAAmB,KAAK;AACxB,QAAM,sBAAsB;AAC1B,OAAI;AACJ,sBAAmB,MAAM;IACzB;;AAKJ,OAAM,gBAAgB;EACpB,MAAM,QAAQ,OAAO,QAAQ,UAAU,OAAO,KAAK;EAEnD,MAAM,eAAe,OAAO,cAAc;GACxC,IAAI,OAAO,eAAe;GAC1B,QAAQ;GACR,QAAQ;GACR,MAAM;GACN,OAAO;GACP,wBAAwB;GACzB,CAAC;AAKF,OAAA,GAAA,sBAAA,eACgB,OAAO,eAAe,WAAW,MAAA,GAAA,sBAAA,eACjC,aAAa,WAAW,CAEtC,QAAO,eAAe;GAAE,GAAG;GAAc,SAAS;GAAM,CAAC;AAG3D,eAAa;AACX,UAAO;;IAERLine truncated
@@ -0,0 +1,63 @@
import crypto from 'crypto'
import { urlAlphabet } from './url-alphabet/index.js'
const POOL_SIZE_MULTIPLIER = 128
let pool, poolOffset
let fillPool = bytes => {
if (bytes < 0) throw new RangeError('Wrong ID size')
try {
if (!pool || pool.length < bytes) {
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
crypto.randomFillSync(pool)
poolOffset = 0
} else if (poolOffset + bytes > pool.length) {
crypto.randomFillSync(pool)
poolOffset = 0
}
} catch (e) {
pool = undefined
throw e
}
poolOffset += bytes
}
let random = bytes => {
fillPool((bytes |= 0))
return pool.subarray(poolOffset - bytes, poolOffset)
}
let customRandom = (alphabet, defaultSize, getRandom) => {
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
return (size = defaultSize) => {
if (size <= 0) return ''
let id = ''
while (true) {
let bytes = getRandom(step)
let i = step
while (i--) {
id += alphabet[bytes[i] & mask] || ''
if (id.length === size) return id
}
}
}
}
let customAlphabet = (alphabet, size = 21) =>
customRandom(alphabet, size, random)
let nanoid = (size = 21) => {
fillPool((size |= 0))
let id = ''
for (let i = poolOffset - size; i < poolOffset; i++) {
id += urlAlphabet[pool[i] & 63]
}
return id
}
export { nanoid, customAlphabet, customRandom, urlAlphabet, random }
@@ -0,0 +1,86 @@
/**
* @fileoverview Rule to flag the generator functions that does not have yield.
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Require generator functions to contain `yield`",
recommended: true,
url: "https://eslint.org/docs/latest/rules/require-yield",
},
schema: [],
messages: {
missingYield: "This generator function does not have 'yield'.",
},
},
create(context) {
const stack = [];
const sourceCode = context.sourceCode;
/**
* If the node is a generator function, start counting `yield` keywords.
* @param {Node} node A function node to check.
* @returns {void}
*/
function beginChecking(node) {
if (node.generator) {
stack.push(0);
}
}
/**
* If the node is a generator function, end counting `yield` keywords, then
* reports result.
* @param {Node} node A function node to check.
* @returns {void}
*/
function endChecking(node) {
if (!node.generator) {
return;
}
const countYield = stack.pop();
if (countYield === 0 && node.body.body.length > 0) {
context.report({
loc: astUtils.getFunctionHeadLoc(node, sourceCode),
messageId: "missingYield",
});
}
}
return {
FunctionDeclaration: beginChecking,
"FunctionDeclaration:exit": endChecking,
FunctionExpression: beginChecking,
"FunctionExpression:exit": endChecking,
// Increases the count of `yield` keyword.
YieldExpression() {
if (stack.length > 0) {
stack[stack.length - 1] += 1;
}
},
};
},
};
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,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 './contact-round.js';
//# sourceMappingURL=contact-2.js.map
@@ -0,0 +1,75 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("./Resolver")} Resolver */
/** @typedef {import("./Resolver").ResolveRequest} ResolveRequest */
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
const namespaceStartCharCode = "@".charCodeAt(0);
module.exports = class JoinRequestPartPlugin {
/**
* @param {string | ResolveStepHook} source source
* @param {string | ResolveStepHook} target target
*/
constructor(source, target) {
this.source = source;
this.target = target;
}
/**
* @param {Resolver} resolver the resolver
* @returns {void}
*/
apply(resolver) {
const target = resolver.ensureHook(this.target);
resolver
.getHook(this.source)
.tapAsync(
"JoinRequestPartPlugin",
(request, resolveContext, callback) => {
const req = request.request || "";
let i = req.indexOf("/", 3);
if (i >= 0 && req.charCodeAt(2) === namespaceStartCharCode) {
i = req.indexOf("/", i + 1);
}
/** @type {string} */
let moduleName;
/** @type {string} */
let remainingRequest;
/** @type {boolean} */
let fullySpecified;
if (i < 0) {
moduleName = req;
remainingRequest = ".";
fullySpecified = false;
} else {
moduleName = req.slice(0, i);
remainingRequest = `.${req.slice(i)}`;
fullySpecified = /** @type {boolean} */ (request.fullySpecified);
}
/** @type {ResolveRequest} */
const obj = {
...request,
path: resolver.join(
/** @type {string} */
(request.path),
moduleName,
),
relativePath:
request.relativePath &&
resolver.join(request.relativePath, moduleName),
request: remainingRequest,
fullySpecified,
};
resolver.doResolve(target, obj, null, resolveContext, callback);
},
);
}
};
@@ -0,0 +1,76 @@
"use strict";
// Adapted from https://github.com/mathiasbynens/he/blob/36afe179392226cf1b6ccdb16ebbb7a5a844d93a/src/he.js#L106-L134
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceCodePoint = exports.fromCodePoint = void 0;
var decodeMap = new Map([
[0, 65533],
// C1 Unicode control character reference replacements
[128, 8364],
[130, 8218],
[131, 402],
[132, 8222],
[133, 8230],
[134, 8224],
[135, 8225],
[136, 710],
[137, 8240],
[138, 352],
[139, 8249],
[140, 338],
[142, 381],
[145, 8216],
[146, 8217],
[147, 8220],
[148, 8221],
[149, 8226],
[150, 8211],
[151, 8212],
[152, 732],
[153, 8482],
[154, 353],
[155, 8250],
[156, 339],
[158, 382],
[159, 376],
]);
/**
* Polyfill for `String.fromCodePoint`. It is used to create a string from a Unicode code point.
*/
exports.fromCodePoint =
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
(_a = String.fromCodePoint) !== null && _a !== void 0 ? _a : function (codePoint) {
var output = "";
if (codePoint > 0xffff) {
codePoint -= 0x10000;
output += String.fromCharCode(((codePoint >>> 10) & 0x3ff) | 0xd800);
codePoint = 0xdc00 | (codePoint & 0x3ff);
}
output += String.fromCharCode(codePoint);
return output;
};
/**
* Replace the given code point with a replacement character if it is a
* surrogate or is outside the valid range. Otherwise return the code
* point unchanged.
*/
function replaceCodePoint(codePoint) {
var _a;
if ((codePoint >= 0xd800 && codePoint <= 0xdfff) || codePoint > 0x10ffff) {
return 0xfffd;
}
return (_a = decodeMap.get(codePoint)) !== null && _a !== void 0 ? _a : codePoint;
}
exports.replaceCodePoint = replaceCodePoint;
/**
* Replace the code point if relevant, then convert it to a string.
*
* @deprecated Use `fromCodePoint(replaceCodePoint(codePoint))` instead.
* @param codePoint The code point to decode.
* @returns The decoded code point.
*/
function decodeCodePoint(codePoint) {
return (0, exports.fromCodePoint)(replaceCodePoint(codePoint));
}
exports.default = decodeCodePoint;
//# sourceMappingURL=decode_codepoint.js.map
@@ -0,0 +1,81 @@
/**
* @fileoverview Types for the plugin-kit package.
* @author Nicholas C. Zakas
*/
//------------------------------------------------------------------------------
// Imports
//------------------------------------------------------------------------------
import type {
RuleDefinition,
RuleDefinitionTypeOptions,
RuleVisitor,
} from "@eslint/core";
//------------------------------------------------------------------------------
// Exports
//------------------------------------------------------------------------------
/**
* Defaults for non-language-related `RuleDefinition` options.
*/
export interface CustomRuleTypeDefinitions {
RuleOptions: unknown[];
MessageIds: string;
ExtRuleDocs: Record<string, unknown>;
}
/**
* A helper type to define language specific specializations of the `RuleDefinition` type.
*
* @example
* ```ts
* type YourRuleDefinition<
* Options extends Partial<CustomRuleTypeDefinitions> = {},
* > = CustomRuleDefinitionType<
* {
* LangOptions: YourLanguageOptions;
* Code: YourSourceCode;
* Visitor: YourRuleVisitor;
* Node: YourNode;
* },
* Options
* >;
* ```
*/
export type CustomRuleDefinitionType<
LanguageSpecificOptions extends Omit<
RuleDefinitionTypeOptions,
keyof CustomRuleTypeDefinitions
>,
Options extends Partial<CustomRuleTypeDefinitions>,
> = RuleDefinition<
// Language specific type options (non-configurable)
LanguageSpecificOptions &
Required<
// Rule specific type options (custom)
Options &
// Rule specific type options (defaults)
Omit<CustomRuleTypeDefinitions, keyof Options>
>
>;
/**
* Adds matching `:exit` selector properties for each key of a `RuleVisitor`.
*/
export type CustomRuleVisitorWithExit<RuleVisitorType extends RuleVisitor> = {
[Key in keyof RuleVisitorType as
| Key
| `${Key & string}:exit`]: RuleVisitorType[Key];
};
/**
* A map of names to string values, or `null` when no value is provided.
*/
export type StringConfig = Record<string, string | null>;
/**
* A map of names to boolean flags.
*/
export type BooleanConfig = Record<string, boolean>;
@@ -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.es2020_full = void 0;
const dom_1 = require("./dom");
const dom_asynciterable_1 = require("./dom.asynciterable");
const dom_iterable_1 = require("./dom.iterable");
const es2020_1 = require("./es2020");
const scripthost_1 = require("./scripthost");
const webworker_importscripts_1 = require("./webworker.importscripts");
exports.es2020_full = {
libs: [
es2020_1.es2020,
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,50 @@
const React = require('react');
function ToggleOption({ children, filter, activeFilters, setFilters }) {
return (
<button
className={
'toggle__option ' + (activeFilters[filter] ? 'is-toggled' : '')
}
onClick={() =>
setFilters({
...activeFilters,
[filter]: !activeFilters[filter]
})
}
>
{children}
</button>
);
}
module.exports = function FilterToggle({ activeFilters, setFilters }) {
return (
<div className="toggle">
<div className="toggle__label">Filter:</div>
<div className="toggle__options">
<ToggleOption
filter="low"
activeFilters={activeFilters}
setFilters={setFilters}
>
Low
</ToggleOption>
<ToggleOption
filter="medium"
activeFilters={activeFilters}
setFilters={setFilters}
>
Medium
</ToggleOption>
<ToggleOption
filter="high"
activeFilters={activeFilters}
setFilters={setFilters}
>
High
</ToggleOption>
</div>
</div>
);
};