vue3-calculator
Version:
A Vue 3 calculator component with scientific and standard modes
2,082 lines • 90 kB
JavaScript
import { ref as O, computed as ve, defineComponent as ft, watch as dt, onMounted as vt, onUnmounted as ht, createElementBlock as U, openBlock as x, createElementVNode as v, createCommentVNode as J, createVNode as Te, toDisplayString as pe, normalizeStyle as mt, normalizeClass as Ve, createStaticVNode as De, Transition as Oe, withCtx as Re, withModifiers as Ze, Fragment as Ue, renderList as xe, nextTick as pt } from "vue";
/*!
* decimal.js v10.6.0
* An arbitrary-precision Decimal type for JavaScript.
* https://github.com/MikeMcl/decimal.js
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
* MIT Licence
*/
var he = 9e15, ae = 1e9, ze = "0123456789abcdef", ke = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", Ne = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", Le = {
// These values must be integers within the stated ranges (inclusive).
// Most of these values can be changed at run-time using the `Decimal.config` method.
// The maximum number of significant digits of the result of a calculation or base conversion.
// E.g. `Decimal.config({ precision: 20 });`
precision: 20,
// 1 to MAX_DIGITS
// The rounding mode used when rounding to `precision`.
//
// ROUND_UP 0 Away from zero.
// ROUND_DOWN 1 Towards zero.
// ROUND_CEIL 2 Towards +Infinity.
// ROUND_FLOOR 3 Towards -Infinity.
// ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
// ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
// ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
// ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
// ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
//
// E.g.
// `Decimal.rounding = 4;`
// `Decimal.rounding = Decimal.ROUND_HALF_UP;`
rounding: 4,
// 0 to 8
// The modulo mode used when calculating the modulus: a mod n.
// The quotient (q = a / n) is calculated according to the corresponding rounding mode.
// The remainder (r) is calculated as: r = a - n * q.
//
// UP 0 The remainder is positive if the dividend is negative, else is negative.
// DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
// FLOOR 3 The remainder has the same sign as the divisor (Python %).
// HALF_EVEN 6 The IEEE 754 remainder function.
// EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
//
// Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
// division (9) are commonly used for the modulus operation. The other rounding modes can also
// be used, but they may not give useful results.
modulo: 1,
// 0 to 9
// The exponent value at and beneath which `toString` returns exponential notation.
// JavaScript numbers: -7
toExpNeg: -7,
// 0 to -EXP_LIMIT
// The exponent value at and above which `toString` returns exponential notation.
// JavaScript numbers: 21
toExpPos: 21,
// 0 to EXP_LIMIT
// The minimum exponent value, beneath which underflow to zero occurs.
// JavaScript numbers: -324 (5e-324)
minE: -he,
// -1 to -EXP_LIMIT
// The maximum exponent value, above which overflow to Infinity occurs.
// JavaScript numbers: 308 (1.7976931348623157e+308)
maxE: he,
// 1 to EXP_LIMIT
// Whether to use cryptographically-secure random number generation, if available.
crypto: !1
// true/false
}, Je, ee, y = !0, Me = "[DecimalError] ", ue = Me + "Invalid argument: ", Ke = Me + "Precision limit exceeded", je = Me + "crypto unavailable", Qe = "[object Decimal]", R = Math.floor, P = Math.pow, gt = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, wt = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, bt = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, Ye = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, X = 1e7, k = 7, kt = 9007199254740991, Nt = ke.length - 1, He = Ne.length - 1, m = { toStringTag: Qe };
m.absoluteValue = m.abs = function() {
var e = new this.constructor(this);
return e.s < 0 && (e.s = 1), w(e);
};
m.ceil = function() {
return w(new this.constructor(this), this.e + 1, 2);
};
m.clampedTo = m.clamp = function(e, t) {
var n, i = this, r = i.constructor;
if (e = new r(e), t = new r(t), !e.s || !t.s) return new r(NaN);
if (e.gt(t)) throw Error(ue + t);
return n = i.cmp(e), n < 0 ? e : i.cmp(t) > 0 ? t : new r(i);
};
m.comparedTo = m.cmp = function(e) {
var t, n, i, r, o = this, s = o.d, l = (e = new o.constructor(e)).d, a = o.s, u = e.s;
if (!s || !l)
return !a || !u ? NaN : a !== u ? a : s === l ? 0 : !s ^ a < 0 ? 1 : -1;
if (!s[0] || !l[0]) return s[0] ? a : l[0] ? -u : 0;
if (a !== u) return a;
if (o.e !== e.e) return o.e > e.e ^ a < 0 ? 1 : -1;
for (i = s.length, r = l.length, t = 0, n = i < r ? i : r; t < n; ++t)
if (s[t] !== l[t]) return s[t] > l[t] ^ a < 0 ? 1 : -1;
return i === r ? 0 : i > r ^ a < 0 ? 1 : -1;
};
m.cosine = m.cos = function() {
var e, t, n = this, i = n.constructor;
return n.d ? n.d[0] ? (e = i.precision, t = i.rounding, i.precision = e + Math.max(n.e, n.sd()) + k, i.rounding = 1, n = Ct(i, rt(i, n)), i.precision = e, i.rounding = t, w(ee == 2 || ee == 3 ? n.neg() : n, e, t, !0)) : new i(1) : new i(NaN);
};
m.cubeRoot = m.cbrt = function() {
var e, t, n, i, r, o, s, l, a, u, c = this, d = c.constructor;
if (!c.isFinite() || c.isZero()) return new d(c);
for (y = !1, o = c.s * P(c.s * c, 1 / 3), !o || Math.abs(o) == 1 / 0 ? (n = D(c.d), e = c.e, (o = (e - n.length + 1) % 3) && (n += o == 1 || o == -2 ? "0" : "00"), o = P(n, 1 / 3), e = R((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)), o == 1 / 0 ? n = "5e" + e : (n = o.toExponential(), n = n.slice(0, n.indexOf("e") + 1) + e), i = new d(n), i.s = c.s) : i = new d(o.toString()), s = (e = d.precision) + 3; ; )
if (l = i, a = l.times(l).times(l), u = a.plus(c), i = F(u.plus(c).times(l), u.plus(a), s + 2, 1), D(l.d).slice(0, s) === (n = D(i.d)).slice(0, s))
if (n = n.slice(s - 3, s + 1), n == "9999" || !r && n == "4999") {
if (!r && (w(l, e + 1, 0), l.times(l).times(l).eq(c))) {
i = l;
break;
}
s += 4, r = 1;
} else {
(!+n || !+n.slice(1) && n.charAt(0) == "5") && (w(i, e + 1, 1), t = !i.times(i).times(i).eq(c));
break;
}
return y = !0, w(i, e, d.rounding, t);
};
m.decimalPlaces = m.dp = function() {
var e, t = this.d, n = NaN;
if (t) {
if (e = t.length - 1, n = (e - R(this.e / k)) * k, e = t[e], e) for (; e % 10 == 0; e /= 10) n--;
n < 0 && (n = 0);
}
return n;
};
m.dividedBy = m.div = function(e) {
return F(this, new this.constructor(e));
};
m.dividedToIntegerBy = m.divToInt = function(e) {
var t = this, n = t.constructor;
return w(F(t, new n(e), 0, 1, 1), n.precision, n.rounding);
};
m.equals = m.eq = function(e) {
return this.cmp(e) === 0;
};
m.floor = function() {
return w(new this.constructor(this), this.e + 1, 3);
};
m.greaterThan = m.gt = function(e) {
return this.cmp(e) > 0;
};
m.greaterThanOrEqualTo = m.gte = function(e) {
var t = this.cmp(e);
return t == 1 || t === 0;
};
m.hyperbolicCosine = m.cosh = function() {
var e, t, n, i, r, o = this, s = o.constructor, l = new s(1);
if (!o.isFinite()) return new s(o.s ? 1 / 0 : NaN);
if (o.isZero()) return l;
n = s.precision, i = s.rounding, s.precision = n + Math.max(o.e, o.sd()) + 4, s.rounding = 1, r = o.d.length, r < 32 ? (e = Math.ceil(r / 3), t = (1 / Ee(4, e)).toString()) : (e = 16, t = "2.3283064365386962890625e-10"), o = me(s, 1, o.times(t), new s(1), !0);
for (var a, u = e, c = new s(8); u--; )
a = o.times(o), o = l.minus(a.times(c.minus(a.times(c))));
return w(o, s.precision = n, s.rounding = i, !0);
};
m.hyperbolicSine = m.sinh = function() {
var e, t, n, i, r = this, o = r.constructor;
if (!r.isFinite() || r.isZero()) return new o(r);
if (t = o.precision, n = o.rounding, o.precision = t + Math.max(r.e, r.sd()) + 4, o.rounding = 1, i = r.d.length, i < 3)
r = me(o, 2, r, r, !0);
else {
e = 1.4 * Math.sqrt(i), e = e > 16 ? 16 : e | 0, r = r.times(1 / Ee(5, e)), r = me(o, 2, r, r, !0);
for (var s, l = new o(5), a = new o(16), u = new o(20); e--; )
s = r.times(r), r = r.times(l.plus(s.times(a.times(s).plus(u))));
}
return o.precision = t, o.rounding = n, w(r, t, n, !0);
};
m.hyperbolicTangent = m.tanh = function() {
var e, t, n = this, i = n.constructor;
return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 7, i.rounding = 1, F(n.sinh(), n.cosh(), i.precision = e, i.rounding = t)) : new i(n.s);
};
m.inverseCosine = m.acos = function() {
var e = this, t = e.constructor, n = e.abs().cmp(1), i = t.precision, r = t.rounding;
return n !== -1 ? n === 0 ? e.isNeg() ? K(t, i, r) : new t(0) : new t(NaN) : e.isZero() ? K(t, i + 4, r).times(0.5) : (t.precision = i + 6, t.rounding = 1, e = new t(1).minus(e).div(e.plus(1)).sqrt().atan(), t.precision = i, t.rounding = r, e.times(2));
};
m.inverseHyperbolicCosine = m.acosh = function() {
var e, t, n = this, i = n.constructor;
return n.lte(1) ? new i(n.eq(1) ? 0 : NaN) : n.isFinite() ? (e = i.precision, t = i.rounding, i.precision = e + Math.max(Math.abs(n.e), n.sd()) + 4, i.rounding = 1, y = !1, n = n.times(n).minus(1).sqrt().plus(n), y = !0, i.precision = e, i.rounding = t, n.ln()) : new i(n);
};
m.inverseHyperbolicSine = m.asinh = function() {
var e, t, n = this, i = n.constructor;
return !n.isFinite() || n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 2 * Math.max(Math.abs(n.e), n.sd()) + 6, i.rounding = 1, y = !1, n = n.times(n).plus(1).sqrt().plus(n), y = !0, i.precision = e, i.rounding = t, n.ln());
};
m.inverseHyperbolicTangent = m.atanh = function() {
var e, t, n, i, r = this, o = r.constructor;
return r.isFinite() ? r.e >= 0 ? new o(r.abs().eq(1) ? r.s / 0 : r.isZero() ? r : NaN) : (e = o.precision, t = o.rounding, i = r.sd(), Math.max(i, e) < 2 * -r.e - 1 ? w(new o(r), e, t, !0) : (o.precision = n = i - r.e, r = F(r.plus(1), new o(1).minus(r), n + e, 1), o.precision = e + 4, o.rounding = 1, r = r.ln(), o.precision = e, o.rounding = t, r.times(0.5))) : new o(NaN);
};
m.inverseSine = m.asin = function() {
var e, t, n, i, r = this, o = r.constructor;
return r.isZero() ? new o(r) : (t = r.abs().cmp(1), n = o.precision, i = o.rounding, t !== -1 ? t === 0 ? (e = K(o, n + 4, i).times(0.5), e.s = r.s, e) : new o(NaN) : (o.precision = n + 6, o.rounding = 1, r = r.div(new o(1).minus(r.times(r)).sqrt().plus(1)).atan(), o.precision = n, o.rounding = i, r.times(2)));
};
m.inverseTangent = m.atan = function() {
var e, t, n, i, r, o, s, l, a, u = this, c = u.constructor, d = c.precision, h = c.rounding;
if (u.isFinite()) {
if (u.isZero())
return new c(u);
if (u.abs().eq(1) && d + 4 <= He)
return s = K(c, d + 4, h).times(0.25), s.s = u.s, s;
} else {
if (!u.s) return new c(NaN);
if (d + 4 <= He)
return s = K(c, d + 4, h).times(0.5), s.s = u.s, s;
}
for (c.precision = l = d + 10, c.rounding = 1, n = Math.min(28, l / k + 2 | 0), e = n; e; --e) u = u.div(u.times(u).plus(1).sqrt().plus(1));
for (y = !1, t = Math.ceil(l / k), i = 1, a = u.times(u), s = new c(u), r = u; e !== -1; )
if (r = r.times(a), o = s.minus(r.div(i += 2)), r = r.times(a), s = o.plus(r.div(i += 2)), s.d[t] !== void 0) for (e = t; s.d[e] === o.d[e] && e--; ) ;
return n && (s = s.times(2 << n - 1)), y = !0, w(s, c.precision = d, c.rounding = h, !0);
};
m.isFinite = function() {
return !!this.d;
};
m.isInteger = m.isInt = function() {
return !!this.d && R(this.e / k) > this.d.length - 2;
};
m.isNaN = function() {
return !this.s;
};
m.isNegative = m.isNeg = function() {
return this.s < 0;
};
m.isPositive = m.isPos = function() {
return this.s > 0;
};
m.isZero = function() {
return !!this.d && this.d[0] === 0;
};
m.lessThan = m.lt = function(e) {
return this.cmp(e) < 0;
};
m.lessThanOrEqualTo = m.lte = function(e) {
return this.cmp(e) < 1;
};
m.logarithm = m.log = function(e) {
var t, n, i, r, o, s, l, a, u = this, c = u.constructor, d = c.precision, h = c.rounding, g = 5;
if (e == null)
e = new c(10), t = !0;
else {
if (e = new c(e), n = e.d, e.s < 0 || !n || !n[0] || e.eq(1)) return new c(NaN);
t = e.eq(10);
}
if (n = u.d, u.s < 0 || !n || !n[0] || u.eq(1))
return new c(n && !n[0] ? -1 / 0 : u.s != 1 ? NaN : n ? 0 : 1 / 0);
if (t)
if (n.length > 1)
o = !0;
else {
for (r = n[0]; r % 10 === 0; ) r /= 10;
o = r !== 1;
}
if (y = !1, l = d + g, s = le(u, l), i = t ? Ce(c, l + 10) : le(e, l), a = F(s, i, l, 1), ge(a.d, r = d, h))
do
if (l += 10, s = le(u, l), i = t ? Ce(c, l + 10) : le(e, l), a = F(s, i, l, 1), !o) {
+D(a.d).slice(r + 1, r + 15) + 1 == 1e14 && (a = w(a, d + 1, 0));
break;
}
while (ge(a.d, r += 10, h));
return y = !0, w(a, d, h);
};
m.minus = m.sub = function(e) {
var t, n, i, r, o, s, l, a, u, c, d, h, g = this, M = g.constructor;
if (e = new M(e), !g.d || !e.d)
return !g.s || !e.s ? e = new M(NaN) : g.d ? e.s = -e.s : e = new M(e.d || g.s !== e.s ? g : NaN), e;
if (g.s != e.s)
return e.s = -e.s, g.plus(e);
if (u = g.d, h = e.d, l = M.precision, a = M.rounding, !u[0] || !h[0]) {
if (h[0]) e.s = -e.s;
else if (u[0]) e = new M(g);
else return new M(a === 3 ? -0 : 0);
return y ? w(e, l, a) : e;
}
if (n = R(e.e / k), c = R(g.e / k), u = u.slice(), o = c - n, o) {
for (d = o < 0, d ? (t = u, o = -o, s = h.length) : (t = h, n = c, s = u.length), i = Math.max(Math.ceil(l / k), s) + 2, o > i && (o = i, t.length = 1), t.reverse(), i = o; i--; ) t.push(0);
t.reverse();
} else {
for (i = u.length, s = h.length, d = i < s, d && (s = i), i = 0; i < s; i++)
if (u[i] != h[i]) {
d = u[i] < h[i];
break;
}
o = 0;
}
for (d && (t = u, u = h, h = t, e.s = -e.s), s = u.length, i = h.length - s; i > 0; --i) u[s++] = 0;
for (i = h.length; i > o; ) {
if (u[--i] < h[i]) {
for (r = i; r && u[--r] === 0; ) u[r] = X - 1;
--u[r], u[i] += X;
}
u[i] -= h[i];
}
for (; u[--s] === 0; ) u.pop();
for (; u[0] === 0; u.shift()) --n;
return u[0] ? (e.d = u, e.e = ye(u, n), y ? w(e, l, a) : e) : new M(a === 3 ? -0 : 0);
};
m.modulo = m.mod = function(e) {
var t, n = this, i = n.constructor;
return e = new i(e), !n.d || !e.s || e.d && !e.d[0] ? new i(NaN) : !e.d || n.d && !n.d[0] ? w(new i(n), i.precision, i.rounding) : (y = !1, i.modulo == 9 ? (t = F(n, e.abs(), 0, 3, 1), t.s *= e.s) : t = F(n, e, 0, i.modulo, 1), t = t.times(e), y = !0, n.minus(t));
};
m.naturalExponential = m.exp = function() {
return $e(this);
};
m.naturalLogarithm = m.ln = function() {
return le(this);
};
m.negated = m.neg = function() {
var e = new this.constructor(this);
return e.s = -e.s, w(e);
};
m.plus = m.add = function(e) {
var t, n, i, r, o, s, l, a, u, c, d = this, h = d.constructor;
if (e = new h(e), !d.d || !e.d)
return !d.s || !e.s ? e = new h(NaN) : d.d || (e = new h(e.d || d.s === e.s ? d : NaN)), e;
if (d.s != e.s)
return e.s = -e.s, d.minus(e);
if (u = d.d, c = e.d, l = h.precision, a = h.rounding, !u[0] || !c[0])
return c[0] || (e = new h(d)), y ? w(e, l, a) : e;
if (o = R(d.e / k), i = R(e.e / k), u = u.slice(), r = o - i, r) {
for (r < 0 ? (n = u, r = -r, s = c.length) : (n = c, i = o, s = u.length), o = Math.ceil(l / k), s = o > s ? o + 1 : s + 1, r > s && (r = s, n.length = 1), n.reverse(); r--; ) n.push(0);
n.reverse();
}
for (s = u.length, r = c.length, s - r < 0 && (r = s, n = c, c = u, u = n), t = 0; r; )
t = (u[--r] = u[r] + c[r] + t) / X | 0, u[r] %= X;
for (t && (u.unshift(t), ++i), s = u.length; u[--s] == 0; ) u.pop();
return e.d = u, e.e = ye(u, i), y ? w(e, l, a) : e;
};
m.precision = m.sd = function(e) {
var t, n = this;
if (e !== void 0 && e !== !!e && e !== 1 && e !== 0) throw Error(ue + e);
return n.d ? (t = et(n.d), e && n.e + 1 > t && (t = n.e + 1)) : t = NaN, t;
};
m.round = function() {
var e = this, t = e.constructor;
return w(new t(e), e.e + 1, t.rounding);
};
m.sine = m.sin = function() {
var e, t, n = this, i = n.constructor;
return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + Math.max(n.e, n.sd()) + k, i.rounding = 1, n = yt(i, rt(i, n)), i.precision = e, i.rounding = t, w(ee > 2 ? n.neg() : n, e, t, !0)) : new i(NaN);
};
m.squareRoot = m.sqrt = function() {
var e, t, n, i, r, o, s = this, l = s.d, a = s.e, u = s.s, c = s.constructor;
if (u !== 1 || !l || !l[0])
return new c(!u || u < 0 && (!l || l[0]) ? NaN : l ? s : 1 / 0);
for (y = !1, u = Math.sqrt(+s), u == 0 || u == 1 / 0 ? (t = D(l), (t.length + a) % 2 == 0 && (t += "0"), u = Math.sqrt(t), a = R((a + 1) / 2) - (a < 0 || a % 2), u == 1 / 0 ? t = "5e" + a : (t = u.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + a), i = new c(t)) : i = new c(u.toString()), n = (a = c.precision) + 3; ; )
if (o = i, i = o.plus(F(s, o, n + 2, 1)).times(0.5), D(o.d).slice(0, n) === (t = D(i.d)).slice(0, n))
if (t = t.slice(n - 3, n + 1), t == "9999" || !r && t == "4999") {
if (!r && (w(o, a + 1, 0), o.times(o).eq(s))) {
i = o;
break;
}
n += 4, r = 1;
} else {
(!+t || !+t.slice(1) && t.charAt(0) == "5") && (w(i, a + 1, 1), e = !i.times(i).eq(s));
break;
}
return y = !0, w(i, a, c.rounding, e);
};
m.tangent = m.tan = function() {
var e, t, n = this, i = n.constructor;
return n.isFinite() ? n.isZero() ? new i(n) : (e = i.precision, t = i.rounding, i.precision = e + 10, i.rounding = 1, n = n.sin(), n.s = 1, n = F(n, new i(1).minus(n.times(n)).sqrt(), e + 10, 0), i.precision = e, i.rounding = t, w(ee == 2 || ee == 4 ? n.neg() : n, e, t, !0)) : new i(NaN);
};
m.times = m.mul = function(e) {
var t, n, i, r, o, s, l, a, u, c = this, d = c.constructor, h = c.d, g = (e = new d(e)).d;
if (e.s *= c.s, !h || !h[0] || !g || !g[0])
return new d(!e.s || h && !h[0] && !g || g && !g[0] && !h ? NaN : !h || !g ? e.s / 0 : e.s * 0);
for (n = R(c.e / k) + R(e.e / k), a = h.length, u = g.length, a < u && (o = h, h = g, g = o, s = a, a = u, u = s), o = [], s = a + u, i = s; i--; ) o.push(0);
for (i = u; --i >= 0; ) {
for (t = 0, r = a + i; r > i; )
l = o[r] + g[i] * h[r - i - 1] + t, o[r--] = l % X | 0, t = l / X | 0;
o[r] = (o[r] + t) % X | 0;
}
for (; !o[--s]; ) o.pop();
return t ? ++n : o.shift(), e.d = o, e.e = ye(o, n), y ? w(e, d.precision, d.rounding) : e;
};
m.toBinary = function(e, t) {
return qe(this, 2, e, t);
};
m.toDecimalPlaces = m.toDP = function(e, t) {
var n = this, i = n.constructor;
return n = new i(n), e === void 0 ? n : (W(e, 0, ae), t === void 0 ? t = i.rounding : W(t, 0, 8), w(n, e + n.e + 1, t));
};
m.toExponential = function(e, t) {
var n, i = this, r = i.constructor;
return e === void 0 ? n = j(i, !0) : (W(e, 0, ae), t === void 0 ? t = r.rounding : W(t, 0, 8), i = w(new r(i), e + 1, t), n = j(i, !0, e + 1)), i.isNeg() && !i.isZero() ? "-" + n : n;
};
m.toFixed = function(e, t) {
var n, i, r = this, o = r.constructor;
return e === void 0 ? n = j(r) : (W(e, 0, ae), t === void 0 ? t = o.rounding : W(t, 0, 8), i = w(new o(r), e + r.e + 1, t), n = j(i, !1, e + i.e + 1)), r.isNeg() && !r.isZero() ? "-" + n : n;
};
m.toFraction = function(e) {
var t, n, i, r, o, s, l, a, u, c, d, h, g = this, M = g.d, N = g.constructor;
if (!M) return new N(g);
if (u = n = new N(1), i = a = new N(0), t = new N(i), o = t.e = et(M) - g.e - 1, s = o % k, t.d[0] = P(10, s < 0 ? k + s : s), e == null)
e = o > 0 ? t : u;
else {
if (l = new N(e), !l.isInt() || l.lt(u)) throw Error(ue + l);
e = l.gt(t) ? o > 0 ? t : u : l;
}
for (y = !1, l = new N(D(M)), c = N.precision, N.precision = o = M.length * k * 2; d = F(l, t, 0, 1, 1), r = n.plus(d.times(i)), r.cmp(e) != 1; )
n = i, i = r, r = u, u = a.plus(d.times(r)), a = r, r = t, t = l.minus(d.times(r)), l = r;
return r = F(e.minus(n), i, 0, 1, 1), a = a.plus(r.times(u)), n = n.plus(r.times(i)), a.s = u.s = g.s, h = F(u, i, o, 1).minus(g).abs().cmp(F(a, n, o, 1).minus(g).abs()) < 1 ? [u, i] : [a, n], N.precision = c, y = !0, h;
};
m.toHexadecimal = m.toHex = function(e, t) {
return qe(this, 16, e, t);
};
m.toNearest = function(e, t) {
var n = this, i = n.constructor;
if (n = new i(n), e == null) {
if (!n.d) return n;
e = new i(1), t = i.rounding;
} else {
if (e = new i(e), t === void 0 ? t = i.rounding : W(t, 0, 8), !n.d) return e.s ? n : e;
if (!e.d)
return e.s && (e.s = n.s), e;
}
return e.d[0] ? (y = !1, n = F(n, e, 0, t, 1).times(e), y = !0, w(n)) : (e.s = n.s, n = e), n;
};
m.toNumber = function() {
return +this;
};
m.toOctal = function(e, t) {
return qe(this, 8, e, t);
};
m.toPower = m.pow = function(e) {
var t, n, i, r, o, s, l = this, a = l.constructor, u = +(e = new a(e));
if (!l.d || !e.d || !l.d[0] || !e.d[0]) return new a(P(+l, u));
if (l = new a(l), l.eq(1)) return l;
if (i = a.precision, o = a.rounding, e.eq(1)) return w(l, i, o);
if (t = R(e.e / k), t >= e.d.length - 1 && (n = u < 0 ? -u : u) <= kt)
return r = tt(a, l, n, i), e.s < 0 ? new a(1).div(r) : w(r, i, o);
if (s = l.s, s < 0) {
if (t < e.d.length - 1) return new a(NaN);
if ((e.d[t] & 1) == 0 && (s = 1), l.e == 0 && l.d[0] == 1 && l.d.length == 1)
return l.s = s, l;
}
return n = P(+l, u), t = n == 0 || !isFinite(n) ? R(u * (Math.log("0." + D(l.d)) / Math.LN10 + l.e + 1)) : new a(n + "").e, t > a.maxE + 1 || t < a.minE - 1 ? new a(t > 0 ? s / 0 : 0) : (y = !1, a.rounding = l.s = 1, n = Math.min(12, (t + "").length), r = $e(e.times(le(l, i + n)), i), r.d && (r = w(r, i + 5, 1), ge(r.d, i, o) && (t = i + 10, r = w($e(e.times(le(l, t + n)), t), t + 5, 1), +D(r.d).slice(i + 1, i + 15) + 1 == 1e14 && (r = w(r, i + 1, 0)))), r.s = s, y = !0, a.rounding = o, w(r, i, o));
};
m.toPrecision = function(e, t) {
var n, i = this, r = i.constructor;
return e === void 0 ? n = j(i, i.e <= r.toExpNeg || i.e >= r.toExpPos) : (W(e, 1, ae), t === void 0 ? t = r.rounding : W(t, 0, 8), i = w(new r(i), e, t), n = j(i, e <= i.e || i.e <= r.toExpNeg, e)), i.isNeg() && !i.isZero() ? "-" + n : n;
};
m.toSignificantDigits = m.toSD = function(e, t) {
var n = this, i = n.constructor;
return e === void 0 ? (e = i.precision, t = i.rounding) : (W(e, 1, ae), t === void 0 ? t = i.rounding : W(t, 0, 8)), w(new i(n), e, t);
};
m.toString = function() {
var e = this, t = e.constructor, n = j(e, e.e <= t.toExpNeg || e.e >= t.toExpPos);
return e.isNeg() && !e.isZero() ? "-" + n : n;
};
m.truncated = m.trunc = function() {
return w(new this.constructor(this), this.e + 1, 1);
};
m.valueOf = m.toJSON = function() {
var e = this, t = e.constructor, n = j(e, e.e <= t.toExpNeg || e.e >= t.toExpPos);
return e.isNeg() ? "-" + n : n;
};
function D(e) {
var t, n, i, r = e.length - 1, o = "", s = e[0];
if (r > 0) {
for (o += s, t = 1; t < r; t++)
i = e[t] + "", n = k - i.length, n && (o += se(n)), o += i;
s = e[t], i = s + "", n = k - i.length, n && (o += se(n));
} else if (s === 0)
return "0";
for (; s % 10 === 0; ) s /= 10;
return o + s;
}
function W(e, t, n) {
if (e !== ~~e || e < t || e > n)
throw Error(ue + e);
}
function ge(e, t, n, i) {
var r, o, s, l;
for (o = e[0]; o >= 10; o /= 10) --t;
return --t < 0 ? (t += k, r = 0) : (r = Math.ceil((t + 1) / k), t %= k), o = P(10, k - t), l = e[r] % o | 0, i == null ? t < 3 ? (t == 0 ? l = l / 100 | 0 : t == 1 && (l = l / 10 | 0), s = n < 4 && l == 99999 || n > 3 && l == 49999 || l == 5e4 || l == 0) : s = (n < 4 && l + 1 == o || n > 3 && l + 1 == o / 2) && (e[r + 1] / o / 100 | 0) == P(10, t - 2) - 1 || (l == o / 2 || l == 0) && (e[r + 1] / o / 100 | 0) == 0 : t < 4 ? (t == 0 ? l = l / 1e3 | 0 : t == 1 ? l = l / 100 | 0 : t == 2 && (l = l / 10 | 0), s = (i || n < 4) && l == 9999 || !i && n > 3 && l == 4999) : s = ((i || n < 4) && l + 1 == o || !i && n > 3 && l + 1 == o / 2) && (e[r + 1] / o / 1e3 | 0) == P(10, t - 3) - 1, s;
}
function we(e, t, n) {
for (var i, r = [0], o, s = 0, l = e.length; s < l; ) {
for (o = r.length; o--; ) r[o] *= t;
for (r[0] += ze.indexOf(e.charAt(s++)), i = 0; i < r.length; i++)
r[i] > n - 1 && (r[i + 1] === void 0 && (r[i + 1] = 0), r[i + 1] += r[i] / n | 0, r[i] %= n);
}
return r.reverse();
}
function Ct(e, t) {
var n, i, r;
if (t.isZero()) return t;
i = t.d.length, i < 32 ? (n = Math.ceil(i / 3), r = (1 / Ee(4, n)).toString()) : (n = 16, r = "2.3283064365386962890625e-10"), e.precision += n, t = me(e, 1, t.times(r), new e(1));
for (var o = n; o--; ) {
var s = t.times(t);
t = s.times(s).minus(s).times(8).plus(1);
}
return e.precision -= n, t;
}
var F = /* @__PURE__ */ function() {
function e(i, r, o) {
var s, l = 0, a = i.length;
for (i = i.slice(); a--; )
s = i[a] * r + l, i[a] = s % o | 0, l = s / o | 0;
return l && i.unshift(l), i;
}
function t(i, r, o, s) {
var l, a;
if (o != s)
a = o > s ? 1 : -1;
else
for (l = a = 0; l < o; l++)
if (i[l] != r[l]) {
a = i[l] > r[l] ? 1 : -1;
break;
}
return a;
}
function n(i, r, o, s) {
for (var l = 0; o--; )
i[o] -= l, l = i[o] < r[o] ? 1 : 0, i[o] = l * s + i[o] - r[o];
for (; !i[0] && i.length > 1; ) i.shift();
}
return function(i, r, o, s, l, a) {
var u, c, d, h, g, M, N, $, z, B, V, A, te, _, ce, ne, Q, fe, Z, ie, re = i.constructor, Y = i.s == r.s ? 1 : -1, q = i.d, p = r.d;
if (!q || !q[0] || !p || !p[0])
return new re(
// Return NaN if either NaN, or both Infinity or 0.
!i.s || !r.s || (q ? p && q[0] == p[0] : !p) ? NaN : (
// Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
q && q[0] == 0 || !p ? Y * 0 : Y / 0
)
);
for (a ? (g = 1, c = i.e - r.e) : (a = X, g = k, c = R(i.e / g) - R(r.e / g)), Z = p.length, Q = q.length, z = new re(Y), B = z.d = [], d = 0; p[d] == (q[d] || 0); d++) ;
if (p[d] > (q[d] || 0) && c--, o == null ? (_ = o = re.precision, s = re.rounding) : l ? _ = o + (i.e - r.e) + 1 : _ = o, _ < 0)
B.push(1), M = !0;
else {
if (_ = _ / g + 2 | 0, d = 0, Z == 1) {
for (h = 0, p = p[0], _++; (d < Q || h) && _--; d++)
ce = h * a + (q[d] || 0), B[d] = ce / p | 0, h = ce % p | 0;
M = h || d < Q;
} else {
for (h = a / (p[0] + 1) | 0, h > 1 && (p = e(p, h, a), q = e(q, h, a), Z = p.length, Q = q.length), ne = Z, V = q.slice(0, Z), A = V.length; A < Z; ) V[A++] = 0;
ie = p.slice(), ie.unshift(0), fe = p[0], p[1] >= a / 2 && ++fe;
do
h = 0, u = t(p, V, Z, A), u < 0 ? (te = V[0], Z != A && (te = te * a + (V[1] || 0)), h = te / fe | 0, h > 1 ? (h >= a && (h = a - 1), N = e(p, h, a), $ = N.length, A = V.length, u = t(N, V, $, A), u == 1 && (h--, n(N, Z < $ ? ie : p, $, a))) : (h == 0 && (u = h = 1), N = p.slice()), $ = N.length, $ < A && N.unshift(0), n(V, N, A, a), u == -1 && (A = V.length, u = t(p, V, Z, A), u < 1 && (h++, n(V, Z < A ? ie : p, A, a))), A = V.length) : u === 0 && (h++, V = [0]), B[d++] = h, u && V[0] ? V[A++] = q[ne] || 0 : (V = [q[ne]], A = 1);
while ((ne++ < Q || V[0] !== void 0) && _--);
M = V[0] !== void 0;
}
B[0] || B.shift();
}
if (g == 1)
z.e = c, Je = M;
else {
for (d = 1, h = B[0]; h >= 10; h /= 10) d++;
z.e = d + c * g - 1, w(z, l ? o + z.e + 1 : o, s, M);
}
return z;
};
}();
function w(e, t, n, i) {
var r, o, s, l, a, u, c, d, h, g = e.constructor;
e: if (t != null) {
if (d = e.d, !d) return e;
for (r = 1, l = d[0]; l >= 10; l /= 10) r++;
if (o = t - r, o < 0)
o += k, s = t, c = d[h = 0], a = c / P(10, r - s - 1) % 10 | 0;
else if (h = Math.ceil((o + 1) / k), l = d.length, h >= l)
if (i) {
for (; l++ <= h; ) d.push(0);
c = a = 0, r = 1, o %= k, s = o - k + 1;
} else
break e;
else {
for (c = l = d[h], r = 1; l >= 10; l /= 10) r++;
o %= k, s = o - k + r, a = s < 0 ? 0 : c / P(10, r - s - 1) % 10 | 0;
}
if (i = i || t < 0 || d[h + 1] !== void 0 || (s < 0 ? c : c % P(10, r - s - 1)), u = n < 4 ? (a || i) && (n == 0 || n == (e.s < 0 ? 3 : 2)) : a > 5 || a == 5 && (n == 4 || i || n == 6 && // Check whether the digit to the left of the rounding digit is odd.
(o > 0 ? s > 0 ? c / P(10, r - s) : 0 : d[h - 1]) % 10 & 1 || n == (e.s < 0 ? 8 : 7)), t < 1 || !d[0])
return d.length = 0, u ? (t -= e.e + 1, d[0] = P(10, (k - t % k) % k), e.e = -t || 0) : d[0] = e.e = 0, e;
if (o == 0 ? (d.length = h, l = 1, h--) : (d.length = h + 1, l = P(10, k - o), d[h] = s > 0 ? (c / P(10, r - s) % P(10, s) | 0) * l : 0), u)
for (; ; )
if (h == 0) {
for (o = 1, s = d[0]; s >= 10; s /= 10) o++;
for (s = d[0] += l, l = 1; s >= 10; s /= 10) l++;
o != l && (e.e++, d[0] == X && (d[0] = 1));
break;
} else {
if (d[h] += l, d[h] != X) break;
d[h--] = 0, l = 1;
}
for (o = d.length; d[--o] === 0; ) d.pop();
}
return y && (e.e > g.maxE ? (e.d = null, e.e = NaN) : e.e < g.minE && (e.e = 0, e.d = [0])), e;
}
function j(e, t, n) {
if (!e.isFinite()) return it(e);
var i, r = e.e, o = D(e.d), s = o.length;
return t ? (n && (i = n - s) > 0 ? o = o.charAt(0) + "." + o.slice(1) + se(i) : s > 1 && (o = o.charAt(0) + "." + o.slice(1)), o = o + (e.e < 0 ? "e" : "e+") + e.e) : r < 0 ? (o = "0." + se(-r - 1) + o, n && (i = n - s) > 0 && (o += se(i))) : r >= s ? (o += se(r + 1 - s), n && (i = n - r - 1) > 0 && (o = o + "." + se(i))) : ((i = r + 1) < s && (o = o.slice(0, i) + "." + o.slice(i)), n && (i = n - s) > 0 && (r + 1 === s && (o += "."), o += se(i))), o;
}
function ye(e, t) {
var n = e[0];
for (t *= k; n >= 10; n /= 10) t++;
return t;
}
function Ce(e, t, n) {
if (t > Nt)
throw y = !0, n && (e.precision = n), Error(Ke);
return w(new e(ke), t, 1, !0);
}
function K(e, t, n) {
if (t > He) throw Error(Ke);
return w(new e(Ne), t, n, !0);
}
function et(e) {
var t = e.length - 1, n = t * k + 1;
if (t = e[t], t) {
for (; t % 10 == 0; t /= 10) n--;
for (t = e[0]; t >= 10; t /= 10) n++;
}
return n;
}
function se(e) {
for (var t = ""; e--; ) t += "0";
return t;
}
function tt(e, t, n, i) {
var r, o = new e(1), s = Math.ceil(i / k + 4);
for (y = !1; ; ) {
if (n % 2 && (o = o.times(t), _e(o.d, s) && (r = !0)), n = R(n / 2), n === 0) {
n = o.d.length - 1, r && o.d[n] === 0 && ++o.d[n];
break;
}
t = t.times(t), _e(t.d, s);
}
return y = !0, o;
}
function We(e) {
return e.d[e.d.length - 1] & 1;
}
function nt(e, t, n) {
for (var i, r, o = new e(t[0]), s = 0; ++s < t.length; ) {
if (r = new e(t[s]), !r.s) {
o = r;
break;
}
i = o.cmp(r), (i === n || i === 0 && o.s === n) && (o = r);
}
return o;
}
function $e(e, t) {
var n, i, r, o, s, l, a, u = 0, c = 0, d = 0, h = e.constructor, g = h.rounding, M = h.precision;
if (!e.d || !e.d[0] || e.e > 17)
return new h(e.d ? e.d[0] ? e.s < 0 ? 0 : 1 / 0 : 1 : e.s ? e.s < 0 ? 0 : e : NaN);
for (t == null ? (y = !1, a = M) : a = t, l = new h(0.03125); e.e > -2; )
e = e.times(l), d += 5;
for (i = Math.log(P(2, d)) / Math.LN10 * 2 + 5 | 0, a += i, n = o = s = new h(1), h.precision = a; ; ) {
if (o = w(o.times(e), a, 1), n = n.times(++c), l = s.plus(F(o, n, a, 1)), D(l.d).slice(0, a) === D(s.d).slice(0, a)) {
for (r = d; r--; ) s = w(s.times(s), a, 1);
if (t == null)
if (u < 3 && ge(s.d, a - i, g, u))
h.precision = a += 10, n = o = l = new h(1), c = 0, u++;
else
return w(s, h.precision = M, g, y = !0);
else
return h.precision = M, s;
}
s = l;
}
}
function le(e, t) {
var n, i, r, o, s, l, a, u, c, d, h, g = 1, M = 10, N = e, $ = N.d, z = N.constructor, B = z.rounding, V = z.precision;
if (N.s < 0 || !$ || !$[0] || !N.e && $[0] == 1 && $.length == 1)
return new z($ && !$[0] ? -1 / 0 : N.s != 1 ? NaN : $ ? 0 : N);
if (t == null ? (y = !1, c = V) : c = t, z.precision = c += M, n = D($), i = n.charAt(0), Math.abs(o = N.e) < 15e14) {
for (; i < 7 && i != 1 || i == 1 && n.charAt(1) > 3; )
N = N.times(e), n = D(N.d), i = n.charAt(0), g++;
o = N.e, i > 1 ? (N = new z("0." + n), o++) : N = new z(i + "." + n.slice(1));
} else
return u = Ce(z, c + 2, V).times(o + ""), N = le(new z(i + "." + n.slice(1)), c - M).plus(u), z.precision = V, t == null ? w(N, V, B, y = !0) : N;
for (d = N, a = s = N = F(N.minus(1), N.plus(1), c, 1), h = w(N.times(N), c, 1), r = 3; ; ) {
if (s = w(s.times(h), c, 1), u = a.plus(F(s, new z(r), c, 1)), D(u.d).slice(0, c) === D(a.d).slice(0, c))
if (a = a.times(2), o !== 0 && (a = a.plus(Ce(z, c + 2, V).times(o + ""))), a = F(a, new z(g), c, 1), t == null)
if (ge(a.d, c - M, B, l))
z.precision = c += M, u = s = N = F(d.minus(1), d.plus(1), c, 1), h = w(N.times(N), c, 1), r = l = 1;
else
return w(a, z.precision = V, B, y = !0);
else
return z.precision = V, a;
a = u, r += 2;
}
}
function it(e) {
return String(e.s * e.s / 0);
}
function be(e, t) {
var n, i, r;
for ((n = t.indexOf(".")) > -1 && (t = t.replace(".", "")), (i = t.search(/e/i)) > 0 ? (n < 0 && (n = i), n += +t.slice(i + 1), t = t.substring(0, i)) : n < 0 && (n = t.length), i = 0; t.charCodeAt(i) === 48; i++) ;
for (r = t.length; t.charCodeAt(r - 1) === 48; --r) ;
if (t = t.slice(i, r), t) {
if (r -= i, e.e = n = n - i - 1, e.d = [], i = (n + 1) % k, n < 0 && (i += k), i < r) {
for (i && e.d.push(+t.slice(0, i)), r -= k; i < r; ) e.d.push(+t.slice(i, i += k));
t = t.slice(i), i = k - t.length;
} else
i -= r;
for (; i--; ) t += "0";
e.d.push(+t), y && (e.e > e.constructor.maxE ? (e.d = null, e.e = NaN) : e.e < e.constructor.minE && (e.e = 0, e.d = [0]));
} else
e.e = 0, e.d = [0];
return e;
}
function Mt(e, t) {
var n, i, r, o, s, l, a, u, c;
if (t.indexOf("_") > -1) {
if (t = t.replace(/(\d)_(?=\d)/g, "$1"), Ye.test(t)) return be(e, t);
} else if (t === "Infinity" || t === "NaN")
return +t || (e.s = NaN), e.e = NaN, e.d = null, e;
if (wt.test(t))
n = 16, t = t.toLowerCase();
else if (gt.test(t))
n = 2;
else if (bt.test(t))
n = 8;
else
throw Error(ue + t);
for (o = t.search(/p/i), o > 0 ? (a = +t.slice(o + 1), t = t.substring(2, o)) : t = t.slice(2), o = t.indexOf("."), s = o >= 0, i = e.constructor, s && (t = t.replace(".", ""), l = t.length, o = l - o, r = tt(i, new i(n), o, o * 2)), u = we(t, n, X), c = u.length - 1, o = c; u[o] === 0; --o) u.pop();
return o < 0 ? new i(e.s * 0) : (e.e = ye(u, c), e.d = u, y = !1, s && (e = F(e, r, l * 4)), a && (e = e.times(Math.abs(a) < 54 ? P(2, a) : S.pow(2, a))), y = !0, e);
}
function yt(e, t) {
var n, i = t.d.length;
if (i < 3)
return t.isZero() ? t : me(e, 2, t, t);
n = 1.4 * Math.sqrt(i), n = n > 16 ? 16 : n | 0, t = t.times(1 / Ee(5, n)), t = me(e, 2, t, t);
for (var r, o = new e(5), s = new e(16), l = new e(20); n--; )
r = t.times(t), t = t.times(o.plus(r.times(s.times(r).minus(l))));
return t;
}
function me(e, t, n, i, r) {
var o, s, l, a, u = e.precision, c = Math.ceil(u / k);
for (y = !1, a = n.times(n), l = new e(i); ; ) {
if (s = F(l.times(a), new e(t++ * t++), u, 1), l = r ? i.plus(s) : i.minus(s), i = F(s.times(a), new e(t++ * t++), u, 1), s = l.plus(i), s.d[c] !== void 0) {
for (o = c; s.d[o] === l.d[o] && o--; ) ;
if (o == -1) break;
}
o = l, l = i, i = s, s = o;
}
return y = !0, s.d.length = c + 1, s;
}
function Ee(e, t) {
for (var n = e; --t; ) n *= e;
return n;
}
function rt(e, t) {
var n, i = t.s < 0, r = K(e, e.precision, 1), o = r.times(0.5);
if (t = t.abs(), t.lte(o))
return ee = i ? 4 : 1, t;
if (n = t.divToInt(r), n.isZero())
ee = i ? 3 : 2;
else {
if (t = t.minus(n.times(r)), t.lte(o))
return ee = We(n) ? i ? 2 : 3 : i ? 4 : 1, t;
ee = We(n) ? i ? 1 : 4 : i ? 3 : 2;
}
return t.minus(r).abs();
}
function qe(e, t, n, i) {
var r, o, s, l, a, u, c, d, h, g = e.constructor, M = n !== void 0;
if (M ? (W(n, 1, ae), i === void 0 ? i = g.rounding : W(i, 0, 8)) : (n = g.precision, i = g.rounding), !e.isFinite())
c = it(e);
else {
for (c = j(e), s = c.indexOf("."), M ? (r = 2, t == 16 ? n = n * 4 - 3 : t == 8 && (n = n * 3 - 2)) : r = t, s >= 0 && (c = c.replace(".", ""), h = new g(1), h.e = c.length - s, h.d = we(j(h), 10, r), h.e = h.d.length), d = we(c, 10, r), o = a = d.length; d[--a] == 0; ) d.pop();
if (!d[0])
c = M ? "0p+0" : "0";
else {
if (s < 0 ? o-- : (e = new g(e), e.d = d, e.e = o, e = F(e, h, n, i, 0, r), d = e.d, o = e.e, u = Je), s = d[n], l = r / 2, u = u || d[n + 1] !== void 0, u = i < 4 ? (s !== void 0 || u) && (i === 0 || i === (e.s < 0 ? 3 : 2)) : s > l || s === l && (i === 4 || u || i === 6 && d[n - 1] & 1 || i === (e.s < 0 ? 8 : 7)), d.length = n, u)
for (; ++d[--n] > r - 1; )
d[n] = 0, n || (++o, d.unshift(1));
for (a = d.length; !d[a - 1]; --a) ;
for (s = 0, c = ""; s < a; s++) c += ze.charAt(d[s]);
if (M) {
if (a > 1)
if (t == 16 || t == 8) {
for (s = t == 16 ? 4 : 3, --a; a % s; a++) c += "0";
for (d = we(c, r, t), a = d.length; !d[a - 1]; --a) ;
for (s = 1, c = "1."; s < a; s++) c += ze.charAt(d[s]);
} else
c = c.charAt(0) + "." + c.slice(1);
c = c + (o < 0 ? "p" : "p+") + o;
} else if (o < 0) {
for (; ++o; ) c = "0" + c;
c = "0." + c;
} else if (++o > a) for (o -= a; o--; ) c += "0";
else o < a && (c = c.slice(0, o) + "." + c.slice(o));
}
c = (t == 16 ? "0x" : t == 2 ? "0b" : t == 8 ? "0o" : "") + c;
}
return e.s < 0 ? "-" + c : c;
}
function _e(e, t) {
if (e.length > t)
return e.length = t, !0;
}
function Et(e) {
return new this(e).abs();
}
function St(e) {
return new this(e).acos();
}
function Vt(e) {
return new this(e).acosh();
}
function zt(e, t) {
return new this(e).plus(t);
}
function Lt(e) {
return new this(e).asin();
}
function Ht(e) {
return new this(e).asinh();
}
function $t(e) {
return new this(e).atan();
}
function Ft(e) {
return new this(e).atanh();
}
function qt(e, t) {
e = new this(e), t = new this(t);
var n, i = this.precision, r = this.rounding, o = i + 4;
return !e.s || !t.s ? n = new this(NaN) : !e.d && !t.d ? (n = K(this, o, 1).times(t.s > 0 ? 0.25 : 0.75), n.s = e.s) : !t.d || e.isZero() ? (n = t.s < 0 ? K(this, i, r) : new this(0), n.s = e.s) : !e.d || t.isZero() ? (n = K(this, o, 1).times(0.5), n.s = e.s) : t.s < 0 ? (this.precision = o, this.rounding = 1, n = this.atan(F(e, t, o, 1)), t = K(this, o, 1), this.precision = i, this.rounding = r, n = e.s < 0 ? n.minus(t) : n.plus(t)) : n = this.atan(F(e, t, o, 1)), n;
}
function At(e) {
return new this(e).cbrt();
}
function Bt(e) {
return w(e = new this(e), e.e + 1, 2);
}
function It(e, t, n) {
return new this(e).clamp(t, n);
}
function Pt(e) {
if (!e || typeof e != "object") throw Error(Me + "Object expected");
var t, n, i, r = e.defaults === !0, o = [
"precision",
1,
ae,
"rounding",
0,
8,
"toExpNeg",
-he,
0,
"toExpPos",
0,
he,
"maxE",
0,
he,
"minE",
-he,
0,
"modulo",
0,
9
];
for (t = 0; t < o.length; t += 3)
if (n = o[t], r && (this[n] = Le[n]), (i = e[n]) !== void 0)
if (R(i) === i && i >= o[t + 1] && i <= o[t + 2]) this[n] = i;
else throw Error(ue + n + ": " + i);
if (n = "crypto", r && (this[n] = Le[n]), (i = e[n]) !== void 0)
if (i === !0 || i === !1 || i === 0 || i === 1)
if (i)
if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
this[n] = !0;
else
throw Error(je);
else
this[n] = !1;
else
throw Error(ue + n + ": " + i);
return this;
}
function Tt(e) {
return new this(e).cos();
}
function Dt(e) {
return new this(e).cosh();
}
function ot(e) {
var t, n, i;
function r(o) {
var s, l, a, u = this;
if (!(u instanceof r)) return new r(o);
if (u.constructor = r, Ge(o)) {
u.s = o.s, y ? !o.d || o.e > r.maxE ? (u.e = NaN, u.d = null) : o.e < r.minE ? (u.e = 0, u.d = [0]) : (u.e = o.e, u.d = o.d.slice()) : (u.e = o.e, u.d = o.d ? o.d.slice() : o.d);
return;
}
if (a = typeof o, a === "number") {
if (o === 0) {
u.s = 1 / o < 0 ? -1 : 1, u.e = 0, u.d = [0];
return;
}
if (o < 0 ? (o = -o, u.s = -1) : u.s = 1, o === ~~o && o < 1e7) {
for (s = 0, l = o; l >= 10; l /= 10) s++;
y ? s > r.maxE ? (u.e = NaN, u.d = null) : s < r.minE ? (u.e = 0, u.d = [0]) : (u.e = s, u.d = [o]) : (u.e = s, u.d = [o]);
return;
}
if (o * 0 !== 0) {
o || (u.s = NaN), u.e = NaN, u.d = null;
return;
}
return be(u, o.toString());
}
if (a === "string")
return (l = o.charCodeAt(0)) === 45 ? (o = o.slice(1), u.s = -1) : (l === 43 && (o = o.slice(1)), u.s = 1), Ye.test(o) ? be(u, o) : Mt(u, o);
if (a === "bigint")
return o < 0 ? (o = -o, u.s = -1) : u.s = 1, be(u, o.toString());
throw Error(ue + o);
}
if (r.prototype = m, r.ROUND_UP = 0, r.ROUND_DOWN = 1, r.ROUND_CEIL = 2, r.ROUND_FLOOR = 3, r.ROUND_HALF_UP = 4, r.ROUND_HALF_DOWN = 5, r.ROUND_HALF_EVEN = 6, r.ROUND_HALF_CEIL = 7, r.ROUND_HALF_FLOOR = 8, r.EUCLID = 9, r.config = r.set = Pt, r.clone = ot, r.isDecimal = Ge, r.abs = Et, r.acos = St, r.acosh = Vt, r.add = zt, r.asin = Lt, r.asinh = Ht, r.atan = $t, r.atanh = Ft, r.atan2 = qt, r.cbrt = At, r.ceil = Bt, r.clamp = It, r.cos = Tt, r.cosh = Dt, r.div = Ot, r.exp = Rt, r.floor = Zt, r.hypot = Ut, r.ln = xt, r.log = Wt, r.log10 = Gt, r.log2 = _t, r.max = Xt, r.min = Jt, r.mod = Kt, r.mul = jt, r.pow = Qt, r.random = Yt, r.round = en, r.sign = tn, r.sin = nn, r.sinh = rn, r.sqrt = on, r.sub = sn, r.sum = ln, r.tan = un, r.tanh = an, r.trunc = cn, e === void 0 && (e = {}), e && e.defaults !== !0)
for (i = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], t = 0; t < i.length; ) e.hasOwnProperty(n = i[t++]) || (e[n] = this[n]);
return r.config(e), r;
}
function Ot(e, t) {
return new this(e).div(t);
}
function Rt(e) {
return new this(e).exp();
}
function Zt(e) {
return w(e = new this(e), e.e + 1, 3);
}
function Ut() {
var e, t, n = new this(0);
for (y = !1, e = 0; e < arguments.length; )
if (t = new this(arguments[e++]), t.d)
n.d && (n = n.plus(t.times(t)));
else {
if (t.s)
return y = !0, new this(1 / 0);
n = t;
}
return y = !0, n.sqrt();
}
function Ge(e) {
return e instanceof S || e && e.toStringTag === Qe || !1;
}
function xt(e) {
return new this(e).ln();
}
function Wt(e, t) {
return new this(e).log(t);
}
function _t(e) {
return new this(e).log(2);
}
function Gt(e) {
return new this(e).log(10);
}
function Xt() {
return nt(this, arguments, -1);
}
function Jt() {
return nt(this, arguments, 1);
}
function Kt(e, t) {
return new this(e).mod(t);
}
function jt(e, t) {
return new this(e).mul(t);
}
function Qt(e, t) {
return new this(e).pow(t);
}
function Yt(e) {
var t, n, i, r, o = 0, s = new this(1), l = [];
if (e === void 0 ? e = this.precision : W(e, 1, ae), i = Math.ceil(e / k), this.crypto)
if (crypto.getRandomValues)
for (t = crypto.getRandomValues(new Uint32Array(i)); o < i; )
r = t[o], r >= 429e7 ? t[o] = crypto.getRandomValues(new Uint32Array(1))[0] : l[o++] = r % 1e7;
else if (crypto.randomBytes) {
for (t = crypto.randomBytes(i *= 4); o < i; )
r = t[o] + (t[o + 1] << 8) + (t[o + 2] << 16) + ((t[o + 3] & 127) << 24), r >= 214e7 ? crypto.randomBytes(4).copy(t, o) : (l.push(r % 1e7), o += 4);
o = i / 4;
} else
throw Error(je);
else for (; o < i; ) l[o++] = Math.random() * 1e7 | 0;
for (i = l[--o], e %= k, i && e && (r = P(10, k - e), l[o] = (i / r | 0) * r); l[o] === 0; o--) l.pop();
if (o < 0)
n = 0, l = [0];
else {
for (n = -1; l[0] === 0; n -= k) l.shift();
for (i = 1, r = l[0]; r >= 10; r /= 10) i++;
i < k && (n -= k - i);
}
return s.e = n, s.d = l, s;
}
function en(e) {
return w(e = new this(e), e.e + 1, this.rounding);
}
function tn(e) {
return e = new this(e), e.d ? e.d[0] ? e.s : 0 * e.s : e.s || NaN;
}
function nn(e) {
return new this(e).sin();
}
function rn(e) {
return new this(e).sinh();
}
function on(e) {
return new this(e).sqrt();
}
function sn(e, t) {
return new this(e).sub(t);
}
function ln() {
var e = 0, t = arguments, n = new this(t[e]);
for (y = !1; n.s && ++e < t.length; ) n = n.plus(t[e]);
return y = !0, w(n, this.precision, this.rounding);
}
function un(e) {
return new this(e).tan();
}
function an(e) {
return new this(e).tanh();
}
function cn(e) {
return w(e = new this(e), e.e + 1, 1);
}
m[Symbol.for("nodejs.util.inspect.custom")] = m.toString;
m[Symbol.toStringTag] = "Decimal";
var S = m.constructor = ot(Le);
ke = new S(ke);
Ne = new S(Ne);
const Xe = 16;
function Fe() {
const e = O("0"), t = O(""), n = O(null), i = O(!1), r = O([]), o = O("0"), s = O(!1), l = O(""), a = O("");
S.set({ precision: 20 });
const u = ve(() => s.value ? l.value || "错误" : d(e.value)), c = ve(() => a.value || "");
function d(p) {
if (!p || p === "0") return "0";
try {
const b = new S(p);
let L;
b.isInteger() ? L = b.toFixed(0) : L = b.toFixed();
let G = L;
L.includes(".") && (G = L.replace(/\.?0+$/, ""));
const oe = G.split(".");
return oe[0] && (oe[0] = oe[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",")), oe.join(".");
} catch {
return p;
}
}
function h(p) {
if (s.value && B(), a.value.endsWith("=") && (a.value = ""), i.value)
e.value = p, i.value = !1;
else {
const b = e.value === "0" ? p : e.value + p;
b.replace(/[.-]/g, "").length <= Xe && (e.value = b);
}
}
function g() {
if (s.value && B(), a.value.endsWith("=") && (a.value = ""), i.value)
e.value = "0.", i.value = !1;
else if (!e.value.includes(".")) {
const p = e.value + ".";
p.replace(/[.-]/g, "").length <= Xe && (e.value = p);
}
}
function M(p) {
if (s.value) {
B();
return;
}
const b = e.value;
let L = t.value, G = n.value;
if (t.value && n.value && !i.value ? (N(), t.value = e.value) : t.value = b, p === "=") {
if (L && G) {
const oe = `${L} ${G} ${b}`;
r.value.unshift(`${oe} = ${e.value}`), r.value.length > 50 && (r.value = r.value.slice(0, 50)), a.value = `${L} ${G} ${b} =`, n.value = null, t.value = "";
}
} else
a.value = `${t.value} ${p}`, n.value = p;
i.value = !0;
}
function N() {
if (!(!t.value || !n.value))
try {
if (t.value === "NaN" || t.value === "Infinity" || e.value === "NaN" || e.value === "Infinity")
throw new Error("无效的数值");
const p = new S(t.value), b = new S(e.value);
let L;
switch (n.value) {
case "+":
L = p.plus(b);
break;
case "-":
L = p.minus(b);
break;
case "*":
L = p.times(b);
break;
case "/":
if (b.isZero())
throw l.value = "除数不能为零", new Error("除数不能为零");
L = p.dividedBy(b);
break;
case "^":
L = new S(Math.pow(p.toNumber(), b.toNumber()));
break;
default:
return;
}
e.value = L.toString(), s.value = !1, l.value = "";
} catch (p) {
e.value = "错误", s.value = !0, l.value || (l.value = p instanceof Error ? p.message : "计算错误"), console.error("计算错误:", p);
}
}
function $(p) {
p >= 0 && p < r.value.length && r.value.splice(p, 1);
}
function z() {
e.value = "0", s.value = !1;
}
function B() {
e.value = "0", t.value = "", n.value = null, i.value = !1, a.value = "", s.value = !1, l.value = "";
}
function V() {
if (s.value || i.value) {
z();
return;
}
e.value.length > 1 ? e.value = e.value.slice(0, -1) : e.value = "0";
}
function A() {
s.value || e.value !== "0" && (e.value = e.value.startsWith("-") ? e.value.slice(1) : "-" + e.value);
}
function te() {
if (!s.value)
try {
const b = new S(e.value).dividedBy(100);
e.value = b.toString();
} catch {
e.value = "错误", s.value = !0;
}
}
function _() {
if (!s.value)
try {
const p = new S(e.value);
if (p.isNegative())
throw l.value = "负数不能开平方根", new Error("负数不能开平方根");
const b = p.sqrt();
a.value = `√(${p}) =`, e.value = b.toString(), l.value = "";
} catch (p) {
e.value = "错误", s.value = !0, l.value || (l.value = p instanceof Error ? p.message : "计算错误");
}
}
function ce() {
if (!s.value)
try {
const p = new S(e.value), b = p.times(p);
a.value = `sqr(${p}) =`, e.value = b.toString(), l.value = "";
} catch (p) {
e.value = "错误", s.value = !0, l.value = p instanceof Error ? p.message : "计算错误";
}
}
function ne() {
if (!s.value)
try {
const p = new S(e.value);
if (p.isZero())
throw l.value = "零不能求倒数", new Error("零不能求倒数");
const b = new S(1).dividedBy(p);
a.value = `1/(${p}) =`, e.value = b.toString(), l.value = "";
} catch (p) {
e.value = "错误", s.value = !0, l.value || (l.value = p instanceof Error ? p.message : "计算错误");
}
}
function Q() {
s.value || (o.value = e.value, i.value = !0);
}
function fe() {
e.value = o.value, i.value = !0;
}
function Z() {
o.value = "0";
}
function ie() {
if (!s.value)
try {
const p = new S(o.value), b = new S(e.value);
o.value = p.plus(b).toString(), i.value = !0;
} catch (p) {
console.error("内存加法错误:", p);
}
}
function re() {
if (!s.value)
try {
const p = new S(o.value), b = new S(e.value);
o.value = p.minus(b).toString(), i.value = !0;
} catch (p) {
console.error("内存减法错误:", p);
}
}
function Y(p) {
if (!s.value)
try {
const b = new S(e.value);
let L;
switch (p) {
case "sin":
L = new S(Math.sin(b.toNumber() * Math.PI / 180));
break;
case "cos":
L = new S(Math.cos(b.toNumber() * Math.PI / 180));
break;
case "tan":
L = new S(Math.tan(b.toNumber() * Math.PI / 180));
break;
case "log":
if (b.lte(0))
throw l.value = "对数的真数必须大于0", new Error("对数的真数必须大于0");
L = new S(Math.log10(b.toNumber()));
break;
case "ln":
if (b.lte(0))
throw l.value = "自然对数的真数必须大于0", new Error("自然对数的真数必须大于0");
L = new S(Math.log(b.toNumber()));
break;
case "exp":
L = new S(Math.exp(b.toNumber()));
break;
case "pow":
t.value = b.toString(), n.value = "^", i.value = !0, a.value = `${b} ^`;
return;
default:
return;
}
e.value = L.toString(), i.value = !0, s.value = !1, l.value = "";
} catch (b) {
e.value = "错误", s.value = !0, l.value || (l.value = b instanceof Error ? b.message : "科学计算错误"), console.error("科学计算错误:", b);
}
}
function q() {
if (!s.value)
try {
const p = new S(e.value);
if (p.isNegative() || !p.isInteger())
throw l.value = "阶乘只能计算非负整数", new Error("阶乘只能计算非负整数");
if (p.gt(170))
throw l.value = "数值过大,无法计算阶乘", new Error("数值过大,无法计算阶乘");
let b = new S(1), L = p.toNumber();
for (let G = 2; G <= L; G++)
b = b.times(G);
e.value = b.toString(), i.value = !0, s.value = !1, l.value = "";
} catch (p) {
e.value = "错误", s.value = !0, l.value || (l.value = p instanceof Error ? p.message : "阶乘计算错误"), console.error("阶乘计算错误:", p);
}
}
return {
// 状态
display: e,
previousValue: t,
currentOperator: n,
waitingForNewValue: i,
history: r,
memory: o,
isError: s,
errorMessage: l,
expression: a,
// 计算属性
displayText: u,
expressionText: c,
// 方法
inputNumber: h,
inputDecimal: g,
inputOperator: M,
calculate: N,
removeHistoryItem: $,
clearEntry: z,
clearAll: B,
backspace: V,
toggleSign: A,
percentage: te,
squareRoot: _,
square: ce,
reciprocal: ne,
memoryStore: Q,
memoryRecall: fe,
memoryClear: Z,
memoryAdd: ie,
memorySubtract: re,
formatNumber: d,
scientificFunction: Y,
factorial: q
};
}
const fn = { class: "calculator" }, dn = { class: "toolbar-area" }, vn = { class: "toolbar-left" }, hn = { class: "mode-display" }, mn = { class: "display-area" }, pn = { class: "expression" }, gn = { class: "memory-section" }, wn = ["disabled"], bn = ["disabled"], kn = ["disabled"], Nn = { class: "buttons-area" }, Cn = {
key: 0,
class: "button-row scientific-row"
}, Mn = {
key: 1,
class: "button-row scientific-row"
}, yn = { class: "button-row" }, En = { class: "button-row" }, Sn = { class: "button-row" }, Vn = { class: "button-row" }, zn = { class: "button-row" }, Ln = { class: "drawer-content" }, Hn = {
key: 0,
class: "mode-check"
}, $n = {
key: 0,
class: "mode-check"
}, Fn = { class: "history-list" }, qn = ["onClick"], An = ["onClick"], Bn = {
key: 0,
class: "history-empty"
}, In = { class: "memory-list" }, Pn = ["onClick"], Tn = { class: "memory-actions" }, Dn = ["onClick"], On = ["onClick"], Rn = ["onClick"], Zn = {
key: 0,
class: "memory-empty"
}, Un = {
key: 0,
class: "memory-footer"
}, xn = /* @__PURE__ */ ft({
__name: "Calculator",
setup(e) {
const t = Fe(), n = O(), i = O(!1), r = O(!1), o = O(!1), s = O([]), l = O("standard"), a = ve(() => l.value === "standard" ? "标准型" : "科学型"), u = ve(() => t.displayText.value), c = ve(() => t.expressionText.value), d = ve(() => t.history.value), h = O("32px");
function g() {
pt(() => {
if (!n.value) return;
const E = n.value, f = u.value, C = E.clientWidth - 32, H = 32, I = 16, T = document.createElement("span");
T.style.visibility = "hidden", T.style.position = "absolute", T.style.fontSize = `${H}px`, T.style.fontWeight = "300", T.style.fontFamily = getComputedStyle(E).fontFamily, T.textContent = f, document.body.appendChild(T);
const Ie = T.offsetWidth;
document.body.removeChild(T);
let Pe = H;
Ie > C && (Pe = Math.max(
I,
C / Ie * H
)), h.value = `${Pe}px`;
});
}
dt(u, g, { immediate: !0 });
function M(E) {
t.inputNumber(E);
}
function N() {
t.inputDecimal();
}
function $(E) {
t.inputOperator(E);
}
function z() {
t.clearEntry();
}
function B() {
t.clearAll();
}
function V() {
t.backspace();
}
function A() {
t.toggleSign();
}
function te() {
t.percentage();
}
function _() {
t.squareRoot();
}
function ce() {
t.square();
}
function ne() {
t.reciprocal();
}
function Q() {
const E = u.value;
t.memoryStore(), E !== "0" && !s.value.includes(E) && s.value.unshift(E);
}
function fe() {
s.value.length > 0 && (t.display.value = s.value[0] || "0", t.waitingForNewValue.value = !0);
}
function Z() {
t.memoryClear(), s.value = [];
}
function ie() {
try {
const E = t.display.value || "0", f = s.value.length > 0 && s.value[0] || "0", C = new S(E), H = new S(f);
console.log(C.plus(H));
const I = C.plus(H).toString();
s.value.length > 0 ? s.value[0] = I : s.value.unshift(I);
} catch (E) {
console.error("内存加法计算错误:", E);
const f = parseFloat(t.display.value) || 0, C = s.value.length > 0 && parseFloat(s.value[0] || "0") || 0, H = f + C;
s.value.length > 0 ? s.value[0] = H.toString() : s.value.unshift(H.toString());
}
}
function re() {
try {
const E = t.display.value || "0", f = s.value.length > 0 && s.value[0] || "0", C = new S(E), I = new S(f).minus(C).toString();
s.value.length > 0 ? s.value[0] = I : s.value.unshift(I);
} catch (E) {
console.error("内存减法计算错误:", E);
const f = parseFloat(t.display.value) || 0, H = (s.value.length > 0 && parseFloat(s.value[0] || "0") || 0) - f;
s.value.length > 0 ? s.value[0] = H.toString() : s.value.unshift(H.toString());
}
}
function Y() {
i.value = !i.value;
}
function q() {
o.value = !o.value;
}
function p(E) {
t.display.value = E, t.waitingForNewValue.value = !0, o.value = !1;
}
function b() {
s.value = [];
}
function L(E) {
s.value.splice(E, 1);
}
function G(E, f) {
try {
const C = t.display.value || "0", H = new S(C), I = new S(E || "0"), T = H.plus(I).toString();
s.value[f] = T;
} catch (C) {
console.error("内存项加法计算错误:", C);
const H = parseFloat(t.display.value) || 0, I = parseFloat(E) || 0, T = H + I;
s.value[f] = T.toString();
}
}
function oe(E, f) {
try {
const C = t.display.value || "0", H = new S(C), T = new S(E || "0").minus(H).toString();
s.value[f] = T;
} catch (C) {
console.error("内存项减法计算错误:", C);
const H = parseFloat(t.display.value) || 0, T = (parseFloat(E) || 0) - H;
s.value[f] = T.toString();
}
}
function lt() {
r.value = !r.value;
}
function Se() {
r.value = !1;
}
function Ae(E) {
l.value = E, Se(), t.clearAll();
}
function de(E) {
t.scientificFunction(E);
}
function ut() {
t.factorial();
}
function at(E) {
t.removeHistoryItem(E);
}
function ct(E) {
const f = E.split(" = ")[1];
f && (t.display.value = f, t.waitingForNewValue.value = !0, i.value = !1);
}
function Be(E) {
E.preventDefault();
const f = E.key;
/^[0-9]$/.test(f) ? M(f) : f === "+" ? $("+") : f === "-" ? $("-") : f === "*" ? $("*") : f === "/" ? $("/") : f === "Enter" || f === "=" ? $("=") : f === "." ? N() : f === "Backspace" ? V() : f === "Escape" ? B() : f === "Delete" && z();
}
return vt(() => {
document.addEventListener("keydown", Be);
}), ht(() => {
document.removeEventListener("keydown", Be);
}), (E, f) => (x(), U("div", fn, [
v("div", dn, [
v("div", vn, [
v("button", {
class: "btn btn-menu",
onClick: lt,
title: "切换计算器模式"
}, f[26] || (f[26] = [
v("svg", {
width: "16",
height: "16",
viewBox: "0 0 16 16"
}, [
v("path", {
d: "M2 3h12v1H2V3zm0 4h12v1H2V7zm0 4h12v1H2v-1z",
fill: "currentColor"
})
], -1)
])),
v("div", hn, pe(a.value), 1)
]),
v("div", { class: "toolbar-right" }, [
v("button", {
class: "btn btn-memory",
onClick: Y,
title: "历史记录"
}, f[27] || (f[27] = [
v("svg", {
viewBox: "0 0 1024 1024",
width: "22",
height: "22"
}, [
v("path", {
d: "M537.6 95.6928A409.2928 409.2928 0 0 0 159.3344 351.232l-23.2448-43.4176a28.16 28.16 0 0 0-49.664 26.5728l55.1936 102.9632a28.2112 28.2112 0 0 0 24.832 14.848 27.6992 27.6992 0 0 0 12.4416-2.9184l109.9776-54.272a28.16 28.16 0 0 0-24.9344-50.5344l-51.2 25.6a351.6416 351.6416 0 1 1 12.4416 294.4512 28.16 28.16 0 0 0-50.0736 25.6A407.9616 407.9616 0 1 0 537.6 95.6928z",
fill: "#555555"
}),
v("path", {
d: "M522.9056 297.7792a28.16 28.16 0 0 0-28.16 28.16V568.32a28.16 28.16 0 0 0 28.16 28.16h205.8752a28.16 28.16 0 0 0 0-56.32h-177.7152V325.9392a28.16 28.16 0 0 0-28.16-28.16z",
fill: "#555555"
})
], -1)
]))
])
]),
v("div", mn, [
v("div", pn, pe(c.value), 1),
v("div", {
ref_key: "displayRef",
ref: n,
class: "display",
style: mt({ fontSize: h.value })
}, pe(u.value), 5)
]),
v("div", gn, [
v("button", {
class: "btn btn-memory",
onClick: Z,
disabled: s.value.length === 0,
title: "清除所有记忆"
}, " MC ", 8, wn),
v("button", {
class: "btn btn-memory",
onClick: fe,
disabled: s.value.length === 0,
title: "记忆调用"
}, " MR ", 8, bn),
v("button", {
class: "btn btn-memory",
onClick: ie,
title: "记忆加法"
}, " M+ "),
v("button", {
class: "btn btn-memory",
onClick: re,
title: "记忆减法"
}, " M- "),
v("button", {
class: "btn btn-memory",
onClick: Q,
title: "记忆存储"
}, " MS "),
v("button", {
class: "btn btn-memory",
onClick: q,
disabled: s.value.length === 0,
title: "内存记录"
}, " M∨ ", 8, kn)
]),
v("div", Nn, [
l.value === "scientific" ? (x(), U("div", Cn, [
v("button", {
class: "btn btn-function",
onClick: f[0] || (f[0] = (C) => de("sin")),
title: "正弦"
}, " sin "),
v("button", {
class: "btn btn-function",
onClick: f[1] || (f[1] = (C) => de("cos")),
title: "余弦"
}, " cos "),
v("button", {
class: "btn btn-function",
onClick: f[2] || (f[2] = (C) => de("tan")),
title: "正切"
}, " tan "),
v("button", {
class: "btn btn-function",
onClick: f[3] || (f[3] = (C) => de("log")),
title: "常用对数"
}, " log ")
])) : J("", !0),
l.value === "scientific" ? (x(), U("div", Mn, [
v("button", {
class: "btn btn-function",
onClick: f[4] || (f[4] = (C) => de("ln")),
title: "自然对数"
}, " ln "),
v("button", {
class: "btn btn-function",
onClick: f[5] || (f[5] = (C) => de("exp")),
title: "e的x次方"
}, " e^x "),
v("button", {
class: "btn btn-function",
onClick: f[6] || (f[6] = (C) => de("pow")),
title: "x的y次方"
}, " x^y "),
v("button", {
class: "btn btn-function",
onClick: ut,
title: "阶乘"
}, " n! ")
])) : J("", !0),
v("div", { class: "button-row" }, [
v("button", {
class: "btn btn-function",
onClick: te
}, "%"),
v("button", {
class: "btn btn-clear",
onClick: z
}, "CE"),
v("button", {
class: "btn btn-clear",
onClick: B
}, "C"),
v("button", {
class: "btn btn-function",
onClick: V
}, f[28] || (f[28] = [
v("svg", {
viewBox: "0 0 1395 1024",
width: "20",
height: "20"
}, [
v("path", {
d: "M1229.851676 1024h-719.567568a23.911784 23.911784 0 0 1-3.90227-1.051676 96.864865 96.864865 0 0 1-64.152216-28.118486L28.118486 580.718703a97.639784 97.639784 0 0 1 0-138.046271L442.229622 28.588973A97.224649 97.224649 0 0 1 509.868973 0h719.982703a166.054054 166.054054 0 0 1 166.054054 166.054054v691.891892a166.054054 166.054054 0 0 1-166.054054 166.054054z m110.702702-820.556108A149.808432 149.808432 0 0 0 1189.113081 55.351351H532.48a89.558486 89.558486 0 0 0-61.689081 25.378595L92.132324 454.739027a78.01773 78.01773 0 0 0 0 114.604973l378.658595 373.178811a89.254054 89.254054 0 0 0 58.506378 25.074162 23.081514 23.081514 0 0 0 3.542487 0.940973h656.273297a149.808432 149.808432 0 0 0 151.441297-148.009514v-617.167567z m-253.536864 519.776865l-19.566703 19.566702a13.837838 13.837838 0 0 1-19.566703 0l-205.491892-205.491891-205.491892 205.491891a13.837838 13.837838 0 0 1-19.566702 0l-19.566703-19.566702a13.837838 13.837838 0 0 1 0-19.566703L803.258811 498.162162l-205.491892-205.491892a13.837838 13.837838 0 0 1 0-19.566702l19.566703-19.566703a13.837838 13.837838 0 0 1 19.566702 0l205.491892 205.491892 205.491892-205.491892a13.837838 13.837838 0 0 1 19.566703 0l19.566703 19.566703a13.837838 13.837838 0 0 1 0 19.566702L881.525622 498.162162l205.491892 205.491892a13.837838 13.837838 0 0 1 0 19.566703z",
fill: "#333333"
})
], -1)
]))
]),
v("div", yn, [
v("button", {
class: "btn btn-function",
onClick: ne,
title: "倒数 (1/x)"
}, f[29] || (f[29] = [
v("svg", {
width: "30",
height: "30",
viewBox: "0 0 20 20"
}, [
v("text", {
x: "6",
y: "10",
"font-size": "7",
"font-family": "Arial, sans-serif",
"font-weight": "500",
fill: "currentColor"
}, " 1 "),
v("line", {
x1: "8",
y1: "16",
x2: "14",
y2: "6",
stroke: "currentColor",
"stroke-width": "0.6"
}),
v("text", {
x: "12",
y: "16",
"font-size": "7",
"font-family": "Arial, sans-serif",
"font-style": "italic",
fill: "currentColor"
}, " x ")
], -1)
])),
v("button", {
class: "btn btn-function",
onClick: ce,
title: "平方 (x²)"
}, f[30] || (f[30] = [
v("svg", {
viewBox: "0 0 1024 1024",
width: "20",
height: "20"
}, [
v("path", {
d: "M634.34666667 990.22222222L398.72 639.39555555 162.66666667 990.22222222h-60.69333334l268.26666667-391.57333333L123.62666667 245.68888889h60.69333333l216.53333333 316.48L612.58666667 245.68888889h60.69333333L430.93333333 598.75555555l264 391.57333334-60.58666666-0.10666667zM750.93333333 372.19555555v-17.6c9.38666667-23.57333333 21.76-45.33333333 37.33333334-65.38666666 15.36-20.16 36.26666667-41.28 62.29333333-63.78666667 30.61333333-26.45333333 51.84-48.53333333 63.46666667-65.92s17.38666667-36.8 17.38666666-58.02666667c0-22.82666667-6.72-40.53333333-19.94666666-53.65333333-13.22666667-12.90666667-31.36-19.41333333-54.4-19.41333333-20.48 0-37.86666667 6.29333333-52.16 18.88-14.29333333 12.48-22.61333333 29.54666667-24.85333334 51.09333333L755.62666667 94.22222222c2.56-26.13333333 13.01333333-47.14666667 31.68-63.04 18.45333333-15.89333333 42.02666667-23.89333333 70.61333333-23.89333333 30.4 0 54.50666667 8 72.32 24.10666666 17.70666667 16.10666667 26.45333333 38.4 26.45333333 66.98666667 0 16.64-2.56 31.68-7.57333333 44.90666667s-13.22666667 26.77333333-24.64 40.74666666c-11.41333333 13.97333333-30.08 32.42666667-55.78666667 55.57333334-21.22666667 18.88-39.36 37.12-54.18666666 54.72s-26.45333333 36.05333333-34.77333334 55.25333333h182.4v22.50666667H750.93333333z",
fill: "#000000"
})
], -1)
])),
v("button", {
class: "btn btn-function",
onClick: _,
title: "平方根 (√x)"
}, f[31] || (f[31] = [
v("svg", {
viewBox: "0 0 1445 1024",
width: "20",
height: "20"
}, [
v("path", {
d: "M923.768471 421.647059c15.36 16.263529 26.985412 32.647529 34.816 48.971294 5.662118 11.264 14.878118 40.96 27.76847 88.907294l41.441883-62.102588c10.962824-15.058824 24.274824-29.394824 39.996235-43.068235 15.661176-13.673412 29.515294-23.009882 41.381647-28.009412 7.529412-3.132235 15.841882-4.698353 24.937412-4.698353 13.492706 0 24.214588 3.614118 32.225882 10.842353s12.047059 15.962353 12.047059 26.322823c0 11.926588-2.409412 20.118588-7.107765 24.45553a43.971765 43.971765 0 0 1-30.117647 11.806117c-6.625882 0-13.613176-1.445647-21.142588-4.21647-14.757647-5.059765-24.696471-7.589647-29.635765-7.589647-7.529412 0-16.504471 4.397176-26.864941 13.251764-19.456 16.263529-42.646588 47.766588-69.632 94.569412l38.550588 161.852235c6.023529 24.756706 11.023059 39.634824 15.058824 44.453648 4.096 4.879059 8.192 7.288471 12.288 7.28847 6.625882 0 14.275765-3.614118 23.070117-10.842353 17.227294-14.396235 31.924706-33.189647 44.212706-56.44047l16.444236 8.432941a294.671059 294.671059 0 0 1-75.294118 92.28047c-17.227294 13.854118-31.804235 20.720941-43.730824 20.720942-17.588706 0-31.563294-9.878588-41.863529-29.635765-6.625882-12.288-20.239059-64.933647-40.96-158.117647-48.971294 84.992-88.184471 139.745882-117.639529 164.201412-19.154824 15.661176-37.647059 23.491765-55.536942 23.491764a50.838588 50.838588 0 0 1-34.334117-13.613176 35.84 35.84 0 0 1-11.324236-27.708236c0-10.420706 3.433412-19.034353 10.360471-25.901176a34.575059 34.575059 0 0 1 25.419294-10.360471c9.999059 0 20.660706 4.999529 31.984941 15.058824 8.131765 7.228235 14.456471 10.842353 18.853647 10.842353 3.734588 0 8.613647-2.529882 14.576942-7.589647 14.697412-11.866353 34.816-37.647059 60.235294-77.101177 25.419294-39.574588 42.044235-68.126118 49.874823-85.714823a5098.315294 5098.315294 0 0 0-31.563294-120.952471c-7.228235-20.359529-16.624941-34.816-28.190118-43.248941-11.625412-8.432941-28.732235-12.709647-51.32047-12.709647-7.228235 0-15.540706 0.301176-24.937412 0.903529v-16.865882L923.768471 421.647059zM164.201412 523.806118l-90.473412 45.236706a30.117647 30.117647 0 0 1-26.985412-53.850353l120.470588-60.235295a30.117647 30.117647 0 0 1 41.682824 16.323765l143.661176 383.096471L512.602353 54.392471A30.117647 30.117647 0 0 1 542.117647 30.117647h843.294118a30.117647 30.117647 0 1 1 0 60.235294H566.814118L390.927059 969.667765c-5.903059 29.696-47.104 33.069176-57.705412 4.698353l-168.96-450.56z",
fill: "#000000"
})
], -1)
])),
v("button", {
class: "btn btn-operator",
onClick: f[7] || (f[7] = (C) => $("/"))
}, f[32] || (f[32] = [
v("svg", {
viewBox: "0 0 1461 1024",
width: "20",
height: "20"
}, [
v("path", {
d: "M0 464.484686m55.698745 0l1349.623431 0q55.698745 0 55.698745 55.698745l0 0q0 55.698745-55.698745 55.698745l-1349.623431 0q-55.698745 0-55.698745-55.698745l0 0q0-55.698745 55.698745-55.698745Z",
fill: "#333"
}),
v("path", {
d: "M729.082287 100.686192m-100.686192 0a100.686192 100.686192 0 1 0 201.372385 0 100.686192 100.686192 0 1 0-201.372385 0Z",
fill: "#333"
}),
v("path", {
d: "M729.082287 923.313808m-100.686192 0a100.686192 100.686192 0 1 0 201.372385 0 100.686192 100.686192 0 1 0-201.372385 0Z",
"p-id": "33119"
})
], -1)
]))
]),
v("div", En, [
v("button", {
class: "btn btn-number",
onClick: f[8] || (f[8] = (C) => M("7"))
}, "7"),
v("button", {
class: "btn btn-number",
onClick: f[9] || (f[9] = (C) => M("8"))
}, "8"),
v("button", {
class: "btn btn-number",
onClick: f[10] || (f[10] = (C) => M("9"))
}, "9"),
v("button", {
class: "btn btn-operator",
onClick: f[11] || (f[11] = (C) => $("*"))
}, f[33] || (f[33] = [
v("svg", {
viewBox: "0 0 1024 1024",
width: "20",
height: "20"
}, [
v("path", {
d: "M198.4 243.2c-6.4-12.8-6.4-32 0-44.8 12.8-6.4 32-6.4 44.8 0l582.4 582.4c12.8 12.8 12.8 32 0 44.8-12.8 6.4-32 6.4-44.8 0L198.4 243.2z m0 0",
fill: "#333"
}),
v("path", {
d: "M780.8 198.4c12.8-6.4 32-6.4 44.8 0 12.8 12.8 12.8 32 0 44.8l-582.4 582.4c-12.8 6.4-32 6.4-44.8 0-6.4-12.8-6.4-32 0-44.8l582.4-582.4z m0 0",
fill: "#333"
})
], -1)
]))
]),
v("div", Sn, [
v("button", {
class: "btn btn-number",
onClick: f[12] || (f[12] = (C) => M("4"))
}, "4"),
v("button", {
class: "btn btn-number",
onClick: f[13] || (f[13] = (C) => M("5"))
}, "5"),
v("button", {
class: "btn btn-number",
onClick: f[14] || (f[14] = (C) => M("6"))
}, "6"),
v("button", {
class: "btn btn-operator",
onClick: f[15] || (f[15] = (C) => $("-"))
}, f[34] || (f[34] = [
v("svg", {
viewBox: "0 0 1024 1024",
width: "20",
height: "20"
}, [
v("path", {
d: "M128 512h768v46.933333H128z",
fill: "#333"
})
], -1)
]))
]),
v("div", Vn, [
v("button", {
class: "btn btn-number",
onClick: f[16] || (f[16] = (C) => M("1"))
}, "1"),
v("button", {
class: "btn btn-number",
onClick: f[17] || (f[17] = (C) => M("2"))
}, "2"),
v("button", {
class: "btn btn-number",
onClick: f[18] || (f[18] = (C) => M("3"))
}, "3"),
v("button", {
class: "btn btn-operator",
onClick: f[19] || (f[19] = (C) => $("+"))
}, f[35] || (f[35] = [
v("svg", {
viewBox: "0 0 1024 1024",
width: "20",
height: "20"
}, [
v("path", {
d: "M863.328262 481.340895l-317.344013 0.099772L545.984249 162.816826c0-17.664722-14.336138-32.00086-32.00086-32.00086s-31.99914 14.336138-31.99914 32.00086l0 318.400215-322.368714-0.17718c-0.032684 0-0.063647 0-0.096331 0-17.632039 0-31.935493 14.239806-32.00086 31.904529-0.096331 17.664722 14.208843 32.031824 31.871845 32.095471l322.59234 0.17718 0 319.167424c0 17.695686 14.336138 32.00086 31.99914 32.00086s32.00086-14.303454 32.00086-32.00086L545.982529 545.440667l317.087703-0.099772c0.063647 0 0.096331 0 0.127295 0 17.632039 0 31.935493-14.239806 32.00086-31.904529S880.960301 481.404542 863.328262 481.340895z",
fill: "#333333"
})
], -1)
]))
]),
v("div", zn, [
v("button", {
class: "btn btn-function",
onClick: A
}, f[36] || (f[36] = [
v("svg", {
viewBox: "0 0 1024 1024",
width: "25",
height: "25"
}, [
v("path", {
d: "M552.96 747.52h225.28v48.64h-225.28zM655.36 227.84l38.4 23.04-314.88 545.28-38.4-23.04zM245.76 314.88h225.28v48.64H245.76z",
fill: "#333333"
}),
v("path", {
d: "M335.36 227.84H384v225.28h-48.64z",
fill: "#333333"
})
], -1)
])),
v("button", {
class: "btn btn-number",
onClick: f[20] || (f[20] = (C) => M("0"))
}, "0"),
v("button", {
class: "btn btn-function",
onClick: N
}, "."),
v("button", {
class: "btn btn-equals",
onClick: f[21] || (f[21] = (C) => $("="))
}, "=")
])
]),
r.value ? (x(), U("div", {
key: 0,
class: "drawer-overlay",
onClick: Se
})) : J("", !0),
v("div", {
class: Ve(["drawer-menu", { "drawer-open": r.value }])
}, [
v("div", { class: "drawer-header" }, [
f[38] || (f[38] = v("h3", null, "计算器", -1)),
v("button", {
class: "btn btn-close",
onClick: Se,
title: "关闭菜单"
}, f[37] || (f[37] = [
v("svg", {
width: "16",
height: "16",
viewBox: "0 0 16 16"
}, [
v("path", {
d: "M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z",
fill: "currentColor"
})
], -1)
]))
]),
v("div", Ln, [
v("div", {
class: Ve(["mode-option", { active: l.value === "standard" }]),
onClick: f[22] || (f[22] = (C) => Ae("standard"))
}, [
f[40] || (f[40] = De('<div class="mode-icon" data-v-d83a4ce9><svg width="20" height="20" viewBox="0 0 16 16" data-v-d83a4ce9><path d="M2 2h12a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm0 1v10h12V3H2z" fill="currentColor" data-v-d83a4ce9></path><path d="M4 5h2v2H4V5zm3 0h2v2H7V5zm3 0h2v2h-2V5zM4 8h2v2H4V8zm3 0h2v2H7V8zm3 0h2v2h-2V8z" fill="currentColor" data-v-d83a4ce9></path></svg></div><div class="mode-info" data-v-d83a4ce9><div class="mode-title" data-v-d83a4ce9>标准型</div><div class="mode-desc" data-v-d83a4ce9>基本的算术运算</div></div>', 2)),
l.value === "standard" ? (x(), U("div", Hn, f[39] || (f[39] = [
v("svg", {
width: "16",
height: "16",
viewBox: "0 0 16 16"
}, [
v("path", {
d: "M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z",
fill: "currentColor"
})
], -1)
]))) : J("", !0)
], 2),
v("div", {
class: Ve(["mode-option", { active: l.value === "scientific" }]),
onClick: f[23] || (f[23] = (C) => Ae("scientific"))
}, [
f[42] || (f[42] = De('<div class="mode-icon" data-v-d83a4ce9><svg width="20" height="20" viewBox="0 0 16 16" data-v-d83a4ce9><path d="M2 2h12a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm0 1v10h12V3H2z" fill="currentColor" data-v-d83a4ce9></path><path d="M3 4h1v1H3V4zm2 0h1v1H5V4zm2 0h1v1H7V4zm2 0h1v1H9V4zm2 0h1v1h-1V4zM3 6h1v1H3V6zm2 0h1v1H5V6zm2 0h1v1H7V6zm2 0h1v1H9V6zm2 0h1v1h-1V6zM3 8h1v1H3V8zm2 0h1v1H5V8zm2 0h1v1H7V8zm2 0h1v1H9V8zm2 0h1v1h-1V8zM3 10h1v1H3v-1zm2 0h1v1H5v-1zm2 0h1v1H7v-1zm2 0h1v1H9v-1zm2 0h1v1h-1v-1z" fill="currentColor" data-v-d83a4ce9></path></svg></div><div class="mode-info" data-v-d83a4ce9><div class="mode-title" data-v-d83a4ce9>科学型</div><div class="mode-desc" data-v-d83a4ce9>高级数学函数和运算</div></div>', 2)),
l.value === "scientific" ? (x(), U("div", $n, f[41] || (f[41] = [
v("svg", {
width: "16",
height: "16",
viewBox: "0 0 16 16"
}, [
v("path", {
d: "M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z",
fill: "currentColor"
})
], -1)
]))) : J("", !0)
], 2)
])
], 2),
Te(Oe, { name: "history-slide" }, {
default: Re(() => [
i.value ? (x(), U("div", {
key: 0,
class: "history-overlay",
onClick: Y
}, [
v("div", {
class: "history-panel",
onClick: f[24] || (f[24] = Ze(() => {
}, ["stop"]))
}, [
v("div", { class: "history-header" }, [
f[44] || (f[44] = v("h3", null, "历史记录", -1)),
v("div", { class: "history-actions" }, [
v("button", {
class: "btn btn-close",
onClick: Y,
title: "关闭历史记录"
}, f[43] || (f[43] = [
v("svg", {
width: "16",
height: "16",
viewBox: "0 0 16 16"
}, [
v("path", {
d: "M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z",
fill: "currentColor"
})
], -1)
]))
])
]),
v("div", Fn, [
(x(!0), U(Ue, null, xe(d.value, (C, H) => (x(), U("div", {
key: H,
class: "history-item"
}, [
v("div", {
class: "history-content",
onClick: (I) => ct(C)
}, pe(C), 9, qn),
v("button", {
class: "btn btn-delete",
onClick: (I) => at(H),
title: "删除此条记录"
}, f[45] || (f[45] = [
v("svg", {
width: "14",
height: "14",
viewBox: "0 0 16 16"
}, [
v("path", {
d: "M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z",
fill: "currentColor"
})
], -1)
]), 8, An)
]))), 128)),
d.value.length === 0 ? (x(), U("div", Bn, " 暂无历史记录 ")) : J("", !0)
])
])
])) : J("", !0)
]),
_: 1
}),
Te(Oe, { name: "memory-slide" }, {
default: Re(() => [
o.value ? (x(), U("div", {
key: 0,
class: "memory-overlay",
onClick: q
}, [
v("div", {
class: "memory-panel",
onClick: f[25] || (f[25] = Ze(() => {
}, ["stop"]))
}, [
v("div", { class: "memory-header" }, [
f[47] || (f[47] = v("h3", null, "内存记录", -1)),
v("div", { class: "memory-actions" }, [
v("button", {
class: "btn btn-close",
onClick: q,
title: "关闭内存记录"
}, f[46] || (f[46] = [
v("svg", {
width: "16",
height: "16",
viewBox: "0 0 16 16"
}, [
v("path", {
d: "M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z",
fill: "currentColor"
})
], -1)
]))
])
]),
v("div", In, [
(x(!0), U(Ue, null, xe(s.value, (C, H) => (x(), U("div", {
key: H,
class: "memory-item"
}, [
v("div", {
class: "memory-value",
onClick: (I) => p(C)
}, pe(C), 9, Pn),
v("div", Tn, [
v("button", {
class: "btn btn-mini",
onClick: (I) => L(H),
title: "清除此项"
}, " MC ", 8, Dn),
v("button", {
class: "btn btn-mini",
onClick: (I) => G(C, H),
title: "内存加法"
}, " M+ ", 8, On),
v("button", {
class: "btn btn-mini",
onClick: (I) => oe(C, H),
title: "内存减法"
}, " M- ", 8, Rn)
])
]))), 128)),
s.value.length === 0 ? (x(), U("div", Zn, " 内存中未保存任何内容 ")) : J("", !0)
]),
s.value.length > 0 ? (x(), U("div", Un, [
v("button", {
class: "btn btn-clear-memory",
onClick: b,
title: "清空所有内存记录"
}, f[48] || (f[48] = [
v("svg", {
width: "14",
height: "14",
viewBox: "0 0 16 16"
}, [
v("path", {
d: "M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z",
fill: "currentColor"
})
], -1)
]))
])) : J("", !0)
])
])) : J("", !0)
]),
_: 1
})
]));
}
}), Wn = (e, t) => {
const n = e.__vccOpts || e;
for (const [i, r] of t)
n[i] = r;
return n;
}, st = /* @__PURE__ */ Wn(xn, [["__scopeId", "data-v-d83a4ce9"]]);
function _n(e) {
e.component("Calculator", st);
}
const Xn = {
install: _n,
Calculator: st,
useCalculator: Fe,
useCalculatorStore: Fe
// 向后兼容
}, Jn = "1.0.0";
export {
st as Calculator,
Xn as default,
_n as install,
Fe as useCalculator,
Fe as useCalculatorStore,
Jn as version
};
//# sourceMappingURL=index.es.js.map