Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

recharts-scale

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recharts-scale - npm Package Compare versions

Comparing version 0.4.0 to 0.4.2

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 0.4.0 (Seq 28, 2018)
### feat
- use `decimal.js-light` to handle large number or high precision
## 0.3.2 (Aug 21, 2017)

@@ -2,0 +8,0 @@

204

es6/getNiceTickValues.js

@@ -1,30 +0,26 @@

'use strict';
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getTickValuesFixedDomain = exports.getTickValues = exports.getNiceTickValues = undefined;
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /**
* @fileOverview calculate tick values of scale
* @author xile611, arcthur
* @date 2015-09-17
*/
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
var _decimal = require('decimal.js-light');
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
var _decimal2 = _interopRequireDefault(_decimal);
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
var _utils = require('./util/utils');
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
var _arithmetic = require('./util/arithmetic');
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var _arithmetic2 = _interopRequireDefault(_arithmetic);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
/**
* @fileOverview calculate tick values of scale
* @author xile611, arcthur
* @date 2015-09-17
*/
import Decimal from 'decimal.js-light';
import { compose, range, memoize, map, reverse } from './util/utils';
import Arithmetic from './util/arithmetic';
/**
* Calculate a interval of a minimum value and a maximum value

@@ -36,2 +32,3 @@ *

*/
function getValidInterval(_ref) {

@@ -43,6 +40,4 @@ var _ref2 = _slicedToArray(_ref, 2),

var validMin = min,
validMax = max;
validMax = max; // exchange
// exchange
if (min > max) {

@@ -55,3 +50,2 @@ validMin = max;

}
/**

@@ -66,21 +60,20 @@ * Calculate the step which is easy to understand between ticks, like 10, 20, 25

*/
function getFormatStep(roughStep, allowDecimals, correctionFactor) {
if (roughStep.lte(0)) {
return new _decimal2.default(0);
return new Decimal(0);
}
var digitCount = _arithmetic2.default.getDigitCount(roughStep.toNumber());
// The ratio between the rough step and the smallest number which has a bigger
var digitCount = Arithmetic.getDigitCount(roughStep.toNumber()); // The ratio between the rough step and the smallest number which has a bigger
// order of magnitudes than the rough step
var digitCountValue = new _decimal2.default(10).pow(digitCount);
var stepRatio = roughStep.div(digitCountValue);
// When an integer and a float multiplied, the accuracy of result may be wrong
var digitCountValue = new Decimal(10).pow(digitCount);
var stepRatio = roughStep.div(digitCountValue); // When an integer and a float multiplied, the accuracy of result may be wrong
var stepRatioScale = digitCount !== 1 ? 0.05 : 0.1;
var amendStepRatio = new _decimal2.default(Math.ceil(stepRatio.div(stepRatioScale).toNumber())).add(correctionFactor).mul(stepRatioScale);
var amendStepRatio = new Decimal(Math.ceil(stepRatio.div(stepRatioScale).toNumber())).add(correctionFactor).mul(stepRatioScale);
var formatStep = amendStepRatio.mul(digitCountValue);
return allowDecimals ? formatStep : new _decimal2.default(Math.ceil(formatStep));
return allowDecimals ? formatStep : new Decimal(Math.ceil(formatStep));
}
/**

@@ -94,7 +87,9 @@ * calculate the ticks when the minimum value equals to the maximum value

*/
function getTickOfSingleValue(value, tickCount, allowDecimals) {
var step = 1;
// calculate the middle value of ticks
var middle = new _decimal2.default(value);
var step = 1; // calculate the middle value of ticks
var middle = new Decimal(value);
if (!middle.isint() && allowDecimals) {

@@ -105,24 +100,20 @@ var absVal = Math.abs(value);

// The step should be a float number when the difference is smaller than 1
step = new _decimal2.default(10).pow(_arithmetic2.default.getDigitCount(value) - 1);
middle = new _decimal2.default(Math.floor(middle.div(step).toNumber())).mul(step);
step = new Decimal(10).pow(Arithmetic.getDigitCount(value) - 1);
middle = new Decimal(Math.floor(middle.div(step).toNumber())).mul(step);
} else if (absVal > 1) {
// Return the maximum integer which is smaller than 'value' when 'value' is greater than 1
middle = new _decimal2.default(Math.floor(value));
middle = new Decimal(Math.floor(value));
}
} else if (value === 0) {
middle = new _decimal2.default(Math.floor((tickCount - 1) / 2));
middle = new Decimal(Math.floor((tickCount - 1) / 2));
} else if (!allowDecimals) {
middle = new _decimal2.default(Math.floor(value));
middle = new Decimal(Math.floor(value));
}
var middleIndex = Math.floor((tickCount - 1) / 2);
var fn = (0, _utils.compose)((0, _utils.map)(function (n) {
return middle.add(new _decimal2.default(n - middleIndex).mul(step)).toNumber();
}), _utils.range);
var fn = compose(map(function (n) {
return middle.add(new Decimal(n - middleIndex).mul(step)).toNumber();
}), range);
return fn(0, tickCount);
}
/**

@@ -138,2 +129,4 @@ * Calculate the step

*/
function calculateStep(min, max, tickCount, allowDecimals) {

@@ -145,26 +138,24 @@ var correctionFactor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;

return {
step: new _decimal2.default(0),
tickMin: new _decimal2.default(0),
tickMax: new _decimal2.default(0)
step: new Decimal(0),
tickMin: new Decimal(0),
tickMax: new Decimal(0)
};
}
} // The step which is easy to understand between two ticks
// The step which is easy to understand between two ticks
var step = getFormatStep(new _decimal2.default(max).sub(min).div(tickCount - 1), allowDecimals, correctionFactor);
// A medial value of ticks
var middle = void 0;
var step = getFormatStep(new Decimal(max).sub(min).div(tickCount - 1), allowDecimals, correctionFactor); // A medial value of ticks
// When 0 is inside the interval, 0 should be a tick
var middle; // When 0 is inside the interval, 0 should be a tick
if (min <= 0 && max >= 0) {
middle = new _decimal2.default(0);
middle = new Decimal(0);
} else {
// calculate the middle value
middle = new _decimal2.default(min).add(max).div(2);
// minus modulo value
middle = middle.sub(new _decimal2.default(middle).mod(step));
middle = new Decimal(min).add(max).div(2); // minus modulo value
middle = middle.sub(new Decimal(middle).mod(step));
}
var belowCount = Math.ceil(middle.sub(min).div(step).toNumber());
var upCount = Math.ceil(new _decimal2.default(max).sub(middle).div(step).toNumber());
var upCount = Math.ceil(new Decimal(max).sub(middle).div(step).toNumber());
var scaleCount = belowCount + upCount + 1;

@@ -175,3 +166,5 @@

return calculateStep(min, max, tickCount, allowDecimals, correctionFactor + 1);
} else if (scaleCount < tickCount) {
}
if (scaleCount < tickCount) {
// When less ticks can cover the interval, we should add some additional ticks

@@ -184,8 +177,8 @@ upCount = max > 0 ? upCount + (tickCount - scaleCount) : upCount;

step: step,
tickMin: middle.sub(new _decimal2.default(belowCount).mul(step)),
tickMax: middle.add(new _decimal2.default(upCount).mul(step))
tickMin: middle.sub(new Decimal(belowCount).mul(step)),
tickMax: middle.add(new Decimal(upCount).mul(step))
};
}
/**
* Calculate the ticks of an interval
* Calculate the ticks of an interval, the count of ticks will be guraranteed
*

@@ -197,2 +190,4 @@ * @param {Number} min, max min: The minimum value, max: The maximum value

*/
function getNiceTickValuesFn(_ref3) {

@@ -205,3 +200,2 @@ var _ref4 = _slicedToArray(_ref3, 2),

var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
// More than two ticks should be return

@@ -215,7 +209,16 @@ var count = Math.max(tickCount, 2);

if (cormin === -Infinity || cormax === Infinity) {
var _values = cormax === Infinity ? [cormin].concat(_toConsumableArray(range(0, tickCount - 1).map(function () {
return Infinity;
}))) : _toConsumableArray(range(0, tickCount - 1).map(function () {
return -Infinity;
})).concat([cormax]);
return min > max ? reverse(_values) : _values;
}
if (cormin === cormax) {
return getTickOfSingleValue(cormin, tickCount, allowDecimals);
}
} // Get the step between two ticks
// Get the step between two ticks

@@ -227,7 +230,15 @@ var _calculateStep = calculateStep(cormin, cormax, count, allowDecimals),

var values = _arithmetic2.default.rangeStep(tickMin, tickMax.add(new _decimal2.default(0.1).mul(step)), step);
return min > max ? (0, _utils.reverse)(values) : values;
var values = Arithmetic.rangeStep(tickMin, tickMax.add(new Decimal(0.1).mul(step)), step);
return min > max ? reverse(values) : values;
}
/**
* Calculate the ticks of an interval, the count of ticks won't be guraranteed
*
* @param {Number} min, max min: The minimum value, max: The maximum value
* @param {Integer} tickCount The count of ticks
* @param {Boolean} allowDecimals Allow the ticks to be decimals or not
* @return {Array} ticks
*/
function getTickValuesFn(_ref5) {

@@ -240,3 +251,2 @@ var _ref6 = _slicedToArray(_ref5, 2),

var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
// More than two ticks should be return

@@ -250,2 +260,6 @@ var count = Math.max(tickCount, 2);

if (cormin === -Infinity || cormax === Infinity) {
return [min, max];
}
if (cormin === cormax) {

@@ -255,15 +269,22 @@ return getTickOfSingleValue(cormin, tickCount, allowDecimals);

var step = getFormatStep(new _decimal2.default(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
var fn = (0, _utils.compose)((0, _utils.map)(function (n) {
return new _decimal2.default(cormin).add(new _decimal2.default(n).mul(step)).toNumber();
}), _utils.range);
var step = getFormatStep(new Decimal(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
var fn = compose(map(function (n) {
return new Decimal(cormin).add(new Decimal(n).mul(step)).toNumber();
}), range);
var values = fn(0, count).filter(function (entry) {
return entry >= cormin && entry <= cormax;
});
return min > max ? (0, _utils.reverse)(values) : values;
return min > max ? reverse(values) : values;
}
/**
* Calculate the ticks of an interval, the count of ticks won't be guraranteed,
* but the domain will be guaranteed
*
* @param {Number} min, max min: The minimum value, max: The maximum value
* @param {Integer} tickCount The count of ticks
* @param {Boolean} allowDecimals Allow the ticks to be decimals or not
* @return {Array} ticks
*/
function getTickValuesFixedDomainFn(_ref7, tickCount) {

@@ -282,2 +303,6 @@ var _ref8 = _slicedToArray(_ref7, 2),

if (cormin === -Infinity || cormax === Infinity) {
return [min, max];
}
if (cormin === cormax) {

@@ -288,10 +313,11 @@ return [cormin];

var count = Math.max(tickCount, 2);
var step = getFormatStep(new _decimal2.default(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
var values = [].concat(_toConsumableArray(_arithmetic2.default.rangeStep(new _decimal2.default(cormin), new _decimal2.default(cormax).sub(new _decimal2.default(0.99).mul(step)), step)), [cormax]);
var step = getFormatStep(new Decimal(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
return min > max ? (0, _utils.reverse)(values) : values;
var values = _toConsumableArray(Arithmetic.rangeStep(new Decimal(cormin), new Decimal(cormax).sub(new Decimal(0.99).mul(step)), step)).concat([cormax]);
return min > max ? reverse(values) : values;
}
var getNiceTickValues = exports.getNiceTickValues = (0, _utils.memoize)(getNiceTickValuesFn);
var getTickValues = exports.getTickValues = (0, _utils.memoize)(getTickValuesFn);
var getTickValuesFixedDomain = exports.getTickValuesFixedDomain = (0, _utils.memoize)(getTickValuesFixedDomainFn);
export var getNiceTickValues = memoize(getNiceTickValuesFn);
export var getTickValues = memoize(getTickValuesFn);
export var getTickValuesFixedDomain = memoize(getTickValuesFixedDomainFn);

@@ -1,26 +0,1 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _getNiceTickValues = require('./getNiceTickValues');
Object.defineProperty(exports, 'getTickValues', {
enumerable: true,
get: function get() {
return _getNiceTickValues.getTickValues;
}
});
Object.defineProperty(exports, 'getNiceTickValues', {
enumerable: true,
get: function get() {
return _getNiceTickValues.getNiceTickValues;
}
});
Object.defineProperty(exports, 'getTickValuesFixedDomain', {
enumerable: true,
get: function get() {
return _getNiceTickValues.getTickValuesFixedDomain;
}
});
export { getTickValues, getNiceTickValues, getTickValuesFixedDomain } from './getNiceTickValues';

@@ -1,16 +0,9 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _decimal = require('decimal.js-light');
var _decimal2 = _interopRequireDefault(_decimal);
var _utils = require('./utils');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @fileOverview 一些公用的运算方法
* @author xile611
* @date 2015-09-17
*/
import Decimal from 'decimal.js-light';
import { curry } from './utils';
/**
* 获取数值的位数

@@ -24,9 +17,5 @@ * 其中绝对值属于区间[0.1, 1), 得到的值为0

*/
/**
* @fileOverview 一些公用的运算方法
* @author xile611
* @date 2015-09-17
*/
function getDigitCount(value) {
var result = void 0;
var result;

@@ -36,3 +25,3 @@ if (value === 0) {

} else {
result = Math.floor(new _decimal2.default(value).abs().log(10).toNumber()) + 1;
result = Math.floor(new Decimal(value).abs().log(10).toNumber()) + 1;
}

@@ -42,3 +31,2 @@

}
/**

@@ -53,4 +41,6 @@ * 按照固定的步长获取[start, end)这个区间的数据

*/
function rangeStep(start, end, step) {
var num = new _decimal2.default(start);
var num = new Decimal(start);
var result = [];

@@ -60,3 +50,2 @@

result.push(num.toNumber());
num = num.add(step);

@@ -75,6 +64,7 @@ }

*/
var interpolateNumber = (0, _utils.curry)(function (a, b, t) {
var interpolateNumber = curry(function (a, b, t) {
var newA = +a;
var newB = +b;
return newA + t * (newB - newA);

@@ -90,7 +80,6 @@ });

*/
var uninterpolateNumber = (0, _utils.curry)(function (a, b, x) {
var uninterpolateNumber = curry(function (a, b, x) {
var diff = b - +a;
diff = diff || Infinity;
return (x - a) / diff;

@@ -107,14 +96,11 @@ });

*/
var uninterpolateTruncation = (0, _utils.curry)(function (a, b, x) {
var uninterpolateTruncation = curry(function (a, b, x) {
var diff = b - +a;
diff = diff || Infinity;
return Math.max(0, Math.min(1, (x - a) / diff));
});
exports.default = {
export default {
rangeStep: rangeStep,
getDigitCount: getDigitCount,
interpolateNumber: interpolateNumber,

@@ -121,0 +107,0 @@ uninterpolateNumber: uninterpolateNumber,

@@ -1,9 +0,9 @@

'use strict';
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
Object.defineProperty(exports, "__esModule", {
value: true
});
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
var identity = function identity(i) {

@@ -13,3 +13,3 @@ return i;

var PLACE_HOLDER = exports.PLACE_HOLDER = {
export var PLACE_HOLDER = {
'@@functional/placeholder': true

@@ -28,3 +28,3 @@ };

return fn.apply(undefined, arguments);
return fn.apply(void 0, arguments);
};

@@ -39,3 +39,3 @@ };

return curry0(function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];

@@ -49,7 +49,7 @@ }

if (argsLength >= n) {
return fn.apply(undefined, args);
return fn.apply(void 0, args);
}
return curryN(n - argsLength, curry0(function () {
for (var _len2 = arguments.length, restArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
for (var _len2 = arguments.length, restArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
restArgs[_key2] = arguments[_key2];

@@ -61,4 +61,3 @@ }

});
return fn.apply(undefined, _toConsumableArray(newArgs).concat(restArgs));
return fn.apply(void 0, _toConsumableArray(newArgs).concat(restArgs));
}));

@@ -68,7 +67,6 @@ });

var curry = exports.curry = function curry(fn) {
export var curry = function curry(fn) {
return curryN(fn.length, fn);
};
var range = exports.range = function range(begin, end) {
export var range = function range(begin, end) {
var arr = [];

@@ -82,4 +80,3 @@

};
var map = exports.map = curry(function (fn, arr) {
export var map = curry(function (fn, arr) {
if (Array.isArray(arr)) {

@@ -93,5 +90,4 @@ return arr.map(fn);

});
var compose = exports.compose = function compose() {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
export var compose = function compose() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];

@@ -104,29 +100,25 @@ }

var fns = args.reverse();
// first function can receive multiply arguments
var fns = args.reverse(); // first function can receive multiply arguments
var firstFn = fns[0];
var tailsFn = fns.slice(1);
return function () {
return tailsFn.reduce(function (res, fn) {
return fn(res);
}, firstFn.apply(undefined, arguments));
}, firstFn.apply(void 0, arguments));
};
};
var reverse = exports.reverse = function reverse(arr) {
export var reverse = function reverse(arr) {
if (Array.isArray(arr)) {
return arr.reverse();
}
} // can be string
// can be string
return arr.split('').reverse.join('');
};
var memoize = exports.memoize = function memoize(fn) {
export var memoize = function memoize(fn) {
var lastArgs = null;
var lastResult = null;
return function () {
for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];

@@ -142,6 +134,5 @@ }

lastArgs = args;
lastResult = fn.apply(undefined, args);
lastResult = fn.apply(void 0, args);
return lastResult;
};
};

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,25 +6,28 @@ Object.defineProperty(exports, "__esModule", {

});
exports.getTickValuesFixedDomain = exports.getTickValues = exports.getNiceTickValues = undefined;
exports.getTickValuesFixedDomain = exports.getTickValues = exports.getNiceTickValues = void 0;
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /**
* @fileOverview calculate tick values of scale
* @author xile611, arcthur
* @date 2015-09-17
*/
var _decimal = _interopRequireDefault(require("decimal.js-light"));
var _utils = require("./util/utils");
var _decimal = require('decimal.js-light');
var _arithmetic = _interopRequireDefault(require("./util/arithmetic"));
var _decimal2 = _interopRequireDefault(_decimal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _utils = require('./util/utils');
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
var _arithmetic = require('./util/arithmetic');
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
var _arithmetic2 = _interopRequireDefault(_arithmetic);
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
/**

@@ -43,6 +46,4 @@ * Calculate a interval of a minimum value and a maximum value

var validMin = min,
validMax = max;
validMax = max; // exchange
// exchange
if (min > max) {

@@ -55,3 +56,2 @@ validMin = max;

}
/**

@@ -66,21 +66,21 @@ * Calculate the step which is easy to understand between ticks, like 10, 20, 25

*/
function getFormatStep(roughStep, allowDecimals, correctionFactor) {
if (roughStep.lte(0)) {
return new _decimal2.default(0);
return new _decimal.default(0);
}
var digitCount = _arithmetic2.default.getDigitCount(roughStep.toNumber());
// The ratio between the rough step and the smallest number which has a bigger
var digitCount = _arithmetic.default.getDigitCount(roughStep.toNumber()); // The ratio between the rough step and the smallest number which has a bigger
// order of magnitudes than the rough step
var digitCountValue = new _decimal2.default(10).pow(digitCount);
var stepRatio = roughStep.div(digitCountValue);
// When an integer and a float multiplied, the accuracy of result may be wrong
var digitCountValue = new _decimal.default(10).pow(digitCount);
var stepRatio = roughStep.div(digitCountValue); // When an integer and a float multiplied, the accuracy of result may be wrong
var stepRatioScale = digitCount !== 1 ? 0.05 : 0.1;
var amendStepRatio = new _decimal2.default(Math.ceil(stepRatio.div(stepRatioScale).toNumber())).add(correctionFactor).mul(stepRatioScale);
var amendStepRatio = new _decimal.default(Math.ceil(stepRatio.div(stepRatioScale).toNumber())).add(correctionFactor).mul(stepRatioScale);
var formatStep = amendStepRatio.mul(digitCountValue);
return allowDecimals ? formatStep : new _decimal2.default(Math.ceil(formatStep));
return allowDecimals ? formatStep : new _decimal.default(Math.ceil(formatStep));
}
/**

@@ -94,7 +94,9 @@ * calculate the ticks when the minimum value equals to the maximum value

*/
function getTickOfSingleValue(value, tickCount, allowDecimals) {
var step = 1;
// calculate the middle value of ticks
var middle = new _decimal2.default(value);
var step = 1; // calculate the middle value of ticks
var middle = new _decimal.default(value);
if (!middle.isint() && allowDecimals) {

@@ -105,24 +107,20 @@ var absVal = Math.abs(value);

// The step should be a float number when the difference is smaller than 1
step = new _decimal2.default(10).pow(_arithmetic2.default.getDigitCount(value) - 1);
middle = new _decimal2.default(Math.floor(middle.div(step).toNumber())).mul(step);
step = new _decimal.default(10).pow(_arithmetic.default.getDigitCount(value) - 1);
middle = new _decimal.default(Math.floor(middle.div(step).toNumber())).mul(step);
} else if (absVal > 1) {
// Return the maximum integer which is smaller than 'value' when 'value' is greater than 1
middle = new _decimal2.default(Math.floor(value));
middle = new _decimal.default(Math.floor(value));
}
} else if (value === 0) {
middle = new _decimal2.default(Math.floor((tickCount - 1) / 2));
middle = new _decimal.default(Math.floor((tickCount - 1) / 2));
} else if (!allowDecimals) {
middle = new _decimal2.default(Math.floor(value));
middle = new _decimal.default(Math.floor(value));
}
var middleIndex = Math.floor((tickCount - 1) / 2);
var fn = (0, _utils.compose)((0, _utils.map)(function (n) {
return middle.add(new _decimal2.default(n - middleIndex).mul(step)).toNumber();
return middle.add(new _decimal.default(n - middleIndex).mul(step)).toNumber();
}), _utils.range);
return fn(0, tickCount);
}
/**

@@ -138,2 +136,4 @@ * Calculate the step

*/
function calculateStep(min, max, tickCount, allowDecimals) {

@@ -145,26 +145,24 @@ var correctionFactor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;

return {
step: new _decimal2.default(0),
tickMin: new _decimal2.default(0),
tickMax: new _decimal2.default(0)
step: new _decimal.default(0),
tickMin: new _decimal.default(0),
tickMax: new _decimal.default(0)
};
}
} // The step which is easy to understand between two ticks
// The step which is easy to understand between two ticks
var step = getFormatStep(new _decimal2.default(max).sub(min).div(tickCount - 1), allowDecimals, correctionFactor);
// A medial value of ticks
var middle = void 0;
var step = getFormatStep(new _decimal.default(max).sub(min).div(tickCount - 1), allowDecimals, correctionFactor); // A medial value of ticks
// When 0 is inside the interval, 0 should be a tick
var middle; // When 0 is inside the interval, 0 should be a tick
if (min <= 0 && max >= 0) {
middle = new _decimal2.default(0);
middle = new _decimal.default(0);
} else {
// calculate the middle value
middle = new _decimal2.default(min).add(max).div(2);
// minus modulo value
middle = middle.sub(new _decimal2.default(middle).mod(step));
middle = new _decimal.default(min).add(max).div(2); // minus modulo value
middle = middle.sub(new _decimal.default(middle).mod(step));
}
var belowCount = Math.ceil(middle.sub(min).div(step).toNumber());
var upCount = Math.ceil(new _decimal2.default(max).sub(middle).div(step).toNumber());
var upCount = Math.ceil(new _decimal.default(max).sub(middle).div(step).toNumber());
var scaleCount = belowCount + upCount + 1;

@@ -175,3 +173,5 @@

return calculateStep(min, max, tickCount, allowDecimals, correctionFactor + 1);
} else if (scaleCount < tickCount) {
}
if (scaleCount < tickCount) {
// When less ticks can cover the interval, we should add some additional ticks

@@ -184,8 +184,8 @@ upCount = max > 0 ? upCount + (tickCount - scaleCount) : upCount;

step: step,
tickMin: middle.sub(new _decimal2.default(belowCount).mul(step)),
tickMax: middle.add(new _decimal2.default(upCount).mul(step))
tickMin: middle.sub(new _decimal.default(belowCount).mul(step)),
tickMax: middle.add(new _decimal.default(upCount).mul(step))
};
}
/**
* Calculate the ticks of an interval
* Calculate the ticks of an interval, the count of ticks will be guraranteed
*

@@ -197,2 +197,4 @@ * @param {Number} min, max min: The minimum value, max: The maximum value

*/
function getNiceTickValuesFn(_ref3) {

@@ -205,3 +207,2 @@ var _ref4 = _slicedToArray(_ref3, 2),

var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
// More than two ticks should be return

@@ -215,7 +216,16 @@ var count = Math.max(tickCount, 2);

if (cormin === -Infinity || cormax === Infinity) {
var _values = cormax === Infinity ? [cormin].concat(_toConsumableArray((0, _utils.range)(0, tickCount - 1).map(function () {
return Infinity;
}))) : _toConsumableArray((0, _utils.range)(0, tickCount - 1).map(function () {
return -Infinity;
})).concat([cormax]);
return min > max ? (0, _utils.reverse)(_values) : _values;
}
if (cormin === cormax) {
return getTickOfSingleValue(cormin, tickCount, allowDecimals);
}
} // Get the step between two ticks
// Get the step between two ticks

@@ -227,7 +237,16 @@ var _calculateStep = calculateStep(cormin, cormax, count, allowDecimals),

var values = _arithmetic2.default.rangeStep(tickMin, tickMax.add(new _decimal2.default(0.1).mul(step)), step);
var values = _arithmetic.default.rangeStep(tickMin, tickMax.add(new _decimal.default(0.1).mul(step)), step);
return min > max ? (0, _utils.reverse)(values) : values;
}
/**
* Calculate the ticks of an interval, the count of ticks won't be guraranteed
*
* @param {Number} min, max min: The minimum value, max: The maximum value
* @param {Integer} tickCount The count of ticks
* @param {Boolean} allowDecimals Allow the ticks to be decimals or not
* @return {Array} ticks
*/
function getTickValuesFn(_ref5) {

@@ -240,3 +259,2 @@ var _ref6 = _slicedToArray(_ref5, 2),

var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
// More than two ticks should be return

@@ -250,2 +268,6 @@ var count = Math.max(tickCount, 2);

if (cormin === -Infinity || cormax === Infinity) {
return [min, max];
}
if (cormin === cormax) {

@@ -255,15 +277,22 @@ return getTickOfSingleValue(cormin, tickCount, allowDecimals);

var step = getFormatStep(new _decimal2.default(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
var step = getFormatStep(new _decimal.default(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
var fn = (0, _utils.compose)((0, _utils.map)(function (n) {
return new _decimal2.default(cormin).add(new _decimal2.default(n).mul(step)).toNumber();
return new _decimal.default(cormin).add(new _decimal.default(n).mul(step)).toNumber();
}), _utils.range);
var values = fn(0, count).filter(function (entry) {
return entry >= cormin && entry <= cormax;
});
return min > max ? (0, _utils.reverse)(values) : values;
}
/**
* Calculate the ticks of an interval, the count of ticks won't be guraranteed,
* but the domain will be guaranteed
*
* @param {Number} min, max min: The minimum value, max: The maximum value
* @param {Integer} tickCount The count of ticks
* @param {Boolean} allowDecimals Allow the ticks to be decimals or not
* @return {Array} ticks
*/
function getTickValuesFixedDomainFn(_ref7, tickCount) {

@@ -282,2 +311,6 @@ var _ref8 = _slicedToArray(_ref7, 2),

if (cormin === -Infinity || cormax === Infinity) {
return [min, max];
}
if (cormin === cormax) {

@@ -288,10 +321,14 @@ return [cormin];

var count = Math.max(tickCount, 2);
var step = getFormatStep(new _decimal2.default(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
var values = [].concat(_toConsumableArray(_arithmetic2.default.rangeStep(new _decimal2.default(cormin), new _decimal2.default(cormax).sub(new _decimal2.default(0.99).mul(step)), step)), [cormax]);
var step = getFormatStep(new _decimal.default(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
var values = _toConsumableArray(_arithmetic.default.rangeStep(new _decimal.default(cormin), new _decimal.default(cormax).sub(new _decimal.default(0.99).mul(step)), step)).concat([cormax]);
return min > max ? (0, _utils.reverse)(values) : values;
}
var getNiceTickValues = exports.getNiceTickValues = (0, _utils.memoize)(getNiceTickValuesFn);
var getTickValues = exports.getTickValues = (0, _utils.memoize)(getTickValuesFn);
var getTickValuesFixedDomain = exports.getTickValuesFixedDomain = (0, _utils.memoize)(getTickValuesFixedDomainFn);
var getNiceTickValues = (0, _utils.memoize)(getNiceTickValuesFn);
exports.getNiceTickValues = getNiceTickValues;
var getTickValues = (0, _utils.memoize)(getTickValuesFn);
exports.getTickValues = getTickValues;
var getTickValuesFixedDomain = (0, _utils.memoize)(getTickValuesFixedDomainFn);
exports.getTickValuesFixedDomain = getTickValuesFixedDomain;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,6 +6,3 @@ Object.defineProperty(exports, "__esModule", {

});
var _getNiceTickValues = require('./getNiceTickValues');
Object.defineProperty(exports, 'getTickValues', {
Object.defineProperty(exports, "getTickValues", {
enumerable: true,

@@ -16,3 +13,3 @@ get: function get() {

});
Object.defineProperty(exports, 'getNiceTickValues', {
Object.defineProperty(exports, "getNiceTickValues", {
enumerable: true,

@@ -23,3 +20,3 @@ get: function get() {

});
Object.defineProperty(exports, 'getTickValuesFixedDomain', {
Object.defineProperty(exports, "getTickValuesFixedDomain", {
enumerable: true,

@@ -29,2 +26,4 @@ get: function get() {

}
});
});
var _getNiceTickValues = require("./getNiceTickValues");

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,12 +6,17 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = void 0;
var _decimal = require('decimal.js-light');
var _decimal = _interopRequireDefault(require("decimal.js-light"));
var _decimal2 = _interopRequireDefault(_decimal);
var _utils = require("./utils");
var _utils = require('./utils');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @fileOverview 一些公用的运算方法
* @author xile611
* @date 2015-09-17
*/
/**
* 获取数值的位数

@@ -25,9 +30,4 @@ * 其中绝对值属于区间[0.1, 1), 得到的值为0

*/
/**
* @fileOverview 一些公用的运算方法
* @author xile611
* @date 2015-09-17
*/
function getDigitCount(value) {
var result = void 0;
var result;

@@ -37,3 +37,3 @@ if (value === 0) {

} else {
result = Math.floor(new _decimal2.default(value).abs().log(10).toNumber()) + 1;
result = Math.floor(new _decimal.default(value).abs().log(10).toNumber()) + 1;
}

@@ -43,3 +43,2 @@

}
/**

@@ -54,4 +53,6 @@ * 按照固定的步长获取[start, end)这个区间的数据

*/
function rangeStep(start, end, step) {
var num = new _decimal2.default(start);
var num = new _decimal.default(start);
var result = [];

@@ -61,3 +62,2 @@

result.push(num.toNumber());
num = num.add(step);

@@ -76,6 +76,7 @@ }

*/
var interpolateNumber = (0, _utils.curry)(function (a, b, t) {
var newA = +a;
var newB = +b;
return newA + t * (newB - newA);

@@ -91,7 +92,6 @@ });

*/
var uninterpolateNumber = (0, _utils.curry)(function (a, b, x) {
var diff = b - +a;
diff = diff || Infinity;
return (x - a) / diff;

@@ -108,17 +108,15 @@ });

*/
var uninterpolateTruncation = (0, _utils.curry)(function (a, b, x) {
var diff = b - +a;
diff = diff || Infinity;
return Math.max(0, Math.min(1, (x - a) / diff));
});
exports.default = {
var _default = {
rangeStep: rangeStep,
getDigitCount: getDigitCount,
interpolateNumber: interpolateNumber,
uninterpolateNumber: uninterpolateNumber,
uninterpolateTruncation: uninterpolateTruncation
};
};
exports.default = _default;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,5 +6,12 @@ Object.defineProperty(exports, "__esModule", {

});
exports.memoize = exports.reverse = exports.compose = exports.map = exports.range = exports.curry = exports.PLACE_HOLDER = void 0;
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
var identity = function identity(i) {

@@ -14,5 +21,6 @@ return i;

var PLACE_HOLDER = exports.PLACE_HOLDER = {
var PLACE_HOLDER = {
'@@functional/placeholder': true
};
exports.PLACE_HOLDER = PLACE_HOLDER;

@@ -29,3 +37,3 @@ var isPlaceHolder = function isPlaceHolder(val) {

return fn.apply(undefined, arguments);
return fn.apply(void 0, arguments);
};

@@ -40,3 +48,3 @@ };

return curry0(function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];

@@ -50,7 +58,7 @@ }

if (argsLength >= n) {
return fn.apply(undefined, args);
return fn.apply(void 0, args);
}
return curryN(n - argsLength, curry0(function () {
for (var _len2 = arguments.length, restArgs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
for (var _len2 = arguments.length, restArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
restArgs[_key2] = arguments[_key2];

@@ -62,4 +70,3 @@ }

});
return fn.apply(undefined, _toConsumableArray(newArgs).concat(restArgs));
return fn.apply(void 0, _toConsumableArray(newArgs).concat(restArgs));
}));

@@ -69,7 +76,9 @@ });

var curry = exports.curry = function curry(fn) {
var curry = function curry(fn) {
return curryN(fn.length, fn);
};
var range = exports.range = function range(begin, end) {
exports.curry = curry;
var range = function range(begin, end) {
var arr = [];

@@ -84,3 +93,4 @@

var map = exports.map = curry(function (fn, arr) {
exports.range = range;
var map = curry(function (fn, arr) {
if (Array.isArray(arr)) {

@@ -94,5 +104,6 @@ return arr.map(fn);

});
exports.map = map;
var compose = exports.compose = function compose() {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
var compose = function compose() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];

@@ -105,29 +116,31 @@ }

var fns = args.reverse();
// first function can receive multiply arguments
var fns = args.reverse(); // first function can receive multiply arguments
var firstFn = fns[0];
var tailsFn = fns.slice(1);
return function () {
return tailsFn.reduce(function (res, fn) {
return fn(res);
}, firstFn.apply(undefined, arguments));
}, firstFn.apply(void 0, arguments));
};
};
var reverse = exports.reverse = function reverse(arr) {
exports.compose = compose;
var reverse = function reverse(arr) {
if (Array.isArray(arr)) {
return arr.reverse();
}
} // can be string
// can be string
return arr.split('').reverse.join('');
};
var memoize = exports.memoize = function memoize(fn) {
exports.reverse = reverse;
var memoize = function memoize(fn) {
var lastArgs = null;
var lastResult = null;
return function () {
for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];

@@ -143,6 +156,7 @@ }

lastArgs = args;
lastResult = fn.apply(undefined, args);
lastResult = fn.apply(void 0, args);
return lastResult;
};
};
};
exports.memoize = memoize;
{
"name": "recharts-scale",
"version": "0.4.0",
"version": "0.4.2",
"description": "Scale of Cartesian Coordinates",

@@ -19,2 +19,12 @@ "main": "lib/index",

],
"scripts": {
"build": "npm run build-cjs && npm run build-es6 && rimraf umd && npm run build-umd && npm run build-min",
"build-cjs": "rimraf lib && cross-env BABEL_ENV=commonjs babel ./src -d lib",
"build-es6": "rimraf es6 && cross-env babel ./src -d es6 --blacklist=es6.modules",
"build-umd": "cross-env NODE_ENV=development BABEL_ENV=commonjs webpack -p src/index.js -o umd/RechartsScale.js",
"build-min": "cross-env NODE_ENV=production BABEL_ENV=commonjs webpack -p src/index.js -o umd/RechartsScale.min.js",
"test": "nyc ava --verbose",
"autofix": "eslint src test --fix",
"lint": "eslint src test"
},
"pre-commit": [

@@ -36,31 +46,47 @@ "lint"

"devDependencies": {
"babel-cli": "^6.10.0",
"babel-eslint": "^6.1.0",
"babel-loader": "^6.2.4",
"babel-plugin-transform-export-extensions": "^6.8.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "6.3.13",
"babel-register": "^6.3.13",
"chai": "3.4.1",
"eslint": "^2.9.0",
"eslint-plugin-import": "^1.7.0",
"eslint-plugin-jsx-a11y": "^1.5.0",
"eslint-config-airbnb": "^9.0.1",
"eslint-plugin-react": "^5.2.0",
"isparta": "^4.0.0",
"mocha": "^2.5.0",
"webpack": "^1.13.1",
"pre-commit": "^1.1.3"
"@babel/cli": "^7.1.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"ava": "^1.0.0-beta.8",
"babel-eslint": "^10.0.0",
"babel-loader": "^8.0.0",
"cross-env": "^5.2.0",
"eslint": "^5.6.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.11.1",
"nyc": "^13.0.1",
"pre-commit": "^1.1.3",
"webpack": "^4.20.0",
"webpack-cli": "^3.1.2"
},
"scripts": {
"build": "npm run build-cjs && npm run build-es6 && rimraf umd && npm run build-umd && npm run build-min",
"build-cjs": "rimraf lib && babel ./src -d lib",
"build-es6": "rimraf es6 && babel ./src -d es6 --blacklist=es6.modules",
"build-umd": "NODE_ENV=production webpack src/index.js umd/RechartsScale.js",
"build-min": "NODE_ENV=production webpack -p src/index.js umd/RechartsScale.min.js",
"test": "mocha --compilers js:babel-register --recursive",
"test-cov": "isparta cover _mocha --report html --report text -- --require babel-register",
"lint": "eslint src test"
"ava": {
"files": [
"test/**/*.test.js"
],
"sources": [
"**/*.js",
"!umd/**/*"
],
"failFast": true,
"tap": true,
"require": [
"esm",
"@babel/register"
],
"babel": {
"testOptions": {
"presets": [
"@babel/preset-env"
]
}
}
},
"license": "MIT"
}

@@ -7,3 +7,5 @@ /**

import Decimal from 'decimal.js-light';
import { compose, range, memoize, map, reverse } from './util/utils';
import {
compose, range, memoize, map, reverse,
} from './util/utils';
import Arithmetic from './util/arithmetic';

@@ -49,3 +51,3 @@

const amendStepRatio = new Decimal(
Math.ceil(stepRatio.div(stepRatioScale).toNumber())
Math.ceil(stepRatio.div(stepRatioScale).toNumber()),
).add(correctionFactor).mul(stepRatioScale);

@@ -93,3 +95,3 @@

map(n => middle.add(new Decimal(n - middleIndex).mul(step)).toNumber()),
range
range,
);

@@ -124,3 +126,3 @@

allowDecimals,
correctionFactor
correctionFactor,
);

@@ -143,3 +145,3 @@

let upCount = Math.ceil(new Decimal(max).sub(middle).div(step)
.toNumber());
.toNumber());
const scaleCount = belowCount + upCount + 1;

@@ -150,3 +152,3 @@

return calculateStep(min, max, tickCount, allowDecimals, correctionFactor + 1);
} else if (scaleCount < tickCount) {
} if (scaleCount < tickCount) {
// When less ticks can cover the interval, we should add some additional ticks

@@ -164,3 +166,3 @@ upCount = max > 0 ? upCount + (tickCount - scaleCount) : upCount;

/**
* Calculate the ticks of an interval
* Calculate the ticks of an interval, the count of ticks will be guraranteed
*

@@ -177,2 +179,10 @@ * @param {Number} min, max min: The minimum value, max: The maximum value

if (cormin === -Infinity || cormax === Infinity) {
const values = cormax === Infinity
? [cormin, ...range(0, tickCount - 1).map(() => Infinity)]
: [...range(0, tickCount - 1).map(() => -Infinity), cormax];
return min > max ? reverse(values) : values;
}
if (cormin === cormax) {

@@ -190,2 +200,10 @@ return getTickOfSingleValue(cormin, tickCount, allowDecimals);

/**
* Calculate the ticks of an interval, the count of ticks won't be guraranteed
*
* @param {Number} min, max min: The minimum value, max: The maximum value
* @param {Integer} tickCount The count of ticks
* @param {Boolean} allowDecimals Allow the ticks to be decimals or not
* @return {Array} ticks
*/
function getTickValuesFn([min, max], tickCount = 6, allowDecimals = true) {

@@ -196,2 +214,6 @@ // More than two ticks should be return

if (cormin === -Infinity || cormax === Infinity) {
return [min, max];
}
if (cormin === cormax) {

@@ -205,3 +227,3 @@ return getTickOfSingleValue(cormin, tickCount, allowDecimals);

map(n => new Decimal(cormin).add(new Decimal(n).mul(step)).toNumber()),
range
range,
);

@@ -214,2 +236,11 @@

/**
* Calculate the ticks of an interval, the count of ticks won't be guraranteed,
* but the domain will be guaranteed
*
* @param {Number} min, max min: The minimum value, max: The maximum value
* @param {Integer} tickCount The count of ticks
* @param {Boolean} allowDecimals Allow the ticks to be decimals or not
* @return {Array} ticks
*/
function getTickValuesFixedDomainFn([min, max], tickCount, allowDecimals = true) {

@@ -219,2 +250,6 @@ // More than two ticks should be return

if (cormin === -Infinity || cormax === Infinity) {
return [min, max];
}
if (cormin === cormax) { return [cormin]; }

@@ -228,3 +263,3 @@

new Decimal(cormax).sub(new Decimal(0.99).mul(step)),
step
step,
),

@@ -240,2 +275,1 @@ cormax,

export const getTickValuesFixedDomain = memoize(getTickValuesFixedDomainFn);

@@ -25,3 +25,3 @@ /**

result = Math.floor(new Decimal(value).abs().log(10)
.toNumber()) + 1;
.toNumber()) + 1;
}

@@ -28,0 +28,0 @@

@@ -9,3 +9,3 @@ const identity = i => i;

const curry0 = (fn) => function _curried(...args) {
const curry0 = fn => function _curried(...args) {
if (args.length === 0 || args.length === 1 && isPlaceHolder(args[0])) {

@@ -68,10 +68,7 @@ return _curried;

return (...composeArgs) =>
tailsFn.reduce((res, fn) =>
fn(res),
firstFn(...composeArgs)
);
return (...composeArgs) => tailsFn.reduce((res, fn) => fn(res),
firstFn(...composeArgs));
};
export const reverse = arr => {
export const reverse = (arr) => {
if (Array.isArray(arr)) {

@@ -85,3 +82,3 @@ return arr.reverse();

export const memoize = fn => {
export const memoize = (fn) => {
let lastArgs = null;

@@ -88,0 +85,0 @@ let lastResult = null;

@@ -1,1 +0,1 @@

!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.RechartsScale=r():e.RechartsScale=r()}(this,function(){return function(e){function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}var t={};return r.m=e,r.c=t,r.p="",r(0)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(3);Object.defineProperty(r,"getTickValues",{enumerable:!0,get:function(){return n.getTickValues}}),Object.defineProperty(r,"getNiceTickValues",{enumerable:!0,get:function(){return n.getNiceTickValues}}),Object.defineProperty(r,"getTickValuesFixedDomain",{enumerable:!0,get:function(){return n.getTickValuesFixedDomain}})},function(e,r){"use strict";function t(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++)t[r]=e[r];return t}return Array.from(e)}Object.defineProperty(r,"__esModule",{value:!0});var n=function(e){return e},i=r.PLACE_HOLDER={"@@functional/placeholder":!0},o=function(e){return e===i},u=function(e){return function r(){return 0===arguments.length||1===arguments.length&&o(arguments.length<=0?void 0:arguments[0])?r:e.apply(void 0,arguments)}},s=function e(r,n){return 1===r?n:u(function(){for(var s=arguments.length,f=Array(s),c=0;c<s;c++)f[c]=arguments[c];var a=f.filter(function(e){return e!==i}).length;return a>=r?n.apply(void 0,f):e(r-a,u(function(){for(var e=arguments.length,r=Array(e),i=0;i<e;i++)r[i]=arguments[i];var u=f.map(function(e){return o(e)?r.shift():e});return n.apply(void 0,t(u).concat(r))}))})},f=r.curry=function(e){return s(e.length,e)};r.range=function(e,r){for(var t=[],n=e;n<r;++n)t[n-e]=n;return t},r.map=f(function(e,r){return Array.isArray(r)?r.map(e):Object.keys(r).map(function(e){return r[e]}).map(e)}),r.compose=function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];if(!r.length)return n;var i=r.reverse(),o=i[0],u=i.slice(1);return function(){return u.reduce(function(e,r){return r(e)},o.apply(void 0,arguments))}},r.reverse=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},r.memoize=function(e){var r=null,t=null;return function(){for(var n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];return r&&i.every(function(e,t){return e===r[t]})?t:(r=i,t=e.apply(void 0,i))}}},function(e,r,t){var n;!function(i){"use strict";function o(e,r){var t,n,i,o,u,s,f,c,a=e.constructor,l=a.precision;if(!e.s||!r.s)return r.s||(r=new a(e)),E?v(r,l):r;if(f=e.d,c=r.d,u=e.e,i=r.e,f=f.slice(),o=u-i){for(o<0?(n=f,o=-o,s=c.length):(n=c,i=u,s=f.length),u=Math.ceil(l/P),s=u>s?u+1:s+1,o>s&&(o=s,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for(s=f.length,o=c.length,s-o<0&&(o=s,n=c,c=f,f=n),t=0;o;)t=(f[--o]=f[o]+c[o]+t)/T|0,f[o]%=T;for(t&&(f.unshift(t),++i),s=f.length;0==f[--s];)f.pop();return r.d=f,r.e=i,E?v(r,l):r}function u(e,r,t){if(e!==~~e||e<r||e>t)throw Error(O+e)}function s(e){var r,t,n,i=e.length-1,o="",u=e[0];if(i>0){for(o+=u,r=1;r<i;r++)n=e[r]+"",t=P-n.length,t&&(o+=l(t)),o+=n;u=e[r],n=u+"",t=P-n.length,t&&(o+=l(t))}else if(0===u)return"0";for(;u%10===0;)u/=10;return o+u}function f(e,r){var t,n,i,o,u,f,a=0,l=0,d=e.constructor,h=d.precision;if(c(e)>16)throw Error(A+c(e));if(!e.s)return new d(y);for(null==r?(E=!1,f=h):f=r,u=new d(.03125);e.abs().gte(.1);)e=e.times(u),l+=5;for(n=Math.log(k(2,l))/Math.LN10*2+5|0,f+=n,t=i=o=new d(y),d.precision=f;;){if(i=v(i.times(e),f),t=t.times(++a),u=o.plus(R(i,t,f)),s(u.d).slice(0,f)===s(o.d).slice(0,f)){for(;l--;)o=v(o.times(o),f);return d.precision=h,null==r?(E=!0,v(o,h)):o}o=u}}function c(e){for(var r=e.e*P,t=e.d[0];t>=10;t/=10)r++;return r}function a(e,r,t){if(r>e.LN10.sd())throw E=!0,t&&(e.precision=t),Error(M+"LN10 precision limit exceeded");return v(new e(e.LN10),r)}function l(e){for(var r="";e--;)r+="0";return r}function d(e,r){var t,n,i,o,u,f,l,h,g,p=1,w=10,m=e,b=m.d,N=m.constructor,x=N.precision;if(m.s<1)throw Error(M+(m.s?"NaN":"-Infinity"));if(m.eq(y))return new N(0);if(null==r?(E=!1,h=x):h=r,m.eq(10))return null==r&&(E=!0),a(N,h);if(h+=w,N.precision=h,t=s(b),n=t.charAt(0),o=c(m),!(Math.abs(o)<15e14))return l=a(N,h+2,x).times(o+""),m=d(new N(n+"."+t.slice(1)),h-w).plus(l),N.precision=x,null==r?(E=!0,v(m,x)):m;for(;n<7&&1!=n||1==n&&t.charAt(1)>3;)m=m.times(e),t=s(m.d),n=t.charAt(0),p++;for(o=c(m),n>1?(m=new N("0."+t),o++):m=new N(n+"."+t.slice(1)),f=u=m=R(m.minus(y),m.plus(y),h),g=v(m.times(m),h),i=3;;){if(u=v(u.times(g),h),l=f.plus(R(u,new N(i),h)),s(l.d).slice(0,h)===s(f.d).slice(0,h))return f=f.times(2),0!==o&&(f=f.plus(a(N,h+2,x).times(o+""))),f=R(f,new N(p),h),N.precision=x,null==r?(E=!0,v(f,x)):f;f=l,i+=2}}function h(e,r){var t,n,i;for((t=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(t<0&&(t=n),t+=+r.slice(n+1),r=r.substring(0,n)):t<0&&(t=r.length),n=0;48===r.charCodeAt(n);)++n;for(i=r.length;48===r.charCodeAt(i-1);)--i;if(r=r.slice(n,i)){if(i-=n,t=t-n-1,e.e=_(t/P),e.d=[],n=(t+1)%P,t<0&&(n+=P),n<i){for(n&&e.d.push(+r.slice(0,n)),i-=P;n<i;)e.d.push(+r.slice(n,n+=P));r=r.slice(n),n=P-r.length}else n-=i;for(;n--;)r+="0";if(e.d.push(+r),E&&(e.e>j||e.e<-j))throw Error(A+t)}else e.s=0,e.e=0,e.d=[0];return e}function v(e,r,t){var n,i,o,u,s,f,a,l,d=e.d;for(u=1,o=d[0];o>=10;o/=10)u++;if(n=r-u,n<0)n+=P,i=r,a=d[l=0];else{if(l=Math.ceil((n+1)/P),o=d.length,l>=o)return e;for(a=o=d[l],u=1;o>=10;o/=10)u++;n%=P,i=n-P+u}if(void 0!==t&&(o=k(10,u-i-1),s=a/o%10|0,f=r<0||void 0!==d[l+1]||a%o,f=t<4?(s||f)&&(0==t||t==(e.s<0?3:2)):s>5||5==s&&(4==t||f||6==t&&(n>0?i>0?a/k(10,u-i):0:d[l-1])%10&1||t==(e.s<0?8:7))),r<1||!d[0])return f?(o=c(e),d.length=1,r=r-o-1,d[0]=k(10,(P-r%P)%P),e.e=_(-r/P)||0):(d.length=1,d[0]=e.e=e.s=0),e;if(0==n?(d.length=l,o=1,l--):(d.length=l+1,o=k(10,P-n),d[l]=i>0?(a/k(10,u-i)%k(10,i)|0)*o:0),f)for(;;){if(0==l){(d[0]+=o)==T&&(d[0]=1,++e.e);break}if(d[l]+=o,d[l]!=T)break;d[l--]=0,o=1}for(n=d.length;0===d[--n];)d.pop();if(E&&(e.e>j||e.e<-j))throw Error(A+c(e));return e}function g(e,r){var t,n,i,o,u,s,f,c,a,l,d=e.constructor,h=d.precision;if(!e.s||!r.s)return r.s?r.s=-r.s:r=new d(e),E?v(r,h):r;if(f=e.d,l=r.d,n=r.e,c=e.e,f=f.slice(),u=c-n){for(a=u<0,a?(t=f,u=-u,s=l.length):(t=l,n=c,s=f.length),i=Math.max(Math.ceil(h/P),s)+2,u>i&&(u=i,t.length=1),t.reverse(),i=u;i--;)t.push(0);t.reverse()}else{for(i=f.length,s=l.length,a=i<s,a&&(s=i),i=0;i<s;i++)if(f[i]!=l[i]){a=f[i]<l[i];break}u=0}for(a&&(t=f,f=l,l=t,r.s=-r.s),s=f.length,i=l.length-s;i>0;--i)f[s++]=0;for(i=l.length;i>u;){if(f[--i]<l[i]){for(o=i;o&&0===f[--o];)f[o]=T-1;--f[o],f[i]+=T}f[i]-=l[i]}for(;0===f[--s];)f.pop();for(;0===f[0];f.shift())--n;return f[0]?(r.d=f,r.e=n,E?v(r,h):r):new d(0)}function p(e,r,t){var n,i=c(e),o=s(e.d),u=o.length;return r?(t&&(n=t-u)>0?o=o.charAt(0)+"."+o.slice(1)+l(n):u>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+l(-i-1)+o,t&&(n=t-u)>0&&(o+=l(n))):i>=u?(o+=l(i+1-u),t&&(n=t-i-1)>0&&(o=o+"."+l(n))):((n=i+1)<u&&(o=o.slice(0,n)+"."+o.slice(n)),t&&(n=t-u)>0&&(i+1===u&&(o+="."),o+=l(n))),e.s<0?"-"+o:o}function w(e,r){if(e.length>r)return e.length=r,!0}function m(e){function r(e){var t=this;if(!(t instanceof r))return new r(e);if(t.constructor=r,e instanceof r)return t.s=e.s,t.e=e.e,void(t.d=(e=e.d)?e.slice():e);if("number"==typeof e){if(0*e!==0)throw Error(O+e);if(e>0)t.s=1;else{if(!(e<0))return t.s=0,t.e=0,void(t.d=[0]);e=-e,t.s=-1}return e===~~e&&e<1e7?(t.e=0,void(t.d=[e])):h(t,e.toString())}if("string"!=typeof e)throw Error(O+e);if(45===e.charCodeAt(0)?(e=e.slice(1),t.s=-1):t.s=1,!D.test(e))throw Error(O+e);h(t,e)}var t,n,i;if(r.prototype=q,r.ROUND_UP=0,r.ROUND_DOWN=1,r.ROUND_CEIL=2,r.ROUND_FLOOR=3,r.ROUND_HALF_UP=4,r.ROUND_HALF_DOWN=5,r.ROUND_HALF_EVEN=6,r.ROUND_HALF_CEIL=7,r.ROUND_HALF_FLOOR=8,r.clone=m,r.config=r.set=b,void 0===e&&(e={}),e)for(i=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<i.length;)e.hasOwnProperty(n=i[t++])||(e[n]=this[n]);return r.config(e),r}function b(e){if(!e||"object"!=typeof e)throw Error(M+"Object expected");var r,t,n,i=["precision",1,N,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(r=0;r<i.length;r+=3)if(void 0!==(n=e[t=i[r]])){if(!(_(n)===n&&n>=i[r+1]&&n<=i[r+2]))throw Error(O+t+": "+n);this[t]=n}if(void 0!==(n=e[t="LN10"])){if(n!=Math.LN10)throw Error(O+t+": "+n);this[t]=new this(n)}return this}var y,N=1e9,x={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},E=!0,M="[DecimalError] ",O=M+"Invalid argument: ",A=M+"Exponent out of range: ",_=Math.floor,k=Math.pow,D=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,T=1e7,P=7,L=9007199254740991,j=_(L/P),q={};q.absoluteValue=q.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e},q.comparedTo=q.cmp=function(e){var r,t,n,i,o=this;if(e=new o.constructor(e),o.s!==e.s)return o.s||-e.s;if(o.e!==e.e)return o.e>e.e^o.s<0?1:-1;for(n=o.d.length,i=e.d.length,r=0,t=n<i?n:i;r<t;++r)if(o.d[r]!==e.d[r])return o.d[r]>e.d[r]^o.s<0?1:-1;return n===i?0:n>i^o.s<0?1:-1},q.decimalPlaces=q.dp=function(){var e=this,r=e.d.length-1,t=(r-e.e)*P;if(r=e.d[r])for(;r%10==0;r/=10)t--;return t<0?0:t},q.dividedBy=q.div=function(e){return R(this,new this.constructor(e))},q.dividedToIntegerBy=q.idiv=function(e){var r=this,t=r.constructor;return v(R(r,new t(e),0,1),t.precision)},q.equals=q.eq=function(e){return!this.cmp(e)},q.exponent=function(){return c(this)},q.greaterThan=q.gt=function(e){return this.cmp(e)>0},q.greaterThanOrEqualTo=q.gte=function(e){return this.cmp(e)>=0},q.isInteger=q.isint=function(){return this.e>this.d.length-2},q.isNegative=q.isneg=function(){return this.s<0},q.isPositive=q.ispos=function(){return this.s>0},q.isZero=function(){return 0===this.s},q.lessThan=q.lt=function(e){return this.cmp(e)<0},q.lessThanOrEqualTo=q.lte=function(e){return this.cmp(e)<1},q.logarithm=q.log=function(e){var r,t=this,n=t.constructor,i=n.precision,o=i+5;if(void 0===e)e=new n(10);else if(e=new n(e),e.s<1||e.eq(y))throw Error(M+"NaN");if(t.s<1)throw Error(M+(t.s?"NaN":"-Infinity"));return t.eq(y)?new n(0):(E=!1,r=R(d(t,o),d(e,o),o),E=!0,v(r,i))},q.minus=q.sub=function(e){var r=this;return e=new r.constructor(e),r.s==e.s?g(r,e):o(r,(e.s=-e.s,e))},q.modulo=q.mod=function(e){var r,t=this,n=t.constructor,i=n.precision;if(e=new n(e),!e.s)throw Error(M+"NaN");return t.s?(E=!1,r=R(t,e,0,1).times(e),E=!0,t.minus(r)):v(new n(t),i)},q.naturalExponential=q.exp=function(){return f(this)},q.naturalLogarithm=q.ln=function(){return d(this)},q.negated=q.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},q.plus=q.add=function(e){var r=this;return e=new r.constructor(e),r.s==e.s?o(r,e):g(r,(e.s=-e.s,e))},q.precision=q.sd=function(e){var r,t,n,i=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(O+e);if(r=c(i)+1,n=i.d.length-1,t=n*P+1,n=i.d[n]){for(;n%10==0;n/=10)t--;for(n=i.d[0];n>=10;n/=10)t++}return e&&r>t?r:t},q.squareRoot=q.sqrt=function(){var e,r,t,n,i,o,u,f=this,a=f.constructor;if(f.s<1){if(!f.s)return new a(0);throw Error(M+"NaN")}for(e=c(f),E=!1,i=Math.sqrt(+f),0==i||i==1/0?(r=s(f.d),(r.length+e)%2==0&&(r+="0"),i=Math.sqrt(r),e=_((e+1)/2)-(e<0||e%2),i==1/0?r="1e"+e:(r=i.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new a(r)):n=new a(i.toString()),t=a.precision,i=u=t+3;;)if(o=n,n=o.plus(R(f,o,u+2)).times(.5),s(o.d).slice(0,u)===(r=s(n.d)).slice(0,u)){if(r=r.slice(u-3,u+1),i==u&&"4999"==r){if(v(o,t+1,0),o.times(o).eq(f)){n=o;break}}else if("9999"!=r)break;u+=4}return E=!0,v(n,t)},q.times=q.mul=function(e){var r,t,n,i,o,u,s,f,c,a=this,l=a.constructor,d=a.d,h=(e=new l(e)).d;if(!a.s||!e.s)return new l(0);for(e.s*=a.s,t=a.e+e.e,f=d.length,c=h.length,f<c&&(o=d,d=h,h=o,u=f,f=c,c=u),o=[],u=f+c,n=u;n--;)o.push(0);for(n=c;--n>=0;){for(r=0,i=f+n;i>n;)s=o[i]+h[n]*d[i-n-1]+r,o[i--]=s%T|0,r=s/T|0;o[i]=(o[i]+r)%T|0}for(;!o[--u];)o.pop();return r?++t:o.shift(),e.d=o,e.e=t,E?v(e,l.precision):e},q.toDecimalPlaces=q.todp=function(e,r){var t=this,n=t.constructor;return t=new n(t),void 0===e?t:(u(e,0,N),void 0===r?r=n.rounding:u(r,0,8),v(t,e+c(t)+1,r))},q.toExponential=function(e,r){var t,n=this,i=n.constructor;return void 0===e?t=p(n,!0):(u(e,0,N),void 0===r?r=i.rounding:u(r,0,8),n=v(new i(n),e+1,r),t=p(n,!0,e+1)),t},q.toFixed=function(e,r){var t,n,i=this,o=i.constructor;return void 0===e?p(i):(u(e,0,N),void 0===r?r=o.rounding:u(r,0,8),n=v(new o(i),e+c(i)+1,r),t=p(n.abs(),!1,e+c(n)+1),i.isneg()&&!i.isZero()?"-"+t:t)},q.toInteger=q.toint=function(){var e=this,r=e.constructor;return v(new r(e),c(e)+1,r.rounding)},q.toNumber=function(){return+this},q.toPower=q.pow=function(e){var r,t,n,i,o,u,s=this,c=s.constructor,a=12,l=+(e=new c(e));if(!e.s)return new c(y);if(s=new c(s),!s.s){if(e.s<1)throw Error(M+"Infinity");return s}if(s.eq(y))return s;if(n=c.precision,e.eq(y))return v(s,n);if(r=e.e,t=e.d.length-1,u=r>=t,o=s.s,u){if((t=l<0?-l:l)<=L){for(i=new c(y),r=Math.ceil(n/P+4),E=!1;t%2&&(i=i.times(s),w(i.d,r)),t=_(t/2),0!==t;)s=s.times(s),w(s.d,r);return E=!0,e.s<0?new c(y).div(i):v(i,n)}}else if(o<0)throw Error(M+"NaN");return o=o<0&&1&e.d[Math.max(r,t)]?-1:1,s.s=1,E=!1,i=e.times(d(s,n+a)),E=!0,i=f(i),i.s=o,i},q.toPrecision=function(e,r){var t,n,i=this,o=i.constructor;return void 0===e?(t=c(i),n=p(i,t<=o.toExpNeg||t>=o.toExpPos)):(u(e,1,N),void 0===r?r=o.rounding:u(r,0,8),i=v(new o(i),e,r),t=c(i),n=p(i,e<=t||t<=o.toExpNeg,e)),n},q.toSignificantDigits=q.tosd=function(e,r){var t=this,n=t.constructor;return void 0===e?(e=n.precision,r=n.rounding):(u(e,1,N),void 0===r?r=n.rounding:u(r,0,8)),v(new n(t),e,r)},q.toString=q.valueOf=q.val=q.toJSON=function(){var e=this,r=c(e),t=e.constructor;return p(e,r<=t.toExpNeg||r>=t.toExpPos)};var R=function(){function e(e,r){var t,n=0,i=e.length;for(e=e.slice();i--;)t=e[i]*r+n,e[i]=t%T|0,n=t/T|0;return n&&e.unshift(n),e}function r(e,r,t,n){var i,o;if(t!=n)o=t>n?1:-1;else for(i=o=0;i<t;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function t(e,r,t){for(var n=0;t--;)e[t]-=n,n=e[t]<r[t]?1:0,e[t]=n*T+e[t]-r[t];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,o,u){var s,f,a,l,d,h,g,p,w,m,b,y,N,x,E,O,A,_,k=n.constructor,D=n.s==i.s?1:-1,L=n.d,j=i.d;if(!n.s)return new k(n);if(!i.s)throw Error(M+"Division by zero");for(f=n.e-i.e,A=j.length,E=L.length,g=new k(D),p=g.d=[],a=0;j[a]==(L[a]||0);)++a;if(j[a]>(L[a]||0)&&--f,y=null==o?o=k.precision:u?o+(c(n)-c(i))+1:o,y<0)return new k(0);if(y=y/P+2|0,a=0,1==A)for(l=0,j=j[0],y++;(a<E||l)&&y--;a++)N=l*T+(L[a]||0),p[a]=N/j|0,l=N%j|0;else{for(l=T/(j[0]+1)|0,l>1&&(j=e(j,l),L=e(L,l),A=j.length,E=L.length),x=A,w=L.slice(0,A),m=w.length;m<A;)w[m++]=0;_=j.slice(),_.unshift(0),O=j[0],j[1]>=T/2&&++O;do l=0,s=r(j,w,A,m),s<0?(b=w[0],A!=m&&(b=b*T+(w[1]||0)),l=b/O|0,l>1?(l>=T&&(l=T-1),d=e(j,l),h=d.length,m=w.length,s=r(d,w,h,m),1==s&&(l--,t(d,A<h?_:j,h))):(0==l&&(s=l=1),d=j.slice()),h=d.length,h<m&&d.unshift(0),t(w,d,m),s==-1&&(m=w.length,s=r(j,w,A,m),s<1&&(l++,t(w,A<m?_:j,m))),m=w.length):0===s&&(l++,w=[0]),p[a++]=l,s&&w[0]?w[m++]=L[x]||0:(w=[L[x]],m=1);while((x++<E||void 0!==w[0])&&y--)}return p[0]||p.shift(),g.e=f,v(g,u?o+c(g)+1:o)}}();x=m(x),x.default=x.Decimal=x,y=new x(1),n=function(){return x}.call(r,t,r,e),!(void 0!==n&&(e.exports=n))}(this)},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var r=0,t=Array(e.length);r<e.length;r++)t[r]=e[r];return t}return Array.from(e)}function o(e){var r=d(e,2),t=r[0],n=r[1],i=t,o=n;return t>n&&(i=n,o=t),[i,o]}function u(e,r,t){if(e.lte(0))return new v.default(0);var n=w.default.getDigitCount(e.toNumber()),i=new v.default(10).pow(n),o=e.div(i),u=1!==n?.05:.1,s=new v.default(Math.ceil(o.div(u).toNumber())).add(t).mul(u),f=s.mul(i);return r?f:new v.default(Math.ceil(f))}function s(e,r,t){var n=1,i=new v.default(e);if(!i.isint()&&t){var o=Math.abs(e);o<1?(n=new v.default(10).pow(w.default.getDigitCount(e)-1),i=new v.default(Math.floor(i.div(n).toNumber())).mul(n)):o>1&&(i=new v.default(Math.floor(e)))}else 0===e?i=new v.default(Math.floor((r-1)/2)):t||(i=new v.default(Math.floor(e)));var u=Math.floor((r-1)/2),s=(0,g.compose)((0,g.map)(function(e){return i.add(new v.default(e-u).mul(n)).toNumber()}),g.range);return s(0,r)}function f(e,r,t,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((r-e)/(t-1)))return{step:new v.default(0),tickMin:new v.default(0),tickMax:new v.default(0)};var o=u(new v.default(r).sub(e).div(t-1),n,i),s=void 0;e<=0&&r>=0?s=new v.default(0):(s=new v.default(e).add(r).div(2),s=s.sub(new v.default(s).mod(o)));var c=Math.ceil(s.sub(e).div(o).toNumber()),a=Math.ceil(new v.default(r).sub(s).div(o).toNumber()),l=c+a+1;return l>t?f(e,r,t,n,i+1):(l<t&&(a=r>0?a+(t-l):a,c=r>0?c:c+(t-l)),{step:o,tickMin:s.sub(new v.default(c).mul(o)),tickMax:s.add(new v.default(a).mul(o))})}function c(e){var r=d(e,2),t=r[0],n=r[1],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,u=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=Math.max(i,2),a=o([t,n]),l=d(a,2),h=l[0],p=l[1];if(h===p)return s(h,i,u);var m=f(h,p,c,u),b=m.step,y=m.tickMin,N=m.tickMax,x=w.default.rangeStep(y,N.add(new v.default(.1).mul(b)),b);return t>n?(0,g.reverse)(x):x}function a(e){var r=d(e,2),t=r[0],n=r[1],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,f=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=Math.max(i,2),a=o([t,n]),l=d(a,2),h=l[0],p=l[1];if(h===p)return s(h,i,f);var w=u(new v.default(p).sub(h).div(c-1),f,0),m=(0,g.compose)((0,g.map)(function(e){return new v.default(h).add(new v.default(e).mul(w)).toNumber()}),g.range),b=m(0,c).filter(function(e){return e>=h&&e<=p});return t>n?(0,g.reverse)(b):b}function l(e,r){var t=d(e,2),n=t[0],s=t[1],f=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],c=o([n,s]),a=d(c,2),l=a[0],h=a[1];if(l===h)return[l];var p=Math.max(r,2),m=u(new v.default(h).sub(l).div(p-1),f,0),b=[].concat(i(w.default.rangeStep(new v.default(l),new v.default(h).sub(new v.default(.99).mul(m)),m)),[h]);return n>s?(0,g.reverse)(b):b}Object.defineProperty(r,"__esModule",{value:!0}),r.getTickValuesFixedDomain=r.getTickValues=r.getNiceTickValues=void 0;var d=function(){function e(e,r){var t=[],n=!0,i=!1,o=void 0;try{for(var u,s=e[Symbol.iterator]();!(n=(u=s.next()).done)&&(t.push(u.value),!r||t.length!==r);n=!0);}catch(e){i=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return t}return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),h=t(2),v=n(h),g=t(1),p=t(4),w=n(p);r.getNiceTickValues=(0,g.memoize)(c),r.getTickValues=(0,g.memoize)(a),r.getTickValuesFixedDomain=(0,g.memoize)(l)},function(e,r,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){var r=void 0;return r=0===e?1:Math.floor(new s.default(e).abs().log(10).toNumber())+1}function o(e,r,t){for(var n=new s.default(e),i=[];n.lt(r);)i.push(n.toNumber()),n=n.add(t);return i}Object.defineProperty(r,"__esModule",{value:!0});var u=t(2),s=n(u),f=t(1),c=(0,f.curry)(function(e,r,t){var n=+e,i=+r;return n+t*(i-n)}),a=(0,f.curry)(function(e,r,t){var n=r-+e;return n=n||1/0,(t-e)/n}),l=(0,f.curry)(function(e,r,t){var n=r-+e;return n=n||1/0,Math.max(0,Math.min(1,(t-e)/n))});r.default={rangeStep:o,getDigitCount:i,interpolateNumber:c,uninterpolateNumber:a,uninterpolateTruncation:l}}])});
!function(e){var r={};function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)t.d(n,i,function(r){return e[r]}.bind(null,i));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=2)}([function(e,r,t){var n;/*! decimal.js-light v2.4.1 https://github.com/MikeMcl/decimal.js-light/LICENCE */!function(i){"use strict";var o,u=1e9,s={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},f=!0,a="[DecimalError] ",c=a+"Invalid argument: ",l=a+"Exponent out of range: ",d=Math.floor,h=Math.pow,v=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,g=1e7,p=7,w=d(9007199254740991/p),m={};function b(e,r){var t,n,i,o,u,s,a,c,l=e.constructor,d=l.precision;if(!e.s||!r.s)return r.s||(r=new l(e)),f?T(r,d):r;if(a=e.d,c=r.d,u=e.e,i=r.e,a=a.slice(),o=u-i){for(o<0?(n=a,o=-o,s=c.length):(n=c,i=u,s=a.length),o>(s=(u=Math.ceil(d/p))>s?u+1:s+1)&&(o=s,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for((s=a.length)-(o=c.length)<0&&(o=s,n=c,c=a,a=n),t=0;o;)t=(a[--o]=a[o]+c[o]+t)/g|0,a[o]%=g;for(t&&(a.unshift(t),++i),s=a.length;0==a[--s];)a.pop();return r.d=a,r.e=i,f?T(r,d):r}function y(e,r,t){if(e!==~~e||e<r||e>t)throw Error(c+e)}function N(e){var r,t,n,i=e.length-1,o="",u=e[0];if(i>0){for(o+=u,r=1;r<i;r++)n=e[r]+"",(t=p-n.length)&&(o+=A(t)),o+=n;u=e[r],(t=p-(n=u+"").length)&&(o+=A(t))}else if(0===u)return"0";for(;u%10==0;)u/=10;return o+u}m.absoluteValue=m.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e},m.comparedTo=m.cmp=function(e){var r,t,n,i,o=this;if(e=new o.constructor(e),o.s!==e.s)return o.s||-e.s;if(o.e!==e.e)return o.e>e.e^o.s<0?1:-1;for(r=0,t=(n=o.d.length)<(i=e.d.length)?n:i;r<t;++r)if(o.d[r]!==e.d[r])return o.d[r]>e.d[r]^o.s<0?1:-1;return n===i?0:n>i^o.s<0?1:-1},m.decimalPlaces=m.dp=function(){var e=this,r=e.d.length-1,t=(r-e.e)*p;if(r=e.d[r])for(;r%10==0;r/=10)t--;return t<0?0:t},m.dividedBy=m.div=function(e){return E(this,new this.constructor(e))},m.dividedToIntegerBy=m.idiv=function(e){var r=this.constructor;return T(E(this,new r(e),0,1),r.precision)},m.equals=m.eq=function(e){return!this.cmp(e)},m.exponent=function(){return O(this)},m.greaterThan=m.gt=function(e){return this.cmp(e)>0},m.greaterThanOrEqualTo=m.gte=function(e){return this.cmp(e)>=0},m.isInteger=m.isint=function(){return this.e>this.d.length-2},m.isNegative=m.isneg=function(){return this.s<0},m.isPositive=m.ispos=function(){return this.s>0},m.isZero=function(){return 0===this.s},m.lessThan=m.lt=function(e){return this.cmp(e)<0},m.lessThanOrEqualTo=m.lte=function(e){return this.cmp(e)<1},m.logarithm=m.log=function(e){var r,t=this,n=t.constructor,i=n.precision,u=i+5;if(void 0===e)e=new n(10);else if((e=new n(e)).s<1||e.eq(o))throw Error(a+"NaN");if(t.s<1)throw Error(a+(t.s?"NaN":"-Infinity"));return t.eq(o)?new n(0):(f=!1,r=E(_(t,u),_(e,u),u),f=!0,T(r,i))},m.minus=m.sub=function(e){var r=this;return e=new r.constructor(e),r.s==e.s?k(r,e):b(r,(e.s=-e.s,e))},m.modulo=m.mod=function(e){var r,t=this,n=t.constructor,i=n.precision;if(!(e=new n(e)).s)throw Error(a+"NaN");return t.s?(f=!1,r=E(t,e,0,1).times(e),f=!0,t.minus(r)):T(new n(t),i)},m.naturalExponential=m.exp=function(){return M(this)},m.naturalLogarithm=m.ln=function(){return _(this)},m.negated=m.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},m.plus=m.add=function(e){var r=this;return e=new r.constructor(e),r.s==e.s?b(r,e):k(r,(e.s=-e.s,e))},m.precision=m.sd=function(e){var r,t,n,i=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(c+e);if(r=O(i)+1,t=(n=i.d.length-1)*p+1,n=i.d[n]){for(;n%10==0;n/=10)t--;for(n=i.d[0];n>=10;n/=10)t++}return e&&r>t?r:t},m.squareRoot=m.sqrt=function(){var e,r,t,n,i,o,u,s=this,c=s.constructor;if(s.s<1){if(!s.s)return new c(0);throw Error(a+"NaN")}for(e=O(s),f=!1,0==(i=Math.sqrt(+s))||i==1/0?(((r=N(s.d)).length+e)%2==0&&(r+="0"),i=Math.sqrt(r),e=d((e+1)/2)-(e<0||e%2),n=new c(r=i==1/0?"1e"+e:(r=i.toExponential()).slice(0,r.indexOf("e")+1)+e)):n=new c(i.toString()),i=u=(t=c.precision)+3;;)if(n=(o=n).plus(E(s,o,u+2)).times(.5),N(o.d).slice(0,u)===(r=N(n.d)).slice(0,u)){if(r=r.slice(u-3,u+1),i==u&&"4999"==r){if(T(o,t+1,0),o.times(o).eq(s)){n=o;break}}else if("9999"!=r)break;u+=4}return f=!0,T(n,t)},m.times=m.mul=function(e){var r,t,n,i,o,u,s,a,c,l=this,d=l.constructor,h=l.d,v=(e=new d(e)).d;if(!l.s||!e.s)return new d(0);for(e.s*=l.s,t=l.e+e.e,(a=h.length)<(c=v.length)&&(o=h,h=v,v=o,u=a,a=c,c=u),o=[],n=u=a+c;n--;)o.push(0);for(n=c;--n>=0;){for(r=0,i=a+n;i>n;)s=o[i]+v[n]*h[i-n-1]+r,o[i--]=s%g|0,r=s/g|0;o[i]=(o[i]+r)%g|0}for(;!o[--u];)o.pop();return r?++t:o.shift(),e.d=o,e.e=t,f?T(e,d.precision):e},m.toDecimalPlaces=m.todp=function(e,r){var t=this,n=t.constructor;return t=new n(t),void 0===e?t:(y(e,0,u),void 0===r?r=n.rounding:y(r,0,8),T(t,e+O(t)+1,r))},m.toExponential=function(e,r){var t,n=this,i=n.constructor;return void 0===e?t=D(n,!0):(y(e,0,u),void 0===r?r=i.rounding:y(r,0,8),t=D(n=T(new i(n),e+1,r),!0,e+1)),t},m.toFixed=function(e,r){var t,n,i=this,o=i.constructor;return void 0===e?D(i):(y(e,0,u),void 0===r?r=o.rounding:y(r,0,8),t=D((n=T(new o(i),e+O(i)+1,r)).abs(),!1,e+O(n)+1),i.isneg()&&!i.isZero()?"-"+t:t)},m.toInteger=m.toint=function(){var e=this,r=e.constructor;return T(new r(e),O(e)+1,r.rounding)},m.toNumber=function(){return+this},m.toPower=m.pow=function(e){var r,t,n,i,u,s,c=this,l=c.constructor,h=+(e=new l(e));if(!e.s)return new l(o);if(!(c=new l(c)).s){if(e.s<1)throw Error(a+"Infinity");return c}if(c.eq(o))return c;if(n=l.precision,e.eq(o))return T(c,n);if(s=(r=e.e)>=(t=e.d.length-1),u=c.s,s){if((t=h<0?-h:h)<=9007199254740991){for(i=new l(o),r=Math.ceil(n/p+4),f=!1;t%2&&j((i=i.times(c)).d,r),0!==(t=d(t/2));)j((c=c.times(c)).d,r);return f=!0,e.s<0?new l(o).div(i):T(i,n)}}else if(u<0)throw Error(a+"NaN");return u=u<0&&1&e.d[Math.max(r,t)]?-1:1,c.s=1,f=!1,i=e.times(_(c,n+12)),f=!0,(i=M(i)).s=u,i},m.toPrecision=function(e,r){var t,n,i=this,o=i.constructor;return void 0===e?n=D(i,(t=O(i))<=o.toExpNeg||t>=o.toExpPos):(y(e,1,u),void 0===r?r=o.rounding:y(r,0,8),n=D(i=T(new o(i),e,r),e<=(t=O(i))||t<=o.toExpNeg,e)),n},m.toSignificantDigits=m.tosd=function(e,r){var t=this.constructor;return void 0===e?(e=t.precision,r=t.rounding):(y(e,1,u),void 0===r?r=t.rounding:y(r,0,8)),T(new t(this),e,r)},m.toString=m.valueOf=m.val=m.toJSON=function(){var e=this,r=O(e),t=e.constructor;return D(e,r<=t.toExpNeg||r>=t.toExpPos)};var E=function(){function e(e,r){var t,n=0,i=e.length;for(e=e.slice();i--;)t=e[i]*r+n,e[i]=t%g|0,n=t/g|0;return n&&e.unshift(n),e}function r(e,r,t,n){var i,o;if(t!=n)o=t>n?1:-1;else for(i=o=0;i<t;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function t(e,r,t){for(var n=0;t--;)e[t]-=n,n=e[t]<r[t]?1:0,e[t]=n*g+e[t]-r[t];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,o,u){var s,f,c,l,d,h,v,w,m,b,y,N,E,M,x,A,_,P,k=n.constructor,D=n.s==i.s?1:-1,j=n.d,L=i.d;if(!n.s)return new k(n);if(!i.s)throw Error(a+"Division by zero");for(f=n.e-i.e,_=L.length,x=j.length,w=(v=new k(D)).d=[],c=0;L[c]==(j[c]||0);)++c;if(L[c]>(j[c]||0)&&--f,(N=null==o?o=k.precision:u?o+(O(n)-O(i))+1:o)<0)return new k(0);if(N=N/p+2|0,c=0,1==_)for(l=0,L=L[0],N++;(c<x||l)&&N--;c++)E=l*g+(j[c]||0),w[c]=E/L|0,l=E%L|0;else{for((l=g/(L[0]+1)|0)>1&&(L=e(L,l),j=e(j,l),_=L.length,x=j.length),M=_,b=(m=j.slice(0,_)).length;b<_;)m[b++]=0;(P=L.slice()).unshift(0),A=L[0],L[1]>=g/2&&++A;do{l=0,(s=r(L,m,_,b))<0?(y=m[0],_!=b&&(y=y*g+(m[1]||0)),(l=y/A|0)>1?(l>=g&&(l=g-1),1==(s=r(d=e(L,l),m,h=d.length,b=m.length))&&(l--,t(d,_<h?P:L,h))):(0==l&&(s=l=1),d=L.slice()),(h=d.length)<b&&d.unshift(0),t(m,d,b),-1==s&&(s=r(L,m,_,b=m.length))<1&&(l++,t(m,_<b?P:L,b)),b=m.length):0===s&&(l++,m=[0]),w[c++]=l,s&&m[0]?m[b++]=j[M]||0:(m=[j[M]],b=1)}while((M++<x||void 0!==m[0])&&N--)}return w[0]||w.shift(),v.e=f,T(v,u?o+O(v)+1:o)}}();function M(e,r){var t,n,i,u,s,a=0,c=0,d=e.constructor,v=d.precision;if(O(e)>16)throw Error(l+O(e));if(!e.s)return new d(o);for(null==r?(f=!1,s=v):s=r,u=new d(.03125);e.abs().gte(.1);)e=e.times(u),c+=5;for(s+=Math.log(h(2,c))/Math.LN10*2+5|0,t=n=i=new d(o),d.precision=s;;){if(n=T(n.times(e),s),t=t.times(++a),N((u=i.plus(E(n,t,s))).d).slice(0,s)===N(i.d).slice(0,s)){for(;c--;)i=T(i.times(i),s);return d.precision=v,null==r?(f=!0,T(i,v)):i}i=u}}function O(e){for(var r=e.e*p,t=e.d[0];t>=10;t/=10)r++;return r}function x(e,r,t){if(r>e.LN10.sd())throw f=!0,t&&(e.precision=t),Error(a+"LN10 precision limit exceeded");return T(new e(e.LN10),r)}function A(e){for(var r="";e--;)r+="0";return r}function _(e,r){var t,n,i,u,s,c,l,d,h,v=1,g=e,p=g.d,w=g.constructor,m=w.precision;if(g.s<1)throw Error(a+(g.s?"NaN":"-Infinity"));if(g.eq(o))return new w(0);if(null==r?(f=!1,d=m):d=r,g.eq(10))return null==r&&(f=!0),x(w,d);if(d+=10,w.precision=d,n=(t=N(p)).charAt(0),u=O(g),!(Math.abs(u)<15e14))return l=x(w,d+2,m).times(u+""),g=_(new w(n+"."+t.slice(1)),d-10).plus(l),w.precision=m,null==r?(f=!0,T(g,m)):g;for(;n<7&&1!=n||1==n&&t.charAt(1)>3;)n=(t=N((g=g.times(e)).d)).charAt(0),v++;for(u=O(g),n>1?(g=new w("0."+t),u++):g=new w(n+"."+t.slice(1)),c=s=g=E(g.minus(o),g.plus(o),d),h=T(g.times(g),d),i=3;;){if(s=T(s.times(h),d),N((l=c.plus(E(s,new w(i),d))).d).slice(0,d)===N(c.d).slice(0,d))return c=c.times(2),0!==u&&(c=c.plus(x(w,d+2,m).times(u+""))),c=E(c,new w(v),d),w.precision=m,null==r?(f=!0,T(c,m)):c;c=l,i+=2}}function P(e,r){var t,n,i;for((t=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(t<0&&(t=n),t+=+r.slice(n+1),r=r.substring(0,n)):t<0&&(t=r.length),n=0;48===r.charCodeAt(n);)++n;for(i=r.length;48===r.charCodeAt(i-1);)--i;if(r=r.slice(n,i)){if(i-=n,t=t-n-1,e.e=d(t/p),e.d=[],n=(t+1)%p,t<0&&(n+=p),n<i){for(n&&e.d.push(+r.slice(0,n)),i-=p;n<i;)e.d.push(+r.slice(n,n+=p));r=r.slice(n),n=p-r.length}else n-=i;for(;n--;)r+="0";if(e.d.push(+r),f&&(e.e>w||e.e<-w))throw Error(l+t)}else e.s=0,e.e=0,e.d=[0];return e}function T(e,r,t){var n,i,o,u,s,a,c,v,m=e.d;for(u=1,o=m[0];o>=10;o/=10)u++;if((n=r-u)<0)n+=p,i=r,c=m[v=0];else{if((v=Math.ceil((n+1)/p))>=(o=m.length))return e;for(c=o=m[v],u=1;o>=10;o/=10)u++;i=(n%=p)-p+u}if(void 0!==t&&(s=c/(o=h(10,u-i-1))%10|0,a=r<0||void 0!==m[v+1]||c%o,a=t<4?(s||a)&&(0==t||t==(e.s<0?3:2)):s>5||5==s&&(4==t||a||6==t&&(n>0?i>0?c/h(10,u-i):0:m[v-1])%10&1||t==(e.s<0?8:7))),r<1||!m[0])return a?(o=O(e),m.length=1,r=r-o-1,m[0]=h(10,(p-r%p)%p),e.e=d(-r/p)||0):(m.length=1,m[0]=e.e=e.s=0),e;if(0==n?(m.length=v,o=1,v--):(m.length=v+1,o=h(10,p-n),m[v]=i>0?(c/h(10,u-i)%h(10,i)|0)*o:0),a)for(;;){if(0==v){(m[0]+=o)==g&&(m[0]=1,++e.e);break}if(m[v]+=o,m[v]!=g)break;m[v--]=0,o=1}for(n=m.length;0===m[--n];)m.pop();if(f&&(e.e>w||e.e<-w))throw Error(l+O(e));return e}function k(e,r){var t,n,i,o,u,s,a,c,l,d,h=e.constructor,v=h.precision;if(!e.s||!r.s)return r.s?r.s=-r.s:r=new h(e),f?T(r,v):r;if(a=e.d,d=r.d,n=r.e,c=e.e,a=a.slice(),u=c-n){for((l=u<0)?(t=a,u=-u,s=d.length):(t=d,n=c,s=a.length),u>(i=Math.max(Math.ceil(v/p),s)+2)&&(u=i,t.length=1),t.reverse(),i=u;i--;)t.push(0);t.reverse()}else{for((l=(i=a.length)<(s=d.length))&&(s=i),i=0;i<s;i++)if(a[i]!=d[i]){l=a[i]<d[i];break}u=0}for(l&&(t=a,a=d,d=t,r.s=-r.s),s=a.length,i=d.length-s;i>0;--i)a[s++]=0;for(i=d.length;i>u;){if(a[--i]<d[i]){for(o=i;o&&0===a[--o];)a[o]=g-1;--a[o],a[i]+=g}a[i]-=d[i]}for(;0===a[--s];)a.pop();for(;0===a[0];a.shift())--n;return a[0]?(r.d=a,r.e=n,f?T(r,v):r):new h(0)}function D(e,r,t){var n,i=O(e),o=N(e.d),u=o.length;return r?(t&&(n=t-u)>0?o=o.charAt(0)+"."+o.slice(1)+A(n):u>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+A(-i-1)+o,t&&(n=t-u)>0&&(o+=A(n))):i>=u?(o+=A(i+1-u),t&&(n=t-i-1)>0&&(o=o+"."+A(n))):((n=i+1)<u&&(o=o.slice(0,n)+"."+o.slice(n)),t&&(n=t-u)>0&&(i+1===u&&(o+="."),o+=A(n))),e.s<0?"-"+o:o}function j(e,r){if(e.length>r)return e.length=r,!0}function L(e){if(!e||"object"!=typeof e)throw Error(a+"Object expected");var r,t,n,i=["precision",1,u,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(r=0;r<i.length;r+=3)if(void 0!==(n=e[t=i[r]])){if(!(d(n)===n&&n>=i[r+1]&&n<=i[r+2]))throw Error(c+t+": "+n);this[t]=n}if(void 0!==(n=e[t="LN10"])){if(n!=Math.LN10)throw Error(c+t+": "+n);this[t]=new this(n)}return this}(s=function e(r){var t,n,i;function o(e){var r=this;if(!(r instanceof o))return new o(e);if(r.constructor=o,e instanceof o)return r.s=e.s,r.e=e.e,void(r.d=(e=e.d)?e.slice():e);if("number"==typeof e){if(0*e!=0)throw Error(c+e);if(e>0)r.s=1;else{if(!(e<0))return r.s=0,r.e=0,void(r.d=[0]);e=-e,r.s=-1}return e===~~e&&e<1e7?(r.e=0,void(r.d=[e])):P(r,e.toString())}if("string"!=typeof e)throw Error(c+e);if(45===e.charCodeAt(0)?(e=e.slice(1),r.s=-1):r.s=1,!v.test(e))throw Error(c+e);P(r,e)}if(o.prototype=m,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.clone=e,o.config=o.set=L,void 0===r&&(r={}),r)for(i=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<i.length;)r.hasOwnProperty(n=i[t++])||(r[n]=this[n]);return o.config(r),o}(s)).default=s.Decimal=s,o=new s(1),void 0===(n=function(){return s}.call(r,t,r,e))||(e.exports=n)}()},function(e,r,t){"use strict";function n(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}Object.defineProperty(r,"__esModule",{value:!0}),r.memoize=r.reverse=r.compose=r.map=r.range=r.curry=r.PLACE_HOLDER=void 0;var i=function(e){return e},o={"@@functional/placeholder":!0};r.PLACE_HOLDER=o;var u=function(e){return e===o},s=function(e){return function r(){return 0===arguments.length||1===arguments.length&&u(arguments.length<=0?void 0:arguments[0])?r:e.apply(void 0,arguments)}},f=function(e){return function e(r,t){return 1===r?t:s(function(){for(var i=arguments.length,f=new Array(i),a=0;a<i;a++)f[a]=arguments[a];var c=f.filter(function(e){return e!==o}).length;return c>=r?t.apply(void 0,f):e(r-c,s(function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];var o=f.map(function(e){return u(e)?r.shift():e});return t.apply(void 0,n(o).concat(r))}))})}(e.length,e)};r.curry=f;r.range=function(e,r){for(var t=[],n=e;n<r;++n)t[n-e]=n;return t};var a=f(function(e,r){return Array.isArray(r)?r.map(e):Object.keys(r).map(function(e){return r[e]}).map(e)});r.map=a;r.compose=function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];if(!r.length)return i;var n=r.reverse(),o=n[0],u=n.slice(1);return function(){return u.reduce(function(e,r){return r(e)},o.apply(void 0,arguments))}};r.reverse=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")};r.memoize=function(e){var r=null,t=null;return function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return r&&i.every(function(e,t){return e===r[t]})?t:(r=i,t=e.apply(void 0,i))}}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"getTickValues",{enumerable:!0,get:function(){return n.getTickValues}}),Object.defineProperty(r,"getNiceTickValues",{enumerable:!0,get:function(){return n.getNiceTickValues}}),Object.defineProperty(r,"getTickValuesFixedDomain",{enumerable:!0,get:function(){return n.getTickValuesFixedDomain}});var n=t(3)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.getTickValuesFixedDomain=r.getTickValues=r.getNiceTickValues=void 0;var n=u(t(0)),i=t(1),o=u(t(4));function u(e){return e&&e.__esModule?e:{default:e}}function s(e){return function(e){if(Array.isArray(e)){for(var r=0,t=new Array(e.length);r<e.length;r++)t[r]=e[r];return t}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function f(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=[],n=!0,i=!1,o=void 0;try{for(var u,s=e[Symbol.iterator]();!(n=(u=s.next()).done)&&(t.push(u.value),!r||t.length!==r);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return t}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function a(e){var r=f(e,2),t=r[0],n=r[1],i=t,o=n;return t>n&&(i=n,o=t),[i,o]}function c(e,r,t){if(e.lte(0))return new n.default(0);var i=o.default.getDigitCount(e.toNumber()),u=new n.default(10).pow(i),s=e.div(u),f=1!==i?.05:.1,a=new n.default(Math.ceil(s.div(f).toNumber())).add(t).mul(f).mul(u);return r?a:new n.default(Math.ceil(a))}function l(e,r,t){var u=1,s=new n.default(e);if(!s.isint()&&t){var f=Math.abs(e);f<1?(u=new n.default(10).pow(o.default.getDigitCount(e)-1),s=new n.default(Math.floor(s.div(u).toNumber())).mul(u)):f>1&&(s=new n.default(Math.floor(e)))}else 0===e?s=new n.default(Math.floor((r-1)/2)):t||(s=new n.default(Math.floor(e)));var a=Math.floor((r-1)/2);return(0,i.compose)((0,i.map)(function(e){return s.add(new n.default(e-a).mul(u)).toNumber()}),i.range)(0,r)}var d=(0,i.memoize)(function(e){var r=f(e,2),t=r[0],u=r[1],d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,h=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],v=Math.max(d,2),g=f(a([t,u]),2),p=g[0],w=g[1];if(p===-1/0||w===1/0){var m=w===1/0?[p].concat(s((0,i.range)(0,d-1).map(function(){return 1/0}))):s((0,i.range)(0,d-1).map(function(){return-1/0})).concat([w]);return t>u?(0,i.reverse)(m):m}if(p===w)return l(p,d,h);var b=function e(r,t,i,o){var u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!Number.isFinite((t-r)/(i-1)))return{step:new n.default(0),tickMin:new n.default(0),tickMax:new n.default(0)};var s,f=c(new n.default(t).sub(r).div(i-1),o,u);s=r<=0&&t>=0?new n.default(0):(s=new n.default(r).add(t).div(2)).sub(new n.default(s).mod(f));var a=Math.ceil(s.sub(r).div(f).toNumber()),l=Math.ceil(new n.default(t).sub(s).div(f).toNumber()),d=a+l+1;return d>i?e(r,t,i,o,u+1):(d<i&&(l=t>0?l+(i-d):l,a=t>0?a:a+(i-d)),{step:f,tickMin:s.sub(new n.default(a).mul(f)),tickMax:s.add(new n.default(l).mul(f))})}(p,w,v,h),y=b.step,N=b.tickMin,E=b.tickMax,M=o.default.rangeStep(N,E.add(new n.default(.1).mul(y)),y);return t>u?(0,i.reverse)(M):M});r.getNiceTickValues=d;var h=(0,i.memoize)(function(e){var r=f(e,2),t=r[0],o=r[1],u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6,s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],d=Math.max(u,2),h=f(a([t,o]),2),v=h[0],g=h[1];if(v===-1/0||g===1/0)return[t,o];if(v===g)return l(v,u,s);var p=c(new n.default(g).sub(v).div(d-1),s,0),w=(0,i.compose)((0,i.map)(function(e){return new n.default(v).add(new n.default(e).mul(p)).toNumber()}),i.range)(0,d).filter(function(e){return e>=v&&e<=g});return t>o?(0,i.reverse)(w):w});r.getTickValues=h;var v=(0,i.memoize)(function(e,r){var t=f(e,2),u=t[0],l=t[1],d=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],h=f(a([u,l]),2),v=h[0],g=h[1];if(v===-1/0||g===1/0)return[u,l];if(v===g)return[v];var p=Math.max(r,2),w=c(new n.default(g).sub(v).div(p-1),d,0),m=s(o.default.rangeStep(new n.default(v),new n.default(g).sub(new n.default(.99).mul(w)),w)).concat([g]);return u>l?(0,i.reverse)(m):m});r.getTickValuesFixedDomain=v},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n=function(e){return e&&e.__esModule?e:{default:e}}(t(0)),i=t(1);var o={rangeStep:function(e,r,t){for(var i=new n.default(e),o=[];i.lt(r);)o.push(i.toNumber()),i=i.add(t);return o},getDigitCount:function(e){return 0===e?1:Math.floor(new n.default(e).abs().log(10).toNumber())+1},interpolateNumber:(0,i.curry)(function(e,r,t){var n=+e;return n+t*(+r-n)}),uninterpolateNumber:(0,i.curry)(function(e,r,t){var n=r-+e;return(t-e)/(n=n||1/0)}),uninterpolateTruncation:(0,i.curry)(function(e,r,t){var n=r-+e;return n=n||1/0,Math.max(0,Math.min(1,(t-e)/n))})};r.default=o}]);

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc