nhanh-pure-function 4.2.4 → 4.3.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 +1 -1
- package/dist/Canvas/Axis/LayerGroup/index.d.ts +3 -1
- package/dist/Canvas/Axis/LayerGroup/layer.d.ts +2 -0
- package/dist/Canvas/Axis/OverlayGroup/arc.d.ts +1 -1
- package/dist/Canvas/Axis/OverlayGroup/arcTo.d.ts +1 -1
- package/dist/Canvas/Axis/OverlayGroup/billboard.d.ts +1 -1
- package/dist/Canvas/Axis/OverlayGroup/index.d.ts +2 -0
- package/dist/Canvas/Axis/OverlayGroup/point.d.ts +1 -1
- package/dist/Canvas/Axis/OverlayGroup/public/geometricBoundary.d.ts +1 -1
- package/dist/Canvas/Axis/OverlayGroup/public/overlay.d.ts +2 -0
- package/dist/Canvas/Axis/OverlayGroup/text.d.ts +1 -1
- package/dist/Canvas/Axis/core/basedata.d.ts +2 -0
- package/dist/Canvas/Axis/core/event.d.ts +14 -4
- package/dist/Canvas/Axis/index.d.ts +1 -0
- package/dist/Canvas/Axis/public/basedata.d.ts +4 -0
- package/dist/Canvas/Axis/public/eventController.d.ts +4 -4
- package/dist/Math/index.d.ts +7 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +461 -408
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
2
|
var Ze = Object.defineProperty;
|
|
3
|
-
var
|
|
3
|
+
var ye = (r) => {
|
|
4
4
|
throw TypeError(r);
|
|
5
5
|
};
|
|
6
6
|
var Qe = (r, s, t) => s in r ? Ze(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
7
|
-
var d = (r, s, t) => Qe(r, typeof s != "symbol" ? s + "" : s, t),
|
|
8
|
-
var x = (r, s, t) => (
|
|
7
|
+
var d = (r, s, t) => Qe(r, typeof s != "symbol" ? s + "" : s, t), we = (r, s, t) => s.has(r) || ye("Cannot " + t);
|
|
8
|
+
var x = (r, s, t) => (we(r, s, "read from private field"), t ? t.call(r) : s.get(r)), L = (r, s, t) => s.has(r) ? ye("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), M = (r, s, t, e) => (we(r, s, "write to private field"), e ? e.call(r, t) : s.set(r, t), t);
|
|
9
9
|
const Je = {
|
|
10
10
|
".mp3": "audio/mpeg",
|
|
11
11
|
".mp4": "video/mp4",
|
|
@@ -68,7 +68,7 @@ const Je = {
|
|
|
68
68
|
".otf": "font/otf",
|
|
69
69
|
".eot": "application/vnd.ms-fontobject",
|
|
70
70
|
".map": "application/json"
|
|
71
|
-
},
|
|
71
|
+
}, Kt = {
|
|
72
72
|
image: [
|
|
73
73
|
".jpg",
|
|
74
74
|
".jpeg",
|
|
@@ -248,7 +248,7 @@ const Je = {
|
|
|
248
248
|
".awk",
|
|
249
249
|
".php"
|
|
250
250
|
]
|
|
251
|
-
},
|
|
251
|
+
}, xe = [
|
|
252
252
|
"",
|
|
253
253
|
"万",
|
|
254
254
|
"亿",
|
|
@@ -262,7 +262,7 @@ const Je = {
|
|
|
262
262
|
"正",
|
|
263
263
|
"载",
|
|
264
264
|
"极"
|
|
265
|
-
], Ts = ["_self", "_blank", "_parent", "_top"],
|
|
265
|
+
], Ts = ["_self", "_blank", "_parent", "_top"], Re = {
|
|
266
266
|
// 北美标准尺寸 (毫米)
|
|
267
267
|
Letter: { width: 215.9, height: 279.4 },
|
|
268
268
|
// 8.5 × 11 英寸
|
|
@@ -315,10 +315,10 @@ const Je = {
|
|
|
315
315
|
C6: { width: 114, height: 162 },
|
|
316
316
|
C7: { width: 81, height: 114 },
|
|
317
317
|
C8: { width: 57, height: 81 }
|
|
318
|
-
}, Is = Object.keys(
|
|
318
|
+
}, Is = Object.keys(Re).map(
|
|
319
319
|
(r) => ({ value: r, label: r })
|
|
320
320
|
);
|
|
321
|
-
function
|
|
321
|
+
function Bt(r, s = 500) {
|
|
322
322
|
let t, e = !0;
|
|
323
323
|
function i(n) {
|
|
324
324
|
if (!e) return;
|
|
@@ -328,19 +328,19 @@ function Wt(r, s = 500) {
|
|
|
328
328
|
}
|
|
329
329
|
return requestAnimationFrame(i), () => e = !1;
|
|
330
330
|
}
|
|
331
|
-
function Ns(r, s, t, e, i =
|
|
331
|
+
function Ns(r, s, t, e, i = 4) {
|
|
332
332
|
let n = r, o = !1, a = 1, l = r, c = s, h = t;
|
|
333
333
|
const u = () => {
|
|
334
334
|
const P = (c - l) / h;
|
|
335
335
|
return Number(P.toFixed(i));
|
|
336
336
|
};
|
|
337
337
|
let f = u();
|
|
338
|
-
const m = (P) => Math.min(Math.max(P, l), c), p = (P) => Number(P.toFixed(i)), g = (P, b,
|
|
339
|
-
const
|
|
340
|
-
return P >= b &&
|
|
341
|
-
}, y = (P, b,
|
|
342
|
-
const
|
|
343
|
-
return
|
|
338
|
+
const m = (P) => Math.min(Math.max(P, l), c), p = (P) => Number(P.toFixed(i)), g = (P, b, E) => {
|
|
339
|
+
const A = [];
|
|
340
|
+
return P >= b && A.push("最小值必须小于最大值"), E <= 0 ? A.push("分段数必须为正数") : u() == 0 && A.push("数值精度过低,致使动画步长为 0"), A;
|
|
341
|
+
}, y = (P, b, E) => {
|
|
342
|
+
const A = g(P, b, E);
|
|
343
|
+
return A.length > 0 ? (console.error(`参数更新失败: ${A.join("; ")}`), !1) : (l = P, c = b, h = E, f = u(), n = m(n), !0);
|
|
344
344
|
}, w = () => {
|
|
345
345
|
o && (a = n >= c ? -1 : n <= l ? 1 : a, n = m(n + f * a), e(p(n)), requestAnimationFrame(w));
|
|
346
346
|
};
|
|
@@ -447,7 +447,7 @@ function zs(r) {
|
|
|
447
447
|
function Bs(r, s, t = 2) {
|
|
448
448
|
return !Number.isFinite(r) || !Number.isFinite(s) || !Number.isFinite(t) ? (console.error("所有参数必须是有限的数字"), "") : s === 0 ? (console.error("分母不能为零"), "") : t < 0 ? (console.error("小数位数不能为负数"), "") : (r / s * 100).toFixed(t) + "%";
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function ee(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
|
}
|
|
@@ -462,7 +462,7 @@ function Us(r, s) {
|
|
|
462
462
|
}, o = Number(r);
|
|
463
463
|
if (isNaN(o)) return e ? `0${i}` : [0, i];
|
|
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}${xe[c]}${i}` : [f, xe[c] + i];
|
|
466
466
|
}
|
|
467
467
|
function Gs(r) {
|
|
468
468
|
const s = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
@@ -490,7 +490,7 @@ function ti(r, s = "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 ie(r, s = "file") {
|
|
494
494
|
if (!r || (r = String(r).trim(), r === "")) return s;
|
|
495
495
|
const t = r.split("/");
|
|
496
496
|
return t[t.length - 1].split("?")[0];
|
|
@@ -543,7 +543,7 @@ function Ws(r, 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 === It[e][0] && (l =
|
|
546
|
+
return n === It[e][0] && (l = ee(Number(l))), `${l}${n}`;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
return "0毫秒";
|
|
@@ -558,17 +558,17 @@ function $s(r, s) {
|
|
|
558
558
|
}
|
|
559
559
|
return t;
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function pe(r, s = 2) {
|
|
562
562
|
if (Array.isArray(r) && r.length >= s) {
|
|
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 Ut(r, s = 1, t = 2) {
|
|
569
569
|
if (Array.isArray(r) && r.length >= s) {
|
|
570
570
|
for (let i = 0; i < r.length; i++)
|
|
571
|
-
if (!
|
|
571
|
+
if (!pe(r[i], t)) return !1;
|
|
572
572
|
} else return !1;
|
|
573
573
|
return !0;
|
|
574
574
|
}
|
|
@@ -608,7 +608,7 @@ function Qs(r, s, t, e) {
|
|
|
608
608
|
}
|
|
609
609
|
return m && p;
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function se(r) {
|
|
612
612
|
return Object.prototype.toString.call(r).slice(8, -1).toLowerCase();
|
|
613
613
|
}
|
|
614
614
|
function Js(r) {
|
|
@@ -670,11 +670,11 @@ const it = class it {
|
|
|
670
670
|
static check(s, t) {
|
|
671
671
|
if (!s || typeof s != "string")
|
|
672
672
|
return console.error("Invalid URL provided"), t ? !1 : "unknown";
|
|
673
|
-
const e =
|
|
673
|
+
const e = ie(s).toLowerCase();
|
|
674
674
|
if (t) {
|
|
675
|
-
if (!
|
|
675
|
+
if (!Kt.hasOwnProperty(t))
|
|
676
676
|
return console.error(`Unknown file type: ${t}`), "unknown";
|
|
677
|
-
const i =
|
|
677
|
+
const i = Kt[t];
|
|
678
678
|
return it._checkExtension(e, i);
|
|
679
679
|
}
|
|
680
680
|
return it._detectFileType(e);
|
|
@@ -689,7 +689,7 @@ const it = class it {
|
|
|
689
689
|
*/
|
|
690
690
|
static parseAddresses(s) {
|
|
691
691
|
return !s || typeof s != "string" ? (console.error("Invalid URL provided"), []) : s.split(",").map((t) => {
|
|
692
|
-
const e =
|
|
692
|
+
const e = ie(t), i = this.check(t);
|
|
693
693
|
return { url: t, name: e, type: i };
|
|
694
694
|
});
|
|
695
695
|
}
|
|
@@ -741,10 +741,10 @@ const it = class it {
|
|
|
741
741
|
}
|
|
742
742
|
};
|
|
743
743
|
// 缓存文件扩展名的条目,以提高性能
|
|
744
|
-
d(it, "cachedEntries", Object.entries(
|
|
745
|
-
let
|
|
746
|
-
const ei = /\w*(?:\[\d+\])+|\w+/g, ke = /^\w*(?:\[\d+\])+$/, Ve = /\w+|(\[\d+\])/g,
|
|
747
|
-
function
|
|
744
|
+
d(it, "cachedEntries", Object.entries(Kt));
|
|
745
|
+
let Pe = it;
|
|
746
|
+
const ei = /\w*(?:\[\d+\])+|\w+/g, ke = /^\w*(?:\[\d+\])+$/, Ve = /\w+|(\[\d+\])/g, Oe = /\[(\d+)\]/;
|
|
747
|
+
function Ae(r) {
|
|
748
748
|
return r ? r.match(ei) || [] : [];
|
|
749
749
|
}
|
|
750
750
|
function tn(r, s = 3e3) {
|
|
@@ -767,19 +767,19 @@ function ii(r, s) {
|
|
|
767
767
|
n();
|
|
768
768
|
});
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function lt(r, s, t = [], e = Date.now()) {
|
|
771
771
|
if (e < Date.now() - 50) {
|
|
772
772
|
console.error("_MergeObjects 合并异常:疑似死循环");
|
|
773
773
|
return;
|
|
774
774
|
}
|
|
775
|
-
const i =
|
|
775
|
+
const i = se(r), n = se(s);
|
|
776
776
|
if (i != n) return s;
|
|
777
777
|
if (i == "object" || i == "array") {
|
|
778
778
|
if (t.some(([o, a]) => o == r && a == s)) return r;
|
|
779
779
|
if (t.push([r, s]), i == "object") {
|
|
780
780
|
for (const o in s)
|
|
781
781
|
if (Object.prototype.hasOwnProperty.call(s, o)) {
|
|
782
|
-
const a = s[o], l = r[o], c =
|
|
782
|
+
const a = s[o], l = r[o], c = lt(
|
|
783
783
|
l,
|
|
784
784
|
a,
|
|
785
785
|
t,
|
|
@@ -790,7 +790,7 @@ function ct(r, s, t = [], e = Date.now()) {
|
|
|
790
790
|
return r;
|
|
791
791
|
} else if (i == "array")
|
|
792
792
|
return s.forEach((o, a) => {
|
|
793
|
-
const l = o, c = r[a], h =
|
|
793
|
+
const l = o, c = r[a], h = lt(
|
|
794
794
|
c,
|
|
795
795
|
l,
|
|
796
796
|
t,
|
|
@@ -800,7 +800,7 @@ function ct(r, s, t = [], e = Date.now()) {
|
|
|
800
800
|
}), r;
|
|
801
801
|
} else return s;
|
|
802
802
|
}
|
|
803
|
-
function
|
|
803
|
+
function ne(r = "") {
|
|
804
804
|
return r + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(s) {
|
|
805
805
|
const t = Math.random() * 16 | 0;
|
|
806
806
|
return (s === "x" ? t : t & 3 | 8).toString(16);
|
|
@@ -830,7 +830,7 @@ function en(r, s) {
|
|
|
830
830
|
}
|
|
831
831
|
function sn(r, s) {
|
|
832
832
|
if (!r || !s) return r;
|
|
833
|
-
const t =
|
|
833
|
+
const t = Ae(s);
|
|
834
834
|
return t.length ? t.reduce((e, i, n) => {
|
|
835
835
|
const o = n === t.length - 1;
|
|
836
836
|
if (ke.test(i)) {
|
|
@@ -838,7 +838,7 @@ function sn(r, s) {
|
|
|
838
838
|
return a.reduce((l, c, h) => {
|
|
839
839
|
if (/^\w+$/.test(c))
|
|
840
840
|
return l[c] || (h < a.length - 1 ? [] : {});
|
|
841
|
-
const u = c.match(
|
|
841
|
+
const u = c.match(Oe), f = u ? parseInt(u[1], 10) : 0, m = h === a.length - 1;
|
|
842
842
|
return m && o ? l[f] : l[f] || (m ? {} : []);
|
|
843
843
|
}, e);
|
|
844
844
|
}
|
|
@@ -847,7 +847,7 @@ function sn(r, s) {
|
|
|
847
847
|
}
|
|
848
848
|
function nn(r, s, t, e) {
|
|
849
849
|
if (!r || !s) return t;
|
|
850
|
-
const i =
|
|
850
|
+
const i = Ae(s);
|
|
851
851
|
return i.length ? i.reduce((n, o, a) => {
|
|
852
852
|
const l = a === i.length - 1;
|
|
853
853
|
if (ke.test(o)) {
|
|
@@ -856,7 +856,7 @@ function nn(r, s, t, e) {
|
|
|
856
856
|
const m = f === c.length - 1;
|
|
857
857
|
if (/^\w+$/.test(u))
|
|
858
858
|
return h.hasOwnProperty(u) || (h[u] = []), h[u];
|
|
859
|
-
const p = u.match(
|
|
859
|
+
const p = u.match(Oe), g = p ? parseInt(p[1], 10) : 0, y = m && l;
|
|
860
860
|
return h.hasOwnProperty(g) ? y && !e && (h[g] = t) : h[g] = y ? t : m ? {} : [], h[g];
|
|
861
861
|
}, n);
|
|
862
862
|
}
|
|
@@ -873,7 +873,7 @@ function si(r) {
|
|
|
873
873
|
return n;
|
|
874
874
|
if (i.has(n))
|
|
875
875
|
return i.get(n);
|
|
876
|
-
switch (
|
|
876
|
+
switch (se(n)) {
|
|
877
877
|
case "array": {
|
|
878
878
|
const a = [];
|
|
879
879
|
i.set(n, a);
|
|
@@ -1276,7 +1276,7 @@ class an {
|
|
|
1276
1276
|
}), l;
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
1279
|
-
function
|
|
1279
|
+
function be(r, s) {
|
|
1280
1280
|
for (const t of Object.keys(s))
|
|
1281
1281
|
s[t] !== void 0 && (r[t] = s[t]);
|
|
1282
1282
|
}
|
|
@@ -1321,7 +1321,7 @@ class ln {
|
|
|
1321
1321
|
});
|
|
1322
1322
|
if (!s) return;
|
|
1323
1323
|
const { url: t, ping: e, maxRetryCount: i, retryInterval: n } = s;
|
|
1324
|
-
e !== void 0 && (typeof e == "boolean" ? this.pingConfig.enabled = e :
|
|
1324
|
+
e !== void 0 && (typeof e == "boolean" ? this.pingConfig.enabled = e : be(this.pingConfig, e)), be(this.retryConfig, {
|
|
1325
1325
|
maxCount: i,
|
|
1326
1326
|
interval: n
|
|
1327
1327
|
}), t && this.start(t);
|
|
@@ -1414,7 +1414,7 @@ function hn(r) {
|
|
|
1414
1414
|
return navigator.clipboard ? e().catch(o) : o();
|
|
1415
1415
|
}
|
|
1416
1416
|
function un(r, s) {
|
|
1417
|
-
const t =
|
|
1417
|
+
const t = Re[r];
|
|
1418
1418
|
if (!t) return console.error(`未知纸张类型: ${r}`);
|
|
1419
1419
|
const { width: e, height: i } = t, n = (p) => p / 25.4, a = typeof window < "u" ? window.devicePixelRatio * 96 : 300, l = (p) => Math.round(n(p) * a), c = l(e), h = l(i), u = l(s), f = Math.max(0, c - 2 * u), m = Math.max(0, h - 2 * u);
|
|
1420
1420
|
return {
|
|
@@ -1472,7 +1472,7 @@ class Nt {
|
|
|
1472
1472
|
const o = "请先初始化标签页管理器";
|
|
1473
1473
|
return console.error(o), Promise.reject(o);
|
|
1474
1474
|
}
|
|
1475
|
-
const t =
|
|
1475
|
+
const t = ne();
|
|
1476
1476
|
let e = !1;
|
|
1477
1477
|
const i = this.pendingQueries.get(t) || [];
|
|
1478
1478
|
i.push(() => e = !0), this.pendingQueries.set(t, i);
|
|
@@ -1503,7 +1503,7 @@ class Nt {
|
|
|
1503
1503
|
const n = "请先初始化标签页管理器";
|
|
1504
1504
|
return console.error(n), Promise.reject(n);
|
|
1505
1505
|
}
|
|
1506
|
-
const s =
|
|
1506
|
+
const s = ne(), t = [], e = this.pendingQueries.get(s) || [];
|
|
1507
1507
|
e.push((n) => t.push(n)), this.pendingQueries.set(s, e);
|
|
1508
1508
|
const i = {
|
|
1509
1509
|
type: yt.QUERY,
|
|
@@ -1575,7 +1575,7 @@ class dn {
|
|
|
1575
1575
|
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
1576
1576
|
* MIT Licence
|
|
1577
1577
|
*/
|
|
1578
|
-
var
|
|
1578
|
+
var re = 9e15, ht = 1e9, oe = "0123456789abcdef", Gt = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", Xt = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", ae = {
|
|
1579
1579
|
// These values must be integers within the stated ranges (inclusive).
|
|
1580
1580
|
// Most of these values can be changed at run-time using the `Decimal.config` method.
|
|
1581
1581
|
// The maximum number of significant digits of the result of a calculation or base conversion.
|
|
@@ -1628,12 +1628,12 @@ var de = 9e15, ut = 1e9, fe = "0123456789abcdef", qt = "2.3025850929940456840179
|
|
|
1628
1628
|
// -1 to -EXP_LIMIT
|
|
1629
1629
|
// The maximum exponent value, above which overflow to Infinity occurs.
|
|
1630
1630
|
// JavaScript numbers: 308 (1.7976931348623157e+308)
|
|
1631
|
-
maxE:
|
|
1631
|
+
maxE: re,
|
|
1632
1632
|
// 1 to EXP_LIMIT
|
|
1633
1633
|
// Whether to use cryptographically-secure random number generation, if available.
|
|
1634
1634
|
crypto: !1
|
|
1635
1635
|
// true/false
|
|
1636
|
-
}, Te, nt,
|
|
1636
|
+
}, Te, nt, _ = !0, qt = "[DecimalError] ", ct = qt + "Invalid argument: ", Ie = qt + "Precision limit exceeded", Ne = qt + "crypto unavailable", He = "[object Decimal]", F = Math.floor, I = Math.pow, oi = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, ai = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, li = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, Fe = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, Q = 1e7, S = 7, ci = 9007199254740991, hi = Gt.length - 1, le = Xt.length - 1, v = { toStringTag: He };
|
|
1637
1637
|
v.absoluteValue = v.abs = function() {
|
|
1638
1638
|
var r = new this.constructor(this);
|
|
1639
1639
|
return r.s < 0 && (r.s = 1), C(r);
|
|
@@ -1644,7 +1644,7 @@ v.ceil = function() {
|
|
|
1644
1644
|
v.clampedTo = v.clamp = function(r, s) {
|
|
1645
1645
|
var t, e = this, i = e.constructor;
|
|
1646
1646
|
if (r = new i(r), s = new i(s), !r.s || !s.s) return new i(NaN);
|
|
1647
|
-
if (r.gt(s)) throw Error(
|
|
1647
|
+
if (r.gt(s)) throw Error(ct + s);
|
|
1648
1648
|
return t = e.cmp(r), t < 0 ? r : e.cmp(s) > 0 ? s : new i(e);
|
|
1649
1649
|
};
|
|
1650
1650
|
v.comparedTo = v.cmp = function(r) {
|
|
@@ -1665,7 +1665,7 @@ v.cosine = v.cos = function() {
|
|
|
1665
1665
|
v.cubeRoot = v.cbrt = function() {
|
|
1666
1666
|
var r, s, t, e, i, n, o, a, l, c, h = this, u = h.constructor;
|
|
1667
1667
|
if (!h.isFinite() || h.isZero()) return new u(h);
|
|
1668
|
-
for (
|
|
1668
|
+
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; ; )
|
|
1669
1669
|
if (a = e, l = a.times(a).times(a), c = l.plus(h), e = V(c.plus(h).times(a), c.plus(l), o + 2, 1), N(a.d).slice(0, o) === (t = N(e.d)).slice(0, o))
|
|
1670
1670
|
if (t = t.slice(o - 3, o + 1), t == "9999" || !i && t == "4999") {
|
|
1671
1671
|
if (!i && (C(a, r + 1, 0), a.times(a).times(a).eq(h))) {
|
|
@@ -1677,7 +1677,7 @@ v.cubeRoot = v.cbrt = function() {
|
|
|
1677
1677
|
(!+t || !+t.slice(1) && t.charAt(0) == "5") && (C(e, r + 1, 1), s = !e.times(e).times(e).eq(h));
|
|
1678
1678
|
break;
|
|
1679
1679
|
}
|
|
1680
|
-
return
|
|
1680
|
+
return _ = !0, C(e, r, u.rounding, s);
|
|
1681
1681
|
};
|
|
1682
1682
|
v.decimalPlaces = v.dp = function() {
|
|
1683
1683
|
var r, s = this.d, t = NaN;
|
|
@@ -1711,7 +1711,7 @@ v.hyperbolicCosine = v.cosh = function() {
|
|
|
1711
1711
|
var r, s, t, e, i, n = this, o = n.constructor, a = new o(1);
|
|
1712
1712
|
if (!n.isFinite()) return new o(n.s ? 1 / 0 : NaN);
|
|
1713
1713
|
if (n.isZero()) return a;
|
|
1714
|
-
t = o.precision, e = o.rounding, o.precision = t + Math.max(n.e, n.sd()) + 4, o.rounding = 1, i = n.d.length, i < 32 ? (r = Math.ceil(i / 3), s = (1 /
|
|
1714
|
+
t = o.precision, e = o.rounding, o.precision = t + Math.max(n.e, n.sd()) + 4, o.rounding = 1, i = n.d.length, i < 32 ? (r = Math.ceil(i / 3), s = (1 / Qt(4, r)).toString()) : (r = 16, s = "2.3283064365386962890625e-10"), n = Mt(o, 1, n.times(s), new o(1), !0);
|
|
1715
1715
|
for (var l, c = r, h = new o(8); c--; )
|
|
1716
1716
|
l = n.times(n), n = a.minus(l.times(h.minus(l.times(h))));
|
|
1717
1717
|
return C(n, o.precision = t, o.rounding = e, !0);
|
|
@@ -1720,9 +1720,9 @@ v.hyperbolicSine = v.sinh = function() {
|
|
|
1720
1720
|
var r, s, t, e, i = this, n = i.constructor;
|
|
1721
1721
|
if (!i.isFinite() || i.isZero()) return new n(i);
|
|
1722
1722
|
if (s = n.precision, t = n.rounding, n.precision = s + Math.max(i.e, i.sd()) + 4, n.rounding = 1, e = i.d.length, e < 3)
|
|
1723
|
-
i =
|
|
1723
|
+
i = Mt(n, 2, i, i, !0);
|
|
1724
1724
|
else {
|
|
1725
|
-
r = 1.4 * Math.sqrt(e), r = r > 16 ? 16 : r | 0, i = i.times(1 /
|
|
1725
|
+
r = 1.4 * Math.sqrt(e), r = r > 16 ? 16 : r | 0, i = i.times(1 / Qt(5, r)), i = Mt(n, 2, i, i, !0);
|
|
1726
1726
|
for (var o, a = new n(5), l = new n(16), c = new n(20); r--; )
|
|
1727
1727
|
o = i.times(i), i = i.times(a.plus(o.times(l.times(o).plus(c))));
|
|
1728
1728
|
}
|
|
@@ -1738,11 +1738,11 @@ v.inverseCosine = v.acos = function() {
|
|
|
1738
1738
|
};
|
|
1739
1739
|
v.inverseHyperbolicCosine = v.acosh = function() {
|
|
1740
1740
|
var r, s, t = this, e = t.constructor;
|
|
1741
|
-
return t.lte(1) ? new e(t.eq(1) ? 0 : NaN) : t.isFinite() ? (r = e.precision, s = e.rounding, e.precision = r + Math.max(Math.abs(t.e), t.sd()) + 4, e.rounding = 1,
|
|
1741
|
+
return t.lte(1) ? new e(t.eq(1) ? 0 : NaN) : t.isFinite() ? (r = e.precision, s = e.rounding, e.precision = r + Math.max(Math.abs(t.e), t.sd()) + 4, e.rounding = 1, _ = !1, t = t.times(t).minus(1).sqrt().plus(t), _ = !0, e.precision = r, e.rounding = s, t.ln()) : new e(t);
|
|
1742
1742
|
};
|
|
1743
1743
|
v.inverseHyperbolicSine = v.asinh = function() {
|
|
1744
1744
|
var r, s, t = this, e = t.constructor;
|
|
1745
|
-
return !t.isFinite() || t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + 2 * Math.max(Math.abs(t.e), t.sd()) + 6, e.rounding = 1,
|
|
1745
|
+
return !t.isFinite() || t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + 2 * Math.max(Math.abs(t.e), t.sd()) + 6, e.rounding = 1, _ = !1, t = t.times(t).plus(1).sqrt().plus(t), _ = !0, e.precision = r, e.rounding = s, t.ln());
|
|
1746
1746
|
};
|
|
1747
1747
|
v.inverseHyperbolicTangent = v.atanh = function() {
|
|
1748
1748
|
var r, s, t, e, i = this, n = i.constructor;
|
|
@@ -1757,17 +1757,17 @@ v.inverseTangent = v.atan = function() {
|
|
|
1757
1757
|
if (c.isFinite()) {
|
|
1758
1758
|
if (c.isZero())
|
|
1759
1759
|
return new h(c);
|
|
1760
|
-
if (c.abs().eq(1) && u + 4 <=
|
|
1760
|
+
if (c.abs().eq(1) && u + 4 <= le)
|
|
1761
1761
|
return o = tt(h, u + 4, f).times(0.25), o.s = c.s, o;
|
|
1762
1762
|
} else {
|
|
1763
1763
|
if (!c.s) return new h(NaN);
|
|
1764
|
-
if (u + 4 <=
|
|
1764
|
+
if (u + 4 <= le)
|
|
1765
1765
|
return o = tt(h, u + 4, f).times(0.5), o.s = c.s, o;
|
|
1766
1766
|
}
|
|
1767
1767
|
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));
|
|
1768
|
-
for (
|
|
1768
|
+
for (_ = !1, s = Math.ceil(a / S), e = 1, l = c.times(c), o = new h(c), i = c; r !== -1; )
|
|
1769
1769
|
if (i = i.times(l), n = o.minus(i.div(e += 2)), i = i.times(l), o = n.plus(i.div(e += 2)), o.d[s] !== void 0) for (r = s; o.d[r] === n.d[r] && r--; ) ;
|
|
1770
|
-
return t && (o = o.times(2 << t - 1)),
|
|
1770
|
+
return t && (o = o.times(2 << t - 1)), _ = !0, C(o, h.precision = u, h.rounding = f, !0);
|
|
1771
1771
|
};
|
|
1772
1772
|
v.isFinite = function() {
|
|
1773
1773
|
return !!this.d;
|
|
@@ -1810,14 +1810,14 @@ v.logarithm = v.log = function(r) {
|
|
|
1810
1810
|
for (i = t[0]; i % 10 === 0; ) i /= 10;
|
|
1811
1811
|
n = i !== 1;
|
|
1812
1812
|
}
|
|
1813
|
-
if (
|
|
1813
|
+
if (_ = !1, a = u + m, o = at(c, a), e = s ? Yt(h, a + 10) : at(r, a), l = V(o, e, a, 1), kt(l.d, i = u, f))
|
|
1814
1814
|
do
|
|
1815
|
-
if (a += 10, o = at(c, a), e = s ?
|
|
1815
|
+
if (a += 10, o = at(c, a), e = s ? Yt(h, a + 10) : at(r, a), l = V(o, e, a, 1), !n) {
|
|
1816
1816
|
+N(l.d).slice(i + 1, i + 15) + 1 == 1e14 && (l = C(l, u + 1, 0));
|
|
1817
1817
|
break;
|
|
1818
1818
|
}
|
|
1819
1819
|
while (kt(l.d, i += 10, f));
|
|
1820
|
-
return
|
|
1820
|
+
return _ = !0, C(l, u, f);
|
|
1821
1821
|
};
|
|
1822
1822
|
v.minus = v.sub = function(r) {
|
|
1823
1823
|
var s, t, e, i, n, o, a, l, c, h, u, f, m = this, p = m.constructor;
|
|
@@ -1829,7 +1829,7 @@ v.minus = v.sub = function(r) {
|
|
|
1829
1829
|
if (f[0]) r.s = -r.s;
|
|
1830
1830
|
else if (c[0]) r = new p(m);
|
|
1831
1831
|
else return new p(l === 3 ? -0 : 0);
|
|
1832
|
-
return
|
|
1832
|
+
return _ ? C(r, a, l) : r;
|
|
1833
1833
|
}
|
|
1834
1834
|
if (t = F(r.e / S), h = F(m.e / S), c = c.slice(), n = h - t, n) {
|
|
1835
1835
|
for (u = n < 0, u ? (s = c, n = -n, o = f.length) : (s = f, t = h, o = c.length), e = Math.max(Math.ceil(a / S), o) + 2, n > e && (n = e, s.length = 1), s.reverse(), e = n; e--; ) s.push(0);
|
|
@@ -1852,14 +1852,14 @@ v.minus = v.sub = function(r) {
|
|
|
1852
1852
|
}
|
|
1853
1853
|
for (; c[--o] === 0; ) c.pop();
|
|
1854
1854
|
for (; c[0] === 0; c.shift()) --t;
|
|
1855
|
-
return c[0] ? (r.d = c, r.e =
|
|
1855
|
+
return c[0] ? (r.d = c, r.e = Zt(c, t), _ ? C(r, a, l) : r) : new p(l === 3 ? -0 : 0);
|
|
1856
1856
|
};
|
|
1857
1857
|
v.modulo = v.mod = function(r) {
|
|
1858
1858
|
var s, t = this, e = t.constructor;
|
|
1859
|
-
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) : (
|
|
1859
|
+
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 ? (s = V(t, r.abs(), 0, 3, 1), s.s *= r.s) : s = V(t, r, 0, e.modulo, 1), s = s.times(r), _ = !0, t.minus(s));
|
|
1860
1860
|
};
|
|
1861
1861
|
v.naturalExponential = v.exp = function() {
|
|
1862
|
-
return
|
|
1862
|
+
return ce(this);
|
|
1863
1863
|
};
|
|
1864
1864
|
v.naturalLogarithm = v.ln = function() {
|
|
1865
1865
|
return at(this);
|
|
@@ -1875,7 +1875,7 @@ v.plus = v.add = function(r) {
|
|
|
1875
1875
|
if (u.s != r.s)
|
|
1876
1876
|
return r.s = -r.s, u.minus(r);
|
|
1877
1877
|
if (c = u.d, h = r.d, a = f.precision, l = f.rounding, !c[0] || !h[0])
|
|
1878
|
-
return h[0] || (r = new f(u)),
|
|
1878
|
+
return h[0] || (r = new f(u)), _ ? C(r, a, l) : r;
|
|
1879
1879
|
if (n = F(u.e / S), e = F(r.e / S), c = c.slice(), i = n - e, i) {
|
|
1880
1880
|
for (i < 0 ? (t = c, i = -i, o = h.length) : (t = h, e = n, o = c.length), n = Math.ceil(a / S), o = n > o ? n + 1 : o + 1, i > o && (i = o, t.length = 1), t.reverse(); i--; ) t.push(0);
|
|
1881
1881
|
t.reverse();
|
|
@@ -1883,11 +1883,11 @@ v.plus = v.add = function(r) {
|
|
|
1883
1883
|
for (o = c.length, i = h.length, o - i < 0 && (i = o, t = h, h = c, c = t), s = 0; i; )
|
|
1884
1884
|
s = (c[--i] = c[i] + h[i] + s) / Q | 0, c[i] %= Q;
|
|
1885
1885
|
for (s && (c.unshift(s), ++e), o = c.length; c[--o] == 0; ) c.pop();
|
|
1886
|
-
return r.d = c, r.e =
|
|
1886
|
+
return r.d = c, r.e = Zt(c, e), _ ? C(r, a, l) : r;
|
|
1887
1887
|
};
|
|
1888
1888
|
v.precision = v.sd = function(r) {
|
|
1889
1889
|
var s, t = this;
|
|
1890
|
-
if (r !== void 0 && r !== !!r && r !== 1 && r !== 0) throw Error(
|
|
1890
|
+
if (r !== void 0 && r !== !!r && r !== 1 && r !== 0) throw Error(ct + r);
|
|
1891
1891
|
return t.d ? (s = ze(t.d), r && t.e + 1 > s && (s = t.e + 1)) : s = NaN, s;
|
|
1892
1892
|
};
|
|
1893
1893
|
v.round = function() {
|
|
@@ -1902,7 +1902,7 @@ v.squareRoot = v.sqrt = function() {
|
|
|
1902
1902
|
var r, s, t, e, i, n, o = this, a = o.d, l = o.e, c = o.s, h = o.constructor;
|
|
1903
1903
|
if (c !== 1 || !a || !a[0])
|
|
1904
1904
|
return new h(!c || c < 0 && (!a || a[0]) ? NaN : a ? o : 1 / 0);
|
|
1905
|
-
for (
|
|
1905
|
+
for (_ = !1, c = Math.sqrt(+o), c == 0 || c == 1 / 0 ? (s = N(a), (s.length + l) % 2 == 0 && (s += "0"), c = Math.sqrt(s), l = F((l + 1) / 2) - (l < 0 || l % 2), c == 1 / 0 ? s = "5e" + l : (s = c.toExponential(), s = s.slice(0, s.indexOf("e") + 1) + l), e = new h(s)) : e = new h(c.toString()), t = (l = h.precision) + 3; ; )
|
|
1906
1906
|
if (n = e, e = n.plus(V(o, n, t + 2, 1)).times(0.5), N(n.d).slice(0, t) === (s = N(e.d)).slice(0, t))
|
|
1907
1907
|
if (s = s.slice(t - 3, t + 1), s == "9999" || !i && s == "4999") {
|
|
1908
1908
|
if (!i && (C(n, l + 1, 0), n.times(n).eq(o))) {
|
|
@@ -1914,7 +1914,7 @@ v.squareRoot = v.sqrt = function() {
|
|
|
1914
1914
|
(!+s || !+s.slice(1) && s.charAt(0) == "5") && (C(e, l + 1, 1), r = !e.times(e).eq(o));
|
|
1915
1915
|
break;
|
|
1916
1916
|
}
|
|
1917
|
-
return
|
|
1917
|
+
return _ = !0, C(e, l, h.rounding, r);
|
|
1918
1918
|
};
|
|
1919
1919
|
v.tangent = v.tan = function() {
|
|
1920
1920
|
var r, s, t = this, e = t.constructor;
|
|
@@ -1931,22 +1931,22 @@ v.times = v.mul = function(r) {
|
|
|
1931
1931
|
n[i] = (n[i] + s) % Q | 0;
|
|
1932
1932
|
}
|
|
1933
1933
|
for (; !n[--o]; ) n.pop();
|
|
1934
|
-
return s ? ++t : n.shift(), r.d = n, r.e =
|
|
1934
|
+
return s ? ++t : n.shift(), r.d = n, r.e = Zt(n, t), _ ? C(r, u.precision, u.rounding) : r;
|
|
1935
1935
|
};
|
|
1936
1936
|
v.toBinary = function(r, s) {
|
|
1937
|
-
return
|
|
1937
|
+
return ve(this, 2, r, s);
|
|
1938
1938
|
};
|
|
1939
1939
|
v.toDecimalPlaces = v.toDP = function(r, s) {
|
|
1940
1940
|
var t = this, e = t.constructor;
|
|
1941
|
-
return t = new e(t), r === void 0 ? t : (U(r, 0,
|
|
1941
|
+
return t = new e(t), r === void 0 ? t : (U(r, 0, ht), s === void 0 ? s = e.rounding : U(s, 0, 8), C(t, r + t.e + 1, s));
|
|
1942
1942
|
};
|
|
1943
1943
|
v.toExponential = function(r, s) {
|
|
1944
1944
|
var t, e = this, i = e.constructor;
|
|
1945
|
-
return r === void 0 ? t = et(e, !0) : (U(r, 0,
|
|
1945
|
+
return r === void 0 ? t = et(e, !0) : (U(r, 0, ht), s === void 0 ? s = i.rounding : U(s, 0, 8), e = C(new i(e), r + 1, s), t = et(e, !0, r + 1)), e.isNeg() && !e.isZero() ? "-" + t : t;
|
|
1946
1946
|
};
|
|
1947
1947
|
v.toFixed = function(r, s) {
|
|
1948
1948
|
var t, e, i = this, n = i.constructor;
|
|
1949
|
-
return r === void 0 ? t = et(i) : (U(r, 0,
|
|
1949
|
+
return r === void 0 ? t = et(i) : (U(r, 0, ht), s === void 0 ? s = n.rounding : U(s, 0, 8), e = C(new n(i), r + i.e + 1, s), t = et(e, !1, r + e.e + 1)), i.isNeg() && !i.isZero() ? "-" + t : t;
|
|
1950
1950
|
};
|
|
1951
1951
|
v.toFraction = function(r) {
|
|
1952
1952
|
var s, t, e, i, n, o, a, l, c, h, u, f, m = this, p = m.d, g = m.constructor;
|
|
@@ -1954,15 +1954,15 @@ v.toFraction = function(r) {
|
|
|
1954
1954
|
if (c = t = new g(1), e = l = new g(0), s = new g(e), n = s.e = ze(p) - m.e - 1, o = n % S, s.d[0] = I(10, o < 0 ? S + o : o), r == null)
|
|
1955
1955
|
r = n > 0 ? s : c;
|
|
1956
1956
|
else {
|
|
1957
|
-
if (a = new g(r), !a.isInt() || a.lt(c)) throw Error(
|
|
1957
|
+
if (a = new g(r), !a.isInt() || a.lt(c)) throw Error(ct + a);
|
|
1958
1958
|
r = a.gt(s) ? n > 0 ? s : c : a;
|
|
1959
1959
|
}
|
|
1960
|
-
for (
|
|
1960
|
+
for (_ = !1, a = new g(N(p)), h = g.precision, g.precision = n = p.length * S * 2; u = V(a, s, 0, 1, 1), i = t.plus(u.times(e)), i.cmp(r) != 1; )
|
|
1961
1961
|
t = e, e = i, i = c, c = l.plus(u.times(i)), l = i, i = s, s = a.minus(u.times(i)), a = i;
|
|
1962
|
-
return i = V(r.minus(t), e, 0, 1, 1), l = l.plus(i.times(c)), t = t.plus(i.times(e)), l.s = c.s = m.s, f = V(c, e, n, 1).minus(m).abs().cmp(V(l, t, n, 1).minus(m).abs()) < 1 ? [c, e] : [l, t], g.precision = h,
|
|
1962
|
+
return i = V(r.minus(t), e, 0, 1, 1), l = l.plus(i.times(c)), t = t.plus(i.times(e)), l.s = c.s = m.s, f = V(c, e, n, 1).minus(m).abs().cmp(V(l, t, n, 1).minus(m).abs()) < 1 ? [c, e] : [l, t], g.precision = h, _ = !0, f;
|
|
1963
1963
|
};
|
|
1964
1964
|
v.toHexadecimal = v.toHex = function(r, s) {
|
|
1965
|
-
return
|
|
1965
|
+
return ve(this, 16, r, s);
|
|
1966
1966
|
};
|
|
1967
1967
|
v.toNearest = function(r, s) {
|
|
1968
1968
|
var t = this, e = t.constructor;
|
|
@@ -1974,13 +1974,13 @@ v.toNearest = function(r, s) {
|
|
|
1974
1974
|
if (!r.d)
|
|
1975
1975
|
return r.s && (r.s = t.s), r;
|
|
1976
1976
|
}
|
|
1977
|
-
return r.d[0] ? (
|
|
1977
|
+
return r.d[0] ? (_ = !1, t = V(t, r, 0, s, 1).times(r), _ = !0, C(t)) : (r.s = t.s, t = r), t;
|
|
1978
1978
|
};
|
|
1979
1979
|
v.toNumber = function() {
|
|
1980
1980
|
return +this;
|
|
1981
1981
|
};
|
|
1982
1982
|
v.toOctal = function(r, s) {
|
|
1983
|
-
return
|
|
1983
|
+
return ve(this, 8, r, s);
|
|
1984
1984
|
};
|
|
1985
1985
|
v.toPower = v.pow = function(r) {
|
|
1986
1986
|
var s, t, e, i, n, o, a = this, l = a.constructor, c = +(r = new l(r));
|
|
@@ -1994,15 +1994,15 @@ v.toPower = v.pow = function(r) {
|
|
|
1994
1994
|
if (r.d[s] & 1 || (o = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
|
|
1995
1995
|
return a.s = o, a;
|
|
1996
1996
|
}
|
|
1997
|
-
return t = I(+a, c), s = t == 0 || !isFinite(t) ? F(c * (Math.log("0." + N(a.d)) / Math.LN10 + a.e + 1)) : new l(t + "").e, s > l.maxE + 1 || s < l.minE - 1 ? new l(s > 0 ? o / 0 : 0) : (
|
|
1997
|
+
return t = I(+a, c), s = t == 0 || !isFinite(t) ? F(c * (Math.log("0." + N(a.d)) / Math.LN10 + a.e + 1)) : new l(t + "").e, s > l.maxE + 1 || s < l.minE - 1 ? new l(s > 0 ? o / 0 : 0) : (_ = !1, l.rounding = a.s = 1, t = Math.min(12, (s + "").length), i = ce(r.times(at(a, e + t)), e), i.d && (i = C(i, e + 5, 1), kt(i.d, e, n) && (s = e + 10, i = C(ce(r.times(at(a, s + t)), s), s + 5, 1), +N(i.d).slice(e + 1, e + 15) + 1 == 1e14 && (i = C(i, e + 1, 0)))), i.s = o, _ = !0, l.rounding = n, C(i, e, n));
|
|
1998
1998
|
};
|
|
1999
1999
|
v.toPrecision = function(r, s) {
|
|
2000
2000
|
var t, e = this, i = e.constructor;
|
|
2001
|
-
return r === void 0 ? t = et(e, e.e <= i.toExpNeg || e.e >= i.toExpPos) : (U(r, 1,
|
|
2001
|
+
return r === void 0 ? t = et(e, e.e <= i.toExpNeg || e.e >= i.toExpPos) : (U(r, 1, ht), s === void 0 ? s = i.rounding : U(s, 0, 8), e = C(new i(e), r, s), t = et(e, r <= e.e || e.e <= i.toExpNeg, r)), e.isNeg() && !e.isZero() ? "-" + t : t;
|
|
2002
2002
|
};
|
|
2003
2003
|
v.toSignificantDigits = v.toSD = function(r, s) {
|
|
2004
2004
|
var t = this, e = t.constructor;
|
|
2005
|
-
return r === void 0 ? (r = e.precision, s = e.rounding) : (U(r, 1,
|
|
2005
|
+
return r === void 0 ? (r = e.precision, s = e.rounding) : (U(r, 1, ht), s === void 0 ? s = e.rounding : U(s, 0, 8)), C(new e(t), r, s);
|
|
2006
2006
|
};
|
|
2007
2007
|
v.toString = function() {
|
|
2008
2008
|
var r = this, s = r.constructor, t = et(r, r.e <= s.toExpNeg || r.e >= s.toExpPos);
|
|
@@ -2028,7 +2028,7 @@ function N(r) {
|
|
|
2028
2028
|
}
|
|
2029
2029
|
function U(r, s, t) {
|
|
2030
2030
|
if (r !== ~~r || r < s || r > t)
|
|
2031
|
-
throw Error(
|
|
2031
|
+
throw Error(ct + r);
|
|
2032
2032
|
}
|
|
2033
2033
|
function kt(r, s, t, e) {
|
|
2034
2034
|
var i, n, o, a;
|
|
@@ -2038,7 +2038,7 @@ function kt(r, s, t, e) {
|
|
|
2038
2038
|
function Ft(r, s, t) {
|
|
2039
2039
|
for (var e, i = [0], n, o = 0, a = r.length; o < a; ) {
|
|
2040
2040
|
for (n = i.length; n--; ) i[n] *= s;
|
|
2041
|
-
for (i[0] +=
|
|
2041
|
+
for (i[0] += oe.indexOf(r.charAt(o++)), e = 0; e < i.length; e++)
|
|
2042
2042
|
i[e] > t - 1 && (i[e + 1] === void 0 && (i[e + 1] = 0), i[e + 1] += i[e] / t | 0, i[e] %= t);
|
|
2043
2043
|
}
|
|
2044
2044
|
return i.reverse();
|
|
@@ -2046,7 +2046,7 @@ function Ft(r, s, t) {
|
|
|
2046
2046
|
function ui(r, s) {
|
|
2047
2047
|
var t, e, i;
|
|
2048
2048
|
if (s.isZero()) return s;
|
|
2049
|
-
e = s.d.length, e < 32 ? (t = Math.ceil(e / 3), i = (1 /
|
|
2049
|
+
e = s.d.length, e < 32 ? (t = Math.ceil(e / 3), i = (1 / Qt(4, t)).toString()) : (t = 16, i = "2.3283064365386962890625e-10"), r.precision += t, s = Mt(r, 1, s.times(i), new r(1));
|
|
2050
2050
|
for (var n = t; n--; ) {
|
|
2051
2051
|
var o = s.times(s);
|
|
2052
2052
|
s = o.times(o).minus(o).times(8).plus(1);
|
|
@@ -2078,29 +2078,29 @@ var V = /* @__PURE__ */ function() {
|
|
|
2078
2078
|
for (; !e[0] && e.length > 1; ) e.shift();
|
|
2079
2079
|
}
|
|
2080
2080
|
return function(e, i, n, o, a, l) {
|
|
2081
|
-
var c, h, u, f, m, p, g, y, w, P, b,
|
|
2082
|
-
if (!H || !H[0] || !
|
|
2081
|
+
var c, h, u, f, m, p, g, y, w, P, b, E, A, G, At, ut, rt, vt, X, Lt, Tt = e.constructor, Jt = e.s == i.s ? 1 : -1, H = e.d, O = i.d;
|
|
2082
|
+
if (!H || !H[0] || !O || !O[0])
|
|
2083
2083
|
return new Tt(
|
|
2084
2084
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
2085
|
-
!e.s || !i.s || (H ?
|
|
2085
|
+
!e.s || !i.s || (H ? O && H[0] == O[0] : !O) ? NaN : (
|
|
2086
2086
|
// Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
|
|
2087
|
-
H && H[0] == 0 || !
|
|
2087
|
+
H && H[0] == 0 || !O ? Jt * 0 : Jt / 0
|
|
2088
2088
|
)
|
|
2089
2089
|
);
|
|
2090
|
-
for (l ? (m = 1, h = e.e - i.e) : (l = Q, m = S, h = F(e.e / m) - F(i.e / m)), X =
|
|
2091
|
-
if (
|
|
2090
|
+
for (l ? (m = 1, h = e.e - i.e) : (l = Q, m = S, h = F(e.e / m) - F(i.e / m)), X = O.length, rt = H.length, w = new Tt(Jt), P = w.d = [], u = 0; O[u] == (H[u] || 0); u++) ;
|
|
2091
|
+
if (O[u] > (H[u] || 0) && h--, n == null ? (G = n = Tt.precision, o = Tt.rounding) : a ? G = n + (e.e - i.e) + 1 : G = n, G < 0)
|
|
2092
2092
|
P.push(1), p = !0;
|
|
2093
2093
|
else {
|
|
2094
2094
|
if (G = G / m + 2 | 0, u = 0, X == 1) {
|
|
2095
|
-
for (f = 0,
|
|
2096
|
-
|
|
2095
|
+
for (f = 0, O = O[0], G++; (u < rt || f) && G--; u++)
|
|
2096
|
+
At = f * l + (H[u] || 0), P[u] = At / O | 0, f = At % O | 0;
|
|
2097
2097
|
p = f || u < rt;
|
|
2098
2098
|
} else {
|
|
2099
|
-
for (f = l / (
|
|
2100
|
-
Lt =
|
|
2099
|
+
for (f = l / (O[0] + 1) | 0, f > 1 && (O = r(O, f, l), H = r(H, f, l), X = O.length, rt = H.length), ut = X, b = H.slice(0, X), E = b.length; E < X; ) b[E++] = 0;
|
|
2100
|
+
Lt = O.slice(), Lt.unshift(0), vt = O[0], O[1] >= l / 2 && ++vt;
|
|
2101
2101
|
do
|
|
2102
|
-
f = 0, c = s(
|
|
2103
|
-
while ((
|
|
2102
|
+
f = 0, c = s(O, b, X, E), c < 0 ? (A = b[0], X != E && (A = A * l + (b[1] || 0)), f = A / vt | 0, f > 1 ? (f >= l && (f = l - 1), g = r(O, f, l), y = g.length, E = b.length, c = s(g, b, y, E), c == 1 && (f--, t(g, X < y ? Lt : O, y, l))) : (f == 0 && (c = f = 1), g = O.slice()), y = g.length, y < E && g.unshift(0), t(b, g, E, l), c == -1 && (E = b.length, c = s(O, b, X, E), c < 1 && (f++, t(b, X < E ? Lt : O, E, l))), E = b.length) : c === 0 && (f++, b = [0]), P[u++] = f, c && b[0] ? b[E++] = H[ut] || 0 : (b = [H[ut]], E = 1);
|
|
2103
|
+
while ((ut++ < rt || b[0] !== void 0) && G--);
|
|
2104
2104
|
p = b[0] !== void 0;
|
|
2105
2105
|
}
|
|
2106
2106
|
P[0] || P.shift();
|
|
@@ -2147,26 +2147,26 @@ function C(r, s, t, e) {
|
|
|
2147
2147
|
}
|
|
2148
2148
|
for (n = u.length; u[--n] === 0; ) u.pop();
|
|
2149
2149
|
}
|
|
2150
|
-
return
|
|
2150
|
+
return _ && (r.e > m.maxE ? (r.d = null, r.e = NaN) : r.e < m.minE && (r.e = 0, r.d = [0])), r;
|
|
2151
2151
|
}
|
|
2152
2152
|
function et(r, s, t) {
|
|
2153
2153
|
if (!r.isFinite()) return Ge(r);
|
|
2154
2154
|
var e, i = r.e, n = N(r.d), o = n.length;
|
|
2155
2155
|
return s ? (t && (e = t - o) > 0 ? n = n.charAt(0) + "." + n.slice(1) + ot(e) : o > 1 && (n = n.charAt(0) + "." + n.slice(1)), n = n + (r.e < 0 ? "e" : "e+") + r.e) : i < 0 ? (n = "0." + ot(-i - 1) + n, t && (e = t - o) > 0 && (n += ot(e))) : i >= o ? (n += ot(i + 1 - o), t && (e = t - i - 1) > 0 && (n = n + "." + ot(e))) : ((e = i + 1) < o && (n = n.slice(0, e) + "." + n.slice(e)), t && (e = t - o) > 0 && (i + 1 === o && (n += "."), n += ot(e))), n;
|
|
2156
2156
|
}
|
|
2157
|
-
function
|
|
2157
|
+
function Zt(r, s) {
|
|
2158
2158
|
var t = r[0];
|
|
2159
2159
|
for (s *= S; t >= 10; t /= 10) s++;
|
|
2160
2160
|
return s;
|
|
2161
2161
|
}
|
|
2162
|
-
function
|
|
2162
|
+
function Yt(r, s, t) {
|
|
2163
2163
|
if (s > hi)
|
|
2164
|
-
throw
|
|
2165
|
-
return C(new r(
|
|
2164
|
+
throw _ = !0, t && (r.precision = t), Error(Ie);
|
|
2165
|
+
return C(new r(Gt), s, 1, !0);
|
|
2166
2166
|
}
|
|
2167
2167
|
function tt(r, s, t) {
|
|
2168
|
-
if (s >
|
|
2169
|
-
return C(new r(
|
|
2168
|
+
if (s > le) throw Error(Ie);
|
|
2169
|
+
return C(new r(Xt), s, t, !0);
|
|
2170
2170
|
}
|
|
2171
2171
|
function ze(r) {
|
|
2172
2172
|
var s = r.length - 1, t = s * S + 1;
|
|
@@ -2182,16 +2182,16 @@ function ot(r) {
|
|
|
2182
2182
|
}
|
|
2183
2183
|
function Be(r, s, t, e) {
|
|
2184
2184
|
var i, n = new r(1), o = Math.ceil(e / S + 4);
|
|
2185
|
-
for (
|
|
2186
|
-
if (t % 2 && (n = n.times(s),
|
|
2185
|
+
for (_ = !1; ; ) {
|
|
2186
|
+
if (t % 2 && (n = n.times(s), Se(n.d, o) && (i = !0)), t = F(t / 2), t === 0) {
|
|
2187
2187
|
t = n.d.length - 1, i && n.d[t] === 0 && ++n.d[t];
|
|
2188
2188
|
break;
|
|
2189
2189
|
}
|
|
2190
|
-
s = s.times(s),
|
|
2190
|
+
s = s.times(s), Se(s.d, o);
|
|
2191
2191
|
}
|
|
2192
|
-
return
|
|
2192
|
+
return _ = !0, n;
|
|
2193
2193
|
}
|
|
2194
|
-
function
|
|
2194
|
+
function Ce(r) {
|
|
2195
2195
|
return r.d[r.d.length - 1] & 1;
|
|
2196
2196
|
}
|
|
2197
2197
|
function Ue(r, s, t) {
|
|
@@ -2204,11 +2204,11 @@ function Ue(r, s, t) {
|
|
|
2204
2204
|
}
|
|
2205
2205
|
return n;
|
|
2206
2206
|
}
|
|
2207
|
-
function
|
|
2207
|
+
function ce(r, s) {
|
|
2208
2208
|
var t, e, i, n, o, a, l, c = 0, h = 0, u = 0, f = r.constructor, m = f.rounding, p = f.precision;
|
|
2209
2209
|
if (!r.d || !r.d[0] || r.e > 17)
|
|
2210
2210
|
return new f(r.d ? r.d[0] ? r.s < 0 ? 0 : 1 / 0 : 1 : r.s ? r.s < 0 ? 0 : r : NaN);
|
|
2211
|
-
for (s == null ? (
|
|
2211
|
+
for (s == null ? (_ = !1, l = p) : l = s, a = new f(0.03125); r.e > -2; )
|
|
2212
2212
|
r = r.times(a), u += 5;
|
|
2213
2213
|
for (e = Math.log(I(2, u)) / Math.LN10 * 2 + 5 | 0, l += e, t = n = o = new f(1), f.precision = l; ; ) {
|
|
2214
2214
|
if (n = C(n.times(r), l, 1), t = t.times(++h), a = o.plus(V(n, t, l, 1)), N(a.d).slice(0, l) === N(o.d).slice(0, l)) {
|
|
@@ -2217,7 +2217,7 @@ function pe(r, s) {
|
|
|
2217
2217
|
if (c < 3 && kt(o.d, l - e, m, c))
|
|
2218
2218
|
f.precision = l += 10, t = n = a = new f(1), h = 0, c++;
|
|
2219
2219
|
else
|
|
2220
|
-
return C(o, f.precision = p, m,
|
|
2220
|
+
return C(o, f.precision = p, m, _ = !0);
|
|
2221
2221
|
else
|
|
2222
2222
|
return f.precision = p, o;
|
|
2223
2223
|
}
|
|
@@ -2228,19 +2228,19 @@ function at(r, s) {
|
|
|
2228
2228
|
var t, e, i, n, o, a, l, c, h, u, f, m = 1, p = 10, g = r, y = g.d, w = g.constructor, P = w.rounding, b = w.precision;
|
|
2229
2229
|
if (g.s < 0 || !y || !y[0] || !g.e && y[0] == 1 && y.length == 1)
|
|
2230
2230
|
return new w(y && !y[0] ? -1 / 0 : g.s != 1 ? NaN : y ? 0 : g);
|
|
2231
|
-
if (s == null ? (
|
|
2231
|
+
if (s == null ? (_ = !1, h = b) : h = s, w.precision = h += p, t = N(y), e = t.charAt(0), Math.abs(n = g.e) < 15e14) {
|
|
2232
2232
|
for (; e < 7 && e != 1 || e == 1 && t.charAt(1) > 3; )
|
|
2233
2233
|
g = g.times(r), t = N(g.d), e = t.charAt(0), m++;
|
|
2234
2234
|
n = g.e, e > 1 ? (g = new w("0." + t), n++) : g = new w(e + "." + t.slice(1));
|
|
2235
2235
|
} else
|
|
2236
|
-
return c =
|
|
2236
|
+
return c = Yt(w, h + 2, b).times(n + ""), g = at(new w(e + "." + t.slice(1)), h - p).plus(c), w.precision = b, s == null ? C(g, b, P, _ = !0) : g;
|
|
2237
2237
|
for (u = g, l = o = g = V(g.minus(1), g.plus(1), h, 1), f = C(g.times(g), h, 1), i = 3; ; ) {
|
|
2238
2238
|
if (o = C(o.times(f), h, 1), c = l.plus(V(o, new w(i), h, 1)), N(c.d).slice(0, h) === N(l.d).slice(0, h))
|
|
2239
|
-
if (l = l.times(2), n !== 0 && (l = l.plus(
|
|
2239
|
+
if (l = l.times(2), n !== 0 && (l = l.plus(Yt(w, h + 2, b).times(n + ""))), l = V(l, new w(m), h, 1), s == null)
|
|
2240
2240
|
if (kt(l.d, h - p, P, a))
|
|
2241
2241
|
w.precision = h += p, c = o = g = V(u.minus(1), u.plus(1), h, 1), f = C(g.times(g), h, 1), i = a = 1;
|
|
2242
2242
|
else
|
|
2243
|
-
return C(l, w.precision = b, P,
|
|
2243
|
+
return C(l, w.precision = b, P, _ = !0);
|
|
2244
2244
|
else
|
|
2245
2245
|
return w.precision = b, l;
|
|
2246
2246
|
l = c, i += 2;
|
|
@@ -2260,7 +2260,7 @@ function zt(r, s) {
|
|
|
2260
2260
|
} else
|
|
2261
2261
|
e -= i;
|
|
2262
2262
|
for (; e--; ) s += "0";
|
|
2263
|
-
r.d.push(+s),
|
|
2263
|
+
r.d.push(+s), _ && (r.e > r.constructor.maxE ? (r.d = null, r.e = NaN) : r.e < r.constructor.minE && (r.e = 0, r.d = [0]));
|
|
2264
2264
|
} else
|
|
2265
2265
|
r.e = 0, r.d = [0];
|
|
2266
2266
|
return r;
|
|
@@ -2278,31 +2278,31 @@ function di(r, s) {
|
|
|
2278
2278
|
else if (li.test(s))
|
|
2279
2279
|
t = 8;
|
|
2280
2280
|
else
|
|
2281
|
-
throw Error(
|
|
2281
|
+
throw Error(ct + s);
|
|
2282
2282
|
for (n = s.search(/p/i), n > 0 ? (l = +s.slice(n + 1), s = s.substring(2, n)) : s = s.slice(2), n = s.indexOf("."), o = n >= 0, e = r.constructor, o && (s = s.replace(".", ""), a = s.length, n = a - n, i = Be(e, new e(t), n, n * 2)), c = Ft(s, t, Q), h = c.length - 1, n = h; c[n] === 0; --n) c.pop();
|
|
2283
|
-
return n < 0 ? new e(r.s * 0) : (r.e =
|
|
2283
|
+
return n < 0 ? new e(r.s * 0) : (r.e = Zt(c, h), r.d = c, _ = !1, o && (r = V(r, i, a * 4)), l && (r = r.times(Math.abs(l) < 54 ? I(2, l) : R.pow(2, l))), _ = !0, r);
|
|
2284
2284
|
}
|
|
2285
2285
|
function fi(r, s) {
|
|
2286
2286
|
var t, e = s.d.length;
|
|
2287
2287
|
if (e < 3)
|
|
2288
|
-
return s.isZero() ? s :
|
|
2289
|
-
t = 1.4 * Math.sqrt(e), t = t > 16 ? 16 : t | 0, s = s.times(1 /
|
|
2288
|
+
return s.isZero() ? s : Mt(r, 2, s, s);
|
|
2289
|
+
t = 1.4 * Math.sqrt(e), t = t > 16 ? 16 : t | 0, s = s.times(1 / Qt(5, t)), s = Mt(r, 2, s, s);
|
|
2290
2290
|
for (var i, n = new r(5), o = new r(16), a = new r(20); t--; )
|
|
2291
2291
|
i = s.times(s), s = s.times(n.plus(i.times(o.times(i).minus(a))));
|
|
2292
2292
|
return s;
|
|
2293
2293
|
}
|
|
2294
|
-
function
|
|
2294
|
+
function Mt(r, s, t, e, i) {
|
|
2295
2295
|
var n, o, a, l, c = r.precision, h = Math.ceil(c / S);
|
|
2296
|
-
for (
|
|
2296
|
+
for (_ = !1, l = t.times(t), a = new r(e); ; ) {
|
|
2297
2297
|
if (o = V(a.times(l), new r(s++ * s++), c, 1), a = i ? e.plus(o) : e.minus(o), e = V(o.times(l), new r(s++ * s++), c, 1), o = a.plus(e), o.d[h] !== void 0) {
|
|
2298
2298
|
for (n = h; o.d[n] === a.d[n] && n--; ) ;
|
|
2299
2299
|
if (n == -1) break;
|
|
2300
2300
|
}
|
|
2301
2301
|
n = a, a = e, e = o, o = n;
|
|
2302
2302
|
}
|
|
2303
|
-
return
|
|
2303
|
+
return _ = !0, o.d.length = h + 1, o;
|
|
2304
2304
|
}
|
|
2305
|
-
function
|
|
2305
|
+
function Qt(r, s) {
|
|
2306
2306
|
for (var t = r; --s; ) t *= r;
|
|
2307
2307
|
return t;
|
|
2308
2308
|
}
|
|
@@ -2314,14 +2314,14 @@ function Xe(r, s) {
|
|
|
2314
2314
|
nt = e ? 3 : 2;
|
|
2315
2315
|
else {
|
|
2316
2316
|
if (s = s.minus(t.times(i)), s.lte(n))
|
|
2317
|
-
return nt =
|
|
2318
|
-
nt =
|
|
2317
|
+
return nt = Ce(t) ? e ? 2 : 3 : e ? 4 : 1, s;
|
|
2318
|
+
nt = Ce(t) ? e ? 1 : 4 : e ? 3 : 2;
|
|
2319
2319
|
}
|
|
2320
2320
|
return s.minus(i).abs();
|
|
2321
2321
|
}
|
|
2322
|
-
function
|
|
2322
|
+
function ve(r, s, t, e) {
|
|
2323
2323
|
var i, n, o, a, l, c, h, u, f, m = r.constructor, p = t !== void 0;
|
|
2324
|
-
if (p ? (U(t, 1,
|
|
2324
|
+
if (p ? (U(t, 1, ht), e === void 0 ? e = m.rounding : U(e, 0, 8)) : (t = m.precision, e = m.rounding), !r.isFinite())
|
|
2325
2325
|
h = Ge(r);
|
|
2326
2326
|
else {
|
|
2327
2327
|
for (h = et(r), o = h.indexOf("."), p ? (i = 2, s == 16 ? t = t * 4 - 3 : s == 8 && (t = t * 3 - 2)) : i = s, o >= 0 && (h = h.replace(".", ""), f = new m(1), f.e = h.length - o, f.d = Ft(et(f), 10, i), f.e = f.d.length), u = Ft(h, 10, i), n = l = u.length; u[--l] == 0; ) u.pop();
|
|
@@ -2332,13 +2332,13 @@ function ye(r, s, t, e) {
|
|
|
2332
2332
|
for (; ++u[--t] > i - 1; )
|
|
2333
2333
|
u[t] = 0, t || (++n, u.unshift(1));
|
|
2334
2334
|
for (l = u.length; !u[l - 1]; --l) ;
|
|
2335
|
-
for (o = 0, h = ""; o < l; o++) h +=
|
|
2335
|
+
for (o = 0, h = ""; o < l; o++) h += oe.charAt(u[o]);
|
|
2336
2336
|
if (p) {
|
|
2337
2337
|
if (l > 1)
|
|
2338
2338
|
if (s == 16 || s == 8) {
|
|
2339
2339
|
for (o = s == 16 ? 4 : 3, --l; l % o; l++) h += "0";
|
|
2340
2340
|
for (u = Ft(h, i, s), l = u.length; !u[l - 1]; --l) ;
|
|
2341
|
-
for (o = 1, h = "1."; o < l; o++) h +=
|
|
2341
|
+
for (o = 1, h = "1."; o < l; o++) h += oe.charAt(u[o]);
|
|
2342
2342
|
} else
|
|
2343
2343
|
h = h.charAt(0) + "." + h.slice(1);
|
|
2344
2344
|
h = h + (n < 0 ? "p" : "p+") + n;
|
|
@@ -2352,7 +2352,7 @@ function ye(r, s, t, e) {
|
|
|
2352
2352
|
}
|
|
2353
2353
|
return r.s < 0 ? "-" + h : h;
|
|
2354
2354
|
}
|
|
2355
|
-
function
|
|
2355
|
+
function Se(r, s) {
|
|
2356
2356
|
if (r.length > s)
|
|
2357
2357
|
return r.length = s, !0;
|
|
2358
2358
|
}
|
|
@@ -2391,15 +2391,15 @@ function Ci(r) {
|
|
|
2391
2391
|
function Si(r) {
|
|
2392
2392
|
return C(r = new this(r), r.e + 1, 2);
|
|
2393
2393
|
}
|
|
2394
|
-
function
|
|
2394
|
+
function _i(r, s, t) {
|
|
2395
2395
|
return new this(r).clamp(s, t);
|
|
2396
2396
|
}
|
|
2397
|
-
function
|
|
2398
|
-
if (!r || typeof r != "object") throw Error(
|
|
2397
|
+
function Ei(r) {
|
|
2398
|
+
if (!r || typeof r != "object") throw Error(qt + "Object expected");
|
|
2399
2399
|
var s, t, e, i = r.defaults === !0, n = [
|
|
2400
2400
|
"precision",
|
|
2401
2401
|
1,
|
|
2402
|
-
|
|
2402
|
+
ht,
|
|
2403
2403
|
"rounding",
|
|
2404
2404
|
0,
|
|
2405
2405
|
8,
|
|
@@ -2408,10 +2408,10 @@ function Mi(r) {
|
|
|
2408
2408
|
0,
|
|
2409
2409
|
"toExpPos",
|
|
2410
2410
|
0,
|
|
2411
|
-
|
|
2411
|
+
re,
|
|
2412
2412
|
"maxE",
|
|
2413
2413
|
0,
|
|
2414
|
-
|
|
2414
|
+
re,
|
|
2415
2415
|
"minE",
|
|
2416
2416
|
-9e15,
|
|
2417
2417
|
0,
|
|
@@ -2420,10 +2420,10 @@ function Mi(r) {
|
|
|
2420
2420
|
9
|
|
2421
2421
|
];
|
|
2422
2422
|
for (s = 0; s < n.length; s += 3)
|
|
2423
|
-
if (t = n[s], i && (this[t] =
|
|
2423
|
+
if (t = n[s], i && (this[t] = ae[t]), (e = r[t]) !== void 0)
|
|
2424
2424
|
if (F(e) === e && e >= n[s + 1] && e <= n[s + 2]) this[t] = e;
|
|
2425
|
-
else throw Error(
|
|
2426
|
-
if (t = "crypto", i && (this[t] =
|
|
2425
|
+
else throw Error(ct + t + ": " + e);
|
|
2426
|
+
if (t = "crypto", i && (this[t] = ae[t]), (e = r[t]) !== void 0)
|
|
2427
2427
|
if (e === !0 || e === !1 || e === 0 || e === 1)
|
|
2428
2428
|
if (e)
|
|
2429
2429
|
if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
|
|
@@ -2433,13 +2433,13 @@ function Mi(r) {
|
|
|
2433
2433
|
else
|
|
2434
2434
|
this[t] = !1;
|
|
2435
2435
|
else
|
|
2436
|
-
throw Error(
|
|
2436
|
+
throw Error(ct + t + ": " + e);
|
|
2437
2437
|
return this;
|
|
2438
2438
|
}
|
|
2439
|
-
function
|
|
2439
|
+
function Mi(r) {
|
|
2440
2440
|
return new this(r).cos();
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function Di(r) {
|
|
2443
2443
|
return new this(r).cosh();
|
|
2444
2444
|
}
|
|
2445
2445
|
function Ye(r) {
|
|
@@ -2447,8 +2447,8 @@ function Ye(r) {
|
|
|
2447
2447
|
function i(n) {
|
|
2448
2448
|
var o, a, l, c = this;
|
|
2449
2449
|
if (!(c instanceof i)) return new i(n);
|
|
2450
|
-
if (c.constructor = i,
|
|
2451
|
-
c.s = n.s,
|
|
2450
|
+
if (c.constructor = i, _e(n)) {
|
|
2451
|
+
c.s = n.s, _ ? !n.d || n.e > i.maxE ? (c.e = NaN, c.d = null) : n.e < i.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);
|
|
2452
2452
|
return;
|
|
2453
2453
|
}
|
|
2454
2454
|
if (l = typeof n, l === "number") {
|
|
@@ -2458,7 +2458,7 @@ function Ye(r) {
|
|
|
2458
2458
|
}
|
|
2459
2459
|
if (n < 0 ? (n = -n, c.s = -1) : c.s = 1, n === ~~n && n < 1e7) {
|
|
2460
2460
|
for (o = 0, a = n; a >= 10; a /= 10) o++;
|
|
2461
|
-
|
|
2461
|
+
_ ? o > i.maxE ? (c.e = NaN, c.d = null) : o < i.minE ? (c.e = 0, c.d = [0]) : (c.e = o, c.d = [n]) : (c.e = o, c.d = [n]);
|
|
2462
2462
|
return;
|
|
2463
2463
|
}
|
|
2464
2464
|
if (n * 0 !== 0) {
|
|
@@ -2471,13 +2471,13 @@ function Ye(r) {
|
|
|
2471
2471
|
return (a = n.charCodeAt(0)) === 45 ? (n = n.slice(1), c.s = -1) : (a === 43 && (n = n.slice(1)), c.s = 1), Fe.test(n) ? zt(c, n) : di(c, n);
|
|
2472
2472
|
if (l === "bigint")
|
|
2473
2473
|
return n < 0 ? (n = -n, c.s = -1) : c.s = 1, zt(c, n.toString());
|
|
2474
|
-
throw Error(
|
|
2474
|
+
throw Error(ct + n);
|
|
2475
2475
|
}
|
|
2476
|
-
if (i.prototype = v, i.ROUND_UP = 0, i.ROUND_DOWN = 1, i.ROUND_CEIL = 2, i.ROUND_FLOOR = 3, i.ROUND_HALF_UP = 4, i.ROUND_HALF_DOWN = 5, i.ROUND_HALF_EVEN = 6, i.ROUND_HALF_CEIL = 7, i.ROUND_HALF_FLOOR = 8, i.EUCLID = 9, i.config = i.set =
|
|
2476
|
+
if (i.prototype = v, i.ROUND_UP = 0, i.ROUND_DOWN = 1, i.ROUND_CEIL = 2, i.ROUND_FLOOR = 3, i.ROUND_HALF_UP = 4, i.ROUND_HALF_DOWN = 5, i.ROUND_HALF_EVEN = 6, i.ROUND_HALF_CEIL = 7, i.ROUND_HALF_FLOOR = 8, i.EUCLID = 9, i.config = i.set = Ei, i.clone = Ye, i.isDecimal = _e, i.abs = mi, i.acos = gi, i.acosh = pi, i.add = vi, i.asin = yi, i.asinh = wi, i.atan = xi, i.atanh = Pi, i.atan2 = bi, i.cbrt = Ci, i.ceil = Si, i.clamp = _i, i.cos = Mi, i.cosh = Di, i.div = Ri, i.exp = ki, i.floor = Vi, i.hypot = Oi, i.ln = Ai, i.log = Li, i.log10 = Ii, i.log2 = Ti, i.max = Ni, i.min = Hi, i.mod = Fi, i.mul = zi, i.pow = Bi, i.random = Ui, i.round = Gi, i.sign = Xi, i.sin = Yi, i.sinh = ji, i.sqrt = Wi, i.sub = $i, i.sum = qi, i.tan = Zi, i.tanh = Qi, i.trunc = Ji, r === void 0 && (r = {}), r && r.defaults !== !0)
|
|
2477
2477
|
for (e = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], s = 0; s < e.length; ) r.hasOwnProperty(t = e[s++]) || (r[t] = this[t]);
|
|
2478
2478
|
return i.config(r), i;
|
|
2479
2479
|
}
|
|
2480
|
-
function
|
|
2480
|
+
function Ri(r, s) {
|
|
2481
2481
|
return new this(r).div(s);
|
|
2482
2482
|
}
|
|
2483
2483
|
function ki(r) {
|
|
@@ -2486,22 +2486,22 @@ function ki(r) {
|
|
|
2486
2486
|
function Vi(r) {
|
|
2487
2487
|
return C(r = new this(r), r.e + 1, 3);
|
|
2488
2488
|
}
|
|
2489
|
-
function
|
|
2489
|
+
function Oi() {
|
|
2490
2490
|
var r, s, t = new this(0);
|
|
2491
|
-
for (
|
|
2491
|
+
for (_ = !1, r = 0; r < arguments.length; )
|
|
2492
2492
|
if (s = new this(arguments[r++]), s.d)
|
|
2493
2493
|
t.d && (t = t.plus(s.times(s)));
|
|
2494
2494
|
else {
|
|
2495
2495
|
if (s.s)
|
|
2496
|
-
return
|
|
2496
|
+
return _ = !0, new this(1 / 0);
|
|
2497
2497
|
t = s;
|
|
2498
2498
|
}
|
|
2499
|
-
return
|
|
2499
|
+
return _ = !0, t.sqrt();
|
|
2500
2500
|
}
|
|
2501
|
-
function
|
|
2502
|
-
return r instanceof
|
|
2501
|
+
function _e(r) {
|
|
2502
|
+
return r instanceof R || r && r.toStringTag === He || !1;
|
|
2503
2503
|
}
|
|
2504
|
-
function
|
|
2504
|
+
function Ai(r) {
|
|
2505
2505
|
return new this(r).ln();
|
|
2506
2506
|
}
|
|
2507
2507
|
function Li(r, s) {
|
|
@@ -2530,7 +2530,7 @@ function Bi(r, s) {
|
|
|
2530
2530
|
}
|
|
2531
2531
|
function Ui(r) {
|
|
2532
2532
|
var s, t, e, i, n = 0, o = new this(1), a = [];
|
|
2533
|
-
if (r === void 0 ? r = this.precision : U(r, 1,
|
|
2533
|
+
if (r === void 0 ? r = this.precision : U(r, 1, ht), e = Math.ceil(r / S), this.crypto)
|
|
2534
2534
|
if (crypto.getRandomValues)
|
|
2535
2535
|
for (s = crypto.getRandomValues(new Uint32Array(e)); n < e; )
|
|
2536
2536
|
i = s[n], i >= 429e7 ? s[n] = crypto.getRandomValues(new Uint32Array(1))[0] : a[n++] = i % 1e7;
|
|
@@ -2571,8 +2571,8 @@ function $i(r, s) {
|
|
|
2571
2571
|
}
|
|
2572
2572
|
function qi() {
|
|
2573
2573
|
var r = 0, s = arguments, t = new this(s[r]);
|
|
2574
|
-
for (
|
|
2575
|
-
return
|
|
2574
|
+
for (_ = !1; t.s && ++r < s.length; ) t = t.plus(s[r]);
|
|
2575
|
+
return _ = !0, C(t, this.precision, this.rounding);
|
|
2576
2576
|
}
|
|
2577
2577
|
function Zi(r) {
|
|
2578
2578
|
return new this(r).tan();
|
|
@@ -2585,9 +2585,9 @@ function Ji(r) {
|
|
|
2585
2585
|
}
|
|
2586
2586
|
v[Symbol.for("nodejs.util.inspect.custom")] = v.toString;
|
|
2587
2587
|
v[Symbol.toStringTag] = "Decimal";
|
|
2588
|
-
var
|
|
2589
|
-
|
|
2590
|
-
|
|
2588
|
+
var R = v.constructor = Ye(ae);
|
|
2589
|
+
Gt = new R(Gt);
|
|
2590
|
+
Xt = new R(Xt);
|
|
2591
2591
|
class Ki {
|
|
2592
2592
|
constructor() {
|
|
2593
2593
|
/** 父级 */
|
|
@@ -2617,6 +2617,11 @@ class Ki {
|
|
|
2617
2617
|
setMainCanvas(s) {
|
|
2618
2618
|
this.mainCanvas = s;
|
|
2619
2619
|
}
|
|
2620
|
+
/** 从父级移除自身 */
|
|
2621
|
+
remove() {
|
|
2622
|
+
var s;
|
|
2623
|
+
(s = this.parent) == null || s.removeChild(this);
|
|
2624
|
+
}
|
|
2620
2625
|
}
|
|
2621
2626
|
class ts extends Ki {
|
|
2622
2627
|
constructor() {
|
|
@@ -2666,7 +2671,7 @@ class ts extends Ki {
|
|
|
2666
2671
|
}
|
|
2667
2672
|
let es = class extends ts {
|
|
2668
2673
|
constructor(s) {
|
|
2669
|
-
super(), s.name = s.name ||
|
|
2674
|
+
super(), s.name = s.name || ne("default-name-"), Object.assign(this, { ...s });
|
|
2670
2675
|
}
|
|
2671
2676
|
};
|
|
2672
2677
|
class is extends es {
|
|
@@ -2772,19 +2777,19 @@ class Vt extends is {
|
|
|
2772
2777
|
contextmenu: /* @__PURE__ */ new Set(),
|
|
2773
2778
|
click: /* @__PURE__ */ new Set(),
|
|
2774
2779
|
doubleClick: /* @__PURE__ */ new Set(),
|
|
2775
|
-
|
|
2780
|
+
drag: /* @__PURE__ */ new Set()
|
|
2776
2781
|
});
|
|
2777
2782
|
/** 共享事件状态集合 控制器 */
|
|
2778
2783
|
d(this, "sharedControllers", {});
|
|
2779
2784
|
d(this, "_eventDate", {});
|
|
2780
|
-
d(this, "
|
|
2785
|
+
d(this, "_clearEventData", !1);
|
|
2781
2786
|
d(this, "_isHover", !1);
|
|
2782
2787
|
/**
|
|
2783
2788
|
* 接收悬停状态变更通知(由外部事件处理器判断后调用)
|
|
2784
2789
|
* @param state - 当前悬停状态(true:进入元素 / false:离开元素)
|
|
2785
2790
|
* @param [event] - 可选的关联鼠标事件对象
|
|
2786
2791
|
*/
|
|
2787
|
-
d(this, "notifyHover", (t, e) => this.
|
|
2792
|
+
d(this, "notifyHover", (t, e) => this.checkEventData("hover", t) && this.trigger(
|
|
2788
2793
|
"hover",
|
|
2789
2794
|
{ state: t, oldState: this.isHover },
|
|
2790
2795
|
e,
|
|
@@ -2796,14 +2801,14 @@ class Vt extends is {
|
|
|
2796
2801
|
* @param state - 当前按下状态(true:按下开始 / false:按下结束)
|
|
2797
2802
|
* @param [event] - 可选的关联鼠标事件对象
|
|
2798
2803
|
*/
|
|
2799
|
-
d(this, "notifyDown", (t, e) => this.
|
|
2804
|
+
d(this, "notifyDown", (t, e) => this.checkEventData("down", t) && this.trigger("down", { state: t, oldState: this.isDown }, e, "isDownable"));
|
|
2800
2805
|
d(this, "_isContextmenu", !1);
|
|
2801
2806
|
/**
|
|
2802
2807
|
* 接收右键菜单触发通知(由外部事件处理器判断后调用)
|
|
2803
2808
|
* @param state - 右键触发状态(true: 右键开始 / false: 右键结束)
|
|
2804
2809
|
* @param [event] - 可选的关联鼠标事件对象
|
|
2805
2810
|
*/
|
|
2806
|
-
d(this, "notifyContextmenu", (t, e) => this.
|
|
2811
|
+
d(this, "notifyContextmenu", (t, e) => this.checkEventData("contextmenu", t) && this.trigger(
|
|
2807
2812
|
"contextmenu",
|
|
2808
2813
|
{ state: t, oldState: this.isContextmenu },
|
|
2809
2814
|
e,
|
|
@@ -2820,7 +2825,7 @@ class Vt extends is {
|
|
|
2820
2825
|
* @param [event] - 可选的关联鼠标事件对象
|
|
2821
2826
|
*/
|
|
2822
2827
|
d(this, "notifyClick", (t, e) => {
|
|
2823
|
-
if (!this.
|
|
2828
|
+
if (!this.checkEventData("click", t)) return;
|
|
2824
2829
|
let i = !1;
|
|
2825
2830
|
t ? (i = Date.now() - this.clickTimestamp < this.doubleClickInterval, this.clickTimestamp = i ? 0 : Date.now()) : (this._isDblClick = !1, this.clickTimestamp = 0), i ? this.notifyDoubleClick(i, e) : this.trigger(
|
|
2826
2831
|
"click",
|
|
@@ -2835,7 +2840,7 @@ class Vt extends is {
|
|
|
2835
2840
|
* @param state - 双击状态(true: 双击开始 / false: 双击结束)
|
|
2836
2841
|
* @param [event] - 可选的关联鼠标事件对象
|
|
2837
2842
|
*/
|
|
2838
|
-
d(this, "notifyDoubleClick", (t, e) => this.
|
|
2843
|
+
d(this, "notifyDoubleClick", (t, e) => this.checkEventData("doubleClick", t) && this.trigger(
|
|
2839
2844
|
"doubleClick",
|
|
2840
2845
|
{ state: t, oldState: this.isDblClick },
|
|
2841
2846
|
e,
|
|
@@ -2848,13 +2853,13 @@ class Vt extends is {
|
|
|
2848
2853
|
* @param position.offsetY - 相对于元素Y轴的偏移量
|
|
2849
2854
|
* @param [event] - 可选的关联鼠标事件对象
|
|
2850
2855
|
*/
|
|
2851
|
-
d(this, "
|
|
2856
|
+
d(this, "notifyDrag", (t, e) => this.checkEventData("drag", t) && this.trigger("drag", t, e, "isDraggable"));
|
|
2852
2857
|
/**
|
|
2853
2858
|
* 接收滚轮滚动通知(由外部事件处理器判断滚轮动作后调用)
|
|
2854
2859
|
* @param step - 滚轮滚动步长(正数:向上滚动 / 负数:向下滚动)
|
|
2855
2860
|
* @param [event] - 可选的关联滚轮事件对象
|
|
2856
2861
|
*/
|
|
2857
|
-
d(this, "notifyWheel", (t, e) => this.
|
|
2862
|
+
d(this, "notifyWheel", (t, e) => this.checkEventData("wheel", t) && this.trigger("wheel", t, e, "isWheelable"));
|
|
2858
2863
|
}
|
|
2859
2864
|
/** 添加事件监听器 */
|
|
2860
2865
|
addEventListener(t, e) {
|
|
@@ -2880,7 +2885,7 @@ class Vt extends is {
|
|
|
2880
2885
|
this.updateStates(t, e);
|
|
2881
2886
|
const o = new ss(e);
|
|
2882
2887
|
this.listeners[t].forEach((u) => u(o, i));
|
|
2883
|
-
const a = "notify" + (t.charAt(0).toUpperCase() + t.slice(1)), l = ["
|
|
2888
|
+
const a = "notify" + (t.charAt(0).toUpperCase() + t.slice(1)), l = ["notifyDrag", "notifyWheel"].includes(a) ? e : e.state;
|
|
2884
2889
|
o.canPropagate && ((c = this.parent) == null || c[a](l, i)), (h = this.sharedControllers[t]) == null || h.forEach(
|
|
2885
2890
|
(u) => u !== this && u[a](l, i)
|
|
2886
2891
|
);
|
|
@@ -2906,10 +2911,10 @@ class Vt extends is {
|
|
|
2906
2911
|
break;
|
|
2907
2912
|
}
|
|
2908
2913
|
}
|
|
2909
|
-
|
|
2914
|
+
checkEventData(t, e) {
|
|
2910
2915
|
const i = this._eventDate[t], n = JSON.stringify(e);
|
|
2911
|
-
return i == n ? !1 : (this._eventDate[t] = n, this.
|
|
2912
|
-
this.
|
|
2916
|
+
return i == n ? !1 : (this._eventDate[t] = n, this._clearEventData || (this._clearEventData = !0, Promise.resolve().then(() => {
|
|
2917
|
+
this._clearEventData = !1, this._eventDate = {};
|
|
2913
2918
|
})), !0);
|
|
2914
2919
|
}
|
|
2915
2920
|
/** 是否触发悬停 */
|
|
@@ -3033,6 +3038,9 @@ class ns extends Vt {
|
|
|
3033
3038
|
set redrawInNextRenderFrame(t) {
|
|
3034
3039
|
this._redrawInNextRenderFrame = t;
|
|
3035
3040
|
}
|
|
3041
|
+
/** 占位,由子类实现 */
|
|
3042
|
+
removeChild(t) {
|
|
3043
|
+
}
|
|
3036
3044
|
setNotifyReload(t) {
|
|
3037
3045
|
this.notifyReload = t;
|
|
3038
3046
|
}
|
|
@@ -3091,7 +3099,7 @@ class ns extends Vt {
|
|
|
3091
3099
|
let l, c;
|
|
3092
3100
|
t === "center" ? (l = a.left + a.width / 2, c = a.top + a.height / 2) : [l, c] = [t.clientX, t.clientY];
|
|
3093
3101
|
const h = this.getMousePositionOnAxis({ clientX: l, clientY: c }), u = this.getAxisValueByPoint(h.x, h.y);
|
|
3094
|
-
this.scale = new
|
|
3102
|
+
this.scale = new R(this.scale).add(e).toNumber(), this.isScaleUpdated = !0, this.updateSize();
|
|
3095
3103
|
const f = this.getAxisPointByValue(
|
|
3096
3104
|
u.xV,
|
|
3097
3105
|
u.yV
|
|
@@ -3125,7 +3133,7 @@ class ns extends Vt {
|
|
|
3125
3133
|
*/
|
|
3126
3134
|
getGridSize(t) {
|
|
3127
3135
|
const { cycle: e, delta: i, axisConfig: n } = this;
|
|
3128
|
-
let o = new
|
|
3136
|
+
let o = new R(t).sub(1).abs().mod(e * i).div(i).toNumber();
|
|
3129
3137
|
return o = t < 1 && o != 0 ? e - o : o, Number(((o / e + 1) * n.min).toFixed(0));
|
|
3130
3138
|
}
|
|
3131
3139
|
/**
|
|
@@ -3137,11 +3145,11 @@ class ns extends Vt {
|
|
|
3137
3145
|
const { axisConfig: e, cycle: i, delta: n } = this, o = e.count, a = i * n;
|
|
3138
3146
|
if (t === 1) return o;
|
|
3139
3147
|
if (t > 1) {
|
|
3140
|
-
const l = new
|
|
3141
|
-
return new
|
|
3148
|
+
const l = new R(t).sub(1).div(a).floor();
|
|
3149
|
+
return new R(o).div(new R(2).pow(l)).toNumber();
|
|
3142
3150
|
} else {
|
|
3143
|
-
const l = new
|
|
3144
|
-
return new
|
|
3151
|
+
const l = new R(1).sub(t).div(a).ceil();
|
|
3152
|
+
return new R(o).mul(new R(2).pow(l)).toNumber();
|
|
3145
3153
|
}
|
|
3146
3154
|
}
|
|
3147
3155
|
/** 获取每个网格表示的数字 */
|
|
@@ -3164,7 +3172,7 @@ class ns extends Vt {
|
|
|
3164
3172
|
xV: t / n.min * n.count,
|
|
3165
3173
|
yV: e / n.min * n.count
|
|
3166
3174
|
};
|
|
3167
|
-
const o = this.getNowGridCount, a = new
|
|
3175
|
+
const o = this.getNowGridCount, a = new R(t).div(n.size).mul(o).toFixed(8), l = new R(e).div(n.size).mul(o).toFixed(8);
|
|
3168
3176
|
return { xV: Number(a), yV: Number(l) };
|
|
3169
3177
|
}
|
|
3170
3178
|
/** 通过坐标轴上的值 获取坐标轴上的点 */
|
|
@@ -3175,7 +3183,7 @@ class ns extends Vt {
|
|
|
3175
3183
|
x: t / n.count * n.min,
|
|
3176
3184
|
y: e / n.count * n.min
|
|
3177
3185
|
};
|
|
3178
|
-
const o = this.getNowGridCount, a = new
|
|
3186
|
+
const o = this.getNowGridCount, a = new R(t).div(o).mul(n.size).toFixed(3), l = new R(e).div(o).mul(n.size).toFixed(3);
|
|
3179
3187
|
return { x: Number(a), y: Number(l) };
|
|
3180
3188
|
}
|
|
3181
3189
|
/** 获取最大/小的 值 */
|
|
@@ -3456,7 +3464,7 @@ class rs extends ns {
|
|
|
3456
3464
|
const i = si(
|
|
3457
3465
|
this.style[e] || this.style[this.theme]
|
|
3458
3466
|
);
|
|
3459
|
-
|
|
3467
|
+
lt(i, t[e]), this.style[e] = i;
|
|
3460
3468
|
}
|
|
3461
3469
|
this.initStyle();
|
|
3462
3470
|
}
|
|
@@ -3465,7 +3473,7 @@ class rs extends ns {
|
|
|
3465
3473
|
t in this.style && (this.theme = t, this.isThemeUpdated = !0);
|
|
3466
3474
|
}
|
|
3467
3475
|
}
|
|
3468
|
-
class
|
|
3476
|
+
class D extends Vt {
|
|
3469
3477
|
constructor(t) {
|
|
3470
3478
|
t = { ...t }, t.isDraggable = t.isDraggable ?? !1;
|
|
3471
3479
|
const { mainCanvas: e, notifyReload: i } = t;
|
|
@@ -3731,7 +3739,7 @@ class R extends Vt {
|
|
|
3731
3739
|
handleValuePosition(t, e) {
|
|
3732
3740
|
let { value: i, position: n, mainCanvas: o } = this;
|
|
3733
3741
|
if (!o) return !1;
|
|
3734
|
-
const a = t === "array1D" ?
|
|
3742
|
+
const a = t === "array1D" ? pe : Ut, [l, c] = [
|
|
3735
3743
|
a(i) && (!e || i.length >= e),
|
|
3736
3744
|
a(n) && (!e || n.length >= e)
|
|
3737
3745
|
], h = {
|
|
@@ -3787,9 +3795,12 @@ class R extends Vt {
|
|
|
3787
3795
|
get cursorStyle() {
|
|
3788
3796
|
return this.isInteractive ? this.isDraggable ? "_nhanh_canvas_hover_overlay_draggable" : "_nhanh_canvas_hover_overlay" : void 0;
|
|
3789
3797
|
}
|
|
3798
|
+
/** 占位,无实际意义 */
|
|
3799
|
+
removeChild() {
|
|
3800
|
+
}
|
|
3790
3801
|
}
|
|
3791
|
-
d(
|
|
3792
|
-
class
|
|
3802
|
+
d(D, "ctx", document.createElement("canvas").getContext("2d"));
|
|
3803
|
+
class he extends D {
|
|
3793
3804
|
constructor(t) {
|
|
3794
3805
|
super(t);
|
|
3795
3806
|
d(this, "_draw");
|
|
@@ -3822,13 +3833,13 @@ class Bt extends R {
|
|
|
3822
3833
|
n[1],
|
|
3823
3834
|
!0
|
|
3824
3835
|
);
|
|
3825
|
-
e.push([o.x, o.y]), n[0] != 0 ? i = new
|
|
3836
|
+
e.push([o.x, o.y]), n[0] != 0 ? i = new R(o.x).div(n[0]).toNumber() : n[1] != 0 && (i = new R(o.y).div(n[1]).toNumber());
|
|
3826
3837
|
} else
|
|
3827
3838
|
e.push([
|
|
3828
3839
|
// this.mainCanvas!.preservePrecision(scale * item[0]),
|
|
3829
3840
|
// this.mainCanvas!.preservePrecision(scale * item[1]),
|
|
3830
|
-
new
|
|
3831
|
-
new
|
|
3841
|
+
new R(i).mul(n[0]).toNumber(),
|
|
3842
|
+
new R(i).mul(n[1]).toNumber()
|
|
3832
3843
|
]);
|
|
3833
3844
|
}), e;
|
|
3834
3845
|
}
|
|
@@ -3842,13 +3853,13 @@ class Bt extends R {
|
|
|
3842
3853
|
n[1],
|
|
3843
3854
|
!0
|
|
3844
3855
|
);
|
|
3845
|
-
e.push([a.xV, a.yV]), n[0] != 0 ? i = new
|
|
3856
|
+
e.push([a.xV, a.yV]), n[0] != 0 ? i = new R(a.xV).div(n[0]).toNumber() : n[1] != 0 && (i = new R(a.yV).div(n[1]).toNumber());
|
|
3846
3857
|
} else
|
|
3847
3858
|
e.push([
|
|
3848
3859
|
// this.mainCanvas!.preservePrecision(scale * item[0]),
|
|
3849
3860
|
// this.mainCanvas!.preservePrecision(scale * item[1]),
|
|
3850
|
-
new
|
|
3851
|
-
new
|
|
3861
|
+
new R(i).mul(n[0]).toNumber(),
|
|
3862
|
+
new R(i).mul(n[1]).toNumber()
|
|
3852
3863
|
]);
|
|
3853
3864
|
}), e;
|
|
3854
3865
|
}
|
|
@@ -3885,25 +3896,25 @@ class Bt extends R {
|
|
|
3885
3896
|
}
|
|
3886
3897
|
class k {
|
|
3887
3898
|
static add(s, t) {
|
|
3888
|
-
return new
|
|
3899
|
+
return new R(s).add(t).toNumber();
|
|
3889
3900
|
}
|
|
3890
3901
|
static sub(s, t) {
|
|
3891
|
-
return new
|
|
3902
|
+
return new R(s).sub(t).toNumber();
|
|
3892
3903
|
}
|
|
3893
3904
|
static mul(s, t) {
|
|
3894
|
-
return new
|
|
3905
|
+
return new R(s).mul(t).toNumber();
|
|
3895
3906
|
}
|
|
3896
3907
|
static div(s, t) {
|
|
3897
|
-
return new
|
|
3908
|
+
return new R(s).div(t).toNumber();
|
|
3898
3909
|
}
|
|
3899
3910
|
}
|
|
3900
|
-
class
|
|
3911
|
+
class ue extends D {
|
|
3901
3912
|
constructor(t) {
|
|
3902
3913
|
super(t);
|
|
3903
3914
|
/** 文字偏差 */
|
|
3904
3915
|
d(this, "textOffset", { x: 0, y: 0 });
|
|
3905
3916
|
d(this, "_text");
|
|
3906
|
-
d(this, "
|
|
3917
|
+
d(this, "defaultDrag", (t, e) => {
|
|
3907
3918
|
var l;
|
|
3908
3919
|
const { offsetX: i, offsetY: n } = t.data, { x: o, y: a } = this.calculateOffset(i, n);
|
|
3909
3920
|
this.internalUpdate(
|
|
@@ -3925,7 +3936,7 @@ class Ut extends R {
|
|
|
3925
3936
|
), (l = this.notifyReload) == null || l.call(this);
|
|
3926
3937
|
});
|
|
3927
3938
|
const { text: e } = t;
|
|
3928
|
-
Object.assign(this, { text: e }), this.addEventListener("
|
|
3939
|
+
Object.assign(this, { text: e }), this.addEventListener("drag", this.defaultDrag);
|
|
3929
3940
|
}
|
|
3930
3941
|
/** 文字 */
|
|
3931
3942
|
get text() {
|
|
@@ -3946,7 +3957,7 @@ class Ut extends R {
|
|
|
3946
3957
|
});
|
|
3947
3958
|
}
|
|
3948
3959
|
isPointInPath(t, e) {
|
|
3949
|
-
return this.path ?
|
|
3960
|
+
return this.path ? D.ctx.isPointInPath(this.path, t, e) : !1;
|
|
3950
3961
|
}
|
|
3951
3962
|
isPointInStroke(t, e) {
|
|
3952
3963
|
return !1;
|
|
@@ -3955,7 +3966,7 @@ class Ut extends R {
|
|
|
3955
3966
|
if (!this.mainCanvas) return;
|
|
3956
3967
|
if (!this.text || this.text.length == 0)
|
|
3957
3968
|
return this.internalUpdate({ dynamicPosition: void 0 });
|
|
3958
|
-
const t =
|
|
3969
|
+
const t = D.ctx;
|
|
3959
3970
|
this.setOverlayStyles(t);
|
|
3960
3971
|
const e = t.measureText(this.text);
|
|
3961
3972
|
this.textOffset = {
|
|
@@ -3997,11 +4008,11 @@ class Ut extends R {
|
|
|
3997
4008
|
}
|
|
3998
4009
|
}
|
|
3999
4010
|
}
|
|
4000
|
-
class
|
|
4011
|
+
class pt extends D {
|
|
4001
4012
|
constructor(t) {
|
|
4002
4013
|
super(t);
|
|
4003
4014
|
d(this, "angle", 2 * Math.PI);
|
|
4004
|
-
d(this, "
|
|
4015
|
+
d(this, "defaultDrag", (t, e) => {
|
|
4005
4016
|
var l;
|
|
4006
4017
|
const { offsetX: i, offsetY: n } = t.data, { x: o, y: a } = this.calculateOffset(i, n);
|
|
4007
4018
|
this.internalUpdate(
|
|
@@ -4033,7 +4044,7 @@ class lt extends R {
|
|
|
4033
4044
|
n - 100
|
|
4034
4045
|
) : i && this.startNewHoverAnimation(o, n);
|
|
4035
4046
|
});
|
|
4036
|
-
this.addEventListener("hover", this.defaultHover), this.addEventListener("
|
|
4047
|
+
this.addEventListener("hover", this.defaultHover), this.addEventListener("drag", this.defaultDrag);
|
|
4037
4048
|
}
|
|
4038
4049
|
updateValueScope() {
|
|
4039
4050
|
this.initValueScope();
|
|
@@ -4042,7 +4053,7 @@ class lt extends R {
|
|
|
4042
4053
|
cancelAndRestartAnimation(t, e, i) {
|
|
4043
4054
|
this.fillProgress.scheduleCallback();
|
|
4044
4055
|
let n = 0;
|
|
4045
|
-
this.fillProgress.scheduleCallback =
|
|
4056
|
+
this.fillProgress.scheduleCallback = Bt((o) => {
|
|
4046
4057
|
!this.fillProgress || !o || (this.fillProgress.progress += (o - n) * (t ? 1 : -1), n = o, this.fillProgress.progress = Math.min(
|
|
4047
4058
|
1,
|
|
4048
4059
|
Math.max(0, this.fillProgress.progress)
|
|
@@ -4054,7 +4065,7 @@ class lt extends R {
|
|
|
4054
4065
|
this.fillProgress = {
|
|
4055
4066
|
lineWidthOffset: 0,
|
|
4056
4067
|
progress: 0,
|
|
4057
|
-
scheduleCallback:
|
|
4068
|
+
scheduleCallback: Bt((i) => {
|
|
4058
4069
|
this.fillProgress && (this.fillProgress.progress = i, this.updateLineWidthOffset(t));
|
|
4059
4070
|
}, e)
|
|
4060
4071
|
};
|
|
@@ -4067,13 +4078,13 @@ class lt extends R {
|
|
|
4067
4078
|
e !== this.fillProgress.lineWidthOffset && (this.fillProgress.lineWidthOffset = e, (i = this.notifyReload) == null || i.call(this));
|
|
4068
4079
|
}
|
|
4069
4080
|
isPointInPath(t, e) {
|
|
4070
|
-
return this.path ?
|
|
4081
|
+
return this.path ? D.ctx.isPointInPath(this.path, t, e) : !1;
|
|
4071
4082
|
}
|
|
4072
4083
|
isPointInStroke(t, e) {
|
|
4073
4084
|
var i;
|
|
4074
4085
|
if (this.path && this.mainCanvas) {
|
|
4075
|
-
const { width: n } = this.setOverlayStyles(
|
|
4076
|
-
return ((i = this.fillProgress) == null ? void 0 : i.lineWidthOffset) == n ? !1 :
|
|
4086
|
+
const { width: n } = this.setOverlayStyles(D.ctx);
|
|
4087
|
+
return ((i = this.fillProgress) == null ? void 0 : i.lineWidthOffset) == n ? !1 : D.ctx.isPointInStroke(this.path, t, e);
|
|
4077
4088
|
}
|
|
4078
4089
|
return !1;
|
|
4079
4090
|
}
|
|
@@ -4113,7 +4124,7 @@ class lt extends R {
|
|
|
4113
4124
|
}
|
|
4114
4125
|
}
|
|
4115
4126
|
}
|
|
4116
|
-
class je extends
|
|
4127
|
+
class je extends D {
|
|
4117
4128
|
constructor(t) {
|
|
4118
4129
|
super(t);
|
|
4119
4130
|
/** 控制点 */
|
|
@@ -4149,7 +4160,7 @@ class je extends R {
|
|
|
4149
4160
|
}
|
|
4150
4161
|
});
|
|
4151
4162
|
/** 处理拖动状态变化 */
|
|
4152
|
-
d(this, "
|
|
4163
|
+
d(this, "defaultDrag", (t, e) => {
|
|
4153
4164
|
var n;
|
|
4154
4165
|
if (!this.mainCanvas) return;
|
|
4155
4166
|
const i = () => {
|
|
@@ -4182,14 +4193,14 @@ class je extends R {
|
|
|
4182
4193
|
);
|
|
4183
4194
|
if (o != -1) {
|
|
4184
4195
|
const a = this.handlePoints[o];
|
|
4185
|
-
a.
|
|
4196
|
+
a.notifyDrag(t.data, e), this.value[o] = a.value, this.position[o] = a.position, this.dynamicPosition[o] = a.dynamicPosition;
|
|
4186
4197
|
} else i();
|
|
4187
4198
|
} else i();
|
|
4188
4199
|
(n = this.notifyReload) == null || n.call(this), this.updateValueScope();
|
|
4189
4200
|
});
|
|
4190
4201
|
["isHandlePointsVisible", "canCreateOrDeleteHandlePoint"].forEach((e) => {
|
|
4191
4202
|
e in t && (this[e] = t[e]);
|
|
4192
|
-
}), this.addEventListener("click", this.defaultClick), this.addEventListener("doubleClick", this.defaultDoubleClick), this.addEventListener("
|
|
4203
|
+
}), this.addEventListener("click", this.defaultClick), this.addEventListener("doubleClick", this.defaultDoubleClick), this.addEventListener("drag", this.defaultDrag);
|
|
4193
4204
|
}
|
|
4194
4205
|
/** 是否可显示控制点 */
|
|
4195
4206
|
get isHandlePointsVisible() {
|
|
@@ -4233,17 +4244,17 @@ class je extends R {
|
|
|
4233
4244
|
}
|
|
4234
4245
|
/** 创建新的控制点 */
|
|
4235
4246
|
createNewHandlePoint(t, e) {
|
|
4236
|
-
const i =
|
|
4247
|
+
const i = te(
|
|
4237
4248
|
this.value[t],
|
|
4238
4249
|
this.value[e]
|
|
4239
|
-
), n =
|
|
4250
|
+
), n = te(
|
|
4240
4251
|
this.position[t],
|
|
4241
4252
|
this.position[e]
|
|
4242
|
-
), o =
|
|
4253
|
+
), o = te(
|
|
4243
4254
|
this.dynamicPosition[t],
|
|
4244
4255
|
this.dynamicPosition[e]
|
|
4245
4256
|
);
|
|
4246
|
-
return new
|
|
4257
|
+
return new pt({
|
|
4247
4258
|
value: i,
|
|
4248
4259
|
position: n,
|
|
4249
4260
|
dynamicPosition: o,
|
|
@@ -4282,7 +4293,7 @@ class je extends R {
|
|
|
4282
4293
|
let { value: t, position: e, dynamicPosition: i, offset: n, isHandlePointsVisible: o } = this;
|
|
4283
4294
|
!i || !o || (t == null || t.forEach((a, l) => {
|
|
4284
4295
|
if (!this.handlePoints[l]) {
|
|
4285
|
-
const c = new
|
|
4296
|
+
const c = new pt({
|
|
4286
4297
|
value: [0, 0],
|
|
4287
4298
|
mainCanvas: this.mainCanvas,
|
|
4288
4299
|
isDraggable: !0,
|
|
@@ -4327,11 +4338,11 @@ function os(r, s, t = 10) {
|
|
|
4327
4338
|
}
|
|
4328
4339
|
return i;
|
|
4329
4340
|
}
|
|
4330
|
-
function
|
|
4341
|
+
function te(r, s) {
|
|
4331
4342
|
const { x: t, y: e } = qe(...r, ...s);
|
|
4332
4343
|
return [t, e];
|
|
4333
4344
|
}
|
|
4334
|
-
class
|
|
4345
|
+
class de extends je {
|
|
4335
4346
|
constructor(t) {
|
|
4336
4347
|
super(t);
|
|
4337
4348
|
d(this, "_isInfinite");
|
|
@@ -4355,7 +4366,7 @@ class Gt extends je {
|
|
|
4355
4366
|
return !1;
|
|
4356
4367
|
}
|
|
4357
4368
|
isPointInStroke(t, e) {
|
|
4358
|
-
return this.path && this.mainCanvas ? (this.setOverlayStyles(
|
|
4369
|
+
return this.path && this.mainCanvas ? (this.setOverlayStyles(D.ctx), this.isDraggable && (D.ctx.lineWidth = Math.max(D.ctx.lineWidth, 20)), D.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
4359
4370
|
}
|
|
4360
4371
|
isPointInAnywhere(t, e) {
|
|
4361
4372
|
return ((n) => {
|
|
@@ -4393,7 +4404,7 @@ class Gt extends je {
|
|
|
4393
4404
|
var o;
|
|
4394
4405
|
const e = this.mainCanvas, i = e.style[e.theme].line;
|
|
4395
4406
|
let n = {};
|
|
4396
|
-
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.line) || i : typeof this.style == "object" ? n =
|
|
4407
|
+
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.line) || i : typeof this.style == "object" ? n = lt(
|
|
4397
4408
|
JSON.parse(JSON.stringify(i)),
|
|
4398
4409
|
this.style
|
|
4399
4410
|
) : n = i, t && this.setBaseLineStyle(t, n.stroke), n;
|
|
@@ -4422,12 +4433,12 @@ class Gt extends je {
|
|
|
4422
4433
|
const { rect: n } = e, [o, a] = i, l = [a[0] - o[0], a[1] - o[1]];
|
|
4423
4434
|
if (l[0] === 0 && l[1] === 0)
|
|
4424
4435
|
return console.error("重合点无法确定方向");
|
|
4425
|
-
const c =
|
|
4436
|
+
const c = Ee(
|
|
4426
4437
|
o,
|
|
4427
4438
|
[-l[0], -l[1]],
|
|
4428
4439
|
n.width,
|
|
4429
4440
|
n.height
|
|
4430
|
-
), h =
|
|
4441
|
+
), h = Ee(
|
|
4431
4442
|
a,
|
|
4432
4443
|
l,
|
|
4433
4444
|
n.width,
|
|
@@ -4442,7 +4453,7 @@ class Gt extends je {
|
|
|
4442
4453
|
}
|
|
4443
4454
|
}
|
|
4444
4455
|
}
|
|
4445
|
-
function
|
|
4456
|
+
function Ee(r, s, t, e) {
|
|
4446
4457
|
const [i, n] = r, [o, a] = s;
|
|
4447
4458
|
let l = 1 / 0;
|
|
4448
4459
|
if (o !== 0) {
|
|
@@ -4479,7 +4490,7 @@ function as(r, s, t, e) {
|
|
|
4479
4490
|
}
|
|
4480
4491
|
return m && p;
|
|
4481
4492
|
}
|
|
4482
|
-
class
|
|
4493
|
+
class fe extends je {
|
|
4483
4494
|
constructor(t) {
|
|
4484
4495
|
super(t);
|
|
4485
4496
|
d(this, "_isRect", !1);
|
|
@@ -4521,10 +4532,10 @@ class Xt extends je {
|
|
|
4521
4532
|
this.initValueScope();
|
|
4522
4533
|
}
|
|
4523
4534
|
isPointInPath(t, e) {
|
|
4524
|
-
return this.path ?
|
|
4535
|
+
return this.path ? D.ctx.isPointInPath(this.path, t, e) : !1;
|
|
4525
4536
|
}
|
|
4526
4537
|
isPointInStroke(t, e) {
|
|
4527
|
-
return this.path && this.mainCanvas ? (this.setOverlayStyles(
|
|
4538
|
+
return this.path && this.mainCanvas ? (this.setOverlayStyles(D.ctx), this.isDraggable && (D.ctx.lineWidth = Math.max(D.ctx.lineWidth, 20)), D.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
4528
4539
|
}
|
|
4529
4540
|
isPointInAnywhere(t, e) {
|
|
4530
4541
|
return ((n) => {
|
|
@@ -4574,7 +4585,7 @@ class Xt extends je {
|
|
|
4574
4585
|
var c;
|
|
4575
4586
|
const e = this.isHover, i = this.mainCanvas, n = i.style[i.theme].polygon;
|
|
4576
4587
|
let o = {};
|
|
4577
|
-
typeof this.style == "string" ? o = ((c = i.style[this.style]) == null ? void 0 : c.polygon) || n : typeof this.style == "object" ? o =
|
|
4588
|
+
typeof this.style == "string" ? o = ((c = i.style[this.style]) == null ? void 0 : c.polygon) || n : typeof this.style == "object" ? o = lt(
|
|
4578
4589
|
JSON.parse(JSON.stringify(n)),
|
|
4579
4590
|
this.style
|
|
4580
4591
|
) : o = n;
|
|
@@ -4616,7 +4627,7 @@ class Xt extends je {
|
|
|
4616
4627
|
}
|
|
4617
4628
|
}
|
|
4618
4629
|
}
|
|
4619
|
-
class
|
|
4630
|
+
class me extends D {
|
|
4620
4631
|
constructor(t) {
|
|
4621
4632
|
super(t);
|
|
4622
4633
|
d(this, "_isFill", !1);
|
|
@@ -4639,7 +4650,7 @@ class Yt extends R {
|
|
|
4639
4650
|
i != n && ((o = this.notifyReload) == null || o.call(this));
|
|
4640
4651
|
});
|
|
4641
4652
|
/** 处理拖动状态变化 */
|
|
4642
|
-
d(this, "
|
|
4653
|
+
d(this, "defaultDrag", (t, e) => {
|
|
4643
4654
|
if (!this.mainCanvas) return;
|
|
4644
4655
|
const i = () => {
|
|
4645
4656
|
var h;
|
|
@@ -4697,7 +4708,7 @@ class Yt extends R {
|
|
|
4697
4708
|
"isHandlePointsVisible"
|
|
4698
4709
|
].forEach((e) => {
|
|
4699
4710
|
e in t && (this["_" + e] = t[e]);
|
|
4700
|
-
}), this.addEventListener("click", this.defaultClick), this.addEventListener("
|
|
4711
|
+
}), this.addEventListener("click", this.defaultClick), this.addEventListener("drag", this.defaultDrag);
|
|
4701
4712
|
}
|
|
4702
4713
|
/** 是否填充 */
|
|
4703
4714
|
get isFill() {
|
|
@@ -4788,10 +4799,10 @@ class Yt extends R {
|
|
|
4788
4799
|
}));
|
|
4789
4800
|
}
|
|
4790
4801
|
isPointInPath(t, e) {
|
|
4791
|
-
return this.isFill && this.path ?
|
|
4802
|
+
return this.isFill && this.path ? D.ctx.isPointInPath(this.path, t, e) : !1;
|
|
4792
4803
|
}
|
|
4793
4804
|
isPointInStroke(t, e) {
|
|
4794
|
-
return this.path && this.mainCanvas ? (this.setOverlayStyles(
|
|
4805
|
+
return this.path && this.mainCanvas ? (this.setOverlayStyles(D.ctx), this.isDraggable && (D.ctx.lineWidth = Math.max(D.ctx.lineWidth, 20)), D.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
4795
4806
|
}
|
|
4796
4807
|
isPointInAnywhere(t, e) {
|
|
4797
4808
|
return ((n) => {
|
|
@@ -4810,7 +4821,7 @@ class Yt extends R {
|
|
|
4810
4821
|
var c;
|
|
4811
4822
|
const e = this.isHover, i = this.mainCanvas, n = i.style[i.theme].arc;
|
|
4812
4823
|
let o = {};
|
|
4813
|
-
typeof this.style == "string" ? o = ((c = i.style[this.style]) == null ? void 0 : c.arc) || n : typeof this.style == "object" ? o =
|
|
4824
|
+
typeof this.style == "string" ? o = ((c = i.style[this.style]) == null ? void 0 : c.arc) || n : typeof this.style == "object" ? o = lt(
|
|
4814
4825
|
JSON.parse(JSON.stringify(n)),
|
|
4815
4826
|
this.style
|
|
4816
4827
|
) : o = n;
|
|
@@ -4847,7 +4858,7 @@ class Yt extends R {
|
|
|
4847
4858
|
o,
|
|
4848
4859
|
t.axisConfig.x,
|
|
4849
4860
|
t.axisConfig.y
|
|
4850
|
-
), f = (w) => new
|
|
4861
|
+
), f = (w) => new pt({
|
|
4851
4862
|
name: w,
|
|
4852
4863
|
offset: c,
|
|
4853
4864
|
value: [0, 0],
|
|
@@ -4951,7 +4962,7 @@ function ls(r, s, t, e, i, n = 1, o = 1) {
|
|
|
4951
4962
|
[c, h]
|
|
4952
4963
|
];
|
|
4953
4964
|
}
|
|
4954
|
-
class
|
|
4965
|
+
class ge extends D {
|
|
4955
4966
|
constructor(t) {
|
|
4956
4967
|
super(t);
|
|
4957
4968
|
/** 控制点 */
|
|
@@ -4970,12 +4981,12 @@ class jt extends R {
|
|
|
4970
4981
|
i != n && ((o = this.notifyReload) == null || o.call(this));
|
|
4971
4982
|
});
|
|
4972
4983
|
/** 处理拖动状态变化 */
|
|
4973
|
-
d(this, "
|
|
4984
|
+
d(this, "defaultDrag", (t, e) => {
|
|
4974
4985
|
this.mainCanvas;
|
|
4975
4986
|
});
|
|
4976
4987
|
["isHandlePointsVisible"].forEach((e) => {
|
|
4977
4988
|
e in t && (this["_" + e] = t[e]);
|
|
4978
|
-
}), this.addEventListener("click", this.defaultClick), this.addEventListener("
|
|
4989
|
+
}), this.addEventListener("click", this.defaultClick), this.addEventListener("drag", this.defaultDrag);
|
|
4979
4990
|
}
|
|
4980
4991
|
/** 控制点数组 */
|
|
4981
4992
|
get handlePointsArr() {
|
|
@@ -5016,7 +5027,7 @@ class jt extends R {
|
|
|
5016
5027
|
return !1;
|
|
5017
5028
|
}
|
|
5018
5029
|
isPointInStroke(t, e) {
|
|
5019
|
-
return this.path && this.mainCanvas ? (this.setOverlayStyles(
|
|
5030
|
+
return this.path && this.mainCanvas ? (this.setOverlayStyles(D.ctx), this.isDraggable && (D.ctx.lineWidth = Math.max(D.ctx.lineWidth, 20)), D.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
5020
5031
|
}
|
|
5021
5032
|
isPointInAnywhere(t, e) {
|
|
5022
5033
|
return ((n) => {
|
|
@@ -5036,7 +5047,7 @@ class jt extends R {
|
|
|
5036
5047
|
var o;
|
|
5037
5048
|
const e = this.mainCanvas, i = e.style[e.theme].arcTo;
|
|
5038
5049
|
let n = {};
|
|
5039
|
-
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.arcTo) || i : typeof this.style == "object" ? n =
|
|
5050
|
+
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.arcTo) || i : typeof this.style == "object" ? n = lt(
|
|
5040
5051
|
JSON.parse(JSON.stringify(i)),
|
|
5041
5052
|
this.style
|
|
5042
5053
|
) : n = i, t && this.setBaseLineStyle(t, n.stroke), n;
|
|
@@ -5049,7 +5060,7 @@ class jt extends R {
|
|
|
5049
5060
|
var c, h;
|
|
5050
5061
|
let { value: t, position: e, dynamicPosition: i, isHandlePointsVisible: n } = this;
|
|
5051
5062
|
if (!i || !n) return;
|
|
5052
|
-
const o = () => new
|
|
5063
|
+
const o = () => new pt({
|
|
5053
5064
|
value: [0, 0],
|
|
5054
5065
|
mainCanvas: this.mainCanvas,
|
|
5055
5066
|
isDraggable: !0,
|
|
@@ -5075,8 +5086,8 @@ class jt extends R {
|
|
|
5075
5086
|
if (!this.mainCanvas) return;
|
|
5076
5087
|
let { value: t, position: e } = this;
|
|
5077
5088
|
const [i, n] = [
|
|
5078
|
-
|
|
5079
|
-
|
|
5089
|
+
Ut(t) && t.length > 1,
|
|
5090
|
+
Ut(e) && e.length > 1
|
|
5080
5091
|
];
|
|
5081
5092
|
if (!i && !n)
|
|
5082
5093
|
return this.handlePoints = void 0, this.internalUpdate({ dynamicPosition: void 0 });
|
|
@@ -5195,7 +5206,7 @@ class cs extends rs {
|
|
|
5195
5206
|
if (a !== h) return h - a;
|
|
5196
5207
|
if (l !== u)
|
|
5197
5208
|
return u - l;
|
|
5198
|
-
const m = (p) => p instanceof
|
|
5209
|
+
const m = (p) => p instanceof he ? 5 : p instanceof ue ? 4 : p instanceof pt ? 3 : p instanceof de || p instanceof me || p instanceof ge ? 2 : p instanceof fe ? 1 : 0;
|
|
5199
5210
|
return m(f) - m(c);
|
|
5200
5211
|
}
|
|
5201
5212
|
), this.currentDrawOverlays = t.map(
|
|
@@ -5241,7 +5252,7 @@ class hs extends cs {
|
|
|
5241
5252
|
d(this, "mouseLastPosition", { x: 0, y: 0 });
|
|
5242
5253
|
d(this, "unBind");
|
|
5243
5254
|
/** 上一个被点击的覆盖物 */
|
|
5244
|
-
d(this, "
|
|
5255
|
+
d(this, "_lastClickedOverlay");
|
|
5245
5256
|
d(this, "lockNotifyClick", !1);
|
|
5246
5257
|
/** 上一个被右击的覆盖物 */
|
|
5247
5258
|
d(this, "lastContextmenuOverlay");
|
|
@@ -5262,12 +5273,12 @@ class hs extends cs {
|
|
|
5262
5273
|
this.setScale(e, t.data), this.redrawOnce();
|
|
5263
5274
|
});
|
|
5264
5275
|
/** 上一个被按下的覆盖物 */
|
|
5265
|
-
d(this, "
|
|
5276
|
+
d(this, "_lastDownOverlay");
|
|
5266
5277
|
d(this, "defaultDown", (t, e) => {
|
|
5267
5278
|
(e == null ? void 0 : e.button) == 0 && (this.mouseIsDown = !0);
|
|
5268
5279
|
});
|
|
5269
5280
|
/** 上一个被hover的覆盖物 */
|
|
5270
|
-
d(this, "
|
|
5281
|
+
d(this, "_lastHoverOverlay");
|
|
5271
5282
|
/** 最后的光标样式 */
|
|
5272
5283
|
d(this, "lastCursorStyle");
|
|
5273
5284
|
d(this, "oldClientX", []);
|
|
@@ -5300,6 +5311,13 @@ class hs extends cs {
|
|
|
5300
5311
|
});
|
|
5301
5312
|
};
|
|
5302
5313
|
}
|
|
5314
|
+
/** 上一个被点击的覆盖物 */
|
|
5315
|
+
get lastClickedOverlay() {
|
|
5316
|
+
return this._lastClickedOverlay && (this._lastClickedOverlay.equalsMainCanvas(this) || (this._lastClickedOverlay = void 0)), this._lastClickedOverlay;
|
|
5317
|
+
}
|
|
5318
|
+
set lastClickedOverlay(t) {
|
|
5319
|
+
this._lastClickedOverlay = t;
|
|
5320
|
+
}
|
|
5303
5321
|
/** 鼠标左键点击画布 */
|
|
5304
5322
|
click(t) {
|
|
5305
5323
|
var i;
|
|
@@ -5333,16 +5351,16 @@ class hs extends cs {
|
|
|
5333
5351
|
keydown(t) {
|
|
5334
5352
|
const { mouseInCanvas: e, offset: i, delta: n, axisConfig: o } = this, a = t.key;
|
|
5335
5353
|
if (!e || !this.isDraggable || this.isAuto) return;
|
|
5336
|
-
const l = this.getStep(a), c = this.lastClickedOverlay, u = (c == null ? void 0 : c.isDraggable) && this.currentDrawOverlays.includes(c) && (
|
|
5354
|
+
const l = this.getStep(a), c = this.lastClickedOverlay, u = (c == null ? void 0 : c.isDraggable) && this.currentDrawOverlays.includes(c) && (Ut(c.value) ? "Matrix" : pe(c.value) ? "Single" : !1), f = (y, w) => {
|
|
5337
5355
|
if (!u)
|
|
5338
5356
|
return i.x += y * l, i.y += w * l, !0;
|
|
5339
|
-
const P = this.getAxisValueByPoint(l, 0).xV, [b,
|
|
5357
|
+
const P = this.getAxisValueByPoint(l, 0).xV, [b, E] = [P * o.x, P * o.y];
|
|
5340
5358
|
if (u === "Single") {
|
|
5341
|
-
const
|
|
5342
|
-
|
|
5359
|
+
const A = c.value;
|
|
5360
|
+
A[0] += y * b, A[1] += w * E;
|
|
5343
5361
|
} else
|
|
5344
|
-
c.value.forEach((
|
|
5345
|
-
|
|
5362
|
+
c.value.forEach((A) => {
|
|
5363
|
+
A[0] += y * b, A[1] += w * E;
|
|
5346
5364
|
});
|
|
5347
5365
|
return c.value = [...c.value], !0;
|
|
5348
5366
|
}, m = (y) => (this.setScale("center", y * n), !0), g = {
|
|
@@ -5372,6 +5390,13 @@ class hs extends cs {
|
|
|
5372
5390
|
const n = t.deltaY < 0 ? e : -e, o = this.findOverlayByPoint(t);
|
|
5373
5391
|
o == null || o.notifyWheel(n, t), this.notifyWheel(n, t);
|
|
5374
5392
|
}
|
|
5393
|
+
/** 上一个被按下的覆盖物 */
|
|
5394
|
+
get lastDownOverlay() {
|
|
5395
|
+
return this._lastDownOverlay && (this._lastDownOverlay.equalsMainCanvas(this) || (this._lastDownOverlay = void 0)), this._lastDownOverlay;
|
|
5396
|
+
}
|
|
5397
|
+
set lastDownOverlay(t) {
|
|
5398
|
+
this._lastDownOverlay = t;
|
|
5399
|
+
}
|
|
5375
5400
|
/** 鼠标按下 */
|
|
5376
5401
|
mousedown(t) {
|
|
5377
5402
|
var o;
|
|
@@ -5385,6 +5410,13 @@ class hs extends cs {
|
|
|
5385
5410
|
mouseup(t) {
|
|
5386
5411
|
this.mouseIsDown = !1, this.lastDownOverlay = void 0;
|
|
5387
5412
|
}
|
|
5413
|
+
/** 上一个被hover的覆盖物 */
|
|
5414
|
+
get lastHoverOverlay() {
|
|
5415
|
+
return this._lastHoverOverlay && (this._lastHoverOverlay.equalsMainCanvas(this) || (this._lastHoverOverlay = void 0)), this._lastHoverOverlay;
|
|
5416
|
+
}
|
|
5417
|
+
set lastHoverOverlay(t) {
|
|
5418
|
+
this._lastHoverOverlay = t;
|
|
5419
|
+
}
|
|
5388
5420
|
/** 鼠标移动 */
|
|
5389
5421
|
mousemove(t) {
|
|
5390
5422
|
this.isAuto || (this.canvas.classList.toggle("_nhanh_canvas_draggable", this.isDraggable), this.mouseIsDown ? this.handleDragMove(t) : this.handleHover(t));
|
|
@@ -5396,12 +5428,12 @@ class hs extends cs {
|
|
|
5396
5428
|
if (JSON.stringify(n) == JSON.stringify(this.mouseLastPosition))
|
|
5397
5429
|
return;
|
|
5398
5430
|
const { lastDownOverlay: o } = this;
|
|
5399
|
-
o != null && o.isDraggable ? this.
|
|
5431
|
+
o != null && o.isDraggable ? this.notifyDragOverlays(t) : this.handleCanvasPan(t), this.mouseLastPosition = n, this.lockNotifyClick = !0;
|
|
5400
5432
|
}
|
|
5401
5433
|
/** 通知可拖拽的 overlays */
|
|
5402
|
-
|
|
5434
|
+
notifyDragOverlays(t) {
|
|
5403
5435
|
const e = this.lastDownOverlay, { mouseLastPosition: i } = this, { clientX: n, clientY: o } = t;
|
|
5404
|
-
e.
|
|
5436
|
+
e.notifyDrag(
|
|
5405
5437
|
{
|
|
5406
5438
|
offsetX: n - i.x,
|
|
5407
5439
|
offsetY: o - i.y
|
|
@@ -5412,7 +5444,7 @@ class hs extends cs {
|
|
|
5412
5444
|
/** 处理画布平移 */
|
|
5413
5445
|
handleCanvasPan(t) {
|
|
5414
5446
|
const { clientX: e, clientY: i } = t, { offset: n, mouseLastPosition: o } = this, a = e - o.x, l = i - o.y;
|
|
5415
|
-
n.x += a, n.y += l, this.redrawOnce(), this.
|
|
5447
|
+
n.x += a, n.y += l, this.redrawOnce(), this.notifyDrag({ offsetX: a, offsetY: l }, t);
|
|
5416
5448
|
}
|
|
5417
5449
|
/** 处理 hover 逻辑 */
|
|
5418
5450
|
handleHover(t) {
|
|
@@ -5454,12 +5486,12 @@ class hs extends cs {
|
|
|
5454
5486
|
} else if (e.length === 2) {
|
|
5455
5487
|
const { clientX: h, clientY: u } = e[0], { clientX: f, clientY: m } = e[1];
|
|
5456
5488
|
if (i.length == 2) {
|
|
5457
|
-
const p =
|
|
5489
|
+
const p = De(
|
|
5458
5490
|
i[0],
|
|
5459
5491
|
n[0],
|
|
5460
5492
|
i[1],
|
|
5461
5493
|
n[1]
|
|
5462
|
-
), g =
|
|
5494
|
+
), g = De(
|
|
5463
5495
|
h,
|
|
5464
5496
|
u,
|
|
5465
5497
|
f,
|
|
@@ -5537,6 +5569,10 @@ class Y extends Vt {
|
|
|
5537
5569
|
e.setNotifyReload(), e.setMainCanvas(), e.parent = void 0;
|
|
5538
5570
|
}), this.overlays.clear();
|
|
5539
5571
|
}
|
|
5572
|
+
/** 移除覆盖物 */
|
|
5573
|
+
removeChild(t) {
|
|
5574
|
+
this.removeOverlay(t);
|
|
5575
|
+
}
|
|
5540
5576
|
/** 获取覆盖物的绘制方法 */
|
|
5541
5577
|
getOverlaysDrawingMethod() {
|
|
5542
5578
|
const t = [];
|
|
@@ -5618,6 +5654,10 @@ class j extends Vt {
|
|
|
5618
5654
|
e.setNotifyReload(), e.setMainCanvas(), e.parent = void 0;
|
|
5619
5655
|
}), this.groups.clear(), (t = this.notifyReload) == null || t.call(this));
|
|
5620
5656
|
}
|
|
5657
|
+
/** 移除覆盖物组 */
|
|
5658
|
+
removeChild(t) {
|
|
5659
|
+
this.removeGroup(t);
|
|
5660
|
+
}
|
|
5621
5661
|
/** 获取画布 */
|
|
5622
5662
|
getCanvas() {
|
|
5623
5663
|
if (!this.mainCanvas) return;
|
|
@@ -5639,7 +5679,7 @@ class j extends Vt {
|
|
|
5639
5679
|
}
|
|
5640
5680
|
}
|
|
5641
5681
|
}
|
|
5642
|
-
class
|
|
5682
|
+
class Rt extends Vt {
|
|
5643
5683
|
constructor(t) {
|
|
5644
5684
|
super(t);
|
|
5645
5685
|
/** 图层群组 */
|
|
@@ -5650,9 +5690,9 @@ class Dt extends Vt {
|
|
|
5650
5690
|
d(this, "defaultClick", (t, e) => t.stopPropagation());
|
|
5651
5691
|
d(this, "defaultDoubleClick", (t, e) => t.stopPropagation());
|
|
5652
5692
|
d(this, "defaultHover", (t, e) => t.stopPropagation());
|
|
5653
|
-
d(this, "
|
|
5693
|
+
d(this, "defaultDrag", (t, e) => t.stopPropagation());
|
|
5654
5694
|
d(this, "defaultDown", (t, e) => t.stopPropagation());
|
|
5655
|
-
this.inheritOpacity = !1, this.setNotifyReload(t.notifyReload), this.addEventListener("contextmenu", this.defaultContextmenu), this.addEventListener("click", this.defaultClick), this.addEventListener("doubleClick", this.defaultDoubleClick), this.addEventListener("hover", this.defaultHover), this.addEventListener("
|
|
5695
|
+
this.inheritOpacity = !1, this.setNotifyReload(t.notifyReload), this.addEventListener("contextmenu", this.defaultContextmenu), this.addEventListener("click", this.defaultClick), this.addEventListener("doubleClick", this.defaultDoubleClick), this.addEventListener("hover", this.defaultHover), this.addEventListener("drag", this.defaultDrag), this.addEventListener("down", this.defaultDown);
|
|
5656
5696
|
}
|
|
5657
5697
|
get layersSizeChange() {
|
|
5658
5698
|
const t = this.oldLlayersSize;
|
|
@@ -5693,6 +5733,10 @@ class Dt extends Vt {
|
|
|
5693
5733
|
e.setNotifyReload(), e.setMainCanvas(), e.parent = void 0;
|
|
5694
5734
|
}), this.layers.clear(), (t = this.notifyReload) == null || t.call(this));
|
|
5695
5735
|
}
|
|
5736
|
+
/** 移除图层 */
|
|
5737
|
+
removeChild(t) {
|
|
5738
|
+
this.removeLayer(t);
|
|
5739
|
+
}
|
|
5696
5740
|
/** 收集图层的 canvas */
|
|
5697
5741
|
fetchCanvas() {
|
|
5698
5742
|
if (this.shouldRender() && this.layers.size) {
|
|
@@ -5733,7 +5777,7 @@ class us extends hs {
|
|
|
5733
5777
|
const t = [], e = s !== void 0 ? Array.isArray(s) ? [...s] : [s] : Array.from(this.layerGroups.values());
|
|
5734
5778
|
for (; e.length > 0; ) {
|
|
5735
5779
|
const i = e.pop();
|
|
5736
|
-
if (i instanceof
|
|
5780
|
+
if (i instanceof Rt) {
|
|
5737
5781
|
if (!i.isVisible) continue;
|
|
5738
5782
|
e.push(...i.layers.values());
|
|
5739
5783
|
} else if (i instanceof j) {
|
|
@@ -5839,13 +5883,13 @@ class fs extends ds {
|
|
|
5839
5883
|
const m = s / u, p = t / f, g = Math.max(m, p), y = a.count, w = y / a.min, P = n * o;
|
|
5840
5884
|
let b;
|
|
5841
5885
|
if (g > w) {
|
|
5842
|
-
const
|
|
5843
|
-
b = 1 - ((y *
|
|
5886
|
+
const E = Math.ceil(g / w);
|
|
5887
|
+
b = 1 - ((y * E / g - a.min) / a.min + (E - 2)) * P;
|
|
5844
5888
|
} else {
|
|
5845
|
-
const
|
|
5846
|
-
b = 1 + ((y / G / g - a.min) / a.min +
|
|
5889
|
+
const E = (ut, rt, vt) => ut < rt ? vt - 1 : E(ut / 2, rt, vt + 1), A = E(w, g, 0), G = Math.pow(2, A);
|
|
5890
|
+
b = 1 + ((y / G / g - a.min) / a.min + A) * P;
|
|
5847
5891
|
}
|
|
5848
|
-
return i !== void 0 && (b = Math.min(i, b)), b = new
|
|
5892
|
+
return i !== void 0 && (b = Math.min(i, b)), b = new R(b).div(o).round().mul(o).toNumber(), b;
|
|
5849
5893
|
}
|
|
5850
5894
|
/** 计算目标位置偏移 */
|
|
5851
5895
|
calculateOffsetDifference(s, t, e, i, n) {
|
|
@@ -5893,13 +5937,13 @@ class fs extends ds {
|
|
|
5893
5937
|
animateScale(s, t, e, i) {
|
|
5894
5938
|
const n = t - s;
|
|
5895
5939
|
let o = 0;
|
|
5896
|
-
|
|
5940
|
+
Bt((a) => {
|
|
5897
5941
|
!this.isAuto || !this.canvas || !this.isInteractive || (this.setScale("center", (a - o) * n), o = a, this.redrawOnce(), a === 1 && i());
|
|
5898
5942
|
}, e);
|
|
5899
5943
|
}
|
|
5900
5944
|
/** 执行偏移动画 */
|
|
5901
5945
|
animateOffset(s, t, e, i) {
|
|
5902
|
-
|
|
5946
|
+
Bt((n) => {
|
|
5903
5947
|
!this.isAuto || !this.canvas || !this.isInteractive || (this.offset = {
|
|
5904
5948
|
x: Number((s.x + t.x * n).toFixed(0)),
|
|
5905
5949
|
y: Number((s.y + t.y * n).toFixed(0))
|
|
@@ -6077,17 +6121,17 @@ class vs {
|
|
|
6077
6121
|
const y = i.y > c || i.y < 0;
|
|
6078
6122
|
let w = i.x > 0 ? i.x % p : i.x < 0 ? p + i.x % p : 0, P = s.getAxisValueByPoint((w - i.x) * n.x, 0).xV;
|
|
6079
6123
|
for (; w <= l; ) {
|
|
6080
|
-
const b =
|
|
6081
|
-
P !== 0 && this.drawText(b, w -
|
|
6124
|
+
const b = ee(P), E = h(b);
|
|
6125
|
+
P !== 0 && this.drawText(b, w - E / 2, g, y), w += p, P = new R(m).mul(n.x).add(P).toNumber();
|
|
6082
6126
|
}
|
|
6083
6127
|
}
|
|
6084
6128
|
{
|
|
6085
6129
|
const g = i.x > l || i.x < 0;
|
|
6086
6130
|
let y = i.y > 0 ? i.y % p : i.y < 0 ? p + i.y % p : 0, w = s.getAxisValueByPoint(0, (y - i.y) * n.y).yV;
|
|
6087
6131
|
for (; y <= c; ) {
|
|
6088
|
-
const P =
|
|
6089
|
-
let
|
|
6090
|
-
|
|
6132
|
+
const P = ee(w), b = h(P);
|
|
6133
|
+
let E = i.x - b - u;
|
|
6134
|
+
E = Math.max(Math.min(E, l - b - u), u), w != 0 && this.drawText(P, E, y + f / 2, g), y += p, w = new R(m).mul(n.y).add(w).toNumber();
|
|
6091
6135
|
}
|
|
6092
6136
|
}
|
|
6093
6137
|
}
|
|
@@ -6231,7 +6275,7 @@ class ws {
|
|
|
6231
6275
|
};
|
|
6232
6276
|
}
|
|
6233
6277
|
}
|
|
6234
|
-
class xs extends
|
|
6278
|
+
class xs extends D {
|
|
6235
6279
|
constructor(t) {
|
|
6236
6280
|
super(t);
|
|
6237
6281
|
d(this, "_ready", !1);
|
|
@@ -6289,12 +6333,12 @@ class xs extends R {
|
|
|
6289
6333
|
const p = u.w / u.h, g = f / m;
|
|
6290
6334
|
if (o === "fill") return u;
|
|
6291
6335
|
if (o === "contain" || o === "scale-down") {
|
|
6292
|
-
const P = Math.min(u.w / f, u.h / m), b = o === "scale-down" ? Math.min(1, P) : P,
|
|
6336
|
+
const P = Math.min(u.w / f, u.h / m), b = o === "scale-down" ? Math.min(1, P) : P, E = f * b, A = m * b;
|
|
6293
6337
|
return {
|
|
6294
|
-
x: u.x + (u.w -
|
|
6295
|
-
y: u.y + (u.h -
|
|
6296
|
-
w:
|
|
6297
|
-
h:
|
|
6338
|
+
x: u.x + (u.w - E) / 2,
|
|
6339
|
+
y: u.y + (u.h - A) / 2,
|
|
6340
|
+
w: E,
|
|
6341
|
+
h: A
|
|
6298
6342
|
};
|
|
6299
6343
|
}
|
|
6300
6344
|
if (g > p) {
|
|
@@ -6320,10 +6364,10 @@ class xs extends R {
|
|
|
6320
6364
|
this.mainCanvas && (this.ready = !1, this.url && (this.image.src = this.url), this.handleValuePosition("array2D", 1));
|
|
6321
6365
|
}
|
|
6322
6366
|
}
|
|
6323
|
-
class
|
|
6367
|
+
class Me extends xs {
|
|
6324
6368
|
constructor(t) {
|
|
6325
6369
|
super(t);
|
|
6326
|
-
d(this, "
|
|
6370
|
+
d(this, "defaultDrag", (t, e) => {
|
|
6327
6371
|
var l;
|
|
6328
6372
|
const { offsetX: i, offsetY: n } = t.data, { x: o, y: a } = this.calculateOffset(i, n);
|
|
6329
6373
|
this.value.forEach((c, h) => {
|
|
@@ -6340,13 +6384,13 @@ class ae extends xs {
|
|
|
6340
6384
|
}), (l = this.notifyReload) == null || l.call(this), this.updateValueScope();
|
|
6341
6385
|
});
|
|
6342
6386
|
const { url: e, objectFit: i } = t;
|
|
6343
|
-
Object.assign(this, { url: e, objectFit: i }), this.addEventListener("
|
|
6387
|
+
Object.assign(this, { url: e, objectFit: i }), this.addEventListener("drag", this.defaultDrag);
|
|
6344
6388
|
}
|
|
6345
6389
|
updateValueScope() {
|
|
6346
6390
|
this.initValueScope();
|
|
6347
6391
|
}
|
|
6348
6392
|
isPointInPath(t, e) {
|
|
6349
|
-
return this.path ?
|
|
6393
|
+
return this.path ? D.ctx.isPointInPath(this.path, t, e) : !1;
|
|
6350
6394
|
}
|
|
6351
6395
|
isPointInStroke(t, e) {
|
|
6352
6396
|
return !1;
|
|
@@ -6356,7 +6400,7 @@ class ae extends xs {
|
|
|
6356
6400
|
var o;
|
|
6357
6401
|
const e = this.mainCanvas, i = e.style[e.theme].billboard;
|
|
6358
6402
|
let n = {};
|
|
6359
|
-
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.billboard) || i : typeof this.style == "object" ? n =
|
|
6403
|
+
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.billboard) || i : typeof this.style == "object" ? n = lt(
|
|
6360
6404
|
JSON.parse(JSON.stringify(i)),
|
|
6361
6405
|
this.style
|
|
6362
6406
|
) : n = i, t && this.setBaseLineStyle(t, n.stroke), n;
|
|
@@ -6408,7 +6452,7 @@ class T extends ps {
|
|
|
6408
6452
|
a.addGroup(new Y({ name: "文字覆盖物群组" }));
|
|
6409
6453
|
const l = new j({ name: "自定义绘制图层", zIndex: 7 });
|
|
6410
6454
|
l.addGroup(new Y({ name: "自定义绘制覆盖物群组" }));
|
|
6411
|
-
const c = new
|
|
6455
|
+
const c = new Rt({ name: "默认图层群组" });
|
|
6412
6456
|
c.addLayer([
|
|
6413
6457
|
a,
|
|
6414
6458
|
o,
|
|
@@ -6425,11 +6469,14 @@ class T extends ps {
|
|
|
6425
6469
|
}
|
|
6426
6470
|
/** 设置图层群组 */
|
|
6427
6471
|
setLayerGroup(t) {
|
|
6428
|
-
t instanceof
|
|
6472
|
+
t instanceof Rt && (this.layerGroups.set(t.name, t), t.setNotifyReload(() => this.redrawOnce()), t.setMainCanvas(this), t.parent = this);
|
|
6429
6473
|
}
|
|
6430
6474
|
/** 移除图层群组 */
|
|
6431
6475
|
removeLayerGroup(t) {
|
|
6432
|
-
t instanceof
|
|
6476
|
+
t instanceof Rt && (this.layerGroups.delete(t.name), t.setNotifyReload(), t.setMainCanvas(), t.parent = void 0, this.redrawOnce());
|
|
6477
|
+
}
|
|
6478
|
+
removeChild(t) {
|
|
6479
|
+
this.removeLayerGroup(t);
|
|
6433
6480
|
}
|
|
6434
6481
|
/** 添加图层 */
|
|
6435
6482
|
addLayer(t) {
|
|
@@ -6438,8 +6485,7 @@ class T extends ps {
|
|
|
6438
6485
|
}
|
|
6439
6486
|
/** 移除图层 */
|
|
6440
6487
|
removeLayer(t) {
|
|
6441
|
-
|
|
6442
|
-
e && e.removeLayer(Ht(t));
|
|
6488
|
+
Ht(t).forEach((e) => e.remove());
|
|
6443
6489
|
}
|
|
6444
6490
|
/** 添加覆盖物 */
|
|
6445
6491
|
addOverlay(t) {
|
|
@@ -6453,23 +6499,12 @@ class T extends ps {
|
|
|
6453
6499
|
overlays_other: c
|
|
6454
6500
|
} = this.getDefaultOverlayGroup() || {};
|
|
6455
6501
|
Ht(t).forEach((h) => {
|
|
6456
|
-
h instanceof
|
|
6502
|
+
h instanceof ue ? e == null || e.addOverlay(h) : h instanceof pt ? i == null || i.addOverlay(h) : h instanceof de || h instanceof me || h instanceof ge ? n == null || n.addOverlay(h) : h instanceof fe ? o == null || o.addOverlay(h) : h instanceof he ? a == null || a.addOverlay(h) : h instanceof Me ? l == null || l.addOverlay(h) : c == null || c.addOverlay(h);
|
|
6457
6503
|
});
|
|
6458
6504
|
}
|
|
6459
6505
|
/** 移除覆盖物 */
|
|
6460
6506
|
removeOverlay(t) {
|
|
6461
|
-
|
|
6462
|
-
overlays_text: e,
|
|
6463
|
-
overlays_point: i,
|
|
6464
|
-
overlays_line: n,
|
|
6465
|
-
overlays_polygon: o,
|
|
6466
|
-
overlays_custom: a,
|
|
6467
|
-
overlays_billboard: l,
|
|
6468
|
-
overlays_other: c
|
|
6469
|
-
} = this.getDefaultOverlayGroup() || {};
|
|
6470
|
-
Ht(t).forEach((h) => {
|
|
6471
|
-
h instanceof Ut ? e == null || e.removeOverlay(h) : h instanceof lt ? i == null || i.removeOverlay(h) : h instanceof Gt || h instanceof Yt || h instanceof jt ? n == null || n.removeOverlay(h) : h instanceof Xt ? o == null || o.removeOverlay(h) : h instanceof Bt ? a == null || a.addOverlay(h) : h instanceof ae ? l == null || l.removeOverlay(h) : c == null || c.removeOverlay(h);
|
|
6472
|
-
});
|
|
6507
|
+
Ht(t).forEach((e) => e.remove());
|
|
6473
6508
|
}
|
|
6474
6509
|
/** 销毁 */
|
|
6475
6510
|
destroy() {
|
|
@@ -6478,17 +6513,17 @@ class T extends ps {
|
|
|
6478
6513
|
}
|
|
6479
6514
|
/** 视图适配工具:默认缩放、居中计算 */
|
|
6480
6515
|
d(T, "ViewFit", ws), /** 图层群组 */
|
|
6481
|
-
d(T, "LayerGroup",
|
|
6516
|
+
d(T, "LayerGroup", Rt), /** 图层 */
|
|
6482
6517
|
d(T, "Layer", j), /** 覆盖物群组 */
|
|
6483
6518
|
d(T, "OverlayGroup", Y), /** 文字 */
|
|
6484
|
-
d(T, "Text",
|
|
6485
|
-
d(T, "Point",
|
|
6486
|
-
d(T, "Line",
|
|
6487
|
-
d(T, "Polygon",
|
|
6488
|
-
d(T, "Custom",
|
|
6489
|
-
d(T, "Arc",
|
|
6490
|
-
d(T, "ArcTo",
|
|
6491
|
-
d(T, "Billboard",
|
|
6519
|
+
d(T, "Text", ue), /** 点位 */
|
|
6520
|
+
d(T, "Point", pt), /** 线段 */
|
|
6521
|
+
d(T, "Line", de), /** 多边形 */
|
|
6522
|
+
d(T, "Polygon", fe), /** 自定义绘制 */
|
|
6523
|
+
d(T, "Custom", he), /** 圆弧 */
|
|
6524
|
+
d(T, "Arc", me), /** 圆角 */
|
|
6525
|
+
d(T, "ArcTo", ge), /** 图片 */
|
|
6526
|
+
d(T, "Billboard", Me);
|
|
6492
6527
|
class Ps {
|
|
6493
6528
|
/** @param id canvas DOM id(通过 getElementById 定位) */
|
|
6494
6529
|
constructor(s) {
|
|
@@ -6654,10 +6689,10 @@ class Ss {
|
|
|
6654
6689
|
this.canvas.removeEventListener("mousemove", this.handleMouseMove), this.canvas.removeEventListener("mouseleave", this.handleMouseLeave);
|
|
6655
6690
|
}
|
|
6656
6691
|
}
|
|
6657
|
-
const
|
|
6692
|
+
const _s = {
|
|
6658
6693
|
easeInOutQuad: (r) => r < 0.5 ? 2 * r * r : 1 - Math.pow(-2 * r + 2, 2) / 2
|
|
6659
6694
|
};
|
|
6660
|
-
class
|
|
6695
|
+
class Es {
|
|
6661
6696
|
/**
|
|
6662
6697
|
* 创建时间轴引擎:会在构造后 `requestAnimationFrame` 初始化并开始渲染。
|
|
6663
6698
|
* @param id canvas DOM id
|
|
@@ -6825,7 +6860,7 @@ class Ms {
|
|
|
6825
6860
|
Math.max(0.5, h)
|
|
6826
6861
|
);
|
|
6827
6862
|
return Math.max(1, Math.round(u * 60));
|
|
6828
|
-
})(), a = (t == null ? void 0 : t.curve) ??
|
|
6863
|
+
})(), a = (t == null ? void 0 : t.curve) ?? _s.easeInOutQuad;
|
|
6829
6864
|
Ke(
|
|
6830
6865
|
0,
|
|
6831
6866
|
1,
|
|
@@ -6847,7 +6882,7 @@ class Ms {
|
|
|
6847
6882
|
(s = this.offsetDrag) == null || s.destroy(), (t = this.wheelZoom) == null || t.destroy(), (e = this.mouseTimeReporter) == null || e.destroy(), this.canvasManager.destroy();
|
|
6848
6883
|
}
|
|
6849
6884
|
}
|
|
6850
|
-
class mn extends
|
|
6885
|
+
class mn extends Es {
|
|
6851
6886
|
/**
|
|
6852
6887
|
* 将填充样式解析为 ctx.fillStyle 可用的值(纯色或线性渐变)
|
|
6853
6888
|
* @param rect 矩形区域,用于计算渐变起止点
|
|
@@ -6892,7 +6927,7 @@ class mn extends Ms {
|
|
|
6892
6927
|
g && (t.fillStyle = g), h && (t.strokeStyle = h), t.lineWidth = u, t.beginPath(), typeof t.roundRect == "function" ? t.roundRect(f, o, p, a + o, l) : t.rect(f, o, p, a + o), c && t.fill(), h && t.stroke();
|
|
6893
6928
|
}
|
|
6894
6929
|
}
|
|
6895
|
-
function
|
|
6930
|
+
function Ot(r) {
|
|
6896
6931
|
if (typeof r == "string") {
|
|
6897
6932
|
const s = document.querySelector(r);
|
|
6898
6933
|
if (s)
|
|
@@ -6902,28 +6937,28 @@ function At(r) {
|
|
|
6902
6937
|
return r || document.documentElement;
|
|
6903
6938
|
}
|
|
6904
6939
|
function We(r) {
|
|
6905
|
-
const s =
|
|
6940
|
+
const s = Ot(r);
|
|
6906
6941
|
return s ? s.requestFullscreen ? s.requestFullscreen() : s.mozRequestFullScreen ? s.mozRequestFullScreen() : s.webkitRequestFullscreen ? s.webkitRequestFullscreen() : s.msRequestFullscreen ? s.msRequestFullscreen() : Promise.reject("No Fullscreen API") : Promise.reject("No Element");
|
|
6907
6942
|
}
|
|
6908
6943
|
function $e() {
|
|
6909
6944
|
const r = document;
|
|
6910
6945
|
return document.exitFullscreen ? document.exitFullscreen() : r.mozCancelFullScreen ? r.mozCancelFullScreen() : r.webkitExitFullscreen ? r.webkitExitFullscreen() : r.msExitFullscreen ? r.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
|
|
6911
6946
|
}
|
|
6912
|
-
function
|
|
6913
|
-
const s =
|
|
6947
|
+
function jt(r) {
|
|
6948
|
+
const s = Ot(r), t = document, e = document.fullscreenElement || t.webkitFullscreenElement || t.mozFullScreenElement || t.msFullscreenElement;
|
|
6914
6949
|
return s == e || !r && window.innerWidth == screen.width && window.innerHeight == screen.height;
|
|
6915
6950
|
}
|
|
6916
6951
|
function gn(r) {
|
|
6917
|
-
if (r =
|
|
6952
|
+
if (r = Ot(r), !!r)
|
|
6918
6953
|
return function() {
|
|
6919
|
-
|
|
6954
|
+
jt(r) ? $e() : We(r);
|
|
6920
6955
|
};
|
|
6921
6956
|
}
|
|
6922
6957
|
function pn(r, s) {
|
|
6923
|
-
const t =
|
|
6958
|
+
const t = Ot(s);
|
|
6924
6959
|
if (!t) return;
|
|
6925
6960
|
const e = () => {
|
|
6926
|
-
r(
|
|
6961
|
+
r(jt(t));
|
|
6927
6962
|
};
|
|
6928
6963
|
return document.addEventListener("fullscreenchange", e), document.addEventListener("webkitfullscreenchange", e), document.addEventListener("mozfullscreenchange", e), document.addEventListener("MSFullscreenChange", e), e(), () => {
|
|
6929
6964
|
document.removeEventListener("fullscreenchange", e), document.removeEventListener("webkitfullscreenchange", e), document.removeEventListener("mozfullscreenchange", e), document.removeEventListener("MSFullscreenChange", e);
|
|
@@ -6945,7 +6980,7 @@ class vn {
|
|
|
6945
6980
|
* 设置或更新目标元素(`HTMLElement` 或 CSS 选择器;未传时内部会回退到 `document.documentElement`)
|
|
6946
6981
|
*/
|
|
6947
6982
|
init(s) {
|
|
6948
|
-
this.targetElement =
|
|
6983
|
+
this.targetElement = Ot(s);
|
|
6949
6984
|
}
|
|
6950
6985
|
/** 使目标元素进入浏览器全屏 */
|
|
6951
6986
|
enter() {
|
|
@@ -6957,11 +6992,11 @@ class vn {
|
|
|
6957
6992
|
}
|
|
6958
6993
|
/** 若当前已为该目标全屏则退出,否则进入全屏 */
|
|
6959
6994
|
toggle() {
|
|
6960
|
-
this.targetElement && (
|
|
6995
|
+
this.targetElement && (jt(this.targetElement) ? this.exit() : this.enter());
|
|
6961
6996
|
}
|
|
6962
6997
|
attachFullscreenChangeListeners() {
|
|
6963
6998
|
const s = () => {
|
|
6964
|
-
!this.targetElement || !this.onFullscreenChange || this.onFullscreenChange(
|
|
6999
|
+
!this.targetElement || !this.onFullscreenChange || this.onFullscreenChange(jt(this.targetElement));
|
|
6965
7000
|
};
|
|
6966
7001
|
document.addEventListener("fullscreenchange", s), document.addEventListener(
|
|
6967
7002
|
"webkitfullscreenchange",
|
|
@@ -7052,12 +7087,12 @@ function wn(r, s, t) {
|
|
|
7052
7087
|
() => document.addEventListener("mousedown", a)
|
|
7053
7088
|
);
|
|
7054
7089
|
}
|
|
7055
|
-
var W,
|
|
7090
|
+
var W, dt, ft, xt, Pt, J, K, st, bt;
|
|
7056
7091
|
class xn {
|
|
7057
7092
|
constructor() {
|
|
7058
7093
|
L(this, W);
|
|
7059
|
-
L(this,
|
|
7060
|
-
L(this,
|
|
7094
|
+
L(this, dt, !1);
|
|
7095
|
+
L(this, ft, {});
|
|
7061
7096
|
L(this, xt, 0);
|
|
7062
7097
|
L(this, Pt, 0);
|
|
7063
7098
|
L(this, J, 0);
|
|
@@ -7066,7 +7101,7 @@ class xn {
|
|
|
7066
7101
|
L(this, bt);
|
|
7067
7102
|
}
|
|
7068
7103
|
init(s, t) {
|
|
7069
|
-
this.finish(),
|
|
7104
|
+
this.finish(), M(this, W, s), M(this, st, t == null ? void 0 : t.limit), M(this, bt, t == null ? void 0 : t.dragDom), M(this, ft, {
|
|
7070
7105
|
mousedown: this.mousedown.bind(this),
|
|
7071
7106
|
mousemove: this.mousemove.bind(this),
|
|
7072
7107
|
mouseup: this.mouseup.bind(this)
|
|
@@ -7078,44 +7113,44 @@ class xn {
|
|
|
7078
7113
|
bindOrUnbindEvent(s) {
|
|
7079
7114
|
const t = s === "bind" ? "addEventListener" : "removeEventListener";
|
|
7080
7115
|
if (!x(this, W)) return console.error("No DOM");
|
|
7081
|
-
x(this, W)[t]("mousedown", x(this,
|
|
7116
|
+
x(this, W)[t]("mousedown", x(this, ft).mousedown), document[t]("mousemove", x(this, ft).mousemove), document[t]("mouseup", x(this, ft).mouseup);
|
|
7082
7117
|
}
|
|
7083
7118
|
alterLocation() {
|
|
7084
7119
|
if (!x(this, W)) return console.error("No DOM");
|
|
7085
|
-
x(this, st) && (
|
|
7120
|
+
x(this, st) && (M(this, J, Math.min(x(this, J), x(this, st).max.top)), M(this, J, Math.max(x(this, J), x(this, st).min.top)), M(this, K, Math.min(x(this, K), x(this, st).max.left)), M(this, K, Math.max(x(this, K), x(this, st).min.left))), x(this, W).style.setProperty("--top", x(this, J) + "px"), x(this, W).style.setProperty("--left", x(this, K) + "px");
|
|
7086
7121
|
}
|
|
7087
7122
|
mousedown(s) {
|
|
7088
7123
|
if (!x(this, W)) return console.error("No DOM");
|
|
7089
7124
|
if (x(this, bt) && s.target != x(this, bt)) return;
|
|
7090
|
-
document.body.classList.add("no-select"),
|
|
7125
|
+
document.body.classList.add("no-select"), M(this, dt, !0);
|
|
7091
7126
|
const t = x(this, W).getBoundingClientRect(), { pageX: e, pageY: i } = s;
|
|
7092
|
-
|
|
7127
|
+
M(this, xt, e), M(this, Pt, i), M(this, J, t.y), M(this, K, t.x);
|
|
7093
7128
|
}
|
|
7094
7129
|
mousemove(s) {
|
|
7095
7130
|
const { pageX: t, pageY: e } = s;
|
|
7096
|
-
x(this,
|
|
7131
|
+
x(this, dt) && (M(this, J, x(this, J) + (e - x(this, Pt))), M(this, K, x(this, K) + (t - x(this, xt))), M(this, xt, t), M(this, Pt, e), this.alterLocation());
|
|
7097
7132
|
}
|
|
7098
7133
|
mouseup() {
|
|
7099
|
-
x(this,
|
|
7134
|
+
x(this, dt) && (M(this, dt, !1), document.body.classList.remove("no-select"));
|
|
7100
7135
|
}
|
|
7101
7136
|
}
|
|
7102
|
-
W = new WeakMap(),
|
|
7103
|
-
var $,
|
|
7137
|
+
W = new WeakMap(), dt = new WeakMap(), ft = new WeakMap(), xt = new WeakMap(), Pt = new WeakMap(), J = new WeakMap(), K = new WeakMap(), st = new WeakMap(), bt = new WeakMap();
|
|
7138
|
+
var $, mt, gt, Ct, St, q, Z, B, _t, Et;
|
|
7104
7139
|
class Pn {
|
|
7105
7140
|
constructor() {
|
|
7106
7141
|
L(this, $);
|
|
7107
|
-
L(this,
|
|
7108
|
-
L(this,
|
|
7142
|
+
L(this, mt, !1);
|
|
7143
|
+
L(this, gt, {});
|
|
7109
7144
|
L(this, Ct, 0);
|
|
7110
7145
|
L(this, St, 0);
|
|
7111
7146
|
L(this, q, 0);
|
|
7112
7147
|
L(this, Z, 0);
|
|
7113
7148
|
L(this, B);
|
|
7149
|
+
L(this, _t);
|
|
7114
7150
|
L(this, Et);
|
|
7115
|
-
L(this, Mt);
|
|
7116
7151
|
}
|
|
7117
7152
|
init(s, t = {}) {
|
|
7118
|
-
this.finish(),
|
|
7153
|
+
this.finish(), M(this, $, s), M(this, B, t.limit), M(this, _t, t.update_move), M(this, Et, t.update_up), M(this, gt, {
|
|
7119
7154
|
mousedown: this.mousedown.bind(this),
|
|
7120
7155
|
mousemove: this.mousemove.bind(this),
|
|
7121
7156
|
mouseup: this.mouseup.bind(this)
|
|
@@ -7127,7 +7162,7 @@ class Pn {
|
|
|
7127
7162
|
bindOrUnbindEvent(s) {
|
|
7128
7163
|
const t = s === "bind" ? "addEventListener" : "removeEventListener";
|
|
7129
7164
|
if (!x(this, $)) return console.error("No DOM");
|
|
7130
|
-
x(this, $)[t]("mousedown", x(this,
|
|
7165
|
+
x(this, $)[t]("mousedown", x(this, gt).mousedown), document[t]("mousemove", x(this, gt).mousemove), document[t]("mouseup", x(this, gt).mouseup);
|
|
7131
7166
|
}
|
|
7132
7167
|
updateValue() {
|
|
7133
7168
|
const s = {
|
|
@@ -7146,25 +7181,25 @@ class Pn {
|
|
|
7146
7181
|
}
|
|
7147
7182
|
alterLocation() {
|
|
7148
7183
|
if (!x(this, $)) return console.error("No DOM");
|
|
7149
|
-
x(this, B) && (
|
|
7184
|
+
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, Z, Math.min(x(this, Z), x(this, B).max.left)), M(this, Z, Math.max(x(this, Z), x(this, B).min.left))), x(this, _t) && x(this, _t).call(this, this.updateValue()), x(this, $).style.setProperty("--top", x(this, q) + "px"), x(this, $).style.setProperty("--left", x(this, Z) + "px");
|
|
7150
7185
|
}
|
|
7151
7186
|
mousedown(s) {
|
|
7152
7187
|
if (!x(this, $)) return console.error("No DOM");
|
|
7153
|
-
document.body.classList.add("no-select"),
|
|
7188
|
+
document.body.classList.add("no-select"), M(this, mt, !0);
|
|
7154
7189
|
const t = x(this, $).getBoundingClientRect();
|
|
7155
|
-
|
|
7190
|
+
M(this, St, t.y), M(this, Ct, t.x);
|
|
7156
7191
|
const { pageX: e, pageY: i } = s;
|
|
7157
|
-
|
|
7192
|
+
M(this, q, i - x(this, St)), M(this, Z, e - x(this, Ct)), this.alterLocation();
|
|
7158
7193
|
}
|
|
7159
7194
|
mousemove(s) {
|
|
7160
7195
|
const { pageX: t, pageY: e } = s;
|
|
7161
|
-
x(this,
|
|
7196
|
+
x(this, mt) && (M(this, q, e - x(this, St)), M(this, Z, t - x(this, Ct)), this.alterLocation());
|
|
7162
7197
|
}
|
|
7163
7198
|
mouseup() {
|
|
7164
|
-
x(this,
|
|
7199
|
+
x(this, mt) && (M(this, mt, !1), document.body.classList.remove("no-select"), x(this, Et) && x(this, Et).call(this, this.updateValue()));
|
|
7165
7200
|
}
|
|
7166
7201
|
}
|
|
7167
|
-
$ = new WeakMap(),
|
|
7202
|
+
$ = new WeakMap(), mt = new WeakMap(), gt = new WeakMap(), Ct = new WeakMap(), St = new WeakMap(), q = new WeakMap(), Z = new WeakMap(), B = new WeakMap(), _t = new WeakMap(), Et = new WeakMap();
|
|
7168
7203
|
function bn(r, s) {
|
|
7169
7204
|
if (typeof r == "number") return r;
|
|
7170
7205
|
if (/px/.test(r)) return Number(r.replace(/px/, "")) || 0;
|
|
@@ -7206,7 +7241,7 @@ function Sn(r, s = 5e3) {
|
|
|
7206
7241
|
}, i.crossOrigin = "Anonymous";
|
|
7207
7242
|
});
|
|
7208
7243
|
}
|
|
7209
|
-
function
|
|
7244
|
+
function _n(r) {
|
|
7210
7245
|
const t = document.getElementById(r).querySelectorAll("img"), e = t.length, i = [];
|
|
7211
7246
|
let n = 0;
|
|
7212
7247
|
return e === 0 ? Promise.resolve({
|
|
@@ -7248,14 +7283,14 @@ function En(r) {
|
|
|
7248
7283
|
});
|
|
7249
7284
|
});
|
|
7250
7285
|
}
|
|
7251
|
-
function
|
|
7286
|
+
function En(r) {
|
|
7252
7287
|
return new Promise((s, t) => {
|
|
7253
7288
|
fetch(r).then((e) => s(e.text())).catch((e) => {
|
|
7254
7289
|
console.error("Error fetching :", e), t(e);
|
|
7255
7290
|
});
|
|
7256
7291
|
});
|
|
7257
7292
|
}
|
|
7258
|
-
function
|
|
7293
|
+
function Mn(r) {
|
|
7259
7294
|
const s = document.createElement("input");
|
|
7260
7295
|
return s.type = "file", s.accept = (r == null ? void 0 : r.accept) || "", s.multiple = (r == null ? void 0 : r.multiple) || !1, new Promise((t, e) => {
|
|
7261
7296
|
s.addEventListener("change", (i) => {
|
|
@@ -7264,7 +7299,7 @@ function _n(r) {
|
|
|
7264
7299
|
}), s.click();
|
|
7265
7300
|
});
|
|
7266
7301
|
}
|
|
7267
|
-
function
|
|
7302
|
+
function Ms(r) {
|
|
7268
7303
|
const {
|
|
7269
7304
|
href: s,
|
|
7270
7305
|
fileName: t,
|
|
@@ -7273,7 +7308,7 @@ function _s(r) {
|
|
|
7273
7308
|
autoDownload: n = !0
|
|
7274
7309
|
} = r;
|
|
7275
7310
|
let o, a = !1, l = null, c;
|
|
7276
|
-
const h = t ||
|
|
7311
|
+
const h = t || ie(s, "downloaded_file");
|
|
7277
7312
|
c = decodeURIComponent(h);
|
|
7278
7313
|
const u = () => {
|
|
7279
7314
|
if (!l) return;
|
|
@@ -7303,21 +7338,21 @@ function _s(r) {
|
|
|
7303
7338
|
!a && l && u();
|
|
7304
7339
|
} };
|
|
7305
7340
|
}
|
|
7306
|
-
function
|
|
7341
|
+
function Dn(r, s, t) {
|
|
7307
7342
|
if (!t) {
|
|
7308
7343
|
let n = s.replace(/^[^.]+./, "");
|
|
7309
7344
|
n = n == s ? "text/plain" : "application/" + n, t = { type: n };
|
|
7310
7345
|
}
|
|
7311
7346
|
const e = new Blob(r, t), i = URL.createObjectURL(e);
|
|
7312
|
-
|
|
7347
|
+
Ms({ href: i, fileName: s });
|
|
7313
7348
|
}
|
|
7314
|
-
const
|
|
7315
|
-
function
|
|
7316
|
-
const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(s,
|
|
7349
|
+
const Ds = Math.PI / 2, Wt = Math.PI / 180, $t = 6378137, Rs = 85.05112878;
|
|
7350
|
+
function Rn(r, s) {
|
|
7351
|
+
const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(s, Rs), -85.05112878), i = t * Wt * $t, n = e * Wt, o = Math.log(Math.tan(Math.PI / 4 + n / 2)) * $t;
|
|
7317
7352
|
return [i, o];
|
|
7318
7353
|
}
|
|
7319
7354
|
function kn(r, s) {
|
|
7320
|
-
const t = r /
|
|
7355
|
+
const t = r / $t / Wt, e = (2 * Math.atan(Math.exp(s / $t)) - Ds) / Wt;
|
|
7321
7356
|
return [t, e];
|
|
7322
7357
|
}
|
|
7323
7358
|
function ks(r, s, t) {
|
|
@@ -7335,14 +7370,14 @@ function Vn(r, s, t, e, i, n = 1, o = 1) {
|
|
|
7335
7370
|
[c, h]
|
|
7336
7371
|
];
|
|
7337
7372
|
}
|
|
7338
|
-
function
|
|
7373
|
+
function De(r, s, t, e) {
|
|
7339
7374
|
return Math.hypot(Math.abs(t - r), Math.abs(e - s));
|
|
7340
7375
|
}
|
|
7341
7376
|
function qe(r, s, t, e) {
|
|
7342
7377
|
const i = (r + t) / 2, n = (s + e) / 2;
|
|
7343
7378
|
return { x: i, y: n };
|
|
7344
7379
|
}
|
|
7345
|
-
function
|
|
7380
|
+
function On(r, s, t, e) {
|
|
7346
7381
|
const [i, n] = r, [o, a] = s;
|
|
7347
7382
|
let l = 1 / 0;
|
|
7348
7383
|
if (o !== 0) {
|
|
@@ -7363,7 +7398,7 @@ const Vs = /* @__PURE__ */ new Set([
|
|
|
7363
7398
|
"acos",
|
|
7364
7399
|
"atan",
|
|
7365
7400
|
"atan2"
|
|
7366
|
-
]),
|
|
7401
|
+
]), An = new Proxy(Math, {
|
|
7367
7402
|
get(r, s) {
|
|
7368
7403
|
return Vs.has(s) ? function(...t) {
|
|
7369
7404
|
const e = t.map((i) => i / 180 * Math.PI);
|
|
@@ -7379,6 +7414,23 @@ const Vs = /* @__PURE__ */ new Set([
|
|
|
7379
7414
|
throw new Error("DegreeMath 是只读的,不能删除属性");
|
|
7380
7415
|
}
|
|
7381
7416
|
});
|
|
7417
|
+
function Ln(r, s) {
|
|
7418
|
+
const t = r.length;
|
|
7419
|
+
if (t === 0) return [0, 0];
|
|
7420
|
+
if (t === 1) return [r[0][0], r[0][1]];
|
|
7421
|
+
const e = s;
|
|
7422
|
+
let i = r.map((n) => [n[0], n[1]]);
|
|
7423
|
+
for (; i.length > 1; ) {
|
|
7424
|
+
const n = [];
|
|
7425
|
+
for (let o = 0; o < i.length - 1; o++)
|
|
7426
|
+
n.push([
|
|
7427
|
+
(1 - e) * i[o][0] + e * i[o + 1][0],
|
|
7428
|
+
(1 - e) * i[o][1] + e * i[o + 1][1]
|
|
7429
|
+
]);
|
|
7430
|
+
i = n;
|
|
7431
|
+
}
|
|
7432
|
+
return i[0];
|
|
7433
|
+
}
|
|
7382
7434
|
class wt {
|
|
7383
7435
|
constructor(s, t) {
|
|
7384
7436
|
d(this, "resolve");
|
|
@@ -7396,40 +7448,40 @@ class wt {
|
|
|
7396
7448
|
}) : s ? (t = this.resolve) == null || t.call(this) : (e = this.reject) == null || e.call(this), s;
|
|
7397
7449
|
}
|
|
7398
7450
|
}
|
|
7399
|
-
class
|
|
7451
|
+
class Os extends wt {
|
|
7400
7452
|
constructor(s) {
|
|
7401
7453
|
super(), this.resolve = s;
|
|
7402
7454
|
}
|
|
7403
7455
|
warning(...s) {
|
|
7404
7456
|
const t = () => {
|
|
7405
7457
|
var e, i;
|
|
7406
|
-
return (i = (e =
|
|
7458
|
+
return (i = (e = Dt.tips).warning) == null ? void 0 : i.call(e, ...s);
|
|
7407
7459
|
};
|
|
7408
7460
|
return new wt(this.resolve, t);
|
|
7409
7461
|
}
|
|
7410
7462
|
error(...s) {
|
|
7411
7463
|
const t = () => {
|
|
7412
7464
|
var e, i;
|
|
7413
|
-
return (i = (e =
|
|
7465
|
+
return (i = (e = Dt.tips).error) == null ? void 0 : i.call(e, ...s);
|
|
7414
7466
|
};
|
|
7415
7467
|
return new wt(this.resolve, t);
|
|
7416
7468
|
}
|
|
7417
7469
|
}
|
|
7418
|
-
class
|
|
7470
|
+
class As extends wt {
|
|
7419
7471
|
constructor(s) {
|
|
7420
7472
|
super(), this.reject = s;
|
|
7421
7473
|
}
|
|
7422
7474
|
info(...s) {
|
|
7423
7475
|
const t = () => {
|
|
7424
7476
|
var e, i;
|
|
7425
|
-
return (i = (e =
|
|
7477
|
+
return (i = (e = Dt.tips).info) == null ? void 0 : i.call(e, ...s);
|
|
7426
7478
|
};
|
|
7427
7479
|
return new wt(t, this.reject);
|
|
7428
7480
|
}
|
|
7429
7481
|
success(...s) {
|
|
7430
7482
|
const t = () => {
|
|
7431
7483
|
var e, i;
|
|
7432
|
-
return (i = (e =
|
|
7484
|
+
return (i = (e = Dt.tips).success) == null ? void 0 : i.call(e, ...s);
|
|
7433
7485
|
};
|
|
7434
7486
|
return new wt(t, this.reject);
|
|
7435
7487
|
}
|
|
@@ -7454,7 +7506,7 @@ const z = class z {
|
|
|
7454
7506
|
var i, n;
|
|
7455
7507
|
return (n = (i = z.tips)[s]) == null ? void 0 : n.call(i, ...t);
|
|
7456
7508
|
};
|
|
7457
|
-
return new
|
|
7509
|
+
return new Os(e);
|
|
7458
7510
|
};
|
|
7459
7511
|
}
|
|
7460
7512
|
static rejectTip(s) {
|
|
@@ -7463,7 +7515,7 @@ const z = class z {
|
|
|
7463
7515
|
var i, n;
|
|
7464
7516
|
return (n = (i = z.tips)[s]) == null ? void 0 : n.call(i, ...t);
|
|
7465
7517
|
};
|
|
7466
|
-
return new
|
|
7518
|
+
return new As(e);
|
|
7467
7519
|
};
|
|
7468
7520
|
}
|
|
7469
7521
|
};
|
|
@@ -7473,18 +7525,18 @@ d(z, "tips", {
|
|
|
7473
7525
|
warning: void 0,
|
|
7474
7526
|
error: void 0
|
|
7475
7527
|
}), d(z, "info", z.resolveTip("info")), d(z, "success", z.resolveTip("success")), d(z, "warning", z.rejectTip("warning")), d(z, "error", z.rejectTip("error"));
|
|
7476
|
-
let
|
|
7528
|
+
let Dt = z;
|
|
7477
7529
|
export {
|
|
7478
7530
|
Je as EXTENSION_TO_MIME,
|
|
7479
|
-
|
|
7480
|
-
|
|
7531
|
+
Kt as FILE_EXTENSIONS,
|
|
7532
|
+
Re as PAPER_SIZE_DEFINITIONS,
|
|
7481
7533
|
Is as PAPER_SIZE_OPTIONS,
|
|
7482
|
-
|
|
7534
|
+
xe as UNIT_LABELS,
|
|
7483
7535
|
Ts as WINDOW_TARGET,
|
|
7484
7536
|
Ns as _Animate_CreateOscillator,
|
|
7485
7537
|
Hs as _Animate_CubicBezier,
|
|
7486
7538
|
Ke as _Animate_NumericTransition,
|
|
7487
|
-
|
|
7539
|
+
Bt as _Animate_Schedule,
|
|
7488
7540
|
Fs as _Blob_ConvertDataToImageUrl,
|
|
7489
7541
|
un as _Browser_CalculatePrintableArea,
|
|
7490
7542
|
hn as _Browser_CopyToClipboard,
|
|
@@ -7496,7 +7548,7 @@ export {
|
|
|
7496
7548
|
T as _Canvas_Axis,
|
|
7497
7549
|
mn as _Canvas_TimeAxis,
|
|
7498
7550
|
Cn as _Element_CalculateCanvasSize,
|
|
7499
|
-
|
|
7551
|
+
_n as _Element_CheckImagesLoaded,
|
|
7500
7552
|
wn as _Element_CloseOnOutsideClick,
|
|
7501
7553
|
xn as _Element_Drag,
|
|
7502
7554
|
We as _Element_EnterFullscreen,
|
|
@@ -7505,42 +7557,43 @@ export {
|
|
|
7505
7557
|
vn as _Element_FullscreenController,
|
|
7506
7558
|
pn as _Element_FullscreenObserver,
|
|
7507
7559
|
bn as _Element_GetOtherSizeInPixels,
|
|
7508
|
-
|
|
7560
|
+
jt as _Element_IsFullscreen,
|
|
7509
7561
|
Sn as _Element_LoadImage,
|
|
7510
7562
|
Pn as _Element_LocalDrag,
|
|
7511
7563
|
yn as _Element_ScrollEndListener,
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7564
|
+
Dn as _File_CreateAndDownload,
|
|
7565
|
+
Ms as _File_Download,
|
|
7566
|
+
En as _File_Read,
|
|
7567
|
+
Mn as _File_Select,
|
|
7516
7568
|
Xs as _Format_CamelCase,
|
|
7517
7569
|
zs as _Format_CapitalizeFirstLetter,
|
|
7518
7570
|
$s as _Format_ChunkArray,
|
|
7519
7571
|
Ys as _Format_ExcludeSubstring,
|
|
7520
7572
|
Gs as _Format_FileSize,
|
|
7521
|
-
|
|
7573
|
+
ie as _Format_HrefName,
|
|
7522
7574
|
Ws as _Format_MillisecondToReadable,
|
|
7523
|
-
|
|
7575
|
+
ee as _Format_NumberWithCommas,
|
|
7524
7576
|
Us as _Format_NumberWithUnit,
|
|
7525
7577
|
Bs as _Format_Percentage,
|
|
7526
7578
|
ti as _Format_Timestamp,
|
|
7527
7579
|
js as _Format_ToggleInvisibleChars,
|
|
7528
|
-
|
|
7529
|
-
|
|
7580
|
+
De as _Math_CalculateDistance2D,
|
|
7581
|
+
An as _Math_Degree,
|
|
7530
7582
|
Vn as _Math_GetArcPoints,
|
|
7531
|
-
|
|
7583
|
+
Ln as _Math_GetBezierCurveNodes,
|
|
7584
|
+
On as _Math_GetBoundaryIntersection,
|
|
7532
7585
|
qe as _Math_GetMidpoint,
|
|
7533
|
-
|
|
7586
|
+
Rn as _Math_LngLatToPlane,
|
|
7534
7587
|
kn as _Math_PlaneToLngLat,
|
|
7535
7588
|
ks as _Math_PointToLineDistance,
|
|
7536
|
-
|
|
7589
|
+
Dt as _Tip,
|
|
7537
7590
|
si as _Utility_Clone,
|
|
7538
7591
|
ri as _Utility_ColorConverter,
|
|
7539
7592
|
Le as _Utility_Debounce,
|
|
7540
7593
|
tn as _Utility_ExecuteWhenIdle,
|
|
7541
|
-
|
|
7594
|
+
ne as _Utility_GenerateUUID,
|
|
7542
7595
|
sn as _Utility_GetTargetByPath,
|
|
7543
|
-
|
|
7596
|
+
lt as _Utility_MergeObjects,
|
|
7544
7597
|
rn as _Utility_RotateList,
|
|
7545
7598
|
nn as _Utility_SetTargetByPath,
|
|
7546
7599
|
on as _Utility_Sleep,
|
|
@@ -7548,12 +7601,12 @@ export {
|
|
|
7548
7601
|
ni as _Utility_TimeConsumption,
|
|
7549
7602
|
ii as _Utility_WaitForCondition,
|
|
7550
7603
|
Ks as _Valid_CheckConnectionWithXHR,
|
|
7551
|
-
|
|
7604
|
+
se as _Valid_DataType,
|
|
7552
7605
|
Qs as _Valid_DoesInfiniteLineIntersectRectangle,
|
|
7553
|
-
|
|
7554
|
-
|
|
7606
|
+
Pe as _Valid_FileTypeChecker,
|
|
7607
|
+
Ut as _Valid_Is2DNumberArray,
|
|
7555
7608
|
qs as _Valid_IsInMargin,
|
|
7556
|
-
|
|
7609
|
+
pe as _Valid_IsNumberArray,
|
|
7557
7610
|
Zs as _Valid_IsPointInPolygon,
|
|
7558
7611
|
Js as _Valid_IsSecureContext
|
|
7559
7612
|
};
|