summaryrefslogtreecommitdiff
path: root/mathjs/mathjs-expression-parser.min.js
blob: 675afce1425a80d4c291b295441ad22d7b630f96 (plain)
1
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).math=t()}}(function(){return function i(a,s,u){function p(e,t){if(!s[e]){if(!a[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(c)return c(e,!0);var r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}var o=s[e]={exports:{}};a[e][0].call(o.exports,function(t){return p(a[e][1][t]||t)},o,o.exports,i,a,s,u)}return s[e].exports}for(var c="function"==typeof require&&require,t=0;t<u.length;t++)p(u[t]);return p}({1:[function(t,e,n){var r=t("mathjs/core").create();r.import(t("mathjs/lib/expression/function/parse")),r.import(t("mathjs/lib/expression/function/compile")),r.import(t("mathjs/lib/expression/function/eval")),r.import(t("mathjs/lib/function/string/format")),r.import({add:function(t,e){return t+e},subtract:function(t,e){return t-e},multiply:function(t,e){return t*e},divide:function(t,e){return t/e},mod:function(t,e){return t%e},unaryPlus:function(t){return t},unaryMinus:function(t){return-t},bitOr:function(t,e){return t|e},bitXor:function(t,e){return t^e},bitAnd:function(t,e){return t&e},bitNot:function(t){return~t},leftShift:function(t,e){return t<<e},rightArithShift:function(t,e){return t>>e},rightLogShift:function(t,e){return t>>>e},or:function(t,e){return!(!t&&!e)},xor:function(t,e){return!!t!=!!e},and:function(t,e){return!(!t||!e)},not:function(t){return!t},equal:function(t,e){return t==e},unequal:function(t,e){return t!=e},smaller:function(t,e){return t<e},larger:function(t,e){return e<t},smallerEq:function(t,e){return t<=e},largerEq:function(t,e){return e<=t},matrix:function(){throw new Error("Matrices not supported")},index:function(){throw new Error("Matrix indexes not supported")},pi:Math.PI,e:Math.E,true:!0,false:!1,null:null});var o={};Object.getOwnPropertyNames(Math).forEach(function(t){Object.prototype.hasOwnProperty(t)||(o[t]=Math[t])}),r.import(o),e.exports=r},{"mathjs/core":3,"mathjs/lib/expression/function/compile":11,"mathjs/lib/expression/function/eval":12,"mathjs/lib/expression/function/parse":13,"mathjs/lib/function/string/format":37}],2:[function(t,e,n){"use strict";var f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},h={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},l={"–":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},m=function(t,e){return f({},t,e)};e.exports=function(t){for(var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=e.preserveFormatting,r=void 0!==n&&n,o=e.escapeMapFn,i=void 0===o?m:o,a=String(t),s="",u=i(f({},h),r?f({},l):{}),p=Object.keys(u),c=function(){var n=!1;p.forEach(function(t,e){n||a.length>=t.length&&a.slice(0,t.length)===t&&(s+=u[p[e]],a=a.slice(t.length,a.length),n=!0)}),n||(s+=a.slice(0,1),a=a.slice(1,a.length))};a;)c();return s}},{}],3:[function(t,e,n){e.exports=t("./lib/core/core")},{"./lib/core/core":4}],4:[function(t,e,n){"use strict";t("./../utils/polyfills");var u=t("./../utils/object").isFactory,p=t("./typed"),c=t("./../utils/emitter"),f=t("./function/import"),h=t("./function/config");n.create=function(t){if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var r=[],o=[],i=c.mixin({});i.type={},i.expression={transform:{},mathWithTransform:{}},i.typed=p.create(i.type);var a={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function s(t){if(!u(t))throw new Error("Factory object with properties `type`, `name`, and `factory` expected");var e,n=r.indexOf(t);return-1===n?(e=!0===t.math?t.factory(i.type,a,s,i.typed,i):t.factory(i.type,a,s,i.typed),r.push(t),o.push(e)):e=o[n],e}return i.import=s(f),i.config=s(h),i.expression.mathWithTransform.config=i.config,t&&i.config(t),i}},{"./../utils/emitter":52,"./../utils/object":55,"./../utils/polyfills":56,"./function/config":5,"./function/import":6,"./typed":7}],5:[function(t,e,n){"use strict";var u=t("../../utils/object");function p(t,e,n){if(void 0!==t[e]&&(a=n,s=t[e],-1===a.indexOf(s))){var r=(o=n,i=t[e],o.map(function(t){return t.toLowerCase()}).indexOf(i.toLowerCase()));-1!==r?(console.warn('Warning: Wrong casing for configuration option "'+e+'", should be "'+n[r]+'" instead of "'+t[e]+'".'),t[e]=n[r]):console.warn('Warning: Unknown value "'+t[e]+'" for configuration option "'+e+'". Available options: '+n.map(JSON.stringify).join(", ")+".")}var o,i,a,s}n.name="config",n.math=!0,n.factory=function(t,o,e,n,i){var a=["Matrix","Array"],s=["number","BigNumber","Fraction"];function r(t){if(t){var e=u.map(o,u.clone);p(t,"matrix",a),p(t,"number",s),u.deepExtend(o,t);var n=u.map(o,u.clone),r=u.map(t,u.clone);return i.emit("config",n,e,r),n}return u.map(o,u.clone)}return r.MATRIX=a,r.NUMBER=s,r}},{"../../utils/object":55}],6:[function(t,e,n){"use strict";function y(t){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var g=t("../../utils/object").lazy,v=t("../../utils/object").isFactory,b=t("../../utils/object").traverse,x=t("../../error/ArgumentsError");n.math=!0,n.name="import",n.factory=function(s,t,u,p,c){function f(t,e,n){if(n.wrap&&"function"==typeof e&&(r=function(){for(var t=[],e=0,n=arguments.length;e<n;e++){var r=arguments[e];t[e]=r&&r.valueOf()}return o.apply(c,t)},(o=e).transform&&(r.transform=o.transform),e=r),m(c[t])&&m(e))return e=n.override?p(t,e.signatures):p(c[t],e),i(t,c[t]=e),void c.emit("import",t,function(){return e});var o,r;if(void 0===c[t]||n.override)return i(t,c[t]=e),void c.emit("import",t,function(){return e});if(!n.silent)throw new Error('Cannot import "'+t+'": already exists')}function i(t,e){e&&"function"==typeof e.transform?(c.expression.transform[t]=e.transform,n(t)&&(c.expression.mathWithTransform[t]=e.transform)):(delete c.expression.transform[t],n(t)&&(c.expression.mathWithTransform[t]=e))}function h(t){delete c.expression.transform[t],n(t)?c.expression.mathWithTransform[t]=c[t]:delete c.expression.mathWithTransform[t]}function l(e,n){if("string"==typeof e.name){var r=e.name,t=r in c.expression.transform,o=e.path?b(c,e.path):c,i=o.hasOwnProperty(r)?o[r]:void 0,a=function(){var t=u(e);if(t&&"function"==typeof t.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(m(i)&&m(t))return n.override||(t=p(i,t)),t;if(void 0===i||n.override)return t;if(!n.silent)throw new Error('Cannot import "'+r+'": already exists')};!1!==e.lazy?(g(o,r,a),t?h(r):("expression.transform"===e.path||d(e))&&g(c.expression.mathWithTransform,r,a)):(o[r]=a(),t?h(r):("expression.transform"===e.path||d(e))&&(c.expression.mathWithTransform[r]=a())),c.emit("import",r,a,e.path)}else u(e)}function m(t){return"function"==typeof t&&"object"===y(t.signatures)}function n(t){return!e.hasOwnProperty(t)}function d(t){return void 0===t.path&&!e.hasOwnProperty(t.name)}var e={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function e(t,n){var r,o=arguments.length;if(1!==o&&2!==o)throw new x("import",o,1,2);if(n||(n={}),v(t))l(t,n);else if(Array.isArray(t))t.forEach(function(t){e(t,n)});else if("object"===y(t)){for(var i in t)if(t.hasOwnProperty(i)){var a=t[i];"function"==typeof(r=a)||"number"==typeof r||"string"==typeof r||"boolean"==typeof r||null===r||r&&s.isUnit(r)||r&&s.isComplex(r)||r&&s.isBigNumber(r)||r&&s.isFraction(r)||r&&s.isMatrix(r)||r&&Array.isArray(r)?f(i,a,n):v(t)?l(t,n):e(a,n)}}else if(!n.silent)throw new TypeError("Factory, Object, or Array expected")}},n.lazy=!0},{"../../error/ArgumentsError":8,"../../utils/object":55}],7:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=t("typed-function"),i=t("./../utils/number").digits,a=t("./../utils/bignumber/isBigNumber"),s=t("./../utils/collection/isMatrix"),u=function(){return u=o.create,o};n.create=function(n){n.isNumber=function(t){return"number"==typeof t},n.isComplex=function(t){return n.Complex&&t instanceof n.Complex||!1},n.isBigNumber=a,n.isFraction=function(t){return n.Fraction&&t instanceof n.Fraction||!1},n.isUnit=function(t){return t&&t.constructor.prototype.isUnit||!1},n.isString=function(t){return"string"==typeof t},n.isArray=Array.isArray,n.isMatrix=s,n.isDenseMatrix=function(t){return t&&t.isDenseMatrix&&t.constructor.prototype.isMatrix||!1},n.isSparseMatrix=function(t){return t&&t.isSparseMatrix&&t.constructor.prototype.isMatrix||!1},n.isRange=function(t){return t&&t.constructor.prototype.isRange||!1},n.isIndex=function(t){return t&&t.constructor.prototype.isIndex||!1},n.isBoolean=function(t){return"boolean"==typeof t},n.isResultSet=function(t){return t&&t.constructor.prototype.isResultSet||!1},n.isHelp=function(t){return t&&t.constructor.prototype.isHelp||!1},n.isFunction=function(t){return"function"==typeof t},n.isDate=function(t){return t instanceof Date},n.isRegExp=function(t){return t instanceof RegExp},n.isObject=function(t){return"object"===r(t)&&t.constructor===Object&&!n.isComplex(t)&&!n.isFraction(t)},n.isNull=function(t){return null===t},n.isUndefined=function(t){return void 0===t},n.isAccessorNode=function(t){return t&&t.isAccessorNode&&t.constructor.prototype.isNode||!1},n.isArrayNode=function(t){return t&&t.isArrayNode&&t.constructor.prototype.isNode||!1},n.isAssignmentNode=function(t){return t&&t.isAssignmentNode&&t.constructor.prototype.isNode||!1},n.isBlockNode=function(t){return t&&t.isBlockNode&&t.constructor.prototype.isNode||!1},n.isConditionalNode=function(t){return t&&t.isConditionalNode&&t.constructor.prototype.isNode||!1},n.isConstantNode=function(t){return t&&t.isConstantNode&&t.constructor.prototype.isNode||!1},n.isFunctionAssignmentNode=function(t){return t&&t.isFunctionAssignmentNode&&t.constructor.prototype.isNode||!1},n.isFunctionNode=function(t){return t&&t.isFunctionNode&&t.constructor.prototype.isNode||!1},n.isIndexNode=function(t){return t&&t.isIndexNode&&t.constructor.prototype.isNode||!1},n.isNode=function(t){return t&&t.isNode&&t.constructor.prototype.isNode||!1},n.isObjectNode=function(t){return t&&t.isObjectNode&&t.constructor.prototype.isNode||!1},n.isOperatorNode=function(t){return t&&t.isOperatorNode&&t.constructor.prototype.isNode||!1},n.isParenthesisNode=function(t){return t&&t.isParenthesisNode&&t.constructor.prototype.isNode||!1},n.isRangeNode=function(t){return t&&t.isRangeNode&&t.constructor.prototype.isNode||!1},n.isSymbolNode=function(t){return t&&t.isSymbolNode&&t.constructor.prototype.isNode||!1},n.isChain=function(t){return t&&t.constructor.prototype.isChain||!1};var t=u();return t.types=[{name:"number",test:n.isNumber},{name:"Complex",test:n.isComplex},{name:"BigNumber",test:n.isBigNumber},{name:"Fraction",test:n.isFraction},{name:"Unit",test:n.isUnit},{name:"string",test:n.isString},{name:"Array",test:n.isArray},{name:"Matrix",test:n.isMatrix},{name:"DenseMatrix",test:n.isDenseMatrix},{name:"SparseMatrix",test:n.isSparseMatrix},{name:"Range",test:n.isRange},{name:"Index",test:n.isIndex},{name:"boolean",test:n.isBoolean},{name:"ResultSet",test:n.isResultSet},{name:"Help",test:n.isHelp},{name:"function",test:n.isFunction},{name:"Date",test:n.isDate},{name:"RegExp",test:n.isRegExp},{name:"null",test:n.isNull},{name:"undefined",test:n.isUndefined},{name:"OperatorNode",test:n.isOperatorNode},{name:"ConstantNode",test:n.isConstantNode},{name:"SymbolNode",test:n.isSymbolNode},{name:"ParenthesisNode",test:n.isParenthesisNode},{name:"FunctionNode",test:n.isFunctionNode},{name:"FunctionAssignmentNode",test:n.isFunctionAssignmentNode},{name:"ArrayNode",test:n.isArrayNode},{name:"AssignmentNode",test:n.isAssignmentNode},{name:"BlockNode",test:n.isBlockNode},{name:"ConditionalNode",test:n.isConditionalNode},{name:"IndexNode",test:n.isIndexNode},{name:"RangeNode",test:n.isRangeNode},{name:"Node",test:n.isNode},{name:"Object",test:n.isObject}],t.conversions=[{from:"number",to:"BigNumber",convert:function(t){if(15<i(t))throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+t+"). Use function bignumber(x) to convert to BigNumber.");return new n.BigNumber(t)}},{from:"number",to:"Complex",convert:function(t){return new n.Complex(t,0)}},{from:"number",to:"string",convert:function(t){return t+""}},{from:"BigNumber",to:"Complex",convert:function(t){return new n.Complex(t.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(t){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(t){return new n.Complex(t.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(t){if(new n.Fraction(t).valueOf()!==t)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+t+"). Use function fraction(x) to convert to Fraction.");return new n.Fraction(t)}},{from:"string",to:"number",convert:function(t){var e=Number(t);if(isNaN(e))throw new Error('Cannot convert "'+t+'" to a number');return e}},{from:"string",to:"BigNumber",convert:function(e){try{return new n.BigNumber(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){try{return new n.Fraction(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){try{return new n.Complex(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(t){return+t}},{from:"boolean",to:"BigNumber",convert:function(t){return new n.BigNumber(+t)}},{from:"boolean",to:"Fraction",convert:function(t){return new n.Fraction(+t)}},{from:"boolean",to:"string",convert:function(t){return+t}},{from:"Array",to:"Matrix",convert:function(t){return new n.DenseMatrix(t)}},{from:"Matrix",to:"Array",convert:function(t){return t.valueOf()}}],t}},{"./../utils/bignumber/isBigNumber":48,"./../utils/collection/isMatrix":50,"./../utils/number":54,"typed-function":59}],8:[function(t,e,n){"use strict";function o(t,e,n,r){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=e,this.min=n,this.max=r,this.message="Wrong number of arguments in function "+t+" ("+e+" provided, "+n+(null!=r?"-"+r:"")+" expected)",this.stack=(new Error).stack}(o.prototype=new Error).constructor=Error,o.prototype.name="ArgumentsError",o.prototype.isArgumentsError=!0,e.exports=o},{}],9:[function(t,e,n){"use strict";function r(t,e,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=e,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=(new Error).stack}(r.prototype=new RangeError).constructor=RangeError,r.prototype.name="DimensionError",r.prototype.isDimensionError=!0,e.exports=r},{}],10:[function(t,e,n){"use strict";function r(t,e,n){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=n),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=(new Error).stack}(r.prototype=new RangeError).constructor=RangeError,r.prototype.name="IndexError",r.prototype.isIndexError=!0,e.exports=r},{}],11:[function(i,t,e){"use strict";var a=i("../../utils/collection/deepMap");e.name="compile",e.factory=function(t,e,n,r){var o=n(i("../parse"));return r("compile",{string:function(t){return o(t).compile()},"Array | Matrix":function(t){return a(t,function(t){return o(t).compile()})}})}},{"../../utils/collection/deepMap":49,"../parse":34}],12:[function(i,t,e){"use strict";var a=i("../../utils/collection/deepMap");e.name="eval",e.factory=function(t,e,n,r){var o=n(i("../parse"));return r("compile",{string:function(t){return o(t).compile().eval({})},"string, Object":function(t,e){return o(t).compile().eval(e)},"Array | Matrix":function(t){var e={};return a(t,function(t){return o(t).compile().eval(e)})},"Array | Matrix, Object":function(t,e){return a(t,function(t){return o(t).compile().eval(e)})}})}},{"../../utils/collection/deepMap":49,"../parse":34}],13:[function(i,t,e){"use strict";e.name="parse",e.factory=function(t,e,n,r){var o=n(i("../parse"));return r("parse",{"string | Array | Matrix":o,"string | Array | Matrix, Object":o})}},{"../parse":34}],14:[function(t,e,n){"use strict";e.exports={end:!0}},{}],15:[function(u,t,e){"use strict";var p=u("../../utils/customs").getSafeProperty;e.name="AccessorNode",e.path="expression.node",e.factory=function(n,t,e,r){var o=e(u("./Node")),s=e(u("./utils/access"));function i(t,e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!n.isNode(t))throw new TypeError('Node expected for parameter "object"');if(!n.isIndexNode(e))throw new TypeError('IndexNode expected for parameter "index"');this.object=t||null,this.index=e,Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function a(t){return!(n.isAccessorNode(t)||n.isArrayNode(t)||n.isConstantNode(t)||n.isFunctionNode(t)||n.isObjectNode(t)||n.isParenthesisNode(t)||n.isSymbolNode(t))}return(i.prototype=new o).type="AccessorNode",i.prototype.isAccessorNode=!0,i.prototype._compile=function(t,e){var i=this.object._compile(t,e),a=this.index._compile(t,e);if(this.index.isObjectProperty()){var r=this.index.getObjectProperty();return function(t,e,n){return p(i(t,e,n),r)}}return function(t,e,n){var r=i(t,e,n),o=a(t,e,r);return s(r,o)}},i.prototype.forEach=function(t){t(this.object,"object",this),t(this.index,"index",this)},i.prototype.map=function(t){return new i(this._ifNode(t(this.object,"object",this)),this._ifNode(t(this.index,"index",this)))},i.prototype.clone=function(){return new i(this.object,this.index)},i.prototype._toString=function(t){var e=this.object.toString(t);return a(this.object)&&(e="("+e+")"),e+this.index.toString(t)},i.prototype.toHTML=function(t){var e=this.object.toHTML(t);return a(this.object)&&(e='<span class="math-parenthesis math-round-parenthesis">(</span>'+e+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e+this.index.toHTML(t)},i.prototype._toTex=function(t){var e=this.object.toTex(t);return a(this.object)&&(e="\\left(' + object + '\\right)"),e+this.index.toTex(t)},i.prototype.toJSON=function(){return{mathjs:"AccessorNode",object:this.object,index:this.index}},i.fromJSON=function(t){return new i(t.object,t.index)},i}},{"../../utils/customs":51,"./Node":24,"./utils/access":31}],16:[function(a,t,e){"use strict";var s=a("../../utils/array").map;e.name="ArrayNode",e.path="expression.node",e.factory=function(n,t,e,r){var o=e(a("./Node"));function i(t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(this.items=t||[],!Array.isArray(this.items)||!this.items.every(n.isNode))throw new TypeError("Array containing Nodes expected");var e=function(){throw new Error("Property `ArrayNode.nodes` is deprecated, use `ArrayNode.items` instead")};Object.defineProperty(this,"nodes",{get:e,set:e})}return(i.prototype=new o).type="ArrayNode",i.prototype.isArrayNode=!0,i.prototype._compile=function(e,n){var t=s(this.items,function(t){return t._compile(e,n)});if("Array"===e.config().matrix)return function(e,n,r){return s(t,function(t){return t(e,n,r)})};var o=e.matrix;return function(e,n,r){return o(s(t,function(t){return t(e,n,r)}))}},i.prototype.forEach=function(t){for(var e=0;e<this.items.length;e++)t(this.items[e],"items["+e+"]",this)},i.prototype.map=function(t){for(var e=[],n=0;n<this.items.length;n++)e[n]=this._ifNode(t(this.items[n],"items["+n+"]",this));return new i(e)},i.prototype.clone=function(){return new i(this.items.slice(0))},i.prototype._toString=function(e){return"["+this.items.map(function(t){return t.toString(e)}).join(", ")+"]"},i.prototype.toJSON=function(){return{mathjs:"ArrayNode",items:this.items}},i.fromJSON=function(t){return new i(t.items)},i.prototype.toHTML=function(e){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map(function(t){return t.toHTML(e)}).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},i.prototype._toTex=function(e){var n="\\begin{bmatrix}";return this.items.forEach(function(t){t.items?n+=t.items.map(function(t){return t.toTex(e)}).join("&"):n+=t.toTex(e),n+="\\\\"}),n+="\\end{bmatrix}"},i}},{"../../utils/array":46,"./Node":24}],17:[function(u,t,e){"use strict";var d=u("../../utils/customs").getSafeProperty,y=u("../../utils/customs").setSafeProperty;e.name="AssignmentNode",e.path="expression.node",e.factory=function(r,t,e,n){var o=e(u("./Node")),l=e(u("./utils/assign")),m=e(u("./utils/access")),i=u("../operators");function a(t,e,n){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(this.object=t,this.index=n?e:null,this.value=n||e,!r.isSymbolNode(t)&&!r.isAccessorNode(t))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(r.isSymbolNode(t)&&"end"===t.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!r.isIndexNode(this.index))throw new TypeError('IndexNode expected as "index"');if(!r.isNode(this.value))throw new TypeError('Node expected as "value"');Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function s(t,e){e||(e="keep");var n=i.getPrecedence(t,e),r=i.getPrecedence(t.value,e);return"all"===e||null!==r&&r<=n}return(a.prototype=new o).type="AssignmentNode",a.prototype.isAssignmentNode=!0,a.prototype._compile=function(t,e){var a=this.object._compile(t,e),u=this.index?this.index._compile(t,e):null,p=this.value._compile(t,e),s=this.object.name;if(this.index){if(this.index.isObjectProperty()){var i=this.index.getObjectProperty();return function(t,e,n){var r=a(t,e,n),o=p(t,e,n);return y(r,i,o)}}if(r.isSymbolNode(this.object))return function(t,e,n){var r=a(t,e,n),o=p(t,e,n),i=u(t,e,r);return y(t,s,l(r,i,o)),o};var c=this.object.object._compile(t,e);if(this.object.index.isObjectProperty()){var f=this.object.index.getObjectProperty();return function(t,e,n){var r=c(t,e,n),o=d(r,f),i=u(t,e,o),a=p(t,e,n);return y(r,f,l(o,i,a)),a}}var h=this.object.index._compile(t,e);return function(t,e,n){var r=c(t,e,n),o=h(t,e,r),i=m(r,o),a=u(t,e,i),s=p(t,e,n);return l(r,o,l(i,a,s)),s}}if(!r.isSymbolNode(this.object))throw new TypeError("SymbolNode expected as object");return function(t,e,n){return y(t,s,p(t,e,n))}},a.prototype.forEach=function(t){t(this.object,"object",this),this.index&&t(this.index,"index",this),t(this.value,"value",this)},a.prototype.map=function(t){return new a(this._ifNode(t(this.object,"object",this)),this.index?this._ifNode(t(this.index,"index",this)):null,this._ifNode(t(this.value,"value",this)))},a.prototype.clone=function(){return new a(this.object,this.index,this.value)},a.prototype._toString=function(t){var e=this.object.toString(t),n=this.index?this.index.toString(t):"",r=this.value.toString(t);return s(this,t&&t.parenthesis)&&(r="("+r+")"),e+n+" = "+r},a.prototype.toJSON=function(){return{mathjs:"AssignmentNode",object:this.object,index:this.index,value:this.value}},a.fromJSON=function(t){return new a(t.object,t.index,t.value)},a.prototype.toHTML=function(t){var e=this.object.toHTML(t),n=this.index?this.index.toHTML(t):"",r=this.value.toHTML(t);return s(this,t&&t.parenthesis)&&(r='<span class="math-paranthesis math-round-parenthesis">(</span>'+r+'<span class="math-paranthesis math-round-parenthesis">)</span>'),e+n+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+r},a.prototype._toTex=function(t){var e=this.object.toTex(t),n=this.index?this.index.toTex(t):"",r=this.value.toTex(t);return s(this,t&&t.parenthesis)&&(r="\\left(".concat(r,"\\right)")),e+n+":="+r},a}},{"../../utils/customs":51,"../operators":33,"./Node":24,"./utils/access":31,"./utils/assign":32}],18:[function(s,t,e){"use strict";var u=s("../../utils/array").forEach,p=s("../../utils/array").map;e.name="BlockNode",e.path="expression.node",e.factory=function(r,t,e,n){var o=e(s("./Node")),a=e(s("../../type/resultset/ResultSet"));function i(t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(t))throw new Error("Array expected");this.blocks=t.map(function(t){var e=t&&t.node,n=!t||void 0===t.visible||t.visible;if(!r.isNode(e))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof n)throw new TypeError('Property "visible" must be a boolean');return{node:e,visible:n}})}return(i.prototype=new o).type="BlockNode",i.prototype.isBlockNode=!0,i.prototype._compile=function(e,n){var t=p(this.blocks,function(t){return{eval:t.node._compile(e,n),visible:t.visible}});return function(n,r,o){var i=[];return u(t,function(t){var e=t.eval(n,r,o);t.visible&&i.push(e)}),new a(i)}},i.prototype.forEach=function(t){for(var e=0;e<this.blocks.length;e++)t(this.blocks[e].node,"blocks["+e+"].node",this)},i.prototype.map=function(t){for(var e=[],n=0;n<this.blocks.length;n++){var r=this.blocks[n],o=this._ifNode(t(r.node,"blocks["+n+"].node",this));e[n]={node:o,visible:r.visible}}return new i(e)},i.prototype.clone=function(){return new i(this.blocks.map(function(t){return{node:t.node,visible:t.visible}}))},i.prototype._toString=function(e){return this.blocks.map(function(t){return t.node.toString(e)+(t.visible?"":";")}).join("\n")},i.prototype.toJSON=function(){return{mathjs:"BlockNode",blocks:this.blocks}},i.fromJSON=function(t){return new i(t.blocks)},i.prototype.toHTML=function(e){return this.blocks.map(function(t){return t.node.toHTML(e)+(t.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')},i.prototype._toTex=function(e){return this.blocks.map(function(t){return t.node.toTex(e)+(t.visible?"":";")}).join("\\;\\;\n")},i}},{"../../type/resultset/ResultSet":45,"../../utils/array":46,"./Node":24}],19:[function(i,t,e){"use strict";var p=i("../operators");e.name="ConditionalNode",e.path="expression.node",e.factory=function(a,t,e,n){var r=e(i("./Node")),s=e(i("../../function/utils/typeof"));function o(t,e,n){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(!a.isNode(t))throw new TypeError("Parameter condition must be a Node");if(!a.isNode(e))throw new TypeError("Parameter trueExpr must be a Node");if(!a.isNode(n))throw new TypeError("Parameter falseExpr must be a Node");this.condition=t,this.trueExpr=e,this.falseExpr=n}return(o.prototype=new r).type="ConditionalNode",o.prototype.isConditionalNode=!0,o.prototype._compile=function(t,e){var r=this.condition._compile(t,e),o=this.trueExpr._compile(t,e),i=this.falseExpr._compile(t,e);return function(t,e,n){return function(t){if("number"==typeof t||"boolean"==typeof t||"string"==typeof t)return!!t;if(t){if(a.isBigNumber(t))return!t.isZero();if(a.isComplex(t))return!(!t.re&&!t.im);if(a.isUnit(t))return!!t.value}if(null!=t)throw new TypeError('Unsupported type of condition "'+s(t)+'"');return!1}(r(t,e,n))?o(t,e,n):i(t,e,n)}},o.prototype.forEach=function(t){t(this.condition,"condition",this),t(this.trueExpr,"trueExpr",this),t(this.falseExpr,"falseExpr",this)},o.prototype.map=function(t){return new o(this._ifNode(t(this.condition,"condition",this)),this._ifNode(t(this.trueExpr,"trueExpr",this)),this._ifNode(t(this.falseExpr,"falseExpr",this)))},o.prototype.clone=function(){return new o(this.condition,this.trueExpr,this.falseExpr)},o.prototype._toString=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=p.getPrecedence(this,e),r=this.condition.toString(t),o=p.getPrecedence(this.condition,e);("all"===e||"OperatorNode"===this.condition.type||null!==o&&o<=n)&&(r="("+r+")");var i=this.trueExpr.toString(t),a=p.getPrecedence(this.trueExpr,e);("all"===e||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(i="("+i+")");var s=this.falseExpr.toString(t),u=p.getPrecedence(this.falseExpr,e);return("all"===e||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s="("+s+")"),r+" ? "+i+" : "+s},o.prototype.toJSON=function(){return{mathjs:"ConditionalNode",condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}},o.fromJSON=function(t){return new o(t.condition,t.trueExpr,t.falseExpr)},o.prototype.toHTML=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=p.getPrecedence(this,e),r=this.condition.toHTML(t),o=p.getPrecedence(this.condition,e);("all"===e||"OperatorNode"===this.condition.type||null!==o&&o<=n)&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>');var i=this.trueExpr.toHTML(t),a=p.getPrecedence(this.trueExpr,e);("all"===e||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>');var s=this.falseExpr.toHTML(t),u=p.getPrecedence(this.falseExpr,e);return("all"===e||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+'<span class="math-operator math-conditional-operator">?</span>'+i+'<span class="math-operator math-conditional-operator">:</span>'+s},o.prototype._toTex=function(t){return"\\begin{cases} {"+this.trueExpr.toTex(t)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(t)+"}\\\\{"+this.falseExpr.toTex(t)+"}, &\\quad{\\text{otherwise}}\\end{cases}"},o}},{"../../function/utils/typeof":38,"../operators":33,"./Node":24}],20:[function(s,t,e){"use strict";var u=s("../../utils/string").format,p=s("../../utils/latex").escape;e.name="ConstantNode",e.path="expression.node",e.factory=function(t,e,n,r){var o=n(s("./Node")),i=n(s("../../function/utils/typeof"));function a(t){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(2===arguments.length)throw new SyntaxError("new ConstantNode(valueStr, valueType) is not supported anymore since math v4.0.0. Use new ConstantNode(value) instead, where value is a non-stringified value.");this.value=t}return(a.prototype=new o).type="ConstantNode",a.prototype.isConstantNode=!0,a.prototype._compile=function(t,e){var n=this.value;return function(){return n}},a.prototype.forEach=function(t){},a.prototype.map=function(t){return this.clone()},a.prototype.clone=function(){return new a(this.value)},a.prototype._toString=function(t){return u(this.value,t)},a.prototype.toHTML=function(t){var e=this._toString(t);switch(i(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+e+"</span>";case"string":return'<span class="math-string">'+e+"</span>";case"boolean":return'<span class="math-boolean">'+e+"</span>";case"null":return'<span class="math-null-symbol">'+e+"</span>";case"undefined":return'<span class="math-undefined">'+e+"</span>";default:return'<span class="math-symbol">'+e+"</span>"}},a.prototype.toJSON=function(){return{mathjs:"ConstantNode",value:this.value}},a.fromJSON=function(t){return new a(t.value)},a.prototype._toTex=function(t){var e=this._toString(t);switch(i(this.value)){case"string":return"\\mathtt{"+p(e)+"}";case"number":case"BigNumber":var n=e.toLowerCase().indexOf("e");return-1!==n?e.substring(0,n)+"\\cdot10^{"+e.substring(n+1)+"}":e;case"Fraction":return this.value.toLatex();default:return e}},a}},{"../../function/utils/typeof":38,"../../utils/latex":53,"../../utils/string":57,"./Node":24}],21:[function(a,t,e){"use strict";var s=a("../keywords"),u=a("../../utils/string").escape,f=a("../../utils/array").forEach,h=a("../../utils/array").join,p=a("../../utils/latex"),l=a("../operators"),m=a("../../utils/customs").setSafeProperty;e.name="FunctionAssignmentNode",e.path="expression.node",e.factory=function(r,t,e,c){var n=e(a("./Node"));function o(t,e,n){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof t)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(e))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!r.isNode(n))throw new TypeError('Node expected for parameter "expr"');if(t in s)throw new Error('Illegal function name, "'+t+'" is a reserved keyword');this.name=t,this.params=e.map(function(t){return t&&t.name||t}),this.types=e.map(function(t){return t&&t.type||"any"}),this.expr=n}function i(t,e){var n=l.getPrecedence(t,e),r=l.getPrecedence(t.expr,e);return"all"===e||null!==r&&r<=n}return(o.prototype=new n).type="FunctionAssignmentNode",o.prototype.isFunctionAssignmentNode=!0,o.prototype._compile=function(t,e){var n=Object.create(e);f(this.params,function(t){n[t]=!0});var i=this.expr._compile(t,n),a=this.name,s=this.params,u=h(this.types,","),p=a+"("+h(this.params,", ")+")";return function(n,r,o){var t={};t[u]=function(){for(var t=Object.create(r),e=0;e<s.length;e++)t[s[e]]=arguments[e];return i(n,t,o)};var e=c(a,t);return e.syntax=p,m(n,a,e),e}},o.prototype.forEach=function(t){t(this.expr,"expr",this)},o.prototype.map=function(t){var e=this._ifNode(t(this.expr,"expr",this));return new o(this.name,this.params.slice(0),e)},o.prototype.clone=function(){return new o(this.name,this.params.slice(0),this.expr)},o.prototype._toString=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=this.expr.toString(t);return i(this,e)&&(n="("+n+")"),this.name+"("+this.params.join(", ")+") = "+n},o.prototype.toJSON=function(){var n=this.types;return{mathjs:"FunctionAssignmentNode",name:this.name,params:this.params.map(function(t,e){return{name:t,type:n[e]}}),expr:this.expr}},o.fromJSON=function(t){return new o(t.name,t.params,t.expr)},o.prototype.toHTML=function(t){for(var e=t&&t.parenthesis?t.parenthesis:"keep",n=[],r=0;r<this.params.length;r++)n.push('<span class="math-symbol math-parameter">'+u(this.params[r])+"</span>");var o=this.expr.toHTML(t);return i(this,e)&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+u(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+n.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+o},o.prototype._toTex=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=this.expr.toTex(t);return i(this,e)&&(n="\\left(".concat(n,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(p.toSymbol).join(",")+"\\right):="+n},o}},{"../../utils/array":46,"../../utils/customs":51,"../../utils/latex":53,"../../utils/string":57,"../keywords":14,"../operators":33,"./Node":24}],22:[function(p,t,e){"use strict";function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(){return(v=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var f=p("../../utils/latex"),h=p("../../utils/string").escape,l=p("../../utils/object").hasOwnProperty,b=p("../../utils/array").map,x=p("../../utils/customs").validateSafeMethod,w=p("../../utils/customs").getSafeProperty;e.name="FunctionNode",e.path="expression.node",e.math=!0,e.factory=function(y,t,e,n,o){var r=e(p("./Node")),i=e(p("./SymbolNode"));function g(t,e){if(!(this instanceof g))throw new SyntaxError("Constructor must be called with the new operator");if("string"==typeof t&&(t=new i(t)),!y.isNode(t))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(e)||!e.every(y.isNode))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=t,this.args=e||[],Object.defineProperty(this,"name",{get:function(){return this.fn.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}});var n=function(){throw new Error("Property `FunctionNode.object` is deprecated, use `FunctionNode.fn` instead")};Object.defineProperty(this,"object",{get:n,set:n})}(g.prototype=new r).type="FunctionNode",g.prototype.isFunctionNode=!0,g.prototype._compile=function(o,e){if(!(this instanceof g))throw new TypeError("No valid FunctionNode");var i=b(this.args,function(t){return t._compile(o,e)});if(y.isSymbolNode(this.fn)){var a=this.fn.name,s=a in o?w(o,a):void 0;if("function"==typeof s&&!0===s.rawArgs){var r=this.args;return function(t,e,n){return(a in t?w(t,a):s)(r,o,v({},t,e))}}if(1===i.length){var u=i[0];return function(t,e,n){return(a in t?w(t,a):s)(u(t,e,n))}}if(2!==i.length)return function(e,n,r){return(a in e?w(e,a):s).apply(null,b(i,function(t){return t(e,n,r)}))};var p=i[0],c=i[1];return function(t,e,n){return(a in t?w(t,a):s)(p(t,e,n),c(t,e,n))}}if(y.isAccessorNode(this.fn)&&y.isIndexNode(this.fn.index)&&this.fn.index.isObjectProperty()){var f=this.fn.object._compile(o,e),h=this.fn.index.getObjectProperty(),l=this.args;return function(e,n,r){var t=f(e,n,r);return x(t,h),t[h]&&t[h].rawArgs?t[h](l,o,v({},e,n)):t[h].apply(t,b(i,function(t){return t(e,n,r)}))}}var m=this.fn._compile(o,e),d=this.args;return function(e,n,r){var t=m(e,n,r);return t&&t.rawArgs?t(d,o,v({},e,n)):t.apply(t,b(i,function(t){return t(e,n,r)}))}},g.prototype.forEach=function(t){for(var e=0;e<this.args.length;e++)t(this.args[e],"args["+e+"]",this)},g.prototype.map=function(t){for(var e=this.fn.map(t),n=[],r=0;r<this.args.length;r++)n[r]=this._ifNode(t(this.args[r],"args["+r+"]",this));return new g(e,n)},g.prototype.clone=function(){return new g(this.fn,this.args.slice(0))};var a=g.prototype.toString;function s(t,e,n){for(var r,o="",i=new RegExp("\\$(?:\\{([a-z_][a-z_0-9]*)(?:\\[([0-9]+)\\])?\\}|\\$)","ig"),a=0;null!==(r=i.exec(t));)if(o+=t.substring(a,r.index),a=r.index,"$$"===r[0])o+="$",a++;else{a+=r[0].length;var s=e[r[1]];if(!s)throw new ReferenceError("Template: Property "+r[1]+" does not exist.");if(void 0===r[2])switch(c(s)){case"string":o+=s;break;case"object":if(y.isNode(s))o+=s.toTex(n);else{if(!Array.isArray(s))throw new TypeError("Template: "+r[1]+" has to be a Node, String or array of Nodes");o+=s.map(function(t,e){if(y.isNode(t))return t.toTex(n);throw new TypeError("Template: "+r[1]+"["+e+"] is not a Node.")}).join(",")}break;default:throw new TypeError("Template: "+r[1]+" has to be a Node, String or array of Nodes")}else{if(!y.isNode(s[r[2]]&&s[r[2]]))throw new TypeError("Template: "+r[1]+"["+r[2]+"] is not a Node.");o+=s[r[2]].toTex(n)}}return o+=t.slice(a)}g.prototype.toString=function(t){var e,n=this.fn.toString(t);return t&&"object"===c(t.handler)&&l(t.handler,n)&&(e=t.handler[n](this,t)),void 0!==e?e:a.call(this,t)},g.prototype._toString=function(e){var t=this.args.map(function(t){return t.toString(e)});return(y.isFunctionAssignmentNode(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+t.join(", ")+")"},g.prototype.toJSON=function(){return{mathjs:"FunctionNode",fn:this.fn,args:this.args}},g.fromJSON=function(t){return new g(t.fn,t.args)},g.prototype.toHTML=function(e){var t=this.args.map(function(t){return t.toHTML(e)});return'<span class="math-function">'+h(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'};var u=g.prototype.toTex;return g.prototype.toTex=function(t){var e;return t&&"object"===c(t.handler)&&l(t.handler,this.name)&&(e=t.handler[this.name](this,t)),void 0!==e?e:u.call(this,t)},g.prototype._toTex=function(e){var t,n,r=this.args.map(function(t){return t.toTex(e)});switch(!o[this.name]||"function"!=typeof o[this.name].toTex&&"object"!==c(o[this.name].toTex)&&"string"!=typeof o[this.name].toTex||(t=o[this.name].toTex),c(t)){case"function":n=t(this,e);break;case"string":n=s(t,this,e);break;case"object":switch(c(t[r.length])){case"function":n=t[r.length](this,e);break;case"string":n=s(t[r.length],this,e)}}return void 0!==n?n:s(f.defaultTemplate,this,e)},g.prototype.getIdentifier=function(){return this.type+":"+this.name},g}},{"../../utils/array":46,"../../utils/customs":51,"../../utils/latex":53,"../../utils/object":55,"../../utils/string":57,"./Node":24,"./SymbolNode":30}],23:[function(s,t,e){"use strict";var u=s("../../utils/array").map,p=s("../../utils/string").escape;e.name="IndexNode",e.path="expression.node",e.factory=function(m,t,e,n){var r=e(s("./Node")),o=e(s("../../type/matrix/Range")),i=Array.isArray;function a(t,e){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(this.dimensions=t,this.dotNotation=e||!1,!i(t)||!t.every(m.isNode))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties");var n=function(){throw new Error("Property `IndexNode.object` is deprecated, use `IndexNode.fn` instead")};Object.defineProperty(this,"object",{get:n,set:n})}function d(t,e,n){return new o(m.isBigNumber(t)?t.toNumber():t,m.isBigNumber(e)?e.toNumber():e,m.isBigNumber(n)?n.toNumber():n)}return(a.prototype=new r).type="IndexNode",a.prototype.isIndexNode=!0,a.prototype._compile=function(h,l){var o=u(this.dimensions,function(t,i){if(m.isRangeNode(t)){if(t.needsEnd()){var e=Object.create(l);e.end=!0;var a=t.start._compile(h,e),s=t.end._compile(h,e),u=t.step?t.step._compile(h,e):function(){return 1};return function(t,e,n){var r=h.size(n).valueOf(),o=Object.create(e);return o.end=r[i],d(a(t,o,n),s(t,o,n),u(t,o,n))}}var r=t.start._compile(h,l),o=t.end._compile(h,l),p=t.step?t.step._compile(h,l):function(){return 1};return function(t,e,n){return d(r(t,e,n),o(t,e,n),p(t,e,n))}}if(m.isSymbolNode(t)&&"end"===t.name){var n=Object.create(l);n.end=!0;var c=t._compile(h,n);return function(t,e,n){var r=h.size(n).valueOf(),o=Object.create(e);return o.end=r[i],c(t,o,n)}}var f=t._compile(h,l);return function(t,e,n){return f(t,e,n)}});return function(e,n,r){var t=u(o,function(t){return t(e,n,r)});return h.index.apply(h,t)}},a.prototype.forEach=function(t){for(var e=0;e<this.dimensions.length;e++)t(this.dimensions[e],"dimensions["+e+"]",this)},a.prototype.map=function(t){for(var e=[],n=0;n<this.dimensions.length;n++)e[n]=this._ifNode(t(this.dimensions[n],"dimensions["+n+"]",this));return new a(e)},a.prototype.clone=function(){return new a(this.dimensions.slice(0))},a.prototype.isObjectProperty=function(){return 1===this.dimensions.length&&m.isConstantNode(this.dimensions[0])&&"string"==typeof this.dimensions[0].value},a.prototype.getObjectProperty=function(){return this.isObjectProperty()?this.dimensions[0].value:null},a.prototype._toString=function(t){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"},a.prototype.toJSON=function(){return{mathjs:"IndexNode",dimensions:this.dimensions,dotNotation:this.dotNotation}},a.fromJSON=function(t){return new a(t.dimensions,t.dotNotation)},a.prototype.toHTML=function(t){for(var e=[],n=0;n<this.dimensions.length;n++)e[n]=this.dimensions[n].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+p(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+e.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},a.prototype._toTex=function(e){var t=this.dimensions.map(function(t){return t.toTex(e)});return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"},a}},{"../../type/matrix/Range":41,"../../utils/array":46,"../../utils/string":57,"./Node":24}],24:[function(t,e,n){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=t("../keywords"),u=t("../../utils/object").deepEqual,p=t("../../utils/object").hasOwnProperty;n.name="Node",n.path="expression.node",n.math=!0,n.factory=function(e,t,n,r,o){function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator")}return i.prototype.eval=function(t){return this.compile().eval(t)},i.prototype.type="Node",i.prototype.isNode=!0,i.prototype.comment="",i.prototype.compile=function(){var n=this._compile(o.expression.mathWithTransform,{}),r={};return{eval:function(t){var e=t||{};return function(t){for(var e in t)if(p(t,e)&&e in s)throw new Error('Scope contains an illegal symbol, "'+e+'" is a reserved keyword')}(e),n(e,r,null)}}},i.prototype._compile=function(t,e){throw new Error("Method _compile should be implemented by type "+this.type)},i.prototype.forEach=function(t){throw new Error("Cannot run forEach on a Node interface")},i.prototype.map=function(t){throw new Error("Cannot run map on a Node interface")},i.prototype._ifNode=function(t){if(!e.isNode(t))throw new TypeError("Callback function must return a Node");return t},i.prototype.traverse=function(t){t(this,null,null),function r(t,o){t.forEach(function(t,e,n){o(t,e,n),r(t,o)})}(this,t)},i.prototype.transform=function(t){return function r(t,o){return t.map(function(t,e,n){return r(o(t,e,n),o)})}(t(this,null,null),t)},i.prototype.filter=function(r){var o=[];return this.traverse(function(t,e,n){r(t,e,n)&&o.push(t)}),o},i.prototype.find=function(){throw new Error("Function Node.find is deprecated. Use Node.filter instead.")},i.prototype.match=function(){throw new Error("Function Node.match is deprecated. See functions Node.filter, Node.transform, Node.traverse.")},i.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},i.prototype.cloneDeep=function(){return this.map(function(t){return t.cloneDeep()})},i.prototype.equals=function(t){return!!t&&u(this,t)},i.prototype.toString=function(t){var e;if(t&&"object"===a(t))switch(a(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this._toString(t)},i.prototype.toJSON=function(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)},i.prototype.toHTML=function(t){var e;if(t&&"object"===a(t))switch(a(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this.toHTML(t)},i.prototype._toString=function(){throw new Error("_toString not implemented for "+this.type)},i.prototype.toTex=function(t){var e;if(t&&"object"===a(t))switch(a(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this._toTex(t)},i.prototype._toTex=function(t){throw new Error("_toTex not implemented for "+this.type)},i.prototype.getIdentifier=function(){return this.type},i.prototype.getContent=function(){return this},i}},{"../../utils/object":55,"../keywords":14}],25:[function(a,t,e){"use strict";function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var u=a("../../utils/string").stringify,p=a("../../utils/string").escape,c=a("../../utils/customs").isSafeProperty,f=a("../../utils/object").hasOwnProperty;e.name="ObjectNode",e.path="expression.node",e.factory=function(n,t,e,r){var o=e(a("./Node"));function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(this.properties=e||{},e&&("object"!==s(e)||!Object.keys(e).every(function(t){return n.isNode(e[t])})))throw new TypeError("Object containing Nodes expected")}return(i.prototype=new o).type="ObjectNode",i.prototype.isObjectNode=!0,i.prototype._compile=function(t,e){var i={};for(var n in this.properties)if(f(this.properties,n)){var r=u(n),o=JSON.parse(r);if(!c(this.properties,o))throw new Error('No access to property "'+o+'"');i[o]=this.properties[n]._compile(t,e)}return function(t,e,n){var r={};for(var o in i)f(i,o)&&(r[o]=i[o](t,e,n));return r}},i.prototype.forEach=function(t){for(var e in this.properties)this.properties.hasOwnProperty(e)&&t(this.properties[e],"properties["+u(e)+"]",this)},i.prototype.map=function(t){var e={};for(var n in this.properties)this.properties.hasOwnProperty(n)&&(e[n]=this._ifNode(t(this.properties[n],"properties["+u(n)+"]",this)));return new i(e)},i.prototype.clone=function(){var t={};for(var e in this.properties)this.properties.hasOwnProperty(e)&&(t[e]=this.properties[e]);return new i(t)},i.prototype._toString=function(t){var e=[];for(var n in this.properties)this.properties.hasOwnProperty(n)&&e.push(u(n)+": "+this.properties[n].toString(t));return"{"+e.join(", ")+"}"},i.prototype.toJSON=function(){return{mathjs:"ObjectNode",properties:this.properties}},i.fromJSON=function(t){return new i(t.properties)},i.prototype.toHTML=function(t){var e=[];for(var n in this.properties)this.properties.hasOwnProperty(n)&&e.push('<span class="math-symbol math-property">'+p(n)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[n].toHTML(t));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+e.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'},i.prototype._toTex=function(t){var e=[];for(var n in this.properties)this.properties.hasOwnProperty(n)&&e.push("\\mathbf{"+n+":} & "+this.properties[n].toTex(t)+"\\\\");return"\\left\\{\\begin{array}{ll}".concat(e.join("\n"),"\\end{array}\\right\\}")},i}},{"../../utils/customs":51,"../../utils/object":55,"../../utils/string":57,"./Node":24}],26:[function(a,t,e){"use strict";var m=a("../../utils/latex"),s=a("../../utils/array").map,c=a("../../utils/string").escape,u=a("../../utils/customs").isSafeMethod,p=a("../../utils/customs").getSafeProperty,x=a("../operators");e.name="OperatorNode",e.path="expression.node",e.factory=function(o,t,e,n){var r=e(a("./Node"));function i(t,e,n,r){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof t)throw new TypeError('string expected for parameter "op"');if("string"!=typeof e)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(n)||!n.every(o.isNode))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===r,this.op=t,this.fn=e,this.args=n||[]}function l(o,i,t,e,n){var r,a=x.getPrecedence(o,i),s=x.getAssociativity(o,i);if("all"===i||2<e.length&&"OperatorNode:add"!==o.getIdentifier()&&"OperatorNode:multiply"!==o.getIdentifier())return e.map(function(t){switch(t.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});switch(e.length){case 0:r=[];break;case 1:var u=x.getPrecedence(e[0],i);if(n&&null!==u){var p,c;if(c="keep"===i?(p=e[0].getIdentifier(),o.getIdentifier()):(p=e[0].getContent().getIdentifier(),o.getContent().getIdentifier()),!1===x.properties[a][c].latexLeftParens){r=[!1];break}if(!1===x.properties[u][p].latexParens){r=[!1];break}}if(null===u){r=[!1];break}if(u<=a){r=[!0];break}r=[!1];break;case 2:var f,h,l=x.getPrecedence(e[0],i),m=x.isAssociativeWith(o,e[0],i);f=null!==l&&(l===a&&"right"===s&&!m||l<a);var d,y,g,v=x.getPrecedence(e[1],i),b=x.isAssociativeWith(o,e[1],i);h=null!==v&&(v===a&&"left"===s&&!b||v<a),n&&(g="keep"===i?(d=o.getIdentifier(),y=o.args[0].getIdentifier(),o.args[1].getIdentifier()):(d=o.getContent().getIdentifier(),y=o.args[0].getContent().getIdentifier(),o.args[1].getContent().getIdentifier()),null!==l&&(!1===x.properties[a][d].latexLeftParens&&(f=!1),!1===x.properties[l][y].latexParens&&(f=!1)),null!==v&&(!1===x.properties[a][d].latexRightParens&&(h=!1),!1===x.properties[v][g].latexParens&&(h=!1))),r=[f,h];break;default:"OperatorNode:add"!==o.getIdentifier()&&"OperatorNode:multiply"!==o.getIdentifier()||(r=e.map(function(t){var e=x.getPrecedence(t,i),n=x.isAssociativeWith(o,t,i),r=x.getAssociativity(t,i);return null!==e&&(a===e&&s===r&&!n||e<a)}))}return 2<=e.length&&"OperatorNode:multiply"===o.getIdentifier()&&o.implicit&&"auto"===i&&"hide"===t&&(r=e.map(function(t,e){var n="ParenthesisNode"===t.getIdentifier();return!(!r[e]&&!n)})),r}return(i.prototype=new r).type="OperatorNode",i.prototype.isOperatorNode=!0,i.prototype._compile=function(e,n){if("string"!=typeof this.fn||!u(e,this.fn))throw e[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var o=p(e,this.fn),t=s(this.args,function(t){return t._compile(e,n)});if(1===t.length){var r=t[0];return function(t,e,n){return o(r(t,e,n))}}if(2!==t.length)return function(e,n,r){return o.apply(null,s(t,function(t){return t(e,n,r)}))};var i=t[0],a=t[1];return function(t,e,n){return o(i(t,e,n),a(t,e,n))}},i.prototype.forEach=function(t){for(var e=0;e<this.args.length;e++)t(this.args[e],"args["+e+"]",this)},i.prototype.map=function(t){for(var e=[],n=0;n<this.args.length;n++)e[n]=this._ifNode(t(this.args[n],"args["+n+"]",this));return new i(this.op,this.fn,e,this.implicit)},i.prototype.clone=function(){return new i(this.op,this.fn,this.args.slice(0),this.implicit)},i.prototype.isUnary=function(){return 1===this.args.length},i.prototype.isBinary=function(){return 2===this.args.length},i.prototype._toString=function(n){var t=n&&n.parenthesis?n.parenthesis:"keep",e=n&&n.implicit?n.implicit:"hide",r=this.args,o=l(this,t,e,r,!1);if(1===r.length){var i=x.getAssociativity(this,t),a=r[0].toString(n);return o[0]&&(a="("+a+")"),"right"===i?this.op+a:a+this.op}if(2===r.length){var s=r[0].toString(n),u=r[1].toString(n);return o[0]&&(s="("+s+")"),o[1]&&(u="("+u+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===e?s+" "+u:s+" "+this.op+" "+u}if(2<r.length&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var p=r.map(function(t,e){return t=t.toString(n),o[e]&&(t="("+t+")"),t});return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===e?p.join(" "):p.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"},i.prototype.toJSON=function(){return{mathjs:"OperatorNode",op:this.op,fn:this.fn,args:this.args,implicit:this.implicit}},i.fromJSON=function(t){return new i(t.op,t.fn,t.args,t.implicit)},i.prototype.toHTML=function(n){var t=n&&n.parenthesis?n.parenthesis:"keep",e=n&&n.implicit?n.implicit:"hide",r=this.args,o=l(this,t,e,r,!1);if(1===r.length){var i=x.getAssociativity(this,t),a=r[0].toHTML(n);return o[0]&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===i?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+c(this.op)+"</span>"+a:'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+c(this.op)+"</span>"+a}if(2===r.length){var s=r[0].toHTML(n),u=r[1].toHTML(n);return o[0]&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),o[1]&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===e?s+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+u:s+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+c(this.op)+"</span>"+u}var p=r.map(function(t,e){return t=t.toHTML(n),o[e]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t});return 2<r.length&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===e?p.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):p.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+c(this.op)+"</span>"):'<span class="math-function">'+c(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+p.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'},i.prototype._toTex=function(n){var t=n&&n.parenthesis?n.parenthesis:"keep",e=n&&n.implicit?n.implicit:"hide",r=this.args,o=l(this,t,e,r,!0),i=m.operators[this.fn];if(i=void 0===i?this.op:i,1===r.length){var a=x.getAssociativity(this,t),s=r[0].toTex(n);return o[0]&&(s="\\left(".concat(s,"\\right)")),"right"===a?i+s:s+i}if(2===r.length){var u=r[0],p=u.toTex(n);o[0]&&(p="\\left(".concat(p,"\\right)"));var c,f=r[1].toTex(n);switch(o[1]&&(f="\\left(".concat(f,"\\right)")),c="keep"===t?u.getIdentifier():u.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return i+"{"+p+"}{"+f+"}";case"OperatorNode:pow":switch(p="{"+p+"}",f="{"+f+"}",c){case"ConditionalNode":case"OperatorNode:divide":p="\\left(".concat(p,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===e)return p+"~"+f}return p+i+f}if(2<r.length&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var h=r.map(function(t,e){return t=t.toTex(n),o[e]&&(t="\\left(".concat(t,"\\right)")),t});return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit?h.join("~"):h.join(i)}return"\\mathrm{"+this.fn+"}\\left("+r.map(function(t){return t.toTex(n)}).join(",")+"\\right)"},i.prototype.getIdentifier=function(){return this.type+":"+this.fn},i}},{"../../utils/array":46,"../../utils/customs":51,"../../utils/latex":53,"../../utils/string":57,"../operators":33,"./Node":24}],27:[function(a,t,e){"use strict";e.name="ParenthesisNode",e.path="expression.node",e.factory=function(e,t,n,r){var o=n(a("./Node"));function i(t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!e.isNode(t))throw new TypeError('Node expected for parameter "content"');this.content=t}return(i.prototype=new o).type="ParenthesisNode",i.prototype.isParenthesisNode=!0,i.prototype._compile=function(t,e){return this.content._compile(t,e)},i.prototype.getContent=function(){return this.content.getContent()},i.prototype.forEach=function(t){t(this.content,"content",this)},i.prototype.map=function(t){return new i(t(this.content,"content",this))},i.prototype.clone=function(){return new i(this.content)},i.prototype._toString=function(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?"("+this.content.toString(t)+")":this.content.toString(t)},i.prototype.toJSON=function(){return{mathjs:"ParenthesisNode",content:this.content}},i.fromJSON=function(t){return new i(t.content)},i.prototype.toHTML=function(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(t)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(t)},i.prototype._toTex=function(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?"\\left(".concat(this.content.toTex(t),"\\right)"):this.content.toTex(t)},i}},{"./Node":24}],28:[function(s,t,e){"use strict";var u=s("../operators");e.name="RangeNode",e.path="expression.node",e.factory=function(r,t,e,n){var o=e(s("./Node"));function i(t,e,n){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!r.isNode(t))throw new TypeError("Node expected");if(!r.isNode(e))throw new TypeError("Node expected");if(n&&!r.isNode(n))throw new TypeError("Node expected");if(3<arguments.length)throw new Error("Too many arguments");this.start=t,this.end=e,this.step=n||null}function a(t,e){var n=u.getPrecedence(t,e),r={},o=u.getPrecedence(t.start,e);if(r.start=null!==o&&o<=n||"all"===e,t.step){var i=u.getPrecedence(t.step,e);r.step=null!==i&&i<=n||"all"===e}var a=u.getPrecedence(t.end,e);return r.end=null!==a&&a<=n||"all"===e,r}return(i.prototype=new o).type="RangeNode",i.prototype.isRangeNode=!0,i.prototype.needsEnd=function(){return 0<this.filter(function(t){return r.isSymbolNode(t)&&"end"===t.name}).length},i.prototype._compile=function(t,e){var r=t.range,o=this.start._compile(t,e),i=this.end._compile(t,e);if(this.step){var a=this.step._compile(t,e);return function(t,e,n){return r(o(t,e,n),i(t,e,n),a(t,e,n))}}return function(t,e,n){return r(o(t,e,n),i(t,e,n))}},i.prototype.forEach=function(t){t(this.start,"start",this),t(this.end,"end",this),this.step&&t(this.step,"step",this)},i.prototype.map=function(t){return new i(this._ifNode(t(this.start,"start",this)),this._ifNode(t(this.end,"end",this)),this.step&&this._ifNode(t(this.step,"step",this)))},i.prototype.clone=function(){return new i(this.start,this.end,this.step&&this.step)},i.prototype._toString=function(t){var e,n=a(this,t&&t.parenthesis?t.parenthesis:"keep"),r=this.start.toString(t);if(n.start&&(r="("+r+")"),e=r,this.step){var o=this.step.toString(t);n.step&&(o="("+o+")"),e+=":"+o}var i=this.end.toString(t);return n.end&&(i="("+i+")"),e+=":"+i},i.prototype.toJSON=function(){return{mathjs:"RangeNode",start:this.start,end:this.end,step:this.step}},i.fromJSON=function(t){return new i(t.start,t.end,t.step)},i.prototype.toHTML=function(t){var e,n=a(this,t&&t.parenthesis?t.parenthesis:"keep"),r=this.start.toHTML(t);if(n.start&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e=r,this.step){var o=this.step.toHTML(t);n.step&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e+='<span class="math-operator math-range-operator">:</span>'+o}var i=this.end.toHTML(t);return n.end&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e+='<span class="math-operator math-range-operator">:</span>'+i},i.prototype._toTex=function(t){var e=a(this,t&&t.parenthesis?t.parenthesis:"keep"),n=this.start.toTex(t);if(e.start&&(n="\\left(".concat(n,"\\right)")),this.step){var r=this.step.toTex(t);e.step&&(r="\\left(".concat(r,"\\right)")),n+=":"+r}var o=this.end.toTex(t);return e.end&&(o="\\left(".concat(o,"\\right)")),n+=":"+o},i}},{"../operators":33,"./Node":24}],29:[function(a,t,e){"use strict";var s=a("../operators"),u=a("../../utils/latex"),c=a("../../utils/string").escape;e.name="RelationalNode",e.path="expression.node",e.factory=function(t,e,n,r){var o=n(a("./Node")),p=a("../../utils/customs").getSafeProperty;function i(t,e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(t))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(e))throw new TypeError("Parameter params must be an array");if(t.length!==e.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=t,this.params=e}return(i.prototype=new o).type="RelationalNode",i.prototype.isRelationalNode=!0,i.prototype._compile=function(a,e){var s=this,u=this.params.map(function(t){return t._compile(a,e)});return function(t,e,n){for(var r,o=u[0](t,e,n),i=0;i<s.conditionals.length;i++)if(r=o,o=u[i+1](t,e,n),!p(a,s.conditionals[i])(r,o))return!1;return!0}},i.prototype.forEach=function(n){var r=this;this.params.forEach(function(t,e){return n(t,"params["+e+"]",r)},this)},i.prototype.map=function(n){var r=this;return new i(this.conditionals.slice(),this.params.map(function(t,e){return r._ifNode(n(t,"params["+e+"]",r))},this))},i.prototype.clone=function(){return new i(this.conditionals,this.params)},i.prototype._toString=function(r){for(var o=r&&r.parenthesis?r.parenthesis:"keep",i=s.getPrecedence(this,o),t=this.params.map(function(t,e){var n=s.getPrecedence(t,o);return"all"===o||null!==n&&n<=i?"("+t.toString(r)+")":t.toString(r)}),e={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},n=t[0],a=0;a<this.conditionals.length;a++)n+=" "+e[this.conditionals[a]]+" "+t[a+1];return n},i.prototype.toJSON=function(){return{mathjs:"RelationalNode",conditionals:this.conditionals,params:this.params}},i.fromJSON=function(t){return new i(t.conditionals,t.params)},i.prototype.toHTML=function(r){for(var o=r&&r.parenthesis?r.parenthesis:"keep",i=s.getPrecedence(this,o),t=this.params.map(function(t,e){var n=s.getPrecedence(t,o);return"all"===o||null!==n&&n<=i?'<span class="math-parenthesis math-round-parenthesis">(</span>'+t.toHTML(r)+'<span class="math-parenthesis math-round-parenthesis">)</span>':t.toHTML(r)}),e={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},n=t[0],a=0;a<this.conditionals.length;a++)n+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+c(e[this.conditionals[a]])+"</span>"+t[a+1];return n},i.prototype._toTex=function(r){for(var o=r&&r.parenthesis?r.parenthesis:"keep",i=s.getPrecedence(this,o),t=this.params.map(function(t,e){var n=s.getPrecedence(t,o);return"all"===o||null!==n&&n<=i?"\\left("+t.toString(r)+"\right)":t.toString(r)}),e=t[0],n=0;n<this.conditionals.length;n++)e+=u.operators[this.conditionals[n]]+t[n+1];return e},i}},{"../../utils/customs":51,"../../utils/latex":53,"../../utils/string":57,"../operators":33,"./Node":24}],30:[function(u,t,e){"use strict";var p=u("../../utils/latex"),c=u("../../utils/string").escape,f=u("../../utils/object").hasOwnProperty,h=u("../../utils/customs").getSafeProperty;e.name="SymbolNode",e.path="expression.node",e.math=!0,e.factory=function(a,t,e,n,r){var o=e(u("./Node"));function s(t){return!!a.Unit&&a.Unit.isValuelessUnit(t)}function i(t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof t)throw new TypeError('String expected for parameter "name"');this.name=t}return(i.prototype=new o).type="SymbolNode",i.prototype.isSymbolNode=!0,i.prototype._compile=function(r,t){var o=this.name;if(f(t,o))return function(t,e,n){return e[o]};if(o in r)return function(t,e,n){return h(o in t?t:r,o)};var i=s(o);return function(t,e,n){return o in t?h(t,o):i?new a.Unit(null,o):function(t){throw new Error("Undefined symbol "+t)}(o)}},i.prototype.forEach=function(t){},i.prototype.map=function(t){return this.clone()},i.prototype.clone=function(){return new i(this.name)},i.prototype._toString=function(t){return this.name},i.prototype.toHTML=function(t){var e=c(this.name);return"true"===e||"false"===e?'<span class="math-symbol math-boolean">'+e+"</span>":"i"===e?'<span class="math-symbol math-imaginary-symbol">'+e+"</span>":"Infinity"===e?'<span class="math-symbol math-infinity-symbol">'+e+"</span>":"NaN"===e?'<span class="math-symbol math-nan-symbol">'+e+"</span>":"null"===e?'<span class="math-symbol math-null-symbol">'+e+"</span>":"undefined"===e?'<span class="math-symbol math-undefined-symbol">'+e+"</span>":'<span class="math-symbol">'+e+"</span>"},i.prototype.toJSON=function(){return{mathjs:"SymbolNode",name:this.name}},i.fromJSON=function(t){return new i(t.name)},i.prototype._toTex=function(t){var e=!1;void 0===r[this.name]&&s(this.name)&&(e=!0);var n=p.toSymbol(this.name,e);return"\\"===n[0]?n:" "+n},i}},{"../../utils/customs":51,"../../utils/latex":53,"../../utils/object":55,"../../utils/string":57,"./Node":24}],31:[function(i,t,e){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=i("../../transform/error.transform").transform,u=i("../../../utils/customs").getSafeProperty;e.factory=function(t,e,n,r){var o=n(i("../../../function/matrix/subset"));return function(t,e){try{if(Array.isArray(t))return o(t,e);if(t&&"function"==typeof t.subset)return t.subset(e);if("string"==typeof t)return o(t,e);if("object"!==a(t))throw new TypeError("Cannot apply index: unsupported type of object");if(!e.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return u(t,e.getObjectProperty())}catch(t){throw s(t)}}}},{"../../../function/matrix/subset":36,"../../../utils/customs":51,"../../transform/error.transform":35}],32:[function(a,t,e){"use strict";function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var u=a("../../transform/error.transform").transform,p=a("../../../utils/customs").setSafeProperty;e.factory=function(t,e,n,r){var o=n(a("../../../function/matrix/subset")),i=n(a("../../../type/matrix/function/matrix"));return function(t,e,n){try{if(Array.isArray(t))return i(t).subset(e,n).valueOf();if(t&&"function"==typeof t.subset)return t.subset(e,n);if("string"==typeof t)return o(t,e,n);if("object"!==s(t))throw new TypeError("Cannot apply index: unsupported type of object");if(!e.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return p(t,e.getObjectProperty(),n),t}catch(t){throw u(t)}}}},{"../../../function/matrix/subset":36,"../../../type/matrix/function/matrix":42,"../../../utils/customs":51,"../../transform/error.transform":35}],33:[function(t,e,n){"use strict";var c=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{associativity:"left",associativeWith:[]}},{"OperatorNode:and":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{associativity:"left",associativeWith:[]},"OperatorNode:unequal":{associativity:"left",associativeWith:[]},"OperatorNode:smaller":{associativity:"left",associativeWith:[]},"OperatorNode:larger":{associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{associativity:"left",associativeWith:[]}},{"OperatorNode:to":{associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{associativity:"left",associativeWith:[]},"OperatorNode:mod":{associativity:"left",associativeWith:[]}},{"OperatorNode:unaryPlus":{associativity:"right"},"OperatorNode:unaryMinus":{associativity:"right"},"OperatorNode:bitNot":{associativity:"right"},"OperatorNode:not":{associativity:"right"}},{"OperatorNode:pow":{associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{associativity:"left"}},{"OperatorNode:transpose":{associativity:"left"}}];function f(t,e){var n=t;"keep"!==e&&(n=t.getContent());for(var r=n.getIdentifier(),o=0;o<c.length;o++)if(r in c[o])return o;return null}e.exports.properties=c,e.exports.getPrecedence=f,e.exports.getAssociativity=function(t,e){var n=t;"keep"!==e&&(n=t.getContent());var r=n.getIdentifier(),o=f(n,e);if(null===o)return null;var i=c[o][r];if(i.hasOwnProperty("associativity")){if("left"===i.associativity)return"left";if("right"===i.associativity)return"right";throw Error("'"+r+"' has the invalid associativity '"+i.associativity+"'.")}return null},e.exports.isAssociativeWith=function(t,e,n){var r="keep"!==n?t.getContent():t,o="keep"!==n?t.getContent():e,i=r.getIdentifier(),a=o.getIdentifier(),s=f(r,n);if(null===s)return null;var u=c[s][i];if(u.hasOwnProperty("associativeWith")&&u.associativeWith instanceof Array){for(var p=0;p<u.associativeWith.length;p++)if(u.associativeWith[p]===a)return!0;return!1}return null}},{}],34:[function(ot,t,e){"use strict";function it(){return(it=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var at=ot("../error/ArgumentsError"),st=ot("../utils/collection/deepMap");e.name="parse",e.path="expression",e.factory=function(a,h,t,e){var l=t(ot("../type/numeric")),o=t(ot("./node/AccessorNode")),m=t(ot("./node/ArrayNode")),s=t(ot("./node/AssignmentNode")),i=t(ot("./node/BlockNode")),u=t(ot("./node/ConditionalNode")),d=t(ot("./node/ConstantNode")),p=t(ot("./node/FunctionAssignmentNode")),c=t(ot("./node/IndexNode")),y=t(ot("./node/ObjectNode")),f=t(ot("./node/OperatorNode")),g=t(ot("./node/ParenthesisNode")),v=t(ot("./node/FunctionNode")),r=t(ot("./node/RangeNode")),b=t(ot("./node/RelationalNode")),x=t(ot("./node/SymbolNode"));function w(t,e){if(1!==arguments.length&&2!==arguments.length)throw new at("parse",arguments.length,1,2);var n=e&&e.nodes?e.nodes:{};if("string"==typeof t)return D(t,n);if(Array.isArray(t)||t instanceof a.Matrix)return st(t,function(t){if("string"!=typeof t)throw new TypeError("String expected");return D(t,n)});throw new TypeError("String or matrix expected")}var N={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},E={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},O={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},S={true:!0,false:!1,null:null,undefined:void 0},j=["NaN","Infinity"];function k(t,e){return t.expression.substr(t.index,e)}function T(t){return k(t,1)}function A(t){t.index++}function P(t){return t.expression.charAt(t.index-1)}function M(t){return t.expression.charAt(t.index+1)}function C(t){for(t.tokenType=N.NULL,t.token="",t.comment="";w.isWhitespace(T(t),t.nestingLevel);)A(t);if("#"===T(t))for(;"\n"!==T(t)&&""!==T(t);)t.comment+=T(t),A(t);if(""!==T(t)){if("\n"===T(t)&&!t.nestingLevel)return t.tokenType=N.DELIMITER,t.token=T(t),void A(t);var e=T(t),n=k(t,2),r=k(t,3);if(3===r.length&&E[r])return t.tokenType=N.DELIMITER,t.token=r,A(t),A(t),void A(t);if(2===n.length&&E[n])return t.tokenType=N.DELIMITER,t.token=n,A(t),void A(t);if(E[e])return t.tokenType=N.DELIMITER,t.token=e,void A(t);if(w.isDigitDot(e)){if(t.tokenType=N.NUMBER,"."===T(t))t.token+=T(t),A(t),w.isDigit(T(t))||(t.tokenType=N.DELIMITER);else{for(;w.isDigit(T(t));)t.token+=T(t),A(t);w.isDecimalMark(T(t),M(t))&&(t.token+=T(t),A(t))}for(;w.isDigit(T(t));)t.token+=T(t),A(t);if("E"===T(t)||"e"===T(t))if(w.isDigit(M(t))||"-"===M(t)||"+"===M(t)){if(t.token+=T(t),A(t),"+"!==T(t)&&"-"!==T(t)||(t.token+=T(t),A(t)),!w.isDigit(T(t)))throw nt(t,'Digit expected, got "'+T(t)+'"');for(;w.isDigit(T(t));)t.token+=T(t),A(t);if(w.isDecimalMark(T(t),M(t)))throw nt(t,'Digit expected, got "'+T(t)+'"')}else if("."===M(t))throw A(t),nt(t,'Digit expected, got "'+T(t)+'"')}else{if(!w.isAlpha(T(t),P(t),M(t))){for(t.tokenType=N.UNKNOWN;""!==T(t);)t.token+=T(t),A(t);throw nt(t,'Syntax error in part "'+t.token+'"')}for(;w.isAlpha(T(t),P(t),M(t))||w.isDigit(T(t));)t.token+=T(t),A(t);O.hasOwnProperty(t.token)?t.tokenType=N.DELIMITER:t.tokenType=N.SYMBOL}}else t.tokenType=N.DELIMITER}function I(t){for(;C(t),"\n"===t.token;);}function F(t){t.nestingLevel++}function _(t){t.nestingLevel--}function D(t,e){var n={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:N.NULL,nestingLevel:0,conditionalLevel:null};it(n,{expression:t,extraNodes:e}),C(n);var r=function(t){var e,n,r=[];for(""!==t.token&&"\n"!==t.token&&";"!==t.token&&((e=L(t)).comment=t.comment);"\n"===t.token||";"===t.token;)0===r.length&&e&&(n=";"!==t.token,r.push({node:e,visible:n})),C(t),"\n"!==t.token&&";"!==t.token&&""!==t.token&&((e=L(t)).comment=t.comment,n=";"!==t.token,r.push({node:e,visible:n}));return 0<r.length?new i(r):(e||((e=new d(void 0)).comment=t.comment),e)}(n);if(""!==n.token)throw n.tokenType===N.DELIMITER?rt(n,"Unexpected operator "+n.token):nt(n,'Unexpected part "'+n.token+'"');return r}function L(t){var e,n,r,o,i=function(t){for(var e=function(t){for(var e=R(t);"or"===t.token;)I(t),e=new f("or","or",[e,R(t)]);return e}(t);"?"===t.token;){var n=t.conditionalLevel;t.conditionalLevel=t.nestingLevel,I(t);var r=e,o=L(t);if(":"!==t.token)throw nt(t,"False part of conditional expression expected");t.conditionalLevel=null,I(t);var i=L(t);e=new u(r,o,i),t.conditionalLevel=n}return e}(t);if("="!==t.token)return i;if(a.isSymbolNode(i))return e=i.name,I(t),r=L(t),new s(new x(e),r);if(a.isAccessorNode(i))return I(t),r=L(t),new s(i.object,i.index,r);if(a.isFunctionNode(i)&&a.isSymbolNode(i.fn)&&(o=!0,n=[],e=i.name,i.args.forEach(function(t,e){a.isSymbolNode(t)?n[e]=t.name:o=!1}),o))return I(t),r=L(t),new p(e,n,r);throw nt(t,"Invalid left hand side of assignment operator =")}function R(t){for(var e=n(t);"xor"===t.token;)I(t),e=new f("xor","xor",[e,n(t)]);return e}function n(t){for(var e=B(t);"and"===t.token;)I(t),e=new f("and","and",[e,B(t)]);return e}function B(t){for(var e=W(t);"|"===t.token;)I(t),e=new f("|","bitOr",[e,W(t)]);return e}function W(t){for(var e=H(t);"^|"===t.token;)I(t),e=new f("^|","bitXor",[e,H(t)]);return e}function H(t){for(var e=q(t);"&"===t.token;)I(t),e=new f("&","bitAnd",[e,q(t)]);return e}function q(t){for(var e=[U(t)],n=[],r={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};r.hasOwnProperty(t.token);){var o={name:t.token,fn:r[t.token]};n.push(o),I(t),e.push(U(t))}return 1===e.length?e[0]:2===e.length?new f(n[0].name,n[0].fn,e):new b(n.map(function(t){return t.fn}),e)}function U(t){var e,n,r,o,i;for(e=J(t),n={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};n.hasOwnProperty(t.token);)o=n[r=t.token],I(t),i=[e,J(t)],e=new f(r,o,i);return e}function J(t){var e,n,r,o,i;for(e=z(t),n={to:"to",in:"to"};n.hasOwnProperty(t.token);)o=n[r=t.token],I(t),e="in"===r&&""===t.token?new f("*","multiply",[e,new x("in")],!0):(i=[e,z(t)],new f(r,o,i));return e}function z(t){var e,n=[];if(e=":"===t.token?new d(1):$(t),":"===t.token&&t.conditionalLevel!==t.nestingLevel){for(n.push(e);":"===t.token&&n.length<3;)I(t),")"===t.token||"]"===t.token||","===t.token||""===t.token?n.push(new x("end")):n.push($(t));e=3===n.length?new r(n[0],n[2],n[1]):new r(n[0],n[1])}return e}function $(t){var e,n,r,o,i;for(e=V(t),n={"+":"add","-":"subtract"};n.hasOwnProperty(t.token);)o=n[r=t.token],I(t),i=[e,V(t)],e=new f(r,o,i);return e}function V(t){var e,n,r,o,i;for(n=e=X(t),r={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};r.hasOwnProperty(t.token);)i=r[o=t.token],I(t),n=X(t),e=new f(o,i,[e,n]);return e}function X(t){var e,n;for(n=e=Y(t);t.tokenType===N.SYMBOL||"in"===t.token&&a.isConstantNode(e)||!(t.tokenType!==N.NUMBER||a.isConstantNode(n)||a.isOperatorNode(n)&&"!"!==n.op)||"("===t.token;)n=Y(t),e=new f("*","multiply",[e,n],!0);return e}function Y(t){for(var e=Z(t),n=e,r=[];"/"===t.token&&a.isConstantNode(n);){if(r.push(it({},t)),I(t),t.tokenType!==N.NUMBER){it(t,r.pop());break}if(r.push(it({},t)),I(t),t.tokenType!==N.SYMBOL&&"("!==t.token){r.pop(),it(t,r.pop());break}it(t,r.pop()),r.pop(),n=Z(t),e=new f("/","divide",[e,n])}return e}function Z(t){var e,n,r,o,i,a,s,u,p={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return p.hasOwnProperty(t.token)?(r=p[t.token],e=t.token,I(t),n=[Z(t)],new f(e,r,n)):(i=function(t){var e,n,r,o;for(e=function(t){var e,n,r,o,i,a,s,u,p,c=[];if(t.tokenType===N.SYMBOL&&t.extraNodes.hasOwnProperty(t.token)){var f=t.extraNodes[t.token];if(C(t),"("===t.token){if(c=[],F(t),C(t),")"!==t.token)for(c.push(L(t));","===t.token;)C(t),c.push(L(t));if(")"!==t.token)throw nt(t,"Parenthesis ) expected");_(t),C(t)}return new f(c)}return(e=t).tokenType===N.SYMBOL||e.tokenType===N.DELIMITER&&e.token in O?(r=e.token,C(e),n=S.hasOwnProperty(r)?new d(S[r]):-1!==j.indexOf(r)?new d(l(r,"number")):new x(r),n=G(e,n)):'"'!==(o=e).token?"'"!==(s=o).token?function(t){var e,n,r,o;if("["!==t.token)return function(t){if("{"!==t.token)return(e=t).tokenType!==N.NUMBER?function(t){var e;if("("!==t.token)return function(t){throw""===t.token?nt(t,"Unexpected end of expression"):nt(t,"Value expected")}(t);if(F(t),C(t),e=L(t),")"===t.token)return _(t),C(t),e=new g(e),e=G(t,e);throw nt(t,"Parenthesis ) expected")}(e):(n=e.token,C(e),new d(l(n,h.number)));var e,n,r,o={};do{if(C(t),"}"!==t.token){if('"'===t.token)r=K(t);else if("'"===t.token)r=Q(t);else{if(t.tokenType!==N.SYMBOL)throw nt(t,"Symbol or string expected as object key");r=t.token,C(t)}if(":"!==t.token)throw nt(t,"Colon : expected after object key");C(t),o[r]=L(t)}}while(","===t.token);if("}"!==t.token)throw nt(t,"Comma , or bracket } expected after object value");C(t);var i=new y(o);return i=G(t,i)}(t);if(F(t),C(t),"]"!==t.token){var i=tt(t);if(";"===t.token){for(r=1,n=[i];";"===t.token;)C(t),n[r]=tt(t),r++;if("]"!==t.token)throw nt(t,"End of matrix ] expected");_(t),C(t),o=n[0].items.length;for(var a=1;a<r;a++)if(n[a].items.length!==o)throw rt(t,"Column dimensions mismatch ("+n[a].items.length+" !== "+o+")");e=new m(n)}else{if("]"!==t.token)throw nt(t,"End of matrix ] expected");_(t),C(t),e=i}}else _(t),C(t),e=new m([]);return G(t,e)}(s):(p=Q(s),u=new d(p),u=G(s,u)):(a=K(o),i=new d(a),i=G(o,i))}(t),n={"!":"factorial","'":"ctranspose"};n.hasOwnProperty(t.token);)r=t.token,o=n[r],C(t),e=new f(r,o,[e]),e=G(t,e);return e}(o=t),("^"===o.token||".^"===o.token)&&(a=o.token,s="^"===a?"pow":"dotPow",I(o),u=[i,Z(o)],i=new f(a,s,u)),i)}function G(t,e,n){for(var r;!("("!==t.token&&"["!==t.token&&"."!==t.token||n&&-1===n.indexOf(t.token));)if(r=[],"("===t.token){if(!a.isSymbolNode(e)&&!a.isAccessorNode(e))return e;if(F(t),C(t),")"!==t.token)for(r.push(L(t));","===t.token;)C(t),r.push(L(t));if(")"!==t.token)throw nt(t,"Parenthesis ) expected");_(t),C(t),e=new v(e,r)}else if("["===t.token){if(F(t),C(t),"]"!==t.token)for(r.push(L(t));","===t.token;)C(t),r.push(L(t));if("]"!==t.token)throw nt(t,"Parenthesis ] expected");_(t),C(t),e=new o(e,new c(r))}else{if(C(t),t.tokenType!==N.SYMBOL)throw nt(t,"Property name expected after dot");r.push(new d(t.token)),C(t),e=new o(e,new c(r,!0))}return e}function K(t){for(var e="";""!==T(t)&&'"'!==T(t);)"\\"===T(t)&&(e+=T(t),A(t)),e+=T(t),A(t);if(C(t),'"'!==t.token)throw nt(t,'End of string " expected');return C(t),JSON.parse('"'+e+'"')}function Q(t){for(var e="";""!==T(t)&&"'"!==T(t);)"\\"===T(t)&&(e+=T(t),A(t)),e+=T(t),A(t);if(C(t),"'"!==t.token)throw nt(t,"End of string ' expected");return C(t),JSON.parse('"'+e+'"')}function tt(t){for(var e=[L(t)],n=1;","===t.token;)C(t),e[n]=L(t),n++;return new m(e)}function et(t){return t.index-t.token.length+1}function nt(t,e){var n=et(t),r=new SyntaxError(e+" (char "+n+")");return r.char=n,r}function rt(t,e){var n=et(t),r=new SyntaxError(e+" (char "+n+")");return r.char=n,r}return w.isAlpha=function(t,e,n){return w.isValidLatinOrGreek(t)||w.isValidMathSymbol(t,n)||w.isValidMathSymbol(e,t)},w.isValidLatinOrGreek=function(t){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(t)},w.isValidMathSymbol=function(t,e){return/^[\uD835]$/.test(t)&&/^[\uDC00-\uDFFF]$/.test(e)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(e)},w.isWhitespace=function(t,e){return" "===t||"\t"===t||"\n"===t&&0<e},w.isDecimalMark=function(t,e){return"."===t&&"/"!==e&&"*"!==e&&"^"!==e},w.isDigitDot=function(t){return"0"<=t&&t<="9"||"."===t},w.isDigit=function(t){return"0"<=t&&t<="9"},w}},{"../error/ArgumentsError":8,"../type/numeric":44,"../utils/collection/deepMap":49,"./node/AccessorNode":15,"./node/ArrayNode":16,"./node/AssignmentNode":17,"./node/BlockNode":18,"./node/ConditionalNode":19,"./node/ConstantNode":20,"./node/FunctionAssignmentNode":21,"./node/FunctionNode":22,"./node/IndexNode":23,"./node/ObjectNode":25,"./node/OperatorNode":26,"./node/ParenthesisNode":27,"./node/RangeNode":28,"./node/RelationalNode":29,"./node/SymbolNode":30}],35:[function(t,e,n){"use strict";var r=t("../../error/IndexError");n.transform=function(t){return t&&t.isIndexError?new r(t.index+1,t.min+1,void 0!==t.max?t.max+1:void 0):t}},{"../../error/IndexError":10}],36:[function(s,t,e){"use strict";var u=s("../../utils/object").clone,c=s("../../utils/array").validateIndex,r=s("../../utils/customs").getSafeProperty,i=s("../../utils/customs").setSafeProperty,f=s("../../error/DimensionError");function p(t,e){if(1!==e.size().length)throw new f(e.size(),1);var n=e.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");return r(t,n)}function h(t,e,n){if(1!==e.size().length)throw new f(e.size(),1);var r=e.dimension(0);if("string"!=typeof r)throw new TypeError("String expected as index to retrieve an object property");var o=u(t);return i(o,r,n),o}e.name="subset",e.factory=function(i,t,e,n){var o=e(s("../../type/matrix/function/matrix")),r=n("subset",{"Array, Index":function(t,e){var n=o(t).subset(e);return e.isScalar()?n:n.valueOf()},"Matrix, Index":function(t,e){return t.subset(e)},"Object, Index":p,"string, Index":function(e,t){if(!i.isIndex(t))throw new TypeError("Index expected");if(1!==t.size().length)throw new f(t.size().length,1);var n=e.length;c(t.min()[0],n),c(t.max()[0],n);var r=t.dimension(0),o="";return r.forEach(function(t){o+=e.charAt(t)}),o},"Array, Index, any":function(t,e,n){return o(u(t)).subset(e,n,void 0).valueOf()},"Array, Index, any, any":function(t,e,n,r){return o(u(t)).subset(e,n,r).valueOf()},"Matrix, Index, any":function(t,e,n){return t.clone().subset(e,n)},"Matrix, Index, any, any":function(t,e,n,r){return t.clone().subset(e,n,r)},"string, Index, string":a,"string, Index, string, string":a,"Object, Index, any":h});return r.toTex=void 0,r;function a(t,e,n,r){if(!e||!0!==e.isIndex)throw new TypeError("Index expected");if(1!==e.size().length)throw new f(e.size().length,1);if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";var o=e.dimension(0);if(o.size()[0]!==n.length)throw new f(o.size()[0],n.length);var i=t.length;c(e.min()[0]),c(e.max()[0]);for(var a=[],s=0;s<i;s++)a[s]=t.charAt(s);if(o.forEach(function(t,e){a[t]=n.charAt(e[0])}),a.length>i)for(var u=i-1,p=a.length;u<p;u++)a[u]||(a[u]=r);return a.join("")}}},{"../../error/DimensionError":9,"../../type/matrix/function/matrix":42,"../../utils/array":46,"../../utils/customs":51,"../../utils/object":55}],37:[function(t,e,n){"use strict";var i=t("../../utils/string");n.name="format",n.factory=function(t,e,n,r){var o=r("format",{any:i.format,"any, Object | function | number":i.format});return o.toTex=void 0,o}},{"../../utils/string":57}],38:[function(t,e,n){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}n.name="typeof",n.factory=function(n,t,e,r){var o=r("_typeof",{any:function(t){var e=i(t);return"object"===e?null===t?"null":Array.isArray(t)?"Array":t instanceof Date?"Date":t instanceof RegExp?"RegExp":n.isBigNumber(t)?"BigNumber":n.isComplex(t)?"Complex":n.isFraction(t)?"Fraction":n.isMatrix(t)?"Matrix":n.isUnit(t)?"Unit":n.isIndex(t)?"Index":n.isRange(t)?"Range":n.isResultSet(t)?"ResultSet":n.isNode(t)?t.type:n.isChain(t)?"Chain":n.isHelp(t)?"Help":"Object":"function"===e?"Function":e}});return o.toTex=void 0,o}},{}],39:[function(t,e,n){"use strict";var i=t("../../../utils/collection/deepMap");n.name="bignumber",n.factory=function(e,t,n,r){var o=r("bignumber",{"":function(){return new e.BigNumber(0)},number:function(t){return new e.BigNumber(t+"")},string:function(t){return new e.BigNumber(t)},BigNumber:function(t){return t},Fraction:function(t){return new e.BigNumber(t.n).div(t.d).times(t.s)},null:function(t){return new e.BigNumber(0)},"Array | Matrix":function(t){return i(t,o)}});return o.toTex={0:"0",1:"\\left(${args[0]}\\right)"},o}},{"../../../utils/collection/deepMap":49}],40:[function(t,e,n){"use strict";var i=t("../../../utils/collection/deepMap");n.name="fraction",n.factory=function(n,t,e,r){var o=r("fraction",{number:function(t){if(!isFinite(t)||isNaN(t))throw new Error(t+" cannot be represented as a fraction");return new n.Fraction(t)},string:function(t){return new n.Fraction(t)},"number, number":function(t,e){return new n.Fraction(t,e)},null:function(t){return new n.Fraction(0)},BigNumber:function(t){return new n.Fraction(t.toString())},Fraction:function(t){return t},Object:function(t){return new n.Fraction(t)},"Array | Matrix":function(t){return i(t,o)}});return o}},{"../../../utils/collection/deepMap":49}],41:[function(t,e,n){"use strict";var o=t("../../utils/number");n.name="Range",n.path="type",n.factory=function(a,t,e,n){function s(t,e,n){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");var r=null!=t,o=null!=e,i=null!=n;if(r)if(a.isBigNumber(t))t=t.toNumber();else if("number"!=typeof t)throw new TypeError("Parameter start must be a number");if(o)if(a.isBigNumber(e))e=e.toNumber();else if("number"!=typeof e)throw new TypeError("Parameter end must be a number");if(i)if(a.isBigNumber(n))n=n.toNumber();else if("number"!=typeof n)throw new TypeError("Parameter step must be a number");this.start=r?parseFloat(t):0,this.end=o?parseFloat(e):0,this.step=i?parseFloat(n):1}return s.prototype.type="Range",s.prototype.isRange=!0,s.parse=function(t){if("string"!=typeof t)return null;var e=t.split(":").map(function(t){return parseFloat(t)});if(e.some(function(t){return isNaN(t)}))return null;switch(e.length){case 2:return new s(e[0],e[1]);case 3:return new s(e[0],e[2],e[1]);default:return null}},s.prototype.clone=function(){return new s(this.start,this.end,this.step)},s.prototype.size=function(){var t=0,e=this.start,n=this.step,r=this.end-e;return o.sign(n)===o.sign(r)?t=Math.ceil(r/n):0===r&&(t=0),isNaN(t)&&(t=0),[t]},s.prototype.min=function(){var t=this.size()[0];return 0<t?0<this.step?this.start:this.start+(t-1)*this.step:void 0},s.prototype.max=function(){var t=this.size()[0];return 0<t?0<this.step?this.start+(t-1)*this.step:this.start:void 0},s.prototype.forEach=function(t){var e=this.start,n=this.step,r=this.end,o=0;if(0<n)for(;e<r;)t(e,[o],this),e+=n,o++;else if(n<0)for(;r<e;)t(e,[o],this),e+=n,o++},s.prototype.map=function(r){var o=[];return this.forEach(function(t,e,n){o[e[0]]=r(t,e,n)}),o},s.prototype.toArray=function(){var n=[];return this.forEach(function(t,e){n[e[0]]=t}),n},s.prototype.valueOf=function(){return this.toArray()},s.prototype.format=function(t){var e=o.format(this.start,t);return 1!==this.step&&(e+=":"+o.format(this.step,t)),e+=":"+o.format(this.end,t)},s.prototype.toString=function(){return this.format()},s.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},s.fromJSON=function(t){return new s(t.start,t.end,t.step)},s}},{"../../utils/number":54}],42:[function(t,e,n){"use strict";n.name="matrix",n.factory=function(r,t,e,n){var o=n("matrix",{"":function(){return i([])},string:function(t){return i([],t)},"string, string":function(t,e){return i([],t,e)},Array:function(t){return i(t)},Matrix:function(t){return i(t,t.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});return o.toTex={0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},o;function i(t,e,n){return new(r.Matrix.storage(e||"default"))(t,n)}}},{}],43:[function(t,e,n){"use strict";var i=t("./../utils/collection/deepMap");n.name="number",n.factory=function(t,e,n,r){var o=r("number",{"":function(){return 0},number:function(t){return t},string:function(t){if("NaN"===t)return NaN;var e=Number(t);if(isNaN(e))throw new SyntaxError('String "'+t+'" is no valid number');return e},BigNumber:function(t){return t.toNumber()},Fraction:function(t){return t.valueOf()},Unit:function(t){throw new Error("Second argument with valueless unit expected")},null:function(t){return 0},"Unit, string | Unit":function(t,e){return t.toNumber(e)},"Array | Matrix":function(t){return i(t,o)}});return o.toTex={0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},o}},{"./../utils/collection/deepMap":49}],44:[function(u,t,e){"use strict";e.path="type",e.name="_numeric",e.factory=function(t,e,n,r){var o=n(u("../function/utils/typeof")),i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:n(u("./number")),BigNumber:n(u("./bignumber/function/bignumber")),Fraction:n(u("./fraction/function/fraction"))},s=function(t,e){var n=o(t);if(!(n in i))throw new TypeError("Cannot convert "+t+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(e in a))throw new TypeError("Cannot convert "+t+' to type "'+e+'"; valid output types are '+Object.keys(a).join(", "));return e===n?t:a[e](t)};return s.toTex=function(t,e){return t.args[0].toTex()},s}},{"../function/utils/typeof":38,"./bignumber/function/bignumber":39,"./fraction/function/fraction":40,"./number":43}],45:[function(t,e,n){"use strict";n.name="ResultSet",n.path="type",n.factory=function(t,e,n,r){function o(t){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}return o.prototype.type="ResultSet",o.prototype.isResultSet=!0,o.prototype.valueOf=function(){return this.entries},o.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},o.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},o.fromJSON=function(t){return new o(t.entries)},o}},{}],46:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.size=s,n.validate=function(t,e){if(0===e.length){if(Array.isArray(t))throw new u.default(t.length,0)}else!function t(e,n,r){var o;var i=e.length;if(i!==n[r])throw new u.default(i,n[r]);if(r<n.length-1){var a=r+1;for(o=0;o<i;o++){var s=e[o];if(!Array.isArray(s))throw new u.default(n.length-1,n.length,"<");t(e[o],n,a)}}else for(o=0;o<i;o++)if(Array.isArray(e[o]))throw new u.default(n.length+1,n.length,">")}(t,e,0)},n.validateIndex=function(t,e){if(!o.default.isNumber(t)||!o.default.isInteger(t))throw new TypeError("Index must be an integer (value: "+t+")");if(t<0||"number"==typeof e&&e<=t)throw new r.default(t,e)},n.resize=function(t,e,n){if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Array expected");if(0===e.length)throw new Error("Resizing to scalar is not supported");e.forEach(function(t){if(!o.default.isNumber(t)||!o.default.isInteger(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+i.default.format(e)+")")});var r=void 0!==n?n:0;return function t(e,n,r,o){var i,a,s=e.length,u=n[r],p=Math.min(s,u);if(e.length=u,r<n.length-1){var c=r+1;for(i=0;i<p;i++)a=e[i],Array.isArray(a)||(a=[a],e[i]=a),t(a,n,c,o);for(i=p;i<u;i++)a=[],e[i]=a,t(a,n,c,o)}else{for(i=0;i<p;i++)for(;Array.isArray(e[i]);)e[i]=e[i][0];for(i=p;i<u;i++)e[i]=o}}(t,e,0,r),t},n.reshape=function(e,n){var t,r=p(e);function o(t){return t.reduce(function(t,e){return t*e})}if(!Array.isArray(e)||!Array.isArray(n))throw new TypeError("Array expected");if(0===n.length)throw new u.default(0,o(s(e)),"!=");for(var i=1,a=0;a<n.length;a++)i*=n[a];if(r.length!==i)throw new u.default(o(n),o(s(e)),"!=");try{t=function(t,e){for(var n,r=t,o=e.length-1;0<o;o--){var i=e[o];n=[];for(var a=r.length/i,s=0;s<a;s++)n.push(r.slice(s*i,(s+1)*i));r=n}return r}(r,n)}catch(t){if(t instanceof u.default)throw new u.default(o(n),o(s(e)),"!=");throw t}return t},n.squeeze=function(t,e){var n=e||s(t);for(;Array.isArray(t)&&1===t.length;)t=t[0],n.shift();var r=n.length;for(;1===n[r-1];)r--;r<n.length&&(t=function t(e,n,r){var o,i;if(r<n){var a=r+1;for(o=0,i=e.length;o<i;o++)e[o]=t(e[o],n,a)}else for(;Array.isArray(e);)e=e[0];return e}(t,r,0),n.length=r);return t},n.unsqueeze=function(t,e,n,r){var o=r||s(t);if(n)for(var i=0;i<n;i++)t=[t],o.unshift(1);t=function t(e,n,r){var o,i;if(Array.isArray(e)){var a=r+1;for(o=0,i=e.length;o<i;o++)e[o]=t(e[o],n,a)}else for(var s=r;s<n;s++)e=[e];return e}(t,e,0);for(;o.length<e;)o.push(1);return t},n.flatten=p,n.map=function(t,e){return Array.prototype.map.call(t,e)},n.forEach=function(t,e){Array.prototype.forEach.call(t,e)},n.filter=function(t,e){if(1===s(t).length)return Array.prototype.filter.call(t,e);throw new Error("Only one dimensional matrices supported")},n.filterRegExp=function(t,e){if(1===s(t).length)return Array.prototype.filter.call(t,function(t){return e.test(t)});throw new Error("Only one dimensional matrices supported")},n.join=function(t,e){return Array.prototype.join.call(t,e)},n.identify=function(t){if(!Array.isArray(t))throw new TypeError("Array input expected");if(0===t.length)return t;var e=[],n=0;e[0]={value:t[0],identifier:0};for(var r=1;r<t.length;r++)t[r]===t[r-1]?n++:n=0,e.push({value:t[r],identifier:n});return e},n.generalize=function(t){if(!Array.isArray(t))throw new TypeError("Array input expected");if(0===t.length)return t;for(var e=[],n=0;n<t.length;n++)e.push(t[n].value);return e};var o=a(t("./number")),i=a(t("./string")),u=a(t("../error/DimensionError")),r=a(t("../error/IndexError"));function a(t){return t&&t.__esModule?t:{default:t}}function s(t){for(var e=[];Array.isArray(t);)e.push(t.length),t=t[0];return e}function p(t){if(!Array.isArray(t))return t;var n=[];return t.forEach(function t(e){Array.isArray(e)?e.forEach(t):n.push(e)}),n}},{"../error/DimensionError":9,"../error/IndexError":10,"./number":54,"./string":57}],47:[function(t,e,u){"use strict";var p=t("../object");u.format=function(t,e){if("function"==typeof e)return e(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var n,r="auto";switch(void 0!==e&&(e.notation&&(r=e.notation),"number"==typeof e?n=e:e.precision&&(n=e.precision)),r){case"fixed":return u.toFixed(t,n);case"exponential":return u.toExponential(t,n);case"auto":if(e&&e.exponential&&(void 0!==e.exponential.lower||void 0!==e.exponential.upper)){var o=p.map(e,function(t){return t});return(o.exponential=void 0)!==e.exponential.lower&&(o.lowerExp=Math.round(Math.log(e.exponential.lower)/Math.LN10)),void 0!==e.exponential.upper&&(o.upperExp=Math.round(Math.log(e.exponential.upper)/Math.LN10)),console.warn("Deprecation warning: Formatting options exponential.lower and exponential.upper (minimum and maximum value) are replaced with exponential.lowerExp and exponential.upperExp (minimum and maximum exponent) since version 4.0.0. Replace "+JSON.stringify(e)+" with "+JSON.stringify(o)),u.format(t,o)}var i=e&&void 0!==e.lowerExp?e.lowerExp:-3,a=e&&void 0!==e.upperExp?e.upperExp:5;if(t.isZero())return"0";var s=t.logarithm();return(s.gte(i)&&s.lt(a)?t.toSignificantDigits(n).toFixed():u.toExponential(t,n)).replace(/((\.\d*?)(0+))($|e)/,function(){var t=arguments[2],e=arguments[4];return"."!==t?t+e:e});default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", or "fixed".')}},u.toExponential=function(t,e){return void 0!==e?t.toExponential(e-1):t.toExponential()},u.toFixed=function(t,e){return t.toFixed(e)}},{"../object":55}],48:[function(t,e,n){"use strict";e.exports=function(t){return t&&t.constructor.prototype.isBigNumber||!1}},{}],49:[function(t,e,n){"use strict";e.exports=function e(t,n,r){return t&&"function"==typeof t.map?t.map(function(t){return e(t,n,r)}):n(t)}},{}],50:[function(t,e,n){"use strict";e.exports=function(t){return t&&t.constructor.prototype.isMatrix||!1}},{}],51:[function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=t("./object").hasOwnProperty;function i(t,e){return!(!t||"object"!==r(t))&&(!!o(u,e)||!(e in Object.prototype)&&!(e in Function.prototype))}function a(t,e){return!(!t||"function"!=typeof t[e])&&(!(o(t,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(t))&&(!!o(p,e)||!(e in Object.prototype)&&!(e in Function.prototype)))}function s(t){return"object"===r(t)&&t&&t.constructor===Object}var u={length:!0,name:!0},p={toString:!0,valueOf:!0,toLocaleString:!0};n.getSafeProperty=function(t,e){if(s(t)&&i(t,e))return t[e];if("function"==typeof t[e]&&a(t,e))throw new Error('Cannot access method "'+e+'" as a property');throw new Error('No access to property "'+e+'"')},n.setSafeProperty=function(t,e,n){if(s(t)&&i(t,e))return t[e]=n;throw new Error('No access to property "'+e+'"')},n.isSafeProperty=i,n.validateSafeMethod=function(t,e){if(!a(t,e))throw new Error('No access to method "'+e+'"')},n.isSafeMethod=a,n.isPlainObject=s},{"./object":55}],52:[function(t,e,n){"use strict";var r=t("tiny-emitter");n.mixin=function(t){var e=new r;return t.on=e.on.bind(e),t.off=e.off.bind(e),t.once=e.once.bind(e),t.emit=e.emit.bind(e),t}},{"tiny-emitter":58}],53:[function(t,e,n){"use strict";var r=t("escape-latex");n.symbols={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},n.operators={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},n.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var o={deg:"^\\circ"};n.escape=function(t){return r(t,{preserveFormatting:!0})},n.toSymbol=function(t,e){return(e=void 0!==e&&e)?o.hasOwnProperty(t)?o[t]:"\\mathrm{"+n.escape(t)+"}":n.symbols.hasOwnProperty(t)?n.symbols[t]:n.escape(t)}},{"escape-latex":2}],54:[function(t,e,h){"use strict";var i=t("./object");function l(t){for(var e=[],n=0;n<t;n++)e.push(0);return e}h.isNumber=function(t){return"number"==typeof t},h.isInteger=function(t){return"boolean"==typeof t||!!isFinite(t)&&t===Math.round(t)},h.sign=Math.sign||function(t){return 0<t?1:t<0?-1:0},h.format=function(t,e){if("function"==typeof e)return e(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var n,r="auto";switch(e&&(e.notation&&(r=e.notation),h.isNumber(e)?n=e:e.precision&&(n=e.precision)),r){case"fixed":return h.toFixed(t,n);case"exponential":return h.toExponential(t,n);case"engineering":return h.toEngineering(t,n);case"auto":if(!e||!e.exponential||void 0===e.exponential.lower&&void 0===e.exponential.upper)return h.toPrecision(t,n,e&&e).replace(/((\.\d*?)(0+))($|e)/,function(){var t=arguments[2],e=arguments[4];return"."!==t?t+e:e});var o=i.map(e,function(t){return t});return(o.exponential=void 0)!==e.exponential.lower&&(o.lowerExp=Math.round(Math.log(e.exponential.lower)/Math.LN10)),void 0!==e.exponential.upper&&(o.upperExp=Math.round(Math.log(e.exponential.upper)/Math.LN10)),console.warn("Deprecation warning: Formatting options exponential.lower and exponential.upper (minimum and maximum value) are replaced with exponential.lowerExp and exponential.upperExp (minimum and maximum exponent) since version 4.0.0. Replace "+JSON.stringify(e)+" with "+JSON.stringify(o)),h.toPrecision(t,n,o);default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", or "fixed".')}},h.splitNumber=function(t){var e=String(t).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+t);var n=e[1],r=e[2],o=parseFloat(e[4]||"0"),i=r.indexOf(".");o+=-1!==i?i-1:r.length-1;var a=r.replace(".","").replace(/^0*/,function(t){return o-=t.length,""}).replace(/0*$/,"").split("").map(function(t){return parseInt(t)});return 0===a.length&&(a.push(0),o++),{sign:n,coefficients:a,exponent:o}},h.toEngineering=function(t,e){if(isNaN(t)||!isFinite(t))return String(t);var n=h.roundDigits(h.splitNumber(t),e),r=n.exponent,o=n.coefficients,i=r%3==0?r:r<0?r-3-r%3:r-r%3;if(h.isNumber(e))e>o.length&&(o=o.concat(l(e-o.length)));else{var a=0<=r?r:Math.abs(i);o.length-1<a&&(o=o.concat(l(a-(o.length-1))))}for(var s=Math.abs(r-i),u=1;0<=--s;)u++;var p=o.slice(u).join(""),c=h.isNumber(e)&&p.length||p.match(/[1-9]/)?"."+p:"",f=o.slice(0,u).join("")+c+"e"+(0<=r?"+":"")+i.toString();return n.sign+f},h.toFixed=function(t,e){if(isNaN(t)||!isFinite(t))return String(t);var n=h.splitNumber(t),r="number"==typeof e?h.roundDigits(n,n.exponent+1+e):n,o=r.coefficients,i=r.exponent+1,a=i+(e||0);return o.length<a&&(o=o.concat(l(a-o.length))),i<0&&(o=l(1-i).concat(o),i=1),i<o.length&&o.splice(i,0,0===i?"0.":"."),r.sign+o.join("")},h.toExponential=function(t,e){if(isNaN(t)||!isFinite(t))return String(t);var n=h.splitNumber(t),r=e?h.roundDigits(n,e):n,o=r.coefficients,i=r.exponent;o.length<e&&(o=o.concat(l(e-o.length)));var a=o.shift();return r.sign+a+(0<o.length?"."+o.join(""):"")+"e"+(0<=i?"+":"")+i},h.toPrecision=function(t,e,n){if(isNaN(t)||!isFinite(t))return String(t);var r=n&&void 0!==n.lowerExp?n.lowerExp:-3,o=n&&void 0!==n.upperExp?n.upperExp:5,i=h.splitNumber(t);if(i.exponent<r||i.exponent>=o)return h.toExponential(t,e);var a=e?h.roundDigits(i,e):i,s=a.coefficients,u=a.exponent;s.length<e&&(s=s.concat(l(e-s.length))),s=s.concat(l(u-s.length+1+(s.length<e?e-s.length:0)));var p=0<u?u:0;return p<(s=l(-u).concat(s)).length-1&&s.splice(p+1,0,"."),a.sign+s.join("")},h.roundDigits=function(t,e){for(var n={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},r=n.coefficients;e<=0;)r.unshift(0),n.exponent++,e++;if(r.length>e&&5<=r.splice(e,r.length-e)[0]){var o=e-1;for(r[o]++;10===r[o];)r.pop(),0===o&&(r.unshift(0),n.exponent++,o++),r[--o]++}return n},h.digits=function(t){return t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length},h.DBL_EPSILON=Number.EPSILON||2220446049250313e-31,h.nearlyEqual=function(t,e,n){if(null==n)return t===e;if(t===e)return!0;if(isNaN(t)||isNaN(e))return!1;if(isFinite(t)&&isFinite(e)){var r=Math.abs(t-e);return r<h.DBL_EPSILON||r<=Math.max(Math.abs(t),Math.abs(e))*n}return!1}},{"./object":55}],55:[function(t,e,i){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var o=t("./bignumber/isBigNumber");i.clone=function e(t){var n=r(t);if("number"===n||"string"===n||"boolean"===n||null==t)return t;if("function"==typeof t.clone)return t.clone();if(Array.isArray(t))return t.map(function(t){return e(t)});if(t instanceof Date)return new Date(t.valueOf());if(o(t))return t;if(t instanceof RegExp)throw new TypeError("Cannot clone "+t);return i.map(t,e)},i.map=function(t,e){var n={};for(var r in t)i.hasOwnProperty(t,r)&&(n[r]=e(t[r]));return n},i.extend=function(t,e){for(var n in e)i.hasOwnProperty(e,n)&&(t[n]=e[n]);return t},i.deepExtend=function t(e,n){if(Array.isArray(n))throw new TypeError("Arrays are not supported by deepExtend");for(var r in n)if(i.hasOwnProperty(n,r))if(n[r]&&n[r].constructor===Object)void 0===e[r]&&(e[r]={}),e[r].constructor===Object?t(e[r],n[r]):e[r]=n[r];else{if(Array.isArray(n[r]))throw new TypeError("Arrays are not supported by deepExtend");e[r]=n[r]}return e},i.deepEqual=function(t,e){var n,r,o;if(Array.isArray(t)){if(!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(r=0,o=t.length;r<o;r++)if(!i.deepEqual(t[r],e[r]))return!1;return!0}if(t instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(n in t)if(!i.deepEqual(t[n],e[n]))return!1;for(n in e)if(!i.deepEqual(t[n],e[n]))return!1;return!0}return t===e},i.canDefineProperty=function(){try{if(Object.defineProperty)return Object.defineProperty({},"x",{get:function(){}}),!0}catch(t){}return!1},i.lazy=function(t,e,n){if(i.canDefineProperty()){var r,o=!0;Object.defineProperty(t,e,{get:function(){return o&&(r=n(),o=!1),r},set:function(t){r=t,o=!1},configurable:!0,enumerable:!0})}else t[e]=n()},i.traverse=function(t,e){var n=t;if(e)for(var r=e.split("."),o=0;o<r.length;o++){var i=r[o];i in n||(n[i]={}),n=n[i]}return n},i.hasOwnProperty=function(t,e){return t&&Object.hasOwnProperty.call(t,e)},i.isFactory=function(t){return t&&"function"==typeof t.factory}},{"./bignumber/isBigNumber":48}],56:[function(t,e,n){"use strict";Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isNaN=Number.isNaN||function(t){return t!=t}},{}],57:[function(t,e,a){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var s=t("./number").format,u=t("./bignumber/formatter").format,p=t("./bignumber/isBigNumber");a.isString=function(t){return"string"==typeof t},a.endsWith=function(t,e){var n=t.length-e.length,r=t.length;return t.substring(n,r)===e},a.format=function(t,e){if("number"==typeof t)return s(t,e);if(p(t))return u(t,e);if((n=t)&&"object"===i(n)&&"number"==typeof n.s&&"number"==typeof n.n&&"number"==typeof n.d)return e&&"decimal"===e.fraction?t.toString():t.s*t.n+"/"+t.d;var n;if(Array.isArray(t))return function t(e,n){{if(Array.isArray(e)){for(var r="[",o=e.length,i=0;i<o;i++)0!==i&&(r+=", "),r+=t(e[i],n);return r+="]"}return a.format(e,n)}}(t,e);if(a.isString(t))return'"'+t+'"';if("function"==typeof t)return t.syntax?String(t.syntax):"function";if(t&&"object"===i(t)){if("function"==typeof t.format)return t.format(e);if(t&&t.toString()!=={}.toString())return t.toString();var r=[];for(var o in t)t.hasOwnProperty(o)&&r.push('"'+o+'": '+a.format(t[o],e));return"{"+r.join(", ")+"}"}return String(t)},a.stringify=function(t){for(var e=String(t),n="",r=0;r<e.length;){var o=e.charAt(r);"\\"===o?(n+=o,r++,""!==(o=e.charAt(r))&&-1!=='"\\/bfnrtu'.indexOf(o)||(n+="\\"),n+=o):n+='"'===o?'\\"':o,r++}return'"'+n+'"'},a.escape=function(t){var e=String(t);return e=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}},{"./bignumber/formatter":47,"./bignumber/isBigNumber":48,"./number":54}],58:[function(t,e,n){function r(){}r.prototype={on:function(t,e,n){var r=this.e||(this.e={});return(r[t]||(r[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var r=this;function o(){r.off(t,o),e.apply(n,arguments)}return o._=e,this.on(t,o,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),r=0,o=n.length;r<o;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;i<a;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],59:[function(t,e,n){"use strict";var r,o;r=this,o=function(){function g(){return!0}function pt(){return!1}function ct(){}return function t(){var e=[{name:"number",test:function(t){return"number"==typeof t}},{name:"string",test:function(t){return"string"==typeof t}},{name:"boolean",test:function(t){return"boolean"==typeof t}},{name:"Function",test:function(t){return"function"==typeof t}},{name:"Array",test:Array.isArray},{name:"Date",test:function(t){return t instanceof Date}},{name:"RegExp",test:function(t){return t instanceof RegExp}},{name:"Object",test:function(t){return"object"==typeof t&&t.constructor===Object}},{name:"null",test:function(t){return null===t}},{name:"undefined",test:function(t){return void 0===t}}],r={name:"any",test:g},n=[],o=[],q={types:e,conversions:o,ignore:n};function p(e){var t=st(q.types,function(t){return t.name===e});if(t)return t;if("any"===e)return r;var n=st(q.types,function(t){return t.name.toLowerCase()===e.toLowerCase()});throw new TypeError('Unknown type "'+e+'"'+(n?'. Did you mean "'+n.name+'"?':""))}function c(t){return t===r?999:q.types.indexOf(t)}function U(e){var t=st(q.types,function(t){return t.test(e)});if(t)return t.name;throw new TypeError("Value has unknown type. Value: "+e)}function J(t){return t.map(function(t){var e=t.types.map(i);return(t.restParam?"...":"")+e.join("|")}).join(",")}function z(t,n){var e,r,o=0===t.indexOf("..."),i=(o?3<t.length?t.slice(3):"any":t).split("|").map(nt).filter(m).filter(l),a=(e=i,r={},n.forEach(function(t){-1!==e.indexOf(t.from)||-1===e.indexOf(t.to)||r[t.from]||(r[t.from]=t)}),Object.keys(r).map(function(t){return r[t]})),s=i.map(function(t){var e=p(t);return{name:t,typeIndex:c(e),test:e.test,conversion:null,conversionIndex:-1}}),u=a.map(function(t){var e=p(t.from);return{name:t.from,typeIndex:c(e),test:e.test,conversion:t,conversionIndex:n.indexOf(t)}});return{types:s.concat(u),restParam:o}}function $(t){var e=s(t);return!!e&&e.restParam}function V(t){return t.types.some(function(t){return null!=t.conversion})}function X(t){if(t&&0!==t.types.length){if(1===t.types.length)return p(t.types[0].name).test;if(2===t.types.length){var e=p(t.types[0].name).test,n=p(t.types[1].name).test;return function(t){return e(t)||n(t)}}var r=t.types.map(function(t){return p(t.name).test});return function(t){for(var e=0;e<r.length;e++)if(r[e](t))return!0;return!1}}return g}function Y(t){var n,e,r,o;if($(t)){var i=(n=(o=t,o.slice(0,o.length-1)).map(X)).length,a=X(s(t));return function(t){for(var e=0;e<n.length;e++)if(!n[e](t[e]))return!1;return function(t){for(var e=i;e<t.length;e++)if(!a(t[e]))return!1;return!0}(t)&&t.length>=i+1}}return 0===t.length?function(t){return 0===t.length}:1===t.length?(e=X(t[0]),function(t){return e(t[0])&&1===t.length}):2===t.length?(e=X(t[0]),r=X(t[1]),function(t){return e(t[0])&&r(t[1])&&2===t.length}):(n=t.map(X),function(t){for(var e=0;e<n.length;e++)if(!n[e](t[e]))return!1;return t.length===n.length})}function Z(t,e){return e<t.params.length?t.params[e]:$(t.params)?s(t.params):null}function G(t,e,n){var r=Z(t,e);return(r?n?r.types.filter(f):r.types:[]).map(i)}function i(t){return t.name}function f(t){return null===t.conversion||void 0===t.conversion}function K(t,e){var n=function(t){for(var e={},n=0;n<t.length;n++)e[t[n]]=!0;return Object.keys(e)}(ut(t,function(t){return G(t,e,!1)}));return-1!==n.indexOf("any")?["any"]:n}function u(t){for(var e=999,n=0;n<t.types.length;n++)f(t.types[n])&&(e=Math.min(e,t.types[n].typeIndex));return e}function h(t){for(var e=999,n=0;n<t.types.length;n++)f(t.types[n])||(e=Math.min(e,t.types[n].conversionIndex));return e}function Q(t,e){var n,r,o,i,a,s=Math.min(t.params.length,e.params.length);if(0!=(r=t.params.some(V)-e.params.some(V)))return r;for(n=0;n<s;n++)if(0!=(r=V(t.params[n])-V(e.params[n])))return r;for(n=0;n<s;n++)if(o=t.params[n],i=e.params[n],a=void 0,0!==(r=0!=(a=o.restParam-i.restParam)?a:0!=(a=V(o)-V(i))?a:0!=(a=u(o)-u(i))?a:h(o)-h(i)))return r;return t.params.length-e.params.length}function tt(t){var e,n,r,o,i=[],a=[];switch(t.types.forEach(function(t){t.conversion&&(i.push(p(t.conversion.from).test),a.push(t.conversion.convert))}),a.length){case 0:return function(t){return t};case 1:return e=i[0],r=a[0],function(t){return e(t)?r(t):t};case 2:return e=i[0],n=i[1],r=a[0],o=a[1],function(t){return e(t)?r(t):n(t)?o(t):t};default:return function(t){for(var e=0;e<a.length;e++)if(i[e](t))return a[e](t);return t}}}function et(t,u){return function e(n,r,o){if(r<n.length){var t,i=n[r],a=u?i.types.filter(f):i.types;if(i.restParam){var s=a.filter(f);t=s.length<a.length?[s,a]:[a]}else t=a.map(function(t){return[t]});return ut(t,function(t){return e(n,r+1,o.concat([t]))})}return[o.map(function(t,e){return{types:t,restParam:e===n.length-1&&$(n)}})]}(t,0,[])}function a(e,i){if(0===Object.keys(i).length)throw new SyntaxError("No signatures provided");var n=[];Object.keys(i).map(function(t){return n=i[e=t],o=q.conversions,r=[],""!==e.trim()&&(r=e.split(",").map(nt).map(function(t,e,n){var r=z(t,o);if(r.restParam&&e!==n.length-1)throw new SyntaxError('Unexpected rest parameter "'+t+'": only allowed for the last parameter');return r})),r.some(ot)?null:{params:r,fn:n};var e,n,o,r}).filter(rt).forEach(function(e){var t=st(n,function(t){return function(t,e){for(var n=Math.max(t.params.length,e.params.length),r=0;r<n;r++)if(!at(G(t,r,!0),G(e,r,!0)))return!1;var o=t.params.length,i=e.params.length,a=$(t.params),s=$(e.params);return a?s?o===i:o<=i:s?i<=o:o===i}(t,e)});if(t)throw new TypeError('Conflicting signatures "'+J(t.params)+'" and "'+J(e.params)+'".');n.push(e)});var r=ut(n,function(e){return(e?et(e.params,!1):[]).map(function(t){return{params:t,fn:e.fn}})}).filter(rt);r.sort(Q);var o,t=r[0]&&r[0].params.length<=2&&!$(r[0].params),a=r[1]&&r[1].params.length<=2&&!$(r[1].params),s=r[2]&&r[2].params.length<=2&&!$(r[2].params),u=r[3]&&r[3].params.length<=2&&!$(r[3].params),p=r[4]&&r[4].params.length<=2&&!$(r[4].params),c=r[5]&&r[5].params.length<=2&&!$(r[5].params),f=t&&a&&s&&u&&p&&c,h=r.map(function(t){return Y(t.params)}),l=t?X(r[0].params[0]):pt,m=a?X(r[1].params[0]):pt,d=s?X(r[2].params[0]):pt,y=u?X(r[3].params[0]):pt,g=p?X(r[4].params[0]):pt,v=c?X(r[5].params[0]):pt,b=t?X(r[0].params[1]):pt,x=a?X(r[1].params[1]):pt,w=s?X(r[2].params[1]):pt,N=u?X(r[3].params[1]):pt,E=p?X(r[4].params[1]):pt,O=c?X(r[5].params[1]):pt,S=r.map(function(t){return function(t,r){var e=r;if(t.some(V)){var o=$(t),i=t.map(tt);e=function(){for(var t=[],e=o?arguments.length-1:arguments.length,n=0;n<e;n++)t[n]=i[n](arguments[n]);return o&&(t[e]=arguments[e].map(i[e])),r.apply(null,t)}}var n=e;if($(t)){var a=t.length-1;n=function(){return e.apply(null,it(arguments,0,a).concat([it(arguments,a)]))}}return n}(t.params,t.fn)}),j=t?S[0]:ct,k=a?S[1]:ct,T=s?S[2]:ct,A=u?S[3]:ct,P=p?S[4]:ct,M=c?S[5]:ct,C=t?r[0].params.length:-1,I=a?r[1].params.length:-1,F=s?r[2].params.length:-1,_=u?r[3].params.length:-1,D=p?r[4].params.length:-1,L=c?r[5].params.length:-1,R=f?6:0,B=r.length,W=function(){for(var t=R;t<B;t++)if(h[t](arguments))return S[t].apply(null,arguments);throw function(t,n,e){var r,o,i,a=t||"unnamed",s=e;for(i=0;i<n.length;i++){var u=s.filter(function(t){var e=X(Z(t,i));return(i<t.params.length||$(t.params))&&e(n[i])});if(0===u.length){if(0<(o=K(s,i)).length){var p=U(n[i]);return(r=new TypeError("Unexpected type of argument in function "+a+" (expected: "+o.join(" or ")+", actual: "+p+", index: "+i+")")).data={category:"wrongType",fn:a,index:i,actual:p,expected:o},r}}else s=u}var c=s.map(function(t){return $(t.params)?1/0:t.params.length});if(n.length<Math.min.apply(null,c))return o=K(s,i),(r=new TypeError("Too few arguments in function "+a+" (expected: "+o.join(" or ")+", index: "+n.length+")")).data={category:"tooFewArgs",fn:a,index:n.length,expected:o},r;var f=Math.max.apply(null,c);return n.length>f?(r=new TypeError("Too many arguments in function "+a+" (expected: "+f+", actual: "+n.length+")")).data={category:"tooManyArgs",fn:a,index:n.length,expectedLength:f}:(r=new TypeError('Arguments of type "'+n.join(", ")+'" do not match any of the defined signatures of function '+a+".")).data={category:"mismatch",actual:n.map(U)},r}(e,arguments,r)},H=function(t,e){return arguments.length===C&&l(t)&&b(e)?j.apply(null,arguments):arguments.length===I&&m(t)&&x(e)?k.apply(null,arguments):arguments.length===F&&d(t)&&w(e)?T.apply(null,arguments):arguments.length===_&&y(t)&&N(e)?A.apply(null,arguments):arguments.length===D&&g(t)&&E(e)?P.apply(null,arguments):arguments.length===L&&v(t)&&O(e)?M.apply(null,arguments):W.apply(null,arguments)};try{Object.defineProperty(H,"name",{value:e})}catch(t){}return H.signatures=(o={},r.forEach(function(e){e.params.some(V)||et(e.params,!0).forEach(function(t){o[J(t)]=e.fn})}),o),H}function l(t){return-1===q.ignore.indexOf(t)}function nt(t){return t.trim()}function m(t){return!!t}function rt(t){return null!==t}function ot(t){return 0===t.types.length}function s(t){return t[t.length-1]}function it(t,e,n){return Array.prototype.slice.call(t,e,n)}function at(t,e){for(var n=0;n<t.length;n++)if(r=e,o=t[n],-1!==r.indexOf(o))return!0;var r,o;return!1}function st(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return t[n]}function ut(t,e){return Array.prototype.concat.apply([],t.map(e))}function d(t){for(var e="",n=0;n<t.length;n++){var r=t[n];if(("object"==typeof r.signatures||"string"==typeof r.signature)&&""!==r.name)if(""===e)e=r.name;else if(e!==r.name){var o=new Error("Function names do not match (expected: "+e+", actual: "+r.name+")");throw o.data={actual:r.name,expected:e},o}}return e}function y(t){var n,r={};function e(t,e){if(r.hasOwnProperty(t)&&e!==r[t])throw(n=new Error('Signature "'+t+'" is defined twice')).data={signature:t},n}for(var o=0;o<t.length;o++){var i=t[o];if("object"==typeof i.signatures)for(var a in i.signatures)i.signatures.hasOwnProperty(a)&&(e(a,i.signatures[a]),r[a]=i.signatures[a]);else{if("string"!=typeof i.signature)throw(n=new TypeError("Function is no typed-function (index: "+o+")")).data={index:o},n;e(i.signature,i),r[i.signature]=i}}return r}return(q=a("typed",{"string, Object":a,Object:function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(t[n]);return a(d(e),t)},"...Function":function(t){return a(d(t),y(t))},"string, ...Function":function(t,e){return a(t,y(e))}})).create=t,q.types=e,q.conversions=o,q.ignore=n,q.convert=function(t,e){var n=U(t);if(e===n)return t;for(var r=0;r<q.conversions.length;r++){var o=q.conversions[r];if(o.from===n&&o.to===e)return o.convert(t)}throw new Error("Cannot convert from "+n+" to "+e)},q.find=function(t,e){if(!t.signatures)throw new TypeError("Function is no typed-function");var n;if("string"==typeof e){n=e.split(",");for(var r=0;r<n.length;r++)n[r]=n[r].trim()}else{if(!Array.isArray(e))throw new TypeError("String array or a comma separated string expected");n=e}var o=n.join(","),i=t.signatures[o];if(i)return i;throw new TypeError("Signature not found (signature: "+(t.name||"unnamed")+"("+n.join(", ")+"))")},q.addType=function(t,e){if(!t||"string"!=typeof t.name||"function"!=typeof t.test)throw new TypeError("Object with properties {name: string, test: function} expected");if(!1!==e)for(var n=0;n<q.types.length;n++)if("Object"===q.types[n].name)return void q.types.splice(n,0,t);q.types.push(t)},q.addConversion=function(t){if(!t||"string"!=typeof t.from||"string"!=typeof t.to||"function"!=typeof t.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");q.conversions.push(t)},q}()},"object"==typeof n?e.exports=o():r.typed=o()},{}]},{},[1])(1)});