import { unref as U, getCurrentScope as A1, onScopeDispose as N1, getCurrentInstance as ot, onMounted as Wr, nextTick as Cr, watch as er, ref as Se, defineComponent as Re, createElementBlock as Ce, openBlock as he, createElementVNode as $e, warn as D1, computed as ue, inject as vr, isRef as ph, shallowRef as qa, onBeforeUnmount as nn, onBeforeMount as E1, provide as Ft, mergeProps as Zn, renderSlot as Xe, toRef as qt, onUnmounted as S1, useAttrs as C1, useSlots as mh, createCommentVNode as Be, Fragment as nt, normalizeClass as _e, createBlock as He, withCtx as Ve, resolveDynamicComponent as Lt, withModifiers as kr, createVNode as mr, toDisplayString as qr, normalizeStyle as Lr, Transition as fs, withDirectives as at, vShow as Nn, reactive as Vt, onActivated as M1, onUpdated as vh, cloneVNode as _1, Text as hh, Comment as F1, Teleport as T1, readonly as O1, onDeactivated as B1, withKeys as vn, createSlots as $1, toRaw as gh, toRefs as ma, watchEffect as I1, resolveComponent as $n, resolveDirective as R1, toHandlerKey as P1, renderList as Gn, createTextVNode as dn, vModelText as z1, h as $a, createApp as q1, markRaw as ro } from "vue"; import { PlotVuer as L1 } from "@abi-software/plotvuer"; import Js from "https://mapcore-demo.org/current/opencor-wasm/0.0.3/libopencor.js"; const pn = (e, r, { checkForDefaultPrevented: t = !0 } = {}) => (a) => { const i = e == null ? void 0 : e(a); if (t === !1 || !i) return r == null ? void 0 : r(a); }; var yc; const Ir = typeof window < "u", U1 = (e) => typeof e == "string", yh = () => { }, wu = Ir && ((yc = window == null ? void 0 : window.navigator) == null ? void 0 : yc.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); function bh(e) { return typeof e == "function" ? e() : U(e); } function k1(e) { return e; } function ds(e) { return A1() ? (N1(e), !0) : !1; } function V1(e, r = !0) { ot() ? Wr(e) : r ? e() : Cr(e); } function gn(e) { var r; const t = bh(e); return (r = t == null ? void 0 : t.$el) != null ? r : t; } const ps = Ir ? window : void 0; function tt(...e) { let r, t, n, a; if (U1(e[0]) || Array.isArray(e[0]) ? ([t, n, a] = e, r = ps) : [r, t, n, a] = e, !r) return yh; Array.isArray(t) || (t = [t]), Array.isArray(n) || (n = [n]); const i = [], o = () => { i.forEach((c) => c()), i.length = 0; }, l = (c, f, d, p) => (c.addEventListener(f, d, p), () => c.removeEventListener(f, d, p)), u = er(() => [gn(r), bh(a)], ([c, f]) => { o(), c && i.push(...t.flatMap((d) => n.map((p) => l(c, d, p, f)))); }, { immediate: !0, flush: "post" }), s = () => { u(), o(); }; return ds(s), s; } let bc = !1; function H1(e, r, t = {}) { const { window: n = ps, ignore: a = [], capture: i = !0, detectIframe: o = !1 } = t; if (!n) return; wu && !bc && (bc = !0, Array.from(n.document.body.children).forEach((d) => d.addEventListener("click", yh))); let l = !0; const u = (d) => a.some((p) => { if (typeof p == "string") return Array.from(n.document.querySelectorAll(p)).some((m) => m === d.target || d.composedPath().includes(m)); { const m = gn(p); return m && (d.target === m || d.composedPath().includes(m)); } }), c = [ tt(n, "click", (d) => { const p = gn(e); if (!(!p || p === d.target || d.composedPath().includes(p))) { if (d.detail === 0 && (l = !u(d)), !l) { l = !0; return; } r(d); } }, { passive: !0, capture: i }), tt(n, "pointerdown", (d) => { const p = gn(e); p && (l = !d.composedPath().includes(p) && !u(d)); }, { passive: !0 }), o && tt(n, "blur", (d) => { var p; const m = gn(e); ((p = n.document.activeElement) == null ? void 0 : p.tagName) === "IFRAME" && !(m != null && m.contains(n.document.activeElement)) && r(d); }) ].filter(Boolean); return () => c.forEach((d) => d()); } function wh(e, r = !1) { const t = Se(), n = () => t.value = !!e(); return n(), V1(n, r), t; } const wc = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, xc = "__vueuse_ssr_handlers__"; wc[xc] = wc[xc] || {}; var Ac = Object.getOwnPropertySymbols, Z1 = Object.prototype.hasOwnProperty, G1 = Object.prototype.propertyIsEnumerable, W1 = (e, r) => { var t = {}; for (var n in e) Z1.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]); if (e != null && Ac) for (var n of Ac(e)) r.indexOf(n) < 0 && G1.call(e, n) && (t[n] = e[n]); return t; }; function mn(e, r, t = {}) { const n = t, { window: a = ps } = n, i = W1(n, ["window"]); let o; const l = wh(() => a && "ResizeObserver" in a), u = () => { o && (o.disconnect(), o = void 0); }, s = er(() => gn(e), (f) => { u(), l.value && a && f && (o = new ResizeObserver(r), o.observe(f, i)); }, { immediate: !0, flush: "post" }), c = () => { u(), s(); }; return ds(c), { isSupported: l, stop: c }; } var Nc = Object.getOwnPropertySymbols, K1 = Object.prototype.hasOwnProperty, J1 = Object.prototype.propertyIsEnumerable, Y1 = (e, r) => { var t = {}; for (var n in e) K1.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]); if (e != null && Nc) for (var n of Nc(e)) r.indexOf(n) < 0 && J1.call(e, n) && (t[n] = e[n]); return t; }; function j1(e, r, t = {}) { const n = t, { window: a = ps } = n, i = Y1(n, ["window"]); let o; const l = wh(() => a && "MutationObserver" in a), u = () => { o && (o.disconnect(), o = void 0); }, s = er(() => gn(e), (f) => { u(), l.value && a && f && (o = new MutationObserver(r), o.observe(f, i)); }, { immediate: !0 }), c = () => { u(), s(); }; return ds(c), { isSupported: l, stop: c }; } var Dc; (function(e) { e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE"; })(Dc || (Dc = {})); var X1 = Object.defineProperty, Ec = Object.getOwnPropertySymbols, Q1 = Object.prototype.hasOwnProperty, eb = Object.prototype.propertyIsEnumerable, Sc = (e, r, t) => r in e ? X1(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, rb = (e, r) => { for (var t in r || (r = {})) Q1.call(r, t) && Sc(e, t, r[t]); if (Ec) for (var t of Ec(r)) eb.call(r, t) && Sc(e, t, r[t]); return e; }; const tb = { easeInSine: [0.12, 0, 0.39, 0], easeOutSine: [0.61, 1, 0.88, 1], easeInOutSine: [0.37, 0, 0.63, 1], easeInQuad: [0.11, 0, 0.5, 0], easeOutQuad: [0.5, 1, 0.89, 1], easeInOutQuad: [0.45, 0, 0.55, 1], easeInCubic: [0.32, 0, 0.67, 0], easeOutCubic: [0.33, 1, 0.68, 1], easeInOutCubic: [0.65, 0, 0.35, 1], easeInQuart: [0.5, 0, 0.75, 0], easeOutQuart: [0.25, 1, 0.5, 1], easeInOutQuart: [0.76, 0, 0.24, 1], easeInQuint: [0.64, 0, 0.78, 0], easeOutQuint: [0.22, 1, 0.36, 1], easeInOutQuint: [0.83, 0, 0.17, 1], easeInExpo: [0.7, 0, 0.84, 0], easeOutExpo: [0.16, 1, 0.3, 1], easeInOutExpo: [0.87, 0, 0.13, 1], easeInCirc: [0.55, 0, 1, 0.45], easeOutCirc: [0, 0.55, 0.45, 1], easeInOutCirc: [0.85, 0, 0.15, 1], easeInBack: [0.36, 0, 0.66, -0.56], easeOutBack: [0.34, 1.56, 0.64, 1], easeInOutBack: [0.68, -0.6, 0.32, 1.6] }; rb({ linear: k1 }, tb); const nb = () => Ir && /firefox/i.test(window.navigator.userAgent); /** * @vue/shared v3.5.20 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/ process.env.NODE_ENV !== "production" && Object.freeze({}); process.env.NODE_ENV !== "production" && Object.freeze([]); const Fi = () => { }, ab = Object.prototype.hasOwnProperty, Cc = (e, r) => ab.call(e, r), Yt = Array.isArray, Xr = (e) => typeof e == "function", wt = (e) => typeof e == "string", dt = (e) => e !== null && typeof e == "object", ib = Object.prototype.toString, ob = (e) => ib.call(e), Ys = (e) => ob(e).slice(8, -1), xh = (e) => { const r = /* @__PURE__ */ Object.create(null); return (t) => r[t] || (r[t] = e(t)); }, sb = /-(\w)/g, ub = xh( (e) => e.replace(sb, (r, t) => t ? t.toUpperCase() : "") ), lb = /\B([A-Z])/g, cb = xh( (e) => e.replace(lb, "-$1").toLowerCase() ); var Ah = typeof global == "object" && global && global.Object === Object && global, fb = typeof self == "object" && self && self.Object === Object && self, an = Ah || fb || Function("return this")(), Qt = an.Symbol, Nh = Object.prototype, db = Nh.hasOwnProperty, pb = Nh.toString, bi = Qt ? Qt.toStringTag : void 0; function mb(e) { var r = db.call(e, bi), t = e[bi]; try { e[bi] = void 0; var n = !0; } catch { } var a = pb.call(e); return n && (r ? e[bi] = t : delete e[bi]), a; } var vb = Object.prototype, hb = vb.toString; function gb(e) { return hb.call(e); } var yb = "[object Null]", bb = "[object Undefined]", Mc = Qt ? Qt.toStringTag : void 0; function ai(e) { return e == null ? e === void 0 ? bb : yb : Mc && Mc in Object(e) ? mb(e) : gb(e); } function Va(e) { return e != null && typeof e == "object"; } var wb = "[object Symbol]"; function ms(e) { return typeof e == "symbol" || Va(e) && ai(e) == wb; } function xb(e, r) { for (var t = -1, n = e == null ? 0 : e.length, a = Array(n); ++t < n; ) a[t] = r(e[t], t, e); return a; } var Ht = Array.isArray, _c = Qt ? Qt.prototype : void 0, Fc = _c ? _c.toString : void 0; function Dh(e) { if (typeof e == "string") return e; if (Ht(e)) return xb(e, Dh) + ""; if (ms(e)) return Fc ? Fc.call(e) : ""; var r = e + ""; return r == "0" && 1 / e == -1 / 0 ? "-0" : r; } var Ab = /\s/; function Nb(e) { for (var r = e.length; r-- && Ab.test(e.charAt(r)); ) ; return r; } var Db = /^\s+/; function Eb(e) { return e && e.slice(0, Nb(e) + 1).replace(Db, ""); } function Kn(e) { var r = typeof e; return e != null && (r == "object" || r == "function"); } var Tc = NaN, Sb = /^[-+]0x[0-9a-f]+$/i, Cb = /^0b[01]+$/i, Mb = /^0o[0-7]+$/i, _b = parseInt; function Oc(e) { if (typeof e == "number") return e; if (ms(e)) return Tc; if (Kn(e)) { var r = typeof e.valueOf == "function" ? e.valueOf() : e; e = Kn(r) ? r + "" : r; } if (typeof e != "string") return e === 0 ? e : +e; e = Eb(e); var t = Cb.test(e); return t || Mb.test(e) ? _b(e.slice(2), t ? 2 : 8) : Sb.test(e) ? Tc : +e; } function Eh(e) { return e; } var Fb = "[object AsyncFunction]", Tb = "[object Function]", Ob = "[object GeneratorFunction]", Bb = "[object Proxy]"; function Sh(e) { if (!Kn(e)) return !1; var r = ai(e); return r == Tb || r == Ob || r == Fb || r == Bb; } var js = an["__core-js_shared__"], Bc = function() { var e = /[^.]+$/.exec(js && js.keys && js.keys.IE_PROTO || ""); return e ? "Symbol(src)_1." + e : ""; }(); function $b(e) { return !!Bc && Bc in e; } var Ib = Function.prototype, Rb = Ib.toString; function ya(e) { if (e != null) { try { return Rb.call(e); } catch { } try { return e + ""; } catch { } } return ""; } var Pb = /[\\^$.*+?()[\]{}|]/g, zb = /^\[object .+?Constructor\]$/, qb = Function.prototype, Lb = Object.prototype, Ub = qb.toString, kb = Lb.hasOwnProperty, Vb = RegExp( "^" + Ub.call(kb).replace(Pb, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); function Hb(e) { if (!Kn(e) || $b(e)) return !1; var r = Sh(e) ? Vb : zb; return r.test(ya(e)); } function Zb(e, r) { return e == null ? void 0 : e[r]; } function ba(e, r) { var t = Zb(e, r); return Hb(t) ? t : void 0; } var xu = ba(an, "WeakMap"); function Gb(e, r, t) { switch (t.length) { case 0: return e.call(r); case 1: return e.call(r, t[0]); case 2: return e.call(r, t[0], t[1]); case 3: return e.call(r, t[0], t[1], t[2]); } return e.apply(r, t); } var Wb = 800, Kb = 16, Jb = Date.now; function Yb(e) { var r = 0, t = 0; return function() { var n = Jb(), a = Kb - (n - t); if (t = n, a > 0) { if (++r >= Wb) return arguments[0]; } else r = 0; return e.apply(void 0, arguments); }; } function jb(e) { return function() { return e; }; } var zo = function() { try { var e = ba(Object, "defineProperty"); return e({}, "", {}), e; } catch { } }(), Xb = zo ? function(e, r) { return zo(e, "toString", { configurable: !0, enumerable: !1, value: jb(r), writable: !0 }); } : Eh, Qb = Yb(Xb); function ew(e, r, t, n) { e.length; for (var a = t + 1; a--; ) if (r(e[a], a, e)) return a; return -1; } var rw = 9007199254740991, tw = /^(?:0|[1-9]\d*)$/; function il(e, r) { var t = typeof e; return r = r ?? rw, !!r && (t == "number" || t != "symbol" && tw.test(e)) && e > -1 && e % 1 == 0 && e < r; } function nw(e, r, t) { r == "__proto__" && zo ? zo(e, r, { configurable: !0, enumerable: !0, value: t, writable: !0 }) : e[r] = t; } function ol(e, r) { return e === r || e !== e && r !== r; } var aw = Object.prototype, iw = aw.hasOwnProperty; function ow(e, r, t) { var n = e[r]; (!(iw.call(e, r) && ol(n, t)) || t === void 0 && !(r in e)) && nw(e, r, t); } var $c = Math.max; function sw(e, r, t) { return r = $c(r === void 0 ? e.length - 1 : r, 0), function() { for (var n = arguments, a = -1, i = $c(n.length - r, 0), o = Array(i); ++a < i; ) o[a] = n[r + a]; a = -1; for (var l = Array(r + 1); ++a < r; ) l[a] = n[a]; return l[r] = t(o), Gb(e, this, l); }; } var uw = 9007199254740991; function sl(e) { return typeof e == "number" && e > -1 && e % 1 == 0 && e <= uw; } function lw(e) { return e != null && sl(e.length) && !Sh(e); } var cw = Object.prototype; function fw(e) { var r = e && e.constructor, t = typeof r == "function" && r.prototype || cw; return e === t; } function dw(e, r) { for (var t = -1, n = Array(e); ++t < e; ) n[t] = r(t); return n; } var pw = "[object Arguments]"; function Ic(e) { return Va(e) && ai(e) == pw; } var Ch = Object.prototype, mw = Ch.hasOwnProperty, vw = Ch.propertyIsEnumerable, ul = Ic(/* @__PURE__ */ function() { return arguments; }()) ? Ic : function(e) { return Va(e) && mw.call(e, "callee") && !vw.call(e, "callee"); }; function hw() { return !1; } var Mh = typeof exports == "object" && exports && !exports.nodeType && exports, Rc = Mh && typeof module == "object" && module && !module.nodeType && module, gw = Rc && Rc.exports === Mh, Pc = gw ? an.Buffer : void 0, yw = Pc ? Pc.isBuffer : void 0, Au = yw || hw, bw = "[object Arguments]", ww = "[object Array]", xw = "[object Boolean]", Aw = "[object Date]", Nw = "[object Error]", Dw = "[object Function]", Ew = "[object Map]", Sw = "[object Number]", Cw = "[object Object]", Mw = "[object RegExp]", _w = "[object Set]", Fw = "[object String]", Tw = "[object WeakMap]", Ow = "[object ArrayBuffer]", Bw = "[object DataView]", $w = "[object Float32Array]", Iw = "[object Float64Array]", Rw = "[object Int8Array]", Pw = "[object Int16Array]", zw = "[object Int32Array]", qw = "[object Uint8Array]", Lw = "[object Uint8ClampedArray]", Uw = "[object Uint16Array]", kw = "[object Uint32Array]", Ar = {}; Ar[$w] = Ar[Iw] = Ar[Rw] = Ar[Pw] = Ar[zw] = Ar[qw] = Ar[Lw] = Ar[Uw] = Ar[kw] = !0; Ar[bw] = Ar[ww] = Ar[Ow] = Ar[xw] = Ar[Bw] = Ar[Aw] = Ar[Nw] = Ar[Dw] = Ar[Ew] = Ar[Sw] = Ar[Cw] = Ar[Mw] = Ar[_w] = Ar[Fw] = Ar[Tw] = !1; function Vw(e) { return Va(e) && sl(e.length) && !!Ar[ai(e)]; } function Hw(e) { return function(r) { return e(r); }; } var _h = typeof exports == "object" && exports && !exports.nodeType && exports, Si = _h && typeof module == "object" && module && !module.nodeType && module, Zw = Si && Si.exports === _h, Xs = Zw && Ah.process, zc = function() { try { var e = Si && Si.require && Si.require("util").types; return e || Xs && Xs.binding && Xs.binding("util"); } catch { } }(), qc = zc && zc.isTypedArray, Fh = qc ? Hw(qc) : Vw, Gw = Object.prototype, Ww = Gw.hasOwnProperty; function Kw(e, r) { var t = Ht(e), n = !t && ul(e), a = !t && !n && Au(e), i = !t && !n && !a && Fh(e), o = t || n || a || i, l = o ? dw(e.length, String) : [], u = l.length; for (var s in e) Ww.call(e, s) && !(o && // Safari 9 has enumerable `arguments.length` in strict mode. (s == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. a && (s == "offset" || s == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. i && (s == "buffer" || s == "byteLength" || s == "byteOffset") || // Skip index properties. il(s, u))) && l.push(s); return l; } function Jw(e, r) { return function(t) { return e(r(t)); }; } var Yw = Jw(Object.keys, Object), jw = Object.prototype, Xw = jw.hasOwnProperty; function Qw(e) { if (!fw(e)) return Yw(e); var r = []; for (var t in Object(e)) Xw.call(e, t) && t != "constructor" && r.push(t); return r; } function Th(e) { return lw(e) ? Kw(e) : Qw(e); } var ex = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, rx = /^\w*$/; function ll(e, r) { if (Ht(e)) return !1; var t = typeof e; return t == "number" || t == "symbol" || t == "boolean" || e == null || ms(e) ? !0 : rx.test(e) || !ex.test(e) || r != null && e in Object(r); } var Ti = ba(Object, "create"); function tx() { this.__data__ = Ti ? Ti(null) : {}, this.size = 0; } function nx(e) { var r = this.has(e) && delete this.__data__[e]; return this.size -= r ? 1 : 0, r; } var ax = "__lodash_hash_undefined__", ix = Object.prototype, ox = ix.hasOwnProperty; function sx(e) { var r = this.__data__; if (Ti) { var t = r[e]; return t === ax ? void 0 : t; } return ox.call(r, e) ? r[e] : void 0; } var ux = Object.prototype, lx = ux.hasOwnProperty; function cx(e) { var r = this.__data__; return Ti ? r[e] !== void 0 : lx.call(r, e); } var fx = "__lodash_hash_undefined__"; function dx(e, r) { var t = this.__data__; return this.size += this.has(e) ? 0 : 1, t[e] = Ti && r === void 0 ? fx : r, this; } function va(e) { var r = -1, t = e == null ? 0 : e.length; for (this.clear(); ++r < t; ) { var n = e[r]; this.set(n[0], n[1]); } } va.prototype.clear = tx; va.prototype.delete = nx; va.prototype.get = sx; va.prototype.has = cx; va.prototype.set = dx; function px() { this.__data__ = [], this.size = 0; } function vs(e, r) { for (var t = e.length; t--; ) if (ol(e[t][0], r)) return t; return -1; } var mx = Array.prototype, vx = mx.splice; function hx(e) { var r = this.__data__, t = vs(r, e); if (t < 0) return !1; var n = r.length - 1; return t == n ? r.pop() : vx.call(r, t, 1), --this.size, !0; } function gx(e) { var r = this.__data__, t = vs(r, e); return t < 0 ? void 0 : r[t][1]; } function yx(e) { return vs(this.__data__, e) > -1; } function bx(e, r) { var t = this.__data__, n = vs(t, e); return n < 0 ? (++this.size, t.push([e, r])) : t[n][1] = r, this; } function Mn(e) { var r = -1, t = e == null ? 0 : e.length; for (this.clear(); ++r < t; ) { var n = e[r]; this.set(n[0], n[1]); } } Mn.prototype.clear = px; Mn.prototype.delete = hx; Mn.prototype.get = gx; Mn.prototype.has = yx; Mn.prototype.set = bx; var Oi = ba(an, "Map"); function wx() { this.size = 0, this.__data__ = { hash: new va(), map: new (Oi || Mn)(), string: new va() }; } function xx(e) { var r = typeof e; return r == "string" || r == "number" || r == "symbol" || r == "boolean" ? e !== "__proto__" : e === null; } function hs(e, r) { var t = e.__data__; return xx(r) ? t[typeof r == "string" ? "string" : "hash"] : t.map; } function Ax(e) { var r = hs(this, e).delete(e); return this.size -= r ? 1 : 0, r; } function Nx(e) { return hs(this, e).get(e); } function Dx(e) { return hs(this, e).has(e); } function Ex(e, r) { var t = hs(this, e), n = t.size; return t.set(e, r), this.size += t.size == n ? 0 : 1, this; } function _n(e) { var r = -1, t = e == null ? 0 : e.length; for (this.clear(); ++r < t; ) { var n = e[r]; this.set(n[0], n[1]); } } _n.prototype.clear = wx; _n.prototype.delete = Ax; _n.prototype.get = Nx; _n.prototype.has = Dx; _n.prototype.set = Ex; var Sx = "Expected a function"; function cl(e, r) { if (typeof e != "function" || r != null && typeof r != "function") throw new TypeError(Sx); var t = function() { var n = arguments, a = r ? r.apply(this, n) : n[0], i = t.cache; if (i.has(a)) return i.get(a); var o = e.apply(this, n); return t.cache = i.set(a, o) || i, o; }; return t.cache = new (cl.Cache || _n)(), t; } cl.Cache = _n; var Cx = 500; function Mx(e) { var r = cl(e, function(n) { return t.size === Cx && t.clear(), n; }), t = r.cache; return r; } var _x = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Fx = /\\(\\)?/g, Tx = Mx(function(e) { var r = []; return e.charCodeAt(0) === 46 && r.push(""), e.replace(_x, function(t, n, a, i) { r.push(a ? i.replace(Fx, "$1") : n || t); }), r; }); function Ox(e) { return e == null ? "" : Dh(e); } function gs(e, r) { return Ht(e) ? e : ll(e, r) ? [e] : Tx(Ox(e)); } function ki(e) { if (typeof e == "string" || ms(e)) return e; var r = e + ""; return r == "0" && 1 / e == -1 / 0 ? "-0" : r; } function fl(e, r) { r = gs(r, e); for (var t = 0, n = r.length; e != null && t < n; ) e = e[ki(r[t++])]; return t && t == n ? e : void 0; } function hn(e, r, t) { var n = e == null ? void 0 : fl(e, r); return n === void 0 ? t : n; } function Oh(e, r) { for (var t = -1, n = r.length, a = e.length; ++t < n; ) e[a + t] = r[t]; return e; } var Lc = Qt ? Qt.isConcatSpreadable : void 0; function Bx(e) { return Ht(e) || ul(e) || !!(Lc && e && e[Lc]); } function $x(e, r, t, n, a) { var i = -1, o = e.length; for (t || (t = Bx), a || (a = []); ++i < o; ) { var l = e[i]; t(l) ? Oh(a, l) : a[a.length] = l; } return a; } function Ix(e) { var r = e == null ? 0 : e.length; return r ? $x(e) : []; } function Rx(e) { return Qb(sw(e, void 0, Ix), e + ""); } function Ln() { if (!arguments.length) return []; var e = arguments[0]; return Ht(e) ? e : [e]; } function Px() { this.__data__ = new Mn(), this.size = 0; } function zx(e) { var r = this.__data__, t = r.delete(e); return this.size = r.size, t; } function qx(e) { return this.__data__.get(e); } function Lx(e) { return this.__data__.has(e); } var Ux = 200; function kx(e, r) { var t = this.__data__; if (t instanceof Mn) { var n = t.__data__; if (!Oi || n.length < Ux - 1) return n.push([e, r]), this.size = ++t.size, this; t = this.__data__ = new _n(n); } return t.set(e, r), this.size = t.size, this; } function xn(e) { var r = this.__data__ = new Mn(e); this.size = r.size; } xn.prototype.clear = Px; xn.prototype.delete = zx; xn.prototype.get = qx; xn.prototype.has = Lx; xn.prototype.set = kx; function Vx(e, r) { for (var t = -1, n = e == null ? 0 : e.length, a = 0, i = []; ++t < n; ) { var o = e[t]; r(o, t, e) && (i[a++] = o); } return i; } function Hx() { return []; } var Zx = Object.prototype, Gx = Zx.propertyIsEnumerable, Uc = Object.getOwnPropertySymbols, Wx = Uc ? function(e) { return e == null ? [] : (e = Object(e), Vx(Uc(e), function(r) { return Gx.call(e, r); })); } : Hx; function Kx(e, r, t) { var n = r(e); return Ht(e) ? n : Oh(n, t(e)); } function kc(e) { return Kx(e, Th, Wx); } var Nu = ba(an, "DataView"), Du = ba(an, "Promise"), Eu = ba(an, "Set"), Vc = "[object Map]", Jx = "[object Object]", Hc = "[object Promise]", Zc = "[object Set]", Gc = "[object WeakMap]", Wc = "[object DataView]", Yx = ya(Nu), jx = ya(Oi), Xx = ya(Du), Qx = ya(Eu), e2 = ya(xu), Pn = ai; (Nu && Pn(new Nu(new ArrayBuffer(1))) != Wc || Oi && Pn(new Oi()) != Vc || Du && Pn(Du.resolve()) != Hc || Eu && Pn(new Eu()) != Zc || xu && Pn(new xu()) != Gc) && (Pn = function(e) { var r = ai(e), t = r == Jx ? e.constructor : void 0, n = t ? ya(t) : ""; if (n) switch (n) { case Yx: return Wc; case jx: return Vc; case Xx: return Hc; case Qx: return Zc; case e2: return Gc; } return r; }); var Kc = an.Uint8Array, r2 = "__lodash_hash_undefined__"; function t2(e) { return this.__data__.set(e, r2), this; } function n2(e) { return this.__data__.has(e); } function qo(e) { var r = -1, t = e == null ? 0 : e.length; for (this.__data__ = new _n(); ++r < t; ) this.add(e[r]); } qo.prototype.add = qo.prototype.push = t2; qo.prototype.has = n2; function a2(e, r) { for (var t = -1, n = e == null ? 0 : e.length; ++t < n; ) if (r(e[t], t, e)) return !0; return !1; } function i2(e, r) { return e.has(r); } var o2 = 1, s2 = 2; function Bh(e, r, t, n, a, i) { var o = t & o2, l = e.length, u = r.length; if (l != u && !(o && u > l)) return !1; var s = i.get(e), c = i.get(r); if (s && c) return s == r && c == e; var f = -1, d = !0, p = t & s2 ? new qo() : void 0; for (i.set(e, r), i.set(r, e); ++f < l; ) { var m = e[f], v = r[f]; if (n) var b = o ? n(v, m, f, r, e, i) : n(m, v, f, e, r, i); if (b !== void 0) { if (b) continue; d = !1; break; } if (p) { if (!a2(r, function(y, A) { if (!i2(p, A) && (m === y || a(m, y, t, n, i))) return p.push(A); })) { d = !1; break; } } else if (!(m === v || a(m, v, t, n, i))) { d = !1; break; } } return i.delete(e), i.delete(r), d; } function u2(e) { var r = -1, t = Array(e.size); return e.forEach(function(n, a) { t[++r] = [a, n]; }), t; } function l2(e) { var r = -1, t = Array(e.size); return e.forEach(function(n) { t[++r] = n; }), t; } var c2 = 1, f2 = 2, d2 = "[object Boolean]", p2 = "[object Date]", m2 = "[object Error]", v2 = "[object Map]", h2 = "[object Number]", g2 = "[object RegExp]", y2 = "[object Set]", b2 = "[object String]", w2 = "[object Symbol]", x2 = "[object ArrayBuffer]", A2 = "[object DataView]", Jc = Qt ? Qt.prototype : void 0, Qs = Jc ? Jc.valueOf : void 0; function N2(e, r, t, n, a, i, o) { switch (t) { case A2: if (e.byteLength != r.byteLength || e.byteOffset != r.byteOffset) return !1; e = e.buffer, r = r.buffer; case x2: return !(e.byteLength != r.byteLength || !i(new Kc(e), new Kc(r))); case d2: case p2: case h2: return ol(+e, +r); case m2: return e.name == r.name && e.message == r.message; case g2: case b2: return e == r + ""; case v2: var l = u2; case y2: var u = n & c2; if (l || (l = l2), e.size != r.size && !u) return !1; var s = o.get(e); if (s) return s == r; n |= f2, o.set(e, r); var c = Bh(l(e), l(r), n, a, i, o); return o.delete(e), c; case w2: if (Qs) return Qs.call(e) == Qs.call(r); } return !1; } var D2 = 1, E2 = Object.prototype, S2 = E2.hasOwnProperty; function C2(e, r, t, n, a, i) { var o = t & D2, l = kc(e), u = l.length, s = kc(r), c = s.length; if (u != c && !o) return !1; for (var f = u; f--; ) { var d = l[f]; if (!(o ? d in r : S2.call(r, d))) return !1; } var p = i.get(e), m = i.get(r); if (p && m) return p == r && m == e; var v = !0; i.set(e, r), i.set(r, e); for (var b = o; ++f < u; ) { d = l[f]; var y = e[d], A = r[d]; if (n) var h = o ? n(A, y, d, r, e, i) : n(y, A, d, e, r, i); if (!(h === void 0 ? y === A || a(y, A, t, n, i) : h)) { v = !1; break; } b || (b = d == "constructor"); } if (v && !b) { var x = e.constructor, w = r.constructor; x != w && "constructor" in e && "constructor" in r && !(typeof x == "function" && x instanceof x && typeof w == "function" && w instanceof w) && (v = !1); } return i.delete(e), i.delete(r), v; } var M2 = 1, Yc = "[object Arguments]", jc = "[object Array]", to = "[object Object]", _2 = Object.prototype, Xc = _2.hasOwnProperty; function F2(e, r, t, n, a, i) { var o = Ht(e), l = Ht(r), u = o ? jc : Pn(e), s = l ? jc : Pn(r); u = u == Yc ? to : u, s = s == Yc ? to : s; var c = u == to, f = s == to, d = u == s; if (d && Au(e)) { if (!Au(r)) return !1; o = !0, c = !1; } if (d && !c) return i || (i = new xn()), o || Fh(e) ? Bh(e, r, t, n, a, i) : N2(e, r, u, t, n, a, i); if (!(t & M2)) { var p = c && Xc.call(e, "__wrapped__"), m = f && Xc.call(r, "__wrapped__"); if (p || m) { var v = p ? e.value() : e, b = m ? r.value() : r; return i || (i = new xn()), a(v, b, t, n, i); } } return d ? (i || (i = new xn()), C2(e, r, t, n, a, i)) : !1; } function ys(e, r, t, n, a) { return e === r ? !0 : e == null || r == null || !Va(e) && !Va(r) ? e !== e && r !== r : F2(e, r, t, n, ys, a); } var T2 = 1, O2 = 2; function B2(e, r, t, n) { var a = t.length, i = a; if (e == null) return !i; for (e = Object(e); a--; ) { var o = t[a]; if (o[2] ? o[1] !== e[o[0]] : !(o[0] in e)) return !1; } for (; ++a < i; ) { o = t[a]; var l = o[0], u = e[l], s = o[1]; if (o[2]) { if (u === void 0 && !(l in e)) return !1; } else { var c = new xn(), f; if (!(f === void 0 ? ys(s, u, T2 | O2, n, c) : f)) return !1; } } return !0; } function $h(e) { return e === e && !Kn(e); } function $2(e) { for (var r = Th(e), t = r.length; t--; ) { var n = r[t], a = e[n]; r[t] = [n, a, $h(a)]; } return r; } function Ih(e, r) { return function(t) { return t == null ? !1 : t[e] === r && (r !== void 0 || e in Object(t)); }; } function I2(e) { var r = $2(e); return r.length == 1 && r[0][2] ? Ih(r[0][0], r[0][1]) : function(t) { return t === e || B2(t, e, r); }; } function R2(e, r) { return e != null && r in Object(e); } function P2(e, r, t) { r = gs(r, e); for (var n = -1, a = r.length, i = !1; ++n < a; ) { var o = ki(r[n]); if (!(i = e != null && t(e, o))) break; e = e[o]; } return i || ++n != a ? i : (a = e == null ? 0 : e.length, !!a && sl(a) && il(o, a) && (Ht(e) || ul(e))); } function Rh(e, r) { return e != null && P2(e, r, R2); } var z2 = 1, q2 = 2; function L2(e, r) { return ll(e) && $h(r) ? Ih(ki(e), r) : function(t) { var n = hn(t, e); return n === void 0 && n === r ? Rh(t, e) : ys(r, n, z2 | q2); }; } function U2(e) { return function(r) { return r == null ? void 0 : r[e]; }; } function k2(e) { return function(r) { return fl(r, e); }; } function V2(e) { return ll(e) ? U2(ki(e)) : k2(e); } function H2(e) { return typeof e == "function" ? e : e == null ? Eh : typeof e == "object" ? Ht(e) ? L2(e[0], e[1]) : I2(e) : V2(e); } var eu = function() { return an.Date.now(); }, Z2 = "Expected a function", G2 = Math.max, W2 = Math.min; function Su(e, r, t) { var n, a, i, o, l, u, s = 0, c = !1, f = !1, d = !0; if (typeof e != "function") throw new TypeError(Z2); r = Oc(r) || 0, Kn(t) && (c = !!t.leading, f = "maxWait" in t, i = f ? G2(Oc(t.maxWait) || 0, r) : i, d = "trailing" in t ? !!t.trailing : d); function p(g) { var D = n, E = a; return n = a = void 0, s = g, o = e.apply(E, D), o; } function m(g) { return s = g, l = setTimeout(y, r), c ? p(g) : o; } function v(g) { var D = g - u, E = g - s, N = r - D; return f ? W2(N, i - E) : N; } function b(g) { var D = g - u, E = g - s; return u === void 0 || D >= r || D < 0 || f && E >= i; } function y() { var g = eu(); if (b(g)) return A(g); l = setTimeout(y, v(g)); } function A(g) { return l = void 0, d && n ? p(g) : (n = a = void 0, o); } function h() { l !== void 0 && clearTimeout(l), s = 0, n = u = a = l = void 0; } function x() { return l === void 0 ? o : A(eu()); } function w() { var g = eu(), D = b(g); if (n = arguments, a = this, u = g, D) { if (l === void 0) return m(u); if (f) return clearTimeout(l), l = setTimeout(y, r), p(u); } return l === void 0 && (l = setTimeout(y, r)), o; } return w.cancel = h, w.flush = x, w; } function K2(e, r, t) { var n = e == null ? 0 : e.length; if (!n) return -1; var a = n - 1; return ew(e, H2(r), a); } function Lo(e) { for (var r = -1, t = e == null ? 0 : e.length, n = {}; ++r < t; ) { var a = e[r]; n[a[0]] = a[1]; } return n; } function Cu(e, r) { return ys(e, r); } function An(e) { return e == null; } function J2(e) { return e === void 0; } function Y2(e, r, t, n) { if (!Kn(e)) return e; r = gs(r, e); for (var a = -1, i = r.length, o = i - 1, l = e; l != null && ++a < i; ) { var u = ki(r[a]), s = t; if (u === "__proto__" || u === "constructor" || u === "prototype") return e; if (a != o) { var c = l[u]; s = void 0, s === void 0 && (s = Kn(c) ? c : il(r[a + 1]) ? [] : {}); } ow(l, u, s), l = l[u]; } return e; } function j2(e, r, t) { for (var n = -1, a = r.length, i = {}; ++n < a; ) { var o = r[n], l = fl(e, o); t(l, o) && Y2(i, gs(o, e), l); } return i; } function X2(e, r) { return j2(e, r, function(t, n) { return Rh(e, n); }); } var Q2 = Rx(function(e, r) { return e == null ? {} : X2(e, r); }); const yn = (e) => e === void 0, Ph = (e) => typeof e == "boolean", Nr = (e) => typeof e == "number", la = (e) => typeof Element > "u" ? !1 : e instanceof Element, eA = (e) => wt(e) ? !Number.isNaN(Number(e)) : !1, rA = (e = "") => e.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"), Qc = (e) => Object.keys(e); class zh extends Error { constructor(r) { super(r), this.name = "ElementPlusError"; } } function dl(e, r) { throw new zh(`[${e}] ${r}`); } function Tr(e, r) { if (process.env.NODE_ENV !== "production") { const t = wt(e) ? new zh(`[${e}] ${r}`) : e; console.warn(t); } } const tA = "utils/dom/style", qh = (e = "") => e.split(" ").filter((r) => !!r.trim()), ef = (e, r) => { !e || !r.trim() || e.classList.add(...qh(r)); }, Uo = (e, r) => { !e || !r.trim() || e.classList.remove(...qh(r)); }, wi = (e, r) => { var t; if (!Ir || !e || !r) return ""; let n = ub(r); n === "float" && (n = "cssFloat"); try { const a = e.style[n]; if (a) return a; const i = (t = document.defaultView) == null ? void 0 : t.getComputedStyle(e, ""); return i ? i[n] : ""; } catch { return e.style[n]; } }; function Mu(e, r = "px") { if (!e) return ""; if (Nr(e) || eA(e)) return `${e}${r}`; if (wt(e)) return e; Tr(tA, "binding value must be a string or number"); } function nA(e, r) { if (!Ir) return; if (!r) { e.scrollTop = 0; return; } const t = []; let n = r.offsetParent; for (; n !== null && e !== n && e.contains(n); ) t.push(n), n = n.offsetParent; const a = r.offsetTop + t.reduce((u, s) => u + s.offsetTop, 0), i = a + r.offsetHeight, o = e.scrollTop, l = o + e.clientHeight; a < o ? e.scrollTop = a : i > l && (e.scrollTop = i - e.clientHeight); } /*! Element Plus Icons Vue v2.3.2 */ var aA = /* @__PURE__ */ Re({ name: "ArrowDown", __name: "arrow-down", setup(e) { return (r, t) => (he(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ $e("path", { fill: "currentColor", d: "M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z" }) ])); } }), Lh = aA, iA = /* @__PURE__ */ Re({ name: "ArrowUp", __name: "arrow-up", setup(e) { return (r, t) => (he(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ $e("path", { fill: "currentColor", d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0" }) ])); } }), oA = iA, sA = /* @__PURE__ */ Re({ name: "CircleCheck", __name: "circle-check", setup(e) { return (r, t) => (he(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ $e("path", { fill: "currentColor", d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896" }), $e("path", { fill: "currentColor", d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752z" }) ])); } }), uA = sA, lA = /* @__PURE__ */ Re({ name: "CircleClose", __name: "circle-close", setup(e) { return (r, t) => (he(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ $e("path", { fill: "currentColor", d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z" }), $e("path", { fill: "currentColor", d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896" }) ])); } }), pl = lA, cA = /* @__PURE__ */ Re({ name: "Close", __name: "close", setup(e) { return (r, t) => (he(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ $e("path", { fill: "currentColor", d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z" }) ])); } }), rf = cA, fA = /* @__PURE__ */ Re({ name: "Hide", __name: "hide", setup(e) { return (r, t) => (he(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ $e("path", { fill: "currentColor", d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4s-12.8-9.6-22.4-9.6-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176S0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4s3.2 16 9.6 22.4 12.8 9.6 22.4 9.6 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4m-646.4 528Q115.2 579.2 76.8 512q43.2-72 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4m140.8-96Q352 555.2 352 512c0-44.8 16-83.2 48-112s67.2-48 112-48c28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6q-43.2 72-153.6 172.8c-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176S1024 528 1024 512s-48.001-73.6-134.401-176" }), $e("path", { fill: "currentColor", d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112s-67.2 48-112 48" }) ])); } }), dA = fA, pA = /* @__PURE__ */ Re({ name: "Loading", __name: "loading", setup(e) { return (r, t) => (he(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ $e("path", { fill: "currentColor", d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0" }) ])); } }), Uh = pA, mA = /* @__PURE__ */ Re({ name: "Minus", __name: "minus", setup(e) { return (r, t) => (he(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ $e("path", { fill: "currentColor", d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64" }) ])); } }), vA = mA, hA = /* @__PURE__ */ Re({ name: "Plus", __name: "plus", setup(e) { return (r, t) => (he(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ $e("path", { fill: "currentColor", d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z" }) ])); } }), gA = hA, yA = /* @__PURE__ */ Re({ name: "View", __name: "view", setup(e) { return (r, t) => (he(), Ce("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ $e("path", { fill: "currentColor", d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160" }) ])); } }), bA = yA; const kh = "__epPropKey", rr = (e) => e, wA = (e) => dt(e) && !!e[kh], bs = (e, r) => { if (!dt(e) || wA(e)) return e; const { values: t, required: n, default: a, type: i, validator: o } = e, u = { type: i, required: !!n, validator: t || o ? (s) => { let c = !1, f = []; if (t && (f = Array.from(t), Cc(e, "default") && f.push(a), c || (c = f.includes(s))), o && (c || (c = o(s))), !c && f.length > 0) { const d = [...new Set(f)].map((p) => JSON.stringify(p)).join(", "); D1(`Invalid prop: validation failed${r ? ` for prop "${r}"` : ""}. Expected one of [${d}], got value ${JSON.stringify(s)}.`); } return c; } : void 0, [kh]: !0 }; return Cc(e, "default") && (u.default = a), u; }, Er = (e) => Lo(Object.entries(e).map(([r, t]) => [ r, bs(t, r) ])), Ha = rr([ String, Object, Function ]), Vh = { validating: Uh, success: uA, error: pl }, Bt = (e, r) => { if (e.install = (t) => { for (const n of [e, ...Object.values(r ?? {})]) t.component(n.name, n); }, r) for (const [t, n] of Object.entries(r)) e[t] = n; return e; }, ml = (e) => (e.install = Fi, e), Za = { tab: "Tab", enter: "Enter", space: "Space", left: "ArrowLeft", up: "ArrowUp", right: "ArrowRight", down: "ArrowDown", esc: "Escape", delete: "Delete", pageUp: "PageUp", pageDown: "PageDown", home: "Home", end: "End" }, Or = "update:modelValue", ii = "change", ca = "input", Hh = ["", "default", "small", "large"], xA = (e) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(e), AA = (e) => e, NA = ["class", "style"], DA = /^on[A-Z]/, EA = (e = {}) => { const { excludeListeners: r = !1, excludeKeys: t } = e, n = ue(() => ((t == null ? void 0 : t.value) || []).concat(NA)), a = ot(); return a ? ue(() => { var i; return Lo(Object.entries((i = a.proxy) == null ? void 0 : i.$attrs).filter(([o]) => !n.value.includes(o) && !(r && DA.test(o)))); }) : (Tr("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"), ue(() => ({}))); }, SA = ({ from: e, replacement: r, scope: t, version: n, ref: a, type: i = "API" }, o) => { er(() => U(o), (l) => { l && Tr(t, `[${i}] ${e} is about to be deprecated in version ${n}, please use ${r} instead. For more detail, please visit: ${a} `); }, { immediate: !0 }); }; var CA = { name: "en", el: { breadcrumb: { label: "Breadcrumb" }, colorpicker: { confirm: "OK", clear: "Clear", defaultLabel: "color picker", description: "current color is {color}. press enter to select a new color.", alphaLabel: "pick alpha value" }, datepicker: { now: "Now", today: "Today", cancel: "Cancel", clear: "Clear", confirm: "OK", dateTablePrompt: "Use the arrow keys and enter to select the day of the month", monthTablePrompt: "Use the arrow keys and enter to select the month", yearTablePrompt: "Use the arrow keys and enter to select the year", selectedDate: "Selected date", selectDate: "Select date", selectTime: "Select time", startDate: "Start Date", startTime: "Start Time", endDate: "End Date", endTime: "End Time", prevYear: "Previous Year", nextYear: "Next Year", prevMonth: "Previous Month", nextMonth: "Next Month", year: "", month1: "January", month2: "February", month3: "March", month4: "April", month5: "May", month6: "June", month7: "July", month8: "August", month9: "September", month10: "October", month11: "November", month12: "December", week: "week", weeks: { sun: "Sun", mon: "Mon", tue: "Tue", wed: "Wed", thu: "Thu", fri: "Fri", sat: "Sat" }, weeksFull: { sun: "Sunday", mon: "Monday", tue: "Tuesday", wed: "Wednesday", thu: "Thursday", fri: "Friday", sat: "Saturday" }, months: { jan: "Jan", feb: "Feb", mar: "Mar", apr: "Apr", may: "May", jun: "Jun", jul: "Jul", aug: "Aug", sep: "Sep", oct: "Oct", nov: "Nov", dec: "Dec" } }, inputNumber: { decrease: "decrease number", increase: "increase number" }, select: { loading: "Loading", noMatch: "No matching data", noData: "No data", placeholder: "Select" }, mention: { loading: "Loading" }, dropdown: { toggleDropdown: "Toggle Dropdown" }, cascader: { noMatch: "No matching data", loading: "Loading", placeholder: "Select", noData: "No data" }, pagination: { goto: "Go to", pagesize: "/page", total: "Total {total}", pageClassifier: "", page: "Page", prev: "Go to previous page", next: "Go to next page", currentPage: "page {pager}", prevPages: "Previous {pager} pages", nextPages: "Next {pager} pages", deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details" }, dialog: { close: "Close this dialog" }, drawer: { close: "Close this dialog" }, messagebox: { title: "Message", confirm: "OK", cancel: "Cancel", error: "Illegal input", close: "Close this dialog" }, upload: { deleteTip: "press delete to remove", delete: "Delete", preview: "Preview", continue: "Continue" }, slider: { defaultLabel: "slider between {min} and {max}", defaultRangeStartLabel: "pick start value", defaultRangeEndLabel: "pick end value" }, table: { emptyText: "No Data", confirmFilter: "Confirm", resetFilter: "Reset", clearFilter: "All", sumText: "Sum" }, tour: { next: "Next", previous: "Previous", finish: "Finish" }, tree: { emptyText: "No Data" }, transfer: { noMatch: "No matching data", noData: "No data", titles: ["List 1", "List 2"], filterPlaceholder: "Enter keyword", noCheckedFormat: "{total} items", hasCheckedFormat: "{checked}/{total} checked" }, image: { error: "FAILED" }, pageHeader: { title: "Back" }, popconfirm: { confirmButtonText: "Yes", cancelButtonText: "No" }, carousel: { leftArrow: "Carousel arrow left", rightArrow: "Carousel arrow right", indicator: "Carousel switch to index {index}" } } }; const MA = (e) => (r, t) => _A(r, t, U(e)), _A = (e, r, t) => hn(t, e, e).replace(/\{(\w+)\}/g, (n, a) => { var i; return `${(i = r == null ? void 0 : r[a]) != null ? i : `{${a}}`}`; }), FA = (e) => { const r = ue(() => U(e).name), t = ph(e) ? e : Se(e); return { lang: r, locale: t, t: MA(e) }; }, Zh = Symbol("localeContextKey"), ws = (e) => { const r = e || vr(Zh, Se()); return FA(ue(() => r.value || CA)); }, To = "el", TA = "is-", ia = (e, r, t, n, a) => { let i = `${e}-${r}`; return t && (i += `-${t}`), n && (i += `__${n}`), a && (i += `--${a}`), i; }, Gh = Symbol("namespaceContextKey"), vl = (e) => { const r = e || (ot() ? vr(Gh, Se(To)) : Se(To)); return ue(() => U(r) || To); }, Dr = (e, r) => { const t = vl(r); return { namespace: t, b: (v = "") => ia(t.value, e, v, "", ""), e: (v) => v ? ia(t.value, e, "", v, "") : "", m: (v) => v ? ia(t.value, e, "", "", v) : "", be: (v, b) => v && b ? ia(t.value, e, v, b, "") : "", em: (v, b) => v && b ? ia(t.value, e, "", v, b) : "", bm: (v, b) => v && b ? ia(t.value, e, v, "", b) : "", bem: (v, b, y) => v && b && y ? ia(t.value, e, v, b, y) : "", is: (v, ...b) => { const y = b.length >= 1 ? b[0] : !0; return v && y ? `${TA}${v}` : ""; }, cssVar: (v) => { const b = {}; for (const y in v) v[y] && (b[`--${t.value}-${y}`] = v[y]); return b; }, cssVarName: (v) => `--${t.value}-${v}`, cssVarBlock: (v) => { const b = {}; for (const y in v) v[y] && (b[`--${t.value}-${e}-${y}`] = v[y]); return b; }, cssVarBlockName: (v) => `--${t.value}-${e}-${v}` }; }, OA = bs({ type: rr(Boolean), default: null }), BA = bs({ type: rr(Function) }), $A = (e) => { const r = `update:${e}`, t = `onUpdate:${e}`, n = [r], a = { [e]: OA, [t]: BA }; return { useModelToggle: ({ indicator: o, toggleReason: l, shouldHideWhenRouteChanges: u, shouldProceed: s, onShow: c, onHide: f }) => { const d = ot(), { emit: p } = d, m = d.props, v = ue(() => Xr(m[t])), b = ue(() => m[e] === null), y = (D) => { o.value !== !0 && (o.value = !0, l && (l.value = D), Xr(c) && c(D)); }, A = (D) => { o.value !== !1 && (o.value = !1, l && (l.value = D), Xr(f) && f(D)); }, h = (D) => { if (m.disabled === !0 || Xr(s) && !s()) return; const E = v.value && Ir; E && p(r, !0), (b.value || !E) && y(D); }, x = (D) => { if (m.disabled === !0 || !Ir) return; const E = v.value && Ir; E && p(r, !1), (b.value || !E) && A(D); }, w = (D) => { Ph(D) && (m.disabled && D ? v.value && p(r, !1) : o.value !== D && (D ? y() : A())); }, g = () => { o.value ? x() : h(); }; return er(() => m[e], w), u && d.appContext.config.globalProperties.$route !== void 0 && er(() => ({ ...d.proxy.$route }), () => { u.value && o.value && x(); }), Wr(() => { w(m[e]); }), { hide: x, show: h, toggle: g, hasUpdateHandler: v }; }, useModelToggleProps: a, useModelToggleEmits: n }; }, Wh = (e) => { const r = ot(); return ue(() => { var t, n; return (n = (t = r == null ? void 0 : r.proxy) == null ? void 0 : t.$props) == null ? void 0 : n[e]; }); }; var pt = "top", Tt = "bottom", Ot = "right", mt = "left", hl = "auto", Vi = [pt, Tt, Ot, mt], Ga = "start", Bi = "end", IA = "clippingParents", Kh = "viewport", xi = "popper", RA = "reference", tf = Vi.reduce(function(e, r) { return e.concat([r + "-" + Ga, r + "-" + Bi]); }, []), oi = [].concat(Vi, [hl]).reduce(function(e, r) { return e.concat([r, r + "-" + Ga, r + "-" + Bi]); }, []), PA = "beforeRead", zA = "read", qA = "afterRead", LA = "beforeMain", UA = "main", kA = "afterMain", VA = "beforeWrite", HA = "write", ZA = "afterWrite", GA = [PA, zA, qA, LA, UA, kA, VA, HA, ZA]; function en(e) { return e ? (e.nodeName || "").toLowerCase() : null; } function Zt(e) { if (e == null) return window; if (e.toString() !== "[object Window]") { var r = e.ownerDocument; return r && r.defaultView || window; } return e; } function Wa(e) { var r = Zt(e).Element; return e instanceof r || e instanceof Element; } function _t(e) { var r = Zt(e).HTMLElement; return e instanceof r || e instanceof HTMLElement; } function gl(e) { if (typeof ShadowRoot > "u") return !1; var r = Zt(e).ShadowRoot; return e instanceof r || e instanceof ShadowRoot; } function WA(e) { var r = e.state; Object.keys(r.elements).forEach(function(t) { var n = r.styles[t] || {}, a = r.attributes[t] || {}, i = r.elements[t]; !_t(i) || !en(i) || (Object.assign(i.style, n), Object.keys(a).forEach(function(o) { var l = a[o]; l === !1 ? i.removeAttribute(o) : i.setAttribute(o, l === !0 ? "" : l); })); }); } function KA(e) { var r = e.state, t = { popper: { position: r.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} }; return Object.assign(r.elements.popper.style, t.popper), r.styles = t, r.elements.arrow && Object.assign(r.elements.arrow.style, t.arrow), function() { Object.keys(r.elements).forEach(function(n) { var a = r.elements[n], i = r.attributes[n] || {}, o = Object.keys(r.styles.hasOwnProperty(n) ? r.styles[n] : t[n]), l = o.reduce(function(u, s) { return u[s] = "", u; }, {}); !_t(a) || !en(a) || (Object.assign(a.style, l), Object.keys(i).forEach(function(u) { a.removeAttribute(u); })); }); }; } var Jh = { name: "applyStyles", enabled: !0, phase: "write", fn: WA, effect: KA, requires: ["computeStyles"] }; function Xt(e) { return e.split("-")[0]; } var fa = Math.max, ko = Math.min, Ka = Math.round; function Ja(e, r) { r === void 0 && (r = !1); var t = e.getBoundingClientRect(), n = 1, a = 1; if (_t(e) && r) { var i = e.offsetHeight, o = e.offsetWidth; o > 0 && (n = Ka(t.width) / o || 1), i > 0 && (a = Ka(t.height) / i || 1); } return { width: t.width / n, height: t.height / a, top: t.top / a, right: t.right / n, bottom: t.bottom / a, left: t.left / n, x: t.left / n, y: t.top / a }; } function yl(e) { var r = Ja(e), t = e.offsetWidth, n = e.offsetHeight; return Math.abs(r.width - t) <= 1 && (t = r.width), Math.abs(r.height - n) <= 1 && (n = r.height), { x: e.offsetLeft, y: e.offsetTop, width: t, height: n }; } function Yh(e, r) { var t = r.getRootNode && r.getRootNode(); if (e.contains(r)) return !0; if (t && gl(t)) { var n = r; do { if (n && e.isSameNode(n)) return !0; n = n.parentNode || n.host; } while (n); } return !1; } function Dn(e) { return Zt(e).getComputedStyle(e); } function JA(e) { return ["table", "td", "th"].indexOf(en(e)) >= 0; } function Xn(e) { return ((Wa(e) ? e.ownerDocument : e.document) || window.document).documentElement; } function xs(e) { return en(e) === "html" ? e : e.assignedSlot || e.parentNode || (gl(e) ? e.host : null) || Xn(e); } function nf(e) { return !_t(e) || Dn(e).position === "fixed" ? null : e.offsetParent; } function YA(e) { var r = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, t = navigator.userAgent.indexOf("Trident") !== -1; if (t && _t(e)) { var n = Dn(e); if (n.position === "fixed") return null; } var a = xs(e); for (gl(a) && (a = a.host); _t(a) && ["html", "body"].indexOf(en(a)) < 0; ) { var i = Dn(a); if (i.transform !== "none" || i.perspective !== "none" || i.contain === "paint" || ["transform", "perspective"].indexOf(i.willChange) !== -1 || r && i.willChange === "filter" || r && i.filter && i.filter !== "none") return a; a = a.parentNode; } return null; } function Hi(e) { for (var r = Zt(e), t = nf(e); t && JA(t) && Dn(t).position === "static"; ) t = nf(t); return t && (en(t) === "html" || en(t) === "body" && Dn(t).position === "static") ? r : t || YA(e) || r; } function bl(e) { return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y"; } function Ci(e, r, t) { return fa(e, ko(r, t)); } function jA(e, r, t) { var n = Ci(e, r, t); return n > t ? t : n; } function jh() { return { top: 0, right: 0, bottom: 0, left: 0 }; } function Xh(e) { return Object.assign({}, jh(), e); } function Qh(e, r) { return r.reduce(function(t, n) { return t[n] = e, t; }, {}); } var XA = function(e, r) { return e = typeof e == "function" ? e(Object.assign({}, r.rects, { placement: r.placement })) : e, Xh(typeof e != "number" ? e : Qh(e, Vi)); }; function QA(e) { var r, t = e.state, n = e.name, a = e.options, i = t.elements.arrow, o = t.modifiersData.popperOffsets, l = Xt(t.placement), u = bl(l), s = [mt, Ot].indexOf(l) >= 0, c = s ? "height" : "width"; if (!(!i || !o)) { var f = XA(a.padding, t), d = yl(i), p = u === "y" ? pt : mt, m = u === "y" ? Tt : Ot, v = t.rects.reference[c] + t.rects.reference[u] - o[u] - t.rects.popper[c], b = o[u] - t.rects.reference[u], y = Hi(i), A = y ? u === "y" ? y.clientHeight || 0 : y.clientWidth || 0 : 0, h = v / 2 - b / 2, x = f[p], w = A - d[c] - f[m], g = A / 2 - d[c] / 2 + h, D = Ci(x, g, w), E = u; t.modifiersData[n] = (r = {}, r[E] = D, r.centerOffset = D - g, r); } } function eN(e) { var r = e.state, t = e.options, n = t.element, a = n === void 0 ? "[data-popper-arrow]" : n; a != null && (typeof a == "string" && (a = r.elements.popper.querySelector(a), !a) || !Yh(r.elements.popper, a) || (r.elements.arrow = a)); } var rN = { name: "arrow", enabled: !0, phase: "main", fn: QA, effect: eN, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] }; function Ya(e) { return e.split("-")[1]; } var tN = { top: "auto", right: "auto", bottom: "auto", left: "auto" }; function nN(e) { var r = e.x, t = e.y, n = window, a = n.devicePixelRatio || 1; return { x: Ka(r * a) / a || 0, y: Ka(t * a) / a || 0 }; } function af(e) { var r, t = e.popper, n = e.popperRect, a = e.placement, i = e.variation, o = e.offsets, l = e.position, u = e.gpuAcceleration, s = e.adaptive, c = e.roundOffsets, f = e.isFixed, d = o.x, p = d === void 0 ? 0 : d, m = o.y, v = m === void 0 ? 0 : m, b = typeof c == "function" ? c({ x: p, y: v }) : { x: p, y: v }; p = b.x, v = b.y; var y = o.hasOwnProperty("x"), A = o.hasOwnProperty("y"), h = mt, x = pt, w = window; if (s) { var g = Hi(t), D = "clientHeight", E = "clientWidth"; if (g === Zt(t) && (g = Xn(t), Dn(g).position !== "static" && l === "absolute" && (D = "scrollHeight", E = "scrollWidth")), g = g, a === pt || (a === mt || a === Ot) && i === Bi) { x = Tt; var N = f && g === w && w.visualViewport ? w.visualViewport.height : g[D]; v -= N - n.height, v *= u ? 1 : -1; } if (a === mt || (a === pt || a === Tt) && i === Bi) { h = Ot; var S = f && g === w && w.visualViewport ? w.visualViewport.width : g[E]; p -= S - n.width, p *= u ? 1 : -1; } } var M = Object.assign({ position: l }, s && tN), F = c === !0 ? nN({ x: p, y: v }) : { x: p, y: v }; if (p = F.x, v = F.y, u) { var $; return Object.assign({}, M, ($ = {}, $[x] = A ? "0" : "", $[h] = y ? "0" : "", $.transform = (w.devicePixelRatio || 1) <= 1 ? "translate(" + p + "px, " + v + "px)" : "translate3d(" + p + "px, " + v + "px, 0)", $)); } return Object.assign({}, M, (r = {}, r[x] = A ? v + "px" : "", r[h] = y ? p + "px" : "", r.transform = "", r)); } function aN(e) { var r = e.state, t = e.options, n = t.gpuAcceleration, a = n === void 0 ? !0 : n, i = t.adaptive, o = i === void 0 ? !0 : i, l = t.roundOffsets, u = l === void 0 ? !0 : l, s = { placement: Xt(r.placement), variation: Ya(r.placement), popper: r.elements.popper, popperRect: r.rects.popper, gpuAcceleration: a, isFixed: r.options.strategy === "fixed" }; r.modifiersData.popperOffsets != null && (r.styles.popper = Object.assign({}, r.styles.popper, af(Object.assign({}, s, { offsets: r.modifiersData.popperOffsets, position: r.options.strategy, adaptive: o, roundOffsets: u })))), r.modifiersData.arrow != null && (r.styles.arrow = Object.assign({}, r.styles.arrow, af(Object.assign({}, s, { offsets: r.modifiersData.arrow, position: "absolute", adaptive: !1, roundOffsets: u })))), r.attributes.popper = Object.assign({}, r.attributes.popper, { "data-popper-placement": r.placement }); } var e0 = { name: "computeStyles", enabled: !0, phase: "beforeWrite", fn: aN, data: {} }, no = { passive: !0 }; function iN(e) { var r = e.state, t = e.instance, n = e.options, a = n.scroll, i = a === void 0 ? !0 : a, o = n.resize, l = o === void 0 ? !0 : o, u = Zt(r.elements.popper), s = [].concat(r.scrollParents.reference, r.scrollParents.popper); return i && s.forEach(function(c) { c.addEventListener("scroll", t.update, no); }), l && u.addEventListener("resize", t.update, no), function() { i && s.forEach(function(c) { c.removeEventListener("scroll", t.update, no); }), l && u.removeEventListener("resize", t.update, no); }; } var r0 = { name: "eventListeners", enabled: !0, phase: "write", fn: function() { }, effect: iN, data: {} }, oN = { left: "right", right: "left", bottom: "top", top: "bottom" }; function Oo(e) { return e.replace(/left|right|bottom|top/g, function(r) { return oN[r]; }); } var sN = { start: "end", end: "start" }; function of(e) { return e.replace(/start|end/g, function(r) { return sN[r]; }); } function wl(e) { var r = Zt(e), t = r.pageXOffset, n = r.pageYOffset; return { scrollLeft: t, scrollTop: n }; } function xl(e) { return Ja(Xn(e)).left + wl(e).scrollLeft; } function uN(e) { var r = Zt(e), t = Xn(e), n = r.visualViewport, a = t.clientWidth, i = t.clientHeight, o = 0, l = 0; return n && (a = n.width, i = n.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (o = n.offsetLeft, l = n.offsetTop)), { width: a, height: i, x: o + xl(e), y: l }; } function lN(e) { var r, t = Xn(e), n = wl(e), a = (r = e.ownerDocument) == null ? void 0 : r.body, i = fa(t.scrollWidth, t.clientWidth, a ? a.scrollWidth : 0, a ? a.clientWidth : 0), o = fa(t.scrollHeight, t.clientHeight, a ? a.scrollHeight : 0, a ? a.clientHeight : 0), l = -n.scrollLeft + xl(e), u = -n.scrollTop; return Dn(a || t).direction === "rtl" && (l += fa(t.clientWidth, a ? a.clientWidth : 0) - i), { width: i, height: o, x: l, y: u }; } function Al(e) { var r = Dn(e), t = r.overflow, n = r.overflowX, a = r.overflowY; return /auto|scroll|overlay|hidden/.test(t + a + n); } function t0(e) { return ["html", "body", "#document"].indexOf(en(e)) >= 0 ? e.ownerDocument.body : _t(e) && Al(e) ? e : t0(xs(e)); } function Mi(e, r) { var t; r === void 0 && (r = []); var n = t0(e), a = n === ((t = e.ownerDocument) == null ? void 0 : t.body), i = Zt(n), o = a ? [i].concat(i.visualViewport || [], Al(n) ? n : []) : n, l = r.concat(o); return a ? l : l.concat(Mi(xs(o))); } function _u(e) { return Object.assign({}, e, { left: e.x, top: e.y, right: e.x + e.width, bottom: e.y + e.height }); } function cN(e) { var r = Ja(e); return r.top = r.top + e.clientTop, r.left = r.left + e.clientLeft, r.bottom = r.top + e.clientHeight, r.right = r.left + e.clientWidth, r.width = e.clientWidth, r.height = e.clientHeight, r.x = r.left, r.y = r.top, r; } function sf(e, r) { return r === Kh ? _u(uN(e)) : Wa(r) ? cN(r) : _u(lN(Xn(e))); } function fN(e) { var r = Mi(xs(e)), t = ["absolute", "fixed"].indexOf(Dn(e).position) >= 0, n = t && _t(e) ? Hi(e) : e; return Wa(n) ? r.filter(function(a) { return Wa(a) && Yh(a, n) && en(a) !== "body"; }) : []; } function dN(e, r, t) { var n = r === "clippingParents" ? fN(e) : [].concat(r), a = [].concat(n, [t]), i = a[0], o = a.reduce(function(l, u) { var s = sf(e, u); return l.top = fa(s.top, l.top), l.right = ko(s.right, l.right), l.bottom = ko(s.bottom, l.bottom), l.left = fa(s.left, l.left), l; }, sf(e, i)); return o.width = o.right - o.left, o.height = o.bottom - o.top, o.x = o.left, o.y = o.top, o; } function n0(e) { var r = e.reference, t = e.element, n = e.placement, a = n ? Xt(n) : null, i = n ? Ya(n) : null, o = r.x + r.width / 2 - t.width / 2, l = r.y + r.height / 2 - t.height / 2, u; switch (a) { case pt: u = { x: o, y: r.y - t.height }; break; case Tt: u = { x: o, y: r.y + r.height }; break; case Ot: u = { x: r.x + r.width, y: l }; break; case mt: u = { x: r.x - t.width, y: l }; break; default: u = { x: r.x, y: r.y }; } var s = a ? bl(a) : null; if (s != null) { var c = s === "y" ? "height" : "width"; switch (i) { case Ga: u[s] = u[s] - (r[c] / 2 - t[c] / 2); break; case Bi: u[s] = u[s] + (r[c] / 2 - t[c] / 2); break; } } return u; } function $i(e, r) { r === void 0 && (r = {}); var t = r, n = t.placement, a = n === void 0 ? e.placement : n, i = t.boundary, o = i === void 0 ? IA : i, l = t.rootBoundary, u = l === void 0 ? Kh : l, s = t.elementContext, c = s === void 0 ? xi : s, f = t.altBoundary, d = f === void 0 ? !1 : f, p = t.padding, m = p === void 0 ? 0 : p, v = Xh(typeof m != "number" ? m : Qh(m, Vi)), b = c === xi ? RA : xi, y = e.rects.popper, A = e.elements[d ? b : c], h = dN(Wa(A) ? A : A.contextElement || Xn(e.elements.popper), o, u), x = Ja(e.elements.reference), w = n0({ reference: x, element: y, placement: a }), g = _u(Object.assign({}, y, w)), D = c === xi ? g : x, E = { top: h.top - D.top + v.top, bottom: D.bottom - h.bottom + v.bottom, left: h.left - D.left + v.left, right: D.right - h.right + v.right }, N = e.modifiersData.offset; if (c === xi && N) { var S = N[a]; Object.keys(E).forEach(function(M) { var F = [Ot, Tt].indexOf(M) >= 0 ? 1 : -1, $ = [pt, Tt].indexOf(M) >= 0 ? "y" : "x"; E[M] += S[$] * F; }); } return E; } function pN(e, r) { r === void 0 && (r = {}); var t = r, n = t.placement, a = t.boundary, i = t.rootBoundary, o = t.padding, l = t.flipVariations, u = t.allowedAutoPlacements, s = u === void 0 ? oi : u, c = Ya(n), f = c ? l ? tf : tf.filter(function(m) { return Ya(m) === c; }) : Vi, d = f.filter(function(m) { return s.indexOf(m) >= 0; }); d.length === 0 && (d = f); var p = d.reduce(function(m, v) { return m[v] = $i(e, { placement: v, boundary: a, rootBoundary: i, padding: o })[Xt(v)], m; }, {}); return Object.keys(p).sort(function(m, v) { return p[m] - p[v]; }); } function mN(e) { if (Xt(e) === hl) return []; var r = Oo(e); return [of(e), r, of(r)]; } function vN(e) { var r = e.state, t = e.options, n = e.name; if (!r.modifiersData[n]._skip) { for (var a = t.mainAxis, i = a === void 0 ? !0 : a, o = t.altAxis, l = o === void 0 ? !0 : o, u = t.fallbackPlacements, s = t.padding, c = t.boundary, f = t.rootBoundary, d = t.altBoundary, p = t.flipVariations, m = p === void 0 ? !0 : p, v = t.allowedAutoPlacements, b = r.options.placement, y = Xt(b), A = y === b, h = u || (A || !m ? [Oo(b)] : mN(b)), x = [b].concat(h).reduce(function(Q, se) { return Q.concat(Xt(se) === hl ? pN(r, { placement: se, boundary: c, rootBoundary: f, padding: s, flipVariations: m, allowedAutoPlacements: v }) : se); }, []), w = r.rects.reference, g = r.rects.popper, D = /* @__PURE__ */ new Map(), E = !0, N = x[0], S = 0; S < x.length; S++) { var M = x[S], F = Xt(M), $ = Ya(M) === Ga, I = [pt, Tt].indexOf(F) >= 0, B = I ? "width" : "height", C = $i(r, { placement: M, boundary: c, rootBoundary: f, altBoundary: d, padding: s }), _ = I ? $ ? Ot : mt : $ ? Tt : pt; w[B] > g[B] && (_ = Oo(_)); var z = Oo(_), O = []; if (i && O.push(C[F] <= 0), l && O.push(C[_] <= 0, C[z] <= 0), O.every(function(Q) { return Q; })) { N = M, E = !1; break; } D.set(M, O); } if (E) for (var W = m ? 3 : 1, X = function(Q) { var se = x.find(function(re) { var q = D.get(re); if (q) return q.slice(0, Q).every(function(Z) { return Z; }); }); if (se) return N = se, "break"; }, V = W; V > 0; V--) { var R = X(V); if (R === "break") break; } r.placement !== N && (r.modifiersData[n]._skip = !0, r.placement = N, r.reset = !0); } } var hN = { name: "flip", enabled: !0, phase: "main", fn: vN, requiresIfExists: ["offset"], data: { _skip: !1 } }; function uf(e, r, t) { return t === void 0 && (t = { x: 0, y: 0 }), { top: e.top - r.height - t.y, right: e.right - r.width + t.x, bottom: e.bottom - r.height + t.y, left: e.left - r.width - t.x }; } function lf(e) { return [pt, Ot, Tt, mt].some(function(r) { return e[r] >= 0; }); } function gN(e) { var r = e.state, t = e.name, n = r.rects.reference, a = r.rects.popper, i = r.modifiersData.preventOverflow, o = $i(r, { elementContext: "reference" }), l = $i(r, { altBoundary: !0 }), u = uf(o, n), s = uf(l, a, i), c = lf(u), f = lf(s); r.modifiersData[t] = { referenceClippingOffsets: u, popperEscapeOffsets: s, isReferenceHidden: c, hasPopperEscaped: f }, r.attributes.popper = Object.assign({}, r.attributes.popper, { "data-popper-reference-hidden": c, "data-popper-escaped": f }); } var yN = { name: "hide", enabled: !0, phase: "main", requiresIfExists: ["preventOverflow"], fn: gN }; function bN(e, r, t) { var n = Xt(e), a = [mt, pt].indexOf(n) >= 0 ? -1 : 1, i = typeof t == "function" ? t(Object.assign({}, r, { placement: e })) : t, o = i[0], l = i[1]; return o = o || 0, l = (l || 0) * a, [mt, Ot].indexOf(n) >= 0 ? { x: l, y: o } : { x: o, y: l }; } function wN(e) { var r = e.state, t = e.options, n = e.name, a = t.offset, i = a === void 0 ? [0, 0] : a, o = oi.reduce(function(c, f) { return c[f] = bN(f, r.rects, i), c; }, {}), l = o[r.placement], u = l.x, s = l.y; r.modifiersData.popperOffsets != null && (r.modifiersData.popperOffsets.x += u, r.modifiersData.popperOffsets.y += s), r.modifiersData[n] = o; } var xN = { name: "offset", enabled: !0, phase: "main", requires: ["popperOffsets"], fn: wN }; function AN(e) { var r = e.state, t = e.name; r.modifiersData[t] = n0({ reference: r.rects.reference, element: r.rects.popper, placement: r.placement }); } var a0 = { name: "popperOffsets", enabled: !0, phase: "read", fn: AN, data: {} }; function NN(e) { return e === "x" ? "y" : "x"; } function DN(e) { var r = e.state, t = e.options, n = e.name, a = t.mainAxis, i = a === void 0 ? !0 : a, o = t.altAxis, l = o === void 0 ? !1 : o, u = t.boundary, s = t.rootBoundary, c = t.altBoundary, f = t.padding, d = t.tether, p = d === void 0 ? !0 : d, m = t.tetherOffset, v = m === void 0 ? 0 : m, b = $i(r, { boundary: u, rootBoundary: s, padding: f, altBoundary: c }), y = Xt(r.placement), A = Ya(r.placement), h = !A, x = bl(y), w = NN(x), g = r.modifiersData.popperOffsets, D = r.rects.reference, E = r.rects.popper, N = typeof v == "function" ? v(Object.assign({}, r.rects, { placement: r.placement })) : v, S = typeof N == "number" ? { mainAxis: N, altAxis: N } : Object.assign({ mainAxis: 0, altAxis: 0 }, N), M = r.modifiersData.offset ? r.modifiersData.offset[r.placement] : null, F = { x: 0, y: 0 }; if (g) { if (i) { var $, I = x === "y" ? pt : mt, B = x === "y" ? Tt : Ot, C = x === "y" ? "height" : "width", _ = g[x], z = _ + b[I], O = _ - b[B], W = p ? -E[C] / 2 : 0, X = A === Ga ? D[C] : E[C], V = A === Ga ? -E[C] : -D[C], R = r.elements.arrow, Q = p && R ? yl(R) : { width: 0, height: 0 }, se = r.modifiersData["arrow#persistent"] ? r.modifiersData["arrow#persistent"].padding : jh(), re = se[I], q = se[B], Z = Ci(0, D[C], Q[C]), K = h ? D[C] / 2 - W - Z - re - S.mainAxis : X - Z - re - S.mainAxis, j = h ? -D[C] / 2 + W + Z + q + S.mainAxis : V + Z + q + S.mainAxis, ee = r.elements.arrow && Hi(r.elements.arrow), te = ee ? x === "y" ? ee.clientTop || 0 : ee.clientLeft || 0 : 0, oe = ($ = M == null ? void 0 : M[x]) != null ? $ : 0, ge = _ + K - oe - te, L = _ + j - oe, H = Ci(p ? ko(z, ge) : z, _, p ? fa(O, L) : O); g[x] = H, F[x] = H - _; } if (l) { var ne, ie = x === "x" ? pt : mt, me = x === "x" ? Tt : Ot, pe = g[w], xe = w === "y" ? "height" : "width", De = pe + b[ie], k = pe - b[me], J = [pt, mt].indexOf(y) !== -1, G = (ne = M == null ? void 0 : M[w]) != null ? ne : 0, ae = J ? De : pe - D[xe] - E[xe] - G + S.altAxis, fe = J ? pe + D[xe] + E[xe] - G - S.altAxis : k, de = p && J ? jA(ae, pe, fe) : Ci(p ? ae : De, pe, p ? fe : k); g[w] = de, F[w] = de - pe; } r.modifiersData[n] = F; } } var EN = { name: "preventOverflow", enabled: !0, phase: "main", fn: DN, requiresIfExists: ["offset"] }; function SN(e) { return { scrollLeft: e.scrollLeft, scrollTop: e.scrollTop }; } function CN(e) { return e === Zt(e) || !_t(e) ? wl(e) : SN(e); } function MN(e) { var r = e.getBoundingClientRect(), t = Ka(r.width) / e.offsetWidth || 1, n = Ka(r.height) / e.offsetHeight || 1; return t !== 1 || n !== 1; } function _N(e, r, t) { t === void 0 && (t = !1); var n = _t(r), a = _t(r) && MN(r), i = Xn(r), o = Ja(e, a), l = { scrollLeft: 0, scrollTop: 0 }, u = { x: 0, y: 0 }; return (n || !n && !t) && ((en(r) !== "body" || Al(i)) && (l = CN(r)), _t(r) ? (u = Ja(r, !0), u.x += r.clientLeft, u.y += r.clientTop) : i && (u.x = xl(i))), { x: o.left + l.scrollLeft - u.x, y: o.top + l.scrollTop - u.y, width: o.width, height: o.height }; } function FN(e) { var r = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), n = []; e.forEach(function(i) { r.set(i.name, i); }); function a(i) { t.add(i.name); var o = [].concat(i.requires || [], i.requiresIfExists || []); o.forEach(function(l) { if (!t.has(l)) { var u = r.get(l); u && a(u); } }), n.push(i); } return e.forEach(function(i) { t.has(i.name) || a(i); }), n; } function TN(e) { var r = FN(e); return GA.reduce(function(t, n) { return t.concat(r.filter(function(a) { return a.phase === n; })); }, []); } function ON(e) { var r; return function() { return r || (r = new Promise(function(t) { Promise.resolve().then(function() { r = void 0, t(e()); }); })), r; }; } function BN(e) { var r = e.reduce(function(t, n) { var a = t[n.name]; return t[n.name] = a ? Object.assign({}, a, n, { options: Object.assign({}, a.options, n.options), data: Object.assign({}, a.data, n.data) }) : n, t; }, {}); return Object.keys(r).map(function(t) { return r[t]; }); } var cf = { placement: "bottom", modifiers: [], strategy: "absolute" }; function ff() { for (var e = arguments.length, r = new Array(e), t = 0; t < e; t++) r[t] = arguments[t]; return !r.some(function(n) { return !(n && typeof n.getBoundingClientRect == "function"); }); } function Nl(e) { e === void 0 && (e = {}); var r = e, t = r.defaultModifiers, n = t === void 0 ? [] : t, a = r.defaultOptions, i = a === void 0 ? cf : a; return function(o, l, u) { u === void 0 && (u = i); var s = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, cf, i), modifiersData: {}, elements: { reference: o, popper: l }, attributes: {}, styles: {} }, c = [], f = !1, d = { state: s, setOptions: function(v) { var b = typeof v == "function" ? v(s.options) : v; m(), s.options = Object.assign({}, i, s.options, b), s.scrollParents = { reference: Wa(o) ? Mi(o) : o.contextElement ? Mi(o.contextElement) : [], popper: Mi(l) }; var y = TN(BN([].concat(n, s.options.modifiers))); return s.orderedModifiers = y.filter(function(A) { return A.enabled; }), p(), d.update(); }, forceUpdate: function() { if (!f) { var v = s.elements, b = v.reference, y = v.popper; if (ff(b, y)) { s.rects = { reference: _N(b, Hi(y), s.options.strategy === "fixed"), popper: yl(y) }, s.reset = !1, s.placement = s.options.placement, s.orderedModifiers.forEach(function(E) { return s.modifiersData[E.name] = Object.assign({}, E.data); }); for (var A = 0; A < s.orderedModifiers.length; A++) { if (s.reset === !0) { s.reset = !1, A = -1; continue; } var h = s.orderedModifiers[A], x = h.fn, w = h.options, g = w === void 0 ? {} : w, D = h.name; typeof x == "function" && (s = x({ state: s, options: g, name: D, instance: d }) || s); } } } }, update: ON(function() { return new Promise(function(v) { d.forceUpdate(), v(s); }); }), destroy: function() { m(), f = !0; } }; if (!ff(o, l)) return d; d.setOptions(u).then(function(v) { !f && u.onFirstUpdate && u.onFirstUpdate(v); }); function p() { s.orderedModifiers.forEach(function(v) { var b = v.name, y = v.options, A = y === void 0 ? {} : y, h = v.effect; if (typeof h == "function") { var x = h({ state: s, name: b, instance: d, options: A }), w = function() { }; c.push(x || w); } }); } function m() { c.forEach(function(v) { return v(); }), c = []; } return d; }; } Nl(); var $N = [r0, a0, e0, Jh]; Nl({ defaultModifiers: $N }); var IN = [r0, a0, e0, Jh, xN, hN, EN, rN, yN], RN = Nl({ defaultModifiers: IN }); const PN = (e, r, t = {}) => { const n = { name: "updateState", enabled: !0, phase: "write", fn: ({ state: u }) => { const s = zN(u); Object.assign(o.value, s); }, requires: ["computeStyles"] }, a = ue(() => { const { onFirstUpdate: u, placement: s, strategy: c, modifiers: f } = U(t); return { onFirstUpdate: u, placement: s || "bottom", strategy: c || "absolute", modifiers: [ ...f || [], n, { name: "applyStyles", enabled: !1 } ] }; }), i = qa(), o = Se({ styles: { popper: { position: U(a).strategy, left: "0", top: "0" }, arrow: { position: "absolute" } }, attributes: {} }), l = () => { i.value && (i.value.destroy(), i.value = void 0); }; return er(a, (u) => { const s = U(i); s && s.setOptions(u); }, { deep: !0 }), er([e, r], ([u, s]) => { l(), !(!u || !s) && (i.value = RN(u, s, U(a))); }), nn(() => { l(); }), { state: ue(() => { var u; return { ...((u = U(i)) == null ? void 0 : u.state) || {} }; }), styles: ue(() => U(o).styles), attributes: ue(() => U(o).attributes), update: () => { var u; return (u = U(i)) == null ? void 0 : u.update(); }, forceUpdate: () => { var u; return (u = U(i)) == null ? void 0 : u.forceUpdate(); }, instanceRef: ue(() => U(i)) }; }; function zN(e) { const r = Object.keys(e.elements), t = Lo(r.map((a) => [a, e.styles[a] || {}])), n = Lo(r.map((a) => [a, e.attributes[a]])); return { styles: t, attributes: n }; } function df() { let e; const r = (n, a) => { t(), e = window.setTimeout(n, a); }, t = () => window.clearTimeout(e); return ds(() => t()), { registerTimeout: r, cancelTimeout: t }; } const Fu = { prefix: Math.floor(Math.random() * 1e4), current: 0 }, qN = Symbol("elIdInjection"), i0 = () => ot() ? vr(qN, Fu) : Fu, As = (e) => { const r = i0(); !Ir && r === Fu && Tr("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed usage: app.provide(ID_INJECTION_KEY, { prefix: number, current: number, })`); const t = vl(); return ue(() => U(e) || `${t.value}-id-${r.prefix}-${r.current++}`); }; let Ia = []; const pf = (e) => { const r = e; r.key === Za.esc && Ia.forEach((t) => t(r)); }, LN = (e) => { Wr(() => { Ia.length === 0 && document.addEventListener("keydown", pf), Ir && Ia.push(e); }), nn(() => { Ia = Ia.filter((r) => r !== e), Ia.length === 0 && Ir && document.removeEventListener("keydown", pf); }); }; let mf; const o0 = () => { const e = vl(), r = i0(), t = ue(() => `${e.value}-popper-container-${r.prefix}`), n = ue(() => `#${t.value}`); return { id: t, selector: n }; }, UN = (e) => { const r = document.createElement("div"); return r.id = e, document.body.appendChild(r), r; }, kN = () => { const { id: e, selector: r } = o0(); return E1(() => { Ir && (process.env.NODE_ENV === "test" || !mf || !document.body.querySelector(r.value)) && (mf = UN(e.value)); }), { id: e, selector: r }; }, VN = Er({ showAfter: { type: Number, default: 0 }, hideAfter: { type: Number, default: 200 }, autoClose: { type: Number, default: 0 } }), HN = ({ showAfter: e, hideAfter: r, autoClose: t, open: n, close: a }) => { const { registerTimeout: i } = df(), { registerTimeout: o, cancelTimeout: l } = df(); return { onOpen: (c) => { i(() => { n(c); const f = U(t); Nr(f) && f > 0 && o(() => { a(c); }, f); }, U(e)); }, onClose: (c) => { l(), i(() => { a(c); }, U(r)); } }; }, s0 = Symbol("elForwardRef"), ZN = (e) => { Ft(s0, { setForwardRef: (t) => { e.value = t; } }); }, GN = (e) => ({ mounted(r) { e(r); }, updated(r) { e(r); }, unmounted() { e(null); } }), vf = { current: 0 }, hf = Se(0), u0 = 2e3, gf = Symbol("elZIndexContextKey"), l0 = Symbol("zIndexContextKey"), c0 = (e) => { const r = ot() ? vr(gf, vf) : vf, t = e || (ot() ? vr(l0, void 0) : void 0), n = ue(() => { const o = U(t); return Nr(o) ? o : u0; }), a = ue(() => n.value + hf.value), i = () => (r.current++, hf.value = r.current, a.value); return !Ir && !vr(gf) && Tr("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`), { initialZIndex: n, currentZIndex: a, nextZIndex: i }; }; function WN(e) { let r; function t() { if (e.value == null) return; const { selectionStart: a, selectionEnd: i, value: o } = e.value; if (a == null || i == null) return; const l = o.slice(0, Math.max(0, a)), u = o.slice(Math.max(0, i)); r = { selectionStart: a, selectionEnd: i, value: o, beforeTxt: l, afterTxt: u }; } function n() { if (e.value == null || r == null) return; const { value: a } = e.value, { beforeTxt: i, afterTxt: o, selectionStart: l } = r; if (i == null || o == null || l == null) return; let u = a.length; if (a.endsWith(o)) u = a.length - o.length; else if (a.startsWith(i)) u = i.length; else { const s = i[l - 1], c = a.indexOf(s, l - 1); c !== -1 && (u = c + 1); } e.value.setSelectionRange(u, u); } return [t, n]; } const ja = bs({ type: String, values: Hh, required: !1 }), f0 = Symbol("size"), KN = () => { const e = vr(f0, {}); return ue(() => U(e.size) || ""); }; function d0(e, { beforeFocus: r, afterFocus: t, beforeBlur: n, afterBlur: a } = {}) { const i = ot(), { emit: o } = i, l = qa(), u = Se(!1), s = (d) => { Xr(r) && r(d) || u.value || (u.value = !0, o("focus", d), t == null || t()); }, c = (d) => { var p; Xr(n) && n(d) || d.relatedTarget && ((p = l.value) != null && p.contains(d.relatedTarget)) || (u.value = !1, o("blur", d), a == null || a()); }, f = () => { var d, p; (d = l.value) != null && d.contains(document.activeElement) && l.value !== document.activeElement || (p = e.value) == null || p.focus(); }; return er(l, (d) => { d && d.setAttribute("tabindex", "-1"); }), tt(l, "focus", s, !0), tt(l, "blur", c, !0), tt(l, "click", f, !0), process.env.NODE_ENV === "test" && Wr(() => { const d = la(e.value) ? e.value : document.querySelector("input,textarea"); d && (tt(d, "focus", s, !0), tt(d, "blur", c, !0)); }), { isFocused: u, wrapperRef: l, handleFocus: s, handleBlur: c }; } function p0({ afterComposition: e, emit: r }) { const t = Se(!1), n = (l) => { r == null || r("compositionstart", l), t.value = !0; }, a = (l) => { var u; r == null || r("compositionupdate", l); const s = (u = l.target) == null ? void 0 : u.value, c = s[s.length - 1] || ""; t.value = !xA(c); }, i = (l) => { r == null || r("compositionend", l), t.value && (t.value = !1, Cr(() => e(l))); }; return { isComposing: t, handleComposition: (l) => { l.type === "compositionend" ? i(l) : a(l); }, handleCompositionStart: n, handleCompositionUpdate: a, handleCompositionEnd: i }; } const m0 = Symbol("emptyValuesContextKey"), JN = "use-empty-values", YN = ["", void 0, null], jN = void 0, XN = Er({ emptyValues: Array, valueOnClear: { type: [String, Number, Boolean, Function], default: void 0, validator: (e) => Xr(e) ? !e() : !e } }), QN = (e, r) => { const t = ot() ? vr(m0, Se({})) : Se({}), n = ue(() => e.emptyValues || t.value.emptyValues || YN), a = ue(() => Xr(e.valueOnClear) ? e.valueOnClear() : e.valueOnClear !== void 0 ? e.valueOnClear : Xr(t.value.valueOnClear) ? t.value.valueOnClear() : t.value.valueOnClear !== void 0 ? t.value.valueOnClear : jN), i = (o) => n.value.includes(o); return n.value.includes(a.value) || Tr(JN, "value-on-clear should be a value of empty-values"), { emptyValues: n, valueOnClear: a, isEmptyValue: i }; }, eD = Er({ ariaLabel: String, ariaOrientation: { type: String, values: ["horizontal", "vertical", "undefined"] }, ariaControls: String }), wa = (e) => Q2(eD, e), v0 = Symbol(), Vo = Se(); function Dl(e, r = void 0) { const t = ot() ? vr(v0, Vo) : Vo; return e ? ue(() => { var n, a; return (a = (n = t.value) == null ? void 0 : n[e]) != null ? a : r; }) : t; } function rD(e, r) { const t = Dl(), n = Dr(e, ue(() => { var l; return ((l = t.value) == null ? void 0 : l.namespace) || To; })), a = ws(ue(() => { var l; return (l = t.value) == null ? void 0 : l.locale; })), i = c0(ue(() => { var l; return ((l = t.value) == null ? void 0 : l.zIndex) || u0; })), o = ue(() => { var l; return U(r) || ((l = t.value) == null ? void 0 : l.size) || ""; }); return tD(ue(() => U(t) || {})), { ns: n, locale: a, zIndex: i, size: o }; } const tD = (e, r, t = !1) => { var n; const a = !!ot(), i = a ? Dl() : void 0, o = (n = void 0) != null ? n : a ? Ft : void 0; if (!o) { Tr("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup()."); return; } const l = ue(() => { const u = U(e); return i != null && i.value ? nD(i.value, u) : u; }); return o(v0, l), o(Zh, ue(() => l.value.locale)), o(Gh, ue(() => l.value.namespace)), o(l0, ue(() => l.value.zIndex)), o(f0, { size: ue(() => l.value.size || "") }), o(m0, ue(() => ({ emptyValues: l.value.emptyValues, valueOnClear: l.value.valueOnClear }))), (t || !Vo.value) && (Vo.value = l.value), l; }, nD = (e, r) => { const t = [.../* @__PURE__ */ new Set([...Qc(e), ...Qc(r)])], n = {}; for (const a of t) n[a] = r[a] !== void 0 ? r[a] : e[a]; return n; }; var Sr = (e, r) => { const t = e.__vccOpts || e; for (const [n, a] of r) t[n] = a; return t; }; const aD = Er({ size: { type: rr([Number, String]) }, color: { type: String } }), iD = Re({ name: "ElIcon", inheritAttrs: !1 }), oD = /* @__PURE__ */ Re({ ...iD, props: aD, setup(e) { const r = e, t = Dr("icon"), n = ue(() => { const { size: a, color: i } = r; return !a && !i ? {} : { fontSize: yn(a) ? void 0 : Mu(a), "--color": i }; }); return (a, i) => (he(), Ce("i", Zn({ class: U(t).b(), style: U(n) }, a.$attrs), [ Xe(a.$slots, "default") ], 16)); } }); var sD = /* @__PURE__ */ Sr(oD, [["__file", "icon.vue"]]); const Ct = Bt(sD), El = Symbol("formContextKey"), Ho = Symbol("formItemContextKey"), si = (e, r = {}) => { const t = Se(void 0), n = r.prop ? t : Wh("size"), a = r.global ? t : KN(), i = r.form ? { size: void 0 } : vr(El, void 0), o = r.formItem ? { size: void 0 } : vr(Ho, void 0); return ue(() => n.value || U(e) || (o == null ? void 0 : o.size) || (i == null ? void 0 : i.size) || a.value || ""); }, Ns = (e) => { const r = Wh("disabled"), t = vr(El, void 0); return ue(() => r.value || U(e) || (t == null ? void 0 : t.disabled) || !1); }, Zi = () => { const e = vr(El, void 0), r = vr(Ho, void 0); return { form: e, formItem: r }; }, Sl = (e, { formItemContext: r, disableIdGeneration: t, disableIdManagement: n }) => { t || (t = Se(!1)), n || (n = Se(!1)); const a = Se(); let i; const o = ue(() => { var l; return !!(!(e.label || e.ariaLabel) && r && r.inputIds && ((l = r.inputIds) == null ? void 0 : l.length) <= 1); }); return Wr(() => { i = er([qt(e, "id"), t], ([l, u]) => { const s = l ?? (u ? void 0 : As().value); s !== a.value && (r != null && r.removeInputId && (a.value && r.removeInputId(a.value), !(n != null && n.value) && !u && s && r.addInputId(s)), a.value = s); }, { immediate: !0 }); }), S1(() => { i && i(), r != null && r.removeInputId && a.value && r.removeInputId(a.value); }), { isLabeledByFormItem: o, inputId: a }; }; let It; const uD = ` height:0 !important; visibility:hidden !important; ${nb() ? "" : "overflow:hidden !important;"} position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important; `, lD = [ "letter-spacing", "line-height", "padding-top", "padding-bottom", "font-family", "font-weight", "font-size", "text-rendering", "text-transform", "width", "text-indent", "padding-left", "padding-right", "border-width", "box-sizing" ]; function cD(e) { const r = window.getComputedStyle(e), t = r.getPropertyValue("box-sizing"), n = Number.parseFloat(r.getPropertyValue("padding-bottom")) + Number.parseFloat(r.getPropertyValue("padding-top")), a = Number.parseFloat(r.getPropertyValue("border-bottom-width")) + Number.parseFloat(r.getPropertyValue("border-top-width")); return { contextStyle: lD.map((o) => `${o}:${r.getPropertyValue(o)}`).join(";"), paddingSize: n, borderSize: a, boxSizing: t }; } function yf(e, r = 1, t) { var n; It || (It = document.createElement("textarea"), document.body.appendChild(It)); const { paddingSize: a, borderSize: i, boxSizing: o, contextStyle: l } = cD(e); It.setAttribute("style", `${l};${uD}`), It.value = e.value || e.placeholder || ""; let u = It.scrollHeight; const s = {}; o === "border-box" ? u = u + i : o === "content-box" && (u = u - a), It.value = ""; const c = It.scrollHeight - a; if (Nr(r)) { let f = c * r; o === "border-box" && (f = f + a + i), u = Math.max(f, u), s.minHeight = `${f}px`; } if (Nr(t)) { let f = c * t; o === "border-box" && (f = f + a + i), u = Math.min(f, u); } return s.height = `${u}px`, (n = It.parentNode) == null || n.removeChild(It), It = void 0, s; } const fD = Er({ id: { type: String, default: void 0 }, size: ja, disabled: Boolean, modelValue: { type: rr([ String, Number, Object ]), default: "" }, maxlength: { type: [String, Number] }, minlength: { type: [String, Number] }, type: { type: String, default: "text" }, resize: { type: String, values: ["none", "both", "horizontal", "vertical"] }, autosize: { type: rr([Boolean, Object]), default: !1 }, autocomplete: { type: String, default: "off" }, formatter: { type: Function }, parser: { type: Function }, placeholder: { type: String }, form: { type: String }, readonly: Boolean, clearable: Boolean, showPassword: Boolean, showWordLimit: Boolean, suffixIcon: { type: Ha }, prefixIcon: { type: Ha }, containerRole: { type: String, default: void 0 }, tabindex: { type: [String, Number], default: 0 }, validateEvent: { type: Boolean, default: !0 }, inputStyle: { type: rr([Object, Array, String]), default: () => AA({}) }, autofocus: Boolean, rows: { type: Number, default: 2 }, ...wa(["ariaLabel"]) }), dD = { [Or]: (e) => wt(e), input: (e) => wt(e), change: (e) => wt(e), focus: (e) => e instanceof FocusEvent, blur: (e) => e instanceof FocusEvent, clear: () => !0, mouseleave: (e) => e instanceof MouseEvent, mouseenter: (e) => e instanceof MouseEvent, keydown: (e) => e instanceof Event, compositionstart: (e) => e instanceof CompositionEvent, compositionupdate: (e) => e instanceof CompositionEvent, compositionend: (e) => e instanceof CompositionEvent }, pD = Re({ name: "ElInput", inheritAttrs: !1 }), mD = /* @__PURE__ */ Re({ ...pD, props: fD, emits: dD, setup(e, { expose: r, emit: t }) { const n = e, a = C1(), i = mh(), o = ue(() => { const G = {}; return n.containerRole === "combobox" && (G["aria-haspopup"] = a["aria-haspopup"], G["aria-owns"] = a["aria-owns"], G["aria-expanded"] = a["aria-expanded"]), G; }), l = ue(() => [ n.type === "textarea" ? b.b() : v.b(), v.m(p.value), v.is("disabled", m.value), v.is("exceed", R.value), { [v.b("group")]: i.prepend || i.append, [v.m("prefix")]: i.prefix || n.prefixIcon, [v.m("suffix")]: i.suffix || n.suffixIcon || n.clearable || n.showPassword, [v.bm("suffix", "password-clear")]: O.value && W.value, [v.b("hidden")]: n.type === "hidden" }, a.class ]), u = ue(() => [ v.e("wrapper"), v.is("focus", N.value) ]), s = EA({ excludeKeys: ue(() => Object.keys(o.value)) }), { form: c, formItem: f } = Zi(), { inputId: d } = Sl(n, { formItemContext: f }), p = si(), m = Ns(), v = Dr("input"), b = Dr("textarea"), y = qa(), A = qa(), h = Se(!1), x = Se(!1), w = Se(), g = qa(n.inputStyle), D = ue(() => y.value || A.value), { wrapperRef: E, isFocused: N, handleFocus: S, handleBlur: M } = d0(D, { beforeFocus() { return m.value; }, afterBlur() { var G; n.validateEvent && ((G = f == null ? void 0 : f.validate) == null || G.call(f, "blur").catch((ae) => Tr(ae))); } }), F = ue(() => { var G; return (G = c == null ? void 0 : c.statusIcon) != null ? G : !1; }), $ = ue(() => (f == null ? void 0 : f.validateState) || ""), I = ue(() => $.value && Vh[$.value]), B = ue(() => x.value ? bA : dA), C = ue(() => [ a.style ]), _ = ue(() => [ n.inputStyle, g.value, { resize: n.resize } ]), z = ue(() => An(n.modelValue) ? "" : String(n.modelValue)), O = ue(() => n.clearable && !m.value && !n.readonly && !!z.value && (N.value || h.value)), W = ue(() => n.showPassword && !m.value && !n.readonly && !!z.value && (!!z.value || N.value)), X = ue(() => n.showWordLimit && !!n.maxlength && (n.type === "text" || n.type === "textarea") && !m.value && !n.readonly && !n.showPassword), V = ue(() => z.value.length), R = ue(() => !!X.value && V.value > Number(n.maxlength)), Q = ue(() => !!i.suffix || !!n.suffixIcon || O.value || n.showPassword || X.value || !!$.value && F.value), [se, re] = WN(y); mn(A, (G) => { if (K(), !X.value || n.resize !== "both") return; const ae = G[0], { width: fe } = ae.contentRect; w.value = { right: `calc(100% - ${fe + 15 + 6}px)` }; }); const q = () => { const { type: G, autosize: ae } = n; if (!(!Ir || G !== "textarea" || !A.value)) if (ae) { const fe = dt(ae) ? ae.minRows : void 0, de = dt(ae) ? ae.maxRows : void 0, Ne = yf(A.value, fe, de); g.value = { overflowY: "hidden", ...Ne }, Cr(() => { A.value.offsetHeight, g.value = Ne; }); } else g.value = { minHeight: yf(A.value).minHeight }; }, K = ((G) => { let ae = !1; return () => { var fe; if (ae || !n.autosize) return; ((fe = A.value) == null ? void 0 : fe.offsetParent) === null || (G(), ae = !0); }; })(q), j = () => { const G = D.value, ae = n.formatter ? n.formatter(z.value) : z.value; !G || G.value === ae || (G.value = ae); }, ee = async (G) => { se(); let { value: ae } = G.target; if (n.formatter && (ae = n.parser ? n.parser(ae) : ae), !oe.value) { if (ae === z.value) { j(); return; } t(Or, ae), t("input", ae), await Cr(), j(), re(); } }, te = (G) => { t("change", G.target.value); }, { isComposing: oe, handleCompositionStart: ge, handleCompositionUpdate: L, handleCompositionEnd: H } = p0({ emit: t, afterComposition: ee }), ne = () => { x.value = !x.value, ie(); }, ie = async () => { var G; await Cr(), (G = D.value) == null || G.focus(); }, me = () => { var G; return (G = D.value) == null ? void 0 : G.blur(); }, pe = (G) => { h.value = !1, t("mouseleave", G); }, xe = (G) => { h.value = !0, t("mouseenter", G); }, De = (G) => { t("keydown", G); }, k = () => { var G; (G = D.value) == null || G.select(); }, J = () => { t(Or, ""), t("change", ""), t("clear"), t("input", ""); }; return er(() => n.modelValue, () => { var G; Cr(() => q()), n.validateEvent && ((G = f == null ? void 0 : f.validate) == null || G.call(f, "change").catch((ae) => Tr(ae))); }), er(z, () => j()), er(() => n.type, async () => { await Cr(), j(), q(); }), Wr(() => { !n.formatter && n.parser && Tr("ElInput", "If you set the parser, you also need to set the formatter."), j(), Cr(q); }), r({ input: y, textarea: A, ref: D, textareaStyle: _, autosize: qt(n, "autosize"), isComposing: oe, focus: ie, blur: me, select: k, clear: J, resizeTextarea: q }), (G, ae) => (he(), Ce("div", Zn(U(o), { class: [ U(l), { [U(v).bm("group", "append")]: G.$slots.append, [U(v).bm("group", "prepend")]: G.$slots.prepend } ], style: U(C), role: G.containerRole, onMouseenter: xe, onMouseleave: pe }), [ Be(" input "), G.type !== "textarea" ? (he(), Ce(nt, { key: 0 }, [ Be(" prepend slot "), G.$slots.prepend ? (he(), Ce("div", { key: 0, class: _e(U(v).be("group", "prepend")) }, [ Xe(G.$slots, "prepend") ], 2)) : Be("v-if", !0), $e("div", { ref_key: "wrapperRef", ref: E, class: _e(U(u)) }, [ Be(" prefix slot "), G.$slots.prefix || G.prefixIcon ? (he(), Ce("span", { key: 0, class: _e(U(v).e("prefix")) }, [ $e("span", { class: _e(U(v).e("prefix-inner")) }, [ Xe(G.$slots, "prefix"), G.prefixIcon ? (he(), He(U(Ct), { key: 0, class: _e(U(v).e("icon")) }, { default: Ve(() => [ (he(), He(Lt(G.prefixIcon))) ]), _: 1 }, 8, ["class"])) : Be("v-if", !0) ], 2) ], 2)) : Be("v-if", !0), $e("input", Zn({ id: U(d), ref_key: "input", ref: y, class: U(v).e("inner") }, U(s), { minlength: G.minlength, maxlength: G.maxlength, type: G.showPassword ? x.value ? "text" : "password" : G.type, disabled: U(m), readonly: G.readonly, autocomplete: G.autocomplete, tabindex: G.tabindex, "aria-label": G.ariaLabel, placeholder: G.placeholder, style: G.inputStyle, form: G.form, autofocus: G.autofocus, onCompositionstart: U(ge), onCompositionupdate: U(L), onCompositionend: U(H), onInput: ee, onChange: te, onKeydown: De }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "onCompositionstart", "onCompositionupdate", "onCompositionend"]), Be(" suffix slot "), U(Q) ? (he(), Ce("span", { key: 1, class: _e(U(v).e("suffix")) }, [ $e("span", { class: _e(U(v).e("suffix-inner")) }, [ !U(O) || !U(W) || !U(X) ? (he(), Ce(nt, { key: 0 }, [ Xe(G.$slots, "suffix"), G.suffixIcon ? (he(), He(U(Ct), { key: 0, class: _e(U(v).e("icon")) }, { default: Ve(() => [ (he(), He(Lt(G.suffixIcon))) ]), _: 1 }, 8, ["class"])) : Be("v-if", !0) ], 64)) : Be("v-if", !0), U(O) ? (he(), He(U(Ct), { key: 1, class: _e([U(v).e("icon"), U(v).e("clear")]), onMousedown: kr(U(Fi), ["prevent"]), onClick: J }, { default: Ve(() => [ mr(U(pl)) ]), _: 1 }, 8, ["class", "onMousedown"])) : Be("v-if", !0), U(W) ? (he(), He(U(Ct), { key: 2, class: _e([U(v).e("icon"), U(v).e("password")]), onClick: ne }, { default: Ve(() => [ (he(), He(Lt(U(B)))) ]), _: 1 }, 8, ["class"])) : Be("v-if", !0), U(X) ? (he(), Ce("span", { key: 3, class: _e(U(v).e("count")) }, [ $e("span", { class: _e(U(v).e("count-inner")) }, qr(U(V)) + " / " + qr(G.maxlength), 3) ], 2)) : Be("v-if", !0), U($) && U(I) && U(F) ? (he(), He(U(Ct), { key: 4, class: _e([ U(v).e("icon"), U(v).e("validateIcon"), U(v).is("loading", U($) === "validating") ]) }, { default: Ve(() => [ (he(), He(Lt(U(I)))) ]), _: 1 }, 8, ["class"])) : Be("v-if", !0) ], 2) ], 2)) : Be("v-if", !0) ], 2), Be(" append slot "), G.$slots.append ? (he(), Ce("div", { key: 1, class: _e(U(v).be("group", "append")) }, [ Xe(G.$slots, "append") ], 2)) : Be("v-if", !0) ], 64)) : (he(), Ce(nt, { key: 1 }, [ Be(" textarea "), $e("textarea", Zn({ id: U(d), ref_key: "textarea", ref: A, class: [U(b).e("inner"), U(v).is("focus", U(N))] }, U(s), { minlength: G.minlength, maxlength: G.maxlength, tabindex: G.tabindex, disabled: U(m), readonly: G.readonly, autocomplete: G.autocomplete, style: U(_), "aria-label": G.ariaLabel, placeholder: G.placeholder, form: G.form, autofocus: G.autofocus, rows: G.rows, onCompositionstart: U(ge), onCompositionupdate: U(L), onCompositionend: U(H), onInput: ee, onFocus: U(S), onBlur: U(M), onChange: te, onKeydown: De }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]), U(X) ? (he(), Ce("span", { key: 0, style: Lr(w.value), class: _e(U(v).e("count")) }, qr(U(V)) + " / " + qr(G.maxlength), 7)) : Be("v-if", !0) ], 64)) ], 16, ["role"])); } }); var vD = /* @__PURE__ */ Sr(mD, [["__file", "input.vue"]]); const hD = Bt(vD), Ca = 4, gD = { vertical: { offset: "offsetHeight", scroll: "scrollTop", scrollSize: "scrollHeight", size: "height", key: "vertical", axis: "Y", client: "clientY", direction: "top" }, horizontal: { offset: "offsetWidth", scroll: "scrollLeft", scrollSize: "scrollWidth", size: "width", key: "horizontal", axis: "X", client: "clientX", direction: "left" } }, yD = ({ move: e, size: r, bar: t }) => ({ [t.size]: r, transform: `translate${t.axis}(${e}%)` }), Cl = Symbol("scrollbarContextKey"), bD = Er({ vertical: Boolean, size: String, move: Number, ratio: { type: Number, required: !0 }, always: Boolean }), wD = "Thumb", xD = /* @__PURE__ */ Re({ __name: "thumb", props: bD, setup(e) { const r = e, t = vr(Cl), n = Dr("scrollbar"); t || dl(wD, "can not inject scrollbar context"); const a = Se(), i = Se(), o = Se({}), l = Se(!1); let u = !1, s = !1, c = Ir ? document.onselectstart : null; const f = ue(() => gD[r.vertical ? "vertical" : "horizontal"]), d = ue(() => yD({ size: r.size, move: r.move, bar: f.value })), p = ue(() => a.value[f.value.offset] ** 2 / t.wrapElement[f.value.scrollSize] / r.ratio / i.value[f.value.offset]), m = (g) => { var D; if (g.stopPropagation(), g.ctrlKey || [1, 2].includes(g.button)) return; (D = window.getSelection()) == null || D.removeAllRanges(), b(g); const E = g.currentTarget; E && (o.value[f.value.axis] = E[f.value.offset] - (g[f.value.client] - E.getBoundingClientRect()[f.value.direction])); }, v = (g) => { if (!i.value || !a.value || !t.wrapElement) return; const D = Math.abs(g.target.getBoundingClientRect()[f.value.direction] - g[f.value.client]), E = i.value[f.value.offset] / 2, N = (D - E) * 100 * p.value / a.value[f.value.offset]; t.wrapElement[f.value.scroll] = N * t.wrapElement[f.value.scrollSize] / 100; }, b = (g) => { g.stopImmediatePropagation(), u = !0, document.addEventListener("mousemove", y), document.addEventListener("mouseup", A), c = document.onselectstart, document.onselectstart = () => !1; }, y = (g) => { if (!a.value || !i.value || u === !1) return; const D = o.value[f.value.axis]; if (!D) return; const E = (a.value.getBoundingClientRect()[f.value.direction] - g[f.value.client]) * -1, N = i.value[f.value.offset] - D, S = (E - N) * 100 * p.value / a.value[f.value.offset]; t.wrapElement[f.value.scroll] = S * t.wrapElement[f.value.scrollSize] / 100; }, A = () => { u = !1, o.value[f.value.axis] = 0, document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", A), w(), s && (l.value = !1); }, h = () => { s = !1, l.value = !!r.size; }, x = () => { s = !0, l.value = u; }; nn(() => { w(), document.removeEventListener("mouseup", A); }); const w = () => { document.onselectstart !== c && (document.onselectstart = c); }; return tt(qt(t, "scrollbarElement"), "mousemove", h), tt(qt(t, "scrollbarElement"), "mouseleave", x), (g, D) => (he(), He(fs, { name: U(n).b("fade"), persisted: "" }, { default: Ve(() => [ at($e("div", { ref_key: "instance", ref: a, class: _e([U(n).e("bar"), U(n).is(U(f).key)]), onMousedown: v }, [ $e("div", { ref_key: "thumb", ref: i, class: _e(U(n).e("thumb")), style: Lr(U(d)), onMousedown: m }, null, 38) ], 34), [ [Nn, g.always || l.value] ]) ]), _: 1 }, 8, ["name"])); } }); var bf = /* @__PURE__ */ Sr(xD, [["__file", "thumb.vue"]]); const AD = Er({ always: { type: Boolean, default: !0 }, minSize: { type: Number, required: !0 } }), ND = /* @__PURE__ */ Re({ __name: "bar", props: AD, setup(e, { expose: r }) { const t = e, n = vr(Cl), a = Se(0), i = Se(0), o = Se(""), l = Se(""), u = Se(1), s = Se(1); return r({ handleScroll: (d) => { if (d) { const p = d.offsetHeight - Ca, m = d.offsetWidth - Ca; i.value = d.scrollTop * 100 / p * u.value, a.value = d.scrollLeft * 100 / m * s.value; } }, update: () => { const d = n == null ? void 0 : n.wrapElement; if (!d) return; const p = d.offsetHeight - Ca, m = d.offsetWidth - Ca, v = p ** 2 / d.scrollHeight, b = m ** 2 / d.scrollWidth, y = Math.max(v, t.minSize), A = Math.max(b, t.minSize); u.value = v / (p - v) / (y / (p - y)), s.value = b / (m - b) / (A / (m - A)), l.value = y + Ca < p ? `${y}px` : "", o.value = A + Ca < m ? `${A}px` : ""; } }), (d, p) => (he(), Ce(nt, null, [ mr(bf, { move: a.value, ratio: s.value, size: o.value, always: d.always }, null, 8, ["move", "ratio", "size", "always"]), mr(bf, { move: i.value, ratio: u.value, size: l.value, vertical: "", always: d.always }, null, 8, ["move", "ratio", "size", "always"]) ], 64)); } }); var DD = /* @__PURE__ */ Sr(ND, [["__file", "bar.vue"]]); const ED = Er({ height: { type: [String, Number], default: "" }, maxHeight: { type: [String, Number], default: "" }, native: { type: Boolean, default: !1 }, wrapStyle: { type: rr([String, Object, Array]), default: "" }, wrapClass: { type: [String, Array], default: "" }, viewClass: { type: [String, Array], default: "" }, viewStyle: { type: [String, Array, Object], default: "" }, noresize: Boolean, tag: { type: String, default: "div" }, always: Boolean, minSize: { type: Number, default: 20 }, tabindex: { type: [String, Number], default: void 0 }, id: String, role: String, ...wa(["ariaLabel", "ariaOrientation"]) }), SD = { scroll: ({ scrollTop: e, scrollLeft: r }) => [e, r].every(Nr) }, Tu = "ElScrollbar", CD = Re({ name: Tu }), MD = /* @__PURE__ */ Re({ ...CD, props: ED, emits: SD, setup(e, { expose: r, emit: t }) { const n = e, a = Dr("scrollbar"); let i, o, l = 0, u = 0; const s = Se(), c = Se(), f = Se(), d = Se(), p = ue(() => { const w = {}; return n.height && (w.height = Mu(n.height)), n.maxHeight && (w.maxHeight = Mu(n.maxHeight)), [n.wrapStyle, w]; }), m = ue(() => [ n.wrapClass, a.e("wrap"), { [a.em("wrap", "hidden-default")]: !n.native } ]), v = ue(() => [a.e("view"), n.viewClass]), b = () => { var w; c.value && ((w = d.value) == null || w.handleScroll(c.value), l = c.value.scrollTop, u = c.value.scrollLeft, t("scroll", { scrollTop: c.value.scrollTop, scrollLeft: c.value.scrollLeft })); }; function y(w, g) { dt(w) ? c.value.scrollTo(w) : Nr(w) && Nr(g) && c.value.scrollTo(w, g); } const A = (w) => { if (!Nr(w)) { Tr(Tu, "value must be a number"); return; } c.value.scrollTop = w; }, h = (w) => { if (!Nr(w)) { Tr(Tu, "value must be a number"); return; } c.value.scrollLeft = w; }, x = () => { var w; (w = d.value) == null || w.update(); }; return er(() => n.noresize, (w) => { w ? (i == null || i(), o == null || o()) : ({ stop: i } = mn(f, x), o = tt("resize", x)); }, { immediate: !0 }), er(() => [n.maxHeight, n.height], () => { n.native || Cr(() => { var w; x(), c.value && ((w = d.value) == null || w.handleScroll(c.value)); }); }), Ft(Cl, Vt({ scrollbarElement: s, wrapElement: c })), M1(() => { c.value && (c.value.scrollTop = l, c.value.scrollLeft = u); }), Wr(() => { n.native || Cr(() => { x(); }); }), vh(() => x()), r({ wrapRef: c, update: x, scrollTo: y, setScrollTop: A, setScrollLeft: h, handleScroll: b }), (w, g) => (he(), Ce("div", { ref_key: "scrollbarRef", ref: s, class: _e(U(a).b()) }, [ $e("div", { ref_key: "wrapRef", ref: c, class: _e(U(m)), style: Lr(U(p)), tabindex: w.tabindex, onScroll: b }, [ (he(), He(Lt(w.tag), { id: w.id, ref_key: "resizeRef", ref: f, class: _e(U(v)), style: Lr(w.viewStyle), role: w.role, "aria-label": w.ariaLabel, "aria-orientation": w.ariaOrientation }, { default: Ve(() => [ Xe(w.$slots, "default") ]), _: 3 }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"])) ], 46, ["tabindex"]), w.native ? Be("v-if", !0) : (he(), He(DD, { key: 0, ref_key: "barRef", ref: d, always: w.always, "min-size": w.minSize }, null, 8, ["always", "min-size"])) ], 2)); } }); var _D = /* @__PURE__ */ Sr(MD, [["__file", "scrollbar.vue"]]); const FD = Bt(_D), Ml = Symbol("popper"), h0 = Symbol("popperContent"), TD = [ "dialog", "grid", "group", "listbox", "menu", "navigation", "tooltip", "tree" ], g0 = Er({ role: { type: String, values: TD, default: "tooltip" } }), OD = Re({ name: "ElPopper", inheritAttrs: !1 }), BD = /* @__PURE__ */ Re({ ...OD, props: g0, setup(e, { expose: r }) { const t = e, n = Se(), a = Se(), i = Se(), o = Se(), l = ue(() => t.role), u = { triggerRef: n, popperInstanceRef: a, contentRef: i, referenceRef: o, role: l }; return r(u), Ft(Ml, u), (s, c) => Xe(s.$slots, "default"); } }); var $D = /* @__PURE__ */ Sr(BD, [["__file", "popper.vue"]]); const y0 = Er({ arrowOffset: { type: Number, default: 5 } }), ID = Re({ name: "ElPopperArrow", inheritAttrs: !1 }), RD = /* @__PURE__ */ Re({ ...ID, props: y0, setup(e, { expose: r }) { const t = e, n = Dr("popper"), { arrowOffset: a, arrowRef: i, arrowStyle: o } = vr(h0, void 0); return er(() => t.arrowOffset, (l) => { a.value = l; }), nn(() => { i.value = void 0; }), r({ arrowRef: i }), (l, u) => (he(), Ce("span", { ref_key: "arrowRef", ref: i, class: _e(U(n).e("arrow")), style: Lr(U(o)), "data-popper-arrow": "" }, null, 6)); } }); var PD = /* @__PURE__ */ Sr(RD, [["__file", "arrow.vue"]]); const ru = "ElOnlyChild", zD = Re({ name: ru, setup(e, { slots: r, attrs: t }) { var n; const a = vr(s0), i = GN((n = a == null ? void 0 : a.setForwardRef) != null ? n : Fi); return () => { var o; const l = (o = r.default) == null ? void 0 : o.call(r, t); if (!l) return null; if (l.length > 1) return Tr(ru, "requires exact only one valid child."), null; const u = b0(l); return u ? at(_1(u, t), [[i]]) : (Tr(ru, "no valid child node found"), null); }; } }); function b0(e) { if (!e) return null; const r = e; for (const t of r) { if (dt(t)) switch (t.type) { case F1: continue; case hh: case "svg": return wf(t); case nt: return b0(t.children); default: return t; } return wf(t); } return null; } function wf(e) { const r = Dr("only-child"); return mr("span", { class: r.e("content") }, [e]); } const w0 = Er({ virtualRef: { type: rr(Object) }, virtualTriggering: Boolean, onMouseenter: { type: rr(Function) }, onMouseleave: { type: rr(Function) }, onClick: { type: rr(Function) }, onKeydown: { type: rr(Function) }, onFocus: { type: rr(Function) }, onBlur: { type: rr(Function) }, onContextmenu: { type: rr(Function) }, id: String, open: Boolean }), qD = Re({ name: "ElPopperTrigger", inheritAttrs: !1 }), LD = /* @__PURE__ */ Re({ ...qD, props: w0, setup(e, { expose: r }) { const t = e, { role: n, triggerRef: a } = vr(Ml, void 0); ZN(a); const i = ue(() => l.value ? t.id : void 0), o = ue(() => { if (n && n.value === "tooltip") return t.open && t.id ? t.id : void 0; }), l = ue(() => { if (n && n.value !== "tooltip") return n.value; }), u = ue(() => l.value ? `${t.open}` : void 0); let s; const c = [ "onMouseenter", "onMouseleave", "onClick", "onKeydown", "onFocus", "onBlur", "onContextmenu" ]; return Wr(() => { er(() => t.virtualRef, (f) => { f && (a.value = gn(f)); }, { immediate: !0 }), er(a, (f, d) => { s == null || s(), s = void 0, la(f) && (c.forEach((p) => { var m; const v = t[p]; v && (f.addEventListener(p.slice(2).toLowerCase(), v), (m = d == null ? void 0 : d.removeEventListener) == null || m.call(d, p.slice(2).toLowerCase(), v)); }), s = er([i, o, l, u], (p) => { [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((m, v) => { An(p[v]) ? f.removeAttribute(m) : f.setAttribute(m, p[v]); }); }, { immediate: !0 })), la(d) && [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((p) => d.removeAttribute(p)); }, { immediate: !0 }); }), nn(() => { if (s == null || s(), s = void 0, a.value && la(a.value)) { const f = a.value; c.forEach((d) => { const p = t[d]; p && f.removeEventListener(d.slice(2).toLowerCase(), p); }), a.value = void 0; } }), r({ triggerRef: a }), (f, d) => f.virtualTriggering ? Be("v-if", !0) : (he(), He(U(zD), Zn({ key: 0 }, f.$attrs, { "aria-controls": U(i), "aria-describedby": U(o), "aria-expanded": U(u), "aria-haspopup": U(l) }), { default: Ve(() => [ Xe(f.$slots, "default") ]), _: 3 }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])); } }); var UD = /* @__PURE__ */ Sr(LD, [["__file", "trigger.vue"]]); const tu = "focus-trap.focus-after-trapped", nu = "focus-trap.focus-after-released", kD = "focus-trap.focusout-prevented", xf = { cancelable: !0, bubbles: !1 }, VD = { cancelable: !0, bubbles: !1 }, Af = "focusAfterTrapped", Nf = "focusAfterReleased", HD = Symbol("elFocusTrap"), _l = Se(), Ds = Se(0), Fl = Se(0); let ao = 0; const x0 = (e) => { const r = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, { acceptNode: (n) => { const a = n.tagName === "INPUT" && n.type === "hidden"; return n.disabled || n.hidden || a ? NodeFilter.FILTER_SKIP : n.tabIndex >= 0 || n === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; } }); for (; t.nextNode(); ) r.push(t.currentNode); return r; }, Df = (e, r) => { for (const t of e) if (!ZD(t, r)) return t; }, ZD = (e, r) => { if (process.env.NODE_ENV === "test") return !1; if (getComputedStyle(e).visibility === "hidden") return !0; for (; e; ) { if (r && e === r) return !1; if (getComputedStyle(e).display === "none") return !0; e = e.parentElement; } return !1; }, GD = (e) => { const r = x0(e), t = Df(r, e), n = Df(r.reverse(), e); return [t, n]; }, WD = (e) => e instanceof HTMLInputElement && "select" in e, In = (e, r) => { if (e && e.focus) { const t = document.activeElement; e.focus({ preventScroll: !0 }), Fl.value = window.performance.now(), e !== t && WD(e) && r && e.select(); } }; function Ef(e, r) { const t = [...e], n = e.indexOf(r); return n !== -1 && t.splice(n, 1), t; } const KD = () => { let e = []; return { push: (n) => { const a = e[0]; a && n !== a && a.pause(), e = Ef(e, n), e.unshift(n); }, remove: (n) => { var a, i; e = Ef(e, n), (i = (a = e[0]) == null ? void 0 : a.resume) == null || i.call(a); } }; }, JD = (e, r = !1) => { const t = document.activeElement; for (const n of e) if (In(n, r), document.activeElement !== t) return; }, Sf = KD(), YD = () => Ds.value > Fl.value, io = () => { _l.value = "pointer", Ds.value = window.performance.now(); }, Cf = () => { _l.value = "keyboard", Ds.value = window.performance.now(); }, jD = () => (Wr(() => { ao === 0 && (document.addEventListener("mousedown", io), document.addEventListener("touchstart", io), document.addEventListener("keydown", Cf)), ao++; }), nn(() => { ao--, ao <= 0 && (document.removeEventListener("mousedown", io), document.removeEventListener("touchstart", io), document.removeEventListener("keydown", Cf)); }), { focusReason: _l, lastUserFocusTimestamp: Ds, lastAutomatedFocusTimestamp: Fl }), oo = (e) => new CustomEvent(kD, { ...VD, detail: e }), XD = Re({ name: "ElFocusTrap", inheritAttrs: !1, props: { loop: Boolean, trapped: Boolean, focusTrapEl: Object, focusStartEl: { type: [Object, String], default: "first" } }, emits: [ Af, Nf, "focusin", "focusout", "focusout-prevented", "release-requested" ], setup(e, { emit: r }) { const t = Se(); let n, a; const { focusReason: i } = jD(); LN((m) => { e.trapped && !o.paused && r("release-requested", m); }); const o = { paused: !1, pause() { this.paused = !0; }, resume() { this.paused = !1; } }, l = (m) => { if (!e.loop && !e.trapped || o.paused) return; const { key: v, altKey: b, ctrlKey: y, metaKey: A, currentTarget: h, shiftKey: x } = m, { loop: w } = e, g = v === Za.tab && !b && !y && !A, D = document.activeElement; if (g && D) { const E = h, [N, S] = GD(E); if (N && S) { if (!x && D === S) { const F = oo({ focusReason: i.value }); r("focusout-prevented", F), F.defaultPrevented || (m.preventDefault(), w && In(N, !0)); } else if (x && [N, E].includes(D)) { const F = oo({ focusReason: i.value }); r("focusout-prevented", F), F.defaultPrevented || (m.preventDefault(), w && In(S, !0)); } } else if (D === E) { const F = oo({ focusReason: i.value }); r("focusout-prevented", F), F.defaultPrevented || m.preventDefault(); } } }; Ft(HD, { focusTrapRef: t, onKeydown: l }), er(() => e.focusTrapEl, (m) => { m && (t.value = m); }, { immediate: !0 }), er([t], ([m], [v]) => { m && (m.addEventListener("keydown", l), m.addEventListener("focusin", c), m.addEventListener("focusout", f)), v && (v.removeEventListener("keydown", l), v.removeEventListener("focusin", c), v.removeEventListener("focusout", f)); }); const u = (m) => { r(Af, m); }, s = (m) => r(Nf, m), c = (m) => { const v = U(t); if (!v) return; const b = m.target, y = m.relatedTarget, A = b && v.contains(b); e.trapped || y && v.contains(y) || (n = y), A && r("focusin", m), !o.paused && e.trapped && (A ? a = b : In(a, !0)); }, f = (m) => { const v = U(t); if (!(o.paused || !v)) if (e.trapped) { const b = m.relatedTarget; !An(b) && !v.contains(b) && setTimeout(() => { if (!o.paused && e.trapped) { const y = oo({ focusReason: i.value }); r("focusout-prevented", y), y.defaultPrevented || In(a, !0); } }, 0); } else { const b = m.target; b && v.contains(b) || r("focusout", m); } }; async function d() { await Cr(); const m = U(t); if (m) { Sf.push(o); const v = m.contains(document.activeElement) ? n : document.activeElement; if (n = v, !m.contains(v)) { const y = new Event(tu, xf); m.addEventListener(tu, u), m.dispatchEvent(y), y.defaultPrevented || Cr(() => { let A = e.focusStartEl; wt(A) || (In(A), document.activeElement !== A && (A = "first")), A === "first" && JD(x0(m), !0), (document.activeElement === v || A === "container") && In(m); }); } } } function p() { const m = U(t); if (m) { m.removeEventListener(tu, u); const v = new CustomEvent(nu, { ...xf, detail: { focusReason: i.value } }); m.addEventListener(nu, s), m.dispatchEvent(v), !v.defaultPrevented && (i.value == "keyboard" || !YD() || m.contains(document.activeElement)) && In(n ?? document.body), m.removeEventListener(nu, s), Sf.remove(o); } } return Wr(() => { e.trapped && d(), er(() => e.trapped, (m) => { m ? d() : p(); }); }), nn(() => { e.trapped && p(), t.value && (t.value.removeEventListener("keydown", l), t.value.removeEventListener("focusin", c), t.value.removeEventListener("focusout", f), t.value = void 0); }), { onKeydown: l }; } }); function QD(e, r, t, n, a, i) { return Xe(e.$slots, "default", { handleKeydown: e.onKeydown }); } var eE = /* @__PURE__ */ Sr(XD, [["render", QD], ["__file", "focus-trap.vue"]]); const rE = ["fixed", "absolute"], tE = Er({ boundariesPadding: { type: Number, default: 0 }, fallbackPlacements: { type: rr(Array), default: void 0 }, gpuAcceleration: { type: Boolean, default: !0 }, offset: { type: Number, default: 12 }, placement: { type: String, values: oi, default: "bottom" }, popperOptions: { type: rr(Object), default: () => ({}) }, strategy: { type: String, values: rE, default: "absolute" } }), A0 = Er({ ...tE, id: String, style: { type: rr([String, Array, Object]) }, className: { type: rr([String, Array, Object]) }, effect: { type: rr(String), default: "dark" }, visible: Boolean, enterable: { type: Boolean, default: !0 }, pure: Boolean, focusOnShow: { type: Boolean, default: !1 }, trapping: { type: Boolean, default: !1 }, popperClass: { type: rr([String, Array, Object]) }, popperStyle: { type: rr([String, Array, Object]) }, referenceEl: { type: rr(Object) }, triggerTargetEl: { type: rr(Object) }, stopPopperMouseEvent: { type: Boolean, default: !0 }, virtualTriggering: Boolean, zIndex: Number, ...wa(["ariaLabel"]) }), nE = { mouseenter: (e) => e instanceof MouseEvent, mouseleave: (e) => e instanceof MouseEvent, focus: () => !0, blur: () => !0, close: () => !0 }, aE = (e, r = []) => { const { placement: t, strategy: n, popperOptions: a } = e, i = { placement: t, strategy: n, ...a, modifiers: [...oE(e), ...r] }; return sE(i, a == null ? void 0 : a.modifiers), i; }, iE = (e) => { if (Ir) return gn(e); }; function oE(e) { const { offset: r, gpuAcceleration: t, fallbackPlacements: n } = e; return [ { name: "offset", options: { offset: [0, r ?? 12] } }, { name: "preventOverflow", options: { padding: { top: 2, bottom: 2, left: 5, right: 5 } } }, { name: "flip", options: { padding: 5, fallbackPlacements: n } }, { name: "computeStyles", options: { gpuAcceleration: t } } ]; } function sE(e, r) { r && (e.modifiers = [...e.modifiers, ...r ?? []]); } const uE = 0, lE = (e) => { const { popperInstanceRef: r, contentRef: t, triggerRef: n, role: a } = vr(Ml, void 0), i = Se(), o = Se(), l = ue(() => ({ name: "eventListeners", enabled: !!e.visible })), u = ue(() => { var y; const A = U(i), h = (y = U(o)) != null ? y : uE; return { name: "arrow", enabled: !J2(A), options: { element: A, padding: h } }; }), s = ue(() => ({ onFirstUpdate: () => { m(); }, ...aE(e, [ U(u), U(l) ]) })), c = ue(() => iE(e.referenceEl) || U(n)), { attributes: f, state: d, styles: p, update: m, forceUpdate: v, instanceRef: b } = PN(c, t, s); return er(b, (y) => r.value = y), Wr(() => { er(() => { var y; return (y = U(c)) == null ? void 0 : y.getBoundingClientRect(); }, () => { m(); }); }), { attributes: f, arrowRef: i, contentRef: t, instanceRef: b, state: d, styles: p, role: a, forceUpdate: v, update: m }; }, cE = (e, { attributes: r, styles: t, role: n }) => { const { nextZIndex: a } = c0(), i = Dr("popper"), o = ue(() => U(r).popper), l = Se(Nr(e.zIndex) ? e.zIndex : a()), u = ue(() => [ i.b(), i.is("pure", e.pure), i.is(e.effect), e.popperClass ]), s = ue(() => [ { zIndex: U(l) }, U(t).popper, e.popperStyle || {} ]), c = ue(() => n.value === "dialog" ? "false" : void 0), f = ue(() => U(t).arrow || {}); return { ariaModal: c, arrowStyle: f, contentAttrs: o, contentClass: u, contentStyle: s, contentZIndex: l, updateZIndex: () => { l.value = Nr(e.zIndex) ? e.zIndex : a(); } }; }, fE = (e, r) => { const t = Se(!1), n = Se(); return { focusStartRef: n, trapped: t, onFocusAfterReleased: (s) => { var c; ((c = s.detail) == null ? void 0 : c.focusReason) !== "pointer" && (n.value = "first", r("blur")); }, onFocusAfterTrapped: () => { r("focus"); }, onFocusInTrap: (s) => { e.visible && !t.value && (s.target && (n.value = s.target), t.value = !0); }, onFocusoutPrevented: (s) => { e.trapping || (s.detail.focusReason === "pointer" && s.preventDefault(), t.value = !1); }, onReleaseRequested: () => { t.value = !1, r("close"); } }; }, dE = Re({ name: "ElPopperContent" }), pE = /* @__PURE__ */ Re({ ...dE, props: A0, emits: nE, setup(e, { expose: r, emit: t }) { const n = e, { focusStartRef: a, trapped: i, onFocusAfterReleased: o, onFocusAfterTrapped: l, onFocusInTrap: u, onFocusoutPrevented: s, onReleaseRequested: c } = fE(n, t), { attributes: f, arrowRef: d, contentRef: p, styles: m, instanceRef: v, role: b, update: y } = lE(n), { ariaModal: A, arrowStyle: h, contentAttrs: x, contentClass: w, contentStyle: g, updateZIndex: D } = cE(n, { styles: m, attributes: f, role: b }), E = vr(Ho, void 0), N = Se(); Ft(h0, { arrowStyle: h, arrowRef: d, arrowOffset: N }), E && Ft(Ho, { ...E, addInputId: Fi, removeInputId: Fi }); let S; const M = ($ = !0) => { y(), $ && D(); }, F = () => { M(!1), n.visible && n.focusOnShow ? i.value = !0 : n.visible === !1 && (i.value = !1); }; return Wr(() => { er(() => n.triggerTargetEl, ($, I) => { S == null || S(), S = void 0; const B = U($ || p.value), C = U(I || p.value); la(B) && (S = er([b, () => n.ariaLabel, A, () => n.id], (_) => { ["role", "aria-label", "aria-modal", "id"].forEach((z, O) => { An(_[O]) ? B.removeAttribute(z) : B.setAttribute(z, _[O]); }); }, { immediate: !0 })), C !== B && la(C) && ["role", "aria-label", "aria-modal", "id"].forEach((_) => { C.removeAttribute(_); }); }, { immediate: !0 }), er(() => n.visible, F, { immediate: !0 }); }), nn(() => { S == null || S(), S = void 0; }), r({ popperContentRef: p, popperInstanceRef: v, updatePopper: M, contentStyle: g }), ($, I) => (he(), Ce("div", Zn({ ref_key: "contentRef", ref: p }, U(x), { style: U(g), class: U(w), tabindex: "-1", onMouseenter: (B) => $.$emit("mouseenter", B), onMouseleave: (B) => $.$emit("mouseleave", B) }), [ mr(U(eE), { trapped: U(i), "trap-on-focus-in": !0, "focus-trap-el": U(p), "focus-start-el": U(a), onFocusAfterTrapped: U(l), onFocusAfterReleased: U(o), onFocusin: U(u), onFocusoutPrevented: U(s), onReleaseRequested: U(c) }, { default: Ve(() => [ Xe($.$slots, "default") ]), _: 3 }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"]) ], 16, ["onMouseenter", "onMouseleave"])); } }); var mE = /* @__PURE__ */ Sr(pE, [["__file", "content.vue"]]); const vE = Bt($D), Tl = Symbol("elTooltip"), Ol = Er({ ...VN, ...A0, appendTo: { type: rr([String, Object]) }, content: { type: String, default: "" }, rawContent: Boolean, persistent: Boolean, visible: { type: rr(Boolean), default: null }, transition: String, teleported: { type: Boolean, default: !0 }, disabled: Boolean, ...wa(["ariaLabel"]) }), N0 = Er({ ...w0, disabled: Boolean, trigger: { type: rr([String, Array]), default: "hover" }, triggerKeys: { type: rr(Array), default: () => [Za.enter, Za.space] } }), { useModelToggleProps: hE, useModelToggleEmits: gE, useModelToggle: yE } = $A("visible"), bE = Er({ ...g0, ...hE, ...Ol, ...N0, ...y0, showArrow: { type: Boolean, default: !0 } }), wE = [ ...gE, "before-show", "before-hide", "show", "hide", "open", "close" ], xE = (e, r) => Yt(e) ? e.includes(r) : e === r, Ma = (e, r, t) => (n) => { xE(U(e), r) && t(n); }, AE = Re({ name: "ElTooltipTrigger" }), NE = /* @__PURE__ */ Re({ ...AE, props: N0, setup(e, { expose: r }) { const t = e, n = Dr("tooltip"), { controlled: a, id: i, open: o, onOpen: l, onClose: u, onToggle: s } = vr(Tl, void 0), c = Se(null), f = () => { if (U(a) || t.disabled) return !0; }, d = qt(t, "trigger"), p = pn(f, Ma(d, "hover", l)), m = pn(f, Ma(d, "hover", u)), v = pn(f, Ma(d, "click", (x) => { x.button === 0 && s(x); })), b = pn(f, Ma(d, "focus", l)), y = pn(f, Ma(d, "focus", u)), A = pn(f, Ma(d, "contextmenu", (x) => { x.preventDefault(), s(x); })), h = pn(f, (x) => { const { code: w } = x; t.triggerKeys.includes(w) && (x.preventDefault(), s(x)); }); return r({ triggerRef: c }), (x, w) => (he(), He(U(UD), { id: U(i), "virtual-ref": x.virtualRef, open: U(o), "virtual-triggering": x.virtualTriggering, class: _e(U(n).e("trigger")), onBlur: U(y), onClick: U(v), onContextmenu: U(A), onFocus: U(b), onMouseenter: U(p), onMouseleave: U(m), onKeydown: U(h) }, { default: Ve(() => [ Xe(x.$slots, "default") ]), _: 3 }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"])); } }); var DE = /* @__PURE__ */ Sr(NE, [["__file", "trigger.vue"]]); const EE = Er({ to: { type: rr([String, Object]), required: !0 }, disabled: Boolean }), SE = /* @__PURE__ */ Re({ __name: "teleport", props: EE, setup(e) { return (r, t) => r.disabled ? Xe(r.$slots, "default", { key: 0 }) : (he(), He(T1, { key: 1, to: r.to }, [ Xe(r.$slots, "default") ], 8, ["to"])); } }); var CE = /* @__PURE__ */ Sr(SE, [["__file", "teleport.vue"]]); const ME = Bt(CE), _E = Re({ name: "ElTooltipContent", inheritAttrs: !1 }), FE = /* @__PURE__ */ Re({ ..._E, props: Ol, setup(e, { expose: r }) { const t = e, { selector: n } = o0(), a = Dr("tooltip"), i = Se(null); let o; const { controlled: l, id: u, open: s, trigger: c, onClose: f, onOpen: d, onShow: p, onHide: m, onBeforeShow: v, onBeforeHide: b } = vr(Tl, void 0), y = ue(() => t.transition || `${a.namespace.value}-fade-in-linear`), A = ue(() => process.env.NODE_ENV === "test" ? !0 : t.persistent); nn(() => { o == null || o(); }); const h = ue(() => U(A) ? !0 : U(s)), x = ue(() => t.disabled ? !1 : U(s)), w = ue(() => t.appendTo || n.value), g = ue(() => { var C; return (C = t.style) != null ? C : {}; }), D = Se(!0), E = () => { m(), D.value = !0; }, N = () => { if (U(l)) return !0; }, S = pn(N, () => { t.enterable && U(c) === "hover" && d(); }), M = pn(N, () => { U(c) === "hover" && f(); }), F = () => { var C, _; (_ = (C = i.value) == null ? void 0 : C.updatePopper) == null || _.call(C), v == null || v(); }, $ = () => { b == null || b(); }, I = () => { p(), o = H1(ue(() => { var C; return (C = i.value) == null ? void 0 : C.popperContentRef; }), () => { if (U(l)) return; U(c) !== "hover" && f(); }); }, B = () => { t.virtualTriggering || f(); }; return er(() => U(s), (C) => { C ? D.value = !1 : o == null || o(); }, { flush: "post" }), er(() => t.content, () => { var C, _; (_ = (C = i.value) == null ? void 0 : C.updatePopper) == null || _.call(C); }), r({ contentRef: i }), (C, _) => (he(), He(U(ME), { disabled: !C.teleported, to: U(w) }, { default: Ve(() => [ mr(fs, { name: U(y), onAfterLeave: E, onBeforeEnter: F, onAfterEnter: I, onBeforeLeave: $ }, { default: Ve(() => [ U(h) ? at((he(), He(U(mE), Zn({ key: 0, id: U(u), ref_key: "contentRef", ref: i }, C.$attrs, { "aria-label": C.ariaLabel, "aria-hidden": D.value, "boundaries-padding": C.boundariesPadding, "fallback-placements": C.fallbackPlacements, "gpu-acceleration": C.gpuAcceleration, offset: C.offset, placement: C.placement, "popper-options": C.popperOptions, strategy: C.strategy, effect: C.effect, enterable: C.enterable, pure: C.pure, "popper-class": C.popperClass, "popper-style": [C.popperStyle, U(g)], "reference-el": C.referenceEl, "trigger-target-el": C.triggerTargetEl, visible: U(x), "z-index": C.zIndex, onMouseenter: U(S), onMouseleave: U(M), onBlur: B, onClose: U(f) }), { default: Ve(() => [ Xe(C.$slots, "default") ]), _: 3 }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [ [Nn, U(x)] ]) : Be("v-if", !0) ]), _: 3 }, 8, ["name"]) ]), _: 3 }, 8, ["disabled", "to"])); } }); var TE = /* @__PURE__ */ Sr(FE, [["__file", "content.vue"]]); const OE = Re({ name: "ElTooltip" }), BE = /* @__PURE__ */ Re({ ...OE, props: bE, emits: wE, setup(e, { expose: r, emit: t }) { const n = e; kN(); const a = As(), i = Se(), o = Se(), l = () => { var y; const A = U(i); A && ((y = A.popperInstanceRef) == null || y.update()); }, u = Se(!1), s = Se(), { show: c, hide: f, hasUpdateHandler: d } = yE({ indicator: u, toggleReason: s }), { onOpen: p, onClose: m } = HN({ showAfter: qt(n, "showAfter"), hideAfter: qt(n, "hideAfter"), autoClose: qt(n, "autoClose"), open: c, close: f }), v = ue(() => Ph(n.visible) && !d.value); Ft(Tl, { controlled: v, id: a, open: O1(u), trigger: qt(n, "trigger"), onOpen: (y) => { p(y); }, onClose: (y) => { m(y); }, onToggle: (y) => { U(u) ? m(y) : p(y); }, onShow: () => { t("show", s.value); }, onHide: () => { t("hide", s.value); }, onBeforeShow: () => { t("before-show", s.value); }, onBeforeHide: () => { t("before-hide", s.value); }, updatePopper: l }), er(() => n.disabled, (y) => { y && u.value && (u.value = !1); }); const b = (y) => { var A, h; const x = (h = (A = o.value) == null ? void 0 : A.contentRef) == null ? void 0 : h.popperContentRef, w = (y == null ? void 0 : y.relatedTarget) || document.activeElement; return x && x.contains(w); }; return B1(() => u.value && f()), r({ popperRef: i, contentRef: o, isFocusInsideContent: b, updatePopper: l, onOpen: p, onClose: m, hide: f }), (y, A) => (he(), He(U(vE), { ref_key: "popperRef", ref: i, role: y.role }, { default: Ve(() => [ mr(DE, { disabled: y.disabled, trigger: y.trigger, "trigger-keys": y.triggerKeys, "virtual-ref": y.virtualRef, "virtual-triggering": y.virtualTriggering }, { default: Ve(() => [ y.$slots.default ? Xe(y.$slots, "default", { key: 0 }) : Be("v-if", !0) ]), _: 3 }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]), mr(TE, { ref_key: "contentRef", ref: o, "aria-label": y.ariaLabel, "boundaries-padding": y.boundariesPadding, content: y.content, disabled: y.disabled, effect: y.effect, enterable: y.enterable, "fallback-placements": y.fallbackPlacements, "hide-after": y.hideAfter, "gpu-acceleration": y.gpuAcceleration, offset: y.offset, persistent: y.persistent, "popper-class": y.popperClass, "popper-style": y.popperStyle, placement: y.placement, "popper-options": y.popperOptions, pure: y.pure, "raw-content": y.rawContent, "reference-el": y.referenceEl, "trigger-target-el": y.triggerTargetEl, "show-after": y.showAfter, strategy: y.strategy, teleported: y.teleported, transition: y.transition, "virtual-triggering": y.virtualTriggering, "z-index": y.zIndex, "append-to": y.appendTo }, { default: Ve(() => [ Xe(y.$slots, "content", {}, () => [ y.rawContent ? (he(), Ce("span", { key: 0, innerHTML: y.content }, null, 8, ["innerHTML"])) : (he(), Ce("span", { key: 1 }, qr(y.content), 1)) ]), y.showArrow ? (he(), He(U(PD), { key: 0, "arrow-offset": y.arrowOffset }, null, 8, ["arrow-offset"])) : Be("v-if", !0) ]), _: 3 }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"]) ]), _: 3 }, 8, ["role"])); } }); var $E = /* @__PURE__ */ Sr(BE, [["__file", "tooltip.vue"]]); const D0 = Bt($E), E0 = Symbol("buttonGroupContextKey"), IE = (e, r) => { SA({ from: "type.text", replacement: "link", version: "3.0.0", scope: "props", ref: "https://element-plus.org/en-US/component/button.html#button-attributes" }, ue(() => e.type === "text")); const t = vr(E0, void 0), n = Dl("button"), { form: a } = Zi(), i = si(ue(() => t == null ? void 0 : t.size)), o = Ns(), l = Se(), u = mh(), s = ue(() => e.type || (t == null ? void 0 : t.type) || ""), c = ue(() => { var m, v, b; return (b = (v = e.autoInsertSpace) != null ? v : (m = n.value) == null ? void 0 : m.autoInsertSpace) != null ? b : !1; }), f = ue(() => e.tag === "button" ? { ariaDisabled: o.value || e.loading, disabled: o.value || e.loading, autofocus: e.autofocus, type: e.nativeType } : {}), d = ue(() => { var m; const v = (m = u.default) == null ? void 0 : m.call(u); if (c.value && (v == null ? void 0 : v.length) === 1) { const b = v[0]; if ((b == null ? void 0 : b.type) === hh) { const y = b.children; return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(y.trim()); } } return !1; }); return { _disabled: o, _size: i, _type: s, _ref: l, _props: f, shouldAddSpace: d, handleClick: (m) => { if (o.value || e.loading) { m.stopPropagation(); return; } e.nativeType === "reset" && (a == null || a.resetFields()), r("click", m); } }; }, RE = [ "default", "primary", "success", "warning", "info", "danger", "text", "" ], PE = ["button", "submit", "reset"], Ou = Er({ size: ja, disabled: Boolean, type: { type: String, values: RE, default: "" }, icon: { type: Ha }, nativeType: { type: String, values: PE, default: "button" }, loading: Boolean, loadingIcon: { type: Ha, default: () => Uh }, plain: Boolean, text: Boolean, link: Boolean, bg: Boolean, autofocus: Boolean, round: Boolean, circle: Boolean, color: String, dark: Boolean, autoInsertSpace: { type: Boolean, default: void 0 }, tag: { type: rr([String, Object]), default: "button" } }), zE = { click: (e) => e instanceof MouseEvent }; function Zr(e, r) { qE(e) && (e = "100%"); var t = LE(e); return e = r === 360 ? e : Math.min(r, Math.max(0, parseFloat(e))), t && (e = parseInt(String(e * r), 10) / 100), Math.abs(e - r) < 1e-6 ? 1 : (r === 360 ? e = (e < 0 ? e % r + r : e % r) / parseFloat(String(r)) : e = e % r / parseFloat(String(r)), e); } function so(e) { return Math.min(1, Math.max(0, e)); } function qE(e) { return typeof e == "string" && e.indexOf(".") !== -1 && parseFloat(e) === 1; } function LE(e) { return typeof e == "string" && e.indexOf("%") !== -1; } function S0(e) { return e = parseFloat(e), (isNaN(e) || e < 0 || e > 1) && (e = 1), e; } function uo(e) { return e <= 1 ? "".concat(Number(e) * 100, "%") : e; } function sa(e) { return e.length === 1 ? "0" + e : String(e); } function UE(e, r, t) { return { r: Zr(e, 255) * 255, g: Zr(r, 255) * 255, b: Zr(t, 255) * 255 }; } function Mf(e, r, t) { e = Zr(e, 255), r = Zr(r, 255), t = Zr(t, 255); var n = Math.max(e, r, t), a = Math.min(e, r, t), i = 0, o = 0, l = (n + a) / 2; if (n === a) o = 0, i = 0; else { var u = n - a; switch (o = l > 0.5 ? u / (2 - n - a) : u / (n + a), n) { case e: i = (r - t) / u + (r < t ? 6 : 0); break; case r: i = (t - e) / u + 2; break; case t: i = (e - r) / u + 4; break; } i /= 6; } return { h: i, s: o, l }; } function au(e, r, t) { return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? e + (r - e) * (6 * t) : t < 1 / 2 ? r : t < 2 / 3 ? e + (r - e) * (2 / 3 - t) * 6 : e; } function kE(e, r, t) { var n, a, i; if (e = Zr(e, 360), r = Zr(r, 100), t = Zr(t, 100), r === 0) a = t, i = t, n = t; else { var o = t < 0.5 ? t * (1 + r) : t + r - t * r, l = 2 * t - o; n = au(l, o, e + 1 / 3), a = au(l, o, e), i = au(l, o, e - 1 / 3); } return { r: n * 255, g: a * 255, b: i * 255 }; } function _f(e, r, t) { e = Zr(e, 255), r = Zr(r, 255), t = Zr(t, 255); var n = Math.max(e, r, t), a = Math.min(e, r, t), i = 0, o = n, l = n - a, u = n === 0 ? 0 : l / n; if (n === a) i = 0; else { switch (n) { case e: i = (r - t) / l + (r < t ? 6 : 0); break; case r: i = (t - e) / l + 2; break; case t: i = (e - r) / l + 4; break; } i /= 6; } return { h: i, s: u, v: o }; } function VE(e, r, t) { e = Zr(e, 360) * 6, r = Zr(r, 100), t = Zr(t, 100); var n = Math.floor(e), a = e - n, i = t * (1 - r), o = t * (1 - a * r), l = t * (1 - (1 - a) * r), u = n % 6, s = [t, o, i, i, l, t][u], c = [l, t, t, o, i, i][u], f = [i, i, l, t, t, o][u]; return { r: s * 255, g: c * 255, b: f * 255 }; } function Ff(e, r, t, n) { var a = [ sa(Math.round(e).toString(16)), sa(Math.round(r).toString(16)), sa(Math.round(t).toString(16)) ]; return n && a[0].startsWith(a[0].charAt(1)) && a[1].startsWith(a[1].charAt(1)) && a[2].startsWith(a[2].charAt(1)) ? a[0].charAt(0) + a[1].charAt(0) + a[2].charAt(0) : a.join(""); } function HE(e, r, t, n, a) { var i = [ sa(Math.round(e).toString(16)), sa(Math.round(r).toString(16)), sa(Math.round(t).toString(16)), sa(ZE(n)) ]; return a && i[0].startsWith(i[0].charAt(1)) && i[1].startsWith(i[1].charAt(1)) && i[2].startsWith(i[2].charAt(1)) && i[3].startsWith(i[3].charAt(1)) ? i[0].charAt(0) + i[1].charAt(0) + i[2].charAt(0) + i[3].charAt(0) : i.join(""); } function ZE(e) { return Math.round(parseFloat(e) * 255).toString(16); } function Tf(e) { return gt(e) / 255; } function gt(e) { return parseInt(e, 16); } function GE(e) { return { r: e >> 16, g: (e & 65280) >> 8, b: e & 255 }; } var Bu = { aliceblue: "#f0f8ff", antiquewhite: "#faebd7", aqua: "#00ffff", aquamarine: "#7fffd4", azure: "#f0ffff", beige: "#f5f5dc", bisque: "#ffe4c4", black: "#000000", blanchedalmond: "#ffebcd", blue: "#0000ff", blueviolet: "#8a2be2", brown: "#a52a2a", burlywood: "#deb887", cadetblue: "#5f9ea0", chartreuse: "#7fff00", chocolate: "#d2691e", coral: "#ff7f50", cornflowerblue: "#6495ed", cornsilk: "#fff8dc", crimson: "#dc143c", cyan: "#00ffff", darkblue: "#00008b", darkcyan: "#008b8b", darkgoldenrod: "#b8860b", darkgray: "#a9a9a9", darkgreen: "#006400", darkgrey: "#a9a9a9", darkkhaki: "#bdb76b", darkmagenta: "#8b008b", darkolivegreen: "#556b2f", darkorange: "#ff8c00", darkorchid: "#9932cc", darkred: "#8b0000", darksalmon: "#e9967a", darkseagreen: "#8fbc8f", darkslateblue: "#483d8b", darkslategray: "#2f4f4f", darkslategrey: "#2f4f4f", darkturquoise: "#00ced1", darkviolet: "#9400d3", deeppink: "#ff1493", deepskyblue: "#00bfff", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1e90ff", firebrick: "#b22222", floralwhite: "#fffaf0", forestgreen: "#228b22", fuchsia: "#ff00ff", gainsboro: "#dcdcdc", ghostwhite: "#f8f8ff", goldenrod: "#daa520", gold: "#ffd700", gray: "#808080", green: "#008000", greenyellow: "#adff2f", grey: "#808080", honeydew: "#f0fff0", hotpink: "#ff69b4", indianred: "#cd5c5c", indigo: "#4b0082", ivory: "#fffff0", khaki: "#f0e68c", lavenderblush: "#fff0f5", lavender: "#e6e6fa", lawngreen: "#7cfc00", lemonchiffon: "#fffacd", lightblue: "#add8e6", lightcoral: "#f08080", lightcyan: "#e0ffff", lightgoldenrodyellow: "#fafad2", lightgray: "#d3d3d3", lightgreen: "#90ee90", lightgrey: "#d3d3d3", lightpink: "#ffb6c1", lightsalmon: "#ffa07a", lightseagreen: "#20b2aa", lightskyblue: "#87cefa", lightslategray: "#778899", lightslategrey: "#778899", lightsteelblue: "#b0c4de", lightyellow: "#ffffe0", lime: "#00ff00", limegreen: "#32cd32", linen: "#faf0e6", magenta: "#ff00ff", maroon: "#800000", mediumaquamarine: "#66cdaa", mediumblue: "#0000cd", mediumorchid: "#ba55d3", mediumpurple: "#9370db", mediumseagreen: "#3cb371", mediumslateblue: "#7b68ee", mediumspringgreen: "#00fa9a", mediumturquoise: "#48d1cc", mediumvioletred: "#c71585", midnightblue: "#191970", mintcream: "#f5fffa", mistyrose: "#ffe4e1", moccasin: "#ffe4b5", navajowhite: "#ffdead", navy: "#000080", oldlace: "#fdf5e6", olive: "#808000", olivedrab: "#6b8e23", orange: "#ffa500", orangered: "#ff4500", orchid: "#da70d6", palegoldenrod: "#eee8aa", palegreen: "#98fb98", paleturquoise: "#afeeee", palevioletred: "#db7093", papayawhip: "#ffefd5", peachpuff: "#ffdab9", peru: "#cd853f", pink: "#ffc0cb", plum: "#dda0dd", powderblue: "#b0e0e6", purple: "#800080", rebeccapurple: "#663399", red: "#ff0000", rosybrown: "#bc8f8f", royalblue: "#4169e1", saddlebrown: "#8b4513", salmon: "#fa8072", sandybrown: "#f4a460", seagreen: "#2e8b57", seashell: "#fff5ee", sienna: "#a0522d", silver: "#c0c0c0", skyblue: "#87ceeb", slateblue: "#6a5acd", slategray: "#708090", slategrey: "#708090", snow: "#fffafa", springgreen: "#00ff7f", steelblue: "#4682b4", tan: "#d2b48c", teal: "#008080", thistle: "#d8bfd8", tomato: "#ff6347", turquoise: "#40e0d0", violet: "#ee82ee", wheat: "#f5deb3", white: "#ffffff", whitesmoke: "#f5f5f5", yellow: "#ffff00", yellowgreen: "#9acd32" }; function WE(e) { var r = { r: 0, g: 0, b: 0 }, t = 1, n = null, a = null, i = null, o = !1, l = !1; return typeof e == "string" && (e = YE(e)), typeof e == "object" && (ln(e.r) && ln(e.g) && ln(e.b) ? (r = UE(e.r, e.g, e.b), o = !0, l = String(e.r).substr(-1) === "%" ? "prgb" : "rgb") : ln(e.h) && ln(e.s) && ln(e.v) ? (n = uo(e.s), a = uo(e.v), r = VE(e.h, n, a), o = !0, l = "hsv") : ln(e.h) && ln(e.s) && ln(e.l) && (n = uo(e.s), i = uo(e.l), r = kE(e.h, n, i), o = !0, l = "hsl"), Object.prototype.hasOwnProperty.call(e, "a") && (t = e.a)), t = S0(t), { ok: o, format: e.format || l, r: Math.min(255, Math.max(r.r, 0)), g: Math.min(255, Math.max(r.g, 0)), b: Math.min(255, Math.max(r.b, 0)), a: t }; } var KE = "[-\\+]?\\d+%?", JE = "[-\\+]?\\d*\\.\\d+%?", Un = "(?:".concat(JE, ")|(?:").concat(KE, ")"), iu = "[\\s|\\(]+(".concat(Un, ")[,|\\s]+(").concat(Un, ")[,|\\s]+(").concat(Un, ")\\s*\\)?"), ou = "[\\s|\\(]+(".concat(Un, ")[,|\\s]+(").concat(Un, ")[,|\\s]+(").concat(Un, ")[,|\\s]+(").concat(Un, ")\\s*\\)?"), Rt = { CSS_UNIT: new RegExp(Un), rgb: new RegExp("rgb" + iu), rgba: new RegExp("rgba" + ou), hsl: new RegExp("hsl" + iu), hsla: new RegExp("hsla" + ou), hsv: new RegExp("hsv" + iu), hsva: new RegExp("hsva" + ou), hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ }; function YE(e) { if (e = e.trim().toLowerCase(), e.length === 0) return !1; var r = !1; if (Bu[e]) e = Bu[e], r = !0; else if (e === "transparent") return { r: 0, g: 0, b: 0, a: 0, format: "name" }; var t = Rt.rgb.exec(e); return t ? { r: t[1], g: t[2], b: t[3] } : (t = Rt.rgba.exec(e), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = Rt.hsl.exec(e), t ? { h: t[1], s: t[2], l: t[3] } : (t = Rt.hsla.exec(e), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = Rt.hsv.exec(e), t ? { h: t[1], s: t[2], v: t[3] } : (t = Rt.hsva.exec(e), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = Rt.hex8.exec(e), t ? { r: gt(t[1]), g: gt(t[2]), b: gt(t[3]), a: Tf(t[4]), format: r ? "name" : "hex8" } : (t = Rt.hex6.exec(e), t ? { r: gt(t[1]), g: gt(t[2]), b: gt(t[3]), format: r ? "name" : "hex" } : (t = Rt.hex4.exec(e), t ? { r: gt(t[1] + t[1]), g: gt(t[2] + t[2]), b: gt(t[3] + t[3]), a: Tf(t[4] + t[4]), format: r ? "name" : "hex8" } : (t = Rt.hex3.exec(e), t ? { r: gt(t[1] + t[1]), g: gt(t[2] + t[2]), b: gt(t[3] + t[3]), format: r ? "name" : "hex" } : !1))))))))); } function ln(e) { return !!Rt.CSS_UNIT.exec(String(e)); } var jE = ( /** @class */ function() { function e(r, t) { r === void 0 && (r = ""), t === void 0 && (t = {}); var n; if (r instanceof e) return r; typeof r == "number" && (r = GE(r)), this.originalInput = r; var a = WE(r); this.originalInput = r, this.r = a.r, this.g = a.g, this.b = a.b, this.a = a.a, this.roundA = Math.round(100 * this.a) / 100, this.format = (n = t.format) !== null && n !== void 0 ? n : a.format, this.gradientType = t.gradientType, this.r < 1 && (this.r = Math.round(this.r)), this.g < 1 && (this.g = Math.round(this.g)), this.b < 1 && (this.b = Math.round(this.b)), this.isValid = a.ok; } return e.prototype.isDark = function() { return this.getBrightness() < 128; }, e.prototype.isLight = function() { return !this.isDark(); }, e.prototype.getBrightness = function() { var r = this.toRgb(); return (r.r * 299 + r.g * 587 + r.b * 114) / 1e3; }, e.prototype.getLuminance = function() { var r = this.toRgb(), t, n, a, i = r.r / 255, o = r.g / 255, l = r.b / 255; return i <= 0.03928 ? t = i / 12.92 : t = Math.pow((i + 0.055) / 1.055, 2.4), o <= 0.03928 ? n = o / 12.92 : n = Math.pow((o + 0.055) / 1.055, 2.4), l <= 0.03928 ? a = l / 12.92 : a = Math.pow((l + 0.055) / 1.055, 2.4), 0.2126 * t + 0.7152 * n + 0.0722 * a; }, e.prototype.getAlpha = function() { return this.a; }, e.prototype.setAlpha = function(r) { return this.a = S0(r), this.roundA = Math.round(100 * this.a) / 100, this; }, e.prototype.isMonochrome = function() { var r = this.toHsl().s; return r === 0; }, e.prototype.toHsv = function() { var r = _f(this.r, this.g, this.b); return { h: r.h * 360, s: r.s, v: r.v, a: this.a }; }, e.prototype.toHsvString = function() { var r = _f(this.r, this.g, this.b), t = Math.round(r.h * 360), n = Math.round(r.s * 100), a = Math.round(r.v * 100); return this.a === 1 ? "hsv(".concat(t, ", ").concat(n, "%, ").concat(a, "%)") : "hsva(".concat(t, ", ").concat(n, "%, ").concat(a, "%, ").concat(this.roundA, ")"); }, e.prototype.toHsl = function() { var r = Mf(this.r, this.g, this.b); return { h: r.h * 360, s: r.s, l: r.l, a: this.a }; }, e.prototype.toHslString = function() { var r = Mf(this.r, this.g, this.b), t = Math.round(r.h * 360), n = Math.round(r.s * 100), a = Math.round(r.l * 100); return this.a === 1 ? "hsl(".concat(t, ", ").concat(n, "%, ").concat(a, "%)") : "hsla(".concat(t, ", ").concat(n, "%, ").concat(a, "%, ").concat(this.roundA, ")"); }, e.prototype.toHex = function(r) { return r === void 0 && (r = !1), Ff(this.r, this.g, this.b, r); }, e.prototype.toHexString = function(r) { return r === void 0 && (r = !1), "#" + this.toHex(r); }, e.prototype.toHex8 = function(r) { return r === void 0 && (r = !1), HE(this.r, this.g, this.b, this.a, r); }, e.prototype.toHex8String = function(r) { return r === void 0 && (r = !1), "#" + this.toHex8(r); }, e.prototype.toHexShortString = function(r) { return r === void 0 && (r = !1), this.a === 1 ? this.toHexString(r) : this.toHex8String(r); }, e.prototype.toRgb = function() { return { r: Math.round(this.r), g: Math.round(this.g), b: Math.round(this.b), a: this.a }; }, e.prototype.toRgbString = function() { var r = Math.round(this.r), t = Math.round(this.g), n = Math.round(this.b); return this.a === 1 ? "rgb(".concat(r, ", ").concat(t, ", ").concat(n, ")") : "rgba(".concat(r, ", ").concat(t, ", ").concat(n, ", ").concat(this.roundA, ")"); }, e.prototype.toPercentageRgb = function() { var r = function(t) { return "".concat(Math.round(Zr(t, 255) * 100), "%"); }; return { r: r(this.r), g: r(this.g), b: r(this.b), a: this.a }; }, e.prototype.toPercentageRgbString = function() { var r = function(t) { return Math.round(Zr(t, 255) * 100); }; return this.a === 1 ? "rgb(".concat(r(this.r), "%, ").concat(r(this.g), "%, ").concat(r(this.b), "%)") : "rgba(".concat(r(this.r), "%, ").concat(r(this.g), "%, ").concat(r(this.b), "%, ").concat(this.roundA, ")"); }, e.prototype.toName = function() { if (this.a === 0) return "transparent"; if (this.a < 1) return !1; for (var r = "#" + Ff(this.r, this.g, this.b, !1), t = 0, n = Object.entries(Bu); t < n.length; t++) { var a = n[t], i = a[0], o = a[1]; if (r === o) return i; } return !1; }, e.prototype.toString = function(r) { var t = !!r; r = r ?? this.format; var n = !1, a = this.a < 1 && this.a >= 0, i = !t && a && (r.startsWith("hex") || r === "name"); return i ? r === "name" && this.a === 0 ? this.toName() : this.toRgbString() : (r === "rgb" && (n = this.toRgbString()), r === "prgb" && (n = this.toPercentageRgbString()), (r === "hex" || r === "hex6") && (n = this.toHexString()), r === "hex3" && (n = this.toHexString(!0)), r === "hex4" && (n = this.toHex8String(!0)), r === "hex8" && (n = this.toHex8String()), r === "name" && (n = this.toName()), r === "hsl" && (n = this.toHslString()), r === "hsv" && (n = this.toHsvString()), n || this.toHexString()); }, e.prototype.toNumber = function() { return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b); }, e.prototype.clone = function() { return new e(this.toString()); }, e.prototype.lighten = function(r) { r === void 0 && (r = 10); var t = this.toHsl(); return t.l += r / 100, t.l = so(t.l), new e(t); }, e.prototype.brighten = function(r) { r === void 0 && (r = 10); var t = this.toRgb(); return t.r = Math.max(0, Math.min(255, t.r - Math.round(255 * -(r / 100)))), t.g = Math.max(0, Math.min(255, t.g - Math.round(255 * -(r / 100)))), t.b = Math.max(0, Math.min(255, t.b - Math.round(255 * -(r / 100)))), new e(t); }, e.prototype.darken = function(r) { r === void 0 && (r = 10); var t = this.toHsl(); return t.l -= r / 100, t.l = so(t.l), new e(t); }, e.prototype.tint = function(r) { return r === void 0 && (r = 10), this.mix("white", r); }, e.prototype.shade = function(r) { return r === void 0 && (r = 10), this.mix("black", r); }, e.prototype.desaturate = function(r) { r === void 0 && (r = 10); var t = this.toHsl(); return t.s -= r / 100, t.s = so(t.s), new e(t); }, e.prototype.saturate = function(r) { r === void 0 && (r = 10); var t = this.toHsl(); return t.s += r / 100, t.s = so(t.s), new e(t); }, e.prototype.greyscale = function() { return this.desaturate(100); }, e.prototype.spin = function(r) { var t = this.toHsl(), n = (t.h + r) % 360; return t.h = n < 0 ? 360 + n : n, new e(t); }, e.prototype.mix = function(r, t) { t === void 0 && (t = 50); var n = this.toRgb(), a = new e(r).toRgb(), i = t / 100, o = { r: (a.r - n.r) * i + n.r, g: (a.g - n.g) * i + n.g, b: (a.b - n.b) * i + n.b, a: (a.a - n.a) * i + n.a }; return new e(o); }, e.prototype.analogous = function(r, t) { r === void 0 && (r = 6), t === void 0 && (t = 30); var n = this.toHsl(), a = 360 / t, i = [this]; for (n.h = (n.h - (a * r >> 1) + 720) % 360; --r; ) n.h = (n.h + a) % 360, i.push(new e(n)); return i; }, e.prototype.complement = function() { var r = this.toHsl(); return r.h = (r.h + 180) % 360, new e(r); }, e.prototype.monochromatic = function(r) { r === void 0 && (r = 6); for (var t = this.toHsv(), n = t.h, a = t.s, i = t.v, o = [], l = 1 / r; r--; ) o.push(new e({ h: n, s: a, v: i })), i = (i + l) % 1; return o; }, e.prototype.splitcomplement = function() { var r = this.toHsl(), t = r.h; return [ this, new e({ h: (t + 72) % 360, s: r.s, l: r.l }), new e({ h: (t + 216) % 360, s: r.s, l: r.l }) ]; }, e.prototype.onBackground = function(r) { var t = this.toRgb(), n = new e(r).toRgb(), a = t.a + n.a * (1 - t.a); return new e({ r: (t.r * t.a + n.r * n.a * (1 - t.a)) / a, g: (t.g * t.a + n.g * n.a * (1 - t.a)) / a, b: (t.b * t.a + n.b * n.a * (1 - t.a)) / a, a }); }, e.prototype.triad = function() { return this.polyad(3); }, e.prototype.tetrad = function() { return this.polyad(4); }, e.prototype.polyad = function(r) { for (var t = this.toHsl(), n = t.h, a = [this], i = 360 / r, o = 1; o < r; o++) a.push(new e({ h: (n + o * i) % 360, s: t.s, l: t.l })); return a; }, e.prototype.equals = function(r) { return this.toRgbString() === new e(r).toRgbString(); }, e; }() ); function On(e, r = 20) { return e.mix("#141414", r).toString(); } function XE(e) { const r = Ns(), t = Dr("button"); return ue(() => { let n = {}, a = e.color; if (a) { const i = a.match(/var\((.*?)\)/); i && (a = window.getComputedStyle(window.document.documentElement).getPropertyValue(i[1])); const o = new jE(a), l = e.dark ? o.tint(20).toString() : On(o, 20); if (e.plain) n = t.cssVarBlock({ "bg-color": e.dark ? On(o, 90) : o.tint(90).toString(), "text-color": a, "border-color": e.dark ? On(o, 50) : o.tint(50).toString(), "hover-text-color": `var(${t.cssVarName("color-white")})`, "hover-bg-color": a, "hover-border-color": a, "active-bg-color": l, "active-text-color": `var(${t.cssVarName("color-white")})`, "active-border-color": l }), r.value && (n[t.cssVarBlockName("disabled-bg-color")] = e.dark ? On(o, 90) : o.tint(90).toString(), n[t.cssVarBlockName("disabled-text-color")] = e.dark ? On(o, 50) : o.tint(50).toString(), n[t.cssVarBlockName("disabled-border-color")] = e.dark ? On(o, 80) : o.tint(80).toString()); else { const u = e.dark ? On(o, 30) : o.tint(30).toString(), s = o.isDark() ? `var(${t.cssVarName("color-white")})` : `var(${t.cssVarName("color-black")})`; if (n = t.cssVarBlock({ "bg-color": a, "text-color": s, "border-color": a, "hover-bg-color": u, "hover-text-color": s, "hover-border-color": u, "active-bg-color": l, "active-border-color": l }), r.value) { const c = e.dark ? On(o, 50) : o.tint(50).toString(); n[t.cssVarBlockName("disabled-bg-color")] = c, n[t.cssVarBlockName("disabled-text-color")] = e.dark ? "rgba(255, 255, 255, 0.5)" : `var(${t.cssVarName("color-white")})`, n[t.cssVarBlockName("disabled-border-color")] = c; } } } return n; }); } const QE = Re({ name: "ElButton" }), eS = /* @__PURE__ */ Re({ ...QE, props: Ou, emits: zE, setup(e, { expose: r, emit: t }) { const n = e, a = XE(n), i = Dr("button"), { _ref: o, _size: l, _type: u, _disabled: s, _props: c, shouldAddSpace: f, handleClick: d } = IE(n, t), p = ue(() => [ i.b(), i.m(u.value), i.m(l.value), i.is("disabled", s.value), i.is("loading", n.loading), i.is("plain", n.plain), i.is("round", n.round), i.is("circle", n.circle), i.is("text", n.text), i.is("link", n.link), i.is("has-bg", n.bg) ]); return r({ ref: o, size: l, type: u, disabled: s, shouldAddSpace: f }), (m, v) => (he(), He(Lt(m.tag), Zn({ ref_key: "_ref", ref: o }, U(c), { class: U(p), style: U(a), onClick: U(d) }), { default: Ve(() => [ m.loading ? (he(), Ce(nt, { key: 0 }, [ m.$slots.loading ? Xe(m.$slots, "loading", { key: 0 }) : (he(), He(U(Ct), { key: 1, class: _e(U(i).is("loading")) }, { default: Ve(() => [ (he(), He(Lt(m.loadingIcon))) ]), _: 1 }, 8, ["class"])) ], 64)) : m.icon || m.$slots.icon ? (he(), He(U(Ct), { key: 1 }, { default: Ve(() => [ m.icon ? (he(), He(Lt(m.icon), { key: 0 })) : Xe(m.$slots, "icon", { key: 1 }) ]), _: 3 })) : Be("v-if", !0), m.$slots.default ? (he(), Ce("span", { key: 2, class: _e({ [U(i).em("text", "expand")]: U(f) }) }, [ Xe(m.$slots, "default") ], 2)) : Be("v-if", !0) ]), _: 3 }, 16, ["class", "style", "onClick"])); } }); var rS = /* @__PURE__ */ Sr(eS, [["__file", "button.vue"]]); const tS = { size: Ou.size, type: Ou.type }, nS = Re({ name: "ElButtonGroup" }), aS = /* @__PURE__ */ Re({ ...nS, props: tS, setup(e) { const r = e; Ft(E0, Vt({ size: qt(r, "size"), type: qt(r, "type") })); const t = Dr("button"); return (n, a) => (he(), Ce("div", { class: _e(U(t).b("group")) }, [ Xe(n.$slots, "default") ], 2)); } }); var C0 = /* @__PURE__ */ Sr(aS, [["__file", "button-group.vue"]]); const M0 = Bt(rS, { ButtonGroup: C0 }); ml(C0); var xa = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function Es(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } function iS(e) { if (e.__esModule) return e; var r = e.default; if (typeof r == "function") { var t = function n() { return this instanceof n ? Reflect.construct(r, arguments, this.constructor) : r.apply(this, arguments); }; t.prototype = r.prototype; } else t = {}; return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(n) { var a = Object.getOwnPropertyDescriptor(e, n); Object.defineProperty(t, n, a.get ? a : { enumerable: !0, get: function() { return e[n]; } }); }), t; } const Rn = /* @__PURE__ */ new Map(); if (Ir) { let e; document.addEventListener("mousedown", (r) => e = r), document.addEventListener("mouseup", (r) => { if (e) { for (const t of Rn.values()) for (const { documentHandler: n } of t) n(r, e); e = void 0; } }); } function Of(e, r) { let t = []; return Array.isArray(r.arg) ? t = r.arg : la(r.arg) && t.push(r.arg), function(n, a) { const i = r.instance.popperRef, o = n.target, l = a == null ? void 0 : a.target, u = !r || !r.instance, s = !o || !l, c = e.contains(o) || e.contains(l), f = e === o, d = t.length && t.some((m) => m == null ? void 0 : m.contains(o)) || t.length && t.includes(l), p = i && (i.contains(o) || i.contains(l)); u || s || c || f || d || p || r.value(n, a); }; } const oS = { beforeMount(e, r) { Rn.has(e) || Rn.set(e, []), Rn.get(e).push({ documentHandler: Of(e, r), bindingFn: r.value }); }, updated(e, r) { Rn.has(e) || Rn.set(e, []); const t = Rn.get(e), n = t.findIndex((i) => i.bindingFn === r.oldValue), a = { documentHandler: Of(e, r), bindingFn: r.value }; n >= 0 ? t.splice(n, 1, a) : t.push(a); }, unmounted(e) { Rn.delete(e); } }, sS = 100, uS = 600, Bf = { beforeMount(e, r) { const t = r.value, { interval: n = sS, delay: a = uS } = Xr(t) ? {} : t; let i, o; const l = () => Xr(t) ? t() : t.handler(), u = () => { o && (clearTimeout(o), o = void 0), i && (clearInterval(i), i = void 0); }; e.addEventListener("mousedown", (s) => { s.button === 0 && (u(), l(), document.addEventListener("mouseup", () => u(), { once: !0 }), o = setTimeout(() => { i = setInterval(() => { l(); }, n); }, a)); }); } }, $u = Er({ type: { type: String, values: ["primary", "success", "info", "warning", "danger"], default: "primary" }, closable: Boolean, disableTransitions: Boolean, hit: Boolean, color: String, size: { type: String, values: Hh }, effect: { type: String, values: ["dark", "light", "plain"], default: "light" }, round: Boolean }), lS = { close: (e) => e instanceof MouseEvent, click: (e) => e instanceof MouseEvent }, cS = Re({ name: "ElTag" }), fS = /* @__PURE__ */ Re({ ...cS, props: $u, emits: lS, setup(e, { emit: r }) { const t = e, n = si(), a = Dr("tag"), i = ue(() => { const { type: s, hit: c, effect: f, closable: d, round: p } = t; return [ a.b(), a.is("closable", d), a.m(s || "primary"), a.m(n.value), a.m(f), a.is("hit", c), a.is("round", p) ]; }), o = (s) => { r("close", s); }, l = (s) => { r("click", s); }, u = (s) => { s.component.subTree.component.bum = null; }; return (s, c) => s.disableTransitions ? (he(), Ce("span", { key: 0, class: _e(U(i)), style: Lr({ backgroundColor: s.color }), onClick: l }, [ $e("span", { class: _e(U(a).e("content")) }, [ Xe(s.$slots, "default") ], 2), s.closable ? (he(), He(U(Ct), { key: 0, class: _e(U(a).e("close")), onClick: kr(o, ["stop"]) }, { default: Ve(() => [ mr(U(rf)) ]), _: 1 }, 8, ["class", "onClick"])) : Be("v-if", !0) ], 6)) : (he(), He(fs, { key: 1, name: `${U(a).namespace.value}-zoom-in-center`, appear: "", onVnodeMounted: u }, { default: Ve(() => [ $e("span", { class: _e(U(i)), style: Lr({ backgroundColor: s.color }), onClick: l }, [ $e("span", { class: _e(U(a).e("content")) }, [ Xe(s.$slots, "default") ], 2), s.closable ? (he(), He(U(Ct), { key: 0, class: _e(U(a).e("close")), onClick: kr(o, ["stop"]) }, { default: Ve(() => [ mr(U(rf)) ]), _: 1 }, 8, ["class", "onClick"])) : Be("v-if", !0) ], 6) ]), _: 3 }, 8, ["name"])); } }); var dS = /* @__PURE__ */ Sr(fS, [["__file", "tag.vue"]]); const pS = Bt(dS), mS = Er({ direction: { type: String, values: ["horizontal", "vertical"], default: "horizontal" }, contentPosition: { type: String, values: ["left", "center", "right"], default: "center" }, borderStyle: { type: rr(String), default: "solid" } }), vS = Re({ name: "ElDivider" }), hS = /* @__PURE__ */ Re({ ...vS, props: mS, setup(e) { const r = e, t = Dr("divider"), n = ue(() => t.cssVar({ "border-style": r.borderStyle })); return (a, i) => (he(), Ce("div", { class: _e([U(t).b(), U(t).m(a.direction)]), style: Lr(U(n)), role: "separator" }, [ a.$slots.default && a.direction !== "vertical" ? (he(), Ce("div", { key: 0, class: _e([U(t).e("text"), U(t).is(a.contentPosition)]) }, [ Xe(a.$slots, "default") ], 2)) : Be("v-if", !0) ], 6)); } }); var gS = /* @__PURE__ */ Sr(hS, [["__file", "divider.vue"]]); const _0 = Bt(gS), yS = Er({ id: { type: String, default: void 0 }, step: { type: Number, default: 1 }, stepStrictly: Boolean, max: { type: Number, default: Number.POSITIVE_INFINITY }, min: { type: Number, default: Number.NEGATIVE_INFINITY }, modelValue: Number, readonly: Boolean, disabled: Boolean, size: ja, controls: { type: Boolean, default: !0 }, controlsPosition: { type: String, default: "", values: ["", "right"] }, valueOnClear: { type: [String, Number, null], validator: (e) => e === null || Nr(e) || ["min", "max"].includes(e), default: null }, name: String, placeholder: String, precision: { type: Number, validator: (e) => e >= 0 && e === Number.parseInt(`${e}`, 10) }, validateEvent: { type: Boolean, default: !0 }, ...wa(["ariaLabel"]) }), bS = { [ii]: (e, r) => r !== e, blur: (e) => e instanceof FocusEvent, focus: (e) => e instanceof FocusEvent, [ca]: (e) => Nr(e) || An(e), [Or]: (e) => Nr(e) || An(e) }, wS = Re({ name: "ElInputNumber" }), xS = /* @__PURE__ */ Re({ ...wS, props: yS, emits: bS, setup(e, { expose: r, emit: t }) { const n = e, { t: a } = ws(), i = Dr("input-number"), o = Se(), l = Vt({ currentValue: n.modelValue, userInput: null }), { formItem: u } = Zi(), s = ue(() => Nr(n.modelValue) && n.modelValue <= n.min), c = ue(() => Nr(n.modelValue) && n.modelValue >= n.max), f = ue(() => { const B = y(n.step); return yn(n.precision) ? Math.max(y(n.modelValue), B) : (B > n.precision && Tr("InputNumber", "precision should not be less than the decimal places of step"), n.precision); }), d = ue(() => n.controls && n.controlsPosition === "right"), p = si(), m = Ns(), v = ue(() => { if (l.userInput !== null) return l.userInput; let B = l.currentValue; if (An(B)) return ""; if (Nr(B)) { if (Number.isNaN(B)) return ""; yn(n.precision) || (B = B.toFixed(n.precision)); } return B; }), b = (B, C) => { if (yn(C) && (C = f.value), C === 0) return Math.round(B); let _ = String(B); const z = _.indexOf("."); if (z === -1 || !_.replace(".", "").split("")[z + C]) return B; const X = _.length; return _.charAt(X - 1) === "5" && (_ = `${_.slice(0, Math.max(0, X - 1))}6`), Number.parseFloat(Number(_).toFixed(C)); }, y = (B) => { if (An(B)) return 0; const C = B.toString(), _ = C.indexOf("."); let z = 0; return _ !== -1 && (z = C.length - _ - 1), z; }, A = (B, C = 1) => Nr(B) ? b(B + n.step * C) : l.currentValue, h = () => { if (n.readonly || m.value || c.value) return; const B = Number(v.value) || 0, C = A(B); g(C), t(ca, l.currentValue), $(); }, x = () => { if (n.readonly || m.value || s.value) return; const B = Number(v.value) || 0, C = A(B, -1); g(C), t(ca, l.currentValue), $(); }, w = (B, C) => { const { max: _, min: z, step: O, precision: W, stepStrictly: X, valueOnClear: V } = n; _ < z && dl("InputNumber", "min should not be greater than max."); let R = Number(B); if (An(B) || Number.isNaN(R)) return null; if (B === "") { if (V === null) return null; R = wt(V) ? { min: z, max: _ }[V] : V; } return X && (R = b(Math.round(R / O) * O, W), R !== B && C && t(Or, R)), yn(W) || (R = b(R, W)), (R > _ || R < z) && (R = R > _ ? _ : z, C && t(Or, R)), R; }, g = (B, C = !0) => { var _; const z = l.currentValue, O = w(B); if (!C) { t(Or, O); return; } z === O && B || (l.userInput = null, t(Or, O), z !== O && t(ii, O, z), n.validateEvent && ((_ = u == null ? void 0 : u.validate) == null || _.call(u, "change").catch((W) => Tr(W))), l.currentValue = O); }, D = (B) => { l.userInput = B; const C = B === "" ? null : Number(B); t(ca, C), g(C, !1); }, E = (B) => { const C = B !== "" ? Number(B) : ""; (Nr(C) && !Number.isNaN(C) || B === "") && g(C), $(), l.userInput = null; }, N = () => { var B, C; (C = (B = o.value) == null ? void 0 : B.focus) == null || C.call(B); }, S = () => { var B, C; (C = (B = o.value) == null ? void 0 : B.blur) == null || C.call(B); }, M = (B) => { t("focus", B); }, F = (B) => { var C; l.userInput = null, t("blur", B), n.validateEvent && ((C = u == null ? void 0 : u.validate) == null || C.call(u, "blur").catch((_) => Tr(_))); }, $ = () => { l.currentValue !== n.modelValue && (l.currentValue = n.modelValue); }, I = (B) => { document.activeElement === B.target && B.preventDefault(); }; return er(() => n.modelValue, (B, C) => { const _ = w(B, !0); l.userInput === null && _ !== C && (l.currentValue = _); }, { immediate: !0 }), Wr(() => { var B; const { min: C, max: _, modelValue: z } = n, O = (B = o.value) == null ? void 0 : B.input; if (O.setAttribute("role", "spinbutton"), Number.isFinite(_) ? O.setAttribute("aria-valuemax", String(_)) : O.removeAttribute("aria-valuemax"), Number.isFinite(C) ? O.setAttribute("aria-valuemin", String(C)) : O.removeAttribute("aria-valuemin"), O.setAttribute("aria-valuenow", l.currentValue || l.currentValue === 0 ? String(l.currentValue) : ""), O.setAttribute("aria-disabled", String(m.value)), !Nr(z) && z != null) { let W = Number(z); Number.isNaN(W) && (W = null), t(Or, W); } O.addEventListener("wheel", I, { passive: !1 }); }), vh(() => { var B, C; const _ = (B = o.value) == null ? void 0 : B.input; _ == null || _.setAttribute("aria-valuenow", `${(C = l.currentValue) != null ? C : ""}`); }), r({ focus: N, blur: S }), (B, C) => (he(), Ce("div", { class: _e([ U(i).b(), U(i).m(U(p)), U(i).is("disabled", U(m)), U(i).is("without-controls", !B.controls), U(i).is("controls-right", U(d)) ]), onDragstart: kr(() => { }, ["prevent"]) }, [ B.controls ? at((he(), Ce("span", { key: 0, role: "button", "aria-label": U(a)("el.inputNumber.decrease"), class: _e([U(i).e("decrease"), U(i).is("disabled", U(s))]), onKeydown: vn(x, ["enter"]) }, [ Xe(B.$slots, "decrease-icon", {}, () => [ mr(U(Ct), null, { default: Ve(() => [ U(d) ? (he(), He(U(Lh), { key: 0 })) : (he(), He(U(vA), { key: 1 })) ]), _: 1 }) ]) ], 42, ["aria-label", "onKeydown"])), [ [U(Bf), x] ]) : Be("v-if", !0), B.controls ? at((he(), Ce("span", { key: 1, role: "button", "aria-label": U(a)("el.inputNumber.increase"), class: _e([U(i).e("increase"), U(i).is("disabled", U(c))]), onKeydown: vn(h, ["enter"]) }, [ Xe(B.$slots, "increase-icon", {}, () => [ mr(U(Ct), null, { default: Ve(() => [ U(d) ? (he(), He(U(oA), { key: 0 })) : (he(), He(U(gA), { key: 1 })) ]), _: 1 }) ]) ], 42, ["aria-label", "onKeydown"])), [ [U(Bf), h] ]) : Be("v-if", !0), mr(U(hD), { id: B.id, ref_key: "input", ref: o, type: "number", step: B.step, "model-value": U(v), placeholder: B.placeholder, readonly: B.readonly, disabled: U(m), size: U(p), max: B.max, min: B.min, name: B.name, "aria-label": B.ariaLabel, "validate-event": !1, onKeydown: [ vn(kr(h, ["prevent"]), ["up"]), vn(kr(x, ["prevent"]), ["down"]) ], onBlur: F, onFocus: M, onInput: D, onChange: E }, $1({ _: 2 }, [ B.$slots.prefix ? { name: "prefix", fn: Ve(() => [ Xe(B.$slots, "prefix") ]) } : void 0, B.$slots.suffix ? { name: "suffix", fn: Ve(() => [ Xe(B.$slots, "suffix") ]) } : void 0 ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"]) ], 42, ["onDragstart"])); } }); var AS = /* @__PURE__ */ Sr(xS, [["__file", "input-number.vue"]]); const Bl = Bt(AS), F0 = Symbol("ElSelectGroup"), Ss = Symbol("ElSelect"); function NS(e, r) { const t = vr(Ss), n = vr(F0, { disabled: !1 }), a = ue(() => c(Ln(t.props.modelValue), e.value)), i = ue(() => { var p; if (t.props.multiple) { const m = Ln((p = t.props.modelValue) != null ? p : []); return !a.value && m.length >= t.props.multipleLimit && t.props.multipleLimit > 0; } else return !1; }), o = ue(() => e.label || (dt(e.value) ? "" : e.value)), l = ue(() => e.value || e.label || ""), u = ue(() => e.disabled || r.groupDisabled || i.value), s = ot(), c = (p = [], m) => { if (dt(e.value)) { const v = t.props.valueKey; return p && p.some((b) => gh(hn(b, v)) === hn(m, v)); } else return p && p.includes(m); }, f = () => { !e.disabled && !n.disabled && (t.states.hoveringIndex = t.optionsArray.indexOf(s.proxy)); }, d = (p) => { const m = new RegExp(rA(p), "i"); r.visible = m.test(o.value) || e.created; }; return er(() => o.value, () => { !e.created && !t.props.remote && t.setSelected(); }), er(() => e.value, (p, m) => { const { remote: v, valueKey: b } = t.props; if (p !== m && (t.onOptionDestroy(m, s.proxy), t.onOptionCreate(s.proxy)), !e.created && !v) { if (b && dt(p) && dt(m) && p[b] === m[b]) return; t.setSelected(); } }), er(() => n.disabled, () => { r.groupDisabled = n.disabled; }, { immediate: !0 }), { select: t, currentLabel: o, currentValue: l, itemSelected: a, isDisabled: u, hoverItem: f, updateOption: d }; } const DS = Re({ name: "ElOption", componentName: "ElOption", props: { value: { required: !0, type: [String, Number, Boolean, Object] }, label: [String, Number], created: Boolean, disabled: Boolean }, setup(e) { const r = Dr("select"), t = As(), n = ue(() => [ r.be("dropdown", "item"), r.is("disabled", U(l)), r.is("selected", U(o)), r.is("hovering", U(d)) ]), a = Vt({ index: -1, groupDisabled: !1, visible: !0, hover: !1 }), { currentLabel: i, itemSelected: o, isDisabled: l, select: u, hoverItem: s, updateOption: c } = NS(e, a), { visible: f, hover: d } = ma(a), p = ot().proxy; u.onOptionCreate(p), nn(() => { const v = p.value, { selected: b } = u.states, A = (u.props.multiple ? b : [b]).some((h) => h.value === p.value); Cr(() => { u.states.cachedOptions.get(v) === p && !A && u.states.cachedOptions.delete(v); }), u.onOptionDestroy(v, p); }); function m() { l.value || u.handleOptionSelect(p); } return { ns: r, id: t, containerKls: n, currentLabel: i, itemSelected: o, isDisabled: l, select: u, hoverItem: s, updateOption: c, visible: f, hover: d, selectOptionClick: m, states: a }; } }); function ES(e, r, t, n, a, i) { return at((he(), Ce("li", { id: e.id, class: _e(e.containerKls), role: "option", "aria-disabled": e.isDisabled || void 0, "aria-selected": e.itemSelected, onMouseenter: e.hoverItem, onClick: kr(e.selectOptionClick, ["stop"]) }, [ Xe(e.$slots, "default", {}, () => [ $e("span", null, qr(e.currentLabel), 1) ]) ], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [ [Nn, e.visible] ]); } var $l = /* @__PURE__ */ Sr(DS, [["render", ES], ["__file", "option.vue"]]); const SS = Re({ name: "ElSelectDropdown", componentName: "ElSelectDropdown", setup() { const e = vr(Ss), r = Dr("select"), t = ue(() => e.props.popperClass), n = ue(() => e.props.multiple), a = ue(() => e.props.fitInputWidth), i = Se(""); function o() { var l; i.value = `${(l = e.selectRef) == null ? void 0 : l.offsetWidth}px`; } return Wr(() => { o(), mn(e.selectRef, o); }), { ns: r, minWidth: i, popperClass: t, isMultiple: n, isFitInputWidth: a }; } }); function CS(e, r, t, n, a, i) { return he(), Ce("div", { class: _e([e.ns.b("dropdown"), e.ns.is("multiple", e.isMultiple), e.popperClass]), style: Lr({ [e.isFitInputWidth ? "width" : "minWidth"]: e.minWidth }) }, [ e.$slots.header ? (he(), Ce("div", { key: 0, class: _e(e.ns.be("dropdown", "header")) }, [ Xe(e.$slots, "header") ], 2)) : Be("v-if", !0), Xe(e.$slots, "default"), e.$slots.footer ? (he(), Ce("div", { key: 1, class: _e(e.ns.be("dropdown", "footer")) }, [ Xe(e.$slots, "footer") ], 2)) : Be("v-if", !0) ], 6); } var MS = /* @__PURE__ */ Sr(SS, [["render", CS], ["__file", "select-dropdown.vue"]]); const _S = 11, FS = (e, r) => { const { t } = ws(), n = As(), a = Dr("select"), i = Dr("input"), o = Vt({ inputValue: "", options: /* @__PURE__ */ new Map(), cachedOptions: /* @__PURE__ */ new Map(), disabledOptions: /* @__PURE__ */ new Map(), optionValues: [], selected: [], selectionWidth: 0, calculatorWidth: 0, collapseItemWidth: 0, selectedLabel: "", hoveringIndex: -1, previousQuery: null, inputHovering: !1, menuVisibleOnFocus: !1, isBeforeHide: !1 }), l = Se(null), u = Se(null), s = Se(null), c = Se(null), f = Se(null), d = Se(null), p = Se(null), m = Se(null), v = Se(null), b = Se(null), y = Se(null), A = Se(null), { isComposing: h, handleCompositionStart: x, handleCompositionUpdate: w, handleCompositionEnd: g } = p0({ afterComposition: (ce) => fe(ce) }), { wrapperRef: D, isFocused: E } = d0(f, { beforeFocus() { return C.value; }, afterFocus() { e.automaticDropdown && !N.value && (N.value = !0, o.menuVisibleOnFocus = !0); }, beforeBlur(ce) { var Me, tr; return ((Me = s.value) == null ? void 0 : Me.isFocusInsideContent(ce)) || ((tr = c.value) == null ? void 0 : tr.isFocusInsideContent(ce)); }, afterBlur() { N.value = !1, o.menuVisibleOnFocus = !1; } }), N = Se(!1), S = Se(), { form: M, formItem: F } = Zi(), { inputId: $ } = Sl(e, { formItemContext: F }), { valueOnClear: I, isEmptyValue: B } = QN(e), C = ue(() => e.disabled || (M == null ? void 0 : M.disabled)), _ = ue(() => Yt(e.modelValue) ? e.modelValue.length > 0 : !B(e.modelValue)), z = ue(() => e.clearable && !C.value && o.inputHovering && _.value), O = ue(() => e.remote && e.filterable && !e.remoteShowSuffix ? "" : e.suffixIcon), W = ue(() => a.is("reverse", O.value && N.value)), X = ue(() => (F == null ? void 0 : F.validateState) || ""), V = ue(() => Vh[X.value]), R = ue(() => e.remote ? 300 : 0), Q = ue(() => e.loading ? e.loadingText || t("el.select.loading") : e.remote && !o.inputValue && o.options.size === 0 ? !1 : e.filterable && o.inputValue && o.options.size > 0 && se.value === 0 ? e.noMatchText || t("el.select.noMatch") : o.options.size === 0 ? e.noDataText || t("el.select.noData") : null), se = ue(() => re.value.filter((ce) => ce.visible).length), re = ue(() => { const ce = Array.from(o.options.values()), Me = []; return o.optionValues.forEach((tr) => { const hr = ce.findIndex((Jt) => Jt.value === tr); hr > -1 && Me.push(ce[hr]); }), Me.length >= ce.length ? Me : ce; }), q = ue(() => Array.from(o.cachedOptions.values())), Z = ue(() => { const ce = re.value.filter((Me) => !Me.created).some((Me) => Me.currentLabel === o.inputValue); return e.filterable && e.allowCreate && o.inputValue !== "" && !ce; }), K = () => { e.filterable && Xr(e.filterMethod) || e.filterable && e.remote && Xr(e.remoteMethod) || re.value.forEach((ce) => { var Me; (Me = ce.updateOption) == null || Me.call(ce, o.inputValue); }); }, j = si(), ee = ue(() => ["small"].includes(j.value) ? "small" : "default"), te = ue({ get() { return N.value && Q.value !== !1; }, set(ce) { N.value = ce; } }), oe = ue(() => { if (e.multiple && !yn(e.modelValue)) return Ln(e.modelValue).length === 0 && !o.inputValue; const ce = Yt(e.modelValue) ? e.modelValue[0] : e.modelValue; return e.filterable || yn(ce) ? !o.inputValue : !0; }), ge = ue(() => { var ce; const Me = (ce = e.placeholder) != null ? ce : t("el.select.placeholder"); return e.multiple || !_.value ? Me : o.selectedLabel; }), L = ue(() => wu ? null : "mouseenter"); er(() => e.modelValue, (ce, Me) => { e.multiple && e.filterable && !e.reserveKeyword && (o.inputValue = "", H("")), ie(), !Cu(ce, Me) && e.validateEvent && (F == null || F.validate("change").catch((tr) => Tr(tr))); }, { flush: "post", deep: !0 }), er(() => N.value, (ce) => { ce ? H(o.inputValue) : (o.inputValue = "", o.previousQuery = null, o.isBeforeHide = !0), r("visible-change", ce); }), er(() => o.options.entries(), () => { var ce; if (!Ir) return; const Me = ((ce = l.value) == null ? void 0 : ce.querySelectorAll("input")) || []; (!e.filterable && !e.defaultFirstOption && !yn(e.modelValue) || !Array.from(Me).includes(document.activeElement)) && ie(), e.defaultFirstOption && (e.filterable || e.remote) && se.value && ne(); }, { flush: "post" }), er(() => o.hoveringIndex, (ce) => { Nr(ce) && ce > -1 ? S.value = re.value[ce] || {} : S.value = {}, re.value.forEach((Me) => { Me.hover = S.value === Me; }); }), I1(() => { o.isBeforeHide || K(); }); const H = (ce) => { o.previousQuery === ce || h.value || (o.previousQuery = ce, e.filterable && Xr(e.filterMethod) ? e.filterMethod(ce) : e.filterable && e.remote && Xr(e.remoteMethod) && e.remoteMethod(ce), e.defaultFirstOption && (e.filterable || e.remote) && se.value ? Cr(ne) : Cr(pe)); }, ne = () => { const ce = re.value.filter((hr) => hr.visible && !hr.disabled && !hr.states.groupDisabled), Me = ce.find((hr) => hr.created), tr = ce[0]; o.hoveringIndex = Ue(re.value, Me || tr); }, ie = () => { if (e.multiple) o.selectedLabel = ""; else { const Me = Yt(e.modelValue) ? e.modelValue[0] : e.modelValue, tr = me(Me); o.selectedLabel = tr.currentLabel, o.selected = [tr]; return; } const ce = []; yn(e.modelValue) || Ln(e.modelValue).forEach((Me) => { ce.push(me(Me)); }), o.selected = ce; }, me = (ce) => { let Me; const tr = Ys(ce).toLowerCase() === "object", hr = Ys(ce).toLowerCase() === "null", Jt = Ys(ce).toLowerCase() === "undefined"; for (let un = o.cachedOptions.size - 1; un >= 0; un--) { const Dt = q.value[un]; if (tr ? hn(Dt.value, e.valueKey) === hn(ce, e.valueKey) : Dt.value === ce) { Me = { value: ce, currentLabel: Dt.currentLabel, get isDisabled() { return Dt.isDisabled; } }; break; } } if (Me) return Me; const Tn = tr ? ce.label : !hr && !Jt ? ce : ""; return { value: ce, currentLabel: Tn }; }, pe = () => { o.hoveringIndex = re.value.findIndex((ce) => o.selected.some((Me) => hi(Me) === hi(ce))); }, xe = () => { o.selectionWidth = u.value.getBoundingClientRect().width; }, De = () => { o.calculatorWidth = d.value.getBoundingClientRect().width; }, k = () => { o.collapseItemWidth = y.value.getBoundingClientRect().width; }, J = () => { var ce, Me; (Me = (ce = s.value) == null ? void 0 : ce.updatePopper) == null || Me.call(ce); }, G = () => { var ce, Me; (Me = (ce = c.value) == null ? void 0 : ce.updatePopper) == null || Me.call(ce); }, ae = () => { o.inputValue.length > 0 && !N.value && (N.value = !0), H(o.inputValue); }, fe = (ce) => { if (o.inputValue = ce.target.value, e.remote) de(); else return ae(); }, de = Su(() => { ae(); }, R.value), Ne = (ce) => { Cu(e.modelValue, ce) || r(ii, ce); }, we = (ce) => K2(ce, (Me) => !o.disabledOptions.has(Me)), Ee = (ce) => { if (e.multiple && ce.code !== Za.delete && ce.target.value.length <= 0) { const Me = Ln(e.modelValue).slice(), tr = we(Me); if (tr < 0) return; const hr = Me[tr]; Me.splice(tr, 1), r(Or, Me), Ne(Me), r("remove-tag", hr); } }, Ae = (ce, Me) => { const tr = o.selected.indexOf(Me); if (tr > -1 && !C.value) { const hr = Ln(e.modelValue).slice(); hr.splice(tr, 1), r(Or, hr), Ne(hr), r("remove-tag", Me.value); } ce.stopPropagation(), Pe(); }, ar = (ce) => { ce.stopPropagation(); const Me = e.multiple ? [] : I.value; if (e.multiple) for (const tr of o.selected) tr.isDisabled && Me.push(tr.value); r(Or, Me), Ne(Me), o.hoveringIndex = -1, N.value = !1, r("clear"), Pe(); }, ir = (ce) => { var Me; if (e.multiple) { const tr = Ln((Me = e.modelValue) != null ? Me : []).slice(), hr = Ue(tr, ce.value); hr > -1 ? tr.splice(hr, 1) : (e.multipleLimit <= 0 || tr.length < e.multipleLimit) && tr.push(ce.value), r(Or, tr), Ne(tr), ce.created && H(""), e.filterable && !e.reserveKeyword && (o.inputValue = ""); } else r(Or, ce.value), Ne(ce.value), N.value = !1; Pe(), !N.value && Cr(() => { xr(ce); }); }, Ue = (ce = [], Me) => { if (!dt(Me)) return ce.indexOf(Me); const tr = e.valueKey; let hr = -1; return ce.some((Jt, Tn) => gh(hn(Jt, tr)) === hn(Me, tr) ? (hr = Tn, !0) : !1), hr; }, xr = (ce) => { var Me, tr, hr, Jt, Tn; const Sa = Yt(ce) ? ce[0] : ce; let un = null; if (Sa != null && Sa.value) { const Dt = re.value.filter((Qi) => Qi.value === Sa.value); Dt.length > 0 && (un = Dt[0].$el); } if (s.value && un) { const Dt = (Jt = (hr = (tr = (Me = s.value) == null ? void 0 : Me.popperRef) == null ? void 0 : tr.contentRef) == null ? void 0 : hr.querySelector) == null ? void 0 : Jt.call(hr, `.${a.be("dropdown", "wrap")}`); Dt && nA(Dt, un); } (Tn = A.value) == null || Tn.handleScroll(); }, T = (ce) => { o.options.set(ce.value, ce), o.cachedOptions.set(ce.value, ce), ce.disabled && o.disabledOptions.set(ce.value, ce); }, Y = (ce, Me) => { o.options.get(ce) === Me && o.options.delete(ce); }, le = ue(() => { var ce, Me; return (Me = (ce = s.value) == null ? void 0 : ce.popperRef) == null ? void 0 : Me.contentRef; }), be = () => { o.isBeforeHide = !1, Cr(() => xr(o.selected)); }, Pe = () => { var ce; (ce = f.value) == null || ce.focus(); }, Ge = () => { var ce; (ce = f.value) == null || ce.blur(); }, rt = (ce) => { ar(ce); }, vi = () => { N.value = !1, E.value && Ge(); }, Ls = () => { o.inputValue.length > 0 ? o.inputValue = "" : N.value = !1; }, ji = () => { C.value || (wu && (o.inputHovering = !0), o.menuVisibleOnFocus ? o.menuVisibleOnFocus = !1 : N.value = !N.value); }, Us = () => { N.value ? re.value[o.hoveringIndex] && ir(re.value[o.hoveringIndex]) : ji(); }, hi = (ce) => dt(ce.value) ? hn(ce.value, e.valueKey) : ce.value, ks = ue(() => re.value.filter((ce) => ce.visible).every((ce) => ce.disabled)), Vs = ue(() => e.multiple ? e.collapseTags ? o.selected.slice(0, e.maxCollapseTags) : o.selected : []), Hs = ue(() => e.multiple ? e.collapseTags ? o.selected.slice(e.maxCollapseTags) : [] : []), Xi = (ce) => { if (!N.value) { N.value = !0; return; } if (!(o.options.size === 0 || o.filteredOptionsCount === 0 || h.value) && !ks.value) { ce === "next" ? (o.hoveringIndex++, o.hoveringIndex === o.options.size && (o.hoveringIndex = 0)) : ce === "prev" && (o.hoveringIndex--, o.hoveringIndex < 0 && (o.hoveringIndex = o.options.size - 1)); const Me = re.value[o.hoveringIndex]; (Me.disabled === !0 || Me.states.groupDisabled === !0 || !Me.visible) && Xi(ce), Cr(() => xr(S.value)); } }, Zs = () => { if (!u.value) return 0; const ce = window.getComputedStyle(u.value); return Number.parseFloat(ce.gap || "6px"); }, Gs = ue(() => { const ce = Zs(); return { maxWidth: `${y.value && e.maxCollapseTags === 1 ? o.selectionWidth - o.collapseItemWidth - ce : o.selectionWidth}px` }; }), Ws = ue(() => ({ maxWidth: `${o.selectionWidth}px` })), Ks = ue(() => ({ width: `${Math.max(o.calculatorWidth, _S)}px` })); return mn(u, xe), mn(d, De), mn(v, J), mn(D, J), mn(b, G), mn(y, k), Wr(() => { ie(); }), { inputId: $, contentId: n, nsSelect: a, nsInput: i, states: o, isFocused: E, expanded: N, optionsArray: re, hoverOption: S, selectSize: j, filteredOptionsCount: se, resetCalculatorWidth: De, updateTooltip: J, updateTagTooltip: G, debouncedOnInputChange: de, onInput: fe, deletePrevTag: Ee, deleteTag: Ae, deleteSelected: ar, handleOptionSelect: ir, scrollToOption: xr, hasModelValue: _, shouldShowPlaceholder: oe, currentPlaceholder: ge, mouseEnterEventName: L, showClose: z, iconComponent: O, iconReverse: W, validateState: X, validateIcon: V, showNewOption: Z, updateOptions: K, collapseTagSize: ee, setSelected: ie, selectDisabled: C, emptyText: Q, handleCompositionStart: x, handleCompositionUpdate: w, handleCompositionEnd: g, onOptionCreate: T, onOptionDestroy: Y, handleMenuEnter: be, focus: Pe, blur: Ge, handleClearClick: rt, handleClickOutside: vi, handleEsc: Ls, toggleMenu: ji, selectOption: Us, getValueKey: hi, navigateOptions: Xi, dropdownMenuVisible: te, showTagList: Vs, collapseTagList: Hs, tagStyle: Gs, collapseTagStyle: Ws, inputStyle: Ks, popperRef: le, inputRef: f, tooltipRef: s, tagTooltipRef: c, calculatorRef: d, prefixRef: p, suffixRef: m, selectRef: l, wrapperRef: D, selectionRef: u, scrollbarRef: A, menuRef: v, tagMenuRef: b, collapseItemRef: y }; }; var TS = Re({ name: "ElOptions", setup(e, { slots: r }) { const t = vr(Ss); let n = []; return () => { var a, i; const o = (a = r.default) == null ? void 0 : a.call(r), l = []; function u(s) { Yt(s) && s.forEach((c) => { var f, d, p, m; const v = (f = (c == null ? void 0 : c.type) || {}) == null ? void 0 : f.name; v === "ElOptionGroup" ? u(!wt(c.children) && !Yt(c.children) && Xr((d = c.children) == null ? void 0 : d.default) ? (p = c.children) == null ? void 0 : p.default() : c.children) : v === "ElOption" ? l.push((m = c.props) == null ? void 0 : m.value) : Yt(c.children) && u(c.children); }); } return o.length && u((i = o[0]) == null ? void 0 : i.children), Cu(l, n) || (n = l, t && (t.states.optionValues = l)), o; }; } }); const OS = Er({ name: String, id: String, modelValue: { type: [Array, String, Number, Boolean, Object], default: void 0 }, autocomplete: { type: String, default: "off" }, automaticDropdown: Boolean, size: ja, effect: { type: rr(String), default: "light" }, disabled: Boolean, clearable: Boolean, filterable: Boolean, allowCreate: Boolean, loading: Boolean, popperClass: { type: String, default: "" }, popperOptions: { type: rr(Object), default: () => ({}) }, remote: Boolean, loadingText: String, noMatchText: String, noDataText: String, remoteMethod: Function, filterMethod: Function, multiple: Boolean, multipleLimit: { type: Number, default: 0 }, placeholder: { type: String }, defaultFirstOption: Boolean, reserveKeyword: { type: Boolean, default: !0 }, valueKey: { type: String, default: "value" }, collapseTags: Boolean, collapseTagsTooltip: Boolean, maxCollapseTags: { type: Number, default: 1 }, teleported: Ol.teleported, persistent: { type: Boolean, default: !0 }, clearIcon: { type: Ha, default: pl }, fitInputWidth: Boolean, suffixIcon: { type: Ha, default: Lh }, tagType: { ...$u.type, default: "info" }, tagEffect: { ...$u.effect, default: "light" }, validateEvent: { type: Boolean, default: !0 }, remoteShowSuffix: Boolean, placement: { type: rr(String), values: oi, default: "bottom-start" }, fallbackPlacements: { type: rr(Array), default: ["bottom-start", "top-start", "right", "left"] }, appendTo: String, ...XN, ...wa(["ariaLabel"]) }), $f = "ElSelect", BS = Re({ name: $f, componentName: $f, components: { ElSelectMenu: MS, ElOption: $l, ElOptions: TS, ElTag: pS, ElScrollbar: FD, ElTooltip: D0, ElIcon: Ct }, directives: { ClickOutside: oS }, props: OS, emits: [ Or, ii, "remove-tag", "clear", "visible-change", "focus", "blur" ], setup(e, { emit: r }) { const t = ue(() => { const { modelValue: i, multiple: o } = e, l = o ? [] : void 0; return Yt(i) ? o ? i : l : o ? l : i; }), n = Vt({ ...ma(e), modelValue: t }), a = FS(n, r); return Ft(Ss, Vt({ props: n, states: a.states, optionsArray: a.optionsArray, handleOptionSelect: a.handleOptionSelect, onOptionCreate: a.onOptionCreate, onOptionDestroy: a.onOptionDestroy, selectRef: a.selectRef, setSelected: a.setSelected })), { ...a, modelValue: t }; } }); function $S(e, r, t, n, a, i) { const o = $n("el-tag"), l = $n("el-tooltip"), u = $n("el-icon"), s = $n("el-option"), c = $n("el-options"), f = $n("el-scrollbar"), d = $n("el-select-menu"), p = R1("click-outside"); return at((he(), Ce("div", { ref: "selectRef", class: _e([e.nsSelect.b(), e.nsSelect.m(e.selectSize)]), [P1(e.mouseEnterEventName)]: (m) => e.states.inputHovering = !0, onMouseleave: (m) => e.states.inputHovering = !1 }, [ mr(l, { ref: "tooltipRef", visible: e.dropdownMenuVisible, placement: e.placement, teleported: e.teleported, "popper-class": [e.nsSelect.e("popper"), e.popperClass], "popper-options": e.popperOptions, "fallback-placements": e.fallbackPlacements, effect: e.effect, pure: "", trigger: "click", transition: `${e.nsSelect.namespace.value}-zoom-in-top`, "stop-popper-mouse-event": !1, "gpu-acceleration": !1, persistent: e.persistent, "append-to": e.appendTo, onBeforeShow: e.handleMenuEnter, onHide: (m) => e.states.isBeforeHide = !1 }, { default: Ve(() => { var m; return [ $e("div", { ref: "wrapperRef", class: _e([ e.nsSelect.e("wrapper"), e.nsSelect.is("focused", e.isFocused), e.nsSelect.is("hovering", e.states.inputHovering), e.nsSelect.is("filterable", e.filterable), e.nsSelect.is("disabled", e.selectDisabled) ]), onClick: kr(e.toggleMenu, ["prevent"]) }, [ e.$slots.prefix ? (he(), Ce("div", { key: 0, ref: "prefixRef", class: _e(e.nsSelect.e("prefix")) }, [ Xe(e.$slots, "prefix") ], 2)) : Be("v-if", !0), $e("div", { ref: "selectionRef", class: _e([ e.nsSelect.e("selection"), e.nsSelect.is("near", e.multiple && !e.$slots.prefix && !!e.states.selected.length) ]) }, [ e.multiple ? Xe(e.$slots, "tag", { key: 0 }, () => [ (he(!0), Ce(nt, null, Gn(e.showTagList, (v) => (he(), Ce("div", { key: e.getValueKey(v), class: _e(e.nsSelect.e("selected-item")) }, [ mr(o, { closable: !e.selectDisabled && !v.isDisabled, size: e.collapseTagSize, type: e.tagType, effect: e.tagEffect, "disable-transitions": "", style: Lr(e.tagStyle), onClose: (b) => e.deleteTag(b, v) }, { default: Ve(() => [ $e("span", { class: _e(e.nsSelect.e("tags-text")) }, [ Xe(e.$slots, "label", { label: v.currentLabel, value: v.value }, () => [ dn(qr(v.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "style", "onClose"]) ], 2))), 128)), e.collapseTags && e.states.selected.length > e.maxCollapseTags ? (he(), He(l, { key: 0, ref: "tagTooltipRef", disabled: e.dropdownMenuVisible || !e.collapseTagsTooltip, "fallback-placements": ["bottom", "top", "right", "left"], effect: e.effect, placement: "bottom", teleported: e.teleported }, { default: Ve(() => [ $e("div", { ref: "collapseItemRef", class: _e(e.nsSelect.e("selected-item")) }, [ mr(o, { closable: !1, size: e.collapseTagSize, type: e.tagType, effect: e.tagEffect, "disable-transitions": "", style: Lr(e.collapseTagStyle) }, { default: Ve(() => [ $e("span", { class: _e(e.nsSelect.e("tags-text")) }, " + " + qr(e.states.selected.length - e.maxCollapseTags), 3) ]), _: 1 }, 8, ["size", "type", "effect", "style"]) ], 2) ]), content: Ve(() => [ $e("div", { ref: "tagMenuRef", class: _e(e.nsSelect.e("selection")) }, [ (he(!0), Ce(nt, null, Gn(e.collapseTagList, (v) => (he(), Ce("div", { key: e.getValueKey(v), class: _e(e.nsSelect.e("selected-item")) }, [ mr(o, { class: "in-tooltip", closable: !e.selectDisabled && !v.isDisabled, size: e.collapseTagSize, type: e.tagType, effect: e.tagEffect, "disable-transitions": "", onClose: (b) => e.deleteTag(b, v) }, { default: Ve(() => [ $e("span", { class: _e(e.nsSelect.e("tags-text")) }, [ Xe(e.$slots, "label", { label: v.currentLabel, value: v.value }, () => [ dn(qr(v.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "onClose"]) ], 2))), 128)) ], 2) ]), _: 3 }, 8, ["disabled", "effect", "teleported"])) : Be("v-if", !0) ]) : Be("v-if", !0), e.selectDisabled ? Be("v-if", !0) : (he(), Ce("div", { key: 1, class: _e([ e.nsSelect.e("selected-item"), e.nsSelect.e("input-wrapper"), e.nsSelect.is("hidden", !e.filterable) ]) }, [ at($e("input", { id: e.inputId, ref: "inputRef", "onUpdate:modelValue": (v) => e.states.inputValue = v, type: "text", name: e.name, class: _e([e.nsSelect.e("input"), e.nsSelect.is(e.selectSize)]), disabled: e.selectDisabled, autocomplete: e.autocomplete, style: Lr(e.inputStyle), role: "combobox", readonly: !e.filterable, spellcheck: "false", "aria-activedescendant": ((m = e.hoverOption) == null ? void 0 : m.id) || "", "aria-controls": e.contentId, "aria-expanded": e.dropdownMenuVisible, "aria-label": e.ariaLabel, "aria-autocomplete": "none", "aria-haspopup": "listbox", onKeydown: [ vn(kr((v) => e.navigateOptions("next"), ["stop", "prevent"]), ["down"]), vn(kr((v) => e.navigateOptions("prev"), ["stop", "prevent"]), ["up"]), vn(kr(e.handleEsc, ["stop", "prevent"]), ["esc"]), vn(kr(e.selectOption, ["stop", "prevent"]), ["enter"]), vn(kr(e.deletePrevTag, ["stop"]), ["delete"]) ], onCompositionstart: e.handleCompositionStart, onCompositionupdate: e.handleCompositionUpdate, onCompositionend: e.handleCompositionEnd, onInput: e.onInput, onClick: kr(e.toggleMenu, ["stop"]) }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [ [z1, e.states.inputValue] ]), e.filterable ? (he(), Ce("span", { key: 0, ref: "calculatorRef", "aria-hidden": "true", class: _e(e.nsSelect.e("input-calculator")), textContent: qr(e.states.inputValue) }, null, 10, ["textContent"])) : Be("v-if", !0) ], 2)), e.shouldShowPlaceholder ? (he(), Ce("div", { key: 2, class: _e([ e.nsSelect.e("selected-item"), e.nsSelect.e("placeholder"), e.nsSelect.is("transparent", !e.hasModelValue || e.expanded && !e.states.inputValue) ]) }, [ e.hasModelValue ? Xe(e.$slots, "label", { key: 0, label: e.currentPlaceholder, value: e.modelValue }, () => [ $e("span", null, qr(e.currentPlaceholder), 1) ]) : (he(), Ce("span", { key: 1 }, qr(e.currentPlaceholder), 1)) ], 2)) : Be("v-if", !0) ], 2), $e("div", { ref: "suffixRef", class: _e(e.nsSelect.e("suffix")) }, [ e.iconComponent && !e.showClose ? (he(), He(u, { key: 0, class: _e([e.nsSelect.e("caret"), e.nsSelect.e("icon"), e.iconReverse]) }, { default: Ve(() => [ (he(), He(Lt(e.iconComponent))) ]), _: 1 }, 8, ["class"])) : Be("v-if", !0), e.showClose && e.clearIcon ? (he(), He(u, { key: 1, class: _e([ e.nsSelect.e("caret"), e.nsSelect.e("icon"), e.nsSelect.e("clear") ]), onClick: e.handleClearClick }, { default: Ve(() => [ (he(), He(Lt(e.clearIcon))) ]), _: 1 }, 8, ["class", "onClick"])) : Be("v-if", !0), e.validateState && e.validateIcon ? (he(), He(u, { key: 2, class: _e([e.nsInput.e("icon"), e.nsInput.e("validateIcon")]) }, { default: Ve(() => [ (he(), He(Lt(e.validateIcon))) ]), _: 1 }, 8, ["class"])) : Be("v-if", !0) ], 2) ], 10, ["onClick"]) ]; }), content: Ve(() => [ mr(d, { ref: "menuRef" }, { default: Ve(() => [ e.$slots.header ? (he(), Ce("div", { key: 0, class: _e(e.nsSelect.be("dropdown", "header")), onClick: kr(() => { }, ["stop"]) }, [ Xe(e.$slots, "header") ], 10, ["onClick"])) : Be("v-if", !0), at(mr(f, { id: e.contentId, ref: "scrollbarRef", tag: "ul", "wrap-class": e.nsSelect.be("dropdown", "wrap"), "view-class": e.nsSelect.be("dropdown", "list"), class: _e([e.nsSelect.is("empty", e.filteredOptionsCount === 0)]), role: "listbox", "aria-label": e.ariaLabel, "aria-orientation": "vertical" }, { default: Ve(() => [ e.showNewOption ? (he(), He(s, { key: 0, value: e.states.inputValue, created: !0 }, null, 8, ["value"])) : Be("v-if", !0), mr(c, null, { default: Ve(() => [ Xe(e.$slots, "default") ]), _: 3 }) ]), _: 3 }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [ [Nn, e.states.options.size > 0 && !e.loading] ]), e.$slots.loading && e.loading ? (he(), Ce("div", { key: 1, class: _e(e.nsSelect.be("dropdown", "loading")) }, [ Xe(e.$slots, "loading") ], 2)) : e.loading || e.filteredOptionsCount === 0 ? (he(), Ce("div", { key: 2, class: _e(e.nsSelect.be("dropdown", "empty")) }, [ Xe(e.$slots, "empty", {}, () => [ $e("span", null, qr(e.emptyText), 1) ]) ], 2)) : Be("v-if", !0), e.$slots.footer ? (he(), Ce("div", { key: 3, class: _e(e.nsSelect.be("dropdown", "footer")), onClick: kr(() => { }, ["stop"]) }, [ Xe(e.$slots, "footer") ], 10, ["onClick"])) : Be("v-if", !0) ]), _: 3 }, 512) ]), _: 3 }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "onBeforeShow", "onHide"]) ], 16, ["onMouseleave"])), [ [p, e.handleClickOutside, e.popperRef] ]); } var IS = /* @__PURE__ */ Sr(BS, [["render", $S], ["__file", "select.vue"]]); const RS = Re({ name: "ElOptionGroup", componentName: "ElOptionGroup", props: { label: String, disabled: Boolean }, setup(e) { const r = Dr("select"), t = Se(null), n = ot(), a = Se([]); Ft(F0, Vt({ ...ma(e) })); const i = ue(() => a.value.some((s) => s.visible === !0)), o = (s) => { var c, f; return ((c = s.type) == null ? void 0 : c.name) === "ElOption" && !!((f = s.component) != null && f.proxy); }, l = (s) => { const c = Ln(s), f = []; return c.forEach((d) => { var p, m; o(d) ? f.push(d.component.proxy) : (p = d.children) != null && p.length ? f.push(...l(d.children)) : (m = d.component) != null && m.subTree && f.push(...l(d.component.subTree)); }), f; }, u = () => { a.value = l(n.subTree); }; return Wr(() => { u(); }), j1(t, u, { attributes: !0, subtree: !0, childList: !0 }), { groupRef: t, visible: i, ns: r }; } }); function PS(e, r, t, n, a, i) { return at((he(), Ce("ul", { ref: "groupRef", class: _e(e.ns.be("group", "wrap")) }, [ $e("li", { class: _e(e.ns.be("group", "title")) }, qr(e.label), 3), $e("li", null, [ $e("ul", { class: _e(e.ns.b("group")) }, [ Xe(e.$slots, "default") ], 2) ]) ], 2)), [ [Nn, e.visible] ]); } var T0 = /* @__PURE__ */ Sr(RS, [["render", PS], ["__file", "option-group.vue"]]); const O0 = Bt(IS, { Option: $l, OptionGroup: T0 }), B0 = ml($l); ml(T0); const $0 = Symbol("sliderContextKey"), zS = Er({ modelValue: { type: rr([Number, Array]), default: 0 }, id: { type: String, default: void 0 }, min: { type: Number, default: 0 }, max: { type: Number, default: 100 }, step: { type: Number, default: 1 }, showInput: Boolean, showInputControls: { type: Boolean, default: !0 }, size: ja, inputSize: ja, showStops: Boolean, showTooltip: { type: Boolean, default: !0 }, formatTooltip: { type: rr(Function), default: void 0 }, disabled: Boolean, range: Boolean, vertical: Boolean, height: String, debounce: { type: Number, default: 300 }, rangeStartLabel: { type: String, default: void 0 }, rangeEndLabel: { type: String, default: void 0 }, formatValueText: { type: rr(Function), default: void 0 }, tooltipClass: { type: String, default: void 0 }, placement: { type: String, values: oi, default: "top" }, marks: { type: rr(Object) }, validateEvent: { type: Boolean, default: !0 }, ...wa(["ariaLabel"]) }), su = (e) => Nr(e) || Yt(e) && e.every(Nr), qS = { [Or]: su, [ca]: su, [ii]: su }, LS = (e, r, t) => { const n = Se(); return Wr(async () => { e.range ? (Array.isArray(e.modelValue) ? (r.firstValue = Math.max(e.min, e.modelValue[0]), r.secondValue = Math.min(e.max, e.modelValue[1])) : (r.firstValue = e.min, r.secondValue = e.max), r.oldValue = [r.firstValue, r.secondValue]) : (typeof e.modelValue != "number" || Number.isNaN(e.modelValue) ? r.firstValue = e.min : r.firstValue = Math.min(e.max, Math.max(e.min, e.modelValue)), r.oldValue = r.firstValue), tt(window, "resize", t), await Cr(), t(); }), { sliderWrapper: n }; }, US = (e) => ue(() => e.marks ? Object.keys(e.marks).map(Number.parseFloat).sort((t, n) => t - n).filter((t) => t <= e.max && t >= e.min).map((t) => ({ point: t, position: (t - e.min) * 100 / (e.max - e.min), mark: e.marks[t] })) : []), kS = (e, r, t) => { const { form: n, formItem: a } = Zi(), i = qa(), o = Se(), l = Se(), u = { firstButton: o, secondButton: l }, s = ue(() => e.disabled || (n == null ? void 0 : n.disabled) || !1), c = ue(() => Math.min(r.firstValue, r.secondValue)), f = ue(() => Math.max(r.firstValue, r.secondValue)), d = ue(() => e.range ? `${100 * (f.value - c.value) / (e.max - e.min)}%` : `${100 * (r.firstValue - e.min) / (e.max - e.min)}%`), p = ue(() => e.range ? `${100 * (c.value - e.min) / (e.max - e.min)}%` : "0%"), m = ue(() => e.vertical ? { height: e.height } : {}), v = ue(() => e.vertical ? { height: d.value, bottom: p.value } : { width: d.value, left: p.value }), b = () => { i.value && (r.sliderSize = i.value[`client${e.vertical ? "Height" : "Width"}`]); }, y = (F) => { const $ = e.min + F * (e.max - e.min) / 100; if (!e.range) return o; let I; return Math.abs(c.value - $) < Math.abs(f.value - $) ? I = r.firstValue < r.secondValue ? "firstButton" : "secondButton" : I = r.firstValue > r.secondValue ? "firstButton" : "secondButton", u[I]; }, A = (F) => { const $ = y(F); return $.value.setPosition(F), $; }, h = (F) => { r.firstValue = F ?? e.min, w(e.range ? [c.value, f.value] : F ?? e.min); }, x = (F) => { r.secondValue = F, e.range && w([c.value, f.value]); }, w = (F) => { t(Or, F), t(ca, F); }, g = async () => { await Cr(), t(ii, e.range ? [c.value, f.value] : e.modelValue); }, D = (F) => { var $, I, B, C, _, z; if (s.value || r.dragging) return; b(); let O = 0; if (e.vertical) { const W = (B = (I = ($ = F.touches) == null ? void 0 : $.item(0)) == null ? void 0 : I.clientY) != null ? B : F.clientY; O = (i.value.getBoundingClientRect().bottom - W) / r.sliderSize * 100; } else { const W = (z = (_ = (C = F.touches) == null ? void 0 : C.item(0)) == null ? void 0 : _.clientX) != null ? z : F.clientX, X = i.value.getBoundingClientRect().left; O = (W - X) / r.sliderSize * 100; } if (!(O < 0 || O > 100)) return A(O); }; return { elFormItem: a, slider: i, firstButton: o, secondButton: l, sliderDisabled: s, minValue: c, maxValue: f, runwayStyle: m, barStyle: v, resetSize: b, setPosition: A, emitChange: g, onSliderWrapperPrevent: (F) => { var $, I; (($ = u.firstButton.value) != null && $.dragging || (I = u.secondButton.value) != null && I.dragging) && F.preventDefault(); }, onSliderClick: (F) => { D(F) && g(); }, onSliderDown: async (F) => { const $ = D(F); $ && (await Cr(), $.value.onButtonDown(F)); }, onSliderMarkerDown: (F) => { s.value || r.dragging || A(F); }, setFirstValue: h, setSecondValue: x }; }, { left: VS, down: HS, right: ZS, up: GS, home: WS, end: KS, pageUp: JS, pageDown: YS } = Za, jS = (e, r, t) => { const n = Se(), a = Se(!1), i = ue(() => r.value instanceof Function), o = ue(() => i.value && r.value(e.modelValue) || e.modelValue), l = Su(() => { t.value && (a.value = !0); }, 50), u = Su(() => { t.value && (a.value = !1); }, 50); return { tooltip: n, tooltipVisible: a, formatValue: o, displayTooltip: l, hideTooltip: u }; }, XS = (e, r, t) => { const { disabled: n, min: a, max: i, step: o, showTooltip: l, precision: u, sliderSize: s, formatTooltip: c, emitChange: f, resetSize: d, updateDragging: p } = vr($0), { tooltip: m, tooltipVisible: v, formatValue: b, displayTooltip: y, hideTooltip: A } = jS(e, c, l), h = Se(), x = ue(() => `${(e.modelValue - a.value) / (i.value - a.value) * 100}%`), w = ue(() => e.vertical ? { bottom: x.value } : { left: x.value }), g = () => { r.hovering = !0, y(); }, D = () => { r.hovering = !1, r.dragging || A(); }, E = (V) => { n.value || (V.preventDefault(), z(V), window.addEventListener("mousemove", O), window.addEventListener("touchmove", O), window.addEventListener("mouseup", W), window.addEventListener("touchend", W), window.addEventListener("contextmenu", W), h.value.focus()); }, N = (V) => { n.value || (r.newPosition = Number.parseFloat(x.value) + V / (i.value - a.value) * 100, X(r.newPosition), f()); }, S = () => { N(-o.value); }, M = () => { N(o.value); }, F = () => { N(-o.value * 4); }, $ = () => { N(o.value * 4); }, I = () => { n.value || (X(0), f()); }, B = () => { n.value || (X(100), f()); }, C = (V) => { let R = !0; [VS, HS].includes(V.key) ? S() : [ZS, GS].includes(V.key) ? M() : V.key === WS ? I() : V.key === KS ? B() : V.key === YS ? F() : V.key === JS ? $() : R = !1, R && V.preventDefault(); }, _ = (V) => { let R, Q; return V.type.startsWith("touch") ? (Q = V.touches[0].clientY, R = V.touches[0].clientX) : (Q = V.clientY, R = V.clientX), { clientX: R, clientY: Q }; }, z = (V) => { r.dragging = !0, r.isClick = !0; const { clientX: R, clientY: Q } = _(V); e.vertical ? r.startY = Q : r.startX = R, r.startPosition = Number.parseFloat(x.value), r.newPosition = r.startPosition; }, O = (V) => { if (r.dragging) { r.isClick = !1, y(), d(); let R; const { clientX: Q, clientY: se } = _(V); e.vertical ? (r.currentY = se, R = (r.startY - r.currentY) / s.value * 100) : (r.currentX = Q, R = (r.currentX - r.startX) / s.value * 100), r.newPosition = r.startPosition + R, X(r.newPosition); } }, W = () => { r.dragging && (setTimeout(() => { r.dragging = !1, r.hovering || A(), r.isClick || X(r.newPosition), f(); }, 0), window.removeEventListener("mousemove", O), window.removeEventListener("touchmove", O), window.removeEventListener("mouseup", W), window.removeEventListener("touchend", W), window.removeEventListener("contextmenu", W)); }, X = async (V) => { if (V === null || Number.isNaN(+V)) return; V < 0 ? V = 0 : V > 100 && (V = 100); const R = 100 / ((i.value - a.value) / o.value); let se = Math.round(V / R) * R * (i.value - a.value) * 0.01 + a.value; se = Number.parseFloat(se.toFixed(u.value)), se !== e.modelValue && t(Or, se), !r.dragging && e.modelValue !== r.oldValue && (r.oldValue = e.modelValue), await Cr(), r.dragging && y(), m.value.updatePopper(); }; return er(() => r.dragging, (V) => { p(V); }), tt(h, "touchstart", E, { passive: !1 }), { disabled: n, button: h, tooltip: m, tooltipVisible: v, showTooltip: l, wrapperStyle: w, formatValue: b, handleMouseEnter: g, handleMouseLeave: D, onButtonDown: E, onKeyDown: C, setPosition: X }; }, QS = (e, r, t, n) => ({ stops: ue(() => { if (!e.showStops || e.min > e.max) return []; if (e.step === 0) return Tr("ElSlider", "step should not be 0."), []; const o = (e.max - e.min) / e.step, l = 100 * e.step / (e.max - e.min), u = Array.from({ length: o - 1 }).map((s, c) => (c + 1) * l); return e.range ? u.filter((s) => s < 100 * (t.value - e.min) / (e.max - e.min) || s > 100 * (n.value - e.min) / (e.max - e.min)) : u.filter((s) => s > 100 * (r.firstValue - e.min) / (e.max - e.min)); }), getStopStyle: (o) => e.vertical ? { bottom: `${o}%` } : { left: `${o}%` } }), eC = (e, r, t, n, a, i) => { const o = (s) => { a(Or, s), a(ca, s); }, l = () => e.range ? ![t.value, n.value].every((s, c) => s === r.oldValue[c]) : e.modelValue !== r.oldValue, u = () => { var s, c; e.min > e.max && dl("Slider", "min should not be greater than max."); const f = e.modelValue; e.range && Array.isArray(f) ? f[1] < e.min ? o([e.min, e.min]) : f[0] > e.max ? o([e.max, e.max]) : f[0] < e.min ? o([e.min, f[1]]) : f[1] > e.max ? o([f[0], e.max]) : (r.firstValue = f[0], r.secondValue = f[1], l() && (e.validateEvent && ((s = i == null ? void 0 : i.validate) == null || s.call(i, "change").catch((d) => Tr(d))), r.oldValue = f.slice())) : !e.range && typeof f == "number" && !Number.isNaN(f) && (f < e.min ? o(e.min) : f > e.max ? o(e.max) : (r.firstValue = f, l() && (e.validateEvent && ((c = i == null ? void 0 : i.validate) == null || c.call(i, "change").catch((d) => Tr(d))), r.oldValue = f))); }; u(), er(() => r.dragging, (s) => { s || u(); }), er(() => e.modelValue, (s, c) => { r.dragging || Array.isArray(s) && Array.isArray(c) && s.every((f, d) => f === c[d]) && r.firstValue === s[0] && r.secondValue === s[1] || u(); }, { deep: !0 }), er(() => [e.min, e.max], () => { u(); }); }, rC = Er({ modelValue: { type: Number, default: 0 }, vertical: Boolean, tooltipClass: String, placement: { type: String, values: oi, default: "top" } }), tC = { [Or]: (e) => Nr(e) }, nC = Re({ name: "ElSliderButton" }), aC = /* @__PURE__ */ Re({ ...nC, props: rC, emits: tC, setup(e, { expose: r, emit: t }) { const n = e, a = Dr("slider"), i = Vt({ hovering: !1, dragging: !1, isClick: !1, startX: 0, currentX: 0, startY: 0, currentY: 0, startPosition: 0, newPosition: 0, oldValue: n.modelValue }), { disabled: o, button: l, tooltip: u, showTooltip: s, tooltipVisible: c, wrapperStyle: f, formatValue: d, handleMouseEnter: p, handleMouseLeave: m, onButtonDown: v, onKeyDown: b, setPosition: y } = XS(n, i, t), { hovering: A, dragging: h } = ma(i); return r({ onButtonDown: v, onKeyDown: b, setPosition: y, hovering: A, dragging: h }), (x, w) => (he(), Ce("div", { ref_key: "button", ref: l, class: _e([U(a).e("button-wrapper"), { hover: U(A), dragging: U(h) }]), style: Lr(U(f)), tabindex: U(o) ? -1 : 0, onMouseenter: U(p), onMouseleave: U(m), onMousedown: U(v), onFocus: U(p), onBlur: U(m), onKeydown: U(b) }, [ mr(U(D0), { ref_key: "tooltip", ref: u, visible: U(c), placement: x.placement, "fallback-placements": ["top", "bottom", "right", "left"], "stop-popper-mouse-event": !1, "popper-class": x.tooltipClass, disabled: !U(s), persistent: "" }, { content: Ve(() => [ $e("span", null, qr(U(d)), 1) ]), default: Ve(() => [ $e("div", { class: _e([U(a).e("button"), { hover: U(A), dragging: U(h) }]) }, null, 2) ]), _: 1 }, 8, ["visible", "placement", "popper-class", "disabled"]) ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"])); } }); var If = /* @__PURE__ */ Sr(aC, [["__file", "button.vue"]]); const iC = Er({ mark: { type: rr([String, Object]), default: void 0 } }); var oC = Re({ name: "ElSliderMarker", props: iC, setup(e) { const r = Dr("slider"), t = ue(() => wt(e.mark) ? e.mark : e.mark.label), n = ue(() => wt(e.mark) ? void 0 : e.mark.style); return () => $a("div", { class: r.e("marks-text"), style: n.value }, t.value); } }); const sC = Re({ name: "ElSlider" }), uC = /* @__PURE__ */ Re({ ...sC, props: zS, emits: qS, setup(e, { expose: r, emit: t }) { const n = e, a = Dr("slider"), { t: i } = ws(), o = Vt({ firstValue: 0, secondValue: 0, oldValue: 0, dragging: !1, sliderSize: 1 }), { elFormItem: l, slider: u, firstButton: s, secondButton: c, sliderDisabled: f, minValue: d, maxValue: p, runwayStyle: m, barStyle: v, resetSize: b, emitChange: y, onSliderWrapperPrevent: A, onSliderClick: h, onSliderDown: x, onSliderMarkerDown: w, setFirstValue: g, setSecondValue: D } = kS(n, o, t), { stops: E, getStopStyle: N } = QS(n, o, d, p), { inputId: S, isLabeledByFormItem: M } = Sl(n, { formItemContext: l }), F = si(), $ = ue(() => n.inputSize || F.value), I = ue(() => n.ariaLabel || i("el.slider.defaultLabel", { min: n.min, max: n.max })), B = ue(() => n.range ? n.rangeStartLabel || i("el.slider.defaultRangeStartLabel") : I.value), C = ue(() => n.formatValueText ? n.formatValueText(R.value) : `${R.value}`), _ = ue(() => n.rangeEndLabel || i("el.slider.defaultRangeEndLabel")), z = ue(() => n.formatValueText ? n.formatValueText(Q.value) : `${Q.value}`), O = ue(() => [ a.b(), a.m(F.value), a.is("vertical", n.vertical), { [a.m("with-input")]: n.showInput } ]), W = US(n); eC(n, o, d, p, t, l); const X = ue(() => { const q = [n.min, n.max, n.step].map((Z) => { const K = `${Z}`.split(".")[1]; return K ? K.length : 0; }); return Math.max.apply(null, q); }), { sliderWrapper: V } = LS(n, o, b), { firstValue: R, secondValue: Q, sliderSize: se } = ma(o), re = (q) => { o.dragging = q; }; return tt(V, "touchstart", A, { passive: !1 }), tt(V, "touchmove", A, { passive: !1 }), Ft($0, { ...ma(n), sliderSize: se, disabled: f, precision: X, emitChange: y, resetSize: b, updateDragging: re }), r({ onSliderClick: h }), (q, Z) => { var K, j; return he(), Ce("div", { id: q.range ? U(S) : void 0, ref_key: "sliderWrapper", ref: V, class: _e(U(O)), role: q.range ? "group" : void 0, "aria-label": q.range && !U(M) ? U(I) : void 0, "aria-labelledby": q.range && U(M) ? (K = U(l)) == null ? void 0 : K.labelId : void 0 }, [ $e("div", { ref_key: "slider", ref: u, class: _e([ U(a).e("runway"), { "show-input": q.showInput && !q.range }, U(a).is("disabled", U(f)) ]), style: Lr(U(m)), onMousedown: U(x), onTouchstartPassive: U(x) }, [ $e("div", { class: _e(U(a).e("bar")), style: Lr(U(v)) }, null, 6), mr(If, { id: q.range ? void 0 : U(S), ref_key: "firstButton", ref: s, "model-value": U(R), vertical: q.vertical, "tooltip-class": q.tooltipClass, placement: q.placement, role: "slider", "aria-label": q.range || !U(M) ? U(B) : void 0, "aria-labelledby": !q.range && U(M) ? (j = U(l)) == null ? void 0 : j.labelId : void 0, "aria-valuemin": q.min, "aria-valuemax": q.range ? U(Q) : q.max, "aria-valuenow": U(R), "aria-valuetext": U(C), "aria-orientation": q.vertical ? "vertical" : "horizontal", "aria-disabled": U(f), "onUpdate:modelValue": U(g) }, null, 8, ["id", "model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"]), q.range ? (he(), He(If, { key: 0, ref_key: "secondButton", ref: c, "model-value": U(Q), vertical: q.vertical, "tooltip-class": q.tooltipClass, placement: q.placement, role: "slider", "aria-label": U(_), "aria-valuemin": U(R), "aria-valuemax": q.max, "aria-valuenow": U(Q), "aria-valuetext": U(z), "aria-orientation": q.vertical ? "vertical" : "horizontal", "aria-disabled": U(f), "onUpdate:modelValue": U(D) }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : Be("v-if", !0), q.showStops ? (he(), Ce("div", { key: 1 }, [ (he(!0), Ce(nt, null, Gn(U(E), (ee, te) => (he(), Ce("div", { key: te, class: _e(U(a).e("stop")), style: Lr(U(N)(ee)) }, null, 6))), 128)) ])) : Be("v-if", !0), U(W).length > 0 ? (he(), Ce(nt, { key: 2 }, [ $e("div", null, [ (he(!0), Ce(nt, null, Gn(U(W), (ee, te) => (he(), Ce("div", { key: te, style: Lr(U(N)(ee.position)), class: _e([U(a).e("stop"), U(a).e("marks-stop")]) }, null, 6))), 128)) ]), $e("div", { class: _e(U(a).e("marks")) }, [ (he(!0), Ce(nt, null, Gn(U(W), (ee, te) => (he(), He(U(oC), { key: te, mark: ee.mark, style: Lr(U(N)(ee.position)), onMousedown: kr((oe) => U(w)(ee.position), ["stop"]) }, null, 8, ["mark", "style", "onMousedown"]))), 128)) ], 2) ], 64)) : Be("v-if", !0) ], 46, ["onMousedown", "onTouchstartPassive"]), q.showInput && !q.range ? (he(), He(U(Bl), { key: 0, ref: "input", "model-value": U(R), class: _e(U(a).e("input")), step: q.step, disabled: U(f), controls: q.showInputControls, min: q.min, max: q.max, precision: U(X), debounce: q.debounce, size: U($), "onUpdate:modelValue": U(g), onChange: U(y) }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : Be("v-if", !0) ], 10, ["id", "role", "aria-label", "aria-labelledby"]); }; } }); var lC = /* @__PURE__ */ Sr(uC, [["__file", "slider.vue"]]); const I0 = Bt(lC); function cC(e) { let r; const t = Se(!1), n = Vt({ ...e, originalPosition: "", originalOverflow: "", visible: !1 }); function a(d) { n.text = d; } function i() { const d = n.parent, p = f.ns; if (!d.vLoadingAddClassList) { let m = d.getAttribute("loading-number"); m = Number.parseInt(m) - 1, m ? d.setAttribute("loading-number", m.toString()) : (Uo(d, p.bm("parent", "relative")), d.removeAttribute("loading-number")), Uo(d, p.bm("parent", "hidden")); } o(), c.unmount(); } function o() { var d, p; (p = (d = f.$el) == null ? void 0 : d.parentNode) == null || p.removeChild(f.$el); } function l() { var d; e.beforeClose && !e.beforeClose() || (t.value = !0, clearTimeout(r), r = setTimeout(u, 400), n.visible = !1, (d = e.closed) == null || d.call(e)); } function u() { if (!t.value) return; const d = n.parent; t.value = !1, d.vLoadingAddClassList = void 0, i(); } const s = Re({ name: "ElLoading", setup(d, { expose: p }) { const { ns: m, zIndex: v } = rD("loading"); return p({ ns: m, zIndex: v }), () => { const b = n.spinner || n.svg, y = $a("svg", { class: "circular", viewBox: n.svgViewBox ? n.svgViewBox : "0 0 50 50", ...b ? { innerHTML: b } : {} }, [ $a("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none" }) ]), A = n.text ? $a("p", { class: m.b("text") }, [n.text]) : void 0; return $a(fs, { name: m.b("fade"), onAfterLeave: u }, { default: Ve(() => [ at(mr("div", { style: { backgroundColor: n.background || "" }, class: [ m.b("mask"), n.customClass, n.fullscreen ? "is-fullscreen" : "" ] }, [ $a("div", { class: m.b("spinner") }, [y, A]) ]), [[Nn, n.visible]]) ]) }); }; } }), c = q1(s), f = c.mount(document.createElement("div")); return { ...ma(n), setText: a, removeElLoadingChild: o, close: l, handleAfterLeave: u, vm: f, get $el() { return f.$el; } }; } let lo; const Iu = function(e = {}) { if (!Ir) return; const r = fC(e); if (r.fullscreen && lo) return lo; const t = cC({ ...r, closed: () => { var a; (a = r.closed) == null || a.call(r), r.fullscreen && (lo = void 0); } }); dC(r, r.parent, t), Rf(r, r.parent, t), r.parent.vLoadingAddClassList = () => Rf(r, r.parent, t); let n = r.parent.getAttribute("loading-number"); return n ? n = `${Number.parseInt(n) + 1}` : n = "1", r.parent.setAttribute("loading-number", n), r.parent.appendChild(t.$el), Cr(() => t.visible.value = r.visible), r.fullscreen && (lo = t), t; }, fC = (e) => { var r, t, n, a; let i; return wt(e.target) ? i = (r = document.querySelector(e.target)) != null ? r : document.body : i = e.target || document.body, { parent: i === document.body || e.body ? document.body : i, background: e.background || "", svg: e.svg || "", svgViewBox: e.svgViewBox || "", spinner: e.spinner || !1, text: e.text || "", fullscreen: i === document.body && ((t = e.fullscreen) != null ? t : !0), lock: (n = e.lock) != null ? n : !1, customClass: e.customClass || "", visible: (a = e.visible) != null ? a : !0, beforeClose: e.beforeClose, closed: e.closed, target: i }; }, dC = async (e, r, t) => { const { nextZIndex: n } = t.vm.zIndex || t.vm._.exposed.zIndex, a = {}; if (e.fullscreen) t.originalPosition.value = wi(document.body, "position"), t.originalOverflow.value = wi(document.body, "overflow"), a.zIndex = n(); else if (e.parent === document.body) { t.originalPosition.value = wi(document.body, "position"), await Cr(); for (const i of ["top", "left"]) { const o = i === "top" ? "scrollTop" : "scrollLeft"; a[i] = `${e.target.getBoundingClientRect()[i] + document.body[o] + document.documentElement[o] - Number.parseInt(wi(document.body, `margin-${i}`), 10)}px`; } for (const i of ["height", "width"]) a[i] = `${e.target.getBoundingClientRect()[i]}px`; } else t.originalPosition.value = wi(r, "position"); for (const [i, o] of Object.entries(a)) t.$el.style[i] = o; }, Rf = (e, r, t) => { const n = t.vm.ns || t.vm._.exposed.ns; ["absolute", "fixed", "sticky"].includes(t.originalPosition.value) ? Uo(r, n.bm("parent", "relative")) : ef(r, n.bm("parent", "relative")), e.fullscreen && e.lock ? ef(r, n.bm("parent", "hidden")) : Uo(r, n.bm("parent", "hidden")); }, Bo = Symbol("ElLoading"), Pf = (e, r) => { var t, n, a, i; const o = r.instance, l = (d) => dt(r.value) ? r.value[d] : void 0, u = (d) => { const p = wt(d) && (o == null ? void 0 : o[d]) || d; return p && Se(p); }, s = (d) => u(l(d) || e.getAttribute(`element-loading-${cb(d)}`)), c = (t = l("fullscreen")) != null ? t : r.modifiers.fullscreen, f = { text: s("text"), svg: s("svg"), svgViewBox: s("svgViewBox"), spinner: s("spinner"), background: s("background"), customClass: s("customClass"), fullscreen: c, target: (n = l("target")) != null ? n : c ? void 0 : e, body: (a = l("body")) != null ? a : r.modifiers.body, lock: (i = l("lock")) != null ? i : r.modifiers.lock }; e[Bo] = { options: f, instance: Iu(f) }; }, pC = (e, r) => { for (const t of Object.keys(r)) ph(r[t]) && (r[t].value = e[t]); }, Ru = { mounted(e, r) { r.value && Pf(e, r); }, updated(e, r) { const t = e[Bo]; r.oldValue !== r.value && (r.value && !r.oldValue ? Pf(e, r) : r.value && r.oldValue ? dt(r.value) && pC(r.value, t.options) : t == null || t.instance.close()); }, unmounted(e) { var r; (r = e[Bo]) == null || r.instance.close(), e[Bo] = null; } }, mC = { install(e) { e.directive("loading", Ru), e.config.globalProperties.$loading = Iu; }, directive: Ru, service: Iu }; function jr() { return jr = Object.assign ? Object.assign.bind() : function(e) { for (var r = 1; r < arguments.length; r++) { var t = arguments[r]; for (var n in t) ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]); } return e; }, jr.apply(null, arguments); } var R0 = { // minimum relative difference between two compared values, // used by all comparison functions relTol: 1e-12, // minimum absolute difference between two compared values, // used by all comparison functions absTol: 1e-15, // type of default matrix output. Choose 'matrix' (default) or 'array' matrix: "Matrix", // type of default number output. Choose 'number' (default) 'BigNumber', 'bigint', or 'Fraction' number: "number", // type of fallback used for config { number: 'bigint' } when a value cannot be represented // in the configured numeric type. Choose 'number' (default) or 'BigNumber'. numberFallback: "number", // number of significant digits in BigNumbers precision: 64, // predictable output type of functions. When true, output type depends only // on the input types. When false (default), output type can vary depending // on input values. For example `math.sqrt(-4)` returns `complex('2i')` when // predictable is false, and returns `NaN` when true. predictable: !1, // random seed for seeded pseudo random number generation // null = randomly seed randomSeed: null }; function it(e, r) { if (Zo(e, r)) return e[r]; throw typeof e[r] == "function" && Il(e, r) ? new Error('Cannot access method "' + r + '" as a property') : new Error('No access to property "' + r + '"'); } function Xa(e, r, t) { if (Zo(e, r)) return e[r] = t, t; throw new Error('No access to property "' + r + '"'); } function Zo(e, r) { return !hC(e) && !Array.isArray(e) ? !1 : Fe(gC, r) ? !0 : !(r in Object.prototype || r in Function.prototype); } function vC(e, r) { if (!Il(e, r)) throw new Error('No access to method "' + r + '"'); return e[r]; } function Il(e, r) { return e == null || typeof e[r] != "function" || Fe(e, r) && Object.getPrototypeOf && r in Object.getPrototypeOf(e) ? !1 : Fe(yC, r) ? !0 : !(r in Object.prototype || r in Function.prototype); } function hC(e) { return typeof e == "object" && e && e.constructor === Object; } var gC = { length: !0, name: !0 }, yC = { toString: !0, valueOf: !0, toLocaleString: !0 }; class Cs { constructor(r) { this.wrappedObject = r, this[Symbol.iterator] = this.entries; } keys() { return Object.keys(this.wrappedObject).filter((r) => this.has(r)).values(); } get(r) { return it(this.wrappedObject, r); } set(r, t) { return Xa(this.wrappedObject, r, t), this; } has(r) { return Zo(this.wrappedObject, r) && r in this.wrappedObject; } entries() { return z0(this.keys(), (r) => [r, this.get(r)]); } forEach(r) { for (var t of this.keys()) r(this.get(t), t, this); } delete(r) { Zo(this.wrappedObject, r) && delete this.wrappedObject[r]; } clear() { for (var r of this.keys()) this.delete(r); } get size() { return Object.keys(this.wrappedObject).length; } } class P0 { /** * @param {Map} a * @param {Map} b * @param {Set} bKeys */ constructor(r, t, n) { this.a = r, this.b = t, this.bKeys = n, this[Symbol.iterator] = this.entries; } get(r) { return this.bKeys.has(r) ? this.b.get(r) : this.a.get(r); } set(r, t) { return this.bKeys.has(r) ? this.b.set(r, t) : this.a.set(r, t), this; } has(r) { return this.b.has(r) || this.a.has(r); } keys() { return (/* @__PURE__ */ new Set([...this.a.keys(), ...this.b.keys()]))[Symbol.iterator](); } entries() { return z0(this.keys(), (r) => [r, this.get(r)]); } forEach(r) { for (var t of this.keys()) r(this.get(t), t, this); } delete(r) { return this.bKeys.has(r) ? this.b.delete(r) : this.a.delete(r); } clear() { this.a.clear(), this.b.clear(); } get size() { return [...this.keys()].length; } } function z0(e, r) { return { next: () => { var t = e.next(); return t.done ? t : { value: r(t.value), done: !1 }; } }; } function Ii() { return /* @__PURE__ */ new Map(); } function La(e) { if (!e) return Ii(); if (da(e)) return e; if (ui(e)) return new Cs(e); throw new Error("createMap can create maps from objects or Maps"); } function bC(e) { if (e instanceof Cs) return e.wrappedObject; var r = {}; for (var t of e.keys()) { var n = e.get(t); Xa(r, t, n); } return r; } function We(e) { return typeof e == "number"; } function Ze(e) { return !e || typeof e != "object" || typeof e.constructor != "function" ? !1 : e.isBigNumber === !0 && typeof e.constructor.prototype == "object" && e.constructor.prototype.isBigNumber === !0 || typeof e.constructor.isDecimal == "function" && e.constructor.isDecimal(e) === !0; } function q0(e) { return typeof e == "bigint"; } function Ut(e) { return e && typeof e == "object" && Object.getPrototypeOf(e).isComplex === !0 || !1; } function Aa(e) { return e && typeof e == "object" && Object.getPrototypeOf(e).isFraction === !0 || !1; } function ft(e) { return e && e.constructor.prototype.isUnit === !0 || !1; } function Vr(e) { return typeof e == "string"; } var cr = Array.isArray; function ze(e) { return e && e.constructor.prototype.isMatrix === !0 || !1; } function At(e) { return Array.isArray(e) || ze(e); } function Ri(e) { return e && e.isDenseMatrix && e.constructor.prototype.isMatrix === !0 || !1; } function kn(e) { return e && e.isSparseMatrix && e.constructor.prototype.isMatrix === !0 || !1; } function Ms(e) { return e && e.constructor.prototype.isRange === !0 || !1; } function Gi(e) { return e && e.constructor.prototype.isIndex === !0 || !1; } function L0(e) { return typeof e == "boolean"; } function U0(e) { return e && e.constructor.prototype.isResultSet === !0 || !1; } function Rl(e) { return e && e.constructor.prototype.isHelp === !0 || !1; } function k0(e) { return typeof e == "function"; } function V0(e) { return e instanceof Date; } function H0(e) { return e instanceof RegExp; } function ui(e) { return !!(e && typeof e == "object" && e.constructor === Object && !Ut(e) && !Aa(e)); } function da(e) { return e ? e instanceof Map || e instanceof Cs || typeof e.set == "function" && typeof e.get == "function" && typeof e.keys == "function" && typeof e.has == "function" : !1; } function wC(e) { return da(e) && da(e.a) && da(e.b); } function xC(e) { return da(e) && ui(e.wrappedObject); } function Z0(e) { return e === null; } function G0(e) { return e === void 0; } function Jn(e) { return e && e.isAccessorNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function bt(e) { return e && e.isArrayNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function W0(e) { return e && e.isAssignmentNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function K0(e) { return e && e.isBlockNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function J0(e) { return e && e.isConditionalNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function nr(e) { return e && e.isConstantNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function Pu(e) { return nr(e) || _r(e) && e.args.length === 1 && nr(e.args[0]) && "-+~".includes(e.op); } function li(e) { return e && e.isFunctionAssignmentNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function En(e) { return e && e.isFunctionNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function Na(e) { return e && e.isIndexNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function fr(e) { return e && e.isNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function Wi(e) { return e && e.isObjectNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function _r(e) { return e && e.isOperatorNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function rn(e) { return e && e.isParenthesisNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function Y0(e) { return e && e.isRangeNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function j0(e) { return e && e.isRelationalNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function $r(e) { return e && e.isSymbolNode === !0 && e.constructor.prototype.isNode === !0 || !1; } function Pl(e) { return e && e.constructor.prototype.isChain === !0 || !1; } function yr(e) { var r = typeof e; return r === "object" ? e === null ? "null" : Ze(e) ? "BigNumber" : e.constructor && e.constructor.name ? e.constructor.name : "Object" : r; } function qe(e) { var r = typeof e; if (r === "number" || r === "bigint" || r === "string" || r === "boolean" || e === null || e === void 0) return e; if (typeof e.clone == "function") return e.clone(); if (Array.isArray(e)) return e.map(function(t) { return qe(t); }); if (e instanceof Date) return new Date(e.valueOf()); if (Ze(e)) return e; if (ui(e)) return AC(e, qe); if (r === "function") return e; throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e, ")")); } function AC(e, r) { var t = {}; for (var n in e) Fe(e, n) && (t[n] = r(e[n])); return t; } function X0(e, r) { for (var t in r) Fe(r, t) && (e[t] = r[t]); return e; } function Q0(e, r) { if (Array.isArray(r)) throw new TypeError("Arrays are not supported by deepExtend"); for (var t in r) if (Fe(r, t) && !(t in Object.prototype) && !(t in Function.prototype)) if (r[t] && r[t].constructor === Object) e[t] === void 0 && (e[t] = {}), e[t] && e[t].constructor === Object ? Q0(e[t], r[t]) : e[t] = r[t]; else { if (Array.isArray(r[t])) throw new TypeError("Arrays are not supported by deepExtend"); e[t] = r[t]; } return e; } function Sn(e, r) { var t, n, a; if (Array.isArray(e)) { if (!Array.isArray(r) || e.length !== r.length) return !1; for (n = 0, a = e.length; n < a; n++) if (!Sn(e[n], r[n])) return !1; return !0; } else { if (typeof e == "function") return e === r; if (e instanceof Object) { if (Array.isArray(r) || !(r instanceof Object)) return !1; for (t in e) if (!(t in r) || !Sn(e[t], r[t])) return !1; for (t in r) if (!(t in e)) return !1; return !0; } else return e === r; } } function NC(e) { var r = {}; return eg(e, r), r; } function eg(e, r) { for (var t in e) if (Fe(e, t)) { var n = e[t]; typeof n == "object" && n !== null ? eg(n, r) : r[t] = n; } } function $o(e, r, t) { var n = !0, a; Object.defineProperty(e, r, { get: function() { return n && (a = t(), n = !1), a; }, set: function(o) { a = o, n = !1; }, configurable: !0, enumerable: !0 }); } function Fe(e, r) { return e && Object.hasOwnProperty.call(e, r); } function DC(e) { return e && typeof e.factory == "function"; } function EC(e, r) { for (var t = {}, n = 0; n < r.length; n++) { var a = r[n], i = e[a]; i !== void 0 && (t[a] = i); } return t; } var zf = ["Matrix", "Array"], qf = ["number", "BigNumber", "Fraction"]; function SC(e, r) { function t(n) { if (n) { if (n.epsilon !== void 0) { console.warn('Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.'); var a = qe(n); return a.relTol = n.epsilon, a.absTol = n.epsilon * 1e-3, delete a.epsilon, t(a); } var i = qe(e); Lf(n, "matrix", zf), Lf(n, "number", qf), Q0(e, n); var o = qe(e), l = qe(n); return r("config", o, i, l), o; } else return qe(e); } return t.MATRIX_OPTIONS = zf, t.NUMBER_OPTIONS = qf, Object.keys(R0).forEach((n) => { Object.defineProperty(t, n, { get: () => e[n], enumerable: !0, configurable: !0 }); }), t; } function Lf(e, r, t) { e[r] !== void 0 && !t.includes(e[r]) && console.warn('Warning: Unknown value "' + e[r] + '" for configuration option "' + r + '". Available options: ' + t.map((n) => JSON.stringify(n)).join(", ") + "."); } function Uf() { return !0; } function Et() { return !1; } function _a() { } const kf = "Argument is not a typed-function."; function rg() { function e(k) { return typeof k == "object" && k !== null && k.constructor === Object; } const r = [{ name: "number", test: function(k) { return typeof k == "number"; } }, { name: "string", test: function(k) { return typeof k == "string"; } }, { name: "boolean", test: function(k) { return typeof k == "boolean"; } }, { name: "Function", test: function(k) { return typeof k == "function"; } }, { name: "Array", test: Array.isArray }, { name: "Date", test: function(k) { return k instanceof Date; } }, { name: "RegExp", test: function(k) { return k instanceof RegExp; } }, { name: "Object", test: e }, { name: "null", test: function(k) { return k === null; } }, { name: "undefined", test: function(k) { return k === void 0; } }], t = { name: "any", test: Uf, isAny: !0 }; let n, a, i = 0, o = { createCount: 0 }; function l(k) { const J = n.get(k); if (J) return J; let G = 'Unknown type "' + k + '"'; const ae = k.toLowerCase(); let fe; for (fe of a) if (fe.toLowerCase() === ae) { G += '. Did you mean "' + fe + '" ?'; break; } throw new TypeError(G); } function u(k) { let J = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "any"; const G = J ? l(J).index : a.length, ae = []; for (let de = 0; de < k.length; ++de) { if (!k[de] || typeof k[de].name != "string" || typeof k[de].test != "function") throw new TypeError("Object with properties {name: string, test: function} expected"); const Ne = k[de].name; if (n.has(Ne)) throw new TypeError('Duplicate type name "' + Ne + '"'); ae.push(Ne), n.set(Ne, { name: Ne, test: k[de].test, isAny: k[de].isAny, index: G + de, conversionsTo: [] // Newly added type can't have any conversions to it }); } const fe = a.slice(G); a = a.slice(0, G).concat(ae).concat(fe); for (let de = G + ae.length; de < a.length; ++de) n.get(a[de]).index = de; } function s() { n = /* @__PURE__ */ new Map(), a = [], i = 0, u([t], !1); } s(), u(r); function c() { let k; for (k of a) n.get(k).conversionsTo = []; i = 0; } function f(k) { const J = a.filter((G) => { const ae = n.get(G); return !ae.isAny && ae.test(k); }); return J.length ? J : ["any"]; } function d(k) { return k && typeof k == "function" && "_typedFunctionData" in k; } function p(k, J, G) { if (!d(k)) throw new TypeError(kf); const ae = G && G.exact, fe = Array.isArray(J) ? J.join(",") : J, de = x(fe), Ne = b(de); if (!ae || Ne in k.signatures) { const ar = k._typedFunctionData.signatureMap.get(Ne); if (ar) return ar; } const we = de.length; let Ee; if (ae) { Ee = []; let ar; for (ar in k.signatures) Ee.push(k._typedFunctionData.signatureMap.get(ar)); } else Ee = k._typedFunctionData.signatures; for (let ar = 0; ar < we; ++ar) { const ir = de[ar], Ue = []; let xr; for (xr of Ee) { const T = E(xr.params, ar); if (!(!T || ir.restParam && !T.restParam)) { if (!T.hasAny) { const Y = h(T); if (ir.types.some((le) => !Y.has(le.name))) continue; } Ue.push(xr); } } if (Ee = Ue, Ee.length === 0) break; } let Ae; for (Ae of Ee) if (Ae.params.length <= we) return Ae; throw new TypeError("Signature not found (signature: " + (k.name || "unnamed") + "(" + b(de, ", ") + "))"); } function m(k, J, G) { return p(k, J, G).implementation; } function v(k, J) { const G = l(J); if (G.test(k)) return k; const ae = G.conversionsTo; if (ae.length === 0) throw new Error("There are no conversions to " + J + " defined."); for (let fe = 0; fe < ae.length; fe++) if (l(ae[fe].from).test(k)) return ae[fe].convert(k); throw new Error("Cannot convert " + k + " to " + J); } function b(k) { let J = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ","; return k.map((G) => G.name).join(J); } function y(k) { const J = k.indexOf("...") === 0, ae = (J ? k.length > 3 ? k.slice(3) : "any" : k).split("|").map((we) => l(we.trim())); let fe = !1, de = J ? "..." : ""; return { types: ae.map(function(we) { return fe = we.isAny || fe, de += we.name + "|", { name: we.name, typeIndex: we.index, test: we.test, isAny: we.isAny, conversion: null, conversionIndex: -1 }; }), name: de.slice(0, -1), // remove trailing '|' from above hasAny: fe, hasConversion: !1, restParam: J }; } function A(k) { const J = k.types.map((Ne) => Ne.name), G = _(J); let ae = k.hasAny, fe = k.name; const de = G.map(function(Ne) { const we = l(Ne.from); return ae = we.isAny || ae, fe += "|" + Ne.from, { name: Ne.from, typeIndex: we.index, test: we.test, isAny: we.isAny, conversion: Ne, conversionIndex: Ne.index }; }); return { types: k.types.concat(de), name: fe, hasAny: ae, hasConversion: de.length > 0, restParam: k.restParam }; } function h(k) { return k.typeSet || (k.typeSet = /* @__PURE__ */ new Set(), k.types.forEach((J) => k.typeSet.add(J.name))), k.typeSet; } function x(k) { const J = []; if (typeof k != "string") throw new TypeError("Signatures must be strings"); const G = k.trim(); if (G === "") return J; const ae = G.split(","); for (let fe = 0; fe < ae.length; ++fe) { const de = y(ae[fe].trim()); if (de.restParam && fe !== ae.length - 1) throw new SyntaxError('Unexpected rest parameter "' + ae[fe] + '": only allowed for the last parameter'); if (de.types.length === 0) return null; J.push(de); } return J; } function w(k) { const J = K(k); return J ? J.restParam : !1; } function g(k) { if (!k || k.types.length === 0) return Uf; if (k.types.length === 1) return l(k.types[0].name).test; if (k.types.length === 2) { const J = l(k.types[0].name).test, G = l(k.types[1].name).test; return function(fe) { return J(fe) || G(fe); }; } else { const J = k.types.map(function(G) { return l(G.name).test; }); return function(ae) { for (let fe = 0; fe < J.length; fe++) if (J[fe](ae)) return !0; return !1; }; } } function D(k) { let J, G, ae; if (w(k)) { J = Z(k).map(g); const fe = J.length, de = g(K(k)), Ne = function(we) { for (let Ee = fe; Ee < we.length; Ee++) if (!de(we[Ee])) return !1; return !0; }; return function(Ee) { for (let Ae = 0; Ae < J.length; Ae++) if (!J[Ae](Ee[Ae])) return !1; return Ne(Ee) && Ee.length >= fe + 1; }; } else return k.length === 0 ? function(de) { return de.length === 0; } : k.length === 1 ? (G = g(k[0]), function(de) { return G(de[0]) && de.length === 1; }) : k.length === 2 ? (G = g(k[0]), ae = g(k[1]), function(de) { return G(de[0]) && ae(de[1]) && de.length === 2; }) : (J = k.map(g), function(de) { for (let Ne = 0; Ne < J.length; Ne++) if (!J[Ne](de[Ne])) return !1; return de.length === J.length; }); } function E(k, J) { return J < k.length ? k[J] : w(k) ? K(k) : null; } function N(k, J) { const G = E(k, J); return G ? h(G) : /* @__PURE__ */ new Set(); } function S(k) { return k.conversion === null || k.conversion === void 0; } function M(k, J) { const G = /* @__PURE__ */ new Set(); return k.forEach((ae) => { const fe = N(ae.params, J); let de; for (de of fe) G.add(de); }), G.has("any") ? ["any"] : Array.from(G); } function F(k, J, G) { let ae, fe; const de = k || "unnamed"; let Ne = G, we; for (we = 0; we < J.length; we++) { const ir = []; if (Ne.forEach((Ue) => { const xr = E(Ue.params, we), T = g(xr); (we < Ue.params.length || w(Ue.params)) && T(J[we]) && ir.push(Ue); }), ir.length === 0) { if (fe = M(Ne, we), fe.length > 0) { const Ue = f(J[we]); return ae = new TypeError("Unexpected type of argument in function " + de + " (expected: " + fe.join(" or ") + ", actual: " + Ue.join(" | ") + ", index: " + we + ")"), ae.data = { category: "wrongType", fn: de, index: we, actual: Ue, expected: fe }, ae; } } else Ne = ir; } const Ee = Ne.map(function(ir) { return w(ir.params) ? 1 / 0 : ir.params.length; }); if (J.length < Math.min.apply(null, Ee)) return fe = M(Ne, we), ae = new TypeError("Too few arguments in function " + de + " (expected: " + fe.join(" or ") + ", index: " + J.length + ")"), ae.data = { category: "tooFewArgs", fn: de, index: J.length, expected: fe }, ae; const Ae = Math.max.apply(null, Ee); if (J.length > Ae) return ae = new TypeError("Too many arguments in function " + de + " (expected: " + Ae + ", actual: " + J.length + ")"), ae.data = { category: "tooManyArgs", fn: de, index: J.length, expectedLength: Ae }, ae; const ar = []; for (let ir = 0; ir < J.length; ++ir) ar.push(f(J[ir]).join("|")); return ae = new TypeError('Arguments of type "' + ar.join(", ") + '" do not match any of the defined signatures of function ' + de + "."), ae.data = { category: "mismatch", actual: ar }, ae; } function $(k) { let J = a.length + 1; for (let G = 0; G < k.types.length; G++) S(k.types[G]) && (J = Math.min(J, k.types[G].typeIndex)); return J; } function I(k) { let J = i + 1; for (let G = 0; G < k.types.length; G++) S(k.types[G]) || (J = Math.min(J, k.types[G].conversionIndex)); return J; } function B(k, J) { if (k.hasAny) { if (!J.hasAny) return 1; } else if (J.hasAny) return -1; if (k.restParam) { if (!J.restParam) return 1; } else if (J.restParam) return -1; if (k.hasConversion) { if (!J.hasConversion) return 1; } else if (J.hasConversion) return -1; const G = $(k) - $(J); if (G < 0) return -1; if (G > 0) return 1; const ae = I(k) - I(J); return ae < 0 ? -1 : ae > 0 ? 1 : 0; } function C(k, J) { const G = k.params, ae = J.params, fe = K(G), de = K(ae), Ne = w(G), we = w(ae); if (Ne && fe.hasAny) { if (!we || !de.hasAny) return 1; } else if (we && de.hasAny) return -1; let Ee = 0, Ae = 0, ar; for (ar of G) ar.hasAny && ++Ee, ar.hasConversion && ++Ae; let ir = 0, Ue = 0; for (ar of ae) ar.hasAny && ++ir, ar.hasConversion && ++Ue; if (Ee !== ir) return Ee - ir; if (Ne && fe.hasConversion) { if (!we || !de.hasConversion) return 1; } else if (we && de.hasConversion) return -1; if (Ae !== Ue) return Ae - Ue; if (Ne) { if (!we) return 1; } else if (we) return -1; const xr = (G.length - ae.length) * (Ne ? -1 : 1); if (xr !== 0) return xr; const T = []; let Y = 0; for (let be = 0; be < G.length; ++be) { const Pe = B(G[be], ae[be]); T.push(Pe), Y += Pe; } if (Y !== 0) return Y; let le; for (le of T) if (le !== 0) return le; return 0; } function _(k) { if (k.length === 0) return []; const J = k.map(l); k.length > 1 && J.sort((fe, de) => fe.index - de.index); let G = J[0].conversionsTo; if (k.length === 1) return G; G = G.concat([]); const ae = new Set(k); for (let fe = 1; fe < J.length; ++fe) { let de; for (de of J[fe].conversionsTo) ae.has(de.from) || (G.push(de), ae.add(de.from)); } return G; } function z(k, J) { let G = J; if (k.some((fe) => fe.hasConversion)) { const fe = w(k), de = k.map(O); G = function() { const we = [], Ee = fe ? arguments.length - 1 : arguments.length; for (let Ae = 0; Ae < Ee; Ae++) we[Ae] = de[Ae](arguments[Ae]); return fe && (we[Ee] = arguments[Ee].map(de[Ee])), J.apply(this, we); }; } let ae = G; if (w(k)) { const fe = k.length - 1; ae = function() { return G.apply(this, j(arguments, 0, fe).concat([j(arguments, fe)])); }; } return ae; } function O(k) { let J, G, ae, fe; const de = [], Ne = []; switch (k.types.forEach(function(we) { we.conversion && (de.push(l(we.conversion.from).test), Ne.push(we.conversion.convert)); }), Ne.length) { case 0: return function(Ee) { return Ee; }; case 1: return J = de[0], ae = Ne[0], function(Ee) { return J(Ee) ? ae(Ee) : Ee; }; case 2: return J = de[0], G = de[1], ae = Ne[0], fe = Ne[1], function(Ee) { return J(Ee) ? ae(Ee) : G(Ee) ? fe(Ee) : Ee; }; default: return function(Ee) { for (let Ae = 0; Ae < Ne.length; Ae++) if (de[Ae](Ee)) return Ne[Ae](Ee); return Ee; }; } } function W(k) { function J(G, ae, fe) { if (ae < G.length) { const de = G[ae]; let Ne = []; if (de.restParam) { const we = de.types.filter(S); we.length < de.types.length && Ne.push({ types: we, name: "..." + we.map((Ee) => Ee.name).join("|"), hasAny: we.some((Ee) => Ee.isAny), hasConversion: !1, restParam: !0 }), Ne.push(de); } else Ne = de.types.map(function(we) { return { types: [we], name: we.name, hasAny: we.isAny, hasConversion: we.conversion, restParam: !1 }; }); return te(Ne, function(we) { return J(G, ae + 1, fe.concat([we])); }); } else return [fe]; } return J(k, 0, []); } function X(k, J) { const G = Math.max(k.length, J.length); for (let we = 0; we < G; we++) { const Ee = N(k, we), Ae = N(J, we); let ar = !1, ir; for (ir of Ae) if (Ee.has(ir)) { ar = !0; break; } if (!ar) return !1; } const ae = k.length, fe = J.length, de = w(k), Ne = w(J); return de ? Ne ? ae === fe : fe >= ae : Ne ? ae >= fe : ae === fe; } function V(k) { return k.map((J) => ne(J) ? L(J.referToSelf.callback) : H(J) ? ge(J.referTo.references, J.referTo.callback) : J); } function R(k, J, G) { const ae = []; let fe; for (fe of k) { let de = G[fe]; if (typeof de != "number") throw new TypeError('No definition for referenced signature "' + fe + '"'); if (de = J[de], typeof de != "function") return !1; ae.push(de); } return ae; } function Q(k, J, G) { const ae = V(k), fe = new Array(ae.length).fill(!1); let de = !0; for (; de; ) { de = !1; let Ne = !0; for (let we = 0; we < ae.length; ++we) { if (fe[we]) continue; const Ee = ae[we]; if (ne(Ee)) ae[we] = Ee.referToSelf.callback(G), ae[we].referToSelf = Ee.referToSelf, fe[we] = !0, Ne = !1; else if (H(Ee)) { const Ae = R(Ee.referTo.references, ae, J); Ae ? (ae[we] = Ee.referTo.callback.apply(this, Ae), ae[we].referTo = Ee.referTo, fe[we] = !0, Ne = !1) : de = !0; } } if (Ne && de) throw new SyntaxError("Circular reference detected in resolving typed.referTo"); } return ae; } function se(k) { const J = /\bthis(\(|\.signatures\b)/; Object.keys(k).forEach((G) => { const ae = k[G]; if (J.test(ae.toString())) throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead."); }); } function re(k, J) { if (o.createCount++, Object.keys(J).length === 0) throw new SyntaxError("No signatures provided"); o.warnAgainstDeprecatedThis && se(J); const G = [], ae = [], fe = {}, de = []; let Ne; for (Ne in J) { if (!Object.prototype.hasOwnProperty.call(J, Ne)) continue; const dr = x(Ne); if (!dr) continue; G.forEach(function(yi) { if (X(yi, dr)) throw new TypeError('Conflicting signatures "' + b(yi) + '" and "' + b(dr) + '".'); }), G.push(dr); const ct = ae.length; ae.push(J[Ne]); const w1 = dr.map(A); let eo; for (eo of W(w1)) { const yi = b(eo); de.push({ params: eo, name: yi, fn: ct }), eo.every((x1) => !x1.hasConversion) && (fe[yi] = ct); } } de.sort(C); const we = Q(ae, fe, gi); let Ee; for (Ee in fe) Object.prototype.hasOwnProperty.call(fe, Ee) && (fe[Ee] = we[fe[Ee]]); const Ae = [], ar = /* @__PURE__ */ new Map(); for (Ee of de) ar.has(Ee.name) || (Ee.fn = we[Ee.fn], Ae.push(Ee), ar.set(Ee.name, Ee)); const ir = Ae[0] && Ae[0].params.length <= 2 && !w(Ae[0].params), Ue = Ae[1] && Ae[1].params.length <= 2 && !w(Ae[1].params), xr = Ae[2] && Ae[2].params.length <= 2 && !w(Ae[2].params), T = Ae[3] && Ae[3].params.length <= 2 && !w(Ae[3].params), Y = Ae[4] && Ae[4].params.length <= 2 && !w(Ae[4].params), le = Ae[5] && Ae[5].params.length <= 2 && !w(Ae[5].params), be = ir && Ue && xr && T && Y && le; for (let dr = 0; dr < Ae.length; ++dr) Ae[dr].test = D(Ae[dr].params); const Pe = ir ? g(Ae[0].params[0]) : Et, Ge = Ue ? g(Ae[1].params[0]) : Et, rt = xr ? g(Ae[2].params[0]) : Et, vi = T ? g(Ae[3].params[0]) : Et, Ls = Y ? g(Ae[4].params[0]) : Et, ji = le ? g(Ae[5].params[0]) : Et, Us = ir ? g(Ae[0].params[1]) : Et, hi = Ue ? g(Ae[1].params[1]) : Et, ks = xr ? g(Ae[2].params[1]) : Et, Vs = T ? g(Ae[3].params[1]) : Et, Hs = Y ? g(Ae[4].params[1]) : Et, Xi = le ? g(Ae[5].params[1]) : Et; for (let dr = 0; dr < Ae.length; ++dr) Ae[dr].implementation = z(Ae[dr].params, Ae[dr].fn); const Zs = ir ? Ae[0].implementation : _a, Gs = Ue ? Ae[1].implementation : _a, Ws = xr ? Ae[2].implementation : _a, Ks = T ? Ae[3].implementation : _a, ce = Y ? Ae[4].implementation : _a, Me = le ? Ae[5].implementation : _a, tr = ir ? Ae[0].params.length : -1, hr = Ue ? Ae[1].params.length : -1, Jt = xr ? Ae[2].params.length : -1, Tn = T ? Ae[3].params.length : -1, Sa = Y ? Ae[4].params.length : -1, un = le ? Ae[5].params.length : -1, Dt = be ? 6 : 0, Qi = Ae.length, g1 = Ae.map((dr) => dr.test), y1 = Ae.map((dr) => dr.implementation), b1 = function() { for (let ct = Dt; ct < Qi; ct++) if (g1[ct](arguments)) return y1[ct].apply(this, arguments); return o.onMismatch(k, arguments, Ae); }; function gi(dr, ct) { return arguments.length === tr && Pe(dr) && Us(ct) ? Zs.apply(this, arguments) : arguments.length === hr && Ge(dr) && hi(ct) ? Gs.apply(this, arguments) : arguments.length === Jt && rt(dr) && ks(ct) ? Ws.apply(this, arguments) : arguments.length === Tn && vi(dr) && Vs(ct) ? Ks.apply(this, arguments) : arguments.length === Sa && Ls(dr) && Hs(ct) ? ce.apply(this, arguments) : arguments.length === un && ji(dr) && Xi(ct) ? Me.apply(this, arguments) : b1.apply(this, arguments); } try { Object.defineProperty(gi, "name", { value: k }); } catch { } return gi.signatures = fe, gi._typedFunctionData = { signatures: Ae, signatureMap: ar }, gi; } function q(k, J, G) { throw F(k, J, G); } function Z(k) { return j(k, 0, k.length - 1); } function K(k) { return k[k.length - 1]; } function j(k, J, G) { return Array.prototype.slice.call(k, J, G); } function ee(k, J) { for (let G = 0; G < k.length; G++) if (J(k[G])) return k[G]; } function te(k, J) { return Array.prototype.concat.apply([], k.map(J)); } function oe() { const k = Z(arguments).map((G) => b(x(G))), J = K(arguments); if (typeof J != "function") throw new TypeError("Callback function expected as last argument"); return ge(k, J); } function ge(k, J) { return { referTo: { references: k, callback: J } }; } function L(k) { if (typeof k != "function") throw new TypeError("Callback function expected as first argument"); return { referToSelf: { callback: k } }; } function H(k) { return k && typeof k.referTo == "object" && Array.isArray(k.referTo.references) && typeof k.referTo.callback == "function"; } function ne(k) { return k && typeof k.referToSelf == "object" && typeof k.referToSelf.callback == "function"; } function ie(k, J) { if (!k) return J; if (J && J !== k) { const G = new Error("Function names do not match (expected: " + k + ", actual: " + J + ")"); throw G.data = { actual: J, expected: k }, G; } return k; } function me(k) { let J; for (const G in k) Object.prototype.hasOwnProperty.call(k, G) && (d(k[G]) || typeof k[G].signature == "string") && (J = ie(J, k[G].name)); return J; } function pe(k, J) { let G; for (G in J) if (Object.prototype.hasOwnProperty.call(J, G)) { if (G in k && J[G] !== k[G]) { const ae = new Error('Signature "' + G + '" is defined twice'); throw ae.data = { signature: G, sourceFunction: J[G], destFunction: k[G] }, ae; } k[G] = J[G]; } } const xe = o; o = function(k) { const J = typeof k == "string", G = J ? 1 : 0; let ae = J ? k : ""; const fe = {}; for (let de = G; de < arguments.length; ++de) { const Ne = arguments[de]; let we = {}, Ee; if (typeof Ne == "function" ? (Ee = Ne.name, typeof Ne.signature == "string" ? we[Ne.signature] = Ne : d(Ne) && (we = Ne.signatures)) : e(Ne) && (we = Ne, J || (Ee = me(Ne))), Object.keys(we).length === 0) { const Ae = new TypeError("Argument to 'typed' at index " + de + " is not a (typed) function, nor an object with signatures as keys and functions as values."); throw Ae.data = { index: de, argument: Ne }, Ae; } J || (ae = ie(ae, Ee)), pe(fe, we); } return re(ae || "", fe); }, o.create = rg, o.createCount = xe.createCount, o.onMismatch = q, o.throwMismatchError = q, o.createError = F, o.clear = s, o.clearConversions = c, o.addTypes = u, o._findType = l, o.referTo = oe, o.referToSelf = L, o.convert = v, o.findSignature = p, o.find = m, o.isTypedFunction = d, o.warnAgainstDeprecatedThis = !0, o.addType = function(k, J) { let G = "any"; J !== !1 && n.has("Object") && (G = "Object"), o.addTypes([k], G); }; function De(k) { if (!k || typeof k.from != "string" || typeof k.to != "string" || typeof k.convert != "function") throw new TypeError("Object with properties {from: string, to: string, convert: function} expected"); if (k.to === k.from) throw new SyntaxError('Illegal to define conversion from "' + k.from + '" to itself.'); } return o.addConversion = function(k) { let J = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { override: !1 }; De(k); const G = l(k.to), ae = G.conversionsTo.find((fe) => fe.from === k.from); if (ae) if (J && J.override) o.removeConversion({ from: ae.from, to: k.to, convert: ae.convert }); else throw new Error('There is already a conversion from "' + k.from + '" to "' + G.name + '"'); G.conversionsTo.push({ from: k.from, convert: k.convert, index: i++ }); }, o.addConversions = function(k, J) { k.forEach((G) => o.addConversion(G, J)); }, o.removeConversion = function(k) { De(k); const J = l(k.to), G = ee(J.conversionsTo, (fe) => fe.from === k.from); if (!G) throw new Error("Attempt to remove nonexistent conversion from " + k.from + " to " + k.to); if (G.convert !== k.convert) throw new Error("Conversion to remove does not match existing conversion"); const ae = J.conversionsTo.indexOf(G); J.conversionsTo.splice(ae, 1); }, o.resolve = function(k, J) { if (!d(k)) throw new TypeError(kf); const G = k._typedFunctionData.signatures; for (let ae = 0; ae < G.length; ++ae) if (G[ae].test(J)) return G[ae]; return null; }, o; } const Pi = rg(); function P(e, r, t, n) { function a(i) { var o = EC(i, r.map(tg)); return CC(e, r, i), t(o); } return a.isFactory = !0, a.fn = e, a.dependencies = r.slice().sort(), n && (a.meta = n), a; } function _i(e) { return typeof e == "function" && typeof e.fn == "string" && Array.isArray(e.dependencies); } function CC(e, r, t) { var n = r.filter((i) => !MC(i)).every((i) => t[i] !== void 0); if (!n) { var a = r.filter((i) => t[i] === void 0); throw new Error('Cannot create function "'.concat(e, '", ') + "some dependencies are missing: ".concat(a.map((i) => '"'.concat(i, '"')).join(", "), ".")); } } function MC(e) { return e && e[0] === "?"; } function tg(e) { return e && e[0] === "?" ? e.slice(1) : e; } function Oe(e) { return typeof e == "boolean" ? !0 : isFinite(e) ? e === Math.round(e) : !1; } function _C(e) { return /^-?\d+$/.test(e); } function Qn(e, r) { return r.number === "bigint" && !_C(e) ? r.numberFallback : r.number; } var Vn = Math.sign || function(e) { return e > 0 ? 1 : e < 0 ? -1 : 0; }, FC = Math.log2 || function(r) { return Math.log(r) / Math.LN2; }, TC = Math.log10 || function(r) { return Math.log(r) / Math.LN10; }, OC = Math.log1p || function(e) { return Math.log(e + 1); }, BC = Math.cbrt || function(r) { if (r === 0) return r; var t = r < 0, n; return t && (r = -r), isFinite(r) ? (n = Math.exp(Math.log(r) / 3), n = (r / (n * n) + 2 * n) / 3) : n = r, t ? -n : n; }, $C = Math.expm1 || function(r) { return r >= 2e-4 || r <= -2e-4 ? Math.exp(r) - 1 : r + r * r / 2 + r * r * r / 6; }; function uu(e, r, t) { var n = { 2: "0b", 8: "0o", 16: "0x" }, a = n[r], i = ""; if (t) { if (t < 1) throw new Error("size must be in greater than 0"); if (!Oe(t)) throw new Error("size must be an integer"); if (e > 2 ** (t - 1) - 1 || e < -(2 ** (t - 1))) throw new Error("Value must be in range [-2^".concat(t - 1, ", 2^").concat(t - 1, "-1]")); if (!Oe(e)) throw new Error("Value must be an integer"); e < 0 && (e = e + 2 ** t), i = "i".concat(t); } var o = ""; return e < 0 && (e = -e, o = "-"), "".concat(o).concat(a).concat(e.toString(r)).concat(i); } function pa(e, r) { if (typeof r == "function") return r(e); if (e === 1 / 0) return "Infinity"; if (e === -1 / 0) return "-Infinity"; if (isNaN(e)) return "NaN"; var { notation: t, precision: n, wordSize: a } = ng(r); switch (t) { case "fixed": return ag(e, n); case "exponential": return ig(e, n); case "engineering": return IC(e, n); case "bin": return uu(e, 2, a); case "oct": return uu(e, 8, a); case "hex": return uu(e, 16, a); case "auto": return RC(e, n, r).replace(/((\.\d*?)(0+))($|e)/, function() { var i = arguments[2], o = arguments[4]; return i !== "." ? i + o : o; }); default: throw new Error('Unknown notation "' + t + '". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.'); } } function ng(e) { var r = "auto", t, n; if (e !== void 0) if (We(e)) t = e; else if (Ze(e)) t = e.toNumber(); else if (ui(e)) e.precision !== void 0 && (t = Vf(e.precision, () => { throw new Error('Option "precision" must be a number or BigNumber'); })), e.wordSize !== void 0 && (n = Vf(e.wordSize, () => { throw new Error('Option "wordSize" must be a number or BigNumber'); })), e.notation && (r = e.notation); else throw new Error("Unsupported type of options, number, BigNumber, or object expected"); return { notation: r, precision: t, wordSize: n }; } function Ki(e) { var r = String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/); if (!r) throw new SyntaxError("Invalid number " + e); var t = r[1], n = r[2], a = parseFloat(r[4] || "0"), i = n.indexOf("."); a += i !== -1 ? i - 1 : n.length - 1; var o = n.replace(".", "").replace(/^0*/, function(l) { return a -= l.length, ""; }).replace(/0*$/, "").split("").map(function(l) { return parseInt(l); }); return o.length === 0 && (o.push(0), a++), { sign: t, coefficients: o, exponent: a }; } function IC(e, r) { if (isNaN(e) || !isFinite(e)) return String(e); var t = Ki(e), n = _s(t, r), a = n.exponent, i = n.coefficients, o = a % 3 === 0 ? a : a < 0 ? a - 3 - a % 3 : a - a % 3; if (We(r)) for (; r > i.length || a - o + 1 > i.length; ) i.push(0); else for (var l = Math.abs(a - o) - (i.length - 1), u = 0; u < l; u++) i.push(0); for (var s = Math.abs(a - o), c = 1; s > 0; ) c++, s--; var f = i.slice(c).join(""), d = We(r) && f.length || f.match(/[1-9]/) ? "." + f : "", p = i.slice(0, c).join("") + d + "e" + (a >= 0 ? "+" : "") + o.toString(); return n.sign + p; } function ag(e, r) { if (isNaN(e) || !isFinite(e)) return String(e); var t = Ki(e), n = typeof r == "number" ? _s(t, t.exponent + 1 + r) : t, a = n.coefficients, i = n.exponent + 1, o = i + (r || 0); return a.length < o && (a = a.concat(Ua(o - a.length))), i < 0 && (a = Ua(-i + 1).concat(a), i = 1), i < a.length && a.splice(i, 0, i === 0 ? "0." : "."), n.sign + a.join(""); } function ig(e, r) { if (isNaN(e) || !isFinite(e)) return String(e); var t = Ki(e), n = r ? _s(t, r) : t, a = n.coefficients, i = n.exponent; a.length < r && (a = a.concat(Ua(r - a.length))); var o = a.shift(); return n.sign + o + (a.length > 0 ? "." + a.join("") : "") + "e" + (i >= 0 ? "+" : "") + i; } function RC(e, r, t) { if (isNaN(e) || !isFinite(e)) return String(e); var n = Hf(t == null ? void 0 : t.lowerExp, -3), a = Hf(t == null ? void 0 : t.upperExp, 5), i = Ki(e), o = r ? _s(i, r) : i; if (o.exponent < n || o.exponent >= a) return ig(e, r); var l = o.coefficients, u = o.exponent; l.length < r && (l = l.concat(Ua(r - l.length))), l = l.concat(Ua(u - l.length + 1 + (l.length < r ? r - l.length : 0))), l = Ua(-u).concat(l); var s = u > 0 ? u : 0; return s < l.length - 1 && l.splice(s + 1, 0, "."), o.sign + l.join(""); } function _s(e, r) { for (var t = { sign: e.sign, coefficients: e.coefficients, exponent: e.exponent }, n = t.coefficients; r <= 0; ) n.unshift(0), t.exponent++, r++; if (n.length > r) { var a = n.splice(r, n.length - r); if (a[0] >= 5) { var i = r - 1; for (n[i]++; n[i] === 10; ) n.pop(), i === 0 && (n.unshift(0), t.exponent++, i++), i--, n[i]++; } } return t; } function Ua(e) { for (var r = [], t = 0; t < e; t++) r.push(0); return r; } function PC(e) { return e.toExponential().replace(/e.*$/, "").replace(/^0\.?0*|\./, "").length; } function Gr(e, r) { var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1e-8, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0; if (t <= 0) throw new Error("Relative tolerance must be greater than 0"); if (n < 0) throw new Error("Absolute tolerance must be at least 0"); return isNaN(e) || isNaN(r) ? !1 : !isFinite(e) || !isFinite(r) ? e === r : e === r ? !0 : Math.abs(e - r) <= Math.max(t * Math.max(Math.abs(e), Math.abs(r)), n); } var zC = Math.acosh || function(e) { return Math.log(Math.sqrt(e * e - 1) + e); }, qC = Math.asinh || function(e) { return Math.log(Math.sqrt(e * e + 1) + e); }, LC = Math.atanh || function(e) { return Math.log((1 + e) / (1 - e)) / 2; }, UC = Math.cosh || function(e) { return (Math.exp(e) + Math.exp(-e)) / 2; }, kC = Math.sinh || function(e) { return (Math.exp(e) - Math.exp(-e)) / 2; }, VC = Math.tanh || function(e) { var r = Math.exp(2 * e); return (r - 1) / (r + 1); }; function HC(e, r) { var t = !0, n = r > 0 ? !0 : r < 0 ? !1 : 1 / r === 1 / 0; return t ^ n ? -e : e; } function Vf(e, r) { if (We(e)) return e; if (Ze(e)) return e.toNumber(); r(); } function Hf(e, r) { return We(e) ? e : Ze(e) ? e.toNumber() : r; } var og = function() { return og = Pi.create, Pi; }, ZC = ["?BigNumber", "?Complex", "?DenseMatrix", "?Fraction"], GC = /* @__PURE__ */ P("typed", ZC, function(r) { var { BigNumber: t, Complex: n, DenseMatrix: a, Fraction: i } = r, o = og(); return o.clear(), o.addTypes([ { name: "number", test: We }, { name: "Complex", test: Ut }, { name: "BigNumber", test: Ze }, { name: "bigint", test: q0 }, { name: "Fraction", test: Aa }, { name: "Unit", test: ft }, // The following type matches a valid variable name, i.e., an alphanumeric // string starting with an alphabetic character. It is used (at least) // in the definition of the derivative() function, as the argument telling // what to differentiate over must (currently) be a variable. // TODO: deprecate the identifier type (it's not used anymore, see https://github.com/josdejong/mathjs/issues/3253) { name: "identifier", test: (l) => Vr && /^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(l) }, { name: "string", test: Vr }, { name: "Chain", test: Pl }, { name: "Array", test: cr }, { name: "Matrix", test: ze }, { name: "DenseMatrix", test: Ri }, { name: "SparseMatrix", test: kn }, { name: "Range", test: Ms }, { name: "Index", test: Gi }, { name: "boolean", test: L0 }, { name: "ResultSet", test: U0 }, { name: "Help", test: Rl }, { name: "function", test: k0 }, { name: "Date", test: V0 }, { name: "RegExp", test: H0 }, { name: "null", test: Z0 }, { name: "undefined", test: G0 }, { name: "AccessorNode", test: Jn }, { name: "ArrayNode", test: bt }, { name: "AssignmentNode", test: W0 }, { name: "BlockNode", test: K0 }, { name: "ConditionalNode", test: J0 }, { name: "ConstantNode", test: nr }, { name: "FunctionNode", test: En }, { name: "FunctionAssignmentNode", test: li }, { name: "IndexNode", test: Na }, { name: "Node", test: fr }, { name: "ObjectNode", test: Wi }, { name: "OperatorNode", test: _r }, { name: "ParenthesisNode", test: rn }, { name: "RangeNode", test: Y0 }, { name: "RelationalNode", test: j0 }, { name: "SymbolNode", test: $r }, { name: "Map", test: da }, { name: "Object", test: ui } // order 'Object' last, it matches on other classes too ]), o.addConversions([{ from: "number", to: "BigNumber", convert: function(u) { if (t || co(u), PC(u) > 15) throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: " + u + "). Use function bignumber(x) to convert to BigNumber."); return new t(u); } }, { from: "number", to: "Complex", convert: function(u) { return n || fo(u), new n(u, 0); } }, { from: "BigNumber", to: "Complex", convert: function(u) { return n || fo(u), new n(u.toNumber(), 0); } }, { from: "bigint", to: "number", convert: function(u) { if (u > Number.MAX_SAFE_INTEGER) throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: " + u + ")"); return Number(u); } }, { from: "bigint", to: "BigNumber", convert: function(u) { return t || co(u), new t(u.toString()); } }, { from: "bigint", to: "Fraction", convert: function(u) { return i || po(u), new i(u.toString()); } }, { from: "Fraction", to: "BigNumber", convert: function(u) { throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction."); } }, { from: "Fraction", to: "Complex", convert: function(u) { return n || fo(u), new n(u.valueOf(), 0); } }, { from: "number", to: "Fraction", convert: function(u) { i || po(u); var s = new i(u); if (s.valueOf() !== u) throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: " + u + "). Use function fraction(x) to convert to Fraction."); return s; } }, { // FIXME: add conversion from Fraction to number, for example for `sqrt(fraction(1,3))` // from: 'Fraction', // to: 'number', // convert: function (x) { // return x.valueOf() // } // }, { from: "string", to: "number", convert: function(u) { var s = Number(u); if (isNaN(s)) throw new Error('Cannot convert "' + u + '" to a number'); return s; } }, { from: "string", to: "BigNumber", convert: function(u) { t || co(u); try { return new t(u); } catch { throw new Error('Cannot convert "' + u + '" to BigNumber'); } } }, { from: "string", to: "bigint", convert: function(u) { try { return BigInt(u); } catch { throw new Error('Cannot convert "' + u + '" to BigInt'); } } }, { from: "string", to: "Fraction", convert: function(u) { i || po(u); try { return new i(u); } catch { throw new Error('Cannot convert "' + u + '" to Fraction'); } } }, { from: "string", to: "Complex", convert: function(u) { n || fo(u); try { return new n(u); } catch { throw new Error('Cannot convert "' + u + '" to Complex'); } } }, { from: "boolean", to: "number", convert: function(u) { return +u; } }, { from: "boolean", to: "BigNumber", convert: function(u) { return t || co(u), new t(+u); } }, { from: "boolean", to: "bigint", convert: function(u) { return BigInt(+u); } }, { from: "boolean", to: "Fraction", convert: function(u) { return i || po(u), new i(+u); } }, { from: "boolean", to: "string", convert: function(u) { return String(u); } }, { from: "Array", to: "Matrix", convert: function(u) { return a || WC(), new a(u); } }, { from: "Matrix", to: "Array", convert: function(u) { return u.valueOf(); } }]), o.onMismatch = (l, u, s) => { var c = o.createError(l, u, s); if (["wrongType", "mismatch"].includes(c.data.category) && u.length === 1 && At(u[0]) && // check if the function can be unary: s.some((d) => !d.params.includes(","))) { var f = new TypeError("Function '".concat(l, "' doesn't apply to matrices. To call it ") + "elementwise on a matrix 'M', try 'map(M, ".concat(l, ")'.")); throw f.data = c.data, f; } throw c; }, o.onMismatch = (l, u, s) => { var c = o.createError(l, u, s); if (["wrongType", "mismatch"].includes(c.data.category) && u.length === 1 && At(u[0]) && // check if the function can be unary: s.some((d) => !d.params.includes(","))) { var f = new TypeError("Function '".concat(l, "' doesn't apply to matrices. To call it ") + "elementwise on a matrix 'M', try 'map(M, ".concat(l, ")'.")); throw f.data = c.data, f; } throw c; }, o; }); function co(e) { throw new Error("Cannot convert value ".concat(e, " into a BigNumber: no class 'BigNumber' provided")); } function fo(e) { throw new Error("Cannot convert value ".concat(e, " into a Complex number: no class 'Complex' provided")); } function WC() { throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided"); } function po(e) { throw new Error("Cannot convert value ".concat(e, " into a Fraction, no class 'Fraction' provided.")); } var KC = "ResultSet", JC = [], YC = /* @__PURE__ */ P(KC, JC, () => { function e(r) { if (!(this instanceof e)) throw new SyntaxError("Constructor must be called with the new operator"); this.entries = r || []; } return e.prototype.type = "ResultSet", e.prototype.isResultSet = !0, e.prototype.valueOf = function() { return this.entries; }, e.prototype.toString = function() { return "[" + this.entries.map(String).join(", ") + "]"; }, e.prototype.toJSON = function() { return { mathjs: "ResultSet", entries: this.entries }; }, e.fromJSON = function(r) { return new e(r.entries); }, e; }, { isClass: !0 }); /*! * decimal.js v10.6.0 * An arbitrary-precision Decimal type for JavaScript. * https://github.com/MikeMcl/decimal.js * Copyright (c) 2025 Michael Mclaughlin * MIT Licence */ var Ra = 9e15, ea = 1e9, zu = "0123456789abcdef", Go = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", Wo = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", qu = { // 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: -Ra, // -1 to -EXP_LIMIT // The maximum exponent value, above which overflow to Infinity occurs. // JavaScript numbers: 308 (1.7976931348623157e+308) maxE: Ra, // 1 to EXP_LIMIT // Whether to use cryptographically-secure random number generation, if available. crypto: !1 // true/false }, sg, bn, Ke = !0, Fs = "[DecimalError] ", Yn = Fs + "Invalid argument: ", ug = Fs + "Precision limit exceeded", lg = Fs + "crypto unavailable", cg = "[object Decimal]", Qr = Math.floor, Br = Math.pow, jC = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, XC = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, QC = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, fg = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, kt = 1e7, Le = 7, eM = 9007199254740991, rM = Go.length - 1, Lu = Wo.length - 1, ye = { toStringTag: cg }; ye.absoluteValue = ye.abs = function() { var e = new this.constructor(this); return e.s < 0 && (e.s = 1), Ie(e); }; ye.ceil = function() { return Ie(new this.constructor(this), this.e + 1, 2); }; ye.clampedTo = ye.clamp = function(e, r) { var t, n = this, a = n.constructor; if (e = new a(e), r = new a(r), !e.s || !r.s) return new a(NaN); if (e.gt(r)) throw Error(Yn + r); return t = n.cmp(e), t < 0 ? e : n.cmp(r) > 0 ? r : new a(n); }; ye.comparedTo = ye.cmp = function(e) { var r, t, n, a, i = this, o = i.d, l = (e = new i.constructor(e)).d, u = i.s, s = e.s; if (!o || !l) return !u || !s ? NaN : u !== s ? u : o === l ? 0 : !o ^ u < 0 ? 1 : -1; if (!o[0] || !l[0]) return o[0] ? u : l[0] ? -s : 0; if (u !== s) return u; if (i.e !== e.e) return i.e > e.e ^ u < 0 ? 1 : -1; for (n = o.length, a = l.length, r = 0, t = n < a ? n : a; r < t; ++r) if (o[r] !== l[r]) return o[r] > l[r] ^ u < 0 ? 1 : -1; return n === a ? 0 : n > a ^ u < 0 ? 1 : -1; }; ye.cosine = ye.cos = function() { var e, r, t = this, n = t.constructor; return t.d ? t.d[0] ? (e = n.precision, r = n.rounding, n.precision = e + Math.max(t.e, t.sd()) + Le, n.rounding = 1, t = tM(n, hg(n, t)), n.precision = e, n.rounding = r, Ie(bn == 2 || bn == 3 ? t.neg() : t, e, r, !0)) : new n(1) : new n(NaN); }; ye.cubeRoot = ye.cbrt = function() { var e, r, t, n, a, i, o, l, u, s, c = this, f = c.constructor; if (!c.isFinite() || c.isZero()) return new f(c); for (Ke = !1, i = c.s * Br(c.s * c, 1 / 3), !i || Math.abs(i) == 1 / 0 ? (t = Hr(c.d), e = c.e, (i = (e - t.length + 1) % 3) && (t += i == 1 || i == -2 ? "0" : "00"), i = Br(t, 1 / 3), e = Qr((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)), i == 1 / 0 ? t = "5e" + e : (t = i.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + e), n = new f(t), n.s = c.s) : n = new f(i.toString()), o = (e = f.precision) + 3; ; ) if (l = n, u = l.times(l).times(l), s = u.plus(c), n = wr(s.plus(c).times(l), s.plus(u), o + 2, 1), Hr(l.d).slice(0, o) === (t = Hr(n.d)).slice(0, o)) if (t = t.slice(o - 3, o + 1), t == "9999" || !a && t == "4999") { if (!a && (Ie(l, e + 1, 0), l.times(l).times(l).eq(c))) { n = l; break; } o += 4, a = 1; } else { (!+t || !+t.slice(1) && t.charAt(0) == "5") && (Ie(n, e + 1, 1), r = !n.times(n).times(n).eq(c)); break; } return Ke = !0, Ie(n, e, f.rounding, r); }; ye.decimalPlaces = ye.dp = function() { var e, r = this.d, t = NaN; if (r) { if (e = r.length - 1, t = (e - Qr(this.e / Le)) * Le, e = r[e], e) for (; e % 10 == 0; e /= 10) t--; t < 0 && (t = 0); } return t; }; ye.dividedBy = ye.div = function(e) { return wr(this, new this.constructor(e)); }; ye.dividedToIntegerBy = ye.divToInt = function(e) { var r = this, t = r.constructor; return Ie(wr(r, new t(e), 0, 1, 1), t.precision, t.rounding); }; ye.equals = ye.eq = function(e) { return this.cmp(e) === 0; }; ye.floor = function() { return Ie(new this.constructor(this), this.e + 1, 3); }; ye.greaterThan = ye.gt = function(e) { return this.cmp(e) > 0; }; ye.greaterThanOrEqualTo = ye.gte = function(e) { var r = this.cmp(e); return r == 1 || r === 0; }; ye.hyperbolicCosine = ye.cosh = function() { var e, r, t, n, a, i = this, o = i.constructor, l = new o(1); if (!i.isFinite()) return new o(i.s ? 1 / 0 : NaN); if (i.isZero()) return l; t = o.precision, n = o.rounding, o.precision = t + Math.max(i.e, i.sd()) + 4, o.rounding = 1, a = i.d.length, a < 32 ? (e = Math.ceil(a / 3), r = (1 / Os(4, e)).toString()) : (e = 16, r = "2.3283064365386962890625e-10"), i = Qa(o, 1, i.times(r), new o(1), !0); for (var u, s = e, c = new o(8); s--; ) u = i.times(i), i = l.minus(u.times(c.minus(u.times(c)))); return Ie(i, o.precision = t, o.rounding = n, !0); }; ye.hyperbolicSine = ye.sinh = function() { var e, r, t, n, a = this, i = a.constructor; if (!a.isFinite() || a.isZero()) return new i(a); if (r = i.precision, t = i.rounding, i.precision = r + Math.max(a.e, a.sd()) + 4, i.rounding = 1, n = a.d.length, n < 3) a = Qa(i, 2, a, a, !0); else { e = 1.4 * Math.sqrt(n), e = e > 16 ? 16 : e | 0, a = a.times(1 / Os(5, e)), a = Qa(i, 2, a, a, !0); for (var o, l = new i(5), u = new i(16), s = new i(20); e--; ) o = a.times(a), a = a.times(l.plus(o.times(u.times(o).plus(s)))); } return i.precision = r, i.rounding = t, Ie(a, r, t, !0); }; ye.hyperbolicTangent = ye.tanh = function() { var e, r, t = this, n = t.constructor; return t.isFinite() ? t.isZero() ? new n(t) : (e = n.precision, r = n.rounding, n.precision = e + 7, n.rounding = 1, wr(t.sinh(), t.cosh(), n.precision = e, n.rounding = r)) : new n(t.s); }; ye.inverseCosine = ye.acos = function() { var e = this, r = e.constructor, t = e.abs().cmp(1), n = r.precision, a = r.rounding; return t !== -1 ? t === 0 ? e.isNeg() ? jt(r, n, a) : new r(0) : new r(NaN) : e.isZero() ? jt(r, n + 4, a).times(0.5) : (r.precision = n + 6, r.rounding = 1, e = new r(1).minus(e).div(e.plus(1)).sqrt().atan(), r.precision = n, r.rounding = a, e.times(2)); }; ye.inverseHyperbolicCosine = ye.acosh = function() { var e, r, t = this, n = t.constructor; return t.lte(1) ? new n(t.eq(1) ? 0 : NaN) : t.isFinite() ? (e = n.precision, r = n.rounding, n.precision = e + Math.max(Math.abs(t.e), t.sd()) + 4, n.rounding = 1, Ke = !1, t = t.times(t).minus(1).sqrt().plus(t), Ke = !0, n.precision = e, n.rounding = r, t.ln()) : new n(t); }; ye.inverseHyperbolicSine = ye.asinh = function() { var e, r, t = this, n = t.constructor; return !t.isFinite() || t.isZero() ? new n(t) : (e = n.precision, r = n.rounding, n.precision = e + 2 * Math.max(Math.abs(t.e), t.sd()) + 6, n.rounding = 1, Ke = !1, t = t.times(t).plus(1).sqrt().plus(t), Ke = !0, n.precision = e, n.rounding = r, t.ln()); }; ye.inverseHyperbolicTangent = ye.atanh = function() { var e, r, t, n, a = this, i = a.constructor; return a.isFinite() ? a.e >= 0 ? new i(a.abs().eq(1) ? a.s / 0 : a.isZero() ? a : NaN) : (e = i.precision, r = i.rounding, n = a.sd(), Math.max(n, e) < 2 * -a.e - 1 ? Ie(new i(a), e, r, !0) : (i.precision = t = n - a.e, a = wr(a.plus(1), new i(1).minus(a), t + e, 1), i.precision = e + 4, i.rounding = 1, a = a.ln(), i.precision = e, i.rounding = r, a.times(0.5))) : new i(NaN); }; ye.inverseSine = ye.asin = function() { var e, r, t, n, a = this, i = a.constructor; return a.isZero() ? new i(a) : (r = a.abs().cmp(1), t = i.precision, n = i.rounding, r !== -1 ? r === 0 ? (e = jt(i, t + 4, n).times(0.5), e.s = a.s, e) : new i(NaN) : (i.precision = t + 6, i.rounding = 1, a = a.div(new i(1).minus(a.times(a)).sqrt().plus(1)).atan(), i.precision = t, i.rounding = n, a.times(2))); }; ye.inverseTangent = ye.atan = function() { var e, r, t, n, a, i, o, l, u, s = this, c = s.constructor, f = c.precision, d = c.rounding; if (s.isFinite()) { if (s.isZero()) return new c(s); if (s.abs().eq(1) && f + 4 <= Lu) return o = jt(c, f + 4, d).times(0.25), o.s = s.s, o; } else { if (!s.s) return new c(NaN); if (f + 4 <= Lu) return o = jt(c, f + 4, d).times(0.5), o.s = s.s, o; } for (c.precision = l = f + 10, c.rounding = 1, t = Math.min(28, l / Le + 2 | 0), e = t; e; --e) s = s.div(s.times(s).plus(1).sqrt().plus(1)); for (Ke = !1, r = Math.ceil(l / Le), n = 1, u = s.times(s), o = new c(s), a = s; e !== -1; ) if (a = a.times(u), i = o.minus(a.div(n += 2)), a = a.times(u), o = i.plus(a.div(n += 2)), o.d[r] !== void 0) for (e = r; o.d[e] === i.d[e] && e--; ) ; return t && (o = o.times(2 << t - 1)), Ke = !0, Ie(o, c.precision = f, c.rounding = d, !0); }; ye.isFinite = function() { return !!this.d; }; ye.isInteger = ye.isInt = function() { return !!this.d && Qr(this.e / Le) > this.d.length - 2; }; ye.isNaN = function() { return !this.s; }; ye.isNegative = ye.isNeg = function() { return this.s < 0; }; ye.isPositive = ye.isPos = function() { return this.s > 0; }; ye.isZero = function() { return !!this.d && this.d[0] === 0; }; ye.lessThan = ye.lt = function(e) { return this.cmp(e) < 0; }; ye.lessThanOrEqualTo = ye.lte = function(e) { return this.cmp(e) < 1; }; ye.logarithm = ye.log = function(e) { var r, t, n, a, i, o, l, u, s = this, c = s.constructor, f = c.precision, d = c.rounding, p = 5; if (e == null) e = new c(10), r = !0; else { if (e = new c(e), t = e.d, e.s < 0 || !t || !t[0] || e.eq(1)) return new c(NaN); r = e.eq(10); } if (t = s.d, s.s < 0 || !t || !t[0] || s.eq(1)) return new c(t && !t[0] ? -1 / 0 : s.s != 1 ? NaN : t ? 0 : 1 / 0); if (r) if (t.length > 1) i = !0; else { for (a = t[0]; a % 10 === 0; ) a /= 10; i = a !== 1; } if (Ke = !1, l = f + p, o = Hn(s, l), n = r ? Ko(c, l + 10) : Hn(e, l), u = wr(o, n, l, 1), zi(u.d, a = f, d)) do if (l += 10, o = Hn(s, l), n = r ? Ko(c, l + 10) : Hn(e, l), u = wr(o, n, l, 1), !i) { +Hr(u.d).slice(a + 1, a + 15) + 1 == 1e14 && (u = Ie(u, f + 1, 0)); break; } while (zi(u.d, a += 10, d)); return Ke = !0, Ie(u, f, d); }; ye.minus = ye.sub = function(e) { var r, t, n, a, i, o, l, u, s, c, f, d, p = this, m = p.constructor; if (e = new m(e), !p.d || !e.d) return !p.s || !e.s ? e = new m(NaN) : p.d ? e.s = -e.s : e = new m(e.d || p.s !== e.s ? p : NaN), e; if (p.s != e.s) return e.s = -e.s, p.plus(e); if (s = p.d, d = e.d, l = m.precision, u = m.rounding, !s[0] || !d[0]) { if (d[0]) e.s = -e.s; else if (s[0]) e = new m(p); else return new m(u === 3 ? -0 : 0); return Ke ? Ie(e, l, u) : e; } if (t = Qr(e.e / Le), c = Qr(p.e / Le), s = s.slice(), i = c - t, i) { for (f = i < 0, f ? (r = s, i = -i, o = d.length) : (r = d, t = c, o = s.length), n = Math.max(Math.ceil(l / Le), o) + 2, i > n && (i = n, r.length = 1), r.reverse(), n = i; n--; ) r.push(0); r.reverse(); } else { for (n = s.length, o = d.length, f = n < o, f && (o = n), n = 0; n < o; n++) if (s[n] != d[n]) { f = s[n] < d[n]; break; } i = 0; } for (f && (r = s, s = d, d = r, e.s = -e.s), o = s.length, n = d.length - o; n > 0; --n) s[o++] = 0; for (n = d.length; n > i; ) { if (s[--n] < d[n]) { for (a = n; a && s[--a] === 0; ) s[a] = kt - 1; --s[a], s[n] += kt; } s[n] -= d[n]; } for (; s[--o] === 0; ) s.pop(); for (; s[0] === 0; s.shift()) --t; return s[0] ? (e.d = s, e.e = Ts(s, t), Ke ? Ie(e, l, u) : e) : new m(u === 3 ? -0 : 0); }; ye.modulo = ye.mod = function(e) { var r, t = this, n = t.constructor; return e = new n(e), !t.d || !e.s || e.d && !e.d[0] ? new n(NaN) : !e.d || t.d && !t.d[0] ? Ie(new n(t), n.precision, n.rounding) : (Ke = !1, n.modulo == 9 ? (r = wr(t, e.abs(), 0, 3, 1), r.s *= e.s) : r = wr(t, e, 0, n.modulo, 1), r = r.times(e), Ke = !0, t.minus(r)); }; ye.naturalExponential = ye.exp = function() { return Uu(this); }; ye.naturalLogarithm = ye.ln = function() { return Hn(this); }; ye.negated = ye.neg = function() { var e = new this.constructor(this); return e.s = -e.s, Ie(e); }; ye.plus = ye.add = function(e) { var r, t, n, a, i, o, l, u, s, c, f = this, d = f.constructor; if (e = new d(e), !f.d || !e.d) return !f.s || !e.s ? e = new d(NaN) : f.d || (e = new d(e.d || f.s === e.s ? f : NaN)), e; if (f.s != e.s) return e.s = -e.s, f.minus(e); if (s = f.d, c = e.d, l = d.precision, u = d.rounding, !s[0] || !c[0]) return c[0] || (e = new d(f)), Ke ? Ie(e, l, u) : e; if (i = Qr(f.e / Le), n = Qr(e.e / Le), s = s.slice(), a = i - n, a) { for (a < 0 ? (t = s, a = -a, o = c.length) : (t = c, n = i, o = s.length), i = Math.ceil(l / Le), o = i > o ? i + 1 : o + 1, a > o && (a = o, t.length = 1), t.reverse(); a--; ) t.push(0); t.reverse(); } for (o = s.length, a = c.length, o - a < 0 && (a = o, t = c, c = s, s = t), r = 0; a; ) r = (s[--a] = s[a] + c[a] + r) / kt | 0, s[a] %= kt; for (r && (s.unshift(r), ++n), o = s.length; s[--o] == 0; ) s.pop(); return e.d = s, e.e = Ts(s, n), Ke ? Ie(e, l, u) : e; }; ye.precision = ye.sd = function(e) { var r, t = this; if (e !== void 0 && e !== !!e && e !== 1 && e !== 0) throw Error(Yn + e); return t.d ? (r = dg(t.d), e && t.e + 1 > r && (r = t.e + 1)) : r = NaN, r; }; ye.round = function() { var e = this, r = e.constructor; return Ie(new r(e), e.e + 1, r.rounding); }; ye.sine = ye.sin = function() { var e, r, t = this, n = t.constructor; return t.isFinite() ? t.isZero() ? new n(t) : (e = n.precision, r = n.rounding, n.precision = e + Math.max(t.e, t.sd()) + Le, n.rounding = 1, t = aM(n, hg(n, t)), n.precision = e, n.rounding = r, Ie(bn > 2 ? t.neg() : t, e, r, !0)) : new n(NaN); }; ye.squareRoot = ye.sqrt = function() { var e, r, t, n, a, i, o = this, l = o.d, u = o.e, s = o.s, c = o.constructor; if (s !== 1 || !l || !l[0]) return new c(!s || s < 0 && (!l || l[0]) ? NaN : l ? o : 1 / 0); for (Ke = !1, s = Math.sqrt(+o), s == 0 || s == 1 / 0 ? (r = Hr(l), (r.length + u) % 2 == 0 && (r += "0"), s = Math.sqrt(r), u = Qr((u + 1) / 2) - (u < 0 || u % 2), s == 1 / 0 ? r = "5e" + u : (r = s.toExponential(), r = r.slice(0, r.indexOf("e") + 1) + u), n = new c(r)) : n = new c(s.toString()), t = (u = c.precision) + 3; ; ) if (i = n, n = i.plus(wr(o, i, t + 2, 1)).times(0.5), Hr(i.d).slice(0, t) === (r = Hr(n.d)).slice(0, t)) if (r = r.slice(t - 3, t + 1), r == "9999" || !a && r == "4999") { if (!a && (Ie(i, u + 1, 0), i.times(i).eq(o))) { n = i; break; } t += 4, a = 1; } else { (!+r || !+r.slice(1) && r.charAt(0) == "5") && (Ie(n, u + 1, 1), e = !n.times(n).eq(o)); break; } return Ke = !0, Ie(n, u, c.rounding, e); }; ye.tangent = ye.tan = function() { var e, r, t = this, n = t.constructor; return t.isFinite() ? t.isZero() ? new n(t) : (e = n.precision, r = n.rounding, n.precision = e + 10, n.rounding = 1, t = t.sin(), t.s = 1, t = wr(t, new n(1).minus(t.times(t)).sqrt(), e + 10, 0), n.precision = e, n.rounding = r, Ie(bn == 2 || bn == 4 ? t.neg() : t, e, r, !0)) : new n(NaN); }; ye.times = ye.mul = function(e) { var r, t, n, a, i, o, l, u, s, c = this, f = c.constructor, d = c.d, p = (e = new f(e)).d; if (e.s *= c.s, !d || !d[0] || !p || !p[0]) return new f(!e.s || d && !d[0] && !p || p && !p[0] && !d ? NaN : !d || !p ? e.s / 0 : e.s * 0); for (t = Qr(c.e / Le) + Qr(e.e / Le), u = d.length, s = p.length, u < s && (i = d, d = p, p = i, o = u, u = s, s = o), i = [], o = u + s, n = o; n--; ) i.push(0); for (n = s; --n >= 0; ) { for (r = 0, a = u + n; a > n; ) l = i[a] + p[n] * d[a - n - 1] + r, i[a--] = l % kt | 0, r = l / kt | 0; i[a] = (i[a] + r) % kt | 0; } for (; !i[--o]; ) i.pop(); return r ? ++t : i.shift(), e.d = i, e.e = Ts(i, t), Ke ? Ie(e, f.precision, f.rounding) : e; }; ye.toBinary = function(e, r) { return zl(this, 2, e, r); }; ye.toDecimalPlaces = ye.toDP = function(e, r) { var t = this, n = t.constructor; return t = new n(t), e === void 0 ? t : (vt(e, 0, ea), r === void 0 ? r = n.rounding : vt(r, 0, 8), Ie(t, e + t.e + 1, r)); }; ye.toExponential = function(e, r) { var t, n = this, a = n.constructor; return e === void 0 ? t = tn(n, !0) : (vt(e, 0, ea), r === void 0 ? r = a.rounding : vt(r, 0, 8), n = Ie(new a(n), e + 1, r), t = tn(n, !0, e + 1)), n.isNeg() && !n.isZero() ? "-" + t : t; }; ye.toFixed = function(e, r) { var t, n, a = this, i = a.constructor; return e === void 0 ? t = tn(a) : (vt(e, 0, ea), r === void 0 ? r = i.rounding : vt(r, 0, 8), n = Ie(new i(a), e + a.e + 1, r), t = tn(n, !1, e + n.e + 1)), a.isNeg() && !a.isZero() ? "-" + t : t; }; ye.toFraction = function(e) { var r, t, n, a, i, o, l, u, s, c, f, d, p = this, m = p.d, v = p.constructor; if (!m) return new v(p); if (s = t = new v(1), n = u = new v(0), r = new v(n), i = r.e = dg(m) - p.e - 1, o = i % Le, r.d[0] = Br(10, o < 0 ? Le + o : o), e == null) e = i > 0 ? r : s; else { if (l = new v(e), !l.isInt() || l.lt(s)) throw Error(Yn + l); e = l.gt(r) ? i > 0 ? r : s : l; } for (Ke = !1, l = new v(Hr(m)), c = v.precision, v.precision = i = m.length * Le * 2; f = wr(l, r, 0, 1, 1), a = t.plus(f.times(n)), a.cmp(e) != 1; ) t = n, n = a, a = s, s = u.plus(f.times(a)), u = a, a = r, r = l.minus(f.times(a)), l = a; return a = wr(e.minus(t), n, 0, 1, 1), u = u.plus(a.times(s)), t = t.plus(a.times(n)), u.s = s.s = p.s, d = wr(s, n, i, 1).minus(p).abs().cmp(wr(u, t, i, 1).minus(p).abs()) < 1 ? [s, n] : [u, t], v.precision = c, Ke = !0, d; }; ye.toHexadecimal = ye.toHex = function(e, r) { return zl(this, 16, e, r); }; ye.toNearest = function(e, r) { var t = this, n = t.constructor; if (t = new n(t), e == null) { if (!t.d) return t; e = new n(1), r = n.rounding; } else { if (e = new n(e), r === void 0 ? r = n.rounding : vt(r, 0, 8), !t.d) return e.s ? t : e; if (!e.d) return e.s && (e.s = t.s), e; } return e.d[0] ? (Ke = !1, t = wr(t, e, 0, r, 1).times(e), Ke = !0, Ie(t)) : (e.s = t.s, t = e), t; }; ye.toNumber = function() { return +this; }; ye.toOctal = function(e, r) { return zl(this, 8, e, r); }; ye.toPower = ye.pow = function(e) { var r, t, n, a, i, o, l = this, u = l.constructor, s = +(e = new u(e)); if (!l.d || !e.d || !l.d[0] || !e.d[0]) return new u(Br(+l, s)); if (l = new u(l), l.eq(1)) return l; if (n = u.precision, i = u.rounding, e.eq(1)) return Ie(l, n, i); if (r = Qr(e.e / Le), r >= e.d.length - 1 && (t = s < 0 ? -s : s) <= eM) return a = pg(u, l, t, n), e.s < 0 ? new u(1).div(a) : Ie(a, n, i); if (o = l.s, o < 0) { if (r < e.d.length - 1) return new u(NaN); if (e.d[r] & 1 || (o = 1), l.e == 0 && l.d[0] == 1 && l.d.length == 1) return l.s = o, l; } return t = Br(+l, s), r = t == 0 || !isFinite(t) ? Qr(s * (Math.log("0." + Hr(l.d)) / Math.LN10 + l.e + 1)) : new u(t + "").e, r > u.maxE + 1 || r < u.minE - 1 ? new u(r > 0 ? o / 0 : 0) : (Ke = !1, u.rounding = l.s = 1, t = Math.min(12, (r + "").length), a = Uu(e.times(Hn(l, n + t)), n), a.d && (a = Ie(a, n + 5, 1), zi(a.d, n, i) && (r = n + 10, a = Ie(Uu(e.times(Hn(l, r + t)), r), r + 5, 1), +Hr(a.d).slice(n + 1, n + 15) + 1 == 1e14 && (a = Ie(a, n + 1, 0)))), a.s = o, Ke = !0, u.rounding = i, Ie(a, n, i)); }; ye.toPrecision = function(e, r) { var t, n = this, a = n.constructor; return e === void 0 ? t = tn(n, n.e <= a.toExpNeg || n.e >= a.toExpPos) : (vt(e, 1, ea), r === void 0 ? r = a.rounding : vt(r, 0, 8), n = Ie(new a(n), e, r), t = tn(n, e <= n.e || n.e <= a.toExpNeg, e)), n.isNeg() && !n.isZero() ? "-" + t : t; }; ye.toSignificantDigits = ye.toSD = function(e, r) { var t = this, n = t.constructor; return e === void 0 ? (e = n.precision, r = n.rounding) : (vt(e, 1, ea), r === void 0 ? r = n.rounding : vt(r, 0, 8)), Ie(new n(t), e, r); }; ye.toString = function() { var e = this, r = e.constructor, t = tn(e, e.e <= r.toExpNeg || e.e >= r.toExpPos); return e.isNeg() && !e.isZero() ? "-" + t : t; }; ye.truncated = ye.trunc = function() { return Ie(new this.constructor(this), this.e + 1, 1); }; ye.valueOf = ye.toJSON = function() { var e = this, r = e.constructor, t = tn(e, e.e <= r.toExpNeg || e.e >= r.toExpPos); return e.isNeg() ? "-" + t : t; }; function Hr(e) { var r, t, n, a = e.length - 1, i = "", o = e[0]; if (a > 0) { for (i += o, r = 1; r < a; r++) n = e[r] + "", t = Le - n.length, t && (i += zn(t)), i += n; o = e[r], n = o + "", t = Le - n.length, t && (i += zn(t)); } else if (o === 0) return "0"; for (; o % 10 === 0; ) o /= 10; return i + o; } function vt(e, r, t) { if (e !== ~~e || e < r || e > t) throw Error(Yn + e); } function zi(e, r, t, n) { var a, i, o, l; for (i = e[0]; i >= 10; i /= 10) --r; return --r < 0 ? (r += Le, a = 0) : (a = Math.ceil((r + 1) / Le), r %= Le), i = Br(10, Le - r), l = e[a] % i | 0, n == null ? r < 3 ? (r == 0 ? l = l / 100 | 0 : r == 1 && (l = l / 10 | 0), o = t < 4 && l == 99999 || t > 3 && l == 49999 || l == 5e4 || l == 0) : o = (t < 4 && l + 1 == i || t > 3 && l + 1 == i / 2) && (e[a + 1] / i / 100 | 0) == Br(10, r - 2) - 1 || (l == i / 2 || l == 0) && (e[a + 1] / i / 100 | 0) == 0 : r < 4 ? (r == 0 ? l = l / 1e3 | 0 : r == 1 ? l = l / 100 | 0 : r == 2 && (l = l / 10 | 0), o = (n || t < 4) && l == 9999 || !n && t > 3 && l == 4999) : o = ((n || t < 4) && l + 1 == i || !n && t > 3 && l + 1 == i / 2) && (e[a + 1] / i / 1e3 | 0) == Br(10, r - 3) - 1, o; } function Io(e, r, t) { for (var n, a = [0], i, o = 0, l = e.length; o < l; ) { for (i = a.length; i--; ) a[i] *= r; for (a[0] += zu.indexOf(e.charAt(o++)), n = 0; n < a.length; n++) a[n] > t - 1 && (a[n + 1] === void 0 && (a[n + 1] = 0), a[n + 1] += a[n] / t | 0, a[n] %= t); } return a.reverse(); } function tM(e, r) { var t, n, a; if (r.isZero()) return r; n = r.d.length, n < 32 ? (t = Math.ceil(n / 3), a = (1 / Os(4, t)).toString()) : (t = 16, a = "2.3283064365386962890625e-10"), e.precision += t, r = Qa(e, 1, r.times(a), new e(1)); for (var i = t; i--; ) { var o = r.times(r); r = o.times(o).minus(o).times(8).plus(1); } return e.precision -= t, r; } var wr = /* @__PURE__ */ function() { function e(n, a, i) { var o, l = 0, u = n.length; for (n = n.slice(); u--; ) o = n[u] * a + l, n[u] = o % i | 0, l = o / i | 0; return l && n.unshift(l), n; } function r(n, a, i, o) { var l, u; if (i != o) u = i > o ? 1 : -1; else for (l = u = 0; l < i; l++) if (n[l] != a[l]) { u = n[l] > a[l] ? 1 : -1; break; } return u; } function t(n, a, i, o) { for (var l = 0; i--; ) n[i] -= l, l = n[i] < a[i] ? 1 : 0, n[i] = l * o + n[i] - a[i]; for (; !n[0] && n.length > 1; ) n.shift(); } return function(n, a, i, o, l, u) { var s, c, f, d, p, m, v, b, y, A, h, x, w, g, D, E, N, S, M, F, $ = n.constructor, I = n.s == a.s ? 1 : -1, B = n.d, C = a.d; if (!B || !B[0] || !C || !C[0]) return new $( // Return NaN if either NaN, or both Infinity or 0. !n.s || !a.s || (B ? C && B[0] == C[0] : !C) ? NaN : ( // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0. B && B[0] == 0 || !C ? I * 0 : I / 0 ) ); for (u ? (p = 1, c = n.e - a.e) : (u = kt, p = Le, c = Qr(n.e / p) - Qr(a.e / p)), M = C.length, N = B.length, y = new $(I), A = y.d = [], f = 0; C[f] == (B[f] || 0); f++) ; if (C[f] > (B[f] || 0) && c--, i == null ? (g = i = $.precision, o = $.rounding) : l ? g = i + (n.e - a.e) + 1 : g = i, g < 0) A.push(1), m = !0; else { if (g = g / p + 2 | 0, f = 0, M == 1) { for (d = 0, C = C[0], g++; (f < N || d) && g--; f++) D = d * u + (B[f] || 0), A[f] = D / C | 0, d = D % C | 0; m = d || f < N; } else { for (d = u / (C[0] + 1) | 0, d > 1 && (C = e(C, d, u), B = e(B, d, u), M = C.length, N = B.length), E = M, h = B.slice(0, M), x = h.length; x < M; ) h[x++] = 0; F = C.slice(), F.unshift(0), S = C[0], C[1] >= u / 2 && ++S; do d = 0, s = r(C, h, M, x), s < 0 ? (w = h[0], M != x && (w = w * u + (h[1] || 0)), d = w / S | 0, d > 1 ? (d >= u && (d = u - 1), v = e(C, d, u), b = v.length, x = h.length, s = r(v, h, b, x), s == 1 && (d--, t(v, M < b ? F : C, b, u))) : (d == 0 && (s = d = 1), v = C.slice()), b = v.length, b < x && v.unshift(0), t(h, v, x, u), s == -1 && (x = h.length, s = r(C, h, M, x), s < 1 && (d++, t(h, M < x ? F : C, x, u))), x = h.length) : s === 0 && (d++, h = [0]), A[f++] = d, s && h[0] ? h[x++] = B[E] || 0 : (h = [B[E]], x = 1); while ((E++ < N || h[0] !== void 0) && g--); m = h[0] !== void 0; } A[0] || A.shift(); } if (p == 1) y.e = c, sg = m; else { for (f = 1, d = A[0]; d >= 10; d /= 10) f++; y.e = f + c * p - 1, Ie(y, l ? i + y.e + 1 : i, o, m); } return y; }; }(); function Ie(e, r, t, n) { var a, i, o, l, u, s, c, f, d, p = e.constructor; e: if (r != null) { if (f = e.d, !f) return e; for (a = 1, l = f[0]; l >= 10; l /= 10) a++; if (i = r - a, i < 0) i += Le, o = r, c = f[d = 0], u = c / Br(10, a - o - 1) % 10 | 0; else if (d = Math.ceil((i + 1) / Le), l = f.length, d >= l) if (n) { for (; l++ <= d; ) f.push(0); c = u = 0, a = 1, i %= Le, o = i - Le + 1; } else break e; else { for (c = l = f[d], a = 1; l >= 10; l /= 10) a++; i %= Le, o = i - Le + a, u = o < 0 ? 0 : c / Br(10, a - o - 1) % 10 | 0; } if (n = n || r < 0 || f[d + 1] !== void 0 || (o < 0 ? c : c % Br(10, a - o - 1)), s = t < 4 ? (u || n) && (t == 0 || t == (e.s < 0 ? 3 : 2)) : u > 5 || u == 5 && (t == 4 || n || t == 6 && // Check whether the digit to the left of the rounding digit is odd. (i > 0 ? o > 0 ? c / Br(10, a - o) : 0 : f[d - 1]) % 10 & 1 || t == (e.s < 0 ? 8 : 7)), r < 1 || !f[0]) return f.length = 0, s ? (r -= e.e + 1, f[0] = Br(10, (Le - r % Le) % Le), e.e = -r || 0) : f[0] = e.e = 0, e; if (i == 0 ? (f.length = d, l = 1, d--) : (f.length = d + 1, l = Br(10, Le - i), f[d] = o > 0 ? (c / Br(10, a - o) % Br(10, o) | 0) * l : 0), s) for (; ; ) if (d == 0) { for (i = 1, o = f[0]; o >= 10; o /= 10) i++; for (o = f[0] += l, l = 1; o >= 10; o /= 10) l++; i != l && (e.e++, f[0] == kt && (f[0] = 1)); break; } else { if (f[d] += l, f[d] != kt) break; f[d--] = 0, l = 1; } for (i = f.length; f[--i] === 0; ) f.pop(); } return Ke && (e.e > p.maxE ? (e.d = null, e.e = NaN) : e.e < p.minE && (e.e = 0, e.d = [0])), e; } function tn(e, r, t) { if (!e.isFinite()) return vg(e); var n, a = e.e, i = Hr(e.d), o = i.length; return r ? (t && (n = t - o) > 0 ? i = i.charAt(0) + "." + i.slice(1) + zn(n) : o > 1 && (i = i.charAt(0) + "." + i.slice(1)), i = i + (e.e < 0 ? "e" : "e+") + e.e) : a < 0 ? (i = "0." + zn(-a - 1) + i, t && (n = t - o) > 0 && (i += zn(n))) : a >= o ? (i += zn(a + 1 - o), t && (n = t - a - 1) > 0 && (i = i + "." + zn(n))) : ((n = a + 1) < o && (i = i.slice(0, n) + "." + i.slice(n)), t && (n = t - o) > 0 && (a + 1 === o && (i += "."), i += zn(n))), i; } function Ts(e, r) { var t = e[0]; for (r *= Le; t >= 10; t /= 10) r++; return r; } function Ko(e, r, t) { if (r > rM) throw Ke = !0, t && (e.precision = t), Error(ug); return Ie(new e(Go), r, 1, !0); } function jt(e, r, t) { if (r > Lu) throw Error(ug); return Ie(new e(Wo), r, t, !0); } function dg(e) { var r = e.length - 1, t = r * Le + 1; if (r = e[r], r) { for (; r % 10 == 0; r /= 10) t--; for (r = e[0]; r >= 10; r /= 10) t++; } return t; } function zn(e) { for (var r = ""; e--; ) r += "0"; return r; } function pg(e, r, t, n) { var a, i = new e(1), o = Math.ceil(n / Le + 4); for (Ke = !1; ; ) { if (t % 2 && (i = i.times(r), Gf(i.d, o) && (a = !0)), t = Qr(t / 2), t === 0) { t = i.d.length - 1, a && i.d[t] === 0 && ++i.d[t]; break; } r = r.times(r), Gf(r.d, o); } return Ke = !0, i; } function Zf(e) { return e.d[e.d.length - 1] & 1; } function mg(e, r, t) { for (var n, a, i = new e(r[0]), o = 0; ++o < r.length; ) { if (a = new e(r[o]), !a.s) { i = a; break; } n = i.cmp(a), (n === t || n === 0 && i.s === t) && (i = a); } return i; } function Uu(e, r) { var t, n, a, i, o, l, u, s = 0, c = 0, f = 0, d = e.constructor, p = d.rounding, m = d.precision; if (!e.d || !e.d[0] || e.e > 17) return new d(e.d ? e.d[0] ? e.s < 0 ? 0 : 1 / 0 : 1 : e.s ? e.s < 0 ? 0 : e : NaN); for (r == null ? (Ke = !1, u = m) : u = r, l = new d(0.03125); e.e > -2; ) e = e.times(l), f += 5; for (n = Math.log(Br(2, f)) / Math.LN10 * 2 + 5 | 0, u += n, t = i = o = new d(1), d.precision = u; ; ) { if (i = Ie(i.times(e), u, 1), t = t.times(++c), l = o.plus(wr(i, t, u, 1)), Hr(l.d).slice(0, u) === Hr(o.d).slice(0, u)) { for (a = f; a--; ) o = Ie(o.times(o), u, 1); if (r == null) if (s < 3 && zi(o.d, u - n, p, s)) d.precision = u += 10, t = i = l = new d(1), c = 0, s++; else return Ie(o, d.precision = m, p, Ke = !0); else return d.precision = m, o; } o = l; } } function Hn(e, r) { var t, n, a, i, o, l, u, s, c, f, d, p = 1, m = 10, v = e, b = v.d, y = v.constructor, A = y.rounding, h = y.precision; if (v.s < 0 || !b || !b[0] || !v.e && b[0] == 1 && b.length == 1) return new y(b && !b[0] ? -1 / 0 : v.s != 1 ? NaN : b ? 0 : v); if (r == null ? (Ke = !1, c = h) : c = r, y.precision = c += m, t = Hr(b), n = t.charAt(0), Math.abs(i = v.e) < 15e14) { for (; n < 7 && n != 1 || n == 1 && t.charAt(1) > 3; ) v = v.times(e), t = Hr(v.d), n = t.charAt(0), p++; i = v.e, n > 1 ? (v = new y("0." + t), i++) : v = new y(n + "." + t.slice(1)); } else return s = Ko(y, c + 2, h).times(i + ""), v = Hn(new y(n + "." + t.slice(1)), c - m).plus(s), y.precision = h, r == null ? Ie(v, h, A, Ke = !0) : v; for (f = v, u = o = v = wr(v.minus(1), v.plus(1), c, 1), d = Ie(v.times(v), c, 1), a = 3; ; ) { if (o = Ie(o.times(d), c, 1), s = u.plus(wr(o, new y(a), c, 1)), Hr(s.d).slice(0, c) === Hr(u.d).slice(0, c)) if (u = u.times(2), i !== 0 && (u = u.plus(Ko(y, c + 2, h).times(i + ""))), u = wr(u, new y(p), c, 1), r == null) if (zi(u.d, c - m, A, l)) y.precision = c += m, s = o = v = wr(f.minus(1), f.plus(1), c, 1), d = Ie(v.times(v), c, 1), a = l = 1; else return Ie(u, y.precision = h, A, Ke = !0); else return y.precision = h, u; u = s, a += 2; } } function vg(e) { return String(e.s * e.s / 0); } function Ro(e, r) { var t, n, a; for ((t = r.indexOf(".")) > -1 && (r = r.replace(".", "")), (n = r.search(/e/i)) > 0 ? (t < 0 && (t = n), t += +r.slice(n + 1), r = r.substring(0, n)) : t < 0 && (t = r.length), n = 0; r.charCodeAt(n) === 48; n++) ; for (a = r.length; r.charCodeAt(a - 1) === 48; --a) ; if (r = r.slice(n, a), r) { if (a -= n, e.e = t = t - n - 1, e.d = [], n = (t + 1) % Le, t < 0 && (n += Le), n < a) { for (n && e.d.push(+r.slice(0, n)), a -= Le; n < a; ) e.d.push(+r.slice(n, n += Le)); r = r.slice(n), n = Le - r.length; } else n -= a; for (; n--; ) r += "0"; e.d.push(+r), Ke && (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 nM(e, r) { var t, n, a, i, o, l, u, s, c; if (r.indexOf("_") > -1) { if (r = r.replace(/(\d)_(?=\d)/g, "$1"), fg.test(r)) return Ro(e, r); } else if (r === "Infinity" || r === "NaN") return +r || (e.s = NaN), e.e = NaN, e.d = null, e; if (XC.test(r)) t = 16, r = r.toLowerCase(); else if (jC.test(r)) t = 2; else if (QC.test(r)) t = 8; else throw Error(Yn + r); for (i = r.search(/p/i), i > 0 ? (u = +r.slice(i + 1), r = r.substring(2, i)) : r = r.slice(2), i = r.indexOf("."), o = i >= 0, n = e.constructor, o && (r = r.replace(".", ""), l = r.length, i = l - i, a = pg(n, new n(t), i, i * 2)), s = Io(r, t, kt), c = s.length - 1, i = c; s[i] === 0; --i) s.pop(); return i < 0 ? new n(e.s * 0) : (e.e = Ts(s, c), e.d = s, Ke = !1, o && (e = wr(e, a, l * 4)), u && (e = e.times(Math.abs(u) < 54 ? Br(2, u) : jn.pow(2, u))), Ke = !0, e); } function aM(e, r) { var t, n = r.d.length; if (n < 3) return r.isZero() ? r : Qa(e, 2, r, r); t = 1.4 * Math.sqrt(n), t = t > 16 ? 16 : t | 0, r = r.times(1 / Os(5, t)), r = Qa(e, 2, r, r); for (var a, i = new e(5), o = new e(16), l = new e(20); t--; ) a = r.times(r), r = r.times(i.plus(a.times(o.times(a).minus(l)))); return r; } function Qa(e, r, t, n, a) { var i, o, l, u, s = e.precision, c = Math.ceil(s / Le); for (Ke = !1, u = t.times(t), l = new e(n); ; ) { if (o = wr(l.times(u), new e(r++ * r++), s, 1), l = a ? n.plus(o) : n.minus(o), n = wr(o.times(u), new e(r++ * r++), s, 1), o = l.plus(n), o.d[c] !== void 0) { for (i = c; o.d[i] === l.d[i] && i--; ) ; if (i == -1) break; } i = l, l = n, n = o, o = i; } return Ke = !0, o.d.length = c + 1, o; } function Os(e, r) { for (var t = e; --r; ) t *= e; return t; } function hg(e, r) { var t, n = r.s < 0, a = jt(e, e.precision, 1), i = a.times(0.5); if (r = r.abs(), r.lte(i)) return bn = n ? 4 : 1, r; if (t = r.divToInt(a), t.isZero()) bn = n ? 3 : 2; else { if (r = r.minus(t.times(a)), r.lte(i)) return bn = Zf(t) ? n ? 2 : 3 : n ? 4 : 1, r; bn = Zf(t) ? n ? 1 : 4 : n ? 3 : 2; } return r.minus(a).abs(); } function zl(e, r, t, n) { var a, i, o, l, u, s, c, f, d, p = e.constructor, m = t !== void 0; if (m ? (vt(t, 1, ea), n === void 0 ? n = p.rounding : vt(n, 0, 8)) : (t = p.precision, n = p.rounding), !e.isFinite()) c = vg(e); else { for (c = tn(e), o = c.indexOf("."), m ? (a = 2, r == 16 ? t = t * 4 - 3 : r == 8 && (t = t * 3 - 2)) : a = r, o >= 0 && (c = c.replace(".", ""), d = new p(1), d.e = c.length - o, d.d = Io(tn(d), 10, a), d.e = d.d.length), f = Io(c, 10, a), i = u = f.length; f[--u] == 0; ) f.pop(); if (!f[0]) c = m ? "0p+0" : "0"; else { if (o < 0 ? i-- : (e = new p(e), e.d = f, e.e = i, e = wr(e, d, t, n, 0, a), f = e.d, i = e.e, s = sg), o = f[t], l = a / 2, s = s || f[t + 1] !== void 0, s = n < 4 ? (o !== void 0 || s) && (n === 0 || n === (e.s < 0 ? 3 : 2)) : o > l || o === l && (n === 4 || s || n === 6 && f[t - 1] & 1 || n === (e.s < 0 ? 8 : 7)), f.length = t, s) for (; ++f[--t] > a - 1; ) f[t] = 0, t || (++i, f.unshift(1)); for (u = f.length; !f[u - 1]; --u) ; for (o = 0, c = ""; o < u; o++) c += zu.charAt(f[o]); if (m) { if (u > 1) if (r == 16 || r == 8) { for (o = r == 16 ? 4 : 3, --u; u % o; u++) c += "0"; for (f = Io(c, a, r), u = f.length; !f[u - 1]; --u) ; for (o = 1, c = "1."; o < u; o++) c += zu.charAt(f[o]); } else c = c.charAt(0) + "." + c.slice(1); c = c + (i < 0 ? "p" : "p+") + i; } else if (i < 0) { for (; ++i; ) c = "0" + c; c = "0." + c; } else if (++i > u) for (i -= u; i--; ) c += "0"; else i < u && (c = c.slice(0, i) + "." + c.slice(i)); } c = (r == 16 ? "0x" : r == 2 ? "0b" : r == 8 ? "0o" : "") + c; } return e.s < 0 ? "-" + c : c; } function Gf(e, r) { if (e.length > r) return e.length = r, !0; } function iM(e) { return new this(e).abs(); } function oM(e) { return new this(e).acos(); } function sM(e) { return new this(e).acosh(); } function uM(e, r) { return new this(e).plus(r); } function lM(e) { return new this(e).asin(); } function cM(e) { return new this(e).asinh(); } function fM(e) { return new this(e).atan(); } function dM(e) { return new this(e).atanh(); } function pM(e, r) { e = new this(e), r = new this(r); var t, n = this.precision, a = this.rounding, i = n + 4; return !e.s || !r.s ? t = new this(NaN) : !e.d && !r.d ? (t = jt(this, i, 1).times(r.s > 0 ? 0.25 : 0.75), t.s = e.s) : !r.d || e.isZero() ? (t = r.s < 0 ? jt(this, n, a) : new this(0), t.s = e.s) : !e.d || r.isZero() ? (t = jt(this, i, 1).times(0.5), t.s = e.s) : r.s < 0 ? (this.precision = i, this.rounding = 1, t = this.atan(wr(e, r, i, 1)), r = jt(this, i, 1), this.precision = n, this.rounding = a, t = e.s < 0 ? t.minus(r) : t.plus(r)) : t = this.atan(wr(e, r, i, 1)), t; } function mM(e) { return new this(e).cbrt(); } function vM(e) { return Ie(e = new this(e), e.e + 1, 2); } function hM(e, r, t) { return new this(e).clamp(r, t); } function gM(e) { if (!e || typeof e != "object") throw Error(Fs + "Object expected"); var r, t, n, a = e.defaults === !0, i = [ "precision", 1, ea, "rounding", 0, 8, "toExpNeg", -Ra, 0, "toExpPos", 0, Ra, "maxE", 0, Ra, "minE", -Ra, 0, "modulo", 0, 9 ]; for (r = 0; r < i.length; r += 3) if (t = i[r], a && (this[t] = qu[t]), (n = e[t]) !== void 0) if (Qr(n) === n && n >= i[r + 1] && n <= i[r + 2]) this[t] = n; else throw Error(Yn + t + ": " + n); if (t = "crypto", a && (this[t] = qu[t]), (n = e[t]) !== void 0) if (n === !0 || n === !1 || n === 0 || n === 1) if (n) if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes)) this[t] = !0; else throw Error(lg); else this[t] = !1; else throw Error(Yn + t + ": " + n); return this; } function yM(e) { return new this(e).cos(); } function bM(e) { return new this(e).cosh(); } function gg(e) { var r, t, n; function a(i) { var o, l, u, s = this; if (!(s instanceof a)) return new a(i); if (s.constructor = a, Wf(i)) { s.s = i.s, Ke ? !i.d || i.e > a.maxE ? (s.e = NaN, s.d = null) : i.e < a.minE ? (s.e = 0, s.d = [0]) : (s.e = i.e, s.d = i.d.slice()) : (s.e = i.e, s.d = i.d ? i.d.slice() : i.d); return; } if (u = typeof i, u === "number") { if (i === 0) { s.s = 1 / i < 0 ? -1 : 1, s.e = 0, s.d = [0]; return; } if (i < 0 ? (i = -i, s.s = -1) : s.s = 1, i === ~~i && i < 1e7) { for (o = 0, l = i; l >= 10; l /= 10) o++; Ke ? o > a.maxE ? (s.e = NaN, s.d = null) : o < a.minE ? (s.e = 0, s.d = [0]) : (s.e = o, s.d = [i]) : (s.e = o, s.d = [i]); return; } if (i * 0 !== 0) { i || (s.s = NaN), s.e = NaN, s.d = null; return; } return Ro(s, i.toString()); } if (u === "string") return (l = i.charCodeAt(0)) === 45 ? (i = i.slice(1), s.s = -1) : (l === 43 && (i = i.slice(1)), s.s = 1), fg.test(i) ? Ro(s, i) : nM(s, i); if (u === "bigint") return i < 0 ? (i = -i, s.s = -1) : s.s = 1, Ro(s, i.toString()); throw Error(Yn + i); } if (a.prototype = ye, a.ROUND_UP = 0, a.ROUND_DOWN = 1, a.ROUND_CEIL = 2, a.ROUND_FLOOR = 3, a.ROUND_HALF_UP = 4, a.ROUND_HALF_DOWN = 5, a.ROUND_HALF_EVEN = 6, a.ROUND_HALF_CEIL = 7, a.ROUND_HALF_FLOOR = 8, a.EUCLID = 9, a.config = a.set = gM, a.clone = gg, a.isDecimal = Wf, a.abs = iM, a.acos = oM, a.acosh = sM, a.add = uM, a.asin = lM, a.asinh = cM, a.atan = fM, a.atanh = dM, a.atan2 = pM, a.cbrt = mM, a.ceil = vM, a.clamp = hM, a.cos = yM, a.cosh = bM, a.div = wM, a.exp = xM, a.floor = AM, a.hypot = NM, a.ln = DM, a.log = EM, a.log10 = CM, a.log2 = SM, a.max = MM, a.min = _M, a.mod = FM, a.mul = TM, a.pow = OM, a.random = BM, a.round = $M, a.sign = IM, a.sin = RM, a.sinh = PM, a.sqrt = zM, a.sub = qM, a.sum = LM, a.tan = UM, a.tanh = kM, a.trunc = VM, e === void 0 && (e = {}), e && e.defaults !== !0) for (n = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], r = 0; r < n.length; ) e.hasOwnProperty(t = n[r++]) || (e[t] = this[t]); return a.config(e), a; } function wM(e, r) { return new this(e).div(r); } function xM(e) { return new this(e).exp(); } function AM(e) { return Ie(e = new this(e), e.e + 1, 3); } function NM() { var e, r, t = new this(0); for (Ke = !1, e = 0; e < arguments.length; ) if (r = new this(arguments[e++]), r.d) t.d && (t = t.plus(r.times(r))); else { if (r.s) return Ke = !0, new this(1 / 0); t = r; } return Ke = !0, t.sqrt(); } function Wf(e) { return e instanceof jn || e && e.toStringTag === cg || !1; } function DM(e) { return new this(e).ln(); } function EM(e, r) { return new this(e).log(r); } function SM(e) { return new this(e).log(2); } function CM(e) { return new this(e).log(10); } function MM() { return mg(this, arguments, -1); } function _M() { return mg(this, arguments, 1); } function FM(e, r) { return new this(e).mod(r); } function TM(e, r) { return new this(e).mul(r); } function OM(e, r) { return new this(e).pow(r); } function BM(e) { var r, t, n, a, i = 0, o = new this(1), l = []; if (e === void 0 ? e = this.precision : vt(e, 1, ea), n = Math.ceil(e / Le), this.crypto) if (crypto.getRandomValues) for (r = crypto.getRandomValues(new Uint32Array(n)); i < n; ) a = r[i], a >= 429e7 ? r[i] = crypto.getRandomValues(new Uint32Array(1))[0] : l[i++] = a % 1e7; else if (crypto.randomBytes) { for (r = crypto.randomBytes(n *= 4); i < n; ) a = r[i] + (r[i + 1] << 8) + (r[i + 2] << 16) + ((r[i + 3] & 127) << 24), a >= 214e7 ? crypto.randomBytes(4).copy(r, i) : (l.push(a % 1e7), i += 4); i = n / 4; } else throw Error(lg); else for (; i < n; ) l[i++] = Math.random() * 1e7 | 0; for (n = l[--i], e %= Le, n && e && (a = Br(10, Le - e), l[i] = (n / a | 0) * a); l[i] === 0; i--) l.pop(); if (i < 0) t = 0, l = [0]; else { for (t = -1; l[0] === 0; t -= Le) l.shift(); for (n = 1, a = l[0]; a >= 10; a /= 10) n++; n < Le && (t -= Le - n); } return o.e = t, o.d = l, o; } function $M(e) { return Ie(e = new this(e), e.e + 1, this.rounding); } function IM(e) { return e = new this(e), e.d ? e.d[0] ? e.s : 0 * e.s : e.s || NaN; } function RM(e) { return new this(e).sin(); } function PM(e) { return new this(e).sinh(); } function zM(e) { return new this(e).sqrt(); } function qM(e, r) { return new this(e).sub(r); } function LM() { var e = 0, r = arguments, t = new this(r[e]); for (Ke = !1; t.s && ++e < r.length; ) t = t.plus(r[e]); return Ke = !0, Ie(t, this.precision, this.rounding); } function UM(e) { return new this(e).tan(); } function kM(e) { return new this(e).tanh(); } function VM(e) { return Ie(e = new this(e), e.e + 1, 1); } ye[Symbol.for("nodejs.util.inspect.custom")] = ye.toString; ye[Symbol.toStringTag] = "Decimal"; var jn = ye.constructor = gg(qu); Go = new jn(Go); Wo = new jn(Wo); var HM = "BigNumber", ZM = ["?on", "config"], GM = /* @__PURE__ */ P(HM, ZM, (e) => { var { on: r, config: t } = e, n = jn.clone({ precision: t.precision, modulo: jn.EUCLID }); return n.prototype = Object.create(n.prototype), n.prototype.type = "BigNumber", n.prototype.isBigNumber = !0, n.prototype.toJSON = function() { return { mathjs: "BigNumber", value: this.toString() }; }, n.fromJSON = function(a) { return new n(a.value); }, r && r("config", function(a, i) { a.precision !== i.precision && n.config({ precision: a.precision }); }), n; }, { isClass: !0 }); const Jr = Math.cosh || function(e) { return Math.abs(e) < 1e-9 ? 1 - e : (Math.exp(e) + Math.exp(-e)) * 0.5; }, St = Math.sinh || function(e) { return Math.abs(e) < 1e-9 ? e : (Math.exp(e) - Math.exp(-e)) * 0.5; }, WM = function(e) { const r = Math.PI / 4; if (-r > e || e > r) return Math.cos(e) - 1; const t = e * e; return t * (t * (t * (t * (t * (t * (t * (t / 20922789888e3 - 1 / 87178291200) + 1 / 479001600) - 1 / 3628800) + 1 / 40320) - 1 / 720) + 1 / 24) - 1 / 2); }, lu = function(e, r) { return e = Math.abs(e), r = Math.abs(r), e < r && ([e, r] = [r, e]), e < 1e8 ? Math.sqrt(e * e + r * r) : (r /= e, e * Math.sqrt(1 + r * r)); }, Fa = function() { throw SyntaxError("Invalid Param"); }; function cu(e, r) { const t = Math.abs(e), n = Math.abs(r); return e === 0 ? Math.log(n) : r === 0 ? Math.log(t) : t < 3e3 && n < 3e3 ? Math.log(e * e + r * r) * 0.5 : (e = e * 0.5, r = r * 0.5, 0.5 * Math.log(e * e + r * r) + Math.LN2); } const KM = { re: 0, im: 0 }, oa = function(e, r) { const t = KM; if (e == null) t.re = t.im = 0; else if (r !== void 0) t.re = e, t.im = r; else switch (typeof e) { case "object": if ("im" in e && "re" in e) t.re = e.re, t.im = e.im; else if ("abs" in e && "arg" in e) { if (!isFinite(e.abs) && isFinite(e.arg)) return ve.INFINITY; t.re = e.abs * Math.cos(e.arg), t.im = e.abs * Math.sin(e.arg); } else if ("r" in e && "phi" in e) { if (!isFinite(e.r) && isFinite(e.phi)) return ve.INFINITY; t.re = e.r * Math.cos(e.phi), t.im = e.r * Math.sin(e.phi); } else e.length === 2 ? (t.re = e[0], t.im = e[1]) : Fa(); break; case "string": t.im = /* void */ t.re = 0; const n = e.replace(/_/g, "").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g); let a = 1, i = 0; n === null && Fa(); for (let o = 0; o < n.length; o++) { const l = n[o]; l === " " || l === " " || l === ` ` || (l === "+" ? a++ : l === "-" ? i++ : l === "i" || l === "I" ? (a + i === 0 && Fa(), n[o + 1] !== " " && !isNaN(n[o + 1]) ? (t.im += parseFloat((i % 2 ? "-" : "") + n[o + 1]), o++) : t.im += parseFloat((i % 2 ? "-" : "") + "1"), a = i = 0) : ((a + i === 0 || isNaN(l)) && Fa(), n[o + 1] === "i" || n[o + 1] === "I" ? (t.im += parseFloat((i % 2 ? "-" : "") + l), o++) : t.re += parseFloat((i % 2 ? "-" : "") + l), a = i = 0)); } a + i > 0 && Fa(); break; case "number": t.im = 0, t.re = e; break; default: Fa(); } return isNaN(t.re) || isNaN(t.im), t; }; function ve(e, r) { if (!(this instanceof ve)) return new ve(e, r); const t = oa(e, r); this.re = t.re, this.im = t.im; } ve.prototype = { re: 0, im: 0, /** * Calculates the sign of a complex number, which is a normalized complex * * @returns {Complex} */ sign: function() { const e = lu(this.re, this.im); return new ve( this.re / e, this.im / e ); }, /** * Adds two complex numbers * * @returns {Complex} */ add: function(e, r) { const t = oa(e, r), n = this.isInfinite(), a = !(isFinite(t.re) && isFinite(t.im)); return n || a ? n && a ? ve.NAN : ve.INFINITY : new ve( this.re + t.re, this.im + t.im ); }, /** * Subtracts two complex numbers * * @returns {Complex} */ sub: function(e, r) { const t = oa(e, r), n = this.isInfinite(), a = !(isFinite(t.re) && isFinite(t.im)); return n || a ? n && a ? ve.NAN : ve.INFINITY : new ve( this.re - t.re, this.im - t.im ); }, /** * Multiplies two complex numbers * * @returns {Complex} */ mul: function(e, r) { const t = oa(e, r), n = this.isInfinite(), a = !(isFinite(t.re) && isFinite(t.im)), i = this.re === 0 && this.im === 0, o = t.re === 0 && t.im === 0; return n && o || a && i ? ve.NAN : n || a ? ve.INFINITY : t.im === 0 && this.im === 0 ? new ve(this.re * t.re, 0) : new ve( this.re * t.re - this.im * t.im, this.re * t.im + this.im * t.re ); }, /** * Divides two complex numbers * * @returns {Complex} */ div: function(e, r) { const t = oa(e, r), n = this.isInfinite(), a = !(isFinite(t.re) && isFinite(t.im)), i = this.re === 0 && this.im === 0, o = t.re === 0 && t.im === 0; if (i && o || n && a) return ve.NAN; if (o || n) return ve.INFINITY; if (i || a) return ve.ZERO; if (t.im === 0) return new ve(this.re / t.re, this.im / t.re); if (Math.abs(t.re) < Math.abs(t.im)) { const l = t.re / t.im, u = t.re * l + t.im; return new ve( (this.re * l + this.im) / u, (this.im * l - this.re) / u ); } else { const l = t.im / t.re, u = t.im * l + t.re; return new ve( (this.re + this.im * l) / u, (this.im - this.re * l) / u ); } }, /** * Calculate the power of two complex numbers * * @returns {Complex} */ pow: function(e, r) { const t = oa(e, r), n = this.re === 0 && this.im === 0; if (t.re === 0 && t.im === 0) return ve.ONE; if (t.im === 0) { if (this.im === 0 && this.re > 0) return new ve(Math.pow(this.re, t.re), 0); if (this.re === 0) switch ((t.re % 4 + 4) % 4) { case 0: return new ve(Math.pow(this.im, t.re), 0); case 1: return new ve(0, Math.pow(this.im, t.re)); case 2: return new ve(-Math.pow(this.im, t.re), 0); case 3: return new ve(0, -Math.pow(this.im, t.re)); } } if (n && t.re > 0) return ve.ZERO; const i = Math.atan2(this.im, this.re), o = cu(this.re, this.im); let l = Math.exp(t.re * o - t.im * i), u = t.im * o + t.re * i; return new ve( l * Math.cos(u), l * Math.sin(u) ); }, /** * Calculate the complex square root * * @returns {Complex} */ sqrt: function() { const e = this.re, r = this.im; if (r === 0) return e >= 0 ? new ve(Math.sqrt(e), 0) : new ve(0, Math.sqrt(-e)); const t = lu(e, r); let n = Math.sqrt(0.5 * (t + Math.abs(e))), a = Math.abs(r) / (2 * n); return e >= 0 ? new ve(n, r < 0 ? -a : a) : new ve(a, r < 0 ? -n : n); }, /** * Calculate the complex exponent * * @returns {Complex} */ exp: function() { const e = Math.exp(this.re); return this.im === 0 ? new ve(e, 0) : new ve( e * Math.cos(this.im), e * Math.sin(this.im) ); }, /** * Calculate the complex exponent and subtracts one. * * This may be more accurate than `Complex(x).exp().sub(1)` if * `x` is small. * * @returns {Complex} */ expm1: function() { const e = this.re, r = this.im; return new ve( Math.expm1(e) * Math.cos(r) + WM(r), Math.exp(e) * Math.sin(r) ); }, /** * Calculate the natural log * * @returns {Complex} */ log: function() { const e = this.re, r = this.im; return r === 0 && e > 0 ? new ve(Math.log(e), 0) : new ve( cu(e, r), Math.atan2(r, e) ); }, /** * Calculate the magnitude of the complex number * * @returns {number} */ abs: function() { return lu(this.re, this.im); }, /** * Calculate the angle of the complex number * * @returns {number} */ arg: function() { return Math.atan2(this.im, this.re); }, /** * Calculate the sine of the complex number * * @returns {Complex} */ sin: function() { const e = this.re, r = this.im; return new ve( Math.sin(e) * Jr(r), Math.cos(e) * St(r) ); }, /** * Calculate the cosine * * @returns {Complex} */ cos: function() { const e = this.re, r = this.im; return new ve( Math.cos(e) * Jr(r), -Math.sin(e) * St(r) ); }, /** * Calculate the tangent * * @returns {Complex} */ tan: function() { const e = 2 * this.re, r = 2 * this.im, t = Math.cos(e) + Jr(r); return new ve( Math.sin(e) / t, St(r) / t ); }, /** * Calculate the cotangent * * @returns {Complex} */ cot: function() { const e = 2 * this.re, r = 2 * this.im, t = Math.cos(e) - Jr(r); return new ve( -Math.sin(e) / t, St(r) / t ); }, /** * Calculate the secant * * @returns {Complex} */ sec: function() { const e = this.re, r = this.im, t = 0.5 * Jr(2 * r) + 0.5 * Math.cos(2 * e); return new ve( Math.cos(e) * Jr(r) / t, Math.sin(e) * St(r) / t ); }, /** * Calculate the cosecans * * @returns {Complex} */ csc: function() { const e = this.re, r = this.im, t = 0.5 * Jr(2 * r) - 0.5 * Math.cos(2 * e); return new ve( Math.sin(e) * Jr(r) / t, -Math.cos(e) * St(r) / t ); }, /** * Calculate the complex arcus sinus * * @returns {Complex} */ asin: function() { const e = this.re, r = this.im, t = new ve( r * r - e * e + 1, -2 * e * r ).sqrt(), n = new ve( t.re - r, t.im + e ).log(); return new ve(n.im, -n.re); }, /** * Calculate the complex arcus cosinus * * @returns {Complex} */ acos: function() { const e = this.re, r = this.im, t = new ve( r * r - e * e + 1, -2 * e * r ).sqrt(), n = new ve( t.re - r, t.im + e ).log(); return new ve(Math.PI / 2 - n.im, n.re); }, /** * Calculate the complex arcus tangent * * @returns {Complex} */ atan: function() { const e = this.re, r = this.im; if (e === 0) { if (r === 1) return new ve(0, 1 / 0); if (r === -1) return new ve(0, -1 / 0); } const t = e * e + (1 - r) * (1 - r), n = new ve( (1 - r * r - e * e) / t, -2 * e / t ).log(); return new ve(-0.5 * n.im, 0.5 * n.re); }, /** * Calculate the complex arcus cotangent * * @returns {Complex} */ acot: function() { const e = this.re, r = this.im; if (r === 0) return new ve(Math.atan2(1, e), 0); const t = e * e + r * r; return t !== 0 ? new ve( e / t, -r / t ).atan() : new ve( e !== 0 ? e / 0 : 0, r !== 0 ? -r / 0 : 0 ).atan(); }, /** * Calculate the complex arcus secant * * @returns {Complex} */ asec: function() { const e = this.re, r = this.im; if (e === 0 && r === 0) return new ve(0, 1 / 0); const t = e * e + r * r; return t !== 0 ? new ve( e / t, -r / t ).acos() : new ve( e !== 0 ? e / 0 : 0, r !== 0 ? -r / 0 : 0 ).acos(); }, /** * Calculate the complex arcus cosecans * * @returns {Complex} */ acsc: function() { const e = this.re, r = this.im; if (e === 0 && r === 0) return new ve(Math.PI / 2, 1 / 0); const t = e * e + r * r; return t !== 0 ? new ve( e / t, -r / t ).asin() : new ve( e !== 0 ? e / 0 : 0, r !== 0 ? -r / 0 : 0 ).asin(); }, /** * Calculate the complex sinh * * @returns {Complex} */ sinh: function() { const e = this.re, r = this.im; return new ve( St(e) * Math.cos(r), Jr(e) * Math.sin(r) ); }, /** * Calculate the complex cosh * * @returns {Complex} */ cosh: function() { const e = this.re, r = this.im; return new ve( Jr(e) * Math.cos(r), St(e) * Math.sin(r) ); }, /** * Calculate the complex tanh * * @returns {Complex} */ tanh: function() { const e = 2 * this.re, r = 2 * this.im, t = Jr(e) + Math.cos(r); return new ve( St(e) / t, Math.sin(r) / t ); }, /** * Calculate the complex coth * * @returns {Complex} */ coth: function() { const e = 2 * this.re, r = 2 * this.im, t = Jr(e) - Math.cos(r); return new ve( St(e) / t, -Math.sin(r) / t ); }, /** * Calculate the complex coth * * @returns {Complex} */ csch: function() { const e = this.re, r = this.im, t = Math.cos(2 * r) - Jr(2 * e); return new ve( -2 * St(e) * Math.cos(r) / t, 2 * Jr(e) * Math.sin(r) / t ); }, /** * Calculate the complex sech * * @returns {Complex} */ sech: function() { const e = this.re, r = this.im, t = Math.cos(2 * r) + Jr(2 * e); return new ve( 2 * Jr(e) * Math.cos(r) / t, -2 * St(e) * Math.sin(r) / t ); }, /** * Calculate the complex asinh * * @returns {Complex} */ asinh: function() { let e = this.im; this.im = -this.re, this.re = e; const r = this.asin(); return this.re = -this.im, this.im = e, e = r.re, r.re = -r.im, r.im = e, r; }, /** * Calculate the complex acosh * * @returns {Complex} */ acosh: function() { const e = this.acos(); if (e.im <= 0) { const r = e.re; e.re = -e.im, e.im = r; } else { const r = e.im; e.im = -e.re, e.re = r; } return e; }, /** * Calculate the complex atanh * * @returns {Complex} */ atanh: function() { const e = this.re, r = this.im, t = e > 1 && r === 0, n = 1 - e, a = 1 + e, i = n * n + r * r, o = i !== 0 ? new ve( (a * n - r * r) / i, (r * n + a * r) / i ) : new ve( e !== -1 ? e / 0 : 0, r !== 0 ? r / 0 : 0 ), l = o.re; return o.re = cu(o.re, o.im) / 2, o.im = Math.atan2(o.im, l) / 2, t && (o.im = -o.im), o; }, /** * Calculate the complex acoth * * @returns {Complex} */ acoth: function() { const e = this.re, r = this.im; if (e === 0 && r === 0) return new ve(0, Math.PI / 2); const t = e * e + r * r; return t !== 0 ? new ve( e / t, -r / t ).atanh() : new ve( e !== 0 ? e / 0 : 0, r !== 0 ? -r / 0 : 0 ).atanh(); }, /** * Calculate the complex acsch * * @returns {Complex} */ acsch: function() { const e = this.re, r = this.im; if (r === 0) return new ve( e !== 0 ? Math.log(e + Math.sqrt(e * e + 1)) : 1 / 0, 0 ); const t = e * e + r * r; return t !== 0 ? new ve( e / t, -r / t ).asinh() : new ve( e !== 0 ? e / 0 : 0, r !== 0 ? -r / 0 : 0 ).asinh(); }, /** * Calculate the complex asech * * @returns {Complex} */ asech: function() { const e = this.re, r = this.im; if (this.isZero()) return ve.INFINITY; const t = e * e + r * r; return t !== 0 ? new ve( e / t, -r / t ).acosh() : new ve( e !== 0 ? e / 0 : 0, r !== 0 ? -r / 0 : 0 ).acosh(); }, /** * Calculate the complex inverse 1/z * * @returns {Complex} */ inverse: function() { if (this.isZero()) return ve.INFINITY; if (this.isInfinite()) return ve.ZERO; const e = this.re, r = this.im, t = e * e + r * r; return new ve(e / t, -r / t); }, /** * Returns the complex conjugate * * @returns {Complex} */ conjugate: function() { return new ve(this.re, -this.im); }, /** * Gets the negated complex number * * @returns {Complex} */ neg: function() { return new ve(-this.re, -this.im); }, /** * Ceils the actual complex number * * @returns {Complex} */ ceil: function(e) { return e = Math.pow(10, e || 0), new ve( Math.ceil(this.re * e) / e, Math.ceil(this.im * e) / e ); }, /** * Floors the actual complex number * * @returns {Complex} */ floor: function(e) { return e = Math.pow(10, e || 0), new ve( Math.floor(this.re * e) / e, Math.floor(this.im * e) / e ); }, /** * Ceils the actual complex number * * @returns {Complex} */ round: function(e) { return e = Math.pow(10, e || 0), new ve( Math.round(this.re * e) / e, Math.round(this.im * e) / e ); }, /** * Compares two complex numbers * * **Note:** new Complex(Infinity).equals(Infinity) === false * * @returns {boolean} */ equals: function(e, r) { const t = oa(e, r); return Math.abs(t.re - this.re) <= ve.EPSILON && Math.abs(t.im - this.im) <= ve.EPSILON; }, /** * Clones the actual object * * @returns {Complex} */ clone: function() { return new ve(this.re, this.im); }, /** * Gets a string of the actual complex number * * @returns {string} */ toString: function() { let e = this.re, r = this.im, t = ""; return this.isNaN() ? "NaN" : this.isInfinite() ? "Infinity" : (Math.abs(e) < ve.EPSILON && (e = 0), Math.abs(r) < ve.EPSILON && (r = 0), r === 0 ? t + e : (e !== 0 ? (t += e, t += " ", r < 0 ? (r = -r, t += "-") : t += "+", t += " ") : r < 0 && (r = -r, t += "-"), r !== 1 && (t += r), t + "i")); }, /** * Returns the actual number as a vector * * @returns {Array} */ toVector: function() { return [this.re, this.im]; }, /** * Returns the actual real value of the current object * * @returns {number|null} */ valueOf: function() { return this.im === 0 ? this.re : null; }, /** * Determines whether a complex number is not on the Riemann sphere. * * @returns {boolean} */ isNaN: function() { return isNaN(this.re) || isNaN(this.im); }, /** * Determines whether or not a complex number is at the zero pole of the * Riemann sphere. * * @returns {boolean} */ isZero: function() { return this.im === 0 && this.re === 0; }, /** * Determines whether a complex number is not at the infinity pole of the * Riemann sphere. * * @returns {boolean} */ isFinite: function() { return isFinite(this.re) && isFinite(this.im); }, /** * Determines whether or not a complex number is at the infinity pole of the * Riemann sphere. * * @returns {boolean} */ isInfinite: function() { return !this.isFinite(); } }; ve.ZERO = new ve(0, 0); ve.ONE = new ve(1, 0); ve.I = new ve(0, 1); ve.PI = new ve(Math.PI, 0); ve.E = new ve(Math.E, 0); ve.INFINITY = new ve(1 / 0, 1 / 0); ve.NAN = new ve(NaN, NaN); ve.EPSILON = 1e-15; var JM = "Complex", YM = [], jM = /* @__PURE__ */ P(JM, YM, () => (Object.defineProperty(ve, "name", { value: "Complex" }), ve.prototype.constructor = ve, ve.prototype.type = "Complex", ve.prototype.isComplex = !0, ve.prototype.toJSON = function() { return { mathjs: "Complex", re: this.re, im: this.im }; }, ve.prototype.toPolar = function() { return { r: this.abs(), phi: this.arg() }; }, ve.prototype.format = function(e) { var r = "", t = this.im, n = this.re, a = pa(this.re, e), i = pa(this.im, e), o = We(e) ? e : e ? e.precision : null; if (o !== null) { var l = Math.pow(10, -o); Math.abs(n / t) < l && (n = 0), Math.abs(t / n) < l && (t = 0); } return t === 0 ? r = a : n === 0 ? t === 1 ? r = "i" : t === -1 ? r = "-i" : r = i + "i" : t < 0 ? t === -1 ? r = a + " - i" : r = a + " - " + i.substring(1) + "i" : t === 1 ? r = a + " + i" : r = a + " + " + i + "i", r; }, ve.fromPolar = function(e) { switch (arguments.length) { case 1: { var r = arguments[0]; if (typeof r == "object") return ve(r); throw new TypeError("Input has to be an object with r and phi keys."); } case 2: { var t = arguments[0], n = arguments[1]; if (We(t)) { if (ft(n) && n.hasBase("ANGLE") && (n = n.toNumber("rad")), We(n)) return new ve({ r: t, phi: n }); throw new TypeError("Phi is not a number nor an angle unit."); } else throw new TypeError("Radius r is not a number."); } default: throw new SyntaxError("Wrong number of arguments in function fromPolar"); } }, ve.prototype.valueOf = ve.prototype.toString, ve.fromJSON = function(e) { return new ve(e); }, ve.compare = function(e, r) { return e.re > r.re ? 1 : e.re < r.re ? -1 : e.im > r.im ? 1 : e.im < r.im ? -1 : 0; }, ve), { isClass: !0 }); /** * @license Fraction.js v4.3.7 31/08/2023 * https://www.xarg.org/2014/03/rational-numbers-in-javascript/ * * Copyright (c) 2023, Robert Eisele (robert@raw.org) * Dual licensed under the MIT or GPL Version 2 licenses. **/ var XM = 2e3, Te = { s: 1, n: 0, d: 1 }; function cn(e, r) { if (isNaN(e = parseInt(e, 10))) throw Po(); return e * r; } function Mr(e, r) { if (r === 0) throw ql(); var t = Object.create(Yr.prototype); t.s = e < 0 ? -1 : 1, e = e < 0 ? -e : e; var n = Pa(e, r); return t.n = e / n, t.d = r / n, t; } function Kf(e) { for (var r = {}, t = e, n = 2, a = 4; a <= t; ) { for (; t % n === 0; ) t /= n, r[n] = (r[n] || 0) + 1; a += 1 + 2 * n++; } return t !== e ? t > 1 && (r[t] = (r[t] || 0) + 1) : r[e] = (r[e] || 0) + 1, r; } var yt = function(e, r) { var t = 0, n = 1, a = 1, i = 0, o = 0, l = 0, u = 1, s = 1, c = 0, f = 1, d = 1, p = 1, m = 1e7, v; if (e != null) if (r !== void 0) { if (t = e, n = r, a = t * n, t % 1 !== 0 || n % 1 !== 0) throw t_(); } else switch (typeof e) { case "object": { if ("d" in e && "n" in e) t = e.n, n = e.d, "s" in e && (t *= e.s); else if (0 in e) t = e[0], 1 in e && (n = e[1]); else throw Po(); a = t * n; break; } case "number": { if (e < 0 && (a = e, e = -e), e % 1 === 0) t = e; else if (e > 0) { for (e >= 1 && (s = Math.pow(10, Math.floor(1 + Math.log(e) / Math.LN10)), e /= s); f <= m && p <= m; ) if (v = (c + d) / (f + p), e === v) { f + p <= m ? (t = c + d, n = f + p) : p > f ? (t = d, n = p) : (t = c, n = f); break; } else e > v ? (c += d, f += p) : (d += c, p += f), f > m ? (t = d, n = p) : (t = c, n = f); t *= s; } else (isNaN(e) || isNaN(r)) && (n = t = NaN); break; } case "string": { if (f = e.match(/\d+|./g), f === null) throw Po(); if (f[c] === "-" ? (a = -1, c++) : f[c] === "+" && c++, f.length === c + 1 ? o = cn(f[c++], a) : f[c + 1] === "." || f[c] === "." ? (f[c] !== "." && (i = cn(f[c++], a)), c++, (c + 1 === f.length || f[c + 1] === "(" && f[c + 3] === ")" || f[c + 1] === "'" && f[c + 3] === "'") && (o = cn(f[c], a), u = Math.pow(10, f[c].length), c++), (f[c] === "(" && f[c + 2] === ")" || f[c] === "'" && f[c + 2] === "'") && (l = cn(f[c + 1], a), s = Math.pow(10, f[c + 1].length) - 1, c += 3)) : f[c + 1] === "/" || f[c + 1] === ":" ? (o = cn(f[c], a), u = cn(f[c + 2], 1), c += 3) : f[c + 3] === "/" && f[c + 1] === " " && (i = cn(f[c], a), o = cn(f[c + 2], a), u = cn(f[c + 4], 1), c += 5), f.length <= c) { n = u * s, a = /* void */ t = l + n * i + s * o; break; } } default: throw Po(); } if (n === 0) throw ql(); Te.s = a < 0 ? -1 : 1, Te.n = Math.abs(t), Te.d = Math.abs(n); }; function QM(e, r, t) { for (var n = 1; r > 0; e = e * e % t, r >>= 1) r & 1 && (n = n * e % t); return n; } function e_(e, r) { for (; r % 2 === 0; r /= 2) ; for (; r % 5 === 0; r /= 5) ; if (r === 1) return 0; for (var t = 10 % r, n = 1; t !== 1; n++) if (t = t * 10 % r, n > XM) return 0; return n; } function r_(e, r, t) { for (var n = 1, a = QM(10, t, r), i = 0; i < 300; i++) { if (n === a) return i; n = n * 10 % r, a = a * 10 % r; } return 0; } function Pa(e, r) { if (!e) return r; if (!r) return e; for (; ; ) { if (e %= r, !e) return r; if (r %= e, !r) return e; } } function Yr(e, r) { if (yt(e, r), this instanceof Yr) e = Pa(Te.d, Te.n), this.s = Te.s, this.n = Te.n / e, this.d = Te.d / e; else return Mr(Te.s * Te.n, Te.d); } var ql = function() { return new Error("Division by Zero"); }, Po = function() { return new Error("Invalid argument"); }, t_ = function() { return new Error("Parameters must be integer"); }; Yr.prototype = { s: 1, n: 0, d: 1, /** * Calculates the absolute value * * Ex: new Fraction(-4).abs() => 4 **/ abs: function() { return Mr(this.n, this.d); }, /** * Inverts the sign of the current fraction * * Ex: new Fraction(-4).neg() => 4 **/ neg: function() { return Mr(-this.s * this.n, this.d); }, /** * Adds two rational numbers * * Ex: new Fraction({n: 2, d: 3}).add("14.9") => 467 / 30 **/ add: function(e, r) { return yt(e, r), Mr( this.s * this.n * Te.d + Te.s * this.d * Te.n, this.d * Te.d ); }, /** * Subtracts two rational numbers * * Ex: new Fraction({n: 2, d: 3}).add("14.9") => -427 / 30 **/ sub: function(e, r) { return yt(e, r), Mr( this.s * this.n * Te.d - Te.s * this.d * Te.n, this.d * Te.d ); }, /** * Multiplies two rational numbers * * Ex: new Fraction("-17.(345)").mul(3) => 5776 / 111 **/ mul: function(e, r) { return yt(e, r), Mr( this.s * Te.s * this.n * Te.n, this.d * Te.d ); }, /** * Divides two rational numbers * * Ex: new Fraction("-17.(345)").inverse().div(3) **/ div: function(e, r) { return yt(e, r), Mr( this.s * Te.s * this.n * Te.d, this.d * Te.n ); }, /** * Clones the actual object * * Ex: new Fraction("-17.(345)").clone() **/ clone: function() { return Mr(this.s * this.n, this.d); }, /** * Calculates the modulo of two rational numbers - a more precise fmod * * Ex: new Fraction('4.(3)').mod([7, 8]) => (13/3) % (7/8) = (5/6) **/ mod: function(e, r) { if (isNaN(this.n) || isNaN(this.d)) return new Yr(NaN); if (e === void 0) return Mr(this.s * this.n % this.d, 1); if (yt(e, r), Te.n === 0 && this.d === 0) throw ql(); return Mr( this.s * (Te.d * this.n) % (Te.n * this.d), Te.d * this.d ); }, /** * Calculates the fractional gcd of two rational numbers * * Ex: new Fraction(5,8).gcd(3,7) => 1/56 */ gcd: function(e, r) { return yt(e, r), Mr(Pa(Te.n, this.n) * Pa(Te.d, this.d), Te.d * this.d); }, /** * Calculates the fractional lcm of two rational numbers * * Ex: new Fraction(5,8).lcm(3,7) => 15 */ lcm: function(e, r) { return yt(e, r), Te.n === 0 && this.n === 0 ? Mr(0, 1) : Mr(Te.n * this.n, Pa(Te.n, this.n) * Pa(Te.d, this.d)); }, /** * Calculates the ceil of a rational number * * Ex: new Fraction('4.(3)').ceil() => (5 / 1) **/ ceil: function(e) { return e = Math.pow(10, e || 0), isNaN(this.n) || isNaN(this.d) ? new Yr(NaN) : Mr(Math.ceil(e * this.s * this.n / this.d), e); }, /** * Calculates the floor of a rational number * * Ex: new Fraction('4.(3)').floor() => (4 / 1) **/ floor: function(e) { return e = Math.pow(10, e || 0), isNaN(this.n) || isNaN(this.d) ? new Yr(NaN) : Mr(Math.floor(e * this.s * this.n / this.d), e); }, /** * Rounds a rational number * * Ex: new Fraction('4.(3)').round() => (4 / 1) **/ round: function(e) { return e = Math.pow(10, e || 0), isNaN(this.n) || isNaN(this.d) ? new Yr(NaN) : Mr(Math.round(e * this.s * this.n / this.d), e); }, /** * Rounds a rational number to a multiple of another rational number * * Ex: new Fraction('0.9').roundTo("1/8") => 7 / 8 **/ roundTo: function(e, r) { return yt(e, r), Mr(this.s * Math.round(this.n * Te.d / (this.d * Te.n)) * Te.n, Te.d); }, /** * Gets the inverse of the fraction, means numerator and denominator are exchanged * * Ex: new Fraction([-3, 4]).inverse() => -4 / 3 **/ inverse: function() { return Mr(this.s * this.d, this.n); }, /** * Calculates the fraction to some rational exponent, if possible * * Ex: new Fraction(-1,2).pow(-3) => -8 */ pow: function(e, r) { if (yt(e, r), Te.d === 1) return Te.s < 0 ? Mr(Math.pow(this.s * this.d, Te.n), Math.pow(this.n, Te.n)) : Mr(Math.pow(this.s * this.n, Te.n), Math.pow(this.d, Te.n)); if (this.s < 0) return null; var t = Kf(this.n), n = Kf(this.d), a = 1, i = 1; for (var o in t) if (o !== "1") { if (o === "0") { a = 0; break; } if (t[o] *= Te.n, t[o] % Te.d === 0) t[o] /= Te.d; else return null; a *= Math.pow(o, t[o]); } for (var o in n) if (o !== "1") { if (n[o] *= Te.n, n[o] % Te.d === 0) n[o] /= Te.d; else return null; i *= Math.pow(o, n[o]); } return Te.s < 0 ? Mr(i, a) : Mr(a, i); }, /** * Check if two rational numbers are the same * * Ex: new Fraction(19.6).equals([98, 5]); **/ equals: function(e, r) { return yt(e, r), this.s * this.n * Te.d === Te.s * Te.n * this.d; }, /** * Check if two rational numbers are the same * * Ex: new Fraction(19.6).equals([98, 5]); **/ compare: function(e, r) { yt(e, r); var t = this.s * this.n * Te.d - Te.s * Te.n * this.d; return (0 < t) - (t < 0); }, simplify: function(e) { if (isNaN(this.n) || isNaN(this.d)) return this; e = e || 1e-3; for (var r = this.abs(), t = r.toContinued(), n = 1; n < t.length; n++) { for (var a = Mr(t[n - 1], 1), i = n - 2; i >= 0; i--) a = a.inverse().add(t[i]); if (Math.abs(a.sub(r).valueOf()) < e) return a.mul(this.s); } return this; }, /** * Check if two rational numbers are divisible * * Ex: new Fraction(19.6).divisible(1.5); */ divisible: function(e, r) { return yt(e, r), !(!(Te.n * this.d) || this.n * Te.d % (Te.n * this.d)); }, /** * Returns a decimal representation of the fraction * * Ex: new Fraction("100.'91823'").valueOf() => 100.91823918239183 **/ valueOf: function() { return this.s * this.n / this.d; }, /** * Returns a string-fraction representation of a Fraction object * * Ex: new Fraction("1.'3'").toFraction(true) => "4 1/3" **/ toFraction: function(e) { var r, t = "", n = this.n, a = this.d; return this.s < 0 && (t += "-"), a === 1 ? t += n : (e && (r = Math.floor(n / a)) > 0 && (t += r, t += " ", n %= a), t += n, t += "/", t += a), t; }, /** * Returns a latex representation of a Fraction object * * Ex: new Fraction("1.'3'").toLatex() => "\frac{4}{3}" **/ toLatex: function(e) { var r, t = "", n = this.n, a = this.d; return this.s < 0 && (t += "-"), a === 1 ? t += n : (e && (r = Math.floor(n / a)) > 0 && (t += r, n %= a), t += "\\frac{", t += n, t += "}{", t += a, t += "}"), t; }, /** * Returns an array of continued fraction elements * * Ex: new Fraction("7/8").toContinued() => [0,1,7] */ toContinued: function() { var e, r = this.n, t = this.d, n = []; if (isNaN(r) || isNaN(t)) return n; do n.push(Math.floor(r / t)), e = r % t, r = t, t = e; while (r !== 1); return n; }, /** * Creates a string representation of a fraction with all digits * * Ex: new Fraction("100.'91823'").toString() => "100.(91823)" **/ toString: function(e) { var r = this.n, t = this.d; if (isNaN(r) || isNaN(t)) return "NaN"; e = e || 15; var n = e_(r, t), a = r_(r, t, n), i = this.s < 0 ? "-" : ""; if (i += r / t | 0, r %= t, r *= 10, r && (i += "."), n) { for (var o = a; o--; ) i += r / t | 0, r %= t, r *= 10; i += "("; for (var o = n; o--; ) i += r / t | 0, r %= t, r *= 10; i += ")"; } else for (var o = e; r && o--; ) i += r / t | 0, r %= t, r *= 10; return i; } }; var n_ = "Fraction", a_ = [], i_ = /* @__PURE__ */ P(n_, a_, () => (Object.defineProperty(Yr, "name", { value: "Fraction" }), Yr.prototype.constructor = Yr, Yr.prototype.type = "Fraction", Yr.prototype.isFraction = !0, Yr.prototype.toJSON = function() { return { mathjs: "Fraction", n: this.s * this.n, d: this.d }; }, Yr.fromJSON = function(e) { return new Yr(e); }, Yr), { isClass: !0 }), o_ = "Range", s_ = [], u_ = /* @__PURE__ */ P(o_, s_, () => { function e(r, t, n) { if (!(this instanceof e)) throw new SyntaxError("Constructor must be called with the new operator"); var a = r != null, i = t != null, o = n != null; if (a) { if (Ze(r)) r = r.toNumber(); else if (typeof r != "number") throw new TypeError("Parameter start must be a number"); } if (i) { if (Ze(t)) t = t.toNumber(); else if (typeof t != "number") throw new TypeError("Parameter end must be a number"); } if (o) { if (Ze(n)) n = n.toNumber(); else if (typeof n != "number") throw new TypeError("Parameter step must be a number"); } this.start = a ? parseFloat(r) : 0, this.end = i ? parseFloat(t) : 0, this.step = o ? parseFloat(n) : 1; } return e.prototype.type = "Range", e.prototype.isRange = !0, e.parse = function(r) { if (typeof r != "string") return null; var t = r.split(":"), n = t.map(function(i) { return parseFloat(i); }), a = n.some(function(i) { return isNaN(i); }); if (a) return null; switch (n.length) { case 2: return new e(n[0], n[1]); case 3: return new e(n[0], n[2], n[1]); default: return null; } }, e.prototype.clone = function() { return new e(this.start, this.end, this.step); }, e.prototype.size = function() { var r = 0, t = this.start, n = this.step, a = this.end, i = a - t; return Vn(n) === Vn(i) ? r = Math.ceil(i / n) : i === 0 && (r = 0), isNaN(r) && (r = 0), [r]; }, e.prototype.min = function() { var r = this.size()[0]; if (r > 0) return this.step > 0 ? this.start : this.start + (r - 1) * this.step; }, e.prototype.max = function() { var r = this.size()[0]; if (r > 0) return this.step > 0 ? this.start + (r - 1) * this.step : this.start; }, e.prototype.forEach = function(r) { var t = this.start, n = this.step, a = this.end, i = 0; if (n > 0) for (; t < a; ) r(t, [i], this), t += n, i++; else if (n < 0) for (; t > a; ) r(t, [i], this), t += n, i++; }, e.prototype.map = function(r) { var t = []; return this.forEach(function(n, a, i) { t[a[0]] = r(n, a, i); }), t; }, e.prototype.toArray = function() { var r = []; return this.forEach(function(t, n) { r[n[0]] = t; }), r; }, e.prototype.valueOf = function() { return this.toArray(); }, e.prototype.format = function(r) { var t = pa(this.start, r); return this.step !== 1 && (t += ":" + pa(this.step, r)), t += ":" + pa(this.end, r), t; }, e.prototype.toString = function() { return this.format(); }, e.prototype.toJSON = function() { return { mathjs: "Range", start: this.start, end: this.end, step: this.step }; }, e.fromJSON = function(r) { return new e(r.start, r.end, r.step); }, e; }, { isClass: !0 }), l_ = "Matrix", c_ = [], f_ = /* @__PURE__ */ P(l_, c_, () => { function e() { if (!(this instanceof e)) throw new SyntaxError("Constructor must be called with the new operator"); } return e.prototype.type = "Matrix", e.prototype.isMatrix = !0, e.prototype.storage = function() { throw new Error("Cannot invoke storage on a Matrix interface"); }, e.prototype.datatype = function() { throw new Error("Cannot invoke datatype on a Matrix interface"); }, e.prototype.create = function(r, t) { throw new Error("Cannot invoke create on a Matrix interface"); }, e.prototype.subset = function(r, t, n) { throw new Error("Cannot invoke subset on a Matrix interface"); }, e.prototype.get = function(r) { throw new Error("Cannot invoke get on a Matrix interface"); }, e.prototype.set = function(r, t, n) { throw new Error("Cannot invoke set on a Matrix interface"); }, e.prototype.resize = function(r, t) { throw new Error("Cannot invoke resize on a Matrix interface"); }, e.prototype.reshape = function(r, t) { throw new Error("Cannot invoke reshape on a Matrix interface"); }, e.prototype.clone = function() { throw new Error("Cannot invoke clone on a Matrix interface"); }, e.prototype.size = function() { throw new Error("Cannot invoke size on a Matrix interface"); }, e.prototype.map = function(r, t) { throw new Error("Cannot invoke map on a Matrix interface"); }, e.prototype.forEach = function(r) { throw new Error("Cannot invoke forEach on a Matrix interface"); }, e.prototype[Symbol.iterator] = function() { throw new Error("Cannot iterate a Matrix interface"); }, e.prototype.toArray = function() { throw new Error("Cannot invoke toArray on a Matrix interface"); }, e.prototype.valueOf = function() { throw new Error("Cannot invoke valueOf on a Matrix interface"); }, e.prototype.format = function(r) { throw new Error("Cannot invoke format on a Matrix interface"); }, e.prototype.toString = function() { throw new Error("Cannot invoke toString on a Matrix interface"); }, e; }, { isClass: !0 }); function fu(e, r, t) { var n = e.constructor, a = new n(2), i = ""; if (t) { if (t < 1) throw new Error("size must be in greater than 0"); if (!Oe(t)) throw new Error("size must be an integer"); if (e.greaterThan(a.pow(t - 1).sub(1)) || e.lessThan(a.pow(t - 1).mul(-1))) throw new Error("Value must be in range [-2^".concat(t - 1, ", 2^").concat(t - 1, "-1]")); if (!e.isInteger()) throw new Error("Value must be an integer"); e.lessThan(0) && (e = e.add(a.pow(t))), i = "i".concat(t); } switch (r) { case 2: return "".concat(e.toBinary()).concat(i); case 8: return "".concat(e.toOctal()).concat(i); case 16: return "".concat(e.toHexadecimal()).concat(i); default: throw new Error("Base ".concat(r, " not supported ")); } } function d_(e, r) { if (typeof r == "function") return r(e); if (!e.isFinite()) return e.isNaN() ? "NaN" : e.gt(0) ? "Infinity" : "-Infinity"; var { notation: t, precision: n, wordSize: a } = ng(r); switch (t) { case "fixed": return m_(e, n); case "exponential": return Jf(e, n); case "engineering": return p_(e, n); case "bin": return fu(e, 2, a); case "oct": return fu(e, 8, a); case "hex": return fu(e, 16, a); case "auto": { var i = Yf(r == null ? void 0 : r.lowerExp, -3), o = Yf(r == null ? void 0 : r.upperExp, 5); if (e.isZero()) return "0"; var l, u = e.toSignificantDigits(n), s = u.e; return s >= i && s < o ? l = u.toFixed() : l = Jf(e, n), l.replace(/((\.\d*?)(0+))($|e)/, function() { var c = arguments[2], f = arguments[4]; return c !== "." ? c + f : f; }); } default: throw new Error('Unknown notation "' + t + '". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.'); } } function p_(e, r) { var t = e.e, n = t % 3 === 0 ? t : t < 0 ? t - 3 - t % 3 : t - t % 3, a = e.mul(Math.pow(10, -n)), i = a.toPrecision(r); if (i.includes("e")) { var o = e.constructor; i = new o(i).toFixed(); } return i + "e" + (t >= 0 ? "+" : "") + n.toString(); } function Jf(e, r) { return r !== void 0 ? e.toExponential(r - 1) : e.toExponential(); } function m_(e, r) { return e.toFixed(r); } function Yf(e, r) { return We(e) ? e : Ze(e) ? e.toNumber() : r; } function v_(e, r) { var t = e.length - r.length, n = e.length; return e.substring(t, n) === r; } function Qe(e, r) { var t = h_(e, r); return r && typeof r == "object" && "truncate" in r && t.length > r.truncate ? t.substring(0, r.truncate - 3) + "..." : t; } function h_(e, r) { if (typeof e == "number") return pa(e, r); if (Ze(e)) return d_(e, r); if (g_(e)) return !r || r.fraction !== "decimal" ? e.s * e.n + "/" + e.d : e.toString(); if (Array.isArray(e)) return yg(e, r); if (Vr(e)) return za(e); if (typeof e == "function") return e.syntax ? String(e.syntax) : "function"; if (e && typeof e == "object") { if (typeof e.format == "function") return e.format(r); if (e && e.toString(r) !== {}.toString()) return e.toString(r); var t = Object.keys(e).map((n) => za(n) + ": " + Qe(e[n], r)); return "{" + t.join(", ") + "}"; } return String(e); } function za(e) { for (var r = String(e), t = "", n = 0; n < r.length; ) { var a = r.charAt(n); t += a in jf ? jf[a] : a, n++; } return '"' + t + '"'; } var jf = { '"': '\\"', "\\": "\\\\", "\b": "\\b", "\f": "\\f", "\n": "\\n", "\r": "\\r", " ": "\\t" }; function Mt(e) { var r = String(e); return r = r.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(//g, ">"), r; } function yg(e, r) { if (Array.isArray(e)) { for (var t = "[", n = e.length, a = 0; a < n; a++) a !== 0 && (t += ", "), t += yg(e[a], r); return t += "]", t; } else return Qe(e, r); } function g_(e) { return e && typeof e == "object" && typeof e.s == "number" && typeof e.n == "number" && typeof e.d == "number" || !1; } function ku(e, r) { if (!Vr(e)) throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: " + yr(e) + ", index: 0)"); if (!Vr(r)) throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: " + yr(r) + ", index: 1)"); return e === r ? 0 : e > r ? 1 : -1; } function Ye(e, r, t) { if (!(this instanceof Ye)) throw new SyntaxError("Constructor must be called with the new operator"); this.actual = e, this.expected = r, this.relation = t, this.message = "Dimension mismatch (" + (Array.isArray(e) ? "[" + e.join(", ") + "]" : e) + " " + (this.relation || "!=") + " " + (Array.isArray(r) ? "[" + r.join(", ") + "]" : r) + ")", this.stack = new Error().stack; } Ye.prototype = new RangeError(); Ye.prototype.constructor = RangeError; Ye.prototype.name = "DimensionError"; Ye.prototype.isDimensionError = !0; function $t(e, r, t) { if (!(this instanceof $t)) throw new SyntaxError("Constructor must be called with the new operator"); this.index = e, arguments.length < 3 ? (this.min = 0, this.max = r) : (this.min = r, this.max = t), this.min !== void 0 && this.index < this.min ? this.message = "Index out of range (" + this.index + " < " + this.min + ")" : this.max !== void 0 && this.index >= this.max ? this.message = "Index out of range (" + this.index + " > " + (this.max - 1) + ")" : this.message = "Index out of range (" + this.index + ")", this.stack = new Error().stack; } $t.prototype = new RangeError(); $t.prototype.constructor = RangeError; $t.prototype.name = "IndexError"; $t.prototype.isIndexError = !0; function ke(e) { for (var r = []; Array.isArray(e); ) r.push(e.length), e = e[0]; return r; } function bg(e, r, t) { var n, a = e.length; if (a !== r[t]) throw new Ye(a, r[t]); if (t < r.length - 1) { var i = t + 1; for (n = 0; n < a; n++) { var o = e[n]; if (!Array.isArray(o)) throw new Ye(r.length - 1, r.length, "<"); bg(e[n], r, i); } } else for (n = 0; n < a; n++) if (Array.isArray(e[n])) throw new Ye(r.length + 1, r.length, ">"); } function Xf(e, r) { var t = r.length === 0; if (t) { if (Array.isArray(e)) throw new Ye(e.length, 0); } else bg(e, r, 0); } function Jo(e, r) { var t = e.isMatrix ? e._size : ke(e), n = r._sourceSize; n.forEach((a, i) => { if (a !== null && a !== t[i]) throw new Ye(a, t[i]); }); } function gr(e, r) { if (e !== void 0) { if (!We(e) || !Oe(e)) throw new TypeError("Index must be an integer (value: " + e + ")"); if (e < 0 || typeof r == "number" && e >= r) throw new $t(e, r); } } function ei(e) { for (var r = 0; r < e._dimensions.length; ++r) { var t = e._dimensions[r]; if (t._data && cr(t._data)) { if (t._size[0] === 0) return !0; } else if (t.isRange) { if (t.start === t.end) return !0; } else if (Vr(t) && t.length === 0) return !0; } return !1; } function ri(e, r, t) { if (!Array.isArray(r)) throw new TypeError("Array expected"); if (r.length === 0) throw new Error("Resizing to scalar is not supported"); r.forEach(function(a) { if (!We(a) || !Oe(a) || a < 0) throw new TypeError("Invalid size, must contain positive integers (size: " + Qe(r) + ")"); }), (We(e) || Ze(e)) && (e = [e]); var n = t !== void 0 ? t : 0; return Vu(e, r, 0, n), e; } function Vu(e, r, t, n) { var a, i, o = e.length, l = r[t], u = Math.min(o, l); if (e.length = l, t < r.length - 1) { var s = t + 1; for (a = 0; a < u; a++) i = e[a], Array.isArray(i) || (i = [i], e[a] = i), Vu(i, r, s, n); for (a = u; a < l; a++) i = [], e[a] = i, Vu(i, r, s, n); } else { for (a = 0; a < u; a++) for (; Array.isArray(e[a]); ) e[a] = e[a][0]; for (a = u; a < l; a++) e[a] = n; } } function Ll(e, r) { var t = sr(e), n = t.length; if (!Array.isArray(e) || !Array.isArray(r)) throw new TypeError("Array expected"); if (r.length === 0) throw new Ye(0, n, "!="); r = Ul(r, n); var a = wg(r); if (n !== a) throw new Ye(a, n, "!="); try { return y_(t, r); } catch (i) { throw i instanceof Ye ? new Ye(a, n, "!=") : i; } } function Ul(e, r) { var t = wg(e), n = e.slice(), a = -1, i = e.indexOf(a), o = e.indexOf(a, i + 1) >= 0; if (o) throw new Error("More than one wildcard in sizes"); var l = i >= 0, u = r % t === 0; if (l) if (u) n[i] = -r / t; else throw new Error("Could not replace wildcard, since " + r + " is no multiple of " + -t); return n; } function wg(e) { return e.reduce((r, t) => r * t, 1); } function y_(e, r) { for (var t = e, n, a = r.length - 1; a > 0; a--) { var i = r[a]; n = []; for (var o = t.length / i, l = 0; l < o; l++) n.push(t.slice(l * i, (l + 1) * i)); t = n; } return t; } function Yo(e, r) { for (var t = ke(e); Array.isArray(e) && e.length === 1; ) e = e[0], t.shift(); for (var n = t.length; t[n - 1] === 1; ) n--; return n < t.length && (e = xg(e, n, 0), t.length = n), e; } function xg(e, r, t) { var n, a; if (t < r) { var i = t + 1; for (n = 0, a = e.length; n < a; n++) e[n] = xg(e[n], r, i); } else for (; Array.isArray(e); ) e = e[0]; return e; } function Ag(e, r, t, n) { var a = n || ke(e); if (t) for (var i = 0; i < t; i++) e = [e], a.unshift(1); for (e = Ng(e, r, 0); a.length < r; ) a.push(1); return e; } function Ng(e, r, t) { var n, a; if (Array.isArray(e)) { var i = t + 1; for (n = 0, a = e.length; n < a; n++) e[n] = Ng(e[n], r, i); } else for (var o = t; o < r; o++) e = [e]; return e; } function sr(e) { if (!Array.isArray(e)) return e; var r = []; return e.forEach(function t(n) { Array.isArray(n) ? n.forEach(t) : r.push(n); }), r; } function Wn(e, r) { return Array.prototype.map.call(e, r); } function Dg(e, r) { Array.prototype.forEach.call(e, r); } function b_(e, r) { if (ke(e).length !== 1) throw new Error("Only one dimensional matrices supported"); return Array.prototype.filter.call(e, r); } function Qf(e, r) { if (ke(e).length !== 1) throw new Error("Only one dimensional matrices supported"); return Array.prototype.filter.call(e, (t) => r.test(t)); } function ed(e, r) { return Array.prototype.join.call(e, r); } function ti(e) { if (!Array.isArray(e)) throw new TypeError("Array input expected"); if (e.length === 0) return e; var r = [], t = 0; r[0] = { value: e[0], identifier: 0 }; for (var n = 1; n < e.length; n++) e[n] === e[n - 1] ? t++ : t = 0, r.push({ value: e[n], identifier: t }); return r; } function jo(e) { if (!Array.isArray(e)) throw new TypeError("Array input expected"); if (e.length === 0) return e; for (var r = [], t = 0; t < e.length; t++) r.push(e[t].value); return r; } function Bs(e, r) { for (var t, n = 0, a = 0; a < e.length; a++) { var i = e[a], o = Array.isArray(i); if (a === 0 && o && (n = i.length), o && i.length !== n) return; var l = o ? Bs(i, r) : r(i); if (t === void 0) t = l; else if (t !== l) return "mixed"; } return t; } function Eg(e, r, t, n) { if (n < t) { if (e.length !== r.length) throw new Ye(e.length, r.length); for (var a = [], i = 0; i < e.length; i++) a[i] = Eg(e[i], r[i], t, n + 1); return a; } else return e.concat(r); } function Sg() { var e = Array.prototype.slice.call(arguments, 0, -1), r = Array.prototype.slice.call(arguments, -1); if (e.length === 1) return e[0]; if (e.length > 1) return e.slice(1).reduce(function(t, n) { return Eg(t, n, r, 0); }, e[0]); throw new Error("Wrong number of arguments in function concat"); } function kl() { for (var e = arguments.length, r = new Array(e), t = 0; t < e; t++) r[t] = arguments[t]; for (var n = r.map((d) => d.length), a = Math.max(...n), i = new Array(a).fill(null), o = 0; o < r.length; o++) for (var l = r[o], u = n[o], s = 0; s < u; s++) { var c = a - u + s; l[s] > i[c] && (i[c] = l[s]); } for (var f = 0; f < r.length; f++) Cg(r[f], i); return i; } function Cg(e, r) { for (var t = r.length, n = e.length, a = 0; a < n; a++) { var i = t - n + a; if (e[a] < r[i] && e[a] > 1 || e[a] > r[i]) throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e, ") not possible to broadcast dimension ").concat(n, " with size ").concat(e[a], " to size ").concat(r[i])); } } function ua(e, r) { var t = ke(e); if (Sn(t, r)) return e; Cg(t, r); var n = kl(t, r), a = n.length, i = [...Array(a - t.length).fill(1), ...t], o = x_(e); t.length < a && (o = Ll(o, i), t = ke(o)); for (var l = 0; l < a; l++) t[l] < n[l] && (o = w_(o, n[l], l), t = ke(o)); return o; } function w_(e, r, t) { return Sg(...Array(r).fill(e), t); } function Vl(e, r) { if (!Array.isArray(e)) throw new Error("Array expected"); var t = ke(e); if (r.length !== t.length) throw new Ye(r.length, t.length); for (var n = 0; n < r.length; n++) gr(r[n], t[n]); return r.reduce((a, i) => a[i], e); } function Hl(e, r, t, n) { return Array.isArray(e) ? e.map(function(a, i) { return Hl(a, r.concat(i), t, n); }) : n(e, r, t); } function x_(e) { return jr([], e); } function ha(e, r, t) { if (Pi.isTypedFunction(e)) { var n = (r.isMatrix ? r.size() : ke(r)).map(() => 0), a = r.isMatrix ? r.get(n) : Vl(r, n), i = Object.keys(e.signatures).length === 1, o = A_(e, a, n, r), l = i ? Object.values(e.signatures)[0] : e; return o >= 1 && o <= 3 ? function() { for (var u = arguments.length, s = new Array(u), c = 0; c < u; c++) s[c] = arguments[c]; return rd(l, s.slice(0, o), t, e.name); } : function() { for (var u = arguments.length, s = new Array(u), c = 0; c < u; c++) s[c] = arguments[c]; return rd(l, s, t, e.name); }; } return e; } function A_(e, r, t, n) { for (var a = [r, t, n], i = 3; i > 0; i--) { var o = a.slice(0, i); if (Pi.resolve(e, o) !== null) return i; } } function rd(e, r, t, n) { try { return e(...r); } catch (a) { N_(a, r, t, n); } } function N_(e, r, t, n) { var a; if (e instanceof TypeError && ((a = e.data) === null || a === void 0 ? void 0 : a.category) === "wrongType") { var i = []; throw i.push("value: ".concat(yr(r[0]))), r.length >= 2 && i.push("index: ".concat(yr(r[1]))), r.length >= 3 && i.push("array: ".concat(yr(r[2]))), new TypeError("Function ".concat(t, " cannot apply callback arguments ") + "".concat(n, "(").concat(i.join(", "), ") at index ").concat(JSON.stringify(r[1]))); } else throw new TypeError("Function ".concat(t, " cannot apply callback arguments ") + "to function ".concat(n, ": ").concat(e.message)); } var D_ = "DenseMatrix", E_ = ["Matrix"], S_ = /* @__PURE__ */ P(D_, E_, (e) => { var { Matrix: r } = e; function t(c, f) { if (!(this instanceof t)) throw new SyntaxError("Constructor must be called with the new operator"); if (f && !Vr(f)) throw new Error("Invalid datatype: " + f); if (ze(c)) c.type === "DenseMatrix" ? (this._data = qe(c._data), this._size = qe(c._size), this._datatype = f || c._datatype) : (this._data = c.toArray(), this._size = c.size(), this._datatype = f || c._datatype); else if (c && cr(c.data) && cr(c.size)) this._data = c.data, this._size = c.size, Xf(this._data, this._size), this._datatype = f || c.datatype; else if (cr(c)) this._data = s(c), this._size = ke(this._data), Xf(this._data, this._size), this._datatype = f; else { if (c) throw new TypeError("Unsupported type of data (" + yr(c) + ")"); this._data = [], this._size = [0], this._datatype = f; } } t.prototype = new r(), t.prototype.createDenseMatrix = function(c, f) { return new t(c, f); }, Object.defineProperty(t, "name", { value: "DenseMatrix" }), t.prototype.constructor = t, t.prototype.type = "DenseMatrix", t.prototype.isDenseMatrix = !0, t.prototype.getDataType = function() { return Bs(this._data, yr); }, t.prototype.storage = function() { return "dense"; }, t.prototype.datatype = function() { return this._datatype; }, t.prototype.create = function(c, f) { return new t(c, f); }, t.prototype.subset = function(c, f, d) { switch (arguments.length) { case 1: return n(this, c); case 2: case 3: return i(this, c, f, d); default: throw new SyntaxError("Wrong number of arguments"); } }, t.prototype.get = function(c) { return Vl(this._data, c); }, t.prototype.set = function(c, f, d) { if (!cr(c)) throw new TypeError("Array expected"); if (c.length < this._size.length) throw new Ye(c.length, this._size.length, "<"); var p, m, v, b = c.map(function(A) { return A + 1; }); u(this, b, d); var y = this._data; for (p = 0, m = c.length - 1; p < m; p++) v = c[p], gr(v, y.length), y = y[v]; return v = c[c.length - 1], gr(v, y.length), y[v] = f, this; }; function n(c, f) { if (!Gi(f)) throw new TypeError("Invalid index"); var d = f.isScalar(); if (d) return c.get(f.min()); var p = f.size(); if (p.length !== c._size.length) throw new Ye(p.length, c._size.length); for (var m = f.min(), v = f.max(), b = 0, y = c._size.length; b < y; b++) gr(m[b], c._size[b]), gr(v[b], c._size[b]); return new t(a(c._data, f, p.length, 0), c._datatype); } function a(c, f, d, p) { var m = p === d - 1, v = f.dimension(p); return m ? v.map(function(b) { return gr(b, c.length), c[b]; }).valueOf() : v.map(function(b) { gr(b, c.length); var y = c[b]; return a(y, f, d, p + 1); }).valueOf(); } function i(c, f, d, p) { if (!f || f.isIndex !== !0) throw new TypeError("Invalid index"); var m = f.size(), v = f.isScalar(), b; if (ze(d) ? (b = d.size(), d = d.valueOf()) : b = ke(d), v) { if (b.length !== 0) throw new TypeError("Scalar expected"); c.set(f.min(), d, p); } else { if (!Sn(b, m)) try { b.length === 0 ? d = ua([d], m) : d = ua(d, m), b = ke(d); } catch { } if (m.length < c._size.length) throw new Ye(m.length, c._size.length, "<"); if (b.length < m.length) { for (var y = 0, A = 0; m[y] === 1 && b[y] === 1; ) y++; for (; m[y] === 1; ) A++, y++; d = Ag(d, m.length, A, b); } if (!Sn(m, b)) throw new Ye(m, b, ">"); var h = f.max().map(function(g) { return g + 1; }); u(c, h, p); var x = m.length, w = 0; o(c._data, f, d, x, w); } return c; } function o(c, f, d, p, m) { var v = m === p - 1, b = f.dimension(m); v ? b.forEach(function(y, A) { gr(y), c[y] = d[A[0]]; }) : b.forEach(function(y, A) { gr(y), o(c[y], f, d[A[0]], p, m + 1); }); } t.prototype.resize = function(c, f, d) { if (!At(c)) throw new TypeError("Array or Matrix expected"); var p = c.valueOf().map((v) => Array.isArray(v) && v.length === 1 ? v[0] : v), m = d ? this.clone() : this; return l(m, p, f); }; function l(c, f, d) { if (f.length === 0) { for (var p = c._data; cr(p); ) p = p[0]; return p; } return c._size = f.slice(0), c._data = ri(c._data, c._size, d), c; } t.prototype.reshape = function(c, f) { var d = f ? this.clone() : this; d._data = Ll(d._data, c); var p = d._size.reduce((m, v) => m * v); return d._size = Ul(c, p), d; }; function u(c, f, d) { for (var p = c._size.slice(0), m = !1; p.length < f.length; ) p.push(0), m = !0; for (var v = 0, b = f.length; v < b; v++) f[v] > p[v] && (p[v] = f[v], m = !0); m && l(c, p, d); } t.prototype.clone = function() { var c = new t({ data: qe(this._data), size: qe(this._size), datatype: this._datatype }); return c; }, t.prototype.size = function() { return this._size.slice(0); }, t.prototype._forEach = function(c) { var f = this, d = f.size(); if (d.length === 1) { for (var p = 0; p < d[0]; p++) c(f._data, p, [p]); return; } var m = Array(d.length).fill(0), v = Array(d.length - 1), b = v.length - 1; v[0] = f._data[0]; for (var y = 0; y < b; y++) v[y + 1] = v[y][0]; for (m[b] = -1; ; ) { var A = void 0; for (A = b; A >= 0; A--) { if (m[A]++, m[A] === d[A]) { m[A] = 0; continue; } v[A] = A === 0 ? f._data[m[A]] : v[A - 1][m[A]]; for (var h = A; h < b; h++) v[h + 1] = v[h][0]; for (var x = 0; x < d[v.length]; x++) m[v.length] = x, c(v[b], x, m.slice(0)); break; } if (A === -1) break; } }, t.prototype.map = function(c) { var f = this, d = new t(f), p = ha(c, f._data, "map"); return d._forEach(function(m, v, b) { m[v] = p(m[v], b, f); }), d; }, t.prototype.forEach = function(c) { var f = this, d = ha(c, f._data, "map"); f._forEach(function(p, m, v) { d(p[m], v, f); }); }, t.prototype[Symbol.iterator] = function* () { var c = function* (d, p) { if (cr(d)) for (var m = 0; m < d.length; m++) yield* c(d[m], p.concat(m)); else yield { value: d, index: p }; }; yield* c(this._data, []); }, t.prototype.rows = function() { var c = [], f = this.size(); if (f.length !== 2) throw new TypeError("Rows can only be returned for a 2D matrix."); var d = this._data; for (var p of d) c.push(new t([p], this._datatype)); return c; }, t.prototype.columns = function() { var c = this, f = [], d = this.size(); if (d.length !== 2) throw new TypeError("Rows can only be returned for a 2D matrix."); for (var p = this._data, m = function(y) { var A = p.map((h) => [h[y]]); f.push(new t(A, c._datatype)); }, v = 0; v < d[1]; v++) m(v); return f; }, t.prototype.toArray = function() { return qe(this._data); }, t.prototype.valueOf = function() { return this._data; }, t.prototype.format = function(c) { return Qe(this._data, c); }, t.prototype.toString = function() { return Qe(this._data); }, t.prototype.toJSON = function() { return { mathjs: "DenseMatrix", data: this._data, size: this._size, datatype: this._datatype }; }, t.prototype.diagonal = function(c) { if (c) { if (Ze(c) && (c = c.toNumber()), !We(c) || !Oe(c)) throw new TypeError("The parameter k must be an integer number"); } else c = 0; for (var f = c > 0 ? c : 0, d = c < 0 ? -c : 0, p = this._size[0], m = this._size[1], v = Math.min(p - d, m - f), b = [], y = 0; y < v; y++) b[y] = this._data[y + d][y + f]; return new t({ data: b, size: [v], datatype: this._datatype }); }, t.diagonal = function(c, f, d, p) { if (!cr(c)) throw new TypeError("Array expected, size parameter"); if (c.length !== 2) throw new Error("Only two dimensions matrix are supported"); if (c = c.map(function(D) { if (Ze(D) && (D = D.toNumber()), !We(D) || !Oe(D) || D < 1) throw new Error("Size values must be positive integers"); return D; }), d) { if (Ze(d) && (d = d.toNumber()), !We(d) || !Oe(d)) throw new TypeError("The parameter k must be an integer number"); } else d = 0; var m = d > 0 ? d : 0, v = d < 0 ? -d : 0, b = c[0], y = c[1], A = Math.min(b - v, y - m), h; if (cr(f)) { if (f.length !== A) throw new Error("Invalid value array length"); h = function(E) { return f[E]; }; } else if (ze(f)) { var x = f.size(); if (x.length !== 1 || x[0] !== A) throw new Error("Invalid matrix length"); h = function(E) { return f.get([E]); }; } else h = function() { return f; }; p || (p = Ze(h(0)) ? h(0).mul(0) : 0); var w = []; if (c.length > 0) { w = ri(w, c, p); for (var g = 0; g < A; g++) w[g + v][g + m] = h(g); } return new t({ data: w, size: [b, y] }); }, t.fromJSON = function(c) { return new t(c); }, t.prototype.swapRows = function(c, f) { if (!We(c) || !Oe(c) || !We(f) || !Oe(f)) throw new Error("Row index must be positive integers"); if (this._size.length !== 2) throw new Error("Only two dimensional matrix is supported"); return gr(c, this._size[0]), gr(f, this._size[0]), t._swapRows(c, f, this._data), this; }, t._swapRows = function(c, f, d) { var p = d[c]; d[c] = d[f], d[f] = p; }; function s(c) { return ze(c) ? s(c.valueOf()) : cr(c) ? c.map(s) : c; } return t; }, { isClass: !0 }), td = "clone", C_ = ["typed"], M_ = /* @__PURE__ */ P(td, C_, (e) => { var { typed: r } = e; return r(td, { any: qe }); }); function Mg(e) { var r = e.length, t = e[0].length, n, a, i = []; for (a = 0; a < t; a++) { var o = []; for (n = 0; n < r; n++) o.push(e[n][a]); i.push(o); } return i; } function ci(e) { for (var r = 0; r < e.length; r++) if (At(e[r])) return !0; return !1; } function Cn(e, r) { ze(e) && (e = e.valueOf()); for (var t = 0, n = e.length; t < n; t++) { var a = e[t]; Array.isArray(a) ? Cn(a, r) : r(a); } } function je(e, r, t) { return e && typeof e.map == "function" ? e.map(function(n) { return je(n, r); }) : r(e); } function $s(e, r, t) { var n = Array.isArray(e) ? ke(e) : e.size(); if (r < 0 || r >= n.length) throw new $t(r, n.length); return ze(e) ? e.create(Xo(e.valueOf(), r, t), e.datatype()) : Xo(e, r, t); } function Xo(e, r, t) { var n, a, i, o; if (r <= 0) if (Array.isArray(e[0])) { for (o = Mg(e), a = [], n = 0; n < o.length; n++) a[n] = Xo(o[n], r - 1, t); return a; } else { for (i = e[0], n = 1; n < e.length; n++) i = t(i, e[n]); return i; } else { for (a = [], n = 0; n < e.length; n++) a[n] = Xo(e[n], r - 1, t); return a; } } function nd(e, r, t, n, a, i, o, l, u, s, c) { var f = e._values, d = e._index, p = e._ptr, m, v, b, y; if (n) for (v = p[r], b = p[r + 1], m = v; m < b; m++) y = d[m], t[y] !== i ? (t[y] = i, o.push(y), n[y] = f[m]) : (n[y] = l(n[y], f[m]), a[y] = i); else for (v = p[r], b = p[r + 1], m = v; m < b; m++) y = d[m], t[y] !== i ? (t[y] = i, o.push(y)) : a[y] = i; } var ad = "isInteger", __ = ["typed"], F_ = /* @__PURE__ */ P(ad, __, (e) => { var { typed: r } = e; return r(ad, { number: Oe, // TODO: what to do with isInteger(add(0.1, 0.2)) ? BigNumber: function(n) { return n.isInt(); }, bigint: function(n) { return !0; }, Fraction: function(n) { return n.d === 1 && isFinite(n.n); }, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), Gt = "number", fi = "number, number"; function _g(e) { return Math.abs(e); } _g.signature = Gt; function Fg(e, r) { return e + r; } Fg.signature = fi; function Tg(e, r) { return e - r; } Tg.signature = fi; function Og(e, r) { return e * r; } Og.signature = fi; function Bg(e) { return -e; } Bg.signature = Gt; function $g(e) { return e; } $g.signature = Gt; function Di(e) { return BC(e); } Di.signature = Gt; function Ig(e) { return e * e * e; } Ig.signature = Gt; function Rg(e) { return Math.exp(e); } Rg.signature = Gt; function Pg(e) { return $C(e); } Pg.signature = Gt; function zg(e, r) { if (!Oe(e) || !Oe(r)) throw new Error("Parameters in function lcm must be integer numbers"); if (e === 0 || r === 0) return 0; for (var t, n = e * r; r !== 0; ) t = r, r = e % t, e = t; return Math.abs(n / e); } zg.signature = fi; function T_(e, r) { return Math.log(e); } function qg(e) { return TC(e); } qg.signature = Gt; function Lg(e) { return FC(e); } Lg.signature = Gt; function id(e) { var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2, t = r < 0; if (t && (r = -r), r === 0) throw new Error("Root must be non-zero"); if (e < 0 && Math.abs(r) % 2 !== 1) throw new Error("Root must be odd when a is negative."); if (e === 0) return t ? 1 / 0 : 0; if (!isFinite(e)) return t ? 0 : e; var n = Math.pow(Math.abs(e), 1 / r); return n = e < 0 ? -n : n, t ? 1 / n : n; } function Hu(e) { return Vn(e); } Hu.signature = Gt; function Ug(e) { return e * e; } Ug.signature = Gt; function kg(e, r) { var t, n, a, i = 0, o = 1, l = 1, u = 0; if (!Oe(e) || !Oe(r)) throw new Error("Parameters in function xgcd must be integer numbers"); for (; r; ) n = Math.floor(e / r), a = e - n * r, t = i, i = o - n * i, o = t, t = l, l = u - n * l, u = t, e = r, r = a; var s; return e < 0 ? s = [-e, -o, -u] : s = [e, e ? o : 0, u], s; } kg.signature = fi; function Vg(e, r) { return e * e < 1 && r === 1 / 0 || e * e > 1 && r === -1 / 0 ? 0 : Math.pow(e, r); } Vg.signature = fi; function Ai(e) { var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; if (!Oe(r) || r < 0 || r > 15) throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive"); return parseFloat(ag(e, r)); } var O_ = "number", di = "number, number"; function Hg(e, r) { if (!Oe(e) || !Oe(r)) throw new Error("Integers expected in function bitAnd"); return e & r; } Hg.signature = di; function Zg(e) { if (!Oe(e)) throw new Error("Integer expected in function bitNot"); return ~e; } Zg.signature = O_; function Gg(e, r) { if (!Oe(e) || !Oe(r)) throw new Error("Integers expected in function bitOr"); return e | r; } Gg.signature = di; function Wg(e, r) { if (!Oe(e) || !Oe(r)) throw new Error("Integers expected in function bitXor"); return e ^ r; } Wg.signature = di; function Kg(e, r) { if (!Oe(e) || !Oe(r)) throw new Error("Integers expected in function leftShift"); return e << r; } Kg.signature = di; function Jg(e, r) { if (!Oe(e) || !Oe(r)) throw new Error("Integers expected in function rightArithShift"); return e >> r; } Jg.signature = di; function Yg(e, r) { if (!Oe(e) || !Oe(r)) throw new Error("Integers expected in function rightLogShift"); return e >>> r; } Yg.signature = di; function wn(e, r) { if (r < e) return 1; if (r === e) return r; var t = r + e >> 1; return wn(e, t) * wn(t + 1, r); } function jg(e, r) { if (!Oe(e) || e < 0) throw new TypeError("Positive integer value expected in function combinations"); if (!Oe(r) || r < 0) throw new TypeError("Positive integer value expected in function combinations"); if (r > e) throw new TypeError("k must be less than or equal to n"); for (var t = e - r, n = 1, a = r < t ? t + 1 : r + 1, i = 2, o = r < t ? r : t, l = a; l <= e; ++l) for (n *= l; i <= o && n % i === 0; ) n /= i, ++i; return i <= o && (n /= wn(i, o)), n; } jg.signature = "number, number"; var B_ = Math.PI, $_ = 2 * Math.PI, I_ = Math.E, R_ = 1.618033988749895, P_ = "number", Zl = "number, number"; function Xg(e) { return !e; } Xg.signature = P_; function Zu(e, r) { return !!(e || r); } Zu.signature = Zl; function Gu(e, r) { return !!e != !!r; } Gu.signature = Zl; function Wu(e, r) { return !!(e && r); } Wu.signature = Zl; function Qo(e) { var r; if (Oe(e)) return e <= 0 ? isFinite(e) ? 1 / 0 : NaN : e > 171 ? 1 / 0 : wn(1, e - 1); if (e < 0.5) return Math.PI / (Math.sin(Math.PI * e) * Qo(1 - e)); if (e >= 171.35) return 1 / 0; if (e > 85) { var t = e * e, n = t * e, a = n * e, i = a * e; return Math.sqrt(2 * Math.PI / e) * Math.pow(e / Math.E, e) * (1 + 1 / (12 * e) + 1 / (288 * t) - 139 / (51840 * n) - 571 / (2488320 * a) + 163879 / (209018880 * i) + 5246819 / (75246796800 * i * e)); } --e, r = ka[0]; for (var o = 1; o < ka.length; ++o) r += ka[o] / (e + o); var l = e + Qg + 0.5; return Math.sqrt(2 * Math.PI) * Math.pow(l, e + 0.5) * Math.exp(-l) * r; } Qo.signature = "number"; var Qg = 4.7421875, ka = [0.9999999999999971, 57.15623566586292, -59.59796035547549, 14.136097974741746, -0.4919138160976202, 3399464998481189e-20, 4652362892704858e-20, -9837447530487956e-20, 1580887032249125e-19, -21026444172410488e-20, 21743961811521265e-20, -1643181065367639e-19, 8441822398385275e-20, -26190838401581408e-21, 36899182659531625e-22], ey = 0.9189385332046728, z_ = 5, q_ = 7, od = [1.000000000190015, 76.18009172947146, -86.50532032941678, 24.01409824083091, -1.231739572450155, 0.001208650973866179, -5395239384953e-18]; function es(e) { if (e < 0) return NaN; if (e === 0) return 1 / 0; if (!isFinite(e)) return e; if (e < 0.5) return Math.log(Math.PI / Math.sin(Math.PI * e)) - es(1 - e); e = e - 1; for (var r = e + z_ + 0.5, t = od[0], n = q_ - 1; n >= 1; n--) t += od[n] / (e + n); return ey + (e + 0.5) * Math.log(r) - r + Math.log(t); } es.signature = "number"; var et = "number"; function ry(e) { return zC(e); } ry.signature = et; function ty(e) { return Math.atan(1 / e); } ty.signature = et; function ny(e) { return isFinite(e) ? (Math.log((e + 1) / e) + Math.log(e / (e - 1))) / 2 : 0; } ny.signature = et; function ay(e) { return Math.asin(1 / e); } ay.signature = et; function iy(e) { var r = 1 / e; return Math.log(r + Math.sqrt(r * r + 1)); } iy.signature = et; function oy(e) { return Math.acos(1 / e); } oy.signature = et; function sy(e) { var r = 1 / e, t = Math.sqrt(r * r - 1); return Math.log(t + r); } sy.signature = et; function uy(e) { return qC(e); } uy.signature = et; function ly(e) { return LC(e); } ly.signature = et; function cy(e) { return 1 / Math.tan(e); } cy.signature = et; function fy(e) { var r = Math.exp(2 * e); return (r + 1) / (r - 1); } fy.signature = et; function dy(e) { return 1 / Math.sin(e); } dy.signature = et; function py(e) { return e === 0 ? Number.POSITIVE_INFINITY : Math.abs(2 / (Math.exp(e) - Math.exp(-e))) * Vn(e); } py.signature = et; function my(e) { return 1 / Math.cos(e); } my.signature = et; function vy(e) { return 2 / (Math.exp(e) + Math.exp(-e)); } vy.signature = et; function hy(e) { return kC(e); } hy.signature = et; var Gl = "number"; function gy(e) { return e < 0; } gy.signature = Gl; function yy(e) { return e > 0; } yy.signature = Gl; function by(e) { return Number.isNaN(e); } by.signature = Gl; function ht(e, r) { var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1e-9, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0; if (t <= 0) throw new Error("Relative tolerance must be greater than 0"); if (n < 0) throw new Error("Absolute tolerance must be at least 0"); return e.isNaN() || r.isNaN() ? !1 : !e.isFinite() || !r.isFinite() ? e.eq(r) : e.eq(r) ? !0 : e.minus(r).abs().lte(e.constructor.max(e.constructor.max(e.abs(), r.abs()).mul(t), n)); } var sd = "isNegative", L_ = ["typed", "config"], U_ = /* @__PURE__ */ P(sd, L_, (e) => { var { typed: r, config: t } = e; return r(sd, { number: (n) => Gr(n, 0, t.relTol, t.absTol) ? !1 : gy(n), BigNumber: (n) => ht(n, new n.constructor(0), t.relTol, t.absTol) ? !1 : n.isNeg() && !n.isZero() && !n.isNaN(), bigint: (n) => n < 0n, Fraction: (n) => n.s < 0, // It's enough to decide on the sign Unit: r.referToSelf((n) => (a) => r.find(n, a.valueType())(a.value)), "Array | Matrix": r.referToSelf((n) => (a) => je(a, n)) }); }), ud = "isNumeric", k_ = ["typed"], V_ = /* @__PURE__ */ P(ud, k_, (e) => { var { typed: r } = e; return r(ud, { "number | BigNumber | bigint | Fraction | boolean": () => !0, "Complex | Unit | string | null | undefined | Node": () => !1, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), ld = "hasNumericValue", H_ = ["typed", "isNumeric"], Z_ = /* @__PURE__ */ P(ld, H_, (e) => { var { typed: r, isNumeric: t } = e; return r(ld, { boolean: () => !0, string: function(a) { return a.trim().length > 0 && !isNaN(Number(a)); }, any: function(a) { return t(a); } }); }), cd = "isPositive", G_ = ["typed", "config"], W_ = /* @__PURE__ */ P(cd, G_, (e) => { var { typed: r, config: t } = e; return r(cd, { number: (n) => Gr(n, 0, t.relTol, t.absTol) ? !1 : yy(n), BigNumber: (n) => ht(n, new n.constructor(0), t.relTol, t.absTol) ? !1 : !n.isNeg() && !n.isZero() && !n.isNaN(), bigint: (n) => n > 0n, Fraction: (n) => n.s > 0 && n.n > 0, Unit: r.referToSelf((n) => (a) => r.find(n, a.valueType())(a.value)), "Array | Matrix": r.referToSelf((n) => (a) => je(a, n)) }); }), fd = "isZero", K_ = ["typed", "equalScalar"], J_ = /* @__PURE__ */ P(fd, K_, (e) => { var { typed: r, equalScalar: t } = e; return r(fd, { "number | BigNumber | Complex | Fraction": (n) => t(n, 0), bigint: (n) => n === 0n, Unit: r.referToSelf((n) => (a) => r.find(n, a.valueType())(a.value)), "Array | Matrix": r.referToSelf((n) => (a) => je(a, n)) }); }), dd = "isNaN", Y_ = ["typed"], j_ = /* @__PURE__ */ P(dd, Y_, (e) => { var { typed: r } = e; return r(dd, { number: by, BigNumber: function(n) { return n.isNaN(); }, bigint: function(n) { return !1; }, Fraction: function(n) { return !1; }, Complex: function(n) { return n.isNaN(); }, Unit: function(n) { return Number.isNaN(n.value); }, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), pd = "typeOf", X_ = ["typed"], Q_ = /* @__PURE__ */ P(pd, X_, (e) => { var { typed: r } = e; return r(pd, { any: yr }); }); function e3(e, r, t, n) { return Gr(e.re, r.re, t, n) && Gr(e.im, r.im, t, n); } var pi = /* @__PURE__ */ P("compareUnits", ["typed"], (e) => { var { typed: r } = e; return { "Unit, Unit": r.referToSelf((t) => (n, a) => { if (!n.equalBase(a)) throw new Error("Cannot compare units with different base"); return r.find(t, [n.valueType(), a.valueType()])(n.value, a.value); }) }; }), rs = "equalScalar", r3 = ["typed", "config"], t3 = /* @__PURE__ */ P(rs, r3, (e) => { var { typed: r, config: t } = e, n = pi({ typed: r }); return r(rs, { "boolean, boolean": function(i, o) { return i === o; }, "number, number": function(i, o) { return Gr(i, o, t.relTol, t.absTol); }, "BigNumber, BigNumber": function(i, o) { return i.eq(o) || ht(i, o, t.relTol, t.absTol); }, "bigint, bigint": function(i, o) { return i === o; }, "Fraction, Fraction": function(i, o) { return i.equals(o); }, "Complex, Complex": function(i, o) { return e3(i, o, t.relTol, t.absTol); } }, n); }); P(rs, ["typed", "config"], (e) => { var { typed: r, config: t } = e; return r(rs, { "number, number": function(a, i) { return Gr(a, i, t.relTol, t.absTol); } }); }); var n3 = "SparseMatrix", a3 = ["typed", "equalScalar", "Matrix"], i3 = /* @__PURE__ */ P(n3, a3, (e) => { var { typed: r, equalScalar: t, Matrix: n } = e; function a(v, b) { if (!(this instanceof a)) throw new SyntaxError("Constructor must be called with the new operator"); if (b && !Vr(b)) throw new Error("Invalid datatype: " + b); if (ze(v)) i(this, v, b); else if (v && cr(v.index) && cr(v.ptr) && cr(v.size)) this._values = v.values, this._index = v.index, this._ptr = v.ptr, this._size = v.size, this._datatype = b || v.datatype; else if (cr(v)) o(this, v, b); else { if (v) throw new TypeError("Unsupported type of data (" + yr(v) + ")"); this._values = [], this._index = [], this._ptr = [0], this._size = [0, 0], this._datatype = b; } } function i(v, b, y) { b.type === "SparseMatrix" ? (v._values = b._values ? qe(b._values) : void 0, v._index = qe(b._index), v._ptr = qe(b._ptr), v._size = qe(b._size), v._datatype = y || b._datatype) : o(v, b.valueOf(), y || b._datatype); } function o(v, b, y) { v._values = [], v._index = [], v._ptr = [], v._datatype = y; var A = b.length, h = 0, x = t, w = 0; if (Vr(y) && (x = r.find(t, [y, y]) || t, w = r.convert(0, y)), A > 0) { var g = 0; do { v._ptr.push(v._index.length); for (var D = 0; D < A; D++) { var E = b[D]; if (cr(E)) { if (g === 0 && h < E.length && (h = E.length), g < E.length) { var N = E[g]; x(N, w) || (v._values.push(N), v._index.push(D)); } } else g === 0 && h < 1 && (h = 1), x(E, w) || (v._values.push(E), v._index.push(D)); } g++; } while (g < h); } v._ptr.push(v._index.length), v._size = [A, h]; } a.prototype = new n(), a.prototype.createSparseMatrix = function(v, b) { return new a(v, b); }, Object.defineProperty(a, "name", { value: "SparseMatrix" }), a.prototype.constructor = a, a.prototype.type = "SparseMatrix", a.prototype.isSparseMatrix = !0, a.prototype.getDataType = function() { return Bs(this._values, yr); }, a.prototype.storage = function() { return "sparse"; }, a.prototype.datatype = function() { return this._datatype; }, a.prototype.create = function(v, b) { return new a(v, b); }, a.prototype.density = function() { var v = this._size[0], b = this._size[1]; return v !== 0 && b !== 0 ? this._index.length / (v * b) : 0; }, a.prototype.subset = function(v, b, y) { if (!this._values) throw new Error("Cannot invoke subset on a Pattern only matrix"); switch (arguments.length) { case 1: return l(this, v); case 2: case 3: return u(this, v, b, y); default: throw new SyntaxError("Wrong number of arguments"); } }; function l(v, b) { if (!Gi(b)) throw new TypeError("Invalid index"); var y = b.isScalar(); if (y) return v.get(b.min()); var A = b.size(); if (A.length !== v._size.length) throw new Ye(A.length, v._size.length); var h, x, w, g, D = b.min(), E = b.max(); for (h = 0, x = v._size.length; h < x; h++) gr(D[h], v._size[h]), gr(E[h], v._size[h]); var N = v._values, S = v._index, M = v._ptr, F = b.dimension(0), $ = b.dimension(1), I = [], B = []; F.forEach(function(O, W) { B[O] = W[0], I[O] = !0; }); var C = N ? [] : void 0, _ = [], z = []; return $.forEach(function(O) { for (z.push(_.length), w = M[O], g = M[O + 1]; w < g; w++) h = S[w], I[h] === !0 && (_.push(B[h]), C && C.push(N[w])); }), z.push(_.length), new a({ values: C, index: _, ptr: z, size: A, datatype: v._datatype }); } function u(v, b, y, A) { if (!b || b.isIndex !== !0) throw new TypeError("Invalid index"); var h = b.size(), x = b.isScalar(), w; if (ze(y) ? (w = y.size(), y = y.toArray()) : w = ke(y), x) { if (w.length !== 0) throw new TypeError("Scalar expected"); v.set(b.min(), y, A); } else { if (h.length !== 1 && h.length !== 2) throw new Ye(h.length, v._size.length, "<"); if (w.length < h.length) { for (var g = 0, D = 0; h[g] === 1 && w[g] === 1; ) g++; for (; h[g] === 1; ) D++, g++; y = Ag(y, h.length, D, w); } if (!Sn(h, w)) throw new Ye(h, w, ">"); if (h.length === 1) { var E = b.dimension(0); E.forEach(function(M, F) { gr(M), v.set([M, 0], y[F[0]], A); }); } else { var N = b.dimension(0), S = b.dimension(1); N.forEach(function(M, F) { gr(M), S.forEach(function($, I) { gr($), v.set([M, $], y[F[0]][I[0]], A); }); }); } } return v; } a.prototype.get = function(v) { if (!cr(v)) throw new TypeError("Array expected"); if (v.length !== this._size.length) throw new Ye(v.length, this._size.length); if (!this._values) throw new Error("Cannot invoke get on a Pattern only matrix"); var b = v[0], y = v[1]; gr(b, this._size[0]), gr(y, this._size[1]); var A = s(b, this._ptr[y], this._ptr[y + 1], this._index); return A < this._ptr[y + 1] && this._index[A] === b ? this._values[A] : 0; }, a.prototype.set = function(v, b, y) { if (!cr(v)) throw new TypeError("Array expected"); if (v.length !== this._size.length) throw new Ye(v.length, this._size.length); if (!this._values) throw new Error("Cannot invoke set on a Pattern only matrix"); var A = v[0], h = v[1], x = this._size[0], w = this._size[1], g = t, D = 0; Vr(this._datatype) && (g = r.find(t, [this._datatype, this._datatype]) || t, D = r.convert(0, this._datatype)), (A > x - 1 || h > w - 1) && (d(this, Math.max(A + 1, x), Math.max(h + 1, w), y), x = this._size[0], w = this._size[1]), gr(A, x), gr(h, w); var E = s(A, this._ptr[h], this._ptr[h + 1], this._index); return E < this._ptr[h + 1] && this._index[E] === A ? g(b, D) ? c(E, h, this._values, this._index, this._ptr) : this._values[E] = b : g(b, D) || f(E, A, h, b, this._values, this._index, this._ptr), this; }; function s(v, b, y, A) { if (y - b === 0) return y; for (var h = b; h < y; h++) if (A[h] === v) return h; return b; } function c(v, b, y, A, h) { y.splice(v, 1), A.splice(v, 1); for (var x = b + 1; x < h.length; x++) h[x]--; } function f(v, b, y, A, h, x, w) { h.splice(v, 0, A), x.splice(v, 0, b); for (var g = y + 1; g < w.length; g++) w[g]++; } a.prototype.resize = function(v, b, y) { if (!At(v)) throw new TypeError("Array or Matrix expected"); var A = v.valueOf().map((x) => Array.isArray(x) && x.length === 1 ? x[0] : x); if (A.length !== 2) throw new Error("Only two dimensions matrix are supported"); A.forEach(function(x) { if (!We(x) || !Oe(x) || x < 0) throw new TypeError("Invalid size, must contain positive integers (size: " + Qe(A) + ")"); }); var h = y ? this.clone() : this; return d(h, A[0], A[1], b); }; function d(v, b, y, A) { var h = A || 0, x = t, w = 0; Vr(v._datatype) && (x = r.find(t, [v._datatype, v._datatype]) || t, w = r.convert(0, v._datatype), h = r.convert(h, v._datatype)); var g = !x(h, w), D = v._size[0], E = v._size[1], N, S, M; if (y > E) { for (S = E; S < y; S++) if (v._ptr[S] = v._values.length, g) for (N = 0; N < D; N++) v._values.push(h), v._index.push(N); v._ptr[y] = v._values.length; } else y < E && (v._ptr.splice(y + 1, E - y), v._values.splice(v._ptr[y], v._values.length), v._index.splice(v._ptr[y], v._index.length)); if (E = y, b > D) { if (g) { var F = 0; for (S = 0; S < E; S++) { v._ptr[S] = v._ptr[S] + F, M = v._ptr[S + 1] + F; var $ = 0; for (N = D; N < b; N++, $++) v._values.splice(M + $, 0, h), v._index.splice(M + $, 0, N), F++; } v._ptr[E] = v._values.length; } } else if (b < D) { var I = 0; for (S = 0; S < E; S++) { v._ptr[S] = v._ptr[S] - I; var B = v._ptr[S], C = v._ptr[S + 1] - I; for (M = B; M < C; M++) N = v._index[M], N > b - 1 && (v._values.splice(M, 1), v._index.splice(M, 1), I++); } v._ptr[S] = v._values.length; } return v._size[0] = b, v._size[1] = y, v; } a.prototype.reshape = function(v, b) { if (!cr(v)) throw new TypeError("Array expected"); if (v.length !== 2) throw new Error("Sparse matrices can only be reshaped in two dimensions"); v.forEach(function(O) { if (!We(O) || !Oe(O) || O <= -2 || O === 0) throw new TypeError("Invalid size, must contain positive integers or -1 (size: " + Qe(v) + ")"); }); var y = this._size[0] * this._size[1]; v = Ul(v, y); var A = v[0] * v[1]; if (y !== A) throw new Error("Reshaping sparse matrix will result in the wrong number of elements"); var h = b ? this.clone() : this; if (this._size[0] === v[0] && this._size[1] === v[1]) return h; for (var x = [], w = 0; w < h._ptr.length; w++) for (var g = 0; g < h._ptr[w + 1] - h._ptr[w]; g++) x.push(w); for (var D = h._values.slice(), E = h._index.slice(), N = 0; N < h._index.length; N++) { var S = E[N], M = x[N], F = S * h._size[1] + M; x[N] = F % v[1], E[N] = Math.floor(F / v[1]); } h._values.length = 0, h._index.length = 0, h._ptr.length = v[1] + 1, h._size = v.slice(); for (var $ = 0; $ < h._ptr.length; $++) h._ptr[$] = 0; for (var I = 0; I < D.length; I++) { var B = E[I], C = x[I], _ = D[I], z = s(B, h._ptr[C], h._ptr[C + 1], h._index); f(z, B, C, _, h._values, h._index, h._ptr); } return h; }, a.prototype.clone = function() { var v = new a({ values: this._values ? qe(this._values) : void 0, index: qe(this._index), ptr: qe(this._ptr), size: qe(this._size), datatype: this._datatype }); return v; }, a.prototype.size = function() { return this._size.slice(0); }, a.prototype.map = function(v, b) { if (!this._values) throw new Error("Cannot invoke map on a Pattern only matrix"); var y = this, A = this._size[0], h = this._size[1], x = ha(v, y, "map"), w = function(D, E, N) { return x(D, [E, N], y); }; return p(this, 0, A - 1, 0, h - 1, w, b); }; function p(v, b, y, A, h, x, w) { var g = [], D = [], E = [], N = t, S = 0; Vr(v._datatype) && (N = r.find(t, [v._datatype, v._datatype]) || t, S = r.convert(0, v._datatype)); for (var M = function(R, Q, se) { var re = x(R, Q, se); N(re, S) || (g.push(re), D.push(Q)); }, F = A; F <= h; F++) { E.push(g.length); var $ = v._ptr[F], I = v._ptr[F + 1]; if (w) for (var B = $; B < I; B++) { var C = v._index[B]; C >= b && C <= y && M(v._values[B], C - b, F - A); } else { for (var _ = {}, z = $; z < I; z++) { var O = v._index[z]; _[O] = v._values[z]; } for (var W = b; W <= y; W++) { var X = W in _ ? _[W] : 0; M(X, W - b, F - A); } } } return E.push(g.length), new a({ values: g, index: D, ptr: E, size: [y - b + 1, h - A + 1] }); } a.prototype.forEach = function(v, b) { if (!this._values) throw new Error("Cannot invoke forEach on a Pattern only matrix"); for (var y = this, A = this._size[0], h = this._size[1], x = ha(v, y, "forEach"), w = 0; w < h; w++) { var g = this._ptr[w], D = this._ptr[w + 1]; if (b) for (var E = g; E < D; E++) { var N = this._index[E]; x(this._values[E], [N, w], y); } else { for (var S = {}, M = g; M < D; M++) { var F = this._index[M]; S[F] = this._values[M]; } for (var $ = 0; $ < A; $++) { var I = $ in S ? S[$] : 0; x(I, [$, w], y); } } } }, a.prototype[Symbol.iterator] = function* () { if (!this._values) throw new Error("Cannot iterate a Pattern only matrix"); for (var v = this._size[1], b = 0; b < v; b++) for (var y = this._ptr[b], A = this._ptr[b + 1], h = y; h < A; h++) { var x = this._index[h]; yield { value: this._values[h], index: [x, b] }; } }, a.prototype.toArray = function() { return m(this._values, this._index, this._ptr, this._size, !0); }, a.prototype.valueOf = function() { return m(this._values, this._index, this._ptr, this._size, !1); }; function m(v, b, y, A, h) { var x = A[0], w = A[1], g = [], D, E; for (D = 0; D < x; D++) for (g[D] = [], E = 0; E < w; E++) g[D][E] = 0; for (E = 0; E < w; E++) for (var N = y[E], S = y[E + 1], M = N; M < S; M++) D = b[M], g[D][E] = v ? h ? qe(v[M]) : v[M] : 1; return g; } return a.prototype.format = function(v) { for (var b = this._size[0], y = this._size[1], A = this.density(), h = "Sparse Matrix [" + Qe(b, v) + " x " + Qe(y, v) + "] density: " + Qe(A, v) + ` `, x = 0; x < y; x++) for (var w = this._ptr[x], g = this._ptr[x + 1], D = w; D < g; D++) { var E = this._index[D]; h += ` (` + Qe(E, v) + ", " + Qe(x, v) + ") ==> " + (this._values ? Qe(this._values[D], v) : "X"); } return h; }, a.prototype.toString = function() { return Qe(this.toArray()); }, a.prototype.toJSON = function() { return { mathjs: "SparseMatrix", values: this._values, index: this._index, ptr: this._ptr, size: this._size, datatype: this._datatype }; }, a.prototype.diagonal = function(v) { if (v) { if (Ze(v) && (v = v.toNumber()), !We(v) || !Oe(v)) throw new TypeError("The parameter k must be an integer number"); } else v = 0; var b = v > 0 ? v : 0, y = v < 0 ? -v : 0, A = this._size[0], h = this._size[1], x = Math.min(A - y, h - b), w = [], g = [], D = []; D[0] = 0; for (var E = b; E < h && w.length < x; E++) for (var N = this._ptr[E], S = this._ptr[E + 1], M = N; M < S; M++) { var F = this._index[M]; if (F === E - b + y) { w.push(this._values[M]), g[w.length - 1] = F - y; break; } } return D.push(w.length), new a({ values: w, index: g, ptr: D, size: [x, 1] }); }, a.fromJSON = function(v) { return new a(v); }, a.diagonal = function(v, b, y, A, h) { if (!cr(v)) throw new TypeError("Array expected, size parameter"); if (v.length !== 2) throw new Error("Only two dimensions matrix are supported"); if (v = v.map(function(O) { if (Ze(O) && (O = O.toNumber()), !We(O) || !Oe(O) || O < 1) throw new Error("Size values must be positive integers"); return O; }), y) { if (Ze(y) && (y = y.toNumber()), !We(y) || !Oe(y)) throw new TypeError("The parameter k must be an integer number"); } else y = 0; var x = t, w = 0; Vr(h) && (x = r.find(t, [h, h]) || t, w = r.convert(0, h)); var g = y > 0 ? y : 0, D = y < 0 ? -y : 0, E = v[0], N = v[1], S = Math.min(E - D, N - g), M; if (cr(b)) { if (b.length !== S) throw new Error("Invalid value array length"); M = function(W) { return b[W]; }; } else if (ze(b)) { var F = b.size(); if (F.length !== 1 || F[0] !== S) throw new Error("Invalid matrix length"); M = function(W) { return b.get([W]); }; } else M = function() { return b; }; for (var $ = [], I = [], B = [], C = 0; C < N; C++) { B.push($.length); var _ = C - g; if (_ >= 0 && _ < S) { var z = M(_); x(z, w) || (I.push(_ + D), $.push(z)); } } return B.push($.length), new a({ values: $, index: I, ptr: B, size: [E, N] }); }, a.prototype.swapRows = function(v, b) { if (!We(v) || !Oe(v) || !We(b) || !Oe(b)) throw new Error("Row index must be positive integers"); if (this._size.length !== 2) throw new Error("Only two dimensional matrix is supported"); return gr(v, this._size[0]), gr(b, this._size[0]), a._swapRows(v, b, this._size[1], this._values, this._index, this._ptr), this; }, a._forEachRow = function(v, b, y, A, h) { for (var x = A[v], w = A[v + 1], g = x; g < w; g++) h(y[g], b[g]); }, a._swapRows = function(v, b, y, A, h, x) { for (var w = 0; w < y; w++) { var g = x[w], D = x[w + 1], E = s(v, g, D, h), N = s(b, g, D, h); if (E < D && N < D && h[E] === v && h[N] === b) { if (A) { var S = A[E]; A[E] = A[N], A[N] = S; } continue; } if (E < D && h[E] === v && (N >= D || h[N] !== b)) { var M = A ? A[E] : void 0; h.splice(N, 0, b), A && A.splice(N, 0, M), h.splice(N <= E ? E + 1 : E, 1), A && A.splice(N <= E ? E + 1 : E, 1); continue; } if (N < D && h[N] === b && (E >= D || h[E] !== v)) { var F = A ? A[N] : void 0; h.splice(E, 0, v), A && A.splice(E, 0, F), h.splice(E <= N ? N + 1 : N, 1), A && A.splice(E <= N ? N + 1 : N, 1); } } }, a; }, { isClass: !0 }), o3 = "number", s3 = ["typed"]; function u3(e) { var r = e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/); if (r) { var t = { "0b": 2, "0o": 8, "0x": 16 }[r[1]], n = r[2], a = r[3]; return { input: e, radix: t, integerPart: n, fractionalPart: a }; } else return null; } function l3(e) { for (var r = parseInt(e.integerPart, e.radix), t = 0, n = 0; n < e.fractionalPart.length; n++) { var a = parseInt(e.fractionalPart[n], e.radix); t += a / Math.pow(e.radix, n + 1); } var i = r + t; if (isNaN(i)) throw new SyntaxError('String "' + e.input + '" is not a valid number'); return i; } var c3 = /* @__PURE__ */ P(o3, s3, (e) => { var { typed: r } = e, t = r("number", { "": function() { return 0; }, number: function(a) { return a; }, string: function(a) { if (a === "NaN") return NaN; var i = u3(a); if (i) return l3(i); var o = 0, l = a.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/); l && (o = Number(l[2]), a = l[1]); var u = Number(a); if (isNaN(u)) throw new SyntaxError('String "' + a + '" is not a valid number'); if (l) { if (u > 2 ** o - 1) throw new SyntaxError('String "'.concat(a, '" is out of range')); u >= 2 ** (o - 1) && (u = u - 2 ** o); } return u; }, BigNumber: function(a) { return a.toNumber(); }, bigint: function(a) { return Number(a); }, Fraction: function(a) { return a.valueOf(); }, Unit: r.referToSelf((n) => (a) => { var i = a.clone(); return i.value = n(a.value), i; }), null: function(a) { return 0; }, "Unit, string | Unit": function(a, i) { return a.toNumber(i); }, "Array | Matrix": r.referToSelf((n) => (a) => je(a, n)) }); return t.fromJSON = function(n) { return parseFloat(n.value); }, t; }), f3 = "bigint", d3 = ["typed"], p3 = /* @__PURE__ */ P(f3, d3, (e) => { var { typed: r } = e, t = r("bigint", { "": function() { return 0n; }, bigint: function(a) { return a; }, number: function(a) { return BigInt(a.toFixed()); }, BigNumber: function(a) { return BigInt(a.round().toString()); }, Fraction: function(a) { return BigInt(a.valueOf().toFixed()); }, "string | boolean": function(a) { return BigInt(a); }, null: function(a) { return 0n; }, "Array | Matrix": r.referToSelf((n) => (a) => je(a, n)) }); return t.fromJSON = function(n) { return BigInt(n.value); }, t; }), md = "string", m3 = ["typed"], v3 = /* @__PURE__ */ P(md, m3, (e) => { var { typed: r } = e; return r(md, { "": function() { return ""; }, number: pa, null: function(n) { return "null"; }, boolean: function(n) { return n + ""; }, string: function(n) { return n; }, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)), any: function(n) { return String(n); } }); }), vd = "boolean", h3 = ["typed"], g3 = /* @__PURE__ */ P(vd, h3, (e) => { var { typed: r } = e; return r(vd, { "": function() { return !1; }, boolean: function(n) { return n; }, number: function(n) { return !!n; }, null: function(n) { return !1; }, BigNumber: function(n) { return !n.isZero(); }, string: function(n) { var a = n.toLowerCase(); if (a === "true") return !0; if (a === "false") return !1; var i = Number(n); if (n !== "" && !isNaN(i)) return !!i; throw new Error('Cannot convert "' + n + '" to a boolean'); }, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), y3 = "bignumber", b3 = ["typed", "BigNumber"], w3 = /* @__PURE__ */ P(y3, b3, (e) => { var { typed: r, BigNumber: t } = e; return r("bignumber", { "": function() { return new t(0); }, number: function(a) { return new t(a + ""); }, string: function(a) { var i = a.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/); if (i) { var o = i[2], l = t(i[1]), u = new t(2).pow(Number(o)); if (l.gt(u.sub(1))) throw new SyntaxError('String "'.concat(a, '" is out of range')); var s = new t(2).pow(Number(o) - 1); return l.gte(s) ? l.sub(u) : l; } return new t(a); }, BigNumber: function(a) { return a; }, bigint: function(a) { return new t(a.toString()); }, Unit: r.referToSelf((n) => (a) => { var i = a.clone(); return i.value = n(a.value), i; }), Fraction: function(a) { return new t(a.n).div(a.d).times(a.s); }, null: function(a) { return new t(0); }, "Array | Matrix": r.referToSelf((n) => (a) => je(a, n)) }); }), x3 = "complex", A3 = ["typed", "Complex"], N3 = /* @__PURE__ */ P(x3, A3, (e) => { var { typed: r, Complex: t } = e; return r("complex", { "": function() { return t.ZERO; }, number: function(a) { return new t(a, 0); }, "number, number": function(a, i) { return new t(a, i); }, // TODO: this signature should be redundant "BigNumber, BigNumber": function(a, i) { return new t(a.toNumber(), i.toNumber()); }, Fraction: function(a) { return new t(a.valueOf(), 0); }, Complex: function(a) { return a.clone(); }, string: function(a) { return t(a); }, null: function(a) { return t(0); }, Object: function(a) { if ("re" in a && "im" in a) return new t(a.re, a.im); if ("r" in a && "phi" in a || "abs" in a && "arg" in a) return new t(a); throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)"); }, "Array | Matrix": r.referToSelf((n) => (a) => je(a, n)) }); }), D3 = "fraction", E3 = ["typed", "Fraction"], S3 = /* @__PURE__ */ P(D3, E3, (e) => { var { typed: r, Fraction: t } = e; return r("fraction", { number: function(a) { if (!isFinite(a) || isNaN(a)) throw new Error(a + " cannot be represented as a fraction"); return new t(a); }, string: function(a) { return new t(a); }, "number, number": function(a, i) { return new t(a, i); }, null: function(a) { return new t(0); }, BigNumber: function(a) { return new t(a.toString()); }, bigint: function(a) { return new t(a.toString()); }, Fraction: function(a) { return a; }, Unit: r.referToSelf((n) => (a) => { var i = a.clone(); return i.value = n(a.value), i; }), Object: function(a) { return new t(a); }, "Array | Matrix": r.referToSelf((n) => (a) => je(a, n)) }); }), hd = "matrix", C3 = ["typed", "Matrix", "DenseMatrix", "SparseMatrix"], M3 = /* @__PURE__ */ P(hd, C3, (e) => { var { typed: r, Matrix: t, DenseMatrix: n, SparseMatrix: a } = e; return r(hd, { "": function() { return i([]); }, string: function(l) { return i([], l); }, "string, string": function(l, u) { return i([], l, u); }, Array: function(l) { return i(l); }, Matrix: function(l) { return i(l, l.storage()); }, "Array | Matrix, string": i, "Array | Matrix, string, string": i }); function i(o, l, u) { if (l === "dense" || l === "default" || l === void 0) return new n(o, u); if (l === "sparse") return new a(o, u); throw new TypeError("Unknown matrix type " + JSON.stringify(l) + "."); } }), gd = "matrixFromFunction", _3 = ["typed", "matrix", "isZero"], F3 = /* @__PURE__ */ P(gd, _3, (e) => { var { typed: r, matrix: t, isZero: n } = e; return r(gd, { "Array | Matrix, function, string, string": function(o, l, u, s) { return a(o, l, u, s); }, "Array | Matrix, function, string": function(o, l, u) { return a(o, l, u); }, "Matrix, function": function(o, l) { return a(o, l, "dense"); }, "Array, function": function(o, l) { return a(o, l, "dense").toArray(); }, "Array | Matrix, string, function": function(o, l, u) { return a(o, u, l); }, "Array | Matrix, string, string, function": function(o, l, u, s) { return a(o, s, l, u); } }); function a(i, o, l, u) { var s; return u !== void 0 ? s = t(l, u) : s = t(l), s.resize(i), s.forEach(function(c, f) { var d = o(f); n(d) || s.set(f, d); }), s; } }), yd = "matrixFromRows", T3 = ["typed", "matrix", "flatten", "size"], O3 = /* @__PURE__ */ P(yd, T3, (e) => { var { typed: r, matrix: t, flatten: n, size: a } = e; return r(yd, { "...Array": function(u) { return i(u); }, "...Matrix": function(u) { return t(i(u.map((s) => s.toArray()))); } // TODO implement this properly for SparseMatrix }); function i(l) { if (l.length === 0) throw new TypeError("At least one row is needed to construct a matrix."); var u = o(l[0]), s = []; for (var c of l) { var f = o(c); if (f !== u) throw new TypeError("The vectors had different length: " + (u | 0) + " ≠ " + (f | 0)); s.push(n(c)); } return s; } function o(l) { var u = a(l); if (u.length === 1) return u[0]; if (u.length === 2) { if (u[0] === 1) return u[1]; if (u[1] === 1) return u[0]; throw new TypeError("At least one of the arguments is not a vector."); } else throw new TypeError("Only one- or two-dimensional vectors are supported."); } }), bd = "matrixFromColumns", B3 = ["typed", "matrix", "flatten", "size"], $3 = /* @__PURE__ */ P(bd, B3, (e) => { var { typed: r, matrix: t, flatten: n, size: a } = e; return r(bd, { "...Array": function(u) { return i(u); }, "...Matrix": function(u) { return t(i(u.map((s) => s.toArray()))); } // TODO implement this properly for SparseMatrix }); function i(l) { if (l.length === 0) throw new TypeError("At least one column is needed to construct a matrix."); for (var u = o(l[0]), s = [], c = 0; c < u; c++) s[c] = []; for (var f of l) { var d = o(f); if (d !== u) throw new TypeError("The vectors had different length: " + (u | 0) + " ≠ " + (d | 0)); for (var p = n(f), m = 0; m < u; m++) s[m].push(p[m]); } return s; } function o(l) { var u = a(l); if (u.length === 1) return u[0]; if (u.length === 2) { if (u[0] === 1) return u[1]; if (u[1] === 1) return u[0]; throw new TypeError("At least one of the arguments is not a vector."); } else throw new TypeError("Only one- or two-dimensional vectors are supported."); } }), wd = "splitUnit", I3 = ["typed"], R3 = /* @__PURE__ */ P(wd, I3, (e) => { var { typed: r } = e; return r(wd, { "Unit, Array": function(n, a) { return n.splitUnit(a); } }); }), xd = "unaryMinus", P3 = ["typed"], z3 = /* @__PURE__ */ P(xd, P3, (e) => { var { typed: r } = e; return r(xd, { number: Bg, "Complex | BigNumber | Fraction": (t) => t.neg(), bigint: (t) => -t, Unit: r.referToSelf((t) => (n) => { var a = n.clone(); return a.value = r.find(t, a.valueType())(n.value), a; }), // deep map collection, skip zeros since unaryMinus(0) = 0 "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) // TODO: add support for string }); }), Ad = "unaryPlus", q3 = ["typed", "config", "numeric"], L3 = /* @__PURE__ */ P(Ad, q3, (e) => { var { typed: r, config: t, numeric: n } = e; return r(Ad, { number: $g, Complex: function(i) { return i; }, BigNumber: function(i) { return i; }, bigint: function(i) { return i; }, Fraction: function(i) { return i; }, Unit: function(i) { return i.clone(); }, // deep map collection, skip zeros since unaryPlus(0) = 0 "Array | Matrix": r.referToSelf((a) => (i) => je(i, a)), boolean: function(i) { return n(i ? 1 : 0, t.number); }, string: function(i) { return n(i, Qn(i, t)); } }); }), Nd = "abs", U3 = ["typed"], k3 = /* @__PURE__ */ P(Nd, U3, (e) => { var { typed: r } = e; return r(Nd, { number: _g, "Complex | BigNumber | Fraction | Unit": (t) => t.abs(), bigint: (t) => t < 0n ? -t : t, // deep map collection, skip zeros since abs(0) = 0 "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), Dd = "apply", V3 = ["typed", "isInteger"], Wl = /* @__PURE__ */ P(Dd, V3, (e) => { var { typed: r, isInteger: t } = e; return r(Dd, { "Array | Matrix, number | BigNumber, function": function(a, i, o) { if (!t(i)) throw new TypeError("Integer number expected for dimension"); var l = Array.isArray(a) ? ke(a) : a.size(); if (i < 0 || i >= l.length) throw new $t(i, l.length); return ze(a) ? a.create(ts(a.valueOf(), i, o), a.datatype()) : ts(a, i, o); } }); }); function ts(e, r, t) { var n, a, i; if (r <= 0) if (Array.isArray(e[0])) { for (i = H3(e), a = [], n = 0; n < i.length; n++) a[n] = ts(i[n], r - 1, t); return a; } else return t(e); else { for (a = [], n = 0; n < e.length; n++) a[n] = ts(e[n], r - 1, t); return a; } } function H3(e) { var r = e.length, t = e[0].length, n, a, i = []; for (a = 0; a < t; a++) { var o = []; for (n = 0; n < r; n++) o.push(e[n][a]); i.push(o); } return i; } var Ed = "addScalar", Z3 = ["typed"], G3 = /* @__PURE__ */ P(Ed, Z3, (e) => { var { typed: r } = e; return r(Ed, { "number, number": Fg, "Complex, Complex": function(n, a) { return n.add(a); }, "BigNumber, BigNumber": function(n, a) { return n.plus(a); }, "bigint, bigint": function(n, a) { return n + a; }, "Fraction, Fraction": function(n, a) { return n.add(a); }, "Unit, Unit": r.referToSelf((t) => (n, a) => { if (n.value === null || n.value === void 0) throw new Error("Parameter x contains a unit with undefined value"); if (a.value === null || a.value === void 0) throw new Error("Parameter y contains a unit with undefined value"); if (!n.equalBase(a)) throw new Error("Units do not match"); var i = n.clone(); return i.value = r.find(t, [i.valueType(), a.valueType()])(i.value, a.value), i.fixPrefix = !1, i; }) }); }), Sd = "subtractScalar", W3 = ["typed"], K3 = /* @__PURE__ */ P(Sd, W3, (e) => { var { typed: r } = e; return r(Sd, { "number, number": Tg, "Complex, Complex": function(n, a) { return n.sub(a); }, "BigNumber, BigNumber": function(n, a) { return n.minus(a); }, "bigint, bigint": function(n, a) { return n - a; }, "Fraction, Fraction": function(n, a) { return n.sub(a); }, "Unit, Unit": r.referToSelf((t) => (n, a) => { if (n.value === null || n.value === void 0) throw new Error("Parameter x contains a unit with undefined value"); if (a.value === null || a.value === void 0) throw new Error("Parameter y contains a unit with undefined value"); if (!n.equalBase(a)) throw new Error("Units do not match"); var i = n.clone(); return i.value = r.find(t, [i.valueType(), a.valueType()])(i.value, a.value), i.fixPrefix = !1, i; }) }); }), Cd = "cbrt", J3 = ["config", "typed", "isNegative", "unaryMinus", "matrix", "Complex", "BigNumber", "Fraction"], Y3 = /* @__PURE__ */ P(Cd, J3, (e) => { var { config: r, typed: t, isNegative: n, unaryMinus: a, matrix: i, Complex: o, BigNumber: l, Fraction: u } = e; return t(Cd, { number: Di, // note: signature 'number, boolean' is also supported, // created by typed as it knows how to convert number to Complex Complex: s, "Complex, boolean": s, BigNumber: function(d) { return d.cbrt(); }, Unit: c }); function s(f, d) { var p = f.arg() / 3, m = f.abs(), v = new o(Di(m), 0).mul(new o(0, p).exp()); if (d) { var b = [v, new o(Di(m), 0).mul(new o(0, p + Math.PI * 2 / 3).exp()), new o(Di(m), 0).mul(new o(0, p - Math.PI * 2 / 3).exp())]; return r.matrix === "Array" ? b : i(b); } else return v; } function c(f) { if (f.value && Ut(f.value)) { var d = f.clone(); return d.value = 1, d = d.pow(1 / 3), d.value = s(f.value), d; } else { var p = n(f.value); p && (f.value = a(f.value)); var m; Ze(f.value) ? m = new l(1).div(3) : Aa(f.value) ? m = new u(1, 3) : m = 1 / 3; var v = f.pow(m); return p && (v.value = a(v.value)), v; } } }), j3 = "matAlgo11xS0s", X3 = ["typed", "equalScalar"], Kr = /* @__PURE__ */ P(j3, X3, (e) => { var { typed: r, equalScalar: t } = e; return function(a, i, o, l) { var u = a._values, s = a._index, c = a._ptr, f = a._size, d = a._datatype; if (!u) throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value"); var p = f[0], m = f[1], v, b = t, y = 0, A = o; typeof d == "string" && (v = d, b = r.find(t, [v, v]), y = r.convert(0, v), i = r.convert(i, v), A = r.find(o, [v, v])); for (var h = [], x = [], w = [], g = 0; g < m; g++) { w[g] = x.length; for (var D = c[g], E = c[g + 1], N = D; N < E; N++) { var S = s[N], M = l ? A(i, u[N]) : A(u[N], i); b(M, y) || (x.push(S), h.push(M)); } } return w[m] = x.length, a.createSparseMatrix({ values: h, index: x, ptr: w, size: [p, m], datatype: v }); }; }), Q3 = "matAlgo12xSfs", eF = ["typed", "DenseMatrix"], Pr = /* @__PURE__ */ P(Q3, eF, (e) => { var { typed: r, DenseMatrix: t } = e; return function(a, i, o, l) { var u = a._values, s = a._index, c = a._ptr, f = a._size, d = a._datatype; if (!u) throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value"); var p = f[0], m = f[1], v, b = o; typeof d == "string" && (v = d, i = r.convert(i, v), b = r.find(o, [v, v])); for (var y = [], A = [], h = [], x = 0; x < m; x++) { for (var w = x + 1, g = c[x], D = c[x + 1], E = g; E < D; E++) { var N = s[E]; A[N] = u[E], h[N] = w; } for (var S = 0; S < p; S++) x === 0 && (y[S] = []), h[S] === w ? y[S][x] = l ? b(i, A[S]) : b(A[S], i) : y[S][x] = l ? b(i, 0) : b(0, i); } return new t({ data: y, size: [p, m], datatype: v }); }; }), rF = "matAlgo14xDs", tF = ["typed"], Wt = /* @__PURE__ */ P(rF, tF, (e) => { var { typed: r } = e; return function(a, i, o, l) { var u = a._data, s = a._size, c = a._datatype, f, d = o; typeof c == "string" && (f = c, i = r.convert(i, f), d = r.find(o, [f, f])); var p = s.length > 0 ? t(d, 0, s, s[0], u, i, l) : []; return a.createDenseMatrix({ data: p, size: qe(s), datatype: f }); }; function t(n, a, i, o, l, u, s) { var c = []; if (a === i.length - 1) for (var f = 0; f < o; f++) c[f] = s ? n(u, l[f]) : n(l[f], u); else for (var d = 0; d < o; d++) c[d] = t(n, a + 1, i, i[a + 1], l[d], u, s); return c; } }), Ku = "ceil", nF = ["typed", "config", "round", "matrix", "equalScalar", "zeros", "DenseMatrix"], aF = /* @__PURE__ */ P(Ku, ["typed", "config", "round"], (e) => { var { typed: r, config: t, round: n } = e; return r(Ku, { number: function(i) { return Gr(i, n(i), t.relTol, t.absTol) ? n(i) : Math.ceil(i); }, "number, number": function(i, o) { if (Gr(i, n(i, o), t.relTol, t.absTol)) return n(i, o); var [l, u] = "".concat(i, "e").split("e"), s = Math.ceil(Number("".concat(l, "e").concat(Number(u) + o))); return [l, u] = "".concat(s, "e").split("e"), Number("".concat(l, "e").concat(Number(u) - o)); } }); }), iF = /* @__PURE__ */ P(Ku, nF, (e) => { var { typed: r, config: t, round: n, matrix: a, equalScalar: i, zeros: o, DenseMatrix: l } = e, u = Kr({ typed: r, equalScalar: i }), s = Pr({ typed: r, DenseMatrix: l }), c = Wt({ typed: r }), f = aF({ typed: r, config: t, round: n }); return r("ceil", { number: f.signatures.number, "number,number": f.signatures["number,number"], Complex: function(p) { return p.ceil(); }, "Complex, number": function(p, m) { return p.ceil(m); }, "Complex, BigNumber": function(p, m) { return p.ceil(m.toNumber()); }, BigNumber: function(p) { return ht(p, n(p), t.relTol, t.absTol) ? n(p) : p.ceil(); }, "BigNumber, BigNumber": function(p, m) { return ht(p, n(p, m), t.relTol, t.absTol) ? n(p, m) : p.toDecimalPlaces(m.toNumber(), jn.ROUND_CEIL); }, Fraction: function(p) { return p.ceil(); }, "Fraction, number": function(p, m) { return p.ceil(m); }, "Fraction, BigNumber": function(p, m) { return p.ceil(m.toNumber()); }, "Array | Matrix": r.referToSelf((d) => (p) => je(p, d)), "Array, number | BigNumber": r.referToSelf((d) => (p, m) => je(p, (v) => d(v, m))), "SparseMatrix, number | BigNumber": r.referToSelf((d) => (p, m) => u(p, m, d, !1)), "DenseMatrix, number | BigNumber": r.referToSelf((d) => (p, m) => c(p, m, d, !1)), "number | Complex | Fraction | BigNumber, Array": r.referToSelf((d) => (p, m) => c(a(m), p, d, !0).valueOf()), "number | Complex | Fraction | BigNumber, Matrix": r.referToSelf((d) => (p, m) => i(p, 0) ? o(m.size(), m.storage()) : m.storage() === "dense" ? c(m, p, d, !0) : s(m, p, d, !0)) }); }), Md = "cube", oF = ["typed"], sF = /* @__PURE__ */ P(Md, oF, (e) => { var { typed: r } = e; return r(Md, { number: Ig, Complex: function(n) { return n.mul(n).mul(n); }, BigNumber: function(n) { return n.times(n).times(n); }, bigint: function(n) { return n * n * n; }, Fraction: function(n) { return n.pow(3); }, Unit: function(n) { return n.pow(3); } }); }), _d = "exp", uF = ["typed"], lF = /* @__PURE__ */ P(_d, uF, (e) => { var { typed: r } = e; return r(_d, { number: Rg, Complex: function(n) { return n.exp(); }, BigNumber: function(n) { return n.exp(); } }); }), Fd = "expm1", cF = ["typed", "Complex"], fF = /* @__PURE__ */ P(Fd, cF, (e) => { var { typed: r, Complex: t } = e; return r(Fd, { number: Pg, Complex: function(a) { var i = Math.exp(a.re); return new t(i * Math.cos(a.im) - 1, i * Math.sin(a.im)); }, BigNumber: function(a) { return a.exp().minus(1); } }); }), Ju = "fix", dF = ["typed", "Complex", "matrix", "ceil", "floor", "equalScalar", "zeros", "DenseMatrix"], pF = /* @__PURE__ */ P(Ju, ["typed", "ceil", "floor"], (e) => { var { typed: r, ceil: t, floor: n } = e; return r(Ju, { number: function(i) { return i > 0 ? n(i) : t(i); }, "number, number": function(i, o) { return i > 0 ? n(i, o) : t(i, o); } }); }), mF = /* @__PURE__ */ P(Ju, dF, (e) => { var { typed: r, Complex: t, matrix: n, ceil: a, floor: i, equalScalar: o, zeros: l, DenseMatrix: u } = e, s = Pr({ typed: r, DenseMatrix: u }), c = Wt({ typed: r }), f = pF({ typed: r, ceil: a, floor: i }); return r("fix", { number: f.signatures.number, "number, number | BigNumber": f.signatures["number,number"], Complex: function(p) { return new t(p.re > 0 ? Math.floor(p.re) : Math.ceil(p.re), p.im > 0 ? Math.floor(p.im) : Math.ceil(p.im)); }, "Complex, number": function(p, m) { return new t(p.re > 0 ? i(p.re, m) : a(p.re, m), p.im > 0 ? i(p.im, m) : a(p.im, m)); }, "Complex, BigNumber": function(p, m) { var v = m.toNumber(); return new t(p.re > 0 ? i(p.re, v) : a(p.re, v), p.im > 0 ? i(p.im, v) : a(p.im, v)); }, BigNumber: function(p) { return p.isNegative() ? a(p) : i(p); }, "BigNumber, number | BigNumber": function(p, m) { return p.isNegative() ? a(p, m) : i(p, m); }, Fraction: function(p) { return p.s < 0 ? p.ceil() : p.floor(); }, "Fraction, number | BigNumber": function(p, m) { return p.s < 0 ? a(p, m) : i(p, m); }, "Array | Matrix": r.referToSelf((d) => (p) => je(p, d)), "Array | Matrix, number | BigNumber": r.referToSelf((d) => (p, m) => je(p, (v) => d(v, m))), "number | Complex | Fraction | BigNumber, Array": r.referToSelf((d) => (p, m) => c(n(m), p, d, !0).valueOf()), "number | Complex | Fraction | BigNumber, Matrix": r.referToSelf((d) => (p, m) => o(p, 0) ? l(m.size(), m.storage()) : m.storage() === "dense" ? c(m, p, d, !0) : s(m, p, d, !0)) }); }), Yu = "floor", vF = ["typed", "config", "round", "matrix", "equalScalar", "zeros", "DenseMatrix"], hF = /* @__PURE__ */ P(Yu, ["typed", "config", "round"], (e) => { var { typed: r, config: t, round: n } = e; return r(Yu, { number: function(i) { return Gr(i, n(i), t.relTol, t.absTol) ? n(i) : Math.floor(i); }, "number, number": function(i, o) { if (Gr(i, n(i, o), t.relTol, t.absTol)) return n(i, o); var [l, u] = "".concat(i, "e").split("e"), s = Math.floor(Number("".concat(l, "e").concat(Number(u) + o))); return [l, u] = "".concat(s, "e").split("e"), Number("".concat(l, "e").concat(Number(u) - o)); } }); }), wy = /* @__PURE__ */ P(Yu, vF, (e) => { var { typed: r, config: t, round: n, matrix: a, equalScalar: i, zeros: o, DenseMatrix: l } = e, u = Kr({ typed: r, equalScalar: i }), s = Pr({ typed: r, DenseMatrix: l }), c = Wt({ typed: r }), f = hF({ typed: r, config: t, round: n }); return r("floor", { number: f.signatures.number, "number,number": f.signatures["number,number"], Complex: function(p) { return p.floor(); }, "Complex, number": function(p, m) { return p.floor(m); }, "Complex, BigNumber": function(p, m) { return p.floor(m.toNumber()); }, BigNumber: function(p) { return ht(p, n(p), t.relTol, t.absTol) ? n(p) : p.floor(); }, "BigNumber, BigNumber": function(p, m) { return ht(p, n(p, m), t.relTol, t.absTol) ? n(p, m) : p.toDecimalPlaces(m.toNumber(), jn.ROUND_FLOOR); }, Fraction: function(p) { return p.floor(); }, "Fraction, number": function(p, m) { return p.floor(m); }, "Fraction, BigNumber": function(p, m) { return p.floor(m.toNumber()); }, "Array | Matrix": r.referToSelf((d) => (p) => je(p, d)), "Array, number | BigNumber": r.referToSelf((d) => (p, m) => je(p, (v) => d(v, m))), "SparseMatrix, number | BigNumber": r.referToSelf((d) => (p, m) => u(p, m, d, !1)), "DenseMatrix, number | BigNumber": r.referToSelf((d) => (p, m) => c(p, m, d, !1)), "number | Complex | Fraction | BigNumber, Array": r.referToSelf((d) => (p, m) => c(a(m), p, d, !0).valueOf()), "number | Complex | Fraction | BigNumber, Matrix": r.referToSelf((d) => (p, m) => i(p, 0) ? o(m.size(), m.storage()) : m.storage() === "dense" ? c(m, p, d, !0) : s(m, p, d, !0)) }); }), gF = "matAlgo02xDS0", yF = ["typed", "equalScalar"], Kt = /* @__PURE__ */ P(gF, yF, (e) => { var { typed: r, equalScalar: t } = e; return function(a, i, o, l) { var u = a._data, s = a._size, c = a._datatype || a.getDataType(), f = i._values, d = i._index, p = i._ptr, m = i._size, v = i._datatype || i._data === void 0 ? i._datatype : i.getDataType(); if (s.length !== m.length) throw new Ye(s.length, m.length); if (s[0] !== m[0] || s[1] !== m[1]) throw new RangeError("Dimension mismatch. Matrix A (" + s + ") must match Matrix B (" + m + ")"); if (!f) throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix"); var b = s[0], y = s[1], A, h = t, x = 0, w = o; typeof c == "string" && c === v && c !== "mixed" && (A = c, h = r.find(t, [A, A]), x = r.convert(0, A), w = r.find(o, [A, A])); for (var g = [], D = [], E = [], N = 0; N < y; N++) { E[N] = D.length; for (var S = p[N], M = p[N + 1], F = S; F < M; F++) { var $ = d[F], I = l ? w(f[F], u[$][N]) : w(u[$][N], f[F]); h(I, x) || (D.push($), g.push(I)); } } return E[y] = D.length, i.createSparseMatrix({ values: g, index: D, ptr: E, size: [b, y], datatype: c === a._datatype && v === i._datatype ? A : void 0 }); }; }), bF = "matAlgo03xDSf", wF = ["typed"], ut = /* @__PURE__ */ P(bF, wF, (e) => { var { typed: r } = e; return function(n, a, i, o) { var l = n._data, u = n._size, s = n._datatype || n.getDataType(), c = a._values, f = a._index, d = a._ptr, p = a._size, m = a._datatype || a._data === void 0 ? a._datatype : a.getDataType(); if (u.length !== p.length) throw new Ye(u.length, p.length); if (u[0] !== p[0] || u[1] !== p[1]) throw new RangeError("Dimension mismatch. Matrix A (" + u + ") must match Matrix B (" + p + ")"); if (!c) throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix"); var v = u[0], b = u[1], y, A = 0, h = i; typeof s == "string" && s === m && s !== "mixed" && (y = s, A = r.convert(0, y), h = r.find(i, [y, y])); for (var x = [], w = 0; w < v; w++) x[w] = []; for (var g = [], D = [], E = 0; E < b; E++) { for (var N = E + 1, S = d[E], M = d[E + 1], F = S; F < M; F++) { var $ = f[F]; g[$] = o ? h(c[F], l[$][E]) : h(l[$][E], c[F]), D[$] = N; } for (var I = 0; I < v; I++) D[I] === N ? x[I][E] = g[I] : x[I][E] = o ? h(A, l[I][E]) : h(l[I][E], A); } return n.createDenseMatrix({ data: x, size: [v, b], datatype: s === n._datatype && m === a._datatype ? y : void 0 }); }; }), xF = "matAlgo05xSfSf", AF = ["typed", "equalScalar"], Is = /* @__PURE__ */ P(xF, AF, (e) => { var { typed: r, equalScalar: t } = e; return function(a, i, o) { var l = a._values, u = a._index, s = a._ptr, c = a._size, f = a._datatype || a._data === void 0 ? a._datatype : a.getDataType(), d = i._values, p = i._index, m = i._ptr, v = i._size, b = i._datatype || i._data === void 0 ? i._datatype : i.getDataType(); if (c.length !== v.length) throw new Ye(c.length, v.length); if (c[0] !== v[0] || c[1] !== v[1]) throw new RangeError("Dimension mismatch. Matrix A (" + c + ") must match Matrix B (" + v + ")"); var y = c[0], A = c[1], h, x = t, w = 0, g = o; typeof f == "string" && f === b && f !== "mixed" && (h = f, x = r.find(t, [h, h]), w = r.convert(0, h), g = r.find(o, [h, h])); var D = l && d ? [] : void 0, E = [], N = [], S = D ? [] : void 0, M = D ? [] : void 0, F = [], $ = [], I, B, C, _; for (B = 0; B < A; B++) { N[B] = E.length; var z = B + 1; for (C = s[B], _ = s[B + 1]; C < _; C++) I = u[C], E.push(I), F[I] = z, S && (S[I] = l[C]); for (C = m[B], _ = m[B + 1]; C < _; C++) I = p[C], F[I] !== z && E.push(I), $[I] = z, M && (M[I] = d[C]); if (D) for (C = N[B]; C < E.length; ) { I = E[C]; var O = F[I], W = $[I]; if (O === z || W === z) { var X = O === z ? S[I] : w, V = W === z ? M[I] : w, R = g(X, V); x(R, w) ? E.splice(C, 1) : (D.push(R), C++); } } } return N[A] = E.length, a.createSparseMatrix({ values: D, index: E, ptr: N, size: [y, A], datatype: f === a._datatype && b === i._datatype ? h : void 0 }); }; }), NF = "matAlgo13xDD", DF = ["typed"], EF = /* @__PURE__ */ P(NF, DF, (e) => { var { typed: r } = e; return function(a, i, o) { var l = a._data, u = a._size, s = a._datatype, c = i._data, f = i._size, d = i._datatype, p = []; if (u.length !== f.length) throw new Ye(u.length, f.length); for (var m = 0; m < u.length; m++) { if (u[m] !== f[m]) throw new RangeError("Dimension mismatch. Matrix A (" + u + ") must match Matrix B (" + f + ")"); p[m] = u[m]; } var v, b = o; typeof s == "string" && s === d && (v = s, b = r.find(o, [v, v])); var y = p.length > 0 ? t(b, 0, p, p[0], l, c) : []; return a.createDenseMatrix({ data: y, size: p, datatype: v }); }; function t(n, a, i, o, l, u) { var s = []; if (a === i.length - 1) for (var c = 0; c < o; c++) s[c] = n(l[c], u[c]); else for (var f = 0; f < o; f++) s[f] = t(n, a + 1, i, i[a + 1], l[f], u[f]); return s; } }); function zr(e, r) { if (Sn(e.size(), r.size())) return [e, r]; var t = kl(e.size(), r.size()); return [e, r].map((n) => SF(n, t)); } function SF(e, r) { return Sn(e.size(), r) ? e : e.create(ua(e.valueOf(), r), e.datatype()); } var CF = "matrixAlgorithmSuite", MF = ["typed", "matrix"], br = /* @__PURE__ */ P(CF, MF, (e) => { var { typed: r, matrix: t } = e, n = EF({ typed: r }), a = Wt({ typed: r }); return function(o) { var l = o.elop, u = o.SD || o.DS, s; l ? (s = { "DenseMatrix, DenseMatrix": (p, m) => n(...zr(p, m), l), "Array, Array": (p, m) => n(...zr(t(p), t(m)), l).valueOf(), "Array, DenseMatrix": (p, m) => n(...zr(t(p), m), l), "DenseMatrix, Array": (p, m) => n(...zr(p, t(m)), l) }, o.SS && (s["SparseMatrix, SparseMatrix"] = (p, m) => o.SS(...zr(p, m), l, !1)), o.DS && (s["DenseMatrix, SparseMatrix"] = (p, m) => o.DS(...zr(p, m), l, !1), s["Array, SparseMatrix"] = (p, m) => o.DS(...zr(t(p), m), l, !1)), u && (s["SparseMatrix, DenseMatrix"] = (p, m) => u(...zr(m, p), l, !0), s["SparseMatrix, Array"] = (p, m) => u(...zr(t(m), p), l, !0))) : (s = { "DenseMatrix, DenseMatrix": r.referToSelf((p) => (m, v) => n(...zr(m, v), p)), "Array, Array": r.referToSelf((p) => (m, v) => n(...zr(t(m), t(v)), p).valueOf()), "Array, DenseMatrix": r.referToSelf((p) => (m, v) => n(...zr(t(m), v), p)), "DenseMatrix, Array": r.referToSelf((p) => (m, v) => n(...zr(m, t(v)), p)) }, o.SS && (s["SparseMatrix, SparseMatrix"] = r.referToSelf((p) => (m, v) => o.SS(...zr(m, v), p, !1))), o.DS && (s["DenseMatrix, SparseMatrix"] = r.referToSelf((p) => (m, v) => o.DS(...zr(m, v), p, !1)), s["Array, SparseMatrix"] = r.referToSelf((p) => (m, v) => o.DS(...zr(t(m), v), p, !1))), u && (s["SparseMatrix, DenseMatrix"] = r.referToSelf((p) => (m, v) => u(...zr(v, m), p, !0)), s["SparseMatrix, Array"] = r.referToSelf((p) => (m, v) => u(...zr(t(v), m), p, !0)))); var c = o.scalar || "any", f = o.Ds || o.Ss; f && (l ? (s["DenseMatrix," + c] = (p, m) => a(p, m, l, !1), s[c + ", DenseMatrix"] = (p, m) => a(m, p, l, !0), s["Array," + c] = (p, m) => a(t(p), m, l, !1).valueOf(), s[c + ", Array"] = (p, m) => a(t(m), p, l, !0).valueOf()) : (s["DenseMatrix," + c] = r.referToSelf((p) => (m, v) => a(m, v, p, !1)), s[c + ", DenseMatrix"] = r.referToSelf((p) => (m, v) => a(v, m, p, !0)), s["Array," + c] = r.referToSelf((p) => (m, v) => a(t(m), v, p, !1).valueOf()), s[c + ", Array"] = r.referToSelf((p) => (m, v) => a(t(v), m, p, !0).valueOf()))); var d = o.sS !== void 0 ? o.sS : o.Ss; return l ? (o.Ss && (s["SparseMatrix," + c] = (p, m) => o.Ss(p, m, l, !1)), d && (s[c + ", SparseMatrix"] = (p, m) => d(m, p, l, !0))) : (o.Ss && (s["SparseMatrix," + c] = r.referToSelf((p) => (m, v) => o.Ss(m, v, p, !1))), d && (s[c + ", SparseMatrix"] = r.referToSelf((p) => (m, v) => d(v, m, p, !0)))), l && l.signatures && X0(s, l.signatures), s; }; }), Td = "mod", _F = ["typed", "config", "round", "matrix", "equalScalar", "zeros", "DenseMatrix", "concat"], xy = /* @__PURE__ */ P(Td, _F, (e) => { var { typed: r, config: t, round: n, matrix: a, equalScalar: i, zeros: o, DenseMatrix: l, concat: u } = e, s = wy({ typed: r, config: t, round: n, matrix: a, equalScalar: i, zeros: o, DenseMatrix: l }), c = Kt({ typed: r, equalScalar: i }), f = ut({ typed: r }), d = Is({ typed: r, equalScalar: i }), p = Kr({ typed: r, equalScalar: i }), m = Pr({ typed: r, DenseMatrix: l }), v = br({ typed: r, matrix: a, concat: u }); return r(Td, { "number, number": b, "BigNumber, BigNumber": function(A, h) { return h.isZero() ? A : A.sub(h.mul(s(A.div(h)))); }, "bigint, bigint": function(A, h) { if (h === 0n) return A; if (A < 0) { var x = A % h; return x === 0n ? x : x + h; } return A % h; }, "Fraction, Fraction": function(A, h) { return h.equals(0) ? A : A.sub(h.mul(s(A.div(h)))); } }, v({ SS: d, DS: f, SD: c, Ss: p, sS: m })); function b(y, A) { return A === 0 ? y : y - A * s(y / A); } }), FF = "matAlgo01xDSid", TF = ["typed"], ra = /* @__PURE__ */ P(FF, TF, (e) => { var { typed: r } = e; return function(n, a, i, o) { var l = n._data, u = n._size, s = n._datatype || n.getDataType(), c = a._values, f = a._index, d = a._ptr, p = a._size, m = a._datatype || a._data === void 0 ? a._datatype : a.getDataType(); if (u.length !== p.length) throw new Ye(u.length, p.length); if (u[0] !== p[0] || u[1] !== p[1]) throw new RangeError("Dimension mismatch. Matrix A (" + u + ") must match Matrix B (" + p + ")"); if (!c) throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix"); var v = u[0], b = u[1], y = typeof s == "string" && s !== "mixed" && s === m ? s : void 0, A = y ? r.find(i, [y, y]) : i, h, x, w = []; for (h = 0; h < v; h++) w[h] = []; var g = [], D = []; for (x = 0; x < b; x++) { for (var E = x + 1, N = d[x], S = d[x + 1], M = N; M < S; M++) h = f[M], g[h] = o ? A(c[M], l[h][x]) : A(l[h][x], c[M]), D[h] = E; for (h = 0; h < v; h++) D[h] === E ? w[h][x] = g[h] : w[h][x] = l[h][x]; } return n.createDenseMatrix({ data: w, size: [v, b], datatype: s === n._datatype && m === a._datatype ? y : void 0 }); }; }), OF = "matAlgo04xSidSid", BF = ["typed", "equalScalar"], Kl = /* @__PURE__ */ P(OF, BF, (e) => { var { typed: r, equalScalar: t } = e; return function(a, i, o) { var l = a._values, u = a._index, s = a._ptr, c = a._size, f = a._datatype || a._data === void 0 ? a._datatype : a.getDataType(), d = i._values, p = i._index, m = i._ptr, v = i._size, b = i._datatype || i._data === void 0 ? i._datatype : i.getDataType(); if (c.length !== v.length) throw new Ye(c.length, v.length); if (c[0] !== v[0] || c[1] !== v[1]) throw new RangeError("Dimension mismatch. Matrix A (" + c + ") must match Matrix B (" + v + ")"); var y = c[0], A = c[1], h, x = t, w = 0, g = o; typeof f == "string" && f === b && f !== "mixed" && (h = f, x = r.find(t, [h, h]), w = r.convert(0, h), g = r.find(o, [h, h])); var D = l && d ? [] : void 0, E = [], N = [], S = l && d ? [] : void 0, M = l && d ? [] : void 0, F = [], $ = [], I, B, C, _, z; for (B = 0; B < A; B++) { N[B] = E.length; var O = B + 1; for (_ = s[B], z = s[B + 1], C = _; C < z; C++) I = u[C], E.push(I), F[I] = O, S && (S[I] = l[C]); for (_ = m[B], z = m[B + 1], C = _; C < z; C++) if (I = p[C], F[I] === O) { if (S) { var W = g(S[I], d[C]); x(W, w) ? F[I] = null : S[I] = W; } } else E.push(I), $[I] = O, M && (M[I] = d[C]); if (S && M) for (C = N[B]; C < E.length; ) I = E[C], F[I] === O ? (D[C] = S[I], C++) : $[I] === O ? (D[C] = M[I], C++) : E.splice(C, 1); } return N[A] = E.length, a.createSparseMatrix({ values: D, index: E, ptr: N, size: [y, A], datatype: f === a._datatype && b === i._datatype ? h : void 0 }); }; }), $F = "matAlgo10xSids", IF = ["typed", "DenseMatrix"], Da = /* @__PURE__ */ P($F, IF, (e) => { var { typed: r, DenseMatrix: t } = e; return function(a, i, o, l) { var u = a._values, s = a._index, c = a._ptr, f = a._size, d = a._datatype; if (!u) throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value"); var p = f[0], m = f[1], v, b = o; typeof d == "string" && (v = d, i = r.convert(i, v), b = r.find(o, [v, v])); for (var y = [], A = [], h = [], x = 0; x < m; x++) { for (var w = x + 1, g = c[x], D = c[x + 1], E = g; E < D; E++) { var N = s[E]; A[N] = u[E], h[N] = w; } for (var S = 0; S < p; S++) x === 0 && (y[S] = []), h[S] === w ? y[S][x] = l ? b(i, A[S]) : b(A[S], i) : y[S][x] = i; } return new t({ data: y, size: [p, m], datatype: v }); }; }); function Fn(e, r, t, n) { if (!(this instanceof Fn)) throw new SyntaxError("Constructor must be called with the new operator"); this.fn = e, this.count = r, this.min = t, this.max = n, this.message = "Wrong number of arguments in function " + e + " (" + r + " provided, " + t + (n != null ? "-" + n : "") + " expected)", this.stack = new Error().stack; } Fn.prototype = new Error(); Fn.prototype.constructor = Error; Fn.prototype.name = "ArgumentsError"; Fn.prototype.isArgumentsError = !0; var Od = "gcd", RF = ["typed", "config", "round", "matrix", "equalScalar", "zeros", "BigNumber", "DenseMatrix", "concat"], du = "number | BigNumber | Fraction | Matrix | Array", PF = "".concat(du, ", ").concat(du, ", ...").concat(du); function Bd(e) { return !e.some((r) => Array.isArray(r)); } var zF = /* @__PURE__ */ P(Od, RF, (e) => { var { typed: r, matrix: t, config: n, round: a, equalScalar: i, zeros: o, BigNumber: l, DenseMatrix: u, concat: s } = e, c = xy({ typed: r, config: n, round: a, matrix: t, equalScalar: i, zeros: o, DenseMatrix: u, concat: s }), f = ra({ typed: r }), d = Kl({ typed: r, equalScalar: i }), p = Da({ typed: r, DenseMatrix: u }), m = br({ typed: r, matrix: t, concat: s }); return r(Od, { "number, number": v, "BigNumber, BigNumber": b, "Fraction, Fraction": (y, A) => y.gcd(A) }, m({ SS: d, DS: f, Ss: p }), { [PF]: r.referToSelf((y) => (A, h, x) => { for (var w = y(A, h), g = 0; g < x.length; g++) w = y(w, x[g]); return w; }), Array: r.referToSelf((y) => (A) => { if (A.length === 1 && Array.isArray(A[0]) && Bd(A[0])) return y(...A[0]); if (Bd(A)) return y(...A); throw new Fn("gcd() supports only 1d matrices!"); }), Matrix: r.referToSelf((y) => (A) => y(A.toArray())) }); function v(y, A) { if (!Oe(y) || !Oe(A)) throw new Error("Parameters in function gcd must be integer numbers"); for (var h; A !== 0; ) h = c(y, A), y = A, A = h; return y < 0 ? -y : y; } function b(y, A) { if (!y.isInt() || !A.isInt()) throw new Error("Parameters in function gcd must be integer numbers"); for (var h = new l(0); !A.isZero(); ) { var x = c(y, A); y = A, A = x; } return y.lt(h) ? y.neg() : y; } }), qF = "matAlgo06xS0S0", LF = ["typed", "equalScalar"], Rs = /* @__PURE__ */ P(qF, LF, (e) => { var { typed: r, equalScalar: t } = e; return function(a, i, o) { var l = a._values, u = a._size, s = a._datatype || a._data === void 0 ? a._datatype : a.getDataType(), c = i._values, f = i._size, d = i._datatype || i._data === void 0 ? i._datatype : i.getDataType(); if (u.length !== f.length) throw new Ye(u.length, f.length); if (u[0] !== f[0] || u[1] !== f[1]) throw new RangeError("Dimension mismatch. Matrix A (" + u + ") must match Matrix B (" + f + ")"); var p = u[0], m = u[1], v, b = t, y = 0, A = o; typeof s == "string" && s === d && s !== "mixed" && (v = s, b = r.find(t, [v, v]), y = r.convert(0, v), A = r.find(o, [v, v])); for (var h = l && c ? [] : void 0, x = [], w = [], g = h ? [] : void 0, D = [], E = [], N = 0; N < m; N++) { w[N] = x.length; var S = N + 1; if (nd(a, N, D, g, E, S, x, A), nd(i, N, D, g, E, S, x, A), g) for (var M = w[N]; M < x.length; ) { var F = x[M]; if (E[F] === S) { var $ = g[F]; b($, y) ? x.splice(M, 1) : (h.push($), M++); } else x.splice(M, 1); } else for (var I = w[N]; I < x.length; ) { var B = x[I]; E[B] !== S ? x.splice(I, 1) : I++; } } return w[m] = x.length, a.createSparseMatrix({ values: h, index: x, ptr: w, size: [p, m], datatype: s === a._datatype && d === i._datatype ? v : void 0 }); }; }), $d = "lcm", UF = ["typed", "matrix", "equalScalar", "concat"], kF = /* @__PURE__ */ P($d, UF, (e) => { var { typed: r, matrix: t, equalScalar: n, concat: a } = e, i = Kt({ typed: r, equalScalar: n }), o = Rs({ typed: r, equalScalar: n }), l = Kr({ typed: r, equalScalar: n }), u = br({ typed: r, matrix: t, concat: a }), s = "number | BigNumber | Fraction | Matrix | Array", c = {}; return c["".concat(s, ", ").concat(s, ", ...").concat(s)] = r.referToSelf((d) => (p, m, v) => { for (var b = d(p, m), y = 0; y < v.length; y++) b = d(b, v[y]); return b; }), r($d, { "number, number": zg, "BigNumber, BigNumber": f, "Fraction, Fraction": (d, p) => d.lcm(p) }, u({ SS: o, DS: i, Ss: l }), c); function f(d, p) { if (!d.isInt() || !p.isInt()) throw new Error("Parameters in function lcm must be integer numbers"); if (d.isZero()) return d; if (p.isZero()) return p; for (var m = d.times(p); !p.isZero(); ) { var v = p; p = d.mod(v), d = v; } return m.div(d).abs(); } }), Id = "log10", VF = ["typed", "config", "Complex"], HF = /* @__PURE__ */ P(Id, VF, (e) => { var { typed: r, config: t, Complex: n } = e; return r(Id, { number: function(i) { return i >= 0 || t.predictable ? qg(i) : new n(i, 0).log().div(Math.LN10); }, Complex: function(i) { return new n(i).log().div(Math.LN10); }, BigNumber: function(i) { return !i.isNegative() || t.predictable ? i.log() : new n(i.toNumber(), 0).log().div(Math.LN10); }, "Array | Matrix": r.referToSelf((a) => (i) => je(i, a)) }); }), Rd = "log2", ZF = ["typed", "config", "Complex"], GF = /* @__PURE__ */ P(Rd, ZF, (e) => { var { typed: r, config: t, Complex: n } = e; return r(Rd, { number: function(o) { return o >= 0 || t.predictable ? Lg(o) : a(new n(o, 0)); }, Complex: a, BigNumber: function(o) { return !o.isNegative() || t.predictable ? o.log(2) : a(new n(o.toNumber(), 0)); }, "Array | Matrix": r.referToSelf((i) => (o) => je(o, i)) }); function a(i) { var o = Math.sqrt(i.re * i.re + i.im * i.im); return new n(Math.log2 ? Math.log2(o) : Math.log(o) / Math.LN2, Math.atan2(i.im, i.re) / Math.LN2); } }), WF = "multiplyScalar", KF = ["typed"], JF = /* @__PURE__ */ P(WF, KF, (e) => { var { typed: r } = e; return r("multiplyScalar", { "number, number": Og, "Complex, Complex": function(n, a) { return n.mul(a); }, "BigNumber, BigNumber": function(n, a) { return n.times(a); }, "bigint, bigint": function(n, a) { return n * a; }, "Fraction, Fraction": function(n, a) { return n.mul(a); }, "number | Fraction | BigNumber | Complex, Unit": (t, n) => n.multiply(t), "Unit, number | Fraction | BigNumber | Complex | Unit": (t, n) => t.multiply(n) }); }), Pd = "multiply", YF = ["typed", "matrix", "addScalar", "multiplyScalar", "equalScalar", "dot"], jF = /* @__PURE__ */ P(Pd, YF, (e) => { var { typed: r, matrix: t, addScalar: n, multiplyScalar: a, equalScalar: i, dot: o } = e, l = Kr({ typed: r, equalScalar: i }), u = Wt({ typed: r }); function s(w, g) { switch (w.length) { case 1: switch (g.length) { case 1: if (w[0] !== g[0]) throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length"); break; case 2: if (w[0] !== g[0]) throw new RangeError("Dimension mismatch in multiplication. Vector length (" + w[0] + ") must match Matrix rows (" + g[0] + ")"); break; default: throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has " + g.length + " dimensions)"); } break; case 2: switch (g.length) { case 1: if (w[1] !== g[0]) throw new RangeError("Dimension mismatch in multiplication. Matrix columns (" + w[1] + ") must match Vector length (" + g[0] + ")"); break; case 2: if (w[1] !== g[0]) throw new RangeError("Dimension mismatch in multiplication. Matrix A columns (" + w[1] + ") must match Matrix B rows (" + g[0] + ")"); break; default: throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has " + g.length + " dimensions)"); } break; default: throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has " + w.length + " dimensions)"); } } function c(w, g, D) { if (D === 0) throw new Error("Cannot multiply two empty vectors"); return o(w, g); } function f(w, g) { if (g.storage() !== "dense") throw new Error("Support for SparseMatrix not implemented"); return d(w, g); } function d(w, g) { var D = w._data, E = w._size, N = w._datatype || w.getDataType(), S = g._data, M = g._size, F = g._datatype || g.getDataType(), $ = E[0], I = M[1], B, C = n, _ = a; N && F && N === F && typeof N == "string" && N !== "mixed" && (B = N, C = r.find(n, [B, B]), _ = r.find(a, [B, B])); for (var z = [], O = 0; O < I; O++) { for (var W = _(D[0], S[0][O]), X = 1; X < $; X++) W = C(W, _(D[X], S[X][O])); z[O] = W; } return w.createDenseMatrix({ data: z, size: [I], datatype: N === w._datatype && F === g._datatype ? B : void 0 }); } var p = r("_multiplyMatrixVector", { "DenseMatrix, any": v, "SparseMatrix, any": A }), m = r("_multiplyMatrixMatrix", { "DenseMatrix, DenseMatrix": b, "DenseMatrix, SparseMatrix": y, "SparseMatrix, DenseMatrix": h, "SparseMatrix, SparseMatrix": x }); function v(w, g) { var D = w._data, E = w._size, N = w._datatype || w.getDataType(), S = g._data, M = g._datatype || g.getDataType(), F = E[0], $ = E[1], I, B = n, C = a; N && M && N === M && typeof N == "string" && N !== "mixed" && (I = N, B = r.find(n, [I, I]), C = r.find(a, [I, I])); for (var _ = [], z = 0; z < F; z++) { for (var O = D[z], W = C(O[0], S[0]), X = 1; X < $; X++) W = B(W, C(O[X], S[X])); _[z] = W; } return w.createDenseMatrix({ data: _, size: [F], datatype: N === w._datatype && M === g._datatype ? I : void 0 }); } function b(w, g) { var D = w._data, E = w._size, N = w._datatype || w.getDataType(), S = g._data, M = g._size, F = g._datatype || g.getDataType(), $ = E[0], I = E[1], B = M[1], C, _ = n, z = a; N && F && N === F && typeof N == "string" && N !== "mixed" && N !== "mixed" && (C = N, _ = r.find(n, [C, C]), z = r.find(a, [C, C])); for (var O = [], W = 0; W < $; W++) { var X = D[W]; O[W] = []; for (var V = 0; V < B; V++) { for (var R = z(X[0], S[0][V]), Q = 1; Q < I; Q++) R = _(R, z(X[Q], S[Q][V])); O[W][V] = R; } } return w.createDenseMatrix({ data: O, size: [$, B], datatype: N === w._datatype && F === g._datatype ? C : void 0 }); } function y(w, g) { var D = w._data, E = w._size, N = w._datatype || w.getDataType(), S = g._values, M = g._index, F = g._ptr, $ = g._size, I = g._datatype || g._data === void 0 ? g._datatype : g.getDataType(); if (!S) throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix"); var B = E[0], C = $[1], _, z = n, O = a, W = i, X = 0; N && I && N === I && typeof N == "string" && N !== "mixed" && (_ = N, z = r.find(n, [_, _]), O = r.find(a, [_, _]), W = r.find(i, [_, _]), X = r.convert(0, _)); for (var V = [], R = [], Q = [], se = g.createSparseMatrix({ values: V, index: R, ptr: Q, size: [B, C], datatype: N === w._datatype && I === g._datatype ? _ : void 0 }), re = 0; re < C; re++) { Q[re] = R.length; var q = F[re], Z = F[re + 1]; if (Z > q) for (var K = 0, j = 0; j < B; j++) { for (var ee = j + 1, te = void 0, oe = q; oe < Z; oe++) { var ge = M[oe]; K !== ee ? (te = O(D[j][ge], S[oe]), K = ee) : te = z(te, O(D[j][ge], S[oe])); } K === ee && !W(te, X) && (R.push(j), V.push(te)); } } return Q[C] = R.length, se; } function A(w, g) { var D = w._values, E = w._index, N = w._ptr, S = w._datatype || w._data === void 0 ? w._datatype : w.getDataType(); if (!D) throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix"); var M = g._data, F = g._datatype || g.getDataType(), $ = w._size[0], I = g._size[0], B = [], C = [], _ = [], z, O = n, W = a, X = i, V = 0; S && F && S === F && typeof S == "string" && S !== "mixed" && (z = S, O = r.find(n, [z, z]), W = r.find(a, [z, z]), X = r.find(i, [z, z]), V = r.convert(0, z)); var R = [], Q = []; _[0] = 0; for (var se = 0; se < I; se++) { var re = M[se]; if (!X(re, V)) for (var q = N[se], Z = N[se + 1], K = q; K < Z; K++) { var j = E[K]; Q[j] ? R[j] = O(R[j], W(re, D[K])) : (Q[j] = !0, C.push(j), R[j] = W(re, D[K])); } } for (var ee = C.length, te = 0; te < ee; te++) { var oe = C[te]; B[te] = R[oe]; } return _[1] = C.length, w.createSparseMatrix({ values: B, index: C, ptr: _, size: [$, 1], datatype: S === w._datatype && F === g._datatype ? z : void 0 }); } function h(w, g) { var D = w._values, E = w._index, N = w._ptr, S = w._datatype || w._data === void 0 ? w._datatype : w.getDataType(); if (!D) throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix"); var M = g._data, F = g._datatype || g.getDataType(), $ = w._size[0], I = g._size[0], B = g._size[1], C, _ = n, z = a, O = i, W = 0; S && F && S === F && typeof S == "string" && S !== "mixed" && (C = S, _ = r.find(n, [C, C]), z = r.find(a, [C, C]), O = r.find(i, [C, C]), W = r.convert(0, C)); for (var X = [], V = [], R = [], Q = w.createSparseMatrix({ values: X, index: V, ptr: R, size: [$, B], datatype: S === w._datatype && F === g._datatype ? C : void 0 }), se = [], re = [], q = 0; q < B; q++) { R[q] = V.length; for (var Z = q + 1, K = 0; K < I; K++) { var j = M[K][q]; if (!O(j, W)) for (var ee = N[K], te = N[K + 1], oe = ee; oe < te; oe++) { var ge = E[oe]; re[ge] !== Z ? (re[ge] = Z, V.push(ge), se[ge] = z(j, D[oe])) : se[ge] = _(se[ge], z(j, D[oe])); } } for (var L = R[q], H = V.length, ne = L; ne < H; ne++) { var ie = V[ne]; X[ne] = se[ie]; } } return R[B] = V.length, Q; } function x(w, g) { var D = w._values, E = w._index, N = w._ptr, S = w._datatype || w._data === void 0 ? w._datatype : w.getDataType(), M = g._values, F = g._index, $ = g._ptr, I = g._datatype || g._data === void 0 ? g._datatype : g.getDataType(), B = w._size[0], C = g._size[1], _ = D && M, z, O = n, W = a; S && I && S === I && typeof S == "string" && S !== "mixed" && (z = S, O = r.find(n, [z, z]), W = r.find(a, [z, z])); for (var X = _ ? [] : void 0, V = [], R = [], Q = w.createSparseMatrix({ values: X, index: V, ptr: R, size: [B, C], datatype: S === w._datatype && I === g._datatype ? z : void 0 }), se = _ ? [] : void 0, re = [], q, Z, K, j, ee, te, oe, ge, L = 0; L < C; L++) { R[L] = V.length; var H = L + 1; for (ee = $[L], te = $[L + 1], j = ee; j < te; j++) if (ge = F[j], _) for (Z = N[ge], K = N[ge + 1], q = Z; q < K; q++) oe = E[q], re[oe] !== H ? (re[oe] = H, V.push(oe), se[oe] = W(M[j], D[q])) : se[oe] = O(se[oe], W(M[j], D[q])); else for (Z = N[ge], K = N[ge + 1], q = Z; q < K; q++) oe = E[q], re[oe] !== H && (re[oe] = H, V.push(oe)); if (_) for (var ne = R[L], ie = V.length, me = ne; me < ie; me++) { var pe = V[me]; X[me] = se[pe]; } } return R[C] = V.length, Q; } return r(Pd, a, { // we extend the signatures of multiplyScalar with signatures dealing with matrices "Array, Array": r.referTo("Matrix, Matrix", (w) => (g, D) => { s(ke(g), ke(D)); var E = w(t(g), t(D)); return ze(E) ? E.valueOf() : E; }), "Matrix, Matrix": function(g, D) { var E = g.size(), N = D.size(); return s(E, N), E.length === 1 ? N.length === 1 ? c(g, D, E[0]) : f(g, D) : N.length === 1 ? p(g, D) : m(g, D); }, "Matrix, Array": r.referTo("Matrix,Matrix", (w) => (g, D) => w(g, t(D))), "Array, Matrix": r.referToSelf((w) => (g, D) => w(t(g, D.storage()), D)), "SparseMatrix, any": function(g, D) { return l(g, D, a, !1); }, "DenseMatrix, any": function(g, D) { return u(g, D, a, !1); }, "any, SparseMatrix": function(g, D) { return l(D, g, a, !0); }, "any, DenseMatrix": function(g, D) { return u(D, g, a, !0); }, "Array, any": function(g, D) { return u(t(g), D, a, !1).valueOf(); }, "any, Array": function(g, D) { return u(t(D), g, a, !0).valueOf(); }, "any, any": a, "any, any, ...any": r.referToSelf((w) => (g, D, E) => { for (var N = w(g, D), S = 0; S < E.length; S++) N = w(N, E[S]); return N; }) }); }), zd = "nthRoot", XF = ["typed", "matrix", "equalScalar", "BigNumber", "concat"], QF = /* @__PURE__ */ P(zd, XF, (e) => { var { typed: r, matrix: t, equalScalar: n, BigNumber: a, concat: i } = e, o = ra({ typed: r }), l = Kt({ typed: r, equalScalar: n }), u = Rs({ typed: r, equalScalar: n }), s = Kr({ typed: r, equalScalar: n }), c = br({ typed: r, matrix: t, concat: i }); function f() { throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead."); } return r(zd, { number: id, "number, number": id, BigNumber: (p) => d(p, new a(2)), "BigNumber, BigNumber": d, Complex: f, "Complex, number": f, Array: r.referTo("DenseMatrix,number", (p) => (m) => p(t(m), 2).valueOf()), DenseMatrix: r.referTo("DenseMatrix,number", (p) => (m) => p(m, 2)), SparseMatrix: r.referTo("SparseMatrix,number", (p) => (m) => p(m, 2)), "SparseMatrix, SparseMatrix": r.referToSelf((p) => (m, v) => { if (v.density() === 1) return u(m, v, p); throw new Error("Root must be non-zero"); }), "DenseMatrix, SparseMatrix": r.referToSelf((p) => (m, v) => { if (v.density() === 1) return o(m, v, p, !1); throw new Error("Root must be non-zero"); }), "Array, SparseMatrix": r.referTo("DenseMatrix,SparseMatrix", (p) => (m, v) => p(t(m), v)), "number | BigNumber, SparseMatrix": r.referToSelf((p) => (m, v) => { if (v.density() === 1) return s(v, m, p, !0); throw new Error("Root must be non-zero"); }) }, c({ scalar: "number | BigNumber", SD: l, Ss: s, sS: !1 })); function d(p, m) { var v = a.precision, b = a.clone({ precision: v + 2 }), y = new a(0), A = new b(1), h = m.isNegative(); if (h && (m = m.neg()), m.isZero()) throw new Error("Root must be non-zero"); if (p.isNegative() && !m.abs().mod(2).equals(1)) throw new Error("Root must be odd when a is negative."); if (p.isZero()) return h ? new b(1 / 0) : 0; if (!p.isFinite()) return h ? y : p; var x = p.abs().pow(A.div(m)); return x = p.isNeg() ? x.neg() : x, new a((h ? A.div(x) : x).toPrecision(v)); } }), qd = "sign", eT = ["typed", "BigNumber", "Fraction", "complex"], rT = /* @__PURE__ */ P(qd, eT, (e) => { var { typed: r, BigNumber: t, complex: n, Fraction: a } = e; return r(qd, { number: Hu, Complex: function(o) { return o.im === 0 ? n(Hu(o.re)) : o.sign(); }, BigNumber: function(o) { return new t(o.cmp(0)); }, bigint: function(o) { return o > 0n ? 1n : o < 0n ? -1n : 0n; }, Fraction: function(o) { return new a(o.s, 1); }, // deep map collection, skip zeros since sign(0) = 0 "Array | Matrix": r.referToSelf((i) => (o) => je(o, i)), Unit: r.referToSelf((i) => (o) => { if (!o._isDerived() && o.units[0].unit.offset !== 0) throw new TypeError("sign is ambiguous for units with offset"); return r.find(i, o.valueType())(o.value); }) }); }), tT = "sqrt", nT = ["config", "typed", "Complex"], aT = /* @__PURE__ */ P(tT, nT, (e) => { var { config: r, typed: t, Complex: n } = e; return t("sqrt", { number: a, Complex: function(o) { return o.sqrt(); }, BigNumber: function(o) { return !o.isNegative() || r.predictable ? o.sqrt() : a(o.toNumber()); }, Unit: function(o) { return o.pow(0.5); } }); function a(i) { return isNaN(i) ? NaN : i >= 0 || r.predictable ? Math.sqrt(i) : new n(i, 0).sqrt(); } }), Ld = "square", iT = ["typed"], oT = /* @__PURE__ */ P(Ld, iT, (e) => { var { typed: r } = e; return r(Ld, { number: Ug, Complex: function(n) { return n.mul(n); }, BigNumber: function(n) { return n.times(n); }, bigint: function(n) { return n * n; }, Fraction: function(n) { return n.mul(n); }, Unit: function(n) { return n.pow(2); } }); }), Ud = "subtract", sT = ["typed", "matrix", "equalScalar", "subtractScalar", "unaryMinus", "DenseMatrix", "concat"], uT = /* @__PURE__ */ P(Ud, sT, (e) => { var { typed: r, matrix: t, equalScalar: n, subtractScalar: a, unaryMinus: i, DenseMatrix: o, concat: l } = e, u = ra({ typed: r }), s = ut({ typed: r }), c = Is({ typed: r, equalScalar: n }), f = Da({ typed: r, DenseMatrix: o }), d = Pr({ typed: r, DenseMatrix: o }), p = br({ typed: r, matrix: t, concat: l }); return r(Ud, { "any, any": a }, p({ elop: a, SS: c, DS: u, SD: s, Ss: d, sS: f })); }), kd = "xgcd", lT = ["typed", "config", "matrix", "BigNumber"], cT = /* @__PURE__ */ P(kd, lT, (e) => { var { typed: r, config: t, matrix: n, BigNumber: a } = e; return r(kd, { "number, number": function(l, u) { var s = kg(l, u); return t.matrix === "Array" ? s : n(s); }, "BigNumber, BigNumber": i // TODO: implement support for Fraction }); function i(o, l) { var u, s, c, f = new a(0), d = new a(1), p = f, m = d, v = d, b = f; if (!o.isInt() || !l.isInt()) throw new Error("Parameters in function xgcd must be integer numbers"); for (; !l.isZero(); ) s = o.div(l).floor(), c = o.mod(l), u = p, p = m.minus(s.times(p)), m = u, u = v, v = b.minus(s.times(v)), b = u, o = l, l = c; var y; return o.lt(f) ? y = [o.neg(), m.neg(), b.neg()] : y = [o, o.isZero() ? 0 : m, b], t.matrix === "Array" ? y : n(y); } }), Vd = "invmod", fT = ["typed", "config", "BigNumber", "xgcd", "equal", "smaller", "mod", "add", "isInteger"], dT = /* @__PURE__ */ P(Vd, fT, (e) => { var { typed: r, config: t, BigNumber: n, xgcd: a, equal: i, smaller: o, mod: l, add: u, isInteger: s } = e; return r(Vd, { "number, number": c, "BigNumber, BigNumber": c }); function c(f, d) { if (!s(f) || !s(d)) throw new Error("Parameters in function invmod must be integer numbers"); if (f = l(f, d), i(d, 0)) throw new Error("Divisor must be non zero"); var p = a(f, d); p = p.valueOf(); var [m, v] = p; return i(m, n(1)) ? (v = l(v, d), o(v, n(0)) && (v = u(v, d)), v) : NaN; } }), pT = "matAlgo09xS0Sf", mT = ["typed", "equalScalar"], Ay = /* @__PURE__ */ P(pT, mT, (e) => { var { typed: r, equalScalar: t } = e; return function(a, i, o) { var l = a._values, u = a._index, s = a._ptr, c = a._size, f = a._datatype || a._data === void 0 ? a._datatype : a.getDataType(), d = i._values, p = i._index, m = i._ptr, v = i._size, b = i._datatype || i._data === void 0 ? i._datatype : i.getDataType(); if (c.length !== v.length) throw new Ye(c.length, v.length); if (c[0] !== v[0] || c[1] !== v[1]) throw new RangeError("Dimension mismatch. Matrix A (" + c + ") must match Matrix B (" + v + ")"); var y = c[0], A = c[1], h, x = t, w = 0, g = o; typeof f == "string" && f === b && f !== "mixed" && (h = f, x = r.find(t, [h, h]), w = r.convert(0, h), g = r.find(o, [h, h])); var D = l && d ? [] : void 0, E = [], N = [], S = D ? [] : void 0, M = [], F, $, I, B, C; for ($ = 0; $ < A; $++) { N[$] = E.length; var _ = $ + 1; if (S) for (B = m[$], C = m[$ + 1], I = B; I < C; I++) F = p[I], M[F] = _, S[F] = d[I]; for (B = s[$], C = s[$ + 1], I = B; I < C; I++) if (F = u[I], S) { var z = M[F] === _ ? S[F] : w, O = g(l[I], z); x(O, w) || (E.push(F), D.push(O)); } else E.push(F); } return N[A] = E.length, a.createSparseMatrix({ values: D, index: E, ptr: N, size: [y, A], datatype: f === a._datatype && b === i._datatype ? h : void 0 }); }; }), Hd = "dotMultiply", vT = ["typed", "matrix", "equalScalar", "multiplyScalar", "concat"], hT = /* @__PURE__ */ P(Hd, vT, (e) => { var { typed: r, matrix: t, equalScalar: n, multiplyScalar: a, concat: i } = e, o = Kt({ typed: r, equalScalar: n }), l = Ay({ typed: r, equalScalar: n }), u = Kr({ typed: r, equalScalar: n }), s = br({ typed: r, matrix: t, concat: i }); return r(Hd, s({ elop: a, SS: l, DS: o, Ss: u })); }); function gT(e, r) { if (e.isFinite() && !e.isInteger() || r.isFinite() && !r.isInteger()) throw new Error("Integers expected in function bitAnd"); var t = e.constructor; if (e.isNaN() || r.isNaN()) return new t(NaN); if (e.isZero() || r.eq(-1) || e.eq(r)) return e; if (r.isZero() || e.eq(-1)) return r; if (!e.isFinite() || !r.isFinite()) { if (!e.isFinite() && !r.isFinite()) return e.isNegative() === r.isNegative() ? e : new t(0); if (!e.isFinite()) return r.isNegative() ? e : e.isNegative() ? new t(0) : r; if (!r.isFinite()) return e.isNegative() ? r : r.isNegative() ? new t(0) : e; } return Jl(e, r, function(n, a) { return n & a; }); } function qi(e) { if (e.isFinite() && !e.isInteger()) throw new Error("Integer expected in function bitNot"); var r = e.constructor, t = r.precision; r.config({ precision: 1e9 }); var n = e.plus(new r(1)); return n.s = -n.s || null, r.config({ precision: t }), n; } function yT(e, r) { if (e.isFinite() && !e.isInteger() || r.isFinite() && !r.isInteger()) throw new Error("Integers expected in function bitOr"); var t = e.constructor; if (e.isNaN() || r.isNaN()) return new t(NaN); var n = new t(-1); return e.isZero() || r.eq(n) || e.eq(r) ? r : r.isZero() || e.eq(n) ? e : !e.isFinite() || !r.isFinite() ? !e.isFinite() && !e.isNegative() && r.isNegative() || e.isNegative() && !r.isNegative() && !r.isFinite() ? n : e.isNegative() && r.isNegative() ? e.isFinite() ? e : r : e.isFinite() ? r : e : Jl(e, r, function(a, i) { return a | i; }); } function Jl(e, r, t) { var n = e.constructor, a, i, o = +(e.s < 0), l = +(r.s < 0); if (o) { a = mo(qi(e)); for (var u = 0; u < a.length; ++u) a[u] ^= 1; } else a = mo(e); if (l) { i = mo(qi(r)); for (var s = 0; s < i.length; ++s) i[s] ^= 1; } else i = mo(r); var c, f, d; a.length <= i.length ? (c = a, f = i, d = o) : (c = i, f = a, d = l); var p = c.length, m = f.length, v = t(o, l) ^ 1, b = new n(v ^ 1), y = new n(1), A = new n(2), h = n.precision; for (n.config({ precision: 1e9 }); p > 0; ) t(c[--p], f[--m]) === v && (b = b.plus(y)), y = y.times(A); for (; m > 0; ) t(d, f[--m]) === v && (b = b.plus(y)), y = y.times(A); return n.config({ precision: h }), v === 0 && (b.s = -b.s), b; } function mo(e) { for (var r = e.d, t = r[0] + "", n = 1; n < r.length; ++n) { for (var a = r[n] + "", i = 7 - a.length; i--; ) a = "0" + a; t += a; } for (var o = t.length; t.charAt(o) === "0"; ) o--; var l = e.e, u = t.slice(0, o + 1 || 1), s = u.length; if (l > 0) if (++l > s) for (l -= s; l--; ) u += "0"; else l < s && (u = u.slice(0, l) + "." + u.slice(l)); for (var c = [0], f = 0; f < u.length; ) { for (var d = c.length; d--; ) c[d] *= 10; c[0] += parseInt(u.charAt(f++)); for (var p = 0; p < c.length; ++p) c[p] > 1 && ((c[p + 1] === null || c[p + 1] === void 0) && (c[p + 1] = 0), c[p + 1] += c[p] >> 1, c[p] &= 1); } return c.reverse(); } function bT(e, r) { if (e.isFinite() && !e.isInteger() || r.isFinite() && !r.isInteger()) throw new Error("Integers expected in function bitXor"); var t = e.constructor; if (e.isNaN() || r.isNaN()) return new t(NaN); if (e.isZero()) return r; if (r.isZero()) return e; if (e.eq(r)) return new t(0); var n = new t(-1); return e.eq(n) ? qi(r) : r.eq(n) ? qi(e) : !e.isFinite() || !r.isFinite() ? !e.isFinite() && !r.isFinite() ? n : new t(e.isNegative() === r.isNegative() ? 1 / 0 : -1 / 0) : Jl(e, r, function(a, i) { return a ^ i; }); } function wT(e, r) { if (e.isFinite() && !e.isInteger() || r.isFinite() && !r.isInteger()) throw new Error("Integers expected in function leftShift"); var t = e.constructor; return e.isNaN() || r.isNaN() || r.isNegative() && !r.isZero() ? new t(NaN) : e.isZero() || r.isZero() ? e : !e.isFinite() && !r.isFinite() ? new t(NaN) : r.lt(55) ? e.times(Math.pow(2, r.toNumber()) + "") : e.times(new t(2).pow(r)); } function xT(e, r) { if (e.isFinite() && !e.isInteger() || r.isFinite() && !r.isInteger()) throw new Error("Integers expected in function rightArithShift"); var t = e.constructor; return e.isNaN() || r.isNaN() || r.isNegative() && !r.isZero() ? new t(NaN) : e.isZero() || r.isZero() ? e : r.isFinite() ? r.lt(55) ? e.div(Math.pow(2, r.toNumber()) + "").floor() : e.div(new t(2).pow(r)).floor() : e.isNegative() ? new t(-1) : e.isFinite() ? new t(0) : new t(NaN); } var Zd = "bitAnd", AT = ["typed", "matrix", "equalScalar", "concat"], Ny = /* @__PURE__ */ P(Zd, AT, (e) => { var { typed: r, matrix: t, equalScalar: n, concat: a } = e, i = Kt({ typed: r, equalScalar: n }), o = Rs({ typed: r, equalScalar: n }), l = Kr({ typed: r, equalScalar: n }), u = br({ typed: r, matrix: t, concat: a }); return r(Zd, { "number, number": Hg, "BigNumber, BigNumber": gT, "bigint, bigint": (s, c) => s & c }, u({ SS: o, DS: i, Ss: l })); }), Gd = "bitNot", NT = ["typed"], DT = /* @__PURE__ */ P(Gd, NT, (e) => { var { typed: r } = e; return r(Gd, { number: Zg, BigNumber: qi, bigint: (t) => ~t, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), Wd = "bitOr", ET = ["typed", "matrix", "equalScalar", "DenseMatrix", "concat"], Dy = /* @__PURE__ */ P(Wd, ET, (e) => { var { typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i } = e, o = ra({ typed: r }), l = Kl({ typed: r, equalScalar: n }), u = Da({ typed: r, DenseMatrix: a }), s = br({ typed: r, matrix: t, concat: i }); return r(Wd, { "number, number": Gg, "BigNumber, BigNumber": yT, "bigint, bigint": (c, f) => c | f }, s({ SS: l, DS: o, Ss: u })); }), ST = "matAlgo07xSSf", CT = ["typed", "DenseMatrix"], on = /* @__PURE__ */ P(ST, CT, (e) => { var { typed: r, DenseMatrix: t } = e; return function(i, o, l) { var u = i._size, s = i._datatype || i._data === void 0 ? i._datatype : i.getDataType(), c = o._size, f = o._datatype || o._data === void 0 ? o._datatype : o.getDataType(); if (u.length !== c.length) throw new Ye(u.length, c.length); if (u[0] !== c[0] || u[1] !== c[1]) throw new RangeError("Dimension mismatch. Matrix A (" + u + ") must match Matrix B (" + c + ")"); var d = u[0], p = u[1], m, v = 0, b = l; typeof s == "string" && s === f && s !== "mixed" && (m = s, v = r.convert(0, m), b = r.find(l, [m, m])); var y, A, h = []; for (y = 0; y < d; y++) h[y] = []; var x = [], w = [], g = [], D = []; for (A = 0; A < p; A++) { var E = A + 1; for (n(i, A, g, x, E), n(o, A, D, w, E), y = 0; y < d; y++) { var N = g[y] === E ? x[y] : v, S = D[y] === E ? w[y] : v; h[y][A] = b(N, S); } } return new t({ data: h, size: [d, p], datatype: s === i._datatype && f === o._datatype ? m : void 0 }); }; function n(a, i, o, l, u) { for (var s = a._values, c = a._index, f = a._ptr, d = f[i], p = f[i + 1]; d < p; d++) { var m = c[d]; o[m] = u, l[m] = s[d]; } } }), Kd = "bitXor", MT = ["typed", "matrix", "DenseMatrix", "concat"], _T = /* @__PURE__ */ P(Kd, MT, (e) => { var { typed: r, matrix: t, DenseMatrix: n, concat: a } = e, i = ut({ typed: r }), o = on({ typed: r, DenseMatrix: n }), l = Pr({ typed: r, DenseMatrix: n }), u = br({ typed: r, matrix: t, concat: a }); return r(Kd, { "number, number": Wg, "BigNumber, BigNumber": bT, "bigint, bigint": (s, c) => s ^ c }, u({ SS: o, DS: i, Ss: l })); }), Jd = "arg", FT = ["typed"], TT = /* @__PURE__ */ P(Jd, FT, (e) => { var { typed: r } = e; return r(Jd, { number: function(n) { return Math.atan2(0, n); }, BigNumber: function(n) { return n.constructor.atan2(0, n); }, Complex: function(n) { return n.arg(); }, // TODO: implement BigNumber support for function arg "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), Yd = "conj", OT = ["typed"], BT = /* @__PURE__ */ P(Yd, OT, (e) => { var { typed: r } = e; return r(Yd, { "number | BigNumber | Fraction": (t) => t, Complex: (t) => t.conjugate(), "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), jd = "im", $T = ["typed"], IT = /* @__PURE__ */ P(jd, $T, (e) => { var { typed: r } = e; return r(jd, { number: () => 0, "BigNumber | Fraction": (t) => t.mul(0), Complex: (t) => t.im, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), Xd = "re", RT = ["typed"], PT = /* @__PURE__ */ P(Xd, RT, (e) => { var { typed: r } = e; return r(Xd, { "number | BigNumber | Fraction": (t) => t, Complex: (t) => t.re, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), Qd = "not", zT = ["typed"], qT = /* @__PURE__ */ P(Qd, zT, (e) => { var { typed: r } = e; return r(Qd, { "null | undefined": () => !0, number: Xg, Complex: function(n) { return n.re === 0 && n.im === 0; }, BigNumber: function(n) { return n.isZero() || n.isNaN(); }, bigint: (t) => !t, Unit: r.referToSelf((t) => (n) => r.find(t, n.valueType())(n.value)), "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), ep = "or", LT = ["typed", "matrix", "equalScalar", "DenseMatrix", "concat"], Ey = /* @__PURE__ */ P(ep, LT, (e) => { var { typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i } = e, o = ut({ typed: r }), l = Is({ typed: r, equalScalar: n }), u = Pr({ typed: r, DenseMatrix: a }), s = br({ typed: r, matrix: t, concat: i }); return r(ep, { "number, number": Zu, "Complex, Complex": function(f, d) { return f.re !== 0 || f.im !== 0 || d.re !== 0 || d.im !== 0; }, "BigNumber, BigNumber": function(f, d) { return !f.isZero() && !f.isNaN() || !d.isZero() && !d.isNaN(); }, "bigint, bigint": Zu, "Unit, Unit": r.referToSelf((c) => (f, d) => c(f.value || 0, d.value || 0)) }, s({ SS: l, DS: o, Ss: u })); }), rp = "xor", UT = ["typed", "matrix", "DenseMatrix", "concat"], kT = /* @__PURE__ */ P(rp, UT, (e) => { var { typed: r, matrix: t, DenseMatrix: n, concat: a } = e, i = ut({ typed: r }), o = on({ typed: r, DenseMatrix: n }), l = Pr({ typed: r, DenseMatrix: n }), u = br({ typed: r, matrix: t, concat: a }); return r(rp, { "number, number": Gu, "Complex, Complex": function(c, f) { return (c.re !== 0 || c.im !== 0) != (f.re !== 0 || f.im !== 0); }, "bigint, bigint": Gu, "BigNumber, BigNumber": function(c, f) { return (!c.isZero() && !c.isNaN()) != (!f.isZero() && !f.isNaN()); }, "Unit, Unit": r.referToSelf((s) => (c, f) => s(c.value || 0, f.value || 0)) }, u({ SS: o, DS: i, Ss: l })); }), tp = "concat", VT = ["typed", "matrix", "isInteger"], Sy = /* @__PURE__ */ P(tp, VT, (e) => { var { typed: r, matrix: t, isInteger: n } = e; return r(tp, { // TODO: change signature to '...Array | Matrix, dim?' when supported "...Array | Matrix | number | BigNumber": function(i) { var o, l = i.length, u = -1, s, c = !1, f = []; for (o = 0; o < l; o++) { var d = i[o]; if (ze(d) && (c = !0), We(d) || Ze(d)) { if (o !== l - 1) throw new Error("Dimension must be specified as last argument"); if (s = u, u = d.valueOf(), !n(u)) throw new TypeError("Integer number expected for dimension"); if (u < 0 || o > 0 && u > s) throw new $t(u, s + 1); } else { var p = qe(d).valueOf(), m = ke(p); if (f[o] = p, s = u, u = m.length - 1, o > 0 && u !== s) throw new Ye(s + 1, u + 1); } } if (f.length === 0) throw new SyntaxError("At least one matrix expected"); for (var v = f.shift(); f.length; ) v = Sg(v, f.shift(), u); return c ? t(v) : v; }, "...string": function(i) { return i.join(""); } }); }), np = "column", HT = ["typed", "Index", "matrix", "range"], Cy = /* @__PURE__ */ P(np, HT, (e) => { var { typed: r, Index: t, matrix: n, range: a } = e; return r(np, { "Matrix, number": i, "Array, number": function(l, u) { return i(n(qe(l)), u).valueOf(); } }); function i(o, l) { if (o.size().length !== 2) throw new Error("Only two dimensional matrix is supported"); gr(l, o.size()[1]); var u = a(0, o.size()[0]), s = new t(u, l), c = o.subset(s); return ze(c) ? c : n([[c]]); } }), ap = "count", ZT = ["typed", "size", "prod"], GT = /* @__PURE__ */ P(ap, ZT, (e) => { var { typed: r, size: t, prod: n } = e; return r(ap, { string: function(i) { return i.length; }, "Matrix | Array": function(i) { return n(t(i)); } }); }), ip = "cross", WT = ["typed", "matrix", "subtract", "multiply"], KT = /* @__PURE__ */ P(ip, WT, (e) => { var { typed: r, matrix: t, subtract: n, multiply: a } = e; return r(ip, { "Matrix, Matrix": function(l, u) { return t(i(l.toArray(), u.toArray())); }, "Matrix, Array": function(l, u) { return t(i(l.toArray(), u)); }, "Array, Matrix": function(l, u) { return t(i(l, u.toArray())); }, "Array, Array": i }); function i(o, l) { var u = Math.max(ke(o).length, ke(l).length); o = Yo(o), l = Yo(l); var s = ke(o), c = ke(l); if (s.length !== 1 || c.length !== 1 || s[0] !== 3 || c[0] !== 3) throw new RangeError("Vectors with length 3 expected (Size A = [" + s.join(", ") + "], B = [" + c.join(", ") + "])"); var f = [n(a(o[1], l[2]), a(o[2], l[1])), n(a(o[2], l[0]), a(o[0], l[2])), n(a(o[0], l[1]), a(o[1], l[0]))]; return u > 1 ? [f] : f; } }), op = "diag", JT = ["typed", "matrix", "DenseMatrix", "SparseMatrix"], YT = /* @__PURE__ */ P(op, JT, (e) => { var { typed: r, matrix: t, DenseMatrix: n, SparseMatrix: a } = e; return r(op, { // FIXME: simplify this huge amount of signatures as soon as typed-function supports optional arguments Array: function(s) { return i(s, 0, ke(s), null); }, "Array, number": function(s, c) { return i(s, c, ke(s), null); }, "Array, BigNumber": function(s, c) { return i(s, c.toNumber(), ke(s), null); }, "Array, string": function(s, c) { return i(s, 0, ke(s), c); }, "Array, number, string": function(s, c, f) { return i(s, c, ke(s), f); }, "Array, BigNumber, string": function(s, c, f) { return i(s, c.toNumber(), ke(s), f); }, Matrix: function(s) { return i(s, 0, s.size(), s.storage()); }, "Matrix, number": function(s, c) { return i(s, c, s.size(), s.storage()); }, "Matrix, BigNumber": function(s, c) { return i(s, c.toNumber(), s.size(), s.storage()); }, "Matrix, string": function(s, c) { return i(s, 0, s.size(), c); }, "Matrix, number, string": function(s, c, f) { return i(s, c, s.size(), f); }, "Matrix, BigNumber, string": function(s, c, f) { return i(s, c.toNumber(), s.size(), f); } }); function i(u, s, c, f) { if (!Oe(s)) throw new TypeError("Second parameter in function diag must be an integer"); var d = s > 0 ? s : 0, p = s < 0 ? -s : 0; switch (c.length) { case 1: return o(u, s, f, c[0], p, d); case 2: return l(u, s, f, c, p, d); } throw new RangeError("Matrix for function diag must be 2 dimensional"); } function o(u, s, c, f, d, p) { var m = [f + d, f + p]; if (c && c !== "sparse" && c !== "dense") throw new TypeError("Unknown matrix type ".concat(c, '"')); var v = c === "sparse" ? a.diagonal(m, u, s) : n.diagonal(m, u, s); return c !== null ? v : v.valueOf(); } function l(u, s, c, f, d, p) { if (ze(u)) { var m = u.diagonal(s); return c !== null ? c !== m.storage() ? t(m, c) : m : m.valueOf(); } for (var v = Math.min(f[0] - d, f[1] - p), b = [], y = 0; y < v; y++) b[y] = u[y + d][y + p]; return c !== null ? t(b) : b; } }), jT = "filter", XT = ["typed"], My = /* @__PURE__ */ P(jT, XT, (e) => { var { typed: r } = e; return r("filter", { "Array, function": sp, "Matrix, function": function(n, a) { return n.create(sp(n.valueOf(), a), n.datatype()); }, "Array, RegExp": Qf, "Matrix, RegExp": function(n, a) { return n.create(Qf(n.valueOf(), a), n.datatype()); } }); }); function sp(e, r) { var t = ha(r, e, "filter"); return b_(e, function(n, a, i) { return t(n, [a], i); }); } var up = "flatten", QT = ["typed"], e4 = /* @__PURE__ */ P(up, QT, (e) => { var { typed: r } = e; return r(up, { Array: function(n) { return sr(n); }, Matrix: function(n) { return n.create(sr(n.toArray()), n.datatype()); } }); }), ju = "forEach", r4 = ["typed"], _y = /* @__PURE__ */ P(ju, r4, (e) => { var { typed: r } = e; return r(ju, { "Array, function": t4, "Matrix, function": function(n, a) { n.forEach(a); } }); }); function t4(e, r) { Hl(e, [], e, ha(r, e, ju)); } var lp = "getMatrixDataType", n4 = ["typed"], a4 = /* @__PURE__ */ P(lp, n4, (e) => { var { typed: r } = e; return r(lp, { Array: function(n) { return Bs(n, yr); }, Matrix: function(n) { return n.getDataType(); } }); }), cp = "identity", i4 = ["typed", "config", "matrix", "BigNumber", "DenseMatrix", "SparseMatrix"], o4 = /* @__PURE__ */ P(cp, i4, (e) => { var { typed: r, config: t, matrix: n, BigNumber: a, DenseMatrix: i, SparseMatrix: o } = e; return r(cp, { "": function() { return t.matrix === "Matrix" ? n([]) : []; }, string: function(c) { return n(c); }, "number | BigNumber": function(c) { return u(c, c, t.matrix === "Matrix" ? "dense" : void 0); }, "number | BigNumber, string": function(c, f) { return u(c, c, f); }, "number | BigNumber, number | BigNumber": function(c, f) { return u(c, f, t.matrix === "Matrix" ? "dense" : void 0); }, "number | BigNumber, number | BigNumber, string": function(c, f, d) { return u(c, f, d); }, Array: function(c) { return l(c); }, "Array, string": function(c, f) { return l(c, f); }, Matrix: function(c) { return l(c.valueOf(), c.storage()); }, "Matrix, string": function(c, f) { return l(c.valueOf(), f); } }); function l(s, c) { switch (s.length) { case 0: return c ? n(c) : []; case 1: return u(s[0], s[0], c); case 2: return u(s[0], s[1], c); default: throw new Error("Vector containing two values expected"); } } function u(s, c, f) { var d = Ze(s) || Ze(c) ? a : null; if (Ze(s) && (s = s.toNumber()), Ze(c) && (c = c.toNumber()), !Oe(s) || s < 1) throw new Error("Parameters in function identity must be positive integers"); if (!Oe(c) || c < 1) throw new Error("Parameters in function identity must be positive integers"); var p = d ? new a(1) : 1, m = d ? new d(0) : 0, v = [s, c]; if (f) { if (f === "sparse") return o.diagonal(v, p, 0, m); if (f === "dense") return i.diagonal(v, p, 0, m); throw new TypeError('Unknown matrix type "'.concat(f, '"')); } for (var b = ri([], v, m), y = s < c ? s : c, A = 0; A < y; A++) b[A][A] = p; return b; } }), fp = "kron", s4 = ["typed", "matrix", "multiplyScalar"], u4 = /* @__PURE__ */ P(fp, s4, (e) => { var { typed: r, matrix: t, multiplyScalar: n } = e; return r(fp, { "Matrix, Matrix": function(o, l) { return t(a(o.toArray(), l.toArray())); }, "Matrix, Array": function(o, l) { return t(a(o.toArray(), l)); }, "Array, Matrix": function(o, l) { return t(a(o, l.toArray())); }, "Array, Array": a }); function a(i, o) { if (ke(i).length === 1 && (i = [i]), ke(o).length === 1 && (o = [o]), ke(i).length > 2 || ke(o).length > 2) throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = " + JSON.stringify(i.length) + ", y = " + JSON.stringify(o.length) + ")"); var l = [], u = []; return i.map(function(s) { return o.map(function(c) { return u = [], l.push(u), s.map(function(f) { return c.map(function(d) { return u.push(n(f, d)); }); }); }); }) && l; } }), pu = "map", l4 = ["typed"], Fy = /* @__PURE__ */ P(pu, l4, (e) => { var { typed: r } = e; return r(pu, { "Array, function": n, "Matrix, function": function(i, o) { return i.map(o); }, "Array|Matrix, Array|Matrix, ...Array|Matrix|function": (a, i, o) => t([a, i, ...o.slice(0, o.length - 1)], o[o.length - 1]) }); function t(a, i) { if (typeof i != "function") throw new Error("Last argument must be a callback function"); var o = a[0].isMatrix, l = kl(...a.map((x) => x.isMatrix ? x.size() : ke(x))), u = o ? (x, w) => x.get(w) : Vl, s = o ? a.map((x) => x.isMatrix ? x.create(ua(x.toArray(), l), x.datatype()) : a[0].create(ua(x.valueOf(), l))) : a.map((x) => x.isMatrix ? ua(x.toArray(), l) : ua(x, l)), c; if (r.isTypedFunction(i)) { var f = l.map(() => 0), d = s.map((x) => u(x, f)), p = h(i, d, f, s); c = y(p); } else { var m = a.length, v = A(i, m); c = y(v); } var b = (x, w) => c([x, ...s.slice(1).map((g) => u(g, w))], w); if (o) return s[0].map(b); return n(s[0], b); function y(x) { switch (x) { case 0: return (w) => i(...w); case 1: return (w, g) => i(...w, g); case 2: return (w, g) => i(...w, g, ...s); } } function A(x, w) { return x.length > w + 1 ? 2 : x.length === w + 1 ? 1 : 0; } function h(x, w, g, D) { return r.resolve(x, [...w, g, ...D]) !== null ? 2 : r.resolve(x, [...w, g]) !== null ? 1 : (r.resolve(x, w) !== null, 0); } } function n(a, i) { return Hl(a, [], a, ha(i, a, pu)); } }), dp = "diff", c4 = ["typed", "matrix", "subtract", "number"], Ty = /* @__PURE__ */ P(dp, c4, (e) => { var { typed: r, matrix: t, subtract: n, number: a } = e; return r(dp, { "Array | Matrix": function(c) { return ze(c) ? t(o(c.toArray())) : o(c); }, "Array | Matrix, number": function(c, f) { if (!Oe(f)) throw new RangeError("Dimension must be a whole number"); return ze(c) ? t(i(c.toArray(), f)) : i(c, f); }, "Array, BigNumber": r.referTo("Array,number", (s) => (c, f) => s(c, a(f))), "Matrix, BigNumber": r.referTo("Matrix,number", (s) => (c, f) => s(c, a(f))) }); function i(s, c) { if (ze(s) && (s = s.toArray()), !Array.isArray(s)) throw RangeError("Array/Matrix does not have that many dimensions"); if (c > 0) { var f = []; return s.forEach((d) => { f.push(i(d, c - 1)); }), f; } else { if (c === 0) return o(s); throw RangeError("Cannot have negative dimension"); } } function o(s) { for (var c = [], f = s.length, d = 1; d < f; d++) c.push(l(s[d - 1], s[d])); return c; } function l(s, c) { ze(s) && (s = s.toArray()), ze(c) && (c = c.toArray()); var f = Array.isArray(s), d = Array.isArray(c); if (f && d) return u(s, c); if (!f && !d) return n(c, s); throw TypeError("Cannot calculate difference between 1 array and 1 non-array"); } function u(s, c) { if (s.length !== c.length) throw RangeError("Not all sub-arrays have the same length"); for (var f = [], d = s.length, p = 0; p < d; p++) f.push(l(s[p], c[p])); return f; } }), f4 = "ones", d4 = ["typed", "config", "matrix", "BigNumber"], p4 = /* @__PURE__ */ P(f4, d4, (e) => { var { typed: r, config: t, matrix: n, BigNumber: a } = e; return r("ones", { "": function() { return t.matrix === "Array" ? i([]) : i([], "default"); }, // math.ones(m, n, p, ..., format) // TODO: more accurate signature '...number | BigNumber, string' as soon as typed-function supports this "...number | BigNumber | string": function(s) { var c = s[s.length - 1]; if (typeof c == "string") { var f = s.pop(); return i(s, f); } else return t.matrix === "Array" ? i(s) : i(s, "default"); }, Array: i, Matrix: function(s) { var c = s.storage(); return i(s.valueOf(), c); }, "Array | Matrix, string": function(s, c) { return i(s.valueOf(), c); } }); function i(u, s) { var c = o(u), f = c ? new a(1) : 1; if (l(u), s) { var d = n(s); return u.length > 0 ? d.resize(u, f) : d; } else { var p = []; return u.length > 0 ? ri(p, u, f) : p; } } function o(u) { var s = !1; return u.forEach(function(c, f, d) { Ze(c) && (s = !0, d[f] = c.toNumber()); }), s; } function l(u) { u.forEach(function(s) { if (typeof s != "number" || !Oe(s) || s < 0) throw new Error("Parameters in function ones must be positive integers"); }); } }); function Yl() { throw new Error('No "bignumber" implementation available'); } function Oy() { throw new Error('No "fraction" implementation available'); } function By() { throw new Error('No "matrix" implementation available'); } var pp = "range", m4 = ["typed", "config", "?matrix", "?bignumber", "smaller", "smallerEq", "larger", "largerEq", "add", "isPositive"], $y = /* @__PURE__ */ P(pp, m4, (e) => { var { typed: r, config: t, matrix: n, bignumber: a, smaller: i, smallerEq: o, larger: l, largerEq: u, add: s, isPositive: c } = e; return r(pp, { // TODO: simplify signatures when typed-function supports default values and optional arguments // TODO: a number or boolean should not be converted to string here string: d, "string, boolean": d, "number, number": function(b, y) { return f(p(b, y, 1, !1)); }, "number, number, number": function(b, y, A) { return f(p(b, y, A, !1)); }, "number, number, boolean": function(b, y, A) { return f(p(b, y, 1, A)); }, "number, number, number, boolean": function(b, y, A, h) { return f(p(b, y, A, h)); }, "BigNumber, BigNumber": function(b, y) { var A = b.constructor; return f(p(b, y, new A(1), !1)); }, "BigNumber, BigNumber, BigNumber": function(b, y, A) { return f(p(b, y, A, !1)); }, "BigNumber, BigNumber, boolean": function(b, y, A) { var h = b.constructor; return f(p(b, y, new h(1), A)); }, "BigNumber, BigNumber, BigNumber, boolean": function(b, y, A, h) { return f(p(b, y, A, h)); }, "Unit, Unit, Unit": function(b, y, A) { return f(p(b, y, A, !1)); }, "Unit, Unit, Unit, boolean": function(b, y, A, h) { return f(p(b, y, A, h)); } }); function f(v) { return t.matrix === "Matrix" ? n ? n(v) : By() : v; } function d(v, b) { var y = m(v); if (!y) throw new SyntaxError('String "' + v + '" is no valid range'); return t.number === "BigNumber" ? (a === void 0 && Yl(), f(p(a(y.start), a(y.end), a(y.step)))) : f(p(y.start, y.end, y.step, b)); } function p(v, b, y, A) { for (var h = [], x = c(y) ? A ? o : i : A ? u : l, w = v; x(w, b); ) h.push(w), w = s(w, y); return h; } function m(v) { var b = v.split(":"), y = b.map(function(h) { return Number(h); }), A = y.some(function(h) { return isNaN(h); }); if (A) return null; switch (y.length) { case 2: return { start: y[0], end: y[1], step: 1 }; case 3: return { start: y[0], end: y[2], step: y[1] }; default: return null; } } }), mp = "reshape", v4 = ["typed", "isInteger", "matrix"], h4 = /* @__PURE__ */ P(mp, v4, (e) => { var { typed: r, isInteger: t } = e; return r(mp, { "Matrix, Array": function(a, i) { return a.reshape(i, !0); }, "Array, Array": function(a, i) { return i.forEach(function(o) { if (!t(o)) throw new TypeError("Invalid size for dimension: " + o); }), Ll(a, i); } }); }), g4 = "resize", y4 = ["config", "matrix"], b4 = /* @__PURE__ */ P(g4, y4, (e) => { var { config: r, matrix: t } = e; return function(i, o, l) { if (arguments.length !== 2 && arguments.length !== 3) throw new Fn("resize", arguments.length, 2, 3); if (ze(o) && (o = o.valueOf()), Ze(o[0]) && (o = o.map(function(c) { return Ze(c) ? c.toNumber() : c; })), ze(i)) return i.resize(o, l, !0); if (typeof i == "string") return n(i, o, l); var u = Array.isArray(i) ? !1 : r.matrix !== "Array"; if (o.length === 0) { for (; Array.isArray(i); ) i = i[0]; return qe(i); } else { Array.isArray(i) || (i = [i]), i = qe(i); var s = ri(i, o, l); return u ? t(s) : s; } }; function n(a, i, o) { if (o !== void 0) { if (typeof o != "string" || o.length !== 1) throw new TypeError("Single character expected as defaultValue"); } else o = " "; if (i.length !== 1) throw new Ye(i.length, 1); var l = i[0]; if (typeof l != "number" || !Oe(l)) throw new TypeError("Invalid size, must contain positive integers (size: " + Qe(i) + ")"); if (a.length > l) return a.substring(0, l); if (a.length < l) { for (var u = a, s = 0, c = l - a.length; s < c; s++) u += o; return u; } else return a; } }), vp = "rotate", w4 = ["typed", "multiply", "rotationMatrix"], x4 = /* @__PURE__ */ P(vp, w4, (e) => { var { typed: r, multiply: t, rotationMatrix: n } = e; return r(vp, { "Array , number | BigNumber | Complex | Unit": function(o, l) { a(o, 2); var u = t(n(l), o); return u.toArray(); }, "Matrix , number | BigNumber | Complex | Unit": function(o, l) { return a(o, 2), t(n(l), o); }, "Array, number | BigNumber | Complex | Unit, Array | Matrix": function(o, l, u) { a(o, 3); var s = t(n(l, u), o); return s; }, "Matrix, number | BigNumber | Complex | Unit, Array | Matrix": function(o, l, u) { return a(o, 3), t(n(l, u), o); } }); function a(i, o) { var l = Array.isArray(i) ? ke(i) : i.size(); if (l.length > 2) throw new RangeError("Vector must be of dimensions 1x".concat(o)); if (l.length === 2 && l[1] !== 1) throw new RangeError("Vector must be of dimensions 1x".concat(o)); if (l[0] !== o) throw new RangeError("Vector must be of dimensions 1x".concat(o)); } }), hp = "rotationMatrix", A4 = ["typed", "config", "multiplyScalar", "addScalar", "unaryMinus", "norm", "matrix", "BigNumber", "DenseMatrix", "SparseMatrix", "cos", "sin"], N4 = /* @__PURE__ */ P(hp, A4, (e) => { var { typed: r, config: t, multiplyScalar: n, addScalar: a, unaryMinus: i, norm: o, BigNumber: l, matrix: u, DenseMatrix: s, SparseMatrix: c, cos: f, sin: d } = e; return r(hp, { "": function() { return t.matrix === "Matrix" ? u([]) : []; }, string: function(h) { return u(h); }, "number | BigNumber | Complex | Unit": function(h) { return p(h, t.matrix === "Matrix" ? "dense" : void 0); }, "number | BigNumber | Complex | Unit, string": function(h, x) { return p(h, x); }, "number | BigNumber | Complex | Unit, Array": function(h, x) { var w = u(x); return m(w), y(h, w, void 0); }, "number | BigNumber | Complex | Unit, Matrix": function(h, x) { m(x); var w = x.storage() || (t.matrix === "Matrix" ? "dense" : void 0); return y(h, x, w); }, "number | BigNumber | Complex | Unit, Array, string": function(h, x, w) { var g = u(x); return m(g), y(h, g, w); }, "number | BigNumber | Complex | Unit, Matrix, string": function(h, x, w) { return m(x), y(h, x, w); } }); function p(A, h) { var x = Ze(A), w = x ? new l(-1) : -1, g = f(A), D = d(A), E = [[g, n(w, D)], [D, g]]; return b(E, h); } function m(A) { var h = A.size(); if (h.length < 1 || h[0] !== 3) throw new RangeError("Vector must be of dimensions 1x3"); } function v(A) { return A.reduce((h, x) => n(h, x)); } function b(A, h) { if (h) { if (h === "sparse") return new c(A); if (h === "dense") return new s(A); throw new TypeError('Unknown matrix type "'.concat(h, '"')); } return A; } function y(A, h, x) { var w = o(h); if (w === 0) throw new RangeError("Rotation around zero vector"); var g = Ze(A) ? l : null, D = g ? new g(1) : 1, E = g ? new g(-1) : -1, N = g ? new g(h.get([0]) / w) : h.get([0]) / w, S = g ? new g(h.get([1]) / w) : h.get([1]) / w, M = g ? new g(h.get([2]) / w) : h.get([2]) / w, F = f(A), $ = a(D, i(F)), I = d(A), B = a(F, v([N, N, $])), C = a(v([N, S, $]), v([E, M, I])), _ = a(v([N, M, $]), v([S, I])), z = a(v([N, S, $]), v([M, I])), O = a(F, v([S, S, $])), W = a(v([S, M, $]), v([E, N, I])), X = a(v([N, M, $]), v([E, S, I])), V = a(v([S, M, $]), v([N, I])), R = a(F, v([M, M, $])), Q = [[B, C, _], [z, O, W], [X, V, R]]; return b(Q, x); } }), gp = "row", D4 = ["typed", "Index", "matrix", "range"], Iy = /* @__PURE__ */ P(gp, D4, (e) => { var { typed: r, Index: t, matrix: n, range: a } = e; return r(gp, { "Matrix, number": i, "Array, number": function(l, u) { return i(n(qe(l)), u).valueOf(); } }); function i(o, l) { if (o.size().length !== 2) throw new Error("Only two dimensional matrix is supported"); gr(l, o.size()[0]); var u = a(0, o.size()[1]), s = new t(l, u), c = o.subset(s); return ze(c) ? c : n([[c]]); } }), yp = "size", E4 = ["typed", "config", "?matrix"], S4 = /* @__PURE__ */ P(yp, E4, (e) => { var { typed: r, config: t, matrix: n } = e; return r(yp, { Matrix: function(i) { return i.create(i.size(), "number"); }, Array: ke, string: function(i) { return t.matrix === "Array" ? [i.length] : n([i.length], "dense", "number"); }, "number | Complex | BigNumber | Unit | boolean | null": function(i) { return t.matrix === "Array" ? [] : n ? n([], "dense", "number") : By(); } }); }), bp = "squeeze", C4 = ["typed"], M4 = /* @__PURE__ */ P(bp, C4, (e) => { var { typed: r } = e; return r(bp, { Array: function(n) { return Yo(qe(n)); }, Matrix: function(n) { var a = Yo(n.toArray()); return Array.isArray(a) ? n.create(a, n.datatype()) : a; }, any: function(n) { return qe(n); } }); }), wp = "subset", _4 = ["typed", "matrix", "zeros", "add"], Ry = /* @__PURE__ */ P(wp, _4, (e) => { var { typed: r, matrix: t, zeros: n, add: a } = e; return r(wp, { // get subset "Matrix, Index": function(l, u) { return ei(u) ? t() : (Jo(l, u), l.subset(u)); }, "Array, Index": r.referTo("Matrix, Index", function(o) { return function(l, u) { var s = o(t(l), u); return u.isScalar() ? s : s.valueOf(); }; }), "Object, Index": T4, "string, Index": F4, // set subset "Matrix, Index, any, any": function(l, u, s, c) { return ei(u) ? l : (Jo(l, u), l.clone().subset(u, i(s, u), c)); }, "Array, Index, any, any": r.referTo("Matrix, Index, any, any", function(o) { return function(l, u, s, c) { var f = o(t(l), u, s, c); return f.isMatrix ? f.valueOf() : f; }; }), "Array, Index, any": r.referTo("Matrix, Index, any, any", function(o) { return function(l, u, s) { return o(t(l), u, s, void 0).valueOf(); }; }), "Matrix, Index, any": r.referTo("Matrix, Index, any, any", function(o) { return function(l, u, s) { return o(l, u, s, void 0); }; }), "string, Index, string": xp, "string, Index, string, string": xp, "Object, Index, any": O4 }); function i(o, l) { if (typeof o == "string") throw new Error("can't boradcast a string"); if (l._isScalar) return o; var u = l.size(); if (u.every((s) => s > 0)) try { return a(o, n(u)); } catch { return o; } else return o; } }); function F4(e, r) { if (!Gi(r)) throw new TypeError("Index expected"); if (ei(r)) return ""; if (Jo(Array.from(e), r), r.size().length !== 1) throw new Ye(r.size().length, 1); var t = e.length; gr(r.min()[0], t), gr(r.max()[0], t); var n = r.dimension(0), a = ""; return n.forEach(function(i) { a += e.charAt(i); }), a; } function xp(e, r, t, n) { if (!r || r.isIndex !== !0) throw new TypeError("Index expected"); if (ei(r)) return e; if (Jo(Array.from(e), r), r.size().length !== 1) throw new Ye(r.size().length, 1); if (n !== void 0) { if (typeof n != "string" || n.length !== 1) throw new TypeError("Single character expected as defaultValue"); } else n = " "; var a = r.dimension(0), i = a.size()[0]; if (i !== t.length) throw new Ye(a.size()[0], t.length); var o = e.length; gr(r.min()[0]), gr(r.max()[0]); for (var l = [], u = 0; u < o; u++) l[u] = e.charAt(u); if (a.forEach(function(f, d) { l[f] = t.charAt(d[0]); }), l.length > o) for (var s = o - 1, c = l.length; s < c; s++) l[s] || (l[s] = n); return l.join(""); } function T4(e, r) { if (!ei(r)) { if (r.size().length !== 1) throw new Ye(r.size(), 1); var t = r.dimension(0); if (typeof t != "string") throw new TypeError("String expected as index to retrieve an object property"); return it(e, t); } } function O4(e, r, t) { if (ei(r)) return e; if (r.size().length !== 1) throw new Ye(r.size(), 1); var n = r.dimension(0); if (typeof n != "string") throw new TypeError("String expected as index to retrieve an object property"); var a = qe(e); return Xa(a, n, t), a; } var Ap = "transpose", B4 = ["typed", "matrix"], $4 = /* @__PURE__ */ P(Ap, B4, (e) => { var { typed: r, matrix: t } = e; return r(Ap, { Array: (o) => n(t(o)).valueOf(), Matrix: n, any: qe // scalars }); function n(o) { var l = o.size(), u; switch (l.length) { case 1: u = o.clone(); break; case 2: { var s = l[0], c = l[1]; if (c === 0) throw new RangeError("Cannot transpose a 2D matrix with no columns (size: " + Qe(l) + ")"); switch (o.storage()) { case "dense": u = a(o, s, c); break; case "sparse": u = i(o, s, c); break; } } break; default: throw new RangeError("Matrix must be a vector or two dimensional (size: " + Qe(l) + ")"); } return u; } function a(o, l, u) { for (var s = o._data, c = [], f, d = 0; d < u; d++) { f = c[d] = []; for (var p = 0; p < l; p++) f[p] = qe(s[p][d]); } return o.createDenseMatrix({ data: c, size: [u, l], datatype: o._datatype }); } function i(o, l, u) { for (var s = o._values, c = o._index, f = o._ptr, d = s ? [] : void 0, p = [], m = [], v = [], b = 0; b < l; b++) v[b] = 0; var y, A, h; for (y = 0, A = c.length; y < A; y++) v[c[y]]++; for (var x = 0, w = 0; w < l; w++) m.push(x), x += v[w], v[w] = m[w]; for (m.push(x), h = 0; h < u; h++) for (var g = f[h], D = f[h + 1], E = g; E < D; E++) { var N = v[c[E]]++; p[N] = h, s && (d[N] = qe(s[E])); } return o.createSparseMatrix({ values: d, index: p, ptr: m, size: [u, l], datatype: o._datatype }); } }), Np = "ctranspose", I4 = ["typed", "transpose", "conj"], R4 = /* @__PURE__ */ P(Np, I4, (e) => { var { typed: r, transpose: t, conj: n } = e; return r(Np, { any: function(i) { return n(t(i)); } }); }), Dp = "zeros", P4 = ["typed", "config", "matrix", "BigNumber"], z4 = /* @__PURE__ */ P(Dp, P4, (e) => { var { typed: r, config: t, matrix: n, BigNumber: a } = e; return r(Dp, { "": function() { return t.matrix === "Array" ? i([]) : i([], "default"); }, // math.zeros(m, n, p, ..., format) // TODO: more accurate signature '...number | BigNumber, string' as soon as typed-function supports this "...number | BigNumber | string": function(s) { var c = s[s.length - 1]; if (typeof c == "string") { var f = s.pop(); return i(s, f); } else return t.matrix === "Array" ? i(s) : i(s, "default"); }, Array: i, Matrix: function(s) { var c = s.storage(); return i(s.valueOf(), c); }, "Array | Matrix, string": function(s, c) { return i(s.valueOf(), c); } }); function i(u, s) { var c = o(u), f = c ? new a(0) : 0; if (l(u), s) { var d = n(s); return u.length > 0 ? d.resize(u, f) : d; } else { var p = []; return u.length > 0 ? ri(p, u, f) : p; } } function o(u) { var s = !1; return u.forEach(function(c, f, d) { Ze(c) && (s = !0, d[f] = c.toNumber()); }), s; } function l(u) { u.forEach(function(s) { if (typeof s != "number" || !Oe(s) || s < 0) throw new Error("Parameters in function zeros must be positive integers"); }); } }), Ep = "fft", q4 = ["typed", "matrix", "addScalar", "multiplyScalar", "divideScalar", "exp", "tau", "i", "dotDivide", "conj", "pow", "ceil", "log2"], L4 = /* @__PURE__ */ P(Ep, q4, (e) => { var { typed: r, matrix: t, addScalar: n, multiplyScalar: a, divideScalar: i, exp: o, tau: l, i: u, dotDivide: s, conj: c, pow: f, ceil: d, log2: p } = e; return r(Ep, { Array: m, Matrix: function(h) { return h.create(m(h.valueOf()), h.datatype()); } }); function m(A) { var h = ke(A); return h.length === 1 ? y(A, h[0]) : v(A.map((x) => m(x, h.slice(1))), 0); } function v(A, h) { var x = ke(A); if (h !== 0) return new Array(x[0]).fill(0).map((g, D) => v(A[D], h - 1)); if (x.length === 1) return y(A); function w(g) { var D = ke(g); return new Array(D[1]).fill(0).map((E, N) => new Array(D[0]).fill(0).map((S, M) => g[M][N])); } return w(v(w(A), 1)); } function b(A) { for (var h = A.length, x = o(i(a(-1, a(u, l)), h)), w = [], g = 1 - h; g < h; g++) w.push(f(x, i(f(g, 2), 2))); for (var D = f(2, d(p(h + h - 1))), E = [...new Array(h).fill(0).map((C, _) => a(A[_], w[h - 1 + _])), ...new Array(D - h).fill(0)], N = [...new Array(h + h - 1).fill(0).map((C, _) => i(1, w[_])), ...new Array(D - (h + h - 1)).fill(0)], S = y(E), M = y(N), F = new Array(D).fill(0).map((C, _) => a(S[_], M[_])), $ = s(c(m(c(F))), D), I = [], B = h - 1; B < h + h - 1; B++) I.push(a($[B], w[B])); return I; } function y(A) { var h = A.length; if (h === 1) return [A[0]]; if (h % 2 === 0) { for (var x = [...y(A.filter((E, N) => N % 2 === 0)), ...y(A.filter((E, N) => N % 2 === 1))], w = 0; w < h / 2; w++) { var g = x[w], D = a(x[w + h / 2], o(a(a(l, u), i(-w, h)))); x[w] = n(g, D), x[w + h / 2] = n(g, a(-1, D)); } return x; } else return b(A); } }), Sp = "ifft", U4 = ["typed", "fft", "dotDivide", "conj"], k4 = /* @__PURE__ */ P(Sp, U4, (e) => { var { typed: r, fft: t, dotDivide: n, conj: a } = e; return r(Sp, { "Array | Matrix": function(o) { var l = ze(o) ? o.size() : ke(o); return n(a(t(a(o))), l.reduce((u, s) => u * s, 1)); } }); }); function Li(e) { "@babel/helpers - typeof"; return Li = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) { return typeof r; } : function(r) { return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r; }, Li(e); } function V4(e, r) { if (Li(e) != "object" || !e) return e; var t = e[Symbol.toPrimitive]; if (t !== void 0) { var n = t.call(e, r); if (Li(n) != "object") return n; throw new TypeError("@@toPrimitive must return a primitive value."); } return (r === "string" ? String : Number)(e); } function H4(e) { var r = V4(e, "string"); return Li(r) == "symbol" ? r : r + ""; } function Rr(e, r, t) { return (r = H4(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function Cp(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); r && (n = n.filter(function(a) { return Object.getOwnPropertyDescriptor(e, a).enumerable; })), t.push.apply(t, n); } return t; } function Z4(e) { for (var r = 1; r < arguments.length; r++) { var t = arguments[r] != null ? arguments[r] : {}; r % 2 ? Cp(Object(t), !0).forEach(function(n) { Rr(e, n, t[n]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Cp(Object(t)).forEach(function(n) { Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n)); }); } return e; } var G4 = "solveODE", W4 = ["typed", "add", "subtract", "multiply", "divide", "max", "map", "abs", "isPositive", "isNegative", "larger", "smaller", "matrix", "bignumber", "unaryMinus"], K4 = /* @__PURE__ */ P(G4, W4, (e) => { var { typed: r, add: t, subtract: n, multiply: a, divide: i, max: o, map: l, abs: u, isPositive: s, isNegative: c, larger: f, smaller: d, matrix: p, bignumber: m, unaryMinus: v } = e; function b(E) { return function(N, S, M, F) { var $ = !(S.length === 2 && (S.every(g) || S.every(ft))); if ($) throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]'); var I = S[0], B = S[1], C = f(B, I), _ = F.firstStep; if (_ !== void 0 && !s(_)) throw new Error('"firstStep" must be positive'); var z = F.maxStep; if (z !== void 0 && !s(z)) throw new Error('"maxStep" must be positive'); var O = F.minStep; if (O && c(O)) throw new Error('"minStep" must be positive or zero'); var W = [I, B, _, O, z].filter((k) => k !== void 0); if (!(W.every(g) || W.every(ft))) throw new Error('Inconsistent type of "t" dependant variables'); for (var X = 1, V = F.tol ? F.tol : 1e-4, R = F.minDelta ? F.minDelta : 0.2, Q = F.maxDelta ? F.maxDelta : 5, se = F.maxIter ? F.maxIter : 1e4, re = [I, B, ...M, z, O].some(Ze), [q, Z, K, j] = re ? [m(E.a), m(E.c), m(E.b), m(E.bp)] : [E.a, E.c, E.b, E.bp], ee = _ ? C ? _ : v(_) : i(n(B, I), X), te = [I], oe = [M], ge = n(K, j), L = 0, H = 0, ne = x(C), ie = w(C); ne(te[L], B); ) { var me = []; ee = ie(te[L], B, ee), me.push(N(te[L], oe[L])); for (var pe = 1; pe < Z.length; ++pe) me.push(N(t(te[L], a(Z[pe], ee)), t(oe[L], a(ee, q[pe], me)))); var xe = o(u(l(a(ge, me), (k) => ft(k) ? k.value : k))); xe < V && V / xe > 1 / 4 && (te.push(t(te[L], ee)), oe.push(t(oe[L], a(ee, K, me))), L++); var De = 0.84 * (V / xe) ** (1 / 5); if (d(De, R) ? De = R : f(De, Q) && (De = Q), De = re ? m(De) : De, ee = a(ee, De), z && f(u(ee), z) ? ee = C ? z : v(z) : O && d(u(ee), O) && (ee = C ? O : v(O)), H++, H > se) throw new Error("Maximum number of iterations reached, try changing options"); } return { t: te, y: oe }; }; } function y(E, N, S, M) { var F = [[], [0.5], [0, 0.75], [0.2222222222222222, 0.3333333333333333, 0.4444444444444444]], $ = [null, 1 / 2, 3 / 4, 1], I = [2 / 9, 1 / 3, 4 / 9, 0], B = [7 / 24, 1 / 4, 1 / 3, 1 / 8], C = { a: F, c: $, b: I, bp: B }; return b(C)(E, N, S, M); } function A(E, N, S, M) { var F = [[], [0.2], [0.075, 0.225], [0.9777777777777777, -3.7333333333333334, 3.5555555555555554], [2.9525986892242035, -11.595793324188385, 9.822892851699436, -0.2908093278463649], [2.8462752525252526, -10.757575757575758, 8.906422717743473, 0.2784090909090909, -0.2735313036020583], [0.09114583333333333, 0, 0.44923629829290207, 0.6510416666666666, -0.322376179245283, 0.13095238095238096]], $ = [null, 1 / 5, 3 / 10, 4 / 5, 8 / 9, 1, 1], I = [35 / 384, 0, 500 / 1113, 125 / 192, -2187 / 6784, 11 / 84, 0], B = [5179 / 57600, 0, 7571 / 16695, 393 / 640, -92097 / 339200, 187 / 2100, 1 / 40], C = { a: F, c: $, b: I, bp: B }; return b(C)(E, N, S, M); } function h(E, N, S, M) { var F = M.method ? M.method : "RK45", $ = { RK23: y, RK45: A }; if (F.toUpperCase() in $) { var I = Z4({}, M); return delete I.method, $[F.toUpperCase()](E, N, S, I); } else { var B = Object.keys($).map((_) => '"'.concat(_, '"')), C = "".concat(B.slice(0, -1).join(", "), " and ").concat(B.slice(-1)); throw new Error('Unavailable method "'.concat(F, '". Available methods are ').concat(C)); } } function x(E) { return E ? d : f; } function w(E) { var N = E ? f : d; return function(S, M, F) { var $ = t(S, F); return N($, M) ? n(M, S) : F; }; } function g(E) { return Ze(E) || We(E); } function D(E, N, S, M) { var F = h(E, N.toArray(), S.toArray(), M); return { t: p(F.t), y: p(F.y) }; } return r("solveODE", { "function, Array, Array, Object": h, "function, Matrix, Matrix, Object": D, "function, Array, Array": (E, N, S) => h(E, N, S, {}), "function, Matrix, Matrix": (E, N, S) => D(E, N, S, {}), "function, Array, number | BigNumber | Unit": (E, N, S) => { var M = h(E, N, [S], {}); return { t: M.t, y: M.y.map((F) => F[0]) }; }, "function, Matrix, number | BigNumber | Unit": (E, N, S) => { var M = h(E, N.toArray(), [S], {}); return { t: p(M.t), y: p(M.y.map((F) => F[0])) }; }, "function, Array, number | BigNumber | Unit, Object": (E, N, S, M) => { var F = h(E, N, [S], M); return { t: F.t, y: F.y.map(($) => $[0]) }; }, "function, Matrix, number | BigNumber | Unit, Object": (E, N, S, M) => { var F = h(E, N.toArray(), [S], M); return { t: p(F.t), y: p(F.y.map(($) => $[0])) }; } }); }), J4 = "erf", Y4 = ["typed"], j4 = /* @__PURE__ */ P(J4, Y4, (e) => { var { typed: r } = e; return r("name", { number: function(o) { var l = Math.abs(o); return l >= eO ? Vn(o) : l <= X4 ? Vn(o) * t(l) : l <= 4 ? Vn(o) * (1 - n(l)) : Vn(o) * (1 - a(l)); }, "Array | Matrix": r.referToSelf((i) => (o) => je(o, i)) // TODO: For complex numbers, use the approximation for the Faddeeva function // from "More Efficient Computation of the Complex Error Function" (AMS) }); function t(i) { var o = i * i, l = fn[0][4] * o, u = o, s; for (s = 0; s < 3; s += 1) l = (l + fn[0][s]) * o, u = (u + Ta[0][s]) * o; return i * (l + fn[0][3]) / (u + Ta[0][3]); } function n(i) { var o = fn[1][8] * i, l = i, u; for (u = 0; u < 7; u += 1) o = (o + fn[1][u]) * i, l = (l + Ta[1][u]) * i; var s = (o + fn[1][7]) / (l + Ta[1][7]), c = parseInt(i * 16) / 16, f = (i - c) * (i + c); return Math.exp(-c * c) * Math.exp(-f) * s; } function a(i) { var o = 1 / (i * i), l = fn[2][5] * o, u = o, s; for (s = 0; s < 4; s += 1) l = (l + fn[2][s]) * o, u = (u + Ta[2][s]) * o; var c = o * (l + fn[2][4]) / (u + Ta[2][4]); c = (Q4 - c) / i, o = parseInt(i * 16) / 16; var f = (i - o) * (i + o); return Math.exp(-o * o) * Math.exp(-f) * c; } }), X4 = 0.46875, Q4 = 0.5641895835477563, fn = [[3.1611237438705655, 113.86415415105016, 377.485237685302, 3209.3775891384694, 0.18577770618460315], [0.5641884969886701, 8.883149794388377, 66.11919063714163, 298.6351381974001, 881.952221241769, 1712.0476126340707, 2051.0783778260716, 1230.3393547979972, 21531153547440383e-24], [0.30532663496123236, 0.36034489994980445, 0.12578172611122926, 0.016083785148742275, 6587491615298378e-19, 0.016315387137302097]], Ta = [[23.601290952344122, 244.02463793444417, 1282.6165260773723, 2844.236833439171], [15.744926110709835, 117.6939508913125, 537.1811018620099, 1621.3895745666903, 3290.7992357334597, 4362.619090143247, 3439.3676741437216, 1230.3393548037495], [2.568520192289822, 1.8729528499234604, 0.5279051029514285, 0.06051834131244132, 0.0023352049762686918]], eO = Math.pow(2, 53), Mp = "zeta", rO = ["typed", "config", "multiply", "pow", "divide", "factorial", "equal", "smallerEq", "isNegative", "gamma", "sin", "subtract", "add", "?Complex", "?BigNumber", "pi"], tO = /* @__PURE__ */ P(Mp, rO, (e) => { var { typed: r, config: t, multiply: n, pow: a, divide: i, factorial: o, equal: l, smallerEq: u, isNegative: s, gamma: c, sin: f, subtract: d, add: p, Complex: m, BigNumber: v, pi: b } = e; return r(Mp, { number: (g) => y(g, (D) => D, () => 20), BigNumber: (g) => y(g, (D) => new v(D), () => Math.abs(Math.log10(t.relTol))), Complex: A }); function y(g, D, E) { return l(g, 0) ? D(-0.5) : l(g, 1) ? D(NaN) : isFinite(g) ? h(g, D, E, (N) => N) : s(g) ? D(NaN) : D(1); } function A(g) { return g.re === 0 && g.im === 0 ? new m(-0.5) : g.re === 1 ? new m(NaN, NaN) : g.re === 1 / 0 && g.im === 0 ? new m(1) : g.im === 1 / 0 || g.re === -1 / 0 ? new m(NaN, NaN) : h(g, (D) => D, (D) => Math.round(1.3 * 15 + 0.9 * Math.abs(D.im)), (D) => D.re); } function h(g, D, E, N) { var S = E(g); if (N(g) > -(S - 1) / 2) return w(g, D(S), D); var M = n(a(2, g), a(D(b), d(g, 1))); return M = n(M, f(n(i(D(b), 2), g))), M = n(M, c(d(1, g))), n(M, h(d(1, g), D, E, N)); } function x(g, D) { for (var E = g, N = g; u(N, D); N = p(N, 1)) { var S = i(n(o(p(D, d(N, 1))), a(4, N)), n(o(d(D, N)), o(n(2, N)))); E = p(E, S); } return n(D, E); } function w(g, D, E) { for (var N = i(1, n(x(E(0), D), d(1, a(2, d(1, g))))), S = E(0), M = E(1); u(M, D); M = p(M, 1)) S = p(S, i(n((-1) ** (M - 1), x(M, D)), a(M, g))); return n(N, S); } }), _p = "mode", nO = ["typed", "isNaN", "isNumeric"], aO = /* @__PURE__ */ P(_p, nO, (e) => { var { typed: r, isNaN: t, isNumeric: n } = e; return r(_p, { "Array | Matrix": a, "...": function(o) { return a(o); } }); function a(i) { i = sr(i.valueOf()); var o = i.length; if (o === 0) throw new Error("Cannot calculate mode of an empty array"); for (var l = {}, u = [], s = 0, c = 0; c < i.length; c++) { var f = i[c]; if (n(f) && t(f)) throw new Error("Cannot calculate mode of an array containing NaN values"); f in l || (l[f] = 0), l[f]++, l[f] === s ? u.push(f) : l[f] > s && (s = l[f], u = [f]); } return u; } }); function st(e, r, t) { var n; return String(e).includes("Unexpected type") ? (n = arguments.length > 2 ? " (type: " + yr(t) + ", value: " + JSON.stringify(t) + ")" : " (type: " + e.data.actual + ")", new TypeError("Cannot calculate " + r + ", unexpected type of argument" + n)) : String(e).includes("complex numbers") ? (n = arguments.length > 2 ? " (type: " + yr(t) + ", value: " + JSON.stringify(t) + ")" : "", new TypeError("Cannot calculate " + r + ", no ordering relation is defined for complex numbers" + n)) : e; } var Fp = "prod", iO = ["typed", "config", "multiplyScalar", "numeric"], oO = /* @__PURE__ */ P(Fp, iO, (e) => { var { typed: r, config: t, multiplyScalar: n, numeric: a } = e; return r(Fp, { // prod([a, b, c, d, ...]) "Array | Matrix": i, // prod([a, b, c, d, ...], dim) "Array | Matrix, number | BigNumber": function(l, u) { throw new Error("prod(A, dim) is not yet supported"); }, // prod(a, b, c, d, ...) "...": function(l) { return i(l); } }); function i(o) { var l; if (Cn(o, function(u) { try { l = l === void 0 ? u : n(l, u); } catch (s) { throw st(s, "prod", u); } }), typeof l == "string" && (l = a(l, Qn(l, t))), l === void 0) throw new Error("Cannot calculate prod of an empty array"); return l; } }), Tp = "format", sO = ["typed"], uO = /* @__PURE__ */ P(Tp, sO, (e) => { var { typed: r } = e; return r(Tp, { any: Qe, "any, Object | function | number | BigNumber": Qe }); }), Op = "bin", lO = ["typed", "format"], cO = P(Op, lO, (e) => { var { typed: r, format: t } = e; return r(Op, { "number | BigNumber": function(a) { return t(a, { notation: "bin" }); }, "number | BigNumber, number | BigNumber": function(a, i) { return t(a, { notation: "bin", wordSize: i }); } }); }), Bp = "oct", fO = ["typed", "format"], dO = P(Bp, fO, (e) => { var { typed: r, format: t } = e; return r(Bp, { "number | BigNumber": function(a) { return t(a, { notation: "oct" }); }, "number | BigNumber, number | BigNumber": function(a, i) { return t(a, { notation: "oct", wordSize: i }); } }); }), $p = "hex", pO = ["typed", "format"], mO = P($p, pO, (e) => { var { typed: r, format: t } = e; return r($p, { "number | BigNumber": function(a) { return t(a, { notation: "hex" }); }, "number | BigNumber, number | BigNumber": function(a, i) { return t(a, { notation: "hex", wordSize: i }); } }); }), Py = /\$([\w.]+)/g, Ip = "print", vO = ["typed"], zy = /* @__PURE__ */ P(Ip, vO, (e) => { var { typed: r } = e; return r(Ip, { // note: Matrix will be converted automatically to an Array "string, Object | Array": Rp, "string, Object | Array, number | Object": Rp }); }); function Rp(e, r, t) { return e.replace(Py, function(n, a) { var i = a.split("."), o = r[i.shift()]; for (o !== void 0 && o.isMatrix && (o = o.toArray()); i.length && o !== void 0; ) { var l = i.shift(); o = l ? o[l] : o + "."; } return o !== void 0 ? Vr(o) ? o : Qe(o, t) : n; }); } var Pp = "to", hO = ["typed", "matrix", "concat"], gO = /* @__PURE__ */ P(Pp, hO, (e) => { var { typed: r, matrix: t, concat: n } = e, a = br({ typed: r, matrix: t, concat: n }); return r(Pp, { "Unit, Unit | string": (i, o) => i.to(o) }, a({ Ds: !0 })); }), zp = "isPrime", yO = ["typed"], bO = /* @__PURE__ */ P(zp, yO, (e) => { var { typed: r } = e; return r(zp, { number: function(n) { if (n <= 3) return n > 1; if (n % 2 === 0 || n % 3 === 0) return !1; for (var a = 5; a * a <= n; a += 6) if (n % a === 0 || n % (a + 2) === 0) return !1; return !0; }, bigint: function(n) { if (n <= 3n) return n > 1n; if (n % 2n === 0n || n % 3n === 0n) return !1; for (var a = 5n; a * a <= n; a += 6n) if (n % a === 0n || n % (a + 2n) === 0n) return !1; return !0; }, BigNumber: function(n) { if (n.lte(3)) return n.gt(1); if (n.mod(2).eq(0) || n.mod(3).eq(0)) return !1; if (n.lt(Math.pow(2, 32))) { for (var a = n.toNumber(), i = 5; i * i <= a; i += 6) if (a % i === 0 || a % (i + 2) === 0) return !1; return !0; } function o(A, h, x) { for (var w = 1; !h.eq(0); ) h.mod(2).eq(0) ? (h = h.div(2), A = A.mul(A).mod(x)) : (h = h.sub(1), w = A.mul(w).mod(x)); return w; } var l = n.constructor.clone({ precision: n.toFixed(0).length * 2 }); n = new l(n); for (var u = 0, s = n.sub(1); s.mod(2).eq(0); ) s = s.div(2), u += 1; var c = null; if (n.lt("3317044064679887385961981")) c = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41].filter((A) => A < n); else { var f = Math.min(n.toNumber() - 2, Math.floor(2 * Math.pow(n.toFixed(0).length * Math.log(10), 2))); c = []; for (var d = 2; d <= f; d += 1) c.push(f); } for (var p = 0; p < c.length; p += 1) { var m = c[p], v = o(n.sub(n).add(m), s, n); if (!v.eq(1)) { for (var b = 0, y = v; !y.eq(n.sub(1)); b += 1, y = y.mul(y).mod(n)) if (b === u - 1) return !1; } } return !0; }, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }), wO = "numeric", xO = ["number", "?bignumber", "?fraction"], AO = /* @__PURE__ */ P(wO, xO, (e) => { var { number: r, bignumber: t, fraction: n } = e, a = { string: !0, number: !0, BigNumber: !0, Fraction: !0 }, i = { number: (o) => r(o), BigNumber: t ? (o) => t(o) : Yl, bigint: (o) => BigInt(o), Fraction: n ? (o) => n(o) : Oy }; return function(l) { var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "number", s = arguments.length > 2 ? arguments[2] : void 0; if (s !== void 0) throw new SyntaxError("numeric() takes one or two arguments"); var c = yr(l); if (!(c in a)) throw new TypeError("Cannot convert " + l + ' of type "' + c + '"; valid input types are ' + Object.keys(a).join(", ")); if (!(u in i)) throw new TypeError("Cannot convert " + l + ' to type "' + u + '"; valid output types are ' + Object.keys(i).join(", ")); return u === c ? l : i[u](l); }; }), qp = "divideScalar", NO = ["typed", "numeric"], DO = /* @__PURE__ */ P(qp, NO, (e) => { var { typed: r, numeric: t } = e; return r(qp, { "number, number": function(a, i) { return a / i; }, "Complex, Complex": function(a, i) { return a.div(i); }, "BigNumber, BigNumber": function(a, i) { return a.div(i); }, "bigint, bigint": function(a, i) { return a / i; }, "Fraction, Fraction": function(a, i) { return a.div(i); }, "Unit, number | Complex | Fraction | BigNumber | Unit": (n, a) => n.divide(a), "number | Fraction | Complex | BigNumber, Unit": (n, a) => a.divideInto(n) }); }), Lp = "pow", EO = ["typed", "config", "identity", "multiply", "matrix", "inv", "fraction", "number", "Complex"], SO = /* @__PURE__ */ P(Lp, EO, (e) => { var { typed: r, config: t, identity: n, multiply: a, matrix: i, inv: o, number: l, fraction: u, Complex: s } = e; return r(Lp, { "number, number": c, "Complex, Complex": function(m, v) { return m.pow(v); }, "BigNumber, BigNumber": function(m, v) { return v.isInteger() || m >= 0 || t.predictable ? m.pow(v) : new s(m.toNumber(), 0).pow(v.toNumber(), 0); }, "bigint, bigint": (p, m) => p ** m, "Fraction, Fraction": function(m, v) { var b = m.pow(v); if (b != null) return b; if (t.predictable) throw new Error("Result of pow is non-rational and cannot be expressed as a fraction"); return c(m.valueOf(), v.valueOf()); }, "Array, number": f, "Array, BigNumber": function(m, v) { return f(m, v.toNumber()); }, "Matrix, number": d, "Matrix, BigNumber": function(m, v) { return d(m, v.toNumber()); }, "Unit, number | BigNumber": function(m, v) { return m.pow(v); } }); function c(p, m) { if (t.predictable && !Oe(m) && p < 0) try { var v = u(m), b = l(v); if ((m === b || Math.abs((m - b) / m) < 1e-14) && v.d % 2 === 1) return (v.n % 2 === 0 ? 1 : -1) * Math.pow(-p, m); } catch { } return t.predictable && (p < -1 && m === 1 / 0 || p > -1 && p < 0 && m === -1 / 0) ? NaN : Oe(m) || p >= 0 || t.predictable ? Vg(p, m) : p * p < 1 && m === 1 / 0 || p * p > 1 && m === -1 / 0 ? 0 : new s(p, 0).pow(m, 0); } function f(p, m) { if (!Oe(m)) throw new TypeError("For A^b, b must be an integer (value is " + m + ")"); var v = ke(p); if (v.length !== 2) throw new Error("For A^b, A must be 2 dimensional (A has " + v.length + " dimensions)"); if (v[0] !== v[1]) throw new Error("For A^b, A must be square (size is " + v[0] + "x" + v[1] + ")"); if (m < 0) try { return f(o(p), -m); } catch (A) { throw A.message === "Cannot calculate inverse, determinant is zero" ? new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is " + m + ")") : A; } for (var b = n(v[0]).valueOf(), y = p; m >= 1; ) (m & 1) === 1 && (b = a(y, b)), m >>= 1, y = a(y, y); return b; } function d(p, m) { return i(f(p.valueOf(), m)); } }), Oa = "Number of decimals in function round must be an integer", Up = "round", CO = ["typed", "config", "matrix", "equalScalar", "zeros", "BigNumber", "DenseMatrix"], MO = /* @__PURE__ */ P(Up, CO, (e) => { var { typed: r, config: t, matrix: n, equalScalar: a, zeros: i, BigNumber: o, DenseMatrix: l } = e, u = Kr({ typed: r, equalScalar: a }), s = Pr({ typed: r, DenseMatrix: l }), c = Wt({ typed: r }); function f(d) { return Math.abs(Ki(d).exponent); } return r(Up, { number: function(p) { var m = Ai(p, f(t.relTol)), v = Gr(p, m, t.relTol, t.absTol) ? m : p; return Ai(v); }, "number, number": function(p, m) { var v = f(t.relTol); if (m >= v) return Ai(p, m); var b = Ai(p, v), y = Gr(p, b, t.relTol, t.absTol) ? b : p; return Ai(y, m); }, "number, BigNumber": function(p, m) { if (!m.isInteger()) throw new TypeError(Oa); return new o(p).toDecimalPlaces(m.toNumber()); }, Complex: function(p) { return p.round(); }, "Complex, number": function(p, m) { if (m % 1) throw new TypeError(Oa); return p.round(m); }, "Complex, BigNumber": function(p, m) { if (!m.isInteger()) throw new TypeError(Oa); var v = m.toNumber(); return p.round(v); }, BigNumber: function(p) { var m = new o(p).toDecimalPlaces(f(t.relTol)), v = ht(p, m, t.relTol, t.absTol) ? m : p; return v.toDecimalPlaces(0); }, "BigNumber, BigNumber": function(p, m) { if (!m.isInteger()) throw new TypeError(Oa); var v = f(t.relTol); if (m >= v) return p.toDecimalPlaces(m.toNumber()); var b = p.toDecimalPlaces(v), y = ht(p, b, t.relTol, t.absTol) ? b : p; return y.toDecimalPlaces(m.toNumber()); }, Fraction: function(p) { return p.round(); }, "Fraction, number": function(p, m) { if (m % 1) throw new TypeError(Oa); return p.round(m); }, "Fraction, BigNumber": function(p, m) { if (!m.isInteger()) throw new TypeError(Oa); return p.round(m.toNumber()); }, "Unit, number, Unit": r.referToSelf((d) => function(p, m, v) { var b = p.toNumeric(v); return v.multiply(d(b, m)); }), "Unit, BigNumber, Unit": r.referToSelf((d) => (p, m, v) => d(p, m.toNumber(), v)), "Unit, Unit": r.referToSelf((d) => (p, m) => d(p, 0, m)), "Array | Matrix, number, Unit": r.referToSelf((d) => (p, m, v) => je(p, (b) => d(b, m, v))), "Array | Matrix, BigNumber, Unit": r.referToSelf((d) => (p, m, v) => d(p, m.toNumber(), v)), "Array | Matrix, Unit": r.referToSelf((d) => (p, m) => d(p, 0, m)), "Array | Matrix": r.referToSelf((d) => (p) => je(p, d)), "SparseMatrix, number | BigNumber": r.referToSelf((d) => (p, m) => u(p, m, d, !1)), "DenseMatrix, number | BigNumber": r.referToSelf((d) => (p, m) => c(p, m, d, !1)), "Array, number | BigNumber": r.referToSelf((d) => (p, m) => c(n(p), m, d, !1).valueOf()), "number | Complex | BigNumber | Fraction, SparseMatrix": r.referToSelf((d) => (p, m) => a(p, 0) ? i(m.size(), m.storage()) : s(m, p, d, !0)), "number | Complex | BigNumber | Fraction, DenseMatrix": r.referToSelf((d) => (p, m) => a(p, 0) ? i(m.size(), m.storage()) : c(m, p, d, !0)), "number | Complex | BigNumber | Fraction, Array": r.referToSelf((d) => (p, m) => c(n(m), p, d, !0).valueOf()) }); }), kp = "log", _O = ["config", "typed", "divideScalar", "Complex"], FO = /* @__PURE__ */ P(kp, _O, (e) => { var { typed: r, config: t, divideScalar: n, Complex: a } = e; return r(kp, { number: function(o) { return o >= 0 || t.predictable ? T_(o) : new a(o, 0).log(); }, Complex: function(o) { return o.log(); }, BigNumber: function(o) { return !o.isNegative() || t.predictable ? o.ln() : new a(o.toNumber(), 0).log(); }, "any, any": r.referToSelf((i) => (o, l) => n(i(o), i(l))) }); }), Vp = "log1p", TO = ["typed", "config", "divideScalar", "log", "Complex"], OO = /* @__PURE__ */ P(Vp, TO, (e) => { var { typed: r, config: t, divideScalar: n, log: a, Complex: i } = e; return r(Vp, { number: function(u) { return u >= -1 || t.predictable ? OC(u) : o(new i(u, 0)); }, Complex: o, BigNumber: function(u) { var s = u.plus(1); return !s.isNegative() || t.predictable ? s.ln() : o(new i(u.toNumber(), 0)); }, "Array | Matrix": r.referToSelf((l) => (u) => je(u, l)), "any, any": r.referToSelf((l) => (u, s) => n(l(u), a(s))) }); function o(l) { var u = l.re + 1; return new i(Math.log(Math.sqrt(u * u + l.im * l.im)), Math.atan2(l.im, u)); } }), Hp = "nthRoots", BO = ["config", "typed", "divideScalar", "Complex"], $O = /* @__PURE__ */ P(Hp, BO, (e) => { var { typed: r, config: t, divideScalar: n, Complex: a } = e, i = [function(u) { return new a(u, 0); }, function(u) { return new a(0, u); }, function(u) { return new a(-u, 0); }, function(u) { return new a(0, -u); }]; function o(l, u) { if (u < 0) throw new Error("Root must be greater than zero"); if (u === 0) throw new Error("Root must be non-zero"); if (u % 1 !== 0) throw new Error("Root must be an integer"); if (l === 0 || l.abs() === 0) return [new a(0, 0)]; var s = typeof l == "number", c; (s || l.re === 0 || l.im === 0) && (s ? c = 2 * +(l < 0) : l.im === 0 ? c = 2 * +(l.re < 0) : c = 2 * +(l.im < 0) + 1); for (var f = l.arg(), d = l.abs(), p = [], m = Math.pow(d, 1 / u), v = 0; v < u; v++) { var b = (c + 4 * v) / u; if (b === Math.round(b)) { p.push(i[b % 4](m)); continue; } p.push(new a({ r: m, phi: (f + 2 * Math.PI * v) / u })); } return p; } return r(Hp, { Complex: function(u) { return o(u, 2); }, "Complex, number": o }); }), Zp = "dotPow", IO = ["typed", "equalScalar", "matrix", "pow", "DenseMatrix", "concat"], RO = /* @__PURE__ */ P(Zp, IO, (e) => { var { typed: r, equalScalar: t, matrix: n, pow: a, DenseMatrix: i, concat: o } = e, l = ut({ typed: r }), u = on({ typed: r, DenseMatrix: i }), s = Kr({ typed: r, equalScalar: t }), c = Pr({ typed: r, DenseMatrix: i }), f = br({ typed: r, matrix: n, concat: o }), d = {}; for (var p in a.signatures) Object.prototype.hasOwnProperty.call(a.signatures, p) && !p.includes("Matrix") && !p.includes("Array") && (d[p] = a.signatures[p]); var m = r(d); return r(Zp, f({ elop: m, SS: u, DS: l, Ss: s, sS: c })); }), Gp = "dotDivide", PO = ["typed", "matrix", "equalScalar", "divideScalar", "DenseMatrix", "concat"], zO = /* @__PURE__ */ P(Gp, PO, (e) => { var { typed: r, matrix: t, equalScalar: n, divideScalar: a, DenseMatrix: i, concat: o } = e, l = Kt({ typed: r, equalScalar: n }), u = ut({ typed: r }), s = on({ typed: r, DenseMatrix: i }), c = Kr({ typed: r, equalScalar: n }), f = Pr({ typed: r, DenseMatrix: i }), d = br({ typed: r, matrix: t, concat: o }); return r(Gp, d({ elop: a, SS: s, DS: u, SD: l, Ss: c, sS: f })); }); function Ji(e) { var { DenseMatrix: r } = e; return function(n, a, i) { var o = n.size(); if (o.length !== 2) throw new RangeError("Matrix must be two dimensional (size: " + Qe(o) + ")"); var l = o[0], u = o[1]; if (l !== u) throw new RangeError("Matrix must be square (size: " + Qe(o) + ")"); var s = []; if (ze(a)) { var c = a.size(), f = a._data; if (c.length === 1) { if (c[0] !== l) throw new RangeError("Dimension mismatch. Matrix columns must match vector length."); for (var d = 0; d < l; d++) s[d] = [f[d]]; return new r({ data: s, size: [l, 1], datatype: a._datatype }); } if (c.length === 2) { if (c[0] !== l || c[1] !== 1) throw new RangeError("Dimension mismatch. Matrix columns must match vector length."); if (Ri(a)) { if (i) { s = []; for (var p = 0; p < l; p++) s[p] = [f[p][0]]; return new r({ data: s, size: [l, 1], datatype: a._datatype }); } return a; } if (kn(a)) { for (var m = 0; m < l; m++) s[m] = [0]; for (var v = a._values, b = a._index, y = a._ptr, A = y[1], h = y[0]; h < A; h++) { var x = b[h]; s[x][0] = v[h]; } return new r({ data: s, size: [l, 1], datatype: a._datatype }); } } throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector."); } if (cr(a)) { var w = ke(a); if (w.length === 1) { if (w[0] !== l) throw new RangeError("Dimension mismatch. Matrix columns must match vector length."); for (var g = 0; g < l; g++) s[g] = [a[g]]; return new r({ data: s, size: [l, 1] }); } if (w.length === 2) { if (w[0] !== l || w[1] !== 1) throw new RangeError("Dimension mismatch. Matrix columns must match vector length."); for (var D = 0; D < l; D++) s[D] = [a[D][0]]; return new r({ data: s, size: [l, 1] }); } throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector."); } }; } var Wp = "lsolve", qO = ["typed", "matrix", "divideScalar", "multiplyScalar", "subtractScalar", "equalScalar", "DenseMatrix"], LO = /* @__PURE__ */ P(Wp, qO, (e) => { var { typed: r, matrix: t, divideScalar: n, multiplyScalar: a, subtractScalar: i, equalScalar: o, DenseMatrix: l } = e, u = Ji({ DenseMatrix: l }); return r(Wp, { "SparseMatrix, Array | Matrix": function(d, p) { return c(d, p); }, "DenseMatrix, Array | Matrix": function(d, p) { return s(d, p); }, "Array, Array | Matrix": function(d, p) { var m = t(d), v = s(m, p); return v.valueOf(); } }); function s(f, d) { d = u(f, d, !0); for (var p = d._data, m = f._size[0], v = f._size[1], b = [], y = f._data, A = 0; A < v; A++) { var h = p[A][0] || 0, x = void 0; if (o(h, 0)) x = 0; else { var w = y[A][A]; if (o(w, 0)) throw new Error("Linear system cannot be solved since matrix is singular"); x = n(h, w); for (var g = A + 1; g < m; g++) p[g] = [i(p[g][0] || 0, a(x, y[g][A]))]; } b[A] = [x]; } return new l({ data: b, size: [m, 1] }); } function c(f, d) { d = u(f, d, !0); for (var p = d._data, m = f._size[0], v = f._size[1], b = f._values, y = f._index, A = f._ptr, h = [], x = 0; x < v; x++) { var w = p[x][0] || 0; if (o(w, 0)) h[x] = [0]; else { for (var g = 0, D = [], E = [], N = A[x], S = A[x + 1], M = N; M < S; M++) { var F = y[M]; F === x ? g = b[M] : F > x && (D.push(b[M]), E.push(F)); } if (o(g, 0)) throw new Error("Linear system cannot be solved since matrix is singular"); for (var $ = n(w, g), I = 0, B = E.length; I < B; I++) { var C = E[I]; p[C] = [i(p[C][0] || 0, a($, D[I]))]; } h[x] = [$]; } } return new l({ data: h, size: [m, 1] }); } }), Kp = "usolve", UO = ["typed", "matrix", "divideScalar", "multiplyScalar", "subtractScalar", "equalScalar", "DenseMatrix"], kO = /* @__PURE__ */ P(Kp, UO, (e) => { var { typed: r, matrix: t, divideScalar: n, multiplyScalar: a, subtractScalar: i, equalScalar: o, DenseMatrix: l } = e, u = Ji({ DenseMatrix: l }); return r(Kp, { "SparseMatrix, Array | Matrix": function(d, p) { return c(d, p); }, "DenseMatrix, Array | Matrix": function(d, p) { return s(d, p); }, "Array, Array | Matrix": function(d, p) { var m = t(d), v = s(m, p); return v.valueOf(); } }); function s(f, d) { d = u(f, d, !0); for (var p = d._data, m = f._size[0], v = f._size[1], b = [], y = f._data, A = v - 1; A >= 0; A--) { var h = p[A][0] || 0, x = void 0; if (o(h, 0)) x = 0; else { var w = y[A][A]; if (o(w, 0)) throw new Error("Linear system cannot be solved since matrix is singular"); x = n(h, w); for (var g = A - 1; g >= 0; g--) p[g] = [i(p[g][0] || 0, a(x, y[g][A]))]; } b[A] = [x]; } return new l({ data: b, size: [m, 1] }); } function c(f, d) { d = u(f, d, !0); for (var p = d._data, m = f._size[0], v = f._size[1], b = f._values, y = f._index, A = f._ptr, h = [], x = v - 1; x >= 0; x--) { var w = p[x][0] || 0; if (o(w, 0)) h[x] = [0]; else { for (var g = 0, D = [], E = [], N = A[x], S = A[x + 1], M = S - 1; M >= N; M--) { var F = y[M]; F === x ? g = b[M] : F < x && (D.push(b[M]), E.push(F)); } if (o(g, 0)) throw new Error("Linear system cannot be solved since matrix is singular"); for (var $ = n(w, g), I = 0, B = E.length; I < B; I++) { var C = E[I]; p[C] = [i(p[C][0], a($, D[I]))]; } h[x] = [$]; } } return new l({ data: h, size: [m, 1] }); } }), Jp = "lsolveAll", VO = ["typed", "matrix", "divideScalar", "multiplyScalar", "subtractScalar", "equalScalar", "DenseMatrix"], HO = /* @__PURE__ */ P(Jp, VO, (e) => { var { typed: r, matrix: t, divideScalar: n, multiplyScalar: a, subtractScalar: i, equalScalar: o, DenseMatrix: l } = e, u = Ji({ DenseMatrix: l }); return r(Jp, { "SparseMatrix, Array | Matrix": function(d, p) { return c(d, p); }, "DenseMatrix, Array | Matrix": function(d, p) { return s(d, p); }, "Array, Array | Matrix": function(d, p) { var m = t(d), v = s(m, p); return v.map((b) => b.valueOf()); } }); function s(f, d) { for (var p = [u(f, d, !0)._data.map((E) => E[0])], m = f._data, v = f._size[0], b = f._size[1], y = 0; y < b; y++) for (var A = p.length, h = 0; h < A; h++) { var x = p[h]; if (o(m[y][y], 0)) if (o(x[y], 0)) { if (h === 0) { var g = [...x]; g[y] = 1; for (var D = y + 1; D < b; D++) g[D] = i(g[D], m[D][y]); p.push(g); } } else { if (h === 0) return []; p.splice(h, 1), h -= 1, A -= 1; } else { x[y] = n(x[y], m[y][y]); for (var w = y + 1; w < b; w++) x[w] = i(x[w], a(x[y], m[w][y])); } } return p.map((E) => new l({ data: E.map((N) => [N]), size: [v, 1] })); } function c(f, d) { for (var p = [u(f, d, !0)._data.map((X) => X[0])], m = f._size[0], v = f._size[1], b = f._values, y = f._index, A = f._ptr, h = 0; h < v; h++) for (var x = p.length, w = 0; w < x; w++) { for (var g = p[w], D = [], E = [], N = A[h], S = A[h + 1], M = 0, F = N; F < S; F++) { var $ = y[F]; $ === h ? M = b[F] : $ > h && (D.push(b[F]), E.push($)); } if (o(M, 0)) if (o(g[h], 0)) { if (w === 0) { var _ = [...g]; _[h] = 1; for (var z = 0, O = E.length; z < O; z++) { var W = E[z]; _[W] = i(_[W], D[z]); } p.push(_); } } else { if (w === 0) return []; p.splice(w, 1), w -= 1, x -= 1; } else { g[h] = n(g[h], M); for (var I = 0, B = E.length; I < B; I++) { var C = E[I]; g[C] = i(g[C], a(g[h], D[I])); } } } return p.map((X) => new l({ data: X.map((V) => [V]), size: [m, 1] })); } }), Yp = "usolveAll", ZO = ["typed", "matrix", "divideScalar", "multiplyScalar", "subtractScalar", "equalScalar", "DenseMatrix"], GO = /* @__PURE__ */ P(Yp, ZO, (e) => { var { typed: r, matrix: t, divideScalar: n, multiplyScalar: a, subtractScalar: i, equalScalar: o, DenseMatrix: l } = e, u = Ji({ DenseMatrix: l }); return r(Yp, { "SparseMatrix, Array | Matrix": function(d, p) { return c(d, p); }, "DenseMatrix, Array | Matrix": function(d, p) { return s(d, p); }, "Array, Array | Matrix": function(d, p) { var m = t(d), v = s(m, p); return v.map((b) => b.valueOf()); } }); function s(f, d) { for (var p = [u(f, d, !0)._data.map((E) => E[0])], m = f._data, v = f._size[0], b = f._size[1], y = b - 1; y >= 0; y--) for (var A = p.length, h = 0; h < A; h++) { var x = p[h]; if (o(m[y][y], 0)) if (o(x[y], 0)) { if (h === 0) { var g = [...x]; g[y] = 1; for (var D = y - 1; D >= 0; D--) g[D] = i(g[D], m[D][y]); p.push(g); } } else { if (h === 0) return []; p.splice(h, 1), h -= 1, A -= 1; } else { x[y] = n(x[y], m[y][y]); for (var w = y - 1; w >= 0; w--) x[w] = i(x[w], a(x[y], m[w][y])); } } return p.map((E) => new l({ data: E.map((N) => [N]), size: [v, 1] })); } function c(f, d) { for (var p = [u(f, d, !0)._data.map((X) => X[0])], m = f._size[0], v = f._size[1], b = f._values, y = f._index, A = f._ptr, h = v - 1; h >= 0; h--) for (var x = p.length, w = 0; w < x; w++) { for (var g = p[w], D = [], E = [], N = A[h], S = A[h + 1], M = 0, F = S - 1; F >= N; F--) { var $ = y[F]; $ === h ? M = b[F] : $ < h && (D.push(b[F]), E.push($)); } if (o(M, 0)) if (o(g[h], 0)) { if (w === 0) { var _ = [...g]; _[h] = 1; for (var z = 0, O = E.length; z < O; z++) { var W = E[z]; _[W] = i(_[W], D[z]); } p.push(_); } } else { if (w === 0) return []; p.splice(w, 1), w -= 1, x -= 1; } else { g[h] = n(g[h], M); for (var I = 0, B = E.length; I < B; I++) { var C = E[I]; g[C] = i(g[C], a(g[h], D[I])); } } } return p.map((X) => new l({ data: X.map((V) => [V]), size: [m, 1] })); } }), WO = "matAlgo08xS0Sid", KO = ["typed", "equalScalar"], jl = /* @__PURE__ */ P(WO, KO, (e) => { var { typed: r, equalScalar: t } = e; return function(a, i, o) { var l = a._values, u = a._index, s = a._ptr, c = a._size, f = a._datatype || a._data === void 0 ? a._datatype : a.getDataType(), d = i._values, p = i._index, m = i._ptr, v = i._size, b = i._datatype || i._data === void 0 ? i._datatype : i.getDataType(); if (c.length !== v.length) throw new Ye(c.length, v.length); if (c[0] !== v[0] || c[1] !== v[1]) throw new RangeError("Dimension mismatch. Matrix A (" + c + ") must match Matrix B (" + v + ")"); if (!l || !d) throw new Error("Cannot perform operation on Pattern Sparse Matrices"); var y = c[0], A = c[1], h, x = t, w = 0, g = o; typeof f == "string" && f === b && f !== "mixed" && (h = f, x = r.find(t, [h, h]), w = r.convert(0, h), g = r.find(o, [h, h])); for (var D = [], E = [], N = [], S = [], M = [], F, $, I, B, C = 0; C < A; C++) { N[C] = E.length; var _ = C + 1; for ($ = s[C], I = s[C + 1], F = $; F < I; F++) B = u[F], M[B] = _, S[B] = l[F], E.push(B); for ($ = m[C], I = m[C + 1], F = $; F < I; F++) B = p[F], M[B] === _ && (S[B] = g(S[B], d[F])); for (F = N[C]; F < E.length; ) { B = E[F]; var z = S[B]; x(z, w) ? E.splice(F, 1) : (D.push(z), F++); } } return N[A] = E.length, a.createSparseMatrix({ values: D, index: E, ptr: N, size: [y, A], datatype: f === a._datatype && b === i._datatype ? h : void 0 }); }; }), Xl = /* @__PURE__ */ P("useMatrixForArrayScalar", ["typed", "matrix"], (e) => { var { typed: r, matrix: t } = e; return { "Array, number": r.referTo("DenseMatrix, number", (n) => (a, i) => n(t(a), i).valueOf()), "Array, BigNumber": r.referTo("DenseMatrix, BigNumber", (n) => (a, i) => n(t(a), i).valueOf()), "number, Array": r.referTo("number, DenseMatrix", (n) => (a, i) => n(a, t(i)).valueOf()), "BigNumber, Array": r.referTo("BigNumber, DenseMatrix", (n) => (a, i) => n(a, t(i)).valueOf()) }; }), jp = "leftShift", JO = ["typed", "matrix", "equalScalar", "zeros", "DenseMatrix", "concat"], YO = /* @__PURE__ */ P(jp, JO, (e) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, DenseMatrix: i, concat: o } = e, l = ra({ typed: r }), u = Kt({ typed: r, equalScalar: n }), s = jl({ typed: r, equalScalar: n }), c = Da({ typed: r, DenseMatrix: i }), f = Kr({ typed: r, equalScalar: n }), d = Wt({ typed: r }), p = br({ typed: r, matrix: t, concat: o }), m = Xl({ typed: r, matrix: t }); return r(jp, { "number, number": Kg, "BigNumber, BigNumber": wT, "bigint, bigint": (v, b) => v << b, "SparseMatrix, number | BigNumber": r.referToSelf((v) => (b, y) => n(y, 0) ? b.clone() : f(b, y, v, !1)), "DenseMatrix, number | BigNumber": r.referToSelf((v) => (b, y) => n(y, 0) ? b.clone() : d(b, y, v, !1)), "number | BigNumber, SparseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : c(y, b, v, !0)), "number | BigNumber, DenseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : d(y, b, v, !0)) }, m, p({ SS: s, DS: l, SD: u })); }), Xp = "rightArithShift", jO = ["typed", "matrix", "equalScalar", "zeros", "DenseMatrix", "concat"], XO = /* @__PURE__ */ P(Xp, jO, (e) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, DenseMatrix: i, concat: o } = e, l = ra({ typed: r }), u = Kt({ typed: r, equalScalar: n }), s = jl({ typed: r, equalScalar: n }), c = Da({ typed: r, DenseMatrix: i }), f = Kr({ typed: r, equalScalar: n }), d = Wt({ typed: r }), p = br({ typed: r, matrix: t, concat: o }), m = Xl({ typed: r, matrix: t }); return r(Xp, { "number, number": Jg, "BigNumber, BigNumber": xT, "bigint, bigint": (v, b) => v >> b, "SparseMatrix, number | BigNumber": r.referToSelf((v) => (b, y) => n(y, 0) ? b.clone() : f(b, y, v, !1)), "DenseMatrix, number | BigNumber": r.referToSelf((v) => (b, y) => n(y, 0) ? b.clone() : d(b, y, v, !1)), "number | BigNumber, SparseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : c(y, b, v, !0)), "number | BigNumber, DenseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : d(y, b, v, !0)) }, m, p({ SS: s, DS: l, SD: u })); }), Qp = "rightLogShift", QO = ["typed", "matrix", "equalScalar", "zeros", "DenseMatrix", "concat"], eB = /* @__PURE__ */ P(Qp, QO, (e) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, DenseMatrix: i, concat: o } = e, l = ra({ typed: r }), u = Kt({ typed: r, equalScalar: n }), s = jl({ typed: r, equalScalar: n }), c = Da({ typed: r, DenseMatrix: i }), f = Kr({ typed: r, equalScalar: n }), d = Wt({ typed: r }), p = br({ typed: r, matrix: t, concat: o }), m = Xl({ typed: r, matrix: t }); return r(Qp, { "number, number": Yg, // 'BigNumber, BigNumber': ..., // TODO: implement BigNumber support for rightLogShift "SparseMatrix, number | BigNumber": r.referToSelf((v) => (b, y) => n(y, 0) ? b.clone() : f(b, y, v, !1)), "DenseMatrix, number | BigNumber": r.referToSelf((v) => (b, y) => n(y, 0) ? b.clone() : d(b, y, v, !1)), "number | BigNumber, SparseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : c(y, b, v, !0)), "number | BigNumber, DenseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : d(y, b, v, !0)) }, m, p({ SS: s, DS: l, SD: u })); }), em = "and", rB = ["typed", "matrix", "equalScalar", "zeros", "not", "concat"], qy = /* @__PURE__ */ P(em, rB, (e) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, not: i, concat: o } = e, l = Kt({ typed: r, equalScalar: n }), u = Rs({ typed: r, equalScalar: n }), s = Kr({ typed: r, equalScalar: n }), c = Wt({ typed: r }), f = br({ typed: r, matrix: t, concat: o }); return r(em, { "number, number": Wu, "Complex, Complex": function(p, m) { return (p.re !== 0 || p.im !== 0) && (m.re !== 0 || m.im !== 0); }, "BigNumber, BigNumber": function(p, m) { return !p.isZero() && !m.isZero() && !p.isNaN() && !m.isNaN(); }, "bigint, bigint": Wu, "Unit, Unit": r.referToSelf((d) => (p, m) => d(p.value || 0, m.value || 0)), "SparseMatrix, any": r.referToSelf((d) => (p, m) => i(m) ? a(p.size(), p.storage()) : s(p, m, d, !1)), "DenseMatrix, any": r.referToSelf((d) => (p, m) => i(m) ? a(p.size(), p.storage()) : c(p, m, d, !1)), "any, SparseMatrix": r.referToSelf((d) => (p, m) => i(p) ? a(p.size(), p.storage()) : s(m, p, d, !0)), "any, DenseMatrix": r.referToSelf((d) => (p, m) => i(p) ? a(p.size(), p.storage()) : c(m, p, d, !0)), "Array, any": r.referToSelf((d) => (p, m) => d(t(p), m).valueOf()), "any, Array": r.referToSelf((d) => (p, m) => d(p, t(m)).valueOf()) }, f({ SS: u, DS: l })); }), ns = "compare", tB = ["typed", "config", "matrix", "equalScalar", "BigNumber", "Fraction", "DenseMatrix", "concat"], nB = /* @__PURE__ */ P(ns, tB, (e) => { var { typed: r, config: t, equalScalar: n, matrix: a, BigNumber: i, Fraction: o, DenseMatrix: l, concat: u } = e, s = ut({ typed: r }), c = Is({ typed: r, equalScalar: n }), f = Pr({ typed: r, DenseMatrix: l }), d = br({ typed: r, matrix: a, concat: u }), p = pi({ typed: r }); return r(ns, aB({ typed: r, config: t }), { "boolean, boolean": function(v, b) { return v === b ? 0 : v > b ? 1 : -1; }, "BigNumber, BigNumber": function(v, b) { return ht(v, b, t.relTol, t.absTol) ? new i(0) : new i(v.cmp(b)); }, "bigint, bigint": function(v, b) { return v === b ? 0n : v > b ? 1n : -1n; }, "Fraction, Fraction": function(v, b) { return new o(v.compare(b)); }, "Complex, Complex": function() { throw new TypeError("No ordering relation is defined for complex numbers"); } }, p, d({ SS: c, DS: s, Ss: f })); }), aB = /* @__PURE__ */ P(ns, ["typed", "config"], (e) => { var { typed: r, config: t } = e; return r(ns, { "number, number": function(a, i) { return Gr(a, i, t.relTol, t.absTol) ? 0 : a > i ? 1 : -1; } }); }), iB = function e(r, t) { var n = /(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi, a = /(^[ ]*|[ ]*$)/g, i = /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, o = /^0x[0-9a-f]+$/i, l = /^0/, u = function(h) { return e.insensitive && ("" + h).toLowerCase() || "" + h; }, s = u(r).replace(a, "") || "", c = u(t).replace(a, "") || "", f = s.replace(n, "\0$1\0").replace(/\0$/, "").replace(/^\0/, "").split("\0"), d = c.replace(n, "\0$1\0").replace(/\0$/, "").replace(/^\0/, "").split("\0"), p = parseInt(s.match(o), 16) || f.length !== 1 && s.match(i) && Date.parse(s), m = parseInt(c.match(o), 16) || p && c.match(i) && Date.parse(c) || null, v, b; if (m) { if (p < m) return -1; if (p > m) return 1; } for (var y = 0, A = Math.max(f.length, d.length); y < A; y++) { if (v = !(f[y] || "").match(l) && parseFloat(f[y]) || f[y] || 0, b = !(d[y] || "").match(l) && parseFloat(d[y]) || d[y] || 0, isNaN(v) !== isNaN(b)) return isNaN(v) ? 1 : -1; if (typeof v != typeof b && (v += "", b += ""), v < b) return -1; if (v > b) return 1; } return 0; }; const Ba = /* @__PURE__ */ Es(iB); var rm = "compareNatural", oB = ["typed", "compare"], sB = /* @__PURE__ */ P(rm, oB, (e) => { var { typed: r, compare: t } = e, n = t.signatures["boolean,boolean"]; return r(rm, { "any, any": a }); function a(u, s) { var c = yr(u), f = yr(s), d; if ((c === "number" || c === "BigNumber" || c === "Fraction") && (f === "number" || f === "BigNumber" || f === "Fraction")) return d = t(u, s), d.toString() !== "0" ? d > 0 ? 1 : -1 : Ba(c, f); var p = ["Array", "DenseMatrix", "SparseMatrix"]; if (p.includes(c) || p.includes(f)) return d = i(a, u, s), d !== 0 ? d : Ba(c, f); if (c !== f) return Ba(c, f); if (c === "Complex") return uB(u, s); if (c === "Unit") return u.equalBase(s) ? a(u.value, s.value) : o(a, u.formatUnits(), s.formatUnits()); if (c === "boolean") return n(u, s); if (c === "string") return Ba(u, s); if (c === "Object") return l(a, u, s); if (c === "null" || c === "undefined") return 0; throw new TypeError('Unsupported type of value "' + c + '"'); } function i(u, s, c) { return kn(s) && kn(c) ? o(u, s.toJSON().values, c.toJSON().values) : kn(s) ? i(u, s.toArray(), c) : kn(c) ? i(u, s, c.toArray()) : Ri(s) ? i(u, s.toJSON().data, c) : Ri(c) ? i(u, s, c.toJSON().data) : Array.isArray(s) ? Array.isArray(c) ? o(u, s, c) : i(u, s, [c]) : i(u, [s], c); } function o(u, s, c) { for (var f = 0, d = Math.min(s.length, c.length); f < d; f++) { var p = u(s[f], c[f]); if (p !== 0) return p; } return s.length > c.length ? 1 : s.length < c.length ? -1 : 0; } function l(u, s, c) { var f = Object.keys(s), d = Object.keys(c); f.sort(Ba), d.sort(Ba); var p = o(u, f, d); if (p !== 0) return p; for (var m = 0; m < f.length; m++) { var v = u(s[f[m]], c[d[m]]); if (v !== 0) return v; } return 0; } }); function uB(e, r) { return e.re > r.re ? 1 : e.re < r.re ? -1 : e.im > r.im ? 1 : e.im < r.im ? -1 : 0; } var tm = "compareText", lB = ["typed", "matrix", "concat"]; ku.signature = "any, any"; var cB = /* @__PURE__ */ P(tm, lB, (e) => { var { typed: r, matrix: t, concat: n } = e, a = br({ typed: r, matrix: t, concat: n }); return r(tm, ku, a({ elop: ku, Ds: !0 })); }), as = "equal", fB = ["typed", "matrix", "equalScalar", "DenseMatrix", "concat"], dB = /* @__PURE__ */ P(as, fB, (e) => { var { typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i } = e, o = ut({ typed: r }), l = on({ typed: r, DenseMatrix: a }), u = Pr({ typed: r, DenseMatrix: a }), s = br({ typed: r, matrix: t, concat: i }); return r(as, pB({ typed: r, equalScalar: n }), s({ elop: n, SS: l, DS: o, Ss: u })); }), pB = P(as, ["typed", "equalScalar"], (e) => { var { typed: r, equalScalar: t } = e; return r(as, { "any, any": function(a, i) { return a === null ? i === null : i === null ? a === null : a === void 0 ? i === void 0 : i === void 0 ? a === void 0 : t(a, i); } }); }), nm = "equalText", mB = ["typed", "compareText", "isZero"], vB = /* @__PURE__ */ P(nm, mB, (e) => { var { typed: r, compareText: t, isZero: n } = e; return r(nm, { "any, any": function(i, o) { return n(t(i, o)); } }); }), is = "smaller", hB = ["typed", "config", "matrix", "DenseMatrix", "concat"], gB = /* @__PURE__ */ P(is, hB, (e) => { var { typed: r, config: t, matrix: n, DenseMatrix: a, concat: i } = e, o = ut({ typed: r }), l = on({ typed: r, DenseMatrix: a }), u = Pr({ typed: r, DenseMatrix: a }), s = br({ typed: r, matrix: n, concat: i }), c = pi({ typed: r }); return r(is, yB({ typed: r, config: t }), { "boolean, boolean": (f, d) => f < d, "BigNumber, BigNumber": function(d, p) { return d.lt(p) && !ht(d, p, t.relTol, t.absTol); }, "bigint, bigint": (f, d) => f < d, "Fraction, Fraction": (f, d) => f.compare(d) === -1, "Complex, Complex": function(d, p) { throw new TypeError("No ordering relation is defined for complex numbers"); } }, c, s({ SS: l, DS: o, Ss: u })); }), yB = /* @__PURE__ */ P(is, ["typed", "config"], (e) => { var { typed: r, config: t } = e; return r(is, { "number, number": function(a, i) { return a < i && !Gr(a, i, t.relTol, t.absTol); } }); }), os = "smallerEq", bB = ["typed", "config", "matrix", "DenseMatrix", "concat"], wB = /* @__PURE__ */ P(os, bB, (e) => { var { typed: r, config: t, matrix: n, DenseMatrix: a, concat: i } = e, o = ut({ typed: r }), l = on({ typed: r, DenseMatrix: a }), u = Pr({ typed: r, DenseMatrix: a }), s = br({ typed: r, matrix: n, concat: i }), c = pi({ typed: r }); return r(os, xB({ typed: r, config: t }), { "boolean, boolean": (f, d) => f <= d, "BigNumber, BigNumber": function(d, p) { return d.lte(p) || ht(d, p, t.relTol, t.absTol); }, "bigint, bigint": (f, d) => f <= d, "Fraction, Fraction": (f, d) => f.compare(d) !== 1, "Complex, Complex": function() { throw new TypeError("No ordering relation is defined for complex numbers"); } }, c, s({ SS: l, DS: o, Ss: u })); }), xB = /* @__PURE__ */ P(os, ["typed", "config"], (e) => { var { typed: r, config: t } = e; return r(os, { "number, number": function(a, i) { return a <= i || Gr(a, i, t.relTol, t.absTol); } }); }), ss = "larger", AB = ["typed", "config", "matrix", "DenseMatrix", "concat"], NB = /* @__PURE__ */ P(ss, AB, (e) => { var { typed: r, config: t, matrix: n, DenseMatrix: a, concat: i } = e, o = ut({ typed: r }), l = on({ typed: r, DenseMatrix: a }), u = Pr({ typed: r, DenseMatrix: a }), s = br({ typed: r, matrix: n, concat: i }), c = pi({ typed: r }); return r(ss, DB({ typed: r, config: t }), { "boolean, boolean": (f, d) => f > d, "BigNumber, BigNumber": function(d, p) { return d.gt(p) && !ht(d, p, t.relTol, t.absTol); }, "bigint, bigint": (f, d) => f > d, "Fraction, Fraction": (f, d) => f.compare(d) === 1, "Complex, Complex": function() { throw new TypeError("No ordering relation is defined for complex numbers"); } }, c, s({ SS: l, DS: o, Ss: u })); }), DB = /* @__PURE__ */ P(ss, ["typed", "config"], (e) => { var { typed: r, config: t } = e; return r(ss, { "number, number": function(a, i) { return a > i && !Gr(a, i, t.relTol, t.absTol); } }); }), us = "largerEq", EB = ["typed", "config", "matrix", "DenseMatrix", "concat"], SB = /* @__PURE__ */ P(us, EB, (e) => { var { typed: r, config: t, matrix: n, DenseMatrix: a, concat: i } = e, o = ut({ typed: r }), l = on({ typed: r, DenseMatrix: a }), u = Pr({ typed: r, DenseMatrix: a }), s = br({ typed: r, matrix: n, concat: i }), c = pi({ typed: r }); return r(us, CB({ typed: r, config: t }), { "boolean, boolean": (f, d) => f >= d, "BigNumber, BigNumber": function(d, p) { return d.gte(p) || ht(d, p, t.relTol, t.absTol); }, "bigint, bigint": function(d, p) { return d >= p; }, "Fraction, Fraction": (f, d) => f.compare(d) !== -1, "Complex, Complex": function() { throw new TypeError("No ordering relation is defined for complex numbers"); } }, c, s({ SS: l, DS: o, Ss: u })); }), CB = /* @__PURE__ */ P(us, ["typed", "config"], (e) => { var { typed: r, config: t } = e; return r(us, { "number, number": function(a, i) { return a >= i || Gr(a, i, t.relTol, t.absTol); } }); }), am = "deepEqual", MB = ["typed", "equal"], _B = /* @__PURE__ */ P(am, MB, (e) => { var { typed: r, equal: t } = e; return r(am, { "any, any": function(i, o) { return n(i.valueOf(), o.valueOf()); } }); function n(a, i) { if (Array.isArray(a)) if (Array.isArray(i)) { var o = a.length; if (o !== i.length) return !1; for (var l = 0; l < o; l++) if (!n(a[l], i[l])) return !1; return !0; } else return !1; else return Array.isArray(i) ? !1 : t(a, i); } }), ls = "unequal", FB = ["typed", "config", "equalScalar", "matrix", "DenseMatrix", "concat"], TB = /* @__PURE__ */ P(ls, FB, (e) => { var { typed: r, config: t, equalScalar: n, matrix: a, DenseMatrix: i, concat: o } = e, l = ut({ typed: r }), u = on({ typed: r, DenseMatrix: i }), s = Pr({ typed: r, DenseMatrix: i }), c = br({ typed: r, matrix: a, concat: o }); return r(ls, OB({ typed: r, equalScalar: n }), c({ elop: f, SS: u, DS: l, Ss: s })); function f(d, p) { return !n(d, p); } }), OB = P(ls, ["typed", "equalScalar"], (e) => { var { typed: r, equalScalar: t } = e; return r(ls, { "any, any": function(a, i) { return a === null ? i !== null : i === null ? a !== null : a === void 0 ? i !== void 0 : i === void 0 ? a !== void 0 : !t(a, i); } }); }), im = "partitionSelect", BB = ["typed", "isNumeric", "isNaN", "compare"], $B = /* @__PURE__ */ P(im, BB, (e) => { var { typed: r, isNumeric: t, isNaN: n, compare: a } = e, i = a, o = (s, c) => -a(s, c); return r(im, { "Array | Matrix, number": function(c, f) { return l(c, f, i); }, "Array | Matrix, number, string": function(c, f, d) { if (d === "asc") return l(c, f, i); if (d === "desc") return l(c, f, o); throw new Error('Compare string must be "asc" or "desc"'); }, "Array | Matrix, number, function": l }); function l(s, c, f) { if (!Oe(c) || c < 0) throw new Error("k must be a non-negative integer"); if (ze(s)) { var d = s.size(); if (d.length > 1) throw new Error("Only one dimensional matrices supported"); return u(s.valueOf(), c, f); } if (Array.isArray(s)) return u(s, c, f); } function u(s, c, f) { if (c >= s.length) throw new Error("k out of bounds"); for (var d = 0; d < s.length; d++) if (t(s[d]) && n(s[d])) return s[d]; for (var p = 0, m = s.length - 1; p < m; ) { for (var v = p, b = m, y = s[Math.floor(Math.random() * (m - p + 1)) + p]; v < b; ) if (f(s[v], y) >= 0) { var A = s[b]; s[b] = s[v], s[v] = A, --b; } else ++v; f(s[v], y) > 0 && --v, c <= v ? m = v : p = v + 1; } return s[c]; } }), om = "sort", IB = ["typed", "matrix", "compare", "compareNatural"], RB = /* @__PURE__ */ P(om, IB, (e) => { var { typed: r, matrix: t, compare: n, compareNatural: a } = e, i = n, o = (c, f) => -n(c, f); return r(om, { Array: function(f) { return u(f), f.sort(i); }, Matrix: function(f) { return s(f), t(f.toArray().sort(i), f.storage()); }, "Array, function": function(f, d) { return u(f), f.sort(d); }, "Matrix, function": function(f, d) { return s(f), t(f.toArray().sort(d), f.storage()); }, "Array, string": function(f, d) { return u(f), f.sort(l(d)); }, "Matrix, string": function(f, d) { return s(f), t(f.toArray().sort(l(d)), f.storage()); } }); function l(c) { if (c === "asc") return i; if (c === "desc") return o; if (c === "natural") return a; throw new Error('String "asc", "desc", or "natural" expected'); } function u(c) { if (ke(c).length !== 1) throw new Error("One dimensional array expected"); } function s(c) { if (c.size().length !== 1) throw new Error("One dimensional matrix expected"); } }), sm = "max", PB = ["typed", "config", "numeric", "larger"], Ly = /* @__PURE__ */ P(sm, PB, (e) => { var { typed: r, config: t, numeric: n, larger: a } = e; return r(sm, { // max([a, b, c, d, ...]) "Array | Matrix": o, // max([a, b, c, d, ...], dim) "Array | Matrix, number | BigNumber": function(u, s) { return $s(u, s.valueOf(), i); }, // max(a, b, c, d, ...) "...": function(u) { if (ci(u)) throw new TypeError("Scalar values expected in function max"); return o(u); } }); function i(l, u) { try { return a(l, u) ? l : u; } catch (s) { throw st(s, "max", u); } } function o(l) { var u; if (Cn(l, function(s) { try { isNaN(s) && typeof s == "number" ? u = NaN : (u === void 0 || a(s, u)) && (u = s); } catch (c) { throw st(c, "max", s); } }), u === void 0) throw new Error("Cannot calculate max of an empty array"); return typeof u == "string" && (u = n(u, Qn(u, t))), u; } }), um = "min", zB = ["typed", "config", "numeric", "smaller"], Uy = /* @__PURE__ */ P(um, zB, (e) => { var { typed: r, config: t, numeric: n, smaller: a } = e; return r(um, { // min([a, b, c, d, ...]) "Array | Matrix": o, // min([a, b, c, d, ...], dim) "Array | Matrix, number | BigNumber": function(u, s) { return $s(u, s.valueOf(), i); }, // min(a, b, c, d, ...) "...": function(u) { if (ci(u)) throw new TypeError("Scalar values expected in function min"); return o(u); } }); function i(l, u) { try { return a(l, u) ? l : u; } catch (s) { throw st(s, "min", u); } } function o(l) { var u; if (Cn(l, function(s) { try { isNaN(s) && typeof s == "number" ? u = NaN : (u === void 0 || a(s, u)) && (u = s); } catch (c) { throw st(c, "min", s); } }), u === void 0) throw new Error("Cannot calculate min of an empty array"); return typeof u == "string" && (u = n(u, Qn(u, t))), u; } }), qB = "ImmutableDenseMatrix", LB = ["smaller", "DenseMatrix"], UB = /* @__PURE__ */ P(qB, LB, (e) => { var { smaller: r, DenseMatrix: t } = e; function n(a, i) { if (!(this instanceof n)) throw new SyntaxError("Constructor must be called with the new operator"); if (i && !Vr(i)) throw new Error("Invalid datatype: " + i); if (ze(a) || cr(a)) { var o = new t(a, i); this._data = o._data, this._size = o._size, this._datatype = o._datatype, this._min = null, this._max = null; } else if (a && cr(a.data) && cr(a.size)) this._data = a.data, this._size = a.size, this._datatype = a.datatype, this._min = typeof a.min < "u" ? a.min : null, this._max = typeof a.max < "u" ? a.max : null; else { if (a) throw new TypeError("Unsupported type of data (" + yr(a) + ")"); this._data = [], this._size = [0], this._datatype = i, this._min = null, this._max = null; } } return n.prototype = new t(), n.prototype.type = "ImmutableDenseMatrix", n.prototype.isImmutableDenseMatrix = !0, n.prototype.subset = function(a) { switch (arguments.length) { case 1: { var i = t.prototype.subset.call(this, a); return ze(i) ? new n({ data: i._data, size: i._size, datatype: i._datatype }) : i; } case 2: case 3: throw new Error("Cannot invoke set subset on an Immutable Matrix instance"); default: throw new SyntaxError("Wrong number of arguments"); } }, n.prototype.set = function() { throw new Error("Cannot invoke set on an Immutable Matrix instance"); }, n.prototype.resize = function() { throw new Error("Cannot invoke resize on an Immutable Matrix instance"); }, n.prototype.reshape = function() { throw new Error("Cannot invoke reshape on an Immutable Matrix instance"); }, n.prototype.clone = function() { return new n({ data: qe(this._data), size: qe(this._size), datatype: this._datatype }); }, n.prototype.toJSON = function() { return { mathjs: "ImmutableDenseMatrix", data: this._data, size: this._size, datatype: this._datatype }; }, n.fromJSON = function(a) { return new n(a); }, n.prototype.swapRows = function() { throw new Error("Cannot invoke swapRows on an Immutable Matrix instance"); }, n.prototype.min = function() { if (this._min === null) { var a = null; this.forEach(function(i) { (a === null || r(i, a)) && (a = i); }), this._min = a !== null ? a : void 0; } return this._min; }, n.prototype.max = function() { if (this._max === null) { var a = null; this.forEach(function(i) { (a === null || r(a, i)) && (a = i); }), this._max = a !== null ? a : void 0; } return this._max; }, n; }, { isClass: !0 }), kB = "Index", VB = ["ImmutableDenseMatrix", "getMatrixDataType"], HB = /* @__PURE__ */ P(kB, VB, (e) => { var { ImmutableDenseMatrix: r, getMatrixDataType: t } = e; function n(i) { if (!(this instanceof n)) throw new SyntaxError("Constructor must be called with the new operator"); this._dimensions = [], this._sourceSize = [], this._isScalar = !0; for (var o = 0, l = arguments.length; o < l; o++) { var u = arguments[o], s = cr(u), c = ze(u), f = null; if (Ms(u)) this._dimensions.push(u), this._isScalar = !1; else if (s || c) { var d = void 0; t(u) === "boolean" ? (s && (d = a(lm(u).valueOf())), c && (d = a(lm(u._data).valueOf())), f = u.valueOf().length) : d = a(u.valueOf()), this._dimensions.push(d); var p = d.size(); (p.length !== 1 || p[0] !== 1 || f !== null) && (this._isScalar = !1); } else if (typeof u == "number") this._dimensions.push(a([u])); else if (typeof u == "string") this._dimensions.push(u); else throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range"); this._sourceSize.push(f); } } n.prototype.type = "Index", n.prototype.isIndex = !0; function a(i) { for (var o = 0, l = i.length; o < l; o++) if (typeof i[o] != "number" || !Oe(i[o])) throw new TypeError("Index parameters must be positive integer numbers"); return new r(i); } return n.prototype.clone = function() { var i = new n(); return i._dimensions = qe(this._dimensions), i._isScalar = this._isScalar, i._sourceSize = this._sourceSize, i; }, n.create = function(i) { var o = new n(); return n.apply(o, i), o; }, n.prototype.size = function() { for (var i = [], o = 0, l = this._dimensions.length; o < l; o++) { var u = this._dimensions[o]; i[o] = typeof u == "string" ? 1 : u.size()[0]; } return i; }, n.prototype.max = function() { for (var i = [], o = 0, l = this._dimensions.length; o < l; o++) { var u = this._dimensions[o]; i[o] = typeof u == "string" ? u : u.max(); } return i; }, n.prototype.min = function() { for (var i = [], o = 0, l = this._dimensions.length; o < l; o++) { var u = this._dimensions[o]; i[o] = typeof u == "string" ? u : u.min(); } return i; }, n.prototype.forEach = function(i) { for (var o = 0, l = this._dimensions.length; o < l; o++) i(this._dimensions[o], o, this); }, n.prototype.dimension = function(i) { return typeof i != "number" ? null : this._dimensions[i] || null; }, n.prototype.isObjectProperty = function() { return this._dimensions.length === 1 && typeof this._dimensions[0] == "string"; }, n.prototype.getObjectProperty = function() { return this.isObjectProperty() ? this._dimensions[0] : null; }, n.prototype.isScalar = function() { return this._isScalar; }, n.prototype.toArray = function() { for (var i = [], o = 0, l = this._dimensions.length; o < l; o++) { var u = this._dimensions[o]; i.push(typeof u == "string" ? u : u.toArray()); } return i; }, n.prototype.valueOf = n.prototype.toArray, n.prototype.toString = function() { for (var i = [], o = 0, l = this._dimensions.length; o < l; o++) { var u = this._dimensions[o]; typeof u == "string" ? i.push(JSON.stringify(u)) : i.push(u.toString()); } return "[" + i.join(", ") + "]"; }, n.prototype.toJSON = function() { return { mathjs: "Index", dimensions: this._dimensions }; }, n.fromJSON = function(i) { return n.create(i.dimensions); }, n; }, { isClass: !0 }); function lm(e) { var r = []; return e.forEach((t, n) => { t && r.push(n); }), r; } var ZB = "FibonacciHeap", GB = ["smaller", "larger"], WB = /* @__PURE__ */ P(ZB, GB, (e) => { var { smaller: r, larger: t } = e, n = 1 / Math.log((1 + Math.sqrt(5)) / 2); function a() { if (!(this instanceof a)) throw new SyntaxError("Constructor must be called with the new operator"); this._minimum = null, this._size = 0; } a.prototype.type = "FibonacciHeap", a.prototype.isFibonacciHeap = !0, a.prototype.insert = function(c, f) { var d = { key: c, value: f, degree: 0 }; if (this._minimum) { var p = this._minimum; d.left = p, d.right = p.right, p.right = d, d.right.left = d, r(c, p.key) && (this._minimum = d); } else d.left = d, d.right = d, this._minimum = d; return this._size++, d; }, a.prototype.size = function() { return this._size; }, a.prototype.clear = function() { this._minimum = null, this._size = 0; }, a.prototype.isEmpty = function() { return this._size === 0; }, a.prototype.extractMinimum = function() { var c = this._minimum; if (c === null) return c; for (var f = this._minimum, d = c.degree, p = c.child; d > 0; ) { var m = p.right; p.left.right = p.right, p.right.left = p.left, p.left = f, p.right = f.right, f.right = p, p.right.left = p, p.parent = null, p = m, d--; } return c.left.right = c.right, c.right.left = c.left, c === c.right ? f = null : (f = c.right, f = s(f, this._size)), this._size--, this._minimum = f, c; }, a.prototype.remove = function(c) { this._minimum = i(this._minimum, c, -1), this.extractMinimum(); }; function i(c, f, d) { f.key = d; var p = f.parent; return p && r(f.key, p.key) && (o(c, f, p), l(c, p)), r(f.key, c.key) && (c = f), c; } function o(c, f, d) { f.left.right = f.right, f.right.left = f.left, d.degree--, d.child === f && (d.child = f.right), d.degree === 0 && (d.child = null), f.left = c, f.right = c.right, c.right = f, f.right.left = f, f.parent = null, f.mark = !1; } function l(c, f) { var d = f.parent; d && (f.mark ? (o(c, f, d), l(d)) : f.mark = !0); } var u = function(f, d) { f.left.right = f.right, f.right.left = f.left, f.parent = d, d.child ? (f.left = d.child, f.right = d.child.right, d.child.right = f, f.right.left = f) : (d.child = f, f.right = f, f.left = f), d.degree++, f.mark = !1; }; function s(c, f) { var d = Math.floor(Math.log(f) * n) + 1, p = new Array(d), m = 0, v = c; if (v) for (m++, v = v.right; v !== c; ) m++, v = v.right; for (var b; m > 0; ) { for (var y = v.degree, A = v.right; b = p[y], !!b; ) { if (t(v.key, b.key)) { var h = b; b = v, v = h; } u(b, v), p[y] = null, y++; } p[y] = v, v = A, m--; } c = null; for (var x = 0; x < d; x++) b = p[x], b && (c ? (b.left.right = b.right, b.right.left = b.left, b.left = c, b.right = c.right, c.right = b, b.right.left = b, r(b.key, c.key) && (c = b)) : c = b); return c; } return a; }, { isClass: !0 }), KB = "Spa", JB = ["addScalar", "equalScalar", "FibonacciHeap"], YB = /* @__PURE__ */ P(KB, JB, (e) => { var { addScalar: r, equalScalar: t, FibonacciHeap: n } = e; function a() { if (!(this instanceof a)) throw new SyntaxError("Constructor must be called with the new operator"); this._values = [], this._heap = new n(); } return a.prototype.type = "Spa", a.prototype.isSpa = !0, a.prototype.set = function(i, o) { if (this._values[i]) this._values[i].value = o; else { var l = this._heap.insert(i, o); this._values[i] = l; } }, a.prototype.get = function(i) { var o = this._values[i]; return o ? o.value : 0; }, a.prototype.accumulate = function(i, o) { var l = this._values[i]; l ? l.value = r(l.value, o) : (l = this._heap.insert(i, o), this._values[i] = l); }, a.prototype.forEach = function(i, o, l) { var u = this._heap, s = this._values, c = [], f = u.extractMinimum(); for (f && c.push(f); f && f.key <= o; ) f.key >= i && (t(f.value, 0) || l(f.key, f.value, this)), f = u.extractMinimum(), f && c.push(f); for (var d = 0; d < c.length; d++) { var p = c[d]; f = u.insert(p.key, p.value), s[f.key] = f; } }, a.prototype.swap = function(i, o) { var l = this._values[i], u = this._values[o]; if (!l && u) l = this._heap.insert(i, u.value), this._heap.remove(u), this._values[i] = l, this._values[o] = void 0; else if (l && !u) u = this._heap.insert(o, l.value), this._heap.remove(l), this._values[o] = u, this._values[i] = void 0; else if (l && u) { var s = l.value; l.value = u.value, u.value = s; } }, a; }, { isClass: !0 }); function jB(e) { var r = 0, t = 1, n = /* @__PURE__ */ Object.create(null), a = /* @__PURE__ */ Object.create(null), i = 0, o = function(u) { var s = a[u]; if (s && (delete n[s], delete a[u], --r, t === s)) { if (!r) { i = 0, t = 1; return; } for (; !Object.prototype.hasOwnProperty.call(n, ++t); ) ; } }; return e = Math.abs(e), { hit: function(u) { var s = a[u], c = ++i; if (n[c] = u, a[u] = c, !s) return ++r, r <= e ? void 0 : (u = n[t], o(u), u); if (delete n[s], t === s) for (; !Object.prototype.hasOwnProperty.call(n, ++t); ) ; }, delete: o, clear: function() { r = i = 0, t = 1, n = /* @__PURE__ */ Object.create(null), a = /* @__PURE__ */ Object.create(null); } }; } function Yi(e) { var { hasher: r, limit: t } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; return t = t ?? Number.POSITIVE_INFINITY, r = r ?? JSON.stringify, function n() { typeof n.cache != "object" && (n.cache = { values: /* @__PURE__ */ new Map(), lru: jB(t || Number.POSITIVE_INFINITY) }); for (var a = [], i = 0; i < arguments.length; i++) a[i] = arguments[i]; var o = r(a); if (n.cache.values.has(o)) return n.cache.lru.hit(o), n.cache.values.get(o); var l = e.apply(e, a); return n.cache.values.set(o, l), n.cache.values.delete(n.cache.lru.hit(o)), l; }; } var XB = Yi(function(e) { return new e(1).exp(); }, { hasher: Ps }), QB = Yi(function(e) { return new e(1).plus(new e(5).sqrt()).div(2); }, { hasher: Ps }), Ql = Yi(function(e) { return e.acos(-1); }, { hasher: Ps }), e5 = Yi(function(e) { return Ql(e).times(2); }, { hasher: Ps }); function Ps(e) { return e[0].precision; } function cm(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); r && (n = n.filter(function(a) { return Object.getOwnPropertyDescriptor(e, a).enumerable; })), t.push.apply(t, n); } return t; } function mu(e) { for (var r = 1; r < arguments.length; r++) { var t = arguments[r] != null ? arguments[r] : {}; r % 2 ? cm(Object(t), !0).forEach(function(n) { Rr(e, n, t[n]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : cm(Object(t)).forEach(function(n) { Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n)); }); } return e; } var r5 = "Unit", t5 = ["?on", "config", "addScalar", "subtractScalar", "multiplyScalar", "divideScalar", "pow", "abs", "fix", "round", "equal", "isNumeric", "format", "number", "Complex", "BigNumber", "Fraction"], n5 = /* @__PURE__ */ P(r5, t5, (e) => { var { on: r, config: t, addScalar: n, subtractScalar: a, multiplyScalar: i, divideScalar: o, pow: l, abs: u, fix: s, round: c, equal: f, isNumeric: d, format: p, number: m, Complex: v, BigNumber: b, Fraction: y } = e, A = m; function h(L, H) { if (!(this instanceof h)) throw new Error("Constructor must be called with the new operator"); if (!(L == null || d(L) || Ut(L))) throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined"); if (this.fixPrefix = !1, this.skipAutomaticSimplification = !0, H === void 0) this.units = [], this.dimensions = z.map((ie) => 0); else if (typeof H == "string") { var ne = h.parse(H); this.units = ne.units, this.dimensions = ne.dimensions; } else if (ft(H) && H.value === null) this.fixPrefix = H.fixPrefix, this.skipAutomaticSimplification = H.skipAutomaticSimplification, this.dimensions = H.dimensions.slice(0), this.units = H.units.map((ie) => jr({}, ie)); else throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit"); this.value = this._normalize(L); } Object.defineProperty(h, "name", { value: "Unit" }), h.prototype.constructor = h, h.prototype.type = "Unit", h.prototype.isUnit = !0; var x, w, g; function D() { for (; g === " " || g === " "; ) S(); } function E(L) { return L >= "0" && L <= "9" || L === "."; } function N(L) { return L >= "0" && L <= "9"; } function S() { w++, g = x.charAt(w); } function M(L) { w = L, g = x.charAt(w); } function F() { var L = "", H = w; if (g === "+" ? S() : g === "-" && (L += g, S()), !E(g)) return M(H), null; if (g === ".") { if (L += g, S(), !N(g)) return M(H), null; } else { for (; N(g); ) L += g, S(); g === "." && (L += g, S()); } for (; N(g); ) L += g, S(); if (g === "E" || g === "e") { var ne = "", ie = w; if (ne += g, S(), (g === "+" || g === "-") && (ne += g, S()), !N(g)) return M(ie), L; for (L = L + ne; N(g); ) L += g, S(); } return L; } function $() { for (var L = ""; N(g) || h.isValidAlpha(g); ) L += g, S(); var H = L.charAt(0); return h.isValidAlpha(H) ? L : null; } function I(L) { return g === L ? (S(), L) : null; } h.parse = function(L, H) { if (H = H || {}, x = L, w = -1, g = "", typeof x != "string") throw new TypeError("Invalid argument in Unit.parse, string expected"); var ne = new h(); ne.units = []; var ie = 1, me = !1; S(), D(); var pe = F(), xe = null; if (pe) { if (t.number === "BigNumber") xe = new b(pe); else if (t.number === "Fraction") try { xe = new y(pe); } catch { xe = parseFloat(pe); } else xe = parseFloat(pe); D(), I("*") ? (ie = 1, me = !0) : I("/") && (ie = -1, me = !0); } for (var De = [], k = 1; ; ) { for (D(); g === "("; ) De.push(ie), k *= ie, ie = 1, S(), D(); var J = void 0; if (g) { var G = g; if (J = $(), J === null) throw new SyntaxError('Unexpected "' + G + '" in "' + x + '" at index ' + w.toString()); } else break; var ae = B(J); if (ae === null) throw new SyntaxError('Unit "' + J + '" not found.'); var fe = ie * k; if (D(), I("^")) { D(); var de = F(); if (de === null) throw new SyntaxError('In "' + L + '", "^" must be followed by a floating-point number'); fe *= de; } ne.units.push({ unit: ae.unit, prefix: ae.prefix, power: fe }); for (var Ne = 0; Ne < z.length; Ne++) ne.dimensions[Ne] += (ae.unit.dimensions[Ne] || 0) * fe; for (D(); g === ")"; ) { if (De.length === 0) throw new SyntaxError('Unmatched ")" in "' + x + '" at index ' + w.toString()); k /= De.pop(), S(), D(); } if (me = !1, I("*") ? (ie = 1, me = !0) : I("/") ? (ie = -1, me = !0) : ie = 1, ae.unit.base) { var we = ae.unit.base.key; re.auto[we] = { unit: ae.unit, prefix: ae.prefix }; } } if (D(), g) throw new SyntaxError('Could not parse: "' + L + '"'); if (me) throw new SyntaxError('Trailing characters: "' + L + '"'); if (De.length !== 0) throw new SyntaxError('Unmatched "(" in "' + x + '"'); if (ne.units.length === 0 && !H.allowNoUnits) throw new SyntaxError('"' + L + '" contains no units'); return ne.value = xe !== void 0 ? ne._normalize(xe) : null, ne; }, h.prototype.clone = function() { var L = new h(); L.fixPrefix = this.fixPrefix, L.skipAutomaticSimplification = this.skipAutomaticSimplification, L.value = qe(this.value), L.dimensions = this.dimensions.slice(0), L.units = []; for (var H = 0; H < this.units.length; H++) { L.units[H] = {}; for (var ne in this.units[H]) Fe(this.units[H], ne) && (L.units[H][ne] = this.units[H][ne]); } return L; }, h.prototype.valueType = function() { return yr(this.value); }, h.prototype._isDerived = function() { return this.units.length === 0 ? !1 : this.units.length > 1 || Math.abs(this.units[0].power - 1) > 1e-15; }, h.prototype._normalize = function(L) { if (L == null || this.units.length === 0) return L; for (var H = L, ne = h._getNumberConverter(yr(L)), ie = 0; ie < this.units.length; ie++) { var me = ne(this.units[ie].unit.value), pe = ne(this.units[ie].prefix.value), xe = ne(this.units[ie].power); H = i(H, l(i(me, pe), xe)); } return H; }, h.prototype._denormalize = function(L, H) { if (L == null || this.units.length === 0) return L; for (var ne = L, ie = h._getNumberConverter(yr(L)), me = 0; me < this.units.length; me++) { var pe = ie(this.units[me].unit.value), xe = ie(this.units[me].prefix.value), De = ie(this.units[me].power); ne = o(ne, l(i(pe, xe), De)); } return ne; }; var B = Yi((L) => { if (Fe(R, L)) { var H = R[L], ne = H.prefixes[""]; return { unit: H, prefix: ne }; } for (var ie in R) if (Fe(R, ie) && v_(L, ie)) { var me = R[ie], pe = L.length - ie.length, xe = L.substring(0, pe), De = Fe(me.prefixes, xe) ? me.prefixes[xe] : void 0; if (De !== void 0) return { unit: me, prefix: De }; } return null; }, { hasher: (L) => L[0], limit: 100 }); h.isValuelessUnit = function(L) { return B(L) !== null; }, h.prototype.hasBase = function(L) { if (typeof L == "string" && (L = O[L]), !L) return !1; for (var H = 0; H < z.length; H++) if (Math.abs((this.dimensions[H] || 0) - (L.dimensions[H] || 0)) > 1e-12) return !1; return !0; }, h.prototype.equalBase = function(L) { for (var H = 0; H < z.length; H++) if (Math.abs((this.dimensions[H] || 0) - (L.dimensions[H] || 0)) > 1e-12) return !1; return !0; }, h.prototype.equals = function(L) { return this.equalBase(L) && f(this.value, L.value); }, h.prototype.multiply = function(L) { for (var H = this.clone(), ne = ft(L) ? L : new h(L), ie = 0; ie < z.length; ie++) H.dimensions[ie] = (this.dimensions[ie] || 0) + (ne.dimensions[ie] || 0); for (var me = 0; me < ne.units.length; me++) { var pe = mu({}, ne.units[me]); H.units.push(pe); } if (this.value !== null || ne.value !== null) { var xe = this.value === null ? this._normalize(1) : this.value, De = ne.value === null ? ne._normalize(1) : ne.value; H.value = i(xe, De); } else H.value = null; return ft(L) && (H.skipAutomaticSimplification = !1), C(H); }, h.prototype.divideInto = function(L) { return new h(L).divide(this); }, h.prototype.divide = function(L) { for (var H = this.clone(), ne = ft(L) ? L : new h(L), ie = 0; ie < z.length; ie++) H.dimensions[ie] = (this.dimensions[ie] || 0) - (ne.dimensions[ie] || 0); for (var me = 0; me < ne.units.length; me++) { var pe = mu(mu({}, ne.units[me]), {}, { power: -ne.units[me].power }); H.units.push(pe); } if (this.value !== null || ne.value !== null) { var xe = this.value === null ? this._normalize(1) : this.value, De = ne.value === null ? ne._normalize(1) : ne.value; H.value = o(xe, De); } else H.value = null; return ft(L) && (H.skipAutomaticSimplification = !1), C(H); }, h.prototype.pow = function(L) { for (var H = this.clone(), ne = 0; ne < z.length; ne++) H.dimensions[ne] = (this.dimensions[ne] || 0) * L; for (var ie = 0; ie < H.units.length; ie++) H.units[ie].power *= L; return H.value !== null ? H.value = l(H.value, L) : H.value = null, H.skipAutomaticSimplification = !1, C(H); }; function C(L) { return L.equalBase(O.NONE) && L.value !== null && !t.predictable ? L.value : L; } h.prototype.abs = function() { var L = this.clone(); if (L.value !== null) if (L._isDerived() || L.units.length === 0 || L.units[0].unit.offset === 0) L.value = u(L.value); else { var H = L._numberConverter(), ne = H(L.units[0].unit.value), ie = H(L.units[0].unit.offset), me = i(ne, ie); L.value = a(u(n(L.value, me)), me); } for (var pe in L.units) (L.units[pe].unit.name === "VA" || L.units[pe].unit.name === "VAR") && (L.units[pe].unit = R.W); return L; }, h.prototype.to = function(L) { var H = this.value === null ? this._normalize(1) : this.value, ne; if (typeof L == "string") ne = h.parse(L); else if (ft(L)) ne = L.clone(); else throw new Error("String or Unit expected as parameter"); if (!this.equalBase(ne)) throw new Error("Units do not match ('".concat(ne.toString(), "' != '").concat(this.toString(), "')")); if (ne.value !== null) throw new Error("Cannot convert to a unit with a value"); if (this.value === null || this._isDerived() || this.units.length === 0 || ne.units.length === 0 || this.units[0].unit.offset === ne.units[0].unit.offset) ne.value = qe(H); else { var ie = h._getNumberConverter(yr(H)), me = this.units[0].unit.value, pe = this.units[0].unit.offset, xe = i(me, pe), De = ne.units[0].unit.value, k = ne.units[0].unit.offset, J = i(De, k); ne.value = n(H, ie(a(xe, J))); } return ne.fixPrefix = !0, ne.skipAutomaticSimplification = !0, ne; }, h.prototype.toNumber = function(L) { return A(this.toNumeric(L)); }, h.prototype.toNumeric = function(L) { var H; return L ? H = this.to(L) : H = this.clone(), H._isDerived() || H.units.length === 0 ? H._denormalize(H.value) : H._denormalize(H.value, H.units[0].prefix.value); }, h.prototype.toString = function() { return this.format(); }, h.prototype.toJSON = function() { return { mathjs: "Unit", value: this._denormalize(this.value), unit: this.units.length > 0 ? this.formatUnits() : null, fixPrefix: this.fixPrefix }; }, h.fromJSON = function(L) { var H, ne = new h(L.value, (H = L.unit) !== null && H !== void 0 ? H : void 0); return ne.fixPrefix = L.fixPrefix || !1, ne; }, h.prototype.valueOf = h.prototype.toString, h.prototype.simplify = function() { var L = this.clone(), H = [], ne; for (var ie in q) if (Fe(q, ie) && L.hasBase(O[ie])) { ne = ie; break; } if (ne === "NONE") L.units = []; else { var me; if (ne && Fe(q, ne) && (me = q[ne]), me) L.units = [{ unit: me.unit, prefix: me.prefix, power: 1 }]; else { for (var pe = !1, xe = 0; xe < z.length; xe++) { var De = z[xe]; Math.abs(L.dimensions[xe] || 0) > 1e-12 && (Fe(q, De) ? H.push({ unit: q[De].unit, prefix: q[De].prefix, power: L.dimensions[xe] || 0 }) : pe = !0); } H.length < L.units.length && !pe && (L.units = H); } } return L; }, h.prototype.toSI = function() { for (var L = this.clone(), H = [], ne = 0; ne < z.length; ne++) { var ie = z[ne]; if (Math.abs(L.dimensions[ne] || 0) > 1e-12) if (Fe(re.si, ie)) H.push({ unit: re.si[ie].unit, prefix: re.si[ie].prefix, power: L.dimensions[ne] || 0 }); else throw new Error("Cannot express custom unit " + ie + " in SI units"); } return L.units = H, L.fixPrefix = !0, L.skipAutomaticSimplification = !0, this.value !== null ? (L.value = null, this.to(L)) : L; }, h.prototype.formatUnits = function() { for (var L = "", H = "", ne = 0, ie = 0, me = 0; me < this.units.length; me++) this.units[me].power > 0 ? (ne++, L += " " + this.units[me].prefix.name + this.units[me].unit.name, Math.abs(this.units[me].power - 1) > 1e-15 && (L += "^" + this.units[me].power)) : this.units[me].power < 0 && ie++; if (ie > 0) for (var pe = 0; pe < this.units.length; pe++) this.units[pe].power < 0 && (ne > 0 ? (H += " " + this.units[pe].prefix.name + this.units[pe].unit.name, Math.abs(this.units[pe].power + 1) > 1e-15 && (H += "^" + -this.units[pe].power)) : (H += " " + this.units[pe].prefix.name + this.units[pe].unit.name, H += "^" + this.units[pe].power)); L = L.substr(1), H = H.substr(1), ne > 1 && ie > 0 && (L = "(" + L + ")"), ie > 1 && ne > 0 && (H = "(" + H + ")"); var xe = L; return ne > 0 && ie > 0 && (xe += " / "), xe += H, xe; }, h.prototype.format = function(L) { var H = this.skipAutomaticSimplification || this.value === null ? this.clone() : this.simplify(), ne = !1; typeof H.value < "u" && H.value !== null && Ut(H.value) && (ne = Math.abs(H.value.re) < 1e-14); for (var ie in H.units) Fe(H.units, ie) && H.units[ie].unit && (H.units[ie].unit.name === "VA" && ne ? H.units[ie].unit = R.VAR : H.units[ie].unit.name === "VAR" && !ne && (H.units[ie].unit = R.VA)); H.units.length === 1 && !H.fixPrefix && Math.abs(H.units[0].power - Math.round(H.units[0].power)) < 1e-14 && (H.units[0].prefix = H._bestPrefix()); var me = H._denormalize(H.value), pe = H.value !== null ? p(me, L || {}) : "", xe = H.formatUnits(); return H.value && Ut(H.value) && (pe = "(" + pe + ")"), xe.length > 0 && pe.length > 0 && (pe += " "), pe += xe, pe; }, h.prototype._bestPrefix = function() { if (this.units.length !== 1) throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!"); if (Math.abs(this.units[0].power - Math.round(this.units[0].power)) >= 1e-14) throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!"); var L = this.value !== null ? u(this.value) : 0, H = u(this.units[0].unit.value), ne = this.units[0].prefix; if (L === 0) return ne; var ie = this.units[0].power, me = Math.log(L / Math.pow(ne.value * H, ie)) / Math.LN10 - 1.2; if (me > -2.200001 && me < 1.800001) return ne; me = Math.abs(me); var pe = this.units[0].unit.prefixes; for (var xe in pe) if (Fe(pe, xe)) { var De = pe[xe]; if (De.scientific) { var k = Math.abs(Math.log(L / Math.pow(De.value * H, ie)) / Math.LN10 - 1.2); (k < me || k === me && De.name.length < ne.name.length) && (ne = De, me = k); } } return ne; }, h.prototype.splitUnit = function(L) { for (var H = this.clone(), ne = [], ie = 0; ie < L.length && (H = H.to(L[ie]), ie !== L.length - 1); ie++) { var me = H.toNumeric(), pe = c(me), xe = void 0, De = f(pe, me); De ? xe = pe : xe = s(H.toNumeric()); var k = new h(xe, L[ie].toString()); ne.push(k), H = a(H, k); } for (var J = 0, G = 0; G < ne.length; G++) J = n(J, ne[G].value); return f(J, this.value) && (H.value = 0), ne.push(H), ne; }; var _ = { NONE: { "": { name: "", value: 1, scientific: !0 } }, SHORT: { "": { name: "", value: 1, scientific: !0 }, da: { name: "da", value: 10, scientific: !1 }, h: { name: "h", value: 100, scientific: !1 }, k: { name: "k", value: 1e3, scientific: !0 }, M: { name: "M", value: 1e6, scientific: !0 }, G: { name: "G", value: 1e9, scientific: !0 }, T: { name: "T", value: 1e12, scientific: !0 }, P: { name: "P", value: 1e15, scientific: !0 }, E: { name: "E", value: 1e18, scientific: !0 }, Z: { name: "Z", value: 1e21, scientific: !0 }, Y: { name: "Y", value: 1e24, scientific: !0 }, R: { name: "R", value: 1e27, scientific: !0 }, Q: { name: "Q", value: 1e30, scientific: !0 }, d: { name: "d", value: 0.1, scientific: !1 }, c: { name: "c", value: 0.01, scientific: !1 }, m: { name: "m", value: 1e-3, scientific: !0 }, u: { name: "u", value: 1e-6, scientific: !0 }, n: { name: "n", value: 1e-9, scientific: !0 }, p: { name: "p", value: 1e-12, scientific: !0 }, f: { name: "f", value: 1e-15, scientific: !0 }, a: { name: "a", value: 1e-18, scientific: !0 }, z: { name: "z", value: 1e-21, scientific: !0 }, y: { name: "y", value: 1e-24, scientific: !0 }, r: { name: "r", value: 1e-27, scientific: !0 }, q: { name: "q", value: 1e-30, scientific: !0 } }, LONG: { "": { name: "", value: 1, scientific: !0 }, deca: { name: "deca", value: 10, scientific: !1 }, hecto: { name: "hecto", value: 100, scientific: !1 }, kilo: { name: "kilo", value: 1e3, scientific: !0 }, mega: { name: "mega", value: 1e6, scientific: !0 }, giga: { name: "giga", value: 1e9, scientific: !0 }, tera: { name: "tera", value: 1e12, scientific: !0 }, peta: { name: "peta", value: 1e15, scientific: !0 }, exa: { name: "exa", value: 1e18, scientific: !0 }, zetta: { name: "zetta", value: 1e21, scientific: !0 }, yotta: { name: "yotta", value: 1e24, scientific: !0 }, ronna: { name: "ronna", value: 1e27, scientific: !0 }, quetta: { name: "quetta", value: 1e30, scientific: !0 }, deci: { name: "deci", value: 0.1, scientific: !1 }, centi: { name: "centi", value: 0.01, scientific: !1 }, milli: { name: "milli", value: 1e-3, scientific: !0 }, micro: { name: "micro", value: 1e-6, scientific: !0 }, nano: { name: "nano", value: 1e-9, scientific: !0 }, pico: { name: "pico", value: 1e-12, scientific: !0 }, femto: { name: "femto", value: 1e-15, scientific: !0 }, atto: { name: "atto", value: 1e-18, scientific: !0 }, zepto: { name: "zepto", value: 1e-21, scientific: !0 }, yocto: { name: "yocto", value: 1e-24, scientific: !0 }, ronto: { name: "ronto", value: 1e-27, scientific: !0 }, quecto: { name: "quecto", value: 1e-30, scientific: !0 } }, SQUARED: { "": { name: "", value: 1, scientific: !0 }, da: { name: "da", value: 100, scientific: !1 }, h: { name: "h", value: 1e4, scientific: !1 }, k: { name: "k", value: 1e6, scientific: !0 }, M: { name: "M", value: 1e12, scientific: !0 }, G: { name: "G", value: 1e18, scientific: !0 }, T: { name: "T", value: 1e24, scientific: !0 }, P: { name: "P", value: 1e30, scientific: !0 }, E: { name: "E", value: 1e36, scientific: !0 }, Z: { name: "Z", value: 1e42, scientific: !0 }, Y: { name: "Y", value: 1e48, scientific: !0 }, R: { name: "R", value: 1e54, scientific: !0 }, Q: { name: "Q", value: 1e60, scientific: !0 }, d: { name: "d", value: 0.01, scientific: !1 }, c: { name: "c", value: 1e-4, scientific: !1 }, m: { name: "m", value: 1e-6, scientific: !0 }, u: { name: "u", value: 1e-12, scientific: !0 }, n: { name: "n", value: 1e-18, scientific: !0 }, p: { name: "p", value: 1e-24, scientific: !0 }, f: { name: "f", value: 1e-30, scientific: !0 }, a: { name: "a", value: 1e-36, scientific: !0 }, z: { name: "z", value: 1e-42, scientific: !0 }, y: { name: "y", value: 1e-48, scientific: !0 }, r: { name: "r", value: 1e-54, scientific: !0 }, q: { name: "q", value: 1e-60, scientific: !0 } }, CUBIC: { "": { name: "", value: 1, scientific: !0 }, da: { name: "da", value: 1e3, scientific: !1 }, h: { name: "h", value: 1e6, scientific: !1 }, k: { name: "k", value: 1e9, scientific: !0 }, M: { name: "M", value: 1e18, scientific: !0 }, G: { name: "G", value: 1e27, scientific: !0 }, T: { name: "T", value: 1e36, scientific: !0 }, P: { name: "P", value: 1e45, scientific: !0 }, E: { name: "E", value: 1e54, scientific: !0 }, Z: { name: "Z", value: 1e63, scientific: !0 }, Y: { name: "Y", value: 1e72, scientific: !0 }, R: { name: "R", value: 1e81, scientific: !0 }, Q: { name: "Q", value: 1e90, scientific: !0 }, d: { name: "d", value: 1e-3, scientific: !1 }, c: { name: "c", value: 1e-6, scientific: !1 }, m: { name: "m", value: 1e-9, scientific: !0 }, u: { name: "u", value: 1e-18, scientific: !0 }, n: { name: "n", value: 1e-27, scientific: !0 }, p: { name: "p", value: 1e-36, scientific: !0 }, f: { name: "f", value: 1e-45, scientific: !0 }, a: { name: "a", value: 1e-54, scientific: !0 }, z: { name: "z", value: 1e-63, scientific: !0 }, y: { name: "y", value: 1e-72, scientific: !0 }, r: { name: "r", value: 1e-81, scientific: !0 }, q: { name: "q", value: 1e-90, scientific: !0 } }, BINARY_SHORT_SI: { "": { name: "", value: 1, scientific: !0 }, k: { name: "k", value: 1e3, scientific: !0 }, M: { name: "M", value: 1e6, scientific: !0 }, G: { name: "G", value: 1e9, scientific: !0 }, T: { name: "T", value: 1e12, scientific: !0 }, P: { name: "P", value: 1e15, scientific: !0 }, E: { name: "E", value: 1e18, scientific: !0 }, Z: { name: "Z", value: 1e21, scientific: !0 }, Y: { name: "Y", value: 1e24, scientific: !0 } }, BINARY_SHORT_IEC: { "": { name: "", value: 1, scientific: !0 }, Ki: { name: "Ki", value: 1024, scientific: !0 }, Mi: { name: "Mi", value: Math.pow(1024, 2), scientific: !0 }, Gi: { name: "Gi", value: Math.pow(1024, 3), scientific: !0 }, Ti: { name: "Ti", value: Math.pow(1024, 4), scientific: !0 }, Pi: { name: "Pi", value: Math.pow(1024, 5), scientific: !0 }, Ei: { name: "Ei", value: Math.pow(1024, 6), scientific: !0 }, Zi: { name: "Zi", value: Math.pow(1024, 7), scientific: !0 }, Yi: { name: "Yi", value: Math.pow(1024, 8), scientific: !0 } }, BINARY_LONG_SI: { "": { name: "", value: 1, scientific: !0 }, kilo: { name: "kilo", value: 1e3, scientific: !0 }, mega: { name: "mega", value: 1e6, scientific: !0 }, giga: { name: "giga", value: 1e9, scientific: !0 }, tera: { name: "tera", value: 1e12, scientific: !0 }, peta: { name: "peta", value: 1e15, scientific: !0 }, exa: { name: "exa", value: 1e18, scientific: !0 }, zetta: { name: "zetta", value: 1e21, scientific: !0 }, yotta: { name: "yotta", value: 1e24, scientific: !0 } }, BINARY_LONG_IEC: { "": { name: "", value: 1, scientific: !0 }, kibi: { name: "kibi", value: 1024, scientific: !0 }, mebi: { name: "mebi", value: Math.pow(1024, 2), scientific: !0 }, gibi: { name: "gibi", value: Math.pow(1024, 3), scientific: !0 }, tebi: { name: "tebi", value: Math.pow(1024, 4), scientific: !0 }, pebi: { name: "pebi", value: Math.pow(1024, 5), scientific: !0 }, exi: { name: "exi", value: Math.pow(1024, 6), scientific: !0 }, zebi: { name: "zebi", value: Math.pow(1024, 7), scientific: !0 }, yobi: { name: "yobi", value: Math.pow(1024, 8), scientific: !0 } }, BTU: { "": { name: "", value: 1, scientific: !0 }, MM: { name: "MM", value: 1e6, scientific: !0 } } }; _.SHORTLONG = jr({}, _.SHORT, _.LONG), _.BINARY_SHORT = jr({}, _.BINARY_SHORT_SI, _.BINARY_SHORT_IEC), _.BINARY_LONG = jr({}, _.BINARY_LONG_SI, _.BINARY_LONG_IEC); var z = ["MASS", "LENGTH", "TIME", "CURRENT", "TEMPERATURE", "LUMINOUS_INTENSITY", "AMOUNT_OF_SUBSTANCE", "ANGLE", "BIT"], O = { NONE: { dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 0] }, MASS: { dimensions: [1, 0, 0, 0, 0, 0, 0, 0, 0] }, LENGTH: { dimensions: [0, 1, 0, 0, 0, 0, 0, 0, 0] }, TIME: { dimensions: [0, 0, 1, 0, 0, 0, 0, 0, 0] }, CURRENT: { dimensions: [0, 0, 0, 1, 0, 0, 0, 0, 0] }, TEMPERATURE: { dimensions: [0, 0, 0, 0, 1, 0, 0, 0, 0] }, LUMINOUS_INTENSITY: { dimensions: [0, 0, 0, 0, 0, 1, 0, 0, 0] }, AMOUNT_OF_SUBSTANCE: { dimensions: [0, 0, 0, 0, 0, 0, 1, 0, 0] }, FORCE: { dimensions: [1, 1, -2, 0, 0, 0, 0, 0, 0] }, SURFACE: { dimensions: [0, 2, 0, 0, 0, 0, 0, 0, 0] }, VOLUME: { dimensions: [0, 3, 0, 0, 0, 0, 0, 0, 0] }, ENERGY: { dimensions: [1, 2, -2, 0, 0, 0, 0, 0, 0] }, POWER: { dimensions: [1, 2, -3, 0, 0, 0, 0, 0, 0] }, PRESSURE: { dimensions: [1, -1, -2, 0, 0, 0, 0, 0, 0] }, ELECTRIC_CHARGE: { dimensions: [0, 0, 1, 1, 0, 0, 0, 0, 0] }, ELECTRIC_CAPACITANCE: { dimensions: [-1, -2, 4, 2, 0, 0, 0, 0, 0] }, ELECTRIC_POTENTIAL: { dimensions: [1, 2, -3, -1, 0, 0, 0, 0, 0] }, ELECTRIC_RESISTANCE: { dimensions: [1, 2, -3, -2, 0, 0, 0, 0, 0] }, ELECTRIC_INDUCTANCE: { dimensions: [1, 2, -2, -2, 0, 0, 0, 0, 0] }, ELECTRIC_CONDUCTANCE: { dimensions: [-1, -2, 3, 2, 0, 0, 0, 0, 0] }, MAGNETIC_FLUX: { dimensions: [1, 2, -2, -1, 0, 0, 0, 0, 0] }, MAGNETIC_FLUX_DENSITY: { dimensions: [1, 0, -2, -1, 0, 0, 0, 0, 0] }, FREQUENCY: { dimensions: [0, 0, -1, 0, 0, 0, 0, 0, 0] }, ANGLE: { dimensions: [0, 0, 0, 0, 0, 0, 0, 1, 0] }, BIT: { dimensions: [0, 0, 0, 0, 0, 0, 0, 0, 1] } }; for (var W in O) Fe(O, W) && (O[W].key = W); var X = {}, V = { name: "", base: X, value: 1, offset: 0, dimensions: z.map((L) => 0) }, R = { // length meter: { name: "meter", base: O.LENGTH, prefixes: _.LONG, value: 1, offset: 0 }, inch: { name: "inch", base: O.LENGTH, prefixes: _.NONE, value: 0.0254, offset: 0 }, foot: { name: "foot", base: O.LENGTH, prefixes: _.NONE, value: 0.3048, offset: 0 }, yard: { name: "yard", base: O.LENGTH, prefixes: _.NONE, value: 0.9144, offset: 0 }, mile: { name: "mile", base: O.LENGTH, prefixes: _.NONE, value: 1609.344, offset: 0 }, link: { name: "link", base: O.LENGTH, prefixes: _.NONE, value: 0.201168, offset: 0 }, rod: { name: "rod", base: O.LENGTH, prefixes: _.NONE, value: 5.0292, offset: 0 }, chain: { name: "chain", base: O.LENGTH, prefixes: _.NONE, value: 20.1168, offset: 0 }, angstrom: { name: "angstrom", base: O.LENGTH, prefixes: _.NONE, value: 1e-10, offset: 0 }, m: { name: "m", base: O.LENGTH, prefixes: _.SHORT, value: 1, offset: 0 }, in: { name: "in", base: O.LENGTH, prefixes: _.NONE, value: 0.0254, offset: 0 }, ft: { name: "ft", base: O.LENGTH, prefixes: _.NONE, value: 0.3048, offset: 0 }, yd: { name: "yd", base: O.LENGTH, prefixes: _.NONE, value: 0.9144, offset: 0 }, mi: { name: "mi", base: O.LENGTH, prefixes: _.NONE, value: 1609.344, offset: 0 }, li: { name: "li", base: O.LENGTH, prefixes: _.NONE, value: 0.201168, offset: 0 }, rd: { name: "rd", base: O.LENGTH, prefixes: _.NONE, value: 5.02921, offset: 0 }, ch: { name: "ch", base: O.LENGTH, prefixes: _.NONE, value: 20.1168, offset: 0 }, mil: { name: "mil", base: O.LENGTH, prefixes: _.NONE, value: 254e-7, offset: 0 }, // 1/1000 inch // Surface m2: { name: "m2", base: O.SURFACE, prefixes: _.SQUARED, value: 1, offset: 0 }, sqin: { name: "sqin", base: O.SURFACE, prefixes: _.NONE, value: 64516e-8, offset: 0 }, // 645.16 mm2 sqft: { name: "sqft", base: O.SURFACE, prefixes: _.NONE, value: 0.09290304, offset: 0 }, // 0.09290304 m2 sqyd: { name: "sqyd", base: O.SURFACE, prefixes: _.NONE, value: 0.83612736, offset: 0 }, // 0.83612736 m2 sqmi: { name: "sqmi", base: O.SURFACE, prefixes: _.NONE, value: 2589988110336e-6, offset: 0 }, // 2.589988110336 km2 sqrd: { name: "sqrd", base: O.SURFACE, prefixes: _.NONE, value: 25.29295, offset: 0 }, // 25.29295 m2 sqch: { name: "sqch", base: O.SURFACE, prefixes: _.NONE, value: 404.6873, offset: 0 }, // 404.6873 m2 sqmil: { name: "sqmil", base: O.SURFACE, prefixes: _.NONE, value: 64516e-14, offset: 0 }, // 6.4516 * 10^-10 m2 acre: { name: "acre", base: O.SURFACE, prefixes: _.NONE, value: 4046.86, offset: 0 }, // 4046.86 m2 hectare: { name: "hectare", base: O.SURFACE, prefixes: _.NONE, value: 1e4, offset: 0 }, // 10000 m2 // Volume m3: { name: "m3", base: O.VOLUME, prefixes: _.CUBIC, value: 1, offset: 0 }, L: { name: "L", base: O.VOLUME, prefixes: _.SHORT, value: 1e-3, offset: 0 }, // litre l: { name: "l", base: O.VOLUME, prefixes: _.SHORT, value: 1e-3, offset: 0 }, // litre litre: { name: "litre", base: O.VOLUME, prefixes: _.LONG, value: 1e-3, offset: 0 }, cuin: { name: "cuin", base: O.VOLUME, prefixes: _.NONE, value: 16387064e-12, offset: 0 }, // 1.6387064e-5 m3 cuft: { name: "cuft", base: O.VOLUME, prefixes: _.NONE, value: 0.028316846592, offset: 0 }, // 28.316 846 592 L cuyd: { name: "cuyd", base: O.VOLUME, prefixes: _.NONE, value: 0.764554857984, offset: 0 }, // 764.554 857 984 L teaspoon: { name: "teaspoon", base: O.VOLUME, prefixes: _.NONE, value: 5e-6, offset: 0 }, // 5 mL tablespoon: { name: "tablespoon", base: O.VOLUME, prefixes: _.NONE, value: 15e-6, offset: 0 }, // 15 mL // {name: 'cup', base: BASE_UNITS.VOLUME, prefixes: PREFIXES.NONE, value: 0.000240, offset: 0}, // 240 mL // not possible, we have already another cup drop: { name: "drop", base: O.VOLUME, prefixes: _.NONE, value: 5e-8, offset: 0 }, // 0.05 mL = 5e-8 m3 gtt: { name: "gtt", base: O.VOLUME, prefixes: _.NONE, value: 5e-8, offset: 0 }, // 0.05 mL = 5e-8 m3 // Liquid volume minim: { name: "minim", base: O.VOLUME, prefixes: _.NONE, value: 61611519921875e-21, offset: 0 }, // 1/61440 gallons fluiddram: { name: "fluiddram", base: O.VOLUME, prefixes: _.NONE, value: 36966911953125e-19, offset: 0 }, // 1/1024 gallons fluidounce: { name: "fluidounce", base: O.VOLUME, prefixes: _.NONE, value: 295735295625e-16, offset: 0 }, // 1/128 gallons gill: { name: "gill", base: O.VOLUME, prefixes: _.NONE, value: 11829411825e-14, offset: 0 }, // 1/32 gallons cc: { name: "cc", base: O.VOLUME, prefixes: _.NONE, value: 1e-6, offset: 0 }, // 1e-6 L cup: { name: "cup", base: O.VOLUME, prefixes: _.NONE, value: 2365882365e-13, offset: 0 }, // 1/16 gallons pint: { name: "pint", base: O.VOLUME, prefixes: _.NONE, value: 473176473e-12, offset: 0 }, // 1/8 gallons quart: { name: "quart", base: O.VOLUME, prefixes: _.NONE, value: 946352946e-12, offset: 0 }, // 1/4 gallons gallon: { name: "gallon", base: O.VOLUME, prefixes: _.NONE, value: 0.003785411784, offset: 0 }, // 3.785411784 L beerbarrel: { name: "beerbarrel", base: O.VOLUME, prefixes: _.NONE, value: 0.117347765304, offset: 0 }, // 31 gallons oilbarrel: { name: "oilbarrel", base: O.VOLUME, prefixes: _.NONE, value: 0.158987294928, offset: 0 }, // 42 gallons hogshead: { name: "hogshead", base: O.VOLUME, prefixes: _.NONE, value: 0.238480942392, offset: 0 }, // 63 gallons // Mass g: { name: "g", base: O.MASS, prefixes: _.SHORT, value: 1e-3, offset: 0 }, gram: { name: "gram", base: O.MASS, prefixes: _.LONG, value: 1e-3, offset: 0 }, ton: { name: "ton", base: O.MASS, prefixes: _.SHORT, value: 907.18474, offset: 0 }, t: { name: "t", base: O.MASS, prefixes: _.SHORT, value: 1e3, offset: 0 }, tonne: { name: "tonne", base: O.MASS, prefixes: _.LONG, value: 1e3, offset: 0 }, grain: { name: "grain", base: O.MASS, prefixes: _.NONE, value: 6479891e-11, offset: 0 }, dram: { name: "dram", base: O.MASS, prefixes: _.NONE, value: 0.0017718451953125, offset: 0 }, ounce: { name: "ounce", base: O.MASS, prefixes: _.NONE, value: 0.028349523125, offset: 0 }, poundmass: { name: "poundmass", base: O.MASS, prefixes: _.NONE, value: 0.45359237, offset: 0 }, hundredweight: { name: "hundredweight", base: O.MASS, prefixes: _.NONE, value: 45.359237, offset: 0 }, stick: { name: "stick", base: O.MASS, prefixes: _.NONE, value: 0.115, offset: 0 }, stone: { name: "stone", base: O.MASS, prefixes: _.NONE, value: 6.35029318, offset: 0 }, gr: { name: "gr", base: O.MASS, prefixes: _.NONE, value: 6479891e-11, offset: 0 }, dr: { name: "dr", base: O.MASS, prefixes: _.NONE, value: 0.0017718451953125, offset: 0 }, oz: { name: "oz", base: O.MASS, prefixes: _.NONE, value: 0.028349523125, offset: 0 }, lbm: { name: "lbm", base: O.MASS, prefixes: _.NONE, value: 0.45359237, offset: 0 }, cwt: { name: "cwt", base: O.MASS, prefixes: _.NONE, value: 45.359237, offset: 0 }, // Time s: { name: "s", base: O.TIME, prefixes: _.SHORT, value: 1, offset: 0 }, min: { name: "min", base: O.TIME, prefixes: _.NONE, value: 60, offset: 0 }, h: { name: "h", base: O.TIME, prefixes: _.NONE, value: 3600, offset: 0 }, second: { name: "second", base: O.TIME, prefixes: _.LONG, value: 1, offset: 0 }, sec: { name: "sec", base: O.TIME, prefixes: _.LONG, value: 1, offset: 0 }, minute: { name: "minute", base: O.TIME, prefixes: _.NONE, value: 60, offset: 0 }, hour: { name: "hour", base: O.TIME, prefixes: _.NONE, value: 3600, offset: 0 }, day: { name: "day", base: O.TIME, prefixes: _.NONE, value: 86400, offset: 0 }, week: { name: "week", base: O.TIME, prefixes: _.NONE, value: 7 * 86400, offset: 0 }, month: { name: "month", base: O.TIME, prefixes: _.NONE, value: 2629800, // 1/12th of Julian year offset: 0 }, year: { name: "year", base: O.TIME, prefixes: _.NONE, value: 31557600, // Julian year offset: 0 }, decade: { name: "decade", base: O.TIME, prefixes: _.NONE, value: 315576e3, // Julian decade offset: 0 }, century: { name: "century", base: O.TIME, prefixes: _.NONE, value: 315576e4, // Julian century offset: 0 }, millennium: { name: "millennium", base: O.TIME, prefixes: _.NONE, value: 315576e5, // Julian millennium offset: 0 }, // Frequency hertz: { name: "Hertz", base: O.FREQUENCY, prefixes: _.LONG, value: 1, offset: 0, reciprocal: !0 }, Hz: { name: "Hz", base: O.FREQUENCY, prefixes: _.SHORT, value: 1, offset: 0, reciprocal: !0 }, // Angle rad: { name: "rad", base: O.ANGLE, prefixes: _.SHORT, value: 1, offset: 0 }, radian: { name: "radian", base: O.ANGLE, prefixes: _.LONG, value: 1, offset: 0 }, // deg = rad / (2*pi) * 360 = rad / 0.017453292519943295769236907684888 deg: { name: "deg", base: O.ANGLE, prefixes: _.SHORT, value: null, // will be filled in by calculateAngleValues() offset: 0 }, degree: { name: "degree", base: O.ANGLE, prefixes: _.LONG, value: null, // will be filled in by calculateAngleValues() offset: 0 }, // grad = rad / (2*pi) * 400 = rad / 0.015707963267948966192313216916399 grad: { name: "grad", base: O.ANGLE, prefixes: _.SHORT, value: null, // will be filled in by calculateAngleValues() offset: 0 }, gradian: { name: "gradian", base: O.ANGLE, prefixes: _.LONG, value: null, // will be filled in by calculateAngleValues() offset: 0 }, // cycle = rad / (2*pi) = rad / 6.2831853071795864769252867665793 cycle: { name: "cycle", base: O.ANGLE, prefixes: _.NONE, value: null, // will be filled in by calculateAngleValues() offset: 0 }, // arcsec = rad / (3600 * (360 / 2 * pi)) = rad / 0.0000048481368110953599358991410235795 arcsec: { name: "arcsec", base: O.ANGLE, prefixes: _.NONE, value: null, // will be filled in by calculateAngleValues() offset: 0 }, // arcmin = rad / (60 * (360 / 2 * pi)) = rad / 0.00029088820866572159615394846141477 arcmin: { name: "arcmin", base: O.ANGLE, prefixes: _.NONE, value: null, // will be filled in by calculateAngleValues() offset: 0 }, // Electric current A: { name: "A", base: O.CURRENT, prefixes: _.SHORT, value: 1, offset: 0 }, ampere: { name: "ampere", base: O.CURRENT, prefixes: _.LONG, value: 1, offset: 0 }, // Temperature // K(C) = °C + 273.15 // K(F) = (°F + 459.67) * (5 / 9) // K(R) = °R * (5 / 9) K: { name: "K", base: O.TEMPERATURE, prefixes: _.SHORT, value: 1, offset: 0 }, degC: { name: "degC", base: O.TEMPERATURE, prefixes: _.SHORT, value: 1, offset: 273.15 }, degF: { name: "degF", base: O.TEMPERATURE, prefixes: _.SHORT, value: new y(5, 9), offset: 459.67 }, degR: { name: "degR", base: O.TEMPERATURE, prefixes: _.SHORT, value: new y(5, 9), offset: 0 }, kelvin: { name: "kelvin", base: O.TEMPERATURE, prefixes: _.LONG, value: 1, offset: 0 }, celsius: { name: "celsius", base: O.TEMPERATURE, prefixes: _.LONG, value: 1, offset: 273.15 }, fahrenheit: { name: "fahrenheit", base: O.TEMPERATURE, prefixes: _.LONG, value: new y(5, 9), offset: 459.67 }, rankine: { name: "rankine", base: O.TEMPERATURE, prefixes: _.LONG, value: new y(5, 9), offset: 0 }, // amount of substance mol: { name: "mol", base: O.AMOUNT_OF_SUBSTANCE, prefixes: _.SHORT, value: 1, offset: 0 }, mole: { name: "mole", base: O.AMOUNT_OF_SUBSTANCE, prefixes: _.LONG, value: 1, offset: 0 }, // luminous intensity cd: { name: "cd", base: O.LUMINOUS_INTENSITY, prefixes: _.SHORT, value: 1, offset: 0 }, candela: { name: "candela", base: O.LUMINOUS_INTENSITY, prefixes: _.LONG, value: 1, offset: 0 }, // TODO: units STERADIAN // {name: 'sr', base: BASE_UNITS.STERADIAN, prefixes: PREFIXES.NONE, value: 1, offset: 0}, // {name: 'steradian', base: BASE_UNITS.STERADIAN, prefixes: PREFIXES.NONE, value: 1, offset: 0}, // Force N: { name: "N", base: O.FORCE, prefixes: _.SHORT, value: 1, offset: 0 }, newton: { name: "newton", base: O.FORCE, prefixes: _.LONG, value: 1, offset: 0 }, dyn: { name: "dyn", base: O.FORCE, prefixes: _.SHORT, value: 1e-5, offset: 0 }, dyne: { name: "dyne", base: O.FORCE, prefixes: _.LONG, value: 1e-5, offset: 0 }, lbf: { name: "lbf", base: O.FORCE, prefixes: _.NONE, value: 4.4482216152605, offset: 0 }, poundforce: { name: "poundforce", base: O.FORCE, prefixes: _.NONE, value: 4.4482216152605, offset: 0 }, kip: { name: "kip", base: O.FORCE, prefixes: _.LONG, value: 4448.2216, offset: 0 }, kilogramforce: { name: "kilogramforce", base: O.FORCE, prefixes: _.NONE, value: 9.80665, offset: 0 }, // Energy J: { name: "J", base: O.ENERGY, prefixes: _.SHORT, value: 1, offset: 0 }, joule: { name: "joule", base: O.ENERGY, prefixes: _.LONG, value: 1, offset: 0 }, erg: { name: "erg", base: O.ENERGY, prefixes: _.SHORTLONG, // Both kiloerg and kerg are acceptable value: 1e-7, offset: 0 }, Wh: { name: "Wh", base: O.ENERGY, prefixes: _.SHORT, value: 3600, offset: 0 }, BTU: { name: "BTU", base: O.ENERGY, prefixes: _.BTU, value: 1055.05585262, offset: 0 }, eV: { name: "eV", base: O.ENERGY, prefixes: _.SHORT, value: 1602176565e-28, offset: 0 }, electronvolt: { name: "electronvolt", base: O.ENERGY, prefixes: _.LONG, value: 1602176565e-28, offset: 0 }, // Power W: { name: "W", base: O.POWER, prefixes: _.SHORT, value: 1, offset: 0 }, watt: { name: "watt", base: O.POWER, prefixes: _.LONG, value: 1, offset: 0 }, hp: { name: "hp", base: O.POWER, prefixes: _.NONE, value: 745.6998715386, offset: 0 }, // Electrical power units VAR: { name: "VAR", base: O.POWER, prefixes: _.SHORT, value: v.I, offset: 0 }, VA: { name: "VA", base: O.POWER, prefixes: _.SHORT, value: 1, offset: 0 }, // Pressure Pa: { name: "Pa", base: O.PRESSURE, prefixes: _.SHORT, value: 1, offset: 0 }, psi: { name: "psi", base: O.PRESSURE, prefixes: _.NONE, value: 6894.75729276459, offset: 0 }, atm: { name: "atm", base: O.PRESSURE, prefixes: _.NONE, value: 101325, offset: 0 }, bar: { name: "bar", base: O.PRESSURE, prefixes: _.SHORTLONG, value: 1e5, offset: 0 }, torr: { name: "torr", base: O.PRESSURE, prefixes: _.NONE, value: 133.322, offset: 0 }, mmHg: { name: "mmHg", base: O.PRESSURE, prefixes: _.NONE, value: 133.322, offset: 0 }, mmH2O: { name: "mmH2O", base: O.PRESSURE, prefixes: _.NONE, value: 9.80665, offset: 0 }, cmH2O: { name: "cmH2O", base: O.PRESSURE, prefixes: _.NONE, value: 98.0665, offset: 0 }, // Electric charge coulomb: { name: "coulomb", base: O.ELECTRIC_CHARGE, prefixes: _.LONG, value: 1, offset: 0 }, C: { name: "C", base: O.ELECTRIC_CHARGE, prefixes: _.SHORT, value: 1, offset: 0 }, // Electric capacitance farad: { name: "farad", base: O.ELECTRIC_CAPACITANCE, prefixes: _.LONG, value: 1, offset: 0 }, F: { name: "F", base: O.ELECTRIC_CAPACITANCE, prefixes: _.SHORT, value: 1, offset: 0 }, // Electric potential volt: { name: "volt", base: O.ELECTRIC_POTENTIAL, prefixes: _.LONG, value: 1, offset: 0 }, V: { name: "V", base: O.ELECTRIC_POTENTIAL, prefixes: _.SHORT, value: 1, offset: 0 }, // Electric resistance ohm: { name: "ohm", base: O.ELECTRIC_RESISTANCE, prefixes: _.SHORTLONG, // Both Mohm and megaohm are acceptable value: 1, offset: 0 }, /* * Unicode breaks in browsers if charset is not specified Ω: { name: 'Ω', base: BASE_UNITS.ELECTRIC_RESISTANCE, prefixes: PREFIXES.SHORT, value: 1, offset: 0 }, */ // Electric inductance henry: { name: "henry", base: O.ELECTRIC_INDUCTANCE, prefixes: _.LONG, value: 1, offset: 0 }, H: { name: "H", base: O.ELECTRIC_INDUCTANCE, prefixes: _.SHORT, value: 1, offset: 0 }, // Electric conductance siemens: { name: "siemens", base: O.ELECTRIC_CONDUCTANCE, prefixes: _.LONG, value: 1, offset: 0 }, S: { name: "S", base: O.ELECTRIC_CONDUCTANCE, prefixes: _.SHORT, value: 1, offset: 0 }, // Magnetic flux weber: { name: "weber", base: O.MAGNETIC_FLUX, prefixes: _.LONG, value: 1, offset: 0 }, Wb: { name: "Wb", base: O.MAGNETIC_FLUX, prefixes: _.SHORT, value: 1, offset: 0 }, // Magnetic flux density tesla: { name: "tesla", base: O.MAGNETIC_FLUX_DENSITY, prefixes: _.LONG, value: 1, offset: 0 }, T: { name: "T", base: O.MAGNETIC_FLUX_DENSITY, prefixes: _.SHORT, value: 1, offset: 0 }, // Binary b: { name: "b", base: O.BIT, prefixes: _.BINARY_SHORT, value: 1, offset: 0 }, bits: { name: "bits", base: O.BIT, prefixes: _.BINARY_LONG, value: 1, offset: 0 }, B: { name: "B", base: O.BIT, prefixes: _.BINARY_SHORT, value: 8, offset: 0 }, bytes: { name: "bytes", base: O.BIT, prefixes: _.BINARY_LONG, value: 8, offset: 0 } }, Q = { meters: "meter", inches: "inch", feet: "foot", yards: "yard", miles: "mile", links: "link", rods: "rod", chains: "chain", angstroms: "angstrom", lt: "l", litres: "litre", liter: "litre", liters: "litre", teaspoons: "teaspoon", tablespoons: "tablespoon", minims: "minim", fldr: "fluiddram", fluiddrams: "fluiddram", floz: "fluidounce", fluidounces: "fluidounce", gi: "gill", gills: "gill", cp: "cup", cups: "cup", pt: "pint", pints: "pint", qt: "quart", quarts: "quart", gal: "gallon", gallons: "gallon", bbl: "beerbarrel", beerbarrels: "beerbarrel", obl: "oilbarrel", oilbarrels: "oilbarrel", hogsheads: "hogshead", gtts: "gtt", grams: "gram", tons: "ton", tonnes: "tonne", grains: "grain", drams: "dram", ounces: "ounce", poundmasses: "poundmass", hundredweights: "hundredweight", sticks: "stick", lb: "lbm", lbs: "lbm", kips: "kip", kgf: "kilogramforce", acres: "acre", hectares: "hectare", sqfeet: "sqft", sqyard: "sqyd", sqmile: "sqmi", sqmiles: "sqmi", mmhg: "mmHg", mmh2o: "mmH2O", cmh2o: "cmH2O", seconds: "second", secs: "second", minutes: "minute", mins: "minute", hours: "hour", hr: "hour", hrs: "hour", days: "day", weeks: "week", months: "month", years: "year", decades: "decade", centuries: "century", millennia: "millennium", hertz: "hertz", radians: "radian", degrees: "degree", gradians: "gradian", cycles: "cycle", arcsecond: "arcsec", arcseconds: "arcsec", arcminute: "arcmin", arcminutes: "arcmin", BTUs: "BTU", watts: "watt", joules: "joule", amperes: "ampere", amps: "ampere", amp: "ampere", coulombs: "coulomb", volts: "volt", ohms: "ohm", farads: "farad", webers: "weber", teslas: "tesla", electronvolts: "electronvolt", moles: "mole", bit: "bits", byte: "bytes" }; function se(L) { if (L.number === "BigNumber") { var H = Ql(b); R.rad.value = new b(1), R.deg.value = H.div(180), R.grad.value = H.div(200), R.cycle.value = H.times(2), R.arcsec.value = H.div(648e3), R.arcmin.value = H.div(10800); } else R.rad.value = 1, R.deg.value = Math.PI / 180, R.grad.value = Math.PI / 200, R.cycle.value = Math.PI * 2, R.arcsec.value = Math.PI / 648e3, R.arcmin.value = Math.PI / 10800; R.radian.value = R.rad.value, R.degree.value = R.deg.value, R.gradian.value = R.grad.value; } se(t), r && r("config", function(L, H) { L.number !== H.number && se(L); }); var re = { si: { // Base units NONE: { unit: V, prefix: _.NONE[""] }, LENGTH: { unit: R.m, prefix: _.SHORT[""] }, MASS: { unit: R.g, prefix: _.SHORT.k }, TIME: { unit: R.s, prefix: _.SHORT[""] }, CURRENT: { unit: R.A, prefix: _.SHORT[""] }, TEMPERATURE: { unit: R.K, prefix: _.SHORT[""] }, LUMINOUS_INTENSITY: { unit: R.cd, prefix: _.SHORT[""] }, AMOUNT_OF_SUBSTANCE: { unit: R.mol, prefix: _.SHORT[""] }, ANGLE: { unit: R.rad, prefix: _.SHORT[""] }, BIT: { unit: R.bits, prefix: _.SHORT[""] }, // Derived units FORCE: { unit: R.N, prefix: _.SHORT[""] }, ENERGY: { unit: R.J, prefix: _.SHORT[""] }, POWER: { unit: R.W, prefix: _.SHORT[""] }, PRESSURE: { unit: R.Pa, prefix: _.SHORT[""] }, ELECTRIC_CHARGE: { unit: R.C, prefix: _.SHORT[""] }, ELECTRIC_CAPACITANCE: { unit: R.F, prefix: _.SHORT[""] }, ELECTRIC_POTENTIAL: { unit: R.V, prefix: _.SHORT[""] }, ELECTRIC_RESISTANCE: { unit: R.ohm, prefix: _.SHORT[""] }, ELECTRIC_INDUCTANCE: { unit: R.H, prefix: _.SHORT[""] }, ELECTRIC_CONDUCTANCE: { unit: R.S, prefix: _.SHORT[""] }, MAGNETIC_FLUX: { unit: R.Wb, prefix: _.SHORT[""] }, MAGNETIC_FLUX_DENSITY: { unit: R.T, prefix: _.SHORT[""] }, FREQUENCY: { unit: R.Hz, prefix: _.SHORT[""] } } }; re.cgs = JSON.parse(JSON.stringify(re.si)), re.cgs.LENGTH = { unit: R.m, prefix: _.SHORT.c }, re.cgs.MASS = { unit: R.g, prefix: _.SHORT[""] }, re.cgs.FORCE = { unit: R.dyn, prefix: _.SHORT[""] }, re.cgs.ENERGY = { unit: R.erg, prefix: _.NONE[""] }, re.us = JSON.parse(JSON.stringify(re.si)), re.us.LENGTH = { unit: R.ft, prefix: _.NONE[""] }, re.us.MASS = { unit: R.lbm, prefix: _.NONE[""] }, re.us.TEMPERATURE = { unit: R.degF, prefix: _.NONE[""] }, re.us.FORCE = { unit: R.lbf, prefix: _.NONE[""] }, re.us.ENERGY = { unit: R.BTU, prefix: _.BTU[""] }, re.us.POWER = { unit: R.hp, prefix: _.NONE[""] }, re.us.PRESSURE = { unit: R.psi, prefix: _.NONE[""] }, re.auto = JSON.parse(JSON.stringify(re.si)); var q = re.auto; h.setUnitSystem = function(L) { if (Fe(re, L)) q = re[L]; else throw new Error("Unit system " + L + " does not exist. Choices are: " + Object.keys(re).join(", ")); }, h.getUnitSystem = function() { for (var L in re) if (Fe(re, L) && re[L] === q) return L; }, h.typeConverters = { BigNumber: function(H) { return H != null && H.isFraction ? new b(H.n).div(H.d).times(H.s) : new b(H + ""); }, Fraction: function(H) { return new y(H); }, Complex: function(H) { return H; }, number: function(H) { return H != null && H.isFraction ? m(H) : H; } }, h.prototype._numberConverter = function() { var L = h.typeConverters[this.valueType()]; if (L) return L; throw new TypeError('Unsupported Unit value type "' + this.valueType() + '"'); }, h._getNumberConverter = function(L) { if (!h.typeConverters[L]) throw new TypeError('Unsupported type "' + L + '"'); return h.typeConverters[L]; }; for (var Z in R) if (Fe(R, Z)) { var K = R[Z]; K.dimensions = K.base.dimensions; } for (var j in Q) if (Fe(Q, j)) { var ee = R[Q[j]], te = {}; for (var oe in ee) Fe(ee, oe) && (te[oe] = ee[oe]); te.name = j, R[j] = te; } h.isValidAlpha = function(H) { return /^[a-zA-Z]$/.test(H); }; function ge(L) { for (var H = 0; H < L.length; H++) { if (g = L.charAt(H), H === 0 && !h.isValidAlpha(g)) throw new Error('Invalid unit name (must begin with alpha character): "' + L + '"'); if (H > 0 && !(h.isValidAlpha(g) || N(g))) throw new Error('Invalid unit name (only alphanumeric characters are allowed): "' + L + '"'); } } return h.createUnit = function(L, H) { if (typeof L != "object") throw new TypeError("createUnit expects first parameter to be of type 'Object'"); if (H && H.override) { for (var ne in L) if (Fe(L, ne) && h.deleteUnit(ne), L[ne].aliases) for (var ie = 0; ie < L[ne].aliases.length; ie++) h.deleteUnit(L[ne].aliases[ie]); } var me; for (var pe in L) Fe(L, pe) && (me = h.createUnitSingle(pe, L[pe])); return me; }, h.createUnitSingle = function(L, H) { if ((typeof H > "u" || H === null) && (H = {}), typeof L != "string") throw new TypeError("createUnitSingle expects first parameter to be of type 'string'"); if (Fe(R, L)) throw new Error('Cannot create unit "' + L + '": a unit with that name already exists'); ge(L); var ne = null, ie = [], me = 0, pe, xe, De; if (H && H.type === "Unit") ne = H.clone(); else if (typeof H == "string") H !== "" && (pe = H); else if (typeof H == "object") pe = H.definition, xe = H.prefixes, me = H.offset, De = H.baseName, H.aliases && (ie = H.aliases.valueOf()); else throw new TypeError('Cannot create unit "' + L + '" from "' + H.toString() + '": expecting "string" or "Unit" or "Object"'); if (ie) { for (var k = 0; k < ie.length; k++) if (Fe(R, ie[k])) throw new Error('Cannot create alias "' + ie[k] + '": a unit with that name already exists'); } if (pe && typeof pe == "string" && !ne) try { ne = h.parse(pe, { allowNoUnits: !0 }); } catch (T) { throw T.message = 'Could not create unit "' + L + '" from "' + pe + '": ' + T.message, T; } else pe && pe.type === "Unit" && (ne = pe.clone()); ie = ie || [], me = me || 0, xe && xe.toUpperCase ? xe = _[xe.toUpperCase()] || _.NONE : xe = _.NONE; var J = {}; if (ne) { J = { name: L, value: ne.value, dimensions: ne.dimensions.slice(0), prefixes: xe, offset: me }; var de = !1; for (var Ne in O) if (Fe(O, Ne)) { for (var we = !0, Ee = 0; Ee < z.length; Ee++) if (Math.abs((J.dimensions[Ee] || 0) - (O[Ne].dimensions[Ee] || 0)) > 1e-12) { we = !1; break; } if (we) { de = !0, J.base = O[Ne]; break; } } if (!de) { De = De || L + "_STUFF"; var Ae = { dimensions: ne.dimensions.slice(0) }; Ae.key = De, O[De] = Ae, q[De] = { unit: J, prefix: _.NONE[""] }, J.base = O[De]; } } else { if (De = De || L + "_STUFF", z.indexOf(De) >= 0) throw new Error('Cannot create new base unit "' + L + '": a base unit with that name already exists (and cannot be overridden)'); z.push(De); for (var G in O) Fe(O, G) && (O[G].dimensions[z.length - 1] = 0); for (var ae = { dimensions: [] }, fe = 0; fe < z.length; fe++) ae.dimensions[fe] = 0; ae.dimensions[z.length - 1] = 1, ae.key = De, O[De] = ae, J = { name: L, value: 1, dimensions: O[De].dimensions.slice(0), prefixes: xe, offset: me, base: O[De] }, q[De] = { unit: J, prefix: _.NONE[""] }; } h.UNITS[L] = J; for (var ar = 0; ar < ie.length; ar++) { var ir = ie[ar], Ue = {}; for (var xr in J) Fe(J, xr) && (Ue[xr] = J[xr]); Ue.name = ir, h.UNITS[ir] = Ue; } return delete B.cache, new h(null, L); }, h.deleteUnit = function(L) { delete h.UNITS[L], delete B.cache; }, h.PREFIXES = _, h.BASE_DIMENSIONS = z, h.BASE_UNITS = O, h.UNIT_SYSTEMS = re, h.UNITS = R, h; }, { isClass: !0 }), fm = "unit", a5 = ["typed", "Unit"], i5 = /* @__PURE__ */ P(fm, a5, (e) => { var { typed: r, Unit: t } = e; return r(fm, { Unit: function(a) { return a.clone(); }, string: function(a) { return t.isValuelessUnit(a) ? new t(null, a) : t.parse(a, { allowNoUnits: !0 }); }, "number | BigNumber | Fraction | Complex, string | Unit": function(a, i) { return new t(a, i); }, "number | BigNumber | Fraction": function(a) { return new t(a); }, "Array | Matrix": r.referToSelf((n) => (a) => je(a, n)) }); }), dm = "sparse", o5 = ["typed", "SparseMatrix"], s5 = /* @__PURE__ */ P(dm, o5, (e) => { var { typed: r, SparseMatrix: t } = e; return r(dm, { "": function() { return new t([]); }, string: function(a) { return new t([], a); }, "Array | Matrix": function(a) { return new t(a); }, "Array | Matrix, string": function(a, i) { return new t(a, i); } }); }), pm = "createUnit", u5 = ["typed", "Unit"], l5 = /* @__PURE__ */ P(pm, u5, (e) => { var { typed: r, Unit: t } = e; return r(pm, { // General function signature. First parameter is an object where each property is the definition of a new unit. The object keys are the unit names and the values are the definitions. The values can be objects, strings, or Units. If a property is an empty object or an empty string, a new base unit is created. The second parameter is the options. "Object, Object": function(a, i) { return t.createUnit(a, i); }, // Same as above but without the options. Object: function(a) { return t.createUnit(a, {}); }, // Shortcut method for creating one unit. "string, Unit | string | Object, Object": function(a, i, o) { var l = {}; return l[a] = i, t.createUnit(l, o); }, // Same as above but without the options. "string, Unit | string | Object": function(a, i) { var o = {}; return o[a] = i, t.createUnit(o, {}); }, // Without a definition, creates a base unit. string: function(a) { var i = {}; return i[a] = {}, t.createUnit(i, {}); } }); }), mm = "acos", c5 = ["typed", "config", "Complex"], f5 = /* @__PURE__ */ P(mm, c5, (e) => { var { typed: r, config: t, Complex: n } = e; return r(mm, { number: function(i) { return i >= -1 && i <= 1 || t.predictable ? Math.acos(i) : new n(i, 0).acos(); }, Complex: function(i) { return i.acos(); }, BigNumber: function(i) { return i.acos(); } }); }), vm = "acosh", d5 = ["typed", "config", "Complex"], p5 = /* @__PURE__ */ P(vm, d5, (e) => { var { typed: r, config: t, Complex: n } = e; return r(vm, { number: function(i) { return i >= 1 || t.predictable ? ry(i) : i <= -1 ? new n(Math.log(Math.sqrt(i * i - 1) - i), Math.PI) : new n(i, 0).acosh(); }, Complex: function(i) { return i.acosh(); }, BigNumber: function(i) { return i.acosh(); } }); }), hm = "acot", m5 = ["typed", "BigNumber"], v5 = /* @__PURE__ */ P(hm, m5, (e) => { var { typed: r, BigNumber: t } = e; return r(hm, { number: ty, Complex: function(a) { return a.acot(); }, BigNumber: function(a) { return new t(1).div(a).atan(); } }); }), gm = "acoth", h5 = ["typed", "config", "Complex", "BigNumber"], g5 = /* @__PURE__ */ P(gm, h5, (e) => { var { typed: r, config: t, Complex: n, BigNumber: a } = e; return r(gm, { number: function(o) { return o >= 1 || o <= -1 || t.predictable ? ny(o) : new n(o, 0).acoth(); }, Complex: function(o) { return o.acoth(); }, BigNumber: function(o) { return new a(1).div(o).atanh(); } }); }), ym = "acsc", y5 = ["typed", "config", "Complex", "BigNumber"], b5 = /* @__PURE__ */ P(ym, y5, (e) => { var { typed: r, config: t, Complex: n, BigNumber: a } = e; return r(ym, { number: function(o) { return o <= -1 || o >= 1 || t.predictable ? ay(o) : new n(o, 0).acsc(); }, Complex: function(o) { return o.acsc(); }, BigNumber: function(o) { return new a(1).div(o).asin(); } }); }), bm = "acsch", w5 = ["typed", "BigNumber"], x5 = /* @__PURE__ */ P(bm, w5, (e) => { var { typed: r, BigNumber: t } = e; return r(bm, { number: iy, Complex: function(a) { return a.acsch(); }, BigNumber: function(a) { return new t(1).div(a).asinh(); } }); }), wm = "asec", A5 = ["typed", "config", "Complex", "BigNumber"], N5 = /* @__PURE__ */ P(wm, A5, (e) => { var { typed: r, config: t, Complex: n, BigNumber: a } = e; return r(wm, { number: function(o) { return o <= -1 || o >= 1 || t.predictable ? oy(o) : new n(o, 0).asec(); }, Complex: function(o) { return o.asec(); }, BigNumber: function(o) { return new a(1).div(o).acos(); } }); }), xm = "asech", D5 = ["typed", "config", "Complex", "BigNumber"], E5 = /* @__PURE__ */ P(xm, D5, (e) => { var { typed: r, config: t, Complex: n, BigNumber: a } = e; return r(xm, { number: function(o) { if (o <= 1 && o >= -1 || t.predictable) { var l = 1 / o; if (l > 0 || t.predictable) return sy(o); var u = Math.sqrt(l * l - 1); return new n(Math.log(u - l), Math.PI); } return new n(o, 0).asech(); }, Complex: function(o) { return o.asech(); }, BigNumber: function(o) { return new a(1).div(o).acosh(); } }); }), Am = "asin", S5 = ["typed", "config", "Complex"], C5 = /* @__PURE__ */ P(Am, S5, (e) => { var { typed: r, config: t, Complex: n } = e; return r(Am, { number: function(i) { return i >= -1 && i <= 1 || t.predictable ? Math.asin(i) : new n(i, 0).asin(); }, Complex: function(i) { return i.asin(); }, BigNumber: function(i) { return i.asin(); } }); }), M5 = "asinh", _5 = ["typed"], F5 = /* @__PURE__ */ P(M5, _5, (e) => { var { typed: r } = e; return r("asinh", { number: uy, Complex: function(n) { return n.asinh(); }, BigNumber: function(n) { return n.asinh(); } }); }), T5 = "atan", O5 = ["typed"], B5 = /* @__PURE__ */ P(T5, O5, (e) => { var { typed: r } = e; return r("atan", { number: function(n) { return Math.atan(n); }, Complex: function(n) { return n.atan(); }, BigNumber: function(n) { return n.atan(); } }); }), Nm = "atan2", $5 = ["typed", "matrix", "equalScalar", "BigNumber", "DenseMatrix", "concat"], I5 = /* @__PURE__ */ P(Nm, $5, (e) => { var { typed: r, matrix: t, equalScalar: n, BigNumber: a, DenseMatrix: i, concat: o } = e, l = Kt({ typed: r, equalScalar: n }), u = ut({ typed: r }), s = Ay({ typed: r, equalScalar: n }), c = Kr({ typed: r, equalScalar: n }), f = Pr({ typed: r, DenseMatrix: i }), d = br({ typed: r, matrix: t, concat: o }); return r(Nm, { "number, number": Math.atan2, // Complex numbers doesn't seem to have a reasonable implementation of // atan2(). Even Matlab removed the support, after they only calculated // the atan only on base of the real part of the numbers and ignored // the imaginary. "BigNumber, BigNumber": (p, m) => a.atan2(p, m) }, d({ scalar: "number | BigNumber", SS: s, DS: u, SD: l, Ss: c, sS: f })); }), Dm = "atanh", R5 = ["typed", "config", "Complex"], P5 = /* @__PURE__ */ P(Dm, R5, (e) => { var { typed: r, config: t, Complex: n } = e; return r(Dm, { number: function(i) { return i <= 1 && i >= -1 || t.predictable ? ly(i) : new n(i, 0).atanh(); }, Complex: function(i) { return i.atanh(); }, BigNumber: function(i) { return i.atanh(); } }); }), mi = /* @__PURE__ */ P("trigUnit", ["typed"], (e) => { var { typed: r } = e; return { Unit: r.referToSelf((t) => (n) => { if (!n.hasBase(n.constructor.BASE_UNITS.ANGLE)) throw new TypeError("Unit in function cot is no angle"); return r.find(t, n.valueType())(n.value); }) }; }), Em = "cos", z5 = ["typed"], q5 = /* @__PURE__ */ P(Em, z5, (e) => { var { typed: r } = e, t = mi({ typed: r }); return r(Em, { number: Math.cos, "Complex | BigNumber": (n) => n.cos() }, t); }), Sm = "cosh", L5 = ["typed"], U5 = /* @__PURE__ */ P(Sm, L5, (e) => { var { typed: r } = e; return r(Sm, { number: UC, "Complex | BigNumber": (t) => t.cosh() }); }), Cm = "cot", k5 = ["typed", "BigNumber"], V5 = /* @__PURE__ */ P(Cm, k5, (e) => { var { typed: r, BigNumber: t } = e, n = mi({ typed: r }); return r(Cm, { number: cy, Complex: (a) => a.cot(), BigNumber: (a) => new t(1).div(a.tan()) }, n); }), Mm = "coth", H5 = ["typed", "BigNumber"], Z5 = /* @__PURE__ */ P(Mm, H5, (e) => { var { typed: r, BigNumber: t } = e; return r(Mm, { number: fy, Complex: (n) => n.coth(), BigNumber: (n) => new t(1).div(n.tanh()) }); }), _m = "csc", G5 = ["typed", "BigNumber"], W5 = /* @__PURE__ */ P(_m, G5, (e) => { var { typed: r, BigNumber: t } = e, n = mi({ typed: r }); return r(_m, { number: dy, Complex: (a) => a.csc(), BigNumber: (a) => new t(1).div(a.sin()) }, n); }), Fm = "csch", K5 = ["typed", "BigNumber"], J5 = /* @__PURE__ */ P(Fm, K5, (e) => { var { typed: r, BigNumber: t } = e; return r(Fm, { number: py, Complex: (n) => n.csch(), BigNumber: (n) => new t(1).div(n.sinh()) }); }), Tm = "sec", Y5 = ["typed", "BigNumber"], j5 = /* @__PURE__ */ P(Tm, Y5, (e) => { var { typed: r, BigNumber: t } = e, n = mi({ typed: r }); return r(Tm, { number: my, Complex: (a) => a.sec(), BigNumber: (a) => new t(1).div(a.cos()) }, n); }), Om = "sech", X5 = ["typed", "BigNumber"], Q5 = /* @__PURE__ */ P(Om, X5, (e) => { var { typed: r, BigNumber: t } = e; return r(Om, { number: vy, Complex: (n) => n.sech(), BigNumber: (n) => new t(1).div(n.cosh()) }); }), Bm = "sin", e8 = ["typed"], r8 = /* @__PURE__ */ P(Bm, e8, (e) => { var { typed: r } = e, t = mi({ typed: r }); return r(Bm, { number: Math.sin, "Complex | BigNumber": (n) => n.sin() }, t); }), $m = "sinh", t8 = ["typed"], n8 = /* @__PURE__ */ P($m, t8, (e) => { var { typed: r } = e; return r($m, { number: hy, "Complex | BigNumber": (t) => t.sinh() }); }), Im = "tan", a8 = ["typed"], i8 = /* @__PURE__ */ P(Im, a8, (e) => { var { typed: r } = e, t = mi({ typed: r }); return r(Im, { number: Math.tan, "Complex | BigNumber": (n) => n.tan() }, t); }), o8 = "tanh", s8 = ["typed"], u8 = /* @__PURE__ */ P(o8, s8, (e) => { var { typed: r } = e; return r("tanh", { number: VC, "Complex | BigNumber": (t) => t.tanh() }); }), Rm = "setCartesian", l8 = ["typed", "size", "subset", "compareNatural", "Index", "DenseMatrix"], c8 = /* @__PURE__ */ P(Rm, l8, (e) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i, DenseMatrix: o } = e; return r(Rm, { "Array | Matrix, Array | Matrix": function(u, s) { var c = []; if (n(t(u), new i(0)) !== 0 && n(t(s), new i(0)) !== 0) { var f = sr(Array.isArray(u) ? u : u.toArray()).sort(a), d = sr(Array.isArray(s) ? s : s.toArray()).sort(a); c = []; for (var p = 0; p < f.length; p++) for (var m = 0; m < d.length; m++) c.push([f[p], d[m]]); } return Array.isArray(u) && Array.isArray(s) ? c : new o(c); } }); }), Pm = "setDifference", f8 = ["typed", "size", "subset", "compareNatural", "Index", "DenseMatrix"], d8 = /* @__PURE__ */ P(Pm, f8, (e) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i, DenseMatrix: o } = e; return r(Pm, { "Array | Matrix, Array | Matrix": function(u, s) { var c; if (n(t(u), new i(0)) === 0) c = []; else { if (n(t(s), new i(0)) === 0) return sr(u.toArray()); var f = ti(sr(Array.isArray(u) ? u : u.toArray()).sort(a)), d = ti(sr(Array.isArray(s) ? s : s.toArray()).sort(a)); c = []; for (var p, m = 0; m < f.length; m++) { p = !1; for (var v = 0; v < d.length; v++) if (a(f[m].value, d[v].value) === 0 && f[m].identifier === d[v].identifier) { p = !0; break; } p || c.push(f[m]); } } return Array.isArray(u) && Array.isArray(s) ? jo(c) : new o(jo(c)); } }); }), zm = "setDistinct", p8 = ["typed", "size", "subset", "compareNatural", "Index", "DenseMatrix"], m8 = /* @__PURE__ */ P(zm, p8, (e) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i, DenseMatrix: o } = e; return r(zm, { "Array | Matrix": function(u) { var s; if (n(t(u), new i(0)) === 0) s = []; else { var c = sr(Array.isArray(u) ? u : u.toArray()).sort(a); s = [], s.push(c[0]); for (var f = 1; f < c.length; f++) a(c[f], c[f - 1]) !== 0 && s.push(c[f]); } return Array.isArray(u) ? s : new o(s); } }); }), qm = "setIntersect", v8 = ["typed", "size", "subset", "compareNatural", "Index", "DenseMatrix"], h8 = /* @__PURE__ */ P(qm, v8, (e) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i, DenseMatrix: o } = e; return r(qm, { "Array | Matrix, Array | Matrix": function(u, s) { var c; if (n(t(u), new i(0)) === 0 || n(t(s), new i(0)) === 0) c = []; else { var f = ti(sr(Array.isArray(u) ? u : u.toArray()).sort(a)), d = ti(sr(Array.isArray(s) ? s : s.toArray()).sort(a)); c = []; for (var p = 0; p < f.length; p++) for (var m = 0; m < d.length; m++) if (a(f[p].value, d[m].value) === 0 && f[p].identifier === d[m].identifier) { c.push(f[p]); break; } } return Array.isArray(u) && Array.isArray(s) ? jo(c) : new o(jo(c)); } }); }), Lm = "setIsSubset", g8 = ["typed", "size", "subset", "compareNatural", "Index"], y8 = /* @__PURE__ */ P(Lm, g8, (e) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i } = e; return r(Lm, { "Array | Matrix, Array | Matrix": function(l, u) { if (n(t(l), new i(0)) === 0) return !0; if (n(t(u), new i(0)) === 0) return !1; for (var s = ti(sr(Array.isArray(l) ? l : l.toArray()).sort(a)), c = ti(sr(Array.isArray(u) ? u : u.toArray()).sort(a)), f, d = 0; d < s.length; d++) { f = !1; for (var p = 0; p < c.length; p++) if (a(s[d].value, c[p].value) === 0 && s[d].identifier === c[p].identifier) { f = !0; break; } if (f === !1) return !1; } return !0; } }); }), Um = "setMultiplicity", b8 = ["typed", "size", "subset", "compareNatural", "Index"], w8 = /* @__PURE__ */ P(Um, b8, (e) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i } = e; return r(Um, { "number | BigNumber | Fraction | Complex, Array | Matrix": function(l, u) { if (n(t(u), new i(0)) === 0) return 0; for (var s = sr(Array.isArray(u) ? u : u.toArray()), c = 0, f = 0; f < s.length; f++) a(s[f], l) === 0 && c++; return c; } }); }), km = "setPowerset", x8 = ["typed", "size", "subset", "compareNatural", "Index"], A8 = /* @__PURE__ */ P(km, x8, (e) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i } = e; return r(km, { "Array | Matrix": function(s) { if (n(t(s), new i(0)) === 0) return []; for (var c = sr(Array.isArray(s) ? s : s.toArray()).sort(a), f = [], d = 0; d.toString(2).length <= c.length; ) f.push(o(c, d.toString(2).split("").reverse())), d++; return l(f); } }); function o(u, s) { for (var c = [], f = 0; f < s.length; f++) s[f] === "1" && c.push(u[f]); return c; } function l(u) { for (var s = [], c = u.length - 1; c > 0; c--) for (var f = 0; f < c; f++) u[f].length > u[f + 1].length && (s = u[f], u[f] = u[f + 1], u[f + 1] = s); return u; } }), Vm = "setSize", N8 = ["typed", "compareNatural"], D8 = /* @__PURE__ */ P(Vm, N8, (e) => { var { typed: r, compareNatural: t } = e; return r(Vm, { "Array | Matrix": function(a) { return Array.isArray(a) ? sr(a).length : sr(a.toArray()).length; }, "Array | Matrix, boolean": function(a, i) { if (i === !1 || a.length === 0) return Array.isArray(a) ? sr(a).length : sr(a.toArray()).length; for (var o = sr(Array.isArray(a) ? a : a.toArray()).sort(t), l = 1, u = 1; u < o.length; u++) t(o[u], o[u - 1]) !== 0 && l++; return l; } }); }), Hm = "setSymDifference", E8 = ["typed", "size", "concat", "subset", "setDifference", "Index"], S8 = /* @__PURE__ */ P(Hm, E8, (e) => { var { typed: r, size: t, concat: n, subset: a, setDifference: i, Index: o } = e; return r(Hm, { "Array | Matrix, Array | Matrix": function(u, s) { if (a(t(u), new o(0)) === 0) return sr(s); if (a(t(s), new o(0)) === 0) return sr(u); var c = sr(u), f = sr(s); return n(i(c, f), i(f, c)); } }); }), Zm = "setUnion", C8 = ["typed", "size", "concat", "subset", "setIntersect", "setSymDifference", "Index"], M8 = /* @__PURE__ */ P(Zm, C8, (e) => { var { typed: r, size: t, concat: n, subset: a, setIntersect: i, setSymDifference: o, Index: l } = e; return r(Zm, { "Array | Matrix, Array | Matrix": function(s, c) { if (a(t(s), new l(0)) === 0) return sr(c); if (a(t(c), new l(0)) === 0) return sr(s); var f = sr(s), d = sr(c); return n(o(f, d), i(f, d)); } }); }), Gm = "add", _8 = ["typed", "matrix", "addScalar", "equalScalar", "DenseMatrix", "SparseMatrix", "concat"], F8 = /* @__PURE__ */ P(Gm, _8, (e) => { var { typed: r, matrix: t, addScalar: n, equalScalar: a, DenseMatrix: i, SparseMatrix: o, concat: l } = e, u = ra({ typed: r }), s = Kl({ typed: r, equalScalar: a }), c = Da({ typed: r, DenseMatrix: i }), f = br({ typed: r, matrix: t, concat: l }); return r(Gm, { "any, any": n, "any, any, ...any": r.referToSelf((d) => (p, m, v) => { for (var b = d(p, m), y = 0; y < v.length; y++) b = d(b, v[y]); return b; }) }, f({ elop: n, DS: u, SS: s, Ss: c })); }), Wm = "hypot", T8 = ["typed", "abs", "addScalar", "divideScalar", "multiplyScalar", "sqrt", "smaller", "isPositive"], O8 = /* @__PURE__ */ P(Wm, T8, (e) => { var { typed: r, abs: t, addScalar: n, divideScalar: a, multiplyScalar: i, sqrt: o, smaller: l, isPositive: u } = e; return r(Wm, { "... number | BigNumber": s, Array: s, Matrix: (c) => s(sr(c.toArray())) }); function s(c) { for (var f = 0, d = 0, p = 0; p < c.length; p++) { if (Ut(c[p])) throw new TypeError("Unexpected type of argument to hypot"); var m = t(c[p]); l(d, m) ? (f = i(f, i(a(d, m), a(d, m))), f = n(f, 1), d = m) : f = n(f, u(m) ? i(a(m, d), a(m, d)) : m); } return i(d, o(f)); } }), Km = "norm", B8 = ["typed", "abs", "add", "pow", "conj", "sqrt", "multiply", "equalScalar", "larger", "smaller", "matrix", "ctranspose", "eigs"], $8 = /* @__PURE__ */ P(Km, B8, (e) => { var { typed: r, abs: t, add: n, pow: a, conj: i, sqrt: o, multiply: l, equalScalar: u, larger: s, smaller: c, matrix: f, ctranspose: d, eigs: p } = e; return r(Km, { number: Math.abs, Complex: function(E) { return E.abs(); }, BigNumber: function(E) { return E.abs(); }, boolean: function(E) { return Math.abs(E); }, Array: function(E) { return g(f(E), 2); }, Matrix: function(E) { return g(E, 2); }, "Array, number | BigNumber | string": function(E, N) { return g(f(E), N); }, "Matrix, number | BigNumber | string": function(E, N) { return g(E, N); } }); function m(D) { var E = 0; return D.forEach(function(N) { var S = t(N); s(S, E) && (E = S); }, !0), E; } function v(D) { var E; return D.forEach(function(N) { var S = t(N); (!E || c(S, E)) && (E = S); }, !0), E || 0; } function b(D, E) { if (E === Number.POSITIVE_INFINITY || E === "inf") return m(D); if (E === Number.NEGATIVE_INFINITY || E === "-inf") return v(D); if (E === "fro") return g(D, 2); if (typeof E == "number" && !isNaN(E)) { if (!u(E, 0)) { var N = 0; return D.forEach(function(S) { N = n(a(t(S), E), N); }, !0), a(N, 1 / E); } return Number.POSITIVE_INFINITY; } throw new Error("Unsupported parameter value"); } function y(D) { var E = 0; return D.forEach(function(N, S) { E = n(E, l(N, i(N))); }), t(o(E)); } function A(D) { var E = [], N = 0; return D.forEach(function(S, M) { var F = M[1], $ = n(E[F] || 0, t(S)); s($, N) && (N = $), E[F] = $; }, !0), N; } function h(D) { var E = D.size(); if (E[0] !== E[1]) throw new RangeError("Invalid matrix dimensions"); var N = d(D), S = l(N, D), M = p(S).values.toArray(), F = M[M.length - 1]; return t(o(F)); } function x(D) { var E = [], N = 0; return D.forEach(function(S, M) { var F = M[0], $ = n(E[F] || 0, t(S)); s($, N) && (N = $), E[F] = $; }, !0), N; } function w(D, E) { if (E === 1) return A(D); if (E === Number.POSITIVE_INFINITY || E === "inf") return x(D); if (E === "fro") return y(D); if (E === 2) return h(D); throw new Error("Unsupported parameter value " + E); } function g(D, E) { var N = D.size(); if (N.length === 1) return b(D, E); if (N.length === 2) { if (N[0] && N[1]) return w(D, E); throw new RangeError("Invalid matrix dimensions"); } } }), Jm = "dot", I8 = ["typed", "addScalar", "multiplyScalar", "conj", "size"], R8 = /* @__PURE__ */ P(Jm, I8, (e) => { var { typed: r, addScalar: t, multiplyScalar: n, conj: a, size: i } = e; return r(Jm, { "Array | DenseMatrix, Array | DenseMatrix": l, "SparseMatrix, SparseMatrix": u }); function o(c, f) { var d = s(c), p = s(f), m, v; if (d.length === 1) m = d[0]; else if (d.length === 2 && d[1] === 1) m = d[0]; else throw new RangeError("Expected a column vector, instead got a matrix of size (" + d.join(", ") + ")"); if (p.length === 1) v = p[0]; else if (p.length === 2 && p[1] === 1) v = p[0]; else throw new RangeError("Expected a column vector, instead got a matrix of size (" + p.join(", ") + ")"); if (m !== v) throw new RangeError("Vectors must have equal length (" + m + " != " + v + ")"); if (m === 0) throw new RangeError("Cannot calculate the dot product of empty vectors"); return m; } function l(c, f) { var d = o(c, f), p = ze(c) ? c._data : c, m = ze(c) ? c._datatype || c.getDataType() : void 0, v = ze(f) ? f._data : f, b = ze(f) ? f._datatype || f.getDataType() : void 0, y = s(c).length === 2, A = s(f).length === 2, h = t, x = n; if (m && b && m === b && typeof m == "string" && m !== "mixed") { var w = m; h = r.find(t, [w, w]), x = r.find(n, [w, w]); } if (!y && !A) { for (var g = x(a(p[0]), v[0]), D = 1; D < d; D++) g = h(g, x(a(p[D]), v[D])); return g; } if (!y && A) { for (var E = x(a(p[0]), v[0][0]), N = 1; N < d; N++) E = h(E, x(a(p[N]), v[N][0])); return E; } if (y && !A) { for (var S = x(a(p[0][0]), v[0]), M = 1; M < d; M++) S = h(S, x(a(p[M][0]), v[M])); return S; } if (y && A) { for (var F = x(a(p[0][0]), v[0][0]), $ = 1; $ < d; $++) F = h(F, x(a(p[$][0]), v[$][0])); return F; } } function u(c, f) { o(c, f); for (var d = c._index, p = c._values, m = f._index, v = f._values, b = 0, y = t, A = n, h = 0, x = 0; h < d.length && x < m.length; ) { var w = d[h], g = m[x]; if (w < g) { h++; continue; } if (w > g) { x++; continue; } w === g && (b = y(b, A(p[h], v[x])), h++, x++); } return b; } function s(c) { return ze(c) ? c.size() : i(c); } }), P8 = "trace", z8 = ["typed", "matrix", "add"], q8 = /* @__PURE__ */ P(P8, z8, (e) => { var { typed: r, matrix: t, add: n } = e; return r("trace", { Array: function(l) { return a(t(l)); }, SparseMatrix: i, DenseMatrix: a, any: qe }); function a(o) { var l = o._size, u = o._data; switch (l.length) { case 1: if (l[0] === 1) return qe(u[0]); throw new RangeError("Matrix must be square (size: " + Qe(l) + ")"); case 2: { var s = l[0], c = l[1]; if (s === c) { for (var f = 0, d = 0; d < s; d++) f = n(f, u[d][d]); return f; } else throw new RangeError("Matrix must be square (size: " + Qe(l) + ")"); } default: throw new RangeError("Matrix must be two dimensional (size: " + Qe(l) + ")"); } } function i(o) { var l = o._values, u = o._index, s = o._ptr, c = o._size, f = c[0], d = c[1]; if (f === d) { var p = 0; if (l.length > 0) for (var m = 0; m < d; m++) for (var v = s[m], b = s[m + 1], y = v; y < b; y++) { var A = u[y]; if (A === m) { p = n(p, l[y]); break; } if (A > m) break; } return p; } throw new RangeError("Matrix must be square (size: " + Qe(c) + ")"); } }), Ym = "index", L8 = ["typed", "Index"], U8 = /* @__PURE__ */ P(Ym, L8, (e) => { var { typed: r, Index: t } = e; return r(Ym, { "...number | string | BigNumber | Range | Array | Matrix": function(a) { var i = a.map(function(l) { return Ze(l) ? l.toNumber() : cr(l) || ze(l) ? l.map(function(u) { return Ze(u) ? u.toNumber() : u; }) : l; }), o = new t(); return t.apply(o, i), o; } }); }), ky = /* @__PURE__ */ new Set(["end"]), k8 = "Node", V8 = ["mathWithTransform"], H8 = /* @__PURE__ */ P(k8, V8, (e) => { var { mathWithTransform: r } = e; function t(a) { for (var i of [...ky]) if (a.has(i)) throw new Error('Scope contains an illegal symbol, "' + i + '" is a reserved keyword'); } class n { get type() { return "Node"; } get isNode() { return !0; } /** * Evaluate the node * @param {Object} [scope] Scope to read/write variables * @return {*} Returns the result */ evaluate(i) { return this.compile().evaluate(i); } /** * Compile the node into an optimized, evauatable JavaScript function * @return {{evaluate: function([Object])}} object * Returns an object with a function 'evaluate', * which can be invoked as expr.evaluate([scope: Object]), * where scope is an optional object with * variables. */ compile() { var i = this._compile(r, {}), o = {}, l = null; function u(s) { var c = La(s); return t(c), i(c, o, l); } return { evaluate: u }; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(i, o) { throw new Error("Method _compile must be implemented by type " + this.type); } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(i) { throw new Error("Cannot run forEach on a Node interface"); } /** * Create a new Node whose children are the results of calling the * provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {OperatorNode} Returns a transformed copy of the node */ map(i) { throw new Error("Cannot run map on a Node interface"); } /** * Validate whether an object is a Node, for use with map * @param {Node} node * @returns {Node} Returns the input if it's a node, else throws an Error * @protected */ _ifNode(i) { if (!fr(i)) throw new TypeError("Callback function must return a Node"); return i; } /** * Recursively traverse all nodes in a node tree. Executes given callback for * this node and each of its child nodes. * @param {function(node: Node, path: string, parent: Node)} callback * A callback called for every node in the node tree. */ traverse(i) { i(this, null, null); function o(l, u) { l.forEach(function(s, c, f) { u(s, c, f), o(s, u); }); } o(this, i); } /** * Recursively transform a node tree via a transform function. * * For example, to replace all nodes of type SymbolNode having name 'x' with * a ConstantNode with value 2: * * const res = Node.transform(function (node, path, parent) { * if (node && node.isSymbolNode) && (node.name === 'x')) { * return new ConstantNode(2) * } * else { * return node * } * }) * * @param {function(node: Node, path: string, parent: Node) : Node} callback * A mapping function accepting a node, and returning * a replacement for the node or the original node. The "signature" * of the callback must be: * callback(node: Node, index: string, parent: Node) : Node * @return {Node} Returns the original node or its replacement */ transform(i) { function o(l, u, s) { var c = i(l, u, s); return c !== l ? c : l.map(o); } return o(this, null, null); } /** * Find any node in the node tree matching given filter function. For * example, to find all nodes of type SymbolNode having name 'x': * * const results = Node.filter(function (node) { * return (node && node.isSymbolNode) && (node.name === 'x') * }) * * @param {function(node: Node, path: string, parent: Node) : Node} callback * A test function returning true when a node matches, and false * otherwise. Function signature: * callback(node: Node, index: string, parent: Node) : boolean * @return {Node[]} nodes * An array with nodes matching given filter criteria */ filter(i) { var o = []; return this.traverse(function(l, u, s) { i(l, u, s) && o.push(l); }), o; } /** * Create a shallow clone of this node * @return {Node} */ clone() { throw new Error("Cannot clone a Node interface"); } /** * Create a deep clone of this node * @return {Node} */ cloneDeep() { return this.map(function(i) { return i.cloneDeep(); }); } /** * Deep compare this node with another node. * @param {Node} other * @return {boolean} Returns true when both nodes are of the same type and * contain the same values (as do their childs) */ equals(i) { return i ? this.type === i.type && Sn(this, i) : !1; } /** * Get string representation. (wrapper function) * * This function can get an object of the following form: * { * handler: //This can be a callback function of the form * // "function callback(node, options)"or * // a map that maps function names (used in FunctionNodes) * // to callbacks * parenthesis: "keep" //the parenthesis option (This is optional) * } * * @param {Object} [options] * @return {string} */ toString(i) { var o = this._getCustomString(i); return typeof o < "u" ? o : this._toString(i); } /** * Internal function to generate the string output. * This has to be implemented by every Node * * @throws {Error} */ _toString() { throw new Error("_toString not implemented for " + this.type); } /** * Get a JSON representation of the node * Both .toJSON() and the static .fromJSON(json) should be implemented by all * implementations of Node * @returns {Object} */ toJSON() { throw new Error("Cannot serialize object: toJSON not implemented by " + this.type); } /** * Get HTML representation. (wrapper function) * * This function can get an object of the following form: * { * handler: //This can be a callback function of the form * // "function callback(node, options)" or * // a map that maps function names (used in FunctionNodes) * // to callbacks * parenthesis: "keep" //the parenthesis option (This is optional) * } * * @param {Object} [options] * @return {string} */ toHTML(i) { var o = this._getCustomString(i); return typeof o < "u" ? o : this._toHTML(i); } /** * Internal function to generate the HTML output. * This has to be implemented by every Node * * @throws {Error} */ _toHTML() { throw new Error("_toHTML not implemented for " + this.type); } /** * Get LaTeX representation. (wrapper function) * * This function can get an object of the following form: * { * handler: //This can be a callback function of the form * // "function callback(node, options)"or * // a map that maps function names (used in FunctionNodes) * // to callbacks * parenthesis: "keep" //the parenthesis option (This is optional) * } * * @param {Object} [options] * @return {string} */ toTex(i) { var o = this._getCustomString(i); return typeof o < "u" ? o : this._toTex(i); } /** * Internal function to generate the LaTeX output. * This has to be implemented by every Node * * @param {Object} [options] * @throws {Error} */ _toTex(i) { throw new Error("_toTex not implemented for " + this.type); } /** * Helper used by `to...` functions. */ _getCustomString(i) { if (i && typeof i == "object") switch (typeof i.handler) { case "object": case "undefined": return; case "function": return i.handler(this, i); default: throw new TypeError("Object or function expected as callback"); } } /** * Get identifier. * @return {string} */ getIdentifier() { return this.type; } /** * Get the content of the current Node. * @return {Node} node **/ getContent() { return this; } } return n; }, { isClass: !0, isNode: !0 }); function lt(e) { return e && e.isIndexError ? new $t(e.index + 1, e.min + 1, e.max !== void 0 ? e.max + 1 : void 0) : e; } function Vy(e) { var { subset: r } = e; return function(n, a) { try { if (Array.isArray(n)) return r(n, a); if (n && typeof n.subset == "function") return n.subset(a); if (typeof n == "string") return r(n, a); if (typeof n == "object") { if (!a.isObjectProperty()) throw new TypeError("Cannot apply a numeric index as object property"); return it(n, a.getObjectProperty()); } else throw new TypeError("Cannot apply index: unsupported type of object"); } catch (i) { throw lt(i); } }; } var vo = "AccessorNode", Z8 = ["subset", "Node"], G8 = /* @__PURE__ */ P(vo, Z8, (e) => { var { subset: r, Node: t } = e, n = Vy({ subset: r }); function a(o) { return !(Jn(o) || bt(o) || nr(o) || En(o) || Wi(o) || rn(o) || $r(o)); } class i extends t { /** * @constructor AccessorNode * @extends {Node} * Access an object property or get a matrix subset * * @param {Node} object The object from which to retrieve * a property or subset. * @param {IndexNode} index IndexNode containing ranges */ constructor(l, u) { if (super(), !fr(l)) throw new TypeError('Node expected for parameter "object"'); if (!Na(u)) throw new TypeError('IndexNode expected for parameter "index"'); this.object = l, this.index = u; } // readonly property name get name() { return this.index ? this.index.isObjectProperty() ? this.index.getObjectProperty() : "" : this.object.name || ""; } get type() { return vo; } get isAccessorNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(l, u) { var s = this.object._compile(l, u), c = this.index._compile(l, u); if (this.index.isObjectProperty()) { var f = this.index.getObjectProperty(); return function(p, m, v) { return it(s(p, m, v), f); }; } else return function(p, m, v) { var b = s(p, m, v), y = c(p, m, b); return n(b, y); }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(l) { l(this.object, "object", this), l(this.index, "index", this); } /** * Create a new AccessorNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {AccessorNode} Returns a transformed copy of the node */ map(l) { return new i(this._ifNode(l(this.object, "object", this)), this._ifNode(l(this.index, "index", this))); } /** * Create a clone of this node, a shallow copy * @return {AccessorNode} */ clone() { return new i(this.object, this.index); } /** * Get string representation * @param {Object} options * @return {string} */ _toString(l) { var u = this.object.toString(l); return a(this.object) && (u = "(" + u + ")"), u + this.index.toString(l); } /** * Get HTML representation * @param {Object} options * @return {string} */ _toHTML(l) { var u = this.object.toHTML(l); return a(this.object) && (u = '(' + u + ')'), u + this.index.toHTML(l); } /** * Get LaTeX representation * @param {Object} options * @return {string} */ _toTex(l) { var u = this.object.toTex(l); return a(this.object) && (u = "\\left(' + object + '\\right)"), u + this.index.toTex(l); } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: vo, object: this.object, index: this.index }; } /** * Instantiate an AccessorNode from its JSON representation * @param {Object} json * An object structured like * `{"mathjs": "AccessorNode", object: ..., index: ...}`, * where mathjs is optional * @returns {AccessorNode} */ static fromJSON(l) { return new i(l.object, l.index); } } return Rr(i, "name", vo), i; }, { isClass: !0, isNode: !0 }), ho = "ArrayNode", W8 = ["Node"], K8 = /* @__PURE__ */ P(ho, W8, (e) => { var { Node: r } = e; class t extends r { /** * @constructor ArrayNode * @extends {Node} * Holds an 1-dimensional array with items * @param {Node[]} [items] 1 dimensional array with items */ constructor(a) { if (super(), this.items = a || [], !Array.isArray(this.items) || !this.items.every(fr)) throw new TypeError("Array containing Nodes expected"); } get type() { return ho; } get isArrayNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(a, i) { var o = Wn(this.items, function(s) { return s._compile(a, i); }), l = a.config.matrix !== "Array"; if (l) { var u = a.matrix; return function(c, f, d) { return u(Wn(o, function(p) { return p(c, f, d); })); }; } else return function(c, f, d) { return Wn(o, function(p) { return p(c, f, d); }); }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(a) { for (var i = 0; i < this.items.length; i++) { var o = this.items[i]; a(o, "items[" + i + "]", this); } } /** * Create a new ArrayNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {ArrayNode} Returns a transformed copy of the node */ map(a) { for (var i = [], o = 0; o < this.items.length; o++) i[o] = this._ifNode(a(this.items[o], "items[" + o + "]", this)); return new t(i); } /** * Create a clone of this node, a shallow copy * @return {ArrayNode} */ clone() { return new t(this.items.slice(0)); } /** * Get string representation * @param {Object} options * @return {string} str * @override */ _toString(a) { var i = this.items.map(function(o) { return o.toString(a); }); return "[" + i.join(", ") + "]"; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: ho, items: this.items }; } /** * Instantiate an ArrayNode from its JSON representation * @param {Object} json An object structured like * `{"mathjs": "ArrayNode", items: [...]}`, * where mathjs is optional * @returns {ArrayNode} */ static fromJSON(a) { return new t(a.items); } /** * Get HTML representation * @param {Object} options * @return {string} str * @override */ _toHTML(a) { var i = this.items.map(function(o) { return o.toHTML(a); }); return '[' + i.join(',') + ']'; } /** * Get LaTeX representation * @param {Object} options * @return {string} str */ _toTex(a) { function i(o, l) { var u = o.some(bt) && !o.every(bt), s = l || u, c = s ? "&" : "\\\\", f = o.map(function(d) { return d.items ? i(d.items, !l) : d.toTex(a); }).join(c); return u || !s || s && !l ? "\\begin{bmatrix}" + f + "\\end{bmatrix}" : f; } return i(this.items, !1); } } return Rr(t, "name", ho), t; }, { isClass: !0, isNode: !0 }); function J8(e) { var { subset: r, matrix: t } = e; return function(a, i, o) { try { if (Array.isArray(a)) { var l = t(a).subset(i, o).valueOf(); return l.forEach((u, s) => { a[s] = u; }), a; } else { if (a && typeof a.subset == "function") return a.subset(i, o); if (typeof a == "string") return r(a, i, o); if (typeof a == "object") { if (!i.isObjectProperty()) throw TypeError("Cannot apply a numeric index as object property"); return Xa(a, i.getObjectProperty(), o), a; } else throw new TypeError("Cannot apply index: unsupported type of object"); } } catch (u) { throw lt(u); } }; } var Pt = [{ // assignment AssignmentNode: {}, FunctionAssignmentNode: {} }, { // conditional expression ConditionalNode: { latexLeftParens: !1, latexRightParens: !1, latexParens: !1 // conditionals don't need parentheses in LaTeX because // they are 2 dimensional } }, { // logical or "OperatorNode:or": { op: "or", associativity: "left", associativeWith: [] } }, { // logical xor "OperatorNode:xor": { op: "xor", associativity: "left", associativeWith: [] } }, { // logical and "OperatorNode:and": { op: "and", associativity: "left", associativeWith: [] } }, { // bitwise or "OperatorNode:bitOr": { op: "|", associativity: "left", associativeWith: [] } }, { // bitwise xor "OperatorNode:bitXor": { op: "^|", associativity: "left", associativeWith: [] } }, { // bitwise and "OperatorNode:bitAnd": { op: "&", associativity: "left", associativeWith: [] } }, { // relational operators "OperatorNode:equal": { op: "==", associativity: "left", associativeWith: [] }, "OperatorNode:unequal": { op: "!=", associativity: "left", associativeWith: [] }, "OperatorNode:smaller": { op: "<", associativity: "left", associativeWith: [] }, "OperatorNode:larger": { op: ">", associativity: "left", associativeWith: [] }, "OperatorNode:smallerEq": { op: "<=", associativity: "left", associativeWith: [] }, "OperatorNode:largerEq": { op: ">=", associativity: "left", associativeWith: [] }, RelationalNode: { associativity: "left", associativeWith: [] } }, { // bitshift operators "OperatorNode:leftShift": { op: "<<", associativity: "left", associativeWith: [] }, "OperatorNode:rightArithShift": { op: ">>", associativity: "left", associativeWith: [] }, "OperatorNode:rightLogShift": { op: ">>>", associativity: "left", associativeWith: [] } }, { // unit conversion "OperatorNode:to": { op: "to", associativity: "left", associativeWith: [] } }, { // range RangeNode: {} }, { // addition, subtraction "OperatorNode:add": { op: "+", associativity: "left", associativeWith: ["OperatorNode:add", "OperatorNode:subtract"] }, "OperatorNode:subtract": { op: "-", associativity: "left", associativeWith: [] } }, { // multiply, divide, modulus "OperatorNode:multiply": { op: "*", associativity: "left", associativeWith: ["OperatorNode:multiply", "OperatorNode:divide", "Operator:dotMultiply", "Operator:dotDivide"] }, "OperatorNode:divide": { op: "/", associativity: "left", associativeWith: [], latexLeftParens: !1, latexRightParens: !1, latexParens: !1 // fractions don't require parentheses because // they're 2 dimensional, so parens aren't needed // in LaTeX }, "OperatorNode:dotMultiply": { op: ".*", associativity: "left", associativeWith: ["OperatorNode:multiply", "OperatorNode:divide", "OperatorNode:dotMultiply", "OperatorNode:doDivide"] }, "OperatorNode:dotDivide": { op: "./", associativity: "left", associativeWith: [] }, "OperatorNode:mod": { op: "mod", associativity: "left", associativeWith: [] } }, { // Repeat multiplication for implicit multiplication "OperatorNode:multiply": { associativity: "left", associativeWith: ["OperatorNode:multiply", "OperatorNode:divide", "Operator:dotMultiply", "Operator:dotDivide"] } }, { // unary prefix operators "OperatorNode:unaryPlus": { op: "+", associativity: "right" }, "OperatorNode:unaryMinus": { op: "-", associativity: "right" }, "OperatorNode:bitNot": { op: "~", associativity: "right" }, "OperatorNode:not": { op: "not", associativity: "right" } }, { // exponentiation "OperatorNode:pow": { op: "^", associativity: "right", associativeWith: [], latexRightParens: !1 // the exponent doesn't need parentheses in // LaTeX because it's 2 dimensional // (it's on top) }, "OperatorNode:dotPow": { op: ".^", associativity: "right", associativeWith: [] } }, { // factorial "OperatorNode:factorial": { op: "!", associativity: "left" } }, { // matrix transpose "OperatorNode:ctranspose": { op: "'", associativity: "left" } }]; function go(e, r) { if (!r || r !== "auto") return e; for (var t = e; rn(t); ) t = t.content; return t; } function pr(e, r, t, n) { var a = e; r !== "keep" && (a = e.getContent()); for (var i = a.getIdentifier(), o = null, l = 0; l < Pt.length; l++) if (i in Pt[l]) { o = l; break; } if (i === "OperatorNode:multiply" && a.implicit && t !== "show") { var u = go(a.args[0], r); !(nr(u) && n && n.getIdentifier() === "OperatorNode:divide" && Pu(go(n.args[0], r))) && !(u.getIdentifier() === "OperatorNode:divide" && Pu(go(u.args[0], r)) && nr(go(u.args[1]))) && (o += 1); } return o; } function Ni(e, r) { var t = e; r !== "keep" && (t = e.getContent()); var n = t.getIdentifier(), a = pr(t, r); if (a === null) return null; var i = Pt[a][n]; if (Fe(i, "associativity")) { if (i.associativity === "left") return "left"; if (i.associativity === "right") return "right"; throw Error("'" + n + "' has the invalid associativity '" + i.associativity + "'."); } return null; } function vu(e, r, t) { var n = t !== "keep" ? e.getContent() : e, a = t !== "keep" ? e.getContent() : r, i = n.getIdentifier(), o = a.getIdentifier(), l = pr(n, t); if (l === null) return null; var u = Pt[l][i]; if (Fe(u, "associativeWith") && u.associativeWith instanceof Array) { for (var s = 0; s < u.associativeWith.length; s++) if (u.associativeWith[s] === o) return !0; return !1; } return null; } function Y8(e) { var r = "OperatorNode:" + e; for (var t of Pt) if (r in t) return t[r].op; return null; } var yo = "AssignmentNode", j8 = [ "subset", "?matrix", // FIXME: should not be needed at all, should be handled by subset "Node" ], X8 = /* @__PURE__ */ P(yo, j8, (e) => { var { subset: r, matrix: t, Node: n } = e, a = Vy({ subset: r }), i = J8({ subset: r, matrix: t }); function o(u, s, c) { s || (s = "keep"); var f = pr(u, s, c), d = pr(u.value, s, c); return s === "all" || d !== null && d <= f; } class l extends n { /** * @constructor AssignmentNode * @extends {Node} * * Define a symbol, like `a=3.2`, update a property like `a.b=3.2`, or * replace a subset of a matrix like `A[2,2]=42`. * * Syntax: * * new AssignmentNode(symbol, value) * new AssignmentNode(object, index, value) * * Usage: * * new AssignmentNode(new SymbolNode('a'), new ConstantNode(2)) // a=2 * new AssignmentNode(new SymbolNode('a'), * new IndexNode('b'), * new ConstantNode(2)) // a.b=2 * new AssignmentNode(new SymbolNode('a'), * new IndexNode(1, 2), * new ConstantNode(3)) // a[1,2]=3 * * @param {SymbolNode | AccessorNode} object * Object on which to assign a value * @param {IndexNode} [index=null] * Index, property name or matrix index. Optional. If not provided * and `object` is a SymbolNode, the property is assigned to the * global scope. * @param {Node} value * The value to be assigned */ constructor(s, c, f) { if (super(), this.object = s, this.index = f ? c : null, this.value = f || c, !$r(s) && !Jn(s)) throw new TypeError('SymbolNode or AccessorNode expected as "object"'); if ($r(s) && s.name === "end") throw new Error('Cannot assign to symbol "end"'); if (this.index && !Na(this.index)) throw new TypeError('IndexNode expected as "index"'); if (!fr(this.value)) throw new TypeError('Node expected as "value"'); } // class name for typing purposes: // readonly property name get name() { return this.index ? this.index.isObjectProperty() ? this.index.getObjectProperty() : "" : this.object.name || ""; } get type() { return yo; } get isAssignmentNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(s, c) { var f = this.object._compile(s, c), d = this.index ? this.index._compile(s, c) : null, p = this.value._compile(s, c), m = this.object.name; if (this.index) if (this.index.isObjectProperty()) { var v = this.index.getObjectProperty(); return function(x, w, g) { var D = f(x, w, g), E = p(x, w, g); return Xa(D, v, E), E; }; } else { if ($r(this.object)) return function(x, w, g) { var D = f(x, w, g), E = p(x, w, g), N = d(x, w, D); return x.set(m, i(D, N, E)), E; }; var b = this.object.object._compile(s, c); if (this.object.index.isObjectProperty()) { var y = this.object.index.getObjectProperty(); return function(x, w, g) { var D = b(x, w, g), E = it(D, y), N = d(x, w, E), S = p(x, w, g); return Xa(D, y, i(E, N, S)), S; }; } else { var A = this.object.index._compile(s, c); return function(x, w, g) { var D = b(x, w, g), E = A(x, w, D), N = a(D, E), S = d(x, w, N), M = p(x, w, g); return i(D, E, i(N, S, M)), M; }; } } else { if (!$r(this.object)) throw new TypeError("SymbolNode expected as object"); return function(x, w, g) { var D = p(x, w, g); return x.set(m, D), D; }; } } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(s) { s(this.object, "object", this), this.index && s(this.index, "index", this), s(this.value, "value", this); } /** * Create a new AssignmentNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {AssignmentNode} Returns a transformed copy of the node */ map(s) { var c = this._ifNode(s(this.object, "object", this)), f = this.index ? this._ifNode(s(this.index, "index", this)) : null, d = this._ifNode(s(this.value, "value", this)); return new l(c, f, d); } /** * Create a clone of this node, a shallow copy * @return {AssignmentNode} */ clone() { return new l(this.object, this.index, this.value); } /** * Get string representation * @param {Object} options * @return {string} */ _toString(s) { var c = this.object.toString(s), f = this.index ? this.index.toString(s) : "", d = this.value.toString(s); return o(this, s && s.parenthesis, s && s.implicit) && (d = "(" + d + ")"), c + f + " = " + d; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: yo, object: this.object, index: this.index, value: this.value }; } /** * Instantiate an AssignmentNode from its JSON representation * @param {Object} json * An object structured like * `{"mathjs": "AssignmentNode", object: ..., index: ..., value: ...}`, * where mathjs is optional * @returns {AssignmentNode} */ static fromJSON(s) { return new l(s.object, s.index, s.value); } /** * Get HTML representation * @param {Object} options * @return {string} */ _toHTML(s) { var c = this.object.toHTML(s), f = this.index ? this.index.toHTML(s) : "", d = this.value.toHTML(s); return o(this, s && s.parenthesis, s && s.implicit) && (d = '(' + d + ')'), c + f + '=' + d; } /** * Get LaTeX representation * @param {Object} options * @return {string} */ _toTex(s) { var c = this.object.toTex(s), f = this.index ? this.index.toTex(s) : "", d = this.value.toTex(s); return o(this, s && s.parenthesis, s && s.implicit) && (d = "\\left(".concat(d, "\\right)")), c + f + "=" + d; } } return Rr(l, "name", yo), l; }, { isClass: !0, isNode: !0 }), bo = "BlockNode", Q8 = ["ResultSet", "Node"], e6 = /* @__PURE__ */ P(bo, Q8, (e) => { var { ResultSet: r, Node: t } = e; class n extends t { /** * @constructor BlockNode * @extends {Node} * Holds a set with blocks * @param {Array.<{node: Node} | {node: Node, visible: boolean}>} blocks * An array with blocks, where a block is constructed as an * Object with properties block, which is a Node, and visible, * which is a boolean. The property visible is optional and * is true by default */ constructor(i) { if (super(), !Array.isArray(i)) throw new Error("Array expected"); this.blocks = i.map(function(o) { var l = o && o.node, u = o && o.visible !== void 0 ? o.visible : !0; if (!fr(l)) throw new TypeError('Property "node" must be a Node'); if (typeof u != "boolean") throw new TypeError('Property "visible" must be a boolean'); return { node: l, visible: u }; }); } get type() { return bo; } get isBlockNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(i, o) { var l = Wn(this.blocks, function(u) { return { evaluate: u.node._compile(i, o), visible: u.visible }; }); return function(s, c, f) { var d = []; return Dg(l, function(m) { var v = m.evaluate(s, c, f); m.visible && d.push(v); }), new r(d); }; } /** * Execute a callback for each of the child blocks of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(i) { for (var o = 0; o < this.blocks.length; o++) i(this.blocks[o].node, "blocks[" + o + "].node", this); } /** * Create a new BlockNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {BlockNode} Returns a transformed copy of the node */ map(i) { for (var o = [], l = 0; l < this.blocks.length; l++) { var u = this.blocks[l], s = this._ifNode(i(u.node, "blocks[" + l + "].node", this)); o[l] = { node: s, visible: u.visible }; } return new n(o); } /** * Create a clone of this node, a shallow copy * @return {BlockNode} */ clone() { var i = this.blocks.map(function(o) { return { node: o.node, visible: o.visible }; }); return new n(i); } /** * Get string representation * @param {Object} options * @return {string} str * @override */ _toString(i) { return this.blocks.map(function(o) { return o.node.toString(i) + (o.visible ? "" : ";"); }).join(` `); } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: bo, blocks: this.blocks }; } /** * Instantiate an BlockNode from its JSON representation * @param {Object} json * An object structured like * `{"mathjs": "BlockNode", blocks: [{node: ..., visible: false}, ...]}`, * where mathjs is optional * @returns {BlockNode} */ static fromJSON(i) { return new n(i.blocks); } /** * Get HTML representation * @param {Object} options * @return {string} str * @override */ _toHTML(i) { return this.blocks.map(function(o) { return o.node.toHTML(i) + (o.visible ? "" : ';'); }).join('
'); } /** * Get LaTeX representation * @param {Object} options * @return {string} str */ _toTex(i) { return this.blocks.map(function(o) { return o.node.toTex(i) + (o.visible ? "" : ";"); }).join(`\\;\\; `); } } return Rr(n, "name", bo), n; }, { isClass: !0, isNode: !0 }), wo = "ConditionalNode", r6 = ["Node"], t6 = /* @__PURE__ */ P(wo, r6, (e) => { var { Node: r } = e; function t(a) { if (typeof a == "number" || typeof a == "boolean" || typeof a == "string") return !!a; if (a) { if (Ze(a)) return !a.isZero(); if (Ut(a)) return !!(a.re || a.im); if (ft(a)) return !!a.value; } if (a == null) return !1; throw new TypeError('Unsupported type of condition "' + yr(a) + '"'); } class n extends r { /** * A lazy evaluating conditional operator: 'condition ? trueExpr : falseExpr' * * @param {Node} condition Condition, must result in a boolean * @param {Node} trueExpr Expression evaluated when condition is true * @param {Node} falseExpr Expression evaluated when condition is true * * @constructor ConditionalNode * @extends {Node} */ constructor(i, o, l) { if (super(), !fr(i)) throw new TypeError("Parameter condition must be a Node"); if (!fr(o)) throw new TypeError("Parameter trueExpr must be a Node"); if (!fr(l)) throw new TypeError("Parameter falseExpr must be a Node"); this.condition = i, this.trueExpr = o, this.falseExpr = l; } get type() { return wo; } get isConditionalNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(i, o) { var l = this.condition._compile(i, o), u = this.trueExpr._compile(i, o), s = this.falseExpr._compile(i, o); return function(f, d, p) { return t(l(f, d, p)) ? u(f, d, p) : s(f, d, p); }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(i) { i(this.condition, "condition", this), i(this.trueExpr, "trueExpr", this), i(this.falseExpr, "falseExpr", this); } /** * Create a new ConditionalNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {ConditionalNode} Returns a transformed copy of the node */ map(i) { return new n(this._ifNode(i(this.condition, "condition", this)), this._ifNode(i(this.trueExpr, "trueExpr", this)), this._ifNode(i(this.falseExpr, "falseExpr", this))); } /** * Create a clone of this node, a shallow copy * @return {ConditionalNode} */ clone() { return new n(this.condition, this.trueExpr, this.falseExpr); } /** * Get string representation * @param {Object} options * @return {string} str */ _toString(i) { var o = i && i.parenthesis ? i.parenthesis : "keep", l = pr(this, o, i && i.implicit), u = this.condition.toString(i), s = pr(this.condition, o, i && i.implicit); (o === "all" || this.condition.type === "OperatorNode" || s !== null && s <= l) && (u = "(" + u + ")"); var c = this.trueExpr.toString(i), f = pr(this.trueExpr, o, i && i.implicit); (o === "all" || this.trueExpr.type === "OperatorNode" || f !== null && f <= l) && (c = "(" + c + ")"); var d = this.falseExpr.toString(i), p = pr(this.falseExpr, o, i && i.implicit); return (o === "all" || this.falseExpr.type === "OperatorNode" || p !== null && p <= l) && (d = "(" + d + ")"), u + " ? " + c + " : " + d; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: wo, condition: this.condition, trueExpr: this.trueExpr, falseExpr: this.falseExpr }; } /** * Instantiate an ConditionalNode from its JSON representation * @param {Object} json * An object structured like * ``` * {"mathjs": "ConditionalNode", * "condition": ..., * "trueExpr": ..., * "falseExpr": ...} * ``` * where mathjs is optional * @returns {ConditionalNode} */ static fromJSON(i) { return new n(i.condition, i.trueExpr, i.falseExpr); } /** * Get HTML representation * @param {Object} options * @return {string} str */ _toHTML(i) { var o = i && i.parenthesis ? i.parenthesis : "keep", l = pr(this, o, i && i.implicit), u = this.condition.toHTML(i), s = pr(this.condition, o, i && i.implicit); (o === "all" || this.condition.type === "OperatorNode" || s !== null && s <= l) && (u = '(' + u + ')'); var c = this.trueExpr.toHTML(i), f = pr(this.trueExpr, o, i && i.implicit); (o === "all" || this.trueExpr.type === "OperatorNode" || f !== null && f <= l) && (c = '(' + c + ')'); var d = this.falseExpr.toHTML(i), p = pr(this.falseExpr, o, i && i.implicit); return (o === "all" || this.falseExpr.type === "OperatorNode" || p !== null && p <= l) && (d = '(' + d + ')'), u + '?' + c + ':' + d; } /** * Get LaTeX representation * @param {Object} options * @return {string} str */ _toTex(i) { return "\\begin{cases} {" + this.trueExpr.toTex(i) + "}, &\\quad{\\text{if }\\;" + this.condition.toTex(i) + "}\\\\{" + this.falseExpr.toTex(i) + "}, &\\quad{\\text{otherwise}}\\end{cases}"; } } return Rr(n, "name", wo), n; }, { isClass: !0, isNode: !0 }), Xu = Object.assign || function(e) { for (var r = 1; r < arguments.length; r++) { var t = arguments[r]; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]); } return e; }, n6 = { "{": "\\{", "}": "\\}", "\\": "\\textbackslash{}", "#": "\\#", $: "\\$", "%": "\\%", "&": "\\&", "^": "\\textasciicircum{}", _: "\\_", "~": "\\textasciitilde{}" }, a6 = { "–": "\\--", "—": "\\---", " ": "~", " ": "\\qquad{}", "\r\n": "\\newline{}", "\n": "\\newline{}" }, i6 = function(r, t) { return Xu({}, r, t); }, o6 = function(e) { for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = r.preserveFormatting, n = t === void 0 ? !1 : t, a = r.escapeMapFn, i = a === void 0 ? i6 : a, o = String(e), l = "", u = i(Xu({}, n6), n ? Xu({}, a6) : {}), s = Object.keys(u), c = function() { var d = !1; s.forEach(function(p, m) { d || o.length >= p.length && o.slice(0, p.length) === p && (l += u[s[m]], o = o.slice(p.length, o.length), d = !0); }), d || (l += o.slice(0, 1), o = o.slice(1, o.length)); }; o; ) c(); return l; }; const s6 = /* @__PURE__ */ Es(o6); var Qu = { // GREEK LETTERS Alpha: "A", alpha: "\\alpha", Beta: "B", beta: "\\beta", Gamma: "\\Gamma", gamma: "\\gamma", Delta: "\\Delta", delta: "\\delta", Epsilon: "E", epsilon: "\\epsilon", varepsilon: "\\varepsilon", Zeta: "Z", zeta: "\\zeta", Eta: "H", eta: "\\eta", Theta: "\\Theta", theta: "\\theta", vartheta: "\\vartheta", Iota: "I", iota: "\\iota", Kappa: "K", kappa: "\\kappa", varkappa: "\\varkappa", Lambda: "\\Lambda", lambda: "\\lambda", Mu: "M", mu: "\\mu", Nu: "N", nu: "\\nu", Xi: "\\Xi", xi: "\\xi", Omicron: "O", omicron: "o", Pi: "\\Pi", pi: "\\pi", varpi: "\\varpi", Rho: "P", rho: "\\rho", varrho: "\\varrho", Sigma: "\\Sigma", sigma: "\\sigma", varsigma: "\\varsigma", Tau: "T", tau: "\\tau", Upsilon: "\\Upsilon", upsilon: "\\upsilon", Phi: "\\Phi", phi: "\\phi", varphi: "\\varphi", Chi: "X", chi: "\\chi", Psi: "\\Psi", psi: "\\psi", Omega: "\\Omega", omega: "\\omega", // logic true: "\\mathrm{True}", false: "\\mathrm{False}", // other i: "i", // TODO use \i ?? inf: "\\infty", Inf: "\\infty", infinity: "\\infty", Infinity: "\\infty", oo: "\\infty", lim: "\\lim", undefined: "\\mathbf{?}" }, or = { transpose: "^\\top", ctranspose: "^H", factorial: "!", pow: "^", dotPow: ".^\\wedge", // TODO find ideal solution unaryPlus: "+", unaryMinus: "-", bitNot: "\\~", // TODO find ideal solution not: "\\neg", multiply: "\\cdot", divide: "\\frac", // TODO how to handle that properly? dotMultiply: ".\\cdot", // TODO find ideal solution dotDivide: ".:", // TODO find ideal solution mod: "\\mod", add: "+", subtract: "-", to: "\\rightarrow", leftShift: "<<", rightArithShift: ">>", rightLogShift: ">>>", equal: "=", unequal: "\\neq", smaller: "<", larger: ">", smallerEq: "\\leq", largerEq: "\\geq", bitAnd: "\\&", bitXor: "\\underline{|}", bitOr: "|", and: "\\wedge", xor: "\\veebar", or: "\\vee" }, jm = { // arithmetic abs: { 1: "\\left|${args[0]}\\right|" }, add: { 2: "\\left(${args[0]}".concat(or.add, "${args[1]}\\right)") }, cbrt: { 1: "\\sqrt[3]{${args[0]}}" }, ceil: { 1: "\\left\\lceil${args[0]}\\right\\rceil" }, cube: { 1: "\\left(${args[0]}\\right)^3" }, divide: { 2: "\\frac{${args[0]}}{${args[1]}}" }, dotDivide: { 2: "\\left(${args[0]}".concat(or.dotDivide, "${args[1]}\\right)") }, dotMultiply: { 2: "\\left(${args[0]}".concat(or.dotMultiply, "${args[1]}\\right)") }, dotPow: { 2: "\\left(${args[0]}".concat(or.dotPow, "${args[1]}\\right)") }, exp: { 1: "\\exp\\left(${args[0]}\\right)" }, expm1: "\\left(e".concat(or.pow, "{${args[0]}}-1\\right)"), fix: { 1: "\\mathrm{${name}}\\left(${args[0]}\\right)" }, floor: { 1: "\\left\\lfloor${args[0]}\\right\\rfloor" }, gcd: "\\gcd\\left(${args}\\right)", hypot: "\\hypot\\left(${args}\\right)", log: { 1: "\\ln\\left(${args[0]}\\right)", 2: "\\log_{${args[1]}}\\left(${args[0]}\\right)" }, log10: { 1: "\\log_{10}\\left(${args[0]}\\right)" }, log1p: { 1: "\\ln\\left(${args[0]}+1\\right)", 2: "\\log_{${args[1]}}\\left(${args[0]}+1\\right)" }, log2: "\\log_{2}\\left(${args[0]}\\right)", mod: { 2: "\\left(${args[0]}".concat(or.mod, "${args[1]}\\right)") }, multiply: { 2: "\\left(${args[0]}".concat(or.multiply, "${args[1]}\\right)") }, norm: { 1: "\\left\\|${args[0]}\\right\\|", 2: void 0 // use default template }, nthRoot: { 2: "\\sqrt[${args[1]}]{${args[0]}}" }, nthRoots: { 2: "\\{y : $y^{args[1]} = {${args[0]}}\\}" }, pow: { 2: "\\left(${args[0]}\\right)".concat(or.pow, "{${args[1]}}") }, round: { 1: "\\left\\lfloor${args[0]}\\right\\rceil", 2: void 0 // use default template }, sign: { 1: "\\mathrm{${name}}\\left(${args[0]}\\right)" }, sqrt: { 1: "\\sqrt{${args[0]}}" }, square: { 1: "\\left(${args[0]}\\right)^2" }, subtract: { 2: "\\left(${args[0]}".concat(or.subtract, "${args[1]}\\right)") }, unaryMinus: { 1: "".concat(or.unaryMinus, "\\left(${args[0]}\\right)") }, unaryPlus: { 1: "".concat(or.unaryPlus, "\\left(${args[0]}\\right)") }, // bitwise bitAnd: { 2: "\\left(${args[0]}".concat(or.bitAnd, "${args[1]}\\right)") }, bitNot: { 1: or.bitNot + "\\left(${args[0]}\\right)" }, bitOr: { 2: "\\left(${args[0]}".concat(or.bitOr, "${args[1]}\\right)") }, bitXor: { 2: "\\left(${args[0]}".concat(or.bitXor, "${args[1]}\\right)") }, leftShift: { 2: "\\left(${args[0]}".concat(or.leftShift, "${args[1]}\\right)") }, rightArithShift: { 2: "\\left(${args[0]}".concat(or.rightArithShift, "${args[1]}\\right)") }, rightLogShift: { 2: "\\left(${args[0]}".concat(or.rightLogShift, "${args[1]}\\right)") }, // combinatorics bellNumbers: { 1: "\\mathrm{B}_{${args[0]}}" }, catalan: { 1: "\\mathrm{C}_{${args[0]}}" }, stirlingS2: { 2: "\\mathrm{S}\\left(${args}\\right)" }, // complex arg: { 1: "\\arg\\left(${args[0]}\\right)" }, conj: { 1: "\\left(${args[0]}\\right)^*" }, im: { 1: "\\Im\\left\\lbrace${args[0]}\\right\\rbrace" }, re: { 1: "\\Re\\left\\lbrace${args[0]}\\right\\rbrace" }, // logical and: { 2: "\\left(${args[0]}".concat(or.and, "${args[1]}\\right)") }, not: { 1: or.not + "\\left(${args[0]}\\right)" }, or: { 2: "\\left(${args[0]}".concat(or.or, "${args[1]}\\right)") }, xor: { 2: "\\left(${args[0]}".concat(or.xor, "${args[1]}\\right)") }, // matrix cross: { 2: "\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)" }, ctranspose: { 1: "\\left(${args[0]}\\right)".concat(or.ctranspose) }, det: { 1: "\\det\\left(${args[0]}\\right)" }, dot: { 2: "\\left(${args[0]}\\cdot${args[1]}\\right)" }, expm: { 1: "\\exp\\left(${args[0]}\\right)" }, inv: { 1: "\\left(${args[0]}\\right)^{-1}" }, pinv: { 1: "\\left(${args[0]}\\right)^{+}" }, sqrtm: { 1: "{${args[0]}}".concat(or.pow, "{\\frac{1}{2}}") }, trace: { 1: "\\mathrm{tr}\\left(${args[0]}\\right)" }, transpose: { 1: "\\left(${args[0]}\\right)".concat(or.transpose) }, // probability combinations: { 2: "\\binom{${args[0]}}{${args[1]}}" }, combinationsWithRep: { 2: "\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)" }, factorial: { 1: "\\left(${args[0]}\\right)".concat(or.factorial) }, gamma: { 1: "\\Gamma\\left(${args[0]}\\right)" }, lgamma: { 1: "\\ln\\Gamma\\left(${args[0]}\\right)" }, // relational equal: { 2: "\\left(${args[0]}".concat(or.equal, "${args[1]}\\right)") }, larger: { 2: "\\left(${args[0]}".concat(or.larger, "${args[1]}\\right)") }, largerEq: { 2: "\\left(${args[0]}".concat(or.largerEq, "${args[1]}\\right)") }, smaller: { 2: "\\left(${args[0]}".concat(or.smaller, "${args[1]}\\right)") }, smallerEq: { 2: "\\left(${args[0]}".concat(or.smallerEq, "${args[1]}\\right)") }, unequal: { 2: "\\left(${args[0]}".concat(or.unequal, "${args[1]}\\right)") }, // special erf: { 1: "erf\\left(${args[0]}\\right)" }, // statistics max: "\\max\\left(${args}\\right)", min: "\\min\\left(${args}\\right)", variance: "\\mathrm{Var}\\left(${args}\\right)", // trigonometry acos: { 1: "\\cos^{-1}\\left(${args[0]}\\right)" }, acosh: { 1: "\\cosh^{-1}\\left(${args[0]}\\right)" }, acot: { 1: "\\cot^{-1}\\left(${args[0]}\\right)" }, acoth: { 1: "\\coth^{-1}\\left(${args[0]}\\right)" }, acsc: { 1: "\\csc^{-1}\\left(${args[0]}\\right)" }, acsch: { 1: "\\mathrm{csch}^{-1}\\left(${args[0]}\\right)" }, asec: { 1: "\\sec^{-1}\\left(${args[0]}\\right)" }, asech: { 1: "\\mathrm{sech}^{-1}\\left(${args[0]}\\right)" }, asin: { 1: "\\sin^{-1}\\left(${args[0]}\\right)" }, asinh: { 1: "\\sinh^{-1}\\left(${args[0]}\\right)" }, atan: { 1: "\\tan^{-1}\\left(${args[0]}\\right)" }, atan2: { 2: "\\mathrm{atan2}\\left(${args}\\right)" }, atanh: { 1: "\\tanh^{-1}\\left(${args[0]}\\right)" }, cos: { 1: "\\cos\\left(${args[0]}\\right)" }, cosh: { 1: "\\cosh\\left(${args[0]}\\right)" }, cot: { 1: "\\cot\\left(${args[0]}\\right)" }, coth: { 1: "\\coth\\left(${args[0]}\\right)" }, csc: { 1: "\\csc\\left(${args[0]}\\right)" }, csch: { 1: "\\mathrm{csch}\\left(${args[0]}\\right)" }, sec: { 1: "\\sec\\left(${args[0]}\\right)" }, sech: { 1: "\\mathrm{sech}\\left(${args[0]}\\right)" }, sin: { 1: "\\sin\\left(${args[0]}\\right)" }, sinh: { 1: "\\sinh\\left(${args[0]}\\right)" }, tan: { 1: "\\tan\\left(${args[0]}\\right)" }, tanh: { 1: "\\tanh\\left(${args[0]}\\right)" }, // unit to: { 2: "\\left(${args[0]}".concat(or.to, "${args[1]}\\right)") }, // utils numeric: function(r, t) { return r.args[0].toTex(); }, // type number: { 0: "0", 1: "\\left(${args[0]}\\right)", 2: "\\left(\\left(${args[0]}\\right)${args[1]}\\right)" }, string: { 0: '\\mathtt{""}', 1: "\\mathrm{string}\\left(${args[0]}\\right)" }, bignumber: { 0: "0", 1: "\\left(${args[0]}\\right)" }, bigint: { 0: "0", 1: "\\left(${args[0]}\\right)" }, complex: { 0: "0", 1: "\\left(${args[0]}\\right)", 2: "\\left(\\left(${args[0]}\\right)+".concat(Qu.i, "\\cdot\\left(${args[1]}\\right)\\right)") }, matrix: { 0: "\\begin{bmatrix}\\end{bmatrix}", 1: "\\left(${args[0]}\\right)", 2: "\\left(${args[0]}\\right)" }, sparse: { 0: "\\begin{bsparse}\\end{bsparse}", 1: "\\left(${args[0]}\\right)" }, unit: { 1: "\\left(${args[0]}\\right)", 2: "\\left(\\left(${args[0]}\\right)${args[1]}\\right)" } }, u6 = "\\mathrm{${name}}\\left(${args}\\right)", Xm = { deg: "^\\circ" }; function el(e) { return s6(e, { preserveFormatting: !0 }); } function Hy(e, r) { return r = typeof r > "u" ? !1 : r, r ? Fe(Xm, e) ? Xm[e] : "\\mathrm{" + el(e) + "}" : Fe(Qu, e) ? Qu[e] : el(e); } var xo = "ConstantNode", l6 = ["Node"], c6 = /* @__PURE__ */ P(xo, l6, (e) => { var { Node: r } = e; class t extends r { /** * A ConstantNode holds a constant value like a number or string. * * Usage: * * new ConstantNode(2.3) * new ConstantNode('hello') * * @param {*} value Value can be any type (number, BigNumber, bigint, string, ...) * @constructor ConstantNode * @extends {Node} */ constructor(a) { super(), this.value = a; } get type() { return xo; } get isConstantNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(a, i) { var o = this.value; return function() { return o; }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(a) { } /** * Create a new ConstantNode with children produced by the given callback. * Trivial because there are no children. * @param {function(child: Node, path: string, parent: Node) : Node} callback * @returns {ConstantNode} Returns a clone of the node */ map(a) { return this.clone(); } /** * Create a clone of this node, a shallow copy * @return {ConstantNode} */ clone() { return new t(this.value); } /** * Get string representation * @param {Object} options * @return {string} str */ _toString(a) { return Qe(this.value, a); } /** * Get HTML representation * @param {Object} options * @return {string} str */ _toHTML(a) { var i = this._toString(a); switch (yr(this.value)) { case "number": case "bigint": case "BigNumber": case "Fraction": return '' + i + ""; case "string": return '' + i + ""; case "boolean": return '' + i + ""; case "null": return '' + i + ""; case "undefined": return '' + i + ""; default: return '' + i + ""; } } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: xo, value: this.value }; } /** * Instantiate a ConstantNode from its JSON representation * @param {Object} json An object structured like * `{"mathjs": "SymbolNode", value: 2.3}`, * where mathjs is optional * @returns {ConstantNode} */ static fromJSON(a) { return new t(a.value); } /** * Get LaTeX representation * @param {Object} options * @return {string} str */ _toTex(a) { var i = this._toString(a), o = yr(this.value); switch (o) { case "string": return "\\mathtt{" + el(i) + "}"; case "number": case "BigNumber": { var l = o === "BigNumber" ? this.value.isFinite() : isFinite(this.value); if (!l) return this.value.valueOf() < 0 ? "-\\infty" : "\\infty"; var u = i.toLowerCase().indexOf("e"); return u !== -1 ? i.substring(0, u) + "\\cdot10^{" + i.substring(u + 1) + "}" : i; } case "bigint": return i.toString(); case "Fraction": return this.value.toLatex(); default: return i; } } } return Rr(t, "name", xo), t; }, { isClass: !0, isNode: !0 }), Ao = "FunctionAssignmentNode", f6 = ["typed", "Node"], d6 = /* @__PURE__ */ P(Ao, f6, (e) => { var { typed: r, Node: t } = e; function n(i, o, l) { var u = pr(i, o, l), s = pr(i.expr, o, l); return o === "all" || s !== null && s <= u; } class a extends t { /** * @constructor FunctionAssignmentNode * @extends {Node} * Function assignment * * @param {string} name Function name * @param {string[] | Array.<{name: string, type: string}>} params * Array with function parameter names, or an * array with objects containing the name * and type of the parameter * @param {Node} expr The function expression */ constructor(o, l, u) { if (super(), typeof o != "string") throw new TypeError('String expected for parameter "name"'); if (!Array.isArray(l)) throw new TypeError('Array containing strings or objects expected for parameter "params"'); if (!fr(u)) throw new TypeError('Node expected for parameter "expr"'); if (ky.has(o)) throw new Error('Illegal function name, "' + o + '" is a reserved keyword'); var s = /* @__PURE__ */ new Set(); for (var c of l) { var f = typeof c == "string" ? c : c.name; if (s.has(f)) throw new Error('Duplicate parameter name "'.concat(f, '"')); s.add(f); } this.name = o, this.params = l.map(function(d) { return d && d.name || d; }), this.types = l.map(function(d) { return d && d.type || "any"; }), this.expr = u; } get type() { return Ao; } get isFunctionAssignmentNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(o, l) { var u = Object.create(l); Dg(this.params, function(m) { u[m] = !0; }); var s = this.expr._compile(o, u), c = this.name, f = this.params, d = ed(this.types, ","), p = c + "(" + ed(this.params, ", ") + ")"; return function(v, b, y) { var A = {}; A[d] = function() { for (var x = Object.create(b), w = 0; w < f.length; w++) x[f[w]] = arguments[w]; return s(v, x, y); }; var h = r(c, A); return h.syntax = p, v.set(c, h), h; }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(o) { o(this.expr, "expr", this); } /** * Create a new FunctionAssignmentNode whose children are the results of * calling the provided callback function for each child of the original * node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {FunctionAssignmentNode} Returns a transformed copy of the node */ map(o) { var l = this._ifNode(o(this.expr, "expr", this)); return new a(this.name, this.params.slice(0), l); } /** * Create a clone of this node, a shallow copy * @return {FunctionAssignmentNode} */ clone() { return new a(this.name, this.params.slice(0), this.expr); } /** * get string representation * @param {Object} options * @return {string} str */ _toString(o) { var l = o && o.parenthesis ? o.parenthesis : "keep", u = this.expr.toString(o); return n(this, l, o && o.implicit) && (u = "(" + u + ")"), this.name + "(" + this.params.join(", ") + ") = " + u; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { var o = this.types; return { mathjs: Ao, name: this.name, params: this.params.map(function(l, u) { return { name: l, type: o[u] }; }), expr: this.expr }; } /** * Instantiate an FunctionAssignmentNode from its JSON representation * @param {Object} json * An object structured like * ``` * {"mathjs": "FunctionAssignmentNode", * name: ..., params: ..., expr: ...} * ``` * where mathjs is optional * @returns {FunctionAssignmentNode} */ static fromJSON(o) { return new a(o.name, o.params, o.expr); } /** * get HTML representation * @param {Object} options * @return {string} str */ _toHTML(o) { for (var l = o && o.parenthesis ? o.parenthesis : "keep", u = [], s = 0; s < this.params.length; s++) u.push('' + Mt(this.params[s]) + ""); var c = this.expr.toHTML(o); return n(this, l, o && o.implicit) && (c = '(' + c + ')'), '' + Mt(this.name) + '(' + u.join(',') + ')=' + c; } /** * get LaTeX representation * @param {Object} options * @return {string} str */ _toTex(o) { var l = o && o.parenthesis ? o.parenthesis : "keep", u = this.expr.toTex(o); return n(this, l, o && o.implicit) && (u = "\\left(".concat(u, "\\right)")), "\\mathrm{" + this.name + "}\\left(" + this.params.map(Hy).join(",") + "\\right)=" + u; } } return Rr(a, "name", Ao), a; }, { isClass: !0, isNode: !0 }), No = "IndexNode", p6 = ["Node", "size"], m6 = /* @__PURE__ */ P(No, p6, (e) => { var { Node: r, size: t } = e; class n extends r { /** * @constructor IndexNode * @extends Node * * Describes a subset of a matrix or an object property. * Cannot be used on its own, needs to be used within an AccessorNode or * AssignmentNode. * * @param {Node[]} dimensions * @param {boolean} [dotNotation=false] * Optional property describing whether this index was written using dot * notation like `a.b`, or using bracket notation like `a["b"]` * (which is the default). This property is used for string conversion. */ constructor(i, o) { if (super(), this.dimensions = i, this.dotNotation = o || !1, !Array.isArray(i) || !i.every(fr)) throw new TypeError('Array containing Nodes expected for parameter "dimensions"'); if (this.dotNotation && !this.isObjectProperty()) throw new Error("dotNotation only applicable for object properties"); } get type() { return No; } get isIndexNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(i, o) { var l = Wn(this.dimensions, function(s, c) { var f = s.filter((m) => m.isSymbolNode && m.name === "end").length > 0; if (f) { var d = Object.create(o); d.end = !0; var p = s._compile(i, d); return function(v, b, y) { if (!ze(y) && !cr(y) && !Vr(y)) throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is ' + yr(y)); var A = t(y).valueOf(), h = Object.create(b); return h.end = A[c], p(v, h, y); }; } else return s._compile(i, o); }), u = it(i, "index"); return function(c, f, d) { var p = Wn(l, function(m) { return m(c, f, d); }); return u(...p); }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(i) { for (var o = 0; o < this.dimensions.length; o++) i(this.dimensions[o], "dimensions[" + o + "]", this); } /** * Create a new IndexNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {IndexNode} Returns a transformed copy of the node */ map(i) { for (var o = [], l = 0; l < this.dimensions.length; l++) o[l] = this._ifNode(i(this.dimensions[l], "dimensions[" + l + "]", this)); return new n(o, this.dotNotation); } /** * Create a clone of this node, a shallow copy * @return {IndexNode} */ clone() { return new n(this.dimensions.slice(0), this.dotNotation); } /** * Test whether this IndexNode contains a single property name * @return {boolean} */ isObjectProperty() { return this.dimensions.length === 1 && nr(this.dimensions[0]) && typeof this.dimensions[0].value == "string"; } /** * Returns the property name if IndexNode contains a property. * If not, returns null. * @return {string | null} */ getObjectProperty() { return this.isObjectProperty() ? this.dimensions[0].value : null; } /** * Get string representation * @param {Object} options * @return {string} str */ _toString(i) { return this.dotNotation ? "." + this.getObjectProperty() : "[" + this.dimensions.join(", ") + "]"; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: No, dimensions: this.dimensions, dotNotation: this.dotNotation }; } /** * Instantiate an IndexNode from its JSON representation * @param {Object} json * An object structured like * `{"mathjs": "IndexNode", dimensions: [...], dotNotation: false}`, * where mathjs is optional * @returns {IndexNode} */ static fromJSON(i) { return new n(i.dimensions, i.dotNotation); } /** * Get HTML representation * @param {Object} options * @return {string} str */ _toHTML(i) { for (var o = [], l = 0; l < this.dimensions.length; l++) o[l] = this.dimensions[l].toHTML(); return this.dotNotation ? '.' + Mt(this.getObjectProperty()) + "" : '[' + o.join(',') + ']'; } /** * Get LaTeX representation * @param {Object} options * @return {string} str */ _toTex(i) { var o = this.dimensions.map(function(l) { return l.toTex(i); }); return this.dotNotation ? "." + this.getObjectProperty() : "_{" + o.join(",") + "}"; } } return Rr(n, "name", No), n; }, { isClass: !0, isNode: !0 }), Do = "ObjectNode", v6 = ["Node"], h6 = /* @__PURE__ */ P(Do, v6, (e) => { var { Node: r } = e; class t extends r { /** * @constructor ObjectNode * @extends {Node} * Holds an object with keys/values * @param {Object.} [properties] object with key/value pairs */ constructor(a) { if (super(), this.properties = a || {}, a && (typeof a != "object" || !Object.keys(a).every(function(i) { return fr(a[i]); }))) throw new TypeError("Object containing Nodes expected"); } get type() { return Do; } get isObjectNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(a, i) { var o = {}; for (var l in this.properties) if (Fe(this.properties, l)) { var u = za(l), s = JSON.parse(u), c = it(this.properties, l); o[s] = c._compile(a, i); } return function(d, p, m) { var v = {}; for (var b in o) Fe(o, b) && (v[b] = o[b](d, p, m)); return v; }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(a) { for (var i in this.properties) Fe(this.properties, i) && a(this.properties[i], "properties[" + za(i) + "]", this); } /** * Create a new ObjectNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {ObjectNode} Returns a transformed copy of the node */ map(a) { var i = {}; for (var o in this.properties) Fe(this.properties, o) && (i[o] = this._ifNode(a(this.properties[o], "properties[" + za(o) + "]", this))); return new t(i); } /** * Create a clone of this node, a shallow copy * @return {ObjectNode} */ clone() { var a = {}; for (var i in this.properties) Fe(this.properties, i) && (a[i] = this.properties[i]); return new t(a); } /** * Get string representation * @param {Object} options * @return {string} str * @override */ _toString(a) { var i = []; for (var o in this.properties) Fe(this.properties, o) && i.push(za(o) + ": " + this.properties[o].toString(a)); return "{" + i.join(", ") + "}"; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: Do, properties: this.properties }; } /** * Instantiate an OperatorNode from its JSON representation * @param {Object} json An object structured like * `{"mathjs": "ObjectNode", "properties": {...}}`, * where mathjs is optional * @returns {ObjectNode} */ static fromJSON(a) { return new t(a.properties); } /** * Get HTML representation * @param {Object} options * @return {string} str * @override */ _toHTML(a) { var i = []; for (var o in this.properties) Fe(this.properties, o) && i.push('' + Mt(o) + ':' + this.properties[o].toHTML(a)); return '{' + i.join(',') + '}'; } /** * Get LaTeX representation * @param {Object} options * @return {string} str */ _toTex(a) { var i = []; for (var o in this.properties) Fe(this.properties, o) && i.push("\\mathbf{" + o + ":} & " + this.properties[o].toTex(a) + "\\\\"); var l = "\\left\\{\\begin{array}{ll}" + i.join(` `) + "\\end{array}\\right\\}"; return l; } } return Rr(t, "name", Do), t; }, { isClass: !0, isNode: !0 }); function Ei(e, r) { return new P0(e, new Cs(r), new Set(Object.keys(r))); } var Eo = "OperatorNode", g6 = ["Node"], y6 = /* @__PURE__ */ P(Eo, g6, (e) => { var { Node: r } = e; function t(i, o) { var l = i; if (o === "auto") for (; rn(l); ) l = l.content; return nr(l) ? !0 : _r(l) ? t(l.args[0], o) : !1; } function n(i, o, l, u, s) { var c = pr(i, o, l), f = Ni(i, o); if (o === "all" || u.length > 2 && i.getIdentifier() !== "OperatorNode:add" && i.getIdentifier() !== "OperatorNode:multiply") return u.map(function(S) { switch (S.getContent().type) { case "ArrayNode": case "ConstantNode": case "SymbolNode": case "ParenthesisNode": return !1; default: return !0; } }); var d; switch (u.length) { case 0: d = []; break; case 1: { var p = pr(u[0], o, l, i); if (s && p !== null) { var m, v; if (o === "keep" ? (m = u[0].getIdentifier(), v = i.getIdentifier()) : (m = u[0].getContent().getIdentifier(), v = i.getContent().getIdentifier()), Pt[c][v].latexLeftParens === !1) { d = [!1]; break; } if (Pt[p][m].latexParens === !1) { d = [!1]; break; } } if (p === null) { d = [!1]; break; } if (p <= c) { d = [!0]; break; } d = [!1]; } break; case 2: { var b, y = pr(u[0], o, l, i), A = vu(i, u[0], o); y === null ? b = !1 : y === c && f === "right" && !A || y < c ? b = !0 : b = !1; var h, x = pr(u[1], o, l, i), w = vu(i, u[1], o); if (x === null ? h = !1 : x === c && f === "left" && !w || x < c ? h = !0 : h = !1, s) { var g, D, E; o === "keep" ? (g = i.getIdentifier(), D = i.args[0].getIdentifier(), E = i.args[1].getIdentifier()) : (g = i.getContent().getIdentifier(), D = i.args[0].getContent().getIdentifier(), E = i.args[1].getContent().getIdentifier()), y !== null && (Pt[c][g].latexLeftParens === !1 && (b = !1), Pt[y][D].latexParens === !1 && (b = !1)), x !== null && (Pt[c][g].latexRightParens === !1 && (h = !1), Pt[x][E].latexParens === !1 && (h = !1)); } d = [b, h]; } break; default: (i.getIdentifier() === "OperatorNode:add" || i.getIdentifier() === "OperatorNode:multiply") && (d = u.map(function(S) { var M = pr(S, o, l, i), F = vu(i, S, o), $ = Ni(S, o); return M === null ? !1 : c === M && f === $ && !F ? !0 : M < c; })); break; } if (u.length >= 2 && i.getIdentifier() === "OperatorNode:multiply" && i.implicit && o !== "all" && l === "hide") for (var N = 1; N < d.length; ++N) t(u[N], o) && !d[N - 1] && (o !== "keep" || !rn(u[N - 1])) && (d[N] = !0); return d; } class a extends r { /** * @constructor OperatorNode * @extends {Node} * An operator with two arguments, like 2+3 * * @param {string} op Operator name, for example '+' * @param {string} fn Function name, for example 'add' * @param {Node[]} args Operator arguments * @param {boolean} [implicit] Is this an implicit multiplication? * @param {boolean} [isPercentage] Is this an percentage Operation? */ constructor(o, l, u, s, c) { if (super(), typeof o != "string") throw new TypeError('string expected for parameter "op"'); if (typeof l != "string") throw new TypeError('string expected for parameter "fn"'); if (!Array.isArray(u) || !u.every(fr)) throw new TypeError('Array containing Nodes expected for parameter "args"'); this.implicit = s === !0, this.isPercentage = c === !0, this.op = o, this.fn = l, this.args = u || []; } get type() { return Eo; } get isOperatorNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(o, l) { if (typeof this.fn != "string" || !Il(o, this.fn)) throw o[this.fn] ? new Error('No access to function "' + this.fn + '"') : new Error("Function " + this.fn + ' missing in provided namespace "math"'); var u = it(o, this.fn), s = Wn(this.args, function(m) { return m._compile(o, l); }); if (typeof u == "function" && u.rawArgs === !0) { var c = this.args; return function(v, b, y) { return u(c, o, Ei(v, b)); }; } else if (s.length === 1) { var f = s[0]; return function(v, b, y) { return u(f(v, b, y)); }; } else if (s.length === 2) { var d = s[0], p = s[1]; return function(v, b, y) { return u(d(v, b, y), p(v, b, y)); }; } else return function(v, b, y) { return u.apply(null, Wn(s, function(A) { return A(v, b, y); })); }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(o) { for (var l = 0; l < this.args.length; l++) o(this.args[l], "args[" + l + "]", this); } /** * Create a new OperatorNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {OperatorNode} Returns a transformed copy of the node */ map(o) { for (var l = [], u = 0; u < this.args.length; u++) l[u] = this._ifNode(o(this.args[u], "args[" + u + "]", this)); return new a(this.op, this.fn, l, this.implicit, this.isPercentage); } /** * Create a clone of this node, a shallow copy * @return {OperatorNode} */ clone() { return new a(this.op, this.fn, this.args.slice(0), this.implicit, this.isPercentage); } /** * Check whether this is an unary OperatorNode: * has exactly one argument, like `-a`. * @return {boolean} * Returns true when an unary operator node, false otherwise. */ isUnary() { return this.args.length === 1; } /** * Check whether this is a binary OperatorNode: * has exactly two arguments, like `a + b`. * @return {boolean} * Returns true when a binary operator node, false otherwise. */ isBinary() { return this.args.length === 2; } /** * Get string representation. * @param {Object} options * @return {string} str */ _toString(o) { var l = o && o.parenthesis ? o.parenthesis : "keep", u = o && o.implicit ? o.implicit : "hide", s = this.args, c = n(this, l, u, s, !1); if (s.length === 1) { var f = Ni(this, l), d = s[0].toString(o); c[0] && (d = "(" + d + ")"); var p = /[a-zA-Z]+/.test(this.op); return f === "right" ? this.op + (p ? " " : "") + d : f === "left" ? d + (p ? " " : "") + this.op : d + this.op; } else if (s.length === 2) { var m = s[0].toString(o), v = s[1].toString(o); return c[0] && (m = "(" + m + ")"), c[1] && (v = "(" + v + ")"), this.implicit && this.getIdentifier() === "OperatorNode:multiply" && u === "hide" ? m + " " + v : m + " " + this.op + " " + v; } else if (s.length > 2 && (this.getIdentifier() === "OperatorNode:add" || this.getIdentifier() === "OperatorNode:multiply")) { var b = s.map(function(y, A) { return y = y.toString(o), c[A] && (y = "(" + y + ")"), y; }); return this.implicit && this.getIdentifier() === "OperatorNode:multiply" && u === "hide" ? b.join(" ") : b.join(" " + this.op + " "); } else return this.fn + "(" + this.args.join(", ") + ")"; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: Eo, op: this.op, fn: this.fn, args: this.args, implicit: this.implicit, isPercentage: this.isPercentage }; } /** * Instantiate an OperatorNode from its JSON representation * @param {Object} json * An object structured like * ``` * {"mathjs": "OperatorNode", * "op": "+", "fn": "add", "args": [...], * "implicit": false, * "isPercentage":false} * ``` * where mathjs is optional * @returns {OperatorNode} */ static fromJSON(o) { return new a(o.op, o.fn, o.args, o.implicit, o.isPercentage); } /** * Get HTML representation. * @param {Object} options * @return {string} str */ _toHTML(o) { var l = o && o.parenthesis ? o.parenthesis : "keep", u = o && o.implicit ? o.implicit : "hide", s = this.args, c = n(this, l, u, s, !1); if (s.length === 1) { var f = Ni(this, l), d = s[0].toHTML(o); return c[0] && (d = '(' + d + ')'), f === "right" ? '' + Mt(this.op) + "" + d : d + '' + Mt(this.op) + ""; } else if (s.length === 2) { var p = s[0].toHTML(o), m = s[1].toHTML(o); return c[0] && (p = '(' + p + ')'), c[1] && (m = '(' + m + ')'), this.implicit && this.getIdentifier() === "OperatorNode:multiply" && u === "hide" ? p + '' + m : p + '' + Mt(this.op) + "" + m; } else { var v = s.map(function(b, y) { return b = b.toHTML(o), c[y] && (b = '(' + b + ')'), b; }); return s.length > 2 && (this.getIdentifier() === "OperatorNode:add" || this.getIdentifier() === "OperatorNode:multiply") ? this.implicit && this.getIdentifier() === "OperatorNode:multiply" && u === "hide" ? v.join('') : v.join('' + Mt(this.op) + "") : '' + Mt(this.fn) + '(' + v.join(',') + ')'; } } /** * Get LaTeX representation * @param {Object} options * @return {string} str */ _toTex(o) { var l = o && o.parenthesis ? o.parenthesis : "keep", u = o && o.implicit ? o.implicit : "hide", s = this.args, c = n(this, l, u, s, !0), f = or[this.fn]; if (f = typeof f > "u" ? this.op : f, s.length === 1) { var d = Ni(this, l), p = s[0].toTex(o); return c[0] && (p = "\\left(".concat(p, "\\right)")), d === "right" ? f + p : p + f; } else if (s.length === 2) { var m = s[0], v = m.toTex(o); c[0] && (v = "\\left(".concat(v, "\\right)")); var b = s[1], y = b.toTex(o); c[1] && (y = "\\left(".concat(y, "\\right)")); var A; switch (l === "keep" ? A = m.getIdentifier() : A = m.getContent().getIdentifier(), this.getIdentifier()) { case "OperatorNode:divide": return f + "{" + v + "}{" + y + "}"; case "OperatorNode:pow": switch (v = "{" + v + "}", y = "{" + y + "}", A) { case "ConditionalNode": case "OperatorNode:divide": v = "\\left(".concat(v, "\\right)"); } break; case "OperatorNode:multiply": if (this.implicit && u === "hide") return v + "~" + y; } return v + f + y; } else if (s.length > 2 && (this.getIdentifier() === "OperatorNode:add" || this.getIdentifier() === "OperatorNode:multiply")) { var h = s.map(function(x, w) { return x = x.toTex(o), c[w] && (x = "\\left(".concat(x, "\\right)")), x; }); return this.getIdentifier() === "OperatorNode:multiply" && this.implicit && u === "hide" ? h.join("~") : h.join(f); } else return "\\mathrm{" + this.fn + "}\\left(" + s.map(function(x) { return x.toTex(o); }).join(",") + "\\right)"; } /** * Get identifier. * @return {string} */ getIdentifier() { return this.type + ":" + this.fn; } } return Rr(a, "name", Eo), a; }, { isClass: !0, isNode: !0 }), So = "ParenthesisNode", b6 = ["Node"], w6 = /* @__PURE__ */ P(So, b6, (e) => { var { Node: r } = e; class t extends r { /** * @constructor ParenthesisNode * @extends {Node} * A parenthesis node describes manual parenthesis from the user input * @param {Node} content * @extends {Node} */ constructor(a) { if (super(), !fr(a)) throw new TypeError('Node expected for parameter "content"'); this.content = a; } get type() { return So; } get isParenthesisNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(a, i) { return this.content._compile(a, i); } /** * Get the content of the current Node. * @return {Node} content * @override **/ getContent() { return this.content.getContent(); } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(a) { a(this.content, "content", this); } /** * Create a new ParenthesisNode whose child is the result of calling * the provided callback function on the child of this node. * @param {function(child: Node, path: string, parent: Node) : Node} callback * @returns {ParenthesisNode} Returns a clone of the node */ map(a) { var i = a(this.content, "content", this); return new t(i); } /** * Create a clone of this node, a shallow copy * @return {ParenthesisNode} */ clone() { return new t(this.content); } /** * Get string representation * @param {Object} options * @return {string} str * @override */ _toString(a) { return !a || a && !a.parenthesis || a && a.parenthesis === "keep" ? "(" + this.content.toString(a) + ")" : this.content.toString(a); } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: So, content: this.content }; } /** * Instantiate an ParenthesisNode from its JSON representation * @param {Object} json An object structured like * `{"mathjs": "ParenthesisNode", "content": ...}`, * where mathjs is optional * @returns {ParenthesisNode} */ static fromJSON(a) { return new t(a.content); } /** * Get HTML representation * @param {Object} options * @return {string} str * @override */ _toHTML(a) { return !a || a && !a.parenthesis || a && a.parenthesis === "keep" ? '(' + this.content.toHTML(a) + ')' : this.content.toHTML(a); } /** * Get LaTeX representation * @param {Object} options * @return {string} str * @override */ _toTex(a) { return !a || a && !a.parenthesis || a && a.parenthesis === "keep" ? "\\left(".concat(this.content.toTex(a), "\\right)") : this.content.toTex(a); } } return Rr(t, "name", So), t; }, { isClass: !0, isNode: !0 }), Co = "RangeNode", x6 = ["Node"], A6 = /* @__PURE__ */ P(Co, x6, (e) => { var { Node: r } = e; function t(a, i, o) { var l = pr(a, i, o), u = {}, s = pr(a.start, i, o); if (u.start = s !== null && s <= l || i === "all", a.step) { var c = pr(a.step, i, o); u.step = c !== null && c <= l || i === "all"; } var f = pr(a.end, i, o); return u.end = f !== null && f <= l || i === "all", u; } class n extends r { /** * @constructor RangeNode * @extends {Node} * create a range * @param {Node} start included lower-bound * @param {Node} end included upper-bound * @param {Node} [step] optional step */ constructor(i, o, l) { if (super(), !fr(i)) throw new TypeError("Node expected"); if (!fr(o)) throw new TypeError("Node expected"); if (l && !fr(l)) throw new TypeError("Node expected"); if (arguments.length > 3) throw new Error("Too many arguments"); this.start = i, this.end = o, this.step = l || null; } get type() { return Co; } get isRangeNode() { return !0; } /** * Check whether the RangeNode needs the `end` symbol to be defined. * This end is the size of the Matrix in current dimension. * @return {boolean} */ needsEnd() { var i = this.filter(function(o) { return $r(o) && o.name === "end"; }); return i.length > 0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(i, o) { var l = i.range, u = this.start._compile(i, o), s = this.end._compile(i, o); if (this.step) { var c = this.step._compile(i, o); return function(d, p, m) { return l(u(d, p, m), s(d, p, m), c(d, p, m)); }; } else return function(d, p, m) { return l(u(d, p, m), s(d, p, m)); }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(i) { i(this.start, "start", this), i(this.end, "end", this), this.step && i(this.step, "step", this); } /** * Create a new RangeNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {RangeNode} Returns a transformed copy of the node */ map(i) { return new n(this._ifNode(i(this.start, "start", this)), this._ifNode(i(this.end, "end", this)), this.step && this._ifNode(i(this.step, "step", this))); } /** * Create a clone of this node, a shallow copy * @return {RangeNode} */ clone() { return new n(this.start, this.end, this.step && this.step); } /** * Get string representation * @param {Object} options * @return {string} str */ _toString(i) { var o = i && i.parenthesis ? i.parenthesis : "keep", l = t(this, o, i && i.implicit), u, s = this.start.toString(i); if (l.start && (s = "(" + s + ")"), u = s, this.step) { var c = this.step.toString(i); l.step && (c = "(" + c + ")"), u += ":" + c; } var f = this.end.toString(i); return l.end && (f = "(" + f + ")"), u += ":" + f, u; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: Co, start: this.start, end: this.end, step: this.step }; } /** * Instantiate an RangeNode from its JSON representation * @param {Object} json * An object structured like * `{"mathjs": "RangeNode", "start": ..., "end": ..., "step": ...}`, * where mathjs is optional * @returns {RangeNode} */ static fromJSON(i) { return new n(i.start, i.end, i.step); } /** * Get HTML representation * @param {Object} options * @return {string} str */ _toHTML(i) { var o = i && i.parenthesis ? i.parenthesis : "keep", l = t(this, o, i && i.implicit), u, s = this.start.toHTML(i); if (l.start && (s = '(' + s + ')'), u = s, this.step) { var c = this.step.toHTML(i); l.step && (c = '(' + c + ')'), u += ':' + c; } var f = this.end.toHTML(i); return l.end && (f = '(' + f + ')'), u += ':' + f, u; } /** * Get LaTeX representation * @params {Object} options * @return {string} str */ _toTex(i) { var o = i && i.parenthesis ? i.parenthesis : "keep", l = t(this, o, i && i.implicit), u = this.start.toTex(i); if (l.start && (u = "\\left(".concat(u, "\\right)")), this.step) { var s = this.step.toTex(i); l.step && (s = "\\left(".concat(s, "\\right)")), u += ":" + s; } var c = this.end.toTex(i); return l.end && (c = "\\left(".concat(c, "\\right)")), u += ":" + c, u; } } return Rr(n, "name", Co), n; }, { isClass: !0, isNode: !0 }), Mo = "RelationalNode", N6 = ["Node"], D6 = /* @__PURE__ */ P(Mo, N6, (e) => { var { Node: r } = e, t = { equal: "==", unequal: "!=", smaller: "<", larger: ">", smallerEq: "<=", largerEq: ">=" }; class n extends r { /** * A node representing a chained conditional expression, such as 'x > y > z' * * @param {String[]} conditionals * An array of conditional operators used to compare the parameters * @param {Node[]} params * The parameters that will be compared * * @constructor RelationalNode * @extends {Node} */ constructor(i, o) { if (super(), !Array.isArray(i)) throw new TypeError("Parameter conditionals must be an array"); if (!Array.isArray(o)) throw new TypeError("Parameter params must be an array"); if (i.length !== o.length - 1) throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals"); this.conditionals = i, this.params = o; } get type() { return Mo; } get isRelationalNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(i, o) { var l = this, u = this.params.map((s) => s._compile(i, o)); return function(c, f, d) { for (var p, m = u[0](c, f, d), v = 0; v < l.conditionals.length; v++) { p = m, m = u[v + 1](c, f, d); var b = it(i, l.conditionals[v]); if (!b(p, m)) return !1; } return !0; }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(i) { this.params.forEach((o, l) => i(o, "params[" + l + "]", this), this); } /** * Create a new RelationalNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {RelationalNode} Returns a transformed copy of the node */ map(i) { return new n(this.conditionals.slice(), this.params.map((o, l) => this._ifNode(i(o, "params[" + l + "]", this)), this)); } /** * Create a clone of this node, a shallow copy * @return {RelationalNode} */ clone() { return new n(this.conditionals, this.params); } /** * Get string representation. * @param {Object} options * @return {string} str */ _toString(i) { for (var o = i && i.parenthesis ? i.parenthesis : "keep", l = pr(this, o, i && i.implicit), u = this.params.map(function(f, d) { var p = pr(f, o, i && i.implicit); return o === "all" || p !== null && p <= l ? "(" + f.toString(i) + ")" : f.toString(i); }), s = u[0], c = 0; c < this.conditionals.length; c++) s += " " + t[this.conditionals[c]], s += " " + u[c + 1]; return s; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: Mo, conditionals: this.conditionals, params: this.params }; } /** * Instantiate a RelationalNode from its JSON representation * @param {Object} json * An object structured like * `{"mathjs": "RelationalNode", "conditionals": ..., "params": ...}`, * where mathjs is optional * @returns {RelationalNode} */ static fromJSON(i) { return new n(i.conditionals, i.params); } /** * Get HTML representation * @param {Object} options * @return {string} str */ _toHTML(i) { for (var o = i && i.parenthesis ? i.parenthesis : "keep", l = pr(this, o, i && i.implicit), u = this.params.map(function(f, d) { var p = pr(f, o, i && i.implicit); return o === "all" || p !== null && p <= l ? '(' + f.toHTML(i) + ')' : f.toHTML(i); }), s = u[0], c = 0; c < this.conditionals.length; c++) s += '' + Mt(t[this.conditionals[c]]) + "" + u[c + 1]; return s; } /** * Get LaTeX representation * @param {Object} options * @return {string} str */ _toTex(i) { for (var o = i && i.parenthesis ? i.parenthesis : "keep", l = pr(this, o, i && i.implicit), u = this.params.map(function(f, d) { var p = pr(f, o, i && i.implicit); return o === "all" || p !== null && p <= l ? "\\left(" + f.toTex(i) + "\right)" : f.toTex(i); }), s = u[0], c = 0; c < this.conditionals.length; c++) s += or[this.conditionals[c]] + u[c + 1]; return s; } } return Rr(n, "name", Mo), n; }, { isClass: !0, isNode: !0 }), E6 = "SymbolNode", S6 = ["math", "?Unit", "Node"], C6 = /* @__PURE__ */ P(E6, S6, (e) => { var { math: r, Unit: t, Node: n } = e; function a(o) { return t ? t.isValuelessUnit(o) : !1; } class i extends n { /** * @constructor SymbolNode * @extends {Node} * A symbol node can hold and resolve a symbol * @param {string} name * @extends {Node} */ constructor(l) { if (super(), typeof l != "string") throw new TypeError('String expected for parameter "name"'); this.name = l; } get type() { return "SymbolNode"; } get isSymbolNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(l, u) { var s = this.name; if (u[s] === !0) return function(f, d, p) { return it(d, s); }; if (s in l) return function(f, d, p) { return f.has(s) ? f.get(s) : it(l, s); }; var c = a(s); return function(f, d, p) { return f.has(s) ? f.get(s) : c ? new t(null, s) : i.onUndefinedSymbol(s); }; } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(l) { } /** * Create a new SymbolNode with children produced by the given callback. * Trivial since a SymbolNode has no children * @param {function(child: Node, path: string, parent: Node) : Node} callback * @returns {SymbolNode} Returns a clone of the node */ map(l) { return this.clone(); } /** * Throws an error 'Undefined symbol {name}' * @param {string} name */ static onUndefinedSymbol(l) { throw new Error("Undefined symbol " + l); } /** * Create a clone of this node, a shallow copy * @return {SymbolNode} */ clone() { return new i(this.name); } /** * Get string representation * @param {Object} options * @return {string} str * @override */ _toString(l) { return this.name; } /** * Get HTML representation * @param {Object} options * @return {string} str * @override */ _toHTML(l) { var u = Mt(this.name); return u === "true" || u === "false" ? '' + u + "" : u === "i" ? '' + u + "" : u === "Infinity" ? '' + u + "" : u === "NaN" ? '' + u + "" : u === "null" ? '' + u + "" : u === "undefined" ? '' + u + "" : '' + u + ""; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: "SymbolNode", name: this.name }; } /** * Instantiate a SymbolNode from its JSON representation * @param {Object} json An object structured like * `{"mathjs": "SymbolNode", name: "x"}`, * where mathjs is optional * @returns {SymbolNode} */ static fromJSON(l) { return new i(l.name); } /** * Get LaTeX representation * @param {Object} options * @return {string} str * @override */ _toTex(l) { var u = !1; typeof r[this.name] > "u" && a(this.name) && (u = !0); var s = Hy(this.name, u); return s[0] === "\\" ? s : " " + s; } } return i; }, { isClass: !0, isNode: !0 }), _o = "FunctionNode", M6 = ["math", "Node", "SymbolNode"], _6 = /* @__PURE__ */ P(_o, M6, (e) => { var r, { math: t, Node: n, SymbolNode: a } = e, i = (u) => Qe(u, { truncate: 78 }); function o(u, s, c) { for (var f = "", d = /\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi, p = 0, m; (m = d.exec(u)) !== null; ) if (f += u.substring(p, m.index), p = m.index, m[0] === "$$") f += "$", p++; else { p += m[0].length; var v = s[m[1]]; if (!v) throw new ReferenceError("Template: Property " + m[1] + " does not exist."); if (m[2] === void 0) switch (typeof v) { case "string": f += v; break; case "object": if (fr(v)) f += v.toTex(c); else if (Array.isArray(v)) f += v.map(function(b, y) { if (fr(b)) return b.toTex(c); throw new TypeError("Template: " + m[1] + "[" + y + "] is not a Node."); }).join(","); else throw new TypeError("Template: " + m[1] + " has to be a Node, String or array of Nodes"); break; default: throw new TypeError("Template: " + m[1] + " has to be a Node, String or array of Nodes"); } else if (fr(v[m[2]] && v[m[2]])) f += v[m[2]].toTex(c); else throw new TypeError("Template: " + m[1] + "[" + m[2] + "] is not a Node."); } return f += u.slice(p), f; } class l extends n { /** * @constructor FunctionNode * @extends {./Node} * invoke a list with arguments on a node * @param {./Node | string} fn * Item resolving to a function on which to invoke * the arguments, typically a SymbolNode or AccessorNode * @param {./Node[]} args */ constructor(s, c) { if (super(), typeof s == "string" && (s = new a(s)), !fr(s)) throw new TypeError('Node expected as parameter "fn"'); if (!Array.isArray(c) || !c.every(fr)) throw new TypeError('Array containing Nodes expected for parameter "args"'); this.fn = s, this.args = c || []; } // readonly property name get name() { return this.fn.name || ""; } get type() { return _o; } get isFunctionNode() { return !0; } /** * Compile a node into a JavaScript function. * This basically pre-calculates as much as possible and only leaves open * calculations which depend on a dynamic scope with variables. * @param {Object} math Math.js namespace with functions and constants. * @param {Object} argNames An object with argument names as key and `true` * as value. Used in the SymbolNode to optimize * for arguments from user assigned functions * (see FunctionAssignmentNode) or special symbols * like `end` (see IndexNode). * @return {function} Returns a function which can be called like: * evalNode(scope: Object, args: Object, context: *) */ _compile(s, c) { var f = this.args.map((E) => E._compile(s, c)); if ($r(this.fn)) { var d = this.fn.name; if (c[d]) { var y = this.args; return function(N, S, M) { var F = it(S, d); if (typeof F != "function") throw new TypeError("Argument '".concat(d, "' was not a function; received: ").concat(i(F))); if (F.rawArgs) return F(y, s, Ei(N, S)); var $ = f.map((I) => I(N, S, M)); return F.apply(F, $); }; } else { var p = d in s ? it(s, d) : void 0, m = typeof p == "function" && p.rawArgs === !0, v = (E) => { var N; if (E.has(d)) N = E.get(d); else if (d in s) N = it(s, d); else return l.onUndefinedFunction(d); if (typeof N == "function") return N; throw new TypeError("'".concat(d, `' is not a function; its value is: `).concat(i(N))); }; if (m) { var b = this.args; return function(N, S, M) { var F = v(N); if (F.rawArgs === !0) return F(b, s, Ei(N, S)); var $ = f.map((I) => I(N, S, M)); return F(...$); }; } else switch (f.length) { case 0: return function(N, S, M) { var F = v(N); return F(); }; case 1: return function(N, S, M) { var F = v(N), $ = f[0]; return F($(N, S, M)); }; case 2: return function(N, S, M) { var F = v(N), $ = f[0], I = f[1]; return F($(N, S, M), I(N, S, M)); }; default: return function(N, S, M) { var F = v(N), $ = f.map((I) => I(N, S, M)); return F(...$); }; } } } else if (Jn(this.fn) && Na(this.fn.index) && this.fn.index.isObjectProperty()) { var A = this.fn.object._compile(s, c), h = this.fn.index.getObjectProperty(), x = this.args; return function(N, S, M) { var F = A(N, S, M), $ = vC(F, h); if ($ != null && $.rawArgs) return $(x, s, Ei(N, S)); var I = f.map((B) => B(N, S, M)); return $.apply(F, I); }; } else { var w = this.fn.toString(), g = this.fn._compile(s, c), D = this.args; return function(N, S, M) { var F = g(N, S, M); if (typeof F != "function") throw new TypeError("Expression '".concat(w, "' did not evaluate to a function; value is:") + ` `.concat(i(F))); if (F.rawArgs) return F(D, s, Ei(N, S)); var $ = f.map((I) => I(N, S, M)); return F.apply(F, $); }; } } /** * Execute a callback for each of the child nodes of this node * @param {function(child: Node, path: string, parent: Node)} callback */ forEach(s) { s(this.fn, "fn", this); for (var c = 0; c < this.args.length; c++) s(this.args[c], "args[" + c + "]", this); } /** * Create a new FunctionNode whose children are the results of calling * the provided callback function for each child of the original node. * @param {function(child: Node, path: string, parent: Node): Node} callback * @returns {FunctionNode} Returns a transformed copy of the node */ map(s) { for (var c = this._ifNode(s(this.fn, "fn", this)), f = [], d = 0; d < this.args.length; d++) f[d] = this._ifNode(s(this.args[d], "args[" + d + "]", this)); return new l(c, f); } /** * Create a clone of this node, a shallow copy * @return {FunctionNode} */ clone() { return new l(this.fn, this.args.slice(0)); } /** * Throws an error 'Undefined function {name}' * @param {string} name */ /** * Get string representation. (wrapper function) * This overrides parts of Node's toString function. * If callback is an object containing callbacks, it * calls the correct callback for the current node, * otherwise it falls back to calling Node's toString * function. * * @param {Object} options * @return {string} str * @override */ toString(s) { var c, f = this.fn.toString(s); return s && typeof s.handler == "object" && Fe(s.handler, f) && (c = s.handler[f](this, s)), typeof c < "u" ? c : super.toString(s); } /** * Get string representation * @param {Object} options * @return {string} str */ _toString(s) { var c = this.args.map(function(d) { return d.toString(s); }), f = li(this.fn) ? "(" + this.fn.toString(s) + ")" : this.fn.toString(s); return f + "(" + c.join(", ") + ")"; } /** * Get a JSON representation of the node * @returns {Object} */ toJSON() { return { mathjs: _o, fn: this.fn, args: this.args }; } /** * Instantiate an AssignmentNode from its JSON representation * @param {Object} json An object structured like * `{"mathjs": "FunctionNode", fn: ..., args: ...}`, * where mathjs is optional * @returns {FunctionNode} */ /** * Get HTML representation * @param {Object} options * @return {string} str */ _toHTML(s) { var c = this.args.map(function(f) { return f.toHTML(s); }); return '' + Mt(this.fn) + '(' + c.join(',') + ')'; } /** * Get LaTeX representation. (wrapper function) * This overrides parts of Node's toTex function. * If callback is an object containing callbacks, it * calls the correct callback for the current node, * otherwise it falls back to calling Node's toTex * function. * * @param {Object} options * @return {string} */ toTex(s) { var c; return s && typeof s.handler == "object" && Fe(s.handler, this.name) && (c = s.handler[this.name](this, s)), typeof c < "u" ? c : super.toTex(s); } /** * Get LaTeX representation * @param {Object} options * @return {string} str */ _toTex(s) { var c = this.args.map(function(p) { return p.toTex(s); }), f; jm[this.name] && (f = jm[this.name]), t[this.name] && (typeof t[this.name].toTex == "function" || typeof t[this.name].toTex == "object" || typeof t[this.name].toTex == "string") && (f = t[this.name].toTex); var d; switch (typeof f) { case "function": d = f(this, s); break; case "string": d = o(f, this, s); break; case "object": switch (typeof f[c.length]) { case "function": d = f[c.length](this, s); break; case "string": d = o(f[c.length], this, s); break; } } return typeof d < "u" ? d : o(u6, this, s); } /** * Get identifier. * @return {string} */ getIdentifier() { return this.type + ":" + this.name; } } return r = l, Rr(l, "name", _o), Rr(l, "onUndefinedFunction", function(u) { throw new Error("Undefined function " + u); }), Rr(l, "fromJSON", function(u) { return new r(u.fn, u.args); }), l; }, { isClass: !0, isNode: !0 }), Qm = "parse", F6 = ["typed", "numeric", "config", "AccessorNode", "ArrayNode", "AssignmentNode", "BlockNode", "ConditionalNode", "ConstantNode", "FunctionAssignmentNode", "FunctionNode", "IndexNode", "ObjectNode", "OperatorNode", "ParenthesisNode", "RangeNode", "RelationalNode", "SymbolNode"], T6 = /* @__PURE__ */ P(Qm, F6, (e) => { var { typed: r, numeric: t, config: n, AccessorNode: a, ArrayNode: i, AssignmentNode: o, BlockNode: l, ConditionalNode: u, ConstantNode: s, FunctionAssignmentNode: c, FunctionNode: f, IndexNode: d, ObjectNode: p, OperatorNode: m, ParenthesisNode: v, RangeNode: b, RelationalNode: y, SymbolNode: A } = e, h = r(Qm, { string: function(Y) { return X(Y, {}); }, "Array | Matrix": function(Y) { return x(Y, {}); }, "string, Object": function(Y, le) { var be = le.nodes !== void 0 ? le.nodes : {}; return X(Y, be); }, "Array | Matrix, Object": x }); function x(T) { var Y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, le = Y.nodes !== void 0 ? Y.nodes : {}; return je(T, function(be) { if (typeof be != "string") throw new TypeError("String expected"); return X(be, le); }); } var w = { NULL: 0, DELIMITER: 1, NUMBER: 2, SYMBOL: 3, UNKNOWN: 4 }, g = { ",": !0, "(": !0, ")": !0, "[": !0, "]": !0, "{": !0, "}": !0, '"': !0, "'": !0, ";": !0, "+": !0, "-": !0, "*": !0, ".*": !0, "/": !0, "./": !0, "%": !0, "^": !0, ".^": !0, "~": !0, "!": !0, "&": !0, "|": !0, "^|": !0, "=": !0, ":": !0, "?": !0, "==": !0, "!=": !0, "<": !0, ">": !0, "<=": !0, ">=": !0, "<<": !0, ">>": !0, ">>>": !0 }, D = { mod: !0, to: !0, in: !0, and: !0, xor: !0, or: !0, not: !0 }, E = { true: !0, false: !1, null: null, undefined: void 0 }, N = ["NaN", "Infinity"], S = { '"': '"', "'": "'", "\\": "\\", "/": "/", b: "\b", f: "\f", n: ` `, r: "\r", t: " " // note that \u is handled separately in parseStringToken() }; function M() { return { extraNodes: {}, // current extra nodes, must be careful not to mutate expression: "", // current expression comment: "", // last parsed comment index: 0, // current index in expr token: "", // current token tokenType: w.NULL, // type of the token nestingLevel: 0, // level of nesting inside parameters, used to ignore newline characters conditionalLevel: null // when a conditional is being parsed, the level of the conditional is stored here }; } function F(T, Y) { return T.expression.substr(T.index, Y); } function $(T) { return F(T, 1); } function I(T) { T.index++; } function B(T) { return T.expression.charAt(T.index - 1); } function C(T) { return T.expression.charAt(T.index + 1); } function _(T) { for (T.tokenType = w.NULL, T.token = "", T.comment = ""; ; ) { if ($(T) === "#") for (; $(T) !== ` ` && $(T) !== ""; ) T.comment += $(T), I(T); if (h.isWhitespace($(T), T.nestingLevel)) I(T); else break; } if ($(T) === "") { T.tokenType = w.DELIMITER; return; } if ($(T) === ` ` && !T.nestingLevel) { T.tokenType = w.DELIMITER, T.token = $(T), I(T); return; } var Y = $(T), le = F(T, 2), be = F(T, 3); if (be.length === 3 && g[be]) { T.tokenType = w.DELIMITER, T.token = be, I(T), I(T), I(T); return; } if (le.length === 2 && g[le]) { T.tokenType = w.DELIMITER, T.token = le, I(T), I(T); return; } if (g[Y]) { T.tokenType = w.DELIMITER, T.token = Y, I(T); return; } if (h.isDigitDot(Y)) { T.tokenType = w.NUMBER; var Pe = F(T, 2); if (Pe === "0b" || Pe === "0o" || Pe === "0x") { for (T.token += $(T), I(T), T.token += $(T), I(T); h.isHexDigit($(T)); ) T.token += $(T), I(T); if ($(T) === ".") for (T.token += ".", I(T); h.isHexDigit($(T)); ) T.token += $(T), I(T); else if ($(T) === "i") for (T.token += "i", I(T); h.isDigit($(T)); ) T.token += $(T), I(T); return; } if ($(T) === ".") { if (T.token += $(T), I(T), !h.isDigit($(T))) { T.tokenType = w.DELIMITER; return; } } else { for (; h.isDigit($(T)); ) T.token += $(T), I(T); h.isDecimalMark($(T), C(T)) && (T.token += $(T), I(T)); } for (; h.isDigit($(T)); ) T.token += $(T), I(T); if ($(T) === "E" || $(T) === "e") { if (h.isDigit(C(T)) || C(T) === "-" || C(T) === "+") { if (T.token += $(T), I(T), ($(T) === "+" || $(T) === "-") && (T.token += $(T), I(T)), !h.isDigit($(T))) throw Ue(T, 'Digit expected, got "' + $(T) + '"'); for (; h.isDigit($(T)); ) T.token += $(T), I(T); if (h.isDecimalMark($(T), C(T))) throw Ue(T, 'Digit expected, got "' + $(T) + '"'); } else if (C(T) === ".") throw I(T), Ue(T, 'Digit expected, got "' + $(T) + '"'); } return; } if (h.isAlpha($(T), B(T), C(T))) { for (; h.isAlpha($(T), B(T), C(T)) || h.isDigit($(T)); ) T.token += $(T), I(T); Fe(D, T.token) ? T.tokenType = w.DELIMITER : T.tokenType = w.SYMBOL; return; } for (T.tokenType = w.UNKNOWN; $(T) !== ""; ) T.token += $(T), I(T); throw Ue(T, 'Syntax error in part "' + T.token + '"'); } function z(T) { do _(T); while (T.token === ` `); } function O(T) { T.nestingLevel++; } function W(T) { T.nestingLevel--; } h.isAlpha = function(Y, le, be) { return h.isValidLatinOrGreek(Y) || h.isValidMathSymbol(Y, be) || h.isValidMathSymbol(le, Y); }, h.isValidLatinOrGreek = function(Y) { return /^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(Y); }, h.isValidMathSymbol = function(Y, le) { return /^[\uD835]$/.test(Y) && /^[\uDC00-\uDFFF]$/.test(le) && /^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(le); }, h.isWhitespace = function(Y, le) { return Y === " " || Y === " " || Y === ` ` && le > 0; }, h.isDecimalMark = function(Y, le) { return Y === "." && le !== "/" && le !== "*" && le !== "^"; }, h.isDigitDot = function(Y) { return Y >= "0" && Y <= "9" || Y === "."; }, h.isDigit = function(Y) { return Y >= "0" && Y <= "9"; }, h.isHexDigit = function(Y) { return Y >= "0" && Y <= "9" || Y >= "a" && Y <= "f" || Y >= "A" && Y <= "F"; }; function X(T, Y) { var le = M(); jr(le, { expression: T, extraNodes: Y }), _(le); var be = V(le); if (le.token !== "") throw le.tokenType === w.DELIMITER ? xr(le, "Unexpected operator " + le.token) : Ue(le, 'Unexpected part "' + le.token + '"'); return be; } function V(T) { var Y, le = [], be; for (T.token !== "" && T.token !== ` ` && T.token !== ";" && (Y = R(T), T.comment && (Y.comment = T.comment)); T.token === ` ` || T.token === ";"; ) le.length === 0 && Y && (be = T.token !== ";", le.push({ node: Y, visible: be })), _(T), T.token !== ` ` && T.token !== ";" && T.token !== "" && (Y = R(T), T.comment && (Y.comment = T.comment), be = T.token !== ";", le.push({ node: Y, visible: be })); return le.length > 0 ? new l(le) : (Y || (Y = new s(void 0), T.comment && (Y.comment = T.comment)), Y); } function R(T) { var Y, le, be, Pe, Ge = Q(T); if (T.token === "=") { if ($r(Ge)) return Y = Ge.name, z(T), be = R(T), new o(new A(Y), be); if (Jn(Ge)) return z(T), be = R(T), new o(Ge.object, Ge.index, be); if (En(Ge) && $r(Ge.fn) && (Pe = !0, le = [], Y = Ge.name, Ge.args.forEach(function(rt, vi) { $r(rt) ? le[vi] = rt.name : Pe = !1; }), Pe)) return z(T), be = R(T), new c(Y, le, be); throw Ue(T, "Invalid left hand side of assignment operator ="); } return Ge; } function Q(T) { for (var Y = se(T); T.token === "?"; ) { var le = T.conditionalLevel; T.conditionalLevel = T.nestingLevel, z(T); var be = Y, Pe = R(T); if (T.token !== ":") throw Ue(T, "False part of conditional expression expected"); T.conditionalLevel = null, z(T); var Ge = R(T); Y = new u(be, Pe, Ge), T.conditionalLevel = le; } return Y; } function se(T) { for (var Y = re(T); T.token === "or"; ) z(T), Y = new m("or", "or", [Y, re(T)]); return Y; } function re(T) { for (var Y = q(T); T.token === "xor"; ) z(T), Y = new m("xor", "xor", [Y, q(T)]); return Y; } function q(T) { for (var Y = Z(T); T.token === "and"; ) z(T), Y = new m("and", "and", [Y, Z(T)]); return Y; } function Z(T) { for (var Y = K(T); T.token === "|"; ) z(T), Y = new m("|", "bitOr", [Y, K(T)]); return Y; } function K(T) { for (var Y = j(T); T.token === "^|"; ) z(T), Y = new m("^|", "bitXor", [Y, j(T)]); return Y; } function j(T) { for (var Y = ee(T); T.token === "&"; ) z(T), Y = new m("&", "bitAnd", [Y, ee(T)]); return Y; } function ee(T) { for (var Y = [te(T)], le = [], be = { "==": "equal", "!=": "unequal", "<": "smaller", ">": "larger", "<=": "smallerEq", ">=": "largerEq" }; Fe(be, T.token); ) { var Pe = { name: T.token, fn: be[T.token] }; le.push(Pe), z(T), Y.push(te(T)); } return Y.length === 1 ? Y[0] : Y.length === 2 ? new m(le[0].name, le[0].fn, Y) : new y(le.map((Ge) => Ge.fn), Y); } function te(T) { var Y, le, be, Pe; Y = oe(T); for (var Ge = { "<<": "leftShift", ">>": "rightArithShift", ">>>": "rightLogShift" }; Fe(Ge, T.token); ) le = T.token, be = Ge[le], z(T), Pe = [Y, oe(T)], Y = new m(le, be, Pe); return Y; } function oe(T) { var Y, le, be, Pe; Y = ge(T); for (var Ge = { to: "to", in: "to" // alias of 'to' }; Fe(Ge, T.token); ) le = T.token, be = Ge[le], z(T), le === "in" && T.token === "" ? Y = new m("*", "multiply", [Y, new A("in")], !0) : (Pe = [Y, ge(T)], Y = new m(le, be, Pe)); return Y; } function ge(T) { var Y, le = []; if (T.token === ":" ? Y = new s(1) : Y = L(T), T.token === ":" && T.conditionalLevel !== T.nestingLevel) { for (le.push(Y); T.token === ":" && le.length < 3; ) z(T), T.token === ")" || T.token === "]" || T.token === "," || T.token === "" ? le.push(new A("end")) : le.push(L(T)); le.length === 3 ? Y = new b(le[0], le[2], le[1]) : Y = new b(le[0], le[1]); } return Y; } function L(T) { var Y, le, be, Pe; Y = H(T); for (var Ge = { "+": "add", "-": "subtract" }; Fe(Ge, T.token); ) { le = T.token, be = Ge[le], z(T); var rt = H(T); rt.isPercentage ? Pe = [Y, new m("*", "multiply", [Y, rt])] : Pe = [Y, rt], Y = new m(le, be, Pe); } return Y; } function H(T) { var Y, le, be, Pe; Y = ne(T), le = Y; for (var Ge = { "*": "multiply", ".*": "dotMultiply", "/": "divide", "./": "dotDivide" }; Fe(Ge, T.token); ) be = T.token, Pe = Ge[be], z(T), le = ne(T), Y = new m(be, Pe, [Y, le]); return Y; } function ne(T) { var Y, le; for (Y = ie(T), le = Y; T.tokenType === w.SYMBOL || T.token === "in" && nr(Y) || T.token === "in" && _r(Y) && Y.fn === "unaryMinus" && nr(Y.args[0]) || T.tokenType === w.NUMBER && !nr(le) && (!_r(le) || le.op === "!") || T.token === "("; ) le = ie(T), Y = new m( "*", "multiply", [Y, le], !0 /* implicit */ ); return Y; } function ie(T) { for (var Y = me(T), le = Y, be = []; T.token === "/" && Pu(le); ) if (be.push(jr({}, T)), z(T), T.tokenType === w.NUMBER) if (be.push(jr({}, T)), z(T), T.tokenType === w.SYMBOL || T.token === "(" || T.token === "in") jr(T, be.pop()), be.pop(), le = me(T), Y = new m("/", "divide", [Y, le]); else { be.pop(), jr(T, be.pop()); break; } else { jr(T, be.pop()); break; } return Y; } function me(T) { var Y, le, be, Pe; Y = pe(T); for (var Ge = { "%": "mod", mod: "mod" }; Fe(Ge, T.token); ) le = T.token, be = Ge[le], z(T), le === "%" && T.tokenType === w.DELIMITER && T.token !== "(" ? Y = new m("/", "divide", [Y, new s(100)], !1, !0) : (Pe = [Y, pe(T)], Y = new m(le, be, Pe)); return Y; } function pe(T) { var Y, le, be, Pe = { "-": "unaryMinus", "+": "unaryPlus", "~": "bitNot", not: "not" }; return Fe(Pe, T.token) ? (be = Pe[T.token], Y = T.token, z(T), le = [pe(T)], new m(Y, be, le)) : xe(T); } function xe(T) { var Y, le, be, Pe; return Y = De(T), (T.token === "^" || T.token === ".^") && (le = T.token, be = le === "^" ? "pow" : "dotPow", z(T), Pe = [Y, pe(T)], Y = new m(le, be, Pe)), Y; } function De(T) { var Y, le, be, Pe; Y = k(T); for (var Ge = { "!": "factorial", "'": "ctranspose" }; Fe(Ge, T.token); ) le = T.token, be = Ge[le], _(T), Pe = [Y], Y = new m(le, be, Pe), Y = G(T, Y); return Y; } function k(T) { var Y = []; if (T.tokenType === w.SYMBOL && Fe(T.extraNodes, T.token)) { var le = T.extraNodes[T.token]; if (_(T), T.token === "(") { if (Y = [], O(T), _(T), T.token !== ")") for (Y.push(R(T)); T.token === ","; ) _(T), Y.push(R(T)); if (T.token !== ")") throw Ue(T, "Parenthesis ) expected"); W(T), _(T); } return new le(Y); } return J(T); } function J(T) { var Y, le; return T.tokenType === w.SYMBOL || T.tokenType === w.DELIMITER && T.token in D ? (le = T.token, _(T), Fe(E, le) ? Y = new s(E[le]) : N.includes(le) ? Y = new s(t(le, "number")) : Y = new A(le), Y = G(T, Y), Y) : ae(T); } function G(T, Y, le) { for (var be; T.token === "(" || T.token === "[" || T.token === "."; ) if (be = [], T.token === "(") if ($r(Y) || Jn(Y)) { if (O(T), _(T), T.token !== ")") for (be.push(R(T)); T.token === ","; ) _(T), be.push(R(T)); if (T.token !== ")") throw Ue(T, "Parenthesis ) expected"); W(T), _(T), Y = new f(Y, be); } else return Y; else if (T.token === "[") { if (O(T), _(T), T.token !== "]") for (be.push(R(T)); T.token === ","; ) _(T), be.push(R(T)); if (T.token !== "]") throw Ue(T, "Parenthesis ] expected"); W(T), _(T), Y = new a(Y, new d(be)); } else { _(T); var Pe = T.tokenType === w.SYMBOL || T.tokenType === w.DELIMITER && T.token in D; if (!Pe) throw Ue(T, "Property name expected after dot"); be.push(new s(T.token)), _(T); var Ge = !0; Y = new a(Y, new d(be, Ge)); } return Y; } function ae(T) { var Y, le; return T.token === '"' || T.token === "'" ? (le = fe(T, T.token), Y = new s(le), Y = G(T, Y), Y) : de(T); } function fe(T, Y) { for (var le = ""; $(T) !== "" && $(T) !== Y; ) if ($(T) === "\\") { I(T); var be = $(T), Pe = S[be]; if (Pe !== void 0) le += Pe, T.index += 1; else if (be === "u") { var Ge = T.expression.slice(T.index + 1, T.index + 5); if (/^[0-9A-Fa-f]{4}$/.test(Ge)) le += String.fromCharCode(parseInt(Ge, 16)), T.index += 5; else throw Ue(T, "Invalid unicode character \\u".concat(Ge)); } else throw Ue(T, "Bad escape character \\".concat(be)); } else le += $(T), I(T); if (_(T), T.token !== Y) throw Ue(T, "End of string ".concat(Y, " expected")); return _(T), le; } function de(T) { var Y, le, be, Pe; if (T.token === "[") { if (O(T), _(T), T.token !== "]") { var Ge = Ne(T); if (T.token === ";") { for (be = 1, le = [Ge]; T.token === ";"; ) _(T), T.token !== "]" && (le[be] = Ne(T), be++); if (T.token !== "]") throw Ue(T, "End of matrix ] expected"); W(T), _(T), Pe = le[0].items.length; for (var rt = 1; rt < be; rt++) if (le[rt].items.length !== Pe) throw xr(T, "Column dimensions mismatch (" + le[rt].items.length + " !== " + Pe + ")"); Y = new i(le); } else { if (T.token !== "]") throw Ue(T, "End of matrix ] expected"); W(T), _(T), Y = Ge; } } else W(T), _(T), Y = new i([]); return G(T, Y); } return we(T); } function Ne(T) { for (var Y = [R(T)], le = 1; T.token === ","; ) _(T), T.token !== "]" && T.token !== ";" && (Y[le] = R(T), le++); return new i(Y); } function we(T) { if (T.token === "{") { O(T); var Y, le = {}; do if (_(T), T.token !== "}") { if (T.token === '"' || T.token === "'") Y = fe(T, T.token); else if (T.tokenType === w.SYMBOL || T.tokenType === w.DELIMITER && T.token in D) Y = T.token, _(T); else throw Ue(T, "Symbol or string expected as object key"); if (T.token !== ":") throw Ue(T, "Colon : expected after object key"); _(T), le[Y] = R(T); } while (T.token === ","); if (T.token !== "}") throw Ue(T, "Comma , or bracket } expected after object value"); W(T), _(T); var be = new p(le); return be = G(T, be), be; } return Ee(T); } function Ee(T) { var Y; if (T.tokenType === w.NUMBER) { Y = T.token, _(T); var le = Qn(Y, n), be = t(Y, le); return new s(be); } return Ae(T); } function Ae(T) { var Y; if (T.token === "(") { if (O(T), _(T), Y = R(T), T.token !== ")") throw Ue(T, "Parenthesis ) expected"); return W(T), _(T), Y = new v(Y), Y = G(T, Y), Y; } return ar(T); } function ar(T) { throw T.token === "" ? Ue(T, "Unexpected end of expression") : Ue(T, "Value expected"); } function ir(T) { return T.index - T.token.length + 1; } function Ue(T, Y) { var le = ir(T), be = new SyntaxError(Y + " (char " + le + ")"); return be.char = le, be; } function xr(T, Y) { var le = ir(T), be = new SyntaxError(Y + " (char " + le + ")"); return be.char = le, be; } return r.addConversion({ from: "string", to: "Node", convert: h }), h; }), ev = "compile", O6 = ["typed", "parse"], B6 = /* @__PURE__ */ P(ev, O6, (e) => { var { typed: r, parse: t } = e; return r(ev, { string: function(a) { return t(a).compile(); }, "Array | Matrix": function(a) { return je(a, function(i) { return t(i).compile(); }); } }); }), rv = "evaluate", $6 = ["typed", "parse"], I6 = /* @__PURE__ */ P(rv, $6, (e) => { var { typed: r, parse: t } = e; return r(rv, { string: function(a) { var i = Ii(); return t(a).compile().evaluate(i); }, "string, Map | Object": function(a, i) { return t(a).compile().evaluate(i); }, "Array | Matrix": function(a) { var i = Ii(); return je(a, function(o) { return t(o).compile().evaluate(i); }); }, "Array | Matrix, Map | Object": function(a, i) { return je(a, function(o) { return t(o).compile().evaluate(i); }); } }); }), R6 = "Parser", P6 = ["evaluate", "parse"], z6 = /* @__PURE__ */ P(R6, P6, (e) => { var { evaluate: r, parse: t } = e; function n() { if (!(this instanceof n)) throw new SyntaxError("Constructor must be called with the new operator"); Object.defineProperty(this, "scope", { value: Ii(), writable: !1 }); } n.prototype.type = "Parser", n.prototype.isParser = !0, n.prototype.evaluate = function(i) { return r(i, this.scope); }, n.prototype.get = function(i) { if (this.scope.has(i)) return this.scope.get(i); }, n.prototype.getAll = function() { return bC(this.scope); }, n.prototype.getAllAsMap = function() { return this.scope; }; function a(i) { if (i.length === 0) return !1; for (var o = 0; o < i.length; o++) { var l = i.charAt(o - 1), u = i.charAt(o), s = i.charAt(o + 1), c = t.isAlpha(u, l, s) || o > 0 && t.isDigit(u); if (!c) return !1; } return !0; } return n.prototype.set = function(i, o) { if (!a(i)) throw new Error("Invalid variable name: '".concat(i, "'. Variable names must follow the specified rules.")); return this.scope.set(i, o), o; }, n.prototype.remove = function(i) { this.scope.delete(i); }, n.prototype.clear = function() { this.scope.clear(); }, n; }, { isClass: !0 }), tv = "parser", q6 = ["typed", "Parser"], L6 = /* @__PURE__ */ P(tv, q6, (e) => { var { typed: r, Parser: t } = e; return r(tv, { "": function() { return new t(); } }); }), nv = "lup", U6 = ["typed", "matrix", "abs", "addScalar", "divideScalar", "multiplyScalar", "subtractScalar", "larger", "equalScalar", "unaryMinus", "DenseMatrix", "SparseMatrix", "Spa"], k6 = /* @__PURE__ */ P(nv, U6, (e) => { var { typed: r, matrix: t, abs: n, addScalar: a, divideScalar: i, multiplyScalar: o, subtractScalar: l, larger: u, equalScalar: s, unaryMinus: c, DenseMatrix: f, SparseMatrix: d, Spa: p } = e; return r(nv, { DenseMatrix: function(y) { return m(y); }, SparseMatrix: function(y) { return v(y); }, Array: function(y) { var A = t(y), h = m(A); return { L: h.L.valueOf(), U: h.U.valueOf(), p: h.p }; } }); function m(b) { var y = b._size[0], A = b._size[1], h = Math.min(y, A), x = qe(b._data), w = [], g = [y, h], D = [], E = [h, A], N, S, M, F = []; for (N = 0; N < y; N++) F[N] = N; for (S = 0; S < A; S++) { if (S > 0) for (N = 0; N < y; N++) { var $ = Math.min(N, S), I = 0; for (M = 0; M < $; M++) I = a(I, o(x[N][M], x[M][S])); x[N][S] = l(x[N][S], I); } var B = S, C = 0, _ = 0; for (N = S; N < y; N++) { var z = x[N][S], O = n(z); u(O, C) && (B = N, C = O, _ = z); } if (S !== B && (F[S] = [F[B], F[B] = F[S]][0], f._swapRows(S, B, x)), S < y) for (N = S + 1; N < y; N++) { var W = x[N][S]; s(W, 0) || (x[N][S] = i(x[N][S], _)); } } for (S = 0; S < A; S++) for (N = 0; N < y; N++) { if (S === 0 && (N < A && (D[N] = []), w[N] = []), N < S) { N < A && (D[N][S] = x[N][S]), S < y && (w[N][S] = 0); continue; } if (N === S) { N < A && (D[N][S] = x[N][S]), S < y && (w[N][S] = 1); continue; } N < A && (D[N][S] = 0), S < y && (w[N][S] = x[N][S]); } var X = new f({ data: w, size: g }), V = new f({ data: D, size: E }), R = []; for (N = 0, h = F.length; N < h; N++) R[F[N]] = N; return { L: X, U: V, p: R, toString: function() { return "L: " + this.L.toString() + ` U: ` + this.U.toString() + ` P: ` + this.p; } }; } function v(b) { var y = b._size[0], A = b._size[1], h = Math.min(y, A), x = b._values, w = b._index, g = b._ptr, D = [], E = [], N = [], S = [y, h], M = [], F = [], $ = [], I = [h, A], B, C, _, z = [], O = []; for (B = 0; B < y; B++) z[B] = B, O[B] = B; var W = function(R, Q) { var se = O[R], re = O[Q]; z[se] = Q, z[re] = R, O[R] = re, O[Q] = se; }, X = function() { var R = new p(); C < y && (N.push(D.length), D.push(1), E.push(C)), $.push(M.length); var Q = g[C], se = g[C + 1]; for (_ = Q; _ < se; _++) B = w[_], R.set(z[B], x[_]); C > 0 && R.forEach(0, C - 1, function(K, j) { d._forEachRow(K, D, E, N, function(ee, te) { ee > K && R.accumulate(ee, c(o(te, j))); }); }); var re = C, q = R.get(C), Z = n(q); R.forEach(C + 1, y - 1, function(K, j) { var ee = n(j); u(ee, Z) && (re = K, Z = ee, q = j); }), C !== re && (d._swapRows(C, re, S[1], D, E, N), d._swapRows(C, re, I[1], M, F, $), R.swap(C, re), W(C, re)), R.forEach(0, y - 1, function(K, j) { K <= C ? (M.push(j), F.push(K)) : (j = i(j, q), s(j, 0) || (D.push(j), E.push(K))); }); }; for (C = 0; C < A; C++) X(); return $.push(M.length), N.push(D.length), { L: new d({ values: D, index: E, ptr: N, size: S }), U: new d({ values: M, index: F, ptr: $, size: I }), p: z, toString: function() { return "L: " + this.L.toString() + ` U: ` + this.U.toString() + ` P: ` + this.p; } }; } }), av = "qr", V6 = ["typed", "matrix", "zeros", "identity", "isZero", "equal", "sign", "sqrt", "conj", "unaryMinus", "addScalar", "divideScalar", "multiplyScalar", "subtractScalar", "complex"], H6 = /* @__PURE__ */ P(av, V6, (e) => { var { typed: r, matrix: t, zeros: n, identity: a, isZero: i, equal: o, sign: l, sqrt: u, conj: s, unaryMinus: c, addScalar: f, divideScalar: d, multiplyScalar: p, subtractScalar: m, complex: v } = e; return jr(r(av, { DenseMatrix: function(x) { return y(x); }, SparseMatrix: function(x) { return A(); }, Array: function(x) { var w = t(x), g = y(w); return { Q: g.Q.valueOf(), R: g.R.valueOf() }; } }), { _denseQRimpl: b }); function b(h) { var x = h._size[0], w = h._size[1], g = a([x], "dense"), D = g._data, E = h.clone(), N = E._data, S, M, F, $ = n([x], ""); for (F = 0; F < Math.min(w, x); ++F) { var I = N[F][F], B = c(o(I, 0) ? 1 : l(I)), C = s(B), _ = 0; for (S = F; S < x; S++) _ = f(_, p(N[S][F], s(N[S][F]))); var z = p(B, u(_)); if (!i(z)) { var O = m(I, z); for ($[F] = 1, S = F + 1; S < x; S++) $[S] = d(N[S][F], O); var W = c(s(d(O, z))), X = void 0; for (M = F; M < w; M++) { for (X = 0, S = F; S < x; S++) X = f(X, p(s($[S]), N[S][M])); for (X = p(X, W), S = F; S < x; S++) N[S][M] = p(m(N[S][M], p($[S], X)), C); } for (S = 0; S < x; S++) { for (X = 0, M = F; M < x; M++) X = f(X, p(D[S][M], $[M])); for (X = p(X, W), M = F; M < x; ++M) D[S][M] = d(m(D[S][M], p(X, s($[M]))), C); } } } return { Q: g, R: E, toString: function() { return "Q: " + this.Q.toString() + ` R: ` + this.R.toString(); } }; } function y(h) { var x = b(h), w = x.R._data; if (h._data.length > 0) for (var g = w[0][0].type === "Complex" ? v(0) : 0, D = 0; D < w.length; ++D) for (var E = 0; E < D && E < (w[0] || []).length; ++E) w[D][E] = g; return x; } function A(h) { throw new Error("qr not implemented for sparse matrices yet"); } }); function Z6(e, r, t, n) { e._values; for (var a = e._index, i = e._ptr, o = e._size, l = e._datatype, u = o[0], s = o[1], c = null, f = [], d = [], p = 0, m = 0; m < s; m++) { d[m] = p; for (var v = t ? t[m] : m, b = i[v], y = i[v + 1], A = b; A < y; A++) { var h = a[A]; f[p] = h, p++; } } return d[s] = p, e.createSparseMatrix({ values: c, index: f, ptr: d, size: [u, s], datatype: l }); } function Zy(e, r, t, n, a, i, o) { var l = 0; for (t[o] = e; l >= 0; ) { var u = t[o + l], s = t[n + u]; s === -1 ? (l--, i[r++] = u) : (t[n + u] = t[a + s], ++l, t[o + l] = s); } return r; } function G6(e, r) { if (!e) return null; var t = 0, n, a = [], i = [], o = 0, l = r, u = 2 * r; for (n = 0; n < r; n++) i[o + n] = -1; for (n = r - 1; n >= 0; n--) e[n] !== -1 && (i[l + n] = i[o + e[n]], i[o + e[n]] = n); for (n = 0; n < r; n++) e[n] === -1 && (t = Zy(n, t, i, o, l, a, u)); return a; } function W6(e, r) { if (!e) return null; var t = e._index, n = e._ptr, a = e._size, i = a[0], o = a[1], l = [], u = [], s = 0, c = o, f, d; for (f = 0; f < i; f++) u[c + f] = -1; for (var p = 0; p < o; p++) { l[p] = -1, u[s + p] = -1; for (var m = n[p], v = n[p + 1], b = m; b < v; b++) { var y = t[b]; for (f = u[c + y]; f !== -1 && f < p; f = d) d = u[s + f], u[s + f] = p, d === -1 && (l[f] = p); u[c + y] = p; } } return l; } function K6(e, r, t) { for (var n = e._values, a = e._index, i = e._ptr, o = e._size, l = o[1], u = 0, s = 0; s < l; s++) { var c = i[s]; for (i[s] = u; c < i[s + 1]; c++) r(a[c], s, n ? n[c] : 1, t) && (a[u] = a[c], n && (n[u] = n[c]), u++); } return i[l] = u, a.splice(u, a.length - u), n && n.splice(u, n.length - u), u; } function qn(e) { return -e - 2; } var J6 = "csAmd", Y6 = ["add", "multiply", "transpose"], j6 = /* @__PURE__ */ P(J6, Y6, (e) => { var { add: r, multiply: t, transpose: n } = e; return function(c, f) { if (!f || c <= 0 || c > 3) return null; var d = f._size, p = d[0], m = d[1], v = 0, b = Math.max(16, 10 * Math.sqrt(m)); b = Math.min(m - 2, b); var y = a(c, f, p, m, b); K6(y, u, null); for (var A = y._index, h = y._ptr, x = h[m], w = [], g = [], D = 0, E = m + 1, N = 2 * (m + 1), S = 3 * (m + 1), M = 4 * (m + 1), F = 5 * (m + 1), $ = 6 * (m + 1), I = 7 * (m + 1), B = w, C = i(m, h, g, D, S, B, N, I, E, $, M, F), _ = o(m, h, g, F, M, $, b, E, S, B, N), z = 0, O, W, X, V, R, Q, se, re, q, Z, K, j, ee, te, oe, ge; _ < m; ) { for (X = -1; z < m && (X = g[S + z]) === -1; z++) ; g[N + X] !== -1 && (B[g[N + X]] = -1), g[S + z] = g[N + X]; var L = g[M + X], H = g[E + X]; _ += H; var ne = 0; g[E + X] = -H; var ie = h[X], me = L === 0 ? ie : x, pe = me; for (V = 1; V <= L + 1; V++) { for (V > L ? (Q = X, se = ie, re = g[D + X] - L) : (Q = A[ie++], se = h[Q], re = g[D + Q]), R = 1; R <= re; R++) O = A[se++], !((q = g[E + O]) <= 0) && (ne += q, g[E + O] = -q, A[pe++] = O, g[N + O] !== -1 && (B[g[N + O]] = B[O]), B[O] !== -1 ? g[N + B[O]] = g[N + O] : g[S + g[F + O]] = g[N + O]); Q !== X && (h[Q] = qn(X), g[$ + Q] = 0); } for (L !== 0 && (x = pe), g[F + X] = ne, h[X] = me, g[D + X] = pe - me, g[M + X] = -2, C = l(C, v, g, $, m), Z = me; Z < pe; Z++) if (O = A[Z], !((K = g[M + O]) <= 0)) { q = -g[E + O]; var xe = C - q; for (ie = h[O], j = h[O] + K - 1; ie <= j; ie++) Q = A[ie], g[$ + Q] >= C ? g[$ + Q] -= q : g[$ + Q] !== 0 && (g[$ + Q] = g[F + Q] + xe); } for (Z = me; Z < pe; Z++) { for (O = A[Z], j = h[O], ee = j + g[M + O] - 1, te = j, oe = 0, ge = 0, ie = j; ie <= ee; ie++) if (Q = A[ie], g[$ + Q] !== 0) { var De = g[$ + Q] - C; De > 0 ? (ge += De, A[te++] = Q, oe += Q) : (h[Q] = qn(X), g[$ + Q] = 0); } g[M + O] = te - j + 1; var k = te, J = j + g[D + O]; for (ie = ee + 1; ie < J; ie++) { W = A[ie]; var G = g[E + W]; G <= 0 || (ge += G, A[te++] = W, oe += W); } ge === 0 ? (h[O] = qn(X), q = -g[E + O], ne -= q, H += q, _ += q, g[E + O] = 0, g[M + O] = -1) : (g[F + O] = Math.min(g[F + O], ge), A[te] = A[k], A[k] = A[j], A[j] = X, g[D + O] = te - j + 1, oe = (oe < 0 ? -oe : oe) % m, g[N + O] = g[I + oe], g[I + oe] = O, B[O] = oe); } for (g[F + X] = ne, v = Math.max(v, ne), C = l(C + v, v, g, $, m), Z = me; Z < pe; Z++) if (O = A[Z], !(g[E + O] >= 0)) for (oe = B[O], O = g[I + oe], g[I + oe] = -1; O !== -1 && g[N + O] !== -1; O = g[N + O], C++) { for (re = g[D + O], K = g[M + O], ie = h[O] + 1; ie <= h[O] + re - 1; ie++) g[$ + A[ie]] = C; var ae = O; for (W = g[N + O]; W !== -1; ) { var fe = g[D + W] === re && g[M + W] === K; for (ie = h[W] + 1; fe && ie <= h[W] + re - 1; ie++) g[$ + A[ie]] !== C && (fe = 0); fe ? (h[W] = qn(O), g[E + O] += g[E + W], g[E + W] = 0, g[M + W] = -1, W = g[N + W], g[N + ae] = W) : (ae = W, W = g[N + W]); } } for (ie = me, Z = me; Z < pe; Z++) O = A[Z], !((q = -g[E + O]) <= 0) && (g[E + O] = q, ge = g[F + O] + ne - q, ge = Math.min(ge, m - _ - q), g[S + ge] !== -1 && (B[g[S + ge]] = O), g[N + O] = g[S + ge], B[O] = -1, g[S + ge] = O, z = Math.min(z, ge), g[F + O] = ge, A[ie++] = O); g[E + X] = H, (g[D + X] = ie - me) === 0 && (h[X] = -1, g[$ + X] = 0), L !== 0 && (x = ie); } for (O = 0; O < m; O++) h[O] = qn(h[O]); for (W = 0; W <= m; W++) g[S + W] = -1; for (W = m; W >= 0; W--) g[E + W] > 0 || (g[N + W] = g[S + h[W]], g[S + h[W]] = W); for (Q = m; Q >= 0; Q--) g[E + Q] <= 0 || h[Q] !== -1 && (g[N + Q] = g[S + h[Q]], g[S + h[Q]] = Q); for (X = 0, O = 0; O <= m; O++) h[O] === -1 && (X = Zy(O, X, g, S, N, w, $)); return w.splice(w.length - 1, 1), w; }; function a(s, c, f, d, p) { var m = n(c); if (s === 1 && d === f) return r(c, m); if (s === 2) { for (var v = m._index, b = m._ptr, y = 0, A = 0; A < f; A++) { var h = b[A]; if (b[A] = y, !(b[A + 1] - h > p)) for (var x = b[A + 1]; h < x; h++) v[y++] = v[h]; } return b[f] = y, c = n(m), t(m, c); } return t(m, c); } function i(s, c, f, d, p, m, v, b, y, A, h, x) { for (var w = 0; w < s; w++) f[d + w] = c[w + 1] - c[w]; f[d + s] = 0; for (var g = 0; g <= s; g++) f[p + g] = -1, m[g] = -1, f[v + g] = -1, f[b + g] = -1, f[y + g] = 1, f[A + g] = 1, f[h + g] = 0, f[x + g] = f[d + g]; var D = l(0, 0, f, A, s); return f[h + s] = -2, c[s] = -1, f[A + s] = 0, D; } function o(s, c, f, d, p, m, v, b, y, A, h) { for (var x = 0, w = 0; w < s; w++) { var g = f[d + w]; if (g === 0) f[p + w] = -2, x++, c[w] = -1, f[m + w] = 0; else if (g > v) f[b + w] = 0, f[p + w] = -1, x++, c[w] = qn(s), f[b + s]++; else { var D = f[y + g]; D !== -1 && (A[D] = w), f[h + w] = f[y + g], f[y + g] = w; } } return x; } function l(s, c, f, d, p) { if (s < 2 || s + c < 0) { for (var m = 0; m < p; m++) f[d + m] !== 0 && (f[d + m] = 1); s = 2; } return s; } function u(s, c) { return s !== c; } }); function X6(e, r, t, n, a, i, o) { var l, u, s = 0, c; if (e <= r || t[n + r] <= t[a + e]) return -1; t[a + e] = t[n + r]; var f = t[i + e]; if (t[i + e] = r, f === -1) s = 1, c = e; else { for (s = 2, c = f; c !== t[o + c]; c = t[o + c]) ; for (l = f; l !== c; l = u) u = t[o + l], t[o + l] = c; } return { jleaf: s, q: c }; } var Q6 = "csCounts", e$ = ["transpose"], r$ = /* @__PURE__ */ P(Q6, e$, (e) => { var { transpose: r } = e; return function(t, n, a, i) { if (!t || !n || !a) return null; var o = t._size, l = o[0], u = o[1], s, c, f, d, p, m, v, b = 4 * u + (i ? u + l + 1 : 0), y = [], A = 0, h = u, x = 2 * u, w = 3 * u, g = 4 * u, D = 5 * u + 1; for (f = 0; f < b; f++) y[f] = -1; var E = [], N = r(t), S = N._index, M = N._ptr; for (f = 0; f < u; f++) for (c = a[f], E[c] = y[w + c] === -1 ? 1 : 0; c !== -1 && y[w + c] === -1; c = n[c]) y[w + c] = f; if (i) { for (f = 0; f < u; f++) y[a[f]] = f; for (s = 0; s < l; s++) { for (f = u, m = M[s], v = M[s + 1], p = m; p < v; p++) f = Math.min(f, y[S[p]]); y[D + s] = y[g + f], y[g + f] = s; } } for (s = 0; s < u; s++) y[A + s] = s; for (f = 0; f < u; f++) { for (c = a[f], n[c] !== -1 && E[n[c]]--, d = i ? y[g + f] : c; d !== -1; d = i ? y[D + d] : -1) for (p = M[d]; p < M[d + 1]; p++) { s = S[p]; var F = X6(s, c, y, w, h, x, A); F.jleaf >= 1 && E[c]++, F.jleaf === 2 && E[F.q]--; } n[c] !== -1 && (y[A + c] = n[c]); } for (c = 0; c < u; c++) n[c] !== -1 && (E[n[c]] += E[c]); return E; }; }), t$ = "csSqr", n$ = ["add", "multiply", "transpose"], a$ = /* @__PURE__ */ P(t$, n$, (e) => { var { add: r, multiply: t, transpose: n } = e, a = j6({ add: r, multiply: t, transpose: n }), i = r$({ transpose: n }); return function(u, s, c) { var f = s._ptr, d = s._size, p = d[1], m, v = {}; if (v.q = a(u, s), u && !v.q) return null; if (c) { var b = u ? Z6(s, null, v.q) : s; v.parent = W6(b); var y = G6(v.parent, p); if (v.cp = i(b, v.parent, y, 1), b && v.parent && v.cp && o(b, v)) for (v.unz = 0, m = 0; m < p; m++) v.unz += v.cp[m]; } else v.unz = 4 * f[p] + p, v.lnz = v.unz; return v; }; function o(l, u) { var s = l._ptr, c = l._index, f = l._size, d = f[0], p = f[1]; u.pinv = [], u.leftmost = []; var m = u.parent, v = u.pinv, b = u.leftmost, y = [], A = 0, h = d, x = d + p, w = d + 2 * p, g, D, E, N, S; for (D = 0; D < p; D++) y[h + D] = -1, y[x + D] = -1, y[w + D] = 0; for (g = 0; g < d; g++) b[g] = -1; for (D = p - 1; D >= 0; D--) for (N = s[D], S = s[D + 1], E = N; E < S; E++) b[c[E]] = D; for (g = d - 1; g >= 0; g--) v[g] = -1, D = b[g], D !== -1 && (y[w + D]++ === 0 && (y[x + D] = g), y[A + g] = y[h + D], y[h + D] = g); for (u.lnz = 0, u.m2 = d, D = 0; D < p; D++) if (g = y[h + D], u.lnz++, g < 0 && (g = u.m2++), v[g] = D, !(--w[D] <= 0)) { u.lnz += y[w + D]; var M = m[D]; M !== -1 && (y[w + M] === 0 && (y[x + M] = y[x + D]), y[A + y[x + D]] = y[h + M], y[h + M] = y[A + g], y[w + M] += y[w + D]); } for (g = 0; g < d; g++) v[g] < 0 && (v[g] = D++); return !0; } }); function rl(e, r) { return e[r] < 0; } function Gy(e, r) { e[r] = qn(e[r]); } function iv(e) { return e < 0 ? qn(e) : e; } function i$(e, r, t, n, a) { var i = r._index, o = r._ptr, l = r._size, u = l[1], s, c, f, d = 0; for (n[0] = e; d >= 0; ) { e = n[d]; var p = a ? a[e] : e; rl(o, e) || (Gy(o, e), n[u + d] = p < 0 ? 0 : iv(o[p])); var m = 1; for (c = n[u + d], f = p < 0 ? 0 : iv(o[p + 1]); c < f; c++) if (s = i[c], !rl(o, s)) { n[u + d] = c, n[++d] = s, m = 0; break; } m && (d--, n[--t] = e); } return t; } function o$(e, r, t, n, a) { var i = e._ptr, o = e._size, l = r._index, u = r._ptr, s = o[1], c, f, d, p = s; for (f = u[t], d = u[t + 1], c = f; c < d; c++) { var m = l[c]; rl(i, m) || (p = i$(m, e, p, n, a)); } for (c = p; c < s; c++) Gy(i, n[c]); return p; } var s$ = "csSpsolve", u$ = ["divideScalar", "multiply", "subtract"], l$ = /* @__PURE__ */ P(s$, u$, (e) => { var { divideScalar: r, multiply: t, subtract: n } = e; return function(i, o, l, u, s, c, f) { var d = i._values, p = i._index, m = i._ptr, v = i._size, b = v[1], y = o._values, A = o._index, h = o._ptr, x, w, g, D, E = o$(i, o, l, u, c); for (x = E; x < b; x++) s[u[x]] = 0; for (w = h[l], g = h[l + 1], x = w; x < g; x++) s[A[x]] = y[x]; for (var N = E; N < b; N++) { var S = u[N], M = c ? c[S] : S; if (!(M < 0)) for (w = m[M], g = m[M + 1], s[S] = r(s[S], d[f ? w : g - 1]), x = f ? w + 1 : w, D = f ? g : g - 1; x < D; x++) { var F = p[x]; s[F] = n(s[F], t(d[x], s[S])); } } return E; }; }), c$ = "csLu", f$ = ["abs", "divideScalar", "multiply", "subtract", "larger", "largerEq", "SparseMatrix"], d$ = /* @__PURE__ */ P(c$, f$, (e) => { var { abs: r, divideScalar: t, multiply: n, subtract: a, larger: i, largerEq: o, SparseMatrix: l } = e, u = l$({ divideScalar: t, multiply: n, subtract: a }); return function(c, f, d) { if (!c) return null; var p = c._size, m = p[1], v, b = 100, y = 100; f && (v = f.q, b = f.lnz || b, y = f.unz || y); var A = [], h = [], x = [], w = new l({ values: A, index: h, ptr: x, size: [m, m] }), g = [], D = [], E = [], N = new l({ values: g, index: D, ptr: E, size: [m, m] }), S = [], M, F, $ = [], I = []; for (M = 0; M < m; M++) $[M] = 0, S[M] = -1, x[M + 1] = 0; b = 0, y = 0; for (var B = 0; B < m; B++) { x[B] = b, E[B] = y; var C = v ? v[B] : B, _ = u(w, c, C, I, $, S, 1), z = -1, O = -1; for (F = _; F < m; F++) if (M = I[F], S[M] < 0) { var W = r($[M]); i(W, O) && (O = W, z = M); } else D[y] = S[M], g[y++] = $[M]; if (z === -1 || O <= 0) return null; S[C] < 0 && o(r($[C]), n(O, d)) && (z = C); var X = $[z]; for (D[y] = B, g[y++] = X, S[z] = B, h[b] = z, A[b++] = 1, F = _; F < m; F++) M = I[F], S[M] < 0 && (h[b] = M, A[b++] = t($[M], X)), $[M] = 0; } for (x[m] = b, E[m] = y, F = 0; F < b; F++) h[F] = S[h[F]]; return A.splice(b, A.length - b), h.splice(b, h.length - b), g.splice(y, g.length - y), D.splice(y, D.length - y), { L: w, U: N, pinv: S }; }; }), ov = "slu", p$ = ["typed", "abs", "add", "multiply", "transpose", "divideScalar", "subtract", "larger", "largerEq", "SparseMatrix"], m$ = /* @__PURE__ */ P(ov, p$, (e) => { var { typed: r, abs: t, add: n, multiply: a, transpose: i, divideScalar: o, subtract: l, larger: u, largerEq: s, SparseMatrix: c } = e, f = a$({ add: n, multiply: a, transpose: i }), d = d$({ abs: t, divideScalar: o, multiply: a, subtract: l, larger: u, largerEq: s, SparseMatrix: c }); return r(ov, { "SparseMatrix, number, number": function(m, v, b) { if (!Oe(v) || v < 0 || v > 3) throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]"); if (b < 0 || b > 1) throw new Error("Partial pivoting threshold must be a number from 0 to 1"); var y = f(v, m, !1), A = d(m, y, b); return { L: A.L, U: A.U, p: A.pinv, q: y.q, toString: function() { return "L: " + this.L.toString() + ` U: ` + this.U.toString() + ` p: ` + this.p.toString() + (this.q ? ` q: ` + this.q.toString() : "") + ` `; } }; } }); }); function sv(e, r) { var t, n = r.length, a = []; if (e) for (t = 0; t < n; t++) a[e[t]] = r[t]; else for (t = 0; t < n; t++) a[t] = r[t]; return a; } var uv = "lusolve", v$ = ["typed", "matrix", "lup", "slu", "usolve", "lsolve", "DenseMatrix"], h$ = /* @__PURE__ */ P(uv, v$, (e) => { var { typed: r, matrix: t, lup: n, slu: a, usolve: i, lsolve: o, DenseMatrix: l } = e, u = Ji({ DenseMatrix: l }); return r(uv, { "Array, Array | Matrix": function(d, p) { d = t(d); var m = n(d), v = c(m.L, m.U, m.p, null, p); return v.valueOf(); }, "DenseMatrix, Array | Matrix": function(d, p) { var m = n(d); return c(m.L, m.U, m.p, null, p); }, "SparseMatrix, Array | Matrix": function(d, p) { var m = n(d); return c(m.L, m.U, m.p, null, p); }, "SparseMatrix, Array | Matrix, number, number": function(d, p, m, v) { var b = a(d, m, v); return c(b.L, b.U, b.p, b.q, p); }, "Object, Array | Matrix": function(d, p) { return c(d.L, d.U, d.p, d.q, p); } }); function s(f) { if (ze(f)) return f; if (cr(f)) return t(f); throw new TypeError("Invalid Matrix LU decomposition"); } function c(f, d, p, m, v) { f = s(f), d = s(d), p && (v = u(f, v, !0), v._data = sv(p, v._data)); var b = o(f, v), y = i(d, b); return m && (y._data = sv(m, y._data)), y; } }), lv = "polynomialRoot", g$ = ["typed", "isZero", "equalScalar", "add", "subtract", "multiply", "divide", "sqrt", "unaryMinus", "cbrt", "typeOf", "im", "re"], y$ = /* @__PURE__ */ P(lv, g$, (e) => { var { typed: r, isZero: t, equalScalar: n, add: a, subtract: i, multiply: o, divide: l, sqrt: u, unaryMinus: s, cbrt: c, typeOf: f, im: d, re: p } = e; return r(lv, { "number|Complex, ...number|Complex": (m, v) => { for (var b = [m, ...v]; b.length > 0 && t(b[b.length - 1]); ) b.pop(); if (b.length < 2) throw new RangeError("Polynomial [".concat(m, ", ").concat(v, "] must have a non-zero non-constant coefficient")); switch (b.length) { case 2: return [s(l(b[0], b[1]))]; case 3: { var [y, A, h] = b, x = o(2, h), w = o(A, A), g = o(4, h, y); if (n(w, g)) return [l(s(A), x)]; var D = u(i(w, g)); return [l(i(D, A), x), l(i(s(D), A), x)]; } case 4: { var [E, N, S, M] = b, F = s(o(3, M)), $ = o(S, S), I = o(3, M, N), B = a(o(2, S, S, S), o(27, M, M, E)), C = o(9, M, S, N); if (n($, I) && n(B, C)) return [l(S, F)]; var _ = i($, I), z = i(B, C), O = a(o(18, M, S, N, E), o(S, S, N, N)), W = a(o(4, S, S, S, E), o(4, M, N, N, N), o(27, M, M, E, E)); if (n(O, W)) return [ l(i(o(4, M, S, N), a(o(9, M, M, E), o(S, S, S))), o(M, _)), // simple root l(i(o(9, M, E), o(S, N)), o(2, _)) // double root ]; var X; n($, I) ? X = z : X = l(a(z, u(i(o(z, z), o(4, _, _, _)))), 2); var V = !0, R = c(X, V).toArray().map((Q) => l(a(S, Q, l(_, Q)), F)); return R.map((Q) => f(Q) === "Complex" && n(p(Q), p(Q) + d(Q)) ? p(Q) : Q); } default: throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(b)); } } }); }), b$ = "Help", w$ = ["evaluate"], x$ = /* @__PURE__ */ P(b$, w$, (e) => { var { evaluate: r } = e; function t(n) { if (!(this instanceof t)) throw new SyntaxError("Constructor must be called with the new operator"); if (!n) throw new Error('Argument "doc" missing'); this.doc = n; } return t.prototype.type = "Help", t.prototype.isHelp = !0, t.prototype.toString = function() { var n = this.doc || {}, a = ` `; if (n.name && (a += "Name: " + n.name + ` `), n.category && (a += "Category: " + n.category + ` `), n.description && (a += `Description: ` + n.description + ` `), n.syntax && (a += `Syntax: ` + n.syntax.join(` `) + ` `), n.examples) { a += `Examples: `; for (var i = !1, o = r("config()"), l = { config: (f) => (i = !0, r("config(newConfig)", { newConfig: f })) }, u = 0; u < n.examples.length; u++) { var s = n.examples[u]; a += " " + s + ` `; var c = void 0; try { c = r(s, l); } catch (f) { c = f; } c !== void 0 && !Rl(c) && (a += " " + Qe(c, { precision: 14 }) + ` `); } a += ` `, i && r("config(originalConfig)", { originalConfig: o }); } return n.mayThrow && n.mayThrow.length && (a += "Throws: " + n.mayThrow.join(", ") + ` `), n.seealso && n.seealso.length && (a += "See also: " + n.seealso.join(", ") + ` `), a; }, t.prototype.toJSON = function() { var n = qe(this.doc); return n.mathjs = "Help", n; }, t.fromJSON = function(n) { var a = {}; return Object.keys(n).filter((i) => i !== "mathjs").forEach((i) => { a[i] = n[i]; }), new t(a); }, t.prototype.valueOf = t.prototype.toString, t; }, { isClass: !0 }), A$ = "Chain", N$ = ["?on", "math", "typed"], D$ = /* @__PURE__ */ P(A$, N$, (e) => { var { on: r, math: t, typed: n } = e; function a(s) { if (!(this instanceof a)) throw new SyntaxError("Constructor must be called with the new operator"); Pl(s) ? this.value = s.value : this.value = s; } a.prototype.type = "Chain", a.prototype.isChain = !0, a.prototype.done = function() { return this.value; }, a.prototype.valueOf = function() { return this.value; }, a.prototype.toString = function() { return Qe(this.value); }, a.prototype.toJSON = function() { return { mathjs: "Chain", value: this.value }; }, a.fromJSON = function(s) { return new a(s.value); }; function i(s, c) { typeof c == "function" && (a.prototype[s] = l(c)); } function o(s, c) { $o(a.prototype, s, function() { var d = c(); if (typeof d == "function") return l(d); }); } function l(s) { return function() { if (arguments.length === 0) return new a(s(this.value)); for (var c = [this.value], f = 0; f < arguments.length; f++) c[f + 1] = arguments[f]; if (n.isTypedFunction(s)) { var d = n.resolve(s, c); if (d.params.length === 1) throw new Error("chain function " + s.name + " cannot match rest parameter between chain value and additional arguments."); return new a(d.implementation.apply(s, c)); } return new a(s.apply(s, c)); }; } a.createProxy = function(s, c) { if (typeof s == "string") i(s, c); else { var f = function(m) { Fe(s, m) && u[m] === void 0 && o(m, () => s[m]); }; for (var d in s) f(d); } }; var u = { expression: !0, docs: !0, type: !0, classes: !0, json: !0, error: !0, isChain: !0 // conflicts with the property isChain of a Chain instance }; return a.createProxy(t), r && r("import", function(s, c, f) { f || o(s, c); }), a; }, { isClass: !0 }), cv = { name: "e", category: "Constants", syntax: ["e"], description: "Euler's number, the base of the natural logarithm. Approximately equal to 2.71828", examples: ["e", "e ^ 2", "exp(2)", "log(e)"], seealso: ["exp"] }, E$ = { name: "false", category: "Constants", syntax: ["false"], description: "Boolean value false", examples: ["false"], seealso: ["true"] }, S$ = { name: "i", category: "Constants", syntax: ["i"], description: "Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.", examples: ["i", "i * i", "sqrt(-1)"], seealso: [] }, C$ = { name: "Infinity", category: "Constants", syntax: ["Infinity"], description: "Infinity, a number which is larger than the maximum number that can be handled by a floating point number.", examples: ["Infinity", "1 / 0"], seealso: [] }, M$ = { name: "LN10", category: "Constants", syntax: ["LN10"], description: "Returns the natural logarithm of 10, approximately equal to 2.302", examples: ["LN10", "log(10)"], seealso: [] }, _$ = { name: "LN2", category: "Constants", syntax: ["LN2"], description: "Returns the natural logarithm of 2, approximately equal to 0.693", examples: ["LN2", "log(2)"], seealso: [] }, F$ = { name: "LOG10E", category: "Constants", syntax: ["LOG10E"], description: "Returns the base-10 logarithm of E, approximately equal to 0.434", examples: ["LOG10E", "log(e, 10)"], seealso: [] }, T$ = { name: "LOG2E", category: "Constants", syntax: ["LOG2E"], description: "Returns the base-2 logarithm of E, approximately equal to 1.442", examples: ["LOG2E", "log(e, 2)"], seealso: [] }, O$ = { name: "NaN", category: "Constants", syntax: ["NaN"], description: "Not a number", examples: ["NaN", "0 / 0"], seealso: [] }, B$ = { name: "null", category: "Constants", syntax: ["null"], description: "Value null", examples: ["null"], seealso: ["true", "false"] }, $$ = { name: "phi", category: "Constants", syntax: ["phi"], description: "Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...", examples: ["phi"], seealso: [] }, fv = { name: "pi", category: "Constants", syntax: ["pi"], description: "The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159", examples: ["pi", "sin(pi/2)"], seealso: ["tau"] }, I$ = { name: "SQRT1_2", category: "Constants", syntax: ["SQRT1_2"], description: "Returns the square root of 1/2, approximately equal to 0.707", examples: ["SQRT1_2", "sqrt(1/2)"], seealso: [] }, R$ = { name: "SQRT2", category: "Constants", syntax: ["SQRT2"], description: "Returns the square root of 2, approximately equal to 1.414", examples: ["SQRT2", "sqrt(2)"], seealso: [] }, P$ = { name: "tau", category: "Constants", syntax: ["tau"], description: "Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.", examples: ["tau", "2 * pi"], seealso: ["pi"] }, z$ = { name: "true", category: "Constants", syntax: ["true"], description: "Boolean value true", examples: ["true"], seealso: ["false"] }, q$ = { name: "version", category: "Constants", syntax: ["version"], description: "A string with the version number of math.js", examples: ["version"], seealso: [] }, L$ = { name: "bignumber", category: "Construction", syntax: ["bignumber(x)"], description: "Create a big number from a number or string.", examples: ["0.1 + 0.2", "bignumber(0.1) + bignumber(0.2)", 'bignumber("7.2")', 'bignumber("7.2e500")', "bignumber([0.1, 0.2, 0.3])"], seealso: ["boolean", "bigint", "complex", "fraction", "index", "matrix", "string", "unit"] }, U$ = { name: "bigint", category: "Construction", syntax: ["bigint(x)"], description: "Create a bigint, an integer with an arbitrary number of digits, from a number or string.", examples: ["123123123123123123 # a large number will lose digits", 'bigint("123123123123123123")', 'bignumber(["1", "3", "5"])'], seealso: ["boolean", "bignumber", "number", "complex", "fraction", "index", "matrix", "string", "unit"] }, k$ = { name: "boolean", category: "Construction", syntax: ["x", "boolean(x)"], description: "Convert a string or number into a boolean.", examples: ["boolean(0)", "boolean(1)", "boolean(3)", 'boolean("true")', 'boolean("false")', "boolean([1, 0, 1, 1])"], seealso: ["bignumber", "complex", "index", "matrix", "number", "string", "unit"] }, V$ = { name: "complex", category: "Construction", syntax: ["complex()", "complex(re, im)", "complex(string)"], description: "Create a complex number.", examples: ["complex()", "complex(2, 3)", 'complex("7 - 2i")'], seealso: ["bignumber", "boolean", "index", "matrix", "number", "string", "unit"] }, H$ = { name: "createUnit", category: "Construction", syntax: ["createUnit(definitions)", "createUnit(name, definition)"], description: "Create a user-defined unit and register it with the Unit type.", examples: ['createUnit("foo")', 'createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})', 'createUnit("mph", "1 mile/hour")'], seealso: ["unit", "splitUnit"] }, Z$ = { name: "fraction", category: "Construction", syntax: ["fraction(num)", "fraction(matrix)", "fraction(num,den)", "fraction({n: num, d: den})"], description: "Create a fraction from a number or from integer numerator and denominator.", examples: ["fraction(0.125)", "fraction(1, 3) + fraction(2, 5)", "fraction({n: 333, d: 53})", "fraction([sqrt(9), sqrt(10), sqrt(11)])"], seealso: ["bignumber", "boolean", "complex", "index", "matrix", "string", "unit"] }, G$ = { name: "index", category: "Construction", syntax: ["[start]", "[start:end]", "[start:step:end]", "[start1, start 2, ...]", "[start1:end1, start2:end2, ...]", "[start1:step1:end1, start2:step2:end2, ...]"], description: "Create an index to get or replace a subset of a matrix", examples: ["A = [1, 2, 3; 4, 5, 6]", "A[1, :]", "A[1, 2] = 50", "A[1:2, 1:2] = 1", "B = [1, 2, 3]", "B[B>1 and B<3]"], seealso: ["bignumber", "boolean", "complex", "matrix,", "number", "range", "string", "unit"] }, W$ = { name: "matrix", category: "Construction", syntax: ["[]", "[a1, b1, ...; a2, b2, ...]", "matrix()", 'matrix("dense")', "matrix([...])"], description: "Create a matrix.", examples: ["[]", "[1, 2, 3]", "[1, 2, 3; 4, 5, 6]", "matrix()", "matrix([3, 4])", 'matrix([3, 4; 5, 6], "sparse")', 'matrix([3, 4; 5, 6], "sparse", "number")'], seealso: ["bignumber", "boolean", "complex", "index", "number", "string", "unit", "sparse"] }, K$ = { name: "number", category: "Construction", syntax: ["x", "number(x)", "number(unit, valuelessUnit)"], description: "Create a number or convert a string or boolean into a number.", examples: ["2", "2e3", "4.05", "number(2)", 'number("7.2")', "number(true)", "number([true, false, true, true])", 'number(unit("52cm"), "m")'], seealso: ["bignumber", "bigint", "boolean", "complex", "fraction", "index", "matrix", "string", "unit"] }, J$ = { name: "sparse", category: "Construction", syntax: ["sparse()", "sparse([a1, b1, ...; a1, b2, ...])", 'sparse([a1, b1, ...; a1, b2, ...], "number")'], description: "Create a sparse matrix.", examples: ["sparse()", "sparse([3, 4; 5, 6])", 'sparse([3, 0; 5, 0], "number")'], seealso: ["bignumber", "boolean", "complex", "index", "number", "string", "unit", "matrix"] }, Y$ = { name: "splitUnit", category: "Construction", syntax: ["splitUnit(unit: Unit, parts: Unit[])"], description: "Split a unit in an array of units whose sum is equal to the original unit.", examples: ['splitUnit(1 m, ["feet", "inch"])'], seealso: ["unit", "createUnit"] }, j$ = { name: "string", category: "Construction", syntax: ['"text"', "string(x)"], description: "Create a string or convert a value to a string", examples: ['"Hello World!"', "string(4.2)", "string(3 + 2i)"], seealso: ["bignumber", "boolean", "complex", "index", "matrix", "number", "unit"] }, X$ = { name: "unit", category: "Construction", syntax: ["value unit", "unit(value, unit)", "unit(string)"], description: "Create a unit.", examples: ["5.5 mm", "3 inch", 'unit(7.1, "kilogram")', 'unit("23 deg")'], seealso: ["bignumber", "boolean", "complex", "index", "matrix", "number", "string"] }, Q$ = { name: "config", category: "Core", syntax: ["config()", "config(options)"], description: "Get configuration or change configuration.", examples: ["config()", "1/3 + 1/4", 'config({number: "Fraction"})', "1/3 + 1/4"], seealso: [] }, e9 = { name: "import", category: "Core", syntax: ["import(functions)", "import(functions, options)"], description: "Import functions or constants from an object.", examples: ["import({myFn: f(x)=x^2, myConstant: 32 })", "myFn(2)", "myConstant"], seealso: [] }, r9 = { name: "typed", category: "Core", syntax: ["typed(signatures)", "typed(name, signatures)"], description: "Create a typed function.", examples: ['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })', "double(2)", 'double("hello")'], seealso: [] }, t9 = { name: "derivative", category: "Algebra", syntax: ["derivative(expr, variable)", "derivative(expr, variable, {simplify: boolean})"], description: "Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.", examples: ['derivative("2x^3", "x")', 'derivative("2x^3", "x", {simplify: false})', 'derivative("2x^2 + 3x + 4", "x")', 'derivative("sin(2x)", "x")', 'f = parse("x^2 + x")', 'x = parse("x")', "df = derivative(f, x)", "df.evaluate({x: 3})"], seealso: ["simplify", "parse", "evaluate"] }, n9 = { name: "leafCount", category: "Algebra", syntax: ["leafCount(expr)"], description: "Computes the number of leaves in the parse tree of the given expression", examples: ['leafCount("e^(i*pi)-1")', 'leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'], seealso: ["simplify"] }, a9 = { name: "lsolve", category: "Algebra", syntax: ["x=lsolve(L, b)"], description: "Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.", examples: ["a = [-2, 3; 2, 1]", "b = [11, 9]", "x = lsolve(a, b)"], seealso: ["lsolveAll", "lup", "lusolve", "usolve", "matrix", "sparse"] }, i9 = { name: "lsolveAll", category: "Algebra", syntax: ["x=lsolveAll(L, b)"], description: "Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.", examples: ["a = [-2, 3; 2, 1]", "b = [11, 9]", "x = lsolve(a, b)"], seealso: ["lsolve", "lup", "lusolve", "usolve", "matrix", "sparse"] }, o9 = { name: "lup", category: "Algebra", syntax: ["lup(m)"], description: "Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U", examples: ["lup([[2, 1], [1, 4]])", "lup(matrix([[2, 1], [1, 4]]))", "lup(sparse([[2, 1], [1, 4]]))"], seealso: ["lusolve", "lsolve", "usolve", "matrix", "sparse", "slu", "qr"] }, s9 = { name: "lusolve", category: "Algebra", syntax: ["x=lusolve(A, b)", "x=lusolve(lu, b)"], description: "Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.", examples: ["a = [-2, 3; 2, 1]", "b = [11, 9]", "x = lusolve(a, b)"], seealso: ["lup", "slu", "lsolve", "usolve", "matrix", "sparse"] }, u9 = { name: "polynomialRoot", category: "Algebra", syntax: ["x=polynomialRoot(-6, 3)", "x=polynomialRoot(4, -4, 1)", "x=polynomialRoot(-8, 12, -6, 1)"], description: "Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.", examples: ["a = polynomialRoot(-6, 11, -6, 1)"], seealso: ["cbrt", "sqrt"] }, l9 = { name: "qr", category: "Algebra", syntax: ["qr(A)"], description: "Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.", examples: ["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"], seealso: ["lup", "slu", "matrix"] }, c9 = { name: "rationalize", category: "Algebra", syntax: ["rationalize(expr)", "rationalize(expr, scope)", "rationalize(expr, scope, detailed)"], description: "Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.", examples: ['rationalize("2x/y - y/(x+1)")', 'rationalize("2x/y - y/(x+1)", true)'], seealso: ["simplify"] }, f9 = { name: "resolve", category: "Algebra", syntax: ["resolve(node, scope)"], description: "Recursively substitute variables in an expression tree.", examples: ['resolve(parse("1 + x"), { x: 7 })', 'resolve(parse("size(text)"), { text: "Hello World" })', 'resolve(parse("x + y"), { x: parse("3z") })', 'resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'], seealso: ["simplify", "evaluate"], mayThrow: ["ReferenceError"] }, d9 = { name: "simplify", category: "Algebra", syntax: ["simplify(expr)", "simplify(expr, rules)"], description: "Simplify an expression tree.", examples: ['simplify("3 + 2 / 4")', 'simplify("2x + x")', 'f = parse("x * (x + 2 + x)")', "simplified = simplify(f)", "simplified.evaluate({x: 2})"], seealso: ["simplifyCore", "derivative", "evaluate", "parse", "rationalize", "resolve"] }, p9 = { name: "simplifyConstant", category: "Algebra", syntax: ["simplifyConstant(expr)", "simplifyConstant(expr, options)"], description: "Replace constant subexpressions of node with their values.", examples: ['simplifyConstant("(3-3)*x")', 'simplifyConstant(parse("z-cos(tau/8)"))'], seealso: ["simplify", "simplifyCore", "evaluate"] }, m9 = { name: "simplifyCore", category: "Algebra", syntax: ["simplifyCore(node)"], description: "Perform simple one-pass simplifications on an expression tree.", examples: ['simplifyCore(parse("0*x"))', 'simplifyCore(parse("(x+0)*2"))'], seealso: ["simplify", "simplifyConstant", "evaluate"] }, v9 = { name: "slu", category: "Algebra", syntax: ["slu(A, order, threshold)"], description: "Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U", examples: ["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"], seealso: ["lusolve", "lsolve", "usolve", "matrix", "sparse", "lup", "qr"] }, h9 = { name: "symbolicEqual", category: "Algebra", syntax: ["symbolicEqual(expr1, expr2)", "symbolicEqual(expr1, expr2, options)"], description: "Returns true if the difference of the expressions simplifies to 0", examples: ['symbolicEqual("x*y","y*x")', 'symbolicEqual("abs(x^2)", "x^2")', 'symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'], seealso: ["simplify", "evaluate"] }, g9 = { name: "usolve", category: "Algebra", syntax: ["x=usolve(U, b)"], description: "Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.", examples: ["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"], seealso: ["usolveAll", "lup", "lusolve", "lsolve", "matrix", "sparse"] }, y9 = { name: "usolveAll", category: "Algebra", syntax: ["x=usolve(U, b)"], description: "Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.", examples: ["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"], seealso: ["usolve", "lup", "lusolve", "lsolve", "matrix", "sparse"] }, b9 = { name: "abs", category: "Arithmetic", syntax: ["abs(x)"], description: "Compute the absolute value.", examples: ["abs(3.5)", "abs(-4.2)"], seealso: ["sign"] }, w9 = { name: "add", category: "Operators", syntax: ["x + y", "add(x, y)"], description: "Add two values.", examples: ["a = 2.1 + 3.6", "a - 3.6", "3 + 2i", "3 cm + 2 inch", '"2.3" + "4"'], seealso: ["subtract"] }, x9 = { name: "cbrt", category: "Arithmetic", syntax: ["cbrt(x)", "cbrt(x, allRoots)"], description: "Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned", examples: ["cbrt(64)", "cube(4)", "cbrt(-8)", "cbrt(2 + 3i)", "cbrt(8i)", "cbrt(8i, true)", "cbrt(27 m^3)"], seealso: ["square", "sqrt", "cube", "multiply"] }, A9 = { name: "ceil", category: "Arithmetic", syntax: ["ceil(x)"], description: "Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.", examples: ["ceil(3.2)", "ceil(3.8)", "ceil(-4.2)"], seealso: ["floor", "fix", "round"] }, N9 = { name: "cube", category: "Arithmetic", syntax: ["cube(x)"], description: "Compute the cube of a value. The cube of x is x * x * x.", examples: ["cube(2)", "2^3", "2 * 2 * 2"], seealso: ["multiply", "square", "pow"] }, D9 = { name: "divide", category: "Operators", syntax: ["x / y", "divide(x, y)"], description: "Divide two values.", examples: ["a = 2 / 3", "a * 3", "4.5 / 2", "3 + 4 / 2", "(3 + 4) / 2", "18 km / 4.5"], seealso: ["multiply"] }, E9 = { name: "dotDivide", category: "Operators", syntax: ["x ./ y", "dotDivide(x, y)"], description: "Divide two values element wise.", examples: ["a = [1, 2, 3; 4, 5, 6]", "b = [2, 1, 1; 3, 2, 5]", "a ./ b"], seealso: ["multiply", "dotMultiply", "divide"] }, S9 = { name: "dotMultiply", category: "Operators", syntax: ["x .* y", "dotMultiply(x, y)"], description: "Multiply two values element wise.", examples: ["a = [1, 2, 3; 4, 5, 6]", "b = [2, 1, 1; 3, 2, 5]", "a .* b"], seealso: ["multiply", "divide", "dotDivide"] }, C9 = { name: "dotPow", category: "Operators", syntax: ["x .^ y", "dotPow(x, y)"], description: "Calculates the power of x to y element wise.", examples: ["a = [1, 2, 3; 4, 5, 6]", "a .^ 2"], seealso: ["pow"] }, M9 = { name: "exp", category: "Arithmetic", syntax: ["exp(x)"], description: "Calculate the exponent of a value.", examples: ["exp(1.3)", "e ^ 1.3", "log(exp(1.3))", "x = 2.4", "(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"], seealso: ["expm", "expm1", "pow", "log"] }, _9 = { name: "expm", category: "Arithmetic", syntax: ["exp(x)"], description: "Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.", examples: ["expm([[0,2],[0,0]])"], seealso: ["exp"] }, F9 = { name: "expm1", category: "Arithmetic", syntax: ["expm1(x)"], description: "Calculate the value of subtracting 1 from the exponential value.", examples: ["expm1(2)", "pow(e, 2) - 1", "log(expm1(2) + 1)"], seealso: ["exp", "pow", "log"] }, T9 = { name: "fix", category: "Arithmetic", syntax: ["fix(x)"], description: "Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.", examples: ["fix(3.2)", "fix(3.8)", "fix(-4.2)", "fix(-4.8)"], seealso: ["ceil", "floor", "round"] }, O9 = { name: "floor", category: "Arithmetic", syntax: ["floor(x)"], description: "Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.", examples: ["floor(3.2)", "floor(3.8)", "floor(-4.2)"], seealso: ["ceil", "fix", "round"] }, B9 = { name: "gcd", category: "Arithmetic", syntax: ["gcd(a, b)", "gcd(a, b, c, ...)"], description: "Compute the greatest common divisor.", examples: ["gcd(8, 12)", "gcd(-4, 6)", "gcd(25, 15, -10)"], seealso: ["lcm", "xgcd"] }, $9 = { name: "hypot", category: "Arithmetic", syntax: ["hypot(a, b, c, ...)", "hypot([a, b, c, ...])"], description: "Calculate the hypotenuse of a list with values.", examples: ["hypot(3, 4)", "sqrt(3^2 + 4^2)", "hypot(-2)", "hypot([3, 4, 5])"], seealso: ["abs", "norm"] }, I9 = { name: "invmod", category: "Arithmetic", syntax: ["invmod(a, b)"], description: "Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ≣ 1 (mod b)", examples: ["invmod(8, 12)", "invmod(7, 13)", "invmod(15151, 15122)"], seealso: ["gcd", "xgcd"] }, R9 = { name: "lcm", category: "Arithmetic", syntax: ["lcm(x, y)"], description: "Compute the least common multiple.", examples: ["lcm(4, 6)", "lcm(6, 21)", "lcm(6, 21, 5)"], seealso: ["gcd"] }, P9 = { name: "log", category: "Arithmetic", syntax: ["log(x)", "log(x, base)"], description: "Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).", examples: ["log(3.5)", "a = log(2.4)", "exp(a)", "10 ^ 4", "log(10000, 10)", "log(10000) / log(10)", "b = log(1024, 2)", "2 ^ b"], seealso: ["exp", "log1p", "log2", "log10"] }, z9 = { name: "log10", category: "Arithmetic", syntax: ["log10(x)"], description: "Compute the 10-base logarithm of a value.", examples: ["log10(0.00001)", "log10(10000)", "10 ^ 4", "log(10000) / log(10)", "log(10000, 10)"], seealso: ["exp", "log"] }, q9 = { name: "log1p", category: "Arithmetic", syntax: ["log1p(x)", "log1p(x, base)"], description: "Calculate the logarithm of a `value+1`", examples: ["log1p(2.5)", "exp(log1p(1.4))", "pow(10, 4)", "log1p(9999, 10)", "log1p(9999) / log(10)"], seealso: ["exp", "log", "log2", "log10"] }, L9 = { name: "log2", category: "Arithmetic", syntax: ["log2(x)"], description: "Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.", examples: ["log2(0.03125)", "log2(16)", "log2(16) / log2(2)", "pow(2, 4)"], seealso: ["exp", "log1p", "log", "log10"] }, U9 = { name: "mod", category: "Operators", syntax: ["x % y", "x mod y", "mod(x, y)"], description: "Calculates the modulus, the remainder of an integer division.", examples: ["7 % 3", "11 % 2", "10 mod 4", "isOdd(x) = x % 2", "isOdd(2)", "isOdd(3)"], seealso: ["divide"] }, k9 = { name: "multiply", category: "Operators", syntax: ["x * y", "multiply(x, y)"], description: "multiply two values.", examples: ["a = 2.1 * 3.4", "a / 3.4", "2 * 3 + 4", "2 * (3 + 4)", "3 * 2.1 km"], seealso: ["divide"] }, V9 = { name: "norm", category: "Arithmetic", syntax: ["norm(x)", "norm(x, p)"], description: "Calculate the norm of a number, vector or matrix.", examples: ["abs(-3.5)", "norm(-3.5)", "norm(3 - 4i)", "norm([1, 2, -3], Infinity)", "norm([1, 2, -3], -Infinity)", "norm([3, 4], 2)", "norm([[1, 2], [3, 4]], 1)", 'norm([[1, 2], [3, 4]], "inf")', 'norm([[1, 2], [3, 4]], "fro")'] }, H9 = { name: "nthRoot", category: "Arithmetic", syntax: ["nthRoot(a)", "nthRoot(a, root)"], description: 'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".', examples: ["4 ^ 3", "nthRoot(64, 3)", "nthRoot(9, 2)", "sqrt(9)"], seealso: ["nthRoots", "pow", "sqrt"] }, Z9 = { name: "nthRoots", category: "Arithmetic", syntax: ["nthRoots(A)", "nthRoots(A, root)"], description: 'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.', examples: ["nthRoots(1)", "nthRoots(1, 3)"], seealso: ["sqrt", "pow", "nthRoot"] }, G9 = { name: "pow", category: "Operators", syntax: ["x ^ y", "pow(x, y)"], description: "Calculates the power of x to y, x^y.", examples: ["2^3", "2*2*2", "1 + e ^ (pi * i)", "pow([[1, 2], [4, 3]], 2)", "pow([[1, 2], [4, 3]], -1)"], seealso: ["multiply", "nthRoot", "nthRoots", "sqrt"] }, W9 = { name: "round", category: "Arithmetic", syntax: ["round(x)", "round(x, n)", "round(unit, valuelessUnit)", "round(unit, n, valuelessUnit)"], description: "round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.", examples: ["round(3.2)", "round(3.8)", "round(-4.2)", "round(-4.8)", "round(pi, 3)", "round(123.45678, 2)", "round(3.241cm, 2, cm)", "round([3.2, 3.8, -4.7])"], seealso: ["ceil", "floor", "fix"] }, K9 = { name: "sign", category: "Arithmetic", syntax: ["sign(x)"], description: "Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.", examples: ["sign(3.5)", "sign(-4.2)", "sign(0)"], seealso: ["abs"] }, J9 = { name: "sqrt", category: "Arithmetic", syntax: ["sqrt(x)"], description: "Compute the square root value. If x = y * y, then y is the square root of x.", examples: ["sqrt(25)", "5 * 5", "sqrt(-1)"], seealso: ["square", "sqrtm", "multiply", "nthRoot", "nthRoots", "pow"] }, Y9 = { name: "sqrtm", category: "Arithmetic", syntax: ["sqrtm(x)"], description: "Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.", examples: ["sqrtm([[33, 24], [48, 57]])"], seealso: ["sqrt", "abs", "square", "multiply"] }, j9 = { name: "sylvester", category: "Algebra", syntax: ["sylvester(A,B,C)"], description: "Solves the real-valued Sylvester equation AX+XB=C for X", examples: ["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])", "A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]", "sylvester(A, B, C)"], seealso: ["schur", "lyap"] }, X9 = { name: "schur", category: "Algebra", syntax: ["schur(A)"], description: "Performs a real Schur decomposition of the real matrix A = UTU'", examples: ["schur([[1, 0], [-4, 3]])", "A = [[1, 0], [-4, 3]]", "schur(A)"], seealso: ["lyap", "sylvester"] }, Q9 = { name: "lyap", category: "Algebra", syntax: ["lyap(A,Q)"], description: "Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P", examples: ["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])", "A = [[-2, 0], [1, -4]]", "Q = [[3, 1], [1, 3]]", "lyap(A,Q)"], seealso: ["schur", "sylvester"] }, eI = { name: "square", category: "Arithmetic", syntax: ["square(x)"], description: "Compute the square of a value. The square of x is x * x.", examples: ["square(3)", "sqrt(9)", "3^2", "3 * 3"], seealso: ["multiply", "pow", "sqrt", "cube"] }, rI = { name: "subtract", category: "Operators", syntax: ["x - y", "subtract(x, y)"], description: "subtract two values.", examples: ["a = 5.3 - 2", "a + 2", "2/3 - 1/6", "2 * 3 - 3", "2.1 km - 500m"], seealso: ["add"] }, tI = { name: "unaryMinus", category: "Operators", syntax: ["-x", "unaryMinus(x)"], description: "Inverse the sign of a value. Converts booleans and strings to numbers.", examples: ["-4.5", "-(-5.6)", '-"22"'], seealso: ["add", "subtract", "unaryPlus"] }, nI = { name: "unaryPlus", category: "Operators", syntax: ["+x", "unaryPlus(x)"], description: "Converts booleans and strings to numbers.", examples: ["+true", '+"2"'], seealso: ["add", "subtract", "unaryMinus"] }, aI = { name: "xgcd", category: "Arithmetic", syntax: ["xgcd(a, b)"], description: "Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.", examples: ["xgcd(8, 12)", "gcd(8, 12)", "xgcd(36163, 21199)"], seealso: ["gcd", "lcm"] }, iI = { name: "bitAnd", category: "Bitwise", syntax: ["x & y", "bitAnd(x, y)"], description: "Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0", examples: ["5 & 3", "bitAnd(53, 131)", "[1, 12, 31] & 42"], seealso: ["bitNot", "bitOr", "bitXor", "leftShift", "rightArithShift", "rightLogShift"] }, oI = { name: "bitNot", category: "Bitwise", syntax: ["~x", "bitNot(x)"], description: "Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.", examples: ["~1", "~2", "bitNot([2, -3, 4])"], seealso: ["bitAnd", "bitOr", "bitXor", "leftShift", "rightArithShift", "rightLogShift"] }, sI = { name: "bitOr", category: "Bitwise", syntax: ["x | y", "bitOr(x, y)"], description: "Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.", examples: ["5 | 3", "bitOr([1, 2, 3], 4)"], seealso: ["bitAnd", "bitNot", "bitXor", "leftShift", "rightArithShift", "rightLogShift"] }, uI = { name: "bitXor", category: "Bitwise", syntax: ["bitXor(x, y)"], description: "Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.", examples: ["bitOr(1, 2)", "bitXor([2, 3, 4], 4)"], seealso: ["bitAnd", "bitNot", "bitOr", "leftShift", "rightArithShift", "rightLogShift"] }, lI = { name: "leftShift", category: "Bitwise", syntax: ["x << y", "leftShift(x, y)"], description: "Bitwise left logical shift of a value x by y number of bits.", examples: ["4 << 1", "8 >> 1"], seealso: ["bitAnd", "bitNot", "bitOr", "bitXor", "rightArithShift", "rightLogShift"] }, cI = { name: "rightArithShift", category: "Bitwise", syntax: ["x >> y", "rightArithShift(x, y)"], description: "Bitwise right arithmetic shift of a value x by y number of bits.", examples: ["8 >> 1", "4 << 1", "-12 >> 2"], seealso: ["bitAnd", "bitNot", "bitOr", "bitXor", "leftShift", "rightLogShift"] }, fI = { name: "rightLogShift", category: "Bitwise", syntax: ["x >>> y", "rightLogShift(x, y)"], description: "Bitwise right logical shift of a value x by y number of bits.", examples: ["8 >>> 1", "4 << 1", "-12 >>> 2"], seealso: ["bitAnd", "bitNot", "bitOr", "bitXor", "leftShift", "rightArithShift"] }, dI = { name: "bellNumbers", category: "Combinatorics", syntax: ["bellNumbers(n)"], description: "The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.", examples: ["bellNumbers(3)", "bellNumbers(8)"], seealso: ["stirlingS2"] }, pI = { name: "catalan", category: "Combinatorics", syntax: ["catalan(n)"], description: "The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.", examples: ["catalan(3)", "catalan(8)"], seealso: ["bellNumbers"] }, mI = { name: "composition", category: "Combinatorics", syntax: ["composition(n, k)"], description: "The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.", examples: ["composition(5, 3)"], seealso: ["combinations"] }, vI = { name: "stirlingS2", category: "Combinatorics", syntax: ["stirlingS2(n, k)"], description: "he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.", examples: ["stirlingS2(5, 3)"], seealso: ["bellNumbers"] }, hI = { name: "arg", category: "Complex", syntax: ["arg(x)"], description: "Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).", examples: ["arg(2 + 2i)", "atan2(3, 2)", "arg(2 + 3i)"], seealso: ["re", "im", "conj", "abs"] }, gI = { name: "conj", category: "Complex", syntax: ["conj(x)"], description: "Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.", examples: ["conj(2 + 3i)", "conj(2 - 3i)", "conj(-5.2i)"], seealso: ["re", "im", "abs", "arg"] }, yI = { name: "im", category: "Complex", syntax: ["im(x)"], description: "Get the imaginary part of a complex number.", examples: ["im(2 + 3i)", "re(2 + 3i)", "im(-5.2i)", "im(2.4)"], seealso: ["re", "conj", "abs", "arg"] }, bI = { name: "re", category: "Complex", syntax: ["re(x)"], description: "Get the real part of a complex number.", examples: ["re(2 + 3i)", "im(2 + 3i)", "re(-5.2i)", "re(2.4)"], seealso: ["im", "conj", "abs", "arg"] }, wI = { name: "evaluate", category: "Expression", syntax: ["evaluate(expression)", "evaluate(expression, scope)", "evaluate([expr1, expr2, expr3, ...])", "evaluate([expr1, expr2, expr3, ...], scope)"], description: "Evaluate an expression or an array with expressions.", examples: ['evaluate("2 + 3")', 'evaluate("sqrt(16)")', 'evaluate("2 inch to cm")', 'evaluate("sin(x * pi)", { "x": 1/2 })', 'evaluate(["width=2", "height=4","width*height"])'], seealso: [] }, xI = { name: "help", category: "Expression", syntax: ["help(object)", "help(string)"], description: "Display documentation on a function or data type.", examples: ["help(sqrt)", 'help("complex")'], seealso: [] }, AI = { name: "distance", category: "Geometry", syntax: ["distance([x1, y1], [x2, y2])", "distance([[x1, y1], [x2, y2]])"], description: "Calculates the Euclidean distance between two points.", examples: ["distance([0,0], [4,4])", "distance([[0,0], [4,4]])"], seealso: [] }, NI = { name: "intersect", category: "Geometry", syntax: ["intersect(expr1, expr2, expr3, expr4)", "intersect(expr1, expr2, expr3)"], description: "Computes the intersection point of lines and/or planes.", examples: ["intersect([0, 0], [10, 10], [10, 0], [0, 10])", "intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"], seealso: [] }, DI = { name: "and", category: "Logical", syntax: ["x and y", "and(x, y)"], description: "Logical and. Test whether two values are both defined with a nonzero/nonempty value.", examples: ["true and false", "true and true", "2 and 4"], seealso: ["not", "or", "xor"] }, EI = { name: "not", category: "Logical", syntax: ["not x", "not(x)"], description: "Logical not. Flips the boolean value of given argument.", examples: ["not true", "not false", "not 2", "not 0"], seealso: ["and", "or", "xor"] }, SI = { name: "or", category: "Logical", syntax: ["x or y", "or(x, y)"], description: "Logical or. Test if at least one value is defined with a nonzero/nonempty value.", examples: ["true or false", "false or false", "0 or 4"], seealso: ["not", "and", "xor"] }, CI = { name: "xor", category: "Logical", syntax: ["x xor y", "xor(x, y)"], description: "Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.", examples: ["true xor false", "false xor false", "true xor true", "0 xor 4"], seealso: ["not", "and", "or"] }, MI = { name: "column", category: "Matrix", syntax: ["column(x, index)"], description: "Return a column from a matrix or array.", examples: ["A = [[1, 2], [3, 4]]", "column(A, 1)", "column(A, 2)"], seealso: ["row", "matrixFromColumns"] }, _I = { name: "concat", category: "Matrix", syntax: ["concat(A, B, C, ...)", "concat(A, B, C, ..., dim)"], description: "Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.", examples: ["A = [1, 2; 5, 6]", "B = [3, 4; 7, 8]", "concat(A, B)", "concat(A, B, 1)", "concat(A, B, 2)"], seealso: ["det", "diag", "identity", "inv", "ones", "range", "size", "squeeze", "subset", "trace", "transpose", "zeros"] }, FI = { name: "count", category: "Matrix", syntax: ["count(x)"], description: "Count the number of elements of a matrix, array or string.", examples: ["a = [1, 2; 3, 4; 5, 6]", "count(a)", "size(a)", 'count("hello world")'], seealso: ["size"] }, TI = { name: "cross", category: "Matrix", syntax: ["cross(A, B)"], description: "Calculate the cross product for two vectors in three dimensional space.", examples: ["cross([1, 1, 0], [0, 1, 1])", "cross([3, -3, 1], [4, 9, 2])", "cross([2, 3, 4], [5, 6, 7])"], seealso: ["multiply", "dot"] }, OI = { name: "ctranspose", category: "Matrix", syntax: ["x'", "ctranspose(x)"], description: "Complex Conjugate and Transpose a matrix", examples: ["a = [1, 2, 3; 4, 5, 6]", "a'", "ctranspose(a)"], seealso: ["concat", "det", "diag", "identity", "inv", "ones", "range", "size", "squeeze", "subset", "trace", "zeros"] }, BI = { name: "det", category: "Matrix", syntax: ["det(x)"], description: "Calculate the determinant of a matrix", examples: ["det([1, 2; 3, 4])", "det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"], seealso: ["concat", "diag", "identity", "inv", "ones", "range", "size", "squeeze", "subset", "trace", "transpose", "zeros"] }, $I = { name: "diag", category: "Matrix", syntax: ["diag(x)", "diag(x, k)"], description: "Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.", examples: ["diag(1:3)", "diag(1:3, 1)", "a = [1, 2, 3; 4, 5, 6; 7, 8, 9]", "diag(a)"], seealso: ["concat", "det", "identity", "inv", "ones", "range", "size", "squeeze", "subset", "trace", "transpose", "zeros"] }, II = { name: "diff", category: "Matrix", syntax: ["diff(arr)", "diff(arr, dim)"], description: ["Create a new matrix or array with the difference of the passed matrix or array.", "Dim parameter is optional and used to indicate the dimension of the array/matrix to apply the difference", "If no dimension parameter is passed it is assumed as dimension 0", "Dimension is zero-based in javascript and one-based in the parser", "Arrays must be 'rectangular' meaning arrays like [1, 2]", "If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"], examples: ["A = [1, 2, 4, 7, 0]", "diff(A)", "diff(A, 1)", "B = [[1, 2], [3, 4]]", "diff(B)", "diff(B, 1)", "diff(B, 2)", "diff(B, bignumber(2))", "diff([[1, 2], matrix([3, 4])], 2)"], seealso: ["subtract", "partitionSelect"] }, RI = { name: "dot", category: "Matrix", syntax: ["dot(A, B)", "A * B"], description: "Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn", examples: ["dot([2, 4, 1], [2, 2, 3])", "[2, 4, 1] * [2, 2, 3]"], seealso: ["multiply", "cross"] }, PI = { name: "eigs", category: "Matrix", syntax: ["eigs(x)"], description: "Calculate the eigenvalues and optionally eigenvectors of a square matrix", examples: ["eigs([[5, 2.3], [2.3, 1]])", "eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"], seealso: ["inv"] }, zI = { name: "filter", category: "Matrix", syntax: ["filter(x, test)"], description: "Filter items in a matrix.", examples: ["isPositive(x) = x > 0", "filter([6, -2, -1, 4, 3], isPositive)", "filter([6, -2, 0, 1, 0], x != 0)"], seealso: ["sort", "map", "forEach"] }, qI = { name: "flatten", category: "Matrix", syntax: ["flatten(x)"], description: "Flatten a multi dimensional matrix into a single dimensional matrix.", examples: ["a = [1, 2, 3; 4, 5, 6]", "size(a)", "b = flatten(a)", "size(b)"], seealso: ["concat", "resize", "size", "squeeze"] }, LI = { name: "forEach", category: "Matrix", syntax: ["forEach(x, callback)"], description: "Iterates over all elements of a matrix/array, and executes the given callback function.", examples: ["numberOfPets = {}", "addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;", 'forEach(["Dog","Cat","Cat"], addPet)', "numberOfPets"], seealso: ["map", "sort", "filter"] }, UI = { name: "getMatrixDataType", category: "Matrix", syntax: ["getMatrixDataType(x)"], description: 'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".', examples: ["getMatrixDataType([1, 2, 3])", "getMatrixDataType([[5 cm], [2 inch]])", 'getMatrixDataType([1, "text"])', "getMatrixDataType([1, bignumber(4)])"], seealso: ["matrix", "sparse", "typeOf"] }, kI = { name: "identity", category: "Matrix", syntax: ["identity(n)", "identity(m, n)", "identity([m, n])"], description: "Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.", examples: ["identity(3)", "identity(3, 5)", "a = [1, 2, 3; 4, 5, 6]", "identity(size(a))"], seealso: ["concat", "det", "diag", "inv", "ones", "range", "size", "squeeze", "subset", "trace", "transpose", "zeros"] }, VI = { name: "inv", category: "Matrix", syntax: ["inv(x)"], description: "Calculate the inverse of a matrix", examples: ["inv([1, 2; 3, 4])", "inv(4)", "1 / 4"], seealso: ["concat", "det", "diag", "identity", "ones", "range", "size", "squeeze", "subset", "trace", "transpose", "zeros"] }, HI = { name: "pinv", category: "Matrix", syntax: ["pinv(x)"], description: "Calculate the Moore–Penrose inverse of a matrix", examples: ["pinv([1, 2; 3, 4])", "pinv([[1, 0], [0, 1], [0, 1]])", "pinv(4)"], seealso: ["inv"] }, ZI = { name: "kron", category: "Matrix", syntax: ["kron(x, y)"], description: "Calculates the Kronecker product of 2 matrices or vectors.", examples: ["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])", "kron([1,1], [2,3,4])"], seealso: ["multiply", "dot", "cross"] }, GI = { name: "map", category: "Matrix", syntax: ["map(x, callback)", "map(x, y, ..., callback)"], description: "Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.", examples: ["map([1, 2, 3], square)", "map([1, 2], [3, 4], f(a,b) = a + b)"], seealso: ["filter", "forEach"] }, WI = { name: "matrixFromColumns", category: "Matrix", syntax: ["matrixFromColumns(...arr)", "matrixFromColumns(row1, row2)", "matrixFromColumns(row1, row2, row3)"], description: "Create a dense matrix from vectors as individual columns.", examples: ["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"], seealso: ["matrix", "matrixFromRows", "matrixFromFunction", "zeros"] }, KI = { name: "matrixFromFunction", category: "Matrix", syntax: ["matrixFromFunction(size, fn)", "matrixFromFunction(size, fn, format)", "matrixFromFunction(size, fn, format, datatype)", "matrixFromFunction(size, format, fn)", "matrixFromFunction(size, format, datatype, fn)"], description: "Create a matrix by evaluating a generating function at each index.", examples: ["f(I) = I[1] - I[2]", "matrixFromFunction([3,3], f)", "g(I) = I[1] - I[2] == 1 ? 4 : 0", 'matrixFromFunction([100, 100], "sparse", g)', "matrixFromFunction([5], random)"], seealso: ["matrix", "matrixFromRows", "matrixFromColumns", "zeros"] }, JI = { name: "matrixFromRows", category: "Matrix", syntax: ["matrixFromRows(...arr)", "matrixFromRows(row1, row2)", "matrixFromRows(row1, row2, row3)"], description: "Create a dense matrix from vectors as individual rows.", examples: ["matrixFromRows([1, 2, 3], [[4],[5],[6]])"], seealso: ["matrix", "matrixFromColumns", "matrixFromFunction", "zeros"] }, YI = { name: "ones", category: "Matrix", syntax: ["ones(m)", "ones(m, n)", "ones(m, n, p, ...)", "ones([m])", "ones([m, n])", "ones([m, n, p, ...])"], description: "Create a matrix containing ones.", examples: ["ones(3)", "ones(3, 5)", "ones([2,3]) * 4.5", "a = [1, 2, 3; 4, 5, 6]", "ones(size(a))"], seealso: ["concat", "det", "diag", "identity", "inv", "range", "size", "squeeze", "subset", "trace", "transpose", "zeros"] }, jI = { name: "partitionSelect", category: "Matrix", syntax: ["partitionSelect(x, k)", "partitionSelect(x, k, compare)"], description: "Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.", examples: ["partitionSelect([5, 10, 1], 2)", 'partitionSelect(["C", "B", "A", "D"], 1, compareText)', "arr = [5, 2, 1]", "partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]", "arr", "partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]", "arr"], seealso: ["sort"] }, XI = { name: "range", category: "Type", syntax: ["start:end", "start:step:end", "range(start, end)", "range(start, end, step)", "range(string)"], description: "Create a range. Lower bound of the range is included, upper bound is excluded.", examples: ["1:5", "3:-1:-3", "range(3, 7)", "range(0, 12, 2)", 'range("4:10")', "range(1m, 1m, 3m)", "a = [1, 2, 3, 4; 5, 6, 7, 8]", "a[1:2, 1:2]"], seealso: ["concat", "det", "diag", "identity", "inv", "ones", "size", "squeeze", "subset", "trace", "transpose", "zeros"] }, QI = { name: "reshape", category: "Matrix", syntax: ["reshape(x, sizes)"], description: "Reshape a multi dimensional array to fit the specified dimensions.", examples: ["reshape([1, 2, 3, 4, 5, 6], [2, 3])", "reshape([[1, 2], [3, 4]], [1, 4])", "reshape([[1, 2], [3, 4]], [4])", "reshape([1, 2, 3, 4], [-1, 2])"], seealso: ["size", "squeeze", "resize"] }, eR = { name: "resize", category: "Matrix", syntax: ["resize(x, size)", "resize(x, size, defaultValue)"], description: "Resize a matrix.", examples: ["resize([1,2,3,4,5], [3])", "resize([1,2,3], [5])", "resize([1,2,3], [5], -1)", "resize(2, [2, 3])", 'resize("hello", [8], "!")'], seealso: ["size", "subset", "squeeze", "reshape"] }, rR = { name: "rotate", category: "Matrix", syntax: ["rotate(w, theta)", "rotate(w, theta, v)"], description: "Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.", examples: ["rotate([1, 0], pi / 2)", 'rotate(matrix([1, 0]), unit("35deg"))', 'rotate([1, 0, 0], unit("90deg"), [0, 0, 1])', 'rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'], seealso: ["matrix", "rotationMatrix"] }, tR = { name: "rotationMatrix", category: "Matrix", syntax: ["rotationMatrix(theta)", "rotationMatrix(theta, v)", "rotationMatrix(theta, v, format)"], description: "Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.", examples: ["rotationMatrix(pi / 2)", 'rotationMatrix(unit("45deg"), [0, 0, 1])', 'rotationMatrix(1, matrix([0, 0, 1]), "sparse")'], seealso: ["cos", "sin"] }, nR = { name: "row", category: "Matrix", syntax: ["row(x, index)"], description: "Return a row from a matrix or array.", examples: ["A = [[1, 2], [3, 4]]", "row(A, 1)", "row(A, 2)"], seealso: ["column", "matrixFromRows"] }, aR = { name: "size", category: "Matrix", syntax: ["size(x)"], description: "Calculate the size of a matrix.", examples: ["size(2.3)", 'size("hello world")', "a = [1, 2; 3, 4; 5, 6]", "size(a)", "size(1:6)"], seealso: ["concat", "count", "det", "diag", "identity", "inv", "ones", "range", "squeeze", "subset", "trace", "transpose", "zeros"] }, iR = { name: "sort", category: "Matrix", syntax: ["sort(x)", "sort(x, compare)"], description: 'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.', examples: ["sort([5, 10, 1])", 'sort(["C", "B", "A", "D"], "natural")', "sortByLength(a, b) = size(a)[1] - size(b)[1]", 'sort(["Langdon", "Tom", "Sara"], sortByLength)', 'sort(["10", "1", "2"], "natural")'], seealso: ["map", "filter", "forEach"] }, oR = { name: "squeeze", category: "Matrix", syntax: ["squeeze(x)"], description: "Remove inner and outer singleton dimensions from a matrix.", examples: ["a = zeros(3,2,1)", "size(squeeze(a))", "b = zeros(1,1,3)", "size(squeeze(b))"], seealso: ["concat", "det", "diag", "identity", "inv", "ones", "range", "size", "subset", "trace", "transpose", "zeros"] }, sR = { name: "subset", category: "Matrix", syntax: ["value(index)", "value(index) = replacement", "subset(value, [index])", "subset(value, [index], replacement)"], description: "Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.", examples: ["d = [1, 2; 3, 4]", "e = []", "e[1, 1:2] = [5, 6]", "e[2, :] = [7, 8]", "f = d * e", "f[2, 1]", "f[:, 1]", "f[[1,2], [1,3]] = [9, 10; 11, 12]", "f"], seealso: ["concat", "det", "diag", "identity", "inv", "ones", "range", "size", "squeeze", "trace", "transpose", "zeros"] }, uR = { name: "trace", category: "Matrix", syntax: ["trace(A)"], description: "Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.", examples: ["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]", "trace(A)"], seealso: ["concat", "det", "diag", "identity", "inv", "ones", "range", "size", "squeeze", "subset", "transpose", "zeros"] }, lR = { name: "transpose", category: "Matrix", syntax: ["x'", "transpose(x)"], description: "Transpose a matrix", examples: ["a = [1, 2, 3; 4, 5, 6]", "a'", "transpose(a)"], seealso: ["concat", "det", "diag", "identity", "inv", "ones", "range", "size", "squeeze", "subset", "trace", "zeros"] }, cR = { name: "zeros", category: "Matrix", syntax: ["zeros(m)", "zeros(m, n)", "zeros(m, n, p, ...)", "zeros([m])", "zeros([m, n])", "zeros([m, n, p, ...])"], description: "Create a matrix containing zeros.", examples: ["zeros(3)", "zeros(3, 5)", "a = [1, 2, 3; 4, 5, 6]", "zeros(size(a))"], seealso: ["concat", "det", "diag", "identity", "inv", "ones", "range", "size", "squeeze", "subset", "trace", "transpose"] }, fR = { name: "fft", category: "Matrix", syntax: ["fft(x)"], description: "Calculate N-dimensional Fourier transform", examples: ["fft([[1, 0], [1, 0]])"], seealso: ["ifft"] }, dR = { name: "ifft", category: "Matrix", syntax: ["ifft(x)"], description: "Calculate N-dimensional inverse Fourier transform", examples: ["ifft([[2, 2], [0, 0]])"], seealso: ["fft"] }, pR = { name: "combinations", category: "Probability", syntax: ["combinations(n, k)"], description: "Compute the number of combinations of n items taken k at a time", examples: ["combinations(7, 5)"], seealso: ["combinationsWithRep", "permutations", "factorial"] }, mR = { name: "combinationsWithRep", category: "Probability", syntax: ["combinationsWithRep(n, k)"], description: "Compute the number of combinations of n items taken k at a time with replacements.", examples: ["combinationsWithRep(7, 5)"], seealso: ["combinations", "permutations", "factorial"] }, vR = { name: "factorial", category: "Probability", syntax: ["n!", "factorial(n)"], description: "Compute the factorial of a value", examples: ["5!", "5 * 4 * 3 * 2 * 1", "3!"], seealso: ["combinations", "combinationsWithRep", "permutations", "gamma"] }, hR = { name: "gamma", category: "Probability", syntax: ["gamma(n)"], description: "Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.", examples: ["gamma(4)", "3!", "gamma(1/2)", "sqrt(pi)"], seealso: ["factorial"] }, gR = { name: "lgamma", category: "Probability", syntax: ["lgamma(n)"], description: "Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.", examples: ["lgamma(4)", "lgamma(1/2)", "lgamma(i)", "lgamma(complex(1.1, 2))"], seealso: ["gamma"] }, yR = { name: "kldivergence", category: "Probability", syntax: ["kldivergence(x, y)"], description: "Calculate the Kullback-Leibler (KL) divergence between two distributions.", examples: ["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"], seealso: [] }, bR = { name: "multinomial", category: "Probability", syntax: ["multinomial(A)"], description: "Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.", examples: ["multinomial([1, 2, 1])"], seealso: ["combinations", "factorial"] }, wR = { name: "permutations", category: "Probability", syntax: ["permutations(n)", "permutations(n, k)"], description: "Compute the number of permutations of n items taken k at a time", examples: ["permutations(5)", "permutations(5, 3)"], seealso: ["combinations", "combinationsWithRep", "factorial"] }, xR = { name: "pickRandom", category: "Probability", syntax: ["pickRandom(array)", "pickRandom(array, number)", "pickRandom(array, weights)", "pickRandom(array, number, weights)", "pickRandom(array, weights, number)"], description: "Pick a random entry from a given array.", examples: ["pickRandom(0:10)", "pickRandom([1, 3, 1, 6])", "pickRandom([1, 3, 1, 6], 2)", "pickRandom([1, 3, 1, 6], [2, 3, 2, 1])", "pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])", "pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"], seealso: ["random", "randomInt"] }, AR = { name: "random", category: "Probability", syntax: ["random()", "random(max)", "random(min, max)", "random(size)", "random(size, max)", "random(size, min, max)"], description: "Return a random number.", examples: ["random()", "random(10, 20)", "random([2, 3])"], seealso: ["pickRandom", "randomInt"] }, NR = { name: "randomInt", category: "Probability", syntax: ["randomInt(max)", "randomInt(min, max)", "randomInt(size)", "randomInt(size, max)", "randomInt(size, min, max)"], description: "Return a random integer number", examples: ["randomInt(10, 20)", "randomInt([2, 3], 10)"], seealso: ["pickRandom", "random"] }, DR = { name: "compare", category: "Relational", syntax: ["compare(x, y)"], description: "Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.", examples: ["compare(2, 3)", "compare(3, 2)", "compare(2, 2)", "compare(5cm, 40mm)", "compare(2, [1, 2, 3])"], seealso: ["equal", "unequal", "smaller", "smallerEq", "largerEq", "compareNatural", "compareText"] }, ER = { name: "compareNatural", category: "Relational", syntax: ["compareNatural(x, y)"], description: "Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.", examples: ["compareNatural(2, 3)", "compareNatural(3, 2)", "compareNatural(2, 2)", "compareNatural(5cm, 40mm)", 'compareNatural("2", "10")', "compareNatural(2 + 3i, 2 + 4i)", "compareNatural([1, 2, 4], [1, 2, 3])", "compareNatural([1, 5], [1, 2, 3])", "compareNatural([1, 2], [1, 2])", "compareNatural({a: 2}, {a: 4})"], seealso: ["equal", "unequal", "smaller", "smallerEq", "largerEq", "compare", "compareText"] }, SR = { name: "compareText", category: "Relational", syntax: ["compareText(x, y)"], description: "Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.", examples: ['compareText("B", "A")', 'compareText("A", "B")', 'compareText("A", "A")', 'compareText("2", "10")', 'compare("2", "10")', "compare(2, 10)", 'compareNatural("2", "10")', 'compareText("B", ["A", "B", "C"])'], seealso: ["compare", "compareNatural"] }, CR = { name: "deepEqual", category: "Relational", syntax: ["deepEqual(x, y)"], description: "Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.", examples: ["deepEqual([1,3,4], [1,3,4])", "deepEqual([1,3,4], [1,3])"], seealso: ["equal", "unequal", "smaller", "larger", "smallerEq", "largerEq", "compare"] }, MR = { name: "equal", category: "Relational", syntax: ["x == y", "equal(x, y)"], description: "Check equality of two values. Returns true if the values are equal, and false if not.", examples: ["2+2 == 3", "2+2 == 4", "a = 3.2", "b = 6-2.8", "a == b", "50cm == 0.5m"], seealso: ["unequal", "smaller", "larger", "smallerEq", "largerEq", "compare", "deepEqual", "equalText"] }, _R = { name: "equalText", category: "Relational", syntax: ["equalText(x, y)"], description: "Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.", examples: ['equalText("Hello", "Hello")', 'equalText("a", "A")', 'equal("2e3", "2000")', 'equalText("2e3", "2000")', 'equalText("B", ["A", "B", "C"])'], seealso: ["compare", "compareNatural", "compareText", "equal"] }, FR = { name: "larger", category: "Relational", syntax: ["x > y", "larger(x, y)"], description: "Check if value x is larger than y. Returns true if x is larger than y, and false if not.", examples: ["2 > 3", "5 > 2*2", "a = 3.3", "b = 6-2.8", "(a > b)", "(b < a)", "5 cm > 2 inch"], seealso: ["equal", "unequal", "smaller", "smallerEq", "largerEq", "compare"] }, TR = { name: "largerEq", category: "Relational", syntax: ["x >= y", "largerEq(x, y)"], description: "Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.", examples: ["2 >= 1+1", "2 > 1+1", "a = 3.2", "b = 6-2.8", "(a >= b)"], seealso: ["equal", "unequal", "smallerEq", "smaller", "compare"] }, OR = { name: "smaller", category: "Relational", syntax: ["x < y", "smaller(x, y)"], description: "Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.", examples: ["2 < 3", "5 < 2*2", "a = 3.3", "b = 6-2.8", "(a < b)", "5 cm < 2 inch"], seealso: ["equal", "unequal", "larger", "smallerEq", "largerEq", "compare"] }, BR = { name: "smallerEq", category: "Relational", syntax: ["x <= y", "smallerEq(x, y)"], description: "Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.", examples: ["2 <= 1+1", "2 < 1+1", "a = 3.2", "b = 6-2.8", "(a <= b)"], seealso: ["equal", "unequal", "larger", "smaller", "largerEq", "compare"] }, $R = { name: "unequal", category: "Relational", syntax: ["x != y", "unequal(x, y)"], description: "Check unequality of two values. Returns true if the values are unequal, and false if they are equal.", examples: ["2+2 != 3", "2+2 != 4", "a = 3.2", "b = 6-2.8", "a != b", "50cm != 0.5m", "5 cm != 2 inch"], seealso: ["equal", "smaller", "larger", "smallerEq", "largerEq", "compare", "deepEqual"] }, IR = { name: "setCartesian", category: "Set", syntax: ["setCartesian(set1, set2)"], description: "Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.", examples: ["setCartesian([1, 2], [3, 4])"], seealso: ["setUnion", "setIntersect", "setDifference", "setPowerset"] }, RR = { name: "setDifference", category: "Set", syntax: ["setDifference(set1, set2)"], description: "Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.", examples: ["setDifference([1, 2, 3, 4], [3, 4, 5, 6])", "setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"], seealso: ["setUnion", "setIntersect", "setSymDifference"] }, PR = { name: "setDistinct", category: "Set", syntax: ["setDistinct(set)"], description: "Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.", examples: ["setDistinct([1, 1, 1, 2, 2, 3])"], seealso: ["setMultiplicity"] }, zR = { name: "setIntersect", category: "Set", syntax: ["setIntersect(set1, set2)"], description: "Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.", examples: ["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])", "setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"], seealso: ["setUnion", "setDifference"] }, qR = { name: "setIsSubset", category: "Set", syntax: ["setIsSubset(set1, set2)"], description: "Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.", examples: ["setIsSubset([1, 2], [3, 4, 5, 6])", "setIsSubset([3, 4], [3, 4, 5, 6])"], seealso: ["setUnion", "setIntersect", "setDifference"] }, LR = { name: "setMultiplicity", category: "Set", syntax: ["setMultiplicity(element, set)"], description: "Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.", examples: ["setMultiplicity(1, [1, 2, 2, 4])", "setMultiplicity(2, [1, 2, 2, 4])"], seealso: ["setDistinct", "setSize"] }, UR = { name: "setPowerset", category: "Set", syntax: ["setPowerset(set)"], description: "Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.", examples: ["setPowerset([1, 2, 3])"], seealso: ["setCartesian"] }, kR = { name: "setSize", category: "Set", syntax: ["setSize(set)", "setSize(set, unique)"], description: 'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.', examples: ["setSize([1, 2, 2, 4])", "setSize([1, 2, 2, 4], true)"], seealso: ["setUnion", "setIntersect", "setDifference"] }, VR = { name: "setSymDifference", category: "Set", syntax: ["setSymDifference(set1, set2)"], description: "Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.", examples: ["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])", "setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"], seealso: ["setUnion", "setIntersect", "setDifference"] }, HR = { name: "setUnion", category: "Set", syntax: ["setUnion(set1, set2)"], description: "Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.", examples: ["setUnion([1, 2, 3, 4], [3, 4, 5, 6])", "setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"], seealso: ["setIntersect", "setDifference"] }, ZR = { name: "zpk2tf", category: "Signal", syntax: ["zpk2tf(z, p, k)"], description: "Compute the transfer function of a zero-pole-gain model.", examples: ["zpk2tf([1, 2], [-1, -2], 1)", "zpk2tf([1, 2], [-1, -2])", "zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"], seealso: [] }, GR = { name: "freqz", category: "Signal", syntax: ["freqz(b, a)", "freqz(b, a, w)"], description: "Calculates the frequency response of a filter given its numerator and denominator coefficients.", examples: ["freqz([1, 2], [1, 2, 3])", "freqz([1, 2], [1, 2, 3], [0, 1])", "freqz([1, 2], [1, 2, 3], 512)"], seealso: [] }, WR = { name: "erf", category: "Special", syntax: ["erf(x)"], description: "Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x", examples: ["erf(0.2)", "erf(-0.5)", "erf(4)"], seealso: [] }, KR = { name: "zeta", category: "Special", syntax: ["zeta(s)"], description: "Compute the Riemann Zeta Function using an infinite series and Riemann's Functional Equation for the entire complex plane", examples: ["zeta(0.2)", "zeta(-0.5)", "zeta(4)"], seealso: [] }, JR = { name: "mad", category: "Statistics", syntax: ["mad(a, b, c, ...)", "mad(A)"], description: "Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.", examples: ["mad(10, 20, 30)", "mad([1, 2, 3])"], seealso: ["mean", "median", "std", "abs"] }, YR = { name: "max", category: "Statistics", syntax: ["max(a, b, c, ...)", "max(A)", "max(A, dimension)"], description: "Compute the maximum value of a list of values.", examples: ["max(2, 3, 4, 1)", "max([2, 3, 4, 1])", "max([2, 5; 4, 3])", "max([2, 5; 4, 3], 1)", "max([2, 5; 4, 3], 2)", "max(2.7, 7.1, -4.5, 2.0, 4.1)", "min(2.7, 7.1, -4.5, 2.0, 4.1)"], seealso: ["mean", "median", "min", "prod", "std", "sum", "variance"] }, jR = { name: "mean", category: "Statistics", syntax: ["mean(a, b, c, ...)", "mean(A)", "mean(A, dimension)"], description: "Compute the arithmetic mean of a list of values.", examples: ["mean(2, 3, 4, 1)", "mean([2, 3, 4, 1])", "mean([2, 5; 4, 3])", "mean([2, 5; 4, 3], 1)", "mean([2, 5; 4, 3], 2)", "mean([1.0, 2.7, 3.2, 4.0])"], seealso: ["max", "median", "min", "prod", "std", "sum", "variance"] }, XR = { name: "median", category: "Statistics", syntax: ["median(a, b, c, ...)", "median(A)"], description: "Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.", examples: ["median(5, 2, 7)", "median([3, -1, 5, 7])"], seealso: ["max", "mean", "min", "prod", "std", "sum", "variance", "quantileSeq"] }, QR = { name: "min", category: "Statistics", syntax: ["min(a, b, c, ...)", "min(A)", "min(A, dimension)"], description: "Compute the minimum value of a list of values.", examples: ["min(2, 3, 4, 1)", "min([2, 3, 4, 1])", "min([2, 5; 4, 3])", "min([2, 5; 4, 3], 1)", "min([2, 5; 4, 3], 2)", "min(2.7, 7.1, -4.5, 2.0, 4.1)", "max(2.7, 7.1, -4.5, 2.0, 4.1)"], seealso: ["max", "mean", "median", "prod", "std", "sum", "variance"] }, eP = { name: "mode", category: "Statistics", syntax: ["mode(a, b, c, ...)", "mode(A)", "mode(A, a, b, B, c, ...)"], description: "Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.", examples: ["mode(2, 1, 4, 3, 1)", "mode([1, 2.7, 3.2, 4, 2.7])", "mode(1, 4, 6, 1, 6)"], seealso: ["max", "mean", "min", "median", "prod", "std", "sum", "variance"] }, rP = { name: "prod", category: "Statistics", syntax: ["prod(a, b, c, ...)", "prod(A)"], description: "Compute the product of all values.", examples: ["prod(2, 3, 4)", "prod([2, 3, 4])", "prod([2, 5; 4, 3])"], seealso: ["max", "mean", "min", "median", "min", "std", "sum", "variance"] }, tP = { name: "quantileSeq", category: "Statistics", syntax: ["quantileSeq(A, prob[, sorted])", "quantileSeq(A, [prob1, prob2, ...][, sorted])", "quantileSeq(A, N[, sorted])"], description: `Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber. In case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.`, examples: ["quantileSeq([3, -1, 5, 7], 0.5)", "quantileSeq([3, -1, 5, 7], [1/3, 2/3])", "quantileSeq([3, -1, 5, 7], 2)", "quantileSeq([-1, 3, 5, 7], 0.5, true)"], seealso: ["mean", "median", "min", "max", "prod", "std", "sum", "variance"] }, nP = { name: "std", category: "Statistics", syntax: ["std(a, b, c, ...)", "std(A)", "std(A, dimension)", "std(A, normalization)", "std(A, dimension, normalization)"], description: 'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".', examples: ["std(2, 4, 6)", "std([2, 4, 6, 8])", 'std([2, 4, 6, 8], "uncorrected")', 'std([2, 4, 6, 8], "biased")', "std([1, 2, 3; 4, 5, 6])"], seealso: ["max", "mean", "min", "median", "prod", "sum", "variance"] }, aP = { name: "cumsum", category: "Statistics", syntax: ["cumsum(a, b, c, ...)", "cumsum(A)"], description: "Compute the cumulative sum of all values.", examples: ["cumsum(2, 3, 4, 1)", "cumsum([2, 3, 4, 1])", "cumsum([1, 2; 3, 4])", "cumsum([1, 2; 3, 4], 1)", "cumsum([1, 2; 3, 4], 2)"], seealso: ["max", "mean", "median", "min", "prod", "std", "sum", "variance"] }, iP = { name: "sum", category: "Statistics", syntax: ["sum(a, b, c, ...)", "sum(A)", "sum(A, dimension)"], description: "Compute the sum of all values.", examples: ["sum(2, 3, 4, 1)", "sum([2, 3, 4, 1])", "sum([2, 5; 4, 3])"], seealso: ["max", "mean", "median", "min", "prod", "std", "sum", "variance"] }, oP = { name: "variance", category: "Statistics", syntax: ["variance(a, b, c, ...)", "variance(A)", "variance(A, dimension)", "variance(A, normalization)", "variance(A, dimension, normalization)"], description: 'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".', examples: ["variance(2, 4, 6)", "variance([2, 4, 6, 8])", 'variance([2, 4, 6, 8], "uncorrected")', 'variance([2, 4, 6, 8], "biased")', "variance([1, 2, 3; 4, 5, 6])"], seealso: ["max", "mean", "min", "median", "min", "prod", "std", "sum"] }, sP = { name: "corr", category: "Statistics", syntax: ["corr(A,B)"], description: "Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.", examples: ["corr([2, 4, 6, 8],[1, 2, 3, 6])", "corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"], seealso: ["max", "mean", "min", "median", "min", "prod", "std", "sum"] }, uP = { name: "acos", category: "Trigonometry", syntax: ["acos(x)"], description: "Compute the inverse cosine of a value in radians.", examples: ["acos(0.5)", "acos(cos(2.3))"], seealso: ["cos", "atan", "asin"] }, lP = { name: "acosh", category: "Trigonometry", syntax: ["acosh(x)"], description: "Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.", examples: ["acosh(1.5)"], seealso: ["cosh", "asinh", "atanh"] }, cP = { name: "acot", category: "Trigonometry", syntax: ["acot(x)"], description: "Calculate the inverse cotangent of a value.", examples: ["acot(0.5)", "acot(cot(0.5))", "acot(2)"], seealso: ["cot", "atan"] }, fP = { name: "acoth", category: "Trigonometry", syntax: ["acoth(x)"], description: "Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.", examples: ["acoth(2)", "acoth(0.5)"], seealso: ["acsch", "asech"] }, dP = { name: "acsc", category: "Trigonometry", syntax: ["acsc(x)"], description: "Calculate the inverse cotangent of a value.", examples: ["acsc(2)", "acsc(csc(0.5))", "acsc(0.5)"], seealso: ["csc", "asin", "asec"] }, pP = { name: "acsch", category: "Trigonometry", syntax: ["acsch(x)"], description: "Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.", examples: ["acsch(0.5)"], seealso: ["asech", "acoth"] }, mP = { name: "asec", category: "Trigonometry", syntax: ["asec(x)"], description: "Calculate the inverse secant of a value.", examples: ["asec(0.5)", "asec(sec(0.5))", "asec(2)"], seealso: ["acos", "acot", "acsc"] }, vP = { name: "asech", category: "Trigonometry", syntax: ["asech(x)"], description: "Calculate the inverse secant of a value.", examples: ["asech(0.5)"], seealso: ["acsch", "acoth"] }, hP = { name: "asin", category: "Trigonometry", syntax: ["asin(x)"], description: "Compute the inverse sine of a value in radians.", examples: ["asin(0.5)", "asin(sin(0.5))"], seealso: ["sin", "acos", "atan"] }, gP = { name: "asinh", category: "Trigonometry", syntax: ["asinh(x)"], description: "Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.", examples: ["asinh(0.5)"], seealso: ["acosh", "atanh"] }, yP = { name: "atan", category: "Trigonometry", syntax: ["atan(x)"], description: "Compute the inverse tangent of a value in radians.", examples: ["atan(0.5)", "atan(tan(0.5))"], seealso: ["tan", "acos", "asin"] }, bP = { name: "atan2", category: "Trigonometry", syntax: ["atan2(y, x)"], description: "Computes the principal value of the arc tangent of y/x in radians.", examples: ["atan2(2, 2) / pi", "angle = 60 deg in rad", "x = cos(angle)", "y = sin(angle)", "atan2(y, x)"], seealso: ["sin", "cos", "tan"] }, wP = { name: "atanh", category: "Trigonometry", syntax: ["atanh(x)"], description: "Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.", examples: ["atanh(0.5)"], seealso: ["acosh", "asinh"] }, xP = { name: "cos", category: "Trigonometry", syntax: ["cos(x)"], description: "Compute the cosine of x in radians.", examples: ["cos(2)", "cos(pi / 4) ^ 2", "cos(180 deg)", "cos(60 deg)", "sin(0.2)^2 + cos(0.2)^2"], seealso: ["acos", "sin", "tan"] }, AP = { name: "cosh", category: "Trigonometry", syntax: ["cosh(x)"], description: "Compute the hyperbolic cosine of x in radians.", examples: ["cosh(0.5)"], seealso: ["sinh", "tanh", "coth"] }, NP = { name: "cot", category: "Trigonometry", syntax: ["cot(x)"], description: "Compute the cotangent of x in radians. Defined as 1/tan(x)", examples: ["cot(2)", "1 / tan(2)"], seealso: ["sec", "csc", "tan"] }, DP = { name: "coth", category: "Trigonometry", syntax: ["coth(x)"], description: "Compute the hyperbolic cotangent of x in radians.", examples: ["coth(2)", "1 / tanh(2)"], seealso: ["sech", "csch", "tanh"] }, EP = { name: "csc", category: "Trigonometry", syntax: ["csc(x)"], description: "Compute the cosecant of x in radians. Defined as 1/sin(x)", examples: ["csc(2)", "1 / sin(2)"], seealso: ["sec", "cot", "sin"] }, SP = { name: "csch", category: "Trigonometry", syntax: ["csch(x)"], description: "Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)", examples: ["csch(2)", "1 / sinh(2)"], seealso: ["sech", "coth", "sinh"] }, CP = { name: "sec", category: "Trigonometry", syntax: ["sec(x)"], description: "Compute the secant of x in radians. Defined as 1/cos(x)", examples: ["sec(2)", "1 / cos(2)"], seealso: ["cot", "csc", "cos"] }, MP = { name: "sech", category: "Trigonometry", syntax: ["sech(x)"], description: "Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)", examples: ["sech(2)", "1 / cosh(2)"], seealso: ["coth", "csch", "cosh"] }, _P = { name: "sin", category: "Trigonometry", syntax: ["sin(x)"], description: "Compute the sine of x in radians.", examples: ["sin(2)", "sin(pi / 4) ^ 2", "sin(90 deg)", "sin(30 deg)", "sin(0.2)^2 + cos(0.2)^2"], seealso: ["asin", "cos", "tan"] }, FP = { name: "sinh", category: "Trigonometry", syntax: ["sinh(x)"], description: "Compute the hyperbolic sine of x in radians.", examples: ["sinh(0.5)"], seealso: ["cosh", "tanh"] }, TP = { name: "tan", category: "Trigonometry", syntax: ["tan(x)"], description: "Compute the tangent of x in radians.", examples: ["tan(0.5)", "sin(0.5) / cos(0.5)", "tan(pi / 4)", "tan(45 deg)"], seealso: ["atan", "sin", "cos"] }, OP = { name: "tanh", category: "Trigonometry", syntax: ["tanh(x)"], description: "Compute the hyperbolic tangent of x in radians.", examples: ["tanh(0.5)", "sinh(0.5) / cosh(0.5)"], seealso: ["sinh", "cosh"] }, BP = { name: "to", category: "Units", syntax: ["x to unit", "to(x, unit)"], description: "Change the unit of a value.", examples: ["5 inch to cm", "3.2kg to g", "16 bytes in bits"], seealso: [] }, $P = { name: "bin", category: "Utils", syntax: ["bin(value)"], description: "Format a number as binary", examples: ["bin(2)"], seealso: ["oct", "hex"] }, IP = { name: "clone", category: "Utils", syntax: ["clone(x)"], description: "Clone a variable. Creates a copy of primitive variables, and a deep copy of matrices", examples: ["clone(3.5)", "clone(2 - 4i)", "clone(45 deg)", "clone([1, 2; 3, 4])", 'clone("hello world")'], seealso: [] }, RP = { name: "format", category: "Utils", syntax: ["format(value)", "format(value, precision)"], description: "Format a value of any type as string.", examples: ["format(2.3)", "format(3 - 4i)", "format([])", "format(pi, 3)"], seealso: ["print"] }, PP = { name: "hasNumericValue", category: "Utils", syntax: ["hasNumericValue(x)"], description: "Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.", examples: ["hasNumericValue(2)", 'hasNumericValue("2")', 'isNumeric("2")', "hasNumericValue(0)", "hasNumericValue(bignumber(500))", "hasNumericValue(fraction(0.125))", "hasNumericValue(2 + 3i)", 'hasNumericValue([2.3, "foo", false])'], seealso: ["isInteger", "isZero", "isNegative", "isPositive", "isNaN", "isNumeric"] }, zP = { name: "hex", category: "Utils", syntax: ["hex(value)"], description: "Format a number as hexadecimal", examples: ["hex(240)"], seealso: ["bin", "oct"] }, qP = { name: "isInteger", category: "Utils", syntax: ["isInteger(x)"], description: "Test whether a value is an integer number.", examples: ["isInteger(2)", "isInteger(3.5)", "isInteger([3, 0.5, -2])"], seealso: ["isNegative", "isNumeric", "isPositive", "isZero"] }, LP = { name: "isNaN", category: "Utils", syntax: ["isNaN(x)"], description: "Test whether a value is NaN (not a number)", examples: ["isNaN(2)", "isNaN(0 / 0)", "isNaN(NaN)", "isNaN(Infinity)"], seealso: ["isNegative", "isNumeric", "isPositive", "isZero"] }, UP = { name: "isNegative", category: "Utils", syntax: ["isNegative(x)"], description: "Test whether a value is negative: smaller than zero.", examples: ["isNegative(2)", "isNegative(0)", "isNegative(-4)", "isNegative([3, 0.5, -2])"], seealso: ["isInteger", "isNumeric", "isPositive", "isZero"] }, kP = { name: "isNumeric", category: "Utils", syntax: ["isNumeric(x)"], description: "Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.", examples: ["isNumeric(2)", 'isNumeric("2")', 'hasNumericValue("2")', "isNumeric(0)", "isNumeric(bignumber(500))", "isNumeric(fraction(0.125))", "isNumeric(2 + 3i)", 'isNumeric([2.3, "foo", false])'], seealso: ["isInteger", "isZero", "isNegative", "isPositive", "isNaN", "hasNumericValue"] }, VP = { name: "isPositive", category: "Utils", syntax: ["isPositive(x)"], description: "Test whether a value is positive: larger than zero.", examples: ["isPositive(2)", "isPositive(0)", "isPositive(-4)", "isPositive([3, 0.5, -2])"], seealso: ["isInteger", "isNumeric", "isNegative", "isZero"] }, HP = { name: "isPrime", category: "Utils", syntax: ["isPrime(x)"], description: "Test whether a value is prime: has no divisors other than itself and one.", examples: ["isPrime(3)", "isPrime(-2)", "isPrime([2, 17, 100])"], seealso: ["isInteger", "isNumeric", "isNegative", "isZero"] }, ZP = { name: "isZero", category: "Utils", syntax: ["isZero(x)"], description: "Test whether a value is zero.", examples: ["isZero(2)", "isZero(0)", "isZero(-4)", "isZero([3, 0, -2, 0])"], seealso: ["isInteger", "isNumeric", "isNegative", "isPositive"] }, GP = { name: "numeric", category: "Utils", syntax: ["numeric(x)"], description: "Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.", examples: ['numeric("4")', 'numeric("4", "number")', 'numeric("4", "bigint")', 'numeric("4", "BigNumber")', 'numeric("4", "Fraction")', 'numeric(4, "Fraction")', 'numeric(fraction(2, 5), "number")'], seealso: ["number", "bigint", "fraction", "bignumber", "string", "format"] }, WP = { name: "oct", category: "Utils", syntax: ["oct(value)"], description: "Format a number as octal", examples: ["oct(56)"], seealso: ["bin", "hex"] }, KP = { name: "print", category: "Utils", syntax: ["print(template, values)", "print(template, values, precision)"], description: "Interpolate values into a string template.", examples: ['print("Lucy is $age years old", {age: 5})', 'print("The value of pi is $pi", {pi: pi}, 3)', 'print("Hello, $user.name!", {user: {name: "John"}})', 'print("Values: $1, $2, $3", [6, 9, 4])'], seealso: ["format"] }, JP = { name: "typeOf", category: "Utils", syntax: ["typeOf(x)"], description: "Get the type of a variable.", examples: ["typeOf(3.5)", "typeOf(2 - 4i)", "typeOf(45 deg)", 'typeOf("hello world")'], seealso: ["getMatrixDataType"] }, YP = { name: "solveODE", category: "Numeric", syntax: ["solveODE(func, tspan, y0)", "solveODE(func, tspan, y0, options)"], description: "Numerical Integration of Ordinary Differential Equations.", examples: ["f(t,y) = y", "tspan = [0, 4]", "solveODE(f, tspan, 1)", "solveODE(f, tspan, [1, 2])", 'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'], seealso: ["derivative", "simplifyCore"] }, jP = { // construction functions bignumber: L$, bigint: U$, boolean: k$, complex: V$, createUnit: H$, fraction: Z$, index: G$, matrix: W$, number: K$, sparse: J$, splitUnit: Y$, string: j$, unit: X$, // constants e: cv, E: cv, false: E$, i: S$, Infinity: C$, LN2: _$, LN10: M$, LOG2E: T$, LOG10E: F$, NaN: O$, null: B$, pi: fv, PI: fv, phi: $$, SQRT1_2: I$, SQRT2: R$, tau: P$, true: z$, version: q$, // physical constants // TODO: more detailed docs for physical constants speedOfLight: { description: "Speed of light in vacuum", examples: ["speedOfLight"] }, gravitationConstant: { description: "Newtonian constant of gravitation", examples: ["gravitationConstant"] }, planckConstant: { description: "Planck constant", examples: ["planckConstant"] }, reducedPlanckConstant: { description: "Reduced Planck constant", examples: ["reducedPlanckConstant"] }, magneticConstant: { description: "Magnetic constant (vacuum permeability)", examples: ["magneticConstant"] }, electricConstant: { description: "Electric constant (vacuum permeability)", examples: ["electricConstant"] }, vacuumImpedance: { description: "Characteristic impedance of vacuum", examples: ["vacuumImpedance"] }, coulomb: { description: "Coulomb's constant", examples: ["coulomb"] }, elementaryCharge: { description: "Elementary charge", examples: ["elementaryCharge"] }, bohrMagneton: { description: "Bohr magneton", examples: ["bohrMagneton"] }, conductanceQuantum: { description: "Conductance quantum", examples: ["conductanceQuantum"] }, inverseConductanceQuantum: { description: "Inverse conductance quantum", examples: ["inverseConductanceQuantum"] }, // josephson: {description: 'Josephson constant', examples: ['josephson']}, magneticFluxQuantum: { description: "Magnetic flux quantum", examples: ["magneticFluxQuantum"] }, nuclearMagneton: { description: "Nuclear magneton", examples: ["nuclearMagneton"] }, klitzing: { description: "Von Klitzing constant", examples: ["klitzing"] }, bohrRadius: { description: "Bohr radius", examples: ["bohrRadius"] }, classicalElectronRadius: { description: "Classical electron radius", examples: ["classicalElectronRadius"] }, electronMass: { description: "Electron mass", examples: ["electronMass"] }, fermiCoupling: { description: "Fermi coupling constant", examples: ["fermiCoupling"] }, fineStructure: { description: "Fine-structure constant", examples: ["fineStructure"] }, hartreeEnergy: { description: "Hartree energy", examples: ["hartreeEnergy"] }, protonMass: { description: "Proton mass", examples: ["protonMass"] }, deuteronMass: { description: "Deuteron Mass", examples: ["deuteronMass"] }, neutronMass: { description: "Neutron mass", examples: ["neutronMass"] }, quantumOfCirculation: { description: "Quantum of circulation", examples: ["quantumOfCirculation"] }, rydberg: { description: "Rydberg constant", examples: ["rydberg"] }, thomsonCrossSection: { description: "Thomson cross section", examples: ["thomsonCrossSection"] }, weakMixingAngle: { description: "Weak mixing angle", examples: ["weakMixingAngle"] }, efimovFactor: { description: "Efimov factor", examples: ["efimovFactor"] }, atomicMass: { description: "Atomic mass constant", examples: ["atomicMass"] }, avogadro: { description: "Avogadro's number", examples: ["avogadro"] }, boltzmann: { description: "Boltzmann constant", examples: ["boltzmann"] }, faraday: { description: "Faraday constant", examples: ["faraday"] }, firstRadiation: { description: "First radiation constant", examples: ["firstRadiation"] }, loschmidt: { description: "Loschmidt constant at T=273.15 K and p=101.325 kPa", examples: ["loschmidt"] }, gasConstant: { description: "Gas constant", examples: ["gasConstant"] }, molarPlanckConstant: { description: "Molar Planck constant", examples: ["molarPlanckConstant"] }, molarVolume: { description: "Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa", examples: ["molarVolume"] }, sackurTetrode: { description: "Sackur-Tetrode constant at T=1 K and p=101.325 kPa", examples: ["sackurTetrode"] }, secondRadiation: { description: "Second radiation constant", examples: ["secondRadiation"] }, stefanBoltzmann: { description: "Stefan-Boltzmann constant", examples: ["stefanBoltzmann"] }, wienDisplacement: { description: "Wien displacement law constant", examples: ["wienDisplacement"] }, // spectralRadiance: {description: 'First radiation constant for spectral radiance', examples: ['spectralRadiance']}, molarMass: { description: "Molar mass constant", examples: ["molarMass"] }, molarMassC12: { description: "Molar mass constant of carbon-12", examples: ["molarMassC12"] }, gravity: { description: "Standard acceleration of gravity (standard acceleration of free-fall on Earth)", examples: ["gravity"] }, planckLength: { description: "Planck length", examples: ["planckLength"] }, planckMass: { description: "Planck mass", examples: ["planckMass"] }, planckTime: { description: "Planck time", examples: ["planckTime"] }, planckCharge: { description: "Planck charge", examples: ["planckCharge"] }, planckTemperature: { description: "Planck temperature", examples: ["planckTemperature"] }, // functions - algebra derivative: t9, lsolve: a9, lsolveAll: i9, lup: o9, lusolve: s9, leafCount: n9, polynomialRoot: u9, resolve: f9, simplify: d9, simplifyConstant: p9, simplifyCore: m9, symbolicEqual: h9, rationalize: c9, slu: v9, usolve: g9, usolveAll: y9, qr: l9, // functions - arithmetic abs: b9, add: w9, cbrt: x9, ceil: A9, cube: N9, divide: D9, dotDivide: E9, dotMultiply: S9, dotPow: C9, exp: M9, expm: _9, expm1: F9, fix: T9, floor: O9, gcd: B9, hypot: $9, lcm: R9, log: P9, log2: L9, log1p: q9, log10: z9, mod: U9, multiply: k9, norm: V9, nthRoot: H9, nthRoots: Z9, pow: G9, round: W9, sign: K9, sqrt: J9, sqrtm: Y9, square: eI, subtract: rI, unaryMinus: tI, unaryPlus: nI, xgcd: aI, invmod: I9, // functions - bitwise bitAnd: iI, bitNot: oI, bitOr: sI, bitXor: uI, leftShift: lI, rightArithShift: cI, rightLogShift: fI, // functions - combinatorics bellNumbers: dI, catalan: pI, composition: mI, stirlingS2: vI, // functions - core config: Q$, import: e9, typed: r9, // functions - complex arg: hI, conj: gI, re: bI, im: yI, // functions - expression evaluate: wI, help: xI, // functions - geometry distance: AI, intersect: NI, // functions - logical and: DI, not: EI, or: SI, xor: CI, // functions - matrix concat: _I, count: FI, cross: TI, column: MI, ctranspose: OI, det: BI, diag: $I, diff: II, dot: RI, getMatrixDataType: UI, identity: kI, filter: zI, flatten: qI, forEach: LI, inv: VI, pinv: HI, eigs: PI, kron: ZI, matrixFromFunction: KI, matrixFromRows: JI, matrixFromColumns: WI, map: GI, ones: YI, partitionSelect: jI, range: XI, resize: eR, reshape: QI, rotate: rR, rotationMatrix: tR, row: nR, size: aR, sort: iR, squeeze: oR, subset: sR, trace: uR, transpose: lR, zeros: cR, fft: fR, ifft: dR, sylvester: j9, schur: X9, lyap: Q9, // functions - numeric solveODE: YP, // functions - probability combinations: pR, combinationsWithRep: mR, // distribution: distributionDocs, factorial: vR, gamma: hR, kldivergence: yR, lgamma: gR, multinomial: bR, permutations: wR, pickRandom: xR, random: AR, randomInt: NR, // functions - relational compare: DR, compareNatural: ER, compareText: SR, deepEqual: CR, equal: MR, equalText: _R, larger: FR, largerEq: TR, smaller: OR, smallerEq: BR, unequal: $R, // functions - set setCartesian: IR, setDifference: RR, setDistinct: PR, setIntersect: zR, setIsSubset: qR, setMultiplicity: LR, setPowerset: UR, setSize: kR, setSymDifference: VR, setUnion: HR, // functions - signal zpk2tf: ZR, freqz: GR, // functions - special erf: WR, zeta: KR, // functions - statistics cumsum: aP, mad: JR, max: YR, mean: jR, median: XR, min: QR, mode: eP, prod: rP, quantileSeq: tP, std: nP, sum: iP, variance: oP, corr: sP, // functions - trigonometry acos: uP, acosh: lP, acot: cP, acoth: fP, acsc: dP, acsch: pP, asec: mP, asech: vP, asin: hP, asinh: gP, atan: yP, atanh: wP, atan2: bP, cos: xP, cosh: AP, cot: NP, coth: DP, csc: EP, csch: SP, sec: CP, sech: MP, sin: _P, sinh: FP, tan: TP, tanh: OP, // functions - units to: BP, // functions - utils clone: IP, format: RP, bin: $P, oct: WP, hex: zP, isNaN: LP, isInteger: qP, isNegative: UP, isNumeric: kP, hasNumericValue: PP, isPositive: VP, isPrime: HP, isZero: ZP, print: KP, typeOf: JP, numeric: GP }, dv = "help", XP = ["typed", "mathWithTransform", "Help"], QP = /* @__PURE__ */ P(dv, XP, (e) => { var { typed: r, mathWithTransform: t, Help: n } = e; return r(dv, { any: function(i) { var o, l = i; if (typeof i != "string") { for (o in t) if (Fe(t, o) && i === t[o]) { l = o; break; } } var u = it(jP, l); if (!u) { var s = typeof l == "function" ? l.name : l; throw new Error('No documentation found on "' + s + '"'); } return new n(u); } }); }), pv = "chain", e7 = ["typed", "Chain"], r7 = /* @__PURE__ */ P(pv, e7, (e) => { var { typed: r, Chain: t } = e; return r(pv, { "": function() { return new t(); }, any: function(a) { return new t(a); } }); }), mv = "det", t7 = ["typed", "matrix", "subtractScalar", "multiply", "divideScalar", "isZero", "unaryMinus"], n7 = /* @__PURE__ */ P(mv, t7, (e) => { var { typed: r, matrix: t, subtractScalar: n, multiply: a, divideScalar: i, isZero: o, unaryMinus: l } = e; return r(mv, { any: function(c) { return qe(c); }, "Array | Matrix": function(c) { var f; switch (ze(c) ? f = c.size() : Array.isArray(c) ? (c = t(c), f = c.size()) : f = [], f.length) { case 0: return qe(c); case 1: if (f[0] === 1) return qe(c.valueOf()[0]); if (f[0] === 0) return 1; throw new RangeError("Matrix must be square (size: " + Qe(f) + ")"); case 2: { var d = f[0], p = f[1]; if (d === p) return u(c.clone().valueOf(), d); if (p === 0) return 1; throw new RangeError("Matrix must be square (size: " + Qe(f) + ")"); } default: throw new RangeError("Matrix must be two dimensional (size: " + Qe(f) + ")"); } } }); function u(s, c, f) { if (c === 1) return qe(s[0][0]); if (c === 2) return n(a(s[0][0], s[1][1]), a(s[1][0], s[0][1])); for (var d = !1, p = new Array(c).fill(0).map((D, E) => E), m = 0; m < c; m++) { var v = p[m]; if (o(s[v][m])) { var b = void 0; for (b = m + 1; b < c; b++) if (!o(s[p[b]][m])) { v = p[b], p[b] = p[m], p[m] = v, d = !d; break; } if (b === c) return s[v][m]; } for (var y = s[v][m], A = m === 0 ? 1 : s[p[m - 1]][m - 1], h = m + 1; h < c; h++) for (var x = p[h], w = m + 1; w < c; w++) s[x][w] = i(n(a(s[x][w], y), a(s[x][m], s[v][w])), A); } var g = s[p[c - 1]][c - 1]; return d ? l(g) : g; } }), vv = "inv", a7 = ["typed", "matrix", "divideScalar", "addScalar", "multiply", "unaryMinus", "det", "identity", "abs"], i7 = /* @__PURE__ */ P(vv, a7, (e) => { var { typed: r, matrix: t, divideScalar: n, addScalar: a, multiply: i, unaryMinus: o, det: l, identity: u, abs: s } = e; return r(vv, { "Array | Matrix": function(d) { var p = ze(d) ? d.size() : ke(d); switch (p.length) { case 1: if (p[0] === 1) return ze(d) ? t([n(1, d.valueOf()[0])]) : [n(1, d[0])]; throw new RangeError("Matrix must be square (size: " + Qe(p) + ")"); case 2: { var m = p[0], v = p[1]; if (m === v) return ze(d) ? t(c(d.valueOf(), m, v), d.storage()) : c(d, m, v); throw new RangeError("Matrix must be square (size: " + Qe(p) + ")"); } default: throw new RangeError("Matrix must be two dimensional (size: " + Qe(p) + ")"); } }, any: function(d) { return n(1, d); } }); function c(f, d, p) { var m, v, b, y, A; if (d === 1) { if (y = f[0][0], y === 0) throw Error("Cannot calculate inverse, determinant is zero"); return [[n(1, y)]]; } else if (d === 2) { var h = l(f); if (h === 0) throw Error("Cannot calculate inverse, determinant is zero"); return [[n(f[1][1], h), n(o(f[0][1]), h)], [n(o(f[1][0]), h), n(f[0][0], h)]]; } else { var x = f.concat(); for (m = 0; m < d; m++) x[m] = x[m].concat(); for (var w = u(d).valueOf(), g = 0; g < p; g++) { var D = s(x[g][g]), E = g; for (m = g + 1; m < d; ) s(x[m][g]) > D && (D = s(x[m][g]), E = m), m++; if (D === 0) throw Error("Cannot calculate inverse, determinant is zero"); m = E, m !== g && (A = x[g], x[g] = x[m], x[m] = A, A = w[g], w[g] = w[m], w[m] = A); var N = x[g], S = w[g]; for (m = 0; m < d; m++) { var M = x[m], F = w[m]; if (m !== g) { if (M[g] !== 0) { for (b = n(o(M[g]), N[g]), v = g; v < p; v++) M[v] = a(M[v], i(b, N[v])); for (v = 0; v < p; v++) F[v] = a(F[v], i(b, S[v])); } } else { for (b = N[g], v = g; v < p; v++) M[v] = n(M[v], b); for (v = 0; v < p; v++) F[v] = n(F[v], b); } } } return w; } } }), hv = "pinv", o7 = ["typed", "matrix", "inv", "deepEqual", "equal", "dotDivide", "dot", "ctranspose", "divideScalar", "multiply", "add", "Complex"], s7 = /* @__PURE__ */ P(hv, o7, (e) => { var { typed: r, matrix: t, inv: n, deepEqual: a, equal: i, dotDivide: o, dot: l, ctranspose: u, divideScalar: s, multiply: c, add: f, Complex: d } = e; return r(hv, { "Array | Matrix": function(h) { var x = ze(h) ? h.size() : ke(h); switch (x.length) { case 1: return y(h) ? u(h) : x[0] === 1 ? n(h) : o(u(h), l(h, h)); case 2: { if (y(h)) return u(h); var w = x[0], g = x[1]; if (w === g) try { return n(h); } catch (D) { if (!(D instanceof Error && D.message.match(/Cannot calculate inverse, determinant is zero/))) throw D; } return ze(h) ? t(p(h.valueOf(), w, g), h.storage()) : p(h, w, g); } default: throw new RangeError("Matrix must be two dimensional (size: " + Qe(x) + ")"); } }, any: function(h) { return i(h, 0) ? qe(h) : s(1, h); } }); function p(A, h, x) { var { C: w, F: g } = v(A, h, x), D = c(n(c(u(w), w)), u(w)), E = c(u(g), n(c(g, u(g)))); return c(E, D); } function m(A, h, x) { for (var w = qe(A), g = 0, D = 0; D < h; D++) { if (x <= g) return w; for (var E = D; b(w[E][g]); ) if (E++, h === E && (E = D, g++, x === g)) return w; [w[E], w[D]] = [w[D], w[E]]; for (var N = w[D][g], S = 0; S < x; S++) w[D][S] = o(w[D][S], N); for (var M = 0; M < h; M++) if (M !== D) { N = w[M][g]; for (var F = 0; F < x; F++) w[M][F] = f(w[M][F], c(-1, c(N, w[D][F]))); } g++; } return w; } function v(A, h, x) { var w = m(A, h, x), g = A.map((E, N) => E.filter((S, M) => M < h && !b(l(w[M], w[M])))), D = w.filter((E, N) => !b(l(w[N], w[N]))); return { C: g, F: D }; } function b(A) { return i(f(A, d(1, 1)), f(0, d(1, 1))); } function y(A) { return a(f(A, d(1, 1)), f(c(A, 0), d(1, 1))); } }); function u7(e) { var { addScalar: r, subtract: t, flatten: n, multiply: a, multiplyScalar: i, divideScalar: o, sqrt: l, abs: u, bignumber: s, diag: c, size: f, reshape: d, inv: p, qr: m, usolve: v, usolveAll: b, equal: y, complex: A, larger: h, smaller: x, matrixFromColumns: w, dot: g } = e; function D(V, R, Q, se) { var re = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, q = E(V, R, Q, se, re); N(V, R, Q, se, re, q); var { values: Z, C: K } = S(V, R, Q, se, re); if (re) { var j = M(V, R, K, q, Z, Q, se); return { values: Z, eigenvectors: j }; } return { values: Z }; } function E(V, R, Q, se, re) { var q = se === "BigNumber", Z = se === "Complex", K = q ? s(0) : 0, j = q ? s(1) : Z ? A(1) : 1, ee = q ? s(1) : 1, te = q ? s(10) : 2, oe = i(te, te), ge; re && (ge = Array(R).fill(j)); for (var L = !1; !L; ) { L = !0; for (var H = 0; H < R; H++) { for (var ne = K, ie = K, me = 0; me < R; me++) H !== me && (ne = r(ne, u(V[me][H])), ie = r(ie, u(V[H][me]))); if (!y(ne, 0) && !y(ie, 0)) { for (var pe = ee, xe = ne, De = o(ie, te), k = i(ie, te); x(xe, De); ) xe = i(xe, oe), pe = i(pe, te); for (; h(xe, k); ) xe = o(xe, oe), pe = o(pe, te); var J = x(o(r(xe, ie), pe), i(r(ne, ie), 0.95)); if (J) { L = !1; for (var G = o(1, pe), ae = 0; ae < R; ae++) H !== ae && (V[H][ae] = i(V[H][ae], G), V[ae][H] = i(V[ae][H], pe)); re && (ge[H] = i(ge[H], G)); } } } } return re ? c(ge) : null; } function N(V, R, Q, se, re, q) { var Z = se === "BigNumber", K = se === "Complex", j = Z ? s(0) : K ? A(0) : 0; Z && (Q = s(Q)); for (var ee = 0; ee < R - 2; ee++) { for (var te = 0, oe = j, ge = ee + 1; ge < R; ge++) { var L = V[ge][ee]; x(u(oe), u(L)) && (oe = L, te = ge); } if (!x(u(oe), Q)) { if (te !== ee + 1) { var H = V[te]; V[te] = V[ee + 1], V[ee + 1] = H; for (var ne = 0; ne < R; ne++) { var ie = V[ne][te]; V[ne][te] = V[ne][ee + 1], V[ne][ee + 1] = ie; } if (re) { var me = q[te]; q[te] = q[ee + 1], q[ee + 1] = me; } } for (var pe = ee + 2; pe < R; pe++) { var xe = o(V[pe][ee], oe); if (xe !== 0) { for (var De = 0; De < R; De++) V[pe][De] = t(V[pe][De], i(xe, V[ee + 1][De])); for (var k = 0; k < R; k++) V[k][ee + 1] = r(V[k][ee + 1], i(xe, V[k][pe])); if (re) for (var J = 0; J < R; J++) q[pe][J] = t(q[pe][J], i(xe, q[ee + 1][J])); } } } } return q; } function S(V, R, Q, se, re) { var q = se === "BigNumber", Z = se === "Complex", K = q ? s(1) : Z ? A(1) : 1; q && (Q = s(Q)); for (var j = qe(V), ee = [], te = R, oe = [], ge = re ? c(Array(R).fill(K)) : void 0, L = re ? c(Array(te).fill(K)) : void 0, H = 0; H <= 100; ) { H += 1; for (var ne = j[te - 1][te - 1], ie = 0; ie < te; ie++) j[ie][ie] = t(j[ie][ie], ne); var { Q: me, R: pe } = m(j); j = a(pe, me); for (var xe = 0; xe < te; xe++) j[xe][xe] = r(j[xe][xe], ne); if (re && (L = a(L, me)), te === 1 || x(u(j[te - 1][te - 2]), Q)) { H = 0, ee.push(j[te - 1][te - 1]), re && (oe.unshift([[1]]), I(L, R), ge = a(ge, L), te > 1 && (L = c(Array(te - 1).fill(K)))), te -= 1, j.pop(); for (var De = 0; De < te; De++) j[De].pop(); } else if (te === 2 || x(u(j[te - 2][te - 3]), Q)) { H = 0; var k = F(j[te - 2][te - 2], j[te - 2][te - 1], j[te - 1][te - 2], j[te - 1][te - 1]); ee.push(...k), re && (oe.unshift($(j[te - 2][te - 2], j[te - 2][te - 1], j[te - 1][te - 2], j[te - 1][te - 1], k[0], k[1], Q, se)), I(L, R), ge = a(ge, L), te > 2 && (L = c(Array(te - 2).fill(K)))), te -= 2, j.pop(), j.pop(); for (var J = 0; J < te; J++) j[J].pop(), j[J].pop(); } if (te === 0) break; } if (ee.sort((fe, de) => +t(u(fe), u(de))), H > 100) { var G = Error("The eigenvalues failed to converge. Only found these eigenvalues: " + ee.join(", ")); throw G.values = ee, G.vectors = [], G; } var ae = re ? a(ge, B(oe, R)) : void 0; return { values: ee, C: ae }; } function M(V, R, Q, se, re, q, Z) { var K = p(Q), j = a(K, V, Q), ee = Z === "BigNumber", te = Z === "Complex", oe = ee ? s(0) : te ? A(0) : 0, ge = ee ? s(1) : te ? A(1) : 1, L = [], H = []; for (var ne of re) { var ie = C(L, ne, y); ie === -1 ? (L.push(ne), H.push(1)) : H[ie] += 1; } for (var me = [], pe = L.length, xe = Array(R).fill(oe), De = c(Array(R).fill(ge)), k = function() { var ae = L[J], fe = t(j, a(ae, De)), de = b(fe, xe); for (de.shift(); de.length < H[J]; ) { var Ne = _(fe, R, de, q, Z); if (Ne === null) break; de.push(Ne); } var we = a(p(se), Q); de = de.map((Ee) => a(we, Ee)), me.push(...de.map((Ee) => ({ value: ae, vector: n(Ee) }))); }, J = 0; J < pe; J++) k(); return me; } function F(V, R, Q, se) { var re = r(V, se), q = t(i(V, se), i(R, Q)), Z = i(re, 0.5), K = i(l(t(i(re, re), i(4, q))), 0.5); return [r(Z, K), t(Z, K)]; } function $(V, R, Q, se, re, q, Z, K) { var j = K === "BigNumber", ee = K === "Complex", te = j ? s(0) : ee ? A(0) : 0, oe = j ? s(1) : ee ? A(1) : 1; if (x(u(Q), Z)) return [[oe, te], [te, oe]]; if (h(u(t(re, q)), Z)) return [[t(re, se), t(q, se)], [Q, Q]]; var ge = t(V, re), L = t(se, re); return x(u(R), Z) && x(u(L), Z) ? [[ge, oe], [Q, te]] : [[R, te], [L, oe]]; } function I(V, R) { for (var Q = 0; Q < V.length; Q++) V[Q].push(...Array(R - V[Q].length).fill(0)); for (var se = V.length; se < R; se++) V.push(Array(R).fill(0)), V[se][se] = 1; return V; } function B(V, R) { for (var Q = [], se = 0; se < R; se++) Q[se] = Array(R).fill(0); var re = 0; for (var q of V) { for (var Z = q.length, K = 0; K < Z; K++) for (var j = 0; j < Z; j++) Q[re + K][re + j] = q[K][j]; re += Z; } return Q; } function C(V, R, Q) { for (var se = 0; se < V.length; se++) if (Q(V[se], R)) return se; return -1; } function _(V, R, Q, se, re) { for (var q = re === "BigNumber" ? s(1e3) : 1e3, Z, K = 0; K < 5; ++K) { Z = z(R, Q, re); try { Z = v(V, Z); } catch { continue; } if (h(W(Z), q)) break; } if (K >= 5) return null; for (K = 0; ; ) { var j = v(V, Z); if (x(W(O(Z, [j])), se)) break; if (++K >= 10) return null; Z = X(j); } return Z; } function z(V, R, Q) { var se = Q === "BigNumber", re = Q === "Complex", q = Array(V).fill(0).map((Z) => 2 * Math.random() - 1); return se && (q = q.map((Z) => s(Z))), re && (q = q.map((Z) => A(Z))), q = O(q, R), X(q, Q); } function O(V, R) { var Q = f(V); for (var se of R) se = d(se, Q), V = t(V, a(o(g(se, V), g(se, se)), se)); return V; } function W(V) { return u(l(g(V, V))); } function X(V, R) { var Q = R === "BigNumber", se = R === "Complex", re = Q ? s(1) : se ? A(1) : 1; return a(o(re, W(V)), V); } return D; } function l7(e) { var { config: r, addScalar: t, subtract: n, abs: a, atan: i, cos: o, sin: l, multiplyScalar: u, inv: s, bignumber: c, multiply: f, add: d } = e; function p(N, S) { var M = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : r.relTol, F = arguments.length > 3 ? arguments[3] : void 0, $ = arguments.length > 4 ? arguments[4] : void 0; if (F === "number") return m(N, M, $); if (F === "BigNumber") return v(N, M, $); throw TypeError("Unsupported data type: " + F); } function m(N, S, M) { var F = N.length, $ = Math.abs(S / F), I, B; if (M) { B = new Array(F); for (var C = 0; C < F; C++) B[C] = Array(F).fill(0), B[C][C] = 1; } for (var _ = g(N); Math.abs(_[1]) >= Math.abs($); ) { var z = _[0][0], O = _[0][1]; I = b(N[z][z], N[O][O], N[z][O]), N = w(N, I, z, O), M && (B = A(B, I, z, O)), _ = g(N); } for (var W = Array(F).fill(0), X = 0; X < F; X++) W[X] = N[X][X]; return E(qe(W), B, M); } function v(N, S, M) { var F = N.length, $ = a(S / F), I, B; if (M) { B = new Array(F); for (var C = 0; C < F; C++) B[C] = Array(F).fill(0), B[C][C] = 1; } for (var _ = D(N); a(_[1]) >= a($); ) { var z = _[0][0], O = _[0][1]; I = y(N[z][z], N[O][O], N[z][O]), N = x(N, I, z, O), M && (B = h(B, I, z, O)), _ = D(N); } for (var W = Array(F).fill(0), X = 0; X < F; X++) W[X] = N[X][X]; return E(qe(W), B, M); } function b(N, S, M) { var F = S - N; return Math.abs(F) <= r.relTol ? Math.PI / 4 : 0.5 * Math.atan(2 * M / (S - N)); } function y(N, S, M) { var F = n(S, N); return a(F) <= r.relTol ? c(-1).acos().div(4) : u(0.5, i(f(2, M, s(F)))); } function A(N, S, M, F) { for (var $ = N.length, I = Math.cos(S), B = Math.sin(S), C = Array($).fill(0), _ = Array($).fill(0), z = 0; z < $; z++) C[z] = I * N[z][M] - B * N[z][F], _[z] = B * N[z][M] + I * N[z][F]; for (var O = 0; O < $; O++) N[O][M] = C[O], N[O][F] = _[O]; return N; } function h(N, S, M, F) { for (var $ = N.length, I = o(S), B = l(S), C = Array($).fill(c(0)), _ = Array($).fill(c(0)), z = 0; z < $; z++) C[z] = n(u(I, N[z][M]), u(B, N[z][F])), _[z] = t(u(B, N[z][M]), u(I, N[z][F])); for (var O = 0; O < $; O++) N[O][M] = C[O], N[O][F] = _[O]; return N; } function x(N, S, M, F) { for (var $ = N.length, I = c(o(S)), B = c(l(S)), C = u(I, I), _ = u(B, B), z = Array($).fill(c(0)), O = Array($).fill(c(0)), W = f(c(2), I, B, N[M][F]), X = t(n(u(C, N[M][M]), W), u(_, N[F][F])), V = d(u(_, N[M][M]), W, u(C, N[F][F])), R = 0; R < $; R++) z[R] = n(u(I, N[M][R]), u(B, N[F][R])), O[R] = t(u(B, N[M][R]), u(I, N[F][R])); N[M][M] = X, N[F][F] = V, N[M][F] = c(0), N[F][M] = c(0); for (var Q = 0; Q < $; Q++) Q !== M && Q !== F && (N[M][Q] = z[Q], N[Q][M] = z[Q], N[F][Q] = O[Q], N[Q][F] = O[Q]); return N; } function w(N, S, M, F) { for (var $ = N.length, I = Math.cos(S), B = Math.sin(S), C = I * I, _ = B * B, z = Array($).fill(0), O = Array($).fill(0), W = C * N[M][M] - 2 * I * B * N[M][F] + _ * N[F][F], X = _ * N[M][M] + 2 * I * B * N[M][F] + C * N[F][F], V = 0; V < $; V++) z[V] = I * N[M][V] - B * N[F][V], O[V] = B * N[M][V] + I * N[F][V]; N[M][M] = W, N[F][F] = X, N[M][F] = 0, N[F][M] = 0; for (var R = 0; R < $; R++) R !== M && R !== F && (N[M][R] = z[R], N[R][M] = z[R], N[F][R] = O[R], N[R][F] = O[R]); return N; } function g(N) { for (var S = N.length, M = 0, F = [0, 1], $ = 0; $ < S; $++) for (var I = $ + 1; I < S; I++) Math.abs(M) < Math.abs(N[$][I]) && (M = Math.abs(N[$][I]), F = [$, I]); return [F, M]; } function D(N) { for (var S = N.length, M = 0, F = [0, 1], $ = 0; $ < S; $++) for (var I = $ + 1; I < S; I++) a(M) < a(N[$][I]) && (M = a(N[$][I]), F = [$, I]); return [F, M]; } function E(N, S, M) { var F = N.length, $ = Array(F), I; if (M) { I = Array(F); for (var B = 0; B < F; B++) I[B] = Array(F); } for (var C = 0; C < F; C++) { for (var _ = 0, z = N[0], O = 0; O < N.length; O++) a(N[O]) < a(z) && (_ = O, z = N[_]); if ($[C] = N.splice(_, 1)[0], M) for (var W = 0; W < F; W++) I[C][W] = S[W][_], S[W].splice(_, 1); } if (!M) return { values: $ }; var X = I.map((V, R) => ({ value: $[R], vector: V })); return { values: $, eigenvectors: X }; } return p; } var c7 = "eigs", f7 = ["config", "typed", "matrix", "addScalar", "equal", "subtract", "abs", "atan", "cos", "sin", "multiplyScalar", "divideScalar", "inv", "bignumber", "multiply", "add", "larger", "column", "flatten", "number", "complex", "sqrt", "diag", "size", "reshape", "qr", "usolve", "usolveAll", "im", "re", "smaller", "matrixFromColumns", "dot"], d7 = /* @__PURE__ */ P(c7, f7, (e) => { var { config: r, typed: t, matrix: n, addScalar: a, subtract: i, equal: o, abs: l, atan: u, cos: s, sin: c, multiplyScalar: f, divideScalar: d, inv: p, bignumber: m, multiply: v, add: b, larger: y, column: A, flatten: h, number: x, complex: w, sqrt: g, diag: D, size: E, reshape: N, qr: S, usolve: M, usolveAll: F, im: $, re: I, smaller: B, matrixFromColumns: C, dot: _ } = e, z = l7({ config: r, addScalar: a, subtract: i, abs: l, atan: u, cos: s, sin: c, multiplyScalar: f, inv: p, bignumber: m, multiply: v, add: b }), O = u7({ addScalar: a, subtract: i, multiply: v, multiplyScalar: f, flatten: h, divideScalar: d, sqrt: g, abs: l, bignumber: m, diag: D, size: E, reshape: N, qr: S, inv: p, usolve: M, usolveAll: F, equal: o, complex: w, larger: y, smaller: B, matrixFromColumns: C, dot: _ }); return t("eigs", { // The conversion to matrix in the first two implementations, // just to convert back to an array right away in // computeValuesAndVectors, is unfortunate, and should perhaps be // streamlined. It is done because the Matrix object carries some // type information about its entries, and so constructing the matrix // is a roundabout way of doing type detection. Array: function(q) { return W(n(q)); }, "Array, number|BigNumber": function(q, Z) { return W(n(q), { precision: Z }); }, "Array, Object"(re, q) { return W(n(re), q); }, Matrix: function(q) { return W(q, { matricize: !0 }); }, "Matrix, number|BigNumber": function(q, Z) { return W(q, { precision: Z, matricize: !0 }); }, "Matrix, Object": function(q, Z) { var K = { matricize: !0 }; return jr(K, Z), W(q, K); } }); function W(re) { var q, Z = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, K = "eigenvectors" in Z ? Z.eigenvectors : !0, j = (q = Z.precision) !== null && q !== void 0 ? q : r.relTol, ee = X(re, j, K); return Z.matricize && (ee.values = n(ee.values), K && (ee.eigenvectors = ee.eigenvectors.map((te) => { var { value: oe, vector: ge } = te; return { value: oe, vector: n(ge) }; }))), K && Object.defineProperty(ee, "vectors", { enumerable: !1, // to make sure that the eigenvectors can still be // converted to string. get: () => { throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors"); } }), ee; } function X(re, q, Z) { var K = re.toArray(), j = re.size(); if (j.length !== 2 || j[0] !== j[1]) throw new RangeError("Matrix must be square (size: ".concat(Qe(j), ")")); var ee = j[0]; if (R(K, ee, q) && (Q(K, ee), V(K, ee, q))) { var te = se(re, K, ee); return z(K, ee, q, te, Z); } var oe = se(re, K, ee); return O(K, ee, q, oe, Z); } function V(re, q, Z) { for (var K = 0; K < q; K++) for (var j = K; j < q; j++) if (y(m(l(i(re[K][j], re[j][K]))), Z)) return !1; return !0; } function R(re, q, Z) { for (var K = 0; K < q; K++) for (var j = 0; j < q; j++) if (y(m(l($(re[K][j]))), Z)) return !1; return !0; } function Q(re, q) { for (var Z = 0; Z < q; Z++) for (var K = 0; K < q; K++) re[Z][K] = I(re[Z][K]); } function se(re, q, Z) { var K = re.datatype(); if (K === "number" || K === "BigNumber" || K === "Complex") return K; for (var j = !1, ee = !1, te = !1, oe = 0; oe < Z; oe++) for (var ge = 0; ge < Z; ge++) { var L = q[oe][ge]; if (We(L) || Aa(L)) j = !0; else if (Ze(L)) ee = !0; else if (Ut(L)) te = !0; else throw TypeError("Unsupported type in Matrix: " + yr(L)); } if (ee && te && console.warn("Complex BigNumbers not supported, this operation will lose precission."), te) { for (var H = 0; H < Z; H++) for (var ne = 0; ne < Z; ne++) q[H][ne] = w(q[H][ne]); return "Complex"; } if (ee) { for (var ie = 0; ie < Z; ie++) for (var me = 0; me < Z; me++) q[ie][me] = m(q[ie][me]); return "BigNumber"; } if (j) { for (var pe = 0; pe < Z; pe++) for (var xe = 0; xe < Z; xe++) q[pe][xe] = x(q[pe][xe]); return "number"; } else throw TypeError("Matrix contains unsupported types only."); } }), gv = "expm", p7 = ["typed", "abs", "add", "identity", "inv", "multiply"], m7 = /* @__PURE__ */ P(gv, p7, (e) => { var { typed: r, abs: t, add: n, identity: a, inv: i, multiply: o } = e; return r(gv, { Matrix: function(f) { var d = f.size(); if (d.length !== 2 || d[0] !== d[1]) throw new RangeError("Matrix must be square (size: " + Qe(d) + ")"); for (var p = d[0], m = 1e-15, v = l(f), b = u(v, m), y = b.q, A = b.j, h = o(f, Math.pow(2, -A)), x = a(p), w = a(p), g = 1, D = h, E = -1, N = 1; N <= y; N++) N > 1 && (D = o(D, h), E = -E), g = g * (y - N + 1) / ((2 * y - N + 1) * N), x = n(x, o(g, D)), w = n(w, o(g * E, D)); for (var S = o(i(w), x), M = 0; M < A; M++) S = o(S, S); return kn(f) ? f.createSparseMatrix(S) : S; } }); function l(c) { for (var f = c.size()[0], d = 0, p = 0; p < f; p++) { for (var m = 0, v = 0; v < f; v++) m += t(c.get([p, v])); d = Math.max(m, d); } return d; } function u(c, f) { for (var d = 30, p = 0; p < d; p++) for (var m = 0; m <= p; m++) { var v = p - m; if (s(c, m, v) < f) return { q: m, j: v }; } throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)"); } function s(c, f, d) { for (var p = 1, m = 2; m <= f; m++) p *= m; for (var v = p, b = f + 1; b <= 2 * f; b++) v *= b; var y = v * (2 * f + 1); return 8 * Math.pow(c / Math.pow(2, d), 2 * f) * p * p / (v * y); } }), yv = "sqrtm", v7 = ["typed", "abs", "add", "multiply", "map", "sqrt", "subtract", "inv", "size", "max", "identity"], h7 = /* @__PURE__ */ P(yv, v7, (e) => { var { typed: r, abs: t, add: n, multiply: a, map: i, sqrt: o, subtract: l, inv: u, size: s, max: c, identity: f } = e, d = 1e3, p = 1e-6; function m(v) { var b, y = 0, A = v, h = f(s(v)); do { var x = A; if (A = a(0.5, n(x, u(h))), h = a(0.5, n(h, u(x))), b = c(t(l(A, x))), b > p && ++y > d) throw new Error("computing square root of matrix: iterative method could not converge"); } while (b > p); return A; } return r(yv, { "Array | Matrix": function(b) { var y = ze(b) ? b.size() : ke(b); switch (y.length) { case 1: if (y[0] === 1) return i(b, o); throw new RangeError("Matrix must be square (size: " + Qe(y) + ")"); case 2: { var A = y[0], h = y[1]; if (A === h) return m(b); throw new RangeError("Matrix must be square (size: " + Qe(y) + ")"); } default: throw new RangeError("Matrix must be at most two dimensional (size: " + Qe(y) + ")"); } } }); }), bv = "sylvester", g7 = ["typed", "schur", "matrixFromColumns", "matrix", "multiply", "range", "concat", "transpose", "index", "subset", "add", "subtract", "identity", "lusolve", "abs"], y7 = /* @__PURE__ */ P(bv, g7, (e) => { var { typed: r, schur: t, matrixFromColumns: n, matrix: a, multiply: i, range: o, concat: l, transpose: u, index: s, subset: c, add: f, subtract: d, identity: p, lusolve: m, abs: v } = e; return r(bv, { "Matrix, Matrix, Matrix": b, "Array, Matrix, Matrix": function(A, h, x) { return b(a(A), h, x); }, "Array, Array, Matrix": function(A, h, x) { return b(a(A), a(h), x); }, "Array, Matrix, Array": function(A, h, x) { return b(a(A), h, a(x)); }, "Matrix, Array, Matrix": function(A, h, x) { return b(A, a(h), x); }, "Matrix, Array, Array": function(A, h, x) { return b(A, a(h), a(x)); }, "Matrix, Matrix, Array": function(A, h, x) { return b(A, h, a(x)); }, "Array, Array, Array": function(A, h, x) { return b(a(A), a(h), a(x)).toArray(); } }); function b(y, A, h) { for (var x = A.size()[0], w = y.size()[0], g = t(y), D = g.T, E = g.U, N = t(i(-1, A)), S = N.T, M = N.U, F = i(i(u(E), h), M), $ = o(0, w), I = [], B = (te, oe) => l(te, oe, 1), C = (te, oe) => l(te, oe, 0), _ = 0; _ < x; _++) if (_ < x - 1 && v(c(S, s(_ + 1, _))) > 1e-5) { for (var z = C(c(F, s($, _)), c(F, s($, _ + 1))), O = 0; O < _; O++) z = f(z, C(i(I[O], c(S, s(O, _))), i(I[O], c(S, s(O, _ + 1))))); var W = i(p(w), i(-1, c(S, s(_, _)))), X = i(p(w), i(-1, c(S, s(_ + 1, _)))), V = i(p(w), i(-1, c(S, s(_, _ + 1)))), R = i(p(w), i(-1, c(S, s(_ + 1, _ + 1)))), Q = C(B(f(D, W), X), B(V, f(D, R))), se = m(Q, z); I[_] = se.subset(s(o(0, w), 0)), I[_ + 1] = se.subset(s(o(w, 2 * w), 0)), _++; } else { for (var re = c(F, s($, _)), q = 0; q < _; q++) re = f(re, i(I[q], c(S, s(q, _)))); var Z = c(S, s(_, _)), K = d(D, i(Z, p(w))); I[_] = m(K, re); } var j = a(n(...I)), ee = i(E, i(j, u(M))); return ee; } }), wv = "schur", b7 = ["typed", "matrix", "identity", "multiply", "qr", "norm", "subtract"], w7 = /* @__PURE__ */ P(wv, b7, (e) => { var { typed: r, matrix: t, identity: n, multiply: a, qr: i, norm: o, subtract: l } = e; return r(wv, { Array: function(c) { var f = u(t(c)); return { U: f.U.valueOf(), T: f.T.valueOf() }; }, Matrix: function(c) { return u(c); } }); function u(s) { var c = s.size()[0], f = s, d = n(c), p = 0, m; do { m = f; var v = i(f), b = v.Q, y = v.R; if (f = a(y, b), d = a(d, b), p++ > 100) break; } while (o(l(f, m)) > 1e-4); return { U: d, T: f }; } }), xv = "lyap", x7 = ["typed", "matrix", "sylvester", "multiply", "transpose"], A7 = /* @__PURE__ */ P(xv, x7, (e) => { var { typed: r, matrix: t, sylvester: n, multiply: a, transpose: i } = e; return r(xv, { "Matrix, Matrix": function(l, u) { return n(l, i(l), a(-1, u)); }, "Array, Matrix": function(l, u) { return n(t(l), i(t(l)), a(-1, u)); }, "Matrix, Array": function(l, u) { return n(l, i(t(l)), t(a(-1, u))); }, "Array, Array": function(l, u) { return n(t(l), i(t(l)), t(a(-1, u))).toArray(); } }); }), N7 = "divide", D7 = ["typed", "matrix", "multiply", "equalScalar", "divideScalar", "inv"], E7 = /* @__PURE__ */ P(N7, D7, (e) => { var { typed: r, matrix: t, multiply: n, equalScalar: a, divideScalar: i, inv: o } = e, l = Kr({ typed: r, equalScalar: a }), u = Wt({ typed: r }); return r("divide", X0({ // we extend the signatures of divideScalar with signatures dealing with matrices "Array | Matrix, Array | Matrix": function(c, f) { return n(c, o(f)); }, "DenseMatrix, any": function(c, f) { return u(c, f, i, !1); }, "SparseMatrix, any": function(c, f) { return l(c, f, i, !1); }, "Array, any": function(c, f) { return u(t(c), f, i, !1).valueOf(); }, "any, Array | Matrix": function(c, f) { return n(c, o(f)); } }, i.signatures)); }), Av = "distance", S7 = ["typed", "addScalar", "subtractScalar", "divideScalar", "multiplyScalar", "deepEqual", "sqrt", "abs"], C7 = /* @__PURE__ */ P(Av, S7, (e) => { var { typed: r, addScalar: t, subtractScalar: n, multiplyScalar: a, divideScalar: i, deepEqual: o, sqrt: l, abs: u } = e; return r(Av, { "Array, Array, Array": function(w, g, D) { if (w.length === 2 && g.length === 2 && D.length === 2) { if (!c(w)) throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument"); if (!c(g)) throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument"); if (!c(D)) throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument"); if (o(g, D)) throw new TypeError("LinePoint1 should not be same with LinePoint2"); var E = n(D[1], g[1]), N = n(g[0], D[0]), S = n(a(D[0], g[1]), a(g[0], D[1])); return b(w[0], w[1], E, N, S); } else throw new TypeError("Invalid Arguments: Try again"); }, "Object, Object, Object": function(w, g, D) { if (Object.keys(w).length === 2 && Object.keys(g).length === 2 && Object.keys(D).length === 2) { if (!c(w)) throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers"); if (!c(g)) throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers"); if (!c(D)) throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers"); if (o(m(g), m(D))) throw new TypeError("LinePoint1 should not be same with LinePoint2"); if ("pointX" in w && "pointY" in w && "lineOnePtX" in g && "lineOnePtY" in g && "lineTwoPtX" in D && "lineTwoPtY" in D) { var E = n(D.lineTwoPtY, g.lineOnePtY), N = n(g.lineOnePtX, D.lineTwoPtX), S = n(a(D.lineTwoPtX, g.lineOnePtY), a(g.lineOnePtX, D.lineTwoPtY)); return b(w.pointX, w.pointY, E, N, S); } else throw new TypeError("Key names do not match"); } else throw new TypeError("Invalid Arguments: Try again"); }, "Array, Array": function(w, g) { if (w.length === 2 && g.length === 3) { if (!c(w)) throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument"); if (!f(g)) throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument"); return b(w[0], w[1], g[0], g[1], g[2]); } else if (w.length === 3 && g.length === 6) { if (!f(w)) throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument"); if (!p(g)) throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument"); return y(w[0], w[1], w[2], g[0], g[1], g[2], g[3], g[4], g[5]); } else if (w.length === g.length && w.length > 0) { if (!d(w)) throw new TypeError("All values of an array should be numbers or BigNumbers"); if (!d(g)) throw new TypeError("All values of an array should be numbers or BigNumbers"); return A(w, g); } else throw new TypeError("Invalid Arguments: Try again"); }, "Object, Object": function(w, g) { if (Object.keys(w).length === 2 && Object.keys(g).length === 3) { if (!c(w)) throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers"); if (!f(g)) throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers"); if ("pointX" in w && "pointY" in w && "xCoeffLine" in g && "yCoeffLine" in g && "constant" in g) return b(w.pointX, w.pointY, g.xCoeffLine, g.yCoeffLine, g.constant); throw new TypeError("Key names do not match"); } else if (Object.keys(w).length === 3 && Object.keys(g).length === 6) { if (!f(w)) throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers"); if (!p(g)) throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers"); if ("pointX" in w && "pointY" in w && "x0" in g && "y0" in g && "z0" in g && "a" in g && "b" in g && "c" in g) return y(w.pointX, w.pointY, w.pointZ, g.x0, g.y0, g.z0, g.a, g.b, g.c); throw new TypeError("Key names do not match"); } else if (Object.keys(w).length === 2 && Object.keys(g).length === 2) { if (!c(w)) throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers"); if (!c(g)) throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers"); if ("pointOneX" in w && "pointOneY" in w && "pointTwoX" in g && "pointTwoY" in g) return A([w.pointOneX, w.pointOneY], [g.pointTwoX, g.pointTwoY]); throw new TypeError("Key names do not match"); } else if (Object.keys(w).length === 3 && Object.keys(g).length === 3) { if (!f(w)) throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers"); if (!f(g)) throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers"); if ("pointOneX" in w && "pointOneY" in w && "pointOneZ" in w && "pointTwoX" in g && "pointTwoY" in g && "pointTwoZ" in g) return A([w.pointOneX, w.pointOneY, w.pointOneZ], [g.pointTwoX, g.pointTwoY, g.pointTwoZ]); throw new TypeError("Key names do not match"); } else throw new TypeError("Invalid Arguments: Try again"); }, Array: function(w) { if (!v(w)) throw new TypeError("Incorrect array format entered for pairwise distance calculation"); return h(w); } }); function s(x) { return typeof x == "number" || Ze(x); } function c(x) { return x.constructor !== Array && (x = m(x)), s(x[0]) && s(x[1]); } function f(x) { return x.constructor !== Array && (x = m(x)), s(x[0]) && s(x[1]) && s(x[2]); } function d(x) { return Array.isArray(x) || (x = m(x)), x.every(s); } function p(x) { return x.constructor !== Array && (x = m(x)), s(x[0]) && s(x[1]) && s(x[2]) && s(x[3]) && s(x[4]) && s(x[5]); } function m(x) { for (var w = Object.keys(x), g = [], D = 0; D < w.length; D++) g.push(x[w[D]]); return g; } function v(x) { if (x[0].length === 2 && s(x[0][0]) && s(x[0][1])) { if (x.some((w) => w.length !== 2 || !s(w[0]) || !s(w[1]))) return !1; } else if (x[0].length === 3 && s(x[0][0]) && s(x[0][1]) && s(x[0][2])) { if (x.some((w) => w.length !== 3 || !s(w[0]) || !s(w[1]) || !s(w[2]))) return !1; } else return !1; return !0; } function b(x, w, g, D, E) { var N = u(t(t(a(g, x), a(D, w)), E)), S = l(t(a(g, g), a(D, D))); return i(N, S); } function y(x, w, g, D, E, N, S, M, F) { var $ = [n(a(n(E, w), F), a(n(N, g), M)), n(a(n(N, g), S), a(n(D, x), F)), n(a(n(D, x), M), a(n(E, w), S))]; $ = l(t(t(a($[0], $[0]), a($[1], $[1])), a($[2], $[2]))); var I = l(t(t(a(S, S), a(M, M)), a(F, F))); return i($, I); } function A(x, w) { for (var g = x.length, D = 0, E = 0, N = 0; N < g; N++) E = n(x[N], w[N]), D = t(a(E, E), D); return l(D); } function h(x) { for (var w = [], g = [], D = [], E = 0; E < x.length - 1; E++) for (var N = E + 1; N < x.length; N++) x[0].length === 2 ? (g = [x[E][0], x[E][1]], D = [x[N][0], x[N][1]]) : x[0].length === 3 && (g = [x[E][0], x[E][1], x[E][2]], D = [x[N][0], x[N][1], x[N][2]]), w.push(A(g, D)); return w; } }), M7 = "intersect", _7 = ["typed", "config", "abs", "add", "addScalar", "matrix", "multiply", "multiplyScalar", "divideScalar", "subtract", "smaller", "equalScalar", "flatten", "isZero", "isNumeric"], F7 = /* @__PURE__ */ P(M7, _7, (e) => { var { typed: r, config: t, abs: n, add: a, addScalar: i, matrix: o, multiply: l, multiplyScalar: u, divideScalar: s, subtract: c, smaller: f, equalScalar: d, flatten: p, isZero: m, isNumeric: v } = e; return r("intersect", { "Array, Array, Array": b, "Array, Array, Array, Array": y, "Matrix, Matrix, Matrix": function(M, F, $) { var I = b(M.valueOf(), F.valueOf(), $.valueOf()); return I === null ? null : o(I); }, "Matrix, Matrix, Matrix, Matrix": function(M, F, $, I) { var B = y(M.valueOf(), F.valueOf(), $.valueOf(), I.valueOf()); return B === null ? null : o(B); } }); function b(S, M, F) { if (S = A(S), M = A(M), F = A(F), !x(S)) throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument"); if (!x(M)) throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument"); if (!w(F)) throw new TypeError("Array with 4 numbers expected as third argument"); return N(S[0], S[1], S[2], M[0], M[1], M[2], F[0], F[1], F[2], F[3]); } function y(S, M, F, $) { if (S = A(S), M = A(M), F = A(F), $ = A($), S.length === 2) { if (!h(S)) throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument"); if (!h(M)) throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument"); if (!h(F)) throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument"); if (!h($)) throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument"); return g(S, M, F, $); } else if (S.length === 3) { if (!x(S)) throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument"); if (!x(M)) throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument"); if (!x(F)) throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument"); if (!x($)) throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument"); return E(S[0], S[1], S[2], M[0], M[1], M[2], F[0], F[1], F[2], $[0], $[1], $[2]); } else throw new TypeError("Arrays with two or thee dimensional points expected"); } function A(S) { return S.length === 1 ? S[0] : S.length > 1 && Array.isArray(S[0]) && S.every((M) => Array.isArray(M) && M.length === 1) ? p(S) : S; } function h(S) { return S.length === 2 && v(S[0]) && v(S[1]); } function x(S) { return S.length === 3 && v(S[0]) && v(S[1]) && v(S[2]); } function w(S) { return S.length === 4 && v(S[0]) && v(S[1]) && v(S[2]) && v(S[3]); } function g(S, M, F, $) { var I = S, B = F, C = c(I, M), _ = c(B, $), z = c(u(C[0], _[1]), u(_[0], C[1])); if (m(z) || f(n(z), t.relTol)) return null; var O = u(_[0], I[1]), W = u(_[1], I[0]), X = u(_[0], B[1]), V = u(_[1], B[0]), R = s(i(c(c(O, W), X), V), z); return a(l(C, R), I); } function D(S, M, F, $, I, B, C, _, z, O, W, X) { var V = u(c(S, M), c(F, $)), R = u(c(I, B), c(C, _)), Q = u(c(z, O), c(W, X)); return i(i(V, R), Q); } function E(S, M, F, $, I, B, C, _, z, O, W, X) { var V = D(S, C, O, C, M, _, W, _, F, z, X, z), R = D(O, C, $, S, W, _, I, M, X, z, B, F), Q = D(S, C, $, S, M, _, I, M, F, z, B, F), se = D(O, C, O, C, W, _, W, _, X, z, X, z), re = D($, S, $, S, I, M, I, M, B, F, B, F), q = c(u(V, R), u(Q, se)), Z = c(u(re, se), u(R, R)); if (m(Z)) return null; var K = s(q, Z), j = s(i(V, u(K, R)), se), ee = i(S, u(K, c($, S))), te = i(M, u(K, c(I, M))), oe = i(F, u(K, c(B, F))), ge = i(C, u(j, c(O, C))), L = i(_, u(j, c(W, _))), H = i(z, u(j, c(X, z))); return d(ee, ge) && d(te, L) && d(oe, H) ? [ee, te, oe] : null; } function N(S, M, F, $, I, B, C, _, z, O) { var W = u(S, C), X = u($, C), V = u(M, _), R = u(I, _), Q = u(F, z), se = u(B, z), re = c(c(c(O, W), V), Q), q = c(c(c(i(i(X, R), se), W), V), Q), Z = s(re, q), K = i(S, u(Z, c($, S))), j = i(M, u(Z, c(I, M))), ee = i(F, u(Z, c(B, F))); return [K, j, ee]; } }), Nv = "sum", T7 = ["typed", "config", "add", "numeric"], Wy = /* @__PURE__ */ P(Nv, T7, (e) => { var { typed: r, config: t, add: n, numeric: a } = e; return r(Nv, { // sum([a, b, c, d, ...]) "Array | Matrix": i, // sum([a, b, c, d, ...], dim) "Array | Matrix, number | BigNumber": o, // sum(a, b, c, d, ...) "...": function(u) { if (ci(u)) throw new TypeError("Scalar values expected in function sum"); return i(u); } }); function i(l) { var u; return Cn(l, function(s) { try { u = u === void 0 ? s : n(u, s); } catch (c) { throw st(c, "sum", s); } }), u === void 0 && (u = a(0, t.number)), typeof u == "string" && (u = a(u, Qn(u, t))), u; } function o(l, u) { try { var s = $s(l, u, n); return s; } catch (c) { throw st(c, "sum"); } } }), Fo = "cumsum", O7 = ["typed", "add", "unaryPlus"], Ky = /* @__PURE__ */ P(Fo, O7, (e) => { var { typed: r, add: t, unaryPlus: n } = e; return r(Fo, { // sum([a, b, c, d, ...]) Array: a, Matrix: function(s) { return s.create(a(s.valueOf(), s.datatype())); }, // sum([a, b, c, d, ...], dim) "Array, number | BigNumber": o, "Matrix, number | BigNumber": function(s, c) { return s.create(o(s.valueOf(), c), s.datatype()); }, // cumsum(a, b, c, d, ...) "...": function(s) { if (ci(s)) throw new TypeError("All values expected to be scalar in function cumsum"); return a(s); } }); function a(u) { try { return i(u); } catch (s) { throw st(s, Fo); } } function i(u) { if (u.length === 0) return []; for (var s = [n(u[0])], c = 1; c < u.length; ++c) s.push(t(s[c - 1], u[c])); return s; } function o(u, s) { var c = ke(u); if (s < 0 || s >= c.length) throw new $t(s, c.length); try { return l(u, s); } catch (f) { throw st(f, Fo); } } function l(u, s) { var c, f, d; if (s <= 0) { var p = u[0][0]; if (Array.isArray(p)) { for (d = Mg(u), f = [], c = 0; c < d.length; c++) f[c] = l(d[c], s - 1); return f; } else return i(u); } else { for (f = [], c = 0; c < u.length; c++) f[c] = l(u[c], s - 1); return f; } } }), Dv = "mean", B7 = ["typed", "add", "divide"], Jy = /* @__PURE__ */ P(Dv, B7, (e) => { var { typed: r, add: t, divide: n } = e; return r(Dv, { // mean([a, b, c, d, ...]) "Array | Matrix": i, // mean([a, b, c, d, ...], dim) "Array | Matrix, number | BigNumber": a, // mean(a, b, c, d, ...) "...": function(l) { if (ci(l)) throw new TypeError("Scalar values expected in function mean"); return i(l); } }); function a(o, l) { try { var u = $s(o, l, t), s = Array.isArray(o) ? ke(o) : o.size(); return n(u, s[l]); } catch (c) { throw st(c, "mean"); } } function i(o) { var l, u = 0; if (Cn(o, function(s) { try { l = l === void 0 ? s : t(l, s), u++; } catch (c) { throw st(c, "mean", s); } }), u === 0) throw new Error("Cannot calculate the mean of an empty array"); return n(l, u); } }), Ev = "median", $7 = ["typed", "add", "divide", "compare", "partitionSelect"], I7 = /* @__PURE__ */ P(Ev, $7, (e) => { var { typed: r, add: t, divide: n, compare: a, partitionSelect: i } = e; function o(s) { try { s = sr(s.valueOf()); var c = s.length; if (c === 0) throw new Error("Cannot calculate median of an empty array"); if (c % 2 === 0) { for (var f = c / 2 - 1, d = i(s, f + 1), p = s[f], m = 0; m < f; ++m) a(s[m], p) > 0 && (p = s[m]); return u(p, d); } else { var v = i(s, (c - 1) / 2); return l(v); } } catch (b) { throw st(b, "median"); } } var l = r({ "number | BigNumber | Complex | Unit": function(c) { return c; } }), u = r({ "number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit": function(c, f) { return n(t(c, f), 2); } }); return r(Ev, { // median([a, b, c, d, ...]) "Array | Matrix": o, // median([a, b, c, d, ...], dim) "Array | Matrix, number | BigNumber": function(c, f) { throw new Error("median(A, dim) is not yet supported"); }, // median(a, b, c, d, ...) "...": function(c) { if (ci(c)) throw new TypeError("Scalar values expected in function median"); return o(c); } }); }), Sv = "mad", R7 = ["typed", "abs", "map", "median", "subtract"], P7 = /* @__PURE__ */ P(Sv, R7, (e) => { var { typed: r, abs: t, map: n, median: a, subtract: i } = e; return r(Sv, { // mad([a, b, c, d, ...]) "Array | Matrix": o, // mad(a, b, c, d, ...) "...": function(u) { return o(u); } }); function o(l) { if (l = sr(l.valueOf()), l.length === 0) throw new Error("Cannot calculate median absolute deviation (mad) of an empty array"); try { var u = a(l); return a(n(l, function(s) { return t(i(s, u)); })); } catch (s) { throw s instanceof TypeError && s.message.includes("median") ? new TypeError(s.message.replace("median", "mad")) : st(s, "mad"); } } }), hu = "unbiased", Cv = "variance", z7 = ["typed", "add", "subtract", "multiply", "divide", "apply", "isNaN"], Yy = /* @__PURE__ */ P(Cv, z7, (e) => { var { typed: r, add: t, subtract: n, multiply: a, divide: i, apply: o, isNaN: l } = e; return r(Cv, { // variance([a, b, c, d, ...]) "Array | Matrix": function(f) { return u(f, hu); }, // variance([a, b, c, d, ...], normalization) "Array | Matrix, string": u, // variance([a, b, c, c, ...], dim) "Array | Matrix, number | BigNumber": function(f, d) { return s(f, d, hu); }, // variance([a, b, c, c, ...], dim, normalization) "Array | Matrix, number | BigNumber, string": s, // variance(a, b, c, d, ...) "...": function(f) { return u(f, hu); } }); function u(c, f) { var d, p = 0; if (c.length === 0) throw new SyntaxError("Function variance requires one or more parameters (0 provided)"); if (Cn(c, function(b) { try { d = d === void 0 ? b : t(d, b), p++; } catch (y) { throw st(y, "variance", b); } }), p === 0) throw new Error("Cannot calculate variance of an empty array"); var m = i(d, p); if (d = void 0, Cn(c, function(b) { var y = n(b, m); d = d === void 0 ? a(y, y) : t(d, a(y, y)); }), l(d)) return d; switch (f) { case "uncorrected": return i(d, p); case "biased": return i(d, p + 1); case "unbiased": { var v = Ze(d) ? d.mul(0) : 0; return p === 1 ? v : i(d, p - 1); } default: throw new Error('Unknown normalization "' + f + '". Choose "unbiased" (default), "uncorrected", or "biased".'); } } function s(c, f, d) { try { if (c.length === 0) throw new SyntaxError("Function variance requires one or more parameters (0 provided)"); return o(c, f, (p) => u(p, d)); } catch (p) { throw st(p, "variance"); } } }), Mv = "quantileSeq", q7 = ["typed", "?bignumber", "add", "subtract", "divide", "multiply", "partitionSelect", "compare", "isInteger", "smaller", "smallerEq", "larger"], jy = /* @__PURE__ */ P(Mv, q7, (e) => { var { typed: r, bignumber: t, add: n, subtract: a, divide: i, multiply: o, partitionSelect: l, compare: u, isInteger: s, smaller: c, smallerEq: f, larger: d } = e, p = Wl({ typed: r, isInteger: s }); return r(Mv, { "Array | Matrix, number | BigNumber": (A, h) => v(A, h, !1), "Array | Matrix, number | BigNumber, number": (A, h, x) => m(A, h, !1, x, v), "Array | Matrix, number | BigNumber, boolean": v, "Array | Matrix, number | BigNumber, boolean, number": (A, h, x, w) => m(A, h, x, w, v), "Array | Matrix, Array | Matrix": (A, h) => b(A, h, !1), "Array | Matrix, Array | Matrix, number": (A, h, x) => m(A, h, !1, x, b), "Array | Matrix, Array | Matrix, boolean": b, "Array | Matrix, Array | Matrix, boolean, number": (A, h, x, w) => m(A, h, x, w, b) }); function m(A, h, x, w, g) { return p(A, w, (D) => g(D, h, x)); } function v(A, h, x) { var w, g = A.valueOf(); if (c(h, 0)) throw new Error("N/prob must be non-negative"); if (f(h, 1)) return We(h) ? y(g, h, x) : t(y(g, h, x)); if (d(h, 1)) { if (!s(h)) throw new Error("N must be a positive integer"); if (d(h, 4294967295)) throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array"); var D = n(h, 1); w = []; for (var E = 0; c(E, h); E++) { var N = i(E + 1, D); w.push(y(g, N, x)); } return We(h) ? w : t(w); } } function b(A, h, x) { for (var w = A.valueOf(), g = h.valueOf(), D = [], E = 0; E < g.length; ++E) D.push(y(w, g[E], x)); return D; } function y(A, h, x) { var w = sr(A), g = w.length; if (g === 0) throw new Error("Cannot calculate quantile of an empty sequence"); var D = We(h) ? h * (g - 1) : h.times(g - 1), E = We(h) ? Math.floor(D) : D.floor().toNumber(), N = We(h) ? D % 1 : D.minus(E); if (s(D)) return x ? w[D] : l(w, We(h) ? D : D.valueOf()); var S, M; if (x) S = w[E], M = w[E + 1]; else { M = l(w, E + 1), S = w[E]; for (var F = 0; F < E; ++F) u(w[F], S) > 0 && (S = w[F]); } return n(o(S, a(1, N)), o(M, N)); } }), _v = "std", L7 = ["typed", "map", "sqrt", "variance"], Xy = /* @__PURE__ */ P(_v, L7, (e) => { var { typed: r, map: t, sqrt: n, variance: a } = e; return r(_v, { // std([a, b, c, d, ...]) "Array | Matrix": i, // std([a, b, c, d, ...], normalization) "Array | Matrix, string": i, // std([a, b, c, c, ...], dim) "Array | Matrix, number | BigNumber": i, // std([a, b, c, c, ...], dim, normalization) "Array | Matrix, number | BigNumber, string": i, // std(a, b, c, d, ...) "...": function(l) { return i(l); } }); function i(o, l) { if (o.length === 0) throw new SyntaxError("Function std requires one or more parameters (0 provided)"); try { var u = a.apply(null, arguments); return At(u) ? t(u, n) : n(u); } catch (s) { throw s instanceof TypeError && s.message.includes(" variance") ? new TypeError(s.message.replace(" variance", " std")) : s; } } }), Fv = "corr", U7 = ["typed", "matrix", "mean", "sqrt", "sum", "add", "subtract", "multiply", "pow", "divide"], k7 = /* @__PURE__ */ P(Fv, U7, (e) => { var { typed: r, matrix: t, sqrt: n, sum: a, add: i, subtract: o, multiply: l, pow: u, divide: s } = e; return r(Fv, { "Array, Array": function(p, m) { return c(p, m); }, "Matrix, Matrix": function(p, m) { var v = c(p.toArray(), m.toArray()); return Array.isArray(v) ? t(v) : v; } }); function c(d, p) { var m = []; if (Array.isArray(d[0]) && Array.isArray(p[0])) { if (d.length !== p.length) throw new SyntaxError("Dimension mismatch. Array A and B must have the same length."); for (var v = 0; v < d.length; v++) { if (d[v].length !== p[v].length) throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements."); m.push(f(d[v], p[v])); } return m; } else { if (d.length !== p.length) throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements."); return f(d, p); } } function f(d, p) { var m = d.length, v = a(d), b = a(p), y = d.reduce((g, D, E) => i(g, l(D, p[E])), 0), A = a(d.map((g) => u(g, 2))), h = a(p.map((g) => u(g, 2))), x = o(l(m, y), l(v, b)), w = n(l(o(l(m, A), u(v, 2)), o(l(m, h), u(b, 2)))); return s(x, w); } }), Tv = "combinations", V7 = ["typed"], H7 = /* @__PURE__ */ P(Tv, V7, (e) => { var { typed: r } = e; return r(Tv, { "number, number": jg, "BigNumber, BigNumber": function(n, a) { var i = n.constructor, o, l, u = n.minus(a), s = new i(1); if (!Ov(n) || !Ov(a)) throw new TypeError("Positive integer value expected in function combinations"); if (a.gt(n)) throw new TypeError("k must be less than n in function combinations"); if (o = s, a.lt(u)) for (l = s; l.lte(u); l = l.plus(s)) o = o.times(a.plus(l)).dividedBy(l); else for (l = s; l.lte(a); l = l.plus(s)) o = o.times(u.plus(l)).dividedBy(l); return o; } // TODO: implement support for collection in combinations }); }); function Ov(e) { return e.isInteger() && e.gte(0); } var Bv = "combinationsWithRep", Z7 = ["typed"], G7 = /* @__PURE__ */ P(Bv, Z7, (e) => { var { typed: r } = e; return r(Bv, { "number, number": function(n, a) { if (!Oe(n) || n < 0) throw new TypeError("Positive integer value expected in function combinationsWithRep"); if (!Oe(a) || a < 0) throw new TypeError("Positive integer value expected in function combinationsWithRep"); if (n < 1) throw new TypeError("k must be less than or equal to n + k - 1"); if (a < n - 1) { var i = wn(n, n + a - 1); return i / wn(1, a); } var o = wn(a + 1, n + a - 1); return o / wn(1, n - 1); }, "BigNumber, BigNumber": function(n, a) { var i = n.constructor, o, l, u = new i(1), s = n.minus(u); if (!$v(n) || !$v(a)) throw new TypeError("Positive integer value expected in function combinationsWithRep"); if (n.lt(u)) throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep"); if (o = u, a.lt(s)) for (l = u; l.lte(s); l = l.plus(u)) o = o.times(a.plus(l)).dividedBy(l); else for (l = u; l.lte(a); l = l.plus(u)) o = o.times(s.plus(l)).dividedBy(l); return o; } }); }); function $v(e) { return e.isInteger() && e.gte(0); } var Iv = "gamma", W7 = ["typed", "config", "multiplyScalar", "pow", "BigNumber", "Complex"], K7 = /* @__PURE__ */ P(Iv, W7, (e) => { var { typed: r, config: t, multiplyScalar: n, pow: a, BigNumber: i, Complex: o } = e; function l(s) { if (s.im === 0) return Qo(s.re); if (s.re < 0.5) { var c = new o(1 - s.re, -s.im), f = new o(Math.PI * s.re, Math.PI * s.im); return new o(Math.PI).div(f.sin()).div(l(c)); } s = new o(s.re - 1, s.im); for (var d = new o(ka[0], 0), p = 1; p < ka.length; ++p) { var m = new o(ka[p], 0); d = d.add(m.div(s.add(p))); } var v = new o(s.re + Qg + 0.5, s.im), b = Math.sqrt(2 * Math.PI), y = v.pow(s.add(0.5)), A = v.neg().exp(); return d.mul(b).mul(y).mul(A); } return r(Iv, { number: Qo, Complex: l, BigNumber: function(c) { if (c.isInteger()) return c.isNegative() || c.isZero() ? new i(1 / 0) : u(c.minus(1)); if (!c.isFinite()) return new i(c.isNegative() ? NaN : 1 / 0); throw new Error("Integer BigNumber expected"); } }); function u(s) { if (s < 8) return new i([1, 1, 2, 6, 24, 120, 720, 5040][s]); var c = t.precision + (Math.log(s.toNumber()) | 0), f = i.clone({ precision: c }); if (s % 2 === 1) return s.times(u(new i(s - 1))); for (var d = s, p = new f(s), m = s.toNumber(); d > 2; ) d -= 2, m += d, p = p.times(m); return new i(p.toPrecision(i.precision)); } }), Rv = "lgamma", J7 = ["Complex", "typed"], Y7 = /* @__PURE__ */ P(Rv, J7, (e) => { var { Complex: r, typed: t } = e, n = 7, a = 7, i = [-0.029550653594771242, 0.00641025641025641, -0.0019175269175269176, 8417508417508417e-19, -5952380952380953e-19, 7936507936507937e-19, -0.002777777777777778, 0.08333333333333333]; return t(Rv, { number: es, Complex: o, BigNumber: function() { throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber"); } }); function o(s) { var c = 6.283185307179586, f = 1.1447298858494002, d = 0.1; if (s.isNaN()) return new r(NaN, NaN); if (s.im === 0) return new r(es(s.re), 0); if (s.re >= n || Math.abs(s.im) >= a) return l(s); if (s.re <= d) { var p = HC(c, s.im) * Math.floor(0.5 * s.re + 0.25), m = s.mul(Math.PI).sin().log(), v = o(new r(1 - s.re, -s.im)); return new r(f, p).sub(m).sub(v); } else return s.im >= 0 ? u(s) : u(s.conjugate()).conjugate(); } function l(s) { for (var c = s.sub(0.5).mul(s.log()).sub(s).add(ey), f = new r(1, 0).div(s), d = f.div(s), p = i[0], m = i[1], v = 2 * d.re, b = d.re * d.re + d.im * d.im, y = 2; y < 8; y++) { var A = m; m = -b * p + i[y], p = v * p + A; } var h = f.mul(d.mul(p).add(m)); return c.add(h); } function u(s) { var c = 0, f = 0, d = s; for (s = s.add(1); s.re <= n; ) { d = d.mul(s); var p = d.im < 0 ? 1 : 0; p !== 0 && f === 0 && c++, f = p, s = s.add(1); } return l(s).sub(d.log()).sub(new r(0, c * 2 * Math.PI * 1)); } }), Pv = "factorial", j7 = ["typed", "gamma"], X7 = /* @__PURE__ */ P(Pv, j7, (e) => { var { typed: r, gamma: t } = e; return r(Pv, { number: function(a) { if (a < 0) throw new Error("Value must be non-negative"); return t(a + 1); }, BigNumber: function(a) { if (a.isNegative()) throw new Error("Value must be non-negative"); return t(a.plus(1)); }, "Array | Matrix": r.referToSelf((n) => (a) => je(a, n)) }); }), zv = "kldivergence", Q7 = ["typed", "matrix", "divide", "sum", "multiply", "map", "dotDivide", "log", "isNumeric"], ez = /* @__PURE__ */ P(zv, Q7, (e) => { var { typed: r, matrix: t, divide: n, sum: a, multiply: i, map: o, dotDivide: l, log: u, isNumeric: s } = e; return r(zv, { "Array, Array": function(d, p) { return c(t(d), t(p)); }, "Matrix, Array": function(d, p) { return c(d, t(p)); }, "Array, Matrix": function(d, p) { return c(t(d), p); }, "Matrix, Matrix": function(d, p) { return c(d, p); } }); function c(f, d) { var p = d.size().length, m = f.size().length; if (p > 1) throw new Error("first object must be one dimensional"); if (m > 1) throw new Error("second object must be one dimensional"); if (p !== m) throw new Error("Length of two vectors must be equal"); var v = a(f); if (v === 0) throw new Error("Sum of elements in first object must be non zero"); var b = a(d); if (b === 0) throw new Error("Sum of elements in second object must be non zero"); var y = n(f, a(f)), A = n(d, a(d)), h = a(i(y, o(l(y, A), (x) => u(x)))); return s(h) ? h : Number.NaN; } }), qv = "multinomial", rz = ["typed", "add", "divide", "multiply", "factorial", "isInteger", "isPositive"], tz = /* @__PURE__ */ P(qv, rz, (e) => { var { typed: r, add: t, divide: n, multiply: a, factorial: i, isInteger: o, isPositive: l } = e; return r(qv, { "Array | Matrix": function(s) { var c = 0, f = 1; return Cn(s, function(d) { if (!o(d) || !l(d)) throw new TypeError("Positive integer value expected in function multinomial"); c = t(c, d), f = a(f, i(d)); }), n(i(c), f); } }); }), Lv = "permutations", nz = ["typed", "factorial"], az = /* @__PURE__ */ P(Lv, nz, (e) => { var { typed: r, factorial: t } = e; return r(Lv, { "number | BigNumber": t, "number, number": function(a, i) { if (!Oe(a) || a < 0) throw new TypeError("Positive integer value expected in function permutations"); if (!Oe(i) || i < 0) throw new TypeError("Positive integer value expected in function permutations"); if (i > a) throw new TypeError("second argument k must be less than or equal to first argument n"); return wn(a - i + 1, a); }, "BigNumber, BigNumber": function(a, i) { var o, l; if (!Uv(a) || !Uv(i)) throw new TypeError("Positive integer value expected in function permutations"); if (i.gt(a)) throw new TypeError("second argument k must be less than or equal to first argument n"); var u = a.mul(0).add(1); for (o = u, l = a.minus(i).plus(1); l.lte(a); l = l.plus(1)) o = o.times(l); return o; } // TODO: implement support for collection in permutations }); }); function Uv(e) { return e.isInteger() && e.gte(0); } var ec = { exports: {} }; ec.exports; (function(e) { (function(r, t, n) { function a(u) { var s = this, c = l(); s.next = function() { var f = 2091639 * s.s0 + s.c * 23283064365386963e-26; return s.s0 = s.s1, s.s1 = s.s2, s.s2 = f - (s.c = f | 0); }, s.c = 1, s.s0 = c(" "), s.s1 = c(" "), s.s2 = c(" "), s.s0 -= c(u), s.s0 < 0 && (s.s0 += 1), s.s1 -= c(u), s.s1 < 0 && (s.s1 += 1), s.s2 -= c(u), s.s2 < 0 && (s.s2 += 1), c = null; } function i(u, s) { return s.c = u.c, s.s0 = u.s0, s.s1 = u.s1, s.s2 = u.s2, s; } function o(u, s) { var c = new a(u), f = s && s.state, d = c.next; return d.int32 = function() { return c.next() * 4294967296 | 0; }, d.double = function() { return d() + (d() * 2097152 | 0) * 11102230246251565e-32; }, d.quick = d, f && (typeof f == "object" && i(f, c), d.state = function() { return i(c, {}); }), d; } function l() { var u = 4022871197, s = function(c) { c = String(c); for (var f = 0; f < c.length; f++) { u += c.charCodeAt(f); var d = 0.02519603282416938 * u; u = d >>> 0, d -= u, d *= u, u = d >>> 0, d -= u, u += d * 4294967296; } return (u >>> 0) * 23283064365386963e-26; }; return s; } t && t.exports ? t.exports = o : this.alea = o; })( xa, e ); })(ec); var iz = ec.exports, rc = { exports: {} }; rc.exports; (function(e) { (function(r, t, n) { function a(l) { var u = this, s = ""; u.x = 0, u.y = 0, u.z = 0, u.w = 0, u.next = function() { var f = u.x ^ u.x << 11; return u.x = u.y, u.y = u.z, u.z = u.w, u.w ^= u.w >>> 19 ^ f ^ f >>> 8; }, l === (l | 0) ? u.x = l : s += l; for (var c = 0; c < s.length + 64; c++) u.x ^= s.charCodeAt(c) | 0, u.next(); } function i(l, u) { return u.x = l.x, u.y = l.y, u.z = l.z, u.w = l.w, u; } function o(l, u) { var s = new a(l), c = u && u.state, f = function() { return (s.next() >>> 0) / 4294967296; }; return f.double = function() { do var d = s.next() >>> 11, p = (s.next() >>> 0) / 4294967296, m = (d + p) / (1 << 21); while (m === 0); return m; }, f.int32 = s.next, f.quick = f, c && (typeof c == "object" && i(c, s), f.state = function() { return i(s, {}); }), f; } t && t.exports ? t.exports = o : this.xor128 = o; })( xa, e ); })(rc); var oz = rc.exports, tc = { exports: {} }; tc.exports; (function(e) { (function(r, t, n) { function a(l) { var u = this, s = ""; u.next = function() { var f = u.x ^ u.x >>> 2; return u.x = u.y, u.y = u.z, u.z = u.w, u.w = u.v, (u.d = u.d + 362437 | 0) + (u.v = u.v ^ u.v << 4 ^ (f ^ f << 1)) | 0; }, u.x = 0, u.y = 0, u.z = 0, u.w = 0, u.v = 0, l === (l | 0) ? u.x = l : s += l; for (var c = 0; c < s.length + 64; c++) u.x ^= s.charCodeAt(c) | 0, c == s.length && (u.d = u.x << 10 ^ u.x >>> 4), u.next(); } function i(l, u) { return u.x = l.x, u.y = l.y, u.z = l.z, u.w = l.w, u.v = l.v, u.d = l.d, u; } function o(l, u) { var s = new a(l), c = u && u.state, f = function() { return (s.next() >>> 0) / 4294967296; }; return f.double = function() { do var d = s.next() >>> 11, p = (s.next() >>> 0) / 4294967296, m = (d + p) / (1 << 21); while (m === 0); return m; }, f.int32 = s.next, f.quick = f, c && (typeof c == "object" && i(c, s), f.state = function() { return i(s, {}); }), f; } t && t.exports ? t.exports = o : this.xorwow = o; })( xa, e ); })(tc); var sz = tc.exports, nc = { exports: {} }; nc.exports; (function(e) { (function(r, t, n) { function a(l) { var u = this; u.next = function() { var c = u.x, f = u.i, d, p; return d = c[f], d ^= d >>> 7, p = d ^ d << 24, d = c[f + 1 & 7], p ^= d ^ d >>> 10, d = c[f + 3 & 7], p ^= d ^ d >>> 3, d = c[f + 4 & 7], p ^= d ^ d << 7, d = c[f + 7 & 7], d = d ^ d << 13, p ^= d ^ d << 9, c[f] = p, u.i = f + 1 & 7, p; }; function s(c, f) { var d, p = []; if (f === (f | 0)) p[0] = f; else for (f = "" + f, d = 0; d < f.length; ++d) p[d & 7] = p[d & 7] << 15 ^ f.charCodeAt(d) + p[d + 1 & 7] << 13; for (; p.length < 8; ) p.push(0); for (d = 0; d < 8 && p[d] === 0; ++d) ; for (d == 8 ? p[7] = -1 : p[d], c.x = p, c.i = 0, d = 256; d > 0; --d) c.next(); } s(u, l); } function i(l, u) { return u.x = l.x.slice(), u.i = l.i, u; } function o(l, u) { l == null && (l = +/* @__PURE__ */ new Date()); var s = new a(l), c = u && u.state, f = function() { return (s.next() >>> 0) / 4294967296; }; return f.double = function() { do var d = s.next() >>> 11, p = (s.next() >>> 0) / 4294967296, m = (d + p) / (1 << 21); while (m === 0); return m; }, f.int32 = s.next, f.quick = f, c && (c.x && i(c, s), f.state = function() { return i(s, {}); }), f; } t && t.exports ? t.exports = o : this.xorshift7 = o; })( xa, e ); })(nc); var uz = nc.exports, ac = { exports: {} }; ac.exports; (function(e) { (function(r, t, n) { function a(l) { var u = this; u.next = function() { var c = u.w, f = u.X, d = u.i, p, m; return u.w = c = c + 1640531527 | 0, m = f[d + 34 & 127], p = f[d = d + 1 & 127], m ^= m << 13, p ^= p << 17, m ^= m >>> 15, p ^= p >>> 12, m = f[d] = m ^ p, u.i = d, m + (c ^ c >>> 16) | 0; }; function s(c, f) { var d, p, m, v, b, y = [], A = 128; for (f === (f | 0) ? (p = f, f = null) : (f = f + "\0", p = 0, A = Math.max(A, f.length)), m = 0, v = -32; v < A; ++v) f && (p ^= f.charCodeAt((v + 32) % f.length)), v === 0 && (b = p), p ^= p << 10, p ^= p >>> 15, p ^= p << 4, p ^= p >>> 13, v >= 0 && (b = b + 1640531527 | 0, d = y[v & 127] ^= p + b, m = d == 0 ? m + 1 : 0); for (m >= 128 && (y[(f && f.length || 0) & 127] = -1), m = 127, v = 4 * 128; v > 0; --v) p = y[m + 34 & 127], d = y[m = m + 1 & 127], p ^= p << 13, d ^= d << 17, p ^= p >>> 15, d ^= d >>> 12, y[m] = p ^ d; c.w = b, c.X = y, c.i = m; } s(u, l); } function i(l, u) { return u.i = l.i, u.w = l.w, u.X = l.X.slice(), u; } function o(l, u) { l == null && (l = +/* @__PURE__ */ new Date()); var s = new a(l), c = u && u.state, f = function() { return (s.next() >>> 0) / 4294967296; }; return f.double = function() { do var d = s.next() >>> 11, p = (s.next() >>> 0) / 4294967296, m = (d + p) / (1 << 21); while (m === 0); return m; }, f.int32 = s.next, f.quick = f, c && (c.X && i(c, s), f.state = function() { return i(s, {}); }), f; } t && t.exports ? t.exports = o : this.xor4096 = o; })( xa, // window object or global e ); })(ac); var lz = ac.exports, ic = { exports: {} }; ic.exports; (function(e) { (function(r, t, n) { function a(l) { var u = this, s = ""; u.next = function() { var f = u.b, d = u.c, p = u.d, m = u.a; return f = f << 25 ^ f >>> 7 ^ d, d = d - p | 0, p = p << 24 ^ p >>> 8 ^ m, m = m - f | 0, u.b = f = f << 20 ^ f >>> 12 ^ d, u.c = d = d - p | 0, u.d = p << 16 ^ d >>> 16 ^ m, u.a = m - f | 0; }, u.a = 0, u.b = 0, u.c = -1640531527, u.d = 1367130551, l === Math.floor(l) ? (u.a = l / 4294967296 | 0, u.b = l | 0) : s += l; for (var c = 0; c < s.length + 20; c++) u.b ^= s.charCodeAt(c) | 0, u.next(); } function i(l, u) { return u.a = l.a, u.b = l.b, u.c = l.c, u.d = l.d, u; } function o(l, u) { var s = new a(l), c = u && u.state, f = function() { return (s.next() >>> 0) / 4294967296; }; return f.double = function() { do var d = s.next() >>> 11, p = (s.next() >>> 0) / 4294967296, m = (d + p) / (1 << 21); while (m === 0); return m; }, f.int32 = s.next, f.quick = f, c && (typeof c == "object" && i(c, s), f.state = function() { return i(s, {}); }), f; } t && t.exports ? t.exports = o : this.tychei = o; })( xa, e ); })(ic); var cz = ic.exports, Qy = { exports: {} }; const fz = {}, dz = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, default: fz }, Symbol.toStringTag, { value: "Module" })), pz = /* @__PURE__ */ iS(dz); (function(e) { (function(r, t, n) { var a = 256, i = 6, o = 52, l = "random", u = n.pow(a, i), s = n.pow(2, o), c = s * 2, f = a - 1, d; function p(x, w, g) { var D = []; w = w == !0 ? { entropy: !0 } : w || {}; var E = y(b( w.entropy ? [x, h(t)] : x ?? A(), 3 ), D), N = new m(D), S = function() { for (var M = N.g(i), F = u, $ = 0; M < s; ) M = (M + $) * a, F *= a, $ = N.g(1); for (; M >= c; ) M /= 2, F /= 2, $ >>>= 1; return (M + $) / F; }; return S.int32 = function() { return N.g(4) | 0; }, S.quick = function() { return N.g(4) / 4294967296; }, S.double = S, y(h(N.S), t), (w.pass || g || function(M, F, $, I) { return I && (I.S && v(I, N), M.state = function() { return v(N, {}); }), $ ? (n[l] = M, F) : M; })( S, E, "global" in w ? w.global : this == n, w.state ); } function m(x) { var w, g = x.length, D = this, E = 0, N = D.i = D.j = 0, S = D.S = []; for (g || (x = [g++]); E < a; ) S[E] = E++; for (E = 0; E < a; E++) S[E] = S[N = f & N + x[E % g] + (w = S[E])], S[N] = w; (D.g = function(M) { for (var F, $ = 0, I = D.i, B = D.j, C = D.S; M--; ) F = C[I = f & I + 1], $ = $ * a + C[f & (C[I] = C[B = f & B + F]) + (C[B] = F)]; return D.i = I, D.j = B, $; })(a); } function v(x, w) { return w.i = x.i, w.j = x.j, w.S = x.S.slice(), w; } function b(x, w) { var g = [], D = typeof x, E; if (w && D == "object") for (E in x) try { g.push(b(x[E], w - 1)); } catch { } return g.length ? g : D == "string" ? x : x + "\0"; } function y(x, w) { for (var g = x + "", D, E = 0; E < g.length; ) w[f & E] = f & (D ^= w[f & E] * 19) + g.charCodeAt(E++); return h(w); } function A() { try { var x; return d && (x = d.randomBytes) ? x = x(a) : (x = new Uint8Array(a), (r.crypto || r.msCrypto).getRandomValues(x)), h(x); } catch { var w = r.navigator, g = w && w.plugins; return [+/* @__PURE__ */ new Date(), r, g, r.screen, h(t)]; } } function h(x) { return String.fromCharCode.apply(0, x); } if (y(n.random(), t), e.exports) { e.exports = p; try { d = pz; } catch { } } else n["seed" + l] = p; })( // global: `self` in browsers (including strict mode and web workers), // otherwise `this` in Node and other environments typeof self < "u" ? self : xa, [], // pool: entropy pool starts empty Math // math: package containing random, pow, and seedrandom ); })(Qy); var mz = Qy.exports, vz = iz, hz = oz, gz = sz, yz = uz, bz = lz, wz = cz, Ea = mz; Ea.alea = vz; Ea.xor128 = hz; Ea.xorwow = gz; Ea.xorshift7 = yz; Ea.xor4096 = bz; Ea.tychei = wz; var xz = Ea; const e1 = /* @__PURE__ */ Es(xz); var Az = /* @__PURE__ */ e1(Date.now()); function ni(e) { var r; function t(a) { r = a === null ? Az : e1(String(a)); } t(e); function n() { return r(); } return n; } var kv = "pickRandom", Nz = ["typed", "config", "?on"], Dz = /* @__PURE__ */ P(kv, Nz, (e) => { var { typed: r, config: t, on: n } = e, a = ni(t.randomSeed); return n && n("config", function(o, l) { o.randomSeed !== l.randomSeed && (a = ni(o.randomSeed)); }), r(kv, { "Array | Matrix": function(l) { return i(l, {}); }, "Array | Matrix, Object": function(l, u) { return i(l, u); }, "Array | Matrix, number": function(l, u) { return i(l, { number: u }); }, "Array | Matrix, Array | Matrix": function(l, u) { return i(l, { weights: u }); }, "Array | Matrix, Array | Matrix, number": function(l, u, s) { return i(l, { number: s, weights: u }); }, "Array | Matrix, number, Array | Matrix": function(l, u, s) { return i(l, { number: u, weights: s }); } }); function i(o, l) { var { number: u, weights: s, elementWise: c = !0 } = l, f = typeof u > "u"; f && (u = 1); var d = ze(o) ? o.create : ze(s) ? s.create : null; o = o.valueOf(), s && (s = s.valueOf()), c === !0 && (o = sr(o), s = sr(s)); var p = 0; if (typeof s < "u") { if (s.length !== o.length) throw new Error("Weights must have the same length as possibles"); for (var m = 0, v = s.length; m < v; m++) { if (!We(s[m]) || s[m] < 0) throw new Error("Weights must be an array of positive numbers"); p += s[m]; } } for (var b = o.length, y = [], A; y.length < u; ) { if (typeof s > "u") A = o[Math.floor(a() * b)]; else for (var h = a() * p, x = 0, w = o.length; x < w; x++) if (h -= s[x], h < 0) { A = o[x]; break; } y.push(A); } return f ? y[0] : d ? d(y) : y; } }); function oc(e, r) { var t = []; if (e = e.slice(0), e.length > 1) for (var n = 0, a = e.shift(); n < a; n++) t.push(oc(e, r)); else for (var i = 0, o = e.shift(); i < o; i++) t.push(r()); return t; } var Vv = "random", Ez = ["typed", "config", "?on"], Sz = /* @__PURE__ */ P(Vv, Ez, (e) => { var { typed: r, config: t, on: n } = e, a = ni(t.randomSeed); return n && n("config", function(l, u) { l.randomSeed !== u.randomSeed && (a = ni(l.randomSeed)); }), r(Vv, { "": () => o(0, 1), number: (l) => o(0, l), "number, number": (l, u) => o(l, u), "Array | Matrix": (l) => i(l, 0, 1), "Array | Matrix, number": (l, u) => i(l, 0, u), "Array | Matrix, number, number": (l, u, s) => i(l, u, s) }); function i(l, u, s) { var c = oc(l.valueOf(), () => o(u, s)); return ze(l) ? l.create(c, "number") : c; } function o(l, u) { return l + a() * (u - l); } }), Hv = "randomInt", Cz = ["typed", "config", "?on"], Mz = /* @__PURE__ */ P(Hv, Cz, (e) => { var { typed: r, config: t, on: n } = e, a = ni(t.randomSeed); return n && n("config", function(l, u) { l.randomSeed !== u.randomSeed && (a = ni(l.randomSeed)); }), r(Hv, { "": () => o(0, 1), number: (l) => o(0, l), "number, number": (l, u) => o(l, u), "Array | Matrix": (l) => i(l, 0, 1), "Array | Matrix, number": (l, u) => i(l, 0, u), "Array | Matrix, number, number": (l, u, s) => i(l, u, s) }); function i(l, u, s) { var c = oc(l.valueOf(), () => o(u, s)); return ze(l) ? l.create(c, "number") : c; } function o(l, u) { return Math.floor(l + a() * (u - l)); } }), Zv = "stirlingS2", _z = ["typed", "addScalar", "subtractScalar", "multiplyScalar", "divideScalar", "pow", "factorial", "combinations", "isNegative", "isInteger", "number", "?bignumber", "larger"], Fz = /* @__PURE__ */ P(Zv, _z, (e) => { var { typed: r, addScalar: t, subtractScalar: n, multiplyScalar: a, divideScalar: i, pow: o, factorial: l, combinations: u, isNegative: s, isInteger: c, number: f, bignumber: d, larger: p } = e, m = [], v = []; return r(Zv, { "number | BigNumber, number | BigNumber": function(y, A) { if (!c(y) || s(y) || !c(A) || s(A)) throw new TypeError("Non-negative integer value expected in function stirlingS2"); if (p(A, y)) throw new TypeError("k must be less than or equal to n in function stirlingS2"); var h = !(We(y) && We(A)), x = h ? v : m, w = h ? d : f, g = f(y), D = f(A); if (x[g] && x[g].length > D) return x[g][D]; for (var E = 0; E <= g; ++E) if (x[E] || (x[E] = [w(E === 0 ? 1 : 0)]), E !== 0) for (var N = x[E], S = x[E - 1], M = N.length; M <= E && M <= D; ++M) M === E ? N[M] = 1 : N[M] = t(a(w(M), S[M]), S[M - 1]); return x[g][D]; } }); }), Gv = "bellNumbers", Tz = ["typed", "addScalar", "isNegative", "isInteger", "stirlingS2"], Oz = /* @__PURE__ */ P(Gv, Tz, (e) => { var { typed: r, addScalar: t, isNegative: n, isInteger: a, stirlingS2: i } = e; return r(Gv, { "number | BigNumber": function(l) { if (!a(l) || n(l)) throw new TypeError("Non-negative integer value expected in function bellNumbers"); for (var u = 0, s = 0; s <= l; s++) u = t(u, i(l, s)); return u; } }); }), Wv = "catalan", Bz = ["typed", "addScalar", "divideScalar", "multiplyScalar", "combinations", "isNegative", "isInteger"], $z = /* @__PURE__ */ P(Wv, Bz, (e) => { var { typed: r, addScalar: t, divideScalar: n, multiplyScalar: a, combinations: i, isNegative: o, isInteger: l } = e; return r(Wv, { "number | BigNumber": function(s) { if (!l(s) || o(s)) throw new TypeError("Non-negative integer value expected in function catalan"); return n(i(a(s, 2), s), t(s, 1)); } }); }), Kv = "composition", Iz = ["typed", "addScalar", "combinations", "isNegative", "isPositive", "isInteger", "larger"], Rz = /* @__PURE__ */ P(Kv, Iz, (e) => { var { typed: r, addScalar: t, combinations: n, isPositive: a, isNegative: i, isInteger: o, larger: l } = e; return r(Kv, { "number | BigNumber, number | BigNumber": function(s, c) { if (!o(s) || !a(s) || !o(c) || !a(c)) throw new TypeError("Positive integer value expected in function composition"); if (l(c, s)) throw new TypeError("k must be less than or equal to n in function composition"); return n(t(s, -1), t(c, -1)); } }); }), Jv = "leafCount", Pz = ["parse", "typed"], zz = /* @__PURE__ */ P(Jv, Pz, (e) => { var { parse: r, typed: t } = e; function n(a) { var i = 0; return a.forEach((o) => { i += n(o); }), i || 1; } return t(Jv, { Node: function(i) { return n(i); } }); }); function Yv(e) { return nr(e) || _r(e) && e.isUnary() && nr(e.args[0]); } function cs(e) { return !!(nr(e) || (En(e) || _r(e)) && e.args.every(cs) || rn(e) && cs(e.content)); } function jv(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); r && (n = n.filter(function(a) { return Object.getOwnPropertyDescriptor(e, a).enumerable; })), t.push.apply(t, n); } return t; } function gu(e) { for (var r = 1; r < arguments.length; r++) { var t = arguments[r] != null ? arguments[r] : {}; r % 2 ? jv(Object(t), !0).forEach(function(n) { Rr(e, n, t[n]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : jv(Object(t)).forEach(function(n) { Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n)); }); } return e; } var qz = "simplifyUtil", Lz = ["FunctionNode", "OperatorNode", "SymbolNode"], sc = /* @__PURE__ */ P(qz, Lz, (e) => { var { FunctionNode: r, OperatorNode: t, SymbolNode: n } = e, a = !0, i = !1, o = "defaultF", l = { /* */ add: { trivial: a, total: a, commutative: a, associative: a }, /**/ unaryPlus: { trivial: a, total: a, commutative: a, associative: a }, /* */ subtract: { trivial: i, total: a, commutative: i, associative: i }, /* */ multiply: { trivial: a, total: a, commutative: a, associative: a }, /* */ divide: { trivial: i, total: a, commutative: i, associative: i }, /* */ paren: { trivial: a, total: a, commutative: a, associative: i }, /* */ defaultF: { trivial: i, total: a, commutative: i, associative: i } }, u = { divide: { total: i }, log: { total: i } }, s = { subtract: { total: i }, abs: { trivial: a }, log: { total: a } }; function c(h, x) { var w = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : l, g = o; if (typeof h == "string" ? g = h : _r(h) ? g = h.fn.toString() : En(h) ? g = h.name : rn(h) && (g = "paren"), Fe(w, g)) { var D = w[g]; if (Fe(D, x)) return D[x]; if (Fe(l, g)) return l[g][x]; } if (Fe(w, o)) { var E = w[o]; return Fe(E, x) ? E[x] : l[o][x]; } if (Fe(l, g)) { var N = l[g]; if (Fe(N, x)) return N[x]; } return l[o][x]; } function f(h) { var x = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : l; return c(h, "commutative", x); } function d(h) { var x = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : l; return c(h, "associative", x); } function p(h, x) { var w = gu({}, h); for (var g in x) Fe(h, g) ? w[g] = gu(gu({}, x[g]), h[g]) : w[g] = x[g]; return w; } function m(h, x) { if (!h.args || h.args.length === 0) return h; h.args = v(h, x); for (var w = 0; w < h.args.length; w++) m(h.args[w], x); } function v(h, x) { var w, g = [], D = function(N) { for (var S = 0; S < N.args.length; S++) { var M = N.args[S]; _r(M) && w === M.op ? D(M) : g.push(M); } }; return d(h, x) ? (w = h.op, D(h), g) : h.args; } function b(h, x) { if (!(!h.args || h.args.length === 0)) { for (var w = A(h), g = h.args.length, D = 0; D < g; D++) b(h.args[D], x); if (g > 2 && d(h, x)) { for (var E = h.args.pop(); h.args.length > 0; ) E = w([h.args.pop(), E]); h.args = E.args; } } } function y(h, x) { if (!(!h.args || h.args.length === 0)) { for (var w = A(h), g = h.args.length, D = 0; D < g; D++) y(h.args[D], x); if (g > 2 && d(h, x)) { for (var E = h.args.shift(); h.args.length > 0; ) E = w([E, h.args.shift()]); h.args = E.args; } } } function A(h) { return _r(h) ? function(x) { try { return new t(h.op, h.fn, x, h.implicit); } catch (w) { return console.error(w), []; } } : function(x) { return new r(new n(h.name), x); }; } return { createMakeNodeFunction: A, hasProperty: c, isCommutative: f, isAssociative: d, mergeContext: p, flatten: m, allChildren: v, unflattenr: b, unflattenl: y, defaultContext: l, realContext: u, positiveContext: s }; }), Uz = "simplify", kz = ["typed", "parse", "equal", "resolve", "simplifyConstant", "simplifyCore", "AccessorNode", "ArrayNode", "ConstantNode", "FunctionNode", "IndexNode", "ObjectNode", "OperatorNode", "ParenthesisNode", "SymbolNode"], Vz = /* @__PURE__ */ P(Uz, kz, (e) => { var { typed: r, parse: t, equal: n, resolve: a, simplifyConstant: i, simplifyCore: o, AccessorNode: l, ArrayNode: u, ConstantNode: s, FunctionNode: c, IndexNode: f, ObjectNode: d, OperatorNode: p, ParenthesisNode: m, SymbolNode: v } = e, { hasProperty: b, isCommutative: y, isAssociative: A, mergeContext: h, flatten: x, unflattenr: w, unflattenl: g, createMakeNodeFunction: D, defaultContext: E, realContext: N, positiveContext: S } = sc({ FunctionNode: c, OperatorNode: p, SymbolNode: v }); r.addConversion({ from: "Object", to: "Map", convert: La }); var M = r("simplify", { Node: z, "Node, Map": (q, Z) => z(q, !1, Z), "Node, Map, Object": (q, Z, K) => z(q, !1, Z, K), "Node, Array": z, "Node, Array, Map": z, "Node, Array, Map, Object": z }); r.removeConversion({ from: "Object", to: "Map", convert: La }), M.defaultContext = E, M.realContext = N, M.positiveContext = S; function F(q) { return q.transform(function(Z) { return rn(Z) ? F(Z.content) : Z; }); } var $ = { true: !0, false: !0, e: !0, i: !0, Infinity: !0, LN2: !0, LN10: !0, LOG2E: !0, LOG10E: !0, NaN: !0, phi: !0, pi: !0, SQRT1_2: !0, SQRT2: !0, tau: !0 // null: false, // undefined: false, // version: false, }; M.rules = [ o, // { l: 'n+0', r: 'n' }, // simplifyCore // { l: 'n^0', r: '1' }, // simplifyCore // { l: '0*n', r: '0' }, // simplifyCore // { l: 'n/n', r: '1'}, // simplifyCore // { l: 'n^1', r: 'n' }, // simplifyCore // { l: '+n1', r:'n1' }, // simplifyCore // { l: 'n--n1', r:'n+n1' }, // simplifyCore { l: "log(e)", r: "1" }, // temporary rules // Note initially we tend constants to the right because like-term // collection prefers the left, and we would rather collect nonconstants { s: "n-n1 -> n+-n1", // temporarily replace 'subtract' so we can further flatten the 'add' operator assuming: { subtract: { total: !0 } } }, { s: "n-n -> 0", // partial alternative when we can't always subtract assuming: { subtract: { total: !1 } } }, { s: "-(cl*v) -> v * (-cl)", // make non-constant terms positive assuming: { multiply: { commutative: !0 }, subtract: { total: !0 } } }, { s: "-(cl*v) -> (-cl) * v", // non-commutative version, part 1 assuming: { multiply: { commutative: !1 }, subtract: { total: !0 } } }, { s: "-(v*cl) -> v * (-cl)", // non-commutative version, part 2 assuming: { multiply: { commutative: !1 }, subtract: { total: !0 } } }, { l: "-(n1/n2)", r: "-n1/n2" }, { l: "-v", r: "v * (-1)" }, // finish making non-constant terms positive { l: "(n1 + n2)*(-1)", r: "n1*(-1) + n2*(-1)", repeat: !0 }, // expand negations to achieve as much sign cancellation as possible { l: "n/n1^n2", r: "n*n1^-n2" }, // temporarily replace 'divide' so we can further flatten the 'multiply' operator { l: "n/n1", r: "n*n1^-1" }, { s: "(n1*n2)^n3 -> n1^n3 * n2^n3", assuming: { multiply: { commutative: !0 } } }, { s: "(n1*n2)^(-1) -> n2^(-1) * n1^(-1)", assuming: { multiply: { commutative: !1 } } }, // expand nested exponentiation { s: "(n ^ n1) ^ n2 -> n ^ (n1 * n2)", assuming: { divide: { total: !0 } } // 1/(1/n) = n needs 1/n to exist }, // collect like factors; into a sum, only do this for nonconstants { l: " vd * ( vd * n1 + n2)", r: "vd^2 * n1 + vd * n2" }, { s: " vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2", assuming: { divide: { total: !0 } } // v*1/v = v^(1+-1) needs 1/v }, { s: "vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2", assuming: { divide: { total: !0 } } }, { s: "vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2", assuming: { divide: { total: !0 } } }, { l: "n*n", r: "n^2" }, { s: "n * n^n1 -> n^(n1+1)", assuming: { divide: { total: !0 } } // n*1/n = n^(-1+1) needs 1/n }, { s: "n^n1 * n^n2 -> n^(n1+n2)", assuming: { divide: { total: !0 } } // ditto for n^2*1/n^2 }, // Unfortunately, to deal with more complicated cancellations, it // becomes necessary to simplify constants twice per pass. It's not // terribly expensive compared to matching rules, so this should not // pose a performance problem. i, // First: before collecting like terms // collect like terms { s: "n+n -> 2*n", assuming: { add: { total: !0 } } // 2 = 1 + 1 needs to exist }, { l: "n+-n", r: "0" }, { l: "vd*n + vd", r: "vd*(n+1)" }, // NOTE: leftmost position is special: { l: "n3*n1 + n3*n2", r: "n3*(n1+n2)" }, // All sub-monomials tried there. { l: "n3^(-n4)*n1 + n3 * n2", r: "n3^(-n4)*(n1 + n3^(n4+1) *n2)" }, { l: "n3^(-n4)*n1 + n3^n5 * n2", r: "n3^(-n4)*(n1 + n3^(n4+n5)*n2)" }, // noncommutative additional cases (term collection & factoring) { s: "n*vd + vd -> (n+1)*vd", assuming: { multiply: { commutative: !1 } } }, { s: "vd + n*vd -> (1+n)*vd", assuming: { multiply: { commutative: !1 } } }, { s: "n1*n3 + n2*n3 -> (n1+n2)*n3", assuming: { multiply: { commutative: !1 } } }, { s: "n^n1 * n -> n^(n1+1)", assuming: { divide: { total: !0 }, multiply: { commutative: !1 } } }, { s: "n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)", assuming: { multiply: { commutative: !1 } } }, { s: "n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)", assuming: { multiply: { commutative: !1 } } }, { l: "n*cd + cd", r: "(n+1)*cd" }, { s: "cd*n + cd -> cd*(n+1)", assuming: { multiply: { commutative: !1 } } }, { s: "cd + cd*n -> cd*(1+n)", assuming: { multiply: { commutative: !1 } } }, i, // Second: before returning expressions to "standard form" // make factors positive (and undo 'make non-constant terms positive') { s: "(-n)*n1 -> -(n*n1)", assuming: { subtract: { total: !0 } } }, { s: "n1*(-n) -> -(n1*n)", // in case * non-commutative assuming: { subtract: { total: !0 }, multiply: { commutative: !1 } } }, // final ordering of constants { s: "ce+ve -> ve+ce", assuming: { add: { commutative: !0 } }, imposeContext: { add: { commutative: !1 } } }, { s: "vd*cd -> cd*vd", assuming: { multiply: { commutative: !0 } }, imposeContext: { multiply: { commutative: !1 } } }, // undo temporary rules // { l: '(-1) * n', r: '-n' }, // #811 added test which proved this is redundant { l: "n+-n1", r: "n-n1" }, // undo replace 'subtract' { l: "n+-(n1)", r: "n-(n1)" }, { s: "n*(n1^-1) -> n/n1", // undo replace 'divide'; for * commutative assuming: { multiply: { commutative: !0 } } // o.w. / not conventional }, { s: "n*n1^-n2 -> n/n1^n2", assuming: { multiply: { commutative: !0 } } // o.w. / not conventional }, { s: "n^-1 -> 1/n", assuming: { multiply: { commutative: !0 } } // o.w. / not conventional }, { l: "n^1", r: "n" }, // can be produced by power cancellation { s: "n*(n1/n2) -> (n*n1)/n2", // '*' before '/' assuming: { multiply: { associative: !0 } } }, { s: "n-(n1+n2) -> n-n1-n2", // '-' before '+' assuming: { addition: { associative: !0, commutative: !0 } } }, // { l: '(n1/n2)/n3', r: 'n1/(n2*n3)' }, // { l: '(n*n1)/(n*n2)', r: 'n1/n2' }, // simplifyConstant can leave an extra factor of 1, which can always // be eliminated, since the identity always commutes { l: "1*n", r: "n", imposeContext: { multiply: { commutative: !0 } } }, { s: "n1/(n2/n3) -> (n1*n3)/n2", assuming: { multiply: { associative: !0 } } }, { l: "n1/(-n2)", r: "-n1/n2" } ]; function I(q, Z) { var K = {}; if (q.s) { var j = q.s.split("->"); if (j.length === 2) K.l = j[0], K.r = j[1]; else throw SyntaxError("Could not parse rule: " + q.s); } else K.l = q.l, K.r = q.r; K.l = F(t(K.l)), K.r = F(t(K.r)); for (var ee of ["imposeContext", "repeat", "assuming"]) ee in q && (K[ee] = q[ee]); if (q.evaluate && (K.evaluate = t(q.evaluate)), A(K.l, Z)) { var te = !y(K.l, Z), oe; te && (oe = _()); var ge = D(K.l), L = _(); K.expanded = {}, K.expanded.l = ge([K.l, L]), x(K.expanded.l, Z), w(K.expanded.l, Z), K.expanded.r = ge([K.r, L]), te && (K.expandedNC1 = {}, K.expandedNC1.l = ge([oe, K.l]), K.expandedNC1.r = ge([oe, K.r]), K.expandedNC2 = {}, K.expandedNC2.l = ge([oe, K.expanded.l]), K.expandedNC2.r = ge([oe, K.expanded.r])); } return K; } function B(q, Z) { for (var K = [], j = 0; j < q.length; j++) { var ee = q[j], te = void 0, oe = typeof ee; switch (oe) { case "string": ee = { s: ee }; case "object": te = I(ee, Z); break; case "function": te = ee; break; default: throw TypeError("Unsupported type of rule: " + oe); } K.push(te); } return K; } var C = 0; function _() { return new v("_p" + C++); } function z(q, Z) { var K = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Ii(), j = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {}, ee = j.consoleDebug; Z = B(Z || M.rules, j.context); var te = a(q, K); te = F(te); for (var oe = {}, ge = te.toString({ parenthesis: "all" }); !oe[ge]; ) { oe[ge] = !0, C = 0; var L = ge; ee && console.log("Working on: ", ge); for (var H = 0; H < Z.length; H++) { var ne = ""; if (typeof Z[H] == "function" ? (te = Z[H](te, j), ee && (ne = Z[H].name)) : (x(te, j.context), te = W(te, Z[H], j.context), ee && (ne = "".concat(Z[H].l.toString(), " -> ").concat(Z[H].r.toString()))), ee) { var ie = te.toString({ parenthesis: "all" }); ie !== L && (console.log("Applying", ne, "produced", ie), L = ie); } g(te, j.context); } ge = te.toString({ parenthesis: "all" }); } return te; } function O(q, Z, K) { var j = q; if (q) for (var ee = 0; ee < q.length; ++ee) { var te = W(q[ee], Z, K); te !== q[ee] && (j === q && (j = q.slice()), j[ee] = te); } return j; } function W(q, Z, K) { if (Z.assuming) { for (var j in Z.assuming) for (var ee in Z.assuming[j]) if (b(j, ee, K) !== Z.assuming[j][ee]) return q; } var te = h(Z.imposeContext, K), oe = q; if (oe instanceof p || oe instanceof c) { var ge = O(oe.args, Z, K); ge !== oe.args && (oe = oe.clone(), oe.args = ge); } else if (oe instanceof m) { if (oe.content) { var L = W(oe.content, Z, K); L !== oe.content && (oe = new m(L)); } } else if (oe instanceof u) { var H = O(oe.items, Z, K); H !== oe.items && (oe = new u(H)); } else if (oe instanceof l) { var ne = oe.object; oe.object && (ne = W(oe.object, Z, K)); var ie = oe.index; oe.index && (ie = W(oe.index, Z, K)), (ne !== oe.object || ie !== oe.index) && (oe = new l(ne, ie)); } else if (oe instanceof f) { var me = O(oe.dimensions, Z, K); me !== oe.dimensions && (oe = new f(me)); } else if (oe instanceof d) { var pe = !1, xe = {}; for (var De in oe.properties) xe[De] = W(oe.properties[De], Z, K), xe[De] !== oe.properties[De] && (pe = !0); pe && (oe = new d(xe)); } var k = Z.r, J = se(Z.l, oe, te)[0]; if (!J && Z.expanded && (k = Z.expanded.r, J = se(Z.expanded.l, oe, te)[0]), !J && Z.expandedNC1 && (k = Z.expandedNC1.r, J = se(Z.expandedNC1.l, oe, te)[0], J || (k = Z.expandedNC2.r, J = se(Z.expandedNC2.l, oe, te)[0])), J) { var G = oe.implicit; oe = k.clone(), G && "implicit" in k && (oe.implicit = !0), oe = oe.transform(function(ae) { return ae.isSymbolNode && Fe(J.placeholders, ae.name) ? J.placeholders[ae.name].clone() : ae; }); } return Z.repeat && oe !== q && (oe = W(oe, Z, K)), oe; } function X(q, Z) { var K = [], j, ee, te = D(q); if (y(q, Z)) for (var oe = 0; oe < q.args.length; oe++) ee = q.args.slice(0), ee.splice(oe, 1), j = ee.length === 1 ? ee[0] : te(ee), K.push(te([q.args[oe], j])); else for (var ge = 1; ge < q.args.length; ge++) { var L = q.args[0]; ge > 1 && (L = te(q.args.slice(0, ge))), ee = q.args.slice(ge), j = ee.length === 1 ? ee[0] : te(ee), K.push(te([L, j])); } return K; } function V(q, Z) { var K = { placeholders: {} }; if (!q.placeholders && !Z.placeholders) return K; if (q.placeholders) { if (!Z.placeholders) return q; } else return Z; for (var j in q.placeholders) if (Fe(q.placeholders, j) && (K.placeholders[j] = q.placeholders[j], Fe(Z.placeholders, j) && !re(q.placeholders[j], Z.placeholders[j]))) return null; for (var ee in Z.placeholders) Fe(Z.placeholders, ee) && (K.placeholders[ee] = Z.placeholders[ee]); return K; } function R(q, Z) { var K = []; if (q.length === 0 || Z.length === 0) return K; for (var j, ee = 0; ee < q.length; ee++) for (var te = 0; te < Z.length; te++) j = V(q[ee], Z[te]), j && K.push(j); return K; } function Q(q) { if (q.length === 0) return q; for (var Z = q.reduce(R), K = [], j = {}, ee = 0; ee < Z.length; ee++) { var te = JSON.stringify(Z[ee]); j[te] || (j[te] = !0, K.push(Z[ee])); } return K; } function se(q, Z, K, j) { var ee = [{ placeholders: {} }]; if (q instanceof p && Z instanceof p || q instanceof c && Z instanceof c) { if (q instanceof p) { if (q.op !== Z.op || q.fn !== Z.fn) return []; } else if (q instanceof c && q.name !== Z.name) return []; if (Z.args.length === 1 && q.args.length === 1 || !A(Z, K) && Z.args.length === q.args.length || j) { for (var te = [], oe = 0; oe < q.args.length; oe++) { var ge = se(q.args[oe], Z.args[oe], K); if (ge.length === 0) break; te.push(ge); } if (te.length !== q.args.length) { if (!y(Z, K) || // exact match in order needed q.args.length === 1) return []; if (q.args.length > 2) throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented"); var L = se(q.args[0], Z.args[1], K); if (L.length === 0) return []; var H = se(q.args[1], Z.args[0], K); if (H.length === 0) return []; te = [L, H]; } ee = Q(te); } else if (Z.args.length >= 2 && q.args.length === 2) { for (var ne = X(Z, K), ie = [], me = 0; me < ne.length; me++) { var pe = se(q, ne[me], K, !0); ie = ie.concat(pe); } return ie; } else { if (q.args.length > 2) throw Error("Unexpected non-binary associative function: " + q.toString()); return []; } } else if (q instanceof v) { if (q.name.length === 0) throw new Error("Symbol in rule has 0 length...!?"); if ($[q.name]) { if (q.name !== Z.name) return []; } else switch (q.name[1] >= "a" && q.name[1] <= "z" ? q.name.substring(0, 2) : q.name[0]) { case "n": case "_p": ee[0].placeholders[q.name] = Z; break; case "c": case "cl": if (nr(Z)) ee[0].placeholders[q.name] = Z; else return []; break; case "v": if (!nr(Z)) ee[0].placeholders[q.name] = Z; else return []; break; case "vl": if ($r(Z)) ee[0].placeholders[q.name] = Z; else return []; break; case "cd": if (Yv(Z)) ee[0].placeholders[q.name] = Z; else return []; break; case "vd": if (!Yv(Z)) ee[0].placeholders[q.name] = Z; else return []; break; case "ce": if (cs(Z)) ee[0].placeholders[q.name] = Z; else return []; break; case "ve": if (!cs(Z)) ee[0].placeholders[q.name] = Z; else return []; break; default: throw new Error("Invalid symbol in rule: " + q.name); } } else if (q instanceof s) { if (!n(q.value, Z.value)) return []; } else return []; return ee; } function re(q, Z) { if (q instanceof s && Z instanceof s) { if (!n(q.value, Z.value)) return !1; } else if (q instanceof v && Z instanceof v) { if (q.name !== Z.name) return !1; } else if (q instanceof p && Z instanceof p || q instanceof c && Z instanceof c) { if (q instanceof p) { if (q.op !== Z.op || q.fn !== Z.fn) return !1; } else if (q instanceof c && q.name !== Z.name) return !1; if (q.args.length !== Z.args.length) return !1; for (var K = 0; K < q.args.length; K++) if (!re(q.args[K], Z.args[K])) return !1; } else return !1; return !0; } return M; }), Hz = "simplifyConstant", Zz = ["typed", "config", "mathWithTransform", "matrix", "?fraction", "?bignumber", "AccessorNode", "ArrayNode", "ConstantNode", "FunctionNode", "IndexNode", "ObjectNode", "OperatorNode", "SymbolNode"], Gz = /* @__PURE__ */ P(Hz, Zz, (e) => { var { typed: r, config: t, mathWithTransform: n, matrix: a, fraction: i, bignumber: o, AccessorNode: l, ArrayNode: u, ConstantNode: s, FunctionNode: c, IndexNode: f, ObjectNode: d, OperatorNode: p, SymbolNode: m } = e, { isCommutative: v, isAssociative: b, allChildren: y, createMakeNodeFunction: A } = sc({ FunctionNode: c, OperatorNode: p, SymbolNode: m }), h = r("simplifyConstant", { Node: (B) => D(I(B, {})), "Node, Object": function(C, _) { return D(I(C, _)); } }); function x(B) { return Aa(B) ? B.valueOf() : B instanceof Array ? B.map(x) : ze(B) ? a(x(B.valueOf())) : B; } function w(B, C, _) { try { return n[B].apply(null, C); } catch { return C = C.map(x), N(n[B].apply(null, C), _); } } var g = r({ Fraction: M, number: function(C) { return C < 0 ? S(new s(-C)) : new s(C); }, BigNumber: function(C) { return C < 0 ? S(new s(-C)) : new s(C); }, bigint: function(C) { return C < 0n ? S(new s(-C)) : new s(C); }, Complex: function(C) { throw new Error("Cannot convert Complex number to Node"); }, string: function(C) { return new s(C); }, Matrix: function(C) { return new u(C.valueOf().map((_) => g(_))); } }); function D(B) { return fr(B) ? B : g(B); } function E(B, C) { var _ = C && C.exactFractions !== !1; if (_ && isFinite(B) && i) { var z = i(B), O = C && typeof C.fractionsLimit == "number" ? C.fractionsLimit : 1 / 0; if (z.valueOf() === B && z.n < O && z.d < O) return z; } return B; } var N = r({ "string, Object": function(C, _) { var z = Qn(C, t); if (z === "BigNumber") return o === void 0 && Yl(), o(C); if (z === "bigint") return BigInt(C); if (z === "Fraction") return i === void 0 && Oy(), i(C); var O = parseFloat(C); return E(O, _); }, "Fraction, Object": function(C, _) { return C; }, // we don't need options here "BigNumber, Object": function(C, _) { return C; }, // we don't need options here "number, Object": function(C, _) { return E(C, _); }, "bigint, Object": function(C, _) { return C; }, "Complex, Object": function(C, _) { return C.im !== 0 ? C : E(C.re, _); }, "Matrix, Object": function(C, _) { return a(E(C.valueOf())); }, "Array, Object": function(C, _) { return C.map(E); } }); function S(B) { return new p("-", "unaryMinus", [B]); } function M(B) { var C, _ = B.s * B.n; return _ < 0 ? C = new p("-", "unaryMinus", [new s(-_)]) : C = new s(_), B.d === 1 ? C : new p("/", "divide", [C, new s(B.d)]); } function F(B, C, _) { if (!Na(C)) return new l(D(B), D(C)); if (bt(B) || ze(B)) { for (var z = Array.from(C.dimensions); z.length > 0; ) if (nr(z[0]) && typeof z[0].value != "string") { var O = N(z.shift().value, _); bt(B) ? B = B.items[O - 1] : (B = B.valueOf()[O - 1], B instanceof Array && (B = a(B))); } else if (z.length > 1 && nr(z[1]) && typeof z[1].value != "string") { var W = N(z[1].value, _), X = [], V = bt(B) ? B.items : B.valueOf(); for (var R of V) if (bt(R)) X.push(R.items[W - 1]); else if (ze(B)) X.push(R[W - 1]); else break; if (X.length === V.length) bt(B) ? B = new u(X) : B = a(X), z.splice(1, 1); else break; } else break; return z.length === C.dimensions.length ? new l(D(B), C) : z.length > 0 ? (C = new f(z), new l(D(B), C)) : B; } if (Wi(B) && C.dimensions.length === 1 && nr(C.dimensions[0])) { var Q = C.dimensions[0].value; return Q in B.properties ? B.properties[Q] : new s(); } return new l(D(B), C); } function $(B, C, _, z) { var O = C.shift(), W = C.reduce((X, V) => { if (!fr(V)) { var R = X.pop(); if (fr(R)) return [R, V]; try { return X.push(w(B, [R, V], z)), X; } catch { X.push(R); } } X.push(D(X.pop())); var Q = X.length === 1 ? X[0] : _(X); return [_([Q, D(V)])]; }, [O]); return W.length === 1 ? W[0] : _([W[0], g(W[1])]); } function I(B, C) { switch (B.type) { case "SymbolNode": return B; case "ConstantNode": switch (typeof B.value) { case "number": return N(B.value, C); case "bigint": return N(B.value, C); case "string": return B.value; default: if (!isNaN(B.value)) return N(B.value, C); } return B; case "FunctionNode": if (n[B.name] && n[B.name].rawArgs) return B; { var _ = ["add", "multiply"]; if (!_.includes(B.name)) { var z = B.args.map((ee) => I(ee, C)); if (!z.some(fr)) try { return w(B.name, z, C); } catch { } if (B.name === "size" && z.length === 1 && bt(z[0])) { for (var O = [], W = z[0]; bt(W); ) O.push(W.items.length), W = W.items[0]; return a(O); } return new c(B.name, z.map(D)); } } case "OperatorNode": { var X = B.fn.toString(), V, R, Q = A(B); if (_r(B) && B.isUnary()) V = [I(B.args[0], C)], fr(V[0]) ? R = Q(V) : R = w(X, V, C); else if (b(B, C.context)) if (V = y(B, C.context), V = V.map((ee) => I(ee, C)), v(X, C.context)) { for (var se = [], re = [], q = 0; q < V.length; q++) fr(V[q]) ? re.push(V[q]) : se.push(V[q]); se.length > 1 ? (R = $(X, se, Q, C), re.unshift(R), R = $(X, re, Q, C)) : R = $(X, V, Q, C); } else R = $(X, V, Q, C); else V = B.args.map((ee) => I(ee, C)), R = $(X, V, Q, C); return R; } case "ParenthesisNode": return I(B.content, C); case "AccessorNode": return F(I(B.object, C), I(B.index, C), C); case "ArrayNode": { var Z = B.items.map((ee) => I(ee, C)); return Z.some(fr) ? new u(Z.map(D)) : a(Z); } case "IndexNode": return new f(B.dimensions.map((ee) => h(ee, C))); case "ObjectNode": { var K = {}; for (var j in B.properties) K[j] = h(B.properties[j], C); return new d(K); } case "AssignmentNode": case "BlockNode": case "FunctionAssignmentNode": case "RangeNode": case "ConditionalNode": default: throw new Error("Unimplemented node type in simplifyConstant: ".concat(B.type)); } } return h; }), Xv = "simplifyCore", Wz = ["typed", "parse", "equal", "isZero", "add", "subtract", "multiply", "divide", "pow", "AccessorNode", "ArrayNode", "ConstantNode", "FunctionNode", "IndexNode", "ObjectNode", "OperatorNode", "ParenthesisNode", "SymbolNode"], Kz = /* @__PURE__ */ P(Xv, Wz, (e) => { var { typed: r, parse: t, equal: n, isZero: a, add: i, subtract: o, multiply: l, divide: u, pow: s, AccessorNode: c, ArrayNode: f, ConstantNode: d, FunctionNode: p, IndexNode: m, ObjectNode: v, OperatorNode: b, ParenthesisNode: y, SymbolNode: A } = e, h = new d(0), x = new d(1), w = new d(!0), g = new d(!1); function D(M) { return _r(M) && ["and", "not", "or"].includes(M.op); } var { hasProperty: E, isCommutative: N } = sc({ FunctionNode: p, OperatorNode: b, SymbolNode: A }); function S(M) { var F = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, $ = F ? F.context : void 0; if (E(M, "trivial", $)) { if (En(M) && M.args.length === 1) return S(M.args[0], F); var I = !1, B = 0; if (M.forEach((re) => { ++B, B === 1 && (I = S(re, F)); }), B === 1) return I; } var C = M; if (En(C)) { var _ = Y8(C.name); if (_) { if (C.args.length > 2 && E(C, "associative", $)) for (; C.args.length > 2; ) { var z = C.args.pop(), O = C.args.pop(); C.args.push(new b(_, C.name, [z, O])); } C = new b(_, C.name, C.args); } else return new p(S(C.fn), C.args.map((re) => S(re, F))); } if (_r(C) && C.isUnary()) { var W = S(C.args[0], F); if (C.op === "~" && _r(W) && W.isUnary() && W.op === "~" || C.op === "not" && _r(W) && W.isUnary() && W.op === "not" && D(W.args[0])) return W.args[0]; var X = !0; if (C.op === "-" && _r(W) && (W.isBinary() && W.fn === "subtract" && (C = new b("-", "subtract", [W.args[1], W.args[0]]), X = !1), W.isUnary() && W.op === "-")) return W.args[0]; if (X) return new b(C.op, C.fn, [W]); } if (_r(C) && C.isBinary()) { var V = S(C.args[0], F), R = S(C.args[1], F); if (C.op === "+") { if (nr(V) && a(V.value)) return R; if (nr(R) && a(R.value)) return V; _r(R) && R.isUnary() && R.op === "-" && (R = R.args[0], C = new b("-", "subtract", [V, R])); } if (C.op === "-") return _r(R) && R.isUnary() && R.op === "-" ? S(new b("+", "add", [V, R.args[0]]), F) : nr(V) && a(V.value) ? S(new b("-", "unaryMinus", [R])) : nr(R) && a(R.value) ? V : new b(C.op, C.fn, [V, R]); if (C.op === "*") { if (nr(V)) { if (a(V.value)) return h; if (n(V.value, 1)) return R; } if (nr(R)) { if (a(R.value)) return h; if (n(R.value, 1)) return V; if (N(C, $)) return new b(C.op, C.fn, [R, V], C.implicit); } return new b(C.op, C.fn, [V, R], C.implicit); } if (C.op === "/") return nr(V) && a(V.value) ? h : nr(R) && n(R.value, 1) ? V : new b(C.op, C.fn, [V, R]); if (C.op === "^" && nr(R)) { if (a(R.value)) return x; if (n(R.value, 1)) return V; } if (C.op === "and") { if (nr(V)) if (V.value) { if (D(R)) return R; if (nr(R)) return R.value ? w : g; } else return g; if (nr(R)) if (R.value) { if (D(V)) return V; } else return g; } if (C.op === "or") { if (nr(V)) { if (V.value) return w; if (D(R)) return R; } if (nr(R)) { if (R.value) return w; if (D(V)) return V; } } return new b(C.op, C.fn, [V, R]); } if (_r(C)) return new b(C.op, C.fn, C.args.map((re) => S(re, F))); if (bt(C)) return new f(C.items.map((re) => S(re, F))); if (Jn(C)) return new c(S(C.object, F), S(C.index, F)); if (Na(C)) return new m(C.dimensions.map((re) => S(re, F))); if (Wi(C)) { var Q = {}; for (var se in C.properties) Q[se] = S(C.properties[se], F); return new v(Q); } return C; } return r(Xv, { Node: S, "Node,Object": S }); }), Jz = "resolve", Yz = ["typed", "parse", "ConstantNode", "FunctionNode", "OperatorNode", "ParenthesisNode"], jz = /* @__PURE__ */ P(Jz, Yz, (e) => { var { typed: r, parse: t, ConstantNode: n, FunctionNode: a, OperatorNode: i, ParenthesisNode: o } = e; function l(u, s) { var c = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : /* @__PURE__ */ new Set(); if (!s) return u; if ($r(u)) { if (c.has(u.name)) { var f = Array.from(c).join(", "); throw new ReferenceError("recursive loop of variable definitions among {".concat(f, "}")); } var d = s.get(u.name); if (fr(d)) { var p = new Set(c); return p.add(u.name), l(d, s, p); } else return typeof d == "number" ? t(String(d)) : d !== void 0 ? new n(d) : u; } else if (_r(u)) { var m = u.args.map(function(b) { return l(b, s, c); }); return new i(u.op, u.fn, m, u.implicit); } else { if (rn(u)) return new o(l(u.content, s, c)); if (En(u)) { var v = u.args.map(function(b) { return l(b, s, c); }); return new a(u.name, v); } } return u.map((b) => l(b, s, c)); } return r("resolve", { Node: l, "Node, Map | null | undefined": l, "Node, Object": (u, s) => l(u, La(s)), // For arrays and matrices, we map `self` rather than `_resolve` // because resolve is fairly expensive anyway, and this way // we get nice error messages if one entry in the array has wrong type. "Array | Matrix": r.referToSelf((u) => (s) => s.map((c) => u(c))), "Array | Matrix, null | undefined": r.referToSelf((u) => (s) => s.map((c) => u(c))), "Array, Object": r.referTo("Array,Map", (u) => (s, c) => u(s, La(c))), "Matrix, Object": r.referTo("Matrix,Map", (u) => (s, c) => u(s, La(c))), "Array | Matrix, Map": r.referToSelf((u) => (s, c) => s.map((f) => u(f, c))) }); }), Qv = "symbolicEqual", Xz = ["parse", "simplify", "typed", "OperatorNode"], Qz = /* @__PURE__ */ P(Qv, Xz, (e) => { var { parse: r, simplify: t, typed: n, OperatorNode: a } = e; function i(o, l) { var u = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, s = new a("-", "subtract", [o, l]), c = t(s, {}, u); return nr(c) && !c.value; } return n(Qv, { "Node, Node": i, "Node, Node, Object": i }); }), eh = "derivative", eq = ["typed", "config", "parse", "simplify", "equal", "isZero", "numeric", "ConstantNode", "FunctionNode", "OperatorNode", "ParenthesisNode", "SymbolNode"], rq = /* @__PURE__ */ P(eh, eq, (e) => { var { typed: r, config: t, parse: n, simplify: a, equal: i, isZero: o, numeric: l, ConstantNode: u, FunctionNode: s, OperatorNode: c, ParenthesisNode: f, SymbolNode: d } = e; function p(x, w) { var g = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : { simplify: !0 }, D = {}; y(D, x, w.name); var E = A(x, D); return g.simplify ? a(E) : E; } function m(x) { var w = n(x); if (!w.isSymbolNode) throw new TypeError("Invalid variable. " + "Cannot parse ".concat(JSON.stringify(x), " into a variable in function derivative")); return w; } var v = r(eh, { "Node, SymbolNode": p, "Node, SymbolNode, Object": p, "Node, string": (x, w) => p(x, m(w)), "Node, string, Object": (x, w, g) => p(x, m(w), g) /* TODO: implement and test syntax with order of derivatives -> implement as an option {order: number} 'Node, SymbolNode, ConstantNode': function (expr, variable, {order}) { let res = expr for (let i = 0; i < order; i++) { let constNodes = {} constTag(constNodes, expr, variable.name) res = _derivative(res, constNodes) } return res } */ }); v._simplify = !0, v.toTex = function(x) { return b.apply(null, x.args); }; var b = r("_derivTex", { "Node, SymbolNode": function(w, g) { return nr(w) && yr(w.value) === "string" ? b(n(w.value).toString(), g.toString(), 1) : b(w.toTex(), g.toString(), 1); }, "Node, ConstantNode": function(w, g) { if (yr(g.value) === "string") return b(w, n(g.value)); throw new Error("The second parameter to 'derivative' is a non-string constant"); }, "Node, SymbolNode, ConstantNode": function(w, g, D) { return b(w.toString(), g.name, D.value); }, "string, string, number": function(w, g, D) { var E; return D === 1 ? E = "{d\\over d" + g + "}" : E = "{d^{" + D + "}\\over d" + g + "^{" + D + "}}", E + "\\left[".concat(w, "\\right]"); } }), y = r("constTag", { "Object, ConstantNode, string": function(w, g) { return w[g] = !0, !0; }, "Object, SymbolNode, string": function(w, g, D) { return g.name !== D ? (w[g] = !0, !0) : !1; }, "Object, ParenthesisNode, string": function(w, g, D) { return y(w, g.content, D); }, "Object, FunctionAssignmentNode, string": function(w, g, D) { return g.params.includes(D) ? y(w, g.expr, D) : (w[g] = !0, !0); }, "Object, FunctionNode | OperatorNode, string": function(w, g, D) { if (g.args.length > 0) { for (var E = y(w, g.args[0], D), N = 1; N < g.args.length; ++N) E = y(w, g.args[N], D) && E; if (E) return w[g] = !0, !0; } return !1; } }), A = r("_derivative", { "ConstantNode, Object": function(w) { return h(0); }, "SymbolNode, Object": function(w, g) { return g[w] !== void 0 ? h(0) : h(1); }, "ParenthesisNode, Object": function(w, g) { return new f(A(w.content, g)); }, "FunctionAssignmentNode, Object": function(w, g) { return g[w] !== void 0 ? h(0) : A(w.expr, g); }, "FunctionNode, Object": function(w, g) { if (g[w] !== void 0) return h(0); var D = w.args[0], E, N = !1, S = !1, M; switch (w.name) { case "cbrt": N = !0, M = new c("*", "multiply", [h(3), new c("^", "pow", [D, new c("/", "divide", [h(2), h(3)])])]); break; case "sqrt": case "nthRoot": if (w.args.length === 1) N = !0, M = new c("*", "multiply", [h(2), new s("sqrt", [D])]); else if (w.args.length === 2) return E = new c("/", "divide", [h(1), w.args[1]]), g[E] = g[w.args[1]], A(new c("^", "pow", [D, E]), g); break; case "log10": E = h(10); case "log": if (!E && w.args.length === 1) M = D.clone(), N = !0; else if (w.args.length === 1 && E || w.args.length === 2 && g[w.args[1]] !== void 0) M = new c("*", "multiply", [D.clone(), new s("log", [E || w.args[1]])]), N = !0; else if (w.args.length === 2) return A(new c("/", "divide", [new s("log", [D]), new s("log", [w.args[1]])]), g); break; case "pow": if (w.args.length === 2) return g[E] = g[w.args[1]], A(new c("^", "pow", [D, w.args[1]]), g); break; case "exp": M = new s("exp", [D.clone()]); break; case "sin": M = new s("cos", [D.clone()]); break; case "cos": M = new c("-", "unaryMinus", [new s("sin", [D.clone()])]); break; case "tan": M = new c("^", "pow", [new s("sec", [D.clone()]), h(2)]); break; case "sec": M = new c("*", "multiply", [w, new s("tan", [D.clone()])]); break; case "csc": S = !0, M = new c("*", "multiply", [w, new s("cot", [D.clone()])]); break; case "cot": S = !0, M = new c("^", "pow", [new s("csc", [D.clone()]), h(2)]); break; case "asin": N = !0, M = new s("sqrt", [new c("-", "subtract", [h(1), new c("^", "pow", [D.clone(), h(2)])])]); break; case "acos": N = !0, S = !0, M = new s("sqrt", [new c("-", "subtract", [h(1), new c("^", "pow", [D.clone(), h(2)])])]); break; case "atan": N = !0, M = new c("+", "add", [new c("^", "pow", [D.clone(), h(2)]), h(1)]); break; case "asec": N = !0, M = new c("*", "multiply", [new s("abs", [D.clone()]), new s("sqrt", [new c("-", "subtract", [new c("^", "pow", [D.clone(), h(2)]), h(1)])])]); break; case "acsc": N = !0, S = !0, M = new c("*", "multiply", [new s("abs", [D.clone()]), new s("sqrt", [new c("-", "subtract", [new c("^", "pow", [D.clone(), h(2)]), h(1)])])]); break; case "acot": N = !0, S = !0, M = new c("+", "add", [new c("^", "pow", [D.clone(), h(2)]), h(1)]); break; case "sinh": M = new s("cosh", [D.clone()]); break; case "cosh": M = new s("sinh", [D.clone()]); break; case "tanh": M = new c("^", "pow", [new s("sech", [D.clone()]), h(2)]); break; case "sech": S = !0, M = new c("*", "multiply", [w, new s("tanh", [D.clone()])]); break; case "csch": S = !0, M = new c("*", "multiply", [w, new s("coth", [D.clone()])]); break; case "coth": S = !0, M = new c("^", "pow", [new s("csch", [D.clone()]), h(2)]); break; case "asinh": N = !0, M = new s("sqrt", [new c("+", "add", [new c("^", "pow", [D.clone(), h(2)]), h(1)])]); break; case "acosh": N = !0, M = new s("sqrt", [new c("-", "subtract", [new c("^", "pow", [D.clone(), h(2)]), h(1)])]); break; case "atanh": N = !0, M = new c("-", "subtract", [h(1), new c("^", "pow", [D.clone(), h(2)])]); break; case "asech": N = !0, S = !0, M = new c("*", "multiply", [D.clone(), new s("sqrt", [new c("-", "subtract", [h(1), new c("^", "pow", [D.clone(), h(2)])])])]); break; case "acsch": N = !0, S = !0, M = new c("*", "multiply", [new s("abs", [D.clone()]), new s("sqrt", [new c("+", "add", [new c("^", "pow", [D.clone(), h(2)]), h(1)])])]); break; case "acoth": N = !0, S = !0, M = new c("-", "subtract", [h(1), new c("^", "pow", [D.clone(), h(2)])]); break; case "abs": M = new c("/", "divide", [new s(new d("abs"), [D.clone()]), D.clone()]); break; case "gamma": default: throw new Error('Cannot process function "' + w.name + '" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported'); } var F, $; N ? (F = "/", $ = "divide") : (F = "*", $ = "multiply"); var I = A(D, g); return S && (I = new c("-", "unaryMinus", [I])), new c(F, $, [I, M]); }, "OperatorNode, Object": function(w, g) { if (g[w] !== void 0) return h(0); if (w.op === "+") return new c(w.op, w.fn, w.args.map(function(C) { return A(C, g); })); if (w.op === "-") { if (w.isUnary()) return new c(w.op, w.fn, [A(w.args[0], g)]); if (w.isBinary()) return new c(w.op, w.fn, [A(w.args[0], g), A(w.args[1], g)]); } if (w.op === "*") { var D = w.args.filter(function(C) { return g[C] !== void 0; }); if (D.length > 0) { var E = w.args.filter(function(C) { return g[C] === void 0; }), N = E.length === 1 ? E[0] : new c("*", "multiply", E), S = D.concat(A(N, g)); return new c("*", "multiply", S); } return new c("+", "add", w.args.map(function(C) { return new c("*", "multiply", w.args.map(function(_) { return _ === C ? A(_, g) : _.clone(); })); })); } if (w.op === "/" && w.isBinary()) { var M = w.args[0], F = w.args[1]; return g[F] !== void 0 ? new c("/", "divide", [A(M, g), F]) : g[M] !== void 0 ? new c("*", "multiply", [new c("-", "unaryMinus", [M]), new c("/", "divide", [A(F, g), new c("^", "pow", [F.clone(), h(2)])])]) : new c("/", "divide", [new c("-", "subtract", [new c("*", "multiply", [A(M, g), F.clone()]), new c("*", "multiply", [M.clone(), A(F, g)])]), new c("^", "pow", [F.clone(), h(2)])]); } if (w.op === "^" && w.isBinary()) { var $ = w.args[0], I = w.args[1]; if (g[$] !== void 0) return nr($) && (o($.value) || i($.value, 1)) ? h(0) : new c("*", "multiply", [w, new c("*", "multiply", [new s("log", [$.clone()]), A(I.clone(), g)])]); if (g[I] !== void 0) { if (nr(I)) { if (o(I.value)) return h(0); if (i(I.value, 1)) return A($, g); } var B = new c("^", "pow", [$.clone(), new c("-", "subtract", [I, h(1)])]); return new c("*", "multiply", [I.clone(), new c("*", "multiply", [A($, g), B])]); } return new c("*", "multiply", [new c("^", "pow", [$.clone(), I.clone()]), new c("+", "add", [new c("*", "multiply", [A($, g), new c("/", "divide", [I.clone(), $.clone()])]), new c("*", "multiply", [A(I, g), new s("log", [$.clone()])])])]); } throw new Error('Cannot process operator "' + w.op + '" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported'); } }); function h(x, w) { return new u(l(x, Qn(String(x), t))); } return v; }), rh = "rationalize", tq = ["config", "typed", "equal", "isZero", "add", "subtract", "multiply", "divide", "pow", "parse", "simplifyConstant", "simplifyCore", "simplify", "?bignumber", "?fraction", "mathWithTransform", "matrix", "AccessorNode", "ArrayNode", "ConstantNode", "FunctionNode", "IndexNode", "ObjectNode", "OperatorNode", "SymbolNode", "ParenthesisNode"], nq = /* @__PURE__ */ P(rh, tq, (e) => { var { config: r, typed: t, equal: n, isZero: a, add: i, subtract: o, multiply: l, divide: u, pow: s, parse: c, simplifyConstant: f, simplifyCore: d, simplify: p, fraction: m, bignumber: v, mathWithTransform: b, matrix: y, AccessorNode: A, ArrayNode: h, ConstantNode: x, FunctionNode: w, IndexNode: g, ObjectNode: D, OperatorNode: E, SymbolNode: N, ParenthesisNode: S } = e; function M(C) { var _ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, O = $(), W = F(C, _, !0, O.firstRules), X = W.variables.length, V = { exactFractions: !1 }, R = { exactFractions: !0 }; if (C = W.expression, X >= 1) { C = I(C); var Q, se, re = !0, q = !1; C = p(C, O.firstRules, {}, V); for (var Z; se = re ? O.distrDivRules : O.sucDivRules, C = p(C, se, {}, R), re = !re, Z = C.toString(), Z !== Q; ) q = !0, Q = Z; q && (C = p(C, O.firstRulesAgain, {}, V)), C = p(C, O.finalRules, {}, V); } var K = [], j = {}; return C.type === "OperatorNode" && C.isBinary() && C.op === "/" ? (X === 1 && (C.args[0] = B(C.args[0], K), C.args[1] = B(C.args[1])), z && (j.numerator = C.args[0], j.denominator = C.args[1])) : (X === 1 && (C = B(C, K)), z && (j.numerator = C, j.denominator = null)), z ? (j.coefficients = K, j.variables = W.variables, j.expression = C, j) : C; } return t(rh, { Node: M, "Node, boolean": (C, _) => M(C, {}, _), "Node, Object": M, "Node, Object, boolean": M }); function F(C, _, z, O) { var W = [], X = p(C, O, _, { exactFractions: !1 }); z = !!z; var V = "+-*" + (z ? "/" : ""); Q(X); var R = {}; return R.expression = X, R.variables = W, R; function Q(se) { var re = se.type; if (re === "FunctionNode") throw new Error("There is an unsolved function call"); if (re === "OperatorNode") if (se.op === "^") { if (se.args[1].type !== "ConstantNode" || !Oe(parseFloat(se.args[1].value))) throw new Error("There is a non-integer exponent"); Q(se.args[0]); } else { if (!V.includes(se.op)) throw new Error("Operator " + se.op + " invalid in polynomial expression"); for (var q = 0; q < se.args.length; q++) Q(se.args[q]); } else if (re === "SymbolNode") { var Z = se.name, K = W.indexOf(Z); K === -1 && W.push(Z); } else if (re === "ParenthesisNode") Q(se.content); else if (re !== "ConstantNode") throw new Error("type " + re + " is not allowed in polynomial expression"); } } function $() { var C = [ d, // sCore { l: "n+n", r: "2*n" }, { l: "n+-n", r: "0" }, f, // sConstant { l: "n*(n1^-1)", r: "n/n1" }, { l: "n*n1^-n2", r: "n/n1^n2" }, { l: "n1^-1", r: "1/n1" }, { l: "n*(n1/n2)", r: "(n*n1)/n2" }, { l: "1*n", r: "n" } ], _ = [ { l: "(-n1)/(-n2)", r: "n1/n2" }, // Unary division { l: "(-n1)*(-n2)", r: "n1*n2" }, // Unary multiplication { l: "n1--n2", r: "n1+n2" }, // '--' elimination { l: "n1-n2", r: "n1+(-n2)" }, // Subtraction turn into add with un�ry minus { l: "(n1+n2)*n3", r: "(n1*n3 + n2*n3)" }, // Distributive 1 { l: "n1*(n2+n3)", r: "(n1*n2+n1*n3)" }, // Distributive 2 { l: "c1*n + c2*n", r: "(c1+c2)*n" }, // Joining constants { l: "c1*n + n", r: "(c1+1)*n" }, // Joining constants { l: "c1*n - c2*n", r: "(c1-c2)*n" }, // Joining constants { l: "c1*n - n", r: "(c1-1)*n" }, // Joining constants { l: "v/c", r: "(1/c)*v" }, // variable/constant (new!) { l: "v/-c", r: "-(1/c)*v" }, // variable/constant (new!) { l: "-v*-c", r: "c*v" }, // Inversion constant and variable 1 { l: "-v*c", r: "-c*v" }, // Inversion constant and variable 2 { l: "v*-c", r: "-c*v" }, // Inversion constant and variable 3 { l: "v*c", r: "c*v" }, // Inversion constant and variable 4 { l: "-(-n1*n2)", r: "(n1*n2)" }, // Unary propagation { l: "-(n1*n2)", r: "(-n1*n2)" }, // Unary propagation { l: "-(-n1+n2)", r: "(n1-n2)" }, // Unary propagation { l: "-(n1+n2)", r: "(-n1-n2)" }, // Unary propagation { l: "(n1^n2)^n3", r: "(n1^(n2*n3))" }, // Power to Power { l: "-(-n1/n2)", r: "(n1/n2)" }, // Division and Unary { l: "-(n1/n2)", r: "(-n1/n2)" } ], z = [ { l: "(n1/n2 + n3/n4)", r: "((n1*n4 + n3*n2)/(n2*n4))" }, // Sum of fractions { l: "(n1/n2 + n3)", r: "((n1 + n3*n2)/n2)" }, // Sum fraction with number 1 { l: "(n1 + n2/n3)", r: "((n1*n3 + n2)/n3)" } ], O = [ { l: "(n1/(n2/n3))", r: "((n1*n3)/n2)" }, // Division simplification { l: "(n1/n2/n3)", r: "(n1/(n2*n3))" } ], W = {}; return W.firstRules = C.concat(_, O), W.distrDivRules = z, W.sucDivRules = O, W.firstRulesAgain = C.concat(_), W.finalRules = [ d, // simplify.rules[0] { l: "n*-n", r: "-n^2" }, // Joining multiply with power 1 { l: "n*n", r: "n^2" }, // Joining multiply with power 2 f, // simplify.rules[14] old 3rd index in oldRules { l: "n*-n^n1", r: "-n^(n1+1)" }, // Joining multiply with power 3 { l: "n*n^n1", r: "n^(n1+1)" }, // Joining multiply with power 4 { l: "n^n1*-n^n2", r: "-n^(n1+n2)" }, // Joining multiply with power 5 { l: "n^n1*n^n2", r: "n^(n1+n2)" }, // Joining multiply with power 6 { l: "n^n1*-n", r: "-n^(n1+1)" }, // Joining multiply with power 7 { l: "n^n1*n", r: "n^(n1+1)" }, // Joining multiply with power 8 { l: "n^n1/-n", r: "-n^(n1-1)" }, // Joining multiply with power 8 { l: "n^n1/n", r: "n^(n1-1)" }, // Joining division with power 1 { l: "n/-n^n1", r: "-n^(1-n1)" }, // Joining division with power 2 { l: "n/n^n1", r: "n^(1-n1)" }, // Joining division with power 3 { l: "n^n1/-n^n2", r: "n^(n1-n2)" }, // Joining division with power 4 { l: "n^n1/n^n2", r: "n^(n1-n2)" }, // Joining division with power 5 { l: "n1+(-n2*n3)", r: "n1-n2*n3" }, // Solving useless parenthesis 1 { l: "v*(-c)", r: "-c*v" }, // Solving useless unary 2 { l: "n1+-n2", r: "n1-n2" }, // Solving +- together (new!) { l: "v*c", r: "c*v" }, // inversion constant with variable { l: "(n1^n2)^n3", r: "(n1^(n2*n3))" } // Power to Power ], W; } function I(C, _, z) { var O = C.type, W = arguments.length > 1; if (O === "OperatorNode" && C.isBinary()) { var X = !1, V; if (C.op === "^" && (C.args[0].type === "ParenthesisNode" || C.args[0].type === "OperatorNode") && C.args[1].type === "ConstantNode" && (V = parseFloat(C.args[1].value), X = V >= 2 && Oe(V)), X) { if (V > 2) { var R = C.args[0], Q = new E("^", "pow", [C.args[0].cloneDeep(), new x(V - 1)]); C = new E("*", "multiply", [R, Q]); } else C = new E("*", "multiply", [C.args[0], C.args[0].cloneDeep()]); W && (z === "content" ? _.content = C : _.args[z] = C); } } if (O === "ParenthesisNode") I(C.content, C, "content"); else if (O !== "ConstantNode" && O !== "SymbolNode") for (var se = 0; se < C.args.length; se++) I(C.args[se], C, se); if (!W) return C; } function B(C, _) { _ === void 0 && (_ = []), _[0] = 0; var z = {}; z.cte = 1, z.oper = "+", z.fire = ""; var O = 0, W = ""; Z(C, null, z), O = _.length - 1; for (var X = !0, V, R = O; R >= 0; R--) if (_[R] !== 0) { var Q = new x(X ? _[R] : Math.abs(_[R])), se = _[R] < 0 ? "-" : "+"; if (R > 0) { var re = new N(W); if (R > 1) { var q = new x(R); re = new E("^", "pow", [re, q]); } _[R] === -1 && X ? Q = new E("-", "unaryMinus", [re]) : Math.abs(_[R]) === 1 ? Q = re : Q = new E("*", "multiply", [Q, re]); } X ? V = Q : se === "+" ? V = new E("+", "add", [V, Q]) : V = new E("-", "subtract", [V, Q]), X = !1; } if (X) return new x(0); return V; function Z(K, j, ee) { var te = K.type; if (te === "FunctionNode") throw new Error("There is an unsolved function call"); if (te === "OperatorNode") { if (!"+-*^".includes(K.op)) throw new Error("Operator " + K.op + " invalid"); if (j !== null) { if ((K.fn === "unaryMinus" || K.fn === "pow") && j.fn !== "add" && j.fn !== "subtract" && j.fn !== "multiply") throw new Error("Invalid " + K.op + " placing"); if ((K.fn === "subtract" || K.fn === "add" || K.fn === "multiply") && j.fn !== "add" && j.fn !== "subtract") throw new Error("Invalid " + K.op + " placing"); if ((K.fn === "subtract" || K.fn === "add" || K.fn === "unaryMinus") && ee.noFil !== 0) throw new Error("Invalid " + K.op + " placing"); } (K.op === "^" || K.op === "*") && (ee.fire = K.op); for (var oe = 0; oe < K.args.length; oe++) K.fn === "unaryMinus" && (ee.oper = "-"), (K.op === "+" || K.fn === "subtract") && (ee.fire = "", ee.cte = 1, ee.oper = oe === 0 ? "+" : K.op), ee.noFil = oe, Z(K.args[oe], K, ee); } else if (te === "SymbolNode") { if (K.name !== W && W !== "") throw new Error("There is more than one variable"); if (W = K.name, j === null) { _[1] = 1; return; } if (j.op === "^" && ee.noFil !== 0) throw new Error("In power the variable should be the first parameter"); if (j.op === "*" && ee.noFil !== 1) throw new Error("In multiply the variable should be the second parameter"); (ee.fire === "" || ee.fire === "*") && (O < 1 && (_[1] = 0), _[1] += ee.cte * (ee.oper === "+" ? 1 : -1), O = Math.max(1, O)); } else if (te === "ConstantNode") { var ge = parseFloat(K.value); if (j === null) { _[0] = ge; return; } if (j.op === "^") { if (ee.noFil !== 1) throw new Error("Constant cannot be powered"); if (!Oe(ge) || ge <= 0) throw new Error("Non-integer exponent is not allowed"); for (var L = O + 1; L < ge; L++) _[L] = 0; ge > O && (_[ge] = 0), _[ge] += ee.cte * (ee.oper === "+" ? 1 : -1), O = Math.max(ge, O); return; } ee.cte = ge, ee.fire === "" && (_[0] += ee.cte * (ee.oper === "+" ? 1 : -1)); } else throw new Error("Type " + te + " is not allowed"); } } }), th = "zpk2tf", aq = ["typed", "add", "multiply", "Complex", "number"], iq = /* @__PURE__ */ P(th, aq, (e) => { var { typed: r, add: t, multiply: n, Complex: a, number: i } = e; return r(th, { "Array,Array,number": function(s, c, f) { return o(s, c, f); }, "Array,Array": function(s, c) { return o(s, c, 1); }, "Matrix,Matrix,number": function(s, c, f) { return o(s.valueOf(), c.valueOf(), f); }, "Matrix,Matrix": function(s, c) { return o(s.valueOf(), c.valueOf(), 1); } }); function o(u, s, c) { u.some((A) => A.type === "BigNumber") && (u = u.map((A) => i(A))), s.some((A) => A.type === "BigNumber") && (s = s.map((A) => i(A))); for (var f = [a(1, 0)], d = [a(1, 0)], p = 0; p < u.length; p++) { var m = u[p]; typeof m == "number" && (m = a(m, 0)), f = l(f, [a(1, 0), a(-m.re, -m.im)]); } for (var v = 0; v < s.length; v++) { var b = s[v]; typeof b == "number" && (b = a(b, 0)), d = l(d, [a(1, 0), a(-b.re, -b.im)]); } for (var y = 0; y < f.length; y++) f[y] = n(f[y], c); return [f, d]; } function l(u, s) { for (var c = [], f = 0; f < u.length + s.length - 1; f++) { c[f] = a(0, 0); for (var d = 0; d < u.length; d++) f - d >= 0 && f - d < s.length && (c[f] = t(c[f], n(u[d], s[f - d]))); } return c; } }), nh = "freqz", oq = ["typed", "add", "multiply", "Complex", "divide", "matrix"], sq = /* @__PURE__ */ P(nh, oq, (e) => { var { typed: r, add: t, multiply: n, Complex: a, divide: i, matrix: o } = e; return r(nh, { "Array, Array": function(c, f) { var d = u(512); return l(c, f, d); }, "Array, Array, Array": function(c, f, d) { return l(c, f, d); }, "Array, Array, number": function(c, f, d) { if (d < 0) throw new Error("w must be a positive number"); var p = u(d); return l(c, f, p); }, "Matrix, Matrix": function(c, f) { var d = u(512), { w: p, h: m } = l(c.valueOf(), f.valueOf(), d); return { w: o(p), h: o(m) }; }, "Matrix, Matrix, Matrix": function(c, f, d) { var { h: p } = l(c.valueOf(), f.valueOf(), d.valueOf()); return { h: o(p), w: o(d) }; }, "Matrix, Matrix, number": function(c, f, d) { if (d < 0) throw new Error("w must be a positive number"); var p = u(d), { h: m } = l(c.valueOf(), f.valueOf(), p); return { h: o(m), w: o(p) }; } }); function l(s, c, f) { for (var d = [], p = [], m = 0; m < f.length; m++) { for (var v = a(0, 0), b = a(0, 0), y = 0; y < s.length; y++) v = t(v, n(s[y], a(Math.cos(-y * f[m]), Math.sin(-y * f[m])))); for (var A = 0; A < c.length; A++) b = t(b, n(c[A], a(Math.cos(-A * f[m]), Math.sin(-A * f[m])))); d.push(v), p.push(b); } for (var h = [], x = 0; x < d.length; x++) h.push(i(d[x], p[x])); return { h, w: f }; } function u(s) { for (var c = [], f = 0; f < s; f++) c.push(f / s * Math.PI); return c; } }), uq = "reviver", lq = ["classes"], cq = /* @__PURE__ */ P(uq, lq, (e) => { var { classes: r } = e; return function(n, a) { var i = r[a && a.mathjs]; return i && typeof i.fromJSON == "function" ? i.fromJSON(a) : a; }; }), fq = "replacer", dq = [], pq = /* @__PURE__ */ P(fq, dq, () => function(r, t) { return typeof t == "number" && (!isFinite(t) || isNaN(t)) ? { mathjs: "number", value: String(t) } : typeof t == "bigint" ? { mathjs: "bigint", value: String(t) } : t; }), mq = "13.2.3", vq = /* @__PURE__ */ P("true", [], () => !0), hq = /* @__PURE__ */ P("false", [], () => !1), gq = /* @__PURE__ */ P("null", [], () => null), yq = /* @__PURE__ */ Nt("Infinity", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? new t(1 / 0) : 1 / 0; }), bq = /* @__PURE__ */ Nt("NaN", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? new t(NaN) : NaN; }), wq = /* @__PURE__ */ Nt("pi", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? Ql(t) : B_; }), xq = /* @__PURE__ */ Nt("tau", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? e5(t) : $_; }), Aq = /* @__PURE__ */ Nt("e", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? XB(t) : I_; }), Nq = /* @__PURE__ */ Nt("phi", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? QB(t) : R_; }), Dq = /* @__PURE__ */ Nt("LN2", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? new t(2).ln() : Math.LN2; }), Eq = /* @__PURE__ */ Nt("LN10", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? new t(10).ln() : Math.LN10; }), Sq = /* @__PURE__ */ Nt("LOG2E", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? new t(1).div(new t(2).ln()) : Math.LOG2E; }), Cq = /* @__PURE__ */ Nt("LOG10E", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? new t(1).div(new t(10).ln()) : Math.LOG10E; }), Mq = /* @__PURE__ */ Nt( // eslint-disable-line camelcase "SQRT1_2", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? new t("0.5").sqrt() : Math.SQRT1_2; } ), _q = /* @__PURE__ */ Nt("SQRT2", ["config", "?BigNumber"], (e) => { var { config: r, BigNumber: t } = e; return r.number === "BigNumber" ? new t(2).sqrt() : Math.SQRT2; }), Fq = /* @__PURE__ */ Nt("i", ["Complex"], (e) => { var { Complex: r } = e; return r.I; }), Tq = /* @__PURE__ */ P("PI", ["pi"], (e) => { var { pi: r } = e; return r; }), Oq = /* @__PURE__ */ P("E", ["e"], (e) => { var { e: r } = e; return r; }), Bq = /* @__PURE__ */ P("version", [], () => mq); function Nt(e, r, t) { return P(e, r, t, { recreateOnConfigChange: !0 }); } var $q = /* @__PURE__ */ Je("speedOfLight", "299792458", "m s^-1"), Iq = /* @__PURE__ */ Je("gravitationConstant", "6.67430e-11", "m^3 kg^-1 s^-2"), Rq = /* @__PURE__ */ Je("planckConstant", "6.62607015e-34", "J s"), Pq = /* @__PURE__ */ Je("reducedPlanckConstant", "1.0545718176461565e-34", "J s"), zq = /* @__PURE__ */ Je("magneticConstant", "1.25663706212e-6", "N A^-2"), qq = /* @__PURE__ */ Je("electricConstant", "8.8541878128e-12", "F m^-1"), Lq = /* @__PURE__ */ Je("vacuumImpedance", "376.730313667", "ohm"), Uq = /* @__PURE__ */ Je("coulomb", "8.987551792261171e9", "N m^2 C^-2"), kq = /* @__PURE__ */ Je("elementaryCharge", "1.602176634e-19", "C"), Vq = /* @__PURE__ */ Je("bohrMagneton", "9.2740100783e-24", "J T^-1"), Hq = /* @__PURE__ */ Je("conductanceQuantum", "7.748091729863649e-5", "S"), Zq = /* @__PURE__ */ Je("inverseConductanceQuantum", "12906.403729652257", "ohm"), Gq = /* @__PURE__ */ Je("magneticFluxQuantum", "2.0678338484619295e-15", "Wb"), Wq = /* @__PURE__ */ Je("nuclearMagneton", "5.0507837461e-27", "J T^-1"), Kq = /* @__PURE__ */ Je("klitzing", "25812.807459304513", "ohm"), Jq = /* @__PURE__ */ Je("bohrRadius", "5.29177210903e-11", "m"), Yq = /* @__PURE__ */ Je("classicalElectronRadius", "2.8179403262e-15", "m"), jq = /* @__PURE__ */ Je("electronMass", "9.1093837015e-31", "kg"), Xq = /* @__PURE__ */ Je("fermiCoupling", "1.1663787e-5", "GeV^-2"), Qq = zs("fineStructure", 0.0072973525693), eL = /* @__PURE__ */ Je("hartreeEnergy", "4.3597447222071e-18", "J"), rL = /* @__PURE__ */ Je("protonMass", "1.67262192369e-27", "kg"), tL = /* @__PURE__ */ Je("deuteronMass", "3.3435830926e-27", "kg"), nL = /* @__PURE__ */ Je("neutronMass", "1.6749271613e-27", "kg"), aL = /* @__PURE__ */ Je("quantumOfCirculation", "3.6369475516e-4", "m^2 s^-1"), iL = /* @__PURE__ */ Je("rydberg", "10973731.568160", "m^-1"), oL = /* @__PURE__ */ Je("thomsonCrossSection", "6.6524587321e-29", "m^2"), sL = zs("weakMixingAngle", 0.2229), uL = zs("efimovFactor", 22.7), lL = /* @__PURE__ */ Je("atomicMass", "1.66053906660e-27", "kg"), cL = /* @__PURE__ */ Je("avogadro", "6.02214076e23", "mol^-1"), fL = /* @__PURE__ */ Je("boltzmann", "1.380649e-23", "J K^-1"), dL = /* @__PURE__ */ Je("faraday", "96485.33212331001", "C mol^-1"), pL = /* @__PURE__ */ Je("firstRadiation", "3.7417718521927573e-16", "W m^2"), mL = /* @__PURE__ */ Je("loschmidt", "2.686780111798444e25", "m^-3"), vL = /* @__PURE__ */ Je("gasConstant", "8.31446261815324", "J K^-1 mol^-1"), hL = /* @__PURE__ */ Je("molarPlanckConstant", "3.990312712893431e-10", "J s mol^-1"), gL = /* @__PURE__ */ Je("molarVolume", "0.022413969545014137", "m^3 mol^-1"), yL = zs("sackurTetrode", -1.16487052358), bL = /* @__PURE__ */ Je("secondRadiation", "0.014387768775039337", "m K"), wL = /* @__PURE__ */ Je("stefanBoltzmann", "5.67037441918443e-8", "W m^-2 K^-4"), xL = /* @__PURE__ */ Je("wienDisplacement", "2.897771955e-3", "m K"), AL = /* @__PURE__ */ Je("molarMass", "0.99999999965e-3", "kg mol^-1"), NL = /* @__PURE__ */ Je("molarMassC12", "11.9999999958e-3", "kg mol^-1"), DL = /* @__PURE__ */ Je("gravity", "9.80665", "m s^-2"), EL = /* @__PURE__ */ Je("planckLength", "1.616255e-35", "m"), SL = /* @__PURE__ */ Je("planckMass", "2.176435e-8", "kg"), CL = /* @__PURE__ */ Je("planckTime", "5.391245e-44", "s"), ML = /* @__PURE__ */ Je("planckCharge", "1.87554603778e-18", "C"), _L = /* @__PURE__ */ Je("planckTemperature", "1.416785e+32", "K"); function Je(e, r, t) { var n = ["config", "Unit", "BigNumber"]; return P(e, n, (a) => { var { config: i, Unit: o, BigNumber: l } = a, u = i.number === "BigNumber" ? new l(r) : parseFloat(r), s = new o(u, t); return s.fixPrefix = !0, s; }); } function zs(e, r) { var t = ["config", "BigNumber"]; return P(e, t, (n) => { var { config: a, BigNumber: i } = n; return a.number === "BigNumber" ? new i(r) : r; }); } var FL = "apply", TL = ["typed", "isInteger"], OL = /* @__PURE__ */ P(FL, TL, (e) => { var { typed: r, isInteger: t } = e, n = Wl({ typed: r, isInteger: t }); return r("apply", { "...any": function(i) { var o = i[1]; We(o) ? i[1] = o - 1 : Ze(o) && (i[1] = o.minus(1)); try { return n.apply(null, i); } catch (l) { throw lt(l); } } }); }, { isTransformFunction: !0 }), BL = "column", $L = ["typed", "Index", "matrix", "range"], IL = /* @__PURE__ */ P(BL, $L, (e) => { var { typed: r, Index: t, matrix: n, range: a } = e, i = Cy({ typed: r, Index: t, matrix: n, range: a }); return r("column", { "...any": function(l) { var u = l.length - 1, s = l[u]; We(s) && (l[u] = s - 1); try { return i.apply(null, l); } catch (c) { throw lt(c); } } }); }, { isTransformFunction: !0 }); function uc(e, r, t) { var n = e.filter(function(u) { return $r(u) && !(u.name in r) && !t.has(u.name); })[0]; if (!n) throw new Error('No undefined variable found in inline expression "' + e + '"'); var a = n.name, i = /* @__PURE__ */ new Map(), o = new P0(t, i, /* @__PURE__ */ new Set([a])), l = e.compile(); return function(s) { return i.set(a, s), l.evaluate(o); }; } var RL = "transformCallback", PL = ["typed"], lc = /* @__PURE__ */ P(RL, PL, (e) => { var { typed: r } = e; return function(n, a) { return r.isTypedFunction(n) ? t(n, a) : ah(n, n.length, a); }; function t(n, a) { var i = Object.fromEntries(Object.entries(n.signatures).map((o) => { var [l, u] = o, s = l.split(",").length; return r.isTypedFunction(u) ? [l, t(u, a)] : [l, ah(u, s, a)]; })); return typeof n.name == "string" ? r(n.name, i) : r(i); } }); function ah(e, r, t) { return r === t ? e : r === t + 1 ? function() { for (var n = arguments.length, a = new Array(n), i = 0; i < n; i++) a[i] = arguments[i]; var o = a.slice(0, t), l = ih(a[t]); return e(...o, l); } : r > t + 1 ? function() { for (var n = arguments.length, a = new Array(n), i = 0; i < n; i++) a[i] = arguments[i]; var o = a.slice(0, t), l = ih(a[t]), u = a.slice(t + 1); return e(...o, l, ...u); } : e; } function ih(e) { return e.map((r) => r + 1); } var zL = "filter", qL = ["typed"], LL = /* @__PURE__ */ P(zL, qL, (e) => { var { typed: r } = e; function t(a, i, o) { var l = My({ typed: r }), u = lc({ typed: r }); if (a.length === 0) return l(); var s = a[0]; if (a.length === 1) return l(s); var c = a.length - 1, f = a[c]; return s && (s = n(s, o)), f && ($r(f) || li(f) ? f = n(f, o) : f = uc(f, i, o)), l(s, u(f, c)); } t.rawArgs = !0; function n(a, i) { return a.compile().evaluate(i); } return t; }, { isTransformFunction: !0 }), UL = "forEach", kL = ["typed"], VL = /* @__PURE__ */ P(UL, kL, (e) => { var { typed: r } = e, t = _y({ typed: r }), n = lc({ typed: r }); function a(o, l, u) { if (o.length === 0) return t(); var s = o[0]; if (o.length === 1) return t(s); var c = o.length - 1, f = o[c]; return s && (s = i(s, u)), f && ($r(f) || li(f) ? f = i(f, u) : f = uc(f, l, u)), t(s, n(f, c)); } a.rawArgs = !0; function i(o, l) { return o.compile().evaluate(l); } return a; }, { isTransformFunction: !0 }), HL = "index", ZL = ["Index", "getMatrixDataType"], GL = /* @__PURE__ */ P(HL, ZL, (e) => { var { Index: r, getMatrixDataType: t } = e; return function() { for (var a = [], i = 0, o = arguments.length; i < o; i++) { var l = arguments[i]; if (Ms(l)) l.start--, l.end -= l.step > 0 ? 0 : 2; else if (l && l.isSet === !0) l = l.map(function(s) { return s - 1; }); else if (cr(l) || ze(l)) t(l) !== "boolean" && (l = l.map(function(s) { return s - 1; })); else if (We(l)) l--; else if (Ze(l)) l = l.toNumber() - 1; else if (typeof l != "string") throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range"); a[i] = l; } var u = new r(); return r.apply(u, a), u; }; }, { isTransformFunction: !0 }), WL = "map", KL = ["typed"], JL = /* @__PURE__ */ P(WL, KL, (e) => { var { typed: r } = e, t = Fy({ typed: r }), n = lc({ typed: r }); function a(i, o, l) { if (i.length === 0) return t(); if (i.length === 1) return t(i[0]); var u = i.length - 1, s = i.slice(0, u), c = i[u]; return s = s.map((d) => f(d, l)), c && ($r(c) || li(c) ? c = f(c, l) : c = uc(c, o, l)), t(...s, n(c, u)); function f(d, p) { return d.compile().evaluate(p); } } return a.rawArgs = !0, a; }, { isTransformFunction: !0 }); function YL(e) { return We(e) ? e - 1 : Ze(e) ? e.minus(1) : e; } function jL(e) { return We(e) || Ze(e); } function ta(e) { if (e.length === 2 && At(e[0])) { e = e.slice(); var r = e[1]; jL(r) && (e[1] = YL(r)); } return e; } var XL = "max", QL = ["typed", "config", "numeric", "larger"], eU = /* @__PURE__ */ P(XL, QL, (e) => { var { typed: r, config: t, numeric: n, larger: a } = e, i = Ly({ typed: r, config: t, numeric: n, larger: a }); return r("max", { "...any": function(l) { l = ta(l); try { return i.apply(null, l); } catch (u) { throw lt(u); } } }); }, { isTransformFunction: !0 }), rU = "mean", tU = ["typed", "add", "divide"], nU = /* @__PURE__ */ P(rU, tU, (e) => { var { typed: r, add: t, divide: n } = e, a = Jy({ typed: r, add: t, divide: n }); return r("mean", { "...any": function(o) { o = ta(o); try { return a.apply(null, o); } catch (l) { throw lt(l); } } }); }, { isTransformFunction: !0 }), aU = "min", iU = ["typed", "config", "numeric", "smaller"], oU = /* @__PURE__ */ P(aU, iU, (e) => { var { typed: r, config: t, numeric: n, smaller: a } = e, i = Uy({ typed: r, config: t, numeric: n, smaller: a }); return r("min", { "...any": function(l) { l = ta(l); try { return i.apply(null, l); } catch (u) { throw lt(u); } } }); }, { isTransformFunction: !0 }), sU = "range", uU = ["typed", "config", "?matrix", "?bignumber", "smaller", "smallerEq", "larger", "largerEq", "add", "isPositive"], lU = /* @__PURE__ */ P(sU, uU, (e) => { var { typed: r, config: t, matrix: n, bignumber: a, smaller: i, smallerEq: o, larger: l, largerEq: u, add: s, isPositive: c } = e, f = $y({ typed: r, config: t, matrix: n, bignumber: a, smaller: i, smallerEq: o, larger: l, largerEq: u, add: s, isPositive: c }); return r("range", { "...any": function(p) { var m = p.length - 1, v = p[m]; return typeof v != "boolean" && p.push(!0), f.apply(null, p); } }); }, { isTransformFunction: !0 }), cU = "row", fU = ["typed", "Index", "matrix", "range"], dU = /* @__PURE__ */ P(cU, fU, (e) => { var { typed: r, Index: t, matrix: n, range: a } = e, i = Iy({ typed: r, Index: t, matrix: n, range: a }); return r("row", { "...any": function(l) { var u = l.length - 1, s = l[u]; We(s) && (l[u] = s - 1); try { return i.apply(null, l); } catch (c) { throw lt(c); } } }); }, { isTransformFunction: !0 }), pU = "subset", mU = ["typed", "matrix", "zeros", "add"], vU = /* @__PURE__ */ P(pU, mU, (e) => { var { typed: r, matrix: t, zeros: n, add: a } = e, i = Ry({ typed: r, matrix: t, zeros: n, add: a }); return r("subset", { "...any": function(l) { try { return i.apply(null, l); } catch (u) { throw lt(u); } } }); }, { isTransformFunction: !0 }), hU = "concat", gU = ["typed", "matrix", "isInteger"], yU = /* @__PURE__ */ P(hU, gU, (e) => { var { typed: r, matrix: t, isInteger: n } = e, a = Sy({ typed: r, matrix: t, isInteger: n }); return r("concat", { "...any": function(o) { var l = o.length - 1, u = o[l]; We(u) ? o[l] = u - 1 : Ze(u) && (o[l] = u.minus(1)); try { return a.apply(null, o); } catch (s) { throw lt(s); } } }); }, { isTransformFunction: !0 }), oh = "diff", bU = ["typed", "matrix", "subtract", "number", "bignumber"], wU = /* @__PURE__ */ P(oh, bU, (e) => { var { typed: r, matrix: t, subtract: n, number: a, bignumber: i } = e, o = Ty({ typed: r, matrix: t, subtract: n, number: a, bignumber: i }); return r(oh, { "...any": function(u) { u = ta(u); try { return o.apply(null, u); } catch (s) { throw lt(s); } } }); }, { isTransformFunction: !0 }), xU = "std", AU = ["typed", "map", "sqrt", "variance"], NU = /* @__PURE__ */ P(xU, AU, (e) => { var { typed: r, map: t, sqrt: n, variance: a } = e, i = Xy({ typed: r, map: t, sqrt: n, variance: a }); return r("std", { "...any": function(l) { l = ta(l); try { return i.apply(null, l); } catch (u) { throw lt(u); } } }); }, { isTransformFunction: !0 }), sh = "sum", DU = ["typed", "config", "add", "numeric"], EU = /* @__PURE__ */ P(sh, DU, (e) => { var { typed: r, config: t, add: n, numeric: a } = e, i = Wy({ typed: r, config: t, add: n, numeric: a }); return r(sh, { "...any": function(l) { l = ta(l); try { return i.apply(null, l); } catch (u) { throw lt(u); } } }); }, { isTransformFunction: !0 }), SU = "quantileSeq", CU = ["typed", "bignumber", "add", "subtract", "divide", "multiply", "partitionSelect", "compare", "isInteger", "smaller", "smallerEq", "larger"], MU = /* @__PURE__ */ P(SU, CU, (e) => { var { typed: r, bignumber: t, add: n, subtract: a, divide: i, multiply: o, partitionSelect: l, compare: u, isInteger: s, smaller: c, smallerEq: f, larger: d } = e, p = jy({ typed: r, bignumber: t, add: n, subtract: a, divide: i, multiply: o, partitionSelect: l, compare: u, isInteger: s, smaller: c, smallerEq: f, larger: d }); return r("quantileSeq", { "Array | Matrix, number | BigNumber": p, "Array | Matrix, number | BigNumber, number": (v, b, y) => p(v, b, m(y)), "Array | Matrix, number | BigNumber, boolean": p, "Array | Matrix, number | BigNumber, boolean, number": (v, b, y, A) => p(v, b, y, m(A)), "Array | Matrix, Array | Matrix": p, "Array | Matrix, Array | Matrix, number": (v, b, y) => p(v, b, m(y)), "Array | Matrix, Array | Matrix, boolean": p, "Array | Matrix, Array | Matrix, boolean, number": (v, b, y, A) => p(v, b, y, m(A)) }); function m(v) { return ta([[], v])[1]; } }, { isTransformFunction: !0 }), uh = "cumsum", _U = ["typed", "add", "unaryPlus"], FU = /* @__PURE__ */ P(uh, _U, (e) => { var { typed: r, add: t, unaryPlus: n } = e, a = Ky({ typed: r, add: t, unaryPlus: n }); return r(uh, { "...any": function(o) { if (o.length === 2 && At(o[0])) { var l = o[1]; We(l) ? o[1] = l - 1 : Ze(l) && (o[1] = l.minus(1)); } try { return a.apply(null, o); } catch (u) { throw lt(u); } } }); }, { isTransformFunction: !0 }), lh = "variance", TU = ["typed", "add", "subtract", "multiply", "divide", "apply", "isNaN"], OU = /* @__PURE__ */ P(lh, TU, (e) => { var { typed: r, add: t, subtract: n, multiply: a, divide: i, apply: o, isNaN: l } = e, u = Yy({ typed: r, add: t, subtract: n, multiply: a, divide: i, apply: o, isNaN: l }); return r(lh, { "...any": function(c) { c = ta(c); try { return u.apply(null, c); } catch (f) { throw lt(f); } } }); }, { isTransformFunction: !0 }), ch = "print", BU = ["typed", "matrix", "zeros", "add"], $U = /* @__PURE__ */ P(ch, BU, (e) => { var { typed: r, matrix: t, zeros: n, add: a } = e, i = zy({ typed: r, matrix: t, zeros: n, add: a }); return r(ch, { "string, Object | Array": function(u, s) { return i(o(u), s); }, "string, Object | Array, number | Object": function(u, s, c) { return i(o(u), s, c); } }); function o(l) { return l.replace(Py, (u) => { var s = u.slice(1).split("."), c = s.map(function(f) { return !isNaN(f) && f.length > 0 ? parseInt(f) - 1 : f; }); return "$" + c.join("."); }); } }, { isTransformFunction: !0 }), IU = "and", RU = ["typed", "matrix", "zeros", "add", "equalScalar", "not", "concat"], PU = /* @__PURE__ */ P(IU, RU, (e) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, not: i, concat: o } = e, l = qy({ typed: r, matrix: t, equalScalar: n, zeros: a, not: i, concat: o }); function u(s, c, f) { var d = s[0].compile().evaluate(f); if (!At(d) && !l(d, !0)) return !1; var p = s[1].compile().evaluate(f); return l(d, p); } return u.rawArgs = !0, u; }, { isTransformFunction: !0 }), zU = "or", qU = ["typed", "matrix", "equalScalar", "DenseMatrix", "concat"], LU = /* @__PURE__ */ P(zU, qU, (e) => { var { typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i } = e, o = Ey({ typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i }); function l(u, s, c) { var f = u[0].compile().evaluate(c); if (!At(f) && o(f, !1)) return !0; var d = u[1].compile().evaluate(c); return o(f, d); } return l.rawArgs = !0, l; }, { isTransformFunction: !0 }), UU = "bitAnd", kU = ["typed", "matrix", "zeros", "add", "equalScalar", "not", "concat"], VU = /* @__PURE__ */ P(UU, kU, (e) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, not: i, concat: o } = e, l = Ny({ typed: r, matrix: t, equalScalar: n, zeros: a, not: i, concat: o }); function u(s, c, f) { var d = s[0].compile().evaluate(f); if (!At(d)) { if (isNaN(d)) return NaN; if (d === 0 || d === !1) return 0; } var p = s[1].compile().evaluate(f); return l(d, p); } return u.rawArgs = !0, u; }, { isTransformFunction: !0 }), HU = "bitOr", ZU = ["typed", "matrix", "equalScalar", "DenseMatrix", "concat"], GU = /* @__PURE__ */ P(HU, ZU, (e) => { var { typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i } = e, o = Dy({ typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i }); function l(u, s, c) { var f = u[0].compile().evaluate(c); if (!At(f)) { if (isNaN(f)) return NaN; if (f === -1) return -1; if (f === !0) return 1; } var d = u[1].compile().evaluate(c); return o(f, d); } return l.rawArgs = !0, l; }, { isTransformFunction: !0 }); const WU = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, createAbs: k3, createAccessorNode: G8, createAcos: f5, createAcosh: p5, createAcot: v5, createAcoth: g5, createAcsc: b5, createAcsch: x5, createAdd: F8, createAddScalar: G3, createAnd: qy, createAndTransform: PU, createApply: Wl, createApplyTransform: OL, createArg: TT, createArrayNode: K8, createAsec: N5, createAsech: E5, createAsin: C5, createAsinh: F5, createAssignmentNode: X8, createAtan: B5, createAtan2: I5, createAtanh: P5, createAtomicMass: lL, createAvogadro: cL, createBellNumbers: Oz, createBigNumberClass: GM, createBigint: p3, createBignumber: w3, createBin: cO, createBitAnd: Ny, createBitAndTransform: VU, createBitNot: DT, createBitOr: Dy, createBitOrTransform: GU, createBitXor: _T, createBlockNode: e6, createBohrMagneton: Vq, createBohrRadius: Jq, createBoltzmann: fL, createBoolean: g3, createCatalan: $z, createCbrt: Y3, createCeil: iF, createChain: r7, createChainClass: D$, createClassicalElectronRadius: Yq, createClone: M_, createColumn: Cy, createColumnTransform: IL, createCombinations: H7, createCombinationsWithRep: G7, createCompare: nB, createCompareNatural: sB, createCompareText: cB, createCompile: B6, createComplex: N3, createComplexClass: jM, createComposition: Rz, createConcat: Sy, createConcatTransform: yU, createConditionalNode: t6, createConductanceQuantum: Hq, createConj: BT, createConstantNode: c6, createCorr: k7, createCos: q5, createCosh: U5, createCot: V5, createCoth: Z5, createCoulomb: Uq, createCount: GT, createCreateUnit: l5, createCross: KT, createCsc: W5, createCsch: J5, createCtranspose: R4, createCube: sF, createCumSum: Ky, createCumSumTransform: FU, createDeepEqual: _B, createDenseMatrixClass: S_, createDerivative: rq, createDet: n7, createDeuteronMass: tL, createDiag: YT, createDiff: Ty, createDiffTransform: wU, createDistance: C7, createDivide: E7, createDivideScalar: DO, createDot: R8, createDotDivide: zO, createDotMultiply: hT, createDotPow: RO, createE: Aq, createEfimovFactor: uL, createEigs: d7, createElectricConstant: qq, createElectronMass: jq, createElementaryCharge: kq, createEqual: dB, createEqualScalar: t3, createEqualText: vB, createErf: j4, createEvaluate: I6, createExp: lF, createExpm: m7, createExpm1: fF, createFactorial: X7, createFalse: hq, createFaraday: dL, createFermiCoupling: Xq, createFft: L4, createFibonacciHeapClass: WB, createFilter: My, createFilterTransform: LL, createFineStructure: Qq, createFirstRadiation: pL, createFix: mF, createFlatten: e4, createFloor: wy, createForEach: _y, createForEachTransform: VL, createFormat: uO, createFraction: S3, createFractionClass: i_, createFreqz: sq, createFunctionAssignmentNode: d6, createFunctionNode: _6, createGamma: K7, createGasConstant: vL, createGcd: zF, createGetMatrixDataType: a4, createGravitationConstant: Iq, createGravity: DL, createHartreeEnergy: eL, createHasNumericValue: Z_, createHelp: QP, createHelpClass: x$, createHex: mO, createHypot: O8, createI: Fq, createIdentity: o4, createIfft: k4, createIm: IT, createImmutableDenseMatrixClass: UB, createIndex: U8, createIndexClass: HB, createIndexNode: m6, createIndexTransform: GL, createInfinity: yq, createIntersect: F7, createInv: i7, createInverseConductanceQuantum: Zq, createInvmod: dT, createIsInteger: F_, createIsNaN: j_, createIsNegative: U_, createIsNumeric: V_, createIsPositive: W_, createIsPrime: bO, createIsZero: J_, createKldivergence: ez, createKlitzing: Kq, createKron: u4, createLN10: Eq, createLN2: Dq, createLOG10E: Cq, createLOG2E: Sq, createLarger: NB, createLargerEq: SB, createLcm: kF, createLeafCount: zz, createLeftShift: YO, createLgamma: Y7, createLog: FO, createLog10: HF, createLog1p: OO, createLog2: GF, createLoschmidt: mL, createLsolve: LO, createLsolveAll: HO, createLup: k6, createLusolve: h$, createLyap: A7, createMad: P7, createMagneticConstant: zq, createMagneticFluxQuantum: Gq, createMap: Fy, createMapTransform: JL, createMatrix: M3, createMatrixClass: f_, createMatrixFromColumns: $3, createMatrixFromFunction: F3, createMatrixFromRows: O3, createMax: Ly, createMaxTransform: eU, createMean: Jy, createMeanTransform: nU, createMedian: I7, createMin: Uy, createMinTransform: oU, createMod: xy, createMode: aO, createMolarMass: AL, createMolarMassC12: NL, createMolarPlanckConstant: hL, createMolarVolume: gL, createMultinomial: tz, createMultiply: jF, createMultiplyScalar: JF, createNaN: bq, createNeutronMass: nL, createNode: H8, createNorm: $8, createNot: qT, createNthRoot: QF, createNthRoots: $O, createNuclearMagneton: Wq, createNull: gq, createNumber: c3, createNumeric: AO, createObjectNode: h6, createOct: dO, createOnes: p4, createOperatorNode: y6, createOr: Ey, createOrTransform: LU, createParenthesisNode: w6, createParse: T6, createParser: L6, createParserClass: z6, createPartitionSelect: $B, createPermutations: az, createPhi: Nq, createPi: wq, createPickRandom: Dz, createPinv: s7, createPlanckCharge: ML, createPlanckConstant: Rq, createPlanckLength: EL, createPlanckMass: SL, createPlanckTemperature: _L, createPlanckTime: CL, createPolynomialRoot: y$, createPow: SO, createPrint: zy, createPrintTransform: $U, createProd: oO, createProtonMass: rL, createQr: H6, createQuantileSeq: jy, createQuantileSeqTransform: MU, createQuantumOfCirculation: aL, createRandom: Sz, createRandomInt: Mz, createRange: $y, createRangeClass: u_, createRangeNode: A6, createRangeTransform: lU, createRationalize: nq, createRe: PT, createReducedPlanckConstant: Pq, createRelationalNode: D6, createReplacer: pq, createReshape: h4, createResize: b4, createResolve: jz, createResultSet: YC, createReviver: cq, createRightArithShift: XO, createRightLogShift: eB, createRotate: x4, createRotationMatrix: N4, createRound: MO, createRow: Iy, createRowTransform: dU, createRydberg: iL, createSQRT1_2: Mq, createSQRT2: _q, createSackurTetrode: yL, createSchur: w7, createSec: j5, createSech: Q5, createSecondRadiation: bL, createSetCartesian: c8, createSetDifference: d8, createSetDistinct: m8, createSetIntersect: h8, createSetIsSubset: y8, createSetMultiplicity: w8, createSetPowerset: A8, createSetSize: D8, createSetSymDifference: S8, createSetUnion: M8, createSign: rT, createSimplify: Vz, createSimplifyConstant: Gz, createSimplifyCore: Kz, createSin: r8, createSinh: n8, createSize: S4, createSlu: m$, createSmaller: gB, createSmallerEq: wB, createSolveODE: K4, createSort: RB, createSpaClass: YB, createSparse: s5, createSparseMatrixClass: i3, createSpeedOfLight: $q, createSplitUnit: R3, createSqrt: aT, createSqrtm: h7, createSquare: oT, createSqueeze: M4, createStd: Xy, createStdTransform: NU, createStefanBoltzmann: wL, createStirlingS2: Fz, createString: v3, createSubset: Ry, createSubsetTransform: vU, createSubtract: uT, createSubtractScalar: K3, createSum: Wy, createSumTransform: EU, createSylvester: y7, createSymbolNode: C6, createSymbolicEqual: Qz, createTan: i8, createTanh: u8, createTau: xq, createThomsonCrossSection: oL, createTo: gO, createTrace: q8, createTranspose: $4, createTrue: vq, createTypeOf: Q_, createTyped: GC, createUnaryMinus: z3, createUnaryPlus: L3, createUnequal: TB, createUnitClass: n5, createUnitFunction: i5, createUppercaseE: Oq, createUppercasePi: Tq, createUsolve: kO, createUsolveAll: GO, createVacuumImpedance: Lq, createVariance: Yy, createVarianceTransform: OU, createVersion: Bq, createWeakMixingAngle: sL, createWienDisplacement: xL, createXgcd: cT, createXor: kT, createZeros: z4, createZeta: tO, createZpk2tf: iq }, Symbol.toStringTag, { value: "Module" })); var r1 = WU, cc = { exports: {} }; function fc() { } fc.prototype = { on: function(e, r, t) { var n = this.e || (this.e = {}); return (n[e] || (n[e] = [])).push({ fn: r, ctx: t }), this; }, once: function(e, r, t) { var n = this; function a() { n.off(e, a), r.apply(t, arguments); } return a._ = r, this.on(e, a, t); }, emit: function(e) { var r = [].slice.call(arguments, 1), t = ((this.e || (this.e = {}))[e] || []).slice(), n = 0, a = t.length; for (n; n < a; n++) t[n].fn.apply(t[n].ctx, r); return this; }, off: function(e, r) { var t = this.e || (this.e = {}), n = t[e], a = []; if (n && r) for (var i = 0, o = n.length; i < o; i++) n[i].fn !== r && n[i].fn._ !== r && a.push(n[i]); return a.length ? t[e] = a : delete t[e], this; } }; cc.exports = fc; cc.exports.TinyEmitter = fc; var KU = cc.exports; const JU = /* @__PURE__ */ Es(KU); function YU(e) { var r = new JU(); return e.on = r.on.bind(r), e.off = r.off.bind(r), e.once = r.once.bind(r), e.emit = r.emit.bind(r), e; } function jU(e, r, t, n) { function a(b, y) { var A = arguments.length; if (A !== 1 && A !== 2) throw new Fn("import", A, 1, 2); y || (y = {}); function h(D, E, N) { if (Array.isArray(E)) E.forEach((F) => h(D, F)); else if (typeof E == "object") for (var S in E) Fe(E, S) && h(D, E[S], S); else if (_i(E) || N !== void 0) { var M = _i(E) ? m(E) ? E.fn + ".transform" : E.fn : N; if (Fe(D, M) && D[M] !== E && !y.silent) throw new Error('Cannot import "' + M + '" twice'); D[M] = E; } else if (!y.silent) throw new TypeError("Factory, Object, or Array expected"); } var x = {}; h(x, b); for (var w in x) if (Fe(x, w)) { var g = x[w]; if (_i(g)) s(g, y); else if (c(g)) i(w, g, y); else if (!y.silent) throw new TypeError("Factory, Object, or Array expected"); } } function i(b, y, A) { if (A.wrap && typeof y == "function" && (y = u(y)), f(y) && (y = e(b, { [y.signature]: y })), e.isTypedFunction(t[b]) && e.isTypedFunction(y)) { A.override ? y = e(b, y.signatures) : y = e(t[b], y), t[b] = y, delete n[b], o(b, y), t.emit("import", b, function() { return y; }); return; } if (t[b] === void 0 || A.override) { t[b] = y, delete n[b], o(b, y), t.emit("import", b, function() { return y; }); return; } if (!A.silent) throw new Error('Cannot import "' + b + '": already exists'); } function o(b, y) { y && typeof y.transform == "function" ? (t.expression.transform[b] = y.transform, d(b) && (t.expression.mathWithTransform[b] = y.transform)) : (delete t.expression.transform[b], d(b) && (t.expression.mathWithTransform[b] = y)); } function l(b) { delete t.expression.transform[b], d(b) ? t.expression.mathWithTransform[b] = t[b] : delete t.expression.mathWithTransform[b]; } function u(b) { var y = function() { for (var h = [], x = 0, w = arguments.length; x < w; x++) { var g = arguments[x]; h[x] = g && g.valueOf(); } return b.apply(t, h); }; return b.transform && (y.transform = b.transform), y; } function s(b, y) { var A = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : b.fn; if (A.includes(".")) throw new Error("Factory name should not contain a nested path. Name: " + JSON.stringify(A)); var h = m(b) ? t.expression.transform : t, x = A in t.expression.transform, w = Fe(h, A) ? h[A] : void 0, g = function() { var E = {}; b.dependencies.map(tg).forEach((S) => { if (S.includes(".")) throw new Error("Factory dependency should not contain a nested path. Name: " + JSON.stringify(S)); S === "math" ? E.math = t : S === "mathWithTransform" ? E.mathWithTransform = t.expression.mathWithTransform : S === "classes" ? E.classes = t : E[S] = t[S]; }); var N = /* @__PURE__ */ b(E); if (N && typeof N.transform == "function") throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with export const path = "expression.transform"'); if (w === void 0 || y.override) return N; if (e.isTypedFunction(w) && e.isTypedFunction(N)) return e(w, N); if (y.silent) return w; throw new Error('Cannot import "' + A + '": already exists'); }; !b.meta || b.meta.lazy !== !1 ? ($o(h, A, g), w && x ? l(A) : (m(b) || p(b)) && $o(t.expression.mathWithTransform, A, () => h[A])) : (h[A] = g(), w && x ? l(A) : (m(b) || p(b)) && $o(t.expression.mathWithTransform, A, () => h[A])), n[A] = b, t.emit("import", A, g); } function c(b) { return typeof b == "function" || typeof b == "number" || typeof b == "string" || typeof b == "boolean" || b === null || ft(b) || Ut(b) || Ze(b) || Aa(b) || ze(b) || Array.isArray(b); } function f(b) { return typeof b == "function" && typeof b.signature == "string"; } function d(b) { return !Fe(v, b); } function p(b) { return !b.fn.includes(".") && // FIXME: make checking on path redundant, check on meta data instead !Fe(v, b.fn) && (!b.meta || !b.meta.isClass); } function m(b) { return b !== void 0 && b.meta !== void 0 && b.meta.isTransformFunction === !0 || !1; } var v = { expression: !0, type: !0, docs: !0, error: !0, json: !0, chain: !0 // chain method not supported. Note that there is a unit chain too. }; return a; } function dc(e, r) { var t = jr({}, R0, r); if (typeof Object.create != "function") throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility."); var n = YU({ // only here for backward compatibility for legacy factory functions isNumber: We, isComplex: Ut, isBigNumber: Ze, isBigInt: q0, isFraction: Aa, isUnit: ft, isString: Vr, isArray: cr, isMatrix: ze, isCollection: At, isDenseMatrix: Ri, isSparseMatrix: kn, isRange: Ms, isIndex: Gi, isBoolean: L0, isResultSet: U0, isHelp: Rl, isFunction: k0, isDate: V0, isRegExp: H0, isObject: ui, isMap: da, isPartitionedMap: wC, isObjectWrappingMap: xC, isNull: Z0, isUndefined: G0, isAccessorNode: Jn, isArrayNode: bt, isAssignmentNode: W0, isBlockNode: K0, isConditionalNode: J0, isConstantNode: nr, isFunctionAssignmentNode: li, isFunctionNode: En, isIndexNode: Na, isNode: fr, isObjectNode: Wi, isOperatorNode: _r, isParenthesisNode: rn, isRangeNode: Y0, isRelationalNode: j0, isSymbolNode: $r, isChain: Pl }); n.config = SC(t, n.emit), n.expression = { transform: {}, mathWithTransform: { config: n.config } }; var a = [], i = []; function o(c) { if (_i(c)) return c(n); var f = c[Object.keys(c)[0]]; if (_i(f)) return f(n); if (!DC(c)) throw console.warn("Factory object with properties `type`, `name`, and `factory` expected", c), new Error("Factory object with properties `type`, `name`, and `factory` expected"); var d = a.indexOf(c), p; return d === -1 ? (c.math === !0 ? p = c.factory(n.type, t, o, n.typed, n) : p = c.factory(n.type, t, o, n.typed), a.push(c), i.push(p)) : p = i[d], p; } var l = {}; function u() { for (var c = arguments.length, f = new Array(c), d = 0; d < c; d++) f[d] = arguments[d]; return n.typed.apply(n.typed, f); } u.isTypedFunction = Pi.isTypedFunction; var s = jU(u, o, n, l); return n.import = s, n.on("config", () => { Object.values(l).forEach((c) => { c && c.meta && c.meta.recreateOnConfigChange && s(c, { override: !0 }); }); }), n.create = dc.bind(null, e), n.factory = P, n.import(Object.values(NC(e))), n.ArgumentsError = Fn, n.DimensionError = Ye, n.IndexError = $t, n; } const XU = dc(r1, {}), t1 = "simcore/services/comp/opencor"; function tl(e, r) { let t = -1; const n = new XU.parser(); return e.simulationUiInfo.input.forEach((a) => { ++t, n.set(a.id, e.$refs.simInput[t].vModel); }), n.evaluate(r); } function n1(e) { e.$nextTick(() => { let r = -1; e.simulationUiInfo.input.forEach((t) => { ++r, e.$refs.simInput[r].visible = t.visible === void 0 ? !0 : tl(e, t.visible); }), e.libopencor !== void 0 && (e.userMessage = "Running the model...", e.showUserMessage = !0, e.$nextTick(() => { e.runSimulation(); })); }); } function fh(e) { if (!e.hasFinalisedUi && e.isMounted && e.hasValidSimulationUiInfo) { e.$refs.output.classList.add("x" + e.simulationUiInfo.output.plots.length); let r = -1; e.simulationUiInfo.output.plots.forEach(() => { e.simulationResults[++r] = [{ x: [], y: [], type: "scatter" }]; }), n1(e), e.hasFinalisedUi = !0; } } const a1 = (e, r) => { const t = e.__vccOpts || e; for (const [n, a] of r) t[n] = a; return t; }, QU = { name: "SimulationVuerInput", components: { ElInputNumber: Bl, ElOption: B0, ElSelect: O0, ElSlider: I0 }, props: { defaultValue: { required: !0, type: Number }, maximumValue: { type: Number }, minimumValue: { type: Number }, name: { required: !0, type: String }, possibleValues: { type: Array }, stepValue: { type: Number } }, data: function() { return { isDiscrete: this.possibleValues !== void 0, labelClasses: "default " + (this.possibleValues !== void 0 ? "discrete" : "scalar"), visible: !0, vModel: this.defaultValue }; }, methods: { updateUi: function() { n1(this.$parent); } } }, ek = { key: 1, class: "sliders-and-fields" }; function rk(e, r, t, n, a, i) { const o = B0, l = O0, u = I0, s = Bl; return at((he(), Ce("div", null, [ $e("p", { class: _e(e.labelClasses) }, qr(t.name), 3), e.isDiscrete ? (he(), He(l, { key: 0, class: "discrete", "popper-class": "discrete-popper", size: "small", modelValue: e.vModel, "onUpdate:modelValue": r[0] || (r[0] = (c) => e.vModel = c), teleported: !1, onChange: r[1] || (r[1] = (c) => i.updateUi()) }, { default: Ve(() => [ (he(!0), Ce(nt, null, Gn(t.possibleValues, (c) => (he(), He(o, { key: c.value, label: c.name, value: c.value }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["modelValue"])) : Be("", !0), e.isDiscrete ? Be("", !0) : (he(), Ce("div", ek, [ mr(u, { modelValue: e.vModel, "onUpdate:modelValue": r[2] || (r[2] = (c) => e.vModel = c), max: t.maximumValue, min: t.minimumValue, "show-input": !1, "show-tooltip": !1, step: t.stepValue, onInput: r[3] || (r[3] = (c) => i.updateUi()) }, null, 8, ["modelValue", "max", "min", "step"]), mr(s, { class: "scalar", size: "small", modelValue: e.vModel, "onUpdate:modelValue": r[4] || (r[4] = (c) => e.vModel = c), controls: !1, max: t.maximumValue, min: t.minimumValue, step: t.stepValue, "step-strictly": !0, onInput: r[5] || (r[5] = (c) => i.updateUi()) }, null, 8, ["modelValue", "max", "min", "step"]) ])) ], 512)), [ [Nn, e.visible] ]); } const i1 = /* @__PURE__ */ a1(QU, [["render", rk], ["__scopeId", "data-v-463a29a2"]]); var Fr = {}, nl = Fr.ValidationError = function(r, t, n, a, i, o) { if (Array.isArray(a) ? (this.path = a, this.property = a.reduce(function(u, s) { return u + o1(s); }, "instance")) : a !== void 0 && (this.property = a), r && (this.message = r), n) { var l = n.$id || n.id; this.schema = l || n; } t !== void 0 && (this.instance = t), this.name = i, this.argument = o, this.stack = this.toString(); }; nl.prototype.toString = function() { return this.property + " " + this.message; }; var qs = Fr.ValidatorResult = function(r, t, n, a) { this.instance = r, this.schema = t, this.options = n, this.path = a.path, this.propertyPath = a.propertyPath, this.errors = [], this.throwError = n && n.throwError, this.throwFirst = n && n.throwFirst, this.throwAll = n && n.throwAll, this.disableFormat = n && n.disableFormat === !0; }; qs.prototype.addError = function(r) { var t; if (typeof r == "string") t = new nl(r, this.instance, this.schema, this.path); else { if (!r) throw new Error("Missing error detail"); if (!r.message) throw new Error("Missing error message"); if (!r.name) throw new Error("Missing validator type"); t = new nl(r.message, this.instance, this.schema, this.path, r.name, r.argument); } if (this.errors.push(t), this.throwFirst) throw new ga(this); if (this.throwError) throw t; return t; }; qs.prototype.importErrors = function(r) { typeof r == "string" || r && r.validatorType ? this.addError(r) : r && r.errors && (this.errors = this.errors.concat(r.errors)); }; function tk(e, r) { return r + ": " + e.toString() + ` `; } qs.prototype.toString = function(r) { return this.errors.map(tk).join(""); }; Object.defineProperty(qs.prototype, "valid", { get: function() { return !this.errors.length; } }); Fr.ValidatorResultError = ga; function ga(e) { typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, ga), this.instance = e.instance, this.schema = e.schema, this.options = e.options, this.errors = e.errors; } ga.prototype = new Error(); ga.prototype.constructor = ga; ga.prototype.name = "Validation Error"; var dh = Fr.SchemaError = function e(r, t) { this.message = r, this.schema = t, Error.call(this, r), typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, e); }; dh.prototype = Object.create( Error.prototype, { constructor: { value: dh, enumerable: !1 }, name: { value: "SchemaError", enumerable: !1 } } ); var al = Fr.SchemaContext = function(r, t, n, a, i) { this.schema = r, this.options = t, Array.isArray(n) ? (this.path = n, this.propertyPath = n.reduce(function(o, l) { return o + o1(l); }, "instance")) : this.propertyPath = n, this.base = a, this.schemas = i; }; al.prototype.resolve = function(r) { return s1(this.base, r); }; al.prototype.makeChild = function(r, t) { var n = t === void 0 ? this.path : this.path.concat([t]), a = r.$id || r.id; let i = s1(this.base, a || ""); var o = new al(r, this.options, n, i, Object.create(this.schemas)); return a && !o.schemas[i] && (o.schemas[i] = r), o; }; var zt = Fr.FORMAT_REGEXPS = { // 7.3.1. Dates, Times, and Duration "date-time": /^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/, date: /^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/, time: /^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/, duration: /P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i, // 7.3.2. Email Addresses // TODO: fix the email production email: /^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/, "idn-email": /^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u, // 7.3.3. Hostnames // 7.3.4. IP Addresses "ip-address": /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/, // FIXME whitespace is invalid ipv6: /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/, // 7.3.5. Resource Identifiers // TODO: A more accurate regular expression for "uri" goes: // [A-Za-z][+\-.0-9A-Za-z]*:((/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?)?#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])|/?%[0-9A-Fa-f]{2}|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*(#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|/(/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?)? uri: /^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/, "uri-reference": /^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/, iri: /^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/, "iri-reference": /^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u, uuid: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i, // 7.3.6. uri-template "uri-template": /(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu, // 7.3.7. JSON Pointers "json-pointer": /^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu, "relative-json-pointer": /^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu, // hostname regex from: http://stackoverflow.com/a/1420225/5628 hostname: /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/, "host-name": /^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/, "utc-millisec": function(e) { return typeof e == "string" && parseFloat(e) === parseInt(e, 10) && !isNaN(e); }, // 7.3.8. regex regex: function(e) { var r = !0; try { new RegExp(e); } catch { r = !1; } return r; }, // Other definitions // "style" was removed from JSON Schema in draft-4 and is deprecated style: /[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/, // "color" was removed from JSON Schema in draft-4 and is deprecated color: /^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/, phone: /^\+(?:[0-9] ?){6,14}[0-9]$/, alpha: /^[a-zA-Z]+$/, alphanumeric: /^[a-zA-Z0-9]+$/ }; zt.regexp = zt.regex; zt.pattern = zt.regex; zt.ipv4 = zt["ip-address"]; Fr.isFormat = function(r, t, n) { if (typeof r == "string" && zt[t] !== void 0) { if (zt[t] instanceof RegExp) return zt[t].test(r); if (typeof zt[t] == "function") return zt[t](r); } else if (n && n.customFormats && typeof n.customFormats[t] == "function") return n.customFormats[t](r); return !0; }; var o1 = Fr.makeSuffix = function(r) { return r = r.toString(), !r.match(/[.\s\[\]]/) && !r.match(/^[\d]/) ? "." + r : r.match(/^\d+$/) ? "[" + r + "]" : "[" + JSON.stringify(r) + "]"; }; Fr.deepCompareStrict = function e(r, t) { if (typeof r != typeof t) return !1; if (Array.isArray(r)) return !Array.isArray(t) || r.length !== t.length ? !1 : r.every(function(i, o) { return e(r[o], t[o]); }); if (typeof r == "object") { if (!r || !t) return r === t; var n = Object.keys(r), a = Object.keys(t); return n.length !== a.length ? !1 : n.every(function(i) { return e(r[i], t[i]); }); } return r === t; }; function nk(e, r, t, n) { typeof t == "object" ? r[n] = pc(e[n], t) : e.indexOf(t) === -1 && r.push(t); } function ak(e, r, t) { r[t] = e[t]; } function ik(e, r, t, n) { typeof r[n] != "object" || !r[n] ? t[n] = r[n] : e[n] ? t[n] = pc(e[n], r[n]) : t[n] = r[n]; } function pc(e, r) { var t = Array.isArray(r), n = t && [] || {}; return t ? (e = e || [], n = n.concat(e), r.forEach(nk.bind(null, e, n))) : (e && typeof e == "object" && Object.keys(e).forEach(ak.bind(null, e, n)), Object.keys(r).forEach(ik.bind(null, e, r, n))), n; } Fr.deepMerge = pc; Fr.objectGetPath = function(r, t) { for (var n = t.split("/").slice(1), a; typeof (a = n.shift()) == "string"; ) { var i = decodeURIComponent(a.replace(/~0/, "~").replace(/~1/g, "/")); if (!(i in r)) return; r = r[i]; } return r; }; function ok(e) { return "/" + encodeURIComponent(e).replace(/~/g, "%7E"); } Fr.encodePath = function(r) { return r.map(ok).join(""); }; Fr.getDecimalPlaces = function(r) { var t = 0; if (isNaN(r)) return t; typeof r != "number" && (r = Number(r)); var n = r.toString().split("e"); if (n.length === 2) { if (n[1][0] !== "-") return t; t = Number(n[1].slice(1)); } var a = n[0].split("."); return a.length === 2 && (t += a[1].length), t; }; Fr.isSchema = function(r) { return typeof r == "object" && r || typeof r == "boolean"; }; var s1 = Fr.resolveUrl = function(r, t) { const n = new URL(t, new URL(r, "resolve://")); if (n.protocol === "resolve:") { const { pathname: a, search: i, hash: o } = n; return a + i + o; } return n.toString(); }, xt = Fr, ur = xt.ValidatorResult, na = xt.SchemaError, mc = {}; mc.ignoreProperties = { // informative properties id: !0, default: !0, description: !0, title: !0, // arguments to other properties additionalItems: !0, then: !0, else: !0, // special-handled properties $schema: !0, $ref: !0, extends: !0 }; var lr = mc.validators = {}; lr.type = function(r, t, n, a) { if (r === void 0) return null; var i = new ur(r, t, n, a), o = Array.isArray(t.type) ? t.type : [t.type]; if (!o.some(this.testType.bind(this, r, t, n, a))) { var l = o.map(function(u) { if (u) { var s = u.$id || u.id; return s ? "<" + s + ">" : u + ""; } }); i.addError({ name: "type", argument: l, message: "is not of a type(s) " + l }); } return i; }; function vc(e, r, t, n, a) { var i = r.throwError, o = r.throwAll; r.throwError = !1, r.throwAll = !1; var l = this.validateSchema(e, a, r, t); return r.throwError = i, r.throwAll = o, !l.valid && n instanceof Function && n(l), l.valid; } lr.anyOf = function(r, t, n, a) { if (r === void 0) return null; var i = new ur(r, t, n, a), o = new ur(r, t, n, a); if (!Array.isArray(t.anyOf)) throw new na("anyOf must be an array"); if (!t.anyOf.some( vc.bind( this, r, n, a, function(u) { o.importErrors(u); } ) )) { var l = t.anyOf.map(function(u, s) { var c = u.$id || u.id; return c ? "<" + c + ">" : u.title && JSON.stringify(u.title) || u.$ref && "<" + u.$ref + ">" || "[subschema " + s + "]"; }); n.nestedErrors && i.importErrors(o), i.addError({ name: "anyOf", argument: l, message: "is not any of " + l.join(",") }); } return i; }; lr.allOf = function(r, t, n, a) { if (r === void 0) return null; if (!Array.isArray(t.allOf)) throw new na("allOf must be an array"); var i = new ur(r, t, n, a), o = this; return t.allOf.forEach(function(l, u) { var s = o.validateSchema(r, l, n, a); if (!s.valid) { var c = l.$id || l.id, f = c || l.title && JSON.stringify(l.title) || l.$ref && "<" + l.$ref + ">" || "[subschema " + u + "]"; i.addError({ name: "allOf", argument: { id: f, length: s.errors.length, valid: s }, message: "does not match allOf schema " + f + " with " + s.errors.length + " error[s]:" }), i.importErrors(s); } }), i; }; lr.oneOf = function(r, t, n, a) { if (r === void 0) return null; if (!Array.isArray(t.oneOf)) throw new na("oneOf must be an array"); var i = new ur(r, t, n, a), o = new ur(r, t, n, a), l = t.oneOf.filter( vc.bind( this, r, n, a, function(s) { o.importErrors(s); } ) ).length, u = t.oneOf.map(function(s, c) { var f = s.$id || s.id; return f || s.title && JSON.stringify(s.title) || s.$ref && "<" + s.$ref + ">" || "[subschema " + c + "]"; }); return l !== 1 && (n.nestedErrors && i.importErrors(o), i.addError({ name: "oneOf", argument: u, message: "is not exactly one from " + u.join(",") })), i; }; lr.if = function(r, t, n, a) { if (r === void 0) return null; if (!xt.isSchema(t.if)) throw new Error('Expected "if" keyword to be a schema'); var i = vc.call(this, r, n, a, null, t.if), o = new ur(r, t, n, a), l; if (i) { if (t.then === void 0) return; if (!xt.isSchema(t.then)) throw new Error('Expected "then" keyword to be a schema'); l = this.validateSchema(r, t.then, n, a.makeChild(t.then)), o.importErrors(l); } else { if (t.else === void 0) return; if (!xt.isSchema(t.else)) throw new Error('Expected "else" keyword to be a schema'); l = this.validateSchema(r, t.else, n, a.makeChild(t.else)), o.importErrors(l); } return o; }; function hc(e, r) { if (Object.hasOwnProperty.call(e, r)) return e[r]; if (r in e) { for (; e = Object.getPrototypeOf(e); ) if (Object.propertyIsEnumerable.call(e, r)) return e[r]; } } lr.propertyNames = function(r, t, n, a) { if (this.types.object(r)) { var i = new ur(r, t, n, a), o = t.propertyNames !== void 0 ? t.propertyNames : {}; if (!xt.isSchema(o)) throw new na('Expected "propertyNames" to be a schema (object or boolean)'); for (var l in r) if (hc(r, l) !== void 0) { var u = this.validateSchema(l, o, n, a.makeChild(o)); i.importErrors(u); } return i; } }; lr.properties = function(r, t, n, a) { if (this.types.object(r)) { var i = new ur(r, t, n, a), o = t.properties || {}; for (var l in o) { var u = o[l]; if (u !== void 0) { if (u === null) throw new na('Unexpected null, expected schema in "properties"'); typeof n.preValidateProperty == "function" && n.preValidateProperty(r, l, u, n, a); var s = hc(r, l), c = this.validateSchema(s, u, n, a.makeChild(u, l)); c.instance !== i.instance[l] && (i.instance[l] = c.instance), i.importErrors(c); } } return i; } }; function u1(e, r, t, n, a, i) { if (this.types.object(e) && !(r.properties && r.properties[a] !== void 0)) if (r.additionalProperties === !1) i.addError({ name: "additionalProperties", argument: a, message: "is not allowed to have the additional property " + JSON.stringify(a) }); else { var o = r.additionalProperties || {}; typeof t.preValidateProperty == "function" && t.preValidateProperty(e, a, o, t, n); var l = this.validateSchema(e[a], o, t, n.makeChild(o, a)); l.instance !== i.instance[a] && (i.instance[a] = l.instance), i.importErrors(l); } } lr.patternProperties = function(r, t, n, a) { if (this.types.object(r)) { var i = new ur(r, t, n, a), o = t.patternProperties || {}; for (var l in r) { var u = !0; for (var s in o) { var c = o[s]; if (c !== void 0) { if (c === null) throw new na('Unexpected null, expected schema in "patternProperties"'); try { var f = new RegExp(s, "u"); } catch { f = new RegExp(s); } if (f.test(l)) { u = !1, typeof n.preValidateProperty == "function" && n.preValidateProperty(r, l, c, n, a); var d = this.validateSchema(r[l], c, n, a.makeChild(c, l)); d.instance !== i.instance[l] && (i.instance[l] = d.instance), i.importErrors(d); } } } u && u1.call(this, r, t, n, a, l, i); } return i; } }; lr.additionalProperties = function(r, t, n, a) { if (this.types.object(r)) { if (t.patternProperties) return null; var i = new ur(r, t, n, a); for (var o in r) u1.call(this, r, t, n, a, o, i); return i; } }; lr.minProperties = function(r, t, n, a) { if (this.types.object(r)) { var i = new ur(r, t, n, a), o = Object.keys(r); return o.length >= t.minProperties || i.addError({ name: "minProperties", argument: t.minProperties, message: "does not meet minimum property length of " + t.minProperties }), i; } }; lr.maxProperties = function(r, t, n, a) { if (this.types.object(r)) { var i = new ur(r, t, n, a), o = Object.keys(r); return o.length <= t.maxProperties || i.addError({ name: "maxProperties", argument: t.maxProperties, message: "does not meet maximum property length of " + t.maxProperties }), i; } }; lr.items = function(r, t, n, a) { var i = this; if (this.types.array(r) && t.items !== void 0) { var o = new ur(r, t, n, a); return r.every(function(l, u) { if (Array.isArray(t.items)) var s = t.items[u] === void 0 ? t.additionalItems : t.items[u]; else var s = t.items; if (s === void 0) return !0; if (s === !1) return o.addError({ name: "items", message: "additionalItems not permitted" }), !1; var c = i.validateSchema(l, s, n, a.makeChild(s, u)); return c.instance !== o.instance[u] && (o.instance[u] = c.instance), o.importErrors(c), !0; }), o; } }; lr.contains = function(r, t, n, a) { var i = this; if (this.types.array(r) && t.contains !== void 0) { if (!xt.isSchema(t.contains)) throw new Error('Expected "contains" keyword to be a schema'); var o = new ur(r, t, n, a), l = r.some(function(u, s) { var c = i.validateSchema(u, t.contains, n, a.makeChild(t.contains, s)); return c.errors.length === 0; }); return l === !1 && o.addError({ name: "contains", argument: t.contains, message: "must contain an item matching given schema" }), o; } }; lr.minimum = function(r, t, n, a) { if (this.types.number(r)) { var i = new ur(r, t, n, a); return t.exclusiveMinimum && t.exclusiveMinimum === !0 ? r > t.minimum || i.addError({ name: "minimum", argument: t.minimum, message: "must be greater than " + t.minimum }) : r >= t.minimum || i.addError({ name: "minimum", argument: t.minimum, message: "must be greater than or equal to " + t.minimum }), i; } }; lr.maximum = function(r, t, n, a) { if (this.types.number(r)) { var i = new ur(r, t, n, a); return t.exclusiveMaximum && t.exclusiveMaximum === !0 ? r < t.maximum || i.addError({ name: "maximum", argument: t.maximum, message: "must be less than " + t.maximum }) : r <= t.maximum || i.addError({ name: "maximum", argument: t.maximum, message: "must be less than or equal to " + t.maximum }), i; } }; lr.exclusiveMinimum = function(r, t, n, a) { if (typeof t.exclusiveMinimum != "boolean" && this.types.number(r)) { var i = new ur(r, t, n, a), o = r > t.exclusiveMinimum; return o || i.addError({ name: "exclusiveMinimum", argument: t.exclusiveMinimum, message: "must be strictly greater than " + t.exclusiveMinimum }), i; } }; lr.exclusiveMaximum = function(r, t, n, a) { if (typeof t.exclusiveMaximum != "boolean" && this.types.number(r)) { var i = new ur(r, t, n, a), o = r < t.exclusiveMaximum; return o || i.addError({ name: "exclusiveMaximum", argument: t.exclusiveMaximum, message: "must be strictly less than " + t.exclusiveMaximum }), i; } }; var l1 = function(r, t, n, a, i, o) { if (this.types.number(r)) { var l = t[i]; if (l == 0) throw new na(i + " cannot be zero"); var u = new ur(r, t, n, a), s = xt.getDecimalPlaces(r), c = xt.getDecimalPlaces(l), f = Math.max(s, c), d = Math.pow(10, f); return Math.round(r * d) % Math.round(l * d) !== 0 && u.addError({ name: i, argument: l, message: o + JSON.stringify(l) }), u; } }; lr.multipleOf = function(r, t, n, a) { return l1.call(this, r, t, n, a, "multipleOf", "is not a multiple of (divisible by) "); }; lr.divisibleBy = function(r, t, n, a) { return l1.call(this, r, t, n, a, "divisibleBy", "is not divisible by (multiple of) "); }; lr.required = function(r, t, n, a) { var i = new ur(r, t, n, a); return r === void 0 && t.required === !0 ? i.addError({ name: "required", message: "is required" }) : this.types.object(r) && Array.isArray(t.required) && t.required.forEach(function(o) { hc(r, o) === void 0 && i.addError({ name: "required", argument: o, message: "requires property " + JSON.stringify(o) }); }), i; }; lr.pattern = function(r, t, n, a) { if (this.types.string(r)) { var i = new ur(r, t, n, a), o = t.pattern; try { var l = new RegExp(o, "u"); } catch { l = new RegExp(o); } return r.match(l) || i.addError({ name: "pattern", argument: t.pattern, message: "does not match pattern " + JSON.stringify(t.pattern.toString()) }), i; } }; lr.format = function(r, t, n, a) { if (r !== void 0) { var i = new ur(r, t, n, a); return !i.disableFormat && !xt.isFormat(r, t.format, this) && i.addError({ name: "format", argument: t.format, message: "does not conform to the " + JSON.stringify(t.format) + " format" }), i; } }; lr.minLength = function(r, t, n, a) { if (this.types.string(r)) { var i = new ur(r, t, n, a), o = r.match(/[\uDC00-\uDFFF]/g), l = r.length - (o ? o.length : 0); return l >= t.minLength || i.addError({ name: "minLength", argument: t.minLength, message: "does not meet minimum length of " + t.minLength }), i; } }; lr.maxLength = function(r, t, n, a) { if (this.types.string(r)) { var i = new ur(r, t, n, a), o = r.match(/[\uDC00-\uDFFF]/g), l = r.length - (o ? o.length : 0); return l <= t.maxLength || i.addError({ name: "maxLength", argument: t.maxLength, message: "does not meet maximum length of " + t.maxLength }), i; } }; lr.minItems = function(r, t, n, a) { if (this.types.array(r)) { var i = new ur(r, t, n, a); return r.length >= t.minItems || i.addError({ name: "minItems", argument: t.minItems, message: "does not meet minimum length of " + t.minItems }), i; } }; lr.maxItems = function(r, t, n, a) { if (this.types.array(r)) { var i = new ur(r, t, n, a); return r.length <= t.maxItems || i.addError({ name: "maxItems", argument: t.maxItems, message: "does not meet maximum length of " + t.maxItems }), i; } }; function sk(e, r, t) { var n, a = t.length; for (n = r + 1, a; n < a; n++) if (xt.deepCompareStrict(e, t[n])) return !1; return !0; } lr.uniqueItems = function(r, t, n, a) { if (t.uniqueItems === !0 && this.types.array(r)) { var i = new ur(r, t, n, a); return r.every(sk) || i.addError({ name: "uniqueItems", message: "contains duplicate item" }), i; } }; lr.dependencies = function(r, t, n, a) { if (this.types.object(r)) { var i = new ur(r, t, n, a); for (var o in t.dependencies) if (r[o] !== void 0) { var l = t.dependencies[o], u = a.makeChild(l, o); if (typeof l == "string" && (l = [l]), Array.isArray(l)) l.forEach(function(c) { r[c] === void 0 && i.addError({ // FIXME there's two different "dependencies" errors here with slightly different outputs // Can we make these the same? Or should we create different error types? name: "dependencies", argument: u.propertyPath, message: "property " + c + " not found, required by " + u.propertyPath }); }); else { var s = this.validateSchema(r, l, n, u); i.instance !== s.instance && (i.instance = s.instance), s && s.errors.length && (i.addError({ name: "dependencies", argument: u.propertyPath, message: "does not meet dependency required by " + u.propertyPath }), i.importErrors(s)); } } return i; } }; lr.enum = function(r, t, n, a) { if (r === void 0) return null; if (!Array.isArray(t.enum)) throw new na("enum expects an array", t); var i = new ur(r, t, n, a); return t.enum.some(xt.deepCompareStrict.bind(null, r)) || i.addError({ name: "enum", argument: t.enum, message: "is not one of enum values: " + t.enum.map(String).join(",") }), i; }; lr.const = function(r, t, n, a) { if (r === void 0) return null; var i = new ur(r, t, n, a); return xt.deepCompareStrict(t.const, r) || i.addError({ name: "const", argument: t.const, message: "does not exactly match expected constant: " + t.const }), i; }; lr.not = lr.disallow = function(r, t, n, a) { var i = this; if (r === void 0) return null; var o = new ur(r, t, n, a), l = t.not || t.disallow; return l ? (Array.isArray(l) || (l = [l]), l.forEach(function(u) { if (i.testType(r, t, n, a, u)) { var s = u && (u.$id || u.id), c = s || u; o.addError({ name: "not", argument: c, message: "is of prohibited type " + c }); } }), o) : null; }; var uk = mc, gc = {}, yu = Fr; gc.SchemaScanResult = c1; function c1(e, r) { this.id = e, this.ref = r; } gc.scan = function(r, t) { function n(u, s) { if (!s || typeof s != "object") return; if (s.$ref) { let p = yu.resolveUrl(u, s.$ref); l[p] = l[p] ? l[p] + 1 : 0; return; } var c = s.$id || s.id; let f = yu.resolveUrl(u, c); var d = c ? f : u; if (d) { if (d.indexOf("#") < 0 && (d += "#"), o[d]) { if (!yu.deepCompareStrict(o[d], s)) throw new Error("Schema <" + d + "> already exists with different definition"); return o[d]; } o[d] = s, d[d.length - 1] == "#" && (o[d.substring(0, d.length - 1)] = s); } a(d + "/items", Array.isArray(s.items) ? s.items : [s.items]), a(d + "/extends", Array.isArray(s.extends) ? s.extends : [s.extends]), n(d + "/additionalItems", s.additionalItems), i(d + "/properties", s.properties), n(d + "/additionalProperties", s.additionalProperties), i(d + "/definitions", s.definitions), i(d + "/patternProperties", s.patternProperties), i(d + "/dependencies", s.dependencies), a(d + "/disallow", s.disallow), a(d + "/allOf", s.allOf), a(d + "/anyOf", s.anyOf), a(d + "/oneOf", s.oneOf), n(d + "/not", s.not); } function a(u, s) { if (Array.isArray(s)) for (var c = 0; c < s.length; c++) n(u + "/" + c, s[c]); } function i(u, s) { if (!(!s || typeof s != "object")) for (var c in s) n(u + "/" + c, s[c]); } var o = {}, l = {}; return n(r, t), new c1(o, l); }; var f1 = uk, aa = Fr, d1 = gc.scan, p1 = aa.ValidatorResult, lk = aa.ValidatorResultError, Ui = aa.SchemaError, m1 = aa.SchemaContext, ck = "/", Ur = function e() { this.customFormats = Object.create(e.prototype.customFormats), this.schemas = {}, this.unresolvedRefs = [], this.types = Object.create(sn), this.attributes = Object.create(f1.validators); }; Ur.prototype.customFormats = {}; Ur.prototype.schemas = null; Ur.prototype.types = null; Ur.prototype.attributes = null; Ur.prototype.unresolvedRefs = null; Ur.prototype.addSchema = function(r, t) { var n = this; if (!r) return null; var a = d1(t || ck, r), i = t || r.$id || r.id; for (var o in a.id) this.schemas[o] = a.id[o]; for (var o in a.ref) this.unresolvedRefs.push(o); return this.unresolvedRefs = this.unresolvedRefs.filter(function(l) { return typeof n.schemas[l] > "u"; }), this.schemas[i]; }; Ur.prototype.addSubSchemaArray = function(r, t) { if (Array.isArray(t)) for (var n = 0; n < t.length; n++) this.addSubSchema(r, t[n]); }; Ur.prototype.addSubSchemaObject = function(r, t) { if (!(!t || typeof t != "object")) for (var n in t) this.addSubSchema(r, t[n]); }; Ur.prototype.setSchemas = function(r) { this.schemas = r; }; Ur.prototype.getSchema = function(r) { return this.schemas[r]; }; Ur.prototype.validate = function(r, t, n, a) { if (typeof t != "boolean" && typeof t != "object" || t === null) throw new Ui("Expected `schema` to be an object or boolean"); n || (n = {}); var i = t.$id || t.id; let o = aa.resolveUrl(n.base, i || ""); if (!a) { a = new m1(t, n, [], o, Object.create(this.schemas)), a.schemas[o] || (a.schemas[o] = t); var l = d1(o, t); for (var u in l.id) { var s = l.id[u]; a.schemas[u] = s; } } if (n.required && r === void 0) { var c = new p1(r, t, n, a); return c.addError("is required, but is undefined"), c; } var c = this.validateSchema(r, t, n, a); if (c) { if (n.throwAll && c.errors.length) throw new lk(c); } else throw new Error("Result undefined"); return c; }; function v1(e) { var r = typeof e == "string" ? e : e.$ref; return typeof r == "string" ? r : !1; } Ur.prototype.validateSchema = function(r, t, n, a) { var i = new p1(r, t, n, a); if (typeof t == "boolean") t === !0 ? t = {} : t === !1 && (t = { type: [] }); else if (!t) throw new Error("schema is undefined"); if (t.extends) if (Array.isArray(t.extends)) { var o = { schema: t, ctx: a }; t.extends.forEach(this.schemaTraverser.bind(this, o)), t = o.schema, o.schema = null, o.ctx = null, o = null; } else t = aa.deepMerge(t, this.superResolve(t.extends, a)); var l = v1(t); if (l) { var u = this.resolve(t, l, a), s = new m1(u.subschema, n, a.path, u.switchSchema, a.schemas); return this.validateSchema(r, u.subschema, n, s); } var c = n && n.skipAttributes || []; for (var f in t) if (!f1.ignoreProperties[f] && c.indexOf(f) < 0) { var d = null, p = this.attributes[f]; if (p) d = p.call(this, r, t, n, a); else if (n.allowUnknownAttributes === !1) throw new Ui("Unsupported attribute: " + f, t); d && i.importErrors(d); } if (typeof n.rewrite == "function") { var m = n.rewrite.call(this, r, t, n, a); i.instance = m; } return i; }; Ur.prototype.schemaTraverser = function(r, t) { r.schema = aa.deepMerge(r.schema, this.superResolve(t, r.ctx)); }; Ur.prototype.superResolve = function(r, t) { var n = v1(r); return n ? this.resolve(r, n, t).subschema : r; }; Ur.prototype.resolve = function(r, t, n) { if (t = n.resolve(t), n.schemas[t]) return { subschema: n.schemas[t], switchSchema: t }; let i = new URL(t, "thismessage::/").hash; var o = i && i.length && t.substr(0, t.length - i.length); if (!o || !n.schemas[o]) throw new Ui("no such schema <" + t + ">", r); var l = aa.objectGetPath(n.schemas[o], i.substr(1)); if (l === void 0) throw new Ui("no such schema " + i + " located in <" + o + ">", r); return { subschema: l, switchSchema: t }; }; Ur.prototype.testType = function(r, t, n, a, i) { if (i !== void 0) { if (i === null) throw new Ui('Unexpected null in "type" keyword'); if (typeof this.types[i] == "function") return this.types[i].call(this, r); if (i && typeof i == "object") { var o = this.validateSchema(r, i, n, a); return o === void 0 || !(o && o.errors.length); } return !0; } }; var sn = Ur.prototype.types = {}; sn.string = function(r) { return typeof r == "string"; }; sn.number = function(r) { return typeof r == "number" && isFinite(r); }; sn.integer = function(r) { return typeof r == "number" && r % 1 === 0; }; sn.boolean = function(r) { return typeof r == "boolean"; }; sn.array = function(r) { return Array.isArray(r); }; sn.null = function(r) { return r === null; }; sn.date = function(r) { return r instanceof Date; }; sn.any = function(r) { return !0; }; sn.object = function(r) { return r && typeof r == "object" && !Array.isArray(r) && !(r instanceof Date); }; var fk = Ur, h1; h1 = fk; Fr.ValidatorResult; Fr.ValidatorResultError; Fr.ValidationError; Fr.SchemaError; function dk(e, r) { const t = new h1(), n = { additionalProperties: !1, properties: { input: { items: { oneOf: [ { additionalProperties: !1, properties: { defaultValue: { required: !0, type: "number" }, id: { type: "string" }, name: { required: !0, type: "string" }, possibleValues: { items: { additionalProperties: !1, properties: { name: { required: !0, type: "string" }, value: { required: !0, type: "number" } }, type: "object" }, minItems: 1, required: !0, type: "array" }, visible: { type: "string" } } }, { additionalProperties: !1, properties: { defaultValue: { required: !0, type: "number" }, id: { type: "string" }, maximumValue: { required: !0, type: "number" }, minimumValue: { required: !0, type: "number" }, name: { required: !0, type: "string" }, stepValue: { type: "number" }, visible: { type: "string" } } } ], type: "object" }, minItems: 1, required: !0, type: "array" }, output: { additionalProperties: !1, minItems: 1, properties: { data: { items: { additionalProperties: !1, properties: { id: { required: !0, type: "string" }, name: { required: !0, type: "string" } }, type: "object" }, minItems: 1, required: !0, type: "array" }, plots: { items: { additionalProperties: !1, properties: { xAxisTitle: { required: !0, type: "string" }, xValue: { required: !0, type: "string" }, yAxisTitle: { required: !0, type: "string" }, yValue: { required: !0, type: "string" } }, type: "object" }, maxItems: 9, minItems: 1, required: !0, type: "array" } }, required: !0, type: "object" }, parameters: { items: { additionalProperties: !1, properties: { name: { required: !0, type: "string" }, value: { required: !0, type: "string" } }, type: "object" }, type: "array" }, simulation: { additionalProperties: !1, properties: { opencor: { additionalProperties: !1, properties: { endingPoint: { type: "number" }, pointInterval: { type: "number" }, resource: { required: !0, type: "string" } }, type: "object" }, solvers: { items: { additionalProperties: !1, properties: { if: { type: "string" }, input: { additionalProperties: !1, properties: { name: { required: !0, type: "string" }, value: { required: !0, type: "string" } }, type: "object" }, name: { required: !0, type: "string" }, version: { required: !0, type: "string" } }, type: "object" }, minItems: 1, required: !0, type: "array" } }, required: r, type: "object" } }, type: "object" }, a = t.validate(e, n, { nestedErrors: !0 }); if (!a.valid) return console.warn(a.toString()), !1; const i = {}; if (!e.input.every((c) => { if (c.id !== void 0) { if (c.id === "") return console.warn("JSON: the input id must not be empty."), !1; if (i[c.id] !== void 0) return console.warn("JSON: the input id must be unique (" + c.id + " is used more than once)."), !1; i[c.id] = !0; } if (c.name === "") return console.warn("JSON: the input name must not be empty."), !1; if (c.possibleValues !== void 0) { if (!c.possibleValues.every((p) => p.name === "" ? (console.warn("JSON: an input possible value must not be empty."), !1) : !0)) return !1; const f = c.possibleValues.map((p) => p.value), d = {}; if (!f.every((p) => d[p] !== void 0 ? (console.warn("JSON: an input possible value must have a unique value (" + p + " is used more than once)."), !1) : (d[p] = !0, !0))) return !1; if (!f.includes(c.defaultValue)) return console.warn("JSON: the input default value (" + c.defaultValue + ") must be one of the possible values (" + f.join(", ") + ")."), !1; } if (c.minimumValue !== void 0 && c.maximumValue !== void 0) { if (c.minimumValue >= c.maximumValue) return console.warn("JSON: the input minimum value (" + c.minimumValue + ") must be lower than the maximum value (" + c.maximumValue + ")."), !1; if (c.defaultValue < c.minimumValue || c.defaultValue > c.maximumValue) return console.warn("JSON: the input default value (" + c.defaultValue + ") must be greater or equal than the minimum value (" + c.minimumValue + ") and lower or equal than the maximum value (" + c.maximumValue + ")."), !1; const f = c.maximumValue - c.minimumValue; if (c.stepValue !== void 0) { if (c.stepValue <= 0 || c.stepValue > f) return console.warn("JSON: the input step value (" + c.stepValue + ") must be greater than zero and lower or equal than the range value (" + f + ")."), !1; if (!Number.isInteger(f / c.stepValue)) return console.warn("JSON: the input step value (" + c.stepValue + ") must be a factor of the range value (" + f + ")."), !1; } else if (!Number.isInteger(f)) return console.warn("JSON: the (default) input step value (1) must be a factor of the range value (" + f + ")."), !1; } return c.visible !== void 0 && c.visible === "" ? (console.warn("JSON: the input visible must not be empty."), !1) : !0; })) return !1; const l = {}; if (!e.output.data.every((c) => { if (c.id !== void 0) { if (c.id === "") return console.warn("JSON: the output data id must not be empty."), !1; if (l[c.id] !== void 0) return console.warn("JSON: the output data id must be unique (" + c.id + " is used more than once)."), !1; l[c.id] = !0; } return c.name === "" ? (console.warn("JSON: the output data name must not be empty."), !1) : !0; }) || !e.output.plots.every((c) => c.xAxisTitle === "" ? (console.warn("JSON: the output plot X axis title must not be empty."), !1) : c.xValue === "" ? (console.warn("JSON: the output plot X value must not be empty."), !1) : c.yAxisTitle === "" ? (console.warn("JSON: the output plot Y axis title must not be empty."), !1) : c.yValue === "" ? (console.warn("JSON: the output plot Y value must not be empty."), !1) : !0) || e.parameters !== void 0 && !e.parameters.every((f) => f.name === "" ? (console.warn("JSON: the parameter name must not be empty."), !1) : f.value === "" ? (console.warn("JSON: the parameter value must not be empty."), !1) : !0)) return !1; if (r) { let c = !1; if (!e.simulation.solvers.every((f) => { if (f.if !== void 0 && f.if === "") return console.warn("JSON: a simulation solver if must not be empty."), !1; if (f.input !== void 0) { if (f.input.name === "") return console.warn("JSON: a simulation solver input name must not be empty."), !1; if (f.input.value === "") return console.warn("JSON: a simulation solver input value must not be empty."), !1; } return f.name === "" ? (console.warn("JSON: a simulation solver name must not be empty."), !1) : (c = c || f.name === t1, f.version === "" ? (console.warn("JSON: a simulation solver version must not be empty."), !1) : !0); })) return !1; if (c && e.simulation.opencor === void 0) return console.warn("JSON: the simulation solver for OpenCOR is specified so simulation OpenCOR settings must also be specified."), !1; if (e.simulation.opencor !== void 0) { if (e.simulation.opencor.resource === "") return console.warn("JSON: the simulation OpenCOR resource must not be empty."), !1; if (e.simulation.opencor.endingPoint !== void 0) if (e.simulation.opencor.pointInterval !== void 0) { if (e.simulation.opencor.endingPoint <= 0) return console.warn("JSON: the simulation OpenCOR ending point (" + e.simulation.opencor.endingPoint + ") must be greater than zero."), !1; if (e.simulation.opencor.pointInterval <= 0) return console.warn("JSON: the simulation OpenCOR point interval (" + e.simulation.opencor.pointInterval + ") must be greater than zero."), !1; } else return console.warn("JSON: a simulation OpenCOR ending point is specified so a simulation OpenCOR point interval must also be specified."), !1; else if (e.simulation.opencor.pointInterval !== void 0) return console.warn("JSON: a simulation OpenCOR point interval is specified so a simulation OpenCOR ending point must also be specified."), !1; } } return !0; } const pk = "libOpenCOR", mk = "oSPARC", bu = "https://models.physiomeproject.org/", vk = dc(r1, {}), Bn = Object.freeze({ DATASET_ID: "dataset_id", DATASET_URL: "dataset_url", PMR_PATH: "pmr_path", RAW_COMBINE_ARCHIVE: "raw_combine_archive" }), hk = { LIBOPENCOR_SOLVER: pk, OSPARC_SOLVER: mk, name: "SimulationVuer", components: { PlotVuer: L1, SimulationVuerInput: i1, ElButton: M0, ElDivider: _0, ElLoading: mC }, props: { /** * The URL of a running copy of the [SPARC API](https://github.com/nih-sparc/sparc-api). */ apiLocation: { required: !0, type: String }, /** * Either:
*
  • the id of a SPARC simulation-based dataset (as a `Number`, e.g., `135`);
  • *
  • the [PMR](https://models.physiomeproject.org/) path to an [OMEX](https://combinearchive.org/) file (as a `String`, e.g., `workspace/b7c/rawfile/e0ae8d2d56aaaa091e23e1ee7e84cacbda1dfb6b/135.omex`);
  • *
  • the direct URL to an OMEX file (as a `String`, e.g., `https://raw.githubusercontent.com/opencor/webapp/refs/heads/main/tests/models/ui/135.omex`); or
  • *
  • a raw OMEX file (as a `Uint8Array`).
  • */ id: { required: !0, type: [Number, String, Uint8Array] } }, data: function() { let e; if (typeof this.id == "number" ? e = Bn.DATASET_ID : this.id instanceof Uint8Array ? e = Bn.RAW_COMBINE_ARCHIVE : this.id.startsWith("https://") ? e = Bn.DATASET_URL : e = Bn.PMR_PATH, e === Bn.DATASET_ID) { const r = new XMLHttpRequest(); r.open("GET", this.apiLocation + "/sim/dataset/" + this.id), r.onreadystatechange = () => { if (r.readyState === 4 && r.status === 200) { const t = JSON.parse(r.responseText); this.name = t.name, this.uuid = t.study !== void 0 ? t.study.uuid : void 0; } }, r.send(); } return { errorMessage: "", fileManager: void 0, hasFinalisedUi: !1, hasValidSimulationUiInfo: !1, idType: e, instance: void 0, isMounted: !1, isSimulationValid: !0, layout: [], libopencor: void 0, libopencorSet: !1, model: void 0, name: null, opencorBasedSimulation: !0, output: void 0, perfectScollbarOptions: { suppressScrollX: !0 }, showUserMessage: !1, simulationResults: {}, simulationResultsId: {}, simulationUiInfo: {}, solver: void 0, userMessage: "", ui: null, uuid: null }; }, methods: { /** * @public * Generate the metadata associated with the plot which `index` is given. * @arg `index` */ plotMetadata(e) { return { version: "1.1.0", type: "plot", attrs: { style: "timeseries", layout: this.layout[e] } }; }, /** * @public * Manage the file associated with the given `url` and `fileContents`. * @arg `url` * @arg `fileContents` */ manageFile(e, r) { let t = this.fileManager.file(e); t === null && (t = new this.libopencor.File(e)); const n = this.libopencor._malloc(r.length); return new Uint8Array(this.libopencor.HEAPU8.buffer, n, r.length).set(r), t.setContents(n, r.length), this.libopencor._free(n), t; }, /** * @public * Run a PMR-based COMBINE archive using libOpenCOR. */ runSimulation() { if (this.instance === void 0) { const a = new this.libopencor.SedDocument(this.fileManager.file(bu + this.id)); this.model = ro(a.model()), this.instance = ro(a.instantiate()), a.delete(); } this.model.removeAllChanges(); for (const [a, i] of Object.entries(this.parametersData())) { const o = a.split("/"); this.model.addChange(new this.libopencor.SedChangeAttribute(o[0], o[1], i.toString())); } this.instance.run(); const e = {}, r = this.instance.task(0); let t = !0, n; for (const a of this.outputData()) { if (n = !1, a === r.voiName && (e[a] = r.voiAsArray, n = !0), e[a] === void 0) { for (let i = 0; i < r.stateCount; ++i) if (a === r.stateName(i)) { e[a] = r.stateAsArray(i), n = !0; break; } } if (e[a] === void 0) { for (let i = 0; i < r.rateCount; ++i) if (a === r.rateName(i)) { e[a] = r.rateAsArray(i), n = !0; break; } } if (e[a] === void 0) { for (let i = 0; i < r.constantCount; ++i) if (a === r.constantName(i)) { e[a] = r.constantAsArray(i), n = !0; break; } } if (e[a] === void 0) { for (let i = 0; i < r.computedConstantCount; ++i) if (a === r.computedConstantName(i)) { e[a] = r.computedConstantAsArray(i), n = !0; break; } } if (e[a] === void 0) { for (let i = 0; i < r.algebraicCount; ++i) if (a === r.algebraicName(i)) { e[a] = r.algebraicAsArray(i), n = !0; break; } } n || (console.warn("SIMULATION: output '" + a + "' could not be found."), t = !1); } t ? this.processSimulationResults(e) : (this.hasValidSimulationUiInfo = !1, this.errorMessage = "some outputs could not be found"), this.showUserMessage = !1; }, /** * @public * Build the simulation UI using `simulationUiInfo`, a JSON object that describes the contents of the simulation UI. * @arg `simulationUiInfo` */ buildSimulationUi(e) { if (this.simulationUiInfo = e, this.hasValidSimulationUiInfo = dk(this.simulationUiInfo, this.libopencor === void 0), !this.hasValidSimulationUiInfo) { this.errorMessage = "the simulation.json file is malformed"; return; } if (this.libopencor === void 0) { if (this.simulationUiInfo.simulation.solvers.forEach((t) => { (t.if === void 0 || tl(this, t.if)) && (this.solver = t); }), this.solver === void 0) { this.hasValidSimulationUiInfo = !1, this.errorMessage = "no solver name and/or solver version specified"; return; } this.opencorBasedSimulation = this.solver.name === t1; } this.simulationUiInfo.output.data.forEach((t) => { this.simulationResultsId[t.id] = t.name; }); let r = -1; this.simulationUiInfo.output.plots.forEach((t) => { ++r, this.layout[r] = { paper_bgcolor: "rgba(0, 0, 0, 0)", plot_bgcolor: "rgba(0, 0, 0, 0)", autosize: !0, margin: { t: 25, l: 55, r: 25, b: 30, pad: 4 }, loading: !1, options: { responsive: !0, scrollZoom: !0 }, dragmode: "pan", xaxis: { title: { text: t.xAxisTitle, font: { size: 10 } } }, yaxis: { title: { text: t.yAxisTitle, font: { size: 10 } } } }; }), this.$nextTick(() => { fh(this); }); }, /** * @public * Extract the simulation UI JSON file from the given file contents and build the simulation UI. * @arg `libopencor` * @arg `fileContents` */ extractAndBuildSimulationUi(e, r) { this.libopencor = ro(e), this.libopencorSet = !0, this.fileManager = ro(this.libopencor.FileManager.instance()); const t = this.manageFile(bu + this.id, r); if (t.type.value !== e.File.Type.COMBINE_ARCHIVE.value) this.showUserMessage = !1; else { const n = new TextDecoder(), a = t.childFileFromFileName("simulation.json"); if (a === null) this.errorMessage = "no simulation JSON file could be found", this.showUserMessage = !1; else { const i = JSON.parse(n.decode(a.contents())); this.showUserMessage = !1, this.$nextTick(() => { this.buildSimulationUi(i); }); } } }, /** * @public * Run the simulation-based dataset directly on oSPARC. Not all simulation-based datasets can be run directly on * oSPARC, but for those that can the simulation UI shows a `Run on oSPARC` button which, when clicked, calls this * method. */ runOnOsparc() { window.open(`https://osparc.io/study/${this.uuid}`, "_blank"); }, /** * @public * View the simulation-based dataset on the SPARC portal. The simulation UI has a `View Dataset` button which, when * clicked, calls this method. */ viewDataset() { window.open(`https://sparc.science/datasets/${this.id}?type=dataset`, "_blank"); }, /** * @public * View the simulation-based dataset on PMR. The simulation UI has a `View Workspace` button which, when clicked, * calls this method. */ viewWorkspace() { const e = bu + this.id; window.open(e.substring(0, e.lastIndexOf("/")), "_blank"); }, /** * @public * Data needed to set a model's parameters. */ parametersData() { const e = {}; return this.simulationUiInfo.parameters.forEach((r) => { e[r.name] = tl(this, r.value); }), e; }, /** * @public * Data needed to specify the model output. */ outputData() { return this.output === void 0 && this.simulationUiInfo.output.data !== void 0 && (this.output = [], this.simulationUiInfo.output.data.forEach((e) => { this.output.push(e.name); })), this.output; }, /** * @public * Create the `request` that is going to be used by `startSimulation` to ask oSPARC to start the simulation. */ retrieveRequest() { const e = { solver: this.solver }; if (this.opencorBasedSimulation) { e.opencor = { model_url: this.simulationUiInfo.simulation.opencor.resource, json_config: {} }, this.simulationUiInfo.simulation.opencor.endingPoint !== void 0 && this.simulationUiInfo.simulation.opencor.pointInterval !== void 0 && (e.opencor.json_config.simulation = { "Ending point": this.simulationUiInfo.simulation.opencor.endingPoint, "Point interval": this.simulationUiInfo.simulation.opencor.pointInterval }), e.opencor.json_config.parameters = this.parametersData(); const r = this.outputData(); r !== void 0 && (e.opencor.json_config.output = r); } else e.osparc = {}, e.osparc.job_inputs = this.parametersData(); return e; }, /** * @public * Process the simulation results retrieved by `checkSimulation`. The simulation results are post-processed, if * needed, and then readied for use by `PlotVuer`. * @arg `results` */ processSimulationResults(e) { if (typeof e == "string") { const n = /[ \t]+/g, a = e.trim().split(` `), i = a[0].trim().split(n).length; e = {}; for (let l = 0; l < i; ++l) e[l] = []; let o = -1; a.forEach((l) => { ++o; let u = -1; l.trim().split(n).forEach((c) => { e[++u][o] = Number(c); }); }); } const r = new vk.parser(); Object.keys(this.simulationResultsId).forEach((n) => { r.set(n, e[this.simulationResultsId[n]]); }); let t = -1; this.simulationUiInfo.output.plots.forEach((n) => { this.simulationResults[++t] = [ { x: r.evaluate(n.xValue), y: r.evaluate(n.yValue), type: "scatter" } ]; }); }, /** * @public * Show an HTTP issue using the given `xmlhttp`. * @arg `xmlhttp` */ showHttpIssue(e) { this.isSimulationValid = !1, this.showUserMessage = !1, this.errorMessage = e.statusText.toLowerCase() + " (" + e.status + ")"; }, /** * @public * Check the progress of the simulation using the given `data`, a JSON object that contains the simulation job ID, * as well as the solver name and version. This method is first called by `startSimulation` and then every second by * itself until the simulation is finished. * @arg `data` */ checkSimulation(e) { const r = new XMLHttpRequest(); r.open("POST", this.apiLocation + "/check_simulation"), r.setRequestHeader("Content-type", "application/json"), r.onreadystatechange = () => { if (r.readyState === 4) if (r.status === 200) { let t = JSON.parse(r.responseText); if (this.isSimulationValid = t.status === "ok", this.isSimulationValid) if (t.results !== void 0) this.showUserMessage = !1, this.processSimulationResults(t.results); else { let n = this; setTimeout(function() { n.checkSimulation(e); }, 1e3); } else this.showUserMessage = !1, this.errorMessage = t.description; } else this.showHttpIssue(r); }, r.send(JSON.stringify(e)); }, /** * @public * Start the simulation associated with the simulation-based dataset. The simulation UI has a `Run Simulation` * button which, when clicked, calls this method. */ startSimulation() { this.userMessage = "Loading simulation results...", this.showUserMessage = !0, this.$nextTick(() => { this.simulationResults = {}; const e = new XMLHttpRequest(); e.open("POST", this.apiLocation + "/start_simulation"), e.setRequestHeader("Content-type", "application/json"), e.onreadystatechange = () => { if (e.readyState === 4) if (e.status === 200) { let r = JSON.parse(e.responseText); this.isSimulationValid = r.status === "ok", this.isSimulationValid ? this.checkSimulation(r.data) : (this.showUserMessage = !1, this.errorMessage = r.description); } else this.showHttpIssue(e); }, e.send(JSON.stringify(this.retrieveRequest())); }); } }, created: function() { this.idType === Bn.DATASET_ID ? (this.userMessage = "Retrieving UI information...", this.showUserMessage = !0, this.$nextTick(() => { const e = new XMLHttpRequest(); e.open("GET", this.apiLocation + "/simulation_ui_file/" + this.id), e.onreadystatechange = () => { e.readyState === 4 && (this.showUserMessage = !1, e.status === 200 ? this.$nextTick(() => { this.buildSimulationUi(JSON.parse(e.responseText)); }) : this.errorMessage = "the simulation dataset could not be retrieved"); }, e.send(); })) : this.idType === Bn.DATASET_URL ? (this.userMessage = "Retrieving COMBINE archive...", this.showUserMessage = !0, this.$nextTick(() => { const e = new XMLHttpRequest(); e.open("GET", this.id), e.responseType = "arraybuffer", e.onreadystatechange = () => { e.readyState === 4 && (e.status === 200 ? Js().then((r) => { this.extractAndBuildSimulationUi(r, new Uint8Array(e.response)); }) : (this.errorMessage = "the COMBINE archive could not be retrieved", this.showUserMessage = !1)); }, e.send(); })) : this.idType === Bn.PMR_PATH ? (this.userMessage = "Retrieving COMBINE archive from PMR...", this.showUserMessage = !0, this.$nextTick(() => { const e = new XMLHttpRequest(); e.open("POST", this.apiLocation + "/pmr_file"), e.setRequestHeader("Content-type", "application/json"), e.onreadystatechange = () => { e.readyState === 4 && (e.status === 200 ? Js().then((r) => { this.extractAndBuildSimulationUi(r, Uint8Array.from(atob(e.response), (t) => t.charCodeAt(0))); }) : (this.errorMessage = "the COMBINE archive chould not be retrieved from PMR", this.showUserMessage = !1)); }, e.send(JSON.stringify({ path: this.id })); })) : (this.userMessage = "Retrieving COMBINE archive...", this.showUserMessage = !0, this.$nextTick(() => { Js().then((e) => { this.extractAndBuildSimulationUi(e, this.id); }); })); }, mounted: function() { this.isMounted = !0, fh(this); } }, gk = ["element-loading-text"], yk = { key: 0, class: "default error" }, bk = { key: 1, class: "main" }, wk = { class: "main-left" }, xk = { key: 0, class: "default name" }, Ak = { class: "input scrollbar" }, Nk = { key: 2, class: "primary-button" }, Dk = { key: 3, class: "secondary-button" }, Ek = { key: 4, class: "secondary-button" }, Sk = { key: 5, class: "secondary-button" }, Ck = { key: 6, class: "default note" }, Mk = { class: "main-right", ref: "output" }, _k = { class: "main-right" }, Fk = { class: "default error" }, Tk = ["innerHTML"]; function Ok(e, r, t, n, a, i) { const o = _0, l = i1, u = M0, s = $n("PlotVuer"), c = Ru; return at((he(), Ce("div", { class: "simulation-vuer", "element-loading-text": e.userMessage }, [ !e.hasValidSimulationUiInfo && !e.showUserMessage ? (he(), Ce("p", yk, [ r[4] || (r[4] = $e("span", { class: "error" }, "Error:", -1)), dn(" " + qr(e.errorMessage) + ".", 1) ])) : Be("", !0), e.hasValidSimulationUiInfo ? (he(), Ce("div", bk, [ $e("div", wk, [ e.libopencorSet ? Be("", !0) : (he(), Ce("p", xk, qr(e.name), 1)), e.libopencorSet ? Be("", !0) : (he(), He(o, { key: 1 })), r[9] || (r[9] = $e("p", { class: "default input-parameters" }, "Input parameters", -1)), $e("div", Ak, [ (he(!0), Ce(nt, null, Gn(e.simulationUiInfo.input, (f, d) => (he(), He(l, { ref_for: !0, ref: "simInput", defaultValue: f.defaultValue, key: `input-${d}`, name: f.name, maximumValue: f.maximumValue, minimumValue: f.minimumValue, possibleValues: f.possibleValues, stepValue: f.stepValue }, null, 8, ["defaultValue", "name", "maximumValue", "minimumValue", "possibleValues", "stepValue"]))), 128)) ]), e.libopencorSet ? Be("", !0) : (he(), Ce("div", Nk, [ mr(u, { type: "primary", size: "small", onClick: r[0] || (r[0] = (f) => i.startSimulation()) }, { default: Ve(() => [...r[5] || (r[5] = [ dn("Run Simulation", -1) ])]), _: 1 }) ])), e.uuid ? (he(), Ce("div", Dk, [ mr(u, { size: "small", onClick: r[1] || (r[1] = (f) => i.runOnOsparc()) }, { default: Ve(() => [...r[6] || (r[6] = [ dn("Run on oSPARC", -1) ])]), _: 1 }) ])) : Be("", !0), e.libopencorSet ? Be("", !0) : (he(), Ce("div", Ek, [ mr(u, { size: "small", onClick: r[2] || (r[2] = (f) => i.viewDataset()) }, { default: Ve(() => [...r[7] || (r[7] = [ dn("View Dataset", -1) ])]), _: 1 }) ])), e.libopencorSet && e.idType === "pmr_path" ? (he(), Ce("div", Sk, [ mr(u, { size: "small", onClick: r[3] || (r[3] = (f) => i.viewWorkspace()) }, { default: Ve(() => [...r[8] || (r[8] = [ dn("View Workspace", -1) ])]), _: 1 }) ])) : Be("", !0), e.uuid ? (he(), Ce("p", Ck, "Additional parameters are available on oSPARC")) : Be("", !0) ]), at($e("div", Mk, [ (he(!0), Ce(nt, null, Gn(e.simulationUiInfo.output.plots, (f, d) => (he(), He(s, { key: `output-${d}`, metadata: i.plotMetadata(d), "data-source": { data: e.simulationResults[d] }, plotLayout: e.layout[d], plotType: "plotly-only", selectorUi: !1 }, null, 8, ["metadata", "data-source", "plotLayout"]))), 128)) ], 512), [ [Nn, e.isSimulationValid] ]), at($e("div", _k, [ $e("p", Fk, [ r[10] || (r[10] = $e("span", { class: "error" }, "Error:", -1)), r[11] || (r[11] = dn()), $e("span", { innerHTML: e.errorMessage }, null, 8, Tk), r[12] || (r[12] = dn(".", -1)) ]) ], 512), [ [Nn, !e.isSimulationValid] ]) ])) : Be("", !0) ], 8, gk)), [ [c, e.showUserMessage] ]); } const Rk = /* @__PURE__ */ a1(hk, [["render", Ok], ["__scopeId", "data-v-295b46c4"]]); export { Rk as SimulationVuer };