nhanh-pure-function 3.0.6-beta.13 → 3.0.6-beta.15

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/index.es.js CHANGED
@@ -5,8 +5,8 @@ var ge = (r) => {
5
5
  };
6
6
  var qe = (r, n, t) => n in r ? ze(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
7
7
  var f = (r, n, t) => qe(r, typeof n != "symbol" ? n + "" : n, t), ye = (r, n, t) => n.has(r) || ge("Cannot " + t);
8
- var P = (r, n, t) => (ye(r, n, "read from private field"), t ? t.call(r) : n.get(r)), N = (r, n, t) => n.has(r) ? ge("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(r) : n.set(r, t), D = (r, n, t, e) => (ye(r, n, "write to private field"), e ? e.call(r, t) : n.set(r, t), t);
9
- const We = {
8
+ var P = (r, n, t) => (ye(r, n, "read from private field"), t ? t.call(r) : n.get(r)), A = (r, n, t) => n.has(r) ? ge("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(r) : n.set(r, t), D = (r, n, t, e) => (ye(r, n, "write to private field"), e ? e.call(r, t) : n.set(r, t), t);
9
+ const je = {
10
10
  ".mp3": "audio/mpeg",
11
11
  ".mp4": "video/mp4",
12
12
  ".m4a": "audio/mp4",
@@ -336,11 +336,11 @@ function bs(r, n, t, e, i = 2) {
336
336
  };
337
337
  let d = u();
338
338
  const m = (C) => Math.min(Math.max(C, l), c), g = (C) => Number(C.toFixed(i)), p = (C, _, E) => {
339
- const A = [];
340
- return C >= _ && A.push("最小值必须小于最大值"), E <= 0 ? A.push("分段数必须为正数") : u() == 0 && A.push("数值精度过低,致使动画步长为 0"), A;
339
+ const N = [];
340
+ return C >= _ && N.push("最小值必须小于最大值"), E <= 0 ? N.push("分段数必须为正数") : u() == 0 && N.push("数值精度过低,致使动画步长为 0"), N;
341
341
  }, v = (C, _, E) => {
342
- const A = p(C, _, E);
343
- return A.length > 0 ? (console.error(`参数更新失败: ${A.join("; ")}`), !1) : (l = C, c = _, h = E, d = u(), s = m(s), !0);
342
+ const N = p(C, _, E);
343
+ return N.length > 0 ? (console.error(`参数更新失败: ${N.join("; ")}`), !1) : (l = C, c = _, h = E, d = u(), s = m(s), !0);
344
344
  }, w = () => {
345
345
  o && (a = s >= c ? -1 : s <= l ? 1 : a, s = m(s + d * a), e(g(s)), requestAnimationFrame(w));
346
346
  };
@@ -496,7 +496,7 @@ function Os(r, n = !0) {
496
496
  (i) => t[i]
497
497
  ) : r.replace(/\\[btnvfrs]/g, (i) => e[i] || i);
498
498
  }
499
- const Nt = [
499
+ const At = [
500
500
  ["年", 365 * 24 * 60 * 60 * 1e3],
501
501
  ["月", 30 * 24 * 60 * 60 * 1e3],
502
502
  ["周", 7 * 24 * 60 * 60 * 1e3],
@@ -506,20 +506,20 @@ const Nt = [
506
506
  ["秒", 1e3],
507
507
  ["毫秒", 1]
508
508
  ];
509
- function As(r, n) {
509
+ function Ns(r, n) {
510
510
  if (!Number.isInteger(r) || r < 0) return "0毫秒";
511
- const t = n ? Nt.findIndex(([i]) => i === n) : 0, e = t === -1 ? 0 : t;
512
- for (let i = e; i < Nt.length; i++) {
513
- const [s, o] = Nt[i];
511
+ const t = n ? At.findIndex(([i]) => i === n) : 0, e = t === -1 ? 0 : t;
512
+ for (let i = e; i < At.length; i++) {
513
+ const [s, o] = At[i];
514
514
  if (r >= o) {
515
515
  const a = o === 1 ? r : Math.round(r / o * 10) / 10;
516
516
  let l = Number.isInteger(a) ? a : a.toFixed(1).replace(/\.0$/, "");
517
- return s === Nt[e][0] && (l = se(Number(l))), `${l}${s}`;
517
+ return s === At[e][0] && (l = se(Number(l))), `${l}${s}`;
518
518
  }
519
519
  }
520
520
  return "0毫秒";
521
521
  }
522
- function Ns(r, n) {
522
+ function As(r, n) {
523
523
  if (n < 1)
524
524
  return console.error("分割大小必须大于0"), [];
525
525
  const t = [];
@@ -688,7 +688,7 @@ const tt = class tt {
688
688
  * @returns {string} 标准化的MIME类型字符串,如果无法识别则返回原始输入
689
689
  */
690
690
  static _normalizeType(n) {
691
- return n.startsWith(".") && !n.includes("/") ? We[n.toLowerCase()] || n : n.includes("/") ? n : `${n}/*`;
691
+ return n.startsWith(".") && !n.includes("/") ? je[n.toLowerCase()] || n : n.includes("/") ? n : `${n}/*`;
692
692
  }
693
693
  /**
694
694
  * 检查URL是否具有任何指定的文件扩展名
@@ -714,15 +714,15 @@ const tt = class tt {
714
714
  // 缓存文件扩展名的条目,以提高性能
715
715
  f(tt, "cachedEntries", Object.entries(ee));
716
716
  let we = tt;
717
- const je = /\w*(?:\[\d+\])+|\w+/g, Ee = /^\w*(?:\[\d+\])+$/, De = /\w+|(\[\d+\])/g, Ve = /\[(\d+)\]/;
717
+ const We = /\w*(?:\[\d+\])+|\w+/g, Ee = /^\w*(?:\[\d+\])+$/, De = /\w+|(\[\d+\])/g, Ve = /\[(\d+)\]/;
718
718
  function Re(r) {
719
- return r ? r.match(je) || [] : [];
719
+ return r ? r.match(We) || [] : [];
720
720
  }
721
721
  function Bs(r, n = 3e3) {
722
722
  if (typeof r != "function")
723
723
  return console.error("非函数:", r);
724
724
  const t = window.requestIdleCallback, e = function(i) {
725
- i.timeRemaining() <= 0 && !i.didTimeout ? t(e, { timeout: n }) : r();
725
+ i.timeRemaining() <= 0 && !i.didTimeout ? t(e, { timeout: n }) : r(i);
726
726
  };
727
727
  t ? t(e, { timeout: n }) : requestAnimationFrame(() => r());
728
728
  }
@@ -928,28 +928,36 @@ function Ze(r) {
928
928
  return console.warn("structuredClone error:", e), n && t(r);
929
929
  }
930
930
  }
931
- function Qe(r, n, t = 30) {
932
- if (typeof r != "function")
931
+ function Qe(r, n) {
932
+ const t = [
933
+ [11, "#d03050"],
934
+ [8, "#f0a020"],
935
+ [5, "#2080f0"],
936
+ [2, "#18a058"]
937
+ ], { level: e = t, maxHistory: i = 30, prefix: s = "" } = n || {};
938
+ if (e.sort((h, u) => u[0] - h[0]), typeof r != "function")
933
939
  return console.error("第一个参数必须是一个函数。");
934
- if (!Array.isArray(n))
940
+ if (!Array.isArray(e))
935
941
  return console.error("第二个参数必须是一个数组。");
936
- let e = [], i = 0;
937
- const s = (o, a) => {
938
- for (const [l, c] of a)
939
- if (o >= l)
940
- return c;
942
+ let o = [], a = 0;
943
+ const l = (h, u) => {
944
+ for (const [d, m] of u)
945
+ if (h >= d)
946
+ return m;
941
947
  return "black";
942
948
  };
943
- return function(...o) {
944
- const a = performance.now(), l = r(...o), c = performance.now() - a;
945
- e.push(c), e.length > t && e.shift(), i = e.reduce((d, m) => d + m, 0) / e.length || 0;
946
- const h = s(c, n), u = s(i, n);
949
+ return (...h) => {
950
+ const u = performance.now(), d = r(...h), m = performance.now() - u;
951
+ o.push(m), o.length > i && o.shift(), a = o.reduce((v, w) => v + w, 0) / o.length || 0;
952
+ const g = l(m, e), p = l(a, e);
947
953
  return console.log(
948
- `%c单次耗时:${c.toFixed(2)}ms
949
- %c平均耗时(${e.length}次):${i.toFixed(2)}ms`,
950
- `color: ${h}; padding: 2px 0;`,
951
- `color: ${u}; padding: 2px 0;`
952
- ), l;
954
+ `%c${s ? s + " - " : ""}单次耗时:${m.toFixed(
955
+ 2
956
+ )}ms
957
+ %c平均耗时(${o.length}次):${a.toFixed(2)}ms`,
958
+ `color: ${g}; padding: 2px 0;`,
959
+ `color: ${p}; padding: 2px 0;`
960
+ ), d;
953
961
  };
954
962
  }
955
963
  function zs(r) {
@@ -979,7 +987,7 @@ function qs(r, n = 10) {
979
987
  t = Date.now(), i();
980
988
  });
981
989
  }
982
- function Ws(r) {
990
+ function js(r) {
983
991
  const n = () => Promise.resolve(), t = (a) => (console.error(a), Promise.reject(a));
984
992
  function e() {
985
993
  return navigator.clipboard.writeText(r).then(n).catch(t);
@@ -1006,7 +1014,7 @@ function Ws(r) {
1006
1014
  }
1007
1015
  return navigator.clipboard ? e().catch(o) : o();
1008
1016
  }
1009
- function js(r, n) {
1017
+ function Ws(r, n) {
1010
1018
  const t = Se[r];
1011
1019
  if (!t) return console.error(`未知纸张类型: ${r}`);
1012
1020
  const { width: e, height: i } = t, s = (g) => g / 25.4, a = typeof window < "u" ? window.devicePixelRatio * 96 : 300, l = (g) => Math.round(s(g) * a), c = l(e), h = l(i), u = l(n), d = Math.max(0, c - 2 * u), m = Math.max(0, h - 2 * u);
@@ -1184,7 +1192,7 @@ var ae = 9e15, ht = 1e9, le = "0123456789abcdef", zt = "2.3025850929940456840179
1184
1192
  // Whether to use cryptographically-secure random number generation, if available.
1185
1193
  crypto: !1
1186
1194
  // true/false
1187
- }, Me, nt, S = !0, Zt = "[DecimalError] ", ct = Zt + "Invalid argument: ", Oe = Zt + "Precision limit exceeded", Ae = Zt + "crypto unavailable", Ne = "[object Decimal]", T = Math.floor, I = Math.pow, Je = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, Ke = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, ti = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, Ie = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, j = 1e7, b = 7, ei = 9007199254740991, ii = zt.length - 1, he = qt.length - 1, y = { toStringTag: Ne };
1195
+ }, Me, nt, S = !0, Zt = "[DecimalError] ", ct = Zt + "Invalid argument: ", Oe = Zt + "Precision limit exceeded", Ne = Zt + "crypto unavailable", Ae = "[object Decimal]", T = Math.floor, I = Math.pow, Je = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, Ke = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, ti = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, Ie = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, W = 1e7, b = 7, ei = 9007199254740991, ii = zt.length - 1, he = qt.length - 1, y = { toStringTag: Ae };
1188
1196
  y.absoluteValue = y.abs = function() {
1189
1197
  var r = new this.constructor(this);
1190
1198
  return r.s < 0 && (r.s = 1), x(r);
@@ -1361,9 +1369,9 @@ y.logarithm = y.log = function(r) {
1361
1369
  for (i = t[0]; i % 10 === 0; ) i /= 10;
1362
1370
  s = i !== 1;
1363
1371
  }
1364
- if (S = !1, a = u + m, o = at(c, a), e = n ? Wt(h, a + 10) : at(r, a), l = k(o, e, a, 1), Rt(l.d, i = u, d))
1372
+ if (S = !1, a = u + m, o = at(c, a), e = n ? jt(h, a + 10) : at(r, a), l = k(o, e, a, 1), Rt(l.d, i = u, d))
1365
1373
  do
1366
- if (a += 10, o = at(c, a), e = n ? Wt(h, a + 10) : at(r, a), l = k(o, e, a, 1), !s) {
1374
+ if (a += 10, o = at(c, a), e = n ? jt(h, a + 10) : at(r, a), l = k(o, e, a, 1), !s) {
1367
1375
  +H(l.d).slice(i + 1, i + 15) + 1 == 1e14 && (l = x(l, u + 1, 0));
1368
1376
  break;
1369
1377
  }
@@ -1396,8 +1404,8 @@ y.minus = y.sub = function(r) {
1396
1404
  for (u && (n = c, c = d, d = n, r.s = -r.s), o = c.length, e = d.length - o; e > 0; --e) c[o++] = 0;
1397
1405
  for (e = d.length; e > s; ) {
1398
1406
  if (c[--e] < d[e]) {
1399
- for (i = e; i && c[--i] === 0; ) c[i] = j - 1;
1400
- --c[i], c[e] += j;
1407
+ for (i = e; i && c[--i] === 0; ) c[i] = W - 1;
1408
+ --c[i], c[e] += W;
1401
1409
  }
1402
1410
  c[e] -= d[e];
1403
1411
  }
@@ -1432,7 +1440,7 @@ y.plus = y.add = function(r) {
1432
1440
  t.reverse();
1433
1441
  }
1434
1442
  for (o = c.length, i = h.length, o - i < 0 && (i = o, t = h, h = c, c = t), n = 0; i; )
1435
- n = (c[--i] = c[i] + h[i] + n) / j | 0, c[i] %= j;
1443
+ n = (c[--i] = c[i] + h[i] + n) / W | 0, c[i] %= W;
1436
1444
  for (n && (c.unshift(n), ++e), o = c.length; c[--o] == 0; ) c.pop();
1437
1445
  return r.d = c, r.e = Qt(c, e), S ? x(r, a, l) : r;
1438
1446
  };
@@ -1478,8 +1486,8 @@ y.times = y.mul = function(r) {
1478
1486
  for (t = T(h.e / b) + T(r.e / b), l = d.length, c = m.length, l < c && (s = d, d = m, m = s, o = l, l = c, c = o), s = [], o = l + c, e = o; e--; ) s.push(0);
1479
1487
  for (e = c; --e >= 0; ) {
1480
1488
  for (n = 0, i = l + e; i > e; )
1481
- a = s[i] + m[e] * d[i - e - 1] + n, s[i--] = a % j | 0, n = a / j | 0;
1482
- s[i] = (s[i] + n) % j | 0;
1489
+ a = s[i] + m[e] * d[i - e - 1] + n, s[i--] = a % W | 0, n = a / W | 0;
1490
+ s[i] = (s[i] + n) % W | 0;
1483
1491
  }
1484
1492
  for (; !s[--o]; ) s.pop();
1485
1493
  return n ? ++t : s.shift(), r.d = s, r.e = Qt(s, t), S ? x(r, u.precision, u.rounding) : r;
@@ -1629,17 +1637,17 @@ var k = /* @__PURE__ */ function() {
1629
1637
  for (; !e[0] && e.length > 1; ) e.shift();
1630
1638
  }
1631
1639
  return function(e, i, s, o, a, l) {
1632
- var c, h, u, d, m, g, p, v, w, C, _, E, A, X, Mt, ut, rt, yt, G, Ot, At = e.constructor, te = e.s == i.s ? 1 : -1, L = e.d, M = i.d;
1640
+ var c, h, u, d, m, g, p, v, w, C, _, E, N, X, Mt, ut, rt, yt, G, Ot, Nt = e.constructor, te = e.s == i.s ? 1 : -1, L = e.d, M = i.d;
1633
1641
  if (!L || !L[0] || !M || !M[0])
1634
- return new At(
1642
+ return new Nt(
1635
1643
  // Return NaN if either NaN, or both Infinity or 0.
1636
1644
  !e.s || !i.s || (L ? M && L[0] == M[0] : !M) ? NaN : (
1637
1645
  // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
1638
1646
  L && L[0] == 0 || !M ? te * 0 : te / 0
1639
1647
  )
1640
1648
  );
1641
- for (l ? (m = 1, h = e.e - i.e) : (l = j, m = b, h = T(e.e / m) - T(i.e / m)), G = M.length, rt = L.length, w = new At(te), C = w.d = [], u = 0; M[u] == (L[u] || 0); u++) ;
1642
- if (M[u] > (L[u] || 0) && h--, s == null ? (X = s = At.precision, o = At.rounding) : a ? X = s + (e.e - i.e) + 1 : X = s, X < 0)
1649
+ for (l ? (m = 1, h = e.e - i.e) : (l = W, m = b, h = T(e.e / m) - T(i.e / m)), G = M.length, rt = L.length, w = new Nt(te), C = w.d = [], u = 0; M[u] == (L[u] || 0); u++) ;
1650
+ if (M[u] > (L[u] || 0) && h--, s == null ? (X = s = Nt.precision, o = Nt.rounding) : a ? X = s + (e.e - i.e) + 1 : X = s, X < 0)
1643
1651
  C.push(1), g = !0;
1644
1652
  else {
1645
1653
  if (X = X / m + 2 | 0, u = 0, G == 1) {
@@ -1650,7 +1658,7 @@ var k = /* @__PURE__ */ function() {
1650
1658
  for (d = l / (M[0] + 1) | 0, d > 1 && (M = r(M, d, l), L = r(L, d, l), G = M.length, rt = L.length), ut = G, _ = L.slice(0, G), E = _.length; E < G; ) _[E++] = 0;
1651
1659
  Ot = M.slice(), Ot.unshift(0), yt = M[0], M[1] >= l / 2 && ++yt;
1652
1660
  do
1653
- d = 0, c = n(M, _, 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(M, d, l), v = p.length, E = _.length, c = n(p, _, v, E), c == 1 && (d--, t(p, G < v ? Ot : M, v, l))) : (d == 0 && (c = d = 1), p = M.slice()), v = p.length, v < E && p.unshift(0), t(_, p, E, l), c == -1 && (E = _.length, c = n(M, _, G, E), c < 1 && (d++, t(_, G < E ? Ot : M, E, l))), E = _.length) : c === 0 && (d++, _ = [0]), C[u++] = d, c && _[0] ? _[E++] = L[ut] || 0 : (_ = [L[ut]], E = 1);
1661
+ d = 0, c = n(M, _, G, E), c < 0 ? (N = _[0], G != E && (N = N * l + (_[1] || 0)), d = N / yt | 0, d > 1 ? (d >= l && (d = l - 1), p = r(M, d, l), v = p.length, E = _.length, c = n(p, _, v, E), c == 1 && (d--, t(p, G < v ? Ot : M, v, l))) : (d == 0 && (c = d = 1), p = M.slice()), v = p.length, v < E && p.unshift(0), t(_, p, E, l), c == -1 && (E = _.length, c = n(M, _, G, E), c < 1 && (d++, t(_, G < E ? Ot : M, E, l))), E = _.length) : c === 0 && (d++, _ = [0]), C[u++] = d, c && _[0] ? _[E++] = L[ut] || 0 : (_ = [L[ut]], E = 1);
1654
1662
  while ((ut++ < rt || _[0] !== void 0) && X--);
1655
1663
  g = _[0] !== void 0;
1656
1664
  }
@@ -1690,10 +1698,10 @@ function x(r, n, t, e) {
1690
1698
  if (d == 0) {
1691
1699
  for (s = 1, o = u[0]; o >= 10; o /= 10) s++;
1692
1700
  for (o = u[0] += a, a = 1; o >= 10; o /= 10) a++;
1693
- s != a && (r.e++, u[0] == j && (u[0] = 1));
1701
+ s != a && (r.e++, u[0] == W && (u[0] = 1));
1694
1702
  break;
1695
1703
  } else {
1696
- if (u[d] += a, u[d] != j) break;
1704
+ if (u[d] += a, u[d] != W) break;
1697
1705
  u[d--] = 0, a = 1;
1698
1706
  }
1699
1707
  for (s = u.length; u[--s] === 0; ) u.pop();
@@ -1710,7 +1718,7 @@ function Qt(r, n) {
1710
1718
  for (n *= b; t >= 10; t /= 10) n++;
1711
1719
  return n;
1712
1720
  }
1713
- function Wt(r, n, t) {
1721
+ function jt(r, n, t) {
1714
1722
  if (n > ii)
1715
1723
  throw S = !0, t && (r.precision = t), Error(Oe);
1716
1724
  return x(new r(zt), n, 1, !0);
@@ -1784,10 +1792,10 @@ function at(r, n) {
1784
1792
  p = p.times(r), t = H(p.d), e = t.charAt(0), m++;
1785
1793
  s = p.e, e > 1 ? (p = new w("0." + t), s++) : p = new w(e + "." + t.slice(1));
1786
1794
  } else
1787
- return c = Wt(w, h + 2, _).times(s + ""), p = at(new w(e + "." + t.slice(1)), h - g).plus(c), w.precision = _, n == null ? x(p, _, C, S = !0) : p;
1795
+ return c = jt(w, h + 2, _).times(s + ""), p = at(new w(e + "." + t.slice(1)), h - g).plus(c), w.precision = _, n == null ? x(p, _, C, S = !0) : p;
1788
1796
  for (u = p, l = o = p = k(p.minus(1), p.plus(1), h, 1), d = x(p.times(p), h, 1), i = 3; ; ) {
1789
1797
  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))
1790
- if (l = l.times(2), s !== 0 && (l = l.plus(Wt(w, h + 2, _).times(s + ""))), l = k(l, new w(m), h, 1), n == null)
1798
+ if (l = l.times(2), s !== 0 && (l = l.plus(jt(w, h + 2, _).times(s + ""))), l = k(l, new w(m), h, 1), n == null)
1791
1799
  if (Rt(l.d, h - g, C, a))
1792
1800
  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;
1793
1801
  else
@@ -1830,7 +1838,7 @@ function ni(r, n) {
1830
1838
  t = 8;
1831
1839
  else
1832
1840
  throw Error(ct + n);
1833
- for (s = n.search(/p/i), s > 0 ? (l = +n.slice(s + 1), n = n.substring(2, s)) : n = n.slice(2), s = n.indexOf("."), o = s >= 0, e = r.constructor, o && (n = n.replace(".", ""), a = n.length, s = a - s, i = Le(e, new e(t), s, s * 2)), c = Lt(n, t, j), h = c.length - 1, s = h; c[s] === 0; --s) c.pop();
1841
+ for (s = n.search(/p/i), s > 0 ? (l = +n.slice(s + 1), n = n.substring(2, s)) : n = n.slice(2), s = n.indexOf("."), o = s >= 0, e = r.constructor, o && (n = n.replace(".", ""), a = n.length, s = a - s, i = Le(e, new e(t), s, s * 2)), c = Lt(n, t, W), h = c.length - 1, s = h; c[s] === 0; --s) c.pop();
1834
1842
  return s < 0 ? new e(r.s * 0) : (r.e = Qt(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) : R.pow(2, l))), S = !0, r);
1835
1843
  }
1836
1844
  function ri(r, n) {
@@ -1980,7 +1988,7 @@ function vi(r) {
1980
1988
  if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
1981
1989
  this[t] = !0;
1982
1990
  else
1983
- throw Error(Ae);
1991
+ throw Error(Ne);
1984
1992
  else
1985
1993
  this[t] = !1;
1986
1994
  else
@@ -2024,7 +2032,7 @@ function Ue(r) {
2024
2032
  return s < 0 ? (s = -s, c.s = -1) : c.s = 1, Tt(c, s.toString());
2025
2033
  throw Error(ct + s);
2026
2034
  }
2027
- 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 = vi, i.clone = Ue, i.isDecimal = be, i.abs = oi, i.acos = ai, i.acosh = li, i.add = ci, i.asin = hi, i.asinh = ui, i.atan = di, i.atanh = fi, i.atan2 = mi, i.cbrt = pi, i.ceil = gi, i.clamp = yi, i.cos = wi, i.cosh = Pi, i.div = xi, i.exp = bi, i.floor = Ci, i.hypot = _i, i.ln = Si, i.log = Ei, i.log10 = Vi, i.log2 = Di, i.max = Ri, i.min = ki, i.mod = Mi, i.mul = Oi, i.pow = Ai, i.random = Ni, i.round = Ii, i.sign = Hi, i.sin = Li, i.sinh = Ti, i.sqrt = Fi, i.sub = Bi, i.sum = Ui, i.tan = Xi, i.tanh = Gi, i.trunc = Yi, r === void 0 && (r = {}), r && r.defaults !== !0)
2035
+ 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 = vi, i.clone = Ue, i.isDecimal = be, i.abs = oi, i.acos = ai, i.acosh = li, i.add = ci, i.asin = hi, i.asinh = ui, i.atan = di, i.atanh = fi, i.atan2 = mi, i.cbrt = pi, i.ceil = gi, i.clamp = yi, i.cos = wi, i.cosh = Pi, i.div = xi, i.exp = bi, i.floor = Ci, i.hypot = _i, i.ln = Si, i.log = Ei, i.log10 = Vi, i.log2 = Di, i.max = Ri, i.min = ki, i.mod = Mi, i.mul = Oi, i.pow = Ni, i.random = Ai, i.round = Ii, i.sign = Hi, i.sin = Li, i.sinh = Ti, i.sqrt = Fi, i.sub = Bi, i.sum = Ui, i.tan = Xi, i.tanh = Gi, i.trunc = Yi, r === void 0 && (r = {}), r && r.defaults !== !0)
2028
2036
  for (e = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], n = 0; n < e.length; ) r.hasOwnProperty(t = e[n++]) || (r[t] = this[t]);
2029
2037
  return i.config(r), i;
2030
2038
  }
@@ -2050,7 +2058,7 @@ function _i() {
2050
2058
  return S = !0, t.sqrt();
2051
2059
  }
2052
2060
  function be(r) {
2053
- return r instanceof R || r && r.toStringTag === Ne || !1;
2061
+ return r instanceof R || r && r.toStringTag === Ae || !1;
2054
2062
  }
2055
2063
  function Si(r) {
2056
2064
  return new this(r).ln();
@@ -2076,10 +2084,10 @@ function Mi(r, n) {
2076
2084
  function Oi(r, n) {
2077
2085
  return new this(r).mul(n);
2078
2086
  }
2079
- function Ai(r, n) {
2087
+ function Ni(r, n) {
2080
2088
  return new this(r).pow(n);
2081
2089
  }
2082
- function Ni(r) {
2090
+ function Ai(r) {
2083
2091
  var n, t, e, i, s = 0, o = new this(1), a = [];
2084
2092
  if (r === void 0 ? r = this.precision : U(r, 1, ht), e = Math.ceil(r / b), this.crypto)
2085
2093
  if (crypto.getRandomValues)
@@ -2090,7 +2098,7 @@ function Ni(r) {
2090
2098
  i = n[s] + (n[s + 1] << 8) + (n[s + 2] << 16) + ((n[s + 3] & 127) << 24), i >= 214e7 ? crypto.randomBytes(4).copy(n, s) : (a.push(i % 1e7), s += 4);
2091
2099
  s = e / 4;
2092
2100
  } else
2093
- throw Error(Ae);
2101
+ throw Error(Ne);
2094
2102
  else for (; s < e; ) a[s++] = Math.random() * 1e7 | 0;
2095
2103
  for (e = a[--s], r %= b, e && r && (i = I(10, b - r), a[s] = (e / i | 0) * i); a[s] === 0; s--) a.pop();
2096
2104
  if (s < 0)
@@ -2215,12 +2223,12 @@ class qi extends zi {
2215
2223
  return !0;
2216
2224
  }
2217
2225
  }
2218
- let Wi = class extends qi {
2226
+ let ji = class extends qi {
2219
2227
  constructor(n) {
2220
2228
  super(), n.name = n.name || oe("default-name-"), Object.assign(this, { ...n });
2221
2229
  }
2222
2230
  };
2223
- class ji extends Wi {
2231
+ class Wi extends ji {
2224
2232
  constructor(t) {
2225
2233
  super(t);
2226
2234
  f(this, "_isInteractive", !0);
@@ -2311,7 +2319,7 @@ class $i {
2311
2319
  return !this.propagationStopped;
2312
2320
  }
2313
2321
  }
2314
- class kt extends ji {
2322
+ class kt extends Wi {
2315
2323
  constructor() {
2316
2324
  super(...arguments);
2317
2325
  //#region 4. 添加事件管理器
@@ -4657,13 +4665,18 @@ class es extends Qi {
4657
4665
  maxYV: 0
4658
4666
  });
4659
4667
  /** 测量重绘性能 */
4660
- f(this, "measureRedrawPerformance", Qe(() => {
4661
- this.isRendering = !0, this.redraw(), this.redrawInNextRenderFrame = !1, this.isRendering = !1;
4662
- }, [
4663
- [1, "#F56C6C"],
4664
- [0.5, "#E6A23C"],
4665
- [0, "#67C23A"]
4666
- ]));
4668
+ f(this, "measureRedrawPerformance", Qe(
4669
+ () => {
4670
+ this.isRendering = !0, this.redraw(), this.redrawInNextRenderFrame = !1, this.isRendering = !1;
4671
+ },
4672
+ {
4673
+ level: [
4674
+ [1, "#F56C6C"],
4675
+ [0.5, "#E6A23C"],
4676
+ [0, "#67C23A"]
4677
+ ]
4678
+ }
4679
+ ));
4667
4680
  this.canvas && (this.resizeObserver = new ResizeObserver(
4668
4681
  ke(() => {
4669
4682
  [this.canvas.width, this.canvas.height] = [
@@ -4855,11 +4868,11 @@ class is extends es {
4855
4868
  return i.x += v * l, i.y += w * l, !0;
4856
4869
  const C = this.getAxisValueByPoint(l, 0).xV, [_, E] = [C * o.x, C * o.y];
4857
4870
  if (u === "Single") {
4858
- const A = c.value;
4859
- A[0] += v * _, A[1] += w * E;
4871
+ const N = c.value;
4872
+ N[0] += v * _, N[1] += w * E;
4860
4873
  } else
4861
- c.value.forEach((A) => {
4862
- A[0] += v * _, A[1] += w * E;
4874
+ c.value.forEach((N) => {
4875
+ N[0] += v * _, N[1] += w * E;
4863
4876
  });
4864
4877
  return c.value = [...c.value], !0;
4865
4878
  }, m = (v) => (this.setScale("center", v * s), !0), p = {
@@ -4909,11 +4922,11 @@ class is extends es {
4909
4922
  /** 处理拖拽移动 */
4910
4923
  handleDragMove(t) {
4911
4924
  if (!this.isDraggable) return;
4912
- const { lastDownOverlay: e } = this;
4913
- if (!this.isDraggable) return;
4914
- e != null && e.isDraggable ? this.notifyDraggOverlays(t) : this.handleCanvasPan(t);
4915
- const { clientX: i, clientY: s } = t;
4916
- this.mouseLastPosition = { x: i, y: s }, this.lockNotifyClick = !0;
4925
+ const { clientX: e, clientY: i } = t, s = { x: e, y: i };
4926
+ if (JSON.stringify(s) == JSON.stringify(this.mouseLastPosition))
4927
+ return;
4928
+ const { lastDownOverlay: o } = this;
4929
+ o != null && o.isDraggable ? this.notifyDraggOverlays(t) : this.handleCanvasPan(t), this.mouseLastPosition = s, this.lockNotifyClick = !0;
4917
4930
  }
4918
4931
  /** 通知可拖拽的 overlays */
4919
4932
  notifyDraggOverlays(t) {
@@ -5340,8 +5353,8 @@ class rs extends ns {
5340
5353
  const E = Math.ceil(p / w);
5341
5354
  _ = 1 - ((v * E / p - a.min) / a.min + (E - 2)) * C;
5342
5355
  } else {
5343
- 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);
5344
- _ = 1 + ((v / X / p - a.min) / a.min + A) * C;
5356
+ const E = (ut, rt, yt) => ut < rt ? yt - 1 : E(ut / 2, rt, yt + 1), N = E(w, p, 0), X = Math.pow(2, N);
5357
+ _ = 1 + ((v / X / p - a.min) / a.min + N) * C;
5345
5358
  }
5346
5359
  return i !== void 0 && (_ = Math.min(i, _)), _ = new R(_).div(o).round().mul(o).toNumber(), _;
5347
5360
  }
@@ -5750,15 +5763,15 @@ function Qs(r, n, t) {
5750
5763
  var Y, dt, ft, wt, Pt, Z, Q, st, xt;
5751
5764
  class Js {
5752
5765
  constructor() {
5753
- N(this, Y);
5754
- N(this, dt, !1);
5755
- N(this, ft, {});
5756
- N(this, wt, 0);
5757
- N(this, Pt, 0);
5758
- N(this, Z, 0);
5759
- N(this, Q, 0);
5760
- N(this, st);
5761
- N(this, xt);
5766
+ A(this, Y);
5767
+ A(this, dt, !1);
5768
+ A(this, ft, {});
5769
+ A(this, wt, 0);
5770
+ A(this, Pt, 0);
5771
+ A(this, Z, 0);
5772
+ A(this, Q, 0);
5773
+ A(this, st);
5774
+ A(this, xt);
5762
5775
  }
5763
5776
  init(n, t) {
5764
5777
  D(this, Y, n), D(this, st, t == null ? void 0 : t.limit), D(this, xt, t == null ? void 0 : t.dragDom), D(this, ft, {
@@ -5795,19 +5808,19 @@ class Js {
5795
5808
  }
5796
5809
  }
5797
5810
  Y = new WeakMap(), dt = new WeakMap(), ft = new WeakMap(), wt = new WeakMap(), Pt = new WeakMap(), Z = new WeakMap(), Q = new WeakMap(), st = new WeakMap(), xt = new WeakMap();
5798
- var z, mt, pt, bt, Ct, q, W, B, _t, St;
5811
+ var z, mt, pt, bt, Ct, q, j, B, _t, St;
5799
5812
  class Ks {
5800
5813
  constructor() {
5801
- N(this, z);
5802
- N(this, mt, !1);
5803
- N(this, pt, {});
5804
- N(this, bt, 0);
5805
- N(this, Ct, 0);
5806
- N(this, q, 0);
5807
- N(this, W, 0);
5808
- N(this, B);
5809
- N(this, _t);
5810
- N(this, St);
5814
+ A(this, z);
5815
+ A(this, mt, !1);
5816
+ A(this, pt, {});
5817
+ A(this, bt, 0);
5818
+ A(this, Ct, 0);
5819
+ A(this, q, 0);
5820
+ A(this, j, 0);
5821
+ A(this, B);
5822
+ A(this, _t);
5823
+ A(this, St);
5811
5824
  }
5812
5825
  init(n, t = {}) {
5813
5826
  D(this, z, n), D(this, B, t.limit), D(this, _t, t.update_move), D(this, St, t.update_up), D(this, pt, {
@@ -5827,7 +5840,7 @@ class Ks {
5827
5840
  updateValue() {
5828
5841
  const n = {
5829
5842
  top: P(this, q),
5830
- left: P(this, W),
5843
+ left: P(this, j),
5831
5844
  percentage: { top: 0, left: 0 }
5832
5845
  };
5833
5846
  if (P(this, B)) {
@@ -5841,7 +5854,7 @@ class Ks {
5841
5854
  }
5842
5855
  alterLocation() {
5843
5856
  if (!P(this, z)) return console.error("No DOM");
5844
- P(this, B) && (D(this, q, Math.min(P(this, q), P(this, B).max.top)), D(this, q, Math.max(P(this, q), P(this, B).min.top)), D(this, W, Math.min(P(this, W), P(this, B).max.left)), D(this, W, Math.max(P(this, W), P(this, B).min.left))), P(this, _t) && P(this, _t).call(this, this.updateValue()), P(this, z).style.setProperty("--top", P(this, q) + "px"), P(this, z).style.setProperty("--left", P(this, W) + "px");
5857
+ P(this, B) && (D(this, q, Math.min(P(this, q), P(this, B).max.top)), D(this, q, Math.max(P(this, q), P(this, B).min.top)), D(this, j, Math.min(P(this, j), P(this, B).max.left)), D(this, j, Math.max(P(this, j), P(this, B).min.left))), P(this, _t) && P(this, _t).call(this, this.updateValue()), P(this, z).style.setProperty("--top", P(this, q) + "px"), P(this, z).style.setProperty("--left", P(this, j) + "px");
5845
5858
  }
5846
5859
  mousedown(n) {
5847
5860
  if (!P(this, z)) return console.error("No DOM");
@@ -5849,28 +5862,29 @@ class Ks {
5849
5862
  const t = P(this, z).getBoundingClientRect();
5850
5863
  D(this, Ct, t.y), D(this, bt, t.x);
5851
5864
  const { pageX: e, pageY: i } = n;
5852
- D(this, q, i - P(this, Ct)), D(this, W, e - P(this, bt)), this.alterLocation();
5865
+ D(this, q, i - P(this, Ct)), D(this, j, e - P(this, bt)), this.alterLocation();
5853
5866
  }
5854
5867
  mousemove(n) {
5855
5868
  const { pageX: t, pageY: e } = n;
5856
- P(this, mt) && (D(this, q, e - P(this, Ct)), D(this, W, t - P(this, bt)), this.alterLocation());
5869
+ P(this, mt) && (D(this, q, e - P(this, Ct)), D(this, j, t - P(this, bt)), this.alterLocation());
5857
5870
  }
5858
5871
  mouseup() {
5859
5872
  P(this, mt) && (D(this, mt, !1), document.body.classList.remove("no-select"), P(this, St) && P(this, St).call(this, this.updateValue()));
5860
5873
  }
5861
5874
  }
5862
- z = new WeakMap(), mt = new WeakMap(), pt = new WeakMap(), bt = new WeakMap(), Ct = new WeakMap(), q = new WeakMap(), W = new WeakMap(), B = new WeakMap(), _t = new WeakMap(), St = new WeakMap();
5875
+ z = new WeakMap(), mt = new WeakMap(), pt = new WeakMap(), bt = new WeakMap(), Ct = new WeakMap(), q = new WeakMap(), j = new WeakMap(), B = new WeakMap(), _t = new WeakMap(), St = new WeakMap();
5863
5876
  function Kt(r) {
5864
5877
  if (typeof r == "string") {
5865
5878
  const n = document.querySelector(r);
5866
- if (!n) throw new Error(`Element "${r}" not found`);
5867
- return n;
5879
+ if (n)
5880
+ return n;
5881
+ console.error(`Element "${r}" not found`);
5868
5882
  } else
5869
5883
  return r || document.documentElement;
5870
5884
  }
5871
5885
  function hs(r) {
5872
5886
  const n = Kt(r);
5873
- return n.requestFullscreen ? n.requestFullscreen() : n.mozRequestFullScreen ? n.mozRequestFullScreen() : n.webkitRequestFullscreen ? n.webkitRequestFullscreen() : n.msRequestFullscreen ? n.msRequestFullscreen() : Promise.reject("No Fullscreen API");
5887
+ return n ? n.requestFullscreen ? n.requestFullscreen() : n.mozRequestFullScreen ? n.mozRequestFullScreen() : n.webkitRequestFullscreen ? n.webkitRequestFullscreen() : n.msRequestFullscreen ? n.msRequestFullscreen() : Promise.reject("No Fullscreen API") : Promise.reject("No Element");
5874
5888
  }
5875
5889
  function us() {
5876
5890
  const r = document;
@@ -5881,12 +5895,15 @@ function Ge(r) {
5881
5895
  return n == e || !r && window.innerWidth == screen.width && window.innerHeight == screen.height;
5882
5896
  }
5883
5897
  function tn(r) {
5884
- return r = Kt(r), function() {
5885
- Ge(r) ? us() : hs(r);
5886
- };
5898
+ if (r = Kt(r), !!r)
5899
+ return function() {
5900
+ Ge(r) ? us() : hs(r);
5901
+ };
5887
5902
  }
5888
5903
  function en(r, n) {
5889
- const t = Kt(n), e = () => {
5904
+ const t = Kt(n);
5905
+ if (!t) return;
5906
+ const e = () => {
5890
5907
  r(Ge(t));
5891
5908
  };
5892
5909
  return document.addEventListener("fullscreenchange", e), document.addEventListener("webkitfullscreenchange", e), document.addEventListener("mozfullscreenchange", e), document.addEventListener("MSFullscreenChange", e), e(), () => {
@@ -6030,13 +6047,13 @@ function ln(r, n, t) {
6030
6047
  const e = new Blob(r, t), i = URL.createObjectURL(e);
6031
6048
  ds({ href: i, fileName: n });
6032
6049
  }
6033
- const fs = Math.PI / 2, jt = Math.PI / 180, $t = 6378137, ms = 85.05112878;
6050
+ const fs = Math.PI / 2, Wt = Math.PI / 180, $t = 6378137, ms = 85.05112878;
6034
6051
  function cn(r, n) {
6035
- const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(n, ms), -85.05112878), i = t * jt * $t, s = e * jt, o = Math.log(Math.tan(Math.PI / 4 + s / 2)) * $t;
6052
+ const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(n, ms), -85.05112878), i = t * Wt * $t, s = e * Wt, o = Math.log(Math.tan(Math.PI / 4 + s / 2)) * $t;
6036
6053
  return [i, o];
6037
6054
  }
6038
6055
  function hn(r, n) {
6039
- const t = r / $t / jt, e = (2 * Math.atan(Math.exp(n / $t)) - fs) / jt;
6056
+ const t = r / $t / Wt, e = (2 * Math.atan(Math.exp(n / $t)) - fs) / Wt;
6040
6057
  return [t, e];
6041
6058
  }
6042
6059
  function ps(r, n, t) {
@@ -6194,7 +6211,7 @@ f(F, "tips", {
6194
6211
  }), f(F, "info", F.resolveTip("info")), f(F, "success", F.resolveTip("success")), f(F, "warning", F.rejectTip("warning")), f(F, "error", F.rejectTip("error"));
6195
6212
  let Dt = F;
6196
6213
  export {
6197
- We as EXTENSION_TO_MIME,
6214
+ je as EXTENSION_TO_MIME,
6198
6215
  ee as FILE_EXTENSIONS,
6199
6216
  Se as PAPER_SIZE_DEFINITIONS,
6200
6217
  xs as PAPER_SIZE_OPTIONS,
@@ -6204,8 +6221,8 @@ export {
6204
6221
  Cs as _Animate_NumericTransition,
6205
6222
  Gt as _Animate_Schedule,
6206
6223
  _s as _Blob_ConvertDataToImageUrl,
6207
- js as _Browser_CalculatePrintableArea,
6208
- Ws as _Browser_CopyToClipboard,
6224
+ Ws as _Browser_CalculatePrintableArea,
6225
+ js as _Browser_CopyToClipboard,
6209
6226
  qs as _Browser_GetFrameRate,
6210
6227
  It as _Browser_SameOriginTabManager,
6211
6228
  $ as _Canvas,
@@ -6227,11 +6244,11 @@ export {
6227
6244
  an as _File_Read,
6228
6245
  ks as _Format_CamelCase,
6229
6246
  Ss as _Format_CapitalizeFirstLetter,
6230
- Ns as _Format_ChunkArray,
6247
+ As as _Format_ChunkArray,
6231
6248
  Ms as _Format_ExcludeSubstring,
6232
6249
  Vs as _Format_FileSize,
6233
6250
  ne as _Format_HrefName,
6234
- As as _Format_MillisecondToReadable,
6251
+ Ns as _Format_MillisecondToReadable,
6235
6252
  se as _Format_NumberWithCommas,
6236
6253
  Ds as _Format_NumberWithUnit,
6237
6254
  Es as _Format_Percentage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhanh-pure-function",
3
- "version": "3.0.6-beta.13",
3
+ "version": "3.0.6-beta.15",
4
4
  "description": "纯函数工具",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",