New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

a-calc

Package Overview
Dependencies
Maintainers
1
Versions
164
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-calc - npm Package Compare versions

Comparing version 0.0.80 to 1.0.2

2

browser/index.js

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

var a_calc=function(e){"use strict";function C(e){return(C="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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(e,t,r){return t&&A(e.prototype,t),r&&A(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function N(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function S(e,t,r){return(S=N()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);t=new(Function.bind.apply(e,n));return r&&l(t,r.prototype),t}).apply(null,arguments)}function a(e){var r="function"==typeof Map?new Map:void 0;return(a=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return S(e,arguments,u(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),l(t,e)})(e)}function j(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");t=e;if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(r){var n=N();return function(){var e,t=u(r);return j(this,n?(e=u(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments))}}function v(e){return function(e){if(Array.isArray(e))return P(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(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 P(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 x=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,R=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/,T=/^[a-zA-z_][\w\[\]"'_.]*$/;function k(e){return-1<"+-*/%()".indexOf(e)}function D(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":return 2;default:return 0}}function g(e){return void 0!==e}function B(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.some(function(e){return void 0!==e})}function d(e){return null!==e}function h(e){return"string"==typeof e&&!!x.test(e)}function $(e){for(var t,r,n=null,i=null,o=[/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(\D*)$/,/^([+-]?[\d.]+)(\D*)$/],u=0;u<o.length;u++){var l=e.match(o[u]);if(l){t=l;break}}return t&&(i=t[1],""!==(r=t[2]).trim()&&(n=r)),{num:i,unit:n}}var y=function(){o(n,a(Error));var r=c(n);function n(e){var t;return i(this,n),(t=r.call(this,e)).name="CalculatorError",t.message=e,t}return t(n)}(),w=function(){o(n,a(Error));var r=c(n);function n(e){var t;return i(this,n),(t=r.call(this,e)).name="TokensFillError",t.message=e,t}return t(n)}(),F=function(){o(n,a(Error));var r=c(n);function n(e){var t;return i(this,n),(t=r.call(this,e)).name="ArgError",t.message=e,t}return t(n)}(),X=function(){o(n,a(Error));var r=c(n);function n(e){var t;return i(this,n),(t=r.call(this,e)).name="FmtError",t.message=e,t}return t(n)}();function Y(e){for(var t,r=0,n=e.length,i=[];r<n;)if(t=e[r],/\s/.test(t))r++;else if("+"===t)i.push({type:"plus",value:t}),r++;else if(","===t)i.push({type:"comma",value:t}),r++;else if("<>=".includes(t)){var o=t;++r>=n?i.push({type:"symbol",value:o}):(u=e[r],"<>=".includes(u)?(o+=u,i.push({type:"symbol",value:o}),r++):i.push({type:"symbol",value:t}))}else if("~"===t){var u=t;if(++r>=n)throw new X("fmt格式化传参错误!错误解析字符:".concat(t));if(t=e[r],!"+-56".includes(t))throw new X("fmt格式化传参错误!错误解析字符:".concat(t));u+=t,i.push({type:"round",value:u}),r++}else if(/[a-zA-Z_]/.test(t)){for(var l="";/[\w_.\[\]"']/.test(t)&&(l+=t,!(n<=++r));)t=e[r];i.push({type:"var",value:l})}else if(/\d/.test(t)){for(var a="";/[\d.]/.test(t)&&(a+=t,!(n<=++r));)t=e[r];i.push({type:"number",value:a})}return i}function J(e){var t={expr:"",fmt:null,data:null},r="",n=e[0];if(1===e.length)if("string"==typeof n)r=n;else{if("number"!=typeof n)throw new F("错误的参数类型: ".concat(n," 类型为:").concat(C(n)));r=n.toString()}else{if(2!==e.length)throw new F("过多的参数, 该函数最多接受两个参数!");n=e[1];if(o=n,("[object Object]"!==Object.prototype.toString.call(o)||Array.isArray(o))&&!Array.isArray(n))throw new Error("参数错误, 不支持的参数");if("string"==typeof(r=e[0])){if(""===r.trim())throw new w("参数不可为空字符串");if("NaN"===r)throw new w("非法参数:".concat(r))}else if("number"==typeof r)r=r.toString();else if(void 0===r||Number.isNaN(r))throw new w("非法参数:".concat(r));t.data=n}var i,o=r.split("|");return 1===o.length?t.expr=o[0]:(t.expr=o[0],""!==(e=o[1]).trim()&&(t.fmt=Y(e))),null!==t.data&&t.data._fmt&&(n=Y(t.data._fmt),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)}))),t}var K=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Q=Math.ceil,I=Math.floor,U="[BigNumber Error] ",ee=U+"Number primitive has more than 15 significant digits: ",L=1e14,M=14,te=9007199254740991,re=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],z=1e7,G=1e9;function q(e){var t=0|e;return 0<e||e===t?t:t-1}function H(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 V(e,t){var r,n,i=e.c,o=t.c,u=e.s,l=t.s,e=e.e,t=t.e;if(!u||!l)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-l:u;if(u!=l)return u;if(r=u<0,n=e==t,!i||!o)return n?0:!i^r?1:-1;if(!n)return t<e^r?1:-1;for(l=(e=i.length)<(t=o.length)?e:t,u=0;u<l;u++)if(i[u]!=o[u])return i[u]>o[u]^r?1:-1;return e==t?0:t<e^r?1:-1}function W(e,t,r,n){if(e<t||r<e||e!==I(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 ne(e){var t=e.c.length-1;return q(e.e/M)==t&&e.c[t]%2!=0}function ie(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 m=function F(e){var d,f,h,t,c,y,u,l,a,s,p,r=P.prototype={constructor:P,toString:null,valueOf:null},v=new P(1),w=20,m=4,g=-7,b=21,_=-1e7,O=1e7,E=!1,i=1,A=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},S="0123456789abcdefghijklmnopqrstuvwxyz",j=!0;function P(e,t){var r,n,i,o,u,l,a,c,s=this;if(!(s instanceof P))return new P(e,t);if(null==t){if(e&&!0===e._isBigNumber)return s.s=e.s,void(!e.c||e.e>O?s.c=s.e=null:e.e<_?s.c=[s.e=0]:(s.e=e.e,s.c=e.c.slice()));if((l="number"==typeof e)&&0*e==0){if(s.s=1/e<0?(e=-e,-1):1,e===~~e){for(o=0,u=e;10<=u;u/=10,o++);return void(O<o?s.c=s.e=null:(s.e=o,s.c=[e]))}c=String(e)}else{if(!K.test(c=String(e)))return h(s,c,l);s.s=45==c.charCodeAt(0)?(c=c.slice(1),-1):1}0<(u=(c=-1<(o=c.indexOf("."))?c.replace(".",""):c).search(/e/i))?(o<0&&(o=u),o+=+c.slice(u+1),c=c.substring(0,u)):o<0&&(o=c.length)}else{if(W(t,2,S.length,"Base"),10==t&&j)return B(s=new P(e),w+s.e+1,m);if(c=String(e),l="number"==typeof e){if(0*e!=0)return h(s,c,l,t);if(s.s=1/e<0?(c=c.slice(1),-1):1,P.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(ee+e)}else s.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=S.slice(0,t),o=u=0,a=c.length;u<a;u++)if(r.indexOf(n=c.charAt(u))<0){if("."==n){if(o<u){o=a;continue}}else if(!i&&(c==c.toUpperCase()&&(c=c.toLowerCase())||c==c.toLowerCase()&&(c=c.toUpperCase()))){i=!0,u=-1,o=0;continue}return h(s,String(e),l,t)}l=!1,-1<(o=(c=f(c,t,10,s.s)).indexOf("."))?c=c.replace(".",""):o=c.length}for(u=0;48===c.charCodeAt(u);u++);for(a=c.length;48===c.charCodeAt(--a););if(c=c.slice(u,++a)){if(a-=u,l&&P.DEBUG&&15<a&&(te<e||e!==I(e)))throw Error(ee+s.s*e);if((o=o-u-1)>O)s.c=s.e=null;else if(o<_)s.c=[s.e=0];else{if(s.e=o,s.c=[],u=(o+1)%M,o<0&&(u+=M),u<a){for(u&&s.c.push(+c.slice(0,u)),a-=M;u<a;)s.c.push(+c.slice(u,u+=M));u=M-(c=c.slice(u)).length}else u-=a;for(;u--;c+="0");s.c.push(+c)}}else s.c=[s.e=0]}function x(e,t,r,n){for(var i,o,u=[0],l=0,a=e.length;l<a;){for(o=u.length;o--;u[o]*=t);for(u[0]+=n.indexOf(e.charAt(l++)),i=0;i<u.length;i++)u[i]>r-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/r|0,u[i]%=r)}return u.reverse()}function R(e,t,r){var n,i,o,u=0,l=e.length,a=t%z,c=t/z|0;for(e=e.slice();l--;)u=((i=a*(o=e[l]%z)+(n=c*o+(o=e[l]/z|0)*a)%z*z+u)/r|0)+(n/z|0)+c*o,e[l]=i%r;return e=u?[u].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 k(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,u,l;if(null==r?r=m:W(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)l=H(e.c),l=1==n||2==n&&(o<=g||b<=o)?ie(l,o):Z(l,o,"0");else if(r=(e=B(new P(e),t,r)).e,u=(l=H(e.c)).length,1==n||2==n&&(t<=r||r<=g)){for(;u<t;l+="0",u++);l=ie(l,r)}else if(t-=o,l=Z(l,r,"0"),u<r+1){if(0<--t)for(l+=".";t--;l+="0");}else if(0<(t+=r-u))for(r+1==u&&(l+=".");t--;l+="0");return e.s<0&&i?"-"+l:l}function o(e,t){for(var r,n=1,i=new P(e[0]);n<e.length;n++){if(!(r=new P(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function D(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)>O?e.c=e.e=null:r<_?e.c=[e.e=0]:(e.e=r,e.c=t),e}function B(e,t,r,n){var i,o,u,l,a,c,s,f=e.c,h=re;if(f){e:{for(i=1,l=f[0];10<=l;l/=10,i++);if((o=t-i)<0)o+=M,u=t,s=(a=f[c=0])/h[i-u-1]%10|0;else if((c=Q((o+1)/M))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));a=s=0,u=(o%=M)-M+(i=1)}else{for(a=l=f[c],i=1;10<=l;l/=10,i++);s=(u=(o%=M)-M+i)<0?0:a/h[i-u-1]%10|0}if(n=n||t<0||null!=f[c+1]||(u<0?a:a%h[i-u-1]),n=r<4?(s||n)&&(0==r||r==(e.s<0?3:2)):5<s||5==s&&(4==r||n||6==r&&(0<o?0<u?a/h[i-u]: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[(M-t%M)%M],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=c,l=1,c--):(f.length=c+1,l=h[M-o],f[c]=0<u?I(a/h[i-u]%h[u])*l:0),n)for(;;){if(0==c){for(o=1,u=f[0];10<=u;u/=10,o++);for(u=f[0]+=l,l=1;10<=u;u/=10,l++);o!=l&&(e.e++,f[0]==L&&(f[0]=1));break}if(f[c]+=l,f[c]!=L)break;f[c--]=0,l=1}for(o=f.length;0===f[--o];f.pop());}e.e>O?e.c=e.e=null:e.e<_&&(e.c=[e.e=0])}return e}function $(e){var t,r=e.e;return null===r?e.toString():(t=H(e.c),t=r<=g||b<=r?ie(t,r):Z(t,r,"0"),e.s<0?"-"+t:t)}return P.clone=F,P.ROUND_UP=0,P.ROUND_DOWN=1,P.ROUND_CEIL=2,P.ROUND_FLOOR=3,P.ROUND_HALF_UP=4,P.ROUND_HALF_DOWN=5,P.ROUND_HALF_EVEN=6,P.ROUND_HALF_CEIL=7,P.ROUND_HALF_FLOOR=8,P.EUCLID=9,P.config=P.set=function(e){var t,r;if(null!=e){if("object"!=C(e))throw Error(U+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(W(r=e[t],0,G,t),w=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(W(r=e[t],0,8,t),m=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(W(r[0],-G,0,t),W(r[1],0,G,t),g=r[0],b=r[1]):(W(r,-G,G,t),g=-(b=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)W(r[0],-G,-1,t),W(r[1],1,G,t),_=r[0],O=r[1];else{if(W(r,-G,G,t),!r)throw Error(U+t+" cannot be zero: "+r);_=-(O=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){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw E=!r,Error(U+"crypto unavailable");E=r}else E=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(W(r=e[t],0,9,t),i=r),e.hasOwnProperty(t="POW_PRECISION")&&(W(r=e[t],0,G,t),A=r),e.hasOwnProperty(t="FORMAT")){if("object"!=C(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),S=r}}return{DECIMAL_PLACES:w,ROUNDING_MODE:m,EXPONENTIAL_AT:[g,b],RANGE:[_,O],CRYPTO:E,MODULO_MODE:i,POW_PRECISION:A,FORMAT:N,ALPHABET:S}},P.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!P.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===I(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||L<=r||r!==I(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)},P.maximum=P.max=function(){return o(arguments,r.lt)},P.minimum=P.min=function(){return o(arguments,r.gt)},P.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return I(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,u=0,l=[],a=new P(v);if(null==e?e=w:W(e,0,G),i=Q(e/M),E)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)9e15<=(o=131072*t[u]+(t[u+1]>>>11))?(r=crypto.getRandomValues(new Uint32Array(2)),t[u]=r[0],t[u+1]=r[1]):(l.push(o%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw E=!1,Error(U+"crypto unavailable");for(t=crypto.randomBytes(i*=7);u<i;)9e15<=(o=281474976710656*(31&t[u])+1099511627776*t[u+1]+4294967296*t[u+2]+16777216*t[u+3]+(t[u+4]<<16)+(t[u+5]<<8)+t[u+6])?crypto.randomBytes(7).copy(t,u):(l.push(o%1e14),u+=7);u=i/7}if(!E)for(;u<i;)(o=c())<9e15&&(l[u++]=o%1e14);for(i=l[--u],e%=M,i&&e&&(l[u]=I(i/(o=re[M-e]))*o);0===l[u];l.pop(),u--);if(u<0)l=[n=0];else{for(n=-1;0===l[0];l.splice(0,1),n-=M);for(u=1,o=l[0];10<=o;o/=10,u++);u<M&&(n-=M-u)}return a.e=n,a.c=l,a}),P.sum=function(){for(var e=1,t=arguments,r=new P(t[0]);e<t.length;)r=r.plus(t[e++]);return r},y="0123456789",f=function(e,t,r,n,i){var o,u,l,a,c,s,f,h,p=e.indexOf("."),v=w,g=m;for(0<=p&&(a=A,A=0,e=e.replace(".",""),s=(h=new P(t)).pow(e.length-p),A=a,h.c=x(Z(H(s.c),s.e,"0"),10,r,y),h.e=h.c.length),l=a=(f=x(e,t,r,i?(o=S,y):(o=y,S))).length;0==f[--a];f.pop());if(!f[0])return o.charAt(0);if(p<0?--l:(s.c=f,s.e=l,s.s=n,f=(s=d(s,h,v,g,r)).c,c=s.r,l=s.e),p=f[u=l+v+1],a=r/2,c=c||u<0||null!=f[u+1],c=g<4?(null!=p||c)&&(0==g||g==(s.s<0?3:2)):a<p||p==a&&(4==g||c||6==g&&1&f[u-1]||g==(s.s<0?8:7)),u<1||!f[0])e=c?Z(o.charAt(1),-v,o.charAt(0)):o.charAt(0);else{if(f.length=u,c)for(--r;++f[--u]>r;)f[u]=0,u||(++l,f=[1].concat(f));for(a=f.length;!f[--a];);for(p=0,e="";p<=a;e+=o.charAt(f[p++]));e=Z(e,l,o.charAt(0))}return e},d=function(e,t,r,n,i){var o,u,l,a,c,s,f,h,p,v,g,d,y,w,m,b,_,O=e.s==t.s?1:-1,E=e.c,A=t.c;if(!(E&&E[0]&&A&&A[0]))return new P(e.s&&t.s&&(E?!A||E[0]!=A[0]:A)?E&&0==E[0]||!A?0*O:O/0:NaN);for(p=(h=new P(O)).c=[],O=r+(u=e.e-t.e)+1,i||(i=L,u=q(e.e/M)-q(t.e/M),O=O/M|0),l=0;A[l]==(E[l]||0);l++);if(A[l]>(E[l]||0)&&u--,O<0)p.push(1),a=!0;else{for(w=E.length,b=A.length,O+=2,1<(c=I(i/(A[l=0]+1)))&&(A=R(A,c,i),E=R(E,c,i),b=A.length,w=E.length),y=b,g=(v=E.slice(0,b)).length;g<b;v[g++]=0);_=A.slice(),_=[0].concat(_),m=A[0],A[1]>=i/2&&m++;do{if(c=0,(o=T(A,v,b,g))<0){if(d=v[0],b!=g&&(d=d*i+(v[1]||0)),1<(c=I(d/m)))for(f=(s=R(A,c=i<=c?i-1:c,i)).length,g=v.length;1==T(s,v,f,g);)c--,k(s,b<f?_:A,f,i),f=s.length,o=1;else 0==c&&(o=c=1),f=(s=A.slice()).length;if(k(v,s=f<g?[0].concat(s):s,g,i),g=v.length,-1==o)for(;T(A,v,b,g)<1;)c++,k(v,b<g?_:A,g,i),g=v.length}else 0===o&&(c++,v=[0])}while(p[l++]=c,v[0]?v[g++]=E[y]||0:(v=[E[y]],g=1),(y++<w||null!=v[0])&&O--);a=null!=v[0],p[0]||p.splice(0,1)}if(i==L){for(l=1,O=p[0];10<=O;O/=10,l++);B(h,r+(h.e=l+u*M-1)+1,n,a)}else h.e=u,h.r=+a;return h},u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,a=/^\.([^.]+)$/,s=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var i,o=r?t:t.replace(p,"");if(s.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(u,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(l,"$1").replace(a,"0.$1")),t!=o))return new P(o,i);if(P.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 P(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return V(this,new P(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return W(e,0,G),null==t?t=m:W(t,0,8),B(new P(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 P(e,t),w,m)},r.dividedToIntegerBy=r.idiv=function(e,t){return d(this,new P(e,t),0,1)},r.exponentiatedBy=r.pow=function(e,t){var r,n,i,o,u,l,a,c,s=this;if((e=new P(e)).c&&!e.isInteger())throw Error(U+"Exponent not an integer: "+$(e));if(null!=t&&(t=new P(t)),u=14<e.e,!s.c||!s.c[0]||1==s.c[0]&&!s.e&&1==s.c.length||!e.c||!e.c[0])return c=new P(Math.pow(+$(s),u?2-ne(e):+$(e))),t?c.mod(t):c;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new P(NaN);(n=!l&&s.isInteger()&&t.isInteger())&&(s=s.mod(t))}else{if(9<e.e&&(0<s.e||s.e<-1||(0==s.e?1<s.c[0]||u&&24e7<=s.c[1]:s.c[0]<8e13||u&&s.c[0]<=9999975e7)))return o=s.s<0&&ne(e)?-0:0,-1<s.e&&(o=1/o),new P(l?1/o:o);A&&(o=Q(A/M+2))}for(a=u?(r=new P(.5),l&&(e.s=1),ne(e)):(i=Math.abs(+$(e)))%2,c=new P(v);;){if(a){if(!(c=c.times(s)).c)break;o?c.c.length>o&&(c.c.length=o):n&&(c=c.mod(t))}if(i){if(0===(i=I(i/2)))break;a=i%2}else if(B(e=e.times(r),e.e+1,1),14<e.e)a=ne(e);else{if(0==(i=+$(e)))break;a=i%2}s=s.times(s),o?s.c&&s.c.length>o&&(s.c.length=o):n&&(s=s.mod(t))}return n?c:(l&&(c=v.div(c)),t?c.mod(t):o?B(c,A,m,void 0):c)},r.integerValue=function(e){var t=new P(this);return null==e?e=m:W(e,0,8),B(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===V(this,new P(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<V(this,new P(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=V(this,new P(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 V(this,new P(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=V(this,new P(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,u=this,l=u.s;if(t=(e=new P(e,t)).s,!l||!t)return new P(NaN);if(l!=t)return e.s=-t,u.plus(e);var a=u.e/M,c=e.e/M,s=u.c,f=e.c;if(!a||!c){if(!s||!f)return s?(e.s=-t,e):new P(f?u:NaN);if(!s[0]||!f[0])return f[0]?(e.s=-t,e):new P(s[0]?u:3==m?-0:0)}if(a=q(a),c=q(c),s=s.slice(),l=a-c){for((i=(o=l<0)?(l=-l,s):(c=a,f)).reverse(),t=l;t--;i.push(0));i.reverse()}else for(n=(o=(l=s.length)<(t=f.length))?l:t,l=t=0;t<n;t++)if(s[t]!=f[t]){o=s[t]<f[t];break}if(o&&(i=s,s=f,f=i,e.s=-e.s),0<(t=(n=f.length)-(r=s.length)))for(;t--;s[r++]=0);for(t=L-1;l<n;){if(s[--n]<f[n]){for(r=n;r&&!s[--r];s[r]=t);--s[r],s[n]+=L}s[n]-=f[n]}for(;0==s[0];s.splice(0,1),--c);return s[0]?D(e,s,c):(e.s=3==m?-1:1,e.c=[e.e=0],e)},r.modulo=r.mod=function(e,t){var r,n=this;return e=new P(e,t),!n.c||!e.s||e.c&&!e.c[0]?new P(NaN):!e.c||n.c&&!n.c[0]?new P(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,u,l,a,c,s,f,h,p=this,v=p.c,g=(e=new P(e,t)).c;if(!(v&&g&&v[0]&&g[0]))return!p.s||!e.s||v&&!v[0]&&!g||g&&!g[0]&&!v?e.c=e.e=e.s=null:(e.s*=p.s,v&&g?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=q(p.e/M)+q(e.e/M),e.s*=p.s,(l=v.length)<(p=g.length)&&(h=v,v=g,g=h,n=l,l=p,p=n),n=l+p,h=[];n--;h.push(0));for(n=p;0<=--n;){for(s=g[n]%1e7,f=g[n]/1e7|(r=0),i=n+(o=l);n<i;)r=((a=s*(a=v[--o]%1e7)+(u=f*a+(c=v[o]/1e7|0)*s)%1e7*1e7+h[i]+r)/1e14|0)+(u/1e7|0)+f*c,h[i--]=a%1e14;h[i]=r}return r?++t:h.splice(0,1),D(e,h,t)},r.negated=function(){var e=new P(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new P(e,t)).s,!i||!t)return new P(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/M,u=e.e/M,l=n.c,a=e.c;if(!o||!u){if(!l||!a)return new P(i/0);if(!l[0]||!a[0])return a[0]?e:new P(l[0]?n:0*i)}if(o=q(o),u=q(u),l=l.slice(),i=o-u){for((r=0<i?(u=o,a):(i=-i,l)).reverse();i--;r.push(0));r.reverse()}for((i=l.length)-(t=a.length)<0&&(r=a,a=l,l=r,t=i),i=0;t;)i=(l[--t]=l[t]+a[t]+i)/L|0,l[t]=L===l[t]?0:l[t]%L;return i&&(l=[i].concat(l),++u),D(e,l,u)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return W(e,1,G),null==t?t=m:W(t,0,8),B(new P(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 W(e,-te,te),this.times("1e"+e)},r.squareRoot=r.sqrt=function(){var e,t,r,n,i,o=this,u=o.c,l=o.s,a=o.e,c=w+4,s=new P("0.5");if(1!==l||!u||!u[0])return new P(!l||l<0&&(!u||u[0])?NaN:u?o:1/0);if((r=0==(l=Math.sqrt(+$(o)))||l==1/0?(((t=H(u)).length+a)%2==0&&(t+="0"),l=Math.sqrt(+t),a=q((a+1)/2)-(a<0||a%2),new P(t=l==1/0?"5e"+a:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+a)):new P(l+"")).c[0])for((l=(a=r.e)+c)<3&&(l=0);;)if(i=r,r=s.times(i.plus(d(o,i,c,1))),H(i.c).slice(0,l)===(t=H(r.c)).slice(0,l)){if(r.e<a&&--l,"9999"!=(t=t.slice(l-3,l+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(B(r,r.e+w+2,1),e=!r.times(r).eq(o));break}if(!n&&(B(i,i.e+w+2,0),i.times(i).eq(o))){r=i;break}c+=4,l+=4,n=1}return B(r,r.e+w+1,m,e)},r.toExponential=function(e,t){return null!=e&&(W(e,0,G),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(W(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"==C(t)?(r=t,t=null):e&&"object"==C(e)?(r=e,e=t=null):r=N;else if("object"!=C(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,u=r.groupSeparator||"",l=t[0],t=t[1],a=this.s<0,c=a?l.slice(1):l,s=c.length;if(o&&(n=i,i=o,s-=o=n),0<i&&0<s){for(l=c.substr(0,n=s%i||i);n<s;n+=i)l+=u+c.substr(n,i);0<o&&(l+=u+c.slice(n)),a&&(l="-"+l)}e=t?l+(r.decimalSeparator||"")+((o=+r.fractionGroupSize)?t.replace(new RegExp("\\d{"+o+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):t):l}return(r.prefix||"")+e+(r.suffix||"")},r.toFraction=function(e){var t,r,n,i,o,u,l,a,c,s,f=this,h=f.c;if(null!=e&&(!(l=new P(e)).isInteger()&&(l.c||1!==l.s)||l.lt(v)))throw Error(U+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+$(l));if(!h)return new P(f);for(t=new P(v),c=r=new P(v),n=a=new P(v),h=H(h),o=t.e=h.length-f.e-1,t.c[0]=re[(u=o%M)<0?M+u:u],e=!e||0<l.comparedTo(t)?0<o?t:c:l,u=O,O=1/0,l=new P(h),a.c[0]=0;s=d(l,t,0,1),1!=(i=r.plus(s.times(n))).comparedTo(e);)r=n,n=i,c=a.plus(s.times(i=c)),a=i,t=l.minus(s.times(i=t)),l=i;return i=d(e.minus(r),n,0,1),a=a.plus(i.times(c)),r=r.plus(i.times(n)),a.s=c.s=f.s,h=d(c,n,o*=2,m).minus(f).abs().comparedTo(d(a,r,o,m).minus(f).abs())<1?[c,n]:[a,r],O=u,h},r.toNumber=function(){return+$(this)},r.toPrecision=function(e,t){return null!=e&&W(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?ie(H(r.c),i):Z(H(r.c),i,"0"):10===e&&j?Z(H((r=B(new P(r),w+i+1,m)).c),r.e,"0"):(W(e,2,S.length,"Base"),f(Z(H(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return $(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&P.set(e),P}();function oe(e,t,r){var n="";if(m.isBigNumber(e))n=e.toFixed();else if("string"!=typeof e)n=e.toString();else if(!0===r){r=$(e);if(null===r.num)return null;n=m(r.num).toFixed()}else n=m(e).toFixed();if("undefined"===n||"NaN"===n)return null;var i,o,u,l,a,c,s,f,h=null,p=null,v=null,g=null,d="~-";return t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","="].includes(e.value))throw new Error("错误的格式化参数:",e.value);p=e.value}else if("comma"===t)v=!0;else if("number"===t)h=e.value;else if("plus"===t)g=!0;else{if("round"!==t)throw new Error("错误的fmt Token");d=e.value}}),null!==h&&(r=n.split("."),e=r[0],t=1===r.length?"":r[1],r=p,u=h,s=d,l=i=e,f=(a=o=t).length,c={"~-":function(){a=o.slice(0,u)},"~+":function(){""===(a=o.slice(0,u))?l=i.slice(0,i.length-1)+(+i[i.length-1]+1):a=a.slice(0,u-1)+(+a[u-1]+1)},"~5":function(){a=o.slice(0,u);var e=+o[u];""===a?5<=e&&(l=i.slice(0,i.length-1)+(+i[i.length-1]+1)):5<=e&&(a=a.slice(0,u-1)+(+a[u-1]+1))},"~6":function(){a=o.slice(0,u);var e=""===(e=o.slice(+u+1,o.length))?0:parseInt(e),t=+o[u],r=+i[i.length-1];""===a?(6<=t||5==t&&0<e||5==t&&r%2!=0)&&(l=i.slice(0,i.length-1)+(+i[i.length-1]+1)):(r=+o[u-1],(6<=t||5==t&&0<e||5==t&&r%2!=0)&&(a=a.slice(0,u-1)+(+a[u-1]+1)))}},"<="===r?f<=u?a=o:c[s]&&c[s]():"="===r?f<u?a=o+"0".repeat(u-f):u<f&&c[s]&&c[s]():">="===r&&f<u&&(a=o+"0".repeat(u-f)),e=(c={intPart:l,decPart:a}).intPart,n=""===(t=c.decPart)?e:"".concat(e,".").concat(t)),null!==v&&(n=1<(s=n.split(".")).length?((r=s[0]).includes("-")?s[0]=r[0]+r.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):s[0]=r.replace(/(?=(?!^)(?:\d{3})+$)/g,","),s.join(".")):(f=s[0]).includes("-")?f[0]+f.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):f.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),n=null===g||n.startsWith("-")?n:"+"+n}function ue(e,t){for(var r=1<arguments.length&&void 0!==t&&t,n=[],i=0,o=null,u=e.length;i<u;)if(o=e[i],/\s/.test(o))i++;else if("+-".includes(o)){var l=n[n.length-1];if(0===n.length||"+-".includes(l)||"("===l){var a=o;if(++i>=u){n.push(a);break}for(var o=e[i],c=0;/[^*/()\s]/.test(o)&&(["+","-"].includes(o)&&c++,!(2<c||!/[eE]/.test(a[a.length-1])&&"+-".includes(o)))&&(a+=o,!(++i>=u));)o=e[i];n.push(a)}else n.push(o),i++}else if("*/%()".includes(o))n.push(o),i++;else if(/[a-zA-Z_$]/.test(o)){for(var s="";/[\w_.\[\]"']/.test(o)&&(s+=o,!(++i>=u));)o=e[i];n.push(s)}else if(/\d/.test(o)){for(var f="",h=0,p=void 0,p=r?/[^*/()\s]/:/[\d.eE\+-]/;p.test(o)&&(["+","-"].includes(o)&&h++,!(1<h||!/[eE]/.test(f[f.length-1])&&"+-".includes(o)))&&(f+=o,!(++i>=u));)o=e[i];n.push(f)}return n}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},le=Array.isArray,r="object"==C(r)&&r&&r.Object===Object&&r,n="object"==("undefined"==typeof self?"undefined":C(self))&&self&&self.Object===Object&&self,r=r||n||Function("return this")(),n=r.Symbol,s=Object.prototype,ae=s.hasOwnProperty,ce=s.toString,f=n?n.toStringTag:void 0;var se=Object.prototype.toString;var fe=function(e){var t=ae.call(e,f),r=e[f];try{var n=!(e[f]=void 0)}catch(e){}var i=ce.call(e);return n&&(t?e[f]=r:delete e[f]),i},he=function(e){return se.call(e)},pe=n?n.toStringTag:void 0;function ve(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(pe&&pe in Object(e)?fe:he)(e)}var ge=ve,de=function(e){return null!=e&&"object"==C(e)};function ye(e){return"symbol"==C(e)||de(e)&&"[object Symbol]"==ge(e)}var we=le,me=ye,be=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_e=/^\w*$/;function Oe(e,t){if(we(e))return!1;var r=C(e);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!me(e))||(_e.test(e)||!be.test(e)||null!=t&&e in Object(t))}function Ee(e){var t=C(e);return null!=e&&("object"==t||"function"==t)}var Ae=ve,Ne=Ee;function Se(e){return!!Ne(e)&&("[object Function]"==(e=Ae(e))||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)}var s=r["__core-js_shared__"],je=(s=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"";var Pe=Function.prototype.toString;var xe=Se,Re=function(e){return!!je&&je in e},Te=Ee,ke=function(e){if(null!=e){try{return Pe.call(e)}catch(e){}try{return e+""}catch(e){}}return""},De=/^\[object .+?Constructor\]$/,s=Function.prototype,p=Object.prototype,s=s.toString,p=p.hasOwnProperty,Be=RegExp("^"+s.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var $e=function(e){return!(!Te(e)||Re(e))&&(xe(e)?Be:De).test(ke(e))},Fe=function(e,t){return null==e?void 0:e[t]};function Ce(e,t){return e=Fe(e,t),$e(e)?e:void 0}var s=Ce(Object,"create"),Ie=s;var Ue=s,Le=Object.prototype.hasOwnProperty;var Me=s,ze=Object.prototype.hasOwnProperty;var Ge=s;function qe(e){return e=this.has(e)&&delete this.__data__[e],this.size-=e?1:0,e}function He(e){var t,r=this.__data__;return Ue?"__lodash_hash_undefined__"===(t=r[e])?void 0:t:Le.call(r,e)?r[e]:void 0}function Ve(e){var t=this.__data__;return Me?void 0!==t[e]:ze.call(t,e)}function We(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ge&&void 0===t?"__lodash_hash_undefined__":t,this}function b(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])}}b.prototype.clear=function(){this.__data__=Ie?Ie(null):{},this.size=0},b.prototype.delete=qe,b.prototype.get=He,b.prototype.has=Ve,b.prototype.set=We;p=b;var Ze=function(e,t){return e===t||e!=e&&t!=t};function Xe(e,t){for(var r=e.length;r--;)if(Ze(e[r][0],t))return r;return-1}var Ye=Xe,Je=Array.prototype.splice;var Ke=Xe;var Qe=Xe;var et=Xe;function tt(e){var t=this.__data__;return!((e=Ye(t,e))<0)&&(e==t.length-1?t.pop():Je.call(t,e,1),--this.size,!0)}function rt(e){var t=this.__data__;return(e=Ke(t,e))<0?void 0:t[e][1]}function nt(e){return-1<Qe(this.__data__,e)}function it(e,t){var r=this.__data__,n=et(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function _(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])}}_.prototype.clear=function(){this.__data__=[],this.size=0},_.prototype.delete=tt,_.prototype.get=rt,_.prototype.has=nt,_.prototype.set=it;var s=_,r=Ce(r,"Map"),ot=p,ut=s,lt=r;var at=function(e){var t=C(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};function ct(e,t){return e=e.__data__,at(t)?e["string"==typeof t?"string":"hash"]:e.map}var st=ct;var ft=ct;var ht=ct;var pt=ct;function vt(e){return e=st(this,e).delete(e),this.size-=e?1:0,e}function gt(e){return ft(this,e).get(e)}function dt(e){return ht(this,e).has(e)}function yt(e,t){var r=pt(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function O(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])}}O.prototype.clear=function(){this.size=0,this.__data__={hash:new ot,map:new(lt||ut),string:new ot}},O.prototype.delete=vt,O.prototype.get=gt,O.prototype.has=dt,O.prototype.set=yt;var wt=O;function mt(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(mt.Cache||wt),o}mt.Cache=wt;var bt=mt;var _t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ot=/\\(\\)?/g,p=function(e){var t=(e=bt(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(_t,function(e,t,r,n){i.push(r?n.replace(Ot,"$1"):t||e)}),i});var Et=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},At=le,Nt=ye,s=n?n.prototype:void 0,St=s?s.toString:void 0;var jt=function e(t){if("string"==typeof t)return t;if(At(t))return Et(t,e)+"";if(Nt(t))return St?St.call(t):"";var r=t+"";return"0"==r&&1/t==-1/0?"-0":r};var Pt=le,xt=Oe,Rt=p,Tt=function(e){return null==e?"":jt(e)};var kt=ye;var Dt=function(e,t){return Pt(e)?e:xt(e,t)?[e]:Rt(Tt(e))},Bt=function(e){if("string"==typeof e||kt(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t};var $t=function(e,t){for(var r=0,n=(t=Dt(t,e)).length;null!=e&&r<n;)e=e[Bt(t[r++])];return r&&r==n?e:void 0};var E=function(e,t,r){return void 0===(e=null==e?void 0:$t(e,t))?r:e};function Ft(e,t,r){var n=[];if(!d(t))throw new w("错误的填充数据:",t);Array.isArray(t)?n=t:n.push(t);for(var i=[],o=0;o<e.length;o++){var u=e[o];if(T.test(u)){if("undefined"===u||"NaN"===u)throw new w("key不应该为:".concat(u));for(var l=null,a=0;a<n.length;a++){var c=n[a],c=E(c,u);if(void 0!==c){l=c;break}}if(null===l)throw new w("token填充失败,请确认".concat(u,"存在"));if("string"==typeof l){if(""===l.trim())throw new w("token填充失败,".concat(u,"值不可为空字符"));if(!0===r){if(!R.test(l))throw new w("token填充失败,".concat(u,"值:").concat(l,"为非法单位数字"))}else if(!h(l))throw new w("token填充失败,".concat(u,"值:").concat(l,"为非法数字"))}l="string"!=typeof l?l.toString():l,i.push(l)}else i.push(u)}return i}function Ct(e,i){return e.map(function(e){if("var"!==e.type)return e;for(var t,r,n=0;n<i.length&&!g(t=E(i[n],e.value));n++);if("number"==typeof(r=t)||h(r))return{type:"number",value:t};throw new w("错误的填充值")})}function It(e){var r=null;return e.length,{tokens:e.map(function(e){var t=$(e);return null!==t.unit?(null==r&&(r=t.unit),t.num):e}),unit:r}}function Ut(e){for(var t,r=[],n=[],i=e;0<i.length;){var o=i.shift();if(k(o))if("("===o)r.push(o);else if(")"===o){for(var u=r.pop();"("!==u&&0<r.length;)n.push(u),u=r.pop();if("("!==u)throw"error: unmatched ()"}else{for(;t=r[r.length-1],D(o)<=D(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}function Lt(e){for(var t=[];0<e.length;){var r=e.shift();if(k(r)){if(t.length<2)throw new y("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),i=t.pop();if("string"==typeof n&&!m.isBigNumber(n)){if(!h(n))throw new y("".concat(n,"不是一个合法的数字"));n=new m(n)}if("string"==typeof i&&!m.isBigNumber(i)){if(!h(i))throw new y("".concat(i,"不是一个合法的数字"));i=new m(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))}}else t.push(r)}if(1!==t.length)throw"unvalid expression";var o=t[0];if((o=m.isBigNumber(o)?o:m(o)).isNaN())throw new y("计算结果为NaN");return o}return e.calc=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=J(t),o=ue(i.expr,E(i,"data._unit",!1)),u=null,l=null;if(!0===E(i,"data._debug")&&(console.warn("======a-calc调试模式======"),console.warn(i),console.warn(o),i.fmt&&console.warn(i.fmt)),d(i.data)){var a=i.data,c=[],s=a._error,f=a._fillError,h=a._warn,p=E(a,"_unit",null);if(Array.isArray(a)?c=a:(c.push(u=a),g(a=E(u,"_fillData"))&&(Array.isArray(a)?c=[].concat(v(c),v(a)):c.push(a))),B(f,s))try{o=Ft(o,c,p),d(i.fmt)&&(i.fmt=Ct(i.fmt,c))}catch(e){if(e instanceof w)return g(h)&&!0===h&&console.warn(e),g(f)?f:s;throw e}else o=Ft(o,c,p),d(i.fmt)&&(i.fmt=Ct(i.fmt,c));!0===p&&(l=(a=It(o)).unit,o=a.tokens)}if(!0===E(i,"data._debug")&&(console.warn(o),console.warn("单位:".concat(l))),f=Ut(o),c=null,d(u)&&B(n,s))try{c=Lt(f)}catch(e){if(e instanceof y)return void 0!==h&&!0===h&&console.warn(e),s;throw e}else c=Lt(f);return null!==(c=d(i.fmt)?oe(c,i.fmt):null!==c?c.toFixed():null)&&null!==l&&(c+=l),c},e.fmt=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=J(t),i=ue(n.expr,E(n,"data._unit",!1)),o=null,u=null;if(!0===E(n,"data._debug")&&(console.warn("======a-calc调试模式======"),console.warn(n),console.warn(i)),""===n.expr.trim()&&d(n.data)&&g(n.data._error))return n.data._error;if(2<i.length)throw new Error("fmt并非用于计算, 不能传入多个标识:".concat(n.expr));if(1!==i.length)throw new Error("fmt接收了一个无法被解析的标识");if(d(n.data)){var l,a=n.data,c=[],s=a._fillError,f=E(a,"_unit",null);if(Array.isArray(a)?c=a:(c.push(o=a),g(l=E(o,"_fillData"))&&(Array.isArray(l)?c=[].concat(v(c),v(l)):c.push(l))),B(s,a._error))try{i=Ft(i,c,f),d(n.fmt)&&(n.fmt=Ct(n.fmt,c))}catch(e){if(e instanceof w)return void 0!==o._warn&&!0===o._warn&&console.warn(e),o._fillError||o._error;throw e}else i=Ft(i,c,f),d(n.fmt)&&(n.fmt=Ct(n.fmt,c));!0===f&&(u=(l=It(i)).unit,i=l.tokens)}if(s=i[0],!0===f){if(!R.test(s))throw new w("token填充失败,".concat(key,"值:").concat(value,"为非法单位数字"))}else if(!h(s))throw new w("待格式化对象: ".concat(s," 不是数字"));return null!==(a=null!==n.fmt?oe(s,n.fmt,f):m(s).toFixed())&&null!==u&&(a+=u),a},e.version="0.0.80",Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var a_calc=function(e){"use strict";function D(e){return(D="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 E(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 O="1.0.2",N=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*$/,A=/^[+-]?\d[\d.]*(?:e\+|E\+|e-|E-|e|E)?\d*\D*$/;function S(e){return-1<"+-*/%()**".indexOf(e)}function j(e){switch(e){case"+":case"-":return 1;case"*":case"/":case"%":case"**":return 2;default:return 0}}function f(e){return void 0!==e}function h(e){return null!==e}function c(e){return"string"==typeof e&&!!N.test(e)}var o={initial:"initial",number:"number",variable:"var",symbol:"symbol",percent:"percent",round:"round",plus:"plus",comma:"comma",fraction:"fraction",scientific:"scientific"},x="<>=";function k(e){for(var t=o.initial,r=[],n=[];e;){var i=e[0];if(t===o.initial)if(x.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):x.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"==D(t)&&t&&t.Object===Object&&t,i="object"==("undefined"==typeof self?"undefined":D(self))&&self&&self.Object===Object&&self,t=t||i||Function("return this")(),i=t.Symbol,s=Object.prototype,P=s.hasOwnProperty,T=s.toString,u=i?i.toStringTag:void 0;var $=Object.prototype.toString;var B=function(e){var t=P.call(e,u),r=e[u];try{var n=!(e[u]=void 0)}catch(e){}var i=T.call(e);return n&&(t?e[u]=r:delete e[u]),i},I=function(e){return $.call(e)},R=i?i.toStringTag:void 0;function C(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":(R&&R in Object(e)?B:I)(e)}var J=C,K=function(e){return null!=e&&"object"==D(e)};function l(e){return"symbol"==D(e)||K(e)&&"[object Symbol]"==J(e)}var Q=r,ee=l,te=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,re=/^\w*$/;function ne(e,t){var r;return!Q(e)&&(!("number"!=(r=D(e))&&"symbol"!=r&&"boolean"!=r&&null!=e&&!ee(e))||re.test(e)||!te.test(e)||null!=t&&e in Object(t))}function ie(e){var t=D(e);return null!=e&&("object"==t||"function"==t)}var oe=C,se=ie;function ue(e){return!!se(e)&&("[object Function]"==(e=oe(e))||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e)}var s=t["__core-js_shared__"],le=(s=/[^.]+$/.exec(s&&s.keys&&s.keys.IE_PROTO||""))?"Symbol(src)_1."+s:"";var ce=Function.prototype.toString;var ae=ue,fe=function(e){return!!le&&le in e},he=ie,pe=function(e){if(null!=e){try{return ce.call(e)}catch(e){}try{return e+""}catch(e){}}return""},ge=/^\[object .+?Constructor\]$/,s=Function.prototype,a=Object.prototype,s=s.toString,a=a.hasOwnProperty,ve=RegExp("^"+s.call(a).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var de=function(e){return!(!he(e)||fe(e))&&(ae(e)?ve:ge).test(pe(e))},me=function(e,t){return null==e?void 0:e[t]};function ye(e,t){return e=me(e,t),de(e)?e:void 0}var s=ye(Object,"create"),we=s;var be=s,_e=Object.prototype.hasOwnProperty;var Ee=s,Oe=Object.prototype.hasOwnProperty;var Ne=s;function Ae(e){return e=this.has(e)&&delete this.__data__[e],this.size-=e?1:0,e}function Se(e){var t,r=this.__data__;return be?"__lodash_hash_undefined__"===(t=r[e])?void 0:t:_e.call(r,e)?r[e]:void 0}function je(e){var t=this.__data__;return Ee?void 0!==t[e]:Oe.call(t,e)}function xe(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Ne&&void 0===t?"__lodash_hash_undefined__":t,this}function p(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])}}p.prototype.clear=function(){this.__data__=we?we(null):{},this.size=0},p.prototype.delete=Ae,p.prototype.get=Se,p.prototype.has=je,p.prototype.set=xe;a=p;var ke=function(e,t){return e===t||e!=e&&t!=t};function g(e,t){for(var r=e.length;r--;)if(ke(e[r][0],t))return r;return-1}var Pe=g,Te=Array.prototype.splice;var $e=g;var Be=g;var Ie=g;function Re(e){var t=this.__data__;return!((e=Pe(t,e))<0||(e==t.length-1?t.pop():Te.call(t,e,1),--this.size,0))}function Ce(e){var t=this.__data__;return(e=$e(t,e))<0?void 0:t[e][1]}function De(e){return-1<Be(this.__data__,e)}function Fe(e,t){var r=this.__data__,n=Ie(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,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.__data__=[],this.size=0},v.prototype.delete=Re,v.prototype.get=Ce,v.prototype.has=De,v.prototype.set=Fe;var s=v,t=ye(t,"Map"),Ue=a,Le=s,ze=t;var Me=function(e){var t=D(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e};function d(e,t){return e=e.__data__,Me(t)?e["string"==typeof t?"string":"hash"]:e.map}var Ge=d;var qe=d;var He=d;var Ve=d;function We(e){return e=Ge(this,e).delete(e),this.size-=e?1:0,e}function Ze(e){return qe(this,e).get(e)}function Xe(e){return He(this,e).has(e)}function Ye(e,t){var r=Ve(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function m(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])}}m.prototype.clear=function(){this.size=0,this.__data__={hash:new Ue,map:new(ze||Le),string:new Ue}},m.prototype.delete=We,m.prototype.get=Ze,m.prototype.has=Xe,m.prototype.set=Ye;var Je=m;function y(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(y.Cache||Je),o}y.Cache=Je;var Ke=y;var Qe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/\\(\\)?/g,a=function(e){var t=(e=Ke(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(Qe,function(e,t,r,n){i.push(r?n.replace(et,"$1"):t||e)}),i});var tt=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},rt=r,nt=l,s=i?i.prototype:void 0,it=s?s.toString:void 0;var ot=function e(t){var r;return"string"==typeof t?t:rt(t)?tt(t,e)+"":nt(t)?it?it.call(t):"":"0"==(r=t+"")&&1/t==-1/0?"-0":r};var st=r,ut=ne,lt=a,ct=function(e){return null==e?"":ot(e)};var at=l;var ft=function(e,t){return st(e)?e:ut(e,t)?[e]:lt(ct(e))},ht=function(e){var t;return"string"==typeof e||at(e)?e:"0"==(t=e+"")&&1/e==-1/0?"-0":t};var pt=function(e,t){for(var r=0,n=(t=ft(t,e)).length;null!=e&&r<n;)e=e[ht(t[r++])];return r&&r==n?e:void 0};var w=function(e,t,r){return void 0===(e=null==e?void 0:pt(e,t))?r:e};var b={initial:"initial",number:"number",scientific:"scientific",operator:"operator",bracket:"bracket",var:"var"},gt="+-",vt="*/%",dt="()";function mt(e,t){for(var r,n,i,o=1<arguments.length&&void 0!==t&&t,s=b.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 b.initial:if(gt.includes(r)){var h=l.at(-1),s=0===l.length||"operator"===h.type||"("===h?b.number:b.operator;c()}else if(vt.includes(r))s=b.operator,c();else if(/\d/.test(r))s=b.number,c();else if(dt.includes(r))s=b.bracket;else if(/[a-zA-Z_$]/.test(r))s=b.var,c();else{if(!/\s/.test(r))throw new Error("不识别的字符".concat(r));f()}break;case b.bracket:l.push({type:b.bracket,value:r}),f(),s=b.initial;break;case b.operator:h=u.at(-1);"*"===r&&"*"===h&&c(),a(b.operator),s=b.initial;break;case b.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=b.scientific,c()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(r)||"space"===o&&/\S/.test(r)?c():(a(b.number),s=b.initial);break;case b.scientific:/\d/.test(r)?c():gt.includes(r)?(n=u.slice(1),i=u.at(-1),n.includes(r)||!/[Ee]/.test(i)?(a(b.scientific),s=b.initial):c()):["auto","on",!0].includes(o)&&/[^*/+\-()\s]/.test(r)||"space"===o&&/\S/.test(r)?c():(a(b.scientific),s=b.initial);break;case b.var:/[\w_.\[\]"']/.test(r)?c():(a(b.var),s=b.initial);break;default:throw new Error("状态错误")}return 0!==u.length&&(l.push({type:s,value:u.join("")}),u.length=0,s=b.initial),l}function yt(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=w(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(!A.test(s))throw new Error("token填充失败,".concat(o.value,"值:").concat(s,"为非法单位数字"))}else if(!c(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 wt(e){for(var t,r=[],n=[],i=e.map(function(e){return e.value});0<i.length;){var o=i.shift();if(S(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],j(o)<=j(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 bt=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,_t=Math.ceil,F=Math.floor,U="[BigNumber Error] ",Et=U+"Number primitive has more than 15 significant digits: ",L=1e14,z=14,Ot=9007199254740991,Nt=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],M=1e7,G=1e9;function q(e){var t=0|e;return 0<e||e===t?t:t-1}function H(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=z-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function V(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 W(e,t,r,n){if(e<t||r<e||e!==F(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 Z(e){var t=e.c.length-1;return q(e.e/z)==t&&e.c[t]%2!=0}function X(e,t){return(1<e.length?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Y(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 _=function C(e){var d,f,h,t,c,m,s,u,l,a,p,r=x.prototype={constructor:x,toString:null,valueOf:null},g=new x(1),y=20,w=4,v=-7,b=21,_=-1e7,E=1e7,O=!1,i=1,N=0,A={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},S="0123456789abcdefghijklmnopqrstuvwxyz",j=!0;function x(e,t){var r,n,i,o,s,u,l,c,a=this;if(!(a instanceof x))return new x(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(!bt.test(c=String(e)))return h(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(W(t,2,S.length,"Base"),10==t&&j)return I(a=new x(e),y+a.e+1,w);if(c=String(e),u="number"==typeof e){if(0*e!=0)return h(a,c,u,t);if(a.s=1/e<0?(c=c.slice(1),-1):1,x.DEBUG&&15<c.replace(/^0\.0*|\./,"").length)throw Error(Et+e)}else a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1;for(r=S.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 h(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&&x.DEBUG&&15<l&&(Ot<e||e!==F(e)))throw Error(Et+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)%z,o<0&&(s+=z),s<l){for(s&&a.c.push(+c.slice(0,s)),l-=z;s<l;)a.c.push(+c.slice(s,s+=z));s=z-(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%M,c=t/M|0;for(e=e.slice();u--;)s=((i=l*(o=e[u]%M)+(n=c*o+(o=e[u]/M|0)*l)%M*M+s)/r|0)+(n/M|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 $(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:W(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)u=H(e.c),u=1==n||2==n&&(o<=v||b<=o)?X(u,o):Y(u,o,"0");else if(r=(e=I(new x(e),t,r)).e,s=(u=H(e.c)).length,1==n||2==n&&(t<=r||r<=v)){for(;s<t;u+="0",s++);u=X(u,r)}else if(t-=o,u=Y(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 x(e[0]);n<e.length;n++){if(!(r=new x(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function B(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*z-1)>E?e.c=e.e=null:r<_?e.c=[e.e=0]:(e.e=r,e.c=t),e}function I(e,t,r,n){var i,o,s,u,l,c,a,f=e.c,h=Nt;if(f){e:{for(i=1,u=f[0];10<=u;u/=10,i++);if((o=t-i)<0)o+=z,s=t,a=(l=f[c=0])/h[i-s-1]%10|0;else if((c=_t((o+1)/z))>=f.length){if(!n)break e;for(;f.length<=c;f.push(0));l=a=0,s=(o%=z)-z+(i=1)}else{for(l=u=f[c],i=1;10<=u;u/=10,i++);a=(s=(o%=z)-z+i)<0?0:l/h[i-s-1]%10|0}if(n=n||t<0||null!=f[c+1]||(s<0?l:l%h[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/h[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]=h[(z-t%z)%z],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=c,u=1,c--):(f.length=c+1,u=h[z-o],f[c]=0<s?F(l/h[i-s]%h[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]==L)&&(f[0]=1);break}if(f[c]+=u,f[c]!=L)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 R(e){var t,r=e.e;return null===r?e.toString():(t=H(e.c),t=r<=v||b<=r?X(t,r):Y(t,r,"0"),e.s<0?"-"+t:t)}return x.clone=C,x.ROUND_UP=0,x.ROUND_DOWN=1,x.ROUND_CEIL=2,x.ROUND_FLOOR=3,x.ROUND_HALF_UP=4,x.ROUND_HALF_DOWN=5,x.ROUND_HALF_EVEN=6,x.ROUND_HALF_CEIL=7,x.ROUND_HALF_FLOOR=8,x.EUCLID=9,x.config=x.set=function(e){var t,r;if(null!=e){if("object"!=D(e))throw Error(U+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(W(r=e[t],0,G,t),y=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(W(r=e[t],0,8,t),w=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(W(r[0],-G,0,t),W(r[1],0,G,t),v=r[0],b=r[1]):(W(r,-G,G,t),v=-(b=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)W(r[0],-G,-1,t),W(r[1],1,G,t),_=r[0],E=r[1];else{if(W(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")&&(W(r=e[t],0,9,t),i=r),e.hasOwnProperty(t="POW_PRECISION")&&(W(r=e[t],0,G,t),N=r),e.hasOwnProperty(t="FORMAT")){if("object"!=D(r=e[t]))throw Error(U+t+" not an object: "+r);A=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),S=r}}return{DECIMAL_PLACES:y,ROUNDING_MODE:w,EXPONENTIAL_AT:[v,b],RANGE:[_,E],CRYPTO:O,MODULO_MODE:i,POW_PRECISION:N,FORMAT:A,ALPHABET:S}},x.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!x.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===F(i))if(0===n[0]){if(0===i&&1===n.length)return!0}else if((t=(i+1)%z)<1&&(t+=z),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||L<=r||r!==F(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)},x.maximum=x.max=function(){return o(arguments,r.lt)},x.minimum=x.min=function(){return o(arguments,r.gt)},x.random=(t=9007199254740992,c=Math.random()*t&2097151?function(){return F(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 x(g);if(null==e?e=y:W(e,0,G),i=_t(e/z),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%=z,i&&e&&(u[s]=F(i/(o=Nt[z-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-=z);for(s=1,o=u[0];10<=o;o/=10,s++);s<z&&(n-=z-s)}return l.e=n,l.c=u,l}),x.sum=function(){for(var e=1,t=arguments,r=new x(t[0]);e<t.length;)r=r.plus(t[e++]);return r},m="0123456789",f=function(e,t,r,n,i){var o,s,u,l,c,a,f,h,p=e.indexOf("."),g=y,v=w;for(0<=p&&(l=N,N=0,e=e.replace(".",""),a=(h=new x(t)).pow(e.length-p),N=l,h.c=k(Y(H(a.c),a.e,"0"),10,r,m),h.e=h.c.length),u=l=(f=k(e,t,r,i?(o=S,m):(o=m,S))).length;0==f[--l];f.pop());if(!f[0])return o.charAt(0);if(p<0?--u:(a.c=f,a.e=u,a.s=n,f=(a=d(a,h,g,v,r)).c,c=a.r,u=a.e),p=f[s=u+g+1],l=r/2,c=c||s<0||null!=f[s+1],c=v<4?(null!=p||c)&&(0==v||v==(a.s<0?3:2)):l<p||p==l&&(4==v||c||6==v&&1&f[s-1]||v==(a.s<0?8:7)),s<1||!f[0])e=c?Y(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(p=0,e="";p<=l;e+=o.charAt(f[p++]));e=Y(e,u,o.charAt(0))}return e},d=function(e,t,r,n,i){var o,s,u,l,c,a,f,h,p,g,v,d,m,y,w,b,_,E=e.s==t.s?1:-1,O=e.c,N=t.c;if(!(O&&O[0]&&N&&N[0]))return new x(e.s&&t.s&&(O?!N||O[0]!=N[0]:N)?O&&0==O[0]||!N?0*E:E/0:NaN);for(p=(h=new x(E)).c=[],E=r+(s=e.e-t.e)+1,i||(i=L,s=q(e.e/z)-q(t.e/z),E=E/z|0),u=0;N[u]==(O[u]||0);u++);if(N[u]>(O[u]||0)&&s--,E<0)p.push(1),l=!0;else{for(y=O.length,b=N.length,E+=2,1<(c=F(i/(N[u=0]+1)))&&(N=P(N,c,i),O=P(O,c,i),b=N.length,y=O.length),m=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=F(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--,$(a,b<f?_:N,f,i),f=a.length,o=1;else 0==c&&(o=c=1),f=(a=N.slice()).length;if($(g,a=f<v?[0].concat(a):a,v,i),v=g.length,-1==o)for(;T(N,g,b,v)<1;)c++,$(g,b<v?_:N,v,i),v=g.length}else 0===o&&(c++,g=[0])}while(p[u++]=c,g[0]?g[v++]=O[m]||0:(g=[O[m]],v=1),(m++<y||null!=g[0])&&E--);l=null!=g[0],p[0]||p.splice(0,1)}if(i==L){for(u=1,E=p[0];10<=E;E/=10,u++);I(h,r+(h.e=u+s*z-1)+1,n,l)}else h.e=s,h.r=+l;return h},s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,l=/^\.([^.]+)$/,a=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g,h=function(e,t,r,n){var i,o=r?t:t.replace(p,"");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 x(o,i);if(x.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 x(this);return e.s<0&&(e.s=1),e},r.comparedTo=function(e,t){return V(this,new x(e,t))},r.decimalPlaces=r.dp=function(e,t){var r,n;if(null!=e)return W(e,0,G),null==t?t=w:W(t,0,8),I(new x(this),e+this.e+1,t);if(!(e=this.c))return null;if(r=((n=e.length-1)-q(this.e/z))*z,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 x(e,t),y,w)},r.dividedToIntegerBy=r.idiv=function(e,t){return d(this,new x(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 x(e)).c&&!e.isInteger())throw Error(U+"Exponent not an integer: "+R(e));if(null!=t&&(t=new x(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 x(Math.pow(+R(a),s?e.s*(2-Z(e)):+R(e))),t?c.mod(t):c;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new x(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&&Z(e)?-0:0,-1<a.e&&(o=1/o),new x(u?1/o:o);N&&(o=_t(N/z+2))}for(l=s?(r=new x(.5),u&&(e.s=1),Z(e)):(i=Math.abs(+R(e)))%2,c=new x(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=F(i/2)))break;l=i%2}else if(I(e=e.times(r),e.e+1,1),14<e.e)l=Z(e);else{if(0==(i=+R(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?I(c,N,w,void 0):c)},r.integerValue=function(e){var t=new x(this);return null==e?e=w:W(e,0,8),I(t,t.e+1,e)},r.isEqualTo=r.eq=function(e,t){return 0===V(this,new x(e,t))},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(e,t){return 0<V(this,new x(e,t))},r.isGreaterThanOrEqualTo=r.gte=function(e,t){return 1===(t=V(this,new x(e,t)))||0===t},r.isInteger=function(){return!!this.c&&q(this.e/z)>this.c.length-2},r.isLessThan=r.lt=function(e,t){return V(this,new x(e,t))<0},r.isLessThanOrEqualTo=r.lte=function(e,t){return-1===(t=V(this,new x(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 x(e,t)).s,!u||!t)return new x(NaN);if(u!=t)return e.s=-t,s.plus(e);var l=s.e/z,c=e.e/z,a=s.c,f=e.c;if(!l||!c){if(!a||!f)return a?(e.s=-t,e):new x(f?s:NaN);if(!a[0]||!f[0])return f[0]?(e.s=-t,e):new x(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=L-1;u<n;){if(a[--n]<f[n]){for(r=n;r&&!a[--r];a[r]=t);--a[r],a[n]+=L}a[n]-=f[n]}for(;0==a[0];a.splice(0,1),--c);return a[0]?B(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 x(e,t),!n.c||!e.s||e.c&&!e.c[0]?new x(NaN):!e.c||n.c&&!n.c[0]?new x(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,h,p=this,g=p.c,v=(e=new x(e,t)).c;if(!(g&&v&&g[0]&&v[0]))return!p.s||!e.s||g&&!g[0]&&!v||v&&!v[0]&&!g?e.c=e.e=e.s=null:(e.s*=p.s,g&&v?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=q(p.e/z)+q(e.e/z),e.s*=p.s,(u=g.length)<(p=v.length)&&(h=g,g=v,v=h,n=u,u=p,p=n),n=u+p,h=[];n--;h.push(0));for(n=p;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+h[i]+r)/1e14|0)+(s/1e7|0)+f*c,h[i--]=l%1e14;h[i]=r}return r?++t:h.splice(0,1),B(e,h,t)},r.negated=function(){var e=new x(this);return e.s=-e.s||null,e},r.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new x(e,t)).s,!i||!t)return new x(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/z,s=e.e/z,u=n.c,l=e.c;if(!o||!s){if(!u||!l)return new x(i/0);if(!u[0]||!l[0])return l[0]?e:new x(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)/L|0,u[t]=L===u[t]?0:u[t]%L;return i&&(u=[i].concat(u),++s),B(e,u,s)},r.precision=r.sd=function(e,t){var r,n;if(null!=e&&e!==!!e)return W(e,1,G),null==t?t=w:W(t,0,8),I(new x(this),e,t);if(!(t=this.c))return null;if(r=(n=t.length-1)*z+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 W(e,-Ot,Ot),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=y+4,a=new x("0.5");if(1!==u||!s||!s[0])return new x(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);if((r=0==(u=Math.sqrt(+R(o)))||u==1/0?(((t=H(s)).length+l)%2==0&&(t+="0"),u=Math.sqrt(+t),l=q((l+1)/2)-(l<0||l%2),new x(t=u==1/0?"5e"+l:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+l)):new x(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))),H(i.c).slice(0,u)===(t=H(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))||(I(r,r.e+y+2,1),e=!r.times(r).eq(o));break}if(!n&&(I(i,i.e+y+2,0),i.times(i).eq(o))){r=i;break}c+=4,u+=4,n=1}return I(r,r.e+y+1,w,e)},r.toExponential=function(e,t){return null!=e&&(W(e,0,G),e++),n(this,e,t,1)},r.toFixed=function(e,t){return null!=e&&(W(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"==D(t)?(r=t,t=null):e&&"object"==D(e)?(r=e,e=t=null):r=A;else if("object"!=D(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,h=f.c;if(null!=e&&(!(u=new x(e)).isInteger()&&(u.c||1!==u.s)||u.lt(g)))throw Error(U+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+R(u));if(!h)return new x(f);for(t=new x(g),c=r=new x(g),n=l=new x(g),h=H(h),o=t.e=h.length-f.e-1,t.c[0]=Nt[(s=o%z)<0?z+s:s],e=!e||0<u.comparedTo(t)?0<o?t:c:u,s=E,E=1/0,u=new x(h),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,h=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,h},r.toNumber=function(){return+R(this)},r.toPrecision=function(e,t){return null!=e&&W(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?X(H(r.c),i):Y(H(r.c),i,"0"):10===e&&j?Y(H((r=I(new x(r),y+i+1,w)).c),r.e,"0"):(W(e,2,S.length,"Base"),f(Y(H(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},r.valueOf=r.toJSON=function(){return R(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,null!=e&&x.set(e),x}();function At(e){for(var t=[];0<e.length;){var r=e.shift();if(S(r)){if(t.length<2)throw new Error("错误的栈长度, 可能是无法计算的表达式");var n=t.pop(),i=t.pop();if("string"==typeof n&&!_.isBigNumber(n)){if(!c(n))throw new Error("".concat(n,"不是一个合法的数字"));n=new _(n)}if("string"==typeof i&&!_.isBigNumber(i)){if(!c(i))throw new Error("".concat(i,"不是一个合法的数字"));i=new _(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=_.isBigNumber(o)?o:_(o)).isNaN())throw new Error("计算结果为NaN");return o}function St(e,t){var r,n,i,o,s,u,l,c,a,f,h,p,g,v,d,m,y,w="";return _.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=_(w).toExponential(),o&&!e.startsWith("-")?"+"+e:e):l?(t=_(w).toFraction().map(function(e){return e.toFixed()}).join("/"),o&&!t.startsWith("-")?"+"+t:t):(c&&(w=_(w).times(100).toFixed()),r&&(e=w.split("."),t=e[0],e=1===e.length?"":e[1],m=n,h=r,d=s,p=a=t,y=(g=f=e).length,v={"~-":function(){g=f.slice(0,h)},"~+":function(){""===(g=f.slice(0,h))?p=a.slice(0,a.length-1)+(+a[a.length-1]+1):g=g.slice(0,h-1)+(+g[h-1]+1)},"~5":function(){g=f.slice(0,h);var e=+f[h];""===g?5<=e&&(p=a.slice(0,a.length-1)+(+a[a.length-1]+1)):5<=e&&(g=g.slice(0,h-1)+(+g[h-1]+1))},"~6":function(){g=f.slice(0,h);var e=""===(e=f.slice(+h+1,f.length))?0:parseInt(e),t=+f[h],r=+a[a.length-1];""===g?(6<=t||5==t&&0<e||5==t&&r%2!=0)&&(p=a.slice(0,a.length-1)+(+a[a.length-1]+1)):(r=+f[h-1],(6<=t||5==t&&0<e||5==t&&r%2!=0)&&(g=g.slice(0,h-1)+(+g[h-1]+1)))}},"<="===m?y<=h?g=f:v[d]&&v[d]():"="===m?y<h?g=f+"0".repeat(h-y):h<y&&v[d]&&v[d]():">="===m&&y<h&&(g=f+"0".repeat(h-y)),t=(v={int_part:p,dec_part:g}).int_part,w=""===(e=v.dec_part)?t:"".concat(t,".").concat(e)),i&&(w=1<(d=w.split(".")).length?((m=d[0]).includes("-")?d[0]=m[0]+m.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):d[0]=m.replace(/(?=(?!^)(?:\d{3})+$)/g,","),d.join(".")):(y=d[0]).includes("-")?y[0]+y.slice(1).replace(/(?=(?!^)(?:\d{3})+$)/g,","):y.replace(/(?=(?!^)(?:\d{3})+$)/g,",")),null===o||w.startsWith("-")||(w="+"+w),c&&(w+="%"),w))}function jt(e,i){return e.map(function(e){if("var"!==e.type)return e;for(var t,r,n=0;n<i.length&&!f(t=w(i[n],e.value));n++);if("number"==typeof(r=t)||c(r))return{type:"number",value:t};throw new Error("错误的填充值")})}function xt(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}}function kt(){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=e[1],o=w(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===o)return t.expr_err=!0,t;throw new Error("错误的第一个参数类型: ".concat(n," 类型为:").concat(D(n)))}r=n.toString()}if(f(i)&&(t.options=i),e=r.split("|"),t.expr=e[0],1<e.length){o=e[1];if(""!==o.trim())try{t.fmt=k(o)}catch(e){return t.fmt_err=!0,t}}if(null!==t.options&&t.options._fmt){var s,n=[];try{n=k(t.options._fmt)}catch(e){return t.fmt_err=!0,t}null===t.fmt?t.fmt=n:(s=t.fmt.map(function(e){return e.type}),n.forEach(function(e){s.includes(e.type)||t.fmt.push(e)}))}return t}(t),i=w(n,"options._error",!1),o=w(n,"options._debug",!1),s=w(n,"options._unit",!1),u=n.options,l=null;if(n.fmt_err||n.expr_err){if(i)return i;throw new Error("表达式或格式化字符串错误,表达式为:".concat(n.expr))}if(i)try{c=mt(n.expr,s)}catch(e){return i}else c=mt(n.expr,s);if(o&&(console.warn("======a-calc调试模式======"),console.warn("arg:"),console.warn(n),console.warn("tokens:"),console.warn(c)),h(u)){var c,a=[];if(Array.isArray(u)?a=u:(a.push(u),f(u=w(u,"_fill_data",{}))&&(Array.isArray(u)?a=[].concat(E(a),E(u)):a.push(u))),i)try{c=yt(c,a,s),h(n.fmt)&&(n.fmt=jt(n.fmt,a))}catch(e){return i}else c=yt(c,a,s),h(n.fmt)&&(n.fmt=jt(n.fmt,a));[!0,"on","auto","space"].includes(s)&&(l=(u=xt(c)).unit,c=u.tokens)}o&&(console.warn("分离单位之后的tokens:"),console.warn(c),console.warn("单位:".concat(l)));a=wt(c),s=null;if(i)try{s=At(a)}catch(e){return i}else s=At(a);if("Infinity"!==(s=h(n.fmt)?St(s,n.fmt):null!==s?s.toFixed():null)&&null!==s)return null!==l&&(s+=l),s;if(i)return i;throw new Error("计算错误可能是非法的计算式")}console.log("%ca-calc:%c ".concat(O),"color: #fff;background: #67C23A;padding: 2px 3px;border-radius:4px;font-size: 14px;","color: #409EFF;font-size:14px;");t=kt;return e.calc=kt,e.fmt=t,e.version=O,Object.defineProperty(e,"__esModule",{value:!0}),e}({});

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

export function calc (...args: any): string;
export declare function calc (
expr: any,
options?: any[] | { _error: any, _fill_data: any, _unit: boolean | "on" | "off" | "auto" | "space" }
): string;
export function fmt (...args: any): string;
export declare function fmt (
expr: any,
options?: any[] | { _error: any, _fill_data: any, _unit: boolean | "on" | "off" | "auto" | "space" }
): string;
export const version: string;
export declare const version: string;
{
"name": "a-calc",
"version": "0.0.80",
"description": "JavaScript的精准四则运算库,支持复杂运算与格式化操作例如: 带单位计算,千分位, 灵活指定小数点位数,指定舍入规则",
"main": "./cjs/index.cjs",
"exports": {
".": {
"import": "./es/index.mjs",
"require": "./cjs/index.cjs"
},
"./es": {
"import": "./es/index.mjs",
"default": "./es/index.mjs"
},
"./cjs": {
"require": "./cjs/index.cjs",
"default": "./cjs/index.cjs"
}
},
"browser": "./browser/index.js",
"module": "./es/index.mjs",
"typings": "./calc.d.ts",
"scripts": {
"dev": "rollup -c --environment build:dev",
"dev:w": "rollup -c -w --environment build:dev",
"build": "rollup -c --environment build:build & yarn test",
"build:w": "rollup -c -w --environment build:build",
"test": "cross-env ava --verbose --tap test/*.mjs"
},
"files": [
"es",
"cjs",
"browser",
"calc.d.ts"
],
"repository": {
"type": "git",
"url": "git+https://github.com/Autumn-one/a-calc-old.git"
},
"keywords": [
"四则运算",
"字符串四则运算",
"数字格式化",
"千分位",
"a-calc"
],
"author": "Autumn",
"license": "MPL-2.0",
"bugs": {
"url": "https://github.com/Autumn-one/a-calc-old/issues"
},
"homepage": "https://github.com/Autumn-one/a-calc-old#readme",
"devDependencies": {
"@babel/core": "^7.17.10",
"@babel/preset-env": "^7.17.10",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"ava": "^4.2.0",
"cross-env": "^7.0.3",
"glob": "^8.0.1",
"lodash": "^4.17.21",
"npm-run-all": "^4.1.5",
"rollup": "^2.70.2",
"rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-uglify": "^6.0.4",
"bignumber.js": "^9.0.2"
},
"dependencies": {
}
"name": "a-calc",
"version": "1.0.2",
"description": "JavaScript的精准四则运算库,支持复杂运算与格式化操作例如: 带单位计算,千分位, 灵活指定小数点位数,指定舍入规则",
"main": "./cjs/index.cjs",
"exports": {
".": {
"import": "./es/index.mjs",
"require": "./cjs/index.cjs"
},
"./es": {
"import": "./es/index.mjs",
"default": "./es/index.mjs"
},
"./cjs": {
"require": "./cjs/index.cjs",
"default": "./cjs/index.cjs"
}
},
"browser": "./browser/index.js",
"module": "./es/index.mjs",
"types": "./calc.d.ts",
"typings": "./calc.d.ts",
"scripts": {
"dev": "rollup -c --environment build:dev",
"dev:w": "rollup -c -w --environment build:dev",
"build": "rollup -c --environment build:build & npm run test",
"build:w": "rollup -c -w --environment build:build",
"test": "cross-env ava --verbose --tap test/*.mjs"
},
"files": [
"es",
"cjs",
"browser",
"calc.d.ts"
],
"repository": {
"type": "git",
"url": "git+https://github.com/Autumn-one/a-calc-old.git"
},
"keywords": [
"四则运算",
"字符串四则运算",
"数字格式化",
"千分位",
"a-calc"
],
"author": "Autumn",
"license": "MPL-2.0",
"bugs": {
"url": "https://github.com/Autumn-one/a-calc-old/issues"
},
"homepage": "https://github.com/Autumn-one/a-calc-old#readme",
"devDependencies": {
"@babel/core": "^7.17.10",
"@babel/preset-env": "^7.17.10",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"ava": "^4.2.0",
"cross-env": "^7.0.3",
"glob": "^8.0.1",
"lodash": "^4.17.21",
"npm-run-all": "^4.1.5",
"rollup": "^2.70.2",
"rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-uglify": "^6.0.4",
"bignumber.js": "^9.0.2"
},
"dependencies": {
}
}
# a-calc
来源于实际业务的字符串四则运算的库, 可解决以下问题:
来源于实际业务的字符串四则运算的库, 可解决以下问题(注意1.0.2有破坏性更新!):
* js数字计算精度问题
* 数字计算可能输出科学计数法
* 数字格式化, 数字千分位输出
* 数字格式化, 数字千分位输出, 数字直接格式化成百分比, 保留数字的正负号, 直接输出分数等
* 带单位的数字计算或格式化, 例如: `0.1% + 2% `

@@ -11,3 +11,3 @@ * 科学计数法写法的计算, 例如:`-2e3 + 6`

> 支持的运算符 : + - * / %
> 支持的运算符 : + - * / % **

@@ -61,5 +61,5 @@ ## 安装

空格在无歧义的情况下是非必须的,甚至可以正确解析下面人眼都难以解析的写法`calc("-2e+2+3e+2")`,但是没有人应该这样编写计算式来考验`a-calc`解析能力,<span style="color: red;">请记住始终在你的计算式包含空格,就像我写的示例那样!!!</span>
空格在无歧义的情况下是非必须的,甚至可以正确解析下面人眼都难以解析的写法`calc("-2e+2+3e+2")`,但是没有人应该这样编写计算式来考验`a-calc`解析能力,<span style="color: red;">请记住始终在你的计算式包含空格,这样也更漂亮和清晰,就像我写的示例那样!!!</span>
顺便举个有歧义的计算式 `calc("50%%2", {_unit: true})`这种歧义显然是在带单位计算的时候出现,由于解析器不知道你的单位是`%` 还是 `%%` 所以你要用用空格给出明确的意思,正确的写法应该是 `calc("50% % 2", {_unit: true})`
顺便举个有歧义的计算式 `calc("50%%2", {_unit: true})`这种歧义显然是在带单位计算的时候出现,由于解析器不知道你的单位是`%` 还是 `%%` 所以你要用空格给出明确的意思,正确的写法应该是 `calc("50% % 2", {_unit: true})`

@@ -105,4 +105,8 @@ 总之始终加空格!

在 `1.0.2` 之后带单位的计算可以有更多的参数,`_unit` 的取值可以为`boolean | "on" | "off" | "auto" | "space"` 参数看起来很多其实和之前的用法差不多, `true "on" "auto"` 这三个值的效果是一样的,表示自动识别数字后的单位,`false "off"` 表示关闭单位计算,最大的不同是 `"space"` 这个值表示只将空格作为单位分隔符,例如你的单位恰好是 `+-` 这种情况在普通模式下会被识别成运算符,就可以使用 `"space"` 模式,但是此时的空格就是必须的了,你要这样写:`calc("2+- * 3")` 最终结果为:`6+-`
## 计算并格式化
格式化支持如下功能:限制小数位数,保留正负号,百分比输出,科学计数法输出,千分位输出,并且他们是可以组合的,不过有个别的情况组合是不生效的,这个自己去试一下,组合情况太多,不在一一列举。
```js

@@ -124,2 +128,8 @@ // 操作小数位数

// 百分比
calc("1 + 1 | %") // 200%
// 科学计数法, 注意这里由于是普通字符串所以要用\\e,这个 e也可以大写
calc("1 + 1 | \\e") // 2e+0
// 同时指定小数位和千分位且保留正负号

@@ -166,3 +176,3 @@ calc("10000000 + 100000000 | +,=10") // +110,000,000.0000000000

calc("1 + 2sd + d",{
_fillData: {d: 3}, // 从这里数据源对象要赋给 _fillData, 该对象也可以是一个对象数组,此时取数据的时候是依次从数组的项里查找,找到第一个立刻停止
_fill_data: {d: 3}, // 从这里数据源对象要赋给 _fill_data, 该对象也可以是一个对象数组,此时取数据的时候是依次从数组的项里查找,找到第一个立刻停止
_error: "-", // 计算式出错的时候返回 - 作为替代值

@@ -186,75 +196,133 @@ })

## 在项目中的使用姿势(vue为例)
## 在项目中的使用姿势(vue3为例)
> 在项目中编写庞大的第二个参数是不好的, 所以第二个参数你应该想办法固定他, 下面只是一个在VUE项目中的演示
```js
### 集成到vue3模板
```typescript
import { calc, fmt } from "a-calc";
import type { App } from "vue";
import { getCurrentInstance } from "vue";
Vue.mixin( {
methods: {
calc ( expr, obj )
function bind_calc ( app: App<Element> )
{
// 接受一个app的实例绑定计算器
app.config.globalProperties.calc = function ( expr: string, obj: any )
{
const instance: any = getCurrentInstance();
const data_arr = [ instance.setupState, instance.data ];
let _fmt, _error, _unit;
if ( obj !== undefined ) {
dataArr.unshift( obj );
_fmt = obj._fmt === undefined ? undefined : obj._fmt;
_error = obj._error === undefined ? undefined : obj._error;
_unit = obj._unit === undefined ? undefined : obj._unit;
}
return calc( expr, {
_fill_data: data_arr,
_error: _error === undefined ? "-" : _error,
_fmt, // 格式化参数在没有字符串格式化的时候才有用
_unit
} );
};
app.config.globalProperties.fmt = function ( expr: string, obj: any )
{
// 专门格式化的
const instance: any = getCurrentInstance();
const dataArr = [ instance.setupState, instance.data ];
let _fmt, _error, _unit;
if ( obj !== undefined ) {
dataArr.unshift( obj );
_fmt = obj._fmt === undefined ? undefined : obj._fmt;
_error = obj._error === undefined ? undefined : obj._error;
_unit = obj._unit === undefined ? undefined : obj._unit;
}
return fmt( expr,
{
let dataArr = [this];
let _fmt = undefined;
let _error = undefined;
if ( obj !== undefined )
{
dataArr.unshift( obj );
if ( obj._fmt !== undefined )
{
_fmt = obj._fmt;
}
if ( obj._error !== undefined )
{
_error = obj._error;
}
}
_fill_data: data_arr,
_error: _error === undefined ? "-" : _error,
_fmt,
_unit
} );
};
return calc( expr, {
_fillData: dataArr,
_error: _error === undefined ? "-" : _error,
_fmt, // 格式化参数在没有字符串格式化的时候才有用
} );
},
fmt ( expr, obj )
{
// 专门格式化的
let dataArr = [this];
let _fmt = undefined;
let _error = undefined;
if ( obj !== undefined )
{
dataArr.unshift( obj );
if ( obj._fmt !== undefined )
{
_fmt = obj._fmt;
}
if ( obj._error !== undefined )
{
_error = obj._error;
}
}
return fmt( expr,
{
_fillData: dataArr,
_error: _error === undefined ? "-" : _error,
_fmt,
_unit: true
} );
},
},
} );
}
```
### 集成到script setup中
```typescript
interface CalcConfig
{
_fmt?: string;
_error: string;
_unit?: boolean;
}
function use_calc ( state: ReactiveVariable<any>, config: CalcConfig = { _error: "-" } )
{
const data_arr = [ state ];
const _fmt = config._fmt === undefined ? undefined : config._fmt;
const _error = config._error === undefined ? undefined : config._error;
const _unit = config._unit === undefined ? undefined : config._unit;
return function ( expr: string, data = {} )
{
data_arr.unshift( data );
return calc( expr, {
_fill_data: data_arr,
_error: _error === undefined ? "-" : _error,
_fmt, // 格式化参数在没有字符串格式化的时候才有用
_unit
} );
};
}
```
下面是使用示例
```vue
<script lang="ts" setup>
const state = reactive({
a: 1,
b: 2,
c: 3
})
const calc = use_calc(state)
calc("a + b * c")
</script>
```
## 版本变更
* 1.0.2
* 破坏性变更:所有暴露出的小驼峰命名全部改成了蛇形命名法例如原来的`_fillData` 现在变成了 `_fill_data`,原因是蛇形命名法更清晰。
* 内部代码极大的简化,解析器几乎完全重写,带来更稳定的体验
* 原先的设计就是calc函数具备所有fmt的功能,可是1.0.2 之前的版本虽然符合这个设计可是calc和fmt是分别实现的,现在fmt只是calc的别名。
* 支持新的运算符 **
* 支持新的格式化字符 % 可以将数字输出成百分比
* 支持新的格式化字符 `\e`,可以将数字格式化成科学计数法
* 修复格式化字符串非法的时候可能造成死循环的问题
* 解决1/0是 Infinity 的问题
* 增加若干单元测试
* 更详细的类型提示
* 更新文档,添加vue3集成的示例代码
* 0.0.80
* 带来4种舍入规则,分别为:去尾、进一、四舍五入、四舍六入
* 更多边界情况的检测
* fmt允许不在传入格式化字符串,这个特性允许你使用 fmt 来清除小数点后多余的0
* fmt允许不传入格式化字符串,这个特性允许你使用 fmt 来清除小数点后多余的0
* 0.0.79

@@ -261,0 +329,0 @@ * 更新文档

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc