a-calc 1.0.29 → 1.1.0
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 +19 -5
- package/browser/index.js +1 -1
- package/cjs/index.cjs +1 -1
- package/es/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ calc("-2e2 + 3e+2") // 100
|
|
|
59
59
|
|
|
60
60
|
## 关于空格
|
|
61
61
|
|
|
62
|
-
空格在无歧义的情况下是非必须的,甚至可以正确解析下面人眼都难以解析的写法`calc("-2e+2+3e+2")
|
|
62
|
+
空格在无歧义的情况下是非必须的,甚至可以正确解析下面人眼都难以解析的写法`calc("-2e+2+3e+2")`,但是这样清晰度太低了,请尽其所能写更清晰的代码而不是shit!<span style="color: red;">始终在你的计算式包含空格,这样更漂亮和清晰,就像我写的示例那样!!!</span>
|
|
63
63
|
|
|
64
64
|
顺便举个有歧义的计算式 `calc("50%%2", {_unit: true})`这种歧义显然是在带单位计算的时候出现,由于解析器不知道你的单位是`%` 还是 `%%` 所以你要用空格给出明确的意思,正确的写法应该是 `calc("50% % 2", {_unit: true})`
|
|
65
65
|
|
|
@@ -108,6 +108,16 @@ calc("1.123$$$ + 2.88% | + =6", {_unit: true}) // +4.003000$$$
|
|
|
108
108
|
|
|
109
109
|
格式化支持如下功能:限制小数位数,保留正负号,百分比输出,科学计数法输出,千分位输出,并且他们是可以组合的,不过有个别的情况组合是不生效的,这个自己去试一下,组合情况太多,不在一一列举。
|
|
110
110
|
|
|
111
|
+
**格式化列表:**
|
|
112
|
+
|
|
113
|
+
- `>|>=|<|<=|=数字` 表示限制小数位数,例: `<=2` 小数位数小于等于2 `>3` 小数位数必须大于3,这个等价于`>=4`
|
|
114
|
+
- `,` 输出为千分位数字字符串
|
|
115
|
+
- `/` 输出为分数
|
|
116
|
+
- `+` 输出的正数带`+` 号
|
|
117
|
+
- `%` 输出百分比数字,可以和限制小数组合使用
|
|
118
|
+
- `-e` 输出为科学计数法,e可以大写
|
|
119
|
+
- `-n` 输出为数字而不是数字字符串,n可以大写,但是如果你设置了千分位、分数或百分比格式化等这个选项不生效
|
|
120
|
+
|
|
111
121
|
```js
|
|
112
122
|
// 操作小数位数
|
|
113
123
|
calc("0.1 + 0.2 | =2") // 0.30
|
|
@@ -116,8 +126,6 @@ calc("0.11 + 0.11 | <=4") // 0.22
|
|
|
116
126
|
calc("0.1 + 0.2 | >= 5") // 0.30000
|
|
117
127
|
calc("0.0000001+ 0.0000001 | >= 5") // 0.0000002
|
|
118
128
|
|
|
119
|
-
// 格式化的时候对于小数位的操作只支持 >= <= = 三种符号
|
|
120
|
-
|
|
121
129
|
// 保留正负号
|
|
122
130
|
calc("1 + 1 | +") // +2
|
|
123
131
|
|
|
@@ -130,8 +138,8 @@ calc("0.025 + 0.2 | /") // 9/40
|
|
|
130
138
|
// 百分比
|
|
131
139
|
calc("1 + 1 | %") // 200%
|
|
132
140
|
|
|
133
|
-
// 科学计数法,
|
|
134
|
-
calc("1 + 1 |
|
|
141
|
+
// 科学计数法, 注意这个 e也可以大写
|
|
142
|
+
calc("1 + 1 | -e") // 2e+0
|
|
135
143
|
|
|
136
144
|
// 同时指定小数位和千分位且保留正负号
|
|
137
145
|
calc("10000000 + 100000000 | +,=10") // +110,000,000.0000000000
|
|
@@ -304,6 +312,12 @@ calc("a + b", {a,b}) // 推荐写法,因为更清晰
|
|
|
304
312
|
|
|
305
313
|
## 版本变更
|
|
306
314
|
|
|
315
|
+
* 1.1.0
|
|
316
|
+
- 很小的破环性更新,以前的 `\e` 科学计数法输出,现在是 `-e`,其他没变
|
|
317
|
+
- 增加了 `-n` 输出数字类型
|
|
318
|
+
- 对于小数位的限制支持了 `<` 和 `>` 符号
|
|
319
|
+
- 修复了若干舍入格式化问题
|
|
320
|
+
- 单元测试增加到107个
|
|
307
321
|
* 1.0.25
|
|
308
322
|
- 文档更新,简化 a-calc 集成到vue3的写法
|
|
309
323
|
* 1.0.23
|
package/browser/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a_calc=function(e){"use strict";function R(e){return(R="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})(e)}function x(e){return function(e){if(Array.isArray(e))return N(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){var r;if(e)return"string"==typeof e?N(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(e,t):void 0}(e)||function(){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 N(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}var A="1.0.29",j=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,S=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function k(e){return-1<"+-*/%()**".indexOf(e)}function P(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function f(e){return void 0!==e}function p(e){return null!==e}function T(e){return"string"==typeof e&&!!j.test(e)}var o={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",scientific:"scientific"},B="<>=";function F(e){for(var t=o.initial,r=[],n=[];e;){var i=e[0];if(t===o.initial)if(B.includes(i))t=o.symbol,r.push(i),e=e.slice(1);else if("~"===i)t=o.round,r.push(i),e=e.slice(1);else if("\\"===i&&/[Ee]/.test(e[1]))t=o.initial,n.push({type:"scientific",value:e[1]}),e=e.slice(2);else{if("/"===i)t=o.initial,n.push({type:"fraction",value:i});else if(/[a-zA-Z_]/.test(i))t=o.variable,r.push(i);else if(/\d/.test(i))t=o.number,r.push(i);else if("+"===i)t=o.initial,n.push({type:"plus",value:i});else if(","===i)t=o.initial,n.push({type:"comma",value:i});else if("%"===i)t=o.initial,n.push({type:"percent",value:i});else if(!/\s/.test(i))throw new Error("不识别的fmt字符:".concat(i));e=e.slice(1)}else if(t===o.number)/\d/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=o.initial);else if(t===o.variable)/[\$\w_\-.\[\]"']/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=o.initial);else if(t===o.symbol)/\s/.test(i)?e=e.slice(1):B.includes(i)?(r.push(i),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=o.initial);else{if(t!==o.round)throw new Error("错误的自动机状态");if(/\s/.test(i))e=e.slice(1);else{if(!("56+-".includes(i)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(i));r.push(i),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=o.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=o.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=Array.isArray,t="object"==R(t)&&t&&t.Object===Object&&t,n=t,i="object"==("undefined"==typeof self?"undefined":R(self))&&self&&self.Object===Object&&self,n=n||i||Function("return this")(),i=n.Symbol,s=Object.prototype,$=s.hasOwnProperty,D=s.toString,u=i?i.toStringTag:void 0;var I=Object.prototype.toString;var X=function(e){var t=$.call(e,u),r=e[u];try{var n=!(e[u]=void 0)}catch(e){}var i=D.call(e);return n&&(t?e[u]=r:delete e[u]),i},Y=function(e){return I.call(e)},J=i?i.toStringTag:void 0;function K(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(J&&J in Object(e)?X:Y)(e)}function Q(e){return null!=e&&"object"==R(e)}var ee=K,te=Q;function re(e){return"symbol"==R(e)||te(e)&&"[object Symbol]"==ee(e)}var ne=r,ie=re,oe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,se=/^\w*$/;function ue(e,t){var r;return!ne(e)&&(!("number"!=(r=R(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ie(e))||se.test(e)||!oe.test(e)||null!=t&&e in Object(t))}function le(e){var t=R(e);return null!=e&&("object"==t||"function"==t)}var ce=K,ae=le;function fe(e){return!!ae(e)&&("[object Function]"==(e=ce(e))||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)}var s=n["__core-js_shared__"],pe=(s=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"";var he=Function.prototype.toString;function ve(e){if(null!=e){try{return he.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var ge=fe,de=function(e){return!!pe&&pe in e},ye=le,me=ve,we=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,s=s.toString,l=l.hasOwnProperty,be=RegExp("^"+s.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var _e=function(e){return!(!ye(e)||de(e))&&(ge(e)?be:we).test(me(e))},Ee=function(e,t){return null==e?void 0:e[t]};function c(e,t){return e=Ee(e,t),_e(e)?e:void 0}var s=c(Object,"create"),Oe=s;var xe=s,Ne=Object.prototype.hasOwnProperty;var Ae=s,je=Object.prototype.hasOwnProperty;var Se=s;function ke(e){return e=this.has(e)&&delete this.__data__[e],this.size-=e?1:0,e}function Pe(e){var t,r=this.__data__;return xe?"__lodash_hash_undefined__"===(t=r[e])?void 0:t:Ne.call(r,e)?r[e]:void 0}function Te(e){var t=this.__data__;return Ae?void 0!==t[e]:je.call(t,e)}function Be(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Se&&void 0===t?"__lodash_hash_undefined__":t,this}function a(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])}}a.prototype.clear=function(){this.__data__=Oe?Oe(null):{},this.size=0},a.prototype.delete=ke,a.prototype.get=Pe,a.prototype.has=Te,a.prototype.set=Be;l=a;var Fe=function(e,t){return e===t||e!=e&&t!=t};function $e(e,t){for(var r=e.length;r--;)if(Fe(e[r][0],t))return r;return-1}var De=$e,Ie=Array.prototype.splice;var Re=$e;var Ce=$e;var Ue=$e;function ze(e){var t=this.__data__;return!((e=De(t,e))<0||(e==t.length-1?t.pop():Ie.call(t,e,1),--this.size,0))}function Me(e){var t=this.__data__;return(e=Re(t,e))<0?void 0:t[e][1]}function Le(e){return-1<Ce(this.__data__,e)}function Ge(e,t){var r=this.__data__,n=Ue(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function h(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])}}h.prototype.clear=function(){this.__data__=[],this.size=0},h.prototype.delete=ze,h.prototype.get=Me,h.prototype.has=Le,h.prototype.set=Ge;var s=h,v=c(n,"Map"),qe=l,Ve=s,We=v;var He=function(e){var t=R(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};function Ze(e,t){return e=e.__data__,He(t)?e["string"==typeof t?"string":"hash"]:e.map}var Xe=Ze;var Ye=Ze;var Je=Ze;var Ke=Ze;function Qe(e){return e=Xe(this,e).delete(e),this.size-=e?1:0,e}function et(e){return Ye(this,e).get(e)}function tt(e){return Je(this,e).has(e)}function rt(e,t){var r=Ke(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function g(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])}}g.prototype.clear=function(){this.size=0,this.__data__={hash:new qe,map:new(We||Ve),string:new qe}},g.prototype.delete=Qe,g.prototype.get=et,g.prototype.has=tt,g.prototype.set=rt;var nt=g;function it(n,i){if("function"!=typeof n||null!=i&&"function"!=typeof i)throw new TypeError("Expected a function");function o(){var e=arguments,t=i?i.apply(this,e):e[0],r=o.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),o.cache=r.set(t,e)||r,e)}return o.cache=new(it.Cache||nt),o}it.Cache=nt;var ot=it;var st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ut=/\\(\\)?/g,l=function(e){var t=(e=ot(e,function(e){return 500===t.size&&t.clear(),e})).cache;return e}(function(e){var i=[];return 46===e.charCodeAt(0)&&i.push(""),e.replace(st,function(e,t,r,n){i.push(r?n.replace(ut,"$1"):t||e)}),i});var lt=function(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},ct=r,at=re,s=i?i.prototype:void 0,ft=s?s.toString:void 0;var pt=function e(t){var r;return"string"==typeof t?t:ct(t)?lt(t,e)+"":at(t)?ft?ft.call(t):"":"0"==(r=t+"")&&1/t==-1/0?"-0":r};var ht=r,vt=ue,gt=l,dt=function(e){return null==e?"":pt(e)};var yt=re;var mt=function(e,t){return ht(e)?e:vt(e,t)?[e]:gt(dt(e))},wt=function(e){var t;return"string"==typeof e||yt(e)?e:"0"==(t=e+"")&&1/e==-1/0?"-0":t};var bt=function(e,t){for(var r=0,n=(t=mt(t,e)).length;null!=e&&r<n;)e=e[wt(t[r++])];return r&&r==n?e:void 0};var d=function(e,t,r){return void 0===(e=null==e?void 0:bt(e,t))?r:e};var y={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},_t="+-",Et="*/%",Ot="()";function xt(e,t){for(var r,n,i,o=1<arguments.length&&void 0!==t&&t,s=y.initial,u=[],l=[],c=function(){u.push(r),e=e.slice(1)},a=function(e){l.push({type:e,value:u.join("")}),u.length=0},f=function(){e=e.slice(1)};e;)switch(r=e[0],s){case y.initial:if(_t.includes(r)){var p=l.at(-1),s=0===l.length||"operator"===p.type||"("===p?y.number:y.operator;c()}else if(Et.includes(r))s=y.operator,c();else if(/\d/.test(r))s=y.number,c();else if(Ot.includes(r))s=y.bracket;else if(/[a-zA-Z_$]/.test(r))s=y.var,c();else{if(!/\s/.test(r))throw new Error("不识别的字符".concat(r));f()}break;case y.bracket:l.push({type:y.bracket,value:r}),f(),s=y.initial;break;case y.operator:p=u.at(-1);"*"===r&&"*"===p&&c(),a(y.operator),s=y.initial;break;case y.number:if(/\d/.test(r))c();else if("."===r){if(0===u.length||u.includes("."))throw new Error("非法的小数部分".concat(u.join("")));c()}else"Ee".includes(r)?(s=y.scientific,c()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(r)||"space"===o&&/\S/.test(r)?c():(a(y.number),s=y.initial);break;case y.scientific:/\d/.test(r)?c():_t.includes(r)?(n=u.slice(1),i=u.at(-1),n.includes(r)||!/[Ee]/.test(i)?(a(y.scientific),s=y.initial):c()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(r)||"space"===o&&/\S/.test(r)?c():(a(y.scientific),s=y.initial);break;case y.var:/[\w_.\[\]"']/.test(r)?c():(a(y.var),s=y.initial);break;default:throw new Error("状态错误")}return 0!==u.length&&(l.push({type:s,value:u.join("")}),u.length=0,s=y.initial),l}function Nt(e,t,r){if(null===t)throw new Error("错误的填充数据:",t);for(var n=[],i=0;i<e.length;i++){var o=e[i];if("var"!==o.type)n.push(o);else{if("undefined"===o.value||"NaN"===o.value)throw new Error("key不应该为:".concat(o.value));for(var s=null,u=0;u<t.length;u++){var l=t[u],l=d(l,o.value);if(void 0!==l){s=l;break}}if(null===s)throw new Error("token填充失败,请确认".concat(o,"存在"));if("string"==typeof s){if(""===s.trim())throw new Error("token填充失败,".concat(o.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!S.test(s))throw new Error("token填充失败,".concat(o.value,"值:").concat(s,"为非法单位数字"))}else if(!T(s))throw new Error("token填充失败,".concat(o,"值:").concat(s,"为非法数字"))}s="string"!=typeof s?s.toString():s,n.push({type:"number",value:s})}}return n}function At(e){for(var t,r=[],n=[],i=e.map(function(e){return e.value});0<i.length;){var o=i.shift();if(k(o))if("("===o)r.push(o);else if(")"===o){for(var s=r.pop();"("!==s&&0<r.length;)n.push(s),s=r.pop();if("("!==s)throw"error: unmatched ()"}else{for(;t=r[r.length-1],P(o)<=P(t)&&0<r.length;)n.push(r.pop());r.push(o)}else n.push(o)}if(0<r.length){if(")"===r[r.length-1]||"("===r[r.length-1])throw"error: unmatched ()";for(;0<r.length;)n.push(r.pop())}return n}var jt=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,St=Math.ceil,C=Math.floor,U="[BigNumber Error] ",kt=U+"Number primitive has more than 15 significant digits: ",z=1e14,M=14,Pt=9007199254740991,Tt=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],L=1e7,G=1e9;function q(e){var t=0|e;return 0<e||e===t?t:t-1}function V(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=M-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function W(e,t){var r,n,i=e.c,o=t.c,s=e.s,u=t.s,e=e.e,t=t.e;if(!s||!u)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-u:s;if(s!=u)return s;if(r=s<0,n=e==t,!i||!o)return n?0:!i^r?1:-1;if(!n)return t<e^r?1:-1;for(u=(e=i.length)<(t=o.length)?e:t,s=0;s<u;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return e==t?0:t<e^r?1:-1}function H(e,t,r,n){if(e<t||r<e||e!==C(e))throw Error(U+(n||"Argument")+("number"==typeof e?e<t||r<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Bt(e){var t=e.c.length-1;return q(e.e/M)==t&&e.c[t]%2!=0}function Ft(e,t){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Z(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 b=function I(e){var d,f,p,t,c,y,s,u,l,a,h,r=S.prototype={constructor:S,toString:null,valueOf:null},v=new S(1),m=20,w=4,g=-7,b=21,_=-1e7,E=1e7,O=!1,i=1,x=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},A="0123456789abcdefghijklmnopqrstuvwxyz",j=!0;function S(e,t){var r,n,i,o,s,u,l,c,a=this;if(!(a instanceof S))return new S(e,t);if(null==t){if(e&&!0===e._isBigNumber)return a.s=e.s,void(!e.c||e.e>E?a.c=a.e=null:e.e<_?a.c=[a.e=0]:(a.e=e.e,a.c=e.c.slice()));if((u="number"==typeof e)&&0*e==0){if(a.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,s=e;10<=s;s/=10,o++);return void(E<o?a.c=a.e=null:(a.e=o,a.c=[e]))}c=String(e)}else{if(!jt.test(c=String(e)))return p(a,c,u);a.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(s=(c=-1<(o=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(o<0&&(o=s),o+=+c.slice(s+1),c=c.substring(0,s)):o<0&&(o=c.length)}else{if(H(t,2,A.length,"Base"),10==t&&j)return $(a=new S(e),m+a.e+1,w);if(c=String(e),u="number"==typeof e){if(0*e!=0)return p(a,c,u,t);if(a.s=1/e<0?(c=c.slice(1),-1):1,S.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(kt+e)}else a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=A.slice(0,t),o=s=0,l=c.length;s<l;s++)if(r.indexOf(n=c.charAt(s))<0){if("."==n){if(o<s){o=l;continue}}else if(!i&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){i=!0,s=-1,o=0;continue}return p(a,String(e),u,t)}u=!1,-1<(o=(c=f(c,t,10,a.s)).indexOf("."))?c=c.replace(".",""):o=c.length}for(s=0;48===c.charCodeAt(s);s++);for(l=c.length;48===c.charCodeAt(--l););if(c=c.slice(s,++l)){if(l-=s,u&&S.DEBUG&&15<l&&(Pt<e||e!==C(e)))throw Error(kt+a.s*e);if((o=o-s-1)>E)a.c=a.e=null;else if(o<_)a.c=[a.e=0];else{if(a.e=o,a.c=[],s=(o+1)%M,o<0&&(s+=M),s<l){for(s&&a.c.push(+c.slice(0,s)),l-=M;s<l;)a.c.push(+c.slice(s,s+=M));s=M-(c=c.slice(s)).length}else s-=l;for(;s--;c+="0");a.c.push(+c)}}else a.c=[a.e=0]}function k(e,t,r,n){for(var i,o,s=[0],u=0,l=e.length;u<l;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(u++)),i=0;i<s.length;i++)r-1<s[i]&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}function P(e,t,r){var n,i,o,s=0,u=e.length,l=t%L,c=t/L|0;for(e=e.slice();u--;)s=((i=l*(o=e[u]%L)+(n=c*o+(o=e[u]/L|0)*l)%L*L+s)/r|0)+(n/L|0)+c*o,e[u]=i%r;return e=s?[s].concat(e):e}function T(e,t,r,n){var i,o;if(r!=n)o=n<r?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 B(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]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var i,o,s,u;if(null==r?r=w:H(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)u=V(e.c),u=1==n||2==n&&(o<=g||b<=o)?Ft(u,o):Z(u,o,"0");else if(r=(e=$(new S(e),t,r)).e,s=(u=V(e.c)).length,1==n||2==n&&(t<=r||r<=g)){for(;s<t;u+="0",s++);u=Ft(u,r)}else if(t-=o,u=Z(u,r,"0"),s<r+1){if(0<--t)for(u+=".";t--;u+="0");}else if(0<(t+=r-s))for(r+1==s&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function o(e,t){for(var r,n=1,i=new S(e[0]);n<e.length;n++){if(!(r=new S(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function F(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];10<=i;i/=10,n++);return(r=n+r*M-1)>E?e.c=e.e=null:r<_?e.c=[e.e=0]:(e.e=r,e.c=t),e}function $(e,t,r,n){var i,o,s,u,l,c,a,f=e.c,p=Tt;if(f){e:{for(i=1,u=f[0];10<=u;u/=10,i++);if((o=t-i)<0)o+=M,s=t,a=(l=f[c=0])/p[i-s-1]%10|0;else if((c=St((o+1)/M))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=a=0,s=(o%=M)-M+(i=1)}else{for(l=u=f[c],i=1;10<=u;u/=10,i++);a=(s=(o%=M)-M+i)<0?0:l/p[i-s-1]%10|0}if(n=n||t<0||null!=f[c+1]||(s<0?l:l%p[i-s-1]),n=r<4?(a||n)&&(0==r||r==(e.s<0?3:2)):5<a||5==a&&(4==r||n||6==r&&(0<o?0<s?l/p[i-s]: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[(M-t%M)%M],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[M-o],f[c]=0<s?C(l/p[i-s]%p[s])*u:0),n)for(;;){if(0==c){for(o=1,s=f[0];10<=s;s/=10,o++);for(s=f[0]+=u,u=1;10<=s;s/=10,u++);o!=u&&(e.e++,f[0]==z)&&(f[0]=1);break}if(f[c]+=u,f[c]!=z)break;f[c--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>E?e.c=e.e=null:e.e<_&&(e.c=[e.e=0])}return e}function D(e){var t,r=e.e;return null===r?e.toString():(t=V(e.c),t=r<=g||b<=r?Ft(t,r):Z(t,r,"0"),e.s<0?"-"+t:t)}return S.clone=I,S.ROUND_UP=0,S.ROUND_DOWN=1,S.ROUND_CEIL=2,S.ROUND_FLOOR=3,S.ROUND_HALF_UP=4,S.ROUND_HALF_DOWN=5,S.ROUND_HALF_EVEN=6,S.ROUND_HALF_CEIL=7,S.ROUND_HALF_FLOOR=8,S.EUCLID=9,S.config=S.set=function(e){var t,r;if(null!=e){if("object"!=R(e))throw Error(U+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(H(r=e[t],0,G,t),m=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(H(r=e[t],0,8,t),w=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(H(r[0],-G,0,t),H(r[1],0,G,t),g=r[0],b=r[1]):(H(r,-G,G,t),g=-(b=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)H(r[0],-G,-1,t),H(r[1],1,G,t),_=r[0],E=r[1];else{if(H(r,-G,G,t),!r)throw Error(U+t+" cannot be zero: "+r);_=-(E=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(U+t+" not true or false: "+r);if(r&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw O=!r,Error(U+"crypto unavailable");O=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(H(r=e[t],0,9,t),i=r),e.hasOwnProperty(t="POW_PRECISION")&&(H(r=e[t],0,G,t),x=r),e.hasOwnProperty(t="FORMAT")){if("object"!=R(r=e[t]))throw Error(U+t+" not an object: "+r);N=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(U+t+" invalid: "+r);j="0123456789"==r.slice(0,10),A=r}}return{DECIMAL_PLACES:m,ROUNDING_MODE:w,EXPONENTIAL_AT:[g,b],RANGE:[_,E],CRYPTO:O,MODULO_MODE:i,POW_PRECISION:x,FORMAT:N,ALPHABET:A}},S.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!S.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)&&-G<=i&&i<=G&&i===C(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((t=(i+1)%M)<1&&(t+=M),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||z<=r||r!==C(r))break e;if(0!==r)return!0}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(U+"Invalid BigNumber: "+e)},S.maximum=S.max=function(){return o(arguments,r.lt)},S.minimum=S.min=function(){return o(arguments,r.gt)},S.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return C(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,u=[],l=new S(v);if(null==e?e=m:H(e,0,G),i=St(e/M),O)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)9e15<=(o=131072*t[s]+(t[s+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(u.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw O=!1,Error(U+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s<i;)9e15<=(o=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])?crypto.randomBytes(7).copy(t,s):(u.push(o%1e14),s+=7);s=i/7}if(!O)for(;s<i;)(o=c())<9e15&&(u[s++]=o%1e14);for(i=u[--s],e%=M,i&&e&&(u[s]=C(i/(o=Tt[M-e]))*o);0===u[s];u.pop(),s--);if(s<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=M);for(s=1,o=u[0];10<=o;o/=10,s++);s<M&&(n-=M-s)}return l.e=n,l.c=u,l}),S.sum=function(){for(var e=1,t=arguments,r=new S(t[0]);e<t.length;)r=r.plus(t[e++]);return r},y="0123456789",f=function(e,t,r,n,i){var o,s,u,l,c,a,f,p,h=e.indexOf("."),v=m,g=w;for(0<=h&&(l=x,x=0,e=e.replace(".",""),a=(p=new S(t)).pow(e.length-h),x=l,p.c=k(Z(V(a.c),a.e,"0"),10,r,y),p.e=p.c.length),u=l=(f=k(e,t,r,i?(o=A,y):(o=y,A))).length;0==f[--l];f.pop());if(!f[0])return o.charAt(0);if(h<0?--u:(a.c=f,a.e=u,a.s=n,f=(a=d(a,p,v,g,r)).c,c=a.r,u=a.e),h=f[s=u+v+1],l=r/2,c=c||s<0||null!=f[s+1],c=g<4?(null!=h||c)&&(0==g||g==(a.s<0?3:2)):l<h||h==l&&(4==g||c||6==g&&1&f[s-1]||g==(a.s<0?8:7)),s<1||!f[0])e=c?Z(o.charAt(1),-v,o.charAt(0)):o.charAt(0);else{if(f.length=s,c)for(--r;++f[--s]>r;)f[s]=0,s||(++u,f=[1].concat(f));for(l=f.length;!f[--l];);for(h=0,e="";h<=l;e+=o.charAt(f[h++]));e=Z(e,u,o.charAt(0))}return e},d=function(e,t,r,n,i){var o,s,u,l,c,a,f,p,h,v,g,d,y,m,w,b,_,E=e.s==t.s?1:-1,O=e.c,x=t.c;if(!(O&&O[0]&&x&&x[0]))return new S(e.s&&t.s&&(O?!x||O[0]!=x[0]:x)?O&&0==O[0]||!x?0*E:E/0:NaN);for(h=(p=new S(E)).c=[],E=r+(s=e.e-t.e)+1,i||(i=z,s=q(e.e/M)-q(t.e/M),E=E/M|0),u=0;x[u]==(O[u]||0);u++);if(x[u]>(O[u]||0)&&s--,E<0)h.push(1),l=!0;else{for(m=O.length,b=x.length,E+=2,1<(c=C(i/(x[u=0]+1)))&&(x=P(x,c,i),O=P(O,c,i),b=x.length,m=O.length),y=b,g=(v=O.slice(0,b)).length;g<b;v[g++]=0);_=x.slice(),_=[0].concat(_),w=x[0],x[1]>=i/2&&w++;do{if(c=0,(o=T(x,v,b,g))<0){if(d=v[0],b!=g&&(d=d*i+(v[1]||0)),1<(c=C(d/w)))for(f=(a=P(x,c=i<=c?i-1:c,i)).length,g=v.length;1==T(a,v,f,g);)c--,B(a,b<f?_:x,f,i),f=a.length,o=1;else 0==c&&(o=c=1),f=(a=x.slice()).length;if(B(v,a=f<g?[0].concat(a):a,g,i),g=v.length,-1==o)for(;T(x,v,b,g)<1;)c++,B(v,b<g?_:x,g,i),g=v.length}else 0===o&&(c++,v=[0])}while(h[u++]=c,v[0]?v[g++]=O[y]||0:(v=[O[y]],g=1),(y++<m||null!=v[0])&&E--);l=null!=v[0],h[0]||h.splice(0,1)}if(i==z){for(u=1,E=h[0];10<=E;E/=10,u++);$(p,r+(p.e=u+s*M-1)+1,n,l)}else p.e=s,p.r=+l;return p},s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,l=/^\.([^.]+)$/,a=/^-?(Infinity|NaN)$/,h=/^\s*\+(?=[\w.])|^\s+|\s+$/g,p=function(e,t,r,n){var i,o=r?t:t.replace(h,"");if(a.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(s,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(l,"0.$1")),t!=o))return new S(o,i);if(S.DEBUG)throw Error(U+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new S(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return W(this,new S(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return H(e,0,G),null==t?t=w:H(t,0,8),$(new S(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-q(this.e/M))*M,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return d(this,new S(e,t),m,w)},r.dividedToIntegerBy=r.idiv=function(e,t){return d(this,new S(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,i,o,s,u,l,c,a=this;if((e=new S(e)).c&&!e.isInteger())throw Error(U+"Exponent not an integer: "+D(e));if(null!=t&&(t=new S(t)),s=14<e.e,!a.c||!a.c[0]||1==a.c[0]&&!a.e&&1==a.c.length||!e.c||!e.c[0])return c=new S(Math.pow(+D(a),s?e.s*(2-Bt(e)):+D(e))),t?c.mod(t):c;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new S(NaN);(n=!u&&a.isInteger()&&t.isInteger())&&(a=a.mod(t))}else{if(9<e.e&&(0<a.e||a.e<-1||(0==a.e?1<a.c[0]||s&&24e7<=a.c[1]:a.c[0]<8e13||s&&a.c[0]<=9999975e7)))return o=a.s<0&&Bt(e)?-0:0,-1<a.e&&(o=1/o),new S(u?1/o:o);x&&(o=St(x/M+2))}for(l=s?(r=new S(.5),u&&(e.s=1),Bt(e)):(i=Math.abs(+D(e)))%2,c=new S(v);;){if(l){if(!(c=c.times(a)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=C(i/2)))break;l=i%2}else if($(e=e.times(r),e.e+1,1),14<e.e)l=Bt(e);else{if(0==(i=+D(e)))break;l=i%2}a=a.times(a),o?a.c&&a.c.length>o&&(a.c.length=o):n&&(a=a.mod(t))}return n?c:(u&&(c=v.div(c)),t?c.mod(t):o?$(c,x,w,void 0):c)},r.integerValue=function(e){var t=new S(this);return null==e?e=w:H(e,0,8),$(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===W(this,new S(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<W(this,new S(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=W(this,new S(e,t)))||0===t},r.isInteger=function(){return!!this.c&&q(this.e/M)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return W(this,new S(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=W(this,new S(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,i,o,s=this,u=s.s;if(t=(e=new S(e,t)).s,!u||!t)return new S(NaN);if(u!=t)return e.s=-t,s.plus(e);var l=s.e/M,c=e.e/M,a=s.c,f=e.c;if(!l||!c){if(!a||!f)return a?(e.s=-t,e):new S(f?s:NaN);if(!a[0]||!f[0])return f[0]?(e.s=-t,e):new S(a[0]?s:3==w?-0:0)}if(l=q(l),c=q(c),a=a.slice(),u=l-c){for((i=(o=u<0)?(u=-u,a):(c=l,f)).reverse(),t=u;t--;i.push(0));i.reverse()}else for(n=(o=(u=a.length)<(t=f.length))?u:t,u=t=0;t<n;t++)if(a[t]!=f[t]){o=a[t]<f[t];break}if(o&&(i=a,a=f,f=i,e.s=-e.s),0<(t=(n=f.length)-(r=a.length)))for(;t--;a[r++]=0);for(t=z-1;u<n;){if(a[--n]<f[n]){for(r=n;r&&!a[--r];a[r]=t);--a[r],a[n]+=z}a[n]-=f[n]}for(;0==a[0];a.splice(0,1),--c);return a[0]?F(e,a,c):(e.s=3==w?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new S(e,t),!n.c||!e.s||e.c&&!e.c[0]?new S(NaN):!e.c||n.c&&!n.c[0]?new S(n):(9==i?(t=e.s,e.s=1,r=d(n,e,0,3),e.s=t,r.s*=t):r=d(n,e,0,i),(e=n.minus(r.times(e))).c[0]||1!=i||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,i,o,s,u,l,c,a,f,p,h=this,v=h.c,g=(e=new S(e,t)).c;if(!(v&&g&&v[0]&&g[0]))return!h.s||!e.s||v&&!v[0]&&!g||g&&!g[0]&&!v?e.c=e.e=e.s=null:(e.s*=h.s,v&&g?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=q(h.e/M)+q(e.e/M),e.s*=h.s,(u=v.length)<(h=g.length)&&(p=v,v=g,g=p,n=u,u=h,h=n),n=u+h,p=[];n--;p.push(0));for(n=h;0<=--n;){for(a=g[n]%1e7,f=g[n]/1e7|(r=0),i=n+(o=u);n<i;)r=((l=a*(l=v[--o]%1e7)+(s=f*l+(c=v[o]/1e7|0)*a)%1e7*1e7+p[i]+r)/1e14|0)+(s/1e7|0)+f*c,p[i--]=l%1e14;p[i]=r}return r?++t:p.splice(0,1),F(e,p,t)},r.negated=function(){var e=new S(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new S(e,t)).s,!i||!t)return new S(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/M,s=e.e/M,u=n.c,l=e.c;if(!o||!s){if(!u||!l)return new S(i/0);if(!u[0]||!l[0])return l[0]?e:new S(u[0]?n:0*i)}if(o=q(o),s=q(s),u=u.slice(),i=o-s){for((r=0<i?(s=o,l):(i=-i,u)).reverse();i--;r.push(0));r.reverse()}for((i=u.length)-(t=l.length)<0&&(r=l,l=u,u=r,t=i),i=0;t;)i=(u[--t]=u[t]+l[t]+i)/z|0,u[t]=z===u[t]?0:u[t]%z;return i&&(u=[i].concat(u),++s),F(e,u,s)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return H(e,1,G),null==t?t=w:H(t,0,8),$(new S(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*M+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return H(e,-Pt,Pt),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,i,o=this,s=o.c,u=o.s,l=o.e,c=m+4,a=new S("0.5");if(1!==u||!s||!s[0])return new S(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);if((r=0==(u=Math.sqrt(+D(o)))||u==1/0?(((t=V(s)).length+l)%2==0&&(t+="0"),u=Math.sqrt(+t),l=q((l+1)/2)-(l<0||l%2),new S(t=u==1/0?"5e"+l:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+l)):new S(u+"")).c[0])for((u=(l=r.e)+c)<3&&(u=0);;)if(i=r,r=a.times(i.plus(d(o,i,c,1))),V(i.c).slice(0,u)===(t=V(r.c)).slice(0,u)){if(r.e<l&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||($(r,r.e+m+2,1),e=!r.times(r).eq(o));break}if(!n&&($(i,i.e+m+2,0),i.times(i).eq(o))){r=i;break}c+=4,u+=4,n=1}return $(r,r.e+m+1,w,e)},r.toExponential=function(e,t){return null!=e&&(H(e,0,G),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(H(e,0,G),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==R(t)?(r=t,t=null):e&&"object"==R(e)?(r=e,e=t=null):r=N;else if("object"!=R(r))throw Error(U+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),i=+r.groupSize,o=+r.secondaryGroupSize,s=r.groupSeparator||"",u=t[0],t=t[1],l=this.s<0,c=l?u.slice(1):u,a=c.length;if(o&&(n=i,i=o,a-=o=n),0<i&&0<a){for(u=c.substr(0,n=a%i||i);n<a;n+=i)u+=s+c.substr(n,i);0<o&&(u+=s+c.slice(n)),l&&(u="-"+u)}e=t?u+(r.decimalSeparator||"")+((o=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):u}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,i,o,s,u,l,c,a,f=this,p=f.c;if(null!=e&&(!(u=new S(e)).isInteger()&&(u.c||1!==u.s)||u.lt(v)))throw Error(U+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+D(u));if(!p)return new S(f);for(t=new S(v),c=r=new S(v),n=l=new S(v),p=V(p),o=t.e=p.length-f.e-1,t.c[0]=Tt[(s=o%M)<0?M+s:s],e=!e||0<u.comparedTo(t)?0<o?t:c:u,s=E,E=1/0,u=new S(p),l.c[0]=0;a=d(u,t,0,1),1!=(i=r.plus(a.times(n))).comparedTo(e);)r=n,n=i,c=l.plus(a.times(i=c)),l=i,t=u.minus(a.times(i=t)),u=i;return i=d(e.minus(r),n,0,1),l=l.plus(i.times(c)),r=r.plus(i.times(n)),l.s=c.s=f.s,p=d(c,n,o*=2,w).minus(f).abs().comparedTo(d(l,r,o,w).minus(f).abs())<1?[c,n]:[l,r],E=s,p},r.toNumber=function(){return+D(this)},r.toPrecision=function(e,t){return null!=e&&H(e,1,G),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?i<=g||b<=i?Ft(V(r.c),i):Z(V(r.c),i,"0"):10===e&&j?Z(V((r=$(new S(r),m+i+1,w)).c),r.e,"0"):(H(e,2,A.length,"Base"),f(Z(V(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return D(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&S.set(e),S}();function $t(e){for(var t=[];0<e.length;){var r=e.shift();if(k(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),i=t.pop();if("string"==typeof n&&!b.isBigNumber(n)){if(!T(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new b(n)}if("string"==typeof i&&!b.isBigNumber(i)){if(!T(i))throw new Error("".concat(i,"不是一个合法的数字"));i=new b(i)}switch(r){case"+":t.push(i.plus(n));break;case"-":t.push(i.minus(n));break;case"*":t.push(i.times(n));break;case"/":t.push(i.div(n));break;case"%":t.push(i.mod(n));break;case"**":t.push(i.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var o=t[0];if((o=b.isBigNumber(o)?o:b(o)).isNaN())throw new Error("计算结果为NaN");return o}function Dt(e,t){var r,n,i,o,s,u,l,c,a,f,p,h,v,g,d,y,m,w="";return b.isBigNumber(e)?w=e.toFixed():"string"!=typeof e&&(w=e.toString()),"undefined"===w||"NaN"===w?null:(s="~-",c=l=u=o=i=n=r=null,t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","="].includes(e.value))throw new Error("错误的格式化参数:",e.value);n=e.value}else if("comma"===t)i=!0;else if("number"===t)r=e.value;else if("plus"===t)o=!0;else if("round"===t)s=e.value;else if("fraction"===t)l=!0;else if("scientific"===t)u=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");c=!0}}),u?(e=b(w).toExponential(),o&&!e.startsWith("-")?"+"+e:e):l?(t=b(w).toFraction().map(function(e){return e.toFixed()}).join("/"),o&&!t.startsWith("-")?"+"+t:t):(c&&(w=b(w).times(100).toFixed()),r&&(e=w.split("."),t=e[0],e=1===e.length?"":e[1],y=n,p=r,d=s,h=a=t,m=(v=f=e).length,g={"~-":function(){v=f.slice(0,p)},"~+":function(){""===(v=f.slice(0,p))?h=a.slice(0,a.length-1)+(+a[a.length-1]+1):v=v.slice(0,p-1)+(+v[p-1]+1)},"~5":function(){v=f.slice(0,p);var e=+f[p];""===v?5<=e&&(h=a.slice(0,a.length-1)+(+a[a.length-1]+1)):5<=e&&(v=v.slice(0,p-1)+(+v[p-1]+1))},"~6":function(){v=f.slice(0,p);var e=""===(e=f.slice(+p+1,f.length))?0:parseInt(e),t=+f[p],r=+a[a.length-1];""===v?(6<=t||5==t&&0<e||5==t&&r%2!=0)&&(h=a.slice(0,a.length-1)+(+a[a.length-1]+1)):(r=+f[p-1],(6<=t||5==t&&0<e||5==t&&r%2!=0)&&(v=v.slice(0,p-1)+(+v[p-1]+1)))}},"<="===y?v=m<=p?f:(g[d]&&g[d](),v.replace(/0+$/,"")):"="===y?m<p?v=f+"0".repeat(p-m):p<m&&g[d]&&g[d]():">="===y&&m<p&&(v=f+"0".repeat(p-m)),t=(g={int_part:h,dec_part:v}).int_part,w=""===(e=g.dec_part)?t:"".concat(t,".").concat(e)),i&&(w=1<(d=w.split(".")).length?((y=d[0]).includes("-")?d[0]=y[0]+y.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):d[0]=y.replace(/(?=(?!^)(?:\d{3})+$)/g,","),d.join(".")):(m=d[0]).includes("-")?m[0]+m.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):m.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),null===o||w.startsWith("-")||(w="+"+w),c&&(w+="%"),w))}function It(e,i){return e.map(function(e){if("var"!==e.type)return e;for(var t,r,n=0;n<i.length&&!f(t=d(i[n],e.value));n++);if("number"==typeof(r=t)||T(r))return{type:"number",value:t};throw new Error("错误的填充值")})}function Rt(e){var r=null;return e.length,{tokens:e.map(function(e){var t=function(e){for(var t,r,n=null,i=null,o=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],s=0;s<o.length;s++){var u=e.match(o[s]);if(u){t=u;break}}return t&&(i=t[1],""!==(r=t[2]).trim())&&(n=r),{num:i,unit:n}}(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}s=c;try{var m=s(Object,"defineProperty");m({},"",{})}catch(e){}var Ct=K,Ut=Q;r=function(e){return Ut(e)&&"[object Arguments]"==Ct(e)},l=Object.prototype,l.hasOwnProperty,l.propertyIsEnumerable,r(function(){return arguments}()),s={exports:{}};l=(l=(m=s).exports)&&!l.nodeType&&l,r=(r=l&&m&&!m.nodeType&&m)&&r.exports===l?n.Buffer:void 0,l=r?r.isBuffer:void 0,m.exports=l||function(){return!1};var w,zt,Mt,s={exports:{}},t=(l=(l=(r=s).exports)&&!l.nodeType&&l,w=l&&r&&!r.nodeType&&r,zt=w&&w.exports===l&&t.process,l=function(){try{var e=w&&w.require&&w.require("util").types;return e?e:zt&&zt.binding&&zt.binding("util")}catch(e){}}(),r.exports=l,s.exports),r=(t&&t.isTypedArray,{exports:{}});t=(t=(l=r).exports)&&!t.nodeType&&t,r=(r=t&&l&&!l.nodeType&&l)&&r.exports===t?n.Buffer:void 0,Mt=r?r.allocUnsafe:void 0,l.exports=function(e,t){return t?e.slice():(t=e.length,t=Mt?Mt(t):new e.constructor(t),e.copy(t),t)};var t=c(n,"DataView"),r=v,l=c(n,"Promise"),v=c(n,"Set"),_=c(n,"WeakMap"),Lt=K,E=ve,Gt="[object Map]",qt="[object Promise]",Vt="[object Set]",Wt="[object WeakMap]",Ht="[object DataView]",Zt=E(t),Xt=E(r),Yt=E(l),Jt=E(v),Kt=E(_),O=Lt;(t&&O(new t(new ArrayBuffer(1)))!=Ht||r&&O(new r)!=Gt||l&&O(l.resolve())!=qt||v&&O(new v)!=Vt||_&&O(new _)!=Wt)&&(O=function(e){var t=Lt(e),e="[object Object]"==t?e.constructor:void 0,e=e?E(e):"";if(e)switch(e){case Zt:return Ht;case Xt:return Gt;case Yt:return qt;case Jt:return Vt;case Kt:return Wt}return t}),n.Uint8Array;t=i?i.prototype:void 0,t&&t.valueOf,r=s.exports,r&&r.isMap,l=s.exports,l&&l.isSet,v=s.exports,v&&v.isArrayBuffer,_=s.exports;_&&_.isDate,Function.prototype.toString.call(Object);O=i?i.prototype:void 0;O&&O.valueOf;n.isFinite;t=s.exports;function Qt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=function(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],i=(f(i=e[1])&&(t.options=i),d(i,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===i)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(R(n)))}r=n.toString()}if(e=r.split("|"),t.expr=e[0],1<e.length){i=e[1];if(""!==i.trim())try{t.fmt=F(i)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var o,n=[];try{n=F(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(o=t.fmt.map(function(e){return e.type}),n.forEach(function(e){o.includes(e.type)||t.fmt.push(e)}))}return t}(t),i=d(n,"options._error",void 0),o=d(n,"options._debug",!1),s=d(n,"options._unit",!1),u=n.options,l=null;if(n.fmt_err||n.expr_err){if(f(i))return i;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(f(i))try{c=xt(n.expr,s)}catch(e){return i}else c=xt(n.expr,s);if(o&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),p(u)){var c,a=[];if(Array.isArray(u)?a=u:(a.push(u),f(u=d(u,"_fill_data",{}))&&(Array.isArray(u)?a=[].concat(x(a),x(u)):a.push(u))),f(i))try{c=Nt(c,a,s),p(n.fmt)&&(n.fmt=It(n.fmt,a))}catch(e){return i}else c=Nt(c,a,s),p(n.fmt)&&(n.fmt=It(n.fmt,a));[!0,"on","auto","space"].includes(s)&&(l=(u=Rt(c)).unit,c=u.tokens)}a=At(c),o&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(a),console.warn("单位:".concat(l))),s=null;if(f(i))try{s=$t(a)}catch(e){return i}else s=$t(a);if("Infinity"!==(s=p(n.fmt)?Dt(s,n.fmt):null!==s?s.toFixed():null)&&null!==s)return null!==l&&(s+=l),s;if(f(i))return i;throw new Error("计算错误可能是非法的计算式")}t&&t.isRegExp,i&&i.iterator,console.log("%ca-calc:%c ".concat(A," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");r=Qt;return e.calc=Qt,e.fmt=r,e.version=A,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
1
|
+
var a_calc=function(e){"use strict";function R(e){return(R="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})(e)}function N(e){return function(e){if(Array.isArray(e))return x(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){var r;if(e)return"string"==typeof e?x(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(e,t):void 0}(e)||function(){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 x(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}var A="1.1.0",S=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,j=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function k(e){return-1<"+-*/%()**".indexOf(e)}function P(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function f(e){return void 0!==e}function p(e){return null!==e}function T(e){return"string"==typeof e&&!!S.test(e)}var o={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",scientific:"scientific"},B="<>=";function $(e){for(var t=o.initial,r=[],n=[];e;){var i=e[0];if(t===o.initial)if(B.includes(i))t=o.symbol,r.push(i),e=e.slice(1);else if("~"===i)t=o.round,r.push(i),e=e.slice(1);else if("-"===i){if(t=o.initial,/[Ee]/.test(e[1]))n.push({type:"scientific",value:e[1]});else{if(!/[Nn]/.test(e[1]))throw new Error("不识别的fmt字符:".concat(e.slice(2)));n.push({type:"to-number",value:e[1]})}e=e.slice(2)}else{if("/"===i)t=o.initial,n.push({type:"fraction",value:i});else if(/[a-zA-Z_]/.test(i))t=o.variable,r.push(i);else if(/\d/.test(i))t=o.number,r.push(i);else if("+"===i)t=o.initial,n.push({type:"plus",value:i});else if(","===i)t=o.initial,n.push({type:"comma",value:i});else if("%"===i)t=o.initial,n.push({type:"percent",value:i});else if(!/\s/.test(i))throw new Error("不识别的fmt字符:".concat(i));e=e.slice(1)}else if(t===o.number)/\d/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=o.initial);else if(t===o.variable)/[\$\w_\-.\[\]"']/.test(i)?(r.push(i),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=o.initial);else if(t===o.symbol)/\s/.test(i)?e=e.slice(1):B.includes(i)?(r.push(i),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=o.initial);else{if(t!==o.round)throw new Error("错误的自动机状态");if(/\s/.test(i))e=e.slice(1);else{if(!("56+-".includes(i)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(i));r.push(i),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=o.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=o.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=Array.isArray,t="object"==R(t)&&t&&t.Object===Object&&t,n=t,i="object"==("undefined"==typeof self?"undefined":R(self))&&self&&self.Object===Object&&self,n=n||i||Function("return this")(),i=n.Symbol,s=Object.prototype,F=s.hasOwnProperty,D=s.toString,u=i?i.toStringTag:void 0;var I=Object.prototype.toString;var X=function(e){var t=F.call(e,u),r=e[u];try{var n=!(e[u]=void 0)}catch(e){}var i=D.call(e);return n&&(t?e[u]=r:delete e[u]),i},Y=function(e){return I.call(e)},J=i?i.toStringTag:void 0;function K(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(J&&J in Object(e)?X:Y)(e)}function Q(e){return null!=e&&"object"==R(e)}var ee=K,te=Q;function re(e){return"symbol"==R(e)||te(e)&&"[object Symbol]"==ee(e)}var ne=r,ie=re,oe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,se=/^\w*$/;function ue(e,t){var r;return!ne(e)&&(!("number"!=(r=R(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ie(e))||se.test(e)||!oe.test(e)||null!=t&&e in Object(t))}function le(e){var t=R(e);return null!=e&&("object"==t||"function"==t)}var ce=K,ae=le;function fe(e){return!!ae(e)&&("[object Function]"==(e=ce(e))||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)}var s=n["__core-js_shared__"],pe=(s=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"";var he=Function.prototype.toString;function ge(e){if(null!=e){try{return he.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var ve=fe,de=function(e){return!!pe&&pe in e},ye=le,me=ge,we=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,s=s.toString,l=l.hasOwnProperty,be=RegExp("^"+s.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var _e=function(e){return!(!ye(e)||de(e))&&(ve(e)?be:we).test(me(e))},Ee=function(e,t){return null==e?void 0:e[t]};function c(e,t){return e=Ee(e,t),_e(e)?e:void 0}var s=c(Object,"create"),Oe=s;var Ne=s,xe=Object.prototype.hasOwnProperty;var Ae=s,Se=Object.prototype.hasOwnProperty;var je=s;function ke(e){return e=this.has(e)&&delete this.__data__[e],this.size-=e?1:0,e}function Pe(e){var t,r=this.__data__;return Ne?"__lodash_hash_undefined__"===(t=r[e])?void 0:t:xe.call(r,e)?r[e]:void 0}function Te(e){var t=this.__data__;return Ae?void 0!==t[e]:Se.call(t,e)}function Be(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=je&&void 0===t?"__lodash_hash_undefined__":t,this}function a(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])}}a.prototype.clear=function(){this.__data__=Oe?Oe(null):{},this.size=0},a.prototype.delete=ke,a.prototype.get=Pe,a.prototype.has=Te,a.prototype.set=Be;l=a;var $e=function(e,t){return e===t||e!=e&&t!=t};function Fe(e,t){for(var r=e.length;r--;)if($e(e[r][0],t))return r;return-1}var De=Fe,Ie=Array.prototype.splice;var Re=Fe;var Ce=Fe;var Ue=Fe;function ze(e){var t=this.__data__;return!((e=De(t,e))<0||(e==t.length-1?t.pop():Ie.call(t,e,1),--this.size,0))}function Me(e){var t=this.__data__;return(e=Re(t,e))<0?void 0:t[e][1]}function Le(e){return-1<Ce(this.__data__,e)}function Ge(e,t){var r=this.__data__,n=Ue(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function h(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])}}h.prototype.clear=function(){this.__data__=[],this.size=0},h.prototype.delete=ze,h.prototype.get=Me,h.prototype.has=Le,h.prototype.set=Ge;var s=h,g=c(n,"Map"),qe=l,Ve=s,We=g;var He=function(e){var t=R(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};function Ze(e,t){return e=e.__data__,He(t)?e["string"==typeof t?"string":"hash"]:e.map}var Xe=Ze;var Ye=Ze;var Je=Ze;var Ke=Ze;function Qe(e){return e=Xe(this,e).delete(e),this.size-=e?1:0,e}function et(e){return Ye(this,e).get(e)}function tt(e){return Je(this,e).has(e)}function rt(e,t){var r=Ke(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function v(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])}}v.prototype.clear=function(){this.size=0,this.__data__={hash:new qe,map:new(We||Ve),string:new qe}},v.prototype.delete=Qe,v.prototype.get=et,v.prototype.has=tt,v.prototype.set=rt;var nt=v;function it(n,i){if("function"!=typeof n||null!=i&&"function"!=typeof i)throw new TypeError("Expected a function");function o(){var e=arguments,t=i?i.apply(this,e):e[0],r=o.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),o.cache=r.set(t,e)||r,e)}return o.cache=new(it.Cache||nt),o}it.Cache=nt;var ot=it;var st=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ut=/\\(\\)?/g,l=function(e){var t=(e=ot(e,function(e){return 500===t.size&&t.clear(),e})).cache;return e}(function(e){var i=[];return 46===e.charCodeAt(0)&&i.push(""),e.replace(st,function(e,t,r,n){i.push(r?n.replace(ut,"$1"):t||e)}),i});var lt=function(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},ct=r,at=re,s=i?i.prototype:void 0,ft=s?s.toString:void 0;var pt=function e(t){var r;return"string"==typeof t?t:ct(t)?lt(t,e)+"":at(t)?ft?ft.call(t):"":"0"==(r=t+"")&&1/t==-1/0?"-0":r};var ht=r,gt=ue,vt=l,dt=function(e){return null==e?"":pt(e)};var yt=re;var mt=function(e,t){return ht(e)?e:gt(e,t)?[e]:vt(dt(e))},wt=function(e){var t;return"string"==typeof e||yt(e)?e:"0"==(t=e+"")&&1/e==-1/0?"-0":t};var bt=function(e,t){for(var r=0,n=(t=mt(t,e)).length;null!=e&&r<n;)e=e[wt(t[r++])];return r&&r==n?e:void 0};var d=function(e,t,r){return void 0===(e=null==e?void 0:bt(e,t))?r:e};var y={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},_t="+-",Et="*/%",Ot="()";function Nt(e,t){for(var r,n,i,o=1<arguments.length&&void 0!==t&&t,s=y.initial,u=[],l=[],c=function(){u.push(r),e=e.slice(1)},a=function(e){l.push({type:e,value:u.join("")}),u.length=0},f=function(){e=e.slice(1)};e;)switch(r=e[0],s){case y.initial:if(_t.includes(r)){var p=l.at(-1),s=0===l.length||"operator"===p.type||"("===p?y.number:y.operator;c()}else if(Et.includes(r))s=y.operator,c();else if(/\d/.test(r))s=y.number,c();else if(Ot.includes(r))s=y.bracket;else if(/[a-zA-Z_$]/.test(r))s=y.var,c();else{if(!/\s/.test(r))throw new Error("不识别的字符".concat(r));f()}break;case y.bracket:l.push({type:y.bracket,value:r}),f(),s=y.initial;break;case y.operator:p=u.at(-1);"*"===r&&"*"===p&&c(),a(y.operator),s=y.initial;break;case y.number:if(/\d/.test(r))c();else if("."===r){if(0===u.length||u.includes("."))throw new Error("非法的小数部分".concat(u.join("")));c()}else"Ee".includes(r)?(s=y.scientific,c()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(r)||"space"===o&&/\S/.test(r)?c():(a(y.number),s=y.initial);break;case y.scientific:/\d/.test(r)?c():_t.includes(r)?(n=u.slice(1),i=u.at(-1),n.includes(r)||!/[Ee]/.test(i)?(a(y.scientific),s=y.initial):c()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(r)||"space"===o&&/\S/.test(r)?c():(a(y.scientific),s=y.initial);break;case y.var:/[\w_.\[\]"']/.test(r)?c():(a(y.var),s=y.initial);break;default:throw new Error("状态错误")}return 0!==u.length&&(l.push({type:s,value:u.join("")}),u.length=0,s=y.initial),l}function xt(e,t,r){if(null===t)throw new Error("错误的填充数据:",t);for(var n=[],i=0;i<e.length;i++){var o=e[i];if("var"!==o.type)n.push(o);else{if("undefined"===o.value||"NaN"===o.value)throw new Error("key不应该为:".concat(o.value));for(var s=null,u=0;u<t.length;u++){var l=t[u],l=d(l,o.value);if(void 0!==l){s=l;break}}if(null===s)throw new Error("token填充失败,请确认".concat(o,"存在"));if("string"==typeof s){if(""===s.trim())throw new Error("token填充失败,".concat(o.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!j.test(s))throw new Error("token填充失败,".concat(o.value,"值:").concat(s,"为非法单位数字"))}else if(!T(s))throw new Error("token填充失败,".concat(o,"值:").concat(s,"为非法数字"))}s="string"!=typeof s?s.toString():s,n.push({type:"number",value:s})}}return n}function At(e){for(var t,r=[],n=[],i=e.map(function(e){return e.value});0<i.length;){var o=i.shift();if(k(o))if("("===o)r.push(o);else if(")"===o){for(var s=r.pop();"("!==s&&0<r.length;)n.push(s),s=r.pop();if("("!==s)throw"error: unmatched ()"}else{for(;t=r[r.length-1],P(o)<=P(t)&&0<r.length;)n.push(r.pop());r.push(o)}else n.push(o)}if(0<r.length){if(")"===r[r.length-1]||"("===r[r.length-1])throw"error: unmatched ()";for(;0<r.length;)n.push(r.pop())}return n}var St=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,jt=Math.ceil,C=Math.floor,U="[BigNumber Error] ",kt=U+"Number primitive has more than 15 significant digits: ",z=1e14,M=14,Pt=9007199254740991,Tt=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],L=1e7,G=1e9;function q(e){var t=0|e;return 0<e||e===t?t:t-1}function V(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=M-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function W(e,t){var r,n,i=e.c,o=t.c,s=e.s,u=t.s,e=e.e,t=t.e;if(!s||!u)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-u:s;if(s!=u)return s;if(r=s<0,n=e==t,!i||!o)return n?0:!i^r?1:-1;if(!n)return t<e^r?1:-1;for(u=(e=i.length)<(t=o.length)?e:t,s=0;s<u;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return e==t?0:t<e^r?1:-1}function H(e,t,r,n){if(e<t||r<e||e!==C(e))throw Error(U+(n||"Argument")+("number"==typeof e?e<t||r<e?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Bt(e){var t=e.c.length-1;return q(e.e/M)==t&&e.c[t]%2!=0}function $t(e,t){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Z(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 E=function I(e){var d,f,p,t,c,y,s,u,l,a,h,r=j.prototype={constructor:j,toString:null,valueOf:null},g=new j(1),m=20,w=4,v=-7,b=21,_=-1e7,E=1e7,O=!1,i=1,N=0,x={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},A="0123456789abcdefghijklmnopqrstuvwxyz",S=!0;function j(e,t){var r,n,i,o,s,u,l,c,a=this;if(!(a instanceof j))return new j(e,t);if(null==t){if(e&&!0===e._isBigNumber)return a.s=e.s,void(!e.c||e.e>E?a.c=a.e=null:e.e<_?a.c=[a.e=0]:(a.e=e.e,a.c=e.c.slice()));if((u="number"==typeof e)&&0*e==0){if(a.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,s=e;10<=s;s/=10,o++);return void(E<o?a.c=a.e=null:(a.e=o,a.c=[e]))}c=String(e)}else{if(!St.test(c=String(e)))return p(a,c,u);a.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(s=(c=-1<(o=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(o<0&&(o=s),o+=+c.slice(s+1),c=c.substring(0,s)):o<0&&(o=c.length)}else{if(H(t,2,A.length,"Base"),10==t&&S)return F(a=new j(e),m+a.e+1,w);if(c=String(e),u="number"==typeof e){if(0*e!=0)return p(a,c,u,t);if(a.s=1/e<0?(c=c.slice(1),-1):1,j.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(kt+e)}else a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=A.slice(0,t),o=s=0,l=c.length;s<l;s++)if(r.indexOf(n=c.charAt(s))<0){if("."==n){if(o<s){o=l;continue}}else if(!i&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){i=!0,s=-1,o=0;continue}return p(a,String(e),u,t)}u=!1,-1<(o=(c=f(c,t,10,a.s)).indexOf("."))?c=c.replace(".",""):o=c.length}for(s=0;48===c.charCodeAt(s);s++);for(l=c.length;48===c.charCodeAt(--l););if(c=c.slice(s,++l)){if(l-=s,u&&j.DEBUG&&15<l&&(Pt<e||e!==C(e)))throw Error(kt+a.s*e);if((o=o-s-1)>E)a.c=a.e=null;else if(o<_)a.c=[a.e=0];else{if(a.e=o,a.c=[],s=(o+1)%M,o<0&&(s+=M),s<l){for(s&&a.c.push(+c.slice(0,s)),l-=M;s<l;)a.c.push(+c.slice(s,s+=M));s=M-(c=c.slice(s)).length}else s-=l;for(;s--;c+="0");a.c.push(+c)}}else a.c=[a.e=0]}function k(e,t,r,n){for(var i,o,s=[0],u=0,l=e.length;u<l;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(u++)),i=0;i<s.length;i++)r-1<s[i]&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}function P(e,t,r){var n,i,o,s=0,u=e.length,l=t%L,c=t/L|0;for(e=e.slice();u--;)s=((i=l*(o=e[u]%L)+(n=c*o+(o=e[u]/L|0)*l)%L*L+s)/r|0)+(n/L|0)+c*o,e[u]=i%r;return e=s?[s].concat(e):e}function T(e,t,r,n){var i,o;if(r!=n)o=n<r?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 B(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]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var i,o,s,u;if(null==r?r=w:H(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)u=V(e.c),u=1==n||2==n&&(o<=v||b<=o)?$t(u,o):Z(u,o,"0");else if(r=(e=F(new j(e),t,r)).e,s=(u=V(e.c)).length,1==n||2==n&&(t<=r||r<=v)){for(;s<t;u+="0",s++);u=$t(u,r)}else if(t-=o,u=Z(u,r,"0"),s<r+1){if(0<--t)for(u+=".";t--;u+="0");}else if(0<(t+=r-s))for(r+1==s&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function o(e,t){for(var r,n=1,i=new j(e[0]);n<e.length;n++){if(!(r=new j(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function $(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];10<=i;i/=10,n++);return(r=n+r*M-1)>E?e.c=e.e=null:r<_?e.c=[e.e=0]:(e.e=r,e.c=t),e}function F(e,t,r,n){var i,o,s,u,l,c,a,f=e.c,p=Tt;if(f){e:{for(i=1,u=f[0];10<=u;u/=10,i++);if((o=t-i)<0)o+=M,s=t,a=(l=f[c=0])/p[i-s-1]%10|0;else if((c=jt((o+1)/M))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=a=0,s=(o%=M)-M+(i=1)}else{for(l=u=f[c],i=1;10<=u;u/=10,i++);a=(s=(o%=M)-M+i)<0?0:l/p[i-s-1]%10|0}if(n=n||t<0||null!=f[c+1]||(s<0?l:l%p[i-s-1]),n=r<4?(a||n)&&(0==r||r==(e.s<0?3:2)):5<a||5==a&&(4==r||n||6==r&&(0<o?0<s?l/p[i-s]: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[(M-t%M)%M],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[M-o],f[c]=0<s?C(l/p[i-s]%p[s])*u:0),n)for(;;){if(0==c){for(o=1,s=f[0];10<=s;s/=10,o++);for(s=f[0]+=u,u=1;10<=s;s/=10,u++);o!=u&&(e.e++,f[0]==z)&&(f[0]=1);break}if(f[c]+=u,f[c]!=z)break;f[c--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>E?e.c=e.e=null:e.e<_&&(e.c=[e.e=0])}return e}function D(e){var t,r=e.e;return null===r?e.toString():(t=V(e.c),t=r<=v||b<=r?$t(t,r):Z(t,r,"0"),e.s<0?"-"+t:t)}return j.clone=I,j.ROUND_UP=0,j.ROUND_DOWN=1,j.ROUND_CEIL=2,j.ROUND_FLOOR=3,j.ROUND_HALF_UP=4,j.ROUND_HALF_DOWN=5,j.ROUND_HALF_EVEN=6,j.ROUND_HALF_CEIL=7,j.ROUND_HALF_FLOOR=8,j.EUCLID=9,j.config=j.set=function(e){var t,r;if(null!=e){if("object"!=R(e))throw Error(U+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(H(r=e[t],0,G,t),m=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(H(r=e[t],0,8,t),w=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(H(r[0],-G,0,t),H(r[1],0,G,t),v=r[0],b=r[1]):(H(r,-G,G,t),v=-(b=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)H(r[0],-G,-1,t),H(r[1],1,G,t),_=r[0],E=r[1];else{if(H(r,-G,G,t),!r)throw Error(U+t+" cannot be zero: "+r);_=-(E=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(U+t+" not true or false: "+r);if(r&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw O=!r,Error(U+"crypto unavailable");O=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(H(r=e[t],0,9,t),i=r),e.hasOwnProperty(t="POW_PRECISION")&&(H(r=e[t],0,G,t),N=r),e.hasOwnProperty(t="FORMAT")){if("object"!=R(r=e[t]))throw Error(U+t+" not an object: "+r);x=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(U+t+" invalid: "+r);S="0123456789"==r.slice(0,10),A=r}}return{DECIMAL_PLACES:m,ROUNDING_MODE:w,EXPONENTIAL_AT:[v,b],RANGE:[_,E],CRYPTO:O,MODULO_MODE:i,POW_PRECISION:N,FORMAT:x,ALPHABET:A}},j.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!j.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)&&-G<=i&&i<=G&&i===C(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((t=(i+1)%M)<1&&(t+=M),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||z<=r||r!==C(r))break e;if(0!==r)return!0}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(U+"Invalid BigNumber: "+e)},j.maximum=j.max=function(){return o(arguments,r.lt)},j.minimum=j.min=function(){return o(arguments,r.gt)},j.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return C(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,u=[],l=new j(g);if(null==e?e=m:H(e,0,G),i=jt(e/M),O)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s<i;)9e15<=(o=131072*t[s]+(t[s+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(u.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw O=!1,Error(U+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s<i;)9e15<=(o=281474976710656*(31&t[s])+1099511627776*t[s+1]+4294967296*t[s+2]+16777216*t[s+3]+(t[s+4]<<16)+(t[s+5]<<8)+t[s+6])?crypto.randomBytes(7).copy(t,s):(u.push(o%1e14),s+=7);s=i/7}if(!O)for(;s<i;)(o=c())<9e15&&(u[s++]=o%1e14);for(i=u[--s],e%=M,i&&e&&(u[s]=C(i/(o=Tt[M-e]))*o);0===u[s];u.pop(),s--);if(s<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=M);for(s=1,o=u[0];10<=o;o/=10,s++);s<M&&(n-=M-s)}return l.e=n,l.c=u,l}),j.sum=function(){for(var e=1,t=arguments,r=new j(t[0]);e<t.length;)r=r.plus(t[e++]);return r},y="0123456789",f=function(e,t,r,n,i){var o,s,u,l,c,a,f,p,h=e.indexOf("."),g=m,v=w;for(0<=h&&(l=N,N=0,e=e.replace(".",""),a=(p=new j(t)).pow(e.length-h),N=l,p.c=k(Z(V(a.c),a.e,"0"),10,r,y),p.e=p.c.length),u=l=(f=k(e,t,r,i?(o=A,y):(o=y,A))).length;0==f[--l];f.pop());if(!f[0])return o.charAt(0);if(h<0?--u:(a.c=f,a.e=u,a.s=n,f=(a=d(a,p,g,v,r)).c,c=a.r,u=a.e),h=f[s=u+g+1],l=r/2,c=c||s<0||null!=f[s+1],c=v<4?(null!=h||c)&&(0==v||v==(a.s<0?3:2)):l<h||h==l&&(4==v||c||6==v&&1&f[s-1]||v==(a.s<0?8:7)),s<1||!f[0])e=c?Z(o.charAt(1),-g,o.charAt(0)):o.charAt(0);else{if(f.length=s,c)for(--r;++f[--s]>r;)f[s]=0,s||(++u,f=[1].concat(f));for(l=f.length;!f[--l];);for(h=0,e="";h<=l;e+=o.charAt(f[h++]));e=Z(e,u,o.charAt(0))}return e},d=function(e,t,r,n,i){var o,s,u,l,c,a,f,p,h,g,v,d,y,m,w,b,_,E=e.s==t.s?1:-1,O=e.c,N=t.c;if(!(O&&O[0]&&N&&N[0]))return new j(e.s&&t.s&&(O?!N||O[0]!=N[0]:N)?O&&0==O[0]||!N?0*E:E/0:NaN);for(h=(p=new j(E)).c=[],E=r+(s=e.e-t.e)+1,i||(i=z,s=q(e.e/M)-q(t.e/M),E=E/M|0),u=0;N[u]==(O[u]||0);u++);if(N[u]>(O[u]||0)&&s--,E<0)h.push(1),l=!0;else{for(m=O.length,b=N.length,E+=2,1<(c=C(i/(N[u=0]+1)))&&(N=P(N,c,i),O=P(O,c,i),b=N.length,m=O.length),y=b,v=(g=O.slice(0,b)).length;v<b;g[v++]=0);_=N.slice(),_=[0].concat(_),w=N[0],N[1]>=i/2&&w++;do{if(c=0,(o=T(N,g,b,v))<0){if(d=g[0],b!=v&&(d=d*i+(g[1]||0)),1<(c=C(d/w)))for(f=(a=P(N,c=i<=c?i-1:c,i)).length,v=g.length;1==T(a,g,f,v);)c--,B(a,b<f?_:N,f,i),f=a.length,o=1;else 0==c&&(o=c=1),f=(a=N.slice()).length;if(B(g,a=f<v?[0].concat(a):a,v,i),v=g.length,-1==o)for(;T(N,g,b,v)<1;)c++,B(g,b<v?_:N,v,i),v=g.length}else 0===o&&(c++,g=[0])}while(h[u++]=c,g[0]?g[v++]=O[y]||0:(g=[O[y]],v=1),(y++<m||null!=g[0])&&E--);l=null!=g[0],h[0]||h.splice(0,1)}if(i==z){for(u=1,E=h[0];10<=E;E/=10,u++);F(p,r+(p.e=u+s*M-1)+1,n,l)}else p.e=s,p.r=+l;return p},s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,l=/^\.([^.]+)$/,a=/^-?(Infinity|NaN)$/,h=/^\s*\+(?=[\w.])|^\s+|\s+$/g,p=function(e,t,r,n){var i,o=r?t:t.replace(h,"");if(a.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(s,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(l,"0.$1")),t!=o))return new j(o,i);if(j.DEBUG)throw Error(U+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new j(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return W(this,new j(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return H(e,0,G),null==t?t=w:H(t,0,8),F(new j(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-q(this.e/M))*M,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return d(this,new j(e,t),m,w)},r.dividedToIntegerBy=r.idiv=function(e,t){return d(this,new j(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,i,o,s,u,l,c,a=this;if((e=new j(e)).c&&!e.isInteger())throw Error(U+"Exponent not an integer: "+D(e));if(null!=t&&(t=new j(t)),s=14<e.e,!a.c||!a.c[0]||1==a.c[0]&&!a.e&&1==a.c.length||!e.c||!e.c[0])return c=new j(Math.pow(+D(a),s?e.s*(2-Bt(e)):+D(e))),t?c.mod(t):c;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new j(NaN);(n=!u&&a.isInteger()&&t.isInteger())&&(a=a.mod(t))}else{if(9<e.e&&(0<a.e||a.e<-1||(0==a.e?1<a.c[0]||s&&24e7<=a.c[1]:a.c[0]<8e13||s&&a.c[0]<=9999975e7)))return o=a.s<0&&Bt(e)?-0:0,-1<a.e&&(o=1/o),new j(u?1/o:o);N&&(o=jt(N/M+2))}for(l=s?(r=new j(.5),u&&(e.s=1),Bt(e)):(i=Math.abs(+D(e)))%2,c=new j(g);;){if(l){if(!(c=c.times(a)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=C(i/2)))break;l=i%2}else if(F(e=e.times(r),e.e+1,1),14<e.e)l=Bt(e);else{if(0==(i=+D(e)))break;l=i%2}a=a.times(a),o?a.c&&a.c.length>o&&(a.c.length=o):n&&(a=a.mod(t))}return n?c:(u&&(c=g.div(c)),t?c.mod(t):o?F(c,N,w,void 0):c)},r.integerValue=function(e){var t=new j(this);return null==e?e=w:H(e,0,8),F(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===W(this,new j(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<W(this,new j(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=W(this,new j(e,t)))||0===t},r.isInteger=function(){return!!this.c&&q(this.e/M)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return W(this,new j(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=W(this,new j(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,i,o,s=this,u=s.s;if(t=(e=new j(e,t)).s,!u||!t)return new j(NaN);if(u!=t)return e.s=-t,s.plus(e);var l=s.e/M,c=e.e/M,a=s.c,f=e.c;if(!l||!c){if(!a||!f)return a?(e.s=-t,e):new j(f?s:NaN);if(!a[0]||!f[0])return f[0]?(e.s=-t,e):new j(a[0]?s:3==w?-0:0)}if(l=q(l),c=q(c),a=a.slice(),u=l-c){for((i=(o=u<0)?(u=-u,a):(c=l,f)).reverse(),t=u;t--;i.push(0));i.reverse()}else for(n=(o=(u=a.length)<(t=f.length))?u:t,u=t=0;t<n;t++)if(a[t]!=f[t]){o=a[t]<f[t];break}if(o&&(i=a,a=f,f=i,e.s=-e.s),0<(t=(n=f.length)-(r=a.length)))for(;t--;a[r++]=0);for(t=z-1;u<n;){if(a[--n]<f[n]){for(r=n;r&&!a[--r];a[r]=t);--a[r],a[n]+=z}a[n]-=f[n]}for(;0==a[0];a.splice(0,1),--c);return a[0]?$(e,a,c):(e.s=3==w?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new j(e,t),!n.c||!e.s||e.c&&!e.c[0]?new j(NaN):!e.c||n.c&&!n.c[0]?new j(n):(9==i?(t=e.s,e.s=1,r=d(n,e,0,3),e.s=t,r.s*=t):r=d(n,e,0,i),(e=n.minus(r.times(e))).c[0]||1!=i||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,i,o,s,u,l,c,a,f,p,h=this,g=h.c,v=(e=new j(e,t)).c;if(!(g&&v&&g[0]&&v[0]))return!h.s||!e.s||g&&!g[0]&&!v||v&&!v[0]&&!g?e.c=e.e=e.s=null:(e.s*=h.s,g&&v?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=q(h.e/M)+q(e.e/M),e.s*=h.s,(u=g.length)<(h=v.length)&&(p=g,g=v,v=p,n=u,u=h,h=n),n=u+h,p=[];n--;p.push(0));for(n=h;0<=--n;){for(a=v[n]%1e7,f=v[n]/1e7|(r=0),i=n+(o=u);n<i;)r=((l=a*(l=g[--o]%1e7)+(s=f*l+(c=g[o]/1e7|0)*a)%1e7*1e7+p[i]+r)/1e14|0)+(s/1e7|0)+f*c,p[i--]=l%1e14;p[i]=r}return r?++t:p.splice(0,1),$(e,p,t)},r.negated=function(){var e=new j(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new j(e,t)).s,!i||!t)return new j(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/M,s=e.e/M,u=n.c,l=e.c;if(!o||!s){if(!u||!l)return new j(i/0);if(!u[0]||!l[0])return l[0]?e:new j(u[0]?n:0*i)}if(o=q(o),s=q(s),u=u.slice(),i=o-s){for((r=0<i?(s=o,l):(i=-i,u)).reverse();i--;r.push(0));r.reverse()}for((i=u.length)-(t=l.length)<0&&(r=l,l=u,u=r,t=i),i=0;t;)i=(u[--t]=u[t]+l[t]+i)/z|0,u[t]=z===u[t]?0:u[t]%z;return i&&(u=[i].concat(u),++s),$(e,u,s)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return H(e,1,G),null==t?t=w:H(t,0,8),F(new j(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*M+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return H(e,-Pt,Pt),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,i,o=this,s=o.c,u=o.s,l=o.e,c=m+4,a=new j("0.5");if(1!==u||!s||!s[0])return new j(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);if((r=0==(u=Math.sqrt(+D(o)))||u==1/0?(((t=V(s)).length+l)%2==0&&(t+="0"),u=Math.sqrt(+t),l=q((l+1)/2)-(l<0||l%2),new j(t=u==1/0?"5e"+l:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+l)):new j(u+"")).c[0])for((u=(l=r.e)+c)<3&&(u=0);;)if(i=r,r=a.times(i.plus(d(o,i,c,1))),V(i.c).slice(0,u)===(t=V(r.c)).slice(0,u)){if(r.e<l&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(F(r,r.e+m+2,1),e=!r.times(r).eq(o));break}if(!n&&(F(i,i.e+m+2,0),i.times(i).eq(o))){r=i;break}c+=4,u+=4,n=1}return F(r,r.e+m+1,w,e)},r.toExponential=function(e,t){return null!=e&&(H(e,0,G),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(H(e,0,G),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==R(t)?(r=t,t=null):e&&"object"==R(e)?(r=e,e=t=null):r=x;else if("object"!=R(r))throw Error(U+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),i=+r.groupSize,o=+r.secondaryGroupSize,s=r.groupSeparator||"",u=t[0],t=t[1],l=this.s<0,c=l?u.slice(1):u,a=c.length;if(o&&(n=i,i=o,a-=o=n),0<i&&0<a){for(u=c.substr(0,n=a%i||i);n<a;n+=i)u+=s+c.substr(n,i);0<o&&(u+=s+c.slice(n)),l&&(u="-"+u)}e=t?u+(r.decimalSeparator||"")+((o=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):u}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,i,o,s,u,l,c,a,f=this,p=f.c;if(null!=e&&(!(u=new j(e)).isInteger()&&(u.c||1!==u.s)||u.lt(g)))throw Error(U+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+D(u));if(!p)return new j(f);for(t=new j(g),c=r=new j(g),n=l=new j(g),p=V(p),o=t.e=p.length-f.e-1,t.c[0]=Tt[(s=o%M)<0?M+s:s],e=!e||0<u.comparedTo(t)?0<o?t:c:u,s=E,E=1/0,u=new j(p),l.c[0]=0;a=d(u,t,0,1),1!=(i=r.plus(a.times(n))).comparedTo(e);)r=n,n=i,c=l.plus(a.times(i=c)),l=i,t=u.minus(a.times(i=t)),u=i;return i=d(e.minus(r),n,0,1),l=l.plus(i.times(c)),r=r.plus(i.times(n)),l.s=c.s=f.s,p=d(c,n,o*=2,w).minus(f).abs().comparedTo(d(l,r,o,w).minus(f).abs())<1?[c,n]:[l,r],E=s,p},r.toNumber=function(){return+D(this)},r.toPrecision=function(e,t){return null!=e&&H(e,1,G),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?i<=v||b<=i?$t(V(r.c),i):Z(V(r.c),i,"0"):10===e&&S?Z(V((r=F(new j(r),m+i+1,w)).c),r.e,"0"):(H(e,2,A.length,"Base"),f(Z(V(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return D(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&j.set(e),j}();function Ft(e){for(var t=[];0<e.length;){var r=e.shift();if(k(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),i=t.pop();if("string"==typeof n&&!E.isBigNumber(n)){if(!T(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new E(n)}if("string"==typeof i&&!E.isBigNumber(i)){if(!T(i))throw new Error("".concat(i,"不是一个合法的数字"));i=new E(i)}switch(r){case"+":t.push(i.plus(n));break;case"-":t.push(i.minus(n));break;case"*":t.push(i.times(n));break;case"/":t.push(i.div(n));break;case"%":t.push(i.mod(n));break;case"**":t.push(i.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var o=t[0];if((o=E.isBigNumber(o)?o:E(o)).isNaN())throw new Error("计算结果为NaN");return o}function Dt(e,t,r){var n,i,o,s,u,l,c,a,f,p,h,g,v,d,y,m,w,b,_="";return E.isBigNumber(e)?_=e.toFixed():"string"!=typeof e&&(_=e.toString()),"undefined"===_||"NaN"===_?null:(i=n=null,s=o=!1,m=a=c=l=!(u="~-"),t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);i=e.value}else if("to-number"===t)m=!0;else if("comma"===t)o=!0;else if("number"===t)n=e.value;else if("plus"===t)s=!0;else if("round"===t)u=e.value;else if("fraction"===t)c=!0;else if("scientific"===t)l=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");a=!0}}),l?(e=E(_).toExponential(),s&&!e.startsWith("-")?"+"+e:e):c?(t=E(_).toFraction().map(function(e){return e.toFixed()}).join("/"),s&&!t.startsWith("-")?"+"+t:t):(a&&(_=E(_).times(100).toFixed()),n&&(e=_.split("."),t=e[0],e=1===e.length?"":e[1],h=i,g=+n,w=u,v=f=t,y=(d=p=e).length,b={"~-":function(){d=p.slice(0,"<"===h?g-1:g)},"~+":function(){var e,t="<"===h?g-1:g;y<=t||0===y||(e=p.slice(0,t),0!=+p.slice(t,y)&&(e=(+e+1).toString()).length>t?(d=e.slice(1,e.length),v=(+v+1).toString()):d=e)},"~5":function(){var e,t;0===y||(d=p.slice(0,e="<"===h?g-1:g),t=+p[e],Number.isNaN(t))||5<=t&&(d=(+d+1).toString()).length>e&&(d=d.slice(1,d.length),v=(+v+1).toString())},"~6":function(){var e,t,r,n;0!==y&&(t=+p[e="<"===h?g-1:g],r=""===(r=p.slice(+e+1,p.length))?0:parseInt(r),n=0===e?+f[f.length-1]:+p[e-1],d=p.slice(0,e),6<=t||5==t&&0<r||5==t&&n%2!=0)&&(d=(+d+1).toString()).length>e&&(d=d.slice(1,d.length),v=(+v+1).toString())}},"<="===h?d=y<=g?p:(b[w]&&b[w](),d.replace(/0+$/,"")):"<"===h?d=y<g?p:(b[w]&&b[w](),d.replace(/0+$/,"")):"="===h?y<g?d=p+"0".repeat(g-y):g<y&&b[w]&&b[w]():">="===h?y<g&&(d=p+"0".repeat(g-y)):">"===h&&y<=g&&(d=p+"0".repeat(g-y+1)),t=(b={int_part:v,dec_part:d}).int_part,_=""===(e=b.dec_part)?t:"".concat(t,".").concat(e)),o&&(m=!1,_=1<(w=_.split(".")).length?((b=w[0]).includes("-")?w[0]=b[0]+b.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):w[0]=b.replace(/(?=(?!^)(?:\d{3})+$)/g,","),w.join(".")):(t=w[0]).includes("-")?t[0]+t.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),s&&(m=!1,_.startsWith("-")||(_="+"+_)),a&&(m=!1,_+="%"),m&&!r?+_:_))}function It(e,i){return e.map(function(e){if("var"!==e.type)return e;for(var t,r,n=0;n<i.length&&!f(t=d(i[n],e.value));n++);if("number"==typeof(r=t)||T(r))return{type:"number",value:t};throw new Error("错误的填充值")})}function Rt(e){var r=null;return e.length,{tokens:e.map(function(e){var t=function(e){for(var t,r,n=null,i=null,o=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],s=0;s<o.length;s++){var u=e.match(o[s]);if(u){t=u;break}}return t&&(i=t[1],""!==(r=t[2]).trim())&&(n=r),{num:i,unit:n}}(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}s=c;try{var m=s(Object,"defineProperty");m({},"",{})}catch(e){}var Ct=K,Ut=Q;r=function(e){return Ut(e)&&"[object Arguments]"==Ct(e)},l=Object.prototype,l.hasOwnProperty,l.propertyIsEnumerable,r(function(){return arguments}()),s={exports:{}};l=(l=(m=s).exports)&&!l.nodeType&&l,r=(r=l&&m&&!m.nodeType&&m)&&r.exports===l?n.Buffer:void 0,l=r?r.isBuffer:void 0,m.exports=l||function(){return!1};var w,zt,Mt,s={exports:{}},t=(l=(l=(r=s).exports)&&!l.nodeType&&l,w=l&&r&&!r.nodeType&&r,zt=w&&w.exports===l&&t.process,l=function(){try{var e=w&&w.require&&w.require("util").types;return e?e:zt&&zt.binding&&zt.binding("util")}catch(e){}}(),r.exports=l,s.exports),r=(t&&t.isTypedArray,{exports:{}});t=(t=(l=r).exports)&&!t.nodeType&&t,r=(r=t&&l&&!l.nodeType&&l)&&r.exports===t?n.Buffer:void 0,Mt=r?r.allocUnsafe:void 0,l.exports=function(e,t){return t?e.slice():(t=e.length,t=Mt?Mt(t):new e.constructor(t),e.copy(t),t)};var t=c(n,"DataView"),r=g,l=c(n,"Promise"),g=c(n,"Set"),b=c(n,"WeakMap"),Lt=K,_=ge,Gt="[object Map]",qt="[object Promise]",Vt="[object Set]",Wt="[object WeakMap]",Ht="[object DataView]",Zt=_(t),Xt=_(r),Yt=_(l),Jt=_(g),Kt=_(b),O=Lt;(t&&O(new t(new ArrayBuffer(1)))!=Ht||r&&O(new r)!=Gt||l&&O(l.resolve())!=qt||g&&O(new g)!=Vt||b&&O(new b)!=Wt)&&(O=function(e){var t=Lt(e),e="[object Object]"==t?e.constructor:void 0,e=e?_(e):"";if(e)switch(e){case Zt:return Ht;case Xt:return Gt;case Yt:return qt;case Jt:return Vt;case Kt:return Wt}return t}),n.Uint8Array;t=i?i.prototype:void 0,t&&t.valueOf,r=s.exports,r&&r.isMap,l=s.exports,l&&l.isSet,g=s.exports,g&&g.isArrayBuffer,b=s.exports;b&&b.isDate,Function.prototype.toString.call(Object);O=i?i.prototype:void 0;O&&O.valueOf;n.isFinite;t=s.exports;function Qt(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=function(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],i=(f(i=e[1])&&(t.options=i),d(i,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===i)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(R(n)))}r=n.toString()}if(e=r.split("|"),t.expr=e[0],1<e.length){i=e[1];if(""!==i.trim())try{t.fmt=$(i)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var o,n=[];try{n=$(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(o=t.fmt.map(function(e){return e.type}),n.forEach(function(e){o.includes(e.type)||t.fmt.push(e)}))}return t}(t),i=d(n,"options._error",void 0),o=d(n,"options._debug",!1),s=d(n,"options._unit",!1),u=n.options,l=null;if(n.fmt_err||n.expr_err){if(f(i))return i;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(f(i))try{c=Nt(n.expr,s)}catch(e){return i}else c=Nt(n.expr,s);if(o&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),p(u)){var c,a=[];if(Array.isArray(u)?a=u:(a.push(u),f(u=d(u,"_fill_data",{}))&&(Array.isArray(u)?a=[].concat(N(a),N(u)):a.push(u))),f(i))try{c=xt(c,a,s),p(n.fmt)&&(n.fmt=It(n.fmt,a))}catch(e){return i}else c=xt(c,a,s),p(n.fmt)&&(n.fmt=It(n.fmt,a));[!0,"on","auto","space"].includes(s)&&(l=(u=Rt(c)).unit,c=u.tokens)}a=At(c),o&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(a),console.warn("单位:".concat(l))),u=null;if(f(i))try{u=Ft(a)}catch(e){return i}else u=Ft(a);if("Infinity"!==(u=p(n.fmt)?Dt(u,n.fmt,s):null!==u?u.toFixed():null)&&null!==u)return null!==l&&(u+=l),u;if(f(i))return i;throw new Error("计算错误可能是非法的计算式")}t&&t.isRegExp,i&&i.iterator,console.log("%ca-calc:%c ".concat(A," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");r=Qt;return e.calc=Qt,e.fmt=r,e.version=A,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
package/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";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})(e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name: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.")}Object.defineProperty(exports,"__esModule",{value:!0});var version="1.0.29",RegexNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,RegexUnitNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function is_operator(e){return-1<"+-*/%()**".indexOf(e)}function get_prioraty(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function prioraty(e,t){return get_prioraty(e)<=get_prioraty(t)}function not_undefined(e){return void 0!==e}function is_null(e){return null===e}function not_null(e){return null!==e}function is_number(e){return"number"==typeof e||is_str_number(e)}function is_str_number(e){return"string"==typeof e&&!!RegexNumber.test(e)}function split_unit_num(e){for(var t,r,n=null,o=null,i=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],a=0;a<i.length;a++){var s=e.match(i[a]);if(s){t=s;break}}return t&&(o=t[1],""!==(r=t[2]).trim())&&(n=r),{num:o,unit:n}}var state$1={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",scientific:"scientific"},symbol="<>=";function fmt_tokenizer(e){for(var t=state$1.initial,r=[],n=[];e;){var o=e[0];if(t===state$1.initial)if(symbol.includes(o))t=state$1.symbol,r.push(o),e=e.slice(1);else if("~"===o)t=state$1.round,r.push(o),e=e.slice(1);else if("\\"===o&&/[Ee]/.test(e[1]))t=state$1.initial,n.push({type:"scientific",value:e[1]}),e=e.slice(2);else{if("/"===o)t=state$1.initial,n.push({type:"fraction",value:o});else if(/[a-zA-Z_]/.test(o))t=state$1.variable,r.push(o);else if(/\d/.test(o))t=state$1.number,r.push(o);else if("+"===o)t=state$1.initial,n.push({type:"plus",value:o});else if(","===o)t=state$1.initial,n.push({type:"comma",value:o});else if("%"===o)t=state$1.initial,n.push({type:"percent",value:o});else if(!/\s/.test(o))throw new Error("不识别的fmt字符:".concat(o));e=e.slice(1)}else if(t===state$1.number)/\d/.test(o)?(r.push(o),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.variable)/[\$\w_\-.\[\]"']/.test(o)?(r.push(o),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.symbol)/\s/.test(o)?e=e.slice(1):symbol.includes(o)?(r.push(o),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=state$1.initial);else{if(t!==state$1.round)throw new Error("错误的自动机状态");if(/\s/.test(o))e=e.slice(1);else{if(!("56+-".includes(o)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(o));r.push(o),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=state$1.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=state$1.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},isArray$3=Array.isArray,isArray_1=isArray$3,freeGlobal$1="object"==_typeof(commonjsGlobal)&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root$9=freeGlobal||freeSelf||Function("return this")(),_root=root$9,root$8=_root,_Symbol2=_root.Symbol,_Symbol$6=_Symbol2,_Symbol$5=_Symbol$6,objectProto$5=Object.prototype,hasOwnProperty$4=objectProto$5.hasOwnProperty,nativeObjectToString$1=objectProto$5.toString,symToStringTag$1=_Symbol$5?_Symbol$5.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty$4.call(e,symToStringTag$1),r=e[symToStringTag$1];try{var n=!(e[symToStringTag$1]=void 0)}catch(e){}var o=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),o}var _getRawTag=getRawTag$1,objectProto$4=Object.prototype,nativeObjectToString=objectProto$4.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1,_Symbol$4=_Symbol$6,getRawTag=_getRawTag,objectToString=objectToString$1,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$6?_Symbol$6.toStringTag:void 0;function baseGetTag$4(e){return null==e?void 0===e?undefinedTag:nullTag:(symToStringTag&&symToStringTag in Object(e)?getRawTag:objectToString)(e)}var _baseGetTag=baseGetTag$4;function isObjectLike$3(e){return null!=e&&"object"==_typeof(e)}var isObjectLike_1=isObjectLike$3,baseGetTag$3=_baseGetTag,isObjectLike$2=isObjectLike_1,symbolTag="[object Symbol]";function isSymbol$3(e){return"symbol"==_typeof(e)||isObjectLike$2(e)&&baseGetTag$3(e)==symbolTag}var isSymbol_1=isSymbol$3,isArray$2=isArray_1,isSymbol$2=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$1(e,t){var r;return!isArray$2(e)&&(!("number"!=(r=_typeof(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol$2(e))||reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey$1;function isObject$2(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$2,baseGetTag$2=_baseGetTag,isObject$1=isObject_1,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(e){return!!isObject$1(e)&&((e=baseGetTag$2(e))==funcTag||e==genTag||e==asyncTag||e==proxyTag)}var isFunction_1=isFunction$1,root$7=_root,coreJsData$1=_root["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=coreJsData$1,maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1,funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource$2(e){if(null!=e){try{return funcToString$2.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$2,isFunction=isFunction_1,isMasked=_isMasked,isObject=isObject_1,toSource$1=_toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$3=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$3=objectProto$3.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$3).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource$1(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,t){return null==e?void 0:e[t]}var _getValue=getValue$1,baseIsNative=baseIsNative$1,getValue=getValue$1;function getNative$7(e,t){e=getValue(e,t);return baseIsNative(e)?e:void 0}var _getNative=getNative$7,getNative$6=_getNative,nativeCreate$4=_getNative(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){e=this.has(e)&&delete this.__data__[e];return this.size-=e?1:0,e}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$2=Object.prototype,hasOwnProperty$2=objectProto$2.hasOwnProperty;function hashGet$1(e){var t,r=this.__data__;return nativeCreate$2?(t=r[e])===HASH_UNDEFINED$1?void 0:t:hasOwnProperty$2.call(r,e)?r[e]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashHas$1(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty$1.call(t,e)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=hashHas$1,hashSet=hashSet$1;function Hash$1(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])}}Hash$1.prototype.clear=hashClear,Hash$1.prototype.delete=hashDelete,Hash$1.prototype.get=hashGet,Hash$1.prototype.has=hashHas,Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$1(e,t){return e===t||e!=e&&t!=t}var eq_1=eq$1,eq=eq$1;function assocIndexOf$4(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(e){var t=this.__data__,e=assocIndexOf$3(t,e);return!(e<0||(e==t.length-1?t.pop():splice.call(t,e,1),--this.size,0))}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var t=this.__data__,e=assocIndexOf$2(t,e);return e<0?void 0:t[e][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return-1<assocIndexOf$1(this.__data__,e)}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=listCacheDelete$1,listCacheGet=listCacheGet$1,listCacheHas=listCacheHas$1,listCacheSet=listCacheSet$1;function ListCache$1(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$1.prototype.clear=listCacheClear,ListCache$1.prototype.delete=listCacheDelete,ListCache$1.prototype.get=listCacheGet,ListCache$1.prototype.has=listCacheHas,ListCache$1.prototype.set=listCacheSet;var _ListCache=ListCache$1,getNative$5=_getNative,root$6=_root,Map$2=_getNative(_root,"Map"),_Map=Map$2,Hash=_Hash,ListCache=_ListCache,Map$1=_Map;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable$1,isKeyable=isKeyable$1;function getMapData$4(e,t){e=e.__data__;return isKeyable(t)?e["string"==typeof t?"string":"hash"]:e.map}var _getMapData=getMapData$4,getMapData$3=getMapData$4;function mapCacheDelete$1(e){e=getMapData$3(this,e).delete(e);return this.size-=e?1:0,e}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=getMapData$4;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1,getMapData$1=getMapData$4;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1,getMapData=getMapData$4;function mapCacheSet$1(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=mapCacheClear$1,mapCacheDelete=mapCacheDelete$1,mapCacheGet=mapCacheGet$1,mapCacheHas=mapCacheHas$1,mapCacheSet=mapCacheSet$1;function MapCache$1(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$1.prototype.clear=mapCacheClear,MapCache$1.prototype.delete=mapCacheDelete,MapCache$1.prototype.get=mapCacheGet,MapCache$1.prototype.has=mapCacheHas,MapCache$1.prototype.set=mapCacheSet;var _MapCache=MapCache$1,MapCache=MapCache$1,FUNC_ERROR_TEXT="Expected a function";function memoize$1(n,o){if("function"!=typeof n||null!=o&&"function"!=typeof o)throw new TypeError(FUNC_ERROR_TEXT);function i(){var e=arguments,t=o?o.apply(this,e):e[0],r=i.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),i.cache=r.set(t,e)||r,e)}return i.cache=new(memoize$1.Cache||MapCache),i}memoize$1.Cache=MapCache;var memoize_1=memoize$1,memoize=memoize$1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(e){var e=memoize(e,function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e}),t=e.cache;return e}var _memoizeCapped=memoizeCapped$1,memoizeCapped=memoizeCapped$1,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath$1=memoizeCapped$1(function(e){var o=[];return 46===e.charCodeAt(0)&&o.push(""),e.replace(rePropName,function(e,t,r,n){o.push(r?n.replace(reEscapeChar,"$1"):t||e)}),o}),_stringToPath=stringToPath$1;function arrayMap$1(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}var _arrayMap=arrayMap$1,_Symbol$3=_Symbol$6,arrayMap=arrayMap$1,isArray$1=isArray_1,isSymbol$1=isSymbol_1,INFINITY$1=1/0,symbolProto$2=_Symbol$6?_Symbol$6.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString$1(e){var t;return"string"==typeof e?e:isArray$1(e)?arrayMap(e,baseToString$1)+"":isSymbol$1(e)?symbolToString?symbolToString.call(e):"":"0"==(t=e+"")&&1/e==-INFINITY$1?"-0":t}var _baseToString=baseToString$1,baseToString=baseToString$1;function toString$1(e){return null==e?"":baseToString(e)}var toString_1=toString$1,isArray=isArray_1,isKey=_isKey,stringToPath=_stringToPath,toString=toString$1;function castPath$1(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}var _castPath=castPath$1,isSymbol=isSymbol_1,INFINITY=1/0;function toKey$1(e){var t;return"string"==typeof e||isSymbol(e)?e:"0"==(t=e+"")&&1/e==-INFINITY?"-0":t}var _toKey=toKey$1,castPath=castPath$1,toKey=toKey$1;function baseGet$1(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}var _baseGet=baseGet$1,baseGet=baseGet$1;function get(e,t,r){e=null==e?void 0:baseGet(e,t);return void 0===e?r:e}var get_1=get;function parse_args(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],o=e[1],o=(not_undefined(o)&&(t.options=o),get_1(o,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===o)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(_typeof(n)))}r=n.toString()}e=r.split("|");if(t.expr=e[0],1<e.length){o=e[1];if(""!==o.trim())try{t.fmt=fmt_tokenizer(o)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var i,n=[];try{n=fmt_tokenizer(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(i=t.fmt.map(function(e){return e.type}),n.forEach(function(e){i.includes(e.type)||t.fmt.push(e)}))}return t}var state={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},signed="+-",operator="*/%",brackets="()";function tokenizer(e){for(var t,r,n,o=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=state.initial,a=[],s=[],l=function(){a.push(t),e=e.slice(1)},c=function(e){s.push({type:e,value:a.join("")}),a.length=0},u=function(){e=e.slice(1)};e;)switch(t=e[0],i){case state.initial:if(signed.includes(t)){var f=s.at(-1),i=0===s.length||"operator"===f.type||"("===f?state.number:state.operator;l()}else if(operator.includes(t))i=state.operator,l();else if(/\d/.test(t))i=state.number,l();else if(brackets.includes(t))i=state.bracket;else if(/[a-zA-Z_$]/.test(t))i=state.var,l();else{if(!/\s/.test(t))throw new Error("不识别的字符".concat(t));u()}break;case state.bracket:s.push({type:state.bracket,value:t}),u(),i=state.initial;break;case state.operator:f=a.at(-1);"*"===t&&"*"===f&&l(),c(state.operator),i=state.initial;break;case state.number:if(/\d/.test(t))l();else if("."===t){if(0===a.length||a.includes("."))throw new Error("非法的小数部分".concat(a.join("")));l()}else"Ee".includes(t)?(i=state.scientific,l()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(t)||"space"===o&&/\S/.test(t)?l():(c(state.number),i=state.initial);break;case state.scientific:/\d/.test(t)?l():signed.includes(t)?(r=a.slice(1),n=a.at(-1),r.includes(t)||!/[Ee]/.test(n)?(c(state.scientific),i=state.initial):l()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(t)||"space"===o&&/\S/.test(t)?l():(c(state.scientific),i=state.initial);break;case state.var:/[\w_.\[\]"']/.test(t)?l():(c(state.var),i=state.initial);break;default:throw new Error("状态错误")}return 0!==a.length&&(s.push({type:i,value:a.join("")}),a.length=0,i=state.initial),s}function fill_tokens(e,t,r){if(is_null(t))throw new Error("错误的填充数据:",t);for(var n=[],o=0;o<e.length;o++){var i=e[o];if("var"!==i.type)n.push(i);else{if("undefined"===i.value||"NaN"===i.value)throw new Error("key不应该为:".concat(i.value));for(var a=null,s=0;s<t.length;s++){var l=t[s],l=get_1(l,i.value);if(void 0!==l){a=l;break}}if(null===a)throw new Error("token填充失败,请确认".concat(i,"存在"));if("string"==typeof a){if(""===a.trim())throw new Error("token填充失败,".concat(i.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!RegexUnitNumber.test(a))throw new Error("token填充失败,".concat(i.value,"值:").concat(a,"为非法单位数字"))}else if(!is_str_number(a))throw new Error("token填充失败,".concat(i,"值:").concat(a,"为非法数字"))}a="string"!=typeof a?a.toString():a,n.push({type:"number",value:a})}}return n}function token2postfix(e){for(var t=[],r=[],n=e.map(function(e){return e.value});0<n.length;){var o=n.shift();if(is_operator(o))if("("===o)t.push(o);else if(")"===o){for(var i=t.pop();"("!==i&&0<t.length;)r.push(i),i=t.pop();if("("!==i)throw"error: unmatched ()"}else{for(;prioraty(o,t[t.length-1])&&0<t.length;)r.push(t.pop());t.push(o)}else r.push(o)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)r.push(t.pop())}return r}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 m,f,h,t,c,b,a,s,l,u,p,r=O.prototype={constructor:O,toString:null,valueOf:null},g=new O(1),y=20,$=4,_=-7,d=21,v=-1e7,S=1e7,w=!1,o=1,E=0,A={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},C="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function O(e,t){var r,n,o,i,a,s,l,c,u=this;if(!(u instanceof O))return new O(e,t);if(null==t){if(e&&!0===e._isBigNumber)return u.s=e.s,void(!e.c||e.e>S?u.c=u.e=null:e.e<v?u.c=[u.e=0]:(u.e=e.e,u.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(u.s=1/e<0?(e=-e,-1):1,e===~~e){for(i=0,a=e;10<=a;a/=10,i++);return void(S<i?u.c=u.e=null:(u.e=i,u.c=[e]))}c=String(e)}else{if(!isNumeric.test(c=String(e)))return h(u,c,s);u.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(a=(c=-1<(i=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(i<0&&(i=a),i+=+c.slice(a+1),c=c.substring(0,a)):i<0&&(i=c.length)}else{if(intCheck(t,2,C.length,"Base"),10==t&&T)return G(u=new O(e),y+u.e+1,$);if(c=String(e),s="number"==typeof e){if(0*e!=0)return h(u,c,s,t);if(u.s=1/e<0?(c=c.slice(1),-1):1,O.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(tooManyDigits+e)}else u.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=C.slice(0,t),i=a=0,l=c.length;a<l;a++)if(r.indexOf(n=c.charAt(a))<0){if("."==n){if(i<a){i=l;continue}}else if(!o&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){o=!0,a=-1,i=0;continue}return h(u,String(e),s,t)}s=!1,-1<(i=(c=f(c,t,10,u.s)).indexOf("."))?c=c.replace(".",""):i=c.length}for(a=0;48===c.charCodeAt(a);a++);for(l=c.length;48===c.charCodeAt(--l););if(c=c.slice(a,++l)){if(l-=a,s&&O.DEBUG&&15<l&&(MAX_SAFE_INTEGER<e||e!==mathfloor(e)))throw Error(tooManyDigits+u.s*e);if((i=i-a-1)>S)u.c=u.e=null;else if(i<v)u.c=[u.e=0];else{if(u.e=i,u.c=[],a=(i+1)%LOG_BASE,i<0&&(a+=LOG_BASE),a<l){for(a&&u.c.push(+c.slice(0,a)),l-=LOG_BASE;a<l;)u.c.push(+c.slice(a,a+=LOG_BASE));a=LOG_BASE-(c=c.slice(a)).length}else a-=l;for(;a--;c+="0");u.c.push(+c)}}else u.c=[u.e=0]}function N(e,t,r,n){for(var o,i,a=[0],s=0,l=e.length;s<l;){for(i=a.length;i--;a[i]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),o=0;o<a.length;o++)r-1<a[o]&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/r|0,a[o]%=r)}return a.reverse()}function k(e,t,r){var n,o,i,a=0,s=e.length,l=t%SQRT_BASE,c=t/SQRT_BASE|0;for(e=e.slice();s--;)a=((o=l*(i=e[s]%SQRT_BASE)+(n=c*i+(i=e[s]/SQRT_BASE|0)*l)%SQRT_BASE*SQRT_BASE+a)/r|0)+(n/SQRT_BASE|0)+c*i,e[s]=o%r;return e=a?[a].concat(e):e}function M(e,t,r,n){var o,i;if(r!=n)i=n<r?1:-1;else for(o=i=0;o<r;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function x(e,t,r,n){for(var o=0;r--;)e[r]-=o,o=e[r]<t[r]?1:0,e[r]=o*n+e[r]-t[r];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var o,i,a,s;if(null==r?r=$:intCheck(r,0,8),!e.c)return e.toString();if(o=e.c[0],i=e.e,null==t)s=coeffToString(e.c),s=1==n||2==n&&(i<=_||d<=i)?toExponential(s,i):toFixedPoint(s,i,"0");else if(r=(e=G(new O(e),t,r)).e,a=(s=coeffToString(e.c)).length,1==n||2==n&&(t<=r||r<=_)){for(;a<t;s+="0",a++);s=toExponential(s,r)}else if(t-=i,s=toFixedPoint(s,r,"0"),a<r+1){if(0<--t)for(s+=".";t--;s+="0");}else if(0<(t+=r-a))for(r+1==a&&(s+=".");t--;s+="0");return e.s<0&&o?"-"+s:s}function i(e,t){for(var r,n=1,o=new O(e[0]);n<e.length;n++){if(!(r=new O(e[n])).s){o=r;break}t.call(o,r)&&(o=r)}return o}function P(e,t,r){for(var n=1,o=t.length;!t[--o];t.pop());for(o=t[0];10<=o;o/=10,n++);return(r=n+r*LOG_BASE-1)>S?e.c=e.e=null:r<v?e.c=[e.e=0]:(e.e=r,e.c=t),e}function G(e,t,r,n){var o,i,a,s,l,c,u,f=e.c,h=POWS_TEN;if(f){e:{for(o=1,s=f[0];10<=s;s/=10,o++);if((i=t-o)<0)i+=LOG_BASE,a=t,u=(l=f[c=0])/h[o-a-1]%10|0;else if((c=mathceil((i+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=u=0,a=(i%=LOG_BASE)-LOG_BASE+(o=1)}else{for(l=s=f[c],o=1;10<=s;s/=10,o++);u=(a=(i%=LOG_BASE)-LOG_BASE+o)<0?0:l/h[o-a-1]%10|0}if(n=n||t<0||null!=f[c+1]||(a<0?l:l%h[o-a-1]),n=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):5<u||5==u&&(4==r||n||6==r&&(0<i?0<a?l/h[o-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]=h[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):f[0]=e.e=0,e;if(0==i?(f.length=c,s=1,c--):(f.length=c+1,s=h[LOG_BASE-i],f[c]=0<a?mathfloor(l/h[o-a]%h[a])*s:0),n)for(;;){if(0==c){for(i=1,a=f[0];10<=a;a/=10,i++);for(a=f[0]+=s,s=1;10<=a;a/=10,s++);i!=s&&(e.e++,f[0]==BASE)&&(f[0]=1);break}if(f[c]+=s,f[c]!=BASE)break;f[c--]=0,s=1}for(i=f.length;0===f[--i];f.pop());}e.e>S?e.c=e.e=null:e.e<v&&(e.c=[e.e=0])}return e}function B(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=_||d<=r?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return O.clone=clone,O.ROUND_UP=0,O.ROUND_DOWN=1,O.ROUND_CEIL=2,O.ROUND_FLOOR=3,O.ROUND_HALF_UP=4,O.ROUND_HALF_DOWN=5,O.ROUND_HALF_EVEN=6,O.ROUND_HALF_CEIL=7,O.ROUND_HALF_FLOOR=8,O.EUCLID=9,O.config=O.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),y=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),_=r[0],d=r[1]):(intCheck(r,-MAX,MAX,t),_=-(d=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),v=r[0],S=r[1];else{if(intCheck(r,-MAX,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);v=-(S=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&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw w=!r,Error(bignumberError+"crypto unavailable");w=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),o=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),E=r),e.hasOwnProperty(t="FORMAT")){if("object"!=_typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);A=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);T="0123456789"==r.slice(0,10),C=r}}return{DECIMAL_PLACES:y,ROUNDING_MODE:$,EXPONENTIAL_AT:[_,d],RANGE:[v,S],CRYPTO:w,MODULO_MODE:o,POW_PRECISION:E,FORMAT:A,ALPHABET:C}},O.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!O.DEBUG)return!0;var t,r,n=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===i||-1===i)&&-MAX<=o&&o<=MAX&&o===mathfloor(o))if(0===n[0]){if(0===o&&1===n.length)return!0}else if((t=(o+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||BASE<=r||r!==mathfloor(r))break e;if(0!==r)return!0}}else if(null===n&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},O.maximum=O.max=function(){return i(arguments,r.lt)},O.minimum=O.min=function(){return i(arguments,r.gt)},O.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return mathfloor(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,o,i,a=0,s=[],l=new O(g);if(null==e?e=y:intCheck(e,0,MAX),o=mathceil(e/LOG_BASE),w)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));a<o;)9e15<=(i=131072*t[a]+(t[a+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(s.push(i%1e14),a+=2);a=o/2}else{if(!crypto.randomBytes)throw w=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(o*=7);a<o;)9e15<=(i=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])?crypto.randomBytes(7).copy(t,a):(s.push(i%1e14),a+=7);a=o/7}if(!w)for(;a<o;)(i=c())<9e15&&(s[a++]=i%1e14);for(o=s[--a],e%=LOG_BASE,o&&e&&(i=POWS_TEN[LOG_BASE-e],s[a]=mathfloor(o/i)*i);0===s[a];s.pop(),a--);if(a<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(a=1,i=s[0];10<=i;i/=10,a++);a<LOG_BASE&&(n-=LOG_BASE-a)}return l.e=n,l.c=s,l}),O.sum=function(){for(var e=1,t=arguments,r=new O(t[0]);e<t.length;)r=r.plus(t[e++]);return r},b="0123456789",f=function(e,t,r,n,o){var i,a,s,l,c,u,f,h,p=e.indexOf("."),g=y,_=$;for(0<=p&&(l=E,E=0,e=e.replace(".",""),u=(h=new O(t)).pow(e.length-p),E=l,h.c=N(toFixedPoint(coeffToString(u.c),u.e,"0"),10,r,b),h.e=h.c.length),s=l=(f=N(e,t,r,o?(i=C,b):(i=b,C))).length;0==f[--l];f.pop());if(!f[0])return i.charAt(0);if(p<0?--s:(u.c=f,u.e=s,u.s=n,f=(u=m(u,h,g,_,r)).c,c=u.r,s=u.e),p=f[a=s+g+1],l=r/2,c=c||a<0||null!=f[a+1],c=_<4?(null!=p||c)&&(0==_||_==(u.s<0?3:2)):l<p||p==l&&(4==_||c||6==_&&1&f[a-1]||_==(u.s<0?8:7)),a<1||!f[0])e=c?toFixedPoint(i.charAt(1),-g,i.charAt(0)):i.charAt(0);else{if(f.length=a,c)for(--r;++f[--a]>r;)f[a]=0,a||(++s,f=[1].concat(f));for(l=f.length;!f[--l];);for(p=0,e="";p<=l;e+=i.charAt(f[p++]));e=toFixedPoint(e,s,i.charAt(0))}return e},m=function(e,t,r,n,o){var i,a,s,l,c,u,f,h,p,g,_,m,b,y,$,d,v,S=e.s==t.s?1:-1,w=e.c,E=t.c;if(!(w&&w[0]&&E&&E[0]))return new O(e.s&&t.s&&(w?!E||w[0]!=E[0]:E)?w&&0==w[0]||!E?0*S:S/0:NaN);for(p=(h=new O(S)).c=[],S=r+(a=e.e-t.e)+1,o||(o=BASE,a=bitFloor(e.e/LOG_BASE)-bitFloor(t.e/LOG_BASE),S=S/LOG_BASE|0),s=0;E[s]==(w[s]||0);s++);if(E[s]>(w[s]||0)&&a--,S<0)p.push(1),l=!0;else{for(y=w.length,d=E.length,S+=2,1<(c=mathfloor(o/(E[s=0]+1)))&&(E=k(E,c,o),w=k(w,c,o),d=E.length,y=w.length),b=d,_=(g=w.slice(0,d)).length;_<d;g[_++]=0);v=E.slice(),v=[0].concat(v),$=E[0],E[1]>=o/2&&$++;do{if(c=0,(i=M(E,g,d,_))<0){if(m=g[0],d!=_&&(m=m*o+(g[1]||0)),1<(c=mathfloor(m/$)))for(f=(u=k(E,c=o<=c?o-1:c,o)).length,_=g.length;1==M(u,g,f,_);)c--,x(u,d<f?v:E,f,o),f=u.length,i=1;else 0==c&&(i=c=1),f=(u=E.slice()).length;if(x(g,u=f<_?[0].concat(u):u,_,o),_=g.length,-1==i)for(;M(E,g,d,_)<1;)c++,x(g,d<_?v:E,_,o),_=g.length}else 0===i&&(c++,g=[0])}while(p[s++]=c,g[0]?g[_++]=w[b]||0:(g=[w[b]],_=1),(b++<y||null!=g[0])&&S--);l=null!=g[0],p[0]||p.splice(0,1)}if(o==BASE){for(s=1,S=p[0];10<=S;S/=10,s++);G(h,r+(h.e=s+a*LOG_BASE-1)+1,n,l)}else h.e=a,h.r=+l;return h},a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,s=/^([^.]+)\.$/,l=/^\.([^.]+)$/,u=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var o,i=r?t:t.replace(p,"");if(u.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!r&&(i=i.replace(a,function(e,t,r){return o="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=o?e:t}),n&&(o=n,i=i.replace(s,"$1").replace(l,"0.$1")),t!=i))return new O(i,o);if(O.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new O(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return compare(this,new O(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return intCheck(e,0,MAX),null==t?t=$:intCheck(t,0,8),G(new O(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return m(this,new O(e,t),y,$)},r.dividedToIntegerBy=r.idiv=function(e,t){return m(this,new O(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,o,i,a,s,l,c,u=this;if((e=new O(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+B(e));if(null!=t&&(t=new O(t)),a=14<e.e,!u.c||!u.c[0]||1==u.c[0]&&!u.e&&1==u.c.length||!e.c||!e.c[0])return c=new O(Math.pow(+B(u),a?e.s*(2-isOdd(e)):+B(e))),t?c.mod(t):c;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new O(NaN);(n=!s&&u.isInteger()&&t.isInteger())&&(u=u.mod(t))}else{if(9<e.e&&(0<u.e||u.e<-1||(0==u.e?1<u.c[0]||a&&24e7<=u.c[1]:u.c[0]<8e13||a&&u.c[0]<=9999975e7)))return i=u.s<0&&isOdd(e)?-0:0,-1<u.e&&(i=1/i),new O(s?1/i:i);E&&(i=mathceil(E/LOG_BASE+2))}for(l=a?(r=new O(.5),s&&(e.s=1),isOdd(e)):(o=Math.abs(+B(e)))%2,c=new O(g);;){if(l){if(!(c=c.times(u)).c)break;i?c.c.length>i&&(c.c.length=i):n&&(c=c.mod(t))}if(o){if(0===(o=mathfloor(o/2)))break;l=o%2}else if(G(e=e.times(r),e.e+1,1),14<e.e)l=isOdd(e);else{if(0===(o=+B(e)))break;l=o%2}u=u.times(u),i?u.c&&u.c.length>i&&(u.c.length=i):n&&(u=u.mod(t))}return n?c:(s&&(c=g.div(c)),t?c.mod(t):i?G(c,E,$,void 0):c)},r.integerValue=function(e){var t=new O(this);return null==e?e=$:intCheck(e,0,8),G(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===compare(this,new O(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<compare(this,new O(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=compare(this,new O(e,t)))||0===t},r.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return compare(this,new O(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=compare(this,new O(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,o,i,a=this,s=a.s;if(t=(e=new O(e,t)).s,!s||!t)return new O(NaN);if(s!=t)return e.s=-t,a.plus(e);var l=a.e/LOG_BASE,c=e.e/LOG_BASE,u=a.c,f=e.c;if(!l||!c){if(!u||!f)return u?(e.s=-t,e):new O(f?a:NaN);if(!u[0]||!f[0])return f[0]?(e.s=-t,e):new O(u[0]?a:3==$?-0:0)}if(l=bitFloor(l),c=bitFloor(c),u=u.slice(),s=l-c){for((o=(i=s<0)?(s=-s,u):(c=l,f)).reverse(),t=s;t--;o.push(0));o.reverse()}else for(n=(i=(s=u.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(u[t]!=f[t]){i=u[t]<f[t];break}if(i&&(o=u,u=f,f=o,e.s=-e.s),0<(t=(n=f.length)-(r=u.length)))for(;t--;u[r++]=0);for(t=BASE-1;s<n;){if(u[--n]<f[n]){for(r=n;r&&!u[--r];u[r]=t);--u[r],u[n]+=BASE}u[n]-=f[n]}for(;0==u[0];u.splice(0,1),--c);return u[0]?P(e,u,c):(e.s=3==$?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new O(e,t),!n.c||!e.s||e.c&&!e.c[0]?new O(NaN):!e.c||n.c&&!n.c[0]?new O(n):(9==o?(t=e.s,e.s=1,r=m(n,e,0,3),e.s=t,r.s*=t):r=m(n,e,0,o),(e=n.minus(r.times(e))).c[0]||1!=o||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,o,i,a,s,l,c,u,f,h,p,g,_=this,m=_.c,b=(e=new O(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!_.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=_.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=bitFloor(_.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=_.s,(s=m.length)<(_=b.length)&&(h=m,m=b,b=h,n=s,s=_,_=n),n=s+_,h=[];n--;h.push(0));for(p=BASE,g=SQRT_BASE,n=_;0<=--n;){for(u=b[n]%g,f=b[n]/g|(r=0),o=n+(i=s);n<o;)r=((l=u*(l=m[--i]%g)+(a=f*l+(c=m[i]/g|0)*u)%g*g+h[o]+r)/p|0)+(a/g|0)+f*c,h[o--]=l%p;h[o]=r}return r?++t:h.splice(0,1),P(e,h,t)},r.negated=function(){var e=new O(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,o=n.s;if(t=(e=new O(e,t)).s,!o||!t)return new O(NaN);if(o!=t)return e.s=-t,n.minus(e);var i=n.e/LOG_BASE,a=e.e/LOG_BASE,s=n.c,l=e.c;if(!i||!a){if(!s||!l)return new O(o/0);if(!s[0]||!l[0])return l[0]?e:new O(s[0]?n:0*o)}if(i=bitFloor(i),a=bitFloor(a),s=s.slice(),o=i-a){for((r=0<o?(a=i,l):(o=-o,s)).reverse();o--;r.push(0));r.reverse()}for((o=s.length)-(t=l.length)<0&&(r=l,l=s,s=r,t=o),o=0;t;)o=(s[--t]=s[t]+l[t]+o)/BASE|0,s[t]=BASE===s[t]?0:s[t]%BASE;return o&&(s=[o].concat(s),++a),P(e,s,a)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=$:intCheck(t,0,8),G(new O(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*LOG_BASE+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,o,i=this,a=i.c,s=i.s,l=i.e,c=y+4,u=new O("0.5");if(1!==s||!a||!a[0])return new O(!s||s<0&&(!a||a[0])?NaN:a?i:1/0);if((r=0==(s=Math.sqrt(+B(i)))||s==1/0?(((t=coeffToString(a)).length+l)%2==0&&(t+="0"),s=Math.sqrt(+t),l=bitFloor((l+1)/2)-(l<0||l%2),new O(t=s==1/0?"5e"+l:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+l)):new O(s+"")).c[0])for((s=(l=r.e)+c)<3&&(s=0);;)if(o=r,r=u.times(o.plus(m(i,o,c,1))),coeffToString(o.c).slice(0,s)===(t=coeffToString(r.c)).slice(0,s)){if(r.e<l&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(G(r,r.e+y+2,1),e=!r.times(r).eq(i));break}if(!n&&(G(o,o.e+y+2,0),o.times(o).eq(i))){r=o;break}c+=4,s+=4,n=1}return G(r,r.e+y+1,$,e)},r.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==_typeof(t)?(r=t,t=null):e&&"object"==_typeof(e)?(r=e,e=t=null):r=A;else if("object"!=_typeof(r))throw Error(bignumberError+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),o=+r.groupSize,i=+r.secondaryGroupSize,a=r.groupSeparator||"",s=t[0],t=t[1],l=this.s<0,c=l?s.slice(1):s,u=c.length;if(i&&(n=o,o=i,u-=i=n),0<o&&0<u){for(s=c.substr(0,n=u%o||o);n<u;n+=o)s+=a+c.substr(n,o);0<i&&(s+=a+c.slice(n)),l&&(s="-"+s)}e=t?s+(r.decimalSeparator||"")+((i=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+i+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):s}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,o,i,a,s,l,c,u,f=this,h=f.c;if(null!=e&&(!(s=new O(e)).isInteger()&&(s.c||1!==s.s)||s.lt(g)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+B(s));if(!h)return new O(f);for(t=new O(g),c=r=new O(g),n=l=new O(g),h=coeffToString(h),i=t.e=h.length-f.e-1,t.c[0]=POWS_TEN[(a=i%LOG_BASE)<0?LOG_BASE+a:a],e=!e||0<s.comparedTo(t)?0<i?t:c:s,a=S,S=1/0,s=new O(h),l.c[0]=0;u=m(s,t,0,1),1!=(o=r.plus(u.times(n))).comparedTo(e);)r=n,n=o,c=l.plus(u.times(o=c)),l=o,t=s.minus(u.times(o=t)),s=o;return o=m(e.minus(r),n,0,1),l=l.plus(o.times(c)),r=r.plus(o.times(n)),l.s=c.s=f.s,h=m(c,n,i*=2,$).minus(f).abs().comparedTo(m(l,r,i,$).minus(f).abs())<1?[c,n]:[l,r],S=a,h},r.toNumber=function(){return+B(this)},r.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,o=r.e;return null===o?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?o<=_||d<=o?toExponential(coeffToString(r.c),o):toFixedPoint(coeffToString(r.c),o,"0"):10===e&&T?toFixedPoint(coeffToString((r=G(new O(r),y+o+1,$)).c),r.e,"0"):(intCheck(e,2,C.length,"Base"),f(toFixedPoint(coeffToString(r.c),o,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return B(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&O.set(e),O}function bitFloor(e){var t=0|e;return 0<e||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,o=e.length,i=e[0]+"";n<o;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function compare(e,t){var r,n,o=e.c,i=t.c,a=e.s,s=t.s,e=e.e,t=t.e;if(!a||!s)return null;if(r=o&&!o[0],n=i&&!i[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=e==t,!o||!i)return n?0:!o^r?1:-1;if(!n)return t<e^r?1:-1;for(s=(e=o.length)<(t=i.length)?e:t,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^r?1:-1;return e==t?0:t<e^r?1:-1}function intCheck(e,t,r,n){if(e<t||r<e||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||r<e?" 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(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,o;if(t<0){for(o=r+".";++t;o+=r);e=o+e}else if(++t>(n=e.length)){for(o=r,t-=n;--t;o+=r);e+=o}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();function eval_postfix(e){for(var t=[];0<e.length;){var r=e.shift();if(is_operator(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),o=t.pop();if("string"==typeof n&&!BigNumber.isBigNumber(n)){if(!is_str_number(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new BigNumber(n)}if("string"==typeof o&&!BigNumber.isBigNumber(o)){if(!is_str_number(o))throw new Error("".concat(o,"不是一个合法的数字"));o=new BigNumber(o)}switch(r){case"+":t.push(o.plus(n));break;case"-":t.push(o.minus(n));break;case"*":t.push(o.times(n));break;case"/":t.push(o.div(n));break;case"%":t.push(o.mod(n));break;case"**":t.push(o.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var i=t[0];if((i=BigNumber.isBigNumber(i)?i:BigNumber(i)).isNaN())throw new Error("计算结果为NaN");return i}function decimal_round(n,o,e,i,t){var a=n,s=o,r=o.length,l={"~-":function(){s=o.slice(0,i)},"~+":function(){""===(s=o.slice(0,i))?a=n.slice(0,n.length-1)+(+n[n.length-1]+1):s=s.slice(0,i-1)+(+s[i-1]+1)},"~5":function(){s=o.slice(0,i);var e=+o[i];""===s?5<=e&&(a=n.slice(0,n.length-1)+(+n[n.length-1]+1)):5<=e&&(s=s.slice(0,i-1)+(+s[i-1]+1))},"~6":function(){s=o.slice(0,i);var e=""===(e=o.slice(+i+1,o.length))?0:parseInt(e),t=+o[i],r=+n[n.length-1];""===s?(6<=t||5==t&&0<e||5==t&&r%2!=0)&&(a=n.slice(0,n.length-1)+(+n[n.length-1]+1)):(r=+o[i-1],(6<=t||5==t&&0<e||5==t&&r%2!=0)&&(s=s.slice(0,i-1)+(+s[i-1]+1)))}};return"<="===e?s=r<=i?o:(l[t]&&l[t](),s.replace(/0+$/,"")):"="===e?r<i?s=o+"0".repeat(i-r):i<r&&l[t]&&l[t]():">="===e&&r<i&&(s=o+"0".repeat(i-r)),{int_part:a,dec_part:s}}function format(e,t){var r,n,o,i,a,s,l,c,u="";return BigNumber.isBigNumber(e)?u=e.toFixed():"string"!=typeof e&&(u=e.toString()),"undefined"===u||"NaN"===u?null:(a="~-",c=l=s=i=o=n=r=null,t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","="].includes(e.value))throw new Error("错误的格式化参数:",e.value);n=e.value}else if("comma"===t)o=!0;else if("number"===t)r=e.value;else if("plus"===t)i=!0;else if("round"===t)a=e.value;else if("fraction"===t)l=!0;else if("scientific"===t)s=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");c=!0}}),s?(e=BigNumber(u).toExponential(),i&&!e.startsWith("-")?"+"+e:e):l?(t=BigNumber(u).toFraction().map(function(e){return e.toFixed()}).join("/"),i&&!t.startsWith("-")?"+"+t:t):(c&&(u=BigNumber(u).times(100).toFixed()),r&&(t=(e=decimal_round(t=(e=u.split("."))[0],1===e.length?"":e[1],n,r,a)).int_part,u=""===(e=e.dec_part)?t:"".concat(t,".").concat(e)),o&&(u=1<(t=u.split(".")).length?((e=t[0]).includes("-")?t[0]=e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t[0]=e.replace(/(?=(?!^)(?:\d{3})+$)/g,","),t.join(".")):(e=t[0]).includes("-")?e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):e.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),null===i||u.startsWith("-")||(u="+"+u),c&&(u+="%"),u))}function fill_fmt_tokens(e,n){return e.map(function(e){if("var"!==e.type)return e;for(var t,r=0;r<n.length&&!not_undefined(t=get_1(n[r],e.value));r++);if(is_number(t))return{type:"number",value:t};throw new Error("错误的填充值")})}function get_token_and_unit(e){var r=null;return e.length,{tokens:e.map(function(e){var t=split_unit_num(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}var getNative$4=_getNative,baseGetTag$1=(!function(){try{var e=getNative$4(Object,"defineProperty");e({},"",{})}catch(e){}}(),_baseGetTag),isObjectLike$1=isObjectLike_1,argsTag="[object Arguments]";function baseIsArguments$1(e){return isObjectLike$1(e)&&baseGetTag$1(e)==argsTag}var _baseIsArguments=baseIsArguments$1,baseIsArguments=baseIsArguments$1,isObjectLike=isObjectLike_1,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,propertyIsEnumerable=objectProto.propertyIsEnumerable,isBuffer=(baseIsArguments(function(){return arguments}()),{exports:{}});function stubFalse(){return!1}var stubFalse_1=stubFalse,_nodeUtil=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,r=r&&r.exports===t?_root.Buffer:void 0,t=r?r.isBuffer:void 0;e.exports=t||stubFalse_1}(isBuffer,isBuffer.exports),{exports:{}}),nodeUtil$5=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,n=r&&r.exports===t&&_freeGlobal.process,t=function(){try{var e=r&&r.require&&r.require("util").types;return e?e:n&&n.binding&&n.binding("util")}catch(e){}}();e.exports=t}(_nodeUtil,_nodeUtil.exports),_nodeUtil.exports),_cloneBuffer=(nodeUtil$5&&nodeUtil$5.isTypedArray,{exports:{}}),getNative$3=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,r=r&&r.exports===t?_root.Buffer:void 0,n=r?r.allocUnsafe:void 0;e.exports=function(e,t){return t?e.slice():(t=e.length,t=n?n(t):new e.constructor(t),e.copy(t),t)}}(_cloneBuffer,_cloneBuffer.exports),_getNative),root$5=_root,DataView$1=_getNative(_root,"DataView"),_DataView=DataView$1,getNative$2=_getNative,root$4=_root,Promise$2=_getNative(_root,"Promise"),_Promise=Promise$2,getNative$1=_getNative,root$3=_root,Set$1=_getNative(_root,"Set"),_Set=Set$1,getNative=_getNative,root$2=_root,WeakMap$1=_getNative(_root,"WeakMap"),_WeakMap=WeakMap$1,DataView=_DataView,Map=_Map,Promise$1=_Promise,Set=_Set,WeakMap=WeakMap$1,baseGetTag=_baseGetTag,toSource=_toSource,mapTag="[object Map]",objectTag="[object Object]",promiseTag="[object Promise]",setTag="[object Set]",weakMapTag="[object WeakMap]",dataViewTag="[object DataView]",dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap),getTag=baseGetTag,root$1=((DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag)&&(getTag=function(e){var t=baseGetTag(e),e=t==objectTag?e.constructor:void 0,e=e?toSource(e):"";if(e)switch(e){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}return t}),_root),_Symbol$2=(_root.Uint8Array,_Symbol$6),symbolProto$1=_Symbol$6?_Symbol$6.prototype:void 0,nodeUtil$4=(symbolProto$1&&symbolProto$1.valueOf,_nodeUtil.exports),nodeUtil$3=(nodeUtil$4&&nodeUtil$4.isMap,_nodeUtil.exports),nodeUtil$2=(nodeUtil$3&&nodeUtil$3.isSet,_nodeUtil.exports),nodeUtil$1=(nodeUtil$2&&nodeUtil$2.isArrayBuffer,_nodeUtil.exports),funcProto=(nodeUtil$1&&nodeUtil$1.isDate,Function.prototype),funcToString=funcProto.toString,_Symbol$1=(funcToString.call(Object),_Symbol$6),symbolProto=_Symbol$6?_Symbol$6.prototype:void 0,root=(symbolProto&&symbolProto.valueOf,_root),nodeUtil=(_root.isFinite,_nodeUtil.exports),_Symbol=(nodeUtil&&nodeUtil.isRegExp,_Symbol$6);function calc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=parse_args(t),o=get_1(n,"options._error",void 0),i=get_1(n,"options._debug",!1),a=get_1(n,"options._unit",!1),s=n.options,l=null;if(n.fmt_err||n.expr_err){if(not_undefined(o))return o;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(not_undefined(o))try{c=tokenizer(n.expr,a)}catch(e){return o}else c=tokenizer(n.expr,a);if(i&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),not_null(s)){var c,u=[];if(Array.isArray(s)?u=s:(u.push(s),not_undefined(s=get_1(s,"_fill_data",{}))&&(Array.isArray(s)?u=[].concat(_toConsumableArray(u),_toConsumableArray(s)):u.push(s))),not_undefined(o))try{c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u))}catch(e){return o}else c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u));[!0,"on","auto","space"].includes(a)&&(l=(s=get_token_and_unit(c)).unit,c=s.tokens)}u=token2postfix(c),i&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(u),console.warn("单位:".concat(l))),a=null;if(not_undefined(o))try{a=eval_postfix(u)}catch(e){return o}else a=eval_postfix(u);if("Infinity"!==(a=not_null(n.fmt)?format(a,n.fmt):null!==a?a.toFixed():null)&&null!==a)return null!==l&&(a+=l),a;if(not_undefined(o))return o;throw new Error("计算错误可能是非法的计算式")}_Symbol$6&&_Symbol$6.iterator,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: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");var fmt=calc;exports.calc=calc,exports.fmt=fmt,exports.version=version;
|
|
1
|
+
"use strict";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})(e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name: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.")}Object.defineProperty(exports,"__esModule",{value:!0});var version="1.1.0",RegexNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,RegexUnitNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function is_operator(e){return-1<"+-*/%()**".indexOf(e)}function get_prioraty(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function prioraty(e,t){return get_prioraty(e)<=get_prioraty(t)}function not_undefined(e){return void 0!==e}function is_null(e){return null===e}function not_null(e){return null!==e}function is_number(e){return"number"==typeof e||is_str_number(e)}function is_str_number(e){return"string"==typeof e&&!!RegexNumber.test(e)}function split_unit_num(e){for(var t,r,n=null,o=null,i=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],a=0;a<i.length;a++){var s=e.match(i[a]);if(s){t=s;break}}return t&&(o=t[1],""!==(r=t[2]).trim())&&(n=r),{num:o,unit:n}}var state$1={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",scientific:"scientific"},symbol="<>=";function fmt_tokenizer(e){for(var t=state$1.initial,r=[],n=[];e;){var o=e[0];if(t===state$1.initial)if(symbol.includes(o))t=state$1.symbol,r.push(o),e=e.slice(1);else if("~"===o)t=state$1.round,r.push(o),e=e.slice(1);else if("-"===o){if(t=state$1.initial,/[Ee]/.test(e[1]))n.push({type:"scientific",value:e[1]});else{if(!/[Nn]/.test(e[1]))throw new Error("不识别的fmt字符:".concat(e.slice(2)));n.push({type:"to-number",value:e[1]})}e=e.slice(2)}else{if("/"===o)t=state$1.initial,n.push({type:"fraction",value:o});else if(/[a-zA-Z_]/.test(o))t=state$1.variable,r.push(o);else if(/\d/.test(o))t=state$1.number,r.push(o);else if("+"===o)t=state$1.initial,n.push({type:"plus",value:o});else if(","===o)t=state$1.initial,n.push({type:"comma",value:o});else if("%"===o)t=state$1.initial,n.push({type:"percent",value:o});else if(!/\s/.test(o))throw new Error("不识别的fmt字符:".concat(o));e=e.slice(1)}else if(t===state$1.number)/\d/.test(o)?(r.push(o),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.variable)/[\$\w_\-.\[\]"']/.test(o)?(r.push(o),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.symbol)/\s/.test(o)?e=e.slice(1):symbol.includes(o)?(r.push(o),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=state$1.initial);else{if(t!==state$1.round)throw new Error("错误的自动机状态");if(/\s/.test(o))e=e.slice(1);else{if(!("56+-".includes(o)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(o));r.push(o),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=state$1.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=state$1.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},isArray$3=Array.isArray,isArray_1=isArray$3,freeGlobal$1="object"==_typeof(commonjsGlobal)&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root$9=freeGlobal||freeSelf||Function("return this")(),_root=root$9,root$8=_root,_Symbol2=_root.Symbol,_Symbol$6=_Symbol2,_Symbol$5=_Symbol$6,objectProto$5=Object.prototype,hasOwnProperty$4=objectProto$5.hasOwnProperty,nativeObjectToString$1=objectProto$5.toString,symToStringTag$1=_Symbol$5?_Symbol$5.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty$4.call(e,symToStringTag$1),r=e[symToStringTag$1];try{var n=!(e[symToStringTag$1]=void 0)}catch(e){}var o=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),o}var _getRawTag=getRawTag$1,objectProto$4=Object.prototype,nativeObjectToString=objectProto$4.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1,_Symbol$4=_Symbol$6,getRawTag=_getRawTag,objectToString=objectToString$1,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$6?_Symbol$6.toStringTag:void 0;function baseGetTag$4(e){return null==e?void 0===e?undefinedTag:nullTag:(symToStringTag&&symToStringTag in Object(e)?getRawTag:objectToString)(e)}var _baseGetTag=baseGetTag$4;function isObjectLike$3(e){return null!=e&&"object"==_typeof(e)}var isObjectLike_1=isObjectLike$3,baseGetTag$3=_baseGetTag,isObjectLike$2=isObjectLike_1,symbolTag="[object Symbol]";function isSymbol$3(e){return"symbol"==_typeof(e)||isObjectLike$2(e)&&baseGetTag$3(e)==symbolTag}var isSymbol_1=isSymbol$3,isArray$2=isArray_1,isSymbol$2=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$1(e,t){var r;return!isArray$2(e)&&(!("number"!=(r=_typeof(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol$2(e))||reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey$1;function isObject$2(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$2,baseGetTag$2=_baseGetTag,isObject$1=isObject_1,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(e){return!!isObject$1(e)&&((e=baseGetTag$2(e))==funcTag||e==genTag||e==asyncTag||e==proxyTag)}var isFunction_1=isFunction$1,root$7=_root,coreJsData$1=_root["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=coreJsData$1,maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1,funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource$2(e){if(null!=e){try{return funcToString$2.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$2,isFunction=isFunction_1,isMasked=_isMasked,isObject=isObject_1,toSource$1=_toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$3=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$3=objectProto$3.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$3).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource$1(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,t){return null==e?void 0:e[t]}var _getValue=getValue$1,baseIsNative=baseIsNative$1,getValue=getValue$1;function getNative$7(e,t){e=getValue(e,t);return baseIsNative(e)?e:void 0}var _getNative=getNative$7,getNative$6=_getNative,nativeCreate$4=_getNative(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){e=this.has(e)&&delete this.__data__[e];return this.size-=e?1:0,e}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$2=Object.prototype,hasOwnProperty$2=objectProto$2.hasOwnProperty;function hashGet$1(e){var t,r=this.__data__;return nativeCreate$2?(t=r[e])===HASH_UNDEFINED$1?void 0:t:hasOwnProperty$2.call(r,e)?r[e]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashHas$1(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty$1.call(t,e)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=hashHas$1,hashSet=hashSet$1;function Hash$1(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])}}Hash$1.prototype.clear=hashClear,Hash$1.prototype.delete=hashDelete,Hash$1.prototype.get=hashGet,Hash$1.prototype.has=hashHas,Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$1(e,t){return e===t||e!=e&&t!=t}var eq_1=eq$1,eq=eq$1;function assocIndexOf$4(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(e){var t=this.__data__,e=assocIndexOf$3(t,e);return!(e<0||(e==t.length-1?t.pop():splice.call(t,e,1),--this.size,0))}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var t=this.__data__,e=assocIndexOf$2(t,e);return e<0?void 0:t[e][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return-1<assocIndexOf$1(this.__data__,e)}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=listCacheDelete$1,listCacheGet=listCacheGet$1,listCacheHas=listCacheHas$1,listCacheSet=listCacheSet$1;function ListCache$1(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$1.prototype.clear=listCacheClear,ListCache$1.prototype.delete=listCacheDelete,ListCache$1.prototype.get=listCacheGet,ListCache$1.prototype.has=listCacheHas,ListCache$1.prototype.set=listCacheSet;var _ListCache=ListCache$1,getNative$5=_getNative,root$6=_root,Map$2=_getNative(_root,"Map"),_Map=Map$2,Hash=_Hash,ListCache=_ListCache,Map$1=_Map;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable$1,isKeyable=isKeyable$1;function getMapData$4(e,t){e=e.__data__;return isKeyable(t)?e["string"==typeof t?"string":"hash"]:e.map}var _getMapData=getMapData$4,getMapData$3=getMapData$4;function mapCacheDelete$1(e){e=getMapData$3(this,e).delete(e);return this.size-=e?1:0,e}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=getMapData$4;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1,getMapData$1=getMapData$4;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1,getMapData=getMapData$4;function mapCacheSet$1(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=mapCacheClear$1,mapCacheDelete=mapCacheDelete$1,mapCacheGet=mapCacheGet$1,mapCacheHas=mapCacheHas$1,mapCacheSet=mapCacheSet$1;function MapCache$1(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$1.prototype.clear=mapCacheClear,MapCache$1.prototype.delete=mapCacheDelete,MapCache$1.prototype.get=mapCacheGet,MapCache$1.prototype.has=mapCacheHas,MapCache$1.prototype.set=mapCacheSet;var _MapCache=MapCache$1,MapCache=MapCache$1,FUNC_ERROR_TEXT="Expected a function";function memoize$1(n,o){if("function"!=typeof n||null!=o&&"function"!=typeof o)throw new TypeError(FUNC_ERROR_TEXT);function i(){var e=arguments,t=o?o.apply(this,e):e[0],r=i.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),i.cache=r.set(t,e)||r,e)}return i.cache=new(memoize$1.Cache||MapCache),i}memoize$1.Cache=MapCache;var memoize_1=memoize$1,memoize=memoize$1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(e){var e=memoize(e,function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e}),t=e.cache;return e}var _memoizeCapped=memoizeCapped$1,memoizeCapped=memoizeCapped$1,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath$1=memoizeCapped$1(function(e){var o=[];return 46===e.charCodeAt(0)&&o.push(""),e.replace(rePropName,function(e,t,r,n){o.push(r?n.replace(reEscapeChar,"$1"):t||e)}),o}),_stringToPath=stringToPath$1;function arrayMap$1(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}var _arrayMap=arrayMap$1,_Symbol$3=_Symbol$6,arrayMap=arrayMap$1,isArray$1=isArray_1,isSymbol$1=isSymbol_1,INFINITY$1=1/0,symbolProto$2=_Symbol$6?_Symbol$6.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString$1(e){var t;return"string"==typeof e?e:isArray$1(e)?arrayMap(e,baseToString$1)+"":isSymbol$1(e)?symbolToString?symbolToString.call(e):"":"0"==(t=e+"")&&1/e==-INFINITY$1?"-0":t}var _baseToString=baseToString$1,baseToString=baseToString$1;function toString$1(e){return null==e?"":baseToString(e)}var toString_1=toString$1,isArray=isArray_1,isKey=_isKey,stringToPath=_stringToPath,toString=toString$1;function castPath$1(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}var _castPath=castPath$1,isSymbol=isSymbol_1,INFINITY=1/0;function toKey$1(e){var t;return"string"==typeof e||isSymbol(e)?e:"0"==(t=e+"")&&1/e==-INFINITY?"-0":t}var _toKey=toKey$1,castPath=castPath$1,toKey=toKey$1;function baseGet$1(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}var _baseGet=baseGet$1,baseGet=baseGet$1;function get(e,t,r){e=null==e?void 0:baseGet(e,t);return void 0===e?r:e}var get_1=get;function parse_args(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],o=e[1],o=(not_undefined(o)&&(t.options=o),get_1(o,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===o)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(_typeof(n)))}r=n.toString()}e=r.split("|");if(t.expr=e[0],1<e.length){o=e[1];if(""!==o.trim())try{t.fmt=fmt_tokenizer(o)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var i,n=[];try{n=fmt_tokenizer(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(i=t.fmt.map(function(e){return e.type}),n.forEach(function(e){i.includes(e.type)||t.fmt.push(e)}))}return t}var state={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},signed="+-",operator="*/%",brackets="()";function tokenizer(e){for(var t,r,n,o=1<arguments.length&&void 0!==arguments[1]&&arguments[1],i=state.initial,a=[],s=[],l=function(){a.push(t),e=e.slice(1)},c=function(e){s.push({type:e,value:a.join("")}),a.length=0},u=function(){e=e.slice(1)};e;)switch(t=e[0],i){case state.initial:if(signed.includes(t)){var f=s.at(-1),i=0===s.length||"operator"===f.type||"("===f?state.number:state.operator;l()}else if(operator.includes(t))i=state.operator,l();else if(/\d/.test(t))i=state.number,l();else if(brackets.includes(t))i=state.bracket;else if(/[a-zA-Z_$]/.test(t))i=state.var,l();else{if(!/\s/.test(t))throw new Error("不识别的字符".concat(t));u()}break;case state.bracket:s.push({type:state.bracket,value:t}),u(),i=state.initial;break;case state.operator:f=a.at(-1);"*"===t&&"*"===f&&l(),c(state.operator),i=state.initial;break;case state.number:if(/\d/.test(t))l();else if("."===t){if(0===a.length||a.includes("."))throw new Error("非法的小数部分".concat(a.join("")));l()}else"Ee".includes(t)?(i=state.scientific,l()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(t)||"space"===o&&/\S/.test(t)?l():(c(state.number),i=state.initial);break;case state.scientific:/\d/.test(t)?l():signed.includes(t)?(r=a.slice(1),n=a.at(-1),r.includes(t)||!/[Ee]/.test(n)?(c(state.scientific),i=state.initial):l()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(t)||"space"===o&&/\S/.test(t)?l():(c(state.scientific),i=state.initial);break;case state.var:/[\w_.\[\]"']/.test(t)?l():(c(state.var),i=state.initial);break;default:throw new Error("状态错误")}return 0!==a.length&&(s.push({type:i,value:a.join("")}),a.length=0,i=state.initial),s}function fill_tokens(e,t,r){if(is_null(t))throw new Error("错误的填充数据:",t);for(var n=[],o=0;o<e.length;o++){var i=e[o];if("var"!==i.type)n.push(i);else{if("undefined"===i.value||"NaN"===i.value)throw new Error("key不应该为:".concat(i.value));for(var a=null,s=0;s<t.length;s++){var l=t[s],l=get_1(l,i.value);if(void 0!==l){a=l;break}}if(null===a)throw new Error("token填充失败,请确认".concat(i,"存在"));if("string"==typeof a){if(""===a.trim())throw new Error("token填充失败,".concat(i.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!RegexUnitNumber.test(a))throw new Error("token填充失败,".concat(i.value,"值:").concat(a,"为非法单位数字"))}else if(!is_str_number(a))throw new Error("token填充失败,".concat(i,"值:").concat(a,"为非法数字"))}a="string"!=typeof a?a.toString():a,n.push({type:"number",value:a})}}return n}function token2postfix(e){for(var t=[],r=[],n=e.map(function(e){return e.value});0<n.length;){var o=n.shift();if(is_operator(o))if("("===o)t.push(o);else if(")"===o){for(var i=t.pop();"("!==i&&0<t.length;)r.push(i),i=t.pop();if("("!==i)throw"error: unmatched ()"}else{for(;prioraty(o,t[t.length-1])&&0<t.length;)r.push(t.pop());t.push(o)}else r.push(o)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)r.push(t.pop())}return r}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 m,f,h,t,c,b,a,s,l,u,p,r=O.prototype={constructor:O,toString:null,valueOf:null},g=new O(1),y=20,$=4,_=-7,d=21,v=-1e7,S=1e7,w=!1,o=1,E=0,A={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},C="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function O(e,t){var r,n,o,i,a,s,l,c,u=this;if(!(u instanceof O))return new O(e,t);if(null==t){if(e&&!0===e._isBigNumber)return u.s=e.s,void(!e.c||e.e>S?u.c=u.e=null:e.e<v?u.c=[u.e=0]:(u.e=e.e,u.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(u.s=1/e<0?(e=-e,-1):1,e===~~e){for(i=0,a=e;10<=a;a/=10,i++);return void(S<i?u.c=u.e=null:(u.e=i,u.c=[e]))}c=String(e)}else{if(!isNumeric.test(c=String(e)))return h(u,c,s);u.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(a=(c=-1<(i=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(i<0&&(i=a),i+=+c.slice(a+1),c=c.substring(0,a)):i<0&&(i=c.length)}else{if(intCheck(t,2,C.length,"Base"),10==t&&T)return G(u=new O(e),y+u.e+1,$);if(c=String(e),s="number"==typeof e){if(0*e!=0)return h(u,c,s,t);if(u.s=1/e<0?(c=c.slice(1),-1):1,O.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(tooManyDigits+e)}else u.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=C.slice(0,t),i=a=0,l=c.length;a<l;a++)if(r.indexOf(n=c.charAt(a))<0){if("."==n){if(i<a){i=l;continue}}else if(!o&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){o=!0,a=-1,i=0;continue}return h(u,String(e),s,t)}s=!1,-1<(i=(c=f(c,t,10,u.s)).indexOf("."))?c=c.replace(".",""):i=c.length}for(a=0;48===c.charCodeAt(a);a++);for(l=c.length;48===c.charCodeAt(--l););if(c=c.slice(a,++l)){if(l-=a,s&&O.DEBUG&&15<l&&(MAX_SAFE_INTEGER<e||e!==mathfloor(e)))throw Error(tooManyDigits+u.s*e);if((i=i-a-1)>S)u.c=u.e=null;else if(i<v)u.c=[u.e=0];else{if(u.e=i,u.c=[],a=(i+1)%LOG_BASE,i<0&&(a+=LOG_BASE),a<l){for(a&&u.c.push(+c.slice(0,a)),l-=LOG_BASE;a<l;)u.c.push(+c.slice(a,a+=LOG_BASE));a=LOG_BASE-(c=c.slice(a)).length}else a-=l;for(;a--;c+="0");u.c.push(+c)}}else u.c=[u.e=0]}function N(e,t,r,n){for(var o,i,a=[0],s=0,l=e.length;s<l;){for(i=a.length;i--;a[i]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),o=0;o<a.length;o++)r-1<a[o]&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/r|0,a[o]%=r)}return a.reverse()}function k(e,t,r){var n,o,i,a=0,s=e.length,l=t%SQRT_BASE,c=t/SQRT_BASE|0;for(e=e.slice();s--;)a=((o=l*(i=e[s]%SQRT_BASE)+(n=c*i+(i=e[s]/SQRT_BASE|0)*l)%SQRT_BASE*SQRT_BASE+a)/r|0)+(n/SQRT_BASE|0)+c*i,e[s]=o%r;return e=a?[a].concat(e):e}function M(e,t,r,n){var o,i;if(r!=n)i=n<r?1:-1;else for(o=i=0;o<r;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function x(e,t,r,n){for(var o=0;r--;)e[r]-=o,o=e[r]<t[r]?1:0,e[r]=o*n+e[r]-t[r];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var o,i,a,s;if(null==r?r=$:intCheck(r,0,8),!e.c)return e.toString();if(o=e.c[0],i=e.e,null==t)s=coeffToString(e.c),s=1==n||2==n&&(i<=_||d<=i)?toExponential(s,i):toFixedPoint(s,i,"0");else if(r=(e=G(new O(e),t,r)).e,a=(s=coeffToString(e.c)).length,1==n||2==n&&(t<=r||r<=_)){for(;a<t;s+="0",a++);s=toExponential(s,r)}else if(t-=i,s=toFixedPoint(s,r,"0"),a<r+1){if(0<--t)for(s+=".";t--;s+="0");}else if(0<(t+=r-a))for(r+1==a&&(s+=".");t--;s+="0");return e.s<0&&o?"-"+s:s}function i(e,t){for(var r,n=1,o=new O(e[0]);n<e.length;n++){if(!(r=new O(e[n])).s){o=r;break}t.call(o,r)&&(o=r)}return o}function P(e,t,r){for(var n=1,o=t.length;!t[--o];t.pop());for(o=t[0];10<=o;o/=10,n++);return(r=n+r*LOG_BASE-1)>S?e.c=e.e=null:r<v?e.c=[e.e=0]:(e.e=r,e.c=t),e}function G(e,t,r,n){var o,i,a,s,l,c,u,f=e.c,h=POWS_TEN;if(f){e:{for(o=1,s=f[0];10<=s;s/=10,o++);if((i=t-o)<0)i+=LOG_BASE,a=t,u=(l=f[c=0])/h[o-a-1]%10|0;else if((c=mathceil((i+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=u=0,a=(i%=LOG_BASE)-LOG_BASE+(o=1)}else{for(l=s=f[c],o=1;10<=s;s/=10,o++);u=(a=(i%=LOG_BASE)-LOG_BASE+o)<0?0:l/h[o-a-1]%10|0}if(n=n||t<0||null!=f[c+1]||(a<0?l:l%h[o-a-1]),n=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):5<u||5==u&&(4==r||n||6==r&&(0<i?0<a?l/h[o-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]=h[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):f[0]=e.e=0,e;if(0==i?(f.length=c,s=1,c--):(f.length=c+1,s=h[LOG_BASE-i],f[c]=0<a?mathfloor(l/h[o-a]%h[a])*s:0),n)for(;;){if(0==c){for(i=1,a=f[0];10<=a;a/=10,i++);for(a=f[0]+=s,s=1;10<=a;a/=10,s++);i!=s&&(e.e++,f[0]==BASE)&&(f[0]=1);break}if(f[c]+=s,f[c]!=BASE)break;f[c--]=0,s=1}for(i=f.length;0===f[--i];f.pop());}e.e>S?e.c=e.e=null:e.e<v&&(e.c=[e.e=0])}return e}function B(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=_||d<=r?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return O.clone=clone,O.ROUND_UP=0,O.ROUND_DOWN=1,O.ROUND_CEIL=2,O.ROUND_FLOOR=3,O.ROUND_HALF_UP=4,O.ROUND_HALF_DOWN=5,O.ROUND_HALF_EVEN=6,O.ROUND_HALF_CEIL=7,O.ROUND_HALF_FLOOR=8,O.EUCLID=9,O.config=O.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),y=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),_=r[0],d=r[1]):(intCheck(r,-MAX,MAX,t),_=-(d=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),v=r[0],S=r[1];else{if(intCheck(r,-MAX,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);v=-(S=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&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw w=!r,Error(bignumberError+"crypto unavailable");w=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),o=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),E=r),e.hasOwnProperty(t="FORMAT")){if("object"!=_typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);A=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);T="0123456789"==r.slice(0,10),C=r}}return{DECIMAL_PLACES:y,ROUNDING_MODE:$,EXPONENTIAL_AT:[_,d],RANGE:[v,S],CRYPTO:w,MODULO_MODE:o,POW_PRECISION:E,FORMAT:A,ALPHABET:C}},O.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!O.DEBUG)return!0;var t,r,n=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===i||-1===i)&&-MAX<=o&&o<=MAX&&o===mathfloor(o))if(0===n[0]){if(0===o&&1===n.length)return!0}else if((t=(o+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||BASE<=r||r!==mathfloor(r))break e;if(0!==r)return!0}}else if(null===n&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},O.maximum=O.max=function(){return i(arguments,r.lt)},O.minimum=O.min=function(){return i(arguments,r.gt)},O.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return mathfloor(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,o,i,a=0,s=[],l=new O(g);if(null==e?e=y:intCheck(e,0,MAX),o=mathceil(e/LOG_BASE),w)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));a<o;)9e15<=(i=131072*t[a]+(t[a+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(s.push(i%1e14),a+=2);a=o/2}else{if(!crypto.randomBytes)throw w=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(o*=7);a<o;)9e15<=(i=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])?crypto.randomBytes(7).copy(t,a):(s.push(i%1e14),a+=7);a=o/7}if(!w)for(;a<o;)(i=c())<9e15&&(s[a++]=i%1e14);for(o=s[--a],e%=LOG_BASE,o&&e&&(i=POWS_TEN[LOG_BASE-e],s[a]=mathfloor(o/i)*i);0===s[a];s.pop(),a--);if(a<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(a=1,i=s[0];10<=i;i/=10,a++);a<LOG_BASE&&(n-=LOG_BASE-a)}return l.e=n,l.c=s,l}),O.sum=function(){for(var e=1,t=arguments,r=new O(t[0]);e<t.length;)r=r.plus(t[e++]);return r},b="0123456789",f=function(e,t,r,n,o){var i,a,s,l,c,u,f,h,p=e.indexOf("."),g=y,_=$;for(0<=p&&(l=E,E=0,e=e.replace(".",""),u=(h=new O(t)).pow(e.length-p),E=l,h.c=N(toFixedPoint(coeffToString(u.c),u.e,"0"),10,r,b),h.e=h.c.length),s=l=(f=N(e,t,r,o?(i=C,b):(i=b,C))).length;0==f[--l];f.pop());if(!f[0])return i.charAt(0);if(p<0?--s:(u.c=f,u.e=s,u.s=n,f=(u=m(u,h,g,_,r)).c,c=u.r,s=u.e),p=f[a=s+g+1],l=r/2,c=c||a<0||null!=f[a+1],c=_<4?(null!=p||c)&&(0==_||_==(u.s<0?3:2)):l<p||p==l&&(4==_||c||6==_&&1&f[a-1]||_==(u.s<0?8:7)),a<1||!f[0])e=c?toFixedPoint(i.charAt(1),-g,i.charAt(0)):i.charAt(0);else{if(f.length=a,c)for(--r;++f[--a]>r;)f[a]=0,a||(++s,f=[1].concat(f));for(l=f.length;!f[--l];);for(p=0,e="";p<=l;e+=i.charAt(f[p++]));e=toFixedPoint(e,s,i.charAt(0))}return e},m=function(e,t,r,n,o){var i,a,s,l,c,u,f,h,p,g,_,m,b,y,$,d,v,S=e.s==t.s?1:-1,w=e.c,E=t.c;if(!(w&&w[0]&&E&&E[0]))return new O(e.s&&t.s&&(w?!E||w[0]!=E[0]:E)?w&&0==w[0]||!E?0*S:S/0:NaN);for(p=(h=new O(S)).c=[],S=r+(a=e.e-t.e)+1,o||(o=BASE,a=bitFloor(e.e/LOG_BASE)-bitFloor(t.e/LOG_BASE),S=S/LOG_BASE|0),s=0;E[s]==(w[s]||0);s++);if(E[s]>(w[s]||0)&&a--,S<0)p.push(1),l=!0;else{for(y=w.length,d=E.length,S+=2,1<(c=mathfloor(o/(E[s=0]+1)))&&(E=k(E,c,o),w=k(w,c,o),d=E.length,y=w.length),b=d,_=(g=w.slice(0,d)).length;_<d;g[_++]=0);v=E.slice(),v=[0].concat(v),$=E[0],E[1]>=o/2&&$++;do{if(c=0,(i=M(E,g,d,_))<0){if(m=g[0],d!=_&&(m=m*o+(g[1]||0)),1<(c=mathfloor(m/$)))for(f=(u=k(E,c=o<=c?o-1:c,o)).length,_=g.length;1==M(u,g,f,_);)c--,x(u,d<f?v:E,f,o),f=u.length,i=1;else 0==c&&(i=c=1),f=(u=E.slice()).length;if(x(g,u=f<_?[0].concat(u):u,_,o),_=g.length,-1==i)for(;M(E,g,d,_)<1;)c++,x(g,d<_?v:E,_,o),_=g.length}else 0===i&&(c++,g=[0])}while(p[s++]=c,g[0]?g[_++]=w[b]||0:(g=[w[b]],_=1),(b++<y||null!=g[0])&&S--);l=null!=g[0],p[0]||p.splice(0,1)}if(o==BASE){for(s=1,S=p[0];10<=S;S/=10,s++);G(h,r+(h.e=s+a*LOG_BASE-1)+1,n,l)}else h.e=a,h.r=+l;return h},a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,s=/^([^.]+)\.$/,l=/^\.([^.]+)$/,u=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var o,i=r?t:t.replace(p,"");if(u.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!r&&(i=i.replace(a,function(e,t,r){return o="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=o?e:t}),n&&(o=n,i=i.replace(s,"$1").replace(l,"0.$1")),t!=i))return new O(i,o);if(O.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new O(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return compare(this,new O(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return intCheck(e,0,MAX),null==t?t=$:intCheck(t,0,8),G(new O(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return m(this,new O(e,t),y,$)},r.dividedToIntegerBy=r.idiv=function(e,t){return m(this,new O(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,o,i,a,s,l,c,u=this;if((e=new O(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+B(e));if(null!=t&&(t=new O(t)),a=14<e.e,!u.c||!u.c[0]||1==u.c[0]&&!u.e&&1==u.c.length||!e.c||!e.c[0])return c=new O(Math.pow(+B(u),a?e.s*(2-isOdd(e)):+B(e))),t?c.mod(t):c;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new O(NaN);(n=!s&&u.isInteger()&&t.isInteger())&&(u=u.mod(t))}else{if(9<e.e&&(0<u.e||u.e<-1||(0==u.e?1<u.c[0]||a&&24e7<=u.c[1]:u.c[0]<8e13||a&&u.c[0]<=9999975e7)))return i=u.s<0&&isOdd(e)?-0:0,-1<u.e&&(i=1/i),new O(s?1/i:i);E&&(i=mathceil(E/LOG_BASE+2))}for(l=a?(r=new O(.5),s&&(e.s=1),isOdd(e)):(o=Math.abs(+B(e)))%2,c=new O(g);;){if(l){if(!(c=c.times(u)).c)break;i?c.c.length>i&&(c.c.length=i):n&&(c=c.mod(t))}if(o){if(0===(o=mathfloor(o/2)))break;l=o%2}else if(G(e=e.times(r),e.e+1,1),14<e.e)l=isOdd(e);else{if(0===(o=+B(e)))break;l=o%2}u=u.times(u),i?u.c&&u.c.length>i&&(u.c.length=i):n&&(u=u.mod(t))}return n?c:(s&&(c=g.div(c)),t?c.mod(t):i?G(c,E,$,void 0):c)},r.integerValue=function(e){var t=new O(this);return null==e?e=$:intCheck(e,0,8),G(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===compare(this,new O(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<compare(this,new O(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=compare(this,new O(e,t)))||0===t},r.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return compare(this,new O(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=compare(this,new O(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,o,i,a=this,s=a.s;if(t=(e=new O(e,t)).s,!s||!t)return new O(NaN);if(s!=t)return e.s=-t,a.plus(e);var l=a.e/LOG_BASE,c=e.e/LOG_BASE,u=a.c,f=e.c;if(!l||!c){if(!u||!f)return u?(e.s=-t,e):new O(f?a:NaN);if(!u[0]||!f[0])return f[0]?(e.s=-t,e):new O(u[0]?a:3==$?-0:0)}if(l=bitFloor(l),c=bitFloor(c),u=u.slice(),s=l-c){for((o=(i=s<0)?(s=-s,u):(c=l,f)).reverse(),t=s;t--;o.push(0));o.reverse()}else for(n=(i=(s=u.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(u[t]!=f[t]){i=u[t]<f[t];break}if(i&&(o=u,u=f,f=o,e.s=-e.s),0<(t=(n=f.length)-(r=u.length)))for(;t--;u[r++]=0);for(t=BASE-1;s<n;){if(u[--n]<f[n]){for(r=n;r&&!u[--r];u[r]=t);--u[r],u[n]+=BASE}u[n]-=f[n]}for(;0==u[0];u.splice(0,1),--c);return u[0]?P(e,u,c):(e.s=3==$?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new O(e,t),!n.c||!e.s||e.c&&!e.c[0]?new O(NaN):!e.c||n.c&&!n.c[0]?new O(n):(9==o?(t=e.s,e.s=1,r=m(n,e,0,3),e.s=t,r.s*=t):r=m(n,e,0,o),(e=n.minus(r.times(e))).c[0]||1!=o||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,o,i,a,s,l,c,u,f,h,p,g,_=this,m=_.c,b=(e=new O(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!_.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=_.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=bitFloor(_.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=_.s,(s=m.length)<(_=b.length)&&(h=m,m=b,b=h,n=s,s=_,_=n),n=s+_,h=[];n--;h.push(0));for(p=BASE,g=SQRT_BASE,n=_;0<=--n;){for(u=b[n]%g,f=b[n]/g|(r=0),o=n+(i=s);n<o;)r=((l=u*(l=m[--i]%g)+(a=f*l+(c=m[i]/g|0)*u)%g*g+h[o]+r)/p|0)+(a/g|0)+f*c,h[o--]=l%p;h[o]=r}return r?++t:h.splice(0,1),P(e,h,t)},r.negated=function(){var e=new O(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,o=n.s;if(t=(e=new O(e,t)).s,!o||!t)return new O(NaN);if(o!=t)return e.s=-t,n.minus(e);var i=n.e/LOG_BASE,a=e.e/LOG_BASE,s=n.c,l=e.c;if(!i||!a){if(!s||!l)return new O(o/0);if(!s[0]||!l[0])return l[0]?e:new O(s[0]?n:0*o)}if(i=bitFloor(i),a=bitFloor(a),s=s.slice(),o=i-a){for((r=0<o?(a=i,l):(o=-o,s)).reverse();o--;r.push(0));r.reverse()}for((o=s.length)-(t=l.length)<0&&(r=l,l=s,s=r,t=o),o=0;t;)o=(s[--t]=s[t]+l[t]+o)/BASE|0,s[t]=BASE===s[t]?0:s[t]%BASE;return o&&(s=[o].concat(s),++a),P(e,s,a)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=$:intCheck(t,0,8),G(new O(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*LOG_BASE+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,o,i=this,a=i.c,s=i.s,l=i.e,c=y+4,u=new O("0.5");if(1!==s||!a||!a[0])return new O(!s||s<0&&(!a||a[0])?NaN:a?i:1/0);if((r=0==(s=Math.sqrt(+B(i)))||s==1/0?(((t=coeffToString(a)).length+l)%2==0&&(t+="0"),s=Math.sqrt(+t),l=bitFloor((l+1)/2)-(l<0||l%2),new O(t=s==1/0?"5e"+l:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+l)):new O(s+"")).c[0])for((s=(l=r.e)+c)<3&&(s=0);;)if(o=r,r=u.times(o.plus(m(i,o,c,1))),coeffToString(o.c).slice(0,s)===(t=coeffToString(r.c)).slice(0,s)){if(r.e<l&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(G(r,r.e+y+2,1),e=!r.times(r).eq(i));break}if(!n&&(G(o,o.e+y+2,0),o.times(o).eq(i))){r=o;break}c+=4,s+=4,n=1}return G(r,r.e+y+1,$,e)},r.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==_typeof(t)?(r=t,t=null):e&&"object"==_typeof(e)?(r=e,e=t=null):r=A;else if("object"!=_typeof(r))throw Error(bignumberError+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),o=+r.groupSize,i=+r.secondaryGroupSize,a=r.groupSeparator||"",s=t[0],t=t[1],l=this.s<0,c=l?s.slice(1):s,u=c.length;if(i&&(n=o,o=i,u-=i=n),0<o&&0<u){for(s=c.substr(0,n=u%o||o);n<u;n+=o)s+=a+c.substr(n,o);0<i&&(s+=a+c.slice(n)),l&&(s="-"+s)}e=t?s+(r.decimalSeparator||"")+((i=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+i+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):s}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,o,i,a,s,l,c,u,f=this,h=f.c;if(null!=e&&(!(s=new O(e)).isInteger()&&(s.c||1!==s.s)||s.lt(g)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+B(s));if(!h)return new O(f);for(t=new O(g),c=r=new O(g),n=l=new O(g),h=coeffToString(h),i=t.e=h.length-f.e-1,t.c[0]=POWS_TEN[(a=i%LOG_BASE)<0?LOG_BASE+a:a],e=!e||0<s.comparedTo(t)?0<i?t:c:s,a=S,S=1/0,s=new O(h),l.c[0]=0;u=m(s,t,0,1),1!=(o=r.plus(u.times(n))).comparedTo(e);)r=n,n=o,c=l.plus(u.times(o=c)),l=o,t=s.minus(u.times(o=t)),s=o;return o=m(e.minus(r),n,0,1),l=l.plus(o.times(c)),r=r.plus(o.times(n)),l.s=c.s=f.s,h=m(c,n,i*=2,$).minus(f).abs().comparedTo(m(l,r,i,$).minus(f).abs())<1?[c,n]:[l,r],S=a,h},r.toNumber=function(){return+B(this)},r.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,o=r.e;return null===o?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?o<=_||d<=o?toExponential(coeffToString(r.c),o):toFixedPoint(coeffToString(r.c),o,"0"):10===e&&T?toFixedPoint(coeffToString((r=G(new O(r),y+o+1,$)).c),r.e,"0"):(intCheck(e,2,C.length,"Base"),f(toFixedPoint(coeffToString(r.c),o,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return B(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&O.set(e),O}function bitFloor(e){var t=0|e;return 0<e||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,o=e.length,i=e[0]+"";n<o;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function compare(e,t){var r,n,o=e.c,i=t.c,a=e.s,s=t.s,e=e.e,t=t.e;if(!a||!s)return null;if(r=o&&!o[0],n=i&&!i[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=e==t,!o||!i)return n?0:!o^r?1:-1;if(!n)return t<e^r?1:-1;for(s=(e=o.length)<(t=i.length)?e:t,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^r?1:-1;return e==t?0:t<e^r?1:-1}function intCheck(e,t,r,n){if(e<t||r<e||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||r<e?" 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(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,o;if(t<0){for(o=r+".";++t;o+=r);e=o+e}else if(++t>(n=e.length)){for(o=r,t-=n;--t;o+=r);e+=o}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();function eval_postfix(e){for(var t=[];0<e.length;){var r=e.shift();if(is_operator(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),o=t.pop();if("string"==typeof n&&!BigNumber.isBigNumber(n)){if(!is_str_number(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new BigNumber(n)}if("string"==typeof o&&!BigNumber.isBigNumber(o)){if(!is_str_number(o))throw new Error("".concat(o,"不是一个合法的数字"));o=new BigNumber(o)}switch(r){case"+":t.push(o.plus(n));break;case"-":t.push(o.minus(n));break;case"*":t.push(o.times(n));break;case"/":t.push(o.div(n));break;case"%":t.push(o.mod(n));break;case"**":t.push(o.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var i=t[0];if((i=BigNumber.isBigNumber(i)?i:BigNumber(i)).isNaN())throw new Error("计算结果为NaN");return i}function decimal_round(o,i,a,s,e){var l=o,c=i,u=i.length,t={"~-":function(){c=i.slice(0,"<"===a?s-1:s)},"~+":function(){var e,t="<"===a?s-1:s;u<=t||0===u||(e=i.slice(0,t),0!=+i.slice(t,u)&&(e=(+e+1).toString()).length>t?(c=e.slice(1,e.length),l=(+l+1).toString()):c=e)},"~5":function(){var e,t;0===u||(c=i.slice(0,e="<"===a?s-1:s),t=+i[e],Number.isNaN(t))||5<=t&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())},"~6":function(){var e,t,r,n;0!==u&&(t=+i[e="<"===a?s-1:s],r=""===(r=i.slice(+e+1,i.length))?0:parseInt(r),n=0===e?+o[o.length-1]:+i[e-1],c=i.slice(0,e),6<=t||5==t&&0<r||5==t&&n%2!=0)&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())}};return"<="===a?c=u<=s?i:(t[e]&&t[e](),c.replace(/0+$/,"")):"<"===a?c=u<s?i:(t[e]&&t[e](),c.replace(/0+$/,"")):"="===a?u<s?c=i+"0".repeat(s-u):s<u&&t[e]&&t[e]():">="===a?u<s&&(c=i+"0".repeat(s-u)):">"===a&&u<=s&&(c=i+"0".repeat(s-u+1)),{int_part:l,dec_part:c}}function format(e,t,r){var n,o,i,a,s,l,c,u,f,h="";return BigNumber.isBigNumber(e)?h=e.toFixed():"string"!=typeof e&&(h=e.toString()),"undefined"===h||"NaN"===h?null:(o=n=null,a=i=!1,f=u=c=l=!(s="~-"),t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);o=e.value}else if("to-number"===t)f=!0;else if("comma"===t)i=!0;else if("number"===t)n=e.value;else if("plus"===t)a=!0;else if("round"===t)s=e.value;else if("fraction"===t)c=!0;else if("scientific"===t)l=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");u=!0}}),l?(e=BigNumber(h).toExponential(),a&&!e.startsWith("-")?"+"+e:e):c?(t=BigNumber(h).toFraction().map(function(e){return e.toFixed()}).join("/"),a&&!t.startsWith("-")?"+"+t:t):(u&&(h=BigNumber(h).times(100).toFixed()),n&&(t=(e=decimal_round(t=(e=h.split("."))[0],1===e.length?"":e[1],o,+n,s)).int_part,h=""===(e=e.dec_part)?t:"".concat(t,".").concat(e)),i&&(f=!1,h=1<(t=h.split(".")).length?((e=t[0]).includes("-")?t[0]=e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t[0]=e.replace(/(?=(?!^)(?:\d{3})+$)/g,","),t.join(".")):(e=t[0]).includes("-")?e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):e.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),a&&(f=!1,h.startsWith("-")||(h="+"+h)),u&&(f=!1,h+="%"),f&&!r?+h:h))}function fill_fmt_tokens(e,n){return e.map(function(e){if("var"!==e.type)return e;for(var t,r=0;r<n.length&&!not_undefined(t=get_1(n[r],e.value));r++);if(is_number(t))return{type:"number",value:t};throw new Error("错误的填充值")})}function get_token_and_unit(e){var r=null;return e.length,{tokens:e.map(function(e){var t=split_unit_num(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}var getNative$4=_getNative,baseGetTag$1=(!function(){try{var e=getNative$4(Object,"defineProperty");e({},"",{})}catch(e){}}(),_baseGetTag),isObjectLike$1=isObjectLike_1,argsTag="[object Arguments]";function baseIsArguments$1(e){return isObjectLike$1(e)&&baseGetTag$1(e)==argsTag}var _baseIsArguments=baseIsArguments$1,baseIsArguments=baseIsArguments$1,isObjectLike=isObjectLike_1,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,propertyIsEnumerable=objectProto.propertyIsEnumerable,isBuffer=(baseIsArguments(function(){return arguments}()),{exports:{}});function stubFalse(){return!1}var stubFalse_1=stubFalse,_nodeUtil=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,r=r&&r.exports===t?_root.Buffer:void 0,t=r?r.isBuffer:void 0;e.exports=t||stubFalse_1}(isBuffer,isBuffer.exports),{exports:{}}),nodeUtil$5=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,n=r&&r.exports===t&&_freeGlobal.process,t=function(){try{var e=r&&r.require&&r.require("util").types;return e?e:n&&n.binding&&n.binding("util")}catch(e){}}();e.exports=t}(_nodeUtil,_nodeUtil.exports),_nodeUtil.exports),_cloneBuffer=(nodeUtil$5&&nodeUtil$5.isTypedArray,{exports:{}}),getNative$3=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,r=r&&r.exports===t?_root.Buffer:void 0,n=r?r.allocUnsafe:void 0;e.exports=function(e,t){return t?e.slice():(t=e.length,t=n?n(t):new e.constructor(t),e.copy(t),t)}}(_cloneBuffer,_cloneBuffer.exports),_getNative),root$5=_root,DataView$1=_getNative(_root,"DataView"),_DataView=DataView$1,getNative$2=_getNative,root$4=_root,Promise$2=_getNative(_root,"Promise"),_Promise=Promise$2,getNative$1=_getNative,root$3=_root,Set$1=_getNative(_root,"Set"),_Set=Set$1,getNative=_getNative,root$2=_root,WeakMap$1=_getNative(_root,"WeakMap"),_WeakMap=WeakMap$1,DataView=_DataView,Map=_Map,Promise$1=_Promise,Set=_Set,WeakMap=WeakMap$1,baseGetTag=_baseGetTag,toSource=_toSource,mapTag="[object Map]",objectTag="[object Object]",promiseTag="[object Promise]",setTag="[object Set]",weakMapTag="[object WeakMap]",dataViewTag="[object DataView]",dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap),getTag=baseGetTag,root$1=((DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag)&&(getTag=function(e){var t=baseGetTag(e),e=t==objectTag?e.constructor:void 0,e=e?toSource(e):"";if(e)switch(e){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}return t}),_root),_Symbol$2=(_root.Uint8Array,_Symbol$6),symbolProto$1=_Symbol$6?_Symbol$6.prototype:void 0,nodeUtil$4=(symbolProto$1&&symbolProto$1.valueOf,_nodeUtil.exports),nodeUtil$3=(nodeUtil$4&&nodeUtil$4.isMap,_nodeUtil.exports),nodeUtil$2=(nodeUtil$3&&nodeUtil$3.isSet,_nodeUtil.exports),nodeUtil$1=(nodeUtil$2&&nodeUtil$2.isArrayBuffer,_nodeUtil.exports),funcProto=(nodeUtil$1&&nodeUtil$1.isDate,Function.prototype),funcToString=funcProto.toString,_Symbol$1=(funcToString.call(Object),_Symbol$6),symbolProto=_Symbol$6?_Symbol$6.prototype:void 0,root=(symbolProto&&symbolProto.valueOf,_root),nodeUtil=(_root.isFinite,_nodeUtil.exports),_Symbol=(nodeUtil&&nodeUtil.isRegExp,_Symbol$6);function calc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=parse_args(t),o=get_1(n,"options._error",void 0),i=get_1(n,"options._debug",!1),a=get_1(n,"options._unit",!1),s=n.options,l=null;if(n.fmt_err||n.expr_err){if(not_undefined(o))return o;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(not_undefined(o))try{c=tokenizer(n.expr,a)}catch(e){return o}else c=tokenizer(n.expr,a);if(i&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),not_null(s)){var c,u=[];if(Array.isArray(s)?u=s:(u.push(s),not_undefined(s=get_1(s,"_fill_data",{}))&&(Array.isArray(s)?u=[].concat(_toConsumableArray(u),_toConsumableArray(s)):u.push(s))),not_undefined(o))try{c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u))}catch(e){return o}else c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u));[!0,"on","auto","space"].includes(a)&&(l=(s=get_token_and_unit(c)).unit,c=s.tokens)}u=token2postfix(c),i&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(u),console.warn("单位:".concat(l))),s=null;if(not_undefined(o))try{s=eval_postfix(u)}catch(e){return o}else s=eval_postfix(u);if("Infinity"!==(s=not_null(n.fmt)?format(s,n.fmt,a):null!==s?s.toFixed():null)&&null!==s)return null!==l&&(s+=l),s;if(not_undefined(o))return o;throw new Error("计算错误可能是非法的计算式")}_Symbol$6&&_Symbol$6.iterator,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: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");var fmt=calc;exports.calc=calc,exports.fmt=fmt,exports.version=version;
|
package/es/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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})(e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name: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.")}var version="1.0.29",RegexNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,RegexUnitNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function is_operator(e){return-1<"+-*/%()**".indexOf(e)}function get_prioraty(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function prioraty(e,t){return get_prioraty(e)<=get_prioraty(t)}function not_undefined(e){return void 0!==e}function is_null(e){return null===e}function not_null(e){return null!==e}function is_number(e){return"number"==typeof e||is_str_number(e)}function is_str_number(e){return"string"==typeof e&&!!RegexNumber.test(e)}function split_unit_num(e){for(var t,r,n=null,o=null,i=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],a=0;a<i.length;a++){var s=e.match(i[a]);if(s){t=s;break}}return t&&(o=t[1],""!==(r=t[2]).trim())&&(n=r),{num:o,unit:n}}var state$1={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",scientific:"scientific"},symbol="<>=";function fmt_tokenizer(e){for(var t=state$1.initial,r=[],n=[];e;){var o=e[0];if(t===state$1.initial)if(symbol.includes(o))t=state$1.symbol,r.push(o),e=e.slice(1);else if("~"===o)t=state$1.round,r.push(o),e=e.slice(1);else if("\\"===o&&/[Ee]/.test(e[1]))t=state$1.initial,n.push({type:"scientific",value:e[1]}),e=e.slice(2);else{if("/"===o)t=state$1.initial,n.push({type:"fraction",value:o});else if(/[a-zA-Z_]/.test(o))t=state$1.variable,r.push(o);else if(/\d/.test(o))t=state$1.number,r.push(o);else if("+"===o)t=state$1.initial,n.push({type:"plus",value:o});else if(","===o)t=state$1.initial,n.push({type:"comma",value:o});else if("%"===o)t=state$1.initial,n.push({type:"percent",value:o});else if(!/\s/.test(o))throw new Error("不识别的fmt字符:".concat(o));e=e.slice(1)}else if(t===state$1.number)/\d/.test(o)?(r.push(o),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.variable)/[\$\w_\-.\[\]"']/.test(o)?(r.push(o),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.symbol)/\s/.test(o)?e=e.slice(1):symbol.includes(o)?(r.push(o),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=state$1.initial);else{if(t!==state$1.round)throw new Error("错误的自动机状态");if(/\s/.test(o))e=e.slice(1);else{if(!("56+-".includes(o)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(o));r.push(o),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=state$1.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=state$1.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},isArray$3=Array.isArray,isArray_1=isArray$3,freeGlobal$1="object"==_typeof(commonjsGlobal)&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root$9=freeGlobal||freeSelf||Function("return this")(),_root=root$9,root$8=_root,_Symbol2=_root.Symbol,_Symbol$6=_Symbol2,_Symbol$5=_Symbol$6,objectProto$5=Object.prototype,hasOwnProperty$4=objectProto$5.hasOwnProperty,nativeObjectToString$1=objectProto$5.toString,symToStringTag$1=_Symbol$5?_Symbol$5.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty$4.call(e,symToStringTag$1),r=e[symToStringTag$1];try{var n=!(e[symToStringTag$1]=void 0)}catch(e){}var o=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),o}var _getRawTag=getRawTag$1,objectProto$4=Object.prototype,nativeObjectToString=objectProto$4.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1,_Symbol$4=_Symbol$6,getRawTag=_getRawTag,objectToString=objectToString$1,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$6?_Symbol$6.toStringTag:void 0;function baseGetTag$4(e){return null==e?void 0===e?undefinedTag:nullTag:(symToStringTag&&symToStringTag in Object(e)?getRawTag:objectToString)(e)}var _baseGetTag=baseGetTag$4;function isObjectLike$3(e){return null!=e&&"object"==_typeof(e)}var isObjectLike_1=isObjectLike$3,baseGetTag$3=_baseGetTag,isObjectLike$2=isObjectLike_1,symbolTag="[object Symbol]";function isSymbol$3(e){return"symbol"==_typeof(e)||isObjectLike$2(e)&&baseGetTag$3(e)==symbolTag}var isSymbol_1=isSymbol$3,isArray$2=isArray_1,isSymbol$2=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$1(e,t){var r;return!isArray$2(e)&&(!("number"!=(r=_typeof(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol$2(e))||reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey$1;function isObject$2(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$2,baseGetTag$2=_baseGetTag,isObject$1=isObject_1,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(e){return!!isObject$1(e)&&((e=baseGetTag$2(e))==funcTag||e==genTag||e==asyncTag||e==proxyTag)}var isFunction_1=isFunction$1,root$7=_root,coreJsData$1=_root["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=coreJsData$1,maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1,funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource$2(e){if(null!=e){try{return funcToString$2.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$2,isFunction=isFunction_1,isMasked=_isMasked,isObject=isObject_1,toSource$1=_toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$3=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$3=objectProto$3.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$3).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource$1(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,t){return null==e?void 0:e[t]}var _getValue=getValue$1,baseIsNative=baseIsNative$1,getValue=getValue$1;function getNative$7(e,t){e=getValue(e,t);return baseIsNative(e)?e:void 0}var _getNative=getNative$7,getNative$6=_getNative,nativeCreate$4=_getNative(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){e=this.has(e)&&delete this.__data__[e];return this.size-=e?1:0,e}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$2=Object.prototype,hasOwnProperty$2=objectProto$2.hasOwnProperty;function hashGet$1(e){var t,r=this.__data__;return nativeCreate$2?(t=r[e])===HASH_UNDEFINED$1?void 0:t:hasOwnProperty$2.call(r,e)?r[e]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashHas$1(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty$1.call(t,e)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=hashHas$1,hashSet=hashSet$1;function Hash$1(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])}}Hash$1.prototype.clear=hashClear,Hash$1.prototype.delete=hashDelete,Hash$1.prototype.get=hashGet,Hash$1.prototype.has=hashHas,Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$1(e,t){return e===t||e!=e&&t!=t}var eq_1=eq$1,eq=eq$1;function assocIndexOf$4(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(e){var t=this.__data__,e=assocIndexOf$3(t,e);return!(e<0||(e==t.length-1?t.pop():splice.call(t,e,1),--this.size,0))}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var t=this.__data__,e=assocIndexOf$2(t,e);return e<0?void 0:t[e][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return-1<assocIndexOf$1(this.__data__,e)}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=listCacheDelete$1,listCacheGet=listCacheGet$1,listCacheHas=listCacheHas$1,listCacheSet=listCacheSet$1;function ListCache$1(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$1.prototype.clear=listCacheClear,ListCache$1.prototype.delete=listCacheDelete,ListCache$1.prototype.get=listCacheGet,ListCache$1.prototype.has=listCacheHas,ListCache$1.prototype.set=listCacheSet;var _ListCache=ListCache$1,getNative$5=_getNative,root$6=_root,Map$2=_getNative(_root,"Map"),_Map=Map$2,Hash=_Hash,ListCache=_ListCache,Map$1=_Map;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable$1,isKeyable=isKeyable$1;function getMapData$4(e,t){e=e.__data__;return isKeyable(t)?e["string"==typeof t?"string":"hash"]:e.map}var _getMapData=getMapData$4,getMapData$3=getMapData$4;function mapCacheDelete$1(e){e=getMapData$3(this,e).delete(e);return this.size-=e?1:0,e}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=getMapData$4;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1,getMapData$1=getMapData$4;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1,getMapData=getMapData$4;function mapCacheSet$1(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=mapCacheClear$1,mapCacheDelete=mapCacheDelete$1,mapCacheGet=mapCacheGet$1,mapCacheHas=mapCacheHas$1,mapCacheSet=mapCacheSet$1;function MapCache$1(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$1.prototype.clear=mapCacheClear,MapCache$1.prototype.delete=mapCacheDelete,MapCache$1.prototype.get=mapCacheGet,MapCache$1.prototype.has=mapCacheHas,MapCache$1.prototype.set=mapCacheSet;var _MapCache=MapCache$1,MapCache=MapCache$1,FUNC_ERROR_TEXT="Expected a function";function memoize$1(n,o){if("function"!=typeof n||null!=o&&"function"!=typeof o)throw new TypeError(FUNC_ERROR_TEXT);function i(){var e=arguments,t=o?o.apply(this,e):e[0],r=i.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),i.cache=r.set(t,e)||r,e)}return i.cache=new(memoize$1.Cache||MapCache),i}memoize$1.Cache=MapCache;var memoize_1=memoize$1,memoize=memoize$1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(e){var e=memoize(e,function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e}),t=e.cache;return e}var _memoizeCapped=memoizeCapped$1,memoizeCapped=memoizeCapped$1,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath$1=memoizeCapped$1(function(e){var o=[];return 46===e.charCodeAt(0)&&o.push(""),e.replace(rePropName,function(e,t,r,n){o.push(r?n.replace(reEscapeChar,"$1"):t||e)}),o}),_stringToPath=stringToPath$1;function arrayMap$1(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}var _arrayMap=arrayMap$1,_Symbol$3=_Symbol$6,arrayMap=arrayMap$1,isArray$1=isArray_1,isSymbol$1=isSymbol_1,INFINITY$1=1/0,symbolProto$2=_Symbol$6?_Symbol$6.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString$1(e){var t;return"string"==typeof e?e:isArray$1(e)?arrayMap(e,baseToString$1)+"":isSymbol$1(e)?symbolToString?symbolToString.call(e):"":"0"==(t=e+"")&&1/e==-INFINITY$1?"-0":t}var _baseToString=baseToString$1,baseToString=baseToString$1;function toString$1(e){return null==e?"":baseToString(e)}var toString_1=toString$1,isArray=isArray_1,isKey=_isKey,stringToPath=_stringToPath,toString=toString$1;function castPath$1(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}var _castPath=castPath$1,isSymbol=isSymbol_1,INFINITY=1/0;function toKey$1(e){var t;return"string"==typeof e||isSymbol(e)?e:"0"==(t=e+"")&&1/e==-INFINITY?"-0":t}var _toKey=toKey$1,castPath=castPath$1,toKey=toKey$1;function baseGet$1(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}var _baseGet=baseGet$1,baseGet=baseGet$1;function get(e,t,r){e=null==e?void 0:baseGet(e,t);return void 0===e?r:e}var get_1=get;function parse_args(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],o=e[1],o=(not_undefined(o)&&(t.options=o),get_1(o,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===o)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(_typeof(n)))}r=n.toString()}e=r.split("|");if(t.expr=e[0],1<e.length){o=e[1];if(""!==o.trim())try{t.fmt=fmt_tokenizer(o)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var i,n=[];try{n=fmt_tokenizer(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(i=t.fmt.map(function(e){return e.type}),n.forEach(function(e){i.includes(e.type)||t.fmt.push(e)}))}return t}var state={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},signed="+-",operator="*/%",brackets="()";function tokenizer(e){function t(){c.push(o),e=e.slice(1)}function r(e){u.push({type:e,value:c.join("")}),c.length=0}function n(){e=e.slice(1)}for(var o,i,a,s=1<arguments.length&&void 0!==arguments[1]&&arguments[1],l=state.initial,c=[],u=[];e;)switch(o=e[0],l){case state.initial:if(signed.includes(o)){var f=u.at(-1),l=0===u.length||"operator"===f.type||"("===f?state.number:state.operator;t()}else if(operator.includes(o))l=state.operator,t();else if(/\d/.test(o))l=state.number,t();else if(brackets.includes(o))l=state.bracket;else if(/[a-zA-Z_$]/.test(o))l=state.var,t();else{if(!/\s/.test(o))throw new Error("不识别的字符".concat(o));n()}break;case state.bracket:u.push({type:state.bracket,value:o}),n(),l=state.initial;break;case state.operator:f=c.at(-1);"*"===o&&"*"===f&&t(),r(state.operator),l=state.initial;break;case state.number:if(/\d/.test(o))t();else if("."===o){if(0===c.length||c.includes("."))throw new Error("非法的小数部分".concat(c.join("")));t()}else"Ee".includes(o)?(l=state.scientific,t()):["auto","on",!0].includes(s)&&/[^*/+\-()\s]/.test(o)||"space"===s&&/\S/.test(o)?t():(r(state.number),l=state.initial);break;case state.scientific:/\d/.test(o)?t():signed.includes(o)?(i=c.slice(1),a=c.at(-1),i.includes(o)||!/[Ee]/.test(a)?(r(state.scientific),l=state.initial):t()):["auto","on",!0].includes(s)&&/[^*/+\-()\s]/.test(o)||"space"===s&&/\S/.test(o)?t():(r(state.scientific),l=state.initial);break;case state.var:/[\w_.\[\]"']/.test(o)?t():(r(state.var),l=state.initial);break;default:throw new Error("状态错误")}return 0!==c.length&&(u.push({type:l,value:c.join("")}),c.length=0,l=state.initial),u}function fill_tokens(e,t,r){if(is_null(t))throw new Error("错误的填充数据:",t);for(var n=[],o=0;o<e.length;o++){var i=e[o];if("var"!==i.type)n.push(i);else{if("undefined"===i.value||"NaN"===i.value)throw new Error("key不应该为:".concat(i.value));for(var a=null,s=0;s<t.length;s++){var l=t[s],l=get_1(l,i.value);if(void 0!==l){a=l;break}}if(null===a)throw new Error("token填充失败,请确认".concat(i,"存在"));if("string"==typeof a){if(""===a.trim())throw new Error("token填充失败,".concat(i.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!RegexUnitNumber.test(a))throw new Error("token填充失败,".concat(i.value,"值:").concat(a,"为非法单位数字"))}else if(!is_str_number(a))throw new Error("token填充失败,".concat(i,"值:").concat(a,"为非法数字"))}a="string"!=typeof a?a.toString():a,n.push({type:"number",value:a})}}return n}function token2postfix(e){for(var t=[],r=[],n=e.map(function(e){return e.value});0<n.length;){var o=n.shift();if(is_operator(o))if("("===o)t.push(o);else if(")"===o){for(var i=t.pop();"("!==i&&0<t.length;)r.push(i),i=t.pop();if("("!==i)throw"error: unmatched ()"}else{for(;prioraty(o,t[t.length-1])&&0<t.length;)r.push(t.pop());t.push(o)}else r.push(o)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)r.push(t.pop())}return r}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 m,f,h,t,c,b,a,s,l,u,p,r=O.prototype={constructor:O,toString:null,valueOf:null},g=new O(1),y=20,$=4,_=-7,d=21,v=-1e7,S=1e7,w=!1,o=1,E=0,A={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},C="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function O(e,t){var r,n,o,i,a,s,l,c,u=this;if(!(u instanceof O))return new O(e,t);if(null==t){if(e&&!0===e._isBigNumber)return u.s=e.s,void(!e.c||e.e>S?u.c=u.e=null:e.e<v?u.c=[u.e=0]:(u.e=e.e,u.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(u.s=1/e<0?(e=-e,-1):1,e===~~e){for(i=0,a=e;10<=a;a/=10,i++);return void(S<i?u.c=u.e=null:(u.e=i,u.c=[e]))}c=String(e)}else{if(!isNumeric.test(c=String(e)))return h(u,c,s);u.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(a=(c=-1<(i=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(i<0&&(i=a),i+=+c.slice(a+1),c=c.substring(0,a)):i<0&&(i=c.length)}else{if(intCheck(t,2,C.length,"Base"),10==t&&T)return G(u=new O(e),y+u.e+1,$);if(c=String(e),s="number"==typeof e){if(0*e!=0)return h(u,c,s,t);if(u.s=1/e<0?(c=c.slice(1),-1):1,O.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(tooManyDigits+e)}else u.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=C.slice(0,t),i=a=0,l=c.length;a<l;a++)if(r.indexOf(n=c.charAt(a))<0){if("."==n){if(i<a){i=l;continue}}else if(!o&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){o=!0,a=-1,i=0;continue}return h(u,String(e),s,t)}s=!1,-1<(i=(c=f(c,t,10,u.s)).indexOf("."))?c=c.replace(".",""):i=c.length}for(a=0;48===c.charCodeAt(a);a++);for(l=c.length;48===c.charCodeAt(--l););if(c=c.slice(a,++l)){if(l-=a,s&&O.DEBUG&&15<l&&(MAX_SAFE_INTEGER<e||e!==mathfloor(e)))throw Error(tooManyDigits+u.s*e);if((i=i-a-1)>S)u.c=u.e=null;else if(i<v)u.c=[u.e=0];else{if(u.e=i,u.c=[],a=(i+1)%LOG_BASE,i<0&&(a+=LOG_BASE),a<l){for(a&&u.c.push(+c.slice(0,a)),l-=LOG_BASE;a<l;)u.c.push(+c.slice(a,a+=LOG_BASE));a=LOG_BASE-(c=c.slice(a)).length}else a-=l;for(;a--;c+="0");u.c.push(+c)}}else u.c=[u.e=0]}function N(e,t,r,n){for(var o,i,a=[0],s=0,l=e.length;s<l;){for(i=a.length;i--;a[i]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),o=0;o<a.length;o++)r-1<a[o]&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/r|0,a[o]%=r)}return a.reverse()}function k(e,t,r){var n,o,i,a=0,s=e.length,l=t%SQRT_BASE,c=t/SQRT_BASE|0;for(e=e.slice();s--;)a=((o=l*(i=e[s]%SQRT_BASE)+(n=c*i+(i=e[s]/SQRT_BASE|0)*l)%SQRT_BASE*SQRT_BASE+a)/r|0)+(n/SQRT_BASE|0)+c*i,e[s]=o%r;return e=a?[a].concat(e):e}function M(e,t,r,n){var o,i;if(r!=n)i=n<r?1:-1;else for(o=i=0;o<r;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function P(e,t,r,n){for(var o=0;r--;)e[r]-=o,o=e[r]<t[r]?1:0,e[r]=o*n+e[r]-t[r];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var o,i,a,s;if(null==r?r=$:intCheck(r,0,8),!e.c)return e.toString();if(o=e.c[0],i=e.e,null==t)s=coeffToString(e.c),s=1==n||2==n&&(i<=_||d<=i)?toExponential(s,i):toFixedPoint(s,i,"0");else if(r=(e=G(new O(e),t,r)).e,a=(s=coeffToString(e.c)).length,1==n||2==n&&(t<=r||r<=_)){for(;a<t;s+="0",a++);s=toExponential(s,r)}else if(t-=i,s=toFixedPoint(s,r,"0"),a<r+1){if(0<--t)for(s+=".";t--;s+="0");}else if(0<(t+=r-a))for(r+1==a&&(s+=".");t--;s+="0");return e.s<0&&o?"-"+s:s}function i(e,t){for(var r,n=1,o=new O(e[0]);n<e.length;n++){if(!(r=new O(e[n])).s){o=r;break}t.call(o,r)&&(o=r)}return o}function x(e,t,r){for(var n=1,o=t.length;!t[--o];t.pop());for(o=t[0];10<=o;o/=10,n++);return(r=n+r*LOG_BASE-1)>S?e.c=e.e=null:r<v?e.c=[e.e=0]:(e.e=r,e.c=t),e}function G(e,t,r,n){var o,i,a,s,l,c,u,f=e.c,h=POWS_TEN;if(f){e:{for(o=1,s=f[0];10<=s;s/=10,o++);if((i=t-o)<0)i+=LOG_BASE,a=t,u=(l=f[c=0])/h[o-a-1]%10|0;else if((c=mathceil((i+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=u=0,a=(i%=LOG_BASE)-LOG_BASE+(o=1)}else{for(l=s=f[c],o=1;10<=s;s/=10,o++);u=(a=(i%=LOG_BASE)-LOG_BASE+o)<0?0:l/h[o-a-1]%10|0}if(n=n||t<0||null!=f[c+1]||(a<0?l:l%h[o-a-1]),n=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):5<u||5==u&&(4==r||n||6==r&&(0<i?0<a?l/h[o-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]=h[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):f[0]=e.e=0,e;if(0==i?(f.length=c,s=1,c--):(f.length=c+1,s=h[LOG_BASE-i],f[c]=0<a?mathfloor(l/h[o-a]%h[a])*s:0),n)for(;;){if(0==c){for(i=1,a=f[0];10<=a;a/=10,i++);for(a=f[0]+=s,s=1;10<=a;a/=10,s++);i!=s&&(e.e++,f[0]==BASE)&&(f[0]=1);break}if(f[c]+=s,f[c]!=BASE)break;f[c--]=0,s=1}for(i=f.length;0===f[--i];f.pop());}e.e>S?e.c=e.e=null:e.e<v&&(e.c=[e.e=0])}return e}function B(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=_||d<=r?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return O.clone=clone,O.ROUND_UP=0,O.ROUND_DOWN=1,O.ROUND_CEIL=2,O.ROUND_FLOOR=3,O.ROUND_HALF_UP=4,O.ROUND_HALF_DOWN=5,O.ROUND_HALF_EVEN=6,O.ROUND_HALF_CEIL=7,O.ROUND_HALF_FLOOR=8,O.EUCLID=9,O.config=O.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),y=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),_=r[0],d=r[1]):(intCheck(r,-MAX,MAX,t),_=-(d=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),v=r[0],S=r[1];else{if(intCheck(r,-MAX,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);v=-(S=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&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw w=!r,Error(bignumberError+"crypto unavailable");w=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),o=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),E=r),e.hasOwnProperty(t="FORMAT")){if("object"!=_typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);A=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);T="0123456789"==r.slice(0,10),C=r}}return{DECIMAL_PLACES:y,ROUNDING_MODE:$,EXPONENTIAL_AT:[_,d],RANGE:[v,S],CRYPTO:w,MODULO_MODE:o,POW_PRECISION:E,FORMAT:A,ALPHABET:C}},O.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!O.DEBUG)return!0;var t,r,n=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===i||-1===i)&&-MAX<=o&&o<=MAX&&o===mathfloor(o))if(0===n[0]){if(0===o&&1===n.length)return!0}else if((t=(o+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||BASE<=r||r!==mathfloor(r))break e;if(0!==r)return!0}}else if(null===n&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},O.maximum=O.max=function(){return i(arguments,r.lt)},O.minimum=O.min=function(){return i(arguments,r.gt)},O.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return mathfloor(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,o,i,a=0,s=[],l=new O(g);if(null==e?e=y:intCheck(e,0,MAX),o=mathceil(e/LOG_BASE),w)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));a<o;)9e15<=(i=131072*t[a]+(t[a+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(s.push(i%1e14),a+=2);a=o/2}else{if(!crypto.randomBytes)throw w=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(o*=7);a<o;)9e15<=(i=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])?crypto.randomBytes(7).copy(t,a):(s.push(i%1e14),a+=7);a=o/7}if(!w)for(;a<o;)(i=c())<9e15&&(s[a++]=i%1e14);for(o=s[--a],e%=LOG_BASE,o&&e&&(i=POWS_TEN[LOG_BASE-e],s[a]=mathfloor(o/i)*i);0===s[a];s.pop(),a--);if(a<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(a=1,i=s[0];10<=i;i/=10,a++);a<LOG_BASE&&(n-=LOG_BASE-a)}return l.e=n,l.c=s,l}),O.sum=function(){for(var e=1,t=arguments,r=new O(t[0]);e<t.length;)r=r.plus(t[e++]);return r},b="0123456789",f=function(e,t,r,n,o){var i,a,s,l,c,u,f,h,p=e.indexOf("."),g=y,_=$;for(0<=p&&(l=E,E=0,e=e.replace(".",""),u=(h=new O(t)).pow(e.length-p),E=l,h.c=N(toFixedPoint(coeffToString(u.c),u.e,"0"),10,r,b),h.e=h.c.length),s=l=(f=N(e,t,r,o?(i=C,b):(i=b,C))).length;0==f[--l];f.pop());if(!f[0])return i.charAt(0);if(p<0?--s:(u.c=f,u.e=s,u.s=n,f=(u=m(u,h,g,_,r)).c,c=u.r,s=u.e),p=f[a=s+g+1],l=r/2,c=c||a<0||null!=f[a+1],c=_<4?(null!=p||c)&&(0==_||_==(u.s<0?3:2)):l<p||p==l&&(4==_||c||6==_&&1&f[a-1]||_==(u.s<0?8:7)),a<1||!f[0])e=c?toFixedPoint(i.charAt(1),-g,i.charAt(0)):i.charAt(0);else{if(f.length=a,c)for(--r;++f[--a]>r;)f[a]=0,a||(++s,f=[1].concat(f));for(l=f.length;!f[--l];);for(p=0,e="";p<=l;e+=i.charAt(f[p++]));e=toFixedPoint(e,s,i.charAt(0))}return e},m=function(e,t,r,n,o){var i,a,s,l,c,u,f,h,p,g,_,m,b,y,$,d,v,S=e.s==t.s?1:-1,w=e.c,E=t.c;if(!(w&&w[0]&&E&&E[0]))return new O(e.s&&t.s&&(w?!E||w[0]!=E[0]:E)?w&&0==w[0]||!E?0*S:S/0:NaN);for(p=(h=new O(S)).c=[],S=r+(a=e.e-t.e)+1,o||(o=BASE,a=bitFloor(e.e/LOG_BASE)-bitFloor(t.e/LOG_BASE),S=S/LOG_BASE|0),s=0;E[s]==(w[s]||0);s++);if(E[s]>(w[s]||0)&&a--,S<0)p.push(1),l=!0;else{for(y=w.length,d=E.length,S+=2,1<(c=mathfloor(o/(E[s=0]+1)))&&(E=k(E,c,o),w=k(w,c,o),d=E.length,y=w.length),b=d,_=(g=w.slice(0,d)).length;_<d;g[_++]=0);v=E.slice(),v=[0].concat(v),$=E[0],E[1]>=o/2&&$++;do{if(c=0,(i=M(E,g,d,_))<0){if(m=g[0],d!=_&&(m=m*o+(g[1]||0)),1<(c=mathfloor(m/$)))for(f=(u=k(E,c=o<=c?o-1:c,o)).length,_=g.length;1==M(u,g,f,_);)c--,P(u,d<f?v:E,f,o),f=u.length,i=1;else 0==c&&(i=c=1),f=(u=E.slice()).length;if(P(g,u=f<_?[0].concat(u):u,_,o),_=g.length,-1==i)for(;M(E,g,d,_)<1;)c++,P(g,d<_?v:E,_,o),_=g.length}else 0===i&&(c++,g=[0])}while(p[s++]=c,g[0]?g[_++]=w[b]||0:(g=[w[b]],_=1),(b++<y||null!=g[0])&&S--);l=null!=g[0],p[0]||p.splice(0,1)}if(o==BASE){for(s=1,S=p[0];10<=S;S/=10,s++);G(h,r+(h.e=s+a*LOG_BASE-1)+1,n,l)}else h.e=a,h.r=+l;return h},a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,s=/^([^.]+)\.$/,l=/^\.([^.]+)$/,u=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var o,i=r?t:t.replace(p,"");if(u.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!r&&(i=i.replace(a,function(e,t,r){return o="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=o?e:t}),n&&(o=n,i=i.replace(s,"$1").replace(l,"0.$1")),t!=i))return new O(i,o);if(O.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new O(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return compare(this,new O(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return intCheck(e,0,MAX),null==t?t=$:intCheck(t,0,8),G(new O(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return m(this,new O(e,t),y,$)},r.dividedToIntegerBy=r.idiv=function(e,t){return m(this,new O(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,o,i,a,s,l,c,u=this;if((e=new O(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+B(e));if(null!=t&&(t=new O(t)),a=14<e.e,!u.c||!u.c[0]||1==u.c[0]&&!u.e&&1==u.c.length||!e.c||!e.c[0])return c=new O(Math.pow(+B(u),a?e.s*(2-isOdd(e)):+B(e))),t?c.mod(t):c;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new O(NaN);(n=!s&&u.isInteger()&&t.isInteger())&&(u=u.mod(t))}else{if(9<e.e&&(0<u.e||u.e<-1||(0==u.e?1<u.c[0]||a&&24e7<=u.c[1]:u.c[0]<8e13||a&&u.c[0]<=9999975e7)))return i=u.s<0&&isOdd(e)?-0:0,-1<u.e&&(i=1/i),new O(s?1/i:i);E&&(i=mathceil(E/LOG_BASE+2))}for(l=a?(r=new O(.5),s&&(e.s=1),isOdd(e)):(o=Math.abs(+B(e)))%2,c=new O(g);;){if(l){if(!(c=c.times(u)).c)break;i?c.c.length>i&&(c.c.length=i):n&&(c=c.mod(t))}if(o){if(0===(o=mathfloor(o/2)))break;l=o%2}else if(G(e=e.times(r),e.e+1,1),14<e.e)l=isOdd(e);else{if(0===(o=+B(e)))break;l=o%2}u=u.times(u),i?u.c&&u.c.length>i&&(u.c.length=i):n&&(u=u.mod(t))}return n?c:(s&&(c=g.div(c)),t?c.mod(t):i?G(c,E,$,void 0):c)},r.integerValue=function(e){var t=new O(this);return null==e?e=$:intCheck(e,0,8),G(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===compare(this,new O(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<compare(this,new O(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=compare(this,new O(e,t)))||0===t},r.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return compare(this,new O(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=compare(this,new O(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,o,i,a=this,s=a.s;if(t=(e=new O(e,t)).s,!s||!t)return new O(NaN);if(s!=t)return e.s=-t,a.plus(e);var l=a.e/LOG_BASE,c=e.e/LOG_BASE,u=a.c,f=e.c;if(!l||!c){if(!u||!f)return u?(e.s=-t,e):new O(f?a:NaN);if(!u[0]||!f[0])return f[0]?(e.s=-t,e):new O(u[0]?a:3==$?-0:0)}if(l=bitFloor(l),c=bitFloor(c),u=u.slice(),s=l-c){for((o=(i=s<0)?(s=-s,u):(c=l,f)).reverse(),t=s;t--;o.push(0));o.reverse()}else for(n=(i=(s=u.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(u[t]!=f[t]){i=u[t]<f[t];break}if(i&&(o=u,u=f,f=o,e.s=-e.s),0<(t=(n=f.length)-(r=u.length)))for(;t--;u[r++]=0);for(t=BASE-1;s<n;){if(u[--n]<f[n]){for(r=n;r&&!u[--r];u[r]=t);--u[r],u[n]+=BASE}u[n]-=f[n]}for(;0==u[0];u.splice(0,1),--c);return u[0]?x(e,u,c):(e.s=3==$?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new O(e,t),!n.c||!e.s||e.c&&!e.c[0]?new O(NaN):!e.c||n.c&&!n.c[0]?new O(n):(9==o?(t=e.s,e.s=1,r=m(n,e,0,3),e.s=t,r.s*=t):r=m(n,e,0,o),(e=n.minus(r.times(e))).c[0]||1!=o||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,o,i,a,s,l,c,u,f,h,p,g,_=this,m=_.c,b=(e=new O(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!_.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=_.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=bitFloor(_.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=_.s,(s=m.length)<(_=b.length)&&(h=m,m=b,b=h,n=s,s=_,_=n),n=s+_,h=[];n--;h.push(0));for(p=BASE,g=SQRT_BASE,n=_;0<=--n;){for(u=b[n]%g,f=b[n]/g|(r=0),o=n+(i=s);n<o;)r=((l=u*(l=m[--i]%g)+(a=f*l+(c=m[i]/g|0)*u)%g*g+h[o]+r)/p|0)+(a/g|0)+f*c,h[o--]=l%p;h[o]=r}return r?++t:h.splice(0,1),x(e,h,t)},r.negated=function(){var e=new O(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,o=n.s;if(t=(e=new O(e,t)).s,!o||!t)return new O(NaN);if(o!=t)return e.s=-t,n.minus(e);var i=n.e/LOG_BASE,a=e.e/LOG_BASE,s=n.c,l=e.c;if(!i||!a){if(!s||!l)return new O(o/0);if(!s[0]||!l[0])return l[0]?e:new O(s[0]?n:0*o)}if(i=bitFloor(i),a=bitFloor(a),s=s.slice(),o=i-a){for((r=0<o?(a=i,l):(o=-o,s)).reverse();o--;r.push(0));r.reverse()}for((o=s.length)-(t=l.length)<0&&(r=l,l=s,s=r,t=o),o=0;t;)o=(s[--t]=s[t]+l[t]+o)/BASE|0,s[t]=BASE===s[t]?0:s[t]%BASE;return o&&(s=[o].concat(s),++a),x(e,s,a)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=$:intCheck(t,0,8),G(new O(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*LOG_BASE+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,o,i=this,a=i.c,s=i.s,l=i.e,c=y+4,u=new O("0.5");if(1!==s||!a||!a[0])return new O(!s||s<0&&(!a||a[0])?NaN:a?i:1/0);if((r=0==(s=Math.sqrt(+B(i)))||s==1/0?(((t=coeffToString(a)).length+l)%2==0&&(t+="0"),s=Math.sqrt(+t),l=bitFloor((l+1)/2)-(l<0||l%2),new O(t=s==1/0?"5e"+l:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+l)):new O(s+"")).c[0])for((s=(l=r.e)+c)<3&&(s=0);;)if(o=r,r=u.times(o.plus(m(i,o,c,1))),coeffToString(o.c).slice(0,s)===(t=coeffToString(r.c)).slice(0,s)){if(r.e<l&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(G(r,r.e+y+2,1),e=!r.times(r).eq(i));break}if(!n&&(G(o,o.e+y+2,0),o.times(o).eq(i))){r=o;break}c+=4,s+=4,n=1}return G(r,r.e+y+1,$,e)},r.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==_typeof(t)?(r=t,t=null):e&&"object"==_typeof(e)?(r=e,e=t=null):r=A;else if("object"!=_typeof(r))throw Error(bignumberError+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),o=+r.groupSize,i=+r.secondaryGroupSize,a=r.groupSeparator||"",s=t[0],t=t[1],l=this.s<0,c=l?s.slice(1):s,u=c.length;if(i&&(n=o,o=i,u-=i=n),0<o&&0<u){for(s=c.substr(0,n=u%o||o);n<u;n+=o)s+=a+c.substr(n,o);0<i&&(s+=a+c.slice(n)),l&&(s="-"+s)}e=t?s+(r.decimalSeparator||"")+((i=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+i+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):s}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,o,i,a,s,l,c,u,f=this,h=f.c;if(null!=e&&(!(s=new O(e)).isInteger()&&(s.c||1!==s.s)||s.lt(g)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+B(s));if(!h)return new O(f);for(t=new O(g),c=r=new O(g),n=l=new O(g),h=coeffToString(h),i=t.e=h.length-f.e-1,t.c[0]=POWS_TEN[(a=i%LOG_BASE)<0?LOG_BASE+a:a],e=!e||0<s.comparedTo(t)?0<i?t:c:s,a=S,S=1/0,s=new O(h),l.c[0]=0;u=m(s,t,0,1),1!=(o=r.plus(u.times(n))).comparedTo(e);)r=n,n=o,c=l.plus(u.times(o=c)),l=o,t=s.minus(u.times(o=t)),s=o;return o=m(e.minus(r),n,0,1),l=l.plus(o.times(c)),r=r.plus(o.times(n)),l.s=c.s=f.s,h=m(c,n,i*=2,$).minus(f).abs().comparedTo(m(l,r,i,$).minus(f).abs())<1?[c,n]:[l,r],S=a,h},r.toNumber=function(){return+B(this)},r.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,o=r.e;return null===o?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?o<=_||d<=o?toExponential(coeffToString(r.c),o):toFixedPoint(coeffToString(r.c),o,"0"):10===e&&T?toFixedPoint(coeffToString((r=G(new O(r),y+o+1,$)).c),r.e,"0"):(intCheck(e,2,C.length,"Base"),f(toFixedPoint(coeffToString(r.c),o,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return B(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&O.set(e),O}function bitFloor(e){var t=0|e;return 0<e||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,o=e.length,i=e[0]+"";n<o;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function compare(e,t){var r,n,o=e.c,i=t.c,a=e.s,s=t.s,e=e.e,t=t.e;if(!a||!s)return null;if(r=o&&!o[0],n=i&&!i[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=e==t,!o||!i)return n?0:!o^r?1:-1;if(!n)return t<e^r?1:-1;for(s=(e=o.length)<(t=i.length)?e:t,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^r?1:-1;return e==t?0:t<e^r?1:-1}function intCheck(e,t,r,n){if(e<t||r<e||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||r<e?" 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(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,o;if(t<0){for(o=r+".";++t;o+=r);e=o+e}else if(++t>(n=e.length)){for(o=r,t-=n;--t;o+=r);e+=o}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();function eval_postfix(e){for(var t=[];0<e.length;){var r=e.shift();if(is_operator(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),o=t.pop();if("string"==typeof n&&!BigNumber.isBigNumber(n)){if(!is_str_number(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new BigNumber(n)}if("string"==typeof o&&!BigNumber.isBigNumber(o)){if(!is_str_number(o))throw new Error("".concat(o,"不是一个合法的数字"));o=new BigNumber(o)}switch(r){case"+":t.push(o.plus(n));break;case"-":t.push(o.minus(n));break;case"*":t.push(o.times(n));break;case"/":t.push(o.div(n));break;case"%":t.push(o.mod(n));break;case"**":t.push(o.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var i=t[0];if((i=BigNumber.isBigNumber(i)?i:BigNumber(i)).isNaN())throw new Error("计算结果为NaN");return i}function decimal_round(n,o,e,i,t){var a=n,s=o,r=o.length,l={"~-":function(){s=o.slice(0,i)},"~+":function(){""===(s=o.slice(0,i))?a=n.slice(0,n.length-1)+(+n[n.length-1]+1):s=s.slice(0,i-1)+(+s[i-1]+1)},"~5":function(){s=o.slice(0,i);var e=+o[i];""===s?5<=e&&(a=n.slice(0,n.length-1)+(+n[n.length-1]+1)):5<=e&&(s=s.slice(0,i-1)+(+s[i-1]+1))},"~6":function(){s=o.slice(0,i);var e=""===(e=o.slice(+i+1,o.length))?0:parseInt(e),t=+o[i],r=+n[n.length-1];""===s?(6<=t||5==t&&0<e||5==t&&r%2!=0)&&(a=n.slice(0,n.length-1)+(+n[n.length-1]+1)):(r=+o[i-1],(6<=t||5==t&&0<e||5==t&&r%2!=0)&&(s=s.slice(0,i-1)+(+s[i-1]+1)))}};return"<="===e?s=r<=i?o:(l[t]&&l[t](),s.replace(/0+$/,"")):"="===e?r<i?s=o+"0".repeat(i-r):i<r&&l[t]&&l[t]():">="===e&&r<i&&(s=o+"0".repeat(i-r)),{int_part:a,dec_part:s}}function format(e,t){var r,n,o,i,a,s,l,c,u="";return BigNumber.isBigNumber(e)?u=e.toFixed():"string"!=typeof e&&(u=e.toString()),"undefined"===u||"NaN"===u?null:(a="~-",c=l=s=i=o=n=r=null,t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","="].includes(e.value))throw new Error("错误的格式化参数:",e.value);n=e.value}else if("comma"===t)o=!0;else if("number"===t)r=e.value;else if("plus"===t)i=!0;else if("round"===t)a=e.value;else if("fraction"===t)l=!0;else if("scientific"===t)s=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");c=!0}}),s?(e=BigNumber(u).toExponential(),i&&!e.startsWith("-")?"+"+e:e):l?(t=BigNumber(u).toFraction().map(function(e){return e.toFixed()}).join("/"),i&&!t.startsWith("-")?"+"+t:t):(c&&(u=BigNumber(u).times(100).toFixed()),r&&(t=(e=decimal_round(t=(e=u.split("."))[0],1===e.length?"":e[1],n,r,a)).int_part,u=""===(e=e.dec_part)?t:"".concat(t,".").concat(e)),o&&(u=1<(t=u.split(".")).length?((e=t[0]).includes("-")?t[0]=e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t[0]=e.replace(/(?=(?!^)(?:\d{3})+$)/g,","),t.join(".")):(e=t[0]).includes("-")?e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):e.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),null===i||u.startsWith("-")||(u="+"+u),c&&(u+="%"),u))}function fill_fmt_tokens(e,n){return e.map(function(e){if("var"!==e.type)return e;for(var t,r=0;r<n.length&&!not_undefined(t=get_1(n[r],e.value));r++);if(is_number(t))return{type:"number",value:t};throw new Error("错误的填充值")})}function get_token_and_unit(e){var r=null;return e.length,{tokens:e.map(function(e){var t=split_unit_num(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}var getNative$4=_getNative,baseGetTag$1=(!function(){try{var e=getNative$4(Object,"defineProperty");e({},"",{})}catch(e){}}(),_baseGetTag),isObjectLike$1=isObjectLike_1,argsTag="[object Arguments]";function baseIsArguments$1(e){return isObjectLike$1(e)&&baseGetTag$1(e)==argsTag}var _baseIsArguments=baseIsArguments$1,baseIsArguments=baseIsArguments$1,isObjectLike=isObjectLike_1,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,propertyIsEnumerable=objectProto.propertyIsEnumerable,isBuffer=(baseIsArguments(function(){return arguments}()),{exports:{}});function stubFalse(){return!1}var stubFalse_1=stubFalse,_nodeUtil=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,r=r&&r.exports===t?_root.Buffer:void 0,t=r?r.isBuffer:void 0;e.exports=t||stubFalse_1}(isBuffer,isBuffer.exports),{exports:{}}),nodeUtil$5=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,n=r&&r.exports===t&&_freeGlobal.process,t=function(){try{var e=r&&r.require&&r.require("util").types;return e?e:n&&n.binding&&n.binding("util")}catch(e){}}();e.exports=t}(_nodeUtil,_nodeUtil.exports),_nodeUtil.exports),_cloneBuffer=(nodeUtil$5&&nodeUtil$5.isTypedArray,{exports:{}}),getNative$3=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,r=r&&r.exports===t?_root.Buffer:void 0,n=r?r.allocUnsafe:void 0;e.exports=function(e,t){return t?e.slice():(t=e.length,t=n?n(t):new e.constructor(t),e.copy(t),t)}}(_cloneBuffer,_cloneBuffer.exports),_getNative),root$5=_root,DataView$1=_getNative(_root,"DataView"),_DataView=DataView$1,getNative$2=_getNative,root$4=_root,Promise$2=_getNative(_root,"Promise"),_Promise=Promise$2,getNative$1=_getNative,root$3=_root,Set$1=_getNative(_root,"Set"),_Set=Set$1,getNative=_getNative,root$2=_root,WeakMap$1=_getNative(_root,"WeakMap"),_WeakMap=WeakMap$1,DataView=_DataView,Map=_Map,Promise$1=_Promise,Set=_Set,WeakMap=WeakMap$1,baseGetTag=_baseGetTag,toSource=_toSource,mapTag="[object Map]",objectTag="[object Object]",promiseTag="[object Promise]",setTag="[object Set]",weakMapTag="[object WeakMap]",dataViewTag="[object DataView]",dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap),getTag=baseGetTag,root$1=((DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag)&&(getTag=function(e){var t=baseGetTag(e),e=t==objectTag?e.constructor:void 0,e=e?toSource(e):"";if(e)switch(e){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}return t}),_root),_Symbol$2=(_root.Uint8Array,_Symbol$6),symbolProto$1=_Symbol$6?_Symbol$6.prototype:void 0,nodeUtil$4=(symbolProto$1&&symbolProto$1.valueOf,_nodeUtil.exports),nodeUtil$3=(nodeUtil$4&&nodeUtil$4.isMap,_nodeUtil.exports),nodeUtil$2=(nodeUtil$3&&nodeUtil$3.isSet,_nodeUtil.exports),nodeUtil$1=(nodeUtil$2&&nodeUtil$2.isArrayBuffer,_nodeUtil.exports),funcProto=(nodeUtil$1&&nodeUtil$1.isDate,Function.prototype),funcToString=funcProto.toString,_Symbol$1=(funcToString.call(Object),_Symbol$6),symbolProto=_Symbol$6?_Symbol$6.prototype:void 0,root=(symbolProto&&symbolProto.valueOf,_root),nodeUtil=(_root.isFinite,_nodeUtil.exports),_Symbol=(nodeUtil&&nodeUtil.isRegExp,_Symbol$6);function calc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=parse_args(t),o=get_1(n,"options._error",void 0),i=get_1(n,"options._debug",!1),a=get_1(n,"options._unit",!1),s=n.options,l=null;if(n.fmt_err||n.expr_err){if(not_undefined(o))return o;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(not_undefined(o))try{c=tokenizer(n.expr,a)}catch(e){return o}else c=tokenizer(n.expr,a);if(i&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),not_null(s)){var c,u=[];if(Array.isArray(s)?u=s:(u.push(s),not_undefined(s=get_1(s,"_fill_data",{}))&&(Array.isArray(s)?u=[].concat(_toConsumableArray(u),_toConsumableArray(s)):u.push(s))),not_undefined(o))try{c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u))}catch(e){return o}else c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u));[!0,"on","auto","space"].includes(a)&&(l=(s=get_token_and_unit(c)).unit,c=s.tokens)}u=token2postfix(c),i&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(u),console.warn("单位:".concat(l))),a=null;if(not_undefined(o))try{a=eval_postfix(u)}catch(e){return o}else a=eval_postfix(u);if("Infinity"!==(a=not_null(n.fmt)?format(a,n.fmt):null!==a?a.toFixed():null)&&null!==a)return null!==l&&(a+=l),a;if(not_undefined(o))return o;throw new Error("计算错误可能是非法的计算式")}_Symbol$6&&_Symbol$6.iterator,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: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");var fmt=calc;export{calc,fmt,version};
|
|
1
|
+
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})(e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){var r;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name: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.")}var version="1.1.0",RegexNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,RegexUnitNumber=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function is_operator(e){return-1<"+-*/%()**".indexOf(e)}function get_prioraty(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;case"**":return 3;default:return 0}}function prioraty(e,t){return get_prioraty(e)<=get_prioraty(t)}function not_undefined(e){return void 0!==e}function is_null(e){return null===e}function not_null(e){return null!==e}function is_number(e){return"number"==typeof e||is_str_number(e)}function is_str_number(e){return"string"==typeof e&&!!RegexNumber.test(e)}function split_unit_num(e){for(var t,r,n=null,o=null,i=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,/^([+-]?[\d.]+)(.*)$/],a=0;a<i.length;a++){var s=e.match(i[a]);if(s){t=s;break}}return t&&(o=t[1],""!==(r=t[2]).trim())&&(n=r),{num:o,unit:n}}var state$1={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",scientific:"scientific"},symbol="<>=";function fmt_tokenizer(e){for(var t=state$1.initial,r=[],n=[];e;){var o=e[0];if(t===state$1.initial)if(symbol.includes(o))t=state$1.symbol,r.push(o),e=e.slice(1);else if("~"===o)t=state$1.round,r.push(o),e=e.slice(1);else if("-"===o){if(t=state$1.initial,/[Ee]/.test(e[1]))n.push({type:"scientific",value:e[1]});else{if(!/[Nn]/.test(e[1]))throw new Error("不识别的fmt字符:".concat(e.slice(2)));n.push({type:"to-number",value:e[1]})}e=e.slice(2)}else{if("/"===o)t=state$1.initial,n.push({type:"fraction",value:o});else if(/[a-zA-Z_]/.test(o))t=state$1.variable,r.push(o);else if(/\d/.test(o))t=state$1.number,r.push(o);else if("+"===o)t=state$1.initial,n.push({type:"plus",value:o});else if(","===o)t=state$1.initial,n.push({type:"comma",value:o});else if("%"===o)t=state$1.initial,n.push({type:"percent",value:o});else if(!/\s/.test(o))throw new Error("不识别的fmt字符:".concat(o));e=e.slice(1)}else if(t===state$1.number)/\d/.test(o)?(r.push(o),e=e.slice(1)):(n.push({type:"number",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.variable)/[\$\w_\-.\[\]"']/.test(o)?(r.push(o),e=e.slice(1)):(n.push({type:"var",value:r.join("")}),r.length=0,t=state$1.initial);else if(t===state$1.symbol)/\s/.test(o)?e=e.slice(1):symbol.includes(o)?(r.push(o),e=e.slice(1)):(n.push({type:"symbol",value:r.join("")}),r.length=0,t=state$1.initial);else{if(t!==state$1.round)throw new Error("错误的自动机状态");if(/\s/.test(o))e=e.slice(1);else{if(!("56+-".includes(o)&&r.length<2))throw new Error("舍入格式化语法错误:".concat(o));r.push(o),e=e.slice(1),n.push({type:"round",value:r.join("")}),r.length=0,t=state$1.initial}}}if(0<r.length&&(n.push({type:t,value:r.join("")}),r.length=0,t=state$1.initial),1<n.filter(function(e){return"number"===e.type}).length)throw new Error("格式化字符串错误,发现多余的数字");return n}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},isArray$3=Array.isArray,isArray_1=isArray$3,freeGlobal$1="object"==_typeof(commonjsGlobal)&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root$9=freeGlobal||freeSelf||Function("return this")(),_root=root$9,root$8=_root,_Symbol2=_root.Symbol,_Symbol$6=_Symbol2,_Symbol$5=_Symbol$6,objectProto$5=Object.prototype,hasOwnProperty$4=objectProto$5.hasOwnProperty,nativeObjectToString$1=objectProto$5.toString,symToStringTag$1=_Symbol$5?_Symbol$5.toStringTag:void 0;function getRawTag$1(e){var t=hasOwnProperty$4.call(e,symToStringTag$1),r=e[symToStringTag$1];try{var n=!(e[symToStringTag$1]=void 0)}catch(e){}var o=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),o}var _getRawTag=getRawTag$1,objectProto$4=Object.prototype,nativeObjectToString=objectProto$4.toString;function objectToString$1(e){return nativeObjectToString.call(e)}var _objectToString=objectToString$1,_Symbol$4=_Symbol$6,getRawTag=_getRawTag,objectToString=objectToString$1,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol$6?_Symbol$6.toStringTag:void 0;function baseGetTag$4(e){return null==e?void 0===e?undefinedTag:nullTag:(symToStringTag&&symToStringTag in Object(e)?getRawTag:objectToString)(e)}var _baseGetTag=baseGetTag$4;function isObjectLike$3(e){return null!=e&&"object"==_typeof(e)}var isObjectLike_1=isObjectLike$3,baseGetTag$3=_baseGetTag,isObjectLike$2=isObjectLike_1,symbolTag="[object Symbol]";function isSymbol$3(e){return"symbol"==_typeof(e)||isObjectLike$2(e)&&baseGetTag$3(e)==symbolTag}var isSymbol_1=isSymbol$3,isArray$2=isArray_1,isSymbol$2=isSymbol_1,reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey$1(e,t){var r;return!isArray$2(e)&&(!("number"!=(r=_typeof(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol$2(e))||reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}var _isKey=isKey$1;function isObject$2(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var isObject_1=isObject$2,baseGetTag$2=_baseGetTag,isObject$1=isObject_1,asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(e){return!!isObject$1(e)&&((e=baseGetTag$2(e))==funcTag||e==genTag||e==asyncTag||e==proxyTag)}var isFunction_1=isFunction$1,root$7=_root,coreJsData$1=_root["__core-js_shared__"],_coreJsData=coreJsData$1,coreJsData=coreJsData$1,maskSrcKey=function(){var e=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked$1(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked$1,funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource$2(e){if(null!=e){try{return funcToString$2.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource$2,isFunction=isFunction_1,isMasked=_isMasked,isObject=isObject_1,toSource$1=_toSource,reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$3=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$3=objectProto$3.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$3).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative$1(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource$1(e))}var _baseIsNative=baseIsNative$1;function getValue$1(e,t){return null==e?void 0:e[t]}var _getValue=getValue$1,baseIsNative=baseIsNative$1,getValue=getValue$1;function getNative$7(e,t){e=getValue(e,t);return baseIsNative(e)?e:void 0}var _getNative=getNative$7,getNative$6=_getNative,nativeCreate$4=_getNative(Object,"create"),_nativeCreate=nativeCreate$4,nativeCreate$3=_nativeCreate;function hashClear$1(){this.__data__=nativeCreate$3?nativeCreate$3(null):{},this.size=0}var _hashClear=hashClear$1;function hashDelete$1(e){e=this.has(e)&&delete this.__data__[e];return this.size-=e?1:0,e}var _hashDelete=hashDelete$1,nativeCreate$2=_nativeCreate,HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$2=Object.prototype,hasOwnProperty$2=objectProto$2.hasOwnProperty;function hashGet$1(e){var t,r=this.__data__;return nativeCreate$2?(t=r[e])===HASH_UNDEFINED$1?void 0:t:hasOwnProperty$2.call(r,e)?r[e]:void 0}var _hashGet=hashGet$1,nativeCreate$1=_nativeCreate,objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashHas$1(e){var t=this.__data__;return nativeCreate$1?void 0!==t[e]:hasOwnProperty$1.call(t,e)}var _hashHas=hashHas$1,nativeCreate=_nativeCreate,HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet$1(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}var _hashSet=hashSet$1,hashClear=_hashClear,hashDelete=_hashDelete,hashGet=_hashGet,hashHas=hashHas$1,hashSet=hashSet$1;function Hash$1(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])}}Hash$1.prototype.clear=hashClear,Hash$1.prototype.delete=hashDelete,Hash$1.prototype.get=hashGet,Hash$1.prototype.has=hashHas,Hash$1.prototype.set=hashSet;var _Hash=Hash$1;function listCacheClear$1(){this.__data__=[],this.size=0}var _listCacheClear=listCacheClear$1;function eq$1(e,t){return e===t||e!=e&&t!=t}var eq_1=eq$1,eq=eq$1;function assocIndexOf$4(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}var _assocIndexOf=assocIndexOf$4,assocIndexOf$3=_assocIndexOf,arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete$1(e){var t=this.__data__,e=assocIndexOf$3(t,e);return!(e<0||(e==t.length-1?t.pop():splice.call(t,e,1),--this.size,0))}var _listCacheDelete=listCacheDelete$1,assocIndexOf$2=_assocIndexOf;function listCacheGet$1(e){var t=this.__data__,e=assocIndexOf$2(t,e);return e<0?void 0:t[e][1]}var _listCacheGet=listCacheGet$1,assocIndexOf$1=_assocIndexOf;function listCacheHas$1(e){return-1<assocIndexOf$1(this.__data__,e)}var _listCacheHas=listCacheHas$1,assocIndexOf=_assocIndexOf;function listCacheSet$1(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var _listCacheSet=listCacheSet$1,listCacheClear=_listCacheClear,listCacheDelete=listCacheDelete$1,listCacheGet=listCacheGet$1,listCacheHas=listCacheHas$1,listCacheSet=listCacheSet$1;function ListCache$1(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$1.prototype.clear=listCacheClear,ListCache$1.prototype.delete=listCacheDelete,ListCache$1.prototype.get=listCacheGet,ListCache$1.prototype.has=listCacheHas,ListCache$1.prototype.set=listCacheSet;var _ListCache=ListCache$1,getNative$5=_getNative,root$6=_root,Map$2=_getNative(_root,"Map"),_Map=Map$2,Hash=_Hash,ListCache=_ListCache,Map$1=_Map;function mapCacheClear$1(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}var _mapCacheClear=mapCacheClear$1;function isKeyable$1(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var _isKeyable=isKeyable$1,isKeyable=isKeyable$1;function getMapData$4(e,t){e=e.__data__;return isKeyable(t)?e["string"==typeof t?"string":"hash"]:e.map}var _getMapData=getMapData$4,getMapData$3=getMapData$4;function mapCacheDelete$1(e){e=getMapData$3(this,e).delete(e);return this.size-=e?1:0,e}var _mapCacheDelete=mapCacheDelete$1,getMapData$2=getMapData$4;function mapCacheGet$1(e){return getMapData$2(this,e).get(e)}var _mapCacheGet=mapCacheGet$1,getMapData$1=getMapData$4;function mapCacheHas$1(e){return getMapData$1(this,e).has(e)}var _mapCacheHas=mapCacheHas$1,getMapData=getMapData$4;function mapCacheSet$1(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var _mapCacheSet=mapCacheSet$1,mapCacheClear=mapCacheClear$1,mapCacheDelete=mapCacheDelete$1,mapCacheGet=mapCacheGet$1,mapCacheHas=mapCacheHas$1,mapCacheSet=mapCacheSet$1;function MapCache$1(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$1.prototype.clear=mapCacheClear,MapCache$1.prototype.delete=mapCacheDelete,MapCache$1.prototype.get=mapCacheGet,MapCache$1.prototype.has=mapCacheHas,MapCache$1.prototype.set=mapCacheSet;var _MapCache=MapCache$1,MapCache=MapCache$1,FUNC_ERROR_TEXT="Expected a function";function memoize$1(n,o){if("function"!=typeof n||null!=o&&"function"!=typeof o)throw new TypeError(FUNC_ERROR_TEXT);function i(){var e=arguments,t=o?o.apply(this,e):e[0],r=i.cache;return r.has(t)?r.get(t):(e=n.apply(this,e),i.cache=r.set(t,e)||r,e)}return i.cache=new(memoize$1.Cache||MapCache),i}memoize$1.Cache=MapCache;var memoize_1=memoize$1,memoize=memoize$1,MAX_MEMOIZE_SIZE=500;function memoizeCapped$1(e){var e=memoize(e,function(e){return t.size===MAX_MEMOIZE_SIZE&&t.clear(),e}),t=e.cache;return e}var _memoizeCapped=memoizeCapped$1,memoizeCapped=memoizeCapped$1,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath$1=memoizeCapped$1(function(e){var o=[];return 46===e.charCodeAt(0)&&o.push(""),e.replace(rePropName,function(e,t,r,n){o.push(r?n.replace(reEscapeChar,"$1"):t||e)}),o}),_stringToPath=stringToPath$1;function arrayMap$1(e,t){for(var r=-1,n=null==e?0:e.length,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}var _arrayMap=arrayMap$1,_Symbol$3=_Symbol$6,arrayMap=arrayMap$1,isArray$1=isArray_1,isSymbol$1=isSymbol_1,INFINITY$1=1/0,symbolProto$2=_Symbol$6?_Symbol$6.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString$1(e){var t;return"string"==typeof e?e:isArray$1(e)?arrayMap(e,baseToString$1)+"":isSymbol$1(e)?symbolToString?symbolToString.call(e):"":"0"==(t=e+"")&&1/e==-INFINITY$1?"-0":t}var _baseToString=baseToString$1,baseToString=baseToString$1;function toString$1(e){return null==e?"":baseToString(e)}var toString_1=toString$1,isArray=isArray_1,isKey=_isKey,stringToPath=_stringToPath,toString=toString$1;function castPath$1(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}var _castPath=castPath$1,isSymbol=isSymbol_1,INFINITY=1/0;function toKey$1(e){var t;return"string"==typeof e||isSymbol(e)?e:"0"==(t=e+"")&&1/e==-INFINITY?"-0":t}var _toKey=toKey$1,castPath=castPath$1,toKey=toKey$1;function baseGet$1(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}var _baseGet=baseGet$1,baseGet=baseGet$1;function get(e,t,r){e=null==e?void 0:baseGet(e,t);return void 0===e?r:e}var get_1=get;function parse_args(e){var t={expr:"",fmt:null,options:null,fmt_err:!1,expr_err:!1},r="",n=e[0],o=e[1],o=(not_undefined(o)&&(t.options=o),get_1(o,"_error",!1));if(0===e.length)throw new Error("至少传入一个参数");if("string"==typeof n){if(""===(r=n).trim()||n.includes("NaN"))return t.expr_err=!0,t}else{if("number"!=typeof n){if(!0===o)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(_typeof(n)))}r=n.toString()}e=r.split("|");if(t.expr=e[0],1<e.length){o=e[1];if(""!==o.trim())try{t.fmt=fmt_tokenizer(o)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var i,n=[];try{n=fmt_tokenizer(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(i=t.fmt.map(function(e){return e.type}),n.forEach(function(e){i.includes(e.type)||t.fmt.push(e)}))}return t}var state={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},signed="+-",operator="*/%",brackets="()";function tokenizer(e){function t(){c.push(o),e=e.slice(1)}function r(e){u.push({type:e,value:c.join("")}),c.length=0}function n(){e=e.slice(1)}for(var o,i,a,s=1<arguments.length&&void 0!==arguments[1]&&arguments[1],l=state.initial,c=[],u=[];e;)switch(o=e[0],l){case state.initial:if(signed.includes(o)){var f=u.at(-1),l=0===u.length||"operator"===f.type||"("===f?state.number:state.operator;t()}else if(operator.includes(o))l=state.operator,t();else if(/\d/.test(o))l=state.number,t();else if(brackets.includes(o))l=state.bracket;else if(/[a-zA-Z_$]/.test(o))l=state.var,t();else{if(!/\s/.test(o))throw new Error("不识别的字符".concat(o));n()}break;case state.bracket:u.push({type:state.bracket,value:o}),n(),l=state.initial;break;case state.operator:f=c.at(-1);"*"===o&&"*"===f&&t(),r(state.operator),l=state.initial;break;case state.number:if(/\d/.test(o))t();else if("."===o){if(0===c.length||c.includes("."))throw new Error("非法的小数部分".concat(c.join("")));t()}else"Ee".includes(o)?(l=state.scientific,t()):["auto","on",!0].includes(s)&&/[^*/+\-()\s]/.test(o)||"space"===s&&/\S/.test(o)?t():(r(state.number),l=state.initial);break;case state.scientific:/\d/.test(o)?t():signed.includes(o)?(i=c.slice(1),a=c.at(-1),i.includes(o)||!/[Ee]/.test(a)?(r(state.scientific),l=state.initial):t()):["auto","on",!0].includes(s)&&/[^*/+\-()\s]/.test(o)||"space"===s&&/\S/.test(o)?t():(r(state.scientific),l=state.initial);break;case state.var:/[\w_.\[\]"']/.test(o)?t():(r(state.var),l=state.initial);break;default:throw new Error("状态错误")}return 0!==c.length&&(u.push({type:l,value:c.join("")}),c.length=0,l=state.initial),u}function fill_tokens(e,t,r){if(is_null(t))throw new Error("错误的填充数据:",t);for(var n=[],o=0;o<e.length;o++){var i=e[o];if("var"!==i.type)n.push(i);else{if("undefined"===i.value||"NaN"===i.value)throw new Error("key不应该为:".concat(i.value));for(var a=null,s=0;s<t.length;s++){var l=t[s],l=get_1(l,i.value);if(void 0!==l){a=l;break}}if(null===a)throw new Error("token填充失败,请确认".concat(i,"存在"));if("string"==typeof a){if(""===a.trim())throw new Error("token填充失败,".concat(i.value,"值不可为空字符"));if([!0,"on","auto","space"].includes(r)){if(!RegexUnitNumber.test(a))throw new Error("token填充失败,".concat(i.value,"值:").concat(a,"为非法单位数字"))}else if(!is_str_number(a))throw new Error("token填充失败,".concat(i,"值:").concat(a,"为非法数字"))}a="string"!=typeof a?a.toString():a,n.push({type:"number",value:a})}}return n}function token2postfix(e){for(var t=[],r=[],n=e.map(function(e){return e.value});0<n.length;){var o=n.shift();if(is_operator(o))if("("===o)t.push(o);else if(")"===o){for(var i=t.pop();"("!==i&&0<t.length;)r.push(i),i=t.pop();if("("!==i)throw"error: unmatched ()"}else{for(;prioraty(o,t[t.length-1])&&0<t.length;)r.push(t.pop());t.push(o)}else r.push(o)}if(0<t.length){if(")"===t[t.length-1]||"("===t[t.length-1])throw"error: unmatched ()";for(;0<t.length;)r.push(t.pop())}return r}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 m,f,h,t,c,b,a,s,l,u,p,r=O.prototype={constructor:O,toString:null,valueOf:null},g=new O(1),y=20,$=4,_=-7,d=21,v=-1e7,S=1e7,w=!1,o=1,E=0,A={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},C="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function O(e,t){var r,n,o,i,a,s,l,c,u=this;if(!(u instanceof O))return new O(e,t);if(null==t){if(e&&!0===e._isBigNumber)return u.s=e.s,void(!e.c||e.e>S?u.c=u.e=null:e.e<v?u.c=[u.e=0]:(u.e=e.e,u.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(u.s=1/e<0?(e=-e,-1):1,e===~~e){for(i=0,a=e;10<=a;a/=10,i++);return void(S<i?u.c=u.e=null:(u.e=i,u.c=[e]))}c=String(e)}else{if(!isNumeric.test(c=String(e)))return h(u,c,s);u.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(a=(c=-1<(i=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(i<0&&(i=a),i+=+c.slice(a+1),c=c.substring(0,a)):i<0&&(i=c.length)}else{if(intCheck(t,2,C.length,"Base"),10==t&&T)return G(u=new O(e),y+u.e+1,$);if(c=String(e),s="number"==typeof e){if(0*e!=0)return h(u,c,s,t);if(u.s=1/e<0?(c=c.slice(1),-1):1,O.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(tooManyDigits+e)}else u.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=C.slice(0,t),i=a=0,l=c.length;a<l;a++)if(r.indexOf(n=c.charAt(a))<0){if("."==n){if(i<a){i=l;continue}}else if(!o&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){o=!0,a=-1,i=0;continue}return h(u,String(e),s,t)}s=!1,-1<(i=(c=f(c,t,10,u.s)).indexOf("."))?c=c.replace(".",""):i=c.length}for(a=0;48===c.charCodeAt(a);a++);for(l=c.length;48===c.charCodeAt(--l););if(c=c.slice(a,++l)){if(l-=a,s&&O.DEBUG&&15<l&&(MAX_SAFE_INTEGER<e||e!==mathfloor(e)))throw Error(tooManyDigits+u.s*e);if((i=i-a-1)>S)u.c=u.e=null;else if(i<v)u.c=[u.e=0];else{if(u.e=i,u.c=[],a=(i+1)%LOG_BASE,i<0&&(a+=LOG_BASE),a<l){for(a&&u.c.push(+c.slice(0,a)),l-=LOG_BASE;a<l;)u.c.push(+c.slice(a,a+=LOG_BASE));a=LOG_BASE-(c=c.slice(a)).length}else a-=l;for(;a--;c+="0");u.c.push(+c)}}else u.c=[u.e=0]}function N(e,t,r,n){for(var o,i,a=[0],s=0,l=e.length;s<l;){for(i=a.length;i--;a[i]*=t);for(a[0]+=n.indexOf(e.charAt(s++)),o=0;o<a.length;o++)r-1<a[o]&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/r|0,a[o]%=r)}return a.reverse()}function k(e,t,r){var n,o,i,a=0,s=e.length,l=t%SQRT_BASE,c=t/SQRT_BASE|0;for(e=e.slice();s--;)a=((o=l*(i=e[s]%SQRT_BASE)+(n=c*i+(i=e[s]/SQRT_BASE|0)*l)%SQRT_BASE*SQRT_BASE+a)/r|0)+(n/SQRT_BASE|0)+c*i,e[s]=o%r;return e=a?[a].concat(e):e}function M(e,t,r,n){var o,i;if(r!=n)i=n<r?1:-1;else for(o=i=0;o<r;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function P(e,t,r,n){for(var o=0;r--;)e[r]-=o,o=e[r]<t[r]?1:0,e[r]=o*n+e[r]-t[r];for(;!e[0]&&1<e.length;e.splice(0,1));}function n(e,t,r,n){var o,i,a,s;if(null==r?r=$:intCheck(r,0,8),!e.c)return e.toString();if(o=e.c[0],i=e.e,null==t)s=coeffToString(e.c),s=1==n||2==n&&(i<=_||d<=i)?toExponential(s,i):toFixedPoint(s,i,"0");else if(r=(e=G(new O(e),t,r)).e,a=(s=coeffToString(e.c)).length,1==n||2==n&&(t<=r||r<=_)){for(;a<t;s+="0",a++);s=toExponential(s,r)}else if(t-=i,s=toFixedPoint(s,r,"0"),a<r+1){if(0<--t)for(s+=".";t--;s+="0");}else if(0<(t+=r-a))for(r+1==a&&(s+=".");t--;s+="0");return e.s<0&&o?"-"+s:s}function i(e,t){for(var r,n=1,o=new O(e[0]);n<e.length;n++){if(!(r=new O(e[n])).s){o=r;break}t.call(o,r)&&(o=r)}return o}function x(e,t,r){for(var n=1,o=t.length;!t[--o];t.pop());for(o=t[0];10<=o;o/=10,n++);return(r=n+r*LOG_BASE-1)>S?e.c=e.e=null:r<v?e.c=[e.e=0]:(e.e=r,e.c=t),e}function G(e,t,r,n){var o,i,a,s,l,c,u,f=e.c,h=POWS_TEN;if(f){e:{for(o=1,s=f[0];10<=s;s/=10,o++);if((i=t-o)<0)i+=LOG_BASE,a=t,u=(l=f[c=0])/h[o-a-1]%10|0;else if((c=mathceil((i+1)/LOG_BASE))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=u=0,a=(i%=LOG_BASE)-LOG_BASE+(o=1)}else{for(l=s=f[c],o=1;10<=s;s/=10,o++);u=(a=(i%=LOG_BASE)-LOG_BASE+o)<0?0:l/h[o-a-1]%10|0}if(n=n||t<0||null!=f[c+1]||(a<0?l:l%h[o-a-1]),n=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):5<u||5==u&&(4==r||n||6==r&&(0<i?0<a?l/h[o-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]=h[(LOG_BASE-t%LOG_BASE)%LOG_BASE],e.e=-t||0):f[0]=e.e=0,e;if(0==i?(f.length=c,s=1,c--):(f.length=c+1,s=h[LOG_BASE-i],f[c]=0<a?mathfloor(l/h[o-a]%h[a])*s:0),n)for(;;){if(0==c){for(i=1,a=f[0];10<=a;a/=10,i++);for(a=f[0]+=s,s=1;10<=a;a/=10,s++);i!=s&&(e.e++,f[0]==BASE)&&(f[0]=1);break}if(f[c]+=s,f[c]!=BASE)break;f[c--]=0,s=1}for(i=f.length;0===f[--i];f.pop());}e.e>S?e.c=e.e=null:e.e<v&&(e.c=[e.e=0])}return e}function B(e){var t,r=e.e;return null===r?e.toString():(t=coeffToString(e.c),t=r<=_||d<=r?toExponential(t,r):toFixedPoint(t,r,"0"),e.s<0?"-"+t:t)}return O.clone=clone,O.ROUND_UP=0,O.ROUND_DOWN=1,O.ROUND_CEIL=2,O.ROUND_FLOOR=3,O.ROUND_HALF_UP=4,O.ROUND_HALF_DOWN=5,O.ROUND_HALF_EVEN=6,O.ROUND_HALF_CEIL=7,O.ROUND_HALF_FLOOR=8,O.EUCLID=9,O.config=O.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),y=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),_=r[0],d=r[1]):(intCheck(r,-MAX,MAX,t),_=-(d=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),v=r[0],S=r[1];else{if(intCheck(r,-MAX,MAX,t),!r)throw Error(bignumberError+t+" cannot be zero: "+r);v=-(S=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&&("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes))throw w=!r,Error(bignumberError+"crypto unavailable");w=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(intCheck(r=e[t],0,9,t),o=r),e.hasOwnProperty(t="POW_PRECISION")&&(intCheck(r=e[t],0,MAX,t),E=r),e.hasOwnProperty(t="FORMAT")){if("object"!=_typeof(r=e[t]))throw Error(bignumberError+t+" not an object: "+r);A=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(bignumberError+t+" invalid: "+r);T="0123456789"==r.slice(0,10),C=r}}return{DECIMAL_PLACES:y,ROUNDING_MODE:$,EXPONENTIAL_AT:[_,d],RANGE:[v,S],CRYPTO:w,MODULO_MODE:o,POW_PRECISION:E,FORMAT:A,ALPHABET:C}},O.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!O.DEBUG)return!0;var t,r,n=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===i||-1===i)&&-MAX<=o&&o<=MAX&&o===mathfloor(o))if(0===n[0]){if(0===o&&1===n.length)return!0}else if((t=(o+1)%LOG_BASE)<1&&(t+=LOG_BASE),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||BASE<=r||r!==mathfloor(r))break e;if(0!==r)return!0}}else if(null===n&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(bignumberError+"Invalid BigNumber: "+e)},O.maximum=O.max=function(){return i(arguments,r.lt)},O.minimum=O.min=function(){return i(arguments,r.gt)},O.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return mathfloor(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,o,i,a=0,s=[],l=new O(g);if(null==e?e=y:intCheck(e,0,MAX),o=mathceil(e/LOG_BASE),w)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));a<o;)9e15<=(i=131072*t[a]+(t[a+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[a]=r[0],t[a+1]=r[1]):(s.push(i%1e14),a+=2);a=o/2}else{if(!crypto.randomBytes)throw w=!1,Error(bignumberError+"crypto unavailable");for(t=crypto.randomBytes(o*=7);a<o;)9e15<=(i=281474976710656*(31&t[a])+1099511627776*t[a+1]+4294967296*t[a+2]+16777216*t[a+3]+(t[a+4]<<16)+(t[a+5]<<8)+t[a+6])?crypto.randomBytes(7).copy(t,a):(s.push(i%1e14),a+=7);a=o/7}if(!w)for(;a<o;)(i=c())<9e15&&(s[a++]=i%1e14);for(o=s[--a],e%=LOG_BASE,o&&e&&(i=POWS_TEN[LOG_BASE-e],s[a]=mathfloor(o/i)*i);0===s[a];s.pop(),a--);if(a<0)s=[n=0];else{for(n=-1;0===s[0];s.splice(0,1),n-=LOG_BASE);for(a=1,i=s[0];10<=i;i/=10,a++);a<LOG_BASE&&(n-=LOG_BASE-a)}return l.e=n,l.c=s,l}),O.sum=function(){for(var e=1,t=arguments,r=new O(t[0]);e<t.length;)r=r.plus(t[e++]);return r},b="0123456789",f=function(e,t,r,n,o){var i,a,s,l,c,u,f,h,p=e.indexOf("."),g=y,_=$;for(0<=p&&(l=E,E=0,e=e.replace(".",""),u=(h=new O(t)).pow(e.length-p),E=l,h.c=N(toFixedPoint(coeffToString(u.c),u.e,"0"),10,r,b),h.e=h.c.length),s=l=(f=N(e,t,r,o?(i=C,b):(i=b,C))).length;0==f[--l];f.pop());if(!f[0])return i.charAt(0);if(p<0?--s:(u.c=f,u.e=s,u.s=n,f=(u=m(u,h,g,_,r)).c,c=u.r,s=u.e),p=f[a=s+g+1],l=r/2,c=c||a<0||null!=f[a+1],c=_<4?(null!=p||c)&&(0==_||_==(u.s<0?3:2)):l<p||p==l&&(4==_||c||6==_&&1&f[a-1]||_==(u.s<0?8:7)),a<1||!f[0])e=c?toFixedPoint(i.charAt(1),-g,i.charAt(0)):i.charAt(0);else{if(f.length=a,c)for(--r;++f[--a]>r;)f[a]=0,a||(++s,f=[1].concat(f));for(l=f.length;!f[--l];);for(p=0,e="";p<=l;e+=i.charAt(f[p++]));e=toFixedPoint(e,s,i.charAt(0))}return e},m=function(e,t,r,n,o){var i,a,s,l,c,u,f,h,p,g,_,m,b,y,$,d,v,S=e.s==t.s?1:-1,w=e.c,E=t.c;if(!(w&&w[0]&&E&&E[0]))return new O(e.s&&t.s&&(w?!E||w[0]!=E[0]:E)?w&&0==w[0]||!E?0*S:S/0:NaN);for(p=(h=new O(S)).c=[],S=r+(a=e.e-t.e)+1,o||(o=BASE,a=bitFloor(e.e/LOG_BASE)-bitFloor(t.e/LOG_BASE),S=S/LOG_BASE|0),s=0;E[s]==(w[s]||0);s++);if(E[s]>(w[s]||0)&&a--,S<0)p.push(1),l=!0;else{for(y=w.length,d=E.length,S+=2,1<(c=mathfloor(o/(E[s=0]+1)))&&(E=k(E,c,o),w=k(w,c,o),d=E.length,y=w.length),b=d,_=(g=w.slice(0,d)).length;_<d;g[_++]=0);v=E.slice(),v=[0].concat(v),$=E[0],E[1]>=o/2&&$++;do{if(c=0,(i=M(E,g,d,_))<0){if(m=g[0],d!=_&&(m=m*o+(g[1]||0)),1<(c=mathfloor(m/$)))for(f=(u=k(E,c=o<=c?o-1:c,o)).length,_=g.length;1==M(u,g,f,_);)c--,P(u,d<f?v:E,f,o),f=u.length,i=1;else 0==c&&(i=c=1),f=(u=E.slice()).length;if(P(g,u=f<_?[0].concat(u):u,_,o),_=g.length,-1==i)for(;M(E,g,d,_)<1;)c++,P(g,d<_?v:E,_,o),_=g.length}else 0===i&&(c++,g=[0])}while(p[s++]=c,g[0]?g[_++]=w[b]||0:(g=[w[b]],_=1),(b++<y||null!=g[0])&&S--);l=null!=g[0],p[0]||p.splice(0,1)}if(o==BASE){for(s=1,S=p[0];10<=S;S/=10,s++);G(h,r+(h.e=s+a*LOG_BASE-1)+1,n,l)}else h.e=a,h.r=+l;return h},a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,s=/^([^.]+)\.$/,l=/^\.([^.]+)$/,u=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var o,i=r?t:t.replace(p,"");if(u.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!r&&(i=i.replace(a,function(e,t,r){return o="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=o?e:t}),n&&(o=n,i=i.replace(s,"$1").replace(l,"0.$1")),t!=i))return new O(i,o);if(O.DEBUG)throw Error(bignumberError+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},r.absoluteValue=r.abs=function(){var e=new O(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return compare(this,new O(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return intCheck(e,0,MAX),null==t?t=$:intCheck(t,0,8),G(new O(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,n=e[n])for(;n%10==0;n/=10,r--);return r=r<0?0:r},r.dividedBy=r.div=function(e,t){return m(this,new O(e,t),y,$)},r.dividedToIntegerBy=r.idiv=function(e,t){return m(this,new O(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,o,i,a,s,l,c,u=this;if((e=new O(e)).c&&!e.isInteger())throw Error(bignumberError+"Exponent not an integer: "+B(e));if(null!=t&&(t=new O(t)),a=14<e.e,!u.c||!u.c[0]||1==u.c[0]&&!u.e&&1==u.c.length||!e.c||!e.c[0])return c=new O(Math.pow(+B(u),a?e.s*(2-isOdd(e)):+B(e))),t?c.mod(t):c;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new O(NaN);(n=!s&&u.isInteger()&&t.isInteger())&&(u=u.mod(t))}else{if(9<e.e&&(0<u.e||u.e<-1||(0==u.e?1<u.c[0]||a&&24e7<=u.c[1]:u.c[0]<8e13||a&&u.c[0]<=9999975e7)))return i=u.s<0&&isOdd(e)?-0:0,-1<u.e&&(i=1/i),new O(s?1/i:i);E&&(i=mathceil(E/LOG_BASE+2))}for(l=a?(r=new O(.5),s&&(e.s=1),isOdd(e)):(o=Math.abs(+B(e)))%2,c=new O(g);;){if(l){if(!(c=c.times(u)).c)break;i?c.c.length>i&&(c.c.length=i):n&&(c=c.mod(t))}if(o){if(0===(o=mathfloor(o/2)))break;l=o%2}else if(G(e=e.times(r),e.e+1,1),14<e.e)l=isOdd(e);else{if(0===(o=+B(e)))break;l=o%2}u=u.times(u),i?u.c&&u.c.length>i&&(u.c.length=i):n&&(u=u.mod(t))}return n?c:(s&&(c=g.div(c)),t?c.mod(t):i?G(c,E,$,void 0):c)},r.integerValue=function(e){var t=new O(this);return null==e?e=$:intCheck(e,0,8),G(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===compare(this,new O(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<compare(this,new O(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=compare(this,new O(e,t)))||0===t},r.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return compare(this,new O(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=compare(this,new O(e,t)))||0===t},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return 0<this.s},r.isZero=function(){return!!this.c&&0==this.c[0]},r.minus=function(e,t){var r,n,o,i,a=this,s=a.s;if(t=(e=new O(e,t)).s,!s||!t)return new O(NaN);if(s!=t)return e.s=-t,a.plus(e);var l=a.e/LOG_BASE,c=e.e/LOG_BASE,u=a.c,f=e.c;if(!l||!c){if(!u||!f)return u?(e.s=-t,e):new O(f?a:NaN);if(!u[0]||!f[0])return f[0]?(e.s=-t,e):new O(u[0]?a:3==$?-0:0)}if(l=bitFloor(l),c=bitFloor(c),u=u.slice(),s=l-c){for((o=(i=s<0)?(s=-s,u):(c=l,f)).reverse(),t=s;t--;o.push(0));o.reverse()}else for(n=(i=(s=u.length)<(t=f.length))?s:t,s=t=0;t<n;t++)if(u[t]!=f[t]){i=u[t]<f[t];break}if(i&&(o=u,u=f,f=o,e.s=-e.s),0<(t=(n=f.length)-(r=u.length)))for(;t--;u[r++]=0);for(t=BASE-1;s<n;){if(u[--n]<f[n]){for(r=n;r&&!u[--r];u[r]=t);--u[r],u[n]+=BASE}u[n]-=f[n]}for(;0==u[0];u.splice(0,1),--c);return u[0]?x(e,u,c):(e.s=3==$?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new O(e,t),!n.c||!e.s||e.c&&!e.c[0]?new O(NaN):!e.c||n.c&&!n.c[0]?new O(n):(9==o?(t=e.s,e.s=1,r=m(n,e,0,3),e.s=t,r.s*=t):r=m(n,e,0,o),(e=n.minus(r.times(e))).c[0]||1!=o||(e.s=n.s),e)},r.multipliedBy=r.times=function(e,t){var r,n,o,i,a,s,l,c,u,f,h,p,g,_=this,m=_.c,b=(e=new O(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!_.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=_.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=bitFloor(_.e/LOG_BASE)+bitFloor(e.e/LOG_BASE),e.s*=_.s,(s=m.length)<(_=b.length)&&(h=m,m=b,b=h,n=s,s=_,_=n),n=s+_,h=[];n--;h.push(0));for(p=BASE,g=SQRT_BASE,n=_;0<=--n;){for(u=b[n]%g,f=b[n]/g|(r=0),o=n+(i=s);n<o;)r=((l=u*(l=m[--i]%g)+(a=f*l+(c=m[i]/g|0)*u)%g*g+h[o]+r)/p|0)+(a/g|0)+f*c,h[o--]=l%p;h[o]=r}return r?++t:h.splice(0,1),x(e,h,t)},r.negated=function(){var e=new O(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,o=n.s;if(t=(e=new O(e,t)).s,!o||!t)return new O(NaN);if(o!=t)return e.s=-t,n.minus(e);var i=n.e/LOG_BASE,a=e.e/LOG_BASE,s=n.c,l=e.c;if(!i||!a){if(!s||!l)return new O(o/0);if(!s[0]||!l[0])return l[0]?e:new O(s[0]?n:0*o)}if(i=bitFloor(i),a=bitFloor(a),s=s.slice(),o=i-a){for((r=0<o?(a=i,l):(o=-o,s)).reverse();o--;r.push(0));r.reverse()}for((o=s.length)-(t=l.length)<0&&(r=l,l=s,s=r,t=o),o=0;t;)o=(s[--t]=s[t]+l[t]+o)/BASE|0,s[t]=BASE===s[t]?0:s[t]%BASE;return o&&(s=[o].concat(s),++a),x(e,s,a)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return intCheck(e,1,MAX),null==t?t=$:intCheck(t,0,8),G(new O(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*LOG_BASE+1,n=t[n]){for(;n%10==0;n/=10,r--);for(n=t[0];10<=n;n/=10,r++);}return r=e&&this.e+1>r?this.e+1:r},r.shiftedBy=function(e){return intCheck(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,o,i=this,a=i.c,s=i.s,l=i.e,c=y+4,u=new O("0.5");if(1!==s||!a||!a[0])return new O(!s||s<0&&(!a||a[0])?NaN:a?i:1/0);if((r=0==(s=Math.sqrt(+B(i)))||s==1/0?(((t=coeffToString(a)).length+l)%2==0&&(t+="0"),s=Math.sqrt(+t),l=bitFloor((l+1)/2)-(l<0||l%2),new O(t=s==1/0?"5e"+l:(t=s.toExponential()).slice(0,t.indexOf("e")+1)+l)):new O(s+"")).c[0])for((s=(l=r.e)+c)<3&&(s=0);;)if(o=r,r=u.times(o.plus(m(i,o,c,1))),coeffToString(o.c).slice(0,s)===(t=coeffToString(r.c)).slice(0,s)){if(r.e<l&&--s,"9999"!=(t=t.slice(s-3,s+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(G(r,r.e+y+2,1),e=!r.times(r).eq(i));break}if(!n&&(G(o,o.e+y+2,0),o.times(o).eq(i))){r=o;break}c+=4,s+=4,n=1}return G(r,r.e+y+1,$,e)},r.toExponential=function(e,t){return null!=e&&(intCheck(e,0,MAX),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(intCheck(e,0,MAX),e=e+this.e+1),n(this,e,t)},r.toFormat=function(e,t,r){if(null==r)null!=e&&t&&"object"==_typeof(t)?(r=t,t=null):e&&"object"==_typeof(e)?(r=e,e=t=null):r=A;else if("object"!=_typeof(r))throw Error(bignumberError+"Argument not an object: "+r);if(e=this.toFixed(e,t),this.c){var n,t=e.split("."),o=+r.groupSize,i=+r.secondaryGroupSize,a=r.groupSeparator||"",s=t[0],t=t[1],l=this.s<0,c=l?s.slice(1):s,u=c.length;if(i&&(n=o,o=i,u-=i=n),0<o&&0<u){for(s=c.substr(0,n=u%o||o);n<u;n+=o)s+=a+c.substr(n,o);0<i&&(s+=a+c.slice(n)),l&&(s="-"+s)}e=t?s+(r.decimalSeparator||"")+((i=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+i+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):s}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,o,i,a,s,l,c,u,f=this,h=f.c;if(null!=e&&(!(s=new O(e)).isInteger()&&(s.c||1!==s.s)||s.lt(g)))throw Error(bignumberError+"Argument "+(s.isInteger()?"out of range: ":"not an integer: ")+B(s));if(!h)return new O(f);for(t=new O(g),c=r=new O(g),n=l=new O(g),h=coeffToString(h),i=t.e=h.length-f.e-1,t.c[0]=POWS_TEN[(a=i%LOG_BASE)<0?LOG_BASE+a:a],e=!e||0<s.comparedTo(t)?0<i?t:c:s,a=S,S=1/0,s=new O(h),l.c[0]=0;u=m(s,t,0,1),1!=(o=r.plus(u.times(n))).comparedTo(e);)r=n,n=o,c=l.plus(u.times(o=c)),l=o,t=s.minus(u.times(o=t)),s=o;return o=m(e.minus(r),n,0,1),l=l.plus(o.times(c)),r=r.plus(o.times(n)),l.s=c.s=f.s,h=m(c,n,i*=2,$).minus(f).abs().comparedTo(m(l,r,i,$).minus(f).abs())<1?[c,n]:[l,r],S=a,h},r.toNumber=function(){return+B(this)},r.toPrecision=function(e,t){return null!=e&&intCheck(e,1,MAX),n(this,e,t,2)},r.toString=function(e){var t,r=this,n=r.s,o=r.e;return null===o?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(t=null==e?o<=_||d<=o?toExponential(coeffToString(r.c),o):toFixedPoint(coeffToString(r.c),o,"0"):10===e&&T?toFixedPoint(coeffToString((r=G(new O(r),y+o+1,$)).c),r.e,"0"):(intCheck(e,2,C.length,"Base"),f(toFixedPoint(coeffToString(r.c),o,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return B(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&O.set(e),O}function bitFloor(e){var t=0|e;return 0<e||e===t?t:t-1}function coeffToString(e){for(var t,r,n=1,o=e.length,i=e[0]+"";n<o;){for(t=e[n++]+"",r=LOG_BASE-t.length;r--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function compare(e,t){var r,n,o=e.c,i=t.c,a=e.s,s=t.s,e=e.e,t=t.e;if(!a||!s)return null;if(r=o&&!o[0],n=i&&!i[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=e==t,!o||!i)return n?0:!o^r?1:-1;if(!n)return t<e^r?1:-1;for(s=(e=o.length)<(t=i.length)?e:t,a=0;a<s;a++)if(o[a]!=i[a])return o[a]>i[a]^r?1:-1;return e==t?0:t<e^r?1:-1}function intCheck(e,t,r,n){if(e<t||r<e||e!==mathfloor(e))throw Error(bignumberError+(n||"Argument")+("number"==typeof e?e<t||r<e?" 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(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function toFixedPoint(e,t,r){var n,o;if(t<0){for(o=r+".";++t;o+=r);e=o+e}else if(++t>(n=e.length)){for(o=r,t-=n;--t;o+=r);e+=o}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var BigNumber=clone();function eval_postfix(e){for(var t=[];0<e.length;){var r=e.shift();if(is_operator(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),o=t.pop();if("string"==typeof n&&!BigNumber.isBigNumber(n)){if(!is_str_number(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new BigNumber(n)}if("string"==typeof o&&!BigNumber.isBigNumber(o)){if(!is_str_number(o))throw new Error("".concat(o,"不是一个合法的数字"));o=new BigNumber(o)}switch(r){case"+":t.push(o.plus(n));break;case"-":t.push(o.minus(n));break;case"*":t.push(o.times(n));break;case"/":t.push(o.div(n));break;case"%":t.push(o.mod(n));break;case"**":t.push(o.pow(n))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var i=t[0];if((i=BigNumber.isBigNumber(i)?i:BigNumber(i)).isNaN())throw new Error("计算结果为NaN");return i}function decimal_round(o,i,a,s,e){var l=o,c=i,u=i.length,t={"~-":function(){c=i.slice(0,"<"===a?s-1:s)},"~+":function(){var e,t="<"===a?s-1:s;u<=t||0===u||(e=i.slice(0,t),0!=+i.slice(t,u)&&(e=(+e+1).toString()).length>t?(c=e.slice(1,e.length),l=(+l+1).toString()):c=e)},"~5":function(){var e,t;0===u||(c=i.slice(0,e="<"===a?s-1:s),t=+i[e],Number.isNaN(t))||5<=t&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())},"~6":function(){var e,t,r,n;0!==u&&(t=+i[e="<"===a?s-1:s],r=""===(r=i.slice(+e+1,i.length))?0:parseInt(r),n=0===e?+o[o.length-1]:+i[e-1],c=i.slice(0,e),6<=t||5==t&&0<r||5==t&&n%2!=0)&&(c=(+c+1).toString()).length>e&&(c=c.slice(1,c.length),l=(+l+1).toString())}};return"<="===a?c=u<=s?i:(t[e]&&t[e](),c.replace(/0+$/,"")):"<"===a?c=u<s?i:(t[e]&&t[e](),c.replace(/0+$/,"")):"="===a?u<s?c=i+"0".repeat(s-u):s<u&&t[e]&&t[e]():">="===a?u<s&&(c=i+"0".repeat(s-u)):">"===a&&u<=s&&(c=i+"0".repeat(s-u+1)),{int_part:l,dec_part:c}}function format(e,t,r){var n,o,i,a,s,l,c,u,f,h="";return BigNumber.isBigNumber(e)?h=e.toFixed():"string"!=typeof e&&(h=e.toString()),"undefined"===h||"NaN"===h?null:(o=n=null,a=i=!1,f=u=c=l=!(s="~-"),t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);o=e.value}else if("to-number"===t)f=!0;else if("comma"===t)i=!0;else if("number"===t)n=e.value;else if("plus"===t)a=!0;else if("round"===t)s=e.value;else if("fraction"===t)c=!0;else if("scientific"===t)l=!0;else{if("percent"!==t)throw new Error("错误的fmt Token");u=!0}}),l?(e=BigNumber(h).toExponential(),a&&!e.startsWith("-")?"+"+e:e):c?(t=BigNumber(h).toFraction().map(function(e){return e.toFixed()}).join("/"),a&&!t.startsWith("-")?"+"+t:t):(u&&(h=BigNumber(h).times(100).toFixed()),n&&(t=(e=decimal_round(t=(e=h.split("."))[0],1===e.length?"":e[1],o,+n,s)).int_part,h=""===(e=e.dec_part)?t:"".concat(t,".").concat(e)),i&&(f=!1,h=1<(t=h.split(".")).length?((e=t[0]).includes("-")?t[0]=e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):t[0]=e.replace(/(?=(?!^)(?:\d{3})+$)/g,","),t.join(".")):(e=t[0]).includes("-")?e[0]+e.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):e.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),a&&(f=!1,h.startsWith("-")||(h="+"+h)),u&&(f=!1,h+="%"),f&&!r?+h:h))}function fill_fmt_tokens(e,n){return e.map(function(e){if("var"!==e.type)return e;for(var t,r=0;r<n.length&&!not_undefined(t=get_1(n[r],e.value));r++);if(is_number(t))return{type:"number",value:t};throw new Error("错误的填充值")})}function get_token_and_unit(e){var r=null;return e.length,{tokens:e.map(function(e){var t=split_unit_num(e.value);return null!==t.unit?(null==r&&(r=t.unit),{type:"number",value:t.num}):e}),unit:r}}var getNative$4=_getNative,baseGetTag$1=(!function(){try{var e=getNative$4(Object,"defineProperty");e({},"",{})}catch(e){}}(),_baseGetTag),isObjectLike$1=isObjectLike_1,argsTag="[object Arguments]";function baseIsArguments$1(e){return isObjectLike$1(e)&&baseGetTag$1(e)==argsTag}var _baseIsArguments=baseIsArguments$1,baseIsArguments=baseIsArguments$1,isObjectLike=isObjectLike_1,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,propertyIsEnumerable=objectProto.propertyIsEnumerable,isBuffer=(baseIsArguments(function(){return arguments}()),{exports:{}});function stubFalse(){return!1}var stubFalse_1=stubFalse,_nodeUtil=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,r=r&&r.exports===t?_root.Buffer:void 0,t=r?r.isBuffer:void 0;e.exports=t||stubFalse_1}(isBuffer,isBuffer.exports),{exports:{}}),nodeUtil$5=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,n=r&&r.exports===t&&_freeGlobal.process,t=function(){try{var e=r&&r.require&&r.require("util").types;return e?e:n&&n.binding&&n.binding("util")}catch(e){}}();e.exports=t}(_nodeUtil,_nodeUtil.exports),_nodeUtil.exports),_cloneBuffer=(nodeUtil$5&&nodeUtil$5.isTypedArray,{exports:{}}),getNative$3=(!function(e,t){var t=t&&!t.nodeType&&t,r=t&&e&&!e.nodeType&&e,r=r&&r.exports===t?_root.Buffer:void 0,n=r?r.allocUnsafe:void 0;e.exports=function(e,t){return t?e.slice():(t=e.length,t=n?n(t):new e.constructor(t),e.copy(t),t)}}(_cloneBuffer,_cloneBuffer.exports),_getNative),root$5=_root,DataView$1=_getNative(_root,"DataView"),_DataView=DataView$1,getNative$2=_getNative,root$4=_root,Promise$2=_getNative(_root,"Promise"),_Promise=Promise$2,getNative$1=_getNative,root$3=_root,Set$1=_getNative(_root,"Set"),_Set=Set$1,getNative=_getNative,root$2=_root,WeakMap$1=_getNative(_root,"WeakMap"),_WeakMap=WeakMap$1,DataView=_DataView,Map=_Map,Promise$1=_Promise,Set=_Set,WeakMap=WeakMap$1,baseGetTag=_baseGetTag,toSource=_toSource,mapTag="[object Map]",objectTag="[object Object]",promiseTag="[object Promise]",setTag="[object Set]",weakMapTag="[object WeakMap]",dataViewTag="[object DataView]",dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap),getTag=baseGetTag,root$1=((DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag)&&(getTag=function(e){var t=baseGetTag(e),e=t==objectTag?e.constructor:void 0,e=e?toSource(e):"";if(e)switch(e){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}return t}),_root),_Symbol$2=(_root.Uint8Array,_Symbol$6),symbolProto$1=_Symbol$6?_Symbol$6.prototype:void 0,nodeUtil$4=(symbolProto$1&&symbolProto$1.valueOf,_nodeUtil.exports),nodeUtil$3=(nodeUtil$4&&nodeUtil$4.isMap,_nodeUtil.exports),nodeUtil$2=(nodeUtil$3&&nodeUtil$3.isSet,_nodeUtil.exports),nodeUtil$1=(nodeUtil$2&&nodeUtil$2.isArrayBuffer,_nodeUtil.exports),funcProto=(nodeUtil$1&&nodeUtil$1.isDate,Function.prototype),funcToString=funcProto.toString,_Symbol$1=(funcToString.call(Object),_Symbol$6),symbolProto=_Symbol$6?_Symbol$6.prototype:void 0,root=(symbolProto&&symbolProto.valueOf,_root),nodeUtil=(_root.isFinite,_nodeUtil.exports),_Symbol=(nodeUtil&&nodeUtil.isRegExp,_Symbol$6);function calc(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=parse_args(t),o=get_1(n,"options._error",void 0),i=get_1(n,"options._debug",!1),a=get_1(n,"options._unit",!1),s=n.options,l=null;if(n.fmt_err||n.expr_err){if(not_undefined(o))return o;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(not_undefined(o))try{c=tokenizer(n.expr,a)}catch(e){return o}else c=tokenizer(n.expr,a);if(i&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),not_null(s)){var c,u=[];if(Array.isArray(s)?u=s:(u.push(s),not_undefined(s=get_1(s,"_fill_data",{}))&&(Array.isArray(s)?u=[].concat(_toConsumableArray(u),_toConsumableArray(s)):u.push(s))),not_undefined(o))try{c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u))}catch(e){return o}else c=fill_tokens(c,u,a),not_null(n.fmt)&&(n.fmt=fill_fmt_tokens(n.fmt,u));[!0,"on","auto","space"].includes(a)&&(l=(s=get_token_and_unit(c)).unit,c=s.tokens)}u=token2postfix(c),i&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("转换后的tokens"),console.log(u),console.warn("单位:".concat(l))),s=null;if(not_undefined(o))try{s=eval_postfix(u)}catch(e){return o}else s=eval_postfix(u);if("Infinity"!==(s=not_null(n.fmt)?format(s,n.fmt,a):null!==s?s.toFixed():null)&&null!==s)return null!==l&&(s+=l),s;if(not_undefined(o))return o;throw new Error("计算错误可能是非法的计算式")}_Symbol$6&&_Symbol$6.iterator,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: #409EFF;font-size:14px;","color: #409EFF;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;");var fmt=calc;export{calc,fmt,version};
|