nhanh-pure-function 4.2.1 → 4.2.2

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
@@ -451,7 +451,7 @@ function le(r) {
451
451
  const t = r.toString().split("."), e = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
452
452
  return t.length > 1 ? e + "." + t[1] : e;
453
453
  }
454
- function Gs(r, s) {
454
+ function zs(r, s) {
455
455
  const t = {
456
456
  join: !0,
457
457
  suffix: "",
@@ -464,7 +464,7 @@ function Gs(r, s) {
464
464
  const a = Math.abs(o), l = o >= 0, c = Math.max(0, Math.floor(Math.log10(a) / 4)), h = Math.pow(1e4, c), u = a / h, f = (l ? 1 : -1) * parseFloat(u.toFixed(Math.max(0, n)));
465
465
  return e ? `${f}${Pe[c]}${i}` : [f, Pe[c] + i];
466
466
  }
467
- function Us(r) {
467
+ function Gs(r) {
468
468
  const s = ["B", "KB", "MB", "GB", "TB", "PB"];
469
469
  let t = 0;
470
470
  for (; r > 1024; )
@@ -495,10 +495,10 @@ function ce(r, s = "file") {
495
495
  const t = r.split("/");
496
496
  return t[t.length - 1].split("?")[0];
497
497
  }
498
- function Xs(r, s) {
498
+ function Us(r, s) {
499
499
  return r = r.replace(/([^a-zA-Z][a-z])/g, (t) => t.toUpperCase()), s ? r.replace(/[^a-zA-Z]+/g, "") : r;
500
500
  }
501
- function zs(r, s, t = ",") {
501
+ function Xs(r, s, t = ",") {
502
502
  const e = new RegExp(
503
503
  `(^|${t})${s}(${t}|$)`,
504
504
  "g"
@@ -1477,7 +1477,7 @@ v.comparedTo = v.cmp = function(r) {
1477
1477
  };
1478
1478
  v.cosine = v.cos = function() {
1479
1479
  var r, s, t = this, e = t.constructor;
1480
- return t.d ? t.d[0] ? (r = e.precision, s = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t = hi(e, ze(e, t)), e.precision = r, e.rounding = s, C(nt == 2 || nt == 3 ? t.neg() : t, r, s, !0)) : new e(1) : new e(NaN);
1480
+ return t.d ? t.d[0] ? (r = e.precision, s = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t = hi(e, Xe(e, t)), e.precision = r, e.rounding = s, C(nt == 2 || nt == 3 ? t.neg() : t, r, s, !0)) : new e(1) : new e(NaN);
1481
1481
  };
1482
1482
  v.cubeRoot = v.cbrt = function() {
1483
1483
  var r, s, t, e, i, n, o, a, l, c, h = this, u = h.constructor;
@@ -1713,7 +1713,7 @@ v.round = function() {
1713
1713
  };
1714
1714
  v.sine = v.sin = function() {
1715
1715
  var r, s, t = this, e = t.constructor;
1716
- return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t = di(e, ze(e, t)), e.precision = r, e.rounding = s, C(nt > 2 ? t.neg() : t, r, s, !0)) : new e(NaN);
1716
+ return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t = di(e, Xe(e, t)), e.precision = r, e.rounding = s, C(nt > 2 ? t.neg() : t, r, s, !0)) : new e(NaN);
1717
1717
  };
1718
1718
  v.squareRoot = v.sqrt = function() {
1719
1719
  var r, s, t, e, i, n, o = this, a = o.d, l = o.e, c = o.s, h = o.constructor;
@@ -1755,15 +1755,15 @@ v.toBinary = function(r, s) {
1755
1755
  };
1756
1756
  v.toDecimalPlaces = v.toDP = function(r, s) {
1757
1757
  var t = this, e = t.constructor;
1758
- return t = new e(t), r === void 0 ? t : (U(r, 0, ut), s === void 0 ? s = e.rounding : U(s, 0, 8), C(t, r + t.e + 1, s));
1758
+ return t = new e(t), r === void 0 ? t : (G(r, 0, ut), s === void 0 ? s = e.rounding : G(s, 0, 8), C(t, r + t.e + 1, s));
1759
1759
  };
1760
1760
  v.toExponential = function(r, s) {
1761
1761
  var t, e = this, i = e.constructor;
1762
- return r === void 0 ? t = et(e, !0) : (U(r, 0, ut), s === void 0 ? s = i.rounding : U(s, 0, 8), e = C(new i(e), r + 1, s), t = et(e, !0, r + 1)), e.isNeg() && !e.isZero() ? "-" + t : t;
1762
+ return r === void 0 ? t = et(e, !0) : (G(r, 0, ut), s === void 0 ? s = i.rounding : G(s, 0, 8), e = C(new i(e), r + 1, s), t = et(e, !0, r + 1)), e.isNeg() && !e.isZero() ? "-" + t : t;
1763
1763
  };
1764
1764
  v.toFixed = function(r, s) {
1765
1765
  var t, e, i = this, n = i.constructor;
1766
- return r === void 0 ? t = et(i) : (U(r, 0, ut), s === void 0 ? s = n.rounding : U(s, 0, 8), e = C(new n(i), r + i.e + 1, s), t = et(e, !1, r + e.e + 1)), i.isNeg() && !i.isZero() ? "-" + t : t;
1766
+ return r === void 0 ? t = et(i) : (G(r, 0, ut), s === void 0 ? s = n.rounding : G(s, 0, 8), e = C(new n(i), r + i.e + 1, s), t = et(e, !1, r + e.e + 1)), i.isNeg() && !i.isZero() ? "-" + t : t;
1767
1767
  };
1768
1768
  v.toFraction = function(r) {
1769
1769
  var s, t, e, i, n, o, a, l, c, h, u, f, m = this, p = m.d, g = m.constructor;
@@ -1787,7 +1787,7 @@ v.toNearest = function(r, s) {
1787
1787
  if (!t.d) return t;
1788
1788
  r = new e(1), s = e.rounding;
1789
1789
  } else {
1790
- if (r = new e(r), s === void 0 ? s = e.rounding : U(s, 0, 8), !t.d) return r.s ? t : r;
1790
+ if (r = new e(r), s === void 0 ? s = e.rounding : G(s, 0, 8), !t.d) return r.s ? t : r;
1791
1791
  if (!r.d)
1792
1792
  return r.s && (r.s = t.s), r;
1793
1793
  }
@@ -1805,7 +1805,7 @@ v.toPower = v.pow = function(r) {
1805
1805
  if (a = new l(a), a.eq(1)) return a;
1806
1806
  if (e = l.precision, n = l.rounding, r.eq(1)) return C(a, e, n);
1807
1807
  if (s = F(r.e / S), s >= r.d.length - 1 && (t = c < 0 ? -c : c) <= li)
1808
- return i = Ge(l, a, t, e), r.s < 0 ? new l(1).div(i) : C(i, e, n);
1808
+ return i = ze(l, a, t, e), r.s < 0 ? new l(1).div(i) : C(i, e, n);
1809
1809
  if (o = a.s, o < 0) {
1810
1810
  if (s < r.d.length - 1) return new l(NaN);
1811
1811
  if (r.d[s] & 1 || (o = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
@@ -1815,11 +1815,11 @@ v.toPower = v.pow = function(r) {
1815
1815
  };
1816
1816
  v.toPrecision = function(r, s) {
1817
1817
  var t, e = this, i = e.constructor;
1818
- return r === void 0 ? t = et(e, e.e <= i.toExpNeg || e.e >= i.toExpPos) : (U(r, 1, ut), s === void 0 ? s = i.rounding : U(s, 0, 8), e = C(new i(e), r, s), t = et(e, r <= e.e || e.e <= i.toExpNeg, r)), e.isNeg() && !e.isZero() ? "-" + t : t;
1818
+ return r === void 0 ? t = et(e, e.e <= i.toExpNeg || e.e >= i.toExpPos) : (G(r, 1, ut), s === void 0 ? s = i.rounding : G(s, 0, 8), e = C(new i(e), r, s), t = et(e, r <= e.e || e.e <= i.toExpNeg, r)), e.isNeg() && !e.isZero() ? "-" + t : t;
1819
1819
  };
1820
1820
  v.toSignificantDigits = v.toSD = function(r, s) {
1821
1821
  var t = this, e = t.constructor;
1822
- return r === void 0 ? (r = e.precision, s = e.rounding) : (U(r, 1, ut), s === void 0 ? s = e.rounding : U(s, 0, 8)), C(new e(t), r, s);
1822
+ return r === void 0 ? (r = e.precision, s = e.rounding) : (G(r, 1, ut), s === void 0 ? s = e.rounding : G(s, 0, 8)), C(new e(t), r, s);
1823
1823
  };
1824
1824
  v.toString = function() {
1825
1825
  var r = this, s = r.constructor, t = et(r, r.e <= s.toExpNeg || r.e >= s.toExpPos);
@@ -1843,7 +1843,7 @@ function N(r) {
1843
1843
  for (; o % 10 === 0; ) o /= 10;
1844
1844
  return n + o;
1845
1845
  }
1846
- function U(r, s, t) {
1846
+ function G(r, s, t) {
1847
1847
  if (r !== ~~r || r < s || r > t)
1848
1848
  throw Error(ht + r);
1849
1849
  }
@@ -1895,7 +1895,7 @@ var V = /* @__PURE__ */ function() {
1895
1895
  for (; !e[0] && e.length > 1; ) e.shift();
1896
1896
  }
1897
1897
  return function(e, i, n, o, a, l) {
1898
- var c, h, u, f, m, p, g, y, w, P, b, _, A, X, At, dt, rt, vt, z, Lt, Tt = e.constructor, ne = e.s == i.s ? 1 : -1, H = e.d, O = i.d;
1898
+ var c, h, u, f, m, p, g, y, w, P, b, _, A, U, At, dt, rt, vt, X, Lt, Tt = e.constructor, ne = e.s == i.s ? 1 : -1, H = e.d, O = i.d;
1899
1899
  if (!H || !H[0] || !O || !O[0])
1900
1900
  return new Tt(
1901
1901
  // Return NaN if either NaN, or both Infinity or 0.
@@ -1904,20 +1904,20 @@ var V = /* @__PURE__ */ function() {
1904
1904
  H && H[0] == 0 || !O ? ne * 0 : ne / 0
1905
1905
  )
1906
1906
  );
1907
- for (l ? (m = 1, h = e.e - i.e) : (l = Q, m = S, h = F(e.e / m) - F(i.e / m)), z = O.length, rt = H.length, w = new Tt(ne), P = w.d = [], u = 0; O[u] == (H[u] || 0); u++) ;
1908
- if (O[u] > (H[u] || 0) && h--, n == null ? (X = n = Tt.precision, o = Tt.rounding) : a ? X = n + (e.e - i.e) + 1 : X = n, X < 0)
1907
+ for (l ? (m = 1, h = e.e - i.e) : (l = Q, m = S, h = F(e.e / m) - F(i.e / m)), X = O.length, rt = H.length, w = new Tt(ne), P = w.d = [], u = 0; O[u] == (H[u] || 0); u++) ;
1908
+ if (O[u] > (H[u] || 0) && h--, n == null ? (U = n = Tt.precision, o = Tt.rounding) : a ? U = n + (e.e - i.e) + 1 : U = n, U < 0)
1909
1909
  P.push(1), p = !0;
1910
1910
  else {
1911
- if (X = X / m + 2 | 0, u = 0, z == 1) {
1912
- for (f = 0, O = O[0], X++; (u < rt || f) && X--; u++)
1911
+ if (U = U / m + 2 | 0, u = 0, X == 1) {
1912
+ for (f = 0, O = O[0], U++; (u < rt || f) && U--; u++)
1913
1913
  At = f * l + (H[u] || 0), P[u] = At / O | 0, f = At % O | 0;
1914
1914
  p = f || u < rt;
1915
1915
  } else {
1916
- for (f = l / (O[0] + 1) | 0, f > 1 && (O = r(O, f, l), H = r(H, f, l), z = O.length, rt = H.length), dt = z, b = H.slice(0, z), _ = b.length; _ < z; ) b[_++] = 0;
1916
+ for (f = l / (O[0] + 1) | 0, f > 1 && (O = r(O, f, l), H = r(H, f, l), X = O.length, rt = H.length), dt = X, b = H.slice(0, X), _ = b.length; _ < X; ) b[_++] = 0;
1917
1917
  Lt = O.slice(), Lt.unshift(0), vt = O[0], O[1] >= l / 2 && ++vt;
1918
1918
  do
1919
- f = 0, c = s(O, b, z, _), c < 0 ? (A = b[0], z != _ && (A = A * l + (b[1] || 0)), f = A / vt | 0, f > 1 ? (f >= l && (f = l - 1), g = r(O, f, l), y = g.length, _ = b.length, c = s(g, b, y, _), c == 1 && (f--, t(g, z < y ? Lt : O, y, l))) : (f == 0 && (c = f = 1), g = O.slice()), y = g.length, y < _ && g.unshift(0), t(b, g, _, l), c == -1 && (_ = b.length, c = s(O, b, z, _), c < 1 && (f++, t(b, z < _ ? Lt : O, _, l))), _ = b.length) : c === 0 && (f++, b = [0]), P[u++] = f, c && b[0] ? b[_++] = H[dt] || 0 : (b = [H[dt]], _ = 1);
1920
- while ((dt++ < rt || b[0] !== void 0) && X--);
1919
+ f = 0, c = s(O, b, X, _), c < 0 ? (A = b[0], X != _ && (A = A * l + (b[1] || 0)), f = A / vt | 0, f > 1 ? (f >= l && (f = l - 1), g = r(O, f, l), y = g.length, _ = b.length, c = s(g, b, y, _), c == 1 && (f--, t(g, X < y ? Lt : O, y, l))) : (f == 0 && (c = f = 1), g = O.slice()), y = g.length, y < _ && g.unshift(0), t(b, g, _, l), c == -1 && (_ = b.length, c = s(O, b, X, _), c < 1 && (f++, t(b, X < _ ? Lt : O, _, l))), _ = b.length) : c === 0 && (f++, b = [0]), P[u++] = f, c && b[0] ? b[_++] = H[dt] || 0 : (b = [H[dt]], _ = 1);
1920
+ while ((dt++ < rt || b[0] !== void 0) && U--);
1921
1921
  p = b[0] !== void 0;
1922
1922
  }
1923
1923
  P[0] || P.shift();
@@ -1967,7 +1967,7 @@ function C(r, s, t, e) {
1967
1967
  return E && (r.e > m.maxE ? (r.d = null, r.e = NaN) : r.e < m.minE && (r.e = 0, r.d = [0])), r;
1968
1968
  }
1969
1969
  function et(r, s, t) {
1970
- if (!r.isFinite()) return Xe(r);
1970
+ if (!r.isFinite()) return Ue(r);
1971
1971
  var e, i = r.e, n = N(r.d), o = n.length;
1972
1972
  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;
1973
1973
  }
@@ -1997,7 +1997,7 @@ function ot(r) {
1997
1997
  for (var s = ""; r--; ) s += "0";
1998
1998
  return s;
1999
1999
  }
2000
- function Ge(r, s, t, e) {
2000
+ function ze(r, s, t, e) {
2001
2001
  var i, n = new r(1), o = Math.ceil(e / S + 4);
2002
2002
  for (E = !1; ; ) {
2003
2003
  if (t % 2 && (n = n.times(s), Ee(n.d, o) && (i = !0)), t = F(t / 2), t === 0) {
@@ -2011,7 +2011,7 @@ function Ge(r, s, t, e) {
2011
2011
  function Se(r) {
2012
2012
  return r.d[r.d.length - 1] & 1;
2013
2013
  }
2014
- function Ue(r, s, t) {
2014
+ function Ge(r, s, t) {
2015
2015
  for (var e, i, n = new r(s[0]), o = 0; ++o < s.length; ) {
2016
2016
  if (i = new r(s[o]), !i.s) {
2017
2017
  n = i;
@@ -2063,7 +2063,7 @@ function at(r, s) {
2063
2063
  l = c, i += 2;
2064
2064
  }
2065
2065
  }
2066
- function Xe(r) {
2066
+ function Ue(r) {
2067
2067
  return String(r.s * r.s / 0);
2068
2068
  }
2069
2069
  function Bt(r, s) {
@@ -2096,7 +2096,7 @@ function ui(r, s) {
2096
2096
  t = 8;
2097
2097
  else
2098
2098
  throw Error(ht + s);
2099
- 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 = Ge(e, new e(t), n, n * 2)), c = Ft(s, t, Q), h = c.length - 1, n = h; c[n] === 0; --n) c.pop();
2099
+ 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 = ze(e, new e(t), n, n * 2)), c = Ft(s, t, Q), h = c.length - 1, n = h; c[n] === 0; --n) c.pop();
2100
2100
  return n < 0 ? new e(r.s * 0) : (r.e = ie(c, h), r.d = c, E = !1, o && (r = V(r, i, a * 4)), l && (r = r.times(Math.abs(l) < 54 ? I(2, l) : R.pow(2, l))), E = !0, r);
2101
2101
  }
2102
2102
  function di(r, s) {
@@ -2123,7 +2123,7 @@ function se(r, s) {
2123
2123
  for (var t = r; --s; ) t *= r;
2124
2124
  return t;
2125
2125
  }
2126
- function ze(r, s) {
2126
+ function Xe(r, s) {
2127
2127
  var t, e = s.s < 0, i = tt(r, r.precision, 1), n = i.times(0.5);
2128
2128
  if (s = s.abs(), s.lte(n))
2129
2129
  return nt = e ? 4 : 1, s;
@@ -2138,8 +2138,8 @@ function ze(r, s) {
2138
2138
  }
2139
2139
  function ye(r, s, t, e) {
2140
2140
  var i, n, o, a, l, c, h, u, f, m = r.constructor, p = t !== void 0;
2141
- if (p ? (U(t, 1, ut), e === void 0 ? e = m.rounding : U(e, 0, 8)) : (t = m.precision, e = m.rounding), !r.isFinite())
2142
- h = Xe(r);
2141
+ if (p ? (G(t, 1, ut), e === void 0 ? e = m.rounding : G(e, 0, 8)) : (t = m.precision, e = m.rounding), !r.isFinite())
2142
+ h = Ue(r);
2143
2143
  else {
2144
2144
  for (h = et(r), o = h.indexOf("."), p ? (i = 2, s == 16 ? t = t * 4 - 3 : s == 8 && (t = t * 3 - 2)) : i = s, o >= 0 && (h = h.replace(".", ""), f = new m(1), f.e = h.length - o, f.d = Ft(et(f), 10, i), f.e = f.d.length), u = Ft(h, 10, i), n = l = u.length; u[--l] == 0; ) u.pop();
2145
2145
  if (!u[0])
@@ -2290,7 +2290,7 @@ function Ye(r) {
2290
2290
  return n < 0 ? (n = -n, c.s = -1) : c.s = 1, Bt(c, n.toString());
2291
2291
  throw Error(ht + n);
2292
2292
  }
2293
- if (i.prototype = v, i.ROUND_UP = 0, i.ROUND_DOWN = 1, i.ROUND_CEIL = 2, i.ROUND_FLOOR = 3, i.ROUND_HALF_UP = 4, i.ROUND_HALF_DOWN = 5, i.ROUND_HALF_EVEN = 6, i.ROUND_HALF_CEIL = 7, i.ROUND_HALF_FLOOR = 8, i.EUCLID = 9, i.config = i.set = Ei, i.clone = Ye, i.isDecimal = _e, i.abs = fi, i.acos = mi, i.acosh = gi, i.add = pi, i.asin = vi, i.asinh = yi, i.atan = wi, i.atanh = xi, i.atan2 = Pi, i.cbrt = bi, i.ceil = Ci, i.clamp = Si, i.cos = _i, i.cosh = Mi, i.div = Di, i.exp = Ri, i.floor = ki, i.hypot = Vi, i.ln = Oi, i.log = Ai, i.log10 = Ti, i.log2 = Li, i.max = Ii, i.min = Ni, i.mod = Hi, i.mul = Fi, i.pow = Bi, i.random = Gi, i.round = Ui, i.sign = Xi, i.sin = zi, i.sinh = Yi, i.sqrt = ji, i.sub = Wi, i.sum = qi, i.tan = $i, i.tanh = Zi, i.trunc = Qi, r === void 0 && (r = {}), r && r.defaults !== !0)
2293
+ if (i.prototype = v, i.ROUND_UP = 0, i.ROUND_DOWN = 1, i.ROUND_CEIL = 2, i.ROUND_FLOOR = 3, i.ROUND_HALF_UP = 4, i.ROUND_HALF_DOWN = 5, i.ROUND_HALF_EVEN = 6, i.ROUND_HALF_CEIL = 7, i.ROUND_HALF_FLOOR = 8, i.EUCLID = 9, i.config = i.set = Ei, i.clone = Ye, i.isDecimal = _e, i.abs = fi, i.acos = mi, i.acosh = gi, i.add = pi, i.asin = vi, i.asinh = yi, i.atan = wi, i.atanh = xi, i.atan2 = Pi, i.cbrt = bi, i.ceil = Ci, i.clamp = Si, i.cos = _i, i.cosh = Mi, i.div = Di, i.exp = Ri, i.floor = ki, i.hypot = Vi, i.ln = Oi, i.log = Ai, i.log10 = Ti, i.log2 = Li, i.max = Ii, i.min = Ni, i.mod = Hi, i.mul = Fi, i.pow = Bi, i.random = zi, i.round = Gi, i.sign = Ui, i.sin = Xi, i.sinh = Yi, i.sqrt = ji, i.sub = Wi, i.sum = qi, i.tan = $i, i.tanh = Zi, i.trunc = Qi, r === void 0 && (r = {}), r && r.defaults !== !0)
2294
2294
  for (e = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], s = 0; s < e.length; ) r.hasOwnProperty(t = e[s++]) || (r[t] = this[t]);
2295
2295
  return i.config(r), i;
2296
2296
  }
@@ -2331,10 +2331,10 @@ function Ti(r) {
2331
2331
  return new this(r).log(10);
2332
2332
  }
2333
2333
  function Ii() {
2334
- return Ue(this, arguments, -1);
2334
+ return Ge(this, arguments, -1);
2335
2335
  }
2336
2336
  function Ni() {
2337
- return Ue(this, arguments, 1);
2337
+ return Ge(this, arguments, 1);
2338
2338
  }
2339
2339
  function Hi(r, s) {
2340
2340
  return new this(r).mod(s);
@@ -2345,9 +2345,9 @@ function Fi(r, s) {
2345
2345
  function Bi(r, s) {
2346
2346
  return new this(r).pow(s);
2347
2347
  }
2348
- function Gi(r) {
2348
+ function zi(r) {
2349
2349
  var s, t, e, i, n = 0, o = new this(1), a = [];
2350
- if (r === void 0 ? r = this.precision : U(r, 1, ut), e = Math.ceil(r / S), this.crypto)
2350
+ if (r === void 0 ? r = this.precision : G(r, 1, ut), e = Math.ceil(r / S), this.crypto)
2351
2351
  if (crypto.getRandomValues)
2352
2352
  for (s = crypto.getRandomValues(new Uint32Array(e)); n < e; )
2353
2353
  i = s[n], i >= 429e7 ? s[n] = crypto.getRandomValues(new Uint32Array(1))[0] : a[n++] = i % 1e7;
@@ -2368,13 +2368,13 @@ function Gi(r) {
2368
2368
  }
2369
2369
  return o.e = t, o.d = a, o;
2370
2370
  }
2371
- function Ui(r) {
2371
+ function Gi(r) {
2372
2372
  return C(r = new this(r), r.e + 1, this.rounding);
2373
2373
  }
2374
- function Xi(r) {
2374
+ function Ui(r) {
2375
2375
  return r = new this(r), r.d ? r.d[0] ? r.s : 0 * r.s : r.s || NaN;
2376
2376
  }
2377
- function zi(r) {
2377
+ function Xi(r) {
2378
2378
  return new this(r).sin();
2379
2379
  }
2380
2380
  function Yi(r) {
@@ -3606,7 +3606,7 @@ class D extends Vt {
3606
3606
  }
3607
3607
  }
3608
3608
  d(D, "ctx", document.createElement("canvas").getContext("2d"));
3609
- class Gt extends D {
3609
+ class zt extends D {
3610
3610
  constructor(t) {
3611
3611
  super(t);
3612
3612
  d(this, "_draw");
@@ -3714,7 +3714,7 @@ class k {
3714
3714
  return new R(s).div(t).toNumber();
3715
3715
  }
3716
3716
  }
3717
- class Ut extends D {
3717
+ class Gt extends D {
3718
3718
  constructor(t) {
3719
3719
  super(t);
3720
3720
  /** 文字偏差 */
@@ -4145,7 +4145,7 @@ function oe(r, s) {
4145
4145
  const { x: t, y: e } = $e(...r, ...s);
4146
4146
  return [t, e];
4147
4147
  }
4148
- class Xt extends je {
4148
+ class Ut extends je {
4149
4149
  constructor(t) {
4150
4150
  super(t);
4151
4151
  d(this, "_isInfinite");
@@ -4293,7 +4293,7 @@ function os(r, s, t, e) {
4293
4293
  }
4294
4294
  return m && p;
4295
4295
  }
4296
- class zt extends je {
4296
+ class Xt extends je {
4297
4297
  constructor(t) {
4298
4298
  super(t);
4299
4299
  d(this, "_isRect", !1);
@@ -5009,7 +5009,7 @@ class ls extends ns {
5009
5009
  if (a !== h) return h - a;
5010
5010
  if (l !== u)
5011
5011
  return u - l;
5012
- const m = (p) => p instanceof Gt ? 5 : p instanceof Ut ? 4 : p instanceof lt ? 3 : p instanceof Xt || p instanceof Yt || p instanceof jt ? 2 : p instanceof zt ? 1 : 0;
5012
+ const m = (p) => p instanceof zt ? 5 : p instanceof Gt ? 4 : p instanceof lt ? 3 : p instanceof Ut || p instanceof Yt || p instanceof jt ? 2 : p instanceof Xt ? 1 : 0;
5013
5013
  return m(f) - m(c);
5014
5014
  }
5015
5015
  ), this.currentDrawOverlays = t.map(
@@ -5304,8 +5304,13 @@ class Y extends Vt {
5304
5304
  super(t);
5305
5305
  /** 覆盖物集合 */
5306
5306
  d(this, "overlays", /* @__PURE__ */ new Set());
5307
+ d(this, "oldOverlaysSize", 0);
5307
5308
  this.setNotifyReload(t.notifyReload);
5308
5309
  }
5310
+ get overlaysSizeChange() {
5311
+ const t = this.oldOverlaysSize;
5312
+ return this.oldOverlaysSize = this.overlays.size, this.overlays.size !== t;
5313
+ }
5309
5314
  /** 设置主画布 */
5310
5315
  setMainCanvas(t) {
5311
5316
  var e;
@@ -5316,7 +5321,7 @@ class Y extends Vt {
5316
5321
  /** 设置覆盖物重新绘制方法 */
5317
5322
  setNotifyReload(t) {
5318
5323
  this.notifyReload = t ? (e) => {
5319
- e && (this.isRecalculate = !0), (e || this.shouldRender() && this.overlays.size) && t();
5324
+ e && (this.isRecalculate = !0), (e || this.overlaysSizeChange || this.shouldRender() && this.overlays.size) && t();
5320
5325
  } : void 0, this.overlays.forEach(
5321
5326
  (e) => e.setNotifyReload(this.notifyReload)
5322
5327
  );
@@ -5367,6 +5372,7 @@ class j extends Vt {
5367
5372
  /** 是否需要重新绘制 */
5368
5373
  d(this, "isReload", !1);
5369
5374
  d(this, "groups", /* @__PURE__ */ new Map());
5375
+ d(this, "oldGroupsSize", 0);
5370
5376
  /** 本次绘制的覆盖物 */
5371
5377
  d(this, "currentDrawOverlays", []);
5372
5378
  this.setNotifyReload(t.notifyReload), typeof t.zIndex == "number" && (this.zIndex = t.zIndex);
@@ -5379,6 +5385,10 @@ class j extends Vt {
5379
5385
  var e;
5380
5386
  this._zIndex != t && (this._zIndex = t, (e = this.notifyReload) == null || e.call(this));
5381
5387
  }
5388
+ get groupsSizeChange() {
5389
+ const t = this.oldGroupsSize;
5390
+ return this.oldGroupsSize = this.groups.size, this.groups.size !== t;
5391
+ }
5382
5392
  setMainCanvas(t) {
5383
5393
  super.setMainCanvas(t), this.canvas.width = (t == null ? void 0 : t.rect.width) || 0, this.canvas.height = (t == null ? void 0 : t.rect.height) || 0, this.groups.forEach((e) => {
5384
5394
  e.setMainCanvas(t), e.parent = this;
@@ -5386,7 +5396,7 @@ class j extends Vt {
5386
5396
  }
5387
5397
  setNotifyReload(t) {
5388
5398
  this.notifyReload = t ? (e) => {
5389
- e && (this.isRecalculate = !0), (e || this.shouldRender() && this.groups.size) && t();
5399
+ e && (this.isRecalculate = !0), (e || this.groupsSizeChange || this.shouldRender() && this.groups.size) && t();
5390
5400
  } : void 0, this.groups.forEach((e) => this.setGroupNotifyReload(e));
5391
5401
  }
5392
5402
  setGroupNotifyReload(t) {
@@ -5448,6 +5458,7 @@ class Rt extends Vt {
5448
5458
  super(t);
5449
5459
  /** 图层群组 */
5450
5460
  d(this, "layers", /* @__PURE__ */ new Map());
5461
+ d(this, "oldLlayersSize", 0);
5451
5462
  /** 地图的事件触发不需要传递 */
5452
5463
  d(this, "defaultContextmenu", (t, e) => t.stopPropagation());
5453
5464
  d(this, "defaultClick", (t, e) => t.stopPropagation());
@@ -5457,6 +5468,10 @@ class Rt extends Vt {
5457
5468
  d(this, "defaultDown", (t, e) => t.stopPropagation());
5458
5469
  this.inheritOpacity = !1, this.setNotifyReload(t.notifyReload), this.addEventListener("contextmenu", this.defaultContextmenu), this.addEventListener("click", this.defaultClick), this.addEventListener("doubleClick", this.defaultDoubleClick), this.addEventListener("hover", this.defaultHover), this.addEventListener("dragg", this.defaultDragg), this.addEventListener("down", this.defaultDown);
5459
5470
  }
5471
+ get layersSizeChange() {
5472
+ const t = this.oldLlayersSize;
5473
+ return this.oldLlayersSize = this.layers.size, this.layers.size !== t;
5474
+ }
5460
5475
  setMainCanvas(t) {
5461
5476
  super.setMainCanvas(t), this.layers.forEach((e) => {
5462
5477
  e.setMainCanvas(t), e.parent = this;
@@ -5464,7 +5479,7 @@ class Rt extends Vt {
5464
5479
  }
5465
5480
  setNotifyReload(t) {
5466
5481
  this.notifyReload = t ? (e) => {
5467
- e && (this.isRecalculate = !0), (e || this.shouldRender() && this.layers.size) && t();
5482
+ e && (this.isRecalculate = !0), (e || this.layersSizeChange || this.shouldRender() && this.layers.size) && t();
5468
5483
  } : void 0, this.layers.forEach((e) => e.setNotifyReload(this.notifyReload));
5469
5484
  }
5470
5485
  /** 获取图层 */
@@ -5641,8 +5656,8 @@ class ds extends us {
5641
5656
  const _ = Math.ceil(g / w);
5642
5657
  b = 1 - ((y * _ / g - a.min) / a.min + (_ - 2)) * P;
5643
5658
  } else {
5644
- const _ = (dt, rt, vt) => dt < rt ? vt - 1 : _(dt / 2, rt, vt + 1), A = _(w, g, 0), X = Math.pow(2, A);
5645
- b = 1 + ((y / X / g - a.min) / a.min + A) * P;
5659
+ const _ = (dt, rt, vt) => dt < rt ? vt - 1 : _(dt / 2, rt, vt + 1), A = _(w, g, 0), U = Math.pow(2, A);
5660
+ b = 1 + ((y / U / g - a.min) / a.min + A) * P;
5646
5661
  }
5647
5662
  return i !== void 0 && (b = Math.min(i, b)), b = new R(b).div(o).round().mul(o).toNumber(), b;
5648
5663
  }
@@ -6254,7 +6269,7 @@ class T extends gs {
6254
6269
  overlays_other: c
6255
6270
  } = this.getDefaultOverlayGroup() || {};
6256
6271
  Ht(t).forEach((h) => {
6257
- h instanceof Ut ? e == null || e.addOverlay(h) : h instanceof lt ? i == null || i.addOverlay(h) : h instanceof Xt || h instanceof Yt || h instanceof jt ? n == null || n.addOverlay(h) : h instanceof zt ? o == null || o.addOverlay(h) : h instanceof Gt ? a == null || a.addOverlay(h) : h instanceof ae ? l == null || l.addOverlay(h) : c == null || c.addOverlay(h);
6272
+ h instanceof Gt ? e == null || e.addOverlay(h) : h instanceof lt ? i == null || i.addOverlay(h) : h instanceof Ut || h instanceof Yt || h instanceof jt ? n == null || n.addOverlay(h) : h instanceof Xt ? o == null || o.addOverlay(h) : h instanceof zt ? a == null || a.addOverlay(h) : h instanceof ae ? l == null || l.addOverlay(h) : c == null || c.addOverlay(h);
6258
6273
  });
6259
6274
  }
6260
6275
  /** 移除覆盖物 */
@@ -6269,7 +6284,7 @@ class T extends gs {
6269
6284
  overlays_other: c
6270
6285
  } = this.getDefaultOverlayGroup() || {};
6271
6286
  Ht(t).forEach((h) => {
6272
- h instanceof Ut ? e == null || e.removeOverlay(h) : h instanceof lt ? i == null || i.removeOverlay(h) : h instanceof Xt || h instanceof Yt || h instanceof jt ? n == null || n.removeOverlay(h) : h instanceof zt ? o == null || o.removeOverlay(h) : h instanceof Gt ? a == null || a.addOverlay(h) : h instanceof ae ? l == null || l.removeOverlay(h) : c == null || c.removeOverlay(h);
6287
+ h instanceof Gt ? e == null || e.removeOverlay(h) : h instanceof lt ? i == null || i.removeOverlay(h) : h instanceof Ut || h instanceof Yt || h instanceof jt ? n == null || n.removeOverlay(h) : h instanceof Xt ? o == null || o.removeOverlay(h) : h instanceof zt ? a == null || a.addOverlay(h) : h instanceof ae ? l == null || l.removeOverlay(h) : c == null || c.removeOverlay(h);
6273
6288
  });
6274
6289
  }
6275
6290
  /** 销毁 */
@@ -6282,11 +6297,11 @@ d(T, "ViewFit", ys), /** 图层群组 */
6282
6297
  d(T, "LayerGroup", Rt), /** 图层 */
6283
6298
  d(T, "Layer", j), /** 覆盖物群组 */
6284
6299
  d(T, "OverlayGroup", Y), /** 文字 */
6285
- d(T, "Text", Ut), /** 点位 */
6300
+ d(T, "Text", Gt), /** 点位 */
6286
6301
  d(T, "Point", lt), /** 线段 */
6287
- d(T, "Line", Xt), /** 多边形 */
6288
- d(T, "Polygon", zt), /** 自定义绘制 */
6289
- d(T, "Custom", Gt), /** 圆弧 */
6302
+ d(T, "Line", Ut), /** 多边形 */
6303
+ d(T, "Polygon", Xt), /** 自定义绘制 */
6304
+ d(T, "Custom", zt), /** 圆弧 */
6290
6305
  d(T, "Arc", Yt), /** 圆角 */
6291
6306
  d(T, "ArcTo", jt), /** 图片 */
6292
6307
  d(T, "Billboard", ae);
@@ -6901,7 +6916,7 @@ class wn {
6901
6916
  }
6902
6917
  }
6903
6918
  W = new WeakMap(), ft = new WeakMap(), mt = new WeakMap(), xt = new WeakMap(), Pt = new WeakMap(), J = new WeakMap(), K = new WeakMap(), st = new WeakMap(), bt = new WeakMap();
6904
- var q, gt, pt, Ct, St, $, Z, G, Et, _t;
6919
+ var q, gt, pt, Ct, St, $, Z, z, Et, _t;
6905
6920
  class xn {
6906
6921
  constructor() {
6907
6922
  L(this, q);
@@ -6911,12 +6926,12 @@ class xn {
6911
6926
  L(this, St, 0);
6912
6927
  L(this, $, 0);
6913
6928
  L(this, Z, 0);
6914
- L(this, G);
6929
+ L(this, z);
6915
6930
  L(this, Et);
6916
6931
  L(this, _t);
6917
6932
  }
6918
6933
  init(s, t = {}) {
6919
- this.finish(), M(this, q, s), M(this, G, t.limit), M(this, Et, t.update_move), M(this, _t, t.update_up), M(this, pt, {
6934
+ this.finish(), M(this, q, s), M(this, z, t.limit), M(this, Et, t.update_move), M(this, _t, t.update_up), M(this, pt, {
6920
6935
  mousedown: this.mousedown.bind(this),
6921
6936
  mousemove: this.mousemove.bind(this),
6922
6937
  mouseup: this.mouseup.bind(this)
@@ -6936,8 +6951,8 @@ class xn {
6936
6951
  left: x(this, Z),
6937
6952
  percentage: { top: 0, left: 0 }
6938
6953
  };
6939
- if (x(this, G)) {
6940
- const t = (e) => x(this, G) ? (s[e] - x(this, G).min[e]) / (x(this, G).max[e] - x(this, G).min[e]) : 0;
6954
+ if (x(this, z)) {
6955
+ const t = (e) => x(this, z) ? (s[e] - x(this, z).min[e]) / (x(this, z).max[e] - x(this, z).min[e]) : 0;
6941
6956
  s.percentage = {
6942
6957
  top: t("top") || 0,
6943
6958
  left: t("left") || 0
@@ -6947,7 +6962,7 @@ class xn {
6947
6962
  }
6948
6963
  alterLocation() {
6949
6964
  if (!x(this, q)) return console.error("No DOM");
6950
- x(this, G) && (M(this, $, Math.min(x(this, $), x(this, G).max.top)), M(this, $, Math.max(x(this, $), x(this, G).min.top)), M(this, Z, Math.min(x(this, Z), x(this, G).max.left)), M(this, Z, Math.max(x(this, Z), x(this, G).min.left))), x(this, Et) && x(this, Et).call(this, this.updateValue()), x(this, q).style.setProperty("--top", x(this, $) + "px"), x(this, q).style.setProperty("--left", x(this, Z) + "px");
6965
+ x(this, z) && (M(this, $, Math.min(x(this, $), x(this, z).max.top)), M(this, $, Math.max(x(this, $), x(this, z).min.top)), M(this, Z, Math.min(x(this, Z), x(this, z).max.left)), M(this, Z, Math.max(x(this, Z), x(this, z).min.left))), x(this, Et) && x(this, Et).call(this, this.updateValue()), x(this, q).style.setProperty("--top", x(this, $) + "px"), x(this, q).style.setProperty("--left", x(this, Z) + "px");
6951
6966
  }
6952
6967
  mousedown(s) {
6953
6968
  if (!x(this, q)) return console.error("No DOM");
@@ -6965,7 +6980,7 @@ class xn {
6965
6980
  x(this, gt) && (M(this, gt, !1), document.body.classList.remove("no-select"), x(this, _t) && x(this, _t).call(this, this.updateValue()));
6966
6981
  }
6967
6982
  }
6968
- q = new WeakMap(), gt = new WeakMap(), pt = new WeakMap(), Ct = new WeakMap(), St = new WeakMap(), $ = new WeakMap(), Z = new WeakMap(), G = new WeakMap(), Et = new WeakMap(), _t = new WeakMap();
6983
+ q = new WeakMap(), gt = new WeakMap(), pt = new WeakMap(), Ct = new WeakMap(), St = new WeakMap(), $ = new WeakMap(), Z = new WeakMap(), z = new WeakMap(), Et = new WeakMap(), _t = new WeakMap();
6969
6984
  function Pn(r, s) {
6970
6985
  if (typeof r == "number") return r;
6971
6986
  if (/px/.test(r)) return Number(r.replace(/px/, "")) || 0;
@@ -7304,15 +7319,15 @@ export {
7304
7319
  _n as _File_CreateAndDownload,
7305
7320
  _s as _File_Download,
7306
7321
  En as _File_Read,
7307
- Xs as _Format_CamelCase,
7322
+ Us as _Format_CamelCase,
7308
7323
  Fs as _Format_CapitalizeFirstLetter,
7309
7324
  Ws as _Format_ChunkArray,
7310
- zs as _Format_ExcludeSubstring,
7311
- Us as _Format_FileSize,
7325
+ Xs as _Format_ExcludeSubstring,
7326
+ Gs as _Format_FileSize,
7312
7327
  ce as _Format_HrefName,
7313
7328
  js as _Format_MillisecondToReadable,
7314
7329
  le as _Format_NumberWithCommas,
7315
- Gs as _Format_NumberWithUnit,
7330
+ zs as _Format_NumberWithUnit,
7316
7331
  Bs as _Format_Percentage,
7317
7332
  ti as _Format_Timestamp,
7318
7333
  Ys as _Format_ToggleInvisibleChars,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nhanh-pure-function",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "纯函数工具",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",