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,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 AlignVerticalJustifyCenter = createLucideIcon("AlignVerticalJustifyCenter", [
["rect", { width: "14", height: "6", x: "5", y: "16", rx: "2", key: "1i8z2d" }],
["rect", { width: "10", height: "6", x: "7", y: "2", rx: "2", key: "ypihtt" }],
["path", { d: "M2 12h20", key: "9i4pu4" }]
]);
export { AlignVerticalJustifyCenter as default };
//# sourceMappingURL=align-vertical-justify-center.js.map
@@ -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 GalleryVerticalEnd = createLucideIcon("GalleryVerticalEnd", [
["path", { d: "M7 2h10", key: "nczekb" }],
["path", { d: "M5 6h14", key: "u2x4p" }],
["rect", { width: "18", height: "12", x: "3", y: "10", rx: "2", key: "l0tzu3" }]
]);
export { GalleryVerticalEnd as default };
//# sourceMappingURL=gallery-vertical-end.js.map
@@ -0,0 +1,56 @@
# require-from-string [![Build Status](https://travis-ci.org/floatdrop/require-from-string.svg?branch=master)](https://travis-ci.org/floatdrop/require-from-string)
Load module from string in Node.
## Install
```
$ npm install --save require-from-string
```
## Usage
```js
var requireFromString = require('require-from-string');
requireFromString('module.exports = 1');
//=> 1
```
## API
### requireFromString(code, [filename], [options])
#### code
*Required*
Type: `string`
Module code.
#### filename
Type: `string`
Default: `''`
Optional filename.
#### options
Type: `object`
##### appendPaths
Type: `Array`
List of `paths`, that will be appended to module `paths`. Useful, when you want
to be able require modules from these paths.
##### prependPaths
Type: `Array`
Same as `appendPaths`, but paths will be prepended.
## License
MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_A","2":"_Z"},B:{"1":"_J"},C:{"1":"_wP _XC","2":"_2C","36":"_zN"},D:{"1":"_lO","2":"_KC","36":"_jH _cC"},E:{"1":"_dB","2":"_u"},F:{"1":"_yF","2":"_VE"},G:{"1":"_8C","2":"_1"},H:{"2":"1D"},I:{"1":"I","2":"_n","36":"_nJ"},J:{"1":"A","2":"D"},K:{"1":"_ZB","2":"_cB"},L:{"1":"I"},M:{"1":"YC"},N:{"1":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:5,C:"Blob constructing",D:true};
@@ -0,0 +1,4 @@
//#region src/utils/response.d.ts
declare const RESPONSE_ALREADY_SENT: Response;
//#endregion
export { RESPONSE_ALREADY_SENT };
@@ -0,0 +1,144 @@
import {LegacyException} from './exception';
import {LegacyOptions} from './options';
/**
* The object returned by {@link render} and {@link renderSync} after a
* successful compilation.
*
* @category Legacy
* @deprecated This is only used by the legacy {@link render} and {@link
* renderSync} APIs. Use {@link compile}, {@link compileString}, {@link
* compileAsync}, and {@link compileStringAsync} instead.
*/
export interface LegacyResult {
/**
* The compiled CSS. This can be converted to a string by calling
* [Buffer.toString](https://nodejs.org/api/buffer.html#buffer_buf_tostring_encoding_start_end).
*
* @example
*
* ```js
* const result = sass.renderSync({file: "style.scss"});
*
* console.log(result.css.toString());
* ```
*/
css: Buffer;
/**
* The source map that maps the compiled CSS to the source files from which it
* was generated. This can be converted to a string by calling
* [Buffer.toString](https://nodejs.org/api/buffer.html#buffer_buf_tostring_encoding_start_end).
*
* This is `undefined` unless either
*
* * {@link LegacySharedOptions.sourceMap} is a string; or
* * {@link LegacySharedOptions.sourceMap} is `true` and
* {@link LegacySharedOptions.outFile} is set.
*
* The source map uses absolute [`file:`
* URLs](https://en.wikipedia.org/wiki/File_URI_scheme) to link to the Sass
* source files, except if the source file comes from {@link
* LegacyStringOptions.data} in which case it lists its URL as `"stdin"`.
*
* @example
*
* ```js
* const result = sass.renderSync({
* file: "style.scss",
* sourceMap: true,
* outFile: "style.css"
* })
*
* console.log(result.map.toString());
* ```
*/
map?: Buffer;
/** Additional information about the compilation. */
stats: {
/**
* The absolute path of {@link LegacyFileOptions.file} or {@link
* LegacyStringOptions.file}, or `"data"` if {@link
* LegacyStringOptions.file} wasn't set.
*/
entry: string;
/**
* The number of milliseconds between 1 January 1970 at 00:00:00 UTC and the
* time at which Sass compilation began.
*/
start: number;
/**
* The number of milliseconds between 1 January 1970 at 00:00:00 UTC and the
* time at which Sass compilation ended.
*/
end: number;
/**
* The number of milliseconds it took to compile the Sass file. This is
* always equal to `start` minus `end`.
*/
duration: number;
/**
* An array of the absolute paths of all Sass files loaded during
* compilation. If a stylesheet was loaded from a {@link LegacyImporter}
* that returned the stylesheet’s contents, the raw string of the `@use` or
* `@import` that loaded that stylesheet included in this array.
*/
includedFiles: string[];
};
}
/**
* This function synchronously compiles a Sass file to CSS. If it succeeds, it
* returns the result, and if it fails it throws an error.
*
* **Heads up!** When using the `sass-embedded` npm package, **{@link render}
* is almost always faster than {@link renderSync}**, due to the overhead of
* emulating synchronous messaging with worker threads and concurrent
* compilations being blocked on main thread.
*
* @example
*
* ```js
* const sass = require('sass'); // or require('node-sass');
*
* const result = sass.renderSync({file: "style.scss"});
* // ...
* ```
*
* @category Legacy
* @deprecated Use {@link compile} or {@link compileString} instead.
*/
export function renderSync(options: LegacyOptions<'sync'>): LegacyResult;
/**
* This function asynchronously compiles a Sass file to CSS, and calls
* `callback` with a {@link LegacyResult} if compilation succeeds or {@link
* LegacyException} if it fails.
*
* **Heads up!** When using the `sass` npm package, **{@link renderSync} is
* almost twice as fast as {@link render}** by default, due to the overhead of
* making the entire evaluation process asynchronous.
*
* ```js
* const sass = require('sass'); // or require('node-sass');
*
* sass.render({
* file: "style.scss"
* }, function(err, result) {
* // ...
* });
* ```
*
* @category Legacy
* @deprecated Use {@link compileAsync} or {@link compileStringAsync} instead.
*/
export function render(
options: LegacyOptions<'async'>,
callback: (exception?: LegacyException, result?: LegacyResult) => void
): void;
@@ -0,0 +1,63 @@
{
"name": "@jridgewell/sourcemap-codec",
"version": "1.5.5",
"description": "Encode/decode sourcemap mappings",
"keywords": [
"sourcemap",
"vlq"
],
"main": "dist/sourcemap-codec.umd.js",
"module": "dist/sourcemap-codec.mjs",
"types": "types/sourcemap-codec.d.cts",
"files": [
"dist",
"src",
"types"
],
"exports": {
".": [
{
"import": {
"types": "./types/sourcemap-codec.d.mts",
"default": "./dist/sourcemap-codec.mjs"
},
"default": {
"types": "./types/sourcemap-codec.d.cts",
"default": "./dist/sourcemap-codec.umd.js"
}
},
"./dist/sourcemap-codec.umd.js"
],
"./package.json": "./package.json"
},
"scripts": {
"benchmark": "run-s build:code benchmark:*",
"benchmark:install": "cd benchmark && npm install",
"benchmark:only": "node --expose-gc benchmark/index.js",
"build": "run-s -n build:code build:types",
"build:code": "node ../../esbuild.mjs sourcemap-codec.ts",
"build:types": "run-s build:types:force build:types:emit build:types:mts",
"build:types:force": "rimraf tsconfig.build.tsbuildinfo",
"build:types:emit": "tsc --project tsconfig.build.json",
"build:types:mts": "node ../../mts-types.mjs",
"clean": "run-s -n clean:code clean:types",
"clean:code": "tsc --build --clean tsconfig.build.json",
"clean:types": "rimraf dist types",
"test": "run-s -n test:types test:only test:format",
"test:format": "prettier --check '{src,test}/**/*.ts'",
"test:only": "mocha",
"test:types": "eslint '{src,test}/**/*.ts'",
"lint": "run-s -n lint:types lint:format",
"lint:format": "npm run test:format -- --write",
"lint:types": "npm run test:types -- --fix",
"prepublishOnly": "npm run-s -n build test"
},
"homepage": "https://github.com/jridgewell/sourcemaps/tree/main/packages/sourcemap-codec",
"repository": {
"type": "git",
"url": "git+https://github.com/jridgewell/sourcemaps.git",
"directory": "packages/sourcemap-codec"
},
"author": "Justin Ridgewell <justin@ridgewell.name>",
"license": "MIT"
}
@@ -0,0 +1 @@
{"version":3,"file":"megaphone-off.js","sources":["../../../src/icons/megaphone-off.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name MegaphoneOff\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNOS4yNiA5LjI2IDMgMTF2M2wxNC4xNCAzLjE0IiAvPgogIDxwYXRoIGQ9Ik0yMSAxNS4zNFY2bC03LjMxIDIuMDMiIC8+CiAgPHBhdGggZD0iTTExLjYgMTYuOGEzIDMgMCAxIDEtNS44LTEuNiIgLz4KICA8bGluZSB4MT0iMiIgeDI9IjIyIiB5MT0iMiIgeTI9IjIyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/megaphone-off\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst MegaphoneOff = createLucideIcon('MegaphoneOff', [\n ['path', { d: 'M9.26 9.26 3 11v3l14.14 3.14', key: '3429n' }],\n ['path', { d: 'M21 15.34V6l-7.31 2.03', key: '4o1dh8' }],\n ['path', { d: 'M11.6 16.8a3 3 0 1 1-5.8-1.6', key: '1yl0tm' }],\n ['line', { x1: '2', x2: '22', y1: '2', y2: '22', key: 'a6p6uj' }],\n]);\n\nexport default MegaphoneOff;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,iBAAiB,cAAgB,CAAA,CAAA,CAAA;AAAA,CAAA,CACpD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,SAAS,CAAA,CAAA;AAAA,CAAA,CAC5D,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA0B,CAAA,CAAA,CAAA,CAAA,CAAA,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,CACvD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAgC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAC7D,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,CAAK,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAClE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,51 @@
/**
* gridstack-item.component.ts 12.6.0
* Copyright (c) 2025 Alain Dumesny - see GridStack root license
*/
import { GridStackNode, GridStackOptions, GridStackWidget } from "gridstack";
/**
* Extended GridStackWidget interface for Angular integration.
* Adds Angular-specific properties for dynamic component creation.
*/
export interface NgGridStackWidget extends GridStackWidget {
/** Angular component selector for dynamic creation (e.g., 'my-widget') */
selector?: string;
/** Serialized data for component @Input() properties */
input?: NgCompInputs;
/** Configuration for nested sub-grids */
subGridOpts?: NgGridStackOptions;
}
/**
* Extended GridStackNode interface for Angular integration.
* Adds component selector for dynamic content creation.
*/
export interface NgGridStackNode extends GridStackNode {
/** Angular component selector for this node's content */
selector?: string;
}
/**
* Extended GridStackOptions interface for Angular integration.
* Supports Angular-specific widget definitions and nested grids.
*/
export interface NgGridStackOptions extends GridStackOptions {
/** Array of Angular widget definitions for initial grid setup */
children?: NgGridStackWidget[];
/** Configuration for nested sub-grids (Angular-aware) */
subGridOpts?: NgGridStackOptions;
}
/**
* Type for component input data serialization.
* Maps @Input() property names to their values for widget persistence.
*
* @example
* ```typescript
* const inputs: NgCompInputs = {
* title: 'My Widget',
* value: 42,
* config: { enabled: true }
* };
* ```
*/
export declare type NgCompInputs = {
[key: string]: any;
};
@@ -0,0 +1,4 @@
import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment.cts';
export = function maybeSort(mappings: SourceMapSegment[][], owned: boolean): SourceMapSegment[][];
export declare function sortComparator<T extends SourceMapSegment | ReverseSegment>(a: T, b: T): number;
//# sourceMappingURL=sort.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"stdio.d.cts","names":[],"sources":["../src/client/stdio.ts"],"sourcesContent":[],"mappings":";;;;;KASY,qBAAA;;AAAZ;;EAuBa,OAAA,EAAA,MAAA;EAAS;;AAqBtB;EA4BgB,IAAA,CAAA,EAAA,MAAA,EAAA;EAyBH;;;;;EAsFK,GAAA,CAAA,EAvKR,MAuKQ,CAAA,MAAA,EAAA,MAAA,CAAA;EAuFC;;;;;WAvPN,SAAS;;;;;;;;;;;;;;;;;;cAqBT;;;;iBA4BG,qBAAA,CAAA,GAAyB;;;;;;cAyB5B,oBAAA,YAAgC;;;;;;oBAOvB;wBACI;sBAEF;;;;WAWL;;;;;;;;gBAiED;;;;;;;;;;;;;;;;;WAuFC;gBAyCD,iBAAiB"}
@@ -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 PanelBottom = createLucideIcon("PanelBottom", [
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
["path", { d: "M3 15h18", key: "5xshup" }]
]);
export { PanelBottom as default };
//# sourceMappingURL=panel-bottom.js.map
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("../../compile/util");
const code_1 = require("../code");
const codegen_1 = require("../../compile/codegen");
const metadata_1 = require("./metadata");
const nullable_1 = require("./nullable");
const error_1 = require("./error");
const def = {
keyword: "elements",
schemaType: "object",
error: (0, error_1.typeError)("array"),
code(cxt) {
(0, metadata_1.checkMetadata)(cxt);
const { gen, data, schema, it } = cxt;
if ((0, util_1.alwaysValidSchema)(it, schema))
return;
const [valid] = (0, nullable_1.checkNullable)(cxt);
gen.if((0, codegen_1.not)(valid), () => gen.if((0, codegen_1._) `Array.isArray(${data})`, () => gen.assign(valid, (0, code_1.validateArray)(cxt)), () => cxt.error()));
cxt.ok(valid);
},
};
exports.default = def;
//# sourceMappingURL=elements.js.map
@@ -0,0 +1,20 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const ScanSearch = createLucideIcon("ScanSearch", [
["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" }],
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }],
["path", { d: "m16 16-1.9-1.9", key: "1dq9hf" }]
]);
export { ScanSearch as default };
//# sourceMappingURL=scan-search.js.map
@@ -0,0 +1,983 @@
/**
* SHA3 (keccak) addons.
*
* * cSHAKE, KMAC, TupleHash, ParallelHash + XOF variants from
* {@link https://csrc.nist.gov/pubs/sp/800/185/final | NIST SP 800-185}
* * KangarooTwelve 🦘 and TurboSHAKE - reduced-round keccak from
* {@link https://datatracker.ietf.org/doc/rfc9861/ | RFC 9861}
* * KeccakPRG: Pseudo-random generator based on Keccak
* ({@link https://keccak.team/files/CSF-0.1.pdf | pdf})
* @module
*/
import { Keccak, type ShakeOpts } from './sha3.ts';
import {
abytes,
aexists,
anumber,
type CHash,
type CHashXOF,
clean,
copyBytes,
createHasher,
type Hash,
type HashXOF,
type KDFInput,
kdfInputToBytes,
type PRG,
type TArg,
type TRet,
u32,
} from './utils.ts';
// cSHAKE && KMAC (NIST SP800-185)
const _8n = /* @__PURE__ */ BigInt(8);
const _ffn = /* @__PURE__ */ BigInt(0xff);
// It is safe to use bigints here, since they used only for length encoding (not actual data).
// We use bigints in sha256 for lengths too.
// Callers are still expected to supply SP 800-185-valid lengths
// (`0 <= x < 2^2040`); this helper does not enforce that bound.
function leftEncode(n: number | bigint): TRet<Uint8Array> {
n = BigInt(n);
const res = [Number(n & _ffn)];
n >>= _8n;
for (; n > 0; n >>= _8n) res.unshift(Number(n & _ffn));
res.unshift(res.length);
return new Uint8Array(res) as TRet<Uint8Array>;
}
// Same caller contract as `leftEncode(...)`: lengths must already satisfy SP 800-185 §2.3.1.
function rightEncode(n: number | bigint): TRet<Uint8Array> {
n = BigInt(n);
const res = [Number(n & _ffn)];
n >>= _8n;
for (; n > 0; n >>= _8n) res.unshift(Number(n & _ffn));
res.push(res.length);
return new Uint8Array(res) as TRet<Uint8Array>;
}
// `dkLen` validation is deferred to the downstream Keccak constructor.
function chooseLen(opts: ShakeOpts, outputLen: number): number {
return opts.dkLen === undefined ? outputLen : opts.dkLen;
}
const abytesOrZero = (buf?: TArg<Uint8Array>, title = '') => {
if (buf === undefined) return EMPTY_BUFFER;
abytes(buf, undefined, title);
return buf;
};
// NOTE: second modulo is necessary since we don't need to add padding if the
// current element takes a whole block.
// Callers only pass the fixed positive Keccak rates here (`168` or `136`);
// `block <= 0` is not validated locally.
const getPadding = (len: number, block: number) => new Uint8Array((block - (len % block)) % block);
/** Options for cSHAKE and related SP 800-185 functions. */
export type cShakeOpts = ShakeOpts & {
/** Optional personalization string mixed into domain separation. */
personalization?: Uint8Array;
/**
* Optional NIST function-name string used for domain separation.
* SP 800-185 reserves this for standardized function names; applications
* should generally stick to `personalization`.
*/
NISTfn?: KDFInput;
};
// Personalization
function cshakePers(hash: TArg<Keccak>, opts: TArg<cShakeOpts> = {}): TRet<Keccak> {
const h = hash as unknown as Keccak;
if (!opts || (opts.personalization === undefined && opts.NISTfn === undefined))
return h as TRet<Keccak>;
// Encode and pad inplace to avoid unneccesary memory copies/slices so we
// don't need to zero them later.
// bytepad(encode_string(N) || encode_string(S), rate), where `rate` is the
// current cSHAKE/KMAC/TupleHash/ParallelHash block length.
const blockLenBytes = leftEncode(h.blockLen);
const fn = opts.NISTfn === undefined ? EMPTY_BUFFER : kdfInputToBytes(opts.NISTfn);
const fnLen = leftEncode(_8n * BigInt(fn.length)); // length in bits
const pers = abytesOrZero(opts.personalization, 'personalization');
const persLen = leftEncode(_8n * BigInt(pers.length)); // length in bits
if (!fn.length && !pers.length) return h as TRet<Keccak>;
// SP 800-185 cSHAKE appends `00` instead of SHAKE's `1111`; in this Keccak implementation
// that changes the delimited suffix byte from `0x1f` to `0x04` once N or S is non-empty.
h.suffix = 0x04;
h.update(blockLenBytes).update(fnLen).update(fn).update(persLen).update(pers);
let totalLen = blockLenBytes.length + fnLen.length + fn.length + persLen.length + pers.length;
h.update(getPadding(totalLen, h.blockLen));
return h as TRet<Keccak>;
}
const gencShake = (
suffix: number,
blockLen: number,
outputLen: number
): TRet<CHashXOF<Keccak, cShakeOpts>> =>
createHasher<Keccak, cShakeOpts>(
(opts: TArg<cShakeOpts> = {}) =>
cshakePers(
new Keccak(blockLen, suffix, chooseLen(opts, outputLen), true) as unknown as TArg<Keccak>,
opts
) as Keccak
);
/** TupleHash callable interface. */
export type ITupleHash = {
/**
* Hashes an ordered tuple of byte arrays.
* @param messages - Ordered byte-array tuple to hash.
* @param opts - TupleHash output and personalization options. See {@link cShakeOpts}.
* @returns Digest bytes.
*/
(messages: TArg<Uint8Array[]>, opts?: TArg<cShakeOpts>): TRet<Uint8Array>;
/**
* Creates an incremental TupleHash state.
* @param opts - TupleHash output and personalization options. See {@link cShakeOpts}.
* @returns Stateful TupleHash instance.
*/
create(opts?: cShakeOpts): _TupleHash;
};
/**
* 128-bit NIST cSHAKE XOF.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and NIST function-name
* settings. When both `NISTfn` and `personalization` are empty,
* SP 800-185 defines this as plain SHAKE128. Defaults to 16 output bytes
* when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with cSHAKE128.
* ```ts
* cshake128(new Uint8Array([1, 2, 3]), { dkLen: 32 });
* ```
*/
export const cshake128: TRet<CHashXOF<Keccak, cShakeOpts>> = /* @__PURE__ */ gencShake(
0x1f,
168,
16
);
/**
* 256-bit NIST cSHAKE XOF.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and NIST function-name
* settings. When both `NISTfn` and `personalization` are empty,
* SP 800-185 defines this as plain SHAKE256. Defaults to 32 output bytes
* when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with cSHAKE256.
* ```ts
* cshake256(new Uint8Array([1, 2, 3]), { dkLen: 64 });
* ```
*/
export const cshake256: TRet<CHashXOF<Keccak, cShakeOpts>> = /* @__PURE__ */ gencShake(
0x1f,
136,
32
);
/**
* Internal KMAC class.
* SP 800-185 §8.4.1 still recommends keys at least as long as the target
* security strength.
*/
export class _KMAC extends Keccak implements HashXOF<_KMAC> {
constructor(
blockLen: number,
outputLen: number,
enableXOF: boolean,
key: TArg<Uint8Array>,
opts: TArg<cShakeOpts> = {}
) {
super(blockLen, 0x1f, outputLen, enableXOF);
// Preload T = bytepad(encode_string("KMAC") || encode_string(S), rate); later updates append
// newX = bytepad(encode_string(K), rate) || X and `finish()` appends right_encode(L or 0).
cshakePers(this as unknown as TArg<Keccak>, {
NISTfn: 'KMAC',
personalization: opts.personalization,
});
abytes(key, undefined, 'key');
// 1. newX = bytepad(encode_string(K), rate) || X || right_encode(L),
// with `rate = this.blockLen`.
const blockLenBytes = leftEncode(this.blockLen);
const keyLen = leftEncode(_8n * BigInt(key.length));
this.update(blockLenBytes).update(keyLen).update(key);
const totalLen = blockLenBytes.length + keyLen.length + key.length;
this.update(getPadding(totalLen, this.blockLen));
}
protected finish(): void {
// SP 800-185 uses right_encode(L) for fixed-length KMAC and right_encode(0) for KMACXOF.
// outputLen in bits
if (!this.finished) this.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen)));
super.finish();
}
_cloneInto(to?: _KMAC): _KMAC {
// Create new instance without calling constructor since the key
// is already in state and we don't know it.
// Force "to" to be instance of KMAC instead of Sha3.
if (!to) {
to = Object.create(Object.getPrototypeOf(this), {}) as _KMAC;
to.state = this.state.slice();
to.blockLen = this.blockLen;
to.state32 = u32(to.state);
}
return super._cloneInto(to) as _KMAC;
}
clone(): _KMAC {
return this._cloneInto();
}
}
function genKmac(blockLen: number, outputLen: number, xof = false): TRet<IKMAC> {
// One-shot XOF wrappers still finalize via `.digest()` because `_KMAC`
// already bakes the requested output length into the state.
const kmac = (
key: TArg<Uint8Array>,
message: TArg<Uint8Array>,
opts?: TArg<cShakeOpts>
): TRet<Uint8Array> => kmac.create(key, opts).update(message).digest();
kmac.create = (key: TArg<Uint8Array>, opts: TArg<cShakeOpts> = {}) =>
new _KMAC(blockLen, chooseLen(opts, outputLen), xof, key, opts);
return kmac as TRet<IKMAC>;
}
/** KMAC callable interface. */
export type IKMAC = {
/**
* Computes a keyed KMAC digest for one message.
* @param key - Secret key bytes.
* @param message - Message bytes to authenticate.
* @param opts - KMAC output and personalization options. See {@link KangarooOpts}.
* @returns Authentication tag bytes.
*/
(key: TArg<Uint8Array>, message: TArg<Uint8Array>, opts?: TArg<KangarooOpts>): TRet<Uint8Array>;
/**
* Creates an incremental KMAC state.
* @param key - Secret key bytes.
* @param opts - KMAC output and personalization options. See {@link cShakeOpts}.
* @returns Stateful KMAC instance.
*/
create(key: TArg<Uint8Array>, opts?: TArg<cShakeOpts>): _KMAC;
};
/**
* 128-bit Keccak MAC.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param opts - Optional output and personalization settings. Defaults to
* 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Authentication tag bytes.
* @example
* Authenticate a message with KMAC128.
* ```ts
* kmac128(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]));
* ```
*/
export const kmac128: TRet<IKMAC> = /* @__PURE__ */ genKmac(168, 16);
/**
* 256-bit Keccak MAC.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param opts - Optional output and personalization settings. Defaults to
* 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Authentication tag bytes.
* @example
* Authenticate a message with KMAC256.
* ```ts
* kmac256(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]));
* ```
*/
export const kmac256: TRet<IKMAC> = /* @__PURE__ */ genKmac(136, 32);
/**
* 128-bit Keccak-MAC XOF.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param opts - Optional output and personalization settings. Defaults to
* 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Authentication tag bytes.
* @example
* Authenticate a message with KMAC128 XOF output.
* ```ts
* kmac128xof(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]), { dkLen: 32 });
* ```
*/
export const kmac128xof: TRet<IKMAC> = /* @__PURE__ */ genKmac(168, 16, true);
/**
* 256-bit Keccak-MAC XOF.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param opts - Optional output and personalization settings. Defaults to
* 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Authentication tag bytes.
* @example
* Authenticate a message with KMAC256 XOF output.
* ```ts
* kmac256xof(new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6]), { dkLen: 64 });
* ```
*/
export const kmac256xof: TRet<IKMAC> = /* @__PURE__ */ genKmac(136, 32, true);
/**
* Internal TupleHash class for byte-array tuple elements.
* This implementation relies on SP 800-185's byte-oriented encoding form
* rather than arbitrary bit strings.
*/
export class _TupleHash extends Keccak implements HashXOF<_TupleHash> {
constructor(
blockLen: number,
outputLen: number,
enableXOF: boolean,
opts: TArg<cShakeOpts> = {}
) {
super(blockLen, 0x1f, outputLen, enableXOF);
cshakePers(this as unknown as TArg<Keccak>, {
NISTfn: 'TupleHash',
personalization: opts.personalization,
});
// Change update after cshake processed
this.update = (data: TArg<Uint8Array>) => {
abytes(data);
// SP 800-185 encodes each tuple element as
// encode_string(X[i]) = left_encode(len(X[i])) || X[i].
super.update(leftEncode(_8n * BigInt(data.length)));
super.update(data);
return this;
};
}
protected finish(): void {
// SP 800-185 uses right_encode(L) for fixed-length TupleHash
// and right_encode(0) for TupleHashXOF.
if (!this.finished)
// outputLen in bits
super.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen)));
super.finish();
}
_cloneInto(to?: _TupleHash): _TupleHash {
to ||= new _TupleHash(this.blockLen, this.outputLen, this.enableXOF);
return super._cloneInto(to) as _TupleHash;
}
clone(): _TupleHash {
return this._cloneInto();
}
}
function genTuple(blockLen: number, outputLen: number, xof = false): TRet<ITupleHash> {
// One-shot XOF wrappers still use `.digest()` because `_TupleHash` stores
// the requested output length in the state itself.
const tuple = (messages: TArg<Uint8Array[]>, opts?: TArg<cShakeOpts>): TRet<Uint8Array> => {
const h = tuple.create(opts);
if (!Array.isArray(messages)) throw new Error('expected array of messages');
for (const msg of messages) h.update(msg);
return h.digest();
};
tuple.create = (opts: TArg<cShakeOpts> = {}) =>
new _TupleHash(blockLen, chooseLen(opts, outputLen), xof, opts);
return tuple as TRet<ITupleHash>;
}
/**
* 128-bit TupleHASH. `tuple(['ab', 'cd']) != tuple(['a', 'bcd'])`.
* @param messages - ordered byte-array tuple
* @param opts - Optional output and personalization settings. Defaults to
* 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a tuple of byte arrays with TupleHash128.
* ```ts
* tuplehash128([new Uint8Array([1]), new Uint8Array([2])]);
* ```
*/
export const tuplehash128: TRet<ITupleHash> = /* @__PURE__ */ genTuple(168, 16);
/**
* 256-bit TupleHASH. `tuple(['ab', 'cd']) != tuple(['a', 'bcd'])`.
* @param messages - ordered byte-array tuple
* @param opts - Optional output and personalization settings. Defaults to
* 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a tuple of byte arrays with TupleHash256.
* ```ts
* tuplehash256([new Uint8Array([1]), new Uint8Array([2])]);
* ```
*/
export const tuplehash256: TRet<ITupleHash> = /* @__PURE__ */ genTuple(136, 32);
/**
* 128-bit TupleHASH XOF.
* @param messages - ordered byte-array tuple
* @param opts - Optional output and personalization settings. Defaults to
* 16 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a tuple of byte arrays with TupleHash128 XOF output.
* ```ts
* tuplehash128xof([new Uint8Array([1]), new Uint8Array([2])], { dkLen: 32 });
* ```
*/
export const tuplehash128xof: TRet<ITupleHash> = /* @__PURE__ */ genTuple(168, 16, true);
/**
* 256-bit TupleHASH XOF.
* @param messages - ordered byte-array tuple
* @param opts - Optional output and personalization settings. Defaults to
* 32 output bytes when `dkLen` is omitted. See {@link cShakeOpts}.
* @returns Digest bytes.
* @example
* Hash a tuple of byte arrays with TupleHash256 XOF output.
* ```ts
* tuplehash256xof([new Uint8Array([1]), new Uint8Array([2])], { dkLen: 64 });
* ```
*/
export const tuplehash256xof: TRet<ITupleHash> = /* @__PURE__ */ genTuple(136, 32, true);
// Same as K12/M14, but without speedup for inputs less 8kb,
// reduced number of rounds and simpler.
type ParallelOpts = KangarooOpts & { blockLen?: number };
/** Internal Parallel Keccak Hash class. */
export class _ParallelHash extends Keccak implements HashXOF<_ParallelHash> {
private leafHash?: Hash<Keccak>;
protected leafCons: () => Hash<Keccak>;
private chunkPos = 0; // Position of current block in chunk
private chunksDone = 0; // How many chunks we already have
private chunkLen: number;
constructor(
blockLen: number,
outputLen: number,
leafCons: () => Hash<Keccak>,
enableXOF: boolean,
opts: TArg<ParallelOpts> = {}
) {
super(blockLen, 0x1f, outputLen, enableXOF);
cshakePers(this as unknown as TArg<Keccak>, {
NISTfn: 'ParallelHash',
personalization: opts.personalization,
});
this.leafCons = leafCons;
let { blockLen: B = 8 } = opts;
anumber(B);
// blockLen=0 makes take=0 in update(), so pos never advances and the hash hangs.
if (B < 1) throw new Error('"blockLen" must be >= 1, got ' + B);
this.chunkLen = B;
// SP 800-185 initializes z = left_encode(B); each completed chunk appends
// one fixed-size cSHAKE leaf digest before finish() adds right_encode(n)
// and right_encode(L or 0).
super.update(leftEncode(B));
// Change update after cshake processed
this.update = (data: TArg<Uint8Array>) => {
abytes(data);
const { chunkLen, leafCons } = this;
for (let pos = 0, len = data.length; pos < len; ) {
if (this.chunkPos == chunkLen || !this.leafHash) {
if (this.leafHash) {
super.update(this.leafHash.digest());
this.chunksDone++;
}
this.leafHash = leafCons();
this.chunkPos = 0;
}
const take = Math.min(chunkLen - this.chunkPos, len - pos);
this.leafHash.update(data.subarray(pos, pos + take));
this.chunkPos += take;
pos += take;
}
return this;
};
}
protected finish(): void {
if (this.finished) return;
if (this.leafHash) {
super.update(this.leafHash.digest());
this.chunksDone++;
}
// SP 800-185 finishes ParallelHash as
// z || right_encode(n) || right_encode(L); XOF mode replaces
// right_encode(L) with right_encode(0).
super.update(rightEncode(this.chunksDone));
// outputLen in bits
super.update(rightEncode(this.enableXOF ? 0 : _8n * BigInt(this.outputLen)));
super.finish();
}
_cloneInto(to?: _ParallelHash): _ParallelHash {
to ||= new _ParallelHash(this.blockLen, this.outputLen, this.leafCons, this.enableXOF);
to.leafCons = this.leafCons;
// Reused destinations can carry a stale partial leaf
// when the source is still on the root sponge.
if (this.leafHash) to.leafHash = this.leafHash._cloneInto(to.leafHash as Keccak);
else if (to.leafHash) {
to.leafHash.destroy();
to.leafHash = undefined;
}
to.chunkPos = this.chunkPos;
to.chunkLen = this.chunkLen;
to.chunksDone = this.chunksDone;
return super._cloneInto(to) as _ParallelHash;
}
destroy(): void {
super.destroy.call(this);
if (this.leafHash) this.leafHash.destroy();
}
clone(): _ParallelHash {
return this._cloneInto();
}
}
function genPrl(
blockLen: number,
outputLen: number,
leaf: ReturnType<typeof gencShake>,
xof = false
): TRet<CHashXOF<Keccak, ParallelOpts>> {
const parallel = (message: TArg<Uint8Array>, opts?: TArg<ParallelOpts>): TRet<Uint8Array> =>
parallel.create(opts).update(message).digest();
parallel.create = (opts: TArg<ParallelOpts> = {}) =>
new _ParallelHash(
blockLen,
chooseLen(opts, outputLen),
// SP 800-185 fixes leaf digests at 256 bits for ParallelHash128 and
// 512 bits for ParallelHash256; only the final cSHAKE output uses the
// caller-selected dkLen.
() => leaf.create({ dkLen: 2 * outputLen }),
xof,
opts
);
parallel.outputLen = outputLen;
parallel.blockLen = blockLen;
parallel.canXOF = xof;
return parallel as TRet<CHashXOF<Keccak, ParallelOpts>>;
}
/**
* 128-bit ParallelHash. In JS, it is not parallel.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and chunking settings.
* Defaults to 16 output bytes when `dkLen` is omitted.
* See {@link ParallelOpts}.
* @returns Digest bytes.
* @example
* Hash a message with ParallelHash128.
* ```ts
* parallelhash128(new Uint8Array([1, 2, 3]));
* ```
*/
export const parallelhash128: TRet<CHash<Keccak, ParallelOpts>> = /* @__PURE__ */ genPrl(
168,
16,
cshake128
);
/**
* 256-bit ParallelHash. In JS, it is not parallel.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and chunking settings.
* Defaults to 32 output bytes when `dkLen` is omitted.
* See {@link ParallelOpts}.
* @returns Digest bytes.
* @example
* Hash a message with ParallelHash256.
* ```ts
* parallelhash256(new Uint8Array([1, 2, 3]));
* ```
*/
export const parallelhash256: TRet<CHash<Keccak, ParallelOpts>> = /* @__PURE__ */ genPrl(
136,
32,
cshake256
);
/**
* 128-bit ParallelHash XOF. In JS, it is not parallel.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and chunking settings.
* Defaults to 16 output bytes when `dkLen` is omitted.
* See {@link ParallelOpts}.
* @returns Digest bytes.
* @example
* Hash a message with ParallelHash128 XOF output.
* ```ts
* parallelhash128xof(new Uint8Array([1, 2, 3]), { dkLen: 32 });
* ```
*/
export const parallelhash128xof: TRet<CHashXOF<Keccak, ParallelOpts>> = /* @__PURE__ */ genPrl(
168,
16,
cshake128,
true
);
/**
* 256-bit ParallelHash XOF. In JS, it is not parallel.
* @param msg - message bytes to hash
* @param opts - Optional output, personalization, and chunking settings.
* Defaults to 32 output bytes when `dkLen` is omitted.
* See {@link ParallelOpts}.
* @returns Digest bytes.
* @example
* Hash a message with ParallelHash256 XOF output.
* ```ts
* parallelhash256xof(new Uint8Array([1, 2, 3]), { dkLen: 64 });
* ```
*/
export const parallelhash256xof: TRet<CHashXOF<Keccak, ParallelOpts>> = /* @__PURE__ */ genPrl(
136,
32,
cshake256,
true
);
/**
* TurboSHAKE options.
* `D` is the domain separation byte; RFC 9861 defines output length `L`
* as a positive integer.
*/
export type TurboshakeOpts = ShakeOpts & {
/** Optional domain separation byte in the `0x01..0x7f` range. */
D?: number;
};
const genTurbo = (blockLen: number, outputLen: number) =>
createHasher<Keccak, TurboshakeOpts>((opts: TArg<TurboshakeOpts> = {}) => {
const D = opts.D === undefined ? 0x1f : opts.D;
// RFC 9861 §2.1 fixes the default `D = 0x1f`; §2.2 defines the 12-round
// TurboSHAKE family selected here.
if (!Number.isSafeInteger(D) || D < 0x01 || D > 0x7f)
throw new Error('"D" (domain separation byte) must be 0x01..0x7f, got: ' + D);
const dkLen = opts.dkLen === undefined ? outputLen : opts.dkLen;
// RFC 9861 §§2.1-2.2 define output length L as a positive integer.
if (dkLen < 1) throw new Error('"dkLen" must be >= 1');
return new Keccak(blockLen, D, dkLen, true, 12);
});
/**
* TurboSHAKE 128-bit: reduced 12-round keccak.
* Should've been a simple "shake with 12 rounds", but we got a whole new
* spec about Turbo SHAKE Pro MAX.
* @param msg - message bytes to hash
* @param opts - Optional output-length and domain-separation settings.
* RFC 9861 §2.1 defaults `D` to `0x1f`. Defaults to 32 output bytes when
* `dkLen` is omitted. See {@link TurboshakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with TurboSHAKE128.
* ```ts
* turboshake128(new Uint8Array([1, 2, 3]), { dkLen: 32 });
* ```
*/
export const turboshake128: TRet<CHashXOF<Keccak, TurboshakeOpts>> = /* @__PURE__ */ genTurbo(
168,
32
);
/**
* TurboSHAKE 256-bit: reduced 12-round keccak.
* @param msg - message bytes to hash
* @param opts - Optional output-length and domain-separation settings.
* RFC 9861 §2.1 defaults `D` to `0x1f`. Defaults to 64 output bytes when
* `dkLen` is omitted. See {@link TurboshakeOpts}.
* @returns Digest bytes.
* @example
* Hash a message with TurboSHAKE256.
* ```ts
* turboshake256(new Uint8Array([1, 2, 3]), { dkLen: 64 });
* ```
*/
export const turboshake256: TRet<CHashXOF<Keccak, TurboshakeOpts>> = /* @__PURE__ */ genTurbo(
136,
64
);
// Same as NIST rightEncode, but returns `[0]` for the zero string.
// Callers still need to keep `x < 256^255` per RFC 9861 §3.3.
function rightEncodeK12(n: number | bigint): TRet<Uint8Array> {
n = BigInt(n);
const res: number[] = [];
for (; n > 0; n >>= _8n) res.unshift(Number(n & _ffn));
res.push(res.length);
return Uint8Array.from(res);
}
/** K12 options. */
export type KangarooOpts = {
/**
* Desired digest length in bytes.
* RFC 9861 §3 defines output length `L` as a positive integer.
*/
dkLen?: number;
/**
* Optional personalization string mixed into the sponge state.
* Stateful K12 instances keep an internal copy so caller buffers can be
* wiped independently.
*/
personalization?: Uint8Array;
};
const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
/** Internal K12 hash class. */
export class _KangarooTwelve extends Keccak implements HashXOF<_KangarooTwelve> {
readonly chunkLen = 8192;
private leafHash?: Keccak;
protected leafLen: number;
private personalization: Uint8Array;
private chunkPos = 0; // Position of current block in chunk
private chunksDone = 0; // How many chunks we already have
constructor(
blockLen: number,
leafLen: number,
outputLen: number,
rounds: number,
opts: TArg<KangarooOpts>
) {
super(blockLen, 0x07, outputLen, true, rounds);
// RFC 9861 §3 defines output length L as a positive integer.
if (outputLen < 1) throw new Error('"dkLen" must be >= 1');
this.leafLen = leafLen;
this.personalization =
opts.personalization === undefined
? EMPTY_BUFFER
: copyBytes(abytes(opts.personalization, undefined, 'personalization'));
}
update(data: TArg<Uint8Array>): this {
abytes(data);
const { chunkLen, blockLen, leafLen, rounds } = this;
for (let pos = 0, len = data.length; pos < len; ) {
if (this.chunkPos == chunkLen) {
if (this.leafHash) super.update(this.leafHash.digest());
else {
// RFC 9861 §3.2 switches from SingleNode (`07`) to FinalNode (`06`)
// once S exceeds 8192 bytes and prefixes S_0 with
// `03 00 00 00 00 00 00 00`.
this.suffix = 0x06; // Its safe to change suffix here since its used only in digest()
super.update(Uint8Array.from([3, 0, 0, 0, 0, 0, 0, 0]));
}
// Secondary chunks S_1..S_(n-1) become fixed-length
// CV_i = TurboSHAKE*(S_i, `0B`, 32|64) chaining values.
this.leafHash = new Keccak(blockLen, 0x0b, leafLen, false, rounds);
this.chunksDone++;
this.chunkPos = 0;
}
const take = Math.min(chunkLen - this.chunkPos, len - pos);
const chunk = data.subarray(pos, pos + take);
if (this.leafHash) this.leafHash.update(chunk);
else super.update(chunk);
this.chunkPos += take;
pos += take;
}
return this;
}
protected finish(): void {
if (this.finished) return;
const { personalization } = this;
// RFC 9861 §3.2 forms S = M || C || length_encode(|C|) before any tree hashing logic.
this.update(personalization).update(rightEncodeK12(personalization.length));
// Leaf hash
if (this.leafHash) {
// Multi-chunk K12 appends
// CV_1..CV_(n-1) || length_encode(n-1) || `FF FF`
// before the final TurboSHAKE call.
super.update(this.leafHash.digest());
super.update(rightEncodeK12(this.chunksDone));
super.update(Uint8Array.from([0xff, 0xff]));
}
super.finish.call(this);
}
destroy(): void {
super.destroy.call(this);
if (this.leafHash) this.leafHash.destroy();
// Personalization is copied on create/clone, so destroy can wipe it
// without touching caller input.
if (this.personalization !== EMPTY_BUFFER) clean(this.personalization);
this.personalization = EMPTY_BUFFER;
}
_cloneInto(to?: _KangarooTwelve): _KangarooTwelve {
const { blockLen, leafLen, leafHash, outputLen, rounds } = this;
const personalization =
this.personalization === EMPTY_BUFFER ? EMPTY_BUFFER : copyBytes(this.personalization);
// Personalization is absorbed only during finish(), so clones need the same pending value.
to ||= new _KangarooTwelve(blockLen, leafLen, outputLen, rounds, {
personalization,
});
super._cloneInto(to);
// Reused destinations can carry a stale leaf from an older multi-chunk state.
if (leafHash) to.leafHash = leafHash._cloneInto(to.leafHash);
else if (to.leafHash) {
to.leafHash.destroy();
to.leafHash = undefined;
}
// Snapshot the pending personalization so clone state does not alias caller-owned input.
to.personalization = personalization;
to.leafLen = this.leafLen;
to.chunkPos = this.chunkPos;
to.chunksDone = this.chunksDone;
return to;
}
clone(): _KangarooTwelve {
return this._cloneInto();
}
}
/**
* 128-bit KangarooTwelve (k12): reduced 12-round keccak.
* @param msg - message bytes to hash
* @param opts - Optional output and personalization settings. Defaults to
* 32 output bytes when `dkLen` is omitted. See {@link KangarooOpts}.
* @returns Digest bytes.
* @example
* Hash a message with KangarooTwelve-128.
* ```ts
* kt128(new Uint8Array([1, 2, 3]));
* ```
*/
export const kt128: TRet<CHash<_KangarooTwelve, KangarooOpts>> = /* @__PURE__ */ createHasher(
(opts: TArg<KangarooOpts> = {}) => new _KangarooTwelve(168, 32, chooseLen(opts, 32), 12, opts)
);
/**
* 256-bit KangarooTwelve (k12): reduced 12-round keccak.
* @param msg - message bytes to hash
* @param opts - Optional output and personalization settings. Defaults to
* 64 output bytes when `dkLen` is omitted. See {@link KangarooOpts}.
* @returns Digest bytes.
* @example
* Hash a message with KangarooTwelve-256.
* ```ts
* kt256(new Uint8Array([1, 2, 3]));
* ```
*/
export const kt256: TRet<CHash<_KangarooTwelve, KangarooOpts>> = /* @__PURE__ */ createHasher(
(opts: TArg<KangarooOpts> = {}) => new _KangarooTwelve(136, 64, chooseLen(opts, 64), 12, opts)
);
// MarsupilamiFourteen (14-rounds) can be defined as:
// `new KangarooTwelve(136, 64, chooseLen(opts, 64), 14, opts)`
/** KangarooTwelve-based MAC function type. */
export type HopMAC = (
key: TArg<Uint8Array>,
message: TArg<Uint8Array>,
personalization: TArg<Uint8Array>,
dkLen?: number
) => TRet<Uint8Array>;
const genHopMAC =
(hash: TArg<CHash<_KangarooTwelve, KangarooOpts>>): TRet<HopMAC> =>
(
key: TArg<Uint8Array>,
message: TArg<Uint8Array>,
personalization: TArg<Uint8Array>,
dkLen?: number
) => {
const h = hash as unknown as CHash<_KangarooTwelve, KangarooOpts>;
return h(key, { personalization: h(message, { personalization }), dkLen }) as TRet<Uint8Array>;
};
/**
* 128-bit KangarooTwelve-based MAC.
*
* These untested (there is no test vectors or implementation available). Use at your own risk.
* HopMAC128(Key, M, C, L) = KT128(Key, KT128(M, C, 32), L)
* HopMAC256(Key, M, C, L) = KT256(Key, KT256(M, C, 64), L)
* The inner KangarooTwelve call always uses a fixed 32-byte digest here,
* regardless of the outer `dkLen`.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param personalization - personalization bytes mixed into the inner hash
* @param dkLen - optional output length in bytes
* @returns Authentication tag bytes.
* @example
* Authenticate a message with HopMAC128.
* ```ts
* HopMAC128(new Uint8Array([1]), new Uint8Array([2]), new Uint8Array([3]), 32);
* ```
*/
export const HopMAC128: TRet<HopMAC> = /* @__PURE__ */ genHopMAC(kt128);
/**
* 256-bit KangarooTwelve-based MAC.
* Like `HopMAC128`, there are no test vectors or known independent
* implementations available for cross-checking.
* @param key - MAC key bytes
* @param message - message bytes to authenticate
* @param personalization - personalization bytes mixed into the inner hash
* @param dkLen - optional output length in bytes. The inner KangarooTwelve
* call still uses a fixed 64-byte digest here, regardless of the outer
* `dkLen`.
* @returns Authentication tag bytes.
* @example
* Authenticate a message with HopMAC256.
* ```ts
* HopMAC256(new Uint8Array([1]), new Uint8Array([2]), new Uint8Array([3]), 64);
* ```
*/
export const HopMAC256: TRet<HopMAC> = /* @__PURE__ */ genHopMAC(kt256);
/**
* More at
* {@link https://github.com/XKCP/XKCP/tree/master/lib/high/Keccak/PRG}.
* Accepted capacities must keep `rho = 1598 - capacity` byte-aligned, and
* `.clean()` later also requires `rate > 801`.
*/
export class _KeccakPRG extends Keccak implements PRG {
protected rate: number;
constructor(capacity: number) {
anumber(capacity);
const rate = 1600 - capacity;
const rho = rate - 2;
// Rho must be full bytes
if (capacity < 0 || capacity > 1600 - 10 || rho % 8) throw new Error('invalid capacity');
// blockLen = rho in bytes
super(rho / 8, 0, 0, true);
this.rate = rate;
this.posOut = Math.floor((rate + 7) / 8);
}
protected keccak(): void {
// Duplex padding
this.state[this.pos] ^= 0x01;
this.state[this.blockLen] ^= 0x02; // Rho is full bytes
super.keccak();
this.pos = 0;
this.posOut = 0;
}
update(data: TArg<Uint8Array>): this {
super.update(data);
this.posOut = this.blockLen;
return this;
}
protected finish(): void {}
digestInto(_out: TArg<Uint8Array>): void {
throw new Error('digest is not allowed, use .randomBytes() instead');
}
addEntropy(seed: TArg<Uint8Array>): void {
this.update(seed);
}
randomBytes(length: number): TRet<Uint8Array> {
return this.xof(length);
}
clean(): void {
// clean() mutates live sponge state just like randomBytes(),
// so destroyed instances must reject it.
aexists(this, false);
if (this.rate < 1600 / 2 + 1) throw new Error('rate is too low to use .forget()');
this.keccak();
for (let i = 0; i < this.blockLen; i++) this.state[i] = 0;
this.pos = this.blockLen;
this.keccak();
this.posOut = this.blockLen;
}
_cloneInto(to?: _KeccakPRG): _KeccakPRG {
const { rate } = this;
to ||= new _KeccakPRG(1600 - rate);
super._cloneInto(to);
to.rate = rate;
return to;
}
clone(): _KeccakPRG {
return this._cloneInto();
}
}
/**
* KeccakPRG: pseudo-random generator based on Keccak.
* See {@link https://keccak.team/files/CSF-0.1.pdf}.
* @param capacity - sponge capacity in bits. Accepted values are those that
* keep `rho = 1598 - capacity` byte-aligned; the default `254` is chosen
* because it satisfies that duplex layout while leaving a wide byte-aligned
* rate.
* @returns PRG instance backed by a Keccak sponge.
* @example
* Create a Keccak-based pseudorandom generator and read bytes from it.
* ```ts
* const prg = keccakprg(254);
* prg.randomBytes(8);
* ```
*/
export const keccakprg = (capacity = 254): TRet<_KeccakPRG> =>
new _KeccakPRG(capacity) as TRet<_KeccakPRG>;
@@ -0,0 +1 @@
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/type.ts"],"names":[],"mappings":";;;AAEA,mDAAsD;AACtD,uDAAoD;AACpD,6CAA0C;AAC1C,yCAAwC;AACxC,mCAAwE;AAM3D,QAAA,QAAQ,GAA+C;IAClE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC;CAC5B,CAAA;AAID,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAe,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAClD,CAAA;AAED,SAAS,aAAa,CAAC,GAAe;IACpC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC3B,MAAM,EAAC,SAAS,EAAE,SAAS,EAAC,GAAG,EAAE,CAAC,IAAI,CAAA;IACtC,IAAI,SAAS,KAAK,MAAM;QAAE,OAAO,IAAA,WAAC,EAAA,GAAG,IAAI,mBAAmB,CAAA;IAC5D,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,mBAAc,CAAC,CAAA;IACxC,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,QAAQ,CAAC,CAAC,CAAC,aAAG,CAAA;IAChD,MAAM,WAAW,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,mBAAmB,GAAG,IAAI,IAAI,GAAG,YAAY,GAAG,CAAA;IACnF,OAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,kBAAkB,EAAE,WAAW,CAAC,CAAA;AAC3F,CAAC;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC5C,IAAI,IAAU,CAAA;QACd,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,SAAS,CAAC;YACf,KAAK,QAAQ;gBACX,IAAI,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,OAAO,MAAM,EAAE,CAAA;gBACrC,MAAK;YACP,KAAK,WAAW,CAAC,CAAC,CAAC;gBACjB,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;gBACzB,MAAK;YACP,CAAC;YACD,KAAK,SAAS,CAAC;YACf,KAAK,SAAS;gBACZ,IAAI,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,CAAA;gBACpC,MAAK;YACP,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,GAAG,GAAG,MAAiB,CAAA;gBAC7B,IAAI,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,4BAA4B,IAAI,UAAU,IAAI,OAAO,CAAA;gBAC3E,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,CAAC,EAAE,CAAC;oBACjE,IAAI,GAAG,KAAK,QAAQ;wBAAE,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,OAAO,CAAA;gBACzD,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,gBAAQ,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,OAAO,GAAG,OAAO,IAAI,OAAO,GAAG,EAAE,CAAA;gBAC7D,CAAC;YACH,CAAC;QACH,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACxE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}
@@ -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 ReceiptJapaneseYen = createLucideIcon("ReceiptJapaneseYen", [
[
"path",
{ d: "M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z", key: "q3az6g" }
],
["path", { d: "m12 10 3-3", key: "1mc12w" }],
["path", { d: "m9 7 3 3v7.5", key: "39i0xv" }],
["path", { d: "M9 11h6", key: "1fldmi" }],
["path", { d: "M9 15h6", key: "cctwl0" }]
]);
export { ReceiptJapaneseYen as default };
//# sourceMappingURL=receipt-japanese-yen.js.map
@@ -0,0 +1,236 @@
/**
* @fileoverview Rule to disallow empty functions.
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const ALLOW_OPTIONS = Object.freeze([
"functions",
"arrowFunctions",
"generatorFunctions",
"methods",
"generatorMethods",
"getters",
"setters",
"constructors",
"asyncFunctions",
"asyncMethods",
"privateConstructors",
"protectedConstructors",
"decoratedFunctions",
"overrideMethods",
]);
/**
* Gets the kind of a given function node.
* @param {ASTNode} node A function node to get. This is one of
* an ArrowFunctionExpression, a FunctionDeclaration, or a
* FunctionExpression.
* @returns {string} The kind of the function. This is one of "functions",
* "arrowFunctions", "generatorFunctions", "asyncFunctions", "methods",
* "generatorMethods", "asyncMethods", "getters", "setters", and
* "constructors".
*/
function getKind(node) {
const parent = node.parent;
let kind;
if (node.type === "ArrowFunctionExpression") {
return "arrowFunctions";
}
// Detects main kind.
if (parent.type === "Property") {
if (parent.kind === "get") {
return "getters";
}
if (parent.kind === "set") {
return "setters";
}
kind = parent.method ? "methods" : "functions";
} else if (parent.type === "MethodDefinition") {
if (parent.kind === "get") {
return "getters";
}
if (parent.kind === "set") {
return "setters";
}
if (parent.kind === "constructor") {
return "constructors";
}
kind = "methods";
} else {
kind = "functions";
}
// Detects prefix.
let prefix;
if (node.generator) {
prefix = "generator";
} else if (node.async) {
prefix = "async";
} else {
return kind;
}
return prefix + kind[0].toUpperCase() + kind.slice(1);
}
/**
* Checks if a constructor function has parameter properties.
* @param {ASTNode} node The function node to examine.
* @returns {boolean} True if the constructor has parameter properties, false otherwise.
*/
function isParameterPropertiesConstructor(node) {
return node.params.some(param => param.type === "TSParameterProperty");
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
dialects: ["javascript", "typescript"],
language: "javascript",
hasSuggestions: true,
type: "suggestion",
defaultOptions: [{ allow: [] }],
docs: {
description: "Disallow empty functions",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-empty-function",
},
schema: [
{
type: "object",
properties: {
allow: {
type: "array",
items: { enum: ALLOW_OPTIONS },
uniqueItems: true,
},
},
additionalProperties: false,
},
],
messages: {
unexpected: "Unexpected empty {{name}}.",
suggestComment: "Add comment inside empty {{name}}.",
},
},
create(context) {
const [{ allow }] = context.options;
const sourceCode = context.sourceCode;
/**
* Checks if the given function node is allowed to be empty.
* @param {ASTNode} node The function node to check.
* @returns {boolean} True if the function is allowed to be empty, false otherwise.
*/
function isAllowedEmptyFunction(node) {
const kind = getKind(node);
if (allow.includes(kind)) {
return true;
}
if (kind === "constructors") {
if (
(node.parent.accessibility === "private" &&
allow.includes("privateConstructors")) ||
(node.parent.accessibility === "protected" &&
allow.includes("protectedConstructors")) ||
isParameterPropertiesConstructor(node)
) {
return true;
}
}
if (/(?:g|s)etters|methods$/iu.test(kind)) {
if (
(node.parent.decorators?.length &&
allow.includes("decoratedFunctions")) ||
(node.parent.override && allow.includes("overrideMethods"))
) {
return true;
}
}
return false;
}
/**
* Reports a given function node if the node matches the following patterns.
*
* - Not allowed by options.
* - The body is empty.
* - The body doesn't have any comments.
* @param {ASTNode} node A function node to report. This is one of
* an ArrowFunctionExpression, a FunctionDeclaration, or a
* FunctionExpression.
* @returns {void}
*/
function reportIfEmpty(node) {
const name = astUtils.getFunctionNameWithKind(node);
const innerComments = sourceCode.getTokens(node.body, {
includeComments: true,
filter: astUtils.isCommentToken,
});
if (
!isAllowedEmptyFunction(node) &&
node.body.type === "BlockStatement" &&
node.body.body.length === 0 &&
innerComments.length === 0
) {
context.report({
node,
loc: node.body.loc,
messageId: "unexpected",
data: { name },
suggest: [
{
messageId: "suggestComment",
data: { name },
fix(fixer) {
const range = [
node.body.range[0] + 1,
node.body.range[1] - 1,
];
return fixer.replaceTextRange(
range,
" /* empty */ ",
);
},
},
],
});
}
}
return {
ArrowFunctionExpression: reportIfEmpty,
FunctionDeclaration: reportIfEmpty,
FunctionExpression: reportIfEmpty,
};
},
};
@@ -0,0 +1,14 @@
# `@typescript-eslint/typescript-estree`
> A parser that produces an ESTree-compatible AST for TypeScript code.
[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/typescript-estree.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils)
[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/typescript-estree.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils)
## Contributing
👉 See **https://typescript-eslint.io/packages/typescript-estree** for documentation on this package.
> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code.
<!-- Local path for docs: docs/packages/TypeScript_ESTree.mdx -->
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_A","132":"_Z"},B:{"1":"_J"},C:{"1":"_H _lB","2":"_g","257":"_Y _iU"},D:{"1":"_NK","2":"_KC"},E:{"1":"_nB","2":"_k"},F:{"1":"_a","2":"_T"},G:{"1":"_t","2":"_d"},H:{"2":"1D"},I:{"1":"_8B","2":"_n"},J:{"1":"_B"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"1":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:1,C:"defer attribute for external scripts",D:true};
@@ -0,0 +1,174 @@
# This file comes from
# https://github.com/martine/ninja/blob/master/misc/ninja_syntax.py
# Do not edit! Edit the upstream one instead.
"""Python module for generating .ninja files.
Note that this is emphatically not a required piece of Ninja; it's
just a helpful utility for build-file-generation systems that already
use Python.
"""
import textwrap
def escape_path(word):
return word.replace("$ ", "$$ ").replace(" ", "$ ").replace(":", "$:")
class Writer:
def __init__(self, output, width=78):
self.output = output
self.width = width
def newline(self):
self.output.write("\n")
def comment(self, text):
for line in textwrap.wrap(text, self.width - 2):
self.output.write("# " + line + "\n")
def variable(self, key, value, indent=0):
if value is None:
return
if isinstance(value, list):
value = " ".join(filter(None, value)) # Filter out empty strings.
self._line(f"{key} = {value}", indent)
def pool(self, name, depth):
self._line("pool %s" % name)
self.variable("depth", depth, indent=1)
def rule(
self,
name,
command,
description=None,
depfile=None,
generator=False,
pool=None,
restat=False,
rspfile=None,
rspfile_content=None,
deps=None,
):
self._line("rule %s" % name)
self.variable("command", command, indent=1)
if description:
self.variable("description", description, indent=1)
if depfile:
self.variable("depfile", depfile, indent=1)
if generator:
self.variable("generator", "1", indent=1)
if pool:
self.variable("pool", pool, indent=1)
if restat:
self.variable("restat", "1", indent=1)
if rspfile:
self.variable("rspfile", rspfile, indent=1)
if rspfile_content:
self.variable("rspfile_content", rspfile_content, indent=1)
if deps:
self.variable("deps", deps, indent=1)
def build(
self, outputs, rule, inputs=None, implicit=None, order_only=None, variables=None
):
outputs = self._as_list(outputs)
all_inputs = self._as_list(inputs)[:]
out_outputs = list(map(escape_path, outputs))
all_inputs = list(map(escape_path, all_inputs))
if implicit:
implicit = map(escape_path, self._as_list(implicit))
all_inputs.append("|")
all_inputs.extend(implicit)
if order_only:
order_only = map(escape_path, self._as_list(order_only))
all_inputs.append("||")
all_inputs.extend(order_only)
self._line(
"build {}: {}".format(" ".join(out_outputs), " ".join([rule] + all_inputs))
)
if variables:
if isinstance(variables, dict):
iterator = iter(variables.items())
else:
iterator = iter(variables)
for key, val in iterator:
self.variable(key, val, indent=1)
return outputs
def include(self, path):
self._line("include %s" % path)
def subninja(self, path):
self._line("subninja %s" % path)
def default(self, paths):
self._line("default %s" % " ".join(self._as_list(paths)))
def _count_dollars_before_index(self, s, i):
"""Returns the number of '$' characters right in front of s[i]."""
dollar_count = 0
dollar_index = i - 1
while dollar_index > 0 and s[dollar_index] == "$":
dollar_count += 1
dollar_index -= 1
return dollar_count
def _line(self, text, indent=0):
"""Write 'text' word-wrapped at self.width characters."""
leading_space = " " * indent
while len(leading_space) + len(text) > self.width:
# The text is too wide; wrap if possible.
# Find the rightmost space that would obey our width constraint and
# that's not an escaped space.
available_space = self.width - len(leading_space) - len(" $")
space = available_space
while True:
space = text.rfind(" ", 0, space)
if space < 0 or self._count_dollars_before_index(text, space) % 2 == 0:
break
if space < 0:
# No such space; just use the first unescaped space we can find.
space = available_space - 1
while True:
space = text.find(" ", space + 1)
if (
space < 0
or self._count_dollars_before_index(text, space) % 2 == 0
):
break
if space < 0:
# Give up on breaking.
break
self.output.write(leading_space + text[0:space] + " $\n")
text = text[space + 1 :]
# Subsequent lines are continuations, so indent them.
leading_space = " " * (indent + 2)
self.output.write(leading_space + text + "\n")
def _as_list(self, input):
if input is None:
return []
if isinstance(input, list):
return input
return [input]
def escape(string):
"""Escape a string such that it can be embedded into a Ninja file without
further interpretation."""
assert "\n" not in string, "Ninja syntax does not allow newlines"
# We only have one special metacharacter: '$'.
return string.replace("$", "$$")
@@ -0,0 +1,57 @@
import { f as createRule, g as import_ast_utils } from "../utils.js";
var object_property_newline_default = createRule({
name: "object-property-newline",
meta: {
type: "layout",
docs: { description: "Enforce placing object properties on separate lines" },
fixable: "whitespace",
schema: [{
type: "object",
properties: { allowAllPropertiesOnSameLine: { type: "boolean" } },
additionalProperties: false
}],
defaultOptions: [{ allowAllPropertiesOnSameLine: false }],
messages: {
propertiesOnNewlineAll: "Object properties must go on a new line if they aren't all on the same line.",
propertiesOnNewline: "Object properties must go on a new line."
}
},
create(context, [options]) {
const allowSameLine = options.allowAllPropertiesOnSameLine;
const messageId = allowSameLine ? "propertiesOnNewlineAll" : "propertiesOnNewline";
const sourceCode = context.sourceCode;
function check(node, children) {
if (allowSameLine) {
if (children.length > 1) {
if ((0, import_ast_utils.isTokenOnSameLine)(sourceCode.getFirstToken(children[0]), sourceCode.getLastToken(children[children.length - 1]))) return;
}
}
for (let i = 1; i < children.length; i++) {
const lastTokenOfPreviousProperty = sourceCode.getLastToken(children[i - 1]);
const firstTokenOfCurrentProperty = sourceCode.getFirstToken(children[i]);
if ((0, import_ast_utils.isTokenOnSameLine)(lastTokenOfPreviousProperty, firstTokenOfCurrentProperty)) context.report({
node,
loc: firstTokenOfCurrentProperty.loc,
messageId,
fix(fixer) {
const rangeAfterComma = [sourceCode.getTokenBefore(firstTokenOfCurrentProperty).range[1], firstTokenOfCurrentProperty.range[0]];
if (sourceCode.text.slice(rangeAfterComma[0], rangeAfterComma[1]).trim()) return null;
return fixer.replaceTextRange(rangeAfterComma, "\n");
}
});
}
}
return {
ObjectExpression(node) {
check(node, node.properties);
},
TSTypeLiteral(node) {
check(node, node.members);
},
TSInterfaceBody(node) {
check(node, node.body);
}
};
}
});
export { object_property_newline_default as t };
@@ -0,0 +1,20 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const GripHorizontal = createLucideIcon("GripHorizontal", [
["circle", { cx: "12", cy: "9", r: "1", key: "124mty" }],
["circle", { cx: "19", cy: "9", r: "1", key: "1ruzo2" }],
["circle", { cx: "5", cy: "9", r: "1", key: "1a8b28" }],
["circle", { cx: "12", cy: "15", r: "1", key: "1e56xg" }],
["circle", { cx: "19", cy: "15", r: "1", key: "1a92ep" }],
["circle", { cx: "5", cy: "15", r: "1", key: "5r1jwy" }]
]);
export { GripHorizontal as default };
//# sourceMappingURL=grip-horizontal.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"2":"_I","16":"_K"},C:{"2":"_WD _rE _L","16":"_gK"},D:{"2":"_xF _lE","16":"_wC"},E:{"1":"_KB aC","2":"_NR","16":"_bE"},F:{"2":"_cR","16":"_cO"},G:{"2":"_M"},H:{"16":"1D"},I:{"2":"_G","16":"I"},J:{"2":"D","16":"A"},K:{"2":"_D","16":"H"},L:{"16":"I"},M:{"16":"YC"},N:{"2":"A","16":"B"},O:{"16":"bC"},P:{"2":"_3B","16":"_xB"},Q:{"16":"JE"},R:{"16":"KE"},S:{"2":"_C"}},B:1,C:"Password Rules",D:false};
@@ -0,0 +1,416 @@
/**
* @fileoverview A rule to choose between single and double quote marks
* @author Matt DuVall <http://www.mattduvall.com/>, Brandon Payton
* @deprecated in ESLint v8.53.0
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Constants
//------------------------------------------------------------------------------
const QUOTE_SETTINGS = {
double: {
quote: '"',
alternateQuote: "'",
description: "doublequote",
},
single: {
quote: "'",
alternateQuote: '"',
description: "singlequote",
},
backtick: {
quote: "`",
alternateQuote: '"',
description: "backtick",
},
};
// An unescaped newline is a newline preceded by an even number of backslashes.
const UNESCAPED_LINEBREAK_PATTERN = new RegExp(
String.raw`(^|[^\\])(\\\\)*[${Array.from(astUtils.LINEBREAKS).join("")}]`,
"u",
);
/**
* Switches quoting of javascript string between ' " and `
* escaping and unescaping as necessary.
* Only escaping of the minimal set of characters is changed.
* Note: escaping of newlines when switching from backtick to other quotes is not handled.
* @param {string} str A string to convert.
* @returns {string} The string with changed quotes.
* @private
*/
QUOTE_SETTINGS.double.convert =
QUOTE_SETTINGS.single.convert =
QUOTE_SETTINGS.backtick.convert =
function (str) {
const newQuote = this.quote;
const oldQuote = str[0];
if (newQuote === oldQuote) {
return str;
}
return (
newQuote +
str
.slice(1, -1)
.replace(
/\\(\$\{|\r\n?|\n|.)|["'`]|\$\{|(\r\n?|\n)/gu,
(match, escaped, newline) => {
if (
escaped === oldQuote ||
(oldQuote === "`" && escaped === "${")
) {
return escaped; // unescape
}
if (
match === newQuote ||
(newQuote === "`" && match === "${")
) {
return `\\${match}`; // escape
}
if (newline && oldQuote === "`") {
return "\\n"; // escape newlines
}
return match;
},
) +
newQuote
);
};
const AVOID_ESCAPE = "avoid-escape";
//------------------------------------------------------------------------------
// 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: "8.53.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: "quotes",
url: "https://eslint.style/rules/quotes",
},
},
],
},
type: "layout",
docs: {
description:
"Enforce the consistent use of either backticks, double, or single quotes",
recommended: false,
url: "https://eslint.org/docs/latest/rules/quotes",
},
fixable: "code",
schema: [
{
enum: ["single", "double", "backtick"],
},
{
anyOf: [
{
enum: ["avoid-escape"],
},
{
type: "object",
properties: {
avoidEscape: {
type: "boolean",
},
allowTemplateLiterals: {
type: "boolean",
},
},
additionalProperties: false,
},
],
},
],
messages: {
wrongQuotes: "Strings must use {{description}}.",
},
},
create(context) {
const quoteOption = context.options[0],
settings = QUOTE_SETTINGS[quoteOption || "double"],
options = context.options[1],
allowTemplateLiterals =
options && options.allowTemplateLiterals === true,
sourceCode = context.sourceCode;
let avoidEscape = options && options.avoidEscape === true;
// deprecated
if (options === AVOID_ESCAPE) {
avoidEscape = true;
}
/**
* Determines if a given node is part of JSX syntax.
*
* This function returns `true` in the following cases:
*
* - `<div className="foo"></div>` ... If the literal is an attribute value, the parent of the literal is `JSXAttribute`.
* - `<div>foo</div>` ... If the literal is a text content, the parent of the literal is `JSXElement`.
* - `<>foo</>` ... If the literal is a text content, the parent of the literal is `JSXFragment`.
*
* In particular, this function returns `false` in the following cases:
*
* - `<div className={"foo"}></div>`
* - `<div>{"foo"}</div>`
*
* In both cases, inside of the braces is handled as normal JavaScript.
* The braces are `JSXExpressionContainer` nodes.
* @param {ASTNode} node The Literal node to check.
* @returns {boolean} True if the node is a part of JSX, false if not.
* @private
*/
function isJSXLiteral(node) {
return (
node.parent.type === "JSXAttribute" ||
node.parent.type === "JSXElement" ||
node.parent.type === "JSXFragment"
);
}
/**
* Checks whether or not a given node is a directive.
* The directive is a `ExpressionStatement` which has only a string literal not surrounded by
* parentheses.
* @param {ASTNode} node A node to check.
* @returns {boolean} Whether or not the node is a directive.
* @private
*/
function isDirective(node) {
return (
node.type === "ExpressionStatement" &&
node.expression.type === "Literal" &&
typeof node.expression.value === "string" &&
!astUtils.isParenthesised(sourceCode, node.expression)
);
}
/**
* Checks whether a specified node is either part of, or immediately follows a (possibly empty) directive prologue.
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-directive-prologues-and-the-use-strict-directive}
* @param {ASTNode} node A node to check.
* @returns {boolean} Whether a specified node is either part of, or immediately follows a (possibly empty) directive prologue.
* @private
*/
function isExpressionInOrJustAfterDirectivePrologue(node) {
if (!astUtils.isTopLevelExpressionStatement(node.parent)) {
return false;
}
const block = node.parent.parent;
// Check the node is at a prologue.
for (let i = 0; i < block.body.length; ++i) {
const statement = block.body[i];
if (statement === node.parent) {
return true;
}
if (!isDirective(statement)) {
break;
}
}
return false;
}
/**
* Checks whether or not a given node is allowed as non backtick.
* @param {ASTNode} node A node to check.
* @returns {boolean} Whether or not the node is allowed as non backtick.
* @private
*/
function isAllowedAsNonBacktick(node) {
const parent = node.parent;
switch (parent.type) {
// Directive Prologues.
case "ExpressionStatement":
return (
!astUtils.isParenthesised(sourceCode, node) &&
isExpressionInOrJustAfterDirectivePrologue(node)
);
// LiteralPropertyName.
case "Property":
case "PropertyDefinition":
case "MethodDefinition":
return parent.key === node && !parent.computed;
// ModuleSpecifier.
case "ImportDeclaration":
case "ExportNamedDeclaration":
return parent.source === node;
// ModuleExportName or ModuleSpecifier.
case "ExportAllDeclaration":
return parent.exported === node || parent.source === node;
// ModuleExportName.
case "ImportSpecifier":
return parent.imported === node;
// ModuleExportName.
case "ExportSpecifier":
return parent.local === node || parent.exported === node;
// Others don't allow.
default:
return false;
}
}
/**
* Checks whether or not a given TemplateLiteral node is actually using any of the special features provided by template literal strings.
* @param {ASTNode} node A TemplateLiteral node to check.
* @returns {boolean} Whether or not the TemplateLiteral node is using any of the special features provided by template literal strings.
* @private
*/
function isUsingFeatureOfTemplateLiteral(node) {
const hasTag =
node.parent.type === "TaggedTemplateExpression" &&
node === node.parent.quasi;
if (hasTag) {
return true;
}
const hasStringInterpolation = node.expressions.length > 0;
if (hasStringInterpolation) {
return true;
}
const isMultilineString =
node.quasis.length >= 1 &&
UNESCAPED_LINEBREAK_PATTERN.test(node.quasis[0].value.raw);
if (isMultilineString) {
return true;
}
return false;
}
return {
Literal(node) {
const val = node.value,
rawVal = node.raw;
if (settings && typeof val === "string") {
let isValid =
(quoteOption === "backtick" &&
isAllowedAsNonBacktick(node)) ||
isJSXLiteral(node) ||
astUtils.isSurroundedBy(rawVal, settings.quote);
if (!isValid && avoidEscape) {
isValid =
astUtils.isSurroundedBy(
rawVal,
settings.alternateQuote,
) && rawVal.includes(settings.quote);
}
if (!isValid) {
context.report({
node,
messageId: "wrongQuotes",
data: {
description: settings.description,
},
fix(fixer) {
if (
quoteOption === "backtick" &&
astUtils.hasOctalOrNonOctalDecimalEscapeSequence(
rawVal,
)
) {
/*
* An octal or non-octal decimal escape sequence in a template literal would
* produce syntax error, even in non-strict mode.
*/
return null;
}
return fixer.replaceText(
node,
settings.convert(node.raw),
);
},
});
}
}
},
TemplateLiteral(node) {
// Don't throw an error if backticks are expected or a template literal feature is in use.
if (
allowTemplateLiterals ||
quoteOption === "backtick" ||
isUsingFeatureOfTemplateLiteral(node)
) {
return;
}
context.report({
node,
messageId: "wrongQuotes",
data: {
description: settings.description,
},
fix(fixer) {
if (
astUtils.isTopLevelExpressionStatement(
node.parent,
) &&
!astUtils.isParenthesised(sourceCode, node)
) {
/*
* TemplateLiterals aren't actually directives, but fixing them might turn
* them into directives and change the behavior of the code.
*/
return null;
}
return fixer.replaceText(
node,
settings.convert(sourceCode.getText(node)),
);
},
});
},
};
},
};
@@ -0,0 +1,79 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMemberHeadLoc = getMemberHeadLoc;
exports.getParameterPropertyHeadLoc = getParameterPropertyHeadLoc;
const eslint_utils_1 = require("@typescript-eslint/utils/eslint-utils");
/**
* Generates report loc suitable for reporting on how a class member is
* declared, rather than how it's implemented.
*
* ```ts
* class A {
* abstract method(): void;
* ~~~~~~~~~~~~~~~
*
* concreteMethod(): void {
* ~~~~~~~~~~~~~~
* // code
* }
*
* abstract private property?: string;
* ~~~~~~~~~~~~~~~~~~~~~~~~~
*
* @decorator override concreteProperty = 'value';
* ~~~~~~~~~~~~~~~~~~~~~~~~~
* }
* ```
*/
function getMemberHeadLoc(sourceCode, node) {
let start;
if (node.decorators.length === 0) {
start = node.loc.start;
}
else {
const lastDecorator = node.decorators[node.decorators.length - 1];
const nextToken = (0, eslint_utils_1.nullThrows)(sourceCode.getTokenAfter(lastDecorator), eslint_utils_1.NullThrowsReasons.MissingToken('token', 'last decorator'));
start = nextToken.loc.start;
}
let end;
if (!node.computed) {
end = node.key.loc.end;
}
else {
const closingBracket = (0, eslint_utils_1.nullThrows)(sourceCode.getTokenAfter(node.key, token => token.value === ']'), eslint_utils_1.NullThrowsReasons.MissingToken(']', node.type));
end = closingBracket.loc.end;
}
return {
end: structuredClone(end),
start: structuredClone(start),
};
}
/**
* Generates report loc suitable for reporting on how a parameter property is
* declared.
*
* ```ts
* class A {
* constructor(private property: string = 'value') {
* ~~~~~~~~~~~~~~~~
* }
* ```
*/
function getParameterPropertyHeadLoc(sourceCode, node, nodeName) {
// Parameter properties have a weirdly different AST structure
// than other class members.
let start;
if (node.decorators.length === 0) {
start = structuredClone(node.loc.start);
}
else {
const lastDecorator = node.decorators[node.decorators.length - 1];
const nextToken = (0, eslint_utils_1.nullThrows)(sourceCode.getTokenAfter(lastDecorator), eslint_utils_1.NullThrowsReasons.MissingToken('token', 'last decorator'));
start = structuredClone(nextToken.loc.start);
}
const end = sourceCode.getLocFromIndex(node.parameter.range[0] + nodeName.length);
return {
end,
start,
};
}
@@ -0,0 +1,176 @@
import { F as ForwardRefComponent, b as HTMLMotionProps, f as SVGMotionProps } from '../types.d-DOCC-kZB.js';
import 'react';
import 'motion-dom';
/**
* HTML components
*/
declare const MotionA: ForwardRefComponent<HTMLAnchorElement, HTMLMotionProps<"a">>;
declare const MotionAbbr: ForwardRefComponent<HTMLElement, HTMLMotionProps<"abbr">>;
declare const MotionAddress: ForwardRefComponent<HTMLElement, HTMLMotionProps<"address">>;
declare const MotionArea: ForwardRefComponent<HTMLAreaElement, HTMLMotionProps<"area">>;
declare const MotionArticle: ForwardRefComponent<HTMLElement, HTMLMotionProps<"article">>;
declare const MotionAside: ForwardRefComponent<HTMLElement, HTMLMotionProps<"aside">>;
declare const MotionAudio: ForwardRefComponent<HTMLAudioElement, HTMLMotionProps<"audio">>;
declare const MotionB: ForwardRefComponent<HTMLElement, HTMLMotionProps<"b">>;
declare const MotionBase: ForwardRefComponent<HTMLBaseElement, HTMLMotionProps<"base">>;
declare const MotionBdi: ForwardRefComponent<HTMLElement, HTMLMotionProps<"bdi">>;
declare const MotionBdo: ForwardRefComponent<HTMLElement, HTMLMotionProps<"bdo">>;
declare const MotionBig: ForwardRefComponent<HTMLElement, HTMLMotionProps<"big">>;
declare const MotionBlockquote: ForwardRefComponent<HTMLQuoteElement, HTMLMotionProps<"blockquote">>;
declare const MotionBody: ForwardRefComponent<HTMLBodyElement, HTMLMotionProps<"body">>;
declare const MotionButton: ForwardRefComponent<HTMLButtonElement, HTMLMotionProps<"button">>;
declare const MotionCanvas: ForwardRefComponent<HTMLCanvasElement, HTMLMotionProps<"canvas">>;
declare const MotionCaption: ForwardRefComponent<HTMLElement, HTMLMotionProps<"caption">>;
declare const MotionCite: ForwardRefComponent<HTMLElement, HTMLMotionProps<"cite">>;
declare const MotionCode: ForwardRefComponent<HTMLElement, HTMLMotionProps<"code">>;
declare const MotionCol: ForwardRefComponent<HTMLTableColElement, HTMLMotionProps<"col">>;
declare const MotionColgroup: ForwardRefComponent<HTMLTableColElement, HTMLMotionProps<"colgroup">>;
declare const MotionData: ForwardRefComponent<HTMLDataElement, HTMLMotionProps<"data">>;
declare const MotionDatalist: ForwardRefComponent<HTMLDataListElement, HTMLMotionProps<"datalist">>;
declare const MotionDd: ForwardRefComponent<HTMLElement, HTMLMotionProps<"dd">>;
declare const MotionDel: ForwardRefComponent<HTMLModElement, HTMLMotionProps<"del">>;
declare const MotionDetails: ForwardRefComponent<HTMLDetailsElement, HTMLMotionProps<"details">>;
declare const MotionDfn: ForwardRefComponent<HTMLElement, HTMLMotionProps<"dfn">>;
declare const MotionDialog: ForwardRefComponent<HTMLDialogElement, HTMLMotionProps<"dialog">>;
declare const MotionDiv: ForwardRefComponent<HTMLDivElement, HTMLMotionProps<"div">>;
declare const MotionDl: ForwardRefComponent<HTMLDListElement, HTMLMotionProps<"dl">>;
declare const MotionDt: ForwardRefComponent<HTMLElement, HTMLMotionProps<"dt">>;
declare const MotionEm: ForwardRefComponent<HTMLElement, HTMLMotionProps<"em">>;
declare const MotionEmbed: ForwardRefComponent<HTMLEmbedElement, HTMLMotionProps<"embed">>;
declare const MotionFieldset: ForwardRefComponent<HTMLFieldSetElement, HTMLMotionProps<"fieldset">>;
declare const MotionFigcaption: ForwardRefComponent<HTMLElement, HTMLMotionProps<"figcaption">>;
declare const MotionFigure: ForwardRefComponent<HTMLElement, HTMLMotionProps<"figure">>;
declare const MotionFooter: ForwardRefComponent<HTMLElement, HTMLMotionProps<"footer">>;
declare const MotionForm: ForwardRefComponent<HTMLFormElement, HTMLMotionProps<"form">>;
declare const MotionH1: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h1">>;
declare const MotionH2: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h2">>;
declare const MotionH3: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h3">>;
declare const MotionH4: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h4">>;
declare const MotionH5: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h5">>;
declare const MotionH6: ForwardRefComponent<HTMLHeadingElement, HTMLMotionProps<"h6">>;
declare const MotionHead: ForwardRefComponent<HTMLHeadElement, HTMLMotionProps<"head">>;
declare const MotionHeader: ForwardRefComponent<HTMLElement, HTMLMotionProps<"header">>;
declare const MotionHgroup: ForwardRefComponent<HTMLElement, HTMLMotionProps<"hgroup">>;
declare const MotionHr: ForwardRefComponent<HTMLHRElement, HTMLMotionProps<"hr">>;
declare const MotionHtml: ForwardRefComponent<HTMLHtmlElement, HTMLMotionProps<"html">>;
declare const MotionI: ForwardRefComponent<HTMLElement, HTMLMotionProps<"i">>;
declare const MotionIframe: ForwardRefComponent<HTMLIFrameElement, HTMLMotionProps<"iframe">>;
declare const MotionImg: ForwardRefComponent<HTMLImageElement, HTMLMotionProps<"img">>;
declare const MotionInput: ForwardRefComponent<HTMLInputElement, HTMLMotionProps<"input">>;
declare const MotionIns: ForwardRefComponent<HTMLModElement, HTMLMotionProps<"ins">>;
declare const MotionKbd: ForwardRefComponent<HTMLElement, HTMLMotionProps<"kbd">>;
declare const MotionKeygen: ForwardRefComponent<HTMLElement, HTMLMotionProps<"keygen">>;
declare const MotionLabel: ForwardRefComponent<HTMLLabelElement, HTMLMotionProps<"label">>;
declare const MotionLegend: ForwardRefComponent<HTMLLegendElement, HTMLMotionProps<"legend">>;
declare const MotionLi: ForwardRefComponent<HTMLLIElement, HTMLMotionProps<"li">>;
declare const MotionLink: ForwardRefComponent<HTMLLinkElement, HTMLMotionProps<"link">>;
declare const MotionMain: ForwardRefComponent<HTMLElement, HTMLMotionProps<"main">>;
declare const MotionMap: ForwardRefComponent<HTMLMapElement, HTMLMotionProps<"map">>;
declare const MotionMark: ForwardRefComponent<HTMLElement, HTMLMotionProps<"mark">>;
declare const MotionMenu: ForwardRefComponent<HTMLElement, HTMLMotionProps<"menu">>;
declare const MotionMenuitem: ForwardRefComponent<HTMLElement, HTMLMotionProps<"menuitem">>;
declare const MotionMeter: ForwardRefComponent<HTMLMeterElement, HTMLMotionProps<"meter">>;
declare const MotionNav: ForwardRefComponent<HTMLElement, HTMLMotionProps<"nav">>;
declare const MotionObject: ForwardRefComponent<HTMLObjectElement, HTMLMotionProps<"object">>;
declare const MotionOl: ForwardRefComponent<HTMLOListElement, HTMLMotionProps<"ol">>;
declare const MotionOptgroup: ForwardRefComponent<HTMLOptGroupElement, HTMLMotionProps<"optgroup">>;
declare const MotionOption: ForwardRefComponent<HTMLOptionElement, HTMLMotionProps<"option">>;
declare const MotionOutput: ForwardRefComponent<HTMLOutputElement, HTMLMotionProps<"output">>;
declare const MotionP: ForwardRefComponent<HTMLParagraphElement, HTMLMotionProps<"p">>;
declare const MotionParam: ForwardRefComponent<HTMLParamElement, HTMLMotionProps<"param">>;
declare const MotionPicture: ForwardRefComponent<HTMLElement, HTMLMotionProps<"picture">>;
declare const MotionPre: ForwardRefComponent<HTMLPreElement, HTMLMotionProps<"pre">>;
declare const MotionProgress: ForwardRefComponent<HTMLProgressElement, HTMLMotionProps<"progress">>;
declare const MotionQ: ForwardRefComponent<HTMLQuoteElement, HTMLMotionProps<"q">>;
declare const MotionRp: ForwardRefComponent<HTMLElement, HTMLMotionProps<"rp">>;
declare const MotionRt: ForwardRefComponent<HTMLElement, HTMLMotionProps<"rt">>;
declare const MotionRuby: ForwardRefComponent<HTMLElement, HTMLMotionProps<"ruby">>;
declare const MotionS: ForwardRefComponent<HTMLElement, HTMLMotionProps<"s">>;
declare const MotionSamp: ForwardRefComponent<HTMLElement, HTMLMotionProps<"samp">>;
declare const MotionScript: ForwardRefComponent<HTMLScriptElement, HTMLMotionProps<"script">>;
declare const MotionSection: ForwardRefComponent<HTMLElement, HTMLMotionProps<"section">>;
declare const MotionSelect: ForwardRefComponent<HTMLSelectElement, HTMLMotionProps<"select">>;
declare const MotionSmall: ForwardRefComponent<HTMLElement, HTMLMotionProps<"small">>;
declare const MotionSource: ForwardRefComponent<HTMLSourceElement, HTMLMotionProps<"source">>;
declare const MotionSpan: ForwardRefComponent<HTMLSpanElement, HTMLMotionProps<"span">>;
declare const MotionStrong: ForwardRefComponent<HTMLElement, HTMLMotionProps<"strong">>;
declare const MotionStyle: ForwardRefComponent<HTMLStyleElement, HTMLMotionProps<"style">>;
declare const MotionSub: ForwardRefComponent<HTMLElement, HTMLMotionProps<"sub">>;
declare const MotionSummary: ForwardRefComponent<HTMLElement, HTMLMotionProps<"summary">>;
declare const MotionSup: ForwardRefComponent<HTMLElement, HTMLMotionProps<"sup">>;
declare const MotionTable: ForwardRefComponent<HTMLTableElement, HTMLMotionProps<"table">>;
declare const MotionTbody: ForwardRefComponent<HTMLTableSectionElement, HTMLMotionProps<"tbody">>;
declare const MotionTd: ForwardRefComponent<HTMLTableDataCellElement, HTMLMotionProps<"td">>;
declare const MotionTextarea: ForwardRefComponent<HTMLTextAreaElement, HTMLMotionProps<"textarea">>;
declare const MotionTfoot: ForwardRefComponent<HTMLTableSectionElement, HTMLMotionProps<"tfoot">>;
declare const MotionTh: ForwardRefComponent<HTMLTableHeaderCellElement, HTMLMotionProps<"th">>;
declare const MotionThead: ForwardRefComponent<HTMLTableSectionElement, HTMLMotionProps<"thead">>;
declare const MotionTime: ForwardRefComponent<HTMLTimeElement, HTMLMotionProps<"time">>;
declare const MotionTitle: ForwardRefComponent<HTMLTitleElement, HTMLMotionProps<"title">>;
declare const MotionTr: ForwardRefComponent<HTMLTableRowElement, HTMLMotionProps<"tr">>;
declare const MotionTrack: ForwardRefComponent<HTMLTrackElement, HTMLMotionProps<"track">>;
declare const MotionU: ForwardRefComponent<HTMLElement, HTMLMotionProps<"u">>;
declare const MotionUl: ForwardRefComponent<HTMLUListElement, HTMLMotionProps<"ul">>;
declare const MotionVideo: ForwardRefComponent<HTMLVideoElement, HTMLMotionProps<"video">>;
declare const MotionWbr: ForwardRefComponent<HTMLElement, HTMLMotionProps<"wbr">>;
declare const MotionWebview: ForwardRefComponent<HTMLWebViewElement, HTMLMotionProps<"webview">>;
/**
* SVG components
*/
declare const MotionAnimate: ForwardRefComponent<SVGElement, SVGMotionProps<SVGElement>>;
declare const MotionCircle: ForwardRefComponent<SVGCircleElement, SVGMotionProps<SVGCircleElement>>;
declare const MotionDefs: ForwardRefComponent<SVGDefsElement, SVGMotionProps<SVGDefsElement>>;
declare const MotionDesc: ForwardRefComponent<SVGDescElement, SVGMotionProps<SVGDescElement>>;
declare const MotionEllipse: ForwardRefComponent<SVGEllipseElement, SVGMotionProps<SVGEllipseElement>>;
declare const MotionG: ForwardRefComponent<SVGGElement, SVGMotionProps<SVGGElement>>;
declare const MotionImage: ForwardRefComponent<SVGImageElement, SVGMotionProps<SVGImageElement>>;
declare const MotionLine: ForwardRefComponent<SVGLineElement, SVGMotionProps<SVGLineElement>>;
declare const MotionFilter: ForwardRefComponent<SVGFilterElement, SVGMotionProps<SVGFilterElement>>;
declare const MotionMarker: ForwardRefComponent<SVGMarkerElement, SVGMotionProps<SVGMarkerElement>>;
declare const MotionMask: ForwardRefComponent<SVGMaskElement, SVGMotionProps<SVGMaskElement>>;
declare const MotionMetadata: ForwardRefComponent<SVGMetadataElement, SVGMotionProps<SVGMetadataElement>>;
declare const MotionPath: ForwardRefComponent<SVGPathElement, SVGMotionProps<SVGPathElement>>;
declare const MotionPattern: ForwardRefComponent<SVGPatternElement, SVGMotionProps<SVGPatternElement>>;
declare const MotionPolygon: ForwardRefComponent<SVGPolygonElement, SVGMotionProps<SVGPolygonElement>>;
declare const MotionPolyline: ForwardRefComponent<SVGPolylineElement, SVGMotionProps<SVGPolylineElement>>;
declare const MotionRect: ForwardRefComponent<SVGRectElement, SVGMotionProps<SVGRectElement>>;
declare const MotionStop: ForwardRefComponent<SVGStopElement, SVGMotionProps<SVGStopElement>>;
declare const MotionSvg: ForwardRefComponent<SVGSVGElement, SVGMotionProps<SVGSVGElement>>;
declare const MotionSymbol: ForwardRefComponent<SVGSymbolElement, SVGMotionProps<SVGSymbolElement>>;
declare const MotionText: ForwardRefComponent<SVGTextElement, SVGMotionProps<SVGTextElement>>;
declare const MotionTspan: ForwardRefComponent<SVGTSpanElement, SVGMotionProps<SVGTSpanElement>>;
declare const MotionUse: ForwardRefComponent<SVGUseElement, SVGMotionProps<SVGUseElement>>;
declare const MotionView: ForwardRefComponent<SVGViewElement, SVGMotionProps<SVGViewElement>>;
declare const MotionClipPath: ForwardRefComponent<SVGClipPathElement, SVGMotionProps<SVGClipPathElement>>;
declare const MotionFeBlend: ForwardRefComponent<SVGFEBlendElement, SVGMotionProps<SVGFEBlendElement>>;
declare const MotionFeColorMatrix: ForwardRefComponent<SVGFEColorMatrixElement, SVGMotionProps<SVGFEColorMatrixElement>>;
declare const MotionFeComponentTransfer: ForwardRefComponent<SVGFEComponentTransferElement, SVGMotionProps<SVGFEComponentTransferElement>>;
declare const MotionFeComposite: ForwardRefComponent<SVGFECompositeElement, SVGMotionProps<SVGFECompositeElement>>;
declare const MotionFeConvolveMatrix: ForwardRefComponent<SVGFEConvolveMatrixElement, SVGMotionProps<SVGFEConvolveMatrixElement>>;
declare const MotionFeDiffuseLighting: ForwardRefComponent<SVGFEDiffuseLightingElement, SVGMotionProps<SVGFEDiffuseLightingElement>>;
declare const MotionFeDisplacementMap: ForwardRefComponent<SVGFEDisplacementMapElement, SVGMotionProps<SVGFEDisplacementMapElement>>;
declare const MotionFeDistantLight: ForwardRefComponent<SVGFEDistantLightElement, SVGMotionProps<SVGFEDistantLightElement>>;
declare const MotionFeDropShadow: ForwardRefComponent<SVGFEDropShadowElement, SVGMotionProps<SVGFEDropShadowElement>>;
declare const MotionFeFlood: ForwardRefComponent<SVGFEFloodElement, SVGMotionProps<SVGFEFloodElement>>;
declare const MotionFeFuncA: ForwardRefComponent<SVGFEFuncAElement, SVGMotionProps<SVGFEFuncAElement>>;
declare const MotionFeFuncB: ForwardRefComponent<SVGFEFuncBElement, SVGMotionProps<SVGFEFuncBElement>>;
declare const MotionFeFuncG: ForwardRefComponent<SVGFEFuncGElement, SVGMotionProps<SVGFEFuncGElement>>;
declare const MotionFeFuncR: ForwardRefComponent<SVGFEFuncRElement, SVGMotionProps<SVGFEFuncRElement>>;
declare const MotionFeGaussianBlur: ForwardRefComponent<SVGFEGaussianBlurElement, SVGMotionProps<SVGFEGaussianBlurElement>>;
declare const MotionFeImage: ForwardRefComponent<SVGFEImageElement, SVGMotionProps<SVGFEImageElement>>;
declare const MotionFeMerge: ForwardRefComponent<SVGFEMergeElement, SVGMotionProps<SVGFEMergeElement>>;
declare const MotionFeMergeNode: ForwardRefComponent<SVGFEMergeNodeElement, SVGMotionProps<SVGFEMergeNodeElement>>;
declare const MotionFeMorphology: ForwardRefComponent<SVGFEMorphologyElement, SVGMotionProps<SVGFEMorphologyElement>>;
declare const MotionFeOffset: ForwardRefComponent<SVGFEOffsetElement, SVGMotionProps<SVGFEOffsetElement>>;
declare const MotionFePointLight: ForwardRefComponent<SVGFEPointLightElement, SVGMotionProps<SVGFEPointLightElement>>;
declare const MotionFeSpecularLighting: ForwardRefComponent<SVGFESpecularLightingElement, SVGMotionProps<SVGFESpecularLightingElement>>;
declare const MotionFeSpotLight: ForwardRefComponent<SVGFESpotLightElement, SVGMotionProps<SVGFESpotLightElement>>;
declare const MotionFeTile: ForwardRefComponent<SVGFETileElement, SVGMotionProps<SVGFETileElement>>;
declare const MotionFeTurbulence: ForwardRefComponent<SVGFETurbulenceElement, SVGMotionProps<SVGFETurbulenceElement>>;
declare const MotionForeignObject: ForwardRefComponent<SVGForeignObjectElement, SVGMotionProps<SVGForeignObjectElement>>;
declare const MotionLinearGradient: ForwardRefComponent<SVGLinearGradientElement, SVGMotionProps<SVGLinearGradientElement>>;
declare const MotionRadialGradient: ForwardRefComponent<SVGRadialGradientElement, SVGMotionProps<SVGRadialGradientElement>>;
declare const MotionTextPath: ForwardRefComponent<SVGTextPathElement, SVGMotionProps<SVGTextPathElement>>;
export { MotionA as a, MotionAbbr as abbr, MotionAddress as address, MotionAnimate as animate, MotionArea as area, MotionArticle as article, MotionAside as aside, MotionAudio as audio, MotionB as b, MotionBase as base, MotionBdi as bdi, MotionBdo as bdo, MotionBig as big, MotionBlockquote as blockquote, MotionBody as body, MotionButton as button, MotionCanvas as canvas, MotionCaption as caption, MotionCircle as circle, MotionCite as cite, MotionClipPath as clipPath, MotionCode as code, MotionCol as col, MotionColgroup as colgroup, MotionData as data, MotionDatalist as datalist, MotionDd as dd, MotionDefs as defs, MotionDel as del, MotionDesc as desc, MotionDetails as details, MotionDfn as dfn, MotionDialog as dialog, MotionDiv as div, MotionDl as dl, MotionDt as dt, MotionEllipse as ellipse, MotionEm as em, MotionEmbed as embed, MotionFeBlend as feBlend, MotionFeColorMatrix as feColorMatrix, MotionFeComponentTransfer as feComponentTransfer, MotionFeComposite as feComposite, MotionFeConvolveMatrix as feConvolveMatrix, MotionFeDiffuseLighting as feDiffuseLighting, MotionFeDisplacementMap as feDisplacementMap, MotionFeDistantLight as feDistantLight, MotionFeDropShadow as feDropShadow, MotionFeFlood as feFlood, MotionFeFuncA as feFuncA, MotionFeFuncB as feFuncB, MotionFeFuncG as feFuncG, MotionFeFuncR as feFuncR, MotionFeGaussianBlur as feGaussianBlur, MotionFeImage as feImage, MotionFeMerge as feMerge, MotionFeMergeNode as feMergeNode, MotionFeMorphology as feMorphology, MotionFeOffset as feOffset, MotionFePointLight as fePointLight, MotionFeSpecularLighting as feSpecularLighting, MotionFeSpotLight as feSpotLight, MotionFeTile as feTile, MotionFeTurbulence as feTurbulence, MotionFieldset as fieldset, MotionFigcaption as figcaption, MotionFigure as figure, MotionFilter as filter, MotionFooter as footer, MotionForeignObject as foreignObject, MotionForm as form, MotionG as g, MotionH1 as h1, MotionH2 as h2, MotionH3 as h3, MotionH4 as h4, MotionH5 as h5, MotionH6 as h6, MotionHead as head, MotionHeader as header, MotionHgroup as hgroup, MotionHr as hr, MotionHtml as html, MotionI as i, MotionIframe as iframe, MotionImage as image, MotionImg as img, MotionInput as input, MotionIns as ins, MotionKbd as kbd, MotionKeygen as keygen, MotionLabel as label, MotionLegend as legend, MotionLi as li, MotionLine as line, MotionLinearGradient as linearGradient, MotionLink as link, MotionMain as main, MotionMap as map, MotionMark as mark, MotionMarker as marker, MotionMask as mask, MotionMenu as menu, MotionMenuitem as menuitem, MotionMetadata as metadata, MotionMeter as meter, MotionNav as nav, MotionObject as object, MotionOl as ol, MotionOptgroup as optgroup, MotionOption as option, MotionOutput as output, MotionP as p, MotionParam as param, MotionPath as path, MotionPattern as pattern, MotionPicture as picture, MotionPolygon as polygon, MotionPolyline as polyline, MotionPre as pre, MotionProgress as progress, MotionQ as q, MotionRadialGradient as radialGradient, MotionRect as rect, MotionRp as rp, MotionRt as rt, MotionRuby as ruby, MotionS as s, MotionSamp as samp, MotionScript as script, MotionSection as section, MotionSelect as select, MotionSmall as small, MotionSource as source, MotionSpan as span, MotionStop as stop, MotionStrong as strong, MotionStyle as style, MotionSub as sub, MotionSummary as summary, MotionSup as sup, MotionSvg as svg, MotionSymbol as symbol, MotionTable as table, MotionTbody as tbody, MotionTd as td, MotionText as text, MotionTextPath as textPath, MotionTextarea as textarea, MotionTfoot as tfoot, MotionTh as th, MotionThead as thead, MotionTime as time, MotionTitle as title, MotionTr as tr, MotionTrack as track, MotionTspan as tspan, MotionU as u, MotionUl as ul, MotionUse as use, MotionVideo as video, MotionView as view, MotionWbr as wbr, MotionWebview as webview };
@@ -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 ShieldMinus = createLucideIcon("ShieldMinus", [
[
"path",
{
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
key: "oel41y"
}
],
["path", { d: "M9 12h6", key: "1c52cq" }]
]);
export { ShieldMinus as default };
//# sourceMappingURL=shield-minus.js.map
@@ -0,0 +1,263 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const util_1 = require("../util");
exports.default = (0, util_1.createRule)({
name: 'require-await',
meta: {
type: 'suggestion',
docs: {
description: 'Disallow async functions which do not return promises and have no `await` expression',
extendsBaseRule: true,
recommended: 'recommended',
requiresTypeChecking: true,
},
hasSuggestions: true,
messages: {
missingAwait: "{{name}} has no 'await' expression.",
removeAsync: "Remove 'async'.",
},
schema: [],
},
defaultOptions: [],
create(context) {
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
let scopeInfo = null;
/**
* Push the scope info object to the stack.
*/
function enterFunction(node) {
scopeInfo = {
hasAsync: node.async,
hasAwait: false,
isAsyncYield: false,
isGen: node.generator || false,
upper: scopeInfo,
};
}
/**
* Pop the top scope info object from the stack.
* Also, it reports the function if needed.
*/
function exitFunction(node) {
/* istanbul ignore if */ if (!scopeInfo) {
// this shouldn't ever happen, as we have to exit a function after we enter it
return;
}
if (node.async &&
!scopeInfo.hasAwait &&
!isEmptyFunction(node) &&
!(scopeInfo.isGen && scopeInfo.isAsyncYield)) {
// If the function belongs to a method definition or
// property, then the function's range may not include the
// `async` keyword and we should look at the parent instead.
const nodeWithAsyncKeyword = (node.parent.type === utils_1.AST_NODE_TYPES.MethodDefinition &&
node.parent.value === node) ||
(node.parent.type === utils_1.AST_NODE_TYPES.Property &&
node.parent.method &&
node.parent.value === node)
? node.parent
: node;
const asyncToken = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(nodeWithAsyncKeyword, token => token.value === 'async'), 'The node is an async function, so it must have an "async" token.');
const asyncRange = [
asyncToken.range[0],
(0, util_1.nullThrows)(context.sourceCode.getTokenAfter(asyncToken, {
includeComments: true,
}), 'There will always be a token after the "async" keyword.').range[0],
];
// Removing the `async` keyword can cause parsing errors if the
// current statement is relying on automatic semicolon insertion.
// If ASI is currently being used, then we should replace the
// `async` keyword with a semicolon.
const nextToken = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(asyncToken), 'There will always be a token after the "async" keyword.');
const addSemiColon = nextToken.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
(nextToken.value === '[' || nextToken.value === '(') &&
(nodeWithAsyncKeyword.type === utils_1.AST_NODE_TYPES.MethodDefinition ||
(0, util_1.isStartOfExpressionStatement)(nodeWithAsyncKeyword)) &&
(0, util_1.needsPrecedingSemicolon)(context.sourceCode, nodeWithAsyncKeyword);
const changes = [
{ range: asyncRange, replacement: addSemiColon ? ';' : undefined },
];
// If there's a return type annotation and it's a
// `Promise<T>`, we can also change the return type
// annotation to just `T` as part of the suggestion.
// Alternatively, if the function is a generator and
// the return type annotation is `AsyncGenerator<T>`,
// then we can change it to `Generator<T>`.
if (node.returnType?.typeAnnotation.type ===
utils_1.AST_NODE_TYPES.TSTypeReference) {
if (scopeInfo.isGen) {
if (hasTypeName(node.returnType.typeAnnotation, 'AsyncGenerator')) {
changes.push({
range: node.returnType.typeAnnotation.typeName.range,
replacement: 'Generator',
});
}
}
else if (hasTypeName(node.returnType.typeAnnotation, 'Promise') &&
node.returnType.typeAnnotation.typeArguments != null) {
const openAngle = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(node.returnType.typeAnnotation, token => token.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
token.value === '<'), 'There are type arguments, so the angle bracket will exist.');
const closeAngle = (0, util_1.nullThrows)(context.sourceCode.getLastToken(node.returnType.typeAnnotation, token => token.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
token.value === '>'), 'There are type arguments, so the angle bracket will exist.');
changes.push(
// Remove the closing angled bracket.
{ range: closeAngle.range, replacement: undefined },
// Remove the "Promise" identifier
// and the opening angled bracket.
{
range: [
node.returnType.typeAnnotation.typeName.range[0],
openAngle.range[1],
],
replacement: undefined,
});
}
}
context.report({
loc: (0, util_1.getFunctionHeadLoc)(node, context.sourceCode),
node,
messageId: 'missingAwait',
data: {
name: (0, util_1.upperCaseFirst)((0, util_1.getFunctionNameWithKind)(node)),
},
suggest: [
{
messageId: 'removeAsync',
fix: (fixer) => changes.map(change => change.replacement != null
? fixer.replaceTextRange(change.range, change.replacement)
: fixer.removeRange(change.range)),
},
],
});
}
scopeInfo = scopeInfo.upper;
}
/**
* Checks if the node returns a thenable type
*/
function isThenableType(node) {
const type = checker.getTypeAtLocation(node);
return tsutils.isThenableType(checker, node, type);
}
/**
* Marks the current scope as having an await
*/
function markAsHasAwait() {
if (!scopeInfo) {
return;
}
scopeInfo.hasAwait = true;
}
/**
* Mark `scopeInfo.isAsyncYield` to `true` if it
* 1) delegates async generator function
* or
* 2) yields thenable type
*/
function visitYieldExpression(node) {
if (!scopeInfo?.isGen || !node.argument) {
return;
}
if (node.argument.type === utils_1.AST_NODE_TYPES.Literal) {
// ignoring this as for literals we don't need to check the definition
// eg : async function* run() { yield* 1 }
return;
}
if (!node.delegate) {
if (isThenableType(services.esTreeNodeToTSNodeMap.get(node.argument))) {
scopeInfo.isAsyncYield = true;
}
return;
}
const type = services.getTypeAtLocation(node.argument);
const typesToCheck = expandUnionOrIntersectionType(type);
for (const type of typesToCheck) {
const asyncIterator = tsutils.getWellKnownSymbolPropertyOfType(type, 'asyncIterator', checker);
if (asyncIterator != null) {
scopeInfo.isAsyncYield = true;
break;
}
}
}
return {
ArrowFunctionExpression: enterFunction,
'ArrowFunctionExpression:exit': exitFunction,
AwaitExpression: markAsHasAwait,
'ForOfStatement[await = true]': markAsHasAwait,
FunctionDeclaration: enterFunction,
'FunctionDeclaration:exit': exitFunction,
FunctionExpression: enterFunction,
'FunctionExpression:exit': exitFunction,
'VariableDeclaration[kind = "await using"]': markAsHasAwait,
YieldExpression: visitYieldExpression,
// check body-less async arrow function.
// ignore `async () => await foo` because it's obviously correct
'ArrowFunctionExpression[async = true] > :not(BlockStatement, AwaitExpression)'(node) {
const expression = services.esTreeNodeToTSNodeMap.get(node);
if (isThenableType(expression)) {
markAsHasAwait();
}
},
ReturnStatement(node) {
// short circuit early to avoid unnecessary type checks
if (!scopeInfo || scopeInfo.hasAwait || !scopeInfo.hasAsync) {
return;
}
const { expression } = services.esTreeNodeToTSNodeMap.get(node);
if (expression && isThenableType(expression)) {
markAsHasAwait();
}
},
};
},
});
function isEmptyFunction(node) {
return (node.body.type === utils_1.AST_NODE_TYPES.BlockStatement &&
node.body.body.length === 0);
}
function expandUnionOrIntersectionType(type) {
if (type.isUnionOrIntersection()) {
return type.types.flatMap(expandUnionOrIntersectionType);
}
return [type];
}
function hasTypeName(typeReference, typeName) {
return (typeReference.typeName.type === utils_1.AST_NODE_TYPES.Identifier &&
typeReference.typeName.name === typeName);
}
@@ -0,0 +1,3 @@
import type { SelectorsString } from './enums';
import type { Context, NormalizedSelector, ValidatorFunction } from './types';
export declare function createValidator(type: SelectorsString, context: Context, allConfigs: NormalizedSelector[]): ValidatorFunction;
@@ -0,0 +1,114 @@
'use strict';
var test = require('tape');
var getSideChannelWeakMap = require('../');
test('getSideChannelMap', { skip: typeof WeakMap !== 'function' && typeof Map !== 'function' }, function (t) {
var getSideChannel = getSideChannelWeakMap || function () {
throw new EvalError('should never happen');
};
t.test('export', function (st) {
st.equal(typeof getSideChannel, 'function', 'is a function');
st.equal(getSideChannel.length, 0, 'takes no arguments');
var channel = getSideChannel();
st.ok(channel, 'is truthy');
st.equal(typeof channel, 'object', 'is an object');
st.end();
});
t.test('assert', function (st) {
var channel = getSideChannel();
st['throws'](
function () { channel.assert({}); },
TypeError,
'nonexistent value throws'
);
var o = {};
channel.set(o, 'data');
st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops');
st.end();
});
t.test('has', function (st) {
var channel = getSideChannel();
/** @type {unknown[]} */ var o = [];
st.equal(channel.has(o), false, 'nonexistent value yields false');
channel.set(o, 'foo');
st.equal(channel.has(o), true, 'existent value yields true');
st.equal(channel.has('abc'), false, 'non object value non existent yields false');
channel.set('abc', 'foo');
st.equal(channel.has('abc'), true, 'non object value that exists yields true');
st.end();
});
t.test('get', function (st) {
var channel = getSideChannel();
var o = {};
st.equal(channel.get(o), undefined, 'nonexistent value yields undefined');
var data = {};
channel.set(o, data);
st.equal(channel.get(o), data, '"get" yields data set by "set"');
st.end();
});
t.test('set', function (st) {
var channel = getSideChannel();
var o = function () {};
st.equal(channel.get(o), undefined, 'value not set');
channel.set(o, 42);
st.equal(channel.get(o), 42, 'value was set');
channel.set(o, Infinity);
st.equal(channel.get(o), Infinity, 'value was set again');
var o2 = {};
channel.set(o2, 17);
st.equal(channel.get(o), Infinity, 'o is not modified');
st.equal(channel.get(o2), 17, 'o2 is set');
channel.set(o, 14);
st.equal(channel.get(o), 14, 'o is modified');
st.equal(channel.get(o2), 17, 'o2 is not modified');
st.end();
});
t.test('delete', function (st) {
var channel = getSideChannel();
var o = {};
st.equal(channel['delete']({}), false, 'nonexistent value yields false');
channel.set(o, 42);
st.equal(channel.has(o), true, 'value is set');
st.equal(channel['delete']({}), false, 'nonexistent value still yields false');
st.equal(channel['delete'](o), true, 'deleted value yields true');
st.equal(channel.has(o), false, 'value is no longer set');
st.end();
});
t.end();
});
test('getSideChannelMap, no WeakMaps and/or Maps', { skip: typeof WeakMap === 'function' || typeof Map === 'function' }, function (t) {
t.equal(getSideChannelWeakMap, false, 'is false');
t.end();
});
@@ -0,0 +1,24 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const MapPinX = createLucideIcon("MapPinX", [
[
"path",
{
d: "M19.752 11.901A7.78 7.78 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 19 19 0 0 0 .09-.077",
key: "y0ewhp"
}
],
["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }],
["path", { d: "m21.5 15.5-5 5", key: "11iqnx" }],
["path", { d: "m21.5 20.5-5-5", key: "1bylgx" }]
]);
export { MapPinX as default };
//# sourceMappingURL=map-pin-x.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_Z","132":"_A"},B:{"1":"_J"},C:{"1":"_pR","2":"_f","129":"_gJ"},D:{"1":"_4G","2":"_6E","257":"N _0E"},E:{"1":"_7C","2":"_4","257":"L OD","260":"ND"},F:{"1":"_a","2":"_T"},G:{"1":"_2","2":"_d","257":"fD","260":"eD"},H:{"2":"1D"},I:{"1":"_X","2":"_W"},J:{"2":"D","257":"A"},K:{"1":"H","2":"_D"},L:{"1":"I"},M:{"1":"YC"},N:{"132":"_A"},O:{"1":"bC"},P:{"1":"_F"},Q:{"1":"JE"},R:{"1":"KE"},S:{"1":"_C"}},B:4,C:"Content Security Policy 1.0",D:true};
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = addComment;
var _addComments = require("./addComments.js");
function addComment(node, type, content, line) {
return (0, _addComments.default)(node, type, [{
type: line ? "CommentLine" : "CommentBlock",
value: content
}]);
}
//# sourceMappingURL=addComment.js.map
@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const blfColorfulAppender = require("blf-colorful-appender");
const format = require("date-manip/dist/format");
const createDebug = require("debug");
class DebugAppender extends blfColorfulAppender.ColorfulAppender {
constructor() {
super(...arguments);
this.name = "debug";
this.dateFormat = "HH:mm:ss";
}
setup({ name }) {
const debug = createDebug(name);
debug.enabled = true;
debug.namespace = name;
this.debug = debug;
}
/**
* Write log (写入日志)
* @param event Log event (日志事件)
*/
write(event) {
const { layout, debug } = this;
debug.namespace = event.loggerName;
if (layout) {
debug(this.color(layout.format(event), event));
} else {
debug(
this.color(`[${format(event.timestamp, this.dateFormat)}] [${event.levelName}] -`, event),
...event.message
);
}
}
/**
* Close appender (关闭输出)
*/
close() {
return Promise.resolve();
}
}
exports.DebugAppender = DebugAppender;
@@ -0,0 +1 @@
{"version":3,"file":"dd-element.js","sourceRoot":"","sources":["../src/dd-element.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * dd-elements.ts 12.6.0\n * Copyright (c) 2021-2025 Alain Dumesny - see GridStack root license\n */\n\nimport { DDResizable, DDResizableOpt } from './dd-resizable';\nimport { DDDragOpt, GridItemHTMLElement } from './types';\nimport { DDDraggable } from './dd-draggable';\nimport { DDDroppable, DDDroppableOpt } from './dd-droppable';\n\nexport interface DDElementHost extends GridItemHTMLElement {\n ddElement?: DDElement;\n}\n\nexport class DDElement {\n\n static init(el: DDElementHost): DDElement {\n if (!el.ddElement) { el.ddElement = new DDElement(el); }\n return el.ddElement;\n }\n\n public ddDraggable?: DDDraggable;\n public ddDroppable?: DDDroppable;\n public ddResizable?: DDResizable;\n\n constructor(public el: DDElementHost) {}\n\n public on(eventName: string, callback: (event: MouseEvent) => void): DDElement {\n if (this.ddDraggable && ['drag', 'dragstart', 'dragstop'].indexOf(eventName) > -1) {\n this.ddDraggable.on(eventName as 'drag' | 'dragstart' | 'dragstop', callback);\n } else if (this.ddDroppable && ['drop', 'dropover', 'dropout'].indexOf(eventName) > -1) {\n this.ddDroppable.on(eventName as 'drop' | 'dropover' | 'dropout', callback);\n } else if (this.ddResizable && ['resizestart', 'resize', 'resizestop'].indexOf(eventName) > -1) {\n this.ddResizable.on(eventName as 'resizestart' | 'resize' | 'resizestop', callback);\n }\n return this;\n }\n\n public off(eventName: string): DDElement {\n if (this.ddDraggable && ['drag', 'dragstart', 'dragstop'].indexOf(eventName) > -1) {\n this.ddDraggable.off(eventName as 'drag' | 'dragstart' | 'dragstop');\n } else if (this.ddDroppable && ['drop', 'dropover', 'dropout'].indexOf(eventName) > -1) {\n this.ddDroppable.off(eventName as 'drop' | 'dropover' | 'dropout');\n } else if (this.ddResizable && ['resizestart', 'resize', 'resizestop'].indexOf(eventName) > -1) {\n this.ddResizable.off(eventName as 'resizestart' | 'resize' | 'resizestop');\n }\n return this;\n }\n\n public setupDraggable(opts: DDDragOpt): DDElement {\n if (!this.ddDraggable) {\n this.ddDraggable = new DDDraggable(this.el, opts);\n } else {\Line truncated
@@ -0,0 +1,439 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
const util_1 = require("../util");
const getMemberHeadLoc_1 = require("../util/getMemberHeadLoc");
const functionScopeBoundaries = [
utils_1.AST_NODE_TYPES.ArrowFunctionExpression,
utils_1.AST_NODE_TYPES.FunctionDeclaration,
utils_1.AST_NODE_TYPES.FunctionExpression,
utils_1.AST_NODE_TYPES.MethodDefinition,
].join(', ');
exports.default = (0, util_1.createRule)({
name: 'prefer-readonly',
meta: {
type: 'suggestion',
docs: {
description: "Require private members to be marked as `readonly` if they're never modified outside of the constructor",
requiresTypeChecking: true,
},
fixable: 'code',
messages: {
preferReadonly: "Member '{{name}}' is never reassigned; mark it as `readonly`.",
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
onlyInlineLambdas: {
type: 'boolean',
description: 'Whether to restrict checking only to members immediately assigned a lambda value.',
},
},
},
],
},
defaultOptions: [{ onlyInlineLambdas: false }],
create(context, [{ onlyInlineLambdas }]) {
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
const classScopeStack = [];
function handlePropertyAccessExpression(node, parent, classScope) {
if (ts.isBinaryExpression(parent)) {
handleParentBinaryExpression(node, parent, classScope);
return;
}
if (ts.isDeleteExpression(parent) || isDestructuringAssignment(node)) {
classScope.addVariableModification(node);
return;
}
if (ts.isPostfixUnaryExpression(parent) ||
ts.isPrefixUnaryExpression(parent)) {
handleParentPostfixOrPrefixUnaryExpression(parent, classScope);
}
}
function handleParentBinaryExpression(node, parent, classScope) {
if (parent.left === node &&
tsutils.isAssignmentKind(parent.operatorToken.kind)) {
classScope.addVariableModification(node);
}
}
function handleParentPostfixOrPrefixUnaryExpression(node, classScope) {
if (node.operator === ts.SyntaxKind.PlusPlusToken ||
node.operator === ts.SyntaxKind.MinusMinusToken) {
classScope.addVariableModification(node.operand);
}
}
function isDestructuringAssignment(node) {
let current = node.parent;
while (current) {
const parent = current.parent;
if (ts.isObjectLiteralExpression(parent) ||
ts.isArrayLiteralExpression(parent) ||
ts.isSpreadAssignment(parent) ||
(ts.isSpreadElement(parent) &&
ts.isArrayLiteralExpression(parent.parent))) {
current = parent;
}
else if (ts.isBinaryExpression(parent) &&
!ts.isPropertyAccessExpression(current)) {
return (parent.left === current &&
parent.operatorToken.kind === ts.SyntaxKind.EqualsToken);
}
else {
break;
}
}
return false;
}
function isFunctionScopeBoundaryInStack(node) {
if (classScopeStack.length === 0) {
return false;
}
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
if (ts.isConstructorDeclaration(tsNode)) {
return false;
}
return tsutils.isFunctionScopeBoundary(tsNode);
}
function getEsNodesFromViolatingNode(violatingNode) {
return {
esNode: services.tsNodeToESTreeNodeMap.get(violatingNode),
nameNode: services.tsNodeToESTreeNodeMap.get(violatingNode.name),
};
}
function getTypeAnnotationForViolatingNode(node, type, initializerType) {
const annotation = checker.typeToString(type);
// verify the about-to-be-added type annotation is in-scope
if (tsutils.isTypeFlagSet(initializerType, ts.TypeFlags.EnumLiteral)) {
const scope = context.sourceCode.getScope(node);
const variable = utils_1.ASTUtils.findVariable(scope, annotation);
if (variable == null) {
return null;
}
const definition = variable.defs.find(def => def.isTypeDefinition);
if (definition == null) {
return null;
}
const definitionType = services.getTypeAtLocation(definition.node);
if (definitionType !== type) {
return null;
}
}
return annotation;
}
return {
[`${functionScopeBoundaries}:exit`](node) {
if (utils_1.ASTUtils.isConstructor(node)) {
classScopeStack[classScopeStack.length - 1].exitConstructor();
}
else if (isFunctionScopeBoundaryInStack(node)) {
classScopeStack[classScopeStack.length - 1].exitNonConstructor();
}
},
'ClassDeclaration, ClassExpression'(node) {
classScopeStack.push(new ClassScope(checker, services.esTreeNodeToTSNodeMap.get(node), onlyInlineLambdas));
},
'ClassDeclaration, ClassExpression:exit'() {
const finalizedClassScope = (0, util_1.nullThrows)(classScopeStack.pop(), 'Stack should exist on class exit');
for (const violatingNode of finalizedClassScope.finalizeUnmodifiedPrivateNonReadonlys()) {
const { esNode, nameNode } = getEsNodesFromViolatingNode(violatingNode);
const reportNodeOrLoc = (() => {
switch (esNode.type) {
case utils_1.AST_NODE_TYPES.MethodDefinition:
case utils_1.AST_NODE_TYPES.PropertyDefinition:
case utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition:
return { loc: (0, getMemberHeadLoc_1.getMemberHeadLoc)(context.sourceCode, esNode) };
case utils_1.AST_NODE_TYPES.TSParameterProperty:
return {
loc: (0, getMemberHeadLoc_1.getParameterPropertyHeadLoc)(context.sourceCode, esNode, nameNode.name),
};
default:
return { node: esNode };
}
})();
const typeAnnotation = (() => {
if (esNode.type !== utils_1.AST_NODE_TYPES.PropertyDefinition) {
return null;
}
if (esNode.typeAnnotation || !esNode.value) {
return null;
}
if (nameNode.type !== utils_1.AST_NODE_TYPES.Identifier) {
return null;
}
const hasConstructorModifications = finalizedClassScope.memberHasConstructorModifications(nameNode.name);
if (!hasConstructorModifications) {
return null;
}
const violatingType = services.getTypeAtLocation(esNode);
const initializerType = services.getTypeAtLocation(esNode.value);
// if the RHS is a literal, its type would be narrowed, while the
// type of the initializer (which isn't `readonly`) would be the
// widened type
if (initializerType === violatingType) {
return null;
}
if (!tsutils.isLiteralType(initializerType)) {
return null;
}
return getTypeAnnotationForViolatingNode(esNode, violatingType, initializerType);
})();
context.report({
...reportNodeOrLoc,
messageId: 'preferReadonly',
data: {
name: context.sourceCode.getText(nameNode),
},
*fix(fixer) {
const readonlyInsertionTarget = esNode.type === utils_1.AST_NODE_TYPES.PropertyDefinition &&
esNode.computed
? (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(nameNode), 'Expected to find a token before computed property name')
: nameNode;
yield fixer.insertTextBefore(readonlyInsertionTarget, 'readonly ');
if (typeAnnotation) {
yield fixer.insertTextAfter(nameNode, `: ${typeAnnotation}`);
}
},
});
}
},
[functionScopeBoundaries](node) {
if (utils_1.ASTUtils.isConstructor(node)) {
classScopeStack[classScopeStack.length - 1].enterConstructor(services.esTreeNodeToTSNodeMap.get(node));
}
else if (isFunctionScopeBoundaryInStack(node)) {
classScopeStack[classScopeStack.length - 1].enterNonConstructor();
}
},
MemberExpression(node) {
if (classScopeStack.length === 0) {
return;
}
const classScope = classScopeStack[classScopeStack.length - 1];
if (!node.computed) {
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
handlePropertyAccessExpression(tsNode, tsNode.parent, classScope);
}
else {
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
if (ts.isElementAccessExpression(tsNode) &&
ts.isBinaryExpression(tsNode.parent) &&
tsNode.parent.left === tsNode &&
tsutils.isAssignmentKind(tsNode.parent.operatorToken.kind)) {
const memberName = (0, util_1.getStaticMemberAccessValue)(node, context);
if (typeof memberName === 'string') {
classScope.addVariableModificationByName(tsNode.expression, memberName);
}
}
}
},
};
},
});
const OUTSIDE_CONSTRUCTOR = -1;
const DIRECTLY_INSIDE_CONSTRUCTOR = 0;
var TypeToClassRelation;
(function (TypeToClassRelation) {
TypeToClassRelation[TypeToClassRelation["ClassAndInstance"] = 0] = "ClassAndInstance";
TypeToClassRelation[TypeToClassRelation["Class"] = 1] = "Class";
TypeToClassRelation[TypeToClassRelation["Instance"] = 2] = "Instance";
TypeToClassRelation[TypeToClassRelation["None"] = 3] = "None";
})(TypeToClassRelation || (TypeToClassRelation = {}));
class ClassScope {
checker;
onlyInlineLambdas;
classType;
constructorScopeDepth = OUTSIDE_CONSTRUCTOR;
memberVariableModifications = new Set();
memberVariableWithConstructorModifications = new Set();
privateModifiableMembers = new Map();
privateModifiableStatics = new Map();
staticVariableModifications = new Set();
constructor(checker, classNode, onlyInlineLambdas) {
this.checker = checker;
this.onlyInlineLambdas = onlyInlineLambdas;
const classType = checker.getTypeAtLocation(classNode);
if (tsutils.isIntersectionType(classType)) {
this.classType = classType.types[0];
}
else {
this.classType = classType;
}
for (const member of classNode.members) {
if (ts.isPropertyDeclaration(member)) {
this.addDeclaredVariable(member);
}
}
}
addDeclaredVariable(node) {
if (!(tsutils.isModifierFlagSet(node, ts.ModifierFlags.Private) ||
node.name.kind === ts.SyntaxKind.PrivateIdentifier) ||
tsutils.isModifierFlagSet(node, ts.ModifierFlags.Accessor | ts.ModifierFlags.Readonly)) {
return;
}
if (this.onlyInlineLambdas &&
node.initializer != null &&
!ts.isArrowFunction(node.initializer)) {
return;
}
const memberName = getMemberName(node.name);
if (memberName == null) {
return;
}
(tsutils.isModifierFlagSet(node, ts.ModifierFlags.Static)
? this.privateModifiableStatics
: this.privateModifiableMembers).set(memberName, node);
}
addVariableModification(node) {
this.addVariableModificationByName(node.expression, node.name.text);
}
addVariableModificationByName(expression, memberName) {
const modifierType = this.checker.getTypeAtLocation(expression);
const relationOfModifierTypeToClass = this.getTypeToClassRelation(modifierType);
if (relationOfModifierTypeToClass === TypeToClassRelation.Instance &&
this.constructorScopeDepth === DIRECTLY_INSIDE_CONSTRUCTOR) {
this.memberVariableWithConstructorModifications.add(memberName);
return;
}
if (relationOfModifierTypeToClass === TypeToClassRelation.Instance ||
relationOfModifierTypeToClass === TypeToClassRelation.ClassAndInstance) {
this.memberVariableModifications.add(memberName);
}
if (relationOfModifierTypeToClass === TypeToClassRelation.Class ||
relationOfModifierTypeToClass === TypeToClassRelation.ClassAndInstance) {
this.staticVariableModifications.add(memberName);
}
}
enterConstructor(node) {
this.constructorScopeDepth = DIRECTLY_INSIDE_CONSTRUCTOR;
for (const parameter of node.parameters) {
if (tsutils.isModifierFlagSet(parameter, ts.ModifierFlags.Private)) {
this.addDeclaredVariable(parameter);
}
}
}
enterNonConstructor() {
if (this.constructorScopeDepth !== OUTSIDE_CONSTRUCTOR) {
this.constructorScopeDepth += 1;
}
}
exitConstructor() {
this.constructorScopeDepth = OUTSIDE_CONSTRUCTOR;
}
exitNonConstructor() {
if (this.constructorScopeDepth !== OUTSIDE_CONSTRUCTOR) {
this.constructorScopeDepth -= 1;
}
}
finalizeUnmodifiedPrivateNonReadonlys() {
this.memberVariableModifications.forEach(variableName => {
this.privateModifiableMembers.delete(variableName);
});
this.staticVariableModifications.forEach(variableName => {
this.privateModifiableStatics.delete(variableName);
});
return [
...this.privateModifiableMembers.values(),
...this.privateModifiableStatics.values(),
];
}
getTypeToClassRelation(type) {
if (type.isIntersection()) {
let result = TypeToClassRelation.None;
for (const subType of type.types) {
const subTypeResult = this.getTypeToClassRelation(subType);
switch (subTypeResult) {
case TypeToClassRelation.Class:
if (result === TypeToClassRelation.Instance) {
return TypeToClassRelation.ClassAndInstance;
}
result = TypeToClassRelation.Class;
break;
case TypeToClassRelation.Instance:
if (result === TypeToClassRelation.Class) {
return TypeToClassRelation.ClassAndInstance;
}
result = TypeToClassRelation.Instance;
break;
}
}
return result;
}
if (type.isUnion()) {
// any union of class/instance and something else will prevent access to
// private members, so we assume that union consists only of classes
// or class instances, because otherwise tsc will report an error
return this.getTypeToClassRelation(type.types[0]);
}
if (!type.getSymbol() || !(0, util_1.typeIsOrHasBaseType)(type, this.classType)) {
return TypeToClassRelation.None;
}
const typeIsClass = tsutils.isObjectType(type) &&
tsutils.isObjectFlagSet(type, ts.ObjectFlags.Anonymous);
if (typeIsClass) {
return TypeToClassRelation.Class;
}
return TypeToClassRelation.Instance;
}
memberHasConstructorModifications(name) {
return this.memberVariableWithConstructorModifications.has(name);
}
}
function getMemberName(name) {
if (ts.isIdentifier(name) ||
ts.isPrivateIdentifier(name) ||
ts.isStringLiteral(name) ||
ts.isNoSubstitutionTemplateLiteral(name) ||
ts.isNumericLiteral(name)) {
return name.text;
}
if (ts.isComputedPropertyName(name)) {
const expression = name.expression;
if (ts.isNumericLiteral(expression)) {
return expression.text;
}
if (ts.isPropertyAccessExpression(expression) &&
ts.isIdentifier(expression.expression) &&
expression.expression.text === 'Symbol') {
return expression.getText();
}
}
return undefined;
}
@@ -0,0 +1,28 @@
{
"name": "require-from-string",
"version": "2.0.2",
"description": "Require module from string",
"license": "MIT",
"repository": "floatdrop/require-from-string",
"author": {
"name": "Vsevolod Strukchinsky",
"email": "floatdrop@gmail.com",
"url": "github.com/floatdrop"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"files": [
"index.js"
],
"keywords": [
""
],
"dependencies": {},
"devDependencies": {
"mocha": "*"
}
}
@@ -0,0 +1 @@
{"version":3,"file":"refresh-cw-off.js","sources":["../../../src/icons/refresh-cw-off.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name RefreshCwOff\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMjEgOEwxOC43NCA1Ljc0QTkuNzUgOS43NSAwIDAgMCAxMiAzQzExIDMgMTAuMDMgMy4xNiA5LjEzIDMuNDciIC8+CiAgPHBhdGggZD0iTTggMTZIM3Y1IiAvPgogIDxwYXRoIGQ9Ik0zIDEyQzMgOS41MSA0IDcuMjYgNS42NCA1LjY0IiAvPgogIDxwYXRoIGQ9Im0zIDE2IDIuMjYgMi4yNkE5Ljc1IDkuNzUgMCAwIDAgMTIgMjFjMi40OSAwIDQuNzQtMSA2LjM2LTIuNjQiIC8+CiAgPHBhdGggZD0iTTIxIDEyYzAgMS0uMTYgMS45Ny0uNDcgMi44NyIgLz4KICA8cGF0aCBkPSJNMjEgM3Y1aC01IiAvPgogIDxwYXRoIGQ9Ik0yMiAyMiAyIDIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/refresh-cw-off\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst RefreshCwOff = createLucideIcon('RefreshCwOff', [\n ['path', { d: 'M21 8L18.74 5.74A9.75 9.75 0 0 0 12 3C11 3 10.03 3.16 9.13 3.47', key: '1krf6h' }],\n ['path', { d: 'M8 16H3v5', key: '1cv678' }],\n ['path', { d: 'M3 12C3 9.51 4 7.26 5.64 5.64', key: 'ruvoct' }],\n ['path', { d: 'm3 16 2.26 2.26A9.75 9.75 0 0 0 12 21c2.49 0 4.74-1 6.36-2.64', key: '19q130' }],\n ['path', { d: 'M21 12c0 1-.16 1.97-.47 2.87', key: '4w8emr' }],\n ['path', { d: 'M21 3v5h-5', key: '1q7to0' }],\n ['path', { d: 'M22 22 2 2', key: '1r8tn9' }],\n]);\n\nexport default RefreshCwOff;\n"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
{"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,GAAG,GAAG,MAAM,CAAC;AAClB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,GAAG,CAC7B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;CAAC,EAClC;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,IAAI;CAAC,EACxC;IAAE,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,GAAG,CAC9B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;CAAC,EAC5B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,YAAY;IAAE,WAAW;CAAC,EACvD;IACE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CACF,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACpD,KAAK,OAAO,GAAG,sBAAsB,EAAE,CAAC;AACxC,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,EAAE,CAyCnE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAQpE;AA2CD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAoGrE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAUtE"}
@@ -0,0 +1,25 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Gamepad2 = createLucideIcon("Gamepad2", [
["line", { x1: "6", x2: "10", y1: "11", y2: "11", key: "1gktln" }],
["line", { x1: "8", x2: "8", y1: "9", y2: "13", key: "qnk9ow" }],
["line", { x1: "15", x2: "15.01", y1: "12", y2: "12", key: "krot7o" }],
["line", { x1: "18", x2: "18.01", y1: "10", y2: "10", key: "1lcuu1" }],
[
"path",
{
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",
key: "mfqc10"
}
]
]);
export { Gamepad2 as default };
//# sourceMappingURL=gamepad-2.js.map
@@ -0,0 +1,16 @@
import type { TSESLint } from '@typescript-eslint/utils';
export type MessageIds = 'noShadow' | 'noShadowGlobal';
export type Options = [
{
allow?: string[];
builtinGlobals?: boolean;
hoist?: 'all' | 'functions' | 'functions-and-types' | 'never' | 'types';
ignoreFunctionTypeParameterNameValueShadow?: boolean;
ignoreOnInitialization?: boolean;
ignoreTypeValueShadow?: boolean;
}
];
declare const _default: TSESLint.RuleModule<MessageIds, Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1,201 @@
'use strict';
var MagicString = require('magic-string');
var mlly = require('mlly');
function internalFixDefaultCJSExports(code, info, options) {
const parsedExports = extractExports(code, info, options);
if (!parsedExports) {
return;
}
if (parsedExports.defaultExport.specifier) {
const imports = [];
for (const imp of mlly.findStaticImports(code)) {
if (!imp.imports) {
continue;
}
imports.push(mlly.parseStaticImport(imp));
}
const specifier = parsedExports.defaultExport.specifier;
const defaultImport = imports.find((i) => i.specifier === specifier);
return parsedExports.defaultExport._type === "named" ? handleDefaultNamedCJSExport(
code,
info,
parsedExports,
imports,
options,
defaultImport
) : handleDefaultCJSExportAsDefault(
code,
parsedExports,
imports,
defaultImport
) || handleNoSpecifierDefaultCJSExport(code, info, parsedExports);
}
return handleNoSpecifierDefaultCJSExport(code, info, parsedExports);
}
function extractExports(code, info, options) {
const defaultExport = mlly.findExports(code).find(
(e) => e.names.includes("default")
);
if (!defaultExport) {
options.warn?.(
/* c8 ignore next */
`No default export found in ${info.fileName}, it contains default export but cannot be parsed.`
);
return;
}
const match = defaultExport.code.match(/export\s*\{([^}]*)\}/);
if (!match?.length) {
options.warn?.(
`No default export found in ${info.fileName}, it contains default export but cannot be parsed.`
);
return;
}
let defaultAlias;
const exportsEntries = [];
for (const exp of match[1].split(",").map((e) => e.trim())) {
if (exp === "default") {
defaultAlias = exp;
continue;
}
const m = exp.match(/\s*as\s+default\s*/);
if (m) {
defaultAlias = exp.replace(m[0], "");
} else {
exportsEntries.push(exp);
}
}
if (!defaultAlias) {
options.warn?.(
`No default export found in ${info.fileName}, it contains default export but cannot be parsed.`
);
return;
}
return {
defaultExport,
defaultAlias,
exports: exportsEntries
};
}
function handleDefaultCJSExportAsDefault(code, { defaultExport, exports }, imports, defaultImport) {
if (defaultImport) {
return exports.length === 0 ? code.replace(
defaultExport.code,
`export = ${defaultImport.defaultImport}`
) : code.replace(
defaultExport.code,
`// @ts-ignore
export = ${defaultImport.defaultImport};
export { ${exports.join(", ")} } from '${defaultExport.specifier}'`
);
} else {
const magicString = new MagicString(code);
const lastImportPosition = imports.length > 0 ? imports.at(-1)?.end || 0 : 0;
if (lastImportPosition > 0) {
magicString.appendRight(
lastImportPosition,
`
import _default from '${defaultExport.specifier}';
`
);
} else {
magicString.prepend(
`import _default from '${defaultExport.specifier}';
`
);
}
return exports.length > 0 ? magicString.replace(
defaultExport.code,
`// @ts-ignore
export = _default;
export { ${exports.join(", ")} } from '${defaultExport.specifier}'`
).toString() : magicString.replace(defaultExport.code, "export = _default").toString();
}
}
function handleDefaultNamedCJSExport(code, info, parsedExports, imports, options, defaultImport) {
const { defaultAlias, defaultExport, exports } = parsedExports;
if (defaultAlias === "default") {
if (defaultImport && !defaultImport.defaultImport) {
options.warn?.(
`Cannot parse default export name from ${defaultImport.specifier} import at ${info.fileName}!.`
);
return;
}
return handleDefaultCJSExportAsDefault(
code,
parsedExports,
imports,
defaultImport
);
}
if (defaultImport) {
const namedExports = defaultImport.namedImports;
if (namedExports?.[defaultAlias] === defaultAlias) {
return exports.length === 0 ? code.replace(defaultExport.code, `export = ${defaultAlias}`) : code.replace(
defaultExport.code,
`// @ts-ignore
export = ${defaultAlias};
export { ${exports.join(", ")} }`
);
} else {
options.warn?.(
`Cannot parse "${defaultAlias}" named export from ${defaultImport.specifier} import at ${info.fileName}!.`
);
return void 0;
}
}
const magicString = new MagicString(code);
const lastImportPosition = imports.length > 0 ? imports.at(-1)?.end || 0 : 0;
if (lastImportPosition > 0) {
magicString.appendRight(
lastImportPosition,
`
import { ${defaultAlias} } from '${defaultExport.specifier}';
`
);
} else {
magicString.prepend(
`import { ${defaultAlias} } from '${defaultExport.specifier}';
`
);
}
return exports.length > 0 ? magicString.replace(
defaultExport.code,
`// @ts-ignore
export = ${defaultAlias};
export { ${exports.join(", ")} } from '${defaultExport.specifier}'`
).toString() : magicString.replace(defaultExport.code, `export = ${defaultAlias}`).toString();
}
function handleNoSpecifierDefaultCJSExport(code, info, { defaultAlias, defaultExport, exports }) {
let exportStatement = exports.length > 0 ? void 0 : "";
if (exportStatement === void 0) {
let someExternalExport = false;
const typeExportRegexp = /\s*type\s+/;
const allRemainingExports = exports.map((exp) => {
if (someExternalExport) {
return [exp, ""];
}
if (!info.imports.includes(exp)) {
const m = exp.match(typeExportRegexp);
if (m) {
const name = exp.replace(m[0], "").trim();
if (!info.imports.includes(name)) {
return [exp, name];
}
}
}
someExternalExport = true;
return [exp, ""];
});
exportStatement = someExternalExport ? `;
export { ${allRemainingExports.map(([e, _]) => e).join(", ")} }` : `;
export type { ${allRemainingExports.map(([_, t]) => t).join(", ")} }`;
}
return code.replace(
defaultExport.code,
`${exportStatement.length > 0 ? "// @ts-ignore\n" : ""}export = ${defaultAlias}${exportStatement}`
);
}
exports.internalFixDefaultCJSExports = internalFixDefaultCJSExports;
@@ -0,0 +1 @@
{"version":3,"names":["_OverloadYield","require","_regeneratorDefine","AsyncIterator","generator","PromiseImpl","next","define","prototype","Symbol","asyncIterator","invoke","method","arg","resolve","reject","result","value","OverloadYield","v","then","err","unwrapped","error","previousPromise","enqueue","i","callInvokeWithMethodAndArg"],"sources":["../../src/helpers/regeneratorAsyncIterator.ts"],"sourcesContent":["/* @minVersion 7.27.0 */\n/* @mangleFns */\n/* @internal */\n\nimport OverloadYield from \"./OverloadYield.ts\";\nimport define from \"./regeneratorDefine.ts\";\n\nexport default /* @no-mangle */ function AsyncIterator(\n this: any,\n generator: Generator,\n PromiseImpl: PromiseConstructor,\n) {\n if (!this.next) {\n define(AsyncIterator.prototype);\n define(\n AsyncIterator.prototype,\n (typeof Symbol === \"function\" && Symbol.asyncIterator) ||\n \"@asyncIterator\",\n function (this: any) {\n return this;\n },\n );\n }\n\n function invoke(\n method: \"next\" | \"throw\" | \"return\",\n arg: any,\n resolve: (value: any) => void,\n reject: (error: any) => void,\n ): any {\n try {\n var result = generator[method](arg);\n var value = result.value;\n if (value instanceof OverloadYield) {\n return PromiseImpl.resolve(value.v).then(\n function (value) {\n invoke(\"next\", value, resolve, reject);\n },\n function (err) {\n invoke(\"throw\", err, resolve, reject);\n },\n );\n }\n\n return PromiseImpl.resolve(value).then(\n function (unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n },\n function (error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n },\n );\n } catch (error) {\n reject(error);\n }\n }\n\n var previousPromise: Promise<any>;\n\n function enqueue(method: \"next\" | \"throw\" | \"return\", i: number, arg: any) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function (resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return (previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise\n ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg,\n )\n : callInvokeWithMethodAndArg());\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n define(this, \"_invoke\", enqueue, true);\n}\n"],"mappings":";;;;;;AAIA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEgC,SAASE,aAAaA,CAEpDC,SAAoB,EACpBC,WAA+B,EAC/B;EACA,IAAI,CAAC,IAAI,CAACC,IAAI,EAAE;IACd,IAAAC,0BAAM,EAACJ,aAAa,CAACK,SAAS,CAAC;IAC/B,IAAAD,0BAAM,EACJJ,aAAa,CAACK,SAAS,EACtB,OAAOC,MAAM,KAAK,UAAU,IAAIA,MAAM,CAACC,aAAa,IACnD,gBAAgB,EAClB,YAAqB;MACnB,OAAO,IAAI;IACb,CACF,CAAC;EACH;EAEA,SAASC,MAAMA,CACbC,MAAmC,EACnCC,GAAQ,EACRC,OAA6B,EAC7BC,MAA4B,EACvB;IACL,IAAI;MACF,IAAIC,MAAM,GAAGZ,SAAS,CAACQ,MAAM,CAAC,CAACC,GAAG,CAAC;MACnC,IAAII,KAAK,GAAGD,MAAM,CAACC,KAAK;MACxB,IAAIA,KAAK,YAAYC,sBAAa,EAAE;QAClC,OAAOb,WAAW,CAACS,OAAO,CAACG,KAAK,CAACE,CAAC,CAAC,CAACC,IAAI,CACtC,UAAUH,KAAK,EAAE;UACfN,MAAM,CAAC,MAAM,EAAEM,KAAK,EAAEH,OAAO,EAAEC,MAAM,CAAC;QACxC,CAAC,EACD,UAAUM,GAAG,EAAE;UACbV,MAAM,CAAC,OAAO,EAAEU,GAAG,EAAEP,OAAO,EAAEC,MAAM,CAAC;QACvC,CACF,CAAC;MACH;MAEA,OAAOV,WAAW,CAACS,OAAO,CAACG,KAAK,CAAC,CAACG,IAAI,CACpC,UAAUE,SAAS,EAAE;QAInBN,MAAM,CAACC,KAAK,GAAGK,SAAS;QACxBR,OAAO,CAACE,MAAM,CAAC;MACjB,CAAC,EACD,UAAUO,KAAK,EAAE;QAGf,OAAOZ,MAAM,CAAC,OAAO,EAAEY,KAAK,EAAET,OAAO,EAAEC,MAAM,CAAC;MAChD,CACF,CAAC;IACH,CAAC,CAAC,OAAOQ,KAAK,Line truncated
@@ -0,0 +1,88 @@
/**
* @fileoverview The FileContext class.
* @author Nicholas C. Zakas
*/
"use strict";
/**
* Represents a file context that the linter can use to lint a file.
*/
class FileContext {
/**
* The current working directory.
* @type {string}
*/
cwd;
/**
* The filename of the file being linted.
* @type {string}
*/
filename;
/**
* The physical filename of the file being linted.
* @type {string}
*/
physicalFilename;
/**
* The source code of the file being linted.
* @type {SourceCode}
*/
sourceCode;
/**
* The language options used when parsing this file.
* @type {Record<string, unknown>}
*/
languageOptions;
/**
* The settings for the file being linted.
* @type {Record<string, unknown>}
*/
settings;
/**
* Creates a new instance.
* @param {Object} config The configuration object for the file context.
* @param {string} config.cwd The current working directory.
* @param {string} config.filename The filename of the file being linted.
* @param {string} config.physicalFilename The physical filename of the file being linted.
* @param {SourceCode} config.sourceCode The source code of the file being linted.
* @param {Record<string, unknown>} config.languageOptions The language options used when parsing this file.
* @param {Record<string, unknown>} config.settings The settings for the file being linted.
*/
constructor({
cwd,
filename,
physicalFilename,
sourceCode,
languageOptions,
settings,
}) {
this.cwd = cwd;
this.filename = filename;
this.physicalFilename = physicalFilename;
this.sourceCode = sourceCode;
this.languageOptions = languageOptions;
this.settings = settings;
Object.freeze(this);
}
/**
* Creates a new object with the current object as the prototype and
* the specified properties as its own properties.
* @param {Object} extension The properties to add to the new object.
* @returns {FileContext} A new object with the current object as the prototype
* and the specified properties as its own properties.
*/
extend(extension) {
return Object.freeze(Object.assign(Object.create(this), extension));
}
}
exports.FileContext = FileContext;
@@ -0,0 +1,6 @@
/**
* Server-only helper to emit a script tag exactly once during SSR.
*/
export declare function ScriptOnce({ children }: {
children: string;
}): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,59 @@
import type Benchmark from "benchmark";
import datetimeBenchmarks from "./datetime.js";
import discriminatedUnionBenchmarks from "./discriminatedUnion.js";
import ipv4Benchmarks from "./ipv4.js";
import objectBenchmarks from "./object.js";
import primitiveBenchmarks from "./primitives.js";
import realworld from "./realworld.js";
import stringBenchmarks from "./string.js";
import unionBenchmarks from "./union.js";
const argv = process.argv.slice(2);
let suites: Benchmark.Suite[] = [];
if (!argv.length) {
suites = [
...realworld.suites,
...primitiveBenchmarks.suites,
...stringBenchmarks.suites,
...objectBenchmarks.suites,
...unionBenchmarks.suites,
...discriminatedUnionBenchmarks.suites,
];
} else {
if (argv.includes("--realworld")) {
suites.push(...realworld.suites);
}
if (argv.includes("--primitives")) {
suites.push(...primitiveBenchmarks.suites);
}
if (argv.includes("--string")) {
suites.push(...stringBenchmarks.suites);
}
if (argv.includes("--object")) {
suites.push(...objectBenchmarks.suites);
}
if (argv.includes("--union")) {
suites.push(...unionBenchmarks.suites);
}
if (argv.includes("--discriminatedUnion")) {
suites.push(...datetimeBenchmarks.suites);
}
if (argv.includes("--datetime")) {
suites.push(...datetimeBenchmarks.suites);
}
if (argv.includes("--ipv4")) {
suites.push(...ipv4Benchmarks.suites);
}
}
for (const suite of suites) {
suite.run({});
}
// exit on Ctrl-C
process.on("SIGINT", function () {
console.log("Exiting...");
process.exit();
});
@@ -0,0 +1,4 @@
# @floating-ui/dom
This is the library to use Floating UI on the web, wrapping `@floating-ui/core`
with DOM interface logic.
@@ -0,0 +1,19 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const ContactRound = createLucideIcon("ContactRound", [
["path", { d: "M16 2v2", key: "scm5qe" }],
["path", { d: "M17.915 22a6 6 0 0 0-12 0", key: "suqz9p" }],
["path", { d: "M8 2v2", key: "pbkmx" }],
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
["rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", key: "12vinp" }]
]);
export { ContactRound as default };
//# sourceMappingURL=contact-round.js.map
@@ -0,0 +1,996 @@
/// <reference types="node" />
import * as fs from "fs";
import * as jsonfile from "jsonfile";
import { StringifyOptions } from "jsonfile/utils";
export * from "fs";
/**
* Copy a file or directory. The directory can have contents.
*
* @param src Note that if `src` is a directory it will copy everything inside of this directory,
* not the entire directory itself (see [issue #537](https://github.com/jprichardson/node-fs-extra/issues/537)).
* @param dest Note that if `src` is a file, `dest` cannot be a directory
* (see [issue #323](https://github.com/jprichardson/node-fs-extra/issues/323)).
*
* @example
* import * as fs from 'fs-extra'
*
* // With a callback:
* fs.copy('/tmp/myfile', '/tmp/mynewfile', err => {
* if (err) return console.error(err)
* console.log('success!')
* }) // copies file
*
* fs.copy('/tmp/mydir', '/tmp/mynewdir', err => {
* if (err) return console.error(err)
* console.log('success!')
* }) // copies directory, even if it has subdirectories or files
*
* // With Promises:
* fs.copy('/tmp/myfile', '/tmp/mynewfile')
* .then(() => {
* console.log('success!')
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.copy('/tmp/myfile', '/tmp/mynewfile')
* console.log('success!')
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*
* // Using filter function
* fs.copy(
* '/tmp/mydir',
* '/tmp/mynewdir',
* {
* filter(src, dest) {
* // your logic here
* // it will be copied if return true
* }
* },
* err => {
* if (err) return console.error(err)
* console.log('success!')
* }
* )
*/
export function copy(src: string, dest: string, options?: CopyOptions): Promise<void>;
export function copy(src: string, dest: string, callback: NoParamCallbackWithUndefined): void;
export function copy(src: string, dest: string, options: CopyOptions, callback: NoParamCallbackWithUndefined): void;
/**
* Copy a file or directory. The directory can have contents.
*
* @param src Note that if `src` is a directory it will copy everything inside of this directory,
* not the entire directory itself (see [issue #537](https://github.com/jprichardson/node-fs-extra/issues/537)).
* @param dest Note that if `src` is a file, `dest` cannot be a directory
* (see [issue #323](https://github.com/jprichardson/node-fs-extra/issues/323)).
*
* @example
* import * as fs from 'fs-extra'
*
* // copy file
* fs.copySync('/tmp/myfile', '/tmp/mynewfile')
*
* // copy directory, even if it has subdirectories or files
* fs.copySync('/tmp/mydir', '/tmp/mynewdir')
*
* // Using filter function
* fs.copySync('/tmp/mydir', '/tmp/mynewdir', {
* filter(src, dest) {
* // your logic here
* // it will be copied if return true
* }
* })
*/
export function copySync(src: string, dest: string, options?: CopyOptionsSync): void;
/**
* Moves a file or directory, even across devices.
*
* @param dest Note: When `src` is a file, `dest` must be a file and when `src` is a directory, `dest` must be a directory.
*
* @example
* import * as fs from 'fs-extra'
*
* const src = '/tmp/file.txt'
* const dest = '/tmp/this/path/does/not/exist/file.txt'
*
* // With a callback:
* fs.move(src, dest, err => {
* if (err) return console.error(err)
* console.log('success!')
* })
*
* // With Promises:
* fs.move(src, dest)
* .then(() => {
* console.log('success!')
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.move(src, dest)
* console.log('success!')
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*
* // Using `overwrite` option
* fs.move('/tmp/somedir', '/tmp/may/already/exist/somedir', { overwrite: true }, err => {
* if (err) return console.error(err)
* console.log('success!')
* })
*/
export function move(src: string, dest: string, options?: MoveOptions): Promise<void>;
export function move(src: string, dest: string, callback: NoParamCallbackWithUndefined): void;
export function move(src: string, dest: string, options: MoveOptions, callback: NoParamCallbackWithUndefined): void;
/**
* Moves a file or directory, even across devices.
*
* @param dest Note: When `src` is a file, `dest` must be a file and when `src` is a directory, `dest` must be a directory.
*
* @example
* import * as fs from 'fs-extra'
*
* fs.moveSync('/tmp/somefile', '/tmp/does/not/exist/yet/somefile')
*
* // Using `overwrite` option
* fs.moveSync('/tmp/somedir', '/tmp/may/already/exist/somedir', { overwrite: true })
*/
export function moveSync(src: string, dest: string, options?: MoveOptions): void;
/**
* Ensures that the file exists. If the file that is requested to be created is in
* directories that do not exist, these directories are created. If the file already
* exists, it is **NOT MODIFIED**.
*
* @example
* import * as fs from 'fs-extra'
*
* const file = '/tmp/this/path/does/not/exist/file.txt'
*
* // With a callback:
* fs.ensureFile(file, err => {
* console.log(err) // => null
* // file has now been created, including the directory it is to be placed in
* })
*
* // With Promises:
* fs.ensureFile(file)
* .then(() => {
* console.log('success!')
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.ensureFile(file)
* console.log('success!')
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*/
export function ensureFile(file: string): Promise<void>;
export function ensureFile(file: string, callback: NoParamCallbackWithUndefined): void;
/**
* @see ensureFile
*/
export const createFile: typeof ensureFile;
/**
* Ensures that the file exists. If the file that is requested to be created is in
* directories that do not exist, these directories are created. If the file already
* exists, it is **NOT MODIFIED**.
*
* @example
* import * as fs from 'fs-extra'
*
* const file = '/tmp/this/path/does/not/exist/file.txt'
* fs.ensureFileSync(file)
* // file has now been created, including the directory it is to be placed in
*/
export function ensureFileSync(file: string): void;
/**
* @see ensureFileSync
*/
export const createFileSync: typeof ensureFileSync;
/**
* Ensures that the link exists. If the directory structure does not exist, it is created.
*
* @example
* import * as fs from 'fs-extra'
*
* const srcPath = '/tmp/file.txt'
* const destPath = '/tmp/this/path/does/not/exist/file.txt'
*
* // With a callback:
* fs.ensureLink(srcPath, destPath, err => {
* console.log(err) // => null
* // link has now been created, including the directory it is to be placed in
* })
*
* // With Promises:
* fs.ensureLink(srcPath, destPath)
* .then(() => {
* console.log('success!')
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.ensureLink(srcPath, destPath)
* console.log('success!')
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*/
export function ensureLink(src: string, dest: string): Promise<void>;
export function ensureLink(src: string, dest: string, callback: fs.NoParamCallback): void;
/**
* @see ensureLink
*/
export const createLink: typeof ensureLink;
/**
* Ensures that the link exists. If the directory structure does not exist, it is created.
*
* @example
* import * as fs from 'fs-extra'
*
* const srcPath = '/tmp/file.txt'
* const destPath = '/tmp/this/path/does/not/exist/file.txt'
* fs.ensureLinkSync(srcPath, destPath)
* // link has now been created, including the directory it is to be placed in
*/
export function ensureLinkSync(src: string, dest: string): void;
/**
* @see ensureLinkSync
*/
export const createLinkSync: typeof ensureLinkSync;
/**
* Ensures that the symlink exists. If the directory structure does not exist, it is created.
*
* @param type It is only available on Windows and ignored on other platforms.
*
* @example
* import * as fs from 'fs-extra'
*
* const srcPath = '/tmp/file.txt'
* const destPath = '/tmp/this/path/does/not/exist/file.txt'
*
* // With a callback:
* fs.ensureSymlink(srcPath, destPath, err => {
* console.log(err) // => null
* // symlink has now been created, including the directory it is to be placed in
* })
*
* // With Promises:
* fs.ensureSymlink(srcPath, destPath)
* .then(() => {
* console.log('success!')
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.ensureSymlink(srcPath, destPath)
* console.log('success!')
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*/
export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise<void>;
export function ensureSymlink(src: string, dest: string, callback: fs.NoParamCallback): void;
export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: fs.NoParamCallback): void;
/**
* @see ensureSymlink
*/
export const createSymlink: typeof ensureSymlink;
/**
* Ensures that the symlink exists. If the directory structure does not exist, it is created.
*
* @param type It is only available on Windows and ignored on other platforms.
*
* @example
* import * as fs from 'fs-extra'
*
* const srcPath = '/tmp/file.txt'
* const destPath = '/tmp/this/path/does/not/exist/file.txt'
* fs.ensureSymlinkSync(srcPath, destPath)
* // symlink has now been created, including the directory it is to be placed in
*/
export function ensureSymlinkSync(src: string, dest: string, type?: SymlinkType): void;
/**
* @see ensureSymlinkSync
*/
export const createSymlinkSync: typeof ensureSymlinkSync;
/**
* Ensures that the directory exists. If the directory structure does not exist, it is created.
*
* @example
* import * as fs from 'fs-extra'
*
* const dir = '/tmp/this/path/does/not/exist'
* const desiredMode = 0o2775
* const options = {
* mode: 0o2775
* }
*
* // With a callback:
* fs.ensureDir(dir, err => {
* console.log(err) // => null
* // dir has now been created, including the directory it is to be placed in
* })
*
* // With a callback and a mode integer
* fs.ensureDir(dir, desiredMode, err => {
* console.log(err) // => null
* // dir has now been created with mode 0o2775, including the directory it is to be placed in
* })
*
* // With Promises:
* fs.ensureDir(dir)
* .then(() => {
* console.log('success!')
* })
* .catch(err => {
* console.error(err)
* })
*
* // With Promises and a mode integer:
* fs.ensureDir(dir, desiredMode)
* .then(() => {
* console.log('success!')
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.ensureDir(dir)
* console.log('success!')
* } catch (err) {
* console.error(err)
* }
* }
* asyncAwait()
*
* // With async/await and an options object, containing mode:
* async function asyncAwaitMode () {
* try {
* await fs.ensureDir(dir, options)
* console.log('success!')
* } catch (err) {
* console.error(err)
* }
* }
* asyncAwaitMode()
*/
export function ensureDir(path: string, options?: EnsureDirOptions | number): Promise<void>;
export function ensureDir(path: string, callback: fs.NoParamCallback): void;
export function ensureDir(path: string, options: EnsureDirOptions | number, callback: fs.NoParamCallback): void;
/**
* Ensures that the directory exists. If the directory structure does not exist, it is created.
* If provided, options may specify the desired mode for the directory.
*
* @example
* import * as fs from 'fs-extra'
*
* const dir = '/tmp/this/path/does/not/exist'
*
* const desiredMode = 0o2775
* const options = {
* mode: 0o2775
* }
*
* fs.ensureDirSync(dir)
* // dir has now been created, including the directory it is to be placed in
*
* fs.ensureDirSync(dir, desiredMode)
* // dir has now been created, including the directory it is to be placed in with permission 0o2775
*
* fs.ensureDirSync(dir, options)
* // dir has now been created, including the directory it is to be placed in with permission 0o2775
*/
export function ensureDirSync(path: string, options?: EnsureDirOptions | number): void;
/**
* @see ensureDir
*/
export const mkdirs: typeof ensureDir;
/**
* @see ensureDirSync
*/
export const mkdirsSync: typeof ensureDirSync;
/**
* @see ensureDir
*/
export const mkdirp: typeof ensureDir;
/**
* @see ensureDirSync
*/
export const mkdirpSync: typeof ensureDirSync;
/**
* Almost the same as `writeFile` (i.e. it overwrites), except that if the parent directory
* does not exist, it's created.
*
* @example
* import * as fs from 'fs-extra'
*
* const file = '/tmp/this/path/does/not/exist/file.txt'
*
* // With a callback:
* fs.outputFile(file, 'hello!', err => {
* console.log(err) // => null
*
* fs.readFile(file, 'utf8', (err, data) => {
* if (err) return console.error(err)
* console.log(data) // => hello!
* })
* })
*
* // With Promises:
* fs.outputFile(file, 'hello!')
* .then(() => fs.readFile(file, 'utf8'))
* .then(data => {
* console.log(data) // => hello!
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.outputFile(file, 'hello!')
*
* const data = await fs.readFile(file, 'utf8')
*
* console.log(data) // => hello!
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*/
export function outputFile(
file: string,
data: string | NodeJS.ArrayBufferView,
options?: fs.WriteFileOptions,
): Promise<void>;
export function outputFile(file: string, data: string | NodeJS.ArrayBufferView, callback: fs.NoParamCallback): void;
export function outputFile(
file: string,
data: string | NodeJS.ArrayBufferView,
options: fs.WriteFileOptions,
callback: fs.NoParamCallback,
): void;
/**
* Almost the same as `writeFileSync` (i.e. it overwrites), except that if the parent directory
* does not exist, it's created.
*
* @example
* import * as fs from 'fs-extra'
*
* const file = '/tmp/this/path/does/not/exist/file.txt'
* fs.outputFileSync(file, 'hello!')
*
* const data = fs.readFileSync(file, 'utf8')
* console.log(data) // => hello!
*/
export function outputFileSync(
file: string,
data: string | NodeJS.ArrayBufferView,
options?: fs.WriteFileOptions,
): void;
/**
* Reads a JSON file and then parses it into an object.
*
* @example
* import * as fs from 'fs-extra'
*
* // With a callback:
* fs.readJson('./package.json', (err, packageObj) => {
* if (err) console.error(err)
* console.log(packageObj.version) // => 0.1.3
* })
*
* // With Promises:
* fs.readJson('./package.json')
* .then(packageObj => {
* console.log(packageObj.version) // => 0.1.3
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* const packageObj = await fs.readJson('./package.json')
* console.log(packageObj.version) // => 0.1.3
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*
* // `readJsonSync()` can take a `throws` option set to `false` and it won't throw if the JSON is invalid. Example:
* const file = '/tmp/some-invalid.json'
* const data = '{not valid JSON'
* fs.writeFileSync(file, data)
*
* // With a callback:
* fs.readJson(file, { throws: false }, (err, obj) => {
* if (err) console.error(err)
* console.log(obj) // => null
* })
*
* // With Promises:
* fs.readJson(file, { throws: false })
* .then(obj => {
* console.log(obj) // => null
* })
* .catch(err => {
* console.error(err) // Not called
* })
*
* // With async/await:
* async function asyncAwaitThrows () {
* const obj = await fs.readJson(file, { throws: false })
* console.log(obj) // => null
* }
*
* asyncAwaitThrows()
*/
export const readJson: typeof jsonfile.readFile;
/**
* @see readJson
*/
export const readJSON: typeof jsonfile.readFile;
/**
* Reads a JSON file and then parses it into an object.
*
* @example
* import * as fs from 'fs-extra'
*
* const packageObj = fs.readJsonSync('./package.json')
* console.log(packageObj.version) // => 2.0.0
*
* // `readJsonSync()` can take a `throws` option set to `false` and it won't throw if the JSON is invalid. Example:
* const file = '/tmp/some-invalid.json'
* const data = '{not valid JSON'
* fs.writeFileSync(file, data)
*
* const obj = fs.readJsonSync(file, { throws: false })
* console.log(obj) // => null
*/
export const readJsonSync: typeof jsonfile.readFileSync;
/**
* @see readJsonSync
*/
export const readJSONSync: typeof jsonfile.readFileSync;
/**
* Writes an object to a JSON file.
*
* @example
* import * as fs from 'fs-extra'
*
* // With a callback:
* fs.writeJson('./package.json', {name: 'fs-extra'}, err => {
* if (err) return console.error(err)
* console.log('success!')
* })
*
* // With Promises:
* fs.writeJson('./package.json', {name: 'fs-extra'})
* .then(() => {
* console.log('success!')
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.writeJson('./package.json', {name: 'fs-extra'})
* console.log('success!')
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*/
export const writeJson: typeof jsonfile.writeFile;
/**
* @see writeJson
*/
export const writeJSON: typeof jsonfile.writeFile;
/**
* Writes an object to a JSON file.
*
* @example
* import * as fs from 'fs-extra'
*
* fs.writeJsonSync('./package.json', {name: 'fs-extra'})
*/
export const writeJsonSync: typeof jsonfile.writeFileSync;
/**
* @see writeJsonSync
*/
export const writeJSONSync: typeof jsonfile.writeFileSync;
/**
* Almost the same as `writeJson`, except that if the directory does not exist, it's created.
*
* @example
* import * as fs from 'fs-extra'
*
* const file = '/tmp/this/path/does/not/exist/file.json'
*
* // With a callback:
* fs.outputJson(file, {name: 'JP'}, err => {
* console.log(err) // => null
*
* fs.readJson(file, (err, data) => {
* if (err) return console.error(err)
* console.log(data.name) // => JP
* })
* })
*
* // With Promises:
* fs.outputJson(file, {name: 'JP'})
* .then(() => fs.readJson(file))
* .then(data => {
* console.log(data.name) // => JP
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.outputJson(file, {name: 'JP'})
*
* const data = await fs.readJson(file)
*
* console.log(data.name) // => JP
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*/
export function outputJson(file: string, data: any, options?: JsonOutputOptions): Promise<void>;
export function outputJson(file: string, data: any, options: JsonOutputOptions, callback: fs.NoParamCallback): void;
export function outputJson(file: string, data: any, callback: fs.NoParamCallback): void;
/**
* @see outputJson
*/
export const outputJSON: typeof outputJson;
/**
* Almost the same as `writeJsonSync`, except that if the directory does not exist, it's created.
*
* @example
* import * as fs from 'fs-extra'
*
* const file = '/tmp/this/path/does/not/exist/file.json'
* fs.outputJsonSync(file, {name: 'JP'})
*
* const data = fs.readJsonSync(file)
* console.log(data.name) // => JP
*/
export function outputJsonSync(file: string, data: any, options?: JsonOutputOptions): void;
/**
* @see outputJsonSync
*/
export const outputJSONSync: typeof outputJsonSync;
/**
* Removes a file or directory. The directory can have contents. If the path does not exist, silently does nothing.
*
* @example
* import * as fs from 'fs-extra'
*
* // remove file
* // With a callback:
* fs.remove('/tmp/myfile', err => {
* if (err) return console.error(err)
* console.log('success!')
* })
*
* fs.remove('/home/jprichardson', err => {
* if (err) return console.error(err)
* console.log('success!') // I just deleted my entire HOME directory.
* })
*
* // With Promises:
* fs.remove('/tmp/myfile')
* .then(() => {
* console.log('success!')
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.remove('/tmp/myfile')
* console.log('success!')
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*/
export function remove(dir: string): Promise<void>;
export function remove(dir: string, callback: fs.NoParamCallback): void;
/**
* Removes a file or directory. The directory can have contents. If the path does not exist, silently does nothing.
*
* @example
* import * as fs from 'fs-extra'
*
* // remove file
* fs.removeSync('/tmp/myfile')
*
* fs.removeSync('/home/jprichardson') // I just deleted my entire HOME directory.
*/
export function removeSync(dir: string): void;
/**
* Ensures that a directory is empty. Deletes directory contents if the directory is not empty.
* If the directory does not exist, it is created. The directory itself is not deleted.
*
* @example
* import * as fs from 'fs-extra'
*
* // assume this directory has a lot of files and folders
* // With a callback:
* fs.emptyDir('/tmp/some/dir', err => {
* if (err) return console.error(err)
* console.log('success!')
* })
*
* // With Promises:
* fs.emptyDir('/tmp/some/dir')
* .then(() => {
* console.log('success!')
* })
* .catch(err => {
* console.error(err)
* })
*
* // With async/await:
* async function asyncAwait () {
* try {
* await fs.emptyDir('/tmp/some/dir')
* console.log('success!')
* } catch (err) {
* console.error(err)
* }
* }
*
* asyncAwait()
*/
export function emptyDir(path: string): Promise<void>;
export function emptyDir(path: string, callback: fs.NoParamCallback): void;
/**
* @see emptyDir
*/
export const emptydir: typeof emptyDir;
/**
* Ensures that a directory is empty. Deletes directory contents if the directory is not empty.
* If the directory does not exist, it is created. The directory itself is not deleted.
*
* @example
* import * as fs from 'fs-extra'
*
* // assume this directory has a lot of files and folders
* fs.emptyDirSync('/tmp/some/dir')
*/
export function emptyDirSync(path: string): void;
/**
* @see emptyDirSync
*/
export const emptydirSync: typeof emptyDirSync;
/**
* Test whether or not the given path exists by checking with the file system. Like
* [`fs.exists`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback), but with a normal
* callback signature (err, exists). Uses `fs.access` under the hood.
*
* @example
* import * as fs from 'fs-extra'
*
* const file = '/tmp/this/path/does/not/exist/file.txt'
*
* // With a callback:
* fs.pathExists(file, (err, exists) => {
* console.log(err) // => null
* console.log(exists) // => false
* })
*
* // Promise usage:
* fs.pathExists(file)
* .then(exists => console.log(exists)) // => false
*
* // With async/await:
* async function asyncAwait () {
* const exists = await fs.pathExists(file)
*
* console.log(exists) // => false
* }
*
* asyncAwait()
*/
export function pathExists(path: string): Promise<boolean>;
export function pathExists(path: string, callback: (err: NodeJS.ErrnoException | null, exists: boolean) => void): void;
/**
* An alias for [`fs.existsSync`](https://nodejs.org/api/fs.html#fs_fs_existssync_path), created for
* consistency with `pathExists`.
*/
export function pathExistsSync(path: string): boolean;
export const access: typeof fs.access.__promisify__ & typeof fs.access;
export const appendFile: typeof fs.appendFile.__promisify__ & typeof fs.appendFile;
export const chmod: typeof fs.chmod.__promisify__ & typeof fs.chmod;
export const chown: typeof fs.chown.__promisify__ & typeof fs.chown;
export const close: typeof fs.close.__promisify__ & typeof fs.close;
export const copyFile: typeof fs.copyFile.__promisify__ & typeof fs.copyFile;
export const exists: typeof fs.exists.__promisify__ & typeof fs.exists;
export const fchmod: typeof fs.fchmod.__promisify__ & typeof fs.fchmod;
export const fchown: typeof fs.fchown.__promisify__ & typeof fs.fchown;
export const fdatasync: typeof fs.fdatasync.__promisify__ & typeof fs.fdatasync;
export const fstat: typeof fs.fstat.__promisify__ & typeof fs.fstat;
export const fsync: typeof fs.fsync.__promisify__ & typeof fs.fsync;
export const ftruncate: typeof fs.ftruncate.__promisify__ & typeof fs.ftruncate;
export const futimes: typeof fs.futimes.__promisify__ & typeof fs.futimes;
export const lchmod: typeof fs.lchmod.__promisify__ & typeof fs.lchmod;
export const lchown: typeof fs.lchown.__promisify__ & typeof fs.lchown;
export const link: typeof fs.link.__promisify__ & typeof fs.link;
export const lstat: typeof fs.lstat.__promisify__ & typeof fs.lstat;
export const mkdir: typeof fs.mkdir.__promisify__ & typeof fs.mkdir;
export const mkdtemp: typeof fs.mkdtemp.__promisify__ & typeof fs.mkdtemp;
export const open: typeof fs.open.__promisify__ & typeof fs.open;
export const opendir: typeof fs.opendir.__promisify__ & typeof fs.opendir;
export const read: typeof fs.read.__promisify__ & typeof fs.read;
export const readv: typeof fs.readv.__promisify__ & typeof fs.readv;
export const readdir: typeof fs.readdir.__promisify__ & typeof fs.readdir;
export const readFile: typeof fs.readFile.__promisify__ & typeof fs.readFile;
export const readlink: typeof fs.readlink.__promisify__ & typeof fs.readlink;
export const realpath:
& typeof fs.realpath.__promisify__
& typeof fs.realpath
& {
native(path: fs.PathLike, options?: fs.EncodingOption): Promise<string>;
native(path: fs.PathLike, options: fs.BufferEncodingOption): Promise<Buffer>;
};
export const rename: typeof fs.rename.__promisify__ & typeof fs.rename;
export const rm: typeof fs.rm.__promisify__ & typeof fs.rm;
export const rmdir: typeof fs.rmdir.__promisify__ & typeof fs.rmdir;
export const stat: typeof fs.stat.__promisify__ & typeof fs.stat;
export const symlink: typeof fs.symlink.__promisify__ & typeof fs.symlink;
export const truncate: typeof fs.truncate.__promisify__ & typeof fs.truncate;
export const unlink: typeof fs.unlink.__promisify__ & typeof fs.unlink;
export const utimes: typeof fs.utimes.__promisify__ & typeof fs.utimes;
export const write: typeof fs.write.__promisify__ & typeof fs.write;
export const writev: typeof fs.writev.__promisify__ & typeof fs.writev;
export const writeFile: typeof fs.writeFile.__promisify__ & typeof fs.writeFile;
export type NoParamCallbackWithUndefined = (err: NodeJS.ErrnoException | null | undefined) => void;
export type SymlinkType = fs.symlink.Type;
export type CopyFilterSync = (src: string, dest: string) => boolean;
export type CopyFilterAsync = (src: string, dest: string) => Promise<boolean>;
export interface CopyOptions {
/**
* Dereference symlinks.
* @default false
*/
dereference?: boolean | undefined;
/**
* Overwrite existing file or directory.
* _Note that the copy operation will silently fail if you set this to `false` and the destination exists._
* Use the `errorOnExist` option to change this behavior.
* @default true
*/
overwrite?: boolean | undefined;
/**
* When `true`, will set last modification and access times to the ones of the original source files.
* When `false`, timestamp behavior is OS-dependent.
* @default false
*/
preserveTimestamps?: boolean | undefined;
/**
* When `overwrite` is `false` and the destination exists, throw an error.
* @default false
*/
errorOnExist?: boolean | undefined;
/**
* Function to filter copied files/directories. Return `true` to copy the item, `false` to ignore it.
* Can also return a `Promise` that resolves to `true` or `false` (or pass in an `async` function).
*/
filter?: CopyFilterSync | CopyFilterAsync | undefined;
}
export interface CopyOptionsSync extends CopyOptions {
/**
* Function to filter copied files/directories. Return `true` to copy the item, `false` to ignore it.
*/
filter?: CopyFilterSync | undefined;
}
export interface EnsureDirOptions {
mode?: number | undefined;
}
export interface MoveOptions {
/**
* Overwrite existing file or directory.
* @default false
*/
overwrite?: boolean | undefined;
/**
* Dereference symlinks.
* @default false
*/
dereference?: boolean | undefined;
}
export { JFReadOptions as JsonReadOptions, JFWriteOptions as JsonWriteOptions } from "jsonfile";
export type JsonOutputOptions = fs.WriteFileOptions & StringifyOptions;
@@ -0,0 +1,7 @@
//#region src/ssr/constants.ts
const GLOBAL_TSR = "$_TSR";
const TSR_SCRIPT_BARRIER_ID = "$tsr-stream-barrier";
//#endregion
export { GLOBAL_TSR, TSR_SCRIPT_BARRIER_ID };
//# sourceMappingURL=constants.js.map
@@ -0,0 +1,4 @@
import { ZodTypeDef } from "zod/v3";
import { Refs } from "./Refs.js";
import { JsonSchema7Type } from "./parseTypes.js";
export declare function parseDef(def: ZodTypeDef, refs: Refs, forceResolution?: boolean): JsonSchema7Type | undefined;
@@ -0,0 +1,9 @@
import { resolveVariantFromProps } from './resolve-variants.mjs';
function resolveVariant(visualElement, definition, custom) {
const props = visualElement.getProps();
return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, visualElement);
}
export { resolveVariant };
//# sourceMappingURL=resolve-dynamic-variants.mjs.map
@@ -0,0 +1,256 @@
// Use a Map rather than object to avoid unexpected __proto__ access.
export default new Map([
["quot", "\u0022"],
["amp", "&"],
["apos", "\u0027"],
["lt", "<"],
["gt", ">"],
["nbsp", "\u00A0"],
["iexcl", "\u00A1"],
["cent", "\u00A2"],
["pound", "\u00A3"],
["curren", "\u00A4"],
["yen", "\u00A5"],
["brvbar", "\u00A6"],
["sect", "\u00A7"],
["uml", "\u00A8"],
["copy", "\u00A9"],
["ordf", "\u00AA"],
["laquo", "\u00AB"],
["not", "\u00AC"],
["shy", "\u00AD"],
["reg", "\u00AE"],
["macr", "\u00AF"],
["deg", "\u00B0"],
["plusmn", "\u00B1"],
["sup2", "\u00B2"],
["sup3", "\u00B3"],
["acute", "\u00B4"],
["micro", "\u00B5"],
["para", "\u00B6"],
["middot", "\u00B7"],
["cedil", "\u00B8"],
["sup1", "\u00B9"],
["ordm", "\u00BA"],
["raquo", "\u00BB"],
["frac14", "\u00BC"],
["frac12", "\u00BD"],
["frac34", "\u00BE"],
["iquest", "\u00BF"],
["Agrave", "\u00C0"],
["Aacute", "\u00C1"],
["Acirc", "\u00C2"],
["Atilde", "\u00C3"],
["Auml", "\u00C4"],
["Aring", "\u00C5"],
["AElig", "\u00C6"],
["Ccedil", "\u00C7"],
["Egrave", "\u00C8"],
["Eacute", "\u00C9"],
["Ecirc", "\u00CA"],
["Euml", "\u00CB"],
["Igrave", "\u00CC"],
["Iacute", "\u00CD"],
["Icirc", "\u00CE"],
["Iuml", "\u00CF"],
["ETH", "\u00D0"],
["Ntilde", "\u00D1"],
["Ograve", "\u00D2"],
["Oacute", "\u00D3"],
["Ocirc", "\u00D4"],
["Otilde", "\u00D5"],
["Ouml", "\u00D6"],
["times", "\u00D7"],
["Oslash", "\u00D8"],
["Ugrave", "\u00D9"],
["Uacute", "\u00DA"],
["Ucirc", "\u00DB"],
["Uuml", "\u00DC"],
["Yacute", "\u00DD"],
["THORN", "\u00DE"],
["szlig", "\u00DF"],
["agrave", "\u00E0"],
["aacute", "\u00E1"],
["acirc", "\u00E2"],
["atilde", "\u00E3"],
["auml", "\u00E4"],
["aring", "\u00E5"],
["aelig", "\u00E6"],
["ccedil", "\u00E7"],
["egrave", "\u00E8"],
["eacute", "\u00E9"],
["ecirc", "\u00EA"],
["euml", "\u00EB"],
["igrave", "\u00EC"],
["iacute", "\u00ED"],
["icirc", "\u00EE"],
["iuml", "\u00EF"],
["eth", "\u00F0"],
["ntilde", "\u00F1"],
["ograve", "\u00F2"],
["oacute", "\u00F3"],
["ocirc", "\u00F4"],
["otilde", "\u00F5"],
["ouml", "\u00F6"],
["divide", "\u00F7"],
["oslash", "\u00F8"],
["ugrave", "\u00F9"],
["uacute", "\u00FA"],
["ucirc", "\u00FB"],
["uuml", "\u00FC"],
["yacute", "\u00FD"],
["thorn", "\u00FE"],
["yuml", "\u00FF"],
["OElig", "\u0152"],
["oelig", "\u0153"],
["Scaron", "\u0160"],
["scaron", "\u0161"],
["Yuml", "\u0178"],
["fnof", "\u0192"],
["circ", "\u02C6"],
["tilde", "\u02DC"],
["Alpha", "\u0391"],
["Beta", "\u0392"],
["Gamma", "\u0393"],
["Delta", "\u0394"],
["Epsilon", "\u0395"],
["Zeta", "\u0396"],
["Eta", "\u0397"],
["Theta", "\u0398"],
["Iota", "\u0399"],
["Kappa", "\u039A"],
["Lambda", "\u039B"],
["Mu", "\u039C"],
["Nu", "\u039D"],
["Xi", "\u039E"],
["Omicron", "\u039F"],
["Pi", "\u03A0"],
["Rho", "\u03A1"],
["Sigma", "\u03A3"],
["Tau", "\u03A4"],
["Upsilon", "\u03A5"],
["Phi", "\u03A6"],
["Chi", "\u03A7"],
["Psi", "\u03A8"],
["Omega", "\u03A9"],
["alpha", "\u03B1"],
["beta", "\u03B2"],
["gamma", "\u03B3"],
["delta", "\u03B4"],
["epsilon", "\u03B5"],
["zeta", "\u03B6"],
["eta", "\u03B7"],
["theta", "\u03B8"],
["iota", "\u03B9"],
["kappa", "\u03BA"],
["lambda", "\u03BB"],
["mu", "\u03BC"],
["nu", "\u03BD"],
["xi", "\u03BE"],
["omicron", "\u03BF"],
["pi", "\u03C0"],
["rho", "\u03C1"],
["sigmaf", "\u03C2"],
["sigma", "\u03C3"],
["tau", "\u03C4"],
["upsilon", "\u03C5"],
["phi", "\u03C6"],
["chi", "\u03C7"],
["psi", "\u03C8"],
["omega", "\u03C9"],
["thetasym", "\u03D1"],
["upsih", "\u03D2"],
["piv", "\u03D6"],
["ensp", "\u2002"],
["emsp", "\u2003"],
["thinsp", "\u2009"],
["zwnj", "\u200C"],
["zwj", "\u200D"],
["lrm", "\u200E"],
["rlm", "\u200F"],
["ndash", "\u2013"],
["mdash", "\u2014"],
["lsquo", "\u2018"],
["rsquo", "\u2019"],
["sbquo", "\u201A"],
["ldquo", "\u201C"],
["rdquo", "\u201D"],
["bdquo", "\u201E"],
["dagger", "\u2020"],
["Dagger", "\u2021"],
["bull", "\u2022"],
["hellip", "\u2026"],
["permil", "\u2030"],
["prime", "\u2032"],
["Prime", "\u2033"],
["lsaquo", "\u2039"],
["rsaquo", "\u203A"],
["oline", "\u203E"],
["frasl", "\u2044"],
["euro", "\u20AC"],
["image", "\u2111"],
["weierp", "\u2118"],
["real", "\u211C"],
["trade", "\u2122"],
["alefsym", "\u2135"],
["larr", "\u2190"],
["uarr", "\u2191"],
["rarr", "\u2192"],
["darr", "\u2193"],
["harr", "\u2194"],
["crarr", "\u21B5"],
["lArr", "\u21D0"],
["uArr", "\u21D1"],
["rArr", "\u21D2"],
["dArr", "\u21D3"],
["hArr", "\u21D4"],
["forall", "\u2200"],
["part", "\u2202"],
["exist", "\u2203"],
["empty", "\u2205"],
["nabla", "\u2207"],
["isin", "\u2208"],
["notin", "\u2209"],
["ni", "\u220B"],
["prod", "\u220F"],
["sum", "\u2211"],
["minus", "\u2212"],
["lowast", "\u2217"],
["radic", "\u221A"],
["prop", "\u221D"],
["infin", "\u221E"],
["ang", "\u2220"],
["and", "\u2227"],
["or", "\u2228"],
["cap", "\u2229"],
["cup", "\u222A"],
["int", "\u222B"],
["there4", "\u2234"],
["sim", "\u223C"],
["cong", "\u2245"],
["asymp", "\u2248"],
["ne", "\u2260"],
["equiv", "\u2261"],
["le", "\u2264"],
["ge", "\u2265"],
["sub", "\u2282"],
["sup", "\u2283"],
["nsub", "\u2284"],
["sube", "\u2286"],
["supe", "\u2287"],
["oplus", "\u2295"],
["otimes", "\u2297"],
["perp", "\u22A5"],
["sdot", "\u22C5"],
["lceil", "\u2308"],
["rceil", "\u2309"],
["lfloor", "\u230A"],
["rfloor", "\u230B"],
["lang", "\u2329"],
["rang", "\u232A"],
["loz", "\u25CA"],
["spades", "\u2660"],
["clubs", "\u2663"],
["hearts", "\u2665"],
["diams", "\u2666"],
]);
@@ -0,0 +1,11 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
//#region src/utils/jwt/utf8.ts
/**
* @module
* Functions for encoding/decoding UTF8.
*/
const utf8Encoder = new TextEncoder();
const utf8Decoder = new TextDecoder();
//#endregion
exports.utf8Decoder = utf8Decoder;
exports.utf8Encoder = utf8Encoder;
@@ -0,0 +1,3 @@
export declare const chownr: (p: string, uid: number, gid: number, cb: (er?: unknown) => any) => void;
export declare const chownrSync: (p: string, uid: number, gid: number) => void;
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"sort-desc.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,3 @@
# `react-context`
This is an internal utility, not intended for public usage.
@@ -0,0 +1 @@
{"version":3,"file":"sun-snow.js","sources":["../../../src/icons/sun-snow.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name SunSnow\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTAgMjF2LTEiIC8+CiAgPHBhdGggZD0iTTEwIDRWMyIgLz4KICA8cGF0aCBkPSJNMTAgOWEzIDMgMCAwIDAgMCA2IiAvPgogIDxwYXRoIGQ9Im0xNCAyMCAxLjI1LTIuNUwxOCAxOCIgLz4KICA8cGF0aCBkPSJtMTQgNCAxLjI1IDIuNUwxOCA2IiAvPgogIDxwYXRoIGQ9Im0xNyAyMS0zLTYgMS41LTNIMjIiIC8+CiAgPHBhdGggZD0ibTE3IDMtMyA2IDEuNSAzIiAvPgogIDxwYXRoIGQ9Ik0yIDEyaDEiIC8+CiAgPHBhdGggZD0ibTIwIDEwLTEuNSAyIDEuNSAyIiAvPgogIDxwYXRoIGQ9Im0zLjY0IDE4LjM2LjctLjciIC8+CiAgPHBhdGggZD0ibTQuMzQgNi4zNC0uNy0uNyIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/sun-snow\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 SunSnow = createLucideIcon('SunSnow', [\n ['path', { d: 'M10 21v-1', key: '1u8rkd' }],\n ['path', { d: 'M10 4V3', key: 'pkzwkn' }],\n ['path', { d: 'M10 9a3 3 0 0 0 0 6', key: 'gv75dk' }],\n ['path', { d: 'm14 20 1.25-2.5L18 18', key: '1chtki' }],\n ['path', { d: 'm14 4 1.25 2.5L18 6', key: '1b4wsy' }],\n ['path', { d: 'm17 21-3-6 1.5-3H22', key: 'o5qa3v' }],\n ['path', { d: 'm17 3-3 6 1.5 3', key: '11697g' }],\n ['path', { d: 'M2 12h1', key: '1uaihz' }],\n ['path', { d: 'm20 10-1.5 2 1.5 2', key: '1swlpi' }],\n ['path', { d: 'm3.64 18.36.7-.7', key: '105rm9' }],\n ['path', { d: 'm4.34 6.34-.7-.7', key: 'd3unjp' }],\n]);\n\nexport default SunSnow;\n"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
{"version":3,"file":"file-clock.js","sources":["../../../src/icons/file-clock.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name FileClock\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMTYgMjJoMmEyIDIgMCAwIDAgMi0yVjdsLTUtNUg2YTIgMiAwIDAgMC0yIDJ2MyIgLz4KICA8cGF0aCBkPSJNMTQgMnY0YTIgMiAwIDAgMCAyIDJoNCIgLz4KICA8Y2lyY2xlIGN4PSI4IiBjeT0iMTYiIHI9IjYiIC8+CiAgPHBhdGggZD0iTTkuNSAxNy41IDggMTYuMjVWMTQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/file-clock\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 FileClock = createLucideIcon('FileClock', [\n ['path', { d: 'M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3', key: '37hlfg' }],\n ['path', { d: 'M14 2v4a2 2 0 0 0 2 2h4', key: 'tnqrlb' }],\n ['circle', { cx: '8', cy: '16', r: '6', key: '10v15b' }],\n ['path', { d: 'M9.5 17.5 8 16.25V14', key: '1o80t2' }],\n]);\n\nexport default FileClock;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,iBAAiB,WAAa,CAAA,CAAA,CAAA;AAAA,CAAA,CAC9C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,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,CAChF,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA2B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACxD,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,CAAwB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACvD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"1":"R","2":"_XH _8D _lE"},C:{"2":"_H _RU hC _zE","66":"_rB _eG _ED"},D:{"1":"_bQ _3D","2":"_H _qG _gQ","33":"_NB _7H"},E:{"2":"_R"},F:{"1":"_1B _DM _oC","2":"_0B _gR","33":"_cH"},G:{"2":"_M"},H:{"2":"1D"},I:{"2":"_IG _oK","33":"_y"},J:{"2":"_B"},K:{"2":"_N"},L:{"2":"I"},M:{"2":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"1":"_rI _oM","2":"_WL","33":"J"},Q:{"1":"JE"},R:{"2":"KE"},S:{"1":"LE","2":"ME"}},B:7,C:"Shadow DOM (deprecated V0 spec)",D:true};
@@ -0,0 +1,66 @@
/**
* @license React
* use-sync-external-store-shim.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
"use strict";
var React = require("react");
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var objectIs = "function" === typeof Object.is ? Object.is : is,
useState = React.useState,
useEffect = React.useEffect,
useLayoutEffect = React.useLayoutEffect,
useDebugValue = React.useDebugValue;
function useSyncExternalStore$2(subscribe, getSnapshot) {
var value = getSnapshot(),
_useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
inst = _useState[0].inst,
forceUpdate = _useState[1];
useLayoutEffect(
function () {
inst.value = value;
inst.getSnapshot = getSnapshot;
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
},
[subscribe, value, getSnapshot]
);
useEffect(
function () {
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
return subscribe(function () {
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
});
},
[subscribe]
);
useDebugValue(value);
return value;
}
function checkIfSnapshotChanged(inst) {
var latestGetSnapshot = inst.getSnapshot;
inst = inst.value;
try {
var nextValue = latestGetSnapshot();
return !objectIs(inst, nextValue);
} catch (error) {
return !0;
}
}
function useSyncExternalStore$1(subscribe, getSnapshot) {
return getSnapshot();
}
var shim =
"undefined" === typeof window ||
"undefined" === typeof window.document ||
"undefined" === typeof window.document.createElement
? useSyncExternalStore$1
: useSyncExternalStore$2;
exports.useSyncExternalStore =
void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
@@ -0,0 +1,956 @@
import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';
/**
* Custom positioning reference element.
* @see https://floating-ui.com/docs/virtual-elements
*/
const min = Math.min;
const max = Math.max;
const round = Math.round;
const floor = Math.floor;
const createCoords = v => ({
x: v,
y: v
});
function hasWindow() {
return typeof window !== 'undefined';
}
function getNodeName(node) {
if (isNode(node)) {
return (node.nodeName || '').toLowerCase();
}
// Mocked nodes in testing environments may not be instances of Node. By
// returning `#document` an infinite loop won't occur.
// https://github.com/floating-ui/floating-ui/issues/2317
return '#document';
}
function getWindow(node) {
var _node$ownerDocument;
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
}
function getDocumentElement(node) {
var _ref;
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
}
function isNode(value) {
if (!hasWindow()) {
return false;
}
return value instanceof Node || value instanceof getWindow(value).Node;
}
function isElement(value) {
if (!hasWindow()) {
return false;
}
return value instanceof Element || value instanceof getWindow(value).Element;
}
function isHTMLElement(value) {
if (!hasWindow()) {
return false;
}
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
}
function isShadowRoot(value) {
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
return false;
}
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
}
function isOverflowElement(element) {
const {
overflow,
overflowX,
overflowY,
display
} = getComputedStyle$1(element);
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
}
function isTableElement(element) {
return /^(table|td|th)$/.test(getNodeName(element));
}
function isTopLayer(element) {
try {
if (element.matches(':popover-open')) {
return true;
}
} catch (_e) {
// no-op
}
try {
return element.matches(':modal');
} catch (_e) {
return false;
}
}
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
const containRe = /paint|layout|strict|content/;
const isNotNone = value => !!value && value !== 'none';
let isWebKitValue;
function isContainingBlock(elementOrCss) {
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
}
function getContainingBlock(element) {
let currentNode = getParentNode(element);
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
if (isContainingBlock(currentNode)) {
return currentNode;
} else if (isTopLayer(currentNode)) {
return null;
}
currentNode = getParentNode(currentNode);
}
return null;
}
function isWebKit() {
if (isWebKitValue == null) {
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
}
return isWebKitValue;
}
function isLastTraversableNode(node) {
return /^(html|body|#document)$/.test(getNodeName(node));
}
function getComputedStyle$1(element) {
return getWindow(element).getComputedStyle(element);
}
function getNodeScroll(element) {
if (isElement(element)) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}
return {
scrollLeft: element.scrollX,
scrollTop: element.scrollY
};
}
function getParentNode(node) {
if (getNodeName(node) === 'html') {
return node;
}
const result =
// Step into the shadow DOM of the parent of a slotted node.
node.assignedSlot ||
// DOM Element detected.
node.parentNode ||
// ShadowRoot detected.
isShadowRoot(node) && node.host ||
// Fallback.
getDocumentElement(node);
return isShadowRoot(result) ? result.host : result;
}
function getNearestOverflowAncestor(node) {
const parentNode = getParentNode(node);
if (isLastTraversableNode(parentNode)) {
return node.ownerDocument ? node.ownerDocument.body : node.body;
}
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
return parentNode;
}
return getNearestOverflowAncestor(parentNode);
}
function getOverflowAncestors(node, list, traverseIframes) {
var _node$ownerDocument2;
if (list === void 0) {
list = [];
}
if (traverseIframes === void 0) {
traverseIframes = true;
}
const scrollableAncestor = getNearestOverflowAncestor(node);
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
const win = getWindow(scrollableAncestor);
if (isBody) {
const frameElement = getFrameElement(win);
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
} else {
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
}
}
function getFrameElement(win) {
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
}
function getCssDimensions(element) {
const css = getComputedStyle$1(element);
// In testing environments, the `width` and `height` properties are empty
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
let width = parseFloat(css.width) || 0;
let height = parseFloat(css.height) || 0;
const hasOffset = isHTMLElement(element);
const offsetWidth = hasOffset ? element.offsetWidth : width;
const offsetHeight = hasOffset ? element.offsetHeight : height;
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
if (shouldFallback) {
width = offsetWidth;
height = offsetHeight;
}
return {
width,
height,
$: shouldFallback
};
}
function unwrapElement(element) {
return !isElement(element) ? element.contextElement : element;
}
function getScale(element) {
const domElement = unwrapElement(element);
if (!isHTMLElement(domElement)) {
return createCoords(1);
}
const rect = domElement.getBoundingClientRect();
const {
width,
height,
$
} = getCssDimensions(domElement);
let x = ($ ? round(rect.width) : rect.width) / width;
let y = ($ ? round(rect.height) : rect.height) / height;
// 0, NaN, or Infinity should always fallback to 1.
if (!x || !Number.isFinite(x)) {
x = 1;
}
if (!y || !Number.isFinite(y)) {
y = 1;
}
return {
x,
y
};
}
const noOffsets = /*#__PURE__*/createCoords(0);
function getVisualOffsets(element) {
const win = getWindow(element);
if (!isWebKit() || !win.visualViewport) {
return noOffsets;
}
return {
x: win.visualViewport.offsetLeft,
y: win.visualViewport.offsetTop
};
}
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
if (isFixed === void 0) {
isFixed = false;
}
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
return false;
}
return isFixed;
}
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
if (includeScale === void 0) {
includeScale = false;
}
if (isFixedStrategy === void 0) {
isFixedStrategy = false;
}
const clientRect = element.getBoundingClientRect();
const domElement = unwrapElement(element);
let scale = createCoords(1);
if (includeScale) {
if (offsetParent) {
if (isElement(offsetParent)) {
scale = getScale(offsetParent);
}
} else {
scale = getScale(element);
}
}
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
let x = (clientRect.left + visualOffsets.x) / scale.x;
let y = (clientRect.top + visualOffsets.y) / scale.y;
let width = clientRect.width / scale.x;
let height = clientRect.height / scale.y;
if (domElement) {
const win = getWindow(domElement);
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
let currentWin = win;
let currentIFrame = getFrameElement(currentWin);
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
const iframeScale = getScale(currentIFrame);
const iframeRect = currentIFrame.getBoundingClientRect();
const css = getComputedStyle$1(currentIFrame);
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
x *= iframeScale.x;
y *= iframeScale.y;
width *= iframeScale.x;
height *= iframeScale.y;
x += left;
y += top;
currentWin = getWindow(currentIFrame);
currentIFrame = getFrameElement(currentWin);
}
}
return rectToClientRect({
width,
height,
x,
y
});
}
// If <html> has a CSS width greater than the viewport, then this will be
// incorrect for RTL.
function getWindowScrollBarX(element, rect) {
const leftScroll = getNodeScroll(element).scrollLeft;
if (!rect) {
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
}
return rect.left + leftScroll;
}
function getHTMLOffset(documentElement, scroll) {
const htmlRect = documentElement.getBoundingClientRect();
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
const y = htmlRect.top + scroll.scrollTop;
return {
x,
y
};
}
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
let {
elements,
rect,
offsetParent,
strategy
} = _ref;
const isFixed = strategy === 'fixed';
const documentElement = getDocumentElement(offsetParent);
const topLayer = elements ? isTopLayer(elements.floating) : false;
if (offsetParent === documentElement || topLayer && isFixed) {
return rect;
}
let scroll = {
scrollLeft: 0,
scrollTop: 0
};
let scale = createCoords(1);
const offsets = createCoords(0);
const isOffsetParentAnElement = isHTMLElement(offsetParent);
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isOffsetParentAnElement) {
const offsetRect = getBoundingClientRect(offsetParent);
scale = getScale(offsetParent);
offsets.x = offsetRect.x + offsetParent.clientLeft;
offsets.y = offsetRect.y + offsetParent.clientTop;
}
}
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
return {
width: rect.width * scale.x,
height: rect.height * scale.y,
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
};
}
function getClientRects(element) {
return Array.from(element.getClientRects());
}
// Gets the entire size of the scrollable document area, even extending outside
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
function getDocumentRect(element) {
const html = getDocumentElement(element);
const scroll = getNodeScroll(element);
const body = element.ownerDocument.body;
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
const y = -scroll.scrollTop;
if (getComputedStyle$1(body).direction === 'rtl') {
x += max(html.clientWidth, body.clientWidth) - width;
}
return {
width,
height,
x,
y
};
}
// Safety check: ensure the scrollbar space is reasonable in case this
// calculation is affected by unusual styles.
// Most scrollbars leave 15-18px of space.
const SCROLLBAR_MAX = 25;
function getViewportRect(element, strategy) {
const win = getWindow(element);
const html = getDocumentElement(element);
const visualViewport = win.visualViewport;
let width = html.clientWidth;
let height = html.clientHeight;
let x = 0;
let y = 0;
if (visualViewport) {
width = visualViewport.width;
height = visualViewport.height;
const visualViewportBased = isWebKit();
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
x = visualViewport.offsetLeft;
y = visualViewport.offsetTop;
}
}
const windowScrollbarX = getWindowScrollBarX(html);
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
// visual width of the <html> but this is not considered in the size
// of `html.clientWidth`.
if (windowScrollbarX <= 0) {
const doc = html.ownerDocument;
const body = doc.body;
const bodyStyles = getComputedStyle(body);
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
width -= clippingStableScrollbarWidth;
}
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
// If the <body> scrollbar is on the left, the width needs to be extended
// by the scrollbar amount so there isn't extra space on the right.
width += windowScrollbarX;
}
return {
width,
height,
x,
y
};
}
// Returns the inner client rect, subtracting scrollbars if present.
function getInnerBoundingClientRect(element, strategy) {
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
const top = clientRect.top + element.clientTop;
const left = clientRect.left + element.clientLeft;
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
const width = element.clientWidth * scale.x;
const height = element.clientHeight * scale.y;
const x = left * scale.x;
const y = top * scale.y;
return {
width,
height,
x,
y
};
}
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
let rect;
if (clippingAncestor === 'viewport') {
rect = getViewportRect(element, strategy);
} else if (clippingAncestor === 'document') {
rect = getDocumentRect(getDocumentElement(element));
} else if (isElement(clippingAncestor)) {
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
} else {
const visualOffsets = getVisualOffsets(element);
rect = {
x: clippingAncestor.x - visualOffsets.x,
y: clippingAncestor.y - visualOffsets.y,
width: clippingAncestor.width,
height: clippingAncestor.height
};
}
return rectToClientRect(rect);
}
function hasFixedPositionAncestor(element, stopNode) {
const parentNode = getParentNode(element);
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
return false;
}
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
}
// A "clipping ancestor" is an `overflow` element with the characteristic of
// clipping (or hiding) child elements. This returns all clipping ancestors
// of the given element up the tree.
function getClippingElementAncestors(element, cache) {
const cachedResult = cache.get(element);
if (cachedResult) {
return cachedResult;
}
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
let currentContainingBlockComputedStyle = null;
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
let currentNode = elementIsFixed ? getParentNode(element) : element;
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
const computedStyle = getComputedStyle$1(currentNode);
const currentNodeIsContaining = isContainingBlock(currentNode);
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
currentContainingBlockComputedStyle = null;
}
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
if (shouldDropCurrentNode) {
// Drop non-containing blocks.
result = result.filter(ancestor => ancestor !== currentNode);
} else {
// Record last containing block for next iteration.
currentContainingBlockComputedStyle = computedStyle;
}
currentNode = getParentNode(currentNode);
}
cache.set(element, result);
return result;
}
// Gets the maximum area that the element is visible in due to any number of
// clipping ancestors.
function getClippingRect(_ref) {
let {
element,
boundary,
rootBoundary,
strategy
} = _ref;
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
let top = firstRect.top;
let right = firstRect.right;
let bottom = firstRect.bottom;
let left = firstRect.left;
for (let i = 1; i < clippingAncestors.length; i++) {
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
top = max(rect.top, top);
right = min(rect.right, right);
bottom = min(rect.bottom, bottom);
left = max(rect.left, left);
}
return {
width: right - left,
height: bottom - top,
x: left,
y: top
};
}
function getDimensions(element) {
const {
width,
height
} = getCssDimensions(element);
return {
width,
height
};
}
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
const isOffsetParentAnElement = isHTMLElement(offsetParent);
const documentElement = getDocumentElement(offsetParent);
const isFixed = strategy === 'fixed';
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
let scroll = {
scrollLeft: 0,
scrollTop: 0
};
const offsets = createCoords(0);
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
function setLeftRTLScrollbarOffset() {
offsets.x = getWindowScrollBarX(documentElement);
}
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isOffsetParentAnElement) {
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
offsets.x = offsetRect.x + offsetParent.clientLeft;
offsets.y = offsetRect.y + offsetParent.clientTop;
} else if (documentElement) {
setLeftRTLScrollbarOffset();
}
}
if (isFixed && !isOffsetParentAnElement && documentElement) {
setLeftRTLScrollbarOffset();
}
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
return {
x,
y,
width: rect.width,
height: rect.height
};
}
function isStaticPositioned(element) {
return getComputedStyle$1(element).position === 'static';
}
function getTrueOffsetParent(element, polyfill) {
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
return null;
}
if (polyfill) {
return polyfill(element);
}
let rawOffsetParent = element.offsetParent;
// Firefox returns the <html> element as the offsetParent if it's non-static,
// while Chrome and Safari return the <body> element. The <body> element must
// be used to perform the correct calculations even if the <html> element is
// non-static.
if (getDocumentElement(element) === rawOffsetParent) {
rawOffsetParent = rawOffsetParent.ownerDocument.body;
}
return rawOffsetParent;
}
// Gets the closest ancestor positioned element. Handles some edge cases,
// such as table ancestors and cross browser bugs.
function getOffsetParent(element, polyfill) {
const win = getWindow(element);
if (isTopLayer(element)) {
return win;
}
if (!isHTMLElement(element)) {
let svgOffsetParent = getParentNode(element);
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
return svgOffsetParent;
}
svgOffsetParent = getParentNode(svgOffsetParent);
}
return win;
}
let offsetParent = getTrueOffsetParent(element, polyfill);
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
}
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
return win;
}
return offsetParent || getContainingBlock(element) || win;
}
const getElementRects = async function (data) {
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
const getDimensionsFn = this.getDimensions;
const floatingDimensions = await getDimensionsFn(data.floating);
return {
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
floating: {
x: 0,
y: 0,
width: floatingDimensions.width,
height: floatingDimensions.height
}
};
};
function isRTL(element) {
return getComputedStyle$1(element).direction === 'rtl';
}
const platform = {
convertOffsetParentRelativeRectToViewportRelativeRect,
getDocumentElement,
getClippingRect,
getOffsetParent,
getElementRects,
getClientRects,
getDimensions,
getScale,
isElement,
isRTL
};
function rectsAreEqual(a, b) {
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
}
// https://samthor.au/2021/observing-dom/
function observeMove(element, onMove) {
let io = null;
let timeoutId;
const root = getDocumentElement(element);
function cleanup() {
var _io;
clearTimeout(timeoutId);
(_io = io) == null || _io.disconnect();
io = null;
}
function refresh(skip, threshold) {
if (skip === void 0) {
skip = false;
}
if (threshold === void 0) {
threshold = 1;
}
cleanup();
const elementRectForRootMargin = element.getBoundingClientRect();
const {
left,
top,
width,
height
} = elementRectForRootMargin;
if (!skip) {
onMove();
}
if (!width || !height) {
return;
}
const insetTop = floor(top);
const insetRight = floor(root.clientWidth - (left + width));
const insetBottom = floor(root.clientHeight - (top + height));
const insetLeft = floor(left);
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
const options = {
rootMargin,
threshold: max(0, min(1, threshold)) || 1
};
let isFirstUpdate = true;
function handleObserve(entries) {
const ratio = entries[0].intersectionRatio;
if (ratio !== threshold) {
if (!isFirstUpdate) {
return refresh();
}
if (!ratio) {
// If the reference is clipped, the ratio is 0. Throttle the refresh
// to prevent an infinite loop of updates.
timeoutId = setTimeout(() => {
refresh(false, 1e-7);
}, 1000);
} else {
refresh(false, ratio);
}
}
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
// It's possible that even though the ratio is reported as 1, the
// element is not actually fully within the IntersectionObserver's root
// area anymore. This can happen under performance constraints. This may
// be a bug in the browser's IntersectionObserver implementation. To
// work around this, we compare the element's bounding rect now with
// what it was at the time we created the IntersectionObserver. If they
// are not equal then the element moved, so we refresh.
refresh();
}
isFirstUpdate = false;
}
// Older browsers don't support a `document` as the root and will throw an
// error.
try {
io = new IntersectionObserver(handleObserve, {
...options,
// Handle <iframe>s
root: root.ownerDocument
});
} catch (_e) {
io = new IntersectionObserver(handleObserve, options);
}
io.observe(element);
}
refresh(true);
return cleanup;
}
/**
* Automatically updates the position of the floating element when necessary.
* Should only be called when the floating element is mounted on the DOM or
* visible on the screen.
* @returns cleanup function that should be invoked when the floating element is
* removed from the DOM or hidden from the screen.
* @see https://floating-ui.com/docs/autoUpdate
*/
function autoUpdate(reference, floating, update, options) {
if (options === void 0) {
options = {};
}
const {
ancestorScroll = true,
ancestorResize = true,
elementResize = typeof ResizeObserver === 'function',
layoutShift = typeof IntersectionObserver === 'function',
animationFrame = false
} = options;
const referenceEl = unwrapElement(reference);
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
ancestors.forEach(ancestor => {
ancestorScroll && ancestor.addEventListener('scroll', update, {
passive: true
});
ancestorResize && ancestor.addEventListener('resize', update);
});
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
let reobserveFrame = -1;
let resizeObserver = null;
if (elementResize) {
resizeObserver = new ResizeObserver(_ref => {
let [firstEntry] = _ref;
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
// Prevent update loops when using the `size` middleware.
// https://github.com/floating-ui/floating-ui/issues/1740
resizeObserver.unobserve(floating);
cancelAnimationFrame(reobserveFrame);
reobserveFrame = requestAnimationFrame(() => {
var _resizeObserver;
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
});
}
update();
});
if (referenceEl && !animationFrame) {
resizeObserver.observe(referenceEl);
}
if (floating) {
resizeObserver.observe(floating);
}
}
let frameId;
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
if (animationFrame) {
frameLoop();
}
function frameLoop() {
const nextRefRect = getBoundingClientRect(reference);
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
update();
}
prevRefRect = nextRefRect;
frameId = requestAnimationFrame(frameLoop);
}
update();
return () => {
var _resizeObserver2;
ancestors.forEach(ancestor => {
ancestorScroll && ancestor.removeEventListener('scroll', update);
ancestorResize && ancestor.removeEventListener('resize', update);
});
cleanupIo == null || cleanupIo();
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
resizeObserver = null;
if (animationFrame) {
cancelAnimationFrame(frameId);
}
};
}
/**
* Resolves with an object of overflow side offsets that determine how much the
* element is overflowing a given clipping boundary on each side.
* - positive = overflowing the boundary by that number of pixels
* - negative = how many pixels left before it will overflow
* - 0 = lies flush with the boundary
* @see https://floating-ui.com/docs/detectOverflow
*/
const detectOverflow = detectOverflow$1;
/**
* Modifies the placement by translating the floating element along the
* specified axes.
* A number (shorthand for `mainAxis` or distance), or an axes configuration
* object may be passed.
* @see https://floating-ui.com/docs/offset
*/
const offset = offset$1;
/**
* Optimizes the visibility of the floating element by choosing the placement
* that has the most space available automatically, without needing to specify a
* preferred placement. Alternative to `flip`.
* @see https://floating-ui.com/docs/autoPlacement
*/
const autoPlacement = autoPlacement$1;
/**
* Optimizes the visibility of the floating element by shifting it in order to
* keep it in view when it will overflow the clipping boundary.
* @see https://floating-ui.com/docs/shift
*/
const shift = shift$1;
/**
* Optimizes the visibility of the floating element by flipping the `placement`
* in order to keep it in view when the preferred placement(s) will overflow the
* clipping boundary. Alternative to `autoPlacement`.
* @see https://floating-ui.com/docs/flip
*/
const flip = flip$1;
/**
* Provides data that allows you to change the size of the floating element —
* for instance, prevent it from overflowing the clipping boundary or match the
* width of the reference element.
* @see https://floating-ui.com/docs/size
*/
const size = size$1;
/**
* Provides data to hide the floating element in applicable situations, such as
* when it is not in the same clipping context as the reference element.
* @see https://floating-ui.com/docs/hide
*/
const hide = hide$1;
/**
* Provides data to position an inner element of the floating element so that it
* appears centered to the reference element.
* @see https://floating-ui.com/docs/arrow
*/
const arrow = arrow$1;
/**
* Provides improved positioning for inline reference elements that can span
* over multiple lines, such as hyperlinks or range selections.
* @see https://floating-ui.com/docs/inline
*/
const inline = inline$1;
/**
* Built-in `limiter` that will stop `shift()` at a certain point.
*/
const limitShift = limitShift$1;
/**
* Computes the `x` and `y` coordinates that will place the floating element
* next to a given reference element.
*/
const computePosition = (reference, floating, options) => {
// This caches the expensive `getClippingElementAncestors` function so that
// multiple lifecycle resets re-use the same result. It only lives for a
// single call. If other functions become expensive, we can add them as well.
const cache = new Map();
const mergedOptions = {
platform,
...options
};
const platformWithCache = {
...mergedOptions.platform,
_c: cache
};
return computePosition$1(reference, floating, {
...mergedOptions,
platform: platformWithCache
});
};
export { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size };
@@ -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 './file-chart-pie.js';
//# sourceMappingURL=file-pie-chart.js.map
@@ -0,0 +1,10 @@
import { Test } from '@vitest/runner';
import { a as BenchFunction, c as BenchmarkAPI } from './benchmark.d.DAaHLpsq.js';
import { Options } from 'tinybench';
import '@vitest/runner/utils';
declare function getBenchOptions(key: Test): Options;
declare function getBenchFn(key: Test): BenchFunction;
declare const bench: BenchmarkAPI;
export { getBenchOptions as a, bench as b, getBenchFn as g };
@@ -0,0 +1,7 @@
export {};
export {
/**
* @deprecated Import `act` from `react` instead.
*/ act,
} from "react";