nhanh-pure-function 3.0.6-beta.3 → 3.0.6-beta.4
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/File/index.d.ts +17 -7
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +1135 -1126
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -3,9 +3,9 @@ var Xe = Object.defineProperty;
|
|
|
3
3
|
var de = (r) => {
|
|
4
4
|
throw TypeError(r);
|
|
5
5
|
};
|
|
6
|
-
var Ge = (r,
|
|
7
|
-
var f = (r,
|
|
8
|
-
var
|
|
6
|
+
var Ge = (r, s, t) => s in r ? Xe(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
7
|
+
var f = (r, s, t) => Ge(r, typeof s != "symbol" ? s + "" : s, t), fe = (r, s, t) => s.has(r) || de("Cannot " + t);
|
|
8
|
+
var P = (r, s, t) => (fe(r, s, "read from private field"), t ? t.call(r) : s.get(r)), N = (r, s, t) => s.has(r) ? de("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), D = (r, s, t, e) => (fe(r, s, "write to private field"), e ? e.call(r, t) : s.set(r, t), t);
|
|
9
9
|
const Ye = {
|
|
10
10
|
".mp3": "audio/mpeg",
|
|
11
11
|
".mp4": "video/mp4",
|
|
@@ -321,45 +321,45 @@ const Ye = {
|
|
|
321
321
|
label: r
|
|
322
322
|
})
|
|
323
323
|
);
|
|
324
|
-
function Ut(r,
|
|
324
|
+
function Ut(r, s = 500) {
|
|
325
325
|
let t, e = !0;
|
|
326
|
-
function i(
|
|
326
|
+
function i(n) {
|
|
327
327
|
if (!e) return;
|
|
328
|
-
t || (t =
|
|
329
|
-
let o = Math.min((
|
|
330
|
-
r(o),
|
|
328
|
+
t || (t = n);
|
|
329
|
+
let o = Math.min((n - t) / s, 1);
|
|
330
|
+
r(o), n - t < s && requestAnimationFrame(i);
|
|
331
331
|
}
|
|
332
332
|
return requestAnimationFrame(i), () => e = !1;
|
|
333
333
|
}
|
|
334
|
-
function Ps(r,
|
|
335
|
-
let
|
|
334
|
+
function Ps(r, s, t, e, i = 2) {
|
|
335
|
+
let n = r, o = !1, a = 1, l = r, c = s, h = t;
|
|
336
336
|
const u = () => {
|
|
337
|
-
const
|
|
338
|
-
return Number(
|
|
337
|
+
const C = (c - l) / h;
|
|
338
|
+
return Number(C.toFixed(i));
|
|
339
339
|
};
|
|
340
340
|
let d = u();
|
|
341
|
-
const m = (
|
|
341
|
+
const m = (C) => Math.min(Math.max(C, l), c), g = (C) => Number(C.toFixed(i)), p = (C, _, E) => {
|
|
342
342
|
const A = [];
|
|
343
|
-
return
|
|
344
|
-
}, v = (
|
|
345
|
-
const A = p(
|
|
346
|
-
return A.length > 0 ? (console.error(`参数更新失败: ${A.join("; ")}`), !1) : (l =
|
|
347
|
-
},
|
|
348
|
-
o && (a =
|
|
343
|
+
return C >= _ && A.push("最小值必须小于最大值"), E <= 0 ? A.push("分段数必须为正数") : u() == 0 && A.push("数值精度过低,致使动画步长为 0"), A;
|
|
344
|
+
}, v = (C, _, E) => {
|
|
345
|
+
const A = p(C, _, E);
|
|
346
|
+
return A.length > 0 ? (console.error(`参数更新失败: ${A.join("; ")}`), !1) : (l = C, c = _, h = E, d = u(), n = m(n), !0);
|
|
347
|
+
}, w = () => {
|
|
348
|
+
o && (a = n >= c ? -1 : n <= l ? 1 : a, n = m(n + d * a), e(g(n)), requestAnimationFrame(w));
|
|
349
349
|
};
|
|
350
350
|
return {
|
|
351
351
|
/** 启动/继续动画 */
|
|
352
|
-
play(
|
|
353
|
-
if (
|
|
352
|
+
play(C = n) {
|
|
353
|
+
if (n = m(C), p(l, c, h).length)
|
|
354
354
|
return console.error("配置参数错误", this.getParams());
|
|
355
|
-
o || (o = !0,
|
|
355
|
+
o || (o = !0, w());
|
|
356
356
|
},
|
|
357
357
|
/** 暂停动画 */
|
|
358
358
|
pause() {
|
|
359
359
|
o = !1;
|
|
360
360
|
},
|
|
361
361
|
/** 获取当前值 */
|
|
362
|
-
getCurrent: () => g(
|
|
362
|
+
getCurrent: () => g(n),
|
|
363
363
|
/** 是否正在运行 */
|
|
364
364
|
isPlaying: () => o,
|
|
365
365
|
/** 更新参数(不中断动画) */
|
|
@@ -368,33 +368,33 @@ function Ps(r, n, t, e, i = 2) {
|
|
|
368
368
|
getParams: () => ({ min: l, max: c, steps: h, precision: i, stepSize: d })
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
|
-
function xs(r,
|
|
371
|
+
function xs(r, s, t, e, i = 2) {
|
|
372
372
|
if (t <= 0) return console.error("动画步数 必须为正数");
|
|
373
|
-
const
|
|
373
|
+
const n = (u) => Number(u.toFixed(i)), o = s - r, a = n(Math.abs(o) / t);
|
|
374
374
|
if (a === 0) return console.error("数值精度过低,致使动画步长为 0");
|
|
375
375
|
const l = Math.sign(o);
|
|
376
376
|
let c = r;
|
|
377
377
|
const h = () => {
|
|
378
|
-
c =
|
|
378
|
+
c = n(c + a * l), (l > 0 ? c < s : c > s) ? (e(c), requestAnimationFrame(h)) : e(s);
|
|
379
379
|
};
|
|
380
380
|
h();
|
|
381
381
|
}
|
|
382
|
-
function bs(r,
|
|
382
|
+
function bs(r, s = "image/png") {
|
|
383
383
|
try {
|
|
384
|
-
let t, e =
|
|
384
|
+
let t, e = s;
|
|
385
385
|
if (r instanceof File)
|
|
386
386
|
return URL.createObjectURL(r);
|
|
387
387
|
if (typeof r == "string") {
|
|
388
|
-
let
|
|
389
|
-
const o =
|
|
388
|
+
let n = r;
|
|
389
|
+
const o = n.match(/^data:([^;]*)(;base64)?,(.*)$/i);
|
|
390
390
|
if (o) {
|
|
391
391
|
if (!o[2])
|
|
392
392
|
return console.error("无效的数据 URL:缺少 base64 编码声明");
|
|
393
|
-
if (e = o[1] || e,
|
|
393
|
+
if (e = o[1] || e, n = o[3], !n)
|
|
394
394
|
return console.error("数据 URL 包含空有效负载");
|
|
395
395
|
}
|
|
396
|
-
|
|
397
|
-
const a = atob(
|
|
396
|
+
n = n.replace(/[^A-Za-z0-9+/=]/g, "");
|
|
397
|
+
const a = atob(n);
|
|
398
398
|
t = new Uint8Array(a.length);
|
|
399
399
|
for (let l = 0; l < a.length; l++)
|
|
400
400
|
t[l] = a.charCodeAt(l);
|
|
@@ -416,13 +416,13 @@ function bs(r, n = "image/png") {
|
|
|
416
416
|
), null;
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
|
-
function Cs(r,
|
|
420
|
-
let t = 0, e =
|
|
419
|
+
function Cs(r, s = 10) {
|
|
420
|
+
let t = 0, e = s;
|
|
421
421
|
function i() {
|
|
422
422
|
if (e > 0)
|
|
423
423
|
e--, requestAnimationFrame(i);
|
|
424
424
|
else {
|
|
425
|
-
const o = (+/* @__PURE__ */ new Date() - t) /
|
|
425
|
+
const o = (+/* @__PURE__ */ new Date() - t) / s, a = 1e3 / o;
|
|
426
426
|
r(Number(a.toFixed(2)), Number(o.toFixed(2)));
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -431,9 +431,9 @@ function Cs(r, n = 10) {
|
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
function _s(r) {
|
|
434
|
-
const
|
|
434
|
+
const s = () => Promise.resolve(), t = (a) => (console.error(a), Promise.reject(a));
|
|
435
435
|
function e() {
|
|
436
|
-
return navigator.clipboard.writeText(r).then(
|
|
436
|
+
return navigator.clipboard.writeText(r).then(s).catch(t);
|
|
437
437
|
}
|
|
438
438
|
function i() {
|
|
439
439
|
const a = document.createElement("div");
|
|
@@ -444,15 +444,15 @@ function _s(r) {
|
|
|
444
444
|
let h = !1;
|
|
445
445
|
return c && (c.removeAllRanges(), c.addRange(l), h = document.execCommand("copy")), document.body.removeChild(a), h ? Promise.resolve() : Promise.reject();
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function n() {
|
|
448
448
|
const a = document.createElement("textarea");
|
|
449
449
|
a.value = r, document.body.appendChild(a), a.select(), a.setSelectionRange(0, r.length);
|
|
450
450
|
let l = !1;
|
|
451
451
|
return document.activeElement === a && (l = document.execCommand("Copy", !0)), document.body.removeChild(a), l ? Promise.resolve() : Promise.reject();
|
|
452
452
|
}
|
|
453
453
|
function o() {
|
|
454
|
-
return i().then(
|
|
455
|
-
|
|
454
|
+
return i().then(s).catch(() => {
|
|
455
|
+
n().then(s).catch(() => t("复制方式尽皆失效"));
|
|
456
456
|
});
|
|
457
457
|
}
|
|
458
458
|
return navigator.clipboard ? e().catch(o) : o();
|
|
@@ -462,8 +462,8 @@ class ze {
|
|
|
462
462
|
constructor() {
|
|
463
463
|
}
|
|
464
464
|
/** 添加已有窗口 */
|
|
465
|
-
static add(
|
|
466
|
-
this.keys.set(
|
|
465
|
+
static add(s, t) {
|
|
466
|
+
this.keys.set(s, t);
|
|
467
467
|
}
|
|
468
468
|
/**
|
|
469
469
|
* 根据键打开或聚焦窗口
|
|
@@ -473,15 +473,15 @@ class ze {
|
|
|
473
473
|
* @param windowFeatures 新窗口的特性
|
|
474
474
|
* @returns 返回已打开或新打开的窗口
|
|
475
475
|
*/
|
|
476
|
-
static open(
|
|
477
|
-
const
|
|
478
|
-
if (
|
|
479
|
-
return
|
|
476
|
+
static open(s, t, e, i) {
|
|
477
|
+
const n = this.keys.get(s);
|
|
478
|
+
if (n && !n.closed)
|
|
479
|
+
return n.focus(), n;
|
|
480
480
|
{
|
|
481
481
|
const o = window.open(t, e, i);
|
|
482
482
|
if (o)
|
|
483
|
-
return this.keys.set(
|
|
484
|
-
console.error("window.open failed: 可能是浏览器阻止了弹出窗口"), this.keys.delete(
|
|
483
|
+
return this.keys.set(s, o), o;
|
|
484
|
+
console.error("window.open failed: 可能是浏览器阻止了弹出窗口"), this.keys.delete(s);
|
|
485
485
|
}
|
|
486
486
|
}
|
|
487
487
|
/**
|
|
@@ -489,39 +489,39 @@ class ze {
|
|
|
489
489
|
* @param key 窗口的唯一键
|
|
490
490
|
* @returns 如果窗口打开则返回true,否则返回false
|
|
491
491
|
*/
|
|
492
|
-
static isOpen(
|
|
493
|
-
const t = this.keys.get(
|
|
494
|
-
return t != null && t.closed && this.keys.delete(
|
|
492
|
+
static isOpen(s) {
|
|
493
|
+
const t = this.keys.get(s);
|
|
494
|
+
return t != null && t.closed && this.keys.delete(s), this.keys.has(s);
|
|
495
495
|
}
|
|
496
496
|
/**
|
|
497
497
|
* 获取与指定键关联的窗口
|
|
498
498
|
* @param key 窗口的唯一键
|
|
499
499
|
* @returns 返回对应的窗口,如果窗口已关闭则返回undefined
|
|
500
500
|
*/
|
|
501
|
-
static getWindow(
|
|
502
|
-
if (this.isOpen(
|
|
501
|
+
static getWindow(s) {
|
|
502
|
+
if (this.isOpen(s)) return this.keys.get(s);
|
|
503
503
|
}
|
|
504
504
|
/**
|
|
505
505
|
* 关闭与指定键关联的窗口
|
|
506
506
|
* @param key 窗口的唯一键
|
|
507
507
|
*/
|
|
508
|
-
static close(
|
|
509
|
-
const t = this.keys.get(
|
|
510
|
-
t && (t.close(), this.keys.delete(
|
|
508
|
+
static close(s) {
|
|
509
|
+
const t = this.keys.get(s);
|
|
510
|
+
t && (t.close(), this.keys.delete(s));
|
|
511
511
|
}
|
|
512
512
|
/**
|
|
513
513
|
* 关闭所有打开的窗口并清空Map
|
|
514
514
|
*/
|
|
515
515
|
static closeAll() {
|
|
516
|
-
this.keys.forEach((
|
|
516
|
+
this.keys.forEach((s, t) => s.close()), this.keys.clear();
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
519
|
// 存储键与对应窗口的Map
|
|
520
520
|
f(ze, "keys", /* @__PURE__ */ new Map());
|
|
521
|
-
function Ss(r,
|
|
521
|
+
function Ss(r, s) {
|
|
522
522
|
const t = be[r];
|
|
523
523
|
if (!t) throw new Error(`未知纸张类型: ${r}`);
|
|
524
|
-
const { width: e, height: i } = t,
|
|
524
|
+
const { width: e, height: i } = t, n = (g) => g / 25.4, a = typeof window < "u" ? window.devicePixelRatio * 96 : 300, l = (g) => Math.round(n(g) * a), c = l(e), h = l(i), u = l(s), d = Math.max(0, c - 2 * u), m = Math.max(0, h - 2 * u);
|
|
525
525
|
return {
|
|
526
526
|
/** 内容宽度(像素) */
|
|
527
527
|
contentWidth: d,
|
|
@@ -608,31 +608,31 @@ y.absoluteValue = y.abs = function() {
|
|
|
608
608
|
y.ceil = function() {
|
|
609
609
|
return x(new this.constructor(this), this.e + 1, 2);
|
|
610
610
|
};
|
|
611
|
-
y.clampedTo = y.clamp = function(r,
|
|
611
|
+
y.clampedTo = y.clamp = function(r, s) {
|
|
612
612
|
var t, e = this, i = e.constructor;
|
|
613
|
-
if (r = new i(r),
|
|
614
|
-
if (r.gt(
|
|
615
|
-
return t = e.cmp(r), t < 0 ? r : e.cmp(
|
|
613
|
+
if (r = new i(r), s = new i(s), !r.s || !s.s) return new i(NaN);
|
|
614
|
+
if (r.gt(s)) throw Error(ct + s);
|
|
615
|
+
return t = e.cmp(r), t < 0 ? r : e.cmp(s) > 0 ? s : new i(e);
|
|
616
616
|
};
|
|
617
617
|
y.comparedTo = y.cmp = function(r) {
|
|
618
|
-
var
|
|
618
|
+
var s, t, e, i, n = this, o = n.d, a = (r = new n.constructor(r)).d, l = n.s, c = r.s;
|
|
619
619
|
if (!o || !a)
|
|
620
620
|
return !l || !c ? NaN : l !== c ? l : o === a ? 0 : !o ^ l < 0 ? 1 : -1;
|
|
621
621
|
if (!o[0] || !a[0]) return o[0] ? l : a[0] ? -c : 0;
|
|
622
622
|
if (l !== c) return l;
|
|
623
|
-
if (
|
|
624
|
-
for (e = o.length, i = a.length,
|
|
625
|
-
if (o[
|
|
623
|
+
if (n.e !== r.e) return n.e > r.e ^ l < 0 ? 1 : -1;
|
|
624
|
+
for (e = o.length, i = a.length, s = 0, t = e < i ? e : i; s < t; ++s)
|
|
625
|
+
if (o[s] !== a[s]) return o[s] > a[s] ^ l < 0 ? 1 : -1;
|
|
626
626
|
return e === i ? 0 : e > i ^ l < 0 ? 1 : -1;
|
|
627
627
|
};
|
|
628
628
|
y.cosine = y.cos = function() {
|
|
629
|
-
var r,
|
|
630
|
-
return t.d ? t.d[0] ? (r = e.precision,
|
|
629
|
+
var r, s, t = this, e = t.constructor;
|
|
630
|
+
return t.d ? t.d[0] ? (r = e.precision, s = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + b, e.rounding = 1, t = Je(e, Me(e, t)), e.precision = r, e.rounding = s, x(nt == 2 || nt == 3 ? t.neg() : t, r, s, !0)) : new e(1) : new e(NaN);
|
|
631
631
|
};
|
|
632
632
|
y.cubeRoot = y.cbrt = function() {
|
|
633
|
-
var r,
|
|
633
|
+
var r, s, t, e, i, n, o, a, l, c, h = this, u = h.constructor;
|
|
634
634
|
if (!h.isFinite() || h.isZero()) return new u(h);
|
|
635
|
-
for (S = !1,
|
|
635
|
+
for (S = !1, n = h.s * I(h.s * h, 1 / 3), !n || Math.abs(n) == 1 / 0 ? (t = H(h.d), r = h.e, (n = (r - t.length + 1) % 3) && (t += n == 1 || n == -2 ? "0" : "00"), n = I(t, 1 / 3), r = T((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; ; )
|
|
636
636
|
if (a = e, l = a.times(a).times(a), c = l.plus(h), e = k(c.plus(h).times(a), c.plus(l), o + 2, 1), H(a.d).slice(0, o) === (t = H(e.d)).slice(0, o))
|
|
637
637
|
if (t = t.slice(o - 3, o + 1), t == "9999" || !i && t == "4999") {
|
|
638
638
|
if (!i && (x(a, r + 1, 0), a.times(a).times(a).eq(h))) {
|
|
@@ -641,15 +641,15 @@ y.cubeRoot = y.cbrt = function() {
|
|
|
641
641
|
}
|
|
642
642
|
o += 4, i = 1;
|
|
643
643
|
} else {
|
|
644
|
-
(!+t || !+t.slice(1) && t.charAt(0) == "5") && (x(e, r + 1, 1),
|
|
644
|
+
(!+t || !+t.slice(1) && t.charAt(0) == "5") && (x(e, r + 1, 1), s = !e.times(e).times(e).eq(h));
|
|
645
645
|
break;
|
|
646
646
|
}
|
|
647
|
-
return S = !0, x(e, r, u.rounding,
|
|
647
|
+
return S = !0, x(e, r, u.rounding, s);
|
|
648
648
|
};
|
|
649
649
|
y.decimalPlaces = y.dp = function() {
|
|
650
|
-
var r,
|
|
651
|
-
if (
|
|
652
|
-
if (r =
|
|
650
|
+
var r, s = this.d, t = NaN;
|
|
651
|
+
if (s) {
|
|
652
|
+
if (r = s.length - 1, t = (r - T(this.e / b)) * b, r = s[r], r) for (; r % 10 == 0; r /= 10) t--;
|
|
653
653
|
t < 0 && (t = 0);
|
|
654
654
|
}
|
|
655
655
|
return t;
|
|
@@ -658,8 +658,8 @@ y.dividedBy = y.div = function(r) {
|
|
|
658
658
|
return k(this, new this.constructor(r));
|
|
659
659
|
};
|
|
660
660
|
y.dividedToIntegerBy = y.divToInt = function(r) {
|
|
661
|
-
var
|
|
662
|
-
return x(k(
|
|
661
|
+
var s = this, t = s.constructor;
|
|
662
|
+
return x(k(s, new t(r), 0, 1, 1), t.precision, t.rounding);
|
|
663
663
|
};
|
|
664
664
|
y.equals = y.eq = function(r) {
|
|
665
665
|
return this.cmp(r) === 0;
|
|
@@ -671,56 +671,56 @@ y.greaterThan = y.gt = function(r) {
|
|
|
671
671
|
return this.cmp(r) > 0;
|
|
672
672
|
};
|
|
673
673
|
y.greaterThanOrEqualTo = y.gte = function(r) {
|
|
674
|
-
var
|
|
675
|
-
return
|
|
674
|
+
var s = this.cmp(r);
|
|
675
|
+
return s == 1 || s === 0;
|
|
676
676
|
};
|
|
677
677
|
y.hyperbolicCosine = y.cosh = function() {
|
|
678
|
-
var r,
|
|
679
|
-
if (!
|
|
680
|
-
if (
|
|
681
|
-
t = o.precision, e = o.rounding, o.precision = t + Math.max(
|
|
678
|
+
var r, s, t, e, i, n = this, o = n.constructor, a = new o(1);
|
|
679
|
+
if (!n.isFinite()) return new o(n.s ? 1 / 0 : NaN);
|
|
680
|
+
if (n.isZero()) return a;
|
|
681
|
+
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 / Zt(4, r)).toString()) : (r = 16, s = "2.3283064365386962890625e-10"), n = Et(o, 1, n.times(s), new o(1), !0);
|
|
682
682
|
for (var l, c = r, h = new o(8); c--; )
|
|
683
|
-
l =
|
|
684
|
-
return x(
|
|
683
|
+
l = n.times(n), n = a.minus(l.times(h.minus(l.times(h))));
|
|
684
|
+
return x(n, o.precision = t, o.rounding = e, !0);
|
|
685
685
|
};
|
|
686
686
|
y.hyperbolicSine = y.sinh = function() {
|
|
687
|
-
var r,
|
|
688
|
-
if (!i.isFinite() || i.isZero()) return new
|
|
689
|
-
if (
|
|
690
|
-
i = Et(
|
|
687
|
+
var r, s, t, e, i = this, n = i.constructor;
|
|
688
|
+
if (!i.isFinite() || i.isZero()) return new n(i);
|
|
689
|
+
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)
|
|
690
|
+
i = Et(n, 2, i, i, !0);
|
|
691
691
|
else {
|
|
692
|
-
r = 1.4 * Math.sqrt(e), r = r > 16 ? 16 : r | 0, i = i.times(1 / Zt(5, r)), i = Et(
|
|
693
|
-
for (var o, a = new
|
|
692
|
+
r = 1.4 * Math.sqrt(e), r = r > 16 ? 16 : r | 0, i = i.times(1 / Zt(5, r)), i = Et(n, 2, i, i, !0);
|
|
693
|
+
for (var o, a = new n(5), l = new n(16), c = new n(20); r--; )
|
|
694
694
|
o = i.times(i), i = i.times(a.plus(o.times(l.times(o).plus(c))));
|
|
695
695
|
}
|
|
696
|
-
return
|
|
696
|
+
return n.precision = s, n.rounding = t, x(i, s, t, !0);
|
|
697
697
|
};
|
|
698
698
|
y.hyperbolicTangent = y.tanh = function() {
|
|
699
|
-
var r,
|
|
700
|
-
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision,
|
|
699
|
+
var r, s, t = this, e = t.constructor;
|
|
700
|
+
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + 7, e.rounding = 1, k(t.sinh(), t.cosh(), e.precision = r, e.rounding = s)) : new e(t.s);
|
|
701
701
|
};
|
|
702
702
|
y.inverseCosine = y.acos = function() {
|
|
703
|
-
var r = this,
|
|
704
|
-
return t !== -1 ? t === 0 ? r.isNeg() ? K(
|
|
703
|
+
var r = this, s = r.constructor, t = r.abs().cmp(1), e = s.precision, i = s.rounding;
|
|
704
|
+
return t !== -1 ? t === 0 ? r.isNeg() ? K(s, e, i) : new s(0) : new s(NaN) : r.isZero() ? K(s, e + 4, i).times(0.5) : (s.precision = e + 6, s.rounding = 1, r = new s(1).minus(r).div(r.plus(1)).sqrt().atan(), s.precision = e, s.rounding = i, r.times(2));
|
|
705
705
|
};
|
|
706
706
|
y.inverseHyperbolicCosine = y.acosh = function() {
|
|
707
|
-
var r,
|
|
708
|
-
return t.lte(1) ? new e(t.eq(1) ? 0 : NaN) : t.isFinite() ? (r = e.precision,
|
|
707
|
+
var r, s, t = this, e = t.constructor;
|
|
708
|
+
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, S = !1, t = t.times(t).minus(1).sqrt().plus(t), S = !0, e.precision = r, e.rounding = s, t.ln()) : new e(t);
|
|
709
709
|
};
|
|
710
710
|
y.inverseHyperbolicSine = y.asinh = function() {
|
|
711
|
-
var r,
|
|
712
|
-
return !t.isFinite() || t.isZero() ? new e(t) : (r = e.precision,
|
|
711
|
+
var r, s, t = this, e = t.constructor;
|
|
712
|
+
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, S = !1, t = t.times(t).plus(1).sqrt().plus(t), S = !0, e.precision = r, e.rounding = s, t.ln());
|
|
713
713
|
};
|
|
714
714
|
y.inverseHyperbolicTangent = y.atanh = function() {
|
|
715
|
-
var r,
|
|
716
|
-
return i.isFinite() ? i.e >= 0 ? new
|
|
715
|
+
var r, s, t, e, i = this, n = i.constructor;
|
|
716
|
+
return i.isFinite() ? i.e >= 0 ? new n(i.abs().eq(1) ? i.s / 0 : i.isZero() ? i : NaN) : (r = n.precision, s = n.rounding, e = i.sd(), Math.max(e, r) < 2 * -i.e - 1 ? x(new n(i), r, s, !0) : (n.precision = t = e - i.e, i = k(i.plus(1), new n(1).minus(i), t + r, 1), n.precision = r + 4, n.rounding = 1, i = i.ln(), n.precision = r, n.rounding = s, i.times(0.5))) : new n(NaN);
|
|
717
717
|
};
|
|
718
718
|
y.inverseSine = y.asin = function() {
|
|
719
|
-
var r,
|
|
720
|
-
return i.isZero() ? new
|
|
719
|
+
var r, s, t, e, i = this, n = i.constructor;
|
|
720
|
+
return i.isZero() ? new n(i) : (s = i.abs().cmp(1), t = n.precision, e = n.rounding, s !== -1 ? s === 0 ? (r = K(n, t + 4, e).times(0.5), r.s = i.s, r) : new n(NaN) : (n.precision = t + 6, n.rounding = 1, i = i.div(new n(1).minus(i.times(i)).sqrt().plus(1)).atan(), n.precision = t, n.rounding = e, i.times(2)));
|
|
721
721
|
};
|
|
722
722
|
y.inverseTangent = y.atan = function() {
|
|
723
|
-
var r,
|
|
723
|
+
var r, s, t, e, i, n, o, a, l, c = this, h = c.constructor, u = h.precision, d = h.rounding;
|
|
724
724
|
if (c.isFinite()) {
|
|
725
725
|
if (c.isZero())
|
|
726
726
|
return new h(c);
|
|
@@ -732,8 +732,8 @@ y.inverseTangent = y.atan = function() {
|
|
|
732
732
|
return o = K(h, u + 4, d).times(0.5), o.s = c.s, o;
|
|
733
733
|
}
|
|
734
734
|
for (h.precision = a = u + 10, h.rounding = 1, t = Math.min(28, a / b + 2 | 0), r = t; r; --r) c = c.div(c.times(c).plus(1).sqrt().plus(1));
|
|
735
|
-
for (S = !1,
|
|
736
|
-
if (i = i.times(l),
|
|
735
|
+
for (S = !1, s = Math.ceil(a / b), e = 1, l = c.times(c), o = new h(c), i = c; r !== -1; )
|
|
736
|
+
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--; ) ;
|
|
737
737
|
return t && (o = o.times(2 << t - 1)), S = !0, x(o, h.precision = u, h.rounding = d, !0);
|
|
738
738
|
};
|
|
739
739
|
y.isFinite = function() {
|
|
@@ -761,25 +761,25 @@ y.lessThanOrEqualTo = y.lte = function(r) {
|
|
|
761
761
|
return this.cmp(r) < 1;
|
|
762
762
|
};
|
|
763
763
|
y.logarithm = y.log = function(r) {
|
|
764
|
-
var
|
|
764
|
+
var s, t, e, i, n, o, a, l, c = this, h = c.constructor, u = h.precision, d = h.rounding, m = 5;
|
|
765
765
|
if (r == null)
|
|
766
|
-
r = new h(10),
|
|
766
|
+
r = new h(10), s = !0;
|
|
767
767
|
else {
|
|
768
768
|
if (r = new h(r), t = r.d, r.s < 0 || !t || !t[0] || r.eq(1)) return new h(NaN);
|
|
769
|
-
|
|
769
|
+
s = r.eq(10);
|
|
770
770
|
}
|
|
771
771
|
if (t = c.d, c.s < 0 || !t || !t[0] || c.eq(1))
|
|
772
772
|
return new h(t && !t[0] ? -1 / 0 : c.s != 1 ? NaN : t ? 0 : 1 / 0);
|
|
773
|
-
if (
|
|
773
|
+
if (s)
|
|
774
774
|
if (t.length > 1)
|
|
775
|
-
|
|
775
|
+
n = !0;
|
|
776
776
|
else {
|
|
777
777
|
for (i = t[0]; i % 10 === 0; ) i /= 10;
|
|
778
|
-
|
|
778
|
+
n = i !== 1;
|
|
779
779
|
}
|
|
780
|
-
if (S = !1, a = u + m, o = at(c, a), e =
|
|
780
|
+
if (S = !1, a = u + m, o = at(c, a), e = s ? Yt(h, a + 10) : at(r, a), l = k(o, e, a, 1), Vt(l.d, i = u, d))
|
|
781
781
|
do
|
|
782
|
-
if (a += 10, o = at(c, a), e =
|
|
782
|
+
if (a += 10, o = at(c, a), e = s ? Yt(h, a + 10) : at(r, a), l = k(o, e, a, 1), !n) {
|
|
783
783
|
+H(l.d).slice(i + 1, i + 15) + 1 == 1e14 && (l = x(l, u + 1, 0));
|
|
784
784
|
break;
|
|
785
785
|
}
|
|
@@ -787,7 +787,7 @@ y.logarithm = y.log = function(r) {
|
|
|
787
787
|
return S = !0, x(l, u, d);
|
|
788
788
|
};
|
|
789
789
|
y.minus = y.sub = function(r) {
|
|
790
|
-
var
|
|
790
|
+
var s, t, e, i, n, o, a, l, c, h, u, d, m = this, g = m.constructor;
|
|
791
791
|
if (r = new g(r), !m.d || !r.d)
|
|
792
792
|
return !m.s || !r.s ? r = new g(NaN) : m.d ? r.s = -r.s : r = new g(r.d || m.s !== r.s ? m : NaN), r;
|
|
793
793
|
if (m.s != r.s)
|
|
@@ -798,19 +798,19 @@ y.minus = y.sub = function(r) {
|
|
|
798
798
|
else return new g(l === 3 ? -0 : 0);
|
|
799
799
|
return S ? x(r, a, l) : r;
|
|
800
800
|
}
|
|
801
|
-
if (t = T(r.e / b), h = T(m.e / b), c = c.slice(),
|
|
802
|
-
for (u =
|
|
803
|
-
|
|
801
|
+
if (t = T(r.e / b), h = T(m.e / b), c = c.slice(), n = h - t, n) {
|
|
802
|
+
for (u = n < 0, u ? (s = c, n = -n, o = d.length) : (s = d, t = h, o = c.length), e = Math.max(Math.ceil(a / b), o) + 2, n > e && (n = e, s.length = 1), s.reverse(), e = n; e--; ) s.push(0);
|
|
803
|
+
s.reverse();
|
|
804
804
|
} else {
|
|
805
805
|
for (e = c.length, o = d.length, u = e < o, u && (o = e), e = 0; e < o; e++)
|
|
806
806
|
if (c[e] != d[e]) {
|
|
807
807
|
u = c[e] < d[e];
|
|
808
808
|
break;
|
|
809
809
|
}
|
|
810
|
-
|
|
810
|
+
n = 0;
|
|
811
811
|
}
|
|
812
|
-
for (u && (
|
|
813
|
-
for (e = d.length; e >
|
|
812
|
+
for (u && (s = c, c = d, d = s, r.s = -r.s), o = c.length, e = d.length - o; e > 0; --e) c[o++] = 0;
|
|
813
|
+
for (e = d.length; e > n; ) {
|
|
814
814
|
if (c[--e] < d[e]) {
|
|
815
815
|
for (i = e; i && c[--i] === 0; ) c[i] = j - 1;
|
|
816
816
|
--c[i], c[e] += j;
|
|
@@ -822,8 +822,8 @@ y.minus = y.sub = function(r) {
|
|
|
822
822
|
return c[0] ? (r.d = c, r.e = $t(c, t), S ? x(r, a, l) : r) : new g(l === 3 ? -0 : 0);
|
|
823
823
|
};
|
|
824
824
|
y.modulo = y.mod = function(r) {
|
|
825
|
-
var
|
|
826
|
-
return r = new e(r), !t.d || !r.s || r.d && !r.d[0] ? new e(NaN) : !r.d || t.d && !t.d[0] ? x(new e(t), e.precision, e.rounding) : (S = !1, e.modulo == 9 ? (
|
|
825
|
+
var s, t = this, e = t.constructor;
|
|
826
|
+
return r = new e(r), !t.d || !r.s || r.d && !r.d[0] ? new e(NaN) : !r.d || t.d && !t.d[0] ? x(new e(t), e.precision, e.rounding) : (S = !1, e.modulo == 9 ? (s = k(t, r.abs(), 0, 3, 1), s.s *= r.s) : s = k(t, r, 0, e.modulo, 1), s = s.times(r), S = !0, t.minus(s));
|
|
827
827
|
};
|
|
828
828
|
y.naturalExponential = y.exp = function() {
|
|
829
829
|
return re(this);
|
|
@@ -836,216 +836,216 @@ y.negated = y.neg = function() {
|
|
|
836
836
|
return r.s = -r.s, x(r);
|
|
837
837
|
};
|
|
838
838
|
y.plus = y.add = function(r) {
|
|
839
|
-
var
|
|
839
|
+
var s, t, e, i, n, o, a, l, c, h, u = this, d = u.constructor;
|
|
840
840
|
if (r = new d(r), !u.d || !r.d)
|
|
841
841
|
return !u.s || !r.s ? r = new d(NaN) : u.d || (r = new d(r.d || u.s === r.s ? u : NaN)), r;
|
|
842
842
|
if (u.s != r.s)
|
|
843
843
|
return r.s = -r.s, u.minus(r);
|
|
844
844
|
if (c = u.d, h = r.d, a = d.precision, l = d.rounding, !c[0] || !h[0])
|
|
845
845
|
return h[0] || (r = new d(u)), S ? x(r, a, l) : r;
|
|
846
|
-
if (
|
|
847
|
-
for (i < 0 ? (t = c, i = -i, o = h.length) : (t = h, e =
|
|
846
|
+
if (n = T(u.e / b), e = T(r.e / b), c = c.slice(), i = n - e, i) {
|
|
847
|
+
for (i < 0 ? (t = c, i = -i, o = h.length) : (t = h, e = n, o = c.length), n = Math.ceil(a / b), o = n > o ? n + 1 : o + 1, i > o && (i = o, t.length = 1), t.reverse(); i--; ) t.push(0);
|
|
848
848
|
t.reverse();
|
|
849
849
|
}
|
|
850
|
-
for (o = c.length, i = h.length, o - i < 0 && (i = o, t = h, h = c, c = t),
|
|
851
|
-
|
|
852
|
-
for (
|
|
850
|
+
for (o = c.length, i = h.length, o - i < 0 && (i = o, t = h, h = c, c = t), s = 0; i; )
|
|
851
|
+
s = (c[--i] = c[i] + h[i] + s) / j | 0, c[i] %= j;
|
|
852
|
+
for (s && (c.unshift(s), ++e), o = c.length; c[--o] == 0; ) c.pop();
|
|
853
853
|
return r.d = c, r.e = $t(c, e), S ? x(r, a, l) : r;
|
|
854
854
|
};
|
|
855
855
|
y.precision = y.sd = function(r) {
|
|
856
|
-
var
|
|
856
|
+
var s, t = this;
|
|
857
857
|
if (r !== void 0 && r !== !!r && r !== 1 && r !== 0) throw Error(ct + r);
|
|
858
|
-
return t.d ? (
|
|
858
|
+
return t.d ? (s = Re(t.d), r && t.e + 1 > s && (s = t.e + 1)) : s = NaN, s;
|
|
859
859
|
};
|
|
860
860
|
y.round = function() {
|
|
861
|
-
var r = this,
|
|
862
|
-
return x(new
|
|
861
|
+
var r = this, s = r.constructor;
|
|
862
|
+
return x(new s(r), r.e + 1, s.rounding);
|
|
863
863
|
};
|
|
864
864
|
y.sine = y.sin = function() {
|
|
865
|
-
var r,
|
|
866
|
-
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision,
|
|
865
|
+
var r, s, t = this, e = t.constructor;
|
|
866
|
+
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + b, e.rounding = 1, t = Qe(e, Me(e, t)), e.precision = r, e.rounding = s, x(nt > 2 ? t.neg() : t, r, s, !0)) : new e(NaN);
|
|
867
867
|
};
|
|
868
868
|
y.squareRoot = y.sqrt = function() {
|
|
869
|
-
var r,
|
|
869
|
+
var r, s, t, e, i, n, o = this, a = o.d, l = o.e, c = o.s, h = o.constructor;
|
|
870
870
|
if (c !== 1 || !a || !a[0])
|
|
871
871
|
return new h(!c || c < 0 && (!a || a[0]) ? NaN : a ? o : 1 / 0);
|
|
872
|
-
for (S = !1, c = Math.sqrt(+o), c == 0 || c == 1 / 0 ? (
|
|
873
|
-
if (
|
|
874
|
-
if (
|
|
875
|
-
if (!i && (x(
|
|
876
|
-
e =
|
|
872
|
+
for (S = !1, c = Math.sqrt(+o), c == 0 || c == 1 / 0 ? (s = H(a), (s.length + l) % 2 == 0 && (s += "0"), c = Math.sqrt(s), l = T((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; ; )
|
|
873
|
+
if (n = e, e = n.plus(k(o, n, t + 2, 1)).times(0.5), H(n.d).slice(0, t) === (s = H(e.d)).slice(0, t))
|
|
874
|
+
if (s = s.slice(t - 3, t + 1), s == "9999" || !i && s == "4999") {
|
|
875
|
+
if (!i && (x(n, l + 1, 0), n.times(n).eq(o))) {
|
|
876
|
+
e = n;
|
|
877
877
|
break;
|
|
878
878
|
}
|
|
879
879
|
t += 4, i = 1;
|
|
880
880
|
} else {
|
|
881
|
-
(!+
|
|
881
|
+
(!+s || !+s.slice(1) && s.charAt(0) == "5") && (x(e, l + 1, 1), r = !e.times(e).eq(o));
|
|
882
882
|
break;
|
|
883
883
|
}
|
|
884
884
|
return S = !0, x(e, l, h.rounding, r);
|
|
885
885
|
};
|
|
886
886
|
y.tangent = y.tan = function() {
|
|
887
|
-
var r,
|
|
888
|
-
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision,
|
|
887
|
+
var r, s, t = this, e = t.constructor;
|
|
888
|
+
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + 10, e.rounding = 1, t = t.sin(), t.s = 1, t = k(t, new e(1).minus(t.times(t)).sqrt(), r + 10, 0), e.precision = r, e.rounding = s, x(nt == 2 || nt == 4 ? t.neg() : t, r, s, !0)) : new e(NaN);
|
|
889
889
|
};
|
|
890
890
|
y.times = y.mul = function(r) {
|
|
891
|
-
var
|
|
891
|
+
var s, t, e, i, n, o, a, l, c, h = this, u = h.constructor, d = h.d, m = (r = new u(r)).d;
|
|
892
892
|
if (r.s *= h.s, !d || !d[0] || !m || !m[0])
|
|
893
893
|
return new u(!r.s || d && !d[0] && !m || m && !m[0] && !d ? NaN : !d || !m ? r.s / 0 : r.s * 0);
|
|
894
|
-
for (t = T(h.e / b) + T(r.e / b), l = d.length, c = m.length, l < c && (
|
|
894
|
+
for (t = T(h.e / b) + T(r.e / b), l = d.length, c = m.length, l < c && (n = d, d = m, m = n, o = l, l = c, c = o), n = [], o = l + c, e = o; e--; ) n.push(0);
|
|
895
895
|
for (e = c; --e >= 0; ) {
|
|
896
|
-
for (
|
|
897
|
-
a =
|
|
898
|
-
|
|
896
|
+
for (s = 0, i = l + e; i > e; )
|
|
897
|
+
a = n[i] + m[e] * d[i - e - 1] + s, n[i--] = a % j | 0, s = a / j | 0;
|
|
898
|
+
n[i] = (n[i] + s) % j | 0;
|
|
899
899
|
}
|
|
900
|
-
for (; !
|
|
901
|
-
return
|
|
900
|
+
for (; !n[--o]; ) n.pop();
|
|
901
|
+
return s ? ++t : n.shift(), r.d = n, r.e = $t(n, t), S ? x(r, u.precision, u.rounding) : r;
|
|
902
902
|
};
|
|
903
|
-
y.toBinary = function(r,
|
|
904
|
-
return he(this, 2, r,
|
|
903
|
+
y.toBinary = function(r, s) {
|
|
904
|
+
return he(this, 2, r, s);
|
|
905
905
|
};
|
|
906
|
-
y.toDecimalPlaces = y.toDP = function(r,
|
|
906
|
+
y.toDecimalPlaces = y.toDP = function(r, s) {
|
|
907
907
|
var t = this, e = t.constructor;
|
|
908
|
-
return t = new e(t), r === void 0 ? t : (U(r, 0, ht),
|
|
908
|
+
return t = new e(t), r === void 0 ? t : (U(r, 0, ht), s === void 0 ? s = e.rounding : U(s, 0, 8), x(t, r + t.e + 1, s));
|
|
909
909
|
};
|
|
910
|
-
y.toExponential = function(r,
|
|
910
|
+
y.toExponential = function(r, s) {
|
|
911
911
|
var t, e = this, i = e.constructor;
|
|
912
|
-
return r === void 0 ? t = Q(e, !0) : (U(r, 0, ht),
|
|
912
|
+
return r === void 0 ? t = Q(e, !0) : (U(r, 0, ht), s === void 0 ? s = i.rounding : U(s, 0, 8), e = x(new i(e), r + 1, s), t = Q(e, !0, r + 1)), e.isNeg() && !e.isZero() ? "-" + t : t;
|
|
913
913
|
};
|
|
914
|
-
y.toFixed = function(r,
|
|
915
|
-
var t, e, i = this,
|
|
916
|
-
return r === void 0 ? t = Q(i) : (U(r, 0, ht),
|
|
914
|
+
y.toFixed = function(r, s) {
|
|
915
|
+
var t, e, i = this, n = i.constructor;
|
|
916
|
+
return r === void 0 ? t = Q(i) : (U(r, 0, ht), s === void 0 ? s = n.rounding : U(s, 0, 8), e = x(new n(i), r + i.e + 1, s), t = Q(e, !1, r + e.e + 1)), i.isNeg() && !i.isZero() ? "-" + t : t;
|
|
917
917
|
};
|
|
918
918
|
y.toFraction = function(r) {
|
|
919
|
-
var
|
|
919
|
+
var s, t, e, i, n, o, a, l, c, h, u, d, m = this, g = m.d, p = m.constructor;
|
|
920
920
|
if (!g) return new p(m);
|
|
921
|
-
if (c = t = new p(1), e = l = new p(0),
|
|
922
|
-
r =
|
|
921
|
+
if (c = t = new p(1), e = l = new p(0), s = new p(e), n = s.e = Re(g) - m.e - 1, o = n % b, s.d[0] = I(10, o < 0 ? b + o : o), r == null)
|
|
922
|
+
r = n > 0 ? s : c;
|
|
923
923
|
else {
|
|
924
924
|
if (a = new p(r), !a.isInt() || a.lt(c)) throw Error(ct + a);
|
|
925
|
-
r = a.gt(
|
|
925
|
+
r = a.gt(s) ? n > 0 ? s : c : a;
|
|
926
926
|
}
|
|
927
|
-
for (S = !1, a = new p(H(g)), h = p.precision, p.precision =
|
|
928
|
-
t = e, e = i, i = c, c = l.plus(u.times(i)), l = i, i =
|
|
929
|
-
return i = k(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, d = k(c, e,
|
|
927
|
+
for (S = !1, a = new p(H(g)), h = p.precision, p.precision = n = g.length * b * 2; u = k(a, s, 0, 1, 1), i = t.plus(u.times(e)), i.cmp(r) != 1; )
|
|
928
|
+
t = e, e = i, i = c, c = l.plus(u.times(i)), l = i, i = s, s = a.minus(u.times(i)), a = i;
|
|
929
|
+
return i = k(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, d = k(c, e, n, 1).minus(m).abs().cmp(k(l, t, n, 1).minus(m).abs()) < 1 ? [c, e] : [l, t], p.precision = h, S = !0, d;
|
|
930
930
|
};
|
|
931
|
-
y.toHexadecimal = y.toHex = function(r,
|
|
932
|
-
return he(this, 16, r,
|
|
931
|
+
y.toHexadecimal = y.toHex = function(r, s) {
|
|
932
|
+
return he(this, 16, r, s);
|
|
933
933
|
};
|
|
934
|
-
y.toNearest = function(r,
|
|
934
|
+
y.toNearest = function(r, s) {
|
|
935
935
|
var t = this, e = t.constructor;
|
|
936
936
|
if (t = new e(t), r == null) {
|
|
937
937
|
if (!t.d) return t;
|
|
938
|
-
r = new e(1),
|
|
938
|
+
r = new e(1), s = e.rounding;
|
|
939
939
|
} else {
|
|
940
|
-
if (r = new e(r),
|
|
940
|
+
if (r = new e(r), s === void 0 ? s = e.rounding : U(s, 0, 8), !t.d) return r.s ? t : r;
|
|
941
941
|
if (!r.d)
|
|
942
942
|
return r.s && (r.s = t.s), r;
|
|
943
943
|
}
|
|
944
|
-
return r.d[0] ? (S = !1, t = k(t, r, 0,
|
|
944
|
+
return r.d[0] ? (S = !1, t = k(t, r, 0, s, 1).times(r), S = !0, x(t)) : (r.s = t.s, t = r), t;
|
|
945
945
|
};
|
|
946
946
|
y.toNumber = function() {
|
|
947
947
|
return +this;
|
|
948
948
|
};
|
|
949
|
-
y.toOctal = function(r,
|
|
950
|
-
return he(this, 8, r,
|
|
949
|
+
y.toOctal = function(r, s) {
|
|
950
|
+
return he(this, 8, r, s);
|
|
951
951
|
};
|
|
952
952
|
y.toPower = y.pow = function(r) {
|
|
953
|
-
var
|
|
953
|
+
var s, t, e, i, n, o, a = this, l = a.constructor, c = +(r = new l(r));
|
|
954
954
|
if (!a.d || !r.d || !a.d[0] || !r.d[0]) return new l(I(+a, c));
|
|
955
955
|
if (a = new l(a), a.eq(1)) return a;
|
|
956
|
-
if (e = l.precision,
|
|
957
|
-
if (
|
|
958
|
-
return i = Ve(l, a, t, e), r.s < 0 ? new l(1).div(i) : x(i, e,
|
|
956
|
+
if (e = l.precision, n = l.rounding, r.eq(1)) return x(a, e, n);
|
|
957
|
+
if (s = T(r.e / b), s >= r.d.length - 1 && (t = c < 0 ? -c : c) <= $e)
|
|
958
|
+
return i = Ve(l, a, t, e), r.s < 0 ? new l(1).div(i) : x(i, e, n);
|
|
959
959
|
if (o = a.s, o < 0) {
|
|
960
|
-
if (
|
|
961
|
-
if (r.d[
|
|
960
|
+
if (s < r.d.length - 1) return new l(NaN);
|
|
961
|
+
if (r.d[s] & 1 || (o = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
|
|
962
962
|
return a.s = o, a;
|
|
963
963
|
}
|
|
964
|
-
return t = I(+a, c),
|
|
964
|
+
return t = I(+a, c), s = t == 0 || !isFinite(t) ? T(c * (Math.log("0." + H(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) : (S = !1, l.rounding = a.s = 1, t = Math.min(12, (s + "").length), i = re(r.times(at(a, e + t)), e), i.d && (i = x(i, e + 5, 1), Vt(i.d, e, n) && (s = e + 10, i = x(re(r.times(at(a, s + t)), s), s + 5, 1), +H(i.d).slice(e + 1, e + 15) + 1 == 1e14 && (i = x(i, e + 1, 0)))), i.s = o, S = !0, l.rounding = n, x(i, e, n));
|
|
965
965
|
};
|
|
966
|
-
y.toPrecision = function(r,
|
|
966
|
+
y.toPrecision = function(r, s) {
|
|
967
967
|
var t, e = this, i = e.constructor;
|
|
968
|
-
return r === void 0 ? t = Q(e, e.e <= i.toExpNeg || e.e >= i.toExpPos) : (U(r, 1, ht),
|
|
968
|
+
return r === void 0 ? t = Q(e, e.e <= i.toExpNeg || e.e >= i.toExpPos) : (U(r, 1, ht), s === void 0 ? s = i.rounding : U(s, 0, 8), e = x(new i(e), r, s), t = Q(e, r <= e.e || e.e <= i.toExpNeg, r)), e.isNeg() && !e.isZero() ? "-" + t : t;
|
|
969
969
|
};
|
|
970
|
-
y.toSignificantDigits = y.toSD = function(r,
|
|
970
|
+
y.toSignificantDigits = y.toSD = function(r, s) {
|
|
971
971
|
var t = this, e = t.constructor;
|
|
972
|
-
return r === void 0 ? (r = e.precision,
|
|
972
|
+
return r === void 0 ? (r = e.precision, s = e.rounding) : (U(r, 1, ht), s === void 0 ? s = e.rounding : U(s, 0, 8)), x(new e(t), r, s);
|
|
973
973
|
};
|
|
974
974
|
y.toString = function() {
|
|
975
|
-
var r = this,
|
|
975
|
+
var r = this, s = r.constructor, t = Q(r, r.e <= s.toExpNeg || r.e >= s.toExpPos);
|
|
976
976
|
return r.isNeg() && !r.isZero() ? "-" + t : t;
|
|
977
977
|
};
|
|
978
978
|
y.truncated = y.trunc = function() {
|
|
979
979
|
return x(new this.constructor(this), this.e + 1, 1);
|
|
980
980
|
};
|
|
981
981
|
y.valueOf = y.toJSON = function() {
|
|
982
|
-
var r = this,
|
|
982
|
+
var r = this, s = r.constructor, t = Q(r, r.e <= s.toExpNeg || r.e >= s.toExpPos);
|
|
983
983
|
return r.isNeg() ? "-" + t : t;
|
|
984
984
|
};
|
|
985
985
|
function H(r) {
|
|
986
|
-
var
|
|
986
|
+
var s, t, e, i = r.length - 1, n = "", o = r[0];
|
|
987
987
|
if (i > 0) {
|
|
988
|
-
for (
|
|
989
|
-
e = r[
|
|
990
|
-
o = r[
|
|
988
|
+
for (n += o, s = 1; s < i; s++)
|
|
989
|
+
e = r[s] + "", t = b - e.length, t && (n += ot(t)), n += e;
|
|
990
|
+
o = r[s], e = o + "", t = b - e.length, t && (n += ot(t));
|
|
991
991
|
} else if (o === 0)
|
|
992
992
|
return "0";
|
|
993
993
|
for (; o % 10 === 0; ) o /= 10;
|
|
994
|
-
return
|
|
994
|
+
return n + o;
|
|
995
995
|
}
|
|
996
|
-
function U(r,
|
|
997
|
-
if (r !== ~~r || r <
|
|
996
|
+
function U(r, s, t) {
|
|
997
|
+
if (r !== ~~r || r < s || r > t)
|
|
998
998
|
throw Error(ct + r);
|
|
999
999
|
}
|
|
1000
|
-
function Vt(r,
|
|
1001
|
-
var i,
|
|
1002
|
-
for (
|
|
1003
|
-
return --
|
|
1000
|
+
function Vt(r, s, t, e) {
|
|
1001
|
+
var i, n, o, a;
|
|
1002
|
+
for (n = r[0]; n >= 10; n /= 10) --s;
|
|
1003
|
+
return --s < 0 ? (s += b, i = 0) : (i = Math.ceil((s + 1) / b), s %= b), n = I(10, b - s), a = r[i] % n | 0, e == null ? s < 3 ? (s == 0 ? a = a / 100 | 0 : s == 1 && (a = a / 10 | 0), o = t < 4 && a == 99999 || t > 3 && a == 49999 || a == 5e4 || a == 0) : o = (t < 4 && a + 1 == n || t > 3 && a + 1 == n / 2) && (r[i + 1] / n / 100 | 0) == I(10, s - 2) - 1 || (a == n / 2 || a == 0) && (r[i + 1] / n / 100 | 0) == 0 : s < 4 ? (s == 0 ? a = a / 1e3 | 0 : s == 1 ? a = a / 100 | 0 : s == 2 && (a = a / 10 | 0), o = (e || t < 4) && a == 9999 || !e && t > 3 && a == 4999) : o = ((e || t < 4) && a + 1 == n || !e && t > 3 && a + 1 == n / 2) && (r[i + 1] / n / 1e3 | 0) == I(10, s - 3) - 1, o;
|
|
1004
1004
|
}
|
|
1005
|
-
function It(r,
|
|
1006
|
-
for (var e, i = [0],
|
|
1007
|
-
for (
|
|
1005
|
+
function It(r, s, t) {
|
|
1006
|
+
for (var e, i = [0], n, o = 0, a = r.length; o < a; ) {
|
|
1007
|
+
for (n = i.length; n--; ) i[n] *= s;
|
|
1008
1008
|
for (i[0] += ie.indexOf(r.charAt(o++)), e = 0; e < i.length; e++)
|
|
1009
1009
|
i[e] > t - 1 && (i[e + 1] === void 0 && (i[e + 1] = 0), i[e + 1] += i[e] / t | 0, i[e] %= t);
|
|
1010
1010
|
}
|
|
1011
1011
|
return i.reverse();
|
|
1012
1012
|
}
|
|
1013
|
-
function Je(r,
|
|
1013
|
+
function Je(r, s) {
|
|
1014
1014
|
var t, e, i;
|
|
1015
|
-
if (
|
|
1016
|
-
e =
|
|
1017
|
-
for (var
|
|
1018
|
-
var o =
|
|
1019
|
-
|
|
1015
|
+
if (s.isZero()) return s;
|
|
1016
|
+
e = s.d.length, e < 32 ? (t = Math.ceil(e / 3), i = (1 / Zt(4, t)).toString()) : (t = 16, i = "2.3283064365386962890625e-10"), r.precision += t, s = Et(r, 1, s.times(i), new r(1));
|
|
1017
|
+
for (var n = t; n--; ) {
|
|
1018
|
+
var o = s.times(s);
|
|
1019
|
+
s = o.times(o).minus(o).times(8).plus(1);
|
|
1020
1020
|
}
|
|
1021
|
-
return r.precision -= t,
|
|
1021
|
+
return r.precision -= t, s;
|
|
1022
1022
|
}
|
|
1023
1023
|
var k = /* @__PURE__ */ function() {
|
|
1024
|
-
function r(e, i,
|
|
1024
|
+
function r(e, i, n) {
|
|
1025
1025
|
var o, a = 0, l = e.length;
|
|
1026
1026
|
for (e = e.slice(); l--; )
|
|
1027
|
-
o = e[l] * i + a, e[l] = o %
|
|
1027
|
+
o = e[l] * i + a, e[l] = o % n | 0, a = o / n | 0;
|
|
1028
1028
|
return a && e.unshift(a), e;
|
|
1029
1029
|
}
|
|
1030
|
-
function
|
|
1030
|
+
function s(e, i, n, o) {
|
|
1031
1031
|
var a, l;
|
|
1032
|
-
if (
|
|
1033
|
-
l =
|
|
1032
|
+
if (n != o)
|
|
1033
|
+
l = n > o ? 1 : -1;
|
|
1034
1034
|
else
|
|
1035
|
-
for (a = l = 0; a <
|
|
1035
|
+
for (a = l = 0; a < n; a++)
|
|
1036
1036
|
if (e[a] != i[a]) {
|
|
1037
1037
|
l = e[a] > i[a] ? 1 : -1;
|
|
1038
1038
|
break;
|
|
1039
1039
|
}
|
|
1040
1040
|
return l;
|
|
1041
1041
|
}
|
|
1042
|
-
function t(e, i,
|
|
1043
|
-
for (var a = 0;
|
|
1044
|
-
e[
|
|
1042
|
+
function t(e, i, n, o) {
|
|
1043
|
+
for (var a = 0; n--; )
|
|
1044
|
+
e[n] -= a, a = e[n] < i[n] ? 1 : 0, e[n] = a * o + e[n] - i[n];
|
|
1045
1045
|
for (; !e[0] && e.length > 1; ) e.shift();
|
|
1046
1046
|
}
|
|
1047
|
-
return function(e, i,
|
|
1048
|
-
var c, h, u, d, m, g, p, v,
|
|
1047
|
+
return function(e, i, n, o, a, l) {
|
|
1048
|
+
var c, h, u, d, m, g, p, v, w, C, _, E, A, X, Ot, ut, rt, yt, G, Mt, At = e.constructor, Kt = e.s == i.s ? 1 : -1, L = e.d, O = i.d;
|
|
1049
1049
|
if (!L || !L[0] || !O || !O[0])
|
|
1050
1050
|
return new At(
|
|
1051
1051
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
@@ -1054,135 +1054,135 @@ var k = /* @__PURE__ */ function() {
|
|
|
1054
1054
|
L && L[0] == 0 || !O ? Kt * 0 : Kt / 0
|
|
1055
1055
|
)
|
|
1056
1056
|
);
|
|
1057
|
-
for (l ? (m = 1, h = e.e - i.e) : (l = j, m = b, h = T(e.e / m) - T(i.e / m)), G = O.length, rt = L.length,
|
|
1058
|
-
if (O[u] > (L[u] || 0) && h--,
|
|
1059
|
-
|
|
1057
|
+
for (l ? (m = 1, h = e.e - i.e) : (l = j, m = b, h = T(e.e / m) - T(i.e / m)), G = O.length, rt = L.length, w = new At(Kt), C = w.d = [], u = 0; O[u] == (L[u] || 0); u++) ;
|
|
1058
|
+
if (O[u] > (L[u] || 0) && h--, n == null ? (X = n = At.precision, o = At.rounding) : a ? X = n + (e.e - i.e) + 1 : X = n, X < 0)
|
|
1059
|
+
C.push(1), g = !0;
|
|
1060
1060
|
else {
|
|
1061
1061
|
if (X = X / m + 2 | 0, u = 0, G == 1) {
|
|
1062
1062
|
for (d = 0, O = O[0], X++; (u < rt || d) && X--; u++)
|
|
1063
|
-
Ot = d * l + (L[u] || 0),
|
|
1063
|
+
Ot = d * l + (L[u] || 0), C[u] = Ot / O | 0, d = Ot % O | 0;
|
|
1064
1064
|
g = d || u < rt;
|
|
1065
1065
|
} else {
|
|
1066
|
-
for (d = l / (O[0] + 1) | 0, d > 1 && (O = r(O, d, l), L = r(L, d, l), G = O.length, rt = L.length), ut = G,
|
|
1066
|
+
for (d = l / (O[0] + 1) | 0, d > 1 && (O = r(O, d, l), L = r(L, d, l), G = O.length, rt = L.length), ut = G, _ = L.slice(0, G), E = _.length; E < G; ) _[E++] = 0;
|
|
1067
1067
|
Mt = O.slice(), Mt.unshift(0), yt = O[0], O[1] >= l / 2 && ++yt;
|
|
1068
1068
|
do
|
|
1069
|
-
d = 0, c =
|
|
1070
|
-
while ((ut++ < rt ||
|
|
1071
|
-
g =
|
|
1069
|
+
d = 0, c = s(O, _, G, E), c < 0 ? (A = _[0], G != E && (A = A * l + (_[1] || 0)), d = A / yt | 0, d > 1 ? (d >= l && (d = l - 1), p = r(O, d, l), v = p.length, E = _.length, c = s(p, _, v, E), c == 1 && (d--, t(p, G < v ? Mt : O, v, l))) : (d == 0 && (c = d = 1), p = O.slice()), v = p.length, v < E && p.unshift(0), t(_, p, E, l), c == -1 && (E = _.length, c = s(O, _, G, E), c < 1 && (d++, t(_, G < E ? Mt : O, E, l))), E = _.length) : c === 0 && (d++, _ = [0]), C[u++] = d, c && _[0] ? _[E++] = L[ut] || 0 : (_ = [L[ut]], E = 1);
|
|
1070
|
+
while ((ut++ < rt || _[0] !== void 0) && X--);
|
|
1071
|
+
g = _[0] !== void 0;
|
|
1072
1072
|
}
|
|
1073
|
-
|
|
1073
|
+
C[0] || C.shift();
|
|
1074
1074
|
}
|
|
1075
1075
|
if (m == 1)
|
|
1076
|
-
|
|
1076
|
+
w.e = h, Ce = g;
|
|
1077
1077
|
else {
|
|
1078
|
-
for (u = 1, d =
|
|
1079
|
-
|
|
1078
|
+
for (u = 1, d = C[0]; d >= 10; d /= 10) u++;
|
|
1079
|
+
w.e = u + h * m - 1, x(w, a ? n + w.e + 1 : n, o, g);
|
|
1080
1080
|
}
|
|
1081
|
-
return
|
|
1081
|
+
return w;
|
|
1082
1082
|
};
|
|
1083
1083
|
}();
|
|
1084
|
-
function x(r,
|
|
1085
|
-
var i,
|
|
1086
|
-
t: if (
|
|
1084
|
+
function x(r, s, t, e) {
|
|
1085
|
+
var i, n, o, a, l, c, h, u, d, m = r.constructor;
|
|
1086
|
+
t: if (s != null) {
|
|
1087
1087
|
if (u = r.d, !u) return r;
|
|
1088
1088
|
for (i = 1, a = u[0]; a >= 10; a /= 10) i++;
|
|
1089
|
-
if (
|
|
1090
|
-
|
|
1091
|
-
else if (d = Math.ceil((
|
|
1089
|
+
if (n = s - i, n < 0)
|
|
1090
|
+
n += b, o = s, h = u[d = 0], l = h / I(10, i - o - 1) % 10 | 0;
|
|
1091
|
+
else if (d = Math.ceil((n + 1) / b), a = u.length, d >= a)
|
|
1092
1092
|
if (e) {
|
|
1093
1093
|
for (; a++ <= d; ) u.push(0);
|
|
1094
|
-
h = l = 0, i = 1,
|
|
1094
|
+
h = l = 0, i = 1, n %= b, o = n - b + 1;
|
|
1095
1095
|
} else
|
|
1096
1096
|
break t;
|
|
1097
1097
|
else {
|
|
1098
1098
|
for (h = a = u[d], i = 1; a >= 10; a /= 10) i++;
|
|
1099
|
-
|
|
1099
|
+
n %= b, o = n - b + i, l = o < 0 ? 0 : h / I(10, i - o - 1) % 10 | 0;
|
|
1100
1100
|
}
|
|
1101
|
-
if (e = e ||
|
|
1102
|
-
(
|
|
1103
|
-
return u.length = 0, c ? (
|
|
1104
|
-
if (
|
|
1101
|
+
if (e = e || s < 0 || u[d + 1] !== void 0 || (o < 0 ? h : h % I(10, i - o - 1)), c = t < 4 ? (l || e) && (t == 0 || t == (r.s < 0 ? 3 : 2)) : l > 5 || l == 5 && (t == 4 || e || t == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
1102
|
+
(n > 0 ? o > 0 ? h / I(10, i - o) : 0 : u[d - 1]) % 10 & 1 || t == (r.s < 0 ? 8 : 7)), s < 1 || !u[0])
|
|
1103
|
+
return u.length = 0, c ? (s -= r.e + 1, u[0] = I(10, (b - s % b) % b), r.e = -s || 0) : u[0] = r.e = 0, r;
|
|
1104
|
+
if (n == 0 ? (u.length = d, a = 1, d--) : (u.length = d + 1, a = I(10, b - n), u[d] = o > 0 ? (h / I(10, i - o) % I(10, o) | 0) * a : 0), c)
|
|
1105
1105
|
for (; ; )
|
|
1106
1106
|
if (d == 0) {
|
|
1107
|
-
for (
|
|
1107
|
+
for (n = 1, o = u[0]; o >= 10; o /= 10) n++;
|
|
1108
1108
|
for (o = u[0] += a, a = 1; o >= 10; o /= 10) a++;
|
|
1109
|
-
|
|
1109
|
+
n != a && (r.e++, u[0] == j && (u[0] = 1));
|
|
1110
1110
|
break;
|
|
1111
1111
|
} else {
|
|
1112
1112
|
if (u[d] += a, u[d] != j) break;
|
|
1113
1113
|
u[d--] = 0, a = 1;
|
|
1114
1114
|
}
|
|
1115
|
-
for (
|
|
1115
|
+
for (n = u.length; u[--n] === 0; ) u.pop();
|
|
1116
1116
|
}
|
|
1117
1117
|
return S && (r.e > m.maxE ? (r.d = null, r.e = NaN) : r.e < m.minE && (r.e = 0, r.d = [0])), r;
|
|
1118
1118
|
}
|
|
1119
|
-
function Q(r,
|
|
1119
|
+
function Q(r, s, t) {
|
|
1120
1120
|
if (!r.isFinite()) return Oe(r);
|
|
1121
|
-
var e, i = r.e,
|
|
1122
|
-
return
|
|
1121
|
+
var e, i = r.e, n = H(r.d), o = n.length;
|
|
1122
|
+
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;
|
|
1123
1123
|
}
|
|
1124
|
-
function $t(r,
|
|
1124
|
+
function $t(r, s) {
|
|
1125
1125
|
var t = r[0];
|
|
1126
|
-
for (
|
|
1127
|
-
return
|
|
1126
|
+
for (s *= b; t >= 10; t /= 10) s++;
|
|
1127
|
+
return s;
|
|
1128
1128
|
}
|
|
1129
|
-
function Yt(r,
|
|
1130
|
-
if (
|
|
1129
|
+
function Yt(r, s, t) {
|
|
1130
|
+
if (s > Ze)
|
|
1131
1131
|
throw S = !0, t && (r.precision = t), Error(_e);
|
|
1132
|
-
return x(new r(Xt),
|
|
1132
|
+
return x(new r(Xt), s, 1, !0);
|
|
1133
1133
|
}
|
|
1134
|
-
function K(r,
|
|
1135
|
-
if (
|
|
1136
|
-
return x(new r(Gt),
|
|
1134
|
+
function K(r, s, t) {
|
|
1135
|
+
if (s > ne) throw Error(_e);
|
|
1136
|
+
return x(new r(Gt), s, t, !0);
|
|
1137
1137
|
}
|
|
1138
1138
|
function Re(r) {
|
|
1139
|
-
var
|
|
1140
|
-
if (
|
|
1141
|
-
for (;
|
|
1142
|
-
for (
|
|
1139
|
+
var s = r.length - 1, t = s * b + 1;
|
|
1140
|
+
if (s = r[s], s) {
|
|
1141
|
+
for (; s % 10 == 0; s /= 10) t--;
|
|
1142
|
+
for (s = r[0]; s >= 10; s /= 10) t++;
|
|
1143
1143
|
}
|
|
1144
1144
|
return t;
|
|
1145
1145
|
}
|
|
1146
1146
|
function ot(r) {
|
|
1147
|
-
for (var
|
|
1148
|
-
return
|
|
1147
|
+
for (var s = ""; r--; ) s += "0";
|
|
1148
|
+
return s;
|
|
1149
1149
|
}
|
|
1150
|
-
function Ve(r,
|
|
1151
|
-
var i,
|
|
1150
|
+
function Ve(r, s, t, e) {
|
|
1151
|
+
var i, n = new r(1), o = Math.ceil(e / b + 4);
|
|
1152
1152
|
for (S = !1; ; ) {
|
|
1153
|
-
if (t % 2 && (
|
|
1154
|
-
t =
|
|
1153
|
+
if (t % 2 && (n = n.times(s), ge(n.d, o) && (i = !0)), t = T(t / 2), t === 0) {
|
|
1154
|
+
t = n.d.length - 1, i && n.d[t] === 0 && ++n.d[t];
|
|
1155
1155
|
break;
|
|
1156
1156
|
}
|
|
1157
|
-
|
|
1157
|
+
s = s.times(s), ge(s.d, o);
|
|
1158
1158
|
}
|
|
1159
|
-
return S = !0,
|
|
1159
|
+
return S = !0, n;
|
|
1160
1160
|
}
|
|
1161
1161
|
function pe(r) {
|
|
1162
1162
|
return r.d[r.d.length - 1] & 1;
|
|
1163
1163
|
}
|
|
1164
|
-
function ke(r,
|
|
1165
|
-
for (var e, i,
|
|
1166
|
-
if (i = new r(
|
|
1167
|
-
|
|
1164
|
+
function ke(r, s, t) {
|
|
1165
|
+
for (var e, i, n = new r(s[0]), o = 0; ++o < s.length; ) {
|
|
1166
|
+
if (i = new r(s[o]), !i.s) {
|
|
1167
|
+
n = i;
|
|
1168
1168
|
break;
|
|
1169
1169
|
}
|
|
1170
|
-
e =
|
|
1170
|
+
e = n.cmp(i), (e === t || e === 0 && n.s === t) && (n = i);
|
|
1171
1171
|
}
|
|
1172
|
-
return
|
|
1172
|
+
return n;
|
|
1173
1173
|
}
|
|
1174
|
-
function re(r,
|
|
1175
|
-
var t, e, i,
|
|
1174
|
+
function re(r, s) {
|
|
1175
|
+
var t, e, i, n, o, a, l, c = 0, h = 0, u = 0, d = r.constructor, m = d.rounding, g = d.precision;
|
|
1176
1176
|
if (!r.d || !r.d[0] || r.e > 17)
|
|
1177
1177
|
return new d(r.d ? r.d[0] ? r.s < 0 ? 0 : 1 / 0 : 1 : r.s ? r.s < 0 ? 0 : r : NaN);
|
|
1178
|
-
for (
|
|
1178
|
+
for (s == null ? (S = !1, l = g) : l = s, a = new d(0.03125); r.e > -2; )
|
|
1179
1179
|
r = r.times(a), u += 5;
|
|
1180
|
-
for (e = Math.log(I(2, u)) / Math.LN10 * 2 + 5 | 0, l += e, t =
|
|
1181
|
-
if (
|
|
1180
|
+
for (e = Math.log(I(2, u)) / Math.LN10 * 2 + 5 | 0, l += e, t = n = o = new d(1), d.precision = l; ; ) {
|
|
1181
|
+
if (n = x(n.times(r), l, 1), t = t.times(++h), a = o.plus(k(n, t, l, 1)), H(a.d).slice(0, l) === H(o.d).slice(0, l)) {
|
|
1182
1182
|
for (i = u; i--; ) o = x(o.times(o), l, 1);
|
|
1183
|
-
if (
|
|
1183
|
+
if (s == null)
|
|
1184
1184
|
if (c < 3 && Vt(o.d, l - e, m, c))
|
|
1185
|
-
d.precision = l += 10, t =
|
|
1185
|
+
d.precision = l += 10, t = n = a = new d(1), h = 0, c++;
|
|
1186
1186
|
else
|
|
1187
1187
|
return x(o, d.precision = g, m, S = !0);
|
|
1188
1188
|
else
|
|
@@ -1191,137 +1191,137 @@ function re(r, n) {
|
|
|
1191
1191
|
o = a;
|
|
1192
1192
|
}
|
|
1193
1193
|
}
|
|
1194
|
-
function at(r,
|
|
1195
|
-
var t, e, i,
|
|
1194
|
+
function at(r, s) {
|
|
1195
|
+
var t, e, i, n, o, a, l, c, h, u, d, m = 1, g = 10, p = r, v = p.d, w = p.constructor, C = w.rounding, _ = w.precision;
|
|
1196
1196
|
if (p.s < 0 || !v || !v[0] || !p.e && v[0] == 1 && v.length == 1)
|
|
1197
|
-
return new
|
|
1198
|
-
if (
|
|
1197
|
+
return new w(v && !v[0] ? -1 / 0 : p.s != 1 ? NaN : v ? 0 : p);
|
|
1198
|
+
if (s == null ? (S = !1, h = _) : h = s, w.precision = h += g, t = H(v), e = t.charAt(0), Math.abs(n = p.e) < 15e14) {
|
|
1199
1199
|
for (; e < 7 && e != 1 || e == 1 && t.charAt(1) > 3; )
|
|
1200
1200
|
p = p.times(r), t = H(p.d), e = t.charAt(0), m++;
|
|
1201
|
-
|
|
1201
|
+
n = p.e, e > 1 ? (p = new w("0." + t), n++) : p = new w(e + "." + t.slice(1));
|
|
1202
1202
|
} else
|
|
1203
|
-
return c = Yt(
|
|
1203
|
+
return c = Yt(w, h + 2, _).times(n + ""), p = at(new w(e + "." + t.slice(1)), h - g).plus(c), w.precision = _, s == null ? x(p, _, C, S = !0) : p;
|
|
1204
1204
|
for (u = p, l = o = p = k(p.minus(1), p.plus(1), h, 1), d = x(p.times(p), h, 1), i = 3; ; ) {
|
|
1205
|
-
if (o = x(o.times(d), h, 1), c = l.plus(k(o, new
|
|
1206
|
-
if (l = l.times(2),
|
|
1207
|
-
if (Vt(l.d, h - g,
|
|
1208
|
-
|
|
1205
|
+
if (o = x(o.times(d), h, 1), c = l.plus(k(o, new w(i), h, 1)), H(c.d).slice(0, h) === H(l.d).slice(0, h))
|
|
1206
|
+
if (l = l.times(2), n !== 0 && (l = l.plus(Yt(w, h + 2, _).times(n + ""))), l = k(l, new w(m), h, 1), s == null)
|
|
1207
|
+
if (Vt(l.d, h - g, C, a))
|
|
1208
|
+
w.precision = h += g, c = o = p = k(u.minus(1), u.plus(1), h, 1), d = x(p.times(p), h, 1), i = a = 1;
|
|
1209
1209
|
else
|
|
1210
|
-
return x(l,
|
|
1210
|
+
return x(l, w.precision = _, C, S = !0);
|
|
1211
1211
|
else
|
|
1212
|
-
return
|
|
1212
|
+
return w.precision = _, l;
|
|
1213
1213
|
l = c, i += 2;
|
|
1214
1214
|
}
|
|
1215
1215
|
}
|
|
1216
1216
|
function Oe(r) {
|
|
1217
1217
|
return String(r.s * r.s / 0);
|
|
1218
1218
|
}
|
|
1219
|
-
function Ht(r,
|
|
1219
|
+
function Ht(r, s) {
|
|
1220
1220
|
var t, e, i;
|
|
1221
|
-
for ((t =
|
|
1222
|
-
for (i =
|
|
1223
|
-
if (
|
|
1221
|
+
for ((t = s.indexOf(".")) > -1 && (s = s.replace(".", "")), (e = s.search(/e/i)) > 0 ? (t < 0 && (t = e), t += +s.slice(e + 1), s = s.substring(0, e)) : t < 0 && (t = s.length), e = 0; s.charCodeAt(e) === 48; e++) ;
|
|
1222
|
+
for (i = s.length; s.charCodeAt(i - 1) === 48; --i) ;
|
|
1223
|
+
if (s = s.slice(e, i), s) {
|
|
1224
1224
|
if (i -= e, r.e = t = t - e - 1, r.d = [], e = (t + 1) % b, t < 0 && (e += b), e < i) {
|
|
1225
|
-
for (e && r.d.push(+
|
|
1226
|
-
|
|
1225
|
+
for (e && r.d.push(+s.slice(0, e)), i -= b; e < i; ) r.d.push(+s.slice(e, e += b));
|
|
1226
|
+
s = s.slice(e), e = b - s.length;
|
|
1227
1227
|
} else
|
|
1228
1228
|
e -= i;
|
|
1229
|
-
for (; e--; )
|
|
1230
|
-
r.d.push(+
|
|
1229
|
+
for (; e--; ) s += "0";
|
|
1230
|
+
r.d.push(+s), S && (r.e > r.constructor.maxE ? (r.d = null, r.e = NaN) : r.e < r.constructor.minE && (r.e = 0, r.d = [0]));
|
|
1231
1231
|
} else
|
|
1232
1232
|
r.e = 0, r.d = [0];
|
|
1233
1233
|
return r;
|
|
1234
1234
|
}
|
|
1235
|
-
function Ke(r,
|
|
1236
|
-
var t, e, i,
|
|
1237
|
-
if (
|
|
1238
|
-
if (
|
|
1239
|
-
} else if (
|
|
1240
|
-
return +
|
|
1241
|
-
if (qe.test(
|
|
1242
|
-
t = 16,
|
|
1243
|
-
else if (We.test(
|
|
1235
|
+
function Ke(r, s) {
|
|
1236
|
+
var t, e, i, n, o, a, l, c, h;
|
|
1237
|
+
if (s.indexOf("_") > -1) {
|
|
1238
|
+
if (s = s.replace(/(\d)_(?=\d)/g, "$1"), De.test(s)) return Ht(r, s);
|
|
1239
|
+
} else if (s === "Infinity" || s === "NaN")
|
|
1240
|
+
return +s || (r.s = NaN), r.e = NaN, r.d = null, r;
|
|
1241
|
+
if (qe.test(s))
|
|
1242
|
+
t = 16, s = s.toLowerCase();
|
|
1243
|
+
else if (We.test(s))
|
|
1244
1244
|
t = 2;
|
|
1245
|
-
else if (je.test(
|
|
1245
|
+
else if (je.test(s))
|
|
1246
1246
|
t = 8;
|
|
1247
1247
|
else
|
|
1248
|
-
throw Error(ct +
|
|
1249
|
-
for (
|
|
1250
|
-
return
|
|
1248
|
+
throw Error(ct + s);
|
|
1249
|
+
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 = Ve(e, new e(t), n, n * 2)), c = It(s, t, j), h = c.length - 1, n = h; c[n] === 0; --n) c.pop();
|
|
1250
|
+
return n < 0 ? new e(r.s * 0) : (r.e = $t(c, h), r.d = c, S = !1, o && (r = k(r, i, a * 4)), l && (r = r.times(Math.abs(l) < 54 ? I(2, l) : V.pow(2, l))), S = !0, r);
|
|
1251
1251
|
}
|
|
1252
|
-
function Qe(r,
|
|
1253
|
-
var t, e =
|
|
1252
|
+
function Qe(r, s) {
|
|
1253
|
+
var t, e = s.d.length;
|
|
1254
1254
|
if (e < 3)
|
|
1255
|
-
return
|
|
1256
|
-
t = 1.4 * Math.sqrt(e), t = t > 16 ? 16 : t | 0,
|
|
1257
|
-
for (var i,
|
|
1258
|
-
i =
|
|
1259
|
-
return
|
|
1255
|
+
return s.isZero() ? s : Et(r, 2, s, s);
|
|
1256
|
+
t = 1.4 * Math.sqrt(e), t = t > 16 ? 16 : t | 0, s = s.times(1 / Zt(5, t)), s = Et(r, 2, s, s);
|
|
1257
|
+
for (var i, n = new r(5), o = new r(16), a = new r(20); t--; )
|
|
1258
|
+
i = s.times(s), s = s.times(n.plus(i.times(o.times(i).minus(a))));
|
|
1259
|
+
return s;
|
|
1260
1260
|
}
|
|
1261
|
-
function Et(r,
|
|
1262
|
-
var
|
|
1261
|
+
function Et(r, s, t, e, i) {
|
|
1262
|
+
var n, o, a, l, c = r.precision, h = Math.ceil(c / b);
|
|
1263
1263
|
for (S = !1, l = t.times(t), a = new r(e); ; ) {
|
|
1264
|
-
if (o = k(a.times(l), new r(
|
|
1265
|
-
for (
|
|
1266
|
-
if (
|
|
1264
|
+
if (o = k(a.times(l), new r(s++ * s++), c, 1), a = i ? e.plus(o) : e.minus(o), e = k(o.times(l), new r(s++ * s++), c, 1), o = a.plus(e), o.d[h] !== void 0) {
|
|
1265
|
+
for (n = h; o.d[n] === a.d[n] && n--; ) ;
|
|
1266
|
+
if (n == -1) break;
|
|
1267
1267
|
}
|
|
1268
|
-
|
|
1268
|
+
n = a, a = e, e = o, o = n;
|
|
1269
1269
|
}
|
|
1270
1270
|
return S = !0, o.d.length = h + 1, o;
|
|
1271
1271
|
}
|
|
1272
|
-
function Zt(r,
|
|
1273
|
-
for (var t = r; --
|
|
1272
|
+
function Zt(r, s) {
|
|
1273
|
+
for (var t = r; --s; ) t *= r;
|
|
1274
1274
|
return t;
|
|
1275
1275
|
}
|
|
1276
|
-
function Me(r,
|
|
1277
|
-
var t, e =
|
|
1278
|
-
if (
|
|
1279
|
-
return nt = e ? 4 : 1,
|
|
1280
|
-
if (t =
|
|
1276
|
+
function Me(r, s) {
|
|
1277
|
+
var t, e = s.s < 0, i = K(r, r.precision, 1), n = i.times(0.5);
|
|
1278
|
+
if (s = s.abs(), s.lte(n))
|
|
1279
|
+
return nt = e ? 4 : 1, s;
|
|
1280
|
+
if (t = s.divToInt(i), t.isZero())
|
|
1281
1281
|
nt = e ? 3 : 2;
|
|
1282
1282
|
else {
|
|
1283
|
-
if (
|
|
1284
|
-
return nt = pe(t) ? e ? 2 : 3 : e ? 4 : 1,
|
|
1283
|
+
if (s = s.minus(t.times(i)), s.lte(n))
|
|
1284
|
+
return nt = pe(t) ? e ? 2 : 3 : e ? 4 : 1, s;
|
|
1285
1285
|
nt = pe(t) ? e ? 1 : 4 : e ? 3 : 2;
|
|
1286
1286
|
}
|
|
1287
|
-
return
|
|
1287
|
+
return s.minus(i).abs();
|
|
1288
1288
|
}
|
|
1289
|
-
function he(r,
|
|
1290
|
-
var i,
|
|
1289
|
+
function he(r, s, t, e) {
|
|
1290
|
+
var i, n, o, a, l, c, h, u, d, m = r.constructor, g = t !== void 0;
|
|
1291
1291
|
if (g ? (U(t, 1, ht), e === void 0 ? e = m.rounding : U(e, 0, 8)) : (t = m.precision, e = m.rounding), !r.isFinite())
|
|
1292
1292
|
h = Oe(r);
|
|
1293
1293
|
else {
|
|
1294
|
-
for (h = Q(r), o = h.indexOf("."), g ? (i = 2,
|
|
1294
|
+
for (h = Q(r), o = h.indexOf("."), g ? (i = 2, s == 16 ? t = t * 4 - 3 : s == 8 && (t = t * 3 - 2)) : i = s, o >= 0 && (h = h.replace(".", ""), d = new m(1), d.e = h.length - o, d.d = It(Q(d), 10, i), d.e = d.d.length), u = It(h, 10, i), n = l = u.length; u[--l] == 0; ) u.pop();
|
|
1295
1295
|
if (!u[0])
|
|
1296
1296
|
h = g ? "0p+0" : "0";
|
|
1297
1297
|
else {
|
|
1298
|
-
if (o < 0 ?
|
|
1298
|
+
if (o < 0 ? n-- : (r = new m(r), r.d = u, r.e = n, r = k(r, d, t, e, 0, i), u = r.d, n = r.e, c = Ce), o = u[t], a = i / 2, c = c || u[t + 1] !== void 0, c = e < 4 ? (o !== void 0 || c) && (e === 0 || e === (r.s < 0 ? 3 : 2)) : o > a || o === a && (e === 4 || c || e === 6 && u[t - 1] & 1 || e === (r.s < 0 ? 8 : 7)), u.length = t, c)
|
|
1299
1299
|
for (; ++u[--t] > i - 1; )
|
|
1300
|
-
u[t] = 0, t || (++
|
|
1300
|
+
u[t] = 0, t || (++n, u.unshift(1));
|
|
1301
1301
|
for (l = u.length; !u[l - 1]; --l) ;
|
|
1302
1302
|
for (o = 0, h = ""; o < l; o++) h += ie.charAt(u[o]);
|
|
1303
1303
|
if (g) {
|
|
1304
1304
|
if (l > 1)
|
|
1305
|
-
if (
|
|
1306
|
-
for (o =
|
|
1307
|
-
for (u = It(h, i,
|
|
1305
|
+
if (s == 16 || s == 8) {
|
|
1306
|
+
for (o = s == 16 ? 4 : 3, --l; l % o; l++) h += "0";
|
|
1307
|
+
for (u = It(h, i, s), l = u.length; !u[l - 1]; --l) ;
|
|
1308
1308
|
for (o = 1, h = "1."; o < l; o++) h += ie.charAt(u[o]);
|
|
1309
1309
|
} else
|
|
1310
1310
|
h = h.charAt(0) + "." + h.slice(1);
|
|
1311
|
-
h = h + (
|
|
1312
|
-
} else if (
|
|
1313
|
-
for (; ++
|
|
1311
|
+
h = h + (n < 0 ? "p" : "p+") + n;
|
|
1312
|
+
} else if (n < 0) {
|
|
1313
|
+
for (; ++n; ) h = "0" + h;
|
|
1314
1314
|
h = "0." + h;
|
|
1315
|
-
} else if (++
|
|
1316
|
-
else
|
|
1315
|
+
} else if (++n > l) for (n -= l; n--; ) h += "0";
|
|
1316
|
+
else n < l && (h = h.slice(0, n) + "." + h.slice(n));
|
|
1317
1317
|
}
|
|
1318
|
-
h = (
|
|
1318
|
+
h = (s == 16 ? "0x" : s == 2 ? "0b" : s == 8 ? "0o" : "") + h;
|
|
1319
1319
|
}
|
|
1320
1320
|
return r.s < 0 ? "-" + h : h;
|
|
1321
1321
|
}
|
|
1322
|
-
function ge(r,
|
|
1323
|
-
if (r.length >
|
|
1324
|
-
return r.length =
|
|
1322
|
+
function ge(r, s) {
|
|
1323
|
+
if (r.length > s)
|
|
1324
|
+
return r.length = s, !0;
|
|
1325
1325
|
}
|
|
1326
1326
|
function ti(r) {
|
|
1327
1327
|
return new this(r).abs();
|
|
@@ -1332,8 +1332,8 @@ function ei(r) {
|
|
|
1332
1332
|
function ii(r) {
|
|
1333
1333
|
return new this(r).acosh();
|
|
1334
1334
|
}
|
|
1335
|
-
function si(r,
|
|
1336
|
-
return new this(r).plus(
|
|
1335
|
+
function si(r, s) {
|
|
1336
|
+
return new this(r).plus(s);
|
|
1337
1337
|
}
|
|
1338
1338
|
function ni(r) {
|
|
1339
1339
|
return new this(r).asin();
|
|
@@ -1347,10 +1347,10 @@ function oi(r) {
|
|
|
1347
1347
|
function ai(r) {
|
|
1348
1348
|
return new this(r).atanh();
|
|
1349
1349
|
}
|
|
1350
|
-
function li(r,
|
|
1351
|
-
r = new this(r),
|
|
1352
|
-
var t, e = this.precision, i = this.rounding,
|
|
1353
|
-
return !r.s || !
|
|
1350
|
+
function li(r, s) {
|
|
1351
|
+
r = new this(r), s = new this(s);
|
|
1352
|
+
var t, e = this.precision, i = this.rounding, n = e + 4;
|
|
1353
|
+
return !r.s || !s.s ? t = new this(NaN) : !r.d && !s.d ? (t = K(this, n, 1).times(s.s > 0 ? 0.25 : 0.75), t.s = r.s) : !s.d || r.isZero() ? (t = s.s < 0 ? K(this, e, i) : new this(0), t.s = r.s) : !r.d || s.isZero() ? (t = K(this, n, 1).times(0.5), t.s = r.s) : s.s < 0 ? (this.precision = n, this.rounding = 1, t = this.atan(k(r, s, n, 1)), s = K(this, n, 1), this.precision = e, this.rounding = i, t = r.s < 0 ? t.minus(s) : t.plus(s)) : t = this.atan(k(r, s, n, 1)), t;
|
|
1354
1354
|
}
|
|
1355
1355
|
function ci(r) {
|
|
1356
1356
|
return new this(r).cbrt();
|
|
@@ -1358,12 +1358,12 @@ function ci(r) {
|
|
|
1358
1358
|
function hi(r) {
|
|
1359
1359
|
return x(r = new this(r), r.e + 1, 2);
|
|
1360
1360
|
}
|
|
1361
|
-
function ui(r,
|
|
1362
|
-
return new this(r).clamp(
|
|
1361
|
+
function ui(r, s, t) {
|
|
1362
|
+
return new this(r).clamp(s, t);
|
|
1363
1363
|
}
|
|
1364
1364
|
function di(r) {
|
|
1365
1365
|
if (!r || typeof r != "object") throw Error(jt + "Object expected");
|
|
1366
|
-
var
|
|
1366
|
+
var s, t, e, i = r.defaults === !0, n = [
|
|
1367
1367
|
"precision",
|
|
1368
1368
|
1,
|
|
1369
1369
|
ht,
|
|
@@ -1386,9 +1386,9 @@ function di(r) {
|
|
|
1386
1386
|
0,
|
|
1387
1387
|
9
|
|
1388
1388
|
];
|
|
1389
|
-
for (
|
|
1390
|
-
if (t = s
|
|
1391
|
-
if (T(e) === e && e >= s
|
|
1389
|
+
for (s = 0; s < n.length; s += 3)
|
|
1390
|
+
if (t = n[s], i && (this[t] = se[t]), (e = r[t]) !== void 0)
|
|
1391
|
+
if (T(e) === e && e >= n[s + 1] && e <= n[s + 2]) this[t] = e;
|
|
1392
1392
|
else throw Error(ct + t + ": " + e);
|
|
1393
1393
|
if (t = "crypto", i && (this[t] = se[t]), (e = r[t]) !== void 0)
|
|
1394
1394
|
if (e === !0 || e === !1 || e === 0 || e === 1)
|
|
@@ -1410,42 +1410,42 @@ function mi(r) {
|
|
|
1410
1410
|
return new this(r).cosh();
|
|
1411
1411
|
}
|
|
1412
1412
|
function Ae(r) {
|
|
1413
|
-
var
|
|
1414
|
-
function i(
|
|
1413
|
+
var s, t, e;
|
|
1414
|
+
function i(n) {
|
|
1415
1415
|
var o, a, l, c = this;
|
|
1416
|
-
if (!(c instanceof i)) return new i(
|
|
1417
|
-
if (c.constructor = i, ye(
|
|
1418
|
-
c.s =
|
|
1416
|
+
if (!(c instanceof i)) return new i(n);
|
|
1417
|
+
if (c.constructor = i, ye(n)) {
|
|
1418
|
+
c.s = n.s, 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);
|
|
1419
1419
|
return;
|
|
1420
1420
|
}
|
|
1421
|
-
if (l = typeof
|
|
1422
|
-
if (
|
|
1423
|
-
c.s = 1 /
|
|
1421
|
+
if (l = typeof n, l === "number") {
|
|
1422
|
+
if (n === 0) {
|
|
1423
|
+
c.s = 1 / n < 0 ? -1 : 1, c.e = 0, c.d = [0];
|
|
1424
1424
|
return;
|
|
1425
1425
|
}
|
|
1426
|
-
if (
|
|
1427
|
-
for (o = 0, a =
|
|
1428
|
-
S ? o > i.maxE ? (c.e = NaN, c.d = null) : o < i.minE ? (c.e = 0, c.d = [0]) : (c.e = o, c.d = [
|
|
1426
|
+
if (n < 0 ? (n = -n, c.s = -1) : c.s = 1, n === ~~n && n < 1e7) {
|
|
1427
|
+
for (o = 0, a = n; a >= 10; a /= 10) o++;
|
|
1428
|
+
S ? 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]);
|
|
1429
1429
|
return;
|
|
1430
1430
|
}
|
|
1431
|
-
if (
|
|
1432
|
-
|
|
1431
|
+
if (n * 0 !== 0) {
|
|
1432
|
+
n || (c.s = NaN), c.e = NaN, c.d = null;
|
|
1433
1433
|
return;
|
|
1434
1434
|
}
|
|
1435
|
-
return Ht(c,
|
|
1435
|
+
return Ht(c, n.toString());
|
|
1436
1436
|
}
|
|
1437
1437
|
if (l === "string")
|
|
1438
|
-
return (a =
|
|
1438
|
+
return (a = n.charCodeAt(0)) === 45 ? (n = n.slice(1), c.s = -1) : (a === 43 && (n = n.slice(1)), c.s = 1), De.test(n) ? Ht(c, n) : Ke(c, n);
|
|
1439
1439
|
if (l === "bigint")
|
|
1440
|
-
return
|
|
1441
|
-
throw Error(ct +
|
|
1440
|
+
return n < 0 ? (n = -n, c.s = -1) : c.s = 1, Ht(c, n.toString());
|
|
1441
|
+
throw Error(ct + n);
|
|
1442
1442
|
}
|
|
1443
1443
|
if (i.prototype = y, 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 = di, i.clone = Ae, i.isDecimal = ye, i.abs = ti, i.acos = ei, i.acosh = ii, i.add = si, i.asin = ni, i.asinh = ri, i.atan = oi, i.atanh = ai, i.atan2 = li, i.cbrt = ci, i.ceil = hi, i.clamp = ui, i.cos = fi, i.cosh = mi, i.div = pi, i.exp = gi, i.floor = yi, i.hypot = vi, i.ln = wi, i.log = Pi, i.log10 = bi, i.log2 = xi, i.max = Ci, i.min = _i, i.mod = Si, i.mul = Ei, i.pow = Di, i.random = Ri, i.round = Vi, i.sign = ki, i.sin = Oi, i.sinh = Mi, i.sqrt = Ai, i.sub = Ni, i.sum = Ii, i.tan = Hi, i.tanh = Li, i.trunc = Ti, r === void 0 && (r = {}), r && r.defaults !== !0)
|
|
1444
|
-
for (e = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"],
|
|
1444
|
+
for (e = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], s = 0; s < e.length; ) r.hasOwnProperty(t = e[s++]) || (r[t] = this[t]);
|
|
1445
1445
|
return i.config(r), i;
|
|
1446
1446
|
}
|
|
1447
|
-
function pi(r,
|
|
1448
|
-
return new this(r).div(
|
|
1447
|
+
function pi(r, s) {
|
|
1448
|
+
return new this(r).div(s);
|
|
1449
1449
|
}
|
|
1450
1450
|
function gi(r) {
|
|
1451
1451
|
return new this(r).exp();
|
|
@@ -1454,14 +1454,14 @@ function yi(r) {
|
|
|
1454
1454
|
return x(r = new this(r), r.e + 1, 3);
|
|
1455
1455
|
}
|
|
1456
1456
|
function vi() {
|
|
1457
|
-
var r,
|
|
1457
|
+
var r, s, t = new this(0);
|
|
1458
1458
|
for (S = !1, r = 0; r < arguments.length; )
|
|
1459
|
-
if (
|
|
1460
|
-
t.d && (t = t.plus(
|
|
1459
|
+
if (s = new this(arguments[r++]), s.d)
|
|
1460
|
+
t.d && (t = t.plus(s.times(s)));
|
|
1461
1461
|
else {
|
|
1462
|
-
if (
|
|
1462
|
+
if (s.s)
|
|
1463
1463
|
return S = !0, new this(1 / 0);
|
|
1464
|
-
t =
|
|
1464
|
+
t = s;
|
|
1465
1465
|
}
|
|
1466
1466
|
return S = !0, t.sqrt();
|
|
1467
1467
|
}
|
|
@@ -1471,8 +1471,8 @@ function ye(r) {
|
|
|
1471
1471
|
function wi(r) {
|
|
1472
1472
|
return new this(r).ln();
|
|
1473
1473
|
}
|
|
1474
|
-
function Pi(r,
|
|
1475
|
-
return new this(r).log(
|
|
1474
|
+
function Pi(r, s) {
|
|
1475
|
+
return new this(r).log(s);
|
|
1476
1476
|
}
|
|
1477
1477
|
function xi(r) {
|
|
1478
1478
|
return new this(r).log(2);
|
|
@@ -1486,30 +1486,30 @@ function Ci() {
|
|
|
1486
1486
|
function _i() {
|
|
1487
1487
|
return ke(this, arguments, 1);
|
|
1488
1488
|
}
|
|
1489
|
-
function Si(r,
|
|
1490
|
-
return new this(r).mod(
|
|
1489
|
+
function Si(r, s) {
|
|
1490
|
+
return new this(r).mod(s);
|
|
1491
1491
|
}
|
|
1492
|
-
function Ei(r,
|
|
1493
|
-
return new this(r).mul(
|
|
1492
|
+
function Ei(r, s) {
|
|
1493
|
+
return new this(r).mul(s);
|
|
1494
1494
|
}
|
|
1495
|
-
function Di(r,
|
|
1496
|
-
return new this(r).pow(
|
|
1495
|
+
function Di(r, s) {
|
|
1496
|
+
return new this(r).pow(s);
|
|
1497
1497
|
}
|
|
1498
1498
|
function Ri(r) {
|
|
1499
|
-
var
|
|
1499
|
+
var s, t, e, i, n = 0, o = new this(1), a = [];
|
|
1500
1500
|
if (r === void 0 ? r = this.precision : U(r, 1, ht), e = Math.ceil(r / b), this.crypto)
|
|
1501
1501
|
if (crypto.getRandomValues)
|
|
1502
|
-
for (
|
|
1503
|
-
i = n
|
|
1502
|
+
for (s = crypto.getRandomValues(new Uint32Array(e)); n < e; )
|
|
1503
|
+
i = s[n], i >= 429e7 ? s[n] = crypto.getRandomValues(new Uint32Array(1))[0] : a[n++] = i % 1e7;
|
|
1504
1504
|
else if (crypto.randomBytes) {
|
|
1505
|
-
for (
|
|
1506
|
-
i = n
|
|
1507
|
-
|
|
1505
|
+
for (s = crypto.randomBytes(e *= 4); n < e; )
|
|
1506
|
+
i = s[n] + (s[n + 1] << 8) + (s[n + 2] << 16) + ((s[n + 3] & 127) << 24), i >= 214e7 ? crypto.randomBytes(4).copy(s, n) : (a.push(i % 1e7), n += 4);
|
|
1507
|
+
n = e / 4;
|
|
1508
1508
|
} else
|
|
1509
1509
|
throw Error(Se);
|
|
1510
|
-
else for (;
|
|
1511
|
-
for (e = a[--
|
|
1512
|
-
if (
|
|
1510
|
+
else for (; n < e; ) a[n++] = Math.random() * 1e7 | 0;
|
|
1511
|
+
for (e = a[--n], r %= b, e && r && (i = I(10, b - r), a[n] = (e / i | 0) * i); a[n] === 0; n--) a.pop();
|
|
1512
|
+
if (n < 0)
|
|
1513
1513
|
t = 0, a = [0];
|
|
1514
1514
|
else {
|
|
1515
1515
|
for (t = -1; a[0] === 0; t -= b) a.shift();
|
|
@@ -1533,12 +1533,12 @@ function Mi(r) {
|
|
|
1533
1533
|
function Ai(r) {
|
|
1534
1534
|
return new this(r).sqrt();
|
|
1535
1535
|
}
|
|
1536
|
-
function Ni(r,
|
|
1537
|
-
return new this(r).sub(
|
|
1536
|
+
function Ni(r, s) {
|
|
1537
|
+
return new this(r).sub(s);
|
|
1538
1538
|
}
|
|
1539
1539
|
function Ii() {
|
|
1540
|
-
var r = 0,
|
|
1541
|
-
for (S = !1; t.s && ++r <
|
|
1540
|
+
var r = 0, s = arguments, t = new this(s[r]);
|
|
1541
|
+
for (S = !1; t.s && ++r < s.length; ) t = t.plus(s[r]);
|
|
1542
1542
|
return S = !0, x(t, this.precision, this.rounding);
|
|
1543
1543
|
}
|
|
1544
1544
|
function Hi(r) {
|
|
@@ -1573,16 +1573,16 @@ class Fi {
|
|
|
1573
1573
|
get isRecalculate() {
|
|
1574
1574
|
return (this.parent ? this.parent.isRecalculate : !1) || this._isRecalculate;
|
|
1575
1575
|
}
|
|
1576
|
-
set isRecalculate(
|
|
1577
|
-
this._isRecalculate =
|
|
1576
|
+
set isRecalculate(s) {
|
|
1577
|
+
this._isRecalculate = s;
|
|
1578
1578
|
}
|
|
1579
1579
|
/** 是否是同一个主画布 */
|
|
1580
|
-
equalsMainCanvas(
|
|
1581
|
-
return this.mainCanvas ===
|
|
1580
|
+
equalsMainCanvas(s) {
|
|
1581
|
+
return this.mainCanvas === s;
|
|
1582
1582
|
}
|
|
1583
1583
|
/** 设置主画布 */
|
|
1584
|
-
setMainCanvas(
|
|
1585
|
-
this.mainCanvas =
|
|
1584
|
+
setMainCanvas(s) {
|
|
1585
|
+
this.mainCanvas = s;
|
|
1586
1586
|
}
|
|
1587
1587
|
}
|
|
1588
1588
|
class Bi extends Fi {
|
|
@@ -1625,15 +1625,15 @@ class Bi extends Fi {
|
|
|
1625
1625
|
if (!this.isVisible || this.opacity === 0) return !1;
|
|
1626
1626
|
const t = (e = this.mainCanvas) == null ? void 0 : e.scale;
|
|
1627
1627
|
if (this.scaleRange && t) {
|
|
1628
|
-
const i = Math.min(...this.scaleRange),
|
|
1629
|
-
return t >= i && t <=
|
|
1628
|
+
const i = Math.min(...this.scaleRange), n = Math.max(...this.scaleRange);
|
|
1629
|
+
return t >= i && t <= n;
|
|
1630
1630
|
}
|
|
1631
1631
|
return !0;
|
|
1632
1632
|
}
|
|
1633
1633
|
}
|
|
1634
1634
|
let Ui = class extends Bi {
|
|
1635
|
-
constructor(
|
|
1636
|
-
super(),
|
|
1635
|
+
constructor(s) {
|
|
1636
|
+
super(), s.name = s.name || rs("default-name-"), Object.assign(this, { ...s });
|
|
1637
1637
|
}
|
|
1638
1638
|
};
|
|
1639
1639
|
class Xi extends Ui {
|
|
@@ -1716,9 +1716,9 @@ class Xi extends Ui {
|
|
|
1716
1716
|
}
|
|
1717
1717
|
}
|
|
1718
1718
|
class Gi {
|
|
1719
|
-
constructor(
|
|
1719
|
+
constructor(s) {
|
|
1720
1720
|
f(this, "propagationStopped", !1);
|
|
1721
|
-
this.data =
|
|
1721
|
+
this.data = s;
|
|
1722
1722
|
}
|
|
1723
1723
|
stopPropagation() {
|
|
1724
1724
|
this.propagationStopped = !0;
|
|
@@ -1841,9 +1841,9 @@ class kt extends Xi {
|
|
|
1841
1841
|
return (i = this.sharedControllers[t]) == null ? void 0 : i.includes(e);
|
|
1842
1842
|
}
|
|
1843
1843
|
// 核心事件触发逻辑
|
|
1844
|
-
trigger(t, e, i,
|
|
1844
|
+
trigger(t, e, i, n) {
|
|
1845
1845
|
var c, h;
|
|
1846
|
-
if (!this[
|
|
1846
|
+
if (!this[n]) return;
|
|
1847
1847
|
this.updateStates(t, e);
|
|
1848
1848
|
const o = new Gi(e);
|
|
1849
1849
|
this.listeners[t].forEach((u) => u(o, i));
|
|
@@ -1874,8 +1874,8 @@ class kt extends Xi {
|
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
1876
|
checkEventDate(t, e) {
|
|
1877
|
-
const i = this._eventDate[t],
|
|
1878
|
-
return i ==
|
|
1877
|
+
const i = this._eventDate[t], n = JSON.stringify(e);
|
|
1878
|
+
return i == n ? !1 : (this._eventDate[t] = n, this._clearEventDate || (this._clearEventDate = !0, Promise.resolve().then(() => {
|
|
1879
1879
|
this._clearEventDate = !1, this._eventDate = {};
|
|
1880
1880
|
})), !0);
|
|
1881
1881
|
}
|
|
@@ -1979,7 +1979,7 @@ class Yi extends kt {
|
|
|
1979
1979
|
f(this, "isScaleUpdated", !1);
|
|
1980
1980
|
/** 现在网格计数 */
|
|
1981
1981
|
f(this, "nowGridCount");
|
|
1982
|
-
const { id: e, axisConfig: i, defaultCenter:
|
|
1982
|
+
const { id: e, axisConfig: i, defaultCenter: n, offset: o, defaultScale: a } = t, l = document.getElementById(e);
|
|
1983
1983
|
if (l instanceof HTMLCanvasElement)
|
|
1984
1984
|
if (l.getContext) {
|
|
1985
1985
|
this.canvas = l, this.ctx = l.getContext("2d");
|
|
@@ -1987,7 +1987,7 @@ class Yi extends kt {
|
|
|
1987
1987
|
[l.width, l.height] = [c, h];
|
|
1988
1988
|
} else throw new Error("canvas-unsupported code here");
|
|
1989
1989
|
else throw new Error("canvas is not HTMLCanvasElement");
|
|
1990
|
-
i && this.setAxis(i), o && (this.offset.x = o.x || 0, this.offset.y = o.y || 0),
|
|
1990
|
+
i && this.setAxis(i), o && (this.offset.x = o.x || 0, this.offset.y = o.y || 0), n && this.setDefaultCenter(n), a && (this.updateCenter(), this.setScale("center", a - 1), this.defaultScale = a);
|
|
1991
1991
|
}
|
|
1992
1992
|
/** 画布矩形 */
|
|
1993
1993
|
get rect() {
|
|
@@ -2007,7 +2007,7 @@ class Yi extends kt {
|
|
|
2007
2007
|
getDefaultCenterLocation() {
|
|
2008
2008
|
const { canvas: t, rect: e, defaultCenter: i } = this;
|
|
2009
2009
|
if (!t) return console.error("canvas is not HTMLCanvasElement");
|
|
2010
|
-
const { width:
|
|
2010
|
+
const { width: n, height: o } = e, { top: a, bottom: l, left: c, right: h } = i, u = {
|
|
2011
2011
|
/* 垂直方向解析 */
|
|
2012
2012
|
vertical: (p, v) => {
|
|
2013
2013
|
if ([0, "0", "0%"].includes(p)) return 0;
|
|
@@ -2019,21 +2019,21 @@ class Yi extends kt {
|
|
|
2019
2019
|
if ([0, "0", "0%"].includes(p)) return v;
|
|
2020
2020
|
if (p == 1 / 0 || p == -1 / 0) return;
|
|
2021
2021
|
if (typeof p == "number") return v - p;
|
|
2022
|
-
const
|
|
2023
|
-
return
|
|
2022
|
+
const w = u.vertical(p, v);
|
|
2023
|
+
return w ? v - w : void 0;
|
|
2024
2024
|
}
|
|
2025
|
-
}, d = (p, v,
|
|
2025
|
+
}, d = (p, v, w) => {
|
|
2026
2026
|
if (p !== void 0) {
|
|
2027
|
-
const
|
|
2028
|
-
if (
|
|
2027
|
+
const C = u.vertical(p, w);
|
|
2028
|
+
if (C !== void 0) return C;
|
|
2029
2029
|
}
|
|
2030
2030
|
if (v !== void 0) {
|
|
2031
|
-
const
|
|
2032
|
-
if (
|
|
2031
|
+
const C = u.reverse(v, w);
|
|
2032
|
+
if (C !== void 0) return C;
|
|
2033
2033
|
}
|
|
2034
|
-
return
|
|
2034
|
+
return w / 2;
|
|
2035
2035
|
}, m = d(a, l, o);
|
|
2036
|
-
return { x: d(c, h,
|
|
2036
|
+
return { x: d(c, h, n), y: m };
|
|
2037
2037
|
}
|
|
2038
2038
|
/** 更新中心点 */
|
|
2039
2039
|
updateCenter() {
|
|
@@ -2052,8 +2052,8 @@ class Yi extends kt {
|
|
|
2052
2052
|
}
|
|
2053
2053
|
/** 设置缩放 */
|
|
2054
2054
|
setScale(t, e) {
|
|
2055
|
-
const { canvas: i, isWheelable:
|
|
2056
|
-
if (!
|
|
2055
|
+
const { canvas: i, isWheelable: n, axisConfig: o, rect: a } = this;
|
|
2056
|
+
if (!n || !i)
|
|
2057
2057
|
return console.error("canvas is not HTMLCanvasElement");
|
|
2058
2058
|
let l, c;
|
|
2059
2059
|
t === "center" ? (l = a.left + a.width / 2, c = a.top + a.height / 2) : [l, c] = [t.clientX, t.clientY];
|
|
@@ -2069,10 +2069,10 @@ class Yi extends kt {
|
|
|
2069
2069
|
setAxis(t) {
|
|
2070
2070
|
const e = { ...this.axisConfig, ...t }, i = Object.fromEntries(
|
|
2071
2071
|
Object.entries(e).map(([p, v]) => [p, Number(v)])
|
|
2072
|
-
), { x:
|
|
2072
|
+
), { x: n, y: o, count: a, min: l, size: c } = i, h = [1, -1].includes(n), u = [1, -1].includes(o), d = a > 0, m = l > 0, g = c >= l && c <= l * 2;
|
|
2073
2073
|
if (!h || !u || !d || !m || !g) {
|
|
2074
2074
|
console.warn("Invalid axis configuration:", {
|
|
2075
|
-
x:
|
|
2075
|
+
x: n,
|
|
2076
2076
|
y: o,
|
|
2077
2077
|
count: a,
|
|
2078
2078
|
min: l,
|
|
@@ -2092,9 +2092,9 @@ class Yi extends kt {
|
|
|
2092
2092
|
* @returns 计算得到的网格尺寸(像素单位)
|
|
2093
2093
|
*/
|
|
2094
2094
|
getGridSize(t) {
|
|
2095
|
-
const { cycle: e, delta: i, axisConfig:
|
|
2095
|
+
const { cycle: e, delta: i, axisConfig: n } = this;
|
|
2096
2096
|
let o = new V(t).sub(1).abs().mod(e * i).div(i).toNumber();
|
|
2097
|
-
return o = t < 1 && o != 0 ? e - o : o, Number(((o / e + 1) *
|
|
2097
|
+
return o = t < 1 && o != 0 ? e - o : o, Number(((o / e + 1) * n.min).toFixed(0));
|
|
2098
2098
|
}
|
|
2099
2099
|
/**
|
|
2100
2100
|
* 计算当前缩放级别下显示的网格值
|
|
@@ -2102,7 +2102,7 @@ class Yi extends kt {
|
|
|
2102
2102
|
* @returns 计算得到的网格数量
|
|
2103
2103
|
*/
|
|
2104
2104
|
getGridCount(t) {
|
|
2105
|
-
const { axisConfig: e, cycle: i, delta:
|
|
2105
|
+
const { axisConfig: e, cycle: i, delta: n } = this, o = e.count, a = i * n;
|
|
2106
2106
|
if (t === 1) return o;
|
|
2107
2107
|
if (t > 1) {
|
|
2108
2108
|
const l = new V(t).sub(1).div(a).floor();
|
|
@@ -2119,41 +2119,41 @@ class Yi extends kt {
|
|
|
2119
2119
|
}
|
|
2120
2120
|
/** 获取鼠标在坐标轴上的位置 */
|
|
2121
2121
|
getMousePositionOnAxis(t) {
|
|
2122
|
-
const { canvas: e, center: i, rect:
|
|
2122
|
+
const { canvas: e, center: i, rect: n, axisConfig: o } = this;
|
|
2123
2123
|
if (!e) return console.error("canvas is not HTMLCanvasElement");
|
|
2124
|
-
const { clientX: a, clientY: l } = t, { left: c, top: h } =
|
|
2124
|
+
const { clientX: a, clientY: l } = t, { left: c, top: h } = n, u = (a - c - i.x) * o.x, d = (l - h - i.y) * o.y;
|
|
2125
2125
|
return { x: u, y: d };
|
|
2126
2126
|
}
|
|
2127
2127
|
/** 通过坐标轴上的点 获取坐标轴上的值 */
|
|
2128
2128
|
getAxisValueByPoint(t, e, i) {
|
|
2129
|
-
const { axisConfig:
|
|
2129
|
+
const { axisConfig: n } = this;
|
|
2130
2130
|
if (i)
|
|
2131
2131
|
return {
|
|
2132
|
-
xV: t /
|
|
2133
|
-
yV: e /
|
|
2132
|
+
xV: t / n.min * n.count,
|
|
2133
|
+
yV: e / n.min * n.count
|
|
2134
2134
|
};
|
|
2135
|
-
const o = this.getNowGridCount, a = new V(t).div(
|
|
2135
|
+
const o = this.getNowGridCount, a = new V(t).div(n.size).mul(o).toFixed(8), l = new V(e).div(n.size).mul(o).toFixed(8);
|
|
2136
2136
|
return { xV: Number(a), yV: Number(l) };
|
|
2137
2137
|
}
|
|
2138
2138
|
/** 通过坐标轴上的值 获取坐标轴上的点 */
|
|
2139
2139
|
getAxisPointByValue(t, e, i) {
|
|
2140
|
-
const { axisConfig:
|
|
2140
|
+
const { axisConfig: n } = this;
|
|
2141
2141
|
if (i)
|
|
2142
2142
|
return {
|
|
2143
|
-
x: t /
|
|
2144
|
-
y: e /
|
|
2143
|
+
x: t / n.count * n.min,
|
|
2144
|
+
y: e / n.count * n.min
|
|
2145
2145
|
};
|
|
2146
|
-
const o = this.getNowGridCount, a = new V(t).div(o).mul(
|
|
2146
|
+
const o = this.getNowGridCount, a = new V(t).div(o).mul(n.size).toFixed(3), l = new V(e).div(o).mul(n.size).toFixed(3);
|
|
2147
2147
|
return { x: Number(a), y: Number(l) };
|
|
2148
2148
|
}
|
|
2149
2149
|
/** 获取最大/小的 值 */
|
|
2150
2150
|
getMaxMinValue(t) {
|
|
2151
2151
|
t = t || this.rect;
|
|
2152
|
-
const { left: e, top: i, right:
|
|
2153
|
-
clientX: a.x == 1 ? e :
|
|
2152
|
+
const { left: e, top: i, right: n, bottom: o } = t, { axisConfig: a } = this, { x: l, y: c } = this.getMousePositionOnAxis({
|
|
2153
|
+
clientX: a.x == 1 ? e : n,
|
|
2154
2154
|
clientY: a.y == 1 ? i : o
|
|
2155
2155
|
}), { xV: h, yV: u } = this.getAxisValueByPoint(l, c), { x: d, y: m } = this.getMousePositionOnAxis({
|
|
2156
|
-
clientX: a.x == 1 ?
|
|
2156
|
+
clientX: a.x == 1 ? n : e,
|
|
2157
2157
|
clientY: a.y == 1 ? o : i
|
|
2158
2158
|
}), { xV: g, yV: p } = this.getAxisValueByPoint(d, m);
|
|
2159
2159
|
return {
|
|
@@ -2164,7 +2164,7 @@ class Yi extends kt {
|
|
|
2164
2164
|
};
|
|
2165
2165
|
}
|
|
2166
2166
|
transformPosition(t) {
|
|
2167
|
-
const { center: e, percentage: i, axisConfig:
|
|
2167
|
+
const { center: e, percentage: i, axisConfig: n } = this, o = i * n.x, a = i * n.y, l = (c) => [
|
|
2168
2168
|
e.x + c[0] * o,
|
|
2169
2169
|
e.y + c[1] * a
|
|
2170
2170
|
];
|
|
@@ -2385,12 +2385,12 @@ class zi extends Yi {
|
|
|
2385
2385
|
initStyle() {
|
|
2386
2386
|
const { canvas: t, ctx: e, theme: i } = this;
|
|
2387
2387
|
t.classList.add("_nhanh_canvas");
|
|
2388
|
-
const
|
|
2389
|
-
e.font = `${
|
|
2388
|
+
const n = this.style[i];
|
|
2389
|
+
e.font = `${n.text.bold ? "bold" : ""} ${n.text.size}px ${n.text.family}`;
|
|
2390
2390
|
}
|
|
2391
2391
|
/** 清除画布 */
|
|
2392
2392
|
clearScreen(t = !0) {
|
|
2393
|
-
const { ctx: e, theme: i, rect:
|
|
2393
|
+
const { ctx: e, theme: i, rect: n } = this, { width: o, height: a } = n;
|
|
2394
2394
|
e.clearRect(0, 0, o, a), t && this.style[i].background && (e.fillStyle = this.style[i].background, e.fillRect(0, 0, o, a));
|
|
2395
2395
|
}
|
|
2396
2396
|
/** 设置样式 */
|
|
@@ -2472,7 +2472,7 @@ class R extends kt {
|
|
|
2472
2472
|
this.setNotifyReload(i), this.mainCanvas = e, ["redrawOnIsHoverChange"].forEach((o) => {
|
|
2473
2473
|
o in t && (this[o] = t[o]);
|
|
2474
2474
|
});
|
|
2475
|
-
const
|
|
2475
|
+
const n = {};
|
|
2476
2476
|
[
|
|
2477
2477
|
"offset",
|
|
2478
2478
|
"style",
|
|
@@ -2481,8 +2481,8 @@ class R extends kt {
|
|
|
2481
2481
|
"dynamicPosition",
|
|
2482
2482
|
"value"
|
|
2483
2483
|
].forEach((o) => {
|
|
2484
|
-
o in t && (
|
|
2485
|
-
}), this.internalUpdate(
|
|
2484
|
+
o in t && (n[o] = t[o]);
|
|
2485
|
+
}), this.internalUpdate(n), this.addEventListener("hover", this.defaultHover);
|
|
2486
2486
|
}
|
|
2487
2487
|
/** 样式 */
|
|
2488
2488
|
get style() {
|
|
@@ -2535,13 +2535,13 @@ class R extends kt {
|
|
|
2535
2535
|
get finalDynamicPosition() {
|
|
2536
2536
|
var i;
|
|
2537
2537
|
const { x: t, y: e } = this.offset;
|
|
2538
|
-
return (i = this.dynamicPosition) == null ? void 0 : i.map((
|
|
2538
|
+
return (i = this.dynamicPosition) == null ? void 0 : i.map((n, o) => typeof n == "number" ? o == 0 ? n + t : n + e : [n[0] + t, n[1] + e]);
|
|
2539
2539
|
}
|
|
2540
2540
|
/** 请勿在实体对象中调用此方法,此方法仅用于类内部无副作用更新 (请勿使用!) */
|
|
2541
2541
|
internalUpdate(t, e) {
|
|
2542
2542
|
Object.keys(t).forEach((i) => {
|
|
2543
|
-
const
|
|
2544
|
-
|
|
2543
|
+
const n = this.publicToPrivateKeyMap[i];
|
|
2544
|
+
n && (this[n] = t[i]);
|
|
2545
2545
|
}), e && this.updateValueScope();
|
|
2546
2546
|
}
|
|
2547
2547
|
setMainCanvas(t) {
|
|
@@ -2564,10 +2564,10 @@ class R extends kt {
|
|
|
2564
2564
|
initValueScope() {
|
|
2565
2565
|
const t = this.value;
|
|
2566
2566
|
if (Array.isArray(t[0])) {
|
|
2567
|
-
let e = 1 / 0, i = -1 / 0,
|
|
2567
|
+
let e = 1 / 0, i = -1 / 0, n = 1 / 0, o = -1 / 0;
|
|
2568
2568
|
t.forEach(([a, l]) => {
|
|
2569
|
-
e = Math.min(e, a), i = Math.max(i, a),
|
|
2570
|
-
}), this.valueScope = { minX: e, maxX: i, minY:
|
|
2569
|
+
e = Math.min(e, a), i = Math.max(i, a), n = Math.min(n, l), o = Math.max(o, l);
|
|
2570
|
+
}), this.valueScope = { minX: e, maxX: i, minY: n, maxY: o };
|
|
2571
2571
|
} else {
|
|
2572
2572
|
const [e, i] = t;
|
|
2573
2573
|
this.valueScope = { minX: e, maxX: e, minY: i, maxY: i };
|
|
@@ -2580,10 +2580,10 @@ class R extends kt {
|
|
|
2580
2580
|
if (t) {
|
|
2581
2581
|
const { radius: e, value: i } = this.styleRadius;
|
|
2582
2582
|
if (e == 0) return;
|
|
2583
|
-
const
|
|
2584
|
-
this.valueScope.minX -= o, this.valueScope.maxX += o, this.valueScope.minY -= o, this.valueScope.maxY += o, this.styleRadius = { radius: e, value:
|
|
2583
|
+
const n = this.mainCanvas.getAxisValueByPoint(e, 0).xV, o = n - i;
|
|
2584
|
+
this.valueScope.minX -= o, this.valueScope.maxX += o, this.valueScope.minY -= o, this.valueScope.maxY += o, this.styleRadius = { radius: e, value: n };
|
|
2585
2585
|
} else {
|
|
2586
|
-
const { stroke: e, point: i } = this.computedValueScopeStyles,
|
|
2586
|
+
const { stroke: e, point: i } = this.computedValueScopeStyles, n = i ? i.radius + Math.max(0, i.width / 2) : 0, o = e ? Math.max(0, e.width / 2) : 0, a = Math.max(n, o);
|
|
2587
2587
|
if (a == 0) return this.styleRadius = { radius: 0, value: 0 };
|
|
2588
2588
|
const l = this.mainCanvas.getAxisValueByPoint(a, 0).xV;
|
|
2589
2589
|
this.valueScope.minX -= l, this.valueScope.maxX += l, this.valueScope.minY -= l, this.valueScope.maxY += l, this.styleRadius = { radius: a, value: l };
|
|
@@ -2591,16 +2591,16 @@ class R extends kt {
|
|
|
2591
2591
|
}
|
|
2592
2592
|
/** 计算偏移 */
|
|
2593
2593
|
calculateOffsetValue(t = !0) {
|
|
2594
|
-
const { mainCanvas: e, valueScope: i, offset:
|
|
2594
|
+
const { mainCanvas: e, valueScope: i, offset: n, offsetValue: o } = this;
|
|
2595
2595
|
if (!(!e || !i))
|
|
2596
2596
|
if (t) {
|
|
2597
2597
|
const { x: a, y: l } = e.axisConfig;
|
|
2598
|
-
let { xV: c, yV: h } = e.getAxisValueByPoint(
|
|
2598
|
+
let { xV: c, yV: h } = e.getAxisValueByPoint(n.x, n.y);
|
|
2599
2599
|
c *= a, h *= l;
|
|
2600
2600
|
const u = c - o.xV, d = h - o.yV;
|
|
2601
2601
|
i.minX += u, i.maxX += u, i.minY += d, i.maxY += d, this.offsetValue = { xV: c, yV: h };
|
|
2602
2602
|
} else {
|
|
2603
|
-
if (this.offsetValue = { xV: 0, yV: 0 },
|
|
2603
|
+
if (this.offsetValue = { xV: 0, yV: 0 }, n.x == 0 && n.y == 0) return;
|
|
2604
2604
|
this.calculateOffsetValue();
|
|
2605
2605
|
}
|
|
2606
2606
|
}
|
|
@@ -2616,14 +2616,14 @@ class R extends kt {
|
|
|
2616
2616
|
rightV: 0
|
|
2617
2617
|
};
|
|
2618
2618
|
if (this.valueScope) {
|
|
2619
|
-
const { leftV: i, rightV:
|
|
2620
|
-
this.valueScope.minX -= i - this.fixedExtraScope.leftV, this.valueScope.maxX +=
|
|
2619
|
+
const { leftV: i, rightV: n, topV: o, bottomV: a } = e;
|
|
2620
|
+
this.valueScope.minX -= i - this.fixedExtraScope.leftV, this.valueScope.maxX += n - this.fixedExtraScope.rightV, this.valueScope.minY -= o - this.fixedExtraScope.topV, this.valueScope.maxY += a - this.fixedExtraScope.bottomV, this.fixedExtraScope = e;
|
|
2621
2621
|
}
|
|
2622
2622
|
}
|
|
2623
2623
|
}
|
|
2624
2624
|
/** 设置额外范围 */
|
|
2625
2625
|
setExtraScope(t) {
|
|
2626
|
-
const { valueScope: e, mainCanvas: i, extraScope:
|
|
2626
|
+
const { valueScope: e, mainCanvas: i, extraScope: n } = this;
|
|
2627
2627
|
if (!(!e || !i))
|
|
2628
2628
|
if (t === !0)
|
|
2629
2629
|
this.extraScope = {
|
|
@@ -2644,7 +2644,7 @@ class R extends kt {
|
|
|
2644
2644
|
o,
|
|
2645
2645
|
a
|
|
2646
2646
|
);
|
|
2647
|
-
e.minX -= d -
|
|
2647
|
+
e.minX -= d - n.leftV, e.maxX += m - n.rightV, e.minY -= h - n.topV, e.maxY += u - n.bottomV, this.extraScope = { ...t, topV: h, bottomV: u, leftV: d, rightV: m };
|
|
2648
2648
|
} else
|
|
2649
2649
|
this.setExtraScope(this.extraScope);
|
|
2650
2650
|
}
|
|
@@ -2652,8 +2652,8 @@ class R extends kt {
|
|
|
2652
2652
|
get isWithinRange() {
|
|
2653
2653
|
const { mainCanvas: t, valueScope: e } = this;
|
|
2654
2654
|
if (!t) return !1;
|
|
2655
|
-
const { isScaleUpdated: i, maxMinValue:
|
|
2656
|
-
return i && (this.calculateStyleRadiusValue(), this.calculateOffsetValue(), this.setExtraScope()), e ? !(
|
|
2655
|
+
const { isScaleUpdated: i, maxMinValue: n } = t;
|
|
2656
|
+
return i && (this.calculateStyleRadiusValue(), this.calculateOffsetValue(), this.setExtraScope()), e ? !(n.maxXV < e.minX || n.minXV > e.maxX || n.maxYV < e.minY || n.minYV > e.maxY) : !0;
|
|
2657
2657
|
}
|
|
2658
2658
|
/** 判断是否需要渲染 */
|
|
2659
2659
|
get isNeedRender() {
|
|
@@ -2661,26 +2661,26 @@ class R extends kt {
|
|
|
2661
2661
|
}
|
|
2662
2662
|
/** 计算偏移量 */
|
|
2663
2663
|
calculateOffset(t, e) {
|
|
2664
|
-
const { percentage: i, axisConfig:
|
|
2665
|
-
value: t * o *
|
|
2666
|
-
position: t / i *
|
|
2664
|
+
const { percentage: i, axisConfig: n } = this.mainCanvas, o = n.count / n.min / i, a = {
|
|
2665
|
+
value: t * o * n.x,
|
|
2666
|
+
position: t / i * n.x,
|
|
2667
2667
|
dynamicPosition: t
|
|
2668
2668
|
}, l = {
|
|
2669
|
-
value: e * o *
|
|
2670
|
-
position: e / i *
|
|
2669
|
+
value: e * o * n.y,
|
|
2670
|
+
position: e / i * n.y,
|
|
2671
2671
|
dynamicPosition: e
|
|
2672
2672
|
};
|
|
2673
2673
|
return { x: a, y: l };
|
|
2674
2674
|
}
|
|
2675
2675
|
handleValuePosition(t, e) {
|
|
2676
|
-
let { value: i, position:
|
|
2676
|
+
let { value: i, position: n, mainCanvas: o } = this;
|
|
2677
2677
|
if (!o) return !1;
|
|
2678
2678
|
const a = t === "array1D" ? ue : zt, [l, c] = [
|
|
2679
2679
|
a(i) && (!e || i.length >= e),
|
|
2680
|
-
a(
|
|
2680
|
+
a(n) && (!e || n.length >= e)
|
|
2681
2681
|
], h = {
|
|
2682
2682
|
value: i,
|
|
2683
|
-
position:
|
|
2683
|
+
position: n,
|
|
2684
2684
|
dynamicPosition: []
|
|
2685
2685
|
};
|
|
2686
2686
|
if (!l && !c)
|
|
@@ -2698,7 +2698,7 @@ class R extends kt {
|
|
|
2698
2698
|
}
|
|
2699
2699
|
}
|
|
2700
2700
|
} else {
|
|
2701
|
-
const u =
|
|
2701
|
+
const u = n;
|
|
2702
2702
|
if (t === "array1D") {
|
|
2703
2703
|
const d = o.getAxisValueByPoint(u[0], u[1], !0);
|
|
2704
2704
|
h.value = [d.xV, d.yV];
|
|
@@ -2724,8 +2724,8 @@ class R extends kt {
|
|
|
2724
2724
|
}
|
|
2725
2725
|
/** 绘制线基础样式 */
|
|
2726
2726
|
setBaseLineStyle(t, e) {
|
|
2727
|
-
const { width: i, dash:
|
|
2728
|
-
return t.setLineDash(
|
|
2727
|
+
const { width: i, dash: n, dashGap: o, dashOffset: a, color: l, color_hover: c, cap: h, join: u } = e;
|
|
2728
|
+
return t.setLineDash(n ? o : []), t.lineDashOffset = a, t.lineCap = h, t.lineJoin = u, t.lineWidth = i, t.strokeStyle = this.isHover ? c : l, e;
|
|
2729
2729
|
}
|
|
2730
2730
|
/** 光标样式 */
|
|
2731
2731
|
get cursorStyle() {
|
|
@@ -2759,40 +2759,40 @@ class Lt extends R {
|
|
|
2759
2759
|
convertValuesToPositions(t) {
|
|
2760
2760
|
const e = [];
|
|
2761
2761
|
let i = 1;
|
|
2762
|
-
return t.forEach((
|
|
2762
|
+
return t.forEach((n, o) => {
|
|
2763
2763
|
if (o === 0) {
|
|
2764
2764
|
const a = this.mainCanvas.getAxisPointByValue(
|
|
2765
|
-
|
|
2766
|
-
|
|
2765
|
+
n[0],
|
|
2766
|
+
n[1],
|
|
2767
2767
|
!0
|
|
2768
2768
|
);
|
|
2769
|
-
e.push([a.x, a.y]), i = new V(a.x).div(
|
|
2769
|
+
e.push([a.x, a.y]), i = new V(a.x).div(n[0]).toNumber();
|
|
2770
2770
|
} else
|
|
2771
2771
|
e.push([
|
|
2772
2772
|
// this.mainCanvas!.preservePrecision(scale * item[0]),
|
|
2773
2773
|
// this.mainCanvas!.preservePrecision(scale * item[1]),
|
|
2774
|
-
new V(i).mul(
|
|
2775
|
-
new V(i).mul(
|
|
2774
|
+
new V(i).mul(n[0]).toNumber(),
|
|
2775
|
+
new V(i).mul(n[1]).toNumber()
|
|
2776
2776
|
]);
|
|
2777
2777
|
}), e;
|
|
2778
2778
|
}
|
|
2779
2779
|
convertPositionsToValues(t) {
|
|
2780
2780
|
const e = [];
|
|
2781
2781
|
let i = 1;
|
|
2782
|
-
return t.forEach((
|
|
2782
|
+
return t.forEach((n, o) => {
|
|
2783
2783
|
if (o === 0) {
|
|
2784
2784
|
const a = this.mainCanvas.getAxisValueByPoint(
|
|
2785
|
-
|
|
2786
|
-
|
|
2785
|
+
n[0],
|
|
2786
|
+
n[1],
|
|
2787
2787
|
!0
|
|
2788
2788
|
);
|
|
2789
|
-
e.push([a.xV, a.yV]), i = new V(a.xV).div(
|
|
2789
|
+
e.push([a.xV, a.yV]), i = new V(a.xV).div(n[0]).toNumber();
|
|
2790
2790
|
} else
|
|
2791
2791
|
e.push([
|
|
2792
2792
|
// this.mainCanvas!.preservePrecision(scale * item[0]),
|
|
2793
2793
|
// this.mainCanvas!.preservePrecision(scale * item[1]),
|
|
2794
|
-
new V(i).mul(
|
|
2795
|
-
new V(i).mul(
|
|
2794
|
+
new V(i).mul(n[0]).toNumber(),
|
|
2795
|
+
new V(i).mul(n[1]).toNumber()
|
|
2796
2796
|
]);
|
|
2797
2797
|
}), e;
|
|
2798
2798
|
}
|
|
@@ -2828,17 +2828,17 @@ class Lt extends R {
|
|
|
2828
2828
|
}
|
|
2829
2829
|
}
|
|
2830
2830
|
class M {
|
|
2831
|
-
static add(
|
|
2832
|
-
return new V(
|
|
2831
|
+
static add(s, t) {
|
|
2832
|
+
return new V(s).add(t).toNumber();
|
|
2833
2833
|
}
|
|
2834
|
-
static sub(
|
|
2835
|
-
return new V(
|
|
2834
|
+
static sub(s, t) {
|
|
2835
|
+
return new V(s).sub(t).toNumber();
|
|
2836
2836
|
}
|
|
2837
|
-
static mul(
|
|
2838
|
-
return new V(
|
|
2837
|
+
static mul(s, t) {
|
|
2838
|
+
return new V(s).mul(t).toNumber();
|
|
2839
2839
|
}
|
|
2840
|
-
static div(
|
|
2841
|
-
return new V(
|
|
2840
|
+
static div(s, t) {
|
|
2841
|
+
return new V(s).div(t).toNumber();
|
|
2842
2842
|
}
|
|
2843
2843
|
}
|
|
2844
2844
|
class Tt extends R {
|
|
@@ -2849,7 +2849,7 @@ class Tt extends R {
|
|
|
2849
2849
|
f(this, "_text");
|
|
2850
2850
|
f(this, "defaultDragg", (t, e) => {
|
|
2851
2851
|
var l;
|
|
2852
|
-
const { offsetX: i, offsetY:
|
|
2852
|
+
const { offsetX: i, offsetY: n } = t.data, { x: o, y: a } = this.calculateOffset(i, n);
|
|
2853
2853
|
this.internalUpdate(
|
|
2854
2854
|
{
|
|
2855
2855
|
value: [
|
|
@@ -2911,20 +2911,20 @@ class Tt extends R {
|
|
|
2911
2911
|
setOverlayStyles(t) {
|
|
2912
2912
|
var o;
|
|
2913
2913
|
const e = this.mainCanvas, i = e.style[e.theme].text;
|
|
2914
|
-
let
|
|
2915
|
-
return typeof this.style == "string" ?
|
|
2914
|
+
let n = {};
|
|
2915
|
+
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.text) || i : typeof this.style == "object" ? n = Object.assign({}, i, this.style) : n = i, t.font = `${n.bold ? "bold" : ""} ${n.size}px ${n.family}`, t.lineWidth = 2, t.strokeStyle = n.stroke, t.fillStyle = n[this.isHover ? "secondary" : "color"], n;
|
|
2916
2916
|
}
|
|
2917
2917
|
get computedValueScopeStyles() {
|
|
2918
2918
|
return {};
|
|
2919
2919
|
}
|
|
2920
2920
|
draw(t) {
|
|
2921
|
-
const { text: e, textOffset: i, finalDynamicPosition:
|
|
2921
|
+
const { text: e, textOffset: i, finalDynamicPosition: n } = this;
|
|
2922
2922
|
if (!this.mainCanvas || !e) return;
|
|
2923
2923
|
this.setGlobalAlpha(t), this.setOverlayStyles(t);
|
|
2924
|
-
const o =
|
|
2924
|
+
const o = n[0] - i.x, a = n[1] + i.y;
|
|
2925
2925
|
t.strokeText(e, o, a), t.fillText(e, o, a), this.path = new Path2D(), this.path.rect(
|
|
2926
2926
|
o,
|
|
2927
|
-
|
|
2927
|
+
n[1] - i.y,
|
|
2928
2928
|
i.x * 2,
|
|
2929
2929
|
i.y * 2
|
|
2930
2930
|
);
|
|
@@ -2947,7 +2947,7 @@ class lt extends R {
|
|
|
2947
2947
|
f(this, "angle", 2 * Math.PI);
|
|
2948
2948
|
f(this, "defaultDragg", (t, e) => {
|
|
2949
2949
|
var l;
|
|
2950
|
-
const { offsetX: i, offsetY:
|
|
2950
|
+
const { offsetX: i, offsetY: n } = t.data, { x: o, y: a } = this.calculateOffset(i, n);
|
|
2951
2951
|
this.internalUpdate(
|
|
2952
2952
|
{
|
|
2953
2953
|
value: [
|
|
@@ -2970,12 +2970,12 @@ class lt extends R {
|
|
|
2970
2970
|
f(this, "fillProgress");
|
|
2971
2971
|
/** 处理悬停状态变化 */
|
|
2972
2972
|
f(this, "defaultHover", (t, e) => {
|
|
2973
|
-
const i = t.data.state,
|
|
2973
|
+
const i = t.data.state, n = 300, o = this.setOverlayStyles().width;
|
|
2974
2974
|
this.fillProgress ? this.cancelAndRestartAnimation(
|
|
2975
2975
|
i,
|
|
2976
2976
|
o,
|
|
2977
|
-
|
|
2978
|
-
) : i && this.startNewHoverAnimation(o,
|
|
2977
|
+
n - 100
|
|
2978
|
+
) : i && this.startNewHoverAnimation(o, n);
|
|
2979
2979
|
});
|
|
2980
2980
|
this.addEventListener("hover", this.defaultHover), this.addEventListener("dragg", this.defaultDragg);
|
|
2981
2981
|
}
|
|
@@ -2985,9 +2985,9 @@ class lt extends R {
|
|
|
2985
2985
|
/** 取消当前动画并重新开始相反方向的动画 */
|
|
2986
2986
|
cancelAndRestartAnimation(t, e, i) {
|
|
2987
2987
|
this.fillProgress.scheduleCallback();
|
|
2988
|
-
let
|
|
2988
|
+
let n = 0;
|
|
2989
2989
|
this.fillProgress.scheduleCallback = Ut((o) => {
|
|
2990
|
-
!this.fillProgress || !o || (this.fillProgress.progress += (o -
|
|
2990
|
+
!this.fillProgress || !o || (this.fillProgress.progress += (o - n) * (t ? 1 : -1), n = o, this.fillProgress.progress = Math.min(
|
|
2991
2991
|
1,
|
|
2992
2992
|
Math.max(0, this.fillProgress.progress)
|
|
2993
2993
|
), this.updateLineWidthOffset(e), (this.fillProgress.progress === 1 || this.fillProgress.progress === 0) && (this.fillProgress.scheduleCallback(), this.fillProgress.progress === 0 && (this.fillProgress = void 0)));
|
|
@@ -3016,8 +3016,8 @@ class lt extends R {
|
|
|
3016
3016
|
isPointInStroke(t, e) {
|
|
3017
3017
|
var i;
|
|
3018
3018
|
if (this.path && this.mainCanvas) {
|
|
3019
|
-
const { width:
|
|
3020
|
-
return ((i = this.fillProgress) == null ? void 0 : i.lineWidthOffset) ==
|
|
3019
|
+
const { width: n } = this.setOverlayStyles(R.ctx);
|
|
3020
|
+
return ((i = this.fillProgress) == null ? void 0 : i.lineWidthOffset) == n ? !1 : R.ctx.isPointInStroke(this.path, t, e);
|
|
3021
3021
|
}
|
|
3022
3022
|
return !1;
|
|
3023
3023
|
}
|
|
@@ -3027,15 +3027,15 @@ class lt extends R {
|
|
|
3027
3027
|
setOverlayStyles(t) {
|
|
3028
3028
|
var c, h;
|
|
3029
3029
|
const e = this.mainCanvas, i = e.style[e.theme].point;
|
|
3030
|
-
let
|
|
3031
|
-
typeof this.style == "string" ?
|
|
3032
|
-
const { width: o, stroke: a, fill: l } =
|
|
3030
|
+
let n = {};
|
|
3031
|
+
typeof this.style == "string" ? n = ((c = e.style[this.style]) == null ? void 0 : c.point) || i : typeof this.style == "object" ? n = Object.assign({}, i, this.style) : n = i;
|
|
3032
|
+
const { width: o, stroke: a, fill: l } = n;
|
|
3033
3033
|
if (t) {
|
|
3034
3034
|
t.setLineDash([]);
|
|
3035
3035
|
const u = ((h = this.fillProgress) == null ? void 0 : h.lineWidthOffset) || 0;
|
|
3036
3036
|
t.lineWidth = o - u, t.strokeStyle = a, t.fillStyle = l;
|
|
3037
3037
|
}
|
|
3038
|
-
return { ...
|
|
3038
|
+
return { ...n };
|
|
3039
3039
|
}
|
|
3040
3040
|
get computedValueScopeStyles() {
|
|
3041
3041
|
return { point: this.setOverlayStyles() };
|
|
@@ -3045,8 +3045,8 @@ class lt extends R {
|
|
|
3045
3045
|
const { finalDynamicPosition: e, mainCanvas: i } = this;
|
|
3046
3046
|
if (!i) return;
|
|
3047
3047
|
this.setGlobalAlpha(t);
|
|
3048
|
-
const { radius:
|
|
3049
|
-
t.beginPath(), this.path = new Path2D(), this.path.arc(l, c,
|
|
3048
|
+
const { radius: n, width: o } = this.setOverlayStyles(t), a = ((h = this.fillProgress) == null ? void 0 : h.lineWidthOffset) || 0, [l, c] = e;
|
|
3049
|
+
t.beginPath(), this.path = new Path2D(), this.path.arc(l, c, n + a / 2, 0, this.angle), o != a && t.stroke(this.path), t.fill(this.path);
|
|
3050
3050
|
}
|
|
3051
3051
|
getDraw() {
|
|
3052
3052
|
if (this.isNeedRender) {
|
|
@@ -3074,27 +3074,27 @@ class Ne extends R {
|
|
|
3074
3074
|
f(this, "defaultClick", (t, e) => {
|
|
3075
3075
|
var o;
|
|
3076
3076
|
if (!this.isHandlePointsVisible) return;
|
|
3077
|
-
const { state: i, oldState:
|
|
3078
|
-
i !=
|
|
3077
|
+
const { state: i, oldState: n } = t.data;
|
|
3078
|
+
i != n && !this.isInfinite && ((o = this.notifyReload) == null || o.call(this));
|
|
3079
3079
|
});
|
|
3080
3080
|
/** 默认点击事件 点击后 创建/删除 控制点 */
|
|
3081
3081
|
f(this, "defaultDoubleClick", (t, e) => {
|
|
3082
3082
|
if (e) {
|
|
3083
3083
|
if (!this.isHandlePointsVisible) return;
|
|
3084
|
-
const { offsetX: i, offsetY:
|
|
3084
|
+
const { offsetX: i, offsetY: n } = e, { state: o } = t.data;
|
|
3085
3085
|
if (this.lockedCanCreateOrDeleteHandlePoint)
|
|
3086
3086
|
this.resetHandlePointLock();
|
|
3087
3087
|
else if (o && this.isHandlePointsVisible && this.canCreateOrDeleteHandlePoint && this.isDraggable) {
|
|
3088
3088
|
const l = this.handlePoints.findIndex(
|
|
3089
3089
|
(c) => c.isHover
|
|
3090
3090
|
);
|
|
3091
|
-
l === -1 ? this.tryCreateNewHandlePoint(i,
|
|
3091
|
+
l === -1 ? this.tryCreateNewHandlePoint(i, n) : this.tryDeleteHandlePoint(l);
|
|
3092
3092
|
}
|
|
3093
3093
|
}
|
|
3094
3094
|
});
|
|
3095
3095
|
/** 处理拖动状态变化 */
|
|
3096
3096
|
f(this, "defaultDragg", (t, e) => {
|
|
3097
|
-
var
|
|
3097
|
+
var n;
|
|
3098
3098
|
if (!this.mainCanvas) return;
|
|
3099
3099
|
const i = () => {
|
|
3100
3100
|
const { offsetX: o, offsetY: a } = t.data, { x: l, y: c } = this.calculateOffset(o, a);
|
|
@@ -3126,7 +3126,7 @@ class Ne extends R {
|
|
|
3126
3126
|
a.notifyDragg(t.data, e), this.value[o] = a.value, this.position[o] = a.position, this.dynamicPosition[o] = a.dynamicPosition;
|
|
3127
3127
|
} else i();
|
|
3128
3128
|
} else i();
|
|
3129
|
-
(
|
|
3129
|
+
(n = this.notifyReload) == null || n.call(this), this.updateValueScope();
|
|
3130
3130
|
});
|
|
3131
3131
|
["isHandlePointsVisible", "canCreateOrDeleteHandlePoint"].forEach((e) => {
|
|
3132
3132
|
e in t && (this[e] = t[e]);
|
|
@@ -3147,16 +3147,16 @@ class Ne extends R {
|
|
|
3147
3147
|
set offset(t) {
|
|
3148
3148
|
super.offset = t;
|
|
3149
3149
|
let { isHandlePointsVisible: e, handlePoints: i } = this;
|
|
3150
|
-
e && i.forEach((
|
|
3150
|
+
e && i.forEach((n) => n.internalUpdate({ offset: t }));
|
|
3151
3151
|
}
|
|
3152
3152
|
/** 尝试在指定位置创建新控制点 */
|
|
3153
3153
|
tryCreateNewHandlePoint(t, e) {
|
|
3154
3154
|
var c;
|
|
3155
3155
|
if (!this.isPointInStroke(t, e)) return;
|
|
3156
|
-
const i = this.getExtendedDynamicPositions(),
|
|
3157
|
-
if (
|
|
3158
|
-
const [o, a] = this.getAdjacentIndices(
|
|
3159
|
-
this.insertHandlePoint(
|
|
3156
|
+
const i = this.getExtendedDynamicPositions(), n = Wi([t, e], i);
|
|
3157
|
+
if (n === -1) return;
|
|
3158
|
+
const [o, a] = this.getAdjacentIndices(n), l = this.createNewHandlePoint(o, a);
|
|
3159
|
+
this.insertHandlePoint(n, l), this.lockHandlePointCreationTemporarily(), (c = this.notifyReload) == null || c.call(this);
|
|
3160
3160
|
}
|
|
3161
3161
|
/** 尝试删除指定位置的控制点 */
|
|
3162
3162
|
tryDeleteHandlePoint(t) {
|
|
@@ -3177,7 +3177,7 @@ class Ne extends R {
|
|
|
3177
3177
|
const i = te(
|
|
3178
3178
|
this.value[t],
|
|
3179
3179
|
this.value[e]
|
|
3180
|
-
),
|
|
3180
|
+
), n = te(
|
|
3181
3181
|
this.position[t],
|
|
3182
3182
|
this.position[e]
|
|
3183
3183
|
), o = te(
|
|
@@ -3186,7 +3186,7 @@ class Ne extends R {
|
|
|
3186
3186
|
);
|
|
3187
3187
|
return new lt({
|
|
3188
3188
|
value: i,
|
|
3189
|
-
position:
|
|
3189
|
+
position: n,
|
|
3190
3190
|
dynamicPosition: o,
|
|
3191
3191
|
isDraggable: !0,
|
|
3192
3192
|
mainCanvas: this.mainCanvas,
|
|
@@ -3220,13 +3220,13 @@ class Ne extends R {
|
|
|
3220
3220
|
}
|
|
3221
3221
|
/** 更新控制点 */
|
|
3222
3222
|
updateHandlePoints() {
|
|
3223
|
-
let { value: t, position: e, dynamicPosition: i, offset:
|
|
3223
|
+
let { value: t, position: e, dynamicPosition: i, offset: n, isHandlePointsVisible: o } = this;
|
|
3224
3224
|
!i || !o || (t == null || t.forEach((a, l) => {
|
|
3225
3225
|
if (!this.handlePoints[l]) {
|
|
3226
3226
|
const c = new lt({
|
|
3227
3227
|
mainCanvas: this.mainCanvas,
|
|
3228
3228
|
isDraggable: !0,
|
|
3229
|
-
offset:
|
|
3229
|
+
offset: n,
|
|
3230
3230
|
notifyReload: () => {
|
|
3231
3231
|
var h;
|
|
3232
3232
|
return (h = this.notifyReload) == null ? void 0 : h.call(this);
|
|
@@ -3251,24 +3251,24 @@ class Ne extends R {
|
|
|
3251
3251
|
});
|
|
3252
3252
|
}
|
|
3253
3253
|
}
|
|
3254
|
-
function Wi(r,
|
|
3255
|
-
if (
|
|
3256
|
-
if (
|
|
3254
|
+
function Wi(r, s, t = 10) {
|
|
3255
|
+
if (s.length === 0) return 0;
|
|
3256
|
+
if (s.length === 1) return 1;
|
|
3257
3257
|
let e = 1 / 0, i = -1;
|
|
3258
|
-
for (let
|
|
3258
|
+
for (let n = 0; n < s.length - 1; n++) {
|
|
3259
3259
|
const o = fs(
|
|
3260
3260
|
r,
|
|
3261
|
-
n
|
|
3262
|
-
n
|
|
3261
|
+
s[n],
|
|
3262
|
+
s[n + 1]
|
|
3263
3263
|
);
|
|
3264
3264
|
if (o < t)
|
|
3265
|
-
return
|
|
3266
|
-
o < e && (e = o, i =
|
|
3265
|
+
return n + 1;
|
|
3266
|
+
o < e && (e = o, i = n + 1);
|
|
3267
3267
|
}
|
|
3268
3268
|
return i;
|
|
3269
3269
|
}
|
|
3270
|
-
function te(r,
|
|
3271
|
-
const { x: t, y: e } = Ue(...r, ...
|
|
3270
|
+
function te(r, s) {
|
|
3271
|
+
const { x: t, y: e } = Ue(...r, ...s);
|
|
3272
3272
|
return [t, e];
|
|
3273
3273
|
}
|
|
3274
3274
|
class Ft extends Ne {
|
|
@@ -3298,8 +3298,8 @@ class Ft extends Ne {
|
|
|
3298
3298
|
return this.path && this.mainCanvas ? (this.setOverlayStyles(R.ctx), this.isDraggable && (R.ctx.lineWidth = Math.max(R.ctx.lineWidth, 20)), R.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
3299
3299
|
}
|
|
3300
3300
|
isPointInAnywhere(t, e) {
|
|
3301
|
-
return ((
|
|
3302
|
-
if (!
|
|
3301
|
+
return ((n) => {
|
|
3302
|
+
if (!n) return !1;
|
|
3303
3303
|
let o = !1;
|
|
3304
3304
|
return [...this.handlePoints].sort(
|
|
3305
3305
|
(l, c) => (l.isHover ? 0 : 1) - (c.isHover ? 0 : 1)
|
|
@@ -3332,24 +3332,24 @@ class Ft extends Ne {
|
|
|
3332
3332
|
setOverlayStyles(t) {
|
|
3333
3333
|
var o;
|
|
3334
3334
|
const e = this.mainCanvas, i = e.style[e.theme].line;
|
|
3335
|
-
let
|
|
3336
|
-
return typeof this.style == "string" ?
|
|
3335
|
+
let n = {};
|
|
3336
|
+
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.line) || i : typeof this.style == "object" ? n = gt(
|
|
3337
3337
|
JSON.parse(JSON.stringify(i)),
|
|
3338
3338
|
this.style
|
|
3339
|
-
) :
|
|
3339
|
+
) : n = i, t && this.setBaseLineStyle(t, n.stroke), n;
|
|
3340
3340
|
}
|
|
3341
3341
|
get computedValueScopeStyles() {
|
|
3342
3342
|
return this.setOverlayStyles();
|
|
3343
3343
|
}
|
|
3344
3344
|
/** 绘制线段 */
|
|
3345
3345
|
drawLine(t, e) {
|
|
3346
|
-
const { mainCanvas: i, isInfinite:
|
|
3346
|
+
const { mainCanvas: i, isInfinite: n, isClick: o } = this;
|
|
3347
3347
|
if (e = e || this.finalDynamicPosition, !i) return;
|
|
3348
3348
|
this.setGlobalAlpha(t);
|
|
3349
3349
|
const a = this.setOverlayStyles(t);
|
|
3350
3350
|
t.beginPath(), this.path = new Path2D(), e.forEach((l, c) => {
|
|
3351
3351
|
this.path[c == 0 ? "moveTo" : "lineTo"](l[0], l[1]);
|
|
3352
|
-
}), t.stroke(this.path), this.isShowHandlePoint = (
|
|
3352
|
+
}), t.stroke(this.path), this.isShowHandlePoint = (n || o) && this.isHandlePointsVisible, this.isShowHandlePoint && this.handlePoints.forEach((l) => {
|
|
3353
3353
|
var c;
|
|
3354
3354
|
l.style = a.point, (c = l.getDraw()) == null || c[0].call(l, t);
|
|
3355
3355
|
});
|
|
@@ -3359,19 +3359,19 @@ class Ft extends Ne {
|
|
|
3359
3359
|
const { mainCanvas: e, finalDynamicPosition: i } = this;
|
|
3360
3360
|
if (!e) return;
|
|
3361
3361
|
this.setGlobalAlpha(t);
|
|
3362
|
-
const { rect:
|
|
3362
|
+
const { rect: n } = e, [o, a] = i, l = [a[0] - o[0], a[1] - o[1]];
|
|
3363
3363
|
if (l[0] === 0 && l[1] === 0)
|
|
3364
3364
|
return console.error("重合点无法确定方向");
|
|
3365
3365
|
const c = ve(
|
|
3366
3366
|
o,
|
|
3367
3367
|
[-l[0], -l[1]],
|
|
3368
|
-
|
|
3369
|
-
|
|
3368
|
+
n.width,
|
|
3369
|
+
n.height
|
|
3370
3370
|
), h = ve(
|
|
3371
3371
|
a,
|
|
3372
3372
|
l,
|
|
3373
|
-
|
|
3374
|
-
|
|
3373
|
+
n.width,
|
|
3374
|
+
n.height
|
|
3375
3375
|
);
|
|
3376
3376
|
this.drawLine(t, [c, h]);
|
|
3377
3377
|
}
|
|
@@ -3382,39 +3382,39 @@ class Ft extends Ne {
|
|
|
3382
3382
|
}
|
|
3383
3383
|
}
|
|
3384
3384
|
}
|
|
3385
|
-
function ve(r,
|
|
3386
|
-
const [i,
|
|
3385
|
+
function ve(r, s, t, e) {
|
|
3386
|
+
const [i, n] = r, [o, a] = s;
|
|
3387
3387
|
let l = 1 / 0;
|
|
3388
3388
|
if (o !== 0) {
|
|
3389
3389
|
const c = o > 0 ? (t - i) / o : -i / o;
|
|
3390
3390
|
c > 0 && (l = Math.min(l, c));
|
|
3391
3391
|
}
|
|
3392
3392
|
if (a !== 0) {
|
|
3393
|
-
const c = a > 0 ? (e -
|
|
3393
|
+
const c = a > 0 ? (e - n) / a : -n / a;
|
|
3394
3394
|
c > 0 && (l = Math.min(l, c));
|
|
3395
3395
|
}
|
|
3396
|
-
return l === 1 / 0 ? r : [i + o * l,
|
|
3396
|
+
return l === 1 / 0 ? r : [i + o * l, n + a * l];
|
|
3397
3397
|
}
|
|
3398
|
-
function qi(r,
|
|
3399
|
-
const i = Math.min(r[0],
|
|
3398
|
+
function qi(r, s, t, e) {
|
|
3399
|
+
const i = Math.min(r[0], s[0]), n = Math.max(r[0], s[0]), o = Math.min(r[1], s[1]), a = Math.max(r[1], s[1]), l = [
|
|
3400
3400
|
[i, o],
|
|
3401
3401
|
// 左上
|
|
3402
|
-
[
|
|
3402
|
+
[n, o],
|
|
3403
3403
|
// 右上
|
|
3404
|
-
[
|
|
3404
|
+
[n, a],
|
|
3405
3405
|
// 右下
|
|
3406
3406
|
[i, a]
|
|
3407
3407
|
// 左下
|
|
3408
3408
|
], c = e[1] - t[1], h = t[0] - e[0], u = e[0] * t[1] - t[0] * e[1];
|
|
3409
3409
|
if (c === 0 && h === 0) {
|
|
3410
3410
|
const [p, v] = t;
|
|
3411
|
-
return p >= i && p <=
|
|
3411
|
+
return p >= i && p <= n && v >= o && v <= a;
|
|
3412
3412
|
}
|
|
3413
3413
|
const d = 1e-10;
|
|
3414
3414
|
let m = !1, g = !1;
|
|
3415
3415
|
for (const [p, v] of l) {
|
|
3416
|
-
const
|
|
3417
|
-
if (Math.abs(
|
|
3416
|
+
const w = c * p + h * v + u;
|
|
3417
|
+
if (Math.abs(w) < d || (w > d ? m = !0 : g = !0, m && g))
|
|
3418
3418
|
return !0;
|
|
3419
3419
|
}
|
|
3420
3420
|
return m && g;
|
|
@@ -3467,8 +3467,8 @@ class Bt extends Ne {
|
|
|
3467
3467
|
return this.path && this.mainCanvas ? (this.setOverlayStyles(R.ctx), this.isDraggable && (R.ctx.lineWidth = Math.max(R.ctx.lineWidth, 20)), R.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
3468
3468
|
}
|
|
3469
3469
|
isPointInAnywhere(t, e) {
|
|
3470
|
-
return ((
|
|
3471
|
-
if (!
|
|
3470
|
+
return ((n) => {
|
|
3471
|
+
if (!n) return !1;
|
|
3472
3472
|
let o = !1;
|
|
3473
3473
|
return [...this.handlePoints].sort(
|
|
3474
3474
|
(l, c) => (l.isHover ? 0 : 1) - (c.isHover ? 0 : 1)
|
|
@@ -3494,9 +3494,9 @@ class Bt extends Ne {
|
|
|
3494
3494
|
}
|
|
3495
3495
|
/** 处理单个半径值转换 */
|
|
3496
3496
|
handleSingleRadius(t, e) {
|
|
3497
|
-
const { mainCanvas: i, borderRadiusType:
|
|
3497
|
+
const { mainCanvas: i, borderRadiusType: n } = this;
|
|
3498
3498
|
if (t <= 0) return e ? 0 : void 0;
|
|
3499
|
-
switch (
|
|
3499
|
+
switch (n) {
|
|
3500
3500
|
case "position":
|
|
3501
3501
|
return t * i.percentage;
|
|
3502
3502
|
default:
|
|
@@ -3507,17 +3507,17 @@ class Bt extends Ne {
|
|
|
3507
3507
|
updateBaseData() {
|
|
3508
3508
|
if (!this.mainCanvas) return;
|
|
3509
3509
|
let { value: t, position: e, isRect: i } = this;
|
|
3510
|
-
const
|
|
3511
|
-
i && (Array.isArray(t) && (t.length = 2), Array.isArray(e) && (e.length = 2)), this.handleValuePosition("array2D",
|
|
3510
|
+
const n = i ? 2 : 3;
|
|
3511
|
+
i && (Array.isArray(t) && (t.length = 2), Array.isArray(e) && (e.length = 2)), this.handleValuePosition("array2D", n) && (this.updateHandlePoints(), this.updateDynamicRadius());
|
|
3512
3512
|
}
|
|
3513
3513
|
setOverlayStyles(t) {
|
|
3514
3514
|
var c;
|
|
3515
|
-
const e = this.isHover, i = this.mainCanvas,
|
|
3515
|
+
const e = this.isHover, i = this.mainCanvas, n = i.style[i.theme].polygon;
|
|
3516
3516
|
let o = {};
|
|
3517
|
-
typeof this.style == "string" ? o = ((c = i.style[this.style]) == null ? void 0 : c.polygon) ||
|
|
3518
|
-
JSON.parse(JSON.stringify(
|
|
3517
|
+
typeof this.style == "string" ? o = ((c = i.style[this.style]) == null ? void 0 : c.polygon) || n : typeof this.style == "object" ? o = gt(
|
|
3518
|
+
JSON.parse(JSON.stringify(n)),
|
|
3519
3519
|
this.style
|
|
3520
|
-
) : o =
|
|
3520
|
+
) : o = n;
|
|
3521
3521
|
const { fill: a, fill_hover: l } = o;
|
|
3522
3522
|
return t && (this.setBaseLineStyle(t, o.stroke), t.fillStyle = e ? l : a), o;
|
|
3523
3523
|
}
|
|
@@ -3527,7 +3527,7 @@ class Bt extends Ne {
|
|
|
3527
3527
|
/** 绘制矩形 */
|
|
3528
3528
|
drawRect(t) {
|
|
3529
3529
|
this.setGlobalAlpha(t);
|
|
3530
|
-
const [[e, i], [
|
|
3530
|
+
const [[e, i], [n, o]] = this.finalDynamicPosition, a = Math.abs(n - e), l = Math.abs(o - i), c = Math.min(e, n), h = Math.min(i, o), u = this.setOverlayStyles(t);
|
|
3531
3531
|
t.beginPath(), this.path = new Path2D(), this.dynamicBorderRadius ? this.path.roundRect(c, h, a, l, this.dynamicBorderRadius) : this.path.rect(c, h, a, l), t.stroke(this.path), t.fill(this.path), this.isShowHandlePoint = this.isClick && this.isHandlePointsVisible, this.isShowHandlePoint && this.handlePoints.forEach((d) => {
|
|
3532
3532
|
var m;
|
|
3533
3533
|
d.internalUpdate({ style: u.point }), (m = d.getDraw()) == null || m[0].call(d, t);
|
|
@@ -3537,11 +3537,11 @@ class Bt extends Ne {
|
|
|
3537
3537
|
drawPolygon(t) {
|
|
3538
3538
|
this.setGlobalAlpha(t);
|
|
3539
3539
|
const e = this.finalDynamicPosition, i = this.setOverlayStyles(t);
|
|
3540
|
-
t.beginPath(), this.path = new Path2D(), e.forEach((
|
|
3541
|
-
this.path[o == 0 ? "moveTo" : "lineTo"](
|
|
3542
|
-
}), this.path.closePath(), t.stroke(this.path), t.fill(this.path), this.isShowHandlePoint = this.isClick && this.isHandlePointsVisible, this.isShowHandlePoint && this.handlePoints.forEach((
|
|
3540
|
+
t.beginPath(), this.path = new Path2D(), e.forEach((n, o) => {
|
|
3541
|
+
this.path[o == 0 ? "moveTo" : "lineTo"](n[0], n[1]);
|
|
3542
|
+
}), this.path.closePath(), t.stroke(this.path), t.fill(this.path), this.isShowHandlePoint = this.isClick && this.isHandlePointsVisible, this.isShowHandlePoint && this.handlePoints.forEach((n) => {
|
|
3543
3543
|
var o;
|
|
3544
|
-
|
|
3544
|
+
n.internalUpdate({ style: i.point }), (o = n.getDraw()) == null || o[0].call(n, t);
|
|
3545
3545
|
});
|
|
3546
3546
|
}
|
|
3547
3547
|
getDraw() {
|
|
@@ -3575,15 +3575,15 @@ class oe extends R {
|
|
|
3575
3575
|
f(this, "defaultClick", (t, e) => {
|
|
3576
3576
|
var o;
|
|
3577
3577
|
if (!this.isHandlePointsVisible) return;
|
|
3578
|
-
const { state: i, oldState:
|
|
3579
|
-
i !=
|
|
3578
|
+
const { state: i, oldState: n } = t.data;
|
|
3579
|
+
i != n && ((o = this.notifyReload) == null || o.call(this));
|
|
3580
3580
|
});
|
|
3581
3581
|
/** 处理拖动状态变化 */
|
|
3582
3582
|
f(this, "defaultDragg", (t, e) => {
|
|
3583
3583
|
if (!this.mainCanvas) return;
|
|
3584
3584
|
const i = () => {
|
|
3585
3585
|
var h;
|
|
3586
|
-
const { offsetX:
|
|
3586
|
+
const { offsetX: n, offsetY: o } = t.data, { x: a, y: l } = this.calculateOffset(n, o);
|
|
3587
3587
|
this.handlePointsArr.concat(this).forEach((u) => {
|
|
3588
3588
|
u.internalUpdate(
|
|
3589
3589
|
{
|
|
@@ -3605,10 +3605,10 @@ class oe extends R {
|
|
|
3605
3605
|
}), (h = this.notifyReload) == null || h.call(this);
|
|
3606
3606
|
};
|
|
3607
3607
|
if (this.isHandlePointsVisible) {
|
|
3608
|
-
const { start:
|
|
3608
|
+
const { start: n, end: o, radius: a } = this.handlePoints, l = this.handlePointsArr.find((c) => c.isHover);
|
|
3609
3609
|
if (l) {
|
|
3610
3610
|
const c = t.data.offsetX;
|
|
3611
|
-
if (l ==
|
|
3611
|
+
if (l == n)
|
|
3612
3612
|
this.startAngle = (this.startAngle + -c / 180 * Math.PI) % (Math.PI * 2);
|
|
3613
3613
|
else if (l == o)
|
|
3614
3614
|
this.endAngle = (this.endAngle + -c / 180 * Math.PI) % (Math.PI * 2);
|
|
@@ -3716,7 +3716,7 @@ class oe extends R {
|
|
|
3716
3716
|
set offset(t) {
|
|
3717
3717
|
super.offset = t;
|
|
3718
3718
|
let { isHandlePointsVisible: e, handlePointsArr: i } = this;
|
|
3719
|
-
e && i.forEach((
|
|
3719
|
+
e && i.forEach((n) => n.internalUpdate({ offset: t }));
|
|
3720
3720
|
}
|
|
3721
3721
|
updateValueScope() {
|
|
3722
3722
|
const { mainCanvas: t, radiusValue: e } = this;
|
|
@@ -3734,8 +3734,8 @@ class oe extends R {
|
|
|
3734
3734
|
return this.path && this.mainCanvas ? (this.setOverlayStyles(R.ctx), this.isDraggable && (R.ctx.lineWidth = Math.max(R.ctx.lineWidth, 20)), R.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
3735
3735
|
}
|
|
3736
3736
|
isPointInAnywhere(t, e) {
|
|
3737
|
-
return ((
|
|
3738
|
-
if (!
|
|
3737
|
+
return ((n) => {
|
|
3738
|
+
if (!n) return !1;
|
|
3739
3739
|
let o = !1;
|
|
3740
3740
|
return this.handlePointsArr.forEach((a) => {
|
|
3741
3741
|
o ? a.isHover && a.notifyHover(!1) : (o = a.isPointInAnywhere(t, e), o != a.isHover && a.notifyHover(o));
|
|
@@ -3748,12 +3748,12 @@ class oe extends R {
|
|
|
3748
3748
|
}
|
|
3749
3749
|
setOverlayStyles(t) {
|
|
3750
3750
|
var c;
|
|
3751
|
-
const e = this.isHover, i = this.mainCanvas,
|
|
3751
|
+
const e = this.isHover, i = this.mainCanvas, n = i.style[i.theme].arc;
|
|
3752
3752
|
let o = {};
|
|
3753
|
-
typeof this.style == "string" ? o = ((c = i.style[this.style]) == null ? void 0 : c.arc) ||
|
|
3754
|
-
JSON.parse(JSON.stringify(
|
|
3753
|
+
typeof this.style == "string" ? o = ((c = i.style[this.style]) == null ? void 0 : c.arc) || n : typeof this.style == "object" ? o = gt(
|
|
3754
|
+
JSON.parse(JSON.stringify(n)),
|
|
3755
3755
|
this.style
|
|
3756
|
-
) : o =
|
|
3756
|
+
) : o = n;
|
|
3757
3757
|
const { fill: a, fill_hover: l } = o;
|
|
3758
3758
|
return t && (this.setBaseLineStyle(t, o.stroke), t.fillStyle = e ? l : a), o;
|
|
3759
3759
|
}
|
|
@@ -3773,7 +3773,7 @@ class oe extends R {
|
|
|
3773
3773
|
mainCanvas: t,
|
|
3774
3774
|
value: e,
|
|
3775
3775
|
radiusValue: i,
|
|
3776
|
-
startAngle:
|
|
3776
|
+
startAngle: n,
|
|
3777
3777
|
endAngle: o,
|
|
3778
3778
|
dynamicPosition: a,
|
|
3779
3779
|
isHandlePointsVisible: l,
|
|
@@ -3783,18 +3783,18 @@ class oe extends R {
|
|
|
3783
3783
|
const [h, u] = ji(
|
|
3784
3784
|
...e,
|
|
3785
3785
|
i,
|
|
3786
|
-
|
|
3786
|
+
n,
|
|
3787
3787
|
o,
|
|
3788
3788
|
t.axisConfig.x,
|
|
3789
3789
|
t.axisConfig.y
|
|
3790
|
-
), d = (
|
|
3791
|
-
name:
|
|
3790
|
+
), d = (w) => new lt({
|
|
3791
|
+
name: w,
|
|
3792
3792
|
offset: c,
|
|
3793
3793
|
isDraggable: !0,
|
|
3794
3794
|
mainCanvas: this.mainCanvas,
|
|
3795
3795
|
notifyReload: () => {
|
|
3796
|
-
var
|
|
3797
|
-
return (
|
|
3796
|
+
var C;
|
|
3797
|
+
return (C = this.notifyReload) == null ? void 0 : C.call(this);
|
|
3798
3798
|
}
|
|
3799
3799
|
}), m = this.handlePoints.start || d("start"), g = this.handlePoints.end || d("end"), p = this.handlePoints.radius || d("radius");
|
|
3800
3800
|
m.value = h, g.value = u;
|
|
@@ -3817,8 +3817,8 @@ class oe extends R {
|
|
|
3817
3817
|
).xV, this.handleValuePosition("array1D") && this.updateHandlePoints());
|
|
3818
3818
|
}
|
|
3819
3819
|
/** 绘制辅助虚线 */
|
|
3820
|
-
drawGuideLine(t, e, i,
|
|
3821
|
-
this.setBaseLineStyle(t, { ...
|
|
3820
|
+
drawGuideLine(t, e, i, n) {
|
|
3821
|
+
this.setBaseLineStyle(t, { ...n.stroke, dash: !n.stroke.dash });
|
|
3822
3822
|
const {
|
|
3823
3823
|
radiusPosition: o,
|
|
3824
3824
|
startAngle: a,
|
|
@@ -3835,13 +3835,13 @@ class oe extends R {
|
|
|
3835
3835
|
c
|
|
3836
3836
|
), t.stroke(), t.beginPath(), t.moveTo(e, i);
|
|
3837
3837
|
const u = this.handlePoints.radius.finalDynamicPosition;
|
|
3838
|
-
t.lineTo(u[0], u[1]), t.stroke(), !(this.isClosed && this.isClosedThroughCenter) && (t.fillStyle = t.strokeStyle, t.beginPath(), t.arc(e, i,
|
|
3838
|
+
t.lineTo(u[0], u[1]), t.stroke(), !(this.isClosed && this.isClosedThroughCenter) && (t.fillStyle = t.strokeStyle, t.beginPath(), t.arc(e, i, n.point.radius, 0, Math.PI * 2), t.fill());
|
|
3839
3839
|
}
|
|
3840
3840
|
draw(t) {
|
|
3841
3841
|
const {
|
|
3842
3842
|
finalDynamicPosition: e,
|
|
3843
3843
|
mainCanvas: i,
|
|
3844
|
-
startAngle:
|
|
3844
|
+
startAngle: n,
|
|
3845
3845
|
endAngle: o,
|
|
3846
3846
|
counterclockwise: a,
|
|
3847
3847
|
isFill: l,
|
|
@@ -3856,7 +3856,7 @@ class oe extends R {
|
|
|
3856
3856
|
m,
|
|
3857
3857
|
g,
|
|
3858
3858
|
u * i.percentage,
|
|
3859
|
-
|
|
3859
|
+
n,
|
|
3860
3860
|
o,
|
|
3861
3861
|
a
|
|
3862
3862
|
), c && (this.path.lineTo(m, g), h && this.path.closePath()), t.stroke(this.path), l && t.fill(this.path), this.isShowHandlePoint = this.isClick && this.isHandlePointsVisible, this.isShowHandlePoint && (this.drawGuideLine(t, m, g, d), this.handlePointsArr.forEach((p) => {
|
|
@@ -3867,12 +3867,12 @@ class oe extends R {
|
|
|
3867
3867
|
getDraw() {
|
|
3868
3868
|
if (this.isNeedRender) {
|
|
3869
3869
|
if (this.isRecalculate) {
|
|
3870
|
-
const { position: t, mainCanvas: e } = this, i = this.dynamicPosition,
|
|
3871
|
-
if (this.internalUpdate({ dynamicPosition:
|
|
3870
|
+
const { position: t, mainCanvas: e } = this, i = this.dynamicPosition, n = e.transformPosition(t);
|
|
3871
|
+
if (this.internalUpdate({ dynamicPosition: n }), this.isHandlePointsVisible)
|
|
3872
3872
|
if (e != null && e.isScaleUpdated)
|
|
3873
3873
|
this.updateHandlePoints();
|
|
3874
3874
|
else {
|
|
3875
|
-
const o =
|
|
3875
|
+
const o = n[0] - i[0], a = n[1] - i[1];
|
|
3876
3876
|
this.handlePointsArr.forEach((l) => {
|
|
3877
3877
|
const c = l.dynamicPosition[0] + o, h = l.dynamicPosition[1] + a;
|
|
3878
3878
|
l.internalUpdate({ dynamicPosition: [c, h] });
|
|
@@ -3883,8 +3883,8 @@ class oe extends R {
|
|
|
3883
3883
|
}
|
|
3884
3884
|
}
|
|
3885
3885
|
}
|
|
3886
|
-
function ji(r,
|
|
3887
|
-
const a = r + t * Math.cos(e) *
|
|
3886
|
+
function ji(r, s, t, e, i, n = 1, o = 1) {
|
|
3887
|
+
const a = r + t * Math.cos(e) * n, l = s + t * Math.sin(e) * o, c = r + t * Math.cos(i) * n, h = s + t * Math.sin(i) * o;
|
|
3888
3888
|
return [
|
|
3889
3889
|
[a, l],
|
|
3890
3890
|
[c, h]
|
|
@@ -3905,8 +3905,8 @@ class ae extends R {
|
|
|
3905
3905
|
f(this, "defaultClick", (t, e) => {
|
|
3906
3906
|
var o;
|
|
3907
3907
|
if (!this.isHandlePointsVisible) return;
|
|
3908
|
-
const { state: i, oldState:
|
|
3909
|
-
i !=
|
|
3908
|
+
const { state: i, oldState: n } = t.data;
|
|
3909
|
+
i != n && ((o = this.notifyReload) == null || o.call(this));
|
|
3910
3910
|
});
|
|
3911
3911
|
/** 处理拖动状态变化 */
|
|
3912
3912
|
f(this, "defaultDragg", (t, e) => {
|
|
@@ -3921,7 +3921,7 @@ class ae extends R {
|
|
|
3921
3921
|
if (this.handlePoints) {
|
|
3922
3922
|
const { radius: t, other: e } = this.handlePoints;
|
|
3923
3923
|
return [t, ...e].filter(Boolean).sort(
|
|
3924
|
-
(i,
|
|
3924
|
+
(i, n) => (i.isHover || i == t ? 0 : 1) - (n.isHover || n == t ? 0 : 1)
|
|
3925
3925
|
);
|
|
3926
3926
|
}
|
|
3927
3927
|
return [];
|
|
@@ -3958,8 +3958,8 @@ class ae extends R {
|
|
|
3958
3958
|
return this.path && this.mainCanvas ? (this.setOverlayStyles(R.ctx), this.isDraggable && (R.ctx.lineWidth = Math.max(R.ctx.lineWidth, 20)), R.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
3959
3959
|
}
|
|
3960
3960
|
isPointInAnywhere(t, e) {
|
|
3961
|
-
return ((
|
|
3962
|
-
if (!
|
|
3961
|
+
return ((n) => {
|
|
3962
|
+
if (!n) return !1;
|
|
3963
3963
|
let o = !1;
|
|
3964
3964
|
return this.handlePointsArr.forEach((a) => {
|
|
3965
3965
|
o ? a.isHover && a.notifyHover(!1) : (o = a.isPointInAnywhere(t, e), o != a.isHover && a.notifyHover(o));
|
|
@@ -3974,11 +3974,11 @@ class ae extends R {
|
|
|
3974
3974
|
setOverlayStyles(t) {
|
|
3975
3975
|
var o;
|
|
3976
3976
|
const e = this.mainCanvas, i = e.style[e.theme].arcTo;
|
|
3977
|
-
let
|
|
3978
|
-
return typeof this.style == "string" ?
|
|
3977
|
+
let n = {};
|
|
3978
|
+
return typeof this.style == "string" ? n = ((o = e.style[this.style]) == null ? void 0 : o.arcTo) || i : typeof this.style == "object" ? n = gt(
|
|
3979
3979
|
JSON.parse(JSON.stringify(i)),
|
|
3980
3980
|
this.style
|
|
3981
|
-
) :
|
|
3981
|
+
) : n = i, t && this.setBaseLineStyle(t, n.stroke), n;
|
|
3982
3982
|
}
|
|
3983
3983
|
get computedValueScopeStyles() {
|
|
3984
3984
|
return this.setOverlayStyles();
|
|
@@ -3986,8 +3986,8 @@ class ae extends R {
|
|
|
3986
3986
|
/** 更新控制点 */
|
|
3987
3987
|
updateHandlePoints() {
|
|
3988
3988
|
var c, h;
|
|
3989
|
-
let { value: t, position: e, dynamicPosition: i, isHandlePointsVisible:
|
|
3990
|
-
if (!i || !
|
|
3989
|
+
let { value: t, position: e, dynamicPosition: i, isHandlePointsVisible: n } = this;
|
|
3990
|
+
if (!i || !n) return;
|
|
3991
3991
|
const o = () => new lt({
|
|
3992
3992
|
mainCanvas: this.mainCanvas,
|
|
3993
3993
|
isDraggable: !0,
|
|
@@ -4012,11 +4012,11 @@ class ae extends R {
|
|
|
4012
4012
|
updateBaseData() {
|
|
4013
4013
|
if (!this.mainCanvas) return;
|
|
4014
4014
|
let { value: t, position: e } = this;
|
|
4015
|
-
const [i,
|
|
4015
|
+
const [i, n] = [
|
|
4016
4016
|
zt(t) && t.length > 1,
|
|
4017
4017
|
zt(e) && e.length > 1
|
|
4018
4018
|
];
|
|
4019
|
-
if (!i && !
|
|
4019
|
+
if (!i && !n)
|
|
4020
4020
|
return this.handlePoints = void 0, this.internalUpdate({ dynamicPosition: void 0 });
|
|
4021
4021
|
if (i) {
|
|
4022
4022
|
e = [];
|
|
@@ -4035,17 +4035,17 @@ class ae extends R {
|
|
|
4035
4035
|
this.internalUpdate({ value: t, position: e, dynamicPosition: o }), this.updateHandlePoints();
|
|
4036
4036
|
}
|
|
4037
4037
|
draw(t) {
|
|
4038
|
-
const { dynamicPosition: e, mainCanvas: i, radiusValue:
|
|
4038
|
+
const { dynamicPosition: e, mainCanvas: i, radiusValue: n } = this;
|
|
4039
4039
|
}
|
|
4040
4040
|
getDraw() {
|
|
4041
4041
|
if (this.isNeedRender) {
|
|
4042
4042
|
if (this.isRecalculate) {
|
|
4043
|
-
const { position: t, mainCanvas: e } = this, i = this.dynamicPosition,
|
|
4044
|
-
if (this.internalUpdate({ dynamicPosition:
|
|
4043
|
+
const { position: t, mainCanvas: e } = this, i = this.dynamicPosition, n = e.transformPosition(t);
|
|
4044
|
+
if (this.internalUpdate({ dynamicPosition: n }), this.isHandlePointsVisible)
|
|
4045
4045
|
if (e != null && e.isScaleUpdated)
|
|
4046
4046
|
this.updateHandlePoints();
|
|
4047
4047
|
else {
|
|
4048
|
-
const o =
|
|
4048
|
+
const o = n[0][0] - i[0][0], a = n[0][1] - i[0][1];
|
|
4049
4049
|
this.handlePointsArr.forEach((l) => {
|
|
4050
4050
|
const c = l.dynamicPosition[0] + o, h = l.dynamicPosition[1] + a;
|
|
4051
4051
|
l.internalUpdate({ dynamicPosition: [c, h] });
|
|
@@ -4095,11 +4095,11 @@ class $i extends zi {
|
|
|
4095
4095
|
}
|
|
4096
4096
|
/** 更新 计算坐标所需依赖 */
|
|
4097
4097
|
updateRely() {
|
|
4098
|
-
const { center: t, scale: e, rect: i, axisConfig:
|
|
4098
|
+
const { center: t, scale: e, rect: i, axisConfig: n } = this, o = [
|
|
4099
4099
|
t.x,
|
|
4100
4100
|
t.y,
|
|
4101
4101
|
e,
|
|
4102
|
-
JSON.stringify(
|
|
4102
|
+
JSON.stringify(n),
|
|
4103
4103
|
i.width,
|
|
4104
4104
|
i.height
|
|
4105
4105
|
].join();
|
|
@@ -4107,7 +4107,7 @@ class $i extends zi {
|
|
|
4107
4107
|
}
|
|
4108
4108
|
/** 重绘画布 */
|
|
4109
4109
|
redraw() {
|
|
4110
|
-
var
|
|
4110
|
+
var n, o;
|
|
4111
4111
|
if (!this.canvas) return console.warn("canvas is not HTMLCanvasElement");
|
|
4112
4112
|
if (this.canvas.clientWidth == 0 || this.canvas.clientHeight == 0)
|
|
4113
4113
|
return console.warn(
|
|
@@ -4117,7 +4117,7 @@ class $i extends zi {
|
|
|
4117
4117
|
this.ctx.globalAlpha = this.opacity ?? 1, this.updateCenter(), this.updateRely(), this.maxMinValue = this.getMaxMinValue(), this.clearScreen();
|
|
4118
4118
|
const t = [];
|
|
4119
4119
|
let e = [];
|
|
4120
|
-
const i = (
|
|
4120
|
+
const i = (n = this.drawAxis) == null ? void 0 : n.drawAxisAndGrid();
|
|
4121
4121
|
i && e.push([0, i, []]), this.layerGroups.forEach(
|
|
4122
4122
|
(a) => e.push(...a.fetchCanvas())
|
|
4123
4123
|
), e.sort((a, l) => a[0] - l[0]), e.forEach(([, a, l], c) => {
|
|
@@ -4148,11 +4148,11 @@ class $i extends zi {
|
|
|
4148
4148
|
}
|
|
4149
4149
|
/** 根据坐标查找覆盖物 */
|
|
4150
4150
|
findOverlayByPoint(t) {
|
|
4151
|
-
const { offsetX: e, offsetY: i, clientX:
|
|
4152
|
-
clientX:
|
|
4151
|
+
const { offsetX: e, offsetY: i, clientX: n, clientY: o } = t, { x: a, y: l } = this.axisConfig, c = this.getMousePositionOnAxis({
|
|
4152
|
+
clientX: n - 10 * a,
|
|
4153
4153
|
clientY: o - 10 * l
|
|
4154
4154
|
}), h = this.getMousePositionOnAxis({
|
|
4155
|
-
clientX:
|
|
4155
|
+
clientX: n + 10 * a,
|
|
4156
4156
|
clientY: o + 10 * l
|
|
4157
4157
|
}), u = this.getAxisValueByPoint(c.x, c.y), d = this.getAxisValueByPoint(h.x, h.y);
|
|
4158
4158
|
return [...this.currentDrawOverlays].sort(
|
|
@@ -4230,11 +4230,11 @@ class Zi extends $i {
|
|
|
4230
4230
|
{ type: "touchend", handler: this.touchend.bind(this) },
|
|
4231
4231
|
{ type: "touchmove", handler: this.touchmove.bind(this) }
|
|
4232
4232
|
];
|
|
4233
|
-
e.forEach(({ type: i, handler:
|
|
4234
|
-
o.addEventListener(i,
|
|
4233
|
+
e.forEach(({ type: i, handler: n, target: o = t }) => {
|
|
4234
|
+
o.addEventListener(i, n);
|
|
4235
4235
|
}), this.unBind = () => {
|
|
4236
|
-
e.forEach(({ type: i, handler:
|
|
4237
|
-
o.removeEventListener(i,
|
|
4236
|
+
e.forEach(({ type: i, handler: n, target: o = t }) => {
|
|
4237
|
+
o.removeEventListener(i, n);
|
|
4238
4238
|
});
|
|
4239
4239
|
};
|
|
4240
4240
|
}
|
|
@@ -4269,21 +4269,21 @@ class Zi extends $i {
|
|
|
4269
4269
|
}
|
|
4270
4270
|
/** 键盘按下事件 */
|
|
4271
4271
|
keydown(t) {
|
|
4272
|
-
const { mouseInCanvas: e, offset: i, delta:
|
|
4272
|
+
const { mouseInCanvas: e, offset: i, delta: n, axisConfig: o } = this, a = t.key;
|
|
4273
4273
|
if (!e || !this.isDraggable || this.isAuto) return;
|
|
4274
|
-
const l = this.getStep(a), c = this.lastClickedOverlay, u = (c == null ? void 0 : c.isDraggable) && this.currentDrawOverlays.includes(c) && (zt(c.value) ? "Matrix" : ue(c.value) ? "Single" : !1), d = (v,
|
|
4274
|
+
const l = this.getStep(a), c = this.lastClickedOverlay, u = (c == null ? void 0 : c.isDraggable) && this.currentDrawOverlays.includes(c) && (zt(c.value) ? "Matrix" : ue(c.value) ? "Single" : !1), d = (v, w) => {
|
|
4275
4275
|
if (!u)
|
|
4276
|
-
return i.x += v * l, i.y +=
|
|
4277
|
-
const
|
|
4276
|
+
return i.x += v * l, i.y += w * l, !0;
|
|
4277
|
+
const C = this.getAxisValueByPoint(l, 0).xV, [_, E] = [C * o.x, C * o.y];
|
|
4278
4278
|
if (u === "Single") {
|
|
4279
4279
|
const A = c.value;
|
|
4280
|
-
A[0] += v *
|
|
4280
|
+
A[0] += v * _, A[1] += w * E;
|
|
4281
4281
|
} else
|
|
4282
4282
|
c.value.forEach((A) => {
|
|
4283
|
-
A[0] += v *
|
|
4283
|
+
A[0] += v * _, A[1] += w * E;
|
|
4284
4284
|
});
|
|
4285
4285
|
return c.value = [...c.value], !0;
|
|
4286
|
-
}, m = (v) => (this.setScale("center", v *
|
|
4286
|
+
}, m = (v) => (this.setScale("center", v * n), !0), p = {
|
|
4287
4287
|
ArrowUp: () => d(0, -1),
|
|
4288
4288
|
ArrowDown: () => d(0, 1),
|
|
4289
4289
|
ArrowLeft: () => d(-1, 0),
|
|
@@ -4297,8 +4297,8 @@ class Zi extends $i {
|
|
|
4297
4297
|
keyup(t) {
|
|
4298
4298
|
const { mouseInCanvas: e, lastPressedKey: i } = this;
|
|
4299
4299
|
if (e) {
|
|
4300
|
-
const
|
|
4301
|
-
i.key =
|
|
4300
|
+
const n = t.key;
|
|
4301
|
+
i.key = n, i.keyupTime = Date.now(), i.doubleClick = !1;
|
|
4302
4302
|
}
|
|
4303
4303
|
}
|
|
4304
4304
|
/** 滚轮滚动 */
|
|
@@ -4307,8 +4307,8 @@ class Zi extends $i {
|
|
|
4307
4307
|
t.preventDefault();
|
|
4308
4308
|
const { delta: e, isAuto: i } = this;
|
|
4309
4309
|
if (i) return;
|
|
4310
|
-
const
|
|
4311
|
-
o == null || o.notifyWheel(
|
|
4310
|
+
const n = t.deltaY < 0 ? e : -e, o = this.findOverlayByPoint(t);
|
|
4311
|
+
o == null || o.notifyWheel(n, t), this.notifyWheel(n, t);
|
|
4312
4312
|
}
|
|
4313
4313
|
/** 鼠标按下 */
|
|
4314
4314
|
mousedown(t) {
|
|
@@ -4316,8 +4316,8 @@ class Zi extends $i {
|
|
|
4316
4316
|
if (!this.isDownable) return;
|
|
4317
4317
|
const { clientX: e, clientY: i } = t;
|
|
4318
4318
|
this.mouseLastPosition = { x: e, y: i };
|
|
4319
|
-
const
|
|
4320
|
-
this.lastDownOverlay !=
|
|
4319
|
+
const n = this.findOverlayByPoint(t);
|
|
4320
|
+
this.lastDownOverlay != n && ((o = this.lastDownOverlay) == null || o.notifyDown(!1, t), n == null || n.notifyDown(!0, t)), this.lastDownOverlay = n, this.notifyDown(!0, t);
|
|
4321
4321
|
}
|
|
4322
4322
|
/** 鼠标松开 */
|
|
4323
4323
|
mouseup(t) {
|
|
@@ -4333,15 +4333,15 @@ class Zi extends $i {
|
|
|
4333
4333
|
const { lastDownOverlay: e } = this;
|
|
4334
4334
|
if (!this.isDraggable) return;
|
|
4335
4335
|
e != null && e.isDraggable ? this.notifyDraggOverlays(t) : this.handleCanvasPan(t);
|
|
4336
|
-
const { clientX: i, clientY:
|
|
4337
|
-
this.mouseLastPosition = { x: i, y:
|
|
4336
|
+
const { clientX: i, clientY: n } = t;
|
|
4337
|
+
this.mouseLastPosition = { x: i, y: n }, this.lockNotifyClick = !0;
|
|
4338
4338
|
}
|
|
4339
4339
|
/** 通知可拖拽的 overlays */
|
|
4340
4340
|
notifyDraggOverlays(t) {
|
|
4341
|
-
const e = this.lastDownOverlay, { mouseLastPosition: i } = this, { clientX:
|
|
4341
|
+
const e = this.lastDownOverlay, { mouseLastPosition: i } = this, { clientX: n, clientY: o } = t;
|
|
4342
4342
|
e.notifyDragg(
|
|
4343
4343
|
{
|
|
4344
|
-
offsetX:
|
|
4344
|
+
offsetX: n - i.x,
|
|
4345
4345
|
offsetY: o - i.y
|
|
4346
4346
|
},
|
|
4347
4347
|
t
|
|
@@ -4349,8 +4349,8 @@ class Zi extends $i {
|
|
|
4349
4349
|
}
|
|
4350
4350
|
/** 处理画布平移 */
|
|
4351
4351
|
handleCanvasPan(t) {
|
|
4352
|
-
const { clientX: e, clientY: i } = t, { offset:
|
|
4353
|
-
|
|
4352
|
+
const { clientX: e, clientY: i } = t, { offset: n, mouseLastPosition: o } = this, a = e - o.x, l = i - o.y;
|
|
4353
|
+
n.x += a, n.y += l, this.redrawOnce(), this.notifyDragg({ offsetX: a, offsetY: l }, t);
|
|
4354
4354
|
}
|
|
4355
4355
|
/** 处理 hover 逻辑 */
|
|
4356
4356
|
handleHover(t) {
|
|
@@ -4361,8 +4361,8 @@ class Zi extends $i {
|
|
|
4361
4361
|
/** 更新 hover 状态 */
|
|
4362
4362
|
updateHoverState(t, e) {
|
|
4363
4363
|
if (this.lastHoverOverlay === t) {
|
|
4364
|
-
const
|
|
4365
|
-
|
|
4364
|
+
const n = t == null ? void 0 : t.cursorStyle;
|
|
4365
|
+
n !== this.lastCursorStyle && (this.lastCursorStyle && this.canvas.classList.remove(this.lastCursorStyle), n && this.canvas.classList.add(n), this.lastCursorStyle = n);
|
|
4366
4366
|
return;
|
|
4367
4367
|
}
|
|
4368
4368
|
this.lastHoverOverlay && t && t.hasController("hover", this.lastHoverOverlay) || (this.clearHoverState(e), this.applyHoverState(t, e)), this.lastHoverOverlay = t;
|
|
@@ -4384,32 +4384,32 @@ class Zi extends $i {
|
|
|
4384
4384
|
if (!this.isDraggable) return;
|
|
4385
4385
|
const e = t.touches;
|
|
4386
4386
|
t.preventDefault();
|
|
4387
|
-
const { oldClientX: i, oldClientY:
|
|
4387
|
+
const { oldClientX: i, oldClientY: n, offset: o, delta: a, isAuto: l, isDraggable: c } = this;
|
|
4388
4388
|
if (c && !l) {
|
|
4389
4389
|
if (e.length === 1) {
|
|
4390
4390
|
const { clientX: h, clientY: u } = e[0];
|
|
4391
|
-
i.length && (o.x += h - i[0], o.y += u -
|
|
4391
|
+
i.length && (o.x += h - i[0], o.y += u - n[0], this.redrawOnce()), this.oldClientX = [h], this.oldClientY = [u];
|
|
4392
4392
|
} else if (e.length === 2) {
|
|
4393
4393
|
const { clientX: h, clientY: u } = e[0], { clientX: d, clientY: m } = e[1];
|
|
4394
4394
|
if (i.length == 2) {
|
|
4395
4395
|
const g = xe(
|
|
4396
4396
|
i[0],
|
|
4397
|
-
|
|
4397
|
+
n[0],
|
|
4398
4398
|
i[1],
|
|
4399
|
-
|
|
4399
|
+
n[1]
|
|
4400
4400
|
), p = xe(
|
|
4401
4401
|
h,
|
|
4402
4402
|
u,
|
|
4403
4403
|
d,
|
|
4404
4404
|
m
|
|
4405
|
-
), { x: v, y:
|
|
4405
|
+
), { x: v, y: w } = Ue(
|
|
4406
4406
|
h,
|
|
4407
4407
|
u,
|
|
4408
4408
|
d,
|
|
4409
4409
|
m
|
|
4410
4410
|
);
|
|
4411
4411
|
this.setScale(
|
|
4412
|
-
{ clientX: v, clientY:
|
|
4412
|
+
{ clientX: v, clientY: w },
|
|
4413
4413
|
p > g ? a : -a
|
|
4414
4414
|
), this.redrawOnce();
|
|
4415
4415
|
}
|
|
@@ -4528,8 +4528,8 @@ class it extends kt {
|
|
|
4528
4528
|
removeGroup(t) {
|
|
4529
4529
|
var i;
|
|
4530
4530
|
let e = !1;
|
|
4531
|
-
[t].flat().forEach((
|
|
4532
|
-
|
|
4531
|
+
[t].flat().forEach((n) => {
|
|
4532
|
+
n instanceof et && (this.groups.delete(n.name), n.setNotifyReload(), n.setMainCanvas(), n.parent = void 0, e = !0);
|
|
4533
4533
|
}), e && ((i = this.notifyReload) == null || i.call(this));
|
|
4534
4534
|
}
|
|
4535
4535
|
/** 清空覆盖物 */
|
|
@@ -4547,8 +4547,8 @@ class it extends kt {
|
|
|
4547
4547
|
/** 获取画布 */
|
|
4548
4548
|
getCanvas() {
|
|
4549
4549
|
if (!this.mainCanvas) return;
|
|
4550
|
-
const { rect: t, isThemeUpdated: e } = this.mainCanvas, i = this.shouldRender(),
|
|
4551
|
-
if (i &&
|
|
4550
|
+
const { rect: t, isThemeUpdated: e } = this.mainCanvas, i = this.shouldRender(), n = this.groups.size;
|
|
4551
|
+
if (i && n) {
|
|
4552
4552
|
if (this.isReload || this.isRecalculate || e) {
|
|
4553
4553
|
this.currentDrawOverlays = [], this.isReload = !1, this.canvas.width = t.width || 0, this.canvas.height = t.height || 0;
|
|
4554
4554
|
const o = [];
|
|
@@ -4603,8 +4603,8 @@ class Rt extends kt {
|
|
|
4603
4603
|
removeLayer(t) {
|
|
4604
4604
|
var i;
|
|
4605
4605
|
let e = !1;
|
|
4606
|
-
[t].flat().forEach((
|
|
4607
|
-
|
|
4606
|
+
[t].flat().forEach((n) => {
|
|
4607
|
+
n instanceof it && (this.layers.delete(n.name), n.setNotifyReload(), n.setMainCanvas(), n.parent = void 0, e = !0);
|
|
4608
4608
|
}), e && ((i = this.notifyReload) == null || i.call(this));
|
|
4609
4609
|
}
|
|
4610
4610
|
/** 清空图层 */
|
|
@@ -4633,11 +4633,11 @@ class Ji extends Zi {
|
|
|
4633
4633
|
/** 获取默认覆盖物群组 */
|
|
4634
4634
|
getDefaultOverlayGroup() {
|
|
4635
4635
|
var a, l, c, h, u;
|
|
4636
|
-
const
|
|
4637
|
-
if (!
|
|
4638
|
-
const t = (a =
|
|
4636
|
+
const s = this.layerGroups.get("默认图层群组");
|
|
4637
|
+
if (!s) return;
|
|
4638
|
+
const t = (a = s.getLayer("点位图层")) == null ? void 0 : a.getGroup("点位覆盖物群组"), e = (l = s.getLayer("线段图层")) == null ? void 0 : l.getGroup("线段覆盖物群组"), i = (c = s.getLayer("多边形图层")) == null ? void 0 : c.getGroup("多边形覆盖物群组"), n = (h = s.getLayer("文字图层")) == null ? void 0 : h.getGroup("文字覆盖物群组"), o = (u = s.getLayer("自定义绘制图层")) == null ? void 0 : u.getGroup("自定义绘制覆盖物群组");
|
|
4639
4639
|
return {
|
|
4640
|
-
overlays_text:
|
|
4640
|
+
overlays_text: n,
|
|
4641
4641
|
overlays_point: t,
|
|
4642
4642
|
overlays_line: e,
|
|
4643
4643
|
overlays_polygon: i,
|
|
@@ -4648,8 +4648,8 @@ class Ji extends Zi {
|
|
|
4648
4648
|
* 获取所有可见的覆盖层(Overlay)
|
|
4649
4649
|
* 支持从指定源(图层组/图层/覆盖层组/覆盖层数组)开始遍历
|
|
4650
4650
|
*/
|
|
4651
|
-
getAllOverlays(
|
|
4652
|
-
const t = [], e =
|
|
4651
|
+
getAllOverlays(s) {
|
|
4652
|
+
const t = [], e = s !== void 0 ? Array.isArray(s) ? [...s] : [s] : Array.from(this.layerGroups.values());
|
|
4653
4653
|
for (; e.length > 0; ) {
|
|
4654
4654
|
const i = e.pop();
|
|
4655
4655
|
if (i instanceof Rt) {
|
|
@@ -4669,11 +4669,11 @@ class Ji extends Zi {
|
|
|
4669
4669
|
}
|
|
4670
4670
|
class Ki extends Ji {
|
|
4671
4671
|
/** 缩放画布 */
|
|
4672
|
-
zoom(
|
|
4672
|
+
zoom(s) {
|
|
4673
4673
|
const { canvas: t, rect: e } = this;
|
|
4674
4674
|
if (!t || !e)
|
|
4675
4675
|
return console.error("canvas is not HTMLCanvasElement");
|
|
4676
|
-
this.setScale("center",
|
|
4676
|
+
this.setScale("center", s), this.redrawOnce();
|
|
4677
4677
|
}
|
|
4678
4678
|
/** 放大 */
|
|
4679
4679
|
zoomIn() {
|
|
@@ -4684,20 +4684,20 @@ class Ki extends Ji {
|
|
|
4684
4684
|
this.zoom(-this.delta);
|
|
4685
4685
|
}
|
|
4686
4686
|
/** 添加样式 */
|
|
4687
|
-
setStyle(
|
|
4688
|
-
super.setStyle(
|
|
4687
|
+
setStyle(s) {
|
|
4688
|
+
super.setStyle(s), this.redrawOnce();
|
|
4689
4689
|
}
|
|
4690
4690
|
/** 设置主题 */
|
|
4691
|
-
setTheme(
|
|
4692
|
-
super.setTheme(
|
|
4691
|
+
setTheme(s) {
|
|
4692
|
+
super.setTheme(s), this.redrawOnce();
|
|
4693
4693
|
}
|
|
4694
4694
|
/** 设置坐标轴 */
|
|
4695
|
-
setAxis(
|
|
4696
|
-
super.setAxis(
|
|
4695
|
+
setAxis(s) {
|
|
4696
|
+
super.setAxis(s), this.redrawOnce();
|
|
4697
4697
|
}
|
|
4698
4698
|
/** 设置默认中心 */
|
|
4699
|
-
setDefaultCenter(
|
|
4700
|
-
super.setDefaultCenter(
|
|
4699
|
+
setDefaultCenter(s) {
|
|
4700
|
+
super.setDefaultCenter(s), this.redrawOnce();
|
|
4701
4701
|
}
|
|
4702
4702
|
}
|
|
4703
4703
|
class Qi extends Ki {
|
|
@@ -4708,10 +4708,10 @@ class Qi extends Ki {
|
|
|
4708
4708
|
* @param avoid 边距调整 [上, 右, 下, 左]
|
|
4709
4709
|
* @param maxScale 最大缩放比例限制
|
|
4710
4710
|
*/
|
|
4711
|
-
setFitView(
|
|
4712
|
-
const
|
|
4713
|
-
if (
|
|
4714
|
-
const { minX: o, maxX: a, minY: l, maxY: c } = this.calculateBoundingBox(
|
|
4711
|
+
setFitView(s = void 0, t = !1, e = [60, 60, 60, 60], i) {
|
|
4712
|
+
const n = this.getAllOverlays(s);
|
|
4713
|
+
if (n.length === 0) return;
|
|
4714
|
+
const { minX: o, maxX: a, minY: l, maxY: c } = this.calculateBoundingBox(n), h = a - o, u = c - l, d = this.calculateOptimalScale(
|
|
4715
4715
|
h,
|
|
4716
4716
|
u,
|
|
4717
4717
|
e,
|
|
@@ -4726,13 +4726,13 @@ class Qi extends Ki {
|
|
|
4726
4726
|
d == this.scale && m.x == 0 && m.y == 0 || (t ? this.applyTransformImmediately(d, m) : this.animateTransform(d, m));
|
|
4727
4727
|
}
|
|
4728
4728
|
/** 计算所有覆盖层的边界范围 */
|
|
4729
|
-
calculateBoundingBox(
|
|
4730
|
-
let t = 1 / 0, e = -1 / 0, i = 1 / 0,
|
|
4731
|
-
for (const o of
|
|
4729
|
+
calculateBoundingBox(s) {
|
|
4730
|
+
let t = 1 / 0, e = -1 / 0, i = 1 / 0, n = -1 / 0;
|
|
4731
|
+
for (const o of s) {
|
|
4732
4732
|
const a = o.valueScope;
|
|
4733
|
-
t = Math.min(t, a.minX), e = Math.max(e, a.maxX), i = Math.min(i, a.minY),
|
|
4733
|
+
t = Math.min(t, a.minX), e = Math.max(e, a.maxX), i = Math.min(i, a.minY), n = Math.max(n, a.maxY);
|
|
4734
4734
|
}
|
|
4735
|
-
return { minX: t, maxX: e, minY: i, maxY:
|
|
4735
|
+
return { minX: t, maxX: e, minY: i, maxY: n };
|
|
4736
4736
|
}
|
|
4737
4737
|
/**
|
|
4738
4738
|
* 计算最佳缩放比例(基于动态网格系统适配)
|
|
@@ -4751,24 +4751,24 @@ class Qi extends Ki {
|
|
|
4751
4751
|
* @param maxScale 最大允许缩放比例
|
|
4752
4752
|
* @returns 优化后的缩放比例
|
|
4753
4753
|
*/
|
|
4754
|
-
calculateOptimalScale(
|
|
4755
|
-
const { cycle:
|
|
4754
|
+
calculateOptimalScale(s, t, e, i) {
|
|
4755
|
+
const { cycle: n, delta: o, axisConfig: a, rect: l } = this, { width: c, height: h } = l, u = Math.max(0, c - e[1] - e[3]) || c, d = Math.max(0, h - e[0] - e[2]) || h;
|
|
4756
4756
|
if (u <= 0 || d <= 0)
|
|
4757
4757
|
return console.warn("无效的可视区域尺寸,边距设置可能不合理"), this.scale;
|
|
4758
|
-
const m =
|
|
4759
|
-
let
|
|
4760
|
-
if (p >
|
|
4761
|
-
const E = Math.ceil(p /
|
|
4762
|
-
|
|
4758
|
+
const m = s / u, g = t / d, p = Math.max(m, g), v = a.count, w = v / a.min, C = n * o;
|
|
4759
|
+
let _;
|
|
4760
|
+
if (p > w) {
|
|
4761
|
+
const E = Math.ceil(p / w);
|
|
4762
|
+
_ = 1 - ((v * E / p - a.min) / a.min + (E - 2)) * C;
|
|
4763
4763
|
} else {
|
|
4764
|
-
const E = (ut, rt, yt) => ut < rt ? yt - 1 : E(ut / 2, rt, yt + 1), A = E(
|
|
4765
|
-
|
|
4764
|
+
const E = (ut, rt, yt) => ut < rt ? yt - 1 : E(ut / 2, rt, yt + 1), A = E(w, p, 0), X = Math.pow(2, A);
|
|
4765
|
+
_ = 1 + ((v / X / p - a.min) / a.min + A) * C;
|
|
4766
4766
|
}
|
|
4767
|
-
return i !== void 0 && (
|
|
4767
|
+
return i !== void 0 && (_ = Math.min(i, _)), _ = new V(_).div(o).round().mul(o).toNumber(), _;
|
|
4768
4768
|
}
|
|
4769
4769
|
/** 计算目标位置偏移 */
|
|
4770
|
-
calculateOffsetDifference(
|
|
4771
|
-
const { width: o, height: a } = this.rect, { axisConfig: l, center: c } = this, h = (t +
|
|
4770
|
+
calculateOffsetDifference(s, t, e, i, n) {
|
|
4771
|
+
const { width: o, height: a } = this.rect, { axisConfig: l, center: c } = this, h = (t + s) / 2, u = (i + e) / 2, d = this.getAxisPointByValue(h, u), m = this.getAxisValueByPoint(
|
|
4772
4772
|
(o / 2 - c.x) * l.x,
|
|
4773
4773
|
(a / 2 - c.y) * l.y
|
|
4774
4774
|
), g = this.getAxisPointByValue(
|
|
@@ -4777,61 +4777,61 @@ class Qi extends Ki {
|
|
|
4777
4777
|
);
|
|
4778
4778
|
return {
|
|
4779
4779
|
x: Math.round(
|
|
4780
|
-
-(d.x + (
|
|
4780
|
+
-(d.x + (n[3] - n[1]) - g.x) * l.x
|
|
4781
4781
|
),
|
|
4782
4782
|
y: Math.round(
|
|
4783
|
-
-(d.y + (
|
|
4783
|
+
-(d.y + (n[0] - n[2]) - g.y) * l.y
|
|
4784
4784
|
)
|
|
4785
4785
|
};
|
|
4786
4786
|
}
|
|
4787
4787
|
/** 立即应用变换 */
|
|
4788
|
-
applyTransformImmediately(
|
|
4788
|
+
applyTransformImmediately(s, t) {
|
|
4789
4789
|
this.offset = {
|
|
4790
4790
|
x: this.offset.x + t.x,
|
|
4791
4791
|
y: this.offset.y + t.y
|
|
4792
|
-
}, this.scale =
|
|
4792
|
+
}, this.scale = s, this.updateSize(), this.redrawOnce();
|
|
4793
4793
|
}
|
|
4794
4794
|
/** 执行动画过渡 */
|
|
4795
|
-
animateTransform(
|
|
4796
|
-
const e = this.scale, i = { ...this.offset },
|
|
4795
|
+
animateTransform(s, t) {
|
|
4796
|
+
const e = this.scale, i = { ...this.offset }, n = 300;
|
|
4797
4797
|
this.isAuto = !0;
|
|
4798
4798
|
const o = () => this.isAuto = !1;
|
|
4799
4799
|
((c) => this.animateOffset(
|
|
4800
4800
|
i,
|
|
4801
4801
|
t,
|
|
4802
|
-
|
|
4802
|
+
n,
|
|
4803
4803
|
c || o
|
|
4804
4804
|
))((c) => this.animateScale(
|
|
4805
4805
|
e,
|
|
4806
|
-
n,
|
|
4807
4806
|
s,
|
|
4807
|
+
n,
|
|
4808
4808
|
c || o
|
|
4809
4809
|
));
|
|
4810
4810
|
}
|
|
4811
4811
|
/** 执行缩放动画 */
|
|
4812
|
-
animateScale(
|
|
4813
|
-
const
|
|
4812
|
+
animateScale(s, t, e, i) {
|
|
4813
|
+
const n = t - s;
|
|
4814
4814
|
let o = 0;
|
|
4815
4815
|
Ut((a) => {
|
|
4816
|
-
!this.isAuto || !this.canvas || !this.isInteractive || (this.setScale("center", (a - o) *
|
|
4816
|
+
!this.isAuto || !this.canvas || !this.isInteractive || (this.setScale("center", (a - o) * n), o = a, this.redrawOnce(), a === 1 && i());
|
|
4817
4817
|
}, e);
|
|
4818
4818
|
}
|
|
4819
4819
|
/** 执行偏移动画 */
|
|
4820
|
-
animateOffset(
|
|
4821
|
-
Ut((
|
|
4820
|
+
animateOffset(s, t, e, i) {
|
|
4821
|
+
Ut((n) => {
|
|
4822
4822
|
!this.isAuto || !this.canvas || !this.isInteractive || (this.offset = {
|
|
4823
|
-
x: Number((
|
|
4824
|
-
y: Number((
|
|
4825
|
-
}, this.redrawOnce(),
|
|
4823
|
+
x: Number((s.x + t.x * n).toFixed(0)),
|
|
4824
|
+
y: Number((s.y + t.y * n).toFixed(0))
|
|
4825
|
+
}, this.redrawOnce(), n === 1 && i());
|
|
4826
4826
|
}, e);
|
|
4827
4827
|
}
|
|
4828
4828
|
/** 回归初始位置 */
|
|
4829
4829
|
returnToOrigin() {
|
|
4830
4830
|
if (!this.isInteractive || this.scale == this.defaultScale && this.offset.x == 0 && this.offset.y == 0)
|
|
4831
4831
|
return;
|
|
4832
|
-
const { rect:
|
|
4833
|
-
clientX:
|
|
4834
|
-
clientY:
|
|
4832
|
+
const { rect: s, axisConfig: t } = this, e = this.getDefaultCenterLocation(), i = (s.width / 2 - e.x) * t.x, n = (s.height / 2 - e.y) * t.y, o = this.getAxisValueByPoint(i, n, !0), a = this.getMousePositionOnAxis({
|
|
4833
|
+
clientX: s.x + s.width / 2,
|
|
4834
|
+
clientY: s.y + s.height / 2
|
|
4835
4835
|
}), l = this.getAxisValueByPoint(a.x, a.y), c = t.size / this.getNowGridCount, h = Math.round(
|
|
4836
4836
|
(l.xV - o.xV) * t.x * c
|
|
4837
4837
|
), u = Math.round(
|
|
@@ -4845,27 +4845,27 @@ class Qi extends Ki {
|
|
|
4845
4845
|
}
|
|
4846
4846
|
class ts extends Qi {
|
|
4847
4847
|
/** 开关坐标轴 */
|
|
4848
|
-
toggleAxis(
|
|
4849
|
-
this.drawAxis.toggleAxis(
|
|
4848
|
+
toggleAxis(s) {
|
|
4849
|
+
this.drawAxis.toggleAxis(s), this.redrawOnce();
|
|
4850
4850
|
}
|
|
4851
4851
|
/** 开关点位 */
|
|
4852
|
-
togglePoint(
|
|
4852
|
+
togglePoint(s) {
|
|
4853
4853
|
const { overlays_point: t } = this.getDefaultOverlayGroup() || {};
|
|
4854
|
-
return t ? (t.isVisible =
|
|
4854
|
+
return t ? (t.isVisible = s ?? !t.isVisible, this.redrawOnce(), t.isVisible) : !1;
|
|
4855
4855
|
}
|
|
4856
4856
|
/** 开关线段 */
|
|
4857
|
-
toggleLine(
|
|
4857
|
+
toggleLine(s) {
|
|
4858
4858
|
const { overlays_line: t } = this.getDefaultOverlayGroup() || {};
|
|
4859
|
-
return t ? (t.isVisible =
|
|
4859
|
+
return t ? (t.isVisible = s ?? !t.isVisible, this.redrawOnce(), t.isVisible) : !1;
|
|
4860
4860
|
}
|
|
4861
4861
|
/** 开关多边形 */
|
|
4862
|
-
togglePolygon(
|
|
4862
|
+
togglePolygon(s) {
|
|
4863
4863
|
const { overlays_polygon: t } = this.getDefaultOverlayGroup() || {};
|
|
4864
|
-
return t ? (t.isVisible =
|
|
4864
|
+
return t ? (t.isVisible = s ?? !t.isVisible, this.redrawOnce(), t.isVisible) : !1;
|
|
4865
4865
|
}
|
|
4866
4866
|
/** 切换锁定状态 */
|
|
4867
|
-
toggleLock(
|
|
4868
|
-
return this.isInteractive =
|
|
4867
|
+
toggleLock(s) {
|
|
4868
|
+
return this.isInteractive = s ?? !this.isInteractive, this.isInteractive;
|
|
4869
4869
|
}
|
|
4870
4870
|
}
|
|
4871
4871
|
class es extends ts {
|
|
@@ -4874,15 +4874,15 @@ class es extends ts {
|
|
|
4874
4874
|
* @param ctx - Canvas 2D绘图上下文
|
|
4875
4875
|
* @param path - 定义清除区域的路径对象
|
|
4876
4876
|
*/
|
|
4877
|
-
static clearPathRegion(
|
|
4878
|
-
const { width: e, height: i } =
|
|
4879
|
-
|
|
4877
|
+
static clearPathRegion(s, t) {
|
|
4878
|
+
const { width: e, height: i } = s.canvas;
|
|
4879
|
+
s.save(), s.beginPath(), s.clip(t), s.clearRect(0, 0, e, i), s.restore();
|
|
4880
4880
|
}
|
|
4881
4881
|
}
|
|
4882
4882
|
class is extends es {
|
|
4883
4883
|
}
|
|
4884
4884
|
class ss {
|
|
4885
|
-
constructor(
|
|
4885
|
+
constructor(s) {
|
|
4886
4886
|
/** 画布 */
|
|
4887
4887
|
f(this, "canvas");
|
|
4888
4888
|
f(this, "axis_canvas", document.createElement("canvas"));
|
|
@@ -4898,29 +4898,29 @@ class ss {
|
|
|
4898
4898
|
axis: !0,
|
|
4899
4899
|
axisText: !0
|
|
4900
4900
|
});
|
|
4901
|
-
this.canvas =
|
|
4901
|
+
this.canvas = s, this.initAxisCanvas();
|
|
4902
4902
|
}
|
|
4903
4903
|
initAxisCanvas() {
|
|
4904
|
-
const { canvas:
|
|
4905
|
-
|
|
4904
|
+
const { canvas: s, axis_canvas: t } = this;
|
|
4905
|
+
s && (t.width = s.rect.width || 0, t.height = s.rect.height || 0);
|
|
4906
4906
|
}
|
|
4907
4907
|
/** 开关坐标轴 */
|
|
4908
|
-
toggleAxis(
|
|
4908
|
+
toggleAxis(s) {
|
|
4909
4909
|
const t = (() => {
|
|
4910
|
-
if (typeof
|
|
4910
|
+
if (typeof s == "object") {
|
|
4911
4911
|
const {
|
|
4912
4912
|
all: e = !0,
|
|
4913
4913
|
grid: i = { main: !0, secondary: !0 },
|
|
4914
|
-
axis:
|
|
4914
|
+
axis: n = !0,
|
|
4915
4915
|
axisText: o = !0
|
|
4916
|
-
} =
|
|
4917
|
-
return Object.assign({ main: !0, secondary: !0 }, i), { all: e, grid: i, axis:
|
|
4916
|
+
} = s;
|
|
4917
|
+
return Object.assign({ main: !0, secondary: !0 }, i), { all: e, grid: i, axis: n, axisText: o };
|
|
4918
4918
|
}
|
|
4919
|
-
return typeof
|
|
4919
|
+
return typeof s == "boolean" ? {
|
|
4920
4920
|
all: !0,
|
|
4921
|
-
grid: { main:
|
|
4922
|
-
axis:
|
|
4923
|
-
axisText:
|
|
4921
|
+
grid: { main: s, secondary: s },
|
|
4922
|
+
axis: s,
|
|
4923
|
+
axisText: s
|
|
4924
4924
|
} : !this.show.all;
|
|
4925
4925
|
})();
|
|
4926
4926
|
typeof t == "boolean" ? this.show.all = t : this.show = t, this.isReload = !0;
|
|
@@ -4930,12 +4930,12 @@ class ss {
|
|
|
4930
4930
|
return (this.canvas.isRecalculate || this.isReload || this.canvas.isThemeUpdated) && (this.isReload = !1, this.initAxisCanvas(), (this.show.grid.main || this.show.grid.secondary) && this.drawGrid(), this.show.axis && this.drawAxis(), this.show.axisText && this.drawAxisText()), this.axis_canvas;
|
|
4931
4931
|
}
|
|
4932
4932
|
color() {
|
|
4933
|
-
const { theme:
|
|
4934
|
-
return (t[
|
|
4933
|
+
const { theme: s, style: t } = this.canvas;
|
|
4934
|
+
return (t[s] || t.light).grid;
|
|
4935
4935
|
}
|
|
4936
4936
|
/** 绘制网格 */
|
|
4937
4937
|
drawGrid() {
|
|
4938
|
-
const { canvas:
|
|
4938
|
+
const { canvas: s, ctx: t } = this, { rect: e, center: i, axisConfig: n } = s, { width: o, height: a } = e, l = this.color(), c = n.size, h = c / 5;
|
|
4939
4939
|
t.lineWidth = 1;
|
|
4940
4940
|
const u = (m, g) => {
|
|
4941
4941
|
const p = i.x % m > 0 ? i.x % m : m + i.x % m;
|
|
@@ -4954,12 +4954,12 @@ class ss {
|
|
|
4954
4954
|
}
|
|
4955
4955
|
/** 坐标轴 */
|
|
4956
4956
|
drawAxis() {
|
|
4957
|
-
const { canvas:
|
|
4957
|
+
const { canvas: s, ctx: t } = this, { rect: e, center: i } = s, { width: n, height: o } = e, a = this.color();
|
|
4958
4958
|
t.lineWidth = 2, t.strokeStyle = a.axis;
|
|
4959
4959
|
const l = () => {
|
|
4960
|
-
i.y >= 0 && i.y <= o && (t.beginPath(), t.moveTo(0, i.y), t.lineTo(
|
|
4960
|
+
i.y >= 0 && i.y <= o && (t.beginPath(), t.moveTo(0, i.y), t.lineTo(n, i.y), t.stroke());
|
|
4961
4961
|
}, c = () => {
|
|
4962
|
-
i.x >= 0 && i.x <=
|
|
4962
|
+
i.x >= 0 && i.x <= n && (t.beginPath(), t.moveTo(i.x, 0), t.lineTo(i.x, o), t.stroke());
|
|
4963
4963
|
};
|
|
4964
4964
|
l(), c();
|
|
4965
4965
|
}
|
|
@@ -4974,41 +4974,41 @@ class ss {
|
|
|
4974
4974
|
* @param y 文本绘制的纵坐标
|
|
4975
4975
|
* @param secondary 是否为次要颜色
|
|
4976
4976
|
*/
|
|
4977
|
-
drawText(
|
|
4978
|
-
const { canvas:
|
|
4979
|
-
o.font = `${l.bold ? "bold" : ""} ${l.size}px ${l.family}`, o.strokeStyle = l.stroke, ![
|
|
4977
|
+
drawText(s, t, e, i) {
|
|
4978
|
+
const { canvas: n, ctx: o } = this, { theme: a } = n, l = this.canvas.style[a].text;
|
|
4979
|
+
o.font = `${l.bold ? "bold" : ""} ${l.size}px ${l.family}`, o.strokeStyle = l.stroke, ![s, t, e].includes(void 0) && o.strokeText(s, t, e), o.fillStyle = l[i ? "secondary" : "color"], ![s, t, e].includes(void 0) && o.fillText(s, t, e);
|
|
4980
4980
|
}
|
|
4981
4981
|
/** 坐标轴 - 文字 */
|
|
4982
4982
|
drawAxisText() {
|
|
4983
|
-
const { canvas:
|
|
4983
|
+
const { canvas: s, ctx: t } = this, { rect: e, center: i, axisConfig: n, style: o, theme: a } = s, { width: l, height: c } = e;
|
|
4984
4984
|
this.drawText();
|
|
4985
4985
|
const h = (p) => Math.ceil(t.measureText(p).width), u = 4, d = o[a].text.size;
|
|
4986
4986
|
{
|
|
4987
|
-
const p = h("0"), v = i.x < u || i.x > l + p + u,
|
|
4988
|
-
!v && !
|
|
4987
|
+
const p = h("0"), v = i.x < u || i.x > l + p + u, w = i.y < -(u + d) || i.y > c + d + u;
|
|
4988
|
+
!v && !w && this.drawText(
|
|
4989
4989
|
"0",
|
|
4990
4990
|
i.x - p - u,
|
|
4991
4991
|
i.y + d + u
|
|
4992
4992
|
);
|
|
4993
4993
|
}
|
|
4994
|
-
const m =
|
|
4994
|
+
const m = s.getNowGridCount, g = n.size;
|
|
4995
4995
|
{
|
|
4996
4996
|
let p = i.y + d + u;
|
|
4997
4997
|
p = Math.max(Math.min(p, c - u), u + d);
|
|
4998
4998
|
const v = i.y > c || i.y < 0;
|
|
4999
|
-
let
|
|
5000
|
-
for (;
|
|
5001
|
-
const
|
|
5002
|
-
|
|
4999
|
+
let w = i.x > 0 ? i.x % g : i.x < 0 ? g + i.x % g : 0, C = s.getAxisValueByPoint((w - i.x) * n.x, 0).xV;
|
|
5000
|
+
for (; w <= l; ) {
|
|
5001
|
+
const _ = we(C), E = h(_);
|
|
5002
|
+
C !== 0 && this.drawText(_, w - E / 2, p, v), w += g, C = new V(m).mul(n.x).add(C).toNumber();
|
|
5003
5003
|
}
|
|
5004
5004
|
}
|
|
5005
5005
|
{
|
|
5006
5006
|
const p = i.x > l || i.x < 0;
|
|
5007
|
-
let v = i.y > 0 ? i.y % g : i.y < 0 ? g + i.y % g : 0,
|
|
5007
|
+
let v = i.y > 0 ? i.y % g : i.y < 0 ? g + i.y % g : 0, w = s.getAxisValueByPoint(0, (v - i.y) * n.y).yV;
|
|
5008
5008
|
for (; v <= c; ) {
|
|
5009
|
-
const
|
|
5010
|
-
let E = i.x -
|
|
5011
|
-
E = Math.max(Math.min(E, l -
|
|
5009
|
+
const C = we(w), _ = h(C);
|
|
5010
|
+
let E = i.x - _ - u;
|
|
5011
|
+
E = Math.max(Math.min(E, l - _ - u), u), w != 0 && this.drawText(C, E, v + d / 2, p), v += g, w = new V(m).mul(n.y).add(w).toNumber();
|
|
5012
5012
|
}
|
|
5013
5013
|
}
|
|
5014
5014
|
}
|
|
@@ -5017,75 +5017,75 @@ function Nt(r) {
|
|
|
5017
5017
|
return [r].flat(1 / 0);
|
|
5018
5018
|
}
|
|
5019
5019
|
class $ extends is {
|
|
5020
|
-
constructor(
|
|
5021
|
-
super(
|
|
5020
|
+
constructor(s) {
|
|
5021
|
+
super(s), this.drawAxis = new ss(this), "axisShow" in s && this.toggleAxis(s.axisShow), this.initLayerGroups(), this.updateCenter();
|
|
5022
5022
|
}
|
|
5023
5023
|
initLayerGroups() {
|
|
5024
|
-
const
|
|
5025
|
-
|
|
5024
|
+
const s = new it({ name: "多边形图层" });
|
|
5025
|
+
s.addGroup(new et({ name: "多边形覆盖物群组" })), s.setzIndex(1);
|
|
5026
5026
|
const t = new it({ name: "线段图层" });
|
|
5027
5027
|
t.addGroup(new et({ name: "线段覆盖物群组" })), t.setzIndex(2);
|
|
5028
5028
|
const e = new it({ name: "点位图层" });
|
|
5029
5029
|
e.addGroup(new et({ name: "点位覆盖物群组" })), e.setzIndex(3);
|
|
5030
5030
|
const i = new it({ name: "文字图层" });
|
|
5031
5031
|
i.addGroup(new et({ name: "文字覆盖物群组" })), i.setzIndex(4);
|
|
5032
|
-
const
|
|
5033
|
-
|
|
5032
|
+
const n = new it({ name: "自定义绘制图层" });
|
|
5033
|
+
n.addGroup(new et({ name: "自定义绘制覆盖物群组" })), n.setzIndex(5);
|
|
5034
5034
|
const o = new Rt({ name: "默认图层群组" });
|
|
5035
5035
|
o.addLayer([
|
|
5036
5036
|
i,
|
|
5037
5037
|
e,
|
|
5038
5038
|
t,
|
|
5039
|
-
|
|
5040
|
-
|
|
5039
|
+
s,
|
|
5040
|
+
n
|
|
5041
5041
|
]), this.setLayerGroup(o);
|
|
5042
5042
|
}
|
|
5043
5043
|
/** 获取图层群组 集合 */
|
|
5044
|
-
gteLayerGroups(
|
|
5045
|
-
return this.layerGroups.get(
|
|
5044
|
+
gteLayerGroups(s = "默认图层群组") {
|
|
5045
|
+
return this.layerGroups.get(s);
|
|
5046
5046
|
}
|
|
5047
5047
|
/** 设置图层群组 */
|
|
5048
|
-
setLayerGroup(
|
|
5049
|
-
|
|
5048
|
+
setLayerGroup(s) {
|
|
5049
|
+
s instanceof Rt && (this.layerGroups.set(s.name, s), s.setNotifyReload(() => this.redrawOnce()), s.setMainCanvas(this), s.parent = this);
|
|
5050
5050
|
}
|
|
5051
5051
|
/** 移除图层群组 */
|
|
5052
|
-
removeLayerGroup(
|
|
5053
|
-
|
|
5052
|
+
removeLayerGroup(s) {
|
|
5053
|
+
s instanceof Rt && (this.layerGroups.delete(s.name), s.setNotifyReload(), s.setMainCanvas(), s.parent = void 0, this.redrawOnce());
|
|
5054
5054
|
}
|
|
5055
5055
|
/** 添加图层 */
|
|
5056
|
-
addLayer(
|
|
5056
|
+
addLayer(s) {
|
|
5057
5057
|
const t = this.layerGroups.get("默认图层群组");
|
|
5058
|
-
t && t.addLayer(Nt(
|
|
5058
|
+
t && t.addLayer(Nt(s));
|
|
5059
5059
|
}
|
|
5060
5060
|
/** 移除图层 */
|
|
5061
|
-
removeLayer(
|
|
5061
|
+
removeLayer(s) {
|
|
5062
5062
|
const t = this.layerGroups.get("默认图层群组");
|
|
5063
|
-
t && t.removeLayer(Nt(
|
|
5063
|
+
t && t.removeLayer(Nt(s));
|
|
5064
5064
|
}
|
|
5065
5065
|
/** 添加覆盖物 */
|
|
5066
|
-
addOverlay(
|
|
5066
|
+
addOverlay(s) {
|
|
5067
5067
|
const {
|
|
5068
5068
|
overlays_text: t,
|
|
5069
5069
|
overlays_point: e,
|
|
5070
5070
|
overlays_line: i,
|
|
5071
|
-
overlays_polygon:
|
|
5071
|
+
overlays_polygon: n,
|
|
5072
5072
|
overlays_custom: o
|
|
5073
5073
|
} = this.getDefaultOverlayGroup() || {};
|
|
5074
|
-
Nt(
|
|
5075
|
-
a instanceof Tt ? t == null || t.addOverlays(a) : a instanceof lt ? e == null || e.addOverlays(a) : a instanceof Ft || a instanceof oe || a instanceof ae ? i == null || i.addOverlays(a) : a instanceof Bt ?
|
|
5074
|
+
Nt(s).forEach((a) => {
|
|
5075
|
+
a instanceof Tt ? t == null || t.addOverlays(a) : a instanceof lt ? e == null || e.addOverlays(a) : a instanceof Ft || a instanceof oe || a instanceof ae ? i == null || i.addOverlays(a) : a instanceof Bt ? n == null || n.addOverlays(a) : a instanceof Lt && (o == null || o.addOverlays(a));
|
|
5076
5076
|
});
|
|
5077
5077
|
}
|
|
5078
5078
|
/** 移除覆盖物 */
|
|
5079
|
-
removeOverlay(
|
|
5079
|
+
removeOverlay(s) {
|
|
5080
5080
|
const {
|
|
5081
5081
|
overlays_text: t,
|
|
5082
5082
|
overlays_point: e,
|
|
5083
5083
|
overlays_line: i,
|
|
5084
|
-
overlays_polygon:
|
|
5084
|
+
overlays_polygon: n,
|
|
5085
5085
|
overlays_custom: o
|
|
5086
5086
|
} = this.getDefaultOverlayGroup() || {};
|
|
5087
|
-
Nt(
|
|
5088
|
-
a instanceof Tt ? t == null || t.removeOverlays(a) : a instanceof lt ? e == null || e.removeOverlays(a) : a instanceof Ft ? i == null || i.removeOverlays(a) : a instanceof Bt ?
|
|
5087
|
+
Nt(s).forEach((a) => {
|
|
5088
|
+
a instanceof Tt ? t == null || t.removeOverlays(a) : a instanceof lt ? e == null || e.removeOverlays(a) : a instanceof Ft ? i == null || i.removeOverlays(a) : a instanceof Bt ? n == null || n.removeOverlays(a) : a instanceof Lt && (o == null || o.addOverlays(a));
|
|
5089
5089
|
});
|
|
5090
5090
|
}
|
|
5091
5091
|
/** 销毁 */
|
|
@@ -5107,115 +5107,115 @@ f($, "ArcTo", ae);
|
|
|
5107
5107
|
function Ds(r) {
|
|
5108
5108
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
5109
5109
|
}
|
|
5110
|
-
function Rs(r,
|
|
5111
|
-
return !Number.isFinite(r) || !Number.isFinite(
|
|
5110
|
+
function Rs(r, s, t = 2) {
|
|
5111
|
+
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) + "%";
|
|
5112
5112
|
}
|
|
5113
5113
|
function we(r) {
|
|
5114
5114
|
const t = r.toString().split("."), e = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
5115
5115
|
return t.length > 1 ? e + "." + t[1] : e;
|
|
5116
5116
|
}
|
|
5117
|
-
function Vs(r,
|
|
5117
|
+
function Vs(r, s) {
|
|
5118
5118
|
const t = {
|
|
5119
5119
|
join: !0,
|
|
5120
5120
|
suffix: "",
|
|
5121
5121
|
decimalPlaces: 2
|
|
5122
|
-
}, { join: e, suffix: i, decimalPlaces:
|
|
5122
|
+
}, { join: e, suffix: i, decimalPlaces: n } = {
|
|
5123
5123
|
...t,
|
|
5124
|
-
...
|
|
5124
|
+
...s || {}
|
|
5125
5125
|
}, o = Number(r);
|
|
5126
5126
|
if (isNaN(o)) return e ? `0${i}` : [0, i];
|
|
5127
|
-
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, d = (l ? 1 : -1) * parseFloat(u.toFixed(Math.max(0,
|
|
5127
|
+
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, d = (l ? 1 : -1) * parseFloat(u.toFixed(Math.max(0, n)));
|
|
5128
5128
|
return e ? `${d}${me[c]}${i}` : [d, me[c] + i];
|
|
5129
5129
|
}
|
|
5130
5130
|
function ks(r) {
|
|
5131
|
-
const
|
|
5131
|
+
const s = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
5132
5132
|
let t = 0;
|
|
5133
5133
|
for (; r > 1024; )
|
|
5134
5134
|
r /= 1024, t++;
|
|
5135
|
-
return `${Math.round(r * 100) / 100} ${
|
|
5135
|
+
return `${Math.round(r * 100) / 100} ${s[t]}`;
|
|
5136
5136
|
}
|
|
5137
|
-
function Os(r,
|
|
5137
|
+
function Os(r, s = "YYYY-MM-DD hh:mm:ss", t = !0) {
|
|
5138
5138
|
const e = new Date(r);
|
|
5139
5139
|
if (isNaN(e.getTime()))
|
|
5140
5140
|
return console.error("Invalid date"), "";
|
|
5141
5141
|
const i = {
|
|
5142
|
-
YYYY: (
|
|
5143
|
-
MM: (
|
|
5142
|
+
YYYY: (n) => n.getFullYear(),
|
|
5143
|
+
MM: (n) => n.getMonth() + 1,
|
|
5144
5144
|
// Adjust for 0-based month
|
|
5145
|
-
DD: (
|
|
5146
|
-
hh: (
|
|
5147
|
-
mm: (
|
|
5148
|
-
ss: (
|
|
5149
|
-
ms: (
|
|
5145
|
+
DD: (n) => n.getDate(),
|
|
5146
|
+
hh: (n) => n.getHours(),
|
|
5147
|
+
mm: (n) => n.getMinutes(),
|
|
5148
|
+
ss: (n) => n.getSeconds(),
|
|
5149
|
+
ms: (n) => n.getMilliseconds()
|
|
5150
5150
|
};
|
|
5151
|
-
return
|
|
5152
|
-
const o = i[
|
|
5151
|
+
return s.replace(/YYYY|MM|DD|hh|mm|ss|ms/g, (n) => {
|
|
5152
|
+
const o = i[n](e);
|
|
5153
5153
|
return t ? String(o).padStart(2, "0") : String(o);
|
|
5154
5154
|
});
|
|
5155
5155
|
}
|
|
5156
|
-
function le(r,
|
|
5157
|
-
if (!r || (r = String(r).trim(), r === "")) return
|
|
5156
|
+
function le(r, s = "file") {
|
|
5157
|
+
if (!r || (r = String(r).trim(), r === "")) return s;
|
|
5158
5158
|
const t = r.split("/");
|
|
5159
5159
|
return t[t.length - 1].split("?")[0];
|
|
5160
5160
|
}
|
|
5161
|
-
function Ms(r,
|
|
5162
|
-
return r = r.replace(/([^a-zA-Z][a-z])/g, (t) => t.toUpperCase()),
|
|
5161
|
+
function Ms(r, s) {
|
|
5162
|
+
return r = r.replace(/([^a-zA-Z][a-z])/g, (t) => t.toUpperCase()), s ? r.replace(/[^a-zA-Z]+/g, "") : r;
|
|
5163
5163
|
}
|
|
5164
|
-
function As(r,
|
|
5164
|
+
function As(r, s, t = ",") {
|
|
5165
5165
|
const e = new RegExp(
|
|
5166
|
-
`(^|${t})${
|
|
5166
|
+
`(^|${t})${s}(${t}|$)`,
|
|
5167
5167
|
"g"
|
|
5168
5168
|
);
|
|
5169
|
-
return r.replace(e, function(i,
|
|
5170
|
-
return
|
|
5169
|
+
return r.replace(e, function(i, n, o) {
|
|
5170
|
+
return n === o ? t : "";
|
|
5171
5171
|
});
|
|
5172
5172
|
}
|
|
5173
|
-
function ue(r,
|
|
5174
|
-
if (Array.isArray(r) && r.length >=
|
|
5173
|
+
function ue(r, s = 2) {
|
|
5174
|
+
if (Array.isArray(r) && r.length >= s) {
|
|
5175
5175
|
for (let e = 0; e < r.length; e++)
|
|
5176
5176
|
if (typeof r[e] != "number" || !Number.isFinite(r[e])) return !1;
|
|
5177
5177
|
} else return !1;
|
|
5178
5178
|
return !0;
|
|
5179
5179
|
}
|
|
5180
|
-
function zt(r,
|
|
5181
|
-
if (Array.isArray(r) && r.length >=
|
|
5180
|
+
function zt(r, s = 1, t = 2) {
|
|
5181
|
+
if (Array.isArray(r) && r.length >= s) {
|
|
5182
5182
|
for (let i = 0; i < r.length; i++)
|
|
5183
5183
|
if (!ue(r[i], t)) return !1;
|
|
5184
5184
|
} else return !1;
|
|
5185
5185
|
return !0;
|
|
5186
5186
|
}
|
|
5187
|
-
function Ns(r,
|
|
5188
|
-
return Math.abs(r -
|
|
5187
|
+
function Ns(r, s, t) {
|
|
5188
|
+
return Math.abs(r - s) <= t;
|
|
5189
5189
|
}
|
|
5190
|
-
function Is(r,
|
|
5190
|
+
function Is(r, s) {
|
|
5191
5191
|
let t = !1;
|
|
5192
|
-
const { x: e, y: i } = r,
|
|
5193
|
-
for (let o = 0, a =
|
|
5194
|
-
const l =
|
|
5192
|
+
const { x: e, y: i } = r, n = s.length;
|
|
5193
|
+
for (let o = 0, a = n - 1; o < n; a = o++) {
|
|
5194
|
+
const l = s[o].x, c = s[o].y, h = s[a].x, u = s[a].y;
|
|
5195
5195
|
c > i != u > i && e < (h - l) * (i - c) / (u - c) + l && (t = !t);
|
|
5196
5196
|
}
|
|
5197
5197
|
return t;
|
|
5198
5198
|
}
|
|
5199
|
-
function Hs(r,
|
|
5200
|
-
const i = Math.min(r[0],
|
|
5199
|
+
function Hs(r, s, t, e) {
|
|
5200
|
+
const i = Math.min(r[0], s[0]), n = Math.max(r[0], s[0]), o = Math.min(r[1], s[1]), a = Math.max(r[1], s[1]), l = [
|
|
5201
5201
|
[i, o],
|
|
5202
5202
|
// 左上
|
|
5203
|
-
[
|
|
5203
|
+
[n, o],
|
|
5204
5204
|
// 右上
|
|
5205
|
-
[
|
|
5205
|
+
[n, a],
|
|
5206
5206
|
// 右下
|
|
5207
5207
|
[i, a]
|
|
5208
5208
|
// 左下
|
|
5209
5209
|
], c = e[1] - t[1], h = t[0] - e[0], u = e[0] * t[1] - t[0] * e[1];
|
|
5210
5210
|
if (c === 0 && h === 0) {
|
|
5211
5211
|
const [p, v] = t;
|
|
5212
|
-
return p >= i && p <=
|
|
5212
|
+
return p >= i && p <= n && v >= o && v <= a;
|
|
5213
5213
|
}
|
|
5214
5214
|
const d = 1e-10;
|
|
5215
5215
|
let m = !1, g = !1;
|
|
5216
5216
|
for (const [p, v] of l) {
|
|
5217
|
-
const
|
|
5218
|
-
if (Math.abs(
|
|
5217
|
+
const w = c * p + h * v + u;
|
|
5218
|
+
if (Math.abs(w) < d || (w > d ? m = !0 : g = !0, m && g))
|
|
5219
5219
|
return !0;
|
|
5220
5220
|
}
|
|
5221
5221
|
return m && g;
|
|
@@ -5248,29 +5248,29 @@ function Ls(r) {
|
|
|
5248
5248
|
].some((t) => r.startsWith(t));
|
|
5249
5249
|
}
|
|
5250
5250
|
function Ts(r) {
|
|
5251
|
-
return new Promise((
|
|
5251
|
+
return new Promise((s, t) => {
|
|
5252
5252
|
if (typeof r != "string" || r.trim() === "" || !r.includes("://")) {
|
|
5253
5253
|
t(new Error("Invalid URL: Must be a non-empty string"));
|
|
5254
5254
|
return;
|
|
5255
5255
|
}
|
|
5256
5256
|
try {
|
|
5257
5257
|
new XMLHttpRequest().open("HEAD", r, !0);
|
|
5258
|
-
} catch (
|
|
5259
|
-
t(new Error(`Invalid URL format: ${
|
|
5258
|
+
} catch (n) {
|
|
5259
|
+
t(new Error(`Invalid URL format: ${n.message}`));
|
|
5260
5260
|
return;
|
|
5261
5261
|
}
|
|
5262
5262
|
const e = new XMLHttpRequest();
|
|
5263
5263
|
e.open("HEAD", r, !0);
|
|
5264
|
-
const i = (
|
|
5265
|
-
t(new Error(`Request failed: ${
|
|
5264
|
+
const i = (n) => {
|
|
5265
|
+
t(new Error(`Request failed: ${n.type}`));
|
|
5266
5266
|
};
|
|
5267
5267
|
e.onreadystatechange = function() {
|
|
5268
|
-
e.readyState === XMLHttpRequest.DONE && (e.status === 0 ? t(new Error("Network error or CORS blocked")) : e.status >= 200 && e.status < 300 ?
|
|
5268
|
+
e.readyState === XMLHttpRequest.DONE && (e.status === 0 ? t(new Error("Network error or CORS blocked")) : e.status >= 200 && e.status < 300 ? s(!0) : t(new Error(`HTTP Error: ${e.status}`)));
|
|
5269
5269
|
}, e.onerror = i, e.onabort = i, e.ontimeout = i;
|
|
5270
5270
|
try {
|
|
5271
5271
|
e.send();
|
|
5272
|
-
} catch (
|
|
5273
|
-
t(new Error(`Request send failed: ${
|
|
5272
|
+
} catch (n) {
|
|
5273
|
+
t(new Error(`Request send failed: ${n.message}`));
|
|
5274
5274
|
}
|
|
5275
5275
|
});
|
|
5276
5276
|
}
|
|
@@ -5279,10 +5279,10 @@ const tt = class tt {
|
|
|
5279
5279
|
if (new.target === tt)
|
|
5280
5280
|
throw new Error("请直接使用静态方法,而不是实例化此类");
|
|
5281
5281
|
}
|
|
5282
|
-
static check(
|
|
5283
|
-
if (!
|
|
5282
|
+
static check(s, t) {
|
|
5283
|
+
if (!s || typeof s != "string")
|
|
5284
5284
|
return console.error("Invalid URL provided"), t ? !1 : "unknown";
|
|
5285
|
-
const e = le(
|
|
5285
|
+
const e = le(s).toLowerCase();
|
|
5286
5286
|
if (t) {
|
|
5287
5287
|
if (!Qt.hasOwnProperty(t))
|
|
5288
5288
|
return console.error(`Unknown file type: ${t}`), "unknown";
|
|
@@ -5299,8 +5299,8 @@ const tt = class tt {
|
|
|
5299
5299
|
* @param {string} url - 以逗号分隔的URL字符串,每个URL代表一个资源的位置
|
|
5300
5300
|
* @returns {Array} - 包含每个URL及其相关信息(名称和类型)的对象数组
|
|
5301
5301
|
*/
|
|
5302
|
-
static parseAddresses(
|
|
5303
|
-
return !
|
|
5302
|
+
static parseAddresses(s) {
|
|
5303
|
+
return !s || typeof s != "string" ? (console.error("Invalid URL provided"), []) : s.split(",").map((t) => {
|
|
5304
5304
|
const e = le(t), i = this.check(t);
|
|
5305
5305
|
return { url: t, name: e, type: i };
|
|
5306
5306
|
});
|
|
@@ -5311,13 +5311,13 @@ const tt = class tt {
|
|
|
5311
5311
|
* @param {string} [accept] - 可接受的 MIME 类型模式(如 "image/*, text/plain")
|
|
5312
5312
|
* @returns {boolean} - 如果类型匹配,则返回 true,否则返回 false
|
|
5313
5313
|
*/
|
|
5314
|
-
static matchesMimeType(
|
|
5314
|
+
static matchesMimeType(s, t) {
|
|
5315
5315
|
if (!t) return !0;
|
|
5316
|
-
if (typeof
|
|
5317
|
-
const e = tt._normalizeType(
|
|
5316
|
+
if (typeof s != "string" || typeof t != "string") return !1;
|
|
5317
|
+
const e = tt._normalizeType(s), i = t.split(",").map((a) => tt._normalizeType(a.trim())), [n, o = "*"] = e.split("/");
|
|
5318
5318
|
return i.some((a) => {
|
|
5319
5319
|
const [l, c = "*"] = a.split("/");
|
|
5320
|
-
return (l === "*" ||
|
|
5320
|
+
return (l === "*" || n === "*" || l === n) && (c === "*" || o === "*" || c === o);
|
|
5321
5321
|
});
|
|
5322
5322
|
}
|
|
5323
5323
|
/**
|
|
@@ -5328,8 +5328,8 @@ const tt = class tt {
|
|
|
5328
5328
|
* @param {string} type - 文件类型或MIME类型字符串
|
|
5329
5329
|
* @returns {string} 标准化的MIME类型字符串,如果无法识别则返回原始输入
|
|
5330
5330
|
*/
|
|
5331
|
-
static _normalizeType(
|
|
5332
|
-
return
|
|
5331
|
+
static _normalizeType(s) {
|
|
5332
|
+
return s.startsWith(".") && !s.includes("/") ? Ye[s.toLowerCase()] || s : s.includes("/") ? s : `${s}/*`;
|
|
5333
5333
|
}
|
|
5334
5334
|
/**
|
|
5335
5335
|
* 检查URL是否具有任何指定的文件扩展名
|
|
@@ -5337,17 +5337,17 @@ const tt = class tt {
|
|
|
5337
5337
|
* @param {string[]} validExtensions - 有效文件扩展名的数组
|
|
5338
5338
|
* @returns {boolean} - 如果URL具有任何指定的文件扩展名,则返回true,否则返回false
|
|
5339
5339
|
*/
|
|
5340
|
-
static _checkExtension(
|
|
5341
|
-
return t.some((e) =>
|
|
5340
|
+
static _checkExtension(s, t) {
|
|
5341
|
+
return t.some((e) => s.endsWith(e));
|
|
5342
5342
|
}
|
|
5343
5343
|
/**
|
|
5344
5344
|
* 检测文件URL的类型
|
|
5345
5345
|
* @param {string} url - 文件的URL
|
|
5346
5346
|
* @returns {string} - 如果URL与任何已知类型匹配,则返回文件类型,否则返回"unknown"
|
|
5347
5347
|
*/
|
|
5348
|
-
static _detectFileType(
|
|
5348
|
+
static _detectFileType(s) {
|
|
5349
5349
|
for (const [t, e] of tt.cachedEntries)
|
|
5350
|
-
if (e.some((i) =>
|
|
5350
|
+
if (e.some((i) => s.endsWith(i)))
|
|
5351
5351
|
return t;
|
|
5352
5352
|
return "unknown";
|
|
5353
5353
|
}
|
|
@@ -5362,35 +5362,35 @@ function Te(r) {
|
|
|
5362
5362
|
function Fs(r) {
|
|
5363
5363
|
if (typeof r != "function")
|
|
5364
5364
|
return console.error("非函数:", r);
|
|
5365
|
-
const
|
|
5366
|
-
t.didTimeout || t.timeRemaining() <= 0 ? requestIdleCallback(
|
|
5365
|
+
const s = function(t) {
|
|
5366
|
+
t.didTimeout || t.timeRemaining() <= 0 ? requestIdleCallback(s) : r();
|
|
5367
5367
|
};
|
|
5368
|
-
requestIdleCallback(
|
|
5368
|
+
requestIdleCallback(s);
|
|
5369
5369
|
}
|
|
5370
|
-
function Bs(r,
|
|
5370
|
+
function Bs(r, s) {
|
|
5371
5371
|
const t = +/* @__PURE__ */ new Date();
|
|
5372
5372
|
return new Promise((e, i) => {
|
|
5373
|
-
const
|
|
5374
|
-
if (+/* @__PURE__ */ new Date() - t >=
|
|
5373
|
+
const n = () => {
|
|
5374
|
+
if (+/* @__PURE__ */ new Date() - t >= s) return i("超时");
|
|
5375
5375
|
if (r()) return e("完成");
|
|
5376
|
-
requestIdleCallback(
|
|
5376
|
+
requestIdleCallback(n);
|
|
5377
5377
|
};
|
|
5378
|
-
|
|
5378
|
+
n();
|
|
5379
5379
|
});
|
|
5380
5380
|
}
|
|
5381
|
-
function gt(r,
|
|
5381
|
+
function gt(r, s, t = [], e = +/* @__PURE__ */ new Date()) {
|
|
5382
5382
|
if (e < +/* @__PURE__ */ new Date() - 50) {
|
|
5383
5383
|
console.error("_MergeObjects 合并异常:疑似死循环");
|
|
5384
5384
|
return;
|
|
5385
5385
|
}
|
|
5386
|
-
const i = ce(r),
|
|
5387
|
-
if (i !=
|
|
5386
|
+
const i = ce(r), n = ce(s);
|
|
5387
|
+
if (i != n) return s;
|
|
5388
5388
|
if (i == "object" || i == "array") {
|
|
5389
|
-
if (t.some(([o, a]) => o == r && a ==
|
|
5390
|
-
if (t.push([r,
|
|
5391
|
-
for (const o in
|
|
5392
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
5393
|
-
const a =
|
|
5389
|
+
if (t.some(([o, a]) => o == r && a == s)) return r;
|
|
5390
|
+
if (t.push([r, s]), i == "object") {
|
|
5391
|
+
for (const o in s)
|
|
5392
|
+
if (Object.prototype.hasOwnProperty.call(s, o)) {
|
|
5393
|
+
const a = s[o], l = r[o], c = gt(
|
|
5394
5394
|
l,
|
|
5395
5395
|
a,
|
|
5396
5396
|
t,
|
|
@@ -5400,7 +5400,7 @@ function gt(r, n, t = [], e = +/* @__PURE__ */ new Date()) {
|
|
|
5400
5400
|
}
|
|
5401
5401
|
return r;
|
|
5402
5402
|
} else if (i == "array")
|
|
5403
|
-
return
|
|
5403
|
+
return s.forEach((o, a) => {
|
|
5404
5404
|
const l = o, c = r[a], h = gt(
|
|
5405
5405
|
c,
|
|
5406
5406
|
l,
|
|
@@ -5409,41 +5409,41 @@ function gt(r, n, t = [], e = +/* @__PURE__ */ new Date()) {
|
|
|
5409
5409
|
);
|
|
5410
5410
|
r[a] = h;
|
|
5411
5411
|
}), r;
|
|
5412
|
-
} else return
|
|
5412
|
+
} else return s;
|
|
5413
5413
|
}
|
|
5414
5414
|
function rs(r = "") {
|
|
5415
|
-
return r + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
|
|
5415
|
+
return r + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(s) {
|
|
5416
5416
|
const t = Math.random() * 16 | 0;
|
|
5417
|
-
return (
|
|
5417
|
+
return (s === "x" ? t : t & 3 | 8).toString(16);
|
|
5418
5418
|
});
|
|
5419
5419
|
}
|
|
5420
|
-
function Fe(r,
|
|
5420
|
+
function Fe(r, s) {
|
|
5421
5421
|
let t;
|
|
5422
5422
|
return function(...e) {
|
|
5423
5423
|
clearTimeout(t), t = setTimeout(() => {
|
|
5424
5424
|
r(...e), t = void 0;
|
|
5425
|
-
},
|
|
5425
|
+
}, s);
|
|
5426
5426
|
};
|
|
5427
5427
|
}
|
|
5428
|
-
function Us(r,
|
|
5428
|
+
function Us(r, s) {
|
|
5429
5429
|
let t = -1 / 0;
|
|
5430
5430
|
return function(...e) {
|
|
5431
5431
|
const i = performance.now();
|
|
5432
|
-
if (i - t >
|
|
5432
|
+
if (i - t > s) {
|
|
5433
5433
|
t = i;
|
|
5434
5434
|
try {
|
|
5435
5435
|
r(...e);
|
|
5436
|
-
} catch (
|
|
5437
|
-
console.error("Throttled function execution failed:",
|
|
5436
|
+
} catch (n) {
|
|
5437
|
+
console.error("Throttled function execution failed:", n);
|
|
5438
5438
|
}
|
|
5439
5439
|
}
|
|
5440
5440
|
};
|
|
5441
5441
|
}
|
|
5442
|
-
function Xs(r,
|
|
5443
|
-
if (!r || !
|
|
5444
|
-
const t = Te(
|
|
5445
|
-
return t.length ? t.reduce((e, i,
|
|
5446
|
-
const o =
|
|
5442
|
+
function Xs(r, s) {
|
|
5443
|
+
if (!r || !s) return r;
|
|
5444
|
+
const t = Te(s);
|
|
5445
|
+
return t.length ? t.reduce((e, i, n) => {
|
|
5446
|
+
const o = n === t.length - 1;
|
|
5447
5447
|
if (Ie.test(i)) {
|
|
5448
5448
|
const a = i.match(He) || [];
|
|
5449
5449
|
return a.reduce((l, c, h) => {
|
|
@@ -5456,10 +5456,10 @@ function Xs(r, n) {
|
|
|
5456
5456
|
return o ? e[i] : e[i] || {};
|
|
5457
5457
|
}, r) : r;
|
|
5458
5458
|
}
|
|
5459
|
-
function Gs(r,
|
|
5460
|
-
if (!r || !
|
|
5461
|
-
const i = Te(
|
|
5462
|
-
return i.length ? i.reduce((
|
|
5459
|
+
function Gs(r, s, t, e) {
|
|
5460
|
+
if (!r || !s) return t;
|
|
5461
|
+
const i = Te(s);
|
|
5462
|
+
return i.length ? i.reduce((n, o, a) => {
|
|
5463
5463
|
const l = a === i.length - 1;
|
|
5464
5464
|
if (Ie.test(o)) {
|
|
5465
5465
|
const c = o.match(He) || [];
|
|
@@ -5469,48 +5469,48 @@ function Gs(r, n, t, e) {
|
|
|
5469
5469
|
return h.hasOwnProperty(u) || (h[u] = []), h[u];
|
|
5470
5470
|
const g = u.match(Le), p = g ? parseInt(g[1], 10) : 0, v = m && l;
|
|
5471
5471
|
return h.hasOwnProperty(p) ? v && !e && (h[p] = t) : h[p] = v ? t : m ? {} : [], h[p];
|
|
5472
|
-
},
|
|
5472
|
+
}, n);
|
|
5473
5473
|
}
|
|
5474
|
-
return l ? ((!e || !
|
|
5474
|
+
return l ? ((!e || !n.hasOwnProperty(o)) && (n[o] = t), n[o]) : (n.hasOwnProperty(o) || (n[o] = {}), n[o]);
|
|
5475
5475
|
}, r) : t;
|
|
5476
5476
|
}
|
|
5477
5477
|
function Ys(r) {
|
|
5478
|
-
return r.map((
|
|
5478
|
+
return r.map((s, t) => r.slice(t).concat(r.slice(0, t)));
|
|
5479
5479
|
}
|
|
5480
5480
|
function os(r) {
|
|
5481
|
-
const
|
|
5482
|
-
const
|
|
5483
|
-
if (
|
|
5484
|
-
return
|
|
5485
|
-
if (i.has(
|
|
5486
|
-
return i.get(
|
|
5487
|
-
switch (ce(
|
|
5481
|
+
const s = window.structuredClone, t = (e, i = /* @__PURE__ */ new WeakMap()) => {
|
|
5482
|
+
const n = e;
|
|
5483
|
+
if (n === null || typeof n != "object")
|
|
5484
|
+
return n;
|
|
5485
|
+
if (i.has(n))
|
|
5486
|
+
return i.get(n);
|
|
5487
|
+
switch (ce(n)) {
|
|
5488
5488
|
case "array": {
|
|
5489
5489
|
const a = [];
|
|
5490
|
-
i.set(
|
|
5491
|
-
for (const l of
|
|
5490
|
+
i.set(n, a);
|
|
5491
|
+
for (const l of n)
|
|
5492
5492
|
a.push(t(l, i));
|
|
5493
5493
|
return a;
|
|
5494
5494
|
}
|
|
5495
5495
|
case "object": {
|
|
5496
|
-
if (
|
|
5496
|
+
if (n === null) return n;
|
|
5497
5497
|
const a = {};
|
|
5498
|
-
i.set(
|
|
5499
|
-
for (const l in
|
|
5500
|
-
Object.prototype.hasOwnProperty.call(
|
|
5498
|
+
i.set(n, a);
|
|
5499
|
+
for (const l in n)
|
|
5500
|
+
Object.prototype.hasOwnProperty.call(n, l) && (a[l] = t(n[l], i));
|
|
5501
5501
|
return a;
|
|
5502
5502
|
}
|
|
5503
5503
|
case "date": {
|
|
5504
|
-
const a = new Date(
|
|
5505
|
-
return i.set(
|
|
5504
|
+
const a = new Date(n.getTime());
|
|
5505
|
+
return i.set(n, a), a;
|
|
5506
5506
|
}
|
|
5507
5507
|
case "regexp": {
|
|
5508
|
-
const a =
|
|
5509
|
-
return l.lastIndex = a.lastIndex, i.set(
|
|
5508
|
+
const a = n, l = new RegExp(a.source, a.flags);
|
|
5509
|
+
return l.lastIndex = a.lastIndex, i.set(n, l), l;
|
|
5510
5510
|
}
|
|
5511
5511
|
case "map": {
|
|
5512
5512
|
const a = /* @__PURE__ */ new Map();
|
|
5513
|
-
return i.set(
|
|
5513
|
+
return i.set(n, a), n.forEach((l, c) => {
|
|
5514
5514
|
a.set(
|
|
5515
5515
|
t(c, i),
|
|
5516
5516
|
t(l, i)
|
|
@@ -5519,7 +5519,7 @@ function os(r) {
|
|
|
5519
5519
|
}
|
|
5520
5520
|
case "set": {
|
|
5521
5521
|
const a = /* @__PURE__ */ new Set();
|
|
5522
|
-
return i.set(
|
|
5522
|
+
return i.set(n, a), n.forEach((l) => {
|
|
5523
5523
|
a.add(t(l, i));
|
|
5524
5524
|
}), a;
|
|
5525
5525
|
}
|
|
@@ -5537,7 +5537,7 @@ function os(r) {
|
|
|
5537
5537
|
case "float64array":
|
|
5538
5538
|
case "bigint64array":
|
|
5539
5539
|
case "biguint64array": {
|
|
5540
|
-
const a =
|
|
5540
|
+
const a = n, l = a.constructor, c = a.buffer.slice(
|
|
5541
5541
|
a.byteOffset,
|
|
5542
5542
|
a.byteOffset + a.byteLength
|
|
5543
5543
|
), h = new l(
|
|
@@ -5545,12 +5545,12 @@ function os(r) {
|
|
|
5545
5545
|
a.byteOffset,
|
|
5546
5546
|
a.byteLength / a.BYTES_PER_ELEMENT
|
|
5547
5547
|
);
|
|
5548
|
-
return i.set(
|
|
5548
|
+
return i.set(n, h), h;
|
|
5549
5549
|
}
|
|
5550
5550
|
// 处理特殊对象类型
|
|
5551
5551
|
case "error": {
|
|
5552
|
-
const a =
|
|
5553
|
-
return l.stack = a.stack, l.name = a.name, i.set(
|
|
5552
|
+
const a = n, l = new a.constructor(a.message);
|
|
5553
|
+
return l.stack = a.stack, l.name = a.name, i.set(n, l), l;
|
|
5554
5554
|
}
|
|
5555
5555
|
// 处理不可克隆对象(直接返回原值)
|
|
5556
5556
|
case "function":
|
|
@@ -5559,22 +5559,22 @@ function os(r) {
|
|
|
5559
5559
|
case "weakset":
|
|
5560
5560
|
case "file":
|
|
5561
5561
|
default:
|
|
5562
|
-
return
|
|
5562
|
+
return n;
|
|
5563
5563
|
}
|
|
5564
5564
|
};
|
|
5565
5565
|
try {
|
|
5566
|
-
return
|
|
5566
|
+
return s ? s(r) : t(r);
|
|
5567
5567
|
} catch (e) {
|
|
5568
|
-
return console.error("structuredClone error:", e),
|
|
5568
|
+
return console.error("structuredClone error:", e), s && t(r);
|
|
5569
5569
|
}
|
|
5570
5570
|
}
|
|
5571
|
-
function as(r,
|
|
5571
|
+
function as(r, s, t = 30) {
|
|
5572
5572
|
if (typeof r != "function")
|
|
5573
5573
|
return console.error("第一个参数必须是一个函数。");
|
|
5574
|
-
if (!Array.isArray(
|
|
5574
|
+
if (!Array.isArray(s))
|
|
5575
5575
|
return console.error("第二个参数必须是一个数组。");
|
|
5576
5576
|
let e = [], i = 0;
|
|
5577
|
-
const
|
|
5577
|
+
const n = (o, a) => {
|
|
5578
5578
|
for (const [l, c] of a)
|
|
5579
5579
|
if (o >= l)
|
|
5580
5580
|
return c;
|
|
@@ -5583,7 +5583,7 @@ function as(r, n, t = 30) {
|
|
|
5583
5583
|
return function(...o) {
|
|
5584
5584
|
const a = performance.now(), l = r(...o), c = performance.now() - a;
|
|
5585
5585
|
e.push(c), e.length > t && e.shift(), i = e.reduce((d, m) => d + m, 0) / e.length || 0;
|
|
5586
|
-
const h =
|
|
5586
|
+
const h = n(c, s), u = n(i, s);
|
|
5587
5587
|
return console.log(
|
|
5588
5588
|
`%c单次耗时:${c.toFixed(2)}ms
|
|
5589
5589
|
%c平均耗时(${e.length}次):${i.toFixed(2)}ms`,
|
|
@@ -5593,9 +5593,9 @@ function as(r, n, t = 30) {
|
|
|
5593
5593
|
};
|
|
5594
5594
|
}
|
|
5595
5595
|
function zs(r) {
|
|
5596
|
-
const
|
|
5596
|
+
const s = Date.now();
|
|
5597
5597
|
let t = performance.now();
|
|
5598
|
-
for (; Date.now() -
|
|
5598
|
+
for (; Date.now() - s < r; ) {
|
|
5599
5599
|
t = Math.sin(t) * 1e6, (t > 1e6 || t < -1e6) && (t = 0);
|
|
5600
5600
|
try {
|
|
5601
5601
|
const e = t.toString().substring(0, 8);
|
|
@@ -5603,14 +5603,14 @@ function zs(r) {
|
|
|
5603
5603
|
} catch {
|
|
5604
5604
|
}
|
|
5605
5605
|
}
|
|
5606
|
-
return Date.now() -
|
|
5606
|
+
return Date.now() - s;
|
|
5607
5607
|
}
|
|
5608
5608
|
function Ws(r) {
|
|
5609
|
-
const
|
|
5609
|
+
const s = Fe(r, 100);
|
|
5610
5610
|
let t = 0, e = 0;
|
|
5611
5611
|
return function(i) {
|
|
5612
|
-
const
|
|
5613
|
-
if (!
|
|
5612
|
+
const n = i.target;
|
|
5613
|
+
if (!n || !(n instanceof Element)) return;
|
|
5614
5614
|
const {
|
|
5615
5615
|
scrollTop: o,
|
|
5616
5616
|
scrollHeight: a,
|
|
@@ -5618,24 +5618,24 @@ function Ws(r) {
|
|
|
5618
5618
|
scrollLeft: c,
|
|
5619
5619
|
scrollWidth: h,
|
|
5620
5620
|
clientWidth: u
|
|
5621
|
-
} =
|
|
5621
|
+
} = n;
|
|
5622
5622
|
function d() {
|
|
5623
5623
|
if (t == o) return;
|
|
5624
5624
|
const g = t > o;
|
|
5625
5625
|
if (t = o, g) return;
|
|
5626
|
-
a - o - l <= 1 &&
|
|
5626
|
+
a - o - l <= 1 && s("vertical");
|
|
5627
5627
|
}
|
|
5628
5628
|
function m() {
|
|
5629
5629
|
if (e == c) return;
|
|
5630
5630
|
const g = e > c;
|
|
5631
5631
|
if (e = c, g) return;
|
|
5632
|
-
h - c - u <= 1 &&
|
|
5632
|
+
h - c - u <= 1 && s("horizontal");
|
|
5633
5633
|
}
|
|
5634
5634
|
d(), m();
|
|
5635
5635
|
};
|
|
5636
5636
|
}
|
|
5637
|
-
function qs(r,
|
|
5638
|
-
const { isClickAllowed: e, uiLibrary: i = ["naiveUI", "ElementPlus", "Element"] } = t || {},
|
|
5637
|
+
function qs(r, s, t) {
|
|
5638
|
+
const { isClickAllowed: e, uiLibrary: i = ["naiveUI", "ElementPlus", "Element"] } = t || {}, n = function(l) {
|
|
5639
5639
|
const c = [];
|
|
5640
5640
|
for (const h in l)
|
|
5641
5641
|
Object.hasOwnProperty.call(l, h) && i.includes(h) && c.push(...l[h]);
|
|
@@ -5650,7 +5650,7 @@ function qs(r, n, t) {
|
|
|
5650
5650
|
Element: [".el-popper"]
|
|
5651
5651
|
});
|
|
5652
5652
|
function o() {
|
|
5653
|
-
|
|
5653
|
+
s(), document.removeEventListener("mousedown", a);
|
|
5654
5654
|
}
|
|
5655
5655
|
function a(l) {
|
|
5656
5656
|
if (e) {
|
|
@@ -5660,7 +5660,7 @@ function qs(r, n, t) {
|
|
|
5660
5660
|
}
|
|
5661
5661
|
const c = l.target;
|
|
5662
5662
|
if (!(c instanceof Element) || !c.isConnected) return;
|
|
5663
|
-
r.concat(
|
|
5663
|
+
r.concat(n).some((u) => !!(c != null && c.closest(u))) || o();
|
|
5664
5664
|
}
|
|
5665
5665
|
requestAnimationFrame(
|
|
5666
5666
|
() => document.addEventListener("mousedown", a)
|
|
@@ -5679,8 +5679,8 @@ class js {
|
|
|
5679
5679
|
N(this, st);
|
|
5680
5680
|
N(this, xt);
|
|
5681
5681
|
}
|
|
5682
|
-
init(
|
|
5683
|
-
D(this, Y,
|
|
5682
|
+
init(s, t) {
|
|
5683
|
+
D(this, Y, s), D(this, st, t == null ? void 0 : t.limit), D(this, xt, t == null ? void 0 : t.dragDom), D(this, ft, {
|
|
5684
5684
|
mousedown: this.mousedown.bind(this),
|
|
5685
5685
|
mousemove: this.mousemove.bind(this),
|
|
5686
5686
|
mouseup: this.mouseup.bind(this)
|
|
@@ -5689,28 +5689,28 @@ class js {
|
|
|
5689
5689
|
finish() {
|
|
5690
5690
|
this.bindOrUnbindEvent("unbind");
|
|
5691
5691
|
}
|
|
5692
|
-
bindOrUnbindEvent(
|
|
5693
|
-
const t =
|
|
5694
|
-
if (!
|
|
5695
|
-
|
|
5692
|
+
bindOrUnbindEvent(s) {
|
|
5693
|
+
const t = s === "bind" ? "addEventListener" : "removeEventListener";
|
|
5694
|
+
if (!P(this, Y)) return console.error("No DOM");
|
|
5695
|
+
P(this, Y)[t]("mousedown", P(this, ft).mousedown), document[t]("mousemove", P(this, ft).mousemove), document[t]("mouseup", P(this, ft).mouseup);
|
|
5696
5696
|
}
|
|
5697
5697
|
alterLocation() {
|
|
5698
|
-
if (!
|
|
5699
|
-
|
|
5698
|
+
if (!P(this, Y)) return console.error("No DOM");
|
|
5699
|
+
P(this, st) && (D(this, Z, Math.min(P(this, Z), P(this, st).max.top)), D(this, Z, Math.max(P(this, Z), P(this, st).min.top)), D(this, J, Math.min(P(this, J), P(this, st).max.left)), D(this, J, Math.max(P(this, J), P(this, st).min.left))), P(this, Y).style.setProperty("--top", P(this, Z) + "px"), P(this, Y).style.setProperty("--left", P(this, J) + "px");
|
|
5700
5700
|
}
|
|
5701
|
-
mousedown(
|
|
5702
|
-
if (!
|
|
5703
|
-
if (
|
|
5701
|
+
mousedown(s) {
|
|
5702
|
+
if (!P(this, Y)) return console.error("No DOM");
|
|
5703
|
+
if (P(this, xt) && s.target != P(this, xt)) return;
|
|
5704
5704
|
document.body.classList.add("no-select"), D(this, dt, !0);
|
|
5705
|
-
const t =
|
|
5705
|
+
const t = P(this, Y).getBoundingClientRect(), { pageX: e, pageY: i } = s;
|
|
5706
5706
|
D(this, wt, e), D(this, Pt, i), D(this, Z, t.y), D(this, J, t.x);
|
|
5707
5707
|
}
|
|
5708
|
-
mousemove(
|
|
5709
|
-
const { pageX: t, pageY: e } =
|
|
5710
|
-
|
|
5708
|
+
mousemove(s) {
|
|
5709
|
+
const { pageX: t, pageY: e } = s;
|
|
5710
|
+
P(this, dt) && (D(this, Z, P(this, Z) + (e - P(this, Pt))), D(this, J, P(this, J) + (t - P(this, wt))), D(this, wt, t), D(this, Pt, e), this.alterLocation());
|
|
5711
5711
|
}
|
|
5712
5712
|
mouseup() {
|
|
5713
|
-
|
|
5713
|
+
P(this, dt) && (D(this, dt, !1), document.body.classList.remove("no-select"));
|
|
5714
5714
|
}
|
|
5715
5715
|
}
|
|
5716
5716
|
Y = new WeakMap(), dt = new WeakMap(), ft = new WeakMap(), wt = new WeakMap(), Pt = new WeakMap(), Z = new WeakMap(), J = new WeakMap(), st = new WeakMap(), xt = new WeakMap();
|
|
@@ -5728,8 +5728,8 @@ class $s {
|
|
|
5728
5728
|
N(this, _t);
|
|
5729
5729
|
N(this, St);
|
|
5730
5730
|
}
|
|
5731
|
-
init(
|
|
5732
|
-
D(this, z,
|
|
5731
|
+
init(s, t = {}) {
|
|
5732
|
+
D(this, z, s), D(this, B, t.limit), D(this, _t, t.update_move), D(this, St, t.update_up), D(this, pt, {
|
|
5733
5733
|
mousedown: this.mousedown.bind(this),
|
|
5734
5734
|
mousemove: this.mousemove.bind(this),
|
|
5735
5735
|
mouseup: this.mouseup.bind(this)
|
|
@@ -5738,124 +5738,124 @@ class $s {
|
|
|
5738
5738
|
finish() {
|
|
5739
5739
|
this.bindOrUnbindEvent("unbind");
|
|
5740
5740
|
}
|
|
5741
|
-
bindOrUnbindEvent(
|
|
5742
|
-
const t =
|
|
5743
|
-
if (!
|
|
5744
|
-
|
|
5741
|
+
bindOrUnbindEvent(s) {
|
|
5742
|
+
const t = s === "bind" ? "addEventListener" : "removeEventListener";
|
|
5743
|
+
if (!P(this, z)) return console.error("No DOM");
|
|
5744
|
+
P(this, z)[t]("mousedown", P(this, pt).mousedown), document[t]("mousemove", P(this, pt).mousemove), document[t]("mouseup", P(this, pt).mouseup);
|
|
5745
5745
|
}
|
|
5746
5746
|
updateValue() {
|
|
5747
|
-
const
|
|
5748
|
-
top:
|
|
5749
|
-
left:
|
|
5747
|
+
const s = {
|
|
5748
|
+
top: P(this, W),
|
|
5749
|
+
left: P(this, q),
|
|
5750
5750
|
percentage: { top: 0, left: 0 }
|
|
5751
5751
|
};
|
|
5752
|
-
if (
|
|
5753
|
-
const t = (e) =>
|
|
5754
|
-
|
|
5752
|
+
if (P(this, B)) {
|
|
5753
|
+
const t = (e) => P(this, B) ? (s[e] - P(this, B).min[e]) / (P(this, B).max[e] - P(this, B).min[e]) : 0;
|
|
5754
|
+
s.percentage = {
|
|
5755
5755
|
top: t("top") || 0,
|
|
5756
5756
|
left: t("left") || 0
|
|
5757
5757
|
};
|
|
5758
5758
|
}
|
|
5759
|
-
return
|
|
5759
|
+
return s;
|
|
5760
5760
|
}
|
|
5761
5761
|
alterLocation() {
|
|
5762
|
-
if (!
|
|
5763
|
-
|
|
5762
|
+
if (!P(this, z)) return console.error("No DOM");
|
|
5763
|
+
P(this, B) && (D(this, W, Math.min(P(this, W), P(this, B).max.top)), D(this, W, Math.max(P(this, W), P(this, B).min.top)), D(this, q, Math.min(P(this, q), P(this, B).max.left)), D(this, q, Math.max(P(this, q), P(this, B).min.left))), P(this, _t) && P(this, _t).call(this, this.updateValue()), P(this, z).style.setProperty("--top", P(this, W) + "px"), P(this, z).style.setProperty("--left", P(this, q) + "px");
|
|
5764
5764
|
}
|
|
5765
|
-
mousedown(
|
|
5766
|
-
if (!
|
|
5765
|
+
mousedown(s) {
|
|
5766
|
+
if (!P(this, z)) return console.error("No DOM");
|
|
5767
5767
|
document.body.classList.add("no-select"), D(this, mt, !0);
|
|
5768
|
-
const t =
|
|
5768
|
+
const t = P(this, z).getBoundingClientRect();
|
|
5769
5769
|
D(this, Ct, t.y), D(this, bt, t.x);
|
|
5770
|
-
const { pageX: e, pageY: i } =
|
|
5771
|
-
D(this, W, i -
|
|
5770
|
+
const { pageX: e, pageY: i } = s;
|
|
5771
|
+
D(this, W, i - P(this, Ct)), D(this, q, e - P(this, bt)), this.alterLocation();
|
|
5772
5772
|
}
|
|
5773
|
-
mousemove(
|
|
5774
|
-
const { pageX: t, pageY: e } =
|
|
5775
|
-
|
|
5773
|
+
mousemove(s) {
|
|
5774
|
+
const { pageX: t, pageY: e } = s;
|
|
5775
|
+
P(this, mt) && (D(this, W, e - P(this, Ct)), D(this, q, t - P(this, bt)), this.alterLocation());
|
|
5776
5776
|
}
|
|
5777
5777
|
mouseup() {
|
|
5778
|
-
|
|
5778
|
+
P(this, mt) && (D(this, mt, !1), document.body.classList.remove("no-select"), P(this, St) && P(this, St).call(this, this.updateValue()));
|
|
5779
5779
|
}
|
|
5780
5780
|
}
|
|
5781
5781
|
z = new WeakMap(), mt = new WeakMap(), pt = new WeakMap(), bt = new WeakMap(), Ct = new WeakMap(), W = new WeakMap(), q = new WeakMap(), B = new WeakMap(), _t = new WeakMap(), St = new WeakMap();
|
|
5782
5782
|
function Jt(r) {
|
|
5783
5783
|
if (typeof r == "string") {
|
|
5784
|
-
const
|
|
5785
|
-
if (!
|
|
5786
|
-
return
|
|
5784
|
+
const s = document.querySelector(r);
|
|
5785
|
+
if (!s) throw new Error(`Element "${r}" not found`);
|
|
5786
|
+
return s;
|
|
5787
5787
|
} else
|
|
5788
5788
|
return r || document.documentElement;
|
|
5789
5789
|
}
|
|
5790
5790
|
function ls(r) {
|
|
5791
|
-
const
|
|
5792
|
-
return
|
|
5791
|
+
const s = Jt(r);
|
|
5792
|
+
return s.requestFullscreen ? s.requestFullscreen() : s.mozRequestFullScreen ? s.mozRequestFullScreen() : s.webkitRequestFullscreen ? s.webkitRequestFullscreen() : s.msRequestFullscreen ? s.msRequestFullscreen() : Promise.reject("No Fullscreen API");
|
|
5793
5793
|
}
|
|
5794
5794
|
function cs() {
|
|
5795
5795
|
const r = document;
|
|
5796
5796
|
return document.exitFullscreen ? document.exitFullscreen() : r.mozCancelFullScreen ? r.mozCancelFullScreen() : r.webkitExitFullscreen ? r.webkitExitFullscreen() : r.msExitFullscreen ? r.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
|
|
5797
5797
|
}
|
|
5798
5798
|
function Be(r) {
|
|
5799
|
-
const
|
|
5800
|
-
return
|
|
5799
|
+
const s = Jt(r), t = document, e = document.fullscreenElement || t.webkitFullscreenElement || t.mozFullScreenElement || t.msFullscreenElement;
|
|
5800
|
+
return s == e || !r && window.innerWidth == screen.width && window.innerHeight == screen.height;
|
|
5801
5801
|
}
|
|
5802
5802
|
function Zs(r) {
|
|
5803
5803
|
return r = Jt(r), function() {
|
|
5804
5804
|
Be(r) ? cs() : ls(r);
|
|
5805
5805
|
};
|
|
5806
5806
|
}
|
|
5807
|
-
function Js(r,
|
|
5808
|
-
const t = Jt(
|
|
5807
|
+
function Js(r, s) {
|
|
5808
|
+
const t = Jt(s), e = () => {
|
|
5809
5809
|
r(Be(t));
|
|
5810
5810
|
};
|
|
5811
5811
|
return document.addEventListener("fullscreenchange", e), document.addEventListener("webkitfullscreenchange", e), document.addEventListener("mozfullscreenchange", e), document.addEventListener("MSFullscreenChange", e), e(), () => {
|
|
5812
5812
|
document.removeEventListener("fullscreenchange", e), document.removeEventListener("webkitfullscreenchange", e), document.removeEventListener("mozfullscreenchange", e), document.removeEventListener("MSFullscreenChange", e);
|
|
5813
5813
|
};
|
|
5814
5814
|
}
|
|
5815
|
-
function Ks(r,
|
|
5815
|
+
function Ks(r, s) {
|
|
5816
5816
|
if (typeof r == "number") return r;
|
|
5817
5817
|
if (/px/.test(r)) return Number(r.replace(/px/, "")) || 0;
|
|
5818
5818
|
const t = document.createElement("div");
|
|
5819
|
-
t.style.width = r,
|
|
5819
|
+
t.style.width = r, s = s || document.body, s.appendChild(t);
|
|
5820
5820
|
const e = t.getBoundingClientRect().width;
|
|
5821
|
-
return
|
|
5821
|
+
return s.removeChild(t), e;
|
|
5822
5822
|
}
|
|
5823
|
-
function Qs(r,
|
|
5823
|
+
function Qs(r, s) {
|
|
5824
5824
|
if (!r) return;
|
|
5825
5825
|
let t, e;
|
|
5826
|
-
if (typeof
|
|
5827
|
-
const
|
|
5828
|
-
if (!
|
|
5829
|
-
const o =
|
|
5826
|
+
if (typeof s == "string") {
|
|
5827
|
+
const n = document.querySelector(s);
|
|
5828
|
+
if (!n) return;
|
|
5829
|
+
const o = n.getBoundingClientRect();
|
|
5830
5830
|
t = o.width, e = o.height;
|
|
5831
|
-
} else if (Array.isArray(
|
|
5832
|
-
t =
|
|
5831
|
+
} else if (Array.isArray(s))
|
|
5832
|
+
t = s[0], e = s[1];
|
|
5833
5833
|
else {
|
|
5834
|
-
const
|
|
5835
|
-
t =
|
|
5834
|
+
const n = s.getBoundingClientRect();
|
|
5835
|
+
t = n.width, e = n.height;
|
|
5836
5836
|
}
|
|
5837
5837
|
const i = t / e;
|
|
5838
5838
|
return i > r ? [r * e, e] : i < r ? [t, t / r] : [t, e];
|
|
5839
5839
|
}
|
|
5840
|
-
function tn(r,
|
|
5840
|
+
function tn(r, s = 5e3) {
|
|
5841
5841
|
return new Promise((t, e) => {
|
|
5842
5842
|
const i = new Image();
|
|
5843
5843
|
i.src = r;
|
|
5844
|
-
const
|
|
5844
|
+
const n = setTimeout(() => {
|
|
5845
5845
|
e(new Error("图片加载超时")), i.onload = null, i.onerror = null;
|
|
5846
|
-
},
|
|
5846
|
+
}, s);
|
|
5847
5847
|
i.onload = () => {
|
|
5848
|
-
clearTimeout(
|
|
5848
|
+
clearTimeout(n);
|
|
5849
5849
|
const o = i.naturalWidth, a = i.naturalHeight, l = o / a;
|
|
5850
5850
|
t([i, l]);
|
|
5851
5851
|
}, i.onerror = () => {
|
|
5852
|
-
clearTimeout(
|
|
5852
|
+
clearTimeout(n), e(new Error("图片加载失败"));
|
|
5853
5853
|
}, i.crossOrigin = "Anonymous";
|
|
5854
5854
|
});
|
|
5855
5855
|
}
|
|
5856
5856
|
function en(r) {
|
|
5857
5857
|
const t = document.getElementById(r).querySelectorAll("img"), e = t.length, i = [];
|
|
5858
|
-
let
|
|
5858
|
+
let n = 0;
|
|
5859
5859
|
return e === 0 ? Promise.resolve({
|
|
5860
5860
|
allLoaded: !0,
|
|
5861
5861
|
loaded: 0,
|
|
@@ -5864,7 +5864,7 @@ function en(r) {
|
|
|
5864
5864
|
errors: []
|
|
5865
5865
|
}) : new Promise((o) => {
|
|
5866
5866
|
const a = () => {
|
|
5867
|
-
|
|
5867
|
+
n === e && o({
|
|
5868
5868
|
allLoaded: i.length === 0,
|
|
5869
5869
|
// 全部加载完成(无失败)
|
|
5870
5870
|
loaded: e - i.length,
|
|
@@ -5876,19 +5876,19 @@ function en(r) {
|
|
|
5876
5876
|
};
|
|
5877
5877
|
t.forEach((l) => {
|
|
5878
5878
|
if (l.complete) {
|
|
5879
|
-
l.naturalWidth === 0 && i.push(l),
|
|
5879
|
+
l.naturalWidth === 0 && i.push(l), n++, a();
|
|
5880
5880
|
return;
|
|
5881
5881
|
}
|
|
5882
5882
|
l.addEventListener(
|
|
5883
5883
|
"load",
|
|
5884
5884
|
() => {
|
|
5885
|
-
|
|
5885
|
+
n++, a();
|
|
5886
5886
|
},
|
|
5887
5887
|
{ once: !0 }
|
|
5888
5888
|
), l.addEventListener(
|
|
5889
5889
|
"error",
|
|
5890
5890
|
() => {
|
|
5891
|
-
i.push(l),
|
|
5891
|
+
i.push(l), n++, a();
|
|
5892
5892
|
},
|
|
5893
5893
|
{ once: !0 }
|
|
5894
5894
|
);
|
|
@@ -5896,93 +5896,102 @@ function en(r) {
|
|
|
5896
5896
|
});
|
|
5897
5897
|
}
|
|
5898
5898
|
function sn(r) {
|
|
5899
|
-
return new Promise((
|
|
5900
|
-
fetch(r).then((e) =>
|
|
5899
|
+
return new Promise((s, t) => {
|
|
5900
|
+
fetch(r).then((e) => s(e.text())).catch((e) => {
|
|
5901
5901
|
console.error("Error fetching :", e), t(e);
|
|
5902
5902
|
});
|
|
5903
5903
|
});
|
|
5904
5904
|
}
|
|
5905
|
-
function hs(r
|
|
5906
|
-
|
|
5907
|
-
|
|
5905
|
+
function hs(r) {
|
|
5906
|
+
const {
|
|
5907
|
+
href: s,
|
|
5908
|
+
fileName: t,
|
|
5909
|
+
onProgress: e,
|
|
5910
|
+
timeout: i = 3e4,
|
|
5911
|
+
autoDownload: n = !0
|
|
5912
|
+
} = r;
|
|
5913
|
+
let o, a = !1, l = null, c;
|
|
5914
|
+
const h = t || le(s, "downloaded_file");
|
|
5915
|
+
c = decodeURIComponent(h);
|
|
5916
|
+
const u = () => {
|
|
5917
|
+
if (!l) return;
|
|
5918
|
+
const p = URL.createObjectURL(l), v = document.createElement("a");
|
|
5919
|
+
v.href = p, v.download = c, v.click(), URL.revokeObjectURL(p);
|
|
5920
|
+
};
|
|
5921
|
+
return { promise: new Promise((p, v) => {
|
|
5908
5922
|
try {
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
const d = u.loaded / u.total * 100;
|
|
5916
|
-
t == null || t(Number(d.toFixed(2)));
|
|
5923
|
+
o = new XMLHttpRequest(), o.open("GET", s), o.responseType = "blob", o.timeout = i, o.ontimeout = () => {
|
|
5924
|
+
a || v(new Error(`请求超时(已超过${i / 1e3}秒)`));
|
|
5925
|
+
}, o.addEventListener("progress", (w) => {
|
|
5926
|
+
if (w.lengthComputable && !a) {
|
|
5927
|
+
const C = w.loaded / w.total * 100;
|
|
5928
|
+
e == null || e(Number(C.toFixed(2)));
|
|
5917
5929
|
}
|
|
5918
|
-
}),
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
}), i.addEventListener("abort", () => {
|
|
5928
|
-
s || (s = !0, c(new Error("下载已被中止")));
|
|
5929
|
-
}), i.send();
|
|
5930
|
-
} catch (h) {
|
|
5931
|
-
s || c(h);
|
|
5930
|
+
}), o.addEventListener("load", () => {
|
|
5931
|
+
a || (o.status >= 200 && o.status < 300 ? (l = o.response, n && u(), p(o.response)) : v(new Error(`下载失败,状态码: ${o.status}`)));
|
|
5932
|
+
}), o.addEventListener("error", () => {
|
|
5933
|
+
a || v(new Error("网络错误,下载失败"));
|
|
5934
|
+
}), o.addEventListener("abort", () => {
|
|
5935
|
+
a || (a = !0, v(new Error("下载已被中止")));
|
|
5936
|
+
}), o.send();
|
|
5937
|
+
} catch (w) {
|
|
5938
|
+
a || v(w);
|
|
5932
5939
|
}
|
|
5933
|
-
}), abort: () => !
|
|
5940
|
+
}), abort: () => !a && o.abort(), download: () => {
|
|
5941
|
+
!a && l && u();
|
|
5942
|
+
} };
|
|
5934
5943
|
}
|
|
5935
|
-
function nn(r,
|
|
5944
|
+
function nn(r, s, t) {
|
|
5936
5945
|
if (!t) {
|
|
5937
|
-
let
|
|
5938
|
-
|
|
5946
|
+
let n = s.replace(/^[^.]+./, "");
|
|
5947
|
+
n = n == s ? "text/plain" : "application/" + n, t = { type: n };
|
|
5939
5948
|
}
|
|
5940
5949
|
const e = new Blob(r, t), i = URL.createObjectURL(e);
|
|
5941
|
-
hs(i,
|
|
5950
|
+
hs({ href: i, fileName: s });
|
|
5942
5951
|
}
|
|
5943
5952
|
const us = Math.PI / 2, Wt = Math.PI / 180, qt = 6378137, ds = 85.05112878;
|
|
5944
|
-
function rn(r,
|
|
5945
|
-
const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(
|
|
5953
|
+
function rn(r, s) {
|
|
5954
|
+
const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(s, ds), -85.05112878), i = t * Wt * qt, n = e * Wt, o = Math.log(Math.tan(Math.PI / 4 + n / 2)) * qt;
|
|
5946
5955
|
return [i, o];
|
|
5947
5956
|
}
|
|
5948
|
-
function on(r,
|
|
5949
|
-
const t = r / qt / Wt, e = (2 * Math.atan(Math.exp(
|
|
5957
|
+
function on(r, s) {
|
|
5958
|
+
const t = r / qt / Wt, e = (2 * Math.atan(Math.exp(s / qt)) - us) / Wt;
|
|
5950
5959
|
return [t, e];
|
|
5951
5960
|
}
|
|
5952
|
-
function fs(r,
|
|
5953
|
-
const [e, i] = r, [
|
|
5954
|
-
if (c === 0) return Math.sqrt((e -
|
|
5955
|
-
let h = ((e -
|
|
5961
|
+
function fs(r, s, t) {
|
|
5962
|
+
const [e, i] = r, [n, o] = s, [a, l] = t, c = (a - n) ** 2 + (l - o) ** 2;
|
|
5963
|
+
if (c === 0) return Math.sqrt((e - n) ** 2 + (i - o) ** 2);
|
|
5964
|
+
let h = ((e - n) * (a - n) + (i - o) * (l - o)) / c;
|
|
5956
5965
|
return h = Math.max(0, Math.min(1, h)), Math.sqrt(
|
|
5957
|
-
(e - (
|
|
5966
|
+
(e - (n + h * (a - n))) ** 2 + (i - (o + h * (l - o))) ** 2
|
|
5958
5967
|
);
|
|
5959
5968
|
}
|
|
5960
|
-
function an(r,
|
|
5961
|
-
const a = r + t * Math.cos(e) *
|
|
5969
|
+
function an(r, s, t, e, i, n = 1, o = 1) {
|
|
5970
|
+
const a = r + t * Math.cos(e) * n, l = s + t * Math.sin(e) * o, c = r + t * Math.cos(i) * n, h = s + t * Math.sin(i) * o;
|
|
5962
5971
|
return [
|
|
5963
5972
|
[a, l],
|
|
5964
5973
|
[c, h]
|
|
5965
5974
|
];
|
|
5966
5975
|
}
|
|
5967
|
-
function xe(r,
|
|
5968
|
-
return Math.hypot(Math.abs(t - r), Math.abs(e -
|
|
5976
|
+
function xe(r, s, t, e) {
|
|
5977
|
+
return Math.hypot(Math.abs(t - r), Math.abs(e - s));
|
|
5969
5978
|
}
|
|
5970
|
-
function Ue(r,
|
|
5971
|
-
const i = (r + t) / 2,
|
|
5972
|
-
return { x: i, y:
|
|
5979
|
+
function Ue(r, s, t, e) {
|
|
5980
|
+
const i = (r + t) / 2, n = (s + e) / 2;
|
|
5981
|
+
return { x: i, y: n };
|
|
5973
5982
|
}
|
|
5974
|
-
function ln(r,
|
|
5975
|
-
const [i,
|
|
5983
|
+
function ln(r, s, t, e) {
|
|
5984
|
+
const [i, n] = r, [o, a] = s;
|
|
5976
5985
|
let l = 1 / 0;
|
|
5977
5986
|
if (o !== 0) {
|
|
5978
5987
|
const c = o > 0 ? (t - i) / o : -i / o;
|
|
5979
5988
|
c > 0 && (l = Math.min(l, c));
|
|
5980
5989
|
}
|
|
5981
5990
|
if (a !== 0) {
|
|
5982
|
-
const c = a > 0 ? (e -
|
|
5991
|
+
const c = a > 0 ? (e - n) / a : -n / a;
|
|
5983
5992
|
c > 0 && (l = Math.min(l, c));
|
|
5984
5993
|
}
|
|
5985
|
-
return l === 1 / 0 ? r : [i + o * l,
|
|
5994
|
+
return l === 1 / 0 ? r : [i + o * l, n + a * l];
|
|
5986
5995
|
}
|
|
5987
5996
|
const ms = /* @__PURE__ */ new Set([
|
|
5988
5997
|
"sin",
|
|
@@ -5993,11 +6002,11 @@ const ms = /* @__PURE__ */ new Set([
|
|
|
5993
6002
|
"atan",
|
|
5994
6003
|
"atan2"
|
|
5995
6004
|
]), cn = new Proxy(Math, {
|
|
5996
|
-
get(r,
|
|
5997
|
-
return ms.has(
|
|
6005
|
+
get(r, s) {
|
|
6006
|
+
return ms.has(s) ? function(...t) {
|
|
5998
6007
|
const e = t.map((i) => i / 180 * Math.PI);
|
|
5999
|
-
return r[
|
|
6000
|
-
} : r[
|
|
6008
|
+
return r[s](...e);
|
|
6009
|
+
} : r[s];
|
|
6001
6010
|
},
|
|
6002
6011
|
// 禁止修改属性
|
|
6003
6012
|
set() {
|
|
@@ -6009,56 +6018,56 @@ const ms = /* @__PURE__ */ new Set([
|
|
|
6009
6018
|
}
|
|
6010
6019
|
});
|
|
6011
6020
|
class vt {
|
|
6012
|
-
constructor(
|
|
6021
|
+
constructor(s, t) {
|
|
6013
6022
|
f(this, "resolve");
|
|
6014
6023
|
f(this, "reject");
|
|
6015
|
-
this.resolve =
|
|
6024
|
+
this.resolve = s, this.reject = t;
|
|
6016
6025
|
}
|
|
6017
|
-
run(
|
|
6026
|
+
run(s) {
|
|
6018
6027
|
var t, e;
|
|
6019
|
-
return
|
|
6020
|
-
var
|
|
6021
|
-
return (
|
|
6028
|
+
return s instanceof Promise ? s.then((i) => {
|
|
6029
|
+
var n;
|
|
6030
|
+
return (n = this.resolve) == null || n.call(this), i;
|
|
6022
6031
|
}).catch((i) => {
|
|
6023
|
-
var
|
|
6024
|
-
return (
|
|
6025
|
-
}) :
|
|
6032
|
+
var n;
|
|
6033
|
+
return (n = this.reject) == null || n.call(this), Promise.reject(i);
|
|
6034
|
+
}) : s ? (t = this.resolve) == null || t.call(this) : (e = this.reject) == null || e.call(this), s;
|
|
6026
6035
|
}
|
|
6027
6036
|
}
|
|
6028
6037
|
class ps extends vt {
|
|
6029
|
-
constructor(
|
|
6030
|
-
super(), this.resolve =
|
|
6038
|
+
constructor(s) {
|
|
6039
|
+
super(), this.resolve = s;
|
|
6031
6040
|
}
|
|
6032
|
-
warning(...
|
|
6041
|
+
warning(...s) {
|
|
6033
6042
|
const t = () => {
|
|
6034
6043
|
var e, i;
|
|
6035
|
-
return (i = (e = Dt.tips).warning) == null ? void 0 : i.call(e, ...
|
|
6044
|
+
return (i = (e = Dt.tips).warning) == null ? void 0 : i.call(e, ...s);
|
|
6036
6045
|
};
|
|
6037
6046
|
return new vt(this.resolve, t);
|
|
6038
6047
|
}
|
|
6039
|
-
error(...
|
|
6048
|
+
error(...s) {
|
|
6040
6049
|
const t = () => {
|
|
6041
6050
|
var e, i;
|
|
6042
|
-
return (i = (e = Dt.tips).error) == null ? void 0 : i.call(e, ...
|
|
6051
|
+
return (i = (e = Dt.tips).error) == null ? void 0 : i.call(e, ...s);
|
|
6043
6052
|
};
|
|
6044
6053
|
return new vt(this.resolve, t);
|
|
6045
6054
|
}
|
|
6046
6055
|
}
|
|
6047
6056
|
class gs extends vt {
|
|
6048
|
-
constructor(
|
|
6049
|
-
super(), this.reject =
|
|
6057
|
+
constructor(s) {
|
|
6058
|
+
super(), this.reject = s;
|
|
6050
6059
|
}
|
|
6051
|
-
info(...
|
|
6060
|
+
info(...s) {
|
|
6052
6061
|
const t = () => {
|
|
6053
6062
|
var e, i;
|
|
6054
|
-
return (i = (e = Dt.tips).info) == null ? void 0 : i.call(e, ...
|
|
6063
|
+
return (i = (e = Dt.tips).info) == null ? void 0 : i.call(e, ...s);
|
|
6055
6064
|
};
|
|
6056
6065
|
return new vt(t, this.reject);
|
|
6057
6066
|
}
|
|
6058
|
-
success(...
|
|
6067
|
+
success(...s) {
|
|
6059
6068
|
const t = () => {
|
|
6060
6069
|
var e, i;
|
|
6061
|
-
return (i = (e = Dt.tips).success) == null ? void 0 : i.call(e, ...
|
|
6070
|
+
return (i = (e = Dt.tips).success) == null ? void 0 : i.call(e, ...s);
|
|
6062
6071
|
};
|
|
6063
6072
|
return new vt(t, this.reject);
|
|
6064
6073
|
}
|
|
@@ -6072,25 +6081,25 @@ const F = class F {
|
|
|
6072
6081
|
if (new.target === F)
|
|
6073
6082
|
throw new Error("请直接使用静态方法,而不是实例化此类");
|
|
6074
6083
|
}
|
|
6075
|
-
static register(
|
|
6084
|
+
static register(s, t) {
|
|
6076
6085
|
if (typeof t != "function")
|
|
6077
6086
|
return console.error("TipHandler must be a function");
|
|
6078
|
-
F.tips[
|
|
6087
|
+
F.tips[s] = t;
|
|
6079
6088
|
}
|
|
6080
|
-
static resolveTip(
|
|
6089
|
+
static resolveTip(s) {
|
|
6081
6090
|
return function(...t) {
|
|
6082
6091
|
const e = () => {
|
|
6083
|
-
var i,
|
|
6084
|
-
return (
|
|
6092
|
+
var i, n;
|
|
6093
|
+
return (n = (i = F.tips)[s]) == null ? void 0 : n.call(i, ...t);
|
|
6085
6094
|
};
|
|
6086
6095
|
return new ps(e);
|
|
6087
6096
|
};
|
|
6088
6097
|
}
|
|
6089
|
-
static rejectTip(
|
|
6098
|
+
static rejectTip(s) {
|
|
6090
6099
|
return function(...t) {
|
|
6091
6100
|
const e = () => {
|
|
6092
|
-
var i,
|
|
6093
|
-
return (
|
|
6101
|
+
var i, n;
|
|
6102
|
+
return (n = (i = F.tips)[s]) == null ? void 0 : n.call(i, ...t);
|
|
6094
6103
|
};
|
|
6095
6104
|
return new gs(e);
|
|
6096
6105
|
};
|