nhanh-pure-function 4.4.0 → 4.6.0
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/dist/Animate/index.d.ts +2 -2
- package/dist/Browser/index.d.ts +1 -1
- package/dist/Element/index.d.ts +1 -1
- package/dist/Element/modules/drop.d.ts +45 -0
- package/dist/Element/{Runtime → modules}/index.d.ts +2 -1
- package/dist/Math/index.d.ts +96 -3
- package/dist/Types/index.d.ts +9 -0
- package/dist/Utility/index.d.ts +3 -85
- package/dist/Utility/modules/colorConverter.d.ts +137 -0
- package/dist/Utility/{Runtime → modules}/index.d.ts +1 -0
- package/dist/Utility/{Runtime → modules}/shortcutKey.d.ts +25 -15
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +1107 -796
- package/package.json +1 -1
- /package/dist/Browser/{Runtime → modules}/index.d.ts +0 -0
- /package/dist/Browser/{Runtime → modules}/soundEffects.d.ts +0 -0
- /package/dist/Browser/{Runtime → modules}/webSocketClient.d.ts +0 -0
- /package/dist/Element/{Runtime → modules}/fullscreen.d.ts +0 -0
- /package/dist/Utility/{Runtime → modules}/undoRedoHistory.d.ts +0 -0
package/dist/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode(".no-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}._nhanh_canvas{cursor:initial}._nhanh_canvas:active{cursor:pointer}._nhanh_canvas._nhanh_canvas_draggable{cursor:grab}._nhanh_canvas._nhanh_canvas_draggable:active{cursor:grabbing}._nhanh_canvas_hover_overlay{cursor:pointer!important}._nhanh_canvas_hover_overlay:active{cursor:grabbing!important}._nhanh_canvas_hover_overlay_draggable{cursor:pointer!important}._nhanh_canvas_hover_overlay_draggable:active{cursor:move!important}._nhanh_canvas_hover_overlay_draggable_ew{cursor:pointer!important}._nhanh_canvas_hover_overlay_draggable_ew:active{cursor:e-resize!important;cursor:ew-resize!important}._nhanh_canvas_hover_overlay_draggable_ns{cursor:pointer!important}._nhanh_canvas_hover_overlay_draggable_ns:active{cursor:n-resize!important;cursor:ns-resize!important}")),document.head.appendChild(a)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
var
|
|
3
|
-
var
|
|
2
|
+
var si = Object.defineProperty;
|
|
3
|
+
var Pe = (r) => {
|
|
4
4
|
throw TypeError(r);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
7
|
-
var d = (r, i, t) =>
|
|
8
|
-
var x = (r, i, t) => (
|
|
9
|
-
const
|
|
6
|
+
var ni = (r, i, t) => i in r ? si(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
|
|
7
|
+
var d = (r, i, t) => ni(r, typeof i != "symbol" ? i + "" : i, t), Ce = (r, i, t) => i.has(r) || Pe("Cannot " + t);
|
|
8
|
+
var x = (r, i, t) => (Ce(r, i, "read from private field"), t ? t.call(r) : i.get(r)), L = (r, i, t) => i.has(r) ? Pe("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(r) : i.set(r, t), M = (r, i, t, e) => (Ce(r, i, "write to private field"), e ? e.call(r, t) : i.set(r, t), t);
|
|
9
|
+
const ri = {
|
|
10
10
|
".mp3": "audio/mpeg",
|
|
11
11
|
".mp4": "video/mp4",
|
|
12
12
|
".m4a": "audio/mp4",
|
|
@@ -68,7 +68,7 @@ const Qe = {
|
|
|
68
68
|
".otf": "font/otf",
|
|
69
69
|
".eot": "application/vnd.ms-fontobject",
|
|
70
70
|
".map": "application/json"
|
|
71
|
-
},
|
|
71
|
+
}, te = {
|
|
72
72
|
image: [
|
|
73
73
|
".jpg",
|
|
74
74
|
".jpeg",
|
|
@@ -248,7 +248,7 @@ const Qe = {
|
|
|
248
248
|
".awk",
|
|
249
249
|
".php"
|
|
250
250
|
]
|
|
251
|
-
},
|
|
251
|
+
}, Se = [
|
|
252
252
|
"",
|
|
253
253
|
"万",
|
|
254
254
|
"亿",
|
|
@@ -262,7 +262,7 @@ const Qe = {
|
|
|
262
262
|
"正",
|
|
263
263
|
"载",
|
|
264
264
|
"极"
|
|
265
|
-
],
|
|
265
|
+
], qs = ["_self", "_blank", "_parent", "_top"], Te = {
|
|
266
266
|
// 北美标准尺寸 (毫米)
|
|
267
267
|
Letter: { width: 215.9, height: 279.4 },
|
|
268
268
|
// 8.5 × 11 英寸
|
|
@@ -315,10 +315,10 @@ const Qe = {
|
|
|
315
315
|
C6: { width: 114, height: 162 },
|
|
316
316
|
C7: { width: 81, height: 114 },
|
|
317
317
|
C8: { width: 57, height: 81 }
|
|
318
|
-
},
|
|
318
|
+
}, Ks = Object.keys(Te).map(
|
|
319
319
|
(r) => ({ value: r, label: r })
|
|
320
320
|
);
|
|
321
|
-
function
|
|
321
|
+
function Ut(r, i = 500) {
|
|
322
322
|
let t, e = !0;
|
|
323
323
|
function s(n) {
|
|
324
324
|
if (!e) return;
|
|
@@ -328,7 +328,7 @@ function Bt(r, i = 500) {
|
|
|
328
328
|
}
|
|
329
329
|
return requestAnimationFrame(s), () => e = !1;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function Zs(r, i, t, e, s = 4) {
|
|
332
332
|
let n = r, o = !1, a = 1, l = r, c = i, h = t;
|
|
333
333
|
const u = () => {
|
|
334
334
|
const b = (c - l) / h;
|
|
@@ -336,13 +336,13 @@ function Hs(r, i, t, e, s = 4) {
|
|
|
336
336
|
};
|
|
337
337
|
let f = u();
|
|
338
338
|
const m = (b) => Math.min(Math.max(b, l), c), g = (b) => Number(b.toFixed(s)), p = (b, P, E) => {
|
|
339
|
-
const
|
|
340
|
-
return b >= P &&
|
|
339
|
+
const O = [];
|
|
340
|
+
return b >= P && O.push("最小值必须小于最大值"), E <= 0 ? O.push("分段数必须为正数") : u() == 0 && O.push("数值精度过低,致使动画步长为 0"), O;
|
|
341
341
|
}, y = (b, P, E) => {
|
|
342
|
-
const
|
|
343
|
-
return
|
|
342
|
+
const O = p(b, P, E);
|
|
343
|
+
return O.length > 0 ? (console.error(`参数更新失败: ${O.join("; ")}`), !1) : (l = b, c = P, h = E, f = u(), n = m(n), !0);
|
|
344
344
|
}, w = () => {
|
|
345
|
-
o && (a = n >= c ? -1 : n <= l ? 1 : a, n = m(n + f * a), e(g(n)), requestAnimationFrame(w));
|
|
345
|
+
o && (a = n >= c ? -1 : n <= l ? 1 : a, n = m(n + f * a), e(g(n), a), requestAnimationFrame(w));
|
|
346
346
|
};
|
|
347
347
|
return {
|
|
348
348
|
/** 启动/继续动画 */
|
|
@@ -365,7 +365,7 @@ function Hs(r, i, t, e, s = 4) {
|
|
|
365
365
|
getParams: () => ({ min: l, max: c, steps: h, precision: s, stepSize: f })
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function oi(r, i, t, e, s = 4) {
|
|
369
369
|
if (t <= 0) return console.error("动画步数 必须为正数");
|
|
370
370
|
const n = (u) => Number(u.toFixed(s)), o = i - r, a = n(Math.abs(o) / t);
|
|
371
371
|
if (a === 0) return console.error("数值精度过低,致使动画步长为 0");
|
|
@@ -376,7 +376,7 @@ function Je(r, i, t, e, s = 4) {
|
|
|
376
376
|
};
|
|
377
377
|
h();
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Qs(r, i, t, e) {
|
|
380
380
|
const s = (l) => 3 * (1 - l) ** 2 * l * r + 3 * (1 - l) * l ** 2 * t + l ** 3, n = (l) => 3 * (1 - l) ** 2 * l * i + 3 * (1 - l) * l ** 2 * e + l ** 3, o = (l) => 3 * r * (1 - l) * (1 - 3 * l) + 3 * t * (2 * l - 3 * l ** 2) + 3 * l ** 2, a = (l) => {
|
|
381
381
|
if (l <= 0) return 0;
|
|
382
382
|
if (l >= 1) return 1;
|
|
@@ -404,7 +404,7 @@ function Fs(r, i, t, e) {
|
|
|
404
404
|
return n(a(c));
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function Js(r, i = "image/png") {
|
|
408
408
|
try {
|
|
409
409
|
let t, e = i;
|
|
410
410
|
if (r instanceof File)
|
|
@@ -441,17 +441,17 @@ function zs(r, i = "image/png") {
|
|
|
441
441
|
), null;
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function tn(r) {
|
|
445
445
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function en(r, i, t = 2) {
|
|
448
448
|
return !Number.isFinite(r) || !Number.isFinite(i) || !Number.isFinite(t) ? (console.error("所有参数必须是有限的数字"), "") : i === 0 ? (console.error("分母不能为零"), "") : t < 0 ? (console.error("小数位数不能为负数"), "") : (r / i * 100).toFixed(t) + "%";
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function se(r) {
|
|
451
451
|
const t = r.toString().split("."), e = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
452
452
|
return t.length > 1 ? e + "." + t[1] : e;
|
|
453
453
|
}
|
|
454
|
-
function
|
|
454
|
+
function sn(r, i) {
|
|
455
455
|
const t = {
|
|
456
456
|
join: !0,
|
|
457
457
|
suffix: "",
|
|
@@ -462,16 +462,16 @@ function Gs(r, i) {
|
|
|
462
462
|
}, o = Number(r);
|
|
463
463
|
if (isNaN(o)) return e ? `0${s}` : [0, s];
|
|
464
464
|
const a = Math.abs(o), l = o >= 0, c = Math.max(0, Math.floor(Math.log10(a) / 4)), h = Math.pow(1e4, c), u = a / h, f = (l ? 1 : -1) * parseFloat(u.toFixed(Math.max(0, n)));
|
|
465
|
-
return e ? `${f}${
|
|
465
|
+
return e ? `${f}${Se[c]}${s}` : [f, Se[c] + s];
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function nn(r) {
|
|
468
468
|
const i = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
469
469
|
let t = 0;
|
|
470
470
|
for (; r > 1024; )
|
|
471
471
|
r /= 1024, t++;
|
|
472
472
|
return `${Math.round(r * 100) / 100} ${i[t]}`;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function ai(r, i = "YYYY-MM-DD hh:mm:ss", t = !0) {
|
|
475
475
|
const e = new Date(r);
|
|
476
476
|
if (isNaN(e.getTime()))
|
|
477
477
|
return console.error("Invalid date"), "";
|
|
@@ -490,15 +490,15 @@ function ti(r, i = "YYYY-MM-DD hh:mm:ss", t = !0) {
|
|
|
490
490
|
return t ? String(o).padStart(2, "0") : String(o);
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function ne(r, i = "file") {
|
|
494
494
|
if (!r || (r = String(r).trim(), r === "")) return i;
|
|
495
495
|
const t = r.split("/");
|
|
496
496
|
return t[t.length - 1].split("?")[0];
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function rn(r, i) {
|
|
499
499
|
return r = r.replace(/([^a-zA-Z][a-z])/g, (t) => t.toUpperCase()), i ? r.replace(/[^a-zA-Z]+/g, "") : r;
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function on(r, i, t = ",") {
|
|
502
502
|
const e = new RegExp(
|
|
503
503
|
`(^|${t})${i}(${t}|$)`,
|
|
504
504
|
"g"
|
|
@@ -507,7 +507,7 @@ function $s(r, i, t = ",") {
|
|
|
507
507
|
return n === o ? t : "";
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function an(r, i = !0) {
|
|
511
511
|
const t = {
|
|
512
512
|
"\b": "\\b",
|
|
513
513
|
" ": "\\t",
|
|
@@ -524,7 +524,7 @@ function js(r, i = !0) {
|
|
|
524
524
|
(s) => t[s]
|
|
525
525
|
) : r.replace(/\\[btnvfrs]/g, (s) => e[s] || s);
|
|
526
526
|
}
|
|
527
|
-
const
|
|
527
|
+
const Nt = [
|
|
528
528
|
["年", 365 * 24 * 60 * 60 * 1e3],
|
|
529
529
|
["月", 30 * 24 * 60 * 60 * 1e3],
|
|
530
530
|
["周", 7 * 24 * 60 * 60 * 1e3],
|
|
@@ -534,21 +534,21 @@ const It = [
|
|
|
534
534
|
["秒", 1e3],
|
|
535
535
|
["毫秒", 1]
|
|
536
536
|
];
|
|
537
|
-
function
|
|
537
|
+
function ln(r, i) {
|
|
538
538
|
if (!Number.isFinite(r) || r < 0) return "0毫秒";
|
|
539
539
|
r = Math.round(r);
|
|
540
|
-
const t = i ?
|
|
541
|
-
for (let s = e; s <
|
|
542
|
-
const [n, o] =
|
|
540
|
+
const t = i ? Nt.findIndex(([s]) => s === i) : 0, e = t === -1 ? 0 : t;
|
|
541
|
+
for (let s = e; s < Nt.length; s++) {
|
|
542
|
+
const [n, o] = Nt[s];
|
|
543
543
|
if (r >= o) {
|
|
544
544
|
const a = o === 1 ? r : Math.round(r / o * 10) / 10;
|
|
545
545
|
let l = Number.isInteger(a) ? a : a.toFixed(1).replace(/\.0$/, "");
|
|
546
|
-
return n ===
|
|
546
|
+
return n === Nt[e][0] && (l = se(Number(l))), `${l}${n}`;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
return "0毫秒";
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function cn(r, i) {
|
|
552
552
|
if (i < 1)
|
|
553
553
|
return console.error("分割大小必须大于0"), [];
|
|
554
554
|
const t = [];
|
|
@@ -558,24 +558,24 @@ function qs(r, i) {
|
|
|
558
558
|
}
|
|
559
559
|
return t;
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function xe(r, i = 2) {
|
|
562
562
|
if (Array.isArray(r) && r.length >= i) {
|
|
563
563
|
for (let e = 0; e < r.length; e++)
|
|
564
564
|
if (typeof r[e] != "number" || !Number.isFinite(r[e])) return !1;
|
|
565
565
|
} else return !1;
|
|
566
566
|
return !0;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function Gt(r, i = 1, t = 2) {
|
|
569
569
|
if (Array.isArray(r) && r.length >= i) {
|
|
570
570
|
for (let s = 0; s < r.length; s++)
|
|
571
|
-
if (!
|
|
571
|
+
if (!xe(r[s], t)) return !1;
|
|
572
572
|
} else return !1;
|
|
573
573
|
return !0;
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function hn(r, i, t) {
|
|
576
576
|
return Math.abs(r - i) <= t;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function un(r, i) {
|
|
579
579
|
let t = !1;
|
|
580
580
|
const { x: e, y: s } = r, n = i.length;
|
|
581
581
|
for (let o = 0, a = n - 1; o < n; a = o++) {
|
|
@@ -584,7 +584,7 @@ function Zs(r, i) {
|
|
|
584
584
|
}
|
|
585
585
|
return t;
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function dn(r, i, t, e) {
|
|
588
588
|
const s = Math.min(r[0], i[0]), n = Math.max(r[0], i[0]), o = Math.min(r[1], i[1]), a = Math.max(r[1], i[1]), l = [
|
|
589
589
|
[s, o],
|
|
590
590
|
// 左上
|
|
@@ -608,10 +608,10 @@ function Qs(r, i, t, e) {
|
|
|
608
608
|
}
|
|
609
609
|
return m && g;
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function re(r) {
|
|
612
612
|
return Object.prototype.toString.call(r).slice(8, -1).toLowerCase();
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function fn(r) {
|
|
615
615
|
return [
|
|
616
616
|
"https:",
|
|
617
617
|
// HTTPS协议,用于安全地浏览网页
|
|
@@ -635,7 +635,7 @@ function Js(r) {
|
|
|
635
635
|
// VPN协议,用于创建安全的网络连接
|
|
636
636
|
].some((t) => r.startsWith(t));
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function mn(r) {
|
|
639
639
|
return new Promise((i, t) => {
|
|
640
640
|
if (typeof r != "string" || r.trim() === "" || !r.includes("://")) {
|
|
641
641
|
t(new Error("Invalid URL: Must be a non-empty string"));
|
|
@@ -668,11 +668,11 @@ const ot = class ot {
|
|
|
668
668
|
static check(i, t) {
|
|
669
669
|
if (!i || typeof i != "string")
|
|
670
670
|
return console.error("Invalid URL provided"), t ? !1 : "unknown";
|
|
671
|
-
const e =
|
|
671
|
+
const e = ne(i).toLowerCase();
|
|
672
672
|
if (t) {
|
|
673
|
-
if (!
|
|
673
|
+
if (!te.hasOwnProperty(t))
|
|
674
674
|
return console.error(`Unknown file type: ${t}`), "unknown";
|
|
675
|
-
const s =
|
|
675
|
+
const s = te[t];
|
|
676
676
|
return ot._checkExtension(e, s);
|
|
677
677
|
}
|
|
678
678
|
return ot._detectFileType(e);
|
|
@@ -687,7 +687,7 @@ const ot = class ot {
|
|
|
687
687
|
*/
|
|
688
688
|
static parseAddresses(i) {
|
|
689
689
|
return !i || typeof i != "string" ? (console.error("Invalid URL provided"), []) : i.split(",").map((t) => {
|
|
690
|
-
const e =
|
|
690
|
+
const e = ne(t), s = this.check(t);
|
|
691
691
|
return { url: t, name: e, type: s };
|
|
692
692
|
});
|
|
693
693
|
}
|
|
@@ -715,7 +715,7 @@ const ot = class ot {
|
|
|
715
715
|
* @returns {string} 标准化的MIME类型字符串,如果无法识别则返回原始输入
|
|
716
716
|
*/
|
|
717
717
|
static _normalizeType(i) {
|
|
718
|
-
return i.startsWith(".") && !i.includes("/") ?
|
|
718
|
+
return i.startsWith(".") && !i.includes("/") ? ri[i.toLowerCase()] || i : i.includes("/") ? i : `${i}/*`;
|
|
719
719
|
}
|
|
720
720
|
/**
|
|
721
721
|
* 检查URL是否具有任何指定的文件扩展名
|
|
@@ -739,13 +739,13 @@ const ot = class ot {
|
|
|
739
739
|
}
|
|
740
740
|
};
|
|
741
741
|
// 缓存文件扩展名的条目,以提高性能
|
|
742
|
-
d(ot, "cachedEntries", Object.entries(
|
|
743
|
-
let
|
|
744
|
-
const
|
|
745
|
-
function
|
|
746
|
-
return r ? r.match(
|
|
742
|
+
d(ot, "cachedEntries", Object.entries(te));
|
|
743
|
+
let _e = ot;
|
|
744
|
+
const li = /\w*(?:\[\d+\])+|\w+/g, Ie = /^\w*(?:\[\d+\])+$/, Ne = /\w+|(\[\d+\])/g, He = /\[(\d+)\]/;
|
|
745
|
+
function Fe(r) {
|
|
746
|
+
return r ? r.match(li) || [] : [];
|
|
747
747
|
}
|
|
748
|
-
class
|
|
748
|
+
class pn {
|
|
749
749
|
constructor(i = {}) {
|
|
750
750
|
d(this, "stack", []);
|
|
751
751
|
d(this, "_index", 0);
|
|
@@ -874,7 +874,7 @@ class en {
|
|
|
874
874
|
e(t);
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
|
-
const
|
|
877
|
+
const ci = {
|
|
878
878
|
// 修饰键
|
|
879
879
|
ctrl: "control",
|
|
880
880
|
ctl: "control",
|
|
@@ -903,8 +903,7 @@ const ii = {
|
|
|
903
903
|
down: "arrowdown",
|
|
904
904
|
left: "arrowleft",
|
|
905
905
|
right: "arrowright"
|
|
906
|
-
}
|
|
907
|
-
class sn {
|
|
906
|
+
}, at = class at {
|
|
908
907
|
constructor(i) {
|
|
909
908
|
/** 最近一次 `mousedown` 的目标,供 `scopeType: "click"` 使用 */
|
|
910
909
|
d(this, "lastClickDom");
|
|
@@ -927,18 +926,26 @@ class sn {
|
|
|
927
926
|
this.downKeys = [];
|
|
928
927
|
});
|
|
929
928
|
d(this, "handleKeyDown", (i) => {
|
|
930
|
-
const t = this.normalizeKey(i.key);
|
|
931
|
-
this.downKeys.includes(t)
|
|
932
|
-
|
|
933
|
-
|
|
929
|
+
const t = this.normalizeKey(i.key), e = i.repeat;
|
|
930
|
+
if (this.downKeys.includes(t)) {
|
|
931
|
+
if (!e) return;
|
|
932
|
+
} else
|
|
933
|
+
this.downKeys.push(t);
|
|
934
|
+
this.debug && console.log(
|
|
935
|
+
`[Shortcut Debug] 📥 keydown -> "${t}" ${e ? "(repeat)" : ""} | 当前按压序列: [${this.downKeys.join(", ")}]`
|
|
936
|
+
), this.checkBindings(i, e);
|
|
934
937
|
});
|
|
935
938
|
d(this, "handleKeyUp", (i) => {
|
|
936
939
|
const t = this.normalizeKey(i.key), e = this.downKeys.indexOf(t);
|
|
937
940
|
e !== -1 && (this.downKeys.splice(e, 1), this.debug && console.log(
|
|
938
941
|
`[Shortcut Debug] 📤 keyup -> "${t}" | 剩余按压序列: [${this.downKeys.join(", ")}]`
|
|
939
|
-
))
|
|
942
|
+
)), this.bindings.forEach((s) => {
|
|
943
|
+
s.allowRepeat && s.currentIndex === s.sequence.length - 1 && s.sequence[s.currentIndex].includes(t) && this.resetBinding(s);
|
|
944
|
+
});
|
|
940
945
|
});
|
|
941
|
-
this.debug = !!i,
|
|
946
|
+
this.debug = !!i, at.activeInstances++, at.activeInstances > 1 && console.warn(
|
|
947
|
+
`[_Utility_ShortcutManager] 检测到当前页面存在 ${at.activeInstances} 个活跃实例。请确保不再使用的实例已显式调用 \`destroy()\` 以释放全局 window 监听器,避免内存泄漏。`
|
|
948
|
+
), window.addEventListener("mouseover", this.handleMouseOver), window.addEventListener("mousedown", this.handleMouseDown), window.addEventListener("keydown", this.handleKeyDown), window.addEventListener("keyup", this.handleKeyUp), window.addEventListener("blur", this.clearKeys);
|
|
942
949
|
}
|
|
943
950
|
/**
|
|
944
951
|
* 注册快捷键。
|
|
@@ -960,33 +967,48 @@ class sn {
|
|
|
960
967
|
const t = this.bindings.get(i);
|
|
961
968
|
t != null && t.timerId && window.clearTimeout(t.timerId), this.bindings.delete(i);
|
|
962
969
|
}
|
|
963
|
-
/**
|
|
970
|
+
/**
|
|
971
|
+
* 彻底销毁当前实例,清空所有快捷键绑定,并移除全局 window 事件监听器。
|
|
972
|
+
*
|
|
973
|
+
* ⚠️ **调用时机**:在单页应用(如 Vue/React 组件卸载)或不需要快捷键时**务必调用**。
|
|
974
|
+
*/
|
|
964
975
|
destroy() {
|
|
965
|
-
this.bindings.forEach((i) => i.timerId && window.clearTimeout(i.timerId)), this.bindings.clear(), this.downKeys = [], this.lastClickDom = void 0, this.lastHoverDom = void 0, window.removeEventListener("mouseover", this.handleMouseOver), window.removeEventListener("mousedown", this.handleMouseDown), window.removeEventListener("keydown", this.handleKeyDown), window.removeEventListener("keyup", this.handleKeyUp), window.removeEventListener("blur", this.clearKeys)
|
|
976
|
+
this.bindings.forEach((i) => i.timerId && window.clearTimeout(i.timerId)), this.bindings.clear(), this.downKeys = [], this.lastClickDom = void 0, this.lastHoverDom = void 0, window.removeEventListener("mouseover", this.handleMouseOver), window.removeEventListener("mousedown", this.handleMouseDown), window.removeEventListener("keydown", this.handleKeyDown), window.removeEventListener("keyup", this.handleKeyUp), window.removeEventListener("blur", this.clearKeys), at.activeInstances = Math.max(
|
|
977
|
+
0,
|
|
978
|
+
at.activeInstances - 1
|
|
979
|
+
);
|
|
966
980
|
}
|
|
967
981
|
/**
|
|
968
982
|
* 遍历所有绑定:校验作用域与输入上下文后,用数组匹配当前步骤;
|
|
969
983
|
* 完全匹配则推进序列或触发回调,前缀匹配则等待,否则重置。
|
|
970
984
|
*/
|
|
971
|
-
checkBindings(i) {
|
|
972
|
-
let
|
|
973
|
-
const
|
|
974
|
-
this.bindings.forEach((
|
|
975
|
-
const
|
|
976
|
-
if (!this.isValidScope(
|
|
977
|
-
this.debug && this.isPrefixMatch(this.downKeys,
|
|
978
|
-
`[Shortcut Debug] ⚠️ 快捷键 "${
|
|
985
|
+
checkBindings(i, t) {
|
|
986
|
+
let e = !1;
|
|
987
|
+
const s = document.activeElement, n = Date.now();
|
|
988
|
+
this.bindings.forEach((o, a) => {
|
|
989
|
+
const l = o.sequence[o.currentIndex];
|
|
990
|
+
if (!this.isValidScope(o)) {
|
|
991
|
+
this.debug && this.isPrefixMatch(this.downKeys, l) && console.warn(
|
|
992
|
+
`[Shortcut Debug] ⚠️ 快捷键 "${a}" 匹配成功但由于作用域限制(scope: ${o.scope})未触发`
|
|
979
993
|
);
|
|
980
994
|
return;
|
|
981
995
|
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
996
|
+
if (this.isValidContext(o, s))
|
|
997
|
+
if (this.isExactMatch(this.downKeys, l))
|
|
998
|
+
if (e = !0, o.currentIndex === o.sequence.length - 1) {
|
|
999
|
+
if (t && (!o.allowRepeat || o.repeatInterval && o.lastFiredAt && n - o.lastFiredAt < o.repeatInterval))
|
|
1000
|
+
return;
|
|
1001
|
+
this.debug && console.log(
|
|
1002
|
+
`[Shortcut Debug] 🎉 成功触发快捷键: "${a}"`
|
|
1003
|
+
), o.callback(i), o.lastFiredAt = n, o.allowRepeat || this.resetBinding(o);
|
|
1004
|
+
} else
|
|
1005
|
+
t || (this.debug && console.log(
|
|
1006
|
+
`[Shortcut Debug] ⏳ 序列匹配中进度: (${o.currentIndex + 1}/${o.sequence.length}),等待下一步...`
|
|
1007
|
+
), o.currentIndex++, this.startSequenceTimer(o));
|
|
1008
|
+
else this.isPrefixMatch(this.downKeys, l) || o.currentIndex > 0 && (this.debug && console.log(
|
|
1009
|
+
`[Shortcut Debug] 🛑 按键序列不匹配,重置快捷键 "${a}" 的进度`
|
|
1010
|
+
), this.resetBinding(o));
|
|
1011
|
+
}), e && i.preventDefault();
|
|
990
1012
|
}
|
|
991
1013
|
/** 启动多步序列超时;超时未按下一步则重置 `currentIndex` */
|
|
992
1014
|
startSequenceTimer(i) {
|
|
@@ -995,7 +1017,7 @@ class sn {
|
|
|
995
1017
|
}, i.timeout ?? 5e3);
|
|
996
1018
|
}
|
|
997
1019
|
resetBinding(i) {
|
|
998
|
-
i.currentIndex = 0, i.timerId && (window.clearTimeout(i.timerId), i.timerId = void 0);
|
|
1020
|
+
i.currentIndex = 0, i.lastFiredAt = void 0, i.timerId && (window.clearTimeout(i.timerId), i.timerId = void 0);
|
|
999
1021
|
}
|
|
1000
1022
|
isValidScope(i) {
|
|
1001
1023
|
var t;
|
|
@@ -1020,7 +1042,7 @@ class sn {
|
|
|
1020
1042
|
*/
|
|
1021
1043
|
normalizeKey(i) {
|
|
1022
1044
|
const t = i.toLowerCase();
|
|
1023
|
-
return
|
|
1045
|
+
return ci[t] ?? t;
|
|
1024
1046
|
}
|
|
1025
1047
|
/** 当前按下键与预期组合键在长度与顺序上完全一致 */
|
|
1026
1048
|
isExactMatch(i, t) {
|
|
@@ -1033,8 +1055,279 @@ class sn {
|
|
|
1033
1055
|
isPrefixMatch(i, t) {
|
|
1034
1056
|
return i.length > t.length ? !1 : i.every((e, s) => e === t[s]);
|
|
1035
1057
|
}
|
|
1058
|
+
};
|
|
1059
|
+
// 静态计数器:记录当前活跃的实例数量
|
|
1060
|
+
d(at, "activeInstances", 0);
|
|
1061
|
+
let Ee = at;
|
|
1062
|
+
class hi {
|
|
1063
|
+
constructor() {
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* 数值钳制,确保在合法区间内。
|
|
1067
|
+
*/
|
|
1068
|
+
static clamp(i, t, e) {
|
|
1069
|
+
return Math.min(Math.max(i, t), e);
|
|
1070
|
+
}
|
|
1071
|
+
static normalizeHue(i) {
|
|
1072
|
+
return (i % 360 + 360) % 360;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* 根据色相分段与色度参数生成 RGB(0-255)。
|
|
1076
|
+
*/
|
|
1077
|
+
static chromaToRgb(i, t, e) {
|
|
1078
|
+
const s = t * (1 - Math.abs(i / 60 % 2 - 1));
|
|
1079
|
+
let n = 0, o = 0, a = 0;
|
|
1080
|
+
return i < 60 ? [n, o, a] = [t, s, 0] : i < 120 ? [n, o, a] = [s, t, 0] : i < 180 ? [n, o, a] = [0, t, s] : i < 240 ? [n, o, a] = [0, s, t] : i < 300 ? [n, o, a] = [s, 0, t] : [n, o, a] = [t, 0, s], {
|
|
1081
|
+
r: (n + e) * 255,
|
|
1082
|
+
g: (o + e) * 255,
|
|
1083
|
+
b: (a + e) * 255
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
static resolveAlpha(i, t) {
|
|
1087
|
+
return Number.isFinite(i) ? this.clamp(i, 0, 1) : t;
|
|
1088
|
+
}
|
|
1089
|
+
static toRoundedRgbString(i, t, e) {
|
|
1090
|
+
return `rgb(${Math.round(i)}, ${Math.round(t)}, ${Math.round(e)})`;
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* HSL 转 RGB。
|
|
1094
|
+
* h: 0-360, s/l: 0-100
|
|
1095
|
+
*/
|
|
1096
|
+
static hslToRgb(i, t, e) {
|
|
1097
|
+
const s = this.normalizeHue(i), n = this.clamp(t, 0, 100) / 100, o = this.clamp(e, 0, 100) / 100, a = (1 - Math.abs(2 * o - 1)) * n, l = o - a / 2;
|
|
1098
|
+
return this.chromaToRgb(s, a, l);
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* HSV 转 RGB。
|
|
1102
|
+
* h: 0-360, s/v: 0-100
|
|
1103
|
+
*/
|
|
1104
|
+
static hsvToRgb(i, t, e) {
|
|
1105
|
+
const s = this.normalizeHue(i), n = this.clamp(t, 0, 100) / 100, o = this.clamp(e, 0, 100) / 100, a = o * n, l = o - a;
|
|
1106
|
+
return this.chromaToRgb(s, a, l);
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* 解析任意受支持的颜色格式并标准化为 RGBA。
|
|
1110
|
+
*/
|
|
1111
|
+
static parseColor(i) {
|
|
1112
|
+
const t = i.trim().toLowerCase();
|
|
1113
|
+
if (t.startsWith("#")) {
|
|
1114
|
+
const o = t.slice(1);
|
|
1115
|
+
if (o.length === 3 || o.length === 4) {
|
|
1116
|
+
const [a, l, c, h = "f"] = o.split("");
|
|
1117
|
+
return {
|
|
1118
|
+
r: parseInt(`${a}${a}`, 16),
|
|
1119
|
+
g: parseInt(`${l}${l}`, 16),
|
|
1120
|
+
b: parseInt(`${c}${c}`, 16),
|
|
1121
|
+
a: parseInt(`${h}${h}`, 16) / 255
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
if (o.length === 6 || o.length === 8) {
|
|
1125
|
+
const a = parseInt(o.slice(0, 2), 16), l = parseInt(o.slice(2, 4), 16), c = parseInt(o.slice(4, 6), 16), h = o.length === 8 ? parseInt(o.slice(6, 8), 16) / 255 : this.DEFAULT_ALPHA;
|
|
1126
|
+
return { r: a, g: l, b: c, a: h };
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
const e = t.match(/^rgba?\(([^)]+)\)$/);
|
|
1130
|
+
if (e) {
|
|
1131
|
+
const o = e[1].split(",").map((a) => a.trim());
|
|
1132
|
+
if (o.length >= 3) {
|
|
1133
|
+
const a = this.clamp(Number(o[0]), 0, 255), l = this.clamp(Number(o[1]), 0, 255), c = this.clamp(Number(o[2]), 0, 255), h = o.length >= 4 ? this.clamp(Number(o[3]), 0, 1) : this.DEFAULT_ALPHA;
|
|
1134
|
+
return { r: a, g: l, b: c, a: h };
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
const s = t.match(/^hsl\(([^)]+)\)$/);
|
|
1138
|
+
if (s) {
|
|
1139
|
+
const o = s[1].split(",").map((a) => a.trim().replace("%", ""));
|
|
1140
|
+
if (o.length >= 3) {
|
|
1141
|
+
const a = Number(o[0]), l = Number(o[1]), c = Number(o[2]);
|
|
1142
|
+
return { ...this.hslToRgb(a, l, c), a: this.DEFAULT_ALPHA };
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
const n = t.match(/^hsv\(([^)]+)\)$/);
|
|
1146
|
+
if (n) {
|
|
1147
|
+
const o = n[1].split(",").map((a) => a.trim().replace("%", ""));
|
|
1148
|
+
if (o.length >= 3) {
|
|
1149
|
+
const a = Number(o[0]), l = Number(o[1]), c = Number(o[2]);
|
|
1150
|
+
return { ...this.hsvToRgb(a, l, c), a: this.DEFAULT_ALPHA };
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
return console.error("Invalid color format", i), { r: 0, g: 0, b: 0, a: this.DEFAULT_ALPHA };
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* 十进制颜色分量转两位十六进制字符串。
|
|
1157
|
+
*/
|
|
1158
|
+
static toHexPart(i) {
|
|
1159
|
+
return Math.round(this.clamp(i, 0, 255)).toString(16).padStart(2, "0");
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* RGB 转 HSL。
|
|
1163
|
+
* 返回 h:0-360, s/l:0-100
|
|
1164
|
+
*/
|
|
1165
|
+
static rgbToHsl(i, t, e) {
|
|
1166
|
+
const s = this.clamp(i, 0, 255) / 255, n = this.clamp(t, 0, 255) / 255, o = this.clamp(e, 0, 255) / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), c = a - l;
|
|
1167
|
+
let h = 0;
|
|
1168
|
+
c !== 0 && (a === s ? h = 60 * ((n - o) / c % 6) : a === n ? h = 60 * ((o - s) / c + 2) : h = 60 * ((s - n) / c + 4)), h < 0 && (h += 360);
|
|
1169
|
+
const u = (a + l) / 2, f = c === 0 ? 0 : c / (1 - Math.abs(2 * u - 1));
|
|
1170
|
+
return { h, s: f * 100, l: u * 100 };
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* RGB 转 HSV。
|
|
1174
|
+
* 返回 h:0-360, s/v:0-100
|
|
1175
|
+
*/
|
|
1176
|
+
static rgbToHsv(i, t, e) {
|
|
1177
|
+
const s = this.clamp(i, 0, 255) / 255, n = this.clamp(t, 0, 255) / 255, o = this.clamp(e, 0, 255) / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), c = a - l;
|
|
1178
|
+
let h = 0;
|
|
1179
|
+
c !== 0 && (a === s ? h = 60 * ((n - o) / c % 6) : a === n ? h = 60 * ((o - s) / c + 2) : h = 60 * ((s - n) / c + 4)), h < 0 && (h += 360);
|
|
1180
|
+
const u = a === 0 ? 0 : c / a, f = a;
|
|
1181
|
+
return { h, s: u * 100, v: f * 100 };
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* 转换为 HEX(#RRGGBB)。
|
|
1185
|
+
*/
|
|
1186
|
+
static toHex(i) {
|
|
1187
|
+
const { r: t, g: e, b: s } = this.parseColor(i);
|
|
1188
|
+
return `#${this.toHexPart(t)}${this.toHexPart(e)}${this.toHexPart(s)}`;
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* 转换为 HEXA(#RRGGBBAA)。
|
|
1192
|
+
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1193
|
+
*/
|
|
1194
|
+
static toHexa(i, t) {
|
|
1195
|
+
const { r: e, g: s, b: n, a: o } = this.parseColor(i), a = this.resolveAlpha(t, o);
|
|
1196
|
+
return `#${this.toHexPart(e)}${this.toHexPart(s)}${this.toHexPart(
|
|
1197
|
+
n
|
|
1198
|
+
)}${this.toHexPart(a * 255)}`;
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* 转换为 RGB(rgb(r, g, b))。
|
|
1202
|
+
*/
|
|
1203
|
+
static toRgb(i) {
|
|
1204
|
+
const { r: t, g: e, b: s } = this.parseColor(i);
|
|
1205
|
+
return this.toRoundedRgbString(t, e, s);
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* 转换为 RGBA(rgba(r, g, b, a))。
|
|
1209
|
+
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1210
|
+
*/
|
|
1211
|
+
static toRgba(i, t) {
|
|
1212
|
+
const e = this.parseColor(i), s = this.resolveAlpha(t, e.a);
|
|
1213
|
+
return `rgba(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(
|
|
1214
|
+
e.b
|
|
1215
|
+
)}, ${s})`;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* 转换为 HSL(hsl(h, s%, l%))。
|
|
1219
|
+
*/
|
|
1220
|
+
static toHsl(i) {
|
|
1221
|
+
const { r: t, g: e, b: s } = this.parseColor(i), { h: n, s: o, l: a } = this.rgbToHsl(t, e, s);
|
|
1222
|
+
return `hsl(${Math.round(n)}, ${Math.round(o)}%, ${Math.round(a)}%)`;
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* 转换为 HSLA(hsla(h, s%, l%, a))。
|
|
1226
|
+
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1227
|
+
*/
|
|
1228
|
+
static toHsla(i, t) {
|
|
1229
|
+
const e = this.parseColor(i), { h: s, s: n, l: o } = this.rgbToHsl(e.r, e.g, e.b), a = this.resolveAlpha(t, e.a);
|
|
1230
|
+
return `hsla(${Math.round(s)}, ${Math.round(n)}%, ${Math.round(
|
|
1231
|
+
o
|
|
1232
|
+
)}%, ${a})`;
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* 转换为 HSV(hsv(h, s%, v%))。
|
|
1236
|
+
*/
|
|
1237
|
+
static toHsv(i) {
|
|
1238
|
+
const { r: t, g: e, b: s } = this.parseColor(i), { h: n, s: o, v: a } = this.rgbToHsv(t, e, s);
|
|
1239
|
+
return `hsv(${Math.round(n)}, ${Math.round(o)}%, ${Math.round(a)}%)`;
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* 转换为 HSVA(hsva(h, s%, v%, a))。
|
|
1243
|
+
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1244
|
+
*/
|
|
1245
|
+
static toHsva(i, t) {
|
|
1246
|
+
const e = this.parseColor(i), { h: s, s: n, v: o } = this.rgbToHsv(e.r, e.g, e.b), a = this.resolveAlpha(t, e.a);
|
|
1247
|
+
return `hsva(${Math.round(s)}, ${Math.round(n)}%, ${Math.round(
|
|
1248
|
+
o
|
|
1249
|
+
)}%, ${a})`;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* 返回解析后的 RGBA 对象。
|
|
1253
|
+
* @param color 任意受支持的颜色字符串(hex/rgb/hsl/hsv)
|
|
1254
|
+
* @returns {{ r: number; g: number; b: number; a: number }} RGBA 分量,r/g/b 范围 0-255,a 范围 0-1
|
|
1255
|
+
*/
|
|
1256
|
+
static toRgbaObject(i) {
|
|
1257
|
+
return this.parseColor(i);
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* 判断两个颜色是否在允许的色差范围内(基于 RGB 欧几里得距离)。
|
|
1261
|
+
* @param colorA 第一个颜色字符串
|
|
1262
|
+
* @param colorB 第二个颜色字符串
|
|
1263
|
+
* @param threshold 允许的最大色差值,范围约 0(完全相同)到 442(黑白最大距离),含 alpha 时上限约 510
|
|
1264
|
+
* @param includeAlpha 是否将 alpha 差值纳入计算,默认 true;启用时 alpha 差值会缩放到 0-255 参与距离
|
|
1265
|
+
* @returns true 表示在允许色差内
|
|
1266
|
+
*/
|
|
1267
|
+
static isWithinColorDifference(i, t, e, s = !0) {
|
|
1268
|
+
const n = this.parseColor(i), o = this.parseColor(t), a = n.r - o.r, l = n.g - o.g, c = n.b - o.b;
|
|
1269
|
+
let h = a * a + l * l + c * c;
|
|
1270
|
+
if (s) {
|
|
1271
|
+
const u = (n.a - o.a) * 255;
|
|
1272
|
+
h += u * u;
|
|
1273
|
+
}
|
|
1274
|
+
return Math.sqrt(h) <= e;
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* 混合两个颜色(在 RGBA 空间线性插值)。
|
|
1278
|
+
* @param colorA 起始颜色
|
|
1279
|
+
* @param colorB 终点颜色
|
|
1280
|
+
* @param ratio 混合比例,0 = 完全 A,1 = 完全 B
|
|
1281
|
+
* @returns 混合后的 rgba 字符串
|
|
1282
|
+
*/
|
|
1283
|
+
static mix(i, t, e) {
|
|
1284
|
+
const s = this.clamp(e, 0, 1), n = this.parseColor(i), o = this.parseColor(t), a = n.r + (o.r - n.r) * s, l = n.g + (o.g - n.g) * s, c = n.b + (o.b - n.b) * s, h = n.a + (o.a - n.a) * s;
|
|
1285
|
+
return `rgba(${Math.round(a)}, ${Math.round(l)}, ${Math.round(c)}, ${h})`;
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* 转换为灰度(基于 ITU-R BT.709 权重)。
|
|
1289
|
+
* @param color 任意受支持的颜色字符串
|
|
1290
|
+
* @returns 灰度 rgb 字符串
|
|
1291
|
+
*/
|
|
1292
|
+
static toGrayscale(i) {
|
|
1293
|
+
const { r: t, g: e, b: s } = this.parseColor(i), n = Math.round(t * 0.2126 + e * 0.7152 + s * 0.0722);
|
|
1294
|
+
return this.toRoundedRgbString(n, n, n);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* 计算 WCAG 2.0 相对亮度。
|
|
1298
|
+
* @param color 任意受支持的颜色字符串
|
|
1299
|
+
* @returns 相对亮度值,范围 [0, 1]
|
|
1300
|
+
*/
|
|
1301
|
+
static luminance(i) {
|
|
1302
|
+
const { r: t, g: e, b: s } = this.parseColor(i), n = (o) => {
|
|
1303
|
+
const a = o / 255;
|
|
1304
|
+
return a <= 0.03928 ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4);
|
|
1305
|
+
};
|
|
1306
|
+
return n(t) * 0.2126 + n(e) * 0.7152 + n(s) * 0.0722;
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* 计算 WCAG 2.0 对比度。
|
|
1310
|
+
* @param colorA 第一个颜色
|
|
1311
|
+
* @param colorB 第二个颜色
|
|
1312
|
+
* @returns 对比度值,范围 [1, 21]
|
|
1313
|
+
*/
|
|
1314
|
+
static contrastRatio(i, t) {
|
|
1315
|
+
const e = this.luminance(i), s = this.luminance(t), n = Math.max(e, s), o = Math.min(e, s);
|
|
1316
|
+
return (n + 0.05) / (o + 0.05);
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* 设置透明度并返回 rgba 字符串。
|
|
1320
|
+
* @param color 任意受支持的颜色字符串
|
|
1321
|
+
* @param alpha 目标透明度,范围 [0, 1]
|
|
1322
|
+
* @returns rgba 字符串
|
|
1323
|
+
*/
|
|
1324
|
+
static withAlpha(i, t) {
|
|
1325
|
+
const { r: e, g: s, b: n } = this.parseColor(i), o = this.clamp(t, 0, 1);
|
|
1326
|
+
return `rgba(${Math.round(e)}, ${Math.round(s)}, ${Math.round(n)}, ${o})`;
|
|
1327
|
+
}
|
|
1036
1328
|
}
|
|
1037
|
-
|
|
1329
|
+
d(hi, "DEFAULT_ALPHA", 1);
|
|
1330
|
+
function gn(r, i = 3e3) {
|
|
1038
1331
|
if (typeof r != "function")
|
|
1039
1332
|
return console.error("非函数:", r);
|
|
1040
1333
|
const t = window.requestIdleCallback, e = function(s) {
|
|
@@ -1042,7 +1335,7 @@ function nn(r, i = 3e3) {
|
|
|
1042
1335
|
};
|
|
1043
1336
|
t ? t(e, { timeout: i }) : requestAnimationFrame(() => r());
|
|
1044
1337
|
}
|
|
1045
|
-
function
|
|
1338
|
+
function ui(r, i) {
|
|
1046
1339
|
const t = Date.now();
|
|
1047
1340
|
return new Promise((e, s) => {
|
|
1048
1341
|
const n = () => {
|
|
@@ -1054,19 +1347,19 @@ function si(r, i) {
|
|
|
1054
1347
|
n();
|
|
1055
1348
|
});
|
|
1056
1349
|
}
|
|
1057
|
-
function
|
|
1350
|
+
function ct(r, i, t = [], e = Date.now()) {
|
|
1058
1351
|
if (e < Date.now() - 50) {
|
|
1059
1352
|
console.error("_MergeObjects 合并异常:疑似死循环");
|
|
1060
1353
|
return;
|
|
1061
1354
|
}
|
|
1062
|
-
const s =
|
|
1355
|
+
const s = re(r), n = re(i);
|
|
1063
1356
|
if (s != n) return i;
|
|
1064
1357
|
if (s == "object" || s == "array") {
|
|
1065
1358
|
if (t.some(([o, a]) => o == r && a == i)) return r;
|
|
1066
1359
|
if (t.push([r, i]), s == "object") {
|
|
1067
1360
|
for (const o in i)
|
|
1068
1361
|
if (Object.prototype.hasOwnProperty.call(i, o)) {
|
|
1069
|
-
const a = i[o], l = r[o], c =
|
|
1362
|
+
const a = i[o], l = r[o], c = ct(
|
|
1070
1363
|
l,
|
|
1071
1364
|
a,
|
|
1072
1365
|
t,
|
|
@@ -1077,7 +1370,7 @@ function lt(r, i, t = [], e = Date.now()) {
|
|
|
1077
1370
|
return r;
|
|
1078
1371
|
} else if (s == "array")
|
|
1079
1372
|
return i.forEach((o, a) => {
|
|
1080
|
-
const l = o, c = r[a], h =
|
|
1373
|
+
const l = o, c = r[a], h = ct(
|
|
1081
1374
|
c,
|
|
1082
1375
|
l,
|
|
1083
1376
|
t,
|
|
@@ -1087,13 +1380,13 @@ function lt(r, i, t = [], e = Date.now()) {
|
|
|
1087
1380
|
}), r;
|
|
1088
1381
|
} else return i;
|
|
1089
1382
|
}
|
|
1090
|
-
function
|
|
1383
|
+
function oe(r = "") {
|
|
1091
1384
|
return r + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(i) {
|
|
1092
1385
|
const t = Math.random() * 16 | 0;
|
|
1093
1386
|
return (i === "x" ? t : t & 3 | 8).toString(16);
|
|
1094
1387
|
});
|
|
1095
1388
|
}
|
|
1096
|
-
function
|
|
1389
|
+
function ze(r, i) {
|
|
1097
1390
|
let t;
|
|
1098
1391
|
return function(...e) {
|
|
1099
1392
|
clearTimeout(t), t = setTimeout(() => {
|
|
@@ -1101,7 +1394,7 @@ function Le(r, i) {
|
|
|
1101
1394
|
}, i);
|
|
1102
1395
|
};
|
|
1103
1396
|
}
|
|
1104
|
-
function
|
|
1397
|
+
function vn(r, i) {
|
|
1105
1398
|
let t = -1 / 0;
|
|
1106
1399
|
return function(...e) {
|
|
1107
1400
|
const s = performance.now();
|
|
@@ -1115,52 +1408,52 @@ function rn(r, i) {
|
|
|
1115
1408
|
}
|
|
1116
1409
|
};
|
|
1117
1410
|
}
|
|
1118
|
-
function
|
|
1411
|
+
function yn(r, i) {
|
|
1119
1412
|
if (!r || !i) return r;
|
|
1120
|
-
const t =
|
|
1413
|
+
const t = Fe(i);
|
|
1121
1414
|
return t.length ? t.reduce((e, s, n) => {
|
|
1122
1415
|
const o = n === t.length - 1;
|
|
1123
|
-
if (
|
|
1124
|
-
const a = s.match(
|
|
1416
|
+
if (Ie.test(s)) {
|
|
1417
|
+
const a = s.match(Ne) || [];
|
|
1125
1418
|
return a.reduce((l, c, h) => {
|
|
1126
1419
|
if (/^\w+$/.test(c))
|
|
1127
1420
|
return l[c] || (h < a.length - 1 ? [] : {});
|
|
1128
|
-
const u = c.match(
|
|
1421
|
+
const u = c.match(He), f = u ? parseInt(u[1], 10) : 0, m = h === a.length - 1;
|
|
1129
1422
|
return m && o ? l[f] : l[f] || (m ? {} : []);
|
|
1130
1423
|
}, e);
|
|
1131
1424
|
}
|
|
1132
1425
|
return o ? e[s] : e[s] || {};
|
|
1133
1426
|
}, r) : r;
|
|
1134
1427
|
}
|
|
1135
|
-
function
|
|
1428
|
+
function wn(r, i, t, e) {
|
|
1136
1429
|
if (!r || !i) return t;
|
|
1137
|
-
const s =
|
|
1430
|
+
const s = Fe(i);
|
|
1138
1431
|
return s.length ? s.reduce((n, o, a) => {
|
|
1139
1432
|
const l = a === s.length - 1;
|
|
1140
|
-
if (
|
|
1141
|
-
const c = o.match(
|
|
1433
|
+
if (Ie.test(o)) {
|
|
1434
|
+
const c = o.match(Ne) || [];
|
|
1142
1435
|
return c.reduce((h, u, f) => {
|
|
1143
1436
|
const m = f === c.length - 1;
|
|
1144
1437
|
if (/^\w+$/.test(u))
|
|
1145
1438
|
return h.hasOwnProperty(u) || (h[u] = []), h[u];
|
|
1146
|
-
const g = u.match(
|
|
1439
|
+
const g = u.match(He), p = g ? parseInt(g[1], 10) : 0, y = m && l;
|
|
1147
1440
|
return h.hasOwnProperty(p) ? y && !e && (h[p] = t) : h[p] = y ? t : m ? {} : [], h[p];
|
|
1148
1441
|
}, n);
|
|
1149
1442
|
}
|
|
1150
1443
|
return l ? ((!e || !n.hasOwnProperty(o)) && (n[o] = t), n[o]) : (n.hasOwnProperty(o) || (n[o] = {}), n[o]);
|
|
1151
1444
|
}, r) : t;
|
|
1152
1445
|
}
|
|
1153
|
-
function
|
|
1446
|
+
function xn(r) {
|
|
1154
1447
|
return r.map((i, t) => r.slice(t).concat(r.slice(0, t)));
|
|
1155
1448
|
}
|
|
1156
|
-
function
|
|
1449
|
+
function di(r) {
|
|
1157
1450
|
const i = window.structuredClone, t = (e, s = /* @__PURE__ */ new WeakMap()) => {
|
|
1158
1451
|
const n = e;
|
|
1159
1452
|
if (n === null || typeof n != "object")
|
|
1160
1453
|
return n;
|
|
1161
1454
|
if (s.has(n))
|
|
1162
1455
|
return s.get(n);
|
|
1163
|
-
switch (
|
|
1456
|
+
switch (re(n)) {
|
|
1164
1457
|
case "array": {
|
|
1165
1458
|
const a = [];
|
|
1166
1459
|
s.set(n, a);
|
|
@@ -1244,7 +1537,7 @@ function ni(r) {
|
|
|
1244
1537
|
return console.warn("structuredClone error:", e), i && t(r);
|
|
1245
1538
|
}
|
|
1246
1539
|
}
|
|
1247
|
-
function
|
|
1540
|
+
function fi(r, i) {
|
|
1248
1541
|
const t = [
|
|
1249
1542
|
[11, "#d03050"],
|
|
1250
1543
|
[8, "#f0a020"],
|
|
@@ -1276,7 +1569,7 @@ function ri(r, i) {
|
|
|
1276
1569
|
), f;
|
|
1277
1570
|
};
|
|
1278
1571
|
}
|
|
1279
|
-
function
|
|
1572
|
+
function bn(r) {
|
|
1280
1573
|
const i = Date.now();
|
|
1281
1574
|
let t = performance.now();
|
|
1282
1575
|
for (; Date.now() - i < r; ) {
|
|
@@ -1289,191 +1582,8 @@ function cn(r) {
|
|
|
1289
1582
|
}
|
|
1290
1583
|
return Date.now() - i;
|
|
1291
1584
|
}
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
}
|
|
1295
|
-
/**
|
|
1296
|
-
* 数值钳制,确保在合法区间内。
|
|
1297
|
-
*/
|
|
1298
|
-
static clamp(i, t, e) {
|
|
1299
|
-
return Math.min(Math.max(i, t), e);
|
|
1300
|
-
}
|
|
1301
|
-
static normalizeHue(i) {
|
|
1302
|
-
return (i % 360 + 360) % 360;
|
|
1303
|
-
}
|
|
1304
|
-
/**
|
|
1305
|
-
* 根据色相分段与色度参数生成 RGB(0-255)。
|
|
1306
|
-
*/
|
|
1307
|
-
static chromaToRgb(i, t, e) {
|
|
1308
|
-
const s = t * (1 - Math.abs(i / 60 % 2 - 1));
|
|
1309
|
-
let n = 0, o = 0, a = 0;
|
|
1310
|
-
return i < 60 ? [n, o, a] = [t, s, 0] : i < 120 ? [n, o, a] = [s, t, 0] : i < 180 ? [n, o, a] = [0, t, s] : i < 240 ? [n, o, a] = [0, s, t] : i < 300 ? [n, o, a] = [s, 0, t] : [n, o, a] = [t, 0, s], {
|
|
1311
|
-
r: (n + e) * 255,
|
|
1312
|
-
g: (o + e) * 255,
|
|
1313
|
-
b: (a + e) * 255
|
|
1314
|
-
};
|
|
1315
|
-
}
|
|
1316
|
-
static resolveAlpha(i, t) {
|
|
1317
|
-
return Number.isFinite(i) ? this.clamp(i, 0, 1) : t;
|
|
1318
|
-
}
|
|
1319
|
-
static toRoundedRgbString(i, t, e) {
|
|
1320
|
-
return `rgb(${Math.round(i)}, ${Math.round(t)}, ${Math.round(e)})`;
|
|
1321
|
-
}
|
|
1322
|
-
/**
|
|
1323
|
-
* HSL 转 RGB。
|
|
1324
|
-
* h: 0-360, s/l: 0-100
|
|
1325
|
-
*/
|
|
1326
|
-
static hslToRgb(i, t, e) {
|
|
1327
|
-
const s = this.normalizeHue(i), n = this.clamp(t, 0, 100) / 100, o = this.clamp(e, 0, 100) / 100, a = (1 - Math.abs(2 * o - 1)) * n, l = o - a / 2;
|
|
1328
|
-
return this.chromaToRgb(s, a, l);
|
|
1329
|
-
}
|
|
1330
|
-
/**
|
|
1331
|
-
* HSV 转 RGB。
|
|
1332
|
-
* h: 0-360, s/v: 0-100
|
|
1333
|
-
*/
|
|
1334
|
-
static hsvToRgb(i, t, e) {
|
|
1335
|
-
const s = this.normalizeHue(i), n = this.clamp(t, 0, 100) / 100, o = this.clamp(e, 0, 100) / 100, a = o * n, l = o - a;
|
|
1336
|
-
return this.chromaToRgb(s, a, l);
|
|
1337
|
-
}
|
|
1338
|
-
/**
|
|
1339
|
-
* 解析任意受支持的颜色格式并标准化为 RGBA。
|
|
1340
|
-
*/
|
|
1341
|
-
static parseColor(i) {
|
|
1342
|
-
const t = i.trim().toLowerCase();
|
|
1343
|
-
if (t.startsWith("#")) {
|
|
1344
|
-
const o = t.slice(1);
|
|
1345
|
-
if (o.length === 3 || o.length === 4) {
|
|
1346
|
-
const [a, l, c, h = "f"] = o.split("");
|
|
1347
|
-
return {
|
|
1348
|
-
r: parseInt(`${a}${a}`, 16),
|
|
1349
|
-
g: parseInt(`${l}${l}`, 16),
|
|
1350
|
-
b: parseInt(`${c}${c}`, 16),
|
|
1351
|
-
a: parseInt(`${h}${h}`, 16) / 255
|
|
1352
|
-
};
|
|
1353
|
-
}
|
|
1354
|
-
if (o.length === 6 || o.length === 8) {
|
|
1355
|
-
const a = parseInt(o.slice(0, 2), 16), l = parseInt(o.slice(2, 4), 16), c = parseInt(o.slice(4, 6), 16), h = o.length === 8 ? parseInt(o.slice(6, 8), 16) / 255 : this.DEFAULT_ALPHA;
|
|
1356
|
-
return { r: a, g: l, b: c, a: h };
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
const e = t.match(/^rgba?\(([^)]+)\)$/);
|
|
1360
|
-
if (e) {
|
|
1361
|
-
const o = e[1].split(",").map((a) => a.trim());
|
|
1362
|
-
if (o.length >= 3) {
|
|
1363
|
-
const a = this.clamp(Number(o[0]), 0, 255), l = this.clamp(Number(o[1]), 0, 255), c = this.clamp(Number(o[2]), 0, 255), h = o.length >= 4 ? this.clamp(Number(o[3]), 0, 1) : this.DEFAULT_ALPHA;
|
|
1364
|
-
return { r: a, g: l, b: c, a: h };
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
const s = t.match(/^hsl\(([^)]+)\)$/);
|
|
1368
|
-
if (s) {
|
|
1369
|
-
const o = s[1].split(",").map((a) => a.trim().replace("%", ""));
|
|
1370
|
-
if (o.length >= 3) {
|
|
1371
|
-
const a = Number(o[0]), l = Number(o[1]), c = Number(o[2]);
|
|
1372
|
-
return { ...this.hslToRgb(a, l, c), a: this.DEFAULT_ALPHA };
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
const n = t.match(/^hsv\(([^)]+)\)$/);
|
|
1376
|
-
if (n) {
|
|
1377
|
-
const o = n[1].split(",").map((a) => a.trim().replace("%", ""));
|
|
1378
|
-
if (o.length >= 3) {
|
|
1379
|
-
const a = Number(o[0]), l = Number(o[1]), c = Number(o[2]);
|
|
1380
|
-
return { ...this.hsvToRgb(a, l, c), a: this.DEFAULT_ALPHA };
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
return console.error("Invalid color format", i), { r: 0, g: 0, b: 0, a: this.DEFAULT_ALPHA };
|
|
1384
|
-
}
|
|
1385
|
-
/**
|
|
1386
|
-
* 十进制颜色分量转两位十六进制字符串。
|
|
1387
|
-
*/
|
|
1388
|
-
static toHexPart(i) {
|
|
1389
|
-
return Math.round(this.clamp(i, 0, 255)).toString(16).padStart(2, "0");
|
|
1390
|
-
}
|
|
1391
|
-
/**
|
|
1392
|
-
* RGB 转 HSL。
|
|
1393
|
-
* 返回 h:0-360, s/l:0-100
|
|
1394
|
-
*/
|
|
1395
|
-
static rgbToHsl(i, t, e) {
|
|
1396
|
-
const s = this.clamp(i, 0, 255) / 255, n = this.clamp(t, 0, 255) / 255, o = this.clamp(e, 0, 255) / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), c = a - l;
|
|
1397
|
-
let h = 0;
|
|
1398
|
-
c !== 0 && (a === s ? h = 60 * ((n - o) / c % 6) : a === n ? h = 60 * ((o - s) / c + 2) : h = 60 * ((s - n) / c + 4)), h < 0 && (h += 360);
|
|
1399
|
-
const u = (a + l) / 2, f = c === 0 ? 0 : c / (1 - Math.abs(2 * u - 1));
|
|
1400
|
-
return { h, s: f * 100, l: u * 100 };
|
|
1401
|
-
}
|
|
1402
|
-
/**
|
|
1403
|
-
* RGB 转 HSV。
|
|
1404
|
-
* 返回 h:0-360, s/v:0-100
|
|
1405
|
-
*/
|
|
1406
|
-
static rgbToHsv(i, t, e) {
|
|
1407
|
-
const s = this.clamp(i, 0, 255) / 255, n = this.clamp(t, 0, 255) / 255, o = this.clamp(e, 0, 255) / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), c = a - l;
|
|
1408
|
-
let h = 0;
|
|
1409
|
-
c !== 0 && (a === s ? h = 60 * ((n - o) / c % 6) : a === n ? h = 60 * ((o - s) / c + 2) : h = 60 * ((s - n) / c + 4)), h < 0 && (h += 360);
|
|
1410
|
-
const u = a === 0 ? 0 : c / a, f = a;
|
|
1411
|
-
return { h, s: u * 100, v: f * 100 };
|
|
1412
|
-
}
|
|
1413
|
-
/**
|
|
1414
|
-
* 转换为 HEX(#RRGGBB)。
|
|
1415
|
-
*/
|
|
1416
|
-
static toHex(i) {
|
|
1417
|
-
const { r: t, g: e, b: s } = this.parseColor(i);
|
|
1418
|
-
return `#${this.toHexPart(t)}${this.toHexPart(e)}${this.toHexPart(s)}`;
|
|
1419
|
-
}
|
|
1420
|
-
/**
|
|
1421
|
-
* 转换为 HEXA(#RRGGBBAA)。
|
|
1422
|
-
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1423
|
-
*/
|
|
1424
|
-
static toHexa(i, t) {
|
|
1425
|
-
const { r: e, g: s, b: n, a: o } = this.parseColor(i), a = this.resolveAlpha(t, o);
|
|
1426
|
-
return `#${this.toHexPart(e)}${this.toHexPart(s)}${this.toHexPart(n)}${this.toHexPart(a * 255)}`;
|
|
1427
|
-
}
|
|
1428
|
-
/**
|
|
1429
|
-
* 转换为 RGB(rgb(r, g, b))。
|
|
1430
|
-
*/
|
|
1431
|
-
static toRgb(i) {
|
|
1432
|
-
const { r: t, g: e, b: s } = this.parseColor(i);
|
|
1433
|
-
return this.toRoundedRgbString(t, e, s);
|
|
1434
|
-
}
|
|
1435
|
-
/**
|
|
1436
|
-
* 转换为 RGBA(rgba(r, g, b, a))。
|
|
1437
|
-
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1438
|
-
*/
|
|
1439
|
-
static toRgba(i, t) {
|
|
1440
|
-
const e = this.parseColor(i), s = this.resolveAlpha(t, e.a);
|
|
1441
|
-
return `rgba(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)}, ${s})`;
|
|
1442
|
-
}
|
|
1443
|
-
/**
|
|
1444
|
-
* 转换为 HSL(hsl(h, s%, l%))。
|
|
1445
|
-
*/
|
|
1446
|
-
static toHsl(i) {
|
|
1447
|
-
const { r: t, g: e, b: s } = this.parseColor(i), { h: n, s: o, l: a } = this.rgbToHsl(t, e, s);
|
|
1448
|
-
return `hsl(${Math.round(n)}, ${Math.round(o)}%, ${Math.round(a)}%)`;
|
|
1449
|
-
}
|
|
1450
|
-
/**
|
|
1451
|
-
* 转换为 HSLA(hsla(h, s%, l%, a))。
|
|
1452
|
-
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1453
|
-
*/
|
|
1454
|
-
static toHsla(i, t) {
|
|
1455
|
-
const e = this.parseColor(i), { h: s, s: n, l: o } = this.rgbToHsl(e.r, e.g, e.b), a = this.resolveAlpha(t, e.a);
|
|
1456
|
-
return `hsla(${Math.round(s)}, ${Math.round(n)}%, ${Math.round(o)}%, ${a})`;
|
|
1457
|
-
}
|
|
1458
|
-
/**
|
|
1459
|
-
* 转换为 HSV(hsv(h, s%, v%))。
|
|
1460
|
-
*/
|
|
1461
|
-
static toHsv(i) {
|
|
1462
|
-
const { r: t, g: e, b: s } = this.parseColor(i), { h: n, s: o, v: a } = this.rgbToHsv(t, e, s);
|
|
1463
|
-
return `hsv(${Math.round(n)}, ${Math.round(o)}%, ${Math.round(a)}%)`;
|
|
1464
|
-
}
|
|
1465
|
-
/**
|
|
1466
|
-
* 转换为 HSVA(hsva(h, s%, v%, a))。
|
|
1467
|
-
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1468
|
-
*/
|
|
1469
|
-
static toHsva(i, t) {
|
|
1470
|
-
const e = this.parseColor(i), { h: s, s: n, v: o } = this.rgbToHsv(e.r, e.g, e.b), a = this.resolveAlpha(t, e.a);
|
|
1471
|
-
return `hsva(${Math.round(s)}, ${Math.round(n)}%, ${Math.round(o)}%, ${a})`;
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
d(oi, "DEFAULT_ALPHA", 1);
|
|
1475
|
-
var yt = /* @__PURE__ */ ((r) => (r.RESPONSE = "response", r.QUERY = "query", r))(yt || {});
|
|
1476
|
-
class hn {
|
|
1585
|
+
var wt = /* @__PURE__ */ ((r) => (r.RESPONSE = "response", r.QUERY = "query", r))(wt || {});
|
|
1586
|
+
class Pn {
|
|
1477
1587
|
constructor(i, t) {
|
|
1478
1588
|
/** 音效资源地址映射(preload 成功后对应项会替换为 blob: URL) */
|
|
1479
1589
|
d(this, "soundSources");
|
|
@@ -1563,11 +1673,11 @@ class hn {
|
|
|
1563
1673
|
}), l;
|
|
1564
1674
|
}
|
|
1565
1675
|
}
|
|
1566
|
-
function
|
|
1676
|
+
function Me(r, i) {
|
|
1567
1677
|
for (const t of Object.keys(i))
|
|
1568
1678
|
i[t] !== void 0 && (r[t] = i[t]);
|
|
1569
1679
|
}
|
|
1570
|
-
class
|
|
1680
|
+
class Cn {
|
|
1571
1681
|
constructor(i) {
|
|
1572
1682
|
/** WebSocket地址 */
|
|
1573
1683
|
d(this, "url");
|
|
@@ -1608,7 +1718,7 @@ class un {
|
|
|
1608
1718
|
});
|
|
1609
1719
|
if (!i) return;
|
|
1610
1720
|
const { url: t, ping: e, maxRetryCount: s, retryInterval: n } = i;
|
|
1611
|
-
e !== void 0 && (typeof e == "boolean" ? this.pingConfig.enabled = e :
|
|
1721
|
+
e !== void 0 && (typeof e == "boolean" ? this.pingConfig.enabled = e : Me(this.pingConfig, e)), Me(this.retryConfig, {
|
|
1612
1722
|
maxCount: s,
|
|
1613
1723
|
interval: n
|
|
1614
1724
|
}), t && this.start(t);
|
|
@@ -1659,7 +1769,7 @@ class un {
|
|
|
1659
1769
|
(i = this.socket) == null || i.close(), this.socket = void 0;
|
|
1660
1770
|
}
|
|
1661
1771
|
}
|
|
1662
|
-
function
|
|
1772
|
+
function Sn(r, i = 10) {
|
|
1663
1773
|
let t = 0, e = i;
|
|
1664
1774
|
function s() {
|
|
1665
1775
|
if (e > 0)
|
|
@@ -1673,7 +1783,7 @@ function dn(r, i = 10) {
|
|
|
1673
1783
|
t = Date.now(), s();
|
|
1674
1784
|
});
|
|
1675
1785
|
}
|
|
1676
|
-
function
|
|
1786
|
+
function _n(r) {
|
|
1677
1787
|
const i = () => Promise.resolve(), t = (a) => (console.error(a), Promise.reject(a));
|
|
1678
1788
|
function e() {
|
|
1679
1789
|
return navigator.clipboard.writeText(r).then(i).catch(t);
|
|
@@ -1700,8 +1810,8 @@ function fn(r) {
|
|
|
1700
1810
|
}
|
|
1701
1811
|
return navigator.clipboard ? e().catch(o) : o();
|
|
1702
1812
|
}
|
|
1703
|
-
function
|
|
1704
|
-
const t =
|
|
1813
|
+
function En(r, i) {
|
|
1814
|
+
const t = Te[r];
|
|
1705
1815
|
if (!t) return console.error(`未知纸张类型: ${r}`);
|
|
1706
1816
|
const { width: e, height: s } = t, n = (g) => g / 25.4, a = typeof window < "u" ? window.devicePixelRatio * 96 : 300, l = (g) => Math.round(n(g) * a), c = l(e), h = l(s), u = l(i), f = Math.max(0, c - 2 * u), m = Math.max(0, h - 2 * u);
|
|
1707
1817
|
return {
|
|
@@ -1717,7 +1827,7 @@ function mn(r, i) {
|
|
|
1717
1827
|
paperHeightPx: h
|
|
1718
1828
|
};
|
|
1719
1829
|
}
|
|
1720
|
-
class
|
|
1830
|
+
class Ht {
|
|
1721
1831
|
constructor() {
|
|
1722
1832
|
}
|
|
1723
1833
|
/** 初始化标签页管理器 */
|
|
@@ -1737,13 +1847,13 @@ class Nt {
|
|
|
1737
1847
|
/** 处理BroadcastChannel消息 */
|
|
1738
1848
|
static handleChannelMessage(i) {
|
|
1739
1849
|
const { type: t, responseKey: e, name: s } = i.data;
|
|
1740
|
-
if (t ===
|
|
1850
|
+
if (t === wt.RESPONSE) {
|
|
1741
1851
|
const n = this.pendingQueries.get(e);
|
|
1742
1852
|
n == null || n.forEach((o) => o(s));
|
|
1743
|
-
} else if (t ===
|
|
1853
|
+
} else if (t === wt.QUERY) {
|
|
1744
1854
|
if (this.pendingQueries.has(e) || s != "*" && s != window.name) return;
|
|
1745
1855
|
const n = {
|
|
1746
|
-
type:
|
|
1856
|
+
type: wt.RESPONSE,
|
|
1747
1857
|
responseKey: e,
|
|
1748
1858
|
name: window.name
|
|
1749
1859
|
};
|
|
@@ -1759,16 +1869,16 @@ class Nt {
|
|
|
1759
1869
|
const o = "请先初始化标签页管理器";
|
|
1760
1870
|
return console.error(o), Promise.reject(o);
|
|
1761
1871
|
}
|
|
1762
|
-
const t =
|
|
1872
|
+
const t = oe();
|
|
1763
1873
|
let e = !1;
|
|
1764
1874
|
const s = this.pendingQueries.get(t) || [];
|
|
1765
1875
|
s.push(() => e = !0), this.pendingQueries.set(t, s);
|
|
1766
1876
|
const n = {
|
|
1767
|
-
type:
|
|
1877
|
+
type: wt.QUERY,
|
|
1768
1878
|
responseKey: t,
|
|
1769
1879
|
name: i
|
|
1770
1880
|
};
|
|
1771
|
-
return this.channel.postMessage(n),
|
|
1881
|
+
return this.channel.postMessage(n), ui(() => e, this.timeout).finally(
|
|
1772
1882
|
() => this.pendingQueries.delete(t)
|
|
1773
1883
|
);
|
|
1774
1884
|
}
|
|
@@ -1790,10 +1900,10 @@ class Nt {
|
|
|
1790
1900
|
const n = "请先初始化标签页管理器";
|
|
1791
1901
|
return console.error(n), Promise.reject(n);
|
|
1792
1902
|
}
|
|
1793
|
-
const i =
|
|
1903
|
+
const i = oe(), t = [], e = this.pendingQueries.get(i) || [];
|
|
1794
1904
|
e.push((n) => t.push(n)), this.pendingQueries.set(i, e);
|
|
1795
1905
|
const s = {
|
|
1796
|
-
type:
|
|
1906
|
+
type: wt.QUERY,
|
|
1797
1907
|
responseKey: i,
|
|
1798
1908
|
name: "*"
|
|
1799
1909
|
};
|
|
@@ -1805,15 +1915,15 @@ class Nt {
|
|
|
1805
1915
|
}
|
|
1806
1916
|
}
|
|
1807
1917
|
/** 初始化完成标志 */
|
|
1808
|
-
d(
|
|
1809
|
-
d(
|
|
1810
|
-
d(
|
|
1918
|
+
d(Ht, "initFinish", !1), /** 频道 */
|
|
1919
|
+
d(Ht, "channel", new BroadcastChannel("nhanh-pure-function")), /** 等待回执消息时间上限(上限) */
|
|
1920
|
+
d(Ht, "timeout", 150), /**
|
|
1811
1921
|
* 待处理查询
|
|
1812
1922
|
* @param key 回执消息key
|
|
1813
1923
|
* @param callback 匹配标签页的回调函数
|
|
1814
1924
|
*/
|
|
1815
|
-
d(
|
|
1816
|
-
class
|
|
1925
|
+
d(Ht, "pendingQueries", /* @__PURE__ */ new Map());
|
|
1926
|
+
class Mn {
|
|
1817
1927
|
constructor() {
|
|
1818
1928
|
/** 用户状态:active(活跃) / idle(闲置) */
|
|
1819
1929
|
d(this, "status", "active");
|
|
@@ -1862,7 +1972,7 @@ class pn {
|
|
|
1862
1972
|
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
1863
1973
|
* MIT Licence
|
|
1864
1974
|
*/
|
|
1865
|
-
var
|
|
1975
|
+
var ae = 9e15, ut = 1e9, le = "0123456789abcdef", Xt = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", Yt = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", ce = {
|
|
1866
1976
|
// These values must be integers within the stated ranges (inclusive).
|
|
1867
1977
|
// Most of these values can be changed at run-time using the `Decimal.config` method.
|
|
1868
1978
|
// The maximum number of significant digits of the result of a calculation or base conversion.
|
|
@@ -1915,12 +2025,12 @@ var re = 9e15, ht = 1e9, oe = "0123456789abcdef", Gt = "2.3025850929940456840179
|
|
|
1915
2025
|
// -1 to -EXP_LIMIT
|
|
1916
2026
|
// The maximum exponent value, above which overflow to Infinity occurs.
|
|
1917
2027
|
// JavaScript numbers: 308 (1.7976931348623157e+308)
|
|
1918
|
-
maxE:
|
|
2028
|
+
maxE: ae,
|
|
1919
2029
|
// 1 to EXP_LIMIT
|
|
1920
2030
|
// Whether to use cryptographically-secure random number generation, if available.
|
|
1921
2031
|
crypto: !1
|
|
1922
2032
|
// true/false
|
|
1923
|
-
},
|
|
2033
|
+
}, Be, st, _ = !0, Kt = "[DecimalError] ", ht = Kt + "Invalid argument: ", Ue = Kt + "Precision limit exceeded", Ge = Kt + "crypto unavailable", Xe = "[object Decimal]", F = Math.floor, I = Math.pow, mi = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, pi = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, gi = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, Ye = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, Z = 1e7, S = 7, vi = 9007199254740991, yi = Xt.length - 1, he = Yt.length - 1, v = { toStringTag: Xe };
|
|
1924
2034
|
v.absoluteValue = v.abs = function() {
|
|
1925
2035
|
var r = new this.constructor(this);
|
|
1926
2036
|
return r.s < 0 && (r.s = 1), C(r);
|
|
@@ -1931,7 +2041,7 @@ v.ceil = function() {
|
|
|
1931
2041
|
v.clampedTo = v.clamp = function(r, i) {
|
|
1932
2042
|
var t, e = this, s = e.constructor;
|
|
1933
2043
|
if (r = new s(r), i = new s(i), !r.s || !i.s) return new s(NaN);
|
|
1934
|
-
if (r.gt(i)) throw Error(
|
|
2044
|
+
if (r.gt(i)) throw Error(ht + i);
|
|
1935
2045
|
return t = e.cmp(r), t < 0 ? r : e.cmp(i) > 0 ? i : new s(e);
|
|
1936
2046
|
};
|
|
1937
2047
|
v.comparedTo = v.cmp = function(r) {
|
|
@@ -1947,13 +2057,13 @@ v.comparedTo = v.cmp = function(r) {
|
|
|
1947
2057
|
};
|
|
1948
2058
|
v.cosine = v.cos = function() {
|
|
1949
2059
|
var r, i, t = this, e = t.constructor;
|
|
1950
|
-
return t.d ? t.d[0] ? (r = e.precision, i = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t =
|
|
2060
|
+
return t.d ? t.d[0] ? (r = e.precision, i = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t = wi(e, Ke(e, t)), e.precision = r, e.rounding = i, C(st == 2 || st == 3 ? t.neg() : t, r, i, !0)) : new e(1) : new e(NaN);
|
|
1951
2061
|
};
|
|
1952
2062
|
v.cubeRoot = v.cbrt = function() {
|
|
1953
2063
|
var r, i, t, e, s, n, o, a, l, c, h = this, u = h.constructor;
|
|
1954
2064
|
if (!h.isFinite() || h.isZero()) return new u(h);
|
|
1955
2065
|
for (_ = !1, n = h.s * I(h.s * h, 1 / 3), !n || Math.abs(n) == 1 / 0 ? (t = N(h.d), r = h.e, (n = (r - t.length + 1) % 3) && (t += n == 1 || n == -2 ? "0" : "00"), n = I(t, 1 / 3), r = F((r + 1) / 3) - (r % 3 == (r < 0 ? -1 : 2)), n == 1 / 0 ? t = "5e" + r : (t = n.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + r), e = new u(t), e.s = h.s) : e = new u(n.toString()), o = (r = u.precision) + 3; ; )
|
|
1956
|
-
if (a = e, l = a.times(a).times(a), c = l.plus(h), e =
|
|
2066
|
+
if (a = e, l = a.times(a).times(a), c = l.plus(h), e = A(c.plus(h).times(a), c.plus(l), o + 2, 1), N(a.d).slice(0, o) === (t = N(e.d)).slice(0, o))
|
|
1957
2067
|
if (t = t.slice(o - 3, o + 1), t == "9999" || !s && t == "4999") {
|
|
1958
2068
|
if (!s && (C(a, r + 1, 0), a.times(a).times(a).eq(h))) {
|
|
1959
2069
|
e = a;
|
|
@@ -1975,11 +2085,11 @@ v.decimalPlaces = v.dp = function() {
|
|
|
1975
2085
|
return t;
|
|
1976
2086
|
};
|
|
1977
2087
|
v.dividedBy = v.div = function(r) {
|
|
1978
|
-
return
|
|
2088
|
+
return A(this, new this.constructor(r));
|
|
1979
2089
|
};
|
|
1980
2090
|
v.dividedToIntegerBy = v.divToInt = function(r) {
|
|
1981
2091
|
var i = this, t = i.constructor;
|
|
1982
|
-
return C(
|
|
2092
|
+
return C(A(i, new t(r), 0, 1, 1), t.precision, t.rounding);
|
|
1983
2093
|
};
|
|
1984
2094
|
v.equals = v.eq = function(r) {
|
|
1985
2095
|
return this.cmp(r) === 0;
|
|
@@ -1998,7 +2108,7 @@ v.hyperbolicCosine = v.cosh = function() {
|
|
|
1998
2108
|
var r, i, t, e, s, n = this, o = n.constructor, a = new o(1);
|
|
1999
2109
|
if (!n.isFinite()) return new o(n.s ? 1 / 0 : NaN);
|
|
2000
2110
|
if (n.isZero()) return a;
|
|
2001
|
-
t = o.precision, e = o.rounding, o.precision = t + Math.max(n.e, n.sd()) + 4, o.rounding = 1, s = n.d.length, s < 32 ? (r = Math.ceil(s / 3), i = (1 /
|
|
2111
|
+
t = o.precision, e = o.rounding, o.precision = t + Math.max(n.e, n.sd()) + 4, o.rounding = 1, s = n.d.length, s < 32 ? (r = Math.ceil(s / 3), i = (1 / Qt(4, r)).toString()) : (r = 16, i = "2.3283064365386962890625e-10"), n = Dt(o, 1, n.times(i), new o(1), !0);
|
|
2002
2112
|
for (var l, c = r, h = new o(8); c--; )
|
|
2003
2113
|
l = n.times(n), n = a.minus(l.times(h.minus(l.times(h))));
|
|
2004
2114
|
return C(n, o.precision = t, o.rounding = e, !0);
|
|
@@ -2007,9 +2117,9 @@ v.hyperbolicSine = v.sinh = function() {
|
|
|
2007
2117
|
var r, i, t, e, s = this, n = s.constructor;
|
|
2008
2118
|
if (!s.isFinite() || s.isZero()) return new n(s);
|
|
2009
2119
|
if (i = n.precision, t = n.rounding, n.precision = i + Math.max(s.e, s.sd()) + 4, n.rounding = 1, e = s.d.length, e < 3)
|
|
2010
|
-
s =
|
|
2120
|
+
s = Dt(n, 2, s, s, !0);
|
|
2011
2121
|
else {
|
|
2012
|
-
r = 1.4 * Math.sqrt(e), r = r > 16 ? 16 : r | 0, s = s.times(1 /
|
|
2122
|
+
r = 1.4 * Math.sqrt(e), r = r > 16 ? 16 : r | 0, s = s.times(1 / Qt(5, r)), s = Dt(n, 2, s, s, !0);
|
|
2013
2123
|
for (var o, a = new n(5), l = new n(16), c = new n(20); r--; )
|
|
2014
2124
|
o = s.times(s), s = s.times(a.plus(o.times(l.times(o).plus(c))));
|
|
2015
2125
|
}
|
|
@@ -2017,7 +2127,7 @@ v.hyperbolicSine = v.sinh = function() {
|
|
|
2017
2127
|
};
|
|
2018
2128
|
v.hyperbolicTangent = v.tanh = function() {
|
|
2019
2129
|
var r, i, t = this, e = t.constructor;
|
|
2020
|
-
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, i = e.rounding, e.precision = r + 7, e.rounding = 1,
|
|
2130
|
+
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, i = e.rounding, e.precision = r + 7, e.rounding = 1, A(t.sinh(), t.cosh(), e.precision = r, e.rounding = i)) : new e(t.s);
|
|
2021
2131
|
};
|
|
2022
2132
|
v.inverseCosine = v.acos = function() {
|
|
2023
2133
|
var r = this, i = r.constructor, t = r.abs().cmp(1), e = i.precision, s = i.rounding;
|
|
@@ -2033,7 +2143,7 @@ v.inverseHyperbolicSine = v.asinh = function() {
|
|
|
2033
2143
|
};
|
|
2034
2144
|
v.inverseHyperbolicTangent = v.atanh = function() {
|
|
2035
2145
|
var r, i, t, e, s = this, n = s.constructor;
|
|
2036
|
-
return s.isFinite() ? s.e >= 0 ? new n(s.abs().eq(1) ? s.s / 0 : s.isZero() ? s : NaN) : (r = n.precision, i = n.rounding, e = s.sd(), Math.max(e, r) < 2 * -s.e - 1 ? C(new n(s), r, i, !0) : (n.precision = t = e - s.e, s =
|
|
2146
|
+
return s.isFinite() ? s.e >= 0 ? new n(s.abs().eq(1) ? s.s / 0 : s.isZero() ? s : NaN) : (r = n.precision, i = n.rounding, e = s.sd(), Math.max(e, r) < 2 * -s.e - 1 ? C(new n(s), r, i, !0) : (n.precision = t = e - s.e, s = A(s.plus(1), new n(1).minus(s), t + r, 1), n.precision = r + 4, n.rounding = 1, s = s.ln(), n.precision = r, n.rounding = i, s.times(0.5))) : new n(NaN);
|
|
2037
2147
|
};
|
|
2038
2148
|
v.inverseSine = v.asin = function() {
|
|
2039
2149
|
var r, i, t, e, s = this, n = s.constructor;
|
|
@@ -2044,11 +2154,11 @@ v.inverseTangent = v.atan = function() {
|
|
|
2044
2154
|
if (c.isFinite()) {
|
|
2045
2155
|
if (c.isZero())
|
|
2046
2156
|
return new h(c);
|
|
2047
|
-
if (c.abs().eq(1) && u + 4 <=
|
|
2157
|
+
if (c.abs().eq(1) && u + 4 <= he)
|
|
2048
2158
|
return o = tt(h, u + 4, f).times(0.25), o.s = c.s, o;
|
|
2049
2159
|
} else {
|
|
2050
2160
|
if (!c.s) return new h(NaN);
|
|
2051
|
-
if (u + 4 <=
|
|
2161
|
+
if (u + 4 <= he)
|
|
2052
2162
|
return o = tt(h, u + 4, f).times(0.5), o.s = c.s, o;
|
|
2053
2163
|
}
|
|
2054
2164
|
for (h.precision = a = u + 10, h.rounding = 1, t = Math.min(28, a / S + 2 | 0), r = t; r; --r) c = c.div(c.times(c).plus(1).sqrt().plus(1));
|
|
@@ -2097,13 +2207,13 @@ v.logarithm = v.log = function(r) {
|
|
|
2097
2207
|
for (s = t[0]; s % 10 === 0; ) s /= 10;
|
|
2098
2208
|
n = s !== 1;
|
|
2099
2209
|
}
|
|
2100
|
-
if (_ = !1, a = u + m, o =
|
|
2210
|
+
if (_ = !1, a = u + m, o = lt(c, a), e = i ? $t(h, a + 10) : lt(r, a), l = A(o, e, a, 1), At(l.d, s = u, f))
|
|
2101
2211
|
do
|
|
2102
|
-
if (a += 10, o =
|
|
2212
|
+
if (a += 10, o = lt(c, a), e = i ? $t(h, a + 10) : lt(r, a), l = A(o, e, a, 1), !n) {
|
|
2103
2213
|
+N(l.d).slice(s + 1, s + 15) + 1 == 1e14 && (l = C(l, u + 1, 0));
|
|
2104
2214
|
break;
|
|
2105
2215
|
}
|
|
2106
|
-
while (
|
|
2216
|
+
while (At(l.d, s += 10, f));
|
|
2107
2217
|
return _ = !0, C(l, u, f);
|
|
2108
2218
|
};
|
|
2109
2219
|
v.minus = v.sub = function(r) {
|
|
@@ -2139,17 +2249,17 @@ v.minus = v.sub = function(r) {
|
|
|
2139
2249
|
}
|
|
2140
2250
|
for (; c[--o] === 0; ) c.pop();
|
|
2141
2251
|
for (; c[0] === 0; c.shift()) --t;
|
|
2142
|
-
return c[0] ? (r.d = c, r.e =
|
|
2252
|
+
return c[0] ? (r.d = c, r.e = Zt(c, t), _ ? C(r, a, l) : r) : new g(l === 3 ? -0 : 0);
|
|
2143
2253
|
};
|
|
2144
2254
|
v.modulo = v.mod = function(r) {
|
|
2145
2255
|
var i, t = this, e = t.constructor;
|
|
2146
|
-
return r = new e(r), !t.d || !r.s || r.d && !r.d[0] ? new e(NaN) : !r.d || t.d && !t.d[0] ? C(new e(t), e.precision, e.rounding) : (_ = !1, e.modulo == 9 ? (i =
|
|
2256
|
+
return r = new e(r), !t.d || !r.s || r.d && !r.d[0] ? new e(NaN) : !r.d || t.d && !t.d[0] ? C(new e(t), e.precision, e.rounding) : (_ = !1, e.modulo == 9 ? (i = A(t, r.abs(), 0, 3, 1), i.s *= r.s) : i = A(t, r, 0, e.modulo, 1), i = i.times(r), _ = !0, t.minus(i));
|
|
2147
2257
|
};
|
|
2148
2258
|
v.naturalExponential = v.exp = function() {
|
|
2149
|
-
return
|
|
2259
|
+
return ue(this);
|
|
2150
2260
|
};
|
|
2151
2261
|
v.naturalLogarithm = v.ln = function() {
|
|
2152
|
-
return
|
|
2262
|
+
return lt(this);
|
|
2153
2263
|
};
|
|
2154
2264
|
v.negated = v.neg = function() {
|
|
2155
2265
|
var r = new this.constructor(this);
|
|
@@ -2170,12 +2280,12 @@ v.plus = v.add = function(r) {
|
|
|
2170
2280
|
for (o = c.length, s = h.length, o - s < 0 && (s = o, t = h, h = c, c = t), i = 0; s; )
|
|
2171
2281
|
i = (c[--s] = c[s] + h[s] + i) / Z | 0, c[s] %= Z;
|
|
2172
2282
|
for (i && (c.unshift(i), ++e), o = c.length; c[--o] == 0; ) c.pop();
|
|
2173
|
-
return r.d = c, r.e =
|
|
2283
|
+
return r.d = c, r.e = Zt(c, e), _ ? C(r, a, l) : r;
|
|
2174
2284
|
};
|
|
2175
2285
|
v.precision = v.sd = function(r) {
|
|
2176
2286
|
var i, t = this;
|
|
2177
|
-
if (r !== void 0 && r !== !!r && r !== 1 && r !== 0) throw Error(
|
|
2178
|
-
return t.d ? (i =
|
|
2287
|
+
if (r !== void 0 && r !== !!r && r !== 1 && r !== 0) throw Error(ht + r);
|
|
2288
|
+
return t.d ? (i = $e(t.d), r && t.e + 1 > i && (i = t.e + 1)) : i = NaN, i;
|
|
2179
2289
|
};
|
|
2180
2290
|
v.round = function() {
|
|
2181
2291
|
var r = this, i = r.constructor;
|
|
@@ -2183,14 +2293,14 @@ v.round = function() {
|
|
|
2183
2293
|
};
|
|
2184
2294
|
v.sine = v.sin = function() {
|
|
2185
2295
|
var r, i, t = this, e = t.constructor;
|
|
2186
|
-
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, i = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t =
|
|
2296
|
+
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, i = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t = bi(e, Ke(e, t)), e.precision = r, e.rounding = i, C(st > 2 ? t.neg() : t, r, i, !0)) : new e(NaN);
|
|
2187
2297
|
};
|
|
2188
2298
|
v.squareRoot = v.sqrt = function() {
|
|
2189
2299
|
var r, i, t, e, s, n, o = this, a = o.d, l = o.e, c = o.s, h = o.constructor;
|
|
2190
2300
|
if (c !== 1 || !a || !a[0])
|
|
2191
2301
|
return new h(!c || c < 0 && (!a || a[0]) ? NaN : a ? o : 1 / 0);
|
|
2192
2302
|
for (_ = !1, c = Math.sqrt(+o), c == 0 || c == 1 / 0 ? (i = N(a), (i.length + l) % 2 == 0 && (i += "0"), c = Math.sqrt(i), l = F((l + 1) / 2) - (l < 0 || l % 2), c == 1 / 0 ? i = "5e" + l : (i = c.toExponential(), i = i.slice(0, i.indexOf("e") + 1) + l), e = new h(i)) : e = new h(c.toString()), t = (l = h.precision) + 3; ; )
|
|
2193
|
-
if (n = e, e = n.plus(
|
|
2303
|
+
if (n = e, e = n.plus(A(o, n, t + 2, 1)).times(0.5), N(n.d).slice(0, t) === (i = N(e.d)).slice(0, t))
|
|
2194
2304
|
if (i = i.slice(t - 3, t + 1), i == "9999" || !s && i == "4999") {
|
|
2195
2305
|
if (!s && (C(n, l + 1, 0), n.times(n).eq(o))) {
|
|
2196
2306
|
e = n;
|
|
@@ -2205,7 +2315,7 @@ v.squareRoot = v.sqrt = function() {
|
|
|
2205
2315
|
};
|
|
2206
2316
|
v.tangent = v.tan = function() {
|
|
2207
2317
|
var r, i, t = this, e = t.constructor;
|
|
2208
|
-
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, i = e.rounding, e.precision = r + 10, e.rounding = 1, t = t.sin(), t.s = 1, t =
|
|
2318
|
+
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, i = e.rounding, e.precision = r + 10, e.rounding = 1, t = t.sin(), t.s = 1, t = A(t, new e(1).minus(t.times(t)).sqrt(), r + 10, 0), e.precision = r, e.rounding = i, C(st == 2 || st == 4 ? t.neg() : t, r, i, !0)) : new e(NaN);
|
|
2209
2319
|
};
|
|
2210
2320
|
v.times = v.mul = function(r) {
|
|
2211
2321
|
var i, t, e, s, n, o, a, l, c, h = this, u = h.constructor, f = h.d, m = (r = new u(r)).d;
|
|
@@ -2218,38 +2328,38 @@ v.times = v.mul = function(r) {
|
|
|
2218
2328
|
n[s] = (n[s] + i) % Z | 0;
|
|
2219
2329
|
}
|
|
2220
2330
|
for (; !n[--o]; ) n.pop();
|
|
2221
|
-
return i ? ++t : n.shift(), r.d = n, r.e =
|
|
2331
|
+
return i ? ++t : n.shift(), r.d = n, r.e = Zt(n, t), _ ? C(r, u.precision, u.rounding) : r;
|
|
2222
2332
|
};
|
|
2223
2333
|
v.toBinary = function(r, i) {
|
|
2224
|
-
return
|
|
2334
|
+
return be(this, 2, r, i);
|
|
2225
2335
|
};
|
|
2226
2336
|
v.toDecimalPlaces = v.toDP = function(r, i) {
|
|
2227
2337
|
var t = this, e = t.constructor;
|
|
2228
|
-
return t = new e(t), r === void 0 ? t : (U(r, 0,
|
|
2338
|
+
return t = new e(t), r === void 0 ? t : (U(r, 0, ut), i === void 0 ? i = e.rounding : U(i, 0, 8), C(t, r + t.e + 1, i));
|
|
2229
2339
|
};
|
|
2230
2340
|
v.toExponential = function(r, i) {
|
|
2231
2341
|
var t, e = this, s = e.constructor;
|
|
2232
|
-
return r === void 0 ? t = et(e, !0) : (U(r, 0,
|
|
2342
|
+
return r === void 0 ? t = et(e, !0) : (U(r, 0, ut), i === void 0 ? i = s.rounding : U(i, 0, 8), e = C(new s(e), r + 1, i), t = et(e, !0, r + 1)), e.isNeg() && !e.isZero() ? "-" + t : t;
|
|
2233
2343
|
};
|
|
2234
2344
|
v.toFixed = function(r, i) {
|
|
2235
2345
|
var t, e, s = this, n = s.constructor;
|
|
2236
|
-
return r === void 0 ? t = et(s) : (U(r, 0,
|
|
2346
|
+
return r === void 0 ? t = et(s) : (U(r, 0, ut), i === void 0 ? i = n.rounding : U(i, 0, 8), e = C(new n(s), r + s.e + 1, i), t = et(e, !1, r + e.e + 1)), s.isNeg() && !s.isZero() ? "-" + t : t;
|
|
2237
2347
|
};
|
|
2238
2348
|
v.toFraction = function(r) {
|
|
2239
2349
|
var i, t, e, s, n, o, a, l, c, h, u, f, m = this, g = m.d, p = m.constructor;
|
|
2240
2350
|
if (!g) return new p(m);
|
|
2241
|
-
if (c = t = new p(1), e = l = new p(0), i = new p(e), n = i.e =
|
|
2351
|
+
if (c = t = new p(1), e = l = new p(0), i = new p(e), n = i.e = $e(g) - m.e - 1, o = n % S, i.d[0] = I(10, o < 0 ? S + o : o), r == null)
|
|
2242
2352
|
r = n > 0 ? i : c;
|
|
2243
2353
|
else {
|
|
2244
|
-
if (a = new p(r), !a.isInt() || a.lt(c)) throw Error(
|
|
2354
|
+
if (a = new p(r), !a.isInt() || a.lt(c)) throw Error(ht + a);
|
|
2245
2355
|
r = a.gt(i) ? n > 0 ? i : c : a;
|
|
2246
2356
|
}
|
|
2247
|
-
for (_ = !1, a = new p(N(g)), h = p.precision, p.precision = n = g.length * S * 2; u =
|
|
2357
|
+
for (_ = !1, a = new p(N(g)), h = p.precision, p.precision = n = g.length * S * 2; u = A(a, i, 0, 1, 1), s = t.plus(u.times(e)), s.cmp(r) != 1; )
|
|
2248
2358
|
t = e, e = s, s = c, c = l.plus(u.times(s)), l = s, s = i, i = a.minus(u.times(s)), a = s;
|
|
2249
|
-
return s =
|
|
2359
|
+
return s = A(r.minus(t), e, 0, 1, 1), l = l.plus(s.times(c)), t = t.plus(s.times(e)), l.s = c.s = m.s, f = A(c, e, n, 1).minus(m).abs().cmp(A(l, t, n, 1).minus(m).abs()) < 1 ? [c, e] : [l, t], p.precision = h, _ = !0, f;
|
|
2250
2360
|
};
|
|
2251
2361
|
v.toHexadecimal = v.toHex = function(r, i) {
|
|
2252
|
-
return
|
|
2362
|
+
return be(this, 16, r, i);
|
|
2253
2363
|
};
|
|
2254
2364
|
v.toNearest = function(r, i) {
|
|
2255
2365
|
var t = this, e = t.constructor;
|
|
@@ -2261,35 +2371,35 @@ v.toNearest = function(r, i) {
|
|
|
2261
2371
|
if (!r.d)
|
|
2262
2372
|
return r.s && (r.s = t.s), r;
|
|
2263
2373
|
}
|
|
2264
|
-
return r.d[0] ? (_ = !1, t =
|
|
2374
|
+
return r.d[0] ? (_ = !1, t = A(t, r, 0, i, 1).times(r), _ = !0, C(t)) : (r.s = t.s, t = r), t;
|
|
2265
2375
|
};
|
|
2266
2376
|
v.toNumber = function() {
|
|
2267
2377
|
return +this;
|
|
2268
2378
|
};
|
|
2269
2379
|
v.toOctal = function(r, i) {
|
|
2270
|
-
return
|
|
2380
|
+
return be(this, 8, r, i);
|
|
2271
2381
|
};
|
|
2272
2382
|
v.toPower = v.pow = function(r) {
|
|
2273
2383
|
var i, t, e, s, n, o, a = this, l = a.constructor, c = +(r = new l(r));
|
|
2274
2384
|
if (!a.d || !r.d || !a.d[0] || !r.d[0]) return new l(I(+a, c));
|
|
2275
2385
|
if (a = new l(a), a.eq(1)) return a;
|
|
2276
2386
|
if (e = l.precision, n = l.rounding, r.eq(1)) return C(a, e, n);
|
|
2277
|
-
if (i = F(r.e / S), i >= r.d.length - 1 && (t = c < 0 ? -c : c) <=
|
|
2278
|
-
return s =
|
|
2387
|
+
if (i = F(r.e / S), i >= r.d.length - 1 && (t = c < 0 ? -c : c) <= vi)
|
|
2388
|
+
return s = je(l, a, t, e), r.s < 0 ? new l(1).div(s) : C(s, e, n);
|
|
2279
2389
|
if (o = a.s, o < 0) {
|
|
2280
2390
|
if (i < r.d.length - 1) return new l(NaN);
|
|
2281
2391
|
if (r.d[i] & 1 || (o = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
|
|
2282
2392
|
return a.s = o, a;
|
|
2283
2393
|
}
|
|
2284
|
-
return t = I(+a, c), i = t == 0 || !isFinite(t) ? F(c * (Math.log("0." + N(a.d)) / Math.LN10 + a.e + 1)) : new l(t + "").e, i > l.maxE + 1 || i < l.minE - 1 ? new l(i > 0 ? o / 0 : 0) : (_ = !1, l.rounding = a.s = 1, t = Math.min(12, (i + "").length), s =
|
|
2394
|
+
return t = I(+a, c), i = t == 0 || !isFinite(t) ? F(c * (Math.log("0." + N(a.d)) / Math.LN10 + a.e + 1)) : new l(t + "").e, i > l.maxE + 1 || i < l.minE - 1 ? new l(i > 0 ? o / 0 : 0) : (_ = !1, l.rounding = a.s = 1, t = Math.min(12, (i + "").length), s = ue(r.times(lt(a, e + t)), e), s.d && (s = C(s, e + 5, 1), At(s.d, e, n) && (i = e + 10, s = C(ue(r.times(lt(a, i + t)), i), i + 5, 1), +N(s.d).slice(e + 1, e + 15) + 1 == 1e14 && (s = C(s, e + 1, 0)))), s.s = o, _ = !0, l.rounding = n, C(s, e, n));
|
|
2285
2395
|
};
|
|
2286
2396
|
v.toPrecision = function(r, i) {
|
|
2287
2397
|
var t, e = this, s = e.constructor;
|
|
2288
|
-
return r === void 0 ? t = et(e, e.e <= s.toExpNeg || e.e >= s.toExpPos) : (U(r, 1,
|
|
2398
|
+
return r === void 0 ? t = et(e, e.e <= s.toExpNeg || e.e >= s.toExpPos) : (U(r, 1, ut), i === void 0 ? i = s.rounding : U(i, 0, 8), e = C(new s(e), r, i), t = et(e, r <= e.e || e.e <= s.toExpNeg, r)), e.isNeg() && !e.isZero() ? "-" + t : t;
|
|
2289
2399
|
};
|
|
2290
2400
|
v.toSignificantDigits = v.toSD = function(r, i) {
|
|
2291
2401
|
var t = this, e = t.constructor;
|
|
2292
|
-
return r === void 0 ? (r = e.precision, i = e.rounding) : (U(r, 1,
|
|
2402
|
+
return r === void 0 ? (r = e.precision, i = e.rounding) : (U(r, 1, ut), i === void 0 ? i = e.rounding : U(i, 0, 8)), C(new e(t), r, i);
|
|
2293
2403
|
};
|
|
2294
2404
|
v.toString = function() {
|
|
2295
2405
|
var r = this, i = r.constructor, t = et(r, r.e <= i.toExpNeg || r.e >= i.toExpPos);
|
|
@@ -2315,32 +2425,32 @@ function N(r) {
|
|
|
2315
2425
|
}
|
|
2316
2426
|
function U(r, i, t) {
|
|
2317
2427
|
if (r !== ~~r || r < i || r > t)
|
|
2318
|
-
throw Error(
|
|
2428
|
+
throw Error(ht + r);
|
|
2319
2429
|
}
|
|
2320
|
-
function
|
|
2430
|
+
function At(r, i, t, e) {
|
|
2321
2431
|
var s, n, o, a;
|
|
2322
2432
|
for (n = r[0]; n >= 10; n /= 10) --i;
|
|
2323
2433
|
return --i < 0 ? (i += S, s = 0) : (s = Math.ceil((i + 1) / S), i %= S), n = I(10, S - i), a = r[s] % n | 0, e == null ? i < 3 ? (i == 0 ? a = a / 100 | 0 : i == 1 && (a = a / 10 | 0), o = t < 4 && a == 99999 || t > 3 && a == 49999 || a == 5e4 || a == 0) : o = (t < 4 && a + 1 == n || t > 3 && a + 1 == n / 2) && (r[s + 1] / n / 100 | 0) == I(10, i - 2) - 1 || (a == n / 2 || a == 0) && (r[s + 1] / n / 100 | 0) == 0 : i < 4 ? (i == 0 ? a = a / 1e3 | 0 : i == 1 ? a = a / 100 | 0 : i == 2 && (a = a / 10 | 0), o = (e || t < 4) && a == 9999 || !e && t > 3 && a == 4999) : o = ((e || t < 4) && a + 1 == n || !e && t > 3 && a + 1 == n / 2) && (r[s + 1] / n / 1e3 | 0) == I(10, i - 3) - 1, o;
|
|
2324
2434
|
}
|
|
2325
|
-
function
|
|
2435
|
+
function zt(r, i, t) {
|
|
2326
2436
|
for (var e, s = [0], n, o = 0, a = r.length; o < a; ) {
|
|
2327
2437
|
for (n = s.length; n--; ) s[n] *= i;
|
|
2328
|
-
for (s[0] +=
|
|
2438
|
+
for (s[0] += le.indexOf(r.charAt(o++)), e = 0; e < s.length; e++)
|
|
2329
2439
|
s[e] > t - 1 && (s[e + 1] === void 0 && (s[e + 1] = 0), s[e + 1] += s[e] / t | 0, s[e] %= t);
|
|
2330
2440
|
}
|
|
2331
2441
|
return s.reverse();
|
|
2332
2442
|
}
|
|
2333
|
-
function
|
|
2443
|
+
function wi(r, i) {
|
|
2334
2444
|
var t, e, s;
|
|
2335
2445
|
if (i.isZero()) return i;
|
|
2336
|
-
e = i.d.length, e < 32 ? (t = Math.ceil(e / 3), s = (1 /
|
|
2446
|
+
e = i.d.length, e < 32 ? (t = Math.ceil(e / 3), s = (1 / Qt(4, t)).toString()) : (t = 16, s = "2.3283064365386962890625e-10"), r.precision += t, i = Dt(r, 1, i.times(s), new r(1));
|
|
2337
2447
|
for (var n = t; n--; ) {
|
|
2338
2448
|
var o = i.times(i);
|
|
2339
2449
|
i = o.times(o).minus(o).times(8).plus(1);
|
|
2340
2450
|
}
|
|
2341
2451
|
return r.precision -= t, i;
|
|
2342
2452
|
}
|
|
2343
|
-
var
|
|
2453
|
+
var A = /* @__PURE__ */ function() {
|
|
2344
2454
|
function r(e, s, n) {
|
|
2345
2455
|
var o, a = 0, l = e.length;
|
|
2346
2456
|
for (e = e.slice(); l--; )
|
|
@@ -2365,35 +2475,35 @@ var V = /* @__PURE__ */ function() {
|
|
|
2365
2475
|
for (; !e[0] && e.length > 1; ) e.shift();
|
|
2366
2476
|
}
|
|
2367
2477
|
return function(e, s, n, o, a, l) {
|
|
2368
|
-
var c, h, u, f, m, g, p, y, w, b, P, E,
|
|
2369
|
-
if (!H || !H[0] || !
|
|
2370
|
-
return new
|
|
2478
|
+
var c, h, u, f, m, g, p, y, w, b, P, E, O, G, Lt, dt, nt, yt, X, Tt, It = e.constructor, Jt = e.s == s.s ? 1 : -1, H = e.d, V = s.d;
|
|
2479
|
+
if (!H || !H[0] || !V || !V[0])
|
|
2480
|
+
return new It(
|
|
2371
2481
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
2372
|
-
!e.s || !s.s || (H ?
|
|
2482
|
+
!e.s || !s.s || (H ? V && H[0] == V[0] : !V) ? NaN : (
|
|
2373
2483
|
// Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
|
|
2374
|
-
H && H[0] == 0 || !
|
|
2484
|
+
H && H[0] == 0 || !V ? Jt * 0 : Jt / 0
|
|
2375
2485
|
)
|
|
2376
2486
|
);
|
|
2377
|
-
for (l ? (m = 1, h = e.e - s.e) : (l = Z, m = S, h = F(e.e / m) - F(s.e / m)), X =
|
|
2378
|
-
if (
|
|
2487
|
+
for (l ? (m = 1, h = e.e - s.e) : (l = Z, m = S, h = F(e.e / m) - F(s.e / m)), X = V.length, nt = H.length, w = new It(Jt), b = w.d = [], u = 0; V[u] == (H[u] || 0); u++) ;
|
|
2488
|
+
if (V[u] > (H[u] || 0) && h--, n == null ? (G = n = It.precision, o = It.rounding) : a ? G = n + (e.e - s.e) + 1 : G = n, G < 0)
|
|
2379
2489
|
b.push(1), g = !0;
|
|
2380
2490
|
else {
|
|
2381
2491
|
if (G = G / m + 2 | 0, u = 0, X == 1) {
|
|
2382
|
-
for (f = 0,
|
|
2383
|
-
|
|
2492
|
+
for (f = 0, V = V[0], G++; (u < nt || f) && G--; u++)
|
|
2493
|
+
Lt = f * l + (H[u] || 0), b[u] = Lt / V | 0, f = Lt % V | 0;
|
|
2384
2494
|
g = f || u < nt;
|
|
2385
2495
|
} else {
|
|
2386
|
-
for (f = l / (
|
|
2387
|
-
|
|
2496
|
+
for (f = l / (V[0] + 1) | 0, f > 1 && (V = r(V, f, l), H = r(H, f, l), X = V.length, nt = H.length), dt = X, P = H.slice(0, X), E = P.length; E < X; ) P[E++] = 0;
|
|
2497
|
+
Tt = V.slice(), Tt.unshift(0), yt = V[0], V[1] >= l / 2 && ++yt;
|
|
2388
2498
|
do
|
|
2389
|
-
f = 0, c = i(
|
|
2390
|
-
while ((
|
|
2499
|
+
f = 0, c = i(V, P, X, E), c < 0 ? (O = P[0], X != E && (O = O * l + (P[1] || 0)), f = O / yt | 0, f > 1 ? (f >= l && (f = l - 1), p = r(V, f, l), y = p.length, E = P.length, c = i(p, P, y, E), c == 1 && (f--, t(p, X < y ? Tt : V, y, l))) : (f == 0 && (c = f = 1), p = V.slice()), y = p.length, y < E && p.unshift(0), t(P, p, E, l), c == -1 && (E = P.length, c = i(V, P, X, E), c < 1 && (f++, t(P, X < E ? Tt : V, E, l))), E = P.length) : c === 0 && (f++, P = [0]), b[u++] = f, c && P[0] ? P[E++] = H[dt] || 0 : (P = [H[dt]], E = 1);
|
|
2500
|
+
while ((dt++ < nt || P[0] !== void 0) && G--);
|
|
2391
2501
|
g = P[0] !== void 0;
|
|
2392
2502
|
}
|
|
2393
2503
|
b[0] || b.shift();
|
|
2394
2504
|
}
|
|
2395
2505
|
if (m == 1)
|
|
2396
|
-
w.e = h,
|
|
2506
|
+
w.e = h, Be = g;
|
|
2397
2507
|
else {
|
|
2398
2508
|
for (u = 1, f = b[0]; f >= 10; f /= 10) u++;
|
|
2399
2509
|
w.e = u + h * m - 1, C(w, a ? n + w.e + 1 : n, o, g);
|
|
@@ -2437,25 +2547,25 @@ function C(r, i, t, e) {
|
|
|
2437
2547
|
return _ && (r.e > m.maxE ? (r.d = null, r.e = NaN) : r.e < m.minE && (r.e = 0, r.d = [0])), r;
|
|
2438
2548
|
}
|
|
2439
2549
|
function et(r, i, t) {
|
|
2440
|
-
if (!r.isFinite()) return
|
|
2550
|
+
if (!r.isFinite()) return qe(r);
|
|
2441
2551
|
var e, s = r.e, n = N(r.d), o = n.length;
|
|
2442
2552
|
return i ? (t && (e = t - o) > 0 ? n = n.charAt(0) + "." + n.slice(1) + rt(e) : o > 1 && (n = n.charAt(0) + "." + n.slice(1)), n = n + (r.e < 0 ? "e" : "e+") + r.e) : s < 0 ? (n = "0." + rt(-s - 1) + n, t && (e = t - o) > 0 && (n += rt(e))) : s >= o ? (n += rt(s + 1 - o), t && (e = t - s - 1) > 0 && (n = n + "." + rt(e))) : ((e = s + 1) < o && (n = n.slice(0, e) + "." + n.slice(e)), t && (e = t - o) > 0 && (s + 1 === o && (n += "."), n += rt(e))), n;
|
|
2443
2553
|
}
|
|
2444
|
-
function
|
|
2554
|
+
function Zt(r, i) {
|
|
2445
2555
|
var t = r[0];
|
|
2446
2556
|
for (i *= S; t >= 10; t /= 10) i++;
|
|
2447
2557
|
return i;
|
|
2448
2558
|
}
|
|
2449
|
-
function
|
|
2450
|
-
if (i >
|
|
2451
|
-
throw _ = !0, t && (r.precision = t), Error(
|
|
2452
|
-
return C(new r(
|
|
2559
|
+
function $t(r, i, t) {
|
|
2560
|
+
if (i > yi)
|
|
2561
|
+
throw _ = !0, t && (r.precision = t), Error(Ue);
|
|
2562
|
+
return C(new r(Xt), i, 1, !0);
|
|
2453
2563
|
}
|
|
2454
2564
|
function tt(r, i, t) {
|
|
2455
|
-
if (i >
|
|
2456
|
-
return C(new r(
|
|
2565
|
+
if (i > he) throw Error(Ue);
|
|
2566
|
+
return C(new r(Yt), i, t, !0);
|
|
2457
2567
|
}
|
|
2458
|
-
function
|
|
2568
|
+
function $e(r) {
|
|
2459
2569
|
var i = r.length - 1, t = i * S + 1;
|
|
2460
2570
|
if (i = r[i], i) {
|
|
2461
2571
|
for (; i % 10 == 0; i /= 10) t--;
|
|
@@ -2467,21 +2577,21 @@ function rt(r) {
|
|
|
2467
2577
|
for (var i = ""; r--; ) i += "0";
|
|
2468
2578
|
return i;
|
|
2469
2579
|
}
|
|
2470
|
-
function
|
|
2580
|
+
function je(r, i, t, e) {
|
|
2471
2581
|
var s, n = new r(1), o = Math.ceil(e / S + 4);
|
|
2472
2582
|
for (_ = !1; ; ) {
|
|
2473
|
-
if (t % 2 && (n = n.times(i),
|
|
2583
|
+
if (t % 2 && (n = n.times(i), ke(n.d, o) && (s = !0)), t = F(t / 2), t === 0) {
|
|
2474
2584
|
t = n.d.length - 1, s && n.d[t] === 0 && ++n.d[t];
|
|
2475
2585
|
break;
|
|
2476
2586
|
}
|
|
2477
|
-
i = i.times(i),
|
|
2587
|
+
i = i.times(i), ke(i.d, o);
|
|
2478
2588
|
}
|
|
2479
2589
|
return _ = !0, n;
|
|
2480
2590
|
}
|
|
2481
|
-
function
|
|
2591
|
+
function De(r) {
|
|
2482
2592
|
return r.d[r.d.length - 1] & 1;
|
|
2483
2593
|
}
|
|
2484
|
-
function
|
|
2594
|
+
function We(r, i, t) {
|
|
2485
2595
|
for (var e, s, n = new r(i[0]), o = 0; ++o < i.length; ) {
|
|
2486
2596
|
if (s = new r(i[o]), !s.s) {
|
|
2487
2597
|
n = s;
|
|
@@ -2491,17 +2601,17 @@ function Ue(r, i, t) {
|
|
|
2491
2601
|
}
|
|
2492
2602
|
return n;
|
|
2493
2603
|
}
|
|
2494
|
-
function
|
|
2604
|
+
function ue(r, i) {
|
|
2495
2605
|
var t, e, s, n, o, a, l, c = 0, h = 0, u = 0, f = r.constructor, m = f.rounding, g = f.precision;
|
|
2496
2606
|
if (!r.d || !r.d[0] || r.e > 17)
|
|
2497
2607
|
return new f(r.d ? r.d[0] ? r.s < 0 ? 0 : 1 / 0 : 1 : r.s ? r.s < 0 ? 0 : r : NaN);
|
|
2498
2608
|
for (i == null ? (_ = !1, l = g) : l = i, a = new f(0.03125); r.e > -2; )
|
|
2499
2609
|
r = r.times(a), u += 5;
|
|
2500
2610
|
for (e = Math.log(I(2, u)) / Math.LN10 * 2 + 5 | 0, l += e, t = n = o = new f(1), f.precision = l; ; ) {
|
|
2501
|
-
if (n = C(n.times(r), l, 1), t = t.times(++h), a = o.plus(
|
|
2611
|
+
if (n = C(n.times(r), l, 1), t = t.times(++h), a = o.plus(A(n, t, l, 1)), N(a.d).slice(0, l) === N(o.d).slice(0, l)) {
|
|
2502
2612
|
for (s = u; s--; ) o = C(o.times(o), l, 1);
|
|
2503
2613
|
if (i == null)
|
|
2504
|
-
if (c < 3 &&
|
|
2614
|
+
if (c < 3 && At(o.d, l - e, m, c))
|
|
2505
2615
|
f.precision = l += 10, t = n = a = new f(1), h = 0, c++;
|
|
2506
2616
|
else
|
|
2507
2617
|
return C(o, f.precision = g, m, _ = !0);
|
|
@@ -2511,7 +2621,7 @@ function ce(r, i) {
|
|
|
2511
2621
|
o = a;
|
|
2512
2622
|
}
|
|
2513
2623
|
}
|
|
2514
|
-
function
|
|
2624
|
+
function lt(r, i) {
|
|
2515
2625
|
var t, e, s, n, o, a, l, c, h, u, f, m = 1, g = 10, p = r, y = p.d, w = p.constructor, b = w.rounding, P = w.precision;
|
|
2516
2626
|
if (p.s < 0 || !y || !y[0] || !p.e && y[0] == 1 && y.length == 1)
|
|
2517
2627
|
return new w(y && !y[0] ? -1 / 0 : p.s != 1 ? NaN : y ? 0 : p);
|
|
@@ -2520,12 +2630,12 @@ function at(r, i) {
|
|
|
2520
2630
|
p = p.times(r), t = N(p.d), e = t.charAt(0), m++;
|
|
2521
2631
|
n = p.e, e > 1 ? (p = new w("0." + t), n++) : p = new w(e + "." + t.slice(1));
|
|
2522
2632
|
} else
|
|
2523
|
-
return c =
|
|
2524
|
-
for (u = p, l = o = p =
|
|
2525
|
-
if (o = C(o.times(f), h, 1), c = l.plus(
|
|
2526
|
-
if (l = l.times(2), n !== 0 && (l = l.plus(
|
|
2527
|
-
if (
|
|
2528
|
-
w.precision = h += g, c = o = p =
|
|
2633
|
+
return c = $t(w, h + 2, P).times(n + ""), p = lt(new w(e + "." + t.slice(1)), h - g).plus(c), w.precision = P, i == null ? C(p, P, b, _ = !0) : p;
|
|
2634
|
+
for (u = p, l = o = p = A(p.minus(1), p.plus(1), h, 1), f = C(p.times(p), h, 1), s = 3; ; ) {
|
|
2635
|
+
if (o = C(o.times(f), h, 1), c = l.plus(A(o, new w(s), h, 1)), N(c.d).slice(0, h) === N(l.d).slice(0, h))
|
|
2636
|
+
if (l = l.times(2), n !== 0 && (l = l.plus($t(w, h + 2, P).times(n + ""))), l = A(l, new w(m), h, 1), i == null)
|
|
2637
|
+
if (At(l.d, h - g, b, a))
|
|
2638
|
+
w.precision = h += g, c = o = p = A(u.minus(1), u.plus(1), h, 1), f = C(p.times(p), h, 1), s = a = 1;
|
|
2529
2639
|
else
|
|
2530
2640
|
return C(l, w.precision = P, b, _ = !0);
|
|
2531
2641
|
else
|
|
@@ -2533,10 +2643,10 @@ function at(r, i) {
|
|
|
2533
2643
|
l = c, s += 2;
|
|
2534
2644
|
}
|
|
2535
2645
|
}
|
|
2536
|
-
function
|
|
2646
|
+
function qe(r) {
|
|
2537
2647
|
return String(r.s * r.s / 0);
|
|
2538
2648
|
}
|
|
2539
|
-
function
|
|
2649
|
+
function Bt(r, i) {
|
|
2540
2650
|
var t, e, s;
|
|
2541
2651
|
for ((t = i.indexOf(".")) > -1 && (i = i.replace(".", "")), (e = i.search(/e/i)) > 0 ? (t < 0 && (t = e), t += +i.slice(e + 1), i = i.substring(0, e)) : t < 0 && (t = i.length), e = 0; i.charCodeAt(e) === 48; e++) ;
|
|
2542
2652
|
for (s = i.length; i.charCodeAt(s - 1) === 48; --s) ;
|
|
@@ -2552,36 +2662,36 @@ function zt(r, i) {
|
|
|
2552
2662
|
r.e = 0, r.d = [0];
|
|
2553
2663
|
return r;
|
|
2554
2664
|
}
|
|
2555
|
-
function
|
|
2665
|
+
function xi(r, i) {
|
|
2556
2666
|
var t, e, s, n, o, a, l, c, h;
|
|
2557
2667
|
if (i.indexOf("_") > -1) {
|
|
2558
|
-
if (i = i.replace(/(\d)_(?=\d)/g, "$1"),
|
|
2668
|
+
if (i = i.replace(/(\d)_(?=\d)/g, "$1"), Ye.test(i)) return Bt(r, i);
|
|
2559
2669
|
} else if (i === "Infinity" || i === "NaN")
|
|
2560
2670
|
return +i || (r.s = NaN), r.e = NaN, r.d = null, r;
|
|
2561
|
-
if (
|
|
2671
|
+
if (pi.test(i))
|
|
2562
2672
|
t = 16, i = i.toLowerCase();
|
|
2563
|
-
else if (
|
|
2673
|
+
else if (mi.test(i))
|
|
2564
2674
|
t = 2;
|
|
2565
|
-
else if (
|
|
2675
|
+
else if (gi.test(i))
|
|
2566
2676
|
t = 8;
|
|
2567
2677
|
else
|
|
2568
|
-
throw Error(
|
|
2569
|
-
for (n = i.search(/p/i), n > 0 ? (l = +i.slice(n + 1), i = i.substring(2, n)) : i = i.slice(2), n = i.indexOf("."), o = n >= 0, e = r.constructor, o && (i = i.replace(".", ""), a = i.length, n = a - n, s =
|
|
2570
|
-
return n < 0 ? new e(r.s * 0) : (r.e =
|
|
2678
|
+
throw Error(ht + i);
|
|
2679
|
+
for (n = i.search(/p/i), n > 0 ? (l = +i.slice(n + 1), i = i.substring(2, n)) : i = i.slice(2), n = i.indexOf("."), o = n >= 0, e = r.constructor, o && (i = i.replace(".", ""), a = i.length, n = a - n, s = je(e, new e(t), n, n * 2)), c = zt(i, t, Z), h = c.length - 1, n = h; c[n] === 0; --n) c.pop();
|
|
2680
|
+
return n < 0 ? new e(r.s * 0) : (r.e = Zt(c, h), r.d = c, _ = !1, o && (r = A(r, s, a * 4)), l && (r = r.times(Math.abs(l) < 54 ? I(2, l) : k.pow(2, l))), _ = !0, r);
|
|
2571
2681
|
}
|
|
2572
|
-
function
|
|
2682
|
+
function bi(r, i) {
|
|
2573
2683
|
var t, e = i.d.length;
|
|
2574
2684
|
if (e < 3)
|
|
2575
|
-
return i.isZero() ? i :
|
|
2576
|
-
t = 1.4 * Math.sqrt(e), t = t > 16 ? 16 : t | 0, i = i.times(1 /
|
|
2685
|
+
return i.isZero() ? i : Dt(r, 2, i, i);
|
|
2686
|
+
t = 1.4 * Math.sqrt(e), t = t > 16 ? 16 : t | 0, i = i.times(1 / Qt(5, t)), i = Dt(r, 2, i, i);
|
|
2577
2687
|
for (var s, n = new r(5), o = new r(16), a = new r(20); t--; )
|
|
2578
2688
|
s = i.times(i), i = i.times(n.plus(s.times(o.times(s).minus(a))));
|
|
2579
2689
|
return i;
|
|
2580
2690
|
}
|
|
2581
|
-
function
|
|
2691
|
+
function Dt(r, i, t, e, s) {
|
|
2582
2692
|
var n, o, a, l, c = r.precision, h = Math.ceil(c / S);
|
|
2583
2693
|
for (_ = !1, l = t.times(t), a = new r(e); ; ) {
|
|
2584
|
-
if (o =
|
|
2694
|
+
if (o = A(a.times(l), new r(i++ * i++), c, 1), a = s ? e.plus(o) : e.minus(o), e = A(o.times(l), new r(i++ * i++), c, 1), o = a.plus(e), o.d[h] !== void 0) {
|
|
2585
2695
|
for (n = h; o.d[n] === a.d[n] && n--; ) ;
|
|
2586
2696
|
if (n == -1) break;
|
|
2587
2697
|
}
|
|
@@ -2589,11 +2699,11 @@ function Mt(r, i, t, e, s) {
|
|
|
2589
2699
|
}
|
|
2590
2700
|
return _ = !0, o.d.length = h + 1, o;
|
|
2591
2701
|
}
|
|
2592
|
-
function
|
|
2702
|
+
function Qt(r, i) {
|
|
2593
2703
|
for (var t = r; --i; ) t *= r;
|
|
2594
2704
|
return t;
|
|
2595
2705
|
}
|
|
2596
|
-
function
|
|
2706
|
+
function Ke(r, i) {
|
|
2597
2707
|
var t, e = i.s < 0, s = tt(r, r.precision, 1), n = s.times(0.5);
|
|
2598
2708
|
if (i = i.abs(), i.lte(n))
|
|
2599
2709
|
return st = e ? 4 : 1, i;
|
|
@@ -2601,31 +2711,31 @@ function Xe(r, i) {
|
|
|
2601
2711
|
st = e ? 3 : 2;
|
|
2602
2712
|
else {
|
|
2603
2713
|
if (i = i.minus(t.times(s)), i.lte(n))
|
|
2604
|
-
return st =
|
|
2605
|
-
st =
|
|
2714
|
+
return st = De(t) ? e ? 2 : 3 : e ? 4 : 1, i;
|
|
2715
|
+
st = De(t) ? e ? 1 : 4 : e ? 3 : 2;
|
|
2606
2716
|
}
|
|
2607
2717
|
return i.minus(s).abs();
|
|
2608
2718
|
}
|
|
2609
|
-
function
|
|
2719
|
+
function be(r, i, t, e) {
|
|
2610
2720
|
var s, n, o, a, l, c, h, u, f, m = r.constructor, g = t !== void 0;
|
|
2611
|
-
if (g ? (U(t, 1,
|
|
2612
|
-
h =
|
|
2721
|
+
if (g ? (U(t, 1, ut), e === void 0 ? e = m.rounding : U(e, 0, 8)) : (t = m.precision, e = m.rounding), !r.isFinite())
|
|
2722
|
+
h = qe(r);
|
|
2613
2723
|
else {
|
|
2614
|
-
for (h = et(r), o = h.indexOf("."), g ? (s = 2, i == 16 ? t = t * 4 - 3 : i == 8 && (t = t * 3 - 2)) : s = i, o >= 0 && (h = h.replace(".", ""), f = new m(1), f.e = h.length - o, f.d =
|
|
2724
|
+
for (h = et(r), o = h.indexOf("."), g ? (s = 2, i == 16 ? t = t * 4 - 3 : i == 8 && (t = t * 3 - 2)) : s = i, o >= 0 && (h = h.replace(".", ""), f = new m(1), f.e = h.length - o, f.d = zt(et(f), 10, s), f.e = f.d.length), u = zt(h, 10, s), n = l = u.length; u[--l] == 0; ) u.pop();
|
|
2615
2725
|
if (!u[0])
|
|
2616
2726
|
h = g ? "0p+0" : "0";
|
|
2617
2727
|
else {
|
|
2618
|
-
if (o < 0 ? n-- : (r = new m(r), r.d = u, r.e = n, r =
|
|
2728
|
+
if (o < 0 ? n-- : (r = new m(r), r.d = u, r.e = n, r = A(r, f, t, e, 0, s), u = r.d, n = r.e, c = Be), o = u[t], a = s / 2, c = c || u[t + 1] !== void 0, c = e < 4 ? (o !== void 0 || c) && (e === 0 || e === (r.s < 0 ? 3 : 2)) : o > a || o === a && (e === 4 || c || e === 6 && u[t - 1] & 1 || e === (r.s < 0 ? 8 : 7)), u.length = t, c)
|
|
2619
2729
|
for (; ++u[--t] > s - 1; )
|
|
2620
2730
|
u[t] = 0, t || (++n, u.unshift(1));
|
|
2621
2731
|
for (l = u.length; !u[l - 1]; --l) ;
|
|
2622
|
-
for (o = 0, h = ""; o < l; o++) h +=
|
|
2732
|
+
for (o = 0, h = ""; o < l; o++) h += le.charAt(u[o]);
|
|
2623
2733
|
if (g) {
|
|
2624
2734
|
if (l > 1)
|
|
2625
2735
|
if (i == 16 || i == 8) {
|
|
2626
2736
|
for (o = i == 16 ? 4 : 3, --l; l % o; l++) h += "0";
|
|
2627
|
-
for (u =
|
|
2628
|
-
for (o = 1, h = "1."; o < l; o++) h +=
|
|
2737
|
+
for (u = zt(h, s, i), l = u.length; !u[l - 1]; --l) ;
|
|
2738
|
+
for (o = 1, h = "1."; o < l; o++) h += le.charAt(u[o]);
|
|
2629
2739
|
} else
|
|
2630
2740
|
h = h.charAt(0) + "." + h.slice(1);
|
|
2631
2741
|
h = h + (n < 0 ? "p" : "p+") + n;
|
|
@@ -2639,54 +2749,54 @@ function ve(r, i, t, e) {
|
|
|
2639
2749
|
}
|
|
2640
2750
|
return r.s < 0 ? "-" + h : h;
|
|
2641
2751
|
}
|
|
2642
|
-
function
|
|
2752
|
+
function ke(r, i) {
|
|
2643
2753
|
if (r.length > i)
|
|
2644
2754
|
return r.length = i, !0;
|
|
2645
2755
|
}
|
|
2646
|
-
function
|
|
2756
|
+
function Pi(r) {
|
|
2647
2757
|
return new this(r).abs();
|
|
2648
2758
|
}
|
|
2649
|
-
function
|
|
2759
|
+
function Ci(r) {
|
|
2650
2760
|
return new this(r).acos();
|
|
2651
2761
|
}
|
|
2652
|
-
function
|
|
2762
|
+
function Si(r) {
|
|
2653
2763
|
return new this(r).acosh();
|
|
2654
2764
|
}
|
|
2655
|
-
function
|
|
2765
|
+
function _i(r, i) {
|
|
2656
2766
|
return new this(r).plus(i);
|
|
2657
2767
|
}
|
|
2658
|
-
function
|
|
2768
|
+
function Ei(r) {
|
|
2659
2769
|
return new this(r).asin();
|
|
2660
2770
|
}
|
|
2661
|
-
function
|
|
2771
|
+
function Mi(r) {
|
|
2662
2772
|
return new this(r).asinh();
|
|
2663
2773
|
}
|
|
2664
|
-
function
|
|
2774
|
+
function Di(r) {
|
|
2665
2775
|
return new this(r).atan();
|
|
2666
2776
|
}
|
|
2667
|
-
function
|
|
2777
|
+
function ki(r) {
|
|
2668
2778
|
return new this(r).atanh();
|
|
2669
2779
|
}
|
|
2670
|
-
function
|
|
2780
|
+
function Ri(r, i) {
|
|
2671
2781
|
r = new this(r), i = new this(i);
|
|
2672
2782
|
var t, e = this.precision, s = this.rounding, n = e + 4;
|
|
2673
|
-
return !r.s || !i.s ? t = new this(NaN) : !r.d && !i.d ? (t = tt(this, n, 1).times(i.s > 0 ? 0.25 : 0.75), t.s = r.s) : !i.d || r.isZero() ? (t = i.s < 0 ? tt(this, e, s) : new this(0), t.s = r.s) : !r.d || i.isZero() ? (t = tt(this, n, 1).times(0.5), t.s = r.s) : i.s < 0 ? (this.precision = n, this.rounding = 1, t = this.atan(
|
|
2783
|
+
return !r.s || !i.s ? t = new this(NaN) : !r.d && !i.d ? (t = tt(this, n, 1).times(i.s > 0 ? 0.25 : 0.75), t.s = r.s) : !i.d || r.isZero() ? (t = i.s < 0 ? tt(this, e, s) : new this(0), t.s = r.s) : !r.d || i.isZero() ? (t = tt(this, n, 1).times(0.5), t.s = r.s) : i.s < 0 ? (this.precision = n, this.rounding = 1, t = this.atan(A(r, i, n, 1)), i = tt(this, n, 1), this.precision = e, this.rounding = s, t = r.s < 0 ? t.minus(i) : t.plus(i)) : t = this.atan(A(r, i, n, 1)), t;
|
|
2674
2784
|
}
|
|
2675
|
-
function
|
|
2785
|
+
function Ai(r) {
|
|
2676
2786
|
return new this(r).cbrt();
|
|
2677
2787
|
}
|
|
2678
|
-
function
|
|
2788
|
+
function Vi(r) {
|
|
2679
2789
|
return C(r = new this(r), r.e + 1, 2);
|
|
2680
2790
|
}
|
|
2681
|
-
function
|
|
2791
|
+
function Oi(r, i, t) {
|
|
2682
2792
|
return new this(r).clamp(i, t);
|
|
2683
2793
|
}
|
|
2684
|
-
function
|
|
2685
|
-
if (!r || typeof r != "object") throw Error(
|
|
2794
|
+
function Li(r) {
|
|
2795
|
+
if (!r || typeof r != "object") throw Error(Kt + "Object expected");
|
|
2686
2796
|
var i, t, e, s = r.defaults === !0, n = [
|
|
2687
2797
|
"precision",
|
|
2688
2798
|
1,
|
|
2689
|
-
|
|
2799
|
+
ut,
|
|
2690
2800
|
"rounding",
|
|
2691
2801
|
0,
|
|
2692
2802
|
8,
|
|
@@ -2695,10 +2805,10 @@ function Mi(r) {
|
|
|
2695
2805
|
0,
|
|
2696
2806
|
"toExpPos",
|
|
2697
2807
|
0,
|
|
2698
|
-
|
|
2808
|
+
ae,
|
|
2699
2809
|
"maxE",
|
|
2700
2810
|
0,
|
|
2701
|
-
|
|
2811
|
+
ae,
|
|
2702
2812
|
"minE",
|
|
2703
2813
|
-9e15,
|
|
2704
2814
|
0,
|
|
@@ -2707,34 +2817,34 @@ function Mi(r) {
|
|
|
2707
2817
|
9
|
|
2708
2818
|
];
|
|
2709
2819
|
for (i = 0; i < n.length; i += 3)
|
|
2710
|
-
if (t = n[i], s && (this[t] =
|
|
2820
|
+
if (t = n[i], s && (this[t] = ce[t]), (e = r[t]) !== void 0)
|
|
2711
2821
|
if (F(e) === e && e >= n[i + 1] && e <= n[i + 2]) this[t] = e;
|
|
2712
|
-
else throw Error(
|
|
2713
|
-
if (t = "crypto", s && (this[t] =
|
|
2822
|
+
else throw Error(ht + t + ": " + e);
|
|
2823
|
+
if (t = "crypto", s && (this[t] = ce[t]), (e = r[t]) !== void 0)
|
|
2714
2824
|
if (e === !0 || e === !1 || e === 0 || e === 1)
|
|
2715
2825
|
if (e)
|
|
2716
2826
|
if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
|
|
2717
2827
|
this[t] = !0;
|
|
2718
2828
|
else
|
|
2719
|
-
throw Error(
|
|
2829
|
+
throw Error(Ge);
|
|
2720
2830
|
else
|
|
2721
2831
|
this[t] = !1;
|
|
2722
2832
|
else
|
|
2723
|
-
throw Error(
|
|
2833
|
+
throw Error(ht + t + ": " + e);
|
|
2724
2834
|
return this;
|
|
2725
2835
|
}
|
|
2726
|
-
function
|
|
2836
|
+
function Ti(r) {
|
|
2727
2837
|
return new this(r).cos();
|
|
2728
2838
|
}
|
|
2729
|
-
function
|
|
2839
|
+
function Ii(r) {
|
|
2730
2840
|
return new this(r).cosh();
|
|
2731
2841
|
}
|
|
2732
|
-
function
|
|
2842
|
+
function Ze(r) {
|
|
2733
2843
|
var i, t, e;
|
|
2734
2844
|
function s(n) {
|
|
2735
2845
|
var o, a, l, c = this;
|
|
2736
2846
|
if (!(c instanceof s)) return new s(n);
|
|
2737
|
-
if (c.constructor = s,
|
|
2847
|
+
if (c.constructor = s, Re(n)) {
|
|
2738
2848
|
c.s = n.s, _ ? !n.d || n.e > s.maxE ? (c.e = NaN, c.d = null) : n.e < s.minE ? (c.e = 0, c.d = [0]) : (c.e = n.e, c.d = n.d.slice()) : (c.e = n.e, c.d = n.d ? n.d.slice() : n.d);
|
|
2739
2849
|
return;
|
|
2740
2850
|
}
|
|
@@ -2752,28 +2862,28 @@ function Ye(r) {
|
|
|
2752
2862
|
n || (c.s = NaN), c.e = NaN, c.d = null;
|
|
2753
2863
|
return;
|
|
2754
2864
|
}
|
|
2755
|
-
return
|
|
2865
|
+
return Bt(c, n.toString());
|
|
2756
2866
|
}
|
|
2757
2867
|
if (l === "string")
|
|
2758
|
-
return (a = n.charCodeAt(0)) === 45 ? (n = n.slice(1), c.s = -1) : (a === 43 && (n = n.slice(1)), c.s = 1),
|
|
2868
|
+
return (a = n.charCodeAt(0)) === 45 ? (n = n.slice(1), c.s = -1) : (a === 43 && (n = n.slice(1)), c.s = 1), Ye.test(n) ? Bt(c, n) : xi(c, n);
|
|
2759
2869
|
if (l === "bigint")
|
|
2760
|
-
return n < 0 ? (n = -n, c.s = -1) : c.s = 1,
|
|
2761
|
-
throw Error(
|
|
2870
|
+
return n < 0 ? (n = -n, c.s = -1) : c.s = 1, Bt(c, n.toString());
|
|
2871
|
+
throw Error(ht + n);
|
|
2762
2872
|
}
|
|
2763
|
-
if (s.prototype = v, s.ROUND_UP = 0, s.ROUND_DOWN = 1, s.ROUND_CEIL = 2, s.ROUND_FLOOR = 3, s.ROUND_HALF_UP = 4, s.ROUND_HALF_DOWN = 5, s.ROUND_HALF_EVEN = 6, s.ROUND_HALF_CEIL = 7, s.ROUND_HALF_FLOOR = 8, s.EUCLID = 9, s.config = s.set =
|
|
2873
|
+
if (s.prototype = v, s.ROUND_UP = 0, s.ROUND_DOWN = 1, s.ROUND_CEIL = 2, s.ROUND_FLOOR = 3, s.ROUND_HALF_UP = 4, s.ROUND_HALF_DOWN = 5, s.ROUND_HALF_EVEN = 6, s.ROUND_HALF_CEIL = 7, s.ROUND_HALF_FLOOR = 8, s.EUCLID = 9, s.config = s.set = Li, s.clone = Ze, s.isDecimal = Re, s.abs = Pi, s.acos = Ci, s.acosh = Si, s.add = _i, s.asin = Ei, s.asinh = Mi, s.atan = Di, s.atanh = ki, s.atan2 = Ri, s.cbrt = Ai, s.ceil = Vi, s.clamp = Oi, s.cos = Ti, s.cosh = Ii, s.div = Ni, s.exp = Hi, s.floor = Fi, s.hypot = zi, s.ln = Bi, s.log = Ui, s.log10 = Xi, s.log2 = Gi, s.max = Yi, s.min = $i, s.mod = ji, s.mul = Wi, s.pow = qi, s.random = Ki, s.round = Zi, s.sign = Qi, s.sin = Ji, s.sinh = ts, s.sqrt = es, s.sub = is, s.sum = ss, s.tan = ns, s.tanh = rs, s.trunc = os, r === void 0 && (r = {}), r && r.defaults !== !0)
|
|
2764
2874
|
for (e = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], i = 0; i < e.length; ) r.hasOwnProperty(t = e[i++]) || (r[t] = this[t]);
|
|
2765
2875
|
return s.config(r), s;
|
|
2766
2876
|
}
|
|
2767
|
-
function
|
|
2877
|
+
function Ni(r, i) {
|
|
2768
2878
|
return new this(r).div(i);
|
|
2769
2879
|
}
|
|
2770
|
-
function
|
|
2880
|
+
function Hi(r) {
|
|
2771
2881
|
return new this(r).exp();
|
|
2772
2882
|
}
|
|
2773
|
-
function
|
|
2883
|
+
function Fi(r) {
|
|
2774
2884
|
return C(r = new this(r), r.e + 1, 3);
|
|
2775
2885
|
}
|
|
2776
|
-
function
|
|
2886
|
+
function zi() {
|
|
2777
2887
|
var r, i, t = new this(0);
|
|
2778
2888
|
for (_ = !1, r = 0; r < arguments.length; )
|
|
2779
2889
|
if (i = new this(arguments[r++]), i.d)
|
|
@@ -2785,39 +2895,39 @@ function Ai() {
|
|
|
2785
2895
|
}
|
|
2786
2896
|
return _ = !0, t.sqrt();
|
|
2787
2897
|
}
|
|
2788
|
-
function
|
|
2789
|
-
return r instanceof k || r && r.toStringTag ===
|
|
2898
|
+
function Re(r) {
|
|
2899
|
+
return r instanceof k || r && r.toStringTag === Xe || !1;
|
|
2790
2900
|
}
|
|
2791
|
-
function
|
|
2901
|
+
function Bi(r) {
|
|
2792
2902
|
return new this(r).ln();
|
|
2793
2903
|
}
|
|
2794
|
-
function
|
|
2904
|
+
function Ui(r, i) {
|
|
2795
2905
|
return new this(r).log(i);
|
|
2796
2906
|
}
|
|
2797
|
-
function
|
|
2907
|
+
function Gi(r) {
|
|
2798
2908
|
return new this(r).log(2);
|
|
2799
2909
|
}
|
|
2800
|
-
function
|
|
2910
|
+
function Xi(r) {
|
|
2801
2911
|
return new this(r).log(10);
|
|
2802
2912
|
}
|
|
2803
|
-
function
|
|
2804
|
-
return
|
|
2913
|
+
function Yi() {
|
|
2914
|
+
return We(this, arguments, -1);
|
|
2805
2915
|
}
|
|
2806
|
-
function
|
|
2807
|
-
return
|
|
2916
|
+
function $i() {
|
|
2917
|
+
return We(this, arguments, 1);
|
|
2808
2918
|
}
|
|
2809
|
-
function
|
|
2919
|
+
function ji(r, i) {
|
|
2810
2920
|
return new this(r).mod(i);
|
|
2811
2921
|
}
|
|
2812
|
-
function
|
|
2922
|
+
function Wi(r, i) {
|
|
2813
2923
|
return new this(r).mul(i);
|
|
2814
2924
|
}
|
|
2815
|
-
function
|
|
2925
|
+
function qi(r, i) {
|
|
2816
2926
|
return new this(r).pow(i);
|
|
2817
2927
|
}
|
|
2818
|
-
function
|
|
2928
|
+
function Ki(r) {
|
|
2819
2929
|
var i, t, e, s, n = 0, o = new this(1), a = [];
|
|
2820
|
-
if (r === void 0 ? r = this.precision : U(r, 1,
|
|
2930
|
+
if (r === void 0 ? r = this.precision : U(r, 1, ut), e = Math.ceil(r / S), this.crypto)
|
|
2821
2931
|
if (crypto.getRandomValues)
|
|
2822
2932
|
for (i = crypto.getRandomValues(new Uint32Array(e)); n < e; )
|
|
2823
2933
|
s = i[n], s >= 429e7 ? i[n] = crypto.getRandomValues(new Uint32Array(1))[0] : a[n++] = s % 1e7;
|
|
@@ -2826,7 +2936,7 @@ function Gi(r) {
|
|
|
2826
2936
|
s = i[n] + (i[n + 1] << 8) + (i[n + 2] << 16) + ((i[n + 3] & 127) << 24), s >= 214e7 ? crypto.randomBytes(4).copy(i, n) : (a.push(s % 1e7), n += 4);
|
|
2827
2937
|
n = e / 4;
|
|
2828
2938
|
} else
|
|
2829
|
-
throw Error(
|
|
2939
|
+
throw Error(Ge);
|
|
2830
2940
|
else for (; n < e; ) a[n++] = Math.random() * 1e7 | 0;
|
|
2831
2941
|
for (e = a[--n], r %= S, e && r && (s = I(10, S - r), a[n] = (e / s | 0) * s); a[n] === 0; n--) a.pop();
|
|
2832
2942
|
if (n < 0)
|
|
@@ -2838,44 +2948,44 @@ function Gi(r) {
|
|
|
2838
2948
|
}
|
|
2839
2949
|
return o.e = t, o.d = a, o;
|
|
2840
2950
|
}
|
|
2841
|
-
function
|
|
2951
|
+
function Zi(r) {
|
|
2842
2952
|
return C(r = new this(r), r.e + 1, this.rounding);
|
|
2843
2953
|
}
|
|
2844
|
-
function
|
|
2954
|
+
function Qi(r) {
|
|
2845
2955
|
return r = new this(r), r.d ? r.d[0] ? r.s : 0 * r.s : r.s || NaN;
|
|
2846
2956
|
}
|
|
2847
|
-
function
|
|
2957
|
+
function Ji(r) {
|
|
2848
2958
|
return new this(r).sin();
|
|
2849
2959
|
}
|
|
2850
|
-
function
|
|
2960
|
+
function ts(r) {
|
|
2851
2961
|
return new this(r).sinh();
|
|
2852
2962
|
}
|
|
2853
|
-
function
|
|
2963
|
+
function es(r) {
|
|
2854
2964
|
return new this(r).sqrt();
|
|
2855
2965
|
}
|
|
2856
|
-
function
|
|
2966
|
+
function is(r, i) {
|
|
2857
2967
|
return new this(r).sub(i);
|
|
2858
2968
|
}
|
|
2859
|
-
function
|
|
2969
|
+
function ss() {
|
|
2860
2970
|
var r = 0, i = arguments, t = new this(i[r]);
|
|
2861
2971
|
for (_ = !1; t.s && ++r < i.length; ) t = t.plus(i[r]);
|
|
2862
2972
|
return _ = !0, C(t, this.precision, this.rounding);
|
|
2863
2973
|
}
|
|
2864
|
-
function
|
|
2974
|
+
function ns(r) {
|
|
2865
2975
|
return new this(r).tan();
|
|
2866
2976
|
}
|
|
2867
|
-
function
|
|
2977
|
+
function rs(r) {
|
|
2868
2978
|
return new this(r).tanh();
|
|
2869
2979
|
}
|
|
2870
|
-
function
|
|
2980
|
+
function os(r) {
|
|
2871
2981
|
return C(r = new this(r), r.e + 1, 1);
|
|
2872
2982
|
}
|
|
2873
2983
|
v[Symbol.for("nodejs.util.inspect.custom")] = v.toString;
|
|
2874
2984
|
v[Symbol.toStringTag] = "Decimal";
|
|
2875
|
-
var k = v.constructor =
|
|
2876
|
-
Gt = new k(Gt);
|
|
2985
|
+
var k = v.constructor = Ze(ce);
|
|
2877
2986
|
Xt = new k(Xt);
|
|
2878
|
-
|
|
2987
|
+
Yt = new k(Yt);
|
|
2988
|
+
class as {
|
|
2879
2989
|
constructor() {
|
|
2880
2990
|
/** 父级 */
|
|
2881
2991
|
d(this, "parent");
|
|
@@ -2910,7 +3020,7 @@ class ts {
|
|
|
2910
3020
|
(i = this.parent) == null || i.removeChild(this);
|
|
2911
3021
|
}
|
|
2912
3022
|
}
|
|
2913
|
-
class
|
|
3023
|
+
class ls extends as {
|
|
2914
3024
|
constructor() {
|
|
2915
3025
|
super(...arguments);
|
|
2916
3026
|
d(this, "_isVisible", !0);
|
|
@@ -2956,12 +3066,12 @@ class es extends ts {
|
|
|
2956
3066
|
return !0;
|
|
2957
3067
|
}
|
|
2958
3068
|
}
|
|
2959
|
-
let
|
|
3069
|
+
let cs = class extends ls {
|
|
2960
3070
|
constructor(i) {
|
|
2961
|
-
super(), i.name = i.name ||
|
|
3071
|
+
super(), i.name = i.name || oe("default-name-"), Object.assign(this, { ...i });
|
|
2962
3072
|
}
|
|
2963
3073
|
};
|
|
2964
|
-
class
|
|
3074
|
+
class hs extends cs {
|
|
2965
3075
|
constructor(t) {
|
|
2966
3076
|
super(t);
|
|
2967
3077
|
d(this, "_isInteractive", !0);
|
|
@@ -3040,7 +3150,7 @@ class ss extends is {
|
|
|
3040
3150
|
return (this.parent ? this.parent[t] : !0) && e && (s ? this.isInteractive : !0);
|
|
3041
3151
|
}
|
|
3042
3152
|
}
|
|
3043
|
-
class
|
|
3153
|
+
class us {
|
|
3044
3154
|
constructor(i) {
|
|
3045
3155
|
d(this, "propagationStopped", !1);
|
|
3046
3156
|
this.data = i;
|
|
@@ -3052,7 +3162,7 @@ class ns {
|
|
|
3052
3162
|
return !this.propagationStopped;
|
|
3053
3163
|
}
|
|
3054
3164
|
}
|
|
3055
|
-
class Vt extends
|
|
3165
|
+
class Vt extends hs {
|
|
3056
3166
|
constructor() {
|
|
3057
3167
|
super(...arguments);
|
|
3058
3168
|
//#region 4. 添加事件管理器
|
|
@@ -3170,7 +3280,7 @@ class Vt extends ss {
|
|
|
3170
3280
|
var c, h;
|
|
3171
3281
|
if (!this[n]) return;
|
|
3172
3282
|
this.updateStates(t, e);
|
|
3173
|
-
const o = new
|
|
3283
|
+
const o = new us(e);
|
|
3174
3284
|
this.listeners[t].forEach((u) => u(o, s));
|
|
3175
3285
|
const a = "notify" + (t.charAt(0).toUpperCase() + t.slice(1)), l = ["notifyDrag", "notifyWheel"].includes(a) ? e : e.state;
|
|
3176
3286
|
o.canPropagate && ((c = this.parent) == null || c[a](l, s)), (h = this.sharedControllers[t]) == null || h.forEach(
|
|
@@ -3226,7 +3336,7 @@ class Vt extends ss {
|
|
|
3226
3336
|
}
|
|
3227
3337
|
//#region 6. 添加事件通知方法
|
|
3228
3338
|
}
|
|
3229
|
-
class
|
|
3339
|
+
class ds extends Vt {
|
|
3230
3340
|
constructor(t) {
|
|
3231
3341
|
super(t);
|
|
3232
3342
|
/** 画布元素 */
|
|
@@ -3500,7 +3610,7 @@ class rs extends Vt {
|
|
|
3500
3610
|
) : l(t);
|
|
3501
3611
|
}
|
|
3502
3612
|
}
|
|
3503
|
-
class
|
|
3613
|
+
class fs extends ds {
|
|
3504
3614
|
constructor(t) {
|
|
3505
3615
|
super(t);
|
|
3506
3616
|
/** 主题 */
|
|
@@ -3748,10 +3858,10 @@ class os extends rs {
|
|
|
3748
3858
|
setStyle(t) {
|
|
3749
3859
|
for (const e in t)
|
|
3750
3860
|
if (Object.prototype.hasOwnProperty.call(t, e)) {
|
|
3751
|
-
const s =
|
|
3861
|
+
const s = di(
|
|
3752
3862
|
this.style[e] || this.style[this.theme]
|
|
3753
3863
|
);
|
|
3754
|
-
|
|
3864
|
+
ct(s, t[e]), this.style[e] = s;
|
|
3755
3865
|
}
|
|
3756
3866
|
this.initStyle();
|
|
3757
3867
|
}
|
|
@@ -4026,7 +4136,7 @@ class D extends Vt {
|
|
|
4026
4136
|
handleValuePosition(t, e) {
|
|
4027
4137
|
let { value: s, position: n, mainCanvas: o } = this;
|
|
4028
4138
|
if (!o) return !1;
|
|
4029
|
-
const a = t === "array1D" ?
|
|
4139
|
+
const a = t === "array1D" ? xe : Gt, [l, c] = [
|
|
4030
4140
|
a(s) && (!e || s.length >= e),
|
|
4031
4141
|
a(n) && (!e || n.length >= e)
|
|
4032
4142
|
], h = {
|
|
@@ -4087,7 +4197,7 @@ class D extends Vt {
|
|
|
4087
4197
|
}
|
|
4088
4198
|
}
|
|
4089
4199
|
d(D, "ctx", document.createElement("canvas").getContext("2d"));
|
|
4090
|
-
class
|
|
4200
|
+
class de extends D {
|
|
4091
4201
|
constructor(t) {
|
|
4092
4202
|
super(t);
|
|
4093
4203
|
d(this, "_draw");
|
|
@@ -4195,7 +4305,7 @@ class R {
|
|
|
4195
4305
|
return new k(i).div(t).toNumber();
|
|
4196
4306
|
}
|
|
4197
4307
|
}
|
|
4198
|
-
class
|
|
4308
|
+
class fe extends D {
|
|
4199
4309
|
constructor(t) {
|
|
4200
4310
|
super(t);
|
|
4201
4311
|
/** 文字偏差 */
|
|
@@ -4295,7 +4405,7 @@ class ue extends D {
|
|
|
4295
4405
|
}
|
|
4296
4406
|
}
|
|
4297
4407
|
}
|
|
4298
|
-
class
|
|
4408
|
+
class vt extends D {
|
|
4299
4409
|
constructor(t) {
|
|
4300
4410
|
super(t);
|
|
4301
4411
|
d(this, "angle", 2 * Math.PI);
|
|
@@ -4340,7 +4450,7 @@ class gt extends D {
|
|
|
4340
4450
|
cancelAndRestartAnimation(t, e, s) {
|
|
4341
4451
|
this.fillProgress.scheduleCallback();
|
|
4342
4452
|
let n = 0;
|
|
4343
|
-
this.fillProgress.scheduleCallback =
|
|
4453
|
+
this.fillProgress.scheduleCallback = Ut((o) => {
|
|
4344
4454
|
!this.fillProgress || !o || (this.fillProgress.progress += (o - n) * (t ? 1 : -1), n = o, this.fillProgress.progress = Math.min(
|
|
4345
4455
|
1,
|
|
4346
4456
|
Math.max(0, this.fillProgress.progress)
|
|
@@ -4352,7 +4462,7 @@ class gt extends D {
|
|
|
4352
4462
|
this.fillProgress = {
|
|
4353
4463
|
lineWidthOffset: 0,
|
|
4354
4464
|
progress: 0,
|
|
4355
|
-
scheduleCallback:
|
|
4465
|
+
scheduleCallback: Ut((s) => {
|
|
4356
4466
|
this.fillProgress && (this.fillProgress.progress = s, this.updateLineWidthOffset(t));
|
|
4357
4467
|
}, e)
|
|
4358
4468
|
};
|
|
@@ -4411,7 +4521,7 @@ class gt extends D {
|
|
|
4411
4521
|
}
|
|
4412
4522
|
}
|
|
4413
4523
|
}
|
|
4414
|
-
class
|
|
4524
|
+
class Qe extends D {
|
|
4415
4525
|
constructor(t) {
|
|
4416
4526
|
super(t);
|
|
4417
4527
|
/** 控制点 */
|
|
@@ -4510,7 +4620,7 @@ class $e extends D {
|
|
|
4510
4620
|
tryCreateNewHandlePoint(t, e) {
|
|
4511
4621
|
var c;
|
|
4512
4622
|
if (!this.isPointInStroke(t, e)) return;
|
|
4513
|
-
const s = this.getExtendedDynamicPositions(), n =
|
|
4623
|
+
const s = this.getExtendedDynamicPositions(), n = ms([t, e], s);
|
|
4514
4624
|
if (n === -1) return;
|
|
4515
4625
|
const [o, a] = this.getAdjacentIndices(n), l = this.createNewHandlePoint(o, a);
|
|
4516
4626
|
this.insertHandlePoint(n, l), this.lockHandlePointCreationTemporarily(), (c = this.notifyReload) == null || c.call(this);
|
|
@@ -4531,17 +4641,17 @@ class $e extends D {
|
|
|
4531
4641
|
}
|
|
4532
4642
|
/** 创建新的控制点 */
|
|
4533
4643
|
createNewHandlePoint(t, e) {
|
|
4534
|
-
const s =
|
|
4644
|
+
const s = ee(
|
|
4535
4645
|
this.value[t],
|
|
4536
4646
|
this.value[e]
|
|
4537
|
-
), n =
|
|
4647
|
+
), n = ee(
|
|
4538
4648
|
this.position[t],
|
|
4539
4649
|
this.position[e]
|
|
4540
|
-
), o =
|
|
4650
|
+
), o = ee(
|
|
4541
4651
|
this.dynamicPosition[t],
|
|
4542
4652
|
this.dynamicPosition[e]
|
|
4543
4653
|
);
|
|
4544
|
-
return new
|
|
4654
|
+
return new vt({
|
|
4545
4655
|
value: s,
|
|
4546
4656
|
position: n,
|
|
4547
4657
|
dynamicPosition: o,
|
|
@@ -4580,7 +4690,7 @@ class $e extends D {
|
|
|
4580
4690
|
let { value: t, position: e, dynamicPosition: s, offset: n, isHandlePointsVisible: o } = this;
|
|
4581
4691
|
!s || !o || (t == null || t.forEach((a, l) => {
|
|
4582
4692
|
if (!this.handlePoints[l]) {
|
|
4583
|
-
const c = new
|
|
4693
|
+
const c = new vt({
|
|
4584
4694
|
value: [0, 0],
|
|
4585
4695
|
mainCanvas: this.mainCanvas,
|
|
4586
4696
|
isDraggable: !0,
|
|
@@ -4609,12 +4719,12 @@ class $e extends D {
|
|
|
4609
4719
|
});
|
|
4610
4720
|
}
|
|
4611
4721
|
}
|
|
4612
|
-
function
|
|
4722
|
+
function ms(r, i, t = 10) {
|
|
4613
4723
|
if (i.length === 0) return 0;
|
|
4614
4724
|
if (i.length === 1) return 1;
|
|
4615
4725
|
let e = 1 / 0, s = -1;
|
|
4616
4726
|
for (let n = 0; n < i.length - 1; n++) {
|
|
4617
|
-
const o =
|
|
4727
|
+
const o = Us(
|
|
4618
4728
|
r,
|
|
4619
4729
|
i[n],
|
|
4620
4730
|
i[n + 1]
|
|
@@ -4625,11 +4735,11 @@ function as(r, i, t = 10) {
|
|
|
4625
4735
|
}
|
|
4626
4736
|
return s;
|
|
4627
4737
|
}
|
|
4628
|
-
function
|
|
4629
|
-
const { x: t, y: e } =
|
|
4738
|
+
function ee(r, i) {
|
|
4739
|
+
const { x: t, y: e } = ii(...r, ...i);
|
|
4630
4740
|
return [t, e];
|
|
4631
4741
|
}
|
|
4632
|
-
class
|
|
4742
|
+
class me extends Qe {
|
|
4633
4743
|
constructor(t) {
|
|
4634
4744
|
super(t);
|
|
4635
4745
|
d(this, "_isInfinite");
|
|
@@ -4670,7 +4780,7 @@ class de extends $e {
|
|
|
4670
4780
|
if (this.isInfinite) {
|
|
4671
4781
|
this.isRecalculate && this.updateDynamicPosition();
|
|
4672
4782
|
const { width: t, height: e } = this.mainCanvas.rect;
|
|
4673
|
-
return
|
|
4783
|
+
return ps(
|
|
4674
4784
|
[0, 0],
|
|
4675
4785
|
[t, e],
|
|
4676
4786
|
this.finalDynamicPosition[0],
|
|
@@ -4691,7 +4801,7 @@ class de extends $e {
|
|
|
4691
4801
|
var o;
|
|
4692
4802
|
const e = this.mainCanvas, s = e.style[e.theme].line;
|
|
4693
4803
|
let n = {};
|
|
4694
|
-
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.line) || s : typeof this.style == "object" ? n =
|
|
4804
|
+
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.line) || s : typeof this.style == "object" ? n = ct(
|
|
4695
4805
|
JSON.parse(JSON.stringify(s)),
|
|
4696
4806
|
this.style
|
|
4697
4807
|
) : n = s, t && this.setBaseLineStyle(t, n.stroke), n;
|
|
@@ -4720,12 +4830,12 @@ class de extends $e {
|
|
|
4720
4830
|
const { rect: n } = e, [o, a] = s, l = [a[0] - o[0], a[1] - o[1]];
|
|
4721
4831
|
if (l[0] === 0 && l[1] === 0)
|
|
4722
4832
|
return console.error("重合点无法确定方向");
|
|
4723
|
-
const c =
|
|
4833
|
+
const c = Ae(
|
|
4724
4834
|
o,
|
|
4725
4835
|
[-l[0], -l[1]],
|
|
4726
4836
|
n.width,
|
|
4727
4837
|
n.height
|
|
4728
|
-
), h =
|
|
4838
|
+
), h = Ae(
|
|
4729
4839
|
a,
|
|
4730
4840
|
l,
|
|
4731
4841
|
n.width,
|
|
@@ -4740,7 +4850,7 @@ class de extends $e {
|
|
|
4740
4850
|
}
|
|
4741
4851
|
}
|
|
4742
4852
|
}
|
|
4743
|
-
function
|
|
4853
|
+
function Ae(r, i, t, e) {
|
|
4744
4854
|
const [s, n] = r, [o, a] = i;
|
|
4745
4855
|
let l = 1 / 0;
|
|
4746
4856
|
if (o !== 0) {
|
|
@@ -4753,7 +4863,7 @@ function Ee(r, i, t, e) {
|
|
|
4753
4863
|
}
|
|
4754
4864
|
return l === 1 / 0 ? r : [s + o * l, n + a * l];
|
|
4755
4865
|
}
|
|
4756
|
-
function
|
|
4866
|
+
function ps(r, i, t, e) {
|
|
4757
4867
|
const s = Math.min(r[0], i[0]), n = Math.max(r[0], i[0]), o = Math.min(r[1], i[1]), a = Math.max(r[1], i[1]), l = [
|
|
4758
4868
|
[s, o],
|
|
4759
4869
|
// 左上
|
|
@@ -4777,7 +4887,7 @@ function ls(r, i, t, e) {
|
|
|
4777
4887
|
}
|
|
4778
4888
|
return m && g;
|
|
4779
4889
|
}
|
|
4780
|
-
class
|
|
4890
|
+
class pe extends Qe {
|
|
4781
4891
|
constructor(t) {
|
|
4782
4892
|
super(t);
|
|
4783
4893
|
d(this, "_isRect", !1);
|
|
@@ -4872,7 +4982,7 @@ class fe extends $e {
|
|
|
4872
4982
|
var c;
|
|
4873
4983
|
const e = this.isHover, s = this.mainCanvas, n = s.style[s.theme].polygon;
|
|
4874
4984
|
let o = {};
|
|
4875
|
-
typeof this.style == "string" ? o = ((c = s.style[this.style]) == null ? void 0 : c.polygon) || n : typeof this.style == "object" ? o =
|
|
4985
|
+
typeof this.style == "string" ? o = ((c = s.style[this.style]) == null ? void 0 : c.polygon) || n : typeof this.style == "object" ? o = ct(
|
|
4876
4986
|
JSON.parse(JSON.stringify(n)),
|
|
4877
4987
|
this.style
|
|
4878
4988
|
) : o = n;
|
|
@@ -4914,7 +5024,7 @@ class fe extends $e {
|
|
|
4914
5024
|
}
|
|
4915
5025
|
}
|
|
4916
5026
|
}
|
|
4917
|
-
class
|
|
5027
|
+
class ge extends D {
|
|
4918
5028
|
constructor(t) {
|
|
4919
5029
|
super(t);
|
|
4920
5030
|
d(this, "_isFill", !1);
|
|
@@ -5108,7 +5218,7 @@ class me extends D {
|
|
|
5108
5218
|
var c;
|
|
5109
5219
|
const e = this.isHover, s = this.mainCanvas, n = s.style[s.theme].arc;
|
|
5110
5220
|
let o = {};
|
|
5111
|
-
typeof this.style == "string" ? o = ((c = s.style[this.style]) == null ? void 0 : c.arc) || n : typeof this.style == "object" ? o =
|
|
5221
|
+
typeof this.style == "string" ? o = ((c = s.style[this.style]) == null ? void 0 : c.arc) || n : typeof this.style == "object" ? o = ct(
|
|
5112
5222
|
JSON.parse(JSON.stringify(n)),
|
|
5113
5223
|
this.style
|
|
5114
5224
|
) : o = n;
|
|
@@ -5138,14 +5248,14 @@ class me extends D {
|
|
|
5138
5248
|
offset: c
|
|
5139
5249
|
} = this;
|
|
5140
5250
|
if (!t || !a || !l) return;
|
|
5141
|
-
const [h, u] =
|
|
5251
|
+
const [h, u] = gs(
|
|
5142
5252
|
...e,
|
|
5143
5253
|
s,
|
|
5144
5254
|
n,
|
|
5145
5255
|
o,
|
|
5146
5256
|
t.axisConfig.x,
|
|
5147
5257
|
t.axisConfig.y
|
|
5148
|
-
), f = (w) => new
|
|
5258
|
+
), f = (w) => new vt({
|
|
5149
5259
|
name: w,
|
|
5150
5260
|
offset: c,
|
|
5151
5261
|
value: [0, 0],
|
|
@@ -5242,14 +5352,14 @@ class me extends D {
|
|
|
5242
5352
|
}
|
|
5243
5353
|
}
|
|
5244
5354
|
}
|
|
5245
|
-
function
|
|
5355
|
+
function gs(r, i, t, e, s, n = 1, o = 1) {
|
|
5246
5356
|
const a = r + t * Math.cos(e) * n, l = i + t * Math.sin(e) * o, c = r + t * Math.cos(s) * n, h = i + t * Math.sin(s) * o;
|
|
5247
5357
|
return [
|
|
5248
5358
|
[a, l],
|
|
5249
5359
|
[c, h]
|
|
5250
5360
|
];
|
|
5251
5361
|
}
|
|
5252
|
-
class
|
|
5362
|
+
class ve extends D {
|
|
5253
5363
|
constructor(t) {
|
|
5254
5364
|
super(t);
|
|
5255
5365
|
/** 控制点 */
|
|
@@ -5334,7 +5444,7 @@ class pe extends D {
|
|
|
5334
5444
|
var o;
|
|
5335
5445
|
const e = this.mainCanvas, s = e.style[e.theme].arcTo;
|
|
5336
5446
|
let n = {};
|
|
5337
|
-
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.arcTo) || s : typeof this.style == "object" ? n =
|
|
5447
|
+
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.arcTo) || s : typeof this.style == "object" ? n = ct(
|
|
5338
5448
|
JSON.parse(JSON.stringify(s)),
|
|
5339
5449
|
this.style
|
|
5340
5450
|
) : n = s, t && this.setBaseLineStyle(t, n.stroke), n;
|
|
@@ -5347,7 +5457,7 @@ class pe extends D {
|
|
|
5347
5457
|
var c, h;
|
|
5348
5458
|
let { value: t, position: e, dynamicPosition: s, isHandlePointsVisible: n } = this;
|
|
5349
5459
|
if (!s || !n) return;
|
|
5350
|
-
const o = () => new
|
|
5460
|
+
const o = () => new vt({
|
|
5351
5461
|
value: [0, 0],
|
|
5352
5462
|
mainCanvas: this.mainCanvas,
|
|
5353
5463
|
isDraggable: !0,
|
|
@@ -5373,8 +5483,8 @@ class pe extends D {
|
|
|
5373
5483
|
if (!this.mainCanvas) return;
|
|
5374
5484
|
let { value: t, position: e } = this;
|
|
5375
5485
|
const [s, n] = [
|
|
5376
|
-
|
|
5377
|
-
|
|
5486
|
+
Gt(t) && t.length > 1,
|
|
5487
|
+
Gt(e) && e.length > 1
|
|
5378
5488
|
];
|
|
5379
5489
|
if (!s && !n)
|
|
5380
5490
|
return this.handlePoints = void 0, this.internalUpdate({ dynamicPosition: void 0 });
|
|
@@ -5416,7 +5526,7 @@ class pe extends D {
|
|
|
5416
5526
|
}
|
|
5417
5527
|
}
|
|
5418
5528
|
}
|
|
5419
|
-
class
|
|
5529
|
+
class vs extends fs {
|
|
5420
5530
|
constructor(t) {
|
|
5421
5531
|
super(t);
|
|
5422
5532
|
/** 监听元素大小 */
|
|
@@ -5433,7 +5543,7 @@ class hs extends os {
|
|
|
5433
5543
|
maxYV: 0
|
|
5434
5544
|
});
|
|
5435
5545
|
/** 测量重绘性能 */
|
|
5436
|
-
d(this, "measureRedrawPerformance",
|
|
5546
|
+
d(this, "measureRedrawPerformance", fi(
|
|
5437
5547
|
() => {
|
|
5438
5548
|
this.isRendering = !0, this.redraw(), this.redrawInNextRenderFrame = !1, this.isRendering = !1;
|
|
5439
5549
|
},
|
|
@@ -5446,7 +5556,7 @@ class hs extends os {
|
|
|
5446
5556
|
}
|
|
5447
5557
|
));
|
|
5448
5558
|
this.canvas && (this.resizeObserver = new ResizeObserver(
|
|
5449
|
-
|
|
5559
|
+
ze(() => {
|
|
5450
5560
|
[this.canvas.width, this.canvas.height] = [
|
|
5451
5561
|
this.rect.width,
|
|
5452
5562
|
this.rect.height
|
|
@@ -5493,7 +5603,7 @@ class hs extends os {
|
|
|
5493
5603
|
if (a !== h) return h - a;
|
|
5494
5604
|
if (l !== u)
|
|
5495
5605
|
return u - l;
|
|
5496
|
-
const m = (g) => g instanceof
|
|
5606
|
+
const m = (g) => g instanceof de ? 5 : g instanceof fe ? 4 : g instanceof vt ? 3 : g instanceof me || g instanceof ge || g instanceof ve ? 2 : g instanceof pe ? 1 : 0;
|
|
5497
5607
|
return m(f) - m(c);
|
|
5498
5608
|
}
|
|
5499
5609
|
), this.currentDrawOverlays = t.map(
|
|
@@ -5528,7 +5638,7 @@ class hs extends os {
|
|
|
5528
5638
|
(t = this.resizeObserver) == null || t.disconnect();
|
|
5529
5639
|
}
|
|
5530
5640
|
}
|
|
5531
|
-
class
|
|
5641
|
+
class ys extends vs {
|
|
5532
5642
|
constructor(t) {
|
|
5533
5643
|
super(t);
|
|
5534
5644
|
/** 鼠标是否在画布内 */
|
|
@@ -5638,16 +5748,16 @@ class us extends hs {
|
|
|
5638
5748
|
keydown(t) {
|
|
5639
5749
|
const { mouseInCanvas: e, offset: s, delta: n, axisConfig: o } = this, a = t.key;
|
|
5640
5750
|
if (!e || !this.isDraggable || this.isAuto) return;
|
|
5641
|
-
const l = this.getStep(a), c = this.lastClickedOverlay, u = (c == null ? void 0 : c.isDraggable) && this.currentDrawOverlays.includes(c) && (
|
|
5751
|
+
const l = this.getStep(a), c = this.lastClickedOverlay, u = (c == null ? void 0 : c.isDraggable) && this.currentDrawOverlays.includes(c) && (Gt(c.value) ? "Matrix" : xe(c.value) ? "Single" : !1), f = (y, w) => {
|
|
5642
5752
|
if (!u)
|
|
5643
5753
|
return s.x += y * l, s.y += w * l, !0;
|
|
5644
5754
|
const b = this.getAxisValueByPoint(l, 0).xV, [P, E] = [b * o.x, b * o.y];
|
|
5645
5755
|
if (u === "Single") {
|
|
5646
|
-
const
|
|
5647
|
-
|
|
5756
|
+
const O = c.value;
|
|
5757
|
+
O[0] += y * P, O[1] += w * E;
|
|
5648
5758
|
} else
|
|
5649
|
-
c.value.forEach((
|
|
5650
|
-
|
|
5759
|
+
c.value.forEach((O) => {
|
|
5760
|
+
O[0] += y * P, O[1] += w * E;
|
|
5651
5761
|
});
|
|
5652
5762
|
return c.value = [...c.value], !0;
|
|
5653
5763
|
}, m = (y) => (this.setScale("center", y * n), !0), p = {
|
|
@@ -5773,17 +5883,17 @@ class us extends hs {
|
|
|
5773
5883
|
} else if (e.length === 2) {
|
|
5774
5884
|
const { clientX: h, clientY: u } = e[0], { clientX: f, clientY: m } = e[1];
|
|
5775
5885
|
if (s.length == 2) {
|
|
5776
|
-
const g =
|
|
5886
|
+
const g = we(
|
|
5777
5887
|
s[0],
|
|
5778
5888
|
n[0],
|
|
5779
5889
|
s[1],
|
|
5780
5890
|
n[1]
|
|
5781
|
-
), p =
|
|
5891
|
+
), p = we(
|
|
5782
5892
|
h,
|
|
5783
5893
|
u,
|
|
5784
5894
|
f,
|
|
5785
5895
|
m
|
|
5786
|
-
), { x: y, y: w } =
|
|
5896
|
+
), { x: y, y: w } = ii(
|
|
5787
5897
|
h,
|
|
5788
5898
|
u,
|
|
5789
5899
|
f,
|
|
@@ -5966,7 +6076,7 @@ class $ extends Vt {
|
|
|
5966
6076
|
}
|
|
5967
6077
|
}
|
|
5968
6078
|
}
|
|
5969
|
-
class
|
|
6079
|
+
class Rt extends Vt {
|
|
5970
6080
|
constructor(t) {
|
|
5971
6081
|
super(t);
|
|
5972
6082
|
/** 图层群组 */
|
|
@@ -6039,7 +6149,7 @@ class kt extends Vt {
|
|
|
6039
6149
|
return [];
|
|
6040
6150
|
}
|
|
6041
6151
|
}
|
|
6042
|
-
class
|
|
6152
|
+
class ws extends ys {
|
|
6043
6153
|
/** 获取默认覆盖物群组 */
|
|
6044
6154
|
getDefaultOverlayGroup() {
|
|
6045
6155
|
var c, h, u, f, m, g, p;
|
|
@@ -6064,7 +6174,7 @@ class ds extends us {
|
|
|
6064
6174
|
const t = [], e = i !== void 0 ? Array.isArray(i) ? [...i] : [i] : Array.from(this.layerGroups.values());
|
|
6065
6175
|
for (; e.length > 0; ) {
|
|
6066
6176
|
const s = e.pop();
|
|
6067
|
-
if (s instanceof
|
|
6177
|
+
if (s instanceof Rt) {
|
|
6068
6178
|
if (!s.isVisible) continue;
|
|
6069
6179
|
e.push(...s.layers.values());
|
|
6070
6180
|
} else if (s instanceof $) {
|
|
@@ -6079,7 +6189,7 @@ class ds extends us {
|
|
|
6079
6189
|
return t;
|
|
6080
6190
|
}
|
|
6081
6191
|
}
|
|
6082
|
-
class
|
|
6192
|
+
class xs extends ws {
|
|
6083
6193
|
/** 缩放画布 */
|
|
6084
6194
|
zoom(i) {
|
|
6085
6195
|
const { canvas: t, rect: e } = this;
|
|
@@ -6112,7 +6222,7 @@ class fs extends ds {
|
|
|
6112
6222
|
super.setDefaultCenter(i), this.redrawOnce();
|
|
6113
6223
|
}
|
|
6114
6224
|
}
|
|
6115
|
-
class
|
|
6225
|
+
class bs extends xs {
|
|
6116
6226
|
/**
|
|
6117
6227
|
* 调整视图以适应指定覆盖层
|
|
6118
6228
|
* @param overlays 目标覆盖层数组,默认使用全部可见覆盖层
|
|
@@ -6173,8 +6283,8 @@ class ms extends fs {
|
|
|
6173
6283
|
const E = Math.ceil(p / w);
|
|
6174
6284
|
P = 1 - ((y * E / p - a.min) / a.min + (E - 2)) * b;
|
|
6175
6285
|
} else {
|
|
6176
|
-
const E = (
|
|
6177
|
-
P = 1 + ((y / G / p - a.min) / a.min +
|
|
6286
|
+
const E = (dt, nt, yt) => dt < nt ? yt - 1 : E(dt / 2, nt, yt + 1), O = E(w, p, 0), G = Math.pow(2, O);
|
|
6287
|
+
P = 1 + ((y / G / p - a.min) / a.min + O) * b;
|
|
6178
6288
|
}
|
|
6179
6289
|
return s !== void 0 && (P = Math.min(s, P)), P = new k(P).div(o).round().mul(o).toNumber(), P;
|
|
6180
6290
|
}
|
|
@@ -6224,13 +6334,13 @@ class ms extends fs {
|
|
|
6224
6334
|
animateScale(i, t, e, s) {
|
|
6225
6335
|
const n = t - i;
|
|
6226
6336
|
let o = 0;
|
|
6227
|
-
|
|
6337
|
+
Ut((a) => {
|
|
6228
6338
|
!this.isAuto || !this.canvas || !this.isInteractive || (this.setScale("center", (a - o) * n), o = a, this.redrawOnce(), a === 1 && s());
|
|
6229
6339
|
}, e);
|
|
6230
6340
|
}
|
|
6231
6341
|
/** 执行偏移动画 */
|
|
6232
6342
|
animateOffset(i, t, e, s) {
|
|
6233
|
-
|
|
6343
|
+
Ut((n) => {
|
|
6234
6344
|
!this.isAuto || !this.canvas || !this.isInteractive || (this.offset = {
|
|
6235
6345
|
x: Number((i.x + t.x * n).toFixed(0)),
|
|
6236
6346
|
y: Number((i.y + t.y * n).toFixed(0))
|
|
@@ -6255,7 +6365,7 @@ class ms extends fs {
|
|
|
6255
6365
|
});
|
|
6256
6366
|
}
|
|
6257
6367
|
}
|
|
6258
|
-
class
|
|
6368
|
+
class Ps extends bs {
|
|
6259
6369
|
/** 开关坐标轴 */
|
|
6260
6370
|
toggleAxis(i) {
|
|
6261
6371
|
this.drawAxis.toggleAxis(i), this.redrawOnce();
|
|
@@ -6280,7 +6390,7 @@ class ps extends ms {
|
|
|
6280
6390
|
return this.isInteractive = i ?? !this.isInteractive, this.isInteractive;
|
|
6281
6391
|
}
|
|
6282
6392
|
}
|
|
6283
|
-
class
|
|
6393
|
+
class Cs extends Ps {
|
|
6284
6394
|
/**
|
|
6285
6395
|
* 清除指定区域的像素点
|
|
6286
6396
|
* @param ctx - Canvas 2D绘图上下文
|
|
@@ -6291,9 +6401,9 @@ class gs extends ps {
|
|
|
6291
6401
|
i.save(), i.beginPath(), i.clip(t), i.clearRect(0, 0, e, s), i.restore();
|
|
6292
6402
|
}
|
|
6293
6403
|
}
|
|
6294
|
-
class
|
|
6404
|
+
class Ss extends Cs {
|
|
6295
6405
|
}
|
|
6296
|
-
class
|
|
6406
|
+
class _s {
|
|
6297
6407
|
constructor(i) {
|
|
6298
6408
|
/** 画布 */
|
|
6299
6409
|
d(this, "canvas");
|
|
@@ -6408,7 +6518,7 @@ class ys {
|
|
|
6408
6518
|
const y = s.y > c || s.y < 0;
|
|
6409
6519
|
let w = s.x > 0 ? s.x % g : s.x < 0 ? g + s.x % g : 0, b = i.getAxisValueByPoint((w - s.x) * n.x, 0).xV;
|
|
6410
6520
|
for (; w <= l; ) {
|
|
6411
|
-
const P =
|
|
6521
|
+
const P = se(b), E = h(P);
|
|
6412
6522
|
b !== 0 && this.drawText(P, w - E / 2, p, y), w += g, b = new k(m).mul(n.x).add(b).toNumber();
|
|
6413
6523
|
}
|
|
6414
6524
|
}
|
|
@@ -6416,14 +6526,14 @@ class ys {
|
|
|
6416
6526
|
const p = s.x > l || s.x < 0;
|
|
6417
6527
|
let y = s.y > 0 ? s.y % g : s.y < 0 ? g + s.y % g : 0, w = i.getAxisValueByPoint(0, (y - s.y) * n.y).yV;
|
|
6418
6528
|
for (; y <= c; ) {
|
|
6419
|
-
const b =
|
|
6529
|
+
const b = se(w), P = h(b);
|
|
6420
6530
|
let E = s.x - P - u;
|
|
6421
6531
|
E = Math.max(Math.min(E, l - P - u), u), w != 0 && this.drawText(b, E, y + f / 2, p), y += g, w = new k(m).mul(n.y).add(w).toNumber();
|
|
6422
6532
|
}
|
|
6423
6533
|
}
|
|
6424
6534
|
}
|
|
6425
6535
|
}
|
|
6426
|
-
class
|
|
6536
|
+
class Es {
|
|
6427
6537
|
constructor(i) {
|
|
6428
6538
|
/** 绑定的画布实例 */
|
|
6429
6539
|
d(this, "canvas");
|
|
@@ -6527,7 +6637,7 @@ class ws {
|
|
|
6527
6637
|
}
|
|
6528
6638
|
}
|
|
6529
6639
|
}
|
|
6530
|
-
class
|
|
6640
|
+
class Ms {
|
|
6531
6641
|
/**
|
|
6532
6642
|
* 计算默认缩放比例,使图像适配视图容器
|
|
6533
6643
|
* @param naturalWidth 图像原始宽度
|
|
@@ -6562,7 +6672,7 @@ class xs {
|
|
|
6562
6672
|
};
|
|
6563
6673
|
}
|
|
6564
6674
|
}
|
|
6565
|
-
class
|
|
6675
|
+
class Ds extends D {
|
|
6566
6676
|
constructor(t) {
|
|
6567
6677
|
super(t);
|
|
6568
6678
|
d(this, "_ready", !1);
|
|
@@ -6620,12 +6730,12 @@ class bs extends D {
|
|
|
6620
6730
|
const g = u.w / u.h, p = f / m;
|
|
6621
6731
|
if (o === "fill") return u;
|
|
6622
6732
|
if (o === "contain" || o === "scale-down") {
|
|
6623
|
-
const b = Math.min(u.w / f, u.h / m), P = o === "scale-down" ? Math.min(1, b) : b, E = f * P,
|
|
6733
|
+
const b = Math.min(u.w / f, u.h / m), P = o === "scale-down" ? Math.min(1, b) : b, E = f * P, O = m * P;
|
|
6624
6734
|
return {
|
|
6625
6735
|
x: u.x + (u.w - E) / 2,
|
|
6626
|
-
y: u.y + (u.h -
|
|
6736
|
+
y: u.y + (u.h - O) / 2,
|
|
6627
6737
|
w: E,
|
|
6628
|
-
h:
|
|
6738
|
+
h: O
|
|
6629
6739
|
};
|
|
6630
6740
|
}
|
|
6631
6741
|
if (p > g) {
|
|
@@ -6651,7 +6761,7 @@ class bs extends D {
|
|
|
6651
6761
|
this.mainCanvas && (this.ready = !1, this.url && (this.image.src = this.url), this.handleValuePosition("array2D", 1));
|
|
6652
6762
|
}
|
|
6653
6763
|
}
|
|
6654
|
-
class
|
|
6764
|
+
class Ve extends Ds {
|
|
6655
6765
|
constructor(t) {
|
|
6656
6766
|
super(t);
|
|
6657
6767
|
d(this, "defaultDrag", (t, e) => {
|
|
@@ -6687,7 +6797,7 @@ class Me extends bs {
|
|
|
6687
6797
|
var o;
|
|
6688
6798
|
const e = this.mainCanvas, s = e.style[e.theme].billboard;
|
|
6689
6799
|
let n = {};
|
|
6690
|
-
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.billboard) || s : typeof this.style == "object" ? n =
|
|
6800
|
+
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.billboard) || s : typeof this.style == "object" ? n = ct(
|
|
6691
6801
|
JSON.parse(JSON.stringify(s)),
|
|
6692
6802
|
this.style
|
|
6693
6803
|
) : n = s, t && this.setBaseLineStyle(t, n.stroke), n;
|
|
@@ -6714,15 +6824,15 @@ class Me extends bs {
|
|
|
6714
6824
|
}
|
|
6715
6825
|
}
|
|
6716
6826
|
}
|
|
6717
|
-
function
|
|
6827
|
+
function Ft(r) {
|
|
6718
6828
|
return [r].flat(1 / 0);
|
|
6719
6829
|
}
|
|
6720
|
-
class T extends
|
|
6830
|
+
class T extends Ss {
|
|
6721
6831
|
constructor(t) {
|
|
6722
6832
|
super(t);
|
|
6723
6833
|
/** 按坐标轴值创建覆盖物(多边形/线)的交互管理 */
|
|
6724
6834
|
d(this, "overlayCreator");
|
|
6725
|
-
this.drawAxis = new
|
|
6835
|
+
this.drawAxis = new _s(this), "axisShow" in t && this.toggleAxis(t.axisShow), this.overlayCreator = new Es(this), this.initLayerGroups(), this.updateCenter();
|
|
6726
6836
|
}
|
|
6727
6837
|
initLayerGroups() {
|
|
6728
6838
|
const t = new $({ name: "其他图层", zIndex: 1 });
|
|
@@ -6739,7 +6849,7 @@ class T extends vs {
|
|
|
6739
6849
|
a.addGroup(new Y({ name: "文字覆盖物群组" }));
|
|
6740
6850
|
const l = new $({ name: "自定义绘制图层", zIndex: 7 });
|
|
6741
6851
|
l.addGroup(new Y({ name: "自定义绘制覆盖物群组" }));
|
|
6742
|
-
const c = new
|
|
6852
|
+
const c = new Rt({ name: "默认图层群组" });
|
|
6743
6853
|
c.addLayer([
|
|
6744
6854
|
a,
|
|
6745
6855
|
o,
|
|
@@ -6756,11 +6866,11 @@ class T extends vs {
|
|
|
6756
6866
|
}
|
|
6757
6867
|
/** 设置图层群组 */
|
|
6758
6868
|
setLayerGroup(t) {
|
|
6759
|
-
t instanceof
|
|
6869
|
+
t instanceof Rt && (this.layerGroups.set(t.name, t), t.setNotifyReload(() => this.redrawOnce()), t.setMainCanvas(this), t.parent = this);
|
|
6760
6870
|
}
|
|
6761
6871
|
/** 移除图层群组 */
|
|
6762
6872
|
removeLayerGroup(t) {
|
|
6763
|
-
t instanceof
|
|
6873
|
+
t instanceof Rt && (this.layerGroups.delete(t.name), t.setNotifyReload(), t.setMainCanvas(), t.parent = void 0, this.redrawOnce());
|
|
6764
6874
|
}
|
|
6765
6875
|
removeChild(t) {
|
|
6766
6876
|
this.removeLayerGroup(t);
|
|
@@ -6768,11 +6878,11 @@ class T extends vs {
|
|
|
6768
6878
|
/** 添加图层 */
|
|
6769
6879
|
addLayer(t) {
|
|
6770
6880
|
const e = this.layerGroups.get("默认图层群组");
|
|
6771
|
-
e && e.addLayer(
|
|
6881
|
+
e && e.addLayer(Ft(t));
|
|
6772
6882
|
}
|
|
6773
6883
|
/** 移除图层 */
|
|
6774
6884
|
removeLayer(t) {
|
|
6775
|
-
|
|
6885
|
+
Ft(t).forEach((e) => e.remove());
|
|
6776
6886
|
}
|
|
6777
6887
|
/** 添加覆盖物 */
|
|
6778
6888
|
addOverlay(t) {
|
|
@@ -6785,13 +6895,13 @@ class T extends vs {
|
|
|
6785
6895
|
overlays_billboard: l,
|
|
6786
6896
|
overlays_other: c
|
|
6787
6897
|
} = this.getDefaultOverlayGroup() || {};
|
|
6788
|
-
|
|
6789
|
-
h instanceof
|
|
6898
|
+
Ft(t).forEach((h) => {
|
|
6899
|
+
h instanceof fe ? e == null || e.addOverlay(h) : h instanceof vt ? s == null || s.addOverlay(h) : h instanceof me || h instanceof ge || h instanceof ve ? n == null || n.addOverlay(h) : h instanceof pe ? o == null || o.addOverlay(h) : h instanceof de ? a == null || a.addOverlay(h) : h instanceof Ve ? l == null || l.addOverlay(h) : c == null || c.addOverlay(h);
|
|
6790
6900
|
});
|
|
6791
6901
|
}
|
|
6792
6902
|
/** 移除覆盖物 */
|
|
6793
6903
|
removeOverlay(t) {
|
|
6794
|
-
|
|
6904
|
+
Ft(t).forEach((e) => e.remove());
|
|
6795
6905
|
}
|
|
6796
6906
|
/** 销毁 */
|
|
6797
6907
|
destroy() {
|
|
@@ -6799,19 +6909,19 @@ class T extends vs {
|
|
|
6799
6909
|
}
|
|
6800
6910
|
}
|
|
6801
6911
|
/** 视图适配工具:默认缩放、居中计算 */
|
|
6802
|
-
d(T, "ViewFit",
|
|
6803
|
-
d(T, "LayerGroup",
|
|
6912
|
+
d(T, "ViewFit", Ms), /** 图层群组 */
|
|
6913
|
+
d(T, "LayerGroup", Rt), /** 图层 */
|
|
6804
6914
|
d(T, "Layer", $), /** 覆盖物群组 */
|
|
6805
6915
|
d(T, "OverlayGroup", Y), /** 文字 */
|
|
6806
|
-
d(T, "Text",
|
|
6807
|
-
d(T, "Point",
|
|
6808
|
-
d(T, "Line",
|
|
6809
|
-
d(T, "Polygon",
|
|
6810
|
-
d(T, "Custom",
|
|
6811
|
-
d(T, "Arc",
|
|
6812
|
-
d(T, "ArcTo",
|
|
6813
|
-
d(T, "Billboard",
|
|
6814
|
-
class
|
|
6916
|
+
d(T, "Text", fe), /** 点位 */
|
|
6917
|
+
d(T, "Point", vt), /** 线段 */
|
|
6918
|
+
d(T, "Line", me), /** 多边形 */
|
|
6919
|
+
d(T, "Polygon", pe), /** 自定义绘制 */
|
|
6920
|
+
d(T, "Custom", de), /** 圆弧 */
|
|
6921
|
+
d(T, "Arc", ge), /** 圆角 */
|
|
6922
|
+
d(T, "ArcTo", ve), /** 图片 */
|
|
6923
|
+
d(T, "Billboard", Ve);
|
|
6924
|
+
class ks {
|
|
6815
6925
|
/** @param id canvas DOM id(通过 getElementById 定位) */
|
|
6816
6926
|
constructor(i) {
|
|
6817
6927
|
/** Canvas DOM id(用于 `document.getElementById` 定位) */
|
|
@@ -6865,7 +6975,7 @@ class Ps {
|
|
|
6865
6975
|
this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = void 0);
|
|
6866
6976
|
}
|
|
6867
6977
|
}
|
|
6868
|
-
class
|
|
6978
|
+
class Rs {
|
|
6869
6979
|
/**
|
|
6870
6980
|
* @param canvas 绑定 mousedown 的 canvas
|
|
6871
6981
|
* @param onOffsetDelta 拖拽时的 dx 回调(由外部映射到时间偏移)
|
|
@@ -6904,7 +7014,7 @@ class Cs {
|
|
|
6904
7014
|
this.canvas.removeEventListener("mousedown", this.handleMouseDown), window.removeEventListener("mousemove", this.handleMouseMove), window.removeEventListener("mouseup", this.handleMouseUp);
|
|
6905
7015
|
}
|
|
6906
7016
|
}
|
|
6907
|
-
class
|
|
7017
|
+
class As {
|
|
6908
7018
|
/**
|
|
6909
7019
|
* @param canvas 绑定 wheel 事件的 canvas
|
|
6910
7020
|
* @param getTimeSpacing 读取当前 timeSpacing 的函数
|
|
@@ -6939,7 +7049,7 @@ class Ss {
|
|
|
6939
7049
|
this.canvas.removeEventListener("wheel", this.handleWheel);
|
|
6940
7050
|
}
|
|
6941
7051
|
}
|
|
6942
|
-
class
|
|
7052
|
+
class Vs {
|
|
6943
7053
|
/**
|
|
6944
7054
|
* 只负责计算鼠标所在 x/y 对应的时间,并把结果通知给 TimeAxis(不直接操作 DOM)。
|
|
6945
7055
|
*/
|
|
@@ -6976,10 +7086,10 @@ class _s {
|
|
|
6976
7086
|
this.canvas.removeEventListener("mousemove", this.handleMouseMove), this.canvas.removeEventListener("mouseleave", this.handleMouseLeave);
|
|
6977
7087
|
}
|
|
6978
7088
|
}
|
|
6979
|
-
const
|
|
7089
|
+
const Os = {
|
|
6980
7090
|
easeInOutQuad: (r) => r < 0.5 ? 2 * r * r : 1 - Math.pow(-2 * r + 2, 2) / 2
|
|
6981
7091
|
};
|
|
6982
|
-
class
|
|
7092
|
+
class Ls {
|
|
6983
7093
|
/**
|
|
6984
7094
|
* 创建时间轴引擎:会在构造后 `requestAnimationFrame` 初始化并开始渲染。
|
|
6985
7095
|
* @param id canvas DOM id
|
|
@@ -7025,13 +7135,13 @@ class Ms {
|
|
|
7025
7135
|
* 可用于叠加额外图形(如指示线、事件点等)
|
|
7026
7136
|
*/
|
|
7027
7137
|
d(this, "onDrawOverlay");
|
|
7028
|
-
this.canvasManager = new
|
|
7138
|
+
this.canvasManager = new ks(i), this.onMouseTimeChange = t, requestAnimationFrame(() => this.init());
|
|
7029
7139
|
}
|
|
7030
7140
|
/** 初始化交互:拖拽平移、滚轮缩放、鼠标时间通知,并触发首次绘制 */
|
|
7031
7141
|
init() {
|
|
7032
7142
|
if (!this.canvasManager.init(() => this.render())) return;
|
|
7033
7143
|
const t = this.canvasManager.getCanvas();
|
|
7034
|
-
t && (this.offsetDrag = new
|
|
7144
|
+
t && (this.offsetDrag = new Rs(
|
|
7035
7145
|
t,
|
|
7036
7146
|
(e) => {
|
|
7037
7147
|
this.currentTime -= Math.round(
|
|
@@ -7041,14 +7151,14 @@ class Ms {
|
|
|
7041
7151
|
() => {
|
|
7042
7152
|
this.stopCenterTimeAnimation();
|
|
7043
7153
|
}
|
|
7044
|
-
), this.wheelZoom = new
|
|
7154
|
+
), this.wheelZoom = new As(
|
|
7045
7155
|
t,
|
|
7046
7156
|
() => this.timeSpacing,
|
|
7047
7157
|
(e, s) => {
|
|
7048
7158
|
const n = this.getTimeAtCanvasX(s);
|
|
7049
7159
|
this.timeSpacing = e, this.setTimeAtCanvasX(n, s), this.render();
|
|
7050
7160
|
}
|
|
7051
|
-
), this.centerTime = Date.now(), this.mouseTimeReporter = new
|
|
7161
|
+
), this.centerTime = Date.now(), this.mouseTimeReporter = new Vs(
|
|
7052
7162
|
t,
|
|
7053
7163
|
(e) => this.getTimeAtCanvasX(e),
|
|
7054
7164
|
(e) => {
|
|
@@ -7092,7 +7202,7 @@ class Ms {
|
|
|
7092
7202
|
for (; y <= f; ) {
|
|
7093
7203
|
const w = p % o === 0, b = w ? a : l;
|
|
7094
7204
|
if (i.fillRect(y, 0, 1, b), w) {
|
|
7095
|
-
const P =
|
|
7205
|
+
const P = ai(g, "MM-DD hh:mm:ss");
|
|
7096
7206
|
i.fillText(P, y, c), g += t;
|
|
7097
7207
|
}
|
|
7098
7208
|
y += m, p++;
|
|
@@ -7147,8 +7257,8 @@ class Ms {
|
|
|
7147
7257
|
Math.max(0.5, h)
|
|
7148
7258
|
);
|
|
7149
7259
|
return Math.max(1, Math.round(u * 60));
|
|
7150
|
-
})(), a = (t == null ? void 0 : t.curve) ??
|
|
7151
|
-
|
|
7260
|
+
})(), a = (t == null ? void 0 : t.curve) ?? Os.easeInOutQuad;
|
|
7261
|
+
oi(
|
|
7152
7262
|
0,
|
|
7153
7263
|
1,
|
|
7154
7264
|
o,
|
|
@@ -7169,7 +7279,7 @@ class Ms {
|
|
|
7169
7279
|
(i = this.offsetDrag) == null || i.destroy(), (t = this.wheelZoom) == null || t.destroy(), (e = this.mouseTimeReporter) == null || e.destroy(), this.canvasManager.destroy();
|
|
7170
7280
|
}
|
|
7171
7281
|
}
|
|
7172
|
-
class
|
|
7282
|
+
class kn extends Ls {
|
|
7173
7283
|
/**
|
|
7174
7284
|
* 将填充样式解析为 ctx.fillStyle 可用的值(纯色或线性渐变)
|
|
7175
7285
|
* @param rect 矩形区域,用于计算渐变起止点
|
|
@@ -7214,6 +7324,161 @@ class vn extends Ms {
|
|
|
7214
7324
|
p && (t.fillStyle = p), h && (t.strokeStyle = h), t.lineWidth = u, t.beginPath(), typeof t.roundRect == "function" ? t.roundRect(f, o, g, a + o, l) : t.rect(f, o, g, a + o), c && t.fill(), h && t.stroke();
|
|
7215
7325
|
}
|
|
7216
7326
|
}
|
|
7327
|
+
const ye = {
|
|
7328
|
+
image: "image/",
|
|
7329
|
+
video: "video/",
|
|
7330
|
+
audio: "audio/",
|
|
7331
|
+
application: "application/"
|
|
7332
|
+
};
|
|
7333
|
+
function Oe(r) {
|
|
7334
|
+
return typeof r == "string" ? document.querySelector(r) : r;
|
|
7335
|
+
}
|
|
7336
|
+
function Ts(r) {
|
|
7337
|
+
return r.some(
|
|
7338
|
+
(i) => i === "text/plain" || i.startsWith("text/")
|
|
7339
|
+
);
|
|
7340
|
+
}
|
|
7341
|
+
function Is(r) {
|
|
7342
|
+
return r.includes("Files");
|
|
7343
|
+
}
|
|
7344
|
+
function Je(r) {
|
|
7345
|
+
return typeof r == "string" && (r.includes(".") || r.includes("/"));
|
|
7346
|
+
}
|
|
7347
|
+
function Ns(r, i) {
|
|
7348
|
+
if (!i) return !0;
|
|
7349
|
+
const t = i.split(",").map((n) => n.trim().toLowerCase()), e = r.name.toLowerCase(), s = r.type.toLowerCase();
|
|
7350
|
+
return t.some((n) => {
|
|
7351
|
+
if (n.startsWith("."))
|
|
7352
|
+
return e.endsWith(n);
|
|
7353
|
+
if (n.endsWith("/*")) {
|
|
7354
|
+
const o = n.replace("/*", "/");
|
|
7355
|
+
return s.startsWith(o);
|
|
7356
|
+
}
|
|
7357
|
+
return s === n;
|
|
7358
|
+
});
|
|
7359
|
+
}
|
|
7360
|
+
function ie(r, i) {
|
|
7361
|
+
return r ? (Array.isArray(r) ? r : [r]).some((e) => typeof e == "object" && e !== null && "matchTypes" in e ? e.matchTypes(i) : e === "text" ? Ts(i) : Je(e) || e === "file" || e in ye ? Is(i) : !1) : !0;
|
|
7362
|
+
}
|
|
7363
|
+
async function Hs(r, i) {
|
|
7364
|
+
if (!i) return [];
|
|
7365
|
+
const t = Array.from(i.files), e = Array.from(i.items);
|
|
7366
|
+
if (!r) return [...t, ...e];
|
|
7367
|
+
const s = Array.isArray(r) ? r : [r], n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
7368
|
+
for (const l of s)
|
|
7369
|
+
if (typeof l == "object" && l !== null && "matchItem" in l)
|
|
7370
|
+
e.forEach((c) => {
|
|
7371
|
+
if (l.matchItem(c))
|
|
7372
|
+
if (c.kind === "file") {
|
|
7373
|
+
const h = c.getAsFile();
|
|
7374
|
+
h && n.add(h);
|
|
7375
|
+
} else c.kind === "string" && o.add(c);
|
|
7376
|
+
});
|
|
7377
|
+
else if (l === "text")
|
|
7378
|
+
e.forEach((c) => {
|
|
7379
|
+
(c.type === "text/plain" || c.type.startsWith("text/")) && o.add(c);
|
|
7380
|
+
});
|
|
7381
|
+
else if (l === "file")
|
|
7382
|
+
t.forEach((c) => n.add(c));
|
|
7383
|
+
else if (Je(l))
|
|
7384
|
+
t.forEach((c) => {
|
|
7385
|
+
Ns(c, l) && n.add(c);
|
|
7386
|
+
});
|
|
7387
|
+
else if (l in ye) {
|
|
7388
|
+
const c = ye[l];
|
|
7389
|
+
t.forEach((h) => {
|
|
7390
|
+
h.type.startsWith(c) && n.add(h);
|
|
7391
|
+
});
|
|
7392
|
+
}
|
|
7393
|
+
const a = Array.from(n);
|
|
7394
|
+
if (o.size > 0) {
|
|
7395
|
+
const l = Array.from(o).map(
|
|
7396
|
+
(h) => new Promise((u) => h.getAsString(u))
|
|
7397
|
+
), c = await Promise.all(l);
|
|
7398
|
+
a.push(...c);
|
|
7399
|
+
}
|
|
7400
|
+
return a;
|
|
7401
|
+
}
|
|
7402
|
+
class Rn {
|
|
7403
|
+
constructor() {
|
|
7404
|
+
d(this, "entries", /* @__PURE__ */ new Map());
|
|
7405
|
+
d(this, "onDragEnter", (i) => {
|
|
7406
|
+
var o;
|
|
7407
|
+
const t = i.currentTarget, e = this.entries.get(t);
|
|
7408
|
+
if (!e) return;
|
|
7409
|
+
const s = i.dataTransfer ? Array.from(i.dataTransfer.types) : [], n = e.rules.filter(
|
|
7410
|
+
(a) => ie(a.targetType, s)
|
|
7411
|
+
);
|
|
7412
|
+
n.length !== 0 && (e.dragDepth += 1, e.dragDepth === 1 && (e.isActive = !0, (o = e.globalActiveCallback) == null || o.call(e, !0), n.forEach((a) => {
|
|
7413
|
+
var l;
|
|
7414
|
+
e.activeRules.add(a), (l = a.activeCallback) == null || l.call(a, !0);
|
|
7415
|
+
})));
|
|
7416
|
+
});
|
|
7417
|
+
d(this, "onDragLeave", (i) => {
|
|
7418
|
+
var s;
|
|
7419
|
+
const t = i.currentTarget, e = this.entries.get(t);
|
|
7420
|
+
e && (e.dragDepth = Math.max(0, e.dragDepth - 1), e.dragDepth === 0 && e.isActive && (e.isActive = !1, (s = e.globalActiveCallback) == null || s.call(e, !1), e.activeRules.forEach((n) => {
|
|
7421
|
+
var o;
|
|
7422
|
+
return (o = n.activeCallback) == null ? void 0 : o.call(n, !1);
|
|
7423
|
+
}), e.activeRules.clear()));
|
|
7424
|
+
});
|
|
7425
|
+
d(this, "onDragOver", (i) => {
|
|
7426
|
+
const t = i.currentTarget, e = this.entries.get(t);
|
|
7427
|
+
if (!e) return;
|
|
7428
|
+
const s = i.dataTransfer ? Array.from(i.dataTransfer.types) : [];
|
|
7429
|
+
e.rules.some(
|
|
7430
|
+
(o) => ie(o.targetType, s)
|
|
7431
|
+
) && (i.preventDefault(), i.dataTransfer && (i.dataTransfer.dropEffect = "copy"));
|
|
7432
|
+
});
|
|
7433
|
+
d(this, "onDrop", async (i) => {
|
|
7434
|
+
var o;
|
|
7435
|
+
const t = i.currentTarget, e = this.entries.get(t);
|
|
7436
|
+
if (!e) return;
|
|
7437
|
+
const s = i.dataTransfer ? Array.from(i.dataTransfer.types) : [], n = e.rules.filter(
|
|
7438
|
+
(a) => ie(a.targetType, s)
|
|
7439
|
+
);
|
|
7440
|
+
n.length !== 0 && (i.preventDefault(), e.dragDepth = 0, e.isActive = !1, (o = e.globalActiveCallback) == null || o.call(e, !1), e.activeRules.forEach((a) => {
|
|
7441
|
+
var l;
|
|
7442
|
+
return (l = a.activeCallback) == null ? void 0 : l.call(a, !1);
|
|
7443
|
+
}), e.activeRules.clear(), n.forEach(async (a) => {
|
|
7444
|
+
const l = await Hs(a.targetType, i.dataTransfer);
|
|
7445
|
+
a.dropCallback(l);
|
|
7446
|
+
}));
|
|
7447
|
+
});
|
|
7448
|
+
}
|
|
7449
|
+
extractRules(i) {
|
|
7450
|
+
if ("rules" in i && Array.isArray(i.rules))
|
|
7451
|
+
return i.rules;
|
|
7452
|
+
const t = i;
|
|
7453
|
+
return [
|
|
7454
|
+
{
|
|
7455
|
+
targetType: t.targetType,
|
|
7456
|
+
dropCallback: t.dropCallback,
|
|
7457
|
+
activeCallback: t.activeCallback
|
|
7458
|
+
}
|
|
7459
|
+
];
|
|
7460
|
+
}
|
|
7461
|
+
add(i) {
|
|
7462
|
+
const t = Oe(i.dom);
|
|
7463
|
+
if (!t || this.entries.has(t)) return;
|
|
7464
|
+
const e = this.extractRules(i);
|
|
7465
|
+
t.addEventListener("dragenter", this.onDragEnter), t.addEventListener("dragleave", this.onDragLeave), t.addEventListener("dragover", this.onDragOver), t.addEventListener("drop", this.onDrop), this.entries.set(t, {
|
|
7466
|
+
dom: t,
|
|
7467
|
+
rules: e,
|
|
7468
|
+
globalActiveCallback: i.activeCallback,
|
|
7469
|
+
dragDepth: 0,
|
|
7470
|
+
isActive: !1,
|
|
7471
|
+
activeRules: /* @__PURE__ */ new Set()
|
|
7472
|
+
});
|
|
7473
|
+
}
|
|
7474
|
+
delete(i) {
|
|
7475
|
+
const t = Oe(i);
|
|
7476
|
+
!t || !this.entries.has(t) || (t.removeEventListener("dragenter", this.onDragEnter), t.removeEventListener("dragleave", this.onDragLeave), t.removeEventListener("dragover", this.onDragOver), t.removeEventListener("drop", this.onDrop), this.entries.delete(t));
|
|
7477
|
+
}
|
|
7478
|
+
destroy() {
|
|
7479
|
+
this.entries.keys().forEach((i) => this.delete(i));
|
|
7480
|
+
}
|
|
7481
|
+
}
|
|
7217
7482
|
function Ot(r) {
|
|
7218
7483
|
if (typeof r == "string") {
|
|
7219
7484
|
const i = document.querySelector(r);
|
|
@@ -7223,35 +7488,35 @@ function Ot(r) {
|
|
|
7223
7488
|
} else
|
|
7224
7489
|
return r || document.documentElement;
|
|
7225
7490
|
}
|
|
7226
|
-
function
|
|
7491
|
+
function ti(r) {
|
|
7227
7492
|
const i = Ot(r);
|
|
7228
7493
|
return i ? i.requestFullscreen ? i.requestFullscreen() : i.mozRequestFullScreen ? i.mozRequestFullScreen() : i.webkitRequestFullscreen ? i.webkitRequestFullscreen() : i.msRequestFullscreen ? i.msRequestFullscreen() : Promise.reject("No Fullscreen API") : Promise.reject("No Element");
|
|
7229
7494
|
}
|
|
7230
|
-
function
|
|
7495
|
+
function ei() {
|
|
7231
7496
|
const r = document;
|
|
7232
7497
|
return document.exitFullscreen ? document.exitFullscreen() : r.mozCancelFullScreen ? r.mozCancelFullScreen() : r.webkitExitFullscreen ? r.webkitExitFullscreen() : r.msExitFullscreen ? r.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
|
|
7233
7498
|
}
|
|
7234
|
-
function
|
|
7499
|
+
function jt(r) {
|
|
7235
7500
|
const i = Ot(r), t = document, e = document.fullscreenElement || t.webkitFullscreenElement || t.mozFullScreenElement || t.msFullscreenElement;
|
|
7236
7501
|
return i == e || !r && window.innerWidth == screen.width && window.innerHeight == screen.height;
|
|
7237
7502
|
}
|
|
7238
|
-
function
|
|
7503
|
+
function An(r) {
|
|
7239
7504
|
if (r = Ot(r), !!r)
|
|
7240
7505
|
return function() {
|
|
7241
|
-
|
|
7506
|
+
jt(r) ? ei() : ti(r);
|
|
7242
7507
|
};
|
|
7243
7508
|
}
|
|
7244
|
-
function
|
|
7509
|
+
function Vn(r, i) {
|
|
7245
7510
|
const t = Ot(i);
|
|
7246
7511
|
if (!t) return;
|
|
7247
7512
|
const e = () => {
|
|
7248
|
-
r(
|
|
7513
|
+
r(jt(t));
|
|
7249
7514
|
};
|
|
7250
7515
|
return document.addEventListener("fullscreenchange", e), document.addEventListener("webkitfullscreenchange", e), document.addEventListener("mozfullscreenchange", e), document.addEventListener("MSFullscreenChange", e), e(), () => {
|
|
7251
7516
|
document.removeEventListener("fullscreenchange", e), document.removeEventListener("webkitfullscreenchange", e), document.removeEventListener("mozfullscreenchange", e), document.removeEventListener("MSFullscreenChange", e);
|
|
7252
7517
|
};
|
|
7253
7518
|
}
|
|
7254
|
-
class
|
|
7519
|
+
class On {
|
|
7255
7520
|
constructor(i, t) {
|
|
7256
7521
|
/** 要全屏展示的目标元素 */
|
|
7257
7522
|
d(this, "targetElement");
|
|
@@ -7271,19 +7536,19 @@ class xn {
|
|
|
7271
7536
|
}
|
|
7272
7537
|
/** 使目标元素进入浏览器全屏 */
|
|
7273
7538
|
enter() {
|
|
7274
|
-
this.targetElement &&
|
|
7539
|
+
this.targetElement && ti(this.targetElement);
|
|
7275
7540
|
}
|
|
7276
7541
|
/** 退出浏览器全屏(不区分由哪个元素进入) */
|
|
7277
7542
|
exit() {
|
|
7278
|
-
this.targetElement &&
|
|
7543
|
+
this.targetElement && ei();
|
|
7279
7544
|
}
|
|
7280
7545
|
/** 若当前已为该目标全屏则退出,否则进入全屏 */
|
|
7281
7546
|
toggle() {
|
|
7282
|
-
this.targetElement && (
|
|
7547
|
+
this.targetElement && (jt(this.targetElement) ? this.exit() : this.enter());
|
|
7283
7548
|
}
|
|
7284
7549
|
attachFullscreenChangeListeners() {
|
|
7285
7550
|
const i = () => {
|
|
7286
|
-
!this.targetElement || !this.onFullscreenChange || this.onFullscreenChange(
|
|
7551
|
+
!this.targetElement || !this.onFullscreenChange || this.onFullscreenChange(jt(this.targetElement));
|
|
7287
7552
|
};
|
|
7288
7553
|
document.addEventListener("fullscreenchange", i), document.addEventListener(
|
|
7289
7554
|
"webkitfullscreenchange",
|
|
@@ -7313,8 +7578,8 @@ class xn {
|
|
|
7313
7578
|
(i = this.detachFullscreenListeners) == null || i.call(this), this.detachFullscreenListeners = void 0, this.targetElement = void 0, this.onFullscreenChange = void 0;
|
|
7314
7579
|
}
|
|
7315
7580
|
}
|
|
7316
|
-
function
|
|
7317
|
-
const i =
|
|
7581
|
+
function Ln(r) {
|
|
7582
|
+
const i = ze(r, 100);
|
|
7318
7583
|
let t = 0, e = 0;
|
|
7319
7584
|
return function(s) {
|
|
7320
7585
|
const n = s.target;
|
|
@@ -7342,7 +7607,7 @@ function bn(r) {
|
|
|
7342
7607
|
f(), m();
|
|
7343
7608
|
};
|
|
7344
7609
|
}
|
|
7345
|
-
function
|
|
7610
|
+
function Tn(r, i, t) {
|
|
7346
7611
|
const { isClickAllowed: e, uiLibrary: s = ["naiveUI", "ElementPlus", "Element"] } = t || {}, n = function(l) {
|
|
7347
7612
|
const c = [];
|
|
7348
7613
|
for (const h in l)
|
|
@@ -7374,21 +7639,21 @@ function Pn(r, i, t) {
|
|
|
7374
7639
|
() => document.addEventListener("mousedown", a)
|
|
7375
7640
|
);
|
|
7376
7641
|
}
|
|
7377
|
-
var j,
|
|
7378
|
-
class
|
|
7642
|
+
var j, ft, mt, bt, Pt, Q, J, it, Ct;
|
|
7643
|
+
class In {
|
|
7379
7644
|
constructor() {
|
|
7380
7645
|
L(this, j);
|
|
7381
|
-
L(this,
|
|
7382
|
-
L(this,
|
|
7383
|
-
L(this, xt, 0);
|
|
7646
|
+
L(this, ft, !1);
|
|
7647
|
+
L(this, mt, {});
|
|
7384
7648
|
L(this, bt, 0);
|
|
7649
|
+
L(this, Pt, 0);
|
|
7385
7650
|
L(this, Q, 0);
|
|
7386
7651
|
L(this, J, 0);
|
|
7387
7652
|
L(this, it);
|
|
7388
|
-
L(this,
|
|
7653
|
+
L(this, Ct);
|
|
7389
7654
|
}
|
|
7390
7655
|
init(i, t) {
|
|
7391
|
-
this.finish(), M(this, j, i), M(this, it, t == null ? void 0 : t.limit), M(this,
|
|
7656
|
+
this.finish(), M(this, j, i), M(this, it, t == null ? void 0 : t.limit), M(this, Ct, t == null ? void 0 : t.dragDom), M(this, mt, {
|
|
7392
7657
|
mousedown: this.mousedown.bind(this),
|
|
7393
7658
|
mousemove: this.mousemove.bind(this),
|
|
7394
7659
|
mouseup: this.mouseup.bind(this)
|
|
@@ -7400,7 +7665,7 @@ class Cn {
|
|
|
7400
7665
|
bindOrUnbindEvent(i) {
|
|
7401
7666
|
const t = i === "bind" ? "addEventListener" : "removeEventListener";
|
|
7402
7667
|
if (!x(this, j)) return console.error("No DOM");
|
|
7403
|
-
x(this, j)[t]("mousedown", x(this,
|
|
7668
|
+
x(this, j)[t]("mousedown", x(this, mt).mousedown), document[t]("mousemove", x(this, mt).mousemove), document[t]("mouseup", x(this, mt).mouseup);
|
|
7404
7669
|
}
|
|
7405
7670
|
alterLocation() {
|
|
7406
7671
|
if (!x(this, j)) return console.error("No DOM");
|
|
@@ -7408,36 +7673,36 @@ class Cn {
|
|
|
7408
7673
|
}
|
|
7409
7674
|
mousedown(i) {
|
|
7410
7675
|
if (!x(this, j)) return console.error("No DOM");
|
|
7411
|
-
if (x(this,
|
|
7412
|
-
document.body.classList.add("no-select"), M(this,
|
|
7676
|
+
if (x(this, Ct) && i.target != x(this, Ct)) return;
|
|
7677
|
+
document.body.classList.add("no-select"), M(this, ft, !0);
|
|
7413
7678
|
const t = x(this, j).getBoundingClientRect(), { pageX: e, pageY: s } = i;
|
|
7414
|
-
M(this,
|
|
7679
|
+
M(this, bt, e), M(this, Pt, s), M(this, Q, t.y), M(this, J, t.x);
|
|
7415
7680
|
}
|
|
7416
7681
|
mousemove(i) {
|
|
7417
7682
|
const { pageX: t, pageY: e } = i;
|
|
7418
|
-
x(this,
|
|
7683
|
+
x(this, ft) && (M(this, Q, x(this, Q) + (e - x(this, Pt))), M(this, J, x(this, J) + (t - x(this, bt))), M(this, bt, t), M(this, Pt, e), this.alterLocation());
|
|
7419
7684
|
}
|
|
7420
7685
|
mouseup() {
|
|
7421
|
-
x(this,
|
|
7686
|
+
x(this, ft) && (M(this, ft, !1), document.body.classList.remove("no-select"));
|
|
7422
7687
|
}
|
|
7423
7688
|
}
|
|
7424
|
-
j = new WeakMap(),
|
|
7425
|
-
var W,
|
|
7426
|
-
class
|
|
7689
|
+
j = new WeakMap(), ft = new WeakMap(), mt = new WeakMap(), bt = new WeakMap(), Pt = new WeakMap(), Q = new WeakMap(), J = new WeakMap(), it = new WeakMap(), Ct = new WeakMap();
|
|
7690
|
+
var W, pt, gt, St, _t, q, K, B, Et, Mt;
|
|
7691
|
+
class Nn {
|
|
7427
7692
|
constructor() {
|
|
7428
7693
|
L(this, W);
|
|
7429
|
-
L(this,
|
|
7430
|
-
L(this,
|
|
7431
|
-
L(this, Ct, 0);
|
|
7694
|
+
L(this, pt, !1);
|
|
7695
|
+
L(this, gt, {});
|
|
7432
7696
|
L(this, St, 0);
|
|
7697
|
+
L(this, _t, 0);
|
|
7433
7698
|
L(this, q, 0);
|
|
7434
7699
|
L(this, K, 0);
|
|
7435
7700
|
L(this, B);
|
|
7436
|
-
L(this, _t);
|
|
7437
7701
|
L(this, Et);
|
|
7702
|
+
L(this, Mt);
|
|
7438
7703
|
}
|
|
7439
7704
|
init(i, t = {}) {
|
|
7440
|
-
this.finish(), M(this, W, i), M(this, B, t.limit), M(this,
|
|
7705
|
+
this.finish(), M(this, W, i), M(this, B, t.limit), M(this, Et, t.update_move), M(this, Mt, t.update_up), M(this, gt, {
|
|
7441
7706
|
mousedown: this.mousedown.bind(this),
|
|
7442
7707
|
mousemove: this.mousemove.bind(this),
|
|
7443
7708
|
mouseup: this.mouseup.bind(this)
|
|
@@ -7449,7 +7714,7 @@ class Sn {
|
|
|
7449
7714
|
bindOrUnbindEvent(i) {
|
|
7450
7715
|
const t = i === "bind" ? "addEventListener" : "removeEventListener";
|
|
7451
7716
|
if (!x(this, W)) return console.error("No DOM");
|
|
7452
|
-
x(this, W)[t]("mousedown", x(this,
|
|
7717
|
+
x(this, W)[t]("mousedown", x(this, gt).mousedown), document[t]("mousemove", x(this, gt).mousemove), document[t]("mouseup", x(this, gt).mouseup);
|
|
7453
7718
|
}
|
|
7454
7719
|
updateValue() {
|
|
7455
7720
|
const i = {
|
|
@@ -7468,26 +7733,26 @@ class Sn {
|
|
|
7468
7733
|
}
|
|
7469
7734
|
alterLocation() {
|
|
7470
7735
|
if (!x(this, W)) return console.error("No DOM");
|
|
7471
|
-
x(this, B) && (M(this, q, Math.min(x(this, q), x(this, B).max.top)), M(this, q, Math.max(x(this, q), x(this, B).min.top)), M(this, K, Math.min(x(this, K), x(this, B).max.left)), M(this, K, Math.max(x(this, K), x(this, B).min.left))), x(this,
|
|
7736
|
+
x(this, B) && (M(this, q, Math.min(x(this, q), x(this, B).max.top)), M(this, q, Math.max(x(this, q), x(this, B).min.top)), M(this, K, Math.min(x(this, K), x(this, B).max.left)), M(this, K, Math.max(x(this, K), x(this, B).min.left))), x(this, Et) && x(this, Et).call(this, this.updateValue()), x(this, W).style.setProperty("--top", x(this, q) + "px"), x(this, W).style.setProperty("--left", x(this, K) + "px");
|
|
7472
7737
|
}
|
|
7473
7738
|
mousedown(i) {
|
|
7474
7739
|
if (!x(this, W)) return console.error("No DOM");
|
|
7475
|
-
document.body.classList.add("no-select"), M(this,
|
|
7740
|
+
document.body.classList.add("no-select"), M(this, pt, !0);
|
|
7476
7741
|
const t = x(this, W).getBoundingClientRect();
|
|
7477
|
-
M(this,
|
|
7742
|
+
M(this, _t, t.y), M(this, St, t.x);
|
|
7478
7743
|
const { pageX: e, pageY: s } = i;
|
|
7479
|
-
M(this, q, s - x(this,
|
|
7744
|
+
M(this, q, s - x(this, _t)), M(this, K, e - x(this, St)), this.alterLocation();
|
|
7480
7745
|
}
|
|
7481
7746
|
mousemove(i) {
|
|
7482
7747
|
const { pageX: t, pageY: e } = i;
|
|
7483
|
-
x(this,
|
|
7748
|
+
x(this, pt) && (M(this, q, e - x(this, _t)), M(this, K, t - x(this, St)), this.alterLocation());
|
|
7484
7749
|
}
|
|
7485
7750
|
mouseup() {
|
|
7486
|
-
x(this,
|
|
7751
|
+
x(this, pt) && (M(this, pt, !1), document.body.classList.remove("no-select"), x(this, Mt) && x(this, Mt).call(this, this.updateValue()));
|
|
7487
7752
|
}
|
|
7488
7753
|
}
|
|
7489
|
-
W = new WeakMap(),
|
|
7490
|
-
function
|
|
7754
|
+
W = new WeakMap(), pt = new WeakMap(), gt = new WeakMap(), St = new WeakMap(), _t = new WeakMap(), q = new WeakMap(), K = new WeakMap(), B = new WeakMap(), Et = new WeakMap(), Mt = new WeakMap();
|
|
7755
|
+
function Hn(r, i) {
|
|
7491
7756
|
if (typeof r == "number") return r;
|
|
7492
7757
|
if (/px/.test(r)) return Number(r.replace(/px/, "")) || 0;
|
|
7493
7758
|
const t = document.createElement("div");
|
|
@@ -7495,7 +7760,7 @@ function _n(r, i) {
|
|
|
7495
7760
|
const e = t.getBoundingClientRect().width;
|
|
7496
7761
|
return i.removeChild(t), e;
|
|
7497
7762
|
}
|
|
7498
|
-
function
|
|
7763
|
+
function Fn(r, i) {
|
|
7499
7764
|
if (!r) return;
|
|
7500
7765
|
let t, e;
|
|
7501
7766
|
if (typeof i == "string") {
|
|
@@ -7512,7 +7777,7 @@ function En(r, i) {
|
|
|
7512
7777
|
const s = t / e;
|
|
7513
7778
|
return s > r ? [r * e, e] : s < r ? [t, t / r] : [t, e];
|
|
7514
7779
|
}
|
|
7515
|
-
function
|
|
7780
|
+
function zn(r, i = 5e3) {
|
|
7516
7781
|
return new Promise((t, e) => {
|
|
7517
7782
|
const s = new Image();
|
|
7518
7783
|
s.src = r;
|
|
@@ -7528,7 +7793,7 @@ function Mn(r, i = 5e3) {
|
|
|
7528
7793
|
}, s.crossOrigin = "Anonymous";
|
|
7529
7794
|
});
|
|
7530
7795
|
}
|
|
7531
|
-
function
|
|
7796
|
+
function Bn(r) {
|
|
7532
7797
|
const t = document.getElementById(r).querySelectorAll("img"), e = t.length, s = [];
|
|
7533
7798
|
let n = 0;
|
|
7534
7799
|
return e === 0 ? Promise.resolve({
|
|
@@ -7570,14 +7835,14 @@ function Dn(r) {
|
|
|
7570
7835
|
});
|
|
7571
7836
|
});
|
|
7572
7837
|
}
|
|
7573
|
-
function
|
|
7838
|
+
function Un(r) {
|
|
7574
7839
|
return new Promise((i, t) => {
|
|
7575
7840
|
fetch(r).then((e) => i(e.text())).catch((e) => {
|
|
7576
7841
|
console.error("Error fetching :", e), t(e);
|
|
7577
7842
|
});
|
|
7578
7843
|
});
|
|
7579
7844
|
}
|
|
7580
|
-
function
|
|
7845
|
+
function Gn(r) {
|
|
7581
7846
|
const i = document.createElement("input");
|
|
7582
7847
|
return i.type = "file", i.accept = (r == null ? void 0 : r.accept) || "", i.multiple = (r == null ? void 0 : r.multiple) || !1, new Promise((t, e) => {
|
|
7583
7848
|
i.addEventListener("change", (s) => {
|
|
@@ -7586,7 +7851,7 @@ function Rn(r) {
|
|
|
7586
7851
|
}), i.click();
|
|
7587
7852
|
});
|
|
7588
7853
|
}
|
|
7589
|
-
function
|
|
7854
|
+
function Fs(r) {
|
|
7590
7855
|
const {
|
|
7591
7856
|
href: i,
|
|
7592
7857
|
fileName: t,
|
|
@@ -7595,7 +7860,7 @@ function Ds(r) {
|
|
|
7595
7860
|
autoDownload: n = !0
|
|
7596
7861
|
} = r;
|
|
7597
7862
|
let o, a = !1, l = null, c;
|
|
7598
|
-
const h = t ||
|
|
7863
|
+
const h = t || ne(i, "downloaded_file");
|
|
7599
7864
|
c = decodeURIComponent(h);
|
|
7600
7865
|
const u = () => {
|
|
7601
7866
|
if (!l) return;
|
|
@@ -7625,24 +7890,24 @@ function Ds(r) {
|
|
|
7625
7890
|
!a && l && u();
|
|
7626
7891
|
} };
|
|
7627
7892
|
}
|
|
7628
|
-
function
|
|
7893
|
+
function Xn(r, i, t) {
|
|
7629
7894
|
if (!t) {
|
|
7630
7895
|
let n = i.replace(/^[^.]+./, "");
|
|
7631
7896
|
n = n == i ? "text/plain" : "application/" + n, t = { type: n };
|
|
7632
7897
|
}
|
|
7633
7898
|
const e = new Blob(r, t), s = URL.createObjectURL(e);
|
|
7634
|
-
|
|
7899
|
+
Fs({ href: s, fileName: i });
|
|
7635
7900
|
}
|
|
7636
|
-
const
|
|
7637
|
-
function
|
|
7638
|
-
const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(i,
|
|
7901
|
+
const zs = Math.PI / 2, Wt = Math.PI / 180, qt = 6378137, Bs = 85.05112878;
|
|
7902
|
+
function Le(r, i) {
|
|
7903
|
+
const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(i, Bs), -85.05112878), s = t * Wt * qt, n = e * Wt, o = Math.log(Math.tan(Math.PI / 4 + n / 2)) * qt;
|
|
7639
7904
|
return [s, o];
|
|
7640
7905
|
}
|
|
7641
|
-
function
|
|
7642
|
-
const t = r /
|
|
7906
|
+
function Yn(r, i) {
|
|
7907
|
+
const t = r / qt / Wt, e = (2 * Math.atan(Math.exp(i / qt)) - zs) / Wt;
|
|
7643
7908
|
return [t, e];
|
|
7644
7909
|
}
|
|
7645
|
-
function
|
|
7910
|
+
function Us(r, i, t) {
|
|
7646
7911
|
const [e, s] = r, [n, o] = i, [a, l] = t, c = (a - n) ** 2 + (l - o) ** 2;
|
|
7647
7912
|
if (c === 0) return Math.sqrt((e - n) ** 2 + (s - o) ** 2);
|
|
7648
7913
|
let h = ((e - n) * (a - n) + (s - o) * (l - o)) / c;
|
|
@@ -7650,21 +7915,25 @@ function Vs(r, i, t) {
|
|
|
7650
7915
|
(e - (n + h * (a - n))) ** 2 + (s - (o + h * (l - o))) ** 2
|
|
7651
7916
|
);
|
|
7652
7917
|
}
|
|
7653
|
-
function
|
|
7918
|
+
function $n(r, i, t, e, s, n = 1, o = 1) {
|
|
7654
7919
|
const a = r + t * Math.cos(e) * n, l = i + t * Math.sin(e) * o, c = r + t * Math.cos(s) * n, h = i + t * Math.sin(s) * o;
|
|
7655
7920
|
return [
|
|
7656
7921
|
[a, l],
|
|
7657
7922
|
[c, h]
|
|
7658
7923
|
];
|
|
7659
7924
|
}
|
|
7660
|
-
function
|
|
7925
|
+
function jn(r, i, t, e) {
|
|
7926
|
+
const [s, n] = Le(r, i), [o, a] = Le(t, e);
|
|
7927
|
+
return we(s, n, o, a);
|
|
7928
|
+
}
|
|
7929
|
+
function we(r, i, t, e) {
|
|
7661
7930
|
return Math.hypot(Math.abs(t - r), Math.abs(e - i));
|
|
7662
7931
|
}
|
|
7663
|
-
function
|
|
7932
|
+
function ii(r, i, t, e) {
|
|
7664
7933
|
const s = (r + t) / 2, n = (i + e) / 2;
|
|
7665
7934
|
return { x: s, y: n };
|
|
7666
7935
|
}
|
|
7667
|
-
function
|
|
7936
|
+
function Wn(r, i, t, e) {
|
|
7668
7937
|
const [s, n] = r, [o, a] = i;
|
|
7669
7938
|
let l = 1 / 0;
|
|
7670
7939
|
if (o !== 0) {
|
|
@@ -7677,7 +7946,7 @@ function Tn(r, i, t, e) {
|
|
|
7677
7946
|
}
|
|
7678
7947
|
return l === 1 / 0 ? r : [s + o * l, n + a * l];
|
|
7679
7948
|
}
|
|
7680
|
-
const
|
|
7949
|
+
const Gs = /* @__PURE__ */ new Set([
|
|
7681
7950
|
"sin",
|
|
7682
7951
|
"cos",
|
|
7683
7952
|
"tan",
|
|
@@ -7685,9 +7954,9 @@ const Os = /* @__PURE__ */ new Set([
|
|
|
7685
7954
|
"acos",
|
|
7686
7955
|
"atan",
|
|
7687
7956
|
"atan2"
|
|
7688
|
-
]),
|
|
7957
|
+
]), qn = new Proxy(Math, {
|
|
7689
7958
|
get(r, i) {
|
|
7690
|
-
return
|
|
7959
|
+
return Gs.has(i) ? function(...t) {
|
|
7691
7960
|
const e = t.map((s) => s / 180 * Math.PI);
|
|
7692
7961
|
return r[i](...e);
|
|
7693
7962
|
} : r[i];
|
|
@@ -7701,28 +7970,59 @@ const Os = /* @__PURE__ */ new Set([
|
|
|
7701
7970
|
throw new Error("DegreeMath 是只读的,不能删除属性");
|
|
7702
7971
|
}
|
|
7703
7972
|
});
|
|
7704
|
-
function
|
|
7973
|
+
function Kn(r, i) {
|
|
7705
7974
|
const t = r.length;
|
|
7706
|
-
if (t === 0) return [0, 0];
|
|
7707
|
-
if (t === 1) return [r[0][0], r[0][1]];
|
|
7975
|
+
if (t === 0) return [0, 0, 0];
|
|
7976
|
+
if (t === 1) return [r[0][0], r[0][1], 0];
|
|
7708
7977
|
const e = i;
|
|
7709
|
-
let s = r.map((
|
|
7710
|
-
for (; s.length >
|
|
7711
|
-
const
|
|
7712
|
-
for (let
|
|
7713
|
-
|
|
7714
|
-
(1 - e) * s[
|
|
7715
|
-
(1 - e) * s[
|
|
7978
|
+
let s = r.map((f) => [f[0], f[1]]);
|
|
7979
|
+
for (; s.length > 2; ) {
|
|
7980
|
+
const f = [];
|
|
7981
|
+
for (let m = 0; m < s.length - 1; m++)
|
|
7982
|
+
f.push([
|
|
7983
|
+
(1 - e) * s[m][0] + e * s[m + 1][0],
|
|
7984
|
+
(1 - e) * s[m][1] + e * s[m + 1][1]
|
|
7716
7985
|
]);
|
|
7717
|
-
s =
|
|
7986
|
+
s = f;
|
|
7718
7987
|
}
|
|
7719
|
-
|
|
7988
|
+
const n = s[0], o = s[1], a = (1 - e) * n[0] + e * o[0], l = (1 - e) * n[1] + e * o[1], c = o[0] - n[0], h = o[1] - n[1], u = Math.atan2(h, c);
|
|
7989
|
+
return [a, l, u];
|
|
7720
7990
|
}
|
|
7721
|
-
function
|
|
7991
|
+
function Zn(r, i, t) {
|
|
7722
7992
|
const e = Math.abs(r) || 1, s = i * Math.PI * 2, n = e * Math.cos(s), o = Math.sin(s);
|
|
7723
7993
|
return t ? [(n + e) / (2 * e), (o + 1) / 2] : [n, o];
|
|
7724
7994
|
}
|
|
7725
|
-
|
|
7995
|
+
function Qn(r, i, t) {
|
|
7996
|
+
return Math.min(Math.max(r, i), t);
|
|
7997
|
+
}
|
|
7998
|
+
function Xs(r, i, t) {
|
|
7999
|
+
return r + (i - r) * t;
|
|
8000
|
+
}
|
|
8001
|
+
function Ys(r, i, t) {
|
|
8002
|
+
return r === i ? 0 : (t - r) / (i - r);
|
|
8003
|
+
}
|
|
8004
|
+
function Jn(r, i, t, e, s) {
|
|
8005
|
+
const n = Ys(i, t, r);
|
|
8006
|
+
return Xs(e, s, n);
|
|
8007
|
+
}
|
|
8008
|
+
function tr(r) {
|
|
8009
|
+
return r / 180 * Math.PI;
|
|
8010
|
+
}
|
|
8011
|
+
function er(r) {
|
|
8012
|
+
return r / Math.PI * 180;
|
|
8013
|
+
}
|
|
8014
|
+
function ir(r, i = !1) {
|
|
8015
|
+
let t = r % 360;
|
|
8016
|
+
return t < 0 && (t += 360), i && t >= 180 && (t -= 360), t;
|
|
8017
|
+
}
|
|
8018
|
+
function sr(r, i, t, e, s, n) {
|
|
8019
|
+
return r >= t && r <= t + s && i >= e && i <= e + n;
|
|
8020
|
+
}
|
|
8021
|
+
function nr(r, i, t, e, s) {
|
|
8022
|
+
const n = r - t, o = i - e;
|
|
8023
|
+
return n * n + o * o <= s * s;
|
|
8024
|
+
}
|
|
8025
|
+
class xt {
|
|
7726
8026
|
constructor(i, t) {
|
|
7727
8027
|
d(this, "resolve");
|
|
7728
8028
|
d(this, "reject");
|
|
@@ -7739,42 +8039,42 @@ class wt {
|
|
|
7739
8039
|
}) : i ? (t = this.resolve) == null || t.call(this) : (e = this.reject) == null || e.call(this), i;
|
|
7740
8040
|
}
|
|
7741
8041
|
}
|
|
7742
|
-
class
|
|
8042
|
+
class $s extends xt {
|
|
7743
8043
|
constructor(i) {
|
|
7744
8044
|
super(), this.resolve = i;
|
|
7745
8045
|
}
|
|
7746
8046
|
warning(...i) {
|
|
7747
8047
|
const t = () => {
|
|
7748
8048
|
var e, s;
|
|
7749
|
-
return (s = (e =
|
|
8049
|
+
return (s = (e = kt.tips).warning) == null ? void 0 : s.call(e, ...i);
|
|
7750
8050
|
};
|
|
7751
|
-
return new
|
|
8051
|
+
return new xt(this.resolve, t);
|
|
7752
8052
|
}
|
|
7753
8053
|
error(...i) {
|
|
7754
8054
|
const t = () => {
|
|
7755
8055
|
var e, s;
|
|
7756
|
-
return (s = (e =
|
|
8056
|
+
return (s = (e = kt.tips).error) == null ? void 0 : s.call(e, ...i);
|
|
7757
8057
|
};
|
|
7758
|
-
return new
|
|
8058
|
+
return new xt(this.resolve, t);
|
|
7759
8059
|
}
|
|
7760
8060
|
}
|
|
7761
|
-
class
|
|
8061
|
+
class js extends xt {
|
|
7762
8062
|
constructor(i) {
|
|
7763
8063
|
super(), this.reject = i;
|
|
7764
8064
|
}
|
|
7765
8065
|
info(...i) {
|
|
7766
8066
|
const t = () => {
|
|
7767
8067
|
var e, s;
|
|
7768
|
-
return (s = (e =
|
|
8068
|
+
return (s = (e = kt.tips).info) == null ? void 0 : s.call(e, ...i);
|
|
7769
8069
|
};
|
|
7770
|
-
return new
|
|
8070
|
+
return new xt(t, this.reject);
|
|
7771
8071
|
}
|
|
7772
8072
|
success(...i) {
|
|
7773
8073
|
const t = () => {
|
|
7774
8074
|
var e, s;
|
|
7775
|
-
return (s = (e =
|
|
8075
|
+
return (s = (e = kt.tips).success) == null ? void 0 : s.call(e, ...i);
|
|
7776
8076
|
};
|
|
7777
|
-
return new
|
|
8077
|
+
return new xt(t, this.reject);
|
|
7778
8078
|
}
|
|
7779
8079
|
}
|
|
7780
8080
|
const z = class z {
|
|
@@ -7791,7 +8091,7 @@ const z = class z {
|
|
|
7791
8091
|
var s, n;
|
|
7792
8092
|
return (n = (s = z.tips)[i]) == null ? void 0 : n.call(s, ...t);
|
|
7793
8093
|
};
|
|
7794
|
-
return new
|
|
8094
|
+
return new $s(e);
|
|
7795
8095
|
};
|
|
7796
8096
|
}
|
|
7797
8097
|
static rejectTip(i) {
|
|
@@ -7800,7 +8100,7 @@ const z = class z {
|
|
|
7800
8100
|
var s, n;
|
|
7801
8101
|
return (n = (s = z.tips)[i]) == null ? void 0 : n.call(s, ...t);
|
|
7802
8102
|
};
|
|
7803
|
-
return new
|
|
8103
|
+
return new js(e);
|
|
7804
8104
|
};
|
|
7805
8105
|
}
|
|
7806
8106
|
};
|
|
@@ -7810,91 +8110,102 @@ d(z, "tips", {
|
|
|
7810
8110
|
warning: void 0,
|
|
7811
8111
|
error: void 0
|
|
7812
8112
|
}), d(z, "info", z.resolveTip("info")), d(z, "success", z.resolveTip("success")), d(z, "warning", z.rejectTip("warning")), d(z, "error", z.rejectTip("error"));
|
|
7813
|
-
let
|
|
8113
|
+
let kt = z;
|
|
7814
8114
|
export {
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
8115
|
+
ri as EXTENSION_TO_MIME,
|
|
8116
|
+
te as FILE_EXTENSIONS,
|
|
8117
|
+
Te as PAPER_SIZE_DEFINITIONS,
|
|
8118
|
+
Ks as PAPER_SIZE_OPTIONS,
|
|
8119
|
+
Se as UNIT_LABELS,
|
|
8120
|
+
qs as WINDOW_TARGET,
|
|
8121
|
+
Zs as _Animate_CreateOscillator,
|
|
8122
|
+
Qs as _Animate_CubicBezier,
|
|
8123
|
+
oi as _Animate_NumericTransition,
|
|
8124
|
+
Ut as _Animate_Schedule,
|
|
8125
|
+
Js as _Blob_ConvertDataToImageUrl,
|
|
8126
|
+
En as _Browser_CalculatePrintableArea,
|
|
8127
|
+
_n as _Browser_CopyToClipboard,
|
|
8128
|
+
Sn as _Browser_GetFrameRate,
|
|
8129
|
+
Mn as _Browser_IdleDetection,
|
|
8130
|
+
Ht as _Browser_SameOriginTabManager,
|
|
8131
|
+
Pn as _Browser_SoundEffects,
|
|
8132
|
+
Cn as _Browser_WebSocketClient,
|
|
7833
8133
|
T as _Canvas_Axis,
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
|
|
7871
|
-
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
8134
|
+
kn as _Canvas_TimeAxis,
|
|
8135
|
+
Fn as _Element_CalculateCanvasSize,
|
|
8136
|
+
Bn as _Element_CheckImagesLoaded,
|
|
8137
|
+
Tn as _Element_CloseOnOutsideClick,
|
|
8138
|
+
In as _Element_Drag,
|
|
8139
|
+
Rn as _Element_DropZoneManager,
|
|
8140
|
+
ti as _Element_EnterFullscreen,
|
|
8141
|
+
ei as _Element_ExitFullscreen,
|
|
8142
|
+
An as _Element_Fullscreen,
|
|
8143
|
+
On as _Element_FullscreenController,
|
|
8144
|
+
Vn as _Element_FullscreenObserver,
|
|
8145
|
+
Hn as _Element_GetOtherSizeInPixels,
|
|
8146
|
+
jt as _Element_IsFullscreen,
|
|
8147
|
+
zn as _Element_LoadImage,
|
|
8148
|
+
Nn as _Element_LocalDrag,
|
|
8149
|
+
Ln as _Element_ScrollEndListener,
|
|
8150
|
+
Xn as _File_CreateAndDownload,
|
|
8151
|
+
Fs as _File_Download,
|
|
8152
|
+
Un as _File_Read,
|
|
8153
|
+
Gn as _File_Select,
|
|
8154
|
+
rn as _Format_CamelCase,
|
|
8155
|
+
tn as _Format_CapitalizeFirstLetter,
|
|
8156
|
+
cn as _Format_ChunkArray,
|
|
8157
|
+
on as _Format_ExcludeSubstring,
|
|
8158
|
+
nn as _Format_FileSize,
|
|
8159
|
+
ne as _Format_HrefName,
|
|
8160
|
+
ln as _Format_MillisecondToReadable,
|
|
8161
|
+
se as _Format_NumberWithCommas,
|
|
8162
|
+
sn as _Format_NumberWithUnit,
|
|
8163
|
+
en as _Format_Percentage,
|
|
8164
|
+
ai as _Format_Timestamp,
|
|
8165
|
+
an as _Format_ToggleInvisibleChars,
|
|
8166
|
+
we as _Math_CalculateDistance2D,
|
|
8167
|
+
jn as _Math_CalculateDistanceLngLat,
|
|
8168
|
+
Qn as _Math_Clamp,
|
|
8169
|
+
tr as _Math_DegToRad,
|
|
8170
|
+
qn as _Math_Degree,
|
|
8171
|
+
$n as _Math_GetArcPoints,
|
|
8172
|
+
Kn as _Math_GetBezierCurveNodes,
|
|
8173
|
+
Wn as _Math_GetBoundaryIntersection,
|
|
8174
|
+
Zn as _Math_GetEllipsePoints,
|
|
8175
|
+
ii as _Math_GetMidpoint,
|
|
8176
|
+
Ys as _Math_InverseLerp,
|
|
8177
|
+
nr as _Math_IsPointInCircle,
|
|
8178
|
+
sr as _Math_IsPointInRect,
|
|
8179
|
+
Xs as _Math_Lerp,
|
|
8180
|
+
Le as _Math_LngLatToPlane,
|
|
8181
|
+
ir as _Math_NormalizeAngle,
|
|
8182
|
+
Yn as _Math_PlaneToLngLat,
|
|
8183
|
+
Us as _Math_PointToLineDistance,
|
|
8184
|
+
er as _Math_RadToDeg,
|
|
8185
|
+
Jn as _Math_Remap,
|
|
8186
|
+
kt as _Tip,
|
|
8187
|
+
di as _Utility_Clone,
|
|
8188
|
+
hi as _Utility_ColorConverter,
|
|
8189
|
+
ze as _Utility_Debounce,
|
|
8190
|
+
gn as _Utility_ExecuteWhenIdle,
|
|
8191
|
+
oe as _Utility_GenerateUUID,
|
|
8192
|
+
yn as _Utility_GetTargetByPath,
|
|
8193
|
+
ct as _Utility_MergeObjects,
|
|
8194
|
+
xn as _Utility_RotateList,
|
|
8195
|
+
wn as _Utility_SetTargetByPath,
|
|
8196
|
+
Ee as _Utility_ShortcutManager,
|
|
8197
|
+
bn as _Utility_Sleep,
|
|
8198
|
+
vn as _Utility_Throttle,
|
|
8199
|
+
fi as _Utility_TimeConsumption,
|
|
8200
|
+
pn as _Utility_UndoRedoHistory,
|
|
8201
|
+
ui as _Utility_WaitForCondition,
|
|
8202
|
+
mn as _Valid_CheckConnectionWithXHR,
|
|
8203
|
+
re as _Valid_DataType,
|
|
8204
|
+
dn as _Valid_DoesInfiniteLineIntersectRectangle,
|
|
8205
|
+
_e as _Valid_FileTypeChecker,
|
|
8206
|
+
Gt as _Valid_Is2DNumberArray,
|
|
8207
|
+
hn as _Valid_IsInMargin,
|
|
8208
|
+
xe as _Valid_IsNumberArray,
|
|
8209
|
+
un as _Valid_IsPointInPolygon,
|
|
8210
|
+
fn as _Valid_IsSecureContext
|
|
7900
8211
|
};
|