docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Type Check & Test (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:25:58 +08:00
1 parent f954252a34
commit e311ca3275
35554 files changed
+6229626 -4

No files matched your search

@@ -0,0 +1,74 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = otfContours2ttfContours;
var _bezierCubic2Q = _interopRequireDefault(require("../../math/bezierCubic2Q2"));
var _pathCeil = _interopRequireDefault(require("../../graphics/pathCeil"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @file otf轮廓转ttf轮廓
* @author mengke01(kekee000@gmail.com)
*/
/**
* 转换轮廓
*
* @param {Array} otfContour otf轮廓
* @return {Array} ttf轮廓
*/
function transformContour(otfContour) {
var contour = [];
var prevPoint;
var curPoint;
var nextPoint;
var nextNextPoint;
contour.push(prevPoint = otfContour[0]);
for (var i = 1, l = otfContour.length; i < l; i++) {
curPoint = otfContour[i];
if (curPoint.onCurve) {
contour.push(curPoint);
prevPoint = curPoint;
}
// 三次bezier曲线
else {
nextPoint = otfContour[i + 1];
nextNextPoint = i === l - 2 ? otfContour[0] : otfContour[i + 2];
var bezierArray = (0, _bezierCubic2Q.default)(prevPoint, curPoint, nextPoint, nextNextPoint);
bezierArray[0][2].onCurve = true;
contour.push(bezierArray[0][1]);
contour.push(bezierArray[0][2]);
// 第二个曲线
if (bezierArray[1]) {
bezierArray[1][2].onCurve = true;
contour.push(bezierArray[1][1]);
contour.push(bezierArray[1][2]);
}
prevPoint = nextNextPoint;
i += 2;
}
}
return (0, _pathCeil.default)(contour);
}
/**
* otf轮廓转ttf轮廓
*
* @param {Array} otfContours otf轮廓数组
* @return {Array} ttf轮廓
*/
function otfContours2ttfContours(otfContours) {
if (!otfContours || !otfContours.length) {
return otfContours;
}
var contours = [];
for (var i = 0, l = otfContours.length; i < l; i++) {
// 这里可能由于转换错误导致空轮廓,需要去除
if (otfContours[i][0]) {
contours.push(transformContour(otfContours[i]));
}
}
return contours;
}
@@ -0,0 +1,882 @@
"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 assertionFunctionUtils_1 = require("../util/assertionFunctionUtils");
exports.default = (0, util_1.createRule)({
name: 'strict-boolean-expressions',
meta: {
type: 'suggestion',
docs: {
description: 'Disallow certain types in boolean expressions',
requiresTypeChecking: true,
},
hasSuggestions: true,
messages: {
conditionErrorAny: 'Unexpected any value in {{context}}. ' +
'An explicit comparison or type conversion is required.',
conditionErrorNullableBoolean: 'Unexpected nullable boolean value in {{context}}. ' +
'Please handle the nullish case explicitly.',
conditionErrorNullableEnum: 'Unexpected nullable enum value in {{context}}. ' +
'Please handle the nullish/zero/NaN cases explicitly.',
conditionErrorNullableNumber: 'Unexpected nullable number value in {{context}}. ' +
'Please handle the nullish/zero/NaN cases explicitly.',
conditionErrorNullableObject: 'Unexpected nullable object value in {{context}}. ' +
'An explicit null check is required.',
conditionErrorNullableString: 'Unexpected nullable string value in {{context}}. ' +
'Please handle the nullish/empty cases explicitly.',
conditionErrorNullish: 'Unexpected nullish value in conditional. ' +
'The condition is always false.',
conditionErrorNumber: 'Unexpected number value in {{context}}. ' +
'An explicit zero/NaN check is required.',
conditionErrorObject: 'Unexpected object value in {{context}}. ' +
'The condition is always true.',
conditionErrorOther: 'Unexpected value in conditional. ' +
'A boolean expression is required.',
conditionErrorString: 'Unexpected string value in {{context}}. ' +
'An explicit empty string check is required.',
conditionFixCastBoolean: 'Explicitly convert value to a boolean (`Boolean(value)`)',
conditionFixCompareArrayLengthNonzero: "Change condition to check array's length (`value.length > 0`)",
conditionFixCompareArrayLengthZero: "Change condition to check array's length (`value.length === 0`)",
conditionFixCompareEmptyString: 'Change condition to check for empty string (`value !== ""`)',
conditionFixCompareFalse: 'Change condition to check if false (`value === false`)',
conditionFixCompareNaN: 'Change condition to check for NaN (`!Number.isNaN(value)`)',
conditionFixCompareNullish: 'Change condition to check for null/undefined (`value != null`)',
conditionFixCompareStringLength: "Change condition to check string's length (`value.length !== 0`)",
conditionFixCompareTrue: 'Change condition to check if true (`value === true`)',
conditionFixCompareZero: 'Change condition to check for 0 (`value !== 0`)',
conditionFixDefaultEmptyString: 'Explicitly treat nullish value the same as an empty string (`value ?? ""`)',
conditionFixDefaultFalse: 'Explicitly treat nullish value the same as false (`value ?? false`)',
conditionFixDefaultZero: 'Explicitly treat nullish value the same as 0 (`value ?? 0`)',
explicitBooleanReturnType: 'Add an explicit `boolean` return type annotation.',
noStrictNullCheck: 'This rule requires the `strictNullChecks` compiler option to be turned on to function correctly.',
predicateCannotBeAsync: "Predicate function should not be 'async'; expected a boolean return type.",
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
allowAny: {
type: 'boolean',
description: 'Whether to allow `any`s in a boolean context.',
},
allowNullableBoolean: {
type: 'boolean',
description: 'Whether to allow nullable `boolean`s in a boolean context.',
},
allowNullableEnum: {
type: 'boolean',
description: 'Whether to allow nullable `enum`s in a boolean context.',
},
allowNullableNumber: {
type: 'boolean',
description: 'Whether to allow nullable `number`s in a boolean context.',
},
allowNullableObject: {
type: 'boolean',
description: 'Whether to allow nullable `object`s, `symbol`s, and functions in a boolean context.',
},
allowNullableString: {
type: 'boolean',
description: 'Whether to allow nullable `string`s in a boolean context.',
},
allowNumber: {
type: 'boolean',
description: 'Whether to allow `number`s in a boolean context.',
},
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: {
type: 'boolean',
description: 'Unless this is set to `true`, the rule will error on every file whose `tsconfig.json` does _not_ have the `strictNullChecks` compiler option (or `strict`) set to `true`.',
},
allowString: {
type: 'boolean',
description: 'Whether to allow `string`s in a boolean context.',
},
},
},
],
},
defaultOptions: [
{
allowAny: false,
allowNullableBoolean: false,
allowNullableEnum: false,
allowNullableNumber: false,
allowNullableObject: true,
allowNullableString: false,
allowNumber: true,
allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
allowString: true,
},
],
create(context, [options]) {
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
const compilerOptions = services.program.getCompilerOptions();
const isStrictNullChecks = tsutils.isStrictCompilerOptionEnabled(compilerOptions, 'strictNullChecks');
if (!isStrictNullChecks &&
options.allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing !== true) {
context.report({
loc: {
start: { column: 0, line: 0 },
end: { column: 0, line: 0 },
},
messageId: 'noStrictNullCheck',
});
}
const traversedNodes = new Set();
return {
CallExpression: traverseCallExpression,
ConditionalExpression: traverseTestExpression,
DoWhileStatement: traverseTestExpression,
ForStatement: traverseTestExpression,
IfStatement: traverseTestExpression,
'LogicalExpression[operator!="??"]': traverseLogicalExpression,
'UnaryExpression[operator="!"]': traverseUnaryLogicalExpression,
WhileStatement: traverseTestExpression,
};
/**
* Inspects condition of a test expression. (`if`, `while`, `for`, etc.)
*/
function traverseTestExpression(node) {
if (node.test == null) {
return;
}
traverseNode(node.test, true);
}
/**
* Inspects the argument of a unary logical expression (`!`).
*/
function traverseUnaryLogicalExpression(node) {
traverseNode(node.argument, true);
}
/**
* Inspects the arguments of a logical expression (`&&`, `||`).
*
* If the logical expression is a descendant of a test expression,
* the `isCondition` flag should be set to true.
* Otherwise, if the logical expression is there on it's own,
* it's used for control flow and is not a condition itself.
*/
function traverseLogicalExpression(node, isCondition = false) {
// left argument is always treated as a condition
traverseNode(node.left, true);
// if the logical expression is used for control flow,
// then its right argument is used for its side effects only
traverseNode(node.right, isCondition);
}
function traverseCallExpression(node) {
const assertedArgument = (0, assertionFunctionUtils_1.findTruthinessAssertedArgument)(services, node);
if (assertedArgument != null) {
traverseNode(assertedArgument, true);
}
if ((0, util_1.isArrayMethodCallWithPredicate)(context, services, node)) {
const predicate = node.arguments.at(0);
if (predicate) {
checkArrayMethodCallPredicate(predicate);
}
}
}
/**
* Dedicated function to check array method predicate calls. Reports predicate
* arguments that don't return a boolean value.
*/
function checkArrayMethodCallPredicate(predicateNode) {
const isFunctionExpression = utils_1.ASTUtils.isFunction(predicateNode);
// custom message for accidental `async` function expressions
if (isFunctionExpression && predicateNode.async) {
return context.report({
node: predicateNode,
messageId: 'predicateCannotBeAsync',
});
}
const returnTypes = services
.getTypeAtLocation(predicateNode)
.getCallSignatures()
.map(signature => {
const type = signature.getReturnType();
if (tsutils.isTypeParameter(type)) {
return checker.getBaseConstraintOfType(type) ?? type;
}
return type;
});
const flattenTypes = [
...new Set(returnTypes.flatMap(type => tsutils.unionConstituents(type))),
];
const types = inspectVariantTypes(flattenTypes);
const reportType = determineReportType(types);
if (reportType == null) {
return;
}
const suggestions = [];
if (isFunctionExpression &&
predicateNode.body.type !== utils_1.AST_NODE_TYPES.BlockStatement) {
suggestions.push(...getSuggestionsForConditionError(predicateNode.body, reportType));
}
if (isFunctionExpression && !predicateNode.returnType) {
suggestions.push({
messageId: 'explicitBooleanReturnType',
fix: fixer => {
if (predicateNode.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression &&
(0, util_1.isParenlessArrowFunction)(predicateNode, context.sourceCode)) {
return [
fixer.insertTextBefore(predicateNode.params[0], '('),
fixer.insertTextAfter(predicateNode.params[0], '): boolean'),
];
}
if (predicateNode.params.length === 0) {
const closingBracket = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(predicateNode, token => token.value === ')'), 'function expression has to have a closing parenthesis.');
return fixer.insertTextAfter(closingBracket, ': boolean');
}
const lastClosingParenthesis = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(predicateNode.params[predicateNode.params.length - 1], token => token.value === ')'), 'function expression has to have a closing parenthesis.');
return fixer.insertTextAfter(lastClosingParenthesis, ': boolean');
},
});
}
return context.report({
node: predicateNode,
messageId: reportType,
data: {
context: 'array predicate return type',
},
suggest: suggestions,
});
}
/**
* Inspects any node.
*
* If it's a logical expression then it recursively traverses its arguments.
* If it's any other kind of node then it's type is finally checked against the rule,
* unless `isCondition` flag is set to false, in which case
* it's assumed to be used for side effects only and is skipped.
*/
function traverseNode(node, isCondition) {
// prevent checking the same node multiple times
if (traversedNodes.has(node)) {
return;
}
traversedNodes.add(node);
// for logical operator, we check its operands
if (node.type === utils_1.AST_NODE_TYPES.LogicalExpression &&
node.operator !== '??') {
traverseLogicalExpression(node, isCondition);
return;
}
// skip if node is not a condition
if (!isCondition) {
return;
}
checkNode(node);
}
function determineReportType(types) {
const is = (...wantedTypes) => types.size === wantedTypes.length &&
wantedTypes.every(type => types.has(type));
// boolean
if (is('boolean') || is('truthy boolean')) {
// boolean is always ok
return undefined;
}
// never
if (is('never')) {
// never is always okay
return undefined;
}
// nullish
if (is('nullish')) {
// condition is always false
return 'conditionErrorNullish';
}
// Known edge case: boolean `true` and nullish values are always valid boolean expressions
if (is('nullish', 'truthy boolean')) {
return;
}
// nullable boolean
if (is('nullish', 'boolean')) {
return !options.allowNullableBoolean
? 'conditionErrorNullableBoolean'
: undefined;
}
// Known edge case: truthy primitives and nullish values are always valid boolean expressions
if ((options.allowNumber && is('nullish', 'truthy number')) ||
(options.allowString && is('nullish', 'truthy string'))) {
return;
}
// string
if (is('string') || is('truthy string')) {
return !options.allowString ? 'conditionErrorString' : undefined;
}
// nullable string
if (is('nullish', 'string')) {
return !options.allowNullableString
? 'conditionErrorNullableString'
: undefined;
}
// number
if (is('number') || is('truthy number')) {
return !options.allowNumber ? 'conditionErrorNumber' : undefined;
}
// nullable number
if (is('nullish', 'number')) {
return !options.allowNullableNumber
? 'conditionErrorNullableNumber'
: undefined;
}
// object
if (is('object')) {
return 'conditionErrorObject';
}
// nullable object
if (is('nullish', 'object')) {
return !options.allowNullableObject
? 'conditionErrorNullableObject'
: undefined;
}
// nullable enum
if (is('nullish', 'number', 'enum') ||
is('nullish', 'string', 'enum') ||
is('nullish', 'truthy number', 'enum') ||
is('nullish', 'truthy string', 'enum') ||
// mixed enums
is('nullish', 'truthy number', 'truthy string', 'enum') ||
is('nullish', 'truthy number', 'string', 'enum') ||
is('nullish', 'truthy string', 'number', 'enum') ||
is('nullish', 'number', 'string', 'enum')) {
return !options.allowNullableEnum
? 'conditionErrorNullableEnum'
: undefined;
}
// any
if (is('any')) {
return !options.allowAny ? 'conditionErrorAny' : undefined;
}
return 'conditionErrorOther';
}
function getSuggestionsForConditionError(node, conditionError) {
switch (conditionError) {
case 'conditionErrorAny':
return [
{
messageId: 'conditionFixCastBoolean',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `Boolean(${code})`,
}),
},
];
case 'conditionErrorNullableBoolean':
if (isLogicalNegationExpression(node.parent)) {
// if (!nullableBoolean)
return [
{
messageId: 'conditionFixDefaultFalse',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} ?? false`,
}),
},
{
messageId: 'conditionFixCompareFalse',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `${code} === false`,
}),
},
];
}
// if (nullableBoolean)
return [
{
messageId: 'conditionFixDefaultFalse',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} ?? false`,
}),
},
{
messageId: 'conditionFixCompareTrue',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} === true`,
}),
},
];
case 'conditionErrorNullableEnum':
if (isLogicalNegationExpression(node.parent)) {
return [
{
messageId: 'conditionFixCompareNullish',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `${code} == null`,
}),
},
];
}
return [
{
messageId: 'conditionFixCompareNullish',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} != null`,
}),
},
];
case 'conditionErrorNullableNumber':
if (isLogicalNegationExpression(node.parent)) {
// if (!nullableNumber)
return [
{
messageId: 'conditionFixCompareNullish',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `${code} == null`,
}),
},
{
messageId: 'conditionFixDefaultZero',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} ?? 0`,
}),
},
{
messageId: 'conditionFixCastBoolean',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `!Boolean(${code})`,
}),
},
];
}
// if (nullableNumber)
return [
{
messageId: 'conditionFixCompareNullish',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} != null`,
}),
},
{
messageId: 'conditionFixDefaultZero',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} ?? 0`,
}),
},
{
messageId: 'conditionFixCastBoolean',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `Boolean(${code})`,
}),
},
];
case 'conditionErrorNullableObject':
if (isLogicalNegationExpression(node.parent)) {
// if (!nullableObject)
return [
{
messageId: 'conditionFixCompareNullish',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `${code} == null`,
}),
},
];
}
// if (nullableObject)
return [
{
messageId: 'conditionFixCompareNullish',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} != null`,
}),
},
];
case 'conditionErrorNullableString':
if (isLogicalNegationExpression(node.parent)) {
// if (!nullableString)
return [
{
messageId: 'conditionFixCompareNullish',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `${code} == null`,
}),
},
{
messageId: 'conditionFixDefaultEmptyString',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} ?? ""`,
}),
},
{
messageId: 'conditionFixCastBoolean',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `!Boolean(${code})`,
}),
},
];
}
// if (nullableString)
return [
{
messageId: 'conditionFixCompareNullish',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} != null`,
}),
},
{
messageId: 'conditionFixDefaultEmptyString',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} ?? ""`,
}),
},
{
messageId: 'conditionFixCastBoolean',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `Boolean(${code})`,
}),
},
];
case 'conditionErrorNumber':
if (isArrayLengthExpression(node, checker, services)) {
if (isLogicalNegationExpression(node.parent)) {
// if (!array.length)
return [
{
messageId: 'conditionFixCompareArrayLengthZero',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `${code} === 0`,
}),
},
];
}
// if (array.length)
return [
{
messageId: 'conditionFixCompareArrayLengthNonzero',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} > 0`,
}),
},
];
}
if (isLogicalNegationExpression(node.parent)) {
// if (!number)
return [
{
messageId: 'conditionFixCompareZero',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
// TODO: we have to compare to 0n if the type is bigint
wrap: code => `${code} === 0`,
}),
},
{
// TODO: don't suggest this for bigint because it can't be NaN
messageId: 'conditionFixCompareNaN',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `Number.isNaN(${code})`,
}),
},
{
messageId: 'conditionFixCastBoolean',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `!Boolean(${code})`,
}),
},
];
}
// if (number)
return [
{
messageId: 'conditionFixCompareZero',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} !== 0`,
}),
},
{
messageId: 'conditionFixCompareNaN',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `!Number.isNaN(${code})`,
}),
},
{
messageId: 'conditionFixCastBoolean',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `Boolean(${code})`,
}),
},
];
case 'conditionErrorString':
if (isLogicalNegationExpression(node.parent)) {
// if (!string)
return [
{
messageId: 'conditionFixCompareStringLength',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `${code}.length === 0`,
}),
},
{
messageId: 'conditionFixCompareEmptyString',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `${code} === ""`,
}),
},
{
messageId: 'conditionFixCastBoolean',
fix: (0, util_1.getWrappingFixer)({
node: node.parent,
innerNode: node,
sourceCode: context.sourceCode,
wrap: code => `!Boolean(${code})`,
}),
},
];
}
// if (string)
return [
{
messageId: 'conditionFixCompareStringLength',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code}.length > 0`,
}),
},
{
messageId: 'conditionFixCompareEmptyString',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `${code} !== ""`,
}),
},
{
messageId: 'conditionFixCastBoolean',
fix: (0, util_1.getWrappingFixer)({
node,
sourceCode: context.sourceCode,
wrap: code => `Boolean(${code})`,
}),
},
];
case 'conditionErrorObject':
case 'conditionErrorNullish':
case 'conditionErrorOther':
return [];
default:
conditionError;
throw new Error('Unreachable');
}
}
/**
* This function does the actual type check on a node.
* It analyzes the type of a node and checks if it is allowed in a boolean context.
*/
function checkNode(node) {
const type = (0, util_1.getConstrainedTypeAtLocation)(services, node);
const types = inspectVariantTypes(tsutils.unionConstituents(type));
const reportType = determineReportType(types);
if (reportType != null) {
context.report({
node,
messageId: reportType,
data: {
context: 'conditional',
},
suggest: getSuggestionsForConditionError(node, reportType),
});
}
}
/**
* Check union variants for the types we care about
*/
function inspectVariantTypes(types) {
const variantTypes = new Set();
if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.VoidLike))) {
variantTypes.add('nullish');
}
const booleans = types.filter(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.BooleanLike));
// If incoming type is either "true" or "false", there will be one type
// object with intrinsicName set accordingly
// If incoming type is boolean, there will be two type objects with
// intrinsicName set "true" and "false" each because of ts-api-utils.unionConstituents()
if (booleans.length === 1) {
variantTypes.add(tsutils.isTrueLiteralType(booleans[0]) ? 'truthy boolean' : 'boolean');
}
else if (booleans.length === 2) {
variantTypes.add('boolean');
}
const strings = types.filter(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.StringLike));
if (strings.length) {
if (strings.every(type => type.isStringLiteral() && type.value !== '')) {
variantTypes.add('truthy string');
}
else {
variantTypes.add('string');
}
}
const numbers = types.filter(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.NumberLike | ts.TypeFlags.BigIntLike));
if (numbers.length) {
if (numbers.every(type => type.isNumberLiteral() && type.value !== 0)) {
variantTypes.add('truthy number');
}
else {
variantTypes.add('number');
}
}
if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.EnumLike))) {
variantTypes.add('enum');
}
if (types.some(type => !tsutils.isTypeFlagSet(type, ts.TypeFlags.Null |
ts.TypeFlags.Undefined |
ts.TypeFlags.VoidLike |
ts.TypeFlags.BooleanLike |
ts.TypeFlags.StringLike |
ts.TypeFlags.NumberLike |
ts.TypeFlags.BigIntLike |
ts.TypeFlags.TypeParameter |
ts.TypeFlags.Any |
ts.TypeFlags.Unknown |
ts.TypeFlags.Never))) {
variantTypes.add(types.some(isBrandedBoolean) ? 'boolean' : 'object');
}
if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.TypeParameter |
ts.TypeFlags.Any |
ts.TypeFlags.Unknown))) {
variantTypes.add('any');
}
if (types.some(type => tsutils.isTypeFlagSet(type, ts.TypeFlags.Never))) {
variantTypes.add('never');
}
return variantTypes;
}
},
});
function isLogicalNegationExpression(node) {
return node.type === utils_1.AST_NODE_TYPES.UnaryExpression && node.operator === '!';
}
function isArrayLengthExpression(node, typeChecker, services) {
if (node.type !== utils_1.AST_NODE_TYPES.MemberExpression) {
return false;
}
if (node.computed) {
return false;
}
if (node.property.name !== 'length') {
return false;
}
const objectType = (0, util_1.getConstrainedTypeAtLocation)(services, node.object);
return (0, util_1.isTypeArrayTypeOrUnionOfArrayTypes)(objectType, typeChecker);
}
/**
* Verify is the type is a branded boolean (e.g. `type Foo = boolean & { __brand: 'Foo' }`)
*
* @param type The type checked
*/
function isBrandedBoolean(type) {
return (type.isIntersection() &&
type.types.some(childType => isBooleanType(childType)));
}
function isBooleanType(expressionType) {
return tsutils.isTypeFlagSet(expressionType, ts.TypeFlags.Boolean | ts.TypeFlags.BooleanLiteral);
}
@@ -0,0 +1,59 @@
/**
* @author Christian Schulz
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*/
"use strict"
const { checkForRestriction, messages } = require("../util/check-restricted")
const visit = require("../util/visit-require")
/** @type {import('./rule-module').RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "disallow specified modules when loaded by `require`",
recommended: false,
url: "https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-restricted-require.md",
},
fixable: null,
schema: [
{
type: "array",
items: {
anyOf: [
{ type: "string" },
{
type: "object",
properties: {
name: {
anyOf: [
{ type: "string" },
{
type: "array",
items: { type: "string" },
additionalItems: false,
},
],
},
message: { type: "string" },
},
additionalProperties: false,
required: ["name"],
},
],
},
additionalItems: false,
},
],
messages,
},
create(context) {
const opts = { includeCore: true }
return visit(context, opts, targets =>
checkForRestriction(context, targets)
)
},
}
@@ -0,0 +1,7 @@
import type { PublicContextDescriptor } from '../../store';
import type { ClientRect } from '../../types';
interface Arguments {
measure(element: HTMLElement): ClientRect;
}
export declare function useDragOverlayMeasuring({ measure, }: Arguments): PublicContextDescriptor['dragOverlay'];
export {};
@@ -0,0 +1,19 @@
import { DateInput } from './types';
/**
* Calculates the difference in months between two dates.
* 计算两个日期之间的月份差
*
* @param date - The first date to compare.
* @param input - The second date to compare.
* @param asFloat - Whether to return the result as a float.
* @returns The difference in months between the two dates.
* @example
* ```ts
* diffInYears(new Date(), new Date()); // 0
* diffInYears(new Date(), new Date(Date.now() + 1000 * 60 * 60 * 24 * 30)); // 1
* diffInYears(new Date(), new Date(Date.now() - 1000 * 60 * 60 * 24 * 30)); // -1
* diffInYears(new Date(), new Date(Date.now() - 1000 * 60 * 60 * 24 * 30 * 12)); // -1
* diffInYears(new Date(), new Date(Date.now() - 1000 * 60 * 60 * 24 * 30 * 12 * 2)); // -2
* ```
*/
export default function diffInYears(date: Date, input: DateInput, asFloat?: boolean): number;
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var TabPanelRole = {
relatedConcepts: [{
module: 'ARIA',
concept: {
name: 'tabpanel'
}
}],
type: 'structure'
};
var _default = TabPanelRole;
exports.default = _default;
@@ -0,0 +1,34 @@
(function(t){function e(){var o=t();return o.default||o}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var f=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};f.prettier=e()}})(function(){"use strict";var Fu=Object.create;var Ue=Object.defineProperty;var pu=Object.getOwnPropertyDescriptor;var du=Object.getOwnPropertyNames;var mu=Object.getPrototypeOf,Eu=Object.prototype.hasOwnProperty;var Zt=e=>{throw TypeError(e)};var Cu=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dt=(e,t)=>{for(var r in t)Ue(e,r,{get:t[r],enumerable:!0})},er=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of du(t))!Eu.call(e,u)&&u!==r&&Ue(e,u,{get:()=>t[u],enumerable:!(n=pu(t,u))||n.enumerable});return e};var hu=(e,t,r)=>(r=e!=null?Fu(mu(e)):{},er(t||!e||!e.__esModule?Ue(r,"default",{value:e,enumerable:!0}):r,e)),gu=e=>er(Ue({},"__esModule",{value:!0}),e);var yu=(e,t,r)=>t.has(e)||Zt("Cannot "+r);var tr=(e,t,r)=>t.has(e)?Zt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r);var fe=(e,t,r)=>(yu(e,t,"access private method"),r);var Pn=Cu(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});function Co(){return new Proxy({},{get:()=>e=>e})}var On=/\r\n|[\n\r\u2028\u2029]/;function ho(e,t,r){let n=Object.assign({column:0,line:-1},e.start),u=Object.assign({},n,e.end),{linesAbove:o=2,linesBelow:i=3}=r||{},s=n.line,a=n.column,c=u.line,D=u.column,p=Math.max(s-(o+1),0),l=Math.min(t.length,c+i);s===-1&&(p=0),c===-1&&(l=t.length);let F=c-s,f={};if(F)for(let d=0;d<=F;d++){let m=d+s;if(!a)f[m]=!0;else if(d===0){let C=t[m-1].length;f[m]=[a,C-a+1]}else if(d===F)f[m]=[0,D];else{let C=t[m-d].length;f[m]=[0,C]}}else a===D?a?f[s]=[a,0]:f[s]=!0:f[s]=[a,D-a];return{start:p,end:l,markerLines:f}}function go(e,t,r={}){let u=Co(!1),o=e.split(On),{start:i,end:s,markerLines:a}=ho(t,o,r),c=t.start&&typeof t.start.column=="number",D=String(s).length,l=e.split(On,s).slice(i,s).map((F,f)=>{let d=i+1+f,C=` ${` ${d}`.slice(-D)} |`,E=a[d],h=!a[d+1];if(E){let x="";if(Array.isArray(E)){let A=F.slice(0,Math.max(E[0]-1,0)).replace(/[^\t]/g," "),$=E[1]||1;x=[`
`,u.gutter(C.replace(/\d/g," "))," ",A,u.marker("^").repeat($)].join(""),h&&r.message&&(x+=" "+u.message(r.message))}return[u.marker(">"),u.gutter(C),F.length>0?` ${F}`:"",x].join("")}else return` ${u.gutter(C)}${F.length>0?` ${F}`:""}`}).join(`
`);return r.message&&!c&&(l=`${" ".repeat(D+1)}${r.message}
${l}`),l}Mt.codeFrameColumns=go});var oi={};dt(oi,{__debug:()=>ui,check:()=>ri,doc:()=>qt,format:()=>fu,formatWithCursor:()=>cu,getSupportInfo:()=>ni,util:()=>Qt,version:()=>tu});var Au=(e,t,r,n)=>{if(!(e&&t==null))return t.replaceAll?t.replaceAll(r,n):r.global?t.replace(r,n):t.split(r).join(n)},te=Au;var _e=class{diff(t,r,n={}){let u;typeof n=="function"?(u=n,n={}):"callback"in n&&(u=n.callback);let o=this.castInput(t,n),i=this.castInput(r,n),s=this.removeEmpty(this.tokenize(o,n)),a=this.removeEmpty(this.tokenize(i,n));return this.diffWithOptionsObj(s,a,n,u)}diffWithOptionsObj(t,r,n,u){var o;let i=E=>{if(E=this.postProcess(E,n),u){setTimeout(function(){u(E)},0);return}else return E},s=r.length,a=t.length,c=1,D=s+a;n.maxEditLength!=null&&(D=Math.min(D,n.maxEditLength));let p=(o=n.timeout)!==null&&o!==void 0?o:1/0,l=Date.now()+p,F=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(F[0],r,t,0,n);if(F[0].oldPos+1>=a&&f+1>=s)return i(this.buildValues(F[0].lastComponent,r,t));let d=-1/0,m=1/0,C=()=>{for(let E=Math.max(d,-c);E<=Math.min(m,c);E+=2){let h,x=F[E-1],A=F[E+1];x&&(F[E-1]=void 0);let $=!1;if(A){let Be=A.oldPos-E;$=A&&0<=Be&&Be<s}let ue=x&&x.oldPos+1<a;if(!$&&!ue){F[E]=void 0;continue}if(!ue||$&&x.oldPos<A.oldPos?h=this.addToPath(A,!0,!1,0,n):h=this.addToPath(x,!1,!0,1,n),f=this.extractCommon(h,r,t,E,n),h.oldPos+1>=a&&f+1>=s)return i(this.buildValues(h.lastComponent,r,t))||!0;F[E]=h,h.oldPos+1>=a&&(m=Math.min(m,E-1)),f+1>=s&&(d=Math.max(d,E+1))}c++};if(u)(function E(){setTimeout(function(){if(c>D||Date.now()>l)return u(void 0);C()||E()},0)})();else for(;c<=D&&Date.now()<=l;){let E=C();if(E)return E}}addToPath(t,r,n,u,o){let i=t.lastComponent;return i&&!o.oneChangePerToken&&i.added===r&&i.removed===n?{oldPos:t.oldPos+u,lastComponent:{count:i.count+1,added:r,removed:n,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+u,lastComponent:{count:1,added:r,removed:n,previousComponent:i}}}extractCommon(t,r,n,u,o){let i=r.length,s=n.length,a=t.oldPos,c=a-u,D=0;for(;c+1<i&&a+1<s&&this.equals(n[a+1],r[c+1],o);)c++,a++,D++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return D&&!o.oneChangePerToken&&(t.lastComponent={count:D,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=a,c}equals(t,r,n){return n.comparator?n.comparator(t,r):t===r||!!n.ignoreCase&&t.toLowerCase()===r.toLowerCase()}removeEmpty(t){let r=[];for(let n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r}castInput(t,r){return t}tokenize(t,r){return Array.from(t)}join(t){return t.join("")}postProcess(t,r){return t}get useLongestToken(){return!1}buildValues(t,r,n){let u=[],o;for(;t;)u.push(t),o=t.previousComponent,delete t.previousComponent,t=o;u.reverse();let i=u.length,s=0,a=0,c=0;for(;s<i;s++){let D=u[s];if(D.removed)D.value=this.join(n.slice(c,c+D.count)),c+=D.count;else{if(!D.added&&this.useLongestToken){let p=r.slice(a,a+D.count);p=p.map(function(l,F){let f=n[c+F];return f.length>l.length?f:l}),D.value=this.join(p)}else D.value=this.join(r.slice(a,a+D.count));a+=D.count,D.added||(c+=D.count)}}return u}};var mt=class extends _e{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}},rr=new mt;function Et(e,t,r){return rr.diff(e,t,r)}function nr(e){let t=e.indexOf("\r");return t!==-1?e.charAt(t+1)===`
`?"crlf":"cr":"lf"}function xe(e){switch(e){case"cr":return"\r";case"crlf":return`\r
`;default:return`
`}}function Ct(e,t){let r;switch(t){case`
`:r=/\n/gu;break;case"\r":r=/\r/gu;break;case`\r
`:r=/\r\n/gu;break;default:throw new Error(`Unexpected "eol" ${JSON.stringify(t)}.`)}let n=e.match(r);return n?n.length:0}function ur(e){return te(!1,e,/\r\n?/gu,`
`)}var W="string",Y="array",j="cursor",N="indent",O="align",P="trim",B="group",k="fill",_="if-break",v="indent-if-break",L="line-suffix",I="line-suffix-boundary",g="line",S="label",w="break-parent",Ve=new Set([j,N,O,P,B,k,_,v,L,I,g,S,w]);var Bu=(e,t,r)=>{if(!(e&&t==null))return Array.isArray(t)||typeof t=="string"?t[r<0?t.length+r:r]:t.at(r)},y=Bu;function or(e){let t=e.length;for(;t>0&&(e[t-1]==="\r"||e[t-1]===`
`);)t--;return t<e.length?e.slice(0,t):e}function _u(e){if(typeof e=="string")return W;if(Array.isArray(e))return Y;if(!e)return;let{type:t}=e;if(Ve.has(t))return t}var M=_u;var xu=e=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(e);function wu(e){let t=e===null?"null":typeof e;if(t!=="string"&&t!=="object")return`Unexpected doc '${t}',
Expected it to be 'string' or 'object'.`;if(M(e))throw new Error("doc is valid.");let r=Object.prototype.toString.call(e);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=xu([...Ve].map(u=>`'${u}'`));return`Unexpected doc.type '${e.type}'.
Expected it to be ${n}.`}var ht=class extends Error{name="InvalidDocError";constructor(t){super(wu(t)),this.doc=t}},q=ht;var ir={};function bu(e,t,r,n){let u=[e];for(;u.length>0;){let o=u.pop();if(o===ir){r(u.pop());continue}r&&u.push(o,ir);let i=M(o);if(!i)throw new q(o);if((t==null?void 0:t(o))!==!1)switch(i){case Y:case k:{let s=i===Y?o:o.parts;for(let a=s.length,c=a-1;c>=0;--c)u.push(s[c]);break}case _:u.push(o.flatContents,o.breakContents);break;case B:if(n&&o.expandedStates)for(let s=o.expandedStates.length,a=s-1;a>=0;--a)u.push(o.expandedStates[a]);else u.push(o.contents);break;case O:case N:case v:case S:case L:u.push(o.contents);break;case W:case j:case P:case I:case g:case w:break;default:throw new q(o)}}}var le=bu;function be(e,t){if(typeof e=="string")return t(e);let r=new Map;return n(e);function n(o){if(r.has(o))return r.get(o);let i=u(o);return r.set(o,i),i}function u(o){switch(M(o)){case Y:return t(o.map(n));case k:return t({...o,parts:o.parts.map(n)});case _:return t({...o,breakContents:n(o.breakContents),flatContents:n(o.flatContents)});case B:{let{expandedStates:i,contents:s}=o;return i?(i=i.map(n),s=i[0]):s=n(s),t({...o,contents:s,expandedStates:i})}case O:case N:case v:case S:case L:return t({...o,contents:n(o.contents)});case W:case j:case P:case I:case g:case w:return t(o);default:throw new q(o)}}}function $e(e,t,r){let n=r,u=!1;function o(i){if(u)return!1;let s=t(i);s!==void 0&&(u=!0,n=s)}return le(e,o),n}function ku(e){if(e.type===B&&e.break||e.type===g&&e.hard||e.type===w)return!0}function Dr(e){return $e(e,ku,!1)}function sr(e){if(e.length>0){let t=y(!1,e,-1);!t.expandedStates&&!t.break&&(t.break="propagated")}return null}function cr(e){let t=new Set,r=[];function n(o){if(o.type===w&&sr(r),o.type===B){if(r.push(o),t.has(o))return!1;t.add(o)}}function u(o){o.type===B&&r.pop().break&&sr(r)}le(e,n,u,!0)}function Su(e){return e.type===g&&!e.hard?e.soft?"":" ":e.type===_?e.flatContents:e}function fr(e){return be(e,Su)}function ar(e){for(e=[...e];e.length>=2&&y(!1,e,-2).type===g&&y(!1,e,-1).type===w;)e.length-=2;if(e.length>0){let t=we(y(!1,e,-1));e[e.length-1]=t}return e}function we(e){switch(M(e)){case N:case v:case B:case L:case S:{let t=we(e.contents);return{...e,contents:t}}case _:return{...e,breakContents:we(e.breakContents),flatContents:we(e.flatContents)};case k:return{...e,parts:ar(e.parts)};case Y:return ar(e);case W:return or(e);case O:case j:case P:case I:case g:case w:break;default:throw new q(e)}return e}function We(e){return we(Nu(e))}function Tu(e){switch(M(e)){case k:if(e.parts.every(t=>t===""))return"";break;case B:if(!e.contents&&!e.id&&!e.break&&!e.expandedStates)return"";if(e.contents.type===B&&e.contents.id===e.id&&e.contents.break===e.break&&e.contents.expandedStates===e.expandedStates)return e.contents;break;case O:case N:case v:case L:if(!e.contents)return"";break;case _:if(!e.flatContents&&!e.breakContents)return"";break;case Y:{let t=[];for(let r of e){if(!r)continue;let[n,...u]=Array.isArray(r)?r:[r];typeof n=="string"&&typeof y(!1,t,-1)=="string"?t[t.length-1]+=n:t.push(n),t.push(...u)}return t.length===0?"":t.length===1?t[0]:t}case W:case j:case P:case I:case g:case S:case w:break;default:throw new q(e)}return e}function Nu(e){return be(e,t=>Tu(t))}function lr(e,t=Me){return be(e,r=>typeof r=="string"?ke(t,r.split(`
`)):r)}function Ou(e){if(e.type===g)return!0}function Fr(e){return $e(e,Ou,!1)}function Fe(e,t){return e.type===S?{...e,contents:t(e.contents)}:t(e)}var gt=()=>{},K=gt,yt=gt,pr=gt;function ie(e){return K(e),{type:N,contents:e}}function oe(e,t){return K(t),{type:O,contents:t,n:e}}function At(e,t={}){return K(e),yt(t.expandedStates,!0),{type:B,id:t.id,contents:e,break:!!t.shouldBreak,expandedStates:t.expandedStates}}function dr(e){return oe(Number.NEGATIVE_INFINITY,e)}function mr(e){return oe({type:"root"},e)}function Er(e){return oe(-1,e)}function Cr(e,t){return At(e[0],{...t,expandedStates:e})}function hr(e){return pr(e),{type:k,parts:e}}function gr(e,t="",r={}){return K(e),t!==""&&K(t),{type:_,breakContents:e,flatContents:t,groupId:r.groupId}}function yr(e,t){return K(e),{type:v,contents:e,groupId:t.groupId,negate:t.negate}}function Se(e){return K(e),{type:L,contents:e}}var Ar={type:I},pe={type:w},Br={type:P},Te={type:g,hard:!0},Bt={type:g,hard:!0,literal:!0},Ge={type:g},_r={type:g,soft:!0},z=[Te,pe],Me=[Bt,pe],X={type:j};function ke(e,t){K(e),yt(t);let r=[];for(let n=0;n<t.length;n++)n!==0&&r.push(e),r.push(t[n]);return r}function Ke(e,t,r){K(e);let n=e;if(t>0){for(let u=0;u<Math.floor(t/r);++u)n=ie(n);n=oe(t%r,n),n=oe(Number.NEGATIVE_INFINITY,n)}return n}function xr(e,t){return K(t),e?{type:S,label:e,contents:t}:t}function Q(e){var t;if(!e)return"";if(Array.isArray(e)){let r=[];for(let n of e)if(Array.isArray(n))r.push(...Q(n));else{let u=Q(n);u!==""&&r.push(u)}return r}return e.type===_?{...e,breakContents:Q(e.breakContents),flatContents:Q(e.flatContents)}:e.type===B?{...e,contents:Q(e.contents),expandedStates:(t=e.expandedStates)==null?void 0:t.map(Q)}:e.type===k?{type:"fill",parts:e.parts.map(Q)}:e.contents?{...e,contents:Q(e.contents)}:e}function wr(e){let t=Object.create(null),r=new Set;return n(Q(e));function n(o,i,s){var a,c;if(typeof o=="string")return JSON.stringify(o);if(Array.isArray(o)){let D=o.map(n).filter(Boolean);return D.length===1?D[0]:`[${D.join(", ")}]`}if(o.type===g){let D=((a=s==null?void 0:s[i+1])==null?void 0:a.type)===w;return o.literal?D?"literalline":"literallineWithoutBreakParent":o.hard?D?"hardline":"hardlineWithoutBreakParent":o.soft?"softline":"line"}if(o.type===w)return((c=s==null?void 0:s[i-1])==null?void 0:c.type)===g&&s[i-1].hard?void 0:"breakParent";if(o.type===P)return"trim";if(o.type===N)return"indent("+n(o.contents)+")";if(o.type===O)return o.n===Number.NEGATIVE_INFINITY?"dedentToRoot("+n(o.contents)+")":o.n<0?"dedent("+n(o.contents)+")":o.n.type==="root"?"markAsRoot("+n(o.contents)+")":"align("+JSON.stringify(o.n)+", "+n(o.contents)+")";if(o.type===_)return"ifBreak("+n(o.breakContents)+(o.flatContents?", "+n(o.flatContents):"")+(o.groupId?(o.flatContents?"":', ""')+`, { groupId: ${u(o.groupId)} }`:"")+")";if(o.type===v){let D=[];o.negate&&D.push("negate: true"),o.groupId&&D.push(`groupId: ${u(o.groupId)}`);let p=D.length>0?`, { ${D.join(", ")} }`:"";return`indentIfBreak(${n(o.contents)}${p})`}if(o.type===B){let D=[];o.break&&o.break!=="propagated"&&D.push("shouldBreak: true"),o.id&&D.push(`id: ${u(o.id)}`);let p=D.length>0?`, { ${D.join(", ")} }`:"";return o.expandedStates?`conditionalGroup([${o.expandedStates.map(l=>n(l)).join(",")}]${p})`:`group(${n(o.contents)}${p})`}if(o.type===k)return`fill([${o.parts.map(D=>n(D)).join(", ")}])`;if(o.type===L)return"lineSuffix("+n(o.contents)+")";if(o.type===I)return"lineSuffixBoundary";if(o.type===S)return`label(${JSON.stringify(o.label)}, ${n(o.contents)})`;if(o.type===j)return"cursor";throw new Error("Unknown doc type "+o.type)}function u(o){if(typeof o!="symbol")return JSON.stringify(String(o));if(o in t)return t[o];let i=o.description||"symbol";for(let s=0;;s++){let a=i+(s>0?` #${s}`:"");if(!r.has(a))return r.add(a),t[o]=`Symbol.for(${JSON.stringify(a)})`}}}var br=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF9Line truncated
`?te(!1,f,`
`,u):f;s.push(d),i.length>0&&(o+=Ne(d));break}case Y:for(let d=f.length-1;d>=0;d--)i.push({ind:l,mode:F,doc:f[d]});break;case j:if(D>=2)throw new Error("There are too many 'cursor' in doc.");s.push(de),D++;break;case N:i.push({ind:Lu(l,t),mode:F,doc:f.contents});break;case O:i.push({ind:Iu(l,f.n,t),mode:F,doc:f.contents});break;case P:o-=wt(s);break;case B:switch(F){case H:if(!a){i.push({ind:l,mode:f.break?R:H,doc:f.contents});break}case R:{a=!1;let d={ind:l,mode:H,doc:f.contents},m=n-o,C=c.length>0;if(!f.break&&ze(d,i,m,C,r))i.push(d);else if(f.expandedStates){let E=y(!1,f.expandedStates,-1);if(f.break){i.push({ind:l,mode:R,doc:E});break}else for(let h=1;h<f.expandedStates.length+1;h++)if(h>=f.expandedStates.length){i.push({ind:l,mode:R,doc:E});break}else{let x=f.expandedStates[h],A={ind:l,mode:H,doc:x};if(ze(A,i,m,C,r)){i.push(A);break}}}else i.push({ind:l,mode:R,doc:f.contents});break}}f.id&&(r[f.id]=y(!1,i,-1).mode);break;case k:{let d=n-o,m=f[_t]??0,{parts:C}=f,E=C.length-m;if(E===0)break;let h=C[m+0],x=C[m+1],A={ind:l,mode:H,doc:h},$={ind:l,mode:R,doc:h},ue=ze(A,[],d,c.length>0,r,!0);if(E===1){ue?i.push(A):i.push($);break}let Be={ind:l,mode:H,doc:x},Ft={ind:l,mode:R,doc:x};if(E===2){ue?i.push(Be,A):i.push(Ft,$);break}let lu=C[m+2],pt={ind:l,mode:F,doc:{...f,[_t]:m+2}};ze({ind:l,mode:H,doc:[h,x,lu]},[],d,c.length>0,r,!0)?i.push(pt,Be,A):ue?i.push(pt,Ft,A):i.push(pt,Ft,$);break}case _:case v:{let d=f.groupId?r[f.groupId]:F;if(d===R){let m=f.type===_?f.breakContents:f.negate?f.contents:ie(f.contents);m&&i.push({ind:l,mode:F,doc:m})}if(d===H){let m=f.type===_?f.flatContents:f.negate?ie(f.contents):f.contents;m&&i.push({ind:l,mode:F,doc:m})}break}case L:c.push({ind:l,mode:F,doc:f.contents});break;case I:c.length>0&&i.push({ind:l,mode:F,doc:Te});break;case g:switch(F){case H:if(f.hard)a=!0;else{f.soft||(s.push(" "),o+=1);break}case R:if(c.length>0){i.push({ind:l,mode:F,doc:f},...c.reverse()),c.length=0;break}f.literal?l.root?(s.push(u,l.root.value),o=l.root.length):(s.push(u),o=0):(o-=wt(s),s.push(u+l.value),o=l.length);break}break;case S:i.push({ind:l,mode:F,doc:f.contents});break;case w:break;default:throw new q(f)}i.length===0&&c.length>0&&(i.push(...c.reverse()),c.length=0)}let p=s.indexOf(de);if(p!==-1){let l=s.indexOf(de,p+1);if(l===-1)return{formatted:s.filter(m=>m!==de).join("")};let F=s.slice(0,p).join(""),f=s.slice(p+1,l).join(""),d=s.slice(l+1).join("");return{formatted:F+f+d,cursorNodeStart:F.length,cursorNodeText:f}}return{formatted:s.join("")}}function Ru(e,t,r=0){let n=0;for(let u=r;u<e.length;++u)e[u]===" "?n=n+t-n%t:n++;return n}var Ee=Ru;var Z,kt,He,bt=class{constructor(t){tr(this,Z);this.stack=[t]}get key(){let{stack:t,siblings:r}=this;return y(!1,t,r===null?-2:-4)??null}get index(){return this.siblings===null?null:y(!1,this.stack,-2)}get node(){return y(!1,this.stack,-1)}get parent(){return this.getNode(1)}get grandparent(){return this.getNode(2)}get isInArray(){return this.siblings!==null}get siblings(){let{stack:t}=this,r=y(!1,t,-3);return Array.isArray(r)?r:null}get next(){let{siblings:t}=this;return t===null?null:t[this.index+1]}get previous(){let{siblings:t}=this;return t===null?null:t[this.index-1]}get isFirst(){return this.index===0}get isLast(){let{siblings:t,index:r}=this;return t!==null&&r===t.length-1}get isRoot(){return this.stack.length===1}get root(){return this.stack[0]}get ancestors(){return[...fe(this,Z,He).call(this)]}getName(){let{stack:t}=this,{length:r}=t;return r>1?y(!1,t,-2):null}getValue(){return y(!1,this.stack,-1)}getNode(t=0){let r=fe(this,Z,kt).call(this,t);return r===-1?null:this.stack[r]}getParentNode(t=0){return this.getNode(t+1)}call(t,...r){let{stack:n}=this,{length:u}=n,o=y(!1,n,-1);for(let i of r)o=o[i],n.push(i,o);try{return t(this)}finally{n.length=u}}callParent(t,r=0){let n=fe(this,Z,kt).call(this,r+1),u=this.stack.splice(n+1);try{return t(this)}finally{this.stack.push(...u)}}each(t,...r){let{stack:n}=this,{length:u}=n,o=y(!1,n,-1);for(let i of r)o=o[i],n.push(i,o);try{for(let i=0;i<o.length;++i)n.push(i,o[i]),t(this,i,o),n.length-=2}finally{n.length=u}}map(t,...r){let n=[];return this.each((u,o,i)=>{n[o]=t(u,o,i)},...r),n}match(...t){let r=this.stack.length-1,n=null,u=this.stack[r--];for(let o of t){if(u===void 0)return!1;let i=null;if(typeof n=="number"&&(i=n,n=this.stack[r--],u=this.stack[r--]),o&&!o(u,n,i))return!1;n=this.stack[r--],u=this.stack[r--]}return!0}findAncestor(t){for(let r of fe(this,Z,He).call(this))if(t(r))return r}hasAncestor(t){for(let r of fe(this,Z,He).call(this))if(t(r))return!0;return!1}};Z=new WeakSet,kt=function(t){let{stack:r}=this;for(let n=r.length-1;n>=0;n-=2)if(!Array.isArray(r[n])&&--t<0)return n;return-1},He=function*(){let{stack:t}=this;for(let r=t.length-3;r>=0;r-=2){let n=t[r];Array.isArray(n)||(yield n)}};var Or=bt;var Pr=new Proxy(()=>{},{get:()=>Pr}),Oe=Pr;function Yu(e){return e!==null&&typeof e=="object"}var vr=Yu;function*Ce(e,t){let{getVisitorKeys:r,filter:n=()=>!0}=t,u=o=>vr(o)&&n(o);for(let o of r(e)){letLine truncated
`)return t-2;if(u===`
`||u==="\r"||u==="\u2028"||u==="\u2029")return t-1}else{if(u==="\r"&&e.charAt(t+1)===`
`)return t+2;if(u===`
`||u==="\r"||u==="\u2028"||u==="\u2029")return t+1}return t}var U=ju;function Uu(e,t,r={}){let n=T(e,r.backwards?t-1:t,r),u=U(e,n,r);return n!==u}var G=Uu;function Vu(e){return Array.isArray(e)&&e.length>0}var Xe=Vu;var Yr=new Set(["tokens","comments","parent","enclosingNode","precedingNode","followingNode"]),$u=e=>Object.keys(e).filter(t=>!Yr.has(t));function Wu(e){return e?t=>e(t,Yr):$u}var J=Wu;function Mu(e){let t=e.type||e.kind||"(unknown type)",r=String(e.name||e.id&&(typeof e.id=="object"?e.id.name:e.id)||e.key&&(typeof e.key=="object"?e.key.name:e.key)||e.value&&(typeof e.value=="object"?"":String(e.value))||e.operator||"");return r.length>20&&(r=r.slice(0,19)+"\u2026"),t+(r?" "+r:"")}function St(e,t){(e.comments??(e.comments=[])).push(t),t.printed=!1,t.nodeDescription=Mu(e)}function se(e,t){t.leading=!0,t.trailing=!1,St(e,t)}function ee(e,t,r){t.leading=!1,t.trailing=!1,r&&(t.marker=r),St(e,t)}function ae(e,t){t.leading=!1,t.trailing=!0,St(e,t)}var Tt=new WeakMap;function Qe(e,t){if(Tt.has(e))return Tt.get(e);let{printer:{getCommentChildNodes:r,canAttachComment:n,getVisitorKeys:u},locStart:o,locEnd:i}=t;if(!n)return[];let s=((r==null?void 0:r(e,t))??[...Ce(e,{getVisitorKeys:J(u)})]).flatMap(a=>n(a)?[a]:Qe(a,t));return s.sort((a,c)=>o(a)-o(c)||i(a)-i(c)),Tt.set(e,s),s}function Ur(e,t,r,n){let{locStart:u,locEnd:o}=r,i=u(t),s=o(t),a=Qe(e,r),c,D,p=0,l=a.length;for(;p<l;){let F=p+l>>1,f=a[F],d=u(f),m=o(f);if(d<=i&&s<=m)return Ur(f,t,r,f);if(m<=i){c=f,p=F+1;continue}if(s<=d){D=f,l=F;continue}throw new Error("Comment location overlaps with node location")}if((n==null?void 0:n.type)==="TemplateLiteral"){let{quasis:F}=n,f=Ot(F,t,r);c&&Ot(F,c,r)!==f&&(c=null),D&&Ot(F,D,r)!==f&&(D=null)}return{enclosingNode:n,precedingNode:c,followingNode:D}}var Nt=()=>!1;function Vr(e,t){let{comments:r}=e;if(delete e.comments,!Xe(r)||!t.printer.canAttachComment)return;let n=[],{printer:{experimentalFeatures:{avoidAstMutation:u=!1}={},handleComments:o={}},originalText:i}=t,{ownLine:s=Nt,endOfLine:a=Nt,remaining:c=Nt}=o,D=r.map((p,l)=>({...Ur(e,p,t),comment:p,text:i,options:t,ast:e,isLastComment:r.length-1===l}));for(let[p,l]of D.entries()){let{comment:F,precedingNode:f,enclosingNode:d,followingNode:m,text:C,options:E,ast:h,isLastComment:x}=l,A;if(u?A=[l]:(F.enclosingNode=d,F.precedingNode=f,F.followingNode=m,A=[F,C,E,h,x]),Gu(C,E,D,p))F.placement="ownLine",s(...A)||(m?se(m,F):f?ae(f,F):d?ee(d,F):ee(h,F));else if(Ku(C,E,D,p))F.placement="endOfLine",a(...A)||(f?ae(f,F):m?se(m,F):d?ee(d,F):ee(h,F));else if(F.placement="remaining",!c(...A))if(f&&m){let $=n.length;$>0&&n[$-1].followingNode!==m&&jr(n,E),n.push(l)}else f?ae(f,F):m?se(m,F):d?ee(d,F):ee(h,F)}if(jr(n,t),!u)for(let p of r)delete p.precedingNode,delete p.enclosingNode,delete p.followingNode}var $r=e=>!/[\S\n\u2028\u2029]/u.test(e);function Gu(e,t,r,n){let{comment:u,precedingNode:o}=r[n],{locStart:i,locEnd:s}=t,a=i(u);if(o)for(let c=n-1;c>=0;c--){let{comment:D,precedingNode:p}=r[c];if(p!==o||!$r(e.slice(s(D),a)))break;a=i(D)}return G(e,a,{backwards:!0})}function Ku(e,t,r,n){let{comment:u,followingNode:o}=r[n],{locStart:i,locEnd:s}=t,a=s(u);if(o)for(let c=n+1;c<r.length;c++){let{comment:D,followingNode:p}=r[c];if(p!==o||!$r(e.slice(a,i(D))))break;a=s(D)}return G(e,a)}function jr(e,t){var s,a;let r=e.length;if(r===0)return;let{precedingNode:n,followingNode:u}=e[0],o=t.locStart(u),i;for(i=r;i>0;--i){let{comment:c,precedingNode:D,followingNode:p}=e[i-1];Oe.strictEqual(D,n),Oe.strictEqual(p,u);let l=t.originalText.slice(t.locEnd(c),o);if(((a=(s=t.printer).isGap)==null?void 0:a.call(s,l,t))??/^[\s(]*$/u.test(l))o=t.locStart(c);else break}for(let[c,{comment:D}]of e.entries())c<i?ae(n,D):se(u,D);for(let c of[n,u])c.comments&&c.comments.length>1&&c.comments.sort((D,p)=>t.locStart(D)-t.locStart(p));e.length=0}function Ot(e,t,r){let n=r.locStart(t)-1;for(let u=1;u<e.length;++u)if(n<r.locStart(e[u]))return u-1;return 0}function zu(e,t){let r=t-1;r=T(e,r,{backwards:!0}),r=U(e,r,{backwards:!0}),r=T(e,r,{backwards:!0});let n=U(e,r,{backwards:!0});return r!==n}var Pe=zu;function Wr(e,t){let r=e.node;return r.printed=!0,t.printer.printComment(e,t)}function Hu(e,t){var D;let r=e.node,n=[Wr(e,t)],{printer:u,originalText:o,locStart:i,locEnd:s}=t;if((D=u.isBlockComment)==null?void 0:D.call(u,r)){let p=G(o,s(r))?G(o,i(r),{backwards:!0})?z:Ge:" ";n.push(p)}else n.push(z);let c=U(o,T(o,s(r)));return c!==!1&&G(o,c)&&n.push(z),n}function Ju(e,t,r){var c;let n=e.node,u=Wr(e,t),{printer:o,originalText:i,locStart:s}=t,a=(c=o.isBlockComment)==null?void 0:c.call(o,n);if(r!=null&&r.hasLineSuffix&&!(r!=null&&r.isBlock)||G(i,s(n),{backwards:!0})){let D=Pe(i,s(n));return{doc:Se([z,D?z:"",u]),isBlock:a,hasLineSuffix:!0}}return!a||r!=null&&r.hasLineSuffix?{doc:[Se([" ",u]),pe],isBlock:a,hasLineSuffix:!0}:{doc:[" ",u],isBlock:a,hasLineSuffix:!1}}function qu(e,t){let r=e.node;if(!r)return{};let n=t[Symbol.for("printedComments")];if((r.comments||[]).filter(a=>!n.has(a)).length===0)return{leading:"",trailing:""Line truncated
(mixed values within one file are normalised by looking at what's used after the first line)`}]},filepath:{category:"Special",type:"path",description:"Specify the input filepath. This will be used to do parser inference.",cliName:"stdin-filepath",cliCategory:"Other",cliDescription:"Path to the file to pretend that stdin comes from."},insertPragma:{category:"Special",type:"boolean",default:!1,description:"Insert @format pragma into file's first docblock comment.",cliCategory:"Other"},parser:{category:"Global",type:"choice",default:void 0,description:"Which parser to use.",exception:e=>typeof e=="string"||typeof e=="function",choices:[{value:"flow",description:"Flow"},{value:"babel",description:"JavaScript"},{value:"babel-flow",description:"Flow"},{value:"babel-ts",description:"TypeScript"},{value:"typescript",description:"TypeScript"},{value:"acorn",description:"JavaScript"},{value:"espree",description:"JavaScript"},{value:"meriyah",description:"JavaScript"},{value:"css",description:"CSS"},{value:"less",description:"Less"},{value:"scss",description:"SCSS"},{value:"json",description:"JSON"},{value:"json5",description:"JSON5"},{value:"jsonc",description:"JSON with Comments"},{value:"json-stringify",description:"JSON.stringify"},{value:"graphql",description:"GraphQL"},{value:"markdown",description:"Markdown"},{value:"mdx",description:"MDX"},{value:"vue",description:"Vue"},{value:"yaml",description:"YAML"},{value:"glimmer",description:"Ember / Handlebars"},{value:"html",description:"HTML"},{value:"angular",description:"Angular"},{value:"lwc",description:"Lightning Web Components"},{value:"mjml",description:"MJML"}]},plugins:{type:"path",array:!0,default:[{value:[]}],category:"Global",description:"Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",exception:e=>typeof e=="string"||typeof e=="object",cliName:"plugin",cliCategory:"Config"},printWidth:{category:"Global",type:"int",default:80,description:"The line length where Prettier will try wrap.",range:{start:0,end:1/0,step:1}},rangeEnd:{category:"Special",type:"int",default:1/0,range:{start:0,end:1/0,step:1},description:`Format code ending at a given character offset (exclusive).
The range will extend forwards to the end of the selected statement.`,cliCategory:"Editor"},rangeStart:{category:"Special",type:"int",default:0,range:{start:0,end:1/0,step:1},description:`Format code starting at a given character offset.
The range will extend backwards to the start of the first line containing the selected statement.`,cliCategory:"Editor"},requirePragma:{category:"Special",type:"boolean",default:!1,description:"Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",cliCategory:"Other"},tabWidth:{type:"int",category:"Global",default:2,description:"Number of spaces per indentation level.",range:{start:0,end:1/0,step:1}},useTabs:{category:"Global",type:"boolean",default:!1,description:"Indent with tabs instead of spaces."},embeddedLanguageFormatting:{category:"Global",type:"choice",default:"auto",description:"Control how Prettier formats quoted code embedded in the file.",choices:[{value:"auto",description:"Format embedded code if Prettier can automatically identify it."},{value:"off",description:"Never automatically format embedded code."}]}};function Ze({plugins:e=[],showDeprecated:t=!1}={}){let r=e.flatMap(u=>u.languages??[]),n=[];for(let u of Zu(Object.assign({},...e.map(({options:o})=>o),zr)))!t&&u.deprecated||(Array.isArray(u.choices)&&(t||(u.choices=u.choices.filter(o=>!o.deprecated)),u.name==="parser"&&(u.choices=[...u.choices,...Qu(u.choices,r,e)])),u.pluginDefaults=Object.fromEntries(e.filter(o=>{var i;return((i=o.defaultOptions)==null?void 0:i[u.name])!==void 0}).map(o=>[o.name,o.defaultOptions[u.name]])),n.push(u));return{languages:r,options:n}}function*Qu(e,t,r){let n=new Set(e.map(u=>u.value));for(let u of t)if(u.parsers){for(let o of u.parsers)if(!n.has(o)){n.add(o);let i=r.find(a=>a.parsers&&Object.prototype.hasOwnProperty.call(a.parsers,o)),s=u.name;i!=null&&i.name&&(s+=` (plugin: ${i.name})`),yield{value:o,description:s}}}}function Zu(e){let t=[];for(let[r,n]of Object.entries(e)){let u={name:r,...n};Array.isArray(u.default)&&(u.default=y(!1,u.default,-1).value),t.push(u)}return t}var eo=(e,t)=>{if(!(e&&t==null))return t.toReversed||!Array.isArray(t)?t.toReversed():[...t].reverse()},Hr=eo;var Jr,qr,Xr,Qr,Zr,to=((Jr=globalThis.Deno)==null?void 0:Jr.build.os)==="windows"||((Xr=(qr=globalThis.navigator)==null?void 0:qr.platform)==null?void 0:Xr.startsWith("Win"))||((Zr=(Qr=globalThis.process)==null?void 0:Qr.platform)==null?void 0:Zr.startsWith("win"))||!1;function en(e){if(e=e instanceof URL?e:new URL(e),e.protocol!=="file:")throw new TypeError(`URL must be a file URL: received "${e.protocol}"`);return e}function ro(e){return e=en(e),decodeURIComponent(e.pathname.replace(/%(?![0-9A-Fa-f]{2})/g,"%25"))}function no(e){e=en(e);let t=decodeURIComponent(e.pathname.replace(/\//g,"\\").replace(/%(?![0-9A-Fa-f]{2})/g,"%25")).replace(/^\\*([A-Za-z]:)(\\|$)/,"$1\\");return e.hostname!==""&&(t=`\\\\${e.hostname}${t}`),t}function tn(e){return to?no(e):ro(e)}var rn=tn;var uo=e=>String(e).split(/[/\\]/u).pop();function nn(e,t){if(!t)return;let r=uo(t).toLowerCase();return e.find(({filenames:n})=>n==null?void 0:n.some(u=>u.toLowerCase()===r))??e.find(({extensions:n})=>n==null?void 0:n.some(u=>r.endsWith(u)))}function oo(e,t){if(t)return e.find(({name:r})=>r.toLowerCase()===t)??e.find(({aliases:r})=>r==null?void 0:r.includes(t))??e.find(({extensions:r})=>r==null?void 0:r.includes(`.${t}`))}function un(e,t){if(t){if(String(t).startsWith("file:"))try{t=rn(t)}catch{return}if(typeof t=="string")return e.find(({isSupported:r})=>r==null?void 0:r({filepath:t}))}}function io(e,t){let r=Hr(!1,e.plugins).flatMap(u=>u.languages??[]),n=oo(r,t.language)??nn(r,t.physicalFile)??nn(r,t.file)??un(r,t.physicalFile)??un(r,t.file)??(t.physicalFile,void 0);return n==null?void 0:n.parsers[0]}var on=io;var re={key:e=>/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(e)?e:JSON.stringify(e),value(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>re.value(r)).join(", ")}]`;let t=Object.keys(e);return t.length===0?"{}":`{ ${t.map(r=>`${re.key(r)}: ${re.value(e[r])}`).join(", ")} }`},pair:({key:e,value:t})=>re.value({[e]:t})};var sn=new Proxy(String,{get:()=>sn}),V=sn;var an=(e,t,{descriptor:r})=>{let n=[`${V.yellow(typeof e=="string"?r.key(e):r.pair(e))} is deprecated`];return t&&n.push(`we now treat it as ${V.blue(typeof t=="string"?r.key(t):r.pair(t))}`),n.join("; ")+"."};var et=Symbol.for("vnopts.VALUE_NOT_EXIST"),ge=Symbol.for("vnopts.VALUE_UNCHANGED");var Dn=" ".repeat(2),fn=(e,t,r)=>{let{text:n,list:u}=r.normalizeExpectedResult(r.schemas[e].expected(r)),o=[];return n&&o.push(cn(e,t,n,r.descriptor)),u&&o.push([cn(e,t,u.title,r.descriptor)].concat(u.values.map(i=>ln(i,r.loggerPrintWidth))).join(`
`)),Fn(o,r.loggerPrintWidth)};function cn(e,t,r,n){return[`Invalid ${V.red(n.key(e))} value.`,`Expected ${V.blue(r)},`,`but received ${t===et?V.gray("nothing"):V.red(n.value(t))}.`].join(" ")}function ln({text:e,list:t},r){let n=[];return e&&n.push(`- ${V.blue(e)}`),t&&n.push([`- ${V.blue(t.title)}:`].concat(t.values.map(u=>ln(u,r-Dn.length).replace(/^|\n/g,`$&${Dn}`))).join(`
`)),Fn(n,r)}function Fn(e,t){if(e.length===1)return e[0];let[r,n]=e,[u,o]=e.map(i=>i.split(`
`,1)[0].length);return u>t&&u>o?n:r}var Pt=[],pn=[];function vt(e,t){if(e===t)return 0;let r=e;e.length>t.length&&(e=t,t=r);let n=e.length,u=t.length;for(;n>0&&e.charCodeAt(~-n)===t.charCodeAt(~-u);)n--,u--;let o=0;for(;o<n&&e.charCodeAt(o)===t.charCodeAt(o);)o++;if(n-=o,u-=o,n===0)return u;let i,s,a,c,D=0,p=0;for(;D<n;)pn[D]=e.charCodeAt(o+D),Pt[D]=++D;for(;p<u;)for(i=t.charCodeAt(o+p),a=p++,s=p,D=0;D<n;D++)c=i===pn[D]?a:a+1,a=Pt[D],s=Pt[D]=a>s?c>s?s+1:c:c>a?a+1:c;return s}var tt=(e,t,{descriptor:r,logger:n,schemas:u})=>{let o=[`Ignored unknown option ${V.yellow(r.pair({key:e,value:t}))}.`],i=Object.keys(u).sort().find(s=>vt(e,s)<3);i&&o.push(`Did you mean ${V.blue(r.key(i))}?`),n.warn(o.join(" "))};var so=["default","expected","validate","deprecated","forward","redirect","overlap","preprocess","postprocess"];function ao(e,t){let r=new e(t),n=Object.create(r);for(let u of so)u in t&&(n[u]=Do(t[u],r,b.prototype[u].length));return n}var b=class{static create(t){return ao(this,t)}constructor(t){this.name=t.name}default(t){}expected(t){return"nothing"}validate(t,r){return!1}deprecated(t,r){return!1}forward(t,r){}redirect(t,r){}overlap(t,r,n){return t}preprocess(t,r){return t}postprocess(t,r){return ge}};function Do(e,t,r){return typeof e=="function"?(...n)=>e(...n.slice(0,r-1),t,...n.slice(r-1)):()=>e}var rt=class extends b{constructor(t){super(t),this._sourceName=t.sourceName}expected(t){return t.schemas[this._sourceName].expected(t)}validate(t,r){return r.schemas[this._sourceName].validate(t,r)}redirect(t,r){return this._sourceName}};var nt=class extends b{expected(){return"anything"}validate(){return!0}};var ut=class extends b{constructor({valueSchema:t,name:r=t.name,...n}){super({...n,name:r}),this._valueSchema=t}expected(t){let{text:r,list:n}=t.normalizeExpectedResult(this._valueSchema.expected(t));return{text:r&&`an array of ${r}`,list:n&&{title:"an array of the following values",values:[{list:n}]}}}validate(t,r){if(!Array.isArray(t))return!1;let n=[];for(let u of t){let o=r.normalizeValidateResult(this._valueSchema.validate(u,r),u);o!==!0&&n.push(o.value)}return n.length===0?!0:{value:n}}deprecated(t,r){let n=[];for(let u of t){let o=r.normalizeDeprecatedResult(this._valueSchema.deprecated(u,r),u);o!==!1&&n.push(...o.map(({value:i})=>({value:[i]})))}return n}forward(t,r){let n=[];for(let u of t){let o=r.normalizeForwardResult(this._valueSchema.forward(u,r),u);n.push(...o.map(dn))}return n}redirect(t,r){let n=[],u=[];for(let o of t){let i=r.normalizeRedirectResult(this._valueSchema.redirect(o,r),o);"remain"in i&&n.push(i.remain),u.push(...i.redirect.map(dn))}return n.length===0?{redirect:u}:{redirect:u,remain:n}}overlap(t,r){return t.concat(r)}};function dn({from:e,to:t}){return{from:[e],to:t}}var ot=class extends b{expected(){return"true or false"}validate(t){return typeof t=="boolean"}};function En(e,t){let r=Object.create(null);for(let n of e){let u=n[t];if(r[u])throw new Error(`Duplicate ${t} ${JSON.stringify(u)}`);r[u]=n}return r}function Cn(e,t){let r=new Map;for(let n of e){let u=n[t];if(r.has(u))throw new Error(`Duplicate ${t} ${JSON.stringify(u)}`);r.set(u,n)}return r}function hn(){let e=Object.create(null);return t=>{let r=JSON.stringify(t);return e[r]?!0:(e[r]=!0,!1)}}function gn(e,t){let r=[],n=[];for(let u of e)t(u)?r.push(u):n.push(u);return[r,n]}function yn(e){return e===Math.floor(e)}function An(e,t){if(e===t)return 0;let r=typeof e,n=typeof t,u=["undefined","object","boolean","number","string"];return r!==n?u.indexOf(r)-u.indexOf(n):r!=="string"?Number(e)-Number(t):e.localeCompare(t)}function Bn(e){return(...t)=>{let r=e(...t);return typeof r=="string"?new Error(r):r}}function Lt(e){return e===void 0?{}:e}function It(e){if(typeof e=="string")return{text:e};let{text:t,list:r}=e;return co((t||r)!==void 0,"Unexpected `expected` result, there should be at least one field."),r?{text:t,list:{title:r.title,values:r.values.map(It)}}:{text:t}}function Rt(e,t){return e===!0?!0:e===!1?{value:t}:e}function Yt(e,t,r=!1){return e===!1?!1:e===!0?r?!0:[{value:t}]:"value"in e?[e]:e.length===0?!1:e}function mn(e,t){return typeof e=="string"||"key"in e?{from:t,to:e}:"from"in e?{from:e.from,to:e.to}:{from:t,to:e.to}}function it(e,t){return e===void 0?[]:Array.isArray(e)?e.map(r=>mn(r,t)):[mn(e,t)]}function jt(e,t){let r=it(typeof e=="object"&&"redirect"in e?e.redirect:e,t);return r.length===0?{remain:t,redirect:r}:typeof e=="object"&&"remain"in e?{remain:e.remain,redirect:r}:{redirect:r}}function co(e,t){if(!e)throw new Error(t)}var st=class extends b{constructor(t){super(t),this._choices=Cn(t.choices.map(r=>r&&typeof r=="object"?r:{value:r}),"value")}expected({descriptor:t}){let r=Array.from(this._choices.keys()).map(i=>this._choices.get(i)).filter(({hidden:i})=>!i).map(i=>i.value).sort(An).map(t.value),n=r.slice(0,-2),u=r.slice(-2);return{text:n.concat(u.join(" or ")).join(", "),list:{title:"one of the following values",values:r}}}validate(t){return this._choices.has(t)}deprecated(t){let r=this._choices.Line truncated
`+n,e.codeFrame=n,e}throw e}var De=yo;async function Ln(e,t,r,n,u){let{embeddedLanguageFormatting:o,printer:{embed:i,hasPrettierIgnore:s=()=>!1,getVisitorKeys:a}}=r;if(!i||o!=="auto")return;if(i.length>2)throw new Error("printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/plugins#optional-embed");let c=J(i.getVisitorKeys??a),D=[];F();let p=e.stack;for(let{print:f,node:d,pathStack:m}of D)try{e.stack=m;let C=await f(l,t,e,r);C&&u.set(d,C)}catch(C){if(globalThis.PRETTIER_DEBUG)throw C}e.stack=p;function l(f,d){return Bo(f,d,r,n)}function F(){let{node:f}=e;if(f===null||typeof f!="object"||s(e))return;for(let m of c(f))Array.isArray(f[m])?e.each(F,m):e.call(F,m);let d=i(e,r);if(d){if(typeof d=="function"){D.push({print:d,node:f,pathStack:[...e.stack]});return}u.set(f,d)}}}async function Bo(e,t,r,n){let u=await ne({...r,...t,parentParser:r.parser,originalText:e,cursorOffset:void 0,rangeStart:void 0,rangeEnd:void 0},{passThrough:!0}),{ast:o}=await De(e,u),i=await n(o,u);return We(i)}function _o(e,t){let{originalText:r,[Symbol.for("comments")]:n,locStart:u,locEnd:o,[Symbol.for("printedComments")]:i}=t,{node:s}=e,a=u(s),c=o(s);for(let D of n)u(D)>=a&&o(D)<=c&&i.add(D);return r.slice(a,c)}var In=_o;async function Ye(e,t){({ast:e}=await Gt(e,t));let r=new Map,n=new Or(e),u=Kr(t),o=new Map;await Ln(n,s,t,Ye,o);let i=await Rn(n,t,s,void 0,o);if(Gr(t),t.cursorOffset>=0){if(t.nodeAfterCursor&&!t.nodeBeforeCursor)return[X,i];if(t.nodeBeforeCursor&&!t.nodeAfterCursor)return[i,X]}return i;function s(c,D){return c===void 0||c===n?a(D):Array.isArray(c)?n.call(()=>a(D),...c):n.call(()=>a(D),c)}function a(c){u(n);let D=n.node;if(D==null)return"";let p=D&&typeof D=="object"&&c===void 0;if(p&&r.has(D))return r.get(D);let l=Rn(n,t,s,c,o);return p&&r.set(D,l),l}}function Rn(e,t,r,n,u){var a;let{node:o}=e,{printer:i}=t,s;switch((a=i.hasPrettierIgnore)!=null&&a.call(i,e)?s=In(e,t):u.has(o)?s=u.get(o):s=i.print(e,t,r,n),o){case t.cursorNode:s=Fe(s,c=>[X,c,X]);break;case t.nodeBeforeCursor:s=Fe(s,c=>[c,X]);break;case t.nodeAfterCursor:s=Fe(s,c=>[X,c]);break}return i.printComment&&(!i.willPrintOwnComments||!i.willPrintOwnComments(e,t))&&(s=Mr(e,s,t)),s}async function Gt(e,t){let r=e.comments??[];t[Symbol.for("comments")]=r,t[Symbol.for("printedComments")]=new Set,Vr(e,t);let{printer:{preprocess:n}}=t;return e=n?await n(e,t):e,{ast:e,comments:r}}function xo(e,t){let{cursorOffset:r,locStart:n,locEnd:u}=t,o=J(t.printer.getVisitorKeys),i=F=>n(F)<=r&&u(F)>=r,s=e,a=[e];for(let F of Lr(e,{getVisitorKeys:o,filter:i}))a.push(F),s=F;if(Ir(s,{getVisitorKeys:o}))return{cursorNode:s};let c,D,p=-1,l=Number.POSITIVE_INFINITY;for(;a.length>0&&(c===void 0||D===void 0);){s=a.pop();let F=c!==void 0,f=D!==void 0;for(let d of Ce(s,{getVisitorKeys:o})){if(!F){let m=u(d);m<=r&&m>p&&(c=d,p=m)}if(!f){let m=n(d);m>=r&&m<l&&(D=d,l=m)}}}return{nodeBeforeCursor:c,nodeAfterCursor:D}}var Kt=xo;function wo(e,t){let{printer:{massageAstNode:r,getVisitorKeys:n}}=t;if(!r)return e;let u=J(n),o=r.ignoredProperties??new Set;return i(e);function i(s,a){if(!(s!==null&&typeof s=="object"))return s;if(Array.isArray(s))return s.map(l=>i(l,a)).filter(Boolean);let c={},D=new Set(u(s));for(let l in s)!Object.prototype.hasOwnProperty.call(s,l)||o.has(l)||(D.has(l)?c[l]=i(s[l],s):c[l]=s[l]);let p=r(s,c,a);if(p!==null)return p??c}}var Yn=wo;var bo=(e,t,r)=>{if(!(e&&t==null)){if(t.findLastIndex)return t.findLastIndex(r);for(let n=t.length-1;n>=0;n--){let u=t[n];if(r(u,n,t))return n}return-1}},jn=bo;var ko=({parser:e})=>e==="json"||e==="json5"||e==="jsonc"||e==="json-stringify";function So(e,t){let r=[e.node,...e.parentNodes],n=new Set([t.node,...t.parentNodes]);return r.find(u=>$n.has(u.type)&&n.has(u))}function Un(e){let t=jn(!1,e,r=>r.type!=="Program"&&r.type!=="File");return t===-1?e:e.slice(0,t+1)}function To(e,t,{locStart:r,locEnd:n}){let u=e.node,o=t.node;if(u===o)return{startNode:u,endNode:o};let i=r(e.node);for(let a of Un(t.parentNodes))if(r(a)>=i)o=a;else break;let s=n(t.node);for(let a of Un(e.parentNodes)){if(n(a)<=s)u=a;else break;if(u===o)break}return{startNode:u,endNode:o}}function zt(e,t,r,n,u=[],o){let{locStart:i,locEnd:s}=r,a=i(e),c=s(e);if(!(t>c||t<a||o==="rangeEnd"&&t===a||o==="rangeStart"&&t===c)){for(let D of Qe(e,r)){let p=zt(D,t,r,n,[e,...u],o);if(p)return p}if(!n||n(e,u[0]))return{node:e,parentNodes:u}}}function No(e,t){return t!=="DeclareExportDeclaration"&&e!=="TypeParameterDeclaration"&&(e==="Directive"||e==="TypeAlias"||e==="TSExportAssignment"||e.startsWith("Declare")||e.startsWith("TSDeclare")||e.endsWith("Statement")||e.endsWith("Declaration"))}var $n=new Set(["JsonRoot","ObjectExpression","ArrayExpression","StringLiteral","NumericLiteral","BooleanLiteral","NullLiteral","UnaryExpression","TemplateLiteral"]),Oo=new Set(["OperationDefinition","FragmentDefinition","VariableDefinition","TypeExtensionDefinition","ObjectTypeDefinition","FieldDefinition","DirectiveDefinition","EnumTypeDefLine truncated
`,u)+1),a=n.slice(s,u).match(/^\s*/u)[0],c=Ee(a,t.tabWidth),D=await Hn(i,{...t,rangeStart:0,rangeEnd:Number.POSITIVE_INFINITY,cursorOffset:t.cursorOffset>u&&t.cursorOffset<=o?t.cursorOffset-u:-1,endOfLine:"lf"},c),p=D.formatted.trimEnd(),{cursorOffset:l}=t;l>o?l+=p.length-i.length:D.cursorOffset>=0&&(l=D.cursorOffset+u);let F=n.slice(0,u)+p+n.slice(o);if(t.endOfLine!=="lf"){let f=xe(t.endOfLine);l>=0&&f===`\r
`&&(l+=Ct(F.slice(0,l),`
`)),F=te(!1,F,`
`,f)}return{formatted:F,cursorOffset:l,comments:D.comments}}function Ht(e,t,r){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?r:t}function Gn(e,t){let{cursorOffset:r,rangeStart:n,rangeEnd:u}=t;return r=Ht(e,r,-1),n=Ht(e,n,0),u=Ht(e,u,e.length),{...t,cursorOffset:r,rangeStart:n,rangeEnd:u}}function Jn(e,t){let{cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:o}=Gn(e,t),i=e.charAt(0)===zn;if(i&&(e=e.slice(1),r--,n--,u--),o==="auto"&&(o=nr(e)),e.includes("\r")){let s=a=>Ct(e.slice(0,Math.max(a,0)),`\r
`);r-=s(r),n-=s(n),u-=s(u),e=ur(e)}return{hasBOM:i,text:e,options:Gn(e,{...t,cursorOffset:r,rangeStart:n,rangeEnd:u,endOfLine:o})}}async function Kn(e,t){let r=await Re(t);return!r.hasPragma||r.hasPragma(e)}async function vo(e,t){var n;let r=await Re(t);return(n=r.hasIgnorePragma)==null?void 0:n.call(r,e)}async function Jt(e,t){let{hasBOM:r,text:n,options:u}=Jn(e,await ne(t));if(u.rangeStart>=u.rangeEnd&&n!==""||u.requirePragma&&!await Kn(n,u)||u.checkIgnorePragma&&await vo(n,u))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let o;return u.rangeStart>0||u.rangeEnd<n.length?o=await Po(n,u):(!u.requirePragma&&u.insertPragma&&u.printer.insertPragma&&!await Kn(n,u)&&(n=u.printer.insertPragma(n)),o=await Hn(n,u)),r&&(o.formatted=zn+o.formatted,o.cursorOffset>=0&&o.cursorOffset++),o}async function qn(e,t,r){let{text:n,options:u}=Jn(e,await ne(t)),o=await De(n,u);return r&&(r.preprocessForPrint&&(o.ast=await Gt(o.ast,u)),r.massage&&(o.ast=Yn(o.ast,u))),o}async function Xn(e,t){t=await ne(t);let r=await Ye(e,t);return me(r,t)}async function Qn(e,t){let r=wr(e),{formatted:n}=await Jt(r,{...t,parser:"__js_expression"});return n}async function Zn(e,t){t=await ne(t);let{ast:r}=await De(e,t);return t.cursorOffset>=0&&(t={...t,...Kt(r,t)}),Ye(r,t)}async function eu(e,t){return me(e,await ne(t))}var qt={};dt(qt,{builders:()=>Io,printer:()=>Ro,utils:()=>Yo});var Io={join:ke,line:Ge,softline:_r,hardline:z,literalline:Me,group:At,conditionalGroup:Cr,fill:hr,lineSuffix:Se,lineSuffixBoundary:Ar,cursor:X,breakParent:pe,ifBreak:gr,trim:Br,indent:ie,indentIfBreak:yr,align:oe,addAlignmentToDoc:Ke,markAsRoot:mr,dedentToRoot:dr,dedent:Er,hardlineWithoutBreakParent:Te,literallineWithoutBreakParent:Bt,label:xr,concat:e=>e},Ro={printDocToString:me},Yo={willBreak:Dr,traverseDoc:le,findInDoc:$e,mapDoc:be,removeLines:fr,stripTrailingHardline:We,replaceEndOfLine:lr,canBreak:Fr};var tu="3.6.2";var Qt={};dt(Qt,{addDanglingComment:()=>ee,addLeadingComment:()=>se,addTrailingComment:()=>ae,getAlignmentSize:()=>Ee,getIndentSize:()=>ru,getMaxContinuousCount:()=>nu,getNextNonSpaceNonCommentCharacter:()=>uu,getNextNonSpaceNonCommentCharacterIndex:()=>Xo,getPreferredQuote:()=>iu,getStringWidth:()=>Ne,hasNewline:()=>G,hasNewlineInRange:()=>su,hasSpaces:()=>au,isNextLineEmpty:()=>ti,isNextLineEmptyAfterIndex:()=>ft,isPreviousLineEmpty:()=>Zo,makeString:()=>Du,skip:()=>he,skipEverythingButNewLine:()=>qe,skipInlineComment:()=>ye,skipNewline:()=>U,skipSpaces:()=>T,skipToLineEnd:()=>Je,skipTrailingComment:()=>Ae,skipWhitespace:()=>Rr});function jo(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let r=t+2;r<e.length;++r)if(e.charAt(r)==="*"&&e.charAt(r+1)==="/")return r+2}return t}var ye=jo;function Uo(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?qe(e,t):t}var Ae=Uo;function Vo(e,t){let r=null,n=t;for(;n!==r;)r=n,n=T(e,n),n=ye(e,n),n=Ae(e,n),n=U(e,n);return n}var je=Vo;function $o(e,t){let r=null,n=t;for(;n!==r;)r=n,n=Je(e,n),n=ye(e,n),n=T(e,n);return n=Ae(e,n),n=U(e,n),n!==!1&&G(e,n)}var ft=$o;function Wo(e,t){let r=e.lastIndexOf(`
`);return r===-1?0:Ee(e.slice(r+1).match(/^[\t ]*/u)[0],t)}var ru=Wo;function Xt(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Mo(e,t){let r=e.match(new RegExp(`(${Xt(t)})+`,"gu"));return r===null?0:r.reduce((n,u)=>Math.max(n,u.length/t.length),0)}var nu=Mo;function Go(e,t){let r=je(e,t);return r===!1?"":e.charAt(r)}var uu=Go;var lt="'",ou='"';function Ko(e,t){let r=t===!0||t===lt?lt:ou,n=r===lt?ou:lt,u=0,o=0;for(let i of e)i===r?u++:i===n&&o++;return u>o?n:r}var iu=Ko;function zo(e,t,r){for(let n=t;n<r;++n)if(e.charAt(n)===`
`)return!0;return!1}var su=zo;function Ho(e,t,r={}){return T(e,r.backwards?t-1:t,r)!==t}var au=Ho;function Jo(e,t,r){let n=t==='"'?"'":'"',o=te(!1,e,/\\(.)|(["'])/gsu,(i,s,a)=>s===n?s:a===t?"\\"+a:a||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+o+t}var Du=Jo;function qo(e,t,r){return je(e,r(t))}function Xo(e,t){return arguments.length===2||typeof t=="number"?je(e,t):qo(...arguments)}function Qo(e,t,r){return Pe(e,r(t))}function Zo(e,t){return arguments.length===2||typeof t=="number"?Pe(e,t):Qo(...arguments)}function ei(e,t,r){return ft(e,r(t))}function ti(e,t){return arguments.length===2||typeof t=="number"?ft(e,t):ei(...arguments)}function ce(e,t=1){return async(...r)=>{let n=r[t]??{},u=n.plugins??[];return r[t]={...n,plugins:Array.isArray(u)?u:Object.values(u)},e(...r)}}var cu=ce(Jt);async function fu(e,t){let{formatted:r}=await cu(e,{...t,cursorOffset:-1});return r}async function ri(e,t){return await fu(e,t)===e}var ni=ce(Ze,0),ui={parse:ce(qn),formatAST:ce(Xn),formatDoc:ce(Qn),printToDoc:ce(Zn),printDocToString:ce(eu)};return gu(oi);});
@@ -0,0 +1,179 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
const explicitReturnTypeUtils_1 = require("../util/explicitReturnTypeUtils");
exports.default = (0, util_1.createRule)({
name: 'explicit-function-return-type',
meta: {
type: 'problem',
docs: {
description: 'Require explicit return types on functions and class methods',
},
messages: {
missingReturnType: 'Missing return type on function.',
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
allowConciseArrowFunctionExpressionsStartingWithVoid: {
type: 'boolean',
description: 'Whether to allow arrow functions that start with the `void` keyword.',
},
allowDirectConstAssertionInArrowFunctions: {
type: 'boolean',
description: 'Whether to ignore arrow functions immediately returning a `as const` value.',
},
allowedNames: {
type: 'array',
description: 'An array of function/method names that will not have their arguments or return values checked.',
items: {
type: 'string',
},
},
allowExpressions: {
type: 'boolean',
description: 'Whether to ignore function expressions (functions which are not part of a declaration).',
},
allowFunctionsWithoutTypeParameters: {
type: 'boolean',
description: "Whether to ignore functions that don't have generic type parameters.",
},
allowHigherOrderFunctions: {
type: 'boolean',
description: 'Whether to ignore functions immediately returning another function expression.',
},
allowIIFEs: {
type: 'boolean',
description: 'Whether to ignore immediately invoked function expressions (IIFEs).',
},
allowTypedFunctionExpressions: {
type: 'boolean',
description: 'Whether to ignore type annotations on the variable of function expressions.',
},
},
},
],
},
defaultOptions: [
{
allowConciseArrowFunctionExpressionsStartingWithVoid: false,
allowDirectConstAssertionInArrowFunctions: true,
allowedNames: [],
allowExpressions: false,
allowFunctionsWithoutTypeParameters: false,
allowHigherOrderFunctions: true,
allowIIFEs: false,
allowTypedFunctionExpressions: true,
},
],
create(context, [options]) {
const functionInfoStack = [];
function enterFunction(node) {
functionInfoStack.push({
node,
returns: [],
});
}
function popFunctionInfo(exitNodeType) {
return (0, util_1.nullThrows)(functionInfoStack.pop(), `Stack should exist on ${exitNodeType} exit`);
}
function isAllowedFunction(node) {
if (options.allowFunctionsWithoutTypeParameters && !node.typeParameters) {
return true;
}
if (options.allowIIFEs && isIIFE(node)) {
return true;
}
if (!options.allowedNames?.length) {
return false;
}
if (node.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression ||
node.type === utils_1.AST_NODE_TYPES.FunctionExpression) {
const parent = node.parent;
let funcName;
if (node.id?.name) {
funcName = node.id.name;
}
else {
switch (parent.type) {
case utils_1.AST_NODE_TYPES.VariableDeclarator: {
if (parent.id.type === utils_1.AST_NODE_TYPES.Identifier) {
funcName = parent.id.name;
}
break;
}
case utils_1.AST_NODE_TYPES.MethodDefinition:
case utils_1.AST_NODE_TYPES.PropertyDefinition:
case utils_1.AST_NODE_TYPES.Property: {
if (parent.key.type === utils_1.AST_NODE_TYPES.Identifier &&
!parent.computed) {
funcName = parent.key.name;
}
break;
}
}
}
if (!!funcName && options.allowedNames.includes(funcName)) {
return true;
}
}
if (node.type === utils_1.AST_NODE_TYPES.FunctionDeclaration &&
node.id &&
options.allowedNames.includes(node.id.name)) {
return true;
}
return false;
}
function isIIFE(node) {
return node.parent.type === utils_1.AST_NODE_TYPES.CallExpression;
}
function exitFunctionExpression(node) {
const info = popFunctionInfo('function expression');
if (options.allowConciseArrowFunctionExpressionsStartingWithVoid &&
node.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression &&
node.expression &&
node.body.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
node.body.operator === 'void') {
return;
}
if (isAllowedFunction(node)) {
return;
}
if (options.allowTypedFunctionExpressions &&
((0, explicitReturnTypeUtils_1.isValidFunctionExpressionReturnType)(node, options) ||
(0, explicitReturnTypeUtils_1.ancestorHasReturnType)(node))) {
return;
}
(0, explicitReturnTypeUtils_1.checkFunctionReturnType)(info, options, context.sourceCode, loc => context.report({
loc,
node,
messageId: 'missingReturnType',
}));
}
return {
'ArrowFunctionExpression, FunctionExpression, FunctionDeclaration': enterFunction,
'ArrowFunctionExpression:exit': exitFunctionExpression,
'FunctionDeclaration:exit'(node) {
const info = popFunctionInfo('function declaration');
if (isAllowedFunction(node)) {
return;
}
if (options.allowTypedFunctionExpressions && node.returnType) {
return;
}
(0, explicitReturnTypeUtils_1.checkFunctionReturnType)(info, options, context.sourceCode, loc => context.report({
loc,
node,
messageId: 'missingReturnType',
}));
},
'FunctionExpression:exit': exitFunctionExpression,
ReturnStatement(node) {
functionInfoStack.at(-1)?.returns.push(node);
},
};
},
});
@@ -0,0 +1,21 @@
import {useTab as $0175d55c2a017ebc$export$fdf4756d5b8ef90a} from "./useTab.mjs";
import {useTabPanel as $34bce698202e07cb$export$fae0121b5afe572d} from "./useTabPanel.mjs";
import {useTabList as $58d314389b21fa3f$export$773e389e644c5874} from "./useTabList.mjs";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export {$0175d55c2a017ebc$export$fdf4756d5b8ef90a as useTab, $34bce698202e07cb$export$fae0121b5afe572d as useTabPanel, $58d314389b21fa3f$export$773e389e644c5874 as useTabList};
//# sourceMappingURL=module.js.map
@@ -0,0 +1,23 @@
import baseSet from './_baseSet.js';
import baseZipObject from './_baseZipObject.js';
/**
* This method is like `_.zipObject` except that it supports property paths.
*
* @static
* @memberOf _
* @since 4.1.0
* @category Array
* @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
* // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
*/
function zipObjectDeep(props, values) {
return baseZipObject(props || [], values || [], baseSet);
}
export default zipObjectDeep;
@@ -0,0 +1,8 @@
'use strict'
const parse = require('./parse')
const prerelease = (version, options) => {
const parsed = parse(version, options)
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
}
module.exports = prerelease
@@ -0,0 +1,58 @@
var $1254e5bb94ac8761$exports = require("./useEffectEvent.main.js");
var $78605a5d7424e31b$exports = require("./useLayoutEffect.main.js");
var $fymK9$react = require("react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useValueEffect", () => $19a2307bfabafaf1$export$14d238f342723f25);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $19a2307bfabafaf1$export$14d238f342723f25(defaultValue) {
let [value, setValue] = (0, $fymK9$react.useState)(defaultValue);
let effect = (0, $fymK9$react.useRef)(null);
// Store the function in a ref so we can always access the current version
// which has the proper `value` in scope.
let nextRef = (0, $1254e5bb94ac8761$exports.useEffectEvent)(()=>{
if (!effect.current) return;
// Run the generator to the next yield.
let newValue = effect.current.next();
// If the generator is done, reset the effect.
if (newValue.done) {
effect.current = null;
return;
}
// If the value is the same as the current value,
// then continue to the next yield. Otherwise,
// set the value in state and wait for the next layout effect.
if (value === newValue.value) nextRef();
else setValue(newValue.value);
});
(0, $78605a5d7424e31b$exports.useLayoutEffect)(()=>{
// If there is an effect currently running, continue to the next yield.
if (effect.current) nextRef();
});
let queue = (0, $1254e5bb94ac8761$exports.useEffectEvent)((fn)=>{
effect.current = fn(value);
nextRef();
});
return [
value,
queue
];
}
//# sourceMappingURL=useValueEffect.main.js.map
@@ -0,0 +1,5 @@
<svg viewbox="0 0 18 18">
<rect class="ql-stroke" height="10" width="12" x="3" y="4"></rect>
<circle class="ql-fill" cx="6" cy="7" r="1"></circle>
<polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"></polyline>
</svg>

After

Width:  |  Height:  |  Size: 254 B

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveConstantValueBindingCallback = resolveConstantValueBindingCallback;
function resolveConstantValueBindingCallback(_params, binding) {
return binding.value;
}
//# sourceMappingURL=resolveConstantValueBindingCallback.js.map
@@ -0,0 +1 @@
{"version":3,"file":"isPendingClassMetadata.d.ts","sourceRoot":"","sources":["../../../../src/metadata/calculations/isPendingClassMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAK9C,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAS7D"}
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _classPrivateFieldInitSpec;
var _checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js");
function _classPrivateFieldInitSpec(obj, privateMap, value) {
(0, _checkPrivateRedeclaration.default)(obj, privateMap);
privateMap.set(obj, value);
}
//# sourceMappingURL=classPrivateFieldInitSpec.js.map
@@ -0,0 +1,4 @@
export interface MultiInjectOptions {
chained?: boolean;
}
//# sourceMappingURL=MultiInjectOptions.d.ts.map
@@ -0,0 +1,17 @@
"use strict";
var _typeof = require("@babel/runtime/helpers/typeof");
var _tslib = require("tslib");
var _vitest = require("vitest");
var ahooks = _interopRequireWildcard(require("."));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
(0, _vitest.describe)('ahooks', function () {
(0, _vitest.test)('exports modules should be defined', function () {
Object.entries(ahooks).forEach(function (_a) {
var _b = (0, _tslib.__read)(_a, 2),
key = _b[0],
value = _b[1];
(0, _vitest.expect)(value).toBeDefined();
});
});
});
@@ -0,0 +1,848 @@
import {
tv
} from "./chunk-UWE6H66T.mjs";
import {
dataFocusVisibleClasses,
groupDataFocusVisibleClasses
} from "./chunk-GH5E4FQB.mjs";
// src/components/input.ts
var input = tv({
slots: {
base: "group flex flex-col data-[hidden=true]:hidden",
label: [
"absolute",
"z-10",
"pointer-events-none",
"origin-top-left",
"flex-shrink-0",
"rtl:origin-top-right",
"subpixel-antialiased",
"block",
"text-small",
"text-foreground-500"
],
mainWrapper: "h-full",
inputWrapper: "relative w-full inline-flex tap-highlight-transparent flex-row items-center shadow-sm px-3 gap-3",
innerWrapper: "inline-flex w-full items-center h-full box-border",
input: [
"w-full font-normal bg-transparent !outline-none placeholder:text-foreground-500 focus-visible:outline-none",
"data-[has-start-content=true]:ps-1.5",
"data-[has-end-content=true]:pe-1.5",
"file:cursor-pointer file:bg-transparent file:border-0",
"autofill:bg-transparent bg-clip-text"
],
clearButton: [
"p-2",
"-m-2",
"z-10",
"absolute",
"end-3",
"start-auto",
"pointer-events-none",
"appearance-none",
"outline-none",
"select-none",
"opacity-0",
"hover:!opacity-100",
"cursor-pointer",
"active:!opacity-70",
"rounded-full",
...dataFocusVisibleClasses
],
helperWrapper: "hidden group-data-[has-helper=true]:flex p-1 relative flex-col gap-1.5",
description: "text-tiny text-foreground-400",
errorMessage: "text-tiny text-danger"
},
variants: {
variant: {
flat: {
inputWrapper: [
"bg-default-100",
"data-[hover=true]:bg-default-200",
"group-data-[focus=true]:bg-default-100"
]
},
faded: {
inputWrapper: [
"bg-default-100",
"border-medium",
"border-default-200",
"data-[hover=true]:border-default-400 focus-within:border-default-400"
],
value: "group-data-[has-value=true]:text-default-foreground"
},
bordered: {
inputWrapper: [
"border-medium",
"border-default-200",
"data-[hover=true]:border-default-400",
"group-data-[focus=true]:border-default-foreground"
]
},
underlined: {
inputWrapper: [
"!px-1",
"!pb-0",
"!gap-0",
"relative",
"box-border",
"border-b-medium",
"shadow-[0_1px_0px_0_rgba(0,0,0,0.05)]",
"border-default-200",
"!rounded-none",
"hover:border-default-300",
"after:content-['']",
"after:w-0",
"after:origin-center",
"after:bg-default-foreground",
"after:absolute",
"after:left-1/2",
"after:-translate-x-1/2",
"after:-bottom-[2px]",
"after:h-[2px]",
"group-data-[focus=true]:after:w-full"
],
innerWrapper: "pb-1",
label: "group-data-[filled-within=true]:text-foreground"
}
},
color: {
default: {},
primary: {},
secondary: {},
success: {},
warning: {},
danger: {}
},
size: {
sm: {
label: "text-tiny",
inputWrapper: "h-8 min-h-8 px-2 rounded-small",
input: "text-small",
clearButton: "text-medium"
},
md: {
inputWrapper: "h-10 min-h-10 rounded-medium",
input: "text-small",
clearButton: "text-large"
},
lg: {
label: "text-medium",
inputWrapper: "h-12 min-h-12 rounded-large",
input: "text-medium",
clearButton: "text-large"
}
},
radius: {
none: {
inputWrapper: "rounded-none"
},
sm: {
inputWrapper: "rounded-small"
},
md: {
inputWrapper: "rounded-medium"
},
lg: {
inputWrapper: "rounded-large"
},
full: {
inputWrapper: "rounded-full"
}
},
labelPlacement: {
outside: {
mainWrapper: "flex flex-col"
},
"outside-left": {
base: "flex-row items-center flex-nowrap data-[has-helper=true]:items-start",
inputWrapper: "flex-1",
mainWrapper: "flex flex-col",
label: "relative text-foreground pe-2 ps-2 pointer-events-auto"
},
inside: {
label: "cursor-text",
inputWrapper: "flex-col items-start justify-center gap-0",
innerWrapper: "group-data-[has-label=true]:items-end"
}
},
fullWidth: {
true: {
base: "w-full"
},
false: {}
},
isClearable: {
true: {
input: "peer pe-6 input-search-cancel-button-none",
clearButton: [
"peer-data-[filled=true]:pointer-events-auto",
"peer-data-[filled=true]:opacity-70 peer-data-[filled=true]:block",
"peer-data-[filled=true]:scale-100"
]
}
},
isDisabled: {
true: {
base: "opacity-disabled pointer-events-none",
inputWrapper: "pointer-events-none",
label: "pointer-events-none"
}
},
isInvalid: {
true: {
label: "!text-danger",
input: "!placeholder:text-danger !text-danger"
}
},
isRequired: {
true: {
label: "after:content-['*'] after:text-danger after:ms-0.5"
}
},
isMultiline: {
true: {
label: "relative",
inputWrapper: "!h-auto",
innerWrapper: "items-start group-data-[has-label=true]:items-start",
input: "resize-none data-[hide-scroll=true]:scrollbar-hide",
clearButton: "absolute top-2 right-2 rtl:right-auto rtl:left-2 z-10"
}
},
disableAnimation: {
true: {
input: "transition-none",
inputWrapper: "transition-none",
label: "transition-none"
},
false: {
inputWrapper: "transition-background motion-reduce:transition-none !duration-150",
label: [
"will-change-auto",
"!duration-200",
"!ease-out",
"motion-reduce:transition-none",
"transition-[transform,color,left,opacity]"
],
clearButton: [
"scale-90",
"ease-out",
"duration-150",
"transition-[opacity,transform]",
"motion-reduce:transition-none",
"motion-reduce:scale-100"
]
}
}
},
defaultVariants: {
variant: "flat",
color: "default",
size: "md",
fullWidth: true,
labelPlacement: "inside",
isDisabled: false,
isMultiline: false
},
compoundVariants: [
{
variant: "flat",
color: "default",
class: {
input: "group-data-[has-value=true]:text-default-foreground"
}
},
{
variant: "flat",
color: "primary",
class: {
inputWrapper: [
"bg-primary-100",
"data-[hover=true]:bg-primary-50",
"text-primary",
"group-data-[focus=true]:bg-primary-50",
"placeholder:text-primary"
],
input: "placeholder:text-primary",
label: "text-primary"
}
},
{
variant: "flat",
color: "secondary",
class: {
inputWrapper: [
"bg-secondary-100",
"text-secondary",
"data-[hover=true]:bg-secondary-50",
"group-data-[focus=true]:bg-secondary-50",
"placeholder:text-secondary"
],
input: "placeholder:text-secondary",
label: "text-secondary"
}
},
{
variant: "flat",
color: "success",
class: {
inputWrapper: [
"bg-success-100",
"text-success-600",
"dark:text-success",
"placeholder:text-success-600",
"dark:placeholder:text-success",
"data-[hover=true]:bg-success-50",
"group-data-[focus=true]:bg-success-50"
],
input: "placeholder:text-success-600 dark:placeholder:text-success",
label: "text-success-600 dark:text-success"
}
},
{
variant: "flat",
color: "warning",
class: {
inputWrapper: [
"bg-warning-100",
"text-warning-600",
"dark:text-warning",
"placeholder:text-warning-600",
"dark:placeholder:text-warning",
"data-[hover=true]:bg-warning-50",
"group-data-[focus=true]:bg-warning-50"
],
input: "placeholder:text-warning-600 dark:placeholder:text-warning",
label: "text-warning-600 dark:text-warning"
}
},
{
variant: "flat",
color: "danger",
class: {
inputWrapper: [
"bg-danger-100",
"text-danger",
"dark:text-danger-500",
"placeholder:text-danger",
"dark:placeholder:text-danger-500",
"data-[hover=true]:bg-danger-50",
"group-data-[focus=true]:bg-danger-50"
],
input: "placeholder:text-danger dark:placeholder:text-danger-500",
label: "text-danger dark:text-danger-500"
}
},
{
variant: "faded",
color: "primary",
class: {
label: "text-primary",
inputWrapper: "data-[hover=true]:border-primary focus-within:border-primary"
}
},
{
variant: "faded",
color: "secondary",
class: {
label: "text-secondary",
inputWrapper: "data-[hover=true]:border-secondary focus-within:border-secondary"
}
},
{
variant: "faded",
color: "success",
class: {
label: "text-success",
inputWrapper: "data-[hover=true]:border-success focus-within:border-success"
}
},
{
variant: "faded",
color: "warning",
class: {
label: "text-warning",
inputWrapper: "data-[hover=true]:border-warning focus-within:border-warning"
}
},
{
variant: "faded",
color: "danger",
class: {
label: "text-danger",
inputWrapper: "data-[hover=true]:border-danger focus-within:border-danger"
}
},
{
variant: "underlined",
color: "default",
class: {
input: "group-data-[has-value=true]:text-foreground"
}
},
{
variant: "underlined",
color: "primary",
class: {
inputWrapper: "after:bg-primary",
label: "text-primary"
}
},
{
variant: "underlined",
color: "secondary",
class: {
inputWrapper: "after:bg-secondary",
label: "text-secondary"
}
},
{
variant: "underlined",
color: "success",
class: {
inputWrapper: "after:bg-success",
label: "text-success"
}
},
{
variant: "underlined",
color: "warning",
class: {
inputWrapper: "after:bg-warning",
label: "text-warning"
}
},
{
variant: "underlined",
color: "danger",
class: {
inputWrapper: "after:bg-danger",
label: "text-danger"
}
},
{
variant: "bordered",
color: "primary",
class: {
inputWrapper: "group-data-[focus=true]:border-primary",
label: "text-primary"
}
},
{
variant: "bordered",
color: "secondary",
class: {
inputWrapper: "group-data-[focus=true]:border-secondary",
label: "text-secondary"
}
},
{
variant: "bordered",
color: "success",
class: {
inputWrapper: "group-data-[focus=true]:border-success",
label: "text-success"
}
},
{
variant: "bordered",
color: "warning",
class: {
inputWrapper: "group-data-[focus=true]:border-warning",
label: "text-warning"
}
},
{
variant: "bordered",
color: "danger",
class: {
inputWrapper: "group-data-[focus=true]:border-danger",
label: "text-danger"
}
},
{
labelPlacement: "inside",
color: "default",
class: {
label: "group-data-[filled-within=true]:text-default-600"
}
},
{
labelPlacement: "outside",
color: "default",
class: {
label: "group-data-[filled-within=true]:text-foreground"
}
},
{
radius: "full",
size: ["sm"],
class: {
inputWrapper: "px-3"
}
},
{
radius: "full",
size: "md",
class: {
inputWrapper: "px-4"
}
},
{
radius: "full",
size: "lg",
class: {
inputWrapper: "px-5"
}
},
{
disableAnimation: false,
variant: ["faded", "bordered"],
class: {
inputWrapper: "transition-colors motion-reduce:transition-none"
}
},
{
disableAnimation: false,
variant: "underlined",
class: {
inputWrapper: "after:transition-width motion-reduce:after:transition-none"
}
},
{
variant: ["flat", "faded"],
class: {
inputWrapper: [
...groupDataFocusVisibleClasses
]
}
},
{
isInvalid: true,
variant: "flat",
class: {
inputWrapper: [
"!bg-danger-50",
"data-[hover=true]:!bg-danger-100",
"group-data-[focus=true]:!bg-danger-50"
]
}
},
{
isInvalid: true,
variant: "bordered",
class: {
inputWrapper: "!border-danger group-data-[focus=true]:!border-danger"
}
},
{
isInvalid: true,
variant: "underlined",
class: {
inputWrapper: "after:!bg-danger"
}
},
{
labelPlacement: "inside",
size: "sm",
class: {
inputWrapper: "h-12 py-1.5 px-3"
}
},
{
labelPlacement: "inside",
size: "md",
class: {
inputWrapper: "h-14 py-2"
}
},
{
labelPlacement: "inside",
size: "lg",
class: {
inputWrapper: "h-16 py-2.5 gap-0"
}
},
{
labelPlacement: "inside",
size: "sm",
variant: ["bordered", "faded"],
class: {
inputWrapper: "py-1"
}
},
{
labelPlacement: ["inside", "outside"],
class: {
label: ["group-data-[filled-within=true]:pointer-events-auto"]
}
},
{
labelPlacement: "outside",
isMultiline: false,
class: {
base: "relative justify-end",
label: [
"pb-0",
"z-20",
"top-1/2",
"-translate-y-1/2",
"group-data-[filled-within=true]:start-0"
]
}
},
{
labelPlacement: ["inside"],
class: {
label: ["group-data-[filled-within=true]:scale-85"]
}
},
{
labelPlacement: ["inside"],
variant: "flat",
class: {
innerWrapper: "pb-0.5"
}
},
{
variant: "underlined",
size: "sm",
class: {
innerWrapper: "pb-1"
}
},
{
variant: "underlined",
size: ["md", "lg"],
class: {
innerWrapper: "pb-1.5"
}
},
{
labelPlacement: "inside",
size: ["sm", "md"],
class: {
label: "text-small"
}
},
{
labelPlacement: "inside",
isMultiline: false,
size: "sm",
class: {
label: [
"group-data-[filled-within=true]:-translate-y-[calc(50%_+_theme(fontSize.tiny)/2_-_8px)]"
]
}
},
{
labelPlacement: "inside",
isMultiline: false,
size: "md",
class: {
label: [
"group-data-[filled-within=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_6px)]"
]
}
},
{
labelPlacement: "inside",
isMultiline: false,
size: "lg",
class: {
label: [
"text-medium",
"group-data-[filled-within=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_8px)]"
]
}
},
{
labelPlacement: "inside",
variant: ["faded", "bordered"],
isMultiline: false,
size: "sm",
class: {
label: [
"group-data-[filled-within=true]:-translate-y-[calc(50%_+_theme(fontSize.tiny)/2_-_8px_-_theme(borderWidth.medium))]"
]
}
},
{
labelPlacement: "inside",
variant: ["faded", "bordered"],
isMultiline: false,
size: "md",
class: {
label: [
"group-data-[filled-within=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_6px_-_theme(borderWidth.medium))]"
]
}
},
{
labelPlacement: "inside",
variant: ["faded", "bordered"],
isMultiline: false,
size: "lg",
class: {
label: [
"text-medium",
"group-data-[filled-within=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_8px_-_theme(borderWidth.medium))]"
]
}
},
{
labelPlacement: "inside",
variant: "underlined",
isMultiline: false,
size: "sm",
class: {
label: [
"group-data-[filled-within=true]:-translate-y-[calc(50%_+_theme(fontSize.tiny)/2_-_5px)]"
]
}
},
{
labelPlacement: "inside",
variant: "underlined",
isMultiline: false,
size: "md",
class: {
label: [
"group-data-[filled-within=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_3.5px)]"
]
}
},
{
labelPlacement: "inside",
variant: "underlined",
size: "lg",
isMultiline: false,
class: {
label: [
"text-medium",
"group-data-[filled-within=true]:-translate-y-[calc(50%_+_theme(fontSize.small)/2_-_4px)]"
]
}
},
{
labelPlacement: "outside",
size: "sm",
isMultiline: false,
class: {
label: [
"start-2",
"text-tiny",
"group-data-[filled-within=true]:-translate-y-[calc(100%_+_theme(fontSize.tiny)/2_+_16px)]"
],
base: "data-[has-label=true]:mt-[calc(theme(fontSize.small)_+_8px)]"
}
},
{
labelPlacement: "outside",
size: "md",
isMultiline: false,
class: {
label: [
"start-3",
"end-auto",
"text-small",
"group-data-[filled-within=true]:-translate-y-[calc(100%_+_theme(fontSize.small)/2_+_20px)]"
],
base: "data-[has-label=true]:mt-[calc(theme(fontSize.small)_+_10px)]"
}
},
{
labelPlacement: "outside",
size: "lg",
isMultiline: false,
class: {
label: [
"start-3",
"end-auto",
"text-medium",
"group-data-[filled-within=true]:-translate-y-[calc(100%_+_theme(fontSize.small)/2_+_24px)]"
],
base: "data-[has-label=true]:mt-[calc(theme(fontSize.small)_+_12px)]"
}
},
{
labelPlacement: "outside-left",
size: "sm",
class: {
label: "group-data-[has-helper=true]:pt-2"
}
},
{
labelPlacement: "outside-left",
size: "md",
class: {
label: "group-data-[has-helper=true]:pt-3"
}
},
{
labelPlacement: "outside-left",
size: "lg",
class: {
label: "group-data-[has-helper=true]:pt-4"
}
},
{
labelPlacement: ["outside", "outside-left"],
isMultiline: true,
class: {
inputWrapper: "py-2"
}
},
{
labelPlacement: "outside",
isMultiline: true,
class: {
label: "pb-1.5"
}
},
{
labelPlacement: "inside",
isMultiline: true,
class: {
label: "pb-0.5",
input: "pt-0"
}
},
{
isMultiline: true,
disableAnimation: false,
class: {
input: "transition-height !duration-100 motion-reduce:transition-none"
}
},
{
labelPlacement: ["inside", "outside"],
class: {
label: ["pe-2", "max-w-full", "text-ellipsis", "overflow-hidden"]
}
},
{
isMultiline: true,
radius: "full",
class: {
inputWrapper: "data-[has-multiple-rows=true]:rounded-large"
}
},
{
isClearable: true,
isMultiline: true,
class: {
clearButton: [
"group-data-[has-value=true]:opacity-70 group-data-[has-value=true]:block",
"group-data-[has-value=true]:scale-100",
"group-data-[has-value=true]:pointer-events-auto"
]
}
}
]
});
export {
input
};
@@ -0,0 +1,26 @@
import { PluginFunc, ConfigType, QUnitType, OpUnitType } from 'dayjs'
declare const plugin: PluginFunc
export = plugin
declare module 'dayjs' {
interface Dayjs {
quarter(): number
quarter(quarter: number): Dayjs
add(value: number, unit: QUnitType): Dayjs
subtract(value: number, unit: QUnitType): Dayjs
startOf(unit: QUnitType | OpUnitType): Dayjs
endOf(unit: QUnitType | OpUnitType): Dayjs
isSame(date?: ConfigType, unit?: QUnitType): boolean
isBefore(date?: ConfigType, unit?: QUnitType): boolean
isAfter(date?: ConfigType, unit?: QUnitType): boolean
}
}
@@ -0,0 +1,44 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.PatternMatcher = void 0;
const eslintUtils = __importStar(require("@eslint-community/eslint-utils"));
/**
* The class to find a pattern in strings as handling escape sequences.
* It ignores the found pattern if it's escaped with `\`.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#patternmatcher-class}
*/
exports.PatternMatcher = eslintUtils.PatternMatcher;
@@ -0,0 +1,16 @@
import type { TSchema, SchemaOptions } from '../schema/index';
import { Kind, Hint } from '../symbols/index';
import { Static } from '../static/index';
export interface TThis extends TSchema {
[Kind]: 'This';
static: this['params'][0];
$ref: string;
}
type RecursiveStatic<T extends TSchema> = Static<T, [RecursiveStatic<T>]>;
export interface TRecursive<T extends TSchema> extends TSchema {
[Hint]: 'Recursive';
static: RecursiveStatic<T>;
}
/** `[Json]` Creates a Recursive type */
export declare function Recursive<T extends TSchema>(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive<T>;
export {};
@@ -0,0 +1,10 @@
const $aa519ee6cf463259$export$d6c8d9636a3dc49c = new WeakMap();
function $aa519ee6cf463259$export$68e648cbec363a18(state, index) {
let data = $aa519ee6cf463259$export$d6c8d9636a3dc49c.get(state);
if (!data) throw new Error('Unknown slider state');
return `${data.id}-${index}`;
}
export {$aa519ee6cf463259$export$d6c8d9636a3dc49c as sliderData, $aa519ee6cf463259$export$68e648cbec363a18 as getSliderThumbId};
//# sourceMappingURL=utils.module.js.map
@@ -0,0 +1,45 @@
{
"name": "browserslist",
"version": "4.28.0",
"description": "Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-env-preset",
"keywords": [
"caniuse",
"browsers",
"target"
],
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/browserslist"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/browserslist"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"author": "Andrey Sitnik <andrey@sitnik.ru>",
"license": "MIT",
"repository": "browserslist/browserslist",
"dependencies": {
"baseline-browser-mapping": "^2.8.25",
"caniuse-lite": "^1.0.30001754",
"electron-to-chromium": "^1.5.249",
"node-releases": "^2.0.27",
"update-browserslist-db": "^1.1.4"
},
"engines": {
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
},
"bin": {
"browserslist": "cli.js"
},
"types": "./index.d.ts",
"browser": {
"./node.js": "./browser.js",
"path": false
}
}
@@ -0,0 +1,18 @@
import baseGetTag from './_baseGetTag.js';
import isObjectLike from './isObjectLike.js';
/** `Object#toString` result references. */
var argsTag = '[object Arguments]';
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag;
}
export default baseIsArguments;
@@ -0,0 +1,161 @@
const CacheSemantics = require('http-cache-semantics')
const Negotiator = require('negotiator')
const ssri = require('ssri')
// options passed to http-cache-semantics constructor
const policyOptions = {
shared: false,
ignoreCargoCult: true,
}
// a fake empty response, used when only testing the
// request for storability
const emptyResponse = { status: 200, headers: {} }
// returns a plain object representation of the Request
const requestObject = (request) => {
const _obj = {
method: request.method,
url: request.url,
headers: {},
compress: request.compress,
}
request.headers.forEach((value, key) => {
_obj.headers[key] = value
})
return _obj
}
// returns a plain object representation of the Response
const responseObject = (response) => {
const _obj = {
status: response.status,
headers: {},
}
response.headers.forEach((value, key) => {
_obj.headers[key] = value
})
return _obj
}
class CachePolicy {
constructor ({ entry, request, response, options }) {
this.entry = entry
this.request = requestObject(request)
this.response = responseObject(response)
this.options = options
this.policy = new CacheSemantics(this.request, this.response, policyOptions)
if (this.entry) {
// if we have an entry, copy the timestamp to the _responseTime
// this is necessary because the CacheSemantics constructor forces
// the value to Date.now() which means a policy created from a
// cache entry is likely to always identify itself as stale
this.policy._responseTime = this.entry.metadata.time
}
}
// static method to quickly determine if a request alone is storable
static storable (request, options) {
// no cachePath means no caching
if (!options.cachePath) {
return false
}
// user explicitly asked not to cache
if (options.cache === 'no-store') {
return false
}
// we only cache GET and HEAD requests
if (!['GET', 'HEAD'].includes(request.method)) {
return false
}
// otherwise, let http-cache-semantics make the decision
// based on the request's headers
const policy = new CacheSemantics(requestObject(request), emptyResponse, policyOptions)
return policy.storable()
}
// returns true if the policy satisfies the request
satisfies (request) {
const _req = requestObject(request)
if (this.request.headers.host !== _req.headers.host) {
return false
}
if (this.request.compress !== _req.compress) {
return false
}
const negotiatorA = new Negotiator(this.request)
const negotiatorB = new Negotiator(_req)
if (JSON.stringify(negotiatorA.mediaTypes()) !== JSON.stringify(negotiatorB.mediaTypes())) {
return false
}
if (JSON.stringify(negotiatorA.languages()) !== JSON.stringify(negotiatorB.languages())) {
return false
}
if (JSON.stringify(negotiatorA.encodings()) !== JSON.stringify(negotiatorB.encodings())) {
return false
}
if (this.options.integrity) {
return ssri.parse(this.options.integrity).match(this.entry.integrity)
}
return true
}
// returns true if the request and response allow caching
storable () {
return this.policy.storable()
}
// NOTE: this is a hack to avoid parsing the cache-control
// header ourselves, it returns true if the response's
// cache-control contains must-revalidate
get mustRevalidate () {
return !!this.policy._rescc['must-revalidate']
}
// returns true if the cached response requires revalidation
// for the given request
needsRevalidation (request) {
const _req = requestObject(request)
// force method to GET because we only cache GETs
// but can serve a HEAD from a cached GET
_req.method = 'GET'
return !this.policy.satisfiesWithoutRevalidation(_req)
}
responseHeaders () {
return this.policy.responseHeaders()
}
// returns a new object containing the appropriate headers
// to send a revalidation request
revalidationHeaders (request) {
const _req = requestObject(request)
return this.policy.revalidationHeaders(_req)
}
// returns true if the request/response was revalidated
// successfully. returns false if a new response was received
revalidated (request, response) {
const _req = requestObject(request)
const _res = responseObject(response)
const policy = this.policy.revalidatedPolicy(_req, _res)
return !policy.modified
}
}
module.exports = CachePolicy
@@ -0,0 +1 @@
{"version":3,"file":"resolveBindingsDeactivations.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveBindingsDeactivations.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAIvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAelE,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,SAAS,GACtC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBtB"}
@@ -0,0 +1,32 @@
export {
_lt as lt,
_lte as lte,
_lte as maximum,
_gt as gt,
_gte as gte,
_gte as minimum,
_positive as positive,
_negative as negative,
_nonpositive as nonpositive,
_nonnegative as nonnegative,
_multipleOf as multipleOf,
_maxSize as maxSize,
_minSize as minSize,
_size as size,
_maxLength as maxLength,
_minLength as minLength,
_length as length,
_regex as regex,
_lowercase as lowercase,
_uppercase as uppercase,
_includes as includes,
_startsWith as startsWith,
_endsWith as endsWith,
_property as property,
_mime as mime,
_overwrite as overwrite,
_normalize as normalize,
_trim as trim,
_toLowerCase as toLowerCase,
_toUpperCase as toUpperCase,
} from "../core/index.js";
@@ -0,0 +1,11 @@
/**
* Count how often a character (or substring) is used in a string.
*
* @param {string} value
* Value to search in.
* @param {string} character
* Character (or substring) to look for.
* @return {number}
* Number of times `character` occurred in `value`.
*/
export function ccount(value: string, character: string): number
@@ -0,0 +1,59 @@
# 0.9.0
- update dependencies, in particular `levn` and `type-check` - this could affect behaviour of argument parsing
# 0.8.3
- changes dependency from `wordwrap` to `word-wrap` due to license issue
- update dependencies
# 0.8.2
- fix bug #18 - detect missing value when flag is last item
- update dependencies
# 0.8.1
- update `fast-levenshtein` dependency
# 0.8.0
- update `levn` dependency - supplying a float value to an option with type `Int` now throws an error, instead of silently converting to an `Int`
# 0.7.1
- fix bug with use of `defaults` and `concatRepeatedArrays` or `mergeRepeatedObjects`
# 0.7.0
- added `concatrepeatedarrays` option: `oneValuePerFlag`, only allows one array value per flag
- added `typeAliases` option
- added `parseArgv` which takes an array and parses with the first two items sliced off
- changed enum help style
- bug fixes (#12)
- use of `concatRepeatedArrays` and `mergeRepeatedObjects` at the top level is deprecated, use it as either a per-option option, or set them in the `defaults` object to set them for all objects
# 0.6.0
- added `defaults` lib-option flag, allowing one to set default properties for all options
- added `concatRepeatedArrays` and `mergeRepeatedObjects` as option level properties, allowing you to turn this feature on for specific options only
# 0.5.0
- `Boolean` flags with `default: 'true'`, and no short aliases, will by default show the `--no` version in help
# 0.4.0
- add `mergeRepeatedObjects` setting
# 0.3.0
- add `concatRepeatedArrays` setting
- add `overrideRequired` option setting
- use just Levenshtein string compare algo rather than Levenshtein Damerau to due dependency license issue
# 0.2.2
- bug fixes
# 0.2.1
- improved interpolation
- added changelog
# 0.2.0
- add dependency checks to options - added `dependsOn` as an option property
- add interpolation for `prepend` and `append` text with new `generateHelp` option, `interpolate`
# 0.1.1
- update dependencies
# 0.1.0
- initial release
@@ -0,0 +1,40 @@
import { getCurrentSuite } from '@vitest/runner';
import { createChainable } from '@vitest/runner/utils';
import { noop } from '@vitest/utils/helpers';
import { g as getWorkerState } from './utils.DvEY5TfP.js';
const benchFns = /* @__PURE__ */ new WeakMap();
const benchOptsMap = /* @__PURE__ */ new WeakMap();
function getBenchOptions(key) {
return benchOptsMap.get(key);
}
function getBenchFn(key) {
return benchFns.get(key);
}
const bench = createBenchmark(function(name, fn = noop, options = {}) {
if (getWorkerState().config.mode !== "benchmark") throw new Error("`bench()` is only available in benchmark mode.");
const task = getCurrentSuite().task(formatName(name), {
...this,
meta: { benchmark: true }
});
benchFns.set(task, fn);
benchOptsMap.set(task, options);
// vitest runner sets mode to `todo` if handler is not passed down
// but we store handler separetly
if (!this.todo && task.mode === "todo") task.mode = "run";
});
function createBenchmark(fn) {
const benchmark = createChainable([
"skip",
"only",
"todo"
], fn);
benchmark.skipIf = (condition) => condition ? benchmark.skip : benchmark;
benchmark.runIf = (condition) => condition ? benchmark : benchmark.skip;
return benchmark;
}
function formatName(name) {
return typeof name === "string" ? name : typeof name === "function" ? name.name || "<anonymous>" : String(name);
}
export { getBenchOptions as a, bench as b, getBenchFn as g };
@@ -0,0 +1,38 @@
{
"name": "@react-aria/form",
"version": "3.0.11",
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
"types": "dist/types.d.ts",
"exports": {
"types": "./dist/types.d.ts",
"import": "./dist/import.mjs",
"require": "./dist/main.js"
},
"source": "src/index.ts",
"files": [
"dist",
"src"
],
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@react-aria/interactions": "^3.22.5",
"@react-aria/utils": "^3.26.0",
"@react-stately/form": "^3.1.0",
"@react-types/shared": "^3.26.0",
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "71f0ef23053f9e03ee7e97df736e8b083e006849"
}
@@ -0,0 +1 @@
{"version":3,"names":["_toSetter","fn","args","thisArg","l","length","Object","defineProperty","set","v","apply"],"sources":["../../src/helpers/toSetter.ts"],"sourcesContent":["/* @minVersion 7.24.0 */\n\nexport default function _toSetter(fn: Function, args: any[], thisArg: any) {\n if (!args) args = [];\n var l = args.length++;\n return Object.defineProperty({}, \"_\", {\n set: function (v) {\n args[l] = v;\n fn.apply(thisArg, args);\n },\n });\n}\n"],"mappings":";;;;;;AAEe,SAASA,SAASA,CAACC,EAAY,EAAEC,IAAW,EAAEC,OAAY,EAAE;EACzE,IAAI,CAACD,IAAI,EAAEA,IAAI,GAAG,EAAE;EACpB,IAAIE,CAAC,GAAGF,IAAI,CAACG,MAAM,EAAE;EACrB,OAAOC,MAAM,CAACC,cAAc,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE;IACpCC,GAAG,EAAE,SAAAA,CAAUC,CAAC,EAAE;MAChBP,IAAI,CAACE,CAAC,CAAC,GAAGK,CAAC;MACXR,EAAE,CAACS,KAAK,CAACP,OAAO,EAAED,IAAI,CAAC;IACzB;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,20 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertAAGUIDToString = convertAAGUIDToString;
const index_js_1 = require("./iso/index.js");
/**
* Convert the aaguid buffer in authData into a UUID string
*/
function convertAAGUIDToString(aaguid) {
// Raw Hex: adce000235bcc60a648b0b25f1f05503
const hex = index_js_1.isoUint8Array.toHex(aaguid);
const segments = [
hex.slice(0, 8), // 8
hex.slice(8, 12), // 4
hex.slice(12, 16), // 4
hex.slice(16, 20), // 4
hex.slice(20, 32), // 8
];
// Formatted: adce0002-35bc-c60a-648b-0b25f1f05503
return segments.join('-');
}
@@ -0,0 +1,117 @@
import * as util from "../core/util.js";
const error = () => {
const Sizable = {
string: { unit: "karakter", verb: "legyen" },
file: { unit: "byte", verb: "legyen" },
array: { unit: "elem", verb: "legyen" },
set: { unit: "elem", verb: "legyen" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const parsedType = (data) => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "NaN" : "szám";
}
case "object": {
if (Array.isArray(data)) {
return "tömb";
}
if (data === null) {
return "null";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns = {
regex: "bemenet",
email: "email cím",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO időbélyeg",
date: "ISO dátum",
time: "ISO idő",
duration: "ISO időintervallum",
ipv4: "IPv4 cím",
ipv6: "IPv6 cím",
cidrv4: "IPv4 tartomány",
cidrv6: "IPv6 tartomány",
base64: "base64-kódolt string",
base64url: "base64url-kódolt string",
json_string: "JSON string",
e164: "E.164 szám",
jwt: "JWT",
template_literal: "bemenet",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `Érvénytelen bemenet: a várt érték ${issue.expected}, a kapott érték ${parsedType(issue.input)}`;
// return `Invalid input: expected ${issue.expected}, received ${util.getParsedType(issue.input)}`;
case "invalid_value":
if (issue.values.length === 1)
return `Érvénytelen bemenet: a várt érték ${util.stringifyPrimitive(issue.values[0])}`;
return `Érvénytelen opció: valamelyik érték várt ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Túl nagy: ${issue.origin ?? "érték"} mérete túl nagy ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elem"}`;
return `Túl nagy: a bemeneti érték ${issue.origin ?? "érték"} túl nagy: ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Túl kicsi: a bemeneti érték ${issue.origin} mérete túl kicsi ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `Túl kicsi: a bemeneti érték ${issue.origin} túl kicsi ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `Érvénytelen string: "${_issue.prefix}" értékkel kell kezdődnie`;
if (_issue.format === "ends_with")
return `Érvénytelen string: "${_issue.suffix}" értékkel kell végződnie`;
if (_issue.format === "includes")
return `Érvénytelen string: "${_issue.includes}" értéket kell tartalmaznia`;
if (_issue.format === "regex")
return `Érvénytelen string: ${_issue.pattern} mintának kell megfelelnie`;
return `Érvénytelen ${Nouns[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Érvénytelen szám: ${issue.divisor} többszörösének kell lennie`;
case "unrecognized_keys":
return `Ismeretlen kulcs${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Érvénytelen kulcs ${issue.origin}`;
case "invalid_union":
return "Érvénytelen bemenet";
case "invalid_element":
return `Érvénytelen érték: ${issue.origin}`;
default:
return `Érvénytelen bemenet`;
}
};
};
export default function () {
return {
localeError: error(),
};
}
@@ -0,0 +1,25 @@
"use strict"
const { READ } = require("@eslint-community/eslint-utils")
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
const trace_events = {
createTracing: { [READ]: { supported: ["10.0.0"] } },
getEnabledCategories: { [READ]: { supported: ["10.0.0"] } },
}
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
module.exports = {
trace_events: {
[READ]: { experimental: ["10.0.0"] },
...trace_events,
},
"node:trace_events": {
[READ]: { experimental: ["14.13.1", "12.20.0"] },
...trace_events,
},
}
@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<!-- http://cyber.law.harvard.edu/rss/examples/rss2sample.xml -->
<rss version="2.0">
<channel>
<title>Liftoff News</title>
<link>http://liftoff.msfc.nasa.gov/</link>
<description>Liftoff to Space Exploration.</description>
<language>en-us</language>
<pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
<lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>Weblog Editor 2.0</generator>
<managingEditor>editor@example.com</managingEditor>
<webMaster>webmaster@example.com</webMaster>
<item>
<title>Star City</title>
<link>http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp</link>
<description>How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's &lt;a href="http://howe.iki.rssi.ru/GCTC/gctc_e.htm"&gt;Star City&lt;/a&gt;.</description>
<pubDate>Tue, 03 Jun 2003 09:39:21 GMT</pubDate>
<guid>http://liftoff.msfc.nasa.gov/2003/06/03.html#item573</guid>
</item>
<item>
<description>Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a &lt;a href="http://science.nasa.gov/headlines/y2003/30may_solareclipse.htm"&gt;partial eclipse of the Sun&lt;/a&gt; on Saturday, May 31st.</description>
<pubDate>Fri, 30 May 2003 11:06:42 GMT</pubDate>
<guid>http://liftoff.msfc.nasa.gov/2003/05/30.html#item572</guid>
</item>
<item>
<title>The Engine That Does More</title>
<link>http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp</link>
<description>Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly. The proposed VASIMR engine would do that.</description>
<pubDate>Tue, 27 May 2003 08:37:32 GMT</pubDate>
<guid>http://liftoff.msfc.nasa.gov/2003/05/27.html#item571</guid>
</item>
<item>
<title>Astronauts' Dirty Laundry</title>
<link>http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp</link>
<description>Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them. Instead, astronauts have other options.</description>
<pubDate>Tue, 20 May 2003 08:56:02 GMT</pubDate>
<guid>http://liftoff.msfc.nasa.gov/2003/05/20.html#item570</guid>
<media:content height="200" medium="image" url="https://picsum.photos/200" width="200"/>
</item>
</channel>
</rss>
@@ -0,0 +1 @@
{"version":3,"names":["shallowEqual","actual","expected","keys","Object","key"],"sources":["../../src/utils/shallowEqual.ts"],"sourcesContent":["export default function shallowEqual<T extends object>(\n actual: object,\n expected: T,\n): actual is T {\n const keys = Object.keys(expected) as (keyof T)[];\n\n for (const key of keys) {\n if (\n // @ts-expect-error maybe we should check whether key exists first\n actual[key] !== expected[key]\n ) {\n return false;\n }\n }\n\n return true;\n}\n"],"mappings":";;;;;;AAAe,SAASA,YAAYA,CAClCC,MAAc,EACdC,QAAW,EACE;EACb,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACD,QAAQ,CAAgB;EAEjD,KAAK,MAAMG,GAAG,IAAIF,IAAI,EAAE;IACtB,IAEEF,MAAM,CAACI,GAAG,CAAC,KAAKH,QAAQ,CAACG,GAAG,CAAC,EAC7B;MACA,OAAO,KAAK;IACd;EACF;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
@@ -0,0 +1,15 @@
# Installation
> `npm install --save @types/chai`
# Summary
This package contains type definitions for chai (http://chaijs.com/).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chai.
### Additional Details
* Last updated: Mon, 20 Oct 2025 23:32:35 GMT
* Dependencies: [@types/deep-eql](https://npmjs.com/package/@types/deep-eql), [assertion-error](https://npmjs.com/package/assertion-error)
# Credits
These definitions were written by [Bart van der Schoor](https://github.com/Bartvds), [Andrew Brown](https://github.com/AGBrown), [Olivier Chevet](https://github.com/olivr70), [Matt Wistrand](https://github.com/mwistrand), [Shaun Luttin](https://github.com/shaunluttin), [Satana Charuwichitratana](https://github.com/micksatana), [Erik Schierboom](https://github.com/ErikSchierboom), [Bogdan Paranytsia](https://github.com/bparan), [CXuesong](https://github.com/CXuesong), and [Joey Kilpatrick](https://github.com/joeykilpatrick).
@@ -0,0 +1,10 @@
/**
* @typedef {import('./lib/index.js').Options} Options
*/
export {
defaultFootnoteBackContent,
defaultFootnoteBackLabel,
defaultHandlers
} from 'mdast-util-to-hast'
export {default} from './lib/index.js'
@@ -0,0 +1,11 @@
"use strict";
var _array_with_holes = require("./_array_with_holes.cjs");
var _iterable_to_array_limit = require("./_iterable_to_array_limit.cjs");
var _non_iterable_rest = require("./_non_iterable_rest.cjs");
var _unsupported_iterable_to_array = require("./_unsupported_iterable_to_array.cjs");
function _sliced_to_array(arr, i) {
return _array_with_holes._(arr) || _iterable_to_array_limit._(arr, i) || _unsupported_iterable_to_array._(arr, i) || _non_iterable_rest._();
}
exports._ = _sliced_to_array;
@@ -0,0 +1,168 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {};
exports["default"] = void 0;
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireWildcard(require("react"));
var _useCodeMirror2 = require("./useCodeMirror");
Object.keys(_useCodeMirror2).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _useCodeMirror2[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _useCodeMirror2[key];
}
});
});
var _jsxRuntime = require("react/jsx-runtime");
var _view = require("@codemirror/view");
Object.keys(_view).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _view[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _view[key];
}
});
});
var _state = require("@codemirror/state");
Object.keys(_state).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _state[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _state[key];
}
});
});
var _codemirrorExtensionsBasicSetup = require("@uiw/codemirror-extensions-basic-setup");
Object.keys(_codemirrorExtensionsBasicSetup).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _codemirrorExtensionsBasicSetup[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _codemirrorExtensionsBasicSetup[key];
}
});
});
var _getDefaultExtensions = require("./getDefaultExtensions");
Object.keys(_getDefaultExtensions).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _getDefaultExtensions[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _getDefaultExtensions[key];
}
});
});
var _utils = require("./utils");
Object.keys(_utils).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _utils[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _utils[key];
}
});
});
var _excluded = ["className", "value", "selection", "extensions", "onChange", "onStatistics", "onCreateEditor", "onUpdate", "autoFocus", "theme", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "basicSetup", "placeholder", "indentWithTab", "editable", "readOnly", "root", "initialState"];
var ReactCodeMirror = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
var className = props.className,
_props$value = props.value,
value = _props$value === void 0 ? '' : _props$value,
selection = props.selection,
_props$extensions = props.extensions,
extensions = _props$extensions === void 0 ? [] : _props$extensions,
onChange = props.onChange,
onStatistics = props.onStatistics,
onCreateEditor = props.onCreateEditor,
onUpdate = props.onUpdate,
autoFocus = props.autoFocus,
_props$theme = props.theme,
theme = _props$theme === void 0 ? 'light' : _props$theme,
height = props.height,
minHeight = props.minHeight,
maxHeight = props.maxHeight,
width = props.width,
minWidth = props.minWidth,
maxWidth = props.maxWidth,
basicSetup = props.basicSetup,
placeholder = props.placeholder,
indentWithTab = props.indentWithTab,
editable = props.editable,
readOnly = props.readOnly,
root = props.root,
initialState = props.initialState,
other = (0, _objectWithoutProperties2["default"])(props, _excluded);
var editor = (0, _react.useRef)(null);
var _useCodeMirror = (0, _useCodeMirror2.useCodeMirror)({
root: root,
value: value,
autoFocus: autoFocus,
theme: theme,
height: height,
minHeight: minHeight,
maxHeight: maxHeight,
width: width,
minWidth: minWidth,
maxWidth: maxWidth,
basicSetup: basicSetup,
placeholder: placeholder,
indentWithTab: indentWithTab,
editable: editable,
readOnly: readOnly,
selection: selection,
onChange: onChange,
onStatistics: onStatistics,
onCreateEditor: onCreateEditor,
onUpdate: onUpdate,
extensions: extensions,
initialState: initialState
}),
state = _useCodeMirror.state,
view = _useCodeMirror.view,
container = _useCodeMirror.container,
setContainer = _useCodeMirror.setContainer;
(0, _react.useImperativeHandle)(ref, function () {
return {
editor: editor.current,
state: state,
view: view
};
}, [editor, container, state, view]);
var setEditorRef = (0, _react.useCallback)(function (el) {
editor.current = el;
setContainer(el);
}, [setContainer]);
// check type of value
if (typeof value !== 'string') {
throw new Error("value must be typeof string but got ".concat((0, _typeof2["default"])(value)));
}
var defaultClassNames = typeof theme === 'string' ? "cm-theme-".concat(theme) : 'cm-theme';
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _objectSpread2["default"])({
ref: setEditorRef,
className: "".concat(defaultClassNames).concat(className ? " ".concat(className) : '')
}, other));
});
ReactCodeMirror.displayName = 'CodeMirror';
var _default = exports["default"] = ReactCodeMirror;
@@ -0,0 +1 @@
{"name":"debug","version":"3.2.7","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532097926,"integrity":"sha512-R7YS706T8a9iiR4pXp+6wF4Czxcm9Ww2+tUxQ3bijLyvfINVUnvAvaVMJsvgl7yMpctPeaqeOrbx2HXcpB1KrA==","mode":420,"size":1107},"src/browser.js":{"checkedAt":1794532097926,"integrity":"sha512-YfFZT5BGQL7B8f5qOUkgm4RT1m/k/mhzFu6Q+keKVgPHYjpVAFu7le3cti8684/F4C9dx4TSxEmoXuCH7YI5Xw==","mode":420,"size":6285},"src/common.js":{"checkedAt":1794532097926,"integrity":"sha512-r4aeRxy5scmfqQNSbrBhkLlnHc2Y0UeakACMh+bYnzg+92iw12aaUgmHtfpKYGu7v7FlXcfGbDoGzcMYKyLQIQ==","mode":420,"size":5929},"src/index.js":{"checkedAt":1794532097926,"integrity":"sha512-4Y37GIs9CmelBFW7qa6HOaSUwN8qgMj+y+Qyqm0ysAlISDies0ecwdmZfKDuykv0M335eb5HUDJ/JnSyTX4Heg==","mode":420,"size":331},"node.js":{"checkedAt":1794532097926,"integrity":"sha512-YTZ+wq/5NJ4gOilf4bwo+t3G2AtVZmD1bqSdZiXWIoIS/oLXOYEUUJo7jZrUAmQp8Ou4SVecdIGSj0fzfIYy1Q==","mode":420,"size":40},"src/node.js":{"checkedAt":1794532097926,"integrity":"sha512-yrclP7zrA8cGtNuDZ1SBPRJnlAn/dkMdBkRGJtKglNLFopyGgDEdRLEdHzE7Fl2ap7KjFV7QRTD9XD2YQ/Nryg==","mode":420,"size":4415},"package.json":{"checkedAt":1794532097927,"integrity":"sha512-a3zhRLaiITLsLn6PLCwrUdRdM38Ri3c2Ye5CcUyHXOkTpDWMF03jHm2RZpMtopnGhkaKIQz4Mwk1R9hoSqksmg==","mode":420,"size":1153},"CHANGELOG.md":{"checkedAt":1794532097927,"integrity":"sha512-2AsoaWUhxEvEM9cxobnKuoMzndhyhb8IcY232YPtw/B6WFWWTTboJ1r+4x4TkB9DUoWc3tlyFZ6SQO/CdUhaRA==","mode":420,"size":12950},"README.md":{"checkedAt":1794532097927,"integrity":"sha512-fZwm/G8BkhNpzwAi4dVihFpTzGcj/qNzjGrBgr5QaW+ir/Cc5652U33uhnFMJiM5ICOSKq9wwEb01hBsnPn1xA==","mode":420,"size":21045}}}
@@ -0,0 +1,268 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
useMultiSelect: () => useMultiSelect,
useMultiSelectListState: () => useMultiSelectListState,
useMultiSelectState: () => useMultiSelectState
});
module.exports = __toCommonJS(src_exports);
// src/use-multiselect.ts
var import_i18n = require("@react-aria/i18n");
var import_interactions = require("@react-aria/interactions");
var import_label = require("@react-aria/label");
var import_menu = require("@react-aria/menu");
var import_selection = require("@react-aria/selection");
var import_utils = require("@react-aria/utils");
var import_react = require("react");
function useMultiSelect(props, state, ref) {
const { disallowEmptySelection, isDisabled } = props;
const collator = (0, import_i18n.useCollator)({ usage: "search", sensitivity: "base" });
const delegate = (0, import_react.useMemo)(
() => new import_selection.ListKeyboardDelegate(state.collection, state.disabledKeys, null, collator),
[state.collection, state.disabledKeys, collator]
);
const { menuTriggerProps, menuProps } = (0, import_menu.useMenuTrigger)(
{
isDisabled,
type: "listbox"
},
state,
ref
);
const triggerOnKeyDown = (e) => {
if (state.selectionMode === "single") {
switch (e.key) {
case "ArrowLeft": {
e.preventDefault();
const key = state.selectedKeys.size > 0 ? delegate.getKeyAbove(state.selectedKeys.values().next().value) : delegate.getFirstKey();
if (key) {
state.setSelectedKeys([key]);
}
break;
}
case "ArrowRight": {
e.preventDefault();
const key = state.selectedKeys.size > 0 ? delegate.getKeyBelow(state.selectedKeys.values().next().value) : delegate.getFirstKey();
if (key) {
state.setSelectedKeys([key]);
}
break;
}
}
}
};
const { typeSelectProps } = (0, import_selection.useTypeSelect)({
keyboardDelegate: delegate,
selectionManager: state.selectionManager,
onTypeSelect(key) {
state.setSelectedKeys([key]);
}
});
const { isInvalid, validationErrors, validationDetails } = state.displayValidation;
const { labelProps, fieldProps, descriptionProps, errorMessageProps } = (0, import_label.useField)({
...props,
labelElementType: "span",
isInvalid,
errorMessage: props.errorMessage || validationErrors
});
typeSelectProps.onKeyDown = typeSelectProps.onKeyDownCapture;
delete typeSelectProps.onKeyDownCapture;
const domProps = (0, import_utils.filterDOMProps)(props, { labelable: true });
const triggerProps = (0, import_utils.mergeProps)(typeSelectProps, menuTriggerProps, fieldProps);
const valueId = (0, import_utils.useId)();
return {
labelProps: {
...labelProps,
onClick: () => {
var _a;
if (!props.isDisabled) {
(_a = ref.current) == null ? void 0 : _a.focus();
(0, import_interactions.setInteractionModality)("keyboard");
}
}
},
triggerProps: (0, import_utils.mergeProps)(domProps, {
...triggerProps,
onKeyDown: (0, import_utils.chain)(triggerProps.onKeyDown, triggerOnKeyDown, props.onKeyDown),
onKeyUp: props.onKeyUp,
"aria-labelledby": [
valueId,
domProps["aria-label"] !== void 0 ? domProps["aria-labelledby"] !== void 0 ? domProps["aria-labelledby"] : triggerProps.id : triggerProps["aria-labelledby"]
].join(" "),
onFocus(e) {
if (state.isFocused) {
return;
}
if (props.onFocus) {
props.onFocus(e);
}
state.setFocused(true);
},
onBlur(e) {
if (state.isOpen) {
return;
}
if (props.onBlur) {
props.onBlur(e);
}
state.setFocused(false);
}
}),
valueProps: {
id: valueId
},
menuProps: {
...menuProps,
disallowEmptySelection,
autoFocus: state.focusStrategy || true,
shouldSelectOnPressUp: true,
shouldFocusOnHover: true,
onBlur: (e) => {
if (e.currentTarget.contains(e.relatedTarget)) {
return;
}
if (props.onBlur) {
props.onBlur(e);
}
state.setFocused(false);
},
onFocus: menuProps == null ? void 0 : menuProps.onFocus,
"aria-labelledby": [
fieldProps["aria-labelledby"],
triggerProps["aria-label"] && !fieldProps["aria-labelledby"] ? triggerProps.id : null
].filter(Boolean).join(" ")
},
descriptionProps,
errorMessageProps,
isInvalid,
validationErrors,
validationDetails
};
}
// src/use-multiselect-list-state.ts
var import_list = require("@react-stately/list");
var import_react2 = require("react");
function useMultiSelectListState(props) {
const {
collection,
disabledKeys,
selectionManager,
selectionManager: { setSelectedKeys, selectedKeys, selectionMode }
} = (0, import_list.useListState)(props);
const missingKeys = (0, import_react2.useMemo)(() => {
if (!props.isLoading && selectedKeys.size !== 0) {
return Array.from(selectedKeys).filter(Boolean).filter((key) => !collection.getItem(key));
}
return [];
}, [selectedKeys, collection]);
const selectedItems = selectedKeys.size !== 0 ? Array.from(selectedKeys).map((key) => {
return collection.getItem(key);
}).filter(Boolean) : null;
if (missingKeys.length) {
console.warn(
`Select: Keys "${missingKeys.join(
", "
)}" passed to "selectedKeys" are not present in the collection.`
);
}
return {
collection,
disabledKeys,
selectionManager,
selectionMode,
selectedKeys,
setSelectedKeys: setSelectedKeys.bind(selectionManager),
selectedItems
};
}
// src/use-multiselect-state.ts
var import_menu2 = require("@react-stately/menu");
var import_form = require("@react-stately/form");
var import_react3 = require("react");
function useMultiSelectState({
validate,
validationBehavior,
...props
}) {
const [isFocused, setFocused] = (0, import_react3.useState)(false);
const [focusStrategy, setFocusStrategy] = (0, import_react3.useState)(null);
const triggerState = (0, import_menu2.useMenuTriggerState)(props);
const listState = useMultiSelectListState({
...props,
onSelectionChange: (keys) => {
if (props.onSelectionChange != null) {
if (keys === "all") {
props.onSelectionChange(new Set(listState.collection.getKeys()));
} else {
props.onSelectionChange(keys);
}
}
if (props.selectionMode === "single") {
triggerState.close();
}
}
});
const validationState = (0, import_form.useFormValidationState)({
...props,
validationBehavior,
validate: (value) => {
if (!validate)
return;
const keys = Array.from(value);
return validate(props.selectionMode === "single" ? keys[0] : keys);
},
value: listState.selectedKeys
});
const shouldHideContent = listState.collection.size === 0 && props.hideEmptyContent;
return {
...validationState,
...listState,
...triggerState,
focusStrategy,
close() {
triggerState.close();
},
open(focusStrategy2 = null) {
if (shouldHideContent)
return;
setFocusStrategy(focusStrategy2);
triggerState.open();
},
toggle(focusStrategy2 = null) {
if (shouldHideContent)
return;
setFocusStrategy(focusStrategy2);
triggerState.toggle();
},
isFocused,
setFocused
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
useMultiSelect,
useMultiSelectListState,
useMultiSelectState
});
@@ -0,0 +1 @@
{"name":"buffer-alloc","version":"1.2.0","requiresBuild":false,"files":{"package.json":{"checkedAt":1794532100167,"integrity":"sha512-FFv0p4MEiJJKiPX0L+X8gZeXo7cApEgWUmGpIjf9CRZZgowhfbfw/0RjnLp73WJKmlS2uXzsn+m5CdIdHrD/ew==","mode":420,"size":448},"index.js":{"checkedAt":1794532100167,"integrity":"sha512-1D4ZBfe028zJKHA73nj8iZBdP6UvvaDAraUauP15mKf14T6cDCWZeqnUhAzw5Di9iZ3HkUnMIhBDsE8tOYUpQA==","mode":420,"size":664},"readme.md":{"checkedAt":1794532100167,"integrity":"sha512-CGp8gRfET7XTLWaJNADijKX0H+o/zvOaPBvlubZCde/EtubRtSdlyuHlhNzp4MHfpXSg6Z5zHdxHNVbIwbwPOg==","mode":420,"size":1162}}}
@@ -0,0 +1,16 @@
/*
* Copyright 2022 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
export type {Variables, LocalizedString} from './LocalizedStringFormatter';
export type {LocalizedStrings} from './LocalizedStringDictionary';
export {LocalizedStringDictionary} from './LocalizedStringDictionary';
export {LocalizedStringFormatter} from './LocalizedStringFormatter';
@@ -0,0 +1,8 @@
import { OB11GroupNoticeEvent } from './OB11GroupNoticeEvent';
import { NapCatCore } from '../../../napcat-core';
export declare class OB11GroupTitleEvent extends OB11GroupNoticeEvent {
notice_type: string;
sub_type: string;
title: string;
constructor(core: NapCatCore, groupId: number, userId: number, title: string);
}
@@ -0,0 +1,46 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.isHigherPrecedenceThanAwait = isHigherPrecedenceThanAwait;
const ts = __importStar(require("typescript"));
const getOperatorPrecedence_1 = require("./getOperatorPrecedence");
function isHigherPrecedenceThanAwait(tsNode) {
const operator = ts.isBinaryExpression(tsNode)
? tsNode.operatorToken.kind
: ts.SyntaxKind.Unknown;
const nodePrecedence = (0, getOperatorPrecedence_1.getOperatorPrecedence)(tsNode.kind, operator);
const awaitPrecedence = (0, getOperatorPrecedence_1.getOperatorPrecedence)(ts.SyntaxKind.AwaitExpression, ts.SyntaxKind.Unknown);
return nodePrecedence > awaitPrecedence;
}
@@ -0,0 +1,63 @@
/**
* @fileoverview Utilities to operate on option objects.
* @author Josh Goldberg
*/
"use strict";
/**
* Determines whether any of input's properties are different
* from values that already exist in original.
* @template T
* @param {Partial<T>} input New value.
* @param {T} original Original value.
* @returns {boolean} Whether input includes an explicit difference.
*/
function containsDifferentProperty(input, original) {
if (input === original) {
return false;
}
if (
typeof input !== typeof original ||
Array.isArray(input) !== Array.isArray(original)
) {
return true;
}
if (Array.isArray(input)) {
return (
input.length !== original.length ||
input.some((value, i) =>
containsDifferentProperty(value, original[i]),
)
);
}
if (typeof input === "object") {
if (input === null || original === null) {
return true;
}
const inputKeys = Object.keys(input);
const originalKeys = Object.keys(original);
return (
inputKeys.length !== originalKeys.length ||
inputKeys.some(
inputKey =>
!Object.hasOwn(original, inputKey) ||
containsDifferentProperty(
input[inputKey],
original[inputKey],
),
)
);
}
return true;
}
module.exports = {
containsDifferentProperty,
};
@@ -0,0 +1,36 @@
'use strict'
const fs = require('../fs')
const u = require('universalify').fromPromise
async function utimesMillis (path, atime, mtime) {
// if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
const fd = await fs.open(path, 'r+')
let closeErr = null
try {
await fs.futimes(fd, atime, mtime)
} finally {
try {
await fs.close(fd)
} catch (e) {
closeErr = e
}
}
if (closeErr) {
throw closeErr
}
}
function utimesMillisSync (path, atime, mtime) {
const fd = fs.openSync(path, 'r+')
fs.futimesSync(fd, atime, mtime)
return fs.closeSync(fd)
}
module.exports = {
utimesMillis: u(utimesMillis),
utimesMillisSync
}
@@ -0,0 +1,24 @@
'use strict';
/**
* Stringifies a comment.
*
* Empty comment lines are left empty,
* lines consisting of a single space are replaced by `#`,
* and all other lines are prefixed with a `#`.
*/
const stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');
function indentComment(comment, indent) {
if (/^\n+$/.test(comment))
return comment.substring(1);
return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
}
const lineComment = (str, indent, comment) => str.endsWith('\n')
? indentComment(comment, indent)
: comment.includes('\n')
? '\n' + indentComment(comment, indent)
: (str.endsWith(' ') ? '' : ' ') + comment;
exports.indentComment = indentComment;
exports.lineComment = lineComment;
exports.stringifyComment = stringifyComment;
@@ -0,0 +1,43 @@
# Buffer Alloc
A [ponyfill](https://ponyfill.com) for `Buffer.alloc`.
Works as Node.js: `v7.0.0` <br>
Works on Node.js: `v0.10.0`
## Installation
```sh
npm install --save buffer-alloc
```
## Usage
```js
const alloc = require('buffer-alloc')
console.log(alloc(4))
//=> <Buffer 00 00 00 00>
console.log(alloc(6, 0x41))
//=> <Buffer 41 41 41 41 41 41>
console.log(alloc(10, 'linus', 'utf8'))
//=> <Buffer 6c 69 6e 75 73 6c 69 6e 75 73>
```
## API
### alloc(size[, fill[, encoding]])
- `size` &lt;Integer&gt; The desired length of the new `Buffer`
- `fill` &lt;String&gt; | &lt;Buffer&gt; | &lt;Integer&gt; A value to pre-fill the new `Buffer` with. **Default:** `0`
- `encoding` &lt;String&gt; If `fill` is a string, this is its encoding. **Default:** `'utf8'`
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the `Buffer` will be zero-filled.
## See also
- [buffer-alloc-unsafe](https://github.com/LinusU/buffer-alloc-unsafe) A ponyfill for `Buffer.allocUnsafe`
- [buffer-fill](https://github.com/LinusU/buffer-fill) A ponyfill for `Buffer.fill`
- [buffer-from](https://github.com/LinusU/buffer-from) A ponyfill for `Buffer.from`
@@ -0,0 +1,44 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ, ReferenceTracker } = require("@eslint-community/eslint-utils")
const { getSourceCode } = require("eslint-compat-utils")
module.exports = {
meta: {
docs: {
description: "disallow the `JSON` class.",
category: "ES5",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-json.html",
},
fixable: null,
messages: {
forbidden: "ES5 '{{name}}' class is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"(program) {
const sourceCode = getSourceCode(context)
const tracker = new ReferenceTracker(
sourceCode.getScope(program),
)
for (const { node, path } of tracker.iterateGlobalReferences({
JSON: { [READ]: true },
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}
@@ -0,0 +1,248 @@
import * as tailwind_variants from 'tailwind-variants';
import * as react from 'react';
import { ReactElement } from 'react';
import * as _heroui_system from '@heroui/system';
import { HTMLHeroUIProps, PropGetter } from '@heroui/system';
import { SnippetVariantProps, SlotsToClasses, SnippetSlots } from '@heroui/theme';
import { ReactRef } from '@heroui/react-utils';
import { TooltipProps } from '@heroui/tooltip';
import { ButtonProps } from '@heroui/button';
interface UseSnippetProps extends Omit<HTMLHeroUIProps, "onCopy">, SnippetVariantProps {
/**
* Ref to the DOM node.
*/
ref?: ReactRef<HTMLDivElement | null>;
/**
* The content of the snippet.
* if `string[]` is passed, it will be rendered as a multi-line snippet.
*/
children?: React.ReactNode | string[];
/**
* The symbol to show before the snippet.
* @default "$"
*/
symbol?: string | React.ReactNode;
/**
* The time in milliseconds to wait before resetting the clipboard.
* @default 2000
*/
timeout?: number;
copyIcon?: ReactElement;
checkIcon?: ReactElement;
/**
* Classname or List of classes to change the classNames of the element.
* if `className` is passed, it will be added to the base slot.
*
* @example
* ```ts
* <Snippet classNames={{
* base:"base-classes",
* pre: "pre-classes",
* copyButton: "copy-classes", // copy button classes
* copyIcon: "copy-classes", // copy icon classes
* checkIcon: "check-classes", // check icon classes
* content: "content-classes", // content when is multiline
* symbol: "symbol-classes", // symbol classes
* }} />
* ```
*/
classNames?: SlotsToClasses<SnippetSlots>;
/**
* Whether the copy button should receive focus on render.
* @default false
*/
autoFocus?: boolean;
/**
* The code string to copy. if `codeString` is passed, it will be copied instead of the children.
*/
codeString?: string;
/**
* Whether to hide the tooltip.
* @default false
*/
disableTooltip?: boolean;
/**
* Whether to disable the copy functionality.
* @default false
*/
disableCopy?: boolean;
/**
* Whether to hide the copy button.
* @default false
*/
hideCopyButton?: boolean;
/**
* Whether to hide the symbol.
* @default false
*/
hideSymbol?: boolean;
/**
* Tooltip props.
* @see [Tooltip](https://heroui.com/components/tooltip) for more details.
* @default {
* offset: 15,
* delay: 1000,
* content: "Copy to clipboard",
* color: snippetProps?.color, // same as the snippet color
* isDisabled: disableCopy,
* }
*/
tooltipProps?: Partial<TooltipProps>;
/**
* Copy button props.
* @see [Button](https://heroui.com/components/button) for more details.
* @default {
* isDisabled: disableCopy,
* onPress: onCopy
* size:"sm",
* variant:"light",
* isIconOnly: true,
* }
*/
copyButtonProps?: Partial<ButtonProps>;
/**
* Callback when the text is copied.
*/
onCopy?: (value: string | string[]) => void;
}
declare function useSnippet(originalProps: UseSnippetProps): {
Component: _heroui_system.As<any>;
as: _heroui_system.As<any> | undefined;
domRef: react.RefObject<HTMLDivElement>;
preRef: react.RefObject<HTMLPreElement>;
children: string[] | react.ReactNode;
slots: {
base: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
pre: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
content: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
symbol: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
copyButton: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
copyIcon: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
checkIcon: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
} & {
base: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
pre: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
content: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
symbol: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
copyButton: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
copyIcon: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
checkIcon: (slotProps?: ({
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
disableAnimation?: boolean | undefined;
radius?: "none" | "sm" | "md" | "lg" | undefined;
fullWidth?: boolean | undefined;
variant?: "flat" | "solid" | "shadow" | "bordered" | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
} & {};
classNames: SlotsToClasses<"symbol" | "base" | "pre" | "content" | "copyButton" | "copyIcon" | "checkIcon"> | undefined;
copied: boolean;
onCopy: () => void;
copyIcon: ReactElement<any, string | react.JSXElementConstructor<any>> | undefined;
checkIcon: ReactElement<any, string | react.JSXElementConstructor<any>> | undefined;
symbolBefore: string | number | boolean | ReactElement<any, string | react.JSXElementConstructor<any>> | react.ReactFragment | null;
isMultiLine: boolean | "" | 0 | null | undefined;
isFocusVisible: boolean;
hideCopyButton: boolean;
disableCopy: boolean;
disableTooltip: boolean;
hideSymbol: boolean;
tooltipProps: Partial<TooltipProps>;
getSnippetProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
getCopyButtonProps: () => ButtonProps;
};
type UseSnippetReturn = ReturnType<typeof useSnippet>;
export { UseSnippetProps, UseSnippetReturn, useSnippet };
@@ -0,0 +1,52 @@
import { Extension } from '@codemirror/state';
export { EditorView } from '@codemirror/view';
/**
This is an extension value that just pulls together a number of
extensions that you might want in a basic editor. It is meant as a
convenient helper to quickly set up CodeMirror without installing
and importing a lot of separate packages.
Specifically, it includes...
- [the default command bindings](https://codemirror.net/6/docs/ref/#commands.defaultKeymap)
- [line numbers](https://codemirror.net/6/docs/ref/#view.lineNumbers)
- [special character highlighting](https://codemirror.net/6/docs/ref/#view.highlightSpecialChars)
- [the undo history](https://codemirror.net/6/docs/ref/#commands.history)
- [a fold gutter](https://codemirror.net/6/docs/ref/#language.foldGutter)
- [custom selection drawing](https://codemirror.net/6/docs/ref/#view.drawSelection)
- [drop cursor](https://codemirror.net/6/docs/ref/#view.dropCursor)
- [multiple selections](https://codemirror.net/6/docs/ref/#state.EditorState^allowMultipleSelections)
- [reindentation on input](https://codemirror.net/6/docs/ref/#language.indentOnInput)
- [the default highlight style](https://codemirror.net/6/docs/ref/#language.defaultHighlightStyle) (as fallback)
- [bracket matching](https://codemirror.net/6/docs/ref/#language.bracketMatching)
- [bracket closing](https://codemirror.net/6/docs/ref/#autocomplete.closeBrackets)
- [autocompletion](https://codemirror.net/6/docs/ref/#autocomplete.autocompletion)
- [rectangular selection](https://codemirror.net/6/docs/ref/#view.rectangularSelection) and [crosshair cursor](https://codemirror.net/6/docs/ref/#view.crosshairCursor)
- [active line highlighting](https://codemirror.net/6/docs/ref/#view.highlightActiveLine)
- [active line gutter highlighting](https://codemirror.net/6/docs/ref/#view.highlightActiveLineGutter)
- [selection match highlighting](https://codemirror.net/6/docs/ref/#search.highlightSelectionMatches)
- [search](https://codemirror.net/6/docs/ref/#search.searchKeymap)
- [linting](https://codemirror.net/6/docs/ref/#lint.lintKeymap)
(You'll probably want to add some language package to your setup
too.)
This extension does not allow customization. The idea is that,
once you decide you want to configure your editor more precisely,
you take this package's source (which is just a bunch of imports
and an array literal), copy it into your own code, and adjust it
as desired.
*/
declare const basicSetup: Extension;
/**
A minimal set of extensions to create a functional editor. Only
includes [the default keymap](https://codemirror.net/6/docs/ref/#commands.defaultKeymap), [undo
history](https://codemirror.net/6/docs/ref/#commands.history), [special character
highlighting](https://codemirror.net/6/docs/ref/#view.highlightSpecialChars), [custom selection
drawing](https://codemirror.net/6/docs/ref/#view.drawSelection), and [default highlight
style](https://codemirror.net/6/docs/ref/#language.defaultHighlightStyle).
*/
declare const minimalSetup: Extension;
export { basicSetup, minimalSetup };
@@ -0,0 +1,45 @@
var test = require('tape')
var through = require('../')
// must emit end before close.
test('end before close', function (assert) {
var ts = through()
var ended = false, closed = false
ts.on('end', function () {
assert.ok(!closed)
ended = true
})
ts.on('close', function () {
assert.ok(ended)
closed = true
})
ts.write(1)
ts.write(2)
ts.write(3)
ts.end()
assert.ok(ended)
assert.ok(closed)
assert.end()
})
test('end only once', function (t) {
var ts = through()
var ended = false, closed = false
ts.on('end', function () {
t.equal(ended, false)
ended = true
})
ts.queue(null)
ts.queue(null)
ts.queue(null)
ts.resume()
t.end()
})
@@ -0,0 +1,18 @@
import * as proto from '../../../packet/transformer/proto';
import { OidbPacket, PacketTransformer } from '../../../packet/transformer/base';
declare class DownloadForwardMsg extends PacketTransformer<typeof proto.RecvLongMsgResp> {
build(uid: string, resId: string): OidbPacket;
parse(data: Buffer): import("napcat-protobuf").any {
resId: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
payload: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
}, false, false>;
settings: import("napcat-protobuf").MessageProtoFieldType<() => {
field1: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
field2: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
field3: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
field4: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, false>;
}>;
}
declare const _default: DownloadForwardMsg;
export default _default;
@@ -0,0 +1,29 @@
/*! https://mths.be/repeat v1.0.0 by @mathias */
'use strict';
var RequireObjectCoercible = require('es-abstract/2019/RequireObjectCoercible');
var ToString = require('es-abstract/2019/ToString');
var ToInteger = require('es-abstract/2019/ToInteger');
module.exports = function repeat(count) {
var O = RequireObjectCoercible(this);
var string = ToString(O);
var n = ToInteger(count);
// Account for out-of-bounds indices
if (n < 0 || n == Infinity) {
throw RangeError('String.prototype.repeat argument must be greater than or equal to 0 and not be Infinity');
}
var result = '';
while (n) {
if (n % 2 == 1) {
result += string;
}
if (n > 1) {
string += string;
}
n >>= 1;
}
return result;
};
@@ -0,0 +1,33 @@
var baseRepeat = require('./_baseRepeat'),
baseToString = require('./_baseToString'),
castSlice = require('./_castSlice'),
hasUnicode = require('./_hasUnicode'),
stringSize = require('./_stringSize'),
stringToArray = require('./_stringToArray');
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeCeil = Math.ceil;
/**
* Creates the padding for `string` based on `length`. The `chars` string
* is truncated if the number of characters exceeds `length`.
*
* @private
* @param {number} length The padding length.
* @param {string} [chars=' '] The string used as padding.
* @returns {string} Returns the padding for `string`.
*/
function createPadding(length, chars) {
chars = chars === undefined ? ' ' : baseToString(chars);
var charsLength = chars.length;
if (charsLength < 2) {
return charsLength ? baseRepeat(chars, length) : chars;
}
var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
return hasUnicode(chars)
? castSlice(stringToArray(result), 0, length).join('')
: result.slice(0, length);
}
module.exports = createPadding;
@@ -0,0 +1 @@
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAcD,MAAM,4CAAsB,IAAI,OAAO;AACvC,MAAM,0CAAoB;IAAC;IAAQ;IAAQ;IAAW;IAAQ;IAAQ;CAAW;AAQ1E,MAAM;IASX;;GAEC,GACD,MAAM,KAAa,EAAU;QAC3B,OAAO,0CAAoB,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,KAAK,CAAC;IACrE;IAEA;;;;GAIC,GACD,qBAAqB,KAAa,EAAE,QAAiB,EAAE,QAAiB,EAAW;QACjF,OAAO,0CAAoB,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,oBAAoB,CAAC,OAAO,UAAU;IACrG;IAEA;;;;GAIC,GACD,mBAAmB,KAAa,EAAU;QACxC,OAAO,0CAAoB,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,OAAO,CAAC,eAAe;IACtF;IA5BA,YAAY,MAAc,EAAE,UAAoC,CAAC,CAAC,CAAE;QAClE,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,OAAO,GAAG;IACjB;AA0BF;AAEA,MAAM,0CAAoB,IAAI;AAC9B,SAAS,0CAAoB,MAAc,EAAE,OAAiC,EAAE,KAAa;IAC3F,iEAAiE;IACjE,IAAI,gBAAgB,4CAAsB,QAAQ;IAElD,uFAAuF;IACvF,oFAAoF;IACpF,IAAI,CAAC,OAAO,QAAQ,CAAC,WAAW,CAAC,cAAc,oBAAoB,CAAC,QAAQ;QAC1E,KAAK,IAAI,mBAAmB,wCAC1B,IAAI,oBAAoB,cAAc,OAAO,CAAC,eAAe,EAAE;YAC7D,IAAI,SAAS,4CAAsB,SAAU,CAAA,OAAO,QAAQ,CAAC,SAAS,SAAS,QAAO,IAAK,iBAAiB;YAC5G,IAAI,OAAO,oBAAoB,CAAC,QAC9B,OAAO;QAEX;IAEJ;IAEA,OAAO;AACT;AAEA,SAAS,4CAAsB,MAAc,EAAE,OAAiC;IAC9E,IAAI,WAAW,SAAU,CAAA,UAAU,OAAO,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,IAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,IAAI,KAAK,EAAC;IAC1G,IAAI,SAAS,wCAAkB,GAAG,CAAC;IACnC,IAAI,CAAC,QAAQ;QACX,SAAS,IAAI,uCAAiB,QAAQ;QACtC,wCAAkB,GAAG,CAAC,UAAU;IAClC;IAEA,OAAO;AACT;AAEA,8EAA8E;AAC9E,+DAA+D;AAC/D,MAAM;IA6BJ,MAAM,KAAa,EAAE;QACnB,wIAAwI;QACxI,IAAI,sBAAsB,IAAI,CAAC,QAAQ,CAAC;QAExC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EACpB,sFAAsF;QACtF,sBAAsB,iCAAW,qBAAqB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAE5E,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EACtB,sBAAsB,oBAAoB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAG;QAE3E,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EACxB,sBAAsB,oBAAoB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAG;QAE7E,sBAAsB,oBAAoB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;QAE1F,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,WAAW;YACpC,gIAAgI;YAChI,IAAI,aAAa,oBAAoB,OAAO,CAAC;YAC7C,sBAAsB,oBAAoB,OAAO,CAAC,KAAK;YACvD,sBAAsB,oBAAoB,OAAO,CAAC,KAAK;YACvD,IAAI,QAAQ,oBAAoB,OAAO,CAAC;YACxC,IAAI,UAAU,IACZ,QAAQ,oBAAoB,MAAM;YAEpC,sBAAsB,oBAAoB,OAAO,CAAC,KAAK;YACvD,IAAI,QAAQ,MAAM,GAChB,sBAAsB,CAAC,EAAE,EAAE,qBAAqB;iBAC3C,IAAI,QAAQ,MAAM,IACvB,sBAAsB,CAAC,GAAG,EAAE,qBAAqB;iBAC5C,IAAI,QAAQ,MAAM,IACvB,sBAAsB;iBAEtB,sBAAsB,GAAG,oBAAoB,KAAK,CAAC,GAAG,QAAQ,GAAG,CAAC,EAAE,oBAAoB,KAAK,CAAC,QAAQ,IAAI;YAE5G,IAAI,aAAa,IACf,sBAAsB,CAAC,CAAC,EAAE,qBAAqB;QAEnD;QAEA,IAAI,WAAW,sBAAsB,CAAC,sBAAsB;QAC5D,IAAI,MAAM,WACR,OAAO;QAGT,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,WAAW;gBAKD,qCACA;YALnC,sEAAsE;YACtE,IAAI,UAAU;gBACZ,GAAG,IAAI,CAAC,OAAO;gBACf,OAAO;gBACP,uBAAuB,KAAK,GAAG,CAAC,AAAC,CAAA,CAAA,sCAAA,IAAI,CAAC,OAAO,CAAC,qBAAqB,cAAlC,iDAAA,sCAAsC,CAAA,IAAK,GAAG;gBAC/E,uBAAuB,KAAK,GAAG,CAAC,AAAC,CAAA,CAAA,sCAAA,IAAI,CAAC,OAAO,CAAC,qBAAqB,cAAlC,iDAAA,sCAAsC,CAAA,IAAK,GAAG;YACjF;YACA,OAAO,AAAC,IAAI,0CAAa,IAAI,CAAC,MAAM,EAAE,SAAU,KAAK,CAAC,IAAI,CAAA,GAAA,yCAAc,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,MAAM,CAAC;QACzG;QAEA,wJAAwJ;QACxJ,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,KAAK,gBAAgB,0CAAoB,IAAI,CAAC,QACzE,WAAW,KAAK;QAGlB,OAAO;IACT;IAEA,SAAS,KAAa,EAAE;QACtB,2EAA2E;QAC3E,QAAQ,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QAE7C,8EAA8E;QAC9E,6FAA6F;QAC7F,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EACxB,QAAQ,MAAM,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,SAAS;QAGnD,8FAA8F;QAC9F,4EAA4E;QAC5E,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,KAAK,QAAQ;YAC3C,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;gBACxB,QAAQ,MAAM,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,OAAO;gBAC/C,QAAQ,MAAM,OAAO,CAAC,OAAO,YAAY,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO;YACvE;YACA,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EACpB,QAAQ,iCAAW,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK;QAErD;QAEA,mGAAmG;QACnG,8GAA8G;QAC9G,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,YAAO,MAAM,QAAQ,CAAC,MAC/C,QAAQ,iCAAW,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK;QAGnD,4HAA4H;QAC5H,gEAAgE;QAChE,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YACzD,QAAQ,iCAAW,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK;YACjD,QAAQ,iCAAW,OAAO,WAAW,IAAI,CAAC,OAAO,CAAC,KAAK;QACzD;QAEA,OAAO;IACT;IAEA,qBAAqB,KAAa,EAAE,WAAmB,CAAC,QAAQ,EAAE,WAAmB,QAAQ,EAAW;QACtG,QAAQ,IAAI,CAAC,QAAQ,CAAC;QAEtB,uEAAuE;QACvE,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,KAAK,WAAW,GACnF,QAAQ,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM;aAC5C,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,WAAW,GACxF,QAAQ,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM;QAGlD,8CAA8C;QAC9C,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,MAAM,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,GAC3D,OAAO;QAGT,kFAAkF;QAClF,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,MAAM,IAAI,CAAC,OAAO,CAAC,qBAAqB,KAAK,GAC7G,OAAO;QAGT,wCAAwC;QACxC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EACpB,QAAQ,iCAAW,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;QAEhD,QAAQ,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QAC5C,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EACtB,QAAQ,MAAM,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE;QAG9C,2DAA2D;QAC3D,OAAO,MAAM,MAAM,KAAK;IAC1B;IA5JA,YAAY,MAAc,EAAE,UAAoC,CAAC,CAAC,CAAE;QAClE,IAAI,CAAC,MAAM,GAAG;QACd,sJAAsJ;QACtJ,oFAAoF;QACpF,IAAI,QAAQ,iBAAiB,KAAK,KALine truncated
@@ -0,0 +1,4 @@
'use strict'
var colorSupport = require('color-support')
module.exports = colorSupport().hasBasic
@@ -0,0 +1,11 @@
import type { TSchema, SchemaOptions } from '../schema/index';
import type { Static } from '../static/index';
import { Kind } from '../symbols/index';
export interface TPromise<T extends TSchema = TSchema> extends TSchema {
[Kind]: 'Promise';
static: Promise<Static<T, this['params']>>;
type: 'Promise';
item: TSchema;
}
/** `[JavaScript]` Creates a Promise type */
export declare function Promise<T extends TSchema>(item: T, options?: SchemaOptions): TPromise<T>;
@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _jsxAstUtils = require("jsx-ast-utils");
/**
* Returns boolean indicating whether the given element has been specified with
* an AST node with a non-literal type.
*
* Returns true if the elements has a role and its value is not of a type Literal.
* Otherwise returns false.
*/
var isNonLiteralProperty = function isNonLiteralProperty(attributes, propName) {
var prop = (0, _jsxAstUtils.getProp)(attributes, propName);
if (!prop) return false;
var propValue = prop.value;
if (!propValue) return false;
if (propValue.type === 'Literal') return false;
if (propValue.type === 'JSXExpressionContainer') {
var expression = propValue.expression;
if (expression.type === 'Identifier' && expression.name === 'undefined') return false;
if (expression.type === 'JSXText') return false;
}
return true;
};
var _default = exports["default"] = isNonLiteralProperty;
module.exports = exports.default;
@@ -0,0 +1,13 @@
/**
* Copyright (c) 2021 The xterm.js authors. All rights reserved.
* @license MIT
*/
import { IBufferRange } from '@xterm/xterm';
export function getRangeLength(range: IBufferRange, bufferCols: number): number {
if (range.start.y > range.end.y) {
throw new Error(`Buffer range end (${range.end.x}, ${range.end.y}) cannot be before start (${range.start.x}, ${range.start.y})`);
}
return bufferCols * (range.end.y - range.start.y) + (range.end.x - range.start.x + 1);
}
@@ -0,0 +1,39 @@
const pxValues = new Set([
// Border props
"borderWidth",
"borderTopWidth",
"borderRightWidth",
"borderBottomWidth",
"borderLeftWidth",
"borderRadius",
"radius",
"borderTopLeftRadius",
"borderTopRightRadius",
"borderBottomRightRadius",
"borderBottomLeftRadius",
// Positioning props
"width",
"maxWidth",
"height",
"maxHeight",
"top",
"right",
"bottom",
"left",
// Spacing props
"padding",
"paddingTop",
"paddingRight",
"paddingBottom",
"paddingLeft",
"margin",
"marginTop",
"marginRight",
"marginBottom",
"marginLeft",
// Misc
"backgroundPositionX",
"backgroundPositionY",
]);
export { pxValues };
@@ -0,0 +1,13 @@
import { RefObject } from 'react';
/**
* Used to handle the outside interaction for popover-based components
* e.g. dropdown, datepicker, date-range-picker, popover, select, autocomplete etc
* @param element - the element outside of the popover ref, originally from `shouldCloseOnInteractOutside`
* @param triggerRef - The trigger ref object
* @param state - The state from the popover component
* @returns - a boolean value which is same as shouldCloseOnInteractOutside
*/
declare const ariaShouldCloseOnInteractOutside: (element: Element, triggerRef: RefObject<Element>, state: any) => boolean;
export { ariaShouldCloseOnInteractOutside };
@@ -0,0 +1,110 @@
// @ts-ignore TS6133
import { expect, test } from "vitest";
import * as z from "zod/v3";
import { ZodIssueCode } from "zod/v3";
import { util } from "../helpers/util.js";
const stringMap = z.map(z.string(), z.string());
type stringMap = z.infer<typeof stringMap>;
test("type inference", () => {
util.assertEqual<stringMap, Map<string, string>>(true);
});
test("valid parse", () => {
const result = stringMap.safeParse(
new Map([
["first", "foo"],
["second", "bar"],
])
);
expect(result.success).toEqual(true);
if (result.success) {
expect(result.data.has("first")).toEqual(true);
expect(result.data.has("second")).toEqual(true);
expect(result.data.get("first")).toEqual("foo");
expect(result.data.get("second")).toEqual("bar");
}
});
test("valid parse async", async () => {
const result = await stringMap.spa(
new Map([
["first", "foo"],
["second", "bar"],
])
);
expect(result.success).toEqual(true);
if (result.success) {
expect(result.data.has("first")).toEqual(true);
expect(result.data.has("second")).toEqual(true);
expect(result.data.get("first")).toEqual("foo");
expect(result.data.get("second")).toEqual("bar");
}
});
test("throws when a Set is given", () => {
const result = stringMap.safeParse(new Set([]));
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(1);
expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type);
}
});
test("throws when the given map has invalid key and invalid input", () => {
const result = stringMap.safeParse(new Map([[42, Symbol()]]));
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(2);
expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type);
expect(result.error.issues[0].path).toEqual([0, "key"]);
expect(result.error.issues[1].code).toEqual(ZodIssueCode.invalid_type);
expect(result.error.issues[1].path).toEqual([0, "value"]);
}
});
test("throws when the given map has multiple invalid entries", () => {
// const result = stringMap.safeParse(new Map([[42, Symbol()]]));
const result = stringMap.safeParse(
new Map([
[1, "foo"],
["bar", 2],
] as [any, any][]) as Map<any, any>
);
// const result = stringMap.safeParse(new Map([[42, Symbol()]]));
expect(result.success).toEqual(false);
if (result.success === false) {
expect(result.error.issues.length).toEqual(2);
expect(result.error.issues[0].code).toEqual(ZodIssueCode.invalid_type);
expect(result.error.issues[0].path).toEqual([0, "key"]);
expect(result.error.issues[1].code).toEqual(ZodIssueCode.invalid_type);
expect(result.error.issues[1].path).toEqual([1, "value"]);
}
});
test("dirty", async () => {
const map = z.map(
z.string().refine((val) => val === val.toUpperCase(), {
message: "Keys must be uppercase",
}),
z.string()
);
const result = await map.spa(
new Map([
["first", "foo"],
["second", "bar"],
])
);
expect(result.success).toEqual(false);
if (!result.success) {
expect(result.error.issues.length).toEqual(2);
expect(result.error.issues[0].code).toEqual(z.ZodIssueCode.custom);
expect(result.error.issues[0].message).toEqual("Keys must be uppercase");
expect(result.error.issues[1].code).toEqual(z.ZodIssueCode.custom);
expect(result.error.issues[1].message).toEqual("Keys must be uppercase");
}
});
@@ -0,0 +1,111 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Partial = Partial;
const type_1 = require("../create/type");
const index_1 = require("../computed/index");
const index_2 = require("../optional/index");
const index_3 = require("../object/index");
const index_4 = require("../intersect/index");
const index_5 = require("../union/index");
const index_6 = require("../ref/index");
const index_7 = require("../discard/index");
const index_8 = require("../symbols/index");
const partial_from_mapped_result_1 = require("./partial-from-mapped-result");
// ------------------------------------------------------------------
// KindGuard
// ------------------------------------------------------------------
const KindGuard = __importStar(require("../guard/kind"));
// prettier-ignore
function FromComputed(target, parameters) {
return (0, index_1.Computed)('Partial', [(0, index_1.Computed)(target, parameters)]);
}
// prettier-ignore
function FromRef($ref) {
return (0, index_1.Computed)('Partial', [(0, index_6.Ref)($ref)]);
}
// prettier-ignore
function FromProperties(properties) {
const partialProperties = {};
for (const K of globalThis.Object.getOwnPropertyNames(properties))
partialProperties[K] = (0, index_2.Optional)(properties[K]);
return partialProperties;
}
// prettier-ignore
function FromObject(type, properties) {
const options = (0, index_7.Discard)(type, [index_8.TransformKind, '$id', 'required', 'properties']);
const mappedProperties = FromProperties(properties);
return (0, index_3.Object)(mappedProperties, options);
}
// prettier-ignore
function FromRest(types) {
return types.map(type => PartialResolve(type));
}
// ------------------------------------------------------------------
// PartialResolve
// ------------------------------------------------------------------
// prettier-ignore
function PartialResolve(type) {
return (
// Mappable
KindGuard.IsComputed(type) ? FromComputed(type.target, type.parameters) :
KindGuard.IsRef(type) ? FromRef(type.$ref) :
KindGuard.IsIntersect(type) ? (0, index_4.Intersect)(FromRest(type.allOf)) :
KindGuard.IsUnion(type) ? (0, index_5.Union)(FromRest(type.anyOf)) :
KindGuard.IsObject(type) ? FromObject(type, type.properties) :
// Intrinsic
KindGuard.IsBigInt(type) ? type :
KindGuard.IsBoolean(type) ? type :
KindGuard.IsInteger(type) ? type :
KindGuard.IsLiteral(type) ? type :
KindGuard.IsNull(type) ? type :
KindGuard.IsNumber(type) ? type :
KindGuard.IsString(type) ? type :
KindGuard.IsSymbol(type) ? type :
KindGuard.IsUndefined(type) ? type :
// Passthrough
(0, index_3.Object)({}));
}
/** `[Json]` Constructs a type where all properties are optional */
function Partial(type, options) {
if (KindGuard.IsMappedResult(type)) {
return (0, partial_from_mapped_result_1.PartialFromMappedResult)(type, options);
}
else {
// special: mapping types require overridable options
return (0, type_1.CreateType)({ ...PartialResolve(type), ...options });
}
}
@@ -0,0 +1,12 @@
import { OneBotAction } from '../OneBotAction';
export declare class SetRestart extends OneBotAction<void, void> {
actionName: "set_restart";
payloadSchema: import("@sinclair/typebox").TObject<{}>;
returnSchema: import("@sinclair/typebox").TNull;
actionSummary: string;
actionDescription: string;
actionTags: string[];
payloadExample: {};
returnExample: null;
_handle(): Promise<void>;
}
@@ -0,0 +1,18 @@
import { MappedResult } from '../mapped/index.mjs';
import { Readonly } from './readonly.mjs';
// prettier-ignore
function FromProperties(K, F) {
const Acc = {};
for (const K2 of globalThis.Object.getOwnPropertyNames(K))
Acc[K2] = Readonly(K[K2], F);
return Acc;
}
// prettier-ignore
function FromMappedResult(R, F) {
return FromProperties(R.properties, F);
}
// prettier-ignore
export function ReadonlyFromMappedResult(R, F) {
const P = FromMappedResult(R, F);
return MappedResult(P);
}
@@ -0,0 +1,154 @@
# clsx [![CI](https://github.com/lukeed/clsx/workflows/CI/badge.svg)](https://github.com/lukeed/clsx/actions?query=workflow%3ACI) [![codecov](https://badgen.net/codecov/c/github/lukeed/clsx)](https://codecov.io/gh/lukeed/clsx) [![licenses](https://licenses.dev/b/npm/clsx)](https://licenses.dev/npm/clsx)
> A tiny (239B) utility for constructing `className` strings conditionally.<Br>Also serves as a [faster](bench) & smaller drop-in replacement for the `classnames` module.
This module is available in three formats:
* **ES Module**: `dist/clsx.mjs`
* **CommonJS**: `dist/clsx.js`
* **UMD**: `dist/clsx.min.js`
## Install
```
$ npm install --save clsx
```
## Usage
```js
import clsx from 'clsx';
// or
import { clsx } from 'clsx';
// Strings (variadic)
clsx('foo', true && 'bar', 'baz');
//=> 'foo bar baz'
// Objects
clsx({ foo:true, bar:false, baz:isTrue() });
//=> 'foo baz'
// Objects (variadic)
clsx({ foo:true }, { bar:false }, null, { '--foobar':'hello' });
//=> 'foo --foobar'
// Arrays
clsx(['foo', 0, false, 'bar']);
//=> 'foo bar'
// Arrays (variadic)
clsx(['foo'], ['', 0, false, 'bar'], [['baz', [['hello'], 'there']]]);
//=> 'foo bar baz hello there'
// Kitchen sink (with nesting)
clsx('foo', [1 && 'bar', { baz:false, bat:null }, ['hello', ['world']]], 'cya');
//=> 'foo bar hello world cya'
```
## API
### clsx(...input)
Returns: `String`
#### input
Type: `Mixed`
The `clsx` function can take ***any*** number of arguments, each of which can be an Object, Array, Boolean, or String.
> **Important:** _Any_ falsey values are discarded!<br>Standalone Boolean values are discarded as well.
```js
clsx(true, false, '', null, undefined, 0, NaN);
//=> ''
```
## Modes
There are multiple "versions" of `clsx` available, which allows you to bring only the functionality you need!
#### `clsx`
> **Size (gzip):** 239 bytes<br>
> **Availability:** CommonJS, ES Module, UMD
The default `clsx` module; see [API](#API) for info.
```js
import { clsx } from 'clsx';
// or
import clsx from 'clsx';
```
#### `clsx/lite`
> **Size (gzip):** 140 bytes<br>
> **Availability:** CommonJS, ES Module<br>
> **CAUTION:** Accepts **ONLY** string arguments!
Ideal for applications that ***only*** use the string-builder pattern.
Any non-string arguments are ignored!
```js
import { clsx } from 'clsx/lite';
// or
import clsx from 'clsx/lite';
// string
clsx('hello', true && 'foo', false && 'bar');
// => "hello foo"
// NOTE: Any non-string input(s) ignored
clsx({ foo: true });
//=> ""
```
## Benchmarks
For snapshots of cross-browser results, check out the [`bench`](bench) directory~!
## Support
All versions of Node.js are supported.
All browsers that support [`Array.isArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray#Browser_compatibility) are supported (IE9+).
>**Note:** For IE8 support and older, please install `clsx@1.0.x` and beware of [#17](https://github.com/lukeed/clsx/issues/17).
## Tailwind Support
Here some additional (optional) steps to enable classes autocompletion using `clsx` with Tailwind CSS.
<details>
<summary>
Visual Studio Code
</summary>
1. [Install the "Tailwind CSS IntelliSense" Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)
2. Add the following to your [`settings.json`](https://code.visualstudio.com/docs/getstarted/settings):
```json
{
"tailwindCSS.experimental.classRegex": [
["clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
]
}
```
</details>
You may find the [`clsx/lite`](#clsxlite) module useful within Tailwind contexts. This is especially true if/when your application **only** composes classes in this pattern:
```js
clsx('text-base', props.active && 'text-primary', props.className);
```
## Related
- [obj-str](https://github.com/lukeed/obj-str) - A smaller (96B) and similiar utility that only works with Objects.
## License
MIT © [Luke Edwards](https://lukeed.com)
@@ -0,0 +1,69 @@
import {useState as $3whtM$useState, useRef as $3whtM$useRef, useEffect as $3whtM$useEffect, useCallback as $3whtM$useCallback} from "react";
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
let [stateValue, setStateValue] = (0, $3whtM$useState)(value || defaultValue);
let isControlledRef = (0, $3whtM$useRef)(value !== undefined);
let isControlled = value !== undefined;
(0, $3whtM$useEffect)(()=>{
let wasControlled = isControlledRef.current;
if (wasControlled !== isControlled) console.warn(`WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`);
isControlledRef.current = isControlled;
}, [
isControlled
]);
let currentValue = isControlled ? value : stateValue;
let setValue = (0, $3whtM$useCallback)((value, ...args)=>{
let onChangeCaller = (value, ...onChangeArgs)=>{
if (onChange) {
if (!Object.is(currentValue, value)) onChange(value, ...onChangeArgs);
}
if (!isControlled) // If uncontrolled, mutate the currentValue local variable so that
// calling setState multiple times with the same value only emits onChange once.
// We do not use a ref for this because we specifically _do_ want the value to
// reset every render, and assigning to a ref in render breaks aborted suspended renders.
// eslint-disable-next-line react-hooks/exhaustive-deps
currentValue = value;
};
if (typeof value === 'function') {
console.warn('We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320');
// this supports functional updates https://reactjs.org/docs/hooks-reference.html#functional-updates
// when someone using useControlledState calls setControlledState(myFunc)
// this will call our useState setState with a function as well which invokes myFunc and calls onChange with the value from myFunc
// if we're in an uncontrolled state, then we also return the value of myFunc which to setState looks as though it was just called with myFunc from the beginning
// otherwise we just return the controlled value, which won't cause a rerender because React knows to bail out when the value is the same
let updateFunction = (oldValue, ...functionArgs)=>{
let interceptedValue = value(isControlled ? currentValue : oldValue, ...functionArgs);
onChangeCaller(interceptedValue, ...args);
if (!isControlled) return interceptedValue;
return oldValue;
};
setStateValue(updateFunction);
} else {
if (!isControlled) setStateValue(value);
onChangeCaller(value, ...args);
}
}, [
isControlled,
currentValue,
onChange
]);
return [
currentValue,
setValue
];
}
export {$458b0a5536c1a7cf$export$40bfa8c7b0832715 as useControlledState};
//# sourceMappingURL=useControlledState.module.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC;AAC5B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC"}
@@ -0,0 +1,492 @@
// Copyright 2010 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Entropy encoding (Huffman) utilities.
#include "./entropy_encode.h"
#include <stdint.h>
#include <algorithm>
#include <limits>
#include <vector>
#include <cstdlib>
#include "./histogram.h"
namespace brotli {
namespace {
struct HuffmanTree {
HuffmanTree();
HuffmanTree(int count, int16_t left, int16_t right)
: total_count_(count),
index_left_(left),
index_right_or_value_(right) {
}
int total_count_;
int16_t index_left_;
int16_t index_right_or_value_;
};
HuffmanTree::HuffmanTree() {}
// Sort the root nodes, least popular first.
bool SortHuffmanTree(const HuffmanTree &v0, const HuffmanTree &v1) {
return v0.total_count_ < v1.total_count_;
}
void SetDepth(const HuffmanTree &p,
HuffmanTree *pool,
uint8_t *depth,
int level) {
if (p.index_left_ >= 0) {
++level;
SetDepth(pool[p.index_left_], pool, depth, level);
SetDepth(pool[p.index_right_or_value_], pool, depth, level);
} else {
depth[p.index_right_or_value_] = level;
}
}
} // namespace
// This function will create a Huffman tree.
//
// The catch here is that the tree cannot be arbitrarily deep.
// Brotli specifies a maximum depth of 15 bits for "code trees"
// and 7 bits for "code length code trees."
//
// count_limit is the value that is to be faked as the minimum value
// and this minimum value is raised until the tree matches the
// maximum length requirement.
//
// This algorithm is not of excellent performance for very long data blocks,
// especially when population counts are longer than 2**tree_limit, but
// we are not planning to use this with extremely long blocks.
//
// See http://en.wikipedia.org/wiki/Huffman_coding
void CreateHuffmanTree(const int *data,
const int length,
const int tree_limit,
uint8_t *depth) {
// For block sizes below 64 kB, we never need to do a second iteration
// of this loop. Probably all of our block sizes will be smaller than
// that, so this loop is mostly of academic interest. If we actually
// would need this, we would be better off with the Katajainen algorithm.
for (int count_limit = 1; ; count_limit *= 2) {
std::vector<HuffmanTree> tree;
tree.reserve(2 * length + 1);
for (int i = length - 1; i >= 0; --i) {
if (data[i]) {
const int count = std::max(data[i], count_limit);
tree.push_back(HuffmanTree(count, -1, i));
}
}
const int n = tree.size();
if (n == 1) {
depth[tree[0].index_right_or_value_] = 1; // Only one element.
break;
}
std::stable_sort(tree.begin(), tree.end(), SortHuffmanTree);
// The nodes are:
// [0, n): the sorted leaf nodes that we start with.
// [n]: we add a sentinel here.
// [n + 1, 2n): new parent nodes are added here, starting from
// (n+1). These are naturally in ascending order.
// [2n]: we add a sentinel at the end as well.
// There will be (2n+1) elements at the end.
const HuffmanTree sentinel(std::numeric_limits<int>::max(), -1, -1);
tree.push_back(sentinel);
tree.push_back(sentinel);
int i = 0; // Points to the next leaf node.
int j = n + 1; // Points to the next non-leaf node.
for (int k = n - 1; k > 0; --k) {
int left, right;
if (tree[i].total_count_ <= tree[j].total_count_) {
left = i;
++i;
} else {
left = j;
++j;
}
if (tree[i].total_count_ <= tree[j].total_count_) {
right = i;
++i;
} else {
right = j;
++j;
}
// The sentinel node becomes the parent node.
int j_end = tree.size() - 1;
tree[j_end].total_count_ =
tree[left].total_count_ + tree[right].total_count_;
tree[j_end].index_left_ = left;
tree[j_end].index_right_or_value_ = right;
// Add back the last sentinel node.
tree.push_back(sentinel);
}
SetDepth(tree[2 * n - 1], &tree[0], depth, 0);
// We need to pack the Huffman tree in tree_limit bits.
// If this was not successful, add fake entities to the lowest values
// and retry.
if (*std::max_element(&depth[0], &depth[length]) <= tree_limit) {
break;
}
}
}
void Reverse(std::vector<uint8_t>* v, int start, int end) {
--end;
while (start < end) {
int tmp = (*v)[start];
(*v)[start] = (*v)[end];
(*v)[end] = tmp;
++start;
--end;
}
}
void WriteHuffmanTreeRepetitions(
const int previous_value,
const int value,
int repetitions,
std::vector<uint8_t> *tree,
std::vector<uint8_t> *extra_bits_data) {
if (previous_value != value) {
tree->push_back(value);
extra_bits_data->push_back(0);
--repetitions;
}
if (repetitions == 7) {
tree->push_back(value);
extra_bits_data->push_back(0);
--repetitions;
}
if (repetitions < 3) {
for (int i = 0; i < repetitions; ++i) {
tree->push_back(value);
extra_bits_data->push_back(0);
}
} else {
repetitions -= 3;
int start = tree->size();
while (repetitions >= 0) {
tree->push_back(16);
extra_bits_data->push_back(repetitions & 0x3);
repetitions >>= 2;
--repetitions;
}
Reverse(tree, start, tree->size());
Reverse(extra_bits_data, start, tree->size());
}
}
void WriteHuffmanTreeRepetitionsZeros(
int repetitions,
std::vector<uint8_t> *tree,
std::vector<uint8_t> *extra_bits_data) {
if (repetitions == 11) {
tree->push_back(0);
extra_bits_data->push_back(0);
--repetitions;
}
if (repetitions < 3) {
for (int i = 0; i < repetitions; ++i) {
tree->push_back(0);
extra_bits_data->push_back(0);
}
} else {
repetitions -= 3;
int start = tree->size();
while (repetitions >= 0) {
tree->push_back(17);
extra_bits_data->push_back(repetitions & 0x7);
repetitions >>= 3;
--repetitions;
}
Reverse(tree, start, tree->size());
Reverse(extra_bits_data, start, tree->size());
}
}
int OptimizeHuffmanCountsForRle(int length, int* counts) {
int nonzero_count = 0;
int stride;
int limit;
int sum;
uint8_t* good_for_rle;
// Let's make the Huffman code more compatible with rle encoding.
int i;
for (i = 0; i < length; i++) {
if (counts[i]) {
++nonzero_count;
}
}
if (nonzero_count < 16) {
return 1;
}
for (; length >= 0; --length) {
if (length == 0) {
return 1; // All zeros.
}
if (counts[length - 1] != 0) {
// Now counts[0..length - 1] does not have trailing zeros.
break;
}
}
{
int nonzeros = 0;
int smallest_nonzero = 1 << 30;
for (i = 0; i < length; ++i) {
if (counts[i] != 0) {
++nonzeros;
if (smallest_nonzero > counts[i]) {
smallest_nonzero = counts[i];
}
}
}
if (nonzeros < 5) {
// Small histogram will model it well.
return 1;
}
int zeros = length - nonzeros;
if (smallest_nonzero < 4) {
if (zeros < 6) {
for (i = 1; i < length - 1; ++i) {
if (counts[i - 1] != 0 && counts[i] == 0 && counts[i + 1] != 0) {
counts[i] = 1;
}
}
}
}
if (nonzeros < 28) {
return 1;
}
}
// 2) Let's mark all population counts that already can be encoded
// with an rle code.
good_for_rle = (uint8_t*)calloc(length, 1);
if (good_for_rle == NULL) {
return 0;
}
{
// Let's not spoil any of the existing good rle codes.
// Mark any seq of 0's that is longer as 5 as a good_for_rle.
// Mark any seq of non-0's that is longer as 7 as a good_for_rle.
int symbol = counts[0];
int stride = 0;
for (i = 0; i < length + 1; ++i) {
if (i == length || counts[i] != symbol) {
if ((symbol == 0 && stride >= 5) ||
(symbol != 0 && stride >= 7)) {
int k;
for (k = 0; k < stride; ++k) {
good_for_rle[i - k - 1] = 1;
}
}
stride = 1;
if (i != length) {
symbol = counts[i];
}
} else {
++stride;
}
}
}
// 3) Let's replace those population counts that lead to more rle codes.
// Math here is in 24.8 fixed point representation.
const int streak_limit = 1240;
stride = 0;
limit = 256 * (counts[0] + counts[1] + counts[2]) / 3 + 420;
sum = 0;
for (i = 0; i < length + 1; ++i) {
if (i == length || good_for_rle[i] ||
(i != 0 && good_for_rle[i - 1]) ||
abs(256 * counts[i] - limit) >= streak_limit) {
if (stride >= 4 || (stride >= 3 && sum == 0)) {
int k;
// The stride must end, collapse what we have, if we have enough (4).
int count = (sum + stride / 2) / stride;
if (count < 1) {
count = 1;
}
if (sum == 0) {
// Don't make an all zeros stride to be upgraded to ones.
count = 0;
}
for (k = 0; k < stride; ++k) {
// We don't want to change value at counts[i],
// that is already belonging to the next stride. Thus - 1.
counts[i - k - 1] = count;
}
}
stride = 0;
sum = 0;
if (i < length - 2) {
// All interesting strides have a count of at least 4,
// at least when non-zeros.
limit = 256 * (counts[i] + counts[i + 1] + counts[i + 2]) / 3 + 420;
} else if (i < length) {
limit = 256 * counts[i];
} else {
limit = 0;
}
}
++stride;
if (i != length) {
sum += counts[i];
if (stride >= 4) {
limit = (256 * sum + stride / 2) / stride;
}
if (stride == 4) {
limit += 120;
}
}
}
free(good_for_rle);
return 1;
}
static void DecideOverRleUse(const uint8_t* depth, const int length,
bool *use_rle_for_non_zero,
bool *use_rle_for_zero) {
int total_reps_zero = 0;
int total_reps_non_zero = 0;
int count_reps_zero = 0;
int count_reps_non_zero = 0;
for (uint32_t i = 0; i < length;) {
const int value = depth[i];
int reps = 1;
for (uint32_t k = i + 1; k < length && depth[k] == value; ++k) {
++reps;
}
if (reps >= 3 && value == 0) {
total_reps_zero += reps;
++count_reps_zero;
}
if (reps >= 4 && value != 0) {
total_reps_non_zero += reps;
++count_reps_non_zero;
}
i += reps;
}
total_reps_non_zero -= count_reps_non_zero * 2;
total_reps_zero -= count_reps_zero * 2;
*use_rle_for_non_zero = total_reps_non_zero > 2;
*use_rle_for_zero = total_reps_zero > 2;
}
void WriteHuffmanTree(const uint8_t* depth,
uint32_t length,
std::vector<uint8_t> *tree,
std::vector<uint8_t> *extra_bits_data) {
int previous_value = 8;
// Throw away trailing zeros.
int new_length = length;
for (int i = 0; i < length; ++i) {
if (depth[length - i - 1] == 0) {
--new_length;
} else {
break;
}
}
// First gather statistics on if it is a good idea to do rle.
bool use_rle_for_non_zero = false;
bool use_rle_for_zero = false;
if (length > 50) {
// Find rle coding for longer codes.
// Shorter codes seem not to benefit from rle.
DecideOverRleUse(depth, new_length,
&use_rle_for_non_zero, &use_rle_for_zero);
}
// Actual rle coding.
for (uint32_t i = 0; i < new_length;) {
const int value = depth[i];
int reps = 1;
if ((value != 0 && use_rle_for_non_zero) ||
(value == 0 && use_rle_for_zero)) {
for (uint32_t k = i + 1; k < new_length && depth[k] == value; ++k) {
++reps;
}
}
if (value == 0) {
WriteHuffmanTreeRepetitionsZeros(reps, tree, extra_bits_data);
} else {
WriteHuffmanTreeRepetitions(previous_value,
value, reps, tree, extra_bits_data);
previous_value = value;
}
i += reps;
}
}
namespace {
uint16_t ReverseBits(int num_bits, uint16_t bits) {
static const size_t kLut[16] = { // Pre-reversed 4-bit values.
0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe,
0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf
};
size_t retval = kLut[bits & 0xf];
for (int i = 4; i < num_bits; i += 4) {
retval <<= 4;
bits >>= 4;
retval |= kLut[bits & 0xf];
}
retval >>= (-num_bits & 0x3);
return retval;
}
} // namespace
void ConvertBitDepthsToSymbols(const uint8_t *depth, int len, uint16_t *bits) {
// In Brotli, all bit depths are [1..15]
// 0 bit depth means that the symbol does not exist.
const int kMaxBits = 16; // 0..15 are values for bits
uint16_t bl_count[kMaxBits] = { 0 };
{
for (int i = 0; i < len; ++i) {
++bl_count[depth[i]];
}
bl_count[0] = 0;
}
uint16_t next_code[kMaxBits];
next_code[0] = 0;
{
int code = 0;
for (int bits = 1; bits < kMaxBits; ++bits) {
code = (code + bl_count[bits - 1]) << 1;
next_code[bits] = code;
}
}
for (int i = 0; i < len; ++i) {
if (depth[i]) {
bits[i] = ReverseBits(depth[i], next_code[depth[i]]++);
}
}
}
} // namespace brotli
@@ -0,0 +1 @@
{"version":3,"file":"ResolvedValueInjectOptions.js","sourceRoot":"","sources":["../../../../src/binding/models/ResolvedValueInjectOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
{"mappings":"AAAA,iBAAiB;IAAG,aAAa,CAAC,QAAQ,CAAC;IACzC,iBAAiB,CAAC,OAAS,CAAC,uBAAuB,EAAE,KAAK,UAAU,CAAC,4BAAsB,CAAC;IAC5F,cAAc,CAAC,OAAS,GAAG,KAAK,KAAK,CAAC,OAAO,CAAC;IAC9C,cAAc,CAAC,QAAQ,CAAC;IACxB,kBAAkB,CAAC,OAAS,CAAC,uBAAuB,EAAE,KAAK,UAAU,CAAC,4BAAsB,CAAC;IAC7F,sBAAsB,CAAC,6CAAoC,CAAC;IAC5D,UAAU,CAAC,OAAI,CAAC;IAChB,aAAa,CAAC,YAAS,CAAC;IACxB,YAAY,CAAC,iBAAiB,CAAC;AACjC","sources":["packages/@react-aria/table/intl/da-DK.json"],"sourcesContent":["{\n \"ascending\": \"stigende\",\n \"ascendingSort\": \"sorteret efter kolonne {columnName} i stigende rækkefølge\",\n \"columnSize\": \"{value} pixels\",\n \"descending\": \"faldende\",\n \"descendingSort\": \"sorteret efter kolonne {columnName} i faldende rækkefølge\",\n \"resizerDescription\": \"Tryk på Enter for at ændre størrelse\",\n \"select\": \"Vælg\",\n \"selectAll\": \"Vælg alle\",\n \"sortable\": \"sorterbar kolonne\"\n}\n"],"names":[],"version":3,"file":"da-DK.main.js.map"}
@@ -0,0 +1 @@
{"version":3,"names":["b","require","_deprecationWarning","alias","lowercase","ArrayExpression","exports","AssignmentExpression","BinaryExpression","InterpreterDirective","Directive","DirectiveLiteral","BlockStatement","BreakStatement","CallExpression","CatchClause","ConditionalExpression","ContinueStatement","DebuggerStatement","DoWhileStatement","EmptyStatement","ExpressionStatement","File","ForInStatement","ForStatement","FunctionDeclaration","FunctionExpression","Identifier","IfStatement","LabeledStatement","StringLiteral","NumericLiteral","NullLiteral","BooleanLiteral","RegExpLiteral","LogicalExpression","MemberExpression","NewExpression","Program","ObjectExpression","ObjectMethod","ObjectProperty","RestElement","ReturnStatement","SequenceExpression","ParenthesizedExpression","SwitchCase","SwitchStatement","ThisExpression","ThrowStatement","TryStatement","UnaryExpression","UpdateExpression","VariableDeclaration","VariableDeclarator","WhileStatement","WithStatement","AssignmentPattern","ArrayPattern","ArrowFunctionExpression","ClassBody","ClassExpression","ClassDeclaration","ExportAllDeclaration","ExportDefaultDeclaration","ExportNamedDeclaration","ExportSpecifier","ForOfStatement","ImportDeclaration","ImportDefaultSpecifier","ImportNamespaceSpecifier","ImportSpecifier","ImportExpression","MetaProperty","ClassMethod","ObjectPattern","SpreadElement","Super","TaggedTemplateExpression","TemplateElement","TemplateLiteral","YieldExpression","AwaitExpression","Import","BigIntLiteral","ExportNamespaceSpecifier","OptionalMemberExpression","OptionalCallExpression","ClassProperty","ClassAccessorProperty","ClassPrivateProperty","ClassPrivateMethod","PrivateName","StaticBlock","ImportAttribute","AnyTypeAnnotation","ArrayTypeAnnotation","BooleanTypeAnnotation","BooleanLiteralTypeAnnotation","NullLiteralTypeAnnotation","ClassImplements","DeclareClass","DeclareFunction","DeclareInterface","DeclareModule","DeclareModuleExports","DeclareTypeAlias","DeclareOpaqueType","DeclareVariable","DeclareExportDeclaration","DeclareExportAllDeclaration","DeclaredPredicate","ExistsTypeAnnotation","FunctionTypeAnnotation","FunctionTypeParam","GenericTypeAnnotation","InferredPredicate","InterfaceExtends","InterfaceDeclaration","InterfaceTypeAnnotation","IntersectionTypeAnnotation","MixedTypeAnnotation","EmptyTypeAnnotation","NullableTypeAnnotation","NumberLiteralTypeAnnotation","NumberTypeAnnotation","ObjectTypeAnnotation","ObjectTypeInternalSlot","ObjectTypeCallProperty","ObjectTypeIndexer","ObjectTypeProperty","ObjectTypeSpreadProperty","OpaqueType","QualifiedTypeIdentifier","StringLiteralTypeAnnotation","StringTypeAnnotation","SymbolTypeAnnotation","ThisTypeAnnotation","TupleTypeAnnotation","TypeofTypeAnnotation","TypeAlias","TypeAnnotation","TypeCastExpression","TypeParameter","TypeParameterDeclaration","TypeParameterInstantiation","UnionTypeAnnotation","Variance","VoidTypeAnnotation","EnumDeclaration","EnumBooleanBody","EnumNumberBody","EnumStringBody","EnumSymbolBody","EnumBooleanMember","EnumNumberMember","EnumStringMember","EnumDefaultedMember","IndexedAccessType","OptionalIndexedAccessType","JSXAttribute","JSXClosingElement","JSXElement","JSXEmptyExpression","JSXExpressionContainer","JSXSpreadChild","JSXIdentifier","JSXMemberExpression","JSXNamespacedName","JSXOpeningElement","JSXSpreadAttribute","JSXText","JSXFragment","JSXOpeningFragment","JSXClosingFragment","Noop","Placeholder","V8IntrinsicIdentifier","ArgumentPlaceholder","BindExpression","Decorator","DoExpression","ExportDefaultSpecifier","RecordExpression","TupleExpression","DecimalLiteral","ModuleExpression","TopicReference","PipelineTopicExpression","PipelineBareFunction","PipelinePrimaryTopicReference","VoidPattern","TSParameterProperty","TSDeclareFunction","TSDeclareMethod","TSQualifiedName","TSCallSignatureDeclaration","TSConstructSignatureDeclaration","TSPropertySignature","TSMethodSignature","TSIndexSignature","TSAnyKeyword","TSBooleanKeyword","TSBigIntKeyword","TSIntrinsicKeyword","TSNeverKeyword","TSNullKeyword","TSNumberKeyword","TSObjectKeyword","TSStringKeyword","TSSymbolKeyword","TSUndefinedKeyword","TSUnknownKeyword","TSVoidKeyword","TSThisType","TSFunctionType","TSConstructorType","TSTypeReference","TSTypePredicate","TSTypeQuery","TSTypeLiteral","TSArrayType","TSTupleType","TSOptionalType","TSRestType","TSNamedTupleMember","TSUnionType","TSIntersectionType","TSConditionalType","TSInferType","TSParenthesizedType","TSTypeOperator","TSIndexedAccessType","TSMappedType","TSTemplateLiteralType","TSLiteralType","TSExpressionWithTypeArguments","TSInterfaceDeclaration","TSInterfaceBody","TSTypeAliasDeclaration","TSInstantiationExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSEnumBody","TSEnumDeclaration","TSEnumMember","TSModuleDeclaration","TSModuleBlock","TSImportType","TSImportEqualsDeclaration","TSExternalModuleReference","TSNonNullExpression","TSExportAssignment","TSNamespaceExportDeclaration","TSTypeAnnotation","TSTypeParameterInstaLine truncated
@@ -0,0 +1,4 @@
var rb = require('crypto').randomBytes;
module.exports = function() {
return rb(16);
};
@@ -0,0 +1,21 @@
var basePropertyOf = require('./_basePropertyOf');
/** Used to map HTML entities to characters. */
var htmlUnescapes = {
'&amp;': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&#39;': "'"
};
/**
* Used by `_.unescape` to convert HTML entities to characters.
*
* @private
* @param {string} chr The matched character to unescape.
* @returns {string} Returns the unescaped character.
*/
var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
module.exports = unescapeHtmlChar;
@@ -0,0 +1,123 @@
// @ts-ignore TS6133
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
test(".optional()", () => {
const schema = z.string().optional();
expect(schema.parse("adsf")).toEqual("adsf");
expect(schema.parse(undefined)).toEqual(undefined);
expect(schema.safeParse(null).success).toEqual(false);
expectTypeOf<typeof schema._output>().toEqualTypeOf<string | undefined>();
});
test("unwrap", () => {
const unwrapped = z.string().optional().unwrap();
expect(unwrapped).toBeInstanceOf(z.ZodString);
});
test("optionality", () => {
const a = z.string();
expect(a._zod.optin).toEqual(undefined);
expect(a._zod.optout).toEqual(undefined);
const b = z.string().optional();
expect(b._zod.optin).toEqual("optional");
expect(b._zod.optout).toEqual("optional");
const c = z.string().default("asdf");
expect(c._zod.optin).toEqual("optional");
expect(c._zod.optout).toEqual(undefined);
const d = z.string().optional().nullable();
expect(d._zod.optin).toEqual("optional");
expect(d._zod.optout).toEqual("optional");
const e = z.string().default("asdf").nullable();
expect(e._zod.optin).toEqual("optional");
expect(e._zod.optout).toEqual(undefined);
// z.undefined should NOT be optional
const f = z.undefined();
expect(f._zod.optin).toEqual("optional");
expect(f._zod.optout).toEqual("optional");
expectTypeOf<typeof f._zod.optin>().toEqualTypeOf<"optional" | undefined>();
expectTypeOf<typeof f._zod.optout>().toEqualTypeOf<"optional" | undefined>();
// z.union should be optional if any of the types are optional
const g = z.union([z.string(), z.undefined()]);
expect(g._zod.optin).toEqual("optional");
expect(g._zod.optout).toEqual("optional");
expectTypeOf<typeof g._zod.optin>().toEqualTypeOf<"optional" | undefined>();
expectTypeOf<typeof g._zod.optout>().toEqualTypeOf<"optional" | undefined>();
const h = z.union([z.string(), z.optional(z.string())]);
expect(h._zod.optin).toEqual("optional");
expect(h._zod.optout).toEqual("optional");
expectTypeOf<typeof h._zod.optin>().toEqualTypeOf<"optional">();
expectTypeOf<typeof h._zod.optout>().toEqualTypeOf<"optional">();
});
test("pipe optionality", () => {
z.string().optional()._zod.optin;
const a = z.string().optional().pipe(z.string());
expect(a._zod.optin).toEqual("optional");
expect(a._zod.optout).toEqual(undefined);
expectTypeOf<typeof a._zod.optin>().toEqualTypeOf<"optional">();
expectTypeOf<typeof a._zod.optout>().toEqualTypeOf<"optional" | undefined>();
const b = z
.string()
.transform((val) => (Math.random() ? val : undefined))
.pipe(z.string().optional());
expect(b._zod.optin).toEqual(undefined);
expect(b._zod.optout).toEqual("optional");
expectTypeOf<typeof b._zod.optin>().toEqualTypeOf<"optional" | undefined>();
expectTypeOf<typeof b._zod.optout>().toEqualTypeOf<"optional">();
const c = z.string().default("asdf").pipe(z.string());
expect(c._zod.optin).toEqual("optional");
expect(c._zod.optout).toEqual(undefined);
const d = z
.string()
.transform((val) => (Math.random() ? val : undefined))
.pipe(z.string().default("asdf"));
expect(d._zod.optin).toEqual(undefined);
expect(d._zod.optout).toEqual(undefined);
});
test("pipe optionality inside objects", () => {
const schema = z.object({
a: z.string().optional(),
b: z.string().optional().pipe(z.string()),
c: z.string().default("asdf").pipe(z.string()),
d: z
.string()
.transform((val) => (Math.random() ? val : undefined))
.pipe(z.string().optional()),
e: z
.string()
.transform((val) => (Math.random() ? val : undefined))
.pipe(z.string().default("asdf")),
});
type SchemaIn = z.input<typeof schema>;
expectTypeOf<SchemaIn>().toEqualTypeOf<{
a?: string | undefined;
b?: string | undefined;
c?: string | undefined;
d: string;
e: string;
}>();
type SchemaOut = z.output<typeof schema>;
expectTypeOf<SchemaOut>().toEqualTypeOf<{
a?: string | undefined;
b: string;
c: string;
d?: string | undefined;
e: string;
}>();
});
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/gopd
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,65 @@
{
"name": "@heroui/button",
"version": "2.2.10",
"description": "Buttons allow users to perform actions and choose with a single tap.",
"keywords": [
"button"
],
"author": "Junior Garcia <jrgarciadev@gmail.com>",
"homepage": "https://heroui.com",
"license": "MIT",
"main": "dist/index.js",
"sideEffects": false,
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/heroui-inc/heroui.git",
"directory": "packages/components/button"
},
"bugs": {
"url": "https://github.com/heroui-inc/heroui/issues"
},
"peerDependencies": {
"react": ">=18 || >=19.0.0-rc.0",
"react-dom": ">=18 || >=19.0.0-rc.0",
"framer-motion": ">=11.5.6 || >=12.0.0-alpha.1",
"@heroui/theme": ">=2.4.0",
"@heroui/system": ">=2.4.0"
},
"dependencies": {
"@react-aria/button": "3.11.0",
"@react-aria/interactions": "3.22.5",
"@react-aria/utils": "3.26.0",
"@react-aria/focus": "3.19.0",
"@react-types/shared": "3.26.0",
"@react-types/button": "3.10.1",
"@heroui/shared-utils": "2.1.3",
"@heroui/react-utils": "2.1.4",
"@heroui/use-aria-button": "2.2.5",
"@heroui/ripple": "2.2.8",
"@heroui/spinner": "2.2.7"
},
"clean-package": "../../../clean-package.config.json",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"build": "tsup src --dts",
"dev": "pnpm build:fast --watch",
"clean": "rimraf dist .turbo",
"typecheck": "tsc --noEmit",
"build:fast": "tsup src"
}
}
@@ -0,0 +1,6 @@
module.exports = {
"dismiss": `Dismiss`
};
//# sourceMappingURL=en-US.main.js.map
@@ -0,0 +1,17 @@
import { useEffect, useRef, useMemo } from './reactImports'
import { copyWithStructuralSharing } from './rtkqImports'
export function useStableQueryArgs<T>(queryArgs: T) {
const cache = useRef(queryArgs)
const copy = useMemo(
() => copyWithStructuralSharing(cache.current, queryArgs),
[queryArgs],
)
useEffect(() => {
if (cache.current !== copy) {
cache.current = copy
}
}, [copy])
return copy
}
@@ -0,0 +1,190 @@
import * as react from 'react';
import { ReactNode } from 'react';
import * as tailwind_variants from 'tailwind-variants';
import * as _heroui_system from '@heroui/system';
import { HTMLHeroUIProps, PropGetter } from '@heroui/system';
import { ChipVariantProps, SlotsToClasses, ChipSlots } from '@heroui/theme';
import { ReactRef } from '@heroui/react-utils';
import { PressEvent } from '@react-types/shared';
interface UseChipProps extends HTMLHeroUIProps, ChipVariantProps {
/**
* Ref to the DOM node.
*/
ref?: ReactRef<HTMLDivElement | null>;
/**
* Avatar to be rendered in the left side of the chip.
*/
avatar?: React.ReactNode;
/**
* Element to be rendered in the left side of the chip.
* this props overrides the `avatar` prop.
*/
startContent?: React.ReactNode;
/**
* Element to be rendered in the right side of the chip.
* if you pass this prop and the `onClose` prop, the passed element
* will have the close button props and it will be rendered instead of the
* default close button.
*/
endContent?: React.ReactNode;
/**
* Classname or List of classes to change the classNames of the element.
* if `className` is passed, it will be added to the base slot.
*
* @example
* ```ts
* <Chip classNames={{
* base:"base-classes",
* dot: "dot-classes",
* content: "content-classes",
* avatar: "avatar-classes",
* closeButton: "close-button-classes",
* }} />
* ```
*/
classNames?: SlotsToClasses<ChipSlots>;
/**
* Callback fired when the chip is closed. if you pass this prop,
* the chip will display a close button (endContent).
* @param e PressEvent
*/
onClose?: (e: PressEvent) => void;
}
declare function useChip(originalProps: UseChipProps): {
Component: _heroui_system.As<any>;
children: ReactNode;
slots: {
base: (slotProps?: ({
isOneChar?: boolean | undefined;
isCloseButtonFocusVisible?: boolean | undefined;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
variant?: "dot" | "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | undefined;
radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
isCloseable?: boolean | undefined;
hasStartContent?: boolean | undefined;
hasEndContent?: boolean | undefined;
isDisabled?: boolean | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
content: (slotProps?: ({
isOneChar?: boolean | undefined;
isCloseButtonFocusVisible?: boolean | undefined;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
variant?: "dot" | "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | undefined;
radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
isCloseable?: boolean | undefined;
hasStartContent?: boolean | undefined;
hasEndContent?: boolean | undefined;
isDisabled?: boolean | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
dot: (slotProps?: ({
isOneChar?: boolean | undefined;
isCloseButtonFocusVisible?: boolean | undefined;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
variant?: "dot" | "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | undefined;
radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
isCloseable?: boolean | undefined;
hasStartContent?: boolean | undefined;
hasEndContent?: boolean | undefined;
isDisabled?: boolean | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
avatar: (slotProps?: ({
isOneChar?: boolean | undefined;
isCloseButtonFocusVisible?: boolean | undefined;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
variant?: "dot" | "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | undefined;
radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
isCloseable?: boolean | undefined;
hasStartContent?: boolean | undefined;
hasEndContent?: boolean | undefined;
isDisabled?: boolean | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
closeButton: (slotProps?: ({
isOneChar?: boolean | undefined;
isCloseButtonFocusVisible?: boolean | undefined;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
variant?: "dot" | "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | undefined;
radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
isCloseable?: boolean | undefined;
hasStartContent?: boolean | undefined;
hasEndContent?: boolean | undefined;
isDisabled?: boolean | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
} & {
base: (slotProps?: ({
isOneChar?: boolean | undefined;
isCloseButtonFocusVisible?: boolean | undefined;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
variant?: "dot" | "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | undefined;
radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
isCloseable?: boolean | undefined;
hasStartContent?: boolean | undefined;
hasEndContent?: boolean | undefined;
isDisabled?: boolean | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
content: (slotProps?: ({
isOneChar?: boolean | undefined;
isCloseButtonFocusVisible?: boolean | undefined;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
variant?: "dot" | "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | undefined;
radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
isCloseable?: boolean | undefined;
hasStartContent?: boolean | undefined;
hasEndContent?: boolean | undefined;
isDisabled?: boolean | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
dot: (slotProps?: ({
isOneChar?: boolean | undefined;
isCloseButtonFocusVisible?: boolean | undefined;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
variant?: "dot" | "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | undefined;
radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
isCloseable?: boolean | undefined;
hasStartContent?: boolean | undefined;
hasEndContent?: boolean | undefined;
isDisabled?: boolean | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
avatar: (slotProps?: ({
isOneChar?: boolean | undefined;
isCloseButtonFocusVisible?: boolean | undefined;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
variant?: "dot" | "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | undefined;
radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
isCloseable?: boolean | undefined;
hasStartContent?: boolean | undefined;
hasEndContent?: boolean | undefined;
isDisabled?: boolean | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
closeButton: (slotProps?: ({
isOneChar?: boolean | undefined;
isCloseButtonFocusVisible?: boolean | undefined;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger" | undefined;
size?: "sm" | "md" | "lg" | undefined;
variant?: "dot" | "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | undefined;
radius?: "sm" | "md" | "lg" | "none" | "full" | undefined;
isCloseable?: boolean | undefined;
hasStartContent?: boolean | undefined;
hasEndContent?: boolean | undefined;
isDisabled?: boolean | undefined;
} & tailwind_variants.ClassProp<ClassValue>) | undefined) => string;
} & {};
classNames: SlotsToClasses<"base" | "content" | "avatar" | "dot" | "closeButton"> | undefined;
isDot: boolean;
isCloseable: boolean;
startContent: react.DetailedReactHTMLElement<react.HTMLAttributes<HTMLElement>, HTMLElement> | null;
endContent: react.DetailedReactHTMLElement<react.HTMLAttributes<HTMLElement>, HTMLElement> | null;
getCloseButtonProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
getChipProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
};
type UseChipReturn = ReturnType<typeof useChip>;
export { UseChipProps, UseChipReturn, useChip };
@@ -0,0 +1,49 @@
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {Key} from '@react-types/shared';
import {TableState} from '@react-stately/table';
export const gridIds: WeakMap<TableState<unknown>, string> = new WeakMap<TableState<unknown>, string>();
function normalizeKey(key: Key): string {
if (typeof key === 'string') {
return key.replace(/\s*/g, '');
}
return '' + key;
}
export function getColumnHeaderId<T>(state: TableState<T>, columnKey: Key): string {
let gridId = gridIds.get(state);
if (!gridId) {
throw new Error('Unknown grid');
}
return `${gridId}-${normalizeKey(columnKey)}`;
}
export function getCellId<T>(state: TableState<T>, rowKey: Key, columnKey: Key): string {
let gridId = gridIds.get(state);
if (!gridId) {
throw new Error('Unknown grid');
}
return `${gridId}-${normalizeKey(rowKey)}-${normalizeKey(columnKey)}`;
}
export function getRowLabelledBy<T>(state: TableState<T>, rowKey: Key): string {
// A row is labelled by it's row headers.
return [...state.collection.rowHeaderColumnKeys].map(columnKey =>
getCellId(state, rowKey, columnKey)
).join(' ');
}
@@ -0,0 +1,42 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const Hook = require("./Hook");
const HookCodeFactory = require("./HookCodeFactory");
class AsyncSeriesBailHookCodeFactory extends HookCodeFactory {
content({ onError, onResult, resultReturns, onDone }) {
return this.callTapsSeries({
onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true),
onResult: (i, result, next) =>
`if(${result} !== undefined) {\n${onResult(
result
)}\n} else {\n${next()}}\n`,
resultReturns,
onDone
});
}
}
const factory = new AsyncSeriesBailHookCodeFactory();
function COMPILE(options) {
factory.setup(this, options);
return factory.create(options);
}
function AsyncSeriesBailHook(args = [], name = undefined) {
const hook = new Hook(args, name);
hook.constructor = AsyncSeriesBailHook;
hook.compile = COMPILE;
hook._call = undefined;
hook.call = undefined;
return hook;
}
AsyncSeriesBailHook.prototype = null;
module.exports = AsyncSeriesBailHook;
@@ -0,0 +1,30 @@
"use client";
import { transform } from 'motion-dom';
import { useConstant } from '../utils/use-constant.mjs';
import { useCombineMotionValues } from './use-combine-values.mjs';
import { useComputed } from './use-computed.mjs';
function useTransform(input, inputRangeOrTransformer, outputRange, options) {
if (typeof input === "function") {
return useComputed(input);
}
const transformer = typeof inputRangeOrTransformer === "function"
? inputRangeOrTransformer
: transform(inputRangeOrTransformer, outputRange, options);
return Array.isArray(input)
? useListTransform(input, transformer)
: useListTransform([input], ([latest]) => transformer(latest));
}
function useListTransform(values, transformer) {
const latest = useConstant(() => []);
return useCombineMotionValues(values, () => {
latest.length = 0;
const numValues = values.length;
for (let i = 0; i < numValues; i++) {
latest[i] = values[i].get();
}
return transformer(latest);
});
}
export { useTransform };
@@ -0,0 +1,15 @@
module.exports = {
"deselectedItem": (args)=>`${args.item} \u{43D}\u{435} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E}.`,
"longPressToSelect": `\u{41D}\u{430}\u{436}\u{43C}\u{438}\u{442}\u{435} \u{438} \u{443}\u{434}\u{435}\u{440}\u{436}\u{438}\u{432}\u{430}\u{439}\u{442}\u{435} \u{434}\u{43B}\u{44F} \u{432}\u{445}\u{43E}\u{434}\u{430} \u{432} \u{440}\u{435}\u{436}\u{438}\u{43C} \u{432}\u{44B}\u{431}\u{43E}\u{440}\u{430}.`,
"select": `\u{412}\u{44B}\u{431}\u{440}\u{430}\u{442}\u{44C}`,
"selectedAll": `\u{412}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{44B} \u{432}\u{441}\u{435} \u{44D}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}\u{44B}.`,
"selectedCount": (args, formatter)=>`${formatter.plural(args.count, {
"=0": `\u{41D}\u{435}\u{442} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43D}\u{44B}\u{445} \u{44D}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}\u{43E}\u{432}`,
one: ()=>`${formatter.number(args.count)} \u{44D}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}`,
other: ()=>`${formatter.number(args.count)} \u{44D}\u{43B}\u{435}\u{43C}\u{435}\u{43D}\u{442}\u{43E}\u{432} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E}`
})}.`,
"selectedItem": (args)=>`${args.item} \u{432}\u{44B}\u{431}\u{440}\u{430}\u{43D}\u{43E}.`
};
//# sourceMappingURL=ru-RU.main.js.map
@@ -0,0 +1,783 @@
import React, { useMemo, useRef, useEffect, useState, useContext } from 'react';
import { useDndContext, getClientRect, useDroppable, useDraggable, closestCorners, getFirstCollision, getScrollableAncestors, KeyboardCode } from '@dnd-kit/core';
import { useUniqueId, useIsomorphicLayoutEffect, CSS, useCombinedRefs, isKeyboardEvent, subtract } from '@dnd-kit/utilities';
/**
* Move an array item to a different position. Returns a new array with the item moved to the new position.
*/
function arrayMove(array, from, to) {
const newArray = array.slice();
newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]);
return newArray;
}
/**
* Swap an array item to a different position. Returns a new array with the item swapped to the new position.
*/
function arraySwap(array, from, to) {
const newArray = array.slice();
newArray[from] = array[to];
newArray[to] = array[from];
return newArray;
}
function getSortedRects(items, rects) {
return items.reduce((accumulator, id, index) => {
const rect = rects.get(id);
if (rect) {
accumulator[index] = rect;
}
return accumulator;
}, Array(items.length));
}
function isValidIndex(index) {
return index !== null && index >= 0;
}
function itemsEqual(a, b) {
if (a === b) {
return true;
}
if (a.length !== b.length) {
return false;
}
for (let i = 0; i < a.length; i++) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
}
function normalizeDisabled(disabled) {
if (typeof disabled === 'boolean') {
return {
draggable: disabled,
droppable: disabled
};
}
return disabled;
}
// To-do: We should be calculating scale transformation
const defaultScale = {
scaleX: 1,
scaleY: 1
};
const horizontalListSortingStrategy = _ref => {
var _rects$activeIndex;
let {
rects,
activeNodeRect: fallbackActiveRect,
activeIndex,
overIndex,
index
} = _ref;
const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;
if (!activeNodeRect) {
return null;
}
const itemGap = getItemGap(rects, index, activeIndex);
if (index === activeIndex) {
const newIndexRect = rects[overIndex];
if (!newIndexRect) {
return null;
}
return {
x: activeIndex < overIndex ? newIndexRect.left + newIndexRect.width - (activeNodeRect.left + activeNodeRect.width) : newIndexRect.left - activeNodeRect.left,
y: 0,
...defaultScale
};
}
if (index > activeIndex && index <= overIndex) {
return {
x: -activeNodeRect.width - itemGap,
y: 0,
...defaultScale
};
}
if (index < activeIndex && index >= overIndex) {
return {
x: activeNodeRect.width + itemGap,
y: 0,
...defaultScale
};
}
return {
x: 0,
y: 0,
...defaultScale
};
};
function getItemGap(rects, index, activeIndex) {
const currentRect = rects[index];
const previousRect = rects[index - 1];
const nextRect = rects[index + 1];
if (!currentRect || !previousRect && !nextRect) {
return 0;
}
if (activeIndex < index) {
return previousRect ? currentRect.left - (previousRect.left + previousRect.width) : nextRect.left - (currentRect.left + currentRect.width);
}
return nextRect ? nextRect.left - (currentRect.left + currentRect.width) : currentRect.left - (previousRect.left + previousRect.width);
}
const rectSortingStrategy = _ref => {
let {
rects,
activeIndex,
overIndex,
index
} = _ref;
const newRects = arrayMove(rects, overIndex, activeIndex);
const oldRect = rects[index];
const newRect = newRects[index];
if (!newRect || !oldRect) {
return null;
}
return {
x: newRect.left - oldRect.left,
y: newRect.top - oldRect.top,
scaleX: newRect.width / oldRect.width,
scaleY: newRect.height / oldRect.height
};
};
const rectSwappingStrategy = _ref => {
let {
activeIndex,
index,
rects,
overIndex
} = _ref;
let oldRect;
let newRect;
if (index === activeIndex) {
oldRect = rects[index];
newRect = rects[overIndex];
}
if (index === overIndex) {
oldRect = rects[index];
newRect = rects[activeIndex];
}
if (!newRect || !oldRect) {
return null;
}
return {
x: newRect.left - oldRect.left,
y: newRect.top - oldRect.top,
scaleX: newRect.width / oldRect.width,
scaleY: newRect.height / oldRect.height
};
};
// To-do: We should be calculating scale transformation
const defaultScale$1 = {
scaleX: 1,
scaleY: 1
};
const verticalListSortingStrategy = _ref => {
var _rects$activeIndex;
let {
activeIndex,
activeNodeRect: fallbackActiveRect,
index,
rects,
overIndex
} = _ref;
const activeNodeRect = (_rects$activeIndex = rects[activeIndex]) != null ? _rects$activeIndex : fallbackActiveRect;
if (!activeNodeRect) {
return null;
}
if (index === activeIndex) {
const overIndexRect = rects[overIndex];
if (!overIndexRect) {
return null;
}
return {
x: 0,
y: activeIndex < overIndex ? overIndexRect.top + overIndexRect.height - (activeNodeRect.top + activeNodeRect.height) : overIndexRect.top - activeNodeRect.top,
...defaultScale$1
};
}
const itemGap = getItemGap$1(rects, index, activeIndex);
if (index > activeIndex && index <= overIndex) {
return {
x: 0,
y: -activeNodeRect.height - itemGap,
...defaultScale$1
};
}
if (index < activeIndex && index >= overIndex) {
return {
x: 0,
y: activeNodeRect.height + itemGap,
...defaultScale$1
};
}
return {
x: 0,
y: 0,
...defaultScale$1
};
};
function getItemGap$1(clientRects, index, activeIndex) {
const currentRect = clientRects[index];
const previousRect = clientRects[index - 1];
const nextRect = clientRects[index + 1];
if (!currentRect) {
return 0;
}
if (activeIndex < index) {
return previousRect ? currentRect.top - (previousRect.top + previousRect.height) : nextRect ? nextRect.top - (currentRect.top + currentRect.height) : 0;
}
return nextRect ? nextRect.top - (currentRect.top + currentRect.height) : previousRect ? currentRect.top - (previousRect.top + previousRect.height) : 0;
}
const ID_PREFIX = 'Sortable';
const Context = /*#__PURE__*/React.createContext({
activeIndex: -1,
containerId: ID_PREFIX,
disableTransforms: false,
items: [],
overIndex: -1,
useDragOverlay: false,
sortedRects: [],
strategy: rectSortingStrategy,
disabled: {
draggable: false,
droppable: false
}
});
function SortableContext(_ref) {
let {
children,
id,
items: userDefinedItems,
strategy = rectSortingStrategy,
disabled: disabledProp = false
} = _ref;
const {
active,
dragOverlay,
droppableRects,
over,
measureDroppableContainers
} = useDndContext();
const containerId = useUniqueId(ID_PREFIX, id);
const useDragOverlay = Boolean(dragOverlay.rect !== null);
const items = useMemo(() => userDefinedItems.map(item => typeof item === 'object' && 'id' in item ? item.id : item), [userDefinedItems]);
const isDragging = active != null;
const activeIndex = active ? items.indexOf(active.id) : -1;
const overIndex = over ? items.indexOf(over.id) : -1;
const previousItemsRef = useRef(items);
const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current);
const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged;
const disabled = normalizeDisabled(disabledProp);
useIsomorphicLayoutEffect(() => {
if (itemsHaveChanged && isDragging) {
measureDroppableContainers(items);
}
}, [itemsHaveChanged, items, isDragging, measureDroppableContainers]);
useEffect(() => {
previousItemsRef.current = items;
}, [items]);
const contextValue = useMemo(() => ({
activeIndex,
containerId,
disabled,
disableTransforms,
items,
overIndex,
useDragOverlay,
sortedRects: getSortedRects(items, droppableRects),
strategy
}), // eslint-disable-next-line react-hooks/exhaustive-deps
[activeIndex, containerId, disabled.draggable, disabled.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy]);
return React.createElement(Context.Provider, {
value: contextValue
}, children);
}
const defaultNewIndexGetter = _ref => {
let {
id,
items,
activeIndex,
overIndex
} = _ref;
return arrayMove(items, activeIndex, overIndex).indexOf(id);
};
const defaultAnimateLayoutChanges = _ref2 => {
let {
containerId,
isSorting,
wasDragging,
index,
items,
newIndex,
previousItems,
previousContainerId,
transition
} = _ref2;
if (!transition || !wasDragging) {
return false;
}
if (previousItems !== items && index === newIndex) {
return false;
}
if (isSorting) {
return true;
}
return newIndex !== index && containerId === previousContainerId;
};
const defaultTransition = {
duration: 200,
easing: 'ease'
};
const transitionProperty = 'transform';
const disabledTransition = /*#__PURE__*/CSS.Transition.toString({
property: transitionProperty,
duration: 0,
easing: 'linear'
});
const defaultAttributes = {
roleDescription: 'sortable'
};
/*
* When the index of an item changes while sorting,
* we need to temporarily disable the transforms
*/
function useDerivedTransform(_ref) {
let {
disabled,
index,
node,
rect
} = _ref;
const [derivedTransform, setDerivedtransform] = useState(null);
const previousIndex = useRef(index);
useIsomorphicLayoutEffect(() => {
if (!disabled && index !== previousIndex.current && node.current) {
const initial = rect.current;
if (initial) {
const current = getClientRect(node.current, {
ignoreTransform: true
});
const delta = {
x: initial.left - current.left,
y: initial.top - current.top,
scaleX: initial.width / current.width,
scaleY: initial.height / current.height
};
if (delta.x || delta.y) {
setDerivedtransform(delta);
}
}
}
if (index !== previousIndex.current) {
previousIndex.current = index;
}
}, [disabled, index, node, rect]);
useEffect(() => {
if (derivedTransform) {
setDerivedtransform(null);
}
}, [derivedTransform]);
return derivedTransform;
}
function useSortable(_ref) {
let {
animateLayoutChanges = defaultAnimateLayoutChanges,
attributes: userDefinedAttributes,
disabled: localDisabled,
data: customData,
getNewIndex = defaultNewIndexGetter,
id,
strategy: localStrategy,
resizeObserverConfig,
transition = defaultTransition
} = _ref;
const {
items,
containerId,
activeIndex,
disabled: globalDisabled,
disableTransforms,
sortedRects,
overIndex,
useDragOverlay,
strategy: globalStrategy
} = useContext(Context);
const disabled = normalizeLocalDisabled(localDisabled, globalDisabled);
const index = items.indexOf(id);
const data = useMemo(() => ({
sortable: {
containerId,
index,
items
},
...customData
}), [containerId, customData, index, items]);
const itemsAfterCurrentSortable = useMemo(() => items.slice(items.indexOf(id)), [items, id]);
const {
rect,
node,
isOver,
setNodeRef: setDroppableNodeRef
} = useDroppable({
id,
data,
disabled: disabled.droppable,
resizeObserverConfig: {
updateMeasurementsFor: itemsAfterCurrentSortable,
...resizeObserverConfig
}
});
const {
active,
activatorEvent,
activeNodeRect,
attributes,
setNodeRef: setDraggableNodeRef,
listeners,
isDragging,
over,
setActivatorNodeRef,
transform
} = useDraggable({
id,
data,
attributes: { ...defaultAttributes,
...userDefinedAttributes
},
disabled: disabled.draggable
});
const setNodeRef = useCombinedRefs(setDroppableNodeRef, setDraggableNodeRef);
const isSorting = Boolean(active);
const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex);
const shouldDisplaceDragSource = !useDragOverlay && isDragging;
const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform : null;
const strategy = localStrategy != null ? localStrategy : globalStrategy;
const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({
rects: sortedRects,
activeNodeRect,
activeIndex,
overIndex,
index
}) : null;
const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({
id,
items,
activeIndex,
overIndex
}) : index;
const activeId = active == null ? void 0 : active.id;
const previous = useRef({
activeId,
items,
newIndex,
containerId
});
const itemsHaveChanged = items !== previous.current.items;
const shouldAnimateLayoutChanges = animateLayoutChanges({
active,
containerId,
isDragging,
isSorting,
id,
index,
items,
newIndex: previous.current.newIndex,
previousItems: previous.current.items,
previousContainerId: previous.current.containerId,
transition,
wasDragging: previous.current.activeId != null
});
const derivedTransform = useDerivedTransform({
disabled: !shouldAnimateLayoutChanges,
index,
node,
rect
});
useEffect(() => {
if (isSorting && previous.current.newIndex !== newIndex) {
previous.current.newIndex = newIndex;
}
if (containerId !== previous.current.containerId) {
previous.current.containerId = containerId;
}
if (items !== previous.current.items) {
previous.current.items = items;
}
}, [isSorting, newIndex, containerId, items]);
useEffect(() => {
if (activeId === previous.current.activeId) {
return;
}
if (activeId != null && previous.current.activeId == null) {
previous.current.activeId = activeId;
return;
}
const timeoutId = setTimeout(() => {
previous.current.activeId = activeId;
}, 50);
return () => clearTimeout(timeoutId);
}, [activeId]);
return {
active,
activeIndex,
attributes,
data,
rect,
index,
newIndex,
items,
isOver,
isSorting,
isDragging,
listeners,
node,
overIndex,
over,
setNodeRef,
setActivatorNodeRef,
setDroppableNodeRef,
setDraggableNodeRef,
transform: derivedTransform != null ? derivedTransform : finalTransform,
transition: getTransition()
};
function getTransition() {
if ( // Temporarily disable transitions for a single frame to set up derived transforms
derivedTransform || // Or to prevent items jumping to back to their "new" position when items change
itemsHaveChanged && previous.current.newIndex === index) {
return disabledTransition;
}
if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) {
return undefined;
}
if (isSorting || shouldAnimateLayoutChanges) {
return CSS.Transition.toString({ ...transition,
property: transitionProperty
});
}
return undefined;
}
}
function normalizeLocalDisabled(localDisabled, globalDisabled) {
var _localDisabled$dragga, _localDisabled$droppa;
if (typeof localDisabled === 'boolean') {
return {
draggable: localDisabled,
// Backwards compatibility
droppable: false
};
}
return {
draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable,
droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable
};
}
function hasSortableData(entry) {
if (!entry) {
return false;
}
const data = entry.data.current;
if (data && 'sortable' in data && typeof data.sortable === 'object' && 'containerId' in data.sortable && 'items' in data.sortable && 'index' in data.sortable) {
return true;
}
return false;
}
const directions = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left];
const sortableKeyboardCoordinates = (event, _ref) => {
let {
context: {
active,
collisionRect,
droppableRects,
droppableContainers,
over,
scrollableAncestors
}
} = _ref;
if (directions.includes(event.code)) {
event.preventDefault();
if (!active || !collisionRect) {
return;
}
const filteredContainers = [];
droppableContainers.getEnabled().forEach(entry => {
if (!entry || entry != null && entry.disabled) {
return;
}
const rect = droppableRects.get(entry.id);
if (!rect) {
return;
}
switch (event.code) {
case KeyboardCode.Down:
if (collisionRect.top < rect.top) {
filteredContainers.push(entry);
}
break;
case KeyboardCode.Up:
if (collisionRect.top > rect.top) {
filteredContainers.push(entry);
}
break;
case KeyboardCode.Left:
if (collisionRect.left > rect.left) {
filteredContainers.push(entry);
}
break;
case KeyboardCode.Right:
if (collisionRect.left < rect.left) {
filteredContainers.push(entry);
}
break;
}
});
const collisions = closestCorners({
active,
collisionRect: collisionRect,
droppableRects,
droppableContainers: filteredContainers,
pointerCoordinates: null
});
let closestId = getFirstCollision(collisions, 'id');
if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) {
closestId = collisions[1].id;
}
if (closestId != null) {
const activeDroppable = droppableContainers.get(active.id);
const newDroppable = droppableContainers.get(closestId);
const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null;
const newNode = newDroppable == null ? void 0 : newDroppable.node.current;
if (newNode && newRect && activeDroppable && newDroppable) {
const newScrollAncestors = getScrollableAncestors(newNode);
const hasDifferentScrollAncestors = newScrollAncestors.some((element, index) => scrollableAncestors[index] !== element);
const hasSameContainer = isSameContainer(activeDroppable, newDroppable);
const isAfterActive = isAfter(activeDroppable, newDroppable);
const offset = hasDifferentScrollAncestors || !hasSameContainer ? {
x: 0,
y: 0
} : {
x: isAfterActive ? collisionRect.width - newRect.width : 0,
y: isAfterActive ? collisionRect.height - newRect.height : 0
};
const rectCoordinates = {
x: newRect.left,
y: newRect.top
};
const newCoordinates = offset.x && offset.y ? rectCoordinates : subtract(rectCoordinates, offset);
return newCoordinates;
}
}
}
return undefined;
};
function isSameContainer(a, b) {
if (!hasSortableData(a) || !hasSortableData(b)) {
return false;
}
return a.data.current.sortable.containerId === b.data.current.sortable.containerId;
}
function isAfter(a, b) {
if (!hasSortableData(a) || !hasSortableData(b)) {
return false;
}
if (!isSameContainer(a, b)) {
return false;
}
return a.data.current.sortable.index < b.data.current.sortable.index;
}
export { SortableContext, arrayMove, arraySwap, defaultAnimateLayoutChanges, defaultNewIndexGetter, hasSortableData, horizontalListSortingStrategy, rectSortingStrategy, rectSwappingStrategy, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy };
//# sourceMappingURL=sortable.esm.js.map
@@ -0,0 +1,14 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var mini = require('framer-motion/mini');
Object.keys(mini).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return mini[k]; }
});
});
@@ -0,0 +1,317 @@
"use client";
import {
listbox_section_default
} from "./chunk-L637PYVS.mjs";
import {
listbox_item_default
} from "./chunk-V45NB7OG.mjs";
// src/virtualized-listbox.tsx
import { useMemo as useMemo2, useRef as useRef2, useState } from "react";
import { mergeProps } from "@react-aria/utils";
import { useVirtualizer } from "@tanstack/react-virtual";
import { isEmpty } from "@heroui/shared-utils";
// ../scroll-shadow/src/use-scroll-shadow.ts
import { mapPropsVariants } from "@heroui/system";
import { scrollShadow } from "@heroui/theme";
import { useDOMRef } from "@heroui/react-utils";
// ../../hooks/use-data-scroll-overflow/src/index.ts
import { capitalize } from "@heroui/shared-utils";
import { useEffect, useRef } from "react";
function useDataScrollOverflow(props = {}) {
const {
domRef,
isEnabled = true,
overflowCheck = "vertical",
visibility = "auto",
offset = 0,
onVisibilityChange,
updateDeps = []
} = props;
const visibleRef = useRef(visibility);
useEffect(() => {
const el = domRef == null ? void 0 : domRef.current;
if (!el || !isEnabled)
return;
const setAttributes = (direction, hasBefore, hasAfter, prefix, suffix) => {
if (visibility === "auto") {
const both = `${prefix}${capitalize(suffix)}Scroll`;
if (hasBefore && hasAfter) {
el.dataset[both] = "true";
el.removeAttribute(`data-${prefix}-scroll`);
el.removeAttribute(`data-${suffix}-scroll`);
} else {
el.dataset[`${prefix}Scroll`] = hasBefore.toString();
el.dataset[`${suffix}Scroll`] = hasAfter.toString();
el.removeAttribute(`data-${prefix}-${suffix}-scroll`);
}
} else {
const next = hasBefore && hasAfter ? "both" : hasBefore ? prefix : hasAfter ? suffix : "none";
if (next !== visibleRef.current) {
onVisibilityChange == null ? void 0 : onVisibilityChange(next);
visibleRef.current = next;
}
}
};
const checkOverflow = () => {
const directions = [
{ type: "vertical", prefix: "top", suffix: "bottom" },
{ type: "horizontal", prefix: "left", suffix: "right" }
];
for (const { type, prefix, suffix } of directions) {
if (overflowCheck === type || overflowCheck === "both") {
const hasBefore = type === "vertical" ? el.scrollTop > offset : el.scrollLeft > offset;
const hasAfter = type === "vertical" ? el.scrollTop + el.clientHeight + offset < el.scrollHeight : el.scrollLeft + el.clientWidth + offset < el.scrollWidth;
setAttributes(type, hasBefore, hasAfter, prefix, suffix);
}
}
};
const clearOverflow = () => {
["top", "bottom", "top-bottom", "left", "right", "left-right"].forEach((attr) => {
el.removeAttribute(`data-${attr}-scroll`);
});
};
checkOverflow();
el.addEventListener("scroll", checkOverflow);
if (visibility !== "auto") {
clearOverflow();
if (visibility === "both") {
el.dataset.topBottomScroll = String(overflowCheck === "vertical");
el.dataset.leftRightScroll = String(overflowCheck === "horizontal");
} else {
el.dataset.topBottomScroll = "false";
el.dataset.leftRightScroll = "false";
["top", "bottom", "left", "right"].forEach((attr) => {
el.dataset[`${attr}Scroll`] = String(visibility === attr);
});
}
}
return () => {
el.removeEventListener("scroll", checkOverflow);
clearOverflow();
};
}, [...updateDeps, isEnabled, visibility, overflowCheck, onVisibilityChange, domRef]);
}
// ../scroll-shadow/src/use-scroll-shadow.ts
import { useMemo } from "react";
import { objectToDeps } from "@heroui/shared-utils";
function useScrollShadow(originalProps) {
var _a;
const [props, variantProps] = mapPropsVariants(originalProps, scrollShadow.variantKeys);
const {
ref,
as,
children,
className,
style,
size = 40,
offset = 0,
visibility = "auto",
isEnabled = true,
onVisibilityChange,
...otherProps
} = props;
const Component = as || "div";
const domRef = useDOMRef(ref);
useDataScrollOverflow({
domRef,
offset,
visibility,
isEnabled,
onVisibilityChange,
updateDeps: [children],
overflowCheck: (_a = originalProps.orientation) != null ? _a : "vertical"
});
const styles = useMemo(
() => scrollShadow({
...variantProps,
className
}),
[objectToDeps(variantProps), className]
);
const getBaseProps = (props2 = {}) => {
var _a2;
return {
ref: domRef,
className: styles,
"data-orientation": (_a2 = originalProps.orientation) != null ? _a2 : "vertical",
style: {
"--scroll-shadow-size": `${size}px`,
...style,
...props2.style
},
...otherProps,
...props2
};
};
return { Component, styles, domRef, children, getBaseProps };
}
// src/virtualized-listbox.tsx
import { filterDOMProps } from "@heroui/react-utils";
import { jsx, jsxs } from "react/jsx-runtime";
var getItemSizesForCollection = (collection, itemHeight) => {
const sizes = [];
for (const item of collection) {
if (item.type === "section") {
sizes.push(([...item.childNodes].length + 1) * itemHeight);
} else {
sizes.push(itemHeight);
}
}
return sizes;
};
var getScrollState = (element) => {
if (!element || element.scrollTop === void 0 || element.clientHeight === void 0 || element.scrollHeight === void 0) {
return {
isTop: false,
isBottom: false,
isMiddle: false
};
}
const isAtTop = element.scrollTop === 0;
const isAtBottom = Math.ceil(element.scrollTop + element.clientHeight) >= element.scrollHeight;
const isInMiddle = !isAtTop && !isAtBottom;
return {
isTop: isAtTop,
isBottom: isAtBottom,
isMiddle: isInMiddle
};
};
var VirtualizedListbox = (props) => {
const {
Component,
state,
color,
variant,
itemClasses,
getBaseProps,
topContent,
bottomContent,
hideEmptyContent,
hideSelectedIcon,
shouldHighlightOnFocus,
disableAnimation,
getEmptyContentProps,
getListProps,
scrollShadowProps
} = props;
const { virtualization } = props;
if (!virtualization || !isEmpty(virtualization) && !virtualization.maxListboxHeight && !virtualization.itemHeight) {
throw new Error(
"You are using a virtualized listbox. VirtualizedListbox requires 'virtualization' props with 'maxListboxHeight' and 'itemHeight' properties. This error might have originated from autocomplete components that use VirtualizedListbox. Please provide these props to use the virtualized listbox."
);
}
const { maxListboxHeight, itemHeight } = virtualization;
const listHeight = Math.min(maxListboxHeight, itemHeight * state.collection.size);
const parentRef = useRef2(null);
const itemSizes = useMemo2(
() => getItemSizesForCollection([...state.collection], itemHeight),
[state.collection, itemHeight]
);
const rowVirtualizer = useVirtualizer({
count: [...state.collection].length,
getScrollElement: () => parentRef.current,
estimateSize: (i) => itemSizes[i]
});
const virtualItems = rowVirtualizer.getVirtualItems();
const { getBaseProps: getBasePropsScrollShadow } = useScrollShadow({ ...scrollShadowProps });
const renderRow = (virtualItem) => {
var _a;
const item = [...state.collection][virtualItem.index];
if (!item) {
return null;
}
const itemProps = {
color,
item,
state,
variant,
disableAnimation,
hideSelectedIcon,
...item.props
};
const virtualizerStyle = {
position: "absolute",
top: 0,
left: 0,
width: "100%",
height: `${virtualItem.size}px`,
transform: `translateY(${virtualItem.start}px)`
};
if (item.type === "section") {
return /* @__PURE__ */ jsx(
listbox_section_default,
{
...itemProps,
itemClasses,
style: { ...virtualizerStyle, ...itemProps.style }
},
item.key
);
}
let listboxItem = /* @__PURE__ */ jsx(
listbox_item_default,
{
...itemProps,
classNames: mergeProps(itemClasses, (_a = item.props) == null ? void 0 : _a.classNames),
shouldHighlightOnFocus,
style: { ...virtualizerStyle, ...itemProps.style }
},
item.key
);
if (item.wrapper) {
listboxItem = item.wrapper(listboxItem);
}
return listboxItem;
};
const [scrollState, setScrollState] = useState({
isTop: false,
isBottom: true,
isMiddle: false
});
const content = /* @__PURE__ */ jsxs(Component, { ...getListProps(), children: [
!state.collection.size && !hideEmptyContent && /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("div", { ...getEmptyContentProps() }) }),
/* @__PURE__ */ jsx(
"div",
{
...filterDOMProps(getBasePropsScrollShadow()),
ref: parentRef,
"data-bottom-scroll": scrollState.isTop,
"data-top-bottom-scroll": scrollState.isMiddle,
"data-top-scroll": scrollState.isBottom,
style: {
height: maxListboxHeight,
overflow: "auto"
},
onScroll: (e) => {
setScrollState(getScrollState(e.target));
},
children: listHeight > 0 && itemHeight > 0 && /* @__PURE__ */ jsx(
"div",
{
style: {
height: `${rowVirtualizer.getTotalSize()}px`,
width: "100%",
position: "relative"
},
children: virtualItems.map((virtualItem) => renderRow(virtualItem))
}
)
}
)
] });
return /* @__PURE__ */ jsxs("div", { ...getBaseProps(), children: [
topContent,
content,
bottomContent
] });
};
var virtualized_listbox_default = VirtualizedListbox;
export {
virtualized_listbox_default
};
@@ -0,0 +1,115 @@
# env-paths
> Get paths for storing things like data, config, cache, etc
Uses the correct OS-specific paths. Most developers get this wrong.
## Install
```
$ npm install env-paths
```
## Usage
```js
const envPaths = require('env-paths');
const paths = envPaths('MyApp');
paths.data;
//=> '/home/sindresorhus/.local/share/MyApp-nodejs'
paths.config
//=> '/home/sindresorhus/.config/MyApp-nodejs'
```
## API
### paths = envPaths(name, options?)
Note: It only generates the path strings. It doesn't create the directories for you. You could use [`make-dir`](https://github.com/sindresorhus/make-dir) to create the directories.
#### name
Type: `string`
Name of your project. Used to generate the paths.
#### options
Type: `object`
##### suffix
Type: `string`<br>
Default: `'nodejs'`
**Don't use this option unless you really have to!**<br>
Suffix appended to the project name to avoid name conflicts with native
apps. Pass an empty string to disable it.
### paths.data
Directory for data files.
Example locations (with the default `nodejs` [suffix](#suffix)):
- macOS: `~/Library/Application Support/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Data` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Data`)
- Linux: `~/.local/share/MyApp-nodejs` (or `$XDG_DATA_HOME/MyApp-nodejs`)
### paths.config
Directory for config files.
Example locations (with the default `nodejs` [suffix](#suffix)):
- macOS: `~/Library/Preferences/MyApp-nodejs`
- Windows: `%APPDATA%\MyApp-nodejs\Config` (for example, `C:\Users\USERNAME\AppData\Roaming\MyApp-nodejs\Config`)
- Linux: `~/.config/MyApp-nodejs` (or `$XDG_CONFIG_HOME/MyApp-nodejs`)
### paths.cache
Directory for non-essential data files.
Example locations (with the default `nodejs` [suffix](#suffix)):
- macOS: `~/Library/Caches/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Cache` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Cache`)
- Linux: `~/.cache/MyApp-nodejs` (or `$XDG_CACHE_HOME/MyApp-nodejs`)
### paths.log
Directory for log files.
Example locations (with the default `nodejs` [suffix](#suffix)):
- macOS: `~/Library/Logs/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\MyApp-nodejs\Log` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-nodejs\Log`)
- Linux: `~/.local/state/MyApp-nodejs` (or `$XDG_STATE_HOME/MyApp-nodejs`)
### paths.temp
Directory for temporary files.
Example locations (with the default `nodejs` [suffix](#suffix)):
- macOS: `/var/folders/jf/f2twvvvs5jl_m49tf034ffpw0000gn/T/MyApp-nodejs`
- Windows: `%LOCALAPPDATA%\Temp\MyApp-nodejs` (for example, `C:\Users\USERNAME\AppData\Local\Temp\MyApp-nodejs`)
- Linux: `/tmp/USERNAME/MyApp-nodejs`
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-env-paths?utm_source=npm-env-paths&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more