import { P1 } from "./chunk-HTVEDWAD.js"; import { Comment, Fragment, Teleport, Text, Transition, cloneVNode, computed, createApp, createBaseVNode, createBlock, createCommentVNode, createElementBlock, createSlots, createTextVNode, createVNode, defineComponent, getCurrentInstance, getCurrentScope, h, inject, isRef, markRaw, mergeProps, nextTick, normalizeClass, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onDeactivated, onMounted, onScopeDispose, onUnmounted, onUpdated, openBlock, provide, reactive, readonly, ref, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, shallowRef, toDisplayString, toHandlerKey, toRaw, toRef, toRefs, unref, useAttrs, useSlots, vModelText, vShow, warn, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "./chunk-HM42ZP2D.js"; import "./chunk-EWTE5DHJ.js"; // node_modules/@abi-software/simulationvuer/dist/simulationvuer.js import Js from "https://mapcore-demo.org/current/opencor-wasm/0.0.3/libopencor.js"; var pn = (e13, r, { checkForDefaultPrevented: t = true } = {}) => (a) => { const i = e13 == null ? void 0 : e13(a); if (t === false || !i) return r == null ? void 0 : r(a); }; var yc; var Ir = typeof window < "u"; var U1 = (e13) => typeof e13 == "string"; var yh = () => { }; var wu = Ir && ((yc = window == null ? void 0 : window.navigator) == null ? void 0 : yc.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); function bh(e13) { return typeof e13 == "function" ? e13() : unref(e13); } function k1(e13) { return e13; } function ds(e13) { return getCurrentScope() ? (onScopeDispose(e13), true) : false; } function V1(e13, r = true) { getCurrentInstance() ? onMounted(e13) : r ? e13() : nextTick(e13); } function gn(e13) { var r; const t = bh(e13); return (r = t == null ? void 0 : t.$el) != null ? r : t; } var ps = Ir ? window : void 0; function tt(...e13) { let r, t, n, a; if (U1(e13[0]) || Array.isArray(e13[0]) ? ([t, n, a] = e13, r = ps) : [r, t, n, a] = e13, !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 = watch(() => [gn(r), bh(a)], ([c, f]) => { o(), c && i.push(...t.flatMap((d) => n.map((p) => l(c, d, p, f)))); }, { immediate: true, flush: "post" }), s = () => { u(), o(); }; return ds(s), s; } var bc = false; function H1(e13, r, t = {}) { const { window: n = ps, ignore: a = [], capture: i = true, detectIframe: o = false } = t; if (!n) return; wu && !bc && (bc = true, Array.from(n.document.body.children).forEach((d) => d.addEventListener("click", yh))); let l = true; 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(e13); if (!(!p || p === d.target || d.composedPath().includes(p))) { if (d.detail === 0 && (l = !u(d)), !l) { l = true; return; } r(d); } }, { passive: true, capture: i }), tt(n, "pointerdown", (d) => { const p = gn(e13); p && (l = !d.composedPath().includes(p) && !u(d)); }, { passive: true }), o && tt(n, "blur", (d) => { var p; const m = gn(e13); ((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(e13, r = false) { const t = ref(), n = () => t.value = !!e13(); return n(), V1(n, r), t; } var wc = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; var xc = "__vueuse_ssr_handlers__"; wc[xc] = wc[xc] || {}; var Ac = Object.getOwnPropertySymbols; var Z1 = Object.prototype.hasOwnProperty; var G1 = Object.prototype.propertyIsEnumerable; var W1 = (e13, r) => { var t = {}; for (var n in e13) Z1.call(e13, n) && r.indexOf(n) < 0 && (t[n] = e13[n]); if (e13 != null && Ac) for (var n of Ac(e13)) r.indexOf(n) < 0 && G1.call(e13, n) && (t[n] = e13[n]); return t; }; function mn(e13, 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 = watch(() => gn(e13), (f) => { u(), l.value && a && f && (o = new ResizeObserver(r), o.observe(f, i)); }, { immediate: true, flush: "post" }), c = () => { u(), s(); }; return ds(c), { isSupported: l, stop: c }; } var Nc = Object.getOwnPropertySymbols; var K1 = Object.prototype.hasOwnProperty; var J1 = Object.prototype.propertyIsEnumerable; var Y1 = (e13, r) => { var t = {}; for (var n in e13) K1.call(e13, n) && r.indexOf(n) < 0 && (t[n] = e13[n]); if (e13 != null && Nc) for (var n of Nc(e13)) r.indexOf(n) < 0 && J1.call(e13, n) && (t[n] = e13[n]); return t; }; function j1(e13, 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 = watch(() => gn(e13), (f) => { u(), l.value && a && f && (o = new MutationObserver(r), o.observe(f, i)); }, { immediate: true }), c = () => { u(), s(); }; return ds(c), { isSupported: l, stop: c }; } var Dc; (function(e13) { e13.UP = "UP", e13.RIGHT = "RIGHT", e13.DOWN = "DOWN", e13.LEFT = "LEFT", e13.NONE = "NONE"; })(Dc || (Dc = {})); var X1 = Object.defineProperty; var Ec = Object.getOwnPropertySymbols; var Q1 = Object.prototype.hasOwnProperty; var eb = Object.prototype.propertyIsEnumerable; var Sc = (e13, r, t) => r in e13 ? X1(e13, r, { enumerable: true, configurable: true, writable: true, value: t }) : e13[r] = t; var rb = (e13, r) => { for (var t in r || (r = {})) Q1.call(r, t) && Sc(e13, t, r[t]); if (Ec) for (var t of Ec(r)) eb.call(r, t) && Sc(e13, t, r[t]); return e13; }; var 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); var nb = () => Ir && /firefox/i.test(window.navigator.userAgent); Object.freeze({}); Object.freeze([]); var Fi = () => { }; var ab = Object.prototype.hasOwnProperty; var Cc = (e13, r) => ab.call(e13, r); var Yt = Array.isArray; var Xr = (e13) => typeof e13 == "function"; var wt = (e13) => typeof e13 == "string"; var dt = (e13) => e13 !== null && typeof e13 == "object"; var ib = Object.prototype.toString; var ob = (e13) => ib.call(e13); var Ys = (e13) => ob(e13).slice(8, -1); var xh = (e13) => { const r = /* @__PURE__ */ Object.create(null); return (t) => r[t] || (r[t] = e13(t)); }; var sb = /-(\w)/g; var ub = xh( (e13) => e13.replace(sb, (r, t) => t ? t.toUpperCase() : "") ); var lb = /\B([A-Z])/g; var cb = xh( (e13) => e13.replace(lb, "-$1").toLowerCase() ); var Ah = typeof global == "object" && global && global.Object === Object && global; var fb = typeof self == "object" && self && self.Object === Object && self; var an = Ah || fb || Function("return this")(); var Qt = an.Symbol; var Nh = Object.prototype; var db = Nh.hasOwnProperty; var pb = Nh.toString; var bi = Qt ? Qt.toStringTag : void 0; function mb(e13) { var r = db.call(e13, bi), t = e13[bi]; try { e13[bi] = void 0; var n = true; } catch { } var a = pb.call(e13); return n && (r ? e13[bi] = t : delete e13[bi]), a; } var vb = Object.prototype; var hb = vb.toString; function gb(e13) { return hb.call(e13); } var yb = "[object Null]"; var bb = "[object Undefined]"; var Mc = Qt ? Qt.toStringTag : void 0; function ai(e13) { return e13 == null ? e13 === void 0 ? bb : yb : Mc && Mc in Object(e13) ? mb(e13) : gb(e13); } function Va(e13) { return e13 != null && typeof e13 == "object"; } var wb = "[object Symbol]"; function ms(e13) { return typeof e13 == "symbol" || Va(e13) && ai(e13) == wb; } function xb(e13, r) { for (var t = -1, n = e13 == null ? 0 : e13.length, a = Array(n); ++t < n; ) a[t] = r(e13[t], t, e13); return a; } var Ht = Array.isArray; var _c = Qt ? Qt.prototype : void 0; var Fc = _c ? _c.toString : void 0; function Dh(e13) { if (typeof e13 == "string") return e13; if (Ht(e13)) return xb(e13, Dh) + ""; if (ms(e13)) return Fc ? Fc.call(e13) : ""; var r = e13 + ""; return r == "0" && 1 / e13 == -1 / 0 ? "-0" : r; } var Ab = /\s/; function Nb(e13) { for (var r = e13.length; r-- && Ab.test(e13.charAt(r)); ) ; return r; } var Db = /^\s+/; function Eb(e13) { return e13 && e13.slice(0, Nb(e13) + 1).replace(Db, ""); } function Kn(e13) { var r = typeof e13; return e13 != null && (r == "object" || r == "function"); } var Tc = NaN; var Sb = /^[-+]0x[0-9a-f]+$/i; var Cb = /^0b[01]+$/i; var Mb = /^0o[0-7]+$/i; var _b = parseInt; function Oc(e13) { if (typeof e13 == "number") return e13; if (ms(e13)) return Tc; if (Kn(e13)) { var r = typeof e13.valueOf == "function" ? e13.valueOf() : e13; e13 = Kn(r) ? r + "" : r; } if (typeof e13 != "string") return e13 === 0 ? e13 : +e13; e13 = Eb(e13); var t = Cb.test(e13); return t || Mb.test(e13) ? _b(e13.slice(2), t ? 2 : 8) : Sb.test(e13) ? Tc : +e13; } function Eh(e13) { return e13; } var Fb = "[object AsyncFunction]"; var Tb = "[object Function]"; var Ob = "[object GeneratorFunction]"; var Bb = "[object Proxy]"; function Sh(e13) { if (!Kn(e13)) return false; var r = ai(e13); return r == Tb || r == Ob || r == Fb || r == Bb; } var js = an["__core-js_shared__"]; var Bc = function() { var e13 = /[^.]+$/.exec(js && js.keys && js.keys.IE_PROTO || ""); return e13 ? "Symbol(src)_1." + e13 : ""; }(); function $b(e13) { return !!Bc && Bc in e13; } var Ib = Function.prototype; var Rb = Ib.toString; function ya(e13) { if (e13 != null) { try { return Rb.call(e13); } catch { } try { return e13 + ""; } catch { } } return ""; } var Pb = /[\\^$.*+?()[\]{}|]/g; var zb = /^\[object .+?Constructor\]$/; var qb = Function.prototype; var Lb = Object.prototype; var Ub = qb.toString; var kb = Lb.hasOwnProperty; var Vb = RegExp( "^" + Ub.call(kb).replace(Pb, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" ); function Hb(e13) { if (!Kn(e13) || $b(e13)) return false; var r = Sh(e13) ? Vb : zb; return r.test(ya(e13)); } function Zb(e13, r) { return e13 == null ? void 0 : e13[r]; } function ba(e13, r) { var t = Zb(e13, r); return Hb(t) ? t : void 0; } var xu = ba(an, "WeakMap"); function Gb(e13, r, t) { switch (t.length) { case 0: return e13.call(r); case 1: return e13.call(r, t[0]); case 2: return e13.call(r, t[0], t[1]); case 3: return e13.call(r, t[0], t[1], t[2]); } return e13.apply(r, t); } var Wb = 800; var Kb = 16; var Jb = Date.now; function Yb(e13) { 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 e13.apply(void 0, arguments); }; } function jb(e13) { return function() { return e13; }; } var zo = function() { try { var e13 = ba(Object, "defineProperty"); return e13({}, "", {}), e13; } catch { } }(); var Xb = zo ? function(e13, r) { return zo(e13, "toString", { configurable: true, enumerable: false, value: jb(r), writable: true }); } : Eh; var Qb = Yb(Xb); function ew(e13, r, t, n) { e13.length; for (var a = t + 1; a--; ) if (r(e13[a], a, e13)) return a; return -1; } var rw = 9007199254740991; var tw = /^(?:0|[1-9]\d*)$/; function il(e13, r) { var t = typeof e13; return r = r ?? rw, !!r && (t == "number" || t != "symbol" && tw.test(e13)) && e13 > -1 && e13 % 1 == 0 && e13 < r; } function nw(e13, r, t) { r == "__proto__" && zo ? zo(e13, r, { configurable: true, enumerable: true, value: t, writable: true }) : e13[r] = t; } function ol(e13, r) { return e13 === r || e13 !== e13 && r !== r; } var aw = Object.prototype; var iw = aw.hasOwnProperty; function ow(e13, r, t) { var n = e13[r]; (!(iw.call(e13, r) && ol(n, t)) || t === void 0 && !(r in e13)) && nw(e13, r, t); } var $c = Math.max; function sw(e13, r, t) { return r = $c(r === void 0 ? e13.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(e13, this, l); }; } var uw = 9007199254740991; function sl(e13) { return typeof e13 == "number" && e13 > -1 && e13 % 1 == 0 && e13 <= uw; } function lw(e13) { return e13 != null && sl(e13.length) && !Sh(e13); } var cw = Object.prototype; function fw(e13) { var r = e13 && e13.constructor, t = typeof r == "function" && r.prototype || cw; return e13 === t; } function dw(e13, r) { for (var t = -1, n = Array(e13); ++t < e13; ) n[t] = r(t); return n; } var pw = "[object Arguments]"; function Ic(e13) { return Va(e13) && ai(e13) == pw; } var Ch = Object.prototype; var mw = Ch.hasOwnProperty; var vw = Ch.propertyIsEnumerable; var ul = Ic(/* @__PURE__ */ function() { return arguments; }()) ? Ic : function(e13) { return Va(e13) && mw.call(e13, "callee") && !vw.call(e13, "callee"); }; function hw() { return false; } var Mh = typeof exports == "object" && exports && !exports.nodeType && exports; var Rc = Mh && typeof module == "object" && module && !module.nodeType && module; var gw = Rc && Rc.exports === Mh; var Pc = gw ? an.Buffer : void 0; var yw = Pc ? Pc.isBuffer : void 0; var Au = yw || hw; var bw = "[object Arguments]"; var ww = "[object Array]"; var xw = "[object Boolean]"; var Aw = "[object Date]"; var Nw = "[object Error]"; var Dw = "[object Function]"; var Ew = "[object Map]"; var Sw = "[object Number]"; var Cw = "[object Object]"; var Mw = "[object RegExp]"; var _w = "[object Set]"; var Fw = "[object String]"; var Tw = "[object WeakMap]"; var Ow = "[object ArrayBuffer]"; var Bw = "[object DataView]"; var $w = "[object Float32Array]"; var Iw = "[object Float64Array]"; var Rw = "[object Int8Array]"; var Pw = "[object Int16Array]"; var zw = "[object Int32Array]"; var qw = "[object Uint8Array]"; var Lw = "[object Uint8ClampedArray]"; var Uw = "[object Uint16Array]"; var kw = "[object Uint32Array]"; var Ar = {}; Ar[$w] = Ar[Iw] = Ar[Rw] = Ar[Pw] = Ar[zw] = Ar[qw] = Ar[Lw] = Ar[Uw] = Ar[kw] = true; 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] = false; function Vw(e13) { return Va(e13) && sl(e13.length) && !!Ar[ai(e13)]; } function Hw(e13) { return function(r) { return e13(r); }; } var _h = typeof exports == "object" && exports && !exports.nodeType && exports; var Si = _h && typeof module == "object" && module && !module.nodeType && module; var Zw = Si && Si.exports === _h; var Xs = Zw && Ah.process; var zc = function() { try { var e13 = Si && Si.require && Si.require("util").types; return e13 || Xs && Xs.binding && Xs.binding("util"); } catch { } }(); var qc = zc && zc.isTypedArray; var Fh = qc ? Hw(qc) : Vw; var Gw = Object.prototype; var Ww = Gw.hasOwnProperty; function Kw(e13, r) { var t = Ht(e13), n = !t && ul(e13), a = !t && !n && Au(e13), i = !t && !n && !a && Fh(e13), o = t || n || a || i, l = o ? dw(e13.length, String) : [], u = l.length; for (var s in e13) Ww.call(e13, 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(e13, r) { return function(t) { return e13(r(t)); }; } var Yw = Jw(Object.keys, Object); var jw = Object.prototype; var Xw = jw.hasOwnProperty; function Qw(e13) { if (!fw(e13)) return Yw(e13); var r = []; for (var t in Object(e13)) Xw.call(e13, t) && t != "constructor" && r.push(t); return r; } function Th(e13) { return lw(e13) ? Kw(e13) : Qw(e13); } var ex = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/; var rx = /^\w*$/; function ll(e13, r) { if (Ht(e13)) return false; var t = typeof e13; return t == "number" || t == "symbol" || t == "boolean" || e13 == null || ms(e13) ? true : rx.test(e13) || !ex.test(e13) || r != null && e13 in Object(r); } var Ti = ba(Object, "create"); function tx() { this.__data__ = Ti ? Ti(null) : {}, this.size = 0; } function nx(e13) { var r = this.has(e13) && delete this.__data__[e13]; return this.size -= r ? 1 : 0, r; } var ax = "__lodash_hash_undefined__"; var ix = Object.prototype; var ox = ix.hasOwnProperty; function sx(e13) { var r = this.__data__; if (Ti) { var t = r[e13]; return t === ax ? void 0 : t; } return ox.call(r, e13) ? r[e13] : void 0; } var ux = Object.prototype; var lx = ux.hasOwnProperty; function cx(e13) { var r = this.__data__; return Ti ? r[e13] !== void 0 : lx.call(r, e13); } var fx = "__lodash_hash_undefined__"; function dx(e13, r) { var t = this.__data__; return this.size += this.has(e13) ? 0 : 1, t[e13] = Ti && r === void 0 ? fx : r, this; } function va(e13) { var r = -1, t = e13 == null ? 0 : e13.length; for (this.clear(); ++r < t; ) { var n = e13[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(e13, r) { for (var t = e13.length; t--; ) if (ol(e13[t][0], r)) return t; return -1; } var mx = Array.prototype; var vx = mx.splice; function hx(e13) { var r = this.__data__, t = vs(r, e13); if (t < 0) return false; var n = r.length - 1; return t == n ? r.pop() : vx.call(r, t, 1), --this.size, true; } function gx(e13) { var r = this.__data__, t = vs(r, e13); return t < 0 ? void 0 : r[t][1]; } function yx(e13) { return vs(this.__data__, e13) > -1; } function bx(e13, r) { var t = this.__data__, n = vs(t, e13); return n < 0 ? (++this.size, t.push([e13, r])) : t[n][1] = r, this; } function Mn(e13) { var r = -1, t = e13 == null ? 0 : e13.length; for (this.clear(); ++r < t; ) { var n = e13[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(e13) { var r = typeof e13; return r == "string" || r == "number" || r == "symbol" || r == "boolean" ? e13 !== "__proto__" : e13 === null; } function hs(e13, r) { var t = e13.__data__; return xx(r) ? t[typeof r == "string" ? "string" : "hash"] : t.map; } function Ax(e13) { var r = hs(this, e13).delete(e13); return this.size -= r ? 1 : 0, r; } function Nx(e13) { return hs(this, e13).get(e13); } function Dx(e13) { return hs(this, e13).has(e13); } function Ex(e13, r) { var t = hs(this, e13), n = t.size; return t.set(e13, r), this.size += t.size == n ? 0 : 1, this; } function _n(e13) { var r = -1, t = e13 == null ? 0 : e13.length; for (this.clear(); ++r < t; ) { var n = e13[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(e13, r) { if (typeof e13 != "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 = e13.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(e13) { var r = cl(e13, function(n) { return t.size === Cx && t.clear(), n; }), t = r.cache; return r; } var _x = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; var Fx = /\\(\\)?/g; var Tx = Mx(function(e13) { var r = []; return e13.charCodeAt(0) === 46 && r.push(""), e13.replace(_x, function(t, n, a, i) { r.push(a ? i.replace(Fx, "$1") : n || t); }), r; }); function Ox(e13) { return e13 == null ? "" : Dh(e13); } function gs(e13, r) { return Ht(e13) ? e13 : ll(e13, r) ? [e13] : Tx(Ox(e13)); } function ki(e13) { if (typeof e13 == "string" || ms(e13)) return e13; var r = e13 + ""; return r == "0" && 1 / e13 == -1 / 0 ? "-0" : r; } function fl(e13, r) { r = gs(r, e13); for (var t = 0, n = r.length; e13 != null && t < n; ) e13 = e13[ki(r[t++])]; return t && t == n ? e13 : void 0; } function hn(e13, r, t) { var n = e13 == null ? void 0 : fl(e13, r); return n === void 0 ? t : n; } function Oh(e13, r) { for (var t = -1, n = r.length, a = e13.length; ++t < n; ) e13[a + t] = r[t]; return e13; } var Lc = Qt ? Qt.isConcatSpreadable : void 0; function Bx(e13) { return Ht(e13) || ul(e13) || !!(Lc && e13 && e13[Lc]); } function $x(e13, r, t, n, a) { var i = -1, o = e13.length; for (t || (t = Bx), a || (a = []); ++i < o; ) { var l = e13[i]; t(l) ? Oh(a, l) : a[a.length] = l; } return a; } function Ix(e13) { var r = e13 == null ? 0 : e13.length; return r ? $x(e13) : []; } function Rx(e13) { return Qb(sw(e13, void 0, Ix), e13 + ""); } function Ln() { if (!arguments.length) return []; var e13 = arguments[0]; return Ht(e13) ? e13 : [e13]; } function Px() { this.__data__ = new Mn(), this.size = 0; } function zx(e13) { var r = this.__data__, t = r.delete(e13); return this.size = r.size, t; } function qx(e13) { return this.__data__.get(e13); } function Lx(e13) { return this.__data__.has(e13); } var Ux = 200; function kx(e13, r) { var t = this.__data__; if (t instanceof Mn) { var n = t.__data__; if (!Oi || n.length < Ux - 1) return n.push([e13, r]), this.size = ++t.size, this; t = this.__data__ = new _n(n); } return t.set(e13, r), this.size = t.size, this; } function xn(e13) { var r = this.__data__ = new Mn(e13); 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(e13, r) { for (var t = -1, n = e13 == null ? 0 : e13.length, a = 0, i = []; ++t < n; ) { var o = e13[t]; r(o, t, e13) && (i[a++] = o); } return i; } function Hx() { return []; } var Zx = Object.prototype; var Gx = Zx.propertyIsEnumerable; var Uc = Object.getOwnPropertySymbols; var Wx = Uc ? function(e13) { return e13 == null ? [] : (e13 = Object(e13), Vx(Uc(e13), function(r) { return Gx.call(e13, r); })); } : Hx; function Kx(e13, r, t) { var n = r(e13); return Ht(e13) ? n : Oh(n, t(e13)); } function kc(e13) { return Kx(e13, Th, Wx); } var Nu = ba(an, "DataView"); var Du = ba(an, "Promise"); var Eu = ba(an, "Set"); var Vc = "[object Map]"; var Jx = "[object Object]"; var Hc = "[object Promise]"; var Zc = "[object Set]"; var Gc = "[object WeakMap]"; var Wc = "[object DataView]"; var Yx = ya(Nu); var jx = ya(Oi); var Xx = ya(Du); var Qx = ya(Eu); var e2 = ya(xu); var 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(e13) { var r = ai(e13), t = r == Jx ? e13.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; var r2 = "__lodash_hash_undefined__"; function t2(e13) { return this.__data__.set(e13, r2), this; } function n2(e13) { return this.__data__.has(e13); } function qo(e13) { var r = -1, t = e13 == null ? 0 : e13.length; for (this.__data__ = new _n(); ++r < t; ) this.add(e13[r]); } qo.prototype.add = qo.prototype.push = t2; qo.prototype.has = n2; function a2(e13, r) { for (var t = -1, n = e13 == null ? 0 : e13.length; ++t < n; ) if (r(e13[t], t, e13)) return true; return false; } function i2(e13, r) { return e13.has(r); } var o2 = 1; var s2 = 2; function Bh(e13, r, t, n, a, i) { var o = t & o2, l = e13.length, u = r.length; if (l != u && !(o && u > l)) return false; var s = i.get(e13), c = i.get(r); if (s && c) return s == r && c == e13; var f = -1, d = true, p = t & s2 ? new qo() : void 0; for (i.set(e13, r), i.set(r, e13); ++f < l; ) { var m = e13[f], v = r[f]; if (n) var b = o ? n(v, m, f, r, e13, i) : n(m, v, f, e13, r, i); if (b !== void 0) { if (b) continue; d = false; 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 = false; break; } } else if (!(m === v || a(m, v, t, n, i))) { d = false; break; } } return i.delete(e13), i.delete(r), d; } function u2(e13) { var r = -1, t = Array(e13.size); return e13.forEach(function(n, a) { t[++r] = [a, n]; }), t; } function l2(e13) { var r = -1, t = Array(e13.size); return e13.forEach(function(n) { t[++r] = n; }), t; } var c2 = 1; var f2 = 2; var d2 = "[object Boolean]"; var p2 = "[object Date]"; var m2 = "[object Error]"; var v2 = "[object Map]"; var h2 = "[object Number]"; var g2 = "[object RegExp]"; var y2 = "[object Set]"; var b2 = "[object String]"; var w2 = "[object Symbol]"; var x2 = "[object ArrayBuffer]"; var A2 = "[object DataView]"; var Jc = Qt ? Qt.prototype : void 0; var Qs = Jc ? Jc.valueOf : void 0; function N2(e13, r, t, n, a, i, o) { switch (t) { case A2: if (e13.byteLength != r.byteLength || e13.byteOffset != r.byteOffset) return false; e13 = e13.buffer, r = r.buffer; case x2: return !(e13.byteLength != r.byteLength || !i(new Kc(e13), new Kc(r))); case d2: case p2: case h2: return ol(+e13, +r); case m2: return e13.name == r.name && e13.message == r.message; case g2: case b2: return e13 == r + ""; case v2: var l = u2; case y2: var u = n & c2; if (l || (l = l2), e13.size != r.size && !u) return false; var s = o.get(e13); if (s) return s == r; n |= f2, o.set(e13, r); var c = Bh(l(e13), l(r), n, a, i, o); return o.delete(e13), c; case w2: if (Qs) return Qs.call(e13) == Qs.call(r); } return false; } var D2 = 1; var E2 = Object.prototype; var S2 = E2.hasOwnProperty; function C2(e13, r, t, n, a, i) { var o = t & D2, l = kc(e13), u = l.length, s = kc(r), c = s.length; if (u != c && !o) return false; for (var f = u; f--; ) { var d = l[f]; if (!(o ? d in r : S2.call(r, d))) return false; } var p = i.get(e13), m = i.get(r); if (p && m) return p == r && m == e13; var v = true; i.set(e13, r), i.set(r, e13); for (var b = o; ++f < u; ) { d = l[f]; var y = e13[d], A = r[d]; if (n) var h10 = o ? n(A, y, d, r, e13, i) : n(y, A, d, e13, r, i); if (!(h10 === void 0 ? y === A || a(y, A, t, n, i) : h10)) { v = false; break; } b || (b = d == "constructor"); } if (v && !b) { var x = e13.constructor, w = r.constructor; x != w && "constructor" in e13 && "constructor" in r && !(typeof x == "function" && x instanceof x && typeof w == "function" && w instanceof w) && (v = false); } return i.delete(e13), i.delete(r), v; } var M2 = 1; var Yc = "[object Arguments]"; var jc = "[object Array]"; var to = "[object Object]"; var _2 = Object.prototype; var Xc = _2.hasOwnProperty; function F2(e13, r, t, n, a, i) { var o = Ht(e13), l = Ht(r), u = o ? jc : Pn(e13), 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(e13)) { if (!Au(r)) return false; o = true, c = false; } if (d && !c) return i || (i = new xn()), o || Fh(e13) ? Bh(e13, r, t, n, a, i) : N2(e13, r, u, t, n, a, i); if (!(t & M2)) { var p = c && Xc.call(e13, "__wrapped__"), m = f && Xc.call(r, "__wrapped__"); if (p || m) { var v = p ? e13.value() : e13, b = m ? r.value() : r; return i || (i = new xn()), a(v, b, t, n, i); } } return d ? (i || (i = new xn()), C2(e13, r, t, n, a, i)) : false; } function ys(e13, r, t, n, a) { return e13 === r ? true : e13 == null || r == null || !Va(e13) && !Va(r) ? e13 !== e13 && r !== r : F2(e13, r, t, n, ys, a); } var T2 = 1; var O2 = 2; function B2(e13, r, t, n) { var a = t.length, i = a; if (e13 == null) return !i; for (e13 = Object(e13); a--; ) { var o = t[a]; if (o[2] ? o[1] !== e13[o[0]] : !(o[0] in e13)) return false; } for (; ++a < i; ) { o = t[a]; var l = o[0], u = e13[l], s = o[1]; if (o[2]) { if (u === void 0 && !(l in e13)) return false; } else { var c = new xn(), f; if (!(f === void 0 ? ys(s, u, T2 | O2, n, c) : f)) return false; } } return true; } function $h(e13) { return e13 === e13 && !Kn(e13); } function $2(e13) { for (var r = Th(e13), t = r.length; t--; ) { var n = r[t], a = e13[n]; r[t] = [n, a, $h(a)]; } return r; } function Ih(e13, r) { return function(t) { return t == null ? false : t[e13] === r && (r !== void 0 || e13 in Object(t)); }; } function I2(e13) { var r = $2(e13); return r.length == 1 && r[0][2] ? Ih(r[0][0], r[0][1]) : function(t) { return t === e13 || B2(t, e13, r); }; } function R2(e13, r) { return e13 != null && r in Object(e13); } function P2(e13, r, t) { r = gs(r, e13); for (var n = -1, a = r.length, i = false; ++n < a; ) { var o = ki(r[n]); if (!(i = e13 != null && t(e13, o))) break; e13 = e13[o]; } return i || ++n != a ? i : (a = e13 == null ? 0 : e13.length, !!a && sl(a) && il(o, a) && (Ht(e13) || ul(e13))); } function Rh(e13, r) { return e13 != null && P2(e13, r, R2); } var z2 = 1; var q2 = 2; function L2(e13, r) { return ll(e13) && $h(r) ? Ih(ki(e13), r) : function(t) { var n = hn(t, e13); return n === void 0 && n === r ? Rh(t, e13) : ys(r, n, z2 | q2); }; } function U2(e13) { return function(r) { return r == null ? void 0 : r[e13]; }; } function k2(e13) { return function(r) { return fl(r, e13); }; } function V2(e13) { return ll(e13) ? U2(ki(e13)) : k2(e13); } function H2(e13) { return typeof e13 == "function" ? e13 : e13 == null ? Eh : typeof e13 == "object" ? Ht(e13) ? L2(e13[0], e13[1]) : I2(e13) : V2(e13); } var eu = function() { return an.Date.now(); }; var Z2 = "Expected a function"; var G2 = Math.max; var W2 = Math.min; function Su(e13, r, t) { var n, a, i, o, l, u, s = 0, c = false, f = false, d = true; if (typeof e13 != "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 = e13.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 h10() { 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 = h10, w.flush = x, w; } function K2(e13, r, t) { var n = e13 == null ? 0 : e13.length; if (!n) return -1; var a = n - 1; return ew(e13, H2(r), a); } function Lo(e13) { for (var r = -1, t = e13 == null ? 0 : e13.length, n = {}; ++r < t; ) { var a = e13[r]; n[a[0]] = a[1]; } return n; } function Cu(e13, r) { return ys(e13, r); } function An(e13) { return e13 == null; } function J2(e13) { return e13 === void 0; } function Y2(e13, r, t, n) { if (!Kn(e13)) return e13; r = gs(r, e13); for (var a = -1, i = r.length, o = i - 1, l = e13; l != null && ++a < i; ) { var u = ki(r[a]), s = t; if (u === "__proto__" || u === "constructor" || u === "prototype") return e13; 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 e13; } function j2(e13, r, t) { for (var n = -1, a = r.length, i = {}; ++n < a; ) { var o = r[n], l = fl(e13, o); t(l, o) && Y2(i, gs(o, e13), l); } return i; } function X2(e13, r) { return j2(e13, r, function(t, n) { return Rh(e13, n); }); } var Q2 = Rx(function(e13, r) { return e13 == null ? {} : X2(e13, r); }); var yn = (e13) => e13 === void 0; var Ph = (e13) => typeof e13 == "boolean"; var Nr = (e13) => typeof e13 == "number"; var la = (e13) => typeof Element > "u" ? false : e13 instanceof Element; var eA = (e13) => wt(e13) ? !Number.isNaN(Number(e13)) : false; var rA = (e13 = "") => e13.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d"); var Qc = (e13) => Object.keys(e13); var zh = class extends Error { constructor(r) { super(r), this.name = "ElementPlusError"; } }; function dl(e13, r) { throw new zh(`[${e13}] ${r}`); } function Tr(e13, r) { if (true) { const t = wt(e13) ? new zh(`[${e13}] ${r}`) : e13; console.warn(t); } } var tA = "utils/dom/style"; var qh = (e13 = "") => e13.split(" ").filter((r) => !!r.trim()); var ef = (e13, r) => { !e13 || !r.trim() || e13.classList.add(...qh(r)); }; var Uo = (e13, r) => { !e13 || !r.trim() || e13.classList.remove(...qh(r)); }; var wi = (e13, r) => { var t; if (!Ir || !e13 || !r) return ""; let n = ub(r); n === "float" && (n = "cssFloat"); try { const a = e13.style[n]; if (a) return a; const i = (t = document.defaultView) == null ? void 0 : t.getComputedStyle(e13, ""); return i ? i[n] : ""; } catch { return e13.style[n]; } }; function Mu(e13, r = "px") { if (!e13) return ""; if (Nr(e13) || eA(e13)) return `${e13}${r}`; if (wt(e13)) return e13; Tr(tA, "binding value must be a string or number"); } function nA(e13, r) { if (!Ir) return; if (!r) { e13.scrollTop = 0; return; } const t = []; let n = r.offsetParent; for (; n !== null && e13 !== n && e13.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 = e13.scrollTop, l = o + e13.clientHeight; a < o ? e13.scrollTop = a : i > l && (e13.scrollTop = i - e13.clientHeight); } var aA = defineComponent({ name: "ArrowDown", __name: "arrow-down", setup(e13) { return (r, t) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("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" }) ])); } }); var Lh = aA; var iA = defineComponent({ name: "ArrowUp", __name: "arrow-up", setup(e13) { return (r, t) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("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" }) ])); } }); var oA = iA; var sA = defineComponent({ name: "CircleCheck", __name: "circle-check", setup(e13) { return (r, t) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("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" }), createBaseVNode("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" }) ])); } }); var uA = sA; var lA = defineComponent({ name: "CircleClose", __name: "circle-close", setup(e13) { return (r, t) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("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" }), createBaseVNode("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" }) ])); } }); var pl = lA; var cA = defineComponent({ name: "Close", __name: "close", setup(e13) { return (r, t) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("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" }) ])); } }); var rf = cA; var fA = defineComponent({ name: "Hide", __name: "hide", setup(e13) { return (r, t) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("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" }), createBaseVNode("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" }) ])); } }); var dA = fA; var pA = defineComponent({ name: "Loading", __name: "loading", setup(e13) { return (r, t) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("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" }) ])); } }); var Uh = pA; var mA = defineComponent({ name: "Minus", __name: "minus", setup(e13) { return (r, t) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("path", { fill: "currentColor", d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64" }) ])); } }); var vA = mA; var hA = defineComponent({ name: "Plus", __name: "plus", setup(e13) { return (r, t) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("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" }) ])); } }); var gA = hA; var yA = defineComponent({ name: "View", __name: "view", setup(e13) { return (r, t) => (openBlock(), createElementBlock("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 1024 1024" }, [ createBaseVNode("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" }) ])); } }); var bA = yA; var kh = "__epPropKey"; var rr = (e13) => e13; var wA = (e13) => dt(e13) && !!e13[kh]; var bs = (e13, r) => { if (!dt(e13) || wA(e13)) return e13; const { values: t, required: n, default: a, type: i, validator: o } = e13, u = { type: i, required: !!n, validator: t || o ? (s) => { let c = false, f = []; if (t && (f = Array.from(t), Cc(e13, "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(", "); warn(`Invalid prop: validation failed${r ? ` for prop "${r}"` : ""}. Expected one of [${d}], got value ${JSON.stringify(s)}.`); } return c; } : void 0, [kh]: true }; return Cc(e13, "default") && (u.default = a), u; }; var Er = (e13) => Lo(Object.entries(e13).map(([r, t]) => [ r, bs(t, r) ])); var Ha = rr([ String, Object, Function ]); var Vh = { validating: Uh, success: uA, error: pl }; var Bt = (e13, r) => { if (e13.install = (t) => { for (const n of [e13, ...Object.values(r ?? {})]) t.component(n.name, n); }, r) for (const [t, n] of Object.entries(r)) e13[t] = n; return e13; }; var ml = (e13) => (e13.install = Fi, e13); var 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" }; var Or = "update:modelValue"; var ii = "change"; var ca = "input"; var Hh = ["", "default", "small", "large"]; var xA = (e13) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(e13); var AA = (e13) => e13; var NA = ["class", "style"]; var DA = /^on[A-Z]/; var EA = (e13 = {}) => { const { excludeListeners: r = false, excludeKeys: t } = e13, n = computed(() => ((t == null ? void 0 : t.value) || []).concat(NA)), a = getCurrentInstance(); return a ? computed(() => { 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"), computed(() => ({}))); }; var SA = ({ from: e13, replacement: r, scope: t, version: n, ref: a, type: i = "API" }, o) => { watch(() => unref(o), (l) => { l && Tr(t, `[${i}] ${e13} is about to be deprecated in version ${n}, please use ${r} instead. For more detail, please visit: ${a} `); }, { immediate: true }); }; 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}" } } }; var MA = (e13) => (r, t) => _A(r, t, unref(e13)); var _A = (e13, r, t) => hn(t, e13, e13).replace(/\{(\w+)\}/g, (n, a) => { var i; return `${(i = r == null ? void 0 : r[a]) != null ? i : `{${a}}`}`; }); var FA = (e13) => { const r = computed(() => unref(e13).name), t = isRef(e13) ? e13 : ref(e13); return { lang: r, locale: t, t: MA(e13) }; }; var Zh = Symbol("localeContextKey"); var ws = (e13) => { const r = e13 || inject(Zh, ref()); return FA(computed(() => r.value || CA)); }; var To = "el"; var TA = "is-"; var ia = (e13, r, t, n, a) => { let i = `${e13}-${r}`; return t && (i += `-${t}`), n && (i += `__${n}`), a && (i += `--${a}`), i; }; var Gh = Symbol("namespaceContextKey"); var vl = (e13) => { const r = e13 || (getCurrentInstance() ? inject(Gh, ref(To)) : ref(To)); return computed(() => unref(r) || To); }; var Dr = (e13, r) => { const t = vl(r); return { namespace: t, b: (v = "") => ia(t.value, e13, v, "", ""), e: (v) => v ? ia(t.value, e13, "", v, "") : "", m: (v) => v ? ia(t.value, e13, "", "", v) : "", be: (v, b) => v && b ? ia(t.value, e13, v, b, "") : "", em: (v, b) => v && b ? ia(t.value, e13, "", v, b) : "", bm: (v, b) => v && b ? ia(t.value, e13, v, "", b) : "", bem: (v, b, y) => v && b && y ? ia(t.value, e13, v, b, y) : "", is: (v, ...b) => { const y = b.length >= 1 ? b[0] : true; 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}-${e13}-${y}`] = v[y]); return b; }, cssVarBlockName: (v) => `--${t.value}-${e13}-${v}` }; }; var OA = bs({ type: rr(Boolean), default: null }); var BA = bs({ type: rr(Function) }); var $A = (e13) => { const r = `update:${e13}`, t = `onUpdate:${e13}`, n = [r], a = { [e13]: OA, [t]: BA }; return { useModelToggle: ({ indicator: o, toggleReason: l, shouldHideWhenRouteChanges: u, shouldProceed: s, onShow: c, onHide: f }) => { const d = getCurrentInstance(), { emit: p } = d, m = d.props, v = computed(() => Xr(m[t])), b = computed(() => m[e13] === null), y = (D) => { o.value !== true && (o.value = true, l && (l.value = D), Xr(c) && c(D)); }, A = (D) => { o.value !== false && (o.value = false, l && (l.value = D), Xr(f) && f(D)); }, h10 = (D) => { if (m.disabled === true || Xr(s) && !s()) return; const E = v.value && Ir; E && p(r, true), (b.value || !E) && y(D); }, x = (D) => { if (m.disabled === true || !Ir) return; const E = v.value && Ir; E && p(r, false), (b.value || !E) && A(D); }, w = (D) => { Ph(D) && (m.disabled && D ? v.value && p(r, false) : o.value !== D && (D ? y() : A())); }, g = () => { o.value ? x() : h10(); }; return watch(() => m[e13], w), u && d.appContext.config.globalProperties.$route !== void 0 && watch(() => ({ ...d.proxy.$route }), () => { u.value && o.value && x(); }), onMounted(() => { w(m[e13]); }), { hide: x, show: h10, toggle: g, hasUpdateHandler: v }; }, useModelToggleProps: a, useModelToggleEmits: n }; }; var Wh = (e13) => { const r = getCurrentInstance(); return computed(() => { var t, n; return (n = (t = r == null ? void 0 : r.proxy) == null ? void 0 : t.$props) == null ? void 0 : n[e13]; }); }; var pt = "top"; var Tt = "bottom"; var Ot = "right"; var mt = "left"; var hl = "auto"; var Vi = [pt, Tt, Ot, mt]; var Ga = "start"; var Bi = "end"; var IA = "clippingParents"; var Kh = "viewport"; var xi = "popper"; var RA = "reference"; var tf = Vi.reduce(function(e13, r) { return e13.concat([r + "-" + Ga, r + "-" + Bi]); }, []); var oi = [].concat(Vi, [hl]).reduce(function(e13, r) { return e13.concat([r, r + "-" + Ga, r + "-" + Bi]); }, []); var PA = "beforeRead"; var zA = "read"; var qA = "afterRead"; var LA = "beforeMain"; var UA = "main"; var kA = "afterMain"; var VA = "beforeWrite"; var HA = "write"; var ZA = "afterWrite"; var GA = [PA, zA, qA, LA, UA, kA, VA, HA, ZA]; function en(e13) { return e13 ? (e13.nodeName || "").toLowerCase() : null; } function Zt(e13) { if (e13 == null) return window; if (e13.toString() !== "[object Window]") { var r = e13.ownerDocument; return r && r.defaultView || window; } return e13; } function Wa(e13) { var r = Zt(e13).Element; return e13 instanceof r || e13 instanceof Element; } function _t(e13) { var r = Zt(e13).HTMLElement; return e13 instanceof r || e13 instanceof HTMLElement; } function gl(e13) { if (typeof ShadowRoot > "u") return false; var r = Zt(e13).ShadowRoot; return e13 instanceof r || e13 instanceof ShadowRoot; } function WA(e13) { var r = e13.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 === false ? i.removeAttribute(o) : i.setAttribute(o, l === true ? "" : l); })); }); } function KA(e13) { var r = e13.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: true, phase: "write", fn: WA, effect: KA, requires: ["computeStyles"] }; function Xt(e13) { return e13.split("-")[0]; } var fa = Math.max; var ko = Math.min; var Ka = Math.round; function Ja(e13, r) { r === void 0 && (r = false); var t = e13.getBoundingClientRect(), n = 1, a = 1; if (_t(e13) && r) { var i = e13.offsetHeight, o = e13.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(e13) { var r = Ja(e13), t = e13.offsetWidth, n = e13.offsetHeight; return Math.abs(r.width - t) <= 1 && (t = r.width), Math.abs(r.height - n) <= 1 && (n = r.height), { x: e13.offsetLeft, y: e13.offsetTop, width: t, height: n }; } function Yh(e13, r) { var t = r.getRootNode && r.getRootNode(); if (e13.contains(r)) return true; if (t && gl(t)) { var n = r; do { if (n && e13.isSameNode(n)) return true; n = n.parentNode || n.host; } while (n); } return false; } function Dn(e13) { return Zt(e13).getComputedStyle(e13); } function JA(e13) { return ["table", "td", "th"].indexOf(en(e13)) >= 0; } function Xn(e13) { return ((Wa(e13) ? e13.ownerDocument : e13.document) || window.document).documentElement; } function xs(e13) { return en(e13) === "html" ? e13 : e13.assignedSlot || e13.parentNode || (gl(e13) ? e13.host : null) || Xn(e13); } function nf(e13) { return !_t(e13) || Dn(e13).position === "fixed" ? null : e13.offsetParent; } function YA(e13) { var r = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, t = navigator.userAgent.indexOf("Trident") !== -1; if (t && _t(e13)) { var n = Dn(e13); if (n.position === "fixed") return null; } var a = xs(e13); 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(e13) { for (var r = Zt(e13), t = nf(e13); 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(e13) || r; } function bl(e13) { return ["top", "bottom"].indexOf(e13) >= 0 ? "x" : "y"; } function Ci(e13, r, t) { return fa(e13, ko(r, t)); } function jA(e13, r, t) { var n = Ci(e13, r, t); return n > t ? t : n; } function jh() { return { top: 0, right: 0, bottom: 0, left: 0 }; } function Xh(e13) { return Object.assign({}, jh(), e13); } function Qh(e13, r) { return r.reduce(function(t, n) { return t[n] = e13, t; }, {}); } var XA = function(e13, r) { return e13 = typeof e13 == "function" ? e13(Object.assign({}, r.rects, { placement: r.placement })) : e13, Xh(typeof e13 != "number" ? e13 : Qh(e13, Vi)); }; function QA(e13) { var r, t = e13.state, n = e13.name, a = e13.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, h10 = v / 2 - b / 2, x = f[p], w = A - d[c] - f[m], g = A / 2 - d[c] / 2 + h10, D = Ci(x, g, w), E = u; t.modifiersData[n] = (r = {}, r[E] = D, r.centerOffset = D - g, r); } } function eN(e13) { var r = e13.state, t = e13.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: true, phase: "main", fn: QA, effect: eN, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] }; function Ya(e13) { return e13.split("-")[1]; } var tN = { top: "auto", right: "auto", bottom: "auto", left: "auto" }; function nN(e13) { var r = e13.x, t = e13.y, n = window, a = n.devicePixelRatio || 1; return { x: Ka(r * a) / a || 0, y: Ka(t * a) / a || 0 }; } function af(e13) { var r, t = e13.popper, n = e13.popperRect, a = e13.placement, i = e13.variation, o = e13.offsets, l = e13.position, u = e13.gpuAcceleration, s = e13.adaptive, c = e13.roundOffsets, f = e13.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"), h10 = 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) { h10 = 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 === true ? 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" : "", $[h10] = 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[h10] = y ? p + "px" : "", r.transform = "", r)); } function aN(e13) { var r = e13.state, t = e13.options, n = t.gpuAcceleration, a = n === void 0 ? true : n, i = t.adaptive, o = i === void 0 ? true : i, l = t.roundOffsets, u = l === void 0 ? true : 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: false, roundOffsets: u })))), r.attributes.popper = Object.assign({}, r.attributes.popper, { "data-popper-placement": r.placement }); } var e0 = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: aN, data: {} }; var no = { passive: true }; function iN(e13) { var r = e13.state, t = e13.instance, n = e13.options, a = n.scroll, i = a === void 0 ? true : a, o = n.resize, l = o === void 0 ? true : 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: true, phase: "write", fn: function() { }, effect: iN, data: {} }; var oN = { left: "right", right: "left", bottom: "top", top: "bottom" }; function Oo(e13) { return e13.replace(/left|right|bottom|top/g, function(r) { return oN[r]; }); } var sN = { start: "end", end: "start" }; function of(e13) { return e13.replace(/start|end/g, function(r) { return sN[r]; }); } function wl(e13) { var r = Zt(e13), t = r.pageXOffset, n = r.pageYOffset; return { scrollLeft: t, scrollTop: n }; } function xl(e13) { return Ja(Xn(e13)).left + wl(e13).scrollLeft; } function uN(e13) { var r = Zt(e13), t = Xn(e13), 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(e13), y: l }; } function lN(e13) { var r, t = Xn(e13), n = wl(e13), a = (r = e13.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(e13), 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(e13) { var r = Dn(e13), t = r.overflow, n = r.overflowX, a = r.overflowY; return /auto|scroll|overlay|hidden/.test(t + a + n); } function t0(e13) { return ["html", "body", "#document"].indexOf(en(e13)) >= 0 ? e13.ownerDocument.body : _t(e13) && Al(e13) ? e13 : t0(xs(e13)); } function Mi(e13, r) { var t; r === void 0 && (r = []); var n = t0(e13), a = n === ((t = e13.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(e13) { return Object.assign({}, e13, { left: e13.x, top: e13.y, right: e13.x + e13.width, bottom: e13.y + e13.height }); } function cN(e13) { var r = Ja(e13); return r.top = r.top + e13.clientTop, r.left = r.left + e13.clientLeft, r.bottom = r.top + e13.clientHeight, r.right = r.left + e13.clientWidth, r.width = e13.clientWidth, r.height = e13.clientHeight, r.x = r.left, r.y = r.top, r; } function sf(e13, r) { return r === Kh ? _u(uN(e13)) : Wa(r) ? cN(r) : _u(lN(Xn(e13))); } function fN(e13) { var r = Mi(xs(e13)), t = ["absolute", "fixed"].indexOf(Dn(e13).position) >= 0, n = t && _t(e13) ? Hi(e13) : e13; return Wa(n) ? r.filter(function(a) { return Wa(a) && Yh(a, n) && en(a) !== "body"; }) : []; } function dN(e13, r, t) { var n = r === "clippingParents" ? fN(e13) : [].concat(r), a = [].concat(n, [t]), i = a[0], o = a.reduce(function(l, u) { var s = sf(e13, 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(e13, 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(e13) { var r = e13.reference, t = e13.element, n = e13.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(e13, r) { r === void 0 && (r = {}); var t = r, n = t.placement, a = n === void 0 ? e13.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 ? false : 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 = e13.rects.popper, A = e13.elements[d ? b : c], h10 = dN(Wa(A) ? A : A.contextElement || Xn(e13.elements.popper), o, u), x = Ja(e13.elements.reference), w = n0({ reference: x, element: y, placement: a }), g = _u(Object.assign({}, y, w)), D = c === xi ? g : x, E = { top: h10.top - D.top + v.top, bottom: D.bottom - h10.bottom + v.bottom, left: h10.left - D.left + v.left, right: D.right - h10.right + v.right }, N = e13.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(e13, 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(e13, { 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(e13) { if (Xt(e13) === hl) return []; var r = Oo(e13); return [of(e13), r, of(r)]; } function vN(e13) { var r = e13.state, t = e13.options, n = e13.name; if (!r.modifiersData[n]._skip) { for (var a = t.mainAxis, i = a === void 0 ? true : a, o = t.altAxis, l = o === void 0 ? true : o, u = t.fallbackPlacements, s = t.padding, c = t.boundary, f = t.rootBoundary, d = t.altBoundary, p = t.flipVariations, m = p === void 0 ? true : p, v = t.allowedAutoPlacements, b = r.options.placement, y = Xt(b), A = y === b, h10 = u || (A || !m ? [Oo(b)] : mN(b)), x = [b].concat(h10).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 = true, 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 = false; 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 = true, r.placement = N, r.reset = true); } } var hN = { name: "flip", enabled: true, phase: "main", fn: vN, requiresIfExists: ["offset"], data: { _skip: false } }; function uf(e13, r, t) { return t === void 0 && (t = { x: 0, y: 0 }), { top: e13.top - r.height - t.y, right: e13.right - r.width + t.x, bottom: e13.bottom - r.height + t.y, left: e13.left - r.width - t.x }; } function lf(e13) { return [pt, Ot, Tt, mt].some(function(r) { return e13[r] >= 0; }); } function gN(e13) { var r = e13.state, t = e13.name, n = r.rects.reference, a = r.rects.popper, i = r.modifiersData.preventOverflow, o = $i(r, { elementContext: "reference" }), l = $i(r, { altBoundary: true }), 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: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: gN }; function bN(e13, r, t) { var n = Xt(e13), a = [mt, pt].indexOf(n) >= 0 ? -1 : 1, i = typeof t == "function" ? t(Object.assign({}, r, { placement: e13 })) : 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(e13) { var r = e13.state, t = e13.options, n = e13.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: true, phase: "main", requires: ["popperOffsets"], fn: wN }; function AN(e13) { var r = e13.state, t = e13.name; r.modifiersData[t] = n0({ reference: r.rects.reference, element: r.rects.popper, placement: r.placement }); } var a0 = { name: "popperOffsets", enabled: true, phase: "read", fn: AN, data: {} }; function NN(e13) { return e13 === "x" ? "y" : "x"; } function DN(e13) { var r = e13.state, t = e13.options, n = e13.name, a = t.mainAxis, i = a === void 0 ? true : a, o = t.altAxis, l = o === void 0 ? false : o, u = t.boundary, s = t.rootBoundary, c = t.altBoundary, f = t.padding, d = t.tether, p = d === void 0 ? true : 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), h10 = !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 = h10 ? D[C] / 2 - W - Z - re - S.mainAxis : X - Z - re - S.mainAxis, j = h10 ? -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: true, phase: "main", fn: DN, requiresIfExists: ["offset"] }; function SN(e13) { return { scrollLeft: e13.scrollLeft, scrollTop: e13.scrollTop }; } function CN(e13) { return e13 === Zt(e13) || !_t(e13) ? wl(e13) : SN(e13); } function MN(e13) { var r = e13.getBoundingClientRect(), t = Ka(r.width) / e13.offsetWidth || 1, n = Ka(r.height) / e13.offsetHeight || 1; return t !== 1 || n !== 1; } function _N(e13, r, t) { t === void 0 && (t = false); var n = _t(r), a = _t(r) && MN(r), i = Xn(r), o = Ja(e13, 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, true), 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(e13) { var r = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set(), n = []; e13.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 e13.forEach(function(i) { t.has(i.name) || a(i); }), n; } function TN(e13) { var r = FN(e13); return GA.reduce(function(t, n) { return t.concat(r.filter(function(a) { return a.phase === n; })); }, []); } function ON(e13) { var r; return function() { return r || (r = new Promise(function(t) { Promise.resolve().then(function() { r = void 0, t(e13()); }); })), r; }; } function BN(e13) { var r = e13.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 e13 = arguments.length, r = new Array(e13), t = 0; t < e13; t++) r[t] = arguments[t]; return !r.some(function(n) { return !(n && typeof n.getBoundingClientRect == "function"); }); } function Nl(e13) { e13 === void 0 && (e13 = {}); var r = e13, 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 = false, 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 = false, 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 === true) { s.reset = false, A = -1; continue; } var h10 = s.orderedModifiers[A], x = h10.fn, w = h10.options, g = w === void 0 ? {} : w, D = h10.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 = true; } }; 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, h10 = v.effect; if (typeof h10 == "function") { var x = h10({ 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]; var RN = Nl({ defaultModifiers: IN }); var PN = (e13, r, t = {}) => { const n = { name: "updateState", enabled: true, phase: "write", fn: ({ state: u }) => { const s = zN(u); Object.assign(o.value, s); }, requires: ["computeStyles"] }, a = computed(() => { const { onFirstUpdate: u, placement: s, strategy: c, modifiers: f } = unref(t); return { onFirstUpdate: u, placement: s || "bottom", strategy: c || "absolute", modifiers: [ ...f || [], n, { name: "applyStyles", enabled: false } ] }; }), i = shallowRef(), o = ref({ styles: { popper: { position: unref(a).strategy, left: "0", top: "0" }, arrow: { position: "absolute" } }, attributes: {} }), l = () => { i.value && (i.value.destroy(), i.value = void 0); }; return watch(a, (u) => { const s = unref(i); s && s.setOptions(u); }, { deep: true }), watch([e13, r], ([u, s]) => { l(), !(!u || !s) && (i.value = RN(u, s, unref(a))); }), onBeforeUnmount(() => { l(); }), { state: computed(() => { var u; return { ...((u = unref(i)) == null ? void 0 : u.state) || {} }; }), styles: computed(() => unref(o).styles), attributes: computed(() => unref(o).attributes), update: () => { var u; return (u = unref(i)) == null ? void 0 : u.update(); }, forceUpdate: () => { var u; return (u = unref(i)) == null ? void 0 : u.forceUpdate(); }, instanceRef: computed(() => unref(i)) }; }; function zN(e13) { const r = Object.keys(e13.elements), t = Lo(r.map((a) => [a, e13.styles[a] || {}])), n = Lo(r.map((a) => [a, e13.attributes[a]])); return { styles: t, attributes: n }; } function df() { let e13; const r = (n, a) => { t(), e13 = window.setTimeout(n, a); }, t = () => window.clearTimeout(e13); return ds(() => t()), { registerTimeout: r, cancelTimeout: t }; } var Fu = { prefix: Math.floor(Math.random() * 1e4), current: 0 }; var qN = Symbol("elIdInjection"); var i0 = () => getCurrentInstance() ? inject(qN, Fu) : Fu; var As = (e13) => { 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 computed(() => unref(e13) || `${t.value}-id-${r.prefix}-${r.current++}`); }; var Ia = []; var pf = (e13) => { const r = e13; r.key === Za.esc && Ia.forEach((t) => t(r)); }; var LN = (e13) => { onMounted(() => { Ia.length === 0 && document.addEventListener("keydown", pf), Ir && Ia.push(e13); }), onBeforeUnmount(() => { Ia = Ia.filter((r) => r !== e13), Ia.length === 0 && Ir && document.removeEventListener("keydown", pf); }); }; var mf; var o0 = () => { const e13 = vl(), r = i0(), t = computed(() => `${e13.value}-popper-container-${r.prefix}`), n = computed(() => `#${t.value}`); return { id: t, selector: n }; }; var UN = (e13) => { const r = document.createElement("div"); return r.id = e13, document.body.appendChild(r), r; }; var kN = () => { const { id: e13, selector: r } = o0(); return onBeforeMount(() => { Ir && (!mf || !document.body.querySelector(r.value)) && (mf = UN(e13.value)); }), { id: e13, selector: r }; }; var VN = Er({ showAfter: { type: Number, default: 0 }, hideAfter: { type: Number, default: 200 }, autoClose: { type: Number, default: 0 } }); var HN = ({ showAfter: e13, 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 = unref(t); Nr(f) && f > 0 && o(() => { a(c); }, f); }, unref(e13)); }, onClose: (c) => { l(), i(() => { a(c); }, unref(r)); } }; }; var s0 = Symbol("elForwardRef"); var ZN = (e13) => { provide(s0, { setForwardRef: (t) => { e13.value = t; } }); }; var GN = (e13) => ({ mounted(r) { e13(r); }, updated(r) { e13(r); }, unmounted() { e13(null); } }); var vf = { current: 0 }; var hf = ref(0); var u0 = 2e3; var gf = Symbol("elZIndexContextKey"); var l0 = Symbol("zIndexContextKey"); var c0 = (e13) => { const r = getCurrentInstance() ? inject(gf, vf) : vf, t = e13 || (getCurrentInstance() ? inject(l0, void 0) : void 0), n = computed(() => { const o = unref(t); return Nr(o) ? o : u0; }), a = computed(() => n.value + hf.value), i = () => (r.current++, hf.value = r.current, a.value); return !Ir && !inject(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(e13) { let r; function t() { if (e13.value == null) return; const { selectionStart: a, selectionEnd: i, value: o } = e13.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 (e13.value == null || r == null) return; const { value: a } = e13.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); } e13.value.setSelectionRange(u, u); } return [t, n]; } var ja = bs({ type: String, values: Hh, required: false }); var f0 = Symbol("size"); var KN = () => { const e13 = inject(f0, {}); return computed(() => unref(e13.size) || ""); }; function d0(e13, { beforeFocus: r, afterFocus: t, beforeBlur: n, afterBlur: a } = {}) { const i = getCurrentInstance(), { emit: o } = i, l = shallowRef(), u = ref(false), s = (d) => { Xr(r) && r(d) || u.value || (u.value = true, 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 = false, o("blur", d), a == null || a()); }, f = () => { var d, p; (d = l.value) != null && d.contains(document.activeElement) && l.value !== document.activeElement || (p = e13.value) == null || p.focus(); }; return watch(l, (d) => { d && d.setAttribute("tabindex", "-1"); }), tt(l, "focus", s, true), tt(l, "blur", c, true), tt(l, "click", f, true), false, { isFocused: u, wrapperRef: l, handleFocus: s, handleBlur: c }; } function p0({ afterComposition: e13, emit: r }) { const t = ref(false), n = (l) => { r == null || r("compositionstart", l), t.value = true; }, 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 = false, nextTick(() => e13(l))); }; return { isComposing: t, handleComposition: (l) => { l.type === "compositionend" ? i(l) : a(l); }, handleCompositionStart: n, handleCompositionUpdate: a, handleCompositionEnd: i }; } var m0 = Symbol("emptyValuesContextKey"); var JN = "use-empty-values"; var YN = ["", void 0, null]; var jN = void 0; var XN = Er({ emptyValues: Array, valueOnClear: { type: [String, Number, Boolean, Function], default: void 0, validator: (e13) => Xr(e13) ? !e13() : !e13 } }); var QN = (e13, r) => { const t = getCurrentInstance() ? inject(m0, ref({})) : ref({}), n = computed(() => e13.emptyValues || t.value.emptyValues || YN), a = computed(() => Xr(e13.valueOnClear) ? e13.valueOnClear() : e13.valueOnClear !== void 0 ? e13.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 }; }; var eD = Er({ ariaLabel: String, ariaOrientation: { type: String, values: ["horizontal", "vertical", "undefined"] }, ariaControls: String }); var wa = (e13) => Q2(eD, e13); var v0 = Symbol(); var Vo = ref(); function Dl(e13, r = void 0) { const t = getCurrentInstance() ? inject(v0, Vo) : Vo; return e13 ? computed(() => { var n, a; return (a = (n = t.value) == null ? void 0 : n[e13]) != null ? a : r; }) : t; } function rD(e13, r) { const t = Dl(), n = Dr(e13, computed(() => { var l; return ((l = t.value) == null ? void 0 : l.namespace) || To; })), a = ws(computed(() => { var l; return (l = t.value) == null ? void 0 : l.locale; })), i = c0(computed(() => { var l; return ((l = t.value) == null ? void 0 : l.zIndex) || u0; })), o = computed(() => { var l; return unref(r) || ((l = t.value) == null ? void 0 : l.size) || ""; }); return tD(computed(() => unref(t) || {})), { ns: n, locale: a, zIndex: i, size: o }; } var tD = (e13, r, t = false) => { var n; const a = !!getCurrentInstance(), i = a ? Dl() : void 0, o = (n = void 0) != null ? n : a ? provide : void 0; if (!o) { Tr("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup()."); return; } const l = computed(() => { const u = unref(e13); return i != null && i.value ? nD(i.value, u) : u; }); return o(v0, l), o(Zh, computed(() => l.value.locale)), o(Gh, computed(() => l.value.namespace)), o(l0, computed(() => l.value.zIndex)), o(f0, { size: computed(() => l.value.size || "") }), o(m0, computed(() => ({ emptyValues: l.value.emptyValues, valueOnClear: l.value.valueOnClear }))), (t || !Vo.value) && (Vo.value = l.value), l; }; var nD = (e13, r) => { const t = [.../* @__PURE__ */ new Set([...Qc(e13), ...Qc(r)])], n = {}; for (const a of t) n[a] = r[a] !== void 0 ? r[a] : e13[a]; return n; }; var Sr = (e13, r) => { const t = e13.__vccOpts || e13; for (const [n, a] of r) t[n] = a; return t; }; var aD = Er({ size: { type: rr([Number, String]) }, color: { type: String } }); var iD = defineComponent({ name: "ElIcon", inheritAttrs: false }); var oD = defineComponent({ ...iD, props: aD, setup(e13) { const r = e13, t = Dr("icon"), n = computed(() => { const { size: a, color: i } = r; return !a && !i ? {} : { fontSize: yn(a) ? void 0 : Mu(a), "--color": i }; }); return (a, i) => (openBlock(), createElementBlock("i", mergeProps({ class: unref(t).b(), style: unref(n) }, a.$attrs), [ renderSlot(a.$slots, "default") ], 16)); } }); var sD = Sr(oD, [["__file", "icon.vue"]]); var Ct = Bt(sD); var El = Symbol("formContextKey"); var Ho = Symbol("formItemContextKey"); var si = (e13, r = {}) => { const t = ref(void 0), n = r.prop ? t : Wh("size"), a = r.global ? t : KN(), i = r.form ? { size: void 0 } : inject(El, void 0), o = r.formItem ? { size: void 0 } : inject(Ho, void 0); return computed(() => n.value || unref(e13) || (o == null ? void 0 : o.size) || (i == null ? void 0 : i.size) || a.value || ""); }; var Ns = (e13) => { const r = Wh("disabled"), t = inject(El, void 0); return computed(() => r.value || unref(e13) || (t == null ? void 0 : t.disabled) || false); }; var Zi = () => { const e13 = inject(El, void 0), r = inject(Ho, void 0); return { form: e13, formItem: r }; }; var Sl = (e13, { formItemContext: r, disableIdGeneration: t, disableIdManagement: n }) => { t || (t = ref(false)), n || (n = ref(false)); const a = ref(); let i; const o = computed(() => { var l; return !!(!(e13.label || e13.ariaLabel) && r && r.inputIds && ((l = r.inputIds) == null ? void 0 : l.length) <= 1); }); return onMounted(() => { i = watch([toRef(e13, "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: true }); }), onUnmounted(() => { i && i(), r != null && r.removeInputId && a.value && r.removeInputId(a.value); }), { isLabeledByFormItem: o, inputId: a }; }; var It; var uD = ` height:0 !important; visibility:hidden !important; ${nb() ? "" : "overflow:hidden !important;"} position:absolute !important; z-index:-1000 !important; top:0 !important; right:0 !important; `; var 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(e13) { const r = window.getComputedStyle(e13), 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(e13, r = 1, t) { var n; It || (It = document.createElement("textarea"), document.body.appendChild(It)); const { paddingSize: a, borderSize: i, boxSizing: o, contextStyle: l } = cD(e13); It.setAttribute("style", `${l};${uD}`), It.value = e13.value || e13.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; } var 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: false }, 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: true }, inputStyle: { type: rr([Object, Array, String]), default: () => AA({}) }, autofocus: Boolean, rows: { type: Number, default: 2 }, ...wa(["ariaLabel"]) }); var dD = { [Or]: (e13) => wt(e13), input: (e13) => wt(e13), change: (e13) => wt(e13), focus: (e13) => e13 instanceof FocusEvent, blur: (e13) => e13 instanceof FocusEvent, clear: () => true, mouseleave: (e13) => e13 instanceof MouseEvent, mouseenter: (e13) => e13 instanceof MouseEvent, keydown: (e13) => e13 instanceof Event, compositionstart: (e13) => e13 instanceof CompositionEvent, compositionupdate: (e13) => e13 instanceof CompositionEvent, compositionend: (e13) => e13 instanceof CompositionEvent }; var pD = defineComponent({ name: "ElInput", inheritAttrs: false }); var mD = defineComponent({ ...pD, props: fD, emits: dD, setup(e13, { expose: r, emit: t }) { const n = e13, a = useAttrs(), i = useSlots(), o = computed(() => { 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 = computed(() => [ 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 = computed(() => [ v.e("wrapper"), v.is("focus", N.value) ]), s = EA({ excludeKeys: computed(() => 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 = shallowRef(), A = shallowRef(), h10 = ref(false), x = ref(false), w = ref(), g = shallowRef(n.inputStyle), D = computed(() => 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 = computed(() => { var G; return (G = c == null ? void 0 : c.statusIcon) != null ? G : false; }), $ = computed(() => (f == null ? void 0 : f.validateState) || ""), I = computed(() => $.value && Vh[$.value]), B = computed(() => x.value ? bA : dA), C = computed(() => [ a.style ]), _ = computed(() => [ n.inputStyle, g.value, { resize: n.resize } ]), z = computed(() => An(n.modelValue) ? "" : String(n.modelValue)), O = computed(() => n.clearable && !m.value && !n.readonly && !!z.value && (N.value || h10.value)), W = computed(() => n.showPassword && !m.value && !n.readonly && !!z.value && (!!z.value || N.value)), X = computed(() => n.showWordLimit && !!n.maxlength && (n.type === "text" || n.type === "textarea") && !m.value && !n.readonly && !n.showPassword), V = computed(() => z.value.length), R = computed(() => !!X.value && V.value > Number(n.maxlength)), Q = computed(() => !!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 }, nextTick(() => { A.value.offsetHeight, g.value = Ne; }); } else g.value = { minHeight: yf(A.value).minHeight }; }, K = /* @__PURE__ */ ((G) => { let ae = false; return () => { var fe; if (ae || !n.autosize) return; ((fe = A.value) == null ? void 0 : fe.offsetParent) === null || (G(), ae = true); }; })(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 nextTick(), 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 nextTick(), (G = D.value) == null || G.focus(); }, me = () => { var G; return (G = D.value) == null ? void 0 : G.blur(); }, pe = (G) => { h10.value = false, t("mouseleave", G); }, xe = (G) => { h10.value = true, 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 watch(() => n.modelValue, () => { var G; nextTick(() => q()), n.validateEvent && ((G = f == null ? void 0 : f.validate) == null || G.call(f, "change").catch((ae) => Tr(ae))); }), watch(z, () => j()), watch(() => n.type, async () => { await nextTick(), j(), q(); }), onMounted(() => { !n.formatter && n.parser && Tr("ElInput", "If you set the parser, you also need to set the formatter."), j(), nextTick(q); }), r({ input: y, textarea: A, ref: D, textareaStyle: _, autosize: toRef(n, "autosize"), isComposing: oe, focus: ie, blur: me, select: k, clear: J, resizeTextarea: q }), (G, ae) => (openBlock(), createElementBlock("div", mergeProps(unref(o), { class: [ unref(l), { [unref(v).bm("group", "append")]: G.$slots.append, [unref(v).bm("group", "prepend")]: G.$slots.prepend } ], style: unref(C), role: G.containerRole, onMouseenter: xe, onMouseleave: pe }), [ createCommentVNode(" input "), G.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ createCommentVNode(" prepend slot "), G.$slots.prepend ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(unref(v).be("group", "prepend")) }, [ renderSlot(G.$slots, "prepend") ], 2)) : createCommentVNode("v-if", true), createBaseVNode("div", { ref_key: "wrapperRef", ref: E, class: normalizeClass(unref(u)) }, [ createCommentVNode(" prefix slot "), G.$slots.prefix || G.prefixIcon ? (openBlock(), createElementBlock("span", { key: 0, class: normalizeClass(unref(v).e("prefix")) }, [ createBaseVNode("span", { class: normalizeClass(unref(v).e("prefix-inner")) }, [ renderSlot(G.$slots, "prefix"), G.prefixIcon ? (openBlock(), createBlock(unref(Ct), { key: 0, class: normalizeClass(unref(v).e("icon")) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(G.prefixIcon))) ]), _: 1 }, 8, ["class"])) : createCommentVNode("v-if", true) ], 2) ], 2)) : createCommentVNode("v-if", true), createBaseVNode("input", mergeProps({ id: unref(d), ref_key: "input", ref: y, class: unref(v).e("inner") }, unref(s), { minlength: G.minlength, maxlength: G.maxlength, type: G.showPassword ? x.value ? "text" : "password" : G.type, disabled: unref(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: unref(ge), onCompositionupdate: unref(L), onCompositionend: unref(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"]), createCommentVNode(" suffix slot "), unref(Q) ? (openBlock(), createElementBlock("span", { key: 1, class: normalizeClass(unref(v).e("suffix")) }, [ createBaseVNode("span", { class: normalizeClass(unref(v).e("suffix-inner")) }, [ !unref(O) || !unref(W) || !unref(X) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ renderSlot(G.$slots, "suffix"), G.suffixIcon ? (openBlock(), createBlock(unref(Ct), { key: 0, class: normalizeClass(unref(v).e("icon")) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(G.suffixIcon))) ]), _: 1 }, 8, ["class"])) : createCommentVNode("v-if", true) ], 64)) : createCommentVNode("v-if", true), unref(O) ? (openBlock(), createBlock(unref(Ct), { key: 1, class: normalizeClass([unref(v).e("icon"), unref(v).e("clear")]), onMousedown: withModifiers(unref(Fi), ["prevent"]), onClick: J }, { default: withCtx(() => [ createVNode(unref(pl)) ]), _: 1 }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true), unref(W) ? (openBlock(), createBlock(unref(Ct), { key: 2, class: normalizeClass([unref(v).e("icon"), unref(v).e("password")]), onClick: ne }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(unref(B)))) ]), _: 1 }, 8, ["class"])) : createCommentVNode("v-if", true), unref(X) ? (openBlock(), createElementBlock("span", { key: 3, class: normalizeClass(unref(v).e("count")) }, [ createBaseVNode("span", { class: normalizeClass(unref(v).e("count-inner")) }, toDisplayString(unref(V)) + " / " + toDisplayString(G.maxlength), 3) ], 2)) : createCommentVNode("v-if", true), unref($) && unref(I) && unref(F) ? (openBlock(), createBlock(unref(Ct), { key: 4, class: normalizeClass([ unref(v).e("icon"), unref(v).e("validateIcon"), unref(v).is("loading", unref($) === "validating") ]) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(unref(I)))) ]), _: 1 }, 8, ["class"])) : createCommentVNode("v-if", true) ], 2) ], 2)) : createCommentVNode("v-if", true) ], 2), createCommentVNode(" append slot "), G.$slots.append ? (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass(unref(v).be("group", "append")) }, [ renderSlot(G.$slots, "append") ], 2)) : createCommentVNode("v-if", true) ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [ createCommentVNode(" textarea "), createBaseVNode("textarea", mergeProps({ id: unref(d), ref_key: "textarea", ref: A, class: [unref(b).e("inner"), unref(v).is("focus", unref(N))] }, unref(s), { minlength: G.minlength, maxlength: G.maxlength, tabindex: G.tabindex, disabled: unref(m), readonly: G.readonly, autocomplete: G.autocomplete, style: unref(_), "aria-label": G.ariaLabel, placeholder: G.placeholder, form: G.form, autofocus: G.autofocus, rows: G.rows, onCompositionstart: unref(ge), onCompositionupdate: unref(L), onCompositionend: unref(H), onInput: ee, onFocus: unref(S), onBlur: unref(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"]), unref(X) ? (openBlock(), createElementBlock("span", { key: 0, style: normalizeStyle(w.value), class: normalizeClass(unref(v).e("count")) }, toDisplayString(unref(V)) + " / " + toDisplayString(G.maxlength), 7)) : createCommentVNode("v-if", true) ], 64)) ], 16, ["role"])); } }); var vD = Sr(mD, [["__file", "input.vue"]]); var hD = Bt(vD); var Ca = 4; var 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" } }; var yD = ({ move: e13, size: r, bar: t }) => ({ [t.size]: r, transform: `translate${t.axis}(${e13}%)` }); var Cl = Symbol("scrollbarContextKey"); var bD = Er({ vertical: Boolean, size: String, move: Number, ratio: { type: Number, required: true }, always: Boolean }); var wD = "Thumb"; var xD = defineComponent({ __name: "thumb", props: bD, setup(e13) { const r = e13, t = inject(Cl), n = Dr("scrollbar"); t || dl(wD, "can not inject scrollbar context"); const a = ref(), i = ref(), o = ref({}), l = ref(false); let u = false, s = false, c = Ir ? document.onselectstart : null; const f = computed(() => gD[r.vertical ? "vertical" : "horizontal"]), d = computed(() => yD({ size: r.size, move: r.move, bar: f.value })), p = computed(() => 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 = true, document.addEventListener("mousemove", y), document.addEventListener("mouseup", A), c = document.onselectstart, document.onselectstart = () => false; }, y = (g) => { if (!a.value || !i.value || u === false) 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 = false, o.value[f.value.axis] = 0, document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", A), w(), s && (l.value = false); }, h10 = () => { s = false, l.value = !!r.size; }, x = () => { s = true, l.value = u; }; onBeforeUnmount(() => { w(), document.removeEventListener("mouseup", A); }); const w = () => { document.onselectstart !== c && (document.onselectstart = c); }; return tt(toRef(t, "scrollbarElement"), "mousemove", h10), tt(toRef(t, "scrollbarElement"), "mouseleave", x), (g, D) => (openBlock(), createBlock(Transition, { name: unref(n).b("fade"), persisted: "" }, { default: withCtx(() => [ withDirectives(createBaseVNode("div", { ref_key: "instance", ref: a, class: normalizeClass([unref(n).e("bar"), unref(n).is(unref(f).key)]), onMousedown: v }, [ createBaseVNode("div", { ref_key: "thumb", ref: i, class: normalizeClass(unref(n).e("thumb")), style: normalizeStyle(unref(d)), onMousedown: m }, null, 38) ], 34), [ [vShow, g.always || l.value] ]) ]), _: 1 }, 8, ["name"])); } }); var bf = Sr(xD, [["__file", "thumb.vue"]]); var AD = Er({ always: { type: Boolean, default: true }, minSize: { type: Number, required: true } }); var ND = defineComponent({ __name: "bar", props: AD, setup(e13, { expose: r }) { const t = e13, n = inject(Cl), a = ref(0), i = ref(0), o = ref(""), l = ref(""), u = ref(1), s = ref(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) => (openBlock(), createElementBlock(Fragment, null, [ createVNode(bf, { move: a.value, ratio: s.value, size: o.value, always: d.always }, null, 8, ["move", "ratio", "size", "always"]), createVNode(bf, { move: i.value, ratio: u.value, size: l.value, vertical: "", always: d.always }, null, 8, ["move", "ratio", "size", "always"]) ], 64)); } }); var DD = Sr(ND, [["__file", "bar.vue"]]); var ED = Er({ height: { type: [String, Number], default: "" }, maxHeight: { type: [String, Number], default: "" }, native: { type: Boolean, default: false }, 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"]) }); var SD = { scroll: ({ scrollTop: e13, scrollLeft: r }) => [e13, r].every(Nr) }; var Tu = "ElScrollbar"; var CD = defineComponent({ name: Tu }); var MD = defineComponent({ ...CD, props: ED, emits: SD, setup(e13, { expose: r, emit: t }) { const n = e13, a = Dr("scrollbar"); let i, o, l = 0, u = 0; const s = ref(), c = ref(), f = ref(), d = ref(), p = computed(() => { const w = {}; return n.height && (w.height = Mu(n.height)), n.maxHeight && (w.maxHeight = Mu(n.maxHeight)), [n.wrapStyle, w]; }), m = computed(() => [ n.wrapClass, a.e("wrap"), { [a.em("wrap", "hidden-default")]: !n.native } ]), v = computed(() => [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; }, h10 = (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 watch(() => n.noresize, (w) => { w ? (i == null || i(), o == null || o()) : ({ stop: i } = mn(f, x), o = tt("resize", x)); }, { immediate: true }), watch(() => [n.maxHeight, n.height], () => { n.native || nextTick(() => { var w; x(), c.value && ((w = d.value) == null || w.handleScroll(c.value)); }); }), provide(Cl, reactive({ scrollbarElement: s, wrapElement: c })), onActivated(() => { c.value && (c.value.scrollTop = l, c.value.scrollLeft = u); }), onMounted(() => { n.native || nextTick(() => { x(); }); }), onUpdated(() => x()), r({ wrapRef: c, update: x, scrollTo: y, setScrollTop: A, setScrollLeft: h10, handleScroll: b }), (w, g) => (openBlock(), createElementBlock("div", { ref_key: "scrollbarRef", ref: s, class: normalizeClass(unref(a).b()) }, [ createBaseVNode("div", { ref_key: "wrapRef", ref: c, class: normalizeClass(unref(m)), style: normalizeStyle(unref(p)), tabindex: w.tabindex, onScroll: b }, [ (openBlock(), createBlock(resolveDynamicComponent(w.tag), { id: w.id, ref_key: "resizeRef", ref: f, class: normalizeClass(unref(v)), style: normalizeStyle(w.viewStyle), role: w.role, "aria-label": w.ariaLabel, "aria-orientation": w.ariaOrientation }, { default: withCtx(() => [ renderSlot(w.$slots, "default") ]), _: 3 }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"])) ], 46, ["tabindex"]), w.native ? createCommentVNode("v-if", true) : (openBlock(), createBlock(DD, { key: 0, ref_key: "barRef", ref: d, always: w.always, "min-size": w.minSize }, null, 8, ["always", "min-size"])) ], 2)); } }); var _D = Sr(MD, [["__file", "scrollbar.vue"]]); var FD = Bt(_D); var Ml = Symbol("popper"); var h0 = Symbol("popperContent"); var TD = [ "dialog", "grid", "group", "listbox", "menu", "navigation", "tooltip", "tree" ]; var g0 = Er({ role: { type: String, values: TD, default: "tooltip" } }); var OD = defineComponent({ name: "ElPopper", inheritAttrs: false }); var BD = defineComponent({ ...OD, props: g0, setup(e13, { expose: r }) { const t = e13, n = ref(), a = ref(), i = ref(), o = ref(), l = computed(() => t.role), u = { triggerRef: n, popperInstanceRef: a, contentRef: i, referenceRef: o, role: l }; return r(u), provide(Ml, u), (s, c) => renderSlot(s.$slots, "default"); } }); var $D = Sr(BD, [["__file", "popper.vue"]]); var y0 = Er({ arrowOffset: { type: Number, default: 5 } }); var ID = defineComponent({ name: "ElPopperArrow", inheritAttrs: false }); var RD = defineComponent({ ...ID, props: y0, setup(e13, { expose: r }) { const t = e13, n = Dr("popper"), { arrowOffset: a, arrowRef: i, arrowStyle: o } = inject(h0, void 0); return watch(() => t.arrowOffset, (l) => { a.value = l; }), onBeforeUnmount(() => { i.value = void 0; }), r({ arrowRef: i }), (l, u) => (openBlock(), createElementBlock("span", { ref_key: "arrowRef", ref: i, class: normalizeClass(unref(n).e("arrow")), style: normalizeStyle(unref(o)), "data-popper-arrow": "" }, null, 6)); } }); var PD = Sr(RD, [["__file", "arrow.vue"]]); var ru = "ElOnlyChild"; var zD = defineComponent({ name: ru, setup(e13, { slots: r, attrs: t }) { var n; const a = inject(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 ? withDirectives(cloneVNode(u, t), [[i]]) : (Tr(ru, "no valid child node found"), null); }; } }); function b0(e13) { if (!e13) return null; const r = e13; for (const t of r) { if (dt(t)) switch (t.type) { case Comment: continue; case Text: case "svg": return wf(t); case Fragment: return b0(t.children); default: return t; } return wf(t); } return null; } function wf(e13) { const r = Dr("only-child"); return createVNode("span", { class: r.e("content") }, [e13]); } var 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 }); var qD = defineComponent({ name: "ElPopperTrigger", inheritAttrs: false }); var LD = defineComponent({ ...qD, props: w0, setup(e13, { expose: r }) { const t = e13, { role: n, triggerRef: a } = inject(Ml, void 0); ZN(a); const i = computed(() => l.value ? t.id : void 0), o = computed(() => { if (n && n.value === "tooltip") return t.open && t.id ? t.id : void 0; }), l = computed(() => { if (n && n.value !== "tooltip") return n.value; }), u = computed(() => l.value ? `${t.open}` : void 0); let s; const c = [ "onMouseenter", "onMouseleave", "onClick", "onKeydown", "onFocus", "onBlur", "onContextmenu" ]; return onMounted(() => { watch(() => t.virtualRef, (f) => { f && (a.value = gn(f)); }, { immediate: true }), watch(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 = watch([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: true })), la(d) && [ "aria-controls", "aria-describedby", "aria-haspopup", "aria-expanded" ].forEach((p) => d.removeAttribute(p)); }, { immediate: true }); }), onBeforeUnmount(() => { 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 ? createCommentVNode("v-if", true) : (openBlock(), createBlock(unref(zD), mergeProps({ key: 0 }, f.$attrs, { "aria-controls": unref(i), "aria-describedby": unref(o), "aria-expanded": unref(u), "aria-haspopup": unref(l) }), { default: withCtx(() => [ renderSlot(f.$slots, "default") ]), _: 3 }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])); } }); var UD = Sr(LD, [["__file", "trigger.vue"]]); var tu = "focus-trap.focus-after-trapped"; var nu = "focus-trap.focus-after-released"; var kD = "focus-trap.focusout-prevented"; var xf = { cancelable: true, bubbles: false }; var VD = { cancelable: true, bubbles: false }; var Af = "focusAfterTrapped"; var Nf = "focusAfterReleased"; var HD = Symbol("elFocusTrap"); var _l = ref(); var Ds = ref(0); var Fl = ref(0); var ao = 0; var x0 = (e13) => { const r = [], t = document.createTreeWalker(e13, 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; }; var Df = (e13, r) => { for (const t of e13) if (!ZD(t, r)) return t; }; var ZD = (e13, r) => { if (false) return false; if (getComputedStyle(e13).visibility === "hidden") return true; for (; e13; ) { if (r && e13 === r) return false; if (getComputedStyle(e13).display === "none") return true; e13 = e13.parentElement; } return false; }; var GD = (e13) => { const r = x0(e13), t = Df(r, e13), n = Df(r.reverse(), e13); return [t, n]; }; var WD = (e13) => e13 instanceof HTMLInputElement && "select" in e13; var In = (e13, r) => { if (e13 && e13.focus) { const t = document.activeElement; e13.focus({ preventScroll: true }), Fl.value = window.performance.now(), e13 !== t && WD(e13) && r && e13.select(); } }; function Ef(e13, r) { const t = [...e13], n = e13.indexOf(r); return n !== -1 && t.splice(n, 1), t; } var KD = () => { let e13 = []; return { push: (n) => { const a = e13[0]; a && n !== a && a.pause(), e13 = Ef(e13, n), e13.unshift(n); }, remove: (n) => { var a, i; e13 = Ef(e13, n), (i = (a = e13[0]) == null ? void 0 : a.resume) == null || i.call(a); } }; }; var JD = (e13, r = false) => { const t = document.activeElement; for (const n of e13) if (In(n, r), document.activeElement !== t) return; }; var Sf = KD(); var YD = () => Ds.value > Fl.value; var io = () => { _l.value = "pointer", Ds.value = window.performance.now(); }; var Cf = () => { _l.value = "keyboard", Ds.value = window.performance.now(); }; var jD = () => (onMounted(() => { ao === 0 && (document.addEventListener("mousedown", io), document.addEventListener("touchstart", io), document.addEventListener("keydown", Cf)), ao++; }), onBeforeUnmount(() => { ao--, ao <= 0 && (document.removeEventListener("mousedown", io), document.removeEventListener("touchstart", io), document.removeEventListener("keydown", Cf)); }), { focusReason: _l, lastUserFocusTimestamp: Ds, lastAutomatedFocusTimestamp: Fl }); var oo = (e13) => new CustomEvent(kD, { ...VD, detail: e13 }); var XD = defineComponent({ name: "ElFocusTrap", inheritAttrs: false, props: { loop: Boolean, trapped: Boolean, focusTrapEl: Object, focusStartEl: { type: [Object, String], default: "first" } }, emits: [ Af, Nf, "focusin", "focusout", "focusout-prevented", "release-requested" ], setup(e13, { emit: r }) { const t = ref(); let n, a; const { focusReason: i } = jD(); LN((m) => { e13.trapped && !o.paused && r("release-requested", m); }); const o = { paused: false, pause() { this.paused = true; }, resume() { this.paused = false; } }, l = (m) => { if (!e13.loop && !e13.trapped || o.paused) return; const { key: v, altKey: b, ctrlKey: y, metaKey: A, currentTarget: h10, shiftKey: x } = m, { loop: w } = e13, g = v === Za.tab && !b && !y && !A, D = document.activeElement; if (g && D) { const E = h10, [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, true)); } else if (x && [N, E].includes(D)) { const F = oo({ focusReason: i.value }); r("focusout-prevented", F), F.defaultPrevented || (m.preventDefault(), w && In(S, true)); } } else if (D === E) { const F = oo({ focusReason: i.value }); r("focusout-prevented", F), F.defaultPrevented || m.preventDefault(); } } }; provide(HD, { focusTrapRef: t, onKeydown: l }), watch(() => e13.focusTrapEl, (m) => { m && (t.value = m); }, { immediate: true }), watch([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 = unref(t); if (!v) return; const b = m.target, y = m.relatedTarget, A = b && v.contains(b); e13.trapped || y && v.contains(y) || (n = y), A && r("focusin", m), !o.paused && e13.trapped && (A ? a = b : In(a, true)); }, f = (m) => { const v = unref(t); if (!(o.paused || !v)) if (e13.trapped) { const b = m.relatedTarget; !An(b) && !v.contains(b) && setTimeout(() => { if (!o.paused && e13.trapped) { const y = oo({ focusReason: i.value }); r("focusout-prevented", y), y.defaultPrevented || In(a, true); } }, 0); } else { const b = m.target; b && v.contains(b) || r("focusout", m); } }; async function d() { await nextTick(); const m = unref(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 || nextTick(() => { let A = e13.focusStartEl; wt(A) || (In(A), document.activeElement !== A && (A = "first")), A === "first" && JD(x0(m), true), (document.activeElement === v || A === "container") && In(m); }); } } } function p() { const m = unref(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 onMounted(() => { e13.trapped && d(), watch(() => e13.trapped, (m) => { m ? d() : p(); }); }), onBeforeUnmount(() => { e13.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(e13, r, t, n, a, i) { return renderSlot(e13.$slots, "default", { handleKeydown: e13.onKeydown }); } var eE = Sr(XD, [["render", QD], ["__file", "focus-trap.vue"]]); var rE = ["fixed", "absolute"]; var tE = Er({ boundariesPadding: { type: Number, default: 0 }, fallbackPlacements: { type: rr(Array), default: void 0 }, gpuAcceleration: { type: Boolean, default: true }, offset: { type: Number, default: 12 }, placement: { type: String, values: oi, default: "bottom" }, popperOptions: { type: rr(Object), default: () => ({}) }, strategy: { type: String, values: rE, default: "absolute" } }); var 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: true }, pure: Boolean, focusOnShow: { type: Boolean, default: false }, trapping: { type: Boolean, default: false }, popperClass: { type: rr([String, Array, Object]) }, popperStyle: { type: rr([String, Array, Object]) }, referenceEl: { type: rr(Object) }, triggerTargetEl: { type: rr(Object) }, stopPopperMouseEvent: { type: Boolean, default: true }, virtualTriggering: Boolean, zIndex: Number, ...wa(["ariaLabel"]) }); var nE = { mouseenter: (e13) => e13 instanceof MouseEvent, mouseleave: (e13) => e13 instanceof MouseEvent, focus: () => true, blur: () => true, close: () => true }; var aE = (e13, r = []) => { const { placement: t, strategy: n, popperOptions: a } = e13, i = { placement: t, strategy: n, ...a, modifiers: [...oE(e13), ...r] }; return sE(i, a == null ? void 0 : a.modifiers), i; }; var iE = (e13) => { if (Ir) return gn(e13); }; function oE(e13) { const { offset: r, gpuAcceleration: t, fallbackPlacements: n } = e13; 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(e13, r) { r && (e13.modifiers = [...e13.modifiers, ...r ?? []]); } var uE = 0; var lE = (e13) => { const { popperInstanceRef: r, contentRef: t, triggerRef: n, role: a } = inject(Ml, void 0), i = ref(), o = ref(), l = computed(() => ({ name: "eventListeners", enabled: !!e13.visible })), u = computed(() => { var y; const A = unref(i), h10 = (y = unref(o)) != null ? y : uE; return { name: "arrow", enabled: !J2(A), options: { element: A, padding: h10 } }; }), s = computed(() => ({ onFirstUpdate: () => { m(); }, ...aE(e13, [ unref(u), unref(l) ]) })), c = computed(() => iE(e13.referenceEl) || unref(n)), { attributes: f, state: d, styles: p, update: m, forceUpdate: v, instanceRef: b } = PN(c, t, s); return watch(b, (y) => r.value = y), onMounted(() => { watch(() => { var y; return (y = unref(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 }; }; var cE = (e13, { attributes: r, styles: t, role: n }) => { const { nextZIndex: a } = c0(), i = Dr("popper"), o = computed(() => unref(r).popper), l = ref(Nr(e13.zIndex) ? e13.zIndex : a()), u = computed(() => [ i.b(), i.is("pure", e13.pure), i.is(e13.effect), e13.popperClass ]), s = computed(() => [ { zIndex: unref(l) }, unref(t).popper, e13.popperStyle || {} ]), c = computed(() => n.value === "dialog" ? "false" : void 0), f = computed(() => unref(t).arrow || {}); return { ariaModal: c, arrowStyle: f, contentAttrs: o, contentClass: u, contentStyle: s, contentZIndex: l, updateZIndex: () => { l.value = Nr(e13.zIndex) ? e13.zIndex : a(); } }; }; var fE = (e13, r) => { const t = ref(false), n = ref(); 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) => { e13.visible && !t.value && (s.target && (n.value = s.target), t.value = true); }, onFocusoutPrevented: (s) => { e13.trapping || (s.detail.focusReason === "pointer" && s.preventDefault(), t.value = false); }, onReleaseRequested: () => { t.value = false, r("close"); } }; }; var dE = defineComponent({ name: "ElPopperContent" }); var pE = defineComponent({ ...dE, props: A0, emits: nE, setup(e13, { expose: r, emit: t }) { const n = e13, { 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: h10, contentAttrs: x, contentClass: w, contentStyle: g, updateZIndex: D } = cE(n, { styles: m, attributes: f, role: b }), E = inject(Ho, void 0), N = ref(); provide(h0, { arrowStyle: h10, arrowRef: d, arrowOffset: N }), E && provide(Ho, { ...E, addInputId: Fi, removeInputId: Fi }); let S; const M = ($ = true) => { y(), $ && D(); }, F = () => { M(false), n.visible && n.focusOnShow ? i.value = true : n.visible === false && (i.value = false); }; return onMounted(() => { watch(() => n.triggerTargetEl, ($, I) => { S == null || S(), S = void 0; const B = unref($ || p.value), C = unref(I || p.value); la(B) && (S = watch([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: true })), C !== B && la(C) && ["role", "aria-label", "aria-modal", "id"].forEach((_) => { C.removeAttribute(_); }); }, { immediate: true }), watch(() => n.visible, F, { immediate: true }); }), onBeforeUnmount(() => { S == null || S(), S = void 0; }), r({ popperContentRef: p, popperInstanceRef: v, updatePopper: M, contentStyle: g }), ($, I) => (openBlock(), createElementBlock("div", mergeProps({ ref_key: "contentRef", ref: p }, unref(x), { style: unref(g), class: unref(w), tabindex: "-1", onMouseenter: (B) => $.$emit("mouseenter", B), onMouseleave: (B) => $.$emit("mouseleave", B) }), [ createVNode(unref(eE), { trapped: unref(i), "trap-on-focus-in": true, "focus-trap-el": unref(p), "focus-start-el": unref(a), onFocusAfterTrapped: unref(l), onFocusAfterReleased: unref(o), onFocusin: unref(u), onFocusoutPrevented: unref(s), onReleaseRequested: unref(c) }, { default: withCtx(() => [ renderSlot($.$slots, "default") ]), _: 3 }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"]) ], 16, ["onMouseenter", "onMouseleave"])); } }); var mE = Sr(pE, [["__file", "content.vue"]]); var vE = Bt($D); var Tl = Symbol("elTooltip"); var 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: true }, disabled: Boolean, ...wa(["ariaLabel"]) }); var N0 = Er({ ...w0, disabled: Boolean, trigger: { type: rr([String, Array]), default: "hover" }, triggerKeys: { type: rr(Array), default: () => [Za.enter, Za.space] } }); var { useModelToggleProps: hE, useModelToggleEmits: gE, useModelToggle: yE } = $A("visible"); var bE = Er({ ...g0, ...hE, ...Ol, ...N0, ...y0, showArrow: { type: Boolean, default: true } }); var wE = [ ...gE, "before-show", "before-hide", "show", "hide", "open", "close" ]; var xE = (e13, r) => Yt(e13) ? e13.includes(r) : e13 === r; var Ma = (e13, r, t) => (n) => { xE(unref(e13), r) && t(n); }; var AE = defineComponent({ name: "ElTooltipTrigger" }); var NE = defineComponent({ ...AE, props: N0, setup(e13, { expose: r }) { const t = e13, n = Dr("tooltip"), { controlled: a, id: i, open: o, onOpen: l, onClose: u, onToggle: s } = inject(Tl, void 0), c = ref(null), f = () => { if (unref(a) || t.disabled) return true; }, d = toRef(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); })), h10 = pn(f, (x) => { const { code: w } = x; t.triggerKeys.includes(w) && (x.preventDefault(), s(x)); }); return r({ triggerRef: c }), (x, w) => (openBlock(), createBlock(unref(UD), { id: unref(i), "virtual-ref": x.virtualRef, open: unref(o), "virtual-triggering": x.virtualTriggering, class: normalizeClass(unref(n).e("trigger")), onBlur: unref(y), onClick: unref(v), onContextmenu: unref(A), onFocus: unref(b), onMouseenter: unref(p), onMouseleave: unref(m), onKeydown: unref(h10) }, { default: withCtx(() => [ renderSlot(x.$slots, "default") ]), _: 3 }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"])); } }); var DE = Sr(NE, [["__file", "trigger.vue"]]); var EE = Er({ to: { type: rr([String, Object]), required: true }, disabled: Boolean }); var SE = defineComponent({ __name: "teleport", props: EE, setup(e13) { return (r, t) => r.disabled ? renderSlot(r.$slots, "default", { key: 0 }) : (openBlock(), createBlock(Teleport, { key: 1, to: r.to }, [ renderSlot(r.$slots, "default") ], 8, ["to"])); } }); var CE = Sr(SE, [["__file", "teleport.vue"]]); var ME = Bt(CE); var _E = defineComponent({ name: "ElTooltipContent", inheritAttrs: false }); var FE = defineComponent({ ..._E, props: Ol, setup(e13, { expose: r }) { const t = e13, { selector: n } = o0(), a = Dr("tooltip"), i = ref(null); let o; const { controlled: l, id: u, open: s, trigger: c, onClose: f, onOpen: d, onShow: p, onHide: m, onBeforeShow: v, onBeforeHide: b } = inject(Tl, void 0), y = computed(() => t.transition || `${a.namespace.value}-fade-in-linear`), A = computed(() => false ? true : t.persistent); onBeforeUnmount(() => { o == null || o(); }); const h10 = computed(() => unref(A) ? true : unref(s)), x = computed(() => t.disabled ? false : unref(s)), w = computed(() => t.appendTo || n.value), g = computed(() => { var C; return (C = t.style) != null ? C : {}; }), D = ref(true), E = () => { m(), D.value = true; }, N = () => { if (unref(l)) return true; }, S = pn(N, () => { t.enterable && unref(c) === "hover" && d(); }), M = pn(N, () => { unref(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(computed(() => { var C; return (C = i.value) == null ? void 0 : C.popperContentRef; }), () => { if (unref(l)) return; unref(c) !== "hover" && f(); }); }, B = () => { t.virtualTriggering || f(); }; return watch(() => unref(s), (C) => { C ? D.value = false : o == null || o(); }, { flush: "post" }), watch(() => t.content, () => { var C, _; (_ = (C = i.value) == null ? void 0 : C.updatePopper) == null || _.call(C); }), r({ contentRef: i }), (C, _) => (openBlock(), createBlock(unref(ME), { disabled: !C.teleported, to: unref(w) }, { default: withCtx(() => [ createVNode(Transition, { name: unref(y), onAfterLeave: E, onBeforeEnter: F, onAfterEnter: I, onBeforeLeave: $ }, { default: withCtx(() => [ unref(h10) ? withDirectives((openBlock(), createBlock(unref(mE), mergeProps({ key: 0, id: unref(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, unref(g)], "reference-el": C.referenceEl, "trigger-target-el": C.triggerTargetEl, visible: unref(x), "z-index": C.zIndex, onMouseenter: unref(S), onMouseleave: unref(M), onBlur: B, onClose: unref(f) }), { default: withCtx(() => [ renderSlot(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"])), [ [vShow, unref(x)] ]) : createCommentVNode("v-if", true) ]), _: 3 }, 8, ["name"]) ]), _: 3 }, 8, ["disabled", "to"])); } }); var TE = Sr(FE, [["__file", "content.vue"]]); var OE = defineComponent({ name: "ElTooltip" }); var BE = defineComponent({ ...OE, props: bE, emits: wE, setup(e13, { expose: r, emit: t }) { const n = e13; kN(); const a = As(), i = ref(), o = ref(), l = () => { var y; const A = unref(i); A && ((y = A.popperInstanceRef) == null || y.update()); }, u = ref(false), s = ref(), { show: c, hide: f, hasUpdateHandler: d } = yE({ indicator: u, toggleReason: s }), { onOpen: p, onClose: m } = HN({ showAfter: toRef(n, "showAfter"), hideAfter: toRef(n, "hideAfter"), autoClose: toRef(n, "autoClose"), open: c, close: f }), v = computed(() => Ph(n.visible) && !d.value); provide(Tl, { controlled: v, id: a, open: readonly(u), trigger: toRef(n, "trigger"), onOpen: (y) => { p(y); }, onClose: (y) => { m(y); }, onToggle: (y) => { unref(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 }), watch(() => n.disabled, (y) => { y && u.value && (u.value = false); }); const b = (y) => { var A, h10; const x = (h10 = (A = o.value) == null ? void 0 : A.contentRef) == null ? void 0 : h10.popperContentRef, w = (y == null ? void 0 : y.relatedTarget) || document.activeElement; return x && x.contains(w); }; return onDeactivated(() => u.value && f()), r({ popperRef: i, contentRef: o, isFocusInsideContent: b, updatePopper: l, onOpen: p, onClose: m, hide: f }), (y, A) => (openBlock(), createBlock(unref(vE), { ref_key: "popperRef", ref: i, role: y.role }, { default: withCtx(() => [ createVNode(DE, { disabled: y.disabled, trigger: y.trigger, "trigger-keys": y.triggerKeys, "virtual-ref": y.virtualRef, "virtual-triggering": y.virtualTriggering }, { default: withCtx(() => [ y.$slots.default ? renderSlot(y.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true) ]), _: 3 }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]), createVNode(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: withCtx(() => [ renderSlot(y.$slots, "content", {}, () => [ y.rawContent ? (openBlock(), createElementBlock("span", { key: 0, innerHTML: y.content }, null, 8, ["innerHTML"])) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(y.content), 1)) ]), y.showArrow ? (openBlock(), createBlock(unref(PD), { key: 0, "arrow-offset": y.arrowOffset }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true) ]), _: 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 = Sr(BE, [["__file", "tooltip.vue"]]); var D0 = Bt($E); var E0 = Symbol("buttonGroupContextKey"); var IE = (e13, 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" }, computed(() => e13.type === "text")); const t = inject(E0, void 0), n = Dl("button"), { form: a } = Zi(), i = si(computed(() => t == null ? void 0 : t.size)), o = Ns(), l = ref(), u = useSlots(), s = computed(() => e13.type || (t == null ? void 0 : t.type) || ""), c = computed(() => { var m, v, b; return (b = (v = e13.autoInsertSpace) != null ? v : (m = n.value) == null ? void 0 : m.autoInsertSpace) != null ? b : false; }), f = computed(() => e13.tag === "button" ? { ariaDisabled: o.value || e13.loading, disabled: o.value || e13.loading, autofocus: e13.autofocus, type: e13.nativeType } : {}), d = computed(() => { 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) === Text) { const y = b.children; return new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(y.trim()); } } return false; }); return { _disabled: o, _size: i, _type: s, _ref: l, _props: f, shouldAddSpace: d, handleClick: (m) => { if (o.value || e13.loading) { m.stopPropagation(); return; } e13.nativeType === "reset" && (a == null || a.resetFields()), r("click", m); } }; }; var RE = [ "default", "primary", "success", "warning", "info", "danger", "text", "" ]; var PE = ["button", "submit", "reset"]; var 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" } }); var zE = { click: (e13) => e13 instanceof MouseEvent }; function Zr(e13, r) { qE(e13) && (e13 = "100%"); var t = LE(e13); return e13 = r === 360 ? e13 : Math.min(r, Math.max(0, parseFloat(e13))), t && (e13 = parseInt(String(e13 * r), 10) / 100), Math.abs(e13 - r) < 1e-6 ? 1 : (r === 360 ? e13 = (e13 < 0 ? e13 % r + r : e13 % r) / parseFloat(String(r)) : e13 = e13 % r / parseFloat(String(r)), e13); } function so(e13) { return Math.min(1, Math.max(0, e13)); } function qE(e13) { return typeof e13 == "string" && e13.indexOf(".") !== -1 && parseFloat(e13) === 1; } function LE(e13) { return typeof e13 == "string" && e13.indexOf("%") !== -1; } function S0(e13) { return e13 = parseFloat(e13), (isNaN(e13) || e13 < 0 || e13 > 1) && (e13 = 1), e13; } function uo(e13) { return e13 <= 1 ? "".concat(Number(e13) * 100, "%") : e13; } function sa(e13) { return e13.length === 1 ? "0" + e13 : String(e13); } function UE(e13, r, t) { return { r: Zr(e13, 255) * 255, g: Zr(r, 255) * 255, b: Zr(t, 255) * 255 }; } function Mf(e13, r, t) { e13 = Zr(e13, 255), r = Zr(r, 255), t = Zr(t, 255); var n = Math.max(e13, r, t), a = Math.min(e13, 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 e13: i = (r - t) / u + (r < t ? 6 : 0); break; case r: i = (t - e13) / u + 2; break; case t: i = (e13 - r) / u + 4; break; } i /= 6; } return { h: i, s: o, l }; } function au(e13, r, t) { return t < 0 && (t += 1), t > 1 && (t -= 1), t < 1 / 6 ? e13 + (r - e13) * (6 * t) : t < 1 / 2 ? r : t < 2 / 3 ? e13 + (r - e13) * (2 / 3 - t) * 6 : e13; } function kE(e13, r, t) { var n, a, i; if (e13 = Zr(e13, 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, e13 + 1 / 3), a = au(l, o, e13), i = au(l, o, e13 - 1 / 3); } return { r: n * 255, g: a * 255, b: i * 255 }; } function _f(e13, r, t) { e13 = Zr(e13, 255), r = Zr(r, 255), t = Zr(t, 255); var n = Math.max(e13, r, t), a = Math.min(e13, r, t), i = 0, o = n, l = n - a, u = n === 0 ? 0 : l / n; if (n === a) i = 0; else { switch (n) { case e13: i = (r - t) / l + (r < t ? 6 : 0); break; case r: i = (t - e13) / l + 2; break; case t: i = (e13 - r) / l + 4; break; } i /= 6; } return { h: i, s: u, v: o }; } function VE(e13, r, t) { e13 = Zr(e13, 360) * 6, r = Zr(r, 100), t = Zr(t, 100); var n = Math.floor(e13), a = e13 - 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(e13, r, t, n) { var a = [ sa(Math.round(e13).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(e13, r, t, n, a) { var i = [ sa(Math.round(e13).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(e13) { return Math.round(parseFloat(e13) * 255).toString(16); } function Tf(e13) { return gt(e13) / 255; } function gt(e13) { return parseInt(e13, 16); } function GE(e13) { return { r: e13 >> 16, g: (e13 & 65280) >> 8, b: e13 & 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(e13) { var r = { r: 0, g: 0, b: 0 }, t = 1, n = null, a = null, i = null, o = false, l = false; return typeof e13 == "string" && (e13 = YE(e13)), typeof e13 == "object" && (ln(e13.r) && ln(e13.g) && ln(e13.b) ? (r = UE(e13.r, e13.g, e13.b), o = true, l = String(e13.r).substr(-1) === "%" ? "prgb" : "rgb") : ln(e13.h) && ln(e13.s) && ln(e13.v) ? (n = uo(e13.s), a = uo(e13.v), r = VE(e13.h, n, a), o = true, l = "hsv") : ln(e13.h) && ln(e13.s) && ln(e13.l) && (n = uo(e13.s), i = uo(e13.l), r = kE(e13.h, n, i), o = true, l = "hsl"), Object.prototype.hasOwnProperty.call(e13, "a") && (t = e13.a)), t = S0(t), { ok: o, format: e13.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+%?"; var JE = "[-\\+]?\\d*\\.\\d+%?"; var Un = "(?:".concat(JE, ")|(?:").concat(KE, ")"); var iu = "[\\s|\\(]+(".concat(Un, ")[,|\\s]+(").concat(Un, ")[,|\\s]+(").concat(Un, ")\\s*\\)?"); var ou = "[\\s|\\(]+(".concat(Un, ")[,|\\s]+(").concat(Un, ")[,|\\s]+(").concat(Un, ")[,|\\s]+(").concat(Un, ")\\s*\\)?"); var 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(e13) { if (e13 = e13.trim().toLowerCase(), e13.length === 0) return false; var r = false; if (Bu[e13]) e13 = Bu[e13], r = true; else if (e13 === "transparent") return { r: 0, g: 0, b: 0, a: 0, format: "name" }; var t = Rt.rgb.exec(e13); return t ? { r: t[1], g: t[2], b: t[3] } : (t = Rt.rgba.exec(e13), t ? { r: t[1], g: t[2], b: t[3], a: t[4] } : (t = Rt.hsl.exec(e13), t ? { h: t[1], s: t[2], l: t[3] } : (t = Rt.hsla.exec(e13), t ? { h: t[1], s: t[2], l: t[3], a: t[4] } : (t = Rt.hsv.exec(e13), t ? { h: t[1], s: t[2], v: t[3] } : (t = Rt.hsva.exec(e13), t ? { h: t[1], s: t[2], v: t[3], a: t[4] } : (t = Rt.hex8.exec(e13), 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(e13), t ? { r: gt(t[1]), g: gt(t[2]), b: gt(t[3]), format: r ? "name" : "hex" } : (t = Rt.hex4.exec(e13), 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(e13), t ? { r: gt(t[1] + t[1]), g: gt(t[2] + t[2]), b: gt(t[3] + t[3]), format: r ? "name" : "hex" } : false))))))))); } function ln(e13) { return !!Rt.CSS_UNIT.exec(String(e13)); } var jE = ( /** @class */ function() { function e13(r, t) { r === void 0 && (r = ""), t === void 0 && (t = {}); var n; if (r instanceof e13) 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 e13.prototype.isDark = function() { return this.getBrightness() < 128; }, e13.prototype.isLight = function() { return !this.isDark(); }, e13.prototype.getBrightness = function() { var r = this.toRgb(); return (r.r * 299 + r.g * 587 + r.b * 114) / 1e3; }, e13.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; }, e13.prototype.getAlpha = function() { return this.a; }, e13.prototype.setAlpha = function(r) { return this.a = S0(r), this.roundA = Math.round(100 * this.a) / 100, this; }, e13.prototype.isMonochrome = function() { var r = this.toHsl().s; return r === 0; }, e13.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 }; }, e13.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, ")"); }, e13.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 }; }, e13.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, ")"); }, e13.prototype.toHex = function(r) { return r === void 0 && (r = false), Ff(this.r, this.g, this.b, r); }, e13.prototype.toHexString = function(r) { return r === void 0 && (r = false), "#" + this.toHex(r); }, e13.prototype.toHex8 = function(r) { return r === void 0 && (r = false), HE(this.r, this.g, this.b, this.a, r); }, e13.prototype.toHex8String = function(r) { return r === void 0 && (r = false), "#" + this.toHex8(r); }, e13.prototype.toHexShortString = function(r) { return r === void 0 && (r = false), this.a === 1 ? this.toHexString(r) : this.toHex8String(r); }, e13.prototype.toRgb = function() { return { r: Math.round(this.r), g: Math.round(this.g), b: Math.round(this.b), a: this.a }; }, e13.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, ")"); }, e13.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 }; }, e13.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, ")"); }, e13.prototype.toName = function() { if (this.a === 0) return "transparent"; if (this.a < 1) return false; for (var r = "#" + Ff(this.r, this.g, this.b, false), 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 false; }, e13.prototype.toString = function(r) { var t = !!r; r = r ?? this.format; var n = false, 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(true)), r === "hex4" && (n = this.toHex8String(true)), r === "hex8" && (n = this.toHex8String()), r === "name" && (n = this.toName()), r === "hsl" && (n = this.toHslString()), r === "hsv" && (n = this.toHsvString()), n || this.toHexString()); }, e13.prototype.toNumber = function() { return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b); }, e13.prototype.clone = function() { return new e13(this.toString()); }, e13.prototype.lighten = function(r) { r === void 0 && (r = 10); var t = this.toHsl(); return t.l += r / 100, t.l = so(t.l), new e13(t); }, e13.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 e13(t); }, e13.prototype.darken = function(r) { r === void 0 && (r = 10); var t = this.toHsl(); return t.l -= r / 100, t.l = so(t.l), new e13(t); }, e13.prototype.tint = function(r) { return r === void 0 && (r = 10), this.mix("white", r); }, e13.prototype.shade = function(r) { return r === void 0 && (r = 10), this.mix("black", r); }, e13.prototype.desaturate = function(r) { r === void 0 && (r = 10); var t = this.toHsl(); return t.s -= r / 100, t.s = so(t.s), new e13(t); }, e13.prototype.saturate = function(r) { r === void 0 && (r = 10); var t = this.toHsl(); return t.s += r / 100, t.s = so(t.s), new e13(t); }, e13.prototype.greyscale = function() { return this.desaturate(100); }, e13.prototype.spin = function(r) { var t = this.toHsl(), n = (t.h + r) % 360; return t.h = n < 0 ? 360 + n : n, new e13(t); }, e13.prototype.mix = function(r, t) { t === void 0 && (t = 50); var n = this.toRgb(), a = new e13(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 e13(o); }, e13.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 e13(n)); return i; }, e13.prototype.complement = function() { var r = this.toHsl(); return r.h = (r.h + 180) % 360, new e13(r); }, e13.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 e13({ h: n, s: a, v: i })), i = (i + l) % 1; return o; }, e13.prototype.splitcomplement = function() { var r = this.toHsl(), t = r.h; return [ this, new e13({ h: (t + 72) % 360, s: r.s, l: r.l }), new e13({ h: (t + 216) % 360, s: r.s, l: r.l }) ]; }, e13.prototype.onBackground = function(r) { var t = this.toRgb(), n = new e13(r).toRgb(), a = t.a + n.a * (1 - t.a); return new e13({ 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 }); }, e13.prototype.triad = function() { return this.polyad(3); }, e13.prototype.tetrad = function() { return this.polyad(4); }, e13.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 e13({ h: (n + o * i) % 360, s: t.s, l: t.l })); return a; }, e13.prototype.equals = function(r) { return this.toRgbString() === new e13(r).toRgbString(); }, e13; }() ); function On(e13, r = 20) { return e13.mix("#141414", r).toString(); } function XE(e13) { const r = Ns(), t = Dr("button"); return computed(() => { let n = {}, a = e13.color; if (a) { const i = a.match(/var\((.*?)\)/); i && (a = window.getComputedStyle(window.document.documentElement).getPropertyValue(i[1])); const o = new jE(a), l = e13.dark ? o.tint(20).toString() : On(o, 20); if (e13.plain) n = t.cssVarBlock({ "bg-color": e13.dark ? On(o, 90) : o.tint(90).toString(), "text-color": a, "border-color": e13.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")] = e13.dark ? On(o, 90) : o.tint(90).toString(), n[t.cssVarBlockName("disabled-text-color")] = e13.dark ? On(o, 50) : o.tint(50).toString(), n[t.cssVarBlockName("disabled-border-color")] = e13.dark ? On(o, 80) : o.tint(80).toString()); else { const u = e13.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 = e13.dark ? On(o, 50) : o.tint(50).toString(); n[t.cssVarBlockName("disabled-bg-color")] = c, n[t.cssVarBlockName("disabled-text-color")] = e13.dark ? "rgba(255, 255, 255, 0.5)" : `var(${t.cssVarName("color-white")})`, n[t.cssVarBlockName("disabled-border-color")] = c; } } } return n; }); } var QE = defineComponent({ name: "ElButton" }); var eS = defineComponent({ ...QE, props: Ou, emits: zE, setup(e13, { expose: r, emit: t }) { const n = e13, a = XE(n), i = Dr("button"), { _ref: o, _size: l, _type: u, _disabled: s, _props: c, shouldAddSpace: f, handleClick: d } = IE(n, t), p = computed(() => [ 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) => (openBlock(), createBlock(resolveDynamicComponent(m.tag), mergeProps({ ref_key: "_ref", ref: o }, unref(c), { class: unref(p), style: unref(a), onClick: unref(d) }), { default: withCtx(() => [ m.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [ m.$slots.loading ? renderSlot(m.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(Ct), { key: 1, class: normalizeClass(unref(i).is("loading")) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(m.loadingIcon))) ]), _: 1 }, 8, ["class"])) ], 64)) : m.icon || m.$slots.icon ? (openBlock(), createBlock(unref(Ct), { key: 1 }, { default: withCtx(() => [ m.icon ? (openBlock(), createBlock(resolveDynamicComponent(m.icon), { key: 0 })) : renderSlot(m.$slots, "icon", { key: 1 }) ]), _: 3 })) : createCommentVNode("v-if", true), m.$slots.default ? (openBlock(), createElementBlock("span", { key: 2, class: normalizeClass({ [unref(i).em("text", "expand")]: unref(f) }) }, [ renderSlot(m.$slots, "default") ], 2)) : createCommentVNode("v-if", true) ]), _: 3 }, 16, ["class", "style", "onClick"])); } }); var rS = Sr(eS, [["__file", "button.vue"]]); var tS = { size: Ou.size, type: Ou.type }; var nS = defineComponent({ name: "ElButtonGroup" }); var aS = defineComponent({ ...nS, props: tS, setup(e13) { const r = e13; provide(E0, reactive({ size: toRef(r, "size"), type: toRef(r, "type") })); const t = Dr("button"); return (n, a) => (openBlock(), createElementBlock("div", { class: normalizeClass(unref(t).b("group")) }, [ renderSlot(n.$slots, "default") ], 2)); } }); var C0 = Sr(aS, [["__file", "button-group.vue"]]); var 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(e13) { return e13 && e13.__esModule && Object.prototype.hasOwnProperty.call(e13, "default") ? e13.default : e13; } function iS(e13) { if (e13.__esModule) return e13; var r = e13.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: true }), Object.keys(e13).forEach(function(n) { var a = Object.getOwnPropertyDescriptor(e13, n); Object.defineProperty(t, n, a.get ? a : { enumerable: true, get: function() { return e13[n]; } }); }), t; } var Rn = /* @__PURE__ */ new Map(); if (Ir) { let e13; document.addEventListener("mousedown", (r) => e13 = r), document.addEventListener("mouseup", (r) => { if (e13) { for (const t of Rn.values()) for (const { documentHandler: n } of t) n(r, e13); e13 = void 0; } }); } function Of(e13, 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 = e13.contains(o) || e13.contains(l), f = e13 === 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); }; } var oS = { beforeMount(e13, r) { Rn.has(e13) || Rn.set(e13, []), Rn.get(e13).push({ documentHandler: Of(e13, r), bindingFn: r.value }); }, updated(e13, r) { Rn.has(e13) || Rn.set(e13, []); const t = Rn.get(e13), n = t.findIndex((i) => i.bindingFn === r.oldValue), a = { documentHandler: Of(e13, r), bindingFn: r.value }; n >= 0 ? t.splice(n, 1, a) : t.push(a); }, unmounted(e13) { Rn.delete(e13); } }; var sS = 100; var uS = 600; var Bf = { beforeMount(e13, 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); }; e13.addEventListener("mousedown", (s) => { s.button === 0 && (u(), l(), document.addEventListener("mouseup", () => u(), { once: true }), o = setTimeout(() => { i = setInterval(() => { l(); }, n); }, a)); }); } }; var $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 }); var lS = { close: (e13) => e13 instanceof MouseEvent, click: (e13) => e13 instanceof MouseEvent }; var cS = defineComponent({ name: "ElTag" }); var fS = defineComponent({ ...cS, props: $u, emits: lS, setup(e13, { emit: r }) { const t = e13, n = si(), a = Dr("tag"), i = computed(() => { 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 ? (openBlock(), createElementBlock("span", { key: 0, class: normalizeClass(unref(i)), style: normalizeStyle({ backgroundColor: s.color }), onClick: l }, [ createBaseVNode("span", { class: normalizeClass(unref(a).e("content")) }, [ renderSlot(s.$slots, "default") ], 2), s.closable ? (openBlock(), createBlock(unref(Ct), { key: 0, class: normalizeClass(unref(a).e("close")), onClick: withModifiers(o, ["stop"]) }, { default: withCtx(() => [ createVNode(unref(rf)) ]), _: 1 }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true) ], 6)) : (openBlock(), createBlock(Transition, { key: 1, name: `${unref(a).namespace.value}-zoom-in-center`, appear: "", onVnodeMounted: u }, { default: withCtx(() => [ createBaseVNode("span", { class: normalizeClass(unref(i)), style: normalizeStyle({ backgroundColor: s.color }), onClick: l }, [ createBaseVNode("span", { class: normalizeClass(unref(a).e("content")) }, [ renderSlot(s.$slots, "default") ], 2), s.closable ? (openBlock(), createBlock(unref(Ct), { key: 0, class: normalizeClass(unref(a).e("close")), onClick: withModifiers(o, ["stop"]) }, { default: withCtx(() => [ createVNode(unref(rf)) ]), _: 1 }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true) ], 6) ]), _: 3 }, 8, ["name"])); } }); var dS = Sr(fS, [["__file", "tag.vue"]]); var pS = Bt(dS); var 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" } }); var vS = defineComponent({ name: "ElDivider" }); var hS = defineComponent({ ...vS, props: mS, setup(e13) { const r = e13, t = Dr("divider"), n = computed(() => t.cssVar({ "border-style": r.borderStyle })); return (a, i) => (openBlock(), createElementBlock("div", { class: normalizeClass([unref(t).b(), unref(t).m(a.direction)]), style: normalizeStyle(unref(n)), role: "separator" }, [ a.$slots.default && a.direction !== "vertical" ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass([unref(t).e("text"), unref(t).is(a.contentPosition)]) }, [ renderSlot(a.$slots, "default") ], 2)) : createCommentVNode("v-if", true) ], 6)); } }); var gS = Sr(hS, [["__file", "divider.vue"]]); var _0 = Bt(gS); var 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: true }, controlsPosition: { type: String, default: "", values: ["", "right"] }, valueOnClear: { type: [String, Number, null], validator: (e13) => e13 === null || Nr(e13) || ["min", "max"].includes(e13), default: null }, name: String, placeholder: String, precision: { type: Number, validator: (e13) => e13 >= 0 && e13 === Number.parseInt(`${e13}`, 10) }, validateEvent: { type: Boolean, default: true }, ...wa(["ariaLabel"]) }); var bS = { [ii]: (e13, r) => r !== e13, blur: (e13) => e13 instanceof FocusEvent, focus: (e13) => e13 instanceof FocusEvent, [ca]: (e13) => Nr(e13) || An(e13), [Or]: (e13) => Nr(e13) || An(e13) }; var wS = defineComponent({ name: "ElInputNumber" }); var xS = defineComponent({ ...wS, props: yS, emits: bS, setup(e13, { expose: r, emit: t }) { const n = e13, { t: a } = ws(), i = Dr("input-number"), o = ref(), l = reactive({ currentValue: n.modelValue, userInput: null }), { formItem: u } = Zi(), s = computed(() => Nr(n.modelValue) && n.modelValue <= n.min), c = computed(() => Nr(n.modelValue) && n.modelValue >= n.max), f = computed(() => { 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 = computed(() => n.controls && n.controlsPosition === "right"), p = si(), m = Ns(), v = computed(() => { 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, h10 = () => { 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 = true) => { 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, false); }, 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 watch(() => n.modelValue, (B, C) => { const _ = w(B, true); l.userInput === null && _ !== C && (l.currentValue = _); }, { immediate: true }), onMounted(() => { 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: false }); }), onUpdated(() => { 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) => (openBlock(), createElementBlock("div", { class: normalizeClass([ unref(i).b(), unref(i).m(unref(p)), unref(i).is("disabled", unref(m)), unref(i).is("without-controls", !B.controls), unref(i).is("controls-right", unref(d)) ]), onDragstart: withModifiers(() => { }, ["prevent"]) }, [ B.controls ? withDirectives((openBlock(), createElementBlock("span", { key: 0, role: "button", "aria-label": unref(a)("el.inputNumber.decrease"), class: normalizeClass([unref(i).e("decrease"), unref(i).is("disabled", unref(s))]), onKeydown: withKeys(x, ["enter"]) }, [ renderSlot(B.$slots, "decrease-icon", {}, () => [ createVNode(unref(Ct), null, { default: withCtx(() => [ unref(d) ? (openBlock(), createBlock(unref(Lh), { key: 0 })) : (openBlock(), createBlock(unref(vA), { key: 1 })) ]), _: 1 }) ]) ], 42, ["aria-label", "onKeydown"])), [ [unref(Bf), x] ]) : createCommentVNode("v-if", true), B.controls ? withDirectives((openBlock(), createElementBlock("span", { key: 1, role: "button", "aria-label": unref(a)("el.inputNumber.increase"), class: normalizeClass([unref(i).e("increase"), unref(i).is("disabled", unref(c))]), onKeydown: withKeys(h10, ["enter"]) }, [ renderSlot(B.$slots, "increase-icon", {}, () => [ createVNode(unref(Ct), null, { default: withCtx(() => [ unref(d) ? (openBlock(), createBlock(unref(oA), { key: 0 })) : (openBlock(), createBlock(unref(gA), { key: 1 })) ]), _: 1 }) ]) ], 42, ["aria-label", "onKeydown"])), [ [unref(Bf), h10] ]) : createCommentVNode("v-if", true), createVNode(unref(hD), { id: B.id, ref_key: "input", ref: o, type: "number", step: B.step, "model-value": unref(v), placeholder: B.placeholder, readonly: B.readonly, disabled: unref(m), size: unref(p), max: B.max, min: B.min, name: B.name, "aria-label": B.ariaLabel, "validate-event": false, onKeydown: [ withKeys(withModifiers(h10, ["prevent"]), ["up"]), withKeys(withModifiers(x, ["prevent"]), ["down"]) ], onBlur: F, onFocus: M, onInput: D, onChange: E }, createSlots({ _: 2 }, [ B.$slots.prefix ? { name: "prefix", fn: withCtx(() => [ renderSlot(B.$slots, "prefix") ]) } : void 0, B.$slots.suffix ? { name: "suffix", fn: withCtx(() => [ renderSlot(B.$slots, "suffix") ]) } : void 0 ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"]) ], 42, ["onDragstart"])); } }); var AS = Sr(xS, [["__file", "input-number.vue"]]); var Bl = Bt(AS); var F0 = Symbol("ElSelectGroup"); var Ss = Symbol("ElSelect"); function NS(e13, r) { const t = inject(Ss), n = inject(F0, { disabled: false }), a = computed(() => c(Ln(t.props.modelValue), e13.value)), i = computed(() => { 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 false; }), o = computed(() => e13.label || (dt(e13.value) ? "" : e13.value)), l = computed(() => e13.value || e13.label || ""), u = computed(() => e13.disabled || r.groupDisabled || i.value), s = getCurrentInstance(), c = (p = [], m) => { if (dt(e13.value)) { const v = t.props.valueKey; return p && p.some((b) => toRaw(hn(b, v)) === hn(m, v)); } else return p && p.includes(m); }, f = () => { !e13.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) || e13.created; }; return watch(() => o.value, () => { !e13.created && !t.props.remote && t.setSelected(); }), watch(() => e13.value, (p, m) => { const { remote: v, valueKey: b } = t.props; if (p !== m && (t.onOptionDestroy(m, s.proxy), t.onOptionCreate(s.proxy)), !e13.created && !v) { if (b && dt(p) && dt(m) && p[b] === m[b]) return; t.setSelected(); } }), watch(() => n.disabled, () => { r.groupDisabled = n.disabled; }, { immediate: true }), { select: t, currentLabel: o, currentValue: l, itemSelected: a, isDisabled: u, hoverItem: f, updateOption: d }; } var DS = defineComponent({ name: "ElOption", componentName: "ElOption", props: { value: { required: true, type: [String, Number, Boolean, Object] }, label: [String, Number], created: Boolean, disabled: Boolean }, setup(e13) { const r = Dr("select"), t = As(), n = computed(() => [ r.be("dropdown", "item"), r.is("disabled", unref(l)), r.is("selected", unref(o)), r.is("hovering", unref(d)) ]), a = reactive({ index: -1, groupDisabled: false, visible: true, hover: false }), { currentLabel: i, itemSelected: o, isDisabled: l, select: u, hoverItem: s, updateOption: c } = NS(e13, a), { visible: f, hover: d } = toRefs(a), p = getCurrentInstance().proxy; u.onOptionCreate(p), onBeforeUnmount(() => { const v = p.value, { selected: b } = u.states, A = (u.props.multiple ? b : [b]).some((h10) => h10.value === p.value); nextTick(() => { 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(e13, r, t, n, a, i) { return withDirectives((openBlock(), createElementBlock("li", { id: e13.id, class: normalizeClass(e13.containerKls), role: "option", "aria-disabled": e13.isDisabled || void 0, "aria-selected": e13.itemSelected, onMouseenter: e13.hoverItem, onClick: withModifiers(e13.selectOptionClick, ["stop"]) }, [ renderSlot(e13.$slots, "default", {}, () => [ createBaseVNode("span", null, toDisplayString(e13.currentLabel), 1) ]) ], 42, ["id", "aria-disabled", "aria-selected", "onMouseenter", "onClick"])), [ [vShow, e13.visible] ]); } var $l = Sr(DS, [["render", ES], ["__file", "option.vue"]]); var SS = defineComponent({ name: "ElSelectDropdown", componentName: "ElSelectDropdown", setup() { const e13 = inject(Ss), r = Dr("select"), t = computed(() => e13.props.popperClass), n = computed(() => e13.props.multiple), a = computed(() => e13.props.fitInputWidth), i = ref(""); function o() { var l; i.value = `${(l = e13.selectRef) == null ? void 0 : l.offsetWidth}px`; } return onMounted(() => { o(), mn(e13.selectRef, o); }), { ns: r, minWidth: i, popperClass: t, isMultiple: n, isFitInputWidth: a }; } }); function CS(e13, r, t, n, a, i) { return openBlock(), createElementBlock("div", { class: normalizeClass([e13.ns.b("dropdown"), e13.ns.is("multiple", e13.isMultiple), e13.popperClass]), style: normalizeStyle({ [e13.isFitInputWidth ? "width" : "minWidth"]: e13.minWidth }) }, [ e13.$slots.header ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(e13.ns.be("dropdown", "header")) }, [ renderSlot(e13.$slots, "header") ], 2)) : createCommentVNode("v-if", true), renderSlot(e13.$slots, "default"), e13.$slots.footer ? (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass(e13.ns.be("dropdown", "footer")) }, [ renderSlot(e13.$slots, "footer") ], 2)) : createCommentVNode("v-if", true) ], 6); } var MS = Sr(SS, [["render", CS], ["__file", "select-dropdown.vue"]]); var _S = 11; var FS = (e13, r) => { const { t } = ws(), n = As(), a = Dr("select"), i = Dr("input"), o = reactive({ 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: false, menuVisibleOnFocus: false, isBeforeHide: false }), l = ref(null), u = ref(null), s = ref(null), c = ref(null), f = ref(null), d = ref(null), p = ref(null), m = ref(null), v = ref(null), b = ref(null), y = ref(null), A = ref(null), { isComposing: h10, handleCompositionStart: x, handleCompositionUpdate: w, handleCompositionEnd: g } = p0({ afterComposition: (ce) => fe(ce) }), { wrapperRef: D, isFocused: E } = d0(f, { beforeFocus() { return C.value; }, afterFocus() { e13.automaticDropdown && !N.value && (N.value = true, o.menuVisibleOnFocus = true); }, 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 = false, o.menuVisibleOnFocus = false; } }), N = ref(false), S = ref(), { form: M, formItem: F } = Zi(), { inputId: $ } = Sl(e13, { formItemContext: F }), { valueOnClear: I, isEmptyValue: B } = QN(e13), C = computed(() => e13.disabled || (M == null ? void 0 : M.disabled)), _ = computed(() => Yt(e13.modelValue) ? e13.modelValue.length > 0 : !B(e13.modelValue)), z = computed(() => e13.clearable && !C.value && o.inputHovering && _.value), O = computed(() => e13.remote && e13.filterable && !e13.remoteShowSuffix ? "" : e13.suffixIcon), W = computed(() => a.is("reverse", O.value && N.value)), X = computed(() => (F == null ? void 0 : F.validateState) || ""), V = computed(() => Vh[X.value]), R = computed(() => e13.remote ? 300 : 0), Q = computed(() => e13.loading ? e13.loadingText || t("el.select.loading") : e13.remote && !o.inputValue && o.options.size === 0 ? false : e13.filterable && o.inputValue && o.options.size > 0 && se.value === 0 ? e13.noMatchText || t("el.select.noMatch") : o.options.size === 0 ? e13.noDataText || t("el.select.noData") : null), se = computed(() => re.value.filter((ce) => ce.visible).length), re = computed(() => { 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 = computed(() => Array.from(o.cachedOptions.values())), Z = computed(() => { const ce = re.value.filter((Me) => !Me.created).some((Me) => Me.currentLabel === o.inputValue); return e13.filterable && e13.allowCreate && o.inputValue !== "" && !ce; }), K = () => { e13.filterable && Xr(e13.filterMethod) || e13.filterable && e13.remote && Xr(e13.remoteMethod) || re.value.forEach((ce) => { var Me; (Me = ce.updateOption) == null || Me.call(ce, o.inputValue); }); }, j = si(), ee = computed(() => ["small"].includes(j.value) ? "small" : "default"), te = computed({ get() { return N.value && Q.value !== false; }, set(ce) { N.value = ce; } }), oe = computed(() => { if (e13.multiple && !yn(e13.modelValue)) return Ln(e13.modelValue).length === 0 && !o.inputValue; const ce = Yt(e13.modelValue) ? e13.modelValue[0] : e13.modelValue; return e13.filterable || yn(ce) ? !o.inputValue : true; }), ge = computed(() => { var ce; const Me = (ce = e13.placeholder) != null ? ce : t("el.select.placeholder"); return e13.multiple || !_.value ? Me : o.selectedLabel; }), L = computed(() => wu ? null : "mouseenter"); watch(() => e13.modelValue, (ce, Me) => { e13.multiple && e13.filterable && !e13.reserveKeyword && (o.inputValue = "", H("")), ie(), !Cu(ce, Me) && e13.validateEvent && (F == null || F.validate("change").catch((tr) => Tr(tr))); }, { flush: "post", deep: true }), watch(() => N.value, (ce) => { ce ? H(o.inputValue) : (o.inputValue = "", o.previousQuery = null, o.isBeforeHide = true), r("visible-change", ce); }), watch(() => o.options.entries(), () => { var ce; if (!Ir) return; const Me = ((ce = l.value) == null ? void 0 : ce.querySelectorAll("input")) || []; (!e13.filterable && !e13.defaultFirstOption && !yn(e13.modelValue) || !Array.from(Me).includes(document.activeElement)) && ie(), e13.defaultFirstOption && (e13.filterable || e13.remote) && se.value && ne(); }, { flush: "post" }), watch(() => o.hoveringIndex, (ce) => { Nr(ce) && ce > -1 ? S.value = re.value[ce] || {} : S.value = {}, re.value.forEach((Me) => { Me.hover = S.value === Me; }); }), watchEffect(() => { o.isBeforeHide || K(); }); const H = (ce) => { o.previousQuery === ce || h10.value || (o.previousQuery = ce, e13.filterable && Xr(e13.filterMethod) ? e13.filterMethod(ce) : e13.filterable && e13.remote && Xr(e13.remoteMethod) && e13.remoteMethod(ce), e13.defaultFirstOption && (e13.filterable || e13.remote) && se.value ? nextTick(ne) : nextTick(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 (e13.multiple) o.selectedLabel = ""; else { const Me = Yt(e13.modelValue) ? e13.modelValue[0] : e13.modelValue, tr = me(Me); o.selectedLabel = tr.currentLabel, o.selected = [tr]; return; } const ce = []; yn(e13.modelValue) || Ln(e13.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, e13.valueKey) === hn(ce, e13.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 = true), H(o.inputValue); }, fe = (ce) => { if (o.inputValue = ce.target.value, e13.remote) de(); else return ae(); }, de = Su(() => { ae(); }, R.value), Ne = (ce) => { Cu(e13.modelValue, ce) || r(ii, ce); }, we = (ce) => K2(ce, (Me) => !o.disabledOptions.has(Me)), Ee = (ce) => { if (e13.multiple && ce.code !== Za.delete && ce.target.value.length <= 0) { const Me = Ln(e13.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(e13.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 = e13.multiple ? [] : I.value; if (e13.multiple) for (const tr of o.selected) tr.isDisabled && Me.push(tr.value); r(Or, Me), Ne(Me), o.hoveringIndex = -1, N.value = false, r("clear"), Pe(); }, ir = (ce) => { var Me; if (e13.multiple) { const tr = Ln((Me = e13.modelValue) != null ? Me : []).slice(), hr = Ue(tr, ce.value); hr > -1 ? tr.splice(hr, 1) : (e13.multipleLimit <= 0 || tr.length < e13.multipleLimit) && tr.push(ce.value), r(Or, tr), Ne(tr), ce.created && H(""), e13.filterable && !e13.reserveKeyword && (o.inputValue = ""); } else r(Or, ce.value), Ne(ce.value), N.value = false; Pe(), !N.value && nextTick(() => { xr(ce); }); }, Ue = (ce = [], Me) => { if (!dt(Me)) return ce.indexOf(Me); const tr = e13.valueKey; let hr = -1; return ce.some((Jt, Tn) => toRaw(hn(Jt, tr)) === hn(Me, tr) ? (hr = Tn, true) : false), 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 = computed(() => { var ce, Me; return (Me = (ce = s.value) == null ? void 0 : ce.popperRef) == null ? void 0 : Me.contentRef; }), be = () => { o.isBeforeHide = false, nextTick(() => 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 = false, E.value && Ge(); }, Ls = () => { o.inputValue.length > 0 ? o.inputValue = "" : N.value = false; }, ji = () => { C.value || (wu && (o.inputHovering = true), o.menuVisibleOnFocus ? o.menuVisibleOnFocus = false : 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, e13.valueKey) : ce.value, ks = computed(() => re.value.filter((ce) => ce.visible).every((ce) => ce.disabled)), Vs = computed(() => e13.multiple ? e13.collapseTags ? o.selected.slice(0, e13.maxCollapseTags) : o.selected : []), Hs = computed(() => e13.multiple ? e13.collapseTags ? o.selected.slice(e13.maxCollapseTags) : [] : []), Xi = (ce) => { if (!N.value) { N.value = true; return; } if (!(o.options.size === 0 || o.filteredOptionsCount === 0 || h10.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 === true || Me.states.groupDisabled === true || !Me.visible) && Xi(ce), nextTick(() => xr(S.value)); } }, Zs = () => { if (!u.value) return 0; const ce = window.getComputedStyle(u.value); return Number.parseFloat(ce.gap || "6px"); }, Gs = computed(() => { const ce = Zs(); return { maxWidth: `${y.value && e13.maxCollapseTags === 1 ? o.selectionWidth - o.collapseItemWidth - ce : o.selectionWidth}px` }; }), Ws = computed(() => ({ maxWidth: `${o.selectionWidth}px` })), Ks = computed(() => ({ 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), onMounted(() => { 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 = defineComponent({ name: "ElOptions", setup(e13, { slots: r }) { const t = inject(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; }; } }); var 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: true }, valueKey: { type: String, default: "value" }, collapseTags: Boolean, collapseTagsTooltip: Boolean, maxCollapseTags: { type: Number, default: 1 }, teleported: Ol.teleported, persistent: { type: Boolean, default: true }, 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: true }, 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"]) }); var $f = "ElSelect"; var BS = defineComponent({ 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(e13, { emit: r }) { const t = computed(() => { const { modelValue: i, multiple: o } = e13, l = o ? [] : void 0; return Yt(i) ? o ? i : l : o ? l : i; }), n = reactive({ ...toRefs(e13), modelValue: t }), a = FS(n, r); return provide(Ss, reactive({ 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(e13, r, t, n, a, i) { const o = resolveComponent("el-tag"), l = resolveComponent("el-tooltip"), u = resolveComponent("el-icon"), s = resolveComponent("el-option"), c = resolveComponent("el-options"), f = resolveComponent("el-scrollbar"), d = resolveComponent("el-select-menu"), p = resolveDirective("click-outside"); return withDirectives((openBlock(), createElementBlock("div", { ref: "selectRef", class: normalizeClass([e13.nsSelect.b(), e13.nsSelect.m(e13.selectSize)]), [toHandlerKey(e13.mouseEnterEventName)]: (m) => e13.states.inputHovering = true, onMouseleave: (m) => e13.states.inputHovering = false }, [ createVNode(l, { ref: "tooltipRef", visible: e13.dropdownMenuVisible, placement: e13.placement, teleported: e13.teleported, "popper-class": [e13.nsSelect.e("popper"), e13.popperClass], "popper-options": e13.popperOptions, "fallback-placements": e13.fallbackPlacements, effect: e13.effect, pure: "", trigger: "click", transition: `${e13.nsSelect.namespace.value}-zoom-in-top`, "stop-popper-mouse-event": false, "gpu-acceleration": false, persistent: e13.persistent, "append-to": e13.appendTo, onBeforeShow: e13.handleMenuEnter, onHide: (m) => e13.states.isBeforeHide = false }, { default: withCtx(() => { var m; return [ createBaseVNode("div", { ref: "wrapperRef", class: normalizeClass([ e13.nsSelect.e("wrapper"), e13.nsSelect.is("focused", e13.isFocused), e13.nsSelect.is("hovering", e13.states.inputHovering), e13.nsSelect.is("filterable", e13.filterable), e13.nsSelect.is("disabled", e13.selectDisabled) ]), onClick: withModifiers(e13.toggleMenu, ["prevent"]) }, [ e13.$slots.prefix ? (openBlock(), createElementBlock("div", { key: 0, ref: "prefixRef", class: normalizeClass(e13.nsSelect.e("prefix")) }, [ renderSlot(e13.$slots, "prefix") ], 2)) : createCommentVNode("v-if", true), createBaseVNode("div", { ref: "selectionRef", class: normalizeClass([ e13.nsSelect.e("selection"), e13.nsSelect.is("near", e13.multiple && !e13.$slots.prefix && !!e13.states.selected.length) ]) }, [ e13.multiple ? renderSlot(e13.$slots, "tag", { key: 0 }, () => [ (openBlock(true), createElementBlock(Fragment, null, renderList(e13.showTagList, (v) => (openBlock(), createElementBlock("div", { key: e13.getValueKey(v), class: normalizeClass(e13.nsSelect.e("selected-item")) }, [ createVNode(o, { closable: !e13.selectDisabled && !v.isDisabled, size: e13.collapseTagSize, type: e13.tagType, effect: e13.tagEffect, "disable-transitions": "", style: normalizeStyle(e13.tagStyle), onClose: (b) => e13.deleteTag(b, v) }, { default: withCtx(() => [ createBaseVNode("span", { class: normalizeClass(e13.nsSelect.e("tags-text")) }, [ renderSlot(e13.$slots, "label", { label: v.currentLabel, value: v.value }, () => [ createTextVNode(toDisplayString(v.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "style", "onClose"]) ], 2))), 128)), e13.collapseTags && e13.states.selected.length > e13.maxCollapseTags ? (openBlock(), createBlock(l, { key: 0, ref: "tagTooltipRef", disabled: e13.dropdownMenuVisible || !e13.collapseTagsTooltip, "fallback-placements": ["bottom", "top", "right", "left"], effect: e13.effect, placement: "bottom", teleported: e13.teleported }, { default: withCtx(() => [ createBaseVNode("div", { ref: "collapseItemRef", class: normalizeClass(e13.nsSelect.e("selected-item")) }, [ createVNode(o, { closable: false, size: e13.collapseTagSize, type: e13.tagType, effect: e13.tagEffect, "disable-transitions": "", style: normalizeStyle(e13.collapseTagStyle) }, { default: withCtx(() => [ createBaseVNode("span", { class: normalizeClass(e13.nsSelect.e("tags-text")) }, " + " + toDisplayString(e13.states.selected.length - e13.maxCollapseTags), 3) ]), _: 1 }, 8, ["size", "type", "effect", "style"]) ], 2) ]), content: withCtx(() => [ createBaseVNode("div", { ref: "tagMenuRef", class: normalizeClass(e13.nsSelect.e("selection")) }, [ (openBlock(true), createElementBlock(Fragment, null, renderList(e13.collapseTagList, (v) => (openBlock(), createElementBlock("div", { key: e13.getValueKey(v), class: normalizeClass(e13.nsSelect.e("selected-item")) }, [ createVNode(o, { class: "in-tooltip", closable: !e13.selectDisabled && !v.isDisabled, size: e13.collapseTagSize, type: e13.tagType, effect: e13.tagEffect, "disable-transitions": "", onClose: (b) => e13.deleteTag(b, v) }, { default: withCtx(() => [ createBaseVNode("span", { class: normalizeClass(e13.nsSelect.e("tags-text")) }, [ renderSlot(e13.$slots, "label", { label: v.currentLabel, value: v.value }, () => [ createTextVNode(toDisplayString(v.currentLabel), 1) ]) ], 2) ]), _: 2 }, 1032, ["closable", "size", "type", "effect", "onClose"]) ], 2))), 128)) ], 2) ]), _: 3 }, 8, ["disabled", "effect", "teleported"])) : createCommentVNode("v-if", true) ]) : createCommentVNode("v-if", true), e13.selectDisabled ? createCommentVNode("v-if", true) : (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass([ e13.nsSelect.e("selected-item"), e13.nsSelect.e("input-wrapper"), e13.nsSelect.is("hidden", !e13.filterable) ]) }, [ withDirectives(createBaseVNode("input", { id: e13.inputId, ref: "inputRef", "onUpdate:modelValue": (v) => e13.states.inputValue = v, type: "text", name: e13.name, class: normalizeClass([e13.nsSelect.e("input"), e13.nsSelect.is(e13.selectSize)]), disabled: e13.selectDisabled, autocomplete: e13.autocomplete, style: normalizeStyle(e13.inputStyle), role: "combobox", readonly: !e13.filterable, spellcheck: "false", "aria-activedescendant": ((m = e13.hoverOption) == null ? void 0 : m.id) || "", "aria-controls": e13.contentId, "aria-expanded": e13.dropdownMenuVisible, "aria-label": e13.ariaLabel, "aria-autocomplete": "none", "aria-haspopup": "listbox", onKeydown: [ withKeys(withModifiers((v) => e13.navigateOptions("next"), ["stop", "prevent"]), ["down"]), withKeys(withModifiers((v) => e13.navigateOptions("prev"), ["stop", "prevent"]), ["up"]), withKeys(withModifiers(e13.handleEsc, ["stop", "prevent"]), ["esc"]), withKeys(withModifiers(e13.selectOption, ["stop", "prevent"]), ["enter"]), withKeys(withModifiers(e13.deletePrevTag, ["stop"]), ["delete"]) ], onCompositionstart: e13.handleCompositionStart, onCompositionupdate: e13.handleCompositionUpdate, onCompositionend: e13.handleCompositionEnd, onInput: e13.onInput, onClick: withModifiers(e13.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"]), [ [vModelText, e13.states.inputValue] ]), e13.filterable ? (openBlock(), createElementBlock("span", { key: 0, ref: "calculatorRef", "aria-hidden": "true", class: normalizeClass(e13.nsSelect.e("input-calculator")), textContent: toDisplayString(e13.states.inputValue) }, null, 10, ["textContent"])) : createCommentVNode("v-if", true) ], 2)), e13.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", { key: 2, class: normalizeClass([ e13.nsSelect.e("selected-item"), e13.nsSelect.e("placeholder"), e13.nsSelect.is("transparent", !e13.hasModelValue || e13.expanded && !e13.states.inputValue) ]) }, [ e13.hasModelValue ? renderSlot(e13.$slots, "label", { key: 0, label: e13.currentPlaceholder, value: e13.modelValue }, () => [ createBaseVNode("span", null, toDisplayString(e13.currentPlaceholder), 1) ]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(e13.currentPlaceholder), 1)) ], 2)) : createCommentVNode("v-if", true) ], 2), createBaseVNode("div", { ref: "suffixRef", class: normalizeClass(e13.nsSelect.e("suffix")) }, [ e13.iconComponent && !e13.showClose ? (openBlock(), createBlock(u, { key: 0, class: normalizeClass([e13.nsSelect.e("caret"), e13.nsSelect.e("icon"), e13.iconReverse]) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(e13.iconComponent))) ]), _: 1 }, 8, ["class"])) : createCommentVNode("v-if", true), e13.showClose && e13.clearIcon ? (openBlock(), createBlock(u, { key: 1, class: normalizeClass([ e13.nsSelect.e("caret"), e13.nsSelect.e("icon"), e13.nsSelect.e("clear") ]), onClick: e13.handleClearClick }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(e13.clearIcon))) ]), _: 1 }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true), e13.validateState && e13.validateIcon ? (openBlock(), createBlock(u, { key: 2, class: normalizeClass([e13.nsInput.e("icon"), e13.nsInput.e("validateIcon")]) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(e13.validateIcon))) ]), _: 1 }, 8, ["class"])) : createCommentVNode("v-if", true) ], 2) ], 10, ["onClick"]) ]; }), content: withCtx(() => [ createVNode(d, { ref: "menuRef" }, { default: withCtx(() => [ e13.$slots.header ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(e13.nsSelect.be("dropdown", "header")), onClick: withModifiers(() => { }, ["stop"]) }, [ renderSlot(e13.$slots, "header") ], 10, ["onClick"])) : createCommentVNode("v-if", true), withDirectives(createVNode(f, { id: e13.contentId, ref: "scrollbarRef", tag: "ul", "wrap-class": e13.nsSelect.be("dropdown", "wrap"), "view-class": e13.nsSelect.be("dropdown", "list"), class: normalizeClass([e13.nsSelect.is("empty", e13.filteredOptionsCount === 0)]), role: "listbox", "aria-label": e13.ariaLabel, "aria-orientation": "vertical" }, { default: withCtx(() => [ e13.showNewOption ? (openBlock(), createBlock(s, { key: 0, value: e13.states.inputValue, created: true }, null, 8, ["value"])) : createCommentVNode("v-if", true), createVNode(c, null, { default: withCtx(() => [ renderSlot(e13.$slots, "default") ]), _: 3 }) ]), _: 3 }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [ [vShow, e13.states.options.size > 0 && !e13.loading] ]), e13.$slots.loading && e13.loading ? (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass(e13.nsSelect.be("dropdown", "loading")) }, [ renderSlot(e13.$slots, "loading") ], 2)) : e13.loading || e13.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", { key: 2, class: normalizeClass(e13.nsSelect.be("dropdown", "empty")) }, [ renderSlot(e13.$slots, "empty", {}, () => [ createBaseVNode("span", null, toDisplayString(e13.emptyText), 1) ]) ], 2)) : createCommentVNode("v-if", true), e13.$slots.footer ? (openBlock(), createElementBlock("div", { key: 3, class: normalizeClass(e13.nsSelect.be("dropdown", "footer")), onClick: withModifiers(() => { }, ["stop"]) }, [ renderSlot(e13.$slots, "footer") ], 10, ["onClick"])) : createCommentVNode("v-if", true) ]), _: 3 }, 512) ]), _: 3 }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "onBeforeShow", "onHide"]) ], 16, ["onMouseleave"])), [ [p, e13.handleClickOutside, e13.popperRef] ]); } var IS = Sr(BS, [["render", $S], ["__file", "select.vue"]]); var RS = defineComponent({ name: "ElOptionGroup", componentName: "ElOptionGroup", props: { label: String, disabled: Boolean }, setup(e13) { const r = Dr("select"), t = ref(null), n = getCurrentInstance(), a = ref([]); provide(F0, reactive({ ...toRefs(e13) })); const i = computed(() => a.value.some((s) => s.visible === true)), 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 onMounted(() => { u(); }), j1(t, u, { attributes: true, subtree: true, childList: true }), { groupRef: t, visible: i, ns: r }; } }); function PS(e13, r, t, n, a, i) { return withDirectives((openBlock(), createElementBlock("ul", { ref: "groupRef", class: normalizeClass(e13.ns.be("group", "wrap")) }, [ createBaseVNode("li", { class: normalizeClass(e13.ns.be("group", "title")) }, toDisplayString(e13.label), 3), createBaseVNode("li", null, [ createBaseVNode("ul", { class: normalizeClass(e13.ns.b("group")) }, [ renderSlot(e13.$slots, "default") ], 2) ]) ], 2)), [ [vShow, e13.visible] ]); } var T0 = Sr(RS, [["render", PS], ["__file", "option-group.vue"]]); var O0 = Bt(IS, { Option: $l, OptionGroup: T0 }); var B0 = ml($l); ml(T0); var $0 = Symbol("sliderContextKey"); var 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: true }, size: ja, inputSize: ja, showStops: Boolean, showTooltip: { type: Boolean, default: true }, 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: true }, ...wa(["ariaLabel"]) }); var su = (e13) => Nr(e13) || Yt(e13) && e13.every(Nr); var qS = { [Or]: su, [ca]: su, [ii]: su }; var LS = (e13, r, t) => { const n = ref(); return onMounted(async () => { e13.range ? (Array.isArray(e13.modelValue) ? (r.firstValue = Math.max(e13.min, e13.modelValue[0]), r.secondValue = Math.min(e13.max, e13.modelValue[1])) : (r.firstValue = e13.min, r.secondValue = e13.max), r.oldValue = [r.firstValue, r.secondValue]) : (typeof e13.modelValue != "number" || Number.isNaN(e13.modelValue) ? r.firstValue = e13.min : r.firstValue = Math.min(e13.max, Math.max(e13.min, e13.modelValue)), r.oldValue = r.firstValue), tt(window, "resize", t), await nextTick(), t(); }), { sliderWrapper: n }; }; var US = (e13) => computed(() => e13.marks ? Object.keys(e13.marks).map(Number.parseFloat).sort((t, n) => t - n).filter((t) => t <= e13.max && t >= e13.min).map((t) => ({ point: t, position: (t - e13.min) * 100 / (e13.max - e13.min), mark: e13.marks[t] })) : []); var kS = (e13, r, t) => { const { form: n, formItem: a } = Zi(), i = shallowRef(), o = ref(), l = ref(), u = { firstButton: o, secondButton: l }, s = computed(() => e13.disabled || (n == null ? void 0 : n.disabled) || false), c = computed(() => Math.min(r.firstValue, r.secondValue)), f = computed(() => Math.max(r.firstValue, r.secondValue)), d = computed(() => e13.range ? `${100 * (f.value - c.value) / (e13.max - e13.min)}%` : `${100 * (r.firstValue - e13.min) / (e13.max - e13.min)}%`), p = computed(() => e13.range ? `${100 * (c.value - e13.min) / (e13.max - e13.min)}%` : "0%"), m = computed(() => e13.vertical ? { height: e13.height } : {}), v = computed(() => e13.vertical ? { height: d.value, bottom: p.value } : { width: d.value, left: p.value }), b = () => { i.value && (r.sliderSize = i.value[`client${e13.vertical ? "Height" : "Width"}`]); }, y = (F) => { const $ = e13.min + F * (e13.max - e13.min) / 100; if (!e13.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), $; }, h10 = (F) => { r.firstValue = F ?? e13.min, w(e13.range ? [c.value, f.value] : F ?? e13.min); }, x = (F) => { r.secondValue = F, e13.range && w([c.value, f.value]); }, w = (F) => { t(Or, F), t(ca, F); }, g = async () => { await nextTick(), t(ii, e13.range ? [c.value, f.value] : e13.modelValue); }, D = (F) => { var $, I, B, C, _, z; if (s.value || r.dragging) return; b(); let O = 0; if (e13.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 nextTick(), $.value.onButtonDown(F)); }, onSliderMarkerDown: (F) => { s.value || r.dragging || A(F); }, setFirstValue: h10, setSecondValue: x }; }; var { left: VS, down: HS, right: ZS, up: GS, home: WS, end: KS, pageUp: JS, pageDown: YS } = Za; var jS = (e13, r, t) => { const n = ref(), a = ref(false), i = computed(() => r.value instanceof Function), o = computed(() => i.value && r.value(e13.modelValue) || e13.modelValue), l = Su(() => { t.value && (a.value = true); }, 50), u = Su(() => { t.value && (a.value = false); }, 50); return { tooltip: n, tooltipVisible: a, formatValue: o, displayTooltip: l, hideTooltip: u }; }; var XS = (e13, 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 } = inject($0), { tooltip: m, tooltipVisible: v, formatValue: b, displayTooltip: y, hideTooltip: A } = jS(e13, c, l), h10 = ref(), x = computed(() => `${(e13.modelValue - a.value) / (i.value - a.value) * 100}%`), w = computed(() => e13.vertical ? { bottom: x.value } : { left: x.value }), g = () => { r.hovering = true, y(); }, D = () => { r.hovering = false, 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), h10.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 = true; [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 = false, 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 = true, r.isClick = true; const { clientX: R, clientY: Q } = _(V); e13.vertical ? r.startY = Q : r.startX = R, r.startPosition = Number.parseFloat(x.value), r.newPosition = r.startPosition; }, O = (V) => { if (r.dragging) { r.isClick = false, y(), d(); let R; const { clientX: Q, clientY: se } = _(V); e13.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 = false, 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 !== e13.modelValue && t(Or, se), !r.dragging && e13.modelValue !== r.oldValue && (r.oldValue = e13.modelValue), await nextTick(), r.dragging && y(), m.value.updatePopper(); }; return watch(() => r.dragging, (V) => { p(V); }), tt(h10, "touchstart", E, { passive: false }), { disabled: n, button: h10, tooltip: m, tooltipVisible: v, showTooltip: l, wrapperStyle: w, formatValue: b, handleMouseEnter: g, handleMouseLeave: D, onButtonDown: E, onKeyDown: C, setPosition: X }; }; var QS = (e13, r, t, n) => ({ stops: computed(() => { if (!e13.showStops || e13.min > e13.max) return []; if (e13.step === 0) return Tr("ElSlider", "step should not be 0."), []; const o = (e13.max - e13.min) / e13.step, l = 100 * e13.step / (e13.max - e13.min), u = Array.from({ length: o - 1 }).map((s, c) => (c + 1) * l); return e13.range ? u.filter((s) => s < 100 * (t.value - e13.min) / (e13.max - e13.min) || s > 100 * (n.value - e13.min) / (e13.max - e13.min)) : u.filter((s) => s > 100 * (r.firstValue - e13.min) / (e13.max - e13.min)); }), getStopStyle: (o) => e13.vertical ? { bottom: `${o}%` } : { left: `${o}%` } }); var eC = (e13, r, t, n, a, i) => { const o = (s) => { a(Or, s), a(ca, s); }, l = () => e13.range ? ![t.value, n.value].every((s, c) => s === r.oldValue[c]) : e13.modelValue !== r.oldValue, u = () => { var s, c; e13.min > e13.max && dl("Slider", "min should not be greater than max."); const f = e13.modelValue; e13.range && Array.isArray(f) ? f[1] < e13.min ? o([e13.min, e13.min]) : f[0] > e13.max ? o([e13.max, e13.max]) : f[0] < e13.min ? o([e13.min, f[1]]) : f[1] > e13.max ? o([f[0], e13.max]) : (r.firstValue = f[0], r.secondValue = f[1], l() && (e13.validateEvent && ((s = i == null ? void 0 : i.validate) == null || s.call(i, "change").catch((d) => Tr(d))), r.oldValue = f.slice())) : !e13.range && typeof f == "number" && !Number.isNaN(f) && (f < e13.min ? o(e13.min) : f > e13.max ? o(e13.max) : (r.firstValue = f, l() && (e13.validateEvent && ((c = i == null ? void 0 : i.validate) == null || c.call(i, "change").catch((d) => Tr(d))), r.oldValue = f))); }; u(), watch(() => r.dragging, (s) => { s || u(); }), watch(() => e13.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: true }), watch(() => [e13.min, e13.max], () => { u(); }); }; var rC = Er({ modelValue: { type: Number, default: 0 }, vertical: Boolean, tooltipClass: String, placement: { type: String, values: oi, default: "top" } }); var tC = { [Or]: (e13) => Nr(e13) }; var nC = defineComponent({ name: "ElSliderButton" }); var aC = defineComponent({ ...nC, props: rC, emits: tC, setup(e13, { expose: r, emit: t }) { const n = e13, a = Dr("slider"), i = reactive({ hovering: false, dragging: false, isClick: false, 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: h10 } = toRefs(i); return r({ onButtonDown: v, onKeyDown: b, setPosition: y, hovering: A, dragging: h10 }), (x, w) => (openBlock(), createElementBlock("div", { ref_key: "button", ref: l, class: normalizeClass([unref(a).e("button-wrapper"), { hover: unref(A), dragging: unref(h10) }]), style: normalizeStyle(unref(f)), tabindex: unref(o) ? -1 : 0, onMouseenter: unref(p), onMouseleave: unref(m), onMousedown: unref(v), onFocus: unref(p), onBlur: unref(m), onKeydown: unref(b) }, [ createVNode(unref(D0), { ref_key: "tooltip", ref: u, visible: unref(c), placement: x.placement, "fallback-placements": ["top", "bottom", "right", "left"], "stop-popper-mouse-event": false, "popper-class": x.tooltipClass, disabled: !unref(s), persistent: "" }, { content: withCtx(() => [ createBaseVNode("span", null, toDisplayString(unref(d)), 1) ]), default: withCtx(() => [ createBaseVNode("div", { class: normalizeClass([unref(a).e("button"), { hover: unref(A), dragging: unref(h10) }]) }, null, 2) ]), _: 1 }, 8, ["visible", "placement", "popper-class", "disabled"]) ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"])); } }); var If = Sr(aC, [["__file", "button.vue"]]); var iC = Er({ mark: { type: rr([String, Object]), default: void 0 } }); var oC = defineComponent({ name: "ElSliderMarker", props: iC, setup(e13) { const r = Dr("slider"), t = computed(() => wt(e13.mark) ? e13.mark : e13.mark.label), n = computed(() => wt(e13.mark) ? void 0 : e13.mark.style); return () => h("div", { class: r.e("marks-text"), style: n.value }, t.value); } }); var sC = defineComponent({ name: "ElSlider" }); var uC = defineComponent({ ...sC, props: zS, emits: qS, setup(e13, { expose: r, emit: t }) { const n = e13, a = Dr("slider"), { t: i } = ws(), o = reactive({ firstValue: 0, secondValue: 0, oldValue: 0, dragging: false, 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: h10, 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(), $ = computed(() => n.inputSize || F.value), I = computed(() => n.ariaLabel || i("el.slider.defaultLabel", { min: n.min, max: n.max })), B = computed(() => n.range ? n.rangeStartLabel || i("el.slider.defaultRangeStartLabel") : I.value), C = computed(() => n.formatValueText ? n.formatValueText(R.value) : `${R.value}`), _ = computed(() => n.rangeEndLabel || i("el.slider.defaultRangeEndLabel")), z = computed(() => n.formatValueText ? n.formatValueText(Q.value) : `${Q.value}`), O = computed(() => [ 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 = computed(() => { 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 } = toRefs(o), re = (q) => { o.dragging = q; }; return tt(V, "touchstart", A, { passive: false }), tt(V, "touchmove", A, { passive: false }), provide($0, { ...toRefs(n), sliderSize: se, disabled: f, precision: X, emitChange: y, resetSize: b, updateDragging: re }), r({ onSliderClick: h10 }), (q, Z) => { var K, j; return openBlock(), createElementBlock("div", { id: q.range ? unref(S) : void 0, ref_key: "sliderWrapper", ref: V, class: normalizeClass(unref(O)), role: q.range ? "group" : void 0, "aria-label": q.range && !unref(M) ? unref(I) : void 0, "aria-labelledby": q.range && unref(M) ? (K = unref(l)) == null ? void 0 : K.labelId : void 0 }, [ createBaseVNode("div", { ref_key: "slider", ref: u, class: normalizeClass([ unref(a).e("runway"), { "show-input": q.showInput && !q.range }, unref(a).is("disabled", unref(f)) ]), style: normalizeStyle(unref(m)), onMousedown: unref(x), onTouchstartPassive: unref(x) }, [ createBaseVNode("div", { class: normalizeClass(unref(a).e("bar")), style: normalizeStyle(unref(v)) }, null, 6), createVNode(If, { id: q.range ? void 0 : unref(S), ref_key: "firstButton", ref: s, "model-value": unref(R), vertical: q.vertical, "tooltip-class": q.tooltipClass, placement: q.placement, role: "slider", "aria-label": q.range || !unref(M) ? unref(B) : void 0, "aria-labelledby": !q.range && unref(M) ? (j = unref(l)) == null ? void 0 : j.labelId : void 0, "aria-valuemin": q.min, "aria-valuemax": q.range ? unref(Q) : q.max, "aria-valuenow": unref(R), "aria-valuetext": unref(C), "aria-orientation": q.vertical ? "vertical" : "horizontal", "aria-disabled": unref(f), "onUpdate:modelValue": unref(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 ? (openBlock(), createBlock(If, { key: 0, ref_key: "secondButton", ref: c, "model-value": unref(Q), vertical: q.vertical, "tooltip-class": q.tooltipClass, placement: q.placement, role: "slider", "aria-label": unref(_), "aria-valuemin": unref(R), "aria-valuemax": q.max, "aria-valuenow": unref(Q), "aria-valuetext": unref(z), "aria-orientation": q.vertical ? "vertical" : "horizontal", "aria-disabled": unref(f), "onUpdate:modelValue": unref(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"])) : createCommentVNode("v-if", true), q.showStops ? (openBlock(), createElementBlock("div", { key: 1 }, [ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(E), (ee, te) => (openBlock(), createElementBlock("div", { key: te, class: normalizeClass(unref(a).e("stop")), style: normalizeStyle(unref(N)(ee)) }, null, 6))), 128)) ])) : createCommentVNode("v-if", true), unref(W).length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [ createBaseVNode("div", null, [ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(W), (ee, te) => (openBlock(), createElementBlock("div", { key: te, style: normalizeStyle(unref(N)(ee.position)), class: normalizeClass([unref(a).e("stop"), unref(a).e("marks-stop")]) }, null, 6))), 128)) ]), createBaseVNode("div", { class: normalizeClass(unref(a).e("marks")) }, [ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(W), (ee, te) => (openBlock(), createBlock(unref(oC), { key: te, mark: ee.mark, style: normalizeStyle(unref(N)(ee.position)), onMousedown: withModifiers((oe) => unref(w)(ee.position), ["stop"]) }, null, 8, ["mark", "style", "onMousedown"]))), 128)) ], 2) ], 64)) : createCommentVNode("v-if", true) ], 46, ["onMousedown", "onTouchstartPassive"]), q.showInput && !q.range ? (openBlock(), createBlock(unref(Bl), { key: 0, ref: "input", "model-value": unref(R), class: normalizeClass(unref(a).e("input")), step: q.step, disabled: unref(f), controls: q.showInputControls, min: q.min, max: q.max, precision: unref(X), debounce: q.debounce, size: unref($), "onUpdate:modelValue": unref(g), onChange: unref(y) }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true) ], 10, ["id", "role", "aria-label", "aria-labelledby"]); }; } }); var lC = Sr(uC, [["__file", "slider.vue"]]); var I0 = Bt(lC); function cC(e13) { let r; const t = ref(false), n = reactive({ ...e13, originalPosition: "", originalOverflow: "", visible: false }); 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; e13.beforeClose && !e13.beforeClose() || (t.value = true, clearTimeout(r), r = setTimeout(u, 400), n.visible = false, (d = e13.closed) == null || d.call(e13)); } function u() { if (!t.value) return; const d = n.parent; t.value = false, d.vLoadingAddClassList = void 0, i(); } const s = defineComponent({ 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 = h("svg", { class: "circular", viewBox: n.svgViewBox ? n.svgViewBox : "0 0 50 50", ...b ? { innerHTML: b } : {} }, [ h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none" }) ]), A = n.text ? h("p", { class: m.b("text") }, [n.text]) : void 0; return h(Transition, { name: m.b("fade"), onAfterLeave: u }, { default: withCtx(() => [ withDirectives(createVNode("div", { style: { backgroundColor: n.background || "" }, class: [ m.b("mask"), n.customClass, n.fullscreen ? "is-fullscreen" : "" ] }, [ h("div", { class: m.b("spinner") }, [y, A]) ]), [[vShow, n.visible]]) ]) }); }; } }), c = createApp(s), f = c.mount(document.createElement("div")); return { ...toRefs(n), setText: a, removeElLoadingChild: o, close: l, handleAfterLeave: u, vm: f, get $el() { return f.$el; } }; } var lo; var Iu = function(e13 = {}) { if (!Ir) return; const r = fC(e13); 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), nextTick(() => t.visible.value = r.visible), r.fullscreen && (lo = t), t; }; var fC = (e13) => { var r, t, n, a; let i; return wt(e13.target) ? i = (r = document.querySelector(e13.target)) != null ? r : document.body : i = e13.target || document.body, { parent: i === document.body || e13.body ? document.body : i, background: e13.background || "", svg: e13.svg || "", svgViewBox: e13.svgViewBox || "", spinner: e13.spinner || false, text: e13.text || "", fullscreen: i === document.body && ((t = e13.fullscreen) != null ? t : true), lock: (n = e13.lock) != null ? n : false, customClass: e13.customClass || "", visible: (a = e13.visible) != null ? a : true, beforeClose: e13.beforeClose, closed: e13.closed, target: i }; }; var dC = async (e13, r, t) => { const { nextZIndex: n } = t.vm.zIndex || t.vm._.exposed.zIndex, a = {}; if (e13.fullscreen) t.originalPosition.value = wi(document.body, "position"), t.originalOverflow.value = wi(document.body, "overflow"), a.zIndex = n(); else if (e13.parent === document.body) { t.originalPosition.value = wi(document.body, "position"), await nextTick(); for (const i of ["top", "left"]) { const o = i === "top" ? "scrollTop" : "scrollLeft"; a[i] = `${e13.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] = `${e13.target.getBoundingClientRect()[i]}px`; } else t.originalPosition.value = wi(r, "position"); for (const [i, o] of Object.entries(a)) t.$el.style[i] = o; }; var Rf = (e13, 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")), e13.fullscreen && e13.lock ? ef(r, n.bm("parent", "hidden")) : Uo(r, n.bm("parent", "hidden")); }; var Bo = Symbol("ElLoading"); var Pf = (e13, 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 && ref(p); }, s = (d) => u(l(d) || e13.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 : e13, body: (a = l("body")) != null ? a : r.modifiers.body, lock: (i = l("lock")) != null ? i : r.modifiers.lock }; e13[Bo] = { options: f, instance: Iu(f) }; }; var pC = (e13, r) => { for (const t of Object.keys(r)) isRef(r[t]) && (r[t].value = e13[t]); }; var Ru = { mounted(e13, r) { r.value && Pf(e13, r); }, updated(e13, r) { const t = e13[Bo]; r.oldValue !== r.value && (r.value && !r.oldValue ? Pf(e13, r) : r.value && r.oldValue ? dt(r.value) && pC(r.value, t.options) : t == null || t.instance.close()); }, unmounted(e13) { var r; (r = e13[Bo]) == null || r.instance.close(), e13[Bo] = null; } }; var mC = { install(e13) { e13.directive("loading", Ru), e13.config.globalProperties.$loading = Iu; }, directive: Ru, service: Iu }; function jr() { return jr = Object.assign ? Object.assign.bind() : function(e13) { for (var r = 1; r < arguments.length; r++) { var t = arguments[r]; for (var n in t) ({}).hasOwnProperty.call(t, n) && (e13[n] = t[n]); } return e13; }, 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: false, // random seed for seeded pseudo random number generation // null = randomly seed randomSeed: null }; function it(e13, r) { if (Zo(e13, r)) return e13[r]; throw typeof e13[r] == "function" && Il(e13, r) ? new Error('Cannot access method "' + r + '" as a property') : new Error('No access to property "' + r + '"'); } function Xa(e13, r, t) { if (Zo(e13, r)) return e13[r] = t, t; throw new Error('No access to property "' + r + '"'); } function Zo(e13, r) { return !hC(e13) && !Array.isArray(e13) ? false : Fe(gC, r) ? true : !(r in Object.prototype || r in Function.prototype); } function vC(e13, r) { if (!Il(e13, r)) throw new Error('No access to method "' + r + '"'); return e13[r]; } function Il(e13, r) { return e13 == null || typeof e13[r] != "function" || Fe(e13, r) && Object.getPrototypeOf && r in Object.getPrototypeOf(e13) ? false : Fe(yC, r) ? true : !(r in Object.prototype || r in Function.prototype); } function hC(e13) { return typeof e13 == "object" && e13 && e13.constructor === Object; } var gC = { length: true, name: true }; var yC = { toString: true, valueOf: true, toLocaleString: true }; var Cs = class { 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; } }; var P0 = class { /** * @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(e13, r) { return { next: () => { var t = e13.next(); return t.done ? t : { value: r(t.value), done: false }; } }; } function Ii() { return /* @__PURE__ */ new Map(); } function La(e13) { if (!e13) return Ii(); if (da(e13)) return e13; if (ui(e13)) return new Cs(e13); throw new Error("createMap can create maps from objects or Maps"); } function bC(e13) { if (e13 instanceof Cs) return e13.wrappedObject; var r = {}; for (var t of e13.keys()) { var n = e13.get(t); Xa(r, t, n); } return r; } function We(e13) { return typeof e13 == "number"; } function Ze(e13) { return !e13 || typeof e13 != "object" || typeof e13.constructor != "function" ? false : e13.isBigNumber === true && typeof e13.constructor.prototype == "object" && e13.constructor.prototype.isBigNumber === true || typeof e13.constructor.isDecimal == "function" && e13.constructor.isDecimal(e13) === true; } function q0(e13) { return typeof e13 == "bigint"; } function Ut(e13) { return e13 && typeof e13 == "object" && Object.getPrototypeOf(e13).isComplex === true || false; } function Aa(e13) { return e13 && typeof e13 == "object" && Object.getPrototypeOf(e13).isFraction === true || false; } function ft(e13) { return e13 && e13.constructor.prototype.isUnit === true || false; } function Vr(e13) { return typeof e13 == "string"; } var cr = Array.isArray; function ze(e13) { return e13 && e13.constructor.prototype.isMatrix === true || false; } function At(e13) { return Array.isArray(e13) || ze(e13); } function Ri(e13) { return e13 && e13.isDenseMatrix && e13.constructor.prototype.isMatrix === true || false; } function kn(e13) { return e13 && e13.isSparseMatrix && e13.constructor.prototype.isMatrix === true || false; } function Ms(e13) { return e13 && e13.constructor.prototype.isRange === true || false; } function Gi(e13) { return e13 && e13.constructor.prototype.isIndex === true || false; } function L0(e13) { return typeof e13 == "boolean"; } function U0(e13) { return e13 && e13.constructor.prototype.isResultSet === true || false; } function Rl(e13) { return e13 && e13.constructor.prototype.isHelp === true || false; } function k0(e13) { return typeof e13 == "function"; } function V0(e13) { return e13 instanceof Date; } function H0(e13) { return e13 instanceof RegExp; } function ui(e13) { return !!(e13 && typeof e13 == "object" && e13.constructor === Object && !Ut(e13) && !Aa(e13)); } function da(e13) { return e13 ? e13 instanceof Map || e13 instanceof Cs || typeof e13.set == "function" && typeof e13.get == "function" && typeof e13.keys == "function" && typeof e13.has == "function" : false; } function wC(e13) { return da(e13) && da(e13.a) && da(e13.b); } function xC(e13) { return da(e13) && ui(e13.wrappedObject); } function Z0(e13) { return e13 === null; } function G0(e13) { return e13 === void 0; } function Jn(e13) { return e13 && e13.isAccessorNode === true && e13.constructor.prototype.isNode === true || false; } function bt(e13) { return e13 && e13.isArrayNode === true && e13.constructor.prototype.isNode === true || false; } function W0(e13) { return e13 && e13.isAssignmentNode === true && e13.constructor.prototype.isNode === true || false; } function K0(e13) { return e13 && e13.isBlockNode === true && e13.constructor.prototype.isNode === true || false; } function J0(e13) { return e13 && e13.isConditionalNode === true && e13.constructor.prototype.isNode === true || false; } function nr(e13) { return e13 && e13.isConstantNode === true && e13.constructor.prototype.isNode === true || false; } function Pu(e13) { return nr(e13) || _r(e13) && e13.args.length === 1 && nr(e13.args[0]) && "-+~".includes(e13.op); } function li(e13) { return e13 && e13.isFunctionAssignmentNode === true && e13.constructor.prototype.isNode === true || false; } function En(e13) { return e13 && e13.isFunctionNode === true && e13.constructor.prototype.isNode === true || false; } function Na(e13) { return e13 && e13.isIndexNode === true && e13.constructor.prototype.isNode === true || false; } function fr(e13) { return e13 && e13.isNode === true && e13.constructor.prototype.isNode === true || false; } function Wi(e13) { return e13 && e13.isObjectNode === true && e13.constructor.prototype.isNode === true || false; } function _r(e13) { return e13 && e13.isOperatorNode === true && e13.constructor.prototype.isNode === true || false; } function rn(e13) { return e13 && e13.isParenthesisNode === true && e13.constructor.prototype.isNode === true || false; } function Y0(e13) { return e13 && e13.isRangeNode === true && e13.constructor.prototype.isNode === true || false; } function j0(e13) { return e13 && e13.isRelationalNode === true && e13.constructor.prototype.isNode === true || false; } function $r(e13) { return e13 && e13.isSymbolNode === true && e13.constructor.prototype.isNode === true || false; } function Pl(e13) { return e13 && e13.constructor.prototype.isChain === true || false; } function yr(e13) { var r = typeof e13; return r === "object" ? e13 === null ? "null" : Ze(e13) ? "BigNumber" : e13.constructor && e13.constructor.name ? e13.constructor.name : "Object" : r; } function qe(e13) { var r = typeof e13; if (r === "number" || r === "bigint" || r === "string" || r === "boolean" || e13 === null || e13 === void 0) return e13; if (typeof e13.clone == "function") return e13.clone(); if (Array.isArray(e13)) return e13.map(function(t) { return qe(t); }); if (e13 instanceof Date) return new Date(e13.valueOf()); if (Ze(e13)) return e13; if (ui(e13)) return AC(e13, qe); if (r === "function") return e13; throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e13, ")")); } function AC(e13, r) { var t = {}; for (var n in e13) Fe(e13, n) && (t[n] = r(e13[n])); return t; } function X0(e13, r) { for (var t in r) Fe(r, t) && (e13[t] = r[t]); return e13; } function Q0(e13, 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) e13[t] === void 0 && (e13[t] = {}), e13[t] && e13[t].constructor === Object ? Q0(e13[t], r[t]) : e13[t] = r[t]; else { if (Array.isArray(r[t])) throw new TypeError("Arrays are not supported by deepExtend"); e13[t] = r[t]; } return e13; } function Sn(e13, r) { var t, n, a; if (Array.isArray(e13)) { if (!Array.isArray(r) || e13.length !== r.length) return false; for (n = 0, a = e13.length; n < a; n++) if (!Sn(e13[n], r[n])) return false; return true; } else { if (typeof e13 == "function") return e13 === r; if (e13 instanceof Object) { if (Array.isArray(r) || !(r instanceof Object)) return false; for (t in e13) if (!(t in r) || !Sn(e13[t], r[t])) return false; for (t in r) if (!(t in e13)) return false; return true; } else return e13 === r; } } function NC(e13) { var r = {}; return eg(e13, r), r; } function eg(e13, r) { for (var t in e13) if (Fe(e13, t)) { var n = e13[t]; typeof n == "object" && n !== null ? eg(n, r) : r[t] = n; } } function $o(e13, r, t) { var n = true, a; Object.defineProperty(e13, r, { get: function() { return n && (a = t(), n = false), a; }, set: function(o) { a = o, n = false; }, configurable: true, enumerable: true }); } function Fe(e13, r) { return e13 && Object.hasOwnProperty.call(e13, r); } function DC(e13) { return e13 && typeof e13.factory == "function"; } function EC(e13, r) { for (var t = {}, n = 0; n < r.length; n++) { var a = r[n], i = e13[a]; i !== void 0 && (t[a] = i); } return t; } var zf = ["Matrix", "Array"]; var qf = ["number", "BigNumber", "Fraction"]; function SC(e13, 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(e13); Lf(n, "matrix", zf), Lf(n, "number", qf), Q0(e13, n); var o = qe(e13), l = qe(n); return r("config", o, i, l), o; } else return qe(e13); } return t.MATRIX_OPTIONS = zf, t.NUMBER_OPTIONS = qf, Object.keys(R0).forEach((n) => { Object.defineProperty(t, n, { get: () => e13[n], enumerable: true, configurable: true }); }), t; } function Lf(e13, r, t) { e13[r] !== void 0 && !t.includes(e13[r]) && console.warn('Warning: Unknown value "' + e13[r] + '" for configuration option "' + r + '". Available options: ' + t.map((n) => JSON.stringify(n)).join(", ") + "."); } function Uf() { return true; } function Et() { return false; } function _a() { } var kf = "Argument is not a typed-function."; function rg() { function e13(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: e13 }, { name: "null", test: function(k) { return k === null; } }, { name: "undefined", test: function(k) { return k === void 0; } }], t = { name: "any", test: Uf, isAny: true }; 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], false); } 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 = h10(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 = false, 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: false, 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 h10(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 : false; } 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 true; return false; }; } } 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 false; return true; }; return function(Ee) { for (let Ae = 0; Ae < J.length; Ae++) if (!J[Ae](Ee[Ae])) return false; 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 false; 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 ? h10(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: false, restParam: true }), Ne.push(de); } else Ne = de.types.map(function(we) { return { types: [we], name: we.name, hasAny: we.isAny, hasConversion: we.conversion, restParam: false }; }); 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 = false, ir; for (ir of Ae) if (Ee.has(ir)) { ar = true; break; } if (!ar) return false; } 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 false; ae.push(de); } return ae; } function Q(k, J, G) { const ae = V(k), fe = new Array(ae.length).fill(false); let de = true; for (; de; ) { de = false; let Ne = true; 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] = true, Ne = false; 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] = true, Ne = false) : de = true; } } 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)) : e13(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 = true, o.addType = function(k, J) { let G = "any"; J !== false && 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: false }; 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; } var Pi = rg(); function P(e13, r, t, n) { function a(i) { var o = EC(i, r.map(tg)); return CC(e13, r, i), t(o); } return a.isFactory = true, a.fn = e13, a.dependencies = r.slice().sort(), n && (a.meta = n), a; } function _i(e13) { return typeof e13 == "function" && typeof e13.fn == "string" && Array.isArray(e13.dependencies); } function CC(e13, 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(e13, '", ') + "some dependencies are missing: ".concat(a.map((i) => '"'.concat(i, '"')).join(", "), ".")); } } function MC(e13) { return e13 && e13[0] === "?"; } function tg(e13) { return e13 && e13[0] === "?" ? e13.slice(1) : e13; } function Oe(e13) { return typeof e13 == "boolean" ? true : isFinite(e13) ? e13 === Math.round(e13) : false; } function _C(e13) { return /^-?\d+$/.test(e13); } function Qn(e13, r) { return r.number === "bigint" && !_C(e13) ? r.numberFallback : r.number; } var Vn = Math.sign || function(e13) { return e13 > 0 ? 1 : e13 < 0 ? -1 : 0; }; var FC = Math.log2 || function(r) { return Math.log(r) / Math.LN2; }; var TC = Math.log10 || function(r) { return Math.log(r) / Math.LN10; }; var OC = Math.log1p || function(e13) { return Math.log(e13 + 1); }; var 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; }; var $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(e13, 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 (e13 > 2 ** (t - 1) - 1 || e13 < -(2 ** (t - 1))) throw new Error("Value must be in range [-2^".concat(t - 1, ", 2^").concat(t - 1, "-1]")); if (!Oe(e13)) throw new Error("Value must be an integer"); e13 < 0 && (e13 = e13 + 2 ** t), i = "i".concat(t); } var o = ""; return e13 < 0 && (e13 = -e13, o = "-"), "".concat(o).concat(a).concat(e13.toString(r)).concat(i); } function pa(e13, r) { if (typeof r == "function") return r(e13); if (e13 === 1 / 0) return "Infinity"; if (e13 === -1 / 0) return "-Infinity"; if (isNaN(e13)) return "NaN"; var { notation: t, precision: n, wordSize: a } = ng(r); switch (t) { case "fixed": return ag(e13, n); case "exponential": return ig(e13, n); case "engineering": return IC(e13, n); case "bin": return uu(e13, 2, a); case "oct": return uu(e13, 8, a); case "hex": return uu(e13, 16, a); case "auto": return RC(e13, 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(e13) { var r = "auto", t, n; if (e13 !== void 0) if (We(e13)) t = e13; else if (Ze(e13)) t = e13.toNumber(); else if (ui(e13)) e13.precision !== void 0 && (t = Vf(e13.precision, () => { throw new Error('Option "precision" must be a number or BigNumber'); })), e13.wordSize !== void 0 && (n = Vf(e13.wordSize, () => { throw new Error('Option "wordSize" must be a number or BigNumber'); })), e13.notation && (r = e13.notation); else throw new Error("Unsupported type of options, number, BigNumber, or object expected"); return { notation: r, precision: t, wordSize: n }; } function Ki(e13) { var r = String(e13).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/); if (!r) throw new SyntaxError("Invalid number " + e13); 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(e13, r) { if (isNaN(e13) || !isFinite(e13)) return String(e13); var t = Ki(e13), 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(e13, r) { if (isNaN(e13) || !isFinite(e13)) return String(e13); var t = Ki(e13), 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(e13, r) { if (isNaN(e13) || !isFinite(e13)) return String(e13); var t = Ki(e13), 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(e13, r, t) { if (isNaN(e13) || !isFinite(e13)) return String(e13); var n = Hf(t == null ? void 0 : t.lowerExp, -3), a = Hf(t == null ? void 0 : t.upperExp, 5), i = Ki(e13), o = r ? _s(i, r) : i; if (o.exponent < n || o.exponent >= a) return ig(e13, 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(e13, r) { for (var t = { sign: e13.sign, coefficients: e13.coefficients, exponent: e13.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(e13) { for (var r = [], t = 0; t < e13; t++) r.push(0); return r; } function PC(e13) { return e13.toExponential().replace(/e.*$/, "").replace(/^0\.?0*|\./, "").length; } function Gr(e13, 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(e13) || isNaN(r) ? false : !isFinite(e13) || !isFinite(r) ? e13 === r : e13 === r ? true : Math.abs(e13 - r) <= Math.max(t * Math.max(Math.abs(e13), Math.abs(r)), n); } var zC = Math.acosh || function(e13) { return Math.log(Math.sqrt(e13 * e13 - 1) + e13); }; var qC = Math.asinh || function(e13) { return Math.log(Math.sqrt(e13 * e13 + 1) + e13); }; var LC = Math.atanh || function(e13) { return Math.log((1 + e13) / (1 - e13)) / 2; }; var UC = Math.cosh || function(e13) { return (Math.exp(e13) + Math.exp(-e13)) / 2; }; var kC = Math.sinh || function(e13) { return (Math.exp(e13) - Math.exp(-e13)) / 2; }; var VC = Math.tanh || function(e13) { var r = Math.exp(2 * e13); return (r - 1) / (r + 1); }; function HC(e13, r) { var t = true, n = r > 0 ? true : r < 0 ? false : 1 / r === 1 / 0; return t ^ n ? -e13 : e13; } function Vf(e13, r) { if (We(e13)) return e13; if (Ze(e13)) return e13.toNumber(); r(); } function Hf(e13, r) { return We(e13) ? e13 : Ze(e13) ? e13.toNumber() : r; } var og = function() { return og = Pi.create, Pi; }; var ZC = ["?BigNumber", "?Complex", "?DenseMatrix", "?Fraction"]; var GC = 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(e13) { throw new Error("Cannot convert value ".concat(e13, " into a BigNumber: no class 'BigNumber' provided")); } function fo(e13) { throw new Error("Cannot convert value ".concat(e13, " 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(e13) { throw new Error("Cannot convert value ".concat(e13, " into a Fraction, no class 'Fraction' provided.")); } var KC = "ResultSet"; var JC = []; var YC = P(KC, JC, () => { function e13(r) { if (!(this instanceof e13)) throw new SyntaxError("Constructor must be called with the new operator"); this.entries = r || []; } return e13.prototype.type = "ResultSet", e13.prototype.isResultSet = true, e13.prototype.valueOf = function() { return this.entries; }, e13.prototype.toString = function() { return "[" + this.entries.map(String).join(", ") + "]"; }, e13.prototype.toJSON = function() { return { mathjs: "ResultSet", entries: this.entries }; }, e13.fromJSON = function(r) { return new e13(r.entries); }, e13; }, { isClass: true }); var Ra = 9e15; var ea = 1e9; var zu = "0123456789abcdef"; var Go = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058"; var Wo = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789"; var 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: false // true/false }; var sg; var bn; var Ke = true; var Fs = "[DecimalError] "; var Yn = Fs + "Invalid argument: "; var ug = Fs + "Precision limit exceeded"; var lg = Fs + "crypto unavailable"; var cg = "[object Decimal]"; var Qr = Math.floor; var Br = Math.pow; var jC = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i; var XC = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i; var QC = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i; var fg = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; var kt = 1e7; var Le = 7; var eM = 9007199254740991; var rM = Go.length - 1; var Lu = Wo.length - 1; var ye = { toStringTag: cg }; ye.absoluteValue = ye.abs = function() { var e13 = new this.constructor(this); return e13.s < 0 && (e13.s = 1), Ie(e13); }; ye.ceil = function() { return Ie(new this.constructor(this), this.e + 1, 2); }; ye.clampedTo = ye.clamp = function(e13, r) { var t, n = this, a = n.constructor; if (e13 = new a(e13), r = new a(r), !e13.s || !r.s) return new a(NaN); if (e13.gt(r)) throw Error(Yn + r); return t = n.cmp(e13), t < 0 ? e13 : n.cmp(r) > 0 ? r : new a(n); }; ye.comparedTo = ye.cmp = function(e13) { var r, t, n, a, i = this, o = i.d, l = (e13 = new i.constructor(e13)).d, u = i.s, s = e13.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 !== e13.e) return i.e > e13.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 e13, r, t = this, n = t.constructor; return t.d ? t.d[0] ? (e13 = n.precision, r = n.rounding, n.precision = e13 + Math.max(t.e, t.sd()) + Le, n.rounding = 1, t = tM(n, hg(n, t)), n.precision = e13, n.rounding = r, Ie(bn == 2 || bn == 3 ? t.neg() : t, e13, r, true)) : new n(1) : new n(NaN); }; ye.cubeRoot = ye.cbrt = function() { var e13, 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 = false, i = c.s * Br(c.s * c, 1 / 3), !i || Math.abs(i) == 1 / 0 ? (t = Hr(c.d), e13 = c.e, (i = (e13 - t.length + 1) % 3) && (t += i == 1 || i == -2 ? "0" : "00"), i = Br(t, 1 / 3), e13 = Qr((e13 + 1) / 3) - (e13 % 3 == (e13 < 0 ? -1 : 2)), i == 1 / 0 ? t = "5e" + e13 : (t = i.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + e13), n = new f(t), n.s = c.s) : n = new f(i.toString()), o = (e13 = 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, e13 + 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, e13 + 1, 1), r = !n.times(n).times(n).eq(c)); break; } return Ke = true, Ie(n, e13, f.rounding, r); }; ye.decimalPlaces = ye.dp = function() { var e13, r = this.d, t = NaN; if (r) { if (e13 = r.length - 1, t = (e13 - Qr(this.e / Le)) * Le, e13 = r[e13], e13) for (; e13 % 10 == 0; e13 /= 10) t--; t < 0 && (t = 0); } return t; }; ye.dividedBy = ye.div = function(e13) { return wr(this, new this.constructor(e13)); }; ye.dividedToIntegerBy = ye.divToInt = function(e13) { var r = this, t = r.constructor; return Ie(wr(r, new t(e13), 0, 1, 1), t.precision, t.rounding); }; ye.equals = ye.eq = function(e13) { return this.cmp(e13) === 0; }; ye.floor = function() { return Ie(new this.constructor(this), this.e + 1, 3); }; ye.greaterThan = ye.gt = function(e13) { return this.cmp(e13) > 0; }; ye.greaterThanOrEqualTo = ye.gte = function(e13) { var r = this.cmp(e13); return r == 1 || r === 0; }; ye.hyperbolicCosine = ye.cosh = function() { var e13, 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 ? (e13 = Math.ceil(a / 3), r = (1 / Os(4, e13)).toString()) : (e13 = 16, r = "2.3283064365386962890625e-10"), i = Qa(o, 1, i.times(r), new o(1), true); for (var u, s = e13, 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, true); }; ye.hyperbolicSine = ye.sinh = function() { var e13, 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, true); else { e13 = 1.4 * Math.sqrt(n), e13 = e13 > 16 ? 16 : e13 | 0, a = a.times(1 / Os(5, e13)), a = Qa(i, 2, a, a, true); for (var o, l = new i(5), u = new i(16), s = new i(20); e13--; ) 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, true); }; ye.hyperbolicTangent = ye.tanh = function() { var e13, r, t = this, n = t.constructor; return t.isFinite() ? t.isZero() ? new n(t) : (e13 = n.precision, r = n.rounding, n.precision = e13 + 7, n.rounding = 1, wr(t.sinh(), t.cosh(), n.precision = e13, n.rounding = r)) : new n(t.s); }; ye.inverseCosine = ye.acos = function() { var e13 = this, r = e13.constructor, t = e13.abs().cmp(1), n = r.precision, a = r.rounding; return t !== -1 ? t === 0 ? e13.isNeg() ? jt(r, n, a) : new r(0) : new r(NaN) : e13.isZero() ? jt(r, n + 4, a).times(0.5) : (r.precision = n + 6, r.rounding = 1, e13 = new r(1).minus(e13).div(e13.plus(1)).sqrt().atan(), r.precision = n, r.rounding = a, e13.times(2)); }; ye.inverseHyperbolicCosine = ye.acosh = function() { var e13, r, t = this, n = t.constructor; return t.lte(1) ? new n(t.eq(1) ? 0 : NaN) : t.isFinite() ? (e13 = n.precision, r = n.rounding, n.precision = e13 + Math.max(Math.abs(t.e), t.sd()) + 4, n.rounding = 1, Ke = false, t = t.times(t).minus(1).sqrt().plus(t), Ke = true, n.precision = e13, n.rounding = r, t.ln()) : new n(t); }; ye.inverseHyperbolicSine = ye.asinh = function() { var e13, r, t = this, n = t.constructor; return !t.isFinite() || t.isZero() ? new n(t) : (e13 = n.precision, r = n.rounding, n.precision = e13 + 2 * Math.max(Math.abs(t.e), t.sd()) + 6, n.rounding = 1, Ke = false, t = t.times(t).plus(1).sqrt().plus(t), Ke = true, n.precision = e13, n.rounding = r, t.ln()); }; ye.inverseHyperbolicTangent = ye.atanh = function() { var e13, 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) : (e13 = i.precision, r = i.rounding, n = a.sd(), Math.max(n, e13) < 2 * -a.e - 1 ? Ie(new i(a), e13, r, true) : (i.precision = t = n - a.e, a = wr(a.plus(1), new i(1).minus(a), t + e13, 1), i.precision = e13 + 4, i.rounding = 1, a = a.ln(), i.precision = e13, i.rounding = r, a.times(0.5))) : new i(NaN); }; ye.inverseSine = ye.asin = function() { var e13, 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 ? (e13 = jt(i, t + 4, n).times(0.5), e13.s = a.s, e13) : 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 e13, 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), e13 = t; e13; --e13) s = s.div(s.times(s).plus(1).sqrt().plus(1)); for (Ke = false, r = Math.ceil(l / Le), n = 1, u = s.times(s), o = new c(s), a = s; e13 !== -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 (e13 = r; o.d[e13] === i.d[e13] && e13--; ) ; return t && (o = o.times(2 << t - 1)), Ke = true, Ie(o, c.precision = f, c.rounding = d, true); }; 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(e13) { return this.cmp(e13) < 0; }; ye.lessThanOrEqualTo = ye.lte = function(e13) { return this.cmp(e13) < 1; }; ye.logarithm = ye.log = function(e13) { var r, t, n, a, i, o, l, u, s = this, c = s.constructor, f = c.precision, d = c.rounding, p = 5; if (e13 == null) e13 = new c(10), r = true; else { if (e13 = new c(e13), t = e13.d, e13.s < 0 || !t || !t[0] || e13.eq(1)) return new c(NaN); r = e13.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 = true; else { for (a = t[0]; a % 10 === 0; ) a /= 10; i = a !== 1; } if (Ke = false, l = f + p, o = Hn(s, l), n = r ? Ko(c, l + 10) : Hn(e13, 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(e13, 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 = true, Ie(u, f, d); }; ye.minus = ye.sub = function(e13) { var r, t, n, a, i, o, l, u, s, c, f, d, p = this, m = p.constructor; if (e13 = new m(e13), !p.d || !e13.d) return !p.s || !e13.s ? e13 = new m(NaN) : p.d ? e13.s = -e13.s : e13 = new m(e13.d || p.s !== e13.s ? p : NaN), e13; if (p.s != e13.s) return e13.s = -e13.s, p.plus(e13); if (s = p.d, d = e13.d, l = m.precision, u = m.rounding, !s[0] || !d[0]) { if (d[0]) e13.s = -e13.s; else if (s[0]) e13 = new m(p); else return new m(u === 3 ? -0 : 0); return Ke ? Ie(e13, l, u) : e13; } if (t = Qr(e13.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, e13.s = -e13.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] ? (e13.d = s, e13.e = Ts(s, t), Ke ? Ie(e13, l, u) : e13) : new m(u === 3 ? -0 : 0); }; ye.modulo = ye.mod = function(e13) { var r, t = this, n = t.constructor; return e13 = new n(e13), !t.d || !e13.s || e13.d && !e13.d[0] ? new n(NaN) : !e13.d || t.d && !t.d[0] ? Ie(new n(t), n.precision, n.rounding) : (Ke = false, n.modulo == 9 ? (r = wr(t, e13.abs(), 0, 3, 1), r.s *= e13.s) : r = wr(t, e13, 0, n.modulo, 1), r = r.times(e13), Ke = true, 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 e13 = new this.constructor(this); return e13.s = -e13.s, Ie(e13); }; ye.plus = ye.add = function(e13) { var r, t, n, a, i, o, l, u, s, c, f = this, d = f.constructor; if (e13 = new d(e13), !f.d || !e13.d) return !f.s || !e13.s ? e13 = new d(NaN) : f.d || (e13 = new d(e13.d || f.s === e13.s ? f : NaN)), e13; if (f.s != e13.s) return e13.s = -e13.s, f.minus(e13); if (s = f.d, c = e13.d, l = d.precision, u = d.rounding, !s[0] || !c[0]) return c[0] || (e13 = new d(f)), Ke ? Ie(e13, l, u) : e13; if (i = Qr(f.e / Le), n = Qr(e13.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 e13.d = s, e13.e = Ts(s, n), Ke ? Ie(e13, l, u) : e13; }; ye.precision = ye.sd = function(e13) { var r, t = this; if (e13 !== void 0 && e13 !== !!e13 && e13 !== 1 && e13 !== 0) throw Error(Yn + e13); return t.d ? (r = dg(t.d), e13 && t.e + 1 > r && (r = t.e + 1)) : r = NaN, r; }; ye.round = function() { var e13 = this, r = e13.constructor; return Ie(new r(e13), e13.e + 1, r.rounding); }; ye.sine = ye.sin = function() { var e13, r, t = this, n = t.constructor; return t.isFinite() ? t.isZero() ? new n(t) : (e13 = n.precision, r = n.rounding, n.precision = e13 + Math.max(t.e, t.sd()) + Le, n.rounding = 1, t = aM(n, hg(n, t)), n.precision = e13, n.rounding = r, Ie(bn > 2 ? t.neg() : t, e13, r, true)) : new n(NaN); }; ye.squareRoot = ye.sqrt = function() { var e13, 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 = false, 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), e13 = !n.times(n).eq(o)); break; } return Ke = true, Ie(n, u, c.rounding, e13); }; ye.tangent = ye.tan = function() { var e13, r, t = this, n = t.constructor; return t.isFinite() ? t.isZero() ? new n(t) : (e13 = n.precision, r = n.rounding, n.precision = e13 + 10, n.rounding = 1, t = t.sin(), t.s = 1, t = wr(t, new n(1).minus(t.times(t)).sqrt(), e13 + 10, 0), n.precision = e13, n.rounding = r, Ie(bn == 2 || bn == 4 ? t.neg() : t, e13, r, true)) : new n(NaN); }; ye.times = ye.mul = function(e13) { var r, t, n, a, i, o, l, u, s, c = this, f = c.constructor, d = c.d, p = (e13 = new f(e13)).d; if (e13.s *= c.s, !d || !d[0] || !p || !p[0]) return new f(!e13.s || d && !d[0] && !p || p && !p[0] && !d ? NaN : !d || !p ? e13.s / 0 : e13.s * 0); for (t = Qr(c.e / Le) + Qr(e13.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(), e13.d = i, e13.e = Ts(i, t), Ke ? Ie(e13, f.precision, f.rounding) : e13; }; ye.toBinary = function(e13, r) { return zl(this, 2, e13, r); }; ye.toDecimalPlaces = ye.toDP = function(e13, r) { var t = this, n = t.constructor; return t = new n(t), e13 === void 0 ? t : (vt(e13, 0, ea), r === void 0 ? r = n.rounding : vt(r, 0, 8), Ie(t, e13 + t.e + 1, r)); }; ye.toExponential = function(e13, r) { var t, n = this, a = n.constructor; return e13 === void 0 ? t = tn(n, true) : (vt(e13, 0, ea), r === void 0 ? r = a.rounding : vt(r, 0, 8), n = Ie(new a(n), e13 + 1, r), t = tn(n, true, e13 + 1)), n.isNeg() && !n.isZero() ? "-" + t : t; }; ye.toFixed = function(e13, r) { var t, n, a = this, i = a.constructor; return e13 === void 0 ? t = tn(a) : (vt(e13, 0, ea), r === void 0 ? r = i.rounding : vt(r, 0, 8), n = Ie(new i(a), e13 + a.e + 1, r), t = tn(n, false, e13 + n.e + 1)), a.isNeg() && !a.isZero() ? "-" + t : t; }; ye.toFraction = function(e13) { 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), e13 == null) e13 = i > 0 ? r : s; else { if (l = new v(e13), !l.isInt() || l.lt(s)) throw Error(Yn + l); e13 = l.gt(r) ? i > 0 ? r : s : l; } for (Ke = false, 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(e13) != 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(e13.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 = true, d; }; ye.toHexadecimal = ye.toHex = function(e13, r) { return zl(this, 16, e13, r); }; ye.toNearest = function(e13, r) { var t = this, n = t.constructor; if (t = new n(t), e13 == null) { if (!t.d) return t; e13 = new n(1), r = n.rounding; } else { if (e13 = new n(e13), r === void 0 ? r = n.rounding : vt(r, 0, 8), !t.d) return e13.s ? t : e13; if (!e13.d) return e13.s && (e13.s = t.s), e13; } return e13.d[0] ? (Ke = false, t = wr(t, e13, 0, r, 1).times(e13), Ke = true, Ie(t)) : (e13.s = t.s, t = e13), t; }; ye.toNumber = function() { return +this; }; ye.toOctal = function(e13, r) { return zl(this, 8, e13, r); }; ye.toPower = ye.pow = function(e13) { var r, t, n, a, i, o, l = this, u = l.constructor, s = +(e13 = new u(e13)); if (!l.d || !e13.d || !l.d[0] || !e13.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, e13.eq(1)) return Ie(l, n, i); if (r = Qr(e13.e / Le), r >= e13.d.length - 1 && (t = s < 0 ? -s : s) <= eM) return a = pg(u, l, t, n), e13.s < 0 ? new u(1).div(a) : Ie(a, n, i); if (o = l.s, o < 0) { if (r < e13.d.length - 1) return new u(NaN); if (e13.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 = false, u.rounding = l.s = 1, t = Math.min(12, (r + "").length), a = Uu(e13.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(e13.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 = true, u.rounding = i, Ie(a, n, i)); }; ye.toPrecision = function(e13, r) { var t, n = this, a = n.constructor; return e13 === void 0 ? t = tn(n, n.e <= a.toExpNeg || n.e >= a.toExpPos) : (vt(e13, 1, ea), r === void 0 ? r = a.rounding : vt(r, 0, 8), n = Ie(new a(n), e13, r), t = tn(n, e13 <= n.e || n.e <= a.toExpNeg, e13)), n.isNeg() && !n.isZero() ? "-" + t : t; }; ye.toSignificantDigits = ye.toSD = function(e13, r) { var t = this, n = t.constructor; return e13 === void 0 ? (e13 = n.precision, r = n.rounding) : (vt(e13, 1, ea), r === void 0 ? r = n.rounding : vt(r, 0, 8)), Ie(new n(t), e13, r); }; ye.toString = function() { var e13 = this, r = e13.constructor, t = tn(e13, e13.e <= r.toExpNeg || e13.e >= r.toExpPos); return e13.isNeg() && !e13.isZero() ? "-" + t : t; }; ye.truncated = ye.trunc = function() { return Ie(new this.constructor(this), this.e + 1, 1); }; ye.valueOf = ye.toJSON = function() { var e13 = this, r = e13.constructor, t = tn(e13, e13.e <= r.toExpNeg || e13.e >= r.toExpPos); return e13.isNeg() ? "-" + t : t; }; function Hr(e13) { var r, t, n, a = e13.length - 1, i = "", o = e13[0]; if (a > 0) { for (i += o, r = 1; r < a; r++) n = e13[r] + "", t = Le - n.length, t && (i += zn(t)), i += n; o = e13[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(e13, r, t) { if (e13 !== ~~e13 || e13 < r || e13 > t) throw Error(Yn + e13); } function zi(e13, r, t, n) { var a, i, o, l; for (i = e13[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 = e13[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) && (e13[a + 1] / i / 100 | 0) == Br(10, r - 2) - 1 || (l == i / 2 || l == 0) && (e13[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) && (e13[a + 1] / i / 1e3 | 0) == Br(10, r - 3) - 1, o; } function Io(e13, r, t) { for (var n, a = [0], i, o = 0, l = e13.length; o < l; ) { for (i = a.length; i--; ) a[i] *= r; for (a[0] += zu.indexOf(e13.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(e13, 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"), e13.precision += t, r = Qa(e13, 1, r.times(a), new e13(1)); for (var i = t; i--; ) { var o = r.times(r); r = o.times(o).minus(o).times(8).plus(1); } return e13.precision -= t, r; } var wr = /* @__PURE__ */ function() { function e13(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, h10, 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 = true; 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 = e13(C, d, u), B = e13(B, d, u), M = C.length, N = B.length), E = M, h10 = B.slice(0, M), x = h10.length; x < M; ) h10[x++] = 0; F = C.slice(), F.unshift(0), S = C[0], C[1] >= u / 2 && ++S; do d = 0, s = r(C, h10, M, x), s < 0 ? (w = h10[0], M != x && (w = w * u + (h10[1] || 0)), d = w / S | 0, d > 1 ? (d >= u && (d = u - 1), v = e13(C, d, u), b = v.length, x = h10.length, s = r(v, h10, 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(h10, v, x, u), s == -1 && (x = h10.length, s = r(C, h10, M, x), s < 1 && (d++, t(h10, M < x ? F : C, x, u))), x = h10.length) : s === 0 && (d++, h10 = [0]), A[f++] = d, s && h10[0] ? h10[x++] = B[E] || 0 : (h10 = [B[E]], x = 1); while ((E++ < N || h10[0] !== void 0) && g--); m = h10[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(e13, r, t, n) { var a, i, o, l, u, s, c, f, d, p = e13.constructor; e: if (r != null) { if (f = e13.d, !f) return e13; 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 == (e13.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 == (e13.s < 0 ? 8 : 7)), r < 1 || !f[0]) return f.length = 0, s ? (r -= e13.e + 1, f[0] = Br(10, (Le - r % Le) % Le), e13.e = -r || 0) : f[0] = e13.e = 0, e13; 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 && (e13.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 && (e13.e > p.maxE ? (e13.d = null, e13.e = NaN) : e13.e < p.minE && (e13.e = 0, e13.d = [0])), e13; } function tn(e13, r, t) { if (!e13.isFinite()) return vg(e13); var n, a = e13.e, i = Hr(e13.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 + (e13.e < 0 ? "e" : "e+") + e13.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(e13, r) { var t = e13[0]; for (r *= Le; t >= 10; t /= 10) r++; return r; } function Ko(e13, r, t) { if (r > rM) throw Ke = true, t && (e13.precision = t), Error(ug); return Ie(new e13(Go), r, 1, true); } function jt(e13, r, t) { if (r > Lu) throw Error(ug); return Ie(new e13(Wo), r, t, true); } function dg(e13) { var r = e13.length - 1, t = r * Le + 1; if (r = e13[r], r) { for (; r % 10 == 0; r /= 10) t--; for (r = e13[0]; r >= 10; r /= 10) t++; } return t; } function zn(e13) { for (var r = ""; e13--; ) r += "0"; return r; } function pg(e13, r, t, n) { var a, i = new e13(1), o = Math.ceil(n / Le + 4); for (Ke = false; ; ) { if (t % 2 && (i = i.times(r), Gf(i.d, o) && (a = true)), 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 = true, i; } function Zf(e13) { return e13.d[e13.d.length - 1] & 1; } function mg(e13, r, t) { for (var n, a, i = new e13(r[0]), o = 0; ++o < r.length; ) { if (a = new e13(r[o]), !a.s) { i = a; break; } n = i.cmp(a), (n === t || n === 0 && i.s === t) && (i = a); } return i; } function Uu(e13, r) { var t, n, a, i, o, l, u, s = 0, c = 0, f = 0, d = e13.constructor, p = d.rounding, m = d.precision; if (!e13.d || !e13.d[0] || e13.e > 17) return new d(e13.d ? e13.d[0] ? e13.s < 0 ? 0 : 1 / 0 : 1 : e13.s ? e13.s < 0 ? 0 : e13 : NaN); for (r == null ? (Ke = false, u = m) : u = r, l = new d(0.03125); e13.e > -2; ) e13 = e13.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(e13), 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 = true); else return d.precision = m, o; } o = l; } } function Hn(e13, r) { var t, n, a, i, o, l, u, s, c, f, d, p = 1, m = 10, v = e13, b = v.d, y = v.constructor, A = y.rounding, h10 = 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 = false, c = h10) : 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(e13), 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, h10).times(i + ""), v = Hn(new y(n + "." + t.slice(1)), c - m).plus(s), y.precision = h10, r == null ? Ie(v, h10, A, Ke = true) : 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, h10).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 = h10, A, Ke = true); else return y.precision = h10, u; u = s, a += 2; } } function vg(e13) { return String(e13.s * e13.s / 0); } function Ro(e13, 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, e13.e = t = t - n - 1, e13.d = [], n = (t + 1) % Le, t < 0 && (n += Le), n < a) { for (n && e13.d.push(+r.slice(0, n)), a -= Le; n < a; ) e13.d.push(+r.slice(n, n += Le)); r = r.slice(n), n = Le - r.length; } else n -= a; for (; n--; ) r += "0"; e13.d.push(+r), Ke && (e13.e > e13.constructor.maxE ? (e13.d = null, e13.e = NaN) : e13.e < e13.constructor.minE && (e13.e = 0, e13.d = [0])); } else e13.e = 0, e13.d = [0]; return e13; } function nM(e13, 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(e13, r); } else if (r === "Infinity" || r === "NaN") return +r || (e13.s = NaN), e13.e = NaN, e13.d = null, e13; 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 = e13.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(e13.s * 0) : (e13.e = Ts(s, c), e13.d = s, Ke = false, o && (e13 = wr(e13, a, l * 4)), u && (e13 = e13.times(Math.abs(u) < 54 ? Br(2, u) : jn.pow(2, u))), Ke = true, e13); } function aM(e13, r) { var t, n = r.d.length; if (n < 3) return r.isZero() ? r : Qa(e13, 2, r, r); t = 1.4 * Math.sqrt(n), t = t > 16 ? 16 : t | 0, r = r.times(1 / Os(5, t)), r = Qa(e13, 2, r, r); for (var a, i = new e13(5), o = new e13(16), l = new e13(20); t--; ) a = r.times(r), r = r.times(i.plus(a.times(o.times(a).minus(l)))); return r; } function Qa(e13, r, t, n, a) { var i, o, l, u, s = e13.precision, c = Math.ceil(s / Le); for (Ke = false, u = t.times(t), l = new e13(n); ; ) { if (o = wr(l.times(u), new e13(r++ * r++), s, 1), l = a ? n.plus(o) : n.minus(o), n = wr(o.times(u), new e13(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 = true, o.d.length = c + 1, o; } function Os(e13, r) { for (var t = e13; --r; ) t *= e13; return t; } function hg(e13, r) { var t, n = r.s < 0, a = jt(e13, e13.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(e13, r, t, n) { var a, i, o, l, u, s, c, f, d, p = e13.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), !e13.isFinite()) c = vg(e13); else { for (c = tn(e13), 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-- : (e13 = new p(e13), e13.d = f, e13.e = i, e13 = wr(e13, d, t, n, 0, a), f = e13.d, i = e13.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 === (e13.s < 0 ? 3 : 2)) : o > l || o === l && (n === 4 || s || n === 6 && f[t - 1] & 1 || n === (e13.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 e13.s < 0 ? "-" + c : c; } function Gf(e13, r) { if (e13.length > r) return e13.length = r, true; } function iM(e13) { return new this(e13).abs(); } function oM(e13) { return new this(e13).acos(); } function sM(e13) { return new this(e13).acosh(); } function uM(e13, r) { return new this(e13).plus(r); } function lM(e13) { return new this(e13).asin(); } function cM(e13) { return new this(e13).asinh(); } function fM(e13) { return new this(e13).atan(); } function dM(e13) { return new this(e13).atanh(); } function pM(e13, r) { e13 = new this(e13), r = new this(r); var t, n = this.precision, a = this.rounding, i = n + 4; return !e13.s || !r.s ? t = new this(NaN) : !e13.d && !r.d ? (t = jt(this, i, 1).times(r.s > 0 ? 0.25 : 0.75), t.s = e13.s) : !r.d || e13.isZero() ? (t = r.s < 0 ? jt(this, n, a) : new this(0), t.s = e13.s) : !e13.d || r.isZero() ? (t = jt(this, i, 1).times(0.5), t.s = e13.s) : r.s < 0 ? (this.precision = i, this.rounding = 1, t = this.atan(wr(e13, r, i, 1)), r = jt(this, i, 1), this.precision = n, this.rounding = a, t = e13.s < 0 ? t.minus(r) : t.plus(r)) : t = this.atan(wr(e13, r, i, 1)), t; } function mM(e13) { return new this(e13).cbrt(); } function vM(e13) { return Ie(e13 = new this(e13), e13.e + 1, 2); } function hM(e13, r, t) { return new this(e13).clamp(r, t); } function gM(e13) { if (!e13 || typeof e13 != "object") throw Error(Fs + "Object expected"); var r, t, n, a = e13.defaults === true, 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 = e13[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 = e13[t]) !== void 0) if (n === true || n === false || n === 0 || n === 1) if (n) if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes)) this[t] = true; else throw Error(lg); else this[t] = false; else throw Error(Yn + t + ": " + n); return this; } function yM(e13) { return new this(e13).cos(); } function bM(e13) { return new this(e13).cosh(); } function gg(e13) { 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, e13 === void 0 && (e13 = {}), e13 && e13.defaults !== true) for (n = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], r = 0; r < n.length; ) e13.hasOwnProperty(t = n[r++]) || (e13[t] = this[t]); return a.config(e13), a; } function wM(e13, r) { return new this(e13).div(r); } function xM(e13) { return new this(e13).exp(); } function AM(e13) { return Ie(e13 = new this(e13), e13.e + 1, 3); } function NM() { var e13, r, t = new this(0); for (Ke = false, e13 = 0; e13 < arguments.length; ) if (r = new this(arguments[e13++]), r.d) t.d && (t = t.plus(r.times(r))); else { if (r.s) return Ke = true, new this(1 / 0); t = r; } return Ke = true, t.sqrt(); } function Wf(e13) { return e13 instanceof jn || e13 && e13.toStringTag === cg || false; } function DM(e13) { return new this(e13).ln(); } function EM(e13, r) { return new this(e13).log(r); } function SM(e13) { return new this(e13).log(2); } function CM(e13) { return new this(e13).log(10); } function MM() { return mg(this, arguments, -1); } function _M() { return mg(this, arguments, 1); } function FM(e13, r) { return new this(e13).mod(r); } function TM(e13, r) { return new this(e13).mul(r); } function OM(e13, r) { return new this(e13).pow(r); } function BM(e13) { var r, t, n, a, i = 0, o = new this(1), l = []; if (e13 === void 0 ? e13 = this.precision : vt(e13, 1, ea), n = Math.ceil(e13 / 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], e13 %= Le, n && e13 && (a = Br(10, Le - e13), 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(e13) { return Ie(e13 = new this(e13), e13.e + 1, this.rounding); } function IM(e13) { return e13 = new this(e13), e13.d ? e13.d[0] ? e13.s : 0 * e13.s : e13.s || NaN; } function RM(e13) { return new this(e13).sin(); } function PM(e13) { return new this(e13).sinh(); } function zM(e13) { return new this(e13).sqrt(); } function qM(e13, r) { return new this(e13).sub(r); } function LM() { var e13 = 0, r = arguments, t = new this(r[e13]); for (Ke = false; t.s && ++e13 < r.length; ) t = t.plus(r[e13]); return Ke = true, Ie(t, this.precision, this.rounding); } function UM(e13) { return new this(e13).tan(); } function kM(e13) { return new this(e13).tanh(); } function VM(e13) { return Ie(e13 = new this(e13), e13.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"; var ZM = ["?on", "config"]; var GM = P(HM, ZM, (e13) => { var { on: r, config: t } = e13, n = jn.clone({ precision: t.precision, modulo: jn.EUCLID }); return n.prototype = Object.create(n.prototype), n.prototype.type = "BigNumber", n.prototype.isBigNumber = true, 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: true }); var Jr = Math.cosh || function(e13) { return Math.abs(e13) < 1e-9 ? 1 - e13 : (Math.exp(e13) + Math.exp(-e13)) * 0.5; }; var St = Math.sinh || function(e13) { return Math.abs(e13) < 1e-9 ? e13 : (Math.exp(e13) - Math.exp(-e13)) * 0.5; }; var WM = function(e13) { const r = Math.PI / 4; if (-r > e13 || e13 > r) return Math.cos(e13) - 1; const t = e13 * e13; return t * (t * (t * (t * (t * (t * (t * (t / 20922789888e3 - 1 / 87178291200) + 1 / 479001600) - 1 / 3628800) + 1 / 40320) - 1 / 720) + 1 / 24) - 1 / 2); }; var lu = function(e13, r) { return e13 = Math.abs(e13), r = Math.abs(r), e13 < r && ([e13, r] = [r, e13]), e13 < 1e8 ? Math.sqrt(e13 * e13 + r * r) : (r /= e13, e13 * Math.sqrt(1 + r * r)); }; var Fa = function() { throw SyntaxError("Invalid Param"); }; function cu(e13, r) { const t = Math.abs(e13), n = Math.abs(r); return e13 === 0 ? Math.log(n) : r === 0 ? Math.log(t) : t < 3e3 && n < 3e3 ? Math.log(e13 * e13 + r * r) * 0.5 : (e13 = e13 * 0.5, r = r * 0.5, 0.5 * Math.log(e13 * e13 + r * r) + Math.LN2); } var KM = { re: 0, im: 0 }; var oa = function(e13, r) { const t = KM; if (e13 == null) t.re = t.im = 0; else if (r !== void 0) t.re = e13, t.im = r; else switch (typeof e13) { case "object": if ("im" in e13 && "re" in e13) t.re = e13.re, t.im = e13.im; else if ("abs" in e13 && "arg" in e13) { if (!isFinite(e13.abs) && isFinite(e13.arg)) return ve.INFINITY; t.re = e13.abs * Math.cos(e13.arg), t.im = e13.abs * Math.sin(e13.arg); } else if ("r" in e13 && "phi" in e13) { if (!isFinite(e13.r) && isFinite(e13.phi)) return ve.INFINITY; t.re = e13.r * Math.cos(e13.phi), t.im = e13.r * Math.sin(e13.phi); } else e13.length === 2 ? (t.re = e13[0], t.im = e13[1]) : Fa(); break; case "string": t.im = /* void */ t.re = 0; const n = e13.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 = e13; break; default: Fa(); } return isNaN(t.re) || isNaN(t.im), t; }; function ve(e13, r) { if (!(this instanceof ve)) return new ve(e13, r); const t = oa(e13, 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 e13 = lu(this.re, this.im); return new ve( this.re / e13, this.im / e13 ); }, /** * Adds two complex numbers * * @returns {Complex} */ add: function(e13, r) { const t = oa(e13, 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(e13, r) { const t = oa(e13, 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(e13, r) { const t = oa(e13, 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(e13, r) { const t = oa(e13, 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(e13, r) { const t = oa(e13, 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 e13 = this.re, r = this.im; if (r === 0) return e13 >= 0 ? new ve(Math.sqrt(e13), 0) : new ve(0, Math.sqrt(-e13)); const t = lu(e13, r); let n = Math.sqrt(0.5 * (t + Math.abs(e13))), a = Math.abs(r) / (2 * n); return e13 >= 0 ? new ve(n, r < 0 ? -a : a) : new ve(a, r < 0 ? -n : n); }, /** * Calculate the complex exponent * * @returns {Complex} */ exp: function() { const e13 = Math.exp(this.re); return this.im === 0 ? new ve(e13, 0) : new ve( e13 * Math.cos(this.im), e13 * 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 e13 = this.re, r = this.im; return new ve( Math.expm1(e13) * Math.cos(r) + WM(r), Math.exp(e13) * Math.sin(r) ); }, /** * Calculate the natural log * * @returns {Complex} */ log: function() { const e13 = this.re, r = this.im; return r === 0 && e13 > 0 ? new ve(Math.log(e13), 0) : new ve( cu(e13, r), Math.atan2(r, e13) ); }, /** * 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 e13 = this.re, r = this.im; return new ve( Math.sin(e13) * Jr(r), Math.cos(e13) * St(r) ); }, /** * Calculate the cosine * * @returns {Complex} */ cos: function() { const e13 = this.re, r = this.im; return new ve( Math.cos(e13) * Jr(r), -Math.sin(e13) * St(r) ); }, /** * Calculate the tangent * * @returns {Complex} */ tan: function() { const e13 = 2 * this.re, r = 2 * this.im, t = Math.cos(e13) + Jr(r); return new ve( Math.sin(e13) / t, St(r) / t ); }, /** * Calculate the cotangent * * @returns {Complex} */ cot: function() { const e13 = 2 * this.re, r = 2 * this.im, t = Math.cos(e13) - Jr(r); return new ve( -Math.sin(e13) / t, St(r) / t ); }, /** * Calculate the secant * * @returns {Complex} */ sec: function() { const e13 = this.re, r = this.im, t = 0.5 * Jr(2 * r) + 0.5 * Math.cos(2 * e13); return new ve( Math.cos(e13) * Jr(r) / t, Math.sin(e13) * St(r) / t ); }, /** * Calculate the cosecans * * @returns {Complex} */ csc: function() { const e13 = this.re, r = this.im, t = 0.5 * Jr(2 * r) - 0.5 * Math.cos(2 * e13); return new ve( Math.sin(e13) * Jr(r) / t, -Math.cos(e13) * St(r) / t ); }, /** * Calculate the complex arcus sinus * * @returns {Complex} */ asin: function() { const e13 = this.re, r = this.im, t = new ve( r * r - e13 * e13 + 1, -2 * e13 * r ).sqrt(), n = new ve( t.re - r, t.im + e13 ).log(); return new ve(n.im, -n.re); }, /** * Calculate the complex arcus cosinus * * @returns {Complex} */ acos: function() { const e13 = this.re, r = this.im, t = new ve( r * r - e13 * e13 + 1, -2 * e13 * r ).sqrt(), n = new ve( t.re - r, t.im + e13 ).log(); return new ve(Math.PI / 2 - n.im, n.re); }, /** * Calculate the complex arcus tangent * * @returns {Complex} */ atan: function() { const e13 = this.re, r = this.im; if (e13 === 0) { if (r === 1) return new ve(0, 1 / 0); if (r === -1) return new ve(0, -1 / 0); } const t = e13 * e13 + (1 - r) * (1 - r), n = new ve( (1 - r * r - e13 * e13) / t, -2 * e13 / t ).log(); return new ve(-0.5 * n.im, 0.5 * n.re); }, /** * Calculate the complex arcus cotangent * * @returns {Complex} */ acot: function() { const e13 = this.re, r = this.im; if (r === 0) return new ve(Math.atan2(1, e13), 0); const t = e13 * e13 + r * r; return t !== 0 ? new ve( e13 / t, -r / t ).atan() : new ve( e13 !== 0 ? e13 / 0 : 0, r !== 0 ? -r / 0 : 0 ).atan(); }, /** * Calculate the complex arcus secant * * @returns {Complex} */ asec: function() { const e13 = this.re, r = this.im; if (e13 === 0 && r === 0) return new ve(0, 1 / 0); const t = e13 * e13 + r * r; return t !== 0 ? new ve( e13 / t, -r / t ).acos() : new ve( e13 !== 0 ? e13 / 0 : 0, r !== 0 ? -r / 0 : 0 ).acos(); }, /** * Calculate the complex arcus cosecans * * @returns {Complex} */ acsc: function() { const e13 = this.re, r = this.im; if (e13 === 0 && r === 0) return new ve(Math.PI / 2, 1 / 0); const t = e13 * e13 + r * r; return t !== 0 ? new ve( e13 / t, -r / t ).asin() : new ve( e13 !== 0 ? e13 / 0 : 0, r !== 0 ? -r / 0 : 0 ).asin(); }, /** * Calculate the complex sinh * * @returns {Complex} */ sinh: function() { const e13 = this.re, r = this.im; return new ve( St(e13) * Math.cos(r), Jr(e13) * Math.sin(r) ); }, /** * Calculate the complex cosh * * @returns {Complex} */ cosh: function() { const e13 = this.re, r = this.im; return new ve( Jr(e13) * Math.cos(r), St(e13) * Math.sin(r) ); }, /** * Calculate the complex tanh * * @returns {Complex} */ tanh: function() { const e13 = 2 * this.re, r = 2 * this.im, t = Jr(e13) + Math.cos(r); return new ve( St(e13) / t, Math.sin(r) / t ); }, /** * Calculate the complex coth * * @returns {Complex} */ coth: function() { const e13 = 2 * this.re, r = 2 * this.im, t = Jr(e13) - Math.cos(r); return new ve( St(e13) / t, -Math.sin(r) / t ); }, /** * Calculate the complex coth * * @returns {Complex} */ csch: function() { const e13 = this.re, r = this.im, t = Math.cos(2 * r) - Jr(2 * e13); return new ve( -2 * St(e13) * Math.cos(r) / t, 2 * Jr(e13) * Math.sin(r) / t ); }, /** * Calculate the complex sech * * @returns {Complex} */ sech: function() { const e13 = this.re, r = this.im, t = Math.cos(2 * r) + Jr(2 * e13); return new ve( 2 * Jr(e13) * Math.cos(r) / t, -2 * St(e13) * Math.sin(r) / t ); }, /** * Calculate the complex asinh * * @returns {Complex} */ asinh: function() { let e13 = this.im; this.im = -this.re, this.re = e13; const r = this.asin(); return this.re = -this.im, this.im = e13, e13 = r.re, r.re = -r.im, r.im = e13, r; }, /** * Calculate the complex acosh * * @returns {Complex} */ acosh: function() { const e13 = this.acos(); if (e13.im <= 0) { const r = e13.re; e13.re = -e13.im, e13.im = r; } else { const r = e13.im; e13.im = -e13.re, e13.re = r; } return e13; }, /** * Calculate the complex atanh * * @returns {Complex} */ atanh: function() { const e13 = this.re, r = this.im, t = e13 > 1 && r === 0, n = 1 - e13, a = 1 + e13, i = n * n + r * r, o = i !== 0 ? new ve( (a * n - r * r) / i, (r * n + a * r) / i ) : new ve( e13 !== -1 ? e13 / 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 e13 = this.re, r = this.im; if (e13 === 0 && r === 0) return new ve(0, Math.PI / 2); const t = e13 * e13 + r * r; return t !== 0 ? new ve( e13 / t, -r / t ).atanh() : new ve( e13 !== 0 ? e13 / 0 : 0, r !== 0 ? -r / 0 : 0 ).atanh(); }, /** * Calculate the complex acsch * * @returns {Complex} */ acsch: function() { const e13 = this.re, r = this.im; if (r === 0) return new ve( e13 !== 0 ? Math.log(e13 + Math.sqrt(e13 * e13 + 1)) : 1 / 0, 0 ); const t = e13 * e13 + r * r; return t !== 0 ? new ve( e13 / t, -r / t ).asinh() : new ve( e13 !== 0 ? e13 / 0 : 0, r !== 0 ? -r / 0 : 0 ).asinh(); }, /** * Calculate the complex asech * * @returns {Complex} */ asech: function() { const e13 = this.re, r = this.im; if (this.isZero()) return ve.INFINITY; const t = e13 * e13 + r * r; return t !== 0 ? new ve( e13 / t, -r / t ).acosh() : new ve( e13 !== 0 ? e13 / 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 e13 = this.re, r = this.im, t = e13 * e13 + r * r; return new ve(e13 / 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(e13) { return e13 = Math.pow(10, e13 || 0), new ve( Math.ceil(this.re * e13) / e13, Math.ceil(this.im * e13) / e13 ); }, /** * Floors the actual complex number * * @returns {Complex} */ floor: function(e13) { return e13 = Math.pow(10, e13 || 0), new ve( Math.floor(this.re * e13) / e13, Math.floor(this.im * e13) / e13 ); }, /** * Ceils the actual complex number * * @returns {Complex} */ round: function(e13) { return e13 = Math.pow(10, e13 || 0), new ve( Math.round(this.re * e13) / e13, Math.round(this.im * e13) / e13 ); }, /** * Compares two complex numbers * * **Note:** new Complex(Infinity).equals(Infinity) === false * * @returns {boolean} */ equals: function(e13, r) { const t = oa(e13, 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 e13 = this.re, r = this.im, t = ""; return this.isNaN() ? "NaN" : this.isInfinite() ? "Infinity" : (Math.abs(e13) < ve.EPSILON && (e13 = 0), Math.abs(r) < ve.EPSILON && (r = 0), r === 0 ? t + e13 : (e13 !== 0 ? (t += e13, 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"; var YM = []; var jM = P(JM, YM, () => (Object.defineProperty(ve, "name", { value: "Complex" }), ve.prototype.constructor = ve, ve.prototype.type = "Complex", ve.prototype.isComplex = true, 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(e13) { var r = "", t = this.im, n = this.re, a = pa(this.re, e13), i = pa(this.im, e13), o = We(e13) ? e13 : e13 ? e13.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(e13) { 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(e13) { return new ve(e13); }, ve.compare = function(e13, r) { return e13.re > r.re ? 1 : e13.re < r.re ? -1 : e13.im > r.im ? 1 : e13.im < r.im ? -1 : 0; }, ve), { isClass: true }); var XM = 2e3; var Te = { s: 1, n: 0, d: 1 }; function cn(e13, r) { if (isNaN(e13 = parseInt(e13, 10))) throw Po(); return e13 * r; } function Mr(e13, r) { if (r === 0) throw ql(); var t = Object.create(Yr.prototype); t.s = e13 < 0 ? -1 : 1, e13 = e13 < 0 ? -e13 : e13; var n = Pa(e13, r); return t.n = e13 / n, t.d = r / n, t; } function Kf(e13) { for (var r = {}, t = e13, n = 2, a = 4; a <= t; ) { for (; t % n === 0; ) t /= n, r[n] = (r[n] || 0) + 1; a += 1 + 2 * n++; } return t !== e13 ? t > 1 && (r[t] = (r[t] || 0) + 1) : r[e13] = (r[e13] || 0) + 1, r; } var yt = function(e13, 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 (e13 != null) if (r !== void 0) { if (t = e13, n = r, a = t * n, t % 1 !== 0 || n % 1 !== 0) throw t_(); } else switch (typeof e13) { case "object": { if ("d" in e13 && "n" in e13) t = e13.n, n = e13.d, "s" in e13 && (t *= e13.s); else if (0 in e13) t = e13[0], 1 in e13 && (n = e13[1]); else throw Po(); a = t * n; break; } case "number": { if (e13 < 0 && (a = e13, e13 = -e13), e13 % 1 === 0) t = e13; else if (e13 > 0) { for (e13 >= 1 && (s = Math.pow(10, Math.floor(1 + Math.log(e13) / Math.LN10)), e13 /= s); f <= m && p <= m; ) if (v = (c + d) / (f + p), e13 === v) { f + p <= m ? (t = c + d, n = f + p) : p > f ? (t = d, n = p) : (t = c, n = f); break; } else e13 > v ? (c += d, f += p) : (d += c, p += f), f > m ? (t = d, n = p) : (t = c, n = f); t *= s; } else (isNaN(e13) || isNaN(r)) && (n = t = NaN); break; } case "string": { if (f = e13.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(e13, r, t) { for (var n = 1; r > 0; e13 = e13 * e13 % t, r >>= 1) r & 1 && (n = n * e13 % t); return n; } function e_(e13, 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_(e13, 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(e13, r) { if (!e13) return r; if (!r) return e13; for (; ; ) { if (e13 %= r, !e13) return r; if (r %= e13, !r) return e13; } } function Yr(e13, r) { if (yt(e13, r), this instanceof Yr) e13 = Pa(Te.d, Te.n), this.s = Te.s, this.n = Te.n / e13, this.d = Te.d / e13; else return Mr(Te.s * Te.n, Te.d); } var ql = function() { return new Error("Division by Zero"); }; var Po = function() { return new Error("Invalid argument"); }; var 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(e13, r) { return yt(e13, 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(e13, r) { return yt(e13, 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(e13, r) { return yt(e13, 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(e13, r) { return yt(e13, 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(e13, r) { if (isNaN(this.n) || isNaN(this.d)) return new Yr(NaN); if (e13 === void 0) return Mr(this.s * this.n % this.d, 1); if (yt(e13, 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(e13, r) { return yt(e13, 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(e13, r) { return yt(e13, 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(e13) { return e13 = Math.pow(10, e13 || 0), isNaN(this.n) || isNaN(this.d) ? new Yr(NaN) : Mr(Math.ceil(e13 * this.s * this.n / this.d), e13); }, /** * Calculates the floor of a rational number * * Ex: new Fraction('4.(3)').floor() => (4 / 1) **/ floor: function(e13) { return e13 = Math.pow(10, e13 || 0), isNaN(this.n) || isNaN(this.d) ? new Yr(NaN) : Mr(Math.floor(e13 * this.s * this.n / this.d), e13); }, /** * Rounds a rational number * * Ex: new Fraction('4.(3)').round() => (4 / 1) **/ round: function(e13) { return e13 = Math.pow(10, e13 || 0), isNaN(this.n) || isNaN(this.d) ? new Yr(NaN) : Mr(Math.round(e13 * this.s * this.n / this.d), e13); }, /** * Rounds a rational number to a multiple of another rational number * * Ex: new Fraction('0.9').roundTo("1/8") => 7 / 8 **/ roundTo: function(e13, r) { return yt(e13, 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(e13, r) { if (yt(e13, 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(e13, r) { return yt(e13, 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(e13, r) { yt(e13, r); var t = this.s * this.n * Te.d - Te.s * Te.n * this.d; return (0 < t) - (t < 0); }, simplify: function(e13) { if (isNaN(this.n) || isNaN(this.d)) return this; e13 = e13 || 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()) < e13) return a.mul(this.s); } return this; }, /** * Check if two rational numbers are divisible * * Ex: new Fraction(19.6).divisible(1.5); */ divisible: function(e13, r) { return yt(e13, 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(e13) { var r, t = "", n = this.n, a = this.d; return this.s < 0 && (t += "-"), a === 1 ? t += n : (e13 && (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(e13) { var r, t = "", n = this.n, a = this.d; return this.s < 0 && (t += "-"), a === 1 ? t += n : (e13 && (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 e13, r = this.n, t = this.d, n = []; if (isNaN(r) || isNaN(t)) return n; do n.push(Math.floor(r / t)), e13 = r % t, r = t, t = e13; 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(e13) { var r = this.n, t = this.d; if (isNaN(r) || isNaN(t)) return "NaN"; e13 = e13 || 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 = e13; r && o--; ) i += r / t | 0, r %= t, r *= 10; return i; } }; var n_ = "Fraction"; var a_ = []; var i_ = P(n_, a_, () => (Object.defineProperty(Yr, "name", { value: "Fraction" }), Yr.prototype.constructor = Yr, Yr.prototype.type = "Fraction", Yr.prototype.isFraction = true, Yr.prototype.toJSON = function() { return { mathjs: "Fraction", n: this.s * this.n, d: this.d }; }, Yr.fromJSON = function(e13) { return new Yr(e13); }, Yr), { isClass: true }); var o_ = "Range"; var s_ = []; var u_ = P(o_, s_, () => { function e13(r, t, n) { if (!(this instanceof e13)) 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 e13.prototype.type = "Range", e13.prototype.isRange = true, e13.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 e13(n[0], n[1]); case 3: return new e13(n[0], n[2], n[1]); default: return null; } }, e13.prototype.clone = function() { return new e13(this.start, this.end, this.step); }, e13.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]; }, e13.prototype.min = function() { var r = this.size()[0]; if (r > 0) return this.step > 0 ? this.start : this.start + (r - 1) * this.step; }, e13.prototype.max = function() { var r = this.size()[0]; if (r > 0) return this.step > 0 ? this.start + (r - 1) * this.step : this.start; }, e13.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++; }, e13.prototype.map = function(r) { var t = []; return this.forEach(function(n, a, i) { t[a[0]] = r(n, a, i); }), t; }, e13.prototype.toArray = function() { var r = []; return this.forEach(function(t, n) { r[n[0]] = t; }), r; }, e13.prototype.valueOf = function() { return this.toArray(); }, e13.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; }, e13.prototype.toString = function() { return this.format(); }, e13.prototype.toJSON = function() { return { mathjs: "Range", start: this.start, end: this.end, step: this.step }; }, e13.fromJSON = function(r) { return new e13(r.start, r.end, r.step); }, e13; }, { isClass: true }); var l_ = "Matrix"; var c_ = []; var f_ = P(l_, c_, () => { function e13() { if (!(this instanceof e13)) throw new SyntaxError("Constructor must be called with the new operator"); } return e13.prototype.type = "Matrix", e13.prototype.isMatrix = true, e13.prototype.storage = function() { throw new Error("Cannot invoke storage on a Matrix interface"); }, e13.prototype.datatype = function() { throw new Error("Cannot invoke datatype on a Matrix interface"); }, e13.prototype.create = function(r, t) { throw new Error("Cannot invoke create on a Matrix interface"); }, e13.prototype.subset = function(r, t, n) { throw new Error("Cannot invoke subset on a Matrix interface"); }, e13.prototype.get = function(r) { throw new Error("Cannot invoke get on a Matrix interface"); }, e13.prototype.set = function(r, t, n) { throw new Error("Cannot invoke set on a Matrix interface"); }, e13.prototype.resize = function(r, t) { throw new Error("Cannot invoke resize on a Matrix interface"); }, e13.prototype.reshape = function(r, t) { throw new Error("Cannot invoke reshape on a Matrix interface"); }, e13.prototype.clone = function() { throw new Error("Cannot invoke clone on a Matrix interface"); }, e13.prototype.size = function() { throw new Error("Cannot invoke size on a Matrix interface"); }, e13.prototype.map = function(r, t) { throw new Error("Cannot invoke map on a Matrix interface"); }, e13.prototype.forEach = function(r) { throw new Error("Cannot invoke forEach on a Matrix interface"); }, e13.prototype[Symbol.iterator] = function() { throw new Error("Cannot iterate a Matrix interface"); }, e13.prototype.toArray = function() { throw new Error("Cannot invoke toArray on a Matrix interface"); }, e13.prototype.valueOf = function() { throw new Error("Cannot invoke valueOf on a Matrix interface"); }, e13.prototype.format = function(r) { throw new Error("Cannot invoke format on a Matrix interface"); }, e13.prototype.toString = function() { throw new Error("Cannot invoke toString on a Matrix interface"); }, e13; }, { isClass: true }); function fu(e13, r, t) { var n = e13.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 (e13.greaterThan(a.pow(t - 1).sub(1)) || e13.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 (!e13.isInteger()) throw new Error("Value must be an integer"); e13.lessThan(0) && (e13 = e13.add(a.pow(t))), i = "i".concat(t); } switch (r) { case 2: return "".concat(e13.toBinary()).concat(i); case 8: return "".concat(e13.toOctal()).concat(i); case 16: return "".concat(e13.toHexadecimal()).concat(i); default: throw new Error("Base ".concat(r, " not supported ")); } } function d_(e13, r) { if (typeof r == "function") return r(e13); if (!e13.isFinite()) return e13.isNaN() ? "NaN" : e13.gt(0) ? "Infinity" : "-Infinity"; var { notation: t, precision: n, wordSize: a } = ng(r); switch (t) { case "fixed": return m_(e13, n); case "exponential": return Jf(e13, n); case "engineering": return p_(e13, n); case "bin": return fu(e13, 2, a); case "oct": return fu(e13, 8, a); case "hex": return fu(e13, 16, a); case "auto": { var i = Yf(r == null ? void 0 : r.lowerExp, -3), o = Yf(r == null ? void 0 : r.upperExp, 5); if (e13.isZero()) return "0"; var l, u = e13.toSignificantDigits(n), s = u.e; return s >= i && s < o ? l = u.toFixed() : l = Jf(e13, 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_(e13, r) { var t = e13.e, n = t % 3 === 0 ? t : t < 0 ? t - 3 - t % 3 : t - t % 3, a = e13.mul(Math.pow(10, -n)), i = a.toPrecision(r); if (i.includes("e")) { var o = e13.constructor; i = new o(i).toFixed(); } return i + "e" + (t >= 0 ? "+" : "") + n.toString(); } function Jf(e13, r) { return r !== void 0 ? e13.toExponential(r - 1) : e13.toExponential(); } function m_(e13, r) { return e13.toFixed(r); } function Yf(e13, r) { return We(e13) ? e13 : Ze(e13) ? e13.toNumber() : r; } function v_(e13, r) { var t = e13.length - r.length, n = e13.length; return e13.substring(t, n) === r; } function Qe(e13, r) { var t = h_(e13, r); return r && typeof r == "object" && "truncate" in r && t.length > r.truncate ? t.substring(0, r.truncate - 3) + "..." : t; } function h_(e13, r) { if (typeof e13 == "number") return pa(e13, r); if (Ze(e13)) return d_(e13, r); if (g_(e13)) return !r || r.fraction !== "decimal" ? e13.s * e13.n + "/" + e13.d : e13.toString(); if (Array.isArray(e13)) return yg(e13, r); if (Vr(e13)) return za(e13); if (typeof e13 == "function") return e13.syntax ? String(e13.syntax) : "function"; if (e13 && typeof e13 == "object") { if (typeof e13.format == "function") return e13.format(r); if (e13 && e13.toString(r) !== {}.toString()) return e13.toString(r); var t = Object.keys(e13).map((n) => za(n) + ": " + Qe(e13[n], r)); return "{" + t.join(", ") + "}"; } return String(e13); } function za(e13) { for (var r = String(e13), 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(e13) { var r = String(e13); return r = r.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(//g, ">"), r; } function yg(e13, r) { if (Array.isArray(e13)) { for (var t = "[", n = e13.length, a = 0; a < n; a++) a !== 0 && (t += ", "), t += yg(e13[a], r); return t += "]", t; } else return Qe(e13, r); } function g_(e13) { return e13 && typeof e13 == "object" && typeof e13.s == "number" && typeof e13.n == "number" && typeof e13.d == "number" || false; } function ku(e13, r) { if (!Vr(e13)) throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: " + yr(e13) + ", 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 e13 === r ? 0 : e13 > r ? 1 : -1; } function Ye(e13, r, t) { if (!(this instanceof Ye)) throw new SyntaxError("Constructor must be called with the new operator"); this.actual = e13, this.expected = r, this.relation = t, this.message = "Dimension mismatch (" + (Array.isArray(e13) ? "[" + e13.join(", ") + "]" : e13) + " " + (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 = true; function $t(e13, r, t) { if (!(this instanceof $t)) throw new SyntaxError("Constructor must be called with the new operator"); this.index = e13, 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 = true; function ke(e13) { for (var r = []; Array.isArray(e13); ) r.push(e13.length), e13 = e13[0]; return r; } function bg(e13, r, t) { var n, a = e13.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 = e13[n]; if (!Array.isArray(o)) throw new Ye(r.length - 1, r.length, "<"); bg(e13[n], r, i); } } else for (n = 0; n < a; n++) if (Array.isArray(e13[n])) throw new Ye(r.length + 1, r.length, ">"); } function Xf(e13, r) { var t = r.length === 0; if (t) { if (Array.isArray(e13)) throw new Ye(e13.length, 0); } else bg(e13, r, 0); } function Jo(e13, r) { var t = e13.isMatrix ? e13._size : ke(e13), n = r._sourceSize; n.forEach((a, i) => { if (a !== null && a !== t[i]) throw new Ye(a, t[i]); }); } function gr(e13, r) { if (e13 !== void 0) { if (!We(e13) || !Oe(e13)) throw new TypeError("Index must be an integer (value: " + e13 + ")"); if (e13 < 0 || typeof r == "number" && e13 >= r) throw new $t(e13, r); } } function ei(e13) { for (var r = 0; r < e13._dimensions.length; ++r) { var t = e13._dimensions[r]; if (t._data && cr(t._data)) { if (t._size[0] === 0) return true; } else if (t.isRange) { if (t.start === t.end) return true; } else if (Vr(t) && t.length === 0) return true; } return false; } function ri(e13, 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(e13) || Ze(e13)) && (e13 = [e13]); var n = t !== void 0 ? t : 0; return Vu(e13, r, 0, n), e13; } function Vu(e13, r, t, n) { var a, i, o = e13.length, l = r[t], u = Math.min(o, l); if (e13.length = l, t < r.length - 1) { var s = t + 1; for (a = 0; a < u; a++) i = e13[a], Array.isArray(i) || (i = [i], e13[a] = i), Vu(i, r, s, n); for (a = u; a < l; a++) i = [], e13[a] = i, Vu(i, r, s, n); } else { for (a = 0; a < u; a++) for (; Array.isArray(e13[a]); ) e13[a] = e13[a][0]; for (a = u; a < l; a++) e13[a] = n; } } function Ll(e13, r) { var t = sr(e13), n = t.length; if (!Array.isArray(e13) || !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(e13, r) { var t = wg(e13), n = e13.slice(), a = -1, i = e13.indexOf(a), o = e13.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(e13) { return e13.reduce((r, t) => r * t, 1); } function y_(e13, r) { for (var t = e13, 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(e13, r) { for (var t = ke(e13); Array.isArray(e13) && e13.length === 1; ) e13 = e13[0], t.shift(); for (var n = t.length; t[n - 1] === 1; ) n--; return n < t.length && (e13 = xg(e13, n, 0), t.length = n), e13; } function xg(e13, r, t) { var n, a; if (t < r) { var i = t + 1; for (n = 0, a = e13.length; n < a; n++) e13[n] = xg(e13[n], r, i); } else for (; Array.isArray(e13); ) e13 = e13[0]; return e13; } function Ag(e13, r, t, n) { var a = n || ke(e13); if (t) for (var i = 0; i < t; i++) e13 = [e13], a.unshift(1); for (e13 = Ng(e13, r, 0); a.length < r; ) a.push(1); return e13; } function Ng(e13, r, t) { var n, a; if (Array.isArray(e13)) { var i = t + 1; for (n = 0, a = e13.length; n < a; n++) e13[n] = Ng(e13[n], r, i); } else for (var o = t; o < r; o++) e13 = [e13]; return e13; } function sr(e13) { if (!Array.isArray(e13)) return e13; var r = []; return e13.forEach(function t(n) { Array.isArray(n) ? n.forEach(t) : r.push(n); }), r; } function Wn(e13, r) { return Array.prototype.map.call(e13, r); } function Dg(e13, r) { Array.prototype.forEach.call(e13, r); } function b_(e13, r) { if (ke(e13).length !== 1) throw new Error("Only one dimensional matrices supported"); return Array.prototype.filter.call(e13, r); } function Qf(e13, r) { if (ke(e13).length !== 1) throw new Error("Only one dimensional matrices supported"); return Array.prototype.filter.call(e13, (t) => r.test(t)); } function ed(e13, r) { return Array.prototype.join.call(e13, r); } function ti(e13) { if (!Array.isArray(e13)) throw new TypeError("Array input expected"); if (e13.length === 0) return e13; var r = [], t = 0; r[0] = { value: e13[0], identifier: 0 }; for (var n = 1; n < e13.length; n++) e13[n] === e13[n - 1] ? t++ : t = 0, r.push({ value: e13[n], identifier: t }); return r; } function jo(e13) { if (!Array.isArray(e13)) throw new TypeError("Array input expected"); if (e13.length === 0) return e13; for (var r = [], t = 0; t < e13.length; t++) r.push(e13[t].value); return r; } function Bs(e13, r) { for (var t, n = 0, a = 0; a < e13.length; a++) { var i = e13[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(e13, r, t, n) { if (n < t) { if (e13.length !== r.length) throw new Ye(e13.length, r.length); for (var a = [], i = 0; i < e13.length; i++) a[i] = Eg(e13[i], r[i], t, n + 1); return a; } else return e13.concat(r); } function Sg() { var e13 = Array.prototype.slice.call(arguments, 0, -1), r = Array.prototype.slice.call(arguments, -1); if (e13.length === 1) return e13[0]; if (e13.length > 1) return e13.slice(1).reduce(function(t, n) { return Eg(t, n, r, 0); }, e13[0]); throw new Error("Wrong number of arguments in function concat"); } function kl() { for (var e13 = arguments.length, r = new Array(e13), t = 0; t < e13; 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(e13, r) { for (var t = r.length, n = e13.length, a = 0; a < n; a++) { var i = t - n + a; if (e13[a] < r[i] && e13[a] > 1 || e13[a] > r[i]) throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e13, ") not possible to broadcast dimension ").concat(n, " with size ").concat(e13[a], " to size ").concat(r[i])); } } function ua(e13, r) { var t = ke(e13); if (Sn(t, r)) return e13; Cg(t, r); var n = kl(t, r), a = n.length, i = [...Array(a - t.length).fill(1), ...t], o = x_(e13); 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_(e13, r, t) { return Sg(...Array(r).fill(e13), t); } function Vl(e13, r) { if (!Array.isArray(e13)) throw new Error("Array expected"); var t = ke(e13); 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], e13); } function Hl(e13, r, t, n) { return Array.isArray(e13) ? e13.map(function(a, i) { return Hl(a, r.concat(i), t, n); }) : n(e13, r, t); } function x_(e13) { return jr([], e13); } function ha(e13, r, t) { if (Pi.isTypedFunction(e13)) { var n = (r.isMatrix ? r.size() : ke(r)).map(() => 0), a = r.isMatrix ? r.get(n) : Vl(r, n), i = Object.keys(e13.signatures).length === 1, o = A_(e13, a, n, r), l = i ? Object.values(e13.signatures)[0] : e13; 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, e13.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, e13.name); }; } return e13; } function A_(e13, r, t, n) { for (var a = [r, t, n], i = 3; i > 0; i--) { var o = a.slice(0, i); if (Pi.resolve(e13, o) !== null) return i; } } function rd(e13, r, t, n) { try { return e13(...r); } catch (a) { N_(a, r, t, n); } } function N_(e13, r, t, n) { var a; if (e13 instanceof TypeError && ((a = e13.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(e13.message)); } var D_ = "DenseMatrix"; var E_ = ["Matrix"]; var S_ = P(D_, E_, (e13) => { var { Matrix: r } = e13; 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 = true, 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 !== true) 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 h10 = f.max().map(function(g) { return g + 1; }); u(c, h10, 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 = false; p.length < f.length; ) p.push(0), m = true; for (var v = 0, b = f.length; v < b; v++) f[v] > p[v] && (p[v] = f[v], m = true); 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 h10 = A; h10 < b; h10++) v[h10 + 1] = v[h10][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((h10) => [h10[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), h10; if (cr(f)) { if (f.length !== A) throw new Error("Invalid value array length"); h10 = 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"); h10 = function(E) { return f.get([E]); }; } else h10 = function() { return f; }; p || (p = Ze(h10(0)) ? h10(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] = h10(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: true }); var td = "clone"; var C_ = ["typed"]; var M_ = P(td, C_, (e13) => { var { typed: r } = e13; return r(td, { any: qe }); }); function Mg(e13) { var r = e13.length, t = e13[0].length, n, a, i = []; for (a = 0; a < t; a++) { var o = []; for (n = 0; n < r; n++) o.push(e13[n][a]); i.push(o); } return i; } function ci(e13) { for (var r = 0; r < e13.length; r++) if (At(e13[r])) return true; return false; } function Cn(e13, r) { ze(e13) && (e13 = e13.valueOf()); for (var t = 0, n = e13.length; t < n; t++) { var a = e13[t]; Array.isArray(a) ? Cn(a, r) : r(a); } } function je(e13, r, t) { return e13 && typeof e13.map == "function" ? e13.map(function(n) { return je(n, r); }) : r(e13); } function $s(e13, r, t) { var n = Array.isArray(e13) ? ke(e13) : e13.size(); if (r < 0 || r >= n.length) throw new $t(r, n.length); return ze(e13) ? e13.create(Xo(e13.valueOf(), r, t), e13.datatype()) : Xo(e13, r, t); } function Xo(e13, r, t) { var n, a, i, o; if (r <= 0) if (Array.isArray(e13[0])) { for (o = Mg(e13), a = [], n = 0; n < o.length; n++) a[n] = Xo(o[n], r - 1, t); return a; } else { for (i = e13[0], n = 1; n < e13.length; n++) i = t(i, e13[n]); return i; } else { for (a = [], n = 0; n < e13.length; n++) a[n] = Xo(e13[n], r - 1, t); return a; } } function nd(e13, r, t, n, a, i, o, l, u, s, c) { var f = e13._values, d = e13._index, p = e13._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"; var __ = ["typed"]; var F_ = P(ad, __, (e13) => { var { typed: r } = e13; 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 true; }, Fraction: function(n) { return n.d === 1 && isFinite(n.n); }, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }); var Gt = "number"; var fi = "number, number"; function _g(e13) { return Math.abs(e13); } _g.signature = Gt; function Fg(e13, r) { return e13 + r; } Fg.signature = fi; function Tg(e13, r) { return e13 - r; } Tg.signature = fi; function Og(e13, r) { return e13 * r; } Og.signature = fi; function Bg(e13) { return -e13; } Bg.signature = Gt; function $g(e13) { return e13; } $g.signature = Gt; function Di(e13) { return BC(e13); } Di.signature = Gt; function Ig(e13) { return e13 * e13 * e13; } Ig.signature = Gt; function Rg(e13) { return Math.exp(e13); } Rg.signature = Gt; function Pg(e13) { return $C(e13); } Pg.signature = Gt; function zg(e13, r) { if (!Oe(e13) || !Oe(r)) throw new Error("Parameters in function lcm must be integer numbers"); if (e13 === 0 || r === 0) return 0; for (var t, n = e13 * r; r !== 0; ) t = r, r = e13 % t, e13 = t; return Math.abs(n / e13); } zg.signature = fi; function T_(e13, r) { return Math.log(e13); } function qg(e13) { return TC(e13); } qg.signature = Gt; function Lg(e13) { return FC(e13); } Lg.signature = Gt; function id(e13) { 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 (e13 < 0 && Math.abs(r) % 2 !== 1) throw new Error("Root must be odd when a is negative."); if (e13 === 0) return t ? 1 / 0 : 0; if (!isFinite(e13)) return t ? 0 : e13; var n = Math.pow(Math.abs(e13), 1 / r); return n = e13 < 0 ? -n : n, t ? 1 / n : n; } function Hu(e13) { return Vn(e13); } Hu.signature = Gt; function Ug(e13) { return e13 * e13; } Ug.signature = Gt; function kg(e13, r) { var t, n, a, i = 0, o = 1, l = 1, u = 0; if (!Oe(e13) || !Oe(r)) throw new Error("Parameters in function xgcd must be integer numbers"); for (; r; ) n = Math.floor(e13 / r), a = e13 - n * r, t = i, i = o - n * i, o = t, t = l, l = u - n * l, u = t, e13 = r, r = a; var s; return e13 < 0 ? s = [-e13, -o, -u] : s = [e13, e13 ? o : 0, u], s; } kg.signature = fi; function Vg(e13, r) { return e13 * e13 < 1 && r === 1 / 0 || e13 * e13 > 1 && r === -1 / 0 ? 0 : Math.pow(e13, r); } Vg.signature = fi; function Ai(e13) { 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(e13, r)); } var O_ = "number"; var di = "number, number"; function Hg(e13, r) { if (!Oe(e13) || !Oe(r)) throw new Error("Integers expected in function bitAnd"); return e13 & r; } Hg.signature = di; function Zg(e13) { if (!Oe(e13)) throw new Error("Integer expected in function bitNot"); return ~e13; } Zg.signature = O_; function Gg(e13, r) { if (!Oe(e13) || !Oe(r)) throw new Error("Integers expected in function bitOr"); return e13 | r; } Gg.signature = di; function Wg(e13, r) { if (!Oe(e13) || !Oe(r)) throw new Error("Integers expected in function bitXor"); return e13 ^ r; } Wg.signature = di; function Kg(e13, r) { if (!Oe(e13) || !Oe(r)) throw new Error("Integers expected in function leftShift"); return e13 << r; } Kg.signature = di; function Jg(e13, r) { if (!Oe(e13) || !Oe(r)) throw new Error("Integers expected in function rightArithShift"); return e13 >> r; } Jg.signature = di; function Yg(e13, r) { if (!Oe(e13) || !Oe(r)) throw new Error("Integers expected in function rightLogShift"); return e13 >>> r; } Yg.signature = di; function wn(e13, r) { if (r < e13) return 1; if (r === e13) return r; var t = r + e13 >> 1; return wn(e13, t) * wn(t + 1, r); } function jg(e13, r) { if (!Oe(e13) || e13 < 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 > e13) throw new TypeError("k must be less than or equal to n"); for (var t = e13 - r, n = 1, a = r < t ? t + 1 : r + 1, i = 2, o = r < t ? r : t, l = a; l <= e13; ++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; var $_ = 2 * Math.PI; var I_ = Math.E; var R_ = 1.618033988749895; var P_ = "number"; var Zl = "number, number"; function Xg(e13) { return !e13; } Xg.signature = P_; function Zu(e13, r) { return !!(e13 || r); } Zu.signature = Zl; function Gu(e13, r) { return !!e13 != !!r; } Gu.signature = Zl; function Wu(e13, r) { return !!(e13 && r); } Wu.signature = Zl; function Qo(e13) { var r; if (Oe(e13)) return e13 <= 0 ? isFinite(e13) ? 1 / 0 : NaN : e13 > 171 ? 1 / 0 : wn(1, e13 - 1); if (e13 < 0.5) return Math.PI / (Math.sin(Math.PI * e13) * Qo(1 - e13)); if (e13 >= 171.35) return 1 / 0; if (e13 > 85) { var t = e13 * e13, n = t * e13, a = n * e13, i = a * e13; return Math.sqrt(2 * Math.PI / e13) * Math.pow(e13 / Math.E, e13) * (1 + 1 / (12 * e13) + 1 / (288 * t) - 139 / (51840 * n) - 571 / (2488320 * a) + 163879 / (209018880 * i) + 5246819 / (75246796800 * i * e13)); } --e13, r = ka[0]; for (var o = 1; o < ka.length; ++o) r += ka[o] / (e13 + o); var l = e13 + Qg + 0.5; return Math.sqrt(2 * Math.PI) * Math.pow(l, e13 + 0.5) * Math.exp(-l) * r; } Qo.signature = "number"; var Qg = 4.7421875; var 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]; var ey = 0.9189385332046728; var z_ = 5; var q_ = 7; var od = [1.000000000190015, 76.18009172947146, -86.50532032941678, 24.01409824083091, -1.231739572450155, 0.001208650973866179, -5395239384953e-18]; function es(e13) { if (e13 < 0) return NaN; if (e13 === 0) return 1 / 0; if (!isFinite(e13)) return e13; if (e13 < 0.5) return Math.log(Math.PI / Math.sin(Math.PI * e13)) - es(1 - e13); e13 = e13 - 1; for (var r = e13 + z_ + 0.5, t = od[0], n = q_ - 1; n >= 1; n--) t += od[n] / (e13 + n); return ey + (e13 + 0.5) * Math.log(r) - r + Math.log(t); } es.signature = "number"; var et = "number"; function ry(e13) { return zC(e13); } ry.signature = et; function ty(e13) { return Math.atan(1 / e13); } ty.signature = et; function ny(e13) { return isFinite(e13) ? (Math.log((e13 + 1) / e13) + Math.log(e13 / (e13 - 1))) / 2 : 0; } ny.signature = et; function ay(e13) { return Math.asin(1 / e13); } ay.signature = et; function iy(e13) { var r = 1 / e13; return Math.log(r + Math.sqrt(r * r + 1)); } iy.signature = et; function oy(e13) { return Math.acos(1 / e13); } oy.signature = et; function sy(e13) { var r = 1 / e13, t = Math.sqrt(r * r - 1); return Math.log(t + r); } sy.signature = et; function uy(e13) { return qC(e13); } uy.signature = et; function ly(e13) { return LC(e13); } ly.signature = et; function cy(e13) { return 1 / Math.tan(e13); } cy.signature = et; function fy(e13) { var r = Math.exp(2 * e13); return (r + 1) / (r - 1); } fy.signature = et; function dy(e13) { return 1 / Math.sin(e13); } dy.signature = et; function py(e13) { return e13 === 0 ? Number.POSITIVE_INFINITY : Math.abs(2 / (Math.exp(e13) - Math.exp(-e13))) * Vn(e13); } py.signature = et; function my(e13) { return 1 / Math.cos(e13); } my.signature = et; function vy(e13) { return 2 / (Math.exp(e13) + Math.exp(-e13)); } vy.signature = et; function hy(e13) { return kC(e13); } hy.signature = et; var Gl = "number"; function gy(e13) { return e13 < 0; } gy.signature = Gl; function yy(e13) { return e13 > 0; } yy.signature = Gl; function by(e13) { return Number.isNaN(e13); } by.signature = Gl; function ht(e13, 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 e13.isNaN() || r.isNaN() ? false : !e13.isFinite() || !r.isFinite() ? e13.eq(r) : e13.eq(r) ? true : e13.minus(r).abs().lte(e13.constructor.max(e13.constructor.max(e13.abs(), r.abs()).mul(t), n)); } var sd = "isNegative"; var L_ = ["typed", "config"]; var U_ = P(sd, L_, (e13) => { var { typed: r, config: t } = e13; return r(sd, { number: (n) => Gr(n, 0, t.relTol, t.absTol) ? false : gy(n), BigNumber: (n) => ht(n, new n.constructor(0), t.relTol, t.absTol) ? false : 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)) }); }); var ud = "isNumeric"; var k_ = ["typed"]; var V_ = P(ud, k_, (e13) => { var { typed: r } = e13; return r(ud, { "number | BigNumber | bigint | Fraction | boolean": () => true, "Complex | Unit | string | null | undefined | Node": () => false, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }); var ld = "hasNumericValue"; var H_ = ["typed", "isNumeric"]; var Z_ = P(ld, H_, (e13) => { var { typed: r, isNumeric: t } = e13; return r(ld, { boolean: () => true, string: function(a) { return a.trim().length > 0 && !isNaN(Number(a)); }, any: function(a) { return t(a); } }); }); var cd = "isPositive"; var G_ = ["typed", "config"]; var W_ = P(cd, G_, (e13) => { var { typed: r, config: t } = e13; return r(cd, { number: (n) => Gr(n, 0, t.relTol, t.absTol) ? false : yy(n), BigNumber: (n) => ht(n, new n.constructor(0), t.relTol, t.absTol) ? false : !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)) }); }); var fd = "isZero"; var K_ = ["typed", "equalScalar"]; var J_ = P(fd, K_, (e13) => { var { typed: r, equalScalar: t } = e13; 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)) }); }); var dd = "isNaN"; var Y_ = ["typed"]; var j_ = P(dd, Y_, (e13) => { var { typed: r } = e13; return r(dd, { number: by, BigNumber: function(n) { return n.isNaN(); }, bigint: function(n) { return false; }, Fraction: function(n) { return false; }, Complex: function(n) { return n.isNaN(); }, Unit: function(n) { return Number.isNaN(n.value); }, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }); var pd = "typeOf"; var X_ = ["typed"]; var Q_ = P(pd, X_, (e13) => { var { typed: r } = e13; return r(pd, { any: yr }); }); function e3(e13, r, t, n) { return Gr(e13.re, r.re, t, n) && Gr(e13.im, r.im, t, n); } var pi = P("compareUnits", ["typed"], (e13) => { var { typed: r } = e13; 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); }) }; }); var rs = "equalScalar"; var r3 = ["typed", "config"]; var t3 = P(rs, r3, (e13) => { var { typed: r, config: t } = e13, 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"], (e13) => { var { typed: r, config: t } = e13; return r(rs, { "number, number": function(a, i) { return Gr(a, i, t.relTol, t.absTol); } }); }); var n3 = "SparseMatrix"; var a3 = ["typed", "equalScalar", "Matrix"]; var i3 = P(n3, a3, (e13) => { var { typed: r, equalScalar: t, Matrix: n } = e13; 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, h10 = 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 && h10 < E.length && (h10 = E.length), g < E.length) { var N = E[g]; x(N, w) || (v._values.push(N), v._index.push(D)); } } else g === 0 && h10 < 1 && (h10 = 1), x(E, w) || (v._values.push(E), v._index.push(D)); } g++; } while (g < h10); } v._ptr.push(v._index.length), v._size = [A, h10]; } 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 = true, 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 h10, x, w, g, D = b.min(), E = b.max(); for (h10 = 0, x = v._size.length; h10 < x; h10++) gr(D[h10], v._size[h10]), gr(E[h10], v._size[h10]); 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] = true; }); var C = N ? [] : void 0, _ = [], z = []; return $.forEach(function(O) { for (z.push(_.length), w = M[O], g = M[O + 1]; w < g; w++) h10 = S[w], I[h10] === true && (_.push(B[h10]), 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 !== true) throw new TypeError("Invalid index"); var h10 = 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 (h10.length !== 1 && h10.length !== 2) throw new Ye(h10.length, v._size.length, "<"); if (w.length < h10.length) { for (var g = 0, D = 0; h10[g] === 1 && w[g] === 1; ) g++; for (; h10[g] === 1; ) D++, g++; y = Ag(y, h10.length, D, w); } if (!Sn(h10, w)) throw new Ye(h10, w, ">"); if (h10.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], h10 = 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 || h10 > w - 1) && (d(this, Math.max(A + 1, x), Math.max(h10 + 1, w), y), x = this._size[0], w = this._size[1]), gr(A, x), gr(h10, w); var E = s(A, this._ptr[h10], this._ptr[h10 + 1], this._index); return E < this._ptr[h10 + 1] && this._index[E] === A ? g(b, D) ? c(E, h10, this._values, this._index, this._ptr) : this._values[E] = b : g(b, D) || f(E, A, h10, b, this._values, this._index, this._ptr), this; }; function s(v, b, y, A) { if (y - b === 0) return y; for (var h10 = b; h10 < y; h10++) if (A[h10] === v) return h10; return b; } function c(v, b, y, A, h10) { y.splice(v, 1), A.splice(v, 1); for (var x = b + 1; x < h10.length; x++) h10[x]--; } function f(v, b, y, A, h10, x, w) { h10.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 h10 = y ? this.clone() : this; return d(h10, A[0], A[1], b); }; function d(v, b, y, A) { var h10 = A || 0, x = t, w = 0; Vr(v._datatype) && (x = r.find(t, [v._datatype, v._datatype]) || t, w = r.convert(0, v._datatype), h10 = r.convert(h10, v._datatype)); var g = !x(h10, 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(h10), 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, h10), 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 h10 = b ? this.clone() : this; if (this._size[0] === v[0] && this._size[1] === v[1]) return h10; for (var x = [], w = 0; w < h10._ptr.length; w++) for (var g = 0; g < h10._ptr[w + 1] - h10._ptr[w]; g++) x.push(w); for (var D = h10._values.slice(), E = h10._index.slice(), N = 0; N < h10._index.length; N++) { var S = E[N], M = x[N], F = S * h10._size[1] + M; x[N] = F % v[1], E[N] = Math.floor(F / v[1]); } h10._values.length = 0, h10._index.length = 0, h10._ptr.length = v[1] + 1, h10._size = v.slice(); for (var $ = 0; $ < h10._ptr.length; $++) h10._ptr[$] = 0; for (var I = 0; I < D.length; I++) { var B = E[I], C = x[I], _ = D[I], z = s(B, h10._ptr[C], h10._ptr[C + 1], h10._index); f(z, B, C, _, h10._values, h10._index, h10._ptr); } return h10; }, 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], h10 = 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, h10 - 1, w, b); }; function p(v, b, y, A, h10, 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 <= h10; 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, h10 - 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], h10 = this._size[1], x = ha(v, y, "forEach"), w = 0; w < h10; 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], h10 = y; h10 < A; h10++) { var x = this._index[h10]; yield { value: this._values[h10], index: [x, b] }; } }, a.prototype.toArray = function() { return m(this._values, this._index, this._ptr, this._size, true); }, a.prototype.valueOf = function() { return m(this._values, this._index, this._ptr, this._size, false); }; function m(v, b, y, A, h10) { 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 ? h10 ? 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(), h10 = "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]; h10 += ` (` + Qe(E, v) + ", " + Qe(x, v) + ") ==> " + (this._values ? Qe(this._values[D], v) : "X"); } return h10; }, 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], h10 = this._size[1], x = Math.min(A - y, h10 - b), w = [], g = [], D = []; D[0] = 0; for (var E = b; E < h10 && 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, h10) { 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(h10) && (x = r.find(t, [h10, h10]) || t, w = r.convert(0, h10)); 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, h10) { for (var x = A[v], w = A[v + 1], g = x; g < w; g++) h10(y[g], b[g]); }, a._swapRows = function(v, b, y, A, h10, x) { for (var w = 0; w < y; w++) { var g = x[w], D = x[w + 1], E = s(v, g, D, h10), N = s(b, g, D, h10); if (E < D && N < D && h10[E] === v && h10[N] === b) { if (A) { var S = A[E]; A[E] = A[N], A[N] = S; } continue; } if (E < D && h10[E] === v && (N >= D || h10[N] !== b)) { var M = A ? A[E] : void 0; h10.splice(N, 0, b), A && A.splice(N, 0, M), h10.splice(N <= E ? E + 1 : E, 1), A && A.splice(N <= E ? E + 1 : E, 1); continue; } if (N < D && h10[N] === b && (E >= D || h10[E] !== v)) { var F = A ? A[N] : void 0; h10.splice(E, 0, v), A && A.splice(E, 0, F), h10.splice(E <= N ? N + 1 : N, 1), A && A.splice(E <= N ? N + 1 : N, 1); } } }, a; }, { isClass: true }); var o3 = "number"; var s3 = ["typed"]; function u3(e13) { var r = e13.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: e13, radix: t, integerPart: n, fractionalPart: a }; } else return null; } function l3(e13) { for (var r = parseInt(e13.integerPart, e13.radix), t = 0, n = 0; n < e13.fractionalPart.length; n++) { var a = parseInt(e13.fractionalPart[n], e13.radix); t += a / Math.pow(e13.radix, n + 1); } var i = r + t; if (isNaN(i)) throw new SyntaxError('String "' + e13.input + '" is not a valid number'); return i; } var c3 = P(o3, s3, (e13) => { var { typed: r } = e13, 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; }); var f3 = "bigint"; var d3 = ["typed"]; var p3 = P(f3, d3, (e13) => { var { typed: r } = e13, 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; }); var md = "string"; var m3 = ["typed"]; var v3 = P(md, m3, (e13) => { var { typed: r } = e13; 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); } }); }); var vd = "boolean"; var h3 = ["typed"]; var g3 = P(vd, h3, (e13) => { var { typed: r } = e13; return r(vd, { "": function() { return false; }, boolean: function(n) { return n; }, number: function(n) { return !!n; }, null: function(n) { return false; }, BigNumber: function(n) { return !n.isZero(); }, string: function(n) { var a = n.toLowerCase(); if (a === "true") return true; if (a === "false") return false; 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)) }); }); var y3 = "bignumber"; var b3 = ["typed", "BigNumber"]; var w3 = P(y3, b3, (e13) => { var { typed: r, BigNumber: t } = e13; 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)) }); }); var x3 = "complex"; var A3 = ["typed", "Complex"]; var N3 = P(x3, A3, (e13) => { var { typed: r, Complex: t } = e13; 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)) }); }); var D3 = "fraction"; var E3 = ["typed", "Fraction"]; var S3 = P(D3, E3, (e13) => { var { typed: r, Fraction: t } = e13; 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)) }); }); var hd = "matrix"; var C3 = ["typed", "Matrix", "DenseMatrix", "SparseMatrix"]; var M3 = P(hd, C3, (e13) => { var { typed: r, Matrix: t, DenseMatrix: n, SparseMatrix: a } = e13; 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) + "."); } }); var gd = "matrixFromFunction"; var _3 = ["typed", "matrix", "isZero"]; var F3 = P(gd, _3, (e13) => { var { typed: r, matrix: t, isZero: n } = e13; 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; } }); var yd = "matrixFromRows"; var T3 = ["typed", "matrix", "flatten", "size"]; var O3 = P(yd, T3, (e13) => { var { typed: r, matrix: t, flatten: n, size: a } = e13; 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."); } }); var bd = "matrixFromColumns"; var B3 = ["typed", "matrix", "flatten", "size"]; var $3 = P(bd, B3, (e13) => { var { typed: r, matrix: t, flatten: n, size: a } = e13; 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."); } }); var wd = "splitUnit"; var I3 = ["typed"]; var R3 = P(wd, I3, (e13) => { var { typed: r } = e13; return r(wd, { "Unit, Array": function(n, a) { return n.splitUnit(a); } }); }); var xd = "unaryMinus"; var P3 = ["typed"]; var z3 = P(xd, P3, (e13) => { var { typed: r } = e13; 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 }); }); var Ad = "unaryPlus"; var q3 = ["typed", "config", "numeric"]; var L3 = P(Ad, q3, (e13) => { var { typed: r, config: t, numeric: n } = e13; 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)); } }); }); var Nd = "abs"; var U3 = ["typed"]; var k3 = P(Nd, U3, (e13) => { var { typed: r } = e13; 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)) }); }); var Dd = "apply"; var V3 = ["typed", "isInteger"]; var Wl = P(Dd, V3, (e13) => { var { typed: r, isInteger: t } = e13; 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(e13, r, t) { var n, a, i; if (r <= 0) if (Array.isArray(e13[0])) { for (i = H3(e13), a = [], n = 0; n < i.length; n++) a[n] = ts(i[n], r - 1, t); return a; } else return t(e13); else { for (a = [], n = 0; n < e13.length; n++) a[n] = ts(e13[n], r - 1, t); return a; } } function H3(e13) { var r = e13.length, t = e13[0].length, n, a, i = []; for (a = 0; a < t; a++) { var o = []; for (n = 0; n < r; n++) o.push(e13[n][a]); i.push(o); } return i; } var Ed = "addScalar"; var Z3 = ["typed"]; var G3 = P(Ed, Z3, (e13) => { var { typed: r } = e13; 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 = false, i; }) }); }); var Sd = "subtractScalar"; var W3 = ["typed"]; var K3 = P(Sd, W3, (e13) => { var { typed: r } = e13; 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 = false, i; }) }); }); var Cd = "cbrt"; var J3 = ["config", "typed", "isNegative", "unaryMinus", "matrix", "Complex", "BigNumber", "Fraction"]; var Y3 = P(Cd, J3, (e13) => { var { config: r, typed: t, isNegative: n, unaryMinus: a, matrix: i, Complex: o, BigNumber: l, Fraction: u } = e13; 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; } } }); var j3 = "matAlgo11xS0s"; var X3 = ["typed", "equalScalar"]; var Kr = P(j3, X3, (e13) => { var { typed: r, equalScalar: t } = e13; 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 h10 = [], 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), h10.push(M)); } } return w[m] = x.length, a.createSparseMatrix({ values: h10, index: x, ptr: w, size: [p, m], datatype: v }); }; }); var Q3 = "matAlgo12xSfs"; var eF = ["typed", "DenseMatrix"]; var Pr = P(Q3, eF, (e13) => { var { typed: r, DenseMatrix: t } = e13; 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 = [], h10 = [], 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], h10[N] = w; } for (var S = 0; S < p; S++) x === 0 && (y[S] = []), h10[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 }); }; }); var rF = "matAlgo14xDs"; var tF = ["typed"]; var Wt = P(rF, tF, (e13) => { var { typed: r } = e13; 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; } }); var Ku = "ceil"; var nF = ["typed", "config", "round", "matrix", "equalScalar", "zeros", "DenseMatrix"]; var aF = P(Ku, ["typed", "config", "round"], (e13) => { var { typed: r, config: t, round: n } = e13; 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)); } }); }); var iF = P(Ku, nF, (e13) => { var { typed: r, config: t, round: n, matrix: a, equalScalar: i, zeros: o, DenseMatrix: l } = e13, 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, false)), "DenseMatrix, number | BigNumber": r.referToSelf((d) => (p, m) => c(p, m, d, false)), "number | Complex | Fraction | BigNumber, Array": r.referToSelf((d) => (p, m) => c(a(m), p, d, true).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, true) : s(m, p, d, true)) }); }); var Md = "cube"; var oF = ["typed"]; var sF = P(Md, oF, (e13) => { var { typed: r } = e13; 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); } }); }); var _d = "exp"; var uF = ["typed"]; var lF = P(_d, uF, (e13) => { var { typed: r } = e13; return r(_d, { number: Rg, Complex: function(n) { return n.exp(); }, BigNumber: function(n) { return n.exp(); } }); }); var Fd = "expm1"; var cF = ["typed", "Complex"]; var fF = P(Fd, cF, (e13) => { var { typed: r, Complex: t } = e13; 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); } }); }); var Ju = "fix"; var dF = ["typed", "Complex", "matrix", "ceil", "floor", "equalScalar", "zeros", "DenseMatrix"]; var pF = P(Ju, ["typed", "ceil", "floor"], (e13) => { var { typed: r, ceil: t, floor: n } = e13; 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); } }); }); var mF = P(Ju, dF, (e13) => { var { typed: r, Complex: t, matrix: n, ceil: a, floor: i, equalScalar: o, zeros: l, DenseMatrix: u } = e13, 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, true).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, true) : s(m, p, d, true)) }); }); var Yu = "floor"; var vF = ["typed", "config", "round", "matrix", "equalScalar", "zeros", "DenseMatrix"]; var hF = P(Yu, ["typed", "config", "round"], (e13) => { var { typed: r, config: t, round: n } = e13; 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)); } }); }); var wy = P(Yu, vF, (e13) => { var { typed: r, config: t, round: n, matrix: a, equalScalar: i, zeros: o, DenseMatrix: l } = e13, 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, false)), "DenseMatrix, number | BigNumber": r.referToSelf((d) => (p, m) => c(p, m, d, false)), "number | Complex | Fraction | BigNumber, Array": r.referToSelf((d) => (p, m) => c(a(m), p, d, true).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, true) : s(m, p, d, true)) }); }); var gF = "matAlgo02xDS0"; var yF = ["typed", "equalScalar"]; var Kt = P(gF, yF, (e13) => { var { typed: r, equalScalar: t } = e13; 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, h10 = t, x = 0, w = o; typeof c == "string" && c === v && c !== "mixed" && (A = c, h10 = 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]); h10(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 }); }; }); var bF = "matAlgo03xDSf"; var wF = ["typed"]; var ut = P(bF, wF, (e13) => { var { typed: r } = e13; 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, h10 = i; typeof s == "string" && s === m && s !== "mixed" && (y = s, A = r.convert(0, y), h10 = 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 ? h10(c[F], l[$][E]) : h10(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 ? h10(A, l[I][E]) : h10(l[I][E], A); } return n.createDenseMatrix({ data: x, size: [v, b], datatype: s === n._datatype && m === a._datatype ? y : void 0 }); }; }); var xF = "matAlgo05xSfSf"; var AF = ["typed", "equalScalar"]; var Is = P(xF, AF, (e13) => { var { typed: r, equalScalar: t } = e13; 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], h10, x = t, w = 0, g = o; typeof f == "string" && f === b && f !== "mixed" && (h10 = f, x = r.find(t, [h10, h10]), w = r.convert(0, h10), g = r.find(o, [h10, h10])); 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 ? h10 : void 0 }); }; }); var NF = "matAlgo13xDD"; var DF = ["typed"]; var EF = P(NF, DF, (e13) => { var { typed: r } = e13; 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(e13, r) { if (Sn(e13.size(), r.size())) return [e13, r]; var t = kl(e13.size(), r.size()); return [e13, r].map((n) => SF(n, t)); } function SF(e13, r) { return Sn(e13.size(), r) ? e13 : e13.create(ua(e13.valueOf(), r), e13.datatype()); } var CF = "matrixAlgorithmSuite"; var MF = ["typed", "matrix"]; var br = P(CF, MF, (e13) => { var { typed: r, matrix: t } = e13, 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, false)), o.DS && (s["DenseMatrix, SparseMatrix"] = (p, m) => o.DS(...zr(p, m), l, false), s["Array, SparseMatrix"] = (p, m) => o.DS(...zr(t(p), m), l, false)), u && (s["SparseMatrix, DenseMatrix"] = (p, m) => u(...zr(m, p), l, true), s["SparseMatrix, Array"] = (p, m) => u(...zr(t(m), p), l, true))) : (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, false))), o.DS && (s["DenseMatrix, SparseMatrix"] = r.referToSelf((p) => (m, v) => o.DS(...zr(m, v), p, false)), s["Array, SparseMatrix"] = r.referToSelf((p) => (m, v) => o.DS(...zr(t(m), v), p, false))), u && (s["SparseMatrix, DenseMatrix"] = r.referToSelf((p) => (m, v) => u(...zr(v, m), p, true)), s["SparseMatrix, Array"] = r.referToSelf((p) => (m, v) => u(...zr(t(v), m), p, true)))); var c = o.scalar || "any", f = o.Ds || o.Ss; f && (l ? (s["DenseMatrix," + c] = (p, m) => a(p, m, l, false), s[c + ", DenseMatrix"] = (p, m) => a(m, p, l, true), s["Array," + c] = (p, m) => a(t(p), m, l, false).valueOf(), s[c + ", Array"] = (p, m) => a(t(m), p, l, true).valueOf()) : (s["DenseMatrix," + c] = r.referToSelf((p) => (m, v) => a(m, v, p, false)), s[c + ", DenseMatrix"] = r.referToSelf((p) => (m, v) => a(v, m, p, true)), s["Array," + c] = r.referToSelf((p) => (m, v) => a(t(m), v, p, false).valueOf()), s[c + ", Array"] = r.referToSelf((p) => (m, v) => a(t(v), m, p, true).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, false)), d && (s[c + ", SparseMatrix"] = (p, m) => d(m, p, l, true))) : (o.Ss && (s["SparseMatrix," + c] = r.referToSelf((p) => (m, v) => o.Ss(m, v, p, false))), d && (s[c + ", SparseMatrix"] = r.referToSelf((p) => (m, v) => d(v, m, p, true)))), l && l.signatures && X0(s, l.signatures), s; }; }); var Td = "mod"; var _F = ["typed", "config", "round", "matrix", "equalScalar", "zeros", "DenseMatrix", "concat"]; var xy = P(Td, _F, (e13) => { var { typed: r, config: t, round: n, matrix: a, equalScalar: i, zeros: o, DenseMatrix: l, concat: u } = e13, 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, h10) { return h10.isZero() ? A : A.sub(h10.mul(s(A.div(h10)))); }, "bigint, bigint": function(A, h10) { if (h10 === 0n) return A; if (A < 0) { var x = A % h10; return x === 0n ? x : x + h10; } return A % h10; }, "Fraction, Fraction": function(A, h10) { return h10.equals(0) ? A : A.sub(h10.mul(s(A.div(h10)))); } }, v({ SS: d, DS: f, SD: c, Ss: p, sS: m })); function b(y, A) { return A === 0 ? y : y - A * s(y / A); } }); var FF = "matAlgo01xDSid"; var TF = ["typed"]; var ra = P(FF, TF, (e13) => { var { typed: r } = e13; 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, h10, x, w = []; for (h10 = 0; h10 < v; h10++) w[h10] = []; 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++) h10 = f[M], g[h10] = o ? A(c[M], l[h10][x]) : A(l[h10][x], c[M]), D[h10] = E; for (h10 = 0; h10 < v; h10++) D[h10] === E ? w[h10][x] = g[h10] : w[h10][x] = l[h10][x]; } return n.createDenseMatrix({ data: w, size: [v, b], datatype: s === n._datatype && m === a._datatype ? y : void 0 }); }; }); var OF = "matAlgo04xSidSid"; var BF = ["typed", "equalScalar"]; var Kl = P(OF, BF, (e13) => { var { typed: r, equalScalar: t } = e13; 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], h10, x = t, w = 0, g = o; typeof f == "string" && f === b && f !== "mixed" && (h10 = f, x = r.find(t, [h10, h10]), w = r.convert(0, h10), g = r.find(o, [h10, h10])); 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 ? h10 : void 0 }); }; }); var $F = "matAlgo10xSids"; var IF = ["typed", "DenseMatrix"]; var Da = P($F, IF, (e13) => { var { typed: r, DenseMatrix: t } = e13; 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 = [], h10 = [], 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], h10[N] = w; } for (var S = 0; S < p; S++) x === 0 && (y[S] = []), h10[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(e13, r, t, n) { if (!(this instanceof Fn)) throw new SyntaxError("Constructor must be called with the new operator"); this.fn = e13, this.count = r, this.min = t, this.max = n, this.message = "Wrong number of arguments in function " + e13 + " (" + 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 = true; var Od = "gcd"; var RF = ["typed", "config", "round", "matrix", "equalScalar", "zeros", "BigNumber", "DenseMatrix", "concat"]; var du = "number | BigNumber | Fraction | Matrix | Array"; var PF = "".concat(du, ", ").concat(du, ", ...").concat(du); function Bd(e13) { return !e13.some((r) => Array.isArray(r)); } var zF = P(Od, RF, (e13) => { var { typed: r, matrix: t, config: n, round: a, equalScalar: i, zeros: o, BigNumber: l, DenseMatrix: u, concat: s } = e13, 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, h10, x) => { for (var w = y(A, h10), 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 h10; A !== 0; ) h10 = c(y, A), y = A, A = h10; 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 h10 = new l(0); !A.isZero(); ) { var x = c(y, A); y = A, A = x; } return y.lt(h10) ? y.neg() : y; } }); var qF = "matAlgo06xS0S0"; var LF = ["typed", "equalScalar"]; var Rs = P(qF, LF, (e13) => { var { typed: r, equalScalar: t } = e13; 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 h10 = l && c ? [] : void 0, x = [], w = [], g = h10 ? [] : 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) : (h10.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: h10, index: x, ptr: w, size: [p, m], datatype: s === a._datatype && d === i._datatype ? v : void 0 }); }; }); var $d = "lcm"; var UF = ["typed", "matrix", "equalScalar", "concat"]; var kF = P($d, UF, (e13) => { var { typed: r, matrix: t, equalScalar: n, concat: a } = e13, 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(); } }); var Id = "log10"; var VF = ["typed", "config", "Complex"]; var HF = P(Id, VF, (e13) => { var { typed: r, config: t, Complex: n } = e13; 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)) }); }); var Rd = "log2"; var ZF = ["typed", "config", "Complex"]; var GF = P(Rd, ZF, (e13) => { var { typed: r, config: t, Complex: n } = e13; 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); } }); var WF = "multiplyScalar"; var KF = ["typed"]; var JF = P(WF, KF, (e13) => { var { typed: r } = e13; 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) }); }); var Pd = "multiply"; var YF = ["typed", "matrix", "addScalar", "multiplyScalar", "equalScalar", "dot"]; var jF = P(Pd, YF, (e13) => { var { typed: r, matrix: t, addScalar: n, multiplyScalar: a, equalScalar: i, dot: o } = e13, 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": h10, "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] = true, 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 h10(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, false); }, "DenseMatrix, any": function(g, D) { return u(g, D, a, false); }, "any, SparseMatrix": function(g, D) { return l(D, g, a, true); }, "any, DenseMatrix": function(g, D) { return u(D, g, a, true); }, "Array, any": function(g, D) { return u(t(g), D, a, false).valueOf(); }, "any, Array": function(g, D) { return u(t(D), g, a, true).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; }) }); }); var zd = "nthRoot"; var XF = ["typed", "matrix", "equalScalar", "BigNumber", "concat"]; var QF = P(zd, XF, (e13) => { var { typed: r, matrix: t, equalScalar: n, BigNumber: a, concat: i } = e13, 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, false); 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, true); throw new Error("Root must be non-zero"); }) }, c({ scalar: "number | BigNumber", SD: l, Ss: s, sS: false })); function d(p, m) { var v = a.precision, b = a.clone({ precision: v + 2 }), y = new a(0), A = new b(1), h10 = m.isNegative(); if (h10 && (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 h10 ? new b(1 / 0) : 0; if (!p.isFinite()) return h10 ? y : p; var x = p.abs().pow(A.div(m)); return x = p.isNeg() ? x.neg() : x, new a((h10 ? A.div(x) : x).toPrecision(v)); } }); var qd = "sign"; var eT = ["typed", "BigNumber", "Fraction", "complex"]; var rT = P(qd, eT, (e13) => { var { typed: r, BigNumber: t, complex: n, Fraction: a } = e13; 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); }) }); }); var tT = "sqrt"; var nT = ["config", "typed", "Complex"]; var aT = P(tT, nT, (e13) => { var { config: r, typed: t, Complex: n } = e13; 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(); } }); var Ld = "square"; var iT = ["typed"]; var oT = P(Ld, iT, (e13) => { var { typed: r } = e13; 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); } }); }); var Ud = "subtract"; var sT = ["typed", "matrix", "equalScalar", "subtractScalar", "unaryMinus", "DenseMatrix", "concat"]; var uT = P(Ud, sT, (e13) => { var { typed: r, matrix: t, equalScalar: n, subtractScalar: a, unaryMinus: i, DenseMatrix: o, concat: l } = e13, 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 })); }); var kd = "xgcd"; var lT = ["typed", "config", "matrix", "BigNumber"]; var cT = P(kd, lT, (e13) => { var { typed: r, config: t, matrix: n, BigNumber: a } = e13; 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); } }); var Vd = "invmod"; var fT = ["typed", "config", "BigNumber", "xgcd", "equal", "smaller", "mod", "add", "isInteger"]; var dT = P(Vd, fT, (e13) => { var { typed: r, config: t, BigNumber: n, xgcd: a, equal: i, smaller: o, mod: l, add: u, isInteger: s } = e13; 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; } }); var pT = "matAlgo09xS0Sf"; var mT = ["typed", "equalScalar"]; var Ay = P(pT, mT, (e13) => { var { typed: r, equalScalar: t } = e13; 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], h10, x = t, w = 0, g = o; typeof f == "string" && f === b && f !== "mixed" && (h10 = f, x = r.find(t, [h10, h10]), w = r.convert(0, h10), g = r.find(o, [h10, h10])); 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 ? h10 : void 0 }); }; }); var Hd = "dotMultiply"; var vT = ["typed", "matrix", "equalScalar", "multiplyScalar", "concat"]; var hT = P(Hd, vT, (e13) => { var { typed: r, matrix: t, equalScalar: n, multiplyScalar: a, concat: i } = e13, 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(e13, r) { if (e13.isFinite() && !e13.isInteger() || r.isFinite() && !r.isInteger()) throw new Error("Integers expected in function bitAnd"); var t = e13.constructor; if (e13.isNaN() || r.isNaN()) return new t(NaN); if (e13.isZero() || r.eq(-1) || e13.eq(r)) return e13; if (r.isZero() || e13.eq(-1)) return r; if (!e13.isFinite() || !r.isFinite()) { if (!e13.isFinite() && !r.isFinite()) return e13.isNegative() === r.isNegative() ? e13 : new t(0); if (!e13.isFinite()) return r.isNegative() ? e13 : e13.isNegative() ? new t(0) : r; if (!r.isFinite()) return e13.isNegative() ? r : r.isNegative() ? new t(0) : e13; } return Jl(e13, r, function(n, a) { return n & a; }); } function qi(e13) { if (e13.isFinite() && !e13.isInteger()) throw new Error("Integer expected in function bitNot"); var r = e13.constructor, t = r.precision; r.config({ precision: 1e9 }); var n = e13.plus(new r(1)); return n.s = -n.s || null, r.config({ precision: t }), n; } function yT(e13, r) { if (e13.isFinite() && !e13.isInteger() || r.isFinite() && !r.isInteger()) throw new Error("Integers expected in function bitOr"); var t = e13.constructor; if (e13.isNaN() || r.isNaN()) return new t(NaN); var n = new t(-1); return e13.isZero() || r.eq(n) || e13.eq(r) ? r : r.isZero() || e13.eq(n) ? e13 : !e13.isFinite() || !r.isFinite() ? !e13.isFinite() && !e13.isNegative() && r.isNegative() || e13.isNegative() && !r.isNegative() && !r.isFinite() ? n : e13.isNegative() && r.isNegative() ? e13.isFinite() ? e13 : r : e13.isFinite() ? r : e13 : Jl(e13, r, function(a, i) { return a | i; }); } function Jl(e13, r, t) { var n = e13.constructor, a, i, o = +(e13.s < 0), l = +(r.s < 0); if (o) { a = mo(qi(e13)); for (var u = 0; u < a.length; ++u) a[u] ^= 1; } else a = mo(e13); 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), h10 = 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: h10 }), v === 0 && (b.s = -b.s), b; } function mo(e13) { for (var r = e13.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 = e13.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(e13, r) { if (e13.isFinite() && !e13.isInteger() || r.isFinite() && !r.isInteger()) throw new Error("Integers expected in function bitXor"); var t = e13.constructor; if (e13.isNaN() || r.isNaN()) return new t(NaN); if (e13.isZero()) return r; if (r.isZero()) return e13; if (e13.eq(r)) return new t(0); var n = new t(-1); return e13.eq(n) ? qi(r) : r.eq(n) ? qi(e13) : !e13.isFinite() || !r.isFinite() ? !e13.isFinite() && !r.isFinite() ? n : new t(e13.isNegative() === r.isNegative() ? 1 / 0 : -1 / 0) : Jl(e13, r, function(a, i) { return a ^ i; }); } function wT(e13, r) { if (e13.isFinite() && !e13.isInteger() || r.isFinite() && !r.isInteger()) throw new Error("Integers expected in function leftShift"); var t = e13.constructor; return e13.isNaN() || r.isNaN() || r.isNegative() && !r.isZero() ? new t(NaN) : e13.isZero() || r.isZero() ? e13 : !e13.isFinite() && !r.isFinite() ? new t(NaN) : r.lt(55) ? e13.times(Math.pow(2, r.toNumber()) + "") : e13.times(new t(2).pow(r)); } function xT(e13, r) { if (e13.isFinite() && !e13.isInteger() || r.isFinite() && !r.isInteger()) throw new Error("Integers expected in function rightArithShift"); var t = e13.constructor; return e13.isNaN() || r.isNaN() || r.isNegative() && !r.isZero() ? new t(NaN) : e13.isZero() || r.isZero() ? e13 : r.isFinite() ? r.lt(55) ? e13.div(Math.pow(2, r.toNumber()) + "").floor() : e13.div(new t(2).pow(r)).floor() : e13.isNegative() ? new t(-1) : e13.isFinite() ? new t(0) : new t(NaN); } var Zd = "bitAnd"; var AT = ["typed", "matrix", "equalScalar", "concat"]; var Ny = P(Zd, AT, (e13) => { var { typed: r, matrix: t, equalScalar: n, concat: a } = e13, 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 })); }); var Gd = "bitNot"; var NT = ["typed"]; var DT = P(Gd, NT, (e13) => { var { typed: r } = e13; return r(Gd, { number: Zg, BigNumber: qi, bigint: (t) => ~t, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }); var Wd = "bitOr"; var ET = ["typed", "matrix", "equalScalar", "DenseMatrix", "concat"]; var Dy = P(Wd, ET, (e13) => { var { typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i } = e13, 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 })); }); var ST = "matAlgo07xSSf"; var CT = ["typed", "DenseMatrix"]; var on = P(ST, CT, (e13) => { var { typed: r, DenseMatrix: t } = e13; 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, h10 = []; for (y = 0; y < d; y++) h10[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; h10[y][A] = b(N, S); } } return new t({ data: h10, 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]; } } }); var Kd = "bitXor"; var MT = ["typed", "matrix", "DenseMatrix", "concat"]; var _T = P(Kd, MT, (e13) => { var { typed: r, matrix: t, DenseMatrix: n, concat: a } = e13, 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 })); }); var Jd = "arg"; var FT = ["typed"]; var TT = P(Jd, FT, (e13) => { var { typed: r } = e13; 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)) }); }); var Yd = "conj"; var OT = ["typed"]; var BT = P(Yd, OT, (e13) => { var { typed: r } = e13; return r(Yd, { "number | BigNumber | Fraction": (t) => t, Complex: (t) => t.conjugate(), "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }); var jd = "im"; var $T = ["typed"]; var IT = P(jd, $T, (e13) => { var { typed: r } = e13; return r(jd, { number: () => 0, "BigNumber | Fraction": (t) => t.mul(0), Complex: (t) => t.im, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }); var Xd = "re"; var RT = ["typed"]; var PT = P(Xd, RT, (e13) => { var { typed: r } = e13; return r(Xd, { "number | BigNumber | Fraction": (t) => t, Complex: (t) => t.re, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }); var Qd = "not"; var zT = ["typed"]; var qT = P(Qd, zT, (e13) => { var { typed: r } = e13; return r(Qd, { "null | undefined": () => true, 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)) }); }); var ep = "or"; var LT = ["typed", "matrix", "equalScalar", "DenseMatrix", "concat"]; var Ey = P(ep, LT, (e13) => { var { typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i } = e13, 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 })); }); var rp = "xor"; var UT = ["typed", "matrix", "DenseMatrix", "concat"]; var kT = P(rp, UT, (e13) => { var { typed: r, matrix: t, DenseMatrix: n, concat: a } = e13, 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 })); }); var tp = "concat"; var VT = ["typed", "matrix", "isInteger"]; var Sy = P(tp, VT, (e13) => { var { typed: r, matrix: t, isInteger: n } = e13; 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 = false, f = []; for (o = 0; o < l; o++) { var d = i[o]; if (ze(d) && (c = true), 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(""); } }); }); var np = "column"; var HT = ["typed", "Index", "matrix", "range"]; var Cy = P(np, HT, (e13) => { var { typed: r, Index: t, matrix: n, range: a } = e13; 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]]); } }); var ap = "count"; var ZT = ["typed", "size", "prod"]; var GT = P(ap, ZT, (e13) => { var { typed: r, size: t, prod: n } = e13; return r(ap, { string: function(i) { return i.length; }, "Matrix | Array": function(i) { return n(t(i)); } }); }); var ip = "cross"; var WT = ["typed", "matrix", "subtract", "multiply"]; var KT = P(ip, WT, (e13) => { var { typed: r, matrix: t, subtract: n, multiply: a } = e13; 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; } }); var op = "diag"; var JT = ["typed", "matrix", "DenseMatrix", "SparseMatrix"]; var YT = P(op, JT, (e13) => { var { typed: r, matrix: t, DenseMatrix: n, SparseMatrix: a } = e13; 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; } }); var jT = "filter"; var XT = ["typed"]; var My = P(jT, XT, (e13) => { var { typed: r } = e13; 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(e13, r) { var t = ha(r, e13, "filter"); return b_(e13, function(n, a, i) { return t(n, [a], i); }); } var up = "flatten"; var QT = ["typed"]; var e4 = P(up, QT, (e13) => { var { typed: r } = e13; return r(up, { Array: function(n) { return sr(n); }, Matrix: function(n) { return n.create(sr(n.toArray()), n.datatype()); } }); }); var ju = "forEach"; var r4 = ["typed"]; var _y = P(ju, r4, (e13) => { var { typed: r } = e13; return r(ju, { "Array, function": t4, "Matrix, function": function(n, a) { n.forEach(a); } }); }); function t4(e13, r) { Hl(e13, [], e13, ha(r, e13, ju)); } var lp = "getMatrixDataType"; var n4 = ["typed"]; var a4 = P(lp, n4, (e13) => { var { typed: r } = e13; return r(lp, { Array: function(n) { return Bs(n, yr); }, Matrix: function(n) { return n.getDataType(); } }); }); var cp = "identity"; var i4 = ["typed", "config", "matrix", "BigNumber", "DenseMatrix", "SparseMatrix"]; var o4 = P(cp, i4, (e13) => { var { typed: r, config: t, matrix: n, BigNumber: a, DenseMatrix: i, SparseMatrix: o } = e13; 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; } }); var fp = "kron"; var s4 = ["typed", "matrix", "multiplyScalar"]; var u4 = P(fp, s4, (e13) => { var { typed: r, matrix: t, multiplyScalar: n } = e13; 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; } }); var pu = "map"; var l4 = ["typed"]; var Fy = P(pu, l4, (e13) => { var { typed: r } = e13; 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 = h10(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 h10(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)); } }); var dp = "diff"; var c4 = ["typed", "matrix", "subtract", "number"]; var Ty = P(dp, c4, (e13) => { var { typed: r, matrix: t, subtract: n, number: a } = e13; 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; } }); var f4 = "ones"; var d4 = ["typed", "config", "matrix", "BigNumber"]; var p4 = P(f4, d4, (e13) => { var { typed: r, config: t, matrix: n, BigNumber: a } = e13; 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 = false; return u.forEach(function(c, f, d) { Ze(c) && (s = true, 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"; var m4 = ["typed", "config", "?matrix", "?bignumber", "smaller", "smallerEq", "larger", "largerEq", "add", "isPositive"]; var $y = P(pp, m4, (e13) => { var { typed: r, config: t, matrix: n, bignumber: a, smaller: i, smallerEq: o, larger: l, largerEq: u, add: s, isPositive: c } = e13; 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, false)); }, "number, number, number": function(b, y, A) { return f(p(b, y, A, false)); }, "number, number, boolean": function(b, y, A) { return f(p(b, y, 1, A)); }, "number, number, number, boolean": function(b, y, A, h10) { return f(p(b, y, A, h10)); }, "BigNumber, BigNumber": function(b, y) { var A = b.constructor; return f(p(b, y, new A(1), false)); }, "BigNumber, BigNumber, BigNumber": function(b, y, A) { return f(p(b, y, A, false)); }, "BigNumber, BigNumber, boolean": function(b, y, A) { var h10 = b.constructor; return f(p(b, y, new h10(1), A)); }, "BigNumber, BigNumber, BigNumber, boolean": function(b, y, A, h10) { return f(p(b, y, A, h10)); }, "Unit, Unit, Unit": function(b, y, A) { return f(p(b, y, A, false)); }, "Unit, Unit, Unit, boolean": function(b, y, A, h10) { return f(p(b, y, A, h10)); } }); 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 h10 = [], x = c(y) ? A ? o : i : A ? u : l, w = v; x(w, b); ) h10.push(w), w = s(w, y); return h10; } function m(v) { var b = v.split(":"), y = b.map(function(h10) { return Number(h10); }), A = y.some(function(h10) { return isNaN(h10); }); 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; } } }); var mp = "reshape"; var v4 = ["typed", "isInteger", "matrix"]; var h4 = P(mp, v4, (e13) => { var { typed: r, isInteger: t } = e13; return r(mp, { "Matrix, Array": function(a, i) { return a.reshape(i, true); }, "Array, Array": function(a, i) { return i.forEach(function(o) { if (!t(o)) throw new TypeError("Invalid size for dimension: " + o); }), Ll(a, i); } }); }); var g4 = "resize"; var y4 = ["config", "matrix"]; var b4 = P(g4, y4, (e13) => { var { config: r, matrix: t } = e13; 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, true); if (typeof i == "string") return n(i, o, l); var u = Array.isArray(i) ? false : 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; } }); var vp = "rotate"; var w4 = ["typed", "multiply", "rotationMatrix"]; var x4 = P(vp, w4, (e13) => { var { typed: r, multiply: t, rotationMatrix: n } = e13; 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)); } }); var hp = "rotationMatrix"; var A4 = ["typed", "config", "multiplyScalar", "addScalar", "unaryMinus", "norm", "matrix", "BigNumber", "DenseMatrix", "SparseMatrix", "cos", "sin"]; var N4 = P(hp, A4, (e13) => { 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 } = e13; return r(hp, { "": function() { return t.matrix === "Matrix" ? u([]) : []; }, string: function(h10) { return u(h10); }, "number | BigNumber | Complex | Unit": function(h10) { return p(h10, t.matrix === "Matrix" ? "dense" : void 0); }, "number | BigNumber | Complex | Unit, string": function(h10, x) { return p(h10, x); }, "number | BigNumber | Complex | Unit, Array": function(h10, x) { var w = u(x); return m(w), y(h10, w, void 0); }, "number | BigNumber | Complex | Unit, Matrix": function(h10, x) { m(x); var w = x.storage() || (t.matrix === "Matrix" ? "dense" : void 0); return y(h10, x, w); }, "number | BigNumber | Complex | Unit, Array, string": function(h10, x, w) { var g = u(x); return m(g), y(h10, g, w); }, "number | BigNumber | Complex | Unit, Matrix, string": function(h10, x, w) { return m(x), y(h10, x, w); } }); function p(A, h10) { 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, h10); } function m(A) { var h10 = A.size(); if (h10.length < 1 || h10[0] !== 3) throw new RangeError("Vector must be of dimensions 1x3"); } function v(A) { return A.reduce((h10, x) => n(h10, x)); } function b(A, h10) { if (h10) { if (h10 === "sparse") return new c(A); if (h10 === "dense") return new s(A); throw new TypeError('Unknown matrix type "'.concat(h10, '"')); } return A; } function y(A, h10, x) { var w = o(h10); 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(h10.get([0]) / w) : h10.get([0]) / w, S = g ? new g(h10.get([1]) / w) : h10.get([1]) / w, M = g ? new g(h10.get([2]) / w) : h10.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); } }); var gp = "row"; var D4 = ["typed", "Index", "matrix", "range"]; var Iy = P(gp, D4, (e13) => { var { typed: r, Index: t, matrix: n, range: a } = e13; 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]]); } }); var yp = "size"; var E4 = ["typed", "config", "?matrix"]; var S4 = P(yp, E4, (e13) => { var { typed: r, config: t, matrix: n } = e13; 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(); } }); }); var bp = "squeeze"; var C4 = ["typed"]; var M4 = P(bp, C4, (e13) => { var { typed: r } = e13; 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); } }); }); var wp = "subset"; var _4 = ["typed", "matrix", "zeros", "add"]; var Ry = P(wp, _4, (e13) => { var { typed: r, matrix: t, zeros: n, add: a } = e13; 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(e13, r) { if (!Gi(r)) throw new TypeError("Index expected"); if (ei(r)) return ""; if (Jo(Array.from(e13), r), r.size().length !== 1) throw new Ye(r.size().length, 1); var t = e13.length; gr(r.min()[0], t), gr(r.max()[0], t); var n = r.dimension(0), a = ""; return n.forEach(function(i) { a += e13.charAt(i); }), a; } function xp(e13, r, t, n) { if (!r || r.isIndex !== true) throw new TypeError("Index expected"); if (ei(r)) return e13; if (Jo(Array.from(e13), 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 = e13.length; gr(r.min()[0]), gr(r.max()[0]); for (var l = [], u = 0; u < o; u++) l[u] = e13.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(e13, 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(e13, t); } } function O4(e13, r, t) { if (ei(r)) return e13; 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(e13); return Xa(a, n, t), a; } var Ap = "transpose"; var B4 = ["typed", "matrix"]; var $4 = P(Ap, B4, (e13) => { var { typed: r, matrix: t } = e13; 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, h10; 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), h10 = 0; h10 < u; h10++) for (var g = f[h10], D = f[h10 + 1], E = g; E < D; E++) { var N = v[c[E]]++; p[N] = h10, s && (d[N] = qe(s[E])); } return o.createSparseMatrix({ values: d, index: p, ptr: m, size: [u, l], datatype: o._datatype }); } }); var Np = "ctranspose"; var I4 = ["typed", "transpose", "conj"]; var R4 = P(Np, I4, (e13) => { var { typed: r, transpose: t, conj: n } = e13; return r(Np, { any: function(i) { return n(t(i)); } }); }); var Dp = "zeros"; var P4 = ["typed", "config", "matrix", "BigNumber"]; var z4 = P(Dp, P4, (e13) => { var { typed: r, config: t, matrix: n, BigNumber: a } = e13; 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 = false; return u.forEach(function(c, f, d) { Ze(c) && (s = true, 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"); }); } }); var Ep = "fft"; var q4 = ["typed", "matrix", "addScalar", "multiplyScalar", "divideScalar", "exp", "tau", "i", "dotDivide", "conj", "pow", "ceil", "log2"]; var L4 = P(Ep, q4, (e13) => { 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 } = e13; return r(Ep, { Array: m, Matrix: function(h10) { return h10.create(m(h10.valueOf()), h10.datatype()); } }); function m(A) { var h10 = ke(A); return h10.length === 1 ? y(A, h10[0]) : v(A.map((x) => m(x, h10.slice(1))), 0); } function v(A, h10) { var x = ke(A); if (h10 !== 0) return new Array(x[0]).fill(0).map((g, D) => v(A[D], h10 - 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 h10 = A.length, x = o(i(a(-1, a(u, l)), h10)), w = [], g = 1 - h10; g < h10; g++) w.push(f(x, i(f(g, 2), 2))); for (var D = f(2, d(p(h10 + h10 - 1))), E = [...new Array(h10).fill(0).map((C, _) => a(A[_], w[h10 - 1 + _])), ...new Array(D - h10).fill(0)], N = [...new Array(h10 + h10 - 1).fill(0).map((C, _) => i(1, w[_])), ...new Array(D - (h10 + h10 - 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 = h10 - 1; B < h10 + h10 - 1; B++) I.push(a($[B], w[B])); return I; } function y(A) { var h10 = A.length; if (h10 === 1) return [A[0]]; if (h10 % 2 === 0) { for (var x = [...y(A.filter((E, N) => N % 2 === 0)), ...y(A.filter((E, N) => N % 2 === 1))], w = 0; w < h10 / 2; w++) { var g = x[w], D = a(x[w + h10 / 2], o(a(a(l, u), i(-w, h10)))); x[w] = n(g, D), x[w + h10 / 2] = n(g, a(-1, D)); } return x; } else return b(A); } }); var Sp = "ifft"; var U4 = ["typed", "fft", "dotDivide", "conj"]; var k4 = P(Sp, U4, (e13) => { var { typed: r, fft: t, dotDivide: n, conj: a } = e13; 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(e13) { "@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(e13); } function V4(e13, r) { if (Li(e13) != "object" || !e13) return e13; var t = e13[Symbol.toPrimitive]; if (t !== void 0) { var n = t.call(e13, r); if (Li(n) != "object") return n; throw new TypeError("@@toPrimitive must return a primitive value."); } return (r === "string" ? String : Number)(e13); } function H4(e13) { var r = V4(e13, "string"); return Li(r) == "symbol" ? r : r + ""; } function Rr(e13, r, t) { return (r = H4(r)) in e13 ? Object.defineProperty(e13, r, { value: t, enumerable: true, configurable: true, writable: true }) : e13[r] = t, e13; } function Cp(e13, r) { var t = Object.keys(e13); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e13); r && (n = n.filter(function(a) { return Object.getOwnPropertyDescriptor(e13, a).enumerable; })), t.push.apply(t, n); } return t; } function Z4(e13) { for (var r = 1; r < arguments.length; r++) { var t = arguments[r] != null ? arguments[r] : {}; r % 2 ? Cp(Object(t), true).forEach(function(n) { Rr(e13, n, t[n]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e13, Object.getOwnPropertyDescriptors(t)) : Cp(Object(t)).forEach(function(n) { Object.defineProperty(e13, n, Object.getOwnPropertyDescriptor(t, n)); }); } return e13; } var G4 = "solveODE"; var W4 = ["typed", "add", "subtract", "multiply", "divide", "max", "map", "abs", "isPositive", "isNegative", "larger", "smaller", "matrix", "bignumber", "unaryMinus"]; var K4 = P(G4, W4, (e13) => { 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 } = e13; 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 h10(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 = h10(E, N.toArray(), S.toArray(), M); return { t: p(F.t), y: p(F.y) }; } return r("solveODE", { "function, Array, Array, Object": h10, "function, Matrix, Matrix, Object": D, "function, Array, Array": (E, N, S) => h10(E, N, S, {}), "function, Matrix, Matrix": (E, N, S) => D(E, N, S, {}), "function, Array, number | BigNumber | Unit": (E, N, S) => { var M = h10(E, N, [S], {}); return { t: M.t, y: M.y.map((F) => F[0]) }; }, "function, Matrix, number | BigNumber | Unit": (E, N, S) => { var M = h10(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 = h10(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 = h10(E, N.toArray(), [S], M); return { t: p(F.t), y: p(F.y.map(($) => $[0])) }; } }); }); var J4 = "erf"; var Y4 = ["typed"]; var j4 = P(J4, Y4, (e13) => { var { typed: r } = e13; 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; } }); var X4 = 0.46875; var Q4 = 0.5641895835477563; var 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]]; var 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]]; var eO = Math.pow(2, 53); var Mp = "zeta"; var rO = ["typed", "config", "multiply", "pow", "divide", "factorial", "equal", "smallerEq", "isNegative", "gamma", "sin", "subtract", "add", "?Complex", "?BigNumber", "pi"]; var tO = P(Mp, rO, (e13) => { 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 } = e13; 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) ? h10(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) : h10(g, (D) => D, (D) => Math.round(1.3 * 15 + 0.9 * Math.abs(D.im)), (D) => D.re); } function h10(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, h10(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); } }); var _p = "mode"; var nO = ["typed", "isNaN", "isNumeric"]; var aO = P(_p, nO, (e13) => { var { typed: r, isNaN: t, isNumeric: n } = e13; 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(e13, r, t) { var n; return String(e13).includes("Unexpected type") ? (n = arguments.length > 2 ? " (type: " + yr(t) + ", value: " + JSON.stringify(t) + ")" : " (type: " + e13.data.actual + ")", new TypeError("Cannot calculate " + r + ", unexpected type of argument" + n)) : String(e13).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)) : e13; } var Fp = "prod"; var iO = ["typed", "config", "multiplyScalar", "numeric"]; var oO = P(Fp, iO, (e13) => { var { typed: r, config: t, multiplyScalar: n, numeric: a } = e13; 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; } }); var Tp = "format"; var sO = ["typed"]; var uO = P(Tp, sO, (e13) => { var { typed: r } = e13; return r(Tp, { any: Qe, "any, Object | function | number | BigNumber": Qe }); }); var Op = "bin"; var lO = ["typed", "format"]; var cO = P(Op, lO, (e13) => { var { typed: r, format: t } = e13; 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 }); } }); }); var Bp = "oct"; var fO = ["typed", "format"]; var dO = P(Bp, fO, (e13) => { var { typed: r, format: t } = e13; 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 }); } }); }); var $p = "hex"; var pO = ["typed", "format"]; var mO = P($p, pO, (e13) => { var { typed: r, format: t } = e13; 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 }); } }); }); var Py = /\$([\w.]+)/g; var Ip = "print"; var vO = ["typed"]; var zy = P(Ip, vO, (e13) => { var { typed: r } = e13; return r(Ip, { // note: Matrix will be converted automatically to an Array "string, Object | Array": Rp, "string, Object | Array, number | Object": Rp }); }); function Rp(e13, r, t) { return e13.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"; var hO = ["typed", "matrix", "concat"]; var gO = P(Pp, hO, (e13) => { var { typed: r, matrix: t, concat: n } = e13, a = br({ typed: r, matrix: t, concat: n }); return r(Pp, { "Unit, Unit | string": (i, o) => i.to(o) }, a({ Ds: true })); }); var zp = "isPrime"; var yO = ["typed"]; var bO = P(zp, yO, (e13) => { var { typed: r } = e13; return r(zp, { number: function(n) { if (n <= 3) return n > 1; if (n % 2 === 0 || n % 3 === 0) return false; for (var a = 5; a * a <= n; a += 6) if (n % a === 0 || n % (a + 2) === 0) return false; return true; }, bigint: function(n) { if (n <= 3n) return n > 1n; if (n % 2n === 0n || n % 3n === 0n) return false; for (var a = 5n; a * a <= n; a += 6n) if (n % a === 0n || n % (a + 2n) === 0n) return false; return true; }, BigNumber: function(n) { if (n.lte(3)) return n.gt(1); if (n.mod(2).eq(0) || n.mod(3).eq(0)) return false; 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 false; return true; } function o(A, h10, x) { for (var w = 1; !h10.eq(0); ) h10.mod(2).eq(0) ? (h10 = h10.div(2), A = A.mul(A).mod(x)) : (h10 = h10.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 false; } } return true; }, "Array | Matrix": r.referToSelf((t) => (n) => je(n, t)) }); }); var wO = "numeric"; var xO = ["number", "?bignumber", "?fraction"]; var AO = P(wO, xO, (e13) => { var { number: r, bignumber: t, fraction: n } = e13, a = { string: true, number: true, BigNumber: true, Fraction: true }, 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); }; }); var qp = "divideScalar"; var NO = ["typed", "numeric"]; var DO = P(qp, NO, (e13) => { var { typed: r, numeric: t } = e13; 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) }); }); var Lp = "pow"; var EO = ["typed", "config", "identity", "multiply", "matrix", "inv", "fraction", "number", "Complex"]; var SO = P(Lp, EO, (e13) => { var { typed: r, config: t, identity: n, multiply: a, matrix: i, inv: o, number: l, fraction: u, Complex: s } = e13; 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)); } }); var Oa = "Number of decimals in function round must be an integer"; var Up = "round"; var CO = ["typed", "config", "matrix", "equalScalar", "zeros", "BigNumber", "DenseMatrix"]; var MO = P(Up, CO, (e13) => { var { typed: r, config: t, matrix: n, equalScalar: a, zeros: i, BigNumber: o, DenseMatrix: l } = e13, 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, false)), "DenseMatrix, number | BigNumber": r.referToSelf((d) => (p, m) => c(p, m, d, false)), "Array, number | BigNumber": r.referToSelf((d) => (p, m) => c(n(p), m, d, false).valueOf()), "number | Complex | BigNumber | Fraction, SparseMatrix": r.referToSelf((d) => (p, m) => a(p, 0) ? i(m.size(), m.storage()) : s(m, p, d, true)), "number | Complex | BigNumber | Fraction, DenseMatrix": r.referToSelf((d) => (p, m) => a(p, 0) ? i(m.size(), m.storage()) : c(m, p, d, true)), "number | Complex | BigNumber | Fraction, Array": r.referToSelf((d) => (p, m) => c(n(m), p, d, true).valueOf()) }); }); var kp = "log"; var _O = ["config", "typed", "divideScalar", "Complex"]; var FO = P(kp, _O, (e13) => { var { typed: r, config: t, divideScalar: n, Complex: a } = e13; 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))) }); }); var Vp = "log1p"; var TO = ["typed", "config", "divideScalar", "log", "Complex"]; var OO = P(Vp, TO, (e13) => { var { typed: r, config: t, divideScalar: n, log: a, Complex: i } = e13; 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)); } }); var Hp = "nthRoots"; var BO = ["config", "typed", "divideScalar", "Complex"]; var $O = P(Hp, BO, (e13) => { var { typed: r, config: t, divideScalar: n, Complex: a } = e13, 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 }); }); var Zp = "dotPow"; var IO = ["typed", "equalScalar", "matrix", "pow", "DenseMatrix", "concat"]; var RO = P(Zp, IO, (e13) => { var { typed: r, equalScalar: t, matrix: n, pow: a, DenseMatrix: i, concat: o } = e13, 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 })); }); var Gp = "dotDivide"; var PO = ["typed", "matrix", "equalScalar", "divideScalar", "DenseMatrix", "concat"]; var zO = P(Gp, PO, (e13) => { var { typed: r, matrix: t, equalScalar: n, divideScalar: a, DenseMatrix: i, concat: o } = e13, 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(e13) { var { DenseMatrix: r } = e13; 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], h10 = y[0]; h10 < A; h10++) { var x = b[h10]; s[x][0] = v[h10]; } 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"; var qO = ["typed", "matrix", "divideScalar", "multiplyScalar", "subtractScalar", "equalScalar", "DenseMatrix"]; var LO = P(Wp, qO, (e13) => { var { typed: r, matrix: t, divideScalar: n, multiplyScalar: a, subtractScalar: i, equalScalar: o, DenseMatrix: l } = e13, 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, true); for (var p = d._data, m = f._size[0], v = f._size[1], b = [], y = f._data, A = 0; A < v; A++) { var h10 = p[A][0] || 0, x = void 0; if (o(h10, 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(h10, 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, true); for (var p = d._data, m = f._size[0], v = f._size[1], b = f._values, y = f._index, A = f._ptr, h10 = [], x = 0; x < v; x++) { var w = p[x][0] || 0; if (o(w, 0)) h10[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]))]; } h10[x] = [$]; } } return new l({ data: h10, size: [m, 1] }); } }); var Kp = "usolve"; var UO = ["typed", "matrix", "divideScalar", "multiplyScalar", "subtractScalar", "equalScalar", "DenseMatrix"]; var kO = P(Kp, UO, (e13) => { var { typed: r, matrix: t, divideScalar: n, multiplyScalar: a, subtractScalar: i, equalScalar: o, DenseMatrix: l } = e13, 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, true); for (var p = d._data, m = f._size[0], v = f._size[1], b = [], y = f._data, A = v - 1; A >= 0; A--) { var h10 = p[A][0] || 0, x = void 0; if (o(h10, 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(h10, 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, true); for (var p = d._data, m = f._size[0], v = f._size[1], b = f._values, y = f._index, A = f._ptr, h10 = [], x = v - 1; x >= 0; x--) { var w = p[x][0] || 0; if (o(w, 0)) h10[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]))]; } h10[x] = [$]; } } return new l({ data: h10, size: [m, 1] }); } }); var Jp = "lsolveAll"; var VO = ["typed", "matrix", "divideScalar", "multiplyScalar", "subtractScalar", "equalScalar", "DenseMatrix"]; var HO = P(Jp, VO, (e13) => { var { typed: r, matrix: t, divideScalar: n, multiplyScalar: a, subtractScalar: i, equalScalar: o, DenseMatrix: l } = e13, 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, true)._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, h10 = 0; h10 < A; h10++) { var x = p[h10]; if (o(m[y][y], 0)) if (o(x[y], 0)) { if (h10 === 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 (h10 === 0) return []; p.splice(h10, 1), h10 -= 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, true)._data.map((X) => X[0])], m = f._size[0], v = f._size[1], b = f._values, y = f._index, A = f._ptr, h10 = 0; h10 < v; h10++) for (var x = p.length, w = 0; w < x; w++) { for (var g = p[w], D = [], E = [], N = A[h10], S = A[h10 + 1], M = 0, F = N; F < S; F++) { var $ = y[F]; $ === h10 ? M = b[F] : $ > h10 && (D.push(b[F]), E.push($)); } if (o(M, 0)) if (o(g[h10], 0)) { if (w === 0) { var _ = [...g]; _[h10] = 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[h10] = n(g[h10], M); for (var I = 0, B = E.length; I < B; I++) { var C = E[I]; g[C] = i(g[C], a(g[h10], D[I])); } } } return p.map((X) => new l({ data: X.map((V) => [V]), size: [m, 1] })); } }); var Yp = "usolveAll"; var ZO = ["typed", "matrix", "divideScalar", "multiplyScalar", "subtractScalar", "equalScalar", "DenseMatrix"]; var GO = P(Yp, ZO, (e13) => { var { typed: r, matrix: t, divideScalar: n, multiplyScalar: a, subtractScalar: i, equalScalar: o, DenseMatrix: l } = e13, 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, true)._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, h10 = 0; h10 < A; h10++) { var x = p[h10]; if (o(m[y][y], 0)) if (o(x[y], 0)) { if (h10 === 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 (h10 === 0) return []; p.splice(h10, 1), h10 -= 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, true)._data.map((X) => X[0])], m = f._size[0], v = f._size[1], b = f._values, y = f._index, A = f._ptr, h10 = v - 1; h10 >= 0; h10--) for (var x = p.length, w = 0; w < x; w++) { for (var g = p[w], D = [], E = [], N = A[h10], S = A[h10 + 1], M = 0, F = S - 1; F >= N; F--) { var $ = y[F]; $ === h10 ? M = b[F] : $ < h10 && (D.push(b[F]), E.push($)); } if (o(M, 0)) if (o(g[h10], 0)) { if (w === 0) { var _ = [...g]; _[h10] = 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[h10] = n(g[h10], M); for (var I = 0, B = E.length; I < B; I++) { var C = E[I]; g[C] = i(g[C], a(g[h10], D[I])); } } } return p.map((X) => new l({ data: X.map((V) => [V]), size: [m, 1] })); } }); var WO = "matAlgo08xS0Sid"; var KO = ["typed", "equalScalar"]; var jl = P(WO, KO, (e13) => { var { typed: r, equalScalar: t } = e13; 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], h10, x = t, w = 0, g = o; typeof f == "string" && f === b && f !== "mixed" && (h10 = f, x = r.find(t, [h10, h10]), w = r.convert(0, h10), g = r.find(o, [h10, h10])); 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 ? h10 : void 0 }); }; }); var Xl = P("useMatrixForArrayScalar", ["typed", "matrix"], (e13) => { var { typed: r, matrix: t } = e13; 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()) }; }); var jp = "leftShift"; var JO = ["typed", "matrix", "equalScalar", "zeros", "DenseMatrix", "concat"]; var YO = P(jp, JO, (e13) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, DenseMatrix: i, concat: o } = e13, 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, false)), "DenseMatrix, number | BigNumber": r.referToSelf((v) => (b, y) => n(y, 0) ? b.clone() : d(b, y, v, false)), "number | BigNumber, SparseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : c(y, b, v, true)), "number | BigNumber, DenseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : d(y, b, v, true)) }, m, p({ SS: s, DS: l, SD: u })); }); var Xp = "rightArithShift"; var jO = ["typed", "matrix", "equalScalar", "zeros", "DenseMatrix", "concat"]; var XO = P(Xp, jO, (e13) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, DenseMatrix: i, concat: o } = e13, 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, false)), "DenseMatrix, number | BigNumber": r.referToSelf((v) => (b, y) => n(y, 0) ? b.clone() : d(b, y, v, false)), "number | BigNumber, SparseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : c(y, b, v, true)), "number | BigNumber, DenseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : d(y, b, v, true)) }, m, p({ SS: s, DS: l, SD: u })); }); var Qp = "rightLogShift"; var QO = ["typed", "matrix", "equalScalar", "zeros", "DenseMatrix", "concat"]; var eB = P(Qp, QO, (e13) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, DenseMatrix: i, concat: o } = e13, 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, false)), "DenseMatrix, number | BigNumber": r.referToSelf((v) => (b, y) => n(y, 0) ? b.clone() : d(b, y, v, false)), "number | BigNumber, SparseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : c(y, b, v, true)), "number | BigNumber, DenseMatrix": r.referToSelf((v) => (b, y) => n(b, 0) ? a(y.size(), y.storage()) : d(y, b, v, true)) }, m, p({ SS: s, DS: l, SD: u })); }); var em = "and"; var rB = ["typed", "matrix", "equalScalar", "zeros", "not", "concat"]; var qy = P(em, rB, (e13) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, not: i, concat: o } = e13, 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, false)), "DenseMatrix, any": r.referToSelf((d) => (p, m) => i(m) ? a(p.size(), p.storage()) : c(p, m, d, false)), "any, SparseMatrix": r.referToSelf((d) => (p, m) => i(p) ? a(p.size(), p.storage()) : s(m, p, d, true)), "any, DenseMatrix": r.referToSelf((d) => (p, m) => i(p) ? a(p.size(), p.storage()) : c(m, p, d, true)), "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 })); }); var ns = "compare"; var tB = ["typed", "config", "matrix", "equalScalar", "BigNumber", "Fraction", "DenseMatrix", "concat"]; var nB = P(ns, tB, (e13) => { var { typed: r, config: t, equalScalar: n, matrix: a, BigNumber: i, Fraction: o, DenseMatrix: l, concat: u } = e13, 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 })); }); var aB = P(ns, ["typed", "config"], (e13) => { var { typed: r, config: t } = e13; return r(ns, { "number, number": function(a, i) { return Gr(a, i, t.relTol, t.absTol) ? 0 : a > i ? 1 : -1; } }); }); var 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(h10) { return e.insensitive && ("" + h10).toLowerCase() || "" + h10; }, 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; }; var Ba = Es(iB); var rm = "compareNatural"; var oB = ["typed", "compare"]; var sB = P(rm, oB, (e13) => { var { typed: r, compare: t } = e13, 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(e13, r) { return e13.re > r.re ? 1 : e13.re < r.re ? -1 : e13.im > r.im ? 1 : e13.im < r.im ? -1 : 0; } var tm = "compareText"; var lB = ["typed", "matrix", "concat"]; ku.signature = "any, any"; var cB = P(tm, lB, (e13) => { var { typed: r, matrix: t, concat: n } = e13, a = br({ typed: r, matrix: t, concat: n }); return r(tm, ku, a({ elop: ku, Ds: true })); }); var as = "equal"; var fB = ["typed", "matrix", "equalScalar", "DenseMatrix", "concat"]; var dB = P(as, fB, (e13) => { var { typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i } = e13, 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 })); }); var pB = P(as, ["typed", "equalScalar"], (e13) => { var { typed: r, equalScalar: t } = e13; 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); } }); }); var nm = "equalText"; var mB = ["typed", "compareText", "isZero"]; var vB = P(nm, mB, (e13) => { var { typed: r, compareText: t, isZero: n } = e13; return r(nm, { "any, any": function(i, o) { return n(t(i, o)); } }); }); var is = "smaller"; var hB = ["typed", "config", "matrix", "DenseMatrix", "concat"]; var gB = P(is, hB, (e13) => { var { typed: r, config: t, matrix: n, DenseMatrix: a, concat: i } = e13, 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 })); }); var yB = P(is, ["typed", "config"], (e13) => { var { typed: r, config: t } = e13; return r(is, { "number, number": function(a, i) { return a < i && !Gr(a, i, t.relTol, t.absTol); } }); }); var os = "smallerEq"; var bB = ["typed", "config", "matrix", "DenseMatrix", "concat"]; var wB = P(os, bB, (e13) => { var { typed: r, config: t, matrix: n, DenseMatrix: a, concat: i } = e13, 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 })); }); var xB = P(os, ["typed", "config"], (e13) => { var { typed: r, config: t } = e13; return r(os, { "number, number": function(a, i) { return a <= i || Gr(a, i, t.relTol, t.absTol); } }); }); var ss = "larger"; var AB = ["typed", "config", "matrix", "DenseMatrix", "concat"]; var NB = P(ss, AB, (e13) => { var { typed: r, config: t, matrix: n, DenseMatrix: a, concat: i } = e13, 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 })); }); var DB = P(ss, ["typed", "config"], (e13) => { var { typed: r, config: t } = e13; return r(ss, { "number, number": function(a, i) { return a > i && !Gr(a, i, t.relTol, t.absTol); } }); }); var us = "largerEq"; var EB = ["typed", "config", "matrix", "DenseMatrix", "concat"]; var SB = P(us, EB, (e13) => { var { typed: r, config: t, matrix: n, DenseMatrix: a, concat: i } = e13, 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 })); }); var CB = P(us, ["typed", "config"], (e13) => { var { typed: r, config: t } = e13; return r(us, { "number, number": function(a, i) { return a >= i || Gr(a, i, t.relTol, t.absTol); } }); }); var am = "deepEqual"; var MB = ["typed", "equal"]; var _B = P(am, MB, (e13) => { var { typed: r, equal: t } = e13; 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 false; for (var l = 0; l < o; l++) if (!n(a[l], i[l])) return false; return true; } else return false; else return Array.isArray(i) ? false : t(a, i); } }); var ls = "unequal"; var FB = ["typed", "config", "equalScalar", "matrix", "DenseMatrix", "concat"]; var TB = P(ls, FB, (e13) => { var { typed: r, config: t, equalScalar: n, matrix: a, DenseMatrix: i, concat: o } = e13, 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); } }); var OB = P(ls, ["typed", "equalScalar"], (e13) => { var { typed: r, equalScalar: t } = e13; 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); } }); }); var im = "partitionSelect"; var BB = ["typed", "isNumeric", "isNaN", "compare"]; var $B = P(im, BB, (e13) => { var { typed: r, isNumeric: t, isNaN: n, compare: a } = e13, 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]; } }); var om = "sort"; var IB = ["typed", "matrix", "compare", "compareNatural"]; var RB = P(om, IB, (e13) => { var { typed: r, matrix: t, compare: n, compareNatural: a } = e13, 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"); } }); var sm = "max"; var PB = ["typed", "config", "numeric", "larger"]; var Ly = P(sm, PB, (e13) => { var { typed: r, config: t, numeric: n, larger: a } = e13; 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; } }); var um = "min"; var zB = ["typed", "config", "numeric", "smaller"]; var Uy = P(um, zB, (e13) => { var { typed: r, config: t, numeric: n, smaller: a } = e13; 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; } }); var qB = "ImmutableDenseMatrix"; var LB = ["smaller", "DenseMatrix"]; var UB = P(qB, LB, (e13) => { var { smaller: r, DenseMatrix: t } = e13; 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 = true, 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: true }); var kB = "Index"; var VB = ["ImmutableDenseMatrix", "getMatrixDataType"]; var HB = P(kB, VB, (e13) => { var { ImmutableDenseMatrix: r, getMatrixDataType: t } = e13; function n(i) { if (!(this instanceof n)) throw new SyntaxError("Constructor must be called with the new operator"); this._dimensions = [], this._sourceSize = [], this._isScalar = true; 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 = false; 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 = false); } 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 = true; 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: true }); function lm(e13) { var r = []; return e13.forEach((t, n) => { t && r.push(n); }), r; } var ZB = "FibonacciHeap"; var GB = ["smaller", "larger"]; var WB = P(ZB, GB, (e13) => { var { smaller: r, larger: t } = e13, 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 = true, 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 = false; } function l(c, f) { var d = f.parent; d && (f.mark ? (o(c, f, d), l(d)) : f.mark = true); } 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 = false; }; 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 h10 = b; b = v, v = h10; } 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: true }); var KB = "Spa"; var JB = ["addScalar", "equalScalar", "FibonacciHeap"]; var YB = P(KB, JB, (e13) => { var { addScalar: r, equalScalar: t, FibonacciHeap: n } = e13; 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 = true, 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: true }); function jB(e13) { 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 e13 = Math.abs(e13), { hit: function(u) { var s = a[u], c = ++i; if (n[c] = u, a[u] = c, !s) return ++r, r <= e13 ? 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(e13) { 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 = e13.apply(e13, a); return n.cache.values.set(o, l), n.cache.values.delete(n.cache.lru.hit(o)), l; }; } var XB = Yi(function(e13) { return new e13(1).exp(); }, { hasher: Ps }); var QB = Yi(function(e13) { return new e13(1).plus(new e13(5).sqrt()).div(2); }, { hasher: Ps }); var Ql = Yi(function(e13) { return e13.acos(-1); }, { hasher: Ps }); var e5 = Yi(function(e13) { return Ql(e13).times(2); }, { hasher: Ps }); function Ps(e13) { return e13[0].precision; } function cm(e13, r) { var t = Object.keys(e13); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e13); r && (n = n.filter(function(a) { return Object.getOwnPropertyDescriptor(e13, a).enumerable; })), t.push.apply(t, n); } return t; } function mu(e13) { for (var r = 1; r < arguments.length; r++) { var t = arguments[r] != null ? arguments[r] : {}; r % 2 ? cm(Object(t), true).forEach(function(n) { Rr(e13, n, t[n]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e13, Object.getOwnPropertyDescriptors(t)) : cm(Object(t)).forEach(function(n) { Object.defineProperty(e13, n, Object.getOwnPropertyDescriptor(t, n)); }); } return e13; } var r5 = "Unit"; var t5 = ["?on", "config", "addScalar", "subtractScalar", "multiplyScalar", "divideScalar", "pow", "abs", "fix", "round", "equal", "isNumeric", "format", "number", "Complex", "BigNumber", "Fraction"]; var n5 = P(r5, t5, (e13) => { 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 } = e13, A = m; function h10(L, H) { if (!(this instanceof h10)) 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 = false, this.skipAutomaticSimplification = true, H === void 0) this.units = [], this.dimensions = z.map((ie) => 0); else if (typeof H == "string") { var ne = h10.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(h10, "name", { value: "Unit" }), h10.prototype.constructor = h10, h10.prototype.type = "Unit", h10.prototype.isUnit = true; 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) || h10.isValidAlpha(g); ) L += g, S(); var H = L.charAt(0); return h10.isValidAlpha(H) ? L : null; } function I(L) { return g === L ? (S(), L) : null; } h10.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 h10(); ne.units = []; var ie = 1, me = false; 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 = true) : I("/") && (ie = -1, me = true); } 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 = false, I("*") ? (ie = 1, me = true) : I("/") ? (ie = -1, me = true) : 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; }, h10.prototype.clone = function() { var L = new h10(); 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; }, h10.prototype.valueType = function() { return yr(this.value); }, h10.prototype._isDerived = function() { return this.units.length === 0 ? false : this.units.length > 1 || Math.abs(this.units[0].power - 1) > 1e-15; }, h10.prototype._normalize = function(L) { if (L == null || this.units.length === 0) return L; for (var H = L, ne = h10._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; }, h10.prototype._denormalize = function(L, H) { if (L == null || this.units.length === 0) return L; for (var ne = L, ie = h10._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 }); h10.isValuelessUnit = function(L) { return B(L) !== null; }, h10.prototype.hasBase = function(L) { if (typeof L == "string" && (L = O[L]), !L) return false; for (var H = 0; H < z.length; H++) if (Math.abs((this.dimensions[H] || 0) - (L.dimensions[H] || 0)) > 1e-12) return false; return true; }, h10.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 false; return true; }, h10.prototype.equals = function(L) { return this.equalBase(L) && f(this.value, L.value); }, h10.prototype.multiply = function(L) { for (var H = this.clone(), ne = ft(L) ? L : new h10(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 = false), C(H); }, h10.prototype.divideInto = function(L) { return new h10(L).divide(this); }, h10.prototype.divide = function(L) { for (var H = this.clone(), ne = ft(L) ? L : new h10(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 = false), C(H); }, h10.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 = false, C(H); }; function C(L) { return L.equalBase(O.NONE) && L.value !== null && !t.predictable ? L.value : L; } h10.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; }, h10.prototype.to = function(L) { var H = this.value === null ? this._normalize(1) : this.value, ne; if (typeof L == "string") ne = h10.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 = h10._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 = true, ne.skipAutomaticSimplification = true, ne; }, h10.prototype.toNumber = function(L) { return A(this.toNumeric(L)); }, h10.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); }, h10.prototype.toString = function() { return this.format(); }, h10.prototype.toJSON = function() { return { mathjs: "Unit", value: this._denormalize(this.value), unit: this.units.length > 0 ? this.formatUnits() : null, fixPrefix: this.fixPrefix }; }, h10.fromJSON = function(L) { var H, ne = new h10(L.value, (H = L.unit) !== null && H !== void 0 ? H : void 0); return ne.fixPrefix = L.fixPrefix || false, ne; }, h10.prototype.valueOf = h10.prototype.toString, h10.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 = false, 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 = true); } H.length < L.units.length && !pe && (L.units = H); } } return L; }, h10.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 = true, L.skipAutomaticSimplification = true, this.value !== null ? (L.value = null, this.to(L)) : L; }, h10.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; }, h10.prototype.format = function(L) { var H = this.skipAutomaticSimplification || this.value === null ? this.clone() : this.simplify(), ne = false; 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; }, h10.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; }, h10.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 h10(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: true } }, SHORT: { "": { name: "", value: 1, scientific: true }, da: { name: "da", value: 10, scientific: false }, h: { name: "h", value: 100, scientific: false }, k: { name: "k", value: 1e3, scientific: true }, M: { name: "M", value: 1e6, scientific: true }, G: { name: "G", value: 1e9, scientific: true }, T: { name: "T", value: 1e12, scientific: true }, P: { name: "P", value: 1e15, scientific: true }, E: { name: "E", value: 1e18, scientific: true }, Z: { name: "Z", value: 1e21, scientific: true }, Y: { name: "Y", value: 1e24, scientific: true }, R: { name: "R", value: 1e27, scientific: true }, Q: { name: "Q", value: 1e30, scientific: true }, d: { name: "d", value: 0.1, scientific: false }, c: { name: "c", value: 0.01, scientific: false }, m: { name: "m", value: 1e-3, scientific: true }, u: { name: "u", value: 1e-6, scientific: true }, n: { name: "n", value: 1e-9, scientific: true }, p: { name: "p", value: 1e-12, scientific: true }, f: { name: "f", value: 1e-15, scientific: true }, a: { name: "a", value: 1e-18, scientific: true }, z: { name: "z", value: 1e-21, scientific: true }, y: { name: "y", value: 1e-24, scientific: true }, r: { name: "r", value: 1e-27, scientific: true }, q: { name: "q", value: 1e-30, scientific: true } }, LONG: { "": { name: "", value: 1, scientific: true }, deca: { name: "deca", value: 10, scientific: false }, hecto: { name: "hecto", value: 100, scientific: false }, kilo: { name: "kilo", value: 1e3, scientific: true }, mega: { name: "mega", value: 1e6, scientific: true }, giga: { name: "giga", value: 1e9, scientific: true }, tera: { name: "tera", value: 1e12, scientific: true }, peta: { name: "peta", value: 1e15, scientific: true }, exa: { name: "exa", value: 1e18, scientific: true }, zetta: { name: "zetta", value: 1e21, scientific: true }, yotta: { name: "yotta", value: 1e24, scientific: true }, ronna: { name: "ronna", value: 1e27, scientific: true }, quetta: { name: "quetta", value: 1e30, scientific: true }, deci: { name: "deci", value: 0.1, scientific: false }, centi: { name: "centi", value: 0.01, scientific: false }, milli: { name: "milli", value: 1e-3, scientific: true }, micro: { name: "micro", value: 1e-6, scientific: true }, nano: { name: "nano", value: 1e-9, scientific: true }, pico: { name: "pico", value: 1e-12, scientific: true }, femto: { name: "femto", value: 1e-15, scientific: true }, atto: { name: "atto", value: 1e-18, scientific: true }, zepto: { name: "zepto", value: 1e-21, scientific: true }, yocto: { name: "yocto", value: 1e-24, scientific: true }, ronto: { name: "ronto", value: 1e-27, scientific: true }, quecto: { name: "quecto", value: 1e-30, scientific: true } }, SQUARED: { "": { name: "", value: 1, scientific: true }, da: { name: "da", value: 100, scientific: false }, h: { name: "h", value: 1e4, scientific: false }, k: { name: "k", value: 1e6, scientific: true }, M: { name: "M", value: 1e12, scientific: true }, G: { name: "G", value: 1e18, scientific: true }, T: { name: "T", value: 1e24, scientific: true }, P: { name: "P", value: 1e30, scientific: true }, E: { name: "E", value: 1e36, scientific: true }, Z: { name: "Z", value: 1e42, scientific: true }, Y: { name: "Y", value: 1e48, scientific: true }, R: { name: "R", value: 1e54, scientific: true }, Q: { name: "Q", value: 1e60, scientific: true }, d: { name: "d", value: 0.01, scientific: false }, c: { name: "c", value: 1e-4, scientific: false }, m: { name: "m", value: 1e-6, scientific: true }, u: { name: "u", value: 1e-12, scientific: true }, n: { name: "n", value: 1e-18, scientific: true }, p: { name: "p", value: 1e-24, scientific: true }, f: { name: "f", value: 1e-30, scientific: true }, a: { name: "a", value: 1e-36, scientific: true }, z: { name: "z", value: 1e-42, scientific: true }, y: { name: "y", value: 1e-48, scientific: true }, r: { name: "r", value: 1e-54, scientific: true }, q: { name: "q", value: 1e-60, scientific: true } }, CUBIC: { "": { name: "", value: 1, scientific: true }, da: { name: "da", value: 1e3, scientific: false }, h: { name: "h", value: 1e6, scientific: false }, k: { name: "k", value: 1e9, scientific: true }, M: { name: "M", value: 1e18, scientific: true }, G: { name: "G", value: 1e27, scientific: true }, T: { name: "T", value: 1e36, scientific: true }, P: { name: "P", value: 1e45, scientific: true }, E: { name: "E", value: 1e54, scientific: true }, Z: { name: "Z", value: 1e63, scientific: true }, Y: { name: "Y", value: 1e72, scientific: true }, R: { name: "R", value: 1e81, scientific: true }, Q: { name: "Q", value: 1e90, scientific: true }, d: { name: "d", value: 1e-3, scientific: false }, c: { name: "c", value: 1e-6, scientific: false }, m: { name: "m", value: 1e-9, scientific: true }, u: { name: "u", value: 1e-18, scientific: true }, n: { name: "n", value: 1e-27, scientific: true }, p: { name: "p", value: 1e-36, scientific: true }, f: { name: "f", value: 1e-45, scientific: true }, a: { name: "a", value: 1e-54, scientific: true }, z: { name: "z", value: 1e-63, scientific: true }, y: { name: "y", value: 1e-72, scientific: true }, r: { name: "r", value: 1e-81, scientific: true }, q: { name: "q", value: 1e-90, scientific: true } }, BINARY_SHORT_SI: { "": { name: "", value: 1, scientific: true }, k: { name: "k", value: 1e3, scientific: true }, M: { name: "M", value: 1e6, scientific: true }, G: { name: "G", value: 1e9, scientific: true }, T: { name: "T", value: 1e12, scientific: true }, P: { name: "P", value: 1e15, scientific: true }, E: { name: "E", value: 1e18, scientific: true }, Z: { name: "Z", value: 1e21, scientific: true }, Y: { name: "Y", value: 1e24, scientific: true } }, BINARY_SHORT_IEC: { "": { name: "", value: 1, scientific: true }, Ki: { name: "Ki", value: 1024, scientific: true }, Mi: { name: "Mi", value: Math.pow(1024, 2), scientific: true }, Gi: { name: "Gi", value: Math.pow(1024, 3), scientific: true }, Ti: { name: "Ti", value: Math.pow(1024, 4), scientific: true }, Pi: { name: "Pi", value: Math.pow(1024, 5), scientific: true }, Ei: { name: "Ei", value: Math.pow(1024, 6), scientific: true }, Zi: { name: "Zi", value: Math.pow(1024, 7), scientific: true }, Yi: { name: "Yi", value: Math.pow(1024, 8), scientific: true } }, BINARY_LONG_SI: { "": { name: "", value: 1, scientific: true }, kilo: { name: "kilo", value: 1e3, scientific: true }, mega: { name: "mega", value: 1e6, scientific: true }, giga: { name: "giga", value: 1e9, scientific: true }, tera: { name: "tera", value: 1e12, scientific: true }, peta: { name: "peta", value: 1e15, scientific: true }, exa: { name: "exa", value: 1e18, scientific: true }, zetta: { name: "zetta", value: 1e21, scientific: true }, yotta: { name: "yotta", value: 1e24, scientific: true } }, BINARY_LONG_IEC: { "": { name: "", value: 1, scientific: true }, kibi: { name: "kibi", value: 1024, scientific: true }, mebi: { name: "mebi", value: Math.pow(1024, 2), scientific: true }, gibi: { name: "gibi", value: Math.pow(1024, 3), scientific: true }, tebi: { name: "tebi", value: Math.pow(1024, 4), scientific: true }, pebi: { name: "pebi", value: Math.pow(1024, 5), scientific: true }, exi: { name: "exi", value: Math.pow(1024, 6), scientific: true }, zebi: { name: "zebi", value: Math.pow(1024, 7), scientific: true }, yobi: { name: "yobi", value: Math.pow(1024, 8), scientific: true } }, BTU: { "": { name: "", value: 1, scientific: true }, MM: { name: "MM", value: 1e6, scientific: true } } }; _.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: true }, Hz: { name: "Hz", base: O.FREQUENCY, prefixes: _.SHORT, value: 1, offset: 0, reciprocal: true }, // 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; h10.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(", ")); }, h10.getUnitSystem = function() { for (var L in re) if (Fe(re, L) && re[L] === q) return L; }, h10.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; } }, h10.prototype._numberConverter = function() { var L = h10.typeConverters[this.valueType()]; if (L) return L; throw new TypeError('Unsupported Unit value type "' + this.valueType() + '"'); }, h10._getNumberConverter = function(L) { if (!h10.typeConverters[L]) throw new TypeError('Unsupported type "' + L + '"'); return h10.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; } h10.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 && !h10.isValidAlpha(g)) throw new Error('Invalid unit name (must begin with alpha character): "' + L + '"'); if (H > 0 && !(h10.isValidAlpha(g) || N(g))) throw new Error('Invalid unit name (only alphanumeric characters are allowed): "' + L + '"'); } } return h10.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) && h10.deleteUnit(ne), L[ne].aliases) for (var ie = 0; ie < L[ne].aliases.length; ie++) h10.deleteUnit(L[ne].aliases[ie]); } var me; for (var pe in L) Fe(L, pe) && (me = h10.createUnitSingle(pe, L[pe])); return me; }, h10.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 = h10.parse(pe, { allowNoUnits: true }); } 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 = false; for (var Ne in O) if (Fe(O, Ne)) { for (var we = true, Ee = 0; Ee < z.length; Ee++) if (Math.abs((J.dimensions[Ee] || 0) - (O[Ne].dimensions[Ee] || 0)) > 1e-12) { we = false; break; } if (we) { de = true, 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[""] }; } h10.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, h10.UNITS[ir] = Ue; } return delete B.cache, new h10(null, L); }, h10.deleteUnit = function(L) { delete h10.UNITS[L], delete B.cache; }, h10.PREFIXES = _, h10.BASE_DIMENSIONS = z, h10.BASE_UNITS = O, h10.UNIT_SYSTEMS = re, h10.UNITS = R, h10; }, { isClass: true }); var fm = "unit"; var a5 = ["typed", "Unit"]; var i5 = P(fm, a5, (e13) => { var { typed: r, Unit: t } = e13; return r(fm, { Unit: function(a) { return a.clone(); }, string: function(a) { return t.isValuelessUnit(a) ? new t(null, a) : t.parse(a, { allowNoUnits: true }); }, "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)) }); }); var dm = "sparse"; var o5 = ["typed", "SparseMatrix"]; var s5 = P(dm, o5, (e13) => { var { typed: r, SparseMatrix: t } = e13; 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); } }); }); var pm = "createUnit"; var u5 = ["typed", "Unit"]; var l5 = P(pm, u5, (e13) => { var { typed: r, Unit: t } = e13; 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, {}); } }); }); var mm = "acos"; var c5 = ["typed", "config", "Complex"]; var f5 = P(mm, c5, (e13) => { var { typed: r, config: t, Complex: n } = e13; 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(); } }); }); var vm = "acosh"; var d5 = ["typed", "config", "Complex"]; var p5 = P(vm, d5, (e13) => { var { typed: r, config: t, Complex: n } = e13; 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(); } }); }); var hm = "acot"; var m5 = ["typed", "BigNumber"]; var v5 = P(hm, m5, (e13) => { var { typed: r, BigNumber: t } = e13; return r(hm, { number: ty, Complex: function(a) { return a.acot(); }, BigNumber: function(a) { return new t(1).div(a).atan(); } }); }); var gm = "acoth"; var h5 = ["typed", "config", "Complex", "BigNumber"]; var g5 = P(gm, h5, (e13) => { var { typed: r, config: t, Complex: n, BigNumber: a } = e13; 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(); } }); }); var ym = "acsc"; var y5 = ["typed", "config", "Complex", "BigNumber"]; var b5 = P(ym, y5, (e13) => { var { typed: r, config: t, Complex: n, BigNumber: a } = e13; 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(); } }); }); var bm = "acsch"; var w5 = ["typed", "BigNumber"]; var x5 = P(bm, w5, (e13) => { var { typed: r, BigNumber: t } = e13; return r(bm, { number: iy, Complex: function(a) { return a.acsch(); }, BigNumber: function(a) { return new t(1).div(a).asinh(); } }); }); var wm = "asec"; var A5 = ["typed", "config", "Complex", "BigNumber"]; var N5 = P(wm, A5, (e13) => { var { typed: r, config: t, Complex: n, BigNumber: a } = e13; 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(); } }); }); var xm = "asech"; var D5 = ["typed", "config", "Complex", "BigNumber"]; var E5 = P(xm, D5, (e13) => { var { typed: r, config: t, Complex: n, BigNumber: a } = e13; 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(); } }); }); var Am = "asin"; var S5 = ["typed", "config", "Complex"]; var C5 = P(Am, S5, (e13) => { var { typed: r, config: t, Complex: n } = e13; 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(); } }); }); var M5 = "asinh"; var _5 = ["typed"]; var F5 = P(M5, _5, (e13) => { var { typed: r } = e13; return r("asinh", { number: uy, Complex: function(n) { return n.asinh(); }, BigNumber: function(n) { return n.asinh(); } }); }); var T5 = "atan"; var O5 = ["typed"]; var B5 = P(T5, O5, (e13) => { var { typed: r } = e13; return r("atan", { number: function(n) { return Math.atan(n); }, Complex: function(n) { return n.atan(); }, BigNumber: function(n) { return n.atan(); } }); }); var Nm = "atan2"; var $5 = ["typed", "matrix", "equalScalar", "BigNumber", "DenseMatrix", "concat"]; var I5 = P(Nm, $5, (e13) => { var { typed: r, matrix: t, equalScalar: n, BigNumber: a, DenseMatrix: i, concat: o } = e13, 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 })); }); var Dm = "atanh"; var R5 = ["typed", "config", "Complex"]; var P5 = P(Dm, R5, (e13) => { var { typed: r, config: t, Complex: n } = e13; 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(); } }); }); var mi = P("trigUnit", ["typed"], (e13) => { var { typed: r } = e13; 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); }) }; }); var Em = "cos"; var z5 = ["typed"]; var q5 = P(Em, z5, (e13) => { var { typed: r } = e13, t = mi({ typed: r }); return r(Em, { number: Math.cos, "Complex | BigNumber": (n) => n.cos() }, t); }); var Sm = "cosh"; var L5 = ["typed"]; var U5 = P(Sm, L5, (e13) => { var { typed: r } = e13; return r(Sm, { number: UC, "Complex | BigNumber": (t) => t.cosh() }); }); var Cm = "cot"; var k5 = ["typed", "BigNumber"]; var V5 = P(Cm, k5, (e13) => { var { typed: r, BigNumber: t } = e13, n = mi({ typed: r }); return r(Cm, { number: cy, Complex: (a) => a.cot(), BigNumber: (a) => new t(1).div(a.tan()) }, n); }); var Mm = "coth"; var H5 = ["typed", "BigNumber"]; var Z5 = P(Mm, H5, (e13) => { var { typed: r, BigNumber: t } = e13; return r(Mm, { number: fy, Complex: (n) => n.coth(), BigNumber: (n) => new t(1).div(n.tanh()) }); }); var _m = "csc"; var G5 = ["typed", "BigNumber"]; var W5 = P(_m, G5, (e13) => { var { typed: r, BigNumber: t } = e13, n = mi({ typed: r }); return r(_m, { number: dy, Complex: (a) => a.csc(), BigNumber: (a) => new t(1).div(a.sin()) }, n); }); var Fm = "csch"; var K5 = ["typed", "BigNumber"]; var J5 = P(Fm, K5, (e13) => { var { typed: r, BigNumber: t } = e13; return r(Fm, { number: py, Complex: (n) => n.csch(), BigNumber: (n) => new t(1).div(n.sinh()) }); }); var Tm = "sec"; var Y5 = ["typed", "BigNumber"]; var j5 = P(Tm, Y5, (e13) => { var { typed: r, BigNumber: t } = e13, n = mi({ typed: r }); return r(Tm, { number: my, Complex: (a) => a.sec(), BigNumber: (a) => new t(1).div(a.cos()) }, n); }); var Om = "sech"; var X5 = ["typed", "BigNumber"]; var Q5 = P(Om, X5, (e13) => { var { typed: r, BigNumber: t } = e13; return r(Om, { number: vy, Complex: (n) => n.sech(), BigNumber: (n) => new t(1).div(n.cosh()) }); }); var Bm = "sin"; var e8 = ["typed"]; var r8 = P(Bm, e8, (e13) => { var { typed: r } = e13, t = mi({ typed: r }); return r(Bm, { number: Math.sin, "Complex | BigNumber": (n) => n.sin() }, t); }); var $m = "sinh"; var t8 = ["typed"]; var n8 = P($m, t8, (e13) => { var { typed: r } = e13; return r($m, { number: hy, "Complex | BigNumber": (t) => t.sinh() }); }); var Im = "tan"; var a8 = ["typed"]; var i8 = P(Im, a8, (e13) => { var { typed: r } = e13, t = mi({ typed: r }); return r(Im, { number: Math.tan, "Complex | BigNumber": (n) => n.tan() }, t); }); var o8 = "tanh"; var s8 = ["typed"]; var u8 = P(o8, s8, (e13) => { var { typed: r } = e13; return r("tanh", { number: VC, "Complex | BigNumber": (t) => t.tanh() }); }); var Rm = "setCartesian"; var l8 = ["typed", "size", "subset", "compareNatural", "Index", "DenseMatrix"]; var c8 = P(Rm, l8, (e13) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i, DenseMatrix: o } = e13; 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); } }); }); var Pm = "setDifference"; var f8 = ["typed", "size", "subset", "compareNatural", "Index", "DenseMatrix"]; var d8 = P(Pm, f8, (e13) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i, DenseMatrix: o } = e13; 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 = false; for (var v = 0; v < d.length; v++) if (a(f[m].value, d[v].value) === 0 && f[m].identifier === d[v].identifier) { p = true; break; } p || c.push(f[m]); } } return Array.isArray(u) && Array.isArray(s) ? jo(c) : new o(jo(c)); } }); }); var zm = "setDistinct"; var p8 = ["typed", "size", "subset", "compareNatural", "Index", "DenseMatrix"]; var m8 = P(zm, p8, (e13) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i, DenseMatrix: o } = e13; 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); } }); }); var qm = "setIntersect"; var v8 = ["typed", "size", "subset", "compareNatural", "Index", "DenseMatrix"]; var h8 = P(qm, v8, (e13) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i, DenseMatrix: o } = e13; 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)); } }); }); var Lm = "setIsSubset"; var g8 = ["typed", "size", "subset", "compareNatural", "Index"]; var y8 = P(Lm, g8, (e13) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i } = e13; return r(Lm, { "Array | Matrix, Array | Matrix": function(l, u) { if (n(t(l), new i(0)) === 0) return true; if (n(t(u), new i(0)) === 0) return false; 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 = false; for (var p = 0; p < c.length; p++) if (a(s[d].value, c[p].value) === 0 && s[d].identifier === c[p].identifier) { f = true; break; } if (f === false) return false; } return true; } }); }); var Um = "setMultiplicity"; var b8 = ["typed", "size", "subset", "compareNatural", "Index"]; var w8 = P(Um, b8, (e13) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i } = e13; 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; } }); }); var km = "setPowerset"; var x8 = ["typed", "size", "subset", "compareNatural", "Index"]; var A8 = P(km, x8, (e13) => { var { typed: r, size: t, subset: n, compareNatural: a, Index: i } = e13; 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; } }); var Vm = "setSize"; var N8 = ["typed", "compareNatural"]; var D8 = P(Vm, N8, (e13) => { var { typed: r, compareNatural: t } = e13; 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 === false || 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; } }); }); var Hm = "setSymDifference"; var E8 = ["typed", "size", "concat", "subset", "setDifference", "Index"]; var S8 = P(Hm, E8, (e13) => { var { typed: r, size: t, concat: n, subset: a, setDifference: i, Index: o } = e13; 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)); } }); }); var Zm = "setUnion"; var C8 = ["typed", "size", "concat", "subset", "setIntersect", "setSymDifference", "Index"]; var M8 = P(Zm, C8, (e13) => { var { typed: r, size: t, concat: n, subset: a, setIntersect: i, setSymDifference: o, Index: l } = e13; 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)); } }); }); var Gm = "add"; var _8 = ["typed", "matrix", "addScalar", "equalScalar", "DenseMatrix", "SparseMatrix", "concat"]; var F8 = P(Gm, _8, (e13) => { var { typed: r, matrix: t, addScalar: n, equalScalar: a, DenseMatrix: i, SparseMatrix: o, concat: l } = e13, 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 })); }); var Wm = "hypot"; var T8 = ["typed", "abs", "addScalar", "divideScalar", "multiplyScalar", "sqrt", "smaller", "isPositive"]; var O8 = P(Wm, T8, (e13) => { var { typed: r, abs: t, addScalar: n, divideScalar: a, multiplyScalar: i, sqrt: o, smaller: l, isPositive: u } = e13; 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)); } }); var Km = "norm"; var B8 = ["typed", "abs", "add", "pow", "conj", "sqrt", "multiply", "equalScalar", "larger", "smaller", "matrix", "ctranspose", "eigs"]; var $8 = P(Km, B8, (e13) => { 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 } = e13; 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); }, true), E; } function v(D) { var E; return D.forEach(function(N) { var S = t(N); (!E || c(S, E)) && (E = S); }, true), 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); }, true), 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] = $; }, true), N; } function h10(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] = $; }, true), 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 h10(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"); } } }); var Jm = "dot"; var I8 = ["typed", "addScalar", "multiplyScalar", "conj", "size"]; var R8 = P(Jm, I8, (e13) => { var { typed: r, addScalar: t, multiplyScalar: n, conj: a, size: i } = e13; 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, h10 = t, x = n; if (m && b && m === b && typeof m == "string" && m !== "mixed") { var w = m; h10 = 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 = h10(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 = h10(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 = h10(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 = h10(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, h10 = 0, x = 0; h10 < d.length && x < m.length; ) { var w = d[h10], g = m[x]; if (w < g) { h10++; continue; } if (w > g) { x++; continue; } w === g && (b = y(b, A(p[h10], v[x])), h10++, x++); } return b; } function s(c) { return ze(c) ? c.size() : i(c); } }); var P8 = "trace"; var z8 = ["typed", "matrix", "add"]; var q8 = P(P8, z8, (e13) => { var { typed: r, matrix: t, add: n } = e13; 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) + ")"); } }); var Ym = "index"; var L8 = ["typed", "Index"]; var U8 = P(Ym, L8, (e13) => { var { typed: r, Index: t } = e13; 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; } }); }); var ky = /* @__PURE__ */ new Set(["end"]); var k8 = "Node"; var V8 = ["mathWithTransform"]; var H8 = P(k8, V8, (e13) => { var { mathWithTransform: r } = e13; 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 true; } /** * 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) : false; } /** * 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: true, isNode: true }); function lt(e13) { return e13 && e13.isIndexError ? new $t(e13.index + 1, e13.min + 1, e13.max !== void 0 ? e13.max + 1 : void 0) : e13; } function Vy(e13) { var { subset: r } = e13; 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"; var Z8 = ["subset", "Node"]; var G8 = P(vo, Z8, (e13) => { var { subset: r, Node: t } = e13, 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 true; } /** * 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: true, isNode: true }); var ho = "ArrayNode"; var W8 = ["Node"]; var K8 = P(ho, W8, (e13) => { var { Node: r } = e13; 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 true; } /** * 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, false); } } return Rr(t, "name", ho), t; }, { isClass: true, isNode: true }); function J8(e13) { var { subset: r, matrix: t } = e13; 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: false, latexRightParens: false, latexParens: false // 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: false, latexRightParens: false, latexParens: false // 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: false // 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(e13, r) { if (!r || r !== "auto") return e13; for (var t = e13; rn(t); ) t = t.content; return t; } function pr(e13, r, t, n) { var a = e13; r !== "keep" && (a = e13.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(e13, r) { var t = e13; r !== "keep" && (t = e13.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(e13, r, t) { var n = t !== "keep" ? e13.getContent() : e13, a = t !== "keep" ? e13.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 true; return false; } return null; } function Y8(e13) { var r = "OperatorNode:" + e13; for (var t of Pt) if (r in t) return t[r].op; return null; } var yo = "AssignmentNode"; var j8 = [ "subset", "?matrix", // FIXME: should not be needed at all, should be handled by subset "Node" ]; var X8 = P(yo, j8, (e13) => { var { subset: r, matrix: t, Node: n } = e13, 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 true; } /** * 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: true, isNode: true }); var bo = "BlockNode"; var Q8 = ["ResultSet", "Node"]; var e6 = P(bo, Q8, (e13) => { var { ResultSet: r, Node: t } = e13; 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 : true; 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 true; } /** * 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: true, isNode: true }); var wo = "ConditionalNode"; var r6 = ["Node"]; var t6 = P(wo, r6, (e13) => { var { Node: r } = e13; 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 false; 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 true; } /** * 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: true, isNode: true }); var Xu = Object.assign || function(e13) { for (var r = 1; r < arguments.length; r++) { var t = arguments[r]; for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e13[n] = t[n]); } return e13; }; var n6 = { "{": "\\{", "}": "\\}", "\\": "\\textbackslash{}", "#": "\\#", $: "\\$", "%": "\\%", "&": "\\&", "^": "\\textasciicircum{}", _: "\\_", "~": "\\textasciitilde{}" }; var a6 = { "–": "\\--", "—": "\\---", " ": "~", " ": "\\qquad{}", "\r\n": "\\newline{}", "\n": "\\newline{}" }; var i6 = function(r, t) { return Xu({}, r, t); }; var o6 = function(e13) { for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = r.preserveFormatting, n = t === void 0 ? false : t, a = r.escapeMapFn, i = a === void 0 ? i6 : a, o = String(e13), l = "", u = i(Xu({}, n6), n ? Xu({}, a6) : {}), s = Object.keys(u), c = function() { var d = false; 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 = true); }), d || (l += o.slice(0, 1), o = o.slice(1, o.length)); }; o; ) c(); return l; }; var s6 = 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{?}" }; var 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" }; var 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)" } }; var u6 = "\\mathrm{${name}}\\left(${args}\\right)"; var Xm = { deg: "^\\circ" }; function el(e13) { return s6(e13, { preserveFormatting: true }); } function Hy(e13, r) { return r = typeof r > "u" ? false : r, r ? Fe(Xm, e13) ? Xm[e13] : "\\mathrm{" + el(e13) + "}" : Fe(Qu, e13) ? Qu[e13] : el(e13); } var xo = "ConstantNode"; var l6 = ["Node"]; var c6 = P(xo, l6, (e13) => { var { Node: r } = e13; 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 true; } /** * 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: true, isNode: true }); var Ao = "FunctionAssignmentNode"; var f6 = ["typed", "Node"]; var d6 = P(Ao, f6, (e13) => { var { typed: r, Node: t } = e13; 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 true; } /** * 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] = true; }); 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 h10 = r(c, A); return h10.syntax = p, v.set(c, h10), h10; }; } /** * 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: true, isNode: true }); var No = "IndexNode"; var p6 = ["Node", "size"]; var m6 = P(No, p6, (e13) => { var { Node: r, size: t } = e13; 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 || false, !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 true; } /** * 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 = true; 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(), h10 = Object.create(b); return h10.end = A[c], p(v, h10, 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: true, isNode: true }); var Do = "ObjectNode"; var v6 = ["Node"]; var h6 = P(Do, v6, (e13) => { var { Node: r } = e13; 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 true; } /** * 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: true, isNode: true }); function Ei(e13, r) { return new P0(e13, new Cs(r), new Set(Object.keys(r))); } var Eo = "OperatorNode"; var g6 = ["Node"]; var y6 = P(Eo, g6, (e13) => { var { Node: r } = e13; function t(i, o) { var l = i; if (o === "auto") for (; rn(l); ) l = l.content; return nr(l) ? true : _r(l) ? t(l.args[0], o) : false; } 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 false; default: return true; } }); 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 === false) { d = [false]; break; } if (Pt[p][m].latexParens === false) { d = [false]; break; } } if (p === null) { d = [false]; break; } if (p <= c) { d = [true]; break; } d = [false]; } break; case 2: { var b, y = pr(u[0], o, l, i), A = vu(i, u[0], o); y === null ? b = false : y === c && f === "right" && !A || y < c ? b = true : b = false; var h10, x = pr(u[1], o, l, i), w = vu(i, u[1], o); if (x === null ? h10 = false : x === c && f === "left" && !w || x < c ? h10 = true : h10 = false, 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 === false && (b = false), Pt[y][D].latexParens === false && (b = false)), x !== null && (Pt[c][g].latexRightParens === false && (h10 = false), Pt[x][E].latexParens === false && (h10 = false)); } d = [b, h10]; } 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 ? false : c === M && f === $ && !F ? true : 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] = true); 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 === true, this.isPercentage = c === true, this.op = o, this.fn = l, this.args = u || []; } get type() { return Eo; } get isOperatorNode() { return true; } /** * 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 === true) { 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, false); 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, false); 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, true), 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 h10 = 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" ? h10.join("~") : h10.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: true, isNode: true }); var So = "ParenthesisNode"; var b6 = ["Node"]; var w6 = P(So, b6, (e13) => { var { Node: r } = e13; 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 true; } /** * 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: true, isNode: true }); var Co = "RangeNode"; var x6 = ["Node"]; var A6 = P(Co, x6, (e13) => { var { Node: r } = e13; 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 true; } /** * 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: true, isNode: true }); var Mo = "RelationalNode"; var N6 = ["Node"]; var D6 = P(Mo, N6, (e13) => { var { Node: r } = e13, 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 true; } /** * 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 false; } return true; }; } /** * 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: true, isNode: true }); var E6 = "SymbolNode"; var S6 = ["math", "?Unit", "Node"]; var C6 = P(E6, S6, (e13) => { var { math: r, Unit: t, Node: n } = e13; function a(o) { return t ? t.isValuelessUnit(o) : false; } 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 true; } /** * 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] === true) 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 = false; typeof r[this.name] > "u" && a(this.name) && (u = true); var s = Hy(this.name, u); return s[0] === "\\" ? s : " " + s; } } return i; }, { isClass: true, isNode: true }); var _o = "FunctionNode"; var M6 = ["math", "Node", "SymbolNode"]; var _6 = P(_o, M6, (e13) => { var r, { math: t, Node: n, SymbolNode: a } = e13, 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 true; } /** * 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 === true, 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 === true) 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), h10 = this.fn.index.getObjectProperty(), x = this.args; return function(N, S, M) { var F = A(N, S, M), $ = vC(F, h10); 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: true, isNode: true }); var Qm = "parse"; var F6 = ["typed", "numeric", "config", "AccessorNode", "ArrayNode", "AssignmentNode", "BlockNode", "ConditionalNode", "ConstantNode", "FunctionAssignmentNode", "FunctionNode", "IndexNode", "ObjectNode", "OperatorNode", "ParenthesisNode", "RangeNode", "RelationalNode", "SymbolNode"]; var T6 = P(Qm, F6, (e13) => { 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 } = e13, h10 = 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 = { ",": true, "(": true, ")": true, "[": true, "]": true, "{": true, "}": true, '"': true, "'": true, ";": true, "+": true, "-": true, "*": true, ".*": true, "/": true, "./": true, "%": true, "^": true, ".^": true, "~": true, "!": true, "&": true, "|": true, "^|": true, "=": true, ":": true, "?": true, "==": true, "!=": true, "<": true, ">": true, "<=": true, ">=": true, "<<": true, ">>": true, ">>>": true }, D = { mod: true, to: true, in: true, and: true, xor: true, or: true, not: true }, E = { true: true, false: false, 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 (h10.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 (h10.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); h10.isHexDigit($(T)); ) T.token += $(T), I(T); if ($(T) === ".") for (T.token += ".", I(T); h10.isHexDigit($(T)); ) T.token += $(T), I(T); else if ($(T) === "i") for (T.token += "i", I(T); h10.isDigit($(T)); ) T.token += $(T), I(T); return; } if ($(T) === ".") { if (T.token += $(T), I(T), !h10.isDigit($(T))) { T.tokenType = w.DELIMITER; return; } } else { for (; h10.isDigit($(T)); ) T.token += $(T), I(T); h10.isDecimalMark($(T), C(T)) && (T.token += $(T), I(T)); } for (; h10.isDigit($(T)); ) T.token += $(T), I(T); if ($(T) === "E" || $(T) === "e") { if (h10.isDigit(C(T)) || C(T) === "-" || C(T) === "+") { if (T.token += $(T), I(T), ($(T) === "+" || $(T) === "-") && (T.token += $(T), I(T)), !h10.isDigit($(T))) throw Ue(T, 'Digit expected, got "' + $(T) + '"'); for (; h10.isDigit($(T)); ) T.token += $(T), I(T); if (h10.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 (h10.isAlpha($(T), B(T), C(T))) { for (; h10.isAlpha($(T), B(T), C(T)) || h10.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--; } h10.isAlpha = function(Y, le, be) { return h10.isValidLatinOrGreek(Y) || h10.isValidMathSymbol(Y, be) || h10.isValidMathSymbol(le, Y); }, h10.isValidLatinOrGreek = function(Y) { return /^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(Y); }, h10.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); }, h10.isWhitespace = function(Y, le) { return Y === " " || Y === " " || Y === ` ` && le > 0; }, h10.isDecimalMark = function(Y, le) { return Y === "." && le !== "/" && le !== "*" && le !== "^"; }, h10.isDigitDot = function(Y) { return Y >= "0" && Y <= "9" || Y === "."; }, h10.isDigit = function(Y) { return Y >= "0" && Y <= "9"; }, h10.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 = true, le = [], Y = Ge.name, Ge.args.forEach(function(rt, vi) { $r(rt) ? le[vi] = rt.name : Pe = false; }), 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")], true) : (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], true /* 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)], false, true) : (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 = true; 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: h10 }), h10; }); var ev = "compile"; var O6 = ["typed", "parse"]; var B6 = P(ev, O6, (e13) => { var { typed: r, parse: t } = e13; return r(ev, { string: function(a) { return t(a).compile(); }, "Array | Matrix": function(a) { return je(a, function(i) { return t(i).compile(); }); } }); }); var rv = "evaluate"; var $6 = ["typed", "parse"]; var I6 = P(rv, $6, (e13) => { var { typed: r, parse: t } = e13; 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); }); } }); }); var R6 = "Parser"; var P6 = ["evaluate", "parse"]; var z6 = P(R6, P6, (e13) => { var { evaluate: r, parse: t } = e13; function n() { if (!(this instanceof n)) throw new SyntaxError("Constructor must be called with the new operator"); Object.defineProperty(this, "scope", { value: Ii(), writable: false }); } n.prototype.type = "Parser", n.prototype.isParser = true, 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 false; 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 false; } return true; } 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: true }); var tv = "parser"; var q6 = ["typed", "Parser"]; var L6 = P(tv, q6, (e13) => { var { typed: r, Parser: t } = e13; return r(tv, { "": function() { return new t(); } }); }); var nv = "lup"; var U6 = ["typed", "matrix", "abs", "addScalar", "divideScalar", "multiplyScalar", "subtractScalar", "larger", "equalScalar", "unaryMinus", "DenseMatrix", "SparseMatrix", "Spa"]; var k6 = P(nv, U6, (e13) => { 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 } = e13; return r(nv, { DenseMatrix: function(y) { return m(y); }, SparseMatrix: function(y) { return v(y); }, Array: function(y) { var A = t(y), h10 = m(A); return { L: h10.L.valueOf(), U: h10.U.valueOf(), p: h10.p }; } }); function m(b) { var y = b._size[0], A = b._size[1], h10 = Math.min(y, A), x = qe(b._data), w = [], g = [y, h10], D = [], E = [h10, 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, h10 = F.length; N < h10; 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], h10 = Math.min(y, A), x = b._values, w = b._index, g = b._ptr, D = [], E = [], N = [], S = [y, h10], M = [], F = [], $ = [], I = [h10, 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; } }; } }); var av = "qr"; var V6 = ["typed", "matrix", "zeros", "identity", "isZero", "equal", "sign", "sqrt", "conj", "unaryMinus", "addScalar", "divideScalar", "multiplyScalar", "subtractScalar", "complex"]; var H6 = P(av, V6, (e13) => { 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 } = e13; 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(h10) { var x = h10._size[0], w = h10._size[1], g = a([x], "dense"), D = g._data, E = h10.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(h10) { var x = b(h10), w = x.R._data; if (h10._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(h10) { throw new Error("qr not implemented for sparse matrices yet"); } }); function Z6(e13, r, t, n) { e13._values; for (var a = e13._index, i = e13._ptr, o = e13._size, l = e13._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 h10 = a[A]; f[p] = h10, p++; } } return d[s] = p, e13.createSparseMatrix({ values: c, index: f, ptr: d, size: [u, s], datatype: l }); } function Zy(e13, r, t, n, a, i, o) { var l = 0; for (t[o] = e13; 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(e13, r) { if (!e13) 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--) e13[n] !== -1 && (i[l + n] = i[o + e13[n]], i[o + e13[n]] = n); for (n = 0; n < r; n++) e13[n] === -1 && (t = Zy(n, t, i, o, l, a, u)); return a; } function W6(e13, r) { if (!e13) return null; var t = e13._index, n = e13._ptr, a = e13._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(e13, r, t) { for (var n = e13._values, a = e13._index, i = e13._ptr, o = e13._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(e13) { return -e13 - 2; } var J6 = "csAmd"; var Y6 = ["add", "multiply", "transpose"]; var j6 = P(J6, Y6, (e13) => { var { add: r, multiply: t, transpose: n } = e13; 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, h10 = y._ptr, x = h10[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, h10, g, D, S, B, N, I, E, $, M, F), _ = o(m, h10, 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 = h10[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 = h10[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 && (h10[Q] = qn(X), g[$ + Q] = 0); } for (L !== 0 && (x = pe), g[F + X] = ne, h10[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 = h10[O], j = h10[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 = h10[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) : (h10[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 ? (h10[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 = h10[O] + 1; ie <= h10[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 = h10[W] + 1; fe && ie <= h10[W] + re - 1; ie++) g[$ + A[ie]] !== C && (fe = 0); fe ? (h10[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 && (h10[X] = -1, g[$ + X] = 0), L !== 0 && (x = ie); } for (O = 0; O < m; O++) h10[O] = qn(h10[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 + h10[W]], g[S + h10[W]] = W); for (Q = m; Q >= 0; Q--) g[E + Q] <= 0 || h10[Q] !== -1 && (g[N + Q] = g[S + h10[Q]], g[S + h10[Q]] = Q); for (X = 0, O = 0; O <= m; O++) h10[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 h10 = b[A]; if (b[A] = y, !(b[A + 1] - h10 > p)) for (var x = b[A + 1]; h10 < x; h10++) v[y++] = v[h10]; } 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, h10, 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[h10 + g] = 0, f[x + g] = f[d + g]; var D = l(0, 0, f, A, s); return f[h10 + s] = -2, c[s] = -1, f[A + s] = 0, D; } function o(s, c, f, d, p, m, v, b, y, A, h10) { 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[h10 + 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(e13, r, t, n, a, i, o) { var l, u, s = 0, c; if (e13 <= r || t[n + r] <= t[a + e13]) return -1; t[a + e13] = t[n + r]; var f = t[i + e13]; if (t[i + e13] = r, f === -1) s = 1, c = e13; 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"; var e$ = ["transpose"]; var r$ = P(Q6, e$, (e13) => { var { transpose: r } = e13; 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, h10 = 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, h10, 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; }; }); var t$ = "csSqr"; var n$ = ["add", "multiply", "transpose"]; var a$ = P(t$, n$, (e13) => { var { add: r, multiply: t, transpose: n } = e13, 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, h10 = d, x = d + p, w = d + 2 * p, g, D, E, N, S; for (D = 0; D < p; D++) y[h10 + 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[h10 + D], y[h10 + D] = g); for (u.lnz = 0, u.m2 = d, D = 0; D < p; D++) if (g = y[h10 + 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[h10 + M], y[h10 + M] = y[A + g], y[w + M] += y[w + D]); } for (g = 0; g < d; g++) v[g] < 0 && (v[g] = D++); return true; } }); function rl(e13, r) { return e13[r] < 0; } function Gy(e13, r) { e13[r] = qn(e13[r]); } function iv(e13) { return e13 < 0 ? qn(e13) : e13; } function i$(e13, 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] = e13; d >= 0; ) { e13 = n[d]; var p = a ? a[e13] : e13; rl(o, e13) || (Gy(o, e13), 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] = e13); } return t; } function o$(e13, r, t, n, a) { var i = e13._ptr, o = e13._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, e13, p, n, a)); } for (c = p; c < s; c++) Gy(i, n[c]); return p; } var s$ = "csSpsolve"; var u$ = ["divideScalar", "multiply", "subtract"]; var l$ = P(s$, u$, (e13) => { var { divideScalar: r, multiply: t, subtract: n } = e13; 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, h10 = 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 = h10[l], g = h10[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; }; }); var c$ = "csLu"; var f$ = ["abs", "divideScalar", "multiply", "subtract", "larger", "largerEq", "SparseMatrix"]; var d$ = P(c$, f$, (e13) => { var { abs: r, divideScalar: t, multiply: n, subtract: a, larger: i, largerEq: o, SparseMatrix: l } = e13, 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 = [], h10 = [], x = [], w = new l({ values: A, index: h10, 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, h10[b] = z, A[b++] = 1, F = _; F < m; F++) M = I[F], S[M] < 0 && (h10[b] = M, A[b++] = t($[M], X)), $[M] = 0; } for (x[m] = b, E[m] = y, F = 0; F < b; F++) h10[F] = S[h10[F]]; return A.splice(b, A.length - b), h10.splice(b, h10.length - b), g.splice(y, g.length - y), D.splice(y, D.length - y), { L: w, U: N, pinv: S }; }; }); var ov = "slu"; var p$ = ["typed", "abs", "add", "multiply", "transpose", "divideScalar", "subtract", "larger", "largerEq", "SparseMatrix"]; var m$ = P(ov, p$, (e13) => { var { typed: r, abs: t, add: n, multiply: a, transpose: i, divideScalar: o, subtract: l, larger: u, largerEq: s, SparseMatrix: c } = e13, 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, false), 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(e13, r) { var t, n = r.length, a = []; if (e13) for (t = 0; t < n; t++) a[e13[t]] = r[t]; else for (t = 0; t < n; t++) a[t] = r[t]; return a; } var uv = "lusolve"; var v$ = ["typed", "matrix", "lup", "slu", "usolve", "lsolve", "DenseMatrix"]; var h$ = P(uv, v$, (e13) => { var { typed: r, matrix: t, lup: n, slu: a, usolve: i, lsolve: o, DenseMatrix: l } = e13, 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, true), v._data = sv(p, v._data)); var b = o(f, v), y = i(d, b); return m && (y._data = sv(m, y._data)), y; } }); var lv = "polynomialRoot"; var g$ = ["typed", "isZero", "equalScalar", "add", "subtract", "multiply", "divide", "sqrt", "unaryMinus", "cbrt", "typeOf", "im", "re"]; var y$ = P(lv, g$, (e13) => { 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 } = e13; 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, h10] = b, x = o(2, h10), w = o(A, A), g = o(4, h10, 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 = true, 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)); } } }); }); var b$ = "Help"; var w$ = ["evaluate"]; var x$ = P(b$, w$, (e13) => { var { evaluate: r } = e13; 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 = true, 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 = false, o = r("config()"), l = { config: (f) => (i = true, 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: true }); var A$ = "Chain"; var N$ = ["?on", "math", "typed"]; var D$ = P(A$, N$, (e13) => { var { on: r, math: t, typed: n } = e13; 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 = true, 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: true, docs: true, type: true, classes: true, json: true, error: true, isChain: true // 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: true }); var 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"] }; var E$ = { name: "false", category: "Constants", syntax: ["false"], description: "Boolean value false", examples: ["false"], seealso: ["true"] }; var 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: [] }; var 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: [] }; var M$ = { name: "LN10", category: "Constants", syntax: ["LN10"], description: "Returns the natural logarithm of 10, approximately equal to 2.302", examples: ["LN10", "log(10)"], seealso: [] }; var _$ = { name: "LN2", category: "Constants", syntax: ["LN2"], description: "Returns the natural logarithm of 2, approximately equal to 0.693", examples: ["LN2", "log(2)"], seealso: [] }; var 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: [] }; var 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: [] }; var O$ = { name: "NaN", category: "Constants", syntax: ["NaN"], description: "Not a number", examples: ["NaN", "0 / 0"], seealso: [] }; var B$ = { name: "null", category: "Constants", syntax: ["null"], description: "Value null", examples: ["null"], seealso: ["true", "false"] }; var $$ = { 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: [] }; var 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"] }; var 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: [] }; var R$ = { name: "SQRT2", category: "Constants", syntax: ["SQRT2"], description: "Returns the square root of 2, approximately equal to 1.414", examples: ["SQRT2", "sqrt(2)"], seealso: [] }; var 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"] }; var z$ = { name: "true", category: "Constants", syntax: ["true"], description: "Boolean value true", examples: ["true"], seealso: ["false"] }; var q$ = { name: "version", category: "Constants", syntax: ["version"], description: "A string with the version number of math.js", examples: ["version"], seealso: [] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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: [] }; var 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: [] }; var 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: [] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var b9 = { name: "abs", category: "Arithmetic", syntax: ["abs(x)"], description: "Compute the absolute value.", examples: ["abs(3.5)", "abs(-4.2)"], seealso: ["sign"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var _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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var $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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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")'] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var nI = { name: "unaryPlus", category: "Operators", syntax: ["+x", "unaryPlus(x)"], description: "Converts booleans and strings to numbers.", examples: ["+true", '+"2"'], seealso: ["add", "subtract", "unaryMinus"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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: [] }; var 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: [] }; var 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: [] }; var 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: [] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var _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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var $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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var fR = { name: "fft", category: "Matrix", syntax: ["fft(x)"], description: "Calculate N-dimensional Fourier transform", examples: ["fft([[1, 0], [1, 0]])"], seealso: ["ifft"] }; var dR = { name: "ifft", category: "Matrix", syntax: ["ifft(x)"], description: "Calculate N-dimensional inverse Fourier transform", examples: ["ifft([[2, 2], [0, 0]])"], seealso: ["fft"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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: [] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var _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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var $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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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: [] }; var 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: [] }; var 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: [] }; var 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: [] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var vP = { name: "asech", category: "Trigonometry", syntax: ["asech(x)"], description: "Calculate the inverse secant of a value.", examples: ["asech(0.5)"], seealso: ["acsch", "acoth"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var _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"] }; var FP = { name: "sinh", category: "Trigonometry", syntax: ["sinh(x)"], description: "Compute the hyperbolic sine of x in radians.", examples: ["sinh(0.5)"], seealso: ["cosh", "tanh"] }; var 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"] }; var 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"] }; var 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: [] }; var $P = { name: "bin", category: "Utils", syntax: ["bin(value)"], description: "Format a number as binary", examples: ["bin(2)"], seealso: ["oct", "hex"] }; var 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: [] }; var 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"] }; var 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"] }; var zP = { name: "hex", category: "Utils", syntax: ["hex(value)"], description: "Format a number as hexadecimal", examples: ["hex(240)"], seealso: ["bin", "oct"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var 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"] }; var WP = { name: "oct", category: "Utils", syntax: ["oct(value)"], description: "Format a number as octal", examples: ["oct(56)"], seealso: ["bin", "hex"] }; var 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"] }; var 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"] }; var 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"] }; var 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 }; var dv = "help"; var XP = ["typed", "mathWithTransform", "Help"]; var QP = P(dv, XP, (e13) => { var { typed: r, mathWithTransform: t, Help: n } = e13; 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); } }); }); var pv = "chain"; var e7 = ["typed", "Chain"]; var r7 = P(pv, e7, (e13) => { var { typed: r, Chain: t } = e13; return r(pv, { "": function() { return new t(); }, any: function(a) { return new t(a); } }); }); var mv = "det"; var t7 = ["typed", "matrix", "subtractScalar", "multiply", "divideScalar", "isZero", "unaryMinus"]; var n7 = P(mv, t7, (e13) => { var { typed: r, matrix: t, subtractScalar: n, multiply: a, divideScalar: i, isZero: o, unaryMinus: l } = e13; 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 = false, 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], h10 = m + 1; h10 < c; h10++) for (var x = p[h10], 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; } }); var vv = "inv"; var a7 = ["typed", "matrix", "divideScalar", "addScalar", "multiply", "unaryMinus", "det", "identity", "abs"]; var i7 = P(vv, a7, (e13) => { var { typed: r, matrix: t, divideScalar: n, addScalar: a, multiply: i, unaryMinus: o, det: l, identity: u, abs: s } = e13; 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 h10 = l(f); if (h10 === 0) throw Error("Cannot calculate inverse, determinant is zero"); return [[n(f[1][1], h10), n(o(f[0][1]), h10)], [n(o(f[1][0]), h10), n(f[0][0], h10)]]; } 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; } } }); var hv = "pinv"; var o7 = ["typed", "matrix", "inv", "deepEqual", "equal", "dotDivide", "dot", "ctranspose", "divideScalar", "multiply", "add", "Complex"]; var s7 = P(hv, o7, (e13) => { 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 } = e13; return r(hv, { "Array | Matrix": function(h10) { var x = ze(h10) ? h10.size() : ke(h10); switch (x.length) { case 1: return y(h10) ? u(h10) : x[0] === 1 ? n(h10) : o(u(h10), l(h10, h10)); case 2: { if (y(h10)) return u(h10); var w = x[0], g = x[1]; if (w === g) try { return n(h10); } catch (D) { if (!(D instanceof Error && D.message.match(/Cannot calculate inverse, determinant is zero/))) throw D; } return ze(h10) ? t(p(h10.valueOf(), w, g), h10.storage()) : p(h10, w, g); } default: throw new RangeError("Matrix must be two dimensional (size: " + Qe(x) + ")"); } }, any: function(h10) { return i(h10, 0) ? qe(h10) : s(1, h10); } }); function p(A, h10, x) { var { C: w, F: g } = v(A, h10, 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, h10, x) { for (var w = qe(A), g = 0, D = 0; D < h10; D++) { if (x <= g) return w; for (var E = D; b(w[E][g]); ) if (E++, h10 === 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 < h10; 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, h10, x) { var w = m(A, h10, x), g = A.map((E, N) => E.filter((S, M) => M < h10 && !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(e13) { 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: h10, smaller: x, matrixFromColumns: w, dot: g } = e13; function D(V, R, Q, se) { var re = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true, 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 = false; !L; ) { L = true; 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 (; h10(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 = false; 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 (h10(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 (h10(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(e13) { 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 } = e13; 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 = h10(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 h10(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"; var 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"]; var d7 = P(c7, f7, (e13) => { 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: h10, 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: _ } = e13, 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: h10, 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: true }); }, "Matrix, number|BigNumber": function(q, Z) { return W(q, { precision: Z, matricize: true }); }, "Matrix, Object": function(q, Z) { var K = { matricize: true }; 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 : true, 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: false, // 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 false; return true; } 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 false; return true; } 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 = false, ee = false, te = false, oe = 0; oe < Z; oe++) for (var ge = 0; ge < Z; ge++) { var L = q[oe][ge]; if (We(L) || Aa(L)) j = true; else if (Ze(L)) ee = true; else if (Ut(L)) te = true; 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."); } }); var gv = "expm"; var p7 = ["typed", "abs", "add", "identity", "inv", "multiply"]; var m7 = P(gv, p7, (e13) => { var { typed: r, abs: t, add: n, identity: a, inv: i, multiply: o } = e13; 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, h10 = o(f, Math.pow(2, -A)), x = a(p), w = a(p), g = 1, D = h10, E = -1, N = 1; N <= y; N++) N > 1 && (D = o(D, h10), 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); } }); var yv = "sqrtm"; var v7 = ["typed", "abs", "add", "multiply", "map", "sqrt", "subtract", "inv", "size", "max", "identity"]; var h7 = P(yv, v7, (e13) => { var { typed: r, abs: t, add: n, multiply: a, map: i, sqrt: o, subtract: l, inv: u, size: s, max: c, identity: f } = e13, d = 1e3, p = 1e-6; function m(v) { var b, y = 0, A = v, h10 = f(s(v)); do { var x = A; if (A = a(0.5, n(x, u(h10))), h10 = a(0.5, n(h10, 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], h10 = y[1]; if (A === h10) 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) + ")"); } } }); }); var bv = "sylvester"; var g7 = ["typed", "schur", "matrixFromColumns", "matrix", "multiply", "range", "concat", "transpose", "index", "subset", "add", "subtract", "identity", "lusolve", "abs"]; var y7 = P(bv, g7, (e13) => { 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 } = e13; return r(bv, { "Matrix, Matrix, Matrix": b, "Array, Matrix, Matrix": function(A, h10, x) { return b(a(A), h10, x); }, "Array, Array, Matrix": function(A, h10, x) { return b(a(A), a(h10), x); }, "Array, Matrix, Array": function(A, h10, x) { return b(a(A), h10, a(x)); }, "Matrix, Array, Matrix": function(A, h10, x) { return b(A, a(h10), x); }, "Matrix, Array, Array": function(A, h10, x) { return b(A, a(h10), a(x)); }, "Matrix, Matrix, Array": function(A, h10, x) { return b(A, h10, a(x)); }, "Array, Array, Array": function(A, h10, x) { return b(a(A), a(h10), a(x)).toArray(); } }); function b(y, A, h10) { 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), h10), 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; } }); var wv = "schur"; var b7 = ["typed", "matrix", "identity", "multiply", "qr", "norm", "subtract"]; var w7 = P(wv, b7, (e13) => { var { typed: r, matrix: t, identity: n, multiply: a, qr: i, norm: o, subtract: l } = e13; 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 }; } }); var xv = "lyap"; var x7 = ["typed", "matrix", "sylvester", "multiply", "transpose"]; var A7 = P(xv, x7, (e13) => { var { typed: r, matrix: t, sylvester: n, multiply: a, transpose: i } = e13; 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(); } }); }); var N7 = "divide"; var D7 = ["typed", "matrix", "multiply", "equalScalar", "divideScalar", "inv"]; var E7 = P(N7, D7, (e13) => { var { typed: r, matrix: t, multiply: n, equalScalar: a, divideScalar: i, inv: o } = e13, 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, false); }, "SparseMatrix, any": function(c, f) { return l(c, f, i, false); }, "Array, any": function(c, f) { return u(t(c), f, i, false).valueOf(); }, "any, Array | Matrix": function(c, f) { return n(c, o(f)); } }, i.signatures)); }); var Av = "distance"; var S7 = ["typed", "addScalar", "subtractScalar", "divideScalar", "multiplyScalar", "deepEqual", "sqrt", "abs"]; var C7 = P(Av, S7, (e13) => { var { typed: r, addScalar: t, subtractScalar: n, multiplyScalar: a, divideScalar: i, deepEqual: o, sqrt: l, abs: u } = e13; 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 h10(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 false; } 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 false; } else return false; return true; } 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 h10(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; } }); var M7 = "intersect"; var _7 = ["typed", "config", "abs", "add", "addScalar", "matrix", "multiply", "multiplyScalar", "divideScalar", "subtract", "smaller", "equalScalar", "flatten", "isZero", "isNumeric"]; var F7 = P(M7, _7, (e13) => { 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 } = e13; 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 (!h10(S)) throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument"); if (!h10(M)) throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument"); if (!h10(F)) throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument"); if (!h10($)) 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 h10(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]; } }); var Nv = "sum"; var T7 = ["typed", "config", "add", "numeric"]; var Wy = P(Nv, T7, (e13) => { var { typed: r, config: t, add: n, numeric: a } = e13; 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"); } } }); var Fo = "cumsum"; var O7 = ["typed", "add", "unaryPlus"]; var Ky = P(Fo, O7, (e13) => { var { typed: r, add: t, unaryPlus: n } = e13; 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; } } }); var Dv = "mean"; var B7 = ["typed", "add", "divide"]; var Jy = P(Dv, B7, (e13) => { var { typed: r, add: t, divide: n } = e13; 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); } }); var Ev = "median"; var $7 = ["typed", "add", "divide", "compare", "partitionSelect"]; var I7 = P(Ev, $7, (e13) => { var { typed: r, add: t, divide: n, compare: a, partitionSelect: i } = e13; 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); } }); }); var Sv = "mad"; var R7 = ["typed", "abs", "map", "median", "subtract"]; var P7 = P(Sv, R7, (e13) => { var { typed: r, abs: t, map: n, median: a, subtract: i } = e13; 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"); } } }); var hu = "unbiased"; var Cv = "variance"; var z7 = ["typed", "add", "subtract", "multiply", "divide", "apply", "isNaN"]; var Yy = P(Cv, z7, (e13) => { var { typed: r, add: t, subtract: n, multiply: a, divide: i, apply: o, isNaN: l } = e13; 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"); } } }); var Mv = "quantileSeq"; var q7 = ["typed", "?bignumber", "add", "subtract", "divide", "multiply", "partitionSelect", "compare", "isInteger", "smaller", "smallerEq", "larger"]; var jy = P(Mv, q7, (e13) => { 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 } = e13, p = Wl({ typed: r, isInteger: s }); return r(Mv, { "Array | Matrix, number | BigNumber": (A, h10) => v(A, h10, false), "Array | Matrix, number | BigNumber, number": (A, h10, x) => m(A, h10, false, x, v), "Array | Matrix, number | BigNumber, boolean": v, "Array | Matrix, number | BigNumber, boolean, number": (A, h10, x, w) => m(A, h10, x, w, v), "Array | Matrix, Array | Matrix": (A, h10) => b(A, h10, false), "Array | Matrix, Array | Matrix, number": (A, h10, x) => m(A, h10, false, x, b), "Array | Matrix, Array | Matrix, boolean": b, "Array | Matrix, Array | Matrix, boolean, number": (A, h10, x, w) => m(A, h10, x, w, b) }); function m(A, h10, x, w, g) { return p(A, w, (D) => g(D, h10, x)); } function v(A, h10, x) { var w, g = A.valueOf(); if (c(h10, 0)) throw new Error("N/prob must be non-negative"); if (f(h10, 1)) return We(h10) ? y(g, h10, x) : t(y(g, h10, x)); if (d(h10, 1)) { if (!s(h10)) throw new Error("N must be a positive integer"); if (d(h10, 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(h10, 1); w = []; for (var E = 0; c(E, h10); E++) { var N = i(E + 1, D); w.push(y(g, N, x)); } return We(h10) ? w : t(w); } } function b(A, h10, x) { for (var w = A.valueOf(), g = h10.valueOf(), D = [], E = 0; E < g.length; ++E) D.push(y(w, g[E], x)); return D; } function y(A, h10, x) { var w = sr(A), g = w.length; if (g === 0) throw new Error("Cannot calculate quantile of an empty sequence"); var D = We(h10) ? h10 * (g - 1) : h10.times(g - 1), E = We(h10) ? Math.floor(D) : D.floor().toNumber(), N = We(h10) ? D % 1 : D.minus(E); if (s(D)) return x ? w[D] : l(w, We(h10) ? 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)); } }); var _v = "std"; var L7 = ["typed", "map", "sqrt", "variance"]; var Xy = P(_v, L7, (e13) => { var { typed: r, map: t, sqrt: n, variance: a } = e13; 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; } } }); var Fv = "corr"; var U7 = ["typed", "matrix", "mean", "sqrt", "sum", "add", "subtract", "multiply", "pow", "divide"]; var k7 = P(Fv, U7, (e13) => { var { typed: r, matrix: t, sqrt: n, sum: a, add: i, subtract: o, multiply: l, pow: u, divide: s } = e13; 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))), h10 = 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, h10), u(b, 2)))); return s(x, w); } }); var Tv = "combinations"; var V7 = ["typed"]; var H7 = P(Tv, V7, (e13) => { var { typed: r } = e13; 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(e13) { return e13.isInteger() && e13.gte(0); } var Bv = "combinationsWithRep"; var Z7 = ["typed"]; var G7 = P(Bv, Z7, (e13) => { var { typed: r } = e13; 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(e13) { return e13.isInteger() && e13.gte(0); } var Iv = "gamma"; var W7 = ["typed", "config", "multiplyScalar", "pow", "BigNumber", "Complex"]; var K7 = P(Iv, W7, (e13) => { var { typed: r, config: t, multiplyScalar: n, pow: a, BigNumber: i, Complex: o } = e13; 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)); } }); var Rv = "lgamma"; var J7 = ["Complex", "typed"]; var Y7 = P(Rv, J7, (e13) => { var { Complex: r, typed: t } = e13, 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 h10 = f.mul(d.mul(p).add(m)); return c.add(h10); } 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)); } }); var Pv = "factorial"; var j7 = ["typed", "gamma"]; var X7 = P(Pv, j7, (e13) => { var { typed: r, gamma: t } = e13; 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)) }); }); var zv = "kldivergence"; var Q7 = ["typed", "matrix", "divide", "sum", "multiply", "map", "dotDivide", "log", "isNumeric"]; var ez = P(zv, Q7, (e13) => { var { typed: r, matrix: t, divide: n, sum: a, multiply: i, map: o, dotDivide: l, log: u, isNumeric: s } = e13; 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)), h10 = a(i(y, o(l(y, A), (x) => u(x)))); return s(h10) ? h10 : Number.NaN; } }); var qv = "multinomial"; var rz = ["typed", "add", "divide", "multiply", "factorial", "isInteger", "isPositive"]; var tz = P(qv, rz, (e13) => { var { typed: r, add: t, divide: n, multiply: a, factorial: i, isInteger: o, isPositive: l } = e13; 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); } }); }); var Lv = "permutations"; var nz = ["typed", "factorial"]; var az = P(Lv, nz, (e13) => { var { typed: r, factorial: t } = e13; 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(e13) { return e13.isInteger() && e13.gte(0); } var ec = { exports: {} }; ec.exports; (function(e13) { (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, e13 ); })(ec); var iz = ec.exports; var rc = { exports: {} }; rc.exports; (function(e13) { (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, e13 ); })(rc); var oz = rc.exports; var tc = { exports: {} }; tc.exports; (function(e13) { (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, e13 ); })(tc); var sz = tc.exports; var nc = { exports: {} }; nc.exports; (function(e13) { (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, e13 ); })(nc); var uz = nc.exports; var ac = { exports: {} }; ac.exports; (function(e13) { (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 e13 ); })(ac); var lz = ac.exports; var ic = { exports: {} }; ic.exports; (function(e13) { (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, e13 ); })(ic); var cz = ic.exports; var Qy = { exports: {} }; var fz = {}; var dz = Object.freeze(Object.defineProperty({ __proto__: null, default: fz }, Symbol.toStringTag, { value: "Module" })); var pz = iS(dz); (function(e13) { (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 == true ? { entropy: true } : w || {}; var E = y(b( w.entropy ? [x, h10(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(h10(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 h10(w); } function A() { try { var x; return d && (x = d.randomBytes) ? x = x(a) : (x = new Uint8Array(a), (r.crypto || r.msCrypto).getRandomValues(x)), h10(x); } catch { var w = r.navigator, g = w && w.plugins; return [+/* @__PURE__ */ new Date(), r, g, r.screen, h10(t)]; } } function h10(x) { return String.fromCharCode.apply(0, x); } if (y(n.random(), t), e13.exports) { e13.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; var vz = iz; var hz = oz; var gz = sz; var yz = uz; var bz = lz; var wz = cz; var Ea = mz; Ea.alea = vz; Ea.xor128 = hz; Ea.xorwow = gz; Ea.xorshift7 = yz; Ea.xor4096 = bz; Ea.tychei = wz; var xz = Ea; var e1 = Es(xz); var Az = e1(Date.now()); function ni(e13) { var r; function t(a) { r = a === null ? Az : e1(String(a)); } t(e13); function n() { return r(); } return n; } var kv = "pickRandom"; var Nz = ["typed", "config", "?on"]; var Dz = P(kv, Nz, (e13) => { var { typed: r, config: t, on: n } = e13, 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 = true } = 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 === true && (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 h10 = a() * p, x = 0, w = o.length; x < w; x++) if (h10 -= s[x], h10 < 0) { A = o[x]; break; } y.push(A); } return f ? y[0] : d ? d(y) : y; } }); function oc(e13, r) { var t = []; if (e13 = e13.slice(0), e13.length > 1) for (var n = 0, a = e13.shift(); n < a; n++) t.push(oc(e13, r)); else for (var i = 0, o = e13.shift(); i < o; i++) t.push(r()); return t; } var Vv = "random"; var Ez = ["typed", "config", "?on"]; var Sz = P(Vv, Ez, (e13) => { var { typed: r, config: t, on: n } = e13, 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); } }); var Hv = "randomInt"; var Cz = ["typed", "config", "?on"]; var Mz = P(Hv, Cz, (e13) => { var { typed: r, config: t, on: n } = e13, 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)); } }); var Zv = "stirlingS2"; var _z = ["typed", "addScalar", "subtractScalar", "multiplyScalar", "divideScalar", "pow", "factorial", "combinations", "isNegative", "isInteger", "number", "?bignumber", "larger"]; var Fz = P(Zv, _z, (e13) => { 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 } = e13, 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 h10 = !(We(y) && We(A)), x = h10 ? v : m, w = h10 ? 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]; } }); }); var Gv = "bellNumbers"; var Tz = ["typed", "addScalar", "isNegative", "isInteger", "stirlingS2"]; var Oz = P(Gv, Tz, (e13) => { var { typed: r, addScalar: t, isNegative: n, isInteger: a, stirlingS2: i } = e13; 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; } }); }); var Wv = "catalan"; var Bz = ["typed", "addScalar", "divideScalar", "multiplyScalar", "combinations", "isNegative", "isInteger"]; var $z = P(Wv, Bz, (e13) => { var { typed: r, addScalar: t, divideScalar: n, multiplyScalar: a, combinations: i, isNegative: o, isInteger: l } = e13; 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)); } }); }); var Kv = "composition"; var Iz = ["typed", "addScalar", "combinations", "isNegative", "isPositive", "isInteger", "larger"]; var Rz = P(Kv, Iz, (e13) => { var { typed: r, addScalar: t, combinations: n, isPositive: a, isNegative: i, isInteger: o, larger: l } = e13; 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)); } }); }); var Jv = "leafCount"; var Pz = ["parse", "typed"]; var zz = P(Jv, Pz, (e13) => { var { parse: r, typed: t } = e13; 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(e13) { return nr(e13) || _r(e13) && e13.isUnary() && nr(e13.args[0]); } function cs(e13) { return !!(nr(e13) || (En(e13) || _r(e13)) && e13.args.every(cs) || rn(e13) && cs(e13.content)); } function jv(e13, r) { var t = Object.keys(e13); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e13); r && (n = n.filter(function(a) { return Object.getOwnPropertyDescriptor(e13, a).enumerable; })), t.push.apply(t, n); } return t; } function gu(e13) { for (var r = 1; r < arguments.length; r++) { var t = arguments[r] != null ? arguments[r] : {}; r % 2 ? jv(Object(t), true).forEach(function(n) { Rr(e13, n, t[n]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e13, Object.getOwnPropertyDescriptors(t)) : jv(Object(t)).forEach(function(n) { Object.defineProperty(e13, n, Object.getOwnPropertyDescriptor(t, n)); }); } return e13; } var qz = "simplifyUtil"; var Lz = ["FunctionNode", "OperatorNode", "SymbolNode"]; var sc = P(qz, Lz, (e13) => { var { FunctionNode: r, OperatorNode: t, SymbolNode: n } = e13, a = true, i = false, 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(h10, x) { var w = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : l, g = o; if (typeof h10 == "string" ? g = h10 : _r(h10) ? g = h10.fn.toString() : En(h10) ? g = h10.name : rn(h10) && (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(h10) { var x = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : l; return c(h10, "commutative", x); } function d(h10) { var x = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : l; return c(h10, "associative", x); } function p(h10, x) { var w = gu({}, h10); for (var g in x) Fe(h10, g) ? w[g] = gu(gu({}, x[g]), h10[g]) : w[g] = x[g]; return w; } function m(h10, x) { if (!h10.args || h10.args.length === 0) return h10; h10.args = v(h10, x); for (var w = 0; w < h10.args.length; w++) m(h10.args[w], x); } function v(h10, 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(h10, x) ? (w = h10.op, D(h10), g) : h10.args; } function b(h10, x) { if (!(!h10.args || h10.args.length === 0)) { for (var w = A(h10), g = h10.args.length, D = 0; D < g; D++) b(h10.args[D], x); if (g > 2 && d(h10, x)) { for (var E = h10.args.pop(); h10.args.length > 0; ) E = w([h10.args.pop(), E]); h10.args = E.args; } } } function y(h10, x) { if (!(!h10.args || h10.args.length === 0)) { for (var w = A(h10), g = h10.args.length, D = 0; D < g; D++) y(h10.args[D], x); if (g > 2 && d(h10, x)) { for (var E = h10.args.shift(); h10.args.length > 0; ) E = w([E, h10.args.shift()]); h10.args = E.args; } } } function A(h10) { return _r(h10) ? function(x) { try { return new t(h10.op, h10.fn, x, h10.implicit); } catch (w) { return console.error(w), []; } } : function(x) { return new r(new n(h10.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 }; }); var Uz = "simplify"; var kz = ["typed", "parse", "equal", "resolve", "simplifyConstant", "simplifyCore", "AccessorNode", "ArrayNode", "ConstantNode", "FunctionNode", "IndexNode", "ObjectNode", "OperatorNode", "ParenthesisNode", "SymbolNode"]; var Vz = P(Uz, kz, (e13) => { 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 } = e13, { hasProperty: b, isCommutative: y, isAssociative: A, mergeContext: h10, 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, false, Z), "Node, Map, Object": (q, Z, K) => z(q, false, 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: true, false: true, e: true, i: true, Infinity: true, LN2: true, LN10: true, LOG2E: true, LOG10E: true, NaN: true, phi: true, pi: true, SQRT1_2: true, SQRT2: true, tau: true // 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: true } } }, { s: "n-n -> 0", // partial alternative when we can't always subtract assuming: { subtract: { total: false } } }, { s: "-(cl*v) -> v * (-cl)", // make non-constant terms positive assuming: { multiply: { commutative: true }, subtract: { total: true } } }, { s: "-(cl*v) -> (-cl) * v", // non-commutative version, part 1 assuming: { multiply: { commutative: false }, subtract: { total: true } } }, { s: "-(v*cl) -> v * (-cl)", // non-commutative version, part 2 assuming: { multiply: { commutative: false }, subtract: { total: true } } }, { 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: true }, // 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: true } } }, { s: "(n1*n2)^(-1) -> n2^(-1) * n1^(-1)", assuming: { multiply: { commutative: false } } }, // expand nested exponentiation { s: "(n ^ n1) ^ n2 -> n ^ (n1 * n2)", assuming: { divide: { total: true } } // 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: true } } // 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: true } } }, { s: "vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2", assuming: { divide: { total: true } } }, { l: "n*n", r: "n^2" }, { s: "n * n^n1 -> n^(n1+1)", assuming: { divide: { total: true } } // n*1/n = n^(-1+1) needs 1/n }, { s: "n^n1 * n^n2 -> n^(n1+n2)", assuming: { divide: { total: true } } // 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: true } } // 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: false } } }, { s: "vd + n*vd -> (1+n)*vd", assuming: { multiply: { commutative: false } } }, { s: "n1*n3 + n2*n3 -> (n1+n2)*n3", assuming: { multiply: { commutative: false } } }, { s: "n^n1 * n -> n^(n1+1)", assuming: { divide: { total: true }, multiply: { commutative: false } } }, { s: "n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)", assuming: { multiply: { commutative: false } } }, { s: "n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)", assuming: { multiply: { commutative: false } } }, { l: "n*cd + cd", r: "(n+1)*cd" }, { s: "cd*n + cd -> cd*(n+1)", assuming: { multiply: { commutative: false } } }, { s: "cd + cd*n -> cd*(1+n)", assuming: { multiply: { commutative: false } } }, 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: true } } }, { s: "n1*(-n) -> -(n1*n)", // in case * non-commutative assuming: { subtract: { total: true }, multiply: { commutative: false } } }, // final ordering of constants { s: "ce+ve -> ve+ce", assuming: { add: { commutative: true } }, imposeContext: { add: { commutative: false } } }, { s: "vd*cd -> cd*vd", assuming: { multiply: { commutative: true } }, imposeContext: { multiply: { commutative: false } } }, // 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: true } } // o.w. / not conventional }, { s: "n*n1^-n2 -> n/n1^n2", assuming: { multiply: { commutative: true } } // o.w. / not conventional }, { s: "n^-1 -> 1/n", assuming: { multiply: { commutative: true } } // 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: true } } }, { s: "n-(n1+n2) -> n-n1-n2", // '-' before '+' assuming: { addition: { associative: true, commutative: true } } }, // { 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: true } } }, { s: "n1/(n2/n3) -> (n1*n3)/n2", assuming: { multiply: { associative: true } } }, { 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] = true, 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 = h10(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 = false, xe = {}; for (var De in oe.properties) xe[De] = W(oe.properties[De], Z, K), xe[De] !== oe.properties[De] && (pe = true); 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 = true), 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] = true, 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, true); 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 false; } else if (q instanceof v && Z instanceof v) { if (q.name !== Z.name) return false; } 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 false; } else if (q instanceof c && q.name !== Z.name) return false; if (q.args.length !== Z.args.length) return false; for (var K = 0; K < q.args.length; K++) if (!re(q.args[K], Z.args[K])) return false; } else return false; return true; } return M; }); var Hz = "simplifyConstant"; var Zz = ["typed", "config", "mathWithTransform", "matrix", "?fraction", "?bignumber", "AccessorNode", "ArrayNode", "ConstantNode", "FunctionNode", "IndexNode", "ObjectNode", "OperatorNode", "SymbolNode"]; var Gz = P(Hz, Zz, (e13) => { 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 } = e13, { isCommutative: v, isAssociative: b, allChildren: y, createMakeNodeFunction: A } = sc({ FunctionNode: c, OperatorNode: p, SymbolNode: m }), h10 = 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 !== false; 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) => h10(ee, C))); case "ObjectNode": { var K = {}; for (var j in B.properties) K[j] = h10(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 h10; }); var Xv = "simplifyCore"; var Wz = ["typed", "parse", "equal", "isZero", "add", "subtract", "multiply", "divide", "pow", "AccessorNode", "ArrayNode", "ConstantNode", "FunctionNode", "IndexNode", "ObjectNode", "OperatorNode", "ParenthesisNode", "SymbolNode"]; var Kz = P(Xv, Wz, (e13) => { 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 } = e13, h10 = new d(0), x = new d(1), w = new d(true), g = new d(false); 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 = false, 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 = true; if (C.op === "-" && _r(W) && (W.isBinary() && W.fn === "subtract" && (C = new b("-", "subtract", [W.args[1], W.args[0]]), X = false), 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 h10; if (n(V.value, 1)) return R; } if (nr(R)) { if (a(R.value)) return h10; 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) ? h10 : 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 }); }); var Jz = "resolve"; var Yz = ["typed", "parse", "ConstantNode", "FunctionNode", "OperatorNode", "ParenthesisNode"]; var jz = P(Jz, Yz, (e13) => { var { typed: r, parse: t, ConstantNode: n, FunctionNode: a, OperatorNode: i, ParenthesisNode: o } = e13; 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))) }); }); var Qv = "symbolicEqual"; var Xz = ["parse", "simplify", "typed", "OperatorNode"]; var Qz = P(Qv, Xz, (e13) => { var { parse: r, simplify: t, typed: n, OperatorNode: a } = e13; 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 }); }); var eh = "derivative"; var eq = ["typed", "config", "parse", "simplify", "equal", "isZero", "numeric", "ConstantNode", "FunctionNode", "OperatorNode", "ParenthesisNode", "SymbolNode"]; var rq = P(eh, eq, (e13) => { 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 } = e13; function p(x, w) { var g = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : { simplify: true }, 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 = true, 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] = true, true; }, "Object, SymbolNode, string": function(w, g, D) { return g.name !== D ? (w[g] = true, true) : false; }, "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] = true, true); }, "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] = true, true; } return false; } }), A = r("_derivative", { "ConstantNode, Object": function(w) { return h10(0); }, "SymbolNode, Object": function(w, g) { return g[w] !== void 0 ? h10(0) : h10(1); }, "ParenthesisNode, Object": function(w, g) { return new f(A(w.content, g)); }, "FunctionAssignmentNode, Object": function(w, g) { return g[w] !== void 0 ? h10(0) : A(w.expr, g); }, "FunctionNode, Object": function(w, g) { if (g[w] !== void 0) return h10(0); var D = w.args[0], E, N = false, S = false, M; switch (w.name) { case "cbrt": N = true, M = new c("*", "multiply", [h10(3), new c("^", "pow", [D, new c("/", "divide", [h10(2), h10(3)])])]); break; case "sqrt": case "nthRoot": if (w.args.length === 1) N = true, M = new c("*", "multiply", [h10(2), new s("sqrt", [D])]); else if (w.args.length === 2) return E = new c("/", "divide", [h10(1), w.args[1]]), g[E] = g[w.args[1]], A(new c("^", "pow", [D, E]), g); break; case "log10": E = h10(10); case "log": if (!E && w.args.length === 1) M = D.clone(), N = true; 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 = true; 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()]), h10(2)]); break; case "sec": M = new c("*", "multiply", [w, new s("tan", [D.clone()])]); break; case "csc": S = true, M = new c("*", "multiply", [w, new s("cot", [D.clone()])]); break; case "cot": S = true, M = new c("^", "pow", [new s("csc", [D.clone()]), h10(2)]); break; case "asin": N = true, M = new s("sqrt", [new c("-", "subtract", [h10(1), new c("^", "pow", [D.clone(), h10(2)])])]); break; case "acos": N = true, S = true, M = new s("sqrt", [new c("-", "subtract", [h10(1), new c("^", "pow", [D.clone(), h10(2)])])]); break; case "atan": N = true, M = new c("+", "add", [new c("^", "pow", [D.clone(), h10(2)]), h10(1)]); break; case "asec": N = true, M = new c("*", "multiply", [new s("abs", [D.clone()]), new s("sqrt", [new c("-", "subtract", [new c("^", "pow", [D.clone(), h10(2)]), h10(1)])])]); break; case "acsc": N = true, S = true, M = new c("*", "multiply", [new s("abs", [D.clone()]), new s("sqrt", [new c("-", "subtract", [new c("^", "pow", [D.clone(), h10(2)]), h10(1)])])]); break; case "acot": N = true, S = true, M = new c("+", "add", [new c("^", "pow", [D.clone(), h10(2)]), h10(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()]), h10(2)]); break; case "sech": S = true, M = new c("*", "multiply", [w, new s("tanh", [D.clone()])]); break; case "csch": S = true, M = new c("*", "multiply", [w, new s("coth", [D.clone()])]); break; case "coth": S = true, M = new c("^", "pow", [new s("csch", [D.clone()]), h10(2)]); break; case "asinh": N = true, M = new s("sqrt", [new c("+", "add", [new c("^", "pow", [D.clone(), h10(2)]), h10(1)])]); break; case "acosh": N = true, M = new s("sqrt", [new c("-", "subtract", [new c("^", "pow", [D.clone(), h10(2)]), h10(1)])]); break; case "atanh": N = true, M = new c("-", "subtract", [h10(1), new c("^", "pow", [D.clone(), h10(2)])]); break; case "asech": N = true, S = true, M = new c("*", "multiply", [D.clone(), new s("sqrt", [new c("-", "subtract", [h10(1), new c("^", "pow", [D.clone(), h10(2)])])])]); break; case "acsch": N = true, S = true, M = new c("*", "multiply", [new s("abs", [D.clone()]), new s("sqrt", [new c("+", "add", [new c("^", "pow", [D.clone(), h10(2)]), h10(1)])])]); break; case "acoth": N = true, S = true, M = new c("-", "subtract", [h10(1), new c("^", "pow", [D.clone(), h10(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 h10(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(), h10(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(), h10(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)) ? h10(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 h10(0); if (i(I.value, 1)) return A($, g); } var B = new c("^", "pow", [$.clone(), new c("-", "subtract", [I, h10(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 h10(x, w) { return new u(l(x, Qn(String(x), t))); } return v; }); var rh = "rationalize"; var 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"]; var nq = P(rh, tq, (e13) => { 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: h10, ConstantNode: x, FunctionNode: w, IndexNode: g, ObjectNode: D, OperatorNode: E, SymbolNode: N, ParenthesisNode: S } = e13; function M(C) { var _ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false, O = $(), W = F(C, _, true, O.firstRules), X = W.variables.length, V = { exactFractions: false }, R = { exactFractions: true }; if (C = W.expression, X >= 1) { C = I(C); var Q, se, re = true, q = false; 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 = true, 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: false }); 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 = false, 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 = true, 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 = false; } 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"); } } }); var th = "zpk2tf"; var aq = ["typed", "add", "multiply", "Complex", "number"]; var iq = P(th, aq, (e13) => { var { typed: r, add: t, multiply: n, Complex: a, number: i } = e13; 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; } }); var nh = "freqz"; var oq = ["typed", "add", "multiply", "Complex", "divide", "matrix"]; var sq = P(nh, oq, (e13) => { var { typed: r, add: t, multiply: n, Complex: a, divide: i, matrix: o } = e13; 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 h10 = [], x = 0; x < d.length; x++) h10.push(i(d[x], p[x])); return { h: h10, w: f }; } function u(s) { for (var c = [], f = 0; f < s; f++) c.push(f / s * Math.PI); return c; } }); var uq = "reviver"; var lq = ["classes"]; var cq = P(uq, lq, (e13) => { var { classes: r } = e13; return function(n, a) { var i = r[a && a.mathjs]; return i && typeof i.fromJSON == "function" ? i.fromJSON(a) : a; }; }); var fq = "replacer"; var dq = []; var pq = 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; }); var mq = "13.2.3"; var vq = P("true", [], () => true); var hq = P("false", [], () => false); var gq = P("null", [], () => null); var yq = Nt("Infinity", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? new t(1 / 0) : 1 / 0; }); var bq = Nt("NaN", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? new t(NaN) : NaN; }); var wq = Nt("pi", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? Ql(t) : B_; }); var xq = Nt("tau", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? e5(t) : $_; }); var Aq = Nt("e", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? XB(t) : I_; }); var Nq = Nt("phi", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? QB(t) : R_; }); var Dq = Nt("LN2", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? new t(2).ln() : Math.LN2; }); var Eq = Nt("LN10", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? new t(10).ln() : Math.LN10; }); var Sq = Nt("LOG2E", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? new t(1).div(new t(2).ln()) : Math.LOG2E; }); var Cq = Nt("LOG10E", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? new t(1).div(new t(10).ln()) : Math.LOG10E; }); var Mq = Nt( // eslint-disable-line camelcase "SQRT1_2", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? new t("0.5").sqrt() : Math.SQRT1_2; } ); var _q = Nt("SQRT2", ["config", "?BigNumber"], (e13) => { var { config: r, BigNumber: t } = e13; return r.number === "BigNumber" ? new t(2).sqrt() : Math.SQRT2; }); var Fq = Nt("i", ["Complex"], (e13) => { var { Complex: r } = e13; return r.I; }); var Tq = P("PI", ["pi"], (e13) => { var { pi: r } = e13; return r; }); var Oq = P("E", ["e"], (e13) => { var { e: r } = e13; return r; }); var Bq = P("version", [], () => mq); function Nt(e13, r, t) { return P(e13, r, t, { recreateOnConfigChange: true }); } var $q = Je("speedOfLight", "299792458", "m s^-1"); var Iq = Je("gravitationConstant", "6.67430e-11", "m^3 kg^-1 s^-2"); var Rq = Je("planckConstant", "6.62607015e-34", "J s"); var Pq = Je("reducedPlanckConstant", "1.0545718176461565e-34", "J s"); var zq = Je("magneticConstant", "1.25663706212e-6", "N A^-2"); var qq = Je("electricConstant", "8.8541878128e-12", "F m^-1"); var Lq = Je("vacuumImpedance", "376.730313667", "ohm"); var Uq = Je("coulomb", "8.987551792261171e9", "N m^2 C^-2"); var kq = Je("elementaryCharge", "1.602176634e-19", "C"); var Vq = Je("bohrMagneton", "9.2740100783e-24", "J T^-1"); var Hq = Je("conductanceQuantum", "7.748091729863649e-5", "S"); var Zq = Je("inverseConductanceQuantum", "12906.403729652257", "ohm"); var Gq = Je("magneticFluxQuantum", "2.0678338484619295e-15", "Wb"); var Wq = Je("nuclearMagneton", "5.0507837461e-27", "J T^-1"); var Kq = Je("klitzing", "25812.807459304513", "ohm"); var Jq = Je("bohrRadius", "5.29177210903e-11", "m"); var Yq = Je("classicalElectronRadius", "2.8179403262e-15", "m"); var jq = Je("electronMass", "9.1093837015e-31", "kg"); var Xq = Je("fermiCoupling", "1.1663787e-5", "GeV^-2"); var Qq = zs("fineStructure", 0.0072973525693); var eL = Je("hartreeEnergy", "4.3597447222071e-18", "J"); var rL = Je("protonMass", "1.67262192369e-27", "kg"); var tL = Je("deuteronMass", "3.3435830926e-27", "kg"); var nL = Je("neutronMass", "1.6749271613e-27", "kg"); var aL = Je("quantumOfCirculation", "3.6369475516e-4", "m^2 s^-1"); var iL = Je("rydberg", "10973731.568160", "m^-1"); var oL = Je("thomsonCrossSection", "6.6524587321e-29", "m^2"); var sL = zs("weakMixingAngle", 0.2229); var uL = zs("efimovFactor", 22.7); var lL = Je("atomicMass", "1.66053906660e-27", "kg"); var cL = Je("avogadro", "6.02214076e23", "mol^-1"); var fL = Je("boltzmann", "1.380649e-23", "J K^-1"); var dL = Je("faraday", "96485.33212331001", "C mol^-1"); var pL = Je("firstRadiation", "3.7417718521927573e-16", "W m^2"); var mL = Je("loschmidt", "2.686780111798444e25", "m^-3"); var vL = Je("gasConstant", "8.31446261815324", "J K^-1 mol^-1"); var hL = Je("molarPlanckConstant", "3.990312712893431e-10", "J s mol^-1"); var gL = Je("molarVolume", "0.022413969545014137", "m^3 mol^-1"); var yL = zs("sackurTetrode", -1.16487052358); var bL = Je("secondRadiation", "0.014387768775039337", "m K"); var wL = Je("stefanBoltzmann", "5.67037441918443e-8", "W m^-2 K^-4"); var xL = Je("wienDisplacement", "2.897771955e-3", "m K"); var AL = Je("molarMass", "0.99999999965e-3", "kg mol^-1"); var NL = Je("molarMassC12", "11.9999999958e-3", "kg mol^-1"); var DL = Je("gravity", "9.80665", "m s^-2"); var EL = Je("planckLength", "1.616255e-35", "m"); var SL = Je("planckMass", "2.176435e-8", "kg"); var CL = Je("planckTime", "5.391245e-44", "s"); var ML = Je("planckCharge", "1.87554603778e-18", "C"); var _L = Je("planckTemperature", "1.416785e+32", "K"); function Je(e13, r, t) { var n = ["config", "Unit", "BigNumber"]; return P(e13, 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 = true, s; }); } function zs(e13, r) { var t = ["config", "BigNumber"]; return P(e13, t, (n) => { var { config: a, BigNumber: i } = n; return a.number === "BigNumber" ? new i(r) : r; }); } var FL = "apply"; var TL = ["typed", "isInteger"]; var OL = P(FL, TL, (e13) => { var { typed: r, isInteger: t } = e13, 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: true }); var BL = "column"; var $L = ["typed", "Index", "matrix", "range"]; var IL = P(BL, $L, (e13) => { var { typed: r, Index: t, matrix: n, range: a } = e13, 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: true }); function uc(e13, r, t) { var n = e13.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 "' + e13 + '"'); var a = n.name, i = /* @__PURE__ */ new Map(), o = new P0(t, i, /* @__PURE__ */ new Set([a])), l = e13.compile(); return function(s) { return i.set(a, s), l.evaluate(o); }; } var RL = "transformCallback"; var PL = ["typed"]; var lc = P(RL, PL, (e13) => { var { typed: r } = e13; 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(e13, r, t) { return r === t ? e13 : 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 e13(...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 e13(...o, l, ...u); } : e13; } function ih(e13) { return e13.map((r) => r + 1); } var zL = "filter"; var qL = ["typed"]; var LL = P(zL, qL, (e13) => { var { typed: r } = e13; 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 = true; function n(a, i) { return a.compile().evaluate(i); } return t; }, { isTransformFunction: true }); var UL = "forEach"; var kL = ["typed"]; var VL = P(UL, kL, (e13) => { var { typed: r } = e13, 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 = true; function i(o, l) { return o.compile().evaluate(l); } return a; }, { isTransformFunction: true }); var HL = "index"; var ZL = ["Index", "getMatrixDataType"]; var GL = P(HL, ZL, (e13) => { var { Index: r, getMatrixDataType: t } = e13; 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 === true) 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: true }); var WL = "map"; var KL = ["typed"]; var JL = P(WL, KL, (e13) => { var { typed: r } = e13, 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 = true, a; }, { isTransformFunction: true }); function YL(e13) { return We(e13) ? e13 - 1 : Ze(e13) ? e13.minus(1) : e13; } function jL(e13) { return We(e13) || Ze(e13); } function ta(e13) { if (e13.length === 2 && At(e13[0])) { e13 = e13.slice(); var r = e13[1]; jL(r) && (e13[1] = YL(r)); } return e13; } var XL = "max"; var QL = ["typed", "config", "numeric", "larger"]; var eU = P(XL, QL, (e13) => { var { typed: r, config: t, numeric: n, larger: a } = e13, 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: true }); var rU = "mean"; var tU = ["typed", "add", "divide"]; var nU = P(rU, tU, (e13) => { var { typed: r, add: t, divide: n } = e13, 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: true }); var aU = "min"; var iU = ["typed", "config", "numeric", "smaller"]; var oU = P(aU, iU, (e13) => { var { typed: r, config: t, numeric: n, smaller: a } = e13, 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: true }); var sU = "range"; var uU = ["typed", "config", "?matrix", "?bignumber", "smaller", "smallerEq", "larger", "largerEq", "add", "isPositive"]; var lU = P(sU, uU, (e13) => { var { typed: r, config: t, matrix: n, bignumber: a, smaller: i, smallerEq: o, larger: l, largerEq: u, add: s, isPositive: c } = e13, 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(true), f.apply(null, p); } }); }, { isTransformFunction: true }); var cU = "row"; var fU = ["typed", "Index", "matrix", "range"]; var dU = P(cU, fU, (e13) => { var { typed: r, Index: t, matrix: n, range: a } = e13, 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: true }); var pU = "subset"; var mU = ["typed", "matrix", "zeros", "add"]; var vU = P(pU, mU, (e13) => { var { typed: r, matrix: t, zeros: n, add: a } = e13, 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: true }); var hU = "concat"; var gU = ["typed", "matrix", "isInteger"]; var yU = P(hU, gU, (e13) => { var { typed: r, matrix: t, isInteger: n } = e13, 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: true }); var oh = "diff"; var bU = ["typed", "matrix", "subtract", "number", "bignumber"]; var wU = P(oh, bU, (e13) => { var { typed: r, matrix: t, subtract: n, number: a, bignumber: i } = e13, 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: true }); var xU = "std"; var AU = ["typed", "map", "sqrt", "variance"]; var NU = P(xU, AU, (e13) => { var { typed: r, map: t, sqrt: n, variance: a } = e13, 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: true }); var sh = "sum"; var DU = ["typed", "config", "add", "numeric"]; var EU = P(sh, DU, (e13) => { var { typed: r, config: t, add: n, numeric: a } = e13, 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: true }); var SU = "quantileSeq"; var CU = ["typed", "bignumber", "add", "subtract", "divide", "multiply", "partitionSelect", "compare", "isInteger", "smaller", "smallerEq", "larger"]; var MU = P(SU, CU, (e13) => { 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 } = e13, 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: true }); var uh = "cumsum"; var _U = ["typed", "add", "unaryPlus"]; var FU = P(uh, _U, (e13) => { var { typed: r, add: t, unaryPlus: n } = e13, 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: true }); var lh = "variance"; var TU = ["typed", "add", "subtract", "multiply", "divide", "apply", "isNaN"]; var OU = P(lh, TU, (e13) => { var { typed: r, add: t, subtract: n, multiply: a, divide: i, apply: o, isNaN: l } = e13, 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: true }); var ch = "print"; var BU = ["typed", "matrix", "zeros", "add"]; var $U = P(ch, BU, (e13) => { var { typed: r, matrix: t, zeros: n, add: a } = e13, 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: true }); var IU = "and"; var RU = ["typed", "matrix", "zeros", "add", "equalScalar", "not", "concat"]; var PU = P(IU, RU, (e13) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, not: i, concat: o } = e13, 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, true)) return false; var p = s[1].compile().evaluate(f); return l(d, p); } return u.rawArgs = true, u; }, { isTransformFunction: true }); var zU = "or"; var qU = ["typed", "matrix", "equalScalar", "DenseMatrix", "concat"]; var LU = P(zU, qU, (e13) => { var { typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i } = e13, 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, false)) return true; var d = u[1].compile().evaluate(c); return o(f, d); } return l.rawArgs = true, l; }, { isTransformFunction: true }); var UU = "bitAnd"; var kU = ["typed", "matrix", "zeros", "add", "equalScalar", "not", "concat"]; var VU = P(UU, kU, (e13) => { var { typed: r, matrix: t, equalScalar: n, zeros: a, not: i, concat: o } = e13, 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 === false) return 0; } var p = s[1].compile().evaluate(f); return l(d, p); } return u.rawArgs = true, u; }, { isTransformFunction: true }); var HU = "bitOr"; var ZU = ["typed", "matrix", "equalScalar", "DenseMatrix", "concat"]; var GU = P(HU, ZU, (e13) => { var { typed: r, matrix: t, equalScalar: n, DenseMatrix: a, concat: i } = e13, 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 === true) return 1; } var d = u[1].compile().evaluate(c); return o(f, d); } return l.rawArgs = true, l; }, { isTransformFunction: true }); var WU = Object.freeze(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; var cc = { exports: {} }; function fc() { } fc.prototype = { on: function(e13, r, t) { var n = this.e || (this.e = {}); return (n[e13] || (n[e13] = [])).push({ fn: r, ctx: t }), this; }, once: function(e13, r, t) { var n = this; function a() { n.off(e13, a), r.apply(t, arguments); } return a._ = r, this.on(e13, a, t); }, emit: function(e13) { var r = [].slice.call(arguments, 1), t = ((this.e || (this.e = {}))[e13] || []).slice(), n = 0, a = t.length; for (n; n < a; n++) t[n].fn.apply(t[n].ctx, r); return this; }, off: function(e13, r) { var t = this.e || (this.e = {}), n = t[e13], 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[e13] = a : delete t[e13], this; } }; cc.exports = fc; cc.exports.TinyEmitter = fc; var KU = cc.exports; var JU = Es(KU); function YU(e13) { var r = new JU(); return e13.on = r.on.bind(r), e13.off = r.off.bind(r), e13.once = r.once.bind(r), e13.emit = r.emit.bind(r), e13; } function jU(e13, 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 h10(D, E, N) { if (Array.isArray(E)) E.forEach((F) => h10(D, F)); else if (typeof E == "object") for (var S in E) Fe(E, S) && h10(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 = {}; h10(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 = e13(b, { [y.signature]: y })), e13.isTypedFunction(t[b]) && e13.isTypedFunction(y)) { A.override ? y = e13(b, y.signatures) : y = e13(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 h10 = [], x = 0, w = arguments.length; x < w; x++) { var g = arguments[x]; h10[x] = g && g.valueOf(); } return b.apply(t, h10); }; 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 h10 = m(b) ? t.expression.transform : t, x = A in t.expression.transform, w = Fe(h10, A) ? h10[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 = 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 (e13.isTypedFunction(w) && e13.isTypedFunction(N)) return e13(w, N); if (y.silent) return w; throw new Error('Cannot import "' + A + '": already exists'); }; !b.meta || b.meta.lazy !== false ? ($o(h10, A, g), w && x ? l(A) : (m(b) || p(b)) && $o(t.expression.mathWithTransform, A, () => h10[A])) : (h10[A] = g(), w && x ? l(A) : (m(b) || p(b)) && $o(t.expression.mathWithTransform, A, () => h10[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 === true || false; } var v = { expression: true, type: true, docs: true, error: true, json: true, chain: true // chain method not supported. Note that there is a unit chain too. }; return a; } function dc(e13, 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 === true ? 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: true }); }); }), n.create = dc.bind(null, e13), n.factory = P, n.import(Object.values(NC(e13))), n.ArgumentsError = Fn, n.DimensionError = Ye, n.IndexError = $t, n; } var XU = dc(r1, {}); var t1 = "simcore/services/comp/opencor"; function tl(e13, r) { let t = -1; const n = new XU.parser(); return e13.simulationUiInfo.input.forEach((a) => { ++t, n.set(a.id, e13.$refs.simInput[t].vModel); }), n.evaluate(r); } function n1(e13) { e13.$nextTick(() => { let r = -1; e13.simulationUiInfo.input.forEach((t) => { ++r, e13.$refs.simInput[r].visible = t.visible === void 0 ? true : tl(e13, t.visible); }), e13.libopencor !== void 0 && (e13.userMessage = "Running the model...", e13.showUserMessage = true, e13.$nextTick(() => { e13.runSimulation(); })); }); } function fh(e13) { if (!e13.hasFinalisedUi && e13.isMounted && e13.hasValidSimulationUiInfo) { e13.$refs.output.classList.add("x" + e13.simulationUiInfo.output.plots.length); let r = -1; e13.simulationUiInfo.output.plots.forEach(() => { e13.simulationResults[++r] = [{ x: [], y: [], type: "scatter" }]; }), n1(e13), e13.hasFinalisedUi = true; } } var a1 = (e13, r) => { const t = e13.__vccOpts || e13; for (const [n, a] of r) t[n] = a; return t; }; var QU = { name: "SimulationVuerInput", components: { ElInputNumber: Bl, ElOption: B0, ElSelect: O0, ElSlider: I0 }, props: { defaultValue: { required: true, type: Number }, maximumValue: { type: Number }, minimumValue: { type: Number }, name: { required: true, 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: true, vModel: this.defaultValue }; }, methods: { updateUi: function() { n1(this.$parent); } } }; var ek = { key: 1, class: "sliders-and-fields" }; function rk(e13, r, t, n, a, i) { const o = B0, l = O0, u = I0, s = Bl; return withDirectives((openBlock(), createElementBlock("div", null, [ createBaseVNode("p", { class: normalizeClass(e13.labelClasses) }, toDisplayString(t.name), 3), e13.isDiscrete ? (openBlock(), createBlock(l, { key: 0, class: "discrete", "popper-class": "discrete-popper", size: "small", modelValue: e13.vModel, "onUpdate:modelValue": r[0] || (r[0] = (c) => e13.vModel = c), teleported: false, onChange: r[1] || (r[1] = (c) => i.updateUi()) }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(t.possibleValues, (c) => (openBlock(), createBlock(o, { key: c.value, label: c.name, value: c.value }, null, 8, ["label", "value"]))), 128)) ]), _: 1 }, 8, ["modelValue"])) : createCommentVNode("", true), e13.isDiscrete ? createCommentVNode("", true) : (openBlock(), createElementBlock("div", ek, [ createVNode(u, { modelValue: e13.vModel, "onUpdate:modelValue": r[2] || (r[2] = (c) => e13.vModel = c), max: t.maximumValue, min: t.minimumValue, "show-input": false, "show-tooltip": false, step: t.stepValue, onInput: r[3] || (r[3] = (c) => i.updateUi()) }, null, 8, ["modelValue", "max", "min", "step"]), createVNode(s, { class: "scalar", size: "small", modelValue: e13.vModel, "onUpdate:modelValue": r[4] || (r[4] = (c) => e13.vModel = c), controls: false, max: t.maximumValue, min: t.minimumValue, step: t.stepValue, "step-strictly": true, onInput: r[5] || (r[5] = (c) => i.updateUi()) }, null, 8, ["modelValue", "max", "min", "step"]) ])) ], 512)), [ [vShow, e13.visible] ]); } var i1 = a1(QU, [["render", rk], ["__scopeId", "data-v-463a29a2"]]); var Fr = {}; var 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 === true; }; 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(e13, r) { return r + ": " + e13.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(e13) { typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, ga), this.instance = e13.instance, this.schema = e13.schema, this.options = e13.options, this.errors = e13.errors; } ga.prototype = new Error(); ga.prototype.constructor = ga; ga.prototype.name = "Validation Error"; var dh = Fr.SchemaError = function e10(r, t) { this.message = r, this.schema = t, Error.call(this, r), typeof Error.captureStackTrace == "function" && Error.captureStackTrace(this, e10); }; dh.prototype = Object.create( Error.prototype, { constructor: { value: dh, enumerable: false }, name: { value: "SchemaError", enumerable: false } } ); 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(e13) { return typeof e13 == "string" && parseFloat(e13) === parseInt(e13, 10) && !isNaN(e13); }, // 7.3.8. regex regex: function(e13) { var r = true; try { new RegExp(e13); } catch { r = false; } 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 true; }; 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 e11(r, t) { if (typeof r != typeof t) return false; if (Array.isArray(r)) return !Array.isArray(t) || r.length !== t.length ? false : r.every(function(i, o) { return e11(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 ? false : n.every(function(i) { return e11(r[i], t[i]); }); } return r === t; }; function nk(e13, r, t, n) { typeof t == "object" ? r[n] = pc(e13[n], t) : e13.indexOf(t) === -1 && r.push(t); } function ak(e13, r, t) { r[t] = e13[t]; } function ik(e13, r, t, n) { typeof r[n] != "object" || !r[n] ? t[n] = r[n] : e13[n] ? t[n] = pc(e13[n], r[n]) : t[n] = r[n]; } function pc(e13, r) { var t = Array.isArray(r), n = t && [] || {}; return t ? (e13 = e13 || [], n = n.concat(e13), r.forEach(nk.bind(null, e13, n))) : (e13 && typeof e13 == "object" && Object.keys(e13).forEach(ak.bind(null, e13, n)), Object.keys(r).forEach(ik.bind(null, e13, 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(e13) { return "/" + encodeURIComponent(e13).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(); }; var xt = Fr; var ur = xt.ValidatorResult; var na = xt.SchemaError; var mc = {}; mc.ignoreProperties = { // informative properties id: true, default: true, description: true, title: true, // arguments to other properties additionalItems: true, then: true, else: true, // special-handled properties $schema: true, $ref: true, extends: true }; 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(e13, r, t, n, a) { var i = r.throwError, o = r.throwAll; r.throwError = false, r.throwAll = false; var l = this.validateSchema(e13, 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(e13, r) { if (Object.hasOwnProperty.call(e13, r)) return e13[r]; if (r in e13) { for (; e13 = Object.getPrototypeOf(e13); ) if (Object.propertyIsEnumerable.call(e13, r)) return e13[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(e13, r, t, n, a, i) { if (this.types.object(e13) && !(r.properties && r.properties[a] !== void 0)) if (r.additionalProperties === false) 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(e13, a, o, t, n); var l = this.validateSchema(e13[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 = true; 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 = false, 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 true; if (s === false) return o.addError({ name: "items", message: "additionalItems not permitted" }), false; 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), true; }), 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 === false && 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 === true ? 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 === true ? 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 === true ? 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(e13, r, t) { var n, a = t.length; for (n = r + 1, a; n < a; n++) if (xt.deepCompareStrict(e13, t[n])) return false; return true; } lr.uniqueItems = function(r, t, n, a) { if (t.uniqueItems === true && 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; var gc = {}; var yu = Fr; gc.SchemaScanResult = c1; function c1(e13, r) { this.id = e13, 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; var aa = Fr; var d1 = gc.scan; var p1 = aa.ValidatorResult; var lk = aa.ValidatorResultError; var Ui = aa.SchemaError; var m1 = aa.SchemaContext; var ck = "/"; var Ur = function e12() { this.customFormats = Object.create(e12.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(e13) { var r = typeof e13 == "string" ? e13 : e13.$ref; return typeof r == "string" ? r : false; } Ur.prototype.validateSchema = function(r, t, n, a) { var i = new p1(r, t, n, a); if (typeof t == "boolean") t === true ? t = {} : t === false && (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 === false) 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 true; } }; 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 true; }; sn.object = function(r) { return r && typeof r == "object" && !Array.isArray(r) && !(r instanceof Date); }; var fk = Ur; var h1; h1 = fk; Fr.ValidatorResult; Fr.ValidatorResultError; Fr.ValidationError; Fr.SchemaError; function dk(e13, r) { const t = new h1(), n = { additionalProperties: false, properties: { input: { items: { oneOf: [ { additionalProperties: false, properties: { defaultValue: { required: true, type: "number" }, id: { type: "string" }, name: { required: true, type: "string" }, possibleValues: { items: { additionalProperties: false, properties: { name: { required: true, type: "string" }, value: { required: true, type: "number" } }, type: "object" }, minItems: 1, required: true, type: "array" }, visible: { type: "string" } } }, { additionalProperties: false, properties: { defaultValue: { required: true, type: "number" }, id: { type: "string" }, maximumValue: { required: true, type: "number" }, minimumValue: { required: true, type: "number" }, name: { required: true, type: "string" }, stepValue: { type: "number" }, visible: { type: "string" } } } ], type: "object" }, minItems: 1, required: true, type: "array" }, output: { additionalProperties: false, minItems: 1, properties: { data: { items: { additionalProperties: false, properties: { id: { required: true, type: "string" }, name: { required: true, type: "string" } }, type: "object" }, minItems: 1, required: true, type: "array" }, plots: { items: { additionalProperties: false, properties: { xAxisTitle: { required: true, type: "string" }, xValue: { required: true, type: "string" }, yAxisTitle: { required: true, type: "string" }, yValue: { required: true, type: "string" } }, type: "object" }, maxItems: 9, minItems: 1, required: true, type: "array" } }, required: true, type: "object" }, parameters: { items: { additionalProperties: false, properties: { name: { required: true, type: "string" }, value: { required: true, type: "string" } }, type: "object" }, type: "array" }, simulation: { additionalProperties: false, properties: { opencor: { additionalProperties: false, properties: { endingPoint: { type: "number" }, pointInterval: { type: "number" }, resource: { required: true, type: "string" } }, type: "object" }, solvers: { items: { additionalProperties: false, properties: { if: { type: "string" }, input: { additionalProperties: false, properties: { name: { required: true, type: "string" }, value: { required: true, type: "string" } }, type: "object" }, name: { required: true, type: "string" }, version: { required: true, type: "string" } }, type: "object" }, minItems: 1, required: true, type: "array" } }, required: r, type: "object" } }, type: "object" }, a = t.validate(e13, n, { nestedErrors: true }); if (!a.valid) return console.warn(a.toString()), false; const i = {}; if (!e13.input.every((c) => { if (c.id !== void 0) { if (c.id === "") return console.warn("JSON: the input id must not be empty."), false; if (i[c.id] !== void 0) return console.warn("JSON: the input id must be unique (" + c.id + " is used more than once)."), false; i[c.id] = true; } if (c.name === "") return console.warn("JSON: the input name must not be empty."), false; if (c.possibleValues !== void 0) { if (!c.possibleValues.every((p) => p.name === "" ? (console.warn("JSON: an input possible value must not be empty."), false) : true)) return false; 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)."), false) : (d[p] = true, true))) return false; if (!f.includes(c.defaultValue)) return console.warn("JSON: the input default value (" + c.defaultValue + ") must be one of the possible values (" + f.join(", ") + ")."), false; } 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 + ")."), false; 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 + ")."), false; 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 + ")."), false; 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 + ")."), false; } else if (!Number.isInteger(f)) return console.warn("JSON: the (default) input step value (1) must be a factor of the range value (" + f + ")."), false; } return c.visible !== void 0 && c.visible === "" ? (console.warn("JSON: the input visible must not be empty."), false) : true; })) return false; const l = {}; if (!e13.output.data.every((c) => { if (c.id !== void 0) { if (c.id === "") return console.warn("JSON: the output data id must not be empty."), false; if (l[c.id] !== void 0) return console.warn("JSON: the output data id must be unique (" + c.id + " is used more than once)."), false; l[c.id] = true; } return c.name === "" ? (console.warn("JSON: the output data name must not be empty."), false) : true; }) || !e13.output.plots.every((c) => c.xAxisTitle === "" ? (console.warn("JSON: the output plot X axis title must not be empty."), false) : c.xValue === "" ? (console.warn("JSON: the output plot X value must not be empty."), false) : c.yAxisTitle === "" ? (console.warn("JSON: the output plot Y axis title must not be empty."), false) : c.yValue === "" ? (console.warn("JSON: the output plot Y value must not be empty."), false) : true) || e13.parameters !== void 0 && !e13.parameters.every((f) => f.name === "" ? (console.warn("JSON: the parameter name must not be empty."), false) : f.value === "" ? (console.warn("JSON: the parameter value must not be empty."), false) : true)) return false; if (r) { let c = false; if (!e13.simulation.solvers.every((f) => { if (f.if !== void 0 && f.if === "") return console.warn("JSON: a simulation solver if must not be empty."), false; if (f.input !== void 0) { if (f.input.name === "") return console.warn("JSON: a simulation solver input name must not be empty."), false; if (f.input.value === "") return console.warn("JSON: a simulation solver input value must not be empty."), false; } return f.name === "" ? (console.warn("JSON: a simulation solver name must not be empty."), false) : (c = c || f.name === t1, f.version === "" ? (console.warn("JSON: a simulation solver version must not be empty."), false) : true); })) return false; if (c && e13.simulation.opencor === void 0) return console.warn("JSON: the simulation solver for OpenCOR is specified so simulation OpenCOR settings must also be specified."), false; if (e13.simulation.opencor !== void 0) { if (e13.simulation.opencor.resource === "") return console.warn("JSON: the simulation OpenCOR resource must not be empty."), false; if (e13.simulation.opencor.endingPoint !== void 0) if (e13.simulation.opencor.pointInterval !== void 0) { if (e13.simulation.opencor.endingPoint <= 0) return console.warn("JSON: the simulation OpenCOR ending point (" + e13.simulation.opencor.endingPoint + ") must be greater than zero."), false; if (e13.simulation.opencor.pointInterval <= 0) return console.warn("JSON: the simulation OpenCOR point interval (" + e13.simulation.opencor.pointInterval + ") must be greater than zero."), false; } else return console.warn("JSON: a simulation OpenCOR ending point is specified so a simulation OpenCOR point interval must also be specified."), false; else if (e13.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."), false; } } return true; } var pk = "libOpenCOR"; var mk = "oSPARC"; var bu = "https://models.physiomeproject.org/"; var vk = dc(r1, {}); var Bn = Object.freeze({ DATASET_ID: "dataset_id", DATASET_URL: "dataset_url", PMR_PATH: "pmr_path", RAW_COMBINE_ARCHIVE: "raw_combine_archive" }); var hk = { LIBOPENCOR_SOLVER: pk, OSPARC_SOLVER: mk, name: "SimulationVuer", components: { PlotVuer: P1, 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: true, 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: true, type: [Number, String, Uint8Array] } }, data: function() { let e13; if (typeof this.id == "number" ? e13 = Bn.DATASET_ID : this.id instanceof Uint8Array ? e13 = Bn.RAW_COMBINE_ARCHIVE : this.id.startsWith("https://") ? e13 = Bn.DATASET_URL : e13 = Bn.PMR_PATH, e13 === 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: false, hasValidSimulationUiInfo: false, idType: e13, instance: void 0, isMounted: false, isSimulationValid: true, layout: [], libopencor: void 0, libopencorSet: false, model: void 0, name: null, opencorBasedSimulation: true, output: void 0, perfectScollbarOptions: { suppressScrollX: true }, showUserMessage: false, 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(e13) { return { version: "1.1.0", type: "plot", attrs: { style: "timeseries", layout: this.layout[e13] } }; }, /** * @public * Manage the file associated with the given `url` and `fileContents`. * @arg `url` * @arg `fileContents` */ manageFile(e13, r) { let t = this.fileManager.file(e13); t === null && (t = new this.libopencor.File(e13)); 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 = markRaw(a.model()), this.instance = markRaw(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 e13 = {}, r = this.instance.task(0); let t = true, n; for (const a of this.outputData()) { if (n = false, a === r.voiName && (e13[a] = r.voiAsArray, n = true), e13[a] === void 0) { for (let i = 0; i < r.stateCount; ++i) if (a === r.stateName(i)) { e13[a] = r.stateAsArray(i), n = true; break; } } if (e13[a] === void 0) { for (let i = 0; i < r.rateCount; ++i) if (a === r.rateName(i)) { e13[a] = r.rateAsArray(i), n = true; break; } } if (e13[a] === void 0) { for (let i = 0; i < r.constantCount; ++i) if (a === r.constantName(i)) { e13[a] = r.constantAsArray(i), n = true; break; } } if (e13[a] === void 0) { for (let i = 0; i < r.computedConstantCount; ++i) if (a === r.computedConstantName(i)) { e13[a] = r.computedConstantAsArray(i), n = true; break; } } if (e13[a] === void 0) { for (let i = 0; i < r.algebraicCount; ++i) if (a === r.algebraicName(i)) { e13[a] = r.algebraicAsArray(i), n = true; break; } } n || (console.warn("SIMULATION: output '" + a + "' could not be found."), t = false); } t ? this.processSimulationResults(e13) : (this.hasValidSimulationUiInfo = false, this.errorMessage = "some outputs could not be found"), this.showUserMessage = false; }, /** * @public * Build the simulation UI using `simulationUiInfo`, a JSON object that describes the contents of the simulation UI. * @arg `simulationUiInfo` */ buildSimulationUi(e13) { if (this.simulationUiInfo = e13, 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 = false, 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: true, margin: { t: 25, l: 55, r: 25, b: 30, pad: 4 }, loading: false, options: { responsive: true, scrollZoom: true }, 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(e13, r) { this.libopencor = markRaw(e13), this.libopencorSet = true, this.fileManager = markRaw(this.libopencor.FileManager.instance()); const t = this.manageFile(bu + this.id, r); if (t.type.value !== e13.File.Type.COMBINE_ARCHIVE.value) this.showUserMessage = false; else { const n = new TextDecoder(), a = t.childFileFromFileName("simulation.json"); if (a === null) this.errorMessage = "no simulation JSON file could be found", this.showUserMessage = false; else { const i = JSON.parse(n.decode(a.contents())); this.showUserMessage = false, 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 e13 = bu + this.id; window.open(e13.substring(0, e13.lastIndexOf("/")), "_blank"); }, /** * @public * Data needed to set a model's parameters. */ parametersData() { const e13 = {}; return this.simulationUiInfo.parameters.forEach((r) => { e13[r.name] = tl(this, r.value); }), e13; }, /** * @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((e13) => { this.output.push(e13.name); })), this.output; }, /** * @public * Create the `request` that is going to be used by `startSimulation` to ask oSPARC to start the simulation. */ retrieveRequest() { const e13 = { solver: this.solver }; if (this.opencorBasedSimulation) { e13.opencor = { model_url: this.simulationUiInfo.simulation.opencor.resource, json_config: {} }, this.simulationUiInfo.simulation.opencor.endingPoint !== void 0 && this.simulationUiInfo.simulation.opencor.pointInterval !== void 0 && (e13.opencor.json_config.simulation = { "Ending point": this.simulationUiInfo.simulation.opencor.endingPoint, "Point interval": this.simulationUiInfo.simulation.opencor.pointInterval }), e13.opencor.json_config.parameters = this.parametersData(); const r = this.outputData(); r !== void 0 && (e13.opencor.json_config.output = r); } else e13.osparc = {}, e13.osparc.job_inputs = this.parametersData(); return e13; }, /** * @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(e13) { if (typeof e13 == "string") { const n = /[ \t]+/g, a = e13.trim().split(` `), i = a[0].trim().split(n).length; e13 = {}; for (let l = 0; l < i; ++l) e13[l] = []; let o = -1; a.forEach((l) => { ++o; let u = -1; l.trim().split(n).forEach((c) => { e13[++u][o] = Number(c); }); }); } const r = new vk.parser(); Object.keys(this.simulationResultsId).forEach((n) => { r.set(n, e13[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(e13) { this.isSimulationValid = false, this.showUserMessage = false, this.errorMessage = e13.statusText.toLowerCase() + " (" + e13.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(e13) { 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 = false, this.processSimulationResults(t.results); else { let n = this; setTimeout(function() { n.checkSimulation(e13); }, 1e3); } else this.showUserMessage = false, this.errorMessage = t.description; } else this.showHttpIssue(r); }, r.send(JSON.stringify(e13)); }, /** * @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 = true, this.$nextTick(() => { this.simulationResults = {}; const e13 = new XMLHttpRequest(); e13.open("POST", this.apiLocation + "/start_simulation"), e13.setRequestHeader("Content-type", "application/json"), e13.onreadystatechange = () => { if (e13.readyState === 4) if (e13.status === 200) { let r = JSON.parse(e13.responseText); this.isSimulationValid = r.status === "ok", this.isSimulationValid ? this.checkSimulation(r.data) : (this.showUserMessage = false, this.errorMessage = r.description); } else this.showHttpIssue(e13); }, e13.send(JSON.stringify(this.retrieveRequest())); }); } }, created: function() { this.idType === Bn.DATASET_ID ? (this.userMessage = "Retrieving UI information...", this.showUserMessage = true, this.$nextTick(() => { const e13 = new XMLHttpRequest(); e13.open("GET", this.apiLocation + "/simulation_ui_file/" + this.id), e13.onreadystatechange = () => { e13.readyState === 4 && (this.showUserMessage = false, e13.status === 200 ? this.$nextTick(() => { this.buildSimulationUi(JSON.parse(e13.responseText)); }) : this.errorMessage = "the simulation dataset could not be retrieved"); }, e13.send(); })) : this.idType === Bn.DATASET_URL ? (this.userMessage = "Retrieving COMBINE archive...", this.showUserMessage = true, this.$nextTick(() => { const e13 = new XMLHttpRequest(); e13.open("GET", this.id), e13.responseType = "arraybuffer", e13.onreadystatechange = () => { e13.readyState === 4 && (e13.status === 200 ? Js().then((r) => { this.extractAndBuildSimulationUi(r, new Uint8Array(e13.response)); }) : (this.errorMessage = "the COMBINE archive could not be retrieved", this.showUserMessage = false)); }, e13.send(); })) : this.idType === Bn.PMR_PATH ? (this.userMessage = "Retrieving COMBINE archive from PMR...", this.showUserMessage = true, this.$nextTick(() => { const e13 = new XMLHttpRequest(); e13.open("POST", this.apiLocation + "/pmr_file"), e13.setRequestHeader("Content-type", "application/json"), e13.onreadystatechange = () => { e13.readyState === 4 && (e13.status === 200 ? Js().then((r) => { this.extractAndBuildSimulationUi(r, Uint8Array.from(atob(e13.response), (t) => t.charCodeAt(0))); }) : (this.errorMessage = "the COMBINE archive chould not be retrieved from PMR", this.showUserMessage = false)); }, e13.send(JSON.stringify({ path: this.id })); })) : (this.userMessage = "Retrieving COMBINE archive...", this.showUserMessage = true, this.$nextTick(() => { Js().then((e13) => { this.extractAndBuildSimulationUi(e13, this.id); }); })); }, mounted: function() { this.isMounted = true, fh(this); } }; var gk = ["element-loading-text"]; var yk = { key: 0, class: "default error" }; var bk = { key: 1, class: "main" }; var wk = { class: "main-left" }; var xk = { key: 0, class: "default name" }; var Ak = { class: "input scrollbar" }; var Nk = { key: 2, class: "primary-button" }; var Dk = { key: 3, class: "secondary-button" }; var Ek = { key: 4, class: "secondary-button" }; var Sk = { key: 5, class: "secondary-button" }; var Ck = { key: 6, class: "default note" }; var Mk = { class: "main-right", ref: "output" }; var _k = { class: "main-right" }; var Fk = { class: "default error" }; var Tk = ["innerHTML"]; function Ok(e13, r, t, n, a, i) { const o = _0, l = i1, u = M0, s = resolveComponent("PlotVuer"), c = Ru; return withDirectives((openBlock(), createElementBlock("div", { class: "simulation-vuer", "element-loading-text": e13.userMessage }, [ !e13.hasValidSimulationUiInfo && !e13.showUserMessage ? (openBlock(), createElementBlock("p", yk, [ r[4] || (r[4] = createBaseVNode("span", { class: "error" }, "Error:", -1)), createTextVNode(" " + toDisplayString(e13.errorMessage) + ".", 1) ])) : createCommentVNode("", true), e13.hasValidSimulationUiInfo ? (openBlock(), createElementBlock("div", bk, [ createBaseVNode("div", wk, [ e13.libopencorSet ? createCommentVNode("", true) : (openBlock(), createElementBlock("p", xk, toDisplayString(e13.name), 1)), e13.libopencorSet ? createCommentVNode("", true) : (openBlock(), createBlock(o, { key: 1 })), r[9] || (r[9] = createBaseVNode("p", { class: "default input-parameters" }, "Input parameters", -1)), createBaseVNode("div", Ak, [ (openBlock(true), createElementBlock(Fragment, null, renderList(e13.simulationUiInfo.input, (f, d) => (openBlock(), createBlock(l, { ref_for: true, 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)) ]), e13.libopencorSet ? createCommentVNode("", true) : (openBlock(), createElementBlock("div", Nk, [ createVNode(u, { type: "primary", size: "small", onClick: r[0] || (r[0] = (f) => i.startSimulation()) }, { default: withCtx(() => [...r[5] || (r[5] = [ createTextVNode("Run Simulation", -1) ])]), _: 1 }) ])), e13.uuid ? (openBlock(), createElementBlock("div", Dk, [ createVNode(u, { size: "small", onClick: r[1] || (r[1] = (f) => i.runOnOsparc()) }, { default: withCtx(() => [...r[6] || (r[6] = [ createTextVNode("Run on oSPARC", -1) ])]), _: 1 }) ])) : createCommentVNode("", true), e13.libopencorSet ? createCommentVNode("", true) : (openBlock(), createElementBlock("div", Ek, [ createVNode(u, { size: "small", onClick: r[2] || (r[2] = (f) => i.viewDataset()) }, { default: withCtx(() => [...r[7] || (r[7] = [ createTextVNode("View Dataset", -1) ])]), _: 1 }) ])), e13.libopencorSet && e13.idType === "pmr_path" ? (openBlock(), createElementBlock("div", Sk, [ createVNode(u, { size: "small", onClick: r[3] || (r[3] = (f) => i.viewWorkspace()) }, { default: withCtx(() => [...r[8] || (r[8] = [ createTextVNode("View Workspace", -1) ])]), _: 1 }) ])) : createCommentVNode("", true), e13.uuid ? (openBlock(), createElementBlock("p", Ck, "Additional parameters are available on oSPARC")) : createCommentVNode("", true) ]), withDirectives(createBaseVNode("div", Mk, [ (openBlock(true), createElementBlock(Fragment, null, renderList(e13.simulationUiInfo.output.plots, (f, d) => (openBlock(), createBlock(s, { key: `output-${d}`, metadata: i.plotMetadata(d), "data-source": { data: e13.simulationResults[d] }, plotLayout: e13.layout[d], plotType: "plotly-only", selectorUi: false }, null, 8, ["metadata", "data-source", "plotLayout"]))), 128)) ], 512), [ [vShow, e13.isSimulationValid] ]), withDirectives(createBaseVNode("div", _k, [ createBaseVNode("p", Fk, [ r[10] || (r[10] = createBaseVNode("span", { class: "error" }, "Error:", -1)), r[11] || (r[11] = createTextVNode()), createBaseVNode("span", { innerHTML: e13.errorMessage }, null, 8, Tk), r[12] || (r[12] = createTextVNode(".", -1)) ]) ], 512), [ [vShow, !e13.isSimulationValid] ]) ])) : createCommentVNode("", true) ], 8, gk)), [ [c, e13.showUserMessage] ]); } var Rk = a1(hk, [["render", Ok], ["__scopeId", "data-v-295b46c4"]]); export { Rk as SimulationVuer }; /*! Bundled license information: @abi-software/simulationvuer/dist/simulationvuer.js: (** * @vue/shared v3.5.20 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **) (*! Element Plus Icons Vue v2.3.2 *) (*! * 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 *) (** * @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. **) */ //# sourceMappingURL=@abi-software_simulationvuer.js.map