From 6aef4690c008a36498b7f717b00e173b40a02a13 Mon Sep 17 00:00:00 2001 From: ravingdragoon <72875320+ravingdragoon@users.noreply.github.com> Date: Mon, 27 Sep 2021 12:15:46 -0700 Subject: [PATCH 1/2] Add files via upload --- math.js | 62801 +------------------------------------------------ math.js.map | 1 + package.json | 3 + 3 files changed, 16 insertions(+), 62789 deletions(-) create mode 100644 math.js.map create mode 100644 package.json diff --git a/math.js b/math.js index a527f18..06c55e8 100644 --- a/math.js +++ b/math.js @@ -6,11 +6,11 @@ * It features real and complex numbers, units, matrices, a large set of * mathematical functions, and a flexible expression parser. * - * @version 7.5.1 - * @date 2020-10-10 + * @version 9.5.0 + * @date 2021-09-22 * * @license - * Copyright (C) 2013-2020 Jos de Jong + * Copyright (C) 2013-2021 Jos de Jong * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy @@ -24,62795 +24,18 @@ * License for the specific language governing permissions and limitations under * the License. */ - -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["math"] = factory(); - else - root["math"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 18); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return factory; }); -/* unused harmony export sortFactories */ -/* unused harmony export create */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isFactory; }); -/* unused harmony export assertDependencies */ -/* unused harmony export isOptionalDependency */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return stripOptionalNotation; }); -/* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); -/* harmony import */ var _object__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); - - +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=238)}([,function(e,t,r){var n=r(14),i=r(63).f,a=r(43),o=r(39),s=r(106),u=r(129),c=r(93);e.exports=function(e,t){var r,f,l,p,h,m=e.target,d=e.global,y=e.stat;if(r=d?n:y?n[m]||s(m,{}):(n[m]||{}).prototype)for(f in t){if(p=t[f],l=e.noTargetGet?(h=i(r,f))&&h.value:r[f],!c(d?f:m+(y?".":"#")+f,e.forced)&&void 0!==l){if(typeof p==typeof l)continue;u(p,l)}(e.sham||l&&l.sham)&&a(p,"sham",!0),o(r,f,p,e)}}},function(e,t,r){r(1)({target:"Array",stat:!0},{isArray:r(66)})},function(e,t,r){"use strict";var n=r(1),i=r(58).map;n({target:"Array",proto:!0,forced:!r(81)("map")},{map:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){var n=r(118),i=r(39),a=r(197);n||i(Object.prototype,"toString",a,{unsafe:!0})},function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=r=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),r(t)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";var n=r(1),i=r(135);n({target:"Array",proto:!0,forced:[].forEach!=i},{forEach:i})},function(e,t,r){var n=r(14),i=r(136),a=r(137),o=r(135),s=r(43),u=function(e){if(e&&e.forEach!==o)try{s(e,"forEach",o)}catch(t){e.forEach=o}};for(var c in i)u(n[c]&&n[c].prototype);u(a)},function(e,t,r){var n=r(39),i=Date.prototype,a=i.toString,o=i.getTime;"Invalid Date"!=String(new Date(NaN))&&n(i,"toString",(function(){var e=o.call(this);return e==e?a.call(this):"Invalid Date"}))},function(e,t,r){"use strict";var n=r(39),i=r(25),a=r(27),o=r(10),s=r(113),u=RegExp.prototype,c=u.toString,f=o((function(){return"/a/b"!=c.call({source:"a",flags:"b"})})),l="toString"!=c.name;(f||l)&&n(RegExp.prototype,"toString",(function(){var e=i(this),t=a(e.source),r=e.flags;return"/"+t+"/"+a(void 0===r&&e instanceof RegExp&&!("flags"in u)?s.call(e):r)}),{unsafe:!0})},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,r){var n=r(20),i=r(24).f,a=Function.prototype,o=a.toString,s=/^\s*function ([^ (]*)/;n&&!("name"in a)&&i(a,"name",{configurable:!0,get:function(){try{return o.call(this).match(s)[1]}catch(e){return""}}})},function(e,t,r){"use strict";var n=r(1),i=r(10),a=r(32),o=r(103);n({target:"Date",proto:!0,forced:i((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=a(this),r=o(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}})},function(e,t,r){"use strict";r(1)({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return URL.prototype.toString.call(this)}})},function(e,t,r){(function(t){var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")()}).call(this,r(178))},function(e,t,r){var n=r(14),i=r(88),a=r(31),o=r(90),s=r(104),u=r(126),c=i("wks"),f=n.Symbol,l=u?f:f&&f.withoutSetter||o;e.exports=function(e){return a(c,e)&&(s||"string"==typeof c[e])||(s&&a(f,e)?c[e]=f[e]:c[e]=l("Symbol."+e)),c[e]}},function(e,t,r){"use strict";var n=r(1),i=r(85),a=r(42),o=r(57),s=[].join,u=i!=Object,c=o("join",",");n({target:"Array",proto:!0,forced:u||!c},{join:function(e){return s.call(a(this),void 0===e?",":e)}})},function(e,t,r){"use strict";var n=r(1),i=r(23),a=r(66),o=r(92),s=r(36),u=r(42),c=r(82),f=r(15),l=r(81)("slice"),p=f("species"),h=[].slice,m=Math.max;n({target:"Array",proto:!0,forced:!l},{slice:function(e,t){var r,n,f,l=u(this),d=s(l.length),y=o(e,d),v=o(void 0===t?d:t,d);if(a(l)&&("function"!=typeof(r=l.constructor)||r!==Array&&!a(r.prototype)?i(r)&&null===(r=r[p])&&(r=void 0):r=void 0,r===Array||void 0===r))return h.call(l,y,v);for(n=new(void 0===r?Array:r)(m(v-y,0)),f=0;y=51||!i((function(){var e=[];return e[m]=!1,e.concat()[0]!==e})),y=l("concat"),v=function(e){if(!o(e))return!1;var t=e[m];return void 0!==t?!!t:a(e)};n({target:"Array",proto:!0,forced:!d||!y},{concat:function(e){var t,r,n,i,a,o=s(this),l=f(o,0),p=0;for(t=-1,n=arguments.length;t9007199254740991)throw TypeError("Maximum allowed index exceeded");for(r=0;r=9007199254740991)throw TypeError("Maximum allowed index exceeded");c(l,p++,a)}return l.length=p,l}})},function(e,t,r){var n=r(10);e.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(e,t,r){"use strict";var n=r(1),i=r(58).find,a=r(120),o=!0;"find"in[]&&Array(1).find((function(){o=!1})),n({target:"Array",proto:!0,forced:o},{find:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a("find")},function(e,t,r){var n=r(223),i=r(224),a=r(168),o=r(225);e.exports=function(e){return n(e)||i(e)||a(e)||o()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,r){var n=r(20),i=r(127),a=r(25),o=r(86),s=Object.defineProperty;t.f=n?s:function(e,t,r){if(a(e),t=o(t),a(r),i)try{return s(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},function(e,t,r){var n=r(23);e.exports=function(e){if(!n(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t,r){"use strict";var n=r(1),i=r(132).indexOf,a=r(57),o=[].indexOf,s=!!o&&1/[1].indexOf(1,-0)<0,u=a("indexOf");n({target:"Array",proto:!0,forced:s||!u},{indexOf:function(e){return s?o.apply(this,arguments)||0:i(this,e,arguments.length>1?arguments[1]:void 0)}})},function(e,t,r){var n=r(76);e.exports=function(e){if(n(e))throw TypeError("Cannot convert a Symbol value to a string");return String(e)}},function(e,t,r){"use strict";var n=r(20),i=r(14),a=r(93),o=r(39),s=r(31),u=r(54),c=r(112),f=r(76),l=r(103),p=r(10),h=r(48),m=r(65).f,d=r(63).f,y=r(24).f,v=r(98).trim,g=i.Number,x=g.prototype,b="Number"==u(h(x)),w=function(e){if(f(e))throw TypeError("Cannot convert a Symbol value to a number");var t,r,n,i,a,o,s,u,c=l(e,"number");if("string"==typeof c&&c.length>2)if(43===(t=(c=v(c)).charCodeAt(0))||45===t){if(88===(r=c.charCodeAt(2))||120===r)return NaN}else if(48===t){switch(c.charCodeAt(1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(o=(a=c.slice(2)).length,s=0;si)return NaN;return parseInt(a,n)}return+c};if(a("Number",!g(" 0o1")||!g("0b1")||g("+0x1"))){for(var N,M=function(e){var t=arguments.length<1?0:e,r=this;return r instanceof M&&(b?p((function(){x.valueOf.call(r)})):"Number"!=u(r))?c(new g(w(t)),r,M):w(t)},E=n?m(g):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),S=0;E.length>S;S++)s(g,N=E[S])&&!s(M,N)&&y(M,N,d(g,N));M.prototype=x,x.constructor=M,o(i,"Number",M)}},function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t { - * // ... create the function log here and return it - * } - * - * @param {string} name Name of the function to be created - * @param {string[]} dependencies The names of all required dependencies - * @param {function} create Callback function called with an object with all dependencies - * @param {Object} [meta] Optional object with meta information that will be attached - * to the created factory function as property `meta`. - * @returns {function} - */ - -function factory(name, dependencies, create, meta) { - function assertAndCreate(scope) { - // we only pass the requested dependencies to the factory function - // to prevent functions to rely on dependencies that are not explicitly - // requested. - var deps = Object(_object__WEBPACK_IMPORTED_MODULE_1__[/* pickShallow */ "j"])(scope, dependencies.map(stripOptionalNotation)); - assertDependencies(name, dependencies, scope); - return create(deps); - } - - assertAndCreate.isFactory = true; - assertAndCreate.fn = name; - assertAndCreate.dependencies = dependencies.slice().sort(); - - if (meta) { - assertAndCreate.meta = meta; - } - - return assertAndCreate; -} -/** - * Sort all factories such that when loading in order, the dependencies are resolved. - * - * @param {Array} factories - * @returns {Array} Returns a new array with the sorted factories. - */ - -function sortFactories(factories) { - var factoriesByName = {}; - factories.forEach(function (factory) { - factoriesByName[factory.fn] = factory; - }); - - function containsDependency(factory, dependency) { - // TODO: detect circular references - if (isFactory(factory)) { - if (Object(_array__WEBPACK_IMPORTED_MODULE_0__[/* contains */ "b"])(factory.dependencies, dependency.fn || dependency.name)) { - return true; - } - - if (factory.dependencies.some(function (d) { - return containsDependency(factoriesByName[d], dependency); - })) { - return true; - } - } - - return false; - } - - var sorted = []; - - function addFactory(factory) { - var index = 0; - - while (index < sorted.length && !containsDependency(sorted[index], factory)) { - index++; - } - - sorted.splice(index, 0, factory); - } // sort regular factory functions - - - factories.filter(isFactory).forEach(addFactory); // sort legacy factory functions AFTER the regular factory functions - - factories.filter(function (factory) { - return !isFactory(factory); - }).forEach(addFactory); - return sorted; -} // TODO: comment or cleanup if unused in the end - -function create(factories) { - var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - sortFactories(factories).forEach(function (factory) { - return factory(scope); - }); - return scope; -} -/** - * Test whether an object is a factory. This is the case when it has - * properties name, dependencies, and a function create. - * @param {*} obj - * @returns {boolean} - */ - -function isFactory(obj) { - return typeof obj === 'function' && typeof obj.fn === 'string' && Array.isArray(obj.dependencies); -} -/** - * Assert that all dependencies of a list with dependencies are available in the provided scope. - * - * Will throw an exception when there are dependencies missing. - * - * @param {string} name Name for the function to be created. Used to generate a useful error message - * @param {string[]} dependencies - * @param {Object} scope - */ - -function assertDependencies(name, dependencies, scope) { - var allDefined = dependencies.filter(function (dependency) { - return !isOptionalDependency(dependency); - }) // filter optionals - .every(function (dependency) { - return scope[dependency] !== undefined; - }); - - if (!allDefined) { - var missingDependencies = dependencies.filter(function (dependency) { - return scope[dependency] === undefined; - }); // TODO: create a custom error class for this, a MathjsError or something like that - - throw new Error("Cannot create function \"".concat(name, "\", ") + "some dependencies are missing: ".concat(missingDependencies.map(function (d) { - return "\"".concat(d, "\""); - }).join(', '), ".")); - } -} -function isOptionalDependency(dependency) { - return dependency && dependency[0] === '?'; -} -function stripOptionalNotation(dependency) { - return dependency && dependency[0] === '?' ? dependency.slice(1) : dependency; -} - -/***/ }), -/* 1 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return isNumber; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isBigNumber; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return isComplex; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return isFraction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return isUnit; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return isString; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isArray; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return isMatrix; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return isCollection; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return isDenseMatrix; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return isSparseMatrix; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return isRange; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return isIndex; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isBoolean; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return isResultSet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return isHelp; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return isFunction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return isDate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return isRegExp; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return isObject; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return isNull; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return isUndefined; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isAccessorNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isArrayNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isAssignmentNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isBlockNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return isConditionalNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return isConstantNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return isFunctionAssignmentNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return isFunctionNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return isIndexNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return isNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return isObjectNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return isOperatorNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return isParenthesisNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return isRangeNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return isSymbolNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return isChain; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return typeOf; }); -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -// type checks for all known types -// -// note that: -// -// - check by duck-typing on a property like `isUnit`, instead of checking instanceof. -// instanceof cannot be used because that would not allow to pass data from -// one instance of math.js to another since each has it's own instance of Unit. -// - check the `isUnit` property via the constructor, so there will be no -// matches for "fake" instances like plain objects with a property `isUnit`. -// That is important for security reasons. -// - It must not be possible to override the type checks used internally, -// for security reasons, so these functions are not exposed in the expression -// parser. -function isNumber(x) { - return typeof x === 'number'; -} -function isBigNumber(x) { - return x && x.constructor.prototype.isBigNumber === true || false; -} -function isComplex(x) { - return x && _typeof(x) === 'object' && Object.getPrototypeOf(x).isComplex === true || false; -} -function isFraction(x) { - return x && _typeof(x) === 'object' && Object.getPrototypeOf(x).isFraction === true || false; -} -function isUnit(x) { - return x && x.constructor.prototype.isUnit === true || false; -} -function isString(x) { - return typeof x === 'string'; -} -var isArray = Array.isArray; -function isMatrix(x) { - return x && x.constructor.prototype.isMatrix === true || false; -} -/** - * Test whether a value is a collection: an Array or Matrix - * @param {*} x - * @returns {boolean} isCollection - */ - -function isCollection(x) { - return Array.isArray(x) || isMatrix(x); -} -function isDenseMatrix(x) { - return x && x.isDenseMatrix && x.constructor.prototype.isMatrix === true || false; -} -function isSparseMatrix(x) { - return x && x.isSparseMatrix && x.constructor.prototype.isMatrix === true || false; -} -function isRange(x) { - return x && x.constructor.prototype.isRange === true || false; -} -function isIndex(x) { - return x && x.constructor.prototype.isIndex === true || false; -} -function isBoolean(x) { - return typeof x === 'boolean'; -} -function isResultSet(x) { - return x && x.constructor.prototype.isResultSet === true || false; -} -function isHelp(x) { - return x && x.constructor.prototype.isHelp === true || false; -} -function isFunction(x) { - return typeof x === 'function'; -} -function isDate(x) { - return x instanceof Date; -} -function isRegExp(x) { - return x instanceof RegExp; -} -function isObject(x) { - return !!(x && _typeof(x) === 'object' && x.constructor === Object && !isComplex(x) && !isFraction(x)); -} -function isNull(x) { - return x === null; -} -function isUndefined(x) { - return x === undefined; -} -function isAccessorNode(x) { - return x && x.isAccessorNode === true && x.constructor.prototype.isNode === true || false; -} -function isArrayNode(x) { - return x && x.isArrayNode === true && x.constructor.prototype.isNode === true || false; -} -function isAssignmentNode(x) { - return x && x.isAssignmentNode === true && x.constructor.prototype.isNode === true || false; -} -function isBlockNode(x) { - return x && x.isBlockNode === true && x.constructor.prototype.isNode === true || false; -} -function isConditionalNode(x) { - return x && x.isConditionalNode === true && x.constructor.prototype.isNode === true || false; -} -function isConstantNode(x) { - return x && x.isConstantNode === true && x.constructor.prototype.isNode === true || false; -} -function isFunctionAssignmentNode(x) { - return x && x.isFunctionAssignmentNode === true && x.constructor.prototype.isNode === true || false; -} -function isFunctionNode(x) { - return x && x.isFunctionNode === true && x.constructor.prototype.isNode === true || false; -} -function isIndexNode(x) { - return x && x.isIndexNode === true && x.constructor.prototype.isNode === true || false; -} -function isNode(x) { - return x && x.isNode === true && x.constructor.prototype.isNode === true || false; -} -function isObjectNode(x) { - return x && x.isObjectNode === true && x.constructor.prototype.isNode === true || false; -} -function isOperatorNode(x) { - return x && x.isOperatorNode === true && x.constructor.prototype.isNode === true || false; -} -function isParenthesisNode(x) { - return x && x.isParenthesisNode === true && x.constructor.prototype.isNode === true || false; -} -function isRangeNode(x) { - return x && x.isRangeNode === true && x.constructor.prototype.isNode === true || false; -} -function isSymbolNode(x) { - return x && x.isSymbolNode === true && x.constructor.prototype.isNode === true || false; -} -function isChain(x) { - return x && x.constructor.prototype.isChain === true || false; -} -function typeOf(x) { - var t = _typeof(x); - - if (t === 'object') { - // JavaScript types - if (x === null) return 'null'; - if (Array.isArray(x)) return 'Array'; - if (x instanceof Date) return 'Date'; - if (x instanceof RegExp) return 'RegExp'; // math.js types - - if (isBigNumber(x)) return 'BigNumber'; - if (isComplex(x)) return 'Complex'; - if (isFraction(x)) return 'Fraction'; - if (isMatrix(x)) return 'Matrix'; - if (isUnit(x)) return 'Unit'; - if (isIndex(x)) return 'Index'; - if (isRange(x)) return 'Range'; - if (isResultSet(x)) return 'ResultSet'; - if (isNode(x)) return x.type; - if (isChain(x)) return 'Chain'; - if (isHelp(x)) return 'Help'; - return 'Object'; - } - - if (t === 'function') return 'Function'; - return t; // can be 'string', 'number', 'boolean', ... -} - -/***/ }), -/* 2 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return arraySize; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return validate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return validateIndex; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return resize; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return reshape; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return squeeze; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return unsqueeze; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return flatten; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return map; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return forEach; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return filter; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return filterRegExp; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return join; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return identify; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return generalize; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getArrayDataType; }); -/* unused harmony export last */ -/* unused harmony export initial */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return contains; }); -/* harmony import */ var _number__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); -/* harmony import */ var _is__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1); -/* harmony import */ var _string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5); -/* harmony import */ var _error_DimensionError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6); -/* harmony import */ var _error_IndexError__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9); - - - - - -/** - * Calculate the size of a multi dimensional array. - * This function checks the size of the first entry, it does not validate - * whether all dimensions match. (use function `validate` for that) - * @param {Array} x - * @Return {Number[]} size - */ - -function arraySize(x) { - var s = []; - - while (Array.isArray(x)) { - s.push(x.length); - x = x[0]; - } - - return s; -} -/** - * Recursively validate whether each element in a multi dimensional array - * has a size corresponding to the provided size array. - * @param {Array} array Array to be validated - * @param {number[]} size Array with the size of each dimension - * @param {number} dim Current dimension - * @throws DimensionError - * @private - */ - -function _validate(array, size, dim) { - var i; - var len = array.length; - - if (len !== size[dim]) { - throw new _error_DimensionError__WEBPACK_IMPORTED_MODULE_3__[/* DimensionError */ "a"](len, size[dim]); - } - - if (dim < size.length - 1) { - // recursively validate each child array - var dimNext = dim + 1; - - for (i = 0; i < len; i++) { - var child = array[i]; - - if (!Array.isArray(child)) { - throw new _error_DimensionError__WEBPACK_IMPORTED_MODULE_3__[/* DimensionError */ "a"](size.length - 1, size.length, '<'); - } - - _validate(array[i], size, dimNext); - } - } else { - // last dimension. none of the childs may be an array - for (i = 0; i < len; i++) { - if (Array.isArray(array[i])) { - throw new _error_DimensionError__WEBPACK_IMPORTED_MODULE_3__[/* DimensionError */ "a"](size.length + 1, size.length, '>'); - } - } - } -} -/** - * Validate whether each element in a multi dimensional array has - * a size corresponding to the provided size array. - * @param {Array} array Array to be validated - * @param {number[]} size Array with the size of each dimension - * @throws DimensionError - */ - - -function validate(array, size) { - var isScalar = size.length === 0; - - if (isScalar) { - // scalar - if (Array.isArray(array)) { - throw new _error_DimensionError__WEBPACK_IMPORTED_MODULE_3__[/* DimensionError */ "a"](array.length, 0); - } - } else { - // array - _validate(array, size, 0); - } -} -/** - * Test whether index is an integer number with index >= 0 and index < length - * when length is provided - * @param {number} index Zero-based index - * @param {number} [length] Length of the array - */ - -function validateIndex(index, length) { - if (!Object(_is__WEBPACK_IMPORTED_MODULE_1__[/* isNumber */ "y"])(index) || !Object(_number__WEBPACK_IMPORTED_MODULE_0__[/* isInteger */ "i"])(index)) { - throw new TypeError('Index must be an integer (value: ' + index + ')'); - } - - if (index < 0 || typeof length === 'number' && index >= length) { - throw new _error_IndexError__WEBPACK_IMPORTED_MODULE_4__[/* IndexError */ "a"](index, length); - } -} -/** - * Resize a multi dimensional array. The resized array is returned. - * @param {Array} array Array to be resized - * @param {Array.} size Array with the size of each dimension - * @param {*} [defaultValue=0] Value to be filled in in new entries, - * zero by default. Specify for example `null`, - * to clearly see entries that are not explicitly - * set. - * @return {Array} array The resized array - */ - -function resize(array, size, defaultValue) { - // TODO: add support for scalars, having size=[] ? - // check the type of the arguments - if (!Array.isArray(array) || !Array.isArray(size)) { - throw new TypeError('Array expected'); - } - - if (size.length === 0) { - throw new Error('Resizing to scalar is not supported'); - } // check whether size contains positive integers - - - size.forEach(function (value) { - if (!Object(_is__WEBPACK_IMPORTED_MODULE_1__[/* isNumber */ "y"])(value) || !Object(_number__WEBPACK_IMPORTED_MODULE_0__[/* isInteger */ "i"])(value) || value < 0) { - throw new TypeError('Invalid size, must contain positive integers ' + '(size: ' + Object(_string__WEBPACK_IMPORTED_MODULE_2__[/* format */ "d"])(size) + ')'); - } - }); // recursively resize the array - - var _defaultValue = defaultValue !== undefined ? defaultValue : 0; - - _resize(array, size, 0, _defaultValue); - - return array; -} -/** - * Recursively resize a multi dimensional array - * @param {Array} array Array to be resized - * @param {number[]} size Array with the size of each dimension - * @param {number} dim Current dimension - * @param {*} [defaultValue] Value to be filled in in new entries, - * undefined by default. - * @private - */ - -function _resize(array, size, dim, defaultValue) { - var i; - var elem; - var oldLen = array.length; - var newLen = size[dim]; - var minLen = Math.min(oldLen, newLen); // apply new length - - array.length = newLen; - - if (dim < size.length - 1) { - // non-last dimension - var dimNext = dim + 1; // resize existing child arrays - - for (i = 0; i < minLen; i++) { - // resize child array - elem = array[i]; - - if (!Array.isArray(elem)) { - elem = [elem]; // add a dimension - - array[i] = elem; - } - - _resize(elem, size, dimNext, defaultValue); - } // create new child arrays - - - for (i = minLen; i < newLen; i++) { - // get child array - elem = []; - array[i] = elem; // resize new child array - - _resize(elem, size, dimNext, defaultValue); - } - } else { - // last dimension - // remove dimensions of existing values - for (i = 0; i < minLen; i++) { - while (Array.isArray(array[i])) { - array[i] = array[i][0]; - } - } // fill new elements with the default value - - - for (i = minLen; i < newLen; i++) { - array[i] = defaultValue; - } - } -} -/** - * Re-shape a multi dimensional array to fit the specified dimensions - * @param {Array} array Array to be reshaped - * @param {Array.} sizes List of sizes for each dimension - * @returns {Array} Array whose data has been formatted to fit the - * specified dimensions - * - * @throws {DimensionError} If the product of the new dimension sizes does - * not equal that of the old ones - */ - - -function reshape(array, sizes) { - var flatArray = flatten(array); - var newArray; - - function product(arr) { - return arr.reduce(function (prev, curr) { - return prev * curr; - }); - } - - if (!Array.isArray(array) || !Array.isArray(sizes)) { - throw new TypeError('Array expected'); - } - - if (sizes.length === 0) { - throw new _error_DimensionError__WEBPACK_IMPORTED_MODULE_3__[/* DimensionError */ "a"](0, product(arraySize(array)), '!='); - } - - var totalSize = 1; - - for (var sizeIndex = 0; sizeIndex < sizes.length; sizeIndex++) { - totalSize *= sizes[sizeIndex]; - } - - if (flatArray.length !== totalSize) { - throw new _error_DimensionError__WEBPACK_IMPORTED_MODULE_3__[/* DimensionError */ "a"](product(sizes), product(arraySize(array)), '!='); - } - - try { - newArray = _reshape(flatArray, sizes); - } catch (e) { - if (e instanceof _error_DimensionError__WEBPACK_IMPORTED_MODULE_3__[/* DimensionError */ "a"]) { - throw new _error_DimensionError__WEBPACK_IMPORTED_MODULE_3__[/* DimensionError */ "a"](product(sizes), product(arraySize(array)), '!='); - } - - throw e; - } - - return newArray; -} -/** - * Iteratively re-shape a multi dimensional array to fit the specified dimensions - * @param {Array} array Array to be reshaped - * @param {Array.} sizes List of sizes for each dimension - * @returns {Array} Array whose data has been formatted to fit the - * specified dimensions - */ - -function _reshape(array, sizes) { - // testing if there are enough elements for the requested shape - var tmpArray = array; - var tmpArray2; // for each dimensions starting by the last one and ignoring the first one - - for (var sizeIndex = sizes.length - 1; sizeIndex > 0; sizeIndex--) { - var size = sizes[sizeIndex]; - tmpArray2 = []; // aggregate the elements of the current tmpArray in elements of the requested size - - var length = tmpArray.length / size; - - for (var i = 0; i < length; i++) { - tmpArray2.push(tmpArray.slice(i * size, (i + 1) * size)); - } // set it as the new tmpArray for the next loop turn or for return - - - tmpArray = tmpArray2; - } - - return tmpArray; -} -/** - * Squeeze a multi dimensional array - * @param {Array} array - * @param {Array} [size] - * @returns {Array} returns the array itself - */ - - -function squeeze(array, size) { - var s = size || arraySize(array); // squeeze outer dimensions - - while (Array.isArray(array) && array.length === 1) { - array = array[0]; - s.shift(); - } // find the first dimension to be squeezed - - - var dims = s.length; - - while (s[dims - 1] === 1) { - dims--; - } // squeeze inner dimensions - - - if (dims < s.length) { - array = _squeeze(array, dims, 0); - s.length = dims; - } - - return array; -} -/** - * Recursively squeeze a multi dimensional array - * @param {Array} array - * @param {number} dims Required number of dimensions - * @param {number} dim Current dimension - * @returns {Array | *} Returns the squeezed array - * @private - */ - -function _squeeze(array, dims, dim) { - var i, ii; - - if (dim < dims) { - var next = dim + 1; - - for (i = 0, ii = array.length; i < ii; i++) { - array[i] = _squeeze(array[i], dims, next); - } - } else { - while (Array.isArray(array)) { - array = array[0]; - } - } - - return array; -} -/** - * Unsqueeze a multi dimensional array: add dimensions when missing - * - * Paramter `size` will be mutated to match the new, unqueezed matrix size. - * - * @param {Array} array - * @param {number} dims Desired number of dimensions of the array - * @param {number} [outer] Number of outer dimensions to be added - * @param {Array} [size] Current size of array. - * @returns {Array} returns the array itself - * @private - */ - - -function unsqueeze(array, dims, outer, size) { - var s = size || arraySize(array); // unsqueeze outer dimensions - - if (outer) { - for (var i = 0; i < outer; i++) { - array = [array]; - s.unshift(1); - } - } // unsqueeze inner dimensions - - - array = _unsqueeze(array, dims, 0); - - while (s.length < dims) { - s.push(1); - } - - return array; -} -/** - * Recursively unsqueeze a multi dimensional array - * @param {Array} array - * @param {number} dims Required number of dimensions - * @param {number} dim Current dimension - * @returns {Array | *} Returns the squeezed array - * @private - */ - -function _unsqueeze(array, dims, dim) { - var i, ii; - - if (Array.isArray(array)) { - var next = dim + 1; - - for (i = 0, ii = array.length; i < ii; i++) { - array[i] = _unsqueeze(array[i], dims, next); - } - } else { - for (var d = dim; d < dims; d++) { - array = [array]; - } - } - - return array; -} -/** - * Flatten a multi dimensional array, put all elements in a one dimensional - * array - * @param {Array} array A multi dimensional array - * @return {Array} The flattened array (1 dimensional) - */ - - -function flatten(array) { - if (!Array.isArray(array)) { - // if not an array, return as is - return array; - } - - var flat = []; - array.forEach(function callback(value) { - if (Array.isArray(value)) { - value.forEach(callback); // traverse through sub-arrays recursively - } else { - flat.push(value); - } - }); - return flat; -} -/** - * A safe map - * @param {Array} array - * @param {function} callback - */ - -function map(array, callback) { - return Array.prototype.map.call(array, callback); -} -/** - * A safe forEach - * @param {Array} array - * @param {function} callback - */ - -function forEach(array, callback) { - Array.prototype.forEach.call(array, callback); -} -/** - * A safe filter - * @param {Array} array - * @param {function} callback - */ - -function filter(array, callback) { - if (arraySize(array).length !== 1) { - throw new Error('Only one dimensional matrices supported'); - } - - return Array.prototype.filter.call(array, callback); -} -/** - * Filter values in a callback given a regular expression - * @param {Array} array - * @param {RegExp} regexp - * @return {Array} Returns the filtered array - * @private - */ - -function filterRegExp(array, regexp) { - if (arraySize(array).length !== 1) { - throw new Error('Only one dimensional matrices supported'); - } - - return Array.prototype.filter.call(array, function (entry) { - return regexp.test(entry); - }); -} -/** - * A safe join - * @param {Array} array - * @param {string} separator - */ - -function join(array, separator) { - return Array.prototype.join.call(array, separator); -} -/** - * Assign a numeric identifier to every element of a sorted array - * @param {Array} a An array - * @return {Array} An array of objects containing the original value and its identifier - */ - -function identify(a) { - if (!Array.isArray(a)) { - throw new TypeError('Array input expected'); - } - - if (a.length === 0) { - return a; - } - - var b = []; - var count = 0; - b[0] = { - value: a[0], - identifier: 0 - }; - - for (var i = 1; i < a.length; i++) { - if (a[i] === a[i - 1]) { - count++; - } else { - count = 0; - } - - b.push({ - value: a[i], - identifier: count - }); - } - - return b; -} -/** - * Remove the numeric identifier from the elements - * @param {array} a An array - * @return {array} An array of values without identifiers - */ - -function generalize(a) { - if (!Array.isArray(a)) { - throw new TypeError('Array input expected'); - } - - if (a.length === 0) { - return a; - } - - var b = []; - - for (var i = 0; i < a.length; i++) { - b.push(a[i].value); - } - - return b; -} -/** - * Check the datatype of a given object - * This is a low level implementation that should only be used by - * parent Matrix classes such as SparseMatrix or DenseMatrix - * This method does not validate Array Matrix shape - * @param {Array} array - * @param {function} typeOf Callback function to use to determine the type of a value - * @return string - */ - -function getArrayDataType(array, typeOf) { - var type; // to hold type info - - var length = 0; // to hold length value to ensure it has consistent sizes - - for (var i = 0; i < array.length; i++) { - var item = array[i]; - var isArray = Array.isArray(item); // Saving the target matrix row size - - if (i === 0 && isArray) { - length = item.length; - } // If the current item is an array but the length does not equal the targetVectorSize - - - if (isArray && item.length !== length) { - return undefined; - } - - var itemType = isArray ? getArrayDataType(item, typeOf) // recurse into a nested array - : typeOf(item); - - if (type === undefined) { - type = itemType; // first item - } else if (type !== itemType) { - return 'mixed'; - } else {// we're good, everything has the same type so far - } - } - - return type; -} -/** - * Return the last item from an array - * @param array - * @returns {*} - */ - -function last(array) { - return array[array.length - 1]; -} -/** - * Get all but the last element of array. - */ - -function initial(array) { - return array.slice(0, array.length - 1); -} -/** - * Test whether an array or string contains an item - * @param {Array | string} array - * @param {*} item - * @return {boolean} - */ - -function contains(array, item) { - return array.indexOf(item) !== -1; -} - -/***/ }), -/* 3 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return clone; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return mapObject; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return extend; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return deepExtend; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return deepStrictEqual; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return deepFlatten; }); -/* unused harmony export canDefineProperty */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return lazy; }); -/* unused harmony export traverse */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return hasOwnProperty; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isLegacyFactory; }); -/* unused harmony export get */ -/* unused harmony export set */ -/* unused harmony export pick */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return pickShallow; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return values; }); -/* harmony import */ var _is__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - - -/** - * Clone an object - * - * clone(x) - * - * Can clone any primitive type, array, and object. - * If x has a function clone, this function will be invoked to clone the object. - * - * @param {*} x - * @return {*} clone - */ - -function clone(x) { - var type = _typeof(x); // immutable primitive types - - - if (type === 'number' || type === 'string' || type === 'boolean' || x === null || x === undefined) { - return x; - } // use clone function of the object when available - - - if (typeof x.clone === 'function') { - return x.clone(); - } // array - - - if (Array.isArray(x)) { - return x.map(function (value) { - return clone(value); - }); - } - - if (x instanceof Date) return new Date(x.valueOf()); - if (Object(_is__WEBPACK_IMPORTED_MODULE_0__[/* isBigNumber */ "e"])(x)) return x; // bignumbers are immutable - - if (x instanceof RegExp) throw new TypeError('Cannot clone ' + x); // TODO: clone a RegExp - // object - - return mapObject(x, clone); -} -/** - * Apply map to all properties of an object - * @param {Object} object - * @param {function} callback - * @return {Object} Returns a copy of the object with mapped properties - */ - -function mapObject(object, callback) { - var clone = {}; - - for (var key in object) { - if (hasOwnProperty(object, key)) { - clone[key] = callback(object[key]); - } - } - - return clone; -} -/** - * Extend object a with the properties of object b - * @param {Object} a - * @param {Object} b - * @return {Object} a - */ - -function extend(a, b) { - for (var prop in b) { - if (hasOwnProperty(b, prop)) { - a[prop] = b[prop]; - } - } - - return a; -} -/** - * Deep extend an object a with the properties of object b - * @param {Object} a - * @param {Object} b - * @returns {Object} - */ - -function deepExtend(a, b) { - // TODO: add support for Arrays to deepExtend - if (Array.isArray(b)) { - throw new TypeError('Arrays are not supported by deepExtend'); - } - - for (var prop in b) { - // We check against prop not being in Object.prototype or Function.prototype - // to prevent polluting for example Object.__proto__. - if (hasOwnProperty(b, prop) && !(prop in Object.prototype) && !(prop in Function.prototype)) { - if (b[prop] && b[prop].constructor === Object) { - if (a[prop] === undefined) { - a[prop] = {}; - } - - if (a[prop] && a[prop].constructor === Object) { - deepExtend(a[prop], b[prop]); - } else { - a[prop] = b[prop]; - } - } else if (Array.isArray(b[prop])) { - throw new TypeError('Arrays are not supported by deepExtend'); - } else { - a[prop] = b[prop]; - } - } - } - - return a; -} -/** - * Deep test equality of all fields in two pairs of arrays or objects. - * Compares values and functions strictly (ie. 2 is not the same as '2'). - * @param {Array | Object} a - * @param {Array | Object} b - * @returns {boolean} - */ - -function deepStrictEqual(a, b) { - var prop, i, len; - - if (Array.isArray(a)) { - if (!Array.isArray(b)) { - return false; - } - - if (a.length !== b.length) { - return false; - } - - for (i = 0, len = a.length; i < len; i++) { - if (!deepStrictEqual(a[i], b[i])) { - return false; - } - } - - return true; - } else if (typeof a === 'function') { - return a === b; - } else if (a instanceof Object) { - if (Array.isArray(b) || !(b instanceof Object)) { - return false; - } - - for (prop in a) { - // noinspection JSUnfilteredForInLoop - if (!(prop in b) || !deepStrictEqual(a[prop], b[prop])) { - return false; - } - } - - for (prop in b) { - // noinspection JSUnfilteredForInLoop - if (!(prop in a) || !deepStrictEqual(a[prop], b[prop])) { - return false; - } - } - - return true; - } else { - return a === b; - } -} -/** - * Recursively flatten a nested object. - * @param {Object} nestedObject - * @return {Object} Returns the flattened object - */ - -function deepFlatten(nestedObject) { - var flattenedObject = {}; - - _deepFlatten(nestedObject, flattenedObject); - - return flattenedObject; -} // helper function used by deepFlatten - -function _deepFlatten(nestedObject, flattenedObject) { - for (var prop in nestedObject) { - if (hasOwnProperty(nestedObject, prop)) { - var value = nestedObject[prop]; - - if (_typeof(value) === 'object' && value !== null) { - _deepFlatten(value, flattenedObject); - } else { - flattenedObject[prop] = value; - } - } - } -} -/** - * Test whether the current JavaScript engine supports Object.defineProperty - * @returns {boolean} returns true if supported - */ - - -function canDefineProperty() { - // test needed for broken IE8 implementation - try { - if (Object.defineProperty) { - Object.defineProperty({}, 'x', { - get: function get() {} - }); - return true; - } - } catch (e) {} - - return false; -} -/** - * Attach a lazy loading property to a constant. - * The given function `fn` is called once when the property is first requested. - * - * @param {Object} object Object where to add the property - * @param {string} prop Property name - * @param {Function} valueResolver Function returning the property value. Called - * without arguments. - */ - -function lazy(object, prop, valueResolver) { - var _uninitialized = true; - - var _value; - - Object.defineProperty(object, prop, { - get: function get() { - if (_uninitialized) { - _value = valueResolver(); - _uninitialized = false; - } - - return _value; - }, - set: function set(value) { - _value = value; - _uninitialized = false; - }, - configurable: true, - enumerable: true - }); -} -/** - * Traverse a path into an object. - * When a namespace is missing, it will be created - * @param {Object} object - * @param {string | string[]} path A dot separated string like 'name.space' - * @return {Object} Returns the object at the end of the path - */ - -function traverse(object, path) { - if (path && typeof path === 'string') { - return traverse(object, path.split('.')); - } - - var obj = object; - - if (path) { - for (var i = 0; i < path.length; i++) { - var key = path[i]; - - if (!(key in obj)) { - obj[key] = {}; - } - - obj = obj[key]; - } - } - - return obj; -} -/** - * A safe hasOwnProperty - * @param {Object} object - * @param {string} property - */ - -function hasOwnProperty(object, property) { - return object && Object.hasOwnProperty.call(object, property); -} -/** - * Test whether an object is a factory. a factory has fields: - * - * - factory: function (type: Object, config: Object, load: function, typed: function [, math: Object]) (required) - * - name: string (optional) - * - path: string A dot separated path (optional) - * - math: boolean If true (false by default), the math namespace is passed - * as fifth argument of the factory function - * - * @param {*} object - * @returns {boolean} - */ - -function isLegacyFactory(object) { - return object && typeof object.factory === 'function'; -} -/** - * Get a nested property from an object - * @param {Object} object - * @param {string | string[]} path - * @returns {Object} - */ - -function get(object, path) { - if (typeof path === 'string') { - if (isPath(path)) { - return get(object, path.split('.')); - } else { - return object[path]; - } - } - - var child = object; - - for (var i = 0; i < path.length; i++) { - var key = path[i]; - child = child ? child[key] : undefined; - } - - return child; -} -/** - * Set a nested property in an object - * Mutates the object itself - * If the path doesn't exist, it will be created - * @param {Object} object - * @param {string | string[]} path - * @param {*} value - * @returns {Object} - */ - -function set(object, path, value) { - if (typeof path === 'string') { - if (isPath(path)) { - return set(object, path.split('.'), value); - } else { - object[path] = value; - return object; - } - } - - var child = object; - - for (var i = 0; i < path.length - 1; i++) { - var key = path[i]; - - if (child[key] === undefined) { - child[key] = {}; - } - - child = child[key]; - } - - if (path.length > 0) { - var lastKey = path[path.length - 1]; - child[lastKey] = value; - } - - return object; -} -/** - * Create an object composed of the picked object properties - * @param {Object} object - * @param {string[]} properties - * @param {function} [transform] Optional value to transform a value when picking it - * @return {Object} - */ - -function pick(object, properties, transform) { - var copy = {}; - - for (var i = 0; i < properties.length; i++) { - var key = properties[i]; - var value = get(object, key); - - if (value !== undefined) { - set(copy, key, transform ? transform(value, key) : value); - } - } - - return copy; -} -/** - * Shallow version of pick, creating an object composed of the picked object properties - * but not for nested properties - * @param {Object} object - * @param {string[]} properties - * @return {Object} - */ - -function pickShallow(object, properties) { - var copy = {}; - - for (var i = 0; i < properties.length; i++) { - var key = properties[i]; - var value = object[key]; - - if (value !== undefined) { - copy[key] = value; - } - } - - return copy; -} -function values(object) { - return Object.keys(object).map(function (key) { - return object[key]; - }); -} // helper function to test whether a string contains a path like 'user.name' - -function isPath(str) { - return str.indexOf('.') !== -1; -} - -/***/ }), -/* 4 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return isInteger; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return sign; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return log2; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return log10; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return log1p; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return cbrt; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return expm1; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return format; }); -/* unused harmony export splitNumber */ -/* unused harmony export toEngineering */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return toFixed; }); -/* unused harmony export toExponential */ -/* unused harmony export toPrecision */ -/* unused harmony export roundDigits */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return digits; }); -/* unused harmony export DBL_EPSILON */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return nearlyEqual; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return acosh; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return asinh; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return atanh; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return cosh; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return sinh; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return tanh; }); -/* harmony import */ var _is__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); - -/** - * @typedef {{sign: '+' | '-' | '', coefficients: number[], exponent: number}} SplitValue - */ - -/** - * Check if a number is integer - * @param {number | boolean} value - * @return {boolean} isInteger - */ - -function isInteger(value) { - if (typeof value === 'boolean') { - return true; - } - - return isFinite(value) ? value === Math.round(value) : false; // Note: we use ==, not ===, as we can have Booleans as well -} -/** - * Calculate the sign of a number - * @param {number} x - * @returns {number} - */ - -var sign = /* #__PURE__ */Math.sign || function (x) { - if (x > 0) { - return 1; - } else if (x < 0) { - return -1; - } else { - return 0; - } -}; -/** - * Calculate the base-2 logarithm of a number - * @param {number} x - * @returns {number} - */ - -var log2 = /* #__PURE__ */Math.log2 || function log2(x) { - return Math.log(x) / Math.LN2; -}; -/** - * Calculate the base-10 logarithm of a number - * @param {number} x - * @returns {number} - */ - -var log10 = /* #__PURE__ */Math.log10 || function log10(x) { - return Math.log(x) / Math.LN10; -}; -/** - * Calculate the natural logarithm of a number + 1 - * @param {number} x - * @returns {number} - */ - -var log1p = /* #__PURE__ */Math.log1p || function (x) { - return Math.log(x + 1); -}; -/** - * Calculate cubic root for a number - * - * Code from es6-shim.js: - * https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L1564-L1577 - * - * @param {number} x - * @returns {number} Returns the cubic root of x - */ - -var cbrt = /* #__PURE__ */Math.cbrt || function cbrt(x) { - if (x === 0) { - return x; - } - - var negate = x < 0; - var result; - - if (negate) { - x = -x; - } - - if (isFinite(x)) { - result = Math.exp(Math.log(x) / 3); // from https://en.wikipedia.org/wiki/Cube_root#Numerical_methods - - result = (x / (result * result) + 2 * result) / 3; - } else { - result = x; - } - - return negate ? -result : result; -}; -/** - * Calculates exponentiation minus 1 - * @param {number} x - * @return {number} res - */ - -var expm1 = /* #__PURE__ */Math.expm1 || function expm1(x) { - return x >= 2e-4 || x <= -2e-4 ? Math.exp(x) - 1 : x + x * x / 2 + x * x * x / 6; -}; -/** - * Convert a number to a formatted string representation. - * - * Syntax: - * - * format(value) - * format(value, options) - * format(value, precision) - * format(value, fn) - * - * Where: - * - * {number} value The value to be formatted - * {Object} options An object with formatting options. Available options: - * {string} notation - * Number notation. Choose from: - * 'fixed' Always use regular number notation. - * For example '123.40' and '14000000' - * 'exponential' Always use exponential notation. - * For example '1.234e+2' and '1.4e+7' - * 'engineering' Always use engineering notation. - * For example '123.4e+0' and '14.0e+6' - * 'auto' (default) Regular number notation for numbers - * having an absolute value between - * `lowerExp` and `upperExp` bounds, and - * uses exponential notation elsewhere. - * Lower bound is included, upper bound - * is excluded. - * For example '123.4' and '1.4e7'. - * {number} precision A number between 0 and 16 to round - * the digits of the number. - * In case of notations 'exponential', - * 'engineering', and 'auto', - * `precision` defines the total - * number of significant digits returned. - * In case of notation 'fixed', - * `precision` defines the number of - * significant digits after the decimal - * point. - * `precision` is undefined by default, - * not rounding any digits. - * {number} lowerExp Exponent determining the lower boundary - * for formatting a value with an exponent - * when `notation='auto`. - * Default value is `-3`. - * {number} upperExp Exponent determining the upper boundary - * for formatting a value with an exponent - * when `notation='auto`. - * Default value is `5`. - * {Function} fn A custom formatting function. Can be used to override the - * built-in notations. Function `fn` is called with `value` as - * parameter and must return a string. Is useful for example to - * format all values inside a matrix in a particular way. - * - * Examples: - * - * format(6.4) // '6.4' - * format(1240000) // '1.24e6' - * format(1/3) // '0.3333333333333333' - * format(1/3, 3) // '0.333' - * format(21385, 2) // '21000' - * format(12.071, {notation: 'fixed'}) // '12' - * format(2.3, {notation: 'fixed', precision: 2}) // '2.30' - * format(52.8, {notation: 'exponential'}) // '5.28e+1' - * format(12345678, {notation: 'engineering'}) // '12.345678e+6' - * - * @param {number} value - * @param {Object | Function | number} [options] - * @return {string} str The formatted value - */ - -function format(value, options) { - if (typeof options === 'function') { - // handle format(value, fn) - return options(value); - } // handle special cases - - - if (value === Infinity) { - return 'Infinity'; - } else if (value === -Infinity) { - return '-Infinity'; - } else if (isNaN(value)) { - return 'NaN'; - } // default values for options - - - var notation = 'auto'; - var precision; - - if (options) { - // determine notation from options - if (options.notation) { - notation = options.notation; - } // determine precision from options - - - if (Object(_is__WEBPACK_IMPORTED_MODULE_0__[/* isNumber */ "y"])(options)) { - precision = options; - } else if (Object(_is__WEBPACK_IMPORTED_MODULE_0__[/* isNumber */ "y"])(options.precision)) { - precision = options.precision; - } - } // handle the various notations - - - switch (notation) { - case 'fixed': - return toFixed(value, precision); - - case 'exponential': - return toExponential(value, precision); - - case 'engineering': - return toEngineering(value, precision); - - case 'auto': - // remove trailing zeros after the decimal point - return toPrecision(value, precision, options && options).replace(/((\.\d*?)(0+))($|e)/, function () { - var digits = arguments[2]; - var e = arguments[4]; - return digits !== '.' ? digits + e : e; - }); - - default: - throw new Error('Unknown notation "' + notation + '". ' + 'Choose "auto", "exponential", or "fixed".'); - } -} -/** - * Split a number into sign, coefficients, and exponent - * @param {number | string} value - * @return {SplitValue} - * Returns an object containing sign, coefficients, and exponent - */ - -function splitNumber(value) { - // parse the input value - var match = String(value).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/); - - if (!match) { - throw new SyntaxError('Invalid number ' + value); - } - - var sign = match[1]; - var digits = match[2]; - var exponent = parseFloat(match[4] || '0'); - var dot = digits.indexOf('.'); - exponent += dot !== -1 ? dot - 1 : digits.length - 1; - var coefficients = digits.replace('.', '') // remove the dot (must be removed before removing leading zeros) - .replace(/^0*/, function (zeros) { - // remove leading zeros, add their count to the exponent - exponent -= zeros.length; - return ''; - }).replace(/0*$/, '') // remove trailing zeros - .split('').map(function (d) { - return parseInt(d); - }); - - if (coefficients.length === 0) { - coefficients.push(0); - exponent++; - } - - return { - sign: sign, - coefficients: coefficients, - exponent: exponent - }; -} -/** - * Format a number in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3' - * @param {number | string} value - * @param {number} [precision] Optional number of significant figures to return. - */ - -function toEngineering(value, precision) { - if (isNaN(value) || !isFinite(value)) { - return String(value); - } - - var split = splitNumber(value); - var rounded = roundDigits(split, precision); - var e = rounded.exponent; - var c = rounded.coefficients; // find nearest lower multiple of 3 for exponent - - var newExp = e % 3 === 0 ? e : e < 0 ? e - 3 - e % 3 : e - e % 3; - - if (Object(_is__WEBPACK_IMPORTED_MODULE_0__[/* isNumber */ "y"])(precision)) { - // add zeroes to give correct sig figs - while (precision > c.length || e - newExp + 1 > c.length) { - c.push(0); - } - } else { - // concatenate coefficients with necessary zeros - // add zeros if necessary (for example: 1e+8 -> 100e+6) - var missingZeros = Math.abs(e - newExp) - (c.length - 1); - - for (var i = 0; i < missingZeros; i++) { - c.push(0); - } - } // find difference in exponents - - - var expDiff = Math.abs(e - newExp); - var decimalIdx = 1; // push decimal index over by expDiff times - - while (expDiff > 0) { - decimalIdx++; - expDiff--; - } // if all coefficient values are zero after the decimal point and precision is unset, don't add a decimal value. - // otherwise concat with the rest of the coefficients - - - var decimals = c.slice(decimalIdx).join(''); - var decimalVal = Object(_is__WEBPACK_IMPORTED_MODULE_0__[/* isNumber */ "y"])(precision) && decimals.length || decimals.match(/[1-9]/) ? '.' + decimals : ''; - var str = c.slice(0, decimalIdx).join('') + decimalVal + 'e' + (e >= 0 ? '+' : '') + newExp.toString(); - return rounded.sign + str; -} -/** - * Format a number with fixed notation. - * @param {number | string} value - * @param {number} [precision=undefined] Optional number of decimals after the - * decimal point. null by default. - */ - -function toFixed(value, precision) { - if (isNaN(value) || !isFinite(value)) { - return String(value); - } - - var splitValue = splitNumber(value); - var rounded = typeof precision === 'number' ? roundDigits(splitValue, splitValue.exponent + 1 + precision) : splitValue; - var c = rounded.coefficients; - var p = rounded.exponent + 1; // exponent may have changed - // append zeros if needed - - var pp = p + (precision || 0); - - if (c.length < pp) { - c = c.concat(zeros(pp - c.length)); - } // prepend zeros if needed - - - if (p < 0) { - c = zeros(-p + 1).concat(c); - p = 1; - } // insert a dot if needed - - - if (p < c.length) { - c.splice(p, 0, p === 0 ? '0.' : '.'); - } - - return rounded.sign + c.join(''); -} -/** - * Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3' - * @param {number | string} value - * @param {number} [precision] Number of digits in formatted output. - * If not provided, the maximum available digits - * is used. - */ - -function toExponential(value, precision) { - if (isNaN(value) || !isFinite(value)) { - return String(value); - } // round if needed, else create a clone - - - var split = splitNumber(value); - var rounded = precision ? roundDigits(split, precision) : split; - var c = rounded.coefficients; - var e = rounded.exponent; // append zeros if needed - - if (c.length < precision) { - c = c.concat(zeros(precision - c.length)); - } // format as `C.CCCe+EEE` or `C.CCCe-EEE` - - - var first = c.shift(); - return rounded.sign + first + (c.length > 0 ? '.' + c.join('') : '') + 'e' + (e >= 0 ? '+' : '') + e; -} -/** - * Format a number with a certain precision - * @param {number | string} value - * @param {number} [precision=undefined] Optional number of digits. - * @param {{lowerExp: number | undefined, upperExp: number | undefined}} [options] - * By default: - * lowerExp = -3 (incl) - * upper = +5 (excl) - * @return {string} - */ - -function toPrecision(value, precision, options) { - if (isNaN(value) || !isFinite(value)) { - return String(value); - } // determine lower and upper bound for exponential notation. - - - var lowerExp = options && options.lowerExp !== undefined ? options.lowerExp : -3; - var upperExp = options && options.upperExp !== undefined ? options.upperExp : 5; - var split = splitNumber(value); - var rounded = precision ? roundDigits(split, precision) : split; - - if (rounded.exponent < lowerExp || rounded.exponent >= upperExp) { - // exponential notation - return toExponential(value, precision); - } else { - var c = rounded.coefficients; - var e = rounded.exponent; // append trailing zeros - - if (c.length < precision) { - c = c.concat(zeros(precision - c.length)); - } // append trailing zeros - // TODO: simplify the next statement - - - c = c.concat(zeros(e - c.length + 1 + (c.length < precision ? precision - c.length : 0))); // prepend zeros - - c = zeros(-e).concat(c); - var dot = e > 0 ? e : 0; - - if (dot < c.length - 1) { - c.splice(dot + 1, 0, '.'); - } - - return rounded.sign + c.join(''); - } -} -/** - * Round the number of digits of a number * - * @param {SplitValue} split A value split with .splitNumber(value) - * @param {number} precision A positive integer - * @return {SplitValue} - * Returns an object containing sign, coefficients, and exponent - * with rounded digits - */ - -function roundDigits(split, precision) { - // create a clone - var rounded = { - sign: split.sign, - coefficients: split.coefficients, - exponent: split.exponent - }; - var c = rounded.coefficients; // prepend zeros if needed - - while (precision <= 0) { - c.unshift(0); - rounded.exponent++; - precision++; - } - - if (c.length > precision) { - var removed = c.splice(precision, c.length - precision); - - if (removed[0] >= 5) { - var i = precision - 1; - c[i]++; - - while (c[i] === 10) { - c.pop(); - - if (i === 0) { - c.unshift(0); - rounded.exponent++; - i++; - } - - i--; - c[i]++; - } - } - } - - return rounded; -} -/** - * Create an array filled with zeros. - * @param {number} length - * @return {Array} - */ - -function zeros(length) { - var arr = []; - - for (var i = 0; i < length; i++) { - arr.push(0); - } - - return arr; -} -/** - * Count the number of significant digits of a number. - * - * For example: - * 2.34 returns 3 - * 0.0034 returns 2 - * 120.5e+30 returns 4 - * - * @param {number} value - * @return {number} digits Number of significant digits - */ - - -function digits(value) { - return value.toExponential().replace(/e.*$/, '') // remove exponential notation - .replace(/^0\.?0*|\./, '') // remove decimal point and leading zeros - .length; -} -/** - * Minimum number added to one that makes the result different than one - */ - -var DBL_EPSILON = Number.EPSILON || 2.2204460492503130808472633361816E-16; -/** - * Compares two floating point numbers. - * @param {number} x First value to compare - * @param {number} y Second value to compare - * @param {number} [epsilon] The maximum relative difference between x and y - * If epsilon is undefined or null, the function will - * test whether x and y are exactly equal. - * @return {boolean} whether the two numbers are nearly equal -*/ - -function nearlyEqual(x, y, epsilon) { - // if epsilon is null or undefined, test whether x and y are exactly equal - if (epsilon === null || epsilon === undefined) { - return x === y; - } - - if (x === y) { - return true; - } // NaN - - - if (isNaN(x) || isNaN(y)) { - return false; - } // at this point x and y should be finite - - - if (isFinite(x) && isFinite(y)) { - // check numbers are very close, needed when comparing numbers near zero - var diff = Math.abs(x - y); - - if (diff < DBL_EPSILON) { - return true; - } else { - // use relative error - return diff <= Math.max(Math.abs(x), Math.abs(y)) * epsilon; - } - } // Infinite and Number or negative Infinite and positive Infinite cases - - - return false; -} -/** - * Calculate the hyperbolic arccos of a number - * @param {number} x - * @return {number} - */ - -var acosh = Math.acosh || function (x) { - return Math.log(Math.sqrt(x * x - 1) + x); -}; -var asinh = Math.asinh || function (x) { - return Math.log(Math.sqrt(x * x + 1) + x); -}; -/** - * Calculate the hyperbolic arctangent of a number - * @param {number} x - * @return {number} - */ - -var atanh = Math.atanh || function (x) { - return Math.log((1 + x) / (1 - x)) / 2; -}; -/** - * Calculate the hyperbolic cosine of a number - * @param {number} x - * @returns {number} - */ - -var cosh = Math.cosh || function (x) { - return (Math.exp(x) + Math.exp(-x)) / 2; -}; -/** - * Calculate the hyperbolic sine of a number - * @param {number} x - * @returns {number} - */ - -var sinh = Math.sinh || function (x) { - return (Math.exp(x) - Math.exp(-x)) / 2; -}; -/** - * Calculate the hyperbolic tangent of a number - * @param {number} x - * @returns {number} - */ - -var tanh = Math.tanh || function (x) { - var e = Math.exp(2 * x); - return (e - 1) / (e + 1); -}; - -/***/ }), -/* 5 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ endsWith; }); -__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ string_format; }); -__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ stringify; }); -__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ string_escape; }); -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ compareText; }); - -// EXTERNAL MODULE: ./src/utils/is.js -var is = __webpack_require__(1); - -// EXTERNAL MODULE: ./src/utils/number.js -var number = __webpack_require__(4); - -// CONCATENATED MODULE: ./src/utils/bignumber/formatter.js -/** - * Convert a BigNumber to a formatted string representation. - * - * Syntax: - * - * format(value) - * format(value, options) - * format(value, precision) - * format(value, fn) - * - * Where: - * - * {number} value The value to be formatted - * {Object} options An object with formatting options. Available options: - * {string} notation - * Number notation. Choose from: - * 'fixed' Always use regular number notation. - * For example '123.40' and '14000000' - * 'exponential' Always use exponential notation. - * For example '1.234e+2' and '1.4e+7' - * 'auto' (default) Regular number notation for numbers - * having an absolute value between - * `lower` and `upper` bounds, and uses - * exponential notation elsewhere. - * Lower bound is included, upper bound - * is excluded. - * For example '123.4' and '1.4e7'. - * {number} precision A number between 0 and 16 to round - * the digits of the number. - * In case of notations 'exponential', - * 'engineering', and 'auto', - * `precision` defines the total - * number of significant digits returned. - * In case of notation 'fixed', - * `precision` defines the number of - * significant digits after the decimal - * point. - * `precision` is undefined by default. - * {number} lowerExp Exponent determining the lower boundary - * for formatting a value with an exponent - * when `notation='auto`. - * Default value is `-3`. - * {number} upperExp Exponent determining the upper boundary - * for formatting a value with an exponent - * when `notation='auto`. - * Default value is `5`. - * {Function} fn A custom formatting function. Can be used to override the - * built-in notations. Function `fn` is called with `value` as - * parameter and must return a string. Is useful for example to - * format all values inside a matrix in a particular way. - * - * Examples: - * - * format(6.4) // '6.4' - * format(1240000) // '1.24e6' - * format(1/3) // '0.3333333333333333' - * format(1/3, 3) // '0.333' - * format(21385, 2) // '21000' - * format(12e8, {notation: 'fixed'}) // returns '1200000000' - * format(2.3, {notation: 'fixed', precision: 4}) // returns '2.3000' - * format(52.8, {notation: 'exponential'}) // returns '5.28e+1' - * format(12400, {notation: 'engineering'}) // returns '12.400e+3' - * - * @param {BigNumber} value - * @param {Object | Function | number} [options] - * @return {string} str The formatted value - */ -function format(value, options) { - if (typeof options === 'function') { - // handle format(value, fn) - return options(value); - } // handle special cases - - - if (!value.isFinite()) { - return value.isNaN() ? 'NaN' : value.gt(0) ? 'Infinity' : '-Infinity'; - } // default values for options - - - var notation = 'auto'; - var precision; - - if (options !== undefined) { - // determine notation from options - if (options.notation) { - notation = options.notation; - } // determine precision from options - - - if (typeof options === 'number') { - precision = options; - } else if (options.precision) { - precision = options.precision; - } - } // handle the various notations - - - switch (notation) { - case 'fixed': - return toFixed(value, precision); - - case 'exponential': - return toExponential(value, precision); - - case 'engineering': - return toEngineering(value, precision); - - case 'auto': - { - // determine lower and upper bound for exponential notation. - // TODO: implement support for upper and lower to be BigNumbers themselves - var lowerExp = options && options.lowerExp !== undefined ? options.lowerExp : -3; - var upperExp = options && options.upperExp !== undefined ? options.upperExp : 5; // handle special case zero - - if (value.isZero()) return '0'; // determine whether or not to output exponential notation - - var str; - var rounded = value.toSignificantDigits(precision); - var exp = rounded.e; - - if (exp >= lowerExp && exp < upperExp) { - // normal number notation - str = rounded.toFixed(); - } else { - // exponential notation - str = toExponential(value, precision); - } // remove trailing zeros after the decimal point - - - return str.replace(/((\.\d*?)(0+))($|e)/, function () { - var digits = arguments[2]; - var e = arguments[4]; - return digits !== '.' ? digits + e : e; - }); - } - - default: - throw new Error('Unknown notation "' + notation + '". ' + 'Choose "auto", "exponential", or "fixed".'); - } -} -/** - * Format a BigNumber in engineering notation. Like '1.23e+6', '2.3e+0', '3.500e-3' - * @param {BigNumber | string} value - * @param {number} [precision] Optional number of significant figures to return. - */ - -function toEngineering(value, precision) { - // find nearest lower multiple of 3 for exponent - var e = value.e; - var newExp = e % 3 === 0 ? e : e < 0 ? e - 3 - e % 3 : e - e % 3; // find difference in exponents, and calculate the value without exponent - - var valueWithoutExp = value.mul(Math.pow(10, -newExp)); - var valueStr = valueWithoutExp.toPrecision(precision); - - if (valueStr.indexOf('e') !== -1) { - valueStr = valueWithoutExp.toString(); - } - - return valueStr + 'e' + (e >= 0 ? '+' : '') + newExp.toString(); -} -/** - * Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3' - * @param {BigNumber} value - * @param {number} [precision] Number of digits in formatted output. - * If not provided, the maximum available digits - * is used. - * @returns {string} str - */ - -function toExponential(value, precision) { - if (precision !== undefined) { - return value.toExponential(precision - 1); // Note the offset of one - } else { - return value.toExponential(); - } -} -/** - * Format a number with fixed notation. - * @param {BigNumber} value - * @param {number} [precision=undefined] Optional number of decimals after the - * decimal point. Undefined by default. - */ - -function toFixed(value, precision) { - return value.toFixed(precision); -} -// CONCATENATED MODULE: ./src/utils/string.js -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - - - - -/** - * Check if a text ends with a certain string. - * @param {string} text - * @param {string} search - */ - -function endsWith(text, search) { - var start = text.length - search.length; - var end = text.length; - return text.substring(start, end) === search; -} -/** - * Format a value of any type into a string. - * - * Usage: - * math.format(value) - * math.format(value, precision) - * - * When value is a function: - * - * - When the function has a property `syntax`, it returns this - * syntax description. - * - In other cases, a string `'function'` is returned. - * - * When `value` is an Object: - * - * - When the object contains a property `format` being a function, this - * function is invoked as `value.format(options)` and the result is returned. - * - When the object has its own `toString` method, this method is invoked - * and the result is returned. - * - In other cases the function will loop over all object properties and - * return JSON object notation like '{"a": 2, "b": 3}'. - * - * Example usage: - * math.format(2/7) // '0.2857142857142857' - * math.format(math.pi, 3) // '3.14' - * math.format(new Complex(2, 3)) // '2 + 3i' - * math.format('hello') // '"hello"' - * - * @param {*} value Value to be stringified - * @param {Object | number | Function} [options] Formatting options. See - * lib/utils/number:format for a - * description of the available - * options. - * @return {string} str - */ - -function string_format(value, options) { - if (typeof value === 'number') { - return Object(number["h" /* format */])(value, options); - } - - if (Object(is["e" /* isBigNumber */])(value)) { - return format(value, options); - } // note: we use unsafe duck-typing here to check for Fractions, this is - // ok here since we're only invoking toString or concatenating its values - - - if (looksLikeFraction(value)) { - if (!options || options.fraction !== 'decimal') { - // output as ratio, like '1/3' - return value.s * value.n + '/' + value.d; - } else { - // output as decimal, like '0.(3)' - return value.toString(); - } - } - - if (Array.isArray(value)) { - return formatArray(value, options); - } - - if (Object(is["I" /* isString */])(value)) { - return '"' + value + '"'; - } - - if (typeof value === 'function') { - return value.syntax ? String(value.syntax) : 'function'; - } - - if (value && _typeof(value) === 'object') { - if (typeof value.format === 'function') { - return value.format(options); - } else if (value && value.toString(options) !== {}.toString()) { - // this object has a non-native toString method, use that one - return value.toString(options); - } else { - var entries = Object.keys(value).map(function (key) { - return '"' + key + '": ' + string_format(value[key], options); - }); - return '{' + entries.join(', ') + '}'; - } - } - - return String(value); -} -/** - * Stringify a value into a string enclosed in double quotes. - * Unescaped double quotes and backslashes inside the value are escaped. - * @param {*} value - * @return {string} - */ - -function stringify(value) { - var text = String(value); - var escaped = ''; - var i = 0; - - while (i < text.length) { - var c = text.charAt(i); - - if (c === '\\') { - escaped += c; - i++; - c = text.charAt(i); - - if (c === '' || '"\\/bfnrtu'.indexOf(c) === -1) { - escaped += '\\'; // no valid escape character -> escape it - } - - escaped += c; - } else if (c === '"') { - escaped += '\\"'; - } else { - escaped += c; - } - - i++; - } - - return '"' + escaped + '"'; -} -/** - * Escape special HTML characters - * @param {*} value - * @return {string} - */ - -function string_escape(value) { - var text = String(value); - text = text.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(//g, '>'); - return text; -} -/** - * Recursively format an n-dimensional matrix - * Example output: "[[1, 2], [3, 4]]" - * @param {Array} array - * @param {Object | number | Function} [options] Formatting options. See - * lib/utils/number:format for a - * description of the available - * options. - * @returns {string} str - */ - -function formatArray(array, options) { - if (Array.isArray(array)) { - var str = '['; - var len = array.length; - - for (var i = 0; i < len; i++) { - if (i !== 0) { - str += ', '; - } - - str += formatArray(array[i], options); - } - - str += ']'; - return str; - } else { - return string_format(array, options); - } -} -/** - * Check whether a value looks like a Fraction (unsafe duck-type check) - * @param {*} value - * @return {boolean} - */ - - -function looksLikeFraction(value) { - return value && _typeof(value) === 'object' && typeof value.s === 'number' && typeof value.n === 'number' && typeof value.d === 'number' || false; -} -/** - * Compare two strings - * @param {string} x - * @param {string} y - * @returns {number} - */ - - -function compareText(x, y) { - // we don't want to convert numbers to string, only accept string input - if (!Object(is["I" /* isString */])(x)) { - throw new TypeError('Unexpected type of argument in function compareText ' + '(expected: string or Array or Matrix, actual: ' + Object(is["M" /* typeOf */])(x) + ', index: 0)'); - } - - if (!Object(is["I" /* isString */])(y)) { - throw new TypeError('Unexpected type of argument in function compareText ' + '(expected: string or Array or Matrix, actual: ' + Object(is["M" /* typeOf */])(y) + ', index: 1)'); - } - - return x === y ? 0 : x > y ? 1 : -1; -} - -/***/ }), -/* 6 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DimensionError; }); -/** - * Create a range error with the message: - * 'Dimension mismatch ( != )' - * @param {number | number[]} actual The actual size - * @param {number | number[]} expected The expected size - * @param {string} [relation='!='] Optional relation between actual - * and expected size: '!=', '<', etc. - * @extends RangeError - */ -function DimensionError(actual, expected, relation) { - if (!(this instanceof DimensionError)) { - throw new SyntaxError('Constructor must be called with the new operator'); - } - - this.actual = actual; - this.expected = expected; - this.relation = relation; - this.message = 'Dimension mismatch (' + (Array.isArray(actual) ? '[' + actual.join(', ') + ']' : actual) + ' ' + (this.relation || '!=') + ' ' + (Array.isArray(expected) ? '[' + expected.join(', ') + ']' : expected) + ')'; - this.stack = new Error().stack; -} -DimensionError.prototype = new RangeError(); -DimensionError.prototype.constructor = RangeError; -DimensionError.prototype.name = 'DimensionError'; -DimensionError.prototype.isDimensionError = true; - -/***/ }), -/* 7 */, -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** - * @license Complex.js v2.0.11 11/02/2016 - * - * Copyright (c) 2016, Robert Eisele (robert@xarg.org) + * Copyright (c) 2020, Robert Eisele (robert@xarg.org) * Dual licensed under the MIT or GPL Version 2 licenses. - **/ - -/** - * - * This class allows the manipulation of complex numbers. - * You can pass a complex number in different formats. Either as object, double, string or two integer parameters. - * - * Object form - * { re: , im: } - * { arg: , abs: } - * { phi: , r: } - * - * Array / Vector form - * [ real, imaginary ] - * - * Double form - * 99.3 - Single double value - * - * String form - * '23.1337' - Simple real number - * '15+3i' - a simple complex number - * '3-i' - a simple complex number - * - * Example: - * - * var c = new Complex('99.3+8i'); - * c.mul({r: 3, i: 9}).div(4.9).sub(3, 2); - * - */ - -(function(root) { - - 'use strict'; - - var cosh = function(x) { - return (Math.exp(x) + Math.exp(-x)) * 0.5; - }; - - var sinh = function(x) { - return (Math.exp(x) - Math.exp(-x)) * 0.5; - }; - - /** - * Calculates cos(x) - 1 using Taylor series if x is small. - * - * @param {number} x - * @returns {number} cos(x) - 1 - */ - - var cosm1 = function(x) { - var limit = Math.PI/4; - if (x < -limit || x > limit) { - return (Math.cos(x) - 1.0); - } - - var xx = x * x; - return xx * - (-0.5 + xx * - (1/24 + xx * - (-1/720 + xx * - (1/40320 + xx * - (-1/3628800 + xx * - (1/4790014600 + xx * - (-1/87178291200 + xx * - (1/20922789888000) - ) - ) - ) - ) - ) - ) - ) - }; - - var hypot = function(x, y) { - - var a = Math.abs(x); - var b = Math.abs(y); - - if (a < 3000 && b < 3000) { - return Math.sqrt(a * a + b * b); - } - - if (a < b) { - a = b; - b = x / y; - } else { - b = y / x; - } - return a * Math.sqrt(1 + b * b); - }; - - var parser_exit = function() { - throw SyntaxError('Invalid Param'); - }; - - /** - * Calculates log(sqrt(a^2+b^2)) in a way to avoid overflows - * - * @param {number} a - * @param {number} b - * @returns {number} - */ - function logHypot(a, b) { - - var _a = Math.abs(a); - var _b = Math.abs(b); - - if (a === 0) { - return Math.log(_b); - } - - if (b === 0) { - return Math.log(_a); - } - - if (_a < 3000 && _b < 3000) { - return Math.log(a * a + b * b) * 0.5; - } - - /* I got 4 ideas to compute this property without overflow: - * - * Testing 1000000 times with random samples for a,b ∈ [1, 1000000000] against a big decimal library to get an error estimate - * - * 1. Only eliminate the square root: (OVERALL ERROR: 3.9122483030951116e-11) - - Math.log(a * a + b * b) / 2 - - * - * - * 2. Try to use the non-overflowing pythagoras: (OVERALL ERROR: 8.889760039210159e-10) - - var fn = function(a, b) { - a = Math.abs(a); - b = Math.abs(b); - var t = Math.min(a, b); - a = Math.max(a, b); - t = t / a; - - return Math.log(a) + Math.log(1 + t * t) / 2; - }; - - * 3. Abuse the identity cos(atan(y/x) = x / sqrt(x^2+y^2): (OVERALL ERROR: 3.4780178737037204e-10) - - Math.log(a / Math.cos(Math.atan2(b, a))) - - * 4. Use 3. and apply log rules: (OVERALL ERROR: 1.2014087502620896e-9) - - Math.log(a) - Math.log(Math.cos(Math.atan2(b, a))) - - */ - - return Math.log(a / Math.cos(Math.atan2(b, a))); - } - - var parse = function(a, b) { - - var z = {'re': 0, 'im': 0}; - - if (a === undefined || a === null) { - z['re'] = - z['im'] = 0; - } else if (b !== undefined) { - z['re'] = a; - z['im'] = b; - } else - switch (typeof a) { - - case 'object': - - if ('im' in a && 're' in a) { - z['re'] = a['re']; - z['im'] = a['im']; - } else if ('abs' in a && 'arg' in a) { - if (!Number.isFinite(a['abs']) && Number.isFinite(a['arg'])) { - return Complex['INFINITY']; - } - z['re'] = a['abs'] * Math.cos(a['arg']); - z['im'] = a['abs'] * Math.sin(a['arg']); - } else if ('r' in a && 'phi' in a) { - if (!Number.isFinite(a['r']) && Number.isFinite(a['phi'])) { - return Complex['INFINITY']; - } - z['re'] = a['r'] * Math.cos(a['phi']); - z['im'] = a['r'] * Math.sin(a['phi']); - } else if (a.length === 2) { // Quick array check - z['re'] = a[0]; - z['im'] = a[1]; - } else { - parser_exit(); - } - break; - - case 'string': - - z['im'] = /* void */ - z['re'] = 0; - - var tokens = a.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g); - var plus = 1; - var minus = 0; - - if (tokens === null) { - parser_exit(); - } - - for (var i = 0; i < tokens.length; i++) { - - var c = tokens[i]; - - if (c === ' ' || c === '\t' || c === '\n') { - /* void */ - } else if (c === '+') { - plus++; - } else if (c === '-') { - minus++; - } else if (c === 'i' || c === 'I') { - - if (plus + minus === 0) { - parser_exit(); - } - - if (tokens[i + 1] !== ' ' && !isNaN(tokens[i + 1])) { - z['im'] += parseFloat((minus % 2 ? '-' : '') + tokens[i + 1]); - i++; - } else { - z['im'] += parseFloat((minus % 2 ? '-' : '') + '1'); - } - plus = minus = 0; - - } else { - - if (plus + minus === 0 || isNaN(c)) { - parser_exit(); - } - - if (tokens[i + 1] === 'i' || tokens[i + 1] === 'I') { - z['im'] += parseFloat((minus % 2 ? '-' : '') + c); - i++; - } else { - z['re'] += parseFloat((minus % 2 ? '-' : '') + c); - } - plus = minus = 0; - } - } - - // Still something on the stack - if (plus + minus > 0) { - parser_exit(); - } - break; - - case 'number': - z['im'] = 0; - z['re'] = a; - break; - - default: - parser_exit(); - } - - if (isNaN(z['re']) || isNaN(z['im'])) { - // If a calculation is NaN, we treat it as NaN and don't throw - //parser_exit(); - } - - return z; - }; - - /** - * @constructor - * @returns {Complex} - */ - function Complex(a, b) { - - if (!(this instanceof Complex)) { - return new Complex(a, b); - } - - var z = parse(a, b); - - this['re'] = z['re']; - this['im'] = z['im']; - } - - Complex.prototype = { - - 're': 0, - 'im': 0, - - /** - * Calculates the sign of a complex number, which is a normalized complex - * - * @returns {Complex} - */ - 'sign': function() { - - var abs = this['abs'](); - - return new Complex( - this['re'] / abs, - this['im'] / abs); - }, - - /** - * Adds two complex numbers - * - * @returns {Complex} - */ - 'add': function(a, b) { - - var z = new Complex(a, b); - - // Infinity + Infinity = NaN - if (this['isInfinite']() && z['isInfinite']()) { - return Complex['NAN']; - } - - // Infinity + z = Infinity { where z != Infinity } - if (this['isInfinite']() || z['isInfinite']()) { - return Complex['INFINITY']; - } - - return new Complex( - this['re'] + z['re'], - this['im'] + z['im']); - }, - - /** - * Subtracts two complex numbers - * - * @returns {Complex} - */ - 'sub': function(a, b) { - - var z = new Complex(a, b); - - // Infinity - Infinity = NaN - if (this['isInfinite']() && z['isInfinite']()) { - return Complex['NAN']; - } - - // Infinity - z = Infinity { where z != Infinity } - if (this['isInfinite']() || z['isInfinite']()) { - return Complex['INFINITY']; - } - - return new Complex( - this['re'] - z['re'], - this['im'] - z['im']); - }, - - /** - * Multiplies two complex numbers - * - * @returns {Complex} - */ - 'mul': function(a, b) { - - var z = new Complex(a, b); - - // Infinity * 0 = NaN - if ((this['isInfinite']() && z['isZero']()) || (this['isZero']() && z['isInfinite']())) { - return Complex['NAN']; - } - - // Infinity * z = Infinity { where z != 0 } - if (this['isInfinite']() || z['isInfinite']()) { - return Complex['INFINITY']; - } - - // Short circuit for real values - if (z['im'] === 0 && this['im'] === 0) { - return new Complex(this['re'] * z['re'], 0); - } - - return new Complex( - this['re'] * z['re'] - this['im'] * z['im'], - this['re'] * z['im'] + this['im'] * z['re']); - }, - - /** - * Divides two complex numbers - * - * @returns {Complex} - */ - 'div': function(a, b) { - - var z = new Complex(a, b); - - // 0 / 0 = NaN and Infinity / Infinity = NaN - if ((this['isZero']() && z['isZero']()) || (this['isInfinite']() && z['isInfinite']())) { - return Complex['NAN']; - } - - // Infinity / 0 = Infinity - if (this['isInfinite']() || z['isZero']()) { - return Complex['INFINITY']; - } - - // 0 / Infinity = 0 - if (this['isZero']() || z['isInfinite']()) { - return Complex['ZERO']; - } - - a = this['re']; - b = this['im']; - - var c = z['re']; - var d = z['im']; - var t, x; - - if (0 === d) { - // Divisor is real - return new Complex(a / c, b / c); - } - - if (Math.abs(c) < Math.abs(d)) { - - x = c / d; - t = c * x + d; - - return new Complex( - (a * x + b) / t, - (b * x - a) / t); - - } else { - - x = d / c; - t = d * x + c; - - return new Complex( - (a + b * x) / t, - (b - a * x) / t); - } - }, - - /** - * Calculate the power of two complex numbers - * - * @returns {Complex} - */ - 'pow': function(a, b) { - - var z = new Complex(a, b); - - a = this['re']; - b = this['im']; - - if (z['isZero']()) { - return Complex['ONE']; - } - - // If the exponent is real - if (z['im'] === 0) { - - if (b === 0 && a >= 0) { - - return new Complex(Math.pow(a, z['re']), 0); - - } else if (a === 0) { // If base is fully imaginary - - switch ((z['re'] % 4 + 4) % 4) { - case 0: - return new Complex(Math.pow(b, z['re']), 0); - case 1: - return new Complex(0, Math.pow(b, z['re'])); - case 2: - return new Complex(-Math.pow(b, z['re']), 0); - case 3: - return new Complex(0, -Math.pow(b, z['re'])); - } - } - } - - /* I couldn't find a good formula, so here is a derivation and optimization - * - * z_1^z_2 = (a + bi)^(c + di) - * = exp((c + di) * log(a + bi) - * = pow(a^2 + b^2, (c + di) / 2) * exp(i(c + di)atan2(b, a)) - * =>... - * Re = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * cos(d * log(a^2 + b^2) / 2 + c * atan2(b, a)) - * Im = (pow(a^2 + b^2, c / 2) * exp(-d * atan2(b, a))) * sin(d * log(a^2 + b^2) / 2 + c * atan2(b, a)) - * - * =>... - * Re = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * cos(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a)) - * Im = exp(c * log(sqrt(a^2 + b^2)) - d * atan2(b, a)) * sin(d * log(sqrt(a^2 + b^2)) + c * atan2(b, a)) - * - * => - * Re = exp(c * logsq2 - d * arg(z_1)) * cos(d * logsq2 + c * arg(z_1)) - * Im = exp(c * logsq2 - d * arg(z_1)) * sin(d * logsq2 + c * arg(z_1)) - * - */ - - if (a === 0 && b === 0 && z['re'] > 0 && z['im'] >= 0) { - return Complex['ZERO']; - } - - var arg = Math.atan2(b, a); - var loh = logHypot(a, b); - - a = Math.exp(z['re'] * loh - z['im'] * arg); - b = z['im'] * loh + z['re'] * arg; - return new Complex( - a * Math.cos(b), - a * Math.sin(b)); - }, - - /** - * Calculate the complex square root - * - * @returns {Complex} - */ - 'sqrt': function() { - - var a = this['re']; - var b = this['im']; - var r = this['abs'](); - - var re, im; - - if (a >= 0) { - - if (b === 0) { - return new Complex(Math.sqrt(a), 0); - } - - re = 0.5 * Math.sqrt(2.0 * (r + a)); - } else { - re = Math.abs(b) / Math.sqrt(2 * (r - a)); - } - - if (a <= 0) { - im = 0.5 * Math.sqrt(2.0 * (r - a)); - } else { - im = Math.abs(b) / Math.sqrt(2 * (r + a)); - } - - return new Complex(re, b < 0 ? -im : im); - }, - - /** - * Calculate the complex exponent - * - * @returns {Complex} - */ - 'exp': function() { - - var tmp = Math.exp(this['re']); - - if (this['im'] === 0) { - //return new Complex(tmp, 0); - } - return new Complex( - tmp * Math.cos(this['im']), - tmp * Math.sin(this['im'])); - }, - - /** - * Calculate the complex exponent and subtracts one. - * - * This may be more accurate than `Complex(x).exp().sub(1)` if - * `x` is small. - * - * @returns {Complex} - */ - 'expm1': function() { - - /** - * exp(a + i*b) - 1 - = exp(a) * (cos(b) + j*sin(b)) - 1 - = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b) - */ - - var a = this['re']; - var b = this['im']; - - return new Complex( - Math.expm1(a) * Math.cos(b) + cosm1(b), - Math.exp(a) * Math.sin(b)); - }, - - /** - * Calculate the natural log - * - * @returns {Complex} - */ - 'log': function() { - - var a = this['re']; - var b = this['im']; - - if (b === 0 && a > 0) { - //return new Complex(Math.log(a), 0); - } - - return new Complex( - logHypot(a, b), - Math.atan2(b, a)); - }, - - /** - * Calculate the magnitude of the complex number - * - * @returns {number} - */ - 'abs': function() { - - return hypot(this['re'], this['im']); - }, - - /** - * Calculate the angle of the complex number - * - * @returns {number} - */ - 'arg': function() { - - return Math.atan2(this['im'], this['re']); - }, - - /** - * Calculate the sine of the complex number - * - * @returns {Complex} - */ - 'sin': function() { - - // sin(c) = (e^b - e^(-b)) / (2i) - - var a = this['re']; - var b = this['im']; - - return new Complex( - Math.sin(a) * cosh(b), - Math.cos(a) * sinh(b)); - }, - - /** - * Calculate the cosine - * - * @returns {Complex} - */ - 'cos': function() { - - // cos(z) = (e^b + e^(-b)) / 2 - - var a = this['re']; - var b = this['im']; - - return new Complex( - Math.cos(a) * cosh(b), - -Math.sin(a) * sinh(b)); - }, - - /** - * Calculate the tangent - * - * @returns {Complex} - */ - 'tan': function() { - - // tan(c) = (e^(ci) - e^(-ci)) / (i(e^(ci) + e^(-ci))) - - var a = 2 * this['re']; - var b = 2 * this['im']; - var d = Math.cos(a) + cosh(b); - - return new Complex( - Math.sin(a) / d, - sinh(b) / d); - }, - - /** - * Calculate the cotangent - * - * @returns {Complex} - */ - 'cot': function() { - - // cot(c) = i(e^(ci) + e^(-ci)) / (e^(ci) - e^(-ci)) - - var a = 2 * this['re']; - var b = 2 * this['im']; - var d = Math.cos(a) - cosh(b); - - return new Complex( - -Math.sin(a) / d, - sinh(b) / d); - }, - - /** - * Calculate the secant - * - * @returns {Complex} - */ - 'sec': function() { - - // sec(c) = 2 / (e^(ci) + e^(-ci)) - - var a = this['re']; - var b = this['im']; - var d = 0.5 * cosh(2 * b) + 0.5 * Math.cos(2 * a); - - return new Complex( - Math.cos(a) * cosh(b) / d, - Math.sin(a) * sinh(b) / d); - }, - - /** - * Calculate the cosecans - * - * @returns {Complex} - */ - 'csc': function() { - - // csc(c) = 2i / (e^(ci) - e^(-ci)) - - var a = this['re']; - var b = this['im']; - var d = 0.5 * cosh(2 * b) - 0.5 * Math.cos(2 * a); - - return new Complex( - Math.sin(a) * cosh(b) / d, - -Math.cos(a) * sinh(b) / d); - }, - - /** - * Calculate the complex arcus sinus - * - * @returns {Complex} - */ - 'asin': function() { - - // asin(c) = -i * log(ci + sqrt(1 - c^2)) - - var a = this['re']; - var b = this['im']; - - var t1 = new Complex( - b * b - a * a + 1, - -2 * a * b)['sqrt'](); - - var t2 = new Complex( - t1['re'] - b, - t1['im'] + a)['log'](); - - return new Complex(t2['im'], -t2['re']); - }, - - /** - * Calculate the complex arcus cosinus - * - * @returns {Complex} - */ - 'acos': function() { - - // acos(c) = i * log(c - i * sqrt(1 - c^2)) - - var a = this['re']; - var b = this['im']; - - var t1 = new Complex( - b * b - a * a + 1, - -2 * a * b)['sqrt'](); - - var t2 = new Complex( - t1['re'] - b, - t1['im'] + a)['log'](); - - return new Complex(Math.PI / 2 - t2['im'], t2['re']); - }, - - /** - * Calculate the complex arcus tangent - * - * @returns {Complex} - */ - 'atan': function() { - - // atan(c) = i / 2 log((i + x) / (i - x)) - - var a = this['re']; - var b = this['im']; - - if (a === 0) { - - if (b === 1) { - return new Complex(0, Infinity); - } - - if (b === -1) { - return new Complex(0, -Infinity); - } - } - - var d = a * a + (1.0 - b) * (1.0 - b); - - var t1 = new Complex( - (1 - b * b - a * a) / d, - -2 * a / d).log(); - - return new Complex(-0.5 * t1['im'], 0.5 * t1['re']); - }, - - /** - * Calculate the complex arcus cotangent - * - * @returns {Complex} - */ - 'acot': function() { - - // acot(c) = i / 2 log((c - i) / (c + i)) - - var a = this['re']; - var b = this['im']; - - if (b === 0) { - return new Complex(Math.atan2(1, a), 0); - } - - var d = a * a + b * b; - return (d !== 0) - ? new Complex( - a / d, - -b / d).atan() - : new Complex( - (a !== 0) ? a / 0 : 0, - (b !== 0) ? -b / 0 : 0).atan(); - }, - - /** - * Calculate the complex arcus secant - * - * @returns {Complex} - */ - 'asec': function() { - - // asec(c) = -i * log(1 / c + sqrt(1 - i / c^2)) - - var a = this['re']; - var b = this['im']; - - if (a === 0 && b === 0) { - return new Complex(0, Infinity); - } - - var d = a * a + b * b; - return (d !== 0) - ? new Complex( - a / d, - -b / d).acos() - : new Complex( - (a !== 0) ? a / 0 : 0, - (b !== 0) ? -b / 0 : 0).acos(); - }, - - /** - * Calculate the complex arcus cosecans - * - * @returns {Complex} - */ - 'acsc': function() { - - // acsc(c) = -i * log(i / c + sqrt(1 - 1 / c^2)) - - var a = this['re']; - var b = this['im']; - - if (a === 0 && b === 0) { - return new Complex(Math.PI / 2, Infinity); - } - - var d = a * a + b * b; - return (d !== 0) - ? new Complex( - a / d, - -b / d).asin() - : new Complex( - (a !== 0) ? a / 0 : 0, - (b !== 0) ? -b / 0 : 0).asin(); - }, - - /** - * Calculate the complex sinh - * - * @returns {Complex} - */ - 'sinh': function() { - - // sinh(c) = (e^c - e^-c) / 2 - - var a = this['re']; - var b = this['im']; - - return new Complex( - sinh(a) * Math.cos(b), - cosh(a) * Math.sin(b)); - }, - - /** - * Calculate the complex cosh - * - * @returns {Complex} - */ - 'cosh': function() { - - // cosh(c) = (e^c + e^-c) / 2 - - var a = this['re']; - var b = this['im']; - - return new Complex( - cosh(a) * Math.cos(b), - sinh(a) * Math.sin(b)); - }, - - /** - * Calculate the complex tanh - * - * @returns {Complex} - */ - 'tanh': function() { - - // tanh(c) = (e^c - e^-c) / (e^c + e^-c) - - var a = 2 * this['re']; - var b = 2 * this['im']; - var d = cosh(a) + Math.cos(b); - - return new Complex( - sinh(a) / d, - Math.sin(b) / d); - }, - - /** - * Calculate the complex coth - * - * @returns {Complex} - */ - 'coth': function() { - - // coth(c) = (e^c + e^-c) / (e^c - e^-c) - - var a = 2 * this['re']; - var b = 2 * this['im']; - var d = cosh(a) - Math.cos(b); - - return new Complex( - sinh(a) / d, - -Math.sin(b) / d); - }, - - /** - * Calculate the complex coth - * - * @returns {Complex} - */ - 'csch': function() { - - // csch(c) = 2 / (e^c - e^-c) - - var a = this['re']; - var b = this['im']; - var d = Math.cos(2 * b) - cosh(2 * a); - - return new Complex( - -2 * sinh(a) * Math.cos(b) / d, - 2 * cosh(a) * Math.sin(b) / d); - }, - - /** - * Calculate the complex sech - * - * @returns {Complex} - */ - 'sech': function() { - - // sech(c) = 2 / (e^c + e^-c) - - var a = this['re']; - var b = this['im']; - var d = Math.cos(2 * b) + cosh(2 * a); - - return new Complex( - 2 * cosh(a) * Math.cos(b) / d, - -2 * sinh(a) * Math.sin(b) / d); - }, - - /** - * Calculate the complex asinh - * - * @returns {Complex} - */ - 'asinh': function() { - - // asinh(c) = log(c + sqrt(c^2 + 1)) - - var tmp = this['im']; - this['im'] = -this['re']; - this['re'] = tmp; - var res = this['asin'](); - - this['re'] = -this['im']; - this['im'] = tmp; - tmp = res['re']; - - res['re'] = -res['im']; - res['im'] = tmp; - return res; - }, - - /** - * Calculate the complex asinh - * - * @returns {Complex} - */ - 'acosh': function() { - - // acosh(c) = log(c + sqrt(c^2 - 1)) - - var res = this['acos'](); - if (res['im'] <= 0) { - var tmp = res['re']; - res['re'] = -res['im']; - res['im'] = tmp; - } else { - var tmp = res['im']; - res['im'] = -res['re']; - res['re'] = tmp; - } - return res; - }, - - /** - * Calculate the complex atanh - * - * @returns {Complex} - */ - 'atanh': function() { - - // atanh(c) = log((1+c) / (1-c)) / 2 - - var a = this['re']; - var b = this['im']; - - var noIM = a > 1 && b === 0; - var oneMinus = 1 - a; - var onePlus = 1 + a; - var d = oneMinus * oneMinus + b * b; - - var x = (d !== 0) - ? new Complex( - (onePlus * oneMinus - b * b) / d, - (b * oneMinus + onePlus * b) / d) - : new Complex( - (a !== -1) ? (a / 0) : 0, - (b !== 0) ? (b / 0) : 0); - - var temp = x['re']; - x['re'] = logHypot(x['re'], x['im']) / 2; - x['im'] = Math.atan2(x['im'], temp) / 2; - if (noIM) { - x['im'] = -x['im']; - } - return x; - }, - - /** - * Calculate the complex acoth - * - * @returns {Complex} - */ - 'acoth': function() { - - // acoth(c) = log((c+1) / (c-1)) / 2 - - var a = this['re']; - var b = this['im']; - - if (a === 0 && b === 0) { - return new Complex(0, Math.PI / 2); - } - - var d = a * a + b * b; - return (d !== 0) - ? new Complex( - a / d, - -b / d).atanh() - : new Complex( - (a !== 0) ? a / 0 : 0, - (b !== 0) ? -b / 0 : 0).atanh(); - }, - - /** - * Calculate the complex acsch - * - * @returns {Complex} - */ - 'acsch': function() { - - // acsch(c) = log((1+sqrt(1+c^2))/c) - - var a = this['re']; - var b = this['im']; - - if (b === 0) { - - return new Complex( - (a !== 0) - ? Math.log(a + Math.sqrt(a * a + 1)) - : Infinity, 0); - } - - var d = a * a + b * b; - return (d !== 0) - ? new Complex( - a / d, - -b / d).asinh() - : new Complex( - (a !== 0) ? a / 0 : 0, - (b !== 0) ? -b / 0 : 0).asinh(); - }, - - /** - * Calculate the complex asech - * - * @returns {Complex} - */ - 'asech': function() { - - // asech(c) = log((1+sqrt(1-c^2))/c) - - var a = this['re']; - var b = this['im']; - - if (this['isZero']()) { - return Complex['INFINITY']; - } - - var d = a * a + b * b; - return (d !== 0) - ? new Complex( - a / d, - -b / d).acosh() - : new Complex( - (a !== 0) ? a / 0 : 0, - (b !== 0) ? -b / 0 : 0).acosh(); - }, - - /** - * Calculate the complex inverse 1/z - * - * @returns {Complex} - */ - 'inverse': function() { - - // 1 / 0 = Infinity and 1 / Infinity = 0 - if (this['isZero']()) { - return Complex['INFINITY']; - } - - if (this['isInfinite']()) { - return Complex['ZERO']; - } - - var a = this['re']; - var b = this['im']; - - var d = a * a + b * b; - - return new Complex(a / d, -b / d); - }, - - /** - * Returns the complex conjugate - * - * @returns {Complex} - */ - 'conjugate': function() { - - return new Complex(this['re'], -this['im']); - }, - - /** - * Gets the negated complex number - * - * @returns {Complex} - */ - 'neg': function() { - - return new Complex(-this['re'], -this['im']); - }, - - /** - * Ceils the actual complex number - * - * @returns {Complex} - */ - 'ceil': function(places) { - - places = Math.pow(10, places || 0); - - return new Complex( - Math.ceil(this['re'] * places) / places, - Math.ceil(this['im'] * places) / places); - }, - - /** - * Floors the actual complex number - * - * @returns {Complex} - */ - 'floor': function(places) { - - places = Math.pow(10, places || 0); - - return new Complex( - Math.floor(this['re'] * places) / places, - Math.floor(this['im'] * places) / places); - }, - - /** - * Ceils the actual complex number - * - * @returns {Complex} - */ - 'round': function(places) { - - places = Math.pow(10, places || 0); - - return new Complex( - Math.round(this['re'] * places) / places, - Math.round(this['im'] * places) / places); - }, - - /** - * Compares two complex numbers - * - * **Note:** new Complex(Infinity).equals(Infinity) === false - * - * @returns {boolean} - */ - 'equals': function(a, b) { - - var z = new Complex(a, b); - - return Math.abs(z['re'] - this['re']) <= Complex['EPSILON'] && - Math.abs(z['im'] - this['im']) <= Complex['EPSILON']; - }, - - /** - * Clones the actual object - * - * @returns {Complex} - */ - 'clone': function() { - - return new Complex(this['re'], this['im']); - }, - - /** - * Gets a string of the actual complex number - * - * @returns {string} - */ - 'toString': function() { - - var a = this['re']; - var b = this['im']; - var ret = ''; - - if (this['isNaN']()) { - return 'NaN'; - } - - if (this['isZero']()) { - return '0'; - } - - if (this['isInfinite']()) { - return 'Infinity'; - } - - if (a !== 0) { - ret += a; - } - - if (b !== 0) { - - if (a !== 0) { - ret += b < 0 ? ' - ' : ' + '; - } else if (b < 0) { - ret += '-'; - } - - b = Math.abs(b); - - if (1 !== b) { - ret += b; - } - ret += 'i'; - } - - if (!ret) - return '0'; - - return ret; - }, - - /** - * Returns the actual number as a vector - * - * @returns {Array} - */ - 'toVector': function() { - - return [this['re'], this['im']]; - }, - - /** - * Returns the actual real value of the current object - * - * @returns {number|null} - */ - 'valueOf': function() { - - if (this['im'] === 0) { - return this['re']; - } - return null; - }, - - /** - * Determines whether a complex number is not on the Riemann sphere. - * - * @returns {boolean} - */ - 'isNaN': function() { - return isNaN(this['re']) || isNaN(this['im']); - }, - - /** - * Determines whether or not a complex number is at the zero pole of the - * Riemann sphere. - * - * @returns {boolean} - */ - 'isZero': function() { - return ( - (this['re'] === 0 || this['re'] === -0) && - (this['im'] === 0 || this['im'] === -0) - ); - }, - - /** - * Determines whether a complex number is not at the infinity pole of the - * Riemann sphere. - * - * @returns {boolean} - */ - 'isFinite': function() { - return isFinite(this['re']) && isFinite(this['im']); - }, - - /** - * Determines whether or not a complex number is at the infinity pole of the - * Riemann sphere. - * - * @returns {boolean} - */ - 'isInfinite': function() { - return !(this['isNaN']() || this['isFinite']()); - } - }; - - Complex['ZERO'] = new Complex(0, 0); - Complex['ONE'] = new Complex(1, 0); - Complex['I'] = new Complex(0, 1); - Complex['PI'] = new Complex(Math.PI, 0); - Complex['E'] = new Complex(Math.E, 0); - Complex['INFINITY'] = new Complex(Infinity, Infinity); - Complex['NAN'] = new Complex(NaN, NaN); - Complex['EPSILON'] = 1e-16; - - if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { - return Complex; - }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} - -})(this); - - -/***/ }), -/* 9 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IndexError; }); + **/!function(r){"use strict";var i=function(e){return.5*(Math.exp(e)+Math.exp(-e))},a=function(e){return.5*(Math.exp(e)-Math.exp(-e))},o=function(){throw SyntaxError("Invalid Param")};function s(e,t){var r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):Math.log(e/Math.cos(Math.atan2(t,e)))}function u(e,t){if(!(this instanceof u))return new u(e,t);var r=function(e,t){var r={re:0,im:0};if(null==e)r.re=r.im=0;else if(void 0!==t)r.re=e,r.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)r.re=e.re,r.im=e.im;else if("abs"in e&&"arg"in e){if(!Number.isFinite(e.abs)&&Number.isFinite(e.arg))return u.INFINITY;r.re=e.abs*Math.cos(e.arg),r.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!Number.isFinite(e.r)&&Number.isFinite(e.phi))return u.INFINITY;r.re=e.r*Math.cos(e.phi),r.im=e.r*Math.sin(e.phi)}else 2===e.length?(r.re=e[0],r.im=e[1]):o();break;case"string":r.im=r.re=0;var n=e.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,a=0;null===n&&o();for(var s=0;s0&&o();break;case"number":r.im=0,r.re=e;break;default:o()}return isNaN(r.re)||isNaN(r.im),r}(e,t);this.re=r.re,this.im=r.im}u.prototype={re:0,im:0,sign:function(){var e=this.abs();return new u(this.re/e,this.im/e)},add:function(e,t){var r=new u(e,t);return this.isInfinite()&&r.isInfinite()?u.NAN:this.isInfinite()||r.isInfinite()?u.INFINITY:new u(this.re+r.re,this.im+r.im)},sub:function(e,t){var r=new u(e,t);return this.isInfinite()&&r.isInfinite()?u.NAN:this.isInfinite()||r.isInfinite()?u.INFINITY:new u(this.re-r.re,this.im-r.im)},mul:function(e,t){var r=new u(e,t);return this.isInfinite()&&r.isZero()||this.isZero()&&r.isInfinite()?u.NAN:this.isInfinite()||r.isInfinite()?u.INFINITY:0===r.im&&0===this.im?new u(this.re*r.re,0):new u(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){var r=new u(e,t);if(this.isZero()&&r.isZero()||this.isInfinite()&&r.isInfinite())return u.NAN;if(this.isInfinite()||r.isZero())return u.INFINITY;if(this.isZero()||r.isInfinite())return u.ZERO;e=this.re,t=this.im;var n,i,a=r.re,o=r.im;return 0===o?new u(e/a,t/a):Math.abs(a)0)return new u(Math.pow(e,r.re),0);if(0===e)switch((r.re%4+4)%4){case 0:return new u(Math.pow(t,r.re),0);case 1:return new u(0,Math.pow(t,r.re));case 2:return new u(-Math.pow(t,r.re),0);case 3:return new u(0,-Math.pow(t,r.re))}}if(0===e&&0===t&&r.re>0&&r.im>=0)return u.ZERO;var n=Math.atan2(t,e),i=s(e,t);return e=Math.exp(r.re*i-r.im*n),t=r.im*i+r.re*n,new u(e*Math.cos(t),e*Math.sin(t))},sqrt:function(){var e,t,r=this.re,n=this.im,i=this.abs();if(r>=0){if(0===n)return new u(Math.sqrt(r),0);e=.5*Math.sqrt(2*(i+r))}else e=Math.abs(n)/Math.sqrt(2*(i-r));return t=r<=0?.5*Math.sqrt(2*(i-r)):Math.abs(n)/Math.sqrt(2*(i+r)),new u(e,n<0?-t:t)},exp:function(){var e=Math.exp(this.re);return this.im,new u(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){var e=this.re,t=this.im;return new u(Math.expm1(e)*Math.cos(t)+function(e){var t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;var r=e*e;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5)}(t),Math.exp(e)*Math.sin(t))},log:function(){var e=this.re,t=this.im;return new u(s(e,t),Math.atan2(t,e))},abs:function(){return e=this.re,t=this.im,r=Math.abs(e),n=Math.abs(t),r<3e3&&n<3e3?Math.sqrt(r*r+n*n):(r1&&0===t,n=1-e,i=1+e,a=n*n+t*t,o=0!==a?new u((i*n-t*t)/a,(t*n+i*t)/a):new u(-1!==e?e/0:0,0!==t?t/0:0),c=o.re;return o.re=s(o.re,o.im)/2,o.im=Math.atan2(o.im,c)/2,r&&(o.im=-o.im),o},acoth:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new u(0,Math.PI/2);var r=e*e+t*t;return 0!==r?new u(e/r,-t/r).atanh():new u(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){var e=this.re,t=this.im;if(0===t)return new u(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);var r=e*e+t*t;return 0!==r?new u(e/r,-t/r).asinh():new u(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){var e=this.re,t=this.im;if(this.isZero())return u.INFINITY;var r=e*e+t*t;return 0!==r?new u(e/r,-t/r).acosh():new u(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return u.INFINITY;if(this.isInfinite())return u.ZERO;var e=this.re,t=this.im,r=e*e+t*t;return new u(e/r,-t/r)},conjugate:function(){return new u(this.re,-this.im)},neg:function(){return new u(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new u(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new u(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new u(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){var r=new u(e,t);return Math.abs(r.re-this.re)<=u.EPSILON&&Math.abs(r.im-this.im)<=u.EPSILON},clone:function(){return new u(this.re,this.im)},toString:function(){var e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)9007199254740991)throw TypeError("Maximum allowed length exceeded");for(f=u(y,n),h=0;hv-n+r;h--)delete y[h-1]}else if(r>n)for(h=v-n;h>g;h--)d=h+r-1,(m=h+n-1)in y?y[d]=y[m]:delete y[d];for(h=0;h=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),a.Arguments=a.Array,i("keys"),i("values"),i("entries")},function(e,t,r){var n=r(56),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},function(e,t,r){var n=r(14),i=r(136),a=r(137),o=r(35),s=r(43),u=r(15),c=u("iterator"),f=u("toStringTag"),l=o.values,p=function(e,t){if(e){if(e[c]!==l)try{s(e,c,l)}catch(t){e[c]=l}if(e[f]||s(e,f,t),i[t])for(var r in o)if(e[r]!==o[r])try{s(e,r,o[r])}catch(t){e[r]=o[r]}}};for(var h in i)p(n[h]&&n[h].prototype,h);p(a,"DOMTokenList")},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t,r){var n=r(14),i=r(43),a=r(31),o=r(106),s=r(128),u=r(55),c=u.get,f=u.enforce,l=String(String).split("String");(e.exports=function(e,t,r,s){var u,c=!!s&&!!s.unsafe,p=!!s&&!!s.enumerable,h=!!s&&!!s.noTargetGet;"function"==typeof r&&("string"!=typeof t||a(r,"name")||i(r,"name",t),(u=f(r)).source||(u.source=l.join("string"==typeof t?t:""))),e!==n?(c?!h&&e[t]&&(p=!0):delete e[t],p?e[t]=r:i(e,t,r)):p?e[t]=r:o(t,r)})(Function.prototype,"toString",(function(){return"function"==typeof this&&c(this).source||s(this)}))},function(e,t,r){"use strict";var n=r(1),i=r(79),a=r(32),o=r(36),s=r(27),u=r(10),c=r(186),f=r(57),l=r(187),p=r(188),h=r(77),m=r(189),d=[],y=d.sort,v=u((function(){d.sort(void 0)})),g=u((function(){d.sort(null)})),x=f("sort"),b=!u((function(){if(h)return h<70;if(!(l&&l>3)){if(p)return!0;if(m)return m<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)d.push({k:t+n,v:r})}for(d.sort((function(e,t){return t.v-e.v})),n=0;ns(r)?1:-1}}(e))).length,n=0;n1?arguments[1]:void 0)}})},function(e,t,r){var n=r(85),i=r(45);e.exports=function(e){return n(i(e))}},function(e,t,r){var n=r(20),i=r(24),a=r(75);e.exports=n?function(e,t,r){return i.f(e,t,a(1,r))}:function(e,t,r){return e[t]=r,e}},function(e,t,r){"use strict";var n=r(1),i=r(14),a=r(64),o=r(89),s=r(20),u=r(104),c=r(10),f=r(31),l=r(66),p=r(23),h=r(76),m=r(25),d=r(32),y=r(42),v=r(86),g=r(27),x=r(75),b=r(48),w=r(109),N=r(65),M=r(157),E=r(133),S=r(63),A=r(24),O=r(125),_=r(43),C=r(39),T=r(88),I=r(91),k=r(78),z=r(90),q=r(15),R=r(165),B=r(166),D=r(102),j=r(55),F=r(58).forEach,P=I("hidden"),U=q("toPrimitive"),L=j.set,$=j.getterFor("Symbol"),H=Object.prototype,G=i.Symbol,V=a("JSON","stringify"),Z=S.f,W=A.f,Y=M.f,J=O.f,X=T("symbols"),Q=T("op-symbols"),K=T("string-to-symbol-registry"),ee=T("symbol-to-string-registry"),te=T("wks"),re=i.QObject,ne=!re||!re.prototype||!re.prototype.findChild,ie=s&&c((function(){return 7!=b(W({},"a",{get:function(){return W(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Z(H,t);n&&delete H[t],W(e,t,r),n&&e!==H&&W(H,t,n)}:W,ae=function(e,t){var r=X[e]=b(G.prototype);return L(r,{type:"Symbol",tag:e,description:t}),s||(r.description=t),r},oe=function(e,t,r){e===H&&oe(Q,t,r),m(e);var n=v(t);return m(r),f(X,n)?(r.enumerable?(f(e,P)&&e[P][n]&&(e[P][n]=!1),r=b(r,{enumerable:x(0,!1)})):(f(e,P)||W(e,P,x(1,{})),e[P][n]=!0),ie(e,n,r)):W(e,n,r)},se=function(e,t){m(e);var r=y(t),n=w(r).concat(le(r));return F(n,(function(t){s&&!ue.call(r,t)||oe(e,t,r[t])})),e},ue=function(e){var t=v(e),r=J.call(this,t);return!(this===H&&f(X,t)&&!f(Q,t))&&(!(r||!f(this,t)||!f(X,t)||f(this,P)&&this[P][t])||r)},ce=function(e,t){var r=y(e),n=v(t);if(r!==H||!f(X,n)||f(Q,n)){var i=Z(r,n);return!i||!f(X,n)||f(r,P)&&r[P][n]||(i.enumerable=!0),i}},fe=function(e){var t=Y(y(e)),r=[];return F(t,(function(e){f(X,e)||f(k,e)||r.push(e)})),r},le=function(e){var t=e===H,r=Y(t?Q:y(e)),n=[];return F(r,(function(e){!f(X,e)||t&&!f(H,e)||n.push(X[e])})),n};(u||(C((G=function(){if(this instanceof G)throw TypeError("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?g(arguments[0]):void 0,t=z(e),r=function(e){this===H&&r.call(Q,e),f(this,P)&&f(this[P],t)&&(this[P][t]=!1),ie(this,t,x(1,e))};return s&&ne&&ie(H,t,{configurable:!0,set:r}),ae(t,e)}).prototype,"toString",(function(){return $(this).tag})),C(G,"withoutSetter",(function(e){return ae(z(e),e)})),O.f=ue,A.f=oe,S.f=ce,N.f=M.f=fe,E.f=le,R.f=function(e){return ae(q(e),e)},s&&(W(G.prototype,"description",{configurable:!0,get:function(){return $(this).description}}),o||C(H,"propertyIsEnumerable",ue,{unsafe:!0}))),n({global:!0,wrap:!0,forced:!u,sham:!u},{Symbol:G}),F(w(te),(function(e){B(e)})),n({target:"Symbol",stat:!0,forced:!u},{for:function(e){var t=g(e);if(f(K,t))return K[t];var r=G(t);return K[t]=r,ee[r]=t,r},keyFor:function(e){if(!h(e))throw TypeError(e+" is not a symbol");if(f(ee,e))return ee[e]},useSetter:function(){ne=!0},useSimple:function(){ne=!1}}),n({target:"Object",stat:!0,forced:!u,sham:!s},{create:function(e,t){return void 0===t?b(e):se(b(e),t)},defineProperty:oe,defineProperties:se,getOwnPropertyDescriptor:ce}),n({target:"Object",stat:!0,forced:!u},{getOwnPropertyNames:fe,getOwnPropertySymbols:le}),n({target:"Object",stat:!0,forced:c((function(){E.f(1)}))},{getOwnPropertySymbols:function(e){return E.f(d(e))}}),V)&&n({target:"JSON",stat:!0,forced:!u||c((function(){var e=G();return"[null]"!=V([e])||"{}"!=V({a:e})||"{}"!=V(Object(e))}))},{stringify:function(e,t,r){for(var n,i=[e],a=1;arguments.length>a;)i.push(arguments[a++]);if(n=t,(p(t)||void 0!==e)&&!h(e))return l(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!h(t))return t}),i[1]=t,V.apply(null,i)}});G.prototype[U]||_(G.prototype,U,G.prototype.valueOf),D(G,"Symbol"),k[P]=!0},function(e,t){e.exports=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,r){"use strict";var n=r(115),i=r(142),a=r(25),o=r(45),s=r(185),u=r(116),c=r(36),f=r(27),l=r(117),p=r(95),h=r(114),m=r(10),d=h.UNSUPPORTED_Y,y=[].push,v=Math.min;n("split",(function(e,t,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var n=f(o(this)),a=void 0===r?4294967295:r>>>0;if(0===a)return[];if(void 0===e)return[n];if(!i(e))return t.call(n,e,a);for(var s,u,c,l=[],h=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),m=0,d=new RegExp(e.source,h+"g");(s=p.call(d,n))&&!((u=d.lastIndex)>m&&(l.push(n.slice(m,s.index)),s.length>1&&s.index=a));)d.lastIndex===s.index&&d.lastIndex++;return m===n.length?!c&&d.test("")||l.push(""):l.push(n.slice(m)),l.length>a?l.slice(0,a):l}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:t.call(this,e,r)}:t,[function(t,r){var i=o(this),a=null==t?void 0:t[e];return void 0!==a?a.call(t,i,r):n.call(f(i),t,r)},function(e,i){var o=a(this),p=f(e),h=r(n,o,p,i,n!==t);if(h.done)return h.value;var m=s(o,RegExp),y=o.unicode,g=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(d?"g":"y"),x=new m(d?"^(?:"+o.source+")":o,g),b=void 0===i?4294967295:i>>>0;if(0===b)return[];if(0===p.length)return null===l(x,p)?[p]:[];for(var w=0,N=0,M=[];N=r.length?{value:void 0,done:!0}:(e=n(r,i),t.index+=e.length,{value:e,done:!1})}))},function(e,t,r){var n,i=r(25),a=r(134),o=r(108),s=r(78),u=r(181),c=r(107),f=r(91),l=f("IE_PROTO"),p=function(){},h=function(e){return"