Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@opentiny/utils

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentiny/utils - npm Package Compare versions

Comparing version
1.0.0
to
3.22.0
+1
dist/after-leave/__tests__/index.test.d.ts
export {};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 在实例上注册"after-leave"事件并设置超时回调
* @param instance - 需要注册事件的实例对象,必须支持$on或$once方法
* @param callback - 事件触发或超时后执行的回调函数
* @param speed - 过渡动画的速度,单位为毫秒
* @param once - 是否只监听一次事件
*
* 该函数用于处理元素过渡结束后的回调,并添加超时保障机制
* 确保回调函数只会被执行一次
*/
export declare function afterLeave(instance: {
$once: (event: string, callback: Function) => void;
$on: (event: string, callback: Function) => void;
}, callback: Function, speed?: number, once?: boolean): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 返回在数组中可以找到一个给定元素的第一个索引,如果不存在,则返回-1。 TINY_NO_NEED 现在数组有 findIndex
* 修复数组原生的 indexOf 方法不能判断 NaN 的问题
*
* let arr1 = [1, 2, 3, 4]
* let arr2 = [1, 2, NaN, 4]
* indexOf(arr1, 2) // 1
* indexOf(arr2, NaN) // 2
*
* @param {Array<T>} arr 要查找的数组
* @param {T} data 需要查找的数据
* @param {Function} [predicate] 断言函数,缺省为 isSame, 两个参数为数组的元素和查找的数据
* @returns {number} 元素在数组中的索引,如果不存在则返回-1
*/
export declare const indexOf: <T>(arr: T[], data: T, predicate?: (item: T, target: T) => boolean) => number;
/**
* 在数组里查找对象,调用自定义的断言函数。
*
* let arr = [1, 2, 3, 4]
* find(arr, function (value) { return value > 2 }) // 3
*
* @param {Array<T>} arr 要查找的数组
* @param {Function} predicate 断言函数
* @returns {T | undefined} 找到的元素,如果没有找到则返回undefined
*/
export declare const find: <T>(arr: T[], predicate: (item: T, index: number) => boolean) => T | undefined;
/**
* 从数组中删除指定元素,并返回该数组。
*
* let arr1 = [1, 2, 3, 4]
* let arr2 = [1, 2, NaN, 4]
* remove(arr1, 2, 2) // [1, 4]
* remove(arr2, NaN) // [1, 2, 4]
*
* @param {Array<T>} arr 源数组
* @param {T} data 需要删除的数据
* @param {number} count 删除元素个数,默认为 1
* @returns {Array<T>} 处理后的数组
*/
export declare const remove: <T>(arr: T[], data: T, count?: number) => T[];
/**
* 对象数组自定义排序,并返回该数组。
*
* sort([ {a:100}, {a:1}, {a:NaN}, {a:10} ], 'a') // [ {a:1}, {a:10}, {a:100}, {a:NaN} ]
* sort([ {a:100}, {a:1}, {a:NaN}, {a:10} ], 'a','desc') // [ {a:100}, {a:10}, {a:1}, {a:NaN} ]
*
* @param {Array<T>} arr 需要排序的对象数组
* @param {string} field 要排序的对象字段
* @param {string} sort 排序方向,取值为 "asc" 或 "desc"
* @returns {Array<T>} 排好序的对象数组
*/
export declare const sort: <T extends Record<string, any>>(arr: T[], field: string, sort?: string) => T[];
/**
* 向数组中添加不重复的数据,并返回该数组。
*
* let arr = [ 1, 2, NaN, 4]
* push(arr, 1) // [ 1, 2, NaN, 4]
* push(arr, NaN) // [ 1, 2, NaN, 4]
* push(arr, 5) // [ 1, 2, NaN, 4, 5]
*
* @param {Array<T>} arr 源数组
* @param {T} data 需要增加的数据
* @returns {Array<T>} 处理后的数组
*/
export declare const push: <T>(arr: T[], data: T) => T[];
/**
* 去除数组中的重复的值,并返回新数组。
*
* let arr = [ 1, NaN, 2, NaN, 2, 3, 4]
* unique(arr) // [ 1, NaN, 2, 3, 4]
*
* @param {Array<T>} arr 源数组
* @returns {Array<T>} 去重后的新数组
*/
export declare const unique: <T>(arr: T[]) => T[];
/**
* 数组转对象
*
* let arr = [ { key1: value1 }, { key2: value2 } ]
* toObject(arr) // { key1: value1, key2: value2 }
*
* @param {Array<Record<string, any>>} arr 包含对象的数组
* @returns {Record<string, any>} 合并后的对象
*/
export declare const toObject: (arr: Record<string, any>[]) => Record<string, any>;
/**
* 将 id 与 pid 构成的扁平数据转换成 children 的树状数据
*
* let data = [{ id: 100, pId: 0, label: '首页'}, { id: 101, pId: 100, label: '指南'}]
* transformPidToChildren(data) // [ 0: { id: 100, label: "首页", children: [ 0: { id: 101, label: "指南" } ] } ]
*
* @param {Array<Record<string, any>>} data id 与 pid 构成的扁平数据的数组
* @param {string} [pidName] pid 的属性名,缺省为 pId
* @param {string} [childrenName] children 的属性名,缺省为 children
* @param {string} [idName] id 的属性名,缺省为 id
* @returns {Array<Record<string, any>>} 树状结构数据
*/
export declare const transformPidToChildren: (data: Record<string, any>[], pidName?: string, childrenName?: string, idName?: string) => Record<string, any>[];
/**
* 将pid标识的普通数组转换树结构数据
*
* @param {Record<string, any> | Record<string, any>[]} data 需要转换的数据
* @param {string} key id的属性名,默认为'id'
* @param {string} parentKey 父id的属性名,默认为'pId'
* @returns {Record<string, any>[]} 树状结构数据
*/
export declare const transformTreeData: (data: Record<string, any> | Record<string, any>[], key?: string, parentKey?: string) => Record<string, any>[];
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 检查环境是否支持BigInt
* @returns {boolean} 是否支持BigInt
*/
export declare function supportBigInt(): boolean;
/**
* 格式化数字字符串
* @param {string | number} numStr 要格式化的数字或字符串
* @returns {Object} 格式化后的对象,包含各种数字信息
*/
export declare function trimNumber(numStr: string | number): {
negative: boolean;
negativeStr: string;
trimStr: string;
integerStr: string;
decimalStr: string;
fullStr: string;
};
/**
* 检查数字是否为科学计数法格式
* @param {string | number} number 要检查的数字
* @returns {boolean} 是否为科学计数法格式
*/
export declare function isE(number: string | number): boolean;
/**
* 验证字符串是否为有效的数字格式
* @param {string | number | null | undefined} num 要验证的数字或字符串
* @returns {boolean} 是否为有效的数字格式
*/
export declare function validateNumber(num: string | number | null | undefined): boolean;
/**
* 获取数字精度(小数位数)
* [Legacy] 将科学计数法 1e-9 转换为 0.000000001。
* 注意:如果用户真的需要 1e-9,可能会损失一些精度
* @param {string | number} number 要检查的数字
* @returns {number} 小数位数
*/
export declare function getNumberPrecision(number: string | number): number;
/**
* 将数字(包括科学计数法)转换为 -xxx.yyy 格式
* @param {string | number} number 要转换的数字
* @returns {string} 转换后的字符串
*/
export declare function num2str(number: string | number): string;
/**
* 获取迷你Decimal实例
* @param {string | number} value 数值
* @param {any} decimal 可选的decimal库
* @returns {any} decimal实例
*/
export declare function getMiniDecimal(value: string | number, decimal?: any): any;
/**
* 大整数小数处理类
*/
export declare class BigIntDecimal {
/** 是否为空 */
empty?: boolean;
/** 原始值 */
origin: string;
/** 是否为负数 */
negative?: boolean;
/** 整数部分 */
integer?: bigint | string;
/** 小数部分 */
decimal?: bigint;
/** 小数长度 */
decimalLen?: number;
/** 是否为NaN */
nan?: boolean;
/**
* 构造函数
* @param {string | number} value 数值
*/
constructor(value: string | number);
/**
* 获取小数部分字符串
* @returns {string} 小数部分字符串
*/
getDecimalStr(): string;
/**
* 获取整数部分字符串
* @returns {string} 整数部分字符串
*/
getIntegerStr(): string;
/**
* 获取数字符号
* @returns {string} 负号或空字符串
*/
getMark(): string;
/**
* 对齐小数位,例如:12.3 + 5 = 1230000
* 这仅用于add函数
* @param {number} decimalLength 小数长度
* @returns {bigint} 对齐后的BigInt
*/
alignDecimal(decimalLength: number): bigint;
/**
* 加法操作
* @param {string | number} value 要添加的值
* @returns {BigIntDecimal} 计算结果
*/
add(value: string | number): BigIntDecimal;
/**
* 取反操作
* @returns {BigIntDecimal} 取反后的值
*/
negate(): BigIntDecimal;
/**
* 检查是否为NaN
* @returns {boolean} 是否为NaN
*/
isNaN(): boolean;
/**
* 检查是否为空
* @returns {boolean} 是否为空
*/
isEmpty(): boolean;
/**
* 检查是否无效
* @returns {boolean} 是否无效
*/
isInvalidate(): boolean;
/**
* 小于等于比较
* @param {BigIntDecimal} target 比较目标
* @returns {boolean} 是否小于等于
*/
lessEquals(target: BigIntDecimal): boolean;
/**
* 相等比较
* @param {BigIntDecimal | null | undefined} target 比较目标
* @returns {boolean} 是否相等
*/
equals(target: BigIntDecimal | null | undefined): boolean;
/**
* 转换为数字
* @returns {number} 数字值
*/
toNumber(): number;
/**
* 转换为字符串
* @param {boolean} safe 是否安全转换,默认为true
* @returns {string} 字符串表示
*/
toString(safe?: boolean): string;
}
/**
* 普通数字小数处理类
*/
export declare class NumberDecimal {
/** 是否为空 */
empty?: boolean;
/** 原始值 */
origin: string;
/** 数字值 */
number?: number;
/**
* 构造函数
* @param {string | number} value 数值
*/
constructor(value?: string | number);
/**
* 取反操作
* @returns {NumberDecimal} 取反后的值
*/
negate(): NumberDecimal;
/**
* 加法操作
* @param {string | number} value 要添加的值
* @returns {NumberDecimal} 计算结果
*/
add(value: string | number): NumberDecimal;
/**
* 检查是否为NaN
* @returns {boolean} 是否为NaN
*/
isNaN(): boolean;
/**
* 检查是否为空
* @returns {boolean} 是否为空
*/
isEmpty(): boolean;
/**
* 检查是否无效
* @returns {boolean} 是否无效
*/
isInvalidate(): boolean;
/**
* 相等比较
* @param {NumberDecimal | null | undefined} target 比较目标
* @returns {boolean} 是否相等
*/
equals(target: NumberDecimal | null | undefined): boolean;
/**
* 小于等于比较
* @param {NumberDecimal} target 比较目标
* @returns {boolean} 是否小于等于
*/
lessEquals(target: NumberDecimal): boolean;
/**
* 转换为数字
* @returns {number} 数字值
*/
toNumber(): number;
/**
* 转换为字符串
* @param {boolean} safe 是否安全转换,默认为true
* @returns {string} 字符串表示
*/
toString(safe?: boolean): string;
}
/**
* 设置Decimal类
* @param {any} decimaljs 自定义decimal库
*/
export declare const setDecimalClass: (decimaljs?: any) => void;
/**
* 比较两个值是否小于等于关系
* @param {string | number} value1 第一个值
* @param {string | number} value2 第二个值
* @returns {boolean} value1 <= value2
*/
export declare function lessEquals(value1: string | number, value2: string | number): boolean;
/**
* 比较两个值是否相等
* @param {string | number} value1 第一个值
* @param {string | number} value2 第二个值
* @returns {boolean} value1 === value2
*/
export declare function equalsDecimal(value1: string | number, value2: string | number): boolean;
/**
* 将数字格式化为固定精度
* @param {string | number} numStr 数字或数字字符串
* @param {number} precision 精度(小数位数)
* @param {number} rounding 舍入方式,默认为5(四舍五入)
* @returns {string} 格式化后的字符串
*/
export declare function toFixed(numStr: string | number, precision: number, rounding?: number): string;
/**
* 获取指定年月的总天数
* @method
* @param {Number} year - 年份
* @param {Number} month - 月份(1-12)
* @returns {Number} - 该月总天数
*/
export declare const getDays: (year: number, month: number) => number;
/**
* 根据日期获取星期几
* @method
* @param {Number} year - 年份
* @param {Number} month - 月份(1-12)
* @param {Number} day - 日期
* @returns {Number} - 星期几(0-6,0表示星期日)
*/
export declare const getWeek: (year: number, month: number, day: number) => number;
/**
* 获取上一个月的年份和月份
* @method
* @param {Number} year - 当前年份
* @param {Number} month - 当前月份(1-12)
* @returns {Object} - 包含上个月年份和月份的对象
*/
export declare const lastMonth: (year: number, month: number) => {
year: number;
month: number;
};
/**
* 获取下一个月的年份和月份
* @method
* @param {Number} year - 当前年份
* @param {Number} month - 当前月份(1-12)
* @returns {Object} - 包含下个月年份和月份的对象
*/
export declare const nextMonth: (year: number, month: number) => {
year: number;
month: number;
};
/**
* 日历数据接口定义
*/
interface CalendarData {
last: {
year: number;
month: number;
start: number;
end: number;
};
current: {
year: number;
month: number;
start: number;
end: number;
};
next: {
year: number;
month: number;
start: number;
end: number;
};
}
/**
* 获取日历数据(包含上月、当月和下月的日期信息)
* @method
* @param {Number} year - 年份
* @param {Number} month - 月份(1-12)
* @returns {CalendarData | undefined} - 日历数据对象,包含上月、当月和下月的日期信息
*/
export declare const getCalendar: (year: number, month: number) => CalendarData | undefined;
/**
* 将一维数组转换成 7*N 的二维数组(用于日历表格展示)
* @method
* @param {Array<T>} array - 一维数据数组
* @returns {Array<Array<T>>} - 转换后的7列二维数组
*/
export declare const transformArray: <T>(array: T[]) => T[][];
/**
* 日期解析结果接口
*/
interface ParsedDate {
year: number;
month: number;
day: number;
hours: number;
minutes: number;
seconds: number;
}
/**
* 时间转换成年月日时分秒对象
* @method
* @param {number | string} time - 时间戳或标准的日期字符串
* @returns {ParsedDate} - 包含年月日时分秒的对象
*/
export declare const parseDate: (time: number | string) => ParsedDate;
export {};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 键盘按键对应的键码常量
* @type {Record<string, number>}
*/
export declare const KEY_CODE: Record<string, number>;
/**
* 组件定位方向常量
* @type {Record<string, string>}
*/
export declare const POSITION: Record<string, string>;
/**
* 排序方向常量
* 只使用在 array.ts中, 待移除
* @type {Record<string, string>}
*/
export declare const SORT: Record<string, string>;
/**
* 刷新间隔时间(毫秒)
* @type {number}
*/
export declare const REFRESH_INTERVAL = 100;
/**
* IP地址输入阈值常量
* @type {Record<string, number>}
*/
export declare const IPTHRESHOLD: Record<string, number>;
/**
* 日期格式常量
* @type {Record<string, string>}
*/
export declare const DATE: Record<string, string>;
/**
* 日期选择器相关常量
* @type {Record<string, any>}
*/
export declare const DATEPICKER: Record<string, any>;
/**
* 浏览器名称常量
* @type {Record<string, string>}
*/
export declare const BROWSER_NAME: Record<string, string>;
/**
* 鼠标滚轮增量值
* @type {number}
*/
export declare const MOUSEDELTA = 120;
/**
* 表单验证状态常量
* @type {Record<string, string>}
*/
export declare const VALIDATE_STATE: Record<string, string>;
/**
* 级联选择器相关常量
* @type {Record<string, any>}
*/
export declare const CASCADER: Record<string, any>;
/** 生成字节流或字符串的sha256编码
* @param message - 需要计算哈希值的消息(字符串或ArrayBuffer)
* @returns 返回消息的SHA-256哈希值(十六进制字符串)
*/
export declare function sha256(message: ArrayBuffer | string): Promise<string>;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 过滤器值类型
*/
interface FilterValue {
type: string;
value: any;
relation?: string;
text?: string;
}
/**
* 过滤器对象类型
*/
interface Filters {
[property: string]: FilterValue;
}
/**
* 分页参数类型
*/
interface Page {
currentPage?: number;
pageSize?: number;
}
/**
* 排序参数类型
*/
interface Sort {
property?: string;
order?: string;
}
/**
* 数据源参数类型
*/
interface Source {
url: string;
type?: string;
method?: string;
data?: Record<string, any>;
beforeRequest?: (config: any, args?: any) => void;
afterRequest?: (data: any) => void;
success?: (data: any) => void;
hideErr?: boolean;
[key: string]: any;
}
/**
* API 参数类型
*/
interface Api {
name: string;
data?: Record<string, any>;
}
/**
* 数据集参数类型
*/
interface Dataset {
source?: Source;
value?: any[];
api?: Api;
service?: any;
}
/**
* 数据集参数类型(完整)
*/
interface DatasetOptions {
dataset?: Dataset | any[];
service?: any;
tree?: {
key?: string;
parentKey?: string;
};
}
/**
* 请求参数类型
*/
interface RequestArgs {
page?: Page;
sort?: Sort;
filters?: Filters;
[key: string]: any;
}
/**
* 获取数据集数据,支持多种数据源方式:
* 1. 直接数组数据
* 2. 通过 source 配置的网络请求
* 3. 通过 api 配置的服务方法调用
*
* @param {DatasetOptions} param0 - 数据集配置选项
* @param {RequestArgs} args - 请求参数
* @returns {Promise<any>} - 返回处理后的数据承诺
*/
export declare const getDataset: ({ dataset, service, tree }: DatasetOptions, args?: RequestArgs) => Promise<any>;
export {};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/** 西班牙语的“日期,日子”,此处为日期辅助对象,其下有i18n,masks,format,parse等辅助方法 */
declare const fecha: {};
export { fecha };
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export declare const getI18nSettings: (t: any) => {
dayNamesShort: any;
dayNames: any;
monthNamesShort: any;
monthNames: any;
amPm: string[];
};
export declare const isDate: (date: any) => boolean;
export declare const toDate: (date: any) => Date | null;
export declare const isDateObject: (val: any) => boolean;
export declare const formatDate: (date: any, format: any, t: any) => any;
export declare const parseDate: (string: any, format: any, t: any) => any;
export declare const getDayCountOfMonth: (year: any, month: any) => 31 | 28 | 30 | 29;
export declare const getDayCountOfYear: (year: any) => 366 | 365;
export declare const getFirstDayOfMonth: (date: any) => number;
export declare const prevDate: (date: any, amount?: number) => Date;
export declare const nextDate: (date: any, amount?: number) => Date;
export declare const getStartDateOfMonth: (year: any, month: any, offsetDay?: number) => Date;
export declare const getWeekNumber: (src: any) => number | null;
export declare const getRangeHours: (ranges?: never[]) => never[];
export declare const range: (length: any) => number[];
export declare const getMonthDays: (date: any) => number[];
export declare const getPrevMonthLastDays: (date: any, amount: any) => number[];
export declare const getRangeMinutes: (ranges: any, hour: any) => any[];
export declare const modifyDate: (date: any, y: any, m: any, d: any) => Date;
export declare const modifyTime: (date: any, h: any, m: any, s: any) => Date;
export declare const modifyWithTimeString: (date: any, time: any, t: any) => any;
export declare const clearTime: (date: any) => Date;
export declare const clearMilliseconds: (date: any) => Date;
export declare const limitTimeRange: (date: any, ranges: any, format?: any) => any;
export declare const timeWithinRange: (date: any, selectableRange: any, format: any) => boolean;
export declare const changeYearMonthAndClampDate: (date: any, year: any, month: any) => Date;
export declare const nextMonth: (date: any) => Date;
export declare const prevMonth: (date: any) => Date;
export declare const nextYear: (date: any, next?: number) => Date;
export declare const prevYear: (date: any, prev?: number) => Date;
export declare const extractTimeFormat: (dateFormat: any) => any;
export declare const extractDateFormat: (dateFormat: any) => any;
export declare const validateRangeInOneMonth: (startDate: any, endDate: any) => boolean;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 判断年份是否为闰年。
*
* isLeapYear(2017) // false
* isLeapYear(2000) // true
*
* @param {Number} year 年份
* @returns {Boolean}
*/
export declare const isLeapYear: (year: any) => boolean;
/**
* 将字符串或数字转换成 Date 类型。
*
* toDate('2008/02/02') // new Date(2008, 1, 2)
* toDate(Date.UTC(2008, 1, 2)) // new Date(Date.UTC(2008, 1, 2))
* toDate('2008/2/2', 'yyyy/M/d') // new Date(2008, 1, 2)
* toDate('2008/02') // new Date(2008, 1, 1)
* toDate('02/2008') // new Date(2008, 1, 1)
* toDate('2008-02-01T20:08+08:00') // new Date(Date.UTC(2008, 0, 31, 16))
* toDate('2008-02-01T04:08-08:00') // new Date(Date.UTC(2008, 1, 1, 8))
*
* @param {String|Number} value 日期类型字符串或数字
* @param {String} [dateFormat] 转换格式
*
* 当 value 为字符串类型时,如果不提供,则尽可能按常见格式去解析。
* 常见格式为 yyyy[/-]MM[/-]dd hh:mm:ss.SSS, MM[/-]dd [/-]yyyy hh:mm:ss.SSS 及 ISO8601 时间格式。
*
* 如果提供,则按具体格式严格匹配解析,并且年份必须为4位。
* - yyyy 代表年份
* - M 或 MM 代表1位或2位的月份
* - d 或 dd 代表1位或2位的天数
* - h 或 hh 代表24小时的1位或2位的小时
* - m 或 mm 代表1位或2位的分钟,
* - s 或 ss 代表1位或2位的秒
* - S 或 SS 或 SSS 代表1位或2位或3位的毫秒
*
* @param {String} [minDate] 最小时间,默认为 0001-01-01 00:00:00.000
* @returns {Date}
*/
export declare const toDate: (value: any, dateFormat: any, minDate: any) => any;
/**
* 将 Date 实例转换成日期字符串
* @param date - Date 实例或日期字符串
* @param dateFormat - 转换格式,默认为 'yyyy/MM/dd hh:mm:ss'
* @param afterFormat - 转换后的格式(仅当date为字符串且有3个参数时有效)
* @returns 格式化后的日期字符串
*/
export declare const format: (date: Date | string, dateFormat?: string) => any;
/**
* 将当前操作的时间变更时区,主要用于转换一个其他时区的时间。
*
* var date = new Date(2017, 0, 1)
* getDateWithNewTimezone(date, 0, -2)
*
* @param {Date} date Date 实例或日期字符串
* @param {Number} otz 原时区 -12~13
* @param {Number} ntz 目标时区 -12~13 默认为当前时区
* @param {Boolean} TimezoneOffset 时区偏移量
* @returns {Date}
*/
export declare const getDateWithNewTimezone: (date: any, otz: any, ntz: any, timezoneOffset?: number) => Date | undefined;
/**
* 按时区将 Date 实例转换成字符串
* @param date - Date 实例或日期字符串
* @param dateFormat - 转换格式
* @param timezone - 时区
* @returns 格式化的日期字符串
*/
export declare const toDateStr: (date: Date | string, dateFormat: string, timezone?: number) => string;
/**
* 获取日期所在周的第一天,默认周一为第一天(可扩展周日为第一天)。
*
* getWeekOfFirstDay() // 返回当前日期所在周的周一同一时间
* getWeekOfFirstDay(true) // 返回当前日期所在周的周日同一时间
* getWeekOfFirstDay(new Date(2019, 8, 5)) // new Date(2019, 8, 2)
* getWeekOfFirstDay(new Date(2019, 8, 5)), true) // new Date(2019, 8, 1)
*
* @param {Date} [date=new Date()] date 日期实例,默认当天
* @param {Boolean} [isSunFirst] 是否设置周日为第一天,非必填
* @returns {Date}
*/
export declare const getWeekOfFirstDay: (date: any, isSunFirst: any) => Date;
export declare const getLocalTimezone: () => number;
export declare const getStrTimezone: (value: any) => any;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export {};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 定义带有 _cancel 方法的防抖函数类型
*/
export interface DebounceFunction extends Function {
_cancel?: () => void;
}
/**
* 防抖函数 - 将多次触发的函数执行延迟到最后一次触发后的指定时间才执行
*
* @param {number} delay - 延迟时间(毫秒)
* @param {boolean | Function} atBegin - 如果为布尔值,指定是否在延迟开始前执行;如果为函数,则作为回调函数
* @param {Function} [callback] - 需要防抖的回调函数
* @returns {DebounceFunction} 返回一个经过防抖处理的函数
*/
export declare function debounce(delay: number, atBegin: boolean | Function, callback?: Function): DebounceFunction;
import { toFixed as roundFixed } from '../bigInt';
export { roundFixed };
/**
* Decimal 类的接口定义
*/
interface IDecimal {
internal: string;
asInt: {
value: string | number;
exp: number;
};
add: (target: number | string | IDecimal) => IDecimal;
sub: (target: number | string | IDecimal) => IDecimal;
mul: (target: number | string | IDecimal) => IDecimal;
div: (target: number | string | IDecimal) => IDecimal;
toString: () => string;
toNumber: () => number;
}
/**
* Decimal 类,解决 JS 的计算精度问题。
*
* // 加法运算 1.1 + 2.2 = 3.3000000000000003
* Decimal.add(1.1, 2.2).toNumber() // 3.3
* new Decimal('1.1').add('2.2').toString() // "3.3"
*
* // 减法运算 0.3 - 0.1 = 0.19999999999999998
* Decimal.sub(0.3, 0.1).toNumber() // 0.2
* new Decimal('0.3').sub('0.1').toString() // "0.2"
*
* // 乘法运算 4.01 * 2.01 = 8.060099999999998
* Decimal.mul(4.01, 2.01).toNumber() // 8.0601
* new Decimal('4.01').mul('2.01').toString() // "8.0601"
*
* // 除法运算 0.3 / 0.1 = 2.9999999999999996
* Decimal.div(0.3, 0.1).toNumber() // 3
* new Decimal('0.3').div('0.1').toString() // "3"
*
* @param {Number|String|IDecimal} num 数字或字符串代表的数字
* @returns {IDecimal} Decimal实例
*/
export declare function Decimal(this: IDecimal | null | undefined, num: number | string | IDecimal): IDecimal;
/**
* 使用定点表示法表示给定数字的字符串,解决 JS 的计算精度问题。
*
* toFixed(1.1 + 2.2, 2) // "3.30"
* toFixed(0.3 - 0.1, 2) // "0.20"
* toFixed(4.01 * 2.01, 4) // "8.0601"
* toFixed(0.3 / 0.1, 2) // "3.00"
* toFixed(0.0001, 2) // "0.00"
* toFixed(0.0001, 3) // "0.000"
* toFixed(0.0001, 4) // "0.0001"
* toFixed(0.0001, 5) // "0.00010"
* toFixed(-0.0001, 2) // "0.00"
* toFixed(-0.0001, 3) // "0.000"
* toFixed(-0.0001, 4) // "-0.0001"
* toFixed(-0.0001, 5) // "-0.00010"
*
* @param {number} num 需精确计算的数字
* @param {number} [fraction=0] 浮点数的小数部分,默认0位
* @returns {string} 格式化后的字符串
*/
export declare const toFixed: (num: number, fraction?: number) => string;
/**
* 格式化数字的接口
*/
interface FormatNumberOptions {
fraction?: number;
rounding?: string;
prefix?: string;
decimalSeparator?: string;
suffix?: string;
zeroize?: boolean;
secondaryGroupSize?: number;
groupSize?: number;
groupSeparator?: string;
fractionGroupSize?: number;
fractionGroupSeparator?: string;
}
/**
* 格式化数字
* @param {number|string} value 要格式化的数值
* @param {FormatNumberOptions} format 格式化选项
* @returns {string} 格式化后的字符串
*/
export declare const formatNumber: (value: number | string, format?: FormatNumberOptions) => string;
/**
* 恢复数字
* @param {number|string} number 要恢复的数字
* @param {object} format 格式选项
* @returns {number} 恢复后的数字
*/
export declare const recoverNumber: (number: number | string, format?: FormatNumberOptions) => number;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 为元素绑定事件监听器
* @param el 目标DOM元素
* @param event 事件名称
* @param handler 事件处理函数
* @param options 事件选项,默认为false
*/
export declare const on: (el: EventTarget, event: string, handler: (this: HTMLElement, ev: Event) => any, options?: boolean | AddEventListenerOptions) => void;
/**
* 移除元素的事件监听器
* @param el 目标DOM元素
* @param event 事件名称
* @param handler 事件处理函数
* @param options 事件选项,默认为false
*/
export declare const off: (el: EventTarget, event: string, handler: (this: HTMLElement, ev: Event) => any, options?: boolean | EventListenerOptions) => void;
/**
* 为元素绑定一次性事件,触发后自动移除
* @param el 目标DOM元素
* @param event 事件名称
* @param fn 事件处理函数
*/
export declare const once: (el: HTMLElement, event: string, fn: (this: HTMLElement, ev: Event) => any) => void;
/**
* 判断元素是否包含指定的类名
* 只能查询单个类名,且不能有空格
* @param el 目标DOM元素
* @param clazz 要检查的类名
* @returns 如果元素包含该类名则返回true,否则返回false
*/
export declare const hasClass: (el: HTMLElement, clazz: string) => boolean;
/**
* 为元素添加一个或多个类名
* clazz允许为用空格分隔的多个类名
* @param el 目标DOM元素
* @param clazz 要添加的类名,多个类名用空格分隔
*/
export declare const addClass: (el: HTMLElement, clazz?: string) => void;
/**
* 从元素移除一个或多个类名
* clazz允许为用空格分隔的多个类名
* @param el 目标DOM元素
* @param clazz 要移除的类名,多个类名用空格分隔
*/
export declare const removeClass: (el: HTMLElement, clazz: string) => void;
/**
* 获取元素的样式值
* 优先查找el.style,找不到则调用getComputedStyle(el)
* @param el 目标DOM元素
* @param styleName 样式属性名
* @returns 样式属性值
*/
export declare const getStyle: (el: HTMLElement, styleName: string) => string | null | undefined;
/**
* 设置元素的样式
* @param el 目标DOM元素
* @param name 样式属性名或样式对象。当它是对象时,遍历所有属性;当它是字符串时,需要传入第3个参数value
* @param value 样式属性值,当name为字符串时使用
*/
export declare const setStyle: (el: HTMLElement, name: string | Record<string, any>, value?: any) => void;
/**
* 判断元素是否有滚动样式
* @param el 目标DOM元素
* @param vertical true时只判断overflow-y属性;false时只判断overflow-x属性;不传入时只判断overflow属性
* @returns 如果元素有滚动样式则返回匹配结果,否则返回null或undefined
*/
export declare const isScroll: (el: HTMLElement, vertical?: boolean) => RegExpMatchArray | null | undefined;
/**
* 查找离元素最近的可滚动父元素
* @param el 目标DOM元素
* @param vertical true时只判断overflow-y属性;false时只判断overflow-x属性;不传入时只判断overflow属性
* @returns 最近的可滚动父元素,如果没有则返回元素自身
*/
export declare const getScrollContainer: (el: HTMLElement, vertical?: boolean) => Window | HTMLElement | undefined;
/**
* 判断元素是否完全在容器内部
* 四个边有重合都不行,必须完全在里面
* @param el 目标DOM元素
* @param container 容器元素
* @returns 如果元素完全在容器内部则返回true,否则返回false
*/
export declare const isInContainer: (el: HTMLElement, container: HTMLElement) => boolean;
/**
* 获取页面的位置和尺寸信息
* @returns 包含滚动位置和可视区域尺寸的对象
* - scrollTop: document或body的垂直滚动位置
* - scrollLeft: document或body的水平滚动位置
* - visibleHeight: 可视区高度(不含滚动条)
* - visibleWidth: 可视区宽度(不含滚动条)
*/
export declare const getDomNode: () => {
scrollTop: number;
scrollLeft: number;
visibleHeight: number;
visibleWidth: number;
};
/**
* 获取元素的垂直滚动位置
* 处理iOS滚动反弹导致的负scrollTop值
* @param el 目标DOM元素
* @returns 元素的垂直滚动位置,最小为0
*/
export declare const getScrollTop: (el: HTMLElement | Window) => number;
/**
* 阻止事件冒泡
* @param event 事件对象
*/
export declare const stopPropagation: (event: Event) => void;
/**
* 阻止事件默认行为
* @param event 事件对象
* @param isStopPropagation 是否同时阻止事件冒泡
*/
export declare const preventDefault: (event: Event, isStopPropagation?: boolean) => void;
/**
* 获取元素的可滚动父元素
* @param el 目标DOM元素
* @param root 根元素,默认为window
* @returns 可滚动的父元素,如果没有则返回root
*/
export declare const getScrollParent: (el: HTMLElement, root?: Window | HTMLElement | undefined) => Window | HTMLElement | null;
interface Hooks {
onMounted: (callback: () => void) => void;
ref: <T>() => {
value?: T;
};
watch: <T>(source: {
value?: T;
}, callback: () => void) => void;
}
/**
* 创建一个用于获取元素可滚动父元素的组合式函数
* @param hooks 包含onMounted、ref和watch的对象
* @returns 返回一个函数,该函数接收元素引用和根元素,返回可滚动父元素的ref
*/
export declare const useScrollParent: ({ onMounted, ref, watch }: Hooks) => <T extends HTMLElement>(elRef: {
value?: T | undefined;
}, root?: Window | HTMLElement | undefined) => {
value?: Window | HTMLElement | null | undefined;
};
/**
* 判断元素是否处于隐藏状态
* 递归检查元素及其父元素的display和position属性
* @param elm 目标DOM元素
* @returns 如果元素处于隐藏状态则返回true,否则返回false
*/
export declare const isDisplayNone: (elm: HTMLElement | null) => boolean;
export {};
export declare function init(): {};
export declare const espaceCtrl: {};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 触发事件,并返回是否在事件中执行了 preventDefault 方法,支持事件传递附加参数。
*
* // 触发事件,返回 false 则退出
* if (!emitEvent(emit, 'before', 1)) {
* return
* }
*
* // @before='before' 定义事件执行的函数
* function before(event, value) {
* // value: 1
* event.preventDefault() // 通知事件宿主停止执行
* }
*
* @param {Function} emit 触发事件的函数
* @param {String} name 事件的名称
* @returns {Boolean}
*/
export declare const emitEvent: (emit: any, name: any, ...args: any[]) => boolean;
/**
* webComponent中,有些事件的target会代理到webComponent根元素上,导致无法获取正确的target
*
* @param event 浏览器事件
* @returns 正确的target
*/
export declare const getActualTarget: (e: any) => any;
export declare const correctTarget: (event: any, target?: EventTarget) => void;
/**
* FastDom
*
* Eliminates layout thrashing
* by batching DOM read/write
* interactions.
*
* @author Wilson Page <wilsonpage@me.com>
* @author Kornel Lesinski <kornel.lesinski@ft.com>
*/
declare const fastdomAsync: any;
export default fastdomAsync;
import { default as fastdom } from './singleton';
import { default as fastdomAsync } from './async';
import { default as fastdomSandbox } from './sandbox';
export { fastdom, fastdomAsync, fastdomSandbox };
/**
* FastDom
*
* Eliminates layout thrashing
* by batching DOM read/write
* interactions.
*
* @author Wilson Page <wilsonpage@me.com>
* @author Kornel Lesinski <kornel.lesinski@ft.com>
*/
declare const fastdomSandbox: any;
export default fastdomSandbox;
declare class FastDom {
constructor();
runTasks(tasks: any): void;
measure(fn: any, ctx: any): any;
mutate(fn: any, ctx: any): any;
clear(task: any): boolean;
extend(props: any): any;
}
declare const fastdomSingleton: FastDom;
export default fastdomSingleton;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
declare const fecha: {};
export { fecha };
export declare const FORM_ITEM = "FormItem";
export declare const FORM_EVENT: {
change: string;
blur: string;
};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
declare const api: {
targetElement: null;
opts: null;
isEnabled: any;
isFullscreen: boolean;
toggle(target: any, options: any, force: any): Promise<unknown>;
request(targetEle: any, options: any): Promise<unknown>;
exit(): Promise<unknown>;
};
export default api;
import { default as FullscreenApi } from './apis';
import { default as sf } from './screenfull';
export { FullscreenApi, sf };
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
declare const screenfull: {
request(element: any, options: any): Promise<unknown>;
exit(): Promise<unknown>;
toggle(element: any, options: any): any;
onchange(callback: any): void;
onerror(callback: any): void;
on(event: any, callback: any): void;
off(event: any, callback: any): void;
raw: {};
};
export default screenfull;
export declare const noop: () => void;
export declare const callInterceptor: (interceptor: any, { args, done, canceled, error }: {
args?: never[] | undefined;
done: any;
canceled: any;
error: any;
}) => void;
export declare const globalConfig: {
viewportWindow: null;
};
export declare const getViewportWindow: () => Window & typeof globalThis;
export declare const isServer: boolean;
/** 分析浏览器的版本信息 */
export declare const browserInfo: {
name: string;
version: number;
isDoc: boolean;
isMobile: boolean;
isPC: boolean;
isNode: false;
chrome: boolean;
ie: boolean;
firefox: boolean;
safari: boolean;
opera: boolean;
edge: boolean;
} | null;
import { default as xss } from './xss';
import { default as logger } from './logger';
import { default as ResizeObserver } from './resize-observer';
import * as nanoid from './nanoid/index';
export { xss, logger, ResizeObserver };
export { sha256 } from './crypt';
export { globalConfig, getViewportWindow, isServer, browserInfo } from './globalConfig';
export { getDays, getWeek, lastMonth, nextMonth, getCalendar, transformArray, parseDate } from './calendar';
export { isLeapYear, toDate, format as formatDateByPattern, getDateWithNewTimezone, toDateStr, getWeekOfFirstDay, getLocalTimezone, getStrTimezone } from './date';
export { getI18nSettings, isDate as isDate1, toDate as toDate1, isDateObject, formatDate, parseDate as parseDate1, nextMonth as nextMonth1, getDayCountOfMonth, getDayCountOfYear, getFirstDayOfMonth, prevDate, nextDate, getStartDateOfMonth, getWeekNumber, getRangeHours, range, getMonthDays, getPrevMonthLastDays, getRangeMinutes, modifyDate, modifyTime, modifyWithTimeString, clearTime, clearMilliseconds, limitTimeRange, timeWithinRange, changeYearMonthAndClampDate, prevMonth, nextYear, prevYear, extractTimeFormat, extractDateFormat, validateRangeInOneMonth } from './date-util';
export { toString, hasOwn, isNull, typeOf, isObject, isFunction, isPlainObject, isEmptyObject, isNumber, isNumeric, isDate, isSame, isRegExp, isPromise } from './type';
export { formatTypes, escapeChars, isNullOrEmpty, camelize, capitalize, hyphenate, toJson, getLength, fillChar, random, guid, escapeHtml, escape, fieldFormat, truncate, tryToConvert, toInt, tryToInt, toNumber, tryToNumber, toDecimal, tryToDecimal, toCurrency, tryToCurrency, toBoolValue, toRate, toFileSize, formatFileSize, isKorean, format as formatString, omitText } from './string';
export { roundFixed, Decimal, toFixed as toFixedDecimal, formatNumber, recoverNumber } from './decimal';
export { each, getObj, setObj, copyField, copyArray, isEqual, isEachEqual, extend, toJsonStr, merge } from './object';
export { supportBigInt, trimNumber, isE, validateNumber, getNumberPrecision, num2str, getMiniDecimal, BigIntDecimal, NumberDecimal, setDecimalClass, lessEquals, equalsDecimal, toFixed as toFixedBigInt } from './bigInt';
export { getDataset } from './dataset';
export { indexOf, find, remove, sort, push, unique, toObject, transformPidToChildren, transformTreeData } from './array';
export { KEY_CODE, POSITION, SORT, REFRESH_INTERVAL, IPTHRESHOLD, DATE, DATEPICKER, BROWSER_NAME, MOUSEDELTA, VALIDATE_STATE, CASCADER } from './common';
export { FORM_ITEM, FORM_EVENT } from './form';
export { Validator } from './validate';
export { emitEvent, getActualTarget, correctTarget } from './event';
export { noop, callInterceptor } from './function';
export { fastdom, fastdomAsync, fastdomSandbox } from './fastdom';
export { FullscreenApi, sf } from './fullscreen';
export { NODE_KEY, getNodeKey, markNodeData, getChildState, Node, TreeStore } from './tree-model';
export { afterLeave } from './after-leave';
export { debounce } from './debounce';
export { throttle } from './throttle';
export { on, off, once, hasClass, addClass, removeClass, getStyle, setStyle, isScroll, getScrollContainer, isInContainer, getDomNode, getScrollTop, stopPropagation, preventDefault, getScrollParent, useScrollParent, isDisplayNone } from './dom';
export { init as initEspace, espaceCtrl } from './espace-ctrl';
export { Memorize } from './memorize';
export { getScrollParent as getScrollParent1, PopperJS } from './popper';
export { PopupManager } from './popup-manager';
export { addResizeListener, removeResizeListener } from './resize-event';
export { calcScrollWidth } from './scroll-width';
export { scrollIntoView } from './scroll-into-view';
export { getDirection, touchStart, touchMove, resetTouchStatus } from './touch';
export { emulate } from './touch-emulator';
export { uploadAjax } from './upload-ajax';
export declare const log: {
logger: Console;
};
export { nanoid };

Sorry, the diff of this file is too big to display

/** 使用 logger.xxx 代替 window.console.xxx, 避免语法警告 */
export declare const logger: Console;
export default logger;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export declare class Memorize {
constructor(value: any, options?: {});
setKey(storeKey: any): void;
getValue(isSort?: boolean): any;
setValue(value: any): void;
clear(): void;
add(dataKey: any): void;
updateByKey(dataKey: any): void;
sort(list: any): any;
assemble(list: any): any;
}
type Nanoid = (size?: number) => string;
type CustomAlphabet = (alphabet: string, defaultSize?: number) => Nanoid;
type Random = (p?: void) => number;
interface API {
urlAlphabet: string;
nanoid: Nanoid;
customAlphabet: CustomAlphabet;
}
export declare const random: Random;
export declare const api: API;
export default api;
declare const urlAlphabet: string;
declare const nanoid: (size?: number) => string;
declare const customAlphabet: (alphabet: string, defaultSize?: number) => (size?: number) => string;
export { urlAlphabet, nanoid, customAlphabet };
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 将对象的每个属性值进行循环处理。
*
* let obj = { name: 'jacky', age: 28, job: 'coder', dept: 'it' }
* each(obj, function (field, value) {
* if (field === 'name') {
* // do something
* }
* })
*
* @param {Object} obj 要处理的对象
* @param {Function} handle 进行循环处理的函数,函数返回false, 则跳出循环
*/
export declare const each: (obj: object, handle: (key: string, value?: any) => boolean) => void;
/** 支持深度合并对象
* 【首参为true】,则每一层是对象就合并, 但是简单值或数组时,就后面覆盖过来
* 【首参为对象】,则仅第一层合并, 类似Object.assign
* 合并对象中,有非object类型的,统统忽略!
* @returns {Object}
*/
declare let extend: (deep: boolean | object, ...values: object[]) => object;
/**
* 通过路径,获得对象指向位置的值。
*
* getObj({ a: { b: 1 } }, 'a.b') // 1
* getObj({ a: { b: 1 } }, 'data.a.b', true) // 1
* getObj({ a: { b: undefined } }, 'a.b') // undefined
*
* @param {Object} data 查找数据源
* @param {String} names 查找属性命名空间字符串
* @param {Boolean} [isExceptRoot] 是否排除 names 的第一个节点,默认 false
* @returns {Object}
*/
export declare const getObj: (data: object, names: string, isExceptRoot?: boolean) => any;
/**
* 通过路径,设置对象指向位置的值。
*
* let obj = { limit: 5, data: { a: 1, b: 2 }, info: { a: 1, b: 2 } }
* setObj(obj, 'limit', 10) // obj.limit = 10
* setObj(obj, 'data', { c: 3 }, true) // obj.data = { a: 1, b: 2, c: 3 }
* setObj(obj, 'info', { c: 3 }) // obj.info = { c: 3 }
* setObj(obj, 'info.c', { d: 4 }, true) // obj.info = { c: { d: 4 } }
* setObj(obj, 'info.c', { e: 5 }, true) // obj.info = { c: { d: 4, e: 5 } }
*
* @param {Object} data 设置数据源
* @param {String} names 查找属性命名空间字符串
* @param {Object} value 设置的值
* @param {boolean} [isMerge] 是否覆盖还是合并,默认覆盖
* @returns {Object}
*/
export declare const setObj: (data: object, names: string, value: any, isMerge: any) => object;
/**
* 根据指定的字段属性名,复制对应的数据。
*
* let obj = { a: 1, b: '2', c: [3, 4, 5], d: { e: 'good' } }
* copyField(obj, ['a', 'b']) // { a: 1, b: '2' }
* copyField(obj, ['a', 'b'], false, true) // { c: [3, 4, 5], d: { e: 'good' } }
*
* @param {Object} data 源数据,合并数据源
* @param {Array} [fields] 指定的值得命名空间字符串的数值。 不传入,默认为克隆一份数据出来
* @param {Boolean} [isMerge] 是否覆盖还是合并,默认false覆盖
* @param {Boolean} [isExclude] 是否排除指定的fields复制,默认false
* @returns {Array}
*/
export declare const copyField: (data: object, fields?: string[], isMerge?: boolean, isExclude?: boolean) => {};
/**
* 复制数组数据,数据如包含对象,则深度复制,并返回一个新数组,如果不是数组则直接返回原对象。
*
* let arr1 = [ 1, 2, { name: 'jacky' } ]
* let arr2 = copyArray(arr1)
*/
export declare const copyArray: (arr: any[]) => {}[];
/**
* 可深层比较两个对象或两个数组是否相等。注意以源对象为比较基础
*
* isEachEqual({a: 1}, {a: 1, b: 2}) // true
* isEachEqual({a: 1, b: 2}, {a: 1}) // false (以源对象为比较基础,所以它是false)
* isEachEqual({a: 1, b: {c: 3, d: 4}}, {a: 1, b: {c: 3, d: 5}}) // false
*
* @param {Object} data1 数据源对象
* @param {Object} data2 对比目标对象
* @param {Boolean} [deep] 是否深度遍历,默认为true
* @returns {Boolean}
*/
declare let isEachEqual: (data1: any, data2: any, deep?: boolean) => boolean;
/**
* 可深层比较两个对象是否相等。
* 与`isEachEqual` 区别是:
* 1、2个对象交换位置,判断2次
* 2、它可以指定要比较的属性分支["a.b","a.c"] (整个系统使用fields这块功能)
*
* isEqual({ a: { b: 1 } }, { a: { b: 1, c: 2 } }, false, [ 'a.b' ]) // false
* isEqual({ a: { b: 1 } }, { a: { b: 1, c: 2 } }, true, [ 'a.b' ]) // true
*
* @param {Object} sourceData 源对象
* @param {Object} targetData 目标对象
* @param {Boolean} [deep] 是否深度比较,默认为true
* @param {Array} [fields] 指定需要比较的字段的数组
* @returns {Boolean}
*/
export declare const isEqual: (sourceData: object, targetData: object, deep?: boolean, fields?: string[]) => boolean;
export { isEachEqual, extend };
/**
* 将json对象序列化为字符串。 ----------重复实现待移除
*
* let obj = { a: 1, b: 2 }
* toJsonStr(obj) // '{"a":1,"b":2}'
* obj.prop = obj
* toJsonStr(obj) // undefined 递归引用自己了,所以catch了
* toJsonStr(null) // 'null'
*
* @param {Object} obj
* @returns {String}
*/
export declare const toJsonStr: (obj: any) => string | undefined;
/**
* 将一个或多个源对象简单合并到目标对象中,合并时排除非 OwnProperty 及 undefined 属性。
* 只处理第一层,功能基本等同于 Object.assign
*
* merge({ a: 1 }, { b: { c: 2 } }, { d: 3 }) // { a: 1, b: { c: 2 }, d: 3 }
*
* @param {Object} target 目标对象
* @param {Object} [source] 源对象
* @returns {Object}
*/
export declare const merge: (target: object, ...rest: object[]) => object;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export interface IModalStack {
id: string;
zIndex: number;
modalClass: string;
}
export declare const PopupManager: {
step: number;
zIndex: number;
globalScroll: boolean;
modalFade: boolean;
modalStack: IModalStack[];
modalDom: HTMLElement;
hasModal: boolean;
popLockClass: string;
oldBodyBorder: string;
viewportWindow: null;
fixBodyBorder(): void;
resetBodyBorder(): void;
/** 全局反注册 */
deregister: (id: string) => void;
/** 返回全局实例 */
getInstance: (id: string) => any;
/** 全局注册 仅vue-popup.ts中使用,instance就是vm, 把vm注册到 vm._popupId 这个键值上 */
register: (id: string, instance: any) => void;
nextZIndex: () => number;
/** 打开遮罩层, 仅vue-popup.ts中使用。 dom = vm.$el 或者 undefined (appendtoBody时) */
openModal(id: string, zIndex: number, dom: HTMLElement | undefined, modalClass: string, modalFade: boolean): void;
/** 点击背景遮罩层时,调用栈顶的popup,调用它的close() */
doOnModalClick: () => void;
closeModal(id: string): void;
};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export declare const addResizeListener: (el: any, fn: any) => void;
export declare const removeResizeListener: (el: any, fn: any) => void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
declare const index: any;
export default index;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export declare const scrollIntoView: (container: any, selected: any) => void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export declare function calcScrollWidth(): number;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 文本替换格式类型
*/
export declare const formatTypes: {
text: string;
url: string;
html: string;
tmpl: string;
};
/**
* 字符对应的字符编码
*/
export declare const escapeChars: {
'&': string;
'<': string;
'>': string;
'"': string;
"'": string;
'[': string;
']': string;
};
/**
* 判断是否为null、undefined、空字符串
*
* isNullOrEmpty('') // true
*
* @param {Object} value 需判断的对象
* @return {Boolean}
*/
export declare const isNullOrEmpty: (value: any) => boolean;
export declare const camelize: (str: any) => any;
/**
* 将字符串首写字母大写。
*
* capitalize('hello') // "Hello"
*
* @param {String} string 要转换的字符串
* @returns {String}
*/
export declare const capitalize: (str: any) => any;
export declare const hyphenate: (str: any) => any;
/**
* 解析Json字符串成对象。
*
* let str = '{ "value": "v1", "text": "t1" }'
* toJson(str) // { value: 'v1', text: 't1' }
*
* @param {String} string 要解析的Json字符串
* @returns {Object}
*/
export declare const toJson: (string: any) => any;
/**
* 计算字符串长度或所占的内存字节数。
* 默认计算方式(中文算两个长度,数字字母算一个),也可指定为 'basic','UTF-16','UTF-8',或自定义的计算规则。
*
* getLength('12ED') // => 4
* getLength('深圳') // => 4
* getLength('好a','basic') // '好a' => 2,'a' => 1
* getLength('好a','UTF-8') // 好a' => 4,'a' => 1
* getLength('好a','UTF-16') //'好a' => 4,'a' => 2
* getLength(str, function (str) {
* return (str + 'xx').length
* })
*
* UTF-8 是一种可变长度的 Unicode 编码格式,使用一至四个字节为每个字符编码
*
* 000000 - 00007F(128个代码) 0zzzzzzz(00-7F) 一个字节
* 000080 - 0007FF(1920个代码) 110yyyyy(C0-DF) 10zzzzzz(80-BF) 两个字节
* 000800 - 00D7FF 注: Unicode在范围 D800-DFFF 中不存在任何字符
* 00E000 - 00FFFF(61440个代码) 1110xxxx(E0-EF) 10yyyyyy 10zzzzzz 三个字节
* 010000 - 10FFFF(1048576个代码) 11110www(F0-F7) 10xxxxxx 10yyyyyy 10zzzzzz 四个字节
*
*
* 定义参考 http://zh.wikipedia.org/wiki/UTF-8
*
* UTF-16 大部分使用两个字节编码,编码超出 65535 的使用四个字节
*
* 000000 - 00FFFF 两个字节
* 010000 - 10FFFF 四个字节
*
* 定义参考 http://zh.wikipedia.org/wiki/UTF-16
*
* @param {String} string
* @param {String|Function} regular 长度规则:'basic'、'UTF-16'、'UTF-8'或自定义的计算规则函数
* @return {Number}
*/
export declare const getLength: (string: any, regular: any) => any;
/**
* 填充字符串,根据填充模式参数,在字符串前面或后面补充字附到指定的长度。
*
* fillChar('1', 3) // "001"
* fillChar('1', 3, true) // "100"
* fillChar('1', 3, true, ' ') // "1 "
*
* @param {String} string 被填充的字符串
* @param {Number} length 填充到某个长度
* @param {Boolean} [append=false] 是否在后面填充,默认为在前面填充
* @param {String} [chr="0"] 填充的字符,默认为0
* @returns {String}
*/
export declare const fillChar: (string: any, length: any, append: any, chr?: string) => string | undefined;
export declare const random: () => number;
/**
* 生成一个guid。
*
* guid('#') // #16722423
*
* @param {String} [prefix] guid前缀,可选值,默认为空字符串
* @param {Number} [length] 生成的guid的长度,可选值,默认为8
* @returns {String}
*/
export declare const guid: (prefix?: string, length?: number) => string;
/**
* 将HTML字符串进行编码。
*
* escapeHtml('<div>&&</div>') // "&#60;div&#62;&#38;&#38;&#60;/div&#62;"
*
* @param {String} string 要编码的字符串
* @param {Boolean} [isReplaceSpace] 是否替换空格
* @returns {String}
*/
export declare const escapeHtml: (string: any, isReplaceSpace: any) => any;
/**
* 将URL字符串进行转义。
*
* let str = '< >& []""' + "'"
* escape(str) // "&#60; &#62;& []&#34;&#34;'"
* escape(str, 'uri', true) // "%3C%20%3E%26%20%5B%5D%22%22'"
* escape(str, true) // "&#60;&#160;&#62;&&#160;[]&#34;&#34;'"
* escape(str, 'html', true) // "&#60;&#160;&#62;&#38;&#160;[]&#34;&#34;&#x27;"
* escape(str, 'prop', true) // "&#60;&#160;&#62;&#38;&#160;&#91;&#93;&#34;&#34;&#x27;"
*
* @param {String} string 需要转换的字符串
* @param {String} [escapeType] 转换类型,可选值:uri, html, prop
* @param {Boolean} [isReplaceSpace] 是否替换空格, 默认不替换
* @returns {String}
*/
export declare const escape: (string: any, escapeType: any, isReplaceSpace: any) => any;
/**
* 使用具体的对象字段代替字符串中的字段占位符。
*
* fieldFormat('url:{{url}}', { url: 'http://abc.com/a&b' }) // "url:http://abc.com/a&#38;b"
* fieldFormat('url:{{#url}}', { url: 'http://abc.com/a&b' }) // "url:http://abc.com/a&b"
* fieldFormat('url:{{@url}}', { url: 'http://abc.com/a&b' }) // "url:http%3A%2F%2Fabc.com%2Fa%26b"
* fieldFormat('url:{{$url}}', { url: 'http://abc.com/a&b' }) // "url:http://abc.com/a&#38;b"
* fieldFormat('url:{{%url}}', { url: 'http://abc.com/a&b' }) // "url:{{http://abc.com/a&b}}"
*
* @param {String} string 要替换的字符串模板
* @param {Object} data 要替换模板的数据
* @param {String} [type="html"] 替换的类型:"text"、"url"、"tmpl"、"html",默认"html"
* @returns {String}
*/
export declare const fieldFormat: (string: any, data: any, type?: string) => string | undefined;
/**
* 使用具体的值替换字符串中的数字占位符。
*
* format('{0}', 1) // "1"
* format('{0}', 1, 'text') // "1"
* format('{0}{1}', [1, 2, 'text']) // "12"
* format('age:{{age}}', { age: 20 }) // "age:20"
* format('\\{0\\}{1}', [0, 1]) // "{0}1"
* format('{0}', [{ age: 20 }]) // "{"age":20}"
* format('{0}', [ 'http://abc.com/a&b' ], 'url') // "http%3A%2F%2Fabc.com%2Fa%26b"
* format('{0}', [ '<div>&&</div>' ], 'html') // "&#60;div&#62;&#38;&#38;&#60;/div&#62;"
*
* @param {String} string 要替换的字符串模板
* @param {Object|Array|String} data 要替换模板的数据
* @param {String} [type="text"] 替换的类型:"text"、"url"、"html",默认"text"
* @returns {String}
*/
export declare const format: (string: any, data: any, type?: string) => any;
/**
* 将字符串按指定长度截断。
*
* truncate('abc', 5) // "abc"
* truncate('abc', 2) // "ab..."
*
* @param {String} string 要截断的字符串
* @param {Number} length 要截断的长度
* @param {String} [ellipsis="{0}..."] 截断类型,通常携带{0}占位符
* @returns {String}
*/
export declare const truncate: (string: any, length: any, ellipsis?: string) => any;
/**
* 尝试按指定函数转换字符串,如果转换结果为 NaN,则返回 defaultValue。
*
* tryToConvert(toInt, null, 0) // 0
*
* @param {Function} convert 指定的转换的函数
* @param {Number|String} defaultValue 若为 NaN 时,返回的缺省值
* @param {Number|String} value 要转换的字符串或多个参数
* @returns {Number|String}
*/
export declare const tryToConvert: (convert: any, defaultValue: any, ...args: any[]) => any;
/**
* 将字符串解析成十进制整数。
*
* toInt(100) // 100
* toInt('100.01') // 100
*
* @param {Number|String} value 要解析的字符串
* @returns {Number}
*/
export declare const toInt: (value: any) => number;
/**
* 尝试将字符串解析成十进制整数。如果 value 是个无效的整数,则返回 defaultValue。
*
* tryToInt(100) // 100
* tryToInt('100.01') // 100
* tryToInt(null, 100) // 100
*
* @param {Number|String} value 要解析的字符串
* @param {Number|String} defaultValue 若为 NaN 时,返回的缺省值
* @returns {Number|String}
*/
export declare const tryToInt: (value: any, defaultValue: any) => any;
/**
* 将字符串解析成数值。
*
* toNumber(100) // 100
* toNumber('100.01') // 100.01
*
* @param {Number|String} value 要解析的字符串
* @returns {Number}
*/
export declare const toNumber: (value: any) => any;
/**
* 尝试将字符串解析成数值。如果 value 是个无效的数字,则返回 defaultValue。
*
* tryToNumber(100) // 100
* tryToNumber('100.01') // 100.01
* tryToNumber(null, 100) // 100
*
* @param {Number|String} value 要解析的字符串
* @param {Number|String} defaultValue 若为 NaN 时,返回的缺省值
* @returns {Number|String}
*/
export declare const tryToNumber: (value: any, defaultValue: any) => any;
/**
* 将字符串解析成浮点数。
*
* toDecimal(100) // "100.00"
* toDecimal("100.01", 2) // "100.01"
* toDecimal(0.8 - 0.6, 2, true) // "0.2"
* toDecimal(0.8 - 0.6, 2, false) // "0.20"
*
* @param {Number|String} value 要解析的数字或字符串
* @param {Number} [fraction=2] 浮点数的小数部分,默认2位
* @param {Boolean} [isTruncate=false] 是否截断,默认为四舍五入,不截断
* @returns {String}
*/
export declare const toDecimal: (value: any, fraction?: number, isTruncate?: boolean) => number;
/**
* 尝试将字符串解析成浮点数。如果 value 是个无效的浮点数,则返回 defaultValue。
*
* tryToDecimal(100) // "100.00"
* tryToDecimal("100.01", 2) // "100.01"
* tryToDecimal(0.8 - 0.6, 2, true) // "0.2"
* tryToDecimal(0.8 - 0.6, 2, false) // "0.20"
* tryToDecimal(null, 2, false, 100) // 100
*
* @param {Number|String} value 要解析的数字或字符串
* @param {Number} [fraction=2] 浮点数的小数部分,默认2位
* @param {Boolean} [isTruncate=false] 是否截断,默认为四舍五入,不截断
* @param {Number|String} [defaultValue] 若为 NaN 时,返回的缺省值
* @returns {Number|String}
*/
export declare const tryToDecimal: (value: any, fraction: any, isTruncate: any, defaultValue: any) => any;
/**
* 将数字或字符串转换成货币格式。
*
* toCurrency(100) // "100.00"
* toCurrency(100, 2) // "100.00"
* toCurrency(1234.56) // "1,234.56"
* toCurrency(100, 2, '${0}') // "$100.00"
*
* @param {Number|String} value 要解析的数字或字符串
* @param {Number} [fraction=2] 浮点数的小数部分,默认2位
* @param {String} [placeholder] 货币符号,占位符格式,例如 "${0}"
* @param {Boolean} [isTruncate=false] 是否截断,默认为四舍五入,不截断
* @returns {String}
*/
export declare const toCurrency: (value: any, fraction: any, placeholder: any, isTruncate: any) => any;
/**
* 尝试将数字转换成货币格式。如果 value 是个无效的金额,则返回 defaultValue。
*
* tryToCurrency(100) // "100.00"
* tryToCurrency(100, 2) // "100.00"
* tryToCurrency(1234.56) // "1,234.56"
* tryToCurrency(100, 2, '${0}') // "$100.00"
* tryToCurrency(null, 3, '¥{0}', '金额错误') // "金额错误"
*
* @param {Number|String} value 要转换的数值
* @param {Number} [fraction=2] 浮点数的小数部分,默认2位
* @param {String} [placeholder] 货币符号,占位符格式,例如 "${0}"
* @param {Number|String} [defaultValue] 若为 NaN 时,返回的缺省值
* @returns {Number|String}
*/
export declare const tryToCurrency: (value: any, fraction: any, placeholder: any, defaultValue: any) => any;
/**
* 转换成布尔值或0(表示false),1(表示true)。
*
* toBoolValue(1) // 1
* toBoolValue(true) // true
* toBoolValue('true') // true
* toBoolValue({}) // true
* toBoolValue('') // false
*
* @param {Number|String|Boolean} value 要转换的值
* @returns {Boolean|number}
*/
export declare const toBoolValue: (value: any) => boolean | 0 | 1;
/**
* 将数值按百分比显示。
*
* toRate(0.1) // "10.00%"
* toRate(10, 100, 2) // "10.00%"
*
* @param {Number} value 要转换的值
* @param {Number} [total=1] 百分比基数,默认为1
* @param {Number} [fraction=2] 数值的小数部分,默认为2
* @returns {String}
*/
export declare const toRate: (value: any, total?: number, fraction?: number) => any;
/**
* 文件大小值 单位互相转换。
*
* toFileSize(1024) // "1.00KB"
* toFileSize(1024, 'B') // "1024.00B"
* toFileSize(1024, 'KB', 'B') // "1.00KB"
* toFileSize(1024, 'MB', 'KB') // "1.00MB"
*
* @param {Number} value 文件大小数值
* @param {String} unit 转换后的单位
* @param {String} [currUnit] 当前大小单位,默认为B,值可为B、KB、MB、GB、TB、PB、EB、ZB、YB
* @returns {String}
*/
export declare const toFileSize: (value: any, unit: any, currUnit: any) => any;
/**
* 文件大小值,单位自动转化,最多保留2位小数
*
* formatFileSize(17252 * 1024) // "16.84M"
* formatFileSize(200 * 1024, 'M') // "200G"
*
* @param {Number} size 文件大小数值
* @param {String} [baseUnit] 当前大小单位,默认为 B,值可为 B、K、M、G、T、P、E、Z、Y
* @returns {String} 转化后的文件大小和单位
*/
export declare const formatFileSize: (size: any, baseUnit?: string) => string;
/**
* 检查文本中是否包含韩文
* @param {String} text
*/
export declare const isKorean: (text: any) => boolean;
/**
* 对字符串进行省略截取
* @param {*} text 待处理的字符串
* @param {*} font 字符集,例如 '14px Arial'
* @param {*} w 字符串显示最大长度
* @returns obj obj.t为处理后字符串,obj.o为是否已省略标志
*/
export declare const omitText: (text: string, font: string, w: number) => {
t: string;
o: boolean;
};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* Throttle execution of a function. Especially useful for rate limiting
* execution of handlers on events like resize and scroll.
*
* @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks,
* values around 100 or 250 (or even higher) are most useful.
* @param {Boolean} [noTrailing] Optional, defaults to false. If noTrailing is true,
* callback will only execute every `delay` milliseconds while the
* throttled-function is being called. If noTrailing is false or unspecified,
* callback will be executed one final time
* after the last throttled-function call.
* (After the throttled-function has not been called for `delay` milliseconds,
* the internal counter is reset)
* @param {Function} callback A function to be executed after delay milliseconds.
* The `this` context and all arguments are passed through, as-is,
* to `callback` when the throttled-function is executed.
* @param {Boolean} [debounceMode] If `debounceMode` is true (at begin),
* schedule `clear` to execute after `delay` ms.
* If `debounceMode` is false (at end),
* schedule `callback` to execute after `delay` ms.
*
* @return {Function} A new, throttled, function.
*/
export declare function throttle(delay: any, noTrailing: any, callback: any, debounceMode?: string): Function;
export declare const emulate: () => void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export declare const getDirection: (x: any, y: any) => "" | "horizontal" | "vertical";
export declare const touchStart: (state: any) => (event: any) => void;
export declare const touchMove: (state: any) => (event: any) => void;
export declare const resetTouchStatus: (state: any) => void;
export { NODE_KEY, getNodeKey, markNodeData } from './util';
export { getChildState, Node } from './node';
export { TreeStore } from './tree-store';
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export declare const getChildState: (node: any) => {
all: boolean;
none: boolean;
allWithoutDisable: boolean;
half: boolean;
};
export declare class Node {
constructor(options: any);
initExpandState(): void;
init(options: any): void;
expandByDefaultKeys(): void;
setData(data: any): void;
get key(): any;
get label(): any;
get disabled(): any;
get nextSibling(): any;
get previousSibling(): any;
remove(): void;
contains(target: any, deep?: boolean): boolean;
insertChild(child: any, index?: any, batch?: any): any;
insertBefore(child: any, beforeNode: any): void;
insertAfter(child: any, afterNode: any): void;
removeChild(child: any): void;
removeChildByData(data: any): void;
expand(callback: any, expandParent: any): void;
doCreateChildren(array: any, defaultProps?: {}): void;
collapse(): void;
shouldLoadData(): any;
updateLeafState(): void;
getChildren(forceInit?: boolean): any;
setChecked(value: any, isDeepChecked: any, recursion: any, passValue: any, checkEasily: any): void;
setCheckedInner({ checkDescendants, value, isDeepChecked, passValue, checkEasily }: {
checkDescendants: any;
value: any;
isDeepChecked: any;
passValue: any;
checkEasily: any;
}): {
value: any;
passValue: any;
returnFlag: boolean;
};
updateChildren(): void;
loadData(callback: any, defaultProps?: {}): void;
getPathData(key: any): any[];
getPathText(key: any, separator?: string): string;
}
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export declare class TreeStore {
constructor(options: any);
getMappingData(data: any): any;
filter(value: any): void;
setData(newVal: any): void;
getNode(data: any): any;
insertBefore(data: any, insertData: any): void;
insertAfter(data: any, insertData: any): void;
remove(data: any, isSaveChildNode: any, isNode: any): void;
append(data: any, parentData: any, index: any): void;
setDefaultCheckedKey(newValue: any): void;
_initDefaultCheckedNodes(): void;
_initDefaultCheckedNode(node: any): void;
getCheckedKeys(leafOnly?: boolean): never[];
getHalfCheckedKeys(): never[];
deregisterNode(node: any): void;
registerNode(node: any): void;
getCheckedNodes(leafOnly?: boolean, includeHalfChecked?: boolean, isNode?: boolean): never[];
getHalfCheckedNodes(): never[];
_getAllNodes(): never[];
updateChildren(key: any, data: any): void;
_setCheckedKeys(key: any, leafOnly?: boolean, checkedKeys?: {}): void;
setDefaultExpandedKeys(keys: any): void;
setCheckedKeys(keys: any, leafOnly?: boolean): void;
setCheckedNodes(array: any, leafOnly?: boolean): void;
setChecked(data: any, checked: any, deep: any): void;
setCurrentNode(currentNode: any): void;
getCurrentNode(): any;
setCurrentNodeKey(key: any): void;
setUserCurrentNode(node: any): void;
getData(data: any): any;
getAllData(): any;
}
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export declare const NODE_KEY = "$treeNodeId";
export declare const getNodeKey: (key: any, data: any) => any;
export declare const markNodeData: (node: any, data: any) => void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 获取对象的字符串表示形式
* 用于类型判断,等同于 Object.prototype.toString
*/
export declare const toString: () => string;
/**
* 检查对象是否具有指定的属性
* 等同于 Object.prototype.hasOwnProperty
*/
export declare const hasOwn: (prop: PropertyKey) => boolean;
/**
* 判断值是否为 null 或 undefined
*
* @param {any} x - 要检查的值
* @returns {boolean} - 如果值为null或undefined则返回true,否则返回false
*
* @example
* isNull(null) // true
* isNull(undefined) // true
* isNull(0) // false
* isNull('') // false
*/
export declare const isNull: (x: any) => boolean;
/**
* 返回 JavaScript 对象的类型。
*
* 如果对象是 undefined 或 null,则返回相应的'undefined'或'null'。
* 其他一切都将返回它的类型字符串表示。
*
* @param {any} obj - 要检查类型的对象
* @returns {string} - 类型的字符串表示
*
* @example
* typeOf(undefined) // 'undefined'
* typeOf(null) // 'null'
* typeOf(true) // 'boolean'
* typeOf(3) // 'number'
* typeOf("test") // 'string'
* typeOf(function(){}) // 'function'
* typeOf([]) // 'array'
* typeOf(new Date()) // 'date'
* typeOf(new Error()) // 'error'
* typeOf(/test/) // 'regExp'
* typeOf({}) // 'object'
*/
export declare const typeOf: (obj: any) => string;
/**
* 判断对象是否为纯粹的对象类型(通过{}或new Object创建的对象)
*
* @param {any} obj - 要检查的对象
* @returns {boolean} - 如果是纯粹的对象类型则返回true,否则返回false
*
* @example
* isObject({}) // true
* isObject(new Object()) // true
* isObject([]) // false
* isObject(null) // false
*/
export declare const isObject: (obj: any) => boolean;
/**
* 判断对象是否为函数类型(包括普通函数和异步函数)
*
* @param {any} fn - 要检查的对象
* @returns {boolean} - 如果是函数类型则返回true,否则返回false
*
* @example
* isFunction(function(){}) // true
* isFunction(async function(){}) // true
* isFunction(() => {}) // true
* isFunction({}) // false
*/
export declare const isFunction: (fn: any) => boolean;
/**
* 判断对象是否为简单对象(纯粹的对象)
*
* 即不是 HTML 节点对象,也不是 window 对象,而是纯粹的对象
* (通过 '{}' 或者 'new Object' 创建的,或者原型为null的对象)
*
* @param {any} obj - 要检查的对象
* @returns {boolean} - 如果是简单对象则返回true,否则返回false
*
* @example
* isPlainObject({}) // true
* isPlainObject(new Object()) // true
* isPlainObject(Object.create(null)) // true
* isPlainObject([]) // false
* isPlainObject(new Date()) // false
*/
export declare const isPlainObject: (obj: any) => boolean;
/**
* 检查对象是否为空(不包含任何属性)
*
* 对于对象和数组,检查是否有自有属性
* 对于其他类型,直接返回true
*
* @param {any} obj - 要检查的对象
* @returns {boolean} - 如果对象为空则返回true,否则返回false
*
* @example
* isEmptyObject({}) // true
* isEmptyObject([]) // true
* isEmptyObject({a: 1}) // false
* isEmptyObject([1, 2]) // false
*/
export declare const isEmptyObject: (obj: any) => boolean;
/**
* 判断对象是否为数字类型(有限数字)
*
* 注意:NaN和Infinity不被视为有效数字
*
* @param {any} value - 要检查的值
* @returns {boolean} - 如果是有效数字则返回true,否则返回false
*
* @example
* isNumber(369) // true
* isNumber(0) // true
* isNumber(-1.5) // true
* isNumber(NaN) // false
* isNumber(Infinity) // false
* isNumber('123') // false
*/
export declare const isNumber: (value: any) => boolean;
/**
* 判断对象是否代表一个数值(可以是数字类型或可转换为数字的字符串)
*
* @param {any} value - 要检查的值
* @returns {boolean} - 如果是数值则返回true,否则返回false
*
* @example
* isNumeric('-10') // true
* isNumeric(16) // true
* isNumeric(0xFF) // true
* isNumeric('0xFF') // true
* isNumeric('8e5') // true
* isNumeric(3.1415) // true
* isNumeric(+10) // true
* isNumeric('') // false
* isNumeric({}) // false
* isNumeric(NaN) // false
* isNumeric(null) // false
* isNumeric(true) // false
* isNumeric(Infinity) // false
* isNumeric(undefined) // false
*/
export declare const isNumeric: (value: any) => boolean;
/**
* 判断对象是否为日期类型
*
* @param {any} value - 要检查的值
* @returns {boolean} - 如果是日期类型则返回true,否则返回false
*
* @example
* isDate(new Date()) // true
* isDate(Date.now()) // false
* isDate('2023-01-01') // false
*/
export declare const isDate: (value: any) => boolean;
/**
* 判断两个值是否值相同且类型相同
*
* 特别处理了NaN的情况,在JavaScript中NaN !== NaN,但在此函数中认为它们相同
*
* @param {any} x - 第一个值
* @param {any} y - 第二个值
* @returns {boolean} - 如果两个值相同则返回true,否则返回false
*
* @example
* isSame(1, 1) // true
* isSame(NaN, NaN) // true
* isSame('a', 'a') // true
* isSame({}, {}) // false (引用不同)
* isSame(1, '1') // false (类型不同)
*/
export declare const isSame: (x: any, y: any) => boolean;
/**
* 判断值是否是正则表达式
*
* @param {any} value - 要检查的值
* @returns {boolean} - 如果是正则表达式则返回true,否则返回false
*
* @example
* isRegExp(/test/) // true
* isRegExp(new RegExp('test')) // true
* isRegExp('/test/') // false (这是字符串)
*/
export declare const isRegExp: (value: any) => boolean;
/**
* 判断值是否是Promise对象或类Promise对象
*
* 类Promise对象需要有then和catch方法
*
* @param {any} val - 要检查的值
* @returns {boolean} - 如果是Promise对象则返回true,否则返回false
*
* @example
* isPromise(Promise.resolve()) // true
* isPromise(new Promise(() => {})) // true
* isPromise({then: () => {}, catch: () => {}}) // true
* isPromise({then: () => {}}) // false (缺少catch方法)
*/
export declare const isPromise: (val: any) => boolean;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export declare const uploadAjax: (option: any) => XMLHttpRequest | undefined;
import { default as Schema } from './schema';
export declare const Validator: typeof Schema;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
declare const _default: (translate?: (value: any) => any) => {
default: any;
required: any;
enum: any;
whitespace: any;
date: {
format: any;
parse: any;
invalid: any;
};
types: {
string: any;
method: any;
array: any;
object: any;
number: any;
date: any;
boolean: any;
integer: any;
float: any;
regexp: any;
email: any;
url: any;
hex: any;
digits: any;
time: any;
dateYM: any;
dateYMD: any;
dateTime: any;
longDateTime: any;
version: any;
speczh: any;
specialch: any;
specialch2: any;
acceptImg: any;
acceptFile: any;
fileSize: any;
};
string: {
len: any;
min: any;
max: any;
range: any;
};
number: {
len: any;
min: any;
max: any;
range: any;
};
array: {
len: any;
min: any;
max: any;
range: any;
};
pattern: {
mismatch: any;
};
};
export default _default;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export default function (rule: any, checkValue: any, source: any, errors: any, options: any): void;
import { default as type } from './type';
import { default as range } from './range';
import { default as enumRule } from './enum';
import { default as pattern } from './pattern';
import { default as required } from './required';
import { default as whitespace } from './whitespace';
declare const _default: {
type: typeof type;
range: typeof range;
pattern: typeof pattern;
required: typeof required;
whitespace: typeof whitespace;
enum: typeof enumRule;
};
export default _default;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export default function (rule: any, checkValue: any, source: any, errors: any, options: any): void;
export default function (rule: any, checkValue: any, source: any, errors: any, options: any): false | undefined;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
interface RequiredType {
rule: any;
checkValue?: any;
source: any;
errors: any;
options: any;
type?: any;
}
export default function ({ rule, checkValue, source, errors, options, type }: RequiredType): void;
export {};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export default function (rule: any, value: any, source: any, errors: any, options: any): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export default function (rule: any, checkValue: any, source: any, errors: any, options: any): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
declare function Schema(descriptor: any, translate?: any): void;
declare namespace Schema {
var register: (type: any, validator: any) => void;
var validators: any;
var warning: () => undefined;
var messages: any;
var systemMessages: any;
var getDefaultMessage: () => undefined;
var getSystemMessage: () => undefined;
}
export default Schema;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* @description 警告函数(当前未实现)
* @returns undefined
*/
export declare const warning: () => undefined;
/**
* @description 转换返回错误的数据结构,将错误数组转换为按字段分组的对象
* @param errors 错误数组
* @returns 按字段分组的错误对象或null
*/
export declare function convertFieldsError(errors: Array<{
field: string;
[key: string]: any;
}> | null | undefined): Record<string, any[]> | null;
/**
* @description 生成校验错误的提示信息,支持格式化占位符
* @param i18nTemplate 带占位符的字符串或函数
* @param rest 替换占位符的字符串参数
* @returns 格式化后的字符串
* 例:format('%s 必须等于 %s', 'A', 'B') 返回 A 必须等于 B
*/
export declare function format(i18nTemplate: Function | string, ...rest: string[]): string;
/**
* @description 判断对应的类型是否是空值
* @param data 要检查的数据
* @param dataType 数据类型
* @returns 是否为空值
*/
export declare function isEmptyValue(data: any, dataType?: string): boolean;
/**
* @description 判断对象是否为空
* @param data 要检查的对象
* @returns 对象是否为空
*/
export declare function isEmptyObject(data: Record<string, any>): boolean;
/**
* @description 异步映射处理对象数组,支持串行或并行处理
* @param objArray 对象数组
* @param option 选项配置
* @param func 处理函数
* @param callback 完成回调
* @returns Promise对象
*/
export declare function asyncMap(objArray: Record<string, any[]>, option: {
first?: boolean;
firstFields?: boolean | string[];
}, func: (rule: any, callback: (errors: any[]) => void) => void, callback: (errors: any[]) => void): Promise<void>;
/**
* @description 处理返回的错误,补充错误信息
* @param rule 规则对象
* @returns 处理函数
*/
export declare function complementError(rule: {
fullField?: string;
[key: string]: any;
}): (onError: string | Function | {
message?: string;
field?: string;
}) => {
message: string;
field: string;
};
/**
* @description 深度合并对象
* @param target 目标对象
* @param sources 源对象
* @returns 合并后的对象
*/
export declare function deepMerge(target: Record<string, any>, sources: Record<string, any>): Record<string, any>;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export {};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export {};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
export {};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 数组验证函数
*
* @description 验证目标值是否符合数组规则要求,支持必填验证、类型验证和范围验证
* @param rule - 验证规则对象,包含验证条件
* @param checkValue - 需要验证的值
* @param callback - 验证完成后的回调函数
* @param source - 验证源对象,包含所有需要验证的字段
* @param options - 验证选项配置
* @returns void
*/
export default function arrayValidation(rule: {
required?: boolean;
field: string;
type?: string;
min?: number;
max?: number;
[key: string]: any;
}, checkValue: any, callback: (errors?: any[]) => void, source: Record<string, any>, options: Record<string, any>): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 日期验证函数
*
* @description 验证字段值是否为有效的日期格式,支持日期对象和日期字符串
* @param rule - 验证规则对象
* @param checkValue - 待验证的值
* @param callback - 验证完成后的回调函数
* @param source - 包含所有字段的源对象
* @param options - 验证选项
*/
export default function dateValidator(rule: {
required?: boolean;
field: string;
type?: string;
min?: number;
max?: number;
[key: string]: any;
}, checkValue: any, callback: (errors?: any[]) => void, source: Record<string, any>, options: Record<string, any>): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 枚举验证函数
*
* @description 验证值是否在指定的枚举范围内
* @param rule - 验证规则对象,包含验证的字段和验证选项
* @param checkValue - 需要验证的值
* @param callback - 回调函数,用于返回验证结果
* @param source - 数据源对象
* @param options - 验证选项
*/
export default function (rule: {
field: string;
required?: boolean;
enum?: any[];
[key: string]: any;
}, checkValue: any, callback: (errors?: any[]) => void, source: Record<string, any>, options: {
messages: Record<string, any>;
[key: string]: any;
}): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 浮点数验证函数
*
* @description 验证字段是否为有效的浮点数,并检查其范围
* @param rule 验证规则对象,包含验证条件如required、type和范围限制
* @param checkValue 需要验证的值
* @param cb 回调函数,用于返回验证结果
* @param source 包含所有字段的源对象
* @param options 验证选项
*/
export default function float(rule: {
required?: boolean;
field: string;
type?: string;
min?: number;
max?: number;
[key: string]: any;
}, checkValue: any, cb: (errors?: any[]) => void, source: Record<string, any>, options?: Record<string, any>): void;
import { default as date } from './date';
import { default as type } from './type';
import { default as float } from './float';
import { default as array } from './array';
import { default as string } from './string';
import { default as method } from './method';
import { default as number } from './number';
import { default as integer } from './integer';
import { default as pattern } from './pattern';
import { default as required } from './required';
import { default as enumValidator } from './enum';
declare const _default: {
date: typeof date;
float: typeof float;
array: typeof array;
string: typeof string;
method: typeof method;
number: typeof number;
integer: typeof integer;
pattern: typeof pattern;
required: typeof required;
hex: typeof type;
url: typeof type;
time: typeof type;
email: typeof type;
digits: typeof type;
dateYM: typeof type;
speczh: typeof type;
dateYMD: typeof type;
version: typeof type;
fileSize: typeof type;
regexp: typeof method;
object: typeof method;
dateTime: typeof type;
specialch: typeof type;
boolean: typeof method;
acceptImg: typeof type;
specialch2: typeof type;
acceptFile: typeof type;
longDateTime: typeof type;
enum: typeof enumValidator;
};
export default _default;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 整数验证函数,用于验证输入值是否符合整数规则
*
* @param rule - 验证规则对象,包含验证所需的各种属性
* @param checkValue - 待验证的值
* @param callback - 回调函数,用于返回验证结果
* @param source - 包含所有字段值的源对象
* @param options - 验证选项
*
* 验证流程:
* 1. 如果字段未提供且非必填,则验证通过
* 2. 检查是否满足必填规则
* 3. 检查值的类型是否为整数
* 4. 检查值是否在指定范围内
*/
export default function (rule: {
required?: boolean;
field: string;
type?: string;
min?: number;
max?: number;
[key: string]: any;
}, checkValue: any, callback: (errors?: any[]) => void, source: Record<string, any>, options: Record<string, any>): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
interface ValidationRule {
required?: boolean;
field: string;
type?: string;
}
interface ValidationSource {
[key: string]: any;
}
interface ValidationOptions {
[key: string]: any;
}
type ValidationCallback = (errors: string[]) => void;
/**
* 验证方法的主函数
* @param rule - 验证规则对象
* @param checkValue - 需要验证的值
* @param callback - 验证完成后的回调函数
* @param source - 包含所有字段值的源对象
* @param options - 验证选项
*/
export default function validate(rule: ValidationRule, checkValue: any, callback: ValidationCallback, source: ValidationSource, options: ValidationOptions): void;
export {};
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 数字类型验证函数
*
* @description 用于验证数字类型字段是否符合规则,包括必填、类型和范围验证
* @param rule - 验证规则对象
* @param checkValue - 需要验证的值
* @param callback - 验证完成后的回调函数,传入错误数组
* @param source - 包含所有字段的源对象
* @param options - 验证选项
* @returns void
*/
export default function (rule: {
required?: boolean;
field: string;
type?: string;
min?: number;
max?: number;
[key: string]: any;
}, checkValue: any, callback: (errors?: any[]) => void, source: Record<string, any>, options?: Record<string, any>): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 模式校验函数
*
* @description 根据规则验证值是否匹配指定的模式(正则表达式)
* @param rule 校验规则对象,包含校验字段和条件
* @param checkValue 需要校验的值
* @param callback 校验完成后的回调函数
* @param source 包含校验字段的源对象
* @param options 校验选项
* @returns void
*/
export default function pattern(rule: {
field: string;
required?: boolean;
pattern?: RegExp | string;
[key: string]: any;
}, checkValue: any, callback: (errors?: any[]) => void, source: Record<string, any>, options: {
messages: Record<string, any>;
[key: string]: any;
}): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 必填验证函数
*
* 检查字段是否满足必填要求。根据值的类型(数组或其他类型)应用相应的验证规则,
* 并将验证结果通过回调函数返回。
*
* @param rule - 验证规则对象
* @param checkValue - 需要验证的值
* @param callback - 回调函数,用于返回验证错误
* @param source - 包含所有字段的源对象
* @param options - 验证选项,包括错误消息等配置
*/
export default function (rule: Record<string, any>, checkValue: any, callback: (errors: any[]) => void, source: Record<string, any>, options: Record<string, any>): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 字符串验证函数
*
* @description 根据规则验证字符串类型的值是否合法,支持必填验证、类型验证、范围验证、模式匹配和空白字符验证
* @param rule - 验证规则对象,包含验证条件
* @param checkValue - 需要验证的值
* @param callback - 验证完成后的回调函数
* @param source - 验证源对象,包含所有需要验证的字段
* @param options - 验证选项配置
* @returns void
*/
export default function stringValidation(rule: {
required?: boolean;
field: string;
type?: string;
pattern?: RegExp | string;
whitespace?: boolean;
min?: number;
max?: number;
[key: string]: any;
}, checkValue: any, callback: (errors?: any[]) => void, source: Record<string, any>, options: Record<string, any>): void;
/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/
/**
* 类型验证函数
*
* 根据规则验证数据类型,如果数据为空且非必填则直接通过,否则进行类型校验
*
* @param rule - 验证规则对象,包含类型、是否必填等信息
* @param checkValue - 需要验证的值
* @param callback - 回调函数,用于返回验证结果
* @param source - 源数据对象
* @param options - 验证选项配置
*/
export default function (rule: {
type: string;
required?: boolean;
field: string;
[key: string]: any;
}, checkValue: any, callback: (errors?: any[]) => void, source: Record<string, any>, options: Record<string, any>): void;
export declare const getXssOption: () => object;
export declare const setXssOption: (option: any) => void;
export declare const setFilterHtml: (filter: (content: string) => string) => void;
export declare const setFilterAttrs: (filter: (content: string) => string) => void;
export declare const setFilterUrl: (filter: (content: any) => any) => void;
declare const _default: {
getXssOption: () => object;
setXssOption: (option: any) => void;
filterHtml: (content: string) => string;
setFilterHtml: (filter: (content: string) => string) => void;
filterAttrs: (content: string) => string;
setFilterAttrs: (filter: (content: string) => string) => void;
filterUrl: (content: string) => string;
setFilterUrl: (filter: (content: any) => any) => void;
};
export default _default;
+11
-6
{
"name": "@opentiny/utils",
"version": "1.0.0",
"type": "module",
"version": "3.22.0",
"description": "nanoid console xss",

@@ -11,3 +12,3 @@ "author": "",

},
"main": "dist/opentiny-utils.es.js",
"main": "dist/index.es.js",
"files": [

@@ -20,9 +21,13 @@ "dist"

"devDependencies": {
"typescript": "^5.2.2",
"vite": "^6.0.0"
"typescript": "~5.3.3",
"vite": "^6.0.0",
"vite-plugin-dts": "~4.3.0",
"vitest": "^3.0.8"
},
"scripts": {
"build": "vite build",
"pub": "pnpm publish --no-git-checks --access=public"
}
"pub": "pnpm publish --no-git-checks --access=public",
"test": "vitest"
},
"types": "dist/index.d.ts"
}

@@ -1,1 +0,5 @@

# @opentiny/utils
## 安装
```bash
npm install --save @opentiny/utils
```
var He = Object.defineProperty;
var Xe = (e, r, t) => r in e ? He(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
var b = (e, r, t) => (Xe(e, typeof r != "symbol" ? r + "" : r, t), t);
const Y = () => typeof window < "u" && typeof document < "u" && window.document === document, j = () => Y() ? window : global, je = j(), Ne = "tcirzywvqlkjhgfbZQG_FLOWHSUBDNIMYREVKCAJxp57XP043891T62-modnaesu", pe = Ne.split("").reverse().join("");
let T, L;
const Ge = (e) => new Uint8Array(new ArrayBuffer(e)), se = (e) => je.crypto.getRandomValues(e), he = (e) => {
!T || T.length < e ? (T = Ge(e * 128), se(T), L = 0) : L + e > T.length && (se(T), L = 0), L += e;
}, Me = (e = 21) => {
he(e -= 0);
let r = "";
for (let t = L - e; t < L; t++)
r += pe[T[t] & 63];
return r;
}, qe = (e) => (he(e -= 0), T.subarray(L - e, L)), Qe = (e, r, t) => {
const s = (2 << 31 - Math.clz32(e.length - 1 | 1)) - 1, a = Math.ceil(1.6 * s * r / e.length);
return (n = r) => {
let o = "";
for (; ; ) {
const i = t(a);
let l = a;
for (; l--; )
if (o += e[i[l] & s] || "", o.length === n)
return o;
}
};
}, Ze = (e, r = 21) => Qe(e, r, qe);
function Je(e) {
return Y() && (e.document.all || e.document.documentMode) && !e.crypto && e.msCrypto;
}
function Ke(e) {
if (Je(e)) {
e.crypto = e.msCrypto;
const r = e.crypto.getRandomValues;
e.crypto.getRandomValues = function(t) {
const s = r.call(e.crypto, t), a = [];
for (let n = 0; n < t.length; n++)
a[n] = s[n];
return a;
};
}
}
const Q = j();
Ke(Q);
const Ye = 4294967296, et = pe, tt = Me, rt = Ze, st = () => Y() ? Q.crypto.getRandomValues(new Q.Uint32Array(1))[0] / Ye : 0, ae = {
urlAlphabet: et,
nanoid: tt,
customAlphabet: rt
}, ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
api: ae,
default: ae,
random: st
}, Symbol.toStringTag, { value: "Module" }));
var Z = { exports: {} }, p = {}, J = { exports: {} }, I = {};
function me() {
var e = {};
return e["align-content"] = !1, e["align-items"] = !1, e["align-self"] = !1, e["alignment-adjust"] = !1, e["alignment-baseline"] = !1, e.all = !1, e["anchor-point"] = !1, e.animation = !1, e["animation-delay"] = !1, e["animation-direction"] = !1, e["animation-duration"] = !1, e["animation-fill-mode"] = !1, e["animation-iteration-count"] = !1, e["animation-name"] = !1, e["animation-play-state"] = !1, e["animation-timing-function"] = !1, e.azimuth = !1, e["backface-visibility"] = !1, e.background = !0, e["background-attachment"] = !0, e["background-clip"] = !0, e["background-color"] = !0, e["background-image"] = !0, e["background-origin"] = !0, e["background-position"] = !0, e["background-repeat"] = !0, e["background-size"] = !0, e["baseline-shift"] = !1, e.binding = !1, e.bleed = !1, e["bookmark-label"] = !1, e["bookmark-level"] = !1, e["bookmark-state"] = !1, e.border = !0, e["border-bottom"] = !0, e["border-bottom-color"] = !0, e["border-bottom-left-radius"] = !0, e["border-bottom-right-radius"] = !0, e["border-bottom-style"] = !0, e["border-bottom-width"] = !0, e["border-collapse"] = !0, e["border-color"] = !0, e["border-image"] = !0, e["border-image-outset"] = !0, e["border-image-repeat"] = !0, e["border-image-slice"] = !0, e["border-image-source"] = !0, e["border-image-width"] = !0, e["border-left"] = !0, e["border-left-color"] = !0, e["border-left-style"] = !0, e["border-left-width"] = !0, e["border-radius"] = !0, e["border-right"] = !0, e["border-right-color"] = !0, e["border-right-style"] = !0, e["border-right-width"] = !0, e["border-spacing"] = !0, e["border-style"] = !0, e["border-top"] = !0, e["border-top-color"] = !0, e["border-top-left-radius"] = !0, e["border-top-right-radius"] = !0, e["border-top-style"] = !0, e["border-top-width"] = !0, e["border-width"] = !0, e.bottom = !1, e["box-decoration-break"] = !0, e["box-shadow"] = !0, e["box-sizing"] = !0, e["box-snap"] = !0, e["box-suppress"] = !0, e["break-after"] = !0, e["break-before"] = !0, e["break-inside"] = !0, e["caption-side"] = !1, e.chains = !1, e.clear = !0, e.clip = !1, e["clip-path"] = !1, e["clip-rule"] = !1, e.color = !0, e["color-interpolation-filters"] = !0, e["column-count"] = !1, e["column-fill"] = !1, e["column-gap"] = !1, e["column-rule"] = !1, e["column-rule-color"] = !1, e["column-rule-style"] = !1, e["column-rule-width"] = !1, e["column-span"] = !1, e["column-width"] = !1, e.columns = !1, e.contain = !1, e.content = !1, e["counter-increment"] = !1, e["counter-reset"] = !1, e["counter-set"] = !1, e.crop = !1, e.cue = !1, e["cue-after"] = !1, e["cue-before"] = !1, e.cursor = !1, e.direction = !1, e.display = !0, e["display-inside"] = !0, e["display-list"] = !0, e["display-outside"] = !0, e["dominant-baseline"] = !1, e.elevation = !1, e["empty-cells"] = !1, e.filter = !1, e.flex = !1, e["flex-basis"] = !1, e["flex-direction"] = !1, e["flex-flow"] = !1, e["flex-grow"] = !1, e["flex-shrink"] = !1, e["flex-wrap"] = !1, e.float = !1, e["float-offset"] = !1, e["flood-color"] = !1, e["flood-opacity"] = !1, e["flow-from"] = !1, e["flow-into"] = !1, e.font = !0, e["font-family"] = !0, e["font-feature-settings"] = !0, e["font-kerning"] = !0, e["font-language-override"] = !0, e["font-size"] = !0, e["font-size-adjust"] = !0, e["font-stretch"] = !0, e["font-style"] = !0, e["font-synthesis"] = !0, e["font-variant"] = !0, e["font-variant-alternates"] = !0, e["font-variant-caps"] = !0, e["font-variant-east-asian"] = !0, e["font-variant-ligatures"] = !0, e["font-variant-numeric"] = !0, e["font-variant-position"] = !0, e["font-weight"] = !0, e.grid = !1, e["grid-area"] = !1, e["grid-auto-columns"] = !1, e["grid-auto-flow"] = !1, e["grid-auto-rows"] = !1, e["grid-column"] = !1, e["grid-column-end"] = !1, e["grid-column-start"] = !1, e["grid-row"] = !1, e["grid-row-end"] = !1, e["grid-row-start"] = !1, e["grid-template"] = !1, e["grid-template-areas"] = !1, e["grid-template-columns"] = !1, e["grid-template-rows"] = !1, e["hanging-punctuation"] = !1, e.height = !0, e.hyphens = !1, e.icon = !1, e["image-orientation"] = !1, e["image-resolution"] = !1, e["ime-mode"] = !1, e["initial-letters"] = !1, e["inline-box-align"] = !1, e["justify-content"] = !1, e["justify-items"] = !1, e["justify-self"] = !1, e.left = !1, e["letter-spacing"] = !0, e["lighting-color"] = !0, e["line-box-contain"] = !1, e["line-break"] = !1, e["line-grid"] = !1, e["line-height"] = !1, e["line-snap"] = !1, e["line-stacking"] = !1, e["line-stacking-ruby"] = !1, e["line-stacking-shift"] = !1, e["line-stacking-strategy"] = !1, e["list-style"] = !0, e["list-style-image"] = !0, e["list-style-position"] = !0, e["list-style-type"] = !0, e.margin = !0, e["margin-bottom"] = !0, e["margin-left"] = !0, e["margin-right"] = !0, e["margin-top"] = !0, e["marker-offset"] = !1, e["marker-side"] = !1, e.marks = !1, e.mask = !1, e["mask-box"] = !1, e["mask-box-outset"] = !1, e["mask-box-repeat"] = !1, e["mask-box-slice"] = !1, e["mask-box-source"] = !1, e["mask-box-width"] = !1, e["mask-clip"] = !1, e["mask-image"] = !1, e["mask-origin"] = !1, e["mask-position"] = !1, e["mask-repeat"] = !1, e["mask-size"] = !1, e["mask-source-type"] = !1, e["mask-type"] = !1, e["max-height"] = !0, e["max-lines"] = !1, e["max-width"] = !0, e["min-height"] = !0, e["min-width"] = !0, e["move-to"] = !1, e["nav-down"] = !1, e["nav-index"] = !1, e["nav-left"] = !1, e["nav-right"] = !1, e["nav-up"] = !1, e["object-fit"] = !1, e["object-position"] = !1, e.opacity = !1, e.order = !1, e.orphans = !1, e.outline = !1, e["outline-color"] = !1, e["outline-offset"] = !1, e["outline-style"] = !1, e["outline-width"] = !1, e.overflow = !1, e["overflow-wrap"] = !1, e["overflow-x"] = !1, e["overflow-y"] = !1, e.padding = !0, e["padding-bottom"] = !0, e["padding-left"] = !0, e["padding-right"] = !0, e["padding-top"] = !0, e.page = !1, e["page-break-after"] = !1, e["page-break-before"] = !1, e["page-break-inside"] = !1, e["page-policy"] = !1, e.pause = !1, e["pause-after"] = !1, e["pause-before"] = !1, e.perspective = !1, e["perspective-origin"] = !1, e.pitch = !1, e["pitch-range"] = !1, e["play-during"] = !1, e.position = !1, e["presentation-level"] = !1, e.quotes = !1, e["region-fragment"] = !1, e.resize = !1, e.rest = !1, e["rest-after"] = !1, e["rest-before"] = !1, e.richness = !1, e.right = !1, e.rotation = !1, e["rotation-point"] = !1, e["ruby-align"] = !1, e["ruby-merge"] = !1, e["ruby-position"] = !1, e["shape-image-threshold"] = !1, e["shape-outside"] = !1, e["shape-margin"] = !1, e.size = !1, e.speak = !1, e["speak-as"] = !1, e["speak-header"] = !1, e["speak-numeral"] = !1, e["speak-punctuation"] = !1, e["speech-rate"] = !1, e.stress = !1, e["string-set"] = !1, e["tab-size"] = !1, e["table-layout"] = !1, e["text-align"] = !0, e["text-align-last"] = !0, e["text-combine-upright"] = !0, e["text-decoration"] = !0, e["text-decoration-color"] = !0, e["text-decoration-line"] = !0, e["text-decoration-skip"] = !0, e["text-decoration-style"] = !0, e["text-emphasis"] = !0, e["text-emphasis-color"] = !0, e["text-emphasis-position"] = !0, e["text-emphasis-style"] = !0, e["text-height"] = !0, e["text-indent"] = !0, e["text-justify"] = !0, e["text-orientation"] = !0, e["text-overflow"] = !0, e["text-shadow"] = !0, e["text-space-collapse"] = !0, e["text-transform"] = !0, e["text-underline-position"] = !0, e["text-wrap"] = !0, e.top = !1, e.transform = !1, e["transform-origin"] = !1, e["transform-style"] = !1, e.transition = !1, e["transition-delay"] = !1, e["transition-duration"] = !1, e["transition-property"] = !1, e["transition-timing-function"] = !1, e["unicode-bidi"] = !1, e["vertical-align"] = !1, e.visibility = !1, e["voice-balance"] = !1, e["voice-duration"] = !1, e["voice-family"] = !1, e["voice-pitch"] = !1, e["voice-range"] = !1, e["voice-rate"] = !1, e["voice-stress"] = !1, e["voice-volume"] = !1, e.volume = !1, e["white-space"] = !1, e.widows = !1, e.width = !0, e["will-change"] = !1, e["word-break"] = !0, e["word-spacing"] = !0, e["word-wrap"] = !0, e["wrap-flow"] = !1, e["wrap-through"] = !1, e["writing-mode"] = !1, e["z-index"] = !1, e;
}
function at(e, r, t) {
}
function nt(e, r, t) {
}
var it = /javascript\s*\:/img;
function lt(e, r) {
return it.test(r) ? "" : r;
}
I.whiteList = me();
I.getDefaultWhiteList = me;
I.onAttr = at;
I.onIgnoreAttr = nt;
I.safeAttrValue = lt;
var ot = {
indexOf: function(e, r) {
var t, s;
if (Array.prototype.indexOf)
return e.indexOf(r);
for (t = 0, s = e.length; t < s; t++)
if (e[t] === r)
return t;
return -1;
},
forEach: function(e, r, t) {
var s, a;
if (Array.prototype.forEach)
return e.forEach(r, t);
for (s = 0, a = e.length; s < a; s++)
r.call(t, e[s], s, e);
},
trim: function(e) {
return String.prototype.trim ? e.trim() : e.replace(/(^\s*)|(\s*$)/g, "");
},
trimRight: function(e) {
return String.prototype.trimRight ? e.trimRight() : e.replace(/(\s*$)/g, "");
}
}, R = ot;
function ft(e, r) {
e = R.trimRight(e), e[e.length - 1] !== ";" && (e += ";");
var t = e.length, s = !1, a = 0, n = 0, o = "";
function i() {
if (!s) {
var u = R.trim(e.slice(a, n)), f = u.indexOf(":");
if (f !== -1) {
var d = R.trim(u.slice(0, f)), g = R.trim(u.slice(f + 1));
if (d) {
var h = r(a, o.length, d, g, u);
h && (o += h + "; ");
}
}
}
a = n + 1;
}
for (; n < t; n++) {
var l = e[n];
if (l === "/" && e[n + 1] === "*") {
var c = e.indexOf("*/", n + 2);
if (c === -1)
break;
n = c + 1, a = n + 1, s = !1;
} else
l === "(" ? s = !0 : l === ")" ? s = !1 : l === ";" ? s || i() : l === `
` && i();
}
return R.trim(o);
}
var ct = ft, W = I, ut = ct;
function ne(e) {
return e == null;
}
function gt(e) {
var r = {};
for (var t in e)
r[t] = e[t];
return r;
}
function be(e) {
e = gt(e || {}), e.whiteList = e.whiteList || W.whiteList, e.onAttr = e.onAttr || W.onAttr, e.onIgnoreAttr = e.onIgnoreAttr || W.onIgnoreAttr, e.safeAttrValue = e.safeAttrValue || W.safeAttrValue, this.options = e;
}
be.prototype.process = function(e) {
if (e = e || "", e = e.toString(), !e)
return "";
var r = this, t = r.options, s = t.whiteList, a = t.onAttr, n = t.onIgnoreAttr, o = t.safeAttrValue, i = ut(e, function(l, c, u, f, d) {
var g = s[u], h = !1;
if (g === !0 ? h = g : typeof g == "function" ? h = g(f) : g instanceof RegExp && (h = g.test(f)), h !== !0 && (h = !1), f = o(u, f), !!f) {
var m = {
position: c,
sourcePosition: l,
source: d,
isWhite: h
};
if (h) {
var y = a(u, f, m);
return ne(y) ? u + ":" + f : y;
} else {
var y = n(u, f, m);
if (!ne(y))
return y;
}
}
});
return i;
};
var dt = be;
(function(e, r) {
var t = I, s = dt;
function a(o, i) {
var l = new s(i);
return l.process(o);
}
r = e.exports = a, r.FilterCSS = s;
for (var n in t)
r[n] = t[n];
typeof window < "u" && (window.filterCSS = e.exports);
})(J, J.exports);
var ee = J.exports, te = {
indexOf: function(e, r) {
var t, s;
if (Array.prototype.indexOf)
return e.indexOf(r);
for (t = 0, s = e.length; t < s; t++)
if (e[t] === r)
return t;
return -1;
},
forEach: function(e, r, t) {
var s, a;
if (Array.prototype.forEach)
return e.forEach(r, t);
for (s = 0, a = e.length; s < a; s++)
r.call(t, e[s], s, e);
},
trim: function(e) {
return String.prototype.trim ? e.trim() : e.replace(/(^\s*)|(\s*$)/g, "");
},
spaceIndex: function(e) {
var r = /\s|\n|\t/, t = r.exec(e);
return t ? t.index : -1;
}
}, pt = ee.FilterCSS, ht = ee.getDefaultWhiteList, H = te;
function ve() {
return {
a: ["target", "href", "title"],
abbr: ["title"],
address: [],
area: ["shape", "coords", "href", "alt"],
article: [],
aside: [],
audio: [
"autoplay",
"controls",
"crossorigin",
"loop",
"muted",
"preload",
"src"
],
b: [],
bdi: ["dir"],
bdo: ["dir"],
big: [],
blockquote: ["cite"],
br: [],
caption: [],
center: [],
cite: [],
code: [],
col: ["align", "valign", "span", "width"],
colgroup: ["align", "valign", "span", "width"],
dd: [],
del: ["datetime"],
details: ["open"],
div: [],
dl: [],
dt: [],
em: [],
figcaption: [],
figure: [],
font: ["color", "size", "face"],
footer: [],
h1: [],
h2: [],
h3: [],
h4: [],
h5: [],
h6: [],
header: [],
hr: [],
i: [],
img: ["src", "alt", "title", "width", "height"],
ins: ["datetime"],
li: [],
mark: [],
nav: [],
ol: [],
p: [],
pre: [],
s: [],
section: [],
small: [],
span: [],
sub: [],
summary: [],
sup: [],
strong: [],
strike: [],
table: ["width", "border", "align", "valign"],
tbody: ["align", "valign"],
td: ["width", "rowspan", "colspan", "align", "valign"],
tfoot: ["align", "valign"],
th: ["width", "rowspan", "colspan", "align", "valign"],
thead: ["align", "valign"],
tr: ["rowspan", "align", "valign"],
tt: [],
u: [],
ul: [],
video: [
"autoplay",
"controls",
"crossorigin",
"loop",
"muted",
"playsinline",
"poster",
"preload",
"src",
"height",
"width"
]
};
}
var we = new pt();
function yt(e, r, t) {
}
function mt(e, r, t) {
}
function bt(e, r, t) {
}
function vt(e, r, t) {
}
function Ae(e) {
return e.replace(At, "&lt;").replace(_t, "&gt;");
}
function wt(e, r, t, s) {
if (t = Le(t), r === "href" || r === "src") {
if (t = H.trim(t), t === "#")
return "#";
if (!(t.substr(0, 7) === "http://" || t.substr(0, 8) === "https://" || t.substr(0, 7) === "mailto:" || t.substr(0, 4) === "tel:" || t.substr(0, 11) === "data:image/" || t.substr(0, 6) === "ftp://" || t.substr(0, 2) === "./" || t.substr(0, 3) === "../" || t[0] === "#" || t[0] === "/"))
return "";
} else if (r === "background") {
if (z.lastIndex = 0, z.test(t))
return "";
} else if (r === "style") {
if (ie.lastIndex = 0, ie.test(t) || (le.lastIndex = 0, le.test(t) && (z.lastIndex = 0, z.test(t))))
return "";
s !== !1 && (s = s || we, t = s.process(t));
}
return t = Ee(t), t;
}
var At = /</g, _t = />/g, xt = /"/g, St = /&quot;/g, Tt = /&#([a-zA-Z0-9]*);?/gim, kt = /&colon;?/gim, Lt = /&newline;?/gim, z = /((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi, ie = /e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi, le = /u\s*r\s*l\s*\(.*/gi;
function _e(e) {
return e.replace(xt, "&quot;");
}
function xe(e) {
return e.replace(St, '"');
}
function Se(e) {
return e.replace(Tt, function(t, s) {
return s[0] === "x" || s[0] === "X" ? String.fromCharCode(parseInt(s.substr(1), 16)) : String.fromCharCode(parseInt(s, 10));
});
}
function Te(e) {
return e.replace(kt, ":").replace(Lt, " ");
}
function ke(e) {
for (var r = "", t = 0, s = e.length; t < s; t++)
r += e.charCodeAt(t) < 32 ? " " : e.charAt(t);
return H.trim(r);
}
function Le(e) {
return e = xe(e), e = Se(e), e = Te(e), e = ke(e), e;
}
function Ee(e) {
return e = _e(e), e = Ae(e), e;
}
function Et() {
return "";
}
function Ct(e, r) {
typeof r != "function" && (r = function() {
});
var t = !Array.isArray(e);
function s(o) {
return t ? !0 : H.indexOf(e, o) !== -1;
}
var a = [], n = !1;
return {
onIgnoreTag: function(o, i, l) {
if (s(o))
if (l.isClosing) {
var c = "[/removed]", u = l.position + c.length;
return a.push([
n !== !1 ? n : l.position,
u
]), n = !1, c;
} else
return n || (n = l.position), "[removed]";
else
return r(o, i, l);
},
remove: function(o) {
var i = "", l = 0;
return H.forEach(a, function(c) {
i += o.slice(l, c[0]), l = c[1];
}), i += o.slice(l), i;
}
};
}
function Bt(e) {
for (var r = "", t = 0; t < e.length; ) {
var s = e.indexOf("<!--", t);
if (s === -1) {
r += e.slice(t);
break;
}
r += e.slice(t, s);
var a = e.indexOf("-->", s);
if (a === -1)
break;
t = a + 3;
}
return r;
}
function It(e) {
var r = e.split("");
return r = r.filter(function(t) {
var s = t.charCodeAt(0);
return s === 127 ? !1 : s <= 31 ? s === 10 || s === 13 : !0;
}), r.join("");
}
p.whiteList = ve();
p.getDefaultWhiteList = ve;
p.onTag = yt;
p.onIgnoreTag = mt;
p.onTagAttr = bt;
p.onIgnoreTagAttr = vt;
p.safeAttrValue = wt;
p.escapeHtml = Ae;
p.escapeQuote = _e;
p.unescapeQuote = xe;
p.escapeHtmlEntities = Se;
p.escapeDangerHtml5Entities = Te;
p.clearNonPrintableCharacter = ke;
p.friendlyAttrValue = Le;
p.escapeAttrValue = Ee;
p.onIgnoreTagStripAll = Et;
p.StripTagBody = Ct;
p.stripCommentTag = Bt;
p.stripBlankChar = It;
p.cssFilter = we;
p.getDefaultCSSWhiteList = ht;
var N = {}, k = te;
function Ot(e) {
var r = k.spaceIndex(e), t;
return r === -1 ? t = e.slice(1, -1) : t = e.slice(1, r + 1), t = k.trim(t).toLowerCase(), t.slice(0, 1) === "/" && (t = t.slice(1)), t.slice(-1) === "/" && (t = t.slice(0, -1)), t;
}
function Ft(e) {
return e.slice(0, 2) === "</";
}
function Rt(e, r, t) {
var s = "", a = 0, n = !1, o = !1, i = 0, l = e.length, c = "", u = "";
e:
for (i = 0; i < l; i++) {
var f = e.charAt(i);
if (n === !1) {
if (f === "<") {
n = i;
continue;
}
} else if (o === !1) {
if (f === "<") {
s += t(e.slice(a, i)), n = i, a = i;
continue;
}
if (f === ">" || i === l - 1) {
s += t(e.slice(a, n)), u = e.slice(n, i + 1), c = Ot(u), s += r(
n,
s.length,
c,
u,
Ft(u)
), a = i + 1, n = !1;
continue;
}
if (f === '"' || f === "'")
for (var d = 1, g = e.charAt(i - d); g.trim() === "" || g === "="; ) {
if (g === "=") {
o = f;
continue e;
}
g = e.charAt(i - ++d);
}
} else if (f === o) {
o = !1;
continue;
}
}
return a < l && (s += t(e.substr(a))), s;
}
var Pt = /[^a-zA-Z0-9\\_:.-]/gim;
function Ut(e, r) {
var t = 0, s = 0, a = [], n = !1, o = e.length;
function i(d, g) {
if (d = k.trim(d), d = d.replace(Pt, "").toLowerCase(), !(d.length < 1)) {
var h = r(d, g || "");
h && a.push(h);
}
}
for (var l = 0; l < o; l++) {
var c = e.charAt(l), u, f;
if (n === !1 && c === "=") {
n = e.slice(t, l), t = l + 1, s = e.charAt(t) === '"' || e.charAt(t) === "'" ? t : zt(e, l + 1);
continue;
}
if (n !== !1 && l === s) {
if (f = e.indexOf(c, l + 1), f === -1)
break;
u = k.trim(e.slice(s + 1, f)), i(n, u), n = !1, l = f, t = l + 1;
continue;
}
if (/\s|\n|\t/.test(c))
if (e = e.replace(/\s|\n|\t/g, " "), n === !1)
if (f = Wt(e, l), f === -1) {
u = k.trim(e.slice(t, l)), i(u), n = !1, t = l + 1;
continue;
} else {
l = f - 1;
continue;
}
else if (f = $t(e, l - 1), f === -1) {
u = k.trim(e.slice(t, l)), u = oe(u), i(n, u), n = !1, t = l + 1;
continue;
} else
continue;
}
return t < e.length && (n === !1 ? i(e.slice(t)) : i(n, oe(k.trim(e.slice(t))))), k.trim(a.join(" "));
}
function Wt(e, r) {
for (; r < e.length; r++) {
var t = e[r];
if (t !== " ")
return t === "=" ? r : -1;
}
}
function zt(e, r) {
for (; r < e.length; r++) {
var t = e[r];
if (t !== " ")
return t === "'" || t === '"' ? r : -1;
}
}
function $t(e, r) {
for (; r > 0; r--) {
var t = e[r];
if (t !== " ")
return t === "=" ? r : -1;
}
}
function Vt(e) {
return e[0] === '"' && e[e.length - 1] === '"' || e[0] === "'" && e[e.length - 1] === "'";
}
function oe(e) {
return Vt(e) ? e.substr(1, e.length - 2) : e;
}
N.parseTag = Rt;
N.parseAttr = Ut;
var Dt = ee.FilterCSS, w = p, Ce = N, Ht = Ce.parseTag, Xt = Ce.parseAttr, D = te;
function $(e) {
return e == null;
}
function jt(e) {
var r = D.spaceIndex(e);
if (r === -1)
return {
html: "",
closing: e[e.length - 2] === "/"
};
e = D.trim(e.slice(r + 1, -1));
var t = e[e.length - 1] === "/";
return t && (e = D.trim(e.slice(0, -1))), {
html: e,
closing: t
};
}
function Nt(e) {
var r = {};
for (var t in e)
r[t] = e[t];
return r;
}
function Gt(e) {
var r = {};
for (var t in e)
Array.isArray(e[t]) ? r[t.toLowerCase()] = e[t].map(function(s) {
return s.toLowerCase();
}) : r[t.toLowerCase()] = e[t];
return r;
}
function Be(e) {
e = Nt(e || {}), e.stripIgnoreTag && (e.onIgnoreTag && console.error(
'Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'
), e.onIgnoreTag = w.onIgnoreTagStripAll), e.whiteList || e.allowList ? e.whiteList = Gt(e.whiteList || e.allowList) : e.whiteList = w.whiteList, e.onTag = e.onTag || w.onTag, e.onTagAttr = e.onTagAttr || w.onTagAttr, e.onIgnoreTag = e.onIgnoreTag || w.onIgnoreTag, e.onIgnoreTagAttr = e.onIgnoreTagAttr || w.onIgnoreTagAttr, e.safeAttrValue = e.safeAttrValue || w.safeAttrValue, e.escapeHtml = e.escapeHtml || w.escapeHtml, this.options = e, e.css === !1 ? this.cssFilter = !1 : (e.css = e.css || {}, this.cssFilter = new Dt(e.css));
}
Be.prototype.process = function(e) {
if (e = e || "", e = e.toString(), !e)
return "";
var r = this, t = r.options, s = t.whiteList, a = t.onTag, n = t.onIgnoreTag, o = t.onTagAttr, i = t.onIgnoreTagAttr, l = t.safeAttrValue, c = t.escapeHtml, u = r.cssFilter;
t.stripBlankChar && (e = w.stripBlankChar(e)), t.allowCommentTag || (e = w.stripCommentTag(e));
var f = !1;
t.stripIgnoreTagBody && (f = w.StripTagBody(
t.stripIgnoreTagBody,
n
), n = f.onIgnoreTag);
var d = Ht(
e,
function(g, h, m, y, G) {
var E = {
sourcePosition: g,
position: h,
isClosing: G,
isWhite: Object.prototype.hasOwnProperty.call(s, m)
}, C = a(m, y, E);
if (!$(C))
return C;
if (E.isWhite) {
if (E.isClosing)
return "</" + m + ">";
var _ = jt(y), M = s[m], x = Xt(_.html, function(S, O) {
var q = D.indexOf(M, S) !== -1, F = o(m, S, O, q);
return $(F) ? q ? (O = l(m, S, O, u), O ? S + '="' + O + '"' : S) : (F = i(m, S, O, q), $(F) ? void 0 : F) : F;
});
return y = "<" + m, x && (y += " " + x), _.closing && (y += " /"), y += ">", y;
} else
return C = n(m, y, E), $(C) ? c(y) : C;
},
c
);
return f && (d = f.remove(d)), d;
};
var Mt = Be;
(function(e, r) {
var t = p, s = N, a = Mt;
function n(i, l) {
var c = new a(l);
return c.process(i);
}
r = e.exports = n, r.filterXSS = n, r.FilterXSS = a, function() {
for (var i in t)
r[i] = t[i];
for (var l in s)
r[l] = s[l];
}(), typeof window < "u" && (window.filterXSS = e.exports);
function o() {
return typeof self < "u" && typeof DedicatedWorkerGlobalScope < "u" && self instanceof DedicatedWorkerGlobalScope;
}
o() && (self.filterXSS = e.exports);
})(Z, Z.exports);
var X = Z.exports;
let v = {
enableAttrs: !0,
enableHtml: !0,
enableUrl: !0,
html: {
whiteList: {
a: ["class", "style", "contenteditable", "data-id", "data-title", "data-size", "data-last-modified"],
address: ["class", "style"],
area: ["class", "style"],
article: ["class", "style"],
aside: ["class", "style"],
audio: ["class", "style"],
b: ["class", "style"],
bdi: ["class", "style"],
bdo: ["class", "style"],
big: ["class", "style"],
blockquote: ["class", "style"],
br: ["class", "style"],
caption: ["class", "style"],
center: ["class", "style"],
cite: ["class", "style"],
code: ["class", "style"],
col: ["class", "style"],
colgroup: ["class", "style"],
dd: ["class", "style"],
del: ["class", "style"],
details: ["class", "style"],
div: [
"class",
"style",
"spellcheck",
"data-gramm",
"spellcheck",
"data-mode",
"data-position",
"data-row",
"data-cell",
"data-rowspan",
"data-colspan",
"data-cell-bg",
"data-parent-bg"
],
dl: ["class", "style"],
dt: ["class", "style"],
em: ["class", "style"],
figcaption: ["class", "style"],
figure: ["class", "style"],
font: ["class", "style"],
footer: ["class", "style"],
h1: ["class", "style"],
h2: ["class", "style"],
h3: ["class", "style"],
h4: ["class", "style"],
h5: ["class", "style"],
h6: ["class", "style"],
header: ["class", "style"],
hr: ["class", "style"],
i: ["class", "style", "data-image-id", "data-image"],
img: ["class", "style", "devui-editorx-image", "style", "data-image-id"],
input: ["class", "style", "data-formula", "data-link", "data-video"],
ins: ["class", "style"],
li: ["class", "style"],
mark: ["class", "style"],
nav: ["class", "style"],
ol: ["class", "style"],
p: ["class", "style"],
pre: ["class", "style"],
s: ["class", "style"],
section: ["class", "style"],
small: ["class", "style"],
span: ["class", "style", "contenteditable", "color", "style"],
sub: ["class", "style"],
summary: ["class", "style"],
sup: ["class", "style"],
strong: ["class", "style"],
strike: ["class", "style"],
svg: ["class", "style", "t", "viewBox", "viewbox", "version", "xmlns", "p-id", "xmlns:xlink"],
path: ["d", "p-id"],
table: ["class", "style"],
tbody: ["class", "style"],
td: ["class", "style", "data-row", "data-cell", "data-cell-bg", "data-parent-bg"],
tfoot: ["class", "style"],
th: ["class", "style"],
thead: ["class", "style"],
tr: ["class", "style", "data-row"],
tt: ["class", "style"],
u: ["class", "style"],
ul: ["class", "style"],
video: ["class", "style"]
}
}
};
const qt = X.getDefaultWhiteList && X.getDefaultWhiteList() || {};
v.html.whiteList = Object.assign(qt, v.html.whiteList);
let Ie = new X.FilterXSS(v.html);
const Qt = () => v, Zt = (e) => {
var t;
let r;
(t = e == null ? void 0 : e.html) != null && t.whiteList && (r = Object.assign(v.html.whiteList, e.html.whiteList)), v = Object.assign(v, e), r && (v.html.whiteList = r), Ie = new X.FilterXSS(v.html);
};
let Oe = (e) => !v.enableHtml || typeof e != "string" ? e : Ie.process(e);
const Jt = (e) => {
Oe = e;
};
let Fe = (e) => !v.enableAttrs || typeof e != "string" ? e : e.replace(/<.*?>/gi, "").replace(/on[a-z]+=/gi, "");
const Kt = (e) => {
Fe = e;
};
let Re = (e) => {
if (!v.enableUrl || typeof e != "string")
return e;
const r = e.replace(/&#(\w+)(^\w|;)?/g, (s, a) => String.fromCharCode(a)).replace(/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim, "").trim();
if (!r)
return "";
if ([".", "/"].includes(r[0]))
return r;
const t = r.match(/^([^:]+):/gm);
return t && /^([^\w]*)(javascript|data|vbscript)/im.test(t[0]) ? "" : r;
};
const Yt = (e) => {
Re = e;
}, Pe = {
getXssOption: Qt,
setXssOption: Zt,
filterHtml: Oe,
setFilterHtml: Jt,
filterAttrs: Fe,
setFilterAttrs: Kt,
filterUrl: Re,
setFilterUrl: Yt
}, er = j(), tr = "console", rr = er[tr] || {};
let Ue = !0;
const U = {}, sr = (e, r) => function(...t) {
Ue && e[r] && typeof e[r] == "function" && e[r](...t);
}, ar = (e) => (Object.keys(e).forEach((r) => {
U[r] = sr(e, r);
}), U), nr = (e) => {
Ue = !!e;
}, ir = (e, r) => {
U && Object.hasOwnProperty.call(U, e) && (U[e] = r);
}, fe = ar(rr), We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: fe,
logger: fe,
setLogger: ir,
switchLogger: nr
}, Symbol.toStringTag, { value: "Module" })), ce = j().crypto;
let K;
ce ? K = (e) => {
const r = [];
for (let t = 0; t < e; t += 4)
r.push(ce.getRandomValues(new Uint32Array(1))[0]);
return new A(r, e);
} : K = (e) => {
const r = [], t = (s) => {
let a = s, n = 987654321;
const o = 4294967295;
return () => {
n = 36969 * (n & 65535) + (n >> 16) & o, a = 18e3 * (a & 65535) + (a >> 16) & o;
let i = (n << 16) + a & o;
return i /= 4294967296, i += 0.5, i * (Math.random() > 0.5 ? 1 : -1);
};
};
for (let s = 0, a; s < e; s += 4) {
const n = t((a || Math.random()) * 4294967296);
a = n() * 987654071, r.push(n() * 4294967296 | 0);
}
return new A(r, e);
};
class re {
// @ts-ignore
static create(...r) {
return new this(...r);
}
clone() {
const r = new this.constructor();
return Object.assign(r, this), r;
}
mixIn(r) {
return Object.assign(this, r);
}
}
class A extends re {
constructor(t = [], s = t.length * 4) {
super();
b(this, "words");
b(this, "sigBytes");
let a = t;
if (a instanceof ArrayBuffer && (a = new Uint8Array(a)), (a instanceof Int8Array || a instanceof Uint8ClampedArray || a instanceof Int16Array || a instanceof Uint16Array || a instanceof Int32Array || a instanceof Uint32Array || a instanceof Float32Array || a instanceof Float64Array) && (a = new Uint8Array(a.buffer, a.byteOffset, a.byteLength)), a instanceof Uint8Array) {
const n = a.byteLength, o = [];
for (let i = 0; i < n; i += 1)
o[i >>> 2] |= a[i] << 24 - i % 4 * 8;
this.words = o, this.sigBytes = n;
} else
this.words = t, this.sigBytes = s;
}
toString(t = lr) {
return t.stringify(this);
}
concat(t) {
const s = this.words, a = t.words, n = this.sigBytes, o = t.sigBytes;
if (this.clamp(), n % 4)
for (let i = 0; i < o; i += 1) {
const l = a[i >>> 2] >>> 24 - i % 4 * 8 & 255;
s[n + i >>> 2] |= l << 24 - (n + i) % 4 * 8;
}
else
for (let i = 0; i < o; i += 4)
s[n + i >>> 2] = a[i >>> 2];
return this.sigBytes += o, this;
}
clone() {
const t = super.clone.call(this);
return t.words = this.words.slice(0), t;
}
clamp() {
const { words: t, sigBytes: s } = this;
t[s >>> 2] &= 4294967295 << 32 - s % 4 * 8, t.length = Math.ceil(s / 4);
}
}
b(A, "random", K);
const ue = {
stringify(e) {
const { words: r, sigBytes: t } = e, s = [];
for (let a = 0; a < t; a += 1) {
const n = r[a >>> 2] >>> 24 - a % 4 * 8 & 255;
s.push(String.fromCharCode(n));
}
return s.join("");
},
parse(e) {
const r = e.length, t = [];
for (let s = 0; s < r; s += 1)
t[s >>> 2] |= (e.charCodeAt(s) & 255) << 24 - s % 4 * 8;
return new A(t, r);
}
}, lr = {
stringify(e) {
const { words: r, sigBytes: t } = e, s = [];
for (let a = 0; a < t; a += 1) {
const n = r[a >>> 2] >>> 24 - a % 4 * 8 & 255;
s.push((n >>> 4).toString(16)), s.push((n & 15).toString(16));
}
return s.join("");
},
parse(e) {
const r = e.length, t = [];
for (let s = 0; s < r; s += 2)
t[s >>> 3] |= parseInt(e.substr(s, 2), 16) << 24 - s % 8 * 4;
return new A(t, r / 2);
}
}, or = {
stringify(e) {
try {
return decodeURIComponent(escape(ue.stringify(e)));
} catch {
throw new Error("The UTF-8 data format is incorrect.");
}
},
parse(e) {
return ue.parse(unescape(encodeURIComponent(e)));
}
};
class fr extends re {
constructor() {
super();
b(this, "_minBufferSize");
b(this, "_nDataBytes", 0);
b(this, "_data");
b(this, "blockSize", 0);
this._minBufferSize = 0;
}
_append(t) {
let s = t;
typeof s == "string" && (s = or.parse(s)), this._data.concat(s), this._nDataBytes += s.sigBytes;
}
reset() {
this._data = new A(), this._nDataBytes = 0;
}
_process(t) {
let s;
const { _data: a, blockSize: n } = this, o = a.words, i = a.sigBytes, l = n * 4;
let c = i / l;
t ? c = Math.ceil(c) : c = Math.max((c | 0) - this._minBufferSize, 0);
const u = c * n, f = Math.min(u * 4, i);
if (u) {
for (let d = 0; d < u; d += n)
this._doProcessBlock(o, d);
s = o.splice(0, u), a.sigBytes -= f;
}
return new A(s, f);
}
clone() {
const t = super.clone.call(this);
return t._data = this._data.clone(), t;
}
}
class ze extends fr {
constructor(t) {
super();
b(this, "cfg");
b(this, "_process");
this.cfg = Object.assign(new re(), t), this.blockSize = 512 / 32, this.reset();
}
static _createHelper(t) {
return (s, a) => new t(a).finalize(s);
}
update(t) {
return this._append(t), this._process(), this;
}
reset() {
super.reset.call(this), this._doReset();
}
finalize(t) {
return t && this._append(t), this._doFinalize();
}
}
const $e = [], Ve = [], B = [];
let V = 2, P = 0;
const cr = (e) => {
const r = Math.sqrt(e);
for (let t = 2; t <= r; t += 1)
if (!(e % t))
return !1;
return !0;
}, ge = (e) => (e - (e | 0)) * 4294967296 | 0;
for (; P < 64; )
cr(V) && (P < 8 && ($e[P] = ge(V ** (1 / 2))), Ve[P] = ge(V ** (1 / 3)), P += 1), V += 1;
class ur extends ze {
constructor() {
super(...arguments);
b(this, "_hash");
b(this, "_data");
}
_doReset() {
this._hash = new A($e.slice(0));
}
_doProcessBlock(t, s) {
const a = this._hash.words;
let n = a[0], o = a[1], i = a[2], l = a[3], c = a[4], u = a[5], f = a[6], d = a[7];
for (let g = 0; g < 64; g += 1) {
if (g < 16)
B[g] = t[s + g] | 0;
else {
const _ = B[g - 15], M = (_ << 25 | _ >>> 7) ^ (_ << 14 | _ >>> 18) ^ _ >>> 3, x = B[g - 2], S = (x << 15 | x >>> 17) ^ (x << 13 | x >>> 19) ^ x >>> 10;
B[g] = M + B[g - 7] + S + B[g - 16];
}
const h = (n << 30 | n >>> 2) ^ (n << 19 | n >>> 13) ^ (n << 10 | n >>> 22), m = (c << 26 | c >>> 6) ^ (c << 21 | c >>> 11) ^ (c << 7 | c >>> 25), y = c & u ^ ~c & f, G = n & o ^ n & i ^ o & i, E = d + m + y + Ve[g] + B[g], C = h + G;
d = f, f = u, u = c, c = l + E | 0, l = i, i = o, o = n, n = E + C | 0;
}
a[0] = a[0] + n | 0, a[1] = a[1] + o | 0, a[2] = a[2] + i | 0, a[3] = a[3] + l | 0, a[4] = a[4] + c | 0, a[5] = a[5] + u | 0, a[6] = a[6] + f | 0, a[7] = a[7] + d | 0;
}
_doFinalize() {
const t = this._data, s = t.words, a = this._nDataBytes * 8, n = t.sigBytes * 8;
return s[n >>> 5] |= 128 << 24 - n % 32, s[(n + 64 >>> 9 << 4) + 14] = Math.floor(a / 4294967296), s[(n + 64 >>> 9 << 4) + 15] = a, t.sigBytes = s.length * 4, this._process(), this._hash;
}
clone() {
const t = super.clone.call(this);
return t._hash = this._hash.clone(), t;
}
}
const de = ze._createHelper(ur);
async function gr(e, r) {
const s = Object.prototype.toString.call(r) === "[object ArrayBuffer]" ? r : new TextEncoder().encode(r), a = await window.crypto.subtle.digest(e, s);
return Array.from(new Uint8Array(a)).map((i) => i.toString(16).padStart(2, "0")).join("");
}
function dr(e) {
return window.crypto.subtle ? gr("SHA-256", e) : Object.prototype.toString.call(e) === "[object ArrayBuffer]" ? de(new A(e), "").toString() : de(e, "").toStrsha256;
}
const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
sha256: dr
}, Symbol.toStringTag, { value: "Module" })), hr = {
nanoid: ye,
xss: Pe,
log: We,
crypt: De
}, yr = ye, mr = Pe, br = We, vr = De;
export {
vr as crypt,
hr as default,
br as log,
yr as nanoid,
mr as xss
};