@qy_better_lib/core 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DOCUMENTATION.md +19 -19
- package/dist/core.min.js +1 -1
- package/lib/utils/echarts.js +1 -1
- package/lib/utils/storage.js +6 -0
- package/package.json +1 -1
package/DOCUMENTATION.md
CHANGED
|
@@ -547,7 +547,7 @@
|
|
|
547
547
|
|
|
548
548
|
### 3. 日期时间工具 (date.ts)
|
|
549
549
|
|
|
550
|
-
>
|
|
550
|
+
> 注意:日期时间工具是可选依赖,需要单独导入
|
|
551
551
|
|
|
552
552
|
#### format_date
|
|
553
553
|
- **功能**: 格式化日期时间
|
|
@@ -1874,7 +1874,7 @@
|
|
|
1874
1874
|
- **返回类型**: `Promise<any>` - Echarts实例
|
|
1875
1875
|
- **示例**:
|
|
1876
1876
|
```typescript
|
|
1877
|
-
import { init_chart } from '@qy_better_lib/core';
|
|
1877
|
+
import { init_chart } from '@qy_better_lib/core/echarts';
|
|
1878
1878
|
|
|
1879
1879
|
async function init() {
|
|
1880
1880
|
const chart = await init_chart('chart-container', {
|
|
@@ -1890,7 +1890,7 @@
|
|
|
1890
1890
|
- **参数**: `chart: any` - Echarts实例
|
|
1891
1891
|
- **示例**:
|
|
1892
1892
|
```typescript
|
|
1893
|
-
import { destroy_chart } from '@qy_better_lib/core';
|
|
1893
|
+
import { destroy_chart } from '@qy_better_lib/core/echarts';
|
|
1894
1894
|
|
|
1895
1895
|
destroy_chart(chart);
|
|
1896
1896
|
```
|
|
@@ -1902,7 +1902,7 @@
|
|
|
1902
1902
|
- `options: EChartsOption` - 图表配置项
|
|
1903
1903
|
- **示例**:
|
|
1904
1904
|
```typescript
|
|
1905
|
-
import { update_chart } from '@qy_better_lib/core';
|
|
1905
|
+
import { update_chart } from '@qy_better_lib/core/echarts';
|
|
1906
1906
|
|
|
1907
1907
|
update_chart(chart, {
|
|
1908
1908
|
series: [{ type: 'bar', data: [4, 5, 6] }]
|
|
@@ -1914,7 +1914,7 @@
|
|
|
1914
1914
|
- **参数**: `chart: any` - Echarts实例
|
|
1915
1915
|
- **示例**:
|
|
1916
1916
|
```typescript
|
|
1917
|
-
import { resize_chart } from '@qy_better_lib/core';
|
|
1917
|
+
import { resize_chart } from '@qy_better_lib/core/echarts';
|
|
1918
1918
|
|
|
1919
1919
|
resize_chart(chart);
|
|
1920
1920
|
```
|
|
@@ -1927,7 +1927,7 @@
|
|
|
1927
1927
|
- **返回类型**: `Function` - 清理函数
|
|
1928
1928
|
- **示例**:
|
|
1929
1929
|
```typescript
|
|
1930
|
-
import { make_chart_responsive } from '@qy_better_lib/core';
|
|
1930
|
+
import { make_chart_responsive } from '@qy_better_lib/core/echarts';
|
|
1931
1931
|
|
|
1932
1932
|
const cleanup = make_chart_responsive(chart);
|
|
1933
1933
|
// 当需要清理时调用
|
|
@@ -1942,7 +1942,7 @@
|
|
|
1942
1942
|
- **返回类型**: `string[]` - 颜色数组
|
|
1943
1943
|
- **示例**:
|
|
1944
1944
|
```typescript
|
|
1945
|
-
import { generate_chart_colors } from '@qy_better_lib/core';
|
|
1945
|
+
import { generate_chart_colors } from '@qy_better_lib/core/echarts';
|
|
1946
1946
|
|
|
1947
1947
|
const colors = generate_chart_colors(5);
|
|
1948
1948
|
console.log(colors);
|
|
@@ -1956,7 +1956,7 @@
|
|
|
1956
1956
|
- **返回类型**: `string` - 格式化后的值
|
|
1957
1957
|
- **示例**:
|
|
1958
1958
|
```typescript
|
|
1959
|
-
import { format_chart_label } from '@qy_better_lib/core';
|
|
1959
|
+
import { format_chart_label } from '@qy_better_lib/core/echarts';
|
|
1960
1960
|
|
|
1961
1961
|
const label = format_chart_label(123, '{value}件');
|
|
1962
1962
|
console.log(label); // 123件
|
|
@@ -1970,7 +1970,7 @@
|
|
|
1970
1970
|
- **返回类型**: `EChartsOption` - 合并后的配置项
|
|
1971
1971
|
- **示例**:
|
|
1972
1972
|
```typescript
|
|
1973
|
-
import { merge_chart_options } from '@qy_better_lib/core';
|
|
1973
|
+
import { merge_chart_options } from '@qy_better_lib/core/echarts';
|
|
1974
1974
|
|
|
1975
1975
|
const options = merge_chart_options(
|
|
1976
1976
|
{ title: { text: '默认标题' } },
|
|
@@ -1986,7 +1986,7 @@
|
|
|
1986
1986
|
- `handler: (...args: any[]) => void` - 事件处理函数
|
|
1987
1987
|
- **示例**:
|
|
1988
1988
|
```typescript
|
|
1989
|
-
import { add_chart_listener } from '@qy_better_lib/core';
|
|
1989
|
+
import { add_chart_listener } from '@qy_better_lib/core/echarts';
|
|
1990
1990
|
|
|
1991
1991
|
add_chart_listener(chart, 'click', (params) => {
|
|
1992
1992
|
console.log('点击事件:', params);
|
|
@@ -2001,7 +2001,7 @@
|
|
|
2001
2001
|
- `handler: (...args: any[]) => void` - 事件处理函数
|
|
2002
2002
|
- **示例**:
|
|
2003
2003
|
```typescript
|
|
2004
|
-
import { remove_chart_listener } from '@qy_better_lib/core';
|
|
2004
|
+
import { remove_chart_listener } from '@qy_better_lib/core/echarts';
|
|
2005
2005
|
|
|
2006
2006
|
const handler = (params) => console.log('点击事件:', params);
|
|
2007
2007
|
add_chart_listener(chart, 'click', handler);
|
|
@@ -2017,7 +2017,7 @@
|
|
|
2017
2017
|
- **返回类型**: `string | null` - 图片URL
|
|
2018
2018
|
- **示例**:
|
|
2019
2019
|
```typescript
|
|
2020
|
-
import { export_chart_image } from '@qy_better_lib/core';
|
|
2020
|
+
import { export_chart_image } from '@qy_better_lib/core/echarts';
|
|
2021
2021
|
|
|
2022
2022
|
const imageUrl = export_chart_image(chart, {
|
|
2023
2023
|
type: 'png',
|
|
@@ -2030,7 +2030,7 @@
|
|
|
2030
2030
|
- **返回类型**: `boolean` - 是否已加载
|
|
2031
2031
|
- **示例**:
|
|
2032
2032
|
```typescript
|
|
2033
|
-
import { is_echarts_loaded } from '@qy_better_lib/core';
|
|
2033
|
+
import { is_echarts_loaded } from '@qy_better_lib/core/echarts';
|
|
2034
2034
|
|
|
2035
2035
|
const loaded = is_echarts_loaded();
|
|
2036
2036
|
console.log(loaded);
|
|
@@ -2041,7 +2041,7 @@
|
|
|
2041
2041
|
- **参数**: `charts: any[]` - 图表实例数组
|
|
2042
2042
|
- **示例**:
|
|
2043
2043
|
```typescript
|
|
2044
|
-
import { resize_charts } from '@qy_better_lib/core';
|
|
2044
|
+
import { resize_charts } from '@qy_better_lib/core/echarts';
|
|
2045
2045
|
|
|
2046
2046
|
resize_charts([chart1, chart2]);
|
|
2047
2047
|
```
|
|
@@ -2051,7 +2051,7 @@
|
|
|
2051
2051
|
- **参数**: `charts: any[]` - 图表实例数组
|
|
2052
2052
|
- **示例**:
|
|
2053
2053
|
```typescript
|
|
2054
|
-
import { destroy_charts } from '@qy_better_lib/core';
|
|
2054
|
+
import { destroy_charts } from '@qy_better_lib/core/echarts';
|
|
2055
2055
|
|
|
2056
2056
|
destroy_charts([chart1, chart2]);
|
|
2057
2057
|
```
|
|
@@ -2065,7 +2065,7 @@
|
|
|
2065
2065
|
- **返回类型**: `any[]` - 排序后的数据数组
|
|
2066
2066
|
- **示例**:
|
|
2067
2067
|
```typescript
|
|
2068
|
-
import { sort_chart_data } from '@qy_better_lib/core';
|
|
2068
|
+
import { sort_chart_data } from '@qy_better_lib/core/echarts';
|
|
2069
2069
|
|
|
2070
2070
|
const sortedData = sort_chart_data([{ value: 3 }, { value: 1 }, { value: 2 }], 'value');
|
|
2071
2071
|
console.log(sortedData);
|
|
@@ -2079,7 +2079,7 @@
|
|
|
2079
2079
|
- **返回类型**: `Record<string, any[]>` - 分组后的数据对象
|
|
2080
2080
|
- **示例**:
|
|
2081
2081
|
```typescript
|
|
2082
|
-
import { group_chart_data } from '@qy_better_lib/core';
|
|
2082
|
+
import { group_chart_data } from '@qy_better_lib/core/echarts';
|
|
2083
2083
|
|
|
2084
2084
|
const groupedData = group_chart_data([
|
|
2085
2085
|
{ category: 'A', value: 1 },
|
|
@@ -2099,7 +2099,7 @@
|
|
|
2099
2099
|
- **返回类型**: `any[]` - 聚合后的数据数组
|
|
2100
2100
|
- **示例**:
|
|
2101
2101
|
```typescript
|
|
2102
|
-
import { aggregate_chart_data } from '@qy_better_lib/core';
|
|
2102
|
+
import { aggregate_chart_data } from '@qy_better_lib/core/echarts';
|
|
2103
2103
|
|
|
2104
2104
|
const aggregatedData = aggregate_chart_data([
|
|
2105
2105
|
{ category: 'A', value: 1 },
|
|
@@ -2678,4 +2678,4 @@
|
|
|
2678
2678
|
const results = search_tree(treeData, { value: 10 });
|
|
2679
2679
|
console.log(results);
|
|
2680
2680
|
```
|
|
2681
|
-
|
|
2681
|
+
|
package/dist/core.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(i=typeof globalThis<"u"?globalThis:i||self,M(i.QyBetterLibCore={}))})(this,(function(i){"use strict";function M(){return Math.floor(Math.random()*1e4)}function it(t){return t<0?0:Math.floor(Math.random()*Math.floor(t))}function ct(t,e){return t>e&&([t,e]=[e,t]),Math.floor(Math.random()*(e-t+1))+t}function ut(t,e,n=2){t>e&&([t,e]=[e,t]);const r=Math.random()*(e-t)+t;return parseFloat(r.toFixed(n))}function st(){const t=R;return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function R(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}function N(t,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"){let n="";const r=e.length;for(let o=0;o<t;o++)n+=e.charAt(Math.floor(Math.random()*r));return n}function ft(){return Math.random()>.5}function w(t){if(!(!t||t.length===0))return t[Math.floor(Math.random()*t.length)]}function at(t,e){return!t||t.length===0||e<=0?[]:e>=t.length?[...t]:[...t].sort(()=>.5-Math.random()).slice(0,e)}function lt(){const t="0123456789ABCDEF";let e="#";for(let n=0;n<6;n++)e+=t[Math.floor(Math.random()*16)];return e}function C(t){return N(t,"0123456789")}function _t(t=8){return N(t,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+~`|}{[]:;?><,./-=")}function dt(){const e=w(["130","131","132","133","134","135","136","137","138","139","150","151","152","153","155","156","157","158","159","170","171","172","173","175","176","177","178","180","181","182","183","184","185","186","187","188","189"]),n=C(8);return`${e}${n}`}function ht(){const t=["gmail.com","yahoo.com","hotmail.com","outlook.com","163.com","126.com","qq.com","sina.com"],e=N(8),n=w(t);return`${e}@${n}`}function mt(){const t=["http","https"],e=["example.com","test.com","demo.com","sample.com"],n=["api","docs","about","contact","products"],r=w(t),o=w(e),c=w(n),u=N(4);return`${r}://www.${o}/${c}?id=${u}`}function gt(t){if(!t)return[];const e=[...t];for(let n=e.length-1;n>0;n--){const r=Math.floor(Math.random()*(n+1));[e[n],e[r]]=[e[r],e[n]]}return e}function yt(t){return t===void 0}function pt(t){return t===null}function l(t){return Array.isArray(t)}function h(t){return typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function bt(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function W(t){return Object.prototype.toString.call(t)==="[object Date]"}function wt(t){return W(t)&&!isNaN(t.getTime())}function vt(t){return typeof t=="boolean"}function p(t){return typeof t=="function"}function Mt(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Nt(t){return typeof t=="symbol"}function Ot(t){return typeof t=="object"&&t!==null&&typeof t.then=="function"&&typeof t.catch=="function"}function $t(t){return!t&&t!==0||l(t)&&t.length===0||h(t)&&!Object.keys(t).length}function Et(t){return!!t}function St(t){return!t}function L(t){return typeof Element>"u"?!1:t instanceof Element}function kt(t){return typeof HTMLElement>"u"?!1:t instanceof HTMLElement}const H=typeof window<"u";function m(t){return typeof t=="number"&&!isNaN(t)}function z(t){return typeof t=="string"}function It(t){return z(t)?!Number.isNaN(Number(t)):!1}function Ft(t){return/^1[3-9]\d{9}$/.test(t)}function At(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function Lt(t){try{return new URL(t),!0}catch{return!1}}function zt(t){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t)}function Tt(t){return/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(t)}function jt(t){return/^(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)$/.test(t)}function Dt(t,e="key",n="children"){const r={};if(!l(t))return r;const o=[{nodes:t}];for(;o.length>0;){const{nodes:c,parent_key:u}=o.pop();for(const s of c){const f=s[e];if(f&&!r[f]){r[f]=s,u&&r[u]&&(r[f].parent=r[u]);const a=s[n];a&&l(a)&&a.length>0&&o.push({nodes:a,parent_key:f})}}}return r}function Pt(t,e="key",n="parentId",r="children"){if(!l(t))return[];const o={},c=[];for(const u of t)o[u[e]]={...u},o[u[e]][r]||(o[u[e]][r]=[]);for(const u of t){const s=u[n];!s||!o[s]?c.push(o[u[e]]):o[s][r].push(o[u[e]])}return c}function Rt(t,e,n="children"){if(!e||!p(e))return!1;let r=!1;const o=l(t)?t:[t],c=[];for(const u of o)c.push({node:u,depth:0});for(;c.length>0;){const{node:u,depth:s}=c.pop();if(e(u,s)===!1){r=!0;break}const a=u[n];if(a&&l(a)&&a.length>0)for(let _=a.length-1;_>=0;_--)c.push({node:a[_],depth:s+1})}return r}function Ct(t,e,n="children"){if(!e||!p(e))return!1;const r=[];if(l(t))for(const o of t)r.push({node:o,depth:0});else r.push({node:t,depth:0});for(;r.length>0;){const{node:o,depth:c}=r.shift();if(e(o,c)===!1)return!0;const s=o[n];if(s&&l(s))for(const f of s)r.push({node:f,depth:c+1})}return!1}function B(t,e,n="children"){if(!e||!p(e))return null;let r=null;const o=c=>{if(e(c))return r=c,!0;const u=c[n];if(u&&l(u)){for(const s of u)if(o(s))return!0}return!1};if(l(t)){for(const c of t)if(o(c))break}else o(t);return r}function T(t,e,n="key",r="children"){return B(t,o=>o[n]===e,r)}function Wt(t,e,n="children"){if(!e||!p(e))return[];const r=o=>{const c=o[n],u=[];if(c&&l(c))for(const s of c){const f=r(s);f&&u.push(f)}return e(o)||u.length>0?{...o,[n]:u}:null};if(l(t)){const o=[];for(const c of t){const u=r(c);u&&o.push(u)}return o}else{const o=r(t);return o?[o]:[]}}function Ht(t,e,n="children"){if(!e||!p(e))return[];const r=o=>{const c=e(o),u=o[n];return u&&l(u)&&(c[n]=u.map(s=>r(s))),c};return l(t)?t.map(o=>r(o)):[r(t)]}function Bt(t,e="key",n="path",r="children"){const o=(c,u="")=>{const s=c[e],f=u?`${u}.${s}`:String(s),a={...c,[n]:f},_=c[r];return _&&l(_)&&(a[r]=_.map(d=>o(d,f))),a};return l(t)?t.map(c=>o(c)):[o(t)]}function Ut(t,e="children"){const n=[],r=o=>{const c=o[e];if(c&&l(c))for(const u of c)n.push(u),r(u)};return r(t),n}function qt(t,e="parent"){const n=[];let r=t[e];for(;r;)n.unshift(r),r=r[e];return n}function Jt(t,e="children"){const n=r=>{const o=r[e];if(!o||!l(o)||o.length===0)return 1;const c=o.map(u=>n(u));return Math.max(...c)+1};if(l(t)){if(t.length===0)return 0;const r=t.map(o=>n(o));return Math.max(...r)}else return n(t)}function Vt(t,e="children"){const n=[],r=o=>{n.push(o);const c=o[e];if(c&&l(c))for(const u of c)r(u)};if(l(t))for(const o of t)r(o);else r(t);return n}function Kt(t,e,n,r="key",o="children"){const c=l(t)?t:[t],u=T(c,e,r,o);return u?(u[o]||(u[o]=[]),u[o].push(n)):c.push(n),c}function Yt(t,e,n="key",r="children"){const o=l(t)?t:[t];let c=null,u=null;const s=(f,a=null)=>{for(let _=0;_<f.length;_++){const d=f[_];if(d[n]===e)return c=d,u=a?a[r]:f,!0;const v=d[r];if(v&&l(v)&&s(v,d))return!0}return!1};if(s(o),c&&u){const f=u.findIndex(a=>a[n]===e);f>-1&&u.splice(f,1)}return o}function Gt(t,e,n,r="key",o="children"){const c=l(t)?t:[t],u=T(c,e,r,o);return u&&Object.assign(u,n),c}function Qt(t,e,n=!0,r="children"){const o=l(t)?t:[t],c=typeof e=="string"?(s,f)=>{const a=s[e],_=f[e];return a<_?-1:a>_?1:0}:e,u=s=>{if(s.sort(c),n)for(const f of s){const a=f[r];a&&l(a)&&a.length>0&&u(a)}};return u(o),o}function Xt(t,e="children"){const n=r=>{const o={...r},c=r[e];return c&&l(c)&&(o[e]=c.map(u=>n(u))),o};return l(t)?t.map(r=>n(r)):[n(t)]}function Zt(t,e="key",n="children"){const r=[],o=new Set,c=new Set,u=(s,f="")=>{if(!h(s)){r.push(`Invalid node at ${f}: node must be an object`);return}if(o.has(s)){r.push(`Circular reference detected at ${f}`);return}o.add(s),e in s&&s[e]!==void 0&&(c.has(s[e])?r.push(`Duplicate key "${s[e]}" found at ${f}`):c.add(s[e]));const a=s[n];a!==void 0&&(l(a)?a.forEach((_,d)=>{u(_,`${f}[${d}]`)}):r.push(`Invalid children at ${f}: children must be an array`)),o.delete(s)};return l(t)?t.forEach((s,f)=>{u(s,`[${f}]`)}):u(t,"root"),{valid:r.length===0,errors:r}}function xt(t,e,n="children"){const r=[],o=p(e)?e:u=>{if(!e||typeof e!="object")return!1;for(const[s,f]of Object.entries(e))if(u[s]!==f)return!1;return!0},c=u=>{typeof o=="function"&&o(u)&&r.push(u);const s=u[n];if(s&&l(s))for(const f of s)c(f)};if(l(t))for(const u of t)c(u);else c(t);return r}function U(t){if(!t&&t!==0)return"0";const e=E(t);return isNaN(e)?`${t}`:`${e}`.replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,"$1,")}function E(t){if(m(t))return t;if(z(t)){const e=parseFloat(t);return isNaN(e)?Number.NaN:e}return Number.NaN}function q(t,e){const n=E(t);return isNaN(n)?Number.NaN:Number(n.toFixed(e))}function te(t,e="¥",n=2){if(!m(t))return e+"0.00";let r;n===0?r=Math.floor(t).toString():r=t.toFixed(n);const o=U(r);return e+o}function ee(t,e,n){return m(t)?Math.max(e,Math.min(n,t)):Number.NaN}function ne(t,e=2){const n=E(t);return isNaN(n)?"0%":(n*100).toFixed(e)+"%"}function re(t){return m(t)?t%2===0:!1}function oe(t){return m(t)?Math.trunc(t):Number.NaN}function ie(t){return m(t)?t-Math.trunc(t):Number.NaN}function ce(t,e=0){if(!m(t))return Number.NaN;const n=Math.pow(10,e);return Math.round(t*n)/n}function ue(t,e=0){if(!m(t))return Number.NaN;const n=Math.pow(10,e);return Math.ceil(t*n)/n}function se(t,e=0){if(!m(t))return Number.NaN;const n=Math.pow(10,e);return Math.floor(t*n)/n}function fe(t,e,n=2){if(!m(t)||!m(e)||e===0)return Number.NaN;const r=t/e*100;return q(r,n)}function g(t="local"){return t==="local"?localStorage:sessionStorage}function S(t,e=null){try{return JSON.parse(t)}catch(n){return console.error("JSON解析错误:",n),e}}function ae(){const t=localStorage.getItem("token");if(!t)return null;const e=S(t);return e!==null?e.expiry!=null&&e.expiry<Date.now()?(localStorage.removeItem("token"),null):e.value:null}function le(t,e=10080*60){const n=Date.now()+e*1e3,r={value:t,expiry:n};localStorage.setItem("token",JSON.stringify(r))}function _e(){localStorage.removeItem("token")}function J(t,e,n="local"){const r=g(n);e!==void 0&&r.setItem(t,JSON.stringify(e))}function V(t,e="local"){const r=g(e).getItem(t);return r?S(r):null}function K(t,e="local"){g(e).removeItem(t)}function de(t="local"){g(t).clear()}function he(t,e,n,r="local"){const o=g(r),c={value:e,expiry:Date.now()+n*1e3};o.setItem(t,JSON.stringify(c))}function me(t,e="local"){const n=g(e),r=n.getItem(t);if(!r)return null;const o=S(r);return o.expiry&&o.expiry<Date.now()?(n.removeItem(t),null):o.value}function ge(t,e="local"){return g(e).getItem(t)!==null}function Y(t="local"){const e=g(t),n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o&&n.push(o)}return n}function ye(t="local"){const e=g(t),n=Y(t);let r=0;return n.forEach(o=>{const c=e.getItem(o);if(c){const u=S(c);u.expiry&&u.expiry<Date.now()&&(e.removeItem(o),r++)}}),r}function pe(t){try{return btoa(unescape(encodeURIComponent(t)))}catch(e){return console.error("加密错误:",e),t}}function be(t){try{return decodeURIComponent(escape(atob(t)))}catch(e){return console.error("解密错误:",e),t}}function we(t,e,n="local"){const r=g(n),o=JSON.stringify(e),c=pe(o);r.setItem(t,c)}function ve(t,e="local"){const r=g(e).getItem(t);if(!r)return null;try{const o=be(r);return JSON.parse(o)}catch(o){return console.error("解密解析错误:",o),null}}function Me(t,e="local"){t.forEach(n=>{J(n.key,n.value,e)})}function Ne(t,e="local"){const n={};return t.forEach(r=>{n[r]=V(r,e)}),n}function Oe(t,e="local"){t.forEach(n=>{K(n,e)})}function k(t){const e=Object.prototype.toString;if(!t||typeof t!="object")return t;if(t.nodeType&&"cloneNode"in t)return t.cloneNode(!0);if(e.call(t)==="[object Date]")return new Date(t.getTime());if(e.call(t)==="[object RegExp]"){const r=[];return t.global&&r.push("g"),t.multiline&&r.push("m"),t.ignoreCase&&r.push("i"),new RegExp(t.source,r.join(""))}if(e.call(t)==="[object FormData]"){const r=new FormData;for(const[o,c]of t.entries())r.append(o,c);return r}if(e.call(t)==="[object Map]"){const r=new Map;for(const[o,c]of t.entries())r.set(o,k(c));return r}if(e.call(t)==="[object Set]"){const r=new Set;for(const o of t.values())r.add(k(o));return r}const n=Array.isArray(t)?[]:t.constructor?new t.constructor:{};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=k(t[r]));return n}function G(...t){let e=t.length,n=t[0];h(n)||(n={});for(let r=1;r<e;r++){let o=t[r];if(h(o))for(let c in o)c==="__proto__"||n===o[c]||(h(o[c])?(h(n[c])||(n[c]=Array.isArray(o[c])?[]:{}),n[c]=G(n[c],o[c])):n[c]=o[c])}return n}function I(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let n,r,o;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!I(t[r],e[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const c=o[r];if(!I(t[c],e[c]))return!1}return!0}return t!==t&&e!==e}function $e(t){return h(t)&&Object.keys(t).length===0}function Ee(t,e){if(!h(t))return{};const n={};return e.forEach(r=>{r in t&&(n[r]=t[r])}),n}function Se(t,e){if(!h(t))return{};const n={};return Object.keys(t).forEach(r=>{e.includes(r)||(n[r]=t[r])}),n}function Q(t,e=""){if(!h(t))return{};const n={};return Object.keys(t).forEach(r=>{const o=e?`${e}.${r}`:r;h(t[r])&&!Array.isArray(t[r])?Object.assign(n,Q(t[r],o)):n[o]=t[r]}),n}function ke(t){if(!h(t))return{};const e={};return Object.keys(t).forEach(n=>{const r=n.split(".");let o=e;r.forEach((c,u)=>{u===r.length-1?o[c]=t[n]:(o[c]||(o[c]={}),o=o[c])})}),e}function Ie(t,e,n=void 0){if(!h(t))return n;const r=e.split(".");let o=t;for(const c of r){if(o==null)return n;o=o[c]}return o!==void 0?o:n}function Fe(t,e,n){h(t)||(t={});const r=e.split(".");let o=t;return r.forEach((c,u)=>{u===r.length-1?o[c]=n:(h(o[c])||(o[c]={}),o=o[c])}),t}function Ae(...t){return Object.assign({},...t)}function Le(t,e){const n={};return!h(t)&&!h(e)?n:h(t)?h(e)?(new Set([...Object.keys(t),...Object.keys(e)]).forEach(o=>{I(t[o],e[o])||(n[o]={oldValue:t[o],newValue:e[o]})}),n):t:e}function X(t,e){return!t||t.tagName==="BODY"?null:t.classList.contains(e)?t:X(t.parentElement,e)}function ze(t,e=!0){const n=document.getElementById(t);n&&n.scrollTo({top:n.scrollHeight,behavior:e?"smooth":void 0})}function Te(t,e=document){return e.querySelector(t)}function je(t,e=document){return Array.from(e.querySelectorAll(t))}function De(t,e){t&&!t.classList.contains(e)&&t.classList.add(e)}function Pe(t,e){t&&t.classList.contains(e)&&t.classList.remove(e)}function Re(t,e){return t?t.classList.toggle(e):!1}function Ce(t,e){return t?t.classList.contains(e):!1}function We(t,e){return t?window.getComputedStyle(t).getPropertyValue(e):""}function He(t,e,n){t&&"style"in t&&(t.style[e]=n)}function Z(t,e){t&&"style"in t&&Object.entries(e).forEach(([n,r])=>{t.style[n]=r})}function Be(t,e){return t&&t.getAttribute(e)||""}function x(t,e,n){t&&t.setAttribute(e,n)}function Ue(t,e){t&&t.removeAttribute(e)}function qe(t,e,n,r){t&&t.addEventListener(e,n,r)}function Je(t,e,n,r){t&&t.removeEventListener(e,n,r)}function Ve(t,e){const n=document.createElement(t);return e&&(e.class_name&&(n.className=e.class_name),e.style&&Z(n,e.style),e.attributes&&Object.entries(e.attributes).forEach(([r,o])=>{x(n,r,o)}),e.text&&(n.textContent=e.text)),n}function O(t){return t?t.getBoundingClientRect():null}function tt(t){if(!t)return null;const e=O(t);return e?{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset}:null}function Ke(t){if(!t)return null;const e=O(t);return e?{width:e.width,height:e.height}:null}function Ye(t,e){if(!t)return;const{behavior:n="smooth",offsetTop:r=0,offsetLeft:o=0}=e||{},c=tt(t);c&&window.scrollTo({top:c.top-r,left:c.left-o,behavior:n})}function Ge(t){if(!t)return!1;const e=O(t);return e?e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth):!1}function Qe(t){if(!t)return!1;const e=O(t);return e?e.top>0&&e.left>0&&e.bottom<(window.innerHeight||document.documentElement.clientHeight)&&e.right<(window.innerWidth||document.documentElement.clientWidth):!1}function Xe(){return{width:window.innerWidth||document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}}function Ze(){return{width:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.documentElement.clientWidth),height:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.documentElement.clientHeight)}}function xe(t,e=1920){let n=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;if(!n)return t;let r=n/e;return Number((t*r).toFixed(3))}function j({path:t,name:e}){const n=document.createElement("a");n.href=t,n.target="_blank",e&&n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function tn(t){t.forEach(e=>{j({path:e.url,name:e.name})})}async function en(t){if(!t)return;const e=new FileReader;return e.readAsDataURL(t),new Promise((n,r)=>{e.onload=o=>n(o.target?.result),e.onerror=o=>r(void 0)})}async function nn(t,e="UTF-8"){if(!t)return;const n=new FileReader;return n.readAsText(t,e),new Promise((r,o)=>{n.onload=c=>r(c.target?.result),n.onerror=()=>o(void 0)})}function F(t){if(!t)return"";const e=t.lastIndexOf(".");return e===-1?"":t.substring(e+1).toLowerCase()}function D(t){if(!t)return"";const e=t.lastIndexOf(".");return e===-1?t:t.substring(0,e)}function rn(t,e){return t.size<=e}function on(t,e){const n=F(t.name);return e.includes(n)}function cn(t,e,n){return new File([t],e,{type:n})}function un(t,e,n="text/plain"){const r=new Blob([t],{type:n}),o=URL.createObjectURL(r);j({path:o,name:e}),URL.revokeObjectURL(o)}async function sn(t,e=800,n=800,r=.8){if(t.type.startsWith("image/"))return new Promise(o=>{const c=document.createElement("canvas"),u=c.getContext("2d"),s=new Image;s.onload=()=>{let{width:f,height:a}=s;if(f>e||a>n){const _=Math.min(e/f,n/a);f*=_,a*=_}c.width=f,c.height=a,u?.drawImage(s,0,0,f,a),c.toBlob(_=>{if(_){const d=new File([_],t.name,{type:t.type});o(d)}else o(void 0)},t.type,r)},s.src=URL.createObjectURL(t)})}function fn(t){const e=F(t.name),n=D(t.name);let r="";return t.size<1024?r=`${t.size} B`:t.size<1024*1024?r=`${(t.size/1024).toFixed(2)} KB`:t.size<1024*1024*1024?r=`${(t.size/(1024*1024)).toFixed(2)} MB`:r=`${(t.size/(1024*1024*1024)).toFixed(2)} GB`,{name:t.name,size:t.size,size_text:r,type:t.type,extension:e,name_without_extension:n}}function an(t){const e=F(t),n=D(t),r=Date.now(),o=Math.random().toString(36).substring(2,8);return e?`${n}_${r}_${o}.${e}`:`${n}_${r}_${o}`}function et(t){return/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.test(t)}function ln(t,e,n){if(!et(t)||!et(e))return t;n=Math.max(Math.min(Number(n),1),0);const r=b(t),o=b(e);if(!r||!o)return t;const c=Math.round(r.r*(1-n)+o.r*n),u=Math.round(r.g*(1-n)+o.g*n),s=Math.round(r.b*(1-n)+o.b*n);return $(c,u,s)}function _n(t){const e=b(t);return e?`${e.r},${e.g},${e.b}`:"0,0,0"}function b(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}function $(t,e,n){return t=Math.max(0,Math.min(255,Math.round(t))),e=Math.max(0,Math.min(255,Math.round(e))),n=Math.max(0,Math.min(255,Math.round(n))),`#${((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)}`}function dn(t,e,n,r){return $(t,e,n)}function hn(t,e){const n=b(t);if(!n)return t;e=Math.max(0,Math.min(1,e));const r=Math.min(255,Math.round(n.r+(255-n.r)*e)),o=Math.min(255,Math.round(n.g+(255-n.g)*e)),c=Math.min(255,Math.round(n.b+(255-n.b)*e));return $(r,o,c)}function mn(t,e){const n=b(t);if(!n)return t;e=Math.max(0,Math.min(1,e));const r=Math.max(0,Math.round(n.r*(1-e))),o=Math.max(0,Math.round(n.g*(1-e))),c=Math.max(0,Math.round(n.b*(1-e)));return $(r,o,c)}function P(t){const e=b(t);return e?(e.r*299+e.g*587+e.b*114)/1e3>128:!1}function gn(t){return!P(t)}function yn(t){return P(t)?"#000000":"#FFFFFF"}function pn(t,e=200,n=!1){let r;return function(...o){const c=this;if(r&&clearTimeout(r),n){const u=!r;if(r=setTimeout(()=>{r=void 0},e),u)return t.apply(c,o)}else r=setTimeout(()=>{t.apply(c,o)},e)}}function bn(t,e=200,n={}){const{leading:r=!0,trailing:o=!0}=n;let c=0,u,s,f;return function(...a){const _=this,d=Date.now();if(c===0){r&&t.apply(_,a),c=d;return}s=a,f=_;const v=d-c;if(v>=e){u&&(clearTimeout(u),u=void 0),t.apply(_,a),c=d;return}!u&&o&&(u=setTimeout(()=>{s&&(t.apply(f,s),c=Date.now()),u=void 0,s=void 0,f=void 0},e-v))}}function wn(t){const e=t.length;function n(...r){return r.length>=e?t.apply(this,r):function(...o){return n.apply(this,[...r,...o])}}return n}function vn(...t){return function(e){return t.reduceRight((n,r)=>r(n),e)}}function Mn(...t){return function(e){return t.reduce((n,r)=>r(n),e)}}function Nn(t,e=1e3){return new Promise(n=>{setTimeout(()=>{n(t())},e)})}async function nt(t,e=3,n=1e3){try{return await t()}catch(r){if(e<=0)throw r;return await new Promise(o=>setTimeout(o,n)),nt(t,e-1,n)}}function On(t){let e=!1,n;return function(...r){return e||(e=!0,n=t.apply(this,r)),n}}function $n(t){const e=new Map;return function(...n){const r=JSON.stringify(n);if(e.has(r))return e.get(r);const o=t.apply(this,n);return e.set(r,o),o}}async function En(t,e=!0){if(e)return Promise.all(t.map(n=>n()));{const n=[];for(const r of t)n.push(await r());return n}}function Sn(t,e=5e3,n="Operation timed out"){return Promise.race([Promise.resolve(t()),new Promise((r,o)=>{setTimeout(()=>{o(new Error(n))},e)})])}const y=new Map;let A=null;H&&(document.addEventListener("mousedown",t=>{A=t}),document.addEventListener("mouseup",t=>{for(const e of y.values())for(const{document_handler:n}of e)A&&n(t,A);A=null}));function rt(t,e){const n=[];return Array.isArray(e.arg)?n.push(...e.arg.filter(L)):L(e.arg)&&n.push(e.arg),function(r,o){const c=r.target,u=o.target;if(!c||!u||!e.instance)return;const s=t.contains(c)||t.contains(u),f=t===c,a=n.some(d=>d&&(d.contains(c)||d===u));let _=!1;try{const d=e.instance.popperRef;d&&(_=d.contains(c)||d.contains(u))}catch{}s||f||a||_||typeof e.value=="function"&&e.value(r,o)}}const ot={beforeMount(t,e){y.has(t)||y.set(t,[]),y.get(t)?.push({document_handler:rt(t,e),binding_fn:e.value})},updated(t,e){y.has(t)||y.set(t,[]);const n=y.get(t);if(!n)return;const r=n.findIndex(c=>c.binding_fn===e.oldValue),o={document_handler:rt(t,e),binding_fn:e.value};r>=0?n.splice(r,1,o):n.push(o)},unmounted(t){y.delete(t)}};function kn(t){t.directive("click-outside",ot)}i.ClickOutside=ot,i.add_class=De,i.add_tree_node=Kt,i.add_tree_node_path=Bt,i.auto_size=xe,i.batch_execution=En,i.build_tree=Pt,i.calculate_percentage=fe,i.ceil=ue,i.clamp=ee,i.clear_expired_storage=ye,i.clear_storage=de,i.clone_tree=Xt,i.compose=vn,i.compress_image=sn,i.create_element=Ve,i.create_file_from_blob=cn,i.curry=wn,i.darken=mn,i.debounce=pn,i.decrypt_storage=ve,i.deep_assign=G,i.deep_clone=k,i.deep_equal=I,i.delay_execution=Nn,i.diff_objects=Le,i.download_file=j,i.download_files=tn,i.download_text_file=un,i.encrypt_storage=we,i.filter_tree=Wt,i.find_tree_node=B,i.find_tree_node_by_key=T,i.flatten_object=Q,i.flatten_tree_to_array=Vt,i.floor=se,i.format_currency=te,i.generate_unique_file_name=an,i.get_all_storage_keys=Y,i.get_attribute=Be,i.get_batch_storage=Ne,i.get_contrast_color=yn,i.get_decimal_part=ie,i.get_document_size=Ze,i.get_element=Te,i.get_element_position=tt,i.get_element_rect=O,i.get_element_size=Ke,i.get_elements=je,i.get_file_extension=F,i.get_file_info=fn,i.get_file_name_without_extension=D,i.get_integer_part=oe,i.get_object_value=Ie,i.get_parent_by_class=X,i.get_rgb=_n,i.get_storage=V,i.get_storage_with_expiry=me,i.get_style=We,i.get_token=ae,i.get_tree_depth=Jt,i.get_tree_node_ancestors=qt,i.get_tree_node_descendants=Ut,i.get_window_size=Xe,i.guid=st,i.has_class=Ce,i.has_storage=ge,i.hex_to_rgb=b,i.is_array=l,i.is_boolean=vt,i.is_client=H,i.is_completely_in_viewport=Qe,i.is_dark=gn,i.is_date=W,i.is_element=L,i.is_email=At,i.is_empty=$t,i.is_empty_object=$e,i.is_even=re,i.is_falsy=St,i.is_function=p,i.is_hex_color=zt,i.is_html_element=kt,i.is_in_viewport=Ge,i.is_ip=Tt,i.is_light=P,i.is_mobile=Ft,i.is_null=pt,i.is_number=m,i.is_object=h,i.is_plain_object=bt,i.is_port=jt,i.is_promise=Ot,i.is_reg_exp=Mt,i.is_string=z,i.is_string_number=It,i.is_symbol=Nt,i.is_truthy=Et,i.is_undefined=yt,i.is_url=Lt,i.is_valid_date=wt,i.lighten=hn,i.memoize=$n,i.merge_objects=Ae,i.mix=ln,i.off=Je,i.omit=Se,i.on=qe,i.once=On,i.pick=Ee,i.pipe=Mn,i.random_boolean=ft,i.random_color=lt,i.random_element=w,i.random_elements=at,i.random_email=ht,i.random_float=ut,i.random_id=M,i.random_int=it,i.random_int_range=ct,i.random_len_string=N,i.random_number_string=C,i.random_password=_t,i.random_phone=dt,i.random_string=R,i.random_url=mt,i.read_file=nn,i.remove_attribute=Ue,i.remove_batch_storage=Oe,i.remove_class=Pe,i.remove_storage=K,i.remove_token=_e,i.remove_tree_node=Yt,i.retry=nt,i.rgb_to_hex=$,i.rgba_to_hex=dn,i.round=ce,i.scroll_footer=ze,i.scroll_to_element=Ye,i.search_tree=xt,i.set_attribute=x,i.set_batch_storage=Me,i.set_object_value=Fe,i.set_storage=J,i.set_storage_with_expiry=he,i.set_style=He,i.set_styles=Z,i.set_token=le,i.setupDirectives=kn,i.shuffle_array=gt,i.sort_tree=Qt,i.thousand_separator=U,i.throttle=bn,i.timeout=Sn,i.to_base64=en,i.to_fixed=q,i.to_number=E,i.to_percentage=ne,i.toggle_class=Re,i.transform_tree=Ht,i.traverse_tree_breadth_first=Ct,i.traverse_tree_depth_first=Rt,i.tree_flat=Dt,i.unflatten_object=ke,i.update_tree_node=Gt,i.validate_file_size=rn,i.validate_file_type=on,i.validate_tree=Zt,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(i,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(i=typeof globalThis<"u"?globalThis:i||self,M(i.QyBetterLibCore={}))})(this,(function(i){"use strict";function M(){return Math.floor(Math.random()*1e4)}function it(t){return t<0?0:Math.floor(Math.random()*Math.floor(t))}function ct(t,e){return t>e&&([t,e]=[e,t]),Math.floor(Math.random()*(e-t+1))+t}function ut(t,e,n=2){t>e&&([t,e]=[e,t]);const r=Math.random()*(e-t)+t;return parseFloat(r.toFixed(n))}function st(){const t=R;return`${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}`}function R(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}function N(t,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"){let n="";const r=e.length;for(let o=0;o<t;o++)n+=e.charAt(Math.floor(Math.random()*r));return n}function ft(){return Math.random()>.5}function w(t){if(!(!t||t.length===0))return t[Math.floor(Math.random()*t.length)]}function at(t,e){return!t||t.length===0||e<=0?[]:e>=t.length?[...t]:[...t].sort(()=>.5-Math.random()).slice(0,e)}function lt(){const t="0123456789ABCDEF";let e="#";for(let n=0;n<6;n++)e+=t[Math.floor(Math.random()*16)];return e}function W(t){return N(t,"0123456789")}function _t(t=8){return N(t,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+~`|}{[]:;?><,./-=")}function dt(){const e=w(["130","131","132","133","134","135","136","137","138","139","150","151","152","153","155","156","157","158","159","170","171","172","173","175","176","177","178","180","181","182","183","184","185","186","187","188","189"]),n=W(8);return`${e}${n}`}function ht(){const t=["gmail.com","yahoo.com","hotmail.com","outlook.com","163.com","126.com","qq.com","sina.com"],e=N(8),n=w(t);return`${e}@${n}`}function mt(){const t=["http","https"],e=["example.com","test.com","demo.com","sample.com"],n=["api","docs","about","contact","products"],r=w(t),o=w(e),c=w(n),u=N(4);return`${r}://www.${o}/${c}?id=${u}`}function gt(t){if(!t)return[];const e=[...t];for(let n=e.length-1;n>0;n--){const r=Math.floor(Math.random()*(n+1));[e[n],e[r]]=[e[r],e[n]]}return e}function yt(t){return t===void 0}function pt(t){return t===null}function l(t){return Array.isArray(t)}function h(t){return typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]"}function bt(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function C(t){return Object.prototype.toString.call(t)==="[object Date]"}function wt(t){return C(t)&&!isNaN(t.getTime())}function vt(t){return typeof t=="boolean"}function p(t){return typeof t=="function"}function Mt(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Nt(t){return typeof t=="symbol"}function Ot(t){return typeof t=="object"&&t!==null&&typeof t.then=="function"&&typeof t.catch=="function"}function $t(t){return!t&&t!==0||l(t)&&t.length===0||h(t)&&!Object.keys(t).length}function Et(t){return!!t}function St(t){return!t}function L(t){return typeof Element>"u"?!1:t instanceof Element}function kt(t){return typeof HTMLElement>"u"?!1:t instanceof HTMLElement}const H=typeof window<"u";function m(t){return typeof t=="number"&&!isNaN(t)}function z(t){return typeof t=="string"}function It(t){return z(t)?!Number.isNaN(Number(t)):!1}function Ft(t){return/^1[3-9]\d{9}$/.test(t)}function At(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}function Lt(t){try{return new URL(t),!0}catch{return!1}}function zt(t){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(t)}function Tt(t){return/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(t)}function jt(t){return/^(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)$/.test(t)}function Dt(t,e="key",n="children"){const r={};if(!l(t))return r;const o=[{nodes:t}];for(;o.length>0;){const{nodes:c,parent_key:u}=o.pop();for(const s of c){const f=s[e];if(f&&!r[f]){r[f]=s,u&&r[u]&&(r[f].parent=r[u]);const a=s[n];a&&l(a)&&a.length>0&&o.push({nodes:a,parent_key:f})}}}return r}function Pt(t,e="key",n="parentId",r="children"){if(!l(t))return[];const o={},c=[];for(const u of t)o[u[e]]={...u},o[u[e]][r]||(o[u[e]][r]=[]);for(const u of t){const s=u[n];!s||!o[s]?c.push(o[u[e]]):o[s][r].push(o[u[e]])}return c}function Rt(t,e,n="children"){if(!e||!p(e))return!1;let r=!1;const o=l(t)?t:[t],c=[];for(const u of o)c.push({node:u,depth:0});for(;c.length>0;){const{node:u,depth:s}=c.pop();if(e(u,s)===!1){r=!0;break}const a=u[n];if(a&&l(a)&&a.length>0)for(let _=a.length-1;_>=0;_--)c.push({node:a[_],depth:s+1})}return r}function Wt(t,e,n="children"){if(!e||!p(e))return!1;const r=[];if(l(t))for(const o of t)r.push({node:o,depth:0});else r.push({node:t,depth:0});for(;r.length>0;){const{node:o,depth:c}=r.shift();if(e(o,c)===!1)return!0;const s=o[n];if(s&&l(s))for(const f of s)r.push({node:f,depth:c+1})}return!1}function B(t,e,n="children"){if(!e||!p(e))return null;let r=null;const o=c=>{if(e(c))return r=c,!0;const u=c[n];if(u&&l(u)){for(const s of u)if(o(s))return!0}return!1};if(l(t)){for(const c of t)if(o(c))break}else o(t);return r}function T(t,e,n="key",r="children"){return B(t,o=>o[n]===e,r)}function Ct(t,e,n="children"){if(!e||!p(e))return[];const r=o=>{const c=o[n],u=[];if(c&&l(c))for(const s of c){const f=r(s);f&&u.push(f)}return e(o)||u.length>0?{...o,[n]:u}:null};if(l(t)){const o=[];for(const c of t){const u=r(c);u&&o.push(u)}return o}else{const o=r(t);return o?[o]:[]}}function Ht(t,e,n="children"){if(!e||!p(e))return[];const r=o=>{const c=e(o),u=o[n];return u&&l(u)&&(c[n]=u.map(s=>r(s))),c};return l(t)?t.map(o=>r(o)):[r(t)]}function Bt(t,e="key",n="path",r="children"){const o=(c,u="")=>{const s=c[e],f=u?`${u}.${s}`:String(s),a={...c,[n]:f},_=c[r];return _&&l(_)&&(a[r]=_.map(d=>o(d,f))),a};return l(t)?t.map(c=>o(c)):[o(t)]}function Ut(t,e="children"){const n=[],r=o=>{const c=o[e];if(c&&l(c))for(const u of c)n.push(u),r(u)};return r(t),n}function qt(t,e="parent"){const n=[];let r=t[e];for(;r;)n.unshift(r),r=r[e];return n}function Jt(t,e="children"){const n=r=>{const o=r[e];if(!o||!l(o)||o.length===0)return 1;const c=o.map(u=>n(u));return Math.max(...c)+1};if(l(t)){if(t.length===0)return 0;const r=t.map(o=>n(o));return Math.max(...r)}else return n(t)}function Vt(t,e="children"){const n=[],r=o=>{n.push(o);const c=o[e];if(c&&l(c))for(const u of c)r(u)};if(l(t))for(const o of t)r(o);else r(t);return n}function Kt(t,e,n,r="key",o="children"){const c=l(t)?t:[t],u=T(c,e,r,o);return u?(u[o]||(u[o]=[]),u[o].push(n)):c.push(n),c}function Yt(t,e,n="key",r="children"){const o=l(t)?t:[t];let c=null,u=null;const s=(f,a=null)=>{for(let _=0;_<f.length;_++){const d=f[_];if(d[n]===e)return c=d,u=a?a[r]:f,!0;const v=d[r];if(v&&l(v)&&s(v,d))return!0}return!1};if(s(o),c&&u){const f=u.findIndex(a=>a[n]===e);f>-1&&u.splice(f,1)}return o}function Gt(t,e,n,r="key",o="children"){const c=l(t)?t:[t],u=T(c,e,r,o);return u&&Object.assign(u,n),c}function Qt(t,e,n=!0,r="children"){const o=l(t)?t:[t],c=typeof e=="string"?(s,f)=>{const a=s[e],_=f[e];return a<_?-1:a>_?1:0}:e,u=s=>{if(s.sort(c),n)for(const f of s){const a=f[r];a&&l(a)&&a.length>0&&u(a)}};return u(o),o}function Xt(t,e="children"){const n=r=>{const o={...r},c=r[e];return c&&l(c)&&(o[e]=c.map(u=>n(u))),o};return l(t)?t.map(r=>n(r)):[n(t)]}function Zt(t,e="key",n="children"){const r=[],o=new Set,c=new Set,u=(s,f="")=>{if(!h(s)){r.push(`Invalid node at ${f}: node must be an object`);return}if(o.has(s)){r.push(`Circular reference detected at ${f}`);return}o.add(s),e in s&&s[e]!==void 0&&(c.has(s[e])?r.push(`Duplicate key "${s[e]}" found at ${f}`):c.add(s[e]));const a=s[n];a!==void 0&&(l(a)?a.forEach((_,d)=>{u(_,`${f}[${d}]`)}):r.push(`Invalid children at ${f}: children must be an array`)),o.delete(s)};return l(t)?t.forEach((s,f)=>{u(s,`[${f}]`)}):u(t,"root"),{valid:r.length===0,errors:r}}function xt(t,e,n="children"){const r=[],o=p(e)?e:u=>{if(!e||typeof e!="object")return!1;for(const[s,f]of Object.entries(e))if(u[s]!==f)return!1;return!0},c=u=>{typeof o=="function"&&o(u)&&r.push(u);const s=u[n];if(s&&l(s))for(const f of s)c(f)};if(l(t))for(const u of t)c(u);else c(t);return r}function U(t){if(!t&&t!==0)return"0";const e=E(t);return isNaN(e)?`${t}`:`${e}`.replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,"$1,")}function E(t){if(m(t))return t;if(z(t)){const e=parseFloat(t);return isNaN(e)?Number.NaN:e}return Number.NaN}function q(t,e){const n=E(t);return isNaN(n)?Number.NaN:Number(n.toFixed(e))}function te(t,e="¥",n=2){if(!m(t))return e+"0.00";let r;n===0?r=Math.floor(t).toString():r=t.toFixed(n);const o=U(r);return e+o}function ee(t,e,n){return m(t)?Math.max(e,Math.min(n,t)):Number.NaN}function ne(t,e=2){const n=E(t);return isNaN(n)?"0%":(n*100).toFixed(e)+"%"}function re(t){return m(t)?t%2===0:!1}function oe(t){return m(t)?Math.trunc(t):Number.NaN}function ie(t){return m(t)?t-Math.trunc(t):Number.NaN}function ce(t,e=0){if(!m(t))return Number.NaN;const n=Math.pow(10,e);return Math.round(t*n)/n}function ue(t,e=0){if(!m(t))return Number.NaN;const n=Math.pow(10,e);return Math.ceil(t*n)/n}function se(t,e=0){if(!m(t))return Number.NaN;const n=Math.pow(10,e);return Math.floor(t*n)/n}function fe(t,e,n=2){if(!m(t)||!m(e)||e===0)return Number.NaN;const r=t/e*100;return q(r,n)}function g(t="local"){return t==="local"?localStorage:sessionStorage}function S(t,e=null){if(!t||typeof t!="string")return e;if(!t.startsWith("{")&&!t.startsWith("[")&&!t.startsWith('"'))return t;try{return JSON.parse(t)}catch(n){return console.error("JSON解析错误:",n),e}}function ae(){const t=localStorage.getItem("token");if(!t)return null;const e=S(t);return e!==null?e.expiry!=null&&e.expiry<Date.now()?(localStorage.removeItem("token"),null):e.value:null}function le(t,e=10080*60){const n=Date.now()+e*1e3,r={value:t,expiry:n};localStorage.setItem("token",JSON.stringify(r))}function _e(){localStorage.removeItem("token")}function J(t,e,n="local"){const r=g(n);e!==void 0&&r.setItem(t,JSON.stringify(e))}function V(t,e="local"){const r=g(e).getItem(t);return r?S(r):null}function K(t,e="local"){g(e).removeItem(t)}function de(t="local"){g(t).clear()}function he(t,e,n,r="local"){const o=g(r),c={value:e,expiry:Date.now()+n*1e3};o.setItem(t,JSON.stringify(c))}function me(t,e="local"){const n=g(e),r=n.getItem(t);if(!r)return null;const o=S(r);return o.expiry&&o.expiry<Date.now()?(n.removeItem(t),null):o.value}function ge(t,e="local"){return g(e).getItem(t)!==null}function Y(t="local"){const e=g(t),n=[];for(let r=0;r<e.length;r++){const o=e.key(r);o&&n.push(o)}return n}function ye(t="local"){const e=g(t),n=Y(t);let r=0;return n.forEach(o=>{const c=e.getItem(o);if(c){const u=S(c);u.expiry&&u.expiry<Date.now()&&(e.removeItem(o),r++)}}),r}function pe(t){try{return btoa(unescape(encodeURIComponent(t)))}catch(e){return console.error("加密错误:",e),t}}function be(t){try{return decodeURIComponent(escape(atob(t)))}catch(e){return console.error("解密错误:",e),t}}function we(t,e,n="local"){const r=g(n),o=JSON.stringify(e),c=pe(o);r.setItem(t,c)}function ve(t,e="local"){const r=g(e).getItem(t);if(!r)return null;try{const o=be(r);return JSON.parse(o)}catch(o){return console.error("解密解析错误:",o),null}}function Me(t,e="local"){t.forEach(n=>{J(n.key,n.value,e)})}function Ne(t,e="local"){const n={};return t.forEach(r=>{n[r]=V(r,e)}),n}function Oe(t,e="local"){t.forEach(n=>{K(n,e)})}function k(t){const e=Object.prototype.toString;if(!t||typeof t!="object")return t;if(t.nodeType&&"cloneNode"in t)return t.cloneNode(!0);if(e.call(t)==="[object Date]")return new Date(t.getTime());if(e.call(t)==="[object RegExp]"){const r=[];return t.global&&r.push("g"),t.multiline&&r.push("m"),t.ignoreCase&&r.push("i"),new RegExp(t.source,r.join(""))}if(e.call(t)==="[object FormData]"){const r=new FormData;for(const[o,c]of t.entries())r.append(o,c);return r}if(e.call(t)==="[object Map]"){const r=new Map;for(const[o,c]of t.entries())r.set(o,k(c));return r}if(e.call(t)==="[object Set]"){const r=new Set;for(const o of t.values())r.add(k(o));return r}const n=Array.isArray(t)?[]:t.constructor?new t.constructor:{};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=k(t[r]));return n}function G(...t){let e=t.length,n=t[0];h(n)||(n={});for(let r=1;r<e;r++){let o=t[r];if(h(o))for(let c in o)c==="__proto__"||n===o[c]||(h(o[c])?(h(n[c])||(n[c]=Array.isArray(o[c])?[]:{}),n[c]=G(n[c],o[c])):n[c]=o[c])}return n}function I(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let n,r,o;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!I(t[r],e[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const c=o[r];if(!I(t[c],e[c]))return!1}return!0}return t!==t&&e!==e}function $e(t){return h(t)&&Object.keys(t).length===0}function Ee(t,e){if(!h(t))return{};const n={};return e.forEach(r=>{r in t&&(n[r]=t[r])}),n}function Se(t,e){if(!h(t))return{};const n={};return Object.keys(t).forEach(r=>{e.includes(r)||(n[r]=t[r])}),n}function Q(t,e=""){if(!h(t))return{};const n={};return Object.keys(t).forEach(r=>{const o=e?`${e}.${r}`:r;h(t[r])&&!Array.isArray(t[r])?Object.assign(n,Q(t[r],o)):n[o]=t[r]}),n}function ke(t){if(!h(t))return{};const e={};return Object.keys(t).forEach(n=>{const r=n.split(".");let o=e;r.forEach((c,u)=>{u===r.length-1?o[c]=t[n]:(o[c]||(o[c]={}),o=o[c])})}),e}function Ie(t,e,n=void 0){if(!h(t))return n;const r=e.split(".");let o=t;for(const c of r){if(o==null)return n;o=o[c]}return o!==void 0?o:n}function Fe(t,e,n){h(t)||(t={});const r=e.split(".");let o=t;return r.forEach((c,u)=>{u===r.length-1?o[c]=n:(h(o[c])||(o[c]={}),o=o[c])}),t}function Ae(...t){return Object.assign({},...t)}function Le(t,e){const n={};return!h(t)&&!h(e)?n:h(t)?h(e)?(new Set([...Object.keys(t),...Object.keys(e)]).forEach(o=>{I(t[o],e[o])||(n[o]={oldValue:t[o],newValue:e[o]})}),n):t:e}function X(t,e){return!t||t.tagName==="BODY"?null:t.classList.contains(e)?t:X(t.parentElement,e)}function ze(t,e=!0){const n=document.getElementById(t);n&&n.scrollTo({top:n.scrollHeight,behavior:e?"smooth":void 0})}function Te(t,e=document){return e.querySelector(t)}function je(t,e=document){return Array.from(e.querySelectorAll(t))}function De(t,e){t&&!t.classList.contains(e)&&t.classList.add(e)}function Pe(t,e){t&&t.classList.contains(e)&&t.classList.remove(e)}function Re(t,e){return t?t.classList.toggle(e):!1}function We(t,e){return t?t.classList.contains(e):!1}function Ce(t,e){return t?window.getComputedStyle(t).getPropertyValue(e):""}function He(t,e,n){t&&"style"in t&&(t.style[e]=n)}function Z(t,e){t&&"style"in t&&Object.entries(e).forEach(([n,r])=>{t.style[n]=r})}function Be(t,e){return t&&t.getAttribute(e)||""}function x(t,e,n){t&&t.setAttribute(e,n)}function Ue(t,e){t&&t.removeAttribute(e)}function qe(t,e,n,r){t&&t.addEventListener(e,n,r)}function Je(t,e,n,r){t&&t.removeEventListener(e,n,r)}function Ve(t,e){const n=document.createElement(t);return e&&(e.class_name&&(n.className=e.class_name),e.style&&Z(n,e.style),e.attributes&&Object.entries(e.attributes).forEach(([r,o])=>{x(n,r,o)}),e.text&&(n.textContent=e.text)),n}function O(t){return t?t.getBoundingClientRect():null}function tt(t){if(!t)return null;const e=O(t);return e?{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset}:null}function Ke(t){if(!t)return null;const e=O(t);return e?{width:e.width,height:e.height}:null}function Ye(t,e){if(!t)return;const{behavior:n="smooth",offsetTop:r=0,offsetLeft:o=0}=e||{},c=tt(t);c&&window.scrollTo({top:c.top-r,left:c.left-o,behavior:n})}function Ge(t){if(!t)return!1;const e=O(t);return e?e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth):!1}function Qe(t){if(!t)return!1;const e=O(t);return e?e.top>0&&e.left>0&&e.bottom<(window.innerHeight||document.documentElement.clientHeight)&&e.right<(window.innerWidth||document.documentElement.clientWidth):!1}function Xe(){return{width:window.innerWidth||document.documentElement.clientWidth,height:window.innerHeight||document.documentElement.clientHeight}}function Ze(){return{width:Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.documentElement.clientWidth),height:Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.documentElement.clientHeight)}}function xe(t,e=1920){let n=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;if(!n)return t;let r=n/e;return Number((t*r).toFixed(3))}function j({path:t,name:e}){const n=document.createElement("a");n.href=t,n.target="_blank",e&&n.setAttribute("download",e),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function tn(t){t.forEach(e=>{j({path:e.url,name:e.name})})}async function en(t){if(!t)return;const e=new FileReader;return e.readAsDataURL(t),new Promise((n,r)=>{e.onload=o=>n(o.target?.result),e.onerror=o=>r(void 0)})}async function nn(t,e="UTF-8"){if(!t)return;const n=new FileReader;return n.readAsText(t,e),new Promise((r,o)=>{n.onload=c=>r(c.target?.result),n.onerror=()=>o(void 0)})}function F(t){if(!t)return"";const e=t.lastIndexOf(".");return e===-1?"":t.substring(e+1).toLowerCase()}function D(t){if(!t)return"";const e=t.lastIndexOf(".");return e===-1?t:t.substring(0,e)}function rn(t,e){return t.size<=e}function on(t,e){const n=F(t.name);return e.includes(n)}function cn(t,e,n){return new File([t],e,{type:n})}function un(t,e,n="text/plain"){const r=new Blob([t],{type:n}),o=URL.createObjectURL(r);j({path:o,name:e}),URL.revokeObjectURL(o)}async function sn(t,e=800,n=800,r=.8){if(t.type.startsWith("image/"))return new Promise(o=>{const c=document.createElement("canvas"),u=c.getContext("2d"),s=new Image;s.onload=()=>{let{width:f,height:a}=s;if(f>e||a>n){const _=Math.min(e/f,n/a);f*=_,a*=_}c.width=f,c.height=a,u?.drawImage(s,0,0,f,a),c.toBlob(_=>{if(_){const d=new File([_],t.name,{type:t.type});o(d)}else o(void 0)},t.type,r)},s.src=URL.createObjectURL(t)})}function fn(t){const e=F(t.name),n=D(t.name);let r="";return t.size<1024?r=`${t.size} B`:t.size<1024*1024?r=`${(t.size/1024).toFixed(2)} KB`:t.size<1024*1024*1024?r=`${(t.size/(1024*1024)).toFixed(2)} MB`:r=`${(t.size/(1024*1024*1024)).toFixed(2)} GB`,{name:t.name,size:t.size,size_text:r,type:t.type,extension:e,name_without_extension:n}}function an(t){const e=F(t),n=D(t),r=Date.now(),o=Math.random().toString(36).substring(2,8);return e?`${n}_${r}_${o}.${e}`:`${n}_${r}_${o}`}function et(t){return/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.test(t)}function ln(t,e,n){if(!et(t)||!et(e))return t;n=Math.max(Math.min(Number(n),1),0);const r=b(t),o=b(e);if(!r||!o)return t;const c=Math.round(r.r*(1-n)+o.r*n),u=Math.round(r.g*(1-n)+o.g*n),s=Math.round(r.b*(1-n)+o.b*n);return $(c,u,s)}function _n(t){const e=b(t);return e?`${e.r},${e.g},${e.b}`:"0,0,0"}function b(t){const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}function $(t,e,n){return t=Math.max(0,Math.min(255,Math.round(t))),e=Math.max(0,Math.min(255,Math.round(e))),n=Math.max(0,Math.min(255,Math.round(n))),`#${((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)}`}function dn(t,e,n,r){return $(t,e,n)}function hn(t,e){const n=b(t);if(!n)return t;e=Math.max(0,Math.min(1,e));const r=Math.min(255,Math.round(n.r+(255-n.r)*e)),o=Math.min(255,Math.round(n.g+(255-n.g)*e)),c=Math.min(255,Math.round(n.b+(255-n.b)*e));return $(r,o,c)}function mn(t,e){const n=b(t);if(!n)return t;e=Math.max(0,Math.min(1,e));const r=Math.max(0,Math.round(n.r*(1-e))),o=Math.max(0,Math.round(n.g*(1-e))),c=Math.max(0,Math.round(n.b*(1-e)));return $(r,o,c)}function P(t){const e=b(t);return e?(e.r*299+e.g*587+e.b*114)/1e3>128:!1}function gn(t){return!P(t)}function yn(t){return P(t)?"#000000":"#FFFFFF"}function pn(t,e=200,n=!1){let r;return function(...o){const c=this;if(r&&clearTimeout(r),n){const u=!r;if(r=setTimeout(()=>{r=void 0},e),u)return t.apply(c,o)}else r=setTimeout(()=>{t.apply(c,o)},e)}}function bn(t,e=200,n={}){const{leading:r=!0,trailing:o=!0}=n;let c=0,u,s,f;return function(...a){const _=this,d=Date.now();if(c===0){r&&t.apply(_,a),c=d;return}s=a,f=_;const v=d-c;if(v>=e){u&&(clearTimeout(u),u=void 0),t.apply(_,a),c=d;return}!u&&o&&(u=setTimeout(()=>{s&&(t.apply(f,s),c=Date.now()),u=void 0,s=void 0,f=void 0},e-v))}}function wn(t){const e=t.length;function n(...r){return r.length>=e?t.apply(this,r):function(...o){return n.apply(this,[...r,...o])}}return n}function vn(...t){return function(e){return t.reduceRight((n,r)=>r(n),e)}}function Mn(...t){return function(e){return t.reduce((n,r)=>r(n),e)}}function Nn(t,e=1e3){return new Promise(n=>{setTimeout(()=>{n(t())},e)})}async function nt(t,e=3,n=1e3){try{return await t()}catch(r){if(e<=0)throw r;return await new Promise(o=>setTimeout(o,n)),nt(t,e-1,n)}}function On(t){let e=!1,n;return function(...r){return e||(e=!0,n=t.apply(this,r)),n}}function $n(t){const e=new Map;return function(...n){const r=JSON.stringify(n);if(e.has(r))return e.get(r);const o=t.apply(this,n);return e.set(r,o),o}}async function En(t,e=!0){if(e)return Promise.all(t.map(n=>n()));{const n=[];for(const r of t)n.push(await r());return n}}function Sn(t,e=5e3,n="Operation timed out"){return Promise.race([Promise.resolve(t()),new Promise((r,o)=>{setTimeout(()=>{o(new Error(n))},e)})])}const y=new Map;let A=null;H&&(document.addEventListener("mousedown",t=>{A=t}),document.addEventListener("mouseup",t=>{for(const e of y.values())for(const{document_handler:n}of e)A&&n(t,A);A=null}));function rt(t,e){const n=[];return Array.isArray(e.arg)?n.push(...e.arg.filter(L)):L(e.arg)&&n.push(e.arg),function(r,o){const c=r.target,u=o.target;if(!c||!u||!e.instance)return;const s=t.contains(c)||t.contains(u),f=t===c,a=n.some(d=>d&&(d.contains(c)||d===u));let _=!1;try{const d=e.instance.popperRef;d&&(_=d.contains(c)||d.contains(u))}catch{}s||f||a||_||typeof e.value=="function"&&e.value(r,o)}}const ot={beforeMount(t,e){y.has(t)||y.set(t,[]),y.get(t)?.push({document_handler:rt(t,e),binding_fn:e.value})},updated(t,e){y.has(t)||y.set(t,[]);const n=y.get(t);if(!n)return;const r=n.findIndex(c=>c.binding_fn===e.oldValue),o={document_handler:rt(t,e),binding_fn:e.value};r>=0?n.splice(r,1,o):n.push(o)},unmounted(t){y.delete(t)}};function kn(t){t.directive("click-outside",ot)}i.ClickOutside=ot,i.add_class=De,i.add_tree_node=Kt,i.add_tree_node_path=Bt,i.auto_size=xe,i.batch_execution=En,i.build_tree=Pt,i.calculate_percentage=fe,i.ceil=ue,i.clamp=ee,i.clear_expired_storage=ye,i.clear_storage=de,i.clone_tree=Xt,i.compose=vn,i.compress_image=sn,i.create_element=Ve,i.create_file_from_blob=cn,i.curry=wn,i.darken=mn,i.debounce=pn,i.decrypt_storage=ve,i.deep_assign=G,i.deep_clone=k,i.deep_equal=I,i.delay_execution=Nn,i.diff_objects=Le,i.download_file=j,i.download_files=tn,i.download_text_file=un,i.encrypt_storage=we,i.filter_tree=Ct,i.find_tree_node=B,i.find_tree_node_by_key=T,i.flatten_object=Q,i.flatten_tree_to_array=Vt,i.floor=se,i.format_currency=te,i.generate_unique_file_name=an,i.get_all_storage_keys=Y,i.get_attribute=Be,i.get_batch_storage=Ne,i.get_contrast_color=yn,i.get_decimal_part=ie,i.get_document_size=Ze,i.get_element=Te,i.get_element_position=tt,i.get_element_rect=O,i.get_element_size=Ke,i.get_elements=je,i.get_file_extension=F,i.get_file_info=fn,i.get_file_name_without_extension=D,i.get_integer_part=oe,i.get_object_value=Ie,i.get_parent_by_class=X,i.get_rgb=_n,i.get_storage=V,i.get_storage_with_expiry=me,i.get_style=Ce,i.get_token=ae,i.get_tree_depth=Jt,i.get_tree_node_ancestors=qt,i.get_tree_node_descendants=Ut,i.get_window_size=Xe,i.guid=st,i.has_class=We,i.has_storage=ge,i.hex_to_rgb=b,i.is_array=l,i.is_boolean=vt,i.is_client=H,i.is_completely_in_viewport=Qe,i.is_dark=gn,i.is_date=C,i.is_element=L,i.is_email=At,i.is_empty=$t,i.is_empty_object=$e,i.is_even=re,i.is_falsy=St,i.is_function=p,i.is_hex_color=zt,i.is_html_element=kt,i.is_in_viewport=Ge,i.is_ip=Tt,i.is_light=P,i.is_mobile=Ft,i.is_null=pt,i.is_number=m,i.is_object=h,i.is_plain_object=bt,i.is_port=jt,i.is_promise=Ot,i.is_reg_exp=Mt,i.is_string=z,i.is_string_number=It,i.is_symbol=Nt,i.is_truthy=Et,i.is_undefined=yt,i.is_url=Lt,i.is_valid_date=wt,i.lighten=hn,i.memoize=$n,i.merge_objects=Ae,i.mix=ln,i.off=Je,i.omit=Se,i.on=qe,i.once=On,i.pick=Ee,i.pipe=Mn,i.random_boolean=ft,i.random_color=lt,i.random_element=w,i.random_elements=at,i.random_email=ht,i.random_float=ut,i.random_id=M,i.random_int=it,i.random_int_range=ct,i.random_len_string=N,i.random_number_string=W,i.random_password=_t,i.random_phone=dt,i.random_string=R,i.random_url=mt,i.read_file=nn,i.remove_attribute=Ue,i.remove_batch_storage=Oe,i.remove_class=Pe,i.remove_storage=K,i.remove_token=_e,i.remove_tree_node=Yt,i.retry=nt,i.rgb_to_hex=$,i.rgba_to_hex=dn,i.round=ce,i.scroll_footer=ze,i.scroll_to_element=Ye,i.search_tree=xt,i.set_attribute=x,i.set_batch_storage=Me,i.set_object_value=Fe,i.set_storage=J,i.set_storage_with_expiry=he,i.set_style=He,i.set_styles=Z,i.set_token=le,i.setupDirectives=kn,i.shuffle_array=gt,i.sort_tree=Qt,i.thousand_separator=U,i.throttle=bn,i.timeout=Sn,i.to_base64=en,i.to_fixed=q,i.to_number=E,i.to_percentage=ne,i.toggle_class=Re,i.transform_tree=Ht,i.traverse_tree_breadth_first=Wt,i.traverse_tree_depth_first=Rt,i.tree_flat=Dt,i.unflatten_object=ke,i.update_tree_node=Gt,i.validate_file_size=rn,i.validate_file_type=on,i.validate_tree=Zt,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
package/lib/utils/echarts.js
CHANGED
|
@@ -30,7 +30,7 @@ function init_chart(container, options, renderer = "canvas", theme) {
|
|
|
30
30
|
const imported = await import("echarts");
|
|
31
31
|
echarts = imported.default || imported;
|
|
32
32
|
}
|
|
33
|
-
const chart_dom = typeof container === "string" ? document.
|
|
33
|
+
const chart_dom = typeof container === "string" ? document.querySelector(container) : container;
|
|
34
34
|
if (!chart_dom) {
|
|
35
35
|
console.error("ECharts DOM容器未找到");
|
|
36
36
|
return null;
|
package/lib/utils/storage.js
CHANGED
|
@@ -2,6 +2,12 @@ function get_storage_instance(type = "local") {
|
|
|
2
2
|
return type === "local" ? localStorage : sessionStorage;
|
|
3
3
|
}
|
|
4
4
|
function json_parse(data, defaultValue = null) {
|
|
5
|
+
if (!data || typeof data !== "string") {
|
|
6
|
+
return defaultValue;
|
|
7
|
+
}
|
|
8
|
+
if (!data.startsWith("{") && !data.startsWith("[") && !data.startsWith('"')) {
|
|
9
|
+
return data;
|
|
10
|
+
}
|
|
5
11
|
try {
|
|
6
12
|
return JSON.parse(data);
|
|
7
13
|
} catch (error) {
|