a-calc 2.2.10 → 2.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/a-calc.versions.js +1 -1
- package/browser/index.js +1 -1
- package/calc.d.ts +7 -7
- package/cjs/index.js +1 -1
- package/es/index.js +1 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -412,6 +412,15 @@ calc_lite("1+1") // "-" The calculation error is caused by the fact that the uni
|
|
|
412
412
|
* Support writing single numerical values with units, for example `calc("1yuan", {_unit: true})` or `fmt("1yuan | =2",{_unit: true})`
|
|
413
413
|
* Supplement documentation
|
|
414
414
|
|
|
415
|
+
## Performance Comparison
|
|
416
|
+
|
|
417
|
+
Performance test results are subject to variation and may differ across different hardware configurations. The final metrics should be considered only as a reference for comparing the relative performance between different libraries.
|
|
418
|
+
|
|
419
|
+
| | a-calc@2.2.10 | mathjs@12.4.3 | mathjs@13.0.2 | math-expression-evaluator@2.0.4 |
|
|
420
|
+
| ---------------------------------------- | ------------- | ------------- | ------------- | ------------------------------- |
|
|
421
|
+
| 50,000 complex calculations runtime(ms) | 423 | 3791 | 610 | 701 |
|
|
422
|
+
| 500,000 complex calculations runtime(ms) | 3650 | 36948 | 5724 | 6764 |
|
|
423
|
+
|
|
415
424
|
## Attention
|
|
416
425
|
|
|
417
426
|
- Do not enclose individual numbers in parentheses.
|
package/a-calc.versions.js
CHANGED
package/browser/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a_calc=function(exports){"use strict";function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,i,o,a,u=[],s=!0,c=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;s=!1}else for(;!(s=(n=o.call(t)).done)&&(u.push(n.value),u.length!==r);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw i}}return u}}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,n=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{s({},"")}catch(e){s=function(e,r,t){return e[r]=t}}function c(e,r,t,i){var o=r&&r.prototype instanceof p?r:p,a=Object.create(o.prototype),u=new A(i||[]);return n(a,"_invoke",{value:w(e,t,u)}),a}function l(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function p(){}function h(){}function _(){}var v={};s(v,o,(function(){return this}));var m=Object.getPrototypeOf,d=m&&m(m(N([])));d&&d!==r&&t.call(d,o)&&(v=d);var g=_.prototype=p.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(r){s(e,r,(function(e){return this._invoke(r,e)}))}))}function y(e,r){function i(n,o,a,u){var s=l(e[n],e,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==typeof f&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,a,u)}),(function(e){i("throw",e,a,u)})):r.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,u)}))}u(s.arg)}var o;n(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return o=o?o.then(n,n):n()}})}function w(e,r,t){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(t.method=i,t.arg=o;;){var a=t.delegate;if(a){var u=S(a,t);if(u){if(u===f)continue;return u}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var s=l(e,r,t);if("normal"===s.type){if(n=t.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(n="completed",t.method="throw",t.arg=s.arg)}}}function S(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,S(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),f;var i=l(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,f;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function E(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function N(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=_,n(g,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:h,configurable:!0}),h.displayName=s(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===h||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,s(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(y.prototype),s(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(r,t,n,i,o){void 0===o&&(o=Promise);var a=new y(c(r,t,n,i),o);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),s(g,u,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=N,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=t.call(o,"catchLoc"),s=t.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&t.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=r,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),f},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),E(t),f}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var i=n.arg;E(t)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:N(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),f}},e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function asyncGeneratorStep(e,r,t,n,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,i)}function _asyncToGenerator(e){return function(){var r=this,t=arguments;return new Promise((function(n,i){var o=e.apply(r,t);function a(e){asyncGeneratorStep(o,n,i,a,u,"next",e)}function u(e){asyncGeneratorStep(o,n,i,a,u,"throw",e)}a(void 0)}))}}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toPrimitive(e,r){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"==typeof r?r:String(r)}var version="2.2.10";function decimal_round(e,r,t,n,i){var o=e,a=r,u=r.length,s={"~-":function(){var e="<"===t?n-1:n;a=r.slice(0,e)},"~+":function(){var e="<"===t?n-1:n;if(!(u<=e||0===u)){var i=r.slice(0,e);0==+r.slice(e,u)?a=i:(i=(+"9".concat(i)+1).toString().slice(1)).length>e?(a=i.slice(1,i.length),o=(+o+1).toString()):a=i}},"~5":function(){if(0!==u){var e="<"===t?n-1:n;a=r.slice(0,e);var i=+r[e];Number.isNaN(i)||i>=5&&(a=(+"9".concat(a)+1).toString().slice(1)).length>e&&(a=a.slice(1,a.length),o=(+o+1).toString())}},"~6":function(){if(0!==u){var i,s="<"===t?n-1:n,c=+r[s],l=r.slice(+s+1,r.length);l=""===l?0:parseInt(l),i=0===s?+e[e.length-1]:+r[s-1],a=r.slice(0,s),(c>=6||5===c&&l>0||5===c&&i%2!=0)&&(a=(+"9".concat(a)+1).toString().slice(1)).length>s&&(a=a.slice(1,a.length),o=(+o+1).toString())}}};return"<="===t?u<=n?a=r.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"<"===t?u<n?a=r.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"="===t?u<n?a=r+"0".repeat(n-u):u>n&&s[i]&&s[i]():">="===t?u<n&&(a=r+"0".repeat(n-u)):">"===t&&u<=n&&(a=r+"0".repeat(n-u+1)),{int_part:o,dec_part:a}}var number_char="0123456789",var_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",number_first_char="0123456789-+",var_members_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$[].'\"",var_first_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",pure_number_var_first_char="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",empty_char=" \n\r\t",state_initial="initial",state_number="number",state_scientific="scientific",state_operator="operator",state_bracket="bracket",state_var="var",state_symbol="symbol",state_percent="percent",state_round="round",state_plus$1="plus",state_comma="comma",state_fraction="fraction",state_to_number="to-number",state_to_number_string="to-number-string",operator_set=new Set(["+","-","*","/","%","**","//"]),isArray=Array.isArray,isArray$1=isArray,freeGlobal="object"==("undefined"==typeof global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,freeGlobal$1=freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root=freeGlobal$1||freeSelf||Function("return this")(),root$1=root,_Symbol=root$1.Symbol,_Symbol$1=_Symbol,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol$1?_Symbol$1.toStringTag:void 0;function getRawTag(e){var r=hasOwnProperty$3.call(e,symToStringTag$1),t=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(r?e[symToStringTag$1]=t:delete e[symToStringTag$1]),i}var objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$1?_Symbol$1.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return null!=e&&"object"==_typeof(e)}var symbolTag="[object Symbol]";function isSymbol(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag(e)==symbolTag}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,r){if(isArray$1(e))return!1;var t=_typeof(e);return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=r&&e in Object(r))}function isObject(e){var r=_typeof(e);return null!=e&&("object"==r||"function"==r)}var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var r=baseGetTag(e);return r==funcTag||r==genTag||r==asyncTag||r==proxyTag}var coreJsData=root$1["__core-js_shared__"],coreJsData$1=coreJsData,maskSrcKey=(uid=/[^.]+$/.exec(coreJsData$1&&coreJsData$1.keys&&coreJsData$1.keys.IE_PROTO||""),uid?"Symbol(src)_1."+uid:""),uid;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,r){return null==e?void 0:e[r]}function getNative(e,r){var t=getValue(e,r);return baseIsNative(t)?t:void 0}var nativeCreate=getNative(Object,"create"),nativeCreate$1=nativeCreate;function hashClear(){this.__data__=nativeCreate$1?nativeCreate$1(null):{},this.size=0}function hashDelete(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet(e){var r=this.__data__;if(nativeCreate$1){var t=r[e];return t===HASH_UNDEFINED$1?void 0:t}return hasOwnProperty$1.call(r,e)?r[e]:void 0}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas(e){var r=this.__data__;return nativeCreate$1?void 0!==r[e]:hasOwnProperty.call(r,e)}var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=nativeCreate$1&&void 0===r?HASH_UNDEFINED:r,this}function Hash(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,r){return e===r||e!=e&&r!=r}function assocIndexOf(e,r){for(var t=e.length;t--;)if(eq(e[t][0],r))return t;return-1}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var r=this.__data__,t=assocIndexOf(r,e);return!(t<0)&&(t==r.length-1?r.pop():splice.call(r,t,1),--this.size,!0)}function listCacheGet(e){var r=this.__data__,t=assocIndexOf(r,e);return t<0?void 0:r[t][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,r){var t=this.__data__,n=assocIndexOf(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this}function ListCache(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map=getNative(root$1,"Map"),Map$1=Map;function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(e){var r=_typeof(e);return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e}function getMapData(e,r){var t=e.__data__;return isKeyable(r)?t["string"==typeof r?"string":"hash"]:t.map}function mapCacheDelete(e){var r=getMapData(this,e).delete(e);return this.size-=r?1:0,r}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,r){var t=getMapData(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this}function MapCache(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT="Expected a function";function memoize(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new TypeError(FUNC_ERROR_TEXT);var t=function t(){var n=arguments,i=r?r.apply(this,n):n[0],o=t.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return t.cache=o.set(i,a)||o,a};return t.cache=new(memoize.Cache||MapCache),t}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var r=memoize(e,(function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e})),t=r.cache;return r}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(rePropName,(function(e,t,n,i){r.push(n?i.replace(reEscapeChar,"$1"):t||e)})),r})),stringToPath$1=stringToPath;function arrayMap(e,r){for(var t=-1,n=null==e?0:e.length,i=Array(n);++t<n;)i[t]=r(e[t],t,e);return i}var INFINITY$1=1/0,symbolProto=_Symbol$1?_Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray$1(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var r=e+"";return"0"==r&&1/e==-INFINITY$1?"-0":r}function toString(e){return null==e?"":baseToString(e)}function castPath(e,r){return isArray$1(e)?e:isKey(e,r)?[e]:stringToPath$1(toString(e))}var INFINITY=1/0;function toKey(e){if("string"==typeof e||isSymbol(e))return e;var r=e+"";return"0"==r&&1/e==-INFINITY?"-0":r}function baseGet(e,r){for(var t=0,n=(r=castPath(r,e)).length;null!=e&&t<n;)e=e[toKey(r[t++])];return t&&t==n?e:void 0}function get(e,r,t){var n=null==e?void 0:baseGet(e,r);return void 0===n?t:n}function split_unit_num(e){for(var r,t,n,i=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],o=0;o<i.length;o++){var a=e.match(i[o]);if(a){n=a;break}}if(n){t=n[1];var u=n[2];""!==u.trim()&&(r=u)}return{num:t,unit:r}}function find_value(e,r,t){var n,i,o,a;return Array.isArray(e)?e.length>1?null!==(n=null!==(i=get(e[0],r))&&void 0!==i?i:get(e.at(-1),r))&&void 0!==n?n:t:1===e.length&&null!==(o=get(e[0],r))&&void 0!==o?o:t:null!==(a=get(e,r,t))&&void 0!==a?a:t}function parse_mantissa(e,r,t,n){var i=e.split("."),o=i[0],a=1===i.length?"":i[1],u=decimal_round(o,a,r,+t,n);return o=u.int_part,""===(a=u.dec_part)?o:"".concat(o,".").concat(a)}function integer_thousands(e){for(var r=e.length,t="";r>0;)t=e.substring(r-3,r)+(""!==t?",":"")+t,r-=3;return t}function parse_thousands(e){var r=e.split("."),t=r[0];return"-"===t[0]?r[0]="-"+integer_thousands(t.slice(1)):r[0]=integer_thousands(t),r.join(".")}function promise_queue(e){return _promise_queue.apply(this,arguments)}function _promise_queue(){return _promise_queue=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n,i,o=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=o.length>1&&void 0!==o[1]?o[1]:5e3,n=0;case 2:if(!(n<r.length)){e.next=16;break}return e.prev=3,e.next=6,Promise.race([r[n],new Promise((function(e,r){setTimeout((function(){return r(new Error("promise queue timeout err"))}),t)}))]);case 6:i=e.sent,e.next=12;break;case 9:return e.prev=9,e.t0=e.catch(3),e.abrupt("continue",13);case 12:return e.abrupt("return",i);case 13:n++,e.next=2;break;case 16:return e.abrupt("return",Promise.reject("错误的 promise queue 调用"));case 17:case"end":return e.stop()}}),e,null,[[3,9]])}))),_promise_queue.apply(this,arguments)}function test_urls(e){return _test_urls.apply(this,arguments)}function _test_urls(){return(_test_urls=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<r.length)){e.next=16;break}return e.prev=2,e.next=5,fetch(r[t]);case 5:if(!e.sent.ok){e.next=8;break}return e.abrupt("return",r[t]);case 8:e.next=13;break;case 10:return e.prev=10,e.t0=e.catch(2),e.abrupt("continue",13);case 13:t++,e.next=1;break;case 16:return e.abrupt("return",null);case 17:case"end":return e.stop()}}),e,null,[[2,10]])})))).apply(this,arguments)}function get_real_value(e,r){if(Array.isArray(e)){for(var t,n=0,i=e.length;n<i;n++){var o;if(void 0!==(t=null!==(o=get(e[n],r))&&void 0!==o?o:void 0))break}if(void 0===t)throw new Error("填充变量".concat(value,"失败"));return t}var a;return null!==(a=get(e,r))&&void 0!==a?a:void 0}function get_next_nonempty_char(e,r,t){var n;for(r++;r<t;){if(n=e[r],-1===empty_char.indexOf(n))return n;r++}}function parse_args(e,r){var t="",n={origin_expr:e,origin_fill_data:r,expr:"",fmt_expr:"",options:void 0,fill_data:void 0,_unit:void 0,_mode:void 0,_fmt:void 0};if(null!=r&&(n.options=r,Array.isArray(r)?n.fill_data=r:Array.isArray(r._fill_data)?n.fill_data=[r].concat(_toConsumableArray(r._fill_data)):void 0===r._fill_data?n.fill_data=[r]:n.fill_data=[r,r._fill_data]),n._mode=find_value(r,"_mode","normal"),n._unit=find_value(r,"_unit",!1),n._fmt=find_value(r,"_fmt"),"string"==typeof e){if(t=e,""===e.trim()||e.includes("NaN"))throw new Error("非法的表达式:".concat(e))}else{if("number"!=typeof e)throw new Error("错误的第一个参数类型: ".concat(e," 类型为:").concat(_typeof(e)));if(isNaN(e))throw new Error("传入了一个非法数字NaN");t=e.toString()}var i=t.split("|");return n.expr=i[0],i.length>1&&(n.fmt_expr=i[1].trim()),n}function push_token$3(e,r){if(r.curr_state===state_number||r.curr_state===state_scientific){var t=r.expr.slice(r.prev_index,r.cur_index);if(r._unit){var n,i=split_unit_num(t),o=i.num,a=i.unit;if(void 0===a)e.push({type:state_number,value:o,real_value:o,has_unit:!1});else r.has_unit=!0,null!==(n=r.unit_str)&&void 0!==n||(r.unit_str=a),e.push({type:state_number,value:o,real_value:o,has_unit:!0,unit:a})}else e.push({type:state_number,value:t,real_value:t,has_unit:!1})}else if(r.curr_state===state_var){r.has_var=!0;var u=r.expr.slice(r.prev_index,r.cur_index),s=get_real_value(r.fill_data,u);if(r._unit){var c,l=split_unit_num(s),f=l.num,p=l.unit;if(void 0===p)e.push({type:"var",value:u,real_value:f,has_unit:!1});else r.has_unit=!0,null!==(c=r.unit_str)&&void 0!==c||(r.unit_str=p),e.push({type:"var",value:u,real_value:f,has_unit:!0,unit:p})}else e.push({type:"var",value:u,real_value:s,has_unit:!1})}else e.push({type:r.curr_state,value:r.expr.slice(r.prev_index,r.cur_index)});r.curr_state=state_initial,r.prev_index=r.cur_index}function tokenizer(e,r,t){for(var n,i={has_var:!1,has_unit:!1,unit_str:void 0,fill_data:r,cur_index:0,prev_index:0,curr_state:state_initial,expr:e,_unit:t},o=e.length,a=[];i.cur_index<o;)switch(n=e[i.cur_index],i.curr_state){case state_initial:if(number_char.includes(n))i.curr_state=state_number,i.cur_index++;else if(" "===n)i.cur_index++,i.prev_index=i.cur_index;else if("+-".includes(n)){var u=a.at(-1);0===i.cur_index||"operator"===(null==u?void 0:u.type)||"("===(null==u?void 0:u.value)?(i.curr_state=state_number,i.cur_index++):(i.cur_index++,a.push({type:state_operator,value:e.slice(i.prev_index,i.cur_index)}),i.prev_index=i.cur_index)}else"*/%".includes(n)?(i.curr_state=state_operator,i.cur_index++):var_char.includes(n)?(i.curr_state=state_var,i.cur_index++):"()".includes(n)?(a.push({type:state_bracket,value:n}),i.curr_state=state_initial,i.cur_index++,i.prev_index=i.cur_index):(i.cur_index++,i.prev_index=i.cur_index);break;case state_number:if(number_char.includes(n))i.cur_index++;else if("."===n){if(i.cur_index===i.prev_index||e.slice(i.prev_index,i.cur_index).includes("."))throw new Error("非法的小数部分".concat(e.slice(i.prev_index,i.cur_index)));i.cur_index++}else"e"===n?(i.curr_state=state_scientific,i.cur_index++):t?"*/+-() ".indexOf(n)>-1||"%"===n&&number_char.includes(e[i.cur_index-1])&&pure_number_var_first_char.includes(get_next_nonempty_char(e,i.cur_index,o))?push_token$3(a,i):i.cur_index++:push_token$3(a,i);break;case state_operator:var s=e[i.cur_index-1];"*"===n&&"*"===s?(i.cur_index++,a.push({type:state_operator,value:"**"}),i.prev_index=i.cur_index):"/"===n&&"/"===s?(i.cur_index++,a.push({type:state_operator,value:"//"}),i.prev_index=i.cur_index):(a.push({type:state_operator,value:s}),i.prev_index=i.cur_index),i.curr_state=state_initial;break;case state_var:var_members_char.includes(n)?i.cur_index++:push_token$3(a,i);break;case state_scientific:if(number_char.includes(n))i.cur_index++;else if("+-".includes(n)){var c=i.prev_index;"+-".includes(e[c])&&(c+=1);var l=e.slice(c,i.cur_index),f=l.at(-1);l.includes(n)||"e"!==f?push_token$3(a,i):i.cur_index++}else t&&-1==="*/+-() ".indexOf(n)?i.cur_index++:push_token$3(a,i);break;default:throw new Error("字符扫描状态错误")}return i.prev_index<i.cur_index&&push_token$3(a,i),a.has_var=i.has_var,a.has_unit=i.has_unit,a.unit=i.unit_str,a}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var r,t,n,i,o,a,u,s,c,l,f=A.prototype={constructor:A,toString:null,valueOf:null},p=new A(1),h=20,_=4,v=-7,m=21,d=-1e7,g=1e7,b=!1,y=1,w=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",E=!0;function A(e,r){var i,o,a,u,s,c,l,f,p=this;if(!(p instanceof A))return new A(e,r);if(null==r){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>g?p.c=p.e=null:e.e<d?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((c="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,s=e;s>=10;s/=10,u++);return void(u>g?p.c=p.e=null:(p.e=u,p.c=[e]))}f=String(e)}else{if(!isNumeric.test(f=String(e)))return n(p,f,c);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(s=f.search(/e/i))>0?(u<0&&(u=s),u+=+f.slice(s+1),f=f.substring(0,s)):u<0&&(u=f.length)}else{if(intCheck(r,2,x.length,"Base"),10==r&&E)return B(p=new A(e),h+p.e+1,_);if(f=String(e),c="number"==typeof e){if(0*e!=0)return n(p,f,c,r);if(p.s=1/e<0?(f=f.slice(1),-1):1,A.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(i=x.slice(0,r),u=s=0,l=f.length;s<l;s++)if(i.indexOf(o=f.charAt(s))<0){if("."==o){if(s>u){u=l;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,s=-1,u=0;continue}return n(p,String(e),c,r)}c=!1,(u=(f=t(f,r,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(s=0;48===f.charCodeAt(s);s++);for(l=f.length;48===f.charCodeAt(--l););if(f=f.slice(s,++l)){if(l-=s,c&&A.DEBUG&&l>15&&(e>MAX_SAFE_INTEGER||e!==mathfloor(e)))throw Error(tooManyDigits+p.s*e);if((u=u-s-1)>g)p.c=p.e=null;else if(u<d)p.c=[p.e=0];else{if(p.e=u,p.c=[],s=(u+1)%LOG_BASE,u<0&&(s+=LOG_BASE),s<l){for(s&&p.c.push(+f.slice(0,s)),l-=LOG_BASE;s<l;)p.c.push(+f.slice(s,s+=LOG_BASE));s=LOG_BASE-(f=f.slice(s)).length}else s-=l;for(;s--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function N(e,r,t,n){var i,o,a,u,s;if(null==t?t=_:intCheck(t,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==r)s=coeffToString(e.c),s=1==n||2==n&&(a<=v||a>=m)?toExponential(s,a):toFixedPoint(s,a,"0");else if(o=(e=B(new A(e),r,t)).e,u=(s=coeffToString(e.c)).length,1==n||2==n&&(r<=o||o<=v)){for(;u<r;s+="0",u++);s=toExponential(s,o)}else if(r-=a,s=toFixedPoint(s,o,"0"),o+1>u){if(--r>0)for(s+=".";r--;s+="0");}else if((r+=o-u)>0)for(o+1==u&&(s+=".");r--;s+="0");return e.s<0&&i?"-"+s:s}function O(e,r){for(var t,n=1,i=new A(e[0]);n<e.length;n++){if(!(t=new A(e[n])).s){i=t;break}r.call(i,t)&&(i=t)}return i}function k(e,r,t){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,n++);return(t=n+t*LOG_BASE-1)>g?e.c=e.e=null:t<d?e.c=[e.e=0]:(e.e=t,e.c=r),e}function B(e,r,t,n){var i,o,a,u,s,c,l,f=e.c,p=POWS_TEN;if(f){e:{for(i=1,u=f[0];u>=10;u/=10,i++);if((o=r-i)<0)o+=LOG_BASE,a=r,l=(s=f[c=0])/p[i-a-1]%10|0;else if((c=mathceil((o+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));s=l=0,i=1,a=(o%=LOG_BASE)-LOG_BASE+1}else{for(s=u=f[c],i=1;u>=10;u/=10,i++);l=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:s/p[i-a-1]%10|0}if(n=n||r<0||null!=f[c+1]||(a<0?s:s%p[i-a-1]),n=t<4?(l||n)&&(0==t||t==(e.s<0?3:2)):l>5||5==l&&(4==t||n||6==t&&(o>0?a>0?s/p[i-a]:0:f[c-1])%10&1||t==(e.s<0?8:7)),r<1||!f[0])return f.length=0,n?(r-=e.e+1,f[0]=p[(LOG_BASE-r%LOG_BASE)%LOG_BASE],e.e=-r||0):f[0]=e.e=0,e;if(0==o?(f.length=c,u=1,c--):(f.length=c+1,u=p[LOG_BASE-o],f[c]=a>0?mathfloor(s/p[i-a]%p[a])*u:0),n)for(;;){if(0==c){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);o!=u&&(e.e++,f[0]==BASE&&(f[0]=1));break}if(f[c]+=u,f[c]!=BASE)break;f[c--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>g?e.c=e.e=null:e.e<d&&(e.c=[e.e=0])}return e}function T(e){var r,t=e.e;return null===t?e.toString():(r=coeffToString(e.c),r=t<=v||t>=m?toExponential(r,t):toFixedPoint(r,t,"0"),e.s<0?"-"+r:r)}return A.clone=clone,A.ROUND_UP=0,A.ROUND_DOWN=1,A.ROUND_CEIL=2,A.ROUND_FLOOR=3,A.ROUND_HALF_UP=4,A.ROUND_HALF_DOWN=5,A.ROUND_HALF_EVEN=6,A.ROUND_HALF_CEIL=7,A.ROUND_HALF_FLOOR=8,A.EUCLID=9,A.config=A.set=function(e){var r,t;if(null!=e){if("object"!=_typeof(e))throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(intCheck(t=e[r],0,MAX,r),h=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(intCheck(t=e[r],0,8,r),_=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(intCheck(t[0],-MAX,0,r),intCheck(t[1],0,MAX,r),v=t[0],m=t[1]):(intCheck(t,-MAX,MAX,r),v=-(m=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)intCheck(t[0],-MAX,-1,r),intCheck(t[1],1,MAX,r),d=t[0],g=t[1];else{if(intCheck(t,-MAX,MAX,r),!t)throw Error(bignumberError+r+" cannot be zero: "+t);d=-(g=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(bignumberError+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw b=!t,Error(bignumberError+"crypto unavailable");b=t}else b=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(intCheck(t=e[r],0,9,r),y=t),e.hasOwnProperty(r="POW_PRECISION")&&(intCheck(t=e[r],0,MAX,r),w=t),e.hasOwnProperty(r="FORMAT")){if("object"!=_typeof(t=e[r]))throw Error(bignumberError+r+" not an object: "+t);S=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.?$|[+\-.\s]|(.).*\1/.test(t))throw Error(bignumberError+r+" invalid: "+t);E="0123456789"==t.slice(0,10),x=t}}return{DECIMAL_PLACES:h,ROUNDING_MODE:_,EXPONENTIAL_AT:[v,m],RANGE:[d,g],CRYPTO:b,MODULO_MODE:y,POW_PRECISION:w,FORMAT:S,ALPHABET:x}},A.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!A.DEBUG)return!0;var r,t,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-MAX&&i<=MAX&&i===mathfloor(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((r=(i+1)%LOG_BASE)<1&&(r+=LOG_BASE),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||t>=BASE||t!==mathfloor(t))break e;if(0!==t)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},A.maximum=A.max=function(){return O(arguments,f.lt)},A.minimum=A.min=function(){return O(arguments,f.gt)},A.random=(i=9007199254740992,o=Math.random()*i&2097151?function(){return mathfloor(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,n,i,a,u=0,s=[],c=new A(p);if(null==e?e=h:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),b)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(a=131072*r[u]+(r[u+1]>>>11))>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),r[u]=t[0],r[u+1]=t[1]):(s.push(a%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw b=!1,Error(bignumberError+"crypto unavailable");for(r=crypto.randomBytes(i*=7);u<i;)(a=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6])>=9e15?crypto.randomBytes(7).copy(r,u):(s.push(a%1e14),u+=7);u=i/7}if(!b)for(;u<i;)(a=o())<9e15&&(s[u++]=a%1e14);for(i=s[--u],e%=LOG_BASE,i&&e&&(a=POWS_TEN[LOG_BASE-e],s[u]=mathfloor(i/a)*a);0===s[u];s.pop(),u--);if(u<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(u=1,a=s[0];a>=10;a/=10,u++);u<LOG_BASE&&(n-=LOG_BASE-u)}return c.e=n,c.c=s,c}),A.sum=function(){for(var e=1,r=arguments,t=new A(r[0]);e<r.length;)t=t.plus(r[e++]);return t},t=function(){var e="0123456789";function t(e,r,t,n){for(var i,o,a=[0],u=0,s=e.length;u<s;){for(o=a.length;o--;a[o]*=r);for(a[0]+=n.indexOf(e.charAt(u++)),i=0;i<a.length;i++)a[i]>t-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/t|0,a[i]%=t)}return a.reverse()}return function(n,i,o,a,u){var s,c,l,f,p,v,m,d,g=n.indexOf("."),b=h,y=_;for(g>=0&&(f=w,w=0,n=n.replace(".",""),v=(d=new A(i)).pow(n.length-g),w=f,d.c=t(toFixedPoint(coeffToString(v.c),v.e,"0"),10,o,e),d.e=d.c.length),l=f=(m=t(n,i,o,u?(s=x,e):(s=e,x))).length;0==m[--f];m.pop());if(!m[0])return s.charAt(0);if(g<0?--l:(v.c=m,v.e=l,v.s=a,m=(v=r(v,d,b,y,o)).c,p=v.r,l=v.e),g=m[c=l+b+1],f=o/2,p=p||c<0||null!=m[c+1],p=y<4?(null!=g||p)&&(0==y||y==(v.s<0?3:2)):g>f||g==f&&(4==y||p||6==y&&1&m[c-1]||y==(v.s<0?8:7)),c<1||!m[0])n=p?toFixedPoint(s.charAt(1),-b,s.charAt(0)):s.charAt(0);else{if(m.length=c,p)for(--o;++m[--c]>o;)m[c]=0,c||(++l,m=[1].concat(m));for(f=m.length;!m[--f];);for(g=0,n="";g<=f;n+=s.charAt(m[g++]));n=toFixedPoint(n,l,s.charAt(0))}return n}}(),r=function(){function e(e,r,t){var n,i,o,a,u=0,s=e.length,c=r%SQRT_BASE,l=r/SQRT_BASE|0;for(e=e.slice();s--;)u=((i=c*(o=e[s]%SQRT_BASE)+(n=l*o+(a=e[s]/SQRT_BASE|0)*c)%SQRT_BASE*SQRT_BASE+u)/t|0)+(n/SQRT_BASE|0)+l*a,e[s]=i%t;return u&&(e=[u].concat(e)),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,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,a,u){var s,c,l,f,p,h,_,v,m,d,g,b,y,w,S,x,E,N=n.s==i.s?1:-1,O=n.c,k=i.c;if(!(O&&O[0]&&k&&k[0]))return new A(n.s&&i.s&&(O?!k||O[0]!=k[0]:k)?O&&0==O[0]||!k?0*N:N/0:NaN);for(m=(v=new A(N)).c=[],N=o+(c=n.e-i.e)+1,u||(u=BASE,c=bitFloor(n.e/LOG_BASE)-bitFloor(i.e/LOG_BASE),N=N/LOG_BASE|0),l=0;k[l]==(O[l]||0);l++);if(k[l]>(O[l]||0)&&c--,N<0)m.push(1),f=!0;else{for(w=O.length,x=k.length,l=0,N+=2,(p=mathfloor(u/(k[0]+1)))>1&&(k=e(k,p,u),O=e(O,p,u),x=k.length,w=O.length),y=x,g=(d=O.slice(0,x)).length;g<x;d[g++]=0);E=k.slice(),E=[0].concat(E),S=k[0],k[1]>=u/2&&S++;do{if(p=0,(s=r(k,d,x,g))<0){if(b=d[0],x!=g&&(b=b*u+(d[1]||0)),(p=mathfloor(b/S))>1)for(p>=u&&(p=u-1),_=(h=e(k,p,u)).length,g=d.length;1==r(h,d,_,g);)p--,t(h,x<_?E:k,_,u),_=h.length,s=1;else 0==p&&(s=p=1),_=(h=k.slice()).length;if(_<g&&(h=[0].concat(h)),t(d,h,g,u),g=d.length,-1==s)for(;r(k,d,x,g)<1;)p++,t(d,x<g?E:k,g,u),g=d.length}else 0===s&&(p++,d=[0]);m[l++]=p,d[0]?d[g++]=O[y]||0:(d=[O[y]],g=1)}while((y++<w||null!=d[0])&&N--);f=null!=d[0],m[0]||m.splice(0,1)}if(u==BASE){for(l=1,N=m[0];N>=10;N/=10,l++);B(v,o+(v.e=l+c*LOG_BASE-1)+1,a,f)}else v.e=c,v.r=+f;return v}}(),a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,s=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,l=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,r,t,n){var i,o=t?r:r.replace(l,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!t&&(o=o.replace(a,(function(e,r,t){return i="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=i?e:r})),n&&(i=n,o=o.replace(u,"$1").replace(s,"0.$1")),r!=o))return new A(o,i);if(A.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new A(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,r){return compare(this,new A(e,r))},f.decimalPlaces=f.dp=function(e,r){var t,n,i,o=this;if(null!=e)return intCheck(e,0,MAX),null==r?r=_:intCheck(r,0,8),B(new A(o),e+o.e+1,r);if(!(t=o.c))return null;if(n=((i=t.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,i=t[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},f.dividedBy=f.div=function(e,t){return r(this,new A(e,t),h,_)},f.dividedToIntegerBy=f.idiv=function(e,t){return r(this,new A(e,t),0,1)},f.exponentiatedBy=f.pow=function(e,r){var t,n,i,o,a,u,s,c,l=this;if((e=new A(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+T(e));if(null!=r&&(r=new A(r)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return c=new A(Math.pow(+T(l),a?e.s*(2-isOdd(e)):+T(e))),r?c.mod(r):c;if(u=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new A(NaN);(n=!u&&l.isInteger()&&r.isInteger())&&(l=l.mod(r))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return o=l.s<0&&isOdd(e)?-0:0,l.e>-1&&(o=1/o),new A(u?1/o:o);w&&(o=mathceil(w/LOG_BASE+2))}for(a?(t=new A(.5),u&&(e.s=1),s=isOdd(e)):s=(i=Math.abs(+T(e)))%2,c=new A(p);;){if(s){if(!(c=c.times(l)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(r))}if(i){if(0===(i=mathfloor(i/2)))break;s=i%2}else if(B(e=e.times(t),e.e+1,1),e.e>14)s=isOdd(e);else{if(0===(i=+T(e)))break;s=i%2}l=l.times(l),o?l.c&&l.c.length>o&&(l.c.length=o):n&&(l=l.mod(r))}return n?c:(u&&(c=p.div(c)),r?c.mod(r):o?B(c,w,_,undefined):c)},f.integerValue=function(e){var r=new A(this);return null==e?e=_:intCheck(e,0,8),B(r,r.e+1,e)},f.isEqualTo=f.eq=function(e,r){return 0===compare(this,new A(e,r))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,r){return compare(this,new A(e,r))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,r){return 1===(r=compare(this,new A(e,r)))||0===r},f.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},f.isLessThan=f.lt=function(e,r){return compare(this,new A(e,r))<0},f.isLessThanOrEqualTo=f.lte=function(e,r){return-1===(r=compare(this,new A(e,r)))||0===r},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,r){var t,n,i,o,a=this,u=a.s;if(r=(e=new A(e,r)).s,!u||!r)return new A(NaN);if(u!=r)return e.s=-r,a.plus(e);var s=a.e/LOG_BASE,c=e.e/LOG_BASE,l=a.c,f=e.c;if(!s||!c){if(!l||!f)return l?(e.s=-r,e):new A(f?a:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-r,e):new A(l[0]?a:3==_?-0:0)}if(s=bitFloor(s),c=bitFloor(c),l=l.slice(),u=s-c){for((o=u<0)?(u=-u,i=l):(c=s,i=f),i.reverse(),r=u;r--;i.push(0));i.reverse()}else for(n=(o=(u=l.length)<(r=f.length))?u:r,u=r=0;r<n;r++)if(l[r]!=f[r]){o=l[r]<f[r];break}if(o&&(i=l,l=f,f=i,e.s=-e.s),(r=(n=f.length)-(t=l.length))>0)for(;r--;l[t++]=0);for(r=BASE-1;n>u;){if(l[--n]<f[n]){for(t=n;t&&!l[--t];l[t]=r);--l[t],l[n]+=BASE}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?k(e,l,c):(e.s=3==_?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,t){var n,i,o=this;return e=new A(e,t),!o.c||!e.s||e.c&&!e.c[0]?new A(NaN):!e.c||o.c&&!o.c[0]?new A(o):(9==y?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,y),(e=o.minus(n.times(e))).c[0]||1!=y||(e.s=o.s),e)},f.multipliedBy=f.times=function(e,r){var t,n,i,o,a,u,s,c,l,f,p,h,_,v,m,d=this,g=d.c,b=(e=new A(e,r)).c;if(!(g&&b&&g[0]&&b[0]))return!d.s||!e.s||g&&!g[0]&&!b||b&&!b[0]&&!g?e.c=e.e=e.s=null:(e.s*=d.s,g&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=bitFloor(d.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=d.s,(s=g.length)<(f=b.length)&&(_=g,g=b,b=_,i=s,s=f,f=i),i=s+f,_=[];i--;_.push(0));for(v=BASE,m=SQRT_BASE,i=f;--i>=0;){for(t=0,p=b[i]%m,h=b[i]/m|0,o=i+(a=s);o>i;)t=((c=p*(c=g[--a]%m)+(u=h*c+(l=g[a]/m|0)*p)%m*m+_[o]+t)/v|0)+(u/m|0)+h*l,_[o--]=c%v;_[o]=t}return t?++n:_.splice(0,1),k(e,_,n)},f.negated=function(){var e=new A(this);return e.s=-e.s||null,e},f.plus=function(e,r){var t,n=this,i=n.s;if(r=(e=new A(e,r)).s,!i||!r)return new A(NaN);if(i!=r)return e.s=-r,n.minus(e);var o=n.e/LOG_BASE,a=e.e/LOG_BASE,u=n.c,s=e.c;if(!o||!a){if(!u||!s)return new A(i/0);if(!u[0]||!s[0])return s[0]?e:new A(u[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),u=u.slice(),i=o-a){for(i>0?(a=o,t=s):(i=-i,t=u),t.reverse();i--;t.push(0));t.reverse()}for((i=u.length)-(r=s.length)<0&&(t=s,s=u,u=t,r=i),i=0;r;)i=(u[--r]=u[r]+s[r]+i)/BASE|0,u[r]=BASE===u[r]?0:u[r]%BASE;return i&&(u=[i].concat(u),++a),k(e,u,a)},f.precision=f.sd=function(e,r){var t,n,i,o=this;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==r?r=_:intCheck(r,0,8),B(new A(o),e,r);if(!(t=o.c))return null;if(n=(i=t.length-1)*LOG_BASE+1,i=t[i]){for(;i%10==0;i/=10,n--);for(i=t[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},f.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,t,n,i,o,a=this,u=a.c,s=a.s,c=a.e,l=h+4,f=new A("0.5");if(1!==s||!u||!u[0])return new A(!s||s<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(s=Math.sqrt(+T(a)))||s==1/0?(((t=coeffToString(u)).length+c)%2==0&&(t+="0"),s=Math.sqrt(+t),c=bitFloor((c+1)/2)-(c<0||c%2),n=new A(t=s==1/0?"5e"+c:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new A(s+""),n.c[0])for((s=(c=n.e)+l)<3&&(s=0);;)if(o=n,n=f.times(o.plus(r(a,o,l,1))),coeffToString(o.c).slice(0,s)===(t=coeffToString(n.c)).slice(0,s)){if(n.e<c&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(B(n,n.e+h+2,1),e=!n.times(n).eq(a));break}if(!i&&(B(o,o.e+h+2,0),o.times(o).eq(a))){n=o;break}l+=4,s+=4,i=1}return B(n,n.e+h+1,_,e)},f.toExponential=function(e,r){return null!=e&&(intCheck(e,0,MAX),e++),N(this,e,r,1)},f.toFixed=function(e,r){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),N(this,e,r)},f.toFormat=function(e,r,t){var n,i=this;if(null==t)null!=e&&r&&"object"==_typeof(r)?(t=r,r=null):e&&"object"==_typeof(e)?(t=e,e=r=null):t=S;else if("object"!=_typeof(t))throw Error(bignumberError+"Argument not an object: "+t);if(n=i.toFixed(e,r),i.c){var o,a=n.split("."),u=+t.groupSize,s=+t.secondaryGroupSize,c=t.groupSeparator||"",l=a[0],f=a[1],p=i.s<0,h=p?l.slice(1):l,_=h.length;if(s&&(o=u,u=s,s=o,_-=o),u>0&&_>0){for(o=_%u||u,l=h.substr(0,o);o<_;o+=u)l+=c+h.substr(o,u);s>0&&(l+=c+h.slice(o)),p&&(l="-"+l)}n=f?l+(t.decimalSeparator||"")+((s=+t.fractionGroupSize)?f.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):f):l}return(t.prefix||"")+n+(t.suffix||"")},f.toFraction=function(e){var t,n,i,o,a,u,s,c,l,f,h,v,m=this,d=m.c;if(null!=e&&(!(s=new A(e)).isInteger()&&(s.c||1!==s.s)||s.lt(p)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+T(s));if(!d)return new A(m);for(t=new A(p),l=n=new A(p),i=c=new A(p),v=coeffToString(d),a=t.e=v.length-m.e-1,t.c[0]=POWS_TEN[(u=a%LOG_BASE)<0?LOG_BASE+u:u],e=!e||s.comparedTo(t)>0?a>0?t:l:s,u=g,g=1/0,s=new A(v),c.c[0]=0;f=r(s,t,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,l=c.plus(f.times(o=l)),c=o,t=s.minus(f.times(o=t)),s=o;return o=r(e.minus(n),i,0,1),c=c.plus(o.times(l)),n=n.plus(o.times(i)),c.s=l.s=m.s,h=r(l,i,a*=2,_).minus(m).abs().comparedTo(r(c,n,a,_).minus(m).abs())<1?[l,i]:[c,n],g=u,h},f.toNumber=function(){return+T(this)},f.toPrecision=function(e,r){return null!=e&&intCheck(e,1,MAX),N(this,e,r,2)},f.toString=function(e){var r,n=this,i=n.s,o=n.e;return null===o?i?(r="Infinity",i<0&&(r="-"+r)):r="NaN":(null==e?r=o<=v||o>=m?toExponential(coeffToString(n.c),o):toFixedPoint(coeffToString(n.c),o,"0"):10===e&&E?r=toFixedPoint(coeffToString((n=B(new A(n),h+o+1,_)).c),n.e,"0"):(intCheck(e,2,x.length,"Base"),r=t(toFixedPoint(coeffToString(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(r="-"+r)),r},f.valueOf=f.toJSON=function(){return T(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=e&&A.set(e),A}function bitFloor(e){var r=0|e;return e>0||e===r?r:r-1}function coeffToString(e){for(var r,t,n=1,i=e.length,o=e[0]+"";n<i;){for(r=e[n++]+"",t=LOG_BASE-r.length;t--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare(e,r){var t,n,i=e.c,o=r.c,a=e.s,u=r.s,s=e.e,c=r.e;if(!a||!u)return null;if(t=i&&!i[0],n=o&&!o[0],t||n)return t?n?0:-u:a;if(a!=u)return a;if(t=a<0,n=s==c,!i||!o)return n?0:!i^t?1:-1;if(!n)return s>c^t?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,a=0;a<u;a++)if(i[a]!=o[a])return i[a]>o[a]^t?1:-1;return s==c?0:s>c^t?1:-1}function intCheck(e,r,t,n){if(e<r||e>t||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<r||e>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var r=e.c.length-1;return bitFloor(e.e/LOG_BASE)==r&&e.c[r]%2!=0}function toExponential(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function toFixedPoint(e,r,t){var n,i;if(r<0){for(i=t+".";++r;i+=t);e=i+e}else if(++r>(n=e.length)){for(i=t,r-=n;--r;i+=t);e+=i}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}var BigNumber=clone();function format(e,r){var t="";if("undefined"===(t=BigNumber.isBigNumber(e)?e.toFixed():"string"==typeof e?e:e.toString())||"NaN"===t)return[void 0,{}];var n={mantissa:null,mantissa_type:null,thousands:!1,sign:!1,round:"~-",scientific:!1,fraction:!1,percent:!1,to_number:!1,to_number_string:!1};if(r.forEach((function(e){var r=e.type;if("symbol"===r){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);n.mantissa_type=e.value}else if("to-number"===r)n.to_number=!0;else if("to-number-string"===r)n.to_number_string=!0;else if("comma"===r)n.thousands=!0;else if("number"===r)n.mantissa=e.value;else if("var"===r)n.mantissa=e.real_value;else if("plus"===r)n.sign=!0;else if("round"===r)n.round=e.value;else if("fraction"===r)n.fraction=!0;else if("scientific"===r)n.scientific=!0;else{if("percent"!==r)throw new Error("错误的fmt Token");n.percent=!0}})),n.to_number)return[+parse_mantissa(t,n.mantissa_type,n.mantissa,n.round),n];if(n.scientific){var i=BigNumber(t).toExponential();return[n.sign&&!i.startsWith("-")?"+"+i:i,n]}if(n.fraction){var o=BigNumber(t).toFraction().map((function(e){return e.toFixed()})).join("/");return[n.sign&&!o.startsWith("-")?"+"+o:o,n]}return n.percent&&(t=BigNumber(t).times(100).toFixed()),null===n.mantissa?t.includes(".")&&(t=t.replace(/0*$/,"")):t=parse_mantissa(t,n.mantissa_type,n.mantissa,n.round),n.thousands&&(t=parse_thousands(t)),n.sign&&(n.to_number=!1,t.startsWith("-")||(t="+"+t)),n.percent&&(t+="%"),[t,n]}function close_important_push(){}function open_important_push(){}function open_debug(){}function close_debug(){}function calc_wrap(e,r){var t={_error:"-"};return["string","number"].includes(_typeof(e))?void 0===r?/[a-zA-Z$_]/.test(e.toString())?function(r){return Array.isArray(r)?r.unshift(t):r=_objectSpread2(_objectSpread2({},t),r),calc(e,r)}:calc(e):(Array.isArray(r)?r.unshift(t):r=_objectSpread2(_objectSpread2({},t),r),calc(e,r)):(Array.isArray(e)?e.unshift(t):e=_objectSpread2(_objectSpread2({},t),e),function(r){return calc(r,e)})}function check_version(){return _check_version.apply(this,arguments)}function _check_version(){return _check_version=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var res,code,versions,last_version,larr,varr,script,url;return _regeneratorRuntime().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:if("undefined"==typeof process||"node"!==process.release.name){_context.next=19;break}if(!(parseInt(process.versions.node)>=17)){_context.next=17;break}return _context.next=4,promise_queue([fetch("https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js"),fetch("https://unpkg.com/a-calc@latest/a-calc.versions.js")]);case 4:return res=_context.sent,_context.next=7,res.text();case 7:code=_context.sent,versions=eval(code),last_version=versions.at(-1),larr=last_version.match(/(\d+)\.(\d+)\.(\d+)/),larr.shift(),larr=larr.map((function(e){return parseInt(e)})),varr=version.match(/(\d+)\.(\d+)\.(\d+)/),varr.shift(),varr=varr.map((function(e){return parseInt(e)})),(larr[0]>varr[0]||larr[0]===varr[0]&&larr[1]>varr[1]||larr[0]===varr[0]&&larr[1]===varr[1]&&larr[2]>varr[2])&&console.warn("a-calc has a new version:",last_version);case 17:_context.next=25;break;case 19:return script=document.createElement("script"),script.onload=function(){var e=a_calc_versions;if(Array.isArray(e)){var r=e.at(-1),t=r.match(/(\d+)\.(\d+)\.(\d+)/);t.shift(),t=t.map((function(e){return parseInt(e)}));var n=version.match(/(\d+)\.(\d+)\.(\d+)/);n.shift(),n=n.map((function(e){return parseInt(e)})),(t[0]>n[0]||t[0]===n[0]&&t[1]>n[1]||t[0]===n[0]&&t[1]===n[1]&&t[2]>n[2])&&console.log("%c↑↑↑ a-calc has a new version: %s ↑↑↑","color: #67C23A;",r)}},_context.next=23,test_urls(["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"]);case 23:url=_context.sent,url?(script.src=url,document.body.appendChild(script)):script=null;case 25:case"end":return _context.stop()}}),_callee)}))),_check_version.apply(this,arguments)}var operator=new Set(["+","-","*","/","%","**","//"]);function push_token$2(e,r,t){if(Number.isNaN(Number(r)))if("-"===r||"+"===r)0===e.length||"operator"===e.at(-1).type||"("===e.at(-1).value?e.push({type:"number",value:r,real_value:r,has_unit:!1}):e.push({type:"operator",value:r});else if(operator.has(r))e.push({type:"operator",value:r});else if(t._unit&&/^[+-]?\d/.test(r)){var n,i=split_unit_num(r),o=i.num,a=i.unit;if(void 0===a)e.push({type:"number",value:o,real_value:o,has_unit:!1});else t.has_unit=!0,null!==(n=t.unit_str)&&void 0!==n||(t.unit_str=a),e.push({type:"number",value:o,real_value:o,has_unit:!0,unit:a})}else if(var_first_char.includes(r[0])){t.has_var=!0;var u=get_real_value(t.fill_data,r);if(t._unit){var s,c=split_unit_num(u),l=c.num,f=c.unit;if(void 0===f)e.push({type:"var",value:r,real_value:l,has_unit:!1});else t.has_unit=!0,null!==(s=t.unit_str)&&void 0!==s||(t.unit_str=f),e.push({type:"var",value:r,real_value:l,has_unit:!0,unit:f})}else e.push({type:"var",value:r,real_value:u,has_unit:!1})}else{if(!/^[+-]?\d/.test(r))throw new Error("无法识别的标识符:".concat(r));var p=r.indexOf("e");-1!==p&&/^\d+$/.test(r.slice(p+1))&&e.push({type:"number",value:r,real_value:r,has_unit:!1})}else e.push({type:"number",value:r,real_value:r,has_unit:!1})}function tokenizer_space(e,r,t){for(var n,i=0,o=0,a=e.length,u=[],s={has_var:!1,has_unit:!1,unit_str:void 0,_unit:t,fill_data:r};o<a;)" "===(n=e[o])?(o>i&&push_token$2(u,e.slice(i,o),s),i=o+1):"("===n?(u.push({type:state_bracket,value:"("}),i=o+1):")"===n&&(o>i&&push_token$2(u,e.slice(i,o),s),u.push({type:state_bracket,value:")"}),i=o+1),o++;return o>i&&push_token$2(u,e.slice(i,o),s),u.has_var=s.has_var,u.has_unit=s.has_unit,u.unit=s.unit_str,u}function compute(e,r,t){if(void 0===e||void 0===r)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(r));switch(t){case"+":return new BigNumber(e).plus(r);case"-":return new BigNumber(e).minus(r);case"*":return new BigNumber(e).times(r);case"/":return new BigNumber(e).div(r);case"%":return new BigNumber(e).mod(r);case"**":return new BigNumber(e).pow(r);case"//":return new BigNumber(e).idiv(r)}}var operator_map$1={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens(e){if(1===e.length){var r=e[0];if("number"===r.type||"var"===r.type)return r.real_value;throw new Error("错误的表达式:".concat(r.value))}for(var t,n,i=[],o=[],a=0,u=e.length;a<u;a++)if("number"!==(t=e[a]).type&&"var"!==t.type)if("operator"!==t.type)if("("!==t.value){if(")"===t.value)for(var s=void 0;s=i.pop();){if("("===s){var c=o.at(-2);if("-"===c){var l=o.pop();o.pop(),o.push(BigNumber.isBigNumber(l)?l.negated():new BigNumber(l).negated())}else if("+"===c){var f=o.pop();o.pop(),o.push(f)}break}var p=o.pop(),h=o.pop();o.push(compute(h,p,s))}}else i.push("(");else{var _=i.at(-1);if("("===_){i.push(t.value);continue}var v=operator_map$1[t.value];if(!i.length){i.push(t.value);continue}if(v<operator_map$1[_])for(var m=void 0;m=i.pop();){if("("===m){i.push("(");break}var d=o.pop(),g=o.pop();o.push(compute(g,d,m))}else if(v===operator_map$1[_]){if("**"===t.value){i.push(t.value);continue}for(var b=void 0;b=i.pop();){if("("===b){i.push("(");break}if(operator_map$1[b]<v){i.push(b);break}var y=o.pop(),w=o.pop();o.push(compute(w,y,b))}}i.push(t.value)}else o.push(t.real_value);for(;n=i.pop();){var S=o.pop(),x=o.pop();o.push(compute(x,S,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return e.has_var||(e.calc_result=o[0]),o[0]}function push_token$1(e,r,t,n,i){r===state_var?(i.has_var=!0,e.push({type:r,value:t,real_value:get_real_value(i.fill_data,t)})):e.push({type:r,value:t}),n.prev=n.curr,i.state=state_initial}function fmt_tokenizer(e,r){for(var t,n={prev:0,curr:0},i=e.length,o={state:state_initial,fill_data:r,has_var:!1},a=[];n.curr<i;)switch(t=e[n.curr],o.state){case state_initial:if(" "===t)n.curr++,n.prev=n.curr;else if("<>=".includes(t))o.state=state_symbol,n.curr++;else if(","===t)n.curr++,push_token$1(a,state_comma,",",n,o);else if(var_char.includes(t))o.state=state_var,n.curr++;else if(number_char.includes(t))o.state=state_number,n.curr++;else if("+"===t)n.curr++,push_token$1(a,state_plus$1,"+",n,o);else if("~"===t)n.curr++,o.state=state_round;else if("%"===t)n.curr++,push_token$1(a,state_percent,"%",n,o);else if("/"===t)n.curr++,push_token$1(a,state_fraction,"/",n,o);else if("!"===t)if(o.state=state_initial,n.curr++,"n"===e[n.curr])n.curr++,push_token$1(a,state_to_number,"!n",n,o);else if("u"===e[n.curr])n.curr++,push_token$1(a,state_to_number_string,"!u",n,o);else{if("e"!==e[n.curr])throw new Error("无法识别的!模式字符:".concat(e[n.curr]));n.curr++,push_token$1(a,state_scientific,"!e",n,o)}else n.curr++,n.prev=n.curr;break;case state_symbol:"="===t&&n.curr++,push_token$1(a,state_symbol,e.slice(n.prev,n.curr),n,o);break;case state_number:number_char.includes(t)?n.curr++:push_token$1(a,state_number,e.slice(n.prev,n.curr),n,o);break;case state_var:var_members_char.includes(t)?n.curr++:push_token$1(a,state_var,e.slice(n.prev,n.curr),n,o);break;case state_round:if(!("56+-".includes(t)&&n.curr-n.prev<2))throw new Error("错误的舍入语法:".concat(e.slice(n.prev,n.curr+1)));n.curr++,push_token$1(a,state_round,e.slice(n.prev,n.curr),n,o);break;default:throw new Error("错误的fmt分词器状态")}return n.prev<n.curr&&push_token$1(a,o.state,e.slice(n.prev,n.curr),n,o),a.has_var=o.has_var,a}var symbol_set=new Set(["<",">","=",">=","<="]),rand_set=new Set(["~+","~-","~5","~6"]);function push_token(e,r,t){if(","===r)e.push({type:state_comma,value:","});else if(symbol_set.has(r))e.push({type:state_symbol,value:r});else if(Number.isNaN(Number(r)))if(var_first_char.includes(r[0]))t.has_var=!0,e.push({type:state_var,value:r,real_value:get_real_value(t.fill_data,r)});else if("%"===r)e.push({type:state_percent,value:r});else if("/"===r)e.push({type:state_fraction,value:r});else if("+"===r)e.push({type:state_plus,value:r});else if(rand_set.has(r))e.push({type:state_round,value:r});else if("!n"===r)e.push({type:state_to_number,value:r});else if("!u"===r)e.push({type:state_to_number_string,value:r});else{if("!e"!==r)throw new Error("无法识别的格式化字符: ".concat(r));e.push({type:state_scientific,value:r})}else e.push({type:state_number,value:r})}function fmt_tokenizer_space(e,r){for(var t,n=0,i=e.length,o={fill_data:r,has_var:!1},a=0,u=[];n<i;)" "===(t=e[n])?(n>a&&push_token(u,e.slice(a,n),o),a=n+1):"<>=".includes(t)&&("="===e[n+1]?(u.push({type:state_symbol,value:t+"="}),a=1+ ++n):(u.push({type:state_symbol,value:t}),a=n+1)),n++;return a<n&&push_token(u,e.slice(a,n),o),u.has_var=o.has_var,u}function compute_lite(e,r,t){switch(t){case"+":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).plus(r);case"-":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).minus(r);case"*":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).times(r);case"/":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).div(r);case"%":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).mod(r);case"**":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).pow(r);case"//":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).idiv(r)}}var operator_map={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens_lite(e,r){for(var t,n,i=[],o=[],a=0,u=e.length;a<u;a++){var s=(t=e[a])[0];if(var_first_char.includes(s))o.push(get_real_value(r,t));else if(operator_set.has(t)){var c=i.at(-1);if("("===c){i.push(t);continue}var l=operator_map[t];if(!i.length){i.push(t);continue}var f=operator_map[c];if(l<f)for(var p=i.at(-1);p&&"("!==p;){i.pop();var h=o.pop(),_=o.pop();o.push(compute_lite(_,h,p)),p=i.at(-1)}else if(l===f){if("**"===t){i.push(t);continue}for(var v=i.at(-1);v&&!(operator_map[v]<l||"("===v);){i.pop();var m=o.pop(),d=o.pop();o.push(compute_lite(d,m,v)),v=i.at(-1)}}i.push(t)}else if(number_first_char.includes(s))o.push(t);else if("("!==t){if(")"===t)for(var g=void 0;(g=i.pop())&&"("!==g;){var b=o.pop(),y=o.pop();o.push(compute_lite(y,b,g))}}else i.push("(")}for(;n=i.pop();){var w=o.pop(),S=o.pop();o.push(compute_lite(S,w,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return o[0]}function calc_lite(e,r,t){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"-";try{var i;if("number"==typeof e)i=e.toString();else{if(""===e)throw new Error("非法的空计算式");var o=e.split(" ");if(1===o.length){if(i=o[0],var_first_char.includes(i[0])&&(i=get_real_value(t,i)),isNaN(Number(i)))throw new Error("错误的计算式:".concat(e))}else i=eval_tokens_lite(o,t).toFixed()}if("string"==typeof r&&""!==r){var a=fmt_tokenizer(r,t);if(void 0!==a)i=_slicedToArray(format(i,a),1)[0]}if("NaN"===i||"Infinity"===i)throw new Error("计算环节出错");return i}catch(e){return n}}function calc_mini(e,r,t){switch(r){case"+":return BigNumber(e).plus(t).toFixed();case"-":return BigNumber(e).minus(t).toFixed();case"*":return BigNumber(e).times(t).toFixed();case"/":return BigNumber(e).div(t).toFixed();case"%":return BigNumber(e).mod(t).toFixed();case"**":return BigNumber(e).pow(t).toFixed();case"//":return BigNumber(e).idiv(t).toFixed()}}function calc(e,r){var t=find_value(r,"_error");try{var n,i,o,a,u,s=parse_args(e,r),c=s._unit,l=s._mode,f="space"===l||"space-all"===l?tokenizer_space(s.expr,s.fill_data,c):tokenizer(s.expr,s.fill_data,c),p=eval_tokens(f),h=BigNumber.isBigNumber(p)?p:new BigNumber(p);if("space-all"===l?(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer_space(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer_space(s._fmt,s.fill_data)):(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer(s._fmt,s.fill_data)),void 0===a?void 0!==u&&(a=u):void 0!==u&&(a=[].concat(_toConsumableArray(u),_toConsumableArray(a))),void 0===a)h=h.toFixed();else{var _=_slicedToArray(format(h,a),2);h=_[0],o=_[1]}if("Infinity"===h||"NaN"===h||void 0===h)throw new Error("计算错误可能是非法的计算式");return!f.has_unit||null!==(n=o)&&void 0!==n&&n.to_number||null!==(i=o)&&void 0!==i&&i.to_number_string||(h+=f.unit),h}catch(e){if(void 0===t)throw e;return t}}function check_update(){check_version().catch((function(){}))}function print_version(){console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")}var calc_util={check_update:check_update,print_version:print_version,open_debug:open_debug,close_debug:close_debug,close_important_push:close_important_push,open_important_push:open_important_push},fmt=calc;function plus(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).plus(r).toNumber():new BigNumber(e).plus(r).toFixed()}function sub(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).minus(r).toNumber():new BigNumber(e).minus(r).toFixed()}function mul(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).times(r).toNumber():new BigNumber(e).times(r).toFixed()}function div(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).div(r).toNumber():new BigNumber(e).div(r).toFixed()}function mod(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).mod(r).toNumber():new BigNumber(e).mod(r).toFixed()}function pow(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).pow(r).toNumber():new BigNumber(e).pow(r).toFixed()}function idiv(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).idiv(r).toNumber():new BigNumber(e).idiv(r).toFixed()}return exports.calc=calc,exports.calc_lite=calc_lite,exports.calc_mini=calc_mini,exports.calc_util=calc_util,exports.calc_wrap=calc_wrap,exports.div=div,exports.fmt=fmt,exports.idiv=idiv,exports.mod=mod,exports.mul=mul,exports.parse_thousands=parse_thousands,exports.plus=plus,exports.pow=pow,exports.sub=sub,exports.version=version,exports}({});
|
|
1
|
+
var a_calc=function(exports){"use strict";function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,i,o,a,u=[],s=!0,c=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;s=!1}else for(;!(s=(n=o.call(t)).done)&&(u.push(n.value),u.length!==r);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw i}}return u}}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,n=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{s({},"")}catch(e){s=function(e,r,t){return e[r]=t}}function c(e,r,t,i){var o=r&&r.prototype instanceof p?r:p,a=Object.create(o.prototype),u=new A(i||[]);return n(a,"_invoke",{value:w(e,t,u)}),a}function l(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function p(){}function h(){}function _(){}var v={};s(v,o,(function(){return this}));var m=Object.getPrototypeOf,d=m&&m(m(N([])));d&&d!==r&&t.call(d,o)&&(v=d);var g=_.prototype=p.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(r){s(e,r,(function(e){return this._invoke(r,e)}))}))}function y(e,r){function i(n,o,a,u){var s=l(e[n],e,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==typeof f&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,a,u)}),(function(e){i("throw",e,a,u)})):r.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,u)}))}u(s.arg)}var o;n(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return o=o?o.then(n,n):n()}})}function w(e,r,t){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(t.method=i,t.arg=o;;){var a=t.delegate;if(a){var u=S(a,t);if(u){if(u===f)continue;return u}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var s=l(e,r,t);if("normal"===s.type){if(n=t.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(n="completed",t.method="throw",t.arg=s.arg)}}}function S(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,S(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),f;var i=l(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,f;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function x(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function E(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function N(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=_,n(g,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:h,configurable:!0}),h.displayName=s(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===h||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,s(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(y.prototype),s(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(r,t,n,i,o){void 0===o&&(o=Promise);var a=new y(c(r,t,n,i),o);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),s(g,u,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=N,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=t.call(o,"catchLoc"),s=t.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&t.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=r,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),f},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),E(t),f}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var i=n.arg;E(t)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:N(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),f}},e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function asyncGeneratorStep(e,r,t,n,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,i)}function _asyncToGenerator(e){return function(){var r=this,t=arguments;return new Promise((function(n,i){var o=e.apply(r,t);function a(e){asyncGeneratorStep(o,n,i,a,u,"next",e)}function u(e){asyncGeneratorStep(o,n,i,a,u,"throw",e)}a(void 0)}))}}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toPrimitive(e,r){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"==typeof r?r:String(r)}var version="2.2.12";function decimal_round(e,r,t,n,i){var o=e,a=r,u=r.length,s={"~-":function(){var e="<"===t?n-1:n;a=r.slice(0,e)},"~+":function(){var e="<"===t?n-1:n;if(!(u<=e||0===u)){var i=r.slice(0,e);0==+r.slice(e,u)?a=i:(i=(+"9".concat(i)+1).toString().slice(1)).length>e?(a=i.slice(1,i.length),o=(+o+1).toString()):a=i}},"~5":function(){if(0!==u){var e="<"===t?n-1:n;a=r.slice(0,e);var i=+r[e];Number.isNaN(i)||i>=5&&(a=(+"9".concat(a)+1).toString().slice(1)).length>e&&(a=a.slice(1,a.length),o=(+o+1).toString())}},"~6":function(){if(0!==u){var i,s="<"===t?n-1:n,c=+r[s],l=r.slice(+s+1,r.length);l=""===l?0:parseInt(l),i=0===s?+e[e.length-1]:+r[s-1],a=r.slice(0,s),(c>=6||5===c&&l>0||5===c&&i%2!=0)&&(a=(+"9".concat(a)+1).toString().slice(1)).length>s&&(a=a.slice(1,a.length),o=(+o+1).toString())}}};return"<="===t?u<=n?a=r.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"<"===t?u<n?a=r.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"="===t?u<n?a=r+"0".repeat(n-u):u>n&&s[i]&&s[i]():">="===t?u<n&&(a=r+"0".repeat(n-u)):">"===t&&u<=n&&(a=r+"0".repeat(n-u+1)),{int_part:o,dec_part:a}}var number_char="0123456789",var_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",number_first_char="0123456789-+",var_members_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$[].'\"",var_first_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",pure_number_var_first_char="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",empty_char=" \n\r\t",state_initial="initial",state_number="number",state_scientific="scientific",state_operator="operator",state_bracket="bracket",state_var="var",state_symbol="symbol",state_percent="percent",state_round="round",state_plus$1="plus",state_comma="comma",state_fraction="fraction",state_to_number="to-number",state_to_number_string="to-number-string",operator_set=new Set(["+","-","*","/","%","**","//"]),isArray=Array.isArray,isArray$1=isArray,freeGlobal="object"==("undefined"==typeof global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,freeGlobal$1=freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root=freeGlobal$1||freeSelf||Function("return this")(),root$1=root,_Symbol=root$1.Symbol,_Symbol$1=_Symbol,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol$1?_Symbol$1.toStringTag:void 0;function getRawTag(e){var r=hasOwnProperty$3.call(e,symToStringTag$1),t=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(r?e[symToStringTag$1]=t:delete e[symToStringTag$1]),i}var objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$1?_Symbol$1.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return null!=e&&"object"==_typeof(e)}var symbolTag="[object Symbol]";function isSymbol(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag(e)==symbolTag}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,r){if(isArray$1(e))return!1;var t=_typeof(e);return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=r&&e in Object(r))}function isObject(e){var r=_typeof(e);return null!=e&&("object"==r||"function"==r)}var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var r=baseGetTag(e);return r==funcTag||r==genTag||r==asyncTag||r==proxyTag}var coreJsData=root$1["__core-js_shared__"],coreJsData$1=coreJsData,maskSrcKey=(uid=/[^.]+$/.exec(coreJsData$1&&coreJsData$1.keys&&coreJsData$1.keys.IE_PROTO||""),uid?"Symbol(src)_1."+uid:""),uid;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,r){return null==e?void 0:e[r]}function getNative(e,r){var t=getValue(e,r);return baseIsNative(t)?t:void 0}var nativeCreate=getNative(Object,"create"),nativeCreate$1=nativeCreate;function hashClear(){this.__data__=nativeCreate$1?nativeCreate$1(null):{},this.size=0}function hashDelete(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet(e){var r=this.__data__;if(nativeCreate$1){var t=r[e];return t===HASH_UNDEFINED$1?void 0:t}return hasOwnProperty$1.call(r,e)?r[e]:void 0}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas(e){var r=this.__data__;return nativeCreate$1?void 0!==r[e]:hasOwnProperty.call(r,e)}var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=nativeCreate$1&&void 0===r?HASH_UNDEFINED:r,this}function Hash(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,r){return e===r||e!=e&&r!=r}function assocIndexOf(e,r){for(var t=e.length;t--;)if(eq(e[t][0],r))return t;return-1}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var r=this.__data__,t=assocIndexOf(r,e);return!(t<0)&&(t==r.length-1?r.pop():splice.call(r,t,1),--this.size,!0)}function listCacheGet(e){var r=this.__data__,t=assocIndexOf(r,e);return t<0?void 0:r[t][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,r){var t=this.__data__,n=assocIndexOf(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this}function ListCache(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map=getNative(root$1,"Map"),Map$1=Map;function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(e){var r=_typeof(e);return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e}function getMapData(e,r){var t=e.__data__;return isKeyable(r)?t["string"==typeof r?"string":"hash"]:t.map}function mapCacheDelete(e){var r=getMapData(this,e).delete(e);return this.size-=r?1:0,r}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,r){var t=getMapData(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this}function MapCache(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT="Expected a function";function memoize(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new TypeError(FUNC_ERROR_TEXT);var t=function t(){var n=arguments,i=r?r.apply(this,n):n[0],o=t.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return t.cache=o.set(i,a)||o,a};return t.cache=new(memoize.Cache||MapCache),t}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var r=memoize(e,(function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e})),t=r.cache;return r}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(rePropName,(function(e,t,n,i){r.push(n?i.replace(reEscapeChar,"$1"):t||e)})),r})),stringToPath$1=stringToPath;function arrayMap(e,r){for(var t=-1,n=null==e?0:e.length,i=Array(n);++t<n;)i[t]=r(e[t],t,e);return i}var INFINITY$1=1/0,symbolProto=_Symbol$1?_Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray$1(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var r=e+"";return"0"==r&&1/e==-INFINITY$1?"-0":r}function toString(e){return null==e?"":baseToString(e)}function castPath(e,r){return isArray$1(e)?e:isKey(e,r)?[e]:stringToPath$1(toString(e))}var INFINITY=1/0;function toKey(e){if("string"==typeof e||isSymbol(e))return e;var r=e+"";return"0"==r&&1/e==-INFINITY?"-0":r}function baseGet(e,r){for(var t=0,n=(r=castPath(r,e)).length;null!=e&&t<n;)e=e[toKey(r[t++])];return t&&t==n?e:void 0}function get(e,r,t){var n=null==e?void 0:baseGet(e,r);return void 0===n?t:n}function split_unit_num(e){for(var r,t,n,i=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],o=0;o<i.length;o++){var a=e.match(i[o]);if(a){n=a;break}}if(n){t=n[1];var u=n[2];""!==u.trim()&&(r=u)}return{num:t,unit:r}}function find_value(e,r,t){var n,i,o,a;return Array.isArray(e)?e.length>1?null!==(n=null!==(i=get(e[0],r))&&void 0!==i?i:get(e.at(-1),r))&&void 0!==n?n:t:1===e.length&&null!==(o=get(e[0],r))&&void 0!==o?o:t:null!==(a=get(e,r,t))&&void 0!==a?a:t}function parse_mantissa(e,r,t,n){var i=e.split("."),o=i[0],a=1===i.length?"":i[1],u=decimal_round(o,a,r,+t,n);return o=u.int_part,""===(a=u.dec_part)?o:"".concat(o,".").concat(a)}function integer_thousands(e){for(var r=e.length,t="";r>0;)t=e.substring(r-3,r)+(""!==t?",":"")+t,r-=3;return t}function parse_thousands(e){var r=e.split("."),t=r[0];return"-"===t[0]?r[0]="-"+integer_thousands(t.slice(1)):r[0]=integer_thousands(t),r.join(".")}function promise_queue(e){return _promise_queue.apply(this,arguments)}function _promise_queue(){return _promise_queue=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n,i,o=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=o.length>1&&void 0!==o[1]?o[1]:5e3,n=0;case 2:if(!(n<r.length)){e.next=16;break}return e.prev=3,e.next=6,Promise.race([r[n],new Promise((function(e,r){setTimeout((function(){return r(new Error("promise queue timeout err"))}),t)}))]);case 6:i=e.sent,e.next=12;break;case 9:return e.prev=9,e.t0=e.catch(3),e.abrupt("continue",13);case 12:return e.abrupt("return",i);case 13:n++,e.next=2;break;case 16:return e.abrupt("return",Promise.reject("错误的 promise queue 调用"));case 17:case"end":return e.stop()}}),e,null,[[3,9]])}))),_promise_queue.apply(this,arguments)}function test_urls(e){return _test_urls.apply(this,arguments)}function _test_urls(){return(_test_urls=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<r.length)){e.next=16;break}return e.prev=2,e.next=5,fetch(r[t]);case 5:if(!e.sent.ok){e.next=8;break}return e.abrupt("return",r[t]);case 8:e.next=13;break;case 10:return e.prev=10,e.t0=e.catch(2),e.abrupt("continue",13);case 13:t++,e.next=1;break;case 16:return e.abrupt("return",null);case 17:case"end":return e.stop()}}),e,null,[[2,10]])})))).apply(this,arguments)}function get_real_value(e,r){if(Array.isArray(e)){for(var t,n=0,i=e.length;n<i;n++){var o;if(void 0!==(t=null!==(o=get(e[n],r))&&void 0!==o?o:void 0))break}if(void 0===t)throw new Error("填充变量".concat(value,"失败"));return t}var a;return null!==(a=get(e,r))&&void 0!==a?a:void 0}function get_next_nonempty_char(e,r,t){var n;for(r++;r<t;){if(n=e[r],-1===empty_char.indexOf(n))return n;r++}}function parse_args(e,r){var t="",n={origin_expr:e,origin_fill_data:r,expr:"",fmt_expr:"",options:void 0,fill_data:void 0,_unit:void 0,_mode:void 0,_fmt:void 0};if(null!=r&&(n.options=r,Array.isArray(r)?n.fill_data=r:Array.isArray(r._fill_data)?n.fill_data=[r].concat(_toConsumableArray(r._fill_data)):void 0===r._fill_data?n.fill_data=[r]:n.fill_data=[r,r._fill_data]),n._mode=find_value(r,"_mode","normal"),n._unit=find_value(r,"_unit",!1),n._fmt=find_value(r,"_fmt"),"string"==typeof e){if(t=e,""===e.trim()||e.includes("NaN"))throw new Error("非法的表达式:".concat(e))}else{if("number"!=typeof e)throw new Error("错误的第一个参数类型: ".concat(e," 类型为:").concat(_typeof(e)));if(isNaN(e))throw new Error("传入了一个非法数字NaN");t=e.toString()}var i=t.split("|");return n.expr=i[0],i.length>1&&(n.fmt_expr=i[1].trim()),n}function push_token$3(e,r){if(r.curr_state===state_number||r.curr_state===state_scientific){var t=r.expr.slice(r.prev_index,r.cur_index);if(r._unit){var n,i=split_unit_num(t),o=i.num,a=i.unit;if(void 0===a)e.push({type:state_number,value:o,real_value:o,has_unit:!1});else r.has_unit=!0,null!==(n=r.unit_str)&&void 0!==n||(r.unit_str=a),e.push({type:state_number,value:o,real_value:o,has_unit:!0,unit:a})}else e.push({type:state_number,value:t,real_value:t,has_unit:!1})}else if(r.curr_state===state_var){r.has_var=!0;var u=r.expr.slice(r.prev_index,r.cur_index),s=get_real_value(r.fill_data,u);if(r._unit){var c,l=split_unit_num(s),f=l.num,p=l.unit;if(void 0===p)e.push({type:"var",value:u,real_value:f,has_unit:!1});else r.has_unit=!0,null!==(c=r.unit_str)&&void 0!==c||(r.unit_str=p),e.push({type:"var",value:u,real_value:f,has_unit:!0,unit:p})}else e.push({type:"var",value:u,real_value:s,has_unit:!1})}else e.push({type:r.curr_state,value:r.expr.slice(r.prev_index,r.cur_index)});r.curr_state=state_initial,r.prev_index=r.cur_index}function tokenizer(e,r,t){for(var n,i={has_var:!1,has_unit:!1,unit_str:void 0,fill_data:r,cur_index:0,prev_index:0,curr_state:state_initial,expr:e,_unit:t},o=e.length,a=[];i.cur_index<o;)switch(n=e[i.cur_index],i.curr_state){case state_initial:if(number_char.includes(n))i.curr_state=state_number,i.cur_index++;else if(" "===n)i.cur_index++,i.prev_index=i.cur_index;else if("+-".includes(n)){var u=a.at(-1);0===i.cur_index||"operator"===(null==u?void 0:u.type)||"("===(null==u?void 0:u.value)?(i.curr_state=state_number,i.cur_index++):(i.cur_index++,a.push({type:state_operator,value:e.slice(i.prev_index,i.cur_index)}),i.prev_index=i.cur_index)}else"*/%".includes(n)?(i.curr_state=state_operator,i.cur_index++):var_char.includes(n)?(i.curr_state=state_var,i.cur_index++):"()".includes(n)?(a.push({type:state_bracket,value:n}),i.curr_state=state_initial,i.cur_index++,i.prev_index=i.cur_index):(i.cur_index++,i.prev_index=i.cur_index);break;case state_number:if(number_char.includes(n))i.cur_index++;else if("."===n){if(i.cur_index===i.prev_index||e.slice(i.prev_index,i.cur_index).includes("."))throw new Error("非法的小数部分".concat(e.slice(i.prev_index,i.cur_index)));i.cur_index++}else"e"===n?(i.curr_state=state_scientific,i.cur_index++):t?"*/+-() ".indexOf(n)>-1||"%"===n&&number_char.includes(e[i.cur_index-1])&&pure_number_var_first_char.includes(get_next_nonempty_char(e,i.cur_index,o))?push_token$3(a,i):i.cur_index++:push_token$3(a,i);break;case state_operator:var s=e[i.cur_index-1];"*"===n&&"*"===s?(i.cur_index++,a.push({type:state_operator,value:"**"}),i.prev_index=i.cur_index):"/"===n&&"/"===s?(i.cur_index++,a.push({type:state_operator,value:"//"}),i.prev_index=i.cur_index):(a.push({type:state_operator,value:s}),i.prev_index=i.cur_index),i.curr_state=state_initial;break;case state_var:var_members_char.includes(n)?i.cur_index++:push_token$3(a,i);break;case state_scientific:if(number_char.includes(n))i.cur_index++;else if("+-".includes(n)){var c=i.prev_index;"+-".includes(e[c])&&(c+=1);var l=e.slice(c,i.cur_index),f=l.at(-1);l.includes(n)||"e"!==f?push_token$3(a,i):i.cur_index++}else t&&-1==="*/+-() ".indexOf(n)?i.cur_index++:push_token$3(a,i);break;default:throw new Error("字符扫描状态错误")}return i.prev_index<i.cur_index&&push_token$3(a,i),a.has_var=i.has_var,a.has_unit=i.has_unit,a.unit=i.unit_str,a}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var r,t,n,i,o,a,u,s,c,l,f=A.prototype={constructor:A,toString:null,valueOf:null},p=new A(1),h=20,_=4,v=-7,m=21,d=-1e7,g=1e7,b=!1,y=1,w=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",E=!0;function A(e,r){var i,o,a,u,s,c,l,f,p=this;if(!(p instanceof A))return new A(e,r);if(null==r){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>g?p.c=p.e=null:e.e<d?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((c="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,s=e;s>=10;s/=10,u++);return void(u>g?p.c=p.e=null:(p.e=u,p.c=[e]))}f=String(e)}else{if(!isNumeric.test(f=String(e)))return n(p,f,c);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(s=f.search(/e/i))>0?(u<0&&(u=s),u+=+f.slice(s+1),f=f.substring(0,s)):u<0&&(u=f.length)}else{if(intCheck(r,2,x.length,"Base"),10==r&&E)return B(p=new A(e),h+p.e+1,_);if(f=String(e),c="number"==typeof e){if(0*e!=0)return n(p,f,c,r);if(p.s=1/e<0?(f=f.slice(1),-1):1,A.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(i=x.slice(0,r),u=s=0,l=f.length;s<l;s++)if(i.indexOf(o=f.charAt(s))<0){if("."==o){if(s>u){u=l;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,s=-1,u=0;continue}return n(p,String(e),c,r)}c=!1,(u=(f=t(f,r,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(s=0;48===f.charCodeAt(s);s++);for(l=f.length;48===f.charCodeAt(--l););if(f=f.slice(s,++l)){if(l-=s,c&&A.DEBUG&&l>15&&(e>MAX_SAFE_INTEGER||e!==mathfloor(e)))throw Error(tooManyDigits+p.s*e);if((u=u-s-1)>g)p.c=p.e=null;else if(u<d)p.c=[p.e=0];else{if(p.e=u,p.c=[],s=(u+1)%LOG_BASE,u<0&&(s+=LOG_BASE),s<l){for(s&&p.c.push(+f.slice(0,s)),l-=LOG_BASE;s<l;)p.c.push(+f.slice(s,s+=LOG_BASE));s=LOG_BASE-(f=f.slice(s)).length}else s-=l;for(;s--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function N(e,r,t,n){var i,o,a,u,s;if(null==t?t=_:intCheck(t,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==r)s=coeffToString(e.c),s=1==n||2==n&&(a<=v||a>=m)?toExponential(s,a):toFixedPoint(s,a,"0");else if(o=(e=B(new A(e),r,t)).e,u=(s=coeffToString(e.c)).length,1==n||2==n&&(r<=o||o<=v)){for(;u<r;s+="0",u++);s=toExponential(s,o)}else if(r-=a,s=toFixedPoint(s,o,"0"),o+1>u){if(--r>0)for(s+=".";r--;s+="0");}else if((r+=o-u)>0)for(o+1==u&&(s+=".");r--;s+="0");return e.s<0&&i?"-"+s:s}function O(e,r){for(var t,n=1,i=new A(e[0]);n<e.length;n++){if(!(t=new A(e[n])).s){i=t;break}r.call(i,t)&&(i=t)}return i}function k(e,r,t){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,n++);return(t=n+t*LOG_BASE-1)>g?e.c=e.e=null:t<d?e.c=[e.e=0]:(e.e=t,e.c=r),e}function B(e,r,t,n){var i,o,a,u,s,c,l,f=e.c,p=POWS_TEN;if(f){e:{for(i=1,u=f[0];u>=10;u/=10,i++);if((o=r-i)<0)o+=LOG_BASE,a=r,l=(s=f[c=0])/p[i-a-1]%10|0;else if((c=mathceil((o+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));s=l=0,i=1,a=(o%=LOG_BASE)-LOG_BASE+1}else{for(s=u=f[c],i=1;u>=10;u/=10,i++);l=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:s/p[i-a-1]%10|0}if(n=n||r<0||null!=f[c+1]||(a<0?s:s%p[i-a-1]),n=t<4?(l||n)&&(0==t||t==(e.s<0?3:2)):l>5||5==l&&(4==t||n||6==t&&(o>0?a>0?s/p[i-a]:0:f[c-1])%10&1||t==(e.s<0?8:7)),r<1||!f[0])return f.length=0,n?(r-=e.e+1,f[0]=p[(LOG_BASE-r%LOG_BASE)%LOG_BASE],e.e=-r||0):f[0]=e.e=0,e;if(0==o?(f.length=c,u=1,c--):(f.length=c+1,u=p[LOG_BASE-o],f[c]=a>0?mathfloor(s/p[i-a]%p[a])*u:0),n)for(;;){if(0==c){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);o!=u&&(e.e++,f[0]==BASE&&(f[0]=1));break}if(f[c]+=u,f[c]!=BASE)break;f[c--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>g?e.c=e.e=null:e.e<d&&(e.c=[e.e=0])}return e}function T(e){var r,t=e.e;return null===t?e.toString():(r=coeffToString(e.c),r=t<=v||t>=m?toExponential(r,t):toFixedPoint(r,t,"0"),e.s<0?"-"+r:r)}return A.clone=clone,A.ROUND_UP=0,A.ROUND_DOWN=1,A.ROUND_CEIL=2,A.ROUND_FLOOR=3,A.ROUND_HALF_UP=4,A.ROUND_HALF_DOWN=5,A.ROUND_HALF_EVEN=6,A.ROUND_HALF_CEIL=7,A.ROUND_HALF_FLOOR=8,A.EUCLID=9,A.config=A.set=function(e){var r,t;if(null!=e){if("object"!=_typeof(e))throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(intCheck(t=e[r],0,MAX,r),h=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(intCheck(t=e[r],0,8,r),_=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(intCheck(t[0],-MAX,0,r),intCheck(t[1],0,MAX,r),v=t[0],m=t[1]):(intCheck(t,-MAX,MAX,r),v=-(m=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)intCheck(t[0],-MAX,-1,r),intCheck(t[1],1,MAX,r),d=t[0],g=t[1];else{if(intCheck(t,-MAX,MAX,r),!t)throw Error(bignumberError+r+" cannot be zero: "+t);d=-(g=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(bignumberError+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw b=!t,Error(bignumberError+"crypto unavailable");b=t}else b=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(intCheck(t=e[r],0,9,r),y=t),e.hasOwnProperty(r="POW_PRECISION")&&(intCheck(t=e[r],0,MAX,r),w=t),e.hasOwnProperty(r="FORMAT")){if("object"!=_typeof(t=e[r]))throw Error(bignumberError+r+" not an object: "+t);S=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.?$|[+\-.\s]|(.).*\1/.test(t))throw Error(bignumberError+r+" invalid: "+t);E="0123456789"==t.slice(0,10),x=t}}return{DECIMAL_PLACES:h,ROUNDING_MODE:_,EXPONENTIAL_AT:[v,m],RANGE:[d,g],CRYPTO:b,MODULO_MODE:y,POW_PRECISION:w,FORMAT:S,ALPHABET:x}},A.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!A.DEBUG)return!0;var r,t,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-MAX&&i<=MAX&&i===mathfloor(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((r=(i+1)%LOG_BASE)<1&&(r+=LOG_BASE),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||t>=BASE||t!==mathfloor(t))break e;if(0!==t)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},A.maximum=A.max=function(){return O(arguments,f.lt)},A.minimum=A.min=function(){return O(arguments,f.gt)},A.random=(i=9007199254740992,o=Math.random()*i&2097151?function(){return mathfloor(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,n,i,a,u=0,s=[],c=new A(p);if(null==e?e=h:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),b)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(a=131072*r[u]+(r[u+1]>>>11))>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),r[u]=t[0],r[u+1]=t[1]):(s.push(a%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw b=!1,Error(bignumberError+"crypto unavailable");for(r=crypto.randomBytes(i*=7);u<i;)(a=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6])>=9e15?crypto.randomBytes(7).copy(r,u):(s.push(a%1e14),u+=7);u=i/7}if(!b)for(;u<i;)(a=o())<9e15&&(s[u++]=a%1e14);for(i=s[--u],e%=LOG_BASE,i&&e&&(a=POWS_TEN[LOG_BASE-e],s[u]=mathfloor(i/a)*a);0===s[u];s.pop(),u--);if(u<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(u=1,a=s[0];a>=10;a/=10,u++);u<LOG_BASE&&(n-=LOG_BASE-u)}return c.e=n,c.c=s,c}),A.sum=function(){for(var e=1,r=arguments,t=new A(r[0]);e<r.length;)t=t.plus(r[e++]);return t},t=function(){var e="0123456789";function t(e,r,t,n){for(var i,o,a=[0],u=0,s=e.length;u<s;){for(o=a.length;o--;a[o]*=r);for(a[0]+=n.indexOf(e.charAt(u++)),i=0;i<a.length;i++)a[i]>t-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/t|0,a[i]%=t)}return a.reverse()}return function(n,i,o,a,u){var s,c,l,f,p,v,m,d,g=n.indexOf("."),b=h,y=_;for(g>=0&&(f=w,w=0,n=n.replace(".",""),v=(d=new A(i)).pow(n.length-g),w=f,d.c=t(toFixedPoint(coeffToString(v.c),v.e,"0"),10,o,e),d.e=d.c.length),l=f=(m=t(n,i,o,u?(s=x,e):(s=e,x))).length;0==m[--f];m.pop());if(!m[0])return s.charAt(0);if(g<0?--l:(v.c=m,v.e=l,v.s=a,m=(v=r(v,d,b,y,o)).c,p=v.r,l=v.e),g=m[c=l+b+1],f=o/2,p=p||c<0||null!=m[c+1],p=y<4?(null!=g||p)&&(0==y||y==(v.s<0?3:2)):g>f||g==f&&(4==y||p||6==y&&1&m[c-1]||y==(v.s<0?8:7)),c<1||!m[0])n=p?toFixedPoint(s.charAt(1),-b,s.charAt(0)):s.charAt(0);else{if(m.length=c,p)for(--o;++m[--c]>o;)m[c]=0,c||(++l,m=[1].concat(m));for(f=m.length;!m[--f];);for(g=0,n="";g<=f;n+=s.charAt(m[g++]));n=toFixedPoint(n,l,s.charAt(0))}return n}}(),r=function(){function e(e,r,t){var n,i,o,a,u=0,s=e.length,c=r%SQRT_BASE,l=r/SQRT_BASE|0;for(e=e.slice();s--;)u=((i=c*(o=e[s]%SQRT_BASE)+(n=l*o+(a=e[s]/SQRT_BASE|0)*c)%SQRT_BASE*SQRT_BASE+u)/t|0)+(n/SQRT_BASE|0)+l*a,e[s]=i%t;return u&&(e=[u].concat(e)),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,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,a,u){var s,c,l,f,p,h,_,v,m,d,g,b,y,w,S,x,E,N=n.s==i.s?1:-1,O=n.c,k=i.c;if(!(O&&O[0]&&k&&k[0]))return new A(n.s&&i.s&&(O?!k||O[0]!=k[0]:k)?O&&0==O[0]||!k?0*N:N/0:NaN);for(m=(v=new A(N)).c=[],N=o+(c=n.e-i.e)+1,u||(u=BASE,c=bitFloor(n.e/LOG_BASE)-bitFloor(i.e/LOG_BASE),N=N/LOG_BASE|0),l=0;k[l]==(O[l]||0);l++);if(k[l]>(O[l]||0)&&c--,N<0)m.push(1),f=!0;else{for(w=O.length,x=k.length,l=0,N+=2,(p=mathfloor(u/(k[0]+1)))>1&&(k=e(k,p,u),O=e(O,p,u),x=k.length,w=O.length),y=x,g=(d=O.slice(0,x)).length;g<x;d[g++]=0);E=k.slice(),E=[0].concat(E),S=k[0],k[1]>=u/2&&S++;do{if(p=0,(s=r(k,d,x,g))<0){if(b=d[0],x!=g&&(b=b*u+(d[1]||0)),(p=mathfloor(b/S))>1)for(p>=u&&(p=u-1),_=(h=e(k,p,u)).length,g=d.length;1==r(h,d,_,g);)p--,t(h,x<_?E:k,_,u),_=h.length,s=1;else 0==p&&(s=p=1),_=(h=k.slice()).length;if(_<g&&(h=[0].concat(h)),t(d,h,g,u),g=d.length,-1==s)for(;r(k,d,x,g)<1;)p++,t(d,x<g?E:k,g,u),g=d.length}else 0===s&&(p++,d=[0]);m[l++]=p,d[0]?d[g++]=O[y]||0:(d=[O[y]],g=1)}while((y++<w||null!=d[0])&&N--);f=null!=d[0],m[0]||m.splice(0,1)}if(u==BASE){for(l=1,N=m[0];N>=10;N/=10,l++);B(v,o+(v.e=l+c*LOG_BASE-1)+1,a,f)}else v.e=c,v.r=+f;return v}}(),a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,s=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,l=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,r,t,n){var i,o=t?r:r.replace(l,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!t&&(o=o.replace(a,(function(e,r,t){return i="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=i?e:r})),n&&(i=n,o=o.replace(u,"$1").replace(s,"0.$1")),r!=o))return new A(o,i);if(A.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new A(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,r){return compare(this,new A(e,r))},f.decimalPlaces=f.dp=function(e,r){var t,n,i,o=this;if(null!=e)return intCheck(e,0,MAX),null==r?r=_:intCheck(r,0,8),B(new A(o),e+o.e+1,r);if(!(t=o.c))return null;if(n=((i=t.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,i=t[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},f.dividedBy=f.div=function(e,t){return r(this,new A(e,t),h,_)},f.dividedToIntegerBy=f.idiv=function(e,t){return r(this,new A(e,t),0,1)},f.exponentiatedBy=f.pow=function(e,r){var t,n,i,o,a,u,s,c,l=this;if((e=new A(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+T(e));if(null!=r&&(r=new A(r)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return c=new A(Math.pow(+T(l),a?e.s*(2-isOdd(e)):+T(e))),r?c.mod(r):c;if(u=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new A(NaN);(n=!u&&l.isInteger()&&r.isInteger())&&(l=l.mod(r))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return o=l.s<0&&isOdd(e)?-0:0,l.e>-1&&(o=1/o),new A(u?1/o:o);w&&(o=mathceil(w/LOG_BASE+2))}for(a?(t=new A(.5),u&&(e.s=1),s=isOdd(e)):s=(i=Math.abs(+T(e)))%2,c=new A(p);;){if(s){if(!(c=c.times(l)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(r))}if(i){if(0===(i=mathfloor(i/2)))break;s=i%2}else if(B(e=e.times(t),e.e+1,1),e.e>14)s=isOdd(e);else{if(0===(i=+T(e)))break;s=i%2}l=l.times(l),o?l.c&&l.c.length>o&&(l.c.length=o):n&&(l=l.mod(r))}return n?c:(u&&(c=p.div(c)),r?c.mod(r):o?B(c,w,_,undefined):c)},f.integerValue=function(e){var r=new A(this);return null==e?e=_:intCheck(e,0,8),B(r,r.e+1,e)},f.isEqualTo=f.eq=function(e,r){return 0===compare(this,new A(e,r))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,r){return compare(this,new A(e,r))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,r){return 1===(r=compare(this,new A(e,r)))||0===r},f.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},f.isLessThan=f.lt=function(e,r){return compare(this,new A(e,r))<0},f.isLessThanOrEqualTo=f.lte=function(e,r){return-1===(r=compare(this,new A(e,r)))||0===r},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,r){var t,n,i,o,a=this,u=a.s;if(r=(e=new A(e,r)).s,!u||!r)return new A(NaN);if(u!=r)return e.s=-r,a.plus(e);var s=a.e/LOG_BASE,c=e.e/LOG_BASE,l=a.c,f=e.c;if(!s||!c){if(!l||!f)return l?(e.s=-r,e):new A(f?a:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-r,e):new A(l[0]?a:3==_?-0:0)}if(s=bitFloor(s),c=bitFloor(c),l=l.slice(),u=s-c){for((o=u<0)?(u=-u,i=l):(c=s,i=f),i.reverse(),r=u;r--;i.push(0));i.reverse()}else for(n=(o=(u=l.length)<(r=f.length))?u:r,u=r=0;r<n;r++)if(l[r]!=f[r]){o=l[r]<f[r];break}if(o&&(i=l,l=f,f=i,e.s=-e.s),(r=(n=f.length)-(t=l.length))>0)for(;r--;l[t++]=0);for(r=BASE-1;n>u;){if(l[--n]<f[n]){for(t=n;t&&!l[--t];l[t]=r);--l[t],l[n]+=BASE}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?k(e,l,c):(e.s=3==_?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,t){var n,i,o=this;return e=new A(e,t),!o.c||!e.s||e.c&&!e.c[0]?new A(NaN):!e.c||o.c&&!o.c[0]?new A(o):(9==y?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,y),(e=o.minus(n.times(e))).c[0]||1!=y||(e.s=o.s),e)},f.multipliedBy=f.times=function(e,r){var t,n,i,o,a,u,s,c,l,f,p,h,_,v,m,d=this,g=d.c,b=(e=new A(e,r)).c;if(!(g&&b&&g[0]&&b[0]))return!d.s||!e.s||g&&!g[0]&&!b||b&&!b[0]&&!g?e.c=e.e=e.s=null:(e.s*=d.s,g&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=bitFloor(d.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=d.s,(s=g.length)<(f=b.length)&&(_=g,g=b,b=_,i=s,s=f,f=i),i=s+f,_=[];i--;_.push(0));for(v=BASE,m=SQRT_BASE,i=f;--i>=0;){for(t=0,p=b[i]%m,h=b[i]/m|0,o=i+(a=s);o>i;)t=((c=p*(c=g[--a]%m)+(u=h*c+(l=g[a]/m|0)*p)%m*m+_[o]+t)/v|0)+(u/m|0)+h*l,_[o--]=c%v;_[o]=t}return t?++n:_.splice(0,1),k(e,_,n)},f.negated=function(){var e=new A(this);return e.s=-e.s||null,e},f.plus=function(e,r){var t,n=this,i=n.s;if(r=(e=new A(e,r)).s,!i||!r)return new A(NaN);if(i!=r)return e.s=-r,n.minus(e);var o=n.e/LOG_BASE,a=e.e/LOG_BASE,u=n.c,s=e.c;if(!o||!a){if(!u||!s)return new A(i/0);if(!u[0]||!s[0])return s[0]?e:new A(u[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),u=u.slice(),i=o-a){for(i>0?(a=o,t=s):(i=-i,t=u),t.reverse();i--;t.push(0));t.reverse()}for((i=u.length)-(r=s.length)<0&&(t=s,s=u,u=t,r=i),i=0;r;)i=(u[--r]=u[r]+s[r]+i)/BASE|0,u[r]=BASE===u[r]?0:u[r]%BASE;return i&&(u=[i].concat(u),++a),k(e,u,a)},f.precision=f.sd=function(e,r){var t,n,i,o=this;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==r?r=_:intCheck(r,0,8),B(new A(o),e,r);if(!(t=o.c))return null;if(n=(i=t.length-1)*LOG_BASE+1,i=t[i]){for(;i%10==0;i/=10,n--);for(i=t[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},f.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,t,n,i,o,a=this,u=a.c,s=a.s,c=a.e,l=h+4,f=new A("0.5");if(1!==s||!u||!u[0])return new A(!s||s<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(s=Math.sqrt(+T(a)))||s==1/0?(((t=coeffToString(u)).length+c)%2==0&&(t+="0"),s=Math.sqrt(+t),c=bitFloor((c+1)/2)-(c<0||c%2),n=new A(t=s==1/0?"5e"+c:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new A(s+""),n.c[0])for((s=(c=n.e)+l)<3&&(s=0);;)if(o=n,n=f.times(o.plus(r(a,o,l,1))),coeffToString(o.c).slice(0,s)===(t=coeffToString(n.c)).slice(0,s)){if(n.e<c&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(B(n,n.e+h+2,1),e=!n.times(n).eq(a));break}if(!i&&(B(o,o.e+h+2,0),o.times(o).eq(a))){n=o;break}l+=4,s+=4,i=1}return B(n,n.e+h+1,_,e)},f.toExponential=function(e,r){return null!=e&&(intCheck(e,0,MAX),e++),N(this,e,r,1)},f.toFixed=function(e,r){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),N(this,e,r)},f.toFormat=function(e,r,t){var n,i=this;if(null==t)null!=e&&r&&"object"==_typeof(r)?(t=r,r=null):e&&"object"==_typeof(e)?(t=e,e=r=null):t=S;else if("object"!=_typeof(t))throw Error(bignumberError+"Argument not an object: "+t);if(n=i.toFixed(e,r),i.c){var o,a=n.split("."),u=+t.groupSize,s=+t.secondaryGroupSize,c=t.groupSeparator||"",l=a[0],f=a[1],p=i.s<0,h=p?l.slice(1):l,_=h.length;if(s&&(o=u,u=s,s=o,_-=o),u>0&&_>0){for(o=_%u||u,l=h.substr(0,o);o<_;o+=u)l+=c+h.substr(o,u);s>0&&(l+=c+h.slice(o)),p&&(l="-"+l)}n=f?l+(t.decimalSeparator||"")+((s=+t.fractionGroupSize)?f.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):f):l}return(t.prefix||"")+n+(t.suffix||"")},f.toFraction=function(e){var t,n,i,o,a,u,s,c,l,f,h,v,m=this,d=m.c;if(null!=e&&(!(s=new A(e)).isInteger()&&(s.c||1!==s.s)||s.lt(p)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+T(s));if(!d)return new A(m);for(t=new A(p),l=n=new A(p),i=c=new A(p),v=coeffToString(d),a=t.e=v.length-m.e-1,t.c[0]=POWS_TEN[(u=a%LOG_BASE)<0?LOG_BASE+u:u],e=!e||s.comparedTo(t)>0?a>0?t:l:s,u=g,g=1/0,s=new A(v),c.c[0]=0;f=r(s,t,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,l=c.plus(f.times(o=l)),c=o,t=s.minus(f.times(o=t)),s=o;return o=r(e.minus(n),i,0,1),c=c.plus(o.times(l)),n=n.plus(o.times(i)),c.s=l.s=m.s,h=r(l,i,a*=2,_).minus(m).abs().comparedTo(r(c,n,a,_).minus(m).abs())<1?[l,i]:[c,n],g=u,h},f.toNumber=function(){return+T(this)},f.toPrecision=function(e,r){return null!=e&&intCheck(e,1,MAX),N(this,e,r,2)},f.toString=function(e){var r,n=this,i=n.s,o=n.e;return null===o?i?(r="Infinity",i<0&&(r="-"+r)):r="NaN":(null==e?r=o<=v||o>=m?toExponential(coeffToString(n.c),o):toFixedPoint(coeffToString(n.c),o,"0"):10===e&&E?r=toFixedPoint(coeffToString((n=B(new A(n),h+o+1,_)).c),n.e,"0"):(intCheck(e,2,x.length,"Base"),r=t(toFixedPoint(coeffToString(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(r="-"+r)),r},f.valueOf=f.toJSON=function(){return T(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=e&&A.set(e),A}function bitFloor(e){var r=0|e;return e>0||e===r?r:r-1}function coeffToString(e){for(var r,t,n=1,i=e.length,o=e[0]+"";n<i;){for(r=e[n++]+"",t=LOG_BASE-r.length;t--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare(e,r){var t,n,i=e.c,o=r.c,a=e.s,u=r.s,s=e.e,c=r.e;if(!a||!u)return null;if(t=i&&!i[0],n=o&&!o[0],t||n)return t?n?0:-u:a;if(a!=u)return a;if(t=a<0,n=s==c,!i||!o)return n?0:!i^t?1:-1;if(!n)return s>c^t?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,a=0;a<u;a++)if(i[a]!=o[a])return i[a]>o[a]^t?1:-1;return s==c?0:s>c^t?1:-1}function intCheck(e,r,t,n){if(e<r||e>t||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<r||e>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var r=e.c.length-1;return bitFloor(e.e/LOG_BASE)==r&&e.c[r]%2!=0}function toExponential(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function toFixedPoint(e,r,t){var n,i;if(r<0){for(i=t+".";++r;i+=t);e=i+e}else if(++r>(n=e.length)){for(i=t,r-=n;--r;i+=t);e+=i}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}var BigNumber=clone();function format(e,r){var t="";if("undefined"===(t=BigNumber.isBigNumber(e)?e.toFixed():"string"==typeof e?e:e.toString())||"NaN"===t)return[void 0,{}];var n={mantissa:null,mantissa_type:null,thousands:!1,sign:!1,round:"~-",scientific:!1,fraction:!1,percent:!1,to_number:!1,to_number_string:!1};if(r.forEach((function(e){var r=e.type;if("symbol"===r){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);n.mantissa_type=e.value}else if("to-number"===r)n.to_number=!0;else if("to-number-string"===r)n.to_number_string=!0;else if("comma"===r)n.thousands=!0;else if("number"===r)n.mantissa=e.value;else if("var"===r)n.mantissa=e.real_value;else if("plus"===r)n.sign=!0;else if("round"===r)n.round=e.value;else if("fraction"===r)n.fraction=!0;else if("scientific"===r)n.scientific=!0;else{if("percent"!==r)throw new Error("错误的fmt Token");n.percent=!0}})),n.to_number)return[+parse_mantissa(t,n.mantissa_type,n.mantissa,n.round),n];if(n.scientific){var i=BigNumber(t).toExponential();return[n.sign&&!i.startsWith("-")?"+"+i:i,n]}if(n.fraction){var o=BigNumber(t).toFraction().map((function(e){return e.toFixed()})).join("/");return[n.sign&&!o.startsWith("-")?"+"+o:o,n]}return n.percent&&(t=BigNumber(t).times(100).toFixed()),null===n.mantissa?t.includes(".")&&(t=t.replace(/0*$/,"")):t=parse_mantissa(t,n.mantissa_type,n.mantissa,n.round),n.thousands&&(t=parse_thousands(t)),n.sign&&(n.to_number=!1,t.startsWith("-")||(t="+"+t)),n.percent&&(t+="%"),[t,n]}function close_important_push(){}function open_important_push(){}function open_debug(){}function close_debug(){}function calc_wrap(e,r){var t={_error:"-"};return["string","number"].includes(_typeof(e))?void 0===r?/[a-zA-Z$_]/.test(e.toString())?function(r){return Array.isArray(r)?r.unshift(t):r=_objectSpread2(_objectSpread2({},t),r),calc(e,r)}:calc(e):(Array.isArray(r)?r.unshift(t):r=_objectSpread2(_objectSpread2({},t),r),calc(e,r)):(Array.isArray(e)?e.unshift(t):e=_objectSpread2(_objectSpread2({},t),e),function(r){return calc(r,e)})}function check_version(){return _check_version.apply(this,arguments)}function _check_version(){return _check_version=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var res,code,versions,last_version,larr,varr,script,url;return _regeneratorRuntime().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:if("undefined"==typeof process||"node"!==process.release.name){_context.next=19;break}if(!(parseInt(process.versions.node)>=17)){_context.next=17;break}return _context.next=4,promise_queue([fetch("https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js"),fetch("https://unpkg.com/a-calc@latest/a-calc.versions.js")]);case 4:return res=_context.sent,_context.next=7,res.text();case 7:code=_context.sent,versions=eval(code),last_version=versions.at(-1),larr=last_version.match(/(\d+)\.(\d+)\.(\d+)/),larr.shift(),larr=larr.map((function(e){return parseInt(e)})),varr=version.match(/(\d+)\.(\d+)\.(\d+)/),varr.shift(),varr=varr.map((function(e){return parseInt(e)})),(larr[0]>varr[0]||larr[0]===varr[0]&&larr[1]>varr[1]||larr[0]===varr[0]&&larr[1]===varr[1]&&larr[2]>varr[2])&&console.warn("a-calc has a new version:",last_version);case 17:_context.next=25;break;case 19:return script=document.createElement("script"),script.onload=function(){var e=a_calc_versions;if(Array.isArray(e)){var r=e.at(-1),t=r.match(/(\d+)\.(\d+)\.(\d+)/);t.shift(),t=t.map((function(e){return parseInt(e)}));var n=version.match(/(\d+)\.(\d+)\.(\d+)/);n.shift(),n=n.map((function(e){return parseInt(e)})),(t[0]>n[0]||t[0]===n[0]&&t[1]>n[1]||t[0]===n[0]&&t[1]===n[1]&&t[2]>n[2])&&console.log("%c↑↑↑ a-calc has a new version: %s ↑↑↑","color: #67C23A;",r)}},_context.next=23,test_urls(["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"]);case 23:url=_context.sent,url?(script.src=url,document.body.appendChild(script)):script=null;case 25:case"end":return _context.stop()}}),_callee)}))),_check_version.apply(this,arguments)}var operator=new Set(["+","-","*","/","%","**","//"]);function push_token$2(e,r,t){if(Number.isNaN(Number(r)))if("-"===r||"+"===r)0===e.length||"operator"===e.at(-1).type||"("===e.at(-1).value?e.push({type:"number",value:r,real_value:r,has_unit:!1}):e.push({type:"operator",value:r});else if(operator.has(r))e.push({type:"operator",value:r});else if(t._unit&&/^[+-]?\d/.test(r)){var n,i=split_unit_num(r),o=i.num,a=i.unit;if(void 0===a)e.push({type:"number",value:o,real_value:o,has_unit:!1});else t.has_unit=!0,null!==(n=t.unit_str)&&void 0!==n||(t.unit_str=a),e.push({type:"number",value:o,real_value:o,has_unit:!0,unit:a})}else if(var_first_char.includes(r[0])){t.has_var=!0;var u=get_real_value(t.fill_data,r);if(t._unit){var s,c=split_unit_num(u),l=c.num,f=c.unit;if(void 0===f)e.push({type:"var",value:r,real_value:l,has_unit:!1});else t.has_unit=!0,null!==(s=t.unit_str)&&void 0!==s||(t.unit_str=f),e.push({type:"var",value:r,real_value:l,has_unit:!0,unit:f})}else e.push({type:"var",value:r,real_value:u,has_unit:!1})}else{if(!/^[+-]?\d/.test(r))throw new Error("无法识别的标识符:".concat(r));var p=r.indexOf("e");-1!==p&&/^\d+$/.test(r.slice(p+1))&&e.push({type:"number",value:r,real_value:r,has_unit:!1})}else e.push({type:"number",value:r,real_value:r,has_unit:!1})}function tokenizer_space(e,r,t){for(var n,i=0,o=0,a=e.length,u=[],s={has_var:!1,has_unit:!1,unit_str:void 0,_unit:t,fill_data:r};o<a;)" "===(n=e[o])?(o>i&&push_token$2(u,e.slice(i,o),s),i=o+1):"("===n?(u.push({type:state_bracket,value:"("}),i=o+1):")"===n&&(o>i&&push_token$2(u,e.slice(i,o),s),u.push({type:state_bracket,value:")"}),i=o+1),o++;return o>i&&push_token$2(u,e.slice(i,o),s),u.has_var=s.has_var,u.has_unit=s.has_unit,u.unit=s.unit_str,u}function compute(e,r,t){if(void 0===e||void 0===r)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(r));switch(t){case"+":return new BigNumber(e).plus(r);case"-":return new BigNumber(e).minus(r);case"*":return new BigNumber(e).times(r);case"/":return new BigNumber(e).div(r);case"%":return new BigNumber(e).mod(r);case"**":return new BigNumber(e).pow(r);case"//":return new BigNumber(e).idiv(r)}}var operator_map$1={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens(e){if(1===e.length){var r=e[0];if("number"===r.type||"var"===r.type)return r.real_value;throw new Error("错误的表达式:".concat(r.value))}for(var t,n,i=[],o=[],a=0,u=e.length;a<u;a++)if("number"!==(t=e[a]).type&&"var"!==t.type)if("operator"!==t.type)if("("!==t.value){if(")"===t.value)for(var s=void 0;s=i.pop();){if("("===s){var c=o.at(-2);if("-"===c){var l=o.pop();o.pop(),o.push(BigNumber.isBigNumber(l)?l.negated():new BigNumber(l).negated())}else if("+"===c){var f=o.pop();o.pop(),o.push(f)}break}var p=o.pop(),h=o.pop();o.push(compute(h,p,s))}}else i.push("(");else{var _=i.at(-1);if("("===_){i.push(t.value);continue}var v=operator_map$1[t.value];if(!i.length){i.push(t.value);continue}if(v<operator_map$1[_])for(var m=void 0;m=i.pop();){if("("===m){i.push("(");break}var d=o.pop(),g=o.pop();o.push(compute(g,d,m))}else if(v===operator_map$1[_]){if("**"===t.value){i.push(t.value);continue}for(var b=void 0;b=i.pop();){if("("===b){i.push("(");break}if(operator_map$1[b]<v){i.push(b);break}var y=o.pop(),w=o.pop();o.push(compute(w,y,b))}}i.push(t.value)}else o.push(t.real_value);for(;n=i.pop();){var S=o.pop(),x=o.pop();o.push(compute(x,S,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return e.has_var||(e.calc_result=o[0]),o[0]}function push_token$1(e,r,t,n,i){r===state_var?(i.has_var=!0,e.push({type:r,value:t,real_value:get_real_value(i.fill_data,t)})):e.push({type:r,value:t}),n.prev=n.curr,i.state=state_initial}function fmt_tokenizer(e,r){for(var t,n={prev:0,curr:0},i=e.length,o={state:state_initial,fill_data:r,has_var:!1},a=[];n.curr<i;)switch(t=e[n.curr],o.state){case state_initial:if(" "===t)n.curr++,n.prev=n.curr;else if("<>=".includes(t))o.state=state_symbol,n.curr++;else if(","===t)n.curr++,push_token$1(a,state_comma,",",n,o);else if(var_char.includes(t))o.state=state_var,n.curr++;else if(number_char.includes(t))o.state=state_number,n.curr++;else if("+"===t)n.curr++,push_token$1(a,state_plus$1,"+",n,o);else if("~"===t)n.curr++,o.state=state_round;else if("%"===t)n.curr++,push_token$1(a,state_percent,"%",n,o);else if("/"===t)n.curr++,push_token$1(a,state_fraction,"/",n,o);else if("!"===t)if(o.state=state_initial,n.curr++,"n"===e[n.curr])n.curr++,push_token$1(a,state_to_number,"!n",n,o);else if("u"===e[n.curr])n.curr++,push_token$1(a,state_to_number_string,"!u",n,o);else{if("e"!==e[n.curr])throw new Error("无法识别的!模式字符:".concat(e[n.curr]));n.curr++,push_token$1(a,state_scientific,"!e",n,o)}else n.curr++,n.prev=n.curr;break;case state_symbol:"="===t&&n.curr++,push_token$1(a,state_symbol,e.slice(n.prev,n.curr),n,o);break;case state_number:number_char.includes(t)?n.curr++:push_token$1(a,state_number,e.slice(n.prev,n.curr),n,o);break;case state_var:var_members_char.includes(t)?n.curr++:push_token$1(a,state_var,e.slice(n.prev,n.curr),n,o);break;case state_round:if(!("56+-".includes(t)&&n.curr-n.prev<2))throw new Error("错误的舍入语法:".concat(e.slice(n.prev,n.curr+1)));n.curr++,push_token$1(a,state_round,e.slice(n.prev,n.curr),n,o);break;default:throw new Error("错误的fmt分词器状态")}return n.prev<n.curr&&push_token$1(a,o.state,e.slice(n.prev,n.curr),n,o),a.has_var=o.has_var,a}var symbol_set=new Set(["<",">","=",">=","<="]),rand_set=new Set(["~+","~-","~5","~6"]);function push_token(e,r,t){if(","===r)e.push({type:state_comma,value:","});else if(symbol_set.has(r))e.push({type:state_symbol,value:r});else if(Number.isNaN(Number(r)))if(var_first_char.includes(r[0]))t.has_var=!0,e.push({type:state_var,value:r,real_value:get_real_value(t.fill_data,r)});else if("%"===r)e.push({type:state_percent,value:r});else if("/"===r)e.push({type:state_fraction,value:r});else if("+"===r)e.push({type:state_plus,value:r});else if(rand_set.has(r))e.push({type:state_round,value:r});else if("!n"===r)e.push({type:state_to_number,value:r});else if("!u"===r)e.push({type:state_to_number_string,value:r});else{if("!e"!==r)throw new Error("无法识别的格式化字符: ".concat(r));e.push({type:state_scientific,value:r})}else e.push({type:state_number,value:r})}function fmt_tokenizer_space(e,r){for(var t,n=0,i=e.length,o={fill_data:r,has_var:!1},a=0,u=[];n<i;)" "===(t=e[n])?(n>a&&push_token(u,e.slice(a,n),o),a=n+1):"<>=".includes(t)&&("="===e[n+1]?(u.push({type:state_symbol,value:t+"="}),a=1+ ++n):(u.push({type:state_symbol,value:t}),a=n+1)),n++;return a<n&&push_token(u,e.slice(a,n),o),u.has_var=o.has_var,u}function compute_lite(e,r,t){switch(t){case"+":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).plus(r);case"-":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).minus(r);case"*":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).times(r);case"/":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).div(r);case"%":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).mod(r);case"**":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).pow(r);case"//":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).idiv(r)}}var operator_map={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens_lite(e,r){for(var t,n,i=[],o=[],a=0,u=e.length;a<u;a++){var s=(t=e[a])[0];if(var_first_char.includes(s))o.push(get_real_value(r,t));else if(operator_set.has(t)){var c=i.at(-1);if("("===c){i.push(t);continue}var l=operator_map[t];if(!i.length){i.push(t);continue}var f=operator_map[c];if(l<f)for(var p=i.at(-1);p&&"("!==p;){i.pop();var h=o.pop(),_=o.pop();o.push(compute_lite(_,h,p)),p=i.at(-1)}else if(l===f){if("**"===t){i.push(t);continue}for(var v=i.at(-1);v&&!(operator_map[v]<l||"("===v);){i.pop();var m=o.pop(),d=o.pop();o.push(compute_lite(d,m,v)),v=i.at(-1)}}i.push(t)}else if(number_first_char.includes(s))o.push(t);else if("("!==t){if(")"===t)for(var g=void 0;(g=i.pop())&&"("!==g;){var b=o.pop(),y=o.pop();o.push(compute_lite(y,b,g))}}else i.push("(")}for(;n=i.pop();){var w=o.pop(),S=o.pop();o.push(compute_lite(S,w,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return o[0]}function calc_lite(e,r,t){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"-";try{var i;if("number"==typeof e)i=e.toString();else{if(""===e)throw new Error("非法的空计算式");var o=e.split(" ");if(1===o.length){if(i=o[0],var_first_char.includes(i[0])&&(i=get_real_value(t,i)),isNaN(Number(i)))throw new Error("错误的计算式:".concat(e))}else i=eval_tokens_lite(o,t).toFixed()}if("string"==typeof r&&""!==r){var a=fmt_tokenizer(r,t);if(void 0!==a)i=_slicedToArray(format(i,a),1)[0]}if("NaN"===i||"Infinity"===i)throw new Error("计算环节出错");return i}catch(e){return n}}function calc_mini(e,r,t){switch(r){case"+":return BigNumber(e).plus(t).toFixed();case"-":return BigNumber(e).minus(t).toFixed();case"*":return BigNumber(e).times(t).toFixed();case"/":return BigNumber(e).div(t).toFixed();case"%":return BigNumber(e).mod(t).toFixed();case"**":return BigNumber(e).pow(t).toFixed();case"//":return BigNumber(e).idiv(t).toFixed()}}function calc(e,r){var t=find_value(r,"_error");try{var n,i,o,a,u,s=parse_args(e,r),c=s._unit,l=s._mode,f="space"===l||"space-all"===l?tokenizer_space(s.expr,s.fill_data,c):tokenizer(s.expr,s.fill_data,c),p=eval_tokens(f),h=BigNumber.isBigNumber(p)?p:new BigNumber(p);if("space-all"===l?(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer_space(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer_space(s._fmt,s.fill_data)):(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer(s._fmt,s.fill_data)),void 0===a?void 0!==u&&(a=u):void 0!==u&&(a=[].concat(_toConsumableArray(u),_toConsumableArray(a))),void 0===a)h=h.toFixed();else{var _=_slicedToArray(format(h,a),2);h=_[0],o=_[1]}if("Infinity"===h||"NaN"===h||void 0===h)throw new Error("计算错误可能是非法的计算式");return!f.has_unit||null!==(n=o)&&void 0!==n&&n.to_number||null!==(i=o)&&void 0!==i&&i.to_number_string||(h+=f.unit),h}catch(e){if(void 0===t)throw e;return t}}function check_update(){check_version().catch((function(){}))}function print_version(){console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")}var calc_util={check_update:check_update,print_version:print_version,open_debug:open_debug,close_debug:close_debug,close_important_push:close_important_push,open_important_push:open_important_push},fmt=calc;function plus(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).plus(r).toNumber():new BigNumber(e).plus(r).toFixed()}function sub(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).minus(r).toNumber():new BigNumber(e).minus(r).toFixed()}function mul(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).times(r).toNumber():new BigNumber(e).times(r).toFixed()}function div(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).div(r).toNumber():new BigNumber(e).div(r).toFixed()}function mod(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).mod(r).toNumber():new BigNumber(e).mod(r).toFixed()}function pow(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).pow(r).toNumber():new BigNumber(e).pow(r).toFixed()}function idiv(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).idiv(r).toNumber():new BigNumber(e).idiv(r).toFixed()}return exports.calc=calc,exports.calc_lite=calc_lite,exports.calc_mini=calc_mini,exports.calc_util=calc_util,exports.calc_wrap=calc_wrap,exports.div=div,exports.fmt=fmt,exports.idiv=idiv,exports.mod=mod,exports.mul=mul,exports.parse_thousands=parse_thousands,exports.plus=plus,exports.pow=pow,exports.sub=sub,exports.version=version,exports}({});
|
package/calc.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ export declare const parse_thousands: (str: string) => string;
|
|
|
160
160
|
* @param type 输出数字还是字符串
|
|
161
161
|
* @returns 计算得到的结果
|
|
162
162
|
*/
|
|
163
|
-
export declare const plus: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type
|
|
163
|
+
export declare const plus: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type?: T) => T extends "number" ? number : string;
|
|
164
164
|
/**
|
|
165
165
|
* 传入两个数字或数字字符串进行相减并返回结果,可以指定第三个参数控制返回数字还是数字字符串
|
|
166
166
|
* @param a 一个数字或数字字符串
|
|
@@ -168,7 +168,7 @@ export declare const plus: <const T extends "number" | "string" = "number">(a: n
|
|
|
168
168
|
* @param type 输出数字还是字符串
|
|
169
169
|
* @returns 计算得到的结果
|
|
170
170
|
*/
|
|
171
|
-
export declare const sub: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type
|
|
171
|
+
export declare const sub: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type?: T) => T extends "number" ? number : string;
|
|
172
172
|
/**
|
|
173
173
|
* 传入两个数字或数字字符串进行相乘并返回结果,可以指定第三个参数控制返回数字还是数字字符串
|
|
174
174
|
* @param a 一个数字或数字字符串
|
|
@@ -176,7 +176,7 @@ export declare const sub: <const T extends "number" | "string" = "number">(a: nu
|
|
|
176
176
|
* @param type 输出数字还是字符串
|
|
177
177
|
* @returns 计算得到的结果
|
|
178
178
|
*/
|
|
179
|
-
export declare const mul: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type
|
|
179
|
+
export declare const mul: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type?: T) => T extends "number" ? number : string;
|
|
180
180
|
/**
|
|
181
181
|
* 传入两个数字或数字字符串进行相除并返回结果,可以指定第三个参数控制返回数字还是数字字符串
|
|
182
182
|
* @param a 一个数字或数字字符串
|
|
@@ -184,7 +184,7 @@ export declare const mul: <const T extends "number" | "string" = "number">(a: nu
|
|
|
184
184
|
* @param type 输出数字还是字符串
|
|
185
185
|
* @returns 计算得到的结果
|
|
186
186
|
*/
|
|
187
|
-
export declare const div: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type
|
|
187
|
+
export declare const div: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type?: T) => T extends "number" ? number : string;
|
|
188
188
|
/**
|
|
189
189
|
* 传入两个数字或数字字符串进行整除并返回结果,可以指定第三个参数控制返回数字还是数字字符串
|
|
190
190
|
* @param a 一个数字或数字字符串
|
|
@@ -192,7 +192,7 @@ export declare const div: <const T extends "number" | "string" = "number">(a: nu
|
|
|
192
192
|
* @param type 输出数字还是字符串
|
|
193
193
|
* @returns 计算得到的结果
|
|
194
194
|
*/
|
|
195
|
-
export declare const idiv: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type
|
|
195
|
+
export declare const idiv: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type?: T) => T extends "number" ? number : string;
|
|
196
196
|
/**
|
|
197
197
|
* 传入两个数字或数字字符串进行幂运算并返回结果,可以指定第三个参数控制返回数字还是数字字符串
|
|
198
198
|
* @param a 一个数字或数字字符串
|
|
@@ -200,7 +200,7 @@ export declare const idiv: <const T extends "number" | "string" = "number">(a: n
|
|
|
200
200
|
* @param type 输出数字还是字符串
|
|
201
201
|
* @returns 计算得到的结果
|
|
202
202
|
*/
|
|
203
|
-
export declare const pow: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type
|
|
203
|
+
export declare const pow: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type?: T) => T extends "number" ? number : string;
|
|
204
204
|
/**
|
|
205
205
|
* 传入两个数字或数字字符串进行取模并返回结果,可以指定第三个参数控制返回数字还是数字字符串
|
|
206
206
|
* @param a 一个数字或数字字符串
|
|
@@ -208,7 +208,7 @@ export declare const pow: <const T extends "number" | "string" = "number">(a: nu
|
|
|
208
208
|
* @param type 输出数字还是字符串
|
|
209
209
|
* @returns 计算得到的结果
|
|
210
210
|
*/
|
|
211
|
-
export declare const mod: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type
|
|
211
|
+
export declare const mod: <const T extends "number" | "string" = "number">(a: number|string, b: number|string, type?: T) => T extends "number" ? number : string;
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
214
|
* calc方法的精简版本,去除了对单位计算的支持但是这个方法性能更好一些,该方法永远不会报错,在计算出错的时候返回 -
|
package/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,u=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return u}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var o=t&&t.prototype instanceof p?t:p,a=Object.create(o.prototype),u=new A(i||[]);return n(a,"_invoke",{value:w(e,r,u)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function p(){}function h(){}function _(){}var v={};s(v,o,(function(){return this}));var m=Object.getPrototypeOf,d=m&&m(m(N([])));d&&d!==t&&r.call(d,o)&&(v=d);var g=_.prototype=p.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){function i(n,o,a,u){var s=l(e[n],e,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){i("next",e,a,u)}),(function(e){i("throw",e,a,u)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,u)}))}u(s.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function w(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var u=S(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function S(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function N(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=_,n(g,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:h,configurable:!0}),h.displayName=s(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,s(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(y.prototype),s(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new y(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),s(g,u,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=N,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:N(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function asyncGeneratorStep(e,t,r,n,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,i)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){asyncGeneratorStep(o,n,i,a,u,"next",e)}function u(e){asyncGeneratorStep(o,n,i,a,u,"throw",e)}a(void 0)}))}}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:String(t)}var version="2.2.10";function decimal_round(e,t,r,n,i){var o=e,a=t,u=t.length,s={"~-":function(){var e="<"===r?n-1:n;a=t.slice(0,e)},"~+":function(){var e="<"===r?n-1:n;if(!(u<=e||0===u)){var i=t.slice(0,e);0==+t.slice(e,u)?a=i:(i=(+"9".concat(i)+1).toString().slice(1)).length>e?(a=i.slice(1,i.length),o=(+o+1).toString()):a=i}},"~5":function(){if(0!==u){var e="<"===r?n-1:n;a=t.slice(0,e);var i=+t[e];Number.isNaN(i)||i>=5&&(a=(+"9".concat(a)+1).toString().slice(1)).length>e&&(a=a.slice(1,a.length),o=(+o+1).toString())}},"~6":function(){if(0!==u){var i,s="<"===r?n-1:n,c=+t[s],l=t.slice(+s+1,t.length);l=""===l?0:parseInt(l),i=0===s?+e[e.length-1]:+t[s-1],a=t.slice(0,s),(c>=6||5===c&&l>0||5===c&&i%2!=0)&&(a=(+"9".concat(a)+1).toString().slice(1)).length>s&&(a=a.slice(1,a.length),o=(+o+1).toString())}}};return"<="===r?u<=n?a=t.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"<"===r?u<n?a=t.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"="===r?u<n?a=t+"0".repeat(n-u):u>n&&s[i]&&s[i]():">="===r?u<n&&(a=t+"0".repeat(n-u)):">"===r&&u<=n&&(a=t+"0".repeat(n-u+1)),{int_part:o,dec_part:a}}var number_char="0123456789",var_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",number_first_char="0123456789-+",var_members_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$[].'\"",var_first_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",pure_number_var_first_char="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",empty_char=" \n\r\t",state_initial="initial",state_number="number",state_scientific="scientific",state_operator="operator",state_bracket="bracket",state_var="var",state_symbol="symbol",state_percent="percent",state_round="round",state_plus$1="plus",state_comma="comma",state_fraction="fraction",state_to_number="to-number",state_to_number_string="to-number-string",operator_set=new Set(["+","-","*","/","%","**","//"]),isArray=Array.isArray,isArray$1=isArray,freeGlobal="object"==("undefined"==typeof global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,freeGlobal$1=freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root=freeGlobal$1||freeSelf||Function("return this")(),root$1=root,_Symbol=root$1.Symbol,_Symbol$1=_Symbol,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol$1?_Symbol$1.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty$3.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$1?_Symbol$1.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return null!=e&&"object"==_typeof(e)}var symbolTag="[object Symbol]";function isSymbol(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag(e)==symbolTag}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray$1(e))return!1;var r=_typeof(e);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}function isObject(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var coreJsData=root$1["__core-js_shared__"],coreJsData$1=coreJsData,maskSrcKey=(uid=/[^.]+$/.exec(coreJsData$1&&coreJsData$1.keys&&coreJsData$1.keys.IE_PROTO||""),uid?"Symbol(src)_1."+uid:""),uid;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,t){return null==e?void 0:e[t]}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}var nativeCreate=getNative(Object,"create"),nativeCreate$1=nativeCreate;function hashClear(){this.__data__=nativeCreate$1?nativeCreate$1(null):{},this.size=0}function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet(e){var t=this.__data__;if(nativeCreate$1){var r=t[e];return r===HASH_UNDEFINED$1?void 0:r}return hasOwnProperty$1.call(t,e)?t[e]:void 0}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty.call(t,e)}var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate$1&&void 0===t?HASH_UNDEFINED:t,this}function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,t){return e===t||e!=e&&t!=t}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),--this.size,!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map=getNative(root$1,"Map"),Map$1=Map;function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=t?1:0,t}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT="Expected a function";function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function r(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(memoize.Cache||MapCache),r}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize(e,(function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e})),r=t.cache;return t}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,(function(e,r,n,i){t.push(n?i.replace(reEscapeChar,"$1"):r||e)})),t})),stringToPath$1=stringToPath;function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var INFINITY$1=1/0,symbolProto=_Symbol$1?_Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray$1(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY$1?"-0":t}function toString(e){return null==e?"":baseToString(e)}function castPath(e,t){return isArray$1(e)?e:isKey(e,t)?[e]:stringToPath$1(toString(e))}var INFINITY=1/0;function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function baseGet(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function get(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}function split_unit_num(e){for(var t,r,n,i=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],o=0;o<i.length;o++){var a=e.match(i[o]);if(a){n=a;break}}if(n){r=n[1];var u=n[2];""!==u.trim()&&(t=u)}return{num:r,unit:t}}function find_value(e,t,r){var n,i,o,a;return Array.isArray(e)?e.length>1?null!==(n=null!==(i=get(e[0],t))&&void 0!==i?i:get(e.at(-1),t))&&void 0!==n?n:r:1===e.length&&null!==(o=get(e[0],t))&&void 0!==o?o:r:null!==(a=get(e,t,r))&&void 0!==a?a:r}function parse_mantissa(e,t,r,n){var i=e.split("."),o=i[0],a=1===i.length?"":i[1],u=decimal_round(o,a,t,+r,n);return o=u.int_part,""===(a=u.dec_part)?o:"".concat(o,".").concat(a)}function integer_thousands(e){for(var t=e.length,r="";t>0;)r=e.substring(t-3,t)+(""!==r?",":"")+r,t-=3;return r}function parse_thousands(e){var t=e.split("."),r=t[0];return"-"===r[0]?t[0]="-"+integer_thousands(r.slice(1)):t[0]=integer_thousands(r),t.join(".")}function promise_queue(e){return _promise_queue.apply(this,arguments)}function _promise_queue(){return _promise_queue=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=o.length>1&&void 0!==o[1]?o[1]:5e3,n=0;case 2:if(!(n<t.length)){e.next=16;break}return e.prev=3,e.next=6,Promise.race([t[n],new Promise((function(e,t){setTimeout((function(){return t(new Error("promise queue timeout err"))}),r)}))]);case 6:i=e.sent,e.next=12;break;case 9:return e.prev=9,e.t0=e.catch(3),e.abrupt("continue",13);case 12:return e.abrupt("return",i);case 13:n++,e.next=2;break;case 16:return e.abrupt("return",Promise.reject("错误的 promise queue 调用"));case 17:case"end":return e.stop()}}),e,null,[[3,9]])}))),_promise_queue.apply(this,arguments)}function test_urls(e){return _test_urls.apply(this,arguments)}function _test_urls(){return(_test_urls=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=0;case 1:if(!(r<t.length)){e.next=16;break}return e.prev=2,e.next=5,fetch(t[r]);case 5:if(!e.sent.ok){e.next=8;break}return e.abrupt("return",t[r]);case 8:e.next=13;break;case 10:return e.prev=10,e.t0=e.catch(2),e.abrupt("continue",13);case 13:r++,e.next=1;break;case 16:return e.abrupt("return",null);case 17:case"end":return e.stop()}}),e,null,[[2,10]])})))).apply(this,arguments)}function get_real_value(e,t){if(Array.isArray(e)){for(var r,n=0,i=e.length;n<i;n++){var o;if(void 0!==(r=null!==(o=get(e[n],t))&&void 0!==o?o:void 0))break}if(void 0===r)throw new Error("填充变量".concat(value,"失败"));return r}var a;return null!==(a=get(e,t))&&void 0!==a?a:void 0}function get_next_nonempty_char(e,t,r){var n;for(t++;t<r;){if(n=e[t],-1===empty_char.indexOf(n))return n;t++}}function parse_args(e,t){var r="",n={origin_expr:e,origin_fill_data:t,expr:"",fmt_expr:"",options:void 0,fill_data:void 0,_unit:void 0,_mode:void 0,_fmt:void 0};if(null!=t&&(n.options=t,Array.isArray(t)?n.fill_data=t:Array.isArray(t._fill_data)?n.fill_data=[t].concat(_toConsumableArray(t._fill_data)):void 0===t._fill_data?n.fill_data=[t]:n.fill_data=[t,t._fill_data]),n._mode=find_value(t,"_mode","normal"),n._unit=find_value(t,"_unit",!1),n._fmt=find_value(t,"_fmt"),"string"==typeof e){if(r=e,""===e.trim()||e.includes("NaN"))throw new Error("非法的表达式:".concat(e))}else{if("number"!=typeof e)throw new Error("错误的第一个参数类型: ".concat(e," 类型为:").concat(_typeof(e)));if(isNaN(e))throw new Error("传入了一个非法数字NaN");r=e.toString()}var i=r.split("|");return n.expr=i[0],i.length>1&&(n.fmt_expr=i[1].trim()),n}function push_token$3(e,t){if(t.curr_state===state_number||t.curr_state===state_scientific){var r=t.expr.slice(t.prev_index,t.cur_index);if(t._unit){var n,i=split_unit_num(r),o=i.num,a=i.unit;if(void 0===a)e.push({type:state_number,value:o,real_value:o,has_unit:!1});else t.has_unit=!0,null!==(n=t.unit_str)&&void 0!==n||(t.unit_str=a),e.push({type:state_number,value:o,real_value:o,has_unit:!0,unit:a})}else e.push({type:state_number,value:r,real_value:r,has_unit:!1})}else if(t.curr_state===state_var){t.has_var=!0;var u=t.expr.slice(t.prev_index,t.cur_index),s=get_real_value(t.fill_data,u);if(t._unit){var c,l=split_unit_num(s),f=l.num,p=l.unit;if(void 0===p)e.push({type:"var",value:u,real_value:f,has_unit:!1});else t.has_unit=!0,null!==(c=t.unit_str)&&void 0!==c||(t.unit_str=p),e.push({type:"var",value:u,real_value:f,has_unit:!0,unit:p})}else e.push({type:"var",value:u,real_value:s,has_unit:!1})}else e.push({type:t.curr_state,value:t.expr.slice(t.prev_index,t.cur_index)});t.curr_state=state_initial,t.prev_index=t.cur_index}function tokenizer(e,t,r){for(var n,i={has_var:!1,has_unit:!1,unit_str:void 0,fill_data:t,cur_index:0,prev_index:0,curr_state:state_initial,expr:e,_unit:r},o=e.length,a=[];i.cur_index<o;)switch(n=e[i.cur_index],i.curr_state){case state_initial:if(number_char.includes(n))i.curr_state=state_number,i.cur_index++;else if(" "===n)i.cur_index++,i.prev_index=i.cur_index;else if("+-".includes(n)){var u=a.at(-1);0===i.cur_index||"operator"===(null==u?void 0:u.type)||"("===(null==u?void 0:u.value)?(i.curr_state=state_number,i.cur_index++):(i.cur_index++,a.push({type:state_operator,value:e.slice(i.prev_index,i.cur_index)}),i.prev_index=i.cur_index)}else"*/%".includes(n)?(i.curr_state=state_operator,i.cur_index++):var_char.includes(n)?(i.curr_state=state_var,i.cur_index++):"()".includes(n)?(a.push({type:state_bracket,value:n}),i.curr_state=state_initial,i.cur_index++,i.prev_index=i.cur_index):(i.cur_index++,i.prev_index=i.cur_index);break;case state_number:if(number_char.includes(n))i.cur_index++;else if("."===n){if(i.cur_index===i.prev_index||e.slice(i.prev_index,i.cur_index).includes("."))throw new Error("非法的小数部分".concat(e.slice(i.prev_index,i.cur_index)));i.cur_index++}else"e"===n?(i.curr_state=state_scientific,i.cur_index++):r?"*/+-() ".indexOf(n)>-1||"%"===n&&number_char.includes(e[i.cur_index-1])&&pure_number_var_first_char.includes(get_next_nonempty_char(e,i.cur_index,o))?push_token$3(a,i):i.cur_index++:push_token$3(a,i);break;case state_operator:var s=e[i.cur_index-1];"*"===n&&"*"===s?(i.cur_index++,a.push({type:state_operator,value:"**"}),i.prev_index=i.cur_index):"/"===n&&"/"===s?(i.cur_index++,a.push({type:state_operator,value:"//"}),i.prev_index=i.cur_index):(a.push({type:state_operator,value:s}),i.prev_index=i.cur_index),i.curr_state=state_initial;break;case state_var:var_members_char.includes(n)?i.cur_index++:push_token$3(a,i);break;case state_scientific:if(number_char.includes(n))i.cur_index++;else if("+-".includes(n)){var c=i.prev_index;"+-".includes(e[c])&&(c+=1);var l=e.slice(c,i.cur_index),f=l.at(-1);l.includes(n)||"e"!==f?push_token$3(a,i):i.cur_index++}else r&&-1==="*/+-() ".indexOf(n)?i.cur_index++:push_token$3(a,i);break;default:throw new Error("字符扫描状态错误")}return i.prev_index<i.cur_index&&push_token$3(a,i),a.has_var=i.has_var,a.has_unit=i.has_unit,a.unit=i.unit_str,a}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var t,r,n,i,o,a,u,s,c,l,f=A.prototype={constructor:A,toString:null,valueOf:null},p=new A(1),h=20,_=4,v=-7,m=21,d=-1e7,g=1e7,b=!1,y=1,w=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",E=!0;function A(e,t){var i,o,a,u,s,c,l,f,p=this;if(!(p instanceof A))return new A(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>g?p.c=p.e=null:e.e<d?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((c="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,s=e;s>=10;s/=10,u++);return void(u>g?p.c=p.e=null:(p.e=u,p.c=[e]))}f=String(e)}else{if(!isNumeric.test(f=String(e)))return n(p,f,c);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(s=f.search(/e/i))>0?(u<0&&(u=s),u+=+f.slice(s+1),f=f.substring(0,s)):u<0&&(u=f.length)}else{if(intCheck(t,2,x.length,"Base"),10==t&&E)return B(p=new A(e),h+p.e+1,_);if(f=String(e),c="number"==typeof e){if(0*e!=0)return n(p,f,c,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,A.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(i=x.slice(0,t),u=s=0,l=f.length;s<l;s++)if(i.indexOf(o=f.charAt(s))<0){if("."==o){if(s>u){u=l;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,s=-1,u=0;continue}return n(p,String(e),c,t)}c=!1,(u=(f=r(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(s=0;48===f.charCodeAt(s);s++);for(l=f.length;48===f.charCodeAt(--l););if(f=f.slice(s,++l)){if(l-=s,c&&A.DEBUG&&l>15&&(e>MAX_SAFE_INTEGER||e!==mathfloor(e)))throw Error(tooManyDigits+p.s*e);if((u=u-s-1)>g)p.c=p.e=null;else if(u<d)p.c=[p.e=0];else{if(p.e=u,p.c=[],s=(u+1)%LOG_BASE,u<0&&(s+=LOG_BASE),s<l){for(s&&p.c.push(+f.slice(0,s)),l-=LOG_BASE;s<l;)p.c.push(+f.slice(s,s+=LOG_BASE));s=LOG_BASE-(f=f.slice(s)).length}else s-=l;for(;s--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function N(e,t,r,n){var i,o,a,u,s;if(null==r?r=_:intCheck(r,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)s=coeffToString(e.c),s=1==n||2==n&&(a<=v||a>=m)?toExponential(s,a):toFixedPoint(s,a,"0");else if(o=(e=B(new A(e),t,r)).e,u=(s=coeffToString(e.c)).length,1==n||2==n&&(t<=o||o<=v)){for(;u<t;s+="0",u++);s=toExponential(s,o)}else if(t-=a,s=toFixedPoint(s,o,"0"),o+1>u){if(--t>0)for(s+=".";t--;s+="0");}else if((t+=o-u)>0)for(o+1==u&&(s+=".");t--;s+="0");return e.s<0&&i?"-"+s:s}function O(e,t){for(var r,n=1,i=new A(e[0]);n<e.length;n++){if(!(r=new A(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function k(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*LOG_BASE-1)>g?e.c=e.e=null:r<d?e.c=[e.e=0]:(e.e=r,e.c=t),e}function B(e,t,r,n){var i,o,a,u,s,c,l,f=e.c,p=POWS_TEN;if(f){e:{for(i=1,u=f[0];u>=10;u/=10,i++);if((o=t-i)<0)o+=LOG_BASE,a=t,l=(s=f[c=0])/p[i-a-1]%10|0;else if((c=mathceil((o+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));s=l=0,i=1,a=(o%=LOG_BASE)-LOG_BASE+1}else{for(s=u=f[c],i=1;u>=10;u/=10,i++);l=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:s/p[i-a-1]%10|0}if(n=n||t<0||null!=f[c+1]||(a<0?s:s%p[i-a-1]),n=r<4?(l||n)&&(0==r||r==(e.s<0?3:2)):l>5||5==l&&(4==r||n||6==r&&(o>0?a>0?s/p[i-a]:0:f[c-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=p[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=c,u=1,c--):(f.length=c+1,u=p[LOG_BASE-o],f[c]=a>0?mathfloor(s/p[i-a]%p[a])*u:0),n)for(;;){if(0==c){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);o!=u&&(e.e++,f[0]==BASE&&(f[0]=1));break}if(f[c]+=u,f[c]!=BASE)break;f[c--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>g?e.c=e.e=null:e.e<d&&(e.c=[e.e=0])}return e}function T(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=v||r>=m?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return A.clone=clone,A.ROUND_UP=0,A.ROUND_DOWN=1,A.ROUND_CEIL=2,A.ROUND_FLOOR=3,A.ROUND_HALF_UP=4,A.ROUND_HALF_DOWN=5,A.ROUND_HALF_EVEN=6,A.ROUND_HALF_CEIL=7,A.ROUND_HALF_FLOOR=8,A.EUCLID=9,A.config=A.set=function(e){var t,r;if(null!=e){if("object"!=_typeof(e))throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(intCheck(r=e[t],0,MAX,t),h=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(intCheck(r=e[t],0,8,t),_=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(intCheck(r[0],-MAX,0,t),intCheck(r[1],0,MAX,t),v=r[0],m=r[1]):(intCheck(r,-MAX,MAX,t),v=-(m=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)intCheck(r[0],-MAX,-1,t),intCheck(r[1],1,MAX,t),d=r[0],g=r[1];else{if(intCheck(r,-MAX,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);d=-(g=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(bignumberError+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw b=!r,Error(bignumberError+"crypto unavailable");b=r}else b=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),y=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),w=r),e.hasOwnProperty(t="FORMAT")){if("object"!=_typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);S=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);E="0123456789"==r.slice(0,10),x=r}}return{DECIMAL_PLACES:h,ROUNDING_MODE:_,EXPONENTIAL_AT:[v,m],RANGE:[d,g],CRYPTO:b,MODULO_MODE:y,POW_PRECISION:w,FORMAT:S,ALPHABET:x}},A.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!A.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-MAX&&i<=MAX&&i===mathfloor(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=BASE||r!==mathfloor(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},A.maximum=A.max=function(){return O(arguments,f.lt)},A.minimum=A.min=function(){return O(arguments,f.gt)},A.random=(i=9007199254740992,o=Math.random()*i&2097151?function(){return mathfloor(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,a,u=0,s=[],c=new A(p);if(null==e?e=h:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),b)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(a=131072*t[u]+(t[u+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[u]=r[0],t[u+1]=r[1]):(s.push(a%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw b=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(i*=7);u<i;)(a=281474976710656*(31&t[u])+1099511627776*t[u+1]+4294967296*t[u+2]+16777216*t[u+3]+(t[u+4]<<16)+(t[u+5]<<8)+t[u+6])>=9e15?crypto.randomBytes(7).copy(t,u):(s.push(a%1e14),u+=7);u=i/7}if(!b)for(;u<i;)(a=o())<9e15&&(s[u++]=a%1e14);for(i=s[--u],e%=LOG_BASE,i&&e&&(a=POWS_TEN[LOG_BASE-e],s[u]=mathfloor(i/a)*a);0===s[u];s.pop(),u--);if(u<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(u=1,a=s[0];a>=10;a/=10,u++);u<LOG_BASE&&(n-=LOG_BASE-u)}return c.e=n,c.c=s,c}),A.sum=function(){for(var e=1,t=arguments,r=new A(t[0]);e<t.length;)r=r.plus(t[e++]);return r},r=function(){var e="0123456789";function r(e,t,r,n){for(var i,o,a=[0],u=0,s=e.length;u<s;){for(o=a.length;o--;a[o]*=t);for(a[0]+=n.indexOf(e.charAt(u++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(n,i,o,a,u){var s,c,l,f,p,v,m,d,g=n.indexOf("."),b=h,y=_;for(g>=0&&(f=w,w=0,n=n.replace(".",""),v=(d=new A(i)).pow(n.length-g),w=f,d.c=r(toFixedPoint(coeffToString(v.c),v.e,"0"),10,o,e),d.e=d.c.length),l=f=(m=r(n,i,o,u?(s=x,e):(s=e,x))).length;0==m[--f];m.pop());if(!m[0])return s.charAt(0);if(g<0?--l:(v.c=m,v.e=l,v.s=a,m=(v=t(v,d,b,y,o)).c,p=v.r,l=v.e),g=m[c=l+b+1],f=o/2,p=p||c<0||null!=m[c+1],p=y<4?(null!=g||p)&&(0==y||y==(v.s<0?3:2)):g>f||g==f&&(4==y||p||6==y&&1&m[c-1]||y==(v.s<0?8:7)),c<1||!m[0])n=p?toFixedPoint(s.charAt(1),-b,s.charAt(0)):s.charAt(0);else{if(m.length=c,p)for(--o;++m[--c]>o;)m[c]=0,c||(++l,m=[1].concat(m));for(f=m.length;!m[--f];);for(g=0,n="";g<=f;n+=s.charAt(m[g++]));n=toFixedPoint(n,l,s.charAt(0))}return n}}(),t=function(){function e(e,t,r){var n,i,o,a,u=0,s=e.length,c=t%SQRT_BASE,l=t/SQRT_BASE|0;for(e=e.slice();s--;)u=((i=c*(o=e[s]%SQRT_BASE)+(n=l*o+(a=e[s]/SQRT_BASE|0)*c)%SQRT_BASE*SQRT_BASE+u)/r|0)+(n/SQRT_BASE|0)+l*a,e[s]=i%r;return u&&(e=[u].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,a,u){var s,c,l,f,p,h,_,v,m,d,g,b,y,w,S,x,E,N=n.s==i.s?1:-1,O=n.c,k=i.c;if(!(O&&O[0]&&k&&k[0]))return new A(n.s&&i.s&&(O?!k||O[0]!=k[0]:k)?O&&0==O[0]||!k?0*N:N/0:NaN);for(m=(v=new A(N)).c=[],N=o+(c=n.e-i.e)+1,u||(u=BASE,c=bitFloor(n.e/LOG_BASE)-bitFloor(i.e/LOG_BASE),N=N/LOG_BASE|0),l=0;k[l]==(O[l]||0);l++);if(k[l]>(O[l]||0)&&c--,N<0)m.push(1),f=!0;else{for(w=O.length,x=k.length,l=0,N+=2,(p=mathfloor(u/(k[0]+1)))>1&&(k=e(k,p,u),O=e(O,p,u),x=k.length,w=O.length),y=x,g=(d=O.slice(0,x)).length;g<x;d[g++]=0);E=k.slice(),E=[0].concat(E),S=k[0],k[1]>=u/2&&S++;do{if(p=0,(s=t(k,d,x,g))<0){if(b=d[0],x!=g&&(b=b*u+(d[1]||0)),(p=mathfloor(b/S))>1)for(p>=u&&(p=u-1),_=(h=e(k,p,u)).length,g=d.length;1==t(h,d,_,g);)p--,r(h,x<_?E:k,_,u),_=h.length,s=1;else 0==p&&(s=p=1),_=(h=k.slice()).length;if(_<g&&(h=[0].concat(h)),r(d,h,g,u),g=d.length,-1==s)for(;t(k,d,x,g)<1;)p++,r(d,x<g?E:k,g,u),g=d.length}else 0===s&&(p++,d=[0]);m[l++]=p,d[0]?d[g++]=O[y]||0:(d=[O[y]],g=1)}while((y++<w||null!=d[0])&&N--);f=null!=d[0],m[0]||m.splice(0,1)}if(u==BASE){for(l=1,N=m[0];N>=10;N/=10,l++);B(v,o+(v.e=l+c*LOG_BASE-1)+1,a,f)}else v.e=c,v.r=+f;return v}}(),a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,s=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,l=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,t,r,n){var i,o=r?t:t.replace(l,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(a,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(u,"$1").replace(s,"0.$1")),t!=o))return new A(o,i);if(A.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new A(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,t){return compare(this,new A(e,t))},f.decimalPlaces=f.dp=function(e,t){var r,n,i,o=this;if(null!=e)return intCheck(e,0,MAX),null==t?t=_:intCheck(t,0,8),B(new A(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},f.dividedBy=f.div=function(e,r){return t(this,new A(e,r),h,_)},f.dividedToIntegerBy=f.idiv=function(e,r){return t(this,new A(e,r),0,1)},f.exponentiatedBy=f.pow=function(e,t){var r,n,i,o,a,u,s,c,l=this;if((e=new A(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+T(e));if(null!=t&&(t=new A(t)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return c=new A(Math.pow(+T(l),a?e.s*(2-isOdd(e)):+T(e))),t?c.mod(t):c;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new A(NaN);(n=!u&&l.isInteger()&&t.isInteger())&&(l=l.mod(t))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return o=l.s<0&&isOdd(e)?-0:0,l.e>-1&&(o=1/o),new A(u?1/o:o);w&&(o=mathceil(w/LOG_BASE+2))}for(a?(r=new A(.5),u&&(e.s=1),s=isOdd(e)):s=(i=Math.abs(+T(e)))%2,c=new A(p);;){if(s){if(!(c=c.times(l)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=mathfloor(i/2)))break;s=i%2}else if(B(e=e.times(r),e.e+1,1),e.e>14)s=isOdd(e);else{if(0===(i=+T(e)))break;s=i%2}l=l.times(l),o?l.c&&l.c.length>o&&(l.c.length=o):n&&(l=l.mod(t))}return n?c:(u&&(c=p.div(c)),t?c.mod(t):o?B(c,w,_,undefined):c)},f.integerValue=function(e){var t=new A(this);return null==e?e=_:intCheck(e,0,8),B(t,t.e+1,e)},f.isEqualTo=f.eq=function(e,t){return 0===compare(this,new A(e,t))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,t){return compare(this,new A(e,t))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,t){return 1===(t=compare(this,new A(e,t)))||0===t},f.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},f.isLessThan=f.lt=function(e,t){return compare(this,new A(e,t))<0},f.isLessThanOrEqualTo=f.lte=function(e,t){return-1===(t=compare(this,new A(e,t)))||0===t},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,t){var r,n,i,o,a=this,u=a.s;if(t=(e=new A(e,t)).s,!u||!t)return new A(NaN);if(u!=t)return e.s=-t,a.plus(e);var s=a.e/LOG_BASE,c=e.e/LOG_BASE,l=a.c,f=e.c;if(!s||!c){if(!l||!f)return l?(e.s=-t,e):new A(f?a:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-t,e):new A(l[0]?a:3==_?-0:0)}if(s=bitFloor(s),c=bitFloor(c),l=l.slice(),u=s-c){for((o=u<0)?(u=-u,i=l):(c=s,i=f),i.reverse(),t=u;t--;i.push(0));i.reverse()}else for(n=(o=(u=l.length)<(t=f.length))?u:t,u=t=0;t<n;t++)if(l[t]!=f[t]){o=l[t]<f[t];break}if(o&&(i=l,l=f,f=i,e.s=-e.s),(t=(n=f.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=BASE-1;n>u;){if(l[--n]<f[n]){for(r=n;r&&!l[--r];l[r]=t);--l[r],l[n]+=BASE}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?k(e,l,c):(e.s=3==_?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,r){var n,i,o=this;return e=new A(e,r),!o.c||!e.s||e.c&&!e.c[0]?new A(NaN):!e.c||o.c&&!o.c[0]?new A(o):(9==y?(i=e.s,e.s=1,n=t(o,e,0,3),e.s=i,n.s*=i):n=t(o,e,0,y),(e=o.minus(n.times(e))).c[0]||1!=y||(e.s=o.s),e)},f.multipliedBy=f.times=function(e,t){var r,n,i,o,a,u,s,c,l,f,p,h,_,v,m,d=this,g=d.c,b=(e=new A(e,t)).c;if(!(g&&b&&g[0]&&b[0]))return!d.s||!e.s||g&&!g[0]&&!b||b&&!b[0]&&!g?e.c=e.e=e.s=null:(e.s*=d.s,g&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=bitFloor(d.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=d.s,(s=g.length)<(f=b.length)&&(_=g,g=b,b=_,i=s,s=f,f=i),i=s+f,_=[];i--;_.push(0));for(v=BASE,m=SQRT_BASE,i=f;--i>=0;){for(r=0,p=b[i]%m,h=b[i]/m|0,o=i+(a=s);o>i;)r=((c=p*(c=g[--a]%m)+(u=h*c+(l=g[a]/m|0)*p)%m*m+_[o]+r)/v|0)+(u/m|0)+h*l,_[o--]=c%v;_[o]=r}return r?++n:_.splice(0,1),k(e,_,n)},f.negated=function(){var e=new A(this);return e.s=-e.s||null,e},f.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new A(e,t)).s,!i||!t)return new A(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/LOG_BASE,a=e.e/LOG_BASE,u=n.c,s=e.c;if(!o||!a){if(!u||!s)return new A(i/0);if(!u[0]||!s[0])return s[0]?e:new A(u[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),u=u.slice(),i=o-a){for(i>0?(a=o,r=s):(i=-i,r=u),r.reverse();i--;r.push(0));r.reverse()}for((i=u.length)-(t=s.length)<0&&(r=s,s=u,u=r,t=i),i=0;t;)i=(u[--t]=u[t]+s[t]+i)/BASE|0,u[t]=BASE===u[t]?0:u[t]%BASE;return i&&(u=[i].concat(u),++a),k(e,u,a)},f.precision=f.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=_:intCheck(t,0,8),B(new A(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*LOG_BASE+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},f.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,r,n,i,o,a=this,u=a.c,s=a.s,c=a.e,l=h+4,f=new A("0.5");if(1!==s||!u||!u[0])return new A(!s||s<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(s=Math.sqrt(+T(a)))||s==1/0?(((r=coeffToString(u)).length+c)%2==0&&(r+="0"),s=Math.sqrt(+r),c=bitFloor((c+1)/2)-(c<0||c%2),n=new A(r=s==1/0?"5e"+c:(r=s.toExponential()).slice(0,r.indexOf("e")+1)+c)):n=new A(s+""),n.c[0])for((s=(c=n.e)+l)<3&&(s=0);;)if(o=n,n=f.times(o.plus(t(a,o,l,1))),coeffToString(o.c).slice(0,s)===(r=coeffToString(n.c)).slice(0,s)){if(n.e<c&&--s,"9999"!=(r=r.slice(s-3,s+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(B(n,n.e+h+2,1),e=!n.times(n).eq(a));break}if(!i&&(B(o,o.e+h+2,0),o.times(o).eq(a))){n=o;break}l+=4,s+=4,i=1}return B(n,n.e+h+1,_,e)},f.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),N(this,e,t,1)},f.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),N(this,e,t)},f.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==_typeof(t)?(r=t,t=null):e&&"object"==_typeof(e)?(r=e,e=t=null):r=S;else if("object"!=_typeof(r))throw Error(bignumberError+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,a=n.split("."),u=+r.groupSize,s=+r.secondaryGroupSize,c=r.groupSeparator||"",l=a[0],f=a[1],p=i.s<0,h=p?l.slice(1):l,_=h.length;if(s&&(o=u,u=s,s=o,_-=o),u>0&&_>0){for(o=_%u||u,l=h.substr(0,o);o<_;o+=u)l+=c+h.substr(o,u);s>0&&(l+=c+h.slice(o)),p&&(l="-"+l)}n=f?l+(r.decimalSeparator||"")+((s=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):l}return(r.prefix||"")+n+(r.suffix||"")},f.toFraction=function(e){var r,n,i,o,a,u,s,c,l,f,h,v,m=this,d=m.c;if(null!=e&&(!(s=new A(e)).isInteger()&&(s.c||1!==s.s)||s.lt(p)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+T(s));if(!d)return new A(m);for(r=new A(p),l=n=new A(p),i=c=new A(p),v=coeffToString(d),a=r.e=v.length-m.e-1,r.c[0]=POWS_TEN[(u=a%LOG_BASE)<0?LOG_BASE+u:u],e=!e||s.comparedTo(r)>0?a>0?r:l:s,u=g,g=1/0,s=new A(v),c.c[0]=0;f=t(s,r,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,l=c.plus(f.times(o=l)),c=o,r=s.minus(f.times(o=r)),s=o;return o=t(e.minus(n),i,0,1),c=c.plus(o.times(l)),n=n.plus(o.times(i)),c.s=l.s=m.s,h=t(l,i,a*=2,_).minus(m).abs().comparedTo(t(c,n,a,_).minus(m).abs())<1?[l,i]:[c,n],g=u,h},f.toNumber=function(){return+T(this)},f.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),N(this,e,t,2)},f.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=v||o>=m?toExponential(coeffToString(n.c),o):toFixedPoint(coeffToString(n.c),o,"0"):10===e&&E?t=toFixedPoint(coeffToString((n=B(new A(n),h+o+1,_)).c),n.e,"0"):(intCheck(e,2,x.length,"Base"),t=r(toFixedPoint(coeffToString(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},f.valueOf=f.toJSON=function(){return T(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=e&&A.set(e),A}function bitFloor(e){var t=0|e;return e>0||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare(e,t){var r,n,i=e.c,o=t.c,a=e.s,u=t.s,s=e.e,c=t.e;if(!a||!u)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-u:a;if(a!=u)return a;if(r=a<0,n=s==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return s>c^r?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,a=0;a<u;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return s==c?0:s>c^r?1:-1}function intCheck(e,t,r,n){if(e<t||e>r||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var t=e.c.length-1;return bitFloor(e.e/LOG_BASE)==t&&e.c[t]%2!=0}function toExponential(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();function format(e,t){var r="";if("undefined"===(r=BigNumber.isBigNumber(e)?e.toFixed():"string"==typeof e?e:e.toString())||"NaN"===r)return[void 0,{}];var n={mantissa:null,mantissa_type:null,thousands:!1,sign:!1,round:"~-",scientific:!1,fraction:!1,percent:!1,to_number:!1,to_number_string:!1};if(t.forEach((function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);n.mantissa_type=e.value}else if("to-number"===t)n.to_number=!0;else if("to-number-string"===t)n.to_number_string=!0;else if("comma"===t)n.thousands=!0;else if("number"===t)n.mantissa=e.value;else if("var"===t)n.mantissa=e.real_value;else if("plus"===t)n.sign=!0;else if("round"===t)n.round=e.value;else if("fraction"===t)n.fraction=!0;else if("scientific"===t)n.scientific=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");n.percent=!0}})),n.to_number)return[+parse_mantissa(r,n.mantissa_type,n.mantissa,n.round),n];if(n.scientific){var i=BigNumber(r).toExponential();return[n.sign&&!i.startsWith("-")?"+"+i:i,n]}if(n.fraction){var o=BigNumber(r).toFraction().map((function(e){return e.toFixed()})).join("/");return[n.sign&&!o.startsWith("-")?"+"+o:o,n]}return n.percent&&(r=BigNumber(r).times(100).toFixed()),null===n.mantissa?r.includes(".")&&(r=r.replace(/0*$/,"")):r=parse_mantissa(r,n.mantissa_type,n.mantissa,n.round),n.thousands&&(r=parse_thousands(r)),n.sign&&(n.to_number=!1,r.startsWith("-")||(r="+"+r)),n.percent&&(r+="%"),[r,n]}function close_important_push(){}function open_important_push(){}function open_debug(){}function close_debug(){}function calc_wrap(e,t){var r={_error:"-"};return["string","number"].includes(_typeof(e))?void 0===t?/[a-zA-Z$_]/.test(e.toString())?function(t){return Array.isArray(t)?t.unshift(r):t=_objectSpread2(_objectSpread2({},r),t),calc(e,t)}:calc(e):(Array.isArray(t)?t.unshift(r):t=_objectSpread2(_objectSpread2({},r),t),calc(e,t)):(Array.isArray(e)?e.unshift(r):e=_objectSpread2(_objectSpread2({},r),e),function(t){return calc(t,e)})}function check_version(){return _check_version.apply(this,arguments)}function _check_version(){return _check_version=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var res,code,versions,last_version,larr,varr,script,url;return _regeneratorRuntime().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:if("undefined"==typeof process||"node"!==process.release.name){_context.next=19;break}if(!(parseInt(process.versions.node)>=17)){_context.next=17;break}return _context.next=4,promise_queue([fetch("https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js"),fetch("https://unpkg.com/a-calc@latest/a-calc.versions.js")]);case 4:return res=_context.sent,_context.next=7,res.text();case 7:code=_context.sent,versions=eval(code),last_version=versions.at(-1),larr=last_version.match(/(\d+)\.(\d+)\.(\d+)/),larr.shift(),larr=larr.map((function(e){return parseInt(e)})),varr=version.match(/(\d+)\.(\d+)\.(\d+)/),varr.shift(),varr=varr.map((function(e){return parseInt(e)})),(larr[0]>varr[0]||larr[0]===varr[0]&&larr[1]>varr[1]||larr[0]===varr[0]&&larr[1]===varr[1]&&larr[2]>varr[2])&&console.warn("a-calc has a new version:",last_version);case 17:_context.next=25;break;case 19:return script=document.createElement("script"),script.onload=function(){var e=a_calc_versions;if(Array.isArray(e)){var t=e.at(-1),r=t.match(/(\d+)\.(\d+)\.(\d+)/);r.shift(),r=r.map((function(e){return parseInt(e)}));var n=version.match(/(\d+)\.(\d+)\.(\d+)/);n.shift(),n=n.map((function(e){return parseInt(e)})),(r[0]>n[0]||r[0]===n[0]&&r[1]>n[1]||r[0]===n[0]&&r[1]===n[1]&&r[2]>n[2])&&console.log("%c↑↑↑ a-calc has a new version: %s ↑↑↑","color: #67C23A;",t)}},_context.next=23,test_urls(["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"]);case 23:url=_context.sent,url?(script.src=url,document.body.appendChild(script)):script=null;case 25:case"end":return _context.stop()}}),_callee)}))),_check_version.apply(this,arguments)}var operator=new Set(["+","-","*","/","%","**","//"]);function push_token$2(e,t,r){if(Number.isNaN(Number(t)))if("-"===t||"+"===t)0===e.length||"operator"===e.at(-1).type||"("===e.at(-1).value?e.push({type:"number",value:t,real_value:t,has_unit:!1}):e.push({type:"operator",value:t});else if(operator.has(t))e.push({type:"operator",value:t});else if(r._unit&&/^[+-]?\d/.test(t)){var n,i=split_unit_num(t),o=i.num,a=i.unit;if(void 0===a)e.push({type:"number",value:o,real_value:o,has_unit:!1});else r.has_unit=!0,null!==(n=r.unit_str)&&void 0!==n||(r.unit_str=a),e.push({type:"number",value:o,real_value:o,has_unit:!0,unit:a})}else if(var_first_char.includes(t[0])){r.has_var=!0;var u=get_real_value(r.fill_data,t);if(r._unit){var s,c=split_unit_num(u),l=c.num,f=c.unit;if(void 0===f)e.push({type:"var",value:t,real_value:l,has_unit:!1});else r.has_unit=!0,null!==(s=r.unit_str)&&void 0!==s||(r.unit_str=f),e.push({type:"var",value:t,real_value:l,has_unit:!0,unit:f})}else e.push({type:"var",value:t,real_value:u,has_unit:!1})}else{if(!/^[+-]?\d/.test(t))throw new Error("无法识别的标识符:".concat(t));var p=t.indexOf("e");-1!==p&&/^\d+$/.test(t.slice(p+1))&&e.push({type:"number",value:t,real_value:t,has_unit:!1})}else e.push({type:"number",value:t,real_value:t,has_unit:!1})}function tokenizer_space(e,t,r){for(var n,i=0,o=0,a=e.length,u=[],s={has_var:!1,has_unit:!1,unit_str:void 0,_unit:r,fill_data:t};o<a;)" "===(n=e[o])?(o>i&&push_token$2(u,e.slice(i,o),s),i=o+1):"("===n?(u.push({type:state_bracket,value:"("}),i=o+1):")"===n&&(o>i&&push_token$2(u,e.slice(i,o),s),u.push({type:state_bracket,value:")"}),i=o+1),o++;return o>i&&push_token$2(u,e.slice(i,o),s),u.has_var=s.has_var,u.has_unit=s.has_unit,u.unit=s.unit_str,u}function compute(e,t,r){if(void 0===e||void 0===t)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(t));switch(r){case"+":return new BigNumber(e).plus(t);case"-":return new BigNumber(e).minus(t);case"*":return new BigNumber(e).times(t);case"/":return new BigNumber(e).div(t);case"%":return new BigNumber(e).mod(t);case"**":return new BigNumber(e).pow(t);case"//":return new BigNumber(e).idiv(t)}}var operator_map$1={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens(e){if(1===e.length){var t=e[0];if("number"===t.type||"var"===t.type)return t.real_value;throw new Error("错误的表达式:".concat(t.value))}for(var r,n,i=[],o=[],a=0,u=e.length;a<u;a++)if("number"!==(r=e[a]).type&&"var"!==r.type)if("operator"!==r.type)if("("!==r.value){if(")"===r.value)for(var s=void 0;s=i.pop();){if("("===s){var c=o.at(-2);if("-"===c){var l=o.pop();o.pop(),o.push(BigNumber.isBigNumber(l)?l.negated():new BigNumber(l).negated())}else if("+"===c){var f=o.pop();o.pop(),o.push(f)}break}var p=o.pop(),h=o.pop();o.push(compute(h,p,s))}}else i.push("(");else{var _=i.at(-1);if("("===_){i.push(r.value);continue}var v=operator_map$1[r.value];if(!i.length){i.push(r.value);continue}if(v<operator_map$1[_])for(var m=void 0;m=i.pop();){if("("===m){i.push("(");break}var d=o.pop(),g=o.pop();o.push(compute(g,d,m))}else if(v===operator_map$1[_]){if("**"===r.value){i.push(r.value);continue}for(var b=void 0;b=i.pop();){if("("===b){i.push("(");break}if(operator_map$1[b]<v){i.push(b);break}var y=o.pop(),w=o.pop();o.push(compute(w,y,b))}}i.push(r.value)}else o.push(r.real_value);for(;n=i.pop();){var S=o.pop(),x=o.pop();o.push(compute(x,S,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return e.has_var||(e.calc_result=o[0]),o[0]}function push_token$1(e,t,r,n,i){t===state_var?(i.has_var=!0,e.push({type:t,value:r,real_value:get_real_value(i.fill_data,r)})):e.push({type:t,value:r}),n.prev=n.curr,i.state=state_initial}function fmt_tokenizer(e,t){for(var r,n={prev:0,curr:0},i=e.length,o={state:state_initial,fill_data:t,has_var:!1},a=[];n.curr<i;)switch(r=e[n.curr],o.state){case state_initial:if(" "===r)n.curr++,n.prev=n.curr;else if("<>=".includes(r))o.state=state_symbol,n.curr++;else if(","===r)n.curr++,push_token$1(a,state_comma,",",n,o);else if(var_char.includes(r))o.state=state_var,n.curr++;else if(number_char.includes(r))o.state=state_number,n.curr++;else if("+"===r)n.curr++,push_token$1(a,state_plus$1,"+",n,o);else if("~"===r)n.curr++,o.state=state_round;else if("%"===r)n.curr++,push_token$1(a,state_percent,"%",n,o);else if("/"===r)n.curr++,push_token$1(a,state_fraction,"/",n,o);else if("!"===r)if(o.state=state_initial,n.curr++,"n"===e[n.curr])n.curr++,push_token$1(a,state_to_number,"!n",n,o);else if("u"===e[n.curr])n.curr++,push_token$1(a,state_to_number_string,"!u",n,o);else{if("e"!==e[n.curr])throw new Error("无法识别的!模式字符:".concat(e[n.curr]));n.curr++,push_token$1(a,state_scientific,"!e",n,o)}else n.curr++,n.prev=n.curr;break;case state_symbol:"="===r&&n.curr++,push_token$1(a,state_symbol,e.slice(n.prev,n.curr),n,o);break;case state_number:number_char.includes(r)?n.curr++:push_token$1(a,state_number,e.slice(n.prev,n.curr),n,o);break;case state_var:var_members_char.includes(r)?n.curr++:push_token$1(a,state_var,e.slice(n.prev,n.curr),n,o);break;case state_round:if(!("56+-".includes(r)&&n.curr-n.prev<2))throw new Error("错误的舍入语法:".concat(e.slice(n.prev,n.curr+1)));n.curr++,push_token$1(a,state_round,e.slice(n.prev,n.curr),n,o);break;default:throw new Error("错误的fmt分词器状态")}return n.prev<n.curr&&push_token$1(a,o.state,e.slice(n.prev,n.curr),n,o),a.has_var=o.has_var,a}var symbol_set=new Set(["<",">","=",">=","<="]),rand_set=new Set(["~+","~-","~5","~6"]);function push_token(e,t,r){if(","===t)e.push({type:state_comma,value:","});else if(symbol_set.has(t))e.push({type:state_symbol,value:t});else if(Number.isNaN(Number(t)))if(var_first_char.includes(t[0]))r.has_var=!0,e.push({type:state_var,value:t,real_value:get_real_value(r.fill_data,t)});else if("%"===t)e.push({type:state_percent,value:t});else if("/"===t)e.push({type:state_fraction,value:t});else if("+"===t)e.push({type:state_plus,value:t});else if(rand_set.has(t))e.push({type:state_round,value:t});else if("!n"===t)e.push({type:state_to_number,value:t});else if("!u"===t)e.push({type:state_to_number_string,value:t});else{if("!e"!==t)throw new Error("无法识别的格式化字符: ".concat(t));e.push({type:state_scientific,value:t})}else e.push({type:state_number,value:t})}function fmt_tokenizer_space(e,t){for(var r,n=0,i=e.length,o={fill_data:t,has_var:!1},a=0,u=[];n<i;)" "===(r=e[n])?(n>a&&push_token(u,e.slice(a,n),o),a=n+1):"<>=".includes(r)&&("="===e[n+1]?(u.push({type:state_symbol,value:r+"="}),a=1+ ++n):(u.push({type:state_symbol,value:r}),a=n+1)),n++;return a<n&&push_token(u,e.slice(a,n),o),u.has_var=o.has_var,u}function compute_lite(e,t,r){switch(r){case"+":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).plus(t);case"-":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).minus(t);case"*":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).times(t);case"/":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).div(t);case"%":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).mod(t);case"**":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).pow(t);case"//":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).idiv(t)}}var operator_map={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens_lite(e,t){for(var r,n,i=[],o=[],a=0,u=e.length;a<u;a++){var s=(r=e[a])[0];if(var_first_char.includes(s))o.push(get_real_value(t,r));else if(operator_set.has(r)){var c=i.at(-1);if("("===c){i.push(r);continue}var l=operator_map[r];if(!i.length){i.push(r);continue}var f=operator_map[c];if(l<f)for(var p=i.at(-1);p&&"("!==p;){i.pop();var h=o.pop(),_=o.pop();o.push(compute_lite(_,h,p)),p=i.at(-1)}else if(l===f){if("**"===r){i.push(r);continue}for(var v=i.at(-1);v&&!(operator_map[v]<l||"("===v);){i.pop();var m=o.pop(),d=o.pop();o.push(compute_lite(d,m,v)),v=i.at(-1)}}i.push(r)}else if(number_first_char.includes(s))o.push(r);else if("("!==r){if(")"===r)for(var g=void 0;(g=i.pop())&&"("!==g;){var b=o.pop(),y=o.pop();o.push(compute_lite(y,b,g))}}else i.push("(")}for(;n=i.pop();){var w=o.pop(),S=o.pop();o.push(compute_lite(S,w,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return o[0]}function calc_lite(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"-";try{var i;if("number"==typeof e)i=e.toString();else{if(""===e)throw new Error("非法的空计算式");var o=e.split(" ");if(1===o.length){if(i=o[0],var_first_char.includes(i[0])&&(i=get_real_value(r,i)),isNaN(Number(i)))throw new Error("错误的计算式:".concat(e))}else i=eval_tokens_lite(o,r).toFixed()}if("string"==typeof t&&""!==t){var a=fmt_tokenizer(t,r);if(void 0!==a)i=_slicedToArray(format(i,a),1)[0]}if("NaN"===i||"Infinity"===i)throw new Error("计算环节出错");return i}catch(e){return n}}function calc_mini(e,t,r){switch(t){case"+":return BigNumber(e).plus(r).toFixed();case"-":return BigNumber(e).minus(r).toFixed();case"*":return BigNumber(e).times(r).toFixed();case"/":return BigNumber(e).div(r).toFixed();case"%":return BigNumber(e).mod(r).toFixed();case"**":return BigNumber(e).pow(r).toFixed();case"//":return BigNumber(e).idiv(r).toFixed()}}function calc(e,t){var r=find_value(t,"_error");try{var n,i,o,a,u,s=parse_args(e,t),c=s._unit,l=s._mode,f="space"===l||"space-all"===l?tokenizer_space(s.expr,s.fill_data,c):tokenizer(s.expr,s.fill_data,c),p=eval_tokens(f),h=BigNumber.isBigNumber(p)?p:new BigNumber(p);if("space-all"===l?(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer_space(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer_space(s._fmt,s.fill_data)):(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer(s._fmt,s.fill_data)),void 0===a?void 0!==u&&(a=u):void 0!==u&&(a=[].concat(_toConsumableArray(u),_toConsumableArray(a))),void 0===a)h=h.toFixed();else{var _=_slicedToArray(format(h,a),2);h=_[0],o=_[1]}if("Infinity"===h||"NaN"===h||void 0===h)throw new Error("计算错误可能是非法的计算式");return!f.has_unit||null!==(n=o)&&void 0!==n&&n.to_number||null!==(i=o)&&void 0!==i&&i.to_number_string||(h+=f.unit),h}catch(e){if(void 0===r)throw e;return r}}function check_update(){check_version().catch((function(){}))}function print_version(){console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")}var calc_util={check_update:check_update,print_version:print_version,open_debug:open_debug,close_debug:close_debug,close_important_push:close_important_push,open_important_push:open_important_push},fmt=calc;function plus(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).plus(t).toNumber():new BigNumber(e).plus(t).toFixed()}function sub(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).minus(t).toNumber():new BigNumber(e).minus(t).toFixed()}function mul(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).times(t).toNumber():new BigNumber(e).times(t).toFixed()}function div(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).div(t).toNumber():new BigNumber(e).div(t).toFixed()}function mod(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).mod(t).toNumber():new BigNumber(e).mod(t).toFixed()}function pow(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).pow(t).toNumber():new BigNumber(e).pow(t).toFixed()}function idiv(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).idiv(t).toNumber():new BigNumber(e).idiv(t).toFixed()}exports.calc=calc,exports.calc_lite=calc_lite,exports.calc_mini=calc_mini,exports.calc_util=calc_util,exports.calc_wrap=calc_wrap,exports.div=div,exports.fmt=fmt,exports.idiv=idiv,exports.mod=mod,exports.mul=mul,exports.parse_thousands=parse_thousands,exports.plus=plus,exports.pow=pow,exports.sub=sub,exports.version=version;
|
|
1
|
+
"use strict";function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,a,u=[],s=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return u}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function c(e,t,r,i){var o=t&&t.prototype instanceof p?t:p,a=Object.create(o.prototype),u=new A(i||[]);return n(a,"_invoke",{value:w(e,r,u)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function p(){}function h(){}function _(){}var v={};s(v,o,(function(){return this}));var m=Object.getPrototypeOf,d=m&&m(m(N([])));d&&d!==t&&r.call(d,o)&&(v=d);var g=_.prototype=p.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function y(e,t){function i(n,o,a,u){var s=l(e[n],e,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?t.resolve(f.__await).then((function(e){i("next",e,a,u)}),(function(e){i("throw",e,a,u)})):t.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,u)}))}u(s.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function w(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var u=S(a,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function S(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var i=l(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function N(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=_,n(g,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:h,configurable:!0}),h.displayName=s(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,s(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(y.prototype),s(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new y(c(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),s(g,u,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=N,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=r.call(o,"catchLoc"),s=r.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:N(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function asyncGeneratorStep(e,t,r,n,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,i)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){asyncGeneratorStep(o,n,i,a,u,"next",e)}function u(e){asyncGeneratorStep(o,n,i,a,u,"throw",e)}a(void 0)}))}}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:String(t)}var version="2.2.12";function decimal_round(e,t,r,n,i){var o=e,a=t,u=t.length,s={"~-":function(){var e="<"===r?n-1:n;a=t.slice(0,e)},"~+":function(){var e="<"===r?n-1:n;if(!(u<=e||0===u)){var i=t.slice(0,e);0==+t.slice(e,u)?a=i:(i=(+"9".concat(i)+1).toString().slice(1)).length>e?(a=i.slice(1,i.length),o=(+o+1).toString()):a=i}},"~5":function(){if(0!==u){var e="<"===r?n-1:n;a=t.slice(0,e);var i=+t[e];Number.isNaN(i)||i>=5&&(a=(+"9".concat(a)+1).toString().slice(1)).length>e&&(a=a.slice(1,a.length),o=(+o+1).toString())}},"~6":function(){if(0!==u){var i,s="<"===r?n-1:n,c=+t[s],l=t.slice(+s+1,t.length);l=""===l?0:parseInt(l),i=0===s?+e[e.length-1]:+t[s-1],a=t.slice(0,s),(c>=6||5===c&&l>0||5===c&&i%2!=0)&&(a=(+"9".concat(a)+1).toString().slice(1)).length>s&&(a=a.slice(1,a.length),o=(+o+1).toString())}}};return"<="===r?u<=n?a=t.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"<"===r?u<n?a=t.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"="===r?u<n?a=t+"0".repeat(n-u):u>n&&s[i]&&s[i]():">="===r?u<n&&(a=t+"0".repeat(n-u)):">"===r&&u<=n&&(a=t+"0".repeat(n-u+1)),{int_part:o,dec_part:a}}var number_char="0123456789",var_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",number_first_char="0123456789-+",var_members_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$[].'\"",var_first_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",pure_number_var_first_char="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",empty_char=" \n\r\t",state_initial="initial",state_number="number",state_scientific="scientific",state_operator="operator",state_bracket="bracket",state_var="var",state_symbol="symbol",state_percent="percent",state_round="round",state_plus$1="plus",state_comma="comma",state_fraction="fraction",state_to_number="to-number",state_to_number_string="to-number-string",operator_set=new Set(["+","-","*","/","%","**","//"]),isArray=Array.isArray,isArray$1=isArray,freeGlobal="object"==("undefined"==typeof global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,freeGlobal$1=freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root=freeGlobal$1||freeSelf||Function("return this")(),root$1=root,_Symbol=root$1.Symbol,_Symbol$1=_Symbol,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol$1?_Symbol$1.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty$3.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$1?_Symbol$1.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return null!=e&&"object"==_typeof(e)}var symbolTag="[object Symbol]";function isSymbol(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag(e)==symbolTag}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray$1(e))return!1;var r=_typeof(e);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}function isObject(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var coreJsData=root$1["__core-js_shared__"],coreJsData$1=coreJsData,maskSrcKey=(uid=/[^.]+$/.exec(coreJsData$1&&coreJsData$1.keys&&coreJsData$1.keys.IE_PROTO||""),uid?"Symbol(src)_1."+uid:""),uid;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,t){return null==e?void 0:e[t]}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}var nativeCreate=getNative(Object,"create"),nativeCreate$1=nativeCreate;function hashClear(){this.__data__=nativeCreate$1?nativeCreate$1(null):{},this.size=0}function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet(e){var t=this.__data__;if(nativeCreate$1){var r=t[e];return r===HASH_UNDEFINED$1?void 0:r}return hasOwnProperty$1.call(t,e)?t[e]:void 0}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty.call(t,e)}var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate$1&&void 0===t?HASH_UNDEFINED:t,this}function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,t){return e===t||e!=e&&t!=t}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),--this.size,!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map=getNative(root$1,"Map"),Map$1=Map;function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=t?1:0,t}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT="Expected a function";function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function r(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(memoize.Cache||MapCache),r}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize(e,(function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e})),r=t.cache;return t}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,(function(e,r,n,i){t.push(n?i.replace(reEscapeChar,"$1"):r||e)})),t})),stringToPath$1=stringToPath;function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var INFINITY$1=1/0,symbolProto=_Symbol$1?_Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray$1(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-INFINITY$1?"-0":t}function toString(e){return null==e?"":baseToString(e)}function castPath(e,t){return isArray$1(e)?e:isKey(e,t)?[e]:stringToPath$1(toString(e))}var INFINITY=1/0;function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-INFINITY?"-0":t}function baseGet(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function get(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}function split_unit_num(e){for(var t,r,n,i=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],o=0;o<i.length;o++){var a=e.match(i[o]);if(a){n=a;break}}if(n){r=n[1];var u=n[2];""!==u.trim()&&(t=u)}return{num:r,unit:t}}function find_value(e,t,r){var n,i,o,a;return Array.isArray(e)?e.length>1?null!==(n=null!==(i=get(e[0],t))&&void 0!==i?i:get(e.at(-1),t))&&void 0!==n?n:r:1===e.length&&null!==(o=get(e[0],t))&&void 0!==o?o:r:null!==(a=get(e,t,r))&&void 0!==a?a:r}function parse_mantissa(e,t,r,n){var i=e.split("."),o=i[0],a=1===i.length?"":i[1],u=decimal_round(o,a,t,+r,n);return o=u.int_part,""===(a=u.dec_part)?o:"".concat(o,".").concat(a)}function integer_thousands(e){for(var t=e.length,r="";t>0;)r=e.substring(t-3,t)+(""!==r?",":"")+r,t-=3;return r}function parse_thousands(e){var t=e.split("."),r=t[0];return"-"===r[0]?t[0]="-"+integer_thousands(r.slice(1)):t[0]=integer_thousands(r),t.join(".")}function promise_queue(e){return _promise_queue.apply(this,arguments)}function _promise_queue(){return _promise_queue=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,o=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=o.length>1&&void 0!==o[1]?o[1]:5e3,n=0;case 2:if(!(n<t.length)){e.next=16;break}return e.prev=3,e.next=6,Promise.race([t[n],new Promise((function(e,t){setTimeout((function(){return t(new Error("promise queue timeout err"))}),r)}))]);case 6:i=e.sent,e.next=12;break;case 9:return e.prev=9,e.t0=e.catch(3),e.abrupt("continue",13);case 12:return e.abrupt("return",i);case 13:n++,e.next=2;break;case 16:return e.abrupt("return",Promise.reject("错误的 promise queue 调用"));case 17:case"end":return e.stop()}}),e,null,[[3,9]])}))),_promise_queue.apply(this,arguments)}function test_urls(e){return _test_urls.apply(this,arguments)}function _test_urls(){return(_test_urls=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=0;case 1:if(!(r<t.length)){e.next=16;break}return e.prev=2,e.next=5,fetch(t[r]);case 5:if(!e.sent.ok){e.next=8;break}return e.abrupt("return",t[r]);case 8:e.next=13;break;case 10:return e.prev=10,e.t0=e.catch(2),e.abrupt("continue",13);case 13:r++,e.next=1;break;case 16:return e.abrupt("return",null);case 17:case"end":return e.stop()}}),e,null,[[2,10]])})))).apply(this,arguments)}function get_real_value(e,t){if(Array.isArray(e)){for(var r,n=0,i=e.length;n<i;n++){var o;if(void 0!==(r=null!==(o=get(e[n],t))&&void 0!==o?o:void 0))break}if(void 0===r)throw new Error("填充变量".concat(value,"失败"));return r}var a;return null!==(a=get(e,t))&&void 0!==a?a:void 0}function get_next_nonempty_char(e,t,r){var n;for(t++;t<r;){if(n=e[t],-1===empty_char.indexOf(n))return n;t++}}function parse_args(e,t){var r="",n={origin_expr:e,origin_fill_data:t,expr:"",fmt_expr:"",options:void 0,fill_data:void 0,_unit:void 0,_mode:void 0,_fmt:void 0};if(null!=t&&(n.options=t,Array.isArray(t)?n.fill_data=t:Array.isArray(t._fill_data)?n.fill_data=[t].concat(_toConsumableArray(t._fill_data)):void 0===t._fill_data?n.fill_data=[t]:n.fill_data=[t,t._fill_data]),n._mode=find_value(t,"_mode","normal"),n._unit=find_value(t,"_unit",!1),n._fmt=find_value(t,"_fmt"),"string"==typeof e){if(r=e,""===e.trim()||e.includes("NaN"))throw new Error("非法的表达式:".concat(e))}else{if("number"!=typeof e)throw new Error("错误的第一个参数类型: ".concat(e," 类型为:").concat(_typeof(e)));if(isNaN(e))throw new Error("传入了一个非法数字NaN");r=e.toString()}var i=r.split("|");return n.expr=i[0],i.length>1&&(n.fmt_expr=i[1].trim()),n}function push_token$3(e,t){if(t.curr_state===state_number||t.curr_state===state_scientific){var r=t.expr.slice(t.prev_index,t.cur_index);if(t._unit){var n,i=split_unit_num(r),o=i.num,a=i.unit;if(void 0===a)e.push({type:state_number,value:o,real_value:o,has_unit:!1});else t.has_unit=!0,null!==(n=t.unit_str)&&void 0!==n||(t.unit_str=a),e.push({type:state_number,value:o,real_value:o,has_unit:!0,unit:a})}else e.push({type:state_number,value:r,real_value:r,has_unit:!1})}else if(t.curr_state===state_var){t.has_var=!0;var u=t.expr.slice(t.prev_index,t.cur_index),s=get_real_value(t.fill_data,u);if(t._unit){var c,l=split_unit_num(s),f=l.num,p=l.unit;if(void 0===p)e.push({type:"var",value:u,real_value:f,has_unit:!1});else t.has_unit=!0,null!==(c=t.unit_str)&&void 0!==c||(t.unit_str=p),e.push({type:"var",value:u,real_value:f,has_unit:!0,unit:p})}else e.push({type:"var",value:u,real_value:s,has_unit:!1})}else e.push({type:t.curr_state,value:t.expr.slice(t.prev_index,t.cur_index)});t.curr_state=state_initial,t.prev_index=t.cur_index}function tokenizer(e,t,r){for(var n,i={has_var:!1,has_unit:!1,unit_str:void 0,fill_data:t,cur_index:0,prev_index:0,curr_state:state_initial,expr:e,_unit:r},o=e.length,a=[];i.cur_index<o;)switch(n=e[i.cur_index],i.curr_state){case state_initial:if(number_char.includes(n))i.curr_state=state_number,i.cur_index++;else if(" "===n)i.cur_index++,i.prev_index=i.cur_index;else if("+-".includes(n)){var u=a.at(-1);0===i.cur_index||"operator"===(null==u?void 0:u.type)||"("===(null==u?void 0:u.value)?(i.curr_state=state_number,i.cur_index++):(i.cur_index++,a.push({type:state_operator,value:e.slice(i.prev_index,i.cur_index)}),i.prev_index=i.cur_index)}else"*/%".includes(n)?(i.curr_state=state_operator,i.cur_index++):var_char.includes(n)?(i.curr_state=state_var,i.cur_index++):"()".includes(n)?(a.push({type:state_bracket,value:n}),i.curr_state=state_initial,i.cur_index++,i.prev_index=i.cur_index):(i.cur_index++,i.prev_index=i.cur_index);break;case state_number:if(number_char.includes(n))i.cur_index++;else if("."===n){if(i.cur_index===i.prev_index||e.slice(i.prev_index,i.cur_index).includes("."))throw new Error("非法的小数部分".concat(e.slice(i.prev_index,i.cur_index)));i.cur_index++}else"e"===n?(i.curr_state=state_scientific,i.cur_index++):r?"*/+-() ".indexOf(n)>-1||"%"===n&&number_char.includes(e[i.cur_index-1])&&pure_number_var_first_char.includes(get_next_nonempty_char(e,i.cur_index,o))?push_token$3(a,i):i.cur_index++:push_token$3(a,i);break;case state_operator:var s=e[i.cur_index-1];"*"===n&&"*"===s?(i.cur_index++,a.push({type:state_operator,value:"**"}),i.prev_index=i.cur_index):"/"===n&&"/"===s?(i.cur_index++,a.push({type:state_operator,value:"//"}),i.prev_index=i.cur_index):(a.push({type:state_operator,value:s}),i.prev_index=i.cur_index),i.curr_state=state_initial;break;case state_var:var_members_char.includes(n)?i.cur_index++:push_token$3(a,i);break;case state_scientific:if(number_char.includes(n))i.cur_index++;else if("+-".includes(n)){var c=i.prev_index;"+-".includes(e[c])&&(c+=1);var l=e.slice(c,i.cur_index),f=l.at(-1);l.includes(n)||"e"!==f?push_token$3(a,i):i.cur_index++}else r&&-1==="*/+-() ".indexOf(n)?i.cur_index++:push_token$3(a,i);break;default:throw new Error("字符扫描状态错误")}return i.prev_index<i.cur_index&&push_token$3(a,i),a.has_var=i.has_var,a.has_unit=i.has_unit,a.unit=i.unit_str,a}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var t,r,n,i,o,a,u,s,c,l,f=A.prototype={constructor:A,toString:null,valueOf:null},p=new A(1),h=20,_=4,v=-7,m=21,d=-1e7,g=1e7,b=!1,y=1,w=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",E=!0;function A(e,t){var i,o,a,u,s,c,l,f,p=this;if(!(p instanceof A))return new A(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>g?p.c=p.e=null:e.e<d?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((c="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,s=e;s>=10;s/=10,u++);return void(u>g?p.c=p.e=null:(p.e=u,p.c=[e]))}f=String(e)}else{if(!isNumeric.test(f=String(e)))return n(p,f,c);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(s=f.search(/e/i))>0?(u<0&&(u=s),u+=+f.slice(s+1),f=f.substring(0,s)):u<0&&(u=f.length)}else{if(intCheck(t,2,x.length,"Base"),10==t&&E)return B(p=new A(e),h+p.e+1,_);if(f=String(e),c="number"==typeof e){if(0*e!=0)return n(p,f,c,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,A.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(i=x.slice(0,t),u=s=0,l=f.length;s<l;s++)if(i.indexOf(o=f.charAt(s))<0){if("."==o){if(s>u){u=l;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,s=-1,u=0;continue}return n(p,String(e),c,t)}c=!1,(u=(f=r(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(s=0;48===f.charCodeAt(s);s++);for(l=f.length;48===f.charCodeAt(--l););if(f=f.slice(s,++l)){if(l-=s,c&&A.DEBUG&&l>15&&(e>MAX_SAFE_INTEGER||e!==mathfloor(e)))throw Error(tooManyDigits+p.s*e);if((u=u-s-1)>g)p.c=p.e=null;else if(u<d)p.c=[p.e=0];else{if(p.e=u,p.c=[],s=(u+1)%LOG_BASE,u<0&&(s+=LOG_BASE),s<l){for(s&&p.c.push(+f.slice(0,s)),l-=LOG_BASE;s<l;)p.c.push(+f.slice(s,s+=LOG_BASE));s=LOG_BASE-(f=f.slice(s)).length}else s-=l;for(;s--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function N(e,t,r,n){var i,o,a,u,s;if(null==r?r=_:intCheck(r,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)s=coeffToString(e.c),s=1==n||2==n&&(a<=v||a>=m)?toExponential(s,a):toFixedPoint(s,a,"0");else if(o=(e=B(new A(e),t,r)).e,u=(s=coeffToString(e.c)).length,1==n||2==n&&(t<=o||o<=v)){for(;u<t;s+="0",u++);s=toExponential(s,o)}else if(t-=a,s=toFixedPoint(s,o,"0"),o+1>u){if(--t>0)for(s+=".";t--;s+="0");}else if((t+=o-u)>0)for(o+1==u&&(s+=".");t--;s+="0");return e.s<0&&i?"-"+s:s}function O(e,t){for(var r,n=1,i=new A(e[0]);n<e.length;n++){if(!(r=new A(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function k(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*LOG_BASE-1)>g?e.c=e.e=null:r<d?e.c=[e.e=0]:(e.e=r,e.c=t),e}function B(e,t,r,n){var i,o,a,u,s,c,l,f=e.c,p=POWS_TEN;if(f){e:{for(i=1,u=f[0];u>=10;u/=10,i++);if((o=t-i)<0)o+=LOG_BASE,a=t,l=(s=f[c=0])/p[i-a-1]%10|0;else if((c=mathceil((o+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));s=l=0,i=1,a=(o%=LOG_BASE)-LOG_BASE+1}else{for(s=u=f[c],i=1;u>=10;u/=10,i++);l=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:s/p[i-a-1]%10|0}if(n=n||t<0||null!=f[c+1]||(a<0?s:s%p[i-a-1]),n=r<4?(l||n)&&(0==r||r==(e.s<0?3:2)):l>5||5==l&&(4==r||n||6==r&&(o>0?a>0?s/p[i-a]:0:f[c-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=p[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=c,u=1,c--):(f.length=c+1,u=p[LOG_BASE-o],f[c]=a>0?mathfloor(s/p[i-a]%p[a])*u:0),n)for(;;){if(0==c){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);o!=u&&(e.e++,f[0]==BASE&&(f[0]=1));break}if(f[c]+=u,f[c]!=BASE)break;f[c--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>g?e.c=e.e=null:e.e<d&&(e.c=[e.e=0])}return e}function T(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=v||r>=m?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return A.clone=clone,A.ROUND_UP=0,A.ROUND_DOWN=1,A.ROUND_CEIL=2,A.ROUND_FLOOR=3,A.ROUND_HALF_UP=4,A.ROUND_HALF_DOWN=5,A.ROUND_HALF_EVEN=6,A.ROUND_HALF_CEIL=7,A.ROUND_HALF_FLOOR=8,A.EUCLID=9,A.config=A.set=function(e){var t,r;if(null!=e){if("object"!=_typeof(e))throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(intCheck(r=e[t],0,MAX,t),h=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(intCheck(r=e[t],0,8,t),_=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(intCheck(r[0],-MAX,0,t),intCheck(r[1],0,MAX,t),v=r[0],m=r[1]):(intCheck(r,-MAX,MAX,t),v=-(m=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)intCheck(r[0],-MAX,-1,t),intCheck(r[1],1,MAX,t),d=r[0],g=r[1];else{if(intCheck(r,-MAX,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);d=-(g=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(bignumberError+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw b=!r,Error(bignumberError+"crypto unavailable");b=r}else b=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),y=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),w=r),e.hasOwnProperty(t="FORMAT")){if("object"!=_typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);S=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);E="0123456789"==r.slice(0,10),x=r}}return{DECIMAL_PLACES:h,ROUNDING_MODE:_,EXPONENTIAL_AT:[v,m],RANGE:[d,g],CRYPTO:b,MODULO_MODE:y,POW_PRECISION:w,FORMAT:S,ALPHABET:x}},A.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!A.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-MAX&&i<=MAX&&i===mathfloor(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=BASE||r!==mathfloor(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},A.maximum=A.max=function(){return O(arguments,f.lt)},A.minimum=A.min=function(){return O(arguments,f.gt)},A.random=(i=9007199254740992,o=Math.random()*i&2097151?function(){return mathfloor(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,a,u=0,s=[],c=new A(p);if(null==e?e=h:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),b)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(a=131072*t[u]+(t[u+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[u]=r[0],t[u+1]=r[1]):(s.push(a%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw b=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(i*=7);u<i;)(a=281474976710656*(31&t[u])+1099511627776*t[u+1]+4294967296*t[u+2]+16777216*t[u+3]+(t[u+4]<<16)+(t[u+5]<<8)+t[u+6])>=9e15?crypto.randomBytes(7).copy(t,u):(s.push(a%1e14),u+=7);u=i/7}if(!b)for(;u<i;)(a=o())<9e15&&(s[u++]=a%1e14);for(i=s[--u],e%=LOG_BASE,i&&e&&(a=POWS_TEN[LOG_BASE-e],s[u]=mathfloor(i/a)*a);0===s[u];s.pop(),u--);if(u<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(u=1,a=s[0];a>=10;a/=10,u++);u<LOG_BASE&&(n-=LOG_BASE-u)}return c.e=n,c.c=s,c}),A.sum=function(){for(var e=1,t=arguments,r=new A(t[0]);e<t.length;)r=r.plus(t[e++]);return r},r=function(){var e="0123456789";function r(e,t,r,n){for(var i,o,a=[0],u=0,s=e.length;u<s;){for(o=a.length;o--;a[o]*=t);for(a[0]+=n.indexOf(e.charAt(u++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(n,i,o,a,u){var s,c,l,f,p,v,m,d,g=n.indexOf("."),b=h,y=_;for(g>=0&&(f=w,w=0,n=n.replace(".",""),v=(d=new A(i)).pow(n.length-g),w=f,d.c=r(toFixedPoint(coeffToString(v.c),v.e,"0"),10,o,e),d.e=d.c.length),l=f=(m=r(n,i,o,u?(s=x,e):(s=e,x))).length;0==m[--f];m.pop());if(!m[0])return s.charAt(0);if(g<0?--l:(v.c=m,v.e=l,v.s=a,m=(v=t(v,d,b,y,o)).c,p=v.r,l=v.e),g=m[c=l+b+1],f=o/2,p=p||c<0||null!=m[c+1],p=y<4?(null!=g||p)&&(0==y||y==(v.s<0?3:2)):g>f||g==f&&(4==y||p||6==y&&1&m[c-1]||y==(v.s<0?8:7)),c<1||!m[0])n=p?toFixedPoint(s.charAt(1),-b,s.charAt(0)):s.charAt(0);else{if(m.length=c,p)for(--o;++m[--c]>o;)m[c]=0,c||(++l,m=[1].concat(m));for(f=m.length;!m[--f];);for(g=0,n="";g<=f;n+=s.charAt(m[g++]));n=toFixedPoint(n,l,s.charAt(0))}return n}}(),t=function(){function e(e,t,r){var n,i,o,a,u=0,s=e.length,c=t%SQRT_BASE,l=t/SQRT_BASE|0;for(e=e.slice();s--;)u=((i=c*(o=e[s]%SQRT_BASE)+(n=l*o+(a=e[s]/SQRT_BASE|0)*c)%SQRT_BASE*SQRT_BASE+u)/r|0)+(n/SQRT_BASE|0)+l*a,e[s]=i%r;return u&&(e=[u].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,a,u){var s,c,l,f,p,h,_,v,m,d,g,b,y,w,S,x,E,N=n.s==i.s?1:-1,O=n.c,k=i.c;if(!(O&&O[0]&&k&&k[0]))return new A(n.s&&i.s&&(O?!k||O[0]!=k[0]:k)?O&&0==O[0]||!k?0*N:N/0:NaN);for(m=(v=new A(N)).c=[],N=o+(c=n.e-i.e)+1,u||(u=BASE,c=bitFloor(n.e/LOG_BASE)-bitFloor(i.e/LOG_BASE),N=N/LOG_BASE|0),l=0;k[l]==(O[l]||0);l++);if(k[l]>(O[l]||0)&&c--,N<0)m.push(1),f=!0;else{for(w=O.length,x=k.length,l=0,N+=2,(p=mathfloor(u/(k[0]+1)))>1&&(k=e(k,p,u),O=e(O,p,u),x=k.length,w=O.length),y=x,g=(d=O.slice(0,x)).length;g<x;d[g++]=0);E=k.slice(),E=[0].concat(E),S=k[0],k[1]>=u/2&&S++;do{if(p=0,(s=t(k,d,x,g))<0){if(b=d[0],x!=g&&(b=b*u+(d[1]||0)),(p=mathfloor(b/S))>1)for(p>=u&&(p=u-1),_=(h=e(k,p,u)).length,g=d.length;1==t(h,d,_,g);)p--,r(h,x<_?E:k,_,u),_=h.length,s=1;else 0==p&&(s=p=1),_=(h=k.slice()).length;if(_<g&&(h=[0].concat(h)),r(d,h,g,u),g=d.length,-1==s)for(;t(k,d,x,g)<1;)p++,r(d,x<g?E:k,g,u),g=d.length}else 0===s&&(p++,d=[0]);m[l++]=p,d[0]?d[g++]=O[y]||0:(d=[O[y]],g=1)}while((y++<w||null!=d[0])&&N--);f=null!=d[0],m[0]||m.splice(0,1)}if(u==BASE){for(l=1,N=m[0];N>=10;N/=10,l++);B(v,o+(v.e=l+c*LOG_BASE-1)+1,a,f)}else v.e=c,v.r=+f;return v}}(),a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,s=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,l=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,t,r,n){var i,o=r?t:t.replace(l,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(a,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(u,"$1").replace(s,"0.$1")),t!=o))return new A(o,i);if(A.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new A(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,t){return compare(this,new A(e,t))},f.decimalPlaces=f.dp=function(e,t){var r,n,i,o=this;if(null!=e)return intCheck(e,0,MAX),null==t?t=_:intCheck(t,0,8),B(new A(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},f.dividedBy=f.div=function(e,r){return t(this,new A(e,r),h,_)},f.dividedToIntegerBy=f.idiv=function(e,r){return t(this,new A(e,r),0,1)},f.exponentiatedBy=f.pow=function(e,t){var r,n,i,o,a,u,s,c,l=this;if((e=new A(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+T(e));if(null!=t&&(t=new A(t)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return c=new A(Math.pow(+T(l),a?e.s*(2-isOdd(e)):+T(e))),t?c.mod(t):c;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new A(NaN);(n=!u&&l.isInteger()&&t.isInteger())&&(l=l.mod(t))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return o=l.s<0&&isOdd(e)?-0:0,l.e>-1&&(o=1/o),new A(u?1/o:o);w&&(o=mathceil(w/LOG_BASE+2))}for(a?(r=new A(.5),u&&(e.s=1),s=isOdd(e)):s=(i=Math.abs(+T(e)))%2,c=new A(p);;){if(s){if(!(c=c.times(l)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=mathfloor(i/2)))break;s=i%2}else if(B(e=e.times(r),e.e+1,1),e.e>14)s=isOdd(e);else{if(0===(i=+T(e)))break;s=i%2}l=l.times(l),o?l.c&&l.c.length>o&&(l.c.length=o):n&&(l=l.mod(t))}return n?c:(u&&(c=p.div(c)),t?c.mod(t):o?B(c,w,_,undefined):c)},f.integerValue=function(e){var t=new A(this);return null==e?e=_:intCheck(e,0,8),B(t,t.e+1,e)},f.isEqualTo=f.eq=function(e,t){return 0===compare(this,new A(e,t))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,t){return compare(this,new A(e,t))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,t){return 1===(t=compare(this,new A(e,t)))||0===t},f.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},f.isLessThan=f.lt=function(e,t){return compare(this,new A(e,t))<0},f.isLessThanOrEqualTo=f.lte=function(e,t){return-1===(t=compare(this,new A(e,t)))||0===t},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,t){var r,n,i,o,a=this,u=a.s;if(t=(e=new A(e,t)).s,!u||!t)return new A(NaN);if(u!=t)return e.s=-t,a.plus(e);var s=a.e/LOG_BASE,c=e.e/LOG_BASE,l=a.c,f=e.c;if(!s||!c){if(!l||!f)return l?(e.s=-t,e):new A(f?a:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-t,e):new A(l[0]?a:3==_?-0:0)}if(s=bitFloor(s),c=bitFloor(c),l=l.slice(),u=s-c){for((o=u<0)?(u=-u,i=l):(c=s,i=f),i.reverse(),t=u;t--;i.push(0));i.reverse()}else for(n=(o=(u=l.length)<(t=f.length))?u:t,u=t=0;t<n;t++)if(l[t]!=f[t]){o=l[t]<f[t];break}if(o&&(i=l,l=f,f=i,e.s=-e.s),(t=(n=f.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=BASE-1;n>u;){if(l[--n]<f[n]){for(r=n;r&&!l[--r];l[r]=t);--l[r],l[n]+=BASE}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?k(e,l,c):(e.s=3==_?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,r){var n,i,o=this;return e=new A(e,r),!o.c||!e.s||e.c&&!e.c[0]?new A(NaN):!e.c||o.c&&!o.c[0]?new A(o):(9==y?(i=e.s,e.s=1,n=t(o,e,0,3),e.s=i,n.s*=i):n=t(o,e,0,y),(e=o.minus(n.times(e))).c[0]||1!=y||(e.s=o.s),e)},f.multipliedBy=f.times=function(e,t){var r,n,i,o,a,u,s,c,l,f,p,h,_,v,m,d=this,g=d.c,b=(e=new A(e,t)).c;if(!(g&&b&&g[0]&&b[0]))return!d.s||!e.s||g&&!g[0]&&!b||b&&!b[0]&&!g?e.c=e.e=e.s=null:(e.s*=d.s,g&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=bitFloor(d.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=d.s,(s=g.length)<(f=b.length)&&(_=g,g=b,b=_,i=s,s=f,f=i),i=s+f,_=[];i--;_.push(0));for(v=BASE,m=SQRT_BASE,i=f;--i>=0;){for(r=0,p=b[i]%m,h=b[i]/m|0,o=i+(a=s);o>i;)r=((c=p*(c=g[--a]%m)+(u=h*c+(l=g[a]/m|0)*p)%m*m+_[o]+r)/v|0)+(u/m|0)+h*l,_[o--]=c%v;_[o]=r}return r?++n:_.splice(0,1),k(e,_,n)},f.negated=function(){var e=new A(this);return e.s=-e.s||null,e},f.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new A(e,t)).s,!i||!t)return new A(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/LOG_BASE,a=e.e/LOG_BASE,u=n.c,s=e.c;if(!o||!a){if(!u||!s)return new A(i/0);if(!u[0]||!s[0])return s[0]?e:new A(u[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),u=u.slice(),i=o-a){for(i>0?(a=o,r=s):(i=-i,r=u),r.reverse();i--;r.push(0));r.reverse()}for((i=u.length)-(t=s.length)<0&&(r=s,s=u,u=r,t=i),i=0;t;)i=(u[--t]=u[t]+s[t]+i)/BASE|0,u[t]=BASE===u[t]?0:u[t]%BASE;return i&&(u=[i].concat(u),++a),k(e,u,a)},f.precision=f.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=_:intCheck(t,0,8),B(new A(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*LOG_BASE+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},f.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,r,n,i,o,a=this,u=a.c,s=a.s,c=a.e,l=h+4,f=new A("0.5");if(1!==s||!u||!u[0])return new A(!s||s<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(s=Math.sqrt(+T(a)))||s==1/0?(((r=coeffToString(u)).length+c)%2==0&&(r+="0"),s=Math.sqrt(+r),c=bitFloor((c+1)/2)-(c<0||c%2),n=new A(r=s==1/0?"5e"+c:(r=s.toExponential()).slice(0,r.indexOf("e")+1)+c)):n=new A(s+""),n.c[0])for((s=(c=n.e)+l)<3&&(s=0);;)if(o=n,n=f.times(o.plus(t(a,o,l,1))),coeffToString(o.c).slice(0,s)===(r=coeffToString(n.c)).slice(0,s)){if(n.e<c&&--s,"9999"!=(r=r.slice(s-3,s+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(B(n,n.e+h+2,1),e=!n.times(n).eq(a));break}if(!i&&(B(o,o.e+h+2,0),o.times(o).eq(a))){n=o;break}l+=4,s+=4,i=1}return B(n,n.e+h+1,_,e)},f.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),N(this,e,t,1)},f.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),N(this,e,t)},f.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==_typeof(t)?(r=t,t=null):e&&"object"==_typeof(e)?(r=e,e=t=null):r=S;else if("object"!=_typeof(r))throw Error(bignumberError+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,a=n.split("."),u=+r.groupSize,s=+r.secondaryGroupSize,c=r.groupSeparator||"",l=a[0],f=a[1],p=i.s<0,h=p?l.slice(1):l,_=h.length;if(s&&(o=u,u=s,s=o,_-=o),u>0&&_>0){for(o=_%u||u,l=h.substr(0,o);o<_;o+=u)l+=c+h.substr(o,u);s>0&&(l+=c+h.slice(o)),p&&(l="-"+l)}n=f?l+(r.decimalSeparator||"")+((s=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):l}return(r.prefix||"")+n+(r.suffix||"")},f.toFraction=function(e){var r,n,i,o,a,u,s,c,l,f,h,v,m=this,d=m.c;if(null!=e&&(!(s=new A(e)).isInteger()&&(s.c||1!==s.s)||s.lt(p)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+T(s));if(!d)return new A(m);for(r=new A(p),l=n=new A(p),i=c=new A(p),v=coeffToString(d),a=r.e=v.length-m.e-1,r.c[0]=POWS_TEN[(u=a%LOG_BASE)<0?LOG_BASE+u:u],e=!e||s.comparedTo(r)>0?a>0?r:l:s,u=g,g=1/0,s=new A(v),c.c[0]=0;f=t(s,r,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,l=c.plus(f.times(o=l)),c=o,r=s.minus(f.times(o=r)),s=o;return o=t(e.minus(n),i,0,1),c=c.plus(o.times(l)),n=n.plus(o.times(i)),c.s=l.s=m.s,h=t(l,i,a*=2,_).minus(m).abs().comparedTo(t(c,n,a,_).minus(m).abs())<1?[l,i]:[c,n],g=u,h},f.toNumber=function(){return+T(this)},f.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),N(this,e,t,2)},f.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=v||o>=m?toExponential(coeffToString(n.c),o):toFixedPoint(coeffToString(n.c),o,"0"):10===e&&E?t=toFixedPoint(coeffToString((n=B(new A(n),h+o+1,_)).c),n.e,"0"):(intCheck(e,2,x.length,"Base"),t=r(toFixedPoint(coeffToString(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},f.valueOf=f.toJSON=function(){return T(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=e&&A.set(e),A}function bitFloor(e){var t=0|e;return e>0||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare(e,t){var r,n,i=e.c,o=t.c,a=e.s,u=t.s,s=e.e,c=t.e;if(!a||!u)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-u:a;if(a!=u)return a;if(r=a<0,n=s==c,!i||!o)return n?0:!i^r?1:-1;if(!n)return s>c^r?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,a=0;a<u;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return s==c?0:s>c^r?1:-1}function intCheck(e,t,r,n){if(e<t||e>r||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var t=e.c.length-1;return bitFloor(e.e/LOG_BASE)==t&&e.c[t]%2!=0}function toExponential(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();function format(e,t){var r="";if("undefined"===(r=BigNumber.isBigNumber(e)?e.toFixed():"string"==typeof e?e:e.toString())||"NaN"===r)return[void 0,{}];var n={mantissa:null,mantissa_type:null,thousands:!1,sign:!1,round:"~-",scientific:!1,fraction:!1,percent:!1,to_number:!1,to_number_string:!1};if(t.forEach((function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);n.mantissa_type=e.value}else if("to-number"===t)n.to_number=!0;else if("to-number-string"===t)n.to_number_string=!0;else if("comma"===t)n.thousands=!0;else if("number"===t)n.mantissa=e.value;else if("var"===t)n.mantissa=e.real_value;else if("plus"===t)n.sign=!0;else if("round"===t)n.round=e.value;else if("fraction"===t)n.fraction=!0;else if("scientific"===t)n.scientific=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");n.percent=!0}})),n.to_number)return[+parse_mantissa(r,n.mantissa_type,n.mantissa,n.round),n];if(n.scientific){var i=BigNumber(r).toExponential();return[n.sign&&!i.startsWith("-")?"+"+i:i,n]}if(n.fraction){var o=BigNumber(r).toFraction().map((function(e){return e.toFixed()})).join("/");return[n.sign&&!o.startsWith("-")?"+"+o:o,n]}return n.percent&&(r=BigNumber(r).times(100).toFixed()),null===n.mantissa?r.includes(".")&&(r=r.replace(/0*$/,"")):r=parse_mantissa(r,n.mantissa_type,n.mantissa,n.round),n.thousands&&(r=parse_thousands(r)),n.sign&&(n.to_number=!1,r.startsWith("-")||(r="+"+r)),n.percent&&(r+="%"),[r,n]}function close_important_push(){}function open_important_push(){}function open_debug(){}function close_debug(){}function calc_wrap(e,t){var r={_error:"-"};return["string","number"].includes(_typeof(e))?void 0===t?/[a-zA-Z$_]/.test(e.toString())?function(t){return Array.isArray(t)?t.unshift(r):t=_objectSpread2(_objectSpread2({},r),t),calc(e,t)}:calc(e):(Array.isArray(t)?t.unshift(r):t=_objectSpread2(_objectSpread2({},r),t),calc(e,t)):(Array.isArray(e)?e.unshift(r):e=_objectSpread2(_objectSpread2({},r),e),function(t){return calc(t,e)})}function check_version(){return _check_version.apply(this,arguments)}function _check_version(){return _check_version=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var res,code,versions,last_version,larr,varr,script,url;return _regeneratorRuntime().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:if("undefined"==typeof process||"node"!==process.release.name){_context.next=19;break}if(!(parseInt(process.versions.node)>=17)){_context.next=17;break}return _context.next=4,promise_queue([fetch("https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js"),fetch("https://unpkg.com/a-calc@latest/a-calc.versions.js")]);case 4:return res=_context.sent,_context.next=7,res.text();case 7:code=_context.sent,versions=eval(code),last_version=versions.at(-1),larr=last_version.match(/(\d+)\.(\d+)\.(\d+)/),larr.shift(),larr=larr.map((function(e){return parseInt(e)})),varr=version.match(/(\d+)\.(\d+)\.(\d+)/),varr.shift(),varr=varr.map((function(e){return parseInt(e)})),(larr[0]>varr[0]||larr[0]===varr[0]&&larr[1]>varr[1]||larr[0]===varr[0]&&larr[1]===varr[1]&&larr[2]>varr[2])&&console.warn("a-calc has a new version:",last_version);case 17:_context.next=25;break;case 19:return script=document.createElement("script"),script.onload=function(){var e=a_calc_versions;if(Array.isArray(e)){var t=e.at(-1),r=t.match(/(\d+)\.(\d+)\.(\d+)/);r.shift(),r=r.map((function(e){return parseInt(e)}));var n=version.match(/(\d+)\.(\d+)\.(\d+)/);n.shift(),n=n.map((function(e){return parseInt(e)})),(r[0]>n[0]||r[0]===n[0]&&r[1]>n[1]||r[0]===n[0]&&r[1]===n[1]&&r[2]>n[2])&&console.log("%c↑↑↑ a-calc has a new version: %s ↑↑↑","color: #67C23A;",t)}},_context.next=23,test_urls(["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"]);case 23:url=_context.sent,url?(script.src=url,document.body.appendChild(script)):script=null;case 25:case"end":return _context.stop()}}),_callee)}))),_check_version.apply(this,arguments)}var operator=new Set(["+","-","*","/","%","**","//"]);function push_token$2(e,t,r){if(Number.isNaN(Number(t)))if("-"===t||"+"===t)0===e.length||"operator"===e.at(-1).type||"("===e.at(-1).value?e.push({type:"number",value:t,real_value:t,has_unit:!1}):e.push({type:"operator",value:t});else if(operator.has(t))e.push({type:"operator",value:t});else if(r._unit&&/^[+-]?\d/.test(t)){var n,i=split_unit_num(t),o=i.num,a=i.unit;if(void 0===a)e.push({type:"number",value:o,real_value:o,has_unit:!1});else r.has_unit=!0,null!==(n=r.unit_str)&&void 0!==n||(r.unit_str=a),e.push({type:"number",value:o,real_value:o,has_unit:!0,unit:a})}else if(var_first_char.includes(t[0])){r.has_var=!0;var u=get_real_value(r.fill_data,t);if(r._unit){var s,c=split_unit_num(u),l=c.num,f=c.unit;if(void 0===f)e.push({type:"var",value:t,real_value:l,has_unit:!1});else r.has_unit=!0,null!==(s=r.unit_str)&&void 0!==s||(r.unit_str=f),e.push({type:"var",value:t,real_value:l,has_unit:!0,unit:f})}else e.push({type:"var",value:t,real_value:u,has_unit:!1})}else{if(!/^[+-]?\d/.test(t))throw new Error("无法识别的标识符:".concat(t));var p=t.indexOf("e");-1!==p&&/^\d+$/.test(t.slice(p+1))&&e.push({type:"number",value:t,real_value:t,has_unit:!1})}else e.push({type:"number",value:t,real_value:t,has_unit:!1})}function tokenizer_space(e,t,r){for(var n,i=0,o=0,a=e.length,u=[],s={has_var:!1,has_unit:!1,unit_str:void 0,_unit:r,fill_data:t};o<a;)" "===(n=e[o])?(o>i&&push_token$2(u,e.slice(i,o),s),i=o+1):"("===n?(u.push({type:state_bracket,value:"("}),i=o+1):")"===n&&(o>i&&push_token$2(u,e.slice(i,o),s),u.push({type:state_bracket,value:")"}),i=o+1),o++;return o>i&&push_token$2(u,e.slice(i,o),s),u.has_var=s.has_var,u.has_unit=s.has_unit,u.unit=s.unit_str,u}function compute(e,t,r){if(void 0===e||void 0===t)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(t));switch(r){case"+":return new BigNumber(e).plus(t);case"-":return new BigNumber(e).minus(t);case"*":return new BigNumber(e).times(t);case"/":return new BigNumber(e).div(t);case"%":return new BigNumber(e).mod(t);case"**":return new BigNumber(e).pow(t);case"//":return new BigNumber(e).idiv(t)}}var operator_map$1={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens(e){if(1===e.length){var t=e[0];if("number"===t.type||"var"===t.type)return t.real_value;throw new Error("错误的表达式:".concat(t.value))}for(var r,n,i=[],o=[],a=0,u=e.length;a<u;a++)if("number"!==(r=e[a]).type&&"var"!==r.type)if("operator"!==r.type)if("("!==r.value){if(")"===r.value)for(var s=void 0;s=i.pop();){if("("===s){var c=o.at(-2);if("-"===c){var l=o.pop();o.pop(),o.push(BigNumber.isBigNumber(l)?l.negated():new BigNumber(l).negated())}else if("+"===c){var f=o.pop();o.pop(),o.push(f)}break}var p=o.pop(),h=o.pop();o.push(compute(h,p,s))}}else i.push("(");else{var _=i.at(-1);if("("===_){i.push(r.value);continue}var v=operator_map$1[r.value];if(!i.length){i.push(r.value);continue}if(v<operator_map$1[_])for(var m=void 0;m=i.pop();){if("("===m){i.push("(");break}var d=o.pop(),g=o.pop();o.push(compute(g,d,m))}else if(v===operator_map$1[_]){if("**"===r.value){i.push(r.value);continue}for(var b=void 0;b=i.pop();){if("("===b){i.push("(");break}if(operator_map$1[b]<v){i.push(b);break}var y=o.pop(),w=o.pop();o.push(compute(w,y,b))}}i.push(r.value)}else o.push(r.real_value);for(;n=i.pop();){var S=o.pop(),x=o.pop();o.push(compute(x,S,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return e.has_var||(e.calc_result=o[0]),o[0]}function push_token$1(e,t,r,n,i){t===state_var?(i.has_var=!0,e.push({type:t,value:r,real_value:get_real_value(i.fill_data,r)})):e.push({type:t,value:r}),n.prev=n.curr,i.state=state_initial}function fmt_tokenizer(e,t){for(var r,n={prev:0,curr:0},i=e.length,o={state:state_initial,fill_data:t,has_var:!1},a=[];n.curr<i;)switch(r=e[n.curr],o.state){case state_initial:if(" "===r)n.curr++,n.prev=n.curr;else if("<>=".includes(r))o.state=state_symbol,n.curr++;else if(","===r)n.curr++,push_token$1(a,state_comma,",",n,o);else if(var_char.includes(r))o.state=state_var,n.curr++;else if(number_char.includes(r))o.state=state_number,n.curr++;else if("+"===r)n.curr++,push_token$1(a,state_plus$1,"+",n,o);else if("~"===r)n.curr++,o.state=state_round;else if("%"===r)n.curr++,push_token$1(a,state_percent,"%",n,o);else if("/"===r)n.curr++,push_token$1(a,state_fraction,"/",n,o);else if("!"===r)if(o.state=state_initial,n.curr++,"n"===e[n.curr])n.curr++,push_token$1(a,state_to_number,"!n",n,o);else if("u"===e[n.curr])n.curr++,push_token$1(a,state_to_number_string,"!u",n,o);else{if("e"!==e[n.curr])throw new Error("无法识别的!模式字符:".concat(e[n.curr]));n.curr++,push_token$1(a,state_scientific,"!e",n,o)}else n.curr++,n.prev=n.curr;break;case state_symbol:"="===r&&n.curr++,push_token$1(a,state_symbol,e.slice(n.prev,n.curr),n,o);break;case state_number:number_char.includes(r)?n.curr++:push_token$1(a,state_number,e.slice(n.prev,n.curr),n,o);break;case state_var:var_members_char.includes(r)?n.curr++:push_token$1(a,state_var,e.slice(n.prev,n.curr),n,o);break;case state_round:if(!("56+-".includes(r)&&n.curr-n.prev<2))throw new Error("错误的舍入语法:".concat(e.slice(n.prev,n.curr+1)));n.curr++,push_token$1(a,state_round,e.slice(n.prev,n.curr),n,o);break;default:throw new Error("错误的fmt分词器状态")}return n.prev<n.curr&&push_token$1(a,o.state,e.slice(n.prev,n.curr),n,o),a.has_var=o.has_var,a}var symbol_set=new Set(["<",">","=",">=","<="]),rand_set=new Set(["~+","~-","~5","~6"]);function push_token(e,t,r){if(","===t)e.push({type:state_comma,value:","});else if(symbol_set.has(t))e.push({type:state_symbol,value:t});else if(Number.isNaN(Number(t)))if(var_first_char.includes(t[0]))r.has_var=!0,e.push({type:state_var,value:t,real_value:get_real_value(r.fill_data,t)});else if("%"===t)e.push({type:state_percent,value:t});else if("/"===t)e.push({type:state_fraction,value:t});else if("+"===t)e.push({type:state_plus,value:t});else if(rand_set.has(t))e.push({type:state_round,value:t});else if("!n"===t)e.push({type:state_to_number,value:t});else if("!u"===t)e.push({type:state_to_number_string,value:t});else{if("!e"!==t)throw new Error("无法识别的格式化字符: ".concat(t));e.push({type:state_scientific,value:t})}else e.push({type:state_number,value:t})}function fmt_tokenizer_space(e,t){for(var r,n=0,i=e.length,o={fill_data:t,has_var:!1},a=0,u=[];n<i;)" "===(r=e[n])?(n>a&&push_token(u,e.slice(a,n),o),a=n+1):"<>=".includes(r)&&("="===e[n+1]?(u.push({type:state_symbol,value:r+"="}),a=1+ ++n):(u.push({type:state_symbol,value:r}),a=n+1)),n++;return a<n&&push_token(u,e.slice(a,n),o),u.has_var=o.has_var,u}function compute_lite(e,t,r){switch(r){case"+":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).plus(t);case"-":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).minus(t);case"*":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).times(t);case"/":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).div(t);case"%":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).mod(t);case"**":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).pow(t);case"//":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).idiv(t)}}var operator_map={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens_lite(e,t){for(var r,n,i=[],o=[],a=0,u=e.length;a<u;a++){var s=(r=e[a])[0];if(var_first_char.includes(s))o.push(get_real_value(t,r));else if(operator_set.has(r)){var c=i.at(-1);if("("===c){i.push(r);continue}var l=operator_map[r];if(!i.length){i.push(r);continue}var f=operator_map[c];if(l<f)for(var p=i.at(-1);p&&"("!==p;){i.pop();var h=o.pop(),_=o.pop();o.push(compute_lite(_,h,p)),p=i.at(-1)}else if(l===f){if("**"===r){i.push(r);continue}for(var v=i.at(-1);v&&!(operator_map[v]<l||"("===v);){i.pop();var m=o.pop(),d=o.pop();o.push(compute_lite(d,m,v)),v=i.at(-1)}}i.push(r)}else if(number_first_char.includes(s))o.push(r);else if("("!==r){if(")"===r)for(var g=void 0;(g=i.pop())&&"("!==g;){var b=o.pop(),y=o.pop();o.push(compute_lite(y,b,g))}}else i.push("(")}for(;n=i.pop();){var w=o.pop(),S=o.pop();o.push(compute_lite(S,w,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return o[0]}function calc_lite(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"-";try{var i;if("number"==typeof e)i=e.toString();else{if(""===e)throw new Error("非法的空计算式");var o=e.split(" ");if(1===o.length){if(i=o[0],var_first_char.includes(i[0])&&(i=get_real_value(r,i)),isNaN(Number(i)))throw new Error("错误的计算式:".concat(e))}else i=eval_tokens_lite(o,r).toFixed()}if("string"==typeof t&&""!==t){var a=fmt_tokenizer(t,r);if(void 0!==a)i=_slicedToArray(format(i,a),1)[0]}if("NaN"===i||"Infinity"===i)throw new Error("计算环节出错");return i}catch(e){return n}}function calc_mini(e,t,r){switch(t){case"+":return BigNumber(e).plus(r).toFixed();case"-":return BigNumber(e).minus(r).toFixed();case"*":return BigNumber(e).times(r).toFixed();case"/":return BigNumber(e).div(r).toFixed();case"%":return BigNumber(e).mod(r).toFixed();case"**":return BigNumber(e).pow(r).toFixed();case"//":return BigNumber(e).idiv(r).toFixed()}}function calc(e,t){var r=find_value(t,"_error");try{var n,i,o,a,u,s=parse_args(e,t),c=s._unit,l=s._mode,f="space"===l||"space-all"===l?tokenizer_space(s.expr,s.fill_data,c):tokenizer(s.expr,s.fill_data,c),p=eval_tokens(f),h=BigNumber.isBigNumber(p)?p:new BigNumber(p);if("space-all"===l?(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer_space(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer_space(s._fmt,s.fill_data)):(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer(s._fmt,s.fill_data)),void 0===a?void 0!==u&&(a=u):void 0!==u&&(a=[].concat(_toConsumableArray(u),_toConsumableArray(a))),void 0===a)h=h.toFixed();else{var _=_slicedToArray(format(h,a),2);h=_[0],o=_[1]}if("Infinity"===h||"NaN"===h||void 0===h)throw new Error("计算错误可能是非法的计算式");return!f.has_unit||null!==(n=o)&&void 0!==n&&n.to_number||null!==(i=o)&&void 0!==i&&i.to_number_string||(h+=f.unit),h}catch(e){if(void 0===r)throw e;return r}}function check_update(){check_version().catch((function(){}))}function print_version(){console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")}var calc_util={check_update:check_update,print_version:print_version,open_debug:open_debug,close_debug:close_debug,close_important_push:close_important_push,open_important_push:open_important_push},fmt=calc;function plus(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).plus(t).toNumber():new BigNumber(e).plus(t).toFixed()}function sub(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).minus(t).toNumber():new BigNumber(e).minus(t).toFixed()}function mul(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).times(t).toNumber():new BigNumber(e).times(t).toFixed()}function div(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).div(t).toNumber():new BigNumber(e).div(t).toFixed()}function mod(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).mod(t).toNumber():new BigNumber(e).mod(t).toFixed()}function pow(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).pow(t).toNumber():new BigNumber(e).pow(t).toFixed()}function idiv(e,t){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).idiv(t).toNumber():new BigNumber(e).idiv(t).toFixed()}exports.calc=calc,exports.calc_lite=calc_lite,exports.calc_mini=calc_mini,exports.calc_util=calc_util,exports.calc_wrap=calc_wrap,exports.div=div,exports.fmt=fmt,exports.idiv=idiv,exports.mod=mod,exports.mul=mul,exports.parse_thousands=parse_thousands,exports.plus=plus,exports.pow=pow,exports.sub=sub,exports.version=version;
|
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,i,o,a,u=[],s=!0,c=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;s=!1}else for(;!(s=(n=o.call(t)).done)&&(u.push(n.value),u.length!==r);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw i}}return u}}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,n=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{s({},"")}catch(e){s=function(e,r,t){return e[r]=t}}function c(e,r,t,i){var o=r&&r.prototype instanceof p?r:p,a=Object.create(o.prototype),u=new A(i||[]);return n(a,"_invoke",{value:w(e,t,u)}),a}function l(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function p(){}function h(){}function _(){}var v={};s(v,o,(function(){return this}));var m=Object.getPrototypeOf,d=m&&m(m(N([])));d&&d!==r&&t.call(d,o)&&(v=d);var g=_.prototype=p.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(r){s(e,r,(function(e){return this._invoke(r,e)}))}))}function y(e,r){function i(n,o,a,u){var s=l(e[n],e,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==typeof f&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,a,u)}),(function(e){i("throw",e,a,u)})):r.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,u)}))}u(s.arg)}var o;n(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return o=o?o.then(n,n):n()}})}function w(e,r,t){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(t.method=i,t.arg=o;;){var a=t.delegate;if(a){var u=S(a,t);if(u){if(u===f)continue;return u}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var s=l(e,r,t);if("normal"===s.type){if(n=t.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(n="completed",t.method="throw",t.arg=s.arg)}}}function S(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,S(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),f;var i=l(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,f;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function E(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function x(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function N(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=_,n(g,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:h,configurable:!0}),h.displayName=s(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===h||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,s(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(y.prototype),s(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(r,t,n,i,o){void 0===o&&(o=Promise);var a=new y(c(r,t,n,i),o);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),s(g,u,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=N,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=t.call(o,"catchLoc"),s=t.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&t.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=r,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),f},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),x(t),f}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var i=n.arg;x(t)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:N(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),f}},e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function asyncGeneratorStep(e,r,t,n,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,i)}function _asyncToGenerator(e){return function(){var r=this,t=arguments;return new Promise((function(n,i){var o=e.apply(r,t);function a(e){asyncGeneratorStep(o,n,i,a,u,"next",e)}function u(e){asyncGeneratorStep(o,n,i,a,u,"throw",e)}a(void 0)}))}}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toPrimitive(e,r){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"==typeof r?r:String(r)}var version="2.2.10";function decimal_round(e,r,t,n,i){var o=e,a=r,u=r.length,s={"~-":function(){var e="<"===t?n-1:n;a=r.slice(0,e)},"~+":function(){var e="<"===t?n-1:n;if(!(u<=e||0===u)){var i=r.slice(0,e);0==+r.slice(e,u)?a=i:(i=(+"9".concat(i)+1).toString().slice(1)).length>e?(a=i.slice(1,i.length),o=(+o+1).toString()):a=i}},"~5":function(){if(0!==u){var e="<"===t?n-1:n;a=r.slice(0,e);var i=+r[e];Number.isNaN(i)||i>=5&&(a=(+"9".concat(a)+1).toString().slice(1)).length>e&&(a=a.slice(1,a.length),o=(+o+1).toString())}},"~6":function(){if(0!==u){var i,s="<"===t?n-1:n,c=+r[s],l=r.slice(+s+1,r.length);l=""===l?0:parseInt(l),i=0===s?+e[e.length-1]:+r[s-1],a=r.slice(0,s),(c>=6||5===c&&l>0||5===c&&i%2!=0)&&(a=(+"9".concat(a)+1).toString().slice(1)).length>s&&(a=a.slice(1,a.length),o=(+o+1).toString())}}};return"<="===t?u<=n?a=r.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"<"===t?u<n?a=r.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"="===t?u<n?a=r+"0".repeat(n-u):u>n&&s[i]&&s[i]():">="===t?u<n&&(a=r+"0".repeat(n-u)):">"===t&&u<=n&&(a=r+"0".repeat(n-u+1)),{int_part:o,dec_part:a}}var number_char="0123456789",var_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",number_first_char="0123456789-+",var_members_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$[].'\"",var_first_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",pure_number_var_first_char="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",empty_char=" \n\r\t",state_initial="initial",state_number="number",state_scientific="scientific",state_operator="operator",state_bracket="bracket",state_var="var",state_symbol="symbol",state_percent="percent",state_round="round",state_plus$1="plus",state_comma="comma",state_fraction="fraction",state_to_number="to-number",state_to_number_string="to-number-string",operator_set=new Set(["+","-","*","/","%","**","//"]),isArray=Array.isArray,isArray$1=isArray,freeGlobal="object"==("undefined"==typeof global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,freeGlobal$1=freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root=freeGlobal$1||freeSelf||Function("return this")(),root$1=root,_Symbol=root$1.Symbol,_Symbol$1=_Symbol,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol$1?_Symbol$1.toStringTag:void 0;function getRawTag(e){var r=hasOwnProperty$3.call(e,symToStringTag$1),t=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(r?e[symToStringTag$1]=t:delete e[symToStringTag$1]),i}var objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$1?_Symbol$1.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return null!=e&&"object"==_typeof(e)}var symbolTag="[object Symbol]";function isSymbol(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag(e)==symbolTag}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,r){if(isArray$1(e))return!1;var t=_typeof(e);return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=r&&e in Object(r))}function isObject(e){var r=_typeof(e);return null!=e&&("object"==r||"function"==r)}var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var r=baseGetTag(e);return r==funcTag||r==genTag||r==asyncTag||r==proxyTag}var coreJsData=root$1["__core-js_shared__"],coreJsData$1=coreJsData,maskSrcKey=(uid=/[^.]+$/.exec(coreJsData$1&&coreJsData$1.keys&&coreJsData$1.keys.IE_PROTO||""),uid?"Symbol(src)_1."+uid:""),uid;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,r){return null==e?void 0:e[r]}function getNative(e,r){var t=getValue(e,r);return baseIsNative(t)?t:void 0}var nativeCreate=getNative(Object,"create"),nativeCreate$1=nativeCreate;function hashClear(){this.__data__=nativeCreate$1?nativeCreate$1(null):{},this.size=0}function hashDelete(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet(e){var r=this.__data__;if(nativeCreate$1){var t=r[e];return t===HASH_UNDEFINED$1?void 0:t}return hasOwnProperty$1.call(r,e)?r[e]:void 0}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas(e){var r=this.__data__;return nativeCreate$1?void 0!==r[e]:hasOwnProperty.call(r,e)}var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=nativeCreate$1&&void 0===r?HASH_UNDEFINED:r,this}function Hash(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,r){return e===r||e!=e&&r!=r}function assocIndexOf(e,r){for(var t=e.length;t--;)if(eq(e[t][0],r))return t;return-1}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var r=this.__data__,t=assocIndexOf(r,e);return!(t<0)&&(t==r.length-1?r.pop():splice.call(r,t,1),--this.size,!0)}function listCacheGet(e){var r=this.__data__,t=assocIndexOf(r,e);return t<0?void 0:r[t][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,r){var t=this.__data__,n=assocIndexOf(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this}function ListCache(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map=getNative(root$1,"Map"),Map$1=Map;function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(e){var r=_typeof(e);return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e}function getMapData(e,r){var t=e.__data__;return isKeyable(r)?t["string"==typeof r?"string":"hash"]:t.map}function mapCacheDelete(e){var r=getMapData(this,e).delete(e);return this.size-=r?1:0,r}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,r){var t=getMapData(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this}function MapCache(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT="Expected a function";function memoize(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new TypeError(FUNC_ERROR_TEXT);var t=function t(){var n=arguments,i=r?r.apply(this,n):n[0],o=t.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return t.cache=o.set(i,a)||o,a};return t.cache=new(memoize.Cache||MapCache),t}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var r=memoize(e,(function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e})),t=r.cache;return r}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(rePropName,(function(e,t,n,i){r.push(n?i.replace(reEscapeChar,"$1"):t||e)})),r})),stringToPath$1=stringToPath;function arrayMap(e,r){for(var t=-1,n=null==e?0:e.length,i=Array(n);++t<n;)i[t]=r(e[t],t,e);return i}var INFINITY$1=1/0,symbolProto=_Symbol$1?_Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray$1(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var r=e+"";return"0"==r&&1/e==-INFINITY$1?"-0":r}function toString(e){return null==e?"":baseToString(e)}function castPath(e,r){return isArray$1(e)?e:isKey(e,r)?[e]:stringToPath$1(toString(e))}var INFINITY=1/0;function toKey(e){if("string"==typeof e||isSymbol(e))return e;var r=e+"";return"0"==r&&1/e==-INFINITY?"-0":r}function baseGet(e,r){for(var t=0,n=(r=castPath(r,e)).length;null!=e&&t<n;)e=e[toKey(r[t++])];return t&&t==n?e:void 0}function get(e,r,t){var n=null==e?void 0:baseGet(e,r);return void 0===n?t:n}function split_unit_num(e){for(var r,t,n,i=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],o=0;o<i.length;o++){var a=e.match(i[o]);if(a){n=a;break}}if(n){t=n[1];var u=n[2];""!==u.trim()&&(r=u)}return{num:t,unit:r}}function find_value(e,r,t){var n,i,o,a;return Array.isArray(e)?e.length>1?null!==(n=null!==(i=get(e[0],r))&&void 0!==i?i:get(e.at(-1),r))&&void 0!==n?n:t:1===e.length&&null!==(o=get(e[0],r))&&void 0!==o?o:t:null!==(a=get(e,r,t))&&void 0!==a?a:t}function parse_mantissa(e,r,t,n){var i=e.split("."),o=i[0],a=1===i.length?"":i[1],u=decimal_round(o,a,r,+t,n);return o=u.int_part,""===(a=u.dec_part)?o:"".concat(o,".").concat(a)}function integer_thousands(e){for(var r=e.length,t="";r>0;)t=e.substring(r-3,r)+(""!==t?",":"")+t,r-=3;return t}function parse_thousands(e){var r=e.split("."),t=r[0];return"-"===t[0]?r[0]="-"+integer_thousands(t.slice(1)):r[0]=integer_thousands(t),r.join(".")}function promise_queue(e){return _promise_queue.apply(this,arguments)}function _promise_queue(){return _promise_queue=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n,i,o=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=o.length>1&&void 0!==o[1]?o[1]:5e3,n=0;case 2:if(!(n<r.length)){e.next=16;break}return e.prev=3,e.next=6,Promise.race([r[n],new Promise((function(e,r){setTimeout((function(){return r(new Error("promise queue timeout err"))}),t)}))]);case 6:i=e.sent,e.next=12;break;case 9:return e.prev=9,e.t0=e.catch(3),e.abrupt("continue",13);case 12:return e.abrupt("return",i);case 13:n++,e.next=2;break;case 16:return e.abrupt("return",Promise.reject("错误的 promise queue 调用"));case 17:case"end":return e.stop()}}),e,null,[[3,9]])}))),_promise_queue.apply(this,arguments)}function test_urls(e){return _test_urls.apply(this,arguments)}function _test_urls(){return(_test_urls=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<r.length)){e.next=16;break}return e.prev=2,e.next=5,fetch(r[t]);case 5:if(!e.sent.ok){e.next=8;break}return e.abrupt("return",r[t]);case 8:e.next=13;break;case 10:return e.prev=10,e.t0=e.catch(2),e.abrupt("continue",13);case 13:t++,e.next=1;break;case 16:return e.abrupt("return",null);case 17:case"end":return e.stop()}}),e,null,[[2,10]])})))).apply(this,arguments)}function get_real_value(e,r){if(Array.isArray(e)){for(var t,n=0,i=e.length;n<i;n++){var o;if(void 0!==(t=null!==(o=get(e[n],r))&&void 0!==o?o:void 0))break}if(void 0===t)throw new Error("填充变量".concat(value,"失败"));return t}var a;return null!==(a=get(e,r))&&void 0!==a?a:void 0}function get_next_nonempty_char(e,r,t){var n;for(r++;r<t;){if(n=e[r],-1===empty_char.indexOf(n))return n;r++}}function parse_args(e,r){var t="",n={origin_expr:e,origin_fill_data:r,expr:"",fmt_expr:"",options:void 0,fill_data:void 0,_unit:void 0,_mode:void 0,_fmt:void 0};if(null!=r&&(n.options=r,Array.isArray(r)?n.fill_data=r:Array.isArray(r._fill_data)?n.fill_data=[r].concat(_toConsumableArray(r._fill_data)):void 0===r._fill_data?n.fill_data=[r]:n.fill_data=[r,r._fill_data]),n._mode=find_value(r,"_mode","normal"),n._unit=find_value(r,"_unit",!1),n._fmt=find_value(r,"_fmt"),"string"==typeof e){if(t=e,""===e.trim()||e.includes("NaN"))throw new Error("非法的表达式:".concat(e))}else{if("number"!=typeof e)throw new Error("错误的第一个参数类型: ".concat(e," 类型为:").concat(_typeof(e)));if(isNaN(e))throw new Error("传入了一个非法数字NaN");t=e.toString()}var i=t.split("|");return n.expr=i[0],i.length>1&&(n.fmt_expr=i[1].trim()),n}function push_token$3(e,r){if(r.curr_state===state_number||r.curr_state===state_scientific){var t=r.expr.slice(r.prev_index,r.cur_index);if(r._unit){var n,i=split_unit_num(t),o=i.num,a=i.unit;if(void 0===a)e.push({type:state_number,value:o,real_value:o,has_unit:!1});else r.has_unit=!0,null!==(n=r.unit_str)&&void 0!==n||(r.unit_str=a),e.push({type:state_number,value:o,real_value:o,has_unit:!0,unit:a})}else e.push({type:state_number,value:t,real_value:t,has_unit:!1})}else if(r.curr_state===state_var){r.has_var=!0;var u=r.expr.slice(r.prev_index,r.cur_index),s=get_real_value(r.fill_data,u);if(r._unit){var c,l=split_unit_num(s),f=l.num,p=l.unit;if(void 0===p)e.push({type:"var",value:u,real_value:f,has_unit:!1});else r.has_unit=!0,null!==(c=r.unit_str)&&void 0!==c||(r.unit_str=p),e.push({type:"var",value:u,real_value:f,has_unit:!0,unit:p})}else e.push({type:"var",value:u,real_value:s,has_unit:!1})}else e.push({type:r.curr_state,value:r.expr.slice(r.prev_index,r.cur_index)});r.curr_state=state_initial,r.prev_index=r.cur_index}function tokenizer(e,r,t){for(var n,i={has_var:!1,has_unit:!1,unit_str:void 0,fill_data:r,cur_index:0,prev_index:0,curr_state:state_initial,expr:e,_unit:t},o=e.length,a=[];i.cur_index<o;)switch(n=e[i.cur_index],i.curr_state){case state_initial:if(number_char.includes(n))i.curr_state=state_number,i.cur_index++;else if(" "===n)i.cur_index++,i.prev_index=i.cur_index;else if("+-".includes(n)){var u=a.at(-1);0===i.cur_index||"operator"===(null==u?void 0:u.type)||"("===(null==u?void 0:u.value)?(i.curr_state=state_number,i.cur_index++):(i.cur_index++,a.push({type:state_operator,value:e.slice(i.prev_index,i.cur_index)}),i.prev_index=i.cur_index)}else"*/%".includes(n)?(i.curr_state=state_operator,i.cur_index++):var_char.includes(n)?(i.curr_state=state_var,i.cur_index++):"()".includes(n)?(a.push({type:state_bracket,value:n}),i.curr_state=state_initial,i.cur_index++,i.prev_index=i.cur_index):(i.cur_index++,i.prev_index=i.cur_index);break;case state_number:if(number_char.includes(n))i.cur_index++;else if("."===n){if(i.cur_index===i.prev_index||e.slice(i.prev_index,i.cur_index).includes("."))throw new Error("非法的小数部分".concat(e.slice(i.prev_index,i.cur_index)));i.cur_index++}else"e"===n?(i.curr_state=state_scientific,i.cur_index++):t?"*/+-() ".indexOf(n)>-1||"%"===n&&number_char.includes(e[i.cur_index-1])&&pure_number_var_first_char.includes(get_next_nonempty_char(e,i.cur_index,o))?push_token$3(a,i):i.cur_index++:push_token$3(a,i);break;case state_operator:var s=e[i.cur_index-1];"*"===n&&"*"===s?(i.cur_index++,a.push({type:state_operator,value:"**"}),i.prev_index=i.cur_index):"/"===n&&"/"===s?(i.cur_index++,a.push({type:state_operator,value:"//"}),i.prev_index=i.cur_index):(a.push({type:state_operator,value:s}),i.prev_index=i.cur_index),i.curr_state=state_initial;break;case state_var:var_members_char.includes(n)?i.cur_index++:push_token$3(a,i);break;case state_scientific:if(number_char.includes(n))i.cur_index++;else if("+-".includes(n)){var c=i.prev_index;"+-".includes(e[c])&&(c+=1);var l=e.slice(c,i.cur_index),f=l.at(-1);l.includes(n)||"e"!==f?push_token$3(a,i):i.cur_index++}else t&&-1==="*/+-() ".indexOf(n)?i.cur_index++:push_token$3(a,i);break;default:throw new Error("字符扫描状态错误")}return i.prev_index<i.cur_index&&push_token$3(a,i),a.has_var=i.has_var,a.has_unit=i.has_unit,a.unit=i.unit_str,a}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var r,t,n,i,o,a,u,s,c,l,f=A.prototype={constructor:A,toString:null,valueOf:null},p=new A(1),h=20,_=4,v=-7,m=21,d=-1e7,g=1e7,b=!1,y=1,w=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},E="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function A(e,r){var i,o,a,u,s,c,l,f,p=this;if(!(p instanceof A))return new A(e,r);if(null==r){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>g?p.c=p.e=null:e.e<d?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((c="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,s=e;s>=10;s/=10,u++);return void(u>g?p.c=p.e=null:(p.e=u,p.c=[e]))}f=String(e)}else{if(!isNumeric.test(f=String(e)))return n(p,f,c);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(s=f.search(/e/i))>0?(u<0&&(u=s),u+=+f.slice(s+1),f=f.substring(0,s)):u<0&&(u=f.length)}else{if(intCheck(r,2,E.length,"Base"),10==r&&x)return B(p=new A(e),h+p.e+1,_);if(f=String(e),c="number"==typeof e){if(0*e!=0)return n(p,f,c,r);if(p.s=1/e<0?(f=f.slice(1),-1):1,A.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(i=E.slice(0,r),u=s=0,l=f.length;s<l;s++)if(i.indexOf(o=f.charAt(s))<0){if("."==o){if(s>u){u=l;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,s=-1,u=0;continue}return n(p,String(e),c,r)}c=!1,(u=(f=t(f,r,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(s=0;48===f.charCodeAt(s);s++);for(l=f.length;48===f.charCodeAt(--l););if(f=f.slice(s,++l)){if(l-=s,c&&A.DEBUG&&l>15&&(e>MAX_SAFE_INTEGER||e!==mathfloor(e)))throw Error(tooManyDigits+p.s*e);if((u=u-s-1)>g)p.c=p.e=null;else if(u<d)p.c=[p.e=0];else{if(p.e=u,p.c=[],s=(u+1)%LOG_BASE,u<0&&(s+=LOG_BASE),s<l){for(s&&p.c.push(+f.slice(0,s)),l-=LOG_BASE;s<l;)p.c.push(+f.slice(s,s+=LOG_BASE));s=LOG_BASE-(f=f.slice(s)).length}else s-=l;for(;s--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function N(e,r,t,n){var i,o,a,u,s;if(null==t?t=_:intCheck(t,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==r)s=coeffToString(e.c),s=1==n||2==n&&(a<=v||a>=m)?toExponential(s,a):toFixedPoint(s,a,"0");else if(o=(e=B(new A(e),r,t)).e,u=(s=coeffToString(e.c)).length,1==n||2==n&&(r<=o||o<=v)){for(;u<r;s+="0",u++);s=toExponential(s,o)}else if(r-=a,s=toFixedPoint(s,o,"0"),o+1>u){if(--r>0)for(s+=".";r--;s+="0");}else if((r+=o-u)>0)for(o+1==u&&(s+=".");r--;s+="0");return e.s<0&&i?"-"+s:s}function O(e,r){for(var t,n=1,i=new A(e[0]);n<e.length;n++){if(!(t=new A(e[n])).s){i=t;break}r.call(i,t)&&(i=t)}return i}function k(e,r,t){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,n++);return(t=n+t*LOG_BASE-1)>g?e.c=e.e=null:t<d?e.c=[e.e=0]:(e.e=t,e.c=r),e}function B(e,r,t,n){var i,o,a,u,s,c,l,f=e.c,p=POWS_TEN;if(f){e:{for(i=1,u=f[0];u>=10;u/=10,i++);if((o=r-i)<0)o+=LOG_BASE,a=r,l=(s=f[c=0])/p[i-a-1]%10|0;else if((c=mathceil((o+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));s=l=0,i=1,a=(o%=LOG_BASE)-LOG_BASE+1}else{for(s=u=f[c],i=1;u>=10;u/=10,i++);l=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:s/p[i-a-1]%10|0}if(n=n||r<0||null!=f[c+1]||(a<0?s:s%p[i-a-1]),n=t<4?(l||n)&&(0==t||t==(e.s<0?3:2)):l>5||5==l&&(4==t||n||6==t&&(o>0?a>0?s/p[i-a]:0:f[c-1])%10&1||t==(e.s<0?8:7)),r<1||!f[0])return f.length=0,n?(r-=e.e+1,f[0]=p[(LOG_BASE-r%LOG_BASE)%LOG_BASE],e.e=-r||0):f[0]=e.e=0,e;if(0==o?(f.length=c,u=1,c--):(f.length=c+1,u=p[LOG_BASE-o],f[c]=a>0?mathfloor(s/p[i-a]%p[a])*u:0),n)for(;;){if(0==c){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);o!=u&&(e.e++,f[0]==BASE&&(f[0]=1));break}if(f[c]+=u,f[c]!=BASE)break;f[c--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>g?e.c=e.e=null:e.e<d&&(e.c=[e.e=0])}return e}function T(e){var r,t=e.e;return null===t?e.toString():(r=coeffToString(e.c),r=t<=v||t>=m?toExponential(r,t):toFixedPoint(r,t,"0"),e.s<0?"-"+r:r)}return A.clone=clone,A.ROUND_UP=0,A.ROUND_DOWN=1,A.ROUND_CEIL=2,A.ROUND_FLOOR=3,A.ROUND_HALF_UP=4,A.ROUND_HALF_DOWN=5,A.ROUND_HALF_EVEN=6,A.ROUND_HALF_CEIL=7,A.ROUND_HALF_FLOOR=8,A.EUCLID=9,A.config=A.set=function(e){var r,t;if(null!=e){if("object"!=_typeof(e))throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(intCheck(t=e[r],0,MAX,r),h=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(intCheck(t=e[r],0,8,r),_=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(intCheck(t[0],-MAX,0,r),intCheck(t[1],0,MAX,r),v=t[0],m=t[1]):(intCheck(t,-MAX,MAX,r),v=-(m=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)intCheck(t[0],-MAX,-1,r),intCheck(t[1],1,MAX,r),d=t[0],g=t[1];else{if(intCheck(t,-MAX,MAX,r),!t)throw Error(bignumberError+r+" cannot be zero: "+t);d=-(g=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(bignumberError+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw b=!t,Error(bignumberError+"crypto unavailable");b=t}else b=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(intCheck(t=e[r],0,9,r),y=t),e.hasOwnProperty(r="POW_PRECISION")&&(intCheck(t=e[r],0,MAX,r),w=t),e.hasOwnProperty(r="FORMAT")){if("object"!=_typeof(t=e[r]))throw Error(bignumberError+r+" not an object: "+t);S=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.?$|[+\-.\s]|(.).*\1/.test(t))throw Error(bignumberError+r+" invalid: "+t);x="0123456789"==t.slice(0,10),E=t}}return{DECIMAL_PLACES:h,ROUNDING_MODE:_,EXPONENTIAL_AT:[v,m],RANGE:[d,g],CRYPTO:b,MODULO_MODE:y,POW_PRECISION:w,FORMAT:S,ALPHABET:E}},A.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!A.DEBUG)return!0;var r,t,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-MAX&&i<=MAX&&i===mathfloor(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((r=(i+1)%LOG_BASE)<1&&(r+=LOG_BASE),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||t>=BASE||t!==mathfloor(t))break e;if(0!==t)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},A.maximum=A.max=function(){return O(arguments,f.lt)},A.minimum=A.min=function(){return O(arguments,f.gt)},A.random=(i=9007199254740992,o=Math.random()*i&2097151?function(){return mathfloor(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,n,i,a,u=0,s=[],c=new A(p);if(null==e?e=h:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),b)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(a=131072*r[u]+(r[u+1]>>>11))>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),r[u]=t[0],r[u+1]=t[1]):(s.push(a%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw b=!1,Error(bignumberError+"crypto unavailable");for(r=crypto.randomBytes(i*=7);u<i;)(a=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6])>=9e15?crypto.randomBytes(7).copy(r,u):(s.push(a%1e14),u+=7);u=i/7}if(!b)for(;u<i;)(a=o())<9e15&&(s[u++]=a%1e14);for(i=s[--u],e%=LOG_BASE,i&&e&&(a=POWS_TEN[LOG_BASE-e],s[u]=mathfloor(i/a)*a);0===s[u];s.pop(),u--);if(u<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(u=1,a=s[0];a>=10;a/=10,u++);u<LOG_BASE&&(n-=LOG_BASE-u)}return c.e=n,c.c=s,c}),A.sum=function(){for(var e=1,r=arguments,t=new A(r[0]);e<r.length;)t=t.plus(r[e++]);return t},t=function(){var e="0123456789";function t(e,r,t,n){for(var i,o,a=[0],u=0,s=e.length;u<s;){for(o=a.length;o--;a[o]*=r);for(a[0]+=n.indexOf(e.charAt(u++)),i=0;i<a.length;i++)a[i]>t-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/t|0,a[i]%=t)}return a.reverse()}return function(n,i,o,a,u){var s,c,l,f,p,v,m,d,g=n.indexOf("."),b=h,y=_;for(g>=0&&(f=w,w=0,n=n.replace(".",""),v=(d=new A(i)).pow(n.length-g),w=f,d.c=t(toFixedPoint(coeffToString(v.c),v.e,"0"),10,o,e),d.e=d.c.length),l=f=(m=t(n,i,o,u?(s=E,e):(s=e,E))).length;0==m[--f];m.pop());if(!m[0])return s.charAt(0);if(g<0?--l:(v.c=m,v.e=l,v.s=a,m=(v=r(v,d,b,y,o)).c,p=v.r,l=v.e),g=m[c=l+b+1],f=o/2,p=p||c<0||null!=m[c+1],p=y<4?(null!=g||p)&&(0==y||y==(v.s<0?3:2)):g>f||g==f&&(4==y||p||6==y&&1&m[c-1]||y==(v.s<0?8:7)),c<1||!m[0])n=p?toFixedPoint(s.charAt(1),-b,s.charAt(0)):s.charAt(0);else{if(m.length=c,p)for(--o;++m[--c]>o;)m[c]=0,c||(++l,m=[1].concat(m));for(f=m.length;!m[--f];);for(g=0,n="";g<=f;n+=s.charAt(m[g++]));n=toFixedPoint(n,l,s.charAt(0))}return n}}(),r=function(){function e(e,r,t){var n,i,o,a,u=0,s=e.length,c=r%SQRT_BASE,l=r/SQRT_BASE|0;for(e=e.slice();s--;)u=((i=c*(o=e[s]%SQRT_BASE)+(n=l*o+(a=e[s]/SQRT_BASE|0)*c)%SQRT_BASE*SQRT_BASE+u)/t|0)+(n/SQRT_BASE|0)+l*a,e[s]=i%t;return u&&(e=[u].concat(e)),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,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,a,u){var s,c,l,f,p,h,_,v,m,d,g,b,y,w,S,E,x,N=n.s==i.s?1:-1,O=n.c,k=i.c;if(!(O&&O[0]&&k&&k[0]))return new A(n.s&&i.s&&(O?!k||O[0]!=k[0]:k)?O&&0==O[0]||!k?0*N:N/0:NaN);for(m=(v=new A(N)).c=[],N=o+(c=n.e-i.e)+1,u||(u=BASE,c=bitFloor(n.e/LOG_BASE)-bitFloor(i.e/LOG_BASE),N=N/LOG_BASE|0),l=0;k[l]==(O[l]||0);l++);if(k[l]>(O[l]||0)&&c--,N<0)m.push(1),f=!0;else{for(w=O.length,E=k.length,l=0,N+=2,(p=mathfloor(u/(k[0]+1)))>1&&(k=e(k,p,u),O=e(O,p,u),E=k.length,w=O.length),y=E,g=(d=O.slice(0,E)).length;g<E;d[g++]=0);x=k.slice(),x=[0].concat(x),S=k[0],k[1]>=u/2&&S++;do{if(p=0,(s=r(k,d,E,g))<0){if(b=d[0],E!=g&&(b=b*u+(d[1]||0)),(p=mathfloor(b/S))>1)for(p>=u&&(p=u-1),_=(h=e(k,p,u)).length,g=d.length;1==r(h,d,_,g);)p--,t(h,E<_?x:k,_,u),_=h.length,s=1;else 0==p&&(s=p=1),_=(h=k.slice()).length;if(_<g&&(h=[0].concat(h)),t(d,h,g,u),g=d.length,-1==s)for(;r(k,d,E,g)<1;)p++,t(d,E<g?x:k,g,u),g=d.length}else 0===s&&(p++,d=[0]);m[l++]=p,d[0]?d[g++]=O[y]||0:(d=[O[y]],g=1)}while((y++<w||null!=d[0])&&N--);f=null!=d[0],m[0]||m.splice(0,1)}if(u==BASE){for(l=1,N=m[0];N>=10;N/=10,l++);B(v,o+(v.e=l+c*LOG_BASE-1)+1,a,f)}else v.e=c,v.r=+f;return v}}(),a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,s=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,l=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,r,t,n){var i,o=t?r:r.replace(l,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!t&&(o=o.replace(a,(function(e,r,t){return i="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=i?e:r})),n&&(i=n,o=o.replace(u,"$1").replace(s,"0.$1")),r!=o))return new A(o,i);if(A.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new A(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,r){return compare(this,new A(e,r))},f.decimalPlaces=f.dp=function(e,r){var t,n,i,o=this;if(null!=e)return intCheck(e,0,MAX),null==r?r=_:intCheck(r,0,8),B(new A(o),e+o.e+1,r);if(!(t=o.c))return null;if(n=((i=t.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,i=t[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},f.dividedBy=f.div=function(e,t){return r(this,new A(e,t),h,_)},f.dividedToIntegerBy=f.idiv=function(e,t){return r(this,new A(e,t),0,1)},f.exponentiatedBy=f.pow=function(e,r){var t,n,i,o,a,u,s,c,l=this;if((e=new A(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+T(e));if(null!=r&&(r=new A(r)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return c=new A(Math.pow(+T(l),a?e.s*(2-isOdd(e)):+T(e))),r?c.mod(r):c;if(u=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new A(NaN);(n=!u&&l.isInteger()&&r.isInteger())&&(l=l.mod(r))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return o=l.s<0&&isOdd(e)?-0:0,l.e>-1&&(o=1/o),new A(u?1/o:o);w&&(o=mathceil(w/LOG_BASE+2))}for(a?(t=new A(.5),u&&(e.s=1),s=isOdd(e)):s=(i=Math.abs(+T(e)))%2,c=new A(p);;){if(s){if(!(c=c.times(l)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(r))}if(i){if(0===(i=mathfloor(i/2)))break;s=i%2}else if(B(e=e.times(t),e.e+1,1),e.e>14)s=isOdd(e);else{if(0===(i=+T(e)))break;s=i%2}l=l.times(l),o?l.c&&l.c.length>o&&(l.c.length=o):n&&(l=l.mod(r))}return n?c:(u&&(c=p.div(c)),r?c.mod(r):o?B(c,w,_,undefined):c)},f.integerValue=function(e){var r=new A(this);return null==e?e=_:intCheck(e,0,8),B(r,r.e+1,e)},f.isEqualTo=f.eq=function(e,r){return 0===compare(this,new A(e,r))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,r){return compare(this,new A(e,r))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,r){return 1===(r=compare(this,new A(e,r)))||0===r},f.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},f.isLessThan=f.lt=function(e,r){return compare(this,new A(e,r))<0},f.isLessThanOrEqualTo=f.lte=function(e,r){return-1===(r=compare(this,new A(e,r)))||0===r},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,r){var t,n,i,o,a=this,u=a.s;if(r=(e=new A(e,r)).s,!u||!r)return new A(NaN);if(u!=r)return e.s=-r,a.plus(e);var s=a.e/LOG_BASE,c=e.e/LOG_BASE,l=a.c,f=e.c;if(!s||!c){if(!l||!f)return l?(e.s=-r,e):new A(f?a:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-r,e):new A(l[0]?a:3==_?-0:0)}if(s=bitFloor(s),c=bitFloor(c),l=l.slice(),u=s-c){for((o=u<0)?(u=-u,i=l):(c=s,i=f),i.reverse(),r=u;r--;i.push(0));i.reverse()}else for(n=(o=(u=l.length)<(r=f.length))?u:r,u=r=0;r<n;r++)if(l[r]!=f[r]){o=l[r]<f[r];break}if(o&&(i=l,l=f,f=i,e.s=-e.s),(r=(n=f.length)-(t=l.length))>0)for(;r--;l[t++]=0);for(r=BASE-1;n>u;){if(l[--n]<f[n]){for(t=n;t&&!l[--t];l[t]=r);--l[t],l[n]+=BASE}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?k(e,l,c):(e.s=3==_?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,t){var n,i,o=this;return e=new A(e,t),!o.c||!e.s||e.c&&!e.c[0]?new A(NaN):!e.c||o.c&&!o.c[0]?new A(o):(9==y?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,y),(e=o.minus(n.times(e))).c[0]||1!=y||(e.s=o.s),e)},f.multipliedBy=f.times=function(e,r){var t,n,i,o,a,u,s,c,l,f,p,h,_,v,m,d=this,g=d.c,b=(e=new A(e,r)).c;if(!(g&&b&&g[0]&&b[0]))return!d.s||!e.s||g&&!g[0]&&!b||b&&!b[0]&&!g?e.c=e.e=e.s=null:(e.s*=d.s,g&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=bitFloor(d.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=d.s,(s=g.length)<(f=b.length)&&(_=g,g=b,b=_,i=s,s=f,f=i),i=s+f,_=[];i--;_.push(0));for(v=BASE,m=SQRT_BASE,i=f;--i>=0;){for(t=0,p=b[i]%m,h=b[i]/m|0,o=i+(a=s);o>i;)t=((c=p*(c=g[--a]%m)+(u=h*c+(l=g[a]/m|0)*p)%m*m+_[o]+t)/v|0)+(u/m|0)+h*l,_[o--]=c%v;_[o]=t}return t?++n:_.splice(0,1),k(e,_,n)},f.negated=function(){var e=new A(this);return e.s=-e.s||null,e},f.plus=function(e,r){var t,n=this,i=n.s;if(r=(e=new A(e,r)).s,!i||!r)return new A(NaN);if(i!=r)return e.s=-r,n.minus(e);var o=n.e/LOG_BASE,a=e.e/LOG_BASE,u=n.c,s=e.c;if(!o||!a){if(!u||!s)return new A(i/0);if(!u[0]||!s[0])return s[0]?e:new A(u[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),u=u.slice(),i=o-a){for(i>0?(a=o,t=s):(i=-i,t=u),t.reverse();i--;t.push(0));t.reverse()}for((i=u.length)-(r=s.length)<0&&(t=s,s=u,u=t,r=i),i=0;r;)i=(u[--r]=u[r]+s[r]+i)/BASE|0,u[r]=BASE===u[r]?0:u[r]%BASE;return i&&(u=[i].concat(u),++a),k(e,u,a)},f.precision=f.sd=function(e,r){var t,n,i,o=this;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==r?r=_:intCheck(r,0,8),B(new A(o),e,r);if(!(t=o.c))return null;if(n=(i=t.length-1)*LOG_BASE+1,i=t[i]){for(;i%10==0;i/=10,n--);for(i=t[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},f.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,t,n,i,o,a=this,u=a.c,s=a.s,c=a.e,l=h+4,f=new A("0.5");if(1!==s||!u||!u[0])return new A(!s||s<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(s=Math.sqrt(+T(a)))||s==1/0?(((t=coeffToString(u)).length+c)%2==0&&(t+="0"),s=Math.sqrt(+t),c=bitFloor((c+1)/2)-(c<0||c%2),n=new A(t=s==1/0?"5e"+c:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new A(s+""),n.c[0])for((s=(c=n.e)+l)<3&&(s=0);;)if(o=n,n=f.times(o.plus(r(a,o,l,1))),coeffToString(o.c).slice(0,s)===(t=coeffToString(n.c)).slice(0,s)){if(n.e<c&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(B(n,n.e+h+2,1),e=!n.times(n).eq(a));break}if(!i&&(B(o,o.e+h+2,0),o.times(o).eq(a))){n=o;break}l+=4,s+=4,i=1}return B(n,n.e+h+1,_,e)},f.toExponential=function(e,r){return null!=e&&(intCheck(e,0,MAX),e++),N(this,e,r,1)},f.toFixed=function(e,r){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),N(this,e,r)},f.toFormat=function(e,r,t){var n,i=this;if(null==t)null!=e&&r&&"object"==_typeof(r)?(t=r,r=null):e&&"object"==_typeof(e)?(t=e,e=r=null):t=S;else if("object"!=_typeof(t))throw Error(bignumberError+"Argument not an object: "+t);if(n=i.toFixed(e,r),i.c){var o,a=n.split("."),u=+t.groupSize,s=+t.secondaryGroupSize,c=t.groupSeparator||"",l=a[0],f=a[1],p=i.s<0,h=p?l.slice(1):l,_=h.length;if(s&&(o=u,u=s,s=o,_-=o),u>0&&_>0){for(o=_%u||u,l=h.substr(0,o);o<_;o+=u)l+=c+h.substr(o,u);s>0&&(l+=c+h.slice(o)),p&&(l="-"+l)}n=f?l+(t.decimalSeparator||"")+((s=+t.fractionGroupSize)?f.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):f):l}return(t.prefix||"")+n+(t.suffix||"")},f.toFraction=function(e){var t,n,i,o,a,u,s,c,l,f,h,v,m=this,d=m.c;if(null!=e&&(!(s=new A(e)).isInteger()&&(s.c||1!==s.s)||s.lt(p)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+T(s));if(!d)return new A(m);for(t=new A(p),l=n=new A(p),i=c=new A(p),v=coeffToString(d),a=t.e=v.length-m.e-1,t.c[0]=POWS_TEN[(u=a%LOG_BASE)<0?LOG_BASE+u:u],e=!e||s.comparedTo(t)>0?a>0?t:l:s,u=g,g=1/0,s=new A(v),c.c[0]=0;f=r(s,t,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,l=c.plus(f.times(o=l)),c=o,t=s.minus(f.times(o=t)),s=o;return o=r(e.minus(n),i,0,1),c=c.plus(o.times(l)),n=n.plus(o.times(i)),c.s=l.s=m.s,h=r(l,i,a*=2,_).minus(m).abs().comparedTo(r(c,n,a,_).minus(m).abs())<1?[l,i]:[c,n],g=u,h},f.toNumber=function(){return+T(this)},f.toPrecision=function(e,r){return null!=e&&intCheck(e,1,MAX),N(this,e,r,2)},f.toString=function(e){var r,n=this,i=n.s,o=n.e;return null===o?i?(r="Infinity",i<0&&(r="-"+r)):r="NaN":(null==e?r=o<=v||o>=m?toExponential(coeffToString(n.c),o):toFixedPoint(coeffToString(n.c),o,"0"):10===e&&x?r=toFixedPoint(coeffToString((n=B(new A(n),h+o+1,_)).c),n.e,"0"):(intCheck(e,2,E.length,"Base"),r=t(toFixedPoint(coeffToString(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(r="-"+r)),r},f.valueOf=f.toJSON=function(){return T(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=e&&A.set(e),A}function bitFloor(e){var r=0|e;return e>0||e===r?r:r-1}function coeffToString(e){for(var r,t,n=1,i=e.length,o=e[0]+"";n<i;){for(r=e[n++]+"",t=LOG_BASE-r.length;t--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare(e,r){var t,n,i=e.c,o=r.c,a=e.s,u=r.s,s=e.e,c=r.e;if(!a||!u)return null;if(t=i&&!i[0],n=o&&!o[0],t||n)return t?n?0:-u:a;if(a!=u)return a;if(t=a<0,n=s==c,!i||!o)return n?0:!i^t?1:-1;if(!n)return s>c^t?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,a=0;a<u;a++)if(i[a]!=o[a])return i[a]>o[a]^t?1:-1;return s==c?0:s>c^t?1:-1}function intCheck(e,r,t,n){if(e<r||e>t||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<r||e>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var r=e.c.length-1;return bitFloor(e.e/LOG_BASE)==r&&e.c[r]%2!=0}function toExponential(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function toFixedPoint(e,r,t){var n,i;if(r<0){for(i=t+".";++r;i+=t);e=i+e}else if(++r>(n=e.length)){for(i=t,r-=n;--r;i+=t);e+=i}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}var BigNumber=clone();function format(e,r){var t="";if("undefined"===(t=BigNumber.isBigNumber(e)?e.toFixed():"string"==typeof e?e:e.toString())||"NaN"===t)return[void 0,{}];var n={mantissa:null,mantissa_type:null,thousands:!1,sign:!1,round:"~-",scientific:!1,fraction:!1,percent:!1,to_number:!1,to_number_string:!1};if(r.forEach((function(e){var r=e.type;if("symbol"===r){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);n.mantissa_type=e.value}else if("to-number"===r)n.to_number=!0;else if("to-number-string"===r)n.to_number_string=!0;else if("comma"===r)n.thousands=!0;else if("number"===r)n.mantissa=e.value;else if("var"===r)n.mantissa=e.real_value;else if("plus"===r)n.sign=!0;else if("round"===r)n.round=e.value;else if("fraction"===r)n.fraction=!0;else if("scientific"===r)n.scientific=!0;else{if("percent"!==r)throw new Error("错误的fmt Token");n.percent=!0}})),n.to_number)return[+parse_mantissa(t,n.mantissa_type,n.mantissa,n.round),n];if(n.scientific){var i=BigNumber(t).toExponential();return[n.sign&&!i.startsWith("-")?"+"+i:i,n]}if(n.fraction){var o=BigNumber(t).toFraction().map((function(e){return e.toFixed()})).join("/");return[n.sign&&!o.startsWith("-")?"+"+o:o,n]}return n.percent&&(t=BigNumber(t).times(100).toFixed()),null===n.mantissa?t.includes(".")&&(t=t.replace(/0*$/,"")):t=parse_mantissa(t,n.mantissa_type,n.mantissa,n.round),n.thousands&&(t=parse_thousands(t)),n.sign&&(n.to_number=!1,t.startsWith("-")||(t="+"+t)),n.percent&&(t+="%"),[t,n]}function close_important_push(){}function open_important_push(){}function open_debug(){}function close_debug(){}function calc_wrap(e,r){var t={_error:"-"};return["string","number"].includes(_typeof(e))?void 0===r?/[a-zA-Z$_]/.test(e.toString())?function(r){return Array.isArray(r)?r.unshift(t):r=_objectSpread2(_objectSpread2({},t),r),calc(e,r)}:calc(e):(Array.isArray(r)?r.unshift(t):r=_objectSpread2(_objectSpread2({},t),r),calc(e,r)):(Array.isArray(e)?e.unshift(t):e=_objectSpread2(_objectSpread2({},t),e),function(r){return calc(r,e)})}function check_version(){return _check_version.apply(this,arguments)}function _check_version(){return _check_version=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var res,code,versions,last_version,larr,varr,script,url;return _regeneratorRuntime().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:if("undefined"==typeof process||"node"!==process.release.name){_context.next=19;break}if(!(parseInt(process.versions.node)>=17)){_context.next=17;break}return _context.next=4,promise_queue([fetch("https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js"),fetch("https://unpkg.com/a-calc@latest/a-calc.versions.js")]);case 4:return res=_context.sent,_context.next=7,res.text();case 7:code=_context.sent,versions=eval(code),last_version=versions.at(-1),larr=last_version.match(/(\d+)\.(\d+)\.(\d+)/),larr.shift(),larr=larr.map((function(e){return parseInt(e)})),varr=version.match(/(\d+)\.(\d+)\.(\d+)/),varr.shift(),varr=varr.map((function(e){return parseInt(e)})),(larr[0]>varr[0]||larr[0]===varr[0]&&larr[1]>varr[1]||larr[0]===varr[0]&&larr[1]===varr[1]&&larr[2]>varr[2])&&console.warn("a-calc has a new version:",last_version);case 17:_context.next=25;break;case 19:return script=document.createElement("script"),script.onload=function(){var e=a_calc_versions;if(Array.isArray(e)){var r=e.at(-1),t=r.match(/(\d+)\.(\d+)\.(\d+)/);t.shift(),t=t.map((function(e){return parseInt(e)}));var n=version.match(/(\d+)\.(\d+)\.(\d+)/);n.shift(),n=n.map((function(e){return parseInt(e)})),(t[0]>n[0]||t[0]===n[0]&&t[1]>n[1]||t[0]===n[0]&&t[1]===n[1]&&t[2]>n[2])&&console.log("%c↑↑↑ a-calc has a new version: %s ↑↑↑","color: #67C23A;",r)}},_context.next=23,test_urls(["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"]);case 23:url=_context.sent,url?(script.src=url,document.body.appendChild(script)):script=null;case 25:case"end":return _context.stop()}}),_callee)}))),_check_version.apply(this,arguments)}var operator=new Set(["+","-","*","/","%","**","//"]);function push_token$2(e,r,t){if(Number.isNaN(Number(r)))if("-"===r||"+"===r)0===e.length||"operator"===e.at(-1).type||"("===e.at(-1).value?e.push({type:"number",value:r,real_value:r,has_unit:!1}):e.push({type:"operator",value:r});else if(operator.has(r))e.push({type:"operator",value:r});else if(t._unit&&/^[+-]?\d/.test(r)){var n,i=split_unit_num(r),o=i.num,a=i.unit;if(void 0===a)e.push({type:"number",value:o,real_value:o,has_unit:!1});else t.has_unit=!0,null!==(n=t.unit_str)&&void 0!==n||(t.unit_str=a),e.push({type:"number",value:o,real_value:o,has_unit:!0,unit:a})}else if(var_first_char.includes(r[0])){t.has_var=!0;var u=get_real_value(t.fill_data,r);if(t._unit){var s,c=split_unit_num(u),l=c.num,f=c.unit;if(void 0===f)e.push({type:"var",value:r,real_value:l,has_unit:!1});else t.has_unit=!0,null!==(s=t.unit_str)&&void 0!==s||(t.unit_str=f),e.push({type:"var",value:r,real_value:l,has_unit:!0,unit:f})}else e.push({type:"var",value:r,real_value:u,has_unit:!1})}else{if(!/^[+-]?\d/.test(r))throw new Error("无法识别的标识符:".concat(r));var p=r.indexOf("e");-1!==p&&/^\d+$/.test(r.slice(p+1))&&e.push({type:"number",value:r,real_value:r,has_unit:!1})}else e.push({type:"number",value:r,real_value:r,has_unit:!1})}function tokenizer_space(e,r,t){for(var n,i=0,o=0,a=e.length,u=[],s={has_var:!1,has_unit:!1,unit_str:void 0,_unit:t,fill_data:r};o<a;)" "===(n=e[o])?(o>i&&push_token$2(u,e.slice(i,o),s),i=o+1):"("===n?(u.push({type:state_bracket,value:"("}),i=o+1):")"===n&&(o>i&&push_token$2(u,e.slice(i,o),s),u.push({type:state_bracket,value:")"}),i=o+1),o++;return o>i&&push_token$2(u,e.slice(i,o),s),u.has_var=s.has_var,u.has_unit=s.has_unit,u.unit=s.unit_str,u}function compute(e,r,t){if(void 0===e||void 0===r)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(r));switch(t){case"+":return new BigNumber(e).plus(r);case"-":return new BigNumber(e).minus(r);case"*":return new BigNumber(e).times(r);case"/":return new BigNumber(e).div(r);case"%":return new BigNumber(e).mod(r);case"**":return new BigNumber(e).pow(r);case"//":return new BigNumber(e).idiv(r)}}var operator_map$1={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens(e){if(1===e.length){var r=e[0];if("number"===r.type||"var"===r.type)return r.real_value;throw new Error("错误的表达式:".concat(r.value))}for(var t,n,i=[],o=[],a=0,u=e.length;a<u;a++)if("number"!==(t=e[a]).type&&"var"!==t.type)if("operator"!==t.type)if("("!==t.value){if(")"===t.value)for(var s=void 0;s=i.pop();){if("("===s){var c=o.at(-2);if("-"===c){var l=o.pop();o.pop(),o.push(BigNumber.isBigNumber(l)?l.negated():new BigNumber(l).negated())}else if("+"===c){var f=o.pop();o.pop(),o.push(f)}break}var p=o.pop(),h=o.pop();o.push(compute(h,p,s))}}else i.push("(");else{var _=i.at(-1);if("("===_){i.push(t.value);continue}var v=operator_map$1[t.value];if(!i.length){i.push(t.value);continue}if(v<operator_map$1[_])for(var m=void 0;m=i.pop();){if("("===m){i.push("(");break}var d=o.pop(),g=o.pop();o.push(compute(g,d,m))}else if(v===operator_map$1[_]){if("**"===t.value){i.push(t.value);continue}for(var b=void 0;b=i.pop();){if("("===b){i.push("(");break}if(operator_map$1[b]<v){i.push(b);break}var y=o.pop(),w=o.pop();o.push(compute(w,y,b))}}i.push(t.value)}else o.push(t.real_value);for(;n=i.pop();){var S=o.pop(),E=o.pop();o.push(compute(E,S,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return e.has_var||(e.calc_result=o[0]),o[0]}function push_token$1(e,r,t,n,i){r===state_var?(i.has_var=!0,e.push({type:r,value:t,real_value:get_real_value(i.fill_data,t)})):e.push({type:r,value:t}),n.prev=n.curr,i.state=state_initial}function fmt_tokenizer(e,r){for(var t,n={prev:0,curr:0},i=e.length,o={state:state_initial,fill_data:r,has_var:!1},a=[];n.curr<i;)switch(t=e[n.curr],o.state){case state_initial:if(" "===t)n.curr++,n.prev=n.curr;else if("<>=".includes(t))o.state=state_symbol,n.curr++;else if(","===t)n.curr++,push_token$1(a,state_comma,",",n,o);else if(var_char.includes(t))o.state=state_var,n.curr++;else if(number_char.includes(t))o.state=state_number,n.curr++;else if("+"===t)n.curr++,push_token$1(a,state_plus$1,"+",n,o);else if("~"===t)n.curr++,o.state=state_round;else if("%"===t)n.curr++,push_token$1(a,state_percent,"%",n,o);else if("/"===t)n.curr++,push_token$1(a,state_fraction,"/",n,o);else if("!"===t)if(o.state=state_initial,n.curr++,"n"===e[n.curr])n.curr++,push_token$1(a,state_to_number,"!n",n,o);else if("u"===e[n.curr])n.curr++,push_token$1(a,state_to_number_string,"!u",n,o);else{if("e"!==e[n.curr])throw new Error("无法识别的!模式字符:".concat(e[n.curr]));n.curr++,push_token$1(a,state_scientific,"!e",n,o)}else n.curr++,n.prev=n.curr;break;case state_symbol:"="===t&&n.curr++,push_token$1(a,state_symbol,e.slice(n.prev,n.curr),n,o);break;case state_number:number_char.includes(t)?n.curr++:push_token$1(a,state_number,e.slice(n.prev,n.curr),n,o);break;case state_var:var_members_char.includes(t)?n.curr++:push_token$1(a,state_var,e.slice(n.prev,n.curr),n,o);break;case state_round:if(!("56+-".includes(t)&&n.curr-n.prev<2))throw new Error("错误的舍入语法:".concat(e.slice(n.prev,n.curr+1)));n.curr++,push_token$1(a,state_round,e.slice(n.prev,n.curr),n,o);break;default:throw new Error("错误的fmt分词器状态")}return n.prev<n.curr&&push_token$1(a,o.state,e.slice(n.prev,n.curr),n,o),a.has_var=o.has_var,a}var symbol_set=new Set(["<",">","=",">=","<="]),rand_set=new Set(["~+","~-","~5","~6"]);function push_token(e,r,t){if(","===r)e.push({type:state_comma,value:","});else if(symbol_set.has(r))e.push({type:state_symbol,value:r});else if(Number.isNaN(Number(r)))if(var_first_char.includes(r[0]))t.has_var=!0,e.push({type:state_var,value:r,real_value:get_real_value(t.fill_data,r)});else if("%"===r)e.push({type:state_percent,value:r});else if("/"===r)e.push({type:state_fraction,value:r});else if("+"===r)e.push({type:state_plus,value:r});else if(rand_set.has(r))e.push({type:state_round,value:r});else if("!n"===r)e.push({type:state_to_number,value:r});else if("!u"===r)e.push({type:state_to_number_string,value:r});else{if("!e"!==r)throw new Error("无法识别的格式化字符: ".concat(r));e.push({type:state_scientific,value:r})}else e.push({type:state_number,value:r})}function fmt_tokenizer_space(e,r){for(var t,n=0,i=e.length,o={fill_data:r,has_var:!1},a=0,u=[];n<i;)" "===(t=e[n])?(n>a&&push_token(u,e.slice(a,n),o),a=n+1):"<>=".includes(t)&&("="===e[n+1]?(u.push({type:state_symbol,value:t+"="}),a=1+ ++n):(u.push({type:state_symbol,value:t}),a=n+1)),n++;return a<n&&push_token(u,e.slice(a,n),o),u.has_var=o.has_var,u}function compute_lite(e,r,t){switch(t){case"+":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).plus(r);case"-":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).minus(r);case"*":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).times(r);case"/":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).div(r);case"%":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).mod(r);case"**":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).pow(r);case"//":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).idiv(r)}}var operator_map={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens_lite(e,r){for(var t,n,i=[],o=[],a=0,u=e.length;a<u;a++){var s=(t=e[a])[0];if(var_first_char.includes(s))o.push(get_real_value(r,t));else if(operator_set.has(t)){var c=i.at(-1);if("("===c){i.push(t);continue}var l=operator_map[t];if(!i.length){i.push(t);continue}var f=operator_map[c];if(l<f)for(var p=i.at(-1);p&&"("!==p;){i.pop();var h=o.pop(),_=o.pop();o.push(compute_lite(_,h,p)),p=i.at(-1)}else if(l===f){if("**"===t){i.push(t);continue}for(var v=i.at(-1);v&&!(operator_map[v]<l||"("===v);){i.pop();var m=o.pop(),d=o.pop();o.push(compute_lite(d,m,v)),v=i.at(-1)}}i.push(t)}else if(number_first_char.includes(s))o.push(t);else if("("!==t){if(")"===t)for(var g=void 0;(g=i.pop())&&"("!==g;){var b=o.pop(),y=o.pop();o.push(compute_lite(y,b,g))}}else i.push("(")}for(;n=i.pop();){var w=o.pop(),S=o.pop();o.push(compute_lite(S,w,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return o[0]}function calc_lite(e,r,t){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"-";try{var i;if("number"==typeof e)i=e.toString();else{if(""===e)throw new Error("非法的空计算式");var o=e.split(" ");if(1===o.length){if(i=o[0],var_first_char.includes(i[0])&&(i=get_real_value(t,i)),isNaN(Number(i)))throw new Error("错误的计算式:".concat(e))}else i=eval_tokens_lite(o,t).toFixed()}if("string"==typeof r&&""!==r){var a=fmt_tokenizer(r,t);if(void 0!==a)i=_slicedToArray(format(i,a),1)[0]}if("NaN"===i||"Infinity"===i)throw new Error("计算环节出错");return i}catch(e){return n}}function calc_mini(e,r,t){switch(r){case"+":return BigNumber(e).plus(t).toFixed();case"-":return BigNumber(e).minus(t).toFixed();case"*":return BigNumber(e).times(t).toFixed();case"/":return BigNumber(e).div(t).toFixed();case"%":return BigNumber(e).mod(t).toFixed();case"**":return BigNumber(e).pow(t).toFixed();case"//":return BigNumber(e).idiv(t).toFixed()}}function calc(e,r){var t=find_value(r,"_error");try{var n,i,o,a,u,s=parse_args(e,r),c=s._unit,l=s._mode,f="space"===l||"space-all"===l?tokenizer_space(s.expr,s.fill_data,c):tokenizer(s.expr,s.fill_data,c),p=eval_tokens(f),h=BigNumber.isBigNumber(p)?p:new BigNumber(p);if("space-all"===l?(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer_space(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer_space(s._fmt,s.fill_data)):(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer(s._fmt,s.fill_data)),void 0===a?void 0!==u&&(a=u):void 0!==u&&(a=[].concat(_toConsumableArray(u),_toConsumableArray(a))),void 0===a)h=h.toFixed();else{var _=_slicedToArray(format(h,a),2);h=_[0],o=_[1]}if("Infinity"===h||"NaN"===h||void 0===h)throw new Error("计算错误可能是非法的计算式");return!f.has_unit||null!==(n=o)&&void 0!==n&&n.to_number||null!==(i=o)&&void 0!==i&&i.to_number_string||(h+=f.unit),h}catch(e){if(void 0===t)throw e;return t}}function check_update(){check_version().catch((function(){}))}function print_version(){console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")}var calc_util={check_update:check_update,print_version:print_version,open_debug:open_debug,close_debug:close_debug,close_important_push:close_important_push,open_important_push:open_important_push},fmt=calc;function plus(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).plus(r).toNumber():new BigNumber(e).plus(r).toFixed()}function sub(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).minus(r).toNumber():new BigNumber(e).minus(r).toFixed()}function mul(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).times(r).toNumber():new BigNumber(e).times(r).toFixed()}function div(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).div(r).toNumber():new BigNumber(e).div(r).toFixed()}function mod(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).mod(r).toNumber():new BigNumber(e).mod(r).toFixed()}function pow(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).pow(r).toNumber():new BigNumber(e).pow(r).toFixed()}function idiv(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).idiv(r).toNumber():new BigNumber(e).idiv(r).toFixed()}export{calc,calc_lite,calc_mini,calc_util,calc_wrap,div,fmt,idiv,mod,mul,parse_thousands,plus,pow,sub,version};
|
|
1
|
+
function _iterableToArrayLimit(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,i,o,a,u=[],s=!0,c=!1;try{if(o=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;s=!1}else for(;!(s=(n=o.call(t)).done)&&(u.push(n.value),u.length!==r);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw i}}return u}}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread2(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},r=Object.prototype,t=r.hasOwnProperty,n=Object.defineProperty||function(e,r,t){e[r]=t.value},i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(e,r,t){return Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[r]}try{s({},"")}catch(e){s=function(e,r,t){return e[r]=t}}function c(e,r,t,i){var o=r&&r.prototype instanceof p?r:p,a=Object.create(o.prototype),u=new A(i||[]);return n(a,"_invoke",{value:w(e,t,u)}),a}function l(e,r,t){try{return{type:"normal",arg:e.call(r,t)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function p(){}function h(){}function _(){}var v={};s(v,o,(function(){return this}));var m=Object.getPrototypeOf,d=m&&m(m(N([])));d&&d!==r&&t.call(d,o)&&(v=d);var g=_.prototype=p.prototype=Object.create(v);function b(e){["next","throw","return"].forEach((function(r){s(e,r,(function(e){return this._invoke(r,e)}))}))}function y(e,r){function i(n,o,a,u){var s=l(e[n],e,o);if("throw"!==s.type){var c=s.arg,f=c.value;return f&&"object"==typeof f&&t.call(f,"__await")?r.resolve(f.__await).then((function(e){i("next",e,a,u)}),(function(e){i("throw",e,a,u)})):r.resolve(f).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,u)}))}u(s.arg)}var o;n(this,"_invoke",{value:function(e,t){function n(){return new r((function(r,n){i(e,t,r,n)}))}return o=o?o.then(n,n):n()}})}function w(e,r,t){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return O()}for(t.method=i,t.arg=o;;){var a=t.delegate;if(a){var u=S(a,t);if(u){if(u===f)continue;return u}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if("suspendedStart"===n)throw n="completed",t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);n="executing";var s=l(e,r,t);if("normal"===s.type){if(n=t.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:t.done}}"throw"===s.type&&(n="completed",t.method="throw",t.arg=s.arg)}}}function S(e,r){var t=r.method,n=e.iterator[t];if(void 0===n)return r.delegate=null,"throw"===t&&e.iterator.return&&(r.method="return",r.arg=void 0,S(e,r),"throw"===r.method)||"return"!==t&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+t+"' method")),f;var i=l(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,f;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,f):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function E(e){var r={tryLoc:e[0]};1 in e&&(r.catchLoc=e[1]),2 in e&&(r.finallyLoc=e[2],r.afterLoc=e[3]),this.tryEntries.push(r)}function x(e){var r=e.completion||{};r.type="normal",delete r.arg,e.completion=r}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function N(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function r(){for(;++n<e.length;)if(t.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=_,n(g,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:h,configurable:!0}),h.displayName=s(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var r="function"==typeof e&&e.constructor;return!!r&&(r===h||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,s(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},b(y.prototype),s(y.prototype,a,(function(){return this})),e.AsyncIterator=y,e.async=function(r,t,n,i,o){void 0===o&&(o=Promise);var a=new y(c(r,t,n,i),o);return e.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},b(g),s(g,u,"Generator"),s(g,o,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var r=Object(e),t=[];for(var n in r)t.push(n);return t.reverse(),function e(){for(;t.length;){var n=t.pop();if(n in r)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=N,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&t.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(t,n){return a.type="throw",a.arg=e,r.next=t,n&&(r.method="next",r.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var u=t.call(o,"catchLoc"),s=t.call(o,"finallyLoc");if(u&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,r){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&t.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=r&&r<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=r,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(a)},complete:function(e,r){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&r&&(this.next=r),f},finish:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),x(t),f}},catch:function(e){for(var r=this.tryEntries.length-1;r>=0;--r){var t=this.tryEntries[r];if(t.tryLoc===e){var n=t.completion;if("throw"===n.type){var i=n.arg;x(t)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,t){return this.delegate={iterator:N(e),resultName:r,nextLoc:t},"next"===this.method&&(this.arg=void 0),f}},e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function asyncGeneratorStep(e,r,t,n,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void t(e)}u.done?r(s):Promise.resolve(s).then(n,i)}function _asyncToGenerator(e){return function(){var r=this,t=arguments;return new Promise((function(n,i){var o=e.apply(r,t);function a(e){asyncGeneratorStep(o,n,i,a,u,"next",e)}function u(e){asyncGeneratorStep(o,n,i,a,u,"throw",e)}a(void 0)}))}}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _slicedToArray(e,r){return _arrayWithHoles(e)||_iterableToArrayLimit(e,r)||_unsupportedIterableToArray(e,r)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,r):void 0}}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toPrimitive(e,r){if("object"!=typeof e||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function _toPropertyKey(e){var r=_toPrimitive(e,"string");return"symbol"==typeof r?r:String(r)}var version="2.2.12";function decimal_round(e,r,t,n,i){var o=e,a=r,u=r.length,s={"~-":function(){var e="<"===t?n-1:n;a=r.slice(0,e)},"~+":function(){var e="<"===t?n-1:n;if(!(u<=e||0===u)){var i=r.slice(0,e);0==+r.slice(e,u)?a=i:(i=(+"9".concat(i)+1).toString().slice(1)).length>e?(a=i.slice(1,i.length),o=(+o+1).toString()):a=i}},"~5":function(){if(0!==u){var e="<"===t?n-1:n;a=r.slice(0,e);var i=+r[e];Number.isNaN(i)||i>=5&&(a=(+"9".concat(a)+1).toString().slice(1)).length>e&&(a=a.slice(1,a.length),o=(+o+1).toString())}},"~6":function(){if(0!==u){var i,s="<"===t?n-1:n,c=+r[s],l=r.slice(+s+1,r.length);l=""===l?0:parseInt(l),i=0===s?+e[e.length-1]:+r[s-1],a=r.slice(0,s),(c>=6||5===c&&l>0||5===c&&i%2!=0)&&(a=(+"9".concat(a)+1).toString().slice(1)).length>s&&(a=a.slice(1,a.length),o=(+o+1).toString())}}};return"<="===t?u<=n?a=r.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"<"===t?u<n?a=r.replace(/0*$/,""):(s[i]&&s[i](),a=a.replace(/0+$/,"")):"="===t?u<n?a=r+"0".repeat(n-u):u>n&&s[i]&&s[i]():">="===t?u<n&&(a=r+"0".repeat(n-u)):">"===t&&u<=n&&(a=r+"0".repeat(n-u+1)),{int_part:o,dec_part:a}}var number_char="0123456789",var_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",number_first_char="0123456789-+",var_members_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$[].'\"",var_first_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",pure_number_var_first_char="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",empty_char=" \n\r\t",state_initial="initial",state_number="number",state_scientific="scientific",state_operator="operator",state_bracket="bracket",state_var="var",state_symbol="symbol",state_percent="percent",state_round="round",state_plus$1="plus",state_comma="comma",state_fraction="fraction",state_to_number="to-number",state_to_number_string="to-number-string",operator_set=new Set(["+","-","*","/","%","**","//"]),isArray=Array.isArray,isArray$1=isArray,freeGlobal="object"==("undefined"==typeof global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,freeGlobal$1=freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root=freeGlobal$1||freeSelf||Function("return this")(),root$1=root,_Symbol=root$1.Symbol,_Symbol$1=_Symbol,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol$1?_Symbol$1.toStringTag:void 0;function getRawTag(e){var r=hasOwnProperty$3.call(e,symToStringTag$1),t=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(r?e[symToStringTag$1]=t:delete e[symToStringTag$1]),i}var objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$1?_Symbol$1.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return null!=e&&"object"==_typeof(e)}var symbolTag="[object Symbol]";function isSymbol(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag(e)==symbolTag}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,r){if(isArray$1(e))return!1;var t=_typeof(e);return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=r&&e in Object(r))}function isObject(e){var r=_typeof(e);return null!=e&&("object"==r||"function"==r)}var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var r=baseGetTag(e);return r==funcTag||r==genTag||r==asyncTag||r==proxyTag}var coreJsData=root$1["__core-js_shared__"],coreJsData$1=coreJsData,maskSrcKey=(uid=/[^.]+$/.exec(coreJsData$1&&coreJsData$1.keys&&coreJsData$1.keys.IE_PROTO||""),uid?"Symbol(src)_1."+uid:""),uid;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,r){return null==e?void 0:e[r]}function getNative(e,r){var t=getValue(e,r);return baseIsNative(t)?t:void 0}var nativeCreate=getNative(Object,"create"),nativeCreate$1=nativeCreate;function hashClear(){this.__data__=nativeCreate$1?nativeCreate$1(null):{},this.size=0}function hashDelete(e){var r=this.has(e)&&delete this.__data__[e];return this.size-=r?1:0,r}var HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet(e){var r=this.__data__;if(nativeCreate$1){var t=r[e];return t===HASH_UNDEFINED$1?void 0:t}return hasOwnProperty$1.call(r,e)?r[e]:void 0}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas(e){var r=this.__data__;return nativeCreate$1?void 0!==r[e]:hasOwnProperty.call(r,e)}var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(e,r){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=nativeCreate$1&&void 0===r?HASH_UNDEFINED:r,this}function Hash(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,r){return e===r||e!=e&&r!=r}function assocIndexOf(e,r){for(var t=e.length;t--;)if(eq(e[t][0],r))return t;return-1}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var r=this.__data__,t=assocIndexOf(r,e);return!(t<0)&&(t==r.length-1?r.pop():splice.call(r,t,1),--this.size,!0)}function listCacheGet(e){var r=this.__data__,t=assocIndexOf(r,e);return t<0?void 0:r[t][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,r){var t=this.__data__,n=assocIndexOf(t,e);return n<0?(++this.size,t.push([e,r])):t[n][1]=r,this}function ListCache(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map=getNative(root$1,"Map"),Map$1=Map;function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(e){var r=_typeof(e);return"string"==r||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==e:null===e}function getMapData(e,r){var t=e.__data__;return isKeyable(r)?t["string"==typeof r?"string":"hash"]:t.map}function mapCacheDelete(e){var r=getMapData(this,e).delete(e);return this.size-=r?1:0,r}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,r){var t=getMapData(this,e),n=t.size;return t.set(e,r),this.size+=t.size==n?0:1,this}function MapCache(e){var r=-1,t=null==e?0:e.length;for(this.clear();++r<t;){var n=e[r];this.set(n[0],n[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT="Expected a function";function memoize(e,r){if("function"!=typeof e||null!=r&&"function"!=typeof r)throw new TypeError(FUNC_ERROR_TEXT);var t=function t(){var n=arguments,i=r?r.apply(this,n):n[0],o=t.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return t.cache=o.set(i,a)||o,a};return t.cache=new(memoize.Cache||MapCache),t}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var r=memoize(e,(function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e})),t=r.cache;return r}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(rePropName,(function(e,t,n,i){r.push(n?i.replace(reEscapeChar,"$1"):t||e)})),r})),stringToPath$1=stringToPath;function arrayMap(e,r){for(var t=-1,n=null==e?0:e.length,i=Array(n);++t<n;)i[t]=r(e[t],t,e);return i}var INFINITY$1=1/0,symbolProto=_Symbol$1?_Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray$1(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var r=e+"";return"0"==r&&1/e==-INFINITY$1?"-0":r}function toString(e){return null==e?"":baseToString(e)}function castPath(e,r){return isArray$1(e)?e:isKey(e,r)?[e]:stringToPath$1(toString(e))}var INFINITY=1/0;function toKey(e){if("string"==typeof e||isSymbol(e))return e;var r=e+"";return"0"==r&&1/e==-INFINITY?"-0":r}function baseGet(e,r){for(var t=0,n=(r=castPath(r,e)).length;null!=e&&t<n;)e=e[toKey(r[t++])];return t&&t==n?e:void 0}function get(e,r,t){var n=null==e?void 0:baseGet(e,r);return void 0===n?t:n}function split_unit_num(e){for(var r,t,n,i=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],o=0;o<i.length;o++){var a=e.match(i[o]);if(a){n=a;break}}if(n){t=n[1];var u=n[2];""!==u.trim()&&(r=u)}return{num:t,unit:r}}function find_value(e,r,t){var n,i,o,a;return Array.isArray(e)?e.length>1?null!==(n=null!==(i=get(e[0],r))&&void 0!==i?i:get(e.at(-1),r))&&void 0!==n?n:t:1===e.length&&null!==(o=get(e[0],r))&&void 0!==o?o:t:null!==(a=get(e,r,t))&&void 0!==a?a:t}function parse_mantissa(e,r,t,n){var i=e.split("."),o=i[0],a=1===i.length?"":i[1],u=decimal_round(o,a,r,+t,n);return o=u.int_part,""===(a=u.dec_part)?o:"".concat(o,".").concat(a)}function integer_thousands(e){for(var r=e.length,t="";r>0;)t=e.substring(r-3,r)+(""!==t?",":"")+t,r-=3;return t}function parse_thousands(e){var r=e.split("."),t=r[0];return"-"===t[0]?r[0]="-"+integer_thousands(t.slice(1)):r[0]=integer_thousands(t),r.join(".")}function promise_queue(e){return _promise_queue.apply(this,arguments)}function _promise_queue(){return _promise_queue=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t,n,i,o=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=o.length>1&&void 0!==o[1]?o[1]:5e3,n=0;case 2:if(!(n<r.length)){e.next=16;break}return e.prev=3,e.next=6,Promise.race([r[n],new Promise((function(e,r){setTimeout((function(){return r(new Error("promise queue timeout err"))}),t)}))]);case 6:i=e.sent,e.next=12;break;case 9:return e.prev=9,e.t0=e.catch(3),e.abrupt("continue",13);case 12:return e.abrupt("return",i);case 13:n++,e.next=2;break;case 16:return e.abrupt("return",Promise.reject("错误的 promise queue 调用"));case 17:case"end":return e.stop()}}),e,null,[[3,9]])}))),_promise_queue.apply(this,arguments)}function test_urls(e){return _test_urls.apply(this,arguments)}function _test_urls(){return(_test_urls=_asyncToGenerator(_regeneratorRuntime().mark((function e(r){var t;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<r.length)){e.next=16;break}return e.prev=2,e.next=5,fetch(r[t]);case 5:if(!e.sent.ok){e.next=8;break}return e.abrupt("return",r[t]);case 8:e.next=13;break;case 10:return e.prev=10,e.t0=e.catch(2),e.abrupt("continue",13);case 13:t++,e.next=1;break;case 16:return e.abrupt("return",null);case 17:case"end":return e.stop()}}),e,null,[[2,10]])})))).apply(this,arguments)}function get_real_value(e,r){if(Array.isArray(e)){for(var t,n=0,i=e.length;n<i;n++){var o;if(void 0!==(t=null!==(o=get(e[n],r))&&void 0!==o?o:void 0))break}if(void 0===t)throw new Error("填充变量".concat(value,"失败"));return t}var a;return null!==(a=get(e,r))&&void 0!==a?a:void 0}function get_next_nonempty_char(e,r,t){var n;for(r++;r<t;){if(n=e[r],-1===empty_char.indexOf(n))return n;r++}}function parse_args(e,r){var t="",n={origin_expr:e,origin_fill_data:r,expr:"",fmt_expr:"",options:void 0,fill_data:void 0,_unit:void 0,_mode:void 0,_fmt:void 0};if(null!=r&&(n.options=r,Array.isArray(r)?n.fill_data=r:Array.isArray(r._fill_data)?n.fill_data=[r].concat(_toConsumableArray(r._fill_data)):void 0===r._fill_data?n.fill_data=[r]:n.fill_data=[r,r._fill_data]),n._mode=find_value(r,"_mode","normal"),n._unit=find_value(r,"_unit",!1),n._fmt=find_value(r,"_fmt"),"string"==typeof e){if(t=e,""===e.trim()||e.includes("NaN"))throw new Error("非法的表达式:".concat(e))}else{if("number"!=typeof e)throw new Error("错误的第一个参数类型: ".concat(e," 类型为:").concat(_typeof(e)));if(isNaN(e))throw new Error("传入了一个非法数字NaN");t=e.toString()}var i=t.split("|");return n.expr=i[0],i.length>1&&(n.fmt_expr=i[1].trim()),n}function push_token$3(e,r){if(r.curr_state===state_number||r.curr_state===state_scientific){var t=r.expr.slice(r.prev_index,r.cur_index);if(r._unit){var n,i=split_unit_num(t),o=i.num,a=i.unit;if(void 0===a)e.push({type:state_number,value:o,real_value:o,has_unit:!1});else r.has_unit=!0,null!==(n=r.unit_str)&&void 0!==n||(r.unit_str=a),e.push({type:state_number,value:o,real_value:o,has_unit:!0,unit:a})}else e.push({type:state_number,value:t,real_value:t,has_unit:!1})}else if(r.curr_state===state_var){r.has_var=!0;var u=r.expr.slice(r.prev_index,r.cur_index),s=get_real_value(r.fill_data,u);if(r._unit){var c,l=split_unit_num(s),f=l.num,p=l.unit;if(void 0===p)e.push({type:"var",value:u,real_value:f,has_unit:!1});else r.has_unit=!0,null!==(c=r.unit_str)&&void 0!==c||(r.unit_str=p),e.push({type:"var",value:u,real_value:f,has_unit:!0,unit:p})}else e.push({type:"var",value:u,real_value:s,has_unit:!1})}else e.push({type:r.curr_state,value:r.expr.slice(r.prev_index,r.cur_index)});r.curr_state=state_initial,r.prev_index=r.cur_index}function tokenizer(e,r,t){for(var n,i={has_var:!1,has_unit:!1,unit_str:void 0,fill_data:r,cur_index:0,prev_index:0,curr_state:state_initial,expr:e,_unit:t},o=e.length,a=[];i.cur_index<o;)switch(n=e[i.cur_index],i.curr_state){case state_initial:if(number_char.includes(n))i.curr_state=state_number,i.cur_index++;else if(" "===n)i.cur_index++,i.prev_index=i.cur_index;else if("+-".includes(n)){var u=a.at(-1);0===i.cur_index||"operator"===(null==u?void 0:u.type)||"("===(null==u?void 0:u.value)?(i.curr_state=state_number,i.cur_index++):(i.cur_index++,a.push({type:state_operator,value:e.slice(i.prev_index,i.cur_index)}),i.prev_index=i.cur_index)}else"*/%".includes(n)?(i.curr_state=state_operator,i.cur_index++):var_char.includes(n)?(i.curr_state=state_var,i.cur_index++):"()".includes(n)?(a.push({type:state_bracket,value:n}),i.curr_state=state_initial,i.cur_index++,i.prev_index=i.cur_index):(i.cur_index++,i.prev_index=i.cur_index);break;case state_number:if(number_char.includes(n))i.cur_index++;else if("."===n){if(i.cur_index===i.prev_index||e.slice(i.prev_index,i.cur_index).includes("."))throw new Error("非法的小数部分".concat(e.slice(i.prev_index,i.cur_index)));i.cur_index++}else"e"===n?(i.curr_state=state_scientific,i.cur_index++):t?"*/+-() ".indexOf(n)>-1||"%"===n&&number_char.includes(e[i.cur_index-1])&&pure_number_var_first_char.includes(get_next_nonempty_char(e,i.cur_index,o))?push_token$3(a,i):i.cur_index++:push_token$3(a,i);break;case state_operator:var s=e[i.cur_index-1];"*"===n&&"*"===s?(i.cur_index++,a.push({type:state_operator,value:"**"}),i.prev_index=i.cur_index):"/"===n&&"/"===s?(i.cur_index++,a.push({type:state_operator,value:"//"}),i.prev_index=i.cur_index):(a.push({type:state_operator,value:s}),i.prev_index=i.cur_index),i.curr_state=state_initial;break;case state_var:var_members_char.includes(n)?i.cur_index++:push_token$3(a,i);break;case state_scientific:if(number_char.includes(n))i.cur_index++;else if("+-".includes(n)){var c=i.prev_index;"+-".includes(e[c])&&(c+=1);var l=e.slice(c,i.cur_index),f=l.at(-1);l.includes(n)||"e"!==f?push_token$3(a,i):i.cur_index++}else t&&-1==="*/+-() ".indexOf(n)?i.cur_index++:push_token$3(a,i);break;default:throw new Error("字符扫描状态错误")}return i.prev_index<i.cur_index&&push_token$3(a,i),a.has_var=i.has_var,a.has_unit=i.has_unit,a.unit=i.unit_str,a}var isNumeric=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,bignumberError="[BigNumber Error] ",tooManyDigits=bignumberError+"Number primitive has more than 15 significant digits: ",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function clone(e){var r,t,n,i,o,a,u,s,c,l,f=A.prototype={constructor:A,toString:null,valueOf:null},p=new A(1),h=20,_=4,v=-7,m=21,d=-1e7,g=1e7,b=!1,y=1,w=0,S={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},E="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function A(e,r){var i,o,a,u,s,c,l,f,p=this;if(!(p instanceof A))return new A(e,r);if(null==r){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>g?p.c=p.e=null:e.e<d?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((c="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,s=e;s>=10;s/=10,u++);return void(u>g?p.c=p.e=null:(p.e=u,p.c=[e]))}f=String(e)}else{if(!isNumeric.test(f=String(e)))return n(p,f,c);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(s=f.search(/e/i))>0?(u<0&&(u=s),u+=+f.slice(s+1),f=f.substring(0,s)):u<0&&(u=f.length)}else{if(intCheck(r,2,E.length,"Base"),10==r&&x)return B(p=new A(e),h+p.e+1,_);if(f=String(e),c="number"==typeof e){if(0*e!=0)return n(p,f,c,r);if(p.s=1/e<0?(f=f.slice(1),-1):1,A.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(i=E.slice(0,r),u=s=0,l=f.length;s<l;s++)if(i.indexOf(o=f.charAt(s))<0){if("."==o){if(s>u){u=l;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,s=-1,u=0;continue}return n(p,String(e),c,r)}c=!1,(u=(f=t(f,r,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(s=0;48===f.charCodeAt(s);s++);for(l=f.length;48===f.charCodeAt(--l););if(f=f.slice(s,++l)){if(l-=s,c&&A.DEBUG&&l>15&&(e>MAX_SAFE_INTEGER||e!==mathfloor(e)))throw Error(tooManyDigits+p.s*e);if((u=u-s-1)>g)p.c=p.e=null;else if(u<d)p.c=[p.e=0];else{if(p.e=u,p.c=[],s=(u+1)%LOG_BASE,u<0&&(s+=LOG_BASE),s<l){for(s&&p.c.push(+f.slice(0,s)),l-=LOG_BASE;s<l;)p.c.push(+f.slice(s,s+=LOG_BASE));s=LOG_BASE-(f=f.slice(s)).length}else s-=l;for(;s--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function N(e,r,t,n){var i,o,a,u,s;if(null==t?t=_:intCheck(t,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==r)s=coeffToString(e.c),s=1==n||2==n&&(a<=v||a>=m)?toExponential(s,a):toFixedPoint(s,a,"0");else if(o=(e=B(new A(e),r,t)).e,u=(s=coeffToString(e.c)).length,1==n||2==n&&(r<=o||o<=v)){for(;u<r;s+="0",u++);s=toExponential(s,o)}else if(r-=a,s=toFixedPoint(s,o,"0"),o+1>u){if(--r>0)for(s+=".";r--;s+="0");}else if((r+=o-u)>0)for(o+1==u&&(s+=".");r--;s+="0");return e.s<0&&i?"-"+s:s}function O(e,r){for(var t,n=1,i=new A(e[0]);n<e.length;n++){if(!(t=new A(e[n])).s){i=t;break}r.call(i,t)&&(i=t)}return i}function k(e,r,t){for(var n=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,n++);return(t=n+t*LOG_BASE-1)>g?e.c=e.e=null:t<d?e.c=[e.e=0]:(e.e=t,e.c=r),e}function B(e,r,t,n){var i,o,a,u,s,c,l,f=e.c,p=POWS_TEN;if(f){e:{for(i=1,u=f[0];u>=10;u/=10,i++);if((o=r-i)<0)o+=LOG_BASE,a=r,l=(s=f[c=0])/p[i-a-1]%10|0;else if((c=mathceil((o+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));s=l=0,i=1,a=(o%=LOG_BASE)-LOG_BASE+1}else{for(s=u=f[c],i=1;u>=10;u/=10,i++);l=(a=(o%=LOG_BASE)-LOG_BASE+i)<0?0:s/p[i-a-1]%10|0}if(n=n||r<0||null!=f[c+1]||(a<0?s:s%p[i-a-1]),n=t<4?(l||n)&&(0==t||t==(e.s<0?3:2)):l>5||5==l&&(4==t||n||6==t&&(o>0?a>0?s/p[i-a]:0:f[c-1])%10&1||t==(e.s<0?8:7)),r<1||!f[0])return f.length=0,n?(r-=e.e+1,f[0]=p[(LOG_BASE-r%LOG_BASE)%LOG_BASE],e.e=-r||0):f[0]=e.e=0,e;if(0==o?(f.length=c,u=1,c--):(f.length=c+1,u=p[LOG_BASE-o],f[c]=a>0?mathfloor(s/p[i-a]%p[a])*u:0),n)for(;;){if(0==c){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);o!=u&&(e.e++,f[0]==BASE&&(f[0]=1));break}if(f[c]+=u,f[c]!=BASE)break;f[c--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>g?e.c=e.e=null:e.e<d&&(e.c=[e.e=0])}return e}function T(e){var r,t=e.e;return null===t?e.toString():(r=coeffToString(e.c),r=t<=v||t>=m?toExponential(r,t):toFixedPoint(r,t,"0"),e.s<0?"-"+r:r)}return A.clone=clone,A.ROUND_UP=0,A.ROUND_DOWN=1,A.ROUND_CEIL=2,A.ROUND_FLOOR=3,A.ROUND_HALF_UP=4,A.ROUND_HALF_DOWN=5,A.ROUND_HALF_EVEN=6,A.ROUND_HALF_CEIL=7,A.ROUND_HALF_FLOOR=8,A.EUCLID=9,A.config=A.set=function(e){var r,t;if(null!=e){if("object"!=_typeof(e))throw Error(bignumberError+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(intCheck(t=e[r],0,MAX,r),h=t),e.hasOwnProperty(r="ROUNDING_MODE")&&(intCheck(t=e[r],0,8,r),_=t),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((t=e[r])&&t.pop?(intCheck(t[0],-MAX,0,r),intCheck(t[1],0,MAX,r),v=t[0],m=t[1]):(intCheck(t,-MAX,MAX,r),v=-(m=t<0?-t:t))),e.hasOwnProperty(r="RANGE"))if((t=e[r])&&t.pop)intCheck(t[0],-MAX,-1,r),intCheck(t[1],1,MAX,r),d=t[0],g=t[1];else{if(intCheck(t,-MAX,MAX,r),!t)throw Error(bignumberError+r+" cannot be zero: "+t);d=-(g=t<0?-t:t)}if(e.hasOwnProperty(r="CRYPTO")){if((t=e[r])!==!!t)throw Error(bignumberError+r+" not true or false: "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw b=!t,Error(bignumberError+"crypto unavailable");b=t}else b=t}if(e.hasOwnProperty(r="MODULO_MODE")&&(intCheck(t=e[r],0,9,r),y=t),e.hasOwnProperty(r="POW_PRECISION")&&(intCheck(t=e[r],0,MAX,r),w=t),e.hasOwnProperty(r="FORMAT")){if("object"!=_typeof(t=e[r]))throw Error(bignumberError+r+" not an object: "+t);S=t}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(t=e[r])||/^.?$|[+\-.\s]|(.).*\1/.test(t))throw Error(bignumberError+r+" invalid: "+t);x="0123456789"==t.slice(0,10),E=t}}return{DECIMAL_PLACES:h,ROUNDING_MODE:_,EXPONENTIAL_AT:[v,m],RANGE:[d,g],CRYPTO:b,MODULO_MODE:y,POW_PRECISION:w,FORMAT:S,ALPHABET:E}},A.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!A.DEBUG)return!0;var r,t,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-MAX&&i<=MAX&&i===mathfloor(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((r=(i+1)%LOG_BASE)<1&&(r+=LOG_BASE),String(n[0]).length==r){for(r=0;r<n.length;r++)if((t=n[r])<0||t>=BASE||t!==mathfloor(t))break e;if(0!==t)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},A.maximum=A.max=function(){return O(arguments,f.lt)},A.minimum=A.min=function(){return O(arguments,f.gt)},A.random=(i=9007199254740992,o=Math.random()*i&2097151?function(){return mathfloor(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,t,n,i,a,u=0,s=[],c=new A(p);if(null==e?e=h:intCheck(e,0,MAX),i=mathceil(e/LOG_BASE),b)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(a=131072*r[u]+(r[u+1]>>>11))>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),r[u]=t[0],r[u+1]=t[1]):(s.push(a%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw b=!1,Error(bignumberError+"crypto unavailable");for(r=crypto.randomBytes(i*=7);u<i;)(a=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6])>=9e15?crypto.randomBytes(7).copy(r,u):(s.push(a%1e14),u+=7);u=i/7}if(!b)for(;u<i;)(a=o())<9e15&&(s[u++]=a%1e14);for(i=s[--u],e%=LOG_BASE,i&&e&&(a=POWS_TEN[LOG_BASE-e],s[u]=mathfloor(i/a)*a);0===s[u];s.pop(),u--);if(u<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(u=1,a=s[0];a>=10;a/=10,u++);u<LOG_BASE&&(n-=LOG_BASE-u)}return c.e=n,c.c=s,c}),A.sum=function(){for(var e=1,r=arguments,t=new A(r[0]);e<r.length;)t=t.plus(r[e++]);return t},t=function(){var e="0123456789";function t(e,r,t,n){for(var i,o,a=[0],u=0,s=e.length;u<s;){for(o=a.length;o--;a[o]*=r);for(a[0]+=n.indexOf(e.charAt(u++)),i=0;i<a.length;i++)a[i]>t-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/t|0,a[i]%=t)}return a.reverse()}return function(n,i,o,a,u){var s,c,l,f,p,v,m,d,g=n.indexOf("."),b=h,y=_;for(g>=0&&(f=w,w=0,n=n.replace(".",""),v=(d=new A(i)).pow(n.length-g),w=f,d.c=t(toFixedPoint(coeffToString(v.c),v.e,"0"),10,o,e),d.e=d.c.length),l=f=(m=t(n,i,o,u?(s=E,e):(s=e,E))).length;0==m[--f];m.pop());if(!m[0])return s.charAt(0);if(g<0?--l:(v.c=m,v.e=l,v.s=a,m=(v=r(v,d,b,y,o)).c,p=v.r,l=v.e),g=m[c=l+b+1],f=o/2,p=p||c<0||null!=m[c+1],p=y<4?(null!=g||p)&&(0==y||y==(v.s<0?3:2)):g>f||g==f&&(4==y||p||6==y&&1&m[c-1]||y==(v.s<0?8:7)),c<1||!m[0])n=p?toFixedPoint(s.charAt(1),-b,s.charAt(0)):s.charAt(0);else{if(m.length=c,p)for(--o;++m[--c]>o;)m[c]=0,c||(++l,m=[1].concat(m));for(f=m.length;!m[--f];);for(g=0,n="";g<=f;n+=s.charAt(m[g++]));n=toFixedPoint(n,l,s.charAt(0))}return n}}(),r=function(){function e(e,r,t){var n,i,o,a,u=0,s=e.length,c=r%SQRT_BASE,l=r/SQRT_BASE|0;for(e=e.slice();s--;)u=((i=c*(o=e[s]%SQRT_BASE)+(n=l*o+(a=e[s]/SQRT_BASE|0)*c)%SQRT_BASE*SQRT_BASE+u)/t|0)+(n/SQRT_BASE|0)+l*a,e[s]=i%t;return u&&(e=[u].concat(e)),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,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,o,a,u){var s,c,l,f,p,h,_,v,m,d,g,b,y,w,S,E,x,N=n.s==i.s?1:-1,O=n.c,k=i.c;if(!(O&&O[0]&&k&&k[0]))return new A(n.s&&i.s&&(O?!k||O[0]!=k[0]:k)?O&&0==O[0]||!k?0*N:N/0:NaN);for(m=(v=new A(N)).c=[],N=o+(c=n.e-i.e)+1,u||(u=BASE,c=bitFloor(n.e/LOG_BASE)-bitFloor(i.e/LOG_BASE),N=N/LOG_BASE|0),l=0;k[l]==(O[l]||0);l++);if(k[l]>(O[l]||0)&&c--,N<0)m.push(1),f=!0;else{for(w=O.length,E=k.length,l=0,N+=2,(p=mathfloor(u/(k[0]+1)))>1&&(k=e(k,p,u),O=e(O,p,u),E=k.length,w=O.length),y=E,g=(d=O.slice(0,E)).length;g<E;d[g++]=0);x=k.slice(),x=[0].concat(x),S=k[0],k[1]>=u/2&&S++;do{if(p=0,(s=r(k,d,E,g))<0){if(b=d[0],E!=g&&(b=b*u+(d[1]||0)),(p=mathfloor(b/S))>1)for(p>=u&&(p=u-1),_=(h=e(k,p,u)).length,g=d.length;1==r(h,d,_,g);)p--,t(h,E<_?x:k,_,u),_=h.length,s=1;else 0==p&&(s=p=1),_=(h=k.slice()).length;if(_<g&&(h=[0].concat(h)),t(d,h,g,u),g=d.length,-1==s)for(;r(k,d,E,g)<1;)p++,t(d,E<g?x:k,g,u),g=d.length}else 0===s&&(p++,d=[0]);m[l++]=p,d[0]?d[g++]=O[y]||0:(d=[O[y]],g=1)}while((y++<w||null!=d[0])&&N--);f=null!=d[0],m[0]||m.splice(0,1)}if(u==BASE){for(l=1,N=m[0];N>=10;N/=10,l++);B(v,o+(v.e=l+c*LOG_BASE-1)+1,a,f)}else v.e=c,v.r=+f;return v}}(),a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,s=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,l=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,r,t,n){var i,o=t?r:r.replace(l,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!t&&(o=o.replace(a,(function(e,r,t){return i="x"==(t=t.toLowerCase())?16:"b"==t?2:8,n&&n!=i?e:r})),n&&(i=n,o=o.replace(u,"$1").replace(s,"0.$1")),r!=o))return new A(o,i);if(A.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+r);e.s=null}e.c=e.e=null},f.absoluteValue=f.abs=function(){var e=new A(this);return e.s<0&&(e.s=1),e},f.comparedTo=function(e,r){return compare(this,new A(e,r))},f.decimalPlaces=f.dp=function(e,r){var t,n,i,o=this;if(null!=e)return intCheck(e,0,MAX),null==r?r=_:intCheck(r,0,8),B(new A(o),e+o.e+1,r);if(!(t=o.c))return null;if(n=((i=t.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,i=t[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},f.dividedBy=f.div=function(e,t){return r(this,new A(e,t),h,_)},f.dividedToIntegerBy=f.idiv=function(e,t){return r(this,new A(e,t),0,1)},f.exponentiatedBy=f.pow=function(e,r){var t,n,i,o,a,u,s,c,l=this;if((e=new A(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+T(e));if(null!=r&&(r=new A(r)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return c=new A(Math.pow(+T(l),a?e.s*(2-isOdd(e)):+T(e))),r?c.mod(r):c;if(u=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new A(NaN);(n=!u&&l.isInteger()&&r.isInteger())&&(l=l.mod(r))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return o=l.s<0&&isOdd(e)?-0:0,l.e>-1&&(o=1/o),new A(u?1/o:o);w&&(o=mathceil(w/LOG_BASE+2))}for(a?(t=new A(.5),u&&(e.s=1),s=isOdd(e)):s=(i=Math.abs(+T(e)))%2,c=new A(p);;){if(s){if(!(c=c.times(l)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(r))}if(i){if(0===(i=mathfloor(i/2)))break;s=i%2}else if(B(e=e.times(t),e.e+1,1),e.e>14)s=isOdd(e);else{if(0===(i=+T(e)))break;s=i%2}l=l.times(l),o?l.c&&l.c.length>o&&(l.c.length=o):n&&(l=l.mod(r))}return n?c:(u&&(c=p.div(c)),r?c.mod(r):o?B(c,w,_,undefined):c)},f.integerValue=function(e){var r=new A(this);return null==e?e=_:intCheck(e,0,8),B(r,r.e+1,e)},f.isEqualTo=f.eq=function(e,r){return 0===compare(this,new A(e,r))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(e,r){return compare(this,new A(e,r))>0},f.isGreaterThanOrEqualTo=f.gte=function(e,r){return 1===(r=compare(this,new A(e,r)))||0===r},f.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},f.isLessThan=f.lt=function(e,r){return compare(this,new A(e,r))<0},f.isLessThanOrEqualTo=f.lte=function(e,r){return-1===(r=compare(this,new A(e,r)))||0===r},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(e,r){var t,n,i,o,a=this,u=a.s;if(r=(e=new A(e,r)).s,!u||!r)return new A(NaN);if(u!=r)return e.s=-r,a.plus(e);var s=a.e/LOG_BASE,c=e.e/LOG_BASE,l=a.c,f=e.c;if(!s||!c){if(!l||!f)return l?(e.s=-r,e):new A(f?a:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-r,e):new A(l[0]?a:3==_?-0:0)}if(s=bitFloor(s),c=bitFloor(c),l=l.slice(),u=s-c){for((o=u<0)?(u=-u,i=l):(c=s,i=f),i.reverse(),r=u;r--;i.push(0));i.reverse()}else for(n=(o=(u=l.length)<(r=f.length))?u:r,u=r=0;r<n;r++)if(l[r]!=f[r]){o=l[r]<f[r];break}if(o&&(i=l,l=f,f=i,e.s=-e.s),(r=(n=f.length)-(t=l.length))>0)for(;r--;l[t++]=0);for(r=BASE-1;n>u;){if(l[--n]<f[n]){for(t=n;t&&!l[--t];l[t]=r);--l[t],l[n]+=BASE}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?k(e,l,c):(e.s=3==_?-1:1,e.c=[e.e=0],e)},f.modulo=f.mod=function(e,t){var n,i,o=this;return e=new A(e,t),!o.c||!e.s||e.c&&!e.c[0]?new A(NaN):!e.c||o.c&&!o.c[0]?new A(o):(9==y?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,y),(e=o.minus(n.times(e))).c[0]||1!=y||(e.s=o.s),e)},f.multipliedBy=f.times=function(e,r){var t,n,i,o,a,u,s,c,l,f,p,h,_,v,m,d=this,g=d.c,b=(e=new A(e,r)).c;if(!(g&&b&&g[0]&&b[0]))return!d.s||!e.s||g&&!g[0]&&!b||b&&!b[0]&&!g?e.c=e.e=e.s=null:(e.s*=d.s,g&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=bitFloor(d.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=d.s,(s=g.length)<(f=b.length)&&(_=g,g=b,b=_,i=s,s=f,f=i),i=s+f,_=[];i--;_.push(0));for(v=BASE,m=SQRT_BASE,i=f;--i>=0;){for(t=0,p=b[i]%m,h=b[i]/m|0,o=i+(a=s);o>i;)t=((c=p*(c=g[--a]%m)+(u=h*c+(l=g[a]/m|0)*p)%m*m+_[o]+t)/v|0)+(u/m|0)+h*l,_[o--]=c%v;_[o]=t}return t?++n:_.splice(0,1),k(e,_,n)},f.negated=function(){var e=new A(this);return e.s=-e.s||null,e},f.plus=function(e,r){var t,n=this,i=n.s;if(r=(e=new A(e,r)).s,!i||!r)return new A(NaN);if(i!=r)return e.s=-r,n.minus(e);var o=n.e/LOG_BASE,a=e.e/LOG_BASE,u=n.c,s=e.c;if(!o||!a){if(!u||!s)return new A(i/0);if(!u[0]||!s[0])return s[0]?e:new A(u[0]?n:0*i)}if(o=bitFloor(o),a=bitFloor(a),u=u.slice(),i=o-a){for(i>0?(a=o,t=s):(i=-i,t=u),t.reverse();i--;t.push(0));t.reverse()}for((i=u.length)-(r=s.length)<0&&(t=s,s=u,u=t,r=i),i=0;r;)i=(u[--r]=u[r]+s[r]+i)/BASE|0,u[r]=BASE===u[r]?0:u[r]%BASE;return i&&(u=[i].concat(u),++a),k(e,u,a)},f.precision=f.sd=function(e,r){var t,n,i,o=this;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==r?r=_:intCheck(r,0,8),B(new A(o),e,r);if(!(t=o.c))return null;if(n=(i=t.length-1)*LOG_BASE+1,i=t[i]){for(;i%10==0;i/=10,n--);for(i=t[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},f.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},f.squareRoot=f.sqrt=function(){var e,t,n,i,o,a=this,u=a.c,s=a.s,c=a.e,l=h+4,f=new A("0.5");if(1!==s||!u||!u[0])return new A(!s||s<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(s=Math.sqrt(+T(a)))||s==1/0?(((t=coeffToString(u)).length+c)%2==0&&(t+="0"),s=Math.sqrt(+t),c=bitFloor((c+1)/2)-(c<0||c%2),n=new A(t=s==1/0?"5e"+c:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new A(s+""),n.c[0])for((s=(c=n.e)+l)<3&&(s=0);;)if(o=n,n=f.times(o.plus(r(a,o,l,1))),coeffToString(o.c).slice(0,s)===(t=coeffToString(n.c)).slice(0,s)){if(n.e<c&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(B(n,n.e+h+2,1),e=!n.times(n).eq(a));break}if(!i&&(B(o,o.e+h+2,0),o.times(o).eq(a))){n=o;break}l+=4,s+=4,i=1}return B(n,n.e+h+1,_,e)},f.toExponential=function(e,r){return null!=e&&(intCheck(e,0,MAX),e++),N(this,e,r,1)},f.toFixed=function(e,r){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),N(this,e,r)},f.toFormat=function(e,r,t){var n,i=this;if(null==t)null!=e&&r&&"object"==_typeof(r)?(t=r,r=null):e&&"object"==_typeof(e)?(t=e,e=r=null):t=S;else if("object"!=_typeof(t))throw Error(bignumberError+"Argument not an object: "+t);if(n=i.toFixed(e,r),i.c){var o,a=n.split("."),u=+t.groupSize,s=+t.secondaryGroupSize,c=t.groupSeparator||"",l=a[0],f=a[1],p=i.s<0,h=p?l.slice(1):l,_=h.length;if(s&&(o=u,u=s,s=o,_-=o),u>0&&_>0){for(o=_%u||u,l=h.substr(0,o);o<_;o+=u)l+=c+h.substr(o,u);s>0&&(l+=c+h.slice(o)),p&&(l="-"+l)}n=f?l+(t.decimalSeparator||"")+((s=+t.fractionGroupSize)?f.replace(new RegExp("\\d{"+s+"}\\B","g"),"$&"+(t.fractionGroupSeparator||"")):f):l}return(t.prefix||"")+n+(t.suffix||"")},f.toFraction=function(e){var t,n,i,o,a,u,s,c,l,f,h,v,m=this,d=m.c;if(null!=e&&(!(s=new A(e)).isInteger()&&(s.c||1!==s.s)||s.lt(p)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+T(s));if(!d)return new A(m);for(t=new A(p),l=n=new A(p),i=c=new A(p),v=coeffToString(d),a=t.e=v.length-m.e-1,t.c[0]=POWS_TEN[(u=a%LOG_BASE)<0?LOG_BASE+u:u],e=!e||s.comparedTo(t)>0?a>0?t:l:s,u=g,g=1/0,s=new A(v),c.c[0]=0;f=r(s,t,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,l=c.plus(f.times(o=l)),c=o,t=s.minus(f.times(o=t)),s=o;return o=r(e.minus(n),i,0,1),c=c.plus(o.times(l)),n=n.plus(o.times(i)),c.s=l.s=m.s,h=r(l,i,a*=2,_).minus(m).abs().comparedTo(r(c,n,a,_).minus(m).abs())<1?[l,i]:[c,n],g=u,h},f.toNumber=function(){return+T(this)},f.toPrecision=function(e,r){return null!=e&&intCheck(e,1,MAX),N(this,e,r,2)},f.toString=function(e){var r,n=this,i=n.s,o=n.e;return null===o?i?(r="Infinity",i<0&&(r="-"+r)):r="NaN":(null==e?r=o<=v||o>=m?toExponential(coeffToString(n.c),o):toFixedPoint(coeffToString(n.c),o,"0"):10===e&&x?r=toFixedPoint(coeffToString((n=B(new A(n),h+o+1,_)).c),n.e,"0"):(intCheck(e,2,E.length,"Base"),r=t(toFixedPoint(coeffToString(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(r="-"+r)),r},f.valueOf=f.toJSON=function(){return T(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=e&&A.set(e),A}function bitFloor(e){var r=0|e;return e>0||e===r?r:r-1}function coeffToString(e){for(var r,t,n=1,i=e.length,o=e[0]+"";n<i;){for(r=e[n++]+"",t=LOG_BASE-r.length;t--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function compare(e,r){var t,n,i=e.c,o=r.c,a=e.s,u=r.s,s=e.e,c=r.e;if(!a||!u)return null;if(t=i&&!i[0],n=o&&!o[0],t||n)return t?n?0:-u:a;if(a!=u)return a;if(t=a<0,n=s==c,!i||!o)return n?0:!i^t?1:-1;if(!n)return s>c^t?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,a=0;a<u;a++)if(i[a]!=o[a])return i[a]>o[a]^t?1:-1;return s==c?0:s>c^t?1:-1}function intCheck(e,r,t,n){if(e<r||e>t||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<r||e>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function isOdd(e){var r=e.c.length-1;return bitFloor(e.e/LOG_BASE)==r&&e.c[r]%2!=0}function toExponential(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function toFixedPoint(e,r,t){var n,i;if(r<0){for(i=t+".";++r;i+=t);e=i+e}else if(++r>(n=e.length)){for(i=t,r-=n;--r;i+=t);e+=i}else r<n&&(e=e.slice(0,r)+"."+e.slice(r));return e}var BigNumber=clone();function format(e,r){var t="";if("undefined"===(t=BigNumber.isBigNumber(e)?e.toFixed():"string"==typeof e?e:e.toString())||"NaN"===t)return[void 0,{}];var n={mantissa:null,mantissa_type:null,thousands:!1,sign:!1,round:"~-",scientific:!1,fraction:!1,percent:!1,to_number:!1,to_number_string:!1};if(r.forEach((function(e){var r=e.type;if("symbol"===r){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);n.mantissa_type=e.value}else if("to-number"===r)n.to_number=!0;else if("to-number-string"===r)n.to_number_string=!0;else if("comma"===r)n.thousands=!0;else if("number"===r)n.mantissa=e.value;else if("var"===r)n.mantissa=e.real_value;else if("plus"===r)n.sign=!0;else if("round"===r)n.round=e.value;else if("fraction"===r)n.fraction=!0;else if("scientific"===r)n.scientific=!0;else{if("percent"!==r)throw new Error("错误的fmt Token");n.percent=!0}})),n.to_number)return[+parse_mantissa(t,n.mantissa_type,n.mantissa,n.round),n];if(n.scientific){var i=BigNumber(t).toExponential();return[n.sign&&!i.startsWith("-")?"+"+i:i,n]}if(n.fraction){var o=BigNumber(t).toFraction().map((function(e){return e.toFixed()})).join("/");return[n.sign&&!o.startsWith("-")?"+"+o:o,n]}return n.percent&&(t=BigNumber(t).times(100).toFixed()),null===n.mantissa?t.includes(".")&&(t=t.replace(/0*$/,"")):t=parse_mantissa(t,n.mantissa_type,n.mantissa,n.round),n.thousands&&(t=parse_thousands(t)),n.sign&&(n.to_number=!1,t.startsWith("-")||(t="+"+t)),n.percent&&(t+="%"),[t,n]}function close_important_push(){}function open_important_push(){}function open_debug(){}function close_debug(){}function calc_wrap(e,r){var t={_error:"-"};return["string","number"].includes(_typeof(e))?void 0===r?/[a-zA-Z$_]/.test(e.toString())?function(r){return Array.isArray(r)?r.unshift(t):r=_objectSpread2(_objectSpread2({},t),r),calc(e,r)}:calc(e):(Array.isArray(r)?r.unshift(t):r=_objectSpread2(_objectSpread2({},t),r),calc(e,r)):(Array.isArray(e)?e.unshift(t):e=_objectSpread2(_objectSpread2({},t),e),function(r){return calc(r,e)})}function check_version(){return _check_version.apply(this,arguments)}function _check_version(){return _check_version=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var res,code,versions,last_version,larr,varr,script,url;return _regeneratorRuntime().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:if("undefined"==typeof process||"node"!==process.release.name){_context.next=19;break}if(!(parseInt(process.versions.node)>=17)){_context.next=17;break}return _context.next=4,promise_queue([fetch("https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js"),fetch("https://unpkg.com/a-calc@latest/a-calc.versions.js")]);case 4:return res=_context.sent,_context.next=7,res.text();case 7:code=_context.sent,versions=eval(code),last_version=versions.at(-1),larr=last_version.match(/(\d+)\.(\d+)\.(\d+)/),larr.shift(),larr=larr.map((function(e){return parseInt(e)})),varr=version.match(/(\d+)\.(\d+)\.(\d+)/),varr.shift(),varr=varr.map((function(e){return parseInt(e)})),(larr[0]>varr[0]||larr[0]===varr[0]&&larr[1]>varr[1]||larr[0]===varr[0]&&larr[1]===varr[1]&&larr[2]>varr[2])&&console.warn("a-calc has a new version:",last_version);case 17:_context.next=25;break;case 19:return script=document.createElement("script"),script.onload=function(){var e=a_calc_versions;if(Array.isArray(e)){var r=e.at(-1),t=r.match(/(\d+)\.(\d+)\.(\d+)/);t.shift(),t=t.map((function(e){return parseInt(e)}));var n=version.match(/(\d+)\.(\d+)\.(\d+)/);n.shift(),n=n.map((function(e){return parseInt(e)})),(t[0]>n[0]||t[0]===n[0]&&t[1]>n[1]||t[0]===n[0]&&t[1]===n[1]&&t[2]>n[2])&&console.log("%c↑↑↑ a-calc has a new version: %s ↑↑↑","color: #67C23A;",r)}},_context.next=23,test_urls(["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"]);case 23:url=_context.sent,url?(script.src=url,document.body.appendChild(script)):script=null;case 25:case"end":return _context.stop()}}),_callee)}))),_check_version.apply(this,arguments)}var operator=new Set(["+","-","*","/","%","**","//"]);function push_token$2(e,r,t){if(Number.isNaN(Number(r)))if("-"===r||"+"===r)0===e.length||"operator"===e.at(-1).type||"("===e.at(-1).value?e.push({type:"number",value:r,real_value:r,has_unit:!1}):e.push({type:"operator",value:r});else if(operator.has(r))e.push({type:"operator",value:r});else if(t._unit&&/^[+-]?\d/.test(r)){var n,i=split_unit_num(r),o=i.num,a=i.unit;if(void 0===a)e.push({type:"number",value:o,real_value:o,has_unit:!1});else t.has_unit=!0,null!==(n=t.unit_str)&&void 0!==n||(t.unit_str=a),e.push({type:"number",value:o,real_value:o,has_unit:!0,unit:a})}else if(var_first_char.includes(r[0])){t.has_var=!0;var u=get_real_value(t.fill_data,r);if(t._unit){var s,c=split_unit_num(u),l=c.num,f=c.unit;if(void 0===f)e.push({type:"var",value:r,real_value:l,has_unit:!1});else t.has_unit=!0,null!==(s=t.unit_str)&&void 0!==s||(t.unit_str=f),e.push({type:"var",value:r,real_value:l,has_unit:!0,unit:f})}else e.push({type:"var",value:r,real_value:u,has_unit:!1})}else{if(!/^[+-]?\d/.test(r))throw new Error("无法识别的标识符:".concat(r));var p=r.indexOf("e");-1!==p&&/^\d+$/.test(r.slice(p+1))&&e.push({type:"number",value:r,real_value:r,has_unit:!1})}else e.push({type:"number",value:r,real_value:r,has_unit:!1})}function tokenizer_space(e,r,t){for(var n,i=0,o=0,a=e.length,u=[],s={has_var:!1,has_unit:!1,unit_str:void 0,_unit:t,fill_data:r};o<a;)" "===(n=e[o])?(o>i&&push_token$2(u,e.slice(i,o),s),i=o+1):"("===n?(u.push({type:state_bracket,value:"("}),i=o+1):")"===n&&(o>i&&push_token$2(u,e.slice(i,o),s),u.push({type:state_bracket,value:")"}),i=o+1),o++;return o>i&&push_token$2(u,e.slice(i,o),s),u.has_var=s.has_var,u.has_unit=s.has_unit,u.unit=s.unit_str,u}function compute(e,r,t){if(void 0===e||void 0===r)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(r));switch(t){case"+":return new BigNumber(e).plus(r);case"-":return new BigNumber(e).minus(r);case"*":return new BigNumber(e).times(r);case"/":return new BigNumber(e).div(r);case"%":return new BigNumber(e).mod(r);case"**":return new BigNumber(e).pow(r);case"//":return new BigNumber(e).idiv(r)}}var operator_map$1={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens(e){if(1===e.length){var r=e[0];if("number"===r.type||"var"===r.type)return r.real_value;throw new Error("错误的表达式:".concat(r.value))}for(var t,n,i=[],o=[],a=0,u=e.length;a<u;a++)if("number"!==(t=e[a]).type&&"var"!==t.type)if("operator"!==t.type)if("("!==t.value){if(")"===t.value)for(var s=void 0;s=i.pop();){if("("===s){var c=o.at(-2);if("-"===c){var l=o.pop();o.pop(),o.push(BigNumber.isBigNumber(l)?l.negated():new BigNumber(l).negated())}else if("+"===c){var f=o.pop();o.pop(),o.push(f)}break}var p=o.pop(),h=o.pop();o.push(compute(h,p,s))}}else i.push("(");else{var _=i.at(-1);if("("===_){i.push(t.value);continue}var v=operator_map$1[t.value];if(!i.length){i.push(t.value);continue}if(v<operator_map$1[_])for(var m=void 0;m=i.pop();){if("("===m){i.push("(");break}var d=o.pop(),g=o.pop();o.push(compute(g,d,m))}else if(v===operator_map$1[_]){if("**"===t.value){i.push(t.value);continue}for(var b=void 0;b=i.pop();){if("("===b){i.push("(");break}if(operator_map$1[b]<v){i.push(b);break}var y=o.pop(),w=o.pop();o.push(compute(w,y,b))}}i.push(t.value)}else o.push(t.real_value);for(;n=i.pop();){var S=o.pop(),E=o.pop();o.push(compute(E,S,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return e.has_var||(e.calc_result=o[0]),o[0]}function push_token$1(e,r,t,n,i){r===state_var?(i.has_var=!0,e.push({type:r,value:t,real_value:get_real_value(i.fill_data,t)})):e.push({type:r,value:t}),n.prev=n.curr,i.state=state_initial}function fmt_tokenizer(e,r){for(var t,n={prev:0,curr:0},i=e.length,o={state:state_initial,fill_data:r,has_var:!1},a=[];n.curr<i;)switch(t=e[n.curr],o.state){case state_initial:if(" "===t)n.curr++,n.prev=n.curr;else if("<>=".includes(t))o.state=state_symbol,n.curr++;else if(","===t)n.curr++,push_token$1(a,state_comma,",",n,o);else if(var_char.includes(t))o.state=state_var,n.curr++;else if(number_char.includes(t))o.state=state_number,n.curr++;else if("+"===t)n.curr++,push_token$1(a,state_plus$1,"+",n,o);else if("~"===t)n.curr++,o.state=state_round;else if("%"===t)n.curr++,push_token$1(a,state_percent,"%",n,o);else if("/"===t)n.curr++,push_token$1(a,state_fraction,"/",n,o);else if("!"===t)if(o.state=state_initial,n.curr++,"n"===e[n.curr])n.curr++,push_token$1(a,state_to_number,"!n",n,o);else if("u"===e[n.curr])n.curr++,push_token$1(a,state_to_number_string,"!u",n,o);else{if("e"!==e[n.curr])throw new Error("无法识别的!模式字符:".concat(e[n.curr]));n.curr++,push_token$1(a,state_scientific,"!e",n,o)}else n.curr++,n.prev=n.curr;break;case state_symbol:"="===t&&n.curr++,push_token$1(a,state_symbol,e.slice(n.prev,n.curr),n,o);break;case state_number:number_char.includes(t)?n.curr++:push_token$1(a,state_number,e.slice(n.prev,n.curr),n,o);break;case state_var:var_members_char.includes(t)?n.curr++:push_token$1(a,state_var,e.slice(n.prev,n.curr),n,o);break;case state_round:if(!("56+-".includes(t)&&n.curr-n.prev<2))throw new Error("错误的舍入语法:".concat(e.slice(n.prev,n.curr+1)));n.curr++,push_token$1(a,state_round,e.slice(n.prev,n.curr),n,o);break;default:throw new Error("错误的fmt分词器状态")}return n.prev<n.curr&&push_token$1(a,o.state,e.slice(n.prev,n.curr),n,o),a.has_var=o.has_var,a}var symbol_set=new Set(["<",">","=",">=","<="]),rand_set=new Set(["~+","~-","~5","~6"]);function push_token(e,r,t){if(","===r)e.push({type:state_comma,value:","});else if(symbol_set.has(r))e.push({type:state_symbol,value:r});else if(Number.isNaN(Number(r)))if(var_first_char.includes(r[0]))t.has_var=!0,e.push({type:state_var,value:r,real_value:get_real_value(t.fill_data,r)});else if("%"===r)e.push({type:state_percent,value:r});else if("/"===r)e.push({type:state_fraction,value:r});else if("+"===r)e.push({type:state_plus,value:r});else if(rand_set.has(r))e.push({type:state_round,value:r});else if("!n"===r)e.push({type:state_to_number,value:r});else if("!u"===r)e.push({type:state_to_number_string,value:r});else{if("!e"!==r)throw new Error("无法识别的格式化字符: ".concat(r));e.push({type:state_scientific,value:r})}else e.push({type:state_number,value:r})}function fmt_tokenizer_space(e,r){for(var t,n=0,i=e.length,o={fill_data:r,has_var:!1},a=0,u=[];n<i;)" "===(t=e[n])?(n>a&&push_token(u,e.slice(a,n),o),a=n+1):"<>=".includes(t)&&("="===e[n+1]?(u.push({type:state_symbol,value:t+"="}),a=1+ ++n):(u.push({type:state_symbol,value:t}),a=n+1)),n++;return a<n&&push_token(u,e.slice(a,n),o),u.has_var=o.has_var,u}function compute_lite(e,r,t){switch(t){case"+":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).plus(r);case"-":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).minus(r);case"*":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).times(r);case"/":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).div(r);case"%":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).mod(r);case"**":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).pow(r);case"//":return(BigNumber.isBigNumber(e)?e:new BigNumber(e)).idiv(r)}}var operator_map={"+":0,"-":0,"*":1,"/":1,"%":1,"//":1,"**":2};function eval_tokens_lite(e,r){for(var t,n,i=[],o=[],a=0,u=e.length;a<u;a++){var s=(t=e[a])[0];if(var_first_char.includes(s))o.push(get_real_value(r,t));else if(operator_set.has(t)){var c=i.at(-1);if("("===c){i.push(t);continue}var l=operator_map[t];if(!i.length){i.push(t);continue}var f=operator_map[c];if(l<f)for(var p=i.at(-1);p&&"("!==p;){i.pop();var h=o.pop(),_=o.pop();o.push(compute_lite(_,h,p)),p=i.at(-1)}else if(l===f){if("**"===t){i.push(t);continue}for(var v=i.at(-1);v&&!(operator_map[v]<l||"("===v);){i.pop();var m=o.pop(),d=o.pop();o.push(compute_lite(d,m,v)),v=i.at(-1)}}i.push(t)}else if(number_first_char.includes(s))o.push(t);else if("("!==t){if(")"===t)for(var g=void 0;(g=i.pop())&&"("!==g;){var b=o.pop(),y=o.pop();o.push(compute_lite(y,b,g))}}else i.push("(")}for(;n=i.pop();){var w=o.pop(),S=o.pop();o.push(compute_lite(S,w,n))}if(1!==o.length)throw new Error("可能出现了错误的计算式");return o[0]}function calc_lite(e,r,t){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"-";try{var i;if("number"==typeof e)i=e.toString();else{if(""===e)throw new Error("非法的空计算式");var o=e.split(" ");if(1===o.length){if(i=o[0],var_first_char.includes(i[0])&&(i=get_real_value(t,i)),isNaN(Number(i)))throw new Error("错误的计算式:".concat(e))}else i=eval_tokens_lite(o,t).toFixed()}if("string"==typeof r&&""!==r){var a=fmt_tokenizer(r,t);if(void 0!==a)i=_slicedToArray(format(i,a),1)[0]}if("NaN"===i||"Infinity"===i)throw new Error("计算环节出错");return i}catch(e){return n}}function calc_mini(e,r,t){switch(r){case"+":return BigNumber(e).plus(t).toFixed();case"-":return BigNumber(e).minus(t).toFixed();case"*":return BigNumber(e).times(t).toFixed();case"/":return BigNumber(e).div(t).toFixed();case"%":return BigNumber(e).mod(t).toFixed();case"**":return BigNumber(e).pow(t).toFixed();case"//":return BigNumber(e).idiv(t).toFixed()}}function calc(e,r){var t=find_value(r,"_error");try{var n,i,o,a,u,s=parse_args(e,r),c=s._unit,l=s._mode,f="space"===l||"space-all"===l?tokenizer_space(s.expr,s.fill_data,c):tokenizer(s.expr,s.fill_data,c),p=eval_tokens(f),h=BigNumber.isBigNumber(p)?p:new BigNumber(p);if("space-all"===l?(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer_space(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer_space(s._fmt,s.fill_data)):(a=""===s.fmt_expr||void 0===s.fmt_expr?void 0:fmt_tokenizer(s.fmt_expr,s.fill_data),u=""===s._fmt||void 0===s._fmt?void 0:fmt_tokenizer(s._fmt,s.fill_data)),void 0===a?void 0!==u&&(a=u):void 0!==u&&(a=[].concat(_toConsumableArray(u),_toConsumableArray(a))),void 0===a)h=h.toFixed();else{var _=_slicedToArray(format(h,a),2);h=_[0],o=_[1]}if("Infinity"===h||"NaN"===h||void 0===h)throw new Error("计算错误可能是非法的计算式");return!f.has_unit||null!==(n=o)&&void 0!==n&&n.to_number||null!==(i=o)&&void 0!==i&&i.to_number_string||(h+=f.unit),h}catch(e){if(void 0===t)throw e;return t}}function check_update(){check_version().catch((function(){}))}function print_version(){console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")}var calc_util={check_update:check_update,print_version:print_version,open_debug:open_debug,close_debug:close_debug,close_important_push:close_important_push,open_important_push:open_important_push},fmt=calc;function plus(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).plus(r).toNumber():new BigNumber(e).plus(r).toFixed()}function sub(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).minus(r).toNumber():new BigNumber(e).minus(r).toFixed()}function mul(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).times(r).toNumber():new BigNumber(e).times(r).toFixed()}function div(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).div(r).toNumber():new BigNumber(e).div(r).toFixed()}function mod(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).mod(r).toNumber():new BigNumber(e).mod(r).toFixed()}function pow(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).pow(r).toNumber():new BigNumber(e).pow(r).toFixed()}function idiv(e,r){return"number"===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"number")?new BigNumber(e).idiv(r).toNumber():new BigNumber(e).idiv(r).toFixed()}export{calc,calc_lite,calc_mini,calc_util,calc_wrap,div,fmt,idiv,mod,mul,parse_thousands,plus,pow,sub,version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "a-calc",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.12",
|
|
4
4
|
"description": "A very powerful and easy-to-use number precision calculation and formatting library.",
|
|
5
5
|
"main": "./es/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -89,15 +89,18 @@
|
|
|
89
89
|
"benchmark": "^2.1.4",
|
|
90
90
|
"bignumber.js": "^9.1.1",
|
|
91
91
|
"cross-env": "^7.0.3",
|
|
92
|
+
"decimal-eval": "^0.1.1",
|
|
92
93
|
"fast-deep-equal": "^3.1.3",
|
|
93
94
|
"glob": "^8.1.0",
|
|
94
95
|
"json-stringify-safe": "^5.0.1",
|
|
96
|
+
"lodash-es": "^4.17.21",
|
|
97
|
+
"math-expression-evaluator": "2.0.4",
|
|
98
|
+
"mathjs": "13.0.2",
|
|
95
99
|
"npm-run-all": "^4.1.5",
|
|
96
100
|
"rollup": "^4.6.0",
|
|
97
101
|
"rollup-plugin-livereload": "^2.0.5",
|
|
98
102
|
"rollup-plugin-serve": "^1.1.0",
|
|
99
|
-
"typescript": "^5.1.6"
|
|
100
|
-
"lodash-es": "^4.17.21"
|
|
103
|
+
"typescript": "^5.1.6"
|
|
101
104
|
},
|
|
102
105
|
"dependencies": {
|
|
103
106
|
"typescript-treasure": "0.0.9"
|