docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s

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,2 @@
export {};
//# sourceMappingURL=getBaseType.spec.d.ts.map
@@ -0,0 +1,84 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = ttf2icon;
var _ttfreader = _interopRequireDefault(require("./ttfreader"));
var _error = _interopRequireDefault(require("./error"));
var _default = _interopRequireDefault(require("./data/default"));
var _ttf2symbol = require("./ttf2symbol");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @file ttf转icon
* @author mengke01(kekee000@gmail.com)
*/
/**
* listUnicode
*
* @param {Array} unicode unicode
* @return {string} unicode string
*/
function listUnicode(unicode) {
return unicode.map(function (u) {
return '\\' + u.toString(16);
}).join(',');
}
/**
* ttf数据结构转icon数据结构
*
* @param {ttfObject} ttf ttfObject对象
* @param {Object} options 选项
* @param {Object} options.metadata 字体相关的信息
* @param {Object} options.iconPrefix icon 前缀
* @return {Object} icon obj
*/
function ttfobject2icon(ttf) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var glyfList = [];
// glyf 信息
var filtered = ttf.glyf.filter(function (g) {
return g.name !== '.notdef' && g.name !== '.null' && g.name !== 'nonmarkingreturn' && g.unicode && g.unicode.length;
});
filtered.forEach(function (g, i) {
glyfList.push({
code: '&#x' + g.unicode[0].toString(16) + ';',
codeName: listUnicode(g.unicode),
name: g.name,
id: (0, _ttf2symbol.getSymbolId)(g, i)
});
});
return {
fontFamily: ttf.name.fontFamily || _default.default.name.fontFamily,
iconPrefix: options.iconPrefix || 'icon',
glyfList: glyfList
};
}
/**
* ttf格式转换成icon
*
* @param {ArrayBuffer|ttfObject} ttfBuffer ttf缓冲数组或者ttfObject对象
* @param {Object} options 选项
* @param {Object} options.metadata 字体相关的信息
*
* @return {Object} icon object
*/
function ttf2icon(ttfBuffer) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
// 读取ttf二进制流
if (ttfBuffer instanceof ArrayBuffer) {
var reader = new _ttfreader.default();
var ttfObject = reader.read(ttfBuffer);
reader.dispose();
return ttfobject2icon(ttfObject, options);
}
// 读取ttfObject
else if (ttfBuffer.version && ttfBuffer.glyf) {
return ttfobject2icon(ttfBuffer, options);
}
_error.default.raise(10101);
}
@@ -0,0 +1,33 @@
import { OneBotAction } from '../../../action/OneBotAction';
import { Static } from '@sinclair/typebox';
export declare const SendFlashMsgPayloadSchema: import("@sinclair/typebox").TObject<{
fileset_id: import("@sinclair/typebox").TString;
user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
group_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
}>;
export type SendFlashMsgPayload = Static<typeof SendFlashMsgPayloadSchema>;
export declare class SendFlashMsg extends OneBotAction<SendFlashMsgPayload, any> {
actionName: "send_flash_msg";
payloadSchema: import("@sinclair/typebox").TObject<{
fileset_id: import("@sinclair/typebox").TString;
user_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
group_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
}>;
returnSchema: import("@sinclair/typebox").TAny;
actionSummary: string;
actionTags: string[];
payloadExample: {
fileset_id: string;
user_id: string;
};
returnExample: {
message_id: number;
};
_handle(payload: SendFlashMsgPayload): Promise<{
errCode: number;
errMsg: string;
rsp: {
sendStatus: import("../../../../napcat-core/data/flash").SendStatus[];
};
}>;
}
@@ -0,0 +1,120 @@
/// <reference types="node" />
import type { Plugin, ParseOptions, Module, Output, Options, Script, Program, JsMinifyOptions, WasmAnalysisOptions } from "@swc/types";
export type * from "@swc/types";
export { newMangleNameCache as experimental_newMangleNameCache } from "./binding";
import { BundleInput } from "./spack";
import type { NapiMinifyExtra } from "./binding";
/**
* Version of the swc binding.
*/
export declare const version: string;
/**
* @deprecated JavaScript API is deprecated. Please use Wasm plugin instead.
*/
export declare function plugins(ps: Plugin[]): Plugin;
export declare class Compiler {
private fallbackBindingsPluginWarningDisplayed;
minify(src: string | Buffer, opts?: JsMinifyOptions, extras?: NapiMinifyExtra): Promise<Output>;
minifySync(src: string | Buffer, opts?: JsMinifyOptions, extras?: NapiMinifyExtra): Output;
/**
* @deprecated Use Rust instead.
*/
parse(src: string, options: ParseOptions & {
isModule: false;
}): Promise<Script>;
parse(src: string, options?: ParseOptions, filename?: string): Promise<Module>;
parseSync(src: string, options: ParseOptions & {
isModule: false;
}): Script;
parseSync(src: string, options?: ParseOptions, filename?: string): Module;
parseFile(path: string, options: ParseOptions & {
isModule: false;
}): Promise<Script>;
parseFile(path: string, options?: ParseOptions): Promise<Module>;
parseFileSync(path: string, options: ParseOptions & {
isModule: false;
}): Script;
parseFileSync(path: string, options?: ParseOptions): Module;
/**
* Note: this method should be invoked on the compiler instance used
* for `parse()` / `parseSync()`.
*/
print(m: Program, options?: Options): Promise<Output>;
/**
* Note: this method should be invoked on the compiler instance used
* for `parse()` / `parseSync()`.
*/
printSync(m: Program, options?: Options): Output;
transform(src: string | Program, options?: Options): Promise<Output>;
transformSync(src: string | Program, options?: Options): Output;
transformFile(path: string, options?: Options): Promise<Output>;
transformFileSync(path: string, options?: Options): Output;
bundle(options?: BundleInput | string): Promise<{
[name: string]: Output;
}>;
}
export declare function experimental_analyze(src: string, options?: WasmAnalysisOptions): Promise<string>;
/**
* @deprecated Use Rust instead.
*/
export declare function parse(src: string, options: ParseOptions & {
isModule: false;
}): Promise<Script>;
export declare function parse(src: string, options?: ParseOptions): Promise<Module>;
export declare function parseSync(src: string, options: ParseOptions & {
isModule: false;
}): Script;
export declare function parseSync(src: string, options?: ParseOptions): Module;
export declare function parseFile(path: string, options: ParseOptions & {
isModule: false;
}): Promise<Script>;
export declare function parseFile(path: string, options?: ParseOptions): Promise<Module>;
export declare function parseFileSync(path: string, options: ParseOptions & {
isModule: false;
}): Script;
export declare function parseFileSync(path: string, options?: ParseOptions): Module;
export declare function print(m: Program, options?: Options): Promise<Output>;
export declare function printSync(m: Program, options?: Options): Output;
export declare function transform(src: string | Program, options?: Options): Promise<Output>;
export declare function transformSync(src: string | Program, options?: Options): Output;
export declare function transformFile(path: string, options?: Options): Promise<Output>;
export declare function transformFileSync(path: string, options?: Options): Output;
export declare function bundle(options?: BundleInput | string): Promise<{
[name: string]: Output;
}>;
export declare function minify(src: string | Buffer, opts?: JsMinifyOptions, extras?: NapiMinifyExtra): Promise<Output>;
export declare function minifySync(src: string | Buffer, opts?: JsMinifyOptions, extras?: NapiMinifyExtra): Output;
/**
* Configure custom trace configuration runs for a process lifecycle.
* Currently only chromium's trace event format is supported.
* (https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview)
*
* This should be called before calling any binding interfaces exported in `@swc/core`, such as
* `transform*`, or `parse*` or anything. To avoid breaking changes, each binding fn internally
* sets default trace subscriber if not set.
*
* Unlike other configuration, this does not belong to individual api surface using swcrc
* or api's parameters (`transform(..., {trace})`). This is due to current tracing subscriber
* can be configured only once for the global scope. Calling `registerGlobalTraceConfig` multiple
* time won't cause error, subsequent calls will be ignored.
*
* As name implies currently this is experimental interface may change over time without semver
* major breaking changes. Please provide feedbacks,
* or bug report at https://github.com/swc-project/swc/discussions.
*/
export declare function __experimental_registerGlobalTraceConfig(traceConfig: {
type: "traceEvent";
fileName?: string;
}): void;
/**
* @ignore
*
* Returns current binary's metadata to determine which binary is actually loaded.
*
* This is undocumented interface, does not guarantee stability across `@swc/core`'s semver
* as internal representation may change anytime. Use it with caution.
*/
export declare function getBinaryMetadata(): {
target: string | undefined;
};
export declare const DEFAULT_EXTENSIONS: readonly string[];
@@ -0,0 +1,43 @@
"use strict";
/* @minVersion 7.22.0 */
function dispose_SuppressedError(suppressed, error) {
if (typeof SuppressedError !== "undefined") {
// eslint-disable-next-line no-undef
dispose_SuppressedError = SuppressedError;
} else {
dispose_SuppressedError = function SuppressedError(suppressed, error) {
this.suppressed = suppressed;
this.error = error;
this.stack = new Error().stack;
};
dispose_SuppressedError.prototype = Object.create(Error.prototype, { constructor: { value: dispose_SuppressedError, writable: true, configurable: true } });
}
return new dispose_SuppressedError(suppressed, error);
}
function _dispose(stack, error, hasError) {
function next() {
while (stack.length > 0) {
try {
var r = stack.pop();
var p = r.d.call(r.v);
if (r.a) return Promise.resolve(p).then(next, err);
} catch (e) {
return err(e);
}
}
if (hasError) throw error;
}
function err(e) {
error = hasError ? new dispose_SuppressedError(e, error) : e;
hasError = true;
return next();
}
return next();
}
exports._ = _dispose;
@@ -0,0 +1,3 @@
export function flow(...transforms) {
return (block) => transforms.reduce((block, t) => t(block), block);
}
@@ -0,0 +1 @@
{"name":"eslint","version":"9.39.1","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532092604,"integrity":"sha512-T2C622nmNAYjHKhwFTSb65JUU30ZjZOqvq70hIj012qeopB+QvPXqCYYfR7RUeDUJ8RKUkGyr4D6keNLw4bJ9g==","mode":420,"size":1094},"lib/rules/accessor-pairs.js":{"checkedAt":1794532092605,"integrity":"sha512-k2ERJ/MAUxldKT1b2weQX11dHCQJ4ExALYZeDcWDsGIKYwiMkkx6zjMPHjC/X6nmrHxa1GCWxkdSwB39rgA+6g==","mode":420,"size":11210},"lib/shared/ajv.js":{"checkedAt":1794532092605,"integrity":"sha512-R6UCYxtqJV+gRVtlDQOMcYr7Sq/2+ftAHAE4Fe4ihz+rSs6i3fRLwjtvK9+rM3/luyCR2niisYgz2WAIYVQyaQ==","mode":420,"size":931},"messages/all-files-ignored.js":{"checkedAt":1794532092605,"integrity":"sha512-+2ITpgKewX7WylQHbFBkhsvsV/RmaX9GOfOywom15B5YS7hz7tC4gArK6Zzig5MpjIaeJovvzknc8mmsXfUMDA==","mode":420,"size":660},"messages/all-matched-files-ignored.js":{"checkedAt":1794532092605,"integrity":"sha512-JhhReXaDW7s2hdsErKasCYHZOJsS9Q5WU2hFqrHFaJNyfDG9QT/+dk355+wdRz/wyQYcnCiYDWzAqO4SfG0L8Q==","mode":420,"size":1025},"lib/api.js":{"checkedAt":1794532092605,"integrity":"sha512-GG8giKpAk1tR5YYL6nZOpz8zB/cbMXA8FLyGeaxnK8gQ+Iqj/uRICv6jcxFlBaFehC0xC/2kUZieKN4HoK7qGA==","mode":420,"size":1609},"lib/linter/apply-disable-directives.js":{"checkedAt":1794532092605,"integrity":"sha512-Vbe/siIbgOlwTlCe2h6b2myi4aSSlR3h+zDX9yedG7zijXPEVLmscAfdFp6fThZm2QydktxxIuoQdmPiZtqoOg==","mode":420,"size":19105},"lib/rules/array-bracket-newline.js":{"checkedAt":1794532092605,"integrity":"sha512-XsC1rEhGIBkZ0WqKvwp1wnQpLGrCWCJh+SC0O8RCi1gRY2a/9HsCoEgAr2W9nvq1qJyuycFR25dHLh7Hs6/mjA==","mode":420,"size":8123},"lib/rules/array-bracket-spacing.js":{"checkedAt":1794532092605,"integrity":"sha512-TJcdpEDxC7oaghUJPBZqM8eYhNe+3NoemJ2oWxlhd1gYy7BXXSk10GqJX9g3YShg56E5rCcB7yYI27AYGRRqZA==","mode":420,"size":8071},"lib/rules/array-callback-return.js":{"checkedAt":1794532092606,"integrity":"sha512-9k+f+blkc/rV/NUWsqrXVto+Pn5uJqREU/KdfjxAiv/5zDD9AEvghn2nmX8tc0PR12QqUJvpMyFeiKMEgxeshA==","mode":420,"size":12815},"lib/rules/array-element-newline.js":{"checkedAt":1794532092606,"integrity":"sha512-TK1fdCDWkxKmEV9sTmqrrEAIiHXs9uKIbbNwihCmR3uXGFMZ839RGeMTMsiZqdWPRruvVbid82SguNnbWhtmXQ==","mode":420,"size":9070},"lib/rules/arrow-body-style.js":{"checkedAt":1794532092606,"integrity":"sha512-2CzQfEGGZ16lwo0PSPIykkj/Euwq2Vjy1VvgE6UDjPUj8Fh1+9OzpdapSghu7OdL4lm6M/inGWpA5kXo9NatlQ==","mode":420,"size":10365},"lib/rules/arrow-parens.js":{"checkedAt":1794532092606,"integrity":"sha512-Ek/3UhrfzI5N2mj5UEHKugKbgMiJ+WBl3lMFWdt03DrhXakIS+wmXFnQMxHGbHCnPWPasuPNdNaLC8cR7yVr8Q==","mode":420,"size":7119},"lib/rules/arrow-spacing.js":{"checkedAt":1794532092606,"integrity":"sha512-UGjhkLLt/NJoTBM1QU4dC0fkD0/9pT3narCEhSGodPnOCXnTOhLs/AZh5NSE1JchsklTVZLR71xtZPMTesWjcg==","mode":420,"size":4618},"lib/shared/assert.js":{"checkedAt":1794532092606,"integrity":"sha512-1vXYYhuW6k7HL3DUoIBY/lfqemnbR4C4Z1f1iiH1Igg9IneKmOQLbgkDzsOhmG1hMieUATcJPD47jjVuDoDlvA==","mode":420,"size":524},"lib/rules/utils/ast-utils.js":{"checkedAt":1794532092606,"integrity":"sha512-tyX8daE1wh3BD1wLJRfCGQ5kXJ8sfu0wQhTNr+UIcs2k4KZPlu2da2wEo1p9GGvOKMtcGD2EJ1WTkF6u8DO7HQ==","mode":420,"size":79320},"lib/shared/ast-utils.js":{"checkedAt":1794532092607,"integrity":"sha512-mLWFJfkZZM+QZC3JG3WRqvT5GUYx4ci/btLZsjxSOxURjy93ILez6vBgmB9frwjr8dCxq1eD+PiJKcDMkZdeyA==","mode":420,"size":897},"lib/languages/js/source-code/token-store/backward-token-comment-cursor.js":{"checkedAt":1794532092607,"integrity":"sha512-Vdu3XYpMFe3uw1EBuSiEfefcokXnRhYk8Nvb+fWLGfGF0iIkf1eZMGf6VD1KOjEKVDACBFEn+hm/GAhdgARsRQ==","mode":420,"size":1877},"lib/languages/js/source-code/token-store/backward-token-cursor.js":{"checkedAt":1794532092607,"integrity":"sha512-8O7slId1ceEoW05v8V2eGXjr/LP4z8/FCTBTWClfYjlfgYz0ta07pbKPD/fydN6PEkuaukOEUkR84QL8Xc9oHQ==","mode":420,"size":1606},"lib/rules/block-scoped-var.js":{"checkedAt":1794532092607,"integrity":"sha512-NuL3SVkj1gO6wJMygiJpWX4TO5M0OikRuDC+OrIOBLGheHNr9e6P7Tr9C2kufgKq0wyhDXCH3h8JUixRwG0QTQ==","mode":420,"size":3501},"lib/rules/block-spacing.js":{"checkedAt":1794532092607,"integrity":"sha512-8UjH0/koLQchDXAqqRBC40GSQnjmsbvdeV+Mv9oq9m8GfSSbBLeneFtzs3Ha16rVZC1K6bO9eaxolckqFVZBxg==","mode":420,"size":5159},"lib/rules/brace-style.js":{"checkedAt":1794532092607,"integrity":"sha512-9gRImo40BWxzZHXufDeBznYuDKCZgArCn+B8UPi1XR1A8uATNxdGyGScLj3IdaemD0jA2UvygJgheGTvo5RPcg==","mode":420,"size":7592},"lib/rules/callback-return.js":{"checkedAt":1794532092607,"integrity":"sha512-7b2KnamDWtqTN5iOSnSkCPHj9TKi5w5dvHr+JiE1gFUnDMuGnFB6Sj3rGxXIGPGYT1WvEogkDZ2vVKbf3kIDAA==","mode":420,"size":5879},"lib/rules/camelcase.js":{"checkedAt":1794532092607,"integrity":"sha512-vuMkyKxiGNVgqgyQBJL1hF7rycKw/KMRex+U2Qebrj81jSa6Lwji1fbBoc0NYlZz5lNR1f7ubmb7VLpjKqYkJA==","mode":420,"size":10363},"lib/rules/capitalized-comments.js":{"checkedAt":1794532092608,"integrity":"sha512-KoyeahLMs/Zll7YslVc6n2PDXOVv++Y0MV/8b/pzitOBB8dUqHpjzVj1jbB2TVCEO/6KRqO/l0UlkT9jPjQPmQ==","mode":420,"size":9285},"lib/rules/utils/char-source.js":{"checkedAt":1794532092608,"integrity":"sha51Line truncated
@@ -0,0 +1,23 @@
(The MIT License)
Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2016-2017 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,26 @@
/**
* Encode certain characters in `value`.
*
* @param {string} value
* @param {CoreWithFormatOptions} options
* @returns {string}
*/
export function core(value: string, options: CoreWithFormatOptions): string;
export type CoreOptions = {
/**
* Whether to only escape the given subset of characters.
*/
subset?: ReadonlyArray<string>;
/**
* Whether to only escape possibly dangerous characters.
* Those characters are `"`, `&`, `'`, `<`, `>`, and `` ` ``.
*/
escapeOnly?: boolean;
};
export type FormatOptions = {
/**
* Format strategy.
*/
format: (code: number, next: number, options: CoreWithFormatOptions) => string;
};
export type CoreWithFormatOptions = CoreOptions & FormatOptions & import('./util/format-smart.js').FormatSmartOptions;
@@ -0,0 +1,63 @@
import {useUNSTABLE_PortalContext as $96b38030c423d352$export$574e9b0fb070c3b0} from "./PortalProvider.mjs";
import {ClearPressResponder as $1CM7W$ClearPressResponder} from "@react-aria/interactions";
import {FocusScope as $1CM7W$FocusScope} from "@react-aria/focus";
import $1CM7W$react, {useState as $1CM7W$useState, useMemo as $1CM7W$useMemo, useContext as $1CM7W$useContext} from "react";
import $1CM7W$reactdom from "react-dom";
import {useIsSSR as $1CM7W$useIsSSR} from "@react-aria/ssr";
import {useLayoutEffect as $1CM7W$useLayoutEffect} from "@react-aria/utils";
/*
* 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.
*/
const $337b884510726a0d$export$a2200b96afd16271 = /*#__PURE__*/ (0, $1CM7W$react).createContext(null);
function $337b884510726a0d$export$c6fdb837b070b4ff(props) {
let isSSR = (0, $1CM7W$useIsSSR)();
let { portalContainer: portalContainer = isSSR ? null : document.body, isExiting: isExiting } = props;
let [contain, setContain] = (0, $1CM7W$useState)(false);
let contextValue = (0, $1CM7W$useMemo)(()=>({
contain: contain,
setContain: setContain
}), [
contain,
setContain
]);
let { getContainer: getContainer } = (0, $96b38030c423d352$export$574e9b0fb070c3b0)();
if (!props.portalContainer && getContainer) portalContainer = getContainer();
if (!portalContainer) return null;
let contents = props.children;
if (!props.disableFocusManagement) contents = /*#__PURE__*/ (0, $1CM7W$react).createElement((0, $1CM7W$FocusScope), {
restoreFocus: true,
contain: contain && !isExiting
}, contents);
contents = /*#__PURE__*/ (0, $1CM7W$react).createElement($337b884510726a0d$export$a2200b96afd16271.Provider, {
value: contextValue
}, /*#__PURE__*/ (0, $1CM7W$react).createElement((0, $1CM7W$ClearPressResponder), null, contents));
return /*#__PURE__*/ (0, $1CM7W$reactdom).createPortal(contents, portalContainer);
}
function $337b884510726a0d$export$14c98a7594375490() {
let ctx = (0, $1CM7W$useContext)($337b884510726a0d$export$a2200b96afd16271);
let setContain = ctx === null || ctx === void 0 ? void 0 : ctx.setContain;
(0, $1CM7W$useLayoutEffect)(()=>{
setContain === null || setContain === void 0 ? void 0 : setContain(true);
}, [
setContain
]);
}
export {$337b884510726a0d$export$a2200b96afd16271 as OverlayContext, $337b884510726a0d$export$c6fdb837b070b4ff as Overlay, $337b884510726a0d$export$14c98a7594375490 as useOverlayFocusContain};
//# sourceMappingURL=Overlay.module.js.map
@@ -0,0 +1,7 @@
export const BITS = 32;
export const GROUPS = 4;
export const RE_ADDRESS =
/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g;
export const RE_SUBNET_STRING = /\/\d{1,2}$/;
@@ -0,0 +1,302 @@
let featureQueries = require('caniuse-lite/data/features/css-featurequeries.js')
let feature = require('caniuse-lite/dist/unpacker/feature')
let { parse } = require('postcss')
let brackets = require('./brackets')
let Browsers = require('./browsers')
let utils = require('./utils')
let Value = require('./value')
let data = feature(featureQueries)
let supported = []
for (let browser in data.stats) {
let versions = data.stats[browser]
for (let version in versions) {
let support = versions[version]
if (/y/.test(support)) {
supported.push(browser + ' ' + version)
}
}
}
class Supports {
constructor(Prefixes, all) {
this.Prefixes = Prefixes
this.all = all
}
/**
* Add prefixes
*/
add(nodes, all) {
return nodes.map(i => {
if (this.isProp(i)) {
let prefixed = this.prefixed(i[0])
if (prefixed.length > 1) {
return this.convert(prefixed)
}
return i
}
if (typeof i === 'object') {
return this.add(i, all)
}
return i
})
}
/**
* Clean brackets with one child
*/
cleanBrackets(nodes) {
return nodes.map(i => {
if (typeof i !== 'object') {
return i
}
if (i.length === 1 && typeof i[0] === 'object') {
return this.cleanBrackets(i[0])
}
return this.cleanBrackets(i)
})
}
/**
* Add " or " between properties and convert it to brackets format
*/
convert(progress) {
let result = ['']
for (let i of progress) {
result.push([`${i.prop}: ${i.value}`])
result.push(' or ')
}
result[result.length - 1] = ''
return result
}
/**
* Check global options
*/
disabled(node) {
if (!this.all.options.grid) {
if (node.prop === 'display' && node.value.includes('grid')) {
return true
}
if (node.prop.includes('grid') || node.prop === 'justify-items') {
return true
}
}
if (this.all.options.flexbox === false) {
if (node.prop === 'display' && node.value.includes('flex')) {
return true
}
let other = ['order', 'justify-content', 'align-items', 'align-content']
if (node.prop.includes('flex') || other.includes(node.prop)) {
return true
}
}
return false
}
/**
* Return true if prefixed property has no unprefixed
*/
isHack(all, unprefixed) {
let check = new RegExp(`(\\(|\\s)${utils.escapeRegexp(unprefixed)}:`)
return !check.test(all)
}
/**
* Return true if brackets node is "not" word
*/
isNot(node) {
return typeof node === 'string' && /not\s*/i.test(node)
}
/**
* Return true if brackets node is "or" word
*/
isOr(node) {
return typeof node === 'string' && /\s*or\s*/i.test(node)
}
/**
* Return true if brackets node is (prop: value)
*/
isProp(node) {
return (
typeof node === 'object' &&
node.length === 1 &&
typeof node[0] === 'string'
)
}
/**
* Compress value functions into a string nodes
*/
normalize(nodes) {
if (typeof nodes !== 'object') {
return nodes
}
nodes = nodes.filter(i => i !== '')
if (typeof nodes[0] === 'string') {
let firstNode = nodes[0].trim()
if (
firstNode.includes(':') ||
firstNode === 'selector' ||
firstNode === 'not selector'
) {
return [brackets.stringify(nodes)]
}
}
return nodes.map(i => this.normalize(i))
}
/**
* Parse string into declaration property and value
*/
parse(str) {
let parts = str.split(':')
let prop = parts[0]
let value = parts[1]
if (!value) value = ''
return [prop.trim(), value.trim()]
}
/**
* Return array of Declaration with all necessary prefixes
*/
prefixed(str) {
let rule = this.virtual(str)
if (this.disabled(rule.first)) {
return rule.nodes
}
let result = { warn: () => null }
let prefixer = this.prefixer().add[rule.first.prop]
prefixer && prefixer.process && prefixer.process(rule.first, result)
for (let decl of rule.nodes) {
for (let value of this.prefixer().values('add', rule.first.prop)) {
value.process(decl)
}
Value.save(this.all, decl)
}
return rule.nodes
}
/**
* Return prefixer only with @supports supported browsers
*/
prefixer() {
if (this.prefixerCache) {
return this.prefixerCache
}
let filtered = this.all.browsers.selected.filter(i => {
return supported.includes(i)
})
let browsers = new Browsers(
this.all.browsers.data,
filtered,
this.all.options
)
this.prefixerCache = new this.Prefixes(
this.all.data,
browsers,
this.all.options
)
return this.prefixerCache
}
/**
* Add prefixed declaration
*/
process(rule) {
let ast = brackets.parse(rule.params)
ast = this.normalize(ast)
ast = this.remove(ast, rule.params)
ast = this.add(ast, rule.params)
ast = this.cleanBrackets(ast)
rule.params = brackets.stringify(ast)
}
/**
* Remove all unnecessary prefixes
*/
remove(nodes, all) {
let i = 0
while (i < nodes.length) {
if (
!this.isNot(nodes[i - 1]) &&
this.isProp(nodes[i]) &&
this.isOr(nodes[i + 1])
) {
if (this.toRemove(nodes[i][0], all)) {
nodes.splice(i, 2)
continue
}
i += 2
continue
}
if (typeof nodes[i] === 'object') {
nodes[i] = this.remove(nodes[i], all)
}
i += 1
}
return nodes
}
/**
* Return true if we need to remove node
*/
toRemove(str, all) {
let [prop, value] = this.parse(str)
let unprefixed = this.all.unprefixed(prop)
let cleaner = this.all.cleaner()
if (
cleaner.remove[prop] &&
cleaner.remove[prop].remove &&
!this.isHack(all, unprefixed)
) {
return true
}
for (let checker of cleaner.values('remove', unprefixed)) {
if (checker.check(value)) {
return true
}
}
return false
}
/**
* Create virtual rule to process it by prefixer
*/
virtual(str) {
let [prop, value] = this.parse(str)
let rule = parse('a{}').first
rule.append({ prop, raws: { before: '' }, value })
return rule
}
}
module.exports = Supports
@@ -0,0 +1,291 @@
/**
* @fileoverview Enforce all elements that require alternative text have it.
* @author Ethan Cohen
*/
// -----------------------------------------------------------------------------
// Requirements
// -----------------------------------------------------------------------------
import { RuleTester } from 'eslint';
import parserOptionsMapper from '../../__util__/parserOptionsMapper';
import parsers from '../../__util__/helpers/parsers';
import rule from '../../../src/rules/alt-text';
// -----------------------------------------------------------------------------
// Tests
// -----------------------------------------------------------------------------
const ruleTester = new RuleTester();
const missingPropError = (type) => ({
message: `${type} elements must have an alt prop, either with meaningful text, or an empty string for decorative images.`,
type: 'JSXOpeningElement',
});
const altValueError = (type) => ({
message: `Invalid alt value for ${type}. \
Use alt="" for presentational images.`,
type: 'JSXOpeningElement',
});
const ariaLabelValueError = {
message: 'The aria-label attribute must have a value. The alt attribute is preferred over aria-label for images.',
};
const ariaLabelledbyValueError = {
message: 'The aria-labelledby attribute must have a value. The alt attribute is preferred over aria-labelledby for images.',
};
const preferAltError = () => ({
message: 'Prefer alt="" over a presentational role. First rule of aria is to not use aria if it can be achieved via native HTML.',
type: 'JSXOpeningElement',
});
const objectError = {
message: 'Embedded <object> elements must have alternative text by providing inner text, aria-label or aria-labelledby props.',
};
const areaError = {
message: 'Each area of an image map must have a text alternative through the `alt`, `aria-label`, or `aria-labelledby` prop.',
};
const inputImageError = {
message: '<input> elements with type="image" must have a text alternative through the `alt`, `aria-label`, or `aria-labelledby` prop.',
};
const componentsSettings = {
'jsx-a11y': {
polymorphicPropName: 'as',
components: {
Input: 'input',
},
},
};
const array = [{
img: ['Thumbnail', 'Image'],
object: ['Object'],
area: ['Area'],
'input[type="image"]': ['InputImage'],
}];
ruleTester.run('alt-text', rule, {
valid: parsers.all([].concat(
// DEFAULT ELEMENT 'img' TESTS
{ code: '<img alt="foo" />;' },
{ code: '<img alt={"foo"} />;' },
{ code: '<img alt={alt} />;' },
{ code: '<img ALT="foo" />;' },
{ code: '<img ALT={`This is the ${alt} text`} />;' },
{ code: '<img ALt="foo" />;' },
{ code: '<img alt="foo" salt={undefined} />;' },
{ code: '<img {...this.props} alt="foo" />' },
{ code: '<a />' },
{ code: '<div />' },
{ code: '<img alt={function(e) {} } />' },
{ code: '<div alt={function(e) {} } />' },
{ code: '<img alt={() => void 0} />' },
{ code: '<IMG />' },
{ code: '<UX.Layout>test</UX.Layout>' },
{ code: '<img alt={alt || "Alt text" } />' },
{ code: '<img alt={photo.caption} />;' },
{ code: '<img alt={bar()} />;' },
{ code: '<img alt={foo.bar || ""} />' },
{ code: '<img alt={bar() || ""} />' },
{ code: '<img alt={foo.bar() || ""} />' },
{ code: '<img alt="" />' },
{ code: '<img alt={`${undefined}`} />' },
{ code: '<img alt=" " />' },
{ code: '<img alt="" role="presentation" />' },
{ code: '<img alt="" role="none" />' },
{ code: '<img alt="" role={`presentation`} />' },
{ code: '<img alt="" role={"presentation"} />' },
{ code: '<img alt="this is lit..." role="presentation" />' },
{ code: '<img alt={error ? "not working": "working"} />' },
{ code: '<img alt={undefined ? "working": "not working"} />' },
{ code: '<img alt={plugin.name + " Logo"} />' },
{ code: '<img aria-label="foo" />' },
{ code: '<img aria-labelledby="id1" />' },
// DEFAULT <object> TESTS
{ code: '<object aria-label="foo" />' },
{ code: '<object aria-labelledby="id1" />' },
{ code: '<object>Foo</object>' },
{ code: '<object><p>This is descriptive!</p></object>' },
{ code: '<Object />' },
{ code: '<object title="An object" />' },
// DEFAULT <area> TESTS
{ code: '<area aria-label="foo" />' },
{ code: '<area aria-labelledby="id1" />' },
{ code: '<area alt="" />' },
{ code: '<area alt="This is descriptive!" />' },
{ code: '<area alt={altText} />' },
{ code: '<Area />' },
// DEFAULT <input type="image"> TESTS
{ code: '<input />' },
{ code: '<input type="foo" />' },
{ code: '<input type="image" aria-label="foo" />' },
{ code: '<input type="image" aria-labelledby="id1" />' },
{ code: '<input type="image" alt="" />' },
{ code: '<input type="image" alt="This is descriptive!" />' },
{ code: '<input type="image" alt={altText} />' },
{ code: '<InputImage />' },
{ code: '<Input type="image" alt="" />', settings: componentsSettings },
{ code: '<SomeComponent as="input" type="image" alt="" />', settings: componentsSettings },
// CUSTOM ELEMENT TESTS FOR ARRAY OPTION TESTS
{ code: '<Thumbnail alt="foo" />;', options: array },
{ code: '<Thumbnail alt={"foo"} />;', options: array },
{ code: '<Thumbnail alt={alt} />;', options: array },
{ code: '<Thumbnail ALT="foo" />;', options: array },
{ code: '<Thumbnail ALT={`This is the ${alt} text`} />;', options: array },
{ code: '<Thumbnail ALt="foo" />;', options: array },
{ code: '<Thumbnail alt="foo" salt={undefined} />;', options: array },
{ code: '<Thumbnail {...this.props} alt="foo" />', options: array },
{ code: '<thumbnail />', options: array },
{ code: '<Thumbnail alt={function(e) {} } />', options: array },
{ code: '<div alt={function(e) {} } />', options: array },
{ code: '<Thumbnail alt={() => void 0} />', options: array },
{ code: '<THUMBNAIL />', options: array },
{ code: '<Thumbnail alt={alt || "foo" } />', options: array },
{ code: '<Image alt="foo" />;', options: array },
{ code: '<Image alt={"foo"} />;', options: array },
{ code: '<Image alt={alt} />;', options: array },
{ code: '<Image ALT="foo" />;', options: array },
{ code: '<Image ALT={`This is the ${alt} text`} />;', options: array },
{ code: '<Image ALt="foo" />;', options: array },
{ code: '<Image alt="foo" salt={undefined} />;', options: array },
{ code: '<Image {...this.props} alt="foo" />', options: array },
{ code: '<image />', options: array },
{ code: '<Image alt={function(e) {} } />', options: array },
{ code: '<div alt={function(e) {} } />', options: array },
{ code: '<Image alt={() => void 0} />', options: array },
{ code: '<IMAGE />', options: array },
{ code: '<Image alt={alt || "foo" } />', options: array },
{ code: '<Object aria-label="foo" />', options: array },
{ code: '<Object aria-labelledby="id1" />', options: array },
{ code: '<Object>Foo</Object>', options: array },
{ code: '<Object><p>This is descriptive!</p></Object>', options: array },
{ code: '<Object title="An object" />', options: array },
{ code: '<Area aria-label="foo" />', options: array },
{ code: '<Area aria-labelledby="id1" />', options: array },
{ code: '<Area alt="" />', options: array },
{ code: '<Area alt="This is descriptive!" />', options: array },
{ code: '<Area alt={altText} />', options: array },
{ code: '<InputImage aria-label="foo" />', options: array },
{ code: '<InputImage aria-labelledby="id1" />', options: array },
{ code: '<InputImage alt="" />', options: array },
{ code: '<InputImage alt="This is descriptive!" />', options: array },
{ code: '<InputImage alt={altText} />', options: array },
)).map(parserOptionsMapper),
invalid: parsers.all([].concat(
// DEFAULT ELEMENT 'img' TESTS
{ code: '<img />;', errors: [missingPropError('img')] },
{ code: '<img alt />;', errors: [altValueError('img')] },
{ code: '<img alt={undefined} />;', errors: [altValueError('img')] },
{ code: '<img src="xyz" />', errors: [missingPropError('img')] },
{ code: '<img role />', errors: [missingPropError('img')] },
{ code: '<img {...this.props} />', errors: [missingPropError('img')] },
{ code: '<img alt={false || false} />', errors: [altValueError('img')] },
{ code: '<img alt={undefined} role="presentation" />;', errors: [altValueError('img')] },
{ code: '<img alt role="presentation" />;', errors: [altValueError('img')] },
{ code: '<img role="presentation" />;', errors: [preferAltError()] },
{ code: '<img role="none" />;', errors: [preferAltError()] },
{ code: '<img aria-label={undefined} />', errors: [ariaLabelValueError] },
{ code: '<img aria-labelledby={undefined} />', errors: [ariaLabelledbyValueError] },
{ code: '<img aria-label="" />', errors: [ariaLabelValueError] },
{ code: '<img aria-labelledby="" />', errors: [ariaLabelledbyValueError] },
{ code: '<SomeComponent as="img" aria-label="" />', settings: componentsSettings, errors: [ariaLabelValueError] },
// DEFAULT ELEMENT 'object' TESTS
{ code: '<object />', errors: [objectError] },
{ code: '<object><div aria-hidden /></object>', errors: [objectError] },
{ code: '<object title={undefined} />', errors: [objectError] },
{ code: '<object aria-label="" />', errors: [objectError] },
{ code: '<object aria-labelledby="" />', errors: [objectError] },
{ code: '<object aria-label={undefined} />', errors: [objectError] },
{ code: '<object aria-labelledby={undefined} />', errors: [objectError] },
// DEFAULT ELEMENT 'area' TESTS
{ code: '<area />', errors: [areaError] },
{ code: '<area alt />', errors: [areaError] },
{ code: '<area alt={undefined} />', errors: [areaError] },
{ code: '<area src="xyz" />', errors: [areaError] },
{ code: '<area {...this.props} />', errors: [areaError] },
{ code: '<area aria-label="" />', errors: [areaError] },
{ code: '<area aria-label={undefined} />', errors: [areaError] },
{ code: '<area aria-labelledby="" />', errors: [areaError] },
{ code: '<area aria-labelledby={undefined} />', errors: [areaError] },
// DEFAULT ELEMENT 'input type="image"' TESTS
{ code: '<input type="image" />', errors: [inputImageError] },
{ code: '<input type="image" alt />', errors: [inputImageError] },
{ code: '<input type="image" alt={undefined} />', errors: [inputImageError] },
{ code: '<input type="image">Foo</input>', errors: [inputImageError] },
{ code: '<input type="image" {...this.props} />', errors: [inputImageError] },
{ code: '<input type="image" aria-label="" />', errors: [inputImageError] },
{ code: '<input type="image" aria-label={undefined} />', errors: [inputImageError] },
{ code: '<input type="image" aria-labelledby="" />', errors: [inputImageError] },
{ code: '<input type="image" aria-labelledby={undefined} />', errors: [inputImageError] },
// CUSTOM ELEMENT TESTS FOR ARRAY OPTION TESTS
{
code: '<Thumbnail />;',
errors: [missingPropError('Thumbnail')],
options: array,
},
{
code: '<Thumbnail alt />;',
errors: [altValueError('Thumbnail')],
options: array,
},
{
code: '<Thumbnail alt={undefined} />;',
errors: [altValueError('Thumbnail')],
options: array,
},
{
code: '<Thumbnail src="xyz" />',
errors: [missingPropError('Thumbnail')],
options: array,
},
{
code: '<Thumbnail {...this.props} />',
errors: [missingPropError('Thumbnail')],
options: array,
},
{ code: '<Image />;', errors: [missingPropError('Image')], options: array },
{ code: '<Image alt />;', errors: [altValueError('Image')], options: array },
{
code: '<Image alt={undefined} />;',
errors: [altValueError('Image')],
options: array,
},
{
code: '<Image src="xyz" />',
errors: [missingPropError('Image')],
options: array,
},
{
code: '<Image {...this.props} />',
errors: [missingPropError('Image')],
options: array,
},
{ code: '<Object />', errors: [objectError], options: array },
{ code: '<Object><div aria-hidden /></Object>', errors: [objectError], options: array },
{ code: '<Object title={undefined} />', errors: [objectError], options: array },
{ code: '<Area />', errors: [areaError], options: array },
{ code: '<Area alt />', errors: [areaError], options: array },
{ code: '<Area alt={undefined} />', errors: [areaError], options: array },
{ code: '<Area src="xyz" />', errors: [areaError], options: array },
{ code: '<Area {...this.props} />', errors: [areaError], options: array },
{ code: '<InputImage />', errors: [inputImageError], options: array },
{ code: '<InputImage alt />', errors: [inputImageError], options: array },
{ code: '<InputImage alt={undefined} />', errors: [inputImageError], options: array },
{ code: '<InputImage>Foo</InputImage>', errors: [inputImageError], options: array },
{ code: '<InputImage {...this.props} />', errors: [inputImageError], options: array },
{ code: '<Input type="image" />', errors: [inputImageError], settings: componentsSettings },
)).map(parserOptionsMapper),
});
@@ -0,0 +1,72 @@
{
"name": "fast-xml-parser",
"version": "4.5.3",
"description": "Validate XML, Parse XML, Build XML without C/C++ based libraries",
"main": "./src/fxp.js",
"scripts": {
"test": "nyc --reporter=lcov --reporter=text jasmine spec/*spec.js",
"test-types": "tsc --noEmit spec/typings/typings-test.ts",
"unit": "jasmine",
"coverage": "nyc report --reporter html --reporter text -t .nyc_output --report-dir .nyc_output/summary",
"perf": "node ./benchmark/perfTest3.js",
"lint": "eslint src/*.js spec/*.js",
"bundle": "webpack --config webpack-prod.config.js",
"prettier": "prettier --write src/**/*.js",
"publish-please": "publish-please",
"checkReadiness": "publish-please --dry-run"
},
"bin": {
"fxparser": "./src/cli/cli.js"
},
"repository": {
"type": "git",
"url": "https://github.com/NaturalIntelligence/fast-xml-parser"
},
"keywords": [
"fast",
"xml",
"json",
"parser",
"xml2js",
"x2js",
"xml2json",
"js",
"cli",
"validator",
"validate",
"transformer",
"assert",
"js2xml",
"json2xml",
"html"
],
"author": "Amit Gupta (https://solothought.com)",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.13.10",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/register": "^7.13.8",
"@types/node": "20",
"babel-loader": "^8.2.2",
"eslint": "^8.3.0",
"he": "^1.2.0",
"jasmine": "^3.6.4",
"nyc": "^15.1.0",
"prettier": "^1.19.1",
"publish-please": "^5.5.2",
"typescript": "5",
"webpack": "^5.64.4",
"webpack-cli": "^4.9.1"
},
"typings": "src/fxp.d.ts",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/NaturalIntelligence"
}
],
"dependencies": {
"strnum": "^1.1.1"
}
}
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
/**
* @file cffStandardStrings.js
* @author mengke01(kekee000@gmail.com)
*/
var cffStandardStrings = ['.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', 'periodcentered', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', 'questiondown', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine', 'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', 'dotlessi', 'lslash', 'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu', 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter', 'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', 'twosuperior', 'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright', 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde', 'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex', 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex', 'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', 'aacute', 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla', 'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex', 'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', 'odieresis', 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis', 'ugrave', 'yacute', 'ydieresis', 'zcaron', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', '266 ff', 'onedotenleader', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', 'Dotaccentsmall', 'Macronsmall', 'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall', '001.000', '001.001', '001.002', '001.003', 'Black', 'Bold', 'Book', 'Light', 'Medium', 'Regular', 'Roman', 'Semibold'];
var _default = exports.default = cffStandardStrings;
@@ -0,0 +1,23 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = extractValueFromCallExpression;
/**
* Extractor function for a CallExpression type value node.
* A call expression looks like `bar()`
* This will return `bar` as the value to indicate its existence,
* since we can not execute the function bar in a static environment.
*
* @param - value - AST Value object with type `CallExpression`
* @returns - The extracted value converted to correct type.
*/
function extractValueFromCallExpression(value) {
// eslint-disable-next-line global-require
var getValue = require('.').default;
var args = Array.isArray(value.arguments) ? value.arguments.map(function (x) {
return getValue(x);
}).join(', ') : '';
return '' + getValue(value.callee) + (value.optional ? '?.' : '') + '(' + args + ')';
}
@@ -0,0 +1,7 @@
import { createMotionComponent } from '../../../motion/index.mjs';
function createMinimalMotionComponent(Component, options) {
return createMotionComponent(Component, options);
}
export { createMinimalMotionComponent };
@@ -0,0 +1 @@
{"version":3,"file":"getValidateError.d.ts","sourceRoot":"","sources":["../../src/logic/getValidateError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAIhE,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,GAAG,EACR,IAAI,SAAa,GAChB,UAAU,GAAG,IAAI,CAYnB"}
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=getFirstIteratorResult.spec.d.ts.map
@@ -0,0 +1,107 @@
import { asciiAlphanumeric } from 'micromark-util-character';
import { encode } from 'micromark-util-encode';
/**
* Make a value safe for injection as a URL.
*
* This encodes unsafe characters with percent-encoding and skips already
* encoded sequences (see `normalizeUri`).
* Further unsafe characters are encoded as character references (see
* `micromark-util-encode`).
*
* A regex of allowed protocols can be given, in which case the URL is
* sanitized.
* For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or
* `/^https?$/i` for `img[src]` (this is what `github.com` allows).
* If the URL includes an unknown protocol (one not matched by `protocol`, such
* as a dangerous example, `javascript:`), the value is ignored.
*
* @param {string | null | undefined} url
* URI to sanitize.
* @param {RegExp | null | undefined} [protocol]
* Allowed protocols.
* @returns {string}
* Sanitized URI.
*/
export function sanitizeUri(url, protocol) {
const value = encode(normalizeUri(url || ''));
if (!protocol) {
return value;
}
const colon = value.indexOf(':');
const questionMark = value.indexOf('?');
const numberSign = value.indexOf('#');
const slash = value.indexOf('/');
if (
// If there is no protocol, it’s relative.
colon < 0 ||
// If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
slash > -1 && colon > slash || questionMark > -1 && colon > questionMark || numberSign > -1 && colon > numberSign ||
// It is a protocol, it should be allowed.
protocol.test(value.slice(0, colon))) {
return value;
}
return '';
}
/**
* Normalize a URL.
*
* Encode unsafe characters with percent-encoding, skipping already encoded
* sequences.
*
* @param {string} value
* URI to normalize.
* @returns {string}
* Normalized URI.
*/
export function normalizeUri(value) {
/** @type {Array<string>} */
const result = [];
let index = -1;
let start = 0;
let skip = 0;
while (++index < value.length) {
const code = value.charCodeAt(index);
/** @type {string} */
let replace = '';
// A correct percent encoded value.
if (code === 37 && asciiAlphanumeric(value.charCodeAt(index + 1)) && asciiAlphanumeric(value.charCodeAt(index + 2))) {
skip = 2;
}
// ASCII.
else if (code < 128) {
if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {
replace = String.fromCharCode(code);
}
}
// Astral.
else if (code > 55_295 && code < 57_344) {
const next = value.charCodeAt(index + 1);
// A correct surrogate pair.
if (code < 56_320 && next > 56_319 && next < 57_344) {
replace = String.fromCharCode(code, next);
skip = 1;
}
// Lone surrogate.
else {
replace = "\uFFFD";
}
}
// Unicode.
else {
replace = String.fromCharCode(code);
}
if (replace) {
result.push(value.slice(start, index), encodeURIComponent(replace));
start = index + skip + 1;
replace = '';
}
if (skip) {
index += skip;
skip = 0;
}
}
return result.join('') + value.slice(start);
}
@@ -0,0 +1 @@
{"mappings":";AAAA,4BAAiB;IAAG,aAAa,CAAC,4BAAI,CAAC;IACrC,iBAAiB,CAAC,OAAS,CAAC,uFAAe,EAAE,KAAK,UAAU,CAAC,0DAAU,CAAC;IACxE,cAAc,CAAC,OAAS,GAAG,KAAK,KAAK,CAAC,kDAAQ,CAAC;IAC/C,cAAc,CAAC,4BAAI,CAAC;IACpB,kBAAkB,CAAC,OAAS,CAAC,uFAAe,EAAE,KAAK,UAAU,CAAC,0DAAU,CAAC;IACzE,sBAAsB,CAAC,wIAA4B,CAAC;IACpD,UAAU,CAAC,qBAAG,CAAC;IACf,aAAa,CAAC,kDAAQ,CAAC;IACvB,YAAY,CAAC,2GAAiB,CAAC;AACjC","sources":["packages/@react-aria/table/intl/he-IL.json"],"sourcesContent":["{\n \"ascending\": \"עולה\",\n \"ascendingSort\": \"מוין לפי עמודה {columnName} בסדר עולה\",\n \"columnSize\": \"{value} פיקסלים\",\n \"descending\": \"יורד\",\n \"descendingSort\": \"מוין לפי עמודה {columnName} בסדר יורד\",\n \"resizerDescription\": \"הקש Enter כדי לשנות את הגודל\",\n \"select\": \"בחר\",\n \"selectAll\": \"בחר הכול\",\n \"sortable\": \"עמודה שניתן למיין\"\n}\n"],"names":[],"version":3,"file":"he-IL.module.js.map"}
@@ -0,0 +1 @@
{"name":"@react-types/tabs","version":"3.3.11","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532114862,"integrity":"sha512-cil7stSp3ik41Hdv2Dj+GMcbvUfs1q+MZ2Yte0804py9i6oJJN/diCiIr/brcQOZ5ZqwAI6dgaHA7l8FZheQBw==","mode":420,"size":11335},"package.json":{"checkedAt":1794532114862,"integrity":"sha512-wkVUAD+djZoYxK06zsjbXJvUIypc31s/bdHSuR0SzQ7REH7bXoXclvT3W1FPwWhvOTR0pzLpIZQayrXNCt18BA==","mode":420,"size":523},"README.md":{"checkedAt":1794532114862,"integrity":"sha512-cNt0mp18Jzh+vGMC0vYVSOOYnsk8ItAuOjn6OP6HONCJCC/bFJExvKKeZ7V8pS6nhjS95cfhflD87ZYmBxdLrw==","mode":420,"size":135},"src/index.d.ts":{"checkedAt":1794532114862,"integrity":"sha512-jm5nEP8l7IvbxFjsQlMr5FTYiixyBJV+5+EExKRortt4zy00Dekn+B98Xb0L1O4GHDbJ3pzBnV9prPQopAdUBg==","mode":420,"size":3130}}}
@@ -0,0 +1,8 @@
export {
createStore,
combineReducers,
applyMiddleware,
compose,
isPlainObject,
isAction,
} from 'redux'
@@ -0,0 +1,5 @@
var OverloadYield = require("./OverloadYield.js");
function _awaitAsyncGenerator(e) {
return new OverloadYield(e, 0);
}
module.exports = _awaitAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"0 1 2 3 4 5 e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","2":"C L M G N O P Q H","516":"R S T U V W X Y Z a b c d"},C:{"2":"0 1 2 3 4 5 6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC 0C 1C"},D:{"1":"LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"J ZB K D E F A B C L M G N O BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X","130":"6 7 8 9 P aB AB","1028":"0 1 2 3 4 5 Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB"},E:{"1":"M G 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","2":"J ZB K D E F A B C 2C ZC 3C 4C 5C 6C aC NC","2049":"L OC 7C"},F:{"1":"0 1 2 3 4 5 x y z","2":"6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w FD GD HD ID NC uC JD OC"},G:{"1":"bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","2":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD","2049":"WD XD YD ZD aD"},H:{"2":"hD"},I:{"2":"TC J iD jD kD lD vC mD","258":"I nD"},J:{"2":"D A"},K:{"1":"H","2":"A B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"2":"A B"},O:{"2":"PC"},P:{"1":"6 7 8 9 AB BB CB DB EB FB rD sD aC tD uD vD wD xD QC RC SC yD","2":"J","258":"oD pD qD"},Q:{"2":"zD"},R:{"2":"0D"},S:{"2":"1D 2D"}},B:4,C:"Web Share API",D:true};
@@ -0,0 +1,92 @@
var composeArgs = require('./_composeArgs'),
composeArgsRight = require('./_composeArgsRight'),
countHolders = require('./_countHolders'),
createCtor = require('./_createCtor'),
createRecurry = require('./_createRecurry'),
getHolder = require('./_getHolder'),
reorder = require('./_reorder'),
replaceHolders = require('./_replaceHolders'),
root = require('./_root');
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_FLAG = 1,
WRAP_BIND_KEY_FLAG = 2,
WRAP_CURRY_FLAG = 8,
WRAP_CURRY_RIGHT_FLAG = 16,
WRAP_ARY_FLAG = 128,
WRAP_FLIP_FLAG = 512;
/**
* Creates a function that wraps `func` to invoke it with optional `this`
* binding of `thisArg`, partial application, and currying.
*
* @private
* @param {Function|string} func The function or method name to wrap.
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to prepend to those provided to
* the new function.
* @param {Array} [holders] The `partials` placeholder indexes.
* @param {Array} [partialsRight] The arguments to append to those provided
* to the new function.
* @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
* @param {Array} [argPos] The argument positions of the new function.
* @param {number} [ary] The arity cap of `func`.
* @param {number} [arity] The arity of `func`.
* @returns {Function} Returns the new wrapped function.
*/
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
var isAry = bitmask & WRAP_ARY_FLAG,
isBind = bitmask & WRAP_BIND_FLAG,
isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
isFlip = bitmask & WRAP_FLIP_FLAG,
Ctor = isBindKey ? undefined : createCtor(func);
function wrapper() {
var length = arguments.length,
args = Array(length),
index = length;
while (index--) {
args[index] = arguments[index];
}
if (isCurried) {
var placeholder = getHolder(wrapper),
holdersCount = countHolders(args, placeholder);
}
if (partials) {
args = composeArgs(args, partials, holders, isCurried);
}
if (partialsRight) {
args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
}
length -= holdersCount;
if (isCurried && length < arity) {
var newHolders = replaceHolders(args, placeholder);
return createRecurry(
func, bitmask, createHybrid, wrapper.placeholder, thisArg,
args, newHolders, argPos, ary, arity - length
);
}
var thisBinding = isBind ? thisArg : this,
fn = isBindKey ? thisBinding[func] : func;
length = args.length;
if (argPos) {
args = reorder(args, argPos);
} else if (isFlip && length > 1) {
args.reverse();
}
if (isAry && ary < length) {
args.length = ary;
}
if (this && this !== root && this instanceof wrapper) {
fn = Ctor || createCtor(fn);
}
return fn.apply(thisBinding, args);
}
return wrapper;
}
module.exports = createHybrid;
@@ -0,0 +1 @@
export declare function isFixed(node: HTMLElement, computedStyle?: CSSStyleDeclaration): boolean;
@@ -0,0 +1,7 @@
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
import { NapCatCore } from '../../../napcat-core';
export declare abstract class OB11GroupNoticeEvent extends OB11BaseNoticeEvent {
group_id: number;
user_id: number;
constructor(core: NapCatCore, group_id: number, user_id: number);
}
@@ -0,0 +1,17 @@
import { ContentInfo } from "@peculiar/asn1-cms";
import { MacData } from "./mac_data";
/**
* ```asn1
* PFX ::= SEQUENCE {
* version INTEGER {v3(3)}(v3,...),
* authSafe ContentInfo,
* macData MacData OPTIONAL
* }
* ```
*/
export declare class PFX {
version: number;
authSafe: ContentInfo;
macData: MacData;
constructor(params?: Partial<PFX>);
}
@@ -0,0 +1 @@
{"version":3,"file":"insert.d.ts","sourceRoot":"","sources":["../../src/utils/insert.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC;AAC/E,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC,EAC9B,IAAI,EAAE,CAAC,EAAE,EACT,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,GACb,CAAC,EAAE,CAAC"}
@@ -0,0 +1 @@
{"version":3,"file":"InjectFromHierarchyOptions.js","sourceRoot":"","sources":["../../../../src/metadata/models/InjectFromHierarchyOptions.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
{
"name": "promise-retry",
"version": "2.0.1",
"description": "Retries a function that returns a promise, leveraging the power of the retry module.",
"main": "index.js",
"scripts": {
"test": "mocha --bail -t 10000"
},
"bugs": {
"url": "https://github.com/IndigoUnited/node-promise-retry/issues/"
},
"repository": {
"type": "git",
"url": "git://github.com/IndigoUnited/node-promise-retry.git"
},
"keywords": [
"retry",
"promise",
"backoff",
"repeat",
"replay"
],
"author": "IndigoUnited <hello@indigounited.com> (http://indigounited.com)",
"license": "MIT",
"devDependencies": {
"expect.js": "^0.3.1",
"mocha": "^8.0.1",
"sleep-promise": "^8.0.1"
},
"dependencies": {
"err-code": "^2.0.2",
"retry": "^0.12.0"
},
"engines": {
"node": ">=10"
}
}
@@ -0,0 +1,956 @@
(function(global, factory) {
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DateManip = {}));
})(this, function(exports2) {
"use strict";
const MS_IN_SECOND = 1e3;
const MS_IN_MINUTE = 6e4;
const MS_IN_HOUR = 36e5;
const MS_IN_DAY = 864e5;
const rangeOfUnits = [
"time",
"year",
"month",
"date",
"day",
"hour",
"minute",
"second",
"millisecond",
"utcOffset"
];
function addMilliseconds(date, ms) {
date.setTime(+date + ms);
return date;
}
function addDays(date, days) {
return addMilliseconds(date, days * MS_IN_DAY);
}
function addHours(date, hours) {
return addMilliseconds(date, hours * MS_IN_HOUR);
}
function addMinutes(date, minutes) {
return addMilliseconds(date, minutes * MS_IN_MINUTE);
}
function isLeapYear$1(year) {
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
}
const arr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
const arr2 = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
function daysOfYear(year) {
return isLeapYear$1(year) ? arr2 : arr;
}
function daysInMonth(date) {
return daysOfYear(date.getFullYear())[date.getMonth()];
}
function addMonths(date, months) {
const expectedMonth = date.getMonth() + months;
const tempMaxDay = daysInMonth(new Date(date.getFullYear(), expectedMonth, 1, 0, 0, 0, 0));
const currentDay = date.getDate();
date.setMonth(expectedMonth, currentDay > tempMaxDay ? tempMaxDay : currentDay);
return date;
}
function addSeconds(date, seconds) {
return addMilliseconds(date, seconds * MS_IN_SECOND);
}
function addYears(date, years) {
return addMonths(date, years * 12);
}
const units = rangeOfUnits.reduce((acc, unit) => {
acc[unit.toUpperCase()] = unit;
return acc;
}, {});
const { DATE: DATE$5, DAY: DAY$6, HOUR: HOUR$7, MILLISECOND: MILLISECOND$3, MINUTE: MINUTE$7, MONTH: MONTH$7, SECOND: SECOND$7, TIME: TIME$1, YEAR: YEAR$7 } = units;
const compatUnits = {};
function mapUnit(key, ...args) {
for (let i = 0; i < arguments.length; i++) {
compatUnits[arguments[i]] = key;
}
}
mapUnit(YEAR$7, "Y", "y", "years");
mapUnit(MONTH$7, "M", "months");
mapUnit(DATE$5, "D", "dates");
mapUnit(DAY$6, "d", "days");
mapUnit(HOUR$7, "h", "hours");
mapUnit(MINUTE$7, "m", "minutes");
mapUnit(SECOND$7, "s", "seconds");
mapUnit(MILLISECOND$3, "ms", "milliseconds");
mapUnit(TIME$1, "t");
function normalizeUnit(u) {
return compatUnits[u];
}
const { DAY: DAY$1$1, HOUR: HOUR$1$1, MINUTE: MINUTE$1$1, MONTH: MONTH$1$1, SECOND: SECOND$1$1, YEAR: YEAR$1$1 } = units;
function addNumber(date, num, unit) {
unit = normalizeUnit(unit);
switch (unit) {
case YEAR$1$1:
return addYears(date, num);
case MONTH$1$1:
return addMonths(date, num);
case DAY$1$1:
return addDays(date, num);
case HOUR$1$1:
return addHours(date, num);
case MINUTE$1$1:
return addMinutes(date, num);
case SECOND$1$1:
return addSeconds(date, num);
default:
return addMilliseconds(date, num);
}
}
const { DAY: DAY$5, HOUR: HOUR$6, MINUTE: MINUTE$6, MONTH: MONTH$6, SECOND: SECOND$6, YEAR: YEAR$6 } = units;
function addObject(date, obj, times) {
let time = 0;
let expectedMonth = 0;
let expectedDay = 0;
Object.entries(obj).forEach(([unit, num]) => {
unit = normalizeUnit(unit);
num *= times;
switch (unit) {
case YEAR$6:
expectedMonth += num * 12;
return;
case MONTH$6:
expectedMonth += date.getMonth() + num;
return;
case DAY$5:
expectedDay = num;
return;
case HOUR$6:
num *= MS_IN_HOUR;
break;
case MINUTE$6:
num *= MS_IN_MINUTE;
break;
case SECOND$6:
num *= MS_IN_SECOND;
break;
}
time += num;
});
if (expectedMonth) {
const tempMaxDay = daysInMonth(new Date(date.getFullYear(), expectedMonth, 1, 0, 0, 0, 0));
const currentDay = date.getDate();
date.setMonth(expectedMonth, (currentDay > tempMaxDay ? tempMaxDay : currentDay) + expectedDay);
}
return addMilliseconds(date, time);
}
function add(date, num, unit) {
return typeof num === "object" && num !== null ? addObject(date, num, 1) : addNumber(date, num, unit);
}
const { YEAR: YEAR$5, MONTH: MONTH$5, DATE: DATE$4, HOUR: HOUR$5, MINUTE: MINUTE$5, SECOND: SECOND$5, MILLISECOND: MILLISECOND$2, UTC_OFFSET: UTC_OFFSET$1 } = units;
function escapeRegex(str) {
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
const TOKEN_MAP = {
YYYY: { pattern: "(\\d{1,4})", key: YEAR$5 },
// 年份
// YY: { pattern: '(\\d{1,2})', key: YEAR }, // 年份
MM: { pattern: "(\\d{1,2})", key: MONTH$5 },
// 月份
DD: { pattern: "(\\d{1,2})", key: DATE$4 },
// 日期
HH: { pattern: "(\\d{1,2})", key: HOUR$5 },
// 小时
mm: { pattern: "(\\d{1,2})", key: MINUTE$5 },
// 分钟
ss: { pattern: "(\\d{1,2})", key: SECOND$5 },
// 秒
SSS: { pattern: "(\\d{1,3})", key: MILLISECOND$2 },
// 毫秒
Z: { pattern: "(Z|[+-]\\d{2}(?::?\\d{2})?)", key: UTC_OFFSET$1 }
// 时区
};
const TOKEN_KEYS = Object.keys(TOKEN_MAP).sort((a, b) => b.length - a.length);
const TOKEN_PATTERN = new RegExp(`(${TOKEN_KEYS.join("|")})`, "g");
function compile(formatString) {
const matchedTokens = [];
const pattern2 = escapeRegex(formatString).replace(TOKEN_PATTERN, (m) => {
matchedTokens.push(m);
return TOKEN_MAP[m].pattern;
});
return { pattern: pattern2, tokens: matchedTokens };
}
function dayOfYear(date, val) {
const monthDays = daysOfYear(date.getFullYear());
const currentMonth = date.getMonth();
let dayCount = date.getDate();
for (let i = 0; i < currentMonth; i++) {
dayCount += monthDays[i];
}
if (val === void 0) {
return dayCount;
}
date.setTime(+date + (val - dayCount) * MS_IN_DAY);
return date;
}
function absFloor(v) {
return v < 0 ? Math.ceil(v) || 0 : Math.floor(v);
}
const BASIC_ISO_REGEX = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
const EXTENDED_ISO_REGEX = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
const ISO_TIMES_REGEX = [
/(\d\d):(\d\d):(\d\d)\.(\d+)/,
// 'HH:mm:ss.SSSS'
/(\d\d):(\d\d):(\d\d),(\d+)/,
// 'HH:mm:ss,SSSS'
/(\d\d):(\d\d):(\d\d)/,
// 'HH:mm:ss'
/(\d\d):(\d\d)/,
// 'HH:mm'
/(\d\d)(\d\d)(\d\d)\.(\d+)/,
// 'HHmmss.SSSS'
/(\d\d)(\d\d)(\d\d),(\d+)/,
// 'HHmmss,SSSS'
/(\d\d)(\d\d)(\d\d)/,
// 'HHmmss'
/(\d\d)(\d\d)/,
// 'HHmm'
/(\d\d)/
// 'HH'
];
const TZ_REGEX = /(Z)|([+-]\d\d)(?::?(\d\d))?/;
const ISO_DATES_REGEX = [
/(\d{4})-(\d\d)-(\d\d)/,
// 'YYYY-MM-DD'
/(\d{4})-(\d\d)/,
// 'YYYY-MM'
/(\d{4})(\d\d)(\d\d)/,
// 'YYYYMMDD'
/(\d{4})(\d\d)/,
// 'YYYYMM'
/(\d{4})/
// 'YYYY'
];
function autoExtract(input) {
const dateRet = new Array(8);
let matches;
const match = EXTENDED_ISO_REGEX.exec(input) || BASIC_ISO_REGEX.exec(input);
if (match) {
const datesLen = ISO_DATES_REGEX.length;
for (let i = 0; i < datesLen; i++) {
if (matches = ISO_DATES_REGEX[i].exec(match[1])) {
for (let j = 0; j < 3; j++) {
const matched = matches[j + 1];
dateRet[j] = matched ? +matched : 1;
}
if (dateRet[1]) {
dateRet[1] -= 1;
}
break;
}
}
matches = null;
if (match[3]) {
for (let i = 0, timesLen = ISO_TIMES_REGEX.length; i < timesLen; i++) {
if (matches = ISO_TIMES_REGEX[i].exec(match[3])) {
if (matches[4]) {
matches[4] = matches[4].padEnd(3, "00");
}
for (let j = 1, len = matches.length; j < len; j++) {
dateRet[j + 2] = +matches[j];
}
break;
}
}
}
matches = null;
if (match[4]) {
matches = TZ_REGEX.exec(match[4]);
if (matches) {
dateRet[7] = matches[1] ? NaN : +matches[2] * 60 + (matches[3] ? +matches[3] : 0);
}
}
return dateRet;
}
return input;
}
function createDate(y, m, d, h, minute, s, ms) {
let date;
if (y < 100 && y >= 0) {
date = new Date(y + 400, m, d, h, minute, s, ms);
if (isFinite(date.getFullYear())) {
date.setFullYear(y);
}
} else {
date = new Date(y, m, d, h, minute, s, ms);
}
return date;
}
function createUTCDate(y, m, d, h, minute, s, ms) {
let date;
if (y < 100 && y >= 0) {
y += 400;
date = new Date(Date.UTC(y, m, d, h, minute, s, ms));
if (isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
} else {
date = new Date(Date.UTC(y, m, d, h, minute, s, ms));
}
return date;
}
function createFromArray(input) {
const utcOffset = input[7];
const currentDate = /* @__PURE__ */ new Date();
const isUTC = Number.isNaN(utcOffset);
const flag = isUTC ? "UTC" : "";
const currentStuffing = [
currentDate[`get${flag}FullYear`](),
currentDate[`get${flag}Month`](),
currentDate[`get${flag}Date`]()
];
let i = 0;
const array = new Array(7);
for (; i < 3 && input[i] == null; ++i) {
array[i] = currentStuffing[i];
}
for (; i < 7; i++) {
array[i] = input[i] == null ? 0 : input[i];
}
let day = array[2];
if (day === 0) {
day = 1;
}
let minute = array[4];
if (!isUTC && typeof utcOffset === "number") {
minute -= utcOffset + currentDate.getTimezoneOffset();
}
return (isUTC ? createUTCDate : createDate)(
array[0],
array[1],
day,
array[3],
minute,
array[5],
array[6]
);
}
function toInteger(val) {
return parseInt(val, 10);
}
function toMonth(val) {
return parseInt(val, 10) - 1;
}
function toMilliseconds(val) {
return parseInt(val.padEnd(3, "0"), 10);
}
function parseTimezone(val) {
if (val === "Z") {
return NaN;
}
const matches = TZ_REGEX.exec(val);
return +matches[2] * 60 + (matches[3] ? +matches[3] : 0);
}
function extractWithFormat(input, format2) {
const { pattern: pattern2, tokens: tokens2 } = compile(format2);
const match = new RegExp(pattern2).exec(input);
if (!match) {
return "";
}
const parts = [];
tokens2.forEach((token, i) => {
const value = match[i + 1];
switch (token) {
case "YYYY":
parts[0] = toInteger(value);
break;
// case 'YY':
// parts[0] = toInteger(value);
// break;
case "MM":
parts[1] = toMonth(value);
break;
case "DD":
parts[2] = toInteger(value);
break;
case "HH":
parts[3] = toInteger(value);
break;
case "mm":
parts[4] = toInteger(value);
break;
case "ss":
parts[5] = toInteger(value);
break;
case "SSS":
parts[6] = toMilliseconds(value);
break;
case "Z":
parts[7] = parseTimezone(value);
break;
}
});
return parts;
}
const { DATE: DATE$3, DAY: DAY$4, HOUR: HOUR$4, MILLISECOND: MILLISECOND$1, MINUTE: MINUTE$4, MONTH: MONTH$4, SECOND: SECOND$4, YEAR: YEAR$4, UTC_OFFSET } = units;
const ASP_NET_JSON_REGEX = /^\/?Date\((-?\d+)/i;
function ensureType(value, checked) {
return checked;
}
function parseObject(obj) {
const array = [];
Object.entries(obj).forEach(([unit, value]) => {
unit = normalizeUnit(unit);
switch (unit) {
case YEAR$4:
array[0] = value;
break;
case MONTH$4:
array[1] = value;
break;
case DATE$3:
case DAY$4:
array[2] = value;
break;
case HOUR$4:
array[3] = value;
break;
case MINUTE$4:
array[4] = value;
break;
case SECOND$4:
array[5] = value;
break;
case MILLISECOND$1:
array[6] = value;
break;
case UTC_OFFSET:
array[7] = value;
break;
}
});
if (array.length === 0) {
return /* @__PURE__ */ new Date();
}
return createFromArray(array);
}
function parseString(input, format2) {
const extracted = typeof format2 === "string" && format2 ? extractWithFormat(input, format2) : autoExtract(input);
if (Array.isArray(extracted)) {
return createFromArray(extracted);
}
const matched = ASP_NET_JSON_REGEX.exec(input);
return new Date(matched !== null ? +matched[1] : Date.parse(extracted));
}
function parse$1(input, format2) {
let ret;
const whatType = typeof input;
if (ensureType(input, whatType === "string")) {
ret = parseString(input, format2);
} else if (Array.isArray(input)) {
ret = createFromArray(input);
} else if (input instanceof Date) {
ret = new Date(input);
} else if (ensureType(input, whatType === "object" && input !== null)) {
if (input.isValid && input.isValid()) {
ret = /* @__PURE__ */ new Date(+input);
} else {
ret = parseObject(input);
}
} else if (ensureType(input, whatType === "number")) {
ret = new Date(input);
} else if (ensureType(input, whatType === "undefined")) {
ret = format2 ? /* @__PURE__ */ new Date(NaN) : /* @__PURE__ */ new Date();
} else {
ret = new Date(Date.parse(input));
}
return ret;
}
function diffInDays(date, input, asFloat) {
const parsed = parse$1(input);
const output = (+date - +parsed) / MS_IN_DAY;
return asFloat ? output : absFloor(output);
}
function diffInHours(date, input, asFloat) {
const parsed = parse$1(input);
const output = (+date - +parsed) / MS_IN_HOUR;
return asFloat ? output : absFloor(output);
}
function diffInMilliseconds(date, input, asFloat) {
const parsed = parse$1(input);
const output = +date - +parsed;
return asFloat ? output : absFloor(output);
}
function diffInMinutes(date, input, asFloat) {
const parsed = parse$1(input);
const output = (+date - +parsed) / MS_IN_MINUTE;
return asFloat ? output : absFloor(output);
}
function monthDiff(a, b) {
const aTime = +a;
const bTime = +b;
if (aTime < bTime) {
return -monthDiff(b, a);
}
const wholeMonthDiff = (b.getFullYear() - a.getFullYear()) * 12 + (b.getMonth() - a.getMonth());
const anchor = +addMonths(new Date(aTime), wholeMonthDiff);
let anchor2;
let adjust;
if (bTime < anchor) {
anchor2 = +addMonths(new Date(aTime), wholeMonthDiff - 1);
adjust = (bTime - anchor) / (anchor - anchor2);
} else {
anchor2 = +addMonths(new Date(aTime), wholeMonthDiff + 1);
adjust = (bTime - anchor) / (anchor2 - anchor);
}
return -(wholeMonthDiff + adjust) || 0;
}
function diffInMonths(date, input, asFloat) {
const parsed = parse$1(input);
const output = monthDiff(date, parsed);
return asFloat ? output : absFloor(output);
}
function diffInSeconds(date, input, asFloat) {
const parsed = parse$1(input);
const output = (+date - +parsed) / MS_IN_SECOND;
return asFloat ? output : absFloor(output);
}
function diffInYears(date, input, asFloat) {
const parsed = parse$1(input);
const output = monthDiff(date, parsed) / 12;
return asFloat ? output : absFloor(output);
}
const {
DAY: DAY$3,
HOUR: HOUR$3,
MINUTE: MINUTE$3,
MONTH: MONTH$3,
SECOND: SECOND$3,
YEAR: YEAR$3
} = units;
function diff(date, input, unit, asFloat) {
unit = normalizeUnit(unit);
switch (unit) {
case YEAR$3:
return diffInYears(date, input, asFloat);
case MONTH$3:
return diffInMonths(date, input, asFloat);
// case DATE:
case DAY$3:
return diffInDays(date, input, asFloat);
case HOUR$3:
return diffInHours(date, input, asFloat);
case MINUTE$3:
return diffInMinutes(date, input, asFloat);
case SECOND$3:
return diffInSeconds(date, input, asFloat);
default:
return diffInMilliseconds(date, input, asFloat);
}
}
function startOfDate(date, y, m, d) {
return +new Date(
y || date.getFullYear(),
m == null ? date.getMonth() : m,
d || date.getDate()
);
}
function startOfTime(date, ms) {
const input = +date;
return input - input % ms;
}
const { DATE: DATE$2, DAY: DAY$2, HOUR: HOUR$2, MINUTE: MINUTE$2, MONTH: MONTH$2, SECOND: SECOND$2, YEAR: YEAR$2 } = units;
function endOf(date, unit) {
unit = normalizeUnit(unit);
let time = 0;
switch (unit) {
case YEAR$2:
time = startOfDate(date, date.getFullYear() + 1, 0, 1) - 1;
break;
case MONTH$2:
time = startOfDate(date, void 0, date.getMonth() + 1, 1) - 1;
break;
case DATE$2:
case DAY$2:
time = startOfDate(date) + MS_IN_DAY - 1;
break;
case HOUR$2:
time = startOfTime(date, MS_IN_HOUR) + MS_IN_HOUR - 1;
break;
case MINUTE$2:
time = startOfTime(date, MS_IN_MINUTE) + MS_IN_MINUTE - 1;
break;
case SECOND$2:
time = startOfTime(date, MS_IN_SECOND) + MS_IN_SECOND - 1;
break;
}
time && date.setTime(time);
return date;
}
function padLeft(val, len) {
return String(val).padStart(len || 2, "0");
}
function dateTimeFormat(date, opts) {
return new Intl.DateTimeFormat("en-US", opts).format(date);
}
function getOrdinalSuffix(day) {
if (day > 3 && day < 21) {
return "th";
}
switch (day % 10) {
case 1:
return "st";
case 2:
return "nd";
case 3:
return "rd";
default:
return "th";
}
}
function timezone(date, together) {
let offset = date.getTimezoneOffset();
let prefix;
if (offset <= 0) {
prefix = "+";
offset = Math.abs(offset);
} else {
prefix = "-";
}
return `${prefix}${padLeft(Math.floor(offset / 60))}${together ? "" : ":"}${padLeft(Math.floor(offset % 60))}`;
}
const FORMAT_MAP = {
// 年份
yyyy: (d) => d.getFullYear(),
YYYY: (d) => d.getFullYear(),
YY: (d) => padLeft(d.getFullYear() % 100),
// 月份
MMMM: (d) => dateTimeFormat(d, { month: "long" }),
MMM: (d) => dateTimeFormat(d, { month: "short" }),
MM: (d) => padLeft(d.getMonth() + 1),
M: (d) => d.getMonth() + 1,
// 日期
DD: (d) => padLeft(d.getDate()),
D: (d) => d.getDate(),
Do: (d) => {
const day = d.getDate();
return String(day) + getOrdinalSuffix(day);
},
// 星期
dddd: (d) => dateTimeFormat(d, { weekday: "long" }),
ddd: (d) => dateTimeFormat(d, { weekday: "short" }),
dd: (d) => dateTimeFormat(d, { weekday: "narrow" }),
// 时间
HH: (d) => padLeft(d.getHours()),
H: (d) => d.getHours(),
hh: (d) => padLeft(d.getHours() % 12 || 12),
h: (d) => d.getHours() % 12 || 12,
mm: (d) => padLeft(d.getMinutes()),
m: (d) => d.getMinutes(),
ss: (d) => padLeft(d.getSeconds()),
s: (d) => d.getSeconds(),
SSS: (d) => padLeft(d.getMilliseconds(), 3),
// 其他
A: (d) => d.getHours() >= 12 ? "PM" : "AM",
a: (d) => d.getHours() >= 12 ? "pm" : "am",
Z: (d) => timezone(d),
ZZ: (d) => timezone(d, true)
};
const tokens = Object.keys(FORMAT_MAP).sort((a, b) => b.length - a.length).join("|");
const pattern = new RegExp(
`${tokens}|\\[([^\\]]*)]`,
"g"
);
function format(date, formatString) {
if (!formatString || formatString === "ISO") {
return date.toISOString();
}
return formatString.replace(pattern, (match, escapeContent) => {
if (escapeContent) {
return escapeContent;
}
const formatter = FORMAT_MAP[match];
return formatter ? formatter(date) : match;
});
}
const { DATE: DATE$1, DAY: DAY$1, HOUR: HOUR$1, MILLISECOND, MINUTE: MINUTE$1, MONTH: MONTH$1, SECOND: SECOND$1, TIME, YEAR: YEAR$1 } = units;
const mapping = {
[YEAR$1]: "FullYear",
[MONTH$1]: "Month",
[DATE$1]: "Date",
[DAY$1]: "Day",
[HOUR$1]: "Hours",
[MINUTE$1]: "Minutes",
[SECOND$1]: "Seconds",
[MILLISECOND]: "Milliseconds",
[TIME]: "Time"
};
const setting = {};
const getting = {};
Object.entries(mapping).forEach(([key, method]) => {
if (key === DAY$1) {
setting[key] = function(date, val) {
const day = date.getDay();
if (val !== day) {
date.setTime(+date + (val - day) * MS_IN_DAY);
}
};
} else {
setting[key] = function(date, val) {
date[`set${method}`](val);
};
}
getting[key] = function(date) {
return date[`get${method}`]();
};
});
function get$1(date, unit) {
const fn = getting[normalizeUnit(unit)];
return fn ? fn(date) : 0;
}
function set$1(date, unit, val) {
const fn = setting[normalizeUnit(unit)];
fn && fn(date, val);
return date;
}
const { DATE, DAY, HOUR, MINUTE, MONTH, SECOND, YEAR } = units;
function startOf(date, unit) {
unit = normalizeUnit(unit);
let time = 0;
switch (unit) {
case YEAR:
time = startOfDate(date, void 0, 0, 1);
break;
case MONTH:
time = startOfDate(date, void 0, void 0, 1);
break;
case DATE:
case DAY:
time = startOfDate(date);
break;
case HOUR:
time = startOfTime(date, MS_IN_HOUR);
break;
case MINUTE:
time = startOfTime(date, MS_IN_MINUTE);
break;
case SECOND:
time = startOfTime(date, MS_IN_SECOND);
break;
}
time && date.setTime(time);
return date;
}
function isAfter(date, input, unit) {
unit = normalizeUnit(unit);
const inputMs = +parse$1(input);
if (!unit) {
return +date > inputMs;
}
return +startOf(new Date(date), unit) > inputMs;
}
function isBefore(date, input, unit) {
unit = normalizeUnit(unit);
const inputMs = +parse$1(input);
if (!unit) {
return +date < inputMs;
}
return +endOf(new Date(date), unit) < inputMs;
}
function isBetween(date, from, to, unit, inclusivity) {
inclusivity = inclusivity || "()";
return (inclusivity.startsWith("(") ? isAfter(date, from, unit) : !isBefore(date, from, unit)) && (inclusivity.charAt(1) === ")" ? isBefore(date, to, unit) : !isAfter(date, to, unit));
}
function isLeapYear(date) {
return isLeapYear$1(date.getFullYear());
}
function isSame(date, input, unit) {
unit = normalizeUnit(unit);
const inputMs = +parse$1(input);
if (!unit) {
return +date === inputMs;
}
return +startOf(new Date(date), unit) <= inputMs && inputMs <= +endOf(new Date(date), unit);
}
function isSameOrAfter(date, input, unit) {
return !isBefore(date, input, unit);
}
function isSameOrBefore(date, input, unit) {
return !isAfter(date, input, unit);
}
function isValid(date) {
return date.toString() !== "Invalid Date";
}
function subDays(date, days) {
return addDays(date, -days);
}
function subHours(date, hours) {
return addHours(date, -hours);
}
function subMilliseconds(date, ms) {
return addMilliseconds(date, -ms);
}
function subMinutes(date, minutes) {
return addMinutes(date, -minutes);
}
function subMonths(date, months) {
return addMonths(date, -months);
}
function subSeconds(date, seconds) {
return addSeconds(date, -seconds);
}
function subYears(date, years) {
return addMonths(date, -years * 12);
}
function subtract(date, num, unit) {
return typeof num === "object" && num !== null ? addObject(date, num, -1) : addNumber(date, -num, unit);
}
const fns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
add,
addDays,
addHours,
addMilliseconds,
addMinutes,
addMonths,
addSeconds,
addYears,
compile,
dayOfYear,
daysInMonth,
diff,
diffInDays,
diffInHours,
diffInMilliseconds,
diffInMinutes,
diffInMonths,
diffInSeconds,
diffInYears,
endOf,
format,
get: get$1,
isAfter,
isBefore,
isBetween,
isLeapYear,
isSame,
isSameOrAfter,
isSameOrBefore,
isValid,
parse: parse$1,
set: set$1,
startOf,
subDays,
subHours,
subMilliseconds,
subMinutes,
subMonths,
subSeconds,
subYears,
subtract,
units
}, Symbol.toStringTag, { value: "Module" }));
const { parse, get, set } = fns;
class DateChain {
constructor(input, format2) {
const _input = input instanceof DateChain ? input._d : input;
this._i = input;
this._f = format2;
this._d = parse(_input, format2);
}
clone() {
return new DateChain(this, this._f);
}
toArray() {
const date = this._d;
return [
get(date, "year"),
get(date, "month"),
get(date, "date"),
get(date, "hours"),
get(date, "minutes"),
get(date, "seconds"),
get(date, "milliseconds")
// -date.getTimezoneOffset()
];
}
toDate() {
return new Date(this._d);
}
toISOString() {
return this._d.toISOString();
}
toJSON() {
return this.toISOString();
}
toString() {
return this._d.toString();
}
valueOf() {
return this._d.valueOf();
}
}
const proto = DateChain.prototype;
Object.entries(units).forEach(([, method]) => {
const fn = function(val) {
if (val == null) {
return get(this._d, method);
}
set(this._d, method, val);
return this;
};
proto[method] = fn;
if (method !== "time") {
proto[`${method}s`] = fn;
}
});
const exclude = ["compile", "parse", "units"];
Object.entries(fns).forEach(([name, method]) => {
if (!exclude.includes(name)) {
proto[name] = function() {
const date = this._d;
const ret = method(date, ...arguments);
return ret === date ? this : ret;
};
}
DateChain[name] = method;
});
function chain(input, format2) {
return new DateChain(input, format2);
}
exports2.add = add;
exports2.addDays = addDays;
exports2.addHours = addHours;
exports2.addMilliseconds = addMilliseconds;
exports2.addMinutes = addMinutes;
exports2.addMonths = addMonths;
exports2.addSeconds = addSeconds;
exports2.addYears = addYears;
exports2.chain = chain;
exports2.compile = compile;
exports2.dayOfYear = dayOfYear;
exports2.daysInMonth = daysInMonth;
exports2.diff = diff;
exports2.diffInDays = diffInDays;
exports2.diffInHours = diffInHours;
exports2.diffInMilliseconds = diffInMilliseconds;
exports2.diffInMinutes = diffInMinutes;
exports2.diffInMonths = diffInMonths;
exports2.diffInSeconds = diffInSeconds;
exports2.diffInYears = diffInYears;
exports2.endOf = endOf;
exports2.format = format;
exports2.get = get$1;
exports2.isAfter = isAfter;
exports2.isBefore = isBefore;
exports2.isBetween = isBetween;
exports2.isLeapYear = isLeapYear;
exports2.isSame = isSame;
exports2.isSameOrAfter = isSameOrAfter;
exports2.isSameOrBefore = isSameOrBefore;
exports2.isValid = isValid;
exports2.parse = parse$1;
exports2.set = set$1;
exports2.startOf = startOf;
exports2.subDays = subDays;
exports2.subHours = subHours;
exports2.subMilliseconds = subMilliseconds;
exports2.subMinutes = subMinutes;
exports2.subMonths = subMonths;
exports2.subSeconds = subSeconds;
exports2.subYears = subYears;
exports2.subtract = subtract;
exports2.units = units;
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
});
@@ -0,0 +1,16 @@
import type { TSESTree } from '@typescript-eslint/utils';
import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule } from '../util';
declare const baseRule: import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingReturn" | "missingReturnValue" | "unexpectedReturnValue", [({
treatUndefinedAsUnspecified?: boolean;
} | undefined)?], unknown, {
'ArrowFunctionExpression:exit'(node: TSESTree.ArrowFunctionExpression): void;
'FunctionDeclaration:exit'(node: TSESTree.FunctionDeclaration): void;
'FunctionExpression:exit'(node: TSESTree.FunctionExpression): void;
ReturnStatement(node: TSESTree.ReturnStatement): void;
}>;
export type Options = InferOptionsTypeFromRule<typeof baseRule>;
export type MessageIds = InferMessageIdsTypeFromRule<typeof baseRule>;
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"missingReturn" | "missingReturnValue" | "unexpectedReturnValue", [({
treatUndefinedAsUnspecified?: boolean;
} | undefined)?], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
export default _default;
@@ -0,0 +1,22 @@
import Settings from '../settings';
import { Pattern, PatternsGroup } from '../types';
export type Task = {
base: string;
dynamic: boolean;
patterns: Pattern[];
positive: Pattern[];
negative: Pattern[];
};
export declare function generate(input: Pattern[], settings: Settings): Task[];
/**
* Returns tasks grouped by basic pattern directories.
*
* Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
* This is necessary because directory traversal starts at the base directory and goes deeper.
*/
export declare function convertPatternsToTasks(positive: Pattern[], negative: Pattern[], dynamic: boolean): Task[];
export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
export declare function getNegativePatternsAsPositive(patterns: Pattern[], ignore: Pattern[]): Pattern[];
export declare function groupPatternsByBaseDirectory(patterns: Pattern[]): PatternsGroup;
export declare function convertPatternGroupsToTasks(positive: PatternsGroup, negative: Pattern[], dynamic: boolean): Task[];
export declare function convertPatternGroupToTask(base: string, positive: Pattern[], negative: Pattern[], dynamic: boolean): Task;
@@ -0,0 +1,45 @@
import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f, Time as $35ea8db9cb2ccb90$export$680ea196effce5f, ZonedDateTime as $35ea8db9cb2ccb90$export$d3b7288e7994edea} from "./CalendarDate.mjs";
import {GregorianCalendar as $3b62074eb05584b2$export$80ee6245ec4f29ec} from "./GregorianCalendar.mjs";
import {JapaneseCalendar as $62225008020f0a13$export$b746ab2b60cdffbf} from "./JapaneseCalendar.mjs";
import {BuddhistCalendar as $8d73d47422ca7302$export$42d20a78301dee44} from "./BuddhistCalendar.mjs";
import {TaiwanCalendar as $5f31bd6f0c8940b2$export$65e01080afcb0799} from "./TaiwanCalendar.mjs";
import {PersianCalendar as $f3ed2e4472ae7e25$export$37fccdbfd14c5939} from "./PersianCalendar.mjs";
import {IndianCalendar as $82c358003bdda0a8$export$39f31c639fa15726} from "./IndianCalendar.mjs";
import {IslamicCivilCalendar as $f2f3e0e3a817edbd$export$2066795aadd37bfc, IslamicTabularCalendar as $f2f3e0e3a817edbd$export$37f0887f2f9d22f7, IslamicUmalquraCalendar as $f2f3e0e3a817edbd$export$5baab4758c231076} from "./IslamicCalendar.mjs";
import {HebrewCalendar as $7c5f6fbf42389787$export$ca405048b8fb5af} from "./HebrewCalendar.mjs";
import {CopticCalendar as $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1, EthiopicAmeteAlemCalendar as $b956b2d7a6cf451f$export$d72e0c37005a4914, EthiopicCalendar as $b956b2d7a6cf451f$export$26ba6eab5e20cd7d} from "./EthiopicCalendar.mjs";
import {createCalendar as $64244302c3013299$export$dd0bbc9b26defe37} from "./createCalendar.mjs";
import {fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, fromDate as $11d87f3f76e88657$export$e57ff100d91bd4b9, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDate as $11d87f3f76e88657$export$93522d1a439f3617, toCalendarDateTime as $11d87f3f76e88657$export$b21e0b124e224484, toLocalTimeZone as $11d87f3f76e88657$export$d9b67bc93c097491, toTime as $11d87f3f76e88657$export$d33f79e3ffc3dc83, toTimeZone as $11d87f3f76e88657$export$538b00033cc11c75, toZoned as $11d87f3f76e88657$export$84c95a83c799e074} from "./conversion.mjs";
import {endOfMonth as $14e0f24ef4ac5c92$export$a2258d9c4118825c, endOfWeek as $14e0f24ef4ac5c92$export$ef8b6d9133084f4e, endOfYear as $14e0f24ef4ac5c92$export$8b7aa55c66d5569e, getDayOfWeek as $14e0f24ef4ac5c92$export$2061056d06d7cdf7, getHoursInDay as $14e0f24ef4ac5c92$export$126c91c941de7e, getLocalTimeZone as $14e0f24ef4ac5c92$export$aa8b41735afcabd2, getMinimumDayInMonth as $14e0f24ef4ac5c92$export$b2f4953d301981d5, getMinimumMonthInYear as $14e0f24ef4ac5c92$export$5412ac11713b72ad, getWeeksInMonth as $14e0f24ef4ac5c92$export$ccc1b2479e7dd654, isEqualCalendar as $14e0f24ef4ac5c92$export$dbc69fd56b53d5e, isEqualDay as $14e0f24ef4ac5c92$export$91b62ebf2ba703ee, isEqualMonth as $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2, isEqualYear as $14e0f24ef4ac5c92$export$ea840f5a6dda8147, isSameDay as $14e0f24ef4ac5c92$export$ea39ec197993aef0, isSameMonth as $14e0f24ef4ac5c92$export$a18c89cbd24170ff, isSameYear as $14e0f24ef4ac5c92$export$5841f9eb9773f25f, isToday as $14e0f24ef4ac5c92$export$629b0a497aa65267, isWeekday as $14e0f24ef4ac5c92$export$ee9d87258e1d19ed, isWeekend as $14e0f24ef4ac5c92$export$618d60ea299da42, maxDate as $14e0f24ef4ac5c92$export$a75f2bff57811055, minDate as $14e0f24ef4ac5c92$export$5c333a116e949cdd, now as $14e0f24ef4ac5c92$export$461939dd4422153, resetLocalTimeZone as $14e0f24ef4ac5c92$export$55753838ffe79333, setLocalTimeZone as $14e0f24ef4ac5c92$export$61a9d83ceb59a3dd, startOfMonth as $14e0f24ef4ac5c92$export$a5a3b454ada2268e, startOfWeek as $14e0f24ef4ac5c92$export$42c81a444fbfb5d4, startOfYear as $14e0f24ef4ac5c92$export$f91e89d3d0406102, today as $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3} from "./queries.mjs";
import {parseAbsolute as $fae977aafc393c5c$export$5adfdab05168c219, parseAbsoluteToLocal as $fae977aafc393c5c$export$8e384432362ed0f0, parseDate as $fae977aafc393c5c$export$6b862160d295c8e, parseDateTime as $fae977aafc393c5c$export$588937bcd60ade55, parseDuration as $fae977aafc393c5c$export$ecae829bb3747ea6, parseTime as $fae977aafc393c5c$export$c9698ec7f05a07e1, parseZonedDateTime as $fae977aafc393c5c$export$fd7893f06e92a6a4} from "./string.mjs";
import {DateFormatter as $fb18d541ea1ad717$export$ad991b66133851cf} from "./DateFormatter.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 {$35ea8db9cb2ccb90$export$99faa760c7908e4f as CalendarDate, $35ea8db9cb2ccb90$export$ca871e8dbb80966f as CalendarDateTime, $35ea8db9cb2ccb90$export$680ea196effce5f as Time, $35ea8db9cb2ccb90$export$d3b7288e7994edea as ZonedDateTime, $3b62074eb05584b2$export$80ee6245ec4f29ec as GregorianCalendar, $62225008020f0a13$export$b746ab2b60cdffbf as JapaneseCalendar, $8d73d47422ca7302$export$42d20a78301dee44 as BuddhistCalendar, $5f31bd6f0c8940b2$export$65e01080afcb0799 as TaiwanCalendar, $f3ed2e4472ae7e25$export$37fccdbfd14c5939 as PersianCalendar, $82c358003bdda0a8$export$39f31c639fa15726 as IndianCalendar, $f2f3e0e3a817edbd$export$2066795aadd37bfc as IslamicCivilCalendar, $f2f3e0e3a817edbd$export$37f0887f2f9d22f7 as IslamicTabularCalendar, $f2f3e0e3a817edbd$export$5baab4758c231076 as IslamicUmalquraCalendar, $7c5f6fbf42389787$export$ca405048b8fb5af as HebrewCalendar, $b956b2d7a6cf451f$export$26ba6eab5e20cd7d as EthiopicCalendar, $b956b2d7a6cf451f$export$d72e0c37005a4914 as EthiopicAmeteAlemCalendar, $b956b2d7a6cf451f$export$fe6243cbe1a4b7c1 as CopticCalendar, $64244302c3013299$export$dd0bbc9b26defe37 as createCalendar, $11d87f3f76e88657$export$93522d1a439f3617 as toCalendarDate, $11d87f3f76e88657$export$b21e0b124e224484 as toCalendarDateTime, $11d87f3f76e88657$export$d33f79e3ffc3dc83 as toTime, $11d87f3f76e88657$export$b4a036af3fc0b032 as toCalendar, $11d87f3f76e88657$export$84c95a83c799e074 as toZoned, $11d87f3f76e88657$export$538b00033cc11c75 as toTimeZone, $11d87f3f76e88657$export$d9b67bc93c097491 as toLocalTimeZone, $11d87f3f76e88657$export$e57ff100d91bd4b9 as fromDate, $11d87f3f76e88657$export$1b96692a1ba042ac as fromAbsolute, $14e0f24ef4ac5c92$export$ea39ec197993aef0 as isSameDay, $14e0f24ef4ac5c92$export$a18c89cbd24170ff as isSameMonth, $14e0f24ef4ac5c92$export$5841f9eb9773f25f as isSameYear, $14e0f24ef4ac5c92$export$91b62ebf2ba703ee as isEqualDay, $14e0f24ef4ac5c92$export$5a8da0c44a3afdf2 as isEqualMonth, $14e0f24ef4ac5c92$export$ea840f5a6dda8147 as isEqualYear, $14e0f24ef4ac5c92$export$629b0a497aa65267 as isToday, $14e0f24ef4ac5c92$export$2061056d06d7cdf7 as getDayOfWeek, $14e0f24ef4ac5c92$export$461939dd4422153 as now, $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3 as today, $14e0f24ef4ac5c92$export$126c91c941de7e as getHoursInDay, $14e0f24ef4ac5c92$export$aa8b41735afcabd2 as getLocalTimeZone, $14e0f24ef4ac5c92$export$61a9d83ceb59a3dd as setLocalTimeZone, $14e0f24ef4ac5c92$export$55753838ffe79333 as resetLocalTimeZone, $14e0f24ef4ac5c92$export$a5a3b454ada2268e as startOfMonth, $14e0f24ef4ac5c92$export$42c81a444fbfb5d4 as startOfWeek, $14e0f24ef4ac5c92$export$f91e89d3d0406102 as startOfYear, $14e0f24ef4ac5c92$export$a2258d9c4118825c as endOfMonth, $14e0f24ef4ac5c92$export$ef8b6d9133084f4e as endOfWeek, $14e0f24ef4ac5c92$export$8b7aa55c66d5569e as endOfYear, $14e0f24ef4ac5c92$export$5412ac11713b72ad as getMinimumMonthInYear, $14e0f24ef4ac5c92$export$b2f4953d301981d5 as getMinimumDayInMonth, $14e0f24ef4ac5c92$export$ccc1b2479e7dd654 as getWeeksInMonth, $14e0f24ef4ac5c92$export$5c333a116e949cdd as minDate, $14e0f24ef4ac5c92$export$a75f2bff57811055 as maxDate, $14e0f24ef4ac5c92$export$618d60ea299da42 as isWeekend, $14e0f24ef4ac5c92$export$ee9d87258e1d19ed as isWeekday, $14e0f24ef4ac5c92$export$dbc69fd56b53d5e as isEqualCalendar, $fae977aafc393c5c$export$6b862160d295c8e as parseDate, $fae977aafc393c5c$export$588937bcd60ade55 as parseDateTime, $fae977aafc393c5c$export$c9698ec7f05a07e1 as parseTime, $fae977aafc393c5c$export$5adfdab05168c219 as parseAbsolute, $fae977aafc393c5c$export$8e384432362ed0f0 as parseAbsoluteToLocal, $fae977aafc393c5c$export$fd7893f06e92a6a4 as parseZonedDateTime, $fae977aafc393c5c$export$ecae829bb3747ea6 as parseDuration, $fb18d541ea1ad717$export$ad991b66133851cf as DateFormatter};
//# sourceMappingURL=module.js.map
@@ -0,0 +1,606 @@
'use strict';
///@ts-check
const util = require('../util');
const xmlNode = require('./xmlNode');
const readDocType = require("./DocTypeReader");
const toNumber = require("strnum");
const getIgnoreAttributesFn = require('../ignoreAttributes')
// const regx =
// '<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)'
// .replace(/NAME/g, util.nameRegexp);
//const tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g");
//const tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g");
class OrderedObjParser{
constructor(options){
this.options = options;
this.currentNode = null;
this.tagsNodeStack = [];
this.docTypeEntities = {};
this.lastEntities = {
"apos" : { regex: /&(apos|#39|#x27);/g, val : "'"},
"gt" : { regex: /&(gt|#62|#x3E);/g, val : ">"},
"lt" : { regex: /&(lt|#60|#x3C);/g, val : "<"},
"quot" : { regex: /&(quot|#34|#x22);/g, val : "\""},
};
this.ampEntity = { regex: /&(amp|#38|#x26);/g, val : "&"};
this.htmlEntities = {
"space": { regex: /&(nbsp|#160);/g, val: " " },
// "lt" : { regex: /&(lt|#60);/g, val: "<" },
// "gt" : { regex: /&(gt|#62);/g, val: ">" },
// "amp" : { regex: /&(amp|#38);/g, val: "&" },
// "quot" : { regex: /&(quot|#34);/g, val: "\"" },
// "apos" : { regex: /&(apos|#39);/g, val: "'" },
"cent" : { regex: /&(cent|#162);/g, val: "¢" },
"pound" : { regex: /&(pound|#163);/g, val: "£" },
"yen" : { regex: /&(yen|#165);/g, val: "¥" },
"euro" : { regex: /&(euro|#8364);/g, val: "€" },
"copyright" : { regex: /&(copy|#169);/g, val: "©" },
"reg" : { regex: /&(reg|#174);/g, val: "®" },
"inr" : { regex: /&(inr|#8377);/g, val: "₹" },
"num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 10)) },
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 16)) },
};
this.addExternalEntities = addExternalEntities;
this.parseXml = parseXml;
this.parseTextData = parseTextData;
this.resolveNameSpace = resolveNameSpace;
this.buildAttributesMap = buildAttributesMap;
this.isItStopNode = isItStopNode;
this.replaceEntitiesValue = replaceEntitiesValue;
this.readStopNodeData = readStopNodeData;
this.saveTextToParentTag = saveTextToParentTag;
this.addChild = addChild;
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes)
}
}
function addExternalEntities(externalEntities){
const entKeys = Object.keys(externalEntities);
for (let i = 0; i < entKeys.length; i++) {
const ent = entKeys[i];
this.lastEntities[ent] = {
regex: new RegExp("&"+ent+";","g"),
val : externalEntities[ent]
}
}
}
/**
* @param {string} val
* @param {string} tagName
* @param {string} jPath
* @param {boolean} dontTrim
* @param {boolean} hasAttributes
* @param {boolean} isLeafNode
* @param {boolean} escapeEntities
*/
function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
if (val !== undefined) {
if (this.options.trimValues && !dontTrim) {
val = val.trim();
}
if(val.length > 0){
if(!escapeEntities) val = this.replaceEntitiesValue(val);
const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
if(newval === null || newval === undefined){
//don't parse
return val;
}else if(typeof newval !== typeof val || newval !== val){
//overwrite
return newval;
}else if(this.options.trimValues){
return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
}else{
const trimmedVal = val.trim();
if(trimmedVal === val){
return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
}else{
return val;
}
}
}
}
}
function resolveNameSpace(tagname) {
if (this.options.removeNSPrefix) {
const tags = tagname.split(':');
const prefix = tagname.charAt(0) === '/' ? '/' : '';
if (tags[0] === 'xmlns') {
return '';
}
if (tags.length === 2) {
tagname = prefix + tags[1];
}
}
return tagname;
}
//TODO: change regex to capture NS
//const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
function buildAttributesMap(attrStr, jPath, tagName) {
if (this.options.ignoreAttributes !== true && typeof attrStr === 'string') {
// attrStr = attrStr.replace(/\r?\n/g, ' ');
//attrStr = attrStr || attrStr.trim();
const matches = util.getAllMatches(attrStr, attrsRegx);
const len = matches.length; //don't make it inline
const attrs = {};
for (let i = 0; i < len; i++) {
const attrName = this.resolveNameSpace(matches[i][1]);
if (this.ignoreAttributesFn(attrName, jPath)) {
continue
}
let oldVal = matches[i][4];
let aName = this.options.attributeNamePrefix + attrName;
if (attrName.length) {
if (this.options.transformAttributeName) {
aName = this.options.transformAttributeName(aName);
}
if(aName === "__proto__") aName = "#__proto__";
if (oldVal !== undefined) {
if (this.options.trimValues) {
oldVal = oldVal.trim();
}
oldVal = this.replaceEntitiesValue(oldVal);
const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
if(newVal === null || newVal === undefined){
//don't parse
attrs[aName] = oldVal;
}else if(typeof newVal !== typeof oldVal || newVal !== oldVal){
//overwrite
attrs[aName] = newVal;
}else{
//parse
attrs[aName] = parseValue(
oldVal,
this.options.parseAttributeValue,
this.options.numberParseOptions
);
}
} else if (this.options.allowBooleanAttributes) {
attrs[aName] = true;
}
}
}
if (!Object.keys(attrs).length) {
return;
}
if (this.options.attributesGroupName) {
const attrCollection = {};
attrCollection[this.options.attributesGroupName] = attrs;
return attrCollection;
}
return attrs
}
}
const parseXml = function(xmlData) {
xmlData = xmlData.replace(/\r\n?/g, "\n"); //TODO: remove this line
const xmlObj = new xmlNode('!xml');
let currentNode = xmlObj;
let textData = "";
let jPath = "";
for(let i=0; i< xmlData.length; i++){//for each char in XML data
const ch = xmlData[i];
if(ch === '<'){
// const nextIndex = i+1;
// const _2ndChar = xmlData[nextIndex];
if( xmlData[i+1] === '/') {//Closing Tag
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.")
let tagName = xmlData.substring(i+2,closeIndex).trim();
if(this.options.removeNSPrefix){
const colonIndex = tagName.indexOf(":");
if(colonIndex !== -1){
tagName = tagName.substr(colonIndex+1);
}
}
if(this.options.transformTagName) {
tagName = this.options.transformTagName(tagName);
}
if(currentNode){
textData = this.saveTextToParentTag(textData, currentNode, jPath);
}
//check if last tag of nested tag was unpaired tag
const lastTagName = jPath.substring(jPath.lastIndexOf(".")+1);
if(tagName && this.options.unpairedTags.indexOf(tagName) !== -1 ){
throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
}
let propIndex = 0
if(lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1 ){
propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.')-1)
this.tagsNodeStack.pop();
}else{
propIndex = jPath.lastIndexOf(".");
}
jPath = jPath.substring(0, propIndex);
currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope
textData = "";
i = closeIndex;
} else if( xmlData[i+1] === '?') {
let tagData = readTagExp(xmlData,i, false, "?>");
if(!tagData) throw new Error("Pi Tag is not closed.");
textData = this.saveTextToParentTag(textData, currentNode, jPath);
if( (this.options.ignoreDeclaration && tagData.tagName === "?xml") || this.options.ignorePiTags){
}else{
const childNode = new xmlNode(tagData.tagName);
childNode.add(this.options.textNodeName, "");
if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
}
this.addChild(currentNode, childNode, jPath)
}
i = tagData.closeIndex + 1;
} else if(xmlData.substr(i + 1, 3) === '!--') {
const endIndex = findClosingIndex(xmlData, "-->", i+4, "Comment is not closed.")
if(this.options.commentPropName){
const comment = xmlData.substring(i + 4, endIndex - 2);
textData = this.saveTextToParentTag(textData, currentNode, jPath);
currentNode.add(this.options.commentPropName, [ { [this.options.textNodeName] : comment } ]);
}
i = endIndex;
} else if( xmlData.substr(i + 1, 2) === '!D') {
const result = readDocType(xmlData, i);
this.docTypeEntities = result.entities;
i = result.i;
}else if(xmlData.substr(i + 1, 2) === '![') {
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
const tagExp = xmlData.substring(i + 9,closeIndex);
textData = this.saveTextToParentTag(textData, currentNode, jPath);
let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
if(val == undefined) val = "";
//cdata should be set even if it is 0 length string
if(this.options.cdataPropName){
currentNode.add(this.options.cdataPropName, [ { [this.options.textNodeName] : tagExp } ]);
}else{
currentNode.add(this.options.textNodeName, val);
}
i = closeIndex + 2;
}else {//Opening tag
let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
let tagName= result.tagName;
const rawTagName = result.rawTagName;
let tagExp = result.tagExp;
let attrExpPresent = result.attrExpPresent;
let closeIndex = result.closeIndex;
if (this.options.transformTagName) {
tagName = this.options.transformTagName(tagName);
}
//save text as child node
if (currentNode && textData) {
if(currentNode.tagname !== '!xml'){
//when nested tag is found
textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
}
}
//check if last tag was unpaired tag
const lastTag = currentNode;
if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){
currentNode = this.tagsNodeStack.pop();
jPath = jPath.substring(0, jPath.lastIndexOf("."));
}
if(tagName !== xmlObj.tagname){
jPath += jPath ? "." + tagName : tagName;
}
if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
let tagContent = "";
//self-closing tag
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
tagName = tagName.substr(0, tagName.length - 1);
jPath = jPath.substr(0, jPath.length - 1);
tagExp = tagName;
}else{
tagExp = tagExp.substr(0, tagExp.length - 1);
}
i = result.closeIndex;
}
//unpaired tag
else if(this.options.unpairedTags.indexOf(tagName) !== -1){
i = result.closeIndex;
}
//normal tag
else{
//read until closing tag is found
const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
if(!result) throw new Error(`Unexpected end of ${rawTagName}`);
i = result.i;
tagContent = result.tagContent;
}
const childNode = new xmlNode(tagName);
if(tagName !== tagExp && attrExpPresent){
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
}
if(tagContent) {
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
}
jPath = jPath.substr(0, jPath.lastIndexOf("."));
childNode.add(this.options.textNodeName, tagContent);
this.addChild(currentNode, childNode, jPath)
}else{
//selfClosing tag
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
tagName = tagName.substr(0, tagName.length - 1);
jPath = jPath.substr(0, jPath.length - 1);
tagExp = tagName;
}else{
tagExp = tagExp.substr(0, tagExp.length - 1);
}
if(this.options.transformTagName) {
tagName = this.options.transformTagName(tagName);
}
const childNode = new xmlNode(tagName);
if(tagName !== tagExp && attrExpPresent){
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
}
this.addChild(currentNode, childNode, jPath)
jPath = jPath.substr(0, jPath.lastIndexOf("."));
}
//opening tag
else{
const childNode = new xmlNode( tagName);
this.tagsNodeStack.push(currentNode);
if(tagName !== tagExp && attrExpPresent){
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
}
this.addChild(currentNode, childNode, jPath)
currentNode = childNode;
}
textData = "";
i = closeIndex;
}
}
}else{
textData += xmlData[i];
}
}
return xmlObj.child;
}
function addChild(currentNode, childNode, jPath){
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"])
if(result === false){
}else if(typeof result === "string"){
childNode.tagname = result
currentNode.addChild(childNode);
}else{
currentNode.addChild(childNode);
}
}
const replaceEntitiesValue = function(val){
if(this.options.processEntities){
for(let entityName in this.docTypeEntities){
const entity = this.docTypeEntities[entityName];
val = val.replace( entity.regx, entity.val);
}
for(let entityName in this.lastEntities){
const entity = this.lastEntities[entityName];
val = val.replace( entity.regex, entity.val);
}
if(this.options.htmlEntities){
for(let entityName in this.htmlEntities){
const entity = this.htmlEntities[entityName];
val = val.replace( entity.regex, entity.val);
}
}
val = val.replace( this.ampEntity.regex, this.ampEntity.val);
}
return val;
}
function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
if (textData) { //store previously collected data as textNode
if(isLeafNode === undefined) isLeafNode = currentNode.child.length === 0
textData = this.parseTextData(textData,
currentNode.tagname,
jPath,
false,
currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false,
isLeafNode);
if (textData !== undefined && textData !== "")
currentNode.add(this.options.textNodeName, textData);
textData = "";
}
return textData;
}
//TODO: use jPath to simplify the logic
/**
*
* @param {string[]} stopNodes
* @param {string} jPath
* @param {string} currentTagName
*/
function isItStopNode(stopNodes, jPath, currentTagName){
const allNodesExp = "*." + currentTagName;
for (const stopNodePath in stopNodes) {
const stopNodeExp = stopNodes[stopNodePath];
if( allNodesExp === stopNodeExp || jPath === stopNodeExp ) return true;
}
return false;
}
/**
* Returns the tag Expression and where it is ending handling single-double quotes situation
* @param {string} xmlData
* @param {number} i starting index
* @returns
*/
function tagExpWithClosingIndex(xmlData, i, closingChar = ">"){
let attrBoundary;
let tagExp = "";
for (let index = i; index < xmlData.length; index++) {
let ch = xmlData[index];
if (attrBoundary) {
if (ch === attrBoundary) attrBoundary = "";//reset
} else if (ch === '"' || ch === "'") {
attrBoundary = ch;
} else if (ch === closingChar[0]) {
if(closingChar[1]){
if(xmlData[index + 1] === closingChar[1]){
return {
data: tagExp,
index: index
}
}
}else{
return {
data: tagExp,
index: index
}
}
} else if (ch === '\t') {
ch = " "
}
tagExp += ch;
}
}
function findClosingIndex(xmlData, str, i, errMsg){
const closingIndex = xmlData.indexOf(str, i);
if(closingIndex === -1){
throw new Error(errMsg)
}else{
return closingIndex + str.length - 1;
}
}
function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
const result = tagExpWithClosingIndex(xmlData, i+1, closingChar);
if(!result) return;
let tagExp = result.data;
const closeIndex = result.index;
const separatorIndex = tagExp.search(/\s/);
let tagName = tagExp;
let attrExpPresent = true;
if(separatorIndex !== -1){//separate tag name and attributes expression
tagName = tagExp.substring(0, separatorIndex);
tagExp = tagExp.substring(separatorIndex + 1).trimStart();
}
const rawTagName = tagName;
if(removeNSPrefix){
const colonIndex = tagName.indexOf(":");
if(colonIndex !== -1){
tagName = tagName.substr(colonIndex+1);
attrExpPresent = tagName !== result.data.substr(colonIndex + 1);
}
}
return {
tagName: tagName,
tagExp: tagExp,
closeIndex: closeIndex,
attrExpPresent: attrExpPresent,
rawTagName: rawTagName,
}
}
/**
* find paired tag for a stop node
* @param {string} xmlData
* @param {string} tagName
* @param {number} i
*/
function readStopNodeData(xmlData, tagName, i){
const startIndex = i;
// Starting at 1 since we already have an open tag
let openTagCount = 1;
for (; i < xmlData.length; i++) {
if( xmlData[i] === "<"){
if (xmlData[i+1] === "/") {//close tag
const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`);
let closeTagName = xmlData.substring(i+2,closeIndex).trim();
if(closeTagName === tagName){
openTagCount--;
if (openTagCount === 0) {
return {
tagContent: xmlData.substring(startIndex, i),
i : closeIndex
}
}
}
i=closeIndex;
} else if(xmlData[i+1] === '?') {
const closeIndex = findClosingIndex(xmlData, "?>", i+1, "StopNode is not closed.")
i=closeIndex;
} else if(xmlData.substr(i + 1, 3) === '!--') {
const closeIndex = findClosingIndex(xmlData, "-->", i+3, "StopNode is not closed.")
i=closeIndex;
} else if(xmlData.substr(i + 1, 2) === '![') {
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
i=closeIndex;
} else {
const tagData = readTagExp(xmlData, i, '>')
if (tagData) {
const openTagName = tagData && tagData.tagName;
if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length-1] !== "/") {
openTagCount++;
}
i=tagData.closeIndex;
}
}
}
}//end for loop
}
function parseValue(val, shouldParse, options) {
if (shouldParse && typeof val === 'string') {
//console.log(options)
const newval = val.trim();
if(newval === 'true' ) return true;
else if(newval === 'false' ) return false;
else return toNumber(val, options);
} else {
if (util.isExist(val)) {
return val;
} else {
return '';
}
}
}
module.exports = OrderedObjParser;
@@ -0,0 +1,13 @@
export type TypeRegistryValidationFunction<TSchema> = (schema: TSchema, value: unknown) => boolean;
/** Returns the entries in this registry */
export declare function Entries(): Map<string, TypeRegistryValidationFunction<any>>;
/** Clears all user defined types */
export declare function Clear(): void;
/** Deletes a registered type */
export declare function Delete(kind: string): boolean;
/** Returns true if this registry contains this kind */
export declare function Has(kind: string): boolean;
/** Sets a validation function for a user defined type */
export declare function Set<TSchema = unknown>(kind: string, func: TypeRegistryValidationFunction<TSchema>): void;
/** Gets a custom validation function for a user defined type */
export declare function Get(kind: string): TypeRegistryValidationFunction<any> | undefined;
@@ -0,0 +1,7 @@
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports['default'] =
importDeclaration;var _contextCompat = require('eslint-module-utils/contextCompat');function importDeclaration(context, node) {
var ancestors = (0, _contextCompat.getAncestors)(context, node);
return ancestors[ancestors.length - 1];
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbXBvcnREZWNsYXJhdGlvbi5qcyJdLCJuYW1lcyI6WyJpbXBvcnREZWNsYXJhdGlvbiIsImNvbnRleHQiLCJub2RlIiwiYW5jZXN0b3JzIiwibGVuZ3RoIl0sIm1hcHBpbmdzIjoiOztBQUV3QkEsaUIsQ0FGeEIsa0VBRWUsU0FBU0EsaUJBQVQsQ0FBMkJDLE9BQTNCLEVBQW9DQyxJQUFwQyxFQUEwQztBQUN2RCxNQUFNQyxZQUFZLGlDQUFhRixPQUFiLEVBQXNCQyxJQUF0QixDQUFsQjtBQUNBLFNBQU9DLFVBQVVBLFVBQVVDLE1BQVYsR0FBbUIsQ0FBN0IsQ0FBUDtBQUNEIiwiZmlsZSI6ImltcG9ydERlY2xhcmF0aW9uLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgZ2V0QW5jZXN0b3JzIH0gZnJvbSAnZXNsaW50LW1vZHVsZS11dGlscy9jb250ZXh0Q29tcGF0JztcblxuZXhwb3J0IGRlZmF1bHQgZnVuY3Rpb24gaW1wb3J0RGVjbGFyYXRpb24oY29udGV4dCwgbm9kZSkge1xuICBjb25zdCBhbmNlc3RvcnMgPSBnZXRBbmNlc3RvcnMoY29udGV4dCwgbm9kZSk7XG4gIHJldHVybiBhbmNlc3RvcnNbYW5jZXN0b3JzLmxlbmd0aCAtIDFdO1xufVxuIl19
@@ -0,0 +1,48 @@
/**
* Copyright (c) 2019, Microsoft Corporation (MIT License).
*/
import { IDisposable } from './types';
interface IListener<T> {
(e: T): void;
}
export interface IEvent<T> {
(listener: (e: T) => any): IDisposable;
}
export class EventEmitter2<T> {
private _listeners: Array<IListener<T>> = [];
private _event?: IEvent<T>;
public get event(): IEvent<T> {
if (!this._event) {
this._event = (listener: (e: T) => any) => {
this._listeners.push(listener);
const disposable = {
dispose: () => {
for (let i = 0; i < this._listeners.length; i++) {
if (this._listeners[i] === listener) {
this._listeners.splice(i, 1);
return;
}
}
}
};
return disposable;
};
}
return this._event;
}
public fire(data: T): void {
const queue: Array<IListener<T>> = [];
for (let i = 0; i < this._listeners.length; i++) {
queue.push(this._listeners[i]);
}
for (let i = 0; i < queue.length; i++) {
queue[i].call(undefined, data);
}
}
}
@@ -0,0 +1,205 @@
import * as proto from '../../../packet/transformer/proto';
import { OidbPacket, PacketTransformer } from '../../../packet/transformer/base';
import { PacketMsgPicElement } from '../../../packet/message/element';
declare class UploadGroupImage extends PacketTransformer<typeof proto.NTV2RichMediaResp> {
build(groupUin: number, img: PacketMsgPicElement): OidbPacket;
parse(data: Buffer): import("napcat-protobuf").any {
common: import("napcat-protobuf").MessageProtoFieldType<() => {
RequestId: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
Command: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, false>;
retCode: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
message: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
}, false, false>;
upload: import("napcat-protobuf").MessageProtoFieldType<() => {
uKey: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, true, false>;
uKeyTtlSecond: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ipv4s: import("napcat-protobuf").MessageProtoFieldType<() => {
outIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
outPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
inIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
inPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ipType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, true>;
ipv6s: import("napcat-protobuf").MessageProtoFieldType<() => {
outIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
outPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
inIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
inPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ipType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, true>;
msgSeq: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT64, false, false>;
msgInfo: import("napcat-protobuf").MessageProtoFieldType<() => {
MsgInfoBody: import("napcat-protobuf").MessageProtoFieldType<() => {
Index: import("napcat-protobuf").MessageProtoFieldType<() => {
Info: import("napcat-protobuf").MessageProtoFieldType<() => {
FileSize: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
FileHash: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
FileSha1: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
FileName: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
Type: import("napcat-protobuf").MessageProtoFieldType<() => {
Type: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
PicFormat: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
VideoFormat: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
VoiceFormat: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, false>;
Width: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
Height: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
Time: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
Original: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, false>;
FileUuid: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
StoreId: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
UploadTime: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
Ttl: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
SubType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, false>;
Picture: import("napcat-protobuf").MessageProtoFieldType<() => {
UrlPath: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
Ext: import("napcat-protobuf").MessageProtoFieldType<() => {
OriginalParameter: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
BigParameter: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
ThumbParameter: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
}, false, false>;
Domain: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
}, false, false>;
Video: import("napcat-protobuf").MessageProtoFieldType<() => {}, false, false>;
Audio: import("napcat-protobuf").MessageProtoFieldType<() => {}, false, false>;
FileExist: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BOOL, false, false>;
HashSum: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
}, false, true>;
ExtBizInfo: import("napcat-protobuf").MessageProtoFieldType<() => {
Pic: import("napcat-protobuf").MessageProtoFieldType<() => {
BizType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
TextSummary: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
BytesPbReserveC2c: import("napcat-protobuf").MessageProtoFieldType<() => {
subType: 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>;
field8: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
field10: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
field12: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
field18: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
field19: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
field20: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
}, false, false>;
BytesPbReserveTroop: import("napcat-protobuf").MessageProtoFieldType<() => {
subType: 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>;
field9: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
field10: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
field12: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
field18: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
field19: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
field21: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
}, false, false>;
FromScene: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ToScene: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
OldFileId: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, false>;
Video: import("napcat-protobuf").MessageProtoFieldType<() => {
FromScene: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ToScene: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
BytesPbReserve: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
}, false, false>;
Ptt: import("napcat-protobuf").MessageProtoFieldType<() => {
SrcUin: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT64, false, false>;
PttScene: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
PttType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ChangeVoice: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
Waveform: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
AutoConvertText: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
BytesReserve: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
BytesPbReserve: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
BytesGeneralFlags: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
}, false, false>;
BusiType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, false>;
}, false, false>;
ext: import("napcat-protobuf").MessageProtoFieldType<() => {
subType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
extType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
extValue: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
}, false, true>;
compatQMsg: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
subFileInfos: import("napcat-protobuf").MessageProtoFieldType<() => {
subType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
uKey: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
uKeyTtlSecond: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ipv4s: import("napcat-protobuf").MessageProtoFieldType<() => {
outIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
outPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
inIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
inPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ipType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, true>;
ipv6s: import("napcat-protobuf").MessageProtoFieldType<() => {
outIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
outPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
inIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
inPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ipType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, true>;
}, false, true>;
}, false, false>;
download: import("napcat-protobuf").MessageProtoFieldType<() => {
rKeyParam: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
rKeyTtlSecond: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
info: import("napcat-protobuf").MessageProtoFieldType<() => {
domain: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
urlPath: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
httpsPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ipv4s: import("napcat-protobuf").MessageProtoFieldType<() => {
outIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
outPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
inIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
inPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ipType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, true>;
ipv6s: import("napcat-protobuf").MessageProtoFieldType<() => {
outIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
outPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
inIP: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
inPort: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
ipType: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, true>;
picUrlExtInfo: import("napcat-protobuf").MessageProtoFieldType<() => {
OriginalParameter: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
BigParameter: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
ThumbParameter: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
}, false, false>;
videoExtInfo: import("napcat-protobuf").MessageProtoFieldType<() => {
VideoCodecFormat: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, false>;
}, false, false>;
rKeyCreateTime: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
}, false, false>;
downloadRKey: import("napcat-protobuf").MessageProtoFieldType<() => {
rKeys: import("napcat-protobuf").MessageProtoFieldType<() => {
rkey: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
rkeyTtlSec: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT64, false, false>;
storeId: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
rkeyCreateTime: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, true, false>;
type: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, true, false>;
}, false, true>;
}, false, false>;
delete: import("napcat-protobuf").MessageProtoFieldType<() => {}, false, false>;
uploadCompleted: import("napcat-protobuf").MessageProtoFieldType<() => {
msgSeq: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT64, false, false>;
}, false, false>;
msgInfoAuth: import("napcat-protobuf").MessageProtoFieldType<() => {
authCode: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT32, false, false>;
msg: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, false, false>;
resultTime: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT64, false, false>;
}, false, false>;
uploadKeyRenewal: import("napcat-protobuf").MessageProtoFieldType<() => {
ukey: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.STRING, false, false>;
ukeyTtlSec: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.UINT64, false, false>;
}, false, false>;
downloadSafe: import("napcat-protobuf").MessageProtoFieldType<() => {}, false, false>;
extension: import("napcat-protobuf").ScalarProtoFieldType<import("napcat-protobuf").ScalarType.BYTES, true, false>;
}>;
}
declare const _default: UploadGroupImage;
export default _default;
@@ -0,0 +1,28 @@
var arrayFilter = require('./_arrayFilter'),
baseRest = require('./_baseRest'),
baseXor = require('./_baseXor'),
isArrayLikeObject = require('./isArrayLikeObject');
/**
* Creates an array of unique values that is the
* [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
* of the given arrays. The order of result values is determined by the order
* they occur in the arrays.
*
* @static
* @memberOf _
* @since 2.4.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of filtered values.
* @see _.difference, _.without
* @example
*
* _.xor([2, 1], [2, 3]);
* // => [1, 3]
*/
var xor = baseRest(function(arrays) {
return baseXor(arrayFilter(arrays, isArrayLikeObject));
});
module.exports = xor;
@@ -0,0 +1 @@
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAuBA,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,MAAM,CAA6B;IAE3C,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAStB,KAAK,IAAI,MAAM;CAIhB;AAED,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,QAAgB,MAAM,CAAS;gBAEnB,MAAM,EAAE,MAAM;IAI1B,IAAI,IAAI,MAAM;IAId,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAK9B"}
@@ -0,0 +1,295 @@
# Sucrase
[![Build Status](https://github.com/alangpierce/sucrase/workflows/All%20tests/badge.svg)](https://github.com/alangpierce/sucrase/actions)
[![npm version](https://img.shields.io/npm/v/sucrase.svg)](https://www.npmjs.com/package/sucrase)
[![Install Size](https://packagephobia.now.sh/badge?p=sucrase)](https://packagephobia.now.sh/result?p=sucrase)
[![MIT License](https://img.shields.io/npm/l/express.svg?maxAge=2592000)](LICENSE)
[![Join the chat at https://gitter.im/sucrasejs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sucrasejs/Lobby)
## [Try it out](https://sucrase.io)
## Quick usage
```bash
yarn add --dev sucrase # Or npm install --save-dev sucrase
node -r sucrase/register main.ts
```
Using the [ts-node](https://github.com/TypeStrong/ts-node) integration:
```bash
yarn add --dev sucrase ts-node typescript
./node_modules/.bin/ts-node --transpiler sucrase/ts-node-plugin main.ts
```
## Project overview
Sucrase is an alternative to Babel that allows super-fast development builds.
Instead of compiling a large range of JS features to be able to work in Internet
Explorer, Sucrase assumes that you're developing with a recent browser or recent
Node.js version, so it focuses on compiling non-standard language extensions:
JSX, TypeScript, and Flow. Because of this smaller scope, Sucrase can get away
with an architecture that is much more performant but less extensible and
maintainable. Sucrase's parser is forked from Babel's parser (so Sucrase is
indebted to Babel and wouldn't be possible without it) and trims it down to a
focused subset of what Babel solves. If it fits your use case, hopefully Sucrase
can speed up your development experience!
**Sucrase has been extensively tested.** It can successfully build
the [Benchling](https://benchling.com/) frontend code,
[Babel](https://github.com/babel/babel),
[React](https://github.com/facebook/react),
[TSLint](https://github.com/palantir/tslint),
[Apollo client](https://github.com/apollographql/apollo-client), and
[decaffeinate](https://github.com/decaffeinate/decaffeinate)
with all tests passing, about 1 million lines of code total.
**Sucrase is about 20x faster than Babel.** Here's one measurement of how
Sucrase compares with other tools when compiling the Jest codebase 3 times,
about 360k lines of code total:
```text
Time Speed
Sucrase 0.57 seconds 636975 lines per second
swc 1.19 seconds 304526 lines per second
esbuild 1.45 seconds 248692 lines per second
TypeScript 8.98 seconds 40240 lines per second
Babel 9.18 seconds 39366 lines per second
```
Details: Measured on July 2022. Tools run in single-threaded mode without warm-up. See the
[benchmark code](https://github.com/alangpierce/sucrase/blob/main/benchmark/benchmark.ts)
for methodology and caveats.
## Transforms
The main configuration option in Sucrase is an array of transform names. These
transforms are available:
* **jsx**: Enables JSX syntax. By default, JSX is transformed to `React.createClass`,
but may be preserved or transformed to `_jsx()` by setting the `jsxRuntime` option.
Also adds `createReactClass` display names and JSX context information.
* **typescript**: Compiles TypeScript code to JavaScript, removing type
annotations and handling features like enums. Does not check types. Sucrase
transforms each file independently, so you should enable the `isolatedModules`
TypeScript flag so that the typechecker will disallow the few features like
`const enum`s that need cross-file compilation. The Sucrase option `keepUnusedImports`
can be used to disable all automatic removal of imports and exports, analogous to TS
`verbatimModuleSyntax`.
* **flow**: Removes Flow type annotations. Does not check types.
* **imports**: Transforms ES Modules (`import`/`export`) to CommonJS
(`require`/`module.exports`) using the same approach as Babel and TypeScript
with `--esModuleInterop`. If `preserveDynamicImport` is specified in the Sucrase
options, then dynamic `import` expressions are left alone, which is particularly
useful in Node to load ESM-only libraries. If `preserveDynamicImport` is not
specified, `import` expressions are transformed into a promise-wrapped call to
`require`.
* **react-hot-loader**: Performs the equivalent of the `react-hot-loader/babel`
transform in the [react-hot-loader](https://github.com/gaearon/react-hot-loader)
project. This enables advanced hot reloading use cases such as editing of
bound methods.
* **jest**: Hoist desired [jest](https://jestjs.io/) method calls above imports in
the same way as [babel-plugin-jest-hoist](https://github.com/facebook/jest/tree/master/packages/babel-plugin-jest-hoist).
Does not validate the arguments passed to `jest.mock`, but the same rules still apply.
When the `imports` transform is *not* specified (i.e. when targeting ESM), the
`injectCreateRequireForImportRequire` option can be specified to transform TS
`import foo = require("foo");` in a way that matches the
[TypeScript 4.7 behavior](https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#commonjs-interoperability)
with `module: nodenext`.
These newer JS features are transformed by default:
* [Optional chaining](https://github.com/tc39/proposal-optional-chaining): `a?.b`
* [Nullish coalescing](https://github.com/tc39/proposal-nullish-coalescing): `a ?? b`
* [Class fields](https://github.com/tc39/proposal-class-fields): `class C { x = 1; }`.
This includes static fields but not the `#x` private field syntax.
* [Numeric separators](https://github.com/tc39/proposal-numeric-separator):
`const n = 1_234;`
* [Optional catch binding](https://github.com/tc39/proposal-optional-catch-binding):
`try { doThing(); } catch { }`.
If your target runtime supports these features, you can specify
`disableESTransforms: true` so that Sucrase preserves the syntax rather than
trying to transform it. Note that transpiled and standard class fields behave
slightly differently; see the
[TypeScript 3.7 release notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier)
for details. If you use TypeScript, you can enable the TypeScript option
`useDefineForClassFields` to enable error checking related to these differences.
### Unsupported syntax
All JS syntax not mentioned above will "pass through" and needs to be supported
by your JS runtime. For example:
* Decorators, private fields, `throw` expressions, generator arrow functions,
and `do` expressions are all unsupported in browsers and Node (as of this
writing), and Sucrase doesn't make an attempt to transpile them.
* Object rest/spread, async functions, and async iterators are all recent
features that should work fine, but might cause issues if you use older
versions of tools like webpack. BigInt and newer regex features may or may not
work, based on your tooling.
### JSX Options
By default, JSX is compiled to React functions in development mode. This can be
configured with a few options:
* **jsxRuntime**: A string specifying the transform mode, which can be one of three values:
* `"classic"` (default): The original JSX transform that calls `React.createElement` by default.
To configure for non-React use cases, specify:
* **jsxPragma**: Element creation function, defaults to `React.createElement`.
* **jsxFragmentPragma**: Fragment component, defaults to `React.Fragment`.
* `"automatic"`: The [new JSX transform](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html)
introduced with React 17, which calls `jsx` functions and auto-adds import statements.
To configure for non-React use cases, specify:
* **jsxImportSource**: Package name for auto-generated import statements, defaults to `react`.
* `"preserve"`: Don't transform JSX, and instead emit it as-is in the output code.
* **production**: If `true`, use production version of functions and don't include debugging
information. When using React in production mode with the automatic transform, this *must* be
set to true to avoid an error about `jsxDEV` being missing.
### Legacy CommonJS interop
Two legacy modes can be used with the `imports` transform:
* **enableLegacyTypeScriptModuleInterop**: Use the default TypeScript approach
to CommonJS interop instead of assuming that TypeScript's `--esModuleInterop`
flag is enabled. For example, if a CJS module exports a function, legacy
TypeScript interop requires you to write `import * as add from './add';`,
while Babel, Webpack, Node.js, and TypeScript with `--esModuleInterop` require
you to write `import add from './add';`. As mentioned in the
[docs](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#support-for-import-d-from-cjs-form-commonjs-modules-with---esmoduleinterop),
the TypeScript team recommends you always use `--esModuleInterop`.
* **enableLegacyBabel5ModuleInterop**: Use the Babel 5 approach to CommonJS
interop, so that you can run `require('./MyModule')` instead of
`require('./MyModule').default`. Analogous to
[babel-plugin-add-module-exports](https://github.com/59naga/babel-plugin-add-module-exports).
## Usage
### Tool integrations
* [Webpack](https://github.com/alangpierce/sucrase/tree/main/integrations/webpack-loader)
* [Gulp](https://github.com/alangpierce/sucrase/tree/main/integrations/gulp-plugin)
* [Jest](https://github.com/alangpierce/sucrase/tree/main/integrations/jest-plugin)
* [Rollup](https://github.com/rollup/plugins/tree/master/packages/sucrase)
* [Broccoli](https://github.com/stefanpenner/broccoli-sucrase)
### Usage in Node
The most robust way is to use the Sucrase plugin for [ts-node](https://github.com/TypeStrong/ts-node),
which has various Node integrations and configures Sucrase via `tsconfig.json`:
```bash
ts-node --transpiler sucrase/ts-node-plugin
```
For projects that don't target ESM, Sucrase also has a require hook with some
reasonable defaults that can be accessed in a few ways:
* From code: `require("sucrase/register");`
* When invoking Node: `node -r sucrase/register main.ts`
* As a separate binary: `sucrase-node main.ts`
Options can be passed to the require hook via a `SUCRASE_OPTIONS` environment
variable holding a JSON string of options.
### Compiling a project to JS
For simple use cases, Sucrase comes with a `sucrase` CLI that mirrors your
directory structure to an output directory:
```bash
sucrase ./srcDir -d ./outDir --transforms typescript,imports
```
### Usage from code
For any advanced use cases, Sucrase can be called from JS directly:
```js
import {transform} from "sucrase";
const compiledCode = transform(code, {transforms: ["typescript", "imports"]}).code;
```
## What Sucrase is not
Sucrase is intended to be useful for the most common cases, but it does not aim
to have nearly the scope and versatility of Babel. Some specific examples:
* Sucrase does not check your code for errors. Sucrase's contract is that if you
give it valid code, it will produce valid JS code. If you give it invalid
code, it might produce invalid code, it might produce valid code, or it might
give an error. Always use Sucrase with a linter or typechecker, which is more
suited for error-checking.
* Sucrase is not pluginizable. With the current architecture, transforms need to
be explicitly written to cooperate with each other, so each additional
transform takes significant extra work.
* Sucrase is not good for prototyping language extensions and upcoming language
features. Its faster architecture makes new transforms more difficult to write
and more fragile.
* Sucrase will never produce code for old browsers like IE. Compiling code down
to ES5 is much more complicated than any transformation that Sucrase needs to
do.
* Sucrase is hesitant to implement upcoming JS features, although some of them
make sense to implement for pragmatic reasons. Its main focus is on language
extensions (JSX, TypeScript, Flow) that will never be supported by JS
runtimes.
* Like Babel, Sucrase is not a typechecker, and must process each file in
isolation. For example, TypeScript `const enum`s are treated as regular
`enum`s rather than inlining across files.
* You should think carefully before using Sucrase in production. Sucrase is
mostly beneficial in development, and in many cases, Babel or tsc will be more
suitable for production builds.
See the [Project Vision](./docs/PROJECT_VISION.md) document for more details on
the philosophy behind Sucrase.
## Motivation
As JavaScript implementations mature, it becomes more and more reasonable to
disable Babel transforms, especially in development when you know that you're
targeting a modern runtime. You might hope that you could simplify and speed up
the build step by eventually disabling Babel entirely, but this isn't possible
if you're using a non-standard language extension like JSX, TypeScript, or Flow.
Unfortunately, disabling most transforms in Babel doesn't speed it up as much as
you might expect. To understand, let's take a look at how Babel works:
1. Tokenize the input source code into a token stream.
2. Parse the token stream into an AST.
3. Walk the AST to compute the scope information for each variable.
4. Apply all transform plugins in a single traversal, resulting in a new AST.
5. Print the resulting AST.
Only step 4 gets faster when disabling plugins, so there's always a fixed cost
to running Babel regardless of how many transforms are enabled.
Sucrase bypasses most of these steps, and works like this:
1. Tokenize the input source code into a token stream using a trimmed-down fork
of the Babel parser. This fork does not produce a full AST, but still
produces meaningful token metadata specifically designed for the later
transforms.
2. Scan through the tokens, computing preliminary information like all
imported/exported names.
3. Run the transform by doing a pass through the tokens and performing a number
of careful find-and-replace operations, like replacing `<Foo` with
`React.createElement(Foo`.
Because Sucrase works on a lower level and uses a custom parser for its use
case, it is much faster than Babel.
## Contributing
Contributions are welcome, whether they be bug reports, PRs, docs, tests, or
anything else! Please take a look through the [Contributing Guide](./CONTRIBUTING.md)
to learn how to get started.
## License and attribution
Sucrase is MIT-licensed. A large part of Sucrase is based on a fork of the
[Babel parser](https://github.com/babel/babel/tree/main/packages/babel-parser),
which is also MIT-licensed.
## Why the name?
Sucrase is an enzyme that processes sugar. Get it?
@@ -0,0 +1,44 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference no-default-lib="true"/>
/// <reference lib="es2015.iterable" />
/// <reference lib="es2020.intl" />
/// <reference lib="es2020.symbol.wellknown" />
interface String {
/**
* Matches a string with a regular expression, and returns an iterable of matches
* containing the results of that search.
* @param regexp A variable name or string literal containing the regular expression pattern and flags.
*/
matchAll(regexp: RegExp): RegExpStringIterator<RegExpExecArray>;
/** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */
toLocaleLowerCase(locales?: Intl.LocalesArgument): string;
/** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */
toLocaleUpperCase(locales?: Intl.LocalesArgument): string;
/**
* Determines whether two strings are equivalent in the current or specified locale.
* @param that String to compare to target string
* @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
* @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
*/
localeCompare(that: string, locales?: Intl.LocalesArgument, options?: Intl.CollatorOptions): number;
}
@@ -0,0 +1,14 @@
/*
* 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 type {TreeProps, TreeState} from './useTreeState';
export {useTreeState} from './useTreeState';
export {TreeCollection} from './TreeCollection';
@@ -0,0 +1,115 @@
// Update with any zlib constants that are added or changed in the future.
// Node v6 didn't export this, so we just hard code the version and rely
// on all the other hard-coded values from zlib v4736. When node v6
// support drops, we can just export the realZlibConstants object.
const realZlibConstants = require('zlib').constants ||
/* istanbul ignore next */ { ZLIB_VERNUM: 4736 }
module.exports = Object.freeze(Object.assign(Object.create(null), {
Z_NO_FLUSH: 0,
Z_PARTIAL_FLUSH: 1,
Z_SYNC_FLUSH: 2,
Z_FULL_FLUSH: 3,
Z_FINISH: 4,
Z_BLOCK: 5,
Z_OK: 0,
Z_STREAM_END: 1,
Z_NEED_DICT: 2,
Z_ERRNO: -1,
Z_STREAM_ERROR: -2,
Z_DATA_ERROR: -3,
Z_MEM_ERROR: -4,
Z_BUF_ERROR: -5,
Z_VERSION_ERROR: -6,
Z_NO_COMPRESSION: 0,
Z_BEST_SPEED: 1,
Z_BEST_COMPRESSION: 9,
Z_DEFAULT_COMPRESSION: -1,
Z_FILTERED: 1,
Z_HUFFMAN_ONLY: 2,
Z_RLE: 3,
Z_FIXED: 4,
Z_DEFAULT_STRATEGY: 0,
DEFLATE: 1,
INFLATE: 2,
GZIP: 3,
GUNZIP: 4,
DEFLATERAW: 5,
INFLATERAW: 6,
UNZIP: 7,
BROTLI_DECODE: 8,
BROTLI_ENCODE: 9,
Z_MIN_WINDOWBITS: 8,
Z_MAX_WINDOWBITS: 15,
Z_DEFAULT_WINDOWBITS: 15,
Z_MIN_CHUNK: 64,
Z_MAX_CHUNK: Infinity,
Z_DEFAULT_CHUNK: 16384,
Z_MIN_MEMLEVEL: 1,
Z_MAX_MEMLEVEL: 9,
Z_DEFAULT_MEMLEVEL: 8,
Z_MIN_LEVEL: -1,
Z_MAX_LEVEL: 9,
Z_DEFAULT_LEVEL: -1,
BROTLI_OPERATION_PROCESS: 0,
BROTLI_OPERATION_FLUSH: 1,
BROTLI_OPERATION_FINISH: 2,
BROTLI_OPERATION_EMIT_METADATA: 3,
BROTLI_MODE_GENERIC: 0,
BROTLI_MODE_TEXT: 1,
BROTLI_MODE_FONT: 2,
BROTLI_DEFAULT_MODE: 0,
BROTLI_MIN_QUALITY: 0,
BROTLI_MAX_QUALITY: 11,
BROTLI_DEFAULT_QUALITY: 11,
BROTLI_MIN_WINDOW_BITS: 10,
BROTLI_MAX_WINDOW_BITS: 24,
BROTLI_LARGE_MAX_WINDOW_BITS: 30,
BROTLI_DEFAULT_WINDOW: 22,
BROTLI_MIN_INPUT_BLOCK_BITS: 16,
BROTLI_MAX_INPUT_BLOCK_BITS: 24,
BROTLI_PARAM_MODE: 0,
BROTLI_PARAM_QUALITY: 1,
BROTLI_PARAM_LGWIN: 2,
BROTLI_PARAM_LGBLOCK: 3,
BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,
BROTLI_PARAM_SIZE_HINT: 5,
BROTLI_PARAM_LARGE_WINDOW: 6,
BROTLI_PARAM_NPOSTFIX: 7,
BROTLI_PARAM_NDIRECT: 8,
BROTLI_DECODER_RESULT_ERROR: 0,
BROTLI_DECODER_RESULT_SUCCESS: 1,
BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,
BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,
BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,
BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,
BROTLI_DECODER_NO_ERROR: 0,
BROTLI_DECODER_SUCCESS: 1,
BROTLI_DECODER_NEEDS_MORE_INPUT: 2,
BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,
BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,
BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,
BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,
BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,
BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,
BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,
BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,
BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,
BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,
BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,
BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,
BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,
BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,
BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,
BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,
BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,
BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,
BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,
BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,
BROTLI_DECODER_ERROR_UNREACHABLE: -31,
}, realZlibConstants))
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Inspect JS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,45 @@
import baseIteratee from './_baseIteratee.js';
import baseWhile from './_baseWhile.js';
/**
* Creates a slice of `array` with elements taken from the end. Elements are
* taken until `predicate` returns falsey. The predicate is invoked with
* three arguments: (value, index, array).
*
* @static
* @memberOf _
* @since 3.0.0
* @category Array
* @param {Array} array The array to query.
* @param {Function} [predicate=_.identity] The function invoked per iteration.
* @returns {Array} Returns the slice of `array`.
* @example
*
* var users = [
* { 'user': 'barney', 'active': true },
* { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': false }
* ];
*
* _.takeRightWhile(users, function(o) { return !o.active; });
* // => objects for ['fred', 'pebbles']
*
* // The `_.matches` iteratee shorthand.
* _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
* // => objects for ['pebbles']
*
* // The `_.matchesProperty` iteratee shorthand.
* _.takeRightWhile(users, ['active', false]);
* // => objects for ['fred', 'pebbles']
*
* // The `_.property` iteratee shorthand.
* _.takeRightWhile(users, 'active');
* // => []
*/
function takeRightWhile(array, predicate) {
return (array && array.length)
? baseWhile(array, baseIteratee(predicate, 3), false, true)
: [];
}
export default takeRightWhile;
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B wC"},B:{"1":"0 1 2 3 4 5 Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I","2":"C L M G N O P"},C:{"1":"0 1 2 3 4 5 FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC","2":"6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB 0C 1C"},D:{"1":"0 1 2 3 4 5 uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","2":"6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB","194":"sB tB"},E:{"1":"G 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","2":"J ZB K D E F A B C 2C ZC 3C 4C 5C 6C aC NC","322":"L M OC 7C"},F:{"1":"0 1 2 3 4 5 hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"6 7 8 9 F B C G N O P aB AB BB CB DB EB FB bB cB dB eB FD GD HD ID NC uC JD OC","194":"fB gB"},G:{"1":"cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC","2":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD","578":"VD WD XD YD ZD aD bD"},H:{"2":"hD"},I:{"2":"TC J I iD jD kD lD vC mD nD"},J:{"2":"D A"},K:{"1":"H","2":"A B C NC uC OC"},L:{"1":"I"},M:{"2":"MC"},N:{"2":"A B"},O:{"1":"PC"},P:{"1":"6 7 8 9 AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD","2":"J"},Q:{"1":"zD"},R:{"1":"0D"},S:{"1":"1D 2D"}},B:5,C:"MediaRecorder API",D:true};
@@ -0,0 +1,15 @@
'use strict';
var $TypeError = require('es-errors/type');
var BigIntLeftShift = require('./leftShift');
// https://262.ecma-international.org/11.0/#sec-numeric-types-bigint-signedRightShift
module.exports = function BigIntSignedRightShift(x, y) {
if (typeof x !== 'bigint' || typeof y !== 'bigint') {
throw new $TypeError('Assertion failed: `x` and `y` arguments must be BigInts');
}
return BigIntLeftShift(x, -y);
};
@@ -0,0 +1,3 @@
declare const _exports: import('eslint').Rule.RuleModule;
export = _exports;
//# sourceMappingURL=style-prop-object.d.ts.map
@@ -0,0 +1,39 @@
import type { AttestationFormat } from '../helpers/decodeAttestationObject.js';
import type { Uint8Array_ } from '../types/index.js';
export type RootCertIdentifier = AttestationFormat | 'mds';
interface SettingsService {
/**
* Set potential root certificates for attestation formats that use them. Root certs will be tried
* one-by-one when validating a certificate path.
*
* Certificates can be specified as a raw `Buffer`, or as a PEM-formatted string. If a
* `Buffer` is passed in it will be converted to PEM format.
*/
setRootCertificates(opts: {
identifier: RootCertIdentifier;
certificates: (Uint8Array_ | string)[];
}): void;
/**
* Get any registered root certificates for the specified attestation format
*/
getRootCertificates(opts: {
identifier: RootCertIdentifier;
}): string[];
}
/**
* A basic service for specifying acceptable root certificates for all supported attestation
* statement formats.
*
* In addition, default root certificates are included for the following statement formats:
*
* - `'android-key'`
* - `'android-safetynet'`
* - `'apple'`
* - `'android-mds'`
*
* These can be overwritten as needed by setting alternative root certificates for their format
* identifier using `setRootCertificates()`.
*/
export declare const SettingsService: SettingsService;
export {};
//# sourceMappingURL=settingsService.d.ts.map
@@ -0,0 +1,30 @@
import eq from './eq.js';
import isArrayLike from './isArrayLike.js';
import isIndex from './_isIndex.js';
import isObject from './isObject.js';
/**
* Checks if the given arguments are from an iteratee call.
*
* @private
* @param {*} value The potential iteratee value argument.
* @param {*} index The potential iteratee index or key argument.
* @param {*} object The potential iteratee object argument.
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
* else `false`.
*/
function isIterateeCall(value, index, object) {
if (!isObject(object)) {
return false;
}
var type = typeof index;
if (type == 'number'
? (isArrayLike(object) && isIndex(index, object.length))
: (type == 'string' && index in object)
) {
return eq(object[index], value);
}
return false;
}
export default isIterateeCall;
@@ -0,0 +1,4 @@
'use strict';
const ansiRegex = require('ansi-regex');
module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;
@@ -0,0 +1,670 @@
/* global window */
/* eslint-disable eqeqeq, prefer-const, @typescript-eslint/no-empty-function */
/*! Copyright (c) Meta Platforms, Inc. and affiliates. **/
/**
* This is simplified pure-js version of https://github.com/facebook/react/blob/main/packages/react-refresh/src/ReactFreshRuntime.js
* without IE11 compatibility and verbose isDev checks.
* Some utils are appended at the bottom for HMR integration.
*/
const REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref')
const REACT_MEMO_TYPE = Symbol.for('react.memo')
// We never remove these associations.
// It's OK to reference families, but use WeakMap/Set for types.
let allFamiliesByID = new Map()
let allFamiliesByType = new WeakMap()
let allSignaturesByType = new WeakMap()
// This WeakMap is read by React, so we only put families
// that have actually been edited here. This keeps checks fast.
const updatedFamiliesByType = new WeakMap()
// This is cleared on every performReactRefresh() call.
// It is an array of [Family, NextType] tuples.
let pendingUpdates = []
// This is injected by the renderer via DevTools global hook.
const helpersByRendererID = new Map()
const helpersByRoot = new Map()
// We keep track of mounted roots so we can schedule updates.
const mountedRoots = new Set()
// If a root captures an error, we remember it so we can retry on edit.
const failedRoots = new Set()
// We also remember the last element for every root.
// It needs to be weak because we do this even for roots that failed to mount.
// If there is no WeakMap, we won't attempt to do retrying.
let rootElements = new WeakMap()
let isPerformingRefresh = false
function computeFullKey(signature) {
if (signature.fullKey !== null) {
return signature.fullKey
}
let fullKey = signature.ownKey
let hooks
try {
hooks = signature.getCustomHooks()
} catch (err) {
// This can happen in an edge case, e.g. if expression like Foo.useSomething
// depends on Foo which is lazily initialized during rendering.
// In that case just assume we'll have to remount.
signature.forceReset = true
signature.fullKey = fullKey
return fullKey
}
for (let i = 0; i < hooks.length; i++) {
const hook = hooks[i]
if (typeof hook !== 'function') {
// Something's wrong. Assume we need to remount.
signature.forceReset = true
signature.fullKey = fullKey
return fullKey
}
const nestedHookSignature = allSignaturesByType.get(hook)
if (nestedHookSignature === undefined) {
// No signature means Hook wasn't in the source code, e.g. in a library.
// We'll skip it because we can assume it won't change during this session.
continue
}
const nestedHookKey = computeFullKey(nestedHookSignature)
if (nestedHookSignature.forceReset) {
signature.forceReset = true
}
fullKey += '\n---\n' + nestedHookKey
}
signature.fullKey = fullKey
return fullKey
}
function haveEqualSignatures(prevType, nextType) {
const prevSignature = allSignaturesByType.get(prevType)
const nextSignature = allSignaturesByType.get(nextType)
if (prevSignature === undefined && nextSignature === undefined) {
return true
}
if (prevSignature === undefined || nextSignature === undefined) {
return false
}
if (computeFullKey(prevSignature) !== computeFullKey(nextSignature)) {
return false
}
if (nextSignature.forceReset) {
return false
}
return true
}
function isReactClass(type) {
return type.prototype && type.prototype.isReactComponent
}
function canPreserveStateBetween(prevType, nextType) {
if (isReactClass(prevType) || isReactClass(nextType)) {
return false
}
if (haveEqualSignatures(prevType, nextType)) {
return true
}
return false
}
function resolveFamily(type) {
// Only check updated types to keep lookups fast.
return updatedFamiliesByType.get(type)
}
// This is a safety mechanism to protect against rogue getters and Proxies.
function getProperty(object, property) {
try {
return object[property]
} catch (err) {
// Intentionally ignore.
return undefined
}
}
function performReactRefresh() {
if (pendingUpdates.length === 0) {
return null
}
if (isPerformingRefresh) {
return null
}
isPerformingRefresh = true
try {
const staleFamilies = new Set()
const updatedFamilies = new Set()
const updates = pendingUpdates
pendingUpdates = []
updates.forEach(([family, nextType]) => {
// Now that we got a real edit, we can create associations
// that will be read by the React reconciler.
const prevType = family.current
updatedFamiliesByType.set(prevType, family)
updatedFamiliesByType.set(nextType, family)
family.current = nextType
// Determine whether this should be a re-render or a re-mount.
if (canPreserveStateBetween(prevType, nextType)) {
updatedFamilies.add(family)
} else {
staleFamilies.add(family)
}
})
// TODO: rename these fields to something more meaningful.
const update = {
updatedFamilies, // Families that will re-render preserving state
staleFamilies, // Families that will be remounted
}
helpersByRendererID.forEach((helpers) => {
// Even if there are no roots, set the handler on first update.
// This ensures that if *new* roots are mounted, they'll use the resolve handler.
helpers.setRefreshHandler(resolveFamily)
})
let didError = false
let firstError = null
// We snapshot maps and sets that are mutated during commits.
// If we don't do this, there is a risk they will be mutated while
// we iterate over them. For example, trying to recover a failed root
// may cause another root to be added to the failed list -- an infinite loop.
const failedRootsSnapshot = new Set(failedRoots)
const mountedRootsSnapshot = new Set(mountedRoots)
const helpersByRootSnapshot = new Map(helpersByRoot)
failedRootsSnapshot.forEach((root) => {
const helpers = helpersByRootSnapshot.get(root)
if (helpers === undefined) {
throw new Error(
'Could not find helpers for a root. This is a bug in React Refresh.',
)
}
if (!failedRoots.has(root)) {
// No longer failed.
}
if (rootElements === null) {
return
}
if (!rootElements.has(root)) {
return
}
const element = rootElements.get(root)
try {
helpers.scheduleRoot(root, element)
} catch (err) {
if (!didError) {
didError = true
firstError = err
}
// Keep trying other roots.
}
})
mountedRootsSnapshot.forEach((root) => {
const helpers = helpersByRootSnapshot.get(root)
if (helpers === undefined) {
throw new Error(
'Could not find helpers for a root. This is a bug in React Refresh.',
)
}
if (!mountedRoots.has(root)) {
// No longer mounted.
}
try {
helpers.scheduleRefresh(root, update)
} catch (err) {
if (!didError) {
didError = true
firstError = err
}
// Keep trying other roots.
}
})
if (didError) {
throw firstError
}
return update
} finally {
isPerformingRefresh = false
}
}
function register(type, id) {
if (type === null) {
return
}
if (typeof type !== 'function' && typeof type !== 'object') {
return
}
// This can happen in an edge case, e.g. if we register
// return value of a HOC but it returns a cached component.
// Ignore anything but the first registration for each type.
if (allFamiliesByType.has(type)) {
return
}
// Create family or remember to update it.
// None of this bookkeeping affects reconciliation
// until the first performReactRefresh() call above.
let family = allFamiliesByID.get(id)
if (family === undefined) {
family = { current: type }
allFamiliesByID.set(id, family)
} else {
pendingUpdates.push([family, type])
}
allFamiliesByType.set(type, family)
// Visit inner types because we might not have registered them.
if (typeof type === 'object' && type !== null) {
switch (getProperty(type, '$$typeof')) {
case REACT_FORWARD_REF_TYPE:
register(type.render, id + '$render')
break
case REACT_MEMO_TYPE:
register(type.type, id + '$type')
break
}
}
}
function setSignature(type, key, forceReset, getCustomHooks) {
if (!allSignaturesByType.has(type)) {
allSignaturesByType.set(type, {
forceReset,
ownKey: key,
fullKey: null,
getCustomHooks: getCustomHooks || (() => []),
})
}
// Visit inner types because we might not have signed them.
if (typeof type === 'object' && type !== null) {
switch (getProperty(type, '$$typeof')) {
case REACT_FORWARD_REF_TYPE:
setSignature(type.render, key, forceReset, getCustomHooks)
break
case REACT_MEMO_TYPE:
setSignature(type.type, key, forceReset, getCustomHooks)
break
}
}
}
// This is lazily called during first render for a type.
// It captures Hook list at that time so inline requires don't break comparisons.
function collectCustomHooksForSignature(type) {
const signature = allSignaturesByType.get(type)
if (signature !== undefined) {
computeFullKey(signature)
}
}
export function injectIntoGlobalHook(globalObject) {
// For React Native, the global hook will be set up by require('react-devtools-core').
// That code will run before us. So we need to monkeypatch functions on existing hook.
// For React Web, the global hook will be set up by the extension.
// This will also run before us.
let hook = globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__
if (hook === undefined) {
// However, if there is no DevTools extension, we'll need to set up the global hook ourselves.
// Note that in this case it's important that renderer code runs *after* this method call.
// Otherwise, the renderer will think that there is no global hook, and won't do the injection.
let nextID = 0
globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook = {
renderers: new Map(),
supportsFiber: true,
inject: (injected) => nextID++,
onScheduleFiberRoot: (id, root, children) => {},
onCommitFiberRoot: (id, root, maybePriorityLevel, didError) => {},
onCommitFiberUnmount() {},
}
}
if (hook.isDisabled) {
// This isn't a real property on the hook, but it can be set to opt out
// of DevTools integration and associated warnings and logs.
// Using console['warn'] to evade Babel and ESLint
console['warn'](
'Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). ' +
'Fast Refresh is not compatible with this shim and will be disabled.',
)
return
}
// Here, we just want to get a reference to scheduleRefresh.
const oldInject = hook.inject
hook.inject = function (injected) {
const id = oldInject.apply(this, arguments)
if (
typeof injected.scheduleRefresh === 'function' &&
typeof injected.setRefreshHandler === 'function'
) {
// This version supports React Refresh.
helpersByRendererID.set(id, injected)
}
return id
}
// Do the same for any already injected roots.
// This is useful if ReactDOM has already been initialized.
// https://github.com/facebook/react/issues/17626
hook.renderers.forEach((injected, id) => {
if (
typeof injected.scheduleRefresh === 'function' &&
typeof injected.setRefreshHandler === 'function'
) {
// This version supports React Refresh.
helpersByRendererID.set(id, injected)
}
})
// We also want to track currently mounted roots.
const oldOnCommitFiberRoot = hook.onCommitFiberRoot
const oldOnScheduleFiberRoot = hook.onScheduleFiberRoot || (() => {})
hook.onScheduleFiberRoot = function (id, root, children) {
if (!isPerformingRefresh) {
// If it was intentionally scheduled, don't attempt to restore.
// This includes intentionally scheduled unmounts.
failedRoots.delete(root)
if (rootElements !== null) {
rootElements.set(root, children)
}
}
return oldOnScheduleFiberRoot.apply(this, arguments)
}
hook.onCommitFiberRoot = function (id, root, maybePriorityLevel, didError) {
const helpers = helpersByRendererID.get(id)
if (helpers !== undefined) {
helpersByRoot.set(root, helpers)
const current = root.current
const alternate = current.alternate
// We need to determine whether this root has just (un)mounted.
// This logic is copy-pasted from similar logic in the DevTools backend.
// If this breaks with some refactoring, you'll want to update DevTools too.
if (alternate !== null) {
const wasMounted =
alternate.memoizedState != null &&
alternate.memoizedState.element != null &&
mountedRoots.has(root)
const isMounted =
current.memoizedState != null && current.memoizedState.element != null
if (!wasMounted && isMounted) {
// Mount a new root.
mountedRoots.add(root)
failedRoots.delete(root)
} else if (wasMounted && isMounted) {
// Update an existing root.
// This doesn't affect our mounted root Set.
} else if (wasMounted && !isMounted) {
// Unmount an existing root.
mountedRoots.delete(root)
if (didError) {
// We'll remount it on future edits.
failedRoots.add(root)
} else {
helpersByRoot.delete(root)
}
} else if (!wasMounted && !isMounted) {
if (didError) {
// We'll remount it on future edits.
failedRoots.add(root)
}
}
} else {
// Mount a new root.
mountedRoots.add(root)
}
}
// Always call the decorated DevTools hook.
return oldOnCommitFiberRoot.apply(this, arguments)
}
}
// This is a wrapper over more primitive functions for setting signature.
// Signatures let us decide whether the Hook order has changed on refresh.
//
// This function is intended to be used as a transform target, e.g.:
// var _s = createSignatureFunctionForTransform()
//
// function Hello() {
// const [foo, setFoo] = useState(0);
// const value = useCustomHook();
// _s(); /* Call without arguments triggers collecting the custom Hook list.
// * This doesn't happen during the module evaluation because we
// * don't want to change the module order with inline requires.
// * Next calls are noops. */
// return <h1>Hi</h1>;
// }
//
// /* Call with arguments attaches the signature to the type: */
// _s(
// Hello,
// 'useState{[foo, setFoo]}(0)',
// () => [useCustomHook], /* Lazy to avoid triggering inline requires */
// );
export function createSignatureFunctionForTransform() {
let savedType
let hasCustomHooks
let didCollectHooks = false
return function (type, key, forceReset, getCustomHooks) {
if (typeof key === 'string') {
// We're in the initial phase that associates signatures
// with the functions. Note this may be called multiple times
// in HOC chains like _s(hoc1(_s(hoc2(_s(actualFunction))))).
if (!savedType) {
// We're in the innermost call, so this is the actual type.
// $FlowFixMe[escaped-generic] discovered when updating Flow
savedType = type
hasCustomHooks = typeof getCustomHooks === 'function'
}
// Set the signature for all types (even wrappers!) in case
// they have no signatures of their own. This is to prevent
// problems like https://github.com/facebook/react/issues/20417.
if (
type != null &&
(typeof type === 'function' || typeof type === 'object')
) {
setSignature(type, key, forceReset, getCustomHooks)
}
return type
} else {
// We're in the _s() call without arguments, which means
// this is the time to collect custom Hook signatures.
// Only do this once. This path is hot and runs *inside* every render!
if (!didCollectHooks && hasCustomHooks) {
didCollectHooks = true
collectCustomHooksForSignature(savedType)
}
}
}
}
function isLikelyComponentType(type) {
switch (typeof type) {
case 'function': {
// First, deal with classes.
if (type.prototype != null) {
if (type.prototype.isReactComponent) {
// React class.
return true
}
const ownNames = Object.getOwnPropertyNames(type.prototype)
if (ownNames.length > 1 || ownNames[0] !== 'constructor') {
// This looks like a class.
return false
}
if (type.prototype.__proto__ !== Object.prototype) {
// It has a superclass.
return false
}
// Pass through.
// This looks like a regular function with empty prototype.
}
// For plain functions and arrows, use name as a heuristic.
const name = type.name || type.displayName
return typeof name === 'string' && /^[A-Z]/.test(name)
}
case 'object': {
if (type != null) {
switch (getProperty(type, '$$typeof')) {
case REACT_FORWARD_REF_TYPE:
case REACT_MEMO_TYPE:
// Definitely React components.
return true
default:
return false
}
}
return false
}
default: {
return false
}
}
}
function isCompoundComponent(type) {
if (!isPlainObject(type)) return false
for (const key in type) {
if (!isLikelyComponentType(type[key])) return false
}
return true
}
function isPlainObject(obj) {
return (
Object.prototype.toString.call(obj) === '[object Object]' &&
(obj.constructor === Object || obj.constructor === undefined)
)
}
/**
* Plugin utils
*/
export function getRefreshReg(filename) {
return (type, id) => register(type, filename + ' ' + id)
}
// Taken from https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/lib/runtime/RefreshUtils.js#L141
// This allows to resister components not detected by SWC like styled component
export function registerExportsForReactRefresh(filename, moduleExports) {
for (const key in moduleExports) {
if (key === '__esModule') continue
const exportValue = moduleExports[key]
if (isLikelyComponentType(exportValue)) {
// 'export' is required to avoid key collision when renamed exports that
// shadow a local component name: https://github.com/vitejs/vite-plugin-react/issues/116
// The register function has an identity check to not register twice the same component,
// so this is safe to not used the same key here.
register(exportValue, filename + ' export ' + key)
} else if (isCompoundComponent(exportValue)) {
for (const subKey in exportValue) {
register(
exportValue[subKey],
filename + ' export ' + key + '-' + subKey,
)
}
}
}
}
function debounce(fn, delay) {
let handle
return () => {
clearTimeout(handle)
handle = setTimeout(fn, delay)
}
}
const hooks = []
window.__registerBeforePerformReactRefresh = (cb) => {
hooks.push(cb)
}
const enqueueUpdate = debounce(async () => {
if (hooks.length) await Promise.all(hooks.map((cb) => cb()))
performReactRefresh()
}, 16)
export function validateRefreshBoundaryAndEnqueueUpdate(
id,
prevExports,
nextExports,
) {
const ignoredExports = window.__getReactRefreshIgnoredExports?.({ id }) ?? []
if (
predicateOnExport(
ignoredExports,
prevExports,
(key) => key in nextExports,
) !== true
) {
return 'Could not Fast Refresh (export removed)'
}
if (
predicateOnExport(
ignoredExports,
nextExports,
(key) => key in prevExports,
) !== true
) {
return 'Could not Fast Refresh (new export)'
}
let hasExports = false
const allExportsAreComponentsOrUnchanged = predicateOnExport(
ignoredExports,
nextExports,
(key, value) => {
hasExports = true
if (isLikelyComponentType(value)) return true
if (isCompoundComponent(value)) return true
return prevExports[key] === nextExports[key]
},
)
if (hasExports && allExportsAreComponentsOrUnchanged === true) {
enqueueUpdate()
} else {
return `Could not Fast Refresh ("${allExportsAreComponentsOrUnchanged}" export is incompatible). Learn more at __README_URL__#consistent-components-exports`
}
}
function predicateOnExport(ignoredExports, moduleExports, predicate) {
for (const key in moduleExports) {
if (key === '__esModule') continue
if (ignoredExports.includes(key)) continue
const desc = Object.getOwnPropertyDescriptor(moduleExports, key)
if (desc && desc.get) return key
if (!predicate(key, moduleExports[key])) return key
}
return true
}
// Hides vite-ignored dynamic import so that Vite can skip analysis if no other
// dynamic import is present (https://github.com/vitejs/vite/pull/12732)
export const __hmr_import = (module) => import(/* @vite-ignore */ module)
// For backwards compatibility with @vitejs/plugin-react.
export default { injectIntoGlobalHook }
@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isNoAncestorBindingConstraintsWithName = isNoAncestorBindingConstraintsWithName;
const isBindingConstraintsWithName_1 = require("./isBindingConstraintsWithName");
const isNoAncestorBindingConstraints_1 = require("./isNoAncestorBindingConstraints");
function isNoAncestorBindingConstraintsWithName(name) {
return (0, isNoAncestorBindingConstraints_1.isNoAncestorBindingConstraints)((0, isBindingConstraintsWithName_1.isBindingConstraintsWithName)(name));
}
//# sourceMappingURL=isNoAncestorBindingConstraintsWithName.js.map
@@ -0,0 +1,4 @@
import type { TSESLint } from '@typescript-eslint/utils';
export type MessageIds = 'defineInitializer' | 'defineInitializerSuggestion';
declare const _default: TSESLint.RuleModule<MessageIds, [], import("../../rules").ESLintPluginDocs, TSESLint.RuleListener>;
export default _default;
@@ -0,0 +1 @@
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,kEAAkE;AAClE,2DAA2D;AAC3D,yDAAyD;AACzD,kHAAkH;;;AAiBlH,oGAAoG;AACpG,iFAAiF;AACjF,sDAAsD;AACtD,IAAI,wDAAkC;AACtC,IAAI,mCAAa;AAEjB,SAAS;IACP,wDAAkC;IAElC,wFAAwF;IACxF,sFAAsF;IACtF,wFAAwF;IACxF,oEAAoE;IACpE,WAAW;QACT,wDAAkC;IACpC,GAAG;AACL;AAEA,SAAS,+CAAyB,CAAe;IAC/C,IAAI,EAAE,WAAW,KAAK,SACpB;AAEJ;AAEA,SAAS;IACP,IAAI,OAAO,aAAa,aACtB;IAGF,IAAI,qCAAe,GAAG;QACpB,IAAI,OAAO,iBAAiB,aAC1B,SAAS,gBAAgB,CAAC,aAAa;aAClC,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,QAClC,SAAS,gBAAgB,CAAC,YAAY;IAE1C;IAEA;IACA,OAAO;QACL;QACA,IAAI,mCAAa,GACf;QAGF,IAAI,OAAO,iBAAiB,aAC1B,SAAS,mBAAmB,CAAC,aAAa;aACrC,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,QAClC,SAAS,mBAAmB,CAAC,YAAY;IAE7C;AACF;AAMO,SAAS,0CAAS,KAAiB;IACxC,IAAI,gBACF,YAAY,iBACZ,aAAa,cACb,UAAU,cACV,UAAU,EACX,GAAG;IAEJ,IAAI,CAAC,WAAW,WAAW,GAAG,CAAA,GAAA,eAAO,EAAE;IACvC,IAAI,QAAQ,CAAA,GAAA,aAAK,EAAE;QACjB,WAAW;QACX,2BAA2B;QAC3B,aAAa;QACb,QAAQ;IACV,GAAG,OAAO;IAEV,CAAA,GAAA,gBAAQ,EAAE,8CAAwB,EAAE;IACpC,IAAI,qBAAC,iBAAiB,4BAAE,wBAAwB,EAAC,GAAG,CAAA,GAAA,yBAAiB;IAErE,IAAI,cAAC,UAAU,mBAAE,eAAe,EAAC,GAAG,CAAA,GAAA,cAAM,EAAE;QAC1C,IAAI,oBAAoB,CAAC,OAAO;YAC9B,MAAM,WAAW,GAAG;YACpB,IAAI,cAAc,gBAAgB,WAAW,MAAM,SAAS,IAAI,CAAC,MAAM,aAAa,CAAC,QAAQ,CAAC,MAAM,MAAM,GACxG;YAGF,MAAM,SAAS,GAAG;YAClB,IAAI,SAAS,MAAM,aAAa;YAChC,MAAM,MAAM,GAAG;YAEf,kGAAkG;YAClG,gGAAgG;YAChG,kFAAkF;YAClF,yGAAyG;YACzG,kBAAkB,CAAA,GAAA,uBAAe,EAAE,MAAM,MAAM,GAAG,eAAe,CAAA;gBAC/D,IAAI,MAAM,SAAS,IAAI,MAAM,MAAM,IAAI,CAAC,CAAA,GAAA,mBAAW,EAAE,MAAM,MAAM,EAAE,EAAE,MAAM,GACzE,gBAAgB,GAAG,EAAE,WAAW;YAEpC,GAAG;gBAAC,SAAS;YAAI;YAEjB,IAAI,cACF,aAAa;gBACX,MAAM;wBACN;6BACA;YACF;YAGF,IAAI,eACF,cAAc;YAGhB,WAAW;QACb;QAEA,IAAI,kBAAkB,CAAC,OAAO;YAC5B,IAAI,SAAS,MAAM,MAAM;YACzB,MAAM,WAAW,GAAG;YACpB,MAAM,MAAM,GAAG;YAEf,IAAI,gBAAgB,WAAW,CAAC,MAAM,SAAS,IAAI,CAAC,QAClD;YAGF,MAAM,SAAS,GAAG;YAClB;YAEA,IAAI,YACF,WAAW;gBACT,MAAM;wBACN;6BACA;YACF;YAGF,IAAI,eACF,cAAc;YAGhB,WAAW;QACb;QAEA,IAAI,aAA4B,CAAC;QAEjC,IAAI,OAAO,iBAAiB,aAAa;YACvC,WAAW,cAAc,GAAG,CAAC;gBAC3B,IAAI,yDAAmC,EAAE,WAAW,KAAK,SACvD;gBAGF,kBAAkB,GAAG,EAAE,WAAW;YACpC;YAEA,WAAW,cAAc,GAAG,CAAC;gBAC3B,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAClD,gBAAgB,GAAG,EAAE,WAAW;YAEpC;QACF,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,QAAQ;YAC1C,WAAW,YAAY,GAAG;gBACxB,MAAM,yBAAyB,GAAG;YACpC;YAEA,WAAW,YAAY,GAAG,CAAC;gBACzB,IAAI,CAAC,MAAM,yBAAyB,IAAI,CAAC,uDACvC,kBAAkB,GAAG;gBAGvB,MAAM,yBAAyB,GAAG;YACpC;YAEA,WAAW,YAAY,GAAG,CAAC;gBACzB,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GAClD,gBAAgB,GAAG;YAEvB;QACF;QACA,OAAO;wBAAC;6BAAY;QAAe;IACrC,GAAG;QAAC;QAAc;QAAe;QAAY;QAAY;QAAO;QAAmB;KAAyB;IAE5G,CAAA,GAAA,gBAAQ,EAAE;QACR,iEAAiE;QACjE,qFAAqF;QACrF,IAAI,YACF,gBAAgB;YAAC,eAAe,MAAM,MAAM;QAAA,GAAG,MAAM,WAAW;IAEpE,uDAAuD;IACvD,GAAG;QAAC;KAAW;IAEf,OAAO;oBACL;mBACA;IACF;AACF","sources":["packages/@react-aria/interactions/src/useHover.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Portions of the code in this file are based on code from react.\n// Original licensing for the following can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions\n\nimport {DOMAttributes, HoverEvents} from '@react-types/shared';\nimport {getOwnerDocument, nodeContains, useGlobalListeners} from '@react-aria/utils';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\nexport interface HoverProps extends HoverEvents {\n /** Whether the hover events should be disabled. */\n isDisabled?: boolean\n}\n\nexport interface HoverResult {\n /** Props to spread on the target element. */\n hoverProps: DOMAttributes,\n isHovered: boolean\n}\n\n// iOS fires onPointerEnter twice: once with pointerType=\"touch\" and again with pointerType=\"mouse\".\n// We want to ignore these emulated events so they do not trigger hover behavior.\n// See https://bugs.webkit.org/show_bug.cgi?id=214609.\nlet globalIgnoreEmulatedMouseEvents = false;\nlet hoverCount = 0;\n\nfunction setGlobalIgnoreEmulatedMouseEvents() {\n globalIgnoreEmulatedMouseEvents = true;\n\n // Clear globalIgnoreEmulatedMouseEvents after a short timeout. iOS fires onPointerEnter\n // with pointerType=\"mouse\" immediately after onPointerUp and before onFocus. On other\n // devices that don't have this quirk, we don't want to ignore a mouse hover sometime in\n // the distant future because a user previously touched the element.\n Line truncated
@@ -0,0 +1 @@
{"mappings":"AAAA;;;;;;;;;;CAUC,GAED,iFAAiF;AACjF,uFAAuF;AACvF,IAAI,oCAAc,IAAI;AAKtB,IAAI,sCAAwC,EAAE;AAUvC,SAAS,0CAAgB,OAAkB,EAAE,OAAO,SAAS,IAAI;IACtE,IAAI,eAAe,IAAI,IAAa;IACpC,IAAI,cAAc,IAAI;IAEtB,IAAI,OAAO,CAAC;QACV,oEAAoE;QACpE,KAAK,IAAI,WAAW,KAAK,gBAAgB,CAAC,sDACxC,aAAa,GAAG,CAAC;QAGnB,IAAI,aAAa,CAAC;YAChB,yFAAyF;YACzF,2FAA2F;YAC3F,uGAAuG;YACvG,2GAA2G;YAC3G,IACE,aAAa,GAAG,CAAC,SAChB,KAAK,aAAa,IAAI,YAAY,GAAG,CAAC,KAAK,aAAa,KAAK,KAAK,aAAa,CAAC,YAAY,CAAC,YAAY,OAE1G,OAAO,WAAW,aAAa;YAGjC,oFAAoF;YACpF,KAAK,IAAI,UAAU,aAAc;gBAC/B,IAAI,KAAK,QAAQ,CAAC,SAChB,OAAO,WAAW,WAAW;YAEjC;YAEA,OAAO,WAAW,aAAa;QACjC;QAEA,IAAI,SAAS,SAAS,gBAAgB,CACpC,MACA,WAAW,YAAY,EACvB;wBAAC;QAAU;QAGb,wCAAwC;QACxC,IAAI,aAAa,WAAW;QAC5B,IAAI,eAAe,WAAW,aAAa,EACzC,KAAK;QAGP,IAAI,eAAe,WAAW,aAAa,EAAE;YAC3C,IAAI,OAAO,OAAO,QAAQ;YAC1B,MAAO,QAAQ,KAAM;gBACnB,KAAK;gBACL,OAAO,OAAO,QAAQ;YACxB;QACF;IACF;IAEA,IAAI,OAAO,CAAC;YACK;QAAf,IAAI,WAAW,CAAA,mBAAA,kCAAY,GAAG,CAAC,mBAAhB,8BAAA,mBAAyB;QAExC,uEAAuE;QACvE,uDAAuD;QACvD,IAAI,KAAK,YAAY,CAAC,mBAAmB,UAAU,aAAa,GAC9D;QAGF,IAAI,aAAa,GACf,KAAK,YAAY,CAAC,eAAe;QAGnC,YAAY,GAAG,CAAC;QAChB,kCAAY,GAAG,CAAC,MAAM,WAAW;IACnC;IAEA,yEAAyE;IACzE,0CAA0C;IAC1C,IAAI,oCAAc,MAAM,EACtB,mCAAa,CAAC,oCAAc,MAAM,GAAG,EAAE,CAAC,UAAU;IAGpD,KAAK;IAEL,IAAI,WAAW,IAAI,iBAAiB,CAAA;QAClC,KAAK,IAAI,UAAU,QAAS;YAC1B,IAAI,OAAO,IAAI,KAAK,eAAe,OAAO,UAAU,CAAC,MAAM,KAAK,GAC9D;YAGF,6EAA6E;YAC7E,sEAAsE;YACtE,IAAI,CAAC;mBAAI;mBAAiB;aAAY,CAAC,IAAI,CAAC,CAAA,OAAQ,KAAK,QAAQ,CAAC,OAAO,MAAM,IAAI;gBACjF,KAAK,IAAI,QAAQ,OAAO,YAAY,CAClC,IAAI,gBAAgB,SAAS;oBAC3B,aAAa,MAAM,CAAC;oBACpB,YAAY,MAAM,CAAC;gBACrB;gBAGF,KAAK,IAAI,QAAQ,OAAO,UAAU,CAAE;oBAClC,IACE,AAAC,CAAA,gBAAgB,eAAe,gBAAgB,UAAS,KACxD,CAAA,KAAK,OAAO,CAAC,aAAa,KAAK,UAAU,KAAK,OAAO,CAAC,iBAAiB,KAAK,MAAK,GAElF,aAAa,GAAG,CAAC;yBACZ,IAAI,gBAAgB,SACzB,KAAK;gBAET;YACF;QACF;IACF;IAEA,SAAS,OAAO,CAAC,MAAM;QAAC,WAAW;QAAM,SAAS;IAAI;IAEtD,IAAI,kBAAmC;QACrC;YACE,SAAS,OAAO,CAAC,MAAM;gBAAC,WAAW;gBAAM,SAAS;YAAI;QACxD;QACA;YACE,SAAS,UAAU;QACrB;IACF;IAEA,oCAAc,IAAI,CAAC;IAEnB,OAAO;QACL,SAAS,UAAU;QAEnB,KAAK,IAAI,QAAQ,YAAa;YAC5B,IAAI,QAAQ,kCAAY,GAAG,CAAC;YAC5B,IAAI,SAAS,MACX;YAEF,IAAI,UAAU,GAAG;gBACf,KAAK,eAAe,CAAC;gBACrB,kCAAY,MAAM,CAAC;YACrB,OACE,kCAAY,GAAG,CAAC,MAAM,QAAQ;QAElC;QAEA,mEAAmE;QACnE,IAAI,oBAAoB,mCAAa,CAAC,oCAAc,MAAM,GAAG,EAAE,EAAE;YAC/D,oCAAc,GAAG;YACjB,IAAI,oCAAc,MAAM,EACtB,mCAAa,CAAC,oCAAc,MAAM,GAAG,EAAE,CAAC,OAAO;QAEnD,OACE,oCAAc,MAAM,CAAC,oCAAc,OAAO,CAAC,kBAAkB;IAEjE;AACF","sources":["packages/@react-aria/overlays/src/ariaHideOutside.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Keeps a ref count of all hidden elements. Added to when hiding an element, and\n// subtracted from when showing it again. When it reaches zero, aria-hidden is removed.\nlet refCountMap = new WeakMap<Element, number>();\ninterface ObserverWrapper {\n observe: () => void,\n disconnect: () => void\n}\nlet observerStack: Array<ObserverWrapper> = [];\n\n/**\n * Hides all elements in the DOM outside the given targets from screen readers using aria-hidden,\n * and returns a function to revert these changes. In addition, changes to the DOM are watched\n * and new elements outside the targets are automatically hidden.\n * @param targets - The elements that should remain visible.\n * @param root - Nothing will be hidden above this element.\n * @returns - A function to restore all hidden elements.\n */\nexport function ariaHideOutside(targets: Element[], root = document.body) {\n let visibleNodes = new Set<Element>(targets);\n let hiddenNodes = new Set<Element>();\n\n let walk = (root: Element) => {\n // Keep live announcer and top layer elements (e.g. toasts) visible.\n for (let element of root.querySelectorAll('[data-live-announcer], [data-react-aria-top-layer]')) {\n visibleNodes.add(element);\n }\n\n let acceptNode = (node: Element) => {\n // Skip this node and its children if it is one of the target nodes, or a live announcer.\n // Also skip children of already hidden nodes, as aria-hidden is recursive. An exception is\n // made for elements with role=\"row\" since VoiceOver on iOS has issues hiding elements with role=\"row\".\n // For that case we want to hide the cells inside as well (https://bugs.webkit.org/show_bug.cgi?id=222623).\n if (\n visibleNodes.has(node) ||\n (node.parentElement && hiddenNodes.has(node.parentElement) && node.parentElement.getAttribute('role') !== Line truncated
@@ -0,0 +1,11 @@
'use strict'
var EventEmitter = require('events').EventEmitter
var util = require('util')
var trackerId = 0
var TrackerBase = module.exports = function (name) {
EventEmitter.call(this)
this.id = ++trackerId
this.name = name
}
util.inherits(TrackerBase, EventEmitter)
@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = buildChildren;
var _index = require("../../validators/generated/index.js");
var _cleanJSXElementLiteralChild = require("../../utils/react/cleanJSXElementLiteralChild.js");
function buildChildren(node) {
const elements = [];
for (let i = 0; i < node.children.length; i++) {
let child = node.children[i];
if ((0, _index.isJSXText)(child)) {
(0, _cleanJSXElementLiteralChild.default)(child, elements);
continue;
}
if ((0, _index.isJSXExpressionContainer)(child)) child = child.expression;
if ((0, _index.isJSXEmptyExpression)(child)) continue;
elements.push(child);
}
return elements;
}
//# sourceMappingURL=buildChildren.js.map
@@ -0,0 +1,50 @@
import unsupportedIterableToArray from "./unsupportedIterableToArray.js";
function _createForOfIteratorHelper(r, e) {
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (!t) {
if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
t && (r = t);
var _n = 0,
F = function F() {};
return {
s: F,
n: function n() {
return _n >= r.length ? {
done: !0
} : {
done: !1,
value: r[_n++]
};
},
e: function e(r) {
throw r;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var o,
a = !0,
u = !1;
return {
s: function s() {
t = t.call(r);
},
n: function n() {
var r = t.next();
return a = r.done, r;
},
e: function e(r) {
u = !0, o = r;
},
f: function f() {
try {
a || null == t["return"] || t["return"]();
} finally {
if (u) throw o;
}
}
};
}
export { _createForOfIteratorHelper as default };
@@ -0,0 +1,17 @@
import { AsnArray } from "@peculiar/asn1-schema";
import { AccessDescription } from "./authority_information_access";
/**
* ```asn1
* id-pe-subjectInfoAccess OBJECT IDENTIFIER ::= { id-pe 11 }
* ```
*/
export declare const id_pe_subjectInfoAccess = "1.3.6.1.5.5.7.1.11";
/**
* ```asn1
* SubjectInfoAccessSyntax ::=
* SEQUENCE SIZE (1..MAX) OF AccessDescription
* ```
*/
export declare class SubjectInfoAccessSyntax extends AsnArray<AccessDescription> {
constructor(items?: AccessDescription[]);
}
@@ -0,0 +1,2 @@
import "./use-latest.cjs.js";
export { _default as default } from "./use-latest.cjs.default.js";
@@ -0,0 +1,23 @@
import root from './_root.js';
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function() {
return root.Date.now();
};
export default now;
@@ -0,0 +1,124 @@
import {getScrollParents as $a40c673dc9f6d9c7$export$94ed1c92c7beeb22} from "./getScrollParents.mjs";
import {isChrome as $c87311424ea30a05$export$6446a186d09e379e} from "./platform.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.
*/
function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'left');
let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, 'top');
let width = element.offsetWidth;
let height = element.offsetHeight;
let x = scrollView.scrollLeft;
let y = scrollView.scrollTop;
// Account for top/left border offsetting the scroll top/Left + scroll padding
let { borderTopWidth: borderTopWidth, borderLeftWidth: borderLeftWidth, scrollPaddingTop: scrollPaddingTop, scrollPaddingRight: scrollPaddingRight, scrollPaddingBottom: scrollPaddingBottom, scrollPaddingLeft: scrollPaddingLeft } = getComputedStyle(scrollView);
// Account for scroll margin of the element
let { scrollMarginTop: scrollMarginTop, scrollMarginRight: scrollMarginRight, scrollMarginBottom: scrollMarginBottom, scrollMarginLeft: scrollMarginLeft } = getComputedStyle(element);
let borderAdjustedX = x + parseInt(borderLeftWidth, 10);
let borderAdjustedY = y + parseInt(borderTopWidth, 10);
// Ignore end/bottom border via clientHeight/Width instead of offsetHeight/Width
let maxX = borderAdjustedX + scrollView.clientWidth;
let maxY = borderAdjustedY + scrollView.clientHeight;
// Get scroll padding / margin values as pixels - defaults to 0 if no scroll padding / margin
// is used.
let scrollPaddingTopNumber = parseInt(scrollPaddingTop, 10) || 0;
let scrollPaddingBottomNumber = parseInt(scrollPaddingBottom, 10) || 0;
let scrollPaddingRightNumber = parseInt(scrollPaddingRight, 10) || 0;
let scrollPaddingLeftNumber = parseInt(scrollPaddingLeft, 10) || 0;
let scrollMarginTopNumber = parseInt(scrollMarginTop, 10) || 0;
let scrollMarginBottomNumber = parseInt(scrollMarginBottom, 10) || 0;
let scrollMarginRightNumber = parseInt(scrollMarginRight, 10) || 0;
let scrollMarginLeftNumber = parseInt(scrollMarginLeft, 10) || 0;
let targetLeft = offsetX - scrollMarginLeftNumber;
let targetRight = offsetX + width + scrollMarginRightNumber;
let targetTop = offsetY - scrollMarginTopNumber;
let targetBottom = offsetY + height + scrollMarginBottomNumber;
let scrollPortLeft = x + parseInt(borderLeftWidth, 10) + scrollPaddingLeftNumber;
let scrollPortRight = maxX - scrollPaddingRightNumber;
let scrollPortTop = y + parseInt(borderTopWidth, 10) + scrollPaddingTopNumber;
let scrollPortBottom = maxY - scrollPaddingBottomNumber;
if (targetLeft > scrollPortLeft || targetRight < scrollPortRight) {
if (targetLeft <= x + scrollPaddingLeftNumber) x = targetLeft - parseInt(borderLeftWidth, 10) - scrollPaddingLeftNumber;
else if (targetRight > maxX - scrollPaddingRightNumber) x += targetRight - maxX + scrollPaddingRightNumber;
}
if (targetTop > scrollPortTop || targetBottom < scrollPortBottom) {
if (targetTop <= borderAdjustedY + scrollPaddingTopNumber) y = targetTop - parseInt(borderTopWidth, 10) - scrollPaddingTopNumber;
else if (targetBottom > maxY - scrollPaddingBottomNumber) y += targetBottom - maxY + scrollPaddingBottomNumber;
}
if (process.env.NODE_ENV === 'test') {
scrollView.scrollLeft = x;
scrollView.scrollTop = y;
return;
}
scrollView.scrollTo({
left: x,
top: y
});
}
/**
* Computes the offset left or top from child to ancestor by accumulating
* offsetLeft or offsetTop through intervening offsetParents.
*/ function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
const prop = axis === 'left' ? 'offsetLeft' : 'offsetTop';
let sum = 0;
while(child.offsetParent){
sum += child[prop];
if (child.offsetParent === ancestor) break;
else if (child.offsetParent.contains(ancestor)) {
// If the ancestor is not `position:relative`, then we stop at
// _its_ offset parent, and we subtract off _its_ offset, so that
// we end up with the proper offset from child to ancestor.
sum -= ancestor[prop];
break;
}
child = child.offsetParent;
}
return sum;
}
function $2f04cbc44ee30ce0$export$c826860796309d1b(targetElement, opts) {
if (targetElement && document.contains(targetElement)) {
let root = document.scrollingElement || document.documentElement;
let isScrollPrevented = window.getComputedStyle(root).overflow === 'hidden';
// If scrolling is not currently prevented then we aren't in a overlay nor is a overlay open, just use element.scrollIntoView to bring the element into view
// Also ignore in chrome because of this bug: https://issues.chromium.org/issues/40074749
if (!isScrollPrevented && !(0, $c87311424ea30a05$export$6446a186d09e379e)()) {
var // use scrollIntoView({block: 'nearest'}) instead of .focus to check if the element is fully in view or not since .focus()
// won't cause a scroll if the element is already focused and doesn't behave consistently when an element is partially out of view horizontally vs vertically
_targetElement_scrollIntoView;
let { left: originalLeft, top: originalTop } = targetElement.getBoundingClientRect();
targetElement === null || targetElement === void 0 ? void 0 : (_targetElement_scrollIntoView = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView === void 0 ? void 0 : _targetElement_scrollIntoView.call(targetElement, {
block: 'nearest'
});
let { left: newLeft, top: newTop } = targetElement.getBoundingClientRect();
// Account for sub pixel differences from rounding
if (Math.abs(originalLeft - newLeft) > 1 || Math.abs(originalTop - newTop) > 1) {
var _opts_containingElement_scrollIntoView, _opts_containingElement, _targetElement_scrollIntoView1;
opts === null || opts === void 0 ? void 0 : (_opts_containingElement = opts.containingElement) === null || _opts_containingElement === void 0 ? void 0 : (_opts_containingElement_scrollIntoView = _opts_containingElement.scrollIntoView) === null || _opts_containingElement_scrollIntoView === void 0 ? void 0 : _opts_containingElement_scrollIntoView.call(_opts_containingElement, {
block: 'center',
inline: 'center'
});
(_targetElement_scrollIntoView1 = targetElement.scrollIntoView) === null || _targetElement_scrollIntoView1 === void 0 ? void 0 : _targetElement_scrollIntoView1.call(targetElement, {
block: 'nearest'
});
}
} else {
let scrollParents = (0, $a40c673dc9f6d9c7$export$94ed1c92c7beeb22)(targetElement);
// If scrolling is prevented, we don't want to scroll the body since it might move the overlay partially offscreen and the user can't scroll it back into view.
for (let scrollParent of scrollParents)$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollParent, targetElement);
}
}
}
export {$2f04cbc44ee30ce0$export$53a0910f038337bd as scrollIntoView, $2f04cbc44ee30ce0$export$c826860796309d1b as scrollIntoViewport};
//# sourceMappingURL=scrollIntoView.module.js.map
@@ -0,0 +1,3 @@
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
export { isSVGTag };
@@ -0,0 +1,3 @@
import {LRParser} from "@lezer/lr"
export const parser: LRParser
@@ -0,0 +1,58 @@
/*
* 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.
*/
import {isAndroid} from './platform';
// Original licensing for the following method can be found in the
// NOTICE file in the root directory of this source tree.
// See https://github.com/facebook/react/blob/3c713d513195a53788b3f8bb4b70279d68b15bcc/packages/react-interactions/events/src/dom/shared/index.js#L74-L87
// Keyboards, Assistive Technologies, and element.click() all produce a "virtual"
// click event. This is a method of inferring such clicks. Every browser except
// IE 11 only sets a zero value of "detail" for click events that are "virtual".
// However, IE 11 uses a zero value for all click events. For IE 11 we rely on
// the quirk that it produces click events that are of type PointerEvent, and
// where only the "virtual" click lacks a pointerType field.
export function isVirtualClick(event: MouseEvent | PointerEvent): boolean {
// JAWS/NVDA with Firefox.
if ((event as PointerEvent).pointerType === '' && event.isTrusted) {
return true;
}
// Android TalkBack's detail value varies depending on the event listener providing the event so we have specific logic here instead
// If pointerType is defined, event is from a click listener. For events from mousedown listener, detail === 0 is a sufficient check
// to detect TalkBack virtual clicks.
if (isAndroid() && (event as PointerEvent).pointerType) {
return event.type === 'click' && event.buttons === 1;
}
return event.detail === 0 && !(event as PointerEvent).pointerType;
}
export function isVirtualPointerEvent(event: PointerEvent): boolean {
// If the pointer size is zero, then we assume it's from a screen reader.
// Android TalkBack double tap will sometimes return a event with width and height of 1
// and pointerType === 'mouse' so we need to check for a specific combination of event attributes.
// Cannot use "event.pressure === 0" as the sole check due to Safari pointer events always returning pressure === 0
// instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush
// Talkback double tap from Windows Firefox touch screen press
return (
(!isAndroid() && event.width === 0 && event.height === 0) ||
(event.width === 1 &&
event.height === 1 &&
event.pressure === 0 &&
event.detail === 0 &&
event.pointerType === 'mouse'
)
);
}
@@ -0,0 +1 @@
{"name":"ansi-regex","version":"6.2.2","requiresBuild":false,"files":{"license":{"checkedAt":1794532105687,"integrity":"sha512-0fM2/ycrxrltyaBKfQ748Ck23VlPUUBgNAR47ldf4B1V/HoXTfWBSk+vcshGKwEpmOynu4mOP5o+hyBfuRNa8g==","mode":420,"size":1117},"index.js":{"checkedAt":1794532105687,"integrity":"sha512-RplKsEl6N9jhljABk9+El4pG7uEGJgB4Xhf/kIKVWrVm4yUL0V6X2SkxZVgZH64umPTEuiws2rkm7Yj9d/oXEQ==","mode":420,"size":590},"package.json":{"checkedAt":1794532105687,"integrity":"sha512-x3kgpxuw672I4QpcpVfQqEI1r0iXJBm/oip36wWvGWfm3bEMylO8hTXyF2Z5ol7PRkImNuapT88vzhMJYLsUYw==","mode":420,"size":1035},"readme.md":{"checkedAt":1794532105687,"integrity":"sha512-lMb9Am/BFuvtkXkq9lTUKzm00eKXwQJE/nbA8mjtR0uCiRyaOPqXKb8T2VvWhM9LM8ULKSKGv4iffIHaUr2Htg==","mode":420,"size":2434},"index.d.ts":{"checkedAt":1794532105687,"integrity":"sha512-ENz/GkIWDyMAoC84cJdvK9A9F2vwLwiUTu+vRp3hnlo/x6XgWvLbDg4oCAfYZKeOhLKuLuDEbJgUtyKqJXNXyQ==","mode":420,"size":689}}}
@@ -0,0 +1,25 @@
'use strict';
var map = require('../common/map.js');
var _null = require('../common/null.js');
var seq = require('../common/seq.js');
var string = require('../common/string.js');
var bool = require('./bool.js');
var float = require('./float.js');
var int = require('./int.js');
const schema = [
map.map,
seq.seq,
string.string,
_null.nullTag,
bool.boolTag,
int.intOct,
int.int,
int.intHex,
float.floatNaN,
float.floatExp,
float.float
];
exports.schema = schema;
@@ -0,0 +1,10 @@
import { isPromise } from './common/calculations/isPromise';
import { BaseEither, Either, Left, Right } from './either/models/Either';
import { stringifyServiceIdentifier } from './services/calculations/stringifyServiceIdentifier';
import { AbstractNewable } from './services/models/AbstractNewable';
import { LazyServiceIdentifier } from './services/models/LazyServiceIdentifier';
import { Newable } from './services/models/Newable';
import { ServiceIdentifier } from './services/models/ServiceIdentifier';
export type { AbstractNewable, BaseEither, Either, Left, Newable, Right, ServiceIdentifier, };
export { isPromise, LazyServiceIdentifier, stringifyServiceIdentifier };
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
export*from"redux";import{freeze as wa,original as Pa}from"immer";import{current as B,isDraft as v,produce as V,isDraftable as Y,setUseStrictIteration as ve}from"immer";import{createSelector as Ia,lruMemoize as va}from"reselect";import{createSelectorCreator as fe,weakMapMemoize as ye}from"reselect";var De=(...e)=>{let t=fe(...e),n=Object.assign((...r)=>{let a=t(...r),o=(i,...h)=>a(v(i)?B(i):i,...h);return Object.assign(o,a),o},{withTypes:()=>n});return n},he=De(ye);import{createStore as Oe,combineReducers as Ne,applyMiddleware as je,compose as L,isPlainObject as Z,isAction as K}from"redux";var Fe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?L:L.apply(null,arguments)},kn=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__?window.__REDUX_DEVTOOLS_EXTENSION__:function(){return function(e){return e}};import{thunk as xt,withExtraArgument as Ct}from"redux-thunk";var ee=e=>e&&typeof e.match=="function";function P(e,t){function n(...r){if(t){let a=t(...r);if(!a)throw new Error(C(0));return{type:e,payload:a.payload,..."meta"in a&&{meta:a.meta},..."error"in a&&{error:a.error}}}return{type:e,payload:r[0]}}return n.toString=()=>`${e}`,n.type=e,n.match=r=>K(r)&&r.type===e,n}function Ae(e){return typeof e=="function"&&"type"in e&&ee(e)}function Te(e){return K(e)&&Object.keys(e).every(At)}function At(e){return["type","payload","error","meta"].indexOf(e)>-1}function Tt(e){let t=e?`${e}`.split("/"):[],n=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched.
Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`}function mt(e={}){return()=>n=>r=>n(r)}var _=class e extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,e.prototype)}static get[Symbol.species](){return e}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new e(...t[0].concat(this)):new e(...t.concat(this))}};function me(e){return Y(e)?V(e,()=>{}):e}function M(e,t,n){return e.has(t)?e.get(t):e.set(t,n(t)).get(t)}function St(e){return typeof e!="object"||e==null||Object.isFrozen(e)}function gt(e={}){if(1)return()=>r=>a=>r(a);var t,n}function Ve(e){let t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||Z(e)}function Le(e,t="",n=Ve,r,a=[],o){let i;if(!n(e))return{keyPath:t||"<root>",value:e};if(typeof e!="object"||e===null||o?.has(e))return!1;let h=r!=null?r(e):Object.entries(e),s=a.length>0;for(let[c,y]of h){let A=t?t+"."+c:c;if(!(s&&a.some(f=>f instanceof RegExp?f.test(A):A===f))){if(!n(y))return{keyPath:A,value:y};if(typeof y=="object"&&(i=Le(y,A,n,r,a,o),i))return i}}return o&&_e(e)&&o.add(e),!1}function _e(e){if(!Object.isFrozen(e))return!1;for(let t of Object.values(e))if(!(typeof t!="object"||t===null)&&!_e(t))return!1;return!0}function kt(e={}){return()=>t=>n=>t(n)}function Et(e){return typeof e=="boolean"}var Ue=()=>function(t){let{thunk:n=!0,immutableCheck:r=!0,serializableCheck:a=!0,actionCreatorCheck:o=!0}=t??{},i=new _;return n&&(Et(n)?i.push(xt):i.push(Ct(n.extraArgument))),i};var Se="RTK_autoBatch",Rt=()=>e=>({payload:e,meta:{[Se]:!0}}),We=e=>t=>{setTimeout(t,e)},ge=(e={type:"raf"})=>t=>(...n)=>{let r=t(...n),a=!0,o=!1,i=!1,h=new Set,s=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:We(10):e.type==="callback"?e.queueNotification:We(e.timeout),c=()=>{i=!1,o&&(o=!1,h.forEach(y=>y()))};return Object.assign({},r,{subscribe(y){let A=()=>a&&y(),S=r.subscribe(A);return h.add(y),()=>{S(),h.delete(y)}},dispatch(y){try{return a=!y?.meta?.[Se],o=!a,o&&(i||(i=!0,s(c))),r.dispatch(y)}finally{a=!0}}})};var ze=e=>function(n){let{autoBatch:r=!0}=n??{},a=new _(e);return r&&a.push(ge(typeof r=="object"?r:void 0)),a};function wt(e){let t=Ue(),{reducer:n=void 0,middleware:r,devTools:a=!0,duplicateMiddlewareCheck:o=!0,preloadedState:i=void 0,enhancers:h=void 0}=e||{},s;if(typeof n=="function")s=n;else if(Z(n))s=Ne(n);else throw new Error(C(1));let c;typeof r=="function"?c=r(t):c=t();let y=L;a&&(y=Fe({trace:!1,...typeof a=="object"&&a}));let A=je(...c),S=ze(A),f=typeof h=="function"?h(S):S(),d=y(...f);return Oe(s,i,d)}function te(e){let t={},n=[],r,a={addCase(o,i){let h=typeof o=="string"?o:o.type;if(!h)throw new Error(C(28));if(h in t)throw new Error(C(29));return t[h]=i,a},addAsyncThunk(o,i){return i.pending&&(t[o.pending.type]=i.pending),i.rejected&&(t[o.rejected.type]=i.rejected),i.fulfilled&&(t[o.fulfilled.type]=i.fulfilled),i.settled&&n.push({matcher:o.settled,reducer:i.settled}),a},addMatcher(o,i){return n.push({matcher:o,reducer:i}),a},addDefaultCase(o){return r=o,a}};return e(a),[t,n,r]}ve(!1);function Pt(e){return typeof e=="function"}function ke(e,t){let[n,r,a]=te(t),o;if(Pt(e))o=()=>me(e());else{let h=me(e);o=()=>h}function i(h=o(),s){let c=[n[s.type],...r.filter(({matcher:y})=>y(s)).map(({reducer:y})=>y)];return c.filter(y=>!!y).length===0&&(c=[a]),c.reduce((y,A)=>{if(A)if(v(y)){let f=A(y,s);return f===void 0?y:f}else{if(Y(y))return V(y,S=>A(S,s));{let S=A(y,s);if(S===void 0){if(y===null)return y;throw Error("A case reducer on a non-draftable value must not return undefined")}return S}}return y},h)}return i.getInitialState=o,i}var Ge=(e,t)=>ee(e)?e.match(t):e(t);function U(...e){return t=>e.some(n=>Ge(n,t))}function H(...e){return t=>e.every(n=>Ge(n,t))}function re(e,t){if(!e||!e.meta)return!1;let n=typeof e.meta.requestId=="string",r=t.indexOf(e.meta.requestStatus)>-1;return n&&r}function q(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function Be(...e){return e.length===0?t=>re(t,["pending"]):q(e)?U(...e.map(t=>t.pending)):Be()(e[0])}function ne(...e){return e.length===0?t=>re(t,["rejected"]):q(e)?U(...e.map(t=>t.rejected)):ne()(e[0])}function Ke(...e){let t=n=>n&&n.meta&&n.meta.rejectedWithValue;return e.length===0?H(ne(...e),t):q(e)?H(ne(...e),t):Ke()(e[0])}function He(...e){return e.length===0?t=>re(t,["fulfilled"]):q(e)?U(...e.map(t=>t.fulfilled)):He()(e[0])}function qe(...e){return e.length===0?t=>re(t,["pending","fulfilled","rejected"]):q(e)?U(...e.flatMap(t=>[t.pending,t.rejected,t.fulfilled])):qe()(e[0])}var Mt="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",D=(e=21)=>{let t="",n=e;for(;n--;)t+=Mt[Math.random()*64|0];return t};var bt=["name","message","stack","code"],$=class{constructor(t,n){this.payload=t;this.meta=n}_type},ae=Line truncated
//# sourceMappingURL=redux-toolkit.browser.mjs.map
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaM,SAAS;IACd,OAAO,CAAA,GAAA,oCAAc;AACvB","sources":["packages/@react-aria/table/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useTable} from './useTable';\nexport {useTableColumnHeader} from './useTableColumnHeader';\nexport {useTableRow} from './useTableRow';\nexport {useTableHeaderRow} from './useTableHeaderRow';\nexport {useTableCell} from './useTableCell';\nexport {useTableSelectionCheckbox, useTableSelectAllCheckbox} from './useTableSelectionCheckbox';\nexport {useTableColumnResize} from './useTableColumnResize';\n\n// Workaround for a Parcel bug where re-exports don't work in the CommonJS output format...\n// export {useGridRowGroup as useTableRowGroup} from '@react-aria/grid';\nimport {GridRowGroupAria, useGridRowGroup} from '@react-aria/grid';\nexport function useTableRowGroup(): GridRowGroupAria {\n return useGridRowGroup();\n}\n\nexport type {AriaTableProps} from './useTable';\nexport type {GridAria, GridRowAria, GridRowProps} from '@react-aria/grid';\nexport type {AriaTableColumnHeaderProps, TableColumnHeaderAria} from './useTableColumnHeader';\nexport type {AriaTableCellProps, TableCellAria} from './useTableCell';\nexport type {TableHeaderRowAria} from './useTableHeaderRow';\nexport type {AriaTableSelectionCheckboxProps, TableSelectionCheckboxAria, TableSelectAllCheckboxAria} from './useTableSelectionCheckbox';\nexport type {AriaTableColumnResizeProps, TableColumnResizeAria} from './useTableColumnResize';\n"],"names":[],"version":3,"file":"main.js.map"}
@@ -0,0 +1,152 @@
"use strict";
// translate the various posix character classes into unicode properties
// this works across all unicode locales
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseClass = void 0;
// { <posix class>: [<translation>, /u flag required, negated]
const posixClasses = {
'[:alnum:]': ['\\p{L}\\p{Nl}\\p{Nd}', true],
'[:alpha:]': ['\\p{L}\\p{Nl}', true],
'[:ascii:]': ['\\x' + '00-\\x' + '7f', false],
'[:blank:]': ['\\p{Zs}\\t', true],
'[:cntrl:]': ['\\p{Cc}', true],
'[:digit:]': ['\\p{Nd}', true],
'[:graph:]': ['\\p{Z}\\p{C}', true, true],
'[:lower:]': ['\\p{Ll}', true],
'[:print:]': ['\\p{C}', true],
'[:punct:]': ['\\p{P}', true],
'[:space:]': ['\\p{Z}\\t\\r\\n\\v\\f', true],
'[:upper:]': ['\\p{Lu}', true],
'[:word:]': ['\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}', true],
'[:xdigit:]': ['A-Fa-f0-9', false],
};
// only need to escape a few things inside of brace expressions
// escapes: [ \ ] -
const braceEscape = (s) => s.replace(/[[\]\\-]/g, '\\$&');
// escape all regexp magic characters
const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
// everything has already been escaped, we just have to join
const rangesToString = (ranges) => ranges.join('');
// takes a glob string at a posix brace expression, and returns
// an equivalent regular expression source, and boolean indicating
// whether the /u flag needs to be applied, and the number of chars
// consumed to parse the character class.
// This also removes out of order ranges, and returns ($.) if the
// entire class just no good.
const parseClass = (glob, position) => {
const pos = position;
/* c8 ignore start */
if (glob.charAt(pos) !== '[') {
throw new Error('not in a brace expression');
}
/* c8 ignore stop */
const ranges = [];
const negs = [];
let i = pos + 1;
let sawStart = false;
let uflag = false;
let escaping = false;
let negate = false;
let endPos = pos;
let rangeStart = '';
WHILE: while (i < glob.length) {
const c = glob.charAt(i);
if ((c === '!' || c === '^') && i === pos + 1) {
negate = true;
i++;
continue;
}
if (c === ']' && sawStart && !escaping) {
endPos = i + 1;
break;
}
sawStart = true;
if (c === '\\') {
if (!escaping) {
escaping = true;
i++;
continue;
}
// escaped \ char, fall through and treat like normal char
}
if (c === '[' && !escaping) {
// either a posix class, a collation equivalent, or just a [
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
if (glob.startsWith(cls, i)) {
// invalid, [a-[] is fine, but not [a-[:alpha]]
if (rangeStart) {
return ['$.', false, glob.length - pos, true];
}
i += cls.length;
if (neg)
negs.push(unip);
else
ranges.push(unip);
uflag = uflag || u;
continue WHILE;
}
}
}
// now it's just a normal character, effectively
escaping = false;
if (rangeStart) {
// throw this range away if it's not valid, but others
// can still match.
if (c > rangeStart) {
ranges.push(braceEscape(rangeStart) + '-' + braceEscape(c));
}
else if (c === rangeStart) {
ranges.push(braceEscape(c));
}
rangeStart = '';
i++;
continue;
}
// now might be the start of a range.
// can be either c-d or c-] or c<more...>] or c] at this point
if (glob.startsWith('-]', i + 1)) {
ranges.push(braceEscape(c + '-'));
i += 2;
continue;
}
if (glob.startsWith('-', i + 1)) {
rangeStart = c;
i += 2;
continue;
}
// not the start of a range, just a single character
ranges.push(braceEscape(c));
i++;
}
if (endPos < i) {
// didn't see the end of the class, not a valid class,
// but might still be valid as a literal match.
return ['', false, 0, false];
}
// if we got no ranges and no negates, then we have a range that
// cannot possibly match anything, and that poisons the whole glob
if (!ranges.length && !negs.length) {
return ['$.', false, glob.length - pos, true];
}
// if we got one positive range, and it's a single character, then that's
// not actually a magic pattern, it's just that one literal character.
// we should not treat that as "magic", we should just return the literal
// character. [_] is a perfectly valid way to escape glob magic chars.
if (negs.length === 0 &&
ranges.length === 1 &&
/^\\?.$/.test(ranges[0]) &&
!negate) {
const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
return [regexpEscape(r), false, endPos - pos, false];
}
const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
const comb = ranges.length && negs.length
? '(' + sranges + '|' + snegs + ')'
: ranges.length
? sranges
: snegs;
return [comb, uflag, endPos - pos, true];
};
exports.parseClass = parseClass;
//# sourceMappingURL=brace-expressions.js.map
@@ -0,0 +1,28 @@
var PolicyMappings_1;
import { __decorate } from "tslib";
import { AsnArray, AsnProp, AsnPropTypes, AsnType, AsnTypeTypes } from "@peculiar/asn1-schema";
import { id_ce } from "../object_identifiers";
export const id_ce_policyMappings = `${id_ce}.33`;
export class PolicyMapping {
constructor(params = {}) {
this.issuerDomainPolicy = "";
this.subjectDomainPolicy = "";
Object.assign(this, params);
}
}
__decorate([
AsnProp({ type: AsnPropTypes.ObjectIdentifier })
], PolicyMapping.prototype, "issuerDomainPolicy", void 0);
__decorate([
AsnProp({ type: AsnPropTypes.ObjectIdentifier })
], PolicyMapping.prototype, "subjectDomainPolicy", void 0);
let PolicyMappings = PolicyMappings_1 = class PolicyMappings extends AsnArray {
constructor(items) {
super(items);
Object.setPrototypeOf(this, PolicyMappings_1.prototype);
}
};
PolicyMappings = PolicyMappings_1 = __decorate([
AsnType({ type: AsnTypeTypes.Sequence, itemType: PolicyMapping })
], PolicyMappings);
export { PolicyMappings };
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('xorBy', require('../xorBy'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,16 @@
/**
* @file otf转bse64字体
* @author mengke01(kekee000@gmail.com)
*/
import bytes2base64 from './util/bytes2base64';
/**
* ttf 二进制转base64编码
*
* @param {Array} arrayBuffer ArrayBuffer对象
* @return {string} base64编码
*/
export default function ttf2base64(arrayBuffer) {
return 'data:font/otf;charset=utf-8;base64,' + bytes2base64(arrayBuffer);
}
@@ -0,0 +1,65 @@
/**
* @import {
* Construct,
* State,
* TokenizeContext,
* Tokenizer
* } from 'micromark-util-types'
*/
import {ok as assert} from 'devlop'
import {markdownLineEnding} from 'micromark-util-character'
import {codes, types} from 'micromark-util-symbol'
/** @type {Construct} */
export const hardBreakEscape = {
name: 'hardBreakEscape',
tokenize: tokenizeHardBreakEscape
}
/**
* @this {TokenizeContext}
* Context.
* @type {Tokenizer}
*/
function tokenizeHardBreakEscape(effects, ok, nok) {
return start
/**
* Start of a hard break (escape).
*
* ```markdown
* > | a\
* ^
* | b
* ```
*
* @type {State}
*/
function start(code) {
assert(code === codes.backslash, 'expected `\\`')
effects.enter(types.hardBreakEscape)
effects.consume(code)
return after
}
/**
* After `\`, at eol.
*
* ```markdown
* > | a\
* ^
* | b
* ```
*
* @type {State}
*/
function after(code) {
if (markdownLineEnding(code)) {
effects.exit(types.hardBreakEscape)
return ok(code)
}
return nok(code)
}
}
@@ -0,0 +1,15 @@
'use strict';
var bind = require('function-bind');
var $TypeError = require('es-errors/type');
var $call = require('./functionCall');
var $actualApply = require('./actualApply');
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
module.exports = function callBindBasic(args) {
if (args.length < 1 || typeof args[0] !== 'function') {
throw new $TypeError('a function is required');
}
return $actualApply(bind, $call, args);
};
@@ -0,0 +1,148 @@
/**
* @import {
* Effects,
* State,
* TokenizeContext,
* TokenType
* } from 'micromark-util-types'
*/
import { markdownLineEnding, markdownSpace } from 'micromark-util-character';
/**
* Parse labels.
*
* > 👉 **Note**: labels in markdown are capped at 999 characters in the string.
*
* ###### Examples
*
* ```markdown
* [a]
* [a
* b]
* [a\]b]
* ```
*
* @this {TokenizeContext}
* Tokenize context.
* @param {Effects} effects
* Context.
* @param {State} ok
* State switched to when successful.
* @param {State} nok
* State switched to when unsuccessful.
* @param {TokenType} type
* Type of the whole label (`[a]`).
* @param {TokenType} markerType
* Type for the markers (`[` and `]`).
* @param {TokenType} stringType
* Type for the identifier (`a`).
* @returns {State}
* Start state.
*/
export function factoryLabel(effects, ok, nok, type, markerType, stringType) {
const self = this;
let size = 0;
/** @type {boolean} */
let seen;
return start;
/**
* Start of label.
*
* ```markdown
* > | [a]
* ^
* ```
*
* @type {State}
*/
function start(code) {
effects.enter(type);
effects.enter(markerType);
effects.consume(code);
effects.exit(markerType);
effects.enter(stringType);
return atBreak;
}
/**
* In label, at something, before something else.
*
* ```markdown
* > | [a]
* ^
* ```
*
* @type {State}
*/
function atBreak(code) {
if (size > 999 || code === null || code === 91 || code === 93 && !seen ||
// To do: remove in the future once we’ve switched from
// `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
// which doesn’t need this.
// Hidden footnotes hook.
/* c8 ignore next 3 */
code === 94 && !size && '_hiddenFootnoteSupport' in self.parser.constructs) {
return nok(code);
}
if (code === 93) {
effects.exit(stringType);
effects.enter(markerType);
effects.consume(code);
effects.exit(markerType);
effects.exit(type);
return ok;
}
// To do: indent? Link chunks and EOLs together?
if (markdownLineEnding(code)) {
effects.enter("lineEnding");
effects.consume(code);
effects.exit("lineEnding");
return atBreak;
}
effects.enter("chunkString", {
contentType: "string"
});
return labelInside(code);
}
/**
* In label, in text.
*
* ```markdown
* > | [a]
* ^
* ```
*
* @type {State}
*/
function labelInside(code) {
if (code === null || code === 91 || code === 93 || markdownLineEnding(code) || size++ > 999) {
effects.exit("chunkString");
return atBreak(code);
}
effects.consume(code);
if (!seen) seen = !markdownSpace(code);
return code === 92 ? labelEscape : labelInside;
}
/**
* After `\`, at a special character.
*
* ```markdown
* > | [a\*a]
* ^
* ```
*
* @type {State}
*/
function labelEscape(code) {
if (code === 91 || code === 92 || code === 93) {
effects.consume(code);
size++;
return labelInside;
}
return labelInside(code);
}
}
@@ -0,0 +1,159 @@
'use strict'
const fs = require('../fs')
const path = require('path')
const u = require('universalify').fromPromise
function getStats (src, dest, opts) {
const statFunc = opts.dereference
? (file) => fs.stat(file, { bigint: true })
: (file) => fs.lstat(file, { bigint: true })
return Promise.all([
statFunc(src),
statFunc(dest).catch(err => {
if (err.code === 'ENOENT') return null
throw err
})
]).then(([srcStat, destStat]) => ({ srcStat, destStat }))
}
function getStatsSync (src, dest, opts) {
let destStat
const statFunc = opts.dereference
? (file) => fs.statSync(file, { bigint: true })
: (file) => fs.lstatSync(file, { bigint: true })
const srcStat = statFunc(src)
try {
destStat = statFunc(dest)
} catch (err) {
if (err.code === 'ENOENT') return { srcStat, destStat: null }
throw err
}
return { srcStat, destStat }
}
async function checkPaths (src, dest, funcName, opts) {
const { srcStat, destStat } = await getStats(src, dest, opts)
if (destStat) {
if (areIdentical(srcStat, destStat)) {
const srcBaseName = path.basename(src)
const destBaseName = path.basename(dest)
if (funcName === 'move' &&
srcBaseName !== destBaseName &&
srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
return { srcStat, destStat, isChangingCase: true }
}
throw new Error('Source and destination must not be the same.')
}
if (srcStat.isDirectory() && !destStat.isDirectory()) {
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
}
if (!srcStat.isDirectory() && destStat.isDirectory()) {
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
}
}
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
throw new Error(errMsg(src, dest, funcName))
}
return { srcStat, destStat }
}
function checkPathsSync (src, dest, funcName, opts) {
const { srcStat, destStat } = getStatsSync(src, dest, opts)
if (destStat) {
if (areIdentical(srcStat, destStat)) {
const srcBaseName = path.basename(src)
const destBaseName = path.basename(dest)
if (funcName === 'move' &&
srcBaseName !== destBaseName &&
srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
return { srcStat, destStat, isChangingCase: true }
}
throw new Error('Source and destination must not be the same.')
}
if (srcStat.isDirectory() && !destStat.isDirectory()) {
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
}
if (!srcStat.isDirectory() && destStat.isDirectory()) {
throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)
}
}
if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
throw new Error(errMsg(src, dest, funcName))
}
return { srcStat, destStat }
}
// recursively check if dest parent is a subdirectory of src.
// It works for all file types including symlinks since it
// checks the src and dest inodes. It starts from the deepest
// parent and stops once it reaches the src parent or the root path.
async function checkParentPaths (src, srcStat, dest, funcName) {
const srcParent = path.resolve(path.dirname(src))
const destParent = path.resolve(path.dirname(dest))
if (destParent === srcParent || destParent === path.parse(destParent).root) return
let destStat
try {
destStat = await fs.stat(destParent, { bigint: true })
} catch (err) {
if (err.code === 'ENOENT') return
throw err
}
if (areIdentical(srcStat, destStat)) {
throw new Error(errMsg(src, dest, funcName))
}
return checkParentPaths(src, srcStat, destParent, funcName)
}
function checkParentPathsSync (src, srcStat, dest, funcName) {
const srcParent = path.resolve(path.dirname(src))
const destParent = path.resolve(path.dirname(dest))
if (destParent === srcParent || destParent === path.parse(destParent).root) return
let destStat
try {
destStat = fs.statSync(destParent, { bigint: true })
} catch (err) {
if (err.code === 'ENOENT') return
throw err
}
if (areIdentical(srcStat, destStat)) {
throw new Error(errMsg(src, dest, funcName))
}
return checkParentPathsSync(src, srcStat, destParent, funcName)
}
function areIdentical (srcStat, destStat) {
// stat.dev can be 0n on windows when node version >= 22.x.x
return destStat.ino !== undefined && destStat.dev !== undefined && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev
}
// return true if dest is a subdir of src, otherwise false.
// It only checks the path strings.
function isSrcSubdir (src, dest) {
const srcArr = path.resolve(src).split(path.sep).filter(i => i)
const destArr = path.resolve(dest).split(path.sep).filter(i => i)
return srcArr.every((cur, i) => destArr[i] === cur)
}
function errMsg (src, dest, funcName) {
return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`
}
module.exports = {
// checkPaths
checkPaths: u(checkPaths),
checkPathsSync,
// checkParent
checkParentPaths: u(checkParentPaths),
checkParentPathsSync,
// Misc
isSrcSubdir,
areIdentical
}
@@ -0,0 +1 @@
{"version":3,"file":"verifyAttestationAndroidKey.d.ts","sourceRoot":"","sources":["../../../src/registration/verifications/verifyAttestationAndroidKey.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAUtF;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,OAAO,CAAC,CA0JlB"}
@@ -0,0 +1,32 @@
import toString from './toString.js';
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
reHasRegExpChar = RegExp(reRegExpChar.source);
/**
* Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
* "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to escape.
* @returns {string} Returns the escaped string.
* @example
*
* _.escapeRegExp('[lodash](https://lodash.com/)');
* // => '\[lodash\]\(https://lodash\.com/\)'
*/
function escapeRegExp(string) {
string = toString(string);
return (string && reHasRegExpChar.test(string))
? string.replace(reRegExpChar, '\\$&')
: string;
}
export default escapeRegExp;
@@ -0,0 +1 @@
{"version":3,"file":"GetPlanOptions.d.ts","sourceRoot":"","sources":["../../../../src/planning/models/GetPlanOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,MAAM,cAAc,GACtB,2BAA2B,GAC3B,6BAA6B,CAAC"}
@@ -0,0 +1 @@
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["configure.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,gCAJW,KAAK,aACL,OAAO,GACL,KAAK,CA+CjB;2BAvDgC,YAAY;6BAAZ,YAAY"}
@@ -0,0 +1,15 @@
import { OctetString } from "@peculiar/asn1-schema";
/**
* ```asn
* id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2)
* us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 }
* ```
*/
export declare const id_messageDigest = "1.2.840.113549.1.9.4";
/**
* ```asn
* MessageDigest ::= OCTET STRING
* ```
*/
export declare class MessageDigest extends OctetString {
}
@@ -0,0 +1 @@
{"name":"is-string","version":"1.1.1","requiresBuild":false,"files":{".eslintrc":{"checkedAt":1794532097068,"integrity":"sha512-T/QSPV2ZjWm3VhZTCfjeqidsgusuFd2r27rrkcUMoEvkaTyXH4e56E7y4+jTYd2SgO0hZ760M22hpFUV+l+6BA==","mode":420,"size":87},".nycrc":{"checkedAt":1794532097068,"integrity":"sha512-aLxN7EM7vuJGE3vcz8CsQow+RuaR3thZWTHupkykz/8WOXUd8ayX5goRxPe3MCnZ0VVDkuEk8UBkk3NodRfMOg==","mode":420,"size":159},"LICENSE":{"checkedAt":1794532097068,"integrity":"sha512-CWRd82wre8E2D9wfNTwrOCxhLsdU7obtQTc4poEGt1uTk93MEI2QW01sXILetqMRgoYp4EIKQZNHNCQrALOFjw==","mode":420,"size":1082},"index.js":{"checkedAt":1794532097068,"integrity":"sha512-ONjrvVdLoki9o5NsZ9Kjt0CCqB3clXdxSRgWqPtY35GULeLMEzNkA1ZL+DgiABQXLvNslmaQD0bHFHKbSjXUdg==","mode":420,"size":1056},"test/index.js":{"checkedAt":1794532097068,"integrity":"sha512-+FO+ZxXziLyATj02bQISkSCP2vBOBnoFZlOtipPkULMi3JaFqI4f+rMAQmR3vc6a70PHoMao2MI7uwa1KUIUnA==","mode":420,"size":1524},"package.json":{"checkedAt":1794532097069,"integrity":"sha512-c5t7eed8B4/xAdmQnDq1ePGwuHu9qnIfYwh6+RKN+yYfZp1AZxmfe8TwVMPoZ/ZZN87+1slJTcDo63AAa7ORWA==","mode":420,"size":2554},"tsconfig.json":{"checkedAt":1794532097069,"integrity":"sha512-xBbrFV4Zb7DECDeefgt+yhGfHLeRKbwlh2H6L08d8tjUDpSQt9WyNmB4pcNL/slJJ50FIksbN+w5cFzfKhZ+bw==","mode":420,"size":123},"CHANGELOG.md":{"checkedAt":1794532097069,"integrity":"sha512-NypG9BSwWlgXVfZEUmD2766NqQHwCkOTUPF6qSxH6iu/tm7W7umvLhcjjr9KbTZh5tPIU+dvUXx4vA6bvPVIRw==","mode":420,"size":14532},"README.md":{"checkedAt":1794532097069,"integrity":"sha512-3/JUC+UI+qfslgWx7ulJ5dY49MZZikUxvVFULTs+e4u5ws70GsbRqVuhpHx/cxAzCAODjd4oQ8uOJpo9Rys4sA==","mode":420,"size":2216},"index.d.ts":{"checkedAt":1794532097069,"integrity":"sha512-HHJ8nH5Llm0qHvrbPMbNRHzlQPmDNx7jz52ddjtKf/IYB2phxd9hvVh4O3NiwyfunIiC4sWk4ge2how3/yecmQ==","mode":420,"size":88},".github/FUNDING.yml":{"checkedAt":1794532097069,"integrity":"sha512-82RQmsZ2ogIrwLFA5+EsL6QYsDr7htp+yCFL44qJH5+ir6gK7Wkl/Ebmk8AZb4J8OlN+0Y9fKl3KlmiAzMYrFQ==","mode":420,"size":580}}}
@@ -0,0 +1,36 @@
var baseDifference = require('./_baseDifference'),
baseFlatten = require('./_baseFlatten'),
baseUniq = require('./_baseUniq');
/**
* The base implementation of methods like `_.xor`, without support for
* iteratee shorthands, that accepts an array of arrays to inspect.
*
* @private
* @param {Array} arrays The arrays to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new array of values.
*/
function baseXor(arrays, iteratee, comparator) {
var length = arrays.length;
if (length < 2) {
return length ? baseUniq(arrays[0]) : [];
}
var index = -1,
result = Array(length);
while (++index < length) {
var array = arrays[index],
othIndex = -1;
while (++othIndex < length) {
if (othIndex != index) {
result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
}
}
}
return baseUniq(baseFlatten(result, 1), iteratee, comparator);
}
module.exports = baseXor;
@@ -0,0 +1,10 @@
"use client";
import {
useInputLabelPlacement,
useLabelPlacement
} from "../chunk-FPAGUVYU.mjs";
import "../chunk-Q3W45BN5.mjs";
export {
useInputLabelPlacement,
useLabelPlacement
};
@@ -0,0 +1 @@
{"name":"detect-libc","version":"2.1.2","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532102106,"integrity":"sha512-OJCAthMtPqrngGSNaZg5DYzHGQhWG84JV44nxUKqGp8xIuAfZAxbAb7nMATCOqTp8gZv5e4MogcsJCBXiyjXHw==","mode":420,"size":11357},"lib/detect-libc.js":{"checkedAt":1794532102106,"integrity":"sha512-Xdwa6DzW4cHON/DjQHesGw6YV7YiCtIUG7gHRrOrEyIBrjhVVyrK1jg5pMmDy+k3hcwG9Ei8Sz3CLYF6ex1rDQ==","mode":420,"size":7503},"lib/elf.js":{"checkedAt":1794532102106,"integrity":"sha512-aDCsiFmeVzkfO/Scg+8i7hice8I2Zgxgk5i5p4V2EVs4qngN/2kXaBd5Arusz4cCIbHEmixStX2CNhQEdz00Xw==","mode":420,"size":982},"lib/filesystem.js":{"checkedAt":1794532102106,"integrity":"sha512-jmtynhCtrrU5raoAUHj1ARzG0kIaJTR/b2rpq+oTcB039a09WOEzGX+5A4IMvvlwSjOKc0o1uju+Q+Hseb6OaA==","mode":420,"size":1097},"lib/process.js":{"checkedAt":1794532102107,"integrity":"sha512-hXWN4z7OdgrThhXUnT/Rekp7Xoju5XzILlt2l0ddrflby11wtM48md24iOoTryQ77qTVIfBz1v0BI4Q2LM7bCA==","mode":420,"size":569},"package.json":{"checkedAt":1794532102107,"integrity":"sha512-SjxOinaatzyimgpv5aYYadGKnQQ6kVt3dLlueXavHkvCwb+yhSkzOv5eelYbgH3AX6fFAvfcm6fp9MqjPMMZvQ==","mode":420,"size":1278},"README.md":{"checkedAt":1794532102107,"integrity":"sha512-97vxzHZ/bYjV7uCKjutVKBNLnJkE4ggcl5yDNFRksMKWT3Bo4szwW5a/XhjQ3Ynfj+kDwNjyZtHfjKmybxAU5g==","mode":420,"size":3215},"index.d.ts":{"checkedAt":1794532102107,"integrity":"sha512-S7DkwRRCOebgwxrVeWUcraosg8u0fFhnbEa5+Xff+JgCDljW7rJizhlZrdb1Y20TvIiHk1m7ekJgN+mvb6M1SQ==","mode":420,"size":436}}}
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AAcM,SAAS,0CAAqB,KAA6B,EAAE,KAA0B,EAAE,GAAqD;IACnJ,IAAI,sBAAC,kBAAkB,SAAE,KAAK,EAAC,GAAG;IAElC,iIAAiI;IACjI,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,uBAAuB,aAAY,gBAAA,0BAAA,IAAK,OAAO,GAAE;YACnD,IAAI,eAAe,MAAM,kBAAkB,CAAC,SAAS,GAAG,MAAM,kBAAkB,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,mBAAmB;YAClI,IAAI,OAAO,CAAC,iBAAiB,CAAC;YAE9B,kDAAkD;YAClD,sDAAsD;YACtD,IAAI,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,UAC5B,IAAI,OAAO,CAAC,KAAK,GAAG;YAGtB,IAAI,CAAC,MAAM,kBAAkB,CAAC,SAAS,EACrC,MAAM,gBAAgB,CAAC,wCAAkB,IAAI,OAAO;QAExD;IACF;IAEA,IAAI,UAAU,CAAA,GAAA,oCAAa,EAAE;QAC3B,MAAM,eAAe;IACvB;IAEA,IAAI,YAAY,CAAA,GAAA,oCAAa,EAAE,CAAC;YAQnB;QAPX,+DAA+D;QAC/D,wEAAwE;QACxE,IAAI,CAAC,MAAM,iBAAiB,CAAC,SAAS,EACpC,MAAM,gBAAgB;QAGxB,oGAAoG;QACpG,IAAI,OAAO,gBAAA,2BAAA,eAAA,IAAK,OAAO,cAAZ,mCAAA,aAAc,IAAI;QAC7B,IAAI,CAAC,EAAE,gBAAgB,IAAI,OAAO,QAAQ,2CAAqB,UAAU,IAAI,OAAO,EAAE;gBAIlF;YAHF,IAAI,OACF;kBAEA,gBAAA,IAAI,OAAO,cAAX,oCAAA,cAAa,KAAK;YAGpB,0BAA0B;YAC1B,CAAA,GAAA,mDAAqB,EAAE;QACzB;QAEA,mDAAmD;QACnD,EAAE,cAAc;IAClB;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE;QAC5B,MAAM,gBAAgB;IACxB;IAEA,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,QAAQ,gBAAA,0BAAA,IAAK,OAAO;QACxB,IAAI,CAAC,OACH;QAGF,IAAI,OAAO,MAAM,IAAI;QACrB,MAAM,gBAAgB,CAAC,WAAW;QAClC,MAAM,gBAAgB,CAAC,UAAU;QACjC,iBAAA,2BAAA,KAAM,gBAAgB,CAAC,SAAS;QAChC,OAAO;YACL,MAAO,mBAAmB,CAAC,WAAW;YACtC,MAAO,mBAAmB,CAAC,UAAU;YACrC,iBAAA,2BAAA,KAAM,mBAAmB,CAAC,SAAS;QACrC;IACF,GAAG;QAAC;QAAK;QAAW;QAAU;QAAS;KAAmB;AAC5D;AAEA,SAAS,kCAAY,KAAyB;IAC5C,6GAA6G;IAC7G,+HAA+H;IAC/H,IAAI,WAAW,MAAM,QAAQ;IAC7B,OAAO;QACL,UAAU,SAAS,QAAQ;QAC3B,aAAa,SAAS,WAAW;QACjC,iBAAiB,SAAS,eAAe;QACzC,eAAe,SAAS,aAAa;QACrC,gBAAgB,SAAS,cAAc;QACvC,cAAc,SAAS,YAAY;QACnC,SAAS,SAAS,OAAO;QACzB,UAAU,SAAS,QAAQ;QAC3B,cAAc,SAAS,YAAY;QACnC,cAAc,SAAS,YAAY;QACnC,OAAO,SAAS,KAAK;IACvB;AACF;AAEA,SAAS,wCAAkB,KAAyB;IAClD,OAAO;QACL,WAAW,CAAC,MAAM,QAAQ,CAAC,KAAK;QAChC,mBAAmB,kCAAY;QAC/B,kBAAkB,MAAM,iBAAiB,GAAG;YAAC,MAAM,iBAAiB;SAAC,GAAG,EAAE;IAC5E;AACF;AAEA,SAAS,2CAAqB,IAAqB;IACjD,IAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,CAAC,MAAM,EAAE,IAAK;QAC7C,IAAI,UAAU,KAAK,QAAQ,CAAC,EAAE;QAC9B,IAAI,CAAC,QAAQ,QAAQ,CAAC,KAAK,EACzB,OAAO;IAEX;IAEA,OAAO;AACT","sources":["packages/@react-aria/form/src/useFormValidation.ts"],"sourcesContent":["/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {FormValidationState} from '@react-stately/form';\nimport {RefObject, Validation, ValidationResult} from '@react-types/shared';\nimport {setInteractionModality} from '@react-aria/interactions';\nimport {useEffect} from 'react';\nimport {useEffectEvent, useLayoutEffect} from '@react-aria/utils';\n\ntype ValidatableElement = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;\n\ninterface FormValidationProps<T> extends Validation<T> {\n focus?: () => void\n}\n\nexport function useFormValidation<T>(props: FormValidationProps<T>, state: FormValidationState, ref: RefObject<ValidatableElement | null> | undefined) {\n let {validationBehavior, focus} = props;\n\n // This is a useLayoutEffect so that it runs before the useEffect in useFormValidationState, which commits the validation change.\n useLayoutEffect(() => {\n if (validationBehavior === 'native' && ref?.current) {\n let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(' ') || 'Invalid value.' : '';\n ref.current.setCustomValidity(errorMessage);\n\n // Prevent default tooltip for validation message.\n // https://bugzilla.mozilla.org/show_bug.cgi?id=605277\n if (!ref.current.hasAttribute('title')) {\n ref.current.title = '';\n }\n\n if (!state.realtimeValidation.isInvalid) {\n state.updateValidation(getNativeValidity(ref.current));\n }\n }\n });\n\n let onReset = useEffectEvent(() => {\n state.resetValidation();\n });\n\n let onInvalid = useEffectEvent((e: Event) => {\n // Only commit validation if we are not already displaying one.\n // This avoids clearing server errors that the user didn't actually fix.\n if (!state.displayValidation.isInvalid) {\n state.commitValidation();\n }\n\n // Auto focus the first invalid input in a form, unless the error already had its default prevented.\n let form = ref?.current?.form;\n if (!e.defaultPrevented && ref && form && getFirstInvalidInput(form) === ref.current) {\n if (focus) {\n focus();\n } else {\n ref.current?.focus();\n }\n\n // Always Line truncated
@@ -0,0 +1,29 @@
import { MultiSelectProps as MultiSelectProps$1, MultiSelectState } from './use-multiselect-state.js';
import { AriaButtonProps } from '@react-types/button';
import { AriaListBoxOptions } from '@react-aria/listbox';
import { HTMLAttributes, RefObject } from 'react';
import { ValidationResult } from '@react-types/shared';
import './use-multiselect-list-state.js';
import '@react-types/overlays';
import '@react-stately/menu';
import '@react-stately/form';
import '@react-stately/list';
type MultiSelectProps<T> = MultiSelectProps$1<T>;
interface MultiSelectAria<T> extends ValidationResult {
/** Props for the label element. */
labelProps: HTMLAttributes<HTMLElement>;
/** Props for the popup trigger element. */
triggerProps: AriaButtonProps;
/** Props for the element representing the selected value. */
valueProps: HTMLAttributes<HTMLElement>;
/** Props for the popup. */
menuProps: AriaListBoxOptions<T>;
/** Props for the select's description element, if any. */
descriptionProps: HTMLAttributes<HTMLElement>;
/** Props for the select's error message element, if any. */
errorMessageProps: HTMLAttributes<HTMLElement>;
}
declare function useMultiSelect<T>(props: MultiSelectProps<T>, state: MultiSelectState<T>, ref: RefObject<HTMLElement>): MultiSelectAria<T>;
export { MultiSelectAria, MultiSelectProps, useMultiSelect };
@@ -0,0 +1 @@
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,OAAO,CAAC;AACxC","sources":["packages/@react-aria/overlays/intl/lt-LT.json"],"sourcesContent":["{\n \"dismiss\": \"Atmesti\"\n}\n"],"names":[],"version":3,"file":"lt-LT.module.js.map"}
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAkBM,SAAS,yCAAU,OAA8B;IACtD,IAAI,WAAW,CAAA,GAAA,qCAAU,EAAE;QACzB,OAAO;QACP,GAAG,OAAO;IACZ;IAEA,mFAAmF;IACnF,IAAI,aAAa,CAAA,GAAA,wBAAU,EAAE,CAAC,QAAQ;QACpC,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO;QAGT,gDAAgD;QAChD,kEAAkE;QAClE,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAChC,OAAO,SAAS,OAAO,CAAC,OAAO,KAAK,CAAC,GAAG,UAAU,MAAM,GAAG,eAAe;IAC5E,GAAG;QAAC;KAAS;IAEb,IAAI,WAAW,CAAA,GAAA,wBAAU,EAAE,CAAC,QAAQ;QAClC,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO;QAGT,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAChC,OAAO,SAAS,OAAO,CAAC,OAAO,KAAK,CAAC,CAAC,UAAU,MAAM,GAAG,eAAe;IAC1E,GAAG;QAAC;KAAS;IAEb,IAAI,WAAW,CAAA,GAAA,wBAAU,EAAE,CAAC,QAAQ;QAClC,IAAI,UAAU,MAAM,KAAK,GACvB,OAAO;QAGT,SAAS,OAAO,SAAS,CAAC;QAC1B,YAAY,UAAU,SAAS,CAAC;QAEhC,IAAI,OAAO;QACX,IAAI,WAAW,UAAU,MAAM;QAC/B,MAAO,OAAO,YAAY,OAAO,MAAM,EAAE,OAAQ;YAC/C,IAAI,QAAQ,OAAO,KAAK,CAAC,MAAM,OAAO;YACtC,IAAI,SAAS,OAAO,CAAC,WAAW,WAAW,GACzC,OAAO;QAEX;QAEA,OAAO;IACT,GAAG;QAAC;KAAS;IAEb,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;wBACpB;sBACA;sBACA;QACF,CAAA,GAAI;QAAC;QAAY;QAAU;KAAS;AACtC","sources":["packages/@react-aria/i18n/src/useFilter.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {useCallback, useMemo} from 'react';\nimport {useCollator} from './useCollator';\n\nexport interface Filter {\n /** Returns whether a string starts with a given substring. */\n startsWith(string: string, substring: string): boolean,\n /** Returns whether a string ends with a given substring. */\n endsWith(string: string, substring: string): boolean,\n /** Returns whether a string contains a given substring. */\n contains(string: string, substring: string): boolean\n}\n\n/**\n * Provides localized string search functionality that is useful for filtering or matching items\n * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.\n */\nexport function useFilter(options?: Intl.CollatorOptions): Filter {\n let collator = useCollator({\n usage: 'search',\n ...options\n });\n\n // TODO(later): these methods don't currently support the ignorePunctuation option.\n let startsWith = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n // Normalize both strings so we can slice safely\n // TODO: take into account the ignorePunctuation option as well...\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(0, substring.length), substring) === 0;\n }, [collator]);\n\n let endsWith = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n return collator.compare(string.slice(-substring.length), substring) === 0;\n }, [collator]);\n\n let contains = useCallback((string, substring) => {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n let scan = 0;\n let sliceLen = substring.length;\n for (; scan + sliceLen <= string.length; scan++) {\n let slice = string.slice(scan, scan + sliceLen);\n if (collator.compare(substring, slice) === 0) {\n return true;\n }\n }\n\n return false;\n }, [collator]);\n\n return useMemo(() => ({\n startsWith,\n endsWith,\n contains\n }), [startsWith, endsWith, contains]);\n}\n"],"names":[],"version":3,"file":"useFilter.main.js.map"}
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more