@abi-software/simulationvuer 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -79,7 +79,7 @@ q: `+this.q.toString():"")+`
79
79
  `),B.seealso&&B.seealso.length&&(C+="See also: "+B.seealso.join(", ")+`
80
80
  `),C},I.prototype.toJSON=function(){var B=TA(this.doc);return B.mathjs="Help",B},I.fromJSON=function(B){var C={};return Object.keys(B).filter(Q=>Q!=="mathjs").forEach(Q=>{C[Q]=B[Q]}),new I(C)},I.prototype.valueOf=I.prototype.toString,I},{isClass:!0}),Vx="Chain",qx=["?on","math","typed"],Ox=T(Vx,qx,A=>{var{on:g,math:I,typed:B}=A;function C(i){if(!(this instanceof C))throw new SyntaxError("Constructor must be called with the new operator");Bw(i)?this.value=i.value:this.value=i}C.prototype.type="Chain",C.prototype.isChain=!0,C.prototype.done=function(){return this.value},C.prototype.valueOf=function(){return this.value},C.prototype.toString=function(){return Qg(this.value)},C.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},C.fromJSON=function(i){return new C(i.value)};function Q(i,o){typeof o=="function"&&(C.prototype[i]=w(o))}function E(i,o){ki(C.prototype,i,function(){var y=o();if(typeof y=="function")return w(y)})}function w(i){return function(){if(arguments.length===0)return new C(i(this.value));for(var o=[this.value],s=0;s<arguments.length;s++)o[s+1]=arguments[s];if(B.isTypedFunction(i)){var y=B.resolve(i,o);if(y.params.length===1)throw new Error("chain function "+i.name+" cannot match rest parameter between chain value and additional arguments.");return new C(y.implementation.apply(i,o))}return new C(i.apply(i,o))}}C.createProxy=function(i,o){if(typeof i=="string")Q(i,o);else{var s=function(N){mA(i,N)&&D[N]===void 0&&E(N,()=>i[N])};for(var y in i)s(y)}};var D={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return C.createProxy(I),g&&g("import",function(i,o,s){s||E(i,o)}),C},{isClass:!0}),UM={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"]},Tx={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},jx={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:[]},Xx={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:[]},zx={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},Px={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},_x={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:[]},$x={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:[]},Av={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},gv={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},Iv={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:[]},nM={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"]},Bv={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:[]},Cv={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},Qv={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"]},Ev={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},iv={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},ov={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"]},Dv={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"]},wv={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"]},sv={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"]},yv={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"]},av={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"]},Gv={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"]},Nv={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"]},Rv={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"]},ev={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"]},tv={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"]},Mv={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"]},Kv={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"]},Fv={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:[]},cv={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:[]},rv={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:[]},Sv={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"]},Lv={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"]},Uv={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"]},nv={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"]},hv={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"]},Yv={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"]},Jv={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"]},kv={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"]},lv={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"]},Hv={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"]},dv={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"]},bv={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"]},uv={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"]},mv={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"]},Zv={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"]},pv={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"]},fv={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"]},Wv={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},xv={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"]},vv={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"]},Vv={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"]},qv={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"]},Ov={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"]},Tv={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"]},jv={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"]},Xv={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"]},zv={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"]},Pv={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"]},_v={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"]},$v={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"]},AV={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"]},gV={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"]},IV={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},BV={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"]},CV={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"]},QV={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"]},EV={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"]},iV={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"]},oV={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"]},DV={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"]},wV={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"]},sV={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")']},yV={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"]},aV={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"]},GV={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"]},NV={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"]},RV={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"]},eV={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"]},tV={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"]},MV={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"]},KV={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"]},FV={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"]},cV={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"]},rV={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"]},SV={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"]},LV={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},UV={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"]},nV={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"]},hV={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"]},YV={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"]},JV={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"]},kV={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"]},lV={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"]},HV={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"]},dV={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"]},bV={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"]},uV={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"]},mV={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"]},ZV={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"]},pV={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"]},fV={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"]},WV={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"]},xV={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:[]},vV={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},VV={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:[]},qV={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:[]},OV={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"]},TV={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"]},jV={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"]},XV={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"]},zV={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"]},PV={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"]},_V={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"]},$V={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"]},Aq={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"]},gq={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"]},Iq={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"]},Bq={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 indicant 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"]},Cq={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"]},Qq={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"]},Eq={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"]},iq={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"]},oq={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"]},Dq={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"]},wq={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"]},sq={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"]},yq={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"]},aq={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"]},Gq={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]},Nq={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"]},Rq={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"]},eq={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"]},tq={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"]},Mq={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"]},Kq={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"]},Fq={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"]},cq={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"]},rq={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"]},Sq={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"]},Lq={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"]},Uq={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"]},nq={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"]},hq={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"]},Yq={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"]},Jq={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"]},kq={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"]},lq={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"]},Hq={name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},dq={name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},bq={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"]},uq={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"]},mq={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"]},Zq={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"]},pq={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"]},fq={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:[]},Wq={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"]},xq={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"]},vq={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"]},Vq={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"]},qq={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"]},Oq={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"]},Tq={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"]},jq={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"]},Xq={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"]},zq={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"]},Pq={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"]},_q={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"]},$q={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"]},AO={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"]},gO={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"]},IO={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"]},BO={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"]},CO={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"]},QO={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"]},EO={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"]},iO={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"]},oO={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"]},DO={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"]},wO={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"]},sO={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"]},yO={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"]},aO={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:[]},GO={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:[]},NO={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:[]},RO={name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]},eO={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"]},tO={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"]},MO={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"]},KO={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"]},FO={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"]},cO={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"]},rO={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"]},SO={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 probablity are: Number, BigNumber.
81
81
 
82
- 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"]},LO={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"]},UO={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"]},nO={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"]},hO={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"]},YO={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"]},JO={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"]},kO={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"]},lO={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"]},HO={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent 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"]},dO={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"]},bO={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},uO={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"]},mO={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},ZO={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"]},pO={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"]},fO={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"]},WO={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"]},xO={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"]},vO={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"]},VO={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},qO={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"]},OO={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"]},TO={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"]},jO={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"]},XO={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"]},zO={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"]},PO={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"]},_O={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},$O={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"]},A3={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"]},g3={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:[]},I3={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},B3={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:[]},C3={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"]},Q3={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"]},E3={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},i3={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"]},o3={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"]},D3={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"]},w3={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"]},s3={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"]},y3={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"]},a3={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"]},G3={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"]},N3={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},R3={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"]},e3={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"]},t3={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"]},M3={bignumber:ov,bigint:Dv,boolean:wv,complex:sv,createUnit:yv,fraction:av,index:Gv,matrix:Nv,number:Rv,sparse:ev,splitUnit:tv,string:Mv,unit:Kv,e:UM,E:UM,false:Tx,i:jx,Infinity:Xx,LN2:Px,LN10:zx,LOG2E:$x,LOG10E:_x,NaN:Av,null:gv,pi:nM,PI:nM,phi:Iv,SQRT1_2:Bv,SQRT2:Cv,tau:Qv,true:Ev,version:iv,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:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh 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"]},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"]},derivative:Sv,lsolve:Uv,lsolveAll:nv,lup:hv,lusolve:Yv,leafCount:Lv,polynomialRoot:Jv,resolve:Hv,simplify:dv,simplifyConstant:bv,simplifyCore:uv,symbolicEqual:Zv,rationalize:lv,slu:mv,usolve:pv,usolveAll:fv,qr:kv,abs:Wv,add:xv,cbrt:vv,ceil:Vv,cube:qv,divide:Ov,dotDivide:Tv,dotMultiply:jv,dotPow:Xv,exp:zv,expm:Pv,expm1:_v,fix:$v,floor:AV,gcd:gV,hypot:IV,lcm:CV,log:QV,log2:oV,log1p:iV,log10:EV,mod:DV,multiply:wV,norm:sV,nthRoot:yV,nthRoots:aV,pow:GV,round:NV,sign:RV,sqrt:eV,sqrtm:tV,square:cV,subtract:rV,unaryMinus:SV,unaryPlus:LV,xgcd:UV,invmod:BV,bitAnd:nV,bitNot:hV,bitOr:YV,bitXor:JV,leftShift:kV,rightArithShift:lV,rightLogShift:HV,bellNumbers:dV,catalan:bV,composition:uV,stirlingS2:mV,config:Fv,import:cv,typed:rv,arg:ZV,conj:pV,re:WV,im:fV,evaluate:xV,help:vV,distance:VV,intersect:qV,and:OV,not:TV,or:jV,xor:XV,concat:PV,count:_V,cross:$V,column:zV,ctranspose:Aq,det:gq,diag:Iq,diff:Bq,dot:Cq,getMatrixDataType:Dq,identity:wq,filter:Eq,flatten:iq,forEach:oq,inv:sq,pinv:yq,eigs:Qq,kron:aq,matrixFromFunction:Rq,matrixFromRows:eq,matrixFromColumns:Nq,map:Gq,ones:tq,partitionSelect:Mq,range:Kq,resize:cq,reshape:Fq,rotate:rq,rotationMatrix:Sq,row:Lq,size:Uq,sort:nq,squeeze:hq,subset:Yq,trace:Jq,transpose:kq,zeros:lq,fft:Hq,ifft:dq,sylvester:MV,schur:KV,lyap:FV,solveODE:t3,combinations:bq,combinationsWithRep:uq,factorial:mq,gamma:Zq,kldivergence:fq,lgamma:pq,multinomial:Wq,permutations:xq,pickRandom:vq,random:Vq,randomInt:qq,compare:Oq,compareNatural:Tq,compareText:jq,deepEqual:Xq,equal:zq,equalText:Pq,larger:_q,largerEq:$q,smaller:AO,smallerEq:gO,unequal:IO,setCartesian:BO,setDifference:CO,setDistinct:QO,setIntersect:EO,setIsSubset:iO,setMultiplicity:oO,setPowerset:DO,setSize:wO,setSymDifference:sO,setUnion:yO,zpk2tf:aO,freqz:GO,erf:NO,zeta:RO,cumsum:UO,mad:eO,max:tO,mean:MO,median:KO,min:FO,mode:cO,prod:rO,quantileSeq:SO,std:LO,sum:nO,variance:hO,corr:YO,acos:JO,acosh:kO,acot:lO,acoth:HO,acsc:dO,acsch:bO,asec:uO,asech:mO,asin:ZO,asinh:pO,atan:fO,atanh:xO,atan2:WO,cos:vO,cosh:VO,cot:qO,coth:OO,csc:TO,csch:jO,sec:XO,sech:zO,sin:PO,sinh:_O,tan:$O,tanh:A3,to:g3,clone:B3,format:C3,bin:I3,oct:N3,hex:E3,isNaN:o3,isInteger:i3,isNegative:D3,isNumeric:w3,hasNumericValue:Q3,isPositive:s3,isPrime:y3,isZero:a3,print:R3,typeOf:e3,numeric:G3},hM="help",K3=["typed","mathWithTransform","Help"],F3=T(hM,K3,A=>{var{typed:g,mathWithTransform:I,Help:B}=A;return g(hM,{any:function(Q){var E,w=Q;if(typeof Q!="string"){for(E in I)if(mA(I,E)&&Q===I[E]){w=E;break}}var D=eI(M3,w);if(!D){var i=typeof w=="function"?w.name:w;throw new Error('No documentation found on "'+i+'"')}return new B(D)}})}),YM="chain",c3=["typed","Chain"],r3=T(YM,c3,A=>{var{typed:g,Chain:I}=A;return g(YM,{"":function(){return new I},any:function(C){return new I(C)}})}),JM="det",S3=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],L3=T(JM,S3,A=>{var{typed:g,matrix:I,subtractScalar:B,multiply:C,divideScalar:Q,isZero:E,unaryMinus:w}=A;return g(JM,{any:function(o){return TA(o)},"Array | Matrix":function(o){var s;switch(qA(o)?s=o.size():Array.isArray(o)?(o=I(o),s=o.size()):s=[],s.length){case 0:return TA(o);case 1:if(s[0]===1)return TA(o.valueOf()[0]);if(s[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Qg(s)+")");case 2:{var y=s[0],a=s[1];if(y===a)return D(o.clone().valueOf(),y);if(a===0)return 1;throw new RangeError("Matrix must be square (size: "+Qg(s)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Qg(s)+")")}}});function D(i,o,s){if(o===1)return TA(i[0][0]);if(o===2)return B(C(i[0][0],i[1][1]),C(i[1][0],i[0][1]));for(var y=!1,a=new Array(o).fill(0).map((Y,h)=>h),N=0;N<o;N++){var e=a[N];if(E(i[e][N])){var F=void 0;for(F=N+1;F<o;F++)if(!E(i[a[F]][N])){e=a[F],a[F]=a[N],a[N]=e,y=!y;break}if(F===o)return i[e][N]}for(var K=i[e][N],U=N===0?1:i[a[N-1]][N-1],M=N+1;M<o;M++)for(var r=a[M],S=N+1;S<o;S++)i[r][S]=Q(B(C(i[r][S],K),C(i[r][N],i[e][S])),U)}var c=i[a[o-1]][o-1];return y?w(c):c}}),kM="inv",U3=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],n3=T(kM,U3,A=>{var{typed:g,matrix:I,divideScalar:B,addScalar:C,multiply:Q,unaryMinus:E,det:w,identity:D,abs:i}=A;return g(kM,{"Array | Matrix":function(y){var a=qA(y)?y.size():gg(y);switch(a.length){case 1:if(a[0]===1)return qA(y)?I([B(1,y.valueOf()[0])]):[B(1,y[0])];throw new RangeError("Matrix must be square (size: "+Qg(a)+")");case 2:{var N=a[0],e=a[1];if(N===e)return qA(y)?I(o(y.valueOf(),N,e),y.storage()):o(y,N,e);throw new RangeError("Matrix must be square (size: "+Qg(a)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Qg(a)+")")}},any:function(y){return B(1,y)}});function o(s,y,a){var N,e,F,K,U;if(y===1){if(K=s[0][0],K===0)throw Error("Cannot calculate inverse, determinant is zero");return[[B(1,K)]]}else if(y===2){var M=w(s);if(M===0)throw Error("Cannot calculate inverse, determinant is zero");return[[B(s[1][1],M),B(E(s[0][1]),M)],[B(E(s[1][0]),M),B(s[0][0],M)]]}else{var r=s.concat();for(N=0;N<y;N++)r[N]=r[N].concat();for(var S=D(y).valueOf(),c=0;c<a;c++){var Y=i(r[c][c]),h=c;for(N=c+1;N<y;)i(r[N][c])>Y&&(Y=i(r[N][c]),h=N),N++;if(Y===0)throw Error("Cannot calculate inverse, determinant is zero");N=h,N!==c&&(U=r[c],r[c]=r[N],r[N]=U,U=S[c],S[c]=S[N],S[N]=U);var n=r[c],J=S[c];for(N=0;N<y;N++){var H=r[N],b=S[N];if(N!==c){if(H[c]!==0){for(F=B(E(H[c]),n[c]),e=c;e<a;e++)H[e]=C(H[e],Q(F,n[e]));for(e=0;e<a;e++)b[e]=C(b[e],Q(F,J[e]))}}else{for(F=n[c],e=c;e<a;e++)H[e]=B(H[e],F);for(e=0;e<a;e++)b[e]=B(b[e],F)}}}return S}}}),lM="pinv",h3=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],Y3=T(lM,h3,A=>{var{typed:g,matrix:I,inv:B,deepEqual:C,equal:Q,dotDivide:E,dot:w,ctranspose:D,divideScalar:i,multiply:o,add:s,Complex:y}=A;return g(lM,{"Array | Matrix":function(M){var r=qA(M)?M.size():gg(M);switch(r.length){case 1:return K(M)?D(M):r[0]===1?B(M):E(D(M),w(M,M));case 2:{if(K(M))return D(M);var S=r[0],c=r[1];if(S===c)try{return B(M)}catch(Y){if(!(Y instanceof Error&&Y.message.match(/Cannot calculate inverse, determinant is zero/)))throw Y}return qA(M)?I(a(M.valueOf(),S,c),M.storage()):a(M,S,c)}default:throw new RangeError("Matrix must be two dimensional (size: "+Qg(r)+")")}},any:function(M){return Q(M,0)?TA(M):i(1,M)}});function a(U,M,r){var{C:S,F:c}=e(U,M,r),Y=o(B(o(D(S),S)),D(S)),h=o(D(c),B(o(c,D(c))));return o(h,Y)}function N(U,M,r){for(var S=TA(U),c=0,Y=0;Y<M;Y++){if(r<=c)return S;for(var h=Y;F(S[h][c]);)if(h++,M===h&&(h=Y,c++,r===c))return S;[S[h],S[Y]]=[S[Y],S[h]];for(var n=S[Y][c],J=0;J<r;J++)S[Y][J]=E(S[Y][J],n);for(var H=0;H<M;H++)if(H!==Y){n=S[H][c];for(var b=0;b<r;b++)S[H][b]=s(S[H][b],o(-1,o(n,S[Y][b])))}c++}return S}function e(U,M,r){var S=N(U,M,r),c=U.map((h,n)=>h.filter((J,H)=>H<M&&!F(w(S[H],S[H])))),Y=S.filter((h,n)=>!F(w(S[n],S[n])));return{C:c,F:Y}}function F(U){return Q(s(U,y(1,1)),s(0,y(1,1)))}function K(U){return C(s(U,y(1,1)),s(o(U,0),y(1,1)))}});function J3(A){var{addScalar:g,subtract:I,flatten:B,multiply:C,multiplyScalar:Q,divideScalar:E,sqrt:w,abs:D,bignumber:i,diag:o,size:s,reshape:y,inv:a,qr:N,usolve:e,usolveAll:F,equal:K,complex:U,larger:M,smaller:r,matrixFromColumns:S,dot:c}=A;function Y(z,v,iA,eA){var CA=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,sA=h(z,v,iA,eA,CA);n(z,v,iA,eA,CA,sA);var{values:GA,C:yA}=J(z,v,iA,eA,CA);if(CA){var aA=H(z,v,yA,sA,GA,iA,eA);return{values:GA,eigenvectors:aA}}return{values:GA}}function h(z,v,iA,eA,CA){var sA=eA==="BigNumber",GA=eA==="Complex",yA=sA?i(0):0,aA=sA?i(1):GA?U(1):1,NA=sA?i(1):1,KA=sA?i(10):2,UA=Q(KA,KA),HA;CA&&(HA=Array(v).fill(aA));for(var P=!1;!P;){P=!0;for(var IA=0;IA<v;IA++){for(var RA=yA,gA=yA,EA=0;EA<v;EA++)IA!==EA&&(RA=g(RA,D(z[EA][IA])),gA=g(gA,D(z[IA][EA])));if(!K(RA,0)&&!K(gA,0)){for(var wA=NA,cA=RA,rA=E(gA,KA),O=Q(gA,KA);r(cA,rA);)cA=Q(cA,UA),wA=Q(wA,KA);for(;M(cA,O);)cA=E(cA,UA),wA=E(wA,KA);var $=r(E(g(cA,gA),wA),Q(g(RA,gA),.95));if($){P=!1;for(var j=E(1,wA),oA=0;oA<v;oA++)IA!==oA&&(z[IA][oA]=Q(z[IA][oA],j),z[oA][IA]=Q(z[oA][IA],wA));CA&&(HA[IA]=Q(HA[IA],j))}}}}return CA?o(HA):null}function n(z,v,iA,eA,CA,sA){var GA=eA==="BigNumber",yA=eA==="Complex",aA=GA?i(0):yA?U(0):0;GA&&(iA=i(iA));for(var NA=0;NA<v-2;NA++){for(var KA=0,UA=aA,HA=NA+1;HA<v;HA++){var P=z[HA][NA];r(D(UA),D(P))&&(UA=P,KA=HA)}if(!r(D(UA),iA)){if(KA!==NA+1){var IA=z[KA];z[KA]=z[NA+1],z[NA+1]=IA;for(var RA=0;RA<v;RA++){var gA=z[RA][KA];z[RA][KA]=z[RA][NA+1],z[RA][NA+1]=gA}if(CA){var EA=sA[KA];sA[KA]=sA[NA+1],sA[NA+1]=EA}}for(var wA=NA+2;wA<v;wA++){var cA=E(z[wA][NA],UA);if(cA!==0){for(var rA=0;rA<v;rA++)z[wA][rA]=I(z[wA][rA],Q(cA,z[NA+1][rA]));for(var O=0;O<v;O++)z[O][NA+1]=g(z[O][NA+1],Q(cA,z[O][wA]));if(CA)for(var $=0;$<v;$++)sA[wA][$]=I(sA[wA][$],Q(cA,sA[NA+1][$]))}}}}return sA}function J(z,v,iA,eA,CA){var sA=eA==="BigNumber",GA=eA==="Complex",yA=sA?i(1):GA?U(1):1;sA&&(iA=i(iA));for(var aA=TA(z),NA=[],KA=v,UA=[],HA=CA?o(Array(v).fill(yA)):void 0,P=CA?o(Array(KA).fill(yA)):void 0,IA=0;IA<=100;){IA+=1;for(var RA=aA[KA-1][KA-1],gA=0;gA<KA;gA++)aA[gA][gA]=I(aA[gA][gA],RA);var{Q:EA,R:wA}=N(aA);aA=C(wA,EA);for(var cA=0;cA<KA;cA++)aA[cA][cA]=g(aA[cA][cA],RA);if(CA&&(P=C(P,EA)),KA===1||r(D(aA[KA-1][KA-2]),iA)){IA=0,NA.push(aA[KA-1][KA-1]),CA&&(UA.unshift([[1]]),f(P,v),HA=C(HA,P),KA>1&&(P=o(Array(KA-1).fill(yA)))),KA-=1,aA.pop();for(var rA=0;rA<KA;rA++)aA[rA].pop()}else if(KA===2||r(D(aA[KA-2][KA-3]),iA)){IA=0;var O=b(aA[KA-2][KA-2],aA[KA-2][KA-1],aA[KA-1][KA-2],aA[KA-1][KA-1]);NA.push(...O),CA&&(UA.unshift(x(aA[KA-2][KA-2],aA[KA-2][KA-1],aA[KA-1][KA-2],aA[KA-1][KA-1],O[0],O[1],iA,eA)),f(P,v),HA=C(HA,P),KA>2&&(P=o(Array(KA-2).fill(yA)))),KA-=2,aA.pop(),aA.pop();for(var $=0;$<KA;$++)aA[$].pop(),aA[$].pop()}if(KA===0)break}if(NA.sort((tA,FA)=>+I(D(tA),D(FA))),IA>100){var j=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+NA.join(", "));throw j.values=NA,j.vectors=[],j}var oA=CA?C(HA,m(UA,v)):void 0;return{values:NA,C:oA}}function H(z,v,iA,eA,CA,sA,GA){var yA=a(iA),aA=C(yA,z,iA),NA=GA==="BigNumber",KA=GA==="Complex",UA=NA?i(0):KA?U(0):0,HA=NA?i(1):KA?U(1):1,P=[],IA=[];for(var RA of CA){var gA=d(P,RA,K);gA===-1?(P.push(RA),IA.push(1)):IA[gA]+=1}for(var EA=[],wA=P.length,cA=Array(v).fill(UA),rA=o(Array(v).fill(HA)),O=function(){var oA=P[$],tA=I(aA,C(oA,rA)),FA=F(tA,cA);for(FA.shift();FA.length<IA[$];){var JA=l(tA,v,FA,sA,GA);if(JA===null)break;FA.push(JA)}var kA=C(a(eA),iA);FA=FA.map(dA=>C(kA,dA)),EA.push(...FA.map(dA=>({value:oA,vector:B(dA)})))},$=0;$<wA;$++)O();return EA}function b(z,v,iA,eA){var CA=g(z,eA),sA=I(Q(z,eA),Q(v,iA)),GA=Q(CA,.5),yA=Q(w(I(Q(CA,CA),Q(4,sA))),.5);return[g(GA,yA),I(GA,yA)]}function x(z,v,iA,eA,CA,sA,GA,yA){var aA=yA==="BigNumber",NA=yA==="Complex",KA=aA?i(0):NA?U(0):0,UA=aA?i(1):NA?U(1):1;if(r(D(iA),GA))return[[UA,KA],[KA,UA]];if(M(D(I(CA,sA)),GA))return[[I(CA,eA),I(sA,eA)],[iA,iA]];var HA=I(z,CA),P=I(eA,CA);return r(D(v),GA)&&r(D(P),GA)?[[HA,UA],[iA,KA]]:[[v,KA],[P,UA]]}function f(z,v){for(var iA=0;iA<z.length;iA++)z[iA].push(...Array(v-z[iA].length).fill(0));for(var eA=z.length;eA<v;eA++)z.push(Array(v).fill(0)),z[eA][eA]=1;return z}function m(z,v){for(var iA=[],eA=0;eA<v;eA++)iA[eA]=Array(v).fill(0);var CA=0;for(var sA of z){for(var GA=sA.length,yA=0;yA<GA;yA++)for(var aA=0;aA<GA;aA++)iA[CA+yA][CA+aA]=sA[yA][aA];CA+=GA}return iA}function d(z,v,iA){for(var eA=0;eA<z.length;eA++)if(iA(z[eA],v))return eA;return-1}function l(z,v,iA,eA,CA){for(var sA=CA==="BigNumber"?i(1e3):1e3,GA,yA=0;yA<5;++yA){GA=q(v,iA,CA);try{GA=e(z,GA)}catch{continue}if(M(_(GA),sA))break}if(yA>=5)return null;for(yA=0;;){var aA=e(z,GA);if(r(_(Z(GA,[aA])),eA))break;if(++yA>=10)return null;GA=BA(aA)}return GA}function q(z,v,iA){var eA=iA==="BigNumber",CA=iA==="Complex",sA=Array(z).fill(0).map(GA=>2*Math.random()-1);return eA&&(sA=sA.map(GA=>i(GA))),CA&&(sA=sA.map(GA=>U(GA))),sA=Z(sA,v),BA(sA,iA)}function Z(z,v){var iA=s(z);for(var eA of v)eA=y(eA,iA),z=I(z,C(E(c(eA,z),c(eA,eA)),eA));return z}function _(z){return D(w(c(z,z)))}function BA(z,v){var iA=v==="BigNumber",eA=v==="Complex",CA=iA?i(1):eA?U(1):1;return C(E(CA,_(z)),z)}return Y}function k3(A){var{config:g,addScalar:I,subtract:B,abs:C,atan:Q,cos:E,sin:w,multiplyScalar:D,inv:i,bignumber:o,multiply:s,add:y}=A;function a(n,J){var H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:g.relTol,b=arguments.length>3?arguments[3]:void 0,x=arguments.length>4?arguments[4]:void 0;if(b==="number")return N(n,H,x);if(b==="BigNumber")return e(n,H,x);throw TypeError("Unsupported data type: "+b)}function N(n,J,H){var b=n.length,x=Math.abs(J/b),f,m;if(H){m=new Array(b);for(var d=0;d<b;d++)m[d]=Array(b).fill(0),m[d][d]=1}for(var l=c(n);Math.abs(l[1])>=Math.abs(x);){var q=l[0][0],Z=l[0][1];f=F(n[q][q],n[Z][Z],n[q][Z]),n=S(n,f,q,Z),H&&(m=U(m,f,q,Z)),l=c(n)}for(var _=Array(b).fill(0),BA=0;BA<b;BA++)_[BA]=n[BA][BA];return h(TA(_),m,H)}function e(n,J,H){var b=n.length,x=C(J/b),f,m;if(H){m=new Array(b);for(var d=0;d<b;d++)m[d]=Array(b).fill(0),m[d][d]=1}for(var l=Y(n);C(l[1])>=C(x);){var q=l[0][0],Z=l[0][1];f=K(n[q][q],n[Z][Z],n[q][Z]),n=r(n,f,q,Z),H&&(m=M(m,f,q,Z)),l=Y(n)}for(var _=Array(b).fill(0),BA=0;BA<b;BA++)_[BA]=n[BA][BA];return h(TA(_),m,H)}function F(n,J,H){var b=J-n;return Math.abs(b)<=g.relTol?Math.PI/4:.5*Math.atan(2*H/(J-n))}function K(n,J,H){var b=B(J,n);return C(b)<=g.relTol?o(-1).acos().div(4):D(.5,Q(s(2,H,i(b))))}function U(n,J,H,b){for(var x=n.length,f=Math.cos(J),m=Math.sin(J),d=Array(x).fill(0),l=Array(x).fill(0),q=0;q<x;q++)d[q]=f*n[q][H]-m*n[q][b],l[q]=m*n[q][H]+f*n[q][b];for(var Z=0;Z<x;Z++)n[Z][H]=d[Z],n[Z][b]=l[Z];return n}function M(n,J,H,b){for(var x=n.length,f=E(J),m=w(J),d=Array(x).fill(o(0)),l=Array(x).fill(o(0)),q=0;q<x;q++)d[q]=B(D(f,n[q][H]),D(m,n[q][b])),l[q]=I(D(m,n[q][H]),D(f,n[q][b]));for(var Z=0;Z<x;Z++)n[Z][H]=d[Z],n[Z][b]=l[Z];return n}function r(n,J,H,b){for(var x=n.length,f=o(E(J)),m=o(w(J)),d=D(f,f),l=D(m,m),q=Array(x).fill(o(0)),Z=Array(x).fill(o(0)),_=s(o(2),f,m,n[H][b]),BA=I(B(D(d,n[H][H]),_),D(l,n[b][b])),z=y(D(l,n[H][H]),_,D(d,n[b][b])),v=0;v<x;v++)q[v]=B(D(f,n[H][v]),D(m,n[b][v])),Z[v]=I(D(m,n[H][v]),D(f,n[b][v]));n[H][H]=BA,n[b][b]=z,n[H][b]=o(0),n[b][H]=o(0);for(var iA=0;iA<x;iA++)iA!==H&&iA!==b&&(n[H][iA]=q[iA],n[iA][H]=q[iA],n[b][iA]=Z[iA],n[iA][b]=Z[iA]);return n}function S(n,J,H,b){for(var x=n.length,f=Math.cos(J),m=Math.sin(J),d=f*f,l=m*m,q=Array(x).fill(0),Z=Array(x).fill(0),_=d*n[H][H]-2*f*m*n[H][b]+l*n[b][b],BA=l*n[H][H]+2*f*m*n[H][b]+d*n[b][b],z=0;z<x;z++)q[z]=f*n[H][z]-m*n[b][z],Z[z]=m*n[H][z]+f*n[b][z];n[H][H]=_,n[b][b]=BA,n[H][b]=0,n[b][H]=0;for(var v=0;v<x;v++)v!==H&&v!==b&&(n[H][v]=q[v],n[v][H]=q[v],n[b][v]=Z[v],n[v][b]=Z[v]);return n}function c(n){for(var J=n.length,H=0,b=[0,1],x=0;x<J;x++)for(var f=x+1;f<J;f++)Math.abs(H)<Math.abs(n[x][f])&&(H=Math.abs(n[x][f]),b=[x,f]);return[b,H]}function Y(n){for(var J=n.length,H=0,b=[0,1],x=0;x<J;x++)for(var f=x+1;f<J;f++)C(H)<C(n[x][f])&&(H=C(n[x][f]),b=[x,f]);return[b,H]}function h(n,J,H){var b=n.length,x=Array(b),f;if(H){f=Array(b);for(var m=0;m<b;m++)f[m]=Array(b)}for(var d=0;d<b;d++){for(var l=0,q=n[0],Z=0;Z<n.length;Z++)C(n[Z])<C(q)&&(l=Z,q=n[l]);if(x[d]=n.splice(l,1)[0],H)for(var _=0;_<b;_++)f[d][_]=J[_][l],J[_].splice(l,1)}if(!H)return{values:x};var BA=f.map((z,v)=>({value:x[v],vector:z}));return{values:x,eigenvectors:BA}}return a}var l3="eigs",H3=["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"],d3=T(l3,H3,A=>{var{config:g,typed:I,matrix:B,addScalar:C,subtract:Q,equal:E,abs:w,atan:D,cos:i,sin:o,multiplyScalar:s,divideScalar:y,inv:a,bignumber:N,multiply:e,add:F,larger:K,column:U,flatten:M,number:r,complex:S,sqrt:c,diag:Y,size:h,reshape:n,qr:J,usolve:H,usolveAll:b,im:x,re:f,smaller:m,matrixFromColumns:d,dot:l}=A,q=k3({config:g,addScalar:C,subtract:Q,column:U,flatten:M,equal:E,abs:w,atan:D,cos:i,sin:o,multiplyScalar:s,inv:a,bignumber:N,complex:S,multiply:e,add:F}),Z=J3({config:g,addScalar:C,subtract:Q,multiply:e,multiplyScalar:s,flatten:M,divideScalar:y,sqrt:c,abs:w,bignumber:N,diag:Y,size:h,reshape:n,qr:J,inv:a,usolve:H,usolveAll:b,equal:E,complex:S,larger:K,smaller:m,matrixFromColumns:d,dot:l});return I("eigs",{Array:function(sA){return _(B(sA))},"Array, number|BigNumber":function(sA,GA){return _(B(sA),{precision:GA})},"Array, Object"(CA,sA){return _(B(CA),sA)},Matrix:function(sA){return _(sA,{matricize:!0})},"Matrix, number|BigNumber":function(sA,GA){return _(sA,{precision:GA,matricize:!0})},"Matrix, Object":function(sA,GA){var yA={matricize:!0};return wI(yA,GA),_(sA,yA)}});function _(CA){var sA,GA=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},yA="eigenvectors"in GA?GA.eigenvectors:!0,aA=(sA=GA.precision)!==null&&sA!==void 0?sA:g.relTol,NA=BA(CA,aA,yA);return GA.matricize&&(NA.values=B(NA.values),yA&&(NA.eigenvectors=NA.eigenvectors.map(KA=>{var{value:UA,vector:HA}=KA;return{value:UA,vector:B(HA)}}))),yA&&Object.defineProperty(NA,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),NA}function BA(CA,sA,GA){var yA=CA.toArray(),aA=CA.size();if(aA.length!==2||aA[0]!==aA[1])throw new RangeError("Matrix must be square (size: ".concat(Qg(aA),")"));var NA=aA[0];if(v(yA,NA,sA)&&(iA(yA,NA),z(yA,NA,sA))){var KA=eA(CA,yA,NA);return q(yA,NA,sA,KA,GA)}var UA=eA(CA,yA,NA);return Z(yA,NA,sA,UA,GA)}function z(CA,sA,GA){for(var yA=0;yA<sA;yA++)for(var aA=yA;aA<sA;aA++)if(K(N(w(Q(CA[yA][aA],CA[aA][yA]))),GA))return!1;return!0}function v(CA,sA,GA){for(var yA=0;yA<sA;yA++)for(var aA=0;aA<sA;aA++)if(K(N(w(x(CA[yA][aA]))),GA))return!1;return!0}function iA(CA,sA){for(var GA=0;GA<sA;GA++)for(var yA=0;yA<sA;yA++)CA[GA][yA]=f(CA[GA][yA])}function eA(CA,sA,GA){var yA=CA.datatype();if(yA==="number"||yA==="BigNumber"||yA==="Complex")return yA;for(var aA=!1,NA=!1,KA=!1,UA=0;UA<GA;UA++)for(var HA=0;HA<GA;HA++){var P=sA[UA][HA];if(Ag(P)||YC(P))aA=!0;else if(PA(P))NA=!0;else if(AB(P))KA=!0;else throw TypeError("Unsupported type in Matrix: "+Mg(P))}if(NA&&KA&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),KA){for(var IA=0;IA<GA;IA++)for(var RA=0;RA<GA;RA++)sA[IA][RA]=S(sA[IA][RA]);return"Complex"}if(NA){for(var gA=0;gA<GA;gA++)for(var EA=0;EA<GA;EA++)sA[gA][EA]=N(sA[gA][EA]);return"BigNumber"}if(aA){for(var wA=0;wA<GA;wA++)for(var cA=0;cA<GA;cA++)sA[wA][cA]=r(sA[wA][cA]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}}),HM="expm",b3=["typed","abs","add","identity","inv","multiply"],u3=T(HM,b3,A=>{var{typed:g,abs:I,add:B,identity:C,inv:Q,multiply:E}=A;return g(HM,{Matrix:function(s){var y=s.size();if(y.length!==2||y[0]!==y[1])throw new RangeError("Matrix must be square (size: "+Qg(y)+")");for(var a=y[0],N=1e-15,e=w(s),F=D(e,N),K=F.q,U=F.j,M=E(s,Math.pow(2,-U)),r=C(a),S=C(a),c=1,Y=M,h=-1,n=1;n<=K;n++)n>1&&(Y=E(Y,M),h=-h),c=c*(K-n+1)/((2*K-n+1)*n),r=B(r,E(c,Y)),S=B(S,E(c*h,Y));for(var J=E(Q(S),r),H=0;H<U;H++)J=E(J,J);return IC(s)?s.createSparseMatrix(J):J}});function w(o){for(var s=o.size()[0],y=0,a=0;a<s;a++){for(var N=0,e=0;e<s;e++)N+=I(o.get([a,e]));y=Math.max(N,y)}return y}function D(o,s){for(var y=30,a=0;a<y;a++)for(var N=0;N<=a;N++){var e=a-N;if(i(o,N,e)<s)return{q:N,j:e}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function i(o,s,y){for(var a=1,N=2;N<=s;N++)a*=N;for(var e=a,F=s+1;F<=2*s;F++)e*=F;var K=e*(2*s+1);return 8*Math.pow(o/Math.pow(2,y),2*s)*a*a/(e*K)}}),dM="sqrtm",m3=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],Z3=T(dM,m3,A=>{var{typed:g,abs:I,add:B,multiply:C,map:Q,sqrt:E,subtract:w,inv:D,size:i,max:o,identity:s}=A,y=1e3,a=1e-6;function N(e){var F,K=0,U=e,M=s(i(e));do{var r=U;if(U=C(.5,B(r,D(M))),M=C(.5,B(M,D(r))),F=o(I(w(U,r))),F>a&&++K>y)throw new Error("computing square root of matrix: iterative method could not converge")}while(F>a);return U}return g(dM,{"Array | Matrix":function(F){var K=qA(F)?F.size():gg(F);switch(K.length){case 1:if(K[0]===1)return Q(F,E);throw new RangeError("Matrix must be square (size: "+Qg(K)+")");case 2:{var U=K[0],M=K[1];if(U===M)return N(F);throw new RangeError("Matrix must be square (size: "+Qg(K)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Qg(K)+")")}}})}),bM="sylvester",p3=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],f3=T(bM,p3,A=>{var{typed:g,schur:I,matrixFromColumns:B,matrix:C,multiply:Q,range:E,concat:w,transpose:D,index:i,subset:o,add:s,subtract:y,identity:a,lusolve:N,abs:e}=A;return g(bM,{"Matrix, Matrix, Matrix":F,"Array, Matrix, Matrix":function(U,M,r){return F(C(U),M,r)},"Array, Array, Matrix":function(U,M,r){return F(C(U),C(M),r)},"Array, Matrix, Array":function(U,M,r){return F(C(U),M,C(r))},"Matrix, Array, Matrix":function(U,M,r){return F(U,C(M),r)},"Matrix, Array, Array":function(U,M,r){return F(U,C(M),C(r))},"Matrix, Matrix, Array":function(U,M,r){return F(U,M,C(r))},"Array, Array, Array":function(U,M,r){return F(C(U),C(M),C(r)).toArray()}});function F(K,U,M){for(var r=U.size()[0],S=K.size()[0],c=I(K),Y=c.T,h=c.U,n=I(Q(-1,U)),J=n.T,H=n.U,b=Q(Q(D(h),M),H),x=E(0,S),f=[],m=(KA,UA)=>w(KA,UA,1),d=(KA,UA)=>w(KA,UA,0),l=0;l<r;l++)if(l<r-1&&e(o(J,i(l+1,l)))>1e-5){for(var q=d(o(b,i(x,l)),o(b,i(x,l+1))),Z=0;Z<l;Z++)q=s(q,d(Q(f[Z],o(J,i(Z,l))),Q(f[Z],o(J,i(Z,l+1)))));var _=Q(a(S),Q(-1,o(J,i(l,l)))),BA=Q(a(S),Q(-1,o(J,i(l+1,l)))),z=Q(a(S),Q(-1,o(J,i(l,l+1)))),v=Q(a(S),Q(-1,o(J,i(l+1,l+1)))),iA=d(m(s(Y,_),BA),m(z,s(Y,v))),eA=N(iA,q);f[l]=eA.subset(i(E(0,S),0)),f[l+1]=eA.subset(i(E(S,2*S),0)),l++}else{for(var CA=o(b,i(x,l)),sA=0;sA<l;sA++)CA=s(CA,Q(f[sA],o(J,i(sA,l))));var GA=o(J,i(l,l)),yA=y(Y,Q(GA,a(S)));f[l]=N(yA,CA)}var aA=C(B(...f)),NA=Q(h,Q(aA,D(H)));return NA}}),uM="schur",W3=["typed","matrix","identity","multiply","qr","norm","subtract"],x3=T(uM,W3,A=>{var{typed:g,matrix:I,identity:B,multiply:C,qr:Q,norm:E,subtract:w}=A;return g(uM,{Array:function(o){var s=D(I(o));return{U:s.U.valueOf(),T:s.T.valueOf()}},Matrix:function(o){return D(o)}});function D(i){var o=i.size()[0],s=i,y=B(o),a=0,N;do{N=s;var e=Q(s),F=e.Q,K=e.R;if(s=C(K,F),y=C(y,F),a++>100)break}while(E(w(s,N))>1e-4);return{U:y,T:s}}}),mM="lyap",v3=["typed","matrix","sylvester","multiply","transpose"],V3=T(mM,v3,A=>{var{typed:g,matrix:I,sylvester:B,multiply:C,transpose:Q}=A;return g(mM,{"Matrix, Matrix":function(w,D){return B(w,Q(w),C(-1,D))},"Array, Matrix":function(w,D){return B(I(w),Q(I(w)),C(-1,D))},"Matrix, Array":function(w,D){return B(w,Q(I(w)),I(C(-1,D)))},"Array, Array":function(w,D){return B(I(w),Q(I(w)),I(C(-1,D))).toArray()}})}),q3="divide",O3=["typed","matrix","multiply","equalScalar","divideScalar","inv"],T3=T(q3,O3,A=>{var{typed:g,matrix:I,multiply:B,equalScalar:C,divideScalar:Q,inv:E}=A,w=EI({typed:g,equalScalar:C}),D=CB({typed:g});return g("divide",A0({"Array | Matrix, Array | Matrix":function(o,s){return B(o,E(s))},"DenseMatrix, any":function(o,s){return D(o,s,Q,!1)},"SparseMatrix, any":function(o,s){return w(o,s,Q,!1)},"Array, any":function(o,s){return D(I(o),s,Q,!1).valueOf()},"any, Array | Matrix":function(o,s){return B(o,E(s))}},Q.signatures))}),ZM="distance",j3=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],X3=T(ZM,j3,A=>{var{typed:g,addScalar:I,subtractScalar:B,multiplyScalar:C,divideScalar:Q,deepEqual:E,sqrt:w,abs:D}=A;return g(ZM,{"Array, Array, Array":function(S,c,Y){if(S.length===2&&c.length===2&&Y.length===2){if(!o(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!o(c))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!o(Y))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(E(c,Y))throw new TypeError("LinePoint1 should not be same with LinePoint2");var h=B(Y[1],c[1]),n=B(c[0],Y[0]),J=B(C(Y[0],c[1]),C(c[0],Y[1]));return F(S[0],S[1],h,n,J)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(S,c,Y){if(Object.keys(S).length===2&&Object.keys(c).length===2&&Object.keys(Y).length===2){if(!o(S))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!o(c))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!o(Y))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(E(N(c),N(Y)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in S&&"pointY"in S&&"lineOnePtX"in c&&"lineOnePtY"in c&&"lineTwoPtX"in Y&&"lineTwoPtY"in Y){var h=B(Y.lineTwoPtY,c.lineOnePtY),n=B(c.lineOnePtX,Y.lineTwoPtX),J=B(C(Y.lineTwoPtX,c.lineOnePtY),C(c.lineOnePtX,Y.lineTwoPtY));return F(S.pointX,S.pointY,h,n,J)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(S,c){if(S.length===2&&c.length===3){if(!o(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!s(c))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return F(S[0],S[1],c[0],c[1],c[2])}else if(S.length===3&&c.length===6){if(!s(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!a(c))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return K(S[0],S[1],S[2],c[0],c[1],c[2],c[3],c[4],c[5])}else if(S.length===c.length&&S.length>0){if(!y(S))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!y(c))throw new TypeError("All values of an array should be numbers or BigNumbers");return U(S,c)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(S,c){if(Object.keys(S).length===2&&Object.keys(c).length===3){if(!o(S))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!s(c))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in S&&"pointY"in S&&"xCoeffLine"in c&&"yCoeffLine"in c&&"constant"in c)return F(S.pointX,S.pointY,c.xCoeffLine,c.yCoeffLine,c.constant);throw new TypeError("Key names do not match")}else if(Object.keys(S).length===3&&Object.keys(c).length===6){if(!s(S))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!a(c))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in S&&"pointY"in S&&"x0"in c&&"y0"in c&&"z0"in c&&"a"in c&&"b"in c&&"c"in c)return K(S.pointX,S.pointY,S.pointZ,c.x0,c.y0,c.z0,c.a,c.b,c.c);throw new TypeError("Key names do not match")}else if(Object.keys(S).length===2&&Object.keys(c).length===2){if(!o(S))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!o(c))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in S&&"pointOneY"in S&&"pointTwoX"in c&&"pointTwoY"in c)return U([S.pointOneX,S.pointOneY],[c.pointTwoX,c.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(S).length===3&&Object.keys(c).length===3){if(!s(S))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!s(c))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in S&&"pointOneY"in S&&"pointOneZ"in S&&"pointTwoX"in c&&"pointTwoY"in c&&"pointTwoZ"in c)return U([S.pointOneX,S.pointOneY,S.pointOneZ],[c.pointTwoX,c.pointTwoY,c.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(S){if(!e(S))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return M(S)}});function i(r){return typeof r=="number"||PA(r)}function o(r){return r.constructor!==Array&&(r=N(r)),i(r[0])&&i(r[1])}function s(r){return r.constructor!==Array&&(r=N(r)),i(r[0])&&i(r[1])&&i(r[2])}function y(r){return Array.isArray(r)||(r=N(r)),r.every(i)}function a(r){return r.constructor!==Array&&(r=N(r)),i(r[0])&&i(r[1])&&i(r[2])&&i(r[3])&&i(r[4])&&i(r[5])}function N(r){for(var S=Object.keys(r),c=[],Y=0;Y<S.length;Y++)c.push(r[S[Y]]);return c}function e(r){if(r[0].length===2&&i(r[0][0])&&i(r[0][1])){if(r.some(S=>S.length!==2||!i(S[0])||!i(S[1])))return!1}else if(r[0].length===3&&i(r[0][0])&&i(r[0][1])&&i(r[0][2])){if(r.some(S=>S.length!==3||!i(S[0])||!i(S[1])||!i(S[2])))return!1}else return!1;return!0}function F(r,S,c,Y,h){var n=D(I(I(C(c,r),C(Y,S)),h)),J=w(I(C(c,c),C(Y,Y)));return Q(n,J)}function K(r,S,c,Y,h,n,J,H,b){var x=[B(C(B(h,S),b),C(B(n,c),H)),B(C(B(n,c),J),C(B(Y,r),b)),B(C(B(Y,r),H),C(B(h,S),J))];x=w(I(I(C(x[0],x[0]),C(x[1],x[1])),C(x[2],x[2])));var f=w(I(I(C(J,J),C(H,H)),C(b,b)));return Q(x,f)}function U(r,S){for(var c=r.length,Y=0,h=0,n=0;n<c;n++)h=B(r[n],S[n]),Y=I(C(h,h),Y);return w(Y)}function M(r){for(var S=[],c=[],Y=[],h=0;h<r.length-1;h++)for(var n=h+1;n<r.length;n++)r[0].length===2?(c=[r[h][0],r[h][1]],Y=[r[n][0],r[n][1]]):r[0].length===3&&(c=[r[h][0],r[h][1],r[h][2]],Y=[r[n][0],r[n][1],r[n][2]]),S.push(U(c,Y));return S}}),z3="intersect",P3=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],_3=T(z3,P3,A=>{var{typed:g,config:I,abs:B,add:C,addScalar:Q,matrix:E,multiply:w,multiplyScalar:D,divideScalar:i,subtract:o,smaller:s,equalScalar:y,flatten:a,isZero:N,isNumeric:e}=A;return g("intersect",{"Array, Array, Array":F,"Array, Array, Array, Array":K,"Matrix, Matrix, Matrix":function(H,b,x){var f=F(H.valueOf(),b.valueOf(),x.valueOf());return f===null?null:E(f)},"Matrix, Matrix, Matrix, Matrix":function(H,b,x,f){var m=K(H.valueOf(),b.valueOf(),x.valueOf(),f.valueOf());return m===null?null:E(m)}});function F(J,H,b){if(J=U(J),H=U(H),b=U(b),!r(J))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!r(H))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!S(b))throw new TypeError("Array with 4 numbers expected as third argument");return n(J[0],J[1],J[2],H[0],H[1],H[2],b[0],b[1],b[2],b[3])}function K(J,H,b,x){if(J=U(J),H=U(H),b=U(b),x=U(x),J.length===2){if(!M(J))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!M(H))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!M(b))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!M(x))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return c(J,H,b,x)}else if(J.length===3){if(!r(J))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!r(H))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!r(b))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!r(x))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return h(J[0],J[1],J[2],H[0],H[1],H[2],b[0],b[1],b[2],x[0],x[1],x[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function U(J){return J.length===1?J[0]:J.length>1&&Array.isArray(J[0])&&J.every(H=>Array.isArray(H)&&H.length===1)?a(J):J}function M(J){return J.length===2&&e(J[0])&&e(J[1])}function r(J){return J.length===3&&e(J[0])&&e(J[1])&&e(J[2])}function S(J){return J.length===4&&e(J[0])&&e(J[1])&&e(J[2])&&e(J[3])}function c(J,H,b,x){var f=J,m=b,d=o(f,H),l=o(m,x),q=o(D(d[0],l[1]),D(l[0],d[1]));if(N(q)||s(B(q),I.relTol))return null;var Z=D(l[0],f[1]),_=D(l[1],f[0]),BA=D(l[0],m[1]),z=D(l[1],m[0]),v=i(Q(o(o(Z,_),BA),z),q);return C(w(d,v),f)}function Y(J,H,b,x,f,m,d,l,q,Z,_,BA){var z=D(o(J,H),o(b,x)),v=D(o(f,m),o(d,l)),iA=D(o(q,Z),o(_,BA));return Q(Q(z,v),iA)}function h(J,H,b,x,f,m,d,l,q,Z,_,BA){var z=Y(J,d,Z,d,H,l,_,l,b,q,BA,q),v=Y(Z,d,x,J,_,l,f,H,BA,q,m,b),iA=Y(J,d,x,J,H,l,f,H,b,q,m,b),eA=Y(Z,d,Z,d,_,l,_,l,BA,q,BA,q),CA=Y(x,J,x,J,f,H,f,H,m,b,m,b),sA=o(D(z,v),D(iA,eA)),GA=o(D(CA,eA),D(v,v));if(N(GA))return null;var yA=i(sA,GA),aA=i(Q(z,D(yA,v)),eA),NA=Q(J,D(yA,o(x,J))),KA=Q(H,D(yA,o(f,H))),UA=Q(b,D(yA,o(m,b))),HA=Q(d,D(aA,o(Z,d))),P=Q(l,D(aA,o(_,l))),IA=Q(q,D(aA,o(BA,q)));return y(NA,HA)&&y(KA,P)&&y(UA,IA)?[NA,KA,UA]:null}function n(J,H,b,x,f,m,d,l,q,Z){var _=D(J,d),BA=D(x,d),z=D(H,l),v=D(f,l),iA=D(b,q),eA=D(m,q),CA=o(o(o(Z,_),z),iA),sA=o(o(o(Q(Q(BA,v),eA),_),z),iA),GA=i(CA,sA),yA=Q(J,D(GA,o(x,J))),aA=Q(H,D(GA,o(f,H))),NA=Q(b,D(GA,o(m,b)));return[yA,aA,NA]}}),pM="sum",$3=["typed","config","add","numeric"],fM=T(pM,$3,A=>{var{typed:g,config:I,add:B,numeric:C}=A;return g(pM,{"Array | Matrix":Q,"Array | Matrix, number | BigNumber":E,"...":function(D){if(FQ(D))throw new TypeError("Scalar values expected in function sum");return Q(D)}});function Q(w){var D;return pB(w,function(i){try{D=D===void 0?i:B(D,i)}catch(o){throw MI(o,"sum",i)}}),D===void 0&&(D=C(0,I.number)),typeof D=="string"&&(D=C(D,CC(D,I))),D}function E(w,D){try{var i=zi(w,D,B);return i}catch(o){throw MI(o,"sum")}}}),ho="cumsum",A8=["typed","add","unaryPlus"],WM=T(ho,A8,A=>{var{typed:g,add:I,unaryPlus:B}=A;return g(ho,{Array:C,Matrix:function(i){return i.create(C(i.valueOf()))},"Array, number | BigNumber":E,"Matrix, number | BigNumber":function(i,o){return i.create(E(i.valueOf(),o))},"...":function(i){if(FQ(i))throw new TypeError("All values expected to be scalar in function cumsum");return C(i)}});function C(D){try{return Q(D)}catch(i){throw MI(i,ho)}}function Q(D){if(D.length===0)return[];for(var i=[B(D[0])],o=1;o<D.length;++o)i.push(I(i[o-1],D[o]));return i}function E(D,i){var o=gg(D);if(i<0||i>=o.length)throw new VI(i,o.length);try{return w(D,i)}catch(s){throw MI(s,ho)}}function w(D,i){var o,s,y;if(i<=0){var a=D[0][0];if(Array.isArray(a)){for(y=gN(D),s=[],o=0;o<y.length;o++)s[o]=w(y[o],i-1);return s}else return Q(D)}else{for(s=[],o=0;o<D.length;o++)s[o]=w(D[o],i-1);return s}}}),xM="mean",g8=["typed","add","divide"],vM=T(xM,g8,A=>{var{typed:g,add:I,divide:B}=A;return g(xM,{"Array | Matrix":Q,"Array | Matrix, number | BigNumber":C,"...":function(w){if(FQ(w))throw new TypeError("Scalar values expected in function mean");return Q(w)}});function C(E,w){try{var D=zi(E,w,I),i=Array.isArray(E)?gg(E):E.size();return B(D,i[w])}catch(o){throw MI(o,"mean")}}function Q(E){var w,D=0;if(pB(E,function(i){try{w=w===void 0?i:I(w,i),D++}catch(o){throw MI(o,"mean",i)}}),D===0)throw new Error("Cannot calculate the mean of an empty array");return B(w,D)}}),VM="median",I8=["typed","add","divide","compare","partitionSelect"],B8=T(VM,I8,A=>{var{typed:g,add:I,divide:B,compare:C,partitionSelect:Q}=A;function E(i){try{i=sg(i.valueOf());var o=i.length;if(o===0)throw new Error("Cannot calculate median of an empty array");if(o%2===0){for(var s=o/2-1,y=Q(i,s+1),a=i[s],N=0;N<s;++N)C(i[N],a)>0&&(a=i[N]);return D(a,y)}else{var e=Q(i,(o-1)/2);return w(e)}}catch(F){throw MI(F,"median")}}var w=g({"number | BigNumber | Complex | Unit":function(o){return o}}),D=g({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(o,s){return B(I(o,s),2)}});return g(VM,{"Array | Matrix":E,"Array | Matrix, number | BigNumber":function(o,s){throw new Error("median(A, dim) is not yet supported")},"...":function(o){if(FQ(o))throw new TypeError("Scalar values expected in function median");return E(o)}})}),qM="mad",C8=["typed","abs","map","median","subtract"],Q8=T(qM,C8,A=>{var{typed:g,abs:I,map:B,median:C,subtract:Q}=A;return g(qM,{"Array | Matrix":E,"...":function(D){return E(D)}});function E(w){if(w=sg(w.valueOf()),w.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var D=C(w);return C(B(w,function(i){return I(Q(i,D))}))}catch(i){throw i instanceof TypeError&&i.message.includes("median")?new TypeError(i.message.replace("median","mad")):MI(i,"mad")}}}),xw="unbiased",OM="variance",E8=["typed","add","subtract","multiply","divide","apply","isNaN"],TM=T(OM,E8,A=>{var{typed:g,add:I,subtract:B,multiply:C,divide:Q,apply:E,isNaN:w}=A;return g(OM,{"Array | Matrix":function(s){return D(s,xw)},"Array | Matrix, string":D,"Array | Matrix, number | BigNumber":function(s,y){return i(s,y,xw)},"Array | Matrix, number | BigNumber, string":i,"...":function(s){return D(s,xw)}});function D(o,s){var y,a=0;if(o.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(pB(o,function(F){try{y=y===void 0?F:I(y,F),a++}catch(K){throw MI(K,"variance",F)}}),a===0)throw new Error("Cannot calculate variance of an empty array");var N=Q(y,a);if(y=void 0,pB(o,function(F){var K=B(F,N);y=y===void 0?C(K,K):I(y,C(K,K))}),w(y))return y;switch(s){case"uncorrected":return Q(y,a);case"biased":return Q(y,a+1);case"unbiased":{var e=PA(y)?y.mul(0):0;return a===1?e:Q(y,a-1)}default:throw new Error('Unknown normalization "'+s+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function i(o,s,y){try{if(o.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return E(o,s,a=>D(a,y))}catch(a){throw MI(a,"variance")}}}),jM="quantileSeq",i8=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],XM=T(jM,i8,A=>{var{typed:g,bignumber:I,add:B,subtract:C,divide:Q,multiply:E,partitionSelect:w,compare:D,isInteger:i,smaller:o,smallerEq:s,larger:y}=A,a=Lw({typed:g,isInteger:i});return g(jM,{"Array | Matrix, number | BigNumber":(U,M)=>e(U,M,!1),"Array | Matrix, number | BigNumber, number":(U,M,r)=>N(U,M,!1,r,e),"Array | Matrix, number | BigNumber, boolean":e,"Array | Matrix, number | BigNumber, boolean, number":(U,M,r,S)=>N(U,M,r,S,e),"Array | Matrix, Array | Matrix":(U,M)=>F(U,M,!1),"Array | Matrix, Array | Matrix, number":(U,M,r)=>N(U,M,!1,r,F),"Array | Matrix, Array | Matrix, boolean":F,"Array | Matrix, Array | Matrix, boolean, number":(U,M,r,S)=>N(U,M,r,S,F)});function N(U,M,r,S,c){return a(U,S,Y=>c(Y,M,r))}function e(U,M,r){var S,c=U.valueOf();if(o(M,0))throw new Error("N/prob must be non-negative");if(s(M,1))return Ag(M)?K(c,M,r):I(K(c,M,r));if(y(M,1)){if(!i(M))throw new Error("N must be a positive integer");if(y(M,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 Y=B(M,1);S=[];for(var h=0;o(h,M);h++){var n=Q(h+1,Y);S.push(K(c,n,r))}return Ag(M)?S:I(S)}}function F(U,M,r){for(var S=U.valueOf(),c=M.valueOf(),Y=[],h=0;h<c.length;++h)Y.push(K(S,c[h],r));return Y}function K(U,M,r){var S=sg(U),c=S.length;if(c===0)throw new Error("Cannot calculate quantile of an empty sequence");var Y=Ag(M)?M*(c-1):M.times(c-1),h=Ag(M)?Math.floor(Y):Y.floor().toNumber(),n=Ag(M)?Y%1:Y.minus(h);if(i(Y))return r?S[Y]:w(S,Ag(M)?Y:Y.valueOf());var J,H;if(r)J=S[h],H=S[h+1];else{H=w(S,h+1),J=S[h];for(var b=0;b<h;++b)D(S[b],J)>0&&(J=S[b])}return B(E(J,C(1,n)),E(H,n))}}),zM="std",o8=["typed","map","sqrt","variance"],PM=T(zM,o8,A=>{var{typed:g,map:I,sqrt:B,variance:C}=A;return g(zM,{"Array | Matrix":Q,"Array | Matrix, string":Q,"Array | Matrix, number | BigNumber":Q,"Array | Matrix, number | BigNumber, string":Q,"...":function(w){return Q(w)}});function Q(E,w){if(E.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var D=C.apply(null,arguments);return kI(D)?I(D,B):B(D)}catch(i){throw i instanceof TypeError&&i.message.includes(" variance")?new TypeError(i.message.replace(" variance"," std")):i}}}),_M="corr",D8=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],w8=T(_M,D8,A=>{var{typed:g,matrix:I,sqrt:B,sum:C,add:Q,subtract:E,multiply:w,pow:D,divide:i}=A;return g(_M,{"Array, Array":function(a,N){return o(a,N)},"Matrix, Matrix":function(a,N){var e=o(a.toArray(),N.toArray());return Array.isArray(e)?I(e):e}});function o(y,a){var N=[];if(Array.isArray(y[0])&&Array.isArray(a[0])){if(y.length!==a.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var e=0;e<y.length;e++){if(y[e].length!==a[e].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");N.push(s(y[e],a[e]))}return N}else{if(y.length!==a.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return s(y,a)}}function s(y,a){var N=y.length,e=C(y),F=C(a),K=y.reduce((c,Y,h)=>Q(c,w(Y,a[h])),0),U=C(y.map(c=>D(c,2))),M=C(a.map(c=>D(c,2))),r=E(w(N,K),w(e,F)),S=B(w(E(w(N,U),D(e,2)),E(w(N,M),D(F,2))));return i(r,S)}}),$M="combinations",s8=["typed"],y8=T($M,s8,A=>{var{typed:g}=A;return g($M,{"number, number":nN,"BigNumber, BigNumber":function(B,C){var Q=B.constructor,E,w,D=B.minus(C),i=new Q(1);if(!AK(B)||!AK(C))throw new TypeError("Positive integer value expected in function combinations");if(C.gt(B))throw new TypeError("k must be less than n in function combinations");if(E=i,C.lt(D))for(w=i;w.lte(D);w=w.plus(i))E=E.times(C.plus(w)).dividedBy(w);else for(w=i;w.lte(C);w=w.plus(i))E=E.times(D.plus(w)).dividedBy(w);return E}})});function AK(A){return A.isInteger()&&A.gte(0)}var gK="combinationsWithRep",a8=["typed"],G8=T(gK,a8,A=>{var{typed:g}=A;return g(gK,{"number, number":function(B,C){if(!WA(B)||B<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!WA(C)||C<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(B<1)throw new TypeError("k must be less than or equal to n + k - 1");if(C<B-1){var Q=fB(B,B+C-1);return Q/fB(1,C)}var E=fB(C+1,B+C-1);return E/fB(1,B-1)},"BigNumber, BigNumber":function(B,C){var Q=B.constructor,E,w,D=new Q(1),i=B.minus(D);if(!IK(B)||!IK(C))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(B.lt(D))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(E=D,C.lt(i))for(w=D;w.lte(i);w=w.plus(D))E=E.times(C.plus(w)).dividedBy(w);else for(w=D;w.lte(C);w=w.plus(D))E=E.times(i.plus(w)).dividedBy(w);return E}})});function IK(A){return A.isInteger()&&A.gte(0)}var BK="gamma",N8=["typed","config","multiplyScalar","pow","BigNumber","Complex"],R8=T(BK,N8,A=>{var{typed:g,config:I,multiplyScalar:B,pow:C,BigNumber:Q,Complex:E}=A;function w(i){if(i.im===0)return _i(i.re);if(i.re<.5){var o=new E(1-i.re,-i.im),s=new E(Math.PI*i.re,Math.PI*i.im);return new E(Math.PI).div(s.sin()).div(w(o))}i=new E(i.re-1,i.im);for(var y=new E(SQ[0],0),a=1;a<SQ.length;++a){var N=new E(SQ[a],0);y=y.add(N.div(i.add(a)))}var e=new E(i.re+YN+.5,i.im),F=Math.sqrt(2*Math.PI),K=e.pow(i.add(.5)),U=e.neg().exp();return y.mul(F).mul(K).mul(U)}return g(BK,{number:_i,Complex:w,BigNumber:function(o){if(o.isInteger())return o.isNegative()||o.isZero()?new Q(1/0):D(o.minus(1));if(!o.isFinite())return new Q(o.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function D(i){if(i<8)return new Q([1,1,2,6,24,120,720,5040][i]);var o=I.precision+(Math.log(i.toNumber())|0),s=Q.clone({precision:o});if(i%2===1)return i.times(D(new Q(i-1)));for(var y=i,a=new s(i),N=i.toNumber();y>2;)y-=2,N+=y,a=a.times(N);return new Q(a.toPrecision(Q.precision))}}),CK="lgamma",e8=["Complex","typed"],t8=T(CK,e8,A=>{var{Complex:g,typed:I}=A,B=7,C=7,Q=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return I(CK,{number:$i,Complex:E,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function E(i){var o=6.283185307179586,s=1.1447298858494002,y=.1;if(i.isNaN())return new g(NaN,NaN);if(i.im===0)return new g($i(i.re),0);if(i.re>=B||Math.abs(i.im)>=C)return w(i);if(i.re<=y){var a=Cl(o,i.im)*Math.floor(.5*i.re+.25),N=i.mul(Math.PI).sin().log(),e=E(new g(1-i.re,-i.im));return new g(s,a).sub(N).sub(e)}else return i.im>=0?D(i):D(i.conjugate()).conjugate()}function w(i){for(var o=i.sub(.5).mul(i.log()).sub(i).add(JN),s=new g(1,0).div(i),y=s.div(i),a=Q[0],N=Q[1],e=2*y.re,F=y.re*y.re+y.im*y.im,K=2;K<8;K++){var U=N;N=-F*a+Q[K],a=e*a+U}var M=s.mul(y.mul(a).add(N));return o.add(M)}function D(i){var o=0,s=0,y=i;for(i=i.add(1);i.re<=B;){y=y.mul(i);var a=y.im<0?1:0;a!==0&&s===0&&o++,s=a,i=i.add(1)}return w(i).sub(y.log()).sub(new g(0,o*2*Math.PI*1))}}),QK="factorial",M8=["typed","gamma"],K8=T(QK,M8,A=>{var{typed:g,gamma:I}=A;return g(QK,{number:function(C){if(C<0)throw new Error("Value must be non-negative");return I(C+1)},BigNumber:function(C){if(C.isNegative())throw new Error("Value must be non-negative");return I(C.plus(1))},"Array | Matrix":g.referToSelf(B=>C=>Bg(C,B))})}),EK="kldivergence",F8=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],c8=T(EK,F8,A=>{var{typed:g,matrix:I,divide:B,sum:C,multiply:Q,map:E,dotDivide:w,log:D,isNumeric:i}=A;return g(EK,{"Array, Array":function(y,a){return o(I(y),I(a))},"Matrix, Array":function(y,a){return o(y,I(a))},"Array, Matrix":function(y,a){return o(I(y),a)},"Matrix, Matrix":function(y,a){return o(y,a)}});function o(s,y){var a=y.size().length,N=s.size().length;if(a>1)throw new Error("first object must be one dimensional");if(N>1)throw new Error("second object must be one dimensional");if(a!==N)throw new Error("Length of two vectors must be equal");var e=C(s);if(e===0)throw new Error("Sum of elements in first object must be non zero");var F=C(y);if(F===0)throw new Error("Sum of elements in second object must be non zero");var K=B(s,C(s)),U=B(y,C(y)),M=C(Q(K,E(w(K,U),r=>D(r))));return i(M)?M:Number.NaN}}),iK="multinomial",r8=["typed","add","divide","multiply","factorial","isInteger","isPositive"],S8=T(iK,r8,A=>{var{typed:g,add:I,divide:B,multiply:C,factorial:Q,isInteger:E,isPositive:w}=A;return g(iK,{"Array | Matrix":function(i){var o=0,s=1;return pB(i,function(y){if(!E(y)||!w(y))throw new TypeError("Positive integer value expected in function multinomial");o=I(o,y),s=C(s,Q(y))}),B(Q(o),s)}})}),oK="permutations",L8=["typed","factorial"],U8=T(oK,L8,A=>{var{typed:g,factorial:I}=A;return g(oK,{"number | BigNumber":I,"number, number":function(C,Q){if(!WA(C)||C<0)throw new TypeError("Positive integer value expected in function permutations");if(!WA(Q)||Q<0)throw new TypeError("Positive integer value expected in function permutations");if(Q>C)throw new TypeError("second argument k must be less than or equal to first argument n");return fB(C-Q+1,C)},"BigNumber, BigNumber":function(C,Q){var E,w;if(!DK(C)||!DK(Q))throw new TypeError("Positive integer value expected in function permutations");if(Q.gt(C))throw new TypeError("second argument k must be less than or equal to first argument n");var D=C.mul(0).add(1);for(E=D,w=C.minus(Q).plus(1);w.lte(C);w=w.plus(1))E=E.times(w);return E}})});function DK(A){return A.isInteger()&&A.gte(0)}var vw={exports:{}};vw.exports,function(A){(function(g,I,B){function C(D){var i=this,o=w();i.next=function(){var s=2091639*i.s0+i.c*23283064365386963e-26;return i.s0=i.s1,i.s1=i.s2,i.s2=s-(i.c=s|0)},i.c=1,i.s0=o(" "),i.s1=o(" "),i.s2=o(" "),i.s0-=o(D),i.s0<0&&(i.s0+=1),i.s1-=o(D),i.s1<0&&(i.s1+=1),i.s2-=o(D),i.s2<0&&(i.s2+=1),o=null}function Q(D,i){return i.c=D.c,i.s0=D.s0,i.s1=D.s1,i.s2=D.s2,i}function E(D,i){var o=new C(D),s=i&&i.state,y=o.next;return y.int32=function(){return o.next()*4294967296|0},y.double=function(){return y()+(y()*2097152|0)*11102230246251565e-32},y.quick=y,s&&(typeof s=="object"&&Q(s,o),y.state=function(){return Q(o,{})}),y}function w(){var D=4022871197,i=function(o){o=String(o);for(var s=0;s<o.length;s++){D+=o.charCodeAt(s);var y=.02519603282416938*D;D=y>>>0,y-=D,y*=D,D=y>>>0,y-=D,D+=y*4294967296}return(D>>>0)*23283064365386963e-26};return i}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.alea=E})($I,A,!1)}(vw);var n8=vw.exports,Vw={exports:{}};Vw.exports,function(A){(function(g,I,B){function C(w){var D=this,i="";D.x=0,D.y=0,D.z=0,D.w=0,D.next=function(){var s=D.x^D.x<<11;return D.x=D.y,D.y=D.z,D.z=D.w,D.w^=D.w>>>19^s^s>>>8},w===(w|0)?D.x=w:i+=w;for(var o=0;o<i.length+64;o++)D.x^=i.charCodeAt(o)|0,D.next()}function Q(w,D){return D.x=w.x,D.y=w.y,D.z=w.z,D.w=w.w,D}function E(w,D){var i=new C(w),o=D&&D.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do var y=i.next()>>>11,a=(i.next()>>>0)/4294967296,N=(y+a)/(1<<21);while(N===0);return N},s.int32=i.next,s.quick=s,o&&(typeof o=="object"&&Q(o,i),s.state=function(){return Q(i,{})}),s}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.xor128=E})($I,A,!1)}(Vw);var h8=Vw.exports,qw={exports:{}};qw.exports,function(A){(function(g,I,B){function C(w){var D=this,i="";D.next=function(){var s=D.x^D.x>>>2;return D.x=D.y,D.y=D.z,D.z=D.w,D.w=D.v,(D.d=D.d+362437|0)+(D.v=D.v^D.v<<4^(s^s<<1))|0},D.x=0,D.y=0,D.z=0,D.w=0,D.v=0,w===(w|0)?D.x=w:i+=w;for(var o=0;o<i.length+64;o++)D.x^=i.charCodeAt(o)|0,o==i.length&&(D.d=D.x<<10^D.x>>>4),D.next()}function Q(w,D){return D.x=w.x,D.y=w.y,D.z=w.z,D.w=w.w,D.v=w.v,D.d=w.d,D}function E(w,D){var i=new C(w),o=D&&D.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do var y=i.next()>>>11,a=(i.next()>>>0)/4294967296,N=(y+a)/(1<<21);while(N===0);return N},s.int32=i.next,s.quick=s,o&&(typeof o=="object"&&Q(o,i),s.state=function(){return Q(i,{})}),s}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.xorwow=E})($I,A,!1)}(qw);var Y8=qw.exports,Ow={exports:{}};Ow.exports,function(A){(function(g,I,B){function C(w){var D=this;D.next=function(){var o=D.x,s=D.i,y,a;return y=o[s],y^=y>>>7,a=y^y<<24,y=o[s+1&7],a^=y^y>>>10,y=o[s+3&7],a^=y^y>>>3,y=o[s+4&7],a^=y^y<<7,y=o[s+7&7],y=y^y<<13,a^=y^y<<9,o[s]=a,D.i=s+1&7,a};function i(o,s){var y,a=[];if(s===(s|0))a[0]=s;else for(s=""+s,y=0;y<s.length;++y)a[y&7]=a[y&7]<<15^s.charCodeAt(y)+a[y+1&7]<<13;for(;a.length<8;)a.push(0);for(y=0;y<8&&a[y]===0;++y);for(y==8?a[7]=-1:a[y],o.x=a,o.i=0,y=256;y>0;--y)o.next()}i(D,w)}function Q(w,D){return D.x=w.x.slice(),D.i=w.i,D}function E(w,D){w==null&&(w=+new Date);var i=new C(w),o=D&&D.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do var y=i.next()>>>11,a=(i.next()>>>0)/4294967296,N=(y+a)/(1<<21);while(N===0);return N},s.int32=i.next,s.quick=s,o&&(o.x&&Q(o,i),s.state=function(){return Q(i,{})}),s}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.xorshift7=E})($I,A,!1)}(Ow);var J8=Ow.exports,Tw={exports:{}};Tw.exports,function(A){(function(g,I,B){function C(w){var D=this;D.next=function(){var o=D.w,s=D.X,y=D.i,a,N;return D.w=o=o+1640531527|0,N=s[y+34&127],a=s[y=y+1&127],N^=N<<13,a^=a<<17,N^=N>>>15,a^=a>>>12,N=s[y]=N^a,D.i=y,N+(o^o>>>16)|0};function i(o,s){var y,a,N,e,F,K=[],U=128;for(s===(s|0)?(a=s,s=null):(s=s+"\0",a=0,U=Math.max(U,s.length)),N=0,e=-32;e<U;++e)s&&(a^=s.charCodeAt((e+32)%s.length)),e===0&&(F=a),a^=a<<10,a^=a>>>15,a^=a<<4,a^=a>>>13,e>=0&&(F=F+1640531527|0,y=K[e&127]^=a+F,N=y==0?N+1:0);for(N>=128&&(K[(s&&s.length||0)&127]=-1),N=127,e=4*128;e>0;--e)a=K[N+34&127],y=K[N=N+1&127],a^=a<<13,y^=y<<17,a^=a>>>15,y^=y>>>12,K[N]=a^y;o.w=F,o.X=K,o.i=N}i(D,w)}function Q(w,D){return D.i=w.i,D.w=w.w,D.X=w.X.slice(),D}function E(w,D){w==null&&(w=+new Date);var i=new C(w),o=D&&D.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do var y=i.next()>>>11,a=(i.next()>>>0)/4294967296,N=(y+a)/(1<<21);while(N===0);return N},s.int32=i.next,s.quick=s,o&&(o.X&&Q(o,i),s.state=function(){return Q(i,{})}),s}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.xor4096=E})($I,A,!1)}(Tw);var k8=Tw.exports,jw={exports:{}};jw.exports,function(A){(function(g,I,B){function C(w){var D=this,i="";D.next=function(){var s=D.b,y=D.c,a=D.d,N=D.a;return s=s<<25^s>>>7^y,y=y-a|0,a=a<<24^a>>>8^N,N=N-s|0,D.b=s=s<<20^s>>>12^y,D.c=y=y-a|0,D.d=a<<16^y>>>16^N,D.a=N-s|0},D.a=0,D.b=0,D.c=-1640531527,D.d=1367130551,w===Math.floor(w)?(D.a=w/4294967296|0,D.b=w|0):i+=w;for(var o=0;o<i.length+20;o++)D.b^=i.charCodeAt(o)|0,D.next()}function Q(w,D){return D.a=w.a,D.b=w.b,D.c=w.c,D.d=w.d,D}function E(w,D){var i=new C(w),o=D&&D.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do var y=i.next()>>>11,a=(i.next()>>>0)/4294967296,N=(y+a)/(1<<21);while(N===0);return N},s.int32=i.next,s.quick=s,o&&(typeof o=="object"&&Q(o,i),s.state=function(){return Q(i,{})}),s}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.tychei=E})($I,A,!1)}(jw);var l8=jw.exports,wK={exports:{}};const sK=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})),yK=MJ(sK);(function(A){(function(g,I,B){var C=256,Q=6,E=52,w="random",D=B.pow(C,Q),i=B.pow(2,E),o=i*2,s=C-1,y;function a(r,S,c){var Y=[];S=S==!0?{entropy:!0}:S||{};var h=K(F(S.entropy?[r,M(I)]:r??U(),3),Y),n=new N(Y),J=function(){for(var H=n.g(Q),b=D,x=0;H<i;)H=(H+x)*C,b*=C,x=n.g(1);for(;H>=o;)H/=2,b/=2,x>>>=1;return(H+x)/b};return J.int32=function(){return n.g(4)|0},J.quick=function(){return n.g(4)/4294967296},J.double=J,K(M(n.S),I),(S.pass||c||function(H,b,x,f){return f&&(f.S&&e(f,n),H.state=function(){return e(n,{})}),x?(B[w]=H,b):H})(J,h,"global"in S?S.global:this==B,S.state)}function N(r){var S,c=r.length,Y=this,h=0,n=Y.i=Y.j=0,J=Y.S=[];for(c||(r=[c++]);h<C;)J[h]=h++;for(h=0;h<C;h++)J[h]=J[n=s&n+r[h%c]+(S=J[h])],J[n]=S;(Y.g=function(H){for(var b,x=0,f=Y.i,m=Y.j,d=Y.S;H--;)b=d[f=s&f+1],x=x*C+d[s&(d[f]=d[m=s&m+b])+(d[m]=b)];return Y.i=f,Y.j=m,x})(C)}function e(r,S){return S.i=r.i,S.j=r.j,S.S=r.S.slice(),S}function F(r,S){var c=[],Y=typeof r,h;if(S&&Y=="object")for(h in r)try{c.push(F(r[h],S-1))}catch{}return c.length?c:Y=="string"?r:r+"\0"}function K(r,S){for(var c=r+"",Y,h=0;h<c.length;)S[s&h]=s&(Y^=S[s&h]*19)+c.charCodeAt(h++);return M(S)}function U(){try{var r;return y&&(r=y.randomBytes)?r=r(C):(r=new Uint8Array(C),(g.crypto||g.msCrypto).getRandomValues(r)),M(r)}catch{var S=g.navigator,c=S&&S.plugins;return[+new Date,g,c,g.screen,M(I)]}}function M(r){return String.fromCharCode.apply(0,r)}if(K(B.random(),I),A.exports){A.exports=a;try{y=yK}catch{}}else B["seed"+w]=a})(typeof self<"u"?self:$I,[],Math)})(wK);var H8=wK.exports,d8=n8,b8=h8,u8=Y8,m8=J8,Z8=k8,p8=l8,dC=H8;dC.alea=d8,dC.xor128=b8,dC.xorwow=u8,dC.xorshift7=m8,dC.xor4096=Z8,dC.tychei=p8;var f8=dC;const aK=sE(f8);var W8=aK(Date.now());function kQ(A){var g;function I(C){g=C===null?W8:aK(String(C))}I(A);function B(){return g()}return B}var GK="pickRandom",x8=["typed","config","?on"],v8=T(GK,x8,A=>{var{typed:g,config:I,on:B}=A,C=kQ(I.randomSeed);return B&&B("config",function(E,w){E.randomSeed!==w.randomSeed&&(C=kQ(E.randomSeed))}),g(GK,{"Array | Matrix":function(w){return Q(w,{})},"Array | Matrix, Object":function(w,D){return Q(w,D)},"Array | Matrix, number":function(w,D){return Q(w,{number:D})},"Array | Matrix, Array | Matrix":function(w,D){return Q(w,{weights:D})},"Array | Matrix, Array | Matrix, number":function(w,D,i){return Q(w,{number:i,weights:D})},"Array | Matrix, number, Array | Matrix":function(w,D,i){return Q(w,{number:D,weights:i})}});function Q(E,w){var{number:D,weights:i,elementWise:o=!0}=w,s=typeof D>"u";s&&(D=1);var y=qA(E)?E.create:qA(i)?i.create:null;E=E.valueOf(),i&&(i=i.valueOf()),o===!0&&(E=sg(E),i=sg(i));var a=0;if(typeof i<"u"){if(i.length!==E.length)throw new Error("Weights must have the same length as possibles");for(var N=0,e=i.length;N<e;N++){if(!Ag(i[N])||i[N]<0)throw new Error("Weights must be an array of positive numbers");a+=i[N]}}for(var F=E.length,K=[],U;K.length<D;){if(typeof i>"u")U=E[Math.floor(C()*F)];else for(var M=C()*a,r=0,S=E.length;r<S;r++)if(M-=i[r],M<0){U=E[r];break}K.push(U)}return s?K[0]:y?y(K):K}});function Xw(A,g){var I=[];if(A=A.slice(0),A.length>1)for(var B=0,C=A.shift();B<C;B++)I.push(Xw(A,g));else for(var Q=0,E=A.shift();Q<E;Q++)I.push(g());return I}var NK="random",V8=["typed","config","?on"],q8=T(NK,V8,A=>{var{typed:g,config:I,on:B}=A,C=kQ(I.randomSeed);return B&&B("config",function(w,D){w.randomSeed!==D.randomSeed&&(C=kQ(w.randomSeed))}),g(NK,{"":()=>E(0,1),number:w=>E(0,w),"number, number":(w,D)=>E(w,D),"Array | Matrix":w=>Q(w,0,1),"Array | Matrix, number":(w,D)=>Q(w,0,D),"Array | Matrix, number, number":(w,D,i)=>Q(w,D,i)});function Q(w,D,i){var o=Xw(w.valueOf(),()=>E(D,i));return qA(w)?w.create(o):o}function E(w,D){return w+C()*(D-w)}}),RK="randomInt",O8=["typed","config","?on"],T8=T(RK,O8,A=>{var{typed:g,config:I,on:B}=A,C=kQ(I.randomSeed);return B&&B("config",function(w,D){w.randomSeed!==D.randomSeed&&(C=kQ(w.randomSeed))}),g(RK,{"":()=>E(0,1),number:w=>E(0,w),"number, number":(w,D)=>E(w,D),"Array | Matrix":w=>Q(w,0,1),"Array | Matrix, number":(w,D)=>Q(w,0,D),"Array | Matrix, number, number":(w,D,i)=>Q(w,D,i)});function Q(w,D,i){var o=Xw(w.valueOf(),()=>E(D,i));return qA(w)?w.create(o):o}function E(w,D){return Math.floor(w+C()*(D-w))}}),eK="stirlingS2",j8=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],X8=T(eK,j8,A=>{var{typed:g,addScalar:I,subtractScalar:B,multiplyScalar:C,divideScalar:Q,pow:E,factorial:w,combinations:D,isNegative:i,isInteger:o,number:s,bignumber:y,larger:a}=A,N=[],e=[];return g(eK,{"number | BigNumber, number | BigNumber":function(K,U){if(!o(K)||i(K)||!o(U)||i(U))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(a(U,K))throw new TypeError("k must be less than or equal to n in function stirlingS2");var M=!(Ag(K)&&Ag(U)),r=M?e:N,S=M?y:s,c=s(K),Y=s(U);if(r[c]&&r[c].length>Y)return r[c][Y];for(var h=0;h<=c;++h)if(r[h]||(r[h]=[S(h===0?1:0)]),h!==0)for(var n=r[h],J=r[h-1],H=n.length;H<=h&&H<=Y;++H)H===h?n[H]=1:n[H]=I(C(S(H),J[H]),J[H-1]);return r[c][Y]}})}),tK="bellNumbers",z8=["typed","addScalar","isNegative","isInteger","stirlingS2"],P8=T(tK,z8,A=>{var{typed:g,addScalar:I,isNegative:B,isInteger:C,stirlingS2:Q}=A;return g(tK,{"number | BigNumber":function(w){if(!C(w)||B(w))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var D=0,i=0;i<=w;i++)D=I(D,Q(w,i));return D}})}),MK="catalan",_8=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],$8=T(MK,_8,A=>{var{typed:g,addScalar:I,divideScalar:B,multiplyScalar:C,combinations:Q,isNegative:E,isInteger:w}=A;return g(MK,{"number | BigNumber":function(i){if(!w(i)||E(i))throw new TypeError("Non-negative integer value expected in function catalan");return B(Q(C(i,2),i),I(i,1))}})}),KK="composition",A4=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],g4=T(KK,A4,A=>{var{typed:g,addScalar:I,combinations:B,isPositive:C,isNegative:Q,isInteger:E,larger:w}=A;return g(KK,{"number | BigNumber, number | BigNumber":function(i,o){if(!E(i)||!C(i)||!E(o)||!C(o))throw new TypeError("Positive integer value expected in function composition");if(w(o,i))throw new TypeError("k must be less than or equal to n in function composition");return B(I(i,-1),I(o,-1))}})}),FK="leafCount",I4=["parse","typed"],B4=T(FK,I4,A=>{var{parse:g,typed:I}=A;function B(C){var Q=0;return C.forEach(E=>{Q+=B(E)}),Q||1}return I(FK,{Node:function(Q){return B(Q)}})});function cK(A){return og(A)||Zg(A)&&A.isUnary()&&og(A.args[0])}function Yo(A){return!!(og(A)||(dB(A)||Zg(A))&&A.args.every(Yo)||NB(A)&&Yo(A.content))}function rK(A,g){var I=Object.keys(A);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(A);g&&(B=B.filter(function(C){return Object.getOwnPropertyDescriptor(A,C).enumerable})),I.push.apply(I,B)}return I}function zw(A){for(var g=1;g<arguments.length;g++){var I=arguments[g]!=null?arguments[g]:{};g%2?rK(Object(I),!0).forEach(function(B){jg(A,B,I[B])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(I)):rK(Object(I)).forEach(function(B){Object.defineProperty(A,B,Object.getOwnPropertyDescriptor(I,B))})}return A}var C4="simplifyUtil",Q4=["FunctionNode","OperatorNode","SymbolNode"],Pw=T(C4,Q4,A=>{var{FunctionNode:g,OperatorNode:I,SymbolNode:B}=A,C=!0,Q=!1,E="defaultF",w={add:{trivial:C,total:C,commutative:C,associative:C},unaryPlus:{trivial:C,total:C,commutative:C,associative:C},subtract:{trivial:Q,total:C,commutative:Q,associative:Q},multiply:{trivial:C,total:C,commutative:C,associative:C},divide:{trivial:Q,total:C,commutative:Q,associative:Q},paren:{trivial:C,total:C,commutative:C,associative:Q},defaultF:{trivial:Q,total:C,commutative:Q,associative:Q}},D={divide:{total:Q},log:{total:Q}},i={subtract:{total:Q},abs:{trivial:C},log:{total:C}};function o(M,r){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w,c=E;if(typeof M=="string"?c=M:Zg(M)?c=M.fn.toString():dB(M)?c=M.name:NB(M)&&(c="paren"),mA(S,c)){var Y=S[c];if(mA(Y,r))return Y[r];if(mA(w,c))return w[c][r]}if(mA(S,E)){var h=S[E];return mA(h,r)?h[r]:w[E][r]}if(mA(w,c)){var n=w[c];if(mA(n,r))return n[r]}return w[E][r]}function s(M){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:w;return o(M,"commutative",r)}function y(M){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:w;return o(M,"associative",r)}function a(M,r){var S=zw({},M);for(var c in r)mA(M,c)?S[c]=zw(zw({},r[c]),M[c]):S[c]=r[c];return S}function N(M,r){if(!M.args||M.args.length===0)return M;M.args=e(M,r);for(var S=0;S<M.args.length;S++)N(M.args[S],r)}function e(M,r){var S,c=[],Y=function h(n){for(var J=0;J<n.args.length;J++){var H=n.args[J];Zg(H)&&S===H.op?h(H):c.push(H)}};return y(M,r)?(S=M.op,Y(M),c):M.args}function F(M,r){if(!(!M.args||M.args.length===0)){for(var S=U(M),c=M.args.length,Y=0;Y<c;Y++)F(M.args[Y],r);if(c>2&&y(M,r)){for(var h=M.args.pop();M.args.length>0;)h=S([M.args.pop(),h]);M.args=h.args}}}function K(M,r){if(!(!M.args||M.args.length===0)){for(var S=U(M),c=M.args.length,Y=0;Y<c;Y++)K(M.args[Y],r);if(c>2&&y(M,r)){for(var h=M.args.shift();M.args.length>0;)h=S([h,M.args.shift()]);M.args=h.args}}}function U(M){return Zg(M)?function(r){try{return new I(M.op,M.fn,r,M.implicit)}catch(S){return console.error(S),[]}}:function(r){return new g(new B(M.name),r)}}return{createMakeNodeFunction:U,hasProperty:o,isCommutative:s,isAssociative:y,mergeContext:a,flatten:N,allChildren:e,unflattenr:F,unflattenl:K,defaultContext:w,realContext:D,positiveContext:i}}),E4="simplify",i4=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],o4=T(E4,i4,A=>{var{config:g,typed:I,parse:B,add:C,subtract:Q,multiply:E,divide:w,pow:D,isZero:i,equal:o,resolve:s,simplifyConstant:y,simplifyCore:a,fraction:N,bignumber:e,mathWithTransform:F,matrix:K,AccessorNode:U,ArrayNode:M,ConstantNode:r,FunctionNode:S,IndexNode:c,ObjectNode:Y,OperatorNode:h,ParenthesisNode:n,SymbolNode:J}=A,{hasProperty:H,isCommutative:b,isAssociative:x,mergeContext:f,flatten:m,unflattenr:d,unflattenl:l,createMakeNodeFunction:q,defaultContext:Z,realContext:_,positiveContext:BA}=Pw({FunctionNode:S,OperatorNode:h,SymbolNode:J});I.addConversion({from:"Object",to:"Map",convert:aQ});var z=I("simplify",{Node:yA,"Node, Map":(gA,EA)=>yA(gA,!1,EA),"Node, Map, Object":(gA,EA,wA)=>yA(gA,!1,EA,wA),"Node, Array":yA,"Node, Array, Map":yA,"Node, Array, Map, Object":yA});I.removeConversion({from:"Object",to:"Map",convert:aQ}),z.defaultContext=Z,z.realContext=_,z.positiveContext=BA;function v(gA){return gA.transform(function(EA,wA,cA){return NB(EA)?v(EA.content):EA})}var iA={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};z.rules=[a,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},y,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{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)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},y,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function eA(gA,EA){var wA={};if(gA.s){var cA=gA.s.split("->");if(cA.length===2)wA.l=cA[0],wA.r=cA[1];else throw SyntaxError("Could not parse rule: "+gA.s)}else wA.l=gA.l,wA.r=gA.r;wA.l=v(B(wA.l)),wA.r=v(B(wA.r));for(var rA of["imposeContext","repeat","assuming"])rA in gA&&(wA[rA]=gA[rA]);if(gA.evaluate&&(wA.evaluate=B(gA.evaluate)),x(wA.l,EA)){var O=!b(wA.l,EA),$;O&&($=GA());var j=q(wA.l),oA=GA();wA.expanded={},wA.expanded.l=j([wA.l,oA]),m(wA.expanded.l,EA),d(wA.expanded.l,EA),wA.expanded.r=j([wA.r,oA]),O&&(wA.expandedNC1={},wA.expandedNC1.l=j([$,wA.l]),wA.expandedNC1.r=j([$,wA.r]),wA.expandedNC2={},wA.expandedNC2.l=j([$,wA.expanded.l]),wA.expandedNC2.r=j([$,wA.expanded.r]))}return wA}function CA(gA,EA){for(var wA=[],cA=0;cA<gA.length;cA++){var rA=gA[cA],O=void 0,$=typeof rA;switch($){case"string":rA={s:rA};case"object":O=eA(rA,EA);break;case"function":O=rA;break;default:throw TypeError("Unsupported type of rule: "+$)}wA.push(O)}return wA}var sA=0;function GA(){return new J("_p"+sA++)}function yA(gA,EA){var wA=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tE(),cA=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},rA=cA.consoleDebug;EA=CA(EA||z.rules,cA.context);var O=s(gA,wA);O=v(O);for(var $={},j=O.toString({parenthesis:"all"});!$[j];){$[j]=!0,sA=0;var oA=j;rA&&console.log("Working on: ",j);for(var tA=0;tA<EA.length;tA++){var FA="";if(typeof EA[tA]=="function"?(O=EA[tA](O,cA),rA&&(FA=EA[tA].name)):(m(O,cA.context),O=NA(O,EA[tA],cA.context),rA&&(FA="".concat(EA[tA].l.toString()," -> ").concat(EA[tA].r.toString()))),rA){var JA=O.toString({parenthesis:"all"});JA!==oA&&(console.log("Applying",FA,"produced",JA),oA=JA)}l(O,cA.context)}j=O.toString({parenthesis:"all"})}return O}function aA(gA,EA,wA){var cA=gA;if(gA)for(var rA=0;rA<gA.length;++rA){var O=NA(gA[rA],EA,wA);O!==gA[rA]&&(cA===gA&&(cA=gA.slice()),cA[rA]=O)}return cA}function NA(gA,EA,wA){if(EA.assuming){for(var cA in EA.assuming)for(var rA in EA.assuming[cA])if(H(cA,rA,wA)!==EA.assuming[cA][rA])return gA}var O=f(EA.imposeContext,wA),$=gA;if($ instanceof h||$ instanceof S){var j=aA($.args,EA,wA);j!==$.args&&($=$.clone(),$.args=j)}else if($ instanceof n){if($.content){var oA=NA($.content,EA,wA);oA!==$.content&&($=new n(oA))}}else if($ instanceof M){var tA=aA($.items,EA,wA);tA!==$.items&&($=new M(tA))}else if($ instanceof U){var FA=$.object;$.object&&(FA=NA($.object,EA,wA));var JA=$.index;$.index&&(JA=NA($.index,EA,wA)),(FA!==$.object||JA!==$.index)&&($=new U(FA,JA))}else if($ instanceof c){var kA=aA($.dimensions,EA,wA);kA!==$.dimensions&&($=new c(kA))}else if($ instanceof Y){var dA=!1,YA={};for(var Cg in $.properties)YA[Cg]=NA($.properties[Cg],EA,wA),YA[Cg]!==$.properties[Cg]&&(dA=!0);dA&&($=new Y(YA))}var Eg=EA.r,fA=IA(EA.l,$,O)[0];if(!fA&&EA.expanded&&(Eg=EA.expanded.r,fA=IA(EA.expanded.l,$,O)[0]),!fA&&EA.expandedNC1&&(Eg=EA.expandedNC1.r,fA=IA(EA.expandedNC1.l,$,O)[0],fA||(Eg=EA.expandedNC2.r,fA=IA(EA.expandedNC2.l,$,O)[0])),fA){var Sg=$.implicit;$=Eg.clone(),Sg&&"implicit"in Eg&&($.implicit=!0),$=$.transform(function(u){return u.isSymbolNode&&mA(fA.placeholders,u.name)?fA.placeholders[u.name].clone():u})}return EA.repeat&&$!==gA&&($=NA($,EA,wA)),$}function KA(gA,EA){var wA=[],cA,rA,O=q(gA);if(b(gA,EA))for(var $=0;$<gA.args.length;$++)rA=gA.args.slice(0),rA.splice($,1),cA=rA.length===1?rA[0]:O(rA),wA.push(O([gA.args[$],cA]));else for(var j=1;j<gA.args.length;j++){var oA=gA.args[0];j>1&&(oA=O(gA.args.slice(0,j))),rA=gA.args.slice(j),cA=rA.length===1?rA[0]:O(rA),wA.push(O([oA,cA]))}return wA}function UA(gA,EA){var wA={placeholders:{}};if(!gA.placeholders&&!EA.placeholders)return wA;if(gA.placeholders){if(!EA.placeholders)return gA}else return EA;for(var cA in gA.placeholders)if(mA(gA.placeholders,cA)&&(wA.placeholders[cA]=gA.placeholders[cA],mA(EA.placeholders,cA)&&!RA(gA.placeholders[cA],EA.placeholders[cA])))return null;for(var rA in EA.placeholders)mA(EA.placeholders,rA)&&(wA.placeholders[rA]=EA.placeholders[rA]);return wA}function HA(gA,EA){var wA=[];if(gA.length===0||EA.length===0)return wA;for(var cA,rA=0;rA<gA.length;rA++)for(var O=0;O<EA.length;O++)cA=UA(gA[rA],EA[O]),cA&&wA.push(cA);return wA}function P(gA){if(gA.length===0)return gA;for(var EA=gA.reduce(HA),wA=[],cA={},rA=0;rA<EA.length;rA++){var O=JSON.stringify(EA[rA]);cA[O]||(cA[O]=!0,wA.push(EA[rA]))}return wA}function IA(gA,EA,wA,cA){var rA=[{placeholders:{}}];if(gA instanceof h&&EA instanceof h||gA instanceof S&&EA instanceof S){if(gA instanceof h){if(gA.op!==EA.op||gA.fn!==EA.fn)return[]}else if(gA instanceof S&&gA.name!==EA.name)return[];if(EA.args.length===1&&gA.args.length===1||!x(EA,wA)&&EA.args.length===gA.args.length||cA){for(var O=[],$=0;$<gA.args.length;$++){var j=IA(gA.args[$],EA.args[$],wA);if(j.length===0)break;O.push(j)}if(O.length!==gA.args.length){if(!b(EA,wA)||gA.args.length===1)return[];if(gA.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var oA=IA(gA.args[0],EA.args[1],wA);if(oA.length===0)return[];var tA=IA(gA.args[1],EA.args[0],wA);if(tA.length===0)return[];O=[oA,tA]}rA=P(O)}else if(EA.args.length>=2&&gA.args.length===2){for(var FA=KA(EA,wA),JA=[],kA=0;kA<FA.length;kA++){var dA=IA(gA,FA[kA],wA,!0);JA=JA.concat(dA)}return JA}else{if(gA.args.length>2)throw Error("Unexpected non-binary associative function: "+gA.toString());return[]}}else if(gA instanceof J){if(gA.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(iA[gA.name]){if(gA.name!==EA.name)return[]}else switch(gA.name[1]>="a"&&gA.name[1]<="z"?gA.name.substring(0,2):gA.name[0]){case"n":case"_p":rA[0].placeholders[gA.name]=EA;break;case"c":case"cl":if(og(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"v":if(!og(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"vl":if(qg(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"cd":if(cK(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"vd":if(!cK(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"ce":if(Yo(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"ve":if(!Yo(EA))rA[0].placeholders[gA.name]=EA;else return[];break;default:throw new Error("Invalid symbol in rule: "+gA.name)}}else if(gA instanceof r){if(!o(gA.value,EA.value))return[]}else return[];return rA}function RA(gA,EA){if(gA instanceof r&&EA instanceof r){if(!o(gA.value,EA.value))return!1}else if(gA instanceof J&&EA instanceof J){if(gA.name!==EA.name)return!1}else if(gA instanceof h&&EA instanceof h||gA instanceof S&&EA instanceof S){if(gA instanceof h){if(gA.op!==EA.op||gA.fn!==EA.fn)return!1}else if(gA instanceof S&&gA.name!==EA.name)return!1;if(gA.args.length!==EA.args.length)return!1;for(var wA=0;wA<gA.args.length;wA++)if(!RA(gA.args[wA],EA.args[wA]))return!1}else return!1;return!0}return z}),D4="simplifyConstant",w4=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],s4=T(D4,w4,A=>{var{typed:g,config:I,mathWithTransform:B,matrix:C,fraction:Q,bignumber:E,AccessorNode:w,ArrayNode:D,ConstantNode:i,FunctionNode:o,IndexNode:s,ObjectNode:y,OperatorNode:a,SymbolNode:N}=A,{isCommutative:e,isAssociative:F,allChildren:K,createMakeNodeFunction:U}=Pw({FunctionNode:o,OperatorNode:a,SymbolNode:N}),M=g("simplifyConstant",{Node:m=>Y(f(m,{})),"Node, Object":function(d,l){return Y(f(d,l))}});function r(m){return YC(m)?m.valueOf():m instanceof Array?m.map(r):qA(m)?C(r(m.valueOf())):m}function S(m,d,l){try{return B[m].apply(null,d)}catch{return d=d.map(r),n(B[m].apply(null,d),l)}}var c=g({Fraction:H,number:function(d){return d<0?J(new i(-d)):new i(d)},BigNumber:function(d){return d<0?J(new i(-d)):new i(d)},bigint:function(d){return d<0n?J(new i(-d)):new i(d)},Complex:function(d){throw new Error("Cannot convert Complex number to Node")},string:function(d){return new i(d)},Matrix:function(d){return new D(d.valueOf().map(l=>c(l)))}});function Y(m){return eg(m)?m:c(m)}function h(m,d){var l=d&&d.exactFractions!==!1;if(l&&isFinite(m)&&Q){var q=Q(m),Z=d&&typeof d.fractionsLimit=="number"?d.fractionsLimit:1/0;if(q.valueOf()===m&&q.n<Z&&q.d<Z)return q}return m}var n=g({"string, Object":function(d,l){var q=CC(d,I);if(q==="BigNumber")return E===void 0&&lw(),E(d);if(q==="bigint")return BigInt(d);if(q==="Fraction")return Q===void 0&&Ge(),Q(d);var Z=parseFloat(d);return h(Z,l)},"Fraction, Object":function(d,l){return d},"BigNumber, Object":function(d,l){return d},"number, Object":function(d,l){return h(d,l)},"bigint, Object":function(d,l){return d},"Complex, Object":function(d,l){return d.im!==0?d:h(d.re,l)},"Matrix, Object":function(d,l){return C(h(d.valueOf()))},"Array, Object":function(d,l){return d.map(h)}});function J(m){return new a("-","unaryMinus",[m])}function H(m){var d,l=m.s*m.n;return l<0?d=new a("-","unaryMinus",[new i(-l)]):d=new i(l),m.d===1?d:new a("/","divide",[d,new i(m.d)])}function b(m,d,l){if(!JC(d))return new w(Y(m),Y(d));if(lI(m)||qA(m)){for(var q=Array.from(d.dimensions);q.length>0;)if(og(q[0])&&typeof q[0].value!="string"){var Z=n(q.shift().value,l);lI(m)?m=m.items[Z-1]:(m=m.valueOf()[Z-1],m instanceof Array&&(m=C(m)))}else if(q.length>1&&og(q[1])&&typeof q[1].value!="string"){var _=n(q[1].value,l),BA=[],z=lI(m)?m.items:m.valueOf();for(var v of z)if(lI(v))BA.push(v.items[_-1]);else if(qA(m))BA.push(v[_-1]);else break;if(BA.length===z.length)lI(m)?m=new D(BA):m=C(BA),q.splice(1,1);else break}else break;return q.length===d.dimensions.length?new w(Y(m),d):q.length>0?(d=new s(q),new w(Y(m),d)):m}if(NE(m)&&d.dimensions.length===1&&og(d.dimensions[0])){var iA=d.dimensions[0].value;return iA in m.properties?m.properties[iA]:new i}return new w(Y(m),d)}function x(m,d,l,q){var Z=d.shift(),_=d.reduce((BA,z)=>{if(!eg(z)){var v=BA.pop();if(eg(v))return[v,z];try{return BA.push(S(m,[v,z],q)),BA}catch{BA.push(v)}}BA.push(Y(BA.pop()));var iA=BA.length===1?BA[0]:l(BA);return[l([iA,Y(z)])]},[Z]);return _.length===1?_[0]:l([_[0],c(_[1])])}function f(m,d){switch(m.type){case"SymbolNode":return m;case"ConstantNode":switch(typeof m.value){case"number":return n(m.value,d);case"bigint":return n(m.value,d);case"string":return m.value;default:if(!isNaN(m.value))return n(m.value,d)}return m;case"FunctionNode":if(B[m.name]&&B[m.name].rawArgs)return m;{var l=["add","multiply"];if(!l.includes(m.name)){var q=m.args.map(NA=>f(NA,d));if(!q.some(eg))try{return S(m.name,q,d)}catch{}if(m.name==="size"&&q.length===1&&lI(q[0])){for(var Z=[],_=q[0];lI(_);)Z.push(_.items.length),_=_.items[0];return C(Z)}return new o(m.name,q.map(Y))}}case"OperatorNode":{var BA=m.fn.toString(),z,v,iA=U(m);if(Zg(m)&&m.isUnary())z=[f(m.args[0],d)],eg(z[0])?v=iA(z):v=S(BA,z,d);else if(F(m,d.context))if(z=K(m,d.context),z=z.map(NA=>f(NA,d)),e(BA,d.context)){for(var eA=[],CA=[],sA=0;sA<z.length;sA++)eg(z[sA])?CA.push(z[sA]):eA.push(z[sA]);eA.length>1?(v=x(BA,eA,iA,d),CA.unshift(v),v=x(BA,CA,iA,d)):v=x(BA,z,iA,d)}else v=x(BA,z,iA,d);else z=m.args.map(NA=>f(NA,d)),v=x(BA,z,iA,d);return v}case"ParenthesisNode":return f(m.content,d);case"AccessorNode":return b(f(m.object,d),f(m.index,d),d);case"ArrayNode":{var GA=m.items.map(NA=>f(NA,d));return GA.some(eg)?new D(GA.map(Y)):C(GA)}case"IndexNode":return new s(m.dimensions.map(NA=>M(NA,d)));case"ObjectNode":{var yA={};for(var aA in m.properties)yA[aA]=M(m.properties[aA],d);return new y(yA)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(m.type))}}return M}),SK="simplifyCore",y4=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],a4=T(SK,y4,A=>{var{typed:g,parse:I,equal:B,isZero:C,add:Q,subtract:E,multiply:w,divide:D,pow:i,AccessorNode:o,ArrayNode:s,ConstantNode:y,FunctionNode:a,IndexNode:N,ObjectNode:e,OperatorNode:F,ParenthesisNode:K,SymbolNode:U}=A,M=new y(0),r=new y(1),S=new y(!0),c=new y(!1);function Y(H){return Zg(H)&&["and","not","or"].includes(H.op)}var{hasProperty:h,isCommutative:n}=Pw({FunctionNode:a,OperatorNode:F,SymbolNode:U});function J(H){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=b?b.context:void 0;if(h(H,"trivial",x)){if(dB(H)&&H.args.length===1)return J(H.args[0],b);var f=!1,m=0;if(H.forEach(CA=>{++m,m===1&&(f=J(CA,b))}),m===1)return f}var d=H;if(dB(d)){var l=tW(d.name);if(l){if(d.args.length>2&&h(d,"associative",x))for(;d.args.length>2;){var q=d.args.pop(),Z=d.args.pop();d.args.push(new F(l,d.name,[q,Z]))}d=new F(l,d.name,d.args)}else return new a(J(d.fn),d.args.map(CA=>J(CA,b)))}if(Zg(d)&&d.isUnary()){var _=J(d.args[0],b);if(d.op==="~"&&Zg(_)&&_.isUnary()&&_.op==="~"||d.op==="not"&&Zg(_)&&_.isUnary()&&_.op==="not"&&Y(_.args[0]))return _.args[0];var BA=!0;if(d.op==="-"&&Zg(_)&&(_.isBinary()&&_.fn==="subtract"&&(d=new F("-","subtract",[_.args[1],_.args[0]]),BA=!1),_.isUnary()&&_.op==="-"))return _.args[0];if(BA)return new F(d.op,d.fn,[_])}if(Zg(d)&&d.isBinary()){var z=J(d.args[0],b),v=J(d.args[1],b);if(d.op==="+"){if(og(z)&&C(z.value))return v;if(og(v)&&C(v.value))return z;Zg(v)&&v.isUnary()&&v.op==="-"&&(v=v.args[0],d=new F("-","subtract",[z,v]))}if(d.op==="-")return Zg(v)&&v.isUnary()&&v.op==="-"?J(new F("+","add",[z,v.args[0]]),b):og(z)&&C(z.value)?J(new F("-","unaryMinus",[v])):og(v)&&C(v.value)?z:new F(d.op,d.fn,[z,v]);if(d.op==="*"){if(og(z)){if(C(z.value))return M;if(B(z.value,1))return v}if(og(v)){if(C(v.value))return M;if(B(v.value,1))return z;if(n(d,x))return new F(d.op,d.fn,[v,z],d.implicit)}return new F(d.op,d.fn,[z,v],d.implicit)}if(d.op==="/")return og(z)&&C(z.value)?M:og(v)&&B(v.value,1)?z:new F(d.op,d.fn,[z,v]);if(d.op==="^"&&og(v)){if(C(v.value))return r;if(B(v.value,1))return z}if(d.op==="and"){if(og(z))if(z.value){if(Y(v))return v;if(og(v))return v.value?S:c}else return c;if(og(v))if(v.value){if(Y(z))return z}else return c}if(d.op==="or"){if(og(z)){if(z.value)return S;if(Y(v))return v}if(og(v)){if(v.value)return S;if(Y(z))return z}}return new F(d.op,d.fn,[z,v])}if(Zg(d))return new F(d.op,d.fn,d.args.map(CA=>J(CA,b)));if(lI(d))return new s(d.items.map(CA=>J(CA,b)));if(BC(d))return new o(J(d.object,b),J(d.index,b));if(JC(d))return new N(d.dimensions.map(CA=>J(CA,b)));if(NE(d)){var iA={};for(var eA in d.properties)iA[eA]=J(d.properties[eA],b);return new e(iA)}return d}return g(SK,{Node:J,"Node,Object":J})}),G4="resolve",N4=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],R4=T(G4,N4,A=>{var{typed:g,parse:I,ConstantNode:B,FunctionNode:C,OperatorNode:Q,ParenthesisNode:E}=A;function w(D,i){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!i)return D;if(qg(D)){if(o.has(D.name)){var s=Array.from(o).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(s,"}"))}var y=i.get(D.name);if(eg(y)){var a=new Set(o);return a.add(D.name),w(y,i,a)}else return typeof y=="number"?I(String(y)):y!==void 0?new B(y):D}else if(Zg(D)){var N=D.args.map(function(F){return w(F,i,o)});return new Q(D.op,D.fn,N,D.implicit)}else{if(NB(D))return new E(w(D.content,i,o));if(dB(D)){var e=D.args.map(function(F){return w(F,i,o)});return new C(D.name,e)}}return D.map(F=>w(F,i,o))}return g("resolve",{Node:w,"Node, Map | null | undefined":w,"Node, Object":(D,i)=>w(D,aQ(i)),"Array | Matrix":g.referToSelf(D=>i=>i.map(o=>D(o))),"Array | Matrix, null | undefined":g.referToSelf(D=>i=>i.map(o=>D(o))),"Array, Object":g.referTo("Array,Map",D=>(i,o)=>D(i,aQ(o))),"Matrix, Object":g.referTo("Matrix,Map",D=>(i,o)=>D(i,aQ(o))),"Array | Matrix, Map":g.referToSelf(D=>(i,o)=>i.map(s=>D(s,o)))})}),LK="symbolicEqual",e4=["parse","simplify","typed","OperatorNode"],t4=T(LK,e4,A=>{var{parse:g,simplify:I,typed:B,OperatorNode:C}=A;function Q(E,w){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=new C("-","subtract",[E,w]),o=I(i,{},D);return og(o)&&!o.value}return B(LK,{"Node, Node":Q,"Node, Node, Object":Q})}),UK="derivative",M4=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],K4=T(UK,M4,A=>{var{typed:g,config:I,parse:B,simplify:C,equal:Q,isZero:E,numeric:w,ConstantNode:D,FunctionNode:i,OperatorNode:o,ParenthesisNode:s,SymbolNode:y}=A;function a(M,r){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},c={};F(c,M,r.name);var Y=K(M,c);return S.simplify?C(Y):Y}g.addConversion({from:"identifier",to:"SymbolNode",convert:B});var N=g(UK,{"Node, SymbolNode":a,"Node, SymbolNode, Object":a});g.removeConversion({from:"identifier",to:"SymbolNode",convert:B}),N._simplify=!0,N.toTex=function(M){return e.apply(null,M.args)};var e=g("_derivTex",{"Node, SymbolNode":function(r,S){return og(r)&&Mg(r.value)==="string"?e(B(r.value).toString(),S.toString(),1):e(r.toTex(),S.toString(),1)},"Node, ConstantNode":function(r,S){if(Mg(S.value)==="string")return e(r,B(S.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(r,S,c){return e(r.toString(),S.name,c.value)},"string, string, number":function(r,S,c){var Y;return c===1?Y="{d\\over d"+S+"}":Y="{d^{"+c+"}\\over d"+S+"^{"+c+"}}",Y+"\\left[".concat(r,"\\right]")}}),F=g("constTag",{"Object, ConstantNode, string":function(r,S){return r[S]=!0,!0},"Object, SymbolNode, string":function(r,S,c){return S.name!==c?(r[S]=!0,!0):!1},"Object, ParenthesisNode, string":function(r,S,c){return F(r,S.content,c)},"Object, FunctionAssignmentNode, string":function(r,S,c){return S.params.includes(c)?F(r,S.expr,c):(r[S]=!0,!0)},"Object, FunctionNode | OperatorNode, string":function(r,S,c){if(S.args.length>0){for(var Y=F(r,S.args[0],c),h=1;h<S.args.length;++h)Y=F(r,S.args[h],c)&&Y;if(Y)return r[S]=!0,!0}return!1}}),K=g("_derivative",{"ConstantNode, Object":function(r){return U(0)},"SymbolNode, Object":function(r,S){return S[r]!==void 0?U(0):U(1)},"ParenthesisNode, Object":function(r,S){return new s(K(r.content,S))},"FunctionAssignmentNode, Object":function(r,S){return S[r]!==void 0?U(0):K(r.expr,S)},"FunctionNode, Object":function(r,S){if(S[r]!==void 0)return U(0);var c=r.args[0],Y,h=!1,n=!1,J;switch(r.name){case"cbrt":h=!0,J=new o("*","multiply",[U(3),new o("^","pow",[c,new o("/","divide",[U(2),U(3)])])]);break;case"sqrt":case"nthRoot":if(r.args.length===1)h=!0,J=new o("*","multiply",[U(2),new i("sqrt",[c])]);else if(r.args.length===2)return Y=new o("/","divide",[U(1),r.args[1]]),S[Y]=S[r.args[1]],K(new o("^","pow",[c,Y]),S);break;case"log10":Y=U(10);case"log":if(!Y&&r.args.length===1)J=c.clone(),h=!0;else if(r.args.length===1&&Y||r.args.length===2&&S[r.args[1]]!==void 0)J=new o("*","multiply",[c.clone(),new i("log",[Y||r.args[1]])]),h=!0;else if(r.args.length===2)return K(new o("/","divide",[new i("log",[c]),new i("log",[r.args[1]])]),S);break;case"pow":if(r.args.length===2)return S[Y]=S[r.args[1]],K(new o("^","pow",[c,r.args[1]]),S);break;case"exp":J=new i("exp",[c.clone()]);break;case"sin":J=new i("cos",[c.clone()]);break;case"cos":J=new o("-","unaryMinus",[new i("sin",[c.clone()])]);break;case"tan":J=new o("^","pow",[new i("sec",[c.clone()]),U(2)]);break;case"sec":J=new o("*","multiply",[r,new i("tan",[c.clone()])]);break;case"csc":n=!0,J=new o("*","multiply",[r,new i("cot",[c.clone()])]);break;case"cot":n=!0,J=new o("^","pow",[new i("csc",[c.clone()]),U(2)]);break;case"asin":h=!0,J=new i("sqrt",[new o("-","subtract",[U(1),new o("^","pow",[c.clone(),U(2)])])]);break;case"acos":h=!0,n=!0,J=new i("sqrt",[new o("-","subtract",[U(1),new o("^","pow",[c.clone(),U(2)])])]);break;case"atan":h=!0,J=new o("+","add",[new o("^","pow",[c.clone(),U(2)]),U(1)]);break;case"asec":h=!0,J=new o("*","multiply",[new i("abs",[c.clone()]),new i("sqrt",[new o("-","subtract",[new o("^","pow",[c.clone(),U(2)]),U(1)])])]);break;case"acsc":h=!0,n=!0,J=new o("*","multiply",[new i("abs",[c.clone()]),new i("sqrt",[new o("-","subtract",[new o("^","pow",[c.clone(),U(2)]),U(1)])])]);break;case"acot":h=!0,n=!0,J=new o("+","add",[new o("^","pow",[c.clone(),U(2)]),U(1)]);break;case"sinh":J=new i("cosh",[c.clone()]);break;case"cosh":J=new i("sinh",[c.clone()]);break;case"tanh":J=new o("^","pow",[new i("sech",[c.clone()]),U(2)]);break;case"sech":n=!0,J=new o("*","multiply",[r,new i("tanh",[c.clone()])]);break;case"csch":n=!0,J=new o("*","multiply",[r,new i("coth",[c.clone()])]);break;case"coth":n=!0,J=new o("^","pow",[new i("csch",[c.clone()]),U(2)]);break;case"asinh":h=!0,J=new i("sqrt",[new o("+","add",[new o("^","pow",[c.clone(),U(2)]),U(1)])]);break;case"acosh":h=!0,J=new i("sqrt",[new o("-","subtract",[new o("^","pow",[c.clone(),U(2)]),U(1)])]);break;case"atanh":h=!0,J=new o("-","subtract",[U(1),new o("^","pow",[c.clone(),U(2)])]);break;case"asech":h=!0,n=!0,J=new o("*","multiply",[c.clone(),new i("sqrt",[new o("-","subtract",[U(1),new o("^","pow",[c.clone(),U(2)])])])]);break;case"acsch":h=!0,n=!0,J=new o("*","multiply",[new i("abs",[c.clone()]),new i("sqrt",[new o("+","add",[new o("^","pow",[c.clone(),U(2)]),U(1)])])]);break;case"acoth":h=!0,n=!0,J=new o("-","subtract",[U(1),new o("^","pow",[c.clone(),U(2)])]);break;case"abs":J=new o("/","divide",[new i(new y("abs"),[c.clone()]),c.clone()]);break;case"gamma":default:throw new Error('Cannot process function "'+r.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}var H,b;h?(H="/",b="divide"):(H="*",b="multiply");var x=K(c,S);return n&&(x=new o("-","unaryMinus",[x])),new o(H,b,[x,J])},"OperatorNode, Object":function(r,S){if(S[r]!==void 0)return U(0);if(r.op==="+")return new o(r.op,r.fn,r.args.map(function(m){return K(m,S)}));if(r.op==="-"){if(r.isUnary())return new o(r.op,r.fn,[K(r.args[0],S)]);if(r.isBinary())return new o(r.op,r.fn,[K(r.args[0],S),K(r.args[1],S)])}if(r.op==="*"){var c=r.args.filter(function(m){return S[m]!==void 0});if(c.length>0){var Y=r.args.filter(function(m){return S[m]===void 0}),h=Y.length===1?Y[0]:new o("*","multiply",Y),n=c.concat(K(h,S));return new o("*","multiply",n)}return new o("+","add",r.args.map(function(m){return new o("*","multiply",r.args.map(function(d){return d===m?K(d,S):d.clone()}))}))}if(r.op==="/"&&r.isBinary()){var J=r.args[0],H=r.args[1];return S[H]!==void 0?new o("/","divide",[K(J,S),H]):S[J]!==void 0?new o("*","multiply",[new o("-","unaryMinus",[J]),new o("/","divide",[K(H,S),new o("^","pow",[H.clone(),U(2)])])]):new o("/","divide",[new o("-","subtract",[new o("*","multiply",[K(J,S),H.clone()]),new o("*","multiply",[J.clone(),K(H,S)])]),new o("^","pow",[H.clone(),U(2)])])}if(r.op==="^"&&r.isBinary()){var b=r.args[0],x=r.args[1];if(S[b]!==void 0)return og(b)&&(E(b.value)||Q(b.value,1))?U(0):new o("*","multiply",[r,new o("*","multiply",[new i("log",[b.clone()]),K(x.clone(),S)])]);if(S[x]!==void 0){if(og(x)){if(E(x.value))return U(0);if(Q(x.value,1))return K(b,S)}var f=new o("^","pow",[b.clone(),new o("-","subtract",[x,U(1)])]);return new o("*","multiply",[x.clone(),new o("*","multiply",[K(b,S),f])])}return new o("*","multiply",[new o("^","pow",[b.clone(),x.clone()]),new o("+","add",[new o("*","multiply",[K(b,S),new o("/","divide",[x.clone(),b.clone()])]),new o("*","multiply",[K(x,S),new i("log",[b.clone()])])])])}throw new Error('Cannot process operator "'+r.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function U(M,r){return new D(w(M,r||CC(String(M),I)))}return N}),nK="rationalize",F4=["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"],c4=T(nK,F4,A=>{var{config:g,typed:I,equal:B,isZero:C,add:Q,subtract:E,multiply:w,divide:D,pow:i,parse:o,simplifyConstant:s,simplifyCore:y,simplify:a,fraction:N,bignumber:e,mathWithTransform:F,matrix:K,AccessorNode:U,ArrayNode:M,ConstantNode:r,FunctionNode:S,IndexNode:c,ObjectNode:Y,OperatorNode:h,SymbolNode:n,ParenthesisNode:J}=A;function H(d){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,Z=x(),_=b(d,l,!0,Z.firstRules),BA=_.variables.length,z={exactFractions:!1},v={exactFractions:!0};if(d=_.expression,BA>=1){d=f(d);var iA,eA,CA=!0,sA=!1;d=a(d,Z.firstRules,{},z);for(var GA;eA=CA?Z.distrDivRules:Z.sucDivRules,d=a(d,eA,{},v),CA=!CA,GA=d.toString(),GA!==iA;)sA=!0,iA=GA;sA&&(d=a(d,Z.firstRulesAgain,{},z)),d=a(d,Z.finalRules,{},z)}var yA=[],aA={};return d.type==="OperatorNode"&&d.isBinary()&&d.op==="/"?(BA===1&&(d.args[0]=m(d.args[0],yA),d.args[1]=m(d.args[1])),q&&(aA.numerator=d.args[0],aA.denominator=d.args[1])):(BA===1&&(d=m(d,yA)),q&&(aA.numerator=d,aA.denominator=null)),q?(aA.coefficients=yA,aA.variables=_.variables,aA.expression=d,aA):d}return I(nK,{Node:H,"Node, boolean":(d,l)=>H(d,{},l),"Node, Object":H,"Node, Object, boolean":H});function b(d,l,q,Z){var _=[],BA=a(d,Z,l,{exactFractions:!1});q=!!q;var z="+-*"+(q?"/":"");iA(BA);var v={};return v.expression=BA,v.variables=_,v;function iA(eA){var CA=eA.type;if(CA==="FunctionNode")throw new Error("There is an unsolved function call");if(CA==="OperatorNode")if(eA.op==="^"){if(eA.args[1].type!=="ConstantNode"||!WA(parseFloat(eA.args[1].value)))throw new Error("There is a non-integer exponent");iA(eA.args[0])}else{if(!z.includes(eA.op))throw new Error("Operator "+eA.op+" invalid in polynomial expression");for(var sA=0;sA<eA.args.length;sA++)iA(eA.args[sA])}else if(CA==="SymbolNode"){var GA=eA.name,yA=_.indexOf(GA);yA===-1&&_.push(GA)}else if(CA==="ParenthesisNode")iA(eA.content);else if(CA!=="ConstantNode")throw new Error("type "+CA+" is not allowed in polynomial expression")}}function x(){var d=[y,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},s,{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=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],q=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],Z=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],_={};return _.firstRules=d.concat(l,Z),_.distrDivRules=q,_.sucDivRules=Z,_.firstRulesAgain=d.concat(l),_.finalRules=[y,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},s,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],_}function f(d,l,q){var Z=d.type,_=arguments.length>1;if(Z==="OperatorNode"&&d.isBinary()){var BA=!1,z;if(d.op==="^"&&(d.args[0].type==="ParenthesisNode"||d.args[0].type==="OperatorNode")&&d.args[1].type==="ConstantNode"&&(z=parseFloat(d.args[1].value),BA=z>=2&&WA(z)),BA){if(z>2){var v=d.args[0],iA=new h("^","pow",[d.args[0].cloneDeep(),new r(z-1)]);d=new h("*","multiply",[v,iA])}else d=new h("*","multiply",[d.args[0],d.args[0].cloneDeep()]);_&&(q==="content"?l.content=d:l.args[q]=d)}}if(Z==="ParenthesisNode")f(d.content,d,"content");else if(Z!=="ConstantNode"&&Z!=="SymbolNode")for(var eA=0;eA<d.args.length;eA++)f(d.args[eA],d,eA);if(!_)return d}function m(d,l){l===void 0&&(l=[]),l[0]=0;var q={};q.cte=1,q.oper="+",q.fire="";var Z=0,_="";GA(d,null,q),Z=l.length-1;for(var BA=!0,z,v=Z;v>=0;v--)if(l[v]!==0){var iA=new r(BA?l[v]:Math.abs(l[v])),eA=l[v]<0?"-":"+";if(v>0){var CA=new n(_);if(v>1){var sA=new r(v);CA=new h("^","pow",[CA,sA])}l[v]===-1&&BA?iA=new h("-","unaryMinus",[CA]):Math.abs(l[v])===1?iA=CA:iA=new h("*","multiply",[iA,CA])}BA?z=iA:eA==="+"?z=new h("+","add",[z,iA]):z=new h("-","subtract",[z,iA]),BA=!1}if(BA)return new r(0);return z;function GA(yA,aA,NA){var KA=yA.type;if(KA==="FunctionNode")throw new Error("There is an unsolved function call");if(KA==="OperatorNode"){if(!"+-*^".includes(yA.op))throw new Error("Operator "+yA.op+" invalid");if(aA!==null){if((yA.fn==="unaryMinus"||yA.fn==="pow")&&aA.fn!=="add"&&aA.fn!=="subtract"&&aA.fn!=="multiply")throw new Error("Invalid "+yA.op+" placing");if((yA.fn==="subtract"||yA.fn==="add"||yA.fn==="multiply")&&aA.fn!=="add"&&aA.fn!=="subtract")throw new Error("Invalid "+yA.op+" placing");if((yA.fn==="subtract"||yA.fn==="add"||yA.fn==="unaryMinus")&&NA.noFil!==0)throw new Error("Invalid "+yA.op+" placing")}(yA.op==="^"||yA.op==="*")&&(NA.fire=yA.op);for(var UA=0;UA<yA.args.length;UA++)yA.fn==="unaryMinus"&&(NA.oper="-"),(yA.op==="+"||yA.fn==="subtract")&&(NA.fire="",NA.cte=1,NA.oper=UA===0?"+":yA.op),NA.noFil=UA,GA(yA.args[UA],yA,NA)}else if(KA==="SymbolNode"){if(yA.name!==_&&_!=="")throw new Error("There is more than one variable");if(_=yA.name,aA===null){l[1]=1;return}if(aA.op==="^"&&NA.noFil!==0)throw new Error("In power the variable should be the first parameter");if(aA.op==="*"&&NA.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(NA.fire===""||NA.fire==="*")&&(Z<1&&(l[1]=0),l[1]+=NA.cte*(NA.oper==="+"?1:-1),Z=Math.max(1,Z))}else if(KA==="ConstantNode"){var HA=parseFloat(yA.value);if(aA===null){l[0]=HA;return}if(aA.op==="^"){if(NA.noFil!==1)throw new Error("Constant cannot be powered");if(!WA(HA)||HA<=0)throw new Error("Non-integer exponent is not allowed");for(var P=Z+1;P<HA;P++)l[P]=0;HA>Z&&(l[HA]=0),l[HA]+=NA.cte*(NA.oper==="+"?1:-1),Z=Math.max(HA,Z);return}NA.cte=HA,NA.fire===""&&(l[0]+=NA.cte*(NA.oper==="+"?1:-1))}else throw new Error("Type "+KA+" is not allowed")}}}),hK="zpk2tf",r4=["typed","add","multiply","Complex","number"],S4=T(hK,r4,A=>{var{typed:g,add:I,multiply:B,Complex:C,number:Q}=A;return g(hK,{"Array,Array,number":function(i,o,s){return E(i,o,s)},"Array,Array":function(i,o){return E(i,o,1)},"Matrix,Matrix,number":function(i,o,s){return E(i.valueOf(),o.valueOf(),s)},"Matrix,Matrix":function(i,o){return E(i.valueOf(),o.valueOf(),1)}});function E(D,i,o){D.some(U=>U.type==="BigNumber")&&(D=D.map(U=>Q(U))),i.some(U=>U.type==="BigNumber")&&(i=i.map(U=>Q(U)));for(var s=[C(1,0)],y=[C(1,0)],a=0;a<D.length;a++){var N=D[a];typeof N=="number"&&(N=C(N,0)),s=w(s,[C(1,0),C(-N.re,-N.im)])}for(var e=0;e<i.length;e++){var F=i[e];typeof F=="number"&&(F=C(F,0)),y=w(y,[C(1,0),C(-F.re,-F.im)])}for(var K=0;K<s.length;K++)s[K]=B(s[K],o);return[s,y]}function w(D,i){for(var o=[],s=0;s<D.length+i.length-1;s++){o[s]=C(0,0);for(var y=0;y<D.length;y++)s-y>=0&&s-y<i.length&&(o[s]=I(o[s],B(D[y],i[s-y])))}return o}}),YK="freqz",L4=["typed","add","multiply","Complex","divide","matrix"],U4=T(YK,L4,A=>{var{typed:g,add:I,multiply:B,Complex:C,divide:Q,matrix:E}=A;return g(YK,{"Array, Array":function(o,s){var y=D(512);return w(o,s,y)},"Array, Array, Array":function(o,s,y){return w(o,s,y)},"Array, Array, number":function(o,s,y){if(y<0)throw new Error("w must be a positive number");var a=D(y);return w(o,s,a)},"Matrix, Matrix":function(o,s){var y=D(512),{w:a,h:N}=w(o.valueOf(),s.valueOf(),y);return{w:E(a),h:E(N)}},"Matrix, Matrix, Matrix":function(o,s,y){var{h:a}=w(o.valueOf(),s.valueOf(),y.valueOf());return{h:E(a),w:E(y)}},"Matrix, Matrix, number":function(o,s,y){if(y<0)throw new Error("w must be a positive number");var a=D(y),{h:N}=w(o.valueOf(),s.valueOf(),a);return{h:E(N),w:E(a)}}});function w(i,o,s){for(var y=[],a=[],N=0;N<s.length;N++){for(var e=C(0,0),F=C(0,0),K=0;K<i.length;K++)e=I(e,B(i[K],C(Math.cos(-K*s[N]),Math.sin(-K*s[N]))));for(var U=0;U<o.length;U++)F=I(F,B(o[U],C(Math.cos(-U*s[N]),Math.sin(-U*s[N]))));y.push(e),a.push(F)}for(var M=[],r=0;r<y.length;r++)M.push(Q(y[r],a[r]));return{h:M,w:s}}function D(i){for(var o=[],s=0;s<i;s++)o.push(s/i*Math.PI);return o}}),n4="reviver",h4=["classes"],Y4=T(n4,h4,A=>{var{classes:g}=A;return function(B,C){var Q=g[C&&C.mathjs];return Q&&typeof Q.fromJSON=="function"?Q.fromJSON(C):C}}),J4="replacer",k4=[],l4=T(J4,k4,()=>function(g,I){return typeof I=="number"&&(!isFinite(I)||isNaN(I))?{mathjs:"number",value:String(I)}:typeof I=="bigint"?{mathjs:"bigint",value:String(I)}:I}),H4="13.0.2",d4=T("true",[],()=>!0),b4=T("false",[],()=>!1),u4=T("null",[],()=>null),m4=dI("Infinity",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(1/0):1/0}),Z4=dI("NaN",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(NaN):NaN}),p4=dI("pi",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?bw(I):PH}),f4=dI("tau",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?Fp(I):_H}),W4=dI("e",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?Mp(I):$H}),x4=dI("phi",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?Kp(I):Ad}),v4=dI("LN2",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(2).ln():Math.LN2}),V4=dI("LN10",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(10).ln():Math.LN10}),q4=dI("LOG2E",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(1).div(new I(2).ln()):Math.LOG2E}),O4=dI("LOG10E",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(1).div(new I(10).ln()):Math.LOG10E}),T4=dI("SQRT1_2",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I("0.5").sqrt():Math.SQRT1_2}),j4=dI("SQRT2",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(2).sqrt():Math.SQRT2}),X4=dI("i",["Complex"],A=>{var{Complex:g}=A;return g.I}),z4=T("PI",["pi"],A=>{var{pi:g}=A;return g}),P4=T("E",["e"],A=>{var{e:g}=A;return g}),_4=T("version",[],()=>H4);function dI(A,g,I){return T(A,g,I,{recreateOnConfigChange:!0})}var $4=$A("speedOfLight","299792458","m s^-1"),AT=$A("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),gT=$A("planckConstant","6.62607015e-34","J s"),IT=$A("reducedPlanckConstant","1.0545718176461565e-34","J s"),BT=$A("magneticConstant","1.25663706212e-6","N A^-2"),CT=$A("electricConstant","8.8541878128e-12","F m^-1"),QT=$A("vacuumImpedance","376.730313667","ohm"),ET=$A("coulomb","8.987551792261171e9","N m^2 C^-2"),iT=$A("elementaryCharge","1.602176634e-19","C"),oT=$A("bohrMagneton","9.2740100783e-24","J T^-1"),DT=$A("conductanceQuantum","7.748091729863649e-5","S"),wT=$A("inverseConductanceQuantum","12906.403729652257","ohm"),sT=$A("magneticFluxQuantum","2.0678338484619295e-15","Wb"),yT=$A("nuclearMagneton","5.0507837461e-27","J T^-1"),aT=$A("klitzing","25812.807459304513","ohm"),GT=$A("bohrRadius","5.29177210903e-11","m"),NT=$A("classicalElectronRadius","2.8179403262e-15","m"),RT=$A("electronMass","9.1093837015e-31","kg"),eT=$A("fermiCoupling","1.1663787e-5","GeV^-2"),tT=Jo("fineStructure",.0072973525693),MT=$A("hartreeEnergy","4.3597447222071e-18","J"),KT=$A("protonMass","1.67262192369e-27","kg"),FT=$A("deuteronMass","3.3435830926e-27","kg"),cT=$A("neutronMass","1.6749271613e-27","kg"),rT=$A("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),ST=$A("rydberg","10973731.568160","m^-1"),LT=$A("thomsonCrossSection","6.6524587321e-29","m^2"),UT=Jo("weakMixingAngle",.2229),nT=Jo("efimovFactor",22.7),hT=$A("atomicMass","1.66053906660e-27","kg"),YT=$A("avogadro","6.02214076e23","mol^-1"),JT=$A("boltzmann","1.380649e-23","J K^-1"),kT=$A("faraday","96485.33212331001","C mol^-1"),lT=$A("firstRadiation","3.7417718521927573e-16","W m^2"),HT=$A("loschmidt","2.686780111798444e25","m^-3"),dT=$A("gasConstant","8.31446261815324","J K^-1 mol^-1"),bT=$A("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),uT=$A("molarVolume","0.022413969545014137","m^3 mol^-1"),mT=Jo("sackurTetrode",-1.16487052358),ZT=$A("secondRadiation","0.014387768775039337","m K"),pT=$A("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),fT=$A("wienDisplacement","2.897771955e-3","m K"),WT=$A("molarMass","0.99999999965e-3","kg mol^-1"),xT=$A("molarMassC12","11.9999999958e-3","kg mol^-1"),vT=$A("gravity","9.80665","m s^-2"),VT=$A("planckLength","1.616255e-35","m"),qT=$A("planckMass","2.176435e-8","kg"),OT=$A("planckTime","5.391245e-44","s"),TT=$A("planckCharge","1.87554603778e-18","C"),jT=$A("planckTemperature","1.416785e+32","K");function $A(A,g,I){var B=["config","Unit","BigNumber"];return T(A,B,C=>{var{config:Q,Unit:E,BigNumber:w}=C,D=Q.number==="BigNumber"?new w(g):parseFloat(g),i=new E(D,I);return i.fixPrefix=!0,i})}function Jo(A,g){var I=["config","BigNumber"];return T(A,I,B=>{var{config:C,BigNumber:Q}=B;return C.number==="BigNumber"?new Q(g):g})}var XT="apply",zT=["typed","isInteger"],PT=T(XT,zT,A=>{var{typed:g,isInteger:I}=A,B=Lw({typed:g,isInteger:I});return g("apply",{"...any":function(Q){var E=Q[1];Ag(E)?Q[1]=E-1:PA(E)&&(Q[1]=E.minus(1));try{return B.apply(null,Q)}catch(w){throw KI(w)}}})},{isTransformFunction:!0}),_T="column",$T=["typed","Index","matrix","range"],Aj=T(_T,$T,A=>{var{typed:g,Index:I,matrix:B,range:C}=A,Q=ge({typed:g,Index:I,matrix:B,range:C});return g("column",{"...any":function(w){var D=w.length-1,i=w[D];Ag(i)&&(w[D]=i-1);try{return Q.apply(null,w)}catch(o){throw KI(o)}}})},{isTransformFunction:!0});function _w(A,g,I){var B=A.filter(function(D){return qg(D)&&!(D.name in g)&&!I.has(D.name)})[0];if(!B)throw new Error('No undefined variable found in inline expression "'+A+'"');var C=B.name,Q=new Map,E=new e0(I,Q,new Set([C])),w=A.compile();return function(i){return Q.set(C,i),w.evaluate(E)}}var gj="filter",Ij=["typed"],Bj=T(gj,Ij,A=>{var{typed:g}=A;function I(C,Q,E){var w,D;return C[0]&&(w=C[0].compile().evaluate(E)),C[1]&&(qg(C[1])||DQ(C[1])?D=C[1].compile().evaluate(E):D=_w(C[1],Q,E)),B(w,D)}I.rawArgs=!0;var B=g("filter",{"Array, function":JK,"Matrix, function":function(Q,E){return Q.create(JK(Q.toArray(),E))},"Array, RegExp":ji,"Matrix, RegExp":function(Q,E){return Q.create(ji(Q.toArray(),E))}});return I},{isTransformFunction:!0});function JK(A,g){return T0(A,function(I,B,C){return UQ(g,I,[B+1],C,"filter")})}var Cj="forEach",Qj=["typed"],Ej=T(Cj,Qj,A=>{var{typed:g}=A;function I(C,Q,E){var w,D;return C[0]&&(w=C[0].compile().evaluate(E)),C[1]&&(qg(C[1])||DQ(C[1])?D=C[1].compile().evaluate(E):D=_w(C[1],Q,E)),B(w,D)}I.rawArgs=!0;var B=g("forEach",{"Array | Matrix, function":function(Q,E){var w=function D(i,o){if(Array.isArray(i))Ti(i,function(s,y){D(s,o.concat(y+1))});else return UQ(E,i,o,Q,"forEach")};w(Q.valueOf(),[])}});return I},{isTransformFunction:!0}),ij="index",oj=["Index","getMatrixDataType"],Dj=T(ij,oj,A=>{var{Index:g,getMatrixDataType:I}=A;return function(){for(var C=[],Q=0,E=arguments.length;Q<E;Q++){var w=arguments[Q];if(Ji(w))w.start--,w.end-=w.step>0?0:2;else if(w&&w.isSet===!0)w=w.map(function(i){return i-1});else if(ag(w)||qA(w))I(w)!=="boolean"&&(w=w.map(function(i){return i-1}));else if(Ag(w))w--;else if(PA(w))w=w.toNumber()-1;else if(typeof w!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");C[Q]=w}var D=new g;return g.apply(D,C),D}},{isTransformFunction:!0}),wj="map",sj=["typed"],yj=T(wj,sj,A=>{var{typed:g}=A;function I(C,Q,E){var w,D;return C[0]&&(w=C[0].compile().evaluate(E)),C[1]&&(qg(C[1])||DQ(C[1])?D=C[1].compile().evaluate(E):D=_w(C[1],Q,E)),B(w,D)}I.rawArgs=!0;var B=g("map",{"Array, function":function(Q,E){return kK(Q,E,Q)},"Matrix, function":function(Q,E){return Q.create(kK(Q.valueOf(),E,Q))}});return I},{isTransformFunction:!0});function kK(A,g,I){function B(C,Q){return Array.isArray(C)?ZB(C,function(E,w){return B(E,Q.concat(w+1))}):UQ(g,C,Q,I,"map")}return B(A,[])}function aC(A){if(A.length===2&&kI(A[0])){A=A.slice();var g=A[1];Ag(g)?A[1]=g-1:PA(g)&&(A[1]=g.minus(1))}return A}var aj="max",Gj=["typed","config","numeric","larger"],Nj=T(aj,Gj,A=>{var{typed:g,config:I,numeric:B,larger:C}=A,Q=et({typed:g,config:I,numeric:B,larger:C});return g("max",{"...any":function(w){w=aC(w);try{return Q.apply(null,w)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),Rj="mean",ej=["typed","add","divide"],tj=T(Rj,ej,A=>{var{typed:g,add:I,divide:B}=A,C=vM({typed:g,add:I,divide:B});return g("mean",{"...any":function(E){E=aC(E);try{return C.apply(null,E)}catch(w){throw KI(w)}}})},{isTransformFunction:!0}),Mj="min",Kj=["typed","config","numeric","smaller"],Fj=T(Mj,Kj,A=>{var{typed:g,config:I,numeric:B,smaller:C}=A,Q=Mt({typed:g,config:I,numeric:B,smaller:C});return g("min",{"...any":function(w){w=aC(w);try{return Q.apply(null,w)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),cj="range",rj=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Sj=T(cj,rj,A=>{var{typed:g,config:I,matrix:B,bignumber:C,smaller:Q,smallerEq:E,larger:w,largerEq:D,add:i,isPositive:o}=A,s=ee({typed:g,config:I,matrix:B,bignumber:C,smaller:Q,smallerEq:E,larger:w,largerEq:D,add:i,isPositive:o});return g("range",{"...any":function(a){var N=a.length-1,e=a[N];return typeof e!="boolean"&&a.push(!0),s.apply(null,a)}})},{isTransformFunction:!0}),Lj="row",Uj=["typed","Index","matrix","range"],nj=T(Lj,Uj,A=>{var{typed:g,Index:I,matrix:B,range:C}=A,Q=ce({typed:g,Index:I,matrix:B,range:C});return g("row",{"...any":function(w){var D=w.length-1,i=w[D];Ag(i)&&(w[D]=i-1);try{return Q.apply(null,w)}catch(o){throw KI(o)}}})},{isTransformFunction:!0}),hj="subset",Yj=["typed","matrix","zeros","add"],Jj=T(hj,Yj,A=>{var{typed:g,matrix:I,zeros:B,add:C}=A,Q=Ue({typed:g,matrix:I,zeros:B,add:C});return g("subset",{"...any":function(w){try{return Q.apply(null,w)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),kj="concat",lj=["typed","matrix","isInteger"],Hj=T(kj,lj,A=>{var{typed:g,matrix:I,isInteger:B}=A,C=$R({typed:g,matrix:I,isInteger:B});return g("concat",{"...any":function(E){var w=E.length-1,D=E[w];Ag(D)?E[w]=D-1:PA(D)&&(E[w]=D.minus(1));try{return C.apply(null,E)}catch(i){throw KI(i)}}})},{isTransformFunction:!0}),lK="diff",dj=["typed","matrix","subtract","number","bignumber"],bj=T(lK,dj,A=>{var{typed:g,matrix:I,subtract:B,number:C,bignumber:Q}=A,E=ae({typed:g,matrix:I,subtract:B,number:C,bignumber:Q});return g(lK,{"...any":function(D){D=aC(D);try{return E.apply(null,D)}catch(i){throw KI(i)}}})},{isTransformFunction:!0}),uj="std",mj=["typed","map","sqrt","variance"],Zj=T(uj,mj,A=>{var{typed:g,map:I,sqrt:B,variance:C}=A,Q=PM({typed:g,map:I,sqrt:B,variance:C});return g("std",{"...any":function(w){w=aC(w);try{return Q.apply(null,w)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),HK="sum",pj=["typed","config","add","numeric"],fj=T(HK,pj,A=>{var{typed:g,config:I,add:B,numeric:C}=A,Q=fM({typed:g,config:I,add:B,numeric:C});return g(HK,{"...any":function(w){w=aC(w);try{return Q.apply(null,w)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),Wj="quantileSeq",xj=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],vj=T(Wj,xj,A=>{var{typed:g,bignumber:I,add:B,subtract:C,divide:Q,multiply:E,partitionSelect:w,compare:D,isInteger:i,smaller:o,smallerEq:s,larger:y}=A,a=XM({typed:g,bignumber:I,add:B,subtract:C,divide:Q,multiply:E,partitionSelect:w,compare:D,isInteger:i,smaller:o,smallerEq:s,larger:y});return g("quantileSeq",{"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, number":(e,F,K)=>a(e,F,N(K)),"Array | Matrix, number | BigNumber, boolean":a,"Array | Matrix, number | BigNumber, boolean, number":(e,F,K,U)=>a(e,F,K,N(U)),"Array | Matrix, Array | Matrix":a,"Array | Matrix, Array | Matrix, number":(e,F,K)=>a(e,F,N(K)),"Array | Matrix, Array | Matrix, boolean":a,"Array | Matrix, Array | Matrix, boolean, number":(e,F,K,U)=>a(e,F,K,N(U))});function N(e){return aC([[],e])[1]}},{isTransformFunction:!0}),dK="cumsum",Vj=["typed","add","unaryPlus"],qj=T(dK,Vj,A=>{var{typed:g,add:I,unaryPlus:B}=A,C=WM({typed:g,add:I,unaryPlus:B});return g(dK,{"...any":function(E){if(E.length===2&&kI(E[0])){var w=E[1];Ag(w)?E[1]=w-1:PA(w)&&(E[1]=w.minus(1))}try{return C.apply(null,E)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),bK="variance",Oj=["typed","add","subtract","multiply","divide","apply","isNaN"],Tj=T(bK,Oj,A=>{var{typed:g,add:I,subtract:B,multiply:C,divide:Q,apply:E,isNaN:w}=A,D=TM({typed:g,add:I,subtract:B,multiply:C,divide:Q,apply:E,isNaN:w});return g(bK,{"...any":function(o){o=aC(o);try{return D.apply(null,o)}catch(s){throw KI(s)}}})},{isTransformFunction:!0}),uK="print",jj=["typed","matrix","zeros","add"],Xj=T(uK,jj,A=>{var{typed:g,matrix:I,zeros:B,add:C}=A,Q=ve({typed:g,matrix:I,zeros:B,add:C});return g(uK,{"string, Object | Array":function(D,i){return Q(E(D),i)},"string, Object | Array, number | Object":function(D,i,o){return Q(E(D),i,o)}});function E(w){return w.replace(We,D=>{var i=D.slice(1).split("."),o=i.map(function(s){return!isNaN(s)&&s.length>0?parseInt(s)-1:s});return"$"+o.join(".")})}},{isTransformFunction:!0}),zj="and",Pj=["typed","matrix","zeros","add","equalScalar","not","concat"],_j=T(zj,Pj,A=>{var{typed:g,matrix:I,equalScalar:B,zeros:C,not:Q,concat:E}=A,w=Dt({typed:g,matrix:I,equalScalar:B,zeros:C,not:Q,concat:E});function D(i,o,s){var y=i[0].compile().evaluate(s);if(!kI(y)&&!w(y,!0))return!1;var a=i[1].compile().evaluate(s);return w(y,a)}return D.rawArgs=!0,D},{isTransformFunction:!0}),$j="or",A1=["typed","matrix","equalScalar","DenseMatrix","concat"],g1=T($j,A1,A=>{var{typed:g,matrix:I,equalScalar:B,DenseMatrix:C,concat:Q}=A,E=zR({typed:g,matrix:I,equalScalar:B,DenseMatrix:C,concat:Q});function w(D,i,o){var s=D[0].compile().evaluate(o);if(!kI(s)&&E(s,!1))return!0;var y=D[1].compile().evaluate(o);return E(s,y)}return w.rawArgs=!0,w},{isTransformFunction:!0}),I1="bitAnd",B1=["typed","matrix","zeros","add","equalScalar","not","concat"],C1=T(I1,B1,A=>{var{typed:g,matrix:I,equalScalar:B,zeros:C,not:Q,concat:E}=A,w=pR({typed:g,matrix:I,equalScalar:B,zeros:C,not:Q,concat:E});function D(i,o,s){var y=i[0].compile().evaluate(s);if(!kI(y)){if(isNaN(y))return NaN;if(y===0||y===!1)return 0}var a=i[1].compile().evaluate(s);return w(y,a)}return D.rawArgs=!0,D},{isTransformFunction:!0}),Q1="bitOr",E1=["typed","matrix","equalScalar","DenseMatrix","concat"],i1=T(Q1,E1,A=>{var{typed:g,matrix:I,equalScalar:B,DenseMatrix:C,concat:Q}=A,E=xR({typed:g,matrix:I,equalScalar:B,DenseMatrix:C,concat:Q});function w(D,i,o){var s=D[0].compile().evaluate(o);if(!kI(s)){if(isNaN(s))return NaN;if(s===-1)return-1;if(s===!0)return 1}var y=D[1].compile().evaluate(o);return E(s,y)}return w.rawArgs=!0,w},{isTransformFunction:!0}),mK=Object.freeze(Object.defineProperty({__proto__:null,createAbs:Eb,createAccessorNode:GW,createAcos:lp,createAcosh:dp,createAcot:up,createAcoth:Zp,createAcsc:fp,createAcsch:xp,createAdd:_f,createAddScalar:wb,createAnd:Dt,createAndTransform:_j,createApply:Lw,createApplyTransform:PT,createArg:Xu,createArrayNode:RW,createAsec:Vp,createAsech:Op,createAsin:jp,createAsinh:Pp,createAssignmentNode:KW,createAtan:Af,createAtan2:If,createAtanh:Cf,createAtomicMass:hT,createAvogadro:YT,createBellNumbers:P8,createBigNumberClass:aH,createBigint:kd,createBignumber:Zd,createBin:lm,createBitAnd:pR,createBitAndTransform:C1,createBitNot:xu,createBitOr:xR,createBitOrTransform:i1,createBitXor:Tu,createBlockNode:cW,createBohrMagneton:oT,createBohrRadius:GT,createBoltzmann:JT,createBoolean:bd,createCatalan:$8,createCbrt:Gb,createCeil:rb,createChain:r3,createChainClass:Ox,createClassicalElectronRadius:NT,createClone:OH,createColumn:ge,createColumnTransform:Aj,createCombinations:y8,createCombinationsWithRep:G8,createCompare:LZ,createCompareNatural:YZ,createCompareText:lZ,createCompile:gx,createComplex:Wd,createComplexClass:eH,createComposition:g4,createConcat:$R,createConcatTransform:Hj,createConditionalNode:SW,createConductanceQuantum:DT,createConj:Pu,createConstantNode:lW,createCorr:w8,createCos:Ef,createCosh:Df,createCot:sf,createCoth:af,createCoulomb:ET,createCount:w2,createCreateUnit:Jp,createCross:y2,createCsc:Nf,createCsch:ef,createCtranspose:Cm,createCube:Lb,createCumSum:WM,createCumSumTransform:qj,createDeepEqual:PZ,createDenseMatrixClass:VH,createDerivative:K4,createDet:L3,createDeuteronMass:FT,createDiag:G2,createDiff:ae,createDiffTransform:bj,createDistance:X3,createDivide:T3,createDivideScalar:Om,createDot:CW,createDotDivide:EZ,createDotMultiply:du,createDotPow:CZ,createE:W4,createEfimovFactor:nT,createEigs:d3,createElectricConstant:CT,createElectronMass:RT,createElementaryCharge:iT,createEqual:dZ,createEqualScalar:Kd,createEqualText:mZ,createErf:Mm,createEvaluate:Bx,createExp:nb,createExpm:u3,createExpm1:Yb,createFactorial:K8,createFalse:b4,createFaraday:kT,createFermiCoupling:eT,createFft:om,createFibonacciHeapClass:Np,createFilter:e2,createFilterTransform:Bj,createFineStructure:tT,createFirstRadiation:lT,createFix:lb,createFlatten:M2,createFloor:FR,createForEach:F2,createForEachTransform:Ej,createFormat:Jm,createFraction:Vd,createFractionClass:LH,createFreqz:U4,createFunctionAssignmentNode:dW,createFunctionNode:PW,createGamma:R8,createGasConstant:dT,createGcd:Iu,createGetMatrixDataType:S2,createGravitationConstant:AT,createGravity:vT,createHartreeEnergy:MT,createHasNumericValue:Dd,createHelp:F3,createHelpClass:vx,createHex:um,createHypot:AW,createI:X4,createIdentity:U2,createIfft:wm,createIm:$u,createImmutableDenseMatrixClass:Dp,createIndex:DW,createIndexClass:yp,createIndexNode:uW,createIndexTransform:Dj,createInfinity:m4,createIntersect:_3,createInv:n3,createInverseConductanceQuantum:wT,createInvmod:Ju,createIsInteger:jH,createIsNaN:Nd,createIsNegative:Qd,createIsNumeric:id,createIsPositive:sd,createIsPrime:Wm,createIsZero:ad,createKldivergence:c8,createKlitzing:aT,createKron:h2,createLN10:V4,createLN2:v4,createLOG10E:O4,createLOG2E:q4,createLarger:qZ,createLargerEq:jZ,createLcm:Eu,createLeafCount:B4,createLeftShift:tZ,createLgamma:t8,createLog:_m,createLog10:ou,createLog1p:AZ,createLog2:wu,createLoschmidt:HT,createLsolve:oZ,createLsolveAll:yZ,createLup:wx,createLusolve:Zx,createLyap:V3,createMad:Q8,createMagneticConstant:BT,createMagneticFluxQuantum:sT,createMap:J2,createMapTransform:yj,createMatrix:Od,createMatrixClass:kH,createMatrixFromColumns:_d,createMatrixFromFunction:jd,createMatrixFromRows:zd,createMax:et,createMaxTransform:Nj,createMean:vM,createMeanTransform:tj,createMedian:B8,createMin:Mt,createMinTransform:Fj,createMod:rR,createMode:Um,createMolarMass:WT,createMolarMassC12:xT,createMolarPlanckConstant:bT,createMolarVolume:uT,createMultinomial:S8,createMultiply:Nu,createMultiplyScalar:au,createNaN:Z4,createNeutronMass:cT,createNode:yW,createNorm:IW,createNot:B2,createNthRoot:eu,createNthRoots:IZ,createNuclearMagneton:yT,createNull:u4,createNumber:hd,createNumeric:Vm,createObjectNode:ZW,createOct:dm,createOnes:b2,createOperatorNode:fW,createOr:zR,createOrTransform:g1,createParenthesisNode:xW,createParse:$W,createParser:ox,createParserClass:Ex,createPartitionSelect:Ip,createPermutations:U8,createPhi:x4,createPi:p4,createPickRandom:v8,createPinv:Y3,createPlanckCharge:TT,createPlanckConstant:gT,createPlanckLength:VT,createPlanckMass:qT,createPlanckTemperature:jT,createPlanckTime:OT,createPolynomialRoot:fx,createPow:jm,createPrint:ve,createPrintTransform:Xj,createProd:hm,createProtonMass:KT,createQr:yx,createQuantileSeq:XM,createQuantileSeqTransform:vj,createQuantumOfCirculation:rT,createRandom:q8,createRandomInt:T8,createRange:ee,createRangeClass:hH,createRangeNode:VW,createRangeTransform:Sj,createRationalize:c4,createRe:g2,createReducedPlanckConstant:IT,createRelationalNode:OW,createReplacer:l4,createReshape:Z2,createResize:W2,createResolve:R4,createResultSet:el,createReviver:Y4,createRightArithShift:KZ,createRightLogShift:cZ,createRotate:v2,createRotationMatrix:q2,createRound:zm,createRow:ce,createRowTransform:nj,createRydberg:ST,createSQRT1_2:T4,createSQRT2:j4,createSackurTetrode:mT,createSchur:x3,createSec:Mf,createSech:Ff,createSecondRadiation:ZT,createSetCartesian:lf,createSetDifference:df,createSetDistinct:uf,createSetIntersect:Zf,createSetIsSubset:ff,createSetMultiplicity:xf,createSetPowerset:Vf,createSetSize:Of,createSetSymDifference:jf,createSetUnion:zf,createSign:Mu,createSimplify:o4,createSimplifyConstant:s4,createSimplifyCore:a4,createSin:rf,createSinh:Lf,createSize:j2,createSlu:ux,createSmaller:pZ,createSmallerEq:xZ,createSolveODE:Rm,createSort:Cp,createSpaClass:tp,createSparse:hp,createSparseMatrixClass:rd,createSpeedOfLight:$4,createSplitUnit:Ab,createSqrt:cu,createSqrtm:Z3,createSquare:Su,createSqueeze:z2,createStd:PM,createStdTransform:Zj,createStefanBoltzmann:pT,createStirlingS2:X8,createString:Hd,createSubset:Ue,createSubsetTransform:Jj,createSubtract:Uu,createSubtractScalar:yb,createSum:fM,createSumTransform:fj,createSylvester:f3,createSymbolNode:XW,createSymbolicEqual:t4,createTan:nf,createTanh:Jf,createTau:f4,createThomsonCrossSection:LT,createTo:pm,createTrace:iW,createTranspose:Im,createTrue:d4,createTypeOf:ed,createTyped:al,createUnaryMinus:Ib,createUnaryPlus:Cb,createUnequal:$Z,createUnitClass:Sp,createUnitFunction:Up,createUppercaseE:P4,createUppercasePi:z4,createUsolve:wZ,createUsolveAll:GZ,createVacuumImpedance:QT,createVariance:TM,createVarianceTransform:Tj,createVersion:_4,createWeakMixingAngle:UT,createWienDisplacement:fT,createXgcd:hu,createXor:E2,createZeros:Em,createZeta:Sm,createZpk2tf:S4},Symbol.toStringTag,{value:"Module"})),$w={exports:{}};function As(){}As.prototype={on:function(A,g,I){var B=this.e||(this.e={});return(B[A]||(B[A]=[])).push({fn:g,ctx:I}),this},once:function(A,g,I){var B=this;function C(){B.off(A,C),g.apply(I,arguments)}return C._=g,this.on(A,C,I)},emit:function(A){var g=[].slice.call(arguments,1),I=((this.e||(this.e={}))[A]||[]).slice(),B=0,C=I.length;for(B;B<C;B++)I[B].fn.apply(I[B].ctx,g);return this},off:function(A,g){var I=this.e||(this.e={}),B=I[A],C=[];if(B&&g)for(var Q=0,E=B.length;Q<E;Q++)B[Q].fn!==g&&B[Q].fn._!==g&&C.push(B[Q]);return C.length?I[A]=C:delete I[A],this}},$w.exports=As,$w.exports.TinyEmitter=As;var o1=$w.exports;const D1=sE(o1);function w1(A){var g=new D1;return A.on=g.on.bind(g),A.off=g.off.bind(g),A.once=g.once.bind(g),A.emit=g.emit.bind(g),A}function s1(A,g,I,B){function C(F,K){var U=arguments.length;if(U!==1&&U!==2)throw new WB("import",U,1,2);K||(K={});function M(Y,h,n){if(Array.isArray(h))h.forEach(b=>M(Y,b));else if(typeof h=="object")for(var J in h)mA(h,J)&&M(Y,h[J],J);else if(eE(h)||n!==void 0){var H=eE(h)?N(h)?h.fn+".transform":h.fn:n;if(mA(Y,H)&&Y[H]!==h&&!K.silent)throw new Error('Cannot import "'+H+'" twice');Y[H]=h}else if(!K.silent)throw new TypeError("Factory, Object, or Array expected")}var r={};M(r,F);for(var S in r)if(mA(r,S)){var c=r[S];if(eE(c))i(c,K);else if(o(c))Q(S,c,K);else if(!K.silent)throw new TypeError("Factory, Object, or Array expected")}}function Q(F,K,U){if(U.wrap&&typeof K=="function"&&(K=D(K)),s(K)&&(K=A(F,{[K.signature]:K})),A.isTypedFunction(I[F])&&A.isTypedFunction(K)){U.override?K=A(F,K.signatures):K=A(I[F],K),I[F]=K,delete B[F],E(F,K),I.emit("import",F,function(){return K});return}if(I[F]===void 0||U.override){I[F]=K,delete B[F],E(F,K),I.emit("import",F,function(){return K});return}if(!U.silent)throw new Error('Cannot import "'+F+'": already exists')}function E(F,K){K&&typeof K.transform=="function"?(I.expression.transform[F]=K.transform,y(F)&&(I.expression.mathWithTransform[F]=K.transform)):(delete I.expression.transform[F],y(F)&&(I.expression.mathWithTransform[F]=K))}function w(F){delete I.expression.transform[F],y(F)?I.expression.mathWithTransform[F]=I[F]:delete I.expression.mathWithTransform[F]}function D(F){var K=function(){for(var M=[],r=0,S=arguments.length;r<S;r++){var c=arguments[r];M[r]=c&&c.valueOf()}return F.apply(I,M)};return F.transform&&(K.transform=F.transform),K}function i(F,K){var U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:F.fn;if(U.includes("."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(U));var M=N(F)?I.expression.transform:I,r=U in I.expression.transform,S=mA(M,U)?M[U]:void 0,c=function(){var h={};F.dependencies.map(G0).forEach(J=>{if(J.includes("."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(J));J==="math"?h.math=I:J==="mathWithTransform"?h.mathWithTransform=I.expression.mathWithTransform:J==="classes"?h.classes=I:h[J]=I[J]});var n=F(h);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(S===void 0||K.override)return n;if(A.isTypedFunction(S)&&A.isTypedFunction(n))return A(S,n);if(K.silent)return S;throw new Error('Cannot import "'+U+'": already exists')};!F.meta||F.meta.lazy!==!1?(ki(M,U,c),S&&r?w(U):(N(F)||a(F))&&ki(I.expression.mathWithTransform,U,()=>M[U])):(M[U]=c(),S&&r?w(U):(N(F)||a(F))&&ki(I.expression.mathWithTransform,U,()=>M[U])),B[U]=F,I.emit("import",U,c)}function o(F){return typeof F=="function"||typeof F=="number"||typeof F=="string"||typeof F=="boolean"||F===null||SI(F)||AB(F)||PA(F)||YC(F)||qA(F)||Array.isArray(F)}function s(F){return typeof F=="function"&&typeof F.signature=="string"}function y(F){return!mA(e,F)}function a(F){return!F.fn.includes(".")&&!mA(e,F.fn)&&(!F.meta||!F.meta.isClass)}function N(F){return F!==void 0&&F.meta!==void 0&&F.meta.isTransformFunction===!0||!1}var e={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return C}function gs(A,g){var I=wI({},fG,g);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 B=w1({isNumber:Ag,isComplex:AB,isBigNumber:PA,isBigInt:WG,isFraction:YC,isUnit:SI,isString:II,isArray:ag,isMatrix:qA,isCollection:kI,isDenseMatrix:yE,isSparseMatrix:IC,isRange:Ji,isIndex:aE,isBoolean:xG,isResultSet:vG,isHelp:gw,isFunction:VG,isDate:qG,isRegExp:OG,isObject:GE,isNull:TG,isUndefined:jG,isAccessorNode:BC,isArrayNode:lI,isAssignmentNode:XG,isBlockNode:zG,isConditionalNode:PG,isConstantNode:og,isFunctionAssignmentNode:DQ,isFunctionNode:dB,isIndexNode:JC,isNode:eg,isObjectNode:NE,isOperatorNode:Zg,isParenthesisNode:NB,isRangeNode:_G,isRelationalNode:$G,isSymbolNode:qg,isChain:Bw});B.config=xk(I,B.emit),B.expression={transform:{},mathWithTransform:{config:B.config}};var C=[],Q=[];function E(o){if(eE(o))return o(B);var s=o[Object.keys(o)[0]];if(eE(s))return s(B);if(!fk(o))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",o),new Error("Factory object with properties `type`, `name`, and `factory` expected");var y=C.indexOf(o),a;return y===-1?(o.math===!0?a=o.factory(B.type,I,E,B.typed,B):a=o.factory(B.type,I,E,B.typed),C.push(o),Q.push(a)):a=Q[y],a}var w={};function D(){for(var o=arguments.length,s=new Array(o),y=0;y<o;y++)s[y]=arguments[y];return B.typed.apply(B.typed,s)}D.isTypedFunction=kC.isTypedFunction;var i=s1(D,E,B,w);return B.import=i,B.on("config",()=>{Object.values(w).forEach(o=>{o&&o.meta&&o.meta.recreateOnConfigChange&&i(o,{override:!0})})}),B.create=gs.bind(null,A),B.factory=T,B.import(Object.values(pk(A))),B.ArgumentsError=WB,B.DimensionError=Ig,B.IndexError=VI,B}const y1=gs(mK,{}),ZK="simcore/services/comp/opencor";function Is(A,g){let I=-1;const B=new y1.parser;return A.simulationUiInfo.input.forEach(C=>{++I,B.set(C.id,A.$refs.simInput[I].vModel)}),B.evaluate(g)}function pK(A){A.$nextTick(()=>{let g=-1;A.simulationUiInfo.input.forEach(I=>{++g,A.$refs.simInput[g].visible=I.visible===void 0?!0:Is(A,I.visible)}),A.libopencor!==void 0&&(A.userMessage="Rerunning the model...",A.showUserMessage=!0,A.$nextTick(()=>{A.runSimulation()}))})}function fK(A){if(!A.hasFinalisedUi&&A.isMounted&&A.hasValidSimulationUiInfo){A.$refs.output.classList.add("x"+A.simulationUiInfo.output.plots.length);let g=-1;A.simulationUiInfo.output.plots.forEach(()=>{A.simulationResults[++g]=[{x:[],y:[],type:"scatter"}]}),pK(A),A.hasFinalisedUi=!0}}const WK=(A,g)=>{const I=A.__vccOpts||A;for(const[B,C]of g)I[B]=C;return I},a1={name:"SimulationVuerInput",components:{ElInputNumber:zD,ElOption:dG,ElSelect:HG,ElSlider:mG},props:{defaultValue:{required:!0,type:Number},maximumValue:{type:Number},minimumValue:{type:Number},name:{required:!0,type:String},possibleValues:{type:Array},stepValue:{type:Number}},data:function(){return{isDiscrete:this.possibleValues!==void 0,labelClasses:"default "+(this.possibleValues!==void 0?"discrete":"scalar"),visible:!0,vModel:this.defaultValue}},methods:{updateUi:function(){pK(this.$parent)}}},G1={key:1,class:"sliders-and-fields"};function N1(A,g,I,B,C,Q){const E=dG,w=HG,D=mG,i=zD;return G.withDirectives((G.openBlock(),G.createElementBlock("div",null,[G.createElementVNode("p",{class:G.normalizeClass(A.labelClasses)},G.toDisplayString(I.name),3),A.isDiscrete?(G.openBlock(),G.createBlock(w,{key:0,class:"discrete","popper-class":"discrete-popper",size:"small",modelValue:A.vModel,"onUpdate:modelValue":g[0]||(g[0]=o=>A.vModel=o),teleported:!1,onChange:g[1]||(g[1]=o=>Q.updateUi())},{default:G.withCtx(()=>[(G.openBlock(!0),G.createElementBlock(G.Fragment,null,G.renderList(I.possibleValues,o=>(G.openBlock(),G.createBlock(E,{key:o.value,label:o.name,value:o.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):G.createCommentVNode("",!0),A.isDiscrete?G.createCommentVNode("",!0):(G.openBlock(),G.createElementBlock("div",G1,[G.createVNode(D,{modelValue:A.vModel,"onUpdate:modelValue":g[2]||(g[2]=o=>A.vModel=o),max:I.maximumValue,min:I.minimumValue,"show-input":!1,"show-tooltip":!1,step:I.stepValue,onChange:g[3]||(g[3]=o=>Q.updateUi())},null,8,["modelValue","max","min","step"]),G.createVNode(i,{class:"scalar",size:"small",modelValue:A.vModel,"onUpdate:modelValue":g[4]||(g[4]=o=>A.vModel=o),controls:!1,max:I.maximumValue,min:I.minimumValue,step:I.stepValue,"step-strictly":!0,onInput:g[5]||(g[5]=o=>Q.updateUi())},null,8,["modelValue","max","min","step"])]))],512)),[[G.vShow,A.visible]])}const xK=WK(a1,[["render",N1],["__scopeId","data-v-33359392"]]);var GC={},ko={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */ko.exports,function(A,g){(function(I){var B=g&&!g.nodeType&&g,C=A&&!A.nodeType&&A,Q=typeof $I=="object"&&$I;(Q.global===Q||Q.window===Q||Q.self===Q)&&(I=Q);var E,w=2147483647,D=36,i=1,o=26,s=38,y=700,a=72,N=128,e="-",F=/^xn--/,K=/[^\x20-\x7E]/,U=/[\x2E\u3002\uFF0E\uFF61]/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},r=D-i,S=Math.floor,c=String.fromCharCode,Y;function h(_){throw new RangeError(M[_])}function n(_,BA){for(var z=_.length,v=[];z--;)v[z]=BA(_[z]);return v}function J(_,BA){var z=_.split("@"),v="";z.length>1&&(v=z[0]+"@",_=z[1]),_=_.replace(U,".");var iA=_.split("."),eA=n(iA,BA).join(".");return v+eA}function H(_){for(var BA=[],z=0,v=_.length,iA,eA;z<v;)iA=_.charCodeAt(z++),iA>=55296&&iA<=56319&&z<v?(eA=_.charCodeAt(z++),(eA&64512)==56320?BA.push(((iA&1023)<<10)+(eA&1023)+65536):(BA.push(iA),z--)):BA.push(iA);return BA}function b(_){return n(_,function(BA){var z="";return BA>65535&&(BA-=65536,z+=c(BA>>>10&1023|55296),BA=56320|BA&1023),z+=c(BA),z}).join("")}function x(_){return _-48<10?_-22:_-65<26?_-65:_-97<26?_-97:D}function f(_,BA){return _+22+75*(_<26)-((BA!=0)<<5)}function m(_,BA,z){var v=0;for(_=z?S(_/y):_>>1,_+=S(_/BA);_>r*o>>1;v+=D)_=S(_/r);return S(v+(r+1)*_/(_+s))}function d(_){var BA=[],z=_.length,v,iA=0,eA=N,CA=a,sA,GA,yA,aA,NA,KA,UA,HA,P;for(sA=_.lastIndexOf(e),sA<0&&(sA=0),GA=0;GA<sA;++GA)_.charCodeAt(GA)>=128&&h("not-basic"),BA.push(_.charCodeAt(GA));for(yA=sA>0?sA+1:0;yA<z;){for(aA=iA,NA=1,KA=D;yA>=z&&h("invalid-input"),UA=x(_.charCodeAt(yA++)),(UA>=D||UA>S((w-iA)/NA))&&h("overflow"),iA+=UA*NA,HA=KA<=CA?i:KA>=CA+o?o:KA-CA,!(UA<HA);KA+=D)P=D-HA,NA>S(w/P)&&h("overflow"),NA*=P;v=BA.length+1,CA=m(iA-aA,v,aA==0),S(iA/v)>w-eA&&h("overflow"),eA+=S(iA/v),iA%=v,BA.splice(iA++,0,eA)}return b(BA)}function l(_){var BA,z,v,iA,eA,CA,sA,GA,yA,aA,NA,KA=[],UA,HA,P,IA;for(_=H(_),UA=_.length,BA=N,z=0,eA=a,CA=0;CA<UA;++CA)NA=_[CA],NA<128&&KA.push(c(NA));for(v=iA=KA.length,iA&&KA.push(e);v<UA;){for(sA=w,CA=0;CA<UA;++CA)NA=_[CA],NA>=BA&&NA<sA&&(sA=NA);for(HA=v+1,sA-BA>S((w-z)/HA)&&h("overflow"),z+=(sA-BA)*HA,BA=sA,CA=0;CA<UA;++CA)if(NA=_[CA],NA<BA&&++z>w&&h("overflow"),NA==BA){for(GA=z,yA=D;aA=yA<=eA?i:yA>=eA+o?o:yA-eA,!(GA<aA);yA+=D)IA=GA-aA,P=D-aA,KA.push(c(f(aA+IA%P,0))),GA=S(IA/P);KA.push(c(f(GA,0))),eA=m(z,HA,v==iA),z=0,++v}++z,++BA}return KA.join("")}function q(_){return J(_,function(BA){return F.test(BA)?d(BA.slice(4).toLowerCase()):BA})}function Z(_){return J(_,function(BA){return K.test(BA)?"xn--"+l(BA):BA})}if(E={version:"1.4.1",ucs2:{decode:H,encode:b},decode:d,encode:l,toASCII:Z,toUnicode:q},B&&C)if(A.exports==B)C.exports=E;else for(Y in E)E.hasOwnProperty(Y)&&(B[Y]=E[Y]);else I.punycode=E})($I)}(ko,ko.exports);var R1=ko.exports,e1=Error,t1=EvalError,M1=RangeError,K1=ReferenceError,vK=SyntaxError,YE=TypeError,F1=URIError,c1=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var g={},I=Symbol("test"),B=Object(I);if(typeof I=="string"||Object.prototype.toString.call(I)!=="[object Symbol]"||Object.prototype.toString.call(B)!=="[object Symbol]")return!1;var C=42;g[I]=C;for(I in g)return!1;if(typeof Object.keys=="function"&&Object.keys(g).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(g).length!==0)return!1;var Q=Object.getOwnPropertySymbols(g);if(Q.length!==1||Q[0]!==I||!Object.prototype.propertyIsEnumerable.call(g,I))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var E=Object.getOwnPropertyDescriptor(g,I);if(E.value!==C||E.enumerable!==!0)return!1}return!0},VK=typeof Symbol<"u"&&Symbol,r1=c1,S1=function(){return typeof VK!="function"||typeof Symbol!="function"||typeof VK("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:r1()},Bs={__proto__:null,foo:{}},L1=Object,U1=function(){return{__proto__:Bs}.foo===Bs.foo&&!(Bs instanceof L1)},n1="Function.prototype.bind called on incompatible ",h1=Object.prototype.toString,Y1=Math.max,J1="[object Function]",qK=function(g,I){for(var B=[],C=0;C<g.length;C+=1)B[C]=g[C];for(var Q=0;Q<I.length;Q+=1)B[Q+g.length]=I[Q];return B},k1=function(g,I){for(var B=[],C=I||0,Q=0;C<g.length;C+=1,Q+=1)B[Q]=g[C];return B},l1=function(A,g){for(var I="",B=0;B<A.length;B+=1)I+=A[B],B+1<A.length&&(I+=g);return I},H1=function(g){var I=this;if(typeof I!="function"||h1.apply(I)!==J1)throw new TypeError(n1+I);for(var B=k1(arguments,1),C,Q=function(){if(this instanceof C){var o=I.apply(this,qK(B,arguments));return Object(o)===o?o:this}return I.apply(g,qK(B,arguments))},E=Y1(0,I.length-B.length),w=[],D=0;D<E;D++)w[D]="$"+D;if(C=Function("binder","return function ("+l1(w,",")+"){ return binder.apply(this,arguments); }")(Q),I.prototype){var i=function(){};i.prototype=I.prototype,C.prototype=new i,i.prototype=null}return C},d1=H1,Cs=Function.prototype.bind||d1,b1=Function.prototype.call,u1=Object.prototype.hasOwnProperty,m1=Cs,Z1=m1.call(b1,u1),Dg,p1=e1,f1=t1,W1=M1,x1=K1,lQ=vK,HQ=YE,v1=F1,OK=Function,Qs=function(A){try{return OK('"use strict"; return ('+A+").constructor;")()}catch{}},bC=Object.getOwnPropertyDescriptor;if(bC)try{bC({},"")}catch{bC=null}var Es=function(){throw new HQ},V1=bC?function(){try{return arguments.callee,Es}catch{try{return bC(arguments,"callee").get}catch{return Es}}}():Es,dQ=S1(),q1=U1(),$g=Object.getPrototypeOf||(q1?function(A){return A.__proto__}:null),bQ={},O1=typeof Uint8Array>"u"||!$g?Dg:$g(Uint8Array),uC={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Dg:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Dg:ArrayBuffer,"%ArrayIteratorPrototype%":dQ&&$g?$g([][Symbol.iterator]()):Dg,"%AsyncFromSyncIteratorPrototype%":Dg,"%AsyncFunction%":bQ,"%AsyncGenerator%":bQ,"%AsyncGeneratorFunction%":bQ,"%AsyncIteratorPrototype%":bQ,"%Atomics%":typeof Atomics>"u"?Dg:Atomics,"%BigInt%":typeof BigInt>"u"?Dg:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Dg:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Dg:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Dg:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":p1,"%eval%":eval,"%EvalError%":f1,"%Float32Array%":typeof Float32Array>"u"?Dg:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Dg:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Dg:FinalizationRegistry,"%Function%":OK,"%GeneratorFunction%":bQ,"%Int8Array%":typeof Int8Array>"u"?Dg:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Dg:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Dg:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":dQ&&$g?$g($g([][Symbol.iterator]())):Dg,"%JSON%":typeof JSON=="object"?JSON:Dg,"%Map%":typeof Map>"u"?Dg:Map,"%MapIteratorPrototype%":typeof Map>"u"||!dQ||!$g?Dg:$g(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Dg:Promise,"%Proxy%":typeof Proxy>"u"?Dg:Proxy,"%RangeError%":W1,"%ReferenceError%":x1,"%Reflect%":typeof Reflect>"u"?Dg:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Dg:Set,"%SetIteratorPrototype%":typeof Set>"u"||!dQ||!$g?Dg:$g(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Dg:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":dQ&&$g?$g(""[Symbol.iterator]()):Dg,"%Symbol%":dQ?Symbol:Dg,"%SyntaxError%":lQ,"%ThrowTypeError%":V1,"%TypedArray%":O1,"%TypeError%":HQ,"%Uint8Array%":typeof Uint8Array>"u"?Dg:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Dg:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Dg:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Dg:Uint32Array,"%URIError%":v1,"%WeakMap%":typeof WeakMap>"u"?Dg:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Dg:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Dg:WeakSet};if($g)try{null.error}catch(A){var T1=$g($g(A));uC["%Error.prototype%"]=T1}var j1=function A(g){var I;if(g==="%AsyncFunction%")I=Qs("async function () {}");else if(g==="%GeneratorFunction%")I=Qs("function* () {}");else if(g==="%AsyncGeneratorFunction%")I=Qs("async function* () {}");else if(g==="%AsyncGenerator%"){var B=A("%AsyncGeneratorFunction%");B&&(I=B.prototype)}else if(g==="%AsyncIteratorPrototype%"){var C=A("%AsyncGenerator%");C&&$g&&(I=$g(C.prototype))}return uC[g]=I,I},TK={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},JE=Cs,lo=Z1,X1=JE.call(Function.call,Array.prototype.concat),z1=JE.call(Function.apply,Array.prototype.splice),jK=JE.call(Function.call,String.prototype.replace),Ho=JE.call(Function.call,String.prototype.slice),P1=JE.call(Function.call,RegExp.prototype.exec),_1=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,$1=/\\(\\)?/g,AX=function(g){var I=Ho(g,0,1),B=Ho(g,-1);if(I==="%"&&B!=="%")throw new lQ("invalid intrinsic syntax, expected closing `%`");if(B==="%"&&I!=="%")throw new lQ("invalid intrinsic syntax, expected opening `%`");var C=[];return jK(g,_1,function(Q,E,w,D){C[C.length]=w?jK(D,$1,"$1"):E||Q}),C},gX=function(g,I){var B=g,C;if(lo(TK,B)&&(C=TK[B],B="%"+C[0]+"%"),lo(uC,B)){var Q=uC[B];if(Q===bQ&&(Q=j1(B)),typeof Q>"u"&&!I)throw new HQ("intrinsic "+g+" exists, but is not available. Please file an issue!");return{alias:C,name:B,value:Q}}throw new lQ("intrinsic "+g+" does not exist!")},uQ=function(g,I){if(typeof g!="string"||g.length===0)throw new HQ("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof I!="boolean")throw new HQ('"allowMissing" argument must be a boolean');if(P1(/^%?[^%]*%?$/,g)===null)throw new lQ("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var B=AX(g),C=B.length>0?B[0]:"",Q=gX("%"+C+"%",I),E=Q.name,w=Q.value,D=!1,i=Q.alias;i&&(C=i[0],z1(B,X1([0,1],i)));for(var o=1,s=!0;o<B.length;o+=1){var y=B[o],a=Ho(y,0,1),N=Ho(y,-1);if((a==='"'||a==="'"||a==="`"||N==='"'||N==="'"||N==="`")&&a!==N)throw new lQ("property names with quotes must have matching quotes");if((y==="constructor"||!s)&&(D=!0),C+="."+y,E="%"+C+"%",lo(uC,E))w=uC[E];else if(w!=null){if(!(y in w)){if(!I)throw new HQ("base intrinsic for "+g+" exists, but the property is not available.");return}if(bC&&o+1>=B.length){var e=bC(w,y);s=!!e,s&&"get"in e&&!("originalValue"in e.get)?w=e.get:w=w[y]}else s=lo(w,y),w=w[y];s&&!D&&(uC[E]=w)}}return w},XK={exports:{}},is,zK;function os(){if(zK)return is;zK=1;var A=uQ,g=A("%Object.defineProperty%",!0)||!1;if(g)try{g({},"a",{value:1})}catch{g=!1}return is=g,is}var IX=uQ,bo=IX("%Object.getOwnPropertyDescriptor%",!0);if(bo)try{bo([],"length")}catch{bo=null}var PK=bo,_K=os(),BX=vK,mQ=YE,$K=PK,CX=function(g,I,B){if(!g||typeof g!="object"&&typeof g!="function")throw new mQ("`obj` must be an object or a function`");if(typeof I!="string"&&typeof I!="symbol")throw new mQ("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new mQ("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new mQ("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new mQ("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new mQ("`loose`, if provided, must be a boolean");var C=arguments.length>3?arguments[3]:null,Q=arguments.length>4?arguments[4]:null,E=arguments.length>5?arguments[5]:null,w=arguments.length>6?arguments[6]:!1,D=!!$K&&$K(g,I);if(_K)_K(g,I,{configurable:E===null&&D?D.configurable:!E,enumerable:C===null&&D?D.enumerable:!C,value:B,writable:Q===null&&D?D.writable:!Q});else if(w||!C&&!Q&&!E)g[I]=B;else throw new BX("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ds=os(),AF=function(){return!!Ds};AF.hasArrayLengthDefineBug=function(){if(!Ds)return null;try{return Ds([],"length",{value:1}).length!==1}catch{return!0}};var QX=AF,EX=uQ,gF=CX,iX=QX(),IF=PK,BF=YE,oX=EX("%Math.floor%"),DX=function(g,I){if(typeof g!="function")throw new BF("`fn` is not a function");if(typeof I!="number"||I<0||I>4294967295||oX(I)!==I)throw new BF("`length` must be a positive 32-bit integer");var B=arguments.length>2&&!!arguments[2],C=!0,Q=!0;if("length"in g&&IF){var E=IF(g,"length");E&&!E.configurable&&(C=!1),E&&!E.writable&&(Q=!1)}return(C||Q||!B)&&(iX?gF(g,"length",I,!0,!0):gF(g,"length",I)),g};(function(A){var g=Cs,I=uQ,B=DX,C=YE,Q=I("%Function.prototype.apply%"),E=I("%Function.prototype.call%"),w=I("%Reflect.apply%",!0)||g.call(E,Q),D=os(),i=I("%Math.max%");A.exports=function(y){if(typeof y!="function")throw new C("a function is required");var a=w(g,E,arguments);return B(a,1+i(0,y.length-(arguments.length-1)),!0)};var o=function(){return w(g,Q,arguments)};D?D(A.exports,"apply",{value:o}):A.exports.apply=o})(XK);var wX=XK.exports,CF=uQ,QF=wX,sX=QF(CF("String.prototype.indexOf")),yX=function(g,I){var B=CF(g,!!I);return typeof B=="function"&&sX(g,".prototype.")>-1?QF(B):B},ws=typeof Map=="function"&&Map.prototype,ss=Object.getOwnPropertyDescriptor&&ws?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,uo=ws&&ss&&typeof ss.get=="function"?ss.get:null,EF=ws&&Map.prototype.forEach,ys=typeof Set=="function"&&Set.prototype,as=Object.getOwnPropertyDescriptor&&ys?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,mo=ys&&as&&typeof as.get=="function"?as.get:null,iF=ys&&Set.prototype.forEach,aX=typeof WeakMap=="function"&&WeakMap.prototype,kE=aX?WeakMap.prototype.has:null,GX=typeof WeakSet=="function"&&WeakSet.prototype,lE=GX?WeakSet.prototype.has:null,NX=typeof WeakRef=="function"&&WeakRef.prototype,oF=NX?WeakRef.prototype.deref:null,RX=Boolean.prototype.valueOf,eX=Object.prototype.toString,tX=Function.prototype.toString,MX=String.prototype.match,Gs=String.prototype.slice,NC=String.prototype.replace,KX=String.prototype.toUpperCase,DF=String.prototype.toLowerCase,wF=RegExp.prototype.test,sF=Array.prototype.concat,tB=Array.prototype.join,FX=Array.prototype.slice,yF=Math.floor,Ns=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Rs=Object.getOwnPropertySymbols,es=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ZQ=typeof Symbol=="function"&&typeof Symbol.iterator=="object",GI=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ZQ||!0)?Symbol.toStringTag:null,aF=Object.prototype.propertyIsEnumerable,GF=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(A){return A.__proto__}:null);function NF(A,g){if(A===1/0||A===-1/0||A!==A||A&&A>-1e3&&A<1e3||wF.call(/e/,g))return g;var I=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof A=="number"){var B=A<0?-yF(-A):yF(A);if(B!==A){var C=String(B),Q=Gs.call(g,C.length+1);return NC.call(C,I,"$&_")+"."+NC.call(NC.call(Q,/([0-9]{3})/g,"$&_"),/_$/,"")}}return NC.call(g,I,"$&_")}var ts=yK,RF=ts.custom,eF=KF(RF)?RF:null,cX=function A(g,I,B,C){var Q=I||{};if(RC(Q,"quoteStyle")&&Q.quoteStyle!=="single"&&Q.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(RC(Q,"maxStringLength")&&(typeof Q.maxStringLength=="number"?Q.maxStringLength<0&&Q.maxStringLength!==1/0:Q.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var E=RC(Q,"customInspect")?Q.customInspect:!0;if(typeof E!="boolean"&&E!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(RC(Q,"indent")&&Q.indent!==null&&Q.indent!==" "&&!(parseInt(Q.indent,10)===Q.indent&&Q.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(RC(Q,"numericSeparator")&&typeof Q.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var w=Q.numericSeparator;if(typeof g>"u")return"undefined";if(g===null)return"null";if(typeof g=="boolean")return g?"true":"false";if(typeof g=="string")return cF(g,Q);if(typeof g=="number"){if(g===0)return 1/0/g>0?"0":"-0";var D=String(g);return w?NF(g,D):D}if(typeof g=="bigint"){var i=String(g)+"n";return w?NF(g,i):i}var o=typeof Q.depth>"u"?5:Q.depth;if(typeof B>"u"&&(B=0),B>=o&&o>0&&typeof g=="object")return Ms(g)?"[Array]":"[Object]";var s=fX(Q,B);if(typeof C>"u")C=[];else if(FF(C,g)>=0)return"[Circular]";function y(x,f,m){if(f&&(C=FX.call(C),C.push(f)),m){var d={depth:Q.depth};return RC(Q,"quoteStyle")&&(d.quoteStyle=Q.quoteStyle),A(x,d,B+1,C)}return A(x,Q,B+1,C)}if(typeof g=="function"&&!MF(g)){var a=kX(g),N=Zo(g,y);return"[Function"+(a?": "+a:" (anonymous)")+"]"+(N.length>0?" { "+tB.call(N,", ")+" }":"")}if(KF(g)){var e=ZQ?NC.call(String(g),/^(Symbol\(.*\))_[^)]*$/,"$1"):es.call(g);return typeof g=="object"&&!ZQ?HE(e):e}if(mX(g)){for(var F="<"+DF.call(String(g.nodeName)),K=g.attributes||[],U=0;U<K.length;U++)F+=" "+K[U].name+"="+tF(rX(K[U].value),"double",Q);return F+=">",g.childNodes&&g.childNodes.length&&(F+="..."),F+="</"+DF.call(String(g.nodeName))+">",F}if(Ms(g)){if(g.length===0)return"[]";var M=Zo(g,y);return s&&!pX(M)?"["+Fs(M,s)+"]":"[ "+tB.call(M,", ")+" ]"}if(LX(g)){var r=Zo(g,y);return!("cause"in Error.prototype)&&"cause"in g&&!aF.call(g,"cause")?"{ ["+String(g)+"] "+tB.call(sF.call("[cause]: "+y(g.cause),r),", ")+" }":r.length===0?"["+String(g)+"]":"{ ["+String(g)+"] "+tB.call(r,", ")+" }"}if(typeof g=="object"&&E){if(eF&&typeof g[eF]=="function"&&ts)return ts(g,{depth:o-B});if(E!=="symbol"&&typeof g.inspect=="function")return g.inspect()}if(lX(g)){var S=[];return EF&&EF.call(g,function(x,f){S.push(y(f,g,!0)+" => "+y(x,g))}),rF("Map",uo.call(g),S,s)}if(bX(g)){var c=[];return iF&&iF.call(g,function(x){c.push(y(x,g))}),rF("Set",mo.call(g),c,s)}if(HX(g))return Ks("WeakMap");if(uX(g))return Ks("WeakSet");if(dX(g))return Ks("WeakRef");if(nX(g))return HE(y(Number(g)));if(YX(g))return HE(y(Ns.call(g)));if(hX(g))return HE(RX.call(g));if(UX(g))return HE(y(String(g)));if(typeof window<"u"&&g===window)return"{ [object Window] }";if(g===$I)return"{ [object globalThis] }";if(!SX(g)&&!MF(g)){var Y=Zo(g,y),h=GF?GF(g)===Object.prototype:g instanceof Object||g.constructor===Object,n=g instanceof Object?"":"null prototype",J=!h&&GI&&Object(g)===g&&GI in g?Gs.call(eC(g),8,-1):n?"Object":"",H=h||typeof g.constructor!="function"?"":g.constructor.name?g.constructor.name+" ":"",b=H+(J||n?"["+tB.call(sF.call([],J||[],n||[]),": ")+"] ":"");return Y.length===0?b+"{}":s?b+"{"+Fs(Y,s)+"}":b+"{ "+tB.call(Y,", ")+" }"}return String(g)};function tF(A,g,I){var B=(I.quoteStyle||g)==="double"?'"':"'";return B+A+B}function rX(A){return NC.call(String(A),/"/g,"&quot;")}function Ms(A){return eC(A)==="[object Array]"&&(!GI||!(typeof A=="object"&&GI in A))}function SX(A){return eC(A)==="[object Date]"&&(!GI||!(typeof A=="object"&&GI in A))}function MF(A){return eC(A)==="[object RegExp]"&&(!GI||!(typeof A=="object"&&GI in A))}function LX(A){return eC(A)==="[object Error]"&&(!GI||!(typeof A=="object"&&GI in A))}function UX(A){return eC(A)==="[object String]"&&(!GI||!(typeof A=="object"&&GI in A))}function nX(A){return eC(A)==="[object Number]"&&(!GI||!(typeof A=="object"&&GI in A))}function hX(A){return eC(A)==="[object Boolean]"&&(!GI||!(typeof A=="object"&&GI in A))}function KF(A){if(ZQ)return A&&typeof A=="object"&&A instanceof Symbol;if(typeof A=="symbol")return!0;if(!A||typeof A!="object"||!es)return!1;try{return es.call(A),!0}catch{}return!1}function YX(A){if(!A||typeof A!="object"||!Ns)return!1;try{return Ns.call(A),!0}catch{}return!1}var JX=Object.prototype.hasOwnProperty||function(A){return A in this};function RC(A,g){return JX.call(A,g)}function eC(A){return eX.call(A)}function kX(A){if(A.name)return A.name;var g=MX.call(tX.call(A),/^function\s*([\w$]+)/);return g?g[1]:null}function FF(A,g){if(A.indexOf)return A.indexOf(g);for(var I=0,B=A.length;I<B;I++)if(A[I]===g)return I;return-1}function lX(A){if(!uo||!A||typeof A!="object")return!1;try{uo.call(A);try{mo.call(A)}catch{return!0}return A instanceof Map}catch{}return!1}function HX(A){if(!kE||!A||typeof A!="object")return!1;try{kE.call(A,kE);try{lE.call(A,lE)}catch{return!0}return A instanceof WeakMap}catch{}return!1}function dX(A){if(!oF||!A||typeof A!="object")return!1;try{return oF.call(A),!0}catch{}return!1}function bX(A){if(!mo||!A||typeof A!="object")return!1;try{mo.call(A);try{uo.call(A)}catch{return!0}return A instanceof Set}catch{}return!1}function uX(A){if(!lE||!A||typeof A!="object")return!1;try{lE.call(A,lE);try{kE.call(A,kE)}catch{return!0}return A instanceof WeakSet}catch{}return!1}function mX(A){return!A||typeof A!="object"?!1:typeof HTMLElement<"u"&&A instanceof HTMLElement?!0:typeof A.nodeName=="string"&&typeof A.getAttribute=="function"}function cF(A,g){if(A.length>g.maxStringLength){var I=A.length-g.maxStringLength,B="... "+I+" more character"+(I>1?"s":"");return cF(Gs.call(A,0,g.maxStringLength),g)+B}var C=NC.call(NC.call(A,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ZX);return tF(C,"single",g)}function ZX(A){var g=A.charCodeAt(0),I={8:"b",9:"t",10:"n",12:"f",13:"r"}[g];return I?"\\"+I:"\\x"+(g<16?"0":"")+KX.call(g.toString(16))}function HE(A){return"Object("+A+")"}function Ks(A){return A+" { ? }"}function rF(A,g,I,B){var C=B?Fs(I,B):tB.call(I,", ");return A+" ("+g+") {"+C+"}"}function pX(A){for(var g=0;g<A.length;g++)if(FF(A[g],`
82
+ 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"]},LO={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"]},UO={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"]},nO={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"]},hO={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"]},YO={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"]},JO={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"]},kO={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"]},lO={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"]},HO={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent 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"]},dO={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"]},bO={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},uO={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"]},mO={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},ZO={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"]},pO={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"]},fO={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"]},WO={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"]},xO={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"]},vO={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"]},VO={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},qO={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"]},OO={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"]},TO={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"]},jO={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"]},XO={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"]},zO={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"]},PO={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"]},_O={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},$O={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"]},A3={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"]},g3={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:[]},I3={name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},B3={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:[]},C3={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"]},Q3={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"]},E3={name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},i3={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"]},o3={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"]},D3={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"]},w3={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"]},s3={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"]},y3={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"]},a3={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"]},G3={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"]},N3={name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},R3={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"]},e3={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"]},t3={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"]},M3={bignumber:ov,bigint:Dv,boolean:wv,complex:sv,createUnit:yv,fraction:av,index:Gv,matrix:Nv,number:Rv,sparse:ev,splitUnit:tv,string:Mv,unit:Kv,e:UM,E:UM,false:Tx,i:jx,Infinity:Xx,LN2:Px,LN10:zx,LOG2E:$x,LOG10E:_x,NaN:Av,null:gv,pi:nM,PI:nM,phi:Iv,SQRT1_2:Bv,SQRT2:Cv,tau:Qv,true:Ev,version:iv,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:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh 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"]},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"]},derivative:Sv,lsolve:Uv,lsolveAll:nv,lup:hv,lusolve:Yv,leafCount:Lv,polynomialRoot:Jv,resolve:Hv,simplify:dv,simplifyConstant:bv,simplifyCore:uv,symbolicEqual:Zv,rationalize:lv,slu:mv,usolve:pv,usolveAll:fv,qr:kv,abs:Wv,add:xv,cbrt:vv,ceil:Vv,cube:qv,divide:Ov,dotDivide:Tv,dotMultiply:jv,dotPow:Xv,exp:zv,expm:Pv,expm1:_v,fix:$v,floor:AV,gcd:gV,hypot:IV,lcm:CV,log:QV,log2:oV,log1p:iV,log10:EV,mod:DV,multiply:wV,norm:sV,nthRoot:yV,nthRoots:aV,pow:GV,round:NV,sign:RV,sqrt:eV,sqrtm:tV,square:cV,subtract:rV,unaryMinus:SV,unaryPlus:LV,xgcd:UV,invmod:BV,bitAnd:nV,bitNot:hV,bitOr:YV,bitXor:JV,leftShift:kV,rightArithShift:lV,rightLogShift:HV,bellNumbers:dV,catalan:bV,composition:uV,stirlingS2:mV,config:Fv,import:cv,typed:rv,arg:ZV,conj:pV,re:WV,im:fV,evaluate:xV,help:vV,distance:VV,intersect:qV,and:OV,not:TV,or:jV,xor:XV,concat:PV,count:_V,cross:$V,column:zV,ctranspose:Aq,det:gq,diag:Iq,diff:Bq,dot:Cq,getMatrixDataType:Dq,identity:wq,filter:Eq,flatten:iq,forEach:oq,inv:sq,pinv:yq,eigs:Qq,kron:aq,matrixFromFunction:Rq,matrixFromRows:eq,matrixFromColumns:Nq,map:Gq,ones:tq,partitionSelect:Mq,range:Kq,resize:cq,reshape:Fq,rotate:rq,rotationMatrix:Sq,row:Lq,size:Uq,sort:nq,squeeze:hq,subset:Yq,trace:Jq,transpose:kq,zeros:lq,fft:Hq,ifft:dq,sylvester:MV,schur:KV,lyap:FV,solveODE:t3,combinations:bq,combinationsWithRep:uq,factorial:mq,gamma:Zq,kldivergence:fq,lgamma:pq,multinomial:Wq,permutations:xq,pickRandom:vq,random:Vq,randomInt:qq,compare:Oq,compareNatural:Tq,compareText:jq,deepEqual:Xq,equal:zq,equalText:Pq,larger:_q,largerEq:$q,smaller:AO,smallerEq:gO,unequal:IO,setCartesian:BO,setDifference:CO,setDistinct:QO,setIntersect:EO,setIsSubset:iO,setMultiplicity:oO,setPowerset:DO,setSize:wO,setSymDifference:sO,setUnion:yO,zpk2tf:aO,freqz:GO,erf:NO,zeta:RO,cumsum:UO,mad:eO,max:tO,mean:MO,median:KO,min:FO,mode:cO,prod:rO,quantileSeq:SO,std:LO,sum:nO,variance:hO,corr:YO,acos:JO,acosh:kO,acot:lO,acoth:HO,acsc:dO,acsch:bO,asec:uO,asech:mO,asin:ZO,asinh:pO,atan:fO,atanh:xO,atan2:WO,cos:vO,cosh:VO,cot:qO,coth:OO,csc:TO,csch:jO,sec:XO,sech:zO,sin:PO,sinh:_O,tan:$O,tanh:A3,to:g3,clone:B3,format:C3,bin:I3,oct:N3,hex:E3,isNaN:o3,isInteger:i3,isNegative:D3,isNumeric:w3,hasNumericValue:Q3,isPositive:s3,isPrime:y3,isZero:a3,print:R3,typeOf:e3,numeric:G3},hM="help",K3=["typed","mathWithTransform","Help"],F3=T(hM,K3,A=>{var{typed:g,mathWithTransform:I,Help:B}=A;return g(hM,{any:function(Q){var E,w=Q;if(typeof Q!="string"){for(E in I)if(mA(I,E)&&Q===I[E]){w=E;break}}var D=eI(M3,w);if(!D){var i=typeof w=="function"?w.name:w;throw new Error('No documentation found on "'+i+'"')}return new B(D)}})}),YM="chain",c3=["typed","Chain"],r3=T(YM,c3,A=>{var{typed:g,Chain:I}=A;return g(YM,{"":function(){return new I},any:function(C){return new I(C)}})}),JM="det",S3=["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],L3=T(JM,S3,A=>{var{typed:g,matrix:I,subtractScalar:B,multiply:C,divideScalar:Q,isZero:E,unaryMinus:w}=A;return g(JM,{any:function(o){return TA(o)},"Array | Matrix":function(o){var s;switch(qA(o)?s=o.size():Array.isArray(o)?(o=I(o),s=o.size()):s=[],s.length){case 0:return TA(o);case 1:if(s[0]===1)return TA(o.valueOf()[0]);if(s[0]===0)return 1;throw new RangeError("Matrix must be square (size: "+Qg(s)+")");case 2:{var y=s[0],a=s[1];if(y===a)return D(o.clone().valueOf(),y);if(a===0)return 1;throw new RangeError("Matrix must be square (size: "+Qg(s)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Qg(s)+")")}}});function D(i,o,s){if(o===1)return TA(i[0][0]);if(o===2)return B(C(i[0][0],i[1][1]),C(i[1][0],i[0][1]));for(var y=!1,a=new Array(o).fill(0).map((Y,h)=>h),N=0;N<o;N++){var e=a[N];if(E(i[e][N])){var F=void 0;for(F=N+1;F<o;F++)if(!E(i[a[F]][N])){e=a[F],a[F]=a[N],a[N]=e,y=!y;break}if(F===o)return i[e][N]}for(var K=i[e][N],U=N===0?1:i[a[N-1]][N-1],M=N+1;M<o;M++)for(var r=a[M],S=N+1;S<o;S++)i[r][S]=Q(B(C(i[r][S],K),C(i[r][N],i[e][S])),U)}var c=i[a[o-1]][o-1];return y?w(c):c}}),kM="inv",U3=["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],n3=T(kM,U3,A=>{var{typed:g,matrix:I,divideScalar:B,addScalar:C,multiply:Q,unaryMinus:E,det:w,identity:D,abs:i}=A;return g(kM,{"Array | Matrix":function(y){var a=qA(y)?y.size():gg(y);switch(a.length){case 1:if(a[0]===1)return qA(y)?I([B(1,y.valueOf()[0])]):[B(1,y[0])];throw new RangeError("Matrix must be square (size: "+Qg(a)+")");case 2:{var N=a[0],e=a[1];if(N===e)return qA(y)?I(o(y.valueOf(),N,e),y.storage()):o(y,N,e);throw new RangeError("Matrix must be square (size: "+Qg(a)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+Qg(a)+")")}},any:function(y){return B(1,y)}});function o(s,y,a){var N,e,F,K,U;if(y===1){if(K=s[0][0],K===0)throw Error("Cannot calculate inverse, determinant is zero");return[[B(1,K)]]}else if(y===2){var M=w(s);if(M===0)throw Error("Cannot calculate inverse, determinant is zero");return[[B(s[1][1],M),B(E(s[0][1]),M)],[B(E(s[1][0]),M),B(s[0][0],M)]]}else{var r=s.concat();for(N=0;N<y;N++)r[N]=r[N].concat();for(var S=D(y).valueOf(),c=0;c<a;c++){var Y=i(r[c][c]),h=c;for(N=c+1;N<y;)i(r[N][c])>Y&&(Y=i(r[N][c]),h=N),N++;if(Y===0)throw Error("Cannot calculate inverse, determinant is zero");N=h,N!==c&&(U=r[c],r[c]=r[N],r[N]=U,U=S[c],S[c]=S[N],S[N]=U);var n=r[c],J=S[c];for(N=0;N<y;N++){var H=r[N],b=S[N];if(N!==c){if(H[c]!==0){for(F=B(E(H[c]),n[c]),e=c;e<a;e++)H[e]=C(H[e],Q(F,n[e]));for(e=0;e<a;e++)b[e]=C(b[e],Q(F,J[e]))}}else{for(F=n[c],e=c;e<a;e++)H[e]=B(H[e],F);for(e=0;e<a;e++)b[e]=B(b[e],F)}}}return S}}}),lM="pinv",h3=["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],Y3=T(lM,h3,A=>{var{typed:g,matrix:I,inv:B,deepEqual:C,equal:Q,dotDivide:E,dot:w,ctranspose:D,divideScalar:i,multiply:o,add:s,Complex:y}=A;return g(lM,{"Array | Matrix":function(M){var r=qA(M)?M.size():gg(M);switch(r.length){case 1:return K(M)?D(M):r[0]===1?B(M):E(D(M),w(M,M));case 2:{if(K(M))return D(M);var S=r[0],c=r[1];if(S===c)try{return B(M)}catch(Y){if(!(Y instanceof Error&&Y.message.match(/Cannot calculate inverse, determinant is zero/)))throw Y}return qA(M)?I(a(M.valueOf(),S,c),M.storage()):a(M,S,c)}default:throw new RangeError("Matrix must be two dimensional (size: "+Qg(r)+")")}},any:function(M){return Q(M,0)?TA(M):i(1,M)}});function a(U,M,r){var{C:S,F:c}=e(U,M,r),Y=o(B(o(D(S),S)),D(S)),h=o(D(c),B(o(c,D(c))));return o(h,Y)}function N(U,M,r){for(var S=TA(U),c=0,Y=0;Y<M;Y++){if(r<=c)return S;for(var h=Y;F(S[h][c]);)if(h++,M===h&&(h=Y,c++,r===c))return S;[S[h],S[Y]]=[S[Y],S[h]];for(var n=S[Y][c],J=0;J<r;J++)S[Y][J]=E(S[Y][J],n);for(var H=0;H<M;H++)if(H!==Y){n=S[H][c];for(var b=0;b<r;b++)S[H][b]=s(S[H][b],o(-1,o(n,S[Y][b])))}c++}return S}function e(U,M,r){var S=N(U,M,r),c=U.map((h,n)=>h.filter((J,H)=>H<M&&!F(w(S[H],S[H])))),Y=S.filter((h,n)=>!F(w(S[n],S[n])));return{C:c,F:Y}}function F(U){return Q(s(U,y(1,1)),s(0,y(1,1)))}function K(U){return C(s(U,y(1,1)),s(o(U,0),y(1,1)))}});function J3(A){var{addScalar:g,subtract:I,flatten:B,multiply:C,multiplyScalar:Q,divideScalar:E,sqrt:w,abs:D,bignumber:i,diag:o,size:s,reshape:y,inv:a,qr:N,usolve:e,usolveAll:F,equal:K,complex:U,larger:M,smaller:r,matrixFromColumns:S,dot:c}=A;function Y(z,v,iA,eA){var CA=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,sA=h(z,v,iA,eA,CA);n(z,v,iA,eA,CA,sA);var{values:GA,C:yA}=J(z,v,iA,eA,CA);if(CA){var aA=H(z,v,yA,sA,GA,iA,eA);return{values:GA,eigenvectors:aA}}return{values:GA}}function h(z,v,iA,eA,CA){var sA=eA==="BigNumber",GA=eA==="Complex",yA=sA?i(0):0,aA=sA?i(1):GA?U(1):1,NA=sA?i(1):1,KA=sA?i(10):2,UA=Q(KA,KA),HA;CA&&(HA=Array(v).fill(aA));for(var P=!1;!P;){P=!0;for(var IA=0;IA<v;IA++){for(var RA=yA,gA=yA,EA=0;EA<v;EA++)IA!==EA&&(RA=g(RA,D(z[EA][IA])),gA=g(gA,D(z[IA][EA])));if(!K(RA,0)&&!K(gA,0)){for(var wA=NA,cA=RA,rA=E(gA,KA),O=Q(gA,KA);r(cA,rA);)cA=Q(cA,UA),wA=Q(wA,KA);for(;M(cA,O);)cA=E(cA,UA),wA=E(wA,KA);var $=r(E(g(cA,gA),wA),Q(g(RA,gA),.95));if($){P=!1;for(var j=E(1,wA),oA=0;oA<v;oA++)IA!==oA&&(z[IA][oA]=Q(z[IA][oA],j),z[oA][IA]=Q(z[oA][IA],wA));CA&&(HA[IA]=Q(HA[IA],j))}}}}return CA?o(HA):null}function n(z,v,iA,eA,CA,sA){var GA=eA==="BigNumber",yA=eA==="Complex",aA=GA?i(0):yA?U(0):0;GA&&(iA=i(iA));for(var NA=0;NA<v-2;NA++){for(var KA=0,UA=aA,HA=NA+1;HA<v;HA++){var P=z[HA][NA];r(D(UA),D(P))&&(UA=P,KA=HA)}if(!r(D(UA),iA)){if(KA!==NA+1){var IA=z[KA];z[KA]=z[NA+1],z[NA+1]=IA;for(var RA=0;RA<v;RA++){var gA=z[RA][KA];z[RA][KA]=z[RA][NA+1],z[RA][NA+1]=gA}if(CA){var EA=sA[KA];sA[KA]=sA[NA+1],sA[NA+1]=EA}}for(var wA=NA+2;wA<v;wA++){var cA=E(z[wA][NA],UA);if(cA!==0){for(var rA=0;rA<v;rA++)z[wA][rA]=I(z[wA][rA],Q(cA,z[NA+1][rA]));for(var O=0;O<v;O++)z[O][NA+1]=g(z[O][NA+1],Q(cA,z[O][wA]));if(CA)for(var $=0;$<v;$++)sA[wA][$]=I(sA[wA][$],Q(cA,sA[NA+1][$]))}}}}return sA}function J(z,v,iA,eA,CA){var sA=eA==="BigNumber",GA=eA==="Complex",yA=sA?i(1):GA?U(1):1;sA&&(iA=i(iA));for(var aA=TA(z),NA=[],KA=v,UA=[],HA=CA?o(Array(v).fill(yA)):void 0,P=CA?o(Array(KA).fill(yA)):void 0,IA=0;IA<=100;){IA+=1;for(var RA=aA[KA-1][KA-1],gA=0;gA<KA;gA++)aA[gA][gA]=I(aA[gA][gA],RA);var{Q:EA,R:wA}=N(aA);aA=C(wA,EA);for(var cA=0;cA<KA;cA++)aA[cA][cA]=g(aA[cA][cA],RA);if(CA&&(P=C(P,EA)),KA===1||r(D(aA[KA-1][KA-2]),iA)){IA=0,NA.push(aA[KA-1][KA-1]),CA&&(UA.unshift([[1]]),f(P,v),HA=C(HA,P),KA>1&&(P=o(Array(KA-1).fill(yA)))),KA-=1,aA.pop();for(var rA=0;rA<KA;rA++)aA[rA].pop()}else if(KA===2||r(D(aA[KA-2][KA-3]),iA)){IA=0;var O=b(aA[KA-2][KA-2],aA[KA-2][KA-1],aA[KA-1][KA-2],aA[KA-1][KA-1]);NA.push(...O),CA&&(UA.unshift(x(aA[KA-2][KA-2],aA[KA-2][KA-1],aA[KA-1][KA-2],aA[KA-1][KA-1],O[0],O[1],iA,eA)),f(P,v),HA=C(HA,P),KA>2&&(P=o(Array(KA-2).fill(yA)))),KA-=2,aA.pop(),aA.pop();for(var $=0;$<KA;$++)aA[$].pop(),aA[$].pop()}if(KA===0)break}if(NA.sort((tA,FA)=>+I(D(tA),D(FA))),IA>100){var j=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+NA.join(", "));throw j.values=NA,j.vectors=[],j}var oA=CA?C(HA,m(UA,v)):void 0;return{values:NA,C:oA}}function H(z,v,iA,eA,CA,sA,GA){var yA=a(iA),aA=C(yA,z,iA),NA=GA==="BigNumber",KA=GA==="Complex",UA=NA?i(0):KA?U(0):0,HA=NA?i(1):KA?U(1):1,P=[],IA=[];for(var RA of CA){var gA=d(P,RA,K);gA===-1?(P.push(RA),IA.push(1)):IA[gA]+=1}for(var EA=[],wA=P.length,cA=Array(v).fill(UA),rA=o(Array(v).fill(HA)),O=function(){var oA=P[$],tA=I(aA,C(oA,rA)),FA=F(tA,cA);for(FA.shift();FA.length<IA[$];){var JA=l(tA,v,FA,sA,GA);if(JA===null)break;FA.push(JA)}var kA=C(a(eA),iA);FA=FA.map(dA=>C(kA,dA)),EA.push(...FA.map(dA=>({value:oA,vector:B(dA)})))},$=0;$<wA;$++)O();return EA}function b(z,v,iA,eA){var CA=g(z,eA),sA=I(Q(z,eA),Q(v,iA)),GA=Q(CA,.5),yA=Q(w(I(Q(CA,CA),Q(4,sA))),.5);return[g(GA,yA),I(GA,yA)]}function x(z,v,iA,eA,CA,sA,GA,yA){var aA=yA==="BigNumber",NA=yA==="Complex",KA=aA?i(0):NA?U(0):0,UA=aA?i(1):NA?U(1):1;if(r(D(iA),GA))return[[UA,KA],[KA,UA]];if(M(D(I(CA,sA)),GA))return[[I(CA,eA),I(sA,eA)],[iA,iA]];var HA=I(z,CA),P=I(eA,CA);return r(D(v),GA)&&r(D(P),GA)?[[HA,UA],[iA,KA]]:[[v,KA],[P,UA]]}function f(z,v){for(var iA=0;iA<z.length;iA++)z[iA].push(...Array(v-z[iA].length).fill(0));for(var eA=z.length;eA<v;eA++)z.push(Array(v).fill(0)),z[eA][eA]=1;return z}function m(z,v){for(var iA=[],eA=0;eA<v;eA++)iA[eA]=Array(v).fill(0);var CA=0;for(var sA of z){for(var GA=sA.length,yA=0;yA<GA;yA++)for(var aA=0;aA<GA;aA++)iA[CA+yA][CA+aA]=sA[yA][aA];CA+=GA}return iA}function d(z,v,iA){for(var eA=0;eA<z.length;eA++)if(iA(z[eA],v))return eA;return-1}function l(z,v,iA,eA,CA){for(var sA=CA==="BigNumber"?i(1e3):1e3,GA,yA=0;yA<5;++yA){GA=q(v,iA,CA);try{GA=e(z,GA)}catch{continue}if(M(_(GA),sA))break}if(yA>=5)return null;for(yA=0;;){var aA=e(z,GA);if(r(_(Z(GA,[aA])),eA))break;if(++yA>=10)return null;GA=BA(aA)}return GA}function q(z,v,iA){var eA=iA==="BigNumber",CA=iA==="Complex",sA=Array(z).fill(0).map(GA=>2*Math.random()-1);return eA&&(sA=sA.map(GA=>i(GA))),CA&&(sA=sA.map(GA=>U(GA))),sA=Z(sA,v),BA(sA,iA)}function Z(z,v){var iA=s(z);for(var eA of v)eA=y(eA,iA),z=I(z,C(E(c(eA,z),c(eA,eA)),eA));return z}function _(z){return D(w(c(z,z)))}function BA(z,v){var iA=v==="BigNumber",eA=v==="Complex",CA=iA?i(1):eA?U(1):1;return C(E(CA,_(z)),z)}return Y}function k3(A){var{config:g,addScalar:I,subtract:B,abs:C,atan:Q,cos:E,sin:w,multiplyScalar:D,inv:i,bignumber:o,multiply:s,add:y}=A;function a(n,J){var H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:g.relTol,b=arguments.length>3?arguments[3]:void 0,x=arguments.length>4?arguments[4]:void 0;if(b==="number")return N(n,H,x);if(b==="BigNumber")return e(n,H,x);throw TypeError("Unsupported data type: "+b)}function N(n,J,H){var b=n.length,x=Math.abs(J/b),f,m;if(H){m=new Array(b);for(var d=0;d<b;d++)m[d]=Array(b).fill(0),m[d][d]=1}for(var l=c(n);Math.abs(l[1])>=Math.abs(x);){var q=l[0][0],Z=l[0][1];f=F(n[q][q],n[Z][Z],n[q][Z]),n=S(n,f,q,Z),H&&(m=U(m,f,q,Z)),l=c(n)}for(var _=Array(b).fill(0),BA=0;BA<b;BA++)_[BA]=n[BA][BA];return h(TA(_),m,H)}function e(n,J,H){var b=n.length,x=C(J/b),f,m;if(H){m=new Array(b);for(var d=0;d<b;d++)m[d]=Array(b).fill(0),m[d][d]=1}for(var l=Y(n);C(l[1])>=C(x);){var q=l[0][0],Z=l[0][1];f=K(n[q][q],n[Z][Z],n[q][Z]),n=r(n,f,q,Z),H&&(m=M(m,f,q,Z)),l=Y(n)}for(var _=Array(b).fill(0),BA=0;BA<b;BA++)_[BA]=n[BA][BA];return h(TA(_),m,H)}function F(n,J,H){var b=J-n;return Math.abs(b)<=g.relTol?Math.PI/4:.5*Math.atan(2*H/(J-n))}function K(n,J,H){var b=B(J,n);return C(b)<=g.relTol?o(-1).acos().div(4):D(.5,Q(s(2,H,i(b))))}function U(n,J,H,b){for(var x=n.length,f=Math.cos(J),m=Math.sin(J),d=Array(x).fill(0),l=Array(x).fill(0),q=0;q<x;q++)d[q]=f*n[q][H]-m*n[q][b],l[q]=m*n[q][H]+f*n[q][b];for(var Z=0;Z<x;Z++)n[Z][H]=d[Z],n[Z][b]=l[Z];return n}function M(n,J,H,b){for(var x=n.length,f=E(J),m=w(J),d=Array(x).fill(o(0)),l=Array(x).fill(o(0)),q=0;q<x;q++)d[q]=B(D(f,n[q][H]),D(m,n[q][b])),l[q]=I(D(m,n[q][H]),D(f,n[q][b]));for(var Z=0;Z<x;Z++)n[Z][H]=d[Z],n[Z][b]=l[Z];return n}function r(n,J,H,b){for(var x=n.length,f=o(E(J)),m=o(w(J)),d=D(f,f),l=D(m,m),q=Array(x).fill(o(0)),Z=Array(x).fill(o(0)),_=s(o(2),f,m,n[H][b]),BA=I(B(D(d,n[H][H]),_),D(l,n[b][b])),z=y(D(l,n[H][H]),_,D(d,n[b][b])),v=0;v<x;v++)q[v]=B(D(f,n[H][v]),D(m,n[b][v])),Z[v]=I(D(m,n[H][v]),D(f,n[b][v]));n[H][H]=BA,n[b][b]=z,n[H][b]=o(0),n[b][H]=o(0);for(var iA=0;iA<x;iA++)iA!==H&&iA!==b&&(n[H][iA]=q[iA],n[iA][H]=q[iA],n[b][iA]=Z[iA],n[iA][b]=Z[iA]);return n}function S(n,J,H,b){for(var x=n.length,f=Math.cos(J),m=Math.sin(J),d=f*f,l=m*m,q=Array(x).fill(0),Z=Array(x).fill(0),_=d*n[H][H]-2*f*m*n[H][b]+l*n[b][b],BA=l*n[H][H]+2*f*m*n[H][b]+d*n[b][b],z=0;z<x;z++)q[z]=f*n[H][z]-m*n[b][z],Z[z]=m*n[H][z]+f*n[b][z];n[H][H]=_,n[b][b]=BA,n[H][b]=0,n[b][H]=0;for(var v=0;v<x;v++)v!==H&&v!==b&&(n[H][v]=q[v],n[v][H]=q[v],n[b][v]=Z[v],n[v][b]=Z[v]);return n}function c(n){for(var J=n.length,H=0,b=[0,1],x=0;x<J;x++)for(var f=x+1;f<J;f++)Math.abs(H)<Math.abs(n[x][f])&&(H=Math.abs(n[x][f]),b=[x,f]);return[b,H]}function Y(n){for(var J=n.length,H=0,b=[0,1],x=0;x<J;x++)for(var f=x+1;f<J;f++)C(H)<C(n[x][f])&&(H=C(n[x][f]),b=[x,f]);return[b,H]}function h(n,J,H){var b=n.length,x=Array(b),f;if(H){f=Array(b);for(var m=0;m<b;m++)f[m]=Array(b)}for(var d=0;d<b;d++){for(var l=0,q=n[0],Z=0;Z<n.length;Z++)C(n[Z])<C(q)&&(l=Z,q=n[l]);if(x[d]=n.splice(l,1)[0],H)for(var _=0;_<b;_++)f[d][_]=J[_][l],J[_].splice(l,1)}if(!H)return{values:x};var BA=f.map((z,v)=>({value:x[v],vector:z}));return{values:x,eigenvectors:BA}}return a}var l3="eigs",H3=["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"],d3=T(l3,H3,A=>{var{config:g,typed:I,matrix:B,addScalar:C,subtract:Q,equal:E,abs:w,atan:D,cos:i,sin:o,multiplyScalar:s,divideScalar:y,inv:a,bignumber:N,multiply:e,add:F,larger:K,column:U,flatten:M,number:r,complex:S,sqrt:c,diag:Y,size:h,reshape:n,qr:J,usolve:H,usolveAll:b,im:x,re:f,smaller:m,matrixFromColumns:d,dot:l}=A,q=k3({config:g,addScalar:C,subtract:Q,column:U,flatten:M,equal:E,abs:w,atan:D,cos:i,sin:o,multiplyScalar:s,inv:a,bignumber:N,complex:S,multiply:e,add:F}),Z=J3({config:g,addScalar:C,subtract:Q,multiply:e,multiplyScalar:s,flatten:M,divideScalar:y,sqrt:c,abs:w,bignumber:N,diag:Y,size:h,reshape:n,qr:J,inv:a,usolve:H,usolveAll:b,equal:E,complex:S,larger:K,smaller:m,matrixFromColumns:d,dot:l});return I("eigs",{Array:function(sA){return _(B(sA))},"Array, number|BigNumber":function(sA,GA){return _(B(sA),{precision:GA})},"Array, Object"(CA,sA){return _(B(CA),sA)},Matrix:function(sA){return _(sA,{matricize:!0})},"Matrix, number|BigNumber":function(sA,GA){return _(sA,{precision:GA,matricize:!0})},"Matrix, Object":function(sA,GA){var yA={matricize:!0};return wI(yA,GA),_(sA,yA)}});function _(CA){var sA,GA=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},yA="eigenvectors"in GA?GA.eigenvectors:!0,aA=(sA=GA.precision)!==null&&sA!==void 0?sA:g.relTol,NA=BA(CA,aA,yA);return GA.matricize&&(NA.values=B(NA.values),yA&&(NA.eigenvectors=NA.eigenvectors.map(KA=>{var{value:UA,vector:HA}=KA;return{value:UA,vector:B(HA)}}))),yA&&Object.defineProperty(NA,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),NA}function BA(CA,sA,GA){var yA=CA.toArray(),aA=CA.size();if(aA.length!==2||aA[0]!==aA[1])throw new RangeError("Matrix must be square (size: ".concat(Qg(aA),")"));var NA=aA[0];if(v(yA,NA,sA)&&(iA(yA,NA),z(yA,NA,sA))){var KA=eA(CA,yA,NA);return q(yA,NA,sA,KA,GA)}var UA=eA(CA,yA,NA);return Z(yA,NA,sA,UA,GA)}function z(CA,sA,GA){for(var yA=0;yA<sA;yA++)for(var aA=yA;aA<sA;aA++)if(K(N(w(Q(CA[yA][aA],CA[aA][yA]))),GA))return!1;return!0}function v(CA,sA,GA){for(var yA=0;yA<sA;yA++)for(var aA=0;aA<sA;aA++)if(K(N(w(x(CA[yA][aA]))),GA))return!1;return!0}function iA(CA,sA){for(var GA=0;GA<sA;GA++)for(var yA=0;yA<sA;yA++)CA[GA][yA]=f(CA[GA][yA])}function eA(CA,sA,GA){var yA=CA.datatype();if(yA==="number"||yA==="BigNumber"||yA==="Complex")return yA;for(var aA=!1,NA=!1,KA=!1,UA=0;UA<GA;UA++)for(var HA=0;HA<GA;HA++){var P=sA[UA][HA];if(Ag(P)||YC(P))aA=!0;else if(PA(P))NA=!0;else if(AB(P))KA=!0;else throw TypeError("Unsupported type in Matrix: "+Mg(P))}if(NA&&KA&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),KA){for(var IA=0;IA<GA;IA++)for(var RA=0;RA<GA;RA++)sA[IA][RA]=S(sA[IA][RA]);return"Complex"}if(NA){for(var gA=0;gA<GA;gA++)for(var EA=0;EA<GA;EA++)sA[gA][EA]=N(sA[gA][EA]);return"BigNumber"}if(aA){for(var wA=0;wA<GA;wA++)for(var cA=0;cA<GA;cA++)sA[wA][cA]=r(sA[wA][cA]);return"number"}else throw TypeError("Matrix contains unsupported types only.")}}),HM="expm",b3=["typed","abs","add","identity","inv","multiply"],u3=T(HM,b3,A=>{var{typed:g,abs:I,add:B,identity:C,inv:Q,multiply:E}=A;return g(HM,{Matrix:function(s){var y=s.size();if(y.length!==2||y[0]!==y[1])throw new RangeError("Matrix must be square (size: "+Qg(y)+")");for(var a=y[0],N=1e-15,e=w(s),F=D(e,N),K=F.q,U=F.j,M=E(s,Math.pow(2,-U)),r=C(a),S=C(a),c=1,Y=M,h=-1,n=1;n<=K;n++)n>1&&(Y=E(Y,M),h=-h),c=c*(K-n+1)/((2*K-n+1)*n),r=B(r,E(c,Y)),S=B(S,E(c*h,Y));for(var J=E(Q(S),r),H=0;H<U;H++)J=E(J,J);return IC(s)?s.createSparseMatrix(J):J}});function w(o){for(var s=o.size()[0],y=0,a=0;a<s;a++){for(var N=0,e=0;e<s;e++)N+=I(o.get([a,e]));y=Math.max(N,y)}return y}function D(o,s){for(var y=30,a=0;a<y;a++)for(var N=0;N<=a;N++){var e=a-N;if(i(o,N,e)<s)return{q:N,j:e}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}function i(o,s,y){for(var a=1,N=2;N<=s;N++)a*=N;for(var e=a,F=s+1;F<=2*s;F++)e*=F;var K=e*(2*s+1);return 8*Math.pow(o/Math.pow(2,y),2*s)*a*a/(e*K)}}),dM="sqrtm",m3=["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],Z3=T(dM,m3,A=>{var{typed:g,abs:I,add:B,multiply:C,map:Q,sqrt:E,subtract:w,inv:D,size:i,max:o,identity:s}=A,y=1e3,a=1e-6;function N(e){var F,K=0,U=e,M=s(i(e));do{var r=U;if(U=C(.5,B(r,D(M))),M=C(.5,B(M,D(r))),F=o(I(w(U,r))),F>a&&++K>y)throw new Error("computing square root of matrix: iterative method could not converge")}while(F>a);return U}return g(dM,{"Array | Matrix":function(F){var K=qA(F)?F.size():gg(F);switch(K.length){case 1:if(K[0]===1)return Q(F,E);throw new RangeError("Matrix must be square (size: "+Qg(K)+")");case 2:{var U=K[0],M=K[1];if(U===M)return N(F);throw new RangeError("Matrix must be square (size: "+Qg(K)+")")}default:throw new RangeError("Matrix must be at most two dimensional (size: "+Qg(K)+")")}}})}),bM="sylvester",p3=["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],f3=T(bM,p3,A=>{var{typed:g,schur:I,matrixFromColumns:B,matrix:C,multiply:Q,range:E,concat:w,transpose:D,index:i,subset:o,add:s,subtract:y,identity:a,lusolve:N,abs:e}=A;return g(bM,{"Matrix, Matrix, Matrix":F,"Array, Matrix, Matrix":function(U,M,r){return F(C(U),M,r)},"Array, Array, Matrix":function(U,M,r){return F(C(U),C(M),r)},"Array, Matrix, Array":function(U,M,r){return F(C(U),M,C(r))},"Matrix, Array, Matrix":function(U,M,r){return F(U,C(M),r)},"Matrix, Array, Array":function(U,M,r){return F(U,C(M),C(r))},"Matrix, Matrix, Array":function(U,M,r){return F(U,M,C(r))},"Array, Array, Array":function(U,M,r){return F(C(U),C(M),C(r)).toArray()}});function F(K,U,M){for(var r=U.size()[0],S=K.size()[0],c=I(K),Y=c.T,h=c.U,n=I(Q(-1,U)),J=n.T,H=n.U,b=Q(Q(D(h),M),H),x=E(0,S),f=[],m=(KA,UA)=>w(KA,UA,1),d=(KA,UA)=>w(KA,UA,0),l=0;l<r;l++)if(l<r-1&&e(o(J,i(l+1,l)))>1e-5){for(var q=d(o(b,i(x,l)),o(b,i(x,l+1))),Z=0;Z<l;Z++)q=s(q,d(Q(f[Z],o(J,i(Z,l))),Q(f[Z],o(J,i(Z,l+1)))));var _=Q(a(S),Q(-1,o(J,i(l,l)))),BA=Q(a(S),Q(-1,o(J,i(l+1,l)))),z=Q(a(S),Q(-1,o(J,i(l,l+1)))),v=Q(a(S),Q(-1,o(J,i(l+1,l+1)))),iA=d(m(s(Y,_),BA),m(z,s(Y,v))),eA=N(iA,q);f[l]=eA.subset(i(E(0,S),0)),f[l+1]=eA.subset(i(E(S,2*S),0)),l++}else{for(var CA=o(b,i(x,l)),sA=0;sA<l;sA++)CA=s(CA,Q(f[sA],o(J,i(sA,l))));var GA=o(J,i(l,l)),yA=y(Y,Q(GA,a(S)));f[l]=N(yA,CA)}var aA=C(B(...f)),NA=Q(h,Q(aA,D(H)));return NA}}),uM="schur",W3=["typed","matrix","identity","multiply","qr","norm","subtract"],x3=T(uM,W3,A=>{var{typed:g,matrix:I,identity:B,multiply:C,qr:Q,norm:E,subtract:w}=A;return g(uM,{Array:function(o){var s=D(I(o));return{U:s.U.valueOf(),T:s.T.valueOf()}},Matrix:function(o){return D(o)}});function D(i){var o=i.size()[0],s=i,y=B(o),a=0,N;do{N=s;var e=Q(s),F=e.Q,K=e.R;if(s=C(K,F),y=C(y,F),a++>100)break}while(E(w(s,N))>1e-4);return{U:y,T:s}}}),mM="lyap",v3=["typed","matrix","sylvester","multiply","transpose"],V3=T(mM,v3,A=>{var{typed:g,matrix:I,sylvester:B,multiply:C,transpose:Q}=A;return g(mM,{"Matrix, Matrix":function(w,D){return B(w,Q(w),C(-1,D))},"Array, Matrix":function(w,D){return B(I(w),Q(I(w)),C(-1,D))},"Matrix, Array":function(w,D){return B(w,Q(I(w)),I(C(-1,D)))},"Array, Array":function(w,D){return B(I(w),Q(I(w)),I(C(-1,D))).toArray()}})}),q3="divide",O3=["typed","matrix","multiply","equalScalar","divideScalar","inv"],T3=T(q3,O3,A=>{var{typed:g,matrix:I,multiply:B,equalScalar:C,divideScalar:Q,inv:E}=A,w=EI({typed:g,equalScalar:C}),D=CB({typed:g});return g("divide",A0({"Array | Matrix, Array | Matrix":function(o,s){return B(o,E(s))},"DenseMatrix, any":function(o,s){return D(o,s,Q,!1)},"SparseMatrix, any":function(o,s){return w(o,s,Q,!1)},"Array, any":function(o,s){return D(I(o),s,Q,!1).valueOf()},"any, Array | Matrix":function(o,s){return B(o,E(s))}},Q.signatures))}),ZM="distance",j3=["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],X3=T(ZM,j3,A=>{var{typed:g,addScalar:I,subtractScalar:B,multiplyScalar:C,divideScalar:Q,deepEqual:E,sqrt:w,abs:D}=A;return g(ZM,{"Array, Array, Array":function(S,c,Y){if(S.length===2&&c.length===2&&Y.length===2){if(!o(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!o(c))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!o(Y))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(E(c,Y))throw new TypeError("LinePoint1 should not be same with LinePoint2");var h=B(Y[1],c[1]),n=B(c[0],Y[0]),J=B(C(Y[0],c[1]),C(c[0],Y[1]));return F(S[0],S[1],h,n,J)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(S,c,Y){if(Object.keys(S).length===2&&Object.keys(c).length===2&&Object.keys(Y).length===2){if(!o(S))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!o(c))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!o(Y))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(E(N(c),N(Y)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in S&&"pointY"in S&&"lineOnePtX"in c&&"lineOnePtY"in c&&"lineTwoPtX"in Y&&"lineTwoPtY"in Y){var h=B(Y.lineTwoPtY,c.lineOnePtY),n=B(c.lineOnePtX,Y.lineTwoPtX),J=B(C(Y.lineTwoPtX,c.lineOnePtY),C(c.lineOnePtX,Y.lineTwoPtY));return F(S.pointX,S.pointY,h,n,J)}else throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(S,c){if(S.length===2&&c.length===3){if(!o(S))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!s(c))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return F(S[0],S[1],c[0],c[1],c[2])}else if(S.length===3&&c.length===6){if(!s(S))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!a(c))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return K(S[0],S[1],S[2],c[0],c[1],c[2],c[3],c[4],c[5])}else if(S.length===c.length&&S.length>0){if(!y(S))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!y(c))throw new TypeError("All values of an array should be numbers or BigNumbers");return U(S,c)}else throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(S,c){if(Object.keys(S).length===2&&Object.keys(c).length===3){if(!o(S))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!s(c))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in S&&"pointY"in S&&"xCoeffLine"in c&&"yCoeffLine"in c&&"constant"in c)return F(S.pointX,S.pointY,c.xCoeffLine,c.yCoeffLine,c.constant);throw new TypeError("Key names do not match")}else if(Object.keys(S).length===3&&Object.keys(c).length===6){if(!s(S))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!a(c))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in S&&"pointY"in S&&"x0"in c&&"y0"in c&&"z0"in c&&"a"in c&&"b"in c&&"c"in c)return K(S.pointX,S.pointY,S.pointZ,c.x0,c.y0,c.z0,c.a,c.b,c.c);throw new TypeError("Key names do not match")}else if(Object.keys(S).length===2&&Object.keys(c).length===2){if(!o(S))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!o(c))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in S&&"pointOneY"in S&&"pointTwoX"in c&&"pointTwoY"in c)return U([S.pointOneX,S.pointOneY],[c.pointTwoX,c.pointTwoY]);throw new TypeError("Key names do not match")}else if(Object.keys(S).length===3&&Object.keys(c).length===3){if(!s(S))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!s(c))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in S&&"pointOneY"in S&&"pointOneZ"in S&&"pointTwoX"in c&&"pointTwoY"in c&&"pointTwoZ"in c)return U([S.pointOneX,S.pointOneY,S.pointOneZ],[c.pointTwoX,c.pointTwoY,c.pointTwoZ]);throw new TypeError("Key names do not match")}else throw new TypeError("Invalid Arguments: Try again")},Array:function(S){if(!e(S))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return M(S)}});function i(r){return typeof r=="number"||PA(r)}function o(r){return r.constructor!==Array&&(r=N(r)),i(r[0])&&i(r[1])}function s(r){return r.constructor!==Array&&(r=N(r)),i(r[0])&&i(r[1])&&i(r[2])}function y(r){return Array.isArray(r)||(r=N(r)),r.every(i)}function a(r){return r.constructor!==Array&&(r=N(r)),i(r[0])&&i(r[1])&&i(r[2])&&i(r[3])&&i(r[4])&&i(r[5])}function N(r){for(var S=Object.keys(r),c=[],Y=0;Y<S.length;Y++)c.push(r[S[Y]]);return c}function e(r){if(r[0].length===2&&i(r[0][0])&&i(r[0][1])){if(r.some(S=>S.length!==2||!i(S[0])||!i(S[1])))return!1}else if(r[0].length===3&&i(r[0][0])&&i(r[0][1])&&i(r[0][2])){if(r.some(S=>S.length!==3||!i(S[0])||!i(S[1])||!i(S[2])))return!1}else return!1;return!0}function F(r,S,c,Y,h){var n=D(I(I(C(c,r),C(Y,S)),h)),J=w(I(C(c,c),C(Y,Y)));return Q(n,J)}function K(r,S,c,Y,h,n,J,H,b){var x=[B(C(B(h,S),b),C(B(n,c),H)),B(C(B(n,c),J),C(B(Y,r),b)),B(C(B(Y,r),H),C(B(h,S),J))];x=w(I(I(C(x[0],x[0]),C(x[1],x[1])),C(x[2],x[2])));var f=w(I(I(C(J,J),C(H,H)),C(b,b)));return Q(x,f)}function U(r,S){for(var c=r.length,Y=0,h=0,n=0;n<c;n++)h=B(r[n],S[n]),Y=I(C(h,h),Y);return w(Y)}function M(r){for(var S=[],c=[],Y=[],h=0;h<r.length-1;h++)for(var n=h+1;n<r.length;n++)r[0].length===2?(c=[r[h][0],r[h][1]],Y=[r[n][0],r[n][1]]):r[0].length===3&&(c=[r[h][0],r[h][1],r[h][2]],Y=[r[n][0],r[n][1],r[n][2]]),S.push(U(c,Y));return S}}),z3="intersect",P3=["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],_3=T(z3,P3,A=>{var{typed:g,config:I,abs:B,add:C,addScalar:Q,matrix:E,multiply:w,multiplyScalar:D,divideScalar:i,subtract:o,smaller:s,equalScalar:y,flatten:a,isZero:N,isNumeric:e}=A;return g("intersect",{"Array, Array, Array":F,"Array, Array, Array, Array":K,"Matrix, Matrix, Matrix":function(H,b,x){var f=F(H.valueOf(),b.valueOf(),x.valueOf());return f===null?null:E(f)},"Matrix, Matrix, Matrix, Matrix":function(H,b,x,f){var m=K(H.valueOf(),b.valueOf(),x.valueOf(),f.valueOf());return m===null?null:E(m)}});function F(J,H,b){if(J=U(J),H=U(H),b=U(b),!r(J))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!r(H))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!S(b))throw new TypeError("Array with 4 numbers expected as third argument");return n(J[0],J[1],J[2],H[0],H[1],H[2],b[0],b[1],b[2],b[3])}function K(J,H,b,x){if(J=U(J),H=U(H),b=U(b),x=U(x),J.length===2){if(!M(J))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!M(H))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!M(b))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!M(x))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return c(J,H,b,x)}else if(J.length===3){if(!r(J))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!r(H))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!r(b))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!r(x))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return h(J[0],J[1],J[2],H[0],H[1],H[2],b[0],b[1],b[2],x[0],x[1],x[2])}else throw new TypeError("Arrays with two or thee dimensional points expected")}function U(J){return J.length===1?J[0]:J.length>1&&Array.isArray(J[0])&&J.every(H=>Array.isArray(H)&&H.length===1)?a(J):J}function M(J){return J.length===2&&e(J[0])&&e(J[1])}function r(J){return J.length===3&&e(J[0])&&e(J[1])&&e(J[2])}function S(J){return J.length===4&&e(J[0])&&e(J[1])&&e(J[2])&&e(J[3])}function c(J,H,b,x){var f=J,m=b,d=o(f,H),l=o(m,x),q=o(D(d[0],l[1]),D(l[0],d[1]));if(N(q)||s(B(q),I.relTol))return null;var Z=D(l[0],f[1]),_=D(l[1],f[0]),BA=D(l[0],m[1]),z=D(l[1],m[0]),v=i(Q(o(o(Z,_),BA),z),q);return C(w(d,v),f)}function Y(J,H,b,x,f,m,d,l,q,Z,_,BA){var z=D(o(J,H),o(b,x)),v=D(o(f,m),o(d,l)),iA=D(o(q,Z),o(_,BA));return Q(Q(z,v),iA)}function h(J,H,b,x,f,m,d,l,q,Z,_,BA){var z=Y(J,d,Z,d,H,l,_,l,b,q,BA,q),v=Y(Z,d,x,J,_,l,f,H,BA,q,m,b),iA=Y(J,d,x,J,H,l,f,H,b,q,m,b),eA=Y(Z,d,Z,d,_,l,_,l,BA,q,BA,q),CA=Y(x,J,x,J,f,H,f,H,m,b,m,b),sA=o(D(z,v),D(iA,eA)),GA=o(D(CA,eA),D(v,v));if(N(GA))return null;var yA=i(sA,GA),aA=i(Q(z,D(yA,v)),eA),NA=Q(J,D(yA,o(x,J))),KA=Q(H,D(yA,o(f,H))),UA=Q(b,D(yA,o(m,b))),HA=Q(d,D(aA,o(Z,d))),P=Q(l,D(aA,o(_,l))),IA=Q(q,D(aA,o(BA,q)));return y(NA,HA)&&y(KA,P)&&y(UA,IA)?[NA,KA,UA]:null}function n(J,H,b,x,f,m,d,l,q,Z){var _=D(J,d),BA=D(x,d),z=D(H,l),v=D(f,l),iA=D(b,q),eA=D(m,q),CA=o(o(o(Z,_),z),iA),sA=o(o(o(Q(Q(BA,v),eA),_),z),iA),GA=i(CA,sA),yA=Q(J,D(GA,o(x,J))),aA=Q(H,D(GA,o(f,H))),NA=Q(b,D(GA,o(m,b)));return[yA,aA,NA]}}),pM="sum",$3=["typed","config","add","numeric"],fM=T(pM,$3,A=>{var{typed:g,config:I,add:B,numeric:C}=A;return g(pM,{"Array | Matrix":Q,"Array | Matrix, number | BigNumber":E,"...":function(D){if(FQ(D))throw new TypeError("Scalar values expected in function sum");return Q(D)}});function Q(w){var D;return pB(w,function(i){try{D=D===void 0?i:B(D,i)}catch(o){throw MI(o,"sum",i)}}),D===void 0&&(D=C(0,I.number)),typeof D=="string"&&(D=C(D,CC(D,I))),D}function E(w,D){try{var i=zi(w,D,B);return i}catch(o){throw MI(o,"sum")}}}),ho="cumsum",A8=["typed","add","unaryPlus"],WM=T(ho,A8,A=>{var{typed:g,add:I,unaryPlus:B}=A;return g(ho,{Array:C,Matrix:function(i){return i.create(C(i.valueOf()))},"Array, number | BigNumber":E,"Matrix, number | BigNumber":function(i,o){return i.create(E(i.valueOf(),o))},"...":function(i){if(FQ(i))throw new TypeError("All values expected to be scalar in function cumsum");return C(i)}});function C(D){try{return Q(D)}catch(i){throw MI(i,ho)}}function Q(D){if(D.length===0)return[];for(var i=[B(D[0])],o=1;o<D.length;++o)i.push(I(i[o-1],D[o]));return i}function E(D,i){var o=gg(D);if(i<0||i>=o.length)throw new VI(i,o.length);try{return w(D,i)}catch(s){throw MI(s,ho)}}function w(D,i){var o,s,y;if(i<=0){var a=D[0][0];if(Array.isArray(a)){for(y=gN(D),s=[],o=0;o<y.length;o++)s[o]=w(y[o],i-1);return s}else return Q(D)}else{for(s=[],o=0;o<D.length;o++)s[o]=w(D[o],i-1);return s}}}),xM="mean",g8=["typed","add","divide"],vM=T(xM,g8,A=>{var{typed:g,add:I,divide:B}=A;return g(xM,{"Array | Matrix":Q,"Array | Matrix, number | BigNumber":C,"...":function(w){if(FQ(w))throw new TypeError("Scalar values expected in function mean");return Q(w)}});function C(E,w){try{var D=zi(E,w,I),i=Array.isArray(E)?gg(E):E.size();return B(D,i[w])}catch(o){throw MI(o,"mean")}}function Q(E){var w,D=0;if(pB(E,function(i){try{w=w===void 0?i:I(w,i),D++}catch(o){throw MI(o,"mean",i)}}),D===0)throw new Error("Cannot calculate the mean of an empty array");return B(w,D)}}),VM="median",I8=["typed","add","divide","compare","partitionSelect"],B8=T(VM,I8,A=>{var{typed:g,add:I,divide:B,compare:C,partitionSelect:Q}=A;function E(i){try{i=sg(i.valueOf());var o=i.length;if(o===0)throw new Error("Cannot calculate median of an empty array");if(o%2===0){for(var s=o/2-1,y=Q(i,s+1),a=i[s],N=0;N<s;++N)C(i[N],a)>0&&(a=i[N]);return D(a,y)}else{var e=Q(i,(o-1)/2);return w(e)}}catch(F){throw MI(F,"median")}}var w=g({"number | BigNumber | Complex | Unit":function(o){return o}}),D=g({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(o,s){return B(I(o,s),2)}});return g(VM,{"Array | Matrix":E,"Array | Matrix, number | BigNumber":function(o,s){throw new Error("median(A, dim) is not yet supported")},"...":function(o){if(FQ(o))throw new TypeError("Scalar values expected in function median");return E(o)}})}),qM="mad",C8=["typed","abs","map","median","subtract"],Q8=T(qM,C8,A=>{var{typed:g,abs:I,map:B,median:C,subtract:Q}=A;return g(qM,{"Array | Matrix":E,"...":function(D){return E(D)}});function E(w){if(w=sg(w.valueOf()),w.length===0)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var D=C(w);return C(B(w,function(i){return I(Q(i,D))}))}catch(i){throw i instanceof TypeError&&i.message.includes("median")?new TypeError(i.message.replace("median","mad")):MI(i,"mad")}}}),xw="unbiased",OM="variance",E8=["typed","add","subtract","multiply","divide","apply","isNaN"],TM=T(OM,E8,A=>{var{typed:g,add:I,subtract:B,multiply:C,divide:Q,apply:E,isNaN:w}=A;return g(OM,{"Array | Matrix":function(s){return D(s,xw)},"Array | Matrix, string":D,"Array | Matrix, number | BigNumber":function(s,y){return i(s,y,xw)},"Array | Matrix, number | BigNumber, string":i,"...":function(s){return D(s,xw)}});function D(o,s){var y,a=0;if(o.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(pB(o,function(F){try{y=y===void 0?F:I(y,F),a++}catch(K){throw MI(K,"variance",F)}}),a===0)throw new Error("Cannot calculate variance of an empty array");var N=Q(y,a);if(y=void 0,pB(o,function(F){var K=B(F,N);y=y===void 0?C(K,K):I(y,C(K,K))}),w(y))return y;switch(s){case"uncorrected":return Q(y,a);case"biased":return Q(y,a+1);case"unbiased":{var e=PA(y)?y.mul(0):0;return a===1?e:Q(y,a-1)}default:throw new Error('Unknown normalization "'+s+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function i(o,s,y){try{if(o.length===0)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return E(o,s,a=>D(a,y))}catch(a){throw MI(a,"variance")}}}),jM="quantileSeq",i8=["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],XM=T(jM,i8,A=>{var{typed:g,bignumber:I,add:B,subtract:C,divide:Q,multiply:E,partitionSelect:w,compare:D,isInteger:i,smaller:o,smallerEq:s,larger:y}=A,a=Lw({typed:g,isInteger:i});return g(jM,{"Array | Matrix, number | BigNumber":(U,M)=>e(U,M,!1),"Array | Matrix, number | BigNumber, number":(U,M,r)=>N(U,M,!1,r,e),"Array | Matrix, number | BigNumber, boolean":e,"Array | Matrix, number | BigNumber, boolean, number":(U,M,r,S)=>N(U,M,r,S,e),"Array | Matrix, Array | Matrix":(U,M)=>F(U,M,!1),"Array | Matrix, Array | Matrix, number":(U,M,r)=>N(U,M,!1,r,F),"Array | Matrix, Array | Matrix, boolean":F,"Array | Matrix, Array | Matrix, boolean, number":(U,M,r,S)=>N(U,M,r,S,F)});function N(U,M,r,S,c){return a(U,S,Y=>c(Y,M,r))}function e(U,M,r){var S,c=U.valueOf();if(o(M,0))throw new Error("N/prob must be non-negative");if(s(M,1))return Ag(M)?K(c,M,r):I(K(c,M,r));if(y(M,1)){if(!i(M))throw new Error("N must be a positive integer");if(y(M,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 Y=B(M,1);S=[];for(var h=0;o(h,M);h++){var n=Q(h+1,Y);S.push(K(c,n,r))}return Ag(M)?S:I(S)}}function F(U,M,r){for(var S=U.valueOf(),c=M.valueOf(),Y=[],h=0;h<c.length;++h)Y.push(K(S,c[h],r));return Y}function K(U,M,r){var S=sg(U),c=S.length;if(c===0)throw new Error("Cannot calculate quantile of an empty sequence");var Y=Ag(M)?M*(c-1):M.times(c-1),h=Ag(M)?Math.floor(Y):Y.floor().toNumber(),n=Ag(M)?Y%1:Y.minus(h);if(i(Y))return r?S[Y]:w(S,Ag(M)?Y:Y.valueOf());var J,H;if(r)J=S[h],H=S[h+1];else{H=w(S,h+1),J=S[h];for(var b=0;b<h;++b)D(S[b],J)>0&&(J=S[b])}return B(E(J,C(1,n)),E(H,n))}}),zM="std",o8=["typed","map","sqrt","variance"],PM=T(zM,o8,A=>{var{typed:g,map:I,sqrt:B,variance:C}=A;return g(zM,{"Array | Matrix":Q,"Array | Matrix, string":Q,"Array | Matrix, number | BigNumber":Q,"Array | Matrix, number | BigNumber, string":Q,"...":function(w){return Q(w)}});function Q(E,w){if(E.length===0)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var D=C.apply(null,arguments);return kI(D)?I(D,B):B(D)}catch(i){throw i instanceof TypeError&&i.message.includes(" variance")?new TypeError(i.message.replace(" variance"," std")):i}}}),_M="corr",D8=["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],w8=T(_M,D8,A=>{var{typed:g,matrix:I,sqrt:B,sum:C,add:Q,subtract:E,multiply:w,pow:D,divide:i}=A;return g(_M,{"Array, Array":function(a,N){return o(a,N)},"Matrix, Matrix":function(a,N){var e=o(a.toArray(),N.toArray());return Array.isArray(e)?I(e):e}});function o(y,a){var N=[];if(Array.isArray(y[0])&&Array.isArray(a[0])){if(y.length!==a.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var e=0;e<y.length;e++){if(y[e].length!==a[e].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");N.push(s(y[e],a[e]))}return N}else{if(y.length!==a.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return s(y,a)}}function s(y,a){var N=y.length,e=C(y),F=C(a),K=y.reduce((c,Y,h)=>Q(c,w(Y,a[h])),0),U=C(y.map(c=>D(c,2))),M=C(a.map(c=>D(c,2))),r=E(w(N,K),w(e,F)),S=B(w(E(w(N,U),D(e,2)),E(w(N,M),D(F,2))));return i(r,S)}}),$M="combinations",s8=["typed"],y8=T($M,s8,A=>{var{typed:g}=A;return g($M,{"number, number":nN,"BigNumber, BigNumber":function(B,C){var Q=B.constructor,E,w,D=B.minus(C),i=new Q(1);if(!AK(B)||!AK(C))throw new TypeError("Positive integer value expected in function combinations");if(C.gt(B))throw new TypeError("k must be less than n in function combinations");if(E=i,C.lt(D))for(w=i;w.lte(D);w=w.plus(i))E=E.times(C.plus(w)).dividedBy(w);else for(w=i;w.lte(C);w=w.plus(i))E=E.times(D.plus(w)).dividedBy(w);return E}})});function AK(A){return A.isInteger()&&A.gte(0)}var gK="combinationsWithRep",a8=["typed"],G8=T(gK,a8,A=>{var{typed:g}=A;return g(gK,{"number, number":function(B,C){if(!WA(B)||B<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!WA(C)||C<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(B<1)throw new TypeError("k must be less than or equal to n + k - 1");if(C<B-1){var Q=fB(B,B+C-1);return Q/fB(1,C)}var E=fB(C+1,B+C-1);return E/fB(1,B-1)},"BigNumber, BigNumber":function(B,C){var Q=B.constructor,E,w,D=new Q(1),i=B.minus(D);if(!IK(B)||!IK(C))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(B.lt(D))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(E=D,C.lt(i))for(w=D;w.lte(i);w=w.plus(D))E=E.times(C.plus(w)).dividedBy(w);else for(w=D;w.lte(C);w=w.plus(D))E=E.times(i.plus(w)).dividedBy(w);return E}})});function IK(A){return A.isInteger()&&A.gte(0)}var BK="gamma",N8=["typed","config","multiplyScalar","pow","BigNumber","Complex"],R8=T(BK,N8,A=>{var{typed:g,config:I,multiplyScalar:B,pow:C,BigNumber:Q,Complex:E}=A;function w(i){if(i.im===0)return _i(i.re);if(i.re<.5){var o=new E(1-i.re,-i.im),s=new E(Math.PI*i.re,Math.PI*i.im);return new E(Math.PI).div(s.sin()).div(w(o))}i=new E(i.re-1,i.im);for(var y=new E(SQ[0],0),a=1;a<SQ.length;++a){var N=new E(SQ[a],0);y=y.add(N.div(i.add(a)))}var e=new E(i.re+YN+.5,i.im),F=Math.sqrt(2*Math.PI),K=e.pow(i.add(.5)),U=e.neg().exp();return y.mul(F).mul(K).mul(U)}return g(BK,{number:_i,Complex:w,BigNumber:function(o){if(o.isInteger())return o.isNegative()||o.isZero()?new Q(1/0):D(o.minus(1));if(!o.isFinite())return new Q(o.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function D(i){if(i<8)return new Q([1,1,2,6,24,120,720,5040][i]);var o=I.precision+(Math.log(i.toNumber())|0),s=Q.clone({precision:o});if(i%2===1)return i.times(D(new Q(i-1)));for(var y=i,a=new s(i),N=i.toNumber();y>2;)y-=2,N+=y,a=a.times(N);return new Q(a.toPrecision(Q.precision))}}),CK="lgamma",e8=["Complex","typed"],t8=T(CK,e8,A=>{var{Complex:g,typed:I}=A,B=7,C=7,Q=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return I(CK,{number:$i,Complex:E,BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function E(i){var o=6.283185307179586,s=1.1447298858494002,y=.1;if(i.isNaN())return new g(NaN,NaN);if(i.im===0)return new g($i(i.re),0);if(i.re>=B||Math.abs(i.im)>=C)return w(i);if(i.re<=y){var a=Cl(o,i.im)*Math.floor(.5*i.re+.25),N=i.mul(Math.PI).sin().log(),e=E(new g(1-i.re,-i.im));return new g(s,a).sub(N).sub(e)}else return i.im>=0?D(i):D(i.conjugate()).conjugate()}function w(i){for(var o=i.sub(.5).mul(i.log()).sub(i).add(JN),s=new g(1,0).div(i),y=s.div(i),a=Q[0],N=Q[1],e=2*y.re,F=y.re*y.re+y.im*y.im,K=2;K<8;K++){var U=N;N=-F*a+Q[K],a=e*a+U}var M=s.mul(y.mul(a).add(N));return o.add(M)}function D(i){var o=0,s=0,y=i;for(i=i.add(1);i.re<=B;){y=y.mul(i);var a=y.im<0?1:0;a!==0&&s===0&&o++,s=a,i=i.add(1)}return w(i).sub(y.log()).sub(new g(0,o*2*Math.PI*1))}}),QK="factorial",M8=["typed","gamma"],K8=T(QK,M8,A=>{var{typed:g,gamma:I}=A;return g(QK,{number:function(C){if(C<0)throw new Error("Value must be non-negative");return I(C+1)},BigNumber:function(C){if(C.isNegative())throw new Error("Value must be non-negative");return I(C.plus(1))},"Array | Matrix":g.referToSelf(B=>C=>Bg(C,B))})}),EK="kldivergence",F8=["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],c8=T(EK,F8,A=>{var{typed:g,matrix:I,divide:B,sum:C,multiply:Q,map:E,dotDivide:w,log:D,isNumeric:i}=A;return g(EK,{"Array, Array":function(y,a){return o(I(y),I(a))},"Matrix, Array":function(y,a){return o(y,I(a))},"Array, Matrix":function(y,a){return o(I(y),a)},"Matrix, Matrix":function(y,a){return o(y,a)}});function o(s,y){var a=y.size().length,N=s.size().length;if(a>1)throw new Error("first object must be one dimensional");if(N>1)throw new Error("second object must be one dimensional");if(a!==N)throw new Error("Length of two vectors must be equal");var e=C(s);if(e===0)throw new Error("Sum of elements in first object must be non zero");var F=C(y);if(F===0)throw new Error("Sum of elements in second object must be non zero");var K=B(s,C(s)),U=B(y,C(y)),M=C(Q(K,E(w(K,U),r=>D(r))));return i(M)?M:Number.NaN}}),iK="multinomial",r8=["typed","add","divide","multiply","factorial","isInteger","isPositive"],S8=T(iK,r8,A=>{var{typed:g,add:I,divide:B,multiply:C,factorial:Q,isInteger:E,isPositive:w}=A;return g(iK,{"Array | Matrix":function(i){var o=0,s=1;return pB(i,function(y){if(!E(y)||!w(y))throw new TypeError("Positive integer value expected in function multinomial");o=I(o,y),s=C(s,Q(y))}),B(Q(o),s)}})}),oK="permutations",L8=["typed","factorial"],U8=T(oK,L8,A=>{var{typed:g,factorial:I}=A;return g(oK,{"number | BigNumber":I,"number, number":function(C,Q){if(!WA(C)||C<0)throw new TypeError("Positive integer value expected in function permutations");if(!WA(Q)||Q<0)throw new TypeError("Positive integer value expected in function permutations");if(Q>C)throw new TypeError("second argument k must be less than or equal to first argument n");return fB(C-Q+1,C)},"BigNumber, BigNumber":function(C,Q){var E,w;if(!DK(C)||!DK(Q))throw new TypeError("Positive integer value expected in function permutations");if(Q.gt(C))throw new TypeError("second argument k must be less than or equal to first argument n");var D=C.mul(0).add(1);for(E=D,w=C.minus(Q).plus(1);w.lte(C);w=w.plus(1))E=E.times(w);return E}})});function DK(A){return A.isInteger()&&A.gte(0)}var vw={exports:{}};vw.exports,function(A){(function(g,I,B){function C(D){var i=this,o=w();i.next=function(){var s=2091639*i.s0+i.c*23283064365386963e-26;return i.s0=i.s1,i.s1=i.s2,i.s2=s-(i.c=s|0)},i.c=1,i.s0=o(" "),i.s1=o(" "),i.s2=o(" "),i.s0-=o(D),i.s0<0&&(i.s0+=1),i.s1-=o(D),i.s1<0&&(i.s1+=1),i.s2-=o(D),i.s2<0&&(i.s2+=1),o=null}function Q(D,i){return i.c=D.c,i.s0=D.s0,i.s1=D.s1,i.s2=D.s2,i}function E(D,i){var o=new C(D),s=i&&i.state,y=o.next;return y.int32=function(){return o.next()*4294967296|0},y.double=function(){return y()+(y()*2097152|0)*11102230246251565e-32},y.quick=y,s&&(typeof s=="object"&&Q(s,o),y.state=function(){return Q(o,{})}),y}function w(){var D=4022871197,i=function(o){o=String(o);for(var s=0;s<o.length;s++){D+=o.charCodeAt(s);var y=.02519603282416938*D;D=y>>>0,y-=D,y*=D,D=y>>>0,y-=D,D+=y*4294967296}return(D>>>0)*23283064365386963e-26};return i}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.alea=E})($I,A,!1)}(vw);var n8=vw.exports,Vw={exports:{}};Vw.exports,function(A){(function(g,I,B){function C(w){var D=this,i="";D.x=0,D.y=0,D.z=0,D.w=0,D.next=function(){var s=D.x^D.x<<11;return D.x=D.y,D.y=D.z,D.z=D.w,D.w^=D.w>>>19^s^s>>>8},w===(w|0)?D.x=w:i+=w;for(var o=0;o<i.length+64;o++)D.x^=i.charCodeAt(o)|0,D.next()}function Q(w,D){return D.x=w.x,D.y=w.y,D.z=w.z,D.w=w.w,D}function E(w,D){var i=new C(w),o=D&&D.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do var y=i.next()>>>11,a=(i.next()>>>0)/4294967296,N=(y+a)/(1<<21);while(N===0);return N},s.int32=i.next,s.quick=s,o&&(typeof o=="object"&&Q(o,i),s.state=function(){return Q(i,{})}),s}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.xor128=E})($I,A,!1)}(Vw);var h8=Vw.exports,qw={exports:{}};qw.exports,function(A){(function(g,I,B){function C(w){var D=this,i="";D.next=function(){var s=D.x^D.x>>>2;return D.x=D.y,D.y=D.z,D.z=D.w,D.w=D.v,(D.d=D.d+362437|0)+(D.v=D.v^D.v<<4^(s^s<<1))|0},D.x=0,D.y=0,D.z=0,D.w=0,D.v=0,w===(w|0)?D.x=w:i+=w;for(var o=0;o<i.length+64;o++)D.x^=i.charCodeAt(o)|0,o==i.length&&(D.d=D.x<<10^D.x>>>4),D.next()}function Q(w,D){return D.x=w.x,D.y=w.y,D.z=w.z,D.w=w.w,D.v=w.v,D.d=w.d,D}function E(w,D){var i=new C(w),o=D&&D.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do var y=i.next()>>>11,a=(i.next()>>>0)/4294967296,N=(y+a)/(1<<21);while(N===0);return N},s.int32=i.next,s.quick=s,o&&(typeof o=="object"&&Q(o,i),s.state=function(){return Q(i,{})}),s}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.xorwow=E})($I,A,!1)}(qw);var Y8=qw.exports,Ow={exports:{}};Ow.exports,function(A){(function(g,I,B){function C(w){var D=this;D.next=function(){var o=D.x,s=D.i,y,a;return y=o[s],y^=y>>>7,a=y^y<<24,y=o[s+1&7],a^=y^y>>>10,y=o[s+3&7],a^=y^y>>>3,y=o[s+4&7],a^=y^y<<7,y=o[s+7&7],y=y^y<<13,a^=y^y<<9,o[s]=a,D.i=s+1&7,a};function i(o,s){var y,a=[];if(s===(s|0))a[0]=s;else for(s=""+s,y=0;y<s.length;++y)a[y&7]=a[y&7]<<15^s.charCodeAt(y)+a[y+1&7]<<13;for(;a.length<8;)a.push(0);for(y=0;y<8&&a[y]===0;++y);for(y==8?a[7]=-1:a[y],o.x=a,o.i=0,y=256;y>0;--y)o.next()}i(D,w)}function Q(w,D){return D.x=w.x.slice(),D.i=w.i,D}function E(w,D){w==null&&(w=+new Date);var i=new C(w),o=D&&D.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do var y=i.next()>>>11,a=(i.next()>>>0)/4294967296,N=(y+a)/(1<<21);while(N===0);return N},s.int32=i.next,s.quick=s,o&&(o.x&&Q(o,i),s.state=function(){return Q(i,{})}),s}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.xorshift7=E})($I,A,!1)}(Ow);var J8=Ow.exports,Tw={exports:{}};Tw.exports,function(A){(function(g,I,B){function C(w){var D=this;D.next=function(){var o=D.w,s=D.X,y=D.i,a,N;return D.w=o=o+1640531527|0,N=s[y+34&127],a=s[y=y+1&127],N^=N<<13,a^=a<<17,N^=N>>>15,a^=a>>>12,N=s[y]=N^a,D.i=y,N+(o^o>>>16)|0};function i(o,s){var y,a,N,e,F,K=[],U=128;for(s===(s|0)?(a=s,s=null):(s=s+"\0",a=0,U=Math.max(U,s.length)),N=0,e=-32;e<U;++e)s&&(a^=s.charCodeAt((e+32)%s.length)),e===0&&(F=a),a^=a<<10,a^=a>>>15,a^=a<<4,a^=a>>>13,e>=0&&(F=F+1640531527|0,y=K[e&127]^=a+F,N=y==0?N+1:0);for(N>=128&&(K[(s&&s.length||0)&127]=-1),N=127,e=4*128;e>0;--e)a=K[N+34&127],y=K[N=N+1&127],a^=a<<13,y^=y<<17,a^=a>>>15,y^=y>>>12,K[N]=a^y;o.w=F,o.X=K,o.i=N}i(D,w)}function Q(w,D){return D.i=w.i,D.w=w.w,D.X=w.X.slice(),D}function E(w,D){w==null&&(w=+new Date);var i=new C(w),o=D&&D.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do var y=i.next()>>>11,a=(i.next()>>>0)/4294967296,N=(y+a)/(1<<21);while(N===0);return N},s.int32=i.next,s.quick=s,o&&(o.X&&Q(o,i),s.state=function(){return Q(i,{})}),s}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.xor4096=E})($I,A,!1)}(Tw);var k8=Tw.exports,jw={exports:{}};jw.exports,function(A){(function(g,I,B){function C(w){var D=this,i="";D.next=function(){var s=D.b,y=D.c,a=D.d,N=D.a;return s=s<<25^s>>>7^y,y=y-a|0,a=a<<24^a>>>8^N,N=N-s|0,D.b=s=s<<20^s>>>12^y,D.c=y=y-a|0,D.d=a<<16^y>>>16^N,D.a=N-s|0},D.a=0,D.b=0,D.c=-1640531527,D.d=1367130551,w===Math.floor(w)?(D.a=w/4294967296|0,D.b=w|0):i+=w;for(var o=0;o<i.length+20;o++)D.b^=i.charCodeAt(o)|0,D.next()}function Q(w,D){return D.a=w.a,D.b=w.b,D.c=w.c,D.d=w.d,D}function E(w,D){var i=new C(w),o=D&&D.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do var y=i.next()>>>11,a=(i.next()>>>0)/4294967296,N=(y+a)/(1<<21);while(N===0);return N},s.int32=i.next,s.quick=s,o&&(typeof o=="object"&&Q(o,i),s.state=function(){return Q(i,{})}),s}I&&I.exports?I.exports=E:B&&B.amd?B(function(){return E}):this.tychei=E})($I,A,!1)}(jw);var l8=jw.exports,wK={exports:{}};const sK=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})),yK=MJ(sK);(function(A){(function(g,I,B){var C=256,Q=6,E=52,w="random",D=B.pow(C,Q),i=B.pow(2,E),o=i*2,s=C-1,y;function a(r,S,c){var Y=[];S=S==!0?{entropy:!0}:S||{};var h=K(F(S.entropy?[r,M(I)]:r??U(),3),Y),n=new N(Y),J=function(){for(var H=n.g(Q),b=D,x=0;H<i;)H=(H+x)*C,b*=C,x=n.g(1);for(;H>=o;)H/=2,b/=2,x>>>=1;return(H+x)/b};return J.int32=function(){return n.g(4)|0},J.quick=function(){return n.g(4)/4294967296},J.double=J,K(M(n.S),I),(S.pass||c||function(H,b,x,f){return f&&(f.S&&e(f,n),H.state=function(){return e(n,{})}),x?(B[w]=H,b):H})(J,h,"global"in S?S.global:this==B,S.state)}function N(r){var S,c=r.length,Y=this,h=0,n=Y.i=Y.j=0,J=Y.S=[];for(c||(r=[c++]);h<C;)J[h]=h++;for(h=0;h<C;h++)J[h]=J[n=s&n+r[h%c]+(S=J[h])],J[n]=S;(Y.g=function(H){for(var b,x=0,f=Y.i,m=Y.j,d=Y.S;H--;)b=d[f=s&f+1],x=x*C+d[s&(d[f]=d[m=s&m+b])+(d[m]=b)];return Y.i=f,Y.j=m,x})(C)}function e(r,S){return S.i=r.i,S.j=r.j,S.S=r.S.slice(),S}function F(r,S){var c=[],Y=typeof r,h;if(S&&Y=="object")for(h in r)try{c.push(F(r[h],S-1))}catch{}return c.length?c:Y=="string"?r:r+"\0"}function K(r,S){for(var c=r+"",Y,h=0;h<c.length;)S[s&h]=s&(Y^=S[s&h]*19)+c.charCodeAt(h++);return M(S)}function U(){try{var r;return y&&(r=y.randomBytes)?r=r(C):(r=new Uint8Array(C),(g.crypto||g.msCrypto).getRandomValues(r)),M(r)}catch{var S=g.navigator,c=S&&S.plugins;return[+new Date,g,c,g.screen,M(I)]}}function M(r){return String.fromCharCode.apply(0,r)}if(K(B.random(),I),A.exports){A.exports=a;try{y=yK}catch{}}else B["seed"+w]=a})(typeof self<"u"?self:$I,[],Math)})(wK);var H8=wK.exports,d8=n8,b8=h8,u8=Y8,m8=J8,Z8=k8,p8=l8,dC=H8;dC.alea=d8,dC.xor128=b8,dC.xorwow=u8,dC.xorshift7=m8,dC.xor4096=Z8,dC.tychei=p8;var f8=dC;const aK=sE(f8);var W8=aK(Date.now());function kQ(A){var g;function I(C){g=C===null?W8:aK(String(C))}I(A);function B(){return g()}return B}var GK="pickRandom",x8=["typed","config","?on"],v8=T(GK,x8,A=>{var{typed:g,config:I,on:B}=A,C=kQ(I.randomSeed);return B&&B("config",function(E,w){E.randomSeed!==w.randomSeed&&(C=kQ(E.randomSeed))}),g(GK,{"Array | Matrix":function(w){return Q(w,{})},"Array | Matrix, Object":function(w,D){return Q(w,D)},"Array | Matrix, number":function(w,D){return Q(w,{number:D})},"Array | Matrix, Array | Matrix":function(w,D){return Q(w,{weights:D})},"Array | Matrix, Array | Matrix, number":function(w,D,i){return Q(w,{number:i,weights:D})},"Array | Matrix, number, Array | Matrix":function(w,D,i){return Q(w,{number:D,weights:i})}});function Q(E,w){var{number:D,weights:i,elementWise:o=!0}=w,s=typeof D>"u";s&&(D=1);var y=qA(E)?E.create:qA(i)?i.create:null;E=E.valueOf(),i&&(i=i.valueOf()),o===!0&&(E=sg(E),i=sg(i));var a=0;if(typeof i<"u"){if(i.length!==E.length)throw new Error("Weights must have the same length as possibles");for(var N=0,e=i.length;N<e;N++){if(!Ag(i[N])||i[N]<0)throw new Error("Weights must be an array of positive numbers");a+=i[N]}}for(var F=E.length,K=[],U;K.length<D;){if(typeof i>"u")U=E[Math.floor(C()*F)];else for(var M=C()*a,r=0,S=E.length;r<S;r++)if(M-=i[r],M<0){U=E[r];break}K.push(U)}return s?K[0]:y?y(K):K}});function Xw(A,g){var I=[];if(A=A.slice(0),A.length>1)for(var B=0,C=A.shift();B<C;B++)I.push(Xw(A,g));else for(var Q=0,E=A.shift();Q<E;Q++)I.push(g());return I}var NK="random",V8=["typed","config","?on"],q8=T(NK,V8,A=>{var{typed:g,config:I,on:B}=A,C=kQ(I.randomSeed);return B&&B("config",function(w,D){w.randomSeed!==D.randomSeed&&(C=kQ(w.randomSeed))}),g(NK,{"":()=>E(0,1),number:w=>E(0,w),"number, number":(w,D)=>E(w,D),"Array | Matrix":w=>Q(w,0,1),"Array | Matrix, number":(w,D)=>Q(w,0,D),"Array | Matrix, number, number":(w,D,i)=>Q(w,D,i)});function Q(w,D,i){var o=Xw(w.valueOf(),()=>E(D,i));return qA(w)?w.create(o):o}function E(w,D){return w+C()*(D-w)}}),RK="randomInt",O8=["typed","config","?on"],T8=T(RK,O8,A=>{var{typed:g,config:I,on:B}=A,C=kQ(I.randomSeed);return B&&B("config",function(w,D){w.randomSeed!==D.randomSeed&&(C=kQ(w.randomSeed))}),g(RK,{"":()=>E(0,1),number:w=>E(0,w),"number, number":(w,D)=>E(w,D),"Array | Matrix":w=>Q(w,0,1),"Array | Matrix, number":(w,D)=>Q(w,0,D),"Array | Matrix, number, number":(w,D,i)=>Q(w,D,i)});function Q(w,D,i){var o=Xw(w.valueOf(),()=>E(D,i));return qA(w)?w.create(o):o}function E(w,D){return Math.floor(w+C()*(D-w))}}),eK="stirlingS2",j8=["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],X8=T(eK,j8,A=>{var{typed:g,addScalar:I,subtractScalar:B,multiplyScalar:C,divideScalar:Q,pow:E,factorial:w,combinations:D,isNegative:i,isInteger:o,number:s,bignumber:y,larger:a}=A,N=[],e=[];return g(eK,{"number | BigNumber, number | BigNumber":function(K,U){if(!o(K)||i(K)||!o(U)||i(U))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(a(U,K))throw new TypeError("k must be less than or equal to n in function stirlingS2");var M=!(Ag(K)&&Ag(U)),r=M?e:N,S=M?y:s,c=s(K),Y=s(U);if(r[c]&&r[c].length>Y)return r[c][Y];for(var h=0;h<=c;++h)if(r[h]||(r[h]=[S(h===0?1:0)]),h!==0)for(var n=r[h],J=r[h-1],H=n.length;H<=h&&H<=Y;++H)H===h?n[H]=1:n[H]=I(C(S(H),J[H]),J[H-1]);return r[c][Y]}})}),tK="bellNumbers",z8=["typed","addScalar","isNegative","isInteger","stirlingS2"],P8=T(tK,z8,A=>{var{typed:g,addScalar:I,isNegative:B,isInteger:C,stirlingS2:Q}=A;return g(tK,{"number | BigNumber":function(w){if(!C(w)||B(w))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var D=0,i=0;i<=w;i++)D=I(D,Q(w,i));return D}})}),MK="catalan",_8=["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],$8=T(MK,_8,A=>{var{typed:g,addScalar:I,divideScalar:B,multiplyScalar:C,combinations:Q,isNegative:E,isInteger:w}=A;return g(MK,{"number | BigNumber":function(i){if(!w(i)||E(i))throw new TypeError("Non-negative integer value expected in function catalan");return B(Q(C(i,2),i),I(i,1))}})}),KK="composition",A4=["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],g4=T(KK,A4,A=>{var{typed:g,addScalar:I,combinations:B,isPositive:C,isNegative:Q,isInteger:E,larger:w}=A;return g(KK,{"number | BigNumber, number | BigNumber":function(i,o){if(!E(i)||!C(i)||!E(o)||!C(o))throw new TypeError("Positive integer value expected in function composition");if(w(o,i))throw new TypeError("k must be less than or equal to n in function composition");return B(I(i,-1),I(o,-1))}})}),FK="leafCount",I4=["parse","typed"],B4=T(FK,I4,A=>{var{parse:g,typed:I}=A;function B(C){var Q=0;return C.forEach(E=>{Q+=B(E)}),Q||1}return I(FK,{Node:function(Q){return B(Q)}})});function cK(A){return og(A)||Zg(A)&&A.isUnary()&&og(A.args[0])}function Yo(A){return!!(og(A)||(dB(A)||Zg(A))&&A.args.every(Yo)||NB(A)&&Yo(A.content))}function rK(A,g){var I=Object.keys(A);if(Object.getOwnPropertySymbols){var B=Object.getOwnPropertySymbols(A);g&&(B=B.filter(function(C){return Object.getOwnPropertyDescriptor(A,C).enumerable})),I.push.apply(I,B)}return I}function zw(A){for(var g=1;g<arguments.length;g++){var I=arguments[g]!=null?arguments[g]:{};g%2?rK(Object(I),!0).forEach(function(B){jg(A,B,I[B])}):Object.getOwnPropertyDescriptors?Object.defineProperties(A,Object.getOwnPropertyDescriptors(I)):rK(Object(I)).forEach(function(B){Object.defineProperty(A,B,Object.getOwnPropertyDescriptor(I,B))})}return A}var C4="simplifyUtil",Q4=["FunctionNode","OperatorNode","SymbolNode"],Pw=T(C4,Q4,A=>{var{FunctionNode:g,OperatorNode:I,SymbolNode:B}=A,C=!0,Q=!1,E="defaultF",w={add:{trivial:C,total:C,commutative:C,associative:C},unaryPlus:{trivial:C,total:C,commutative:C,associative:C},subtract:{trivial:Q,total:C,commutative:Q,associative:Q},multiply:{trivial:C,total:C,commutative:C,associative:C},divide:{trivial:Q,total:C,commutative:Q,associative:Q},paren:{trivial:C,total:C,commutative:C,associative:Q},defaultF:{trivial:Q,total:C,commutative:Q,associative:Q}},D={divide:{total:Q},log:{total:Q}},i={subtract:{total:Q},abs:{trivial:C},log:{total:C}};function o(M,r){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:w,c=E;if(typeof M=="string"?c=M:Zg(M)?c=M.fn.toString():dB(M)?c=M.name:NB(M)&&(c="paren"),mA(S,c)){var Y=S[c];if(mA(Y,r))return Y[r];if(mA(w,c))return w[c][r]}if(mA(S,E)){var h=S[E];return mA(h,r)?h[r]:w[E][r]}if(mA(w,c)){var n=w[c];if(mA(n,r))return n[r]}return w[E][r]}function s(M){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:w;return o(M,"commutative",r)}function y(M){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:w;return o(M,"associative",r)}function a(M,r){var S=zw({},M);for(var c in r)mA(M,c)?S[c]=zw(zw({},r[c]),M[c]):S[c]=r[c];return S}function N(M,r){if(!M.args||M.args.length===0)return M;M.args=e(M,r);for(var S=0;S<M.args.length;S++)N(M.args[S],r)}function e(M,r){var S,c=[],Y=function h(n){for(var J=0;J<n.args.length;J++){var H=n.args[J];Zg(H)&&S===H.op?h(H):c.push(H)}};return y(M,r)?(S=M.op,Y(M),c):M.args}function F(M,r){if(!(!M.args||M.args.length===0)){for(var S=U(M),c=M.args.length,Y=0;Y<c;Y++)F(M.args[Y],r);if(c>2&&y(M,r)){for(var h=M.args.pop();M.args.length>0;)h=S([M.args.pop(),h]);M.args=h.args}}}function K(M,r){if(!(!M.args||M.args.length===0)){for(var S=U(M),c=M.args.length,Y=0;Y<c;Y++)K(M.args[Y],r);if(c>2&&y(M,r)){for(var h=M.args.shift();M.args.length>0;)h=S([h,M.args.shift()]);M.args=h.args}}}function U(M){return Zg(M)?function(r){try{return new I(M.op,M.fn,r,M.implicit)}catch(S){return console.error(S),[]}}:function(r){return new g(new B(M.name),r)}}return{createMakeNodeFunction:U,hasProperty:o,isCommutative:s,isAssociative:y,mergeContext:a,flatten:N,allChildren:e,unflattenr:F,unflattenl:K,defaultContext:w,realContext:D,positiveContext:i}}),E4="simplify",i4=["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],o4=T(E4,i4,A=>{var{config:g,typed:I,parse:B,add:C,subtract:Q,multiply:E,divide:w,pow:D,isZero:i,equal:o,resolve:s,simplifyConstant:y,simplifyCore:a,fraction:N,bignumber:e,mathWithTransform:F,matrix:K,AccessorNode:U,ArrayNode:M,ConstantNode:r,FunctionNode:S,IndexNode:c,ObjectNode:Y,OperatorNode:h,ParenthesisNode:n,SymbolNode:J}=A,{hasProperty:H,isCommutative:b,isAssociative:x,mergeContext:f,flatten:m,unflattenr:d,unflattenl:l,createMakeNodeFunction:q,defaultContext:Z,realContext:_,positiveContext:BA}=Pw({FunctionNode:S,OperatorNode:h,SymbolNode:J});I.addConversion({from:"Object",to:"Map",convert:aQ});var z=I("simplify",{Node:yA,"Node, Map":(gA,EA)=>yA(gA,!1,EA),"Node, Map, Object":(gA,EA,wA)=>yA(gA,!1,EA,wA),"Node, Array":yA,"Node, Array, Map":yA,"Node, Array, Map, Object":yA});I.removeConversion({from:"Object",to:"Map",convert:aQ}),z.defaultContext=Z,z.realContext=_,z.positiveContext=BA;function v(gA){return gA.transform(function(EA,wA,cA){return NB(EA)?v(EA.content):EA})}var iA={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};z.rules=[a,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},y,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{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)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},y,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];function eA(gA,EA){var wA={};if(gA.s){var cA=gA.s.split("->");if(cA.length===2)wA.l=cA[0],wA.r=cA[1];else throw SyntaxError("Could not parse rule: "+gA.s)}else wA.l=gA.l,wA.r=gA.r;wA.l=v(B(wA.l)),wA.r=v(B(wA.r));for(var rA of["imposeContext","repeat","assuming"])rA in gA&&(wA[rA]=gA[rA]);if(gA.evaluate&&(wA.evaluate=B(gA.evaluate)),x(wA.l,EA)){var O=!b(wA.l,EA),$;O&&($=GA());var j=q(wA.l),oA=GA();wA.expanded={},wA.expanded.l=j([wA.l,oA]),m(wA.expanded.l,EA),d(wA.expanded.l,EA),wA.expanded.r=j([wA.r,oA]),O&&(wA.expandedNC1={},wA.expandedNC1.l=j([$,wA.l]),wA.expandedNC1.r=j([$,wA.r]),wA.expandedNC2={},wA.expandedNC2.l=j([$,wA.expanded.l]),wA.expandedNC2.r=j([$,wA.expanded.r]))}return wA}function CA(gA,EA){for(var wA=[],cA=0;cA<gA.length;cA++){var rA=gA[cA],O=void 0,$=typeof rA;switch($){case"string":rA={s:rA};case"object":O=eA(rA,EA);break;case"function":O=rA;break;default:throw TypeError("Unsupported type of rule: "+$)}wA.push(O)}return wA}var sA=0;function GA(){return new J("_p"+sA++)}function yA(gA,EA){var wA=arguments.length>2&&arguments[2]!==void 0?arguments[2]:tE(),cA=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},rA=cA.consoleDebug;EA=CA(EA||z.rules,cA.context);var O=s(gA,wA);O=v(O);for(var $={},j=O.toString({parenthesis:"all"});!$[j];){$[j]=!0,sA=0;var oA=j;rA&&console.log("Working on: ",j);for(var tA=0;tA<EA.length;tA++){var FA="";if(typeof EA[tA]=="function"?(O=EA[tA](O,cA),rA&&(FA=EA[tA].name)):(m(O,cA.context),O=NA(O,EA[tA],cA.context),rA&&(FA="".concat(EA[tA].l.toString()," -> ").concat(EA[tA].r.toString()))),rA){var JA=O.toString({parenthesis:"all"});JA!==oA&&(console.log("Applying",FA,"produced",JA),oA=JA)}l(O,cA.context)}j=O.toString({parenthesis:"all"})}return O}function aA(gA,EA,wA){var cA=gA;if(gA)for(var rA=0;rA<gA.length;++rA){var O=NA(gA[rA],EA,wA);O!==gA[rA]&&(cA===gA&&(cA=gA.slice()),cA[rA]=O)}return cA}function NA(gA,EA,wA){if(EA.assuming){for(var cA in EA.assuming)for(var rA in EA.assuming[cA])if(H(cA,rA,wA)!==EA.assuming[cA][rA])return gA}var O=f(EA.imposeContext,wA),$=gA;if($ instanceof h||$ instanceof S){var j=aA($.args,EA,wA);j!==$.args&&($=$.clone(),$.args=j)}else if($ instanceof n){if($.content){var oA=NA($.content,EA,wA);oA!==$.content&&($=new n(oA))}}else if($ instanceof M){var tA=aA($.items,EA,wA);tA!==$.items&&($=new M(tA))}else if($ instanceof U){var FA=$.object;$.object&&(FA=NA($.object,EA,wA));var JA=$.index;$.index&&(JA=NA($.index,EA,wA)),(FA!==$.object||JA!==$.index)&&($=new U(FA,JA))}else if($ instanceof c){var kA=aA($.dimensions,EA,wA);kA!==$.dimensions&&($=new c(kA))}else if($ instanceof Y){var dA=!1,YA={};for(var Cg in $.properties)YA[Cg]=NA($.properties[Cg],EA,wA),YA[Cg]!==$.properties[Cg]&&(dA=!0);dA&&($=new Y(YA))}var Eg=EA.r,fA=IA(EA.l,$,O)[0];if(!fA&&EA.expanded&&(Eg=EA.expanded.r,fA=IA(EA.expanded.l,$,O)[0]),!fA&&EA.expandedNC1&&(Eg=EA.expandedNC1.r,fA=IA(EA.expandedNC1.l,$,O)[0],fA||(Eg=EA.expandedNC2.r,fA=IA(EA.expandedNC2.l,$,O)[0])),fA){var Sg=$.implicit;$=Eg.clone(),Sg&&"implicit"in Eg&&($.implicit=!0),$=$.transform(function(u){return u.isSymbolNode&&mA(fA.placeholders,u.name)?fA.placeholders[u.name].clone():u})}return EA.repeat&&$!==gA&&($=NA($,EA,wA)),$}function KA(gA,EA){var wA=[],cA,rA,O=q(gA);if(b(gA,EA))for(var $=0;$<gA.args.length;$++)rA=gA.args.slice(0),rA.splice($,1),cA=rA.length===1?rA[0]:O(rA),wA.push(O([gA.args[$],cA]));else for(var j=1;j<gA.args.length;j++){var oA=gA.args[0];j>1&&(oA=O(gA.args.slice(0,j))),rA=gA.args.slice(j),cA=rA.length===1?rA[0]:O(rA),wA.push(O([oA,cA]))}return wA}function UA(gA,EA){var wA={placeholders:{}};if(!gA.placeholders&&!EA.placeholders)return wA;if(gA.placeholders){if(!EA.placeholders)return gA}else return EA;for(var cA in gA.placeholders)if(mA(gA.placeholders,cA)&&(wA.placeholders[cA]=gA.placeholders[cA],mA(EA.placeholders,cA)&&!RA(gA.placeholders[cA],EA.placeholders[cA])))return null;for(var rA in EA.placeholders)mA(EA.placeholders,rA)&&(wA.placeholders[rA]=EA.placeholders[rA]);return wA}function HA(gA,EA){var wA=[];if(gA.length===0||EA.length===0)return wA;for(var cA,rA=0;rA<gA.length;rA++)for(var O=0;O<EA.length;O++)cA=UA(gA[rA],EA[O]),cA&&wA.push(cA);return wA}function P(gA){if(gA.length===0)return gA;for(var EA=gA.reduce(HA),wA=[],cA={},rA=0;rA<EA.length;rA++){var O=JSON.stringify(EA[rA]);cA[O]||(cA[O]=!0,wA.push(EA[rA]))}return wA}function IA(gA,EA,wA,cA){var rA=[{placeholders:{}}];if(gA instanceof h&&EA instanceof h||gA instanceof S&&EA instanceof S){if(gA instanceof h){if(gA.op!==EA.op||gA.fn!==EA.fn)return[]}else if(gA instanceof S&&gA.name!==EA.name)return[];if(EA.args.length===1&&gA.args.length===1||!x(EA,wA)&&EA.args.length===gA.args.length||cA){for(var O=[],$=0;$<gA.args.length;$++){var j=IA(gA.args[$],EA.args[$],wA);if(j.length===0)break;O.push(j)}if(O.length!==gA.args.length){if(!b(EA,wA)||gA.args.length===1)return[];if(gA.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var oA=IA(gA.args[0],EA.args[1],wA);if(oA.length===0)return[];var tA=IA(gA.args[1],EA.args[0],wA);if(tA.length===0)return[];O=[oA,tA]}rA=P(O)}else if(EA.args.length>=2&&gA.args.length===2){for(var FA=KA(EA,wA),JA=[],kA=0;kA<FA.length;kA++){var dA=IA(gA,FA[kA],wA,!0);JA=JA.concat(dA)}return JA}else{if(gA.args.length>2)throw Error("Unexpected non-binary associative function: "+gA.toString());return[]}}else if(gA instanceof J){if(gA.name.length===0)throw new Error("Symbol in rule has 0 length...!?");if(iA[gA.name]){if(gA.name!==EA.name)return[]}else switch(gA.name[1]>="a"&&gA.name[1]<="z"?gA.name.substring(0,2):gA.name[0]){case"n":case"_p":rA[0].placeholders[gA.name]=EA;break;case"c":case"cl":if(og(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"v":if(!og(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"vl":if(qg(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"cd":if(cK(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"vd":if(!cK(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"ce":if(Yo(EA))rA[0].placeholders[gA.name]=EA;else return[];break;case"ve":if(!Yo(EA))rA[0].placeholders[gA.name]=EA;else return[];break;default:throw new Error("Invalid symbol in rule: "+gA.name)}}else if(gA instanceof r){if(!o(gA.value,EA.value))return[]}else return[];return rA}function RA(gA,EA){if(gA instanceof r&&EA instanceof r){if(!o(gA.value,EA.value))return!1}else if(gA instanceof J&&EA instanceof J){if(gA.name!==EA.name)return!1}else if(gA instanceof h&&EA instanceof h||gA instanceof S&&EA instanceof S){if(gA instanceof h){if(gA.op!==EA.op||gA.fn!==EA.fn)return!1}else if(gA instanceof S&&gA.name!==EA.name)return!1;if(gA.args.length!==EA.args.length)return!1;for(var wA=0;wA<gA.args.length;wA++)if(!RA(gA.args[wA],EA.args[wA]))return!1}else return!1;return!0}return z}),D4="simplifyConstant",w4=["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],s4=T(D4,w4,A=>{var{typed:g,config:I,mathWithTransform:B,matrix:C,fraction:Q,bignumber:E,AccessorNode:w,ArrayNode:D,ConstantNode:i,FunctionNode:o,IndexNode:s,ObjectNode:y,OperatorNode:a,SymbolNode:N}=A,{isCommutative:e,isAssociative:F,allChildren:K,createMakeNodeFunction:U}=Pw({FunctionNode:o,OperatorNode:a,SymbolNode:N}),M=g("simplifyConstant",{Node:m=>Y(f(m,{})),"Node, Object":function(d,l){return Y(f(d,l))}});function r(m){return YC(m)?m.valueOf():m instanceof Array?m.map(r):qA(m)?C(r(m.valueOf())):m}function S(m,d,l){try{return B[m].apply(null,d)}catch{return d=d.map(r),n(B[m].apply(null,d),l)}}var c=g({Fraction:H,number:function(d){return d<0?J(new i(-d)):new i(d)},BigNumber:function(d){return d<0?J(new i(-d)):new i(d)},bigint:function(d){return d<0n?J(new i(-d)):new i(d)},Complex:function(d){throw new Error("Cannot convert Complex number to Node")},string:function(d){return new i(d)},Matrix:function(d){return new D(d.valueOf().map(l=>c(l)))}});function Y(m){return eg(m)?m:c(m)}function h(m,d){var l=d&&d.exactFractions!==!1;if(l&&isFinite(m)&&Q){var q=Q(m),Z=d&&typeof d.fractionsLimit=="number"?d.fractionsLimit:1/0;if(q.valueOf()===m&&q.n<Z&&q.d<Z)return q}return m}var n=g({"string, Object":function(d,l){var q=CC(d,I);if(q==="BigNumber")return E===void 0&&lw(),E(d);if(q==="bigint")return BigInt(d);if(q==="Fraction")return Q===void 0&&Ge(),Q(d);var Z=parseFloat(d);return h(Z,l)},"Fraction, Object":function(d,l){return d},"BigNumber, Object":function(d,l){return d},"number, Object":function(d,l){return h(d,l)},"bigint, Object":function(d,l){return d},"Complex, Object":function(d,l){return d.im!==0?d:h(d.re,l)},"Matrix, Object":function(d,l){return C(h(d.valueOf()))},"Array, Object":function(d,l){return d.map(h)}});function J(m){return new a("-","unaryMinus",[m])}function H(m){var d,l=m.s*m.n;return l<0?d=new a("-","unaryMinus",[new i(-l)]):d=new i(l),m.d===1?d:new a("/","divide",[d,new i(m.d)])}function b(m,d,l){if(!JC(d))return new w(Y(m),Y(d));if(lI(m)||qA(m)){for(var q=Array.from(d.dimensions);q.length>0;)if(og(q[0])&&typeof q[0].value!="string"){var Z=n(q.shift().value,l);lI(m)?m=m.items[Z-1]:(m=m.valueOf()[Z-1],m instanceof Array&&(m=C(m)))}else if(q.length>1&&og(q[1])&&typeof q[1].value!="string"){var _=n(q[1].value,l),BA=[],z=lI(m)?m.items:m.valueOf();for(var v of z)if(lI(v))BA.push(v.items[_-1]);else if(qA(m))BA.push(v[_-1]);else break;if(BA.length===z.length)lI(m)?m=new D(BA):m=C(BA),q.splice(1,1);else break}else break;return q.length===d.dimensions.length?new w(Y(m),d):q.length>0?(d=new s(q),new w(Y(m),d)):m}if(NE(m)&&d.dimensions.length===1&&og(d.dimensions[0])){var iA=d.dimensions[0].value;return iA in m.properties?m.properties[iA]:new i}return new w(Y(m),d)}function x(m,d,l,q){var Z=d.shift(),_=d.reduce((BA,z)=>{if(!eg(z)){var v=BA.pop();if(eg(v))return[v,z];try{return BA.push(S(m,[v,z],q)),BA}catch{BA.push(v)}}BA.push(Y(BA.pop()));var iA=BA.length===1?BA[0]:l(BA);return[l([iA,Y(z)])]},[Z]);return _.length===1?_[0]:l([_[0],c(_[1])])}function f(m,d){switch(m.type){case"SymbolNode":return m;case"ConstantNode":switch(typeof m.value){case"number":return n(m.value,d);case"bigint":return n(m.value,d);case"string":return m.value;default:if(!isNaN(m.value))return n(m.value,d)}return m;case"FunctionNode":if(B[m.name]&&B[m.name].rawArgs)return m;{var l=["add","multiply"];if(!l.includes(m.name)){var q=m.args.map(NA=>f(NA,d));if(!q.some(eg))try{return S(m.name,q,d)}catch{}if(m.name==="size"&&q.length===1&&lI(q[0])){for(var Z=[],_=q[0];lI(_);)Z.push(_.items.length),_=_.items[0];return C(Z)}return new o(m.name,q.map(Y))}}case"OperatorNode":{var BA=m.fn.toString(),z,v,iA=U(m);if(Zg(m)&&m.isUnary())z=[f(m.args[0],d)],eg(z[0])?v=iA(z):v=S(BA,z,d);else if(F(m,d.context))if(z=K(m,d.context),z=z.map(NA=>f(NA,d)),e(BA,d.context)){for(var eA=[],CA=[],sA=0;sA<z.length;sA++)eg(z[sA])?CA.push(z[sA]):eA.push(z[sA]);eA.length>1?(v=x(BA,eA,iA,d),CA.unshift(v),v=x(BA,CA,iA,d)):v=x(BA,z,iA,d)}else v=x(BA,z,iA,d);else z=m.args.map(NA=>f(NA,d)),v=x(BA,z,iA,d);return v}case"ParenthesisNode":return f(m.content,d);case"AccessorNode":return b(f(m.object,d),f(m.index,d),d);case"ArrayNode":{var GA=m.items.map(NA=>f(NA,d));return GA.some(eg)?new D(GA.map(Y)):C(GA)}case"IndexNode":return new s(m.dimensions.map(NA=>M(NA,d)));case"ObjectNode":{var yA={};for(var aA in m.properties)yA[aA]=M(m.properties[aA],d);return new y(yA)}case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"RangeNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(m.type))}}return M}),SK="simplifyCore",y4=["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],a4=T(SK,y4,A=>{var{typed:g,parse:I,equal:B,isZero:C,add:Q,subtract:E,multiply:w,divide:D,pow:i,AccessorNode:o,ArrayNode:s,ConstantNode:y,FunctionNode:a,IndexNode:N,ObjectNode:e,OperatorNode:F,ParenthesisNode:K,SymbolNode:U}=A,M=new y(0),r=new y(1),S=new y(!0),c=new y(!1);function Y(H){return Zg(H)&&["and","not","or"].includes(H.op)}var{hasProperty:h,isCommutative:n}=Pw({FunctionNode:a,OperatorNode:F,SymbolNode:U});function J(H){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x=b?b.context:void 0;if(h(H,"trivial",x)){if(dB(H)&&H.args.length===1)return J(H.args[0],b);var f=!1,m=0;if(H.forEach(CA=>{++m,m===1&&(f=J(CA,b))}),m===1)return f}var d=H;if(dB(d)){var l=tW(d.name);if(l){if(d.args.length>2&&h(d,"associative",x))for(;d.args.length>2;){var q=d.args.pop(),Z=d.args.pop();d.args.push(new F(l,d.name,[q,Z]))}d=new F(l,d.name,d.args)}else return new a(J(d.fn),d.args.map(CA=>J(CA,b)))}if(Zg(d)&&d.isUnary()){var _=J(d.args[0],b);if(d.op==="~"&&Zg(_)&&_.isUnary()&&_.op==="~"||d.op==="not"&&Zg(_)&&_.isUnary()&&_.op==="not"&&Y(_.args[0]))return _.args[0];var BA=!0;if(d.op==="-"&&Zg(_)&&(_.isBinary()&&_.fn==="subtract"&&(d=new F("-","subtract",[_.args[1],_.args[0]]),BA=!1),_.isUnary()&&_.op==="-"))return _.args[0];if(BA)return new F(d.op,d.fn,[_])}if(Zg(d)&&d.isBinary()){var z=J(d.args[0],b),v=J(d.args[1],b);if(d.op==="+"){if(og(z)&&C(z.value))return v;if(og(v)&&C(v.value))return z;Zg(v)&&v.isUnary()&&v.op==="-"&&(v=v.args[0],d=new F("-","subtract",[z,v]))}if(d.op==="-")return Zg(v)&&v.isUnary()&&v.op==="-"?J(new F("+","add",[z,v.args[0]]),b):og(z)&&C(z.value)?J(new F("-","unaryMinus",[v])):og(v)&&C(v.value)?z:new F(d.op,d.fn,[z,v]);if(d.op==="*"){if(og(z)){if(C(z.value))return M;if(B(z.value,1))return v}if(og(v)){if(C(v.value))return M;if(B(v.value,1))return z;if(n(d,x))return new F(d.op,d.fn,[v,z],d.implicit)}return new F(d.op,d.fn,[z,v],d.implicit)}if(d.op==="/")return og(z)&&C(z.value)?M:og(v)&&B(v.value,1)?z:new F(d.op,d.fn,[z,v]);if(d.op==="^"&&og(v)){if(C(v.value))return r;if(B(v.value,1))return z}if(d.op==="and"){if(og(z))if(z.value){if(Y(v))return v;if(og(v))return v.value?S:c}else return c;if(og(v))if(v.value){if(Y(z))return z}else return c}if(d.op==="or"){if(og(z)){if(z.value)return S;if(Y(v))return v}if(og(v)){if(v.value)return S;if(Y(z))return z}}return new F(d.op,d.fn,[z,v])}if(Zg(d))return new F(d.op,d.fn,d.args.map(CA=>J(CA,b)));if(lI(d))return new s(d.items.map(CA=>J(CA,b)));if(BC(d))return new o(J(d.object,b),J(d.index,b));if(JC(d))return new N(d.dimensions.map(CA=>J(CA,b)));if(NE(d)){var iA={};for(var eA in d.properties)iA[eA]=J(d.properties[eA],b);return new e(iA)}return d}return g(SK,{Node:J,"Node,Object":J})}),G4="resolve",N4=["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],R4=T(G4,N4,A=>{var{typed:g,parse:I,ConstantNode:B,FunctionNode:C,OperatorNode:Q,ParenthesisNode:E}=A;function w(D,i){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Set;if(!i)return D;if(qg(D)){if(o.has(D.name)){var s=Array.from(o).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(s,"}"))}var y=i.get(D.name);if(eg(y)){var a=new Set(o);return a.add(D.name),w(y,i,a)}else return typeof y=="number"?I(String(y)):y!==void 0?new B(y):D}else if(Zg(D)){var N=D.args.map(function(F){return w(F,i,o)});return new Q(D.op,D.fn,N,D.implicit)}else{if(NB(D))return new E(w(D.content,i,o));if(dB(D)){var e=D.args.map(function(F){return w(F,i,o)});return new C(D.name,e)}}return D.map(F=>w(F,i,o))}return g("resolve",{Node:w,"Node, Map | null | undefined":w,"Node, Object":(D,i)=>w(D,aQ(i)),"Array | Matrix":g.referToSelf(D=>i=>i.map(o=>D(o))),"Array | Matrix, null | undefined":g.referToSelf(D=>i=>i.map(o=>D(o))),"Array, Object":g.referTo("Array,Map",D=>(i,o)=>D(i,aQ(o))),"Matrix, Object":g.referTo("Matrix,Map",D=>(i,o)=>D(i,aQ(o))),"Array | Matrix, Map":g.referToSelf(D=>(i,o)=>i.map(s=>D(s,o)))})}),LK="symbolicEqual",e4=["parse","simplify","typed","OperatorNode"],t4=T(LK,e4,A=>{var{parse:g,simplify:I,typed:B,OperatorNode:C}=A;function Q(E,w){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=new C("-","subtract",[E,w]),o=I(i,{},D);return og(o)&&!o.value}return B(LK,{"Node, Node":Q,"Node, Node, Object":Q})}),UK="derivative",M4=["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],K4=T(UK,M4,A=>{var{typed:g,config:I,parse:B,simplify:C,equal:Q,isZero:E,numeric:w,ConstantNode:D,FunctionNode:i,OperatorNode:o,ParenthesisNode:s,SymbolNode:y}=A;function a(M,r){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{simplify:!0},c={};F(c,M,r.name);var Y=K(M,c);return S.simplify?C(Y):Y}g.addConversion({from:"identifier",to:"SymbolNode",convert:B});var N=g(UK,{"Node, SymbolNode":a,"Node, SymbolNode, Object":a});g.removeConversion({from:"identifier",to:"SymbolNode",convert:B}),N._simplify=!0,N.toTex=function(M){return e.apply(null,M.args)};var e=g("_derivTex",{"Node, SymbolNode":function(r,S){return og(r)&&Mg(r.value)==="string"?e(B(r.value).toString(),S.toString(),1):e(r.toTex(),S.toString(),1)},"Node, ConstantNode":function(r,S){if(Mg(S.value)==="string")return e(r,B(S.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(r,S,c){return e(r.toString(),S.name,c.value)},"string, string, number":function(r,S,c){var Y;return c===1?Y="{d\\over d"+S+"}":Y="{d^{"+c+"}\\over d"+S+"^{"+c+"}}",Y+"\\left[".concat(r,"\\right]")}}),F=g("constTag",{"Object, ConstantNode, string":function(r,S){return r[S]=!0,!0},"Object, SymbolNode, string":function(r,S,c){return S.name!==c?(r[S]=!0,!0):!1},"Object, ParenthesisNode, string":function(r,S,c){return F(r,S.content,c)},"Object, FunctionAssignmentNode, string":function(r,S,c){return S.params.includes(c)?F(r,S.expr,c):(r[S]=!0,!0)},"Object, FunctionNode | OperatorNode, string":function(r,S,c){if(S.args.length>0){for(var Y=F(r,S.args[0],c),h=1;h<S.args.length;++h)Y=F(r,S.args[h],c)&&Y;if(Y)return r[S]=!0,!0}return!1}}),K=g("_derivative",{"ConstantNode, Object":function(r){return U(0)},"SymbolNode, Object":function(r,S){return S[r]!==void 0?U(0):U(1)},"ParenthesisNode, Object":function(r,S){return new s(K(r.content,S))},"FunctionAssignmentNode, Object":function(r,S){return S[r]!==void 0?U(0):K(r.expr,S)},"FunctionNode, Object":function(r,S){if(S[r]!==void 0)return U(0);var c=r.args[0],Y,h=!1,n=!1,J;switch(r.name){case"cbrt":h=!0,J=new o("*","multiply",[U(3),new o("^","pow",[c,new o("/","divide",[U(2),U(3)])])]);break;case"sqrt":case"nthRoot":if(r.args.length===1)h=!0,J=new o("*","multiply",[U(2),new i("sqrt",[c])]);else if(r.args.length===2)return Y=new o("/","divide",[U(1),r.args[1]]),S[Y]=S[r.args[1]],K(new o("^","pow",[c,Y]),S);break;case"log10":Y=U(10);case"log":if(!Y&&r.args.length===1)J=c.clone(),h=!0;else if(r.args.length===1&&Y||r.args.length===2&&S[r.args[1]]!==void 0)J=new o("*","multiply",[c.clone(),new i("log",[Y||r.args[1]])]),h=!0;else if(r.args.length===2)return K(new o("/","divide",[new i("log",[c]),new i("log",[r.args[1]])]),S);break;case"pow":if(r.args.length===2)return S[Y]=S[r.args[1]],K(new o("^","pow",[c,r.args[1]]),S);break;case"exp":J=new i("exp",[c.clone()]);break;case"sin":J=new i("cos",[c.clone()]);break;case"cos":J=new o("-","unaryMinus",[new i("sin",[c.clone()])]);break;case"tan":J=new o("^","pow",[new i("sec",[c.clone()]),U(2)]);break;case"sec":J=new o("*","multiply",[r,new i("tan",[c.clone()])]);break;case"csc":n=!0,J=new o("*","multiply",[r,new i("cot",[c.clone()])]);break;case"cot":n=!0,J=new o("^","pow",[new i("csc",[c.clone()]),U(2)]);break;case"asin":h=!0,J=new i("sqrt",[new o("-","subtract",[U(1),new o("^","pow",[c.clone(),U(2)])])]);break;case"acos":h=!0,n=!0,J=new i("sqrt",[new o("-","subtract",[U(1),new o("^","pow",[c.clone(),U(2)])])]);break;case"atan":h=!0,J=new o("+","add",[new o("^","pow",[c.clone(),U(2)]),U(1)]);break;case"asec":h=!0,J=new o("*","multiply",[new i("abs",[c.clone()]),new i("sqrt",[new o("-","subtract",[new o("^","pow",[c.clone(),U(2)]),U(1)])])]);break;case"acsc":h=!0,n=!0,J=new o("*","multiply",[new i("abs",[c.clone()]),new i("sqrt",[new o("-","subtract",[new o("^","pow",[c.clone(),U(2)]),U(1)])])]);break;case"acot":h=!0,n=!0,J=new o("+","add",[new o("^","pow",[c.clone(),U(2)]),U(1)]);break;case"sinh":J=new i("cosh",[c.clone()]);break;case"cosh":J=new i("sinh",[c.clone()]);break;case"tanh":J=new o("^","pow",[new i("sech",[c.clone()]),U(2)]);break;case"sech":n=!0,J=new o("*","multiply",[r,new i("tanh",[c.clone()])]);break;case"csch":n=!0,J=new o("*","multiply",[r,new i("coth",[c.clone()])]);break;case"coth":n=!0,J=new o("^","pow",[new i("csch",[c.clone()]),U(2)]);break;case"asinh":h=!0,J=new i("sqrt",[new o("+","add",[new o("^","pow",[c.clone(),U(2)]),U(1)])]);break;case"acosh":h=!0,J=new i("sqrt",[new o("-","subtract",[new o("^","pow",[c.clone(),U(2)]),U(1)])]);break;case"atanh":h=!0,J=new o("-","subtract",[U(1),new o("^","pow",[c.clone(),U(2)])]);break;case"asech":h=!0,n=!0,J=new o("*","multiply",[c.clone(),new i("sqrt",[new o("-","subtract",[U(1),new o("^","pow",[c.clone(),U(2)])])])]);break;case"acsch":h=!0,n=!0,J=new o("*","multiply",[new i("abs",[c.clone()]),new i("sqrt",[new o("+","add",[new o("^","pow",[c.clone(),U(2)]),U(1)])])]);break;case"acoth":h=!0,n=!0,J=new o("-","subtract",[U(1),new o("^","pow",[c.clone(),U(2)])]);break;case"abs":J=new o("/","divide",[new i(new y("abs"),[c.clone()]),c.clone()]);break;case"gamma":default:throw new Error('Cannot process function "'+r.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}var H,b;h?(H="/",b="divide"):(H="*",b="multiply");var x=K(c,S);return n&&(x=new o("-","unaryMinus",[x])),new o(H,b,[x,J])},"OperatorNode, Object":function(r,S){if(S[r]!==void 0)return U(0);if(r.op==="+")return new o(r.op,r.fn,r.args.map(function(m){return K(m,S)}));if(r.op==="-"){if(r.isUnary())return new o(r.op,r.fn,[K(r.args[0],S)]);if(r.isBinary())return new o(r.op,r.fn,[K(r.args[0],S),K(r.args[1],S)])}if(r.op==="*"){var c=r.args.filter(function(m){return S[m]!==void 0});if(c.length>0){var Y=r.args.filter(function(m){return S[m]===void 0}),h=Y.length===1?Y[0]:new o("*","multiply",Y),n=c.concat(K(h,S));return new o("*","multiply",n)}return new o("+","add",r.args.map(function(m){return new o("*","multiply",r.args.map(function(d){return d===m?K(d,S):d.clone()}))}))}if(r.op==="/"&&r.isBinary()){var J=r.args[0],H=r.args[1];return S[H]!==void 0?new o("/","divide",[K(J,S),H]):S[J]!==void 0?new o("*","multiply",[new o("-","unaryMinus",[J]),new o("/","divide",[K(H,S),new o("^","pow",[H.clone(),U(2)])])]):new o("/","divide",[new o("-","subtract",[new o("*","multiply",[K(J,S),H.clone()]),new o("*","multiply",[J.clone(),K(H,S)])]),new o("^","pow",[H.clone(),U(2)])])}if(r.op==="^"&&r.isBinary()){var b=r.args[0],x=r.args[1];if(S[b]!==void 0)return og(b)&&(E(b.value)||Q(b.value,1))?U(0):new o("*","multiply",[r,new o("*","multiply",[new i("log",[b.clone()]),K(x.clone(),S)])]);if(S[x]!==void 0){if(og(x)){if(E(x.value))return U(0);if(Q(x.value,1))return K(b,S)}var f=new o("^","pow",[b.clone(),new o("-","subtract",[x,U(1)])]);return new o("*","multiply",[x.clone(),new o("*","multiply",[K(b,S),f])])}return new o("*","multiply",[new o("^","pow",[b.clone(),x.clone()]),new o("+","add",[new o("*","multiply",[K(b,S),new o("/","divide",[x.clone(),b.clone()])]),new o("*","multiply",[K(x,S),new i("log",[b.clone()])])])])}throw new Error('Cannot process operator "'+r.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function U(M,r){return new D(w(M,r||CC(String(M),I)))}return N}),nK="rationalize",F4=["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"],c4=T(nK,F4,A=>{var{config:g,typed:I,equal:B,isZero:C,add:Q,subtract:E,multiply:w,divide:D,pow:i,parse:o,simplifyConstant:s,simplifyCore:y,simplify:a,fraction:N,bignumber:e,mathWithTransform:F,matrix:K,AccessorNode:U,ArrayNode:M,ConstantNode:r,FunctionNode:S,IndexNode:c,ObjectNode:Y,OperatorNode:h,SymbolNode:n,ParenthesisNode:J}=A;function H(d){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,Z=x(),_=b(d,l,!0,Z.firstRules),BA=_.variables.length,z={exactFractions:!1},v={exactFractions:!0};if(d=_.expression,BA>=1){d=f(d);var iA,eA,CA=!0,sA=!1;d=a(d,Z.firstRules,{},z);for(var GA;eA=CA?Z.distrDivRules:Z.sucDivRules,d=a(d,eA,{},v),CA=!CA,GA=d.toString(),GA!==iA;)sA=!0,iA=GA;sA&&(d=a(d,Z.firstRulesAgain,{},z)),d=a(d,Z.finalRules,{},z)}var yA=[],aA={};return d.type==="OperatorNode"&&d.isBinary()&&d.op==="/"?(BA===1&&(d.args[0]=m(d.args[0],yA),d.args[1]=m(d.args[1])),q&&(aA.numerator=d.args[0],aA.denominator=d.args[1])):(BA===1&&(d=m(d,yA)),q&&(aA.numerator=d,aA.denominator=null)),q?(aA.coefficients=yA,aA.variables=_.variables,aA.expression=d,aA):d}return I(nK,{Node:H,"Node, boolean":(d,l)=>H(d,{},l),"Node, Object":H,"Node, Object, boolean":H});function b(d,l,q,Z){var _=[],BA=a(d,Z,l,{exactFractions:!1});q=!!q;var z="+-*"+(q?"/":"");iA(BA);var v={};return v.expression=BA,v.variables=_,v;function iA(eA){var CA=eA.type;if(CA==="FunctionNode")throw new Error("There is an unsolved function call");if(CA==="OperatorNode")if(eA.op==="^"){if(eA.args[1].type!=="ConstantNode"||!WA(parseFloat(eA.args[1].value)))throw new Error("There is a non-integer exponent");iA(eA.args[0])}else{if(!z.includes(eA.op))throw new Error("Operator "+eA.op+" invalid in polynomial expression");for(var sA=0;sA<eA.args.length;sA++)iA(eA.args[sA])}else if(CA==="SymbolNode"){var GA=eA.name,yA=_.indexOf(GA);yA===-1&&_.push(GA)}else if(CA==="ParenthesisNode")iA(eA.content);else if(CA!=="ConstantNode")throw new Error("type "+CA+" is not allowed in polynomial expression")}}function x(){var d=[y,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},s,{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=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],q=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],Z=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],_={};return _.firstRules=d.concat(l,Z),_.distrDivRules=q,_.sucDivRules=Z,_.firstRulesAgain=d.concat(l),_.finalRules=[y,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},s,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],_}function f(d,l,q){var Z=d.type,_=arguments.length>1;if(Z==="OperatorNode"&&d.isBinary()){var BA=!1,z;if(d.op==="^"&&(d.args[0].type==="ParenthesisNode"||d.args[0].type==="OperatorNode")&&d.args[1].type==="ConstantNode"&&(z=parseFloat(d.args[1].value),BA=z>=2&&WA(z)),BA){if(z>2){var v=d.args[0],iA=new h("^","pow",[d.args[0].cloneDeep(),new r(z-1)]);d=new h("*","multiply",[v,iA])}else d=new h("*","multiply",[d.args[0],d.args[0].cloneDeep()]);_&&(q==="content"?l.content=d:l.args[q]=d)}}if(Z==="ParenthesisNode")f(d.content,d,"content");else if(Z!=="ConstantNode"&&Z!=="SymbolNode")for(var eA=0;eA<d.args.length;eA++)f(d.args[eA],d,eA);if(!_)return d}function m(d,l){l===void 0&&(l=[]),l[0]=0;var q={};q.cte=1,q.oper="+",q.fire="";var Z=0,_="";GA(d,null,q),Z=l.length-1;for(var BA=!0,z,v=Z;v>=0;v--)if(l[v]!==0){var iA=new r(BA?l[v]:Math.abs(l[v])),eA=l[v]<0?"-":"+";if(v>0){var CA=new n(_);if(v>1){var sA=new r(v);CA=new h("^","pow",[CA,sA])}l[v]===-1&&BA?iA=new h("-","unaryMinus",[CA]):Math.abs(l[v])===1?iA=CA:iA=new h("*","multiply",[iA,CA])}BA?z=iA:eA==="+"?z=new h("+","add",[z,iA]):z=new h("-","subtract",[z,iA]),BA=!1}if(BA)return new r(0);return z;function GA(yA,aA,NA){var KA=yA.type;if(KA==="FunctionNode")throw new Error("There is an unsolved function call");if(KA==="OperatorNode"){if(!"+-*^".includes(yA.op))throw new Error("Operator "+yA.op+" invalid");if(aA!==null){if((yA.fn==="unaryMinus"||yA.fn==="pow")&&aA.fn!=="add"&&aA.fn!=="subtract"&&aA.fn!=="multiply")throw new Error("Invalid "+yA.op+" placing");if((yA.fn==="subtract"||yA.fn==="add"||yA.fn==="multiply")&&aA.fn!=="add"&&aA.fn!=="subtract")throw new Error("Invalid "+yA.op+" placing");if((yA.fn==="subtract"||yA.fn==="add"||yA.fn==="unaryMinus")&&NA.noFil!==0)throw new Error("Invalid "+yA.op+" placing")}(yA.op==="^"||yA.op==="*")&&(NA.fire=yA.op);for(var UA=0;UA<yA.args.length;UA++)yA.fn==="unaryMinus"&&(NA.oper="-"),(yA.op==="+"||yA.fn==="subtract")&&(NA.fire="",NA.cte=1,NA.oper=UA===0?"+":yA.op),NA.noFil=UA,GA(yA.args[UA],yA,NA)}else if(KA==="SymbolNode"){if(yA.name!==_&&_!=="")throw new Error("There is more than one variable");if(_=yA.name,aA===null){l[1]=1;return}if(aA.op==="^"&&NA.noFil!==0)throw new Error("In power the variable should be the first parameter");if(aA.op==="*"&&NA.noFil!==1)throw new Error("In multiply the variable should be the second parameter");(NA.fire===""||NA.fire==="*")&&(Z<1&&(l[1]=0),l[1]+=NA.cte*(NA.oper==="+"?1:-1),Z=Math.max(1,Z))}else if(KA==="ConstantNode"){var HA=parseFloat(yA.value);if(aA===null){l[0]=HA;return}if(aA.op==="^"){if(NA.noFil!==1)throw new Error("Constant cannot be powered");if(!WA(HA)||HA<=0)throw new Error("Non-integer exponent is not allowed");for(var P=Z+1;P<HA;P++)l[P]=0;HA>Z&&(l[HA]=0),l[HA]+=NA.cte*(NA.oper==="+"?1:-1),Z=Math.max(HA,Z);return}NA.cte=HA,NA.fire===""&&(l[0]+=NA.cte*(NA.oper==="+"?1:-1))}else throw new Error("Type "+KA+" is not allowed")}}}),hK="zpk2tf",r4=["typed","add","multiply","Complex","number"],S4=T(hK,r4,A=>{var{typed:g,add:I,multiply:B,Complex:C,number:Q}=A;return g(hK,{"Array,Array,number":function(i,o,s){return E(i,o,s)},"Array,Array":function(i,o){return E(i,o,1)},"Matrix,Matrix,number":function(i,o,s){return E(i.valueOf(),o.valueOf(),s)},"Matrix,Matrix":function(i,o){return E(i.valueOf(),o.valueOf(),1)}});function E(D,i,o){D.some(U=>U.type==="BigNumber")&&(D=D.map(U=>Q(U))),i.some(U=>U.type==="BigNumber")&&(i=i.map(U=>Q(U)));for(var s=[C(1,0)],y=[C(1,0)],a=0;a<D.length;a++){var N=D[a];typeof N=="number"&&(N=C(N,0)),s=w(s,[C(1,0),C(-N.re,-N.im)])}for(var e=0;e<i.length;e++){var F=i[e];typeof F=="number"&&(F=C(F,0)),y=w(y,[C(1,0),C(-F.re,-F.im)])}for(var K=0;K<s.length;K++)s[K]=B(s[K],o);return[s,y]}function w(D,i){for(var o=[],s=0;s<D.length+i.length-1;s++){o[s]=C(0,0);for(var y=0;y<D.length;y++)s-y>=0&&s-y<i.length&&(o[s]=I(o[s],B(D[y],i[s-y])))}return o}}),YK="freqz",L4=["typed","add","multiply","Complex","divide","matrix"],U4=T(YK,L4,A=>{var{typed:g,add:I,multiply:B,Complex:C,divide:Q,matrix:E}=A;return g(YK,{"Array, Array":function(o,s){var y=D(512);return w(o,s,y)},"Array, Array, Array":function(o,s,y){return w(o,s,y)},"Array, Array, number":function(o,s,y){if(y<0)throw new Error("w must be a positive number");var a=D(y);return w(o,s,a)},"Matrix, Matrix":function(o,s){var y=D(512),{w:a,h:N}=w(o.valueOf(),s.valueOf(),y);return{w:E(a),h:E(N)}},"Matrix, Matrix, Matrix":function(o,s,y){var{h:a}=w(o.valueOf(),s.valueOf(),y.valueOf());return{h:E(a),w:E(y)}},"Matrix, Matrix, number":function(o,s,y){if(y<0)throw new Error("w must be a positive number");var a=D(y),{h:N}=w(o.valueOf(),s.valueOf(),a);return{h:E(N),w:E(a)}}});function w(i,o,s){for(var y=[],a=[],N=0;N<s.length;N++){for(var e=C(0,0),F=C(0,0),K=0;K<i.length;K++)e=I(e,B(i[K],C(Math.cos(-K*s[N]),Math.sin(-K*s[N]))));for(var U=0;U<o.length;U++)F=I(F,B(o[U],C(Math.cos(-U*s[N]),Math.sin(-U*s[N]))));y.push(e),a.push(F)}for(var M=[],r=0;r<y.length;r++)M.push(Q(y[r],a[r]));return{h:M,w:s}}function D(i){for(var o=[],s=0;s<i;s++)o.push(s/i*Math.PI);return o}}),n4="reviver",h4=["classes"],Y4=T(n4,h4,A=>{var{classes:g}=A;return function(B,C){var Q=g[C&&C.mathjs];return Q&&typeof Q.fromJSON=="function"?Q.fromJSON(C):C}}),J4="replacer",k4=[],l4=T(J4,k4,()=>function(g,I){return typeof I=="number"&&(!isFinite(I)||isNaN(I))?{mathjs:"number",value:String(I)}:typeof I=="bigint"?{mathjs:"bigint",value:String(I)}:I}),H4="13.0.2",d4=T("true",[],()=>!0),b4=T("false",[],()=>!1),u4=T("null",[],()=>null),m4=dI("Infinity",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(1/0):1/0}),Z4=dI("NaN",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(NaN):NaN}),p4=dI("pi",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?bw(I):PH}),f4=dI("tau",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?Fp(I):_H}),W4=dI("e",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?Mp(I):$H}),x4=dI("phi",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?Kp(I):Ad}),v4=dI("LN2",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(2).ln():Math.LN2}),V4=dI("LN10",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(10).ln():Math.LN10}),q4=dI("LOG2E",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(1).div(new I(2).ln()):Math.LOG2E}),O4=dI("LOG10E",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(1).div(new I(10).ln()):Math.LOG10E}),T4=dI("SQRT1_2",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I("0.5").sqrt():Math.SQRT1_2}),j4=dI("SQRT2",["config","?BigNumber"],A=>{var{config:g,BigNumber:I}=A;return g.number==="BigNumber"?new I(2).sqrt():Math.SQRT2}),X4=dI("i",["Complex"],A=>{var{Complex:g}=A;return g.I}),z4=T("PI",["pi"],A=>{var{pi:g}=A;return g}),P4=T("E",["e"],A=>{var{e:g}=A;return g}),_4=T("version",[],()=>H4);function dI(A,g,I){return T(A,g,I,{recreateOnConfigChange:!0})}var $4=$A("speedOfLight","299792458","m s^-1"),AT=$A("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),gT=$A("planckConstant","6.62607015e-34","J s"),IT=$A("reducedPlanckConstant","1.0545718176461565e-34","J s"),BT=$A("magneticConstant","1.25663706212e-6","N A^-2"),CT=$A("electricConstant","8.8541878128e-12","F m^-1"),QT=$A("vacuumImpedance","376.730313667","ohm"),ET=$A("coulomb","8.987551792261171e9","N m^2 C^-2"),iT=$A("elementaryCharge","1.602176634e-19","C"),oT=$A("bohrMagneton","9.2740100783e-24","J T^-1"),DT=$A("conductanceQuantum","7.748091729863649e-5","S"),wT=$A("inverseConductanceQuantum","12906.403729652257","ohm"),sT=$A("magneticFluxQuantum","2.0678338484619295e-15","Wb"),yT=$A("nuclearMagneton","5.0507837461e-27","J T^-1"),aT=$A("klitzing","25812.807459304513","ohm"),GT=$A("bohrRadius","5.29177210903e-11","m"),NT=$A("classicalElectronRadius","2.8179403262e-15","m"),RT=$A("electronMass","9.1093837015e-31","kg"),eT=$A("fermiCoupling","1.1663787e-5","GeV^-2"),tT=Jo("fineStructure",.0072973525693),MT=$A("hartreeEnergy","4.3597447222071e-18","J"),KT=$A("protonMass","1.67262192369e-27","kg"),FT=$A("deuteronMass","3.3435830926e-27","kg"),cT=$A("neutronMass","1.6749271613e-27","kg"),rT=$A("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),ST=$A("rydberg","10973731.568160","m^-1"),LT=$A("thomsonCrossSection","6.6524587321e-29","m^2"),UT=Jo("weakMixingAngle",.2229),nT=Jo("efimovFactor",22.7),hT=$A("atomicMass","1.66053906660e-27","kg"),YT=$A("avogadro","6.02214076e23","mol^-1"),JT=$A("boltzmann","1.380649e-23","J K^-1"),kT=$A("faraday","96485.33212331001","C mol^-1"),lT=$A("firstRadiation","3.7417718521927573e-16","W m^2"),HT=$A("loschmidt","2.686780111798444e25","m^-3"),dT=$A("gasConstant","8.31446261815324","J K^-1 mol^-1"),bT=$A("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),uT=$A("molarVolume","0.022413969545014137","m^3 mol^-1"),mT=Jo("sackurTetrode",-1.16487052358),ZT=$A("secondRadiation","0.014387768775039337","m K"),pT=$A("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),fT=$A("wienDisplacement","2.897771955e-3","m K"),WT=$A("molarMass","0.99999999965e-3","kg mol^-1"),xT=$A("molarMassC12","11.9999999958e-3","kg mol^-1"),vT=$A("gravity","9.80665","m s^-2"),VT=$A("planckLength","1.616255e-35","m"),qT=$A("planckMass","2.176435e-8","kg"),OT=$A("planckTime","5.391245e-44","s"),TT=$A("planckCharge","1.87554603778e-18","C"),jT=$A("planckTemperature","1.416785e+32","K");function $A(A,g,I){var B=["config","Unit","BigNumber"];return T(A,B,C=>{var{config:Q,Unit:E,BigNumber:w}=C,D=Q.number==="BigNumber"?new w(g):parseFloat(g),i=new E(D,I);return i.fixPrefix=!0,i})}function Jo(A,g){var I=["config","BigNumber"];return T(A,I,B=>{var{config:C,BigNumber:Q}=B;return C.number==="BigNumber"?new Q(g):g})}var XT="apply",zT=["typed","isInteger"],PT=T(XT,zT,A=>{var{typed:g,isInteger:I}=A,B=Lw({typed:g,isInteger:I});return g("apply",{"...any":function(Q){var E=Q[1];Ag(E)?Q[1]=E-1:PA(E)&&(Q[1]=E.minus(1));try{return B.apply(null,Q)}catch(w){throw KI(w)}}})},{isTransformFunction:!0}),_T="column",$T=["typed","Index","matrix","range"],Aj=T(_T,$T,A=>{var{typed:g,Index:I,matrix:B,range:C}=A,Q=ge({typed:g,Index:I,matrix:B,range:C});return g("column",{"...any":function(w){var D=w.length-1,i=w[D];Ag(i)&&(w[D]=i-1);try{return Q.apply(null,w)}catch(o){throw KI(o)}}})},{isTransformFunction:!0});function _w(A,g,I){var B=A.filter(function(D){return qg(D)&&!(D.name in g)&&!I.has(D.name)})[0];if(!B)throw new Error('No undefined variable found in inline expression "'+A+'"');var C=B.name,Q=new Map,E=new e0(I,Q,new Set([C])),w=A.compile();return function(i){return Q.set(C,i),w.evaluate(E)}}var gj="filter",Ij=["typed"],Bj=T(gj,Ij,A=>{var{typed:g}=A;function I(C,Q,E){var w,D;return C[0]&&(w=C[0].compile().evaluate(E)),C[1]&&(qg(C[1])||DQ(C[1])?D=C[1].compile().evaluate(E):D=_w(C[1],Q,E)),B(w,D)}I.rawArgs=!0;var B=g("filter",{"Array, function":JK,"Matrix, function":function(Q,E){return Q.create(JK(Q.toArray(),E))},"Array, RegExp":ji,"Matrix, RegExp":function(Q,E){return Q.create(ji(Q.toArray(),E))}});return I},{isTransformFunction:!0});function JK(A,g){return T0(A,function(I,B,C){return UQ(g,I,[B+1],C,"filter")})}var Cj="forEach",Qj=["typed"],Ej=T(Cj,Qj,A=>{var{typed:g}=A;function I(C,Q,E){var w,D;return C[0]&&(w=C[0].compile().evaluate(E)),C[1]&&(qg(C[1])||DQ(C[1])?D=C[1].compile().evaluate(E):D=_w(C[1],Q,E)),B(w,D)}I.rawArgs=!0;var B=g("forEach",{"Array | Matrix, function":function(Q,E){var w=function D(i,o){if(Array.isArray(i))Ti(i,function(s,y){D(s,o.concat(y+1))});else return UQ(E,i,o,Q,"forEach")};w(Q.valueOf(),[])}});return I},{isTransformFunction:!0}),ij="index",oj=["Index","getMatrixDataType"],Dj=T(ij,oj,A=>{var{Index:g,getMatrixDataType:I}=A;return function(){for(var C=[],Q=0,E=arguments.length;Q<E;Q++){var w=arguments[Q];if(Ji(w))w.start--,w.end-=w.step>0?0:2;else if(w&&w.isSet===!0)w=w.map(function(i){return i-1});else if(ag(w)||qA(w))I(w)!=="boolean"&&(w=w.map(function(i){return i-1}));else if(Ag(w))w--;else if(PA(w))w=w.toNumber()-1;else if(typeof w!="string")throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");C[Q]=w}var D=new g;return g.apply(D,C),D}},{isTransformFunction:!0}),wj="map",sj=["typed"],yj=T(wj,sj,A=>{var{typed:g}=A;function I(C,Q,E){var w,D;return C[0]&&(w=C[0].compile().evaluate(E)),C[1]&&(qg(C[1])||DQ(C[1])?D=C[1].compile().evaluate(E):D=_w(C[1],Q,E)),B(w,D)}I.rawArgs=!0;var B=g("map",{"Array, function":function(Q,E){return kK(Q,E,Q)},"Matrix, function":function(Q,E){return Q.create(kK(Q.valueOf(),E,Q))}});return I},{isTransformFunction:!0});function kK(A,g,I){function B(C,Q){return Array.isArray(C)?ZB(C,function(E,w){return B(E,Q.concat(w+1))}):UQ(g,C,Q,I,"map")}return B(A,[])}function aC(A){if(A.length===2&&kI(A[0])){A=A.slice();var g=A[1];Ag(g)?A[1]=g-1:PA(g)&&(A[1]=g.minus(1))}return A}var aj="max",Gj=["typed","config","numeric","larger"],Nj=T(aj,Gj,A=>{var{typed:g,config:I,numeric:B,larger:C}=A,Q=et({typed:g,config:I,numeric:B,larger:C});return g("max",{"...any":function(w){w=aC(w);try{return Q.apply(null,w)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),Rj="mean",ej=["typed","add","divide"],tj=T(Rj,ej,A=>{var{typed:g,add:I,divide:B}=A,C=vM({typed:g,add:I,divide:B});return g("mean",{"...any":function(E){E=aC(E);try{return C.apply(null,E)}catch(w){throw KI(w)}}})},{isTransformFunction:!0}),Mj="min",Kj=["typed","config","numeric","smaller"],Fj=T(Mj,Kj,A=>{var{typed:g,config:I,numeric:B,smaller:C}=A,Q=Mt({typed:g,config:I,numeric:B,smaller:C});return g("min",{"...any":function(w){w=aC(w);try{return Q.apply(null,w)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),cj="range",rj=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Sj=T(cj,rj,A=>{var{typed:g,config:I,matrix:B,bignumber:C,smaller:Q,smallerEq:E,larger:w,largerEq:D,add:i,isPositive:o}=A,s=ee({typed:g,config:I,matrix:B,bignumber:C,smaller:Q,smallerEq:E,larger:w,largerEq:D,add:i,isPositive:o});return g("range",{"...any":function(a){var N=a.length-1,e=a[N];return typeof e!="boolean"&&a.push(!0),s.apply(null,a)}})},{isTransformFunction:!0}),Lj="row",Uj=["typed","Index","matrix","range"],nj=T(Lj,Uj,A=>{var{typed:g,Index:I,matrix:B,range:C}=A,Q=ce({typed:g,Index:I,matrix:B,range:C});return g("row",{"...any":function(w){var D=w.length-1,i=w[D];Ag(i)&&(w[D]=i-1);try{return Q.apply(null,w)}catch(o){throw KI(o)}}})},{isTransformFunction:!0}),hj="subset",Yj=["typed","matrix","zeros","add"],Jj=T(hj,Yj,A=>{var{typed:g,matrix:I,zeros:B,add:C}=A,Q=Ue({typed:g,matrix:I,zeros:B,add:C});return g("subset",{"...any":function(w){try{return Q.apply(null,w)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),kj="concat",lj=["typed","matrix","isInteger"],Hj=T(kj,lj,A=>{var{typed:g,matrix:I,isInteger:B}=A,C=$R({typed:g,matrix:I,isInteger:B});return g("concat",{"...any":function(E){var w=E.length-1,D=E[w];Ag(D)?E[w]=D-1:PA(D)&&(E[w]=D.minus(1));try{return C.apply(null,E)}catch(i){throw KI(i)}}})},{isTransformFunction:!0}),lK="diff",dj=["typed","matrix","subtract","number","bignumber"],bj=T(lK,dj,A=>{var{typed:g,matrix:I,subtract:B,number:C,bignumber:Q}=A,E=ae({typed:g,matrix:I,subtract:B,number:C,bignumber:Q});return g(lK,{"...any":function(D){D=aC(D);try{return E.apply(null,D)}catch(i){throw KI(i)}}})},{isTransformFunction:!0}),uj="std",mj=["typed","map","sqrt","variance"],Zj=T(uj,mj,A=>{var{typed:g,map:I,sqrt:B,variance:C}=A,Q=PM({typed:g,map:I,sqrt:B,variance:C});return g("std",{"...any":function(w){w=aC(w);try{return Q.apply(null,w)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),HK="sum",pj=["typed","config","add","numeric"],fj=T(HK,pj,A=>{var{typed:g,config:I,add:B,numeric:C}=A,Q=fM({typed:g,config:I,add:B,numeric:C});return g(HK,{"...any":function(w){w=aC(w);try{return Q.apply(null,w)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),Wj="quantileSeq",xj=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],vj=T(Wj,xj,A=>{var{typed:g,bignumber:I,add:B,subtract:C,divide:Q,multiply:E,partitionSelect:w,compare:D,isInteger:i,smaller:o,smallerEq:s,larger:y}=A,a=XM({typed:g,bignumber:I,add:B,subtract:C,divide:Q,multiply:E,partitionSelect:w,compare:D,isInteger:i,smaller:o,smallerEq:s,larger:y});return g("quantileSeq",{"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, number":(e,F,K)=>a(e,F,N(K)),"Array | Matrix, number | BigNumber, boolean":a,"Array | Matrix, number | BigNumber, boolean, number":(e,F,K,U)=>a(e,F,K,N(U)),"Array | Matrix, Array | Matrix":a,"Array | Matrix, Array | Matrix, number":(e,F,K)=>a(e,F,N(K)),"Array | Matrix, Array | Matrix, boolean":a,"Array | Matrix, Array | Matrix, boolean, number":(e,F,K,U)=>a(e,F,K,N(U))});function N(e){return aC([[],e])[1]}},{isTransformFunction:!0}),dK="cumsum",Vj=["typed","add","unaryPlus"],qj=T(dK,Vj,A=>{var{typed:g,add:I,unaryPlus:B}=A,C=WM({typed:g,add:I,unaryPlus:B});return g(dK,{"...any":function(E){if(E.length===2&&kI(E[0])){var w=E[1];Ag(w)?E[1]=w-1:PA(w)&&(E[1]=w.minus(1))}try{return C.apply(null,E)}catch(D){throw KI(D)}}})},{isTransformFunction:!0}),bK="variance",Oj=["typed","add","subtract","multiply","divide","apply","isNaN"],Tj=T(bK,Oj,A=>{var{typed:g,add:I,subtract:B,multiply:C,divide:Q,apply:E,isNaN:w}=A,D=TM({typed:g,add:I,subtract:B,multiply:C,divide:Q,apply:E,isNaN:w});return g(bK,{"...any":function(o){o=aC(o);try{return D.apply(null,o)}catch(s){throw KI(s)}}})},{isTransformFunction:!0}),uK="print",jj=["typed","matrix","zeros","add"],Xj=T(uK,jj,A=>{var{typed:g,matrix:I,zeros:B,add:C}=A,Q=ve({typed:g,matrix:I,zeros:B,add:C});return g(uK,{"string, Object | Array":function(D,i){return Q(E(D),i)},"string, Object | Array, number | Object":function(D,i,o){return Q(E(D),i,o)}});function E(w){return w.replace(We,D=>{var i=D.slice(1).split("."),o=i.map(function(s){return!isNaN(s)&&s.length>0?parseInt(s)-1:s});return"$"+o.join(".")})}},{isTransformFunction:!0}),zj="and",Pj=["typed","matrix","zeros","add","equalScalar","not","concat"],_j=T(zj,Pj,A=>{var{typed:g,matrix:I,equalScalar:B,zeros:C,not:Q,concat:E}=A,w=Dt({typed:g,matrix:I,equalScalar:B,zeros:C,not:Q,concat:E});function D(i,o,s){var y=i[0].compile().evaluate(s);if(!kI(y)&&!w(y,!0))return!1;var a=i[1].compile().evaluate(s);return w(y,a)}return D.rawArgs=!0,D},{isTransformFunction:!0}),$j="or",A1=["typed","matrix","equalScalar","DenseMatrix","concat"],g1=T($j,A1,A=>{var{typed:g,matrix:I,equalScalar:B,DenseMatrix:C,concat:Q}=A,E=zR({typed:g,matrix:I,equalScalar:B,DenseMatrix:C,concat:Q});function w(D,i,o){var s=D[0].compile().evaluate(o);if(!kI(s)&&E(s,!1))return!0;var y=D[1].compile().evaluate(o);return E(s,y)}return w.rawArgs=!0,w},{isTransformFunction:!0}),I1="bitAnd",B1=["typed","matrix","zeros","add","equalScalar","not","concat"],C1=T(I1,B1,A=>{var{typed:g,matrix:I,equalScalar:B,zeros:C,not:Q,concat:E}=A,w=pR({typed:g,matrix:I,equalScalar:B,zeros:C,not:Q,concat:E});function D(i,o,s){var y=i[0].compile().evaluate(s);if(!kI(y)){if(isNaN(y))return NaN;if(y===0||y===!1)return 0}var a=i[1].compile().evaluate(s);return w(y,a)}return D.rawArgs=!0,D},{isTransformFunction:!0}),Q1="bitOr",E1=["typed","matrix","equalScalar","DenseMatrix","concat"],i1=T(Q1,E1,A=>{var{typed:g,matrix:I,equalScalar:B,DenseMatrix:C,concat:Q}=A,E=xR({typed:g,matrix:I,equalScalar:B,DenseMatrix:C,concat:Q});function w(D,i,o){var s=D[0].compile().evaluate(o);if(!kI(s)){if(isNaN(s))return NaN;if(s===-1)return-1;if(s===!0)return 1}var y=D[1].compile().evaluate(o);return E(s,y)}return w.rawArgs=!0,w},{isTransformFunction:!0}),mK=Object.freeze(Object.defineProperty({__proto__:null,createAbs:Eb,createAccessorNode:GW,createAcos:lp,createAcosh:dp,createAcot:up,createAcoth:Zp,createAcsc:fp,createAcsch:xp,createAdd:_f,createAddScalar:wb,createAnd:Dt,createAndTransform:_j,createApply:Lw,createApplyTransform:PT,createArg:Xu,createArrayNode:RW,createAsec:Vp,createAsech:Op,createAsin:jp,createAsinh:Pp,createAssignmentNode:KW,createAtan:Af,createAtan2:If,createAtanh:Cf,createAtomicMass:hT,createAvogadro:YT,createBellNumbers:P8,createBigNumberClass:aH,createBigint:kd,createBignumber:Zd,createBin:lm,createBitAnd:pR,createBitAndTransform:C1,createBitNot:xu,createBitOr:xR,createBitOrTransform:i1,createBitXor:Tu,createBlockNode:cW,createBohrMagneton:oT,createBohrRadius:GT,createBoltzmann:JT,createBoolean:bd,createCatalan:$8,createCbrt:Gb,createCeil:rb,createChain:r3,createChainClass:Ox,createClassicalElectronRadius:NT,createClone:OH,createColumn:ge,createColumnTransform:Aj,createCombinations:y8,createCombinationsWithRep:G8,createCompare:LZ,createCompareNatural:YZ,createCompareText:lZ,createCompile:gx,createComplex:Wd,createComplexClass:eH,createComposition:g4,createConcat:$R,createConcatTransform:Hj,createConditionalNode:SW,createConductanceQuantum:DT,createConj:Pu,createConstantNode:lW,createCorr:w8,createCos:Ef,createCosh:Df,createCot:sf,createCoth:af,createCoulomb:ET,createCount:w2,createCreateUnit:Jp,createCross:y2,createCsc:Nf,createCsch:ef,createCtranspose:Cm,createCube:Lb,createCumSum:WM,createCumSumTransform:qj,createDeepEqual:PZ,createDenseMatrixClass:VH,createDerivative:K4,createDet:L3,createDeuteronMass:FT,createDiag:G2,createDiff:ae,createDiffTransform:bj,createDistance:X3,createDivide:T3,createDivideScalar:Om,createDot:CW,createDotDivide:EZ,createDotMultiply:du,createDotPow:CZ,createE:W4,createEfimovFactor:nT,createEigs:d3,createElectricConstant:CT,createElectronMass:RT,createElementaryCharge:iT,createEqual:dZ,createEqualScalar:Kd,createEqualText:mZ,createErf:Mm,createEvaluate:Bx,createExp:nb,createExpm:u3,createExpm1:Yb,createFactorial:K8,createFalse:b4,createFaraday:kT,createFermiCoupling:eT,createFft:om,createFibonacciHeapClass:Np,createFilter:e2,createFilterTransform:Bj,createFineStructure:tT,createFirstRadiation:lT,createFix:lb,createFlatten:M2,createFloor:FR,createForEach:F2,createForEachTransform:Ej,createFormat:Jm,createFraction:Vd,createFractionClass:LH,createFreqz:U4,createFunctionAssignmentNode:dW,createFunctionNode:PW,createGamma:R8,createGasConstant:dT,createGcd:Iu,createGetMatrixDataType:S2,createGravitationConstant:AT,createGravity:vT,createHartreeEnergy:MT,createHasNumericValue:Dd,createHelp:F3,createHelpClass:vx,createHex:um,createHypot:AW,createI:X4,createIdentity:U2,createIfft:wm,createIm:$u,createImmutableDenseMatrixClass:Dp,createIndex:DW,createIndexClass:yp,createIndexNode:uW,createIndexTransform:Dj,createInfinity:m4,createIntersect:_3,createInv:n3,createInverseConductanceQuantum:wT,createInvmod:Ju,createIsInteger:jH,createIsNaN:Nd,createIsNegative:Qd,createIsNumeric:id,createIsPositive:sd,createIsPrime:Wm,createIsZero:ad,createKldivergence:c8,createKlitzing:aT,createKron:h2,createLN10:V4,createLN2:v4,createLOG10E:O4,createLOG2E:q4,createLarger:qZ,createLargerEq:jZ,createLcm:Eu,createLeafCount:B4,createLeftShift:tZ,createLgamma:t8,createLog:_m,createLog10:ou,createLog1p:AZ,createLog2:wu,createLoschmidt:HT,createLsolve:oZ,createLsolveAll:yZ,createLup:wx,createLusolve:Zx,createLyap:V3,createMad:Q8,createMagneticConstant:BT,createMagneticFluxQuantum:sT,createMap:J2,createMapTransform:yj,createMatrix:Od,createMatrixClass:kH,createMatrixFromColumns:_d,createMatrixFromFunction:jd,createMatrixFromRows:zd,createMax:et,createMaxTransform:Nj,createMean:vM,createMeanTransform:tj,createMedian:B8,createMin:Mt,createMinTransform:Fj,createMod:rR,createMode:Um,createMolarMass:WT,createMolarMassC12:xT,createMolarPlanckConstant:bT,createMolarVolume:uT,createMultinomial:S8,createMultiply:Nu,createMultiplyScalar:au,createNaN:Z4,createNeutronMass:cT,createNode:yW,createNorm:IW,createNot:B2,createNthRoot:eu,createNthRoots:IZ,createNuclearMagneton:yT,createNull:u4,createNumber:hd,createNumeric:Vm,createObjectNode:ZW,createOct:dm,createOnes:b2,createOperatorNode:fW,createOr:zR,createOrTransform:g1,createParenthesisNode:xW,createParse:$W,createParser:ox,createParserClass:Ex,createPartitionSelect:Ip,createPermutations:U8,createPhi:x4,createPi:p4,createPickRandom:v8,createPinv:Y3,createPlanckCharge:TT,createPlanckConstant:gT,createPlanckLength:VT,createPlanckMass:qT,createPlanckTemperature:jT,createPlanckTime:OT,createPolynomialRoot:fx,createPow:jm,createPrint:ve,createPrintTransform:Xj,createProd:hm,createProtonMass:KT,createQr:yx,createQuantileSeq:XM,createQuantileSeqTransform:vj,createQuantumOfCirculation:rT,createRandom:q8,createRandomInt:T8,createRange:ee,createRangeClass:hH,createRangeNode:VW,createRangeTransform:Sj,createRationalize:c4,createRe:g2,createReducedPlanckConstant:IT,createRelationalNode:OW,createReplacer:l4,createReshape:Z2,createResize:W2,createResolve:R4,createResultSet:el,createReviver:Y4,createRightArithShift:KZ,createRightLogShift:cZ,createRotate:v2,createRotationMatrix:q2,createRound:zm,createRow:ce,createRowTransform:nj,createRydberg:ST,createSQRT1_2:T4,createSQRT2:j4,createSackurTetrode:mT,createSchur:x3,createSec:Mf,createSech:Ff,createSecondRadiation:ZT,createSetCartesian:lf,createSetDifference:df,createSetDistinct:uf,createSetIntersect:Zf,createSetIsSubset:ff,createSetMultiplicity:xf,createSetPowerset:Vf,createSetSize:Of,createSetSymDifference:jf,createSetUnion:zf,createSign:Mu,createSimplify:o4,createSimplifyConstant:s4,createSimplifyCore:a4,createSin:rf,createSinh:Lf,createSize:j2,createSlu:ux,createSmaller:pZ,createSmallerEq:xZ,createSolveODE:Rm,createSort:Cp,createSpaClass:tp,createSparse:hp,createSparseMatrixClass:rd,createSpeedOfLight:$4,createSplitUnit:Ab,createSqrt:cu,createSqrtm:Z3,createSquare:Su,createSqueeze:z2,createStd:PM,createStdTransform:Zj,createStefanBoltzmann:pT,createStirlingS2:X8,createString:Hd,createSubset:Ue,createSubsetTransform:Jj,createSubtract:Uu,createSubtractScalar:yb,createSum:fM,createSumTransform:fj,createSylvester:f3,createSymbolNode:XW,createSymbolicEqual:t4,createTan:nf,createTanh:Jf,createTau:f4,createThomsonCrossSection:LT,createTo:pm,createTrace:iW,createTranspose:Im,createTrue:d4,createTypeOf:ed,createTyped:al,createUnaryMinus:Ib,createUnaryPlus:Cb,createUnequal:$Z,createUnitClass:Sp,createUnitFunction:Up,createUppercaseE:P4,createUppercasePi:z4,createUsolve:wZ,createUsolveAll:GZ,createVacuumImpedance:QT,createVariance:TM,createVarianceTransform:Tj,createVersion:_4,createWeakMixingAngle:UT,createWienDisplacement:fT,createXgcd:hu,createXor:E2,createZeros:Em,createZeta:Sm,createZpk2tf:S4},Symbol.toStringTag,{value:"Module"})),$w={exports:{}};function As(){}As.prototype={on:function(A,g,I){var B=this.e||(this.e={});return(B[A]||(B[A]=[])).push({fn:g,ctx:I}),this},once:function(A,g,I){var B=this;function C(){B.off(A,C),g.apply(I,arguments)}return C._=g,this.on(A,C,I)},emit:function(A){var g=[].slice.call(arguments,1),I=((this.e||(this.e={}))[A]||[]).slice(),B=0,C=I.length;for(B;B<C;B++)I[B].fn.apply(I[B].ctx,g);return this},off:function(A,g){var I=this.e||(this.e={}),B=I[A],C=[];if(B&&g)for(var Q=0,E=B.length;Q<E;Q++)B[Q].fn!==g&&B[Q].fn._!==g&&C.push(B[Q]);return C.length?I[A]=C:delete I[A],this}},$w.exports=As,$w.exports.TinyEmitter=As;var o1=$w.exports;const D1=sE(o1);function w1(A){var g=new D1;return A.on=g.on.bind(g),A.off=g.off.bind(g),A.once=g.once.bind(g),A.emit=g.emit.bind(g),A}function s1(A,g,I,B){function C(F,K){var U=arguments.length;if(U!==1&&U!==2)throw new WB("import",U,1,2);K||(K={});function M(Y,h,n){if(Array.isArray(h))h.forEach(b=>M(Y,b));else if(typeof h=="object")for(var J in h)mA(h,J)&&M(Y,h[J],J);else if(eE(h)||n!==void 0){var H=eE(h)?N(h)?h.fn+".transform":h.fn:n;if(mA(Y,H)&&Y[H]!==h&&!K.silent)throw new Error('Cannot import "'+H+'" twice');Y[H]=h}else if(!K.silent)throw new TypeError("Factory, Object, or Array expected")}var r={};M(r,F);for(var S in r)if(mA(r,S)){var c=r[S];if(eE(c))i(c,K);else if(o(c))Q(S,c,K);else if(!K.silent)throw new TypeError("Factory, Object, or Array expected")}}function Q(F,K,U){if(U.wrap&&typeof K=="function"&&(K=D(K)),s(K)&&(K=A(F,{[K.signature]:K})),A.isTypedFunction(I[F])&&A.isTypedFunction(K)){U.override?K=A(F,K.signatures):K=A(I[F],K),I[F]=K,delete B[F],E(F,K),I.emit("import",F,function(){return K});return}if(I[F]===void 0||U.override){I[F]=K,delete B[F],E(F,K),I.emit("import",F,function(){return K});return}if(!U.silent)throw new Error('Cannot import "'+F+'": already exists')}function E(F,K){K&&typeof K.transform=="function"?(I.expression.transform[F]=K.transform,y(F)&&(I.expression.mathWithTransform[F]=K.transform)):(delete I.expression.transform[F],y(F)&&(I.expression.mathWithTransform[F]=K))}function w(F){delete I.expression.transform[F],y(F)?I.expression.mathWithTransform[F]=I[F]:delete I.expression.mathWithTransform[F]}function D(F){var K=function(){for(var M=[],r=0,S=arguments.length;r<S;r++){var c=arguments[r];M[r]=c&&c.valueOf()}return F.apply(I,M)};return F.transform&&(K.transform=F.transform),K}function i(F,K){var U=arguments.length>2&&arguments[2]!==void 0?arguments[2]:F.fn;if(U.includes("."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(U));var M=N(F)?I.expression.transform:I,r=U in I.expression.transform,S=mA(M,U)?M[U]:void 0,c=function(){var h={};F.dependencies.map(G0).forEach(J=>{if(J.includes("."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(J));J==="math"?h.math=I:J==="mathWithTransform"?h.mathWithTransform=I.expression.mathWithTransform:J==="classes"?h.classes=I:h[J]=I[J]});var n=F(h);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(S===void 0||K.override)return n;if(A.isTypedFunction(S)&&A.isTypedFunction(n))return A(S,n);if(K.silent)return S;throw new Error('Cannot import "'+U+'": already exists')};!F.meta||F.meta.lazy!==!1?(ki(M,U,c),S&&r?w(U):(N(F)||a(F))&&ki(I.expression.mathWithTransform,U,()=>M[U])):(M[U]=c(),S&&r?w(U):(N(F)||a(F))&&ki(I.expression.mathWithTransform,U,()=>M[U])),B[U]=F,I.emit("import",U,c)}function o(F){return typeof F=="function"||typeof F=="number"||typeof F=="string"||typeof F=="boolean"||F===null||SI(F)||AB(F)||PA(F)||YC(F)||qA(F)||Array.isArray(F)}function s(F){return typeof F=="function"&&typeof F.signature=="string"}function y(F){return!mA(e,F)}function a(F){return!F.fn.includes(".")&&!mA(e,F.fn)&&(!F.meta||!F.meta.isClass)}function N(F){return F!==void 0&&F.meta!==void 0&&F.meta.isTransformFunction===!0||!1}var e={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return C}function gs(A,g){var I=wI({},fG,g);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 B=w1({isNumber:Ag,isComplex:AB,isBigNumber:PA,isBigInt:WG,isFraction:YC,isUnit:SI,isString:II,isArray:ag,isMatrix:qA,isCollection:kI,isDenseMatrix:yE,isSparseMatrix:IC,isRange:Ji,isIndex:aE,isBoolean:xG,isResultSet:vG,isHelp:gw,isFunction:VG,isDate:qG,isRegExp:OG,isObject:GE,isNull:TG,isUndefined:jG,isAccessorNode:BC,isArrayNode:lI,isAssignmentNode:XG,isBlockNode:zG,isConditionalNode:PG,isConstantNode:og,isFunctionAssignmentNode:DQ,isFunctionNode:dB,isIndexNode:JC,isNode:eg,isObjectNode:NE,isOperatorNode:Zg,isParenthesisNode:NB,isRangeNode:_G,isRelationalNode:$G,isSymbolNode:qg,isChain:Bw});B.config=xk(I,B.emit),B.expression={transform:{},mathWithTransform:{config:B.config}};var C=[],Q=[];function E(o){if(eE(o))return o(B);var s=o[Object.keys(o)[0]];if(eE(s))return s(B);if(!fk(o))throw console.warn("Factory object with properties `type`, `name`, and `factory` expected",o),new Error("Factory object with properties `type`, `name`, and `factory` expected");var y=C.indexOf(o),a;return y===-1?(o.math===!0?a=o.factory(B.type,I,E,B.typed,B):a=o.factory(B.type,I,E,B.typed),C.push(o),Q.push(a)):a=Q[y],a}var w={};function D(){for(var o=arguments.length,s=new Array(o),y=0;y<o;y++)s[y]=arguments[y];return B.typed.apply(B.typed,s)}D.isTypedFunction=kC.isTypedFunction;var i=s1(D,E,B,w);return B.import=i,B.on("config",()=>{Object.values(w).forEach(o=>{o&&o.meta&&o.meta.recreateOnConfigChange&&i(o,{override:!0})})}),B.create=gs.bind(null,A),B.factory=T,B.import(Object.values(pk(A))),B.ArgumentsError=WB,B.DimensionError=Ig,B.IndexError=VI,B}const y1=gs(mK,{}),ZK="simcore/services/comp/opencor";function Is(A,g){let I=-1;const B=new y1.parser;return A.simulationUiInfo.input.forEach(C=>{++I,B.set(C.id,A.$refs.simInput[I].vModel)}),B.evaluate(g)}function pK(A){A.$nextTick(()=>{let g=-1;A.simulationUiInfo.input.forEach(I=>{++g,A.$refs.simInput[g].visible=I.visible===void 0?!0:Is(A,I.visible)}),A.libopencor!==void 0&&(A.userMessage="Rerunning the model...",A.showUserMessage=!0,A.$nextTick(()=>{A.runSimulation()}))})}function fK(A){if(!A.hasFinalisedUi&&A.isMounted&&A.hasValidSimulationUiInfo){A.$refs.output.classList.add("x"+A.simulationUiInfo.output.plots.length);let g=-1;A.simulationUiInfo.output.plots.forEach(()=>{A.simulationResults[++g]=[{x:[],y:[],type:"scatter"}]}),pK(A),A.hasFinalisedUi=!0}}const WK=(A,g)=>{const I=A.__vccOpts||A;for(const[B,C]of g)I[B]=C;return I},a1={name:"SimulationVuerInput",components:{ElInputNumber:zD,ElOption:dG,ElSelect:HG,ElSlider:mG},props:{defaultValue:{required:!0,type:Number},maximumValue:{type:Number},minimumValue:{type:Number},name:{required:!0,type:String},possibleValues:{type:Array},stepValue:{type:Number}},data:function(){return{isDiscrete:this.possibleValues!==void 0,labelClasses:"default "+(this.possibleValues!==void 0?"discrete":"scalar"),visible:!0,vModel:this.defaultValue}},methods:{updateUi:function(){pK(this.$parent)}}},G1={key:1,class:"sliders-and-fields"};function N1(A,g,I,B,C,Q){const E=dG,w=HG,D=mG,i=zD;return G.withDirectives((G.openBlock(),G.createElementBlock("div",null,[G.createElementVNode("p",{class:G.normalizeClass(A.labelClasses)},G.toDisplayString(I.name),3),A.isDiscrete?(G.openBlock(),G.createBlock(w,{key:0,class:"discrete","popper-class":"discrete-popper",size:"small",modelValue:A.vModel,"onUpdate:modelValue":g[0]||(g[0]=o=>A.vModel=o),teleported:!1,onChange:g[1]||(g[1]=o=>Q.updateUi())},{default:G.withCtx(()=>[(G.openBlock(!0),G.createElementBlock(G.Fragment,null,G.renderList(I.possibleValues,o=>(G.openBlock(),G.createBlock(E,{key:o.value,label:o.name,value:o.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])):G.createCommentVNode("",!0),A.isDiscrete?G.createCommentVNode("",!0):(G.openBlock(),G.createElementBlock("div",G1,[G.createVNode(D,{modelValue:A.vModel,"onUpdate:modelValue":g[2]||(g[2]=o=>A.vModel=o),max:I.maximumValue,min:I.minimumValue,"show-input":!1,"show-tooltip":!1,step:I.stepValue,onInput:g[3]||(g[3]=o=>Q.updateUi())},null,8,["modelValue","max","min","step"]),G.createVNode(i,{class:"scalar",size:"small",modelValue:A.vModel,"onUpdate:modelValue":g[4]||(g[4]=o=>A.vModel=o),controls:!1,max:I.maximumValue,min:I.minimumValue,step:I.stepValue,"step-strictly":!0,onInput:g[5]||(g[5]=o=>Q.updateUi())},null,8,["modelValue","max","min","step"])]))],512)),[[G.vShow,A.visible]])}const xK=WK(a1,[["render",N1],["__scopeId","data-v-d1bc0d75"]]);var GC={},ko={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */ko.exports,function(A,g){(function(I){var B=g&&!g.nodeType&&g,C=A&&!A.nodeType&&A,Q=typeof $I=="object"&&$I;(Q.global===Q||Q.window===Q||Q.self===Q)&&(I=Q);var E,w=2147483647,D=36,i=1,o=26,s=38,y=700,a=72,N=128,e="-",F=/^xn--/,K=/[^\x20-\x7E]/,U=/[\x2E\u3002\uFF0E\uFF61]/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},r=D-i,S=Math.floor,c=String.fromCharCode,Y;function h(_){throw new RangeError(M[_])}function n(_,BA){for(var z=_.length,v=[];z--;)v[z]=BA(_[z]);return v}function J(_,BA){var z=_.split("@"),v="";z.length>1&&(v=z[0]+"@",_=z[1]),_=_.replace(U,".");var iA=_.split("."),eA=n(iA,BA).join(".");return v+eA}function H(_){for(var BA=[],z=0,v=_.length,iA,eA;z<v;)iA=_.charCodeAt(z++),iA>=55296&&iA<=56319&&z<v?(eA=_.charCodeAt(z++),(eA&64512)==56320?BA.push(((iA&1023)<<10)+(eA&1023)+65536):(BA.push(iA),z--)):BA.push(iA);return BA}function b(_){return n(_,function(BA){var z="";return BA>65535&&(BA-=65536,z+=c(BA>>>10&1023|55296),BA=56320|BA&1023),z+=c(BA),z}).join("")}function x(_){return _-48<10?_-22:_-65<26?_-65:_-97<26?_-97:D}function f(_,BA){return _+22+75*(_<26)-((BA!=0)<<5)}function m(_,BA,z){var v=0;for(_=z?S(_/y):_>>1,_+=S(_/BA);_>r*o>>1;v+=D)_=S(_/r);return S(v+(r+1)*_/(_+s))}function d(_){var BA=[],z=_.length,v,iA=0,eA=N,CA=a,sA,GA,yA,aA,NA,KA,UA,HA,P;for(sA=_.lastIndexOf(e),sA<0&&(sA=0),GA=0;GA<sA;++GA)_.charCodeAt(GA)>=128&&h("not-basic"),BA.push(_.charCodeAt(GA));for(yA=sA>0?sA+1:0;yA<z;){for(aA=iA,NA=1,KA=D;yA>=z&&h("invalid-input"),UA=x(_.charCodeAt(yA++)),(UA>=D||UA>S((w-iA)/NA))&&h("overflow"),iA+=UA*NA,HA=KA<=CA?i:KA>=CA+o?o:KA-CA,!(UA<HA);KA+=D)P=D-HA,NA>S(w/P)&&h("overflow"),NA*=P;v=BA.length+1,CA=m(iA-aA,v,aA==0),S(iA/v)>w-eA&&h("overflow"),eA+=S(iA/v),iA%=v,BA.splice(iA++,0,eA)}return b(BA)}function l(_){var BA,z,v,iA,eA,CA,sA,GA,yA,aA,NA,KA=[],UA,HA,P,IA;for(_=H(_),UA=_.length,BA=N,z=0,eA=a,CA=0;CA<UA;++CA)NA=_[CA],NA<128&&KA.push(c(NA));for(v=iA=KA.length,iA&&KA.push(e);v<UA;){for(sA=w,CA=0;CA<UA;++CA)NA=_[CA],NA>=BA&&NA<sA&&(sA=NA);for(HA=v+1,sA-BA>S((w-z)/HA)&&h("overflow"),z+=(sA-BA)*HA,BA=sA,CA=0;CA<UA;++CA)if(NA=_[CA],NA<BA&&++z>w&&h("overflow"),NA==BA){for(GA=z,yA=D;aA=yA<=eA?i:yA>=eA+o?o:yA-eA,!(GA<aA);yA+=D)IA=GA-aA,P=D-aA,KA.push(c(f(aA+IA%P,0))),GA=S(IA/P);KA.push(c(f(GA,0))),eA=m(z,HA,v==iA),z=0,++v}++z,++BA}return KA.join("")}function q(_){return J(_,function(BA){return F.test(BA)?d(BA.slice(4).toLowerCase()):BA})}function Z(_){return J(_,function(BA){return K.test(BA)?"xn--"+l(BA):BA})}if(E={version:"1.4.1",ucs2:{decode:H,encode:b},decode:d,encode:l,toASCII:Z,toUnicode:q},B&&C)if(A.exports==B)C.exports=E;else for(Y in E)E.hasOwnProperty(Y)&&(B[Y]=E[Y]);else I.punycode=E})($I)}(ko,ko.exports);var R1=ko.exports,e1=Error,t1=EvalError,M1=RangeError,K1=ReferenceError,vK=SyntaxError,YE=TypeError,F1=URIError,c1=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var g={},I=Symbol("test"),B=Object(I);if(typeof I=="string"||Object.prototype.toString.call(I)!=="[object Symbol]"||Object.prototype.toString.call(B)!=="[object Symbol]")return!1;var C=42;g[I]=C;for(I in g)return!1;if(typeof Object.keys=="function"&&Object.keys(g).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(g).length!==0)return!1;var Q=Object.getOwnPropertySymbols(g);if(Q.length!==1||Q[0]!==I||!Object.prototype.propertyIsEnumerable.call(g,I))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var E=Object.getOwnPropertyDescriptor(g,I);if(E.value!==C||E.enumerable!==!0)return!1}return!0},VK=typeof Symbol<"u"&&Symbol,r1=c1,S1=function(){return typeof VK!="function"||typeof Symbol!="function"||typeof VK("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:r1()},Bs={__proto__:null,foo:{}},L1=Object,U1=function(){return{__proto__:Bs}.foo===Bs.foo&&!(Bs instanceof L1)},n1="Function.prototype.bind called on incompatible ",h1=Object.prototype.toString,Y1=Math.max,J1="[object Function]",qK=function(g,I){for(var B=[],C=0;C<g.length;C+=1)B[C]=g[C];for(var Q=0;Q<I.length;Q+=1)B[Q+g.length]=I[Q];return B},k1=function(g,I){for(var B=[],C=I||0,Q=0;C<g.length;C+=1,Q+=1)B[Q]=g[C];return B},l1=function(A,g){for(var I="",B=0;B<A.length;B+=1)I+=A[B],B+1<A.length&&(I+=g);return I},H1=function(g){var I=this;if(typeof I!="function"||h1.apply(I)!==J1)throw new TypeError(n1+I);for(var B=k1(arguments,1),C,Q=function(){if(this instanceof C){var o=I.apply(this,qK(B,arguments));return Object(o)===o?o:this}return I.apply(g,qK(B,arguments))},E=Y1(0,I.length-B.length),w=[],D=0;D<E;D++)w[D]="$"+D;if(C=Function("binder","return function ("+l1(w,",")+"){ return binder.apply(this,arguments); }")(Q),I.prototype){var i=function(){};i.prototype=I.prototype,C.prototype=new i,i.prototype=null}return C},d1=H1,Cs=Function.prototype.bind||d1,b1=Function.prototype.call,u1=Object.prototype.hasOwnProperty,m1=Cs,Z1=m1.call(b1,u1),Dg,p1=e1,f1=t1,W1=M1,x1=K1,lQ=vK,HQ=YE,v1=F1,OK=Function,Qs=function(A){try{return OK('"use strict"; return ('+A+").constructor;")()}catch{}},bC=Object.getOwnPropertyDescriptor;if(bC)try{bC({},"")}catch{bC=null}var Es=function(){throw new HQ},V1=bC?function(){try{return arguments.callee,Es}catch{try{return bC(arguments,"callee").get}catch{return Es}}}():Es,dQ=S1(),q1=U1(),$g=Object.getPrototypeOf||(q1?function(A){return A.__proto__}:null),bQ={},O1=typeof Uint8Array>"u"||!$g?Dg:$g(Uint8Array),uC={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?Dg:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Dg:ArrayBuffer,"%ArrayIteratorPrototype%":dQ&&$g?$g([][Symbol.iterator]()):Dg,"%AsyncFromSyncIteratorPrototype%":Dg,"%AsyncFunction%":bQ,"%AsyncGenerator%":bQ,"%AsyncGeneratorFunction%":bQ,"%AsyncIteratorPrototype%":bQ,"%Atomics%":typeof Atomics>"u"?Dg:Atomics,"%BigInt%":typeof BigInt>"u"?Dg:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Dg:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Dg:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Dg:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":p1,"%eval%":eval,"%EvalError%":f1,"%Float32Array%":typeof Float32Array>"u"?Dg:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Dg:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Dg:FinalizationRegistry,"%Function%":OK,"%GeneratorFunction%":bQ,"%Int8Array%":typeof Int8Array>"u"?Dg:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Dg:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Dg:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":dQ&&$g?$g($g([][Symbol.iterator]())):Dg,"%JSON%":typeof JSON=="object"?JSON:Dg,"%Map%":typeof Map>"u"?Dg:Map,"%MapIteratorPrototype%":typeof Map>"u"||!dQ||!$g?Dg:$g(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Dg:Promise,"%Proxy%":typeof Proxy>"u"?Dg:Proxy,"%RangeError%":W1,"%ReferenceError%":x1,"%Reflect%":typeof Reflect>"u"?Dg:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Dg:Set,"%SetIteratorPrototype%":typeof Set>"u"||!dQ||!$g?Dg:$g(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Dg:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":dQ&&$g?$g(""[Symbol.iterator]()):Dg,"%Symbol%":dQ?Symbol:Dg,"%SyntaxError%":lQ,"%ThrowTypeError%":V1,"%TypedArray%":O1,"%TypeError%":HQ,"%Uint8Array%":typeof Uint8Array>"u"?Dg:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Dg:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Dg:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Dg:Uint32Array,"%URIError%":v1,"%WeakMap%":typeof WeakMap>"u"?Dg:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Dg:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Dg:WeakSet};if($g)try{null.error}catch(A){var T1=$g($g(A));uC["%Error.prototype%"]=T1}var j1=function A(g){var I;if(g==="%AsyncFunction%")I=Qs("async function () {}");else if(g==="%GeneratorFunction%")I=Qs("function* () {}");else if(g==="%AsyncGeneratorFunction%")I=Qs("async function* () {}");else if(g==="%AsyncGenerator%"){var B=A("%AsyncGeneratorFunction%");B&&(I=B.prototype)}else if(g==="%AsyncIteratorPrototype%"){var C=A("%AsyncGenerator%");C&&$g&&(I=$g(C.prototype))}return uC[g]=I,I},TK={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},JE=Cs,lo=Z1,X1=JE.call(Function.call,Array.prototype.concat),z1=JE.call(Function.apply,Array.prototype.splice),jK=JE.call(Function.call,String.prototype.replace),Ho=JE.call(Function.call,String.prototype.slice),P1=JE.call(Function.call,RegExp.prototype.exec),_1=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,$1=/\\(\\)?/g,AX=function(g){var I=Ho(g,0,1),B=Ho(g,-1);if(I==="%"&&B!=="%")throw new lQ("invalid intrinsic syntax, expected closing `%`");if(B==="%"&&I!=="%")throw new lQ("invalid intrinsic syntax, expected opening `%`");var C=[];return jK(g,_1,function(Q,E,w,D){C[C.length]=w?jK(D,$1,"$1"):E||Q}),C},gX=function(g,I){var B=g,C;if(lo(TK,B)&&(C=TK[B],B="%"+C[0]+"%"),lo(uC,B)){var Q=uC[B];if(Q===bQ&&(Q=j1(B)),typeof Q>"u"&&!I)throw new HQ("intrinsic "+g+" exists, but is not available. Please file an issue!");return{alias:C,name:B,value:Q}}throw new lQ("intrinsic "+g+" does not exist!")},uQ=function(g,I){if(typeof g!="string"||g.length===0)throw new HQ("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof I!="boolean")throw new HQ('"allowMissing" argument must be a boolean');if(P1(/^%?[^%]*%?$/,g)===null)throw new lQ("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var B=AX(g),C=B.length>0?B[0]:"",Q=gX("%"+C+"%",I),E=Q.name,w=Q.value,D=!1,i=Q.alias;i&&(C=i[0],z1(B,X1([0,1],i)));for(var o=1,s=!0;o<B.length;o+=1){var y=B[o],a=Ho(y,0,1),N=Ho(y,-1);if((a==='"'||a==="'"||a==="`"||N==='"'||N==="'"||N==="`")&&a!==N)throw new lQ("property names with quotes must have matching quotes");if((y==="constructor"||!s)&&(D=!0),C+="."+y,E="%"+C+"%",lo(uC,E))w=uC[E];else if(w!=null){if(!(y in w)){if(!I)throw new HQ("base intrinsic for "+g+" exists, but the property is not available.");return}if(bC&&o+1>=B.length){var e=bC(w,y);s=!!e,s&&"get"in e&&!("originalValue"in e.get)?w=e.get:w=w[y]}else s=lo(w,y),w=w[y];s&&!D&&(uC[E]=w)}}return w},XK={exports:{}},is,zK;function os(){if(zK)return is;zK=1;var A=uQ,g=A("%Object.defineProperty%",!0)||!1;if(g)try{g({},"a",{value:1})}catch{g=!1}return is=g,is}var IX=uQ,bo=IX("%Object.getOwnPropertyDescriptor%",!0);if(bo)try{bo([],"length")}catch{bo=null}var PK=bo,_K=os(),BX=vK,mQ=YE,$K=PK,CX=function(g,I,B){if(!g||typeof g!="object"&&typeof g!="function")throw new mQ("`obj` must be an object or a function`");if(typeof I!="string"&&typeof I!="symbol")throw new mQ("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new mQ("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new mQ("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new mQ("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new mQ("`loose`, if provided, must be a boolean");var C=arguments.length>3?arguments[3]:null,Q=arguments.length>4?arguments[4]:null,E=arguments.length>5?arguments[5]:null,w=arguments.length>6?arguments[6]:!1,D=!!$K&&$K(g,I);if(_K)_K(g,I,{configurable:E===null&&D?D.configurable:!E,enumerable:C===null&&D?D.enumerable:!C,value:B,writable:Q===null&&D?D.writable:!Q});else if(w||!C&&!Q&&!E)g[I]=B;else throw new BX("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Ds=os(),AF=function(){return!!Ds};AF.hasArrayLengthDefineBug=function(){if(!Ds)return null;try{return Ds([],"length",{value:1}).length!==1}catch{return!0}};var QX=AF,EX=uQ,gF=CX,iX=QX(),IF=PK,BF=YE,oX=EX("%Math.floor%"),DX=function(g,I){if(typeof g!="function")throw new BF("`fn` is not a function");if(typeof I!="number"||I<0||I>4294967295||oX(I)!==I)throw new BF("`length` must be a positive 32-bit integer");var B=arguments.length>2&&!!arguments[2],C=!0,Q=!0;if("length"in g&&IF){var E=IF(g,"length");E&&!E.configurable&&(C=!1),E&&!E.writable&&(Q=!1)}return(C||Q||!B)&&(iX?gF(g,"length",I,!0,!0):gF(g,"length",I)),g};(function(A){var g=Cs,I=uQ,B=DX,C=YE,Q=I("%Function.prototype.apply%"),E=I("%Function.prototype.call%"),w=I("%Reflect.apply%",!0)||g.call(E,Q),D=os(),i=I("%Math.max%");A.exports=function(y){if(typeof y!="function")throw new C("a function is required");var a=w(g,E,arguments);return B(a,1+i(0,y.length-(arguments.length-1)),!0)};var o=function(){return w(g,Q,arguments)};D?D(A.exports,"apply",{value:o}):A.exports.apply=o})(XK);var wX=XK.exports,CF=uQ,QF=wX,sX=QF(CF("String.prototype.indexOf")),yX=function(g,I){var B=CF(g,!!I);return typeof B=="function"&&sX(g,".prototype.")>-1?QF(B):B},ws=typeof Map=="function"&&Map.prototype,ss=Object.getOwnPropertyDescriptor&&ws?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,uo=ws&&ss&&typeof ss.get=="function"?ss.get:null,EF=ws&&Map.prototype.forEach,ys=typeof Set=="function"&&Set.prototype,as=Object.getOwnPropertyDescriptor&&ys?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,mo=ys&&as&&typeof as.get=="function"?as.get:null,iF=ys&&Set.prototype.forEach,aX=typeof WeakMap=="function"&&WeakMap.prototype,kE=aX?WeakMap.prototype.has:null,GX=typeof WeakSet=="function"&&WeakSet.prototype,lE=GX?WeakSet.prototype.has:null,NX=typeof WeakRef=="function"&&WeakRef.prototype,oF=NX?WeakRef.prototype.deref:null,RX=Boolean.prototype.valueOf,eX=Object.prototype.toString,tX=Function.prototype.toString,MX=String.prototype.match,Gs=String.prototype.slice,NC=String.prototype.replace,KX=String.prototype.toUpperCase,DF=String.prototype.toLowerCase,wF=RegExp.prototype.test,sF=Array.prototype.concat,tB=Array.prototype.join,FX=Array.prototype.slice,yF=Math.floor,Ns=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Rs=Object.getOwnPropertySymbols,es=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ZQ=typeof Symbol=="function"&&typeof Symbol.iterator=="object",GI=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ZQ||!0)?Symbol.toStringTag:null,aF=Object.prototype.propertyIsEnumerable,GF=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(A){return A.__proto__}:null);function NF(A,g){if(A===1/0||A===-1/0||A!==A||A&&A>-1e3&&A<1e3||wF.call(/e/,g))return g;var I=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof A=="number"){var B=A<0?-yF(-A):yF(A);if(B!==A){var C=String(B),Q=Gs.call(g,C.length+1);return NC.call(C,I,"$&_")+"."+NC.call(NC.call(Q,/([0-9]{3})/g,"$&_"),/_$/,"")}}return NC.call(g,I,"$&_")}var ts=yK,RF=ts.custom,eF=KF(RF)?RF:null,cX=function A(g,I,B,C){var Q=I||{};if(RC(Q,"quoteStyle")&&Q.quoteStyle!=="single"&&Q.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(RC(Q,"maxStringLength")&&(typeof Q.maxStringLength=="number"?Q.maxStringLength<0&&Q.maxStringLength!==1/0:Q.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var E=RC(Q,"customInspect")?Q.customInspect:!0;if(typeof E!="boolean"&&E!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(RC(Q,"indent")&&Q.indent!==null&&Q.indent!==" "&&!(parseInt(Q.indent,10)===Q.indent&&Q.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(RC(Q,"numericSeparator")&&typeof Q.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var w=Q.numericSeparator;if(typeof g>"u")return"undefined";if(g===null)return"null";if(typeof g=="boolean")return g?"true":"false";if(typeof g=="string")return cF(g,Q);if(typeof g=="number"){if(g===0)return 1/0/g>0?"0":"-0";var D=String(g);return w?NF(g,D):D}if(typeof g=="bigint"){var i=String(g)+"n";return w?NF(g,i):i}var o=typeof Q.depth>"u"?5:Q.depth;if(typeof B>"u"&&(B=0),B>=o&&o>0&&typeof g=="object")return Ms(g)?"[Array]":"[Object]";var s=fX(Q,B);if(typeof C>"u")C=[];else if(FF(C,g)>=0)return"[Circular]";function y(x,f,m){if(f&&(C=FX.call(C),C.push(f)),m){var d={depth:Q.depth};return RC(Q,"quoteStyle")&&(d.quoteStyle=Q.quoteStyle),A(x,d,B+1,C)}return A(x,Q,B+1,C)}if(typeof g=="function"&&!MF(g)){var a=kX(g),N=Zo(g,y);return"[Function"+(a?": "+a:" (anonymous)")+"]"+(N.length>0?" { "+tB.call(N,", ")+" }":"")}if(KF(g)){var e=ZQ?NC.call(String(g),/^(Symbol\(.*\))_[^)]*$/,"$1"):es.call(g);return typeof g=="object"&&!ZQ?HE(e):e}if(mX(g)){for(var F="<"+DF.call(String(g.nodeName)),K=g.attributes||[],U=0;U<K.length;U++)F+=" "+K[U].name+"="+tF(rX(K[U].value),"double",Q);return F+=">",g.childNodes&&g.childNodes.length&&(F+="..."),F+="</"+DF.call(String(g.nodeName))+">",F}if(Ms(g)){if(g.length===0)return"[]";var M=Zo(g,y);return s&&!pX(M)?"["+Fs(M,s)+"]":"[ "+tB.call(M,", ")+" ]"}if(LX(g)){var r=Zo(g,y);return!("cause"in Error.prototype)&&"cause"in g&&!aF.call(g,"cause")?"{ ["+String(g)+"] "+tB.call(sF.call("[cause]: "+y(g.cause),r),", ")+" }":r.length===0?"["+String(g)+"]":"{ ["+String(g)+"] "+tB.call(r,", ")+" }"}if(typeof g=="object"&&E){if(eF&&typeof g[eF]=="function"&&ts)return ts(g,{depth:o-B});if(E!=="symbol"&&typeof g.inspect=="function")return g.inspect()}if(lX(g)){var S=[];return EF&&EF.call(g,function(x,f){S.push(y(f,g,!0)+" => "+y(x,g))}),rF("Map",uo.call(g),S,s)}if(bX(g)){var c=[];return iF&&iF.call(g,function(x){c.push(y(x,g))}),rF("Set",mo.call(g),c,s)}if(HX(g))return Ks("WeakMap");if(uX(g))return Ks("WeakSet");if(dX(g))return Ks("WeakRef");if(nX(g))return HE(y(Number(g)));if(YX(g))return HE(y(Ns.call(g)));if(hX(g))return HE(RX.call(g));if(UX(g))return HE(y(String(g)));if(typeof window<"u"&&g===window)return"{ [object Window] }";if(g===$I)return"{ [object globalThis] }";if(!SX(g)&&!MF(g)){var Y=Zo(g,y),h=GF?GF(g)===Object.prototype:g instanceof Object||g.constructor===Object,n=g instanceof Object?"":"null prototype",J=!h&&GI&&Object(g)===g&&GI in g?Gs.call(eC(g),8,-1):n?"Object":"",H=h||typeof g.constructor!="function"?"":g.constructor.name?g.constructor.name+" ":"",b=H+(J||n?"["+tB.call(sF.call([],J||[],n||[]),": ")+"] ":"");return Y.length===0?b+"{}":s?b+"{"+Fs(Y,s)+"}":b+"{ "+tB.call(Y,", ")+" }"}return String(g)};function tF(A,g,I){var B=(I.quoteStyle||g)==="double"?'"':"'";return B+A+B}function rX(A){return NC.call(String(A),/"/g,"&quot;")}function Ms(A){return eC(A)==="[object Array]"&&(!GI||!(typeof A=="object"&&GI in A))}function SX(A){return eC(A)==="[object Date]"&&(!GI||!(typeof A=="object"&&GI in A))}function MF(A){return eC(A)==="[object RegExp]"&&(!GI||!(typeof A=="object"&&GI in A))}function LX(A){return eC(A)==="[object Error]"&&(!GI||!(typeof A=="object"&&GI in A))}function UX(A){return eC(A)==="[object String]"&&(!GI||!(typeof A=="object"&&GI in A))}function nX(A){return eC(A)==="[object Number]"&&(!GI||!(typeof A=="object"&&GI in A))}function hX(A){return eC(A)==="[object Boolean]"&&(!GI||!(typeof A=="object"&&GI in A))}function KF(A){if(ZQ)return A&&typeof A=="object"&&A instanceof Symbol;if(typeof A=="symbol")return!0;if(!A||typeof A!="object"||!es)return!1;try{return es.call(A),!0}catch{}return!1}function YX(A){if(!A||typeof A!="object"||!Ns)return!1;try{return Ns.call(A),!0}catch{}return!1}var JX=Object.prototype.hasOwnProperty||function(A){return A in this};function RC(A,g){return JX.call(A,g)}function eC(A){return eX.call(A)}function kX(A){if(A.name)return A.name;var g=MX.call(tX.call(A),/^function\s*([\w$]+)/);return g?g[1]:null}function FF(A,g){if(A.indexOf)return A.indexOf(g);for(var I=0,B=A.length;I<B;I++)if(A[I]===g)return I;return-1}function lX(A){if(!uo||!A||typeof A!="object")return!1;try{uo.call(A);try{mo.call(A)}catch{return!0}return A instanceof Map}catch{}return!1}function HX(A){if(!kE||!A||typeof A!="object")return!1;try{kE.call(A,kE);try{lE.call(A,lE)}catch{return!0}return A instanceof WeakMap}catch{}return!1}function dX(A){if(!oF||!A||typeof A!="object")return!1;try{return oF.call(A),!0}catch{}return!1}function bX(A){if(!mo||!A||typeof A!="object")return!1;try{mo.call(A);try{uo.call(A)}catch{return!0}return A instanceof Set}catch{}return!1}function uX(A){if(!lE||!A||typeof A!="object")return!1;try{lE.call(A,lE);try{kE.call(A,kE)}catch{return!0}return A instanceof WeakSet}catch{}return!1}function mX(A){return!A||typeof A!="object"?!1:typeof HTMLElement<"u"&&A instanceof HTMLElement?!0:typeof A.nodeName=="string"&&typeof A.getAttribute=="function"}function cF(A,g){if(A.length>g.maxStringLength){var I=A.length-g.maxStringLength,B="... "+I+" more character"+(I>1?"s":"");return cF(Gs.call(A,0,g.maxStringLength),g)+B}var C=NC.call(NC.call(A,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ZX);return tF(C,"single",g)}function ZX(A){var g=A.charCodeAt(0),I={8:"b",9:"t",10:"n",12:"f",13:"r"}[g];return I?"\\"+I:"\\x"+(g<16?"0":"")+KX.call(g.toString(16))}function HE(A){return"Object("+A+")"}function Ks(A){return A+" { ? }"}function rF(A,g,I,B){var C=B?Fs(I,B):tB.call(I,", ");return A+" ("+g+") {"+C+"}"}function pX(A){for(var g=0;g<A.length;g++)if(FF(A[g],`
83
83
  `)>=0)return!1;return!0}function fX(A,g){var I;if(A.indent===" ")I=" ";else if(typeof A.indent=="number"&&A.indent>0)I=tB.call(Array(A.indent+1)," ");else return null;return{base:I,prev:tB.call(Array(g+1),I)}}function Fs(A,g){if(A.length===0)return"";var I=`
84
84
  `+g.prev+g.base;return I+tB.call(A,","+I)+`
85
85
  `+g.prev}function Zo(A,g){var I=Ms(A),B=[];if(I){B.length=A.length;for(var C=0;C<A.length;C++)B[C]=RC(A,C)?g(A[C],A):""}var Q=typeof Rs=="function"?Rs(A):[],E;if(ZQ){E={};for(var w=0;w<Q.length;w++)E["$"+Q[w]]=Q[w]}for(var D in A)RC(A,D)&&(I&&String(Number(D))===D&&D<A.length||ZQ&&E["$"+D]instanceof Symbol||(wF.call(/[^\w$]/,D)?B.push(g(D,A)+": "+g(A[D],A)):B.push(D+": "+g(A[D],A))));if(typeof Rs=="function")for(var i=0;i<Q.length;i++)aF.call(A,Q[i])&&B.push("["+g(Q[i])+"]: "+g(A[Q[i]],A));return B}var SF=uQ,pQ=yX,WX=cX,xX=YE,po=SF("%WeakMap%",!0),fo=SF("%Map%",!0),vX=pQ("WeakMap.prototype.get",!0),VX=pQ("WeakMap.prototype.set",!0),qX=pQ("WeakMap.prototype.has",!0),OX=pQ("Map.prototype.get",!0),TX=pQ("Map.prototype.set",!0),jX=pQ("Map.prototype.has",!0),cs=function(A,g){for(var I=A,B;(B=I.next)!==null;I=B)if(B.key===g)return I.next=B.next,B.next=A.next,A.next=B,B},XX=function(A,g){var I=cs(A,g);return I&&I.value},zX=function(A,g,I){var B=cs(A,g);B?B.value=I:A.next={key:g,next:A.next,value:I}},PX=function(A,g){return!!cs(A,g)},_X=function(){var g,I,B,C={assert:function(Q){if(!C.has(Q))throw new xX("Side channel does not contain "+WX(Q))},get:function(Q){if(po&&Q&&(typeof Q=="object"||typeof Q=="function")){if(g)return vX(g,Q)}else if(fo){if(I)return OX(I,Q)}else if(B)return XX(B,Q)},has:function(Q){if(po&&Q&&(typeof Q=="object"||typeof Q=="function")){if(g)return qX(g,Q)}else if(fo){if(I)return jX(I,Q)}else if(B)return PX(B,Q);return!1},set:function(Q,E){po&&Q&&(typeof Q=="object"||typeof Q=="function")?(g||(g=new po),VX(g,Q,E)):fo?(I||(I=new fo),TX(I,Q,E)):(B||(B={key:{},next:null}),zX(B,Q,E))}};return C},$X=String.prototype.replace,Az=/%20/g,rs={RFC1738:"RFC1738",RFC3986:"RFC3986"},Ss={default:rs.RFC3986,formatters:{RFC1738:function(A){return $X.call(A,Az,"+")},RFC3986:function(A){return String(A)}},RFC1738:rs.RFC1738,RFC3986:rs.RFC3986},gz=Ss,Ls=Object.prototype.hasOwnProperty,mC=Array.isArray,MB=function(){for(var A=[],g=0;g<256;++g)A.push("%"+((g<16?"0":"")+g.toString(16)).toUpperCase());return A}(),Iz=function(g){for(;g.length>1;){var I=g.pop(),B=I.obj[I.prop];if(mC(B)){for(var C=[],Q=0;Q<B.length;++Q)typeof B[Q]<"u"&&C.push(B[Q]);I.obj[I.prop]=C}}},LF=function(g,I){for(var B=I&&I.plainObjects?Object.create(null):{},C=0;C<g.length;++C)typeof g[C]<"u"&&(B[C]=g[C]);return B},Bz=function A(g,I,B){if(!I)return g;if(typeof I!="object"){if(mC(g))g.push(I);else if(g&&typeof g=="object")(B&&(B.plainObjects||B.allowPrototypes)||!Ls.call(Object.prototype,I))&&(g[I]=!0);else return[g,I];return g}if(!g||typeof g!="object")return[g].concat(I);var C=g;return mC(g)&&!mC(I)&&(C=LF(g,B)),mC(g)&&mC(I)?(I.forEach(function(Q,E){if(Ls.call(g,E)){var w=g[E];w&&typeof w=="object"&&Q&&typeof Q=="object"?g[E]=A(w,Q,B):g.push(Q)}else g[E]=Q}),g):Object.keys(I).reduce(function(Q,E){var w=I[E];return Ls.call(Q,E)?Q[E]=A(Q[E],w,B):Q[E]=w,Q},C)},Cz=function(g,I){return Object.keys(I).reduce(function(B,C){return B[C]=I[C],B},g)},Qz=function(A,g,I){var B=A.replace(/\+/g," ");if(I==="iso-8859-1")return B.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(B)}catch{return B}},Ez=function(g,I,B,C,Q){if(g.length===0)return g;var E=g;if(typeof g=="symbol"?E=Symbol.prototype.toString.call(g):typeof g!="string"&&(E=String(g)),B==="iso-8859-1")return escape(E).replace(/%u[0-9a-f]{4}/gi,function(o){return"%26%23"+parseInt(o.slice(2),16)+"%3B"});for(var w="",D=0;D<E.length;++D){var i=E.charCodeAt(D);if(i===45||i===46||i===95||i===126||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||Q===gz.RFC1738&&(i===40||i===41)){w+=E.charAt(D);continue}if(i<128){w=w+MB[i];continue}if(i<2048){w=w+(MB[192|i>>6]+MB[128|i&63]);continue}if(i<55296||i>=57344){w=w+(MB[224|i>>12]+MB[128|i>>6&63]+MB[128|i&63]);continue}D+=1,i=65536+((i&1023)<<10|E.charCodeAt(D)&1023),w+=MB[240|i>>18]+MB[128|i>>12&63]+MB[128|i>>6&63]+MB[128|i&63]}return w},iz=function(g){for(var I=[{obj:{o:g},prop:"o"}],B=[],C=0;C<I.length;++C)for(var Q=I[C],E=Q.obj[Q.prop],w=Object.keys(E),D=0;D<w.length;++D){var i=w[D],o=E[i];typeof o=="object"&&o!==null&&B.indexOf(o)===-1&&(I.push({obj:E,prop:i}),B.push(o))}return Iz(I),g},oz=function(g){return Object.prototype.toString.call(g)==="[object RegExp]"},Dz=function(g){return!g||typeof g!="object"?!1:!!(g.constructor&&g.constructor.isBuffer&&g.constructor.isBuffer(g))},wz=function(g,I){return[].concat(g,I)},sz=function(g,I){if(mC(g)){for(var B=[],C=0;C<g.length;C+=1)B.push(I(g[C]));return B}return I(g)},UF={arrayToObject:LF,assign:Cz,combine:wz,compact:iz,decode:Qz,encode:Ez,isBuffer:Dz,isRegExp:oz,maybeMap:sz,merge:Bz},nF=_X,Wo=UF,dE=Ss,yz=Object.prototype.hasOwnProperty,hF={brackets:function(g){return g+"[]"},comma:"comma",indices:function(g,I){return g+"["+I+"]"},repeat:function(g){return g}},KB=Array.isArray,az=Array.prototype.push,YF=function(A,g){az.apply(A,KB(g)?g:[g])},Gz=Date.prototype.toISOString,JF=dE.default,Xg={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Wo.encode,encodeValuesOnly:!1,format:JF,formatter:dE.formatters[JF],indices:!1,serializeDate:function(g){return Gz.call(g)},skipNulls:!1,strictNullHandling:!1},Nz=function(g){return typeof g=="string"||typeof g=="number"||typeof g=="boolean"||typeof g=="symbol"||typeof g=="bigint"},Us={},Rz=function A(g,I,B,C,Q,E,w,D,i,o,s,y,a,N,e,F,K,U){for(var M=g,r=U,S=0,c=!1;(r=r.get(Us))!==void 0&&!c;){var Y=r.get(g);if(S+=1,typeof Y<"u"){if(Y===S)throw new RangeError("Cyclic object value");c=!0}typeof r.get(Us)>"u"&&(S=0)}if(typeof o=="function"?M=o(I,M):M instanceof Date?M=a(M):B==="comma"&&KB(M)&&(M=Wo.maybeMap(M,function(_){return _ instanceof Date?a(_):_})),M===null){if(E)return i&&!F?i(I,Xg.encoder,K,"key",N):I;M=""}if(Nz(M)||Wo.isBuffer(M)){if(i){var h=F?I:i(I,Xg.encoder,K,"key",N);return[e(h)+"="+e(i(M,Xg.encoder,K,"value",N))]}return[e(I)+"="+e(String(M))]}var n=[];if(typeof M>"u")return n;var J;if(B==="comma"&&KB(M))F&&i&&(M=Wo.maybeMap(M,i)),J=[{value:M.length>0?M.join(",")||null:void 0}];else if(KB(o))J=o;else{var H=Object.keys(M);J=s?H.sort(s):H}var b=D?I.replace(/\./g,"%2E"):I,x=C&&KB(M)&&M.length===1?b+"[]":b;if(Q&&KB(M)&&M.length===0)return x+"[]";for(var f=0;f<J.length;++f){var m=J[f],d=typeof m=="object"&&typeof m.value<"u"?m.value:M[m];if(!(w&&d===null)){var l=y&&D?m.replace(/\./g,"%2E"):m,q=KB(M)?typeof B=="function"?B(x,l):x:x+(y?"."+l:"["+l+"]");U.set(g,S);var Z=nF();Z.set(Us,U),YF(n,A(d,q,B,C,Q,E,w,D,B==="comma"&&F&&KB(M)?null:i,o,s,y,a,N,e,F,K,Z))}}return n},ez=function(g){if(!g)return Xg;if(typeof g.allowEmptyArrays<"u"&&typeof g.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof g.encodeDotInKeys<"u"&&typeof g.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(g.encoder!==null&&typeof g.encoder<"u"&&typeof g.encoder!="function")throw new TypeError("Encoder has to be a function.");var I=g.charset||Xg.charset;if(typeof g.charset<"u"&&g.charset!=="utf-8"&&g.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var B=dE.default;if(typeof g.format<"u"){if(!yz.call(dE.formatters,g.format))throw new TypeError("Unknown format option provided.");B=g.format}var C=dE.formatters[B],Q=Xg.filter;(typeof g.filter=="function"||KB(g.filter))&&(Q=g.filter);var E;if(g.arrayFormat in hF?E=g.arrayFormat:"indices"in g?E=g.indices?"indices":"repeat":E=Xg.arrayFormat,"commaRoundTrip"in g&&typeof g.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var w=typeof g.allowDots>"u"?g.encodeDotInKeys===!0?!0:Xg.allowDots:!!g.allowDots;return{addQueryPrefix:typeof g.addQueryPrefix=="boolean"?g.addQueryPrefix:Xg.addQueryPrefix,allowDots:w,allowEmptyArrays:typeof g.allowEmptyArrays=="boolean"?!!g.allowEmptyArrays:Xg.allowEmptyArrays,arrayFormat:E,charset:I,charsetSentinel:typeof g.charsetSentinel=="boolean"?g.charsetSentinel:Xg.charsetSentinel,commaRoundTrip:g.commaRoundTrip,delimiter:typeof g.delimiter>"u"?Xg.delimiter:g.delimiter,encode:typeof g.encode=="boolean"?g.encode:Xg.encode,encodeDotInKeys:typeof g.encodeDotInKeys=="boolean"?g.encodeDotInKeys:Xg.encodeDotInKeys,encoder:typeof g.encoder=="function"?g.encoder:Xg.encoder,encodeValuesOnly:typeof g.encodeValuesOnly=="boolean"?g.encodeValuesOnly:Xg.encodeValuesOnly,filter:Q,format:B,formatter:C,serializeDate:typeof g.serializeDate=="function"?g.serializeDate:Xg.serializeDate,skipNulls:typeof g.skipNulls=="boolean"?g.skipNulls:Xg.skipNulls,sort:typeof g.sort=="function"?g.sort:null,strictNullHandling:typeof g.strictNullHandling=="boolean"?g.strictNullHandling:Xg.strictNullHandling}},tz=function(A,g){var I=A,B=ez(g),C,Q;typeof B.filter=="function"?(Q=B.filter,I=Q("",I)):KB(B.filter)&&(Q=B.filter,C=Q);var E=[];if(typeof I!="object"||I===null)return"";var w=hF[B.arrayFormat],D=w==="comma"&&B.commaRoundTrip;C||(C=Object.keys(I)),B.sort&&C.sort(B.sort);for(var i=nF(),o=0;o<C.length;++o){var s=C[o];B.skipNulls&&I[s]===null||YF(E,Rz(I[s],s,w,D,B.allowEmptyArrays,B.strictNullHandling,B.skipNulls,B.encodeDotInKeys,B.encode?B.encoder:null,B.filter,B.sort,B.allowDots,B.serializeDate,B.format,B.formatter,B.encodeValuesOnly,B.charset,i))}var y=E.join(B.delimiter),a=B.addQueryPrefix===!0?"?":"";return B.charsetSentinel&&(B.charset==="iso-8859-1"?a+="utf8=%26%2310003%3B&":a+="utf8=%E2%9C%93&"),y.length>0?a+y:""},fQ=UF,ns=Object.prototype.hasOwnProperty,Mz=Array.isArray,pg={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!0,decoder:fQ.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Kz=function(A){return A.replace(/&#(\d+);/g,function(g,I){return String.fromCharCode(parseInt(I,10))})},kF=function(A,g){return A&&typeof A=="string"&&g.comma&&A.indexOf(",")>-1?A.split(","):A},Fz="utf8=%26%2310003%3B",cz="utf8=%E2%9C%93",rz=function(g,I){var B={__proto__:null},C=I.ignoreQueryPrefix?g.replace(/^\?/,""):g,Q=I.parameterLimit===1/0?void 0:I.parameterLimit,E=C.split(I.delimiter,Q),w=-1,D,i=I.charset;if(I.charsetSentinel)for(D=0;D<E.length;++D)E[D].indexOf("utf8=")===0&&(E[D]===cz?i="utf-8":E[D]===Fz&&(i="iso-8859-1"),w=D,D=E.length);for(D=0;D<E.length;++D)if(D!==w){var o=E[D],s=o.indexOf("]="),y=s===-1?o.indexOf("="):s+1,a,N;y===-1?(a=I.decoder(o,pg.decoder,i,"key"),N=I.strictNullHandling?null:""):(a=I.decoder(o.slice(0,y),pg.decoder,i,"key"),N=fQ.maybeMap(kF(o.slice(y+1),I),function(F){return I.decoder(F,pg.decoder,i,"value")})),N&&I.interpretNumericEntities&&i==="iso-8859-1"&&(N=Kz(N)),o.indexOf("[]=")>-1&&(N=Mz(N)?[N]:N);var e=ns.call(B,a);e&&I.duplicates==="combine"?B[a]=fQ.combine(B[a],N):(!e||I.duplicates==="last")&&(B[a]=N)}return B},Sz=function(A,g,I,B){for(var C=B?g:kF(g,I),Q=A.length-1;Q>=0;--Q){var E,w=A[Q];if(w==="[]"&&I.parseArrays)E=I.allowEmptyArrays&&C===""?[]:[].concat(C);else{E=I.plainObjects?Object.create(null):{};var D=w.charAt(0)==="["&&w.charAt(w.length-1)==="]"?w.slice(1,-1):w,i=I.decodeDotInKeys?D.replace(/%2E/g,"."):D,o=parseInt(i,10);!I.parseArrays&&i===""?E={0:C}:!isNaN(o)&&w!==i&&String(o)===i&&o>=0&&I.parseArrays&&o<=I.arrayLimit?(E=[],E[o]=C):i!=="__proto__"&&(E[i]=C)}C=E}return C},Lz=function(g,I,B,C){if(g){var Q=B.allowDots?g.replace(/\.([^.[]+)/g,"[$1]"):g,E=/(\[[^[\]]*])/,w=/(\[[^[\]]*])/g,D=B.depth>0&&E.exec(Q),i=D?Q.slice(0,D.index):Q,o=[];if(i){if(!B.plainObjects&&ns.call(Object.prototype,i)&&!B.allowPrototypes)return;o.push(i)}for(var s=0;B.depth>0&&(D=w.exec(Q))!==null&&s<B.depth;){if(s+=1,!B.plainObjects&&ns.call(Object.prototype,D[1].slice(1,-1))&&!B.allowPrototypes)return;o.push(D[1])}return D&&o.push("["+Q.slice(D.index)+"]"),Sz(o,I,B,C)}},Uz=function(g){if(!g)return pg;if(typeof g.allowEmptyArrays<"u"&&typeof g.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof g.decodeDotInKeys<"u"&&typeof g.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(g.decoder!==null&&typeof g.decoder<"u"&&typeof g.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof g.charset<"u"&&g.charset!=="utf-8"&&g.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var I=typeof g.charset>"u"?pg.charset:g.charset,B=typeof g.duplicates>"u"?pg.duplicates:g.duplicates;if(B!=="combine"&&B!=="first"&&B!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var C=typeof g.allowDots>"u"?g.decodeDotInKeys===!0?!0:pg.allowDots:!!g.allowDots;return{allowDots:C,allowEmptyArrays:typeof g.allowEmptyArrays=="boolean"?!!g.allowEmptyArrays:pg.allowEmptyArrays,allowPrototypes:typeof g.allowPrototypes=="boolean"?g.allowPrototypes:pg.allowPrototypes,allowSparse:typeof g.allowSparse=="boolean"?g.allowSparse:pg.allowSparse,arrayLimit:typeof g.arrayLimit=="number"?g.arrayLimit:pg.arrayLimit,charset:I,charsetSentinel:typeof g.charsetSentinel=="boolean"?g.charsetSentinel:pg.charsetSentinel,comma:typeof g.comma=="boolean"?g.comma:pg.comma,decodeDotInKeys:typeof g.decodeDotInKeys=="boolean"?g.decodeDotInKeys:pg.decodeDotInKeys,decoder:typeof g.decoder=="function"?g.decoder:pg.decoder,delimiter:typeof g.delimiter=="string"||fQ.isRegExp(g.delimiter)?g.delimiter:pg.delimiter,depth:typeof g.depth=="number"||g.depth===!1?+g.depth:pg.depth,duplicates:B,ignoreQueryPrefix:g.ignoreQueryPrefix===!0,interpretNumericEntities:typeof g.interpretNumericEntities=="boolean"?g.interpretNumericEntities:pg.interpretNumericEntities,parameterLimit:typeof g.parameterLimit=="number"?g.parameterLimit:pg.parameterLimit,parseArrays:g.parseArrays!==!1,plainObjects:typeof g.plainObjects=="boolean"?g.plainObjects:pg.plainObjects,strictNullHandling:typeof g.strictNullHandling=="boolean"?g.strictNullHandling:pg.strictNullHandling}},nz=function(A,g){var I=Uz(g);if(A===""||A===null||typeof A>"u")return I.plainObjects?Object.create(null):{};for(var B=typeof A=="string"?rz(A,I):A,C=I.plainObjects?Object.create(null):{},Q=Object.keys(B),E=0;E<Q.length;++E){var w=Q[E],D=Lz(w,B[w],I,typeof A=="string");C=fQ.merge(C,D,I)}return I.allowSparse===!0?C:fQ.compact(C)},hz=tz,Yz=nz,Jz=Ss,kz={formats:Jz,parse:Yz,stringify:hz},lz=R1;function qI(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Hz=/^([a-z0-9.+-]+:)/i,dz=/:[0-9]*$/,bz=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,uz=["<",">",'"',"`"," ","\r",`
@@ -104,5 +104,5 @@ return ret;
104
104
  `,X+=k[nA].argPackAdvance;var bA=L===1?"new func":"func.call";V+=` var rv = ${bA}(${AA.join(", ")});
105
105
  `,W.isVoid||(DA.push("emval_returnValue"),SA.push(XP),V+=` return emval_returnValue(retType, destructorsRef, rv);
106
106
  `),V+=`};
107
- `,DA.push(V);var uA=wc(Function,DA)(...SA),ZA=`methodCaller<(${k.map(OA=>OA.name).join(", ")}) => ${W.name}>`;return TP(XQ(ZA,uA))},PP=R=>{R>9&&(TB[R+1]+=1)},_P=R=>{R=TI.toValue(R);for(var t=new Array(R.length),L=0;L<R.length;L++)t[L]=R[L];return TI.toHandle(t)},$P=R=>{var t=TI.toValue(R);oc(t),Ts(R)},A5=(R,t)=>{R=js(R,"_emval_take_value");var L=R.readValueFromPointer(t);return TI.toHandle(L)},zs=(R,t)=>t+2097152>>>0<4194305-!!R?(R>>>0)+t*4294967296:NaN;function g5(R,t,L){var k=zs(R,t),W=new Date(k*1e3);f[L>>2]=W.getUTCSeconds(),f[L+4>>2]=W.getUTCMinutes(),f[L+8>>2]=W.getUTCHours(),f[L+12>>2]=W.getUTCDate(),f[L+16>>2]=W.getUTCMonth(),f[L+20>>2]=W.getUTCFullYear()-1900,f[L+24>>2]=W.getUTCDay();var V=Date.UTC(W.getUTCFullYear(),0,1,0,0,0,0),X=(W.getTime()-V)/(1e3*60*60*24)|0;f[L+28>>2]=X}var I5=R=>R%4===0&&(R%100!==0||R%400===0),B5=[0,31,60,91,121,152,182,213,244,274,305,335],C5=[0,31,59,90,120,151,181,212,243,273,304,334],Nc=R=>{var t=I5(R.getFullYear()),L=t?B5:C5,k=L[R.getMonth()]+R.getDate()-1;return k};function Q5(R,t,L){var k=zs(R,t),W=new Date(k*1e3);f[L>>2]=W.getSeconds(),f[L+4>>2]=W.getMinutes(),f[L+8>>2]=W.getHours(),f[L+12>>2]=W.getDate(),f[L+16>>2]=W.getMonth(),f[L+20>>2]=W.getFullYear()-1900,f[L+24>>2]=W.getDay();var V=Nc(W)|0;f[L+28>>2]=V,f[L+36>>2]=-(W.getTimezoneOffset()*60);var X=new Date(W.getFullYear(),0,1),AA=new Date(W.getFullYear(),6,1).getTimezoneOffset(),DA=X.getTimezoneOffset(),SA=(AA!=DA&&W.getTimezoneOffset()==Math.min(DA,AA))|0;f[L+32>>2]=SA}var E5=R=>ec(R),i5=function(R){var t=(()=>{var L=new Date(f[R+20>>2]+1900,f[R+16>>2],f[R+12>>2],f[R+8>>2],f[R+4>>2],f[R>>2],0),k=f[R+32>>2],W=L.getTimezoneOffset(),V=new Date(L.getFullYear(),0,1),X=new Date(L.getFullYear(),6,1).getTimezoneOffset(),AA=V.getTimezoneOffset(),DA=Math.min(AA,X);if(k<0)f[R+32>>2]=+(X!=AA&&DA==W);else if(k>0!=(DA==W)){var SA=Math.max(AA,X),nA=k>0?DA:SA;L.setTime(L.getTime()+(nA-W)*6e4)}f[R+24>>2]=L.getDay();var bA=Nc(L)|0;f[R+28>>2]=bA,f[R>>2]=L.getSeconds(),f[R+4>>2]=L.getMinutes(),f[R+8>>2]=L.getHours(),f[R+12>>2]=L.getDate(),f[R+16>>2]=L.getMonth(),f[R+20>>2]=L.getYear();var uA=L.getTime();return isNaN(uA)?-1:uA/1e3})();return E5((j=t,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),t>>>0},o5=(R,t,L,k)=>{var W=new Date().getFullYear(),V=new Date(W,0,1),X=new Date(W,6,1),AA=V.getTimezoneOffset(),DA=X.getTimezoneOffset(),SA=Math.max(AA,DA);m[R>>2]=SA*60,f[t>>2]=+(AA!=DA);var nA=ZA=>ZA.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1],bA=nA(V),uA=nA(X);DA<AA?(VB(bA,L,17),VB(uA,k,17)):(VB(bA,k,17),VB(uA,L,17))},Ps=[],D5=(R,t)=>{Ps.length=0;for(var L;L=H[R++];){var k=L!=105;k&=L!=112,t+=k&&t%8?4:0,Ps.push(L==112?m[t>>2]:L==105?f[t>>2]:l[t>>3]),t+=k?8:4}return Ps},w5=(R,t,L)=>{var k=D5(t,L);return tA[R](...k)},s5=(R,t,L)=>w5(R,t,L),y5=()=>Date.now(),a5=()=>2147483648,G5=R=>{var t=Y.buffer,L=(R-t.byteLength+65535)/65536;try{return Y.grow(L),q(),1}catch{}},N5=R=>{var t=H.length;R>>>=0;var L=a5();if(R>L)return!1;for(var k=(DA,SA)=>DA+(SA-DA%SA)%SA,W=1;W<=4;W*=2){var V=t*(1+.2/W);V=Math.min(V,R+100663296);var X=Math.min(L,k(Math.max(R,V),65536)),AA=G5(X);if(AA)return!0}return!1},_s={},R5=()=>y||"./this.program",XE=()=>{if(!XE.strings){var R=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:R,_:R5()};for(var L in _s)_s[L]===void 0?delete t[L]:t[L]=_s[L];var k=[];for(var L in t)k.push(`${L}=${t[L]}`);XE.strings=k}return XE.strings},e5=(R,t)=>{for(var L=0;L<R.length;++L)J[t++]=R.charCodeAt(L);J[t]=0},t5=(R,t)=>{var L=0;return XE().forEach((k,W)=>{var V=t+L;m[R+W*4>>2]=V,e5(k,V),L+=k.length+1}),0},M5=(R,t)=>{var L=XE();m[R>>2]=L.length;var k=0;return L.forEach(W=>k+=W.length+1),m[t>>2]=k,0};function K5(R){try{var t=xA.getStreamFromFD(R);return p.close(t),0}catch(L){if(typeof p>"u"||L.name!=="ErrnoError")throw L;return L.errno}}var F5=(R,t,L,k)=>{for(var W=0,V=0;V<L;V++){var X=m[t>>2],AA=m[t+4>>2];t+=8;var DA=p.read(R,J,X,AA,k);if(DA<0)return-1;if(W+=DA,DA<AA)break;typeof k<"u"&&(k+=DA)}return W};function c5(R,t,L,k){try{var W=xA.getStreamFromFD(R),V=F5(W,t,L);return m[k>>2]=V,0}catch(X){if(typeof p>"u"||X.name!=="ErrnoError")throw X;return X.errno}}function r5(R,t,L,k,W){var V=zs(t,L);try{if(isNaN(V))return 61;var X=xA.getStreamFromFD(R);return p.llseek(X,V,k),oA=[X.position>>>0,(j=X.position,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],f[W>>2]=oA[0],f[W+4>>2]=oA[1],X.getdents&&V===0&&k===0&&(X.getdents=null),0}catch(AA){if(typeof p>"u"||AA.name!=="ErrnoError")throw AA;return AA.errno}}var S5=(R,t,L,k)=>{for(var W=0,V=0;V<L;V++){var X=m[t>>2],AA=m[t+4>>2];t+=8;var DA=p.write(R,J,X,AA,k);if(DA<0)return-1;W+=DA,typeof k<"u"&&(k+=DA)}return W};function L5(R,t,L,k){try{var W=xA.getStreamFromFD(R),V=S5(W,t,L);return m[k>>2]=V,0}catch(X){if(typeof p>"u"||X.name!=="ErrnoError")throw X;return X.errno}}p.createPreloadedFile=fE,p.staticInit(),x9(),jQ=B.BindingError=class extends Error{constructor(t){super(t),this.name="BindingError"}},_F=B.InternalError=class extends Error{constructor(t){super(t),this.name="InternalError"}},AP(),z9(),oP(),Ec=B.UnboundTypeError=yP(Error,"UnboundTypeError"),MP();var U5={e:Cg,b:Sg,S:Yg,N:fC,O:tg,M:RI,m:WC,Z:U9,K:n9,J:h9,$:Y9,I:J9,aa:k9,V:l9,P:H9,H:d9,T:b9,G:u9,F:m9,R:Z9,U:p9,da:f9,E:W9,fa:V9,d:aP,ja:NP,g:RP,a:eP,ea:sc,p:cP,h:rP,y:LP,n:UP,o:hP,k:YP,l:JP,i:kP,x:lP,t:pP,ga:fP,L:WP,ca:xP,z:vP,ha:qP,c:Ts,ia:OP,v:zP,j:PP,s:_P,u:$P,f:A5,A:g5,B:Q5,C:i5,W:o5,q:s5,ba:y5,Q:N5,X:t5,Y:M5,r:K5,_:c5,D:r5,w:L5},zg=$(),Rc=R=>(Rc=zg.ma)(R),$s=B._malloc=R=>($s=B._malloc=zg.oa)(R),jB=B._free=R=>(jB=B._free=zg.pa)(R),AD=R=>(AD=zg.qa)(R),Ay=R=>(Ay=zg.ra)(R),ec=R=>(ec=zg.sa)(R),tc=R=>(tc=zg.ta)(R);B.dynCall_iiiji=(R,t,L,k,W,V)=>(B.dynCall_iiiji=zg.ua)(R,t,L,k,W,V),B.dynCall_jii=(R,t,L)=>(B.dynCall_jii=zg.va)(R,t,L),B.dynCall_jiji=(R,t,L,k,W)=>(B.dynCall_jiji=zg.wa)(R,t,L,k,W),B.dynCall_viijii=(R,t,L,k,W,V,X)=>(B.dynCall_viijii=zg.xa)(R,t,L,k,W,V,X),B.dynCall_iiiiij=(R,t,L,k,W,V,X)=>(B.dynCall_iiiiij=zg.ya)(R,t,L,k,W,V,X),B.dynCall_iiiiijj=(R,t,L,k,W,V,X,AA,DA)=>(B.dynCall_iiiiijj=zg.za)(R,t,L,k,W,V,X,AA,DA),B.dynCall_iiiiiijj=(R,t,L,k,W,V,X,AA,DA,SA)=>(B.dynCall_iiiiiijj=zg.Aa)(R,t,L,k,W,V,X,AA,DA,SA);var gD;yA=function R(){gD||Mc(),gD||(yA=R)};function Mc(){if(GA>0||(z(),GA>0))return;function R(){var t;gD||(gD=!0,B.calledRun=!0,!h&&(v(),C(B),(t=B.onRuntimeInitialized)==null||t.call(B),iA()))}B.setStatus?(B.setStatus("Running..."),setTimeout(function(){setTimeout(function(){B.setStatus("")},1),R()},1)):R()}if(B.preInit)for(typeof B.preInit=="function"&&(B.preInit=[B.preInit]);B.preInit.length>0;)B.preInit.pop()();return Mc(),I=E,I}})();const I9="libOpenCOR",B9="oSPARC",vo="https://models.physiomeproject.org/",C9=gs(mK,{}),Q9={LIBOPENCOR_SOLVER:I9,OSPARC_SOLVER:B9,name:"SimulationVuer",components:{PlotVuer:Fc.PlotVuer,SimulationVuerInput:xK,ElButton:SG,ElDivider:YG,ElLoading:mk},props:{apiLocation:{required:!0,type:String},id:{required:!0}},data:function(){if(this.id>0){const A=new XMLHttpRequest;A.open("GET",this.apiLocation+"/sim/dataset/"+this.id),A.onreadystatechange=()=>{if(A.readyState===4&&A.status===200){const g=JSON.parse(A.responseText);this.name=g.name,this.uuid=g.study!==void 0?g.study.uuid:void 0}},A.send()}return{errorMessage:"",fileManager:void 0,hasFinalisedUi:!1,hasValidSimulationUiInfo:!1,instance:void 0,isMounted:!1,isSimulationValid:!0,layout:[],libopencor:void 0,name:null,opencorBasedSimulation:!0,output:void 0,perfectScollbarOptions:{suppressScrollX:!0},showUserMessage:!1,simulationResults:{},simulationResultsId:{},simulationUiInfo:{},solver:void 0,userMessage:"",ui:null,uuid:null}},methods:{plotMetadata(A){return{version:"1.1.0",type:"plot",attrs:{style:"timeseries",layout:this.layout[A]}}},downloadPmrFile(A){return new Promise((g,I)=>{const B=new XMLHttpRequest;B.open("POST",this.apiLocation+"/pmr_file"),B.setRequestHeader("Content-type","application/json"),B.onreadystatechange=()=>{B.readyState===4&&(B.status===200&&g(Uint8Array.from(atob(B.response),C=>C.charCodeAt(0))),I())},B.send(JSON.stringify({path:A.replace(vo,"")}))})},manageFile(A,g){let I=G.toRaw(this.fileManager).file(A);I===null&&(I=new this.libopencor.File(A));const B=this.libopencor._malloc(g.length);return new Uint8Array(this.libopencor.HEAPU8.buffer,B,g.length).set(g),I.setContents(B,g.length),this.libopencor._free(B),I},runSimulation(){if(this.instance===void 0){const B=new this.libopencor.SedDocument(G.toRaw(this.fileManager).file(vo+this.id));this.instance=B.instantiate(),B.delete()}const A=G.toRaw(this.instance);A.removeAllInitialConditions();for(const[B,C]of Object.entries(this.parametersData()))A.addInitialCondition(B,C);A.run();const g={},I=A.tasks().get(0);for(const B of this.outputData()){if(B===I.voiName()&&(g[B]=I.voiAsArray()),g[B]===void 0){for(let C=0;C<I.stateCount();++C)if(B===I.stateName(C)){g[B]=I.stateAsArray(C);break}}if(g[B]===void 0){for(let C=0;I.variableCount();++C)if(B===I.variableName(C)){g[B]=I.variableAsArray(C);break}}}this.processSimulationResults(g),this.showUserMessage=!1},buildSimulationUi(A){if(this.simulationUiInfo=A,this.hasValidSimulationUiInfo=A9(this.simulationUiInfo,this.libopencor===void 0),!this.hasValidSimulationUiInfo)return;if(this.libopencor===void 0){if(this.simulationUiInfo.simulation.solvers.forEach(I=>{(I.if===void 0||Is(this,I.if))&&(this.solver=I)}),this.solver===void 0){console.warn("SIMULATION: no solver name and/or solver version specified.");return}this.opencorBasedSimulation=this.solver.name===ZK}this.libopencor!==void 0&&(this.userMessage="Running the model...",this.showUserMessage=!0,this.$nextTick(()=>{this.runSimulation()})),this.simulationUiInfo.output.data.forEach(I=>{this.simulationResultsId[I.id]=I.name});let g=-1;this.simulationUiInfo.output.plots.forEach(I=>{++g,this.layout[g]={paper_bgcolor:"rgba(0, 0, 0, 0)",plot_bgcolor:"rgba(0, 0, 0, 0)",autosize:!0,margin:{t:25,l:55,r:25,b:30,pad:4},loading:!1,options:{responsive:!0,scrollZoom:!0},dragmode:"pan",xaxis:{title:{text:I.xAxisTitle,font:{size:10}}},yaxis:{title:{text:I.yAxisTitle,font:{size:10}}}}}),this.$nextTick(()=>{fK(this)})},runOnOsparc(){window.open(`https://osparc.io/study/${this.uuid}`,"_blank")},viewDataset(){window.open(`https://sparc.science/datasets/${this.id}?type=dataset`,"_blank")},viewWorkspace(){const A=vo+this.id;window.open(A.substring(0,A.lastIndexOf("/")),"_blank")},parametersData(){const A={};return this.simulationUiInfo.parameters.forEach(g=>{A[g.name]=Is(this,g.value)}),A},outputData(){return this.output===void 0&&this.simulationUiInfo.output.data!==void 0&&(this.output=[],this.simulationUiInfo.output.data.forEach(A=>{this.output.push(A.name)})),this.output},retrieveRequest(){const A={solver:this.solver};if(this.opencorBasedSimulation){A.opencor={model_url:this.simulationUiInfo.simulation.opencor.resource,json_config:{}},this.simulationUiInfo.simulation.opencor.endingPoint!==void 0&&this.simulationUiInfo.simulation.opencor.pointInterval!==void 0&&(A.opencor.json_config.simulation={"Ending point":this.simulationUiInfo.simulation.opencor.endingPoint,"Point interval":this.simulationUiInfo.simulation.opencor.pointInterval}),A.opencor.json_config.parameters=this.parametersData();const g=this.outputData();g!==void 0&&(A.opencor.json_config.output=g)}else A.osparc={},A.osparc.job_inputs=this.parametersData();return A},processSimulationResults(A){if(typeof A=="string"){const B=/[ \t]+/g,C=A.trim().split(`
108
- `),Q=C[0].trim().split(B).length;A={};for(let w=0;w<Q;++w)A[w]=[];let E=-1;C.forEach(w=>{++E;let D=-1;w.trim().split(B).forEach(o=>{A[++D][E]=Number(o)})})}const g=new C9.parser;Object.keys(this.simulationResultsId).forEach(B=>{g.set(B,A[this.simulationResultsId[B]])});let I=-1;this.simulationUiInfo.output.plots.forEach(B=>{this.simulationResults[++I]=[{x:g.evaluate(B.xValue),y:g.evaluate(B.yValue),type:"scatter"}]})},showHttpIssue(A){this.isSimulationValid=!1,this.showUserMessage=!1,this.errorMessage=A.statusText.toLowerCase()+" (<a href='https://httpstatuses.com/"+A.status+"/' target='_blank'>"+A.status+"</a>)"},checkSimulation(A){const g=new XMLHttpRequest;g.open("POST",this.apiLocation+"/check_simulation"),g.setRequestHeader("Content-type","application/json"),g.onreadystatechange=()=>{if(g.readyState===4)if(g.status===200){let I=JSON.parse(g.responseText);if(this.isSimulationValid=I.status==="ok",this.isSimulationValid)if(I.results!==void 0)this.showUserMessage=!1,this.processSimulationResults(I.results);else{let B=this;setTimeout(function(){B.checkSimulation(A)},1e3)}else this.showUserMessage=!1,this.errorMessage=I.description}else this.showHttpIssue(g)},g.send(JSON.stringify(A))},startSimulation(){this.userMessage="Loading simulation results...",this.showUserMessage=!0,this.$nextTick(()=>{this.simulationResults={};const A=new XMLHttpRequest;A.open("POST",this.apiLocation+"/start_simulation"),A.setRequestHeader("Content-type","application/json"),A.onreadystatechange=()=>{if(A.readyState===4)if(A.status===200){let g=JSON.parse(A.responseText);this.isSimulationValid=g.status==="ok",this.isSimulationValid?this.checkSimulation(g.data):(this.showUserMessage=!1,this.errorMessage=g.description+"ASDASDASD")}else this.showHttpIssue(A)},A.send(JSON.stringify(this.retrieveRequest()))})}},created:function(){this.id>0?(this.userMessage="Retrieving UI information...",this.showUserMessage=!0,this.$nextTick(()=>{const A=new XMLHttpRequest;A.open("GET",this.apiLocation+"/simulation_ui_file/"+this.id),A.onreadystatechange=()=>{A.readyState===4&&(this.showUserMessage=!1,A.status===200&&this.$nextTick(()=>{this.buildSimulationUi(JSON.parse(A.responseText))}))},A.send()})):this.id!==0&&(this.userMessage="Retrieving COMBINE archive from PMR...",this.showUserMessage=!0,this.$nextTick(()=>{const A=new XMLHttpRequest;A.open("POST",this.apiLocation+"/pmr_file"),A.setRequestHeader("Content-type","application/json"),A.onreadystatechange=()=>{A.readyState===4&&(A.status===200?g9().then(g=>{this.libopencor=g,this.fileManager=this.libopencor.FileManager.instance();const I=Uint8Array.from(atob(A.response),E=>E.charCodeAt(0)),B=this.manageFile(vo+this.id,I),C=new TextDecoder,Q=JSON.parse(C.decode(B.childFile("simulation.json").contents()));this.showUserMessage=!1,this.$nextTick(()=>{this.buildSimulationUi(Q)})}):this.showUserMessage=!1)},A.send(JSON.stringify({path:this.id}))}))},mounted:function(){this.isMounted=!0,fK(this)}},Zs=A=>(G.pushScopeId("data-v-6da5ee45"),A=A(),G.popScopeId(),A),E9=["element-loading-text"],i9={key:0,class:"default error"},o9=Zs(()=>G.createElementVNode("span",{class:"error"},"Error:",-1)),D9={key:1,class:"main"},w9={class:"main-left"},s9={key:0,class:"default name"},y9=Zs(()=>G.createElementVNode("p",{class:"default input-parameters"},"Input parameters",-1)),a9={class:"input scrollbar"},G9={class:"primary-button"},N9={key:2,class:"secondary-button"},R9={class:"secondary-button"},e9={class:"secondary-button"},t9={key:3,class:"default note"},M9={class:"main-right",ref:"output"},K9={class:"main-right"},F9={class:"default error"},c9=Zs(()=>G.createElementVNode("span",{class:"error"},"Error:",-1)),r9=["innerHTML"];function S9(A,g,I,B,C,Q){const E=YG,w=xK,D=SG,i=G.resolveComponent("PlotVuer"),o=Aw;return G.withDirectives((G.openBlock(),G.createElementBlock("div",{class:"simulation-vuer","element-loading-text":A.userMessage},[!A.hasValidSimulationUiInfo&&!A.showUserMessage?(G.openBlock(),G.createElementBlock("p",i9,[o9,G.createTextVNode(" an unknown or invalid model was provided.")])):G.createCommentVNode("",!0),A.hasValidSimulationUiInfo?(G.openBlock(),G.createElementBlock("div",D9,[G.createElementVNode("div",w9,[A.libopencor===void 0?(G.openBlock(),G.createElementBlock("p",s9,G.toDisplayString(A.name),1)):G.createCommentVNode("",!0),A.libopencor===void 0?(G.openBlock(),G.createBlock(E,{key:1})):G.createCommentVNode("",!0),y9,G.createElementVNode("div",a9,[(G.openBlock(!0),G.createElementBlock(G.Fragment,null,G.renderList(A.simulationUiInfo.input,(s,y)=>(G.openBlock(),G.createBlock(w,{ref_for:!0,ref:"simInput",defaultValue:s.defaultValue,key:`input-${y}`,name:s.name,maximumValue:s.maximumValue,minimumValue:s.minimumValue,possibleValues:s.possibleValues,stepValue:s.stepValue},null,8,["defaultValue","name","maximumValue","minimumValue","possibleValues","stepValue"]))),128))]),G.createElementVNode("div",G9,[A.libopencor===void 0?(G.openBlock(),G.createBlock(D,{key:0,type:"primary",size:"small",onClick:g[0]||(g[0]=s=>Q.startSimulation())},{default:G.withCtx(()=>[G.createTextVNode("Run Simulation")]),_:1})):G.createCommentVNode("",!0)]),A.uuid?(G.openBlock(),G.createElementBlock("div",N9,[G.createVNode(D,{size:"small",onClick:g[1]||(g[1]=s=>Q.runOnOsparc())},{default:G.withCtx(()=>[G.createTextVNode("Run on oSPARC")]),_:1})])):G.createCommentVNode("",!0),G.createElementVNode("div",R9,[A.libopencor===void 0?(G.openBlock(),G.createBlock(D,{key:0,size:"small",onClick:g[2]||(g[2]=s=>Q.viewDataset())},{default:G.withCtx(()=>[G.createTextVNode("View Dataset")]),_:1})):G.createCommentVNode("",!0)]),G.createElementVNode("div",e9,[A.libopencor!==void 0?(G.openBlock(),G.createBlock(D,{key:0,size:"small",onClick:g[3]||(g[3]=s=>Q.viewWorkspace())},{default:G.withCtx(()=>[G.createTextVNode("View Workspace")]),_:1})):G.createCommentVNode("",!0)]),A.uuid?(G.openBlock(),G.createElementBlock("p",t9,"Additional parameters are available on oSPARC")):G.createCommentVNode("",!0)]),G.withDirectives(G.createElementVNode("div",M9,[(G.openBlock(!0),G.createElementBlock(G.Fragment,null,G.renderList(A.simulationUiInfo.output.plots,(s,y)=>(G.openBlock(),G.createBlock(i,{key:`output-${y}`,metadata:Q.plotMetadata(y),"data-source":{data:A.simulationResults[y]},plotLayout:A.layout[y],plotType:"plotly-only",selectorUi:!1},null,8,["metadata","data-source","plotLayout"]))),128))],512),[[G.vShow,A.isSimulationValid]]),G.withDirectives(G.createElementVNode("div",K9,[G.createElementVNode("p",F9,[c9,G.createTextVNode(),G.createElementVNode("span",{innerHTML:A.errorMessage},null,8,r9),G.createTextVNode(".")])],512),[[G.vShow,!A.isSimulationValid]])])):G.createCommentVNode("",!0)],8,E9)),[[o,A.showUserMessage]])}const L9=WK(Q9,[["render",S9],["__scopeId","data-v-6da5ee45"]]);DI.SimulationVuer=L9,Object.defineProperty(DI,Symbol.toStringTag,{value:"Module"})});
107
+ `,DA.push(V);var uA=wc(Function,DA)(...SA),ZA=`methodCaller<(${k.map(OA=>OA.name).join(", ")}) => ${W.name}>`;return TP(XQ(ZA,uA))},PP=R=>{R>9&&(TB[R+1]+=1)},_P=R=>{R=TI.toValue(R);for(var t=new Array(R.length),L=0;L<R.length;L++)t[L]=R[L];return TI.toHandle(t)},$P=R=>{var t=TI.toValue(R);oc(t),Ts(R)},A5=(R,t)=>{R=js(R,"_emval_take_value");var L=R.readValueFromPointer(t);return TI.toHandle(L)},zs=(R,t)=>t+2097152>>>0<4194305-!!R?(R>>>0)+t*4294967296:NaN;function g5(R,t,L){var k=zs(R,t),W=new Date(k*1e3);f[L>>2]=W.getUTCSeconds(),f[L+4>>2]=W.getUTCMinutes(),f[L+8>>2]=W.getUTCHours(),f[L+12>>2]=W.getUTCDate(),f[L+16>>2]=W.getUTCMonth(),f[L+20>>2]=W.getUTCFullYear()-1900,f[L+24>>2]=W.getUTCDay();var V=Date.UTC(W.getUTCFullYear(),0,1,0,0,0,0),X=(W.getTime()-V)/(1e3*60*60*24)|0;f[L+28>>2]=X}var I5=R=>R%4===0&&(R%100!==0||R%400===0),B5=[0,31,60,91,121,152,182,213,244,274,305,335],C5=[0,31,59,90,120,151,181,212,243,273,304,334],Nc=R=>{var t=I5(R.getFullYear()),L=t?B5:C5,k=L[R.getMonth()]+R.getDate()-1;return k};function Q5(R,t,L){var k=zs(R,t),W=new Date(k*1e3);f[L>>2]=W.getSeconds(),f[L+4>>2]=W.getMinutes(),f[L+8>>2]=W.getHours(),f[L+12>>2]=W.getDate(),f[L+16>>2]=W.getMonth(),f[L+20>>2]=W.getFullYear()-1900,f[L+24>>2]=W.getDay();var V=Nc(W)|0;f[L+28>>2]=V,f[L+36>>2]=-(W.getTimezoneOffset()*60);var X=new Date(W.getFullYear(),0,1),AA=new Date(W.getFullYear(),6,1).getTimezoneOffset(),DA=X.getTimezoneOffset(),SA=(AA!=DA&&W.getTimezoneOffset()==Math.min(DA,AA))|0;f[L+32>>2]=SA}var E5=R=>ec(R),i5=function(R){var t=(()=>{var L=new Date(f[R+20>>2]+1900,f[R+16>>2],f[R+12>>2],f[R+8>>2],f[R+4>>2],f[R>>2],0),k=f[R+32>>2],W=L.getTimezoneOffset(),V=new Date(L.getFullYear(),0,1),X=new Date(L.getFullYear(),6,1).getTimezoneOffset(),AA=V.getTimezoneOffset(),DA=Math.min(AA,X);if(k<0)f[R+32>>2]=+(X!=AA&&DA==W);else if(k>0!=(DA==W)){var SA=Math.max(AA,X),nA=k>0?DA:SA;L.setTime(L.getTime()+(nA-W)*6e4)}f[R+24>>2]=L.getDay();var bA=Nc(L)|0;f[R+28>>2]=bA,f[R>>2]=L.getSeconds(),f[R+4>>2]=L.getMinutes(),f[R+8>>2]=L.getHours(),f[R+12>>2]=L.getDate(),f[R+16>>2]=L.getMonth(),f[R+20>>2]=L.getYear();var uA=L.getTime();return isNaN(uA)?-1:uA/1e3})();return E5((j=t,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),t>>>0},o5=(R,t,L,k)=>{var W=new Date().getFullYear(),V=new Date(W,0,1),X=new Date(W,6,1),AA=V.getTimezoneOffset(),DA=X.getTimezoneOffset(),SA=Math.max(AA,DA);m[R>>2]=SA*60,f[t>>2]=+(AA!=DA);var nA=ZA=>ZA.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1],bA=nA(V),uA=nA(X);DA<AA?(VB(bA,L,17),VB(uA,k,17)):(VB(bA,k,17),VB(uA,L,17))},Ps=[],D5=(R,t)=>{Ps.length=0;for(var L;L=H[R++];){var k=L!=105;k&=L!=112,t+=k&&t%8?4:0,Ps.push(L==112?m[t>>2]:L==105?f[t>>2]:l[t>>3]),t+=k?8:4}return Ps},w5=(R,t,L)=>{var k=D5(t,L);return tA[R](...k)},s5=(R,t,L)=>w5(R,t,L),y5=()=>Date.now(),a5=()=>2147483648,G5=R=>{var t=Y.buffer,L=(R-t.byteLength+65535)/65536;try{return Y.grow(L),q(),1}catch{}},N5=R=>{var t=H.length;R>>>=0;var L=a5();if(R>L)return!1;for(var k=(DA,SA)=>DA+(SA-DA%SA)%SA,W=1;W<=4;W*=2){var V=t*(1+.2/W);V=Math.min(V,R+100663296);var X=Math.min(L,k(Math.max(R,V),65536)),AA=G5(X);if(AA)return!0}return!1},_s={},R5=()=>y||"./this.program",XE=()=>{if(!XE.strings){var R=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:R,_:R5()};for(var L in _s)_s[L]===void 0?delete t[L]:t[L]=_s[L];var k=[];for(var L in t)k.push(`${L}=${t[L]}`);XE.strings=k}return XE.strings},e5=(R,t)=>{for(var L=0;L<R.length;++L)J[t++]=R.charCodeAt(L);J[t]=0},t5=(R,t)=>{var L=0;return XE().forEach((k,W)=>{var V=t+L;m[R+W*4>>2]=V,e5(k,V),L+=k.length+1}),0},M5=(R,t)=>{var L=XE();m[R>>2]=L.length;var k=0;return L.forEach(W=>k+=W.length+1),m[t>>2]=k,0};function K5(R){try{var t=xA.getStreamFromFD(R);return p.close(t),0}catch(L){if(typeof p>"u"||L.name!=="ErrnoError")throw L;return L.errno}}var F5=(R,t,L,k)=>{for(var W=0,V=0;V<L;V++){var X=m[t>>2],AA=m[t+4>>2];t+=8;var DA=p.read(R,J,X,AA,k);if(DA<0)return-1;if(W+=DA,DA<AA)break;typeof k<"u"&&(k+=DA)}return W};function c5(R,t,L,k){try{var W=xA.getStreamFromFD(R),V=F5(W,t,L);return m[k>>2]=V,0}catch(X){if(typeof p>"u"||X.name!=="ErrnoError")throw X;return X.errno}}function r5(R,t,L,k,W){var V=zs(t,L);try{if(isNaN(V))return 61;var X=xA.getStreamFromFD(R);return p.llseek(X,V,k),oA=[X.position>>>0,(j=X.position,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],f[W>>2]=oA[0],f[W+4>>2]=oA[1],X.getdents&&V===0&&k===0&&(X.getdents=null),0}catch(AA){if(typeof p>"u"||AA.name!=="ErrnoError")throw AA;return AA.errno}}var S5=(R,t,L,k)=>{for(var W=0,V=0;V<L;V++){var X=m[t>>2],AA=m[t+4>>2];t+=8;var DA=p.write(R,J,X,AA,k);if(DA<0)return-1;W+=DA,typeof k<"u"&&(k+=DA)}return W};function L5(R,t,L,k){try{var W=xA.getStreamFromFD(R),V=S5(W,t,L);return m[k>>2]=V,0}catch(X){if(typeof p>"u"||X.name!=="ErrnoError")throw X;return X.errno}}p.createPreloadedFile=fE,p.staticInit(),x9(),jQ=B.BindingError=class extends Error{constructor(t){super(t),this.name="BindingError"}},_F=B.InternalError=class extends Error{constructor(t){super(t),this.name="InternalError"}},AP(),z9(),oP(),Ec=B.UnboundTypeError=yP(Error,"UnboundTypeError"),MP();var U5={e:Cg,b:Sg,S:Yg,N:fC,O:tg,M:RI,m:WC,Z:U9,K:n9,J:h9,$:Y9,I:J9,aa:k9,V:l9,P:H9,H:d9,T:b9,G:u9,F:m9,R:Z9,U:p9,da:f9,E:W9,fa:V9,d:aP,ja:NP,g:RP,a:eP,ea:sc,p:cP,h:rP,y:LP,n:UP,o:hP,k:YP,l:JP,i:kP,x:lP,t:pP,ga:fP,L:WP,ca:xP,z:vP,ha:qP,c:Ts,ia:OP,v:zP,j:PP,s:_P,u:$P,f:A5,A:g5,B:Q5,C:i5,W:o5,q:s5,ba:y5,Q:N5,X:t5,Y:M5,r:K5,_:c5,D:r5,w:L5},zg=$(),Rc=R=>(Rc=zg.ma)(R),$s=B._malloc=R=>($s=B._malloc=zg.oa)(R),jB=B._free=R=>(jB=B._free=zg.pa)(R),AD=R=>(AD=zg.qa)(R),Ay=R=>(Ay=zg.ra)(R),ec=R=>(ec=zg.sa)(R),tc=R=>(tc=zg.ta)(R);B.dynCall_iiiji=(R,t,L,k,W,V)=>(B.dynCall_iiiji=zg.ua)(R,t,L,k,W,V),B.dynCall_jii=(R,t,L)=>(B.dynCall_jii=zg.va)(R,t,L),B.dynCall_jiji=(R,t,L,k,W)=>(B.dynCall_jiji=zg.wa)(R,t,L,k,W),B.dynCall_viijii=(R,t,L,k,W,V,X)=>(B.dynCall_viijii=zg.xa)(R,t,L,k,W,V,X),B.dynCall_iiiiij=(R,t,L,k,W,V,X)=>(B.dynCall_iiiiij=zg.ya)(R,t,L,k,W,V,X),B.dynCall_iiiiijj=(R,t,L,k,W,V,X,AA,DA)=>(B.dynCall_iiiiijj=zg.za)(R,t,L,k,W,V,X,AA,DA),B.dynCall_iiiiiijj=(R,t,L,k,W,V,X,AA,DA,SA)=>(B.dynCall_iiiiiijj=zg.Aa)(R,t,L,k,W,V,X,AA,DA,SA);var gD;yA=function R(){gD||Mc(),gD||(yA=R)};function Mc(){if(GA>0||(z(),GA>0))return;function R(){var t;gD||(gD=!0,B.calledRun=!0,!h&&(v(),C(B),(t=B.onRuntimeInitialized)==null||t.call(B),iA()))}B.setStatus?(B.setStatus("Running..."),setTimeout(function(){setTimeout(function(){B.setStatus("")},1),R()},1)):R()}if(B.preInit)for(typeof B.preInit=="function"&&(B.preInit=[B.preInit]);B.preInit.length>0;)B.preInit.pop()();return Mc(),I=E,I}})();const I9="libOpenCOR",B9="oSPARC",vo="https://models.physiomeproject.org/",C9=gs(mK,{}),Q9={LIBOPENCOR_SOLVER:I9,OSPARC_SOLVER:B9,name:"SimulationVuer",components:{PlotVuer:Fc.PlotVuer,SimulationVuerInput:xK,ElButton:SG,ElDivider:YG,ElLoading:mk},props:{apiLocation:{required:!0,type:String},id:{required:!0}},data:function(){if(this.id>0){const A=new XMLHttpRequest;A.open("GET",this.apiLocation+"/sim/dataset/"+this.id),A.onreadystatechange=()=>{if(A.readyState===4&&A.status===200){const g=JSON.parse(A.responseText);this.name=g.name,this.uuid=g.study!==void 0?g.study.uuid:void 0}},A.send()}return{errorMessage:"",fileManager:void 0,hasFinalisedUi:!1,hasValidSimulationUiInfo:!1,instance:void 0,isMounted:!1,isSimulationValid:!0,layout:[],libopencor:void 0,libopencorSet:!1,name:null,opencorBasedSimulation:!0,output:void 0,perfectScollbarOptions:{suppressScrollX:!0},showUserMessage:!1,simulationResults:{},simulationResultsId:{},simulationUiInfo:{},solver:void 0,userMessage:"",ui:null,uuid:null}},methods:{plotMetadata(A){return{version:"1.1.0",type:"plot",attrs:{style:"timeseries",layout:this.layout[A]}}},downloadPmrFile(A){return new Promise((g,I)=>{const B=new XMLHttpRequest;B.open("POST",this.apiLocation+"/pmr_file"),B.setRequestHeader("Content-type","application/json"),B.onreadystatechange=()=>{B.readyState===4&&(B.status===200&&g(Uint8Array.from(atob(B.response),C=>C.charCodeAt(0))),I())},B.send(JSON.stringify({path:A.replace(vo,"")}))})},manageFile(A,g){let I=this.fileManager.file(A);I===null&&(I=new this.libopencor.File(A));const B=this.libopencor._malloc(g.length);return new Uint8Array(this.libopencor.HEAPU8.buffer,B,g.length).set(g),I.setContents(B,g.length),this.libopencor._free(B),I},runSimulation(){if(this.instance===void 0){const I=new this.libopencor.SedDocument(this.fileManager.file(vo+this.id));this.instance=G.markRaw(I.instantiate()),I.delete()}this.instance.removeAllInitialConditions();for(const[I,B]of Object.entries(this.parametersData()))this.instance.addInitialCondition(I,B);this.instance.run();const A={},g=this.instance.tasks().get(0);for(const I of this.outputData()){if(I===g.voiName()&&(A[I]=g.voiAsArray()),A[I]===void 0){for(let B=0;B<g.stateCount();++B)if(I===g.stateName(B)){A[I]=g.stateAsArray(B);break}}if(A[I]===void 0){for(let B=0;g.variableCount();++B)if(I===g.variableName(B)){A[I]=g.variableAsArray(B);break}}}this.processSimulationResults(A),this.showUserMessage=!1},buildSimulationUi(A){if(this.simulationUiInfo=A,this.hasValidSimulationUiInfo=A9(this.simulationUiInfo,this.libopencor===void 0),!this.hasValidSimulationUiInfo)return;if(this.libopencor===void 0){if(this.simulationUiInfo.simulation.solvers.forEach(I=>{(I.if===void 0||Is(this,I.if))&&(this.solver=I)}),this.solver===void 0){console.warn("SIMULATION: no solver name and/or solver version specified.");return}this.opencorBasedSimulation=this.solver.name===ZK}this.libopencor!==void 0&&(this.userMessage="Running the model...",this.showUserMessage=!0,this.$nextTick(()=>{this.runSimulation()})),this.simulationUiInfo.output.data.forEach(I=>{this.simulationResultsId[I.id]=I.name});let g=-1;this.simulationUiInfo.output.plots.forEach(I=>{++g,this.layout[g]={paper_bgcolor:"rgba(0, 0, 0, 0)",plot_bgcolor:"rgba(0, 0, 0, 0)",autosize:!0,margin:{t:25,l:55,r:25,b:30,pad:4},loading:!1,options:{responsive:!0,scrollZoom:!0},dragmode:"pan",xaxis:{title:{text:I.xAxisTitle,font:{size:10}}},yaxis:{title:{text:I.yAxisTitle,font:{size:10}}}}}),this.$nextTick(()=>{fK(this)})},runOnOsparc(){window.open(`https://osparc.io/study/${this.uuid}`,"_blank")},viewDataset(){window.open(`https://sparc.science/datasets/${this.id}?type=dataset`,"_blank")},viewWorkspace(){const A=vo+this.id;window.open(A.substring(0,A.lastIndexOf("/")),"_blank")},parametersData(){const A={};return this.simulationUiInfo.parameters.forEach(g=>{A[g.name]=Is(this,g.value)}),A},outputData(){return this.output===void 0&&this.simulationUiInfo.output.data!==void 0&&(this.output=[],this.simulationUiInfo.output.data.forEach(A=>{this.output.push(A.name)})),this.output},retrieveRequest(){const A={solver:this.solver};if(this.opencorBasedSimulation){A.opencor={model_url:this.simulationUiInfo.simulation.opencor.resource,json_config:{}},this.simulationUiInfo.simulation.opencor.endingPoint!==void 0&&this.simulationUiInfo.simulation.opencor.pointInterval!==void 0&&(A.opencor.json_config.simulation={"Ending point":this.simulationUiInfo.simulation.opencor.endingPoint,"Point interval":this.simulationUiInfo.simulation.opencor.pointInterval}),A.opencor.json_config.parameters=this.parametersData();const g=this.outputData();g!==void 0&&(A.opencor.json_config.output=g)}else A.osparc={},A.osparc.job_inputs=this.parametersData();return A},processSimulationResults(A){if(typeof A=="string"){const B=/[ \t]+/g,C=A.trim().split(`
108
+ `),Q=C[0].trim().split(B).length;A={};for(let w=0;w<Q;++w)A[w]=[];let E=-1;C.forEach(w=>{++E;let D=-1;w.trim().split(B).forEach(o=>{A[++D][E]=Number(o)})})}const g=new C9.parser;Object.keys(this.simulationResultsId).forEach(B=>{g.set(B,A[this.simulationResultsId[B]])});let I=-1;this.simulationUiInfo.output.plots.forEach(B=>{this.simulationResults[++I]=[{x:g.evaluate(B.xValue),y:g.evaluate(B.yValue),type:"scatter"}]})},showHttpIssue(A){this.isSimulationValid=!1,this.showUserMessage=!1,this.errorMessage=A.statusText.toLowerCase()+" (<a href='https://httpstatuses.com/"+A.status+"/' target='_blank'>"+A.status+"</a>)"},checkSimulation(A){const g=new XMLHttpRequest;g.open("POST",this.apiLocation+"/check_simulation"),g.setRequestHeader("Content-type","application/json"),g.onreadystatechange=()=>{if(g.readyState===4)if(g.status===200){let I=JSON.parse(g.responseText);if(this.isSimulationValid=I.status==="ok",this.isSimulationValid)if(I.results!==void 0)this.showUserMessage=!1,this.processSimulationResults(I.results);else{let B=this;setTimeout(function(){B.checkSimulation(A)},1e3)}else this.showUserMessage=!1,this.errorMessage=I.description}else this.showHttpIssue(g)},g.send(JSON.stringify(A))},startSimulation(){this.userMessage="Loading simulation results...",this.showUserMessage=!0,this.$nextTick(()=>{this.simulationResults={};const A=new XMLHttpRequest;A.open("POST",this.apiLocation+"/start_simulation"),A.setRequestHeader("Content-type","application/json"),A.onreadystatechange=()=>{if(A.readyState===4)if(A.status===200){let g=JSON.parse(A.responseText);this.isSimulationValid=g.status==="ok",this.isSimulationValid?this.checkSimulation(g.data):(this.showUserMessage=!1,this.errorMessage=g.description+"ASDASDASD")}else this.showHttpIssue(A)},A.send(JSON.stringify(this.retrieveRequest()))})}},created:function(){this.id>0?(this.userMessage="Retrieving UI information...",this.showUserMessage=!0,this.$nextTick(()=>{const A=new XMLHttpRequest;A.open("GET",this.apiLocation+"/simulation_ui_file/"+this.id),A.onreadystatechange=()=>{A.readyState===4&&(this.showUserMessage=!1,A.status===200&&this.$nextTick(()=>{this.buildSimulationUi(JSON.parse(A.responseText))}))},A.send()})):this.id!==0&&(this.userMessage="Retrieving COMBINE archive from PMR...",this.showUserMessage=!0,this.$nextTick(()=>{const A=new XMLHttpRequest;A.open("POST",this.apiLocation+"/pmr_file"),A.setRequestHeader("Content-type","application/json"),A.onreadystatechange=()=>{A.readyState===4&&(A.status===200?g9().then(g=>{this.libopencor=G.markRaw(g),this.libopencorSet=!0,this.fileManager=G.markRaw(this.libopencor.FileManager.instance());const I=Uint8Array.from(atob(A.response),E=>E.charCodeAt(0)),B=this.manageFile(vo+this.id,I),C=new TextDecoder,Q=JSON.parse(C.decode(B.childFile("simulation.json").contents()));this.showUserMessage=!1,this.$nextTick(()=>{this.buildSimulationUi(Q)})}):this.showUserMessage=!1)},A.send(JSON.stringify({path:this.id}))}))},mounted:function(){this.isMounted=!0,fK(this)}},Zs=A=>(G.pushScopeId("data-v-0460060a"),A=A(),G.popScopeId(),A),E9=["element-loading-text"],i9={key:0,class:"default error"},o9=Zs(()=>G.createElementVNode("span",{class:"error"},"Error:",-1)),D9={key:1,class:"main"},w9={class:"main-left"},s9={key:0,class:"default name"},y9=Zs(()=>G.createElementVNode("p",{class:"default input-parameters"},"Input parameters",-1)),a9={class:"input scrollbar"},G9={class:"primary-button"},N9={key:2,class:"secondary-button"},R9={class:"secondary-button"},e9={class:"secondary-button"},t9={key:3,class:"default note"},M9={class:"main-right",ref:"output"},K9={class:"main-right"},F9={class:"default error"},c9=Zs(()=>G.createElementVNode("span",{class:"error"},"Error:",-1)),r9=["innerHTML"];function S9(A,g,I,B,C,Q){const E=YG,w=xK,D=SG,i=G.resolveComponent("PlotVuer"),o=Aw;return G.withDirectives((G.openBlock(),G.createElementBlock("div",{class:"simulation-vuer","element-loading-text":A.userMessage},[!A.hasValidSimulationUiInfo&&!A.showUserMessage?(G.openBlock(),G.createElementBlock("p",i9,[o9,G.createTextVNode(" an unknown or invalid model was provided.")])):G.createCommentVNode("",!0),A.hasValidSimulationUiInfo?(G.openBlock(),G.createElementBlock("div",D9,[G.createElementVNode("div",w9,[A.libopencorSet?G.createCommentVNode("",!0):(G.openBlock(),G.createElementBlock("p",s9,G.toDisplayString(A.name),1)),A.libopencorSet?G.createCommentVNode("",!0):(G.openBlock(),G.createBlock(E,{key:1})),y9,G.createElementVNode("div",a9,[(G.openBlock(!0),G.createElementBlock(G.Fragment,null,G.renderList(A.simulationUiInfo.input,(s,y)=>(G.openBlock(),G.createBlock(w,{ref_for:!0,ref:"simInput",defaultValue:s.defaultValue,key:`input-${y}`,name:s.name,maximumValue:s.maximumValue,minimumValue:s.minimumValue,possibleValues:s.possibleValues,stepValue:s.stepValue},null,8,["defaultValue","name","maximumValue","minimumValue","possibleValues","stepValue"]))),128))]),G.createElementVNode("div",G9,[A.libopencorSet?G.createCommentVNode("",!0):(G.openBlock(),G.createBlock(D,{key:0,type:"primary",size:"small",onClick:g[0]||(g[0]=s=>Q.startSimulation())},{default:G.withCtx(()=>[G.createTextVNode("Run Simulation")]),_:1}))]),A.uuid?(G.openBlock(),G.createElementBlock("div",N9,[G.createVNode(D,{size:"small",onClick:g[1]||(g[1]=s=>Q.runOnOsparc())},{default:G.withCtx(()=>[G.createTextVNode("Run on oSPARC")]),_:1})])):G.createCommentVNode("",!0),G.createElementVNode("div",R9,[A.libopencorSet?G.createCommentVNode("",!0):(G.openBlock(),G.createBlock(D,{key:0,size:"small",onClick:g[2]||(g[2]=s=>Q.viewDataset())},{default:G.withCtx(()=>[G.createTextVNode("View Dataset")]),_:1}))]),G.createElementVNode("div",e9,[A.libopencorSet?(G.openBlock(),G.createBlock(D,{key:0,size:"small",onClick:g[3]||(g[3]=s=>Q.viewWorkspace())},{default:G.withCtx(()=>[G.createTextVNode("View Workspace")]),_:1})):G.createCommentVNode("",!0)]),A.uuid?(G.openBlock(),G.createElementBlock("p",t9,"Additional parameters are available on oSPARC")):G.createCommentVNode("",!0)]),G.withDirectives(G.createElementVNode("div",M9,[(G.openBlock(!0),G.createElementBlock(G.Fragment,null,G.renderList(A.simulationUiInfo.output.plots,(s,y)=>(G.openBlock(),G.createBlock(i,{key:`output-${y}`,metadata:Q.plotMetadata(y),"data-source":{data:A.simulationResults[y]},plotLayout:A.layout[y],plotType:"plotly-only",selectorUi:!1},null,8,["metadata","data-source","plotLayout"]))),128))],512),[[G.vShow,A.isSimulationValid]]),G.withDirectives(G.createElementVNode("div",K9,[G.createElementVNode("p",F9,[c9,G.createTextVNode(),G.createElementVNode("span",{innerHTML:A.errorMessage},null,8,r9),G.createTextVNode(".")])],512),[[G.vShow,!A.isSimulationValid]])])):G.createCommentVNode("",!0)],8,E9)),[[o,A.showUserMessage]])}const L9=WK(Q9,[["render",S9],["__scopeId","data-v-0460060a"]]);DI.SimulationVuer=L9,Object.defineProperty(DI,Symbol.toStringTag,{value:"Module"})});