a-calc 3.0.0 → 3.0.1
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/a-calc.versions.js +5 -3
- package/browser/index.js +4 -2
- package/calc.d.ts +13 -4
- package/cjs/chunks/calc.js +10 -0
- package/cjs/chunks/wasm_calc.js +1 -0
- package/cjs/index.js +1 -8
- package/es/chunks/calc.js +10 -0
- package/es/chunks/wasm_calc.js +1 -0
- package/es/index.js +1 -8
- package/mcp-server/src/index.js +0 -0
- package/package.json +17 -17
- package/src/wasm/wasm_calc.d.ts +45 -52
- package/src/wasm/wasm_calc.js +783 -310
- package/src/wasm/wasm_calc_bg.wasm +0 -0
- package/src/wasm/wasm_calc_bg.wasm.d.ts +44 -46
package/calc.d.ts
CHANGED
|
@@ -139,12 +139,17 @@ export interface FmtOptions {
|
|
|
139
139
|
* fmt 函数类型
|
|
140
140
|
* 直接格式化数字,跳过表达式解析
|
|
141
141
|
*/
|
|
142
|
-
export interface Fmt {
|
|
142
|
+
export interface Fmt {
|
|
143
143
|
<const FmtStr extends string | undefined = undefined, const Err = never>(
|
|
144
144
|
value: number | string,
|
|
145
145
|
format_str?: FmtStr,
|
|
146
146
|
options?: FmtOptions & { _error?: Err }
|
|
147
|
-
): If_StrIncludes<FmtStr, ["!n"]> extends true ? number | Err : string | Err;
|
|
147
|
+
): If_StrIncludes<FmtStr, ["!n"]> extends true ? number | Err : string | Err;
|
|
148
|
+
|
|
149
|
+
<const Expr extends string | number, const FmtStr extends string, const Err, const Options extends CalcRuntimeOptions<FmtStr, Err>>(
|
|
150
|
+
expression: Expr,
|
|
151
|
+
options: Options
|
|
152
|
+
): DirectReturn<Expr, Options>;
|
|
148
153
|
}
|
|
149
154
|
|
|
150
155
|
export interface CalcWrap {
|
|
@@ -571,8 +576,12 @@ export type UnitConvertRule =
|
|
|
571
576
|
| {
|
|
572
577
|
mul?: number;
|
|
573
578
|
div?: number;
|
|
574
|
-
plus?: number;
|
|
575
|
-
minus?: number;
|
|
579
|
+
plus?: number;
|
|
580
|
+
minus?: number;
|
|
581
|
+
/** @deprecated Use plus. Kept for compatibility with early 3.x builds. */
|
|
582
|
+
add?: number;
|
|
583
|
+
/** @deprecated Use minus. Kept for compatibility with early 3.x builds. */
|
|
584
|
+
sub?: number;
|
|
576
585
|
fn?: (value: number, input_unit: string, output_unit: string) => number;
|
|
577
586
|
_position?: 'before' | 'after' | 'middle';
|
|
578
587
|
_thousands?: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";var r="undefined"!=typeof document?document.currentScript:null;function n(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=Array(n);t<n;t++)e[t]=r[t];return e}function t(r,n,t,e,i,u,o){try{var a=r[u](o),s=a.value}catch(r){return void t(r)}a.done?n(s):Promise.resolve(s).then(e,i)}function e(r){return function(){var n=this,e=arguments;return new Promise(function(i,u){var o=r.apply(n,e);function a(r){t(o,i,u,a,s,"next",r)}function s(r){t(o,i,u,a,s,"throw",r)}a(void 0)})}}function i(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=v(r))||n){t&&(r=t);var e=0,i=function(){};return{s:i,n:function(){return e>=r.length?{done:!0}:{done:!1,value:r[e++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,o=!0,a=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return o=r.done,r},e:function(r){a=!0,u=r},f:function(){try{o||null==t.return||t.return()}finally{if(a)throw u}}}}function u(r,n,t){return(n=function(r){var n=function(r,n){if("object"!=typeof r||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var e=t.call(r,n);if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(r)}(r,"string");return"symbol"==typeof n?n:n+""}(n))in r?Object.defineProperty(r,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[n]=t,r}function o(r,n){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);n&&(e=e.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,e)}return t}function a(r){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach(function(n){u(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function s(){
|
|
2
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
+
var r,n,t="function"==typeof Symbol?Symbol:{},e=t.iterator||"@@iterator",i=t.toStringTag||"@@toStringTag";function u(t,e,i,u){var s=e&&e.prototype instanceof a?e:a,l=Object.create(s.prototype);return c(l,"_invoke",function(t,e,i){var u,a,s,c=0,l=i||[],f=!1,p={p:0,n:0,v:r,a:v,f:v.bind(r,4),d:function(n,t){return u=n,a=0,s=r,p.n=t,o}};function v(t,e){for(a=t,s=e,n=0;!f&&c&&!i&&n<l.length;n++){var i,u=l[n],v=p.p,_=u[2];t>3?(i=_===e)&&(s=u[(a=u[4])?5:(a=3,3)],u[4]=u[5]=r):u[0]<=v&&((i=t<2&&v<u[1])?(a=0,p.v=e,p.n=u[1]):v<_&&(i=t<3||u[0]>e||e>_)&&(u[4]=t,u[5]=e,p.n=_,a=0))}if(i||t>1)return o;throw f=!0,e}return function(i,l,_){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&v(l,_),a=l,s=_;(n=a<2?r:s)||!f;){u||(a?a<3?(a>1&&(p.n=-1),v(a,s)):p.n=s:p.v=s);try{if(c=2,u){if(a||(i="next"),n=u[i]){if(!(n=n.call(u,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=u.return)&&n.call(u),a<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),a=1);u=r}else if((n=(f=p.n<0)?s:t.call(e,p))!==o)break}catch(n){u=r,a=1,s=n}finally{c=1}}return{value:n,done:f}}}(t,i,u),!0),l}var o={};function a(){}function l(){}function f(){}n=Object.getPrototypeOf;var p=[][e]?n(n([][e]())):(c(n={},e,function(){return this}),n),v=f.prototype=a.prototype=Object.create(p);function _(r){return Object.setPrototypeOf?Object.setPrototypeOf(r,f):(r.__proto__=f,c(r,i,"GeneratorFunction")),r.prototype=Object.create(v),r}return l.prototype=f,c(v,"constructor",f),c(f,"constructor",l),l.displayName="GeneratorFunction",c(f,i,"GeneratorFunction"),c(v),c(v,i,"Generator"),c(v,e,function(){return this}),c(v,"toString",function(){return"[object Generator]"}),(s=function(){return{w:u,m:_}})()}function c(r,n,t,e){var i=Object.defineProperty;try{i({},"",{})}catch(r){i=0}c=function(r,n,t,e){function u(n,t){c(r,n,function(r){return this._invoke(n,t,r)})}n?i?i(r,n,{value:t,enumerable:!e,configurable:!e,writable:!e}):r[n]=t:(u("next",0),u("throw",1),u("return",2))},c(r,n,t,e)}function l(r,n){return function(r){if(Array.isArray(r))return r}(r)||function(r,n){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,i,u,o,a=[],s=!0,c=!1;try{if(u=(t=t.call(r)).next,0===n){if(Object(t)!==t)return;s=!1}else for(;!(s=(e=u.call(t)).done)&&(a.push(e.value),a.length!==n);s=!0);}catch(r){c=!0,i=r}finally{try{if(!s&&null!=t.return&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}(r,n)||v(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(r){return function(r){if(Array.isArray(r))return n(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||v(r)||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(r){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},p(r)}function v(r,t){if(r){if("string"==typeof r)return n(r,t);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(r,t):void 0}}var _="3.0.1";var d="0123456789",h="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",g="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$[].'\"",m="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",w=new Set(d),y=new Set(h),x=new Set(g),b=new Set(m);new Set("0123456789-+");var S=new Set("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$"),N=new Set(" \n\r\t"),E="initial",A="number",j="scientific",O="operator",k="bracket",F="var",q="symbol",M="percent",W="round",P="plus",z="comma",I="fraction",T="to-number",D="to-number-string",Z="fallback_var",$="integer_padding",U="compact",R="unit_after",C="unit_before",B="unit_middle",L="unit_hide",H="unit_default",G="thousands",V="fmt_group",K="shortcut",J="comparison",Q="logical",X="function",Y="range_clamp",rr=new Set([">","<",">=","<=","==","!="]),nr=new Set(["&&","||"]),tr={"|":0,"?":1,":":1,"||":2,"&&":3,"==":4,"!=":4,">":5,"<":5,">=":5,"<=":5,"+":6,"-":6,"*":7,"/":7,"%":7,"//":7,"**":8,"!":9,"unary-":9,"unary+":9},er=Array.isArray,ir="object"==("undefined"==typeof global?"undefined":p(global))&&global&&global.Object===Object&&global,ur="object"==("undefined"==typeof self?"undefined":p(self))&&self&&self.Object===Object&&self,or=ir||ur||Function("return this")(),ar=or.Symbol,sr=Object.prototype,cr=sr.hasOwnProperty,lr=sr.toString,fr=ar?ar.toStringTag:void 0;var pr=Object.prototype.toString;var vr=ar?ar.toStringTag:void 0;function _r(r){return null==r?void 0===r?"[object Undefined]":"[object Null]":vr&&vr in Object(r)?function(r){var n=cr.call(r,fr),t=r[fr];try{r[fr]=void 0;var e=!0}catch(r){}var i=lr.call(r);return e&&(n?r[fr]=t:delete r[fr]),i}(r):function(r){return pr.call(r)}(r)}function dr(r){return"symbol"==p(r)||function(r){return null!=r&&"object"==p(r)}(r)&&"[object Symbol]"==_r(r)}var hr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gr=/^\w*$/;function mr(r){var n=p(r);return null!=r&&("object"==n||"function"==n)}var wr,yr=or["__core-js_shared__"],xr=(wr=/[^.]+$/.exec(yr&&yr.keys&&yr.keys.IE_PROTO||""))?"Symbol(src)_1."+wr:"";var br=Function.prototype.toString;var Sr=/^\[object .+?Constructor\]$/,Nr=Function.prototype,Er=Object.prototype,Ar=Nr.toString,jr=Er.hasOwnProperty,Or=RegExp("^"+Ar.call(jr).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function kr(r){if(!mr(r)||(n=r,xr&&xr in n))return!1;var n,t=function(r){if(!mr(r))return!1;var n=_r(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}(r)?Or:Sr;return t.test(function(r){if(null!=r){try{return br.call(r)}catch(r){}try{return r+""}catch(r){}}return""}(r))}function Fr(r,n){var t=function(r,n){return null==r?void 0:r[n]}(r,n);return kr(t)?t:void 0}var qr=Fr(Object,"create");var Mr=Object.prototype.hasOwnProperty;var Wr=Object.prototype.hasOwnProperty;function Pr(r){var n=-1,t=null==r?0:r.length;for(this.clear();++n<t;){var e=r[n];this.set(e[0],e[1])}}function zr(r,n){return r===n||r!=r&&n!=n}function Ir(r,n){for(var t=r.length;t--;)if(zr(r[t][0],n))return t;return-1}Pr.prototype.clear=function(){this.__data__=qr?qr(null):{},this.size=0},Pr.prototype.delete=function(r){var n=this.has(r)&&delete this.__data__[r];return this.size-=n?1:0,n},Pr.prototype.get=function(r){var n=this.__data__;if(qr){var t=n[r];return"__lodash_hash_undefined__"===t?void 0:t}return Mr.call(n,r)?n[r]:void 0},Pr.prototype.has=function(r){var n=this.__data__;return qr?void 0!==n[r]:Wr.call(n,r)},Pr.prototype.set=function(r,n){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=qr&&void 0===n?"__lodash_hash_undefined__":n,this};var Tr=Array.prototype.splice;function Dr(r){var n=-1,t=null==r?0:r.length;for(this.clear();++n<t;){var e=r[n];this.set(e[0],e[1])}}Dr.prototype.clear=function(){this.__data__=[],this.size=0},Dr.prototype.delete=function(r){var n=this.__data__,t=Ir(n,r);return!(t<0)&&(t==n.length-1?n.pop():Tr.call(n,t,1),--this.size,!0)},Dr.prototype.get=function(r){var n=this.__data__,t=Ir(n,r);return t<0?void 0:n[t][1]},Dr.prototype.has=function(r){return Ir(this.__data__,r)>-1},Dr.prototype.set=function(r,n){var t=this.__data__,e=Ir(t,r);return e<0?(++this.size,t.push([r,n])):t[e][1]=n,this};var Zr=Fr(or,"Map");function $r(r,n){var t,e,i=r.__data__;return("string"==(e=p(t=n))||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t)?i["string"==typeof n?"string":"hash"]:i.map}function Ur(r){var n=-1,t=null==r?0:r.length;for(this.clear();++n<t;){var e=r[n];this.set(e[0],e[1])}}Ur.prototype.clear=function(){this.size=0,this.__data__={hash:new Pr,map:new(Zr||Dr),string:new Pr}},Ur.prototype.delete=function(r){var n=$r(this,r).delete(r);return this.size-=n?1:0,n},Ur.prototype.get=function(r){return $r(this,r).get(r)},Ur.prototype.has=function(r){return $r(this,r).has(r)},Ur.prototype.set=function(r,n){var t=$r(this,r),e=t.size;return t.set(r,n),this.size+=t.size==e?0:1,this};function Rr(r,n){if("function"!=typeof r||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var t=function(){var e=arguments,i=n?n.apply(this,e):e[0],u=t.cache;if(u.has(i))return u.get(i);var o=r.apply(this,e);return t.cache=u.set(i,o)||u,o};return t.cache=new(Rr.Cache||Ur),t}Rr.Cache=Ur;var Cr,Br,Lr,Hr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Gr=/\\(\\)?/g,Vr=(Cr=function(r){var n=[];return 46===r.charCodeAt(0)&&n.push(""),r.replace(Hr,function(r,t,e,i){n.push(e?i.replace(Gr,"$1"):t||r)}),n},Br=Rr(Cr,function(r){return 500===Lr.size&&Lr.clear(),r}),Lr=Br.cache,Br);var Kr=ar?ar.prototype:void 0,Jr=Kr?Kr.toString:void 0;function Qr(r){if("string"==typeof r)return r;if(er(r))return function(r,n){for(var t=-1,e=null==r?0:r.length,i=Array(e);++t<e;)i[t]=n(r[t],t,r);return i}(r,Qr)+"";if(dr(r))return Jr?Jr.call(r):"";var n=r+"";return"0"==n&&1/r==-1/0?"-0":n}function Xr(r,n){return er(r)?r:function(r,n){if(er(r))return!1;var t=p(r);return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=r&&!dr(r))||gr.test(r)||!hr.test(r)||null!=n&&r in Object(n)}(r,n)?[r]:Vr(function(r){return null==r?"":Qr(r)}(r))}function Yr(r){if("string"==typeof r||dr(r))return r;var n=r+"";return"0"==n&&1/r==-1/0?"-0":n}function rn(r,n,t){var e=null==r?void 0:function(r,n){for(var t=0,e=(n=Xr(n,r)).length;null!=r&&t<e;)r=r[Yr(n[t++])];return t&&t==e?r:void 0}(r,n);return void 0===e?t:e}var nn=/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,tn=/^([+-]?[\d.]+)(.*)$/;function en(r){if(null==r)return{num:void 0,unit:void 0};var n,t,e=(r="string"!=typeof r?r.toString():r).match(nn)||r.match(tn);if(e){t=e[1];var i=e[2];""!==i.trim()&&(n=i)}return{num:t,unit:n}}function un(r,n,t){var e,i,u,o;return Array.isArray(r)?r.length>1?null!==(e=null!==(i=rn(r[0],n))&&void 0!==i?i:rn(r.at(-1),n))&&void 0!==e?e:t:1===r.length&&null!==(u=rn(r[0],n))&&void 0!==u?u:t:null!==(o=rn(r,n,t))&&void 0!==o?o:t}function on(r,n,t,e){if(+t>1e4)throw new Error("小数位数(".concat(t,")超出安全上限 ").concat(1e4));var i=r.split("."),u=i[0],o=1===i.length?"":i[1],a=function(r,n,t,e,i){var u=r.startsWith("-"),o=u?r.slice(1):r,a=o,s=n,c=n.length;function l(){a=(BigInt(a)+1n).toString()}function f(r){return(BigInt("9".concat(r))+1n).toString().slice(1)}var p={"~-":function(){var r="<"===t?e-1:e;s=n.slice(0,r)},"~+":function(){var r="<"===t?e-1:e;if(!(c<=r||0===c)){var i=n.slice(0,r);0===+n.slice(r,c)?s=i:(i=f(i)).length>r?(s=i.slice(1,i.length),l()):s=i}},"~5":function(){if(0!==c){var r="<"===t?e-1:e;s=n.slice(0,r);var i=+n[r];Number.isNaN(i)||i>=5&&(s=f(s)).length>r&&(s=s.slice(1,s.length),l())}},"~6":function(){if(0!==c){var r,i="<"===t?e-1:e,u=+n[i],a=n.slice(+i+1,n.length);a=""===a?0:parseInt(a),r=0===i?+o[o.length-1]:+n[i-1],s=n.slice(0,i),(u>=6||5===u&&a>0||5===u&&r%2!=0)&&(s=f(s)).length>i&&(s=s.slice(1,s.length),l())}}};return"<="===t?c<=e?s=n.replace(/0*$/,""):(p[i]&&p[i](),s=s.replace(/0+$/,"")):"<"===t?c<e?s=n.replace(/0*$/,""):(p[i]&&p[i](),s=s.replace(/0+$/,"")):"="===t?c<e?s=n+"0".repeat(e-c):c>e&&p[i]&&p[i]():">="===t?c<e&&(s=n+"0".repeat(e-c)):">"===t&&c<=e&&(s=n+"0".repeat(e-c+1)),{int_part:u?"-".concat(a):a,dec_part:s}}(u,o,n,+t,e);return u=a.int_part,""===(o=a.dec_part)?u:"".concat(u,".").concat(o)}function an(r){for(var n=r.length,t="";n>0;)t=r.substring(n-3,n)+(""!==t?",":"")+t,n-=3;return t}function sn(r){var n=r.split("."),t=n[0];return"-"===t[0]?n[0]="-"+an(t.slice(1)):n[0]=an(t),n.join(".")}function cn(r,n){if(Array.isArray(r)){for(var t,e=0,i=r.length;e<i;e++){var u;if(void 0!==(t=null!==(u=rn(r[e],n))&&void 0!==u?u:void 0))break}if(void 0===t)throw new Error("填充变量".concat(n,"失败"));return t}var o;return null!==(o=rn(r,n))&&void 0!==o?o:void 0}function ln(r,n,t){return t&&"function"==typeof t._empty_check?t._empty_check(r,n):t&&Array.isArray(t._empty_values)?t._empty_values.some(function(n){return!(!Number.isNaN(n)||!Number.isNaN(r))||r===n}):null==r}function fn(r,n,t){for(var e=0;e<n.length;e++){var i=n[e].trim(),u=void 0;try{if(Array.isArray(r))for(var o=0;o<r.length;o++){var a=rn(r[o],i);if(void 0!==a){u=a;break}}else u=rn(r,i)}catch(r){continue}if(!ln(u,i,t))return{value:u,path:i}}throw new Error("多路取值失败,所有路径均为空值: ".concat(n.join(" | ")))}function pn(r,n,t){var e;for(n++;n<t;){if(e=r[n],!N.has(e))return e;n++}}function vn(r,n){return r&&r.startsWith("@")?cn(n,r.slice(1)):r}function _n(r,n,t,e,i){n===F||n===$&&h.includes(t[0])?(i.has_var=!0,r.push({type:n,value:t,real_value:cn(i.fill_data,t)})):r.push({type:n,value:t}),e.prev=e.curr,i.state=E}function dn(r,n){for(var t,e={prev:0,curr:0},u=r.length,o={state:E,fill_data:n,has_var:!1},a=[];e.curr<u;)switch(t=r[e.curr],o.state){case E:if(" "===t)e.curr++,e.prev=e.curr;else if("<>=".includes(t))o.state=q,e.curr++;else if(","===t)e.curr++,_n(a,z,",",e,o);else if(h.includes(t))o.state=F,e.curr++;else if(d.includes(t))o.state=A,e.curr++;else if("+"===t)e.curr++,_n(a,P,"+",e,o);else if("~"===t)e.curr++,o.state=W;else if("%"===t)e.curr++,_n(a,M,"%",e,o);else if("/"===t)e.curr++,_n(a,I,"/",e,o);else if("!"===t)if(o.state=E,e.curr++,"n"===r[e.curr])e.curr++,_n(a,T,"!n",e,o);else if("u"===r[e.curr]){e.curr++;var s=r[e.curr];if("a"===s||"b"===s||"m"===s){if(e.curr++,":"===r[e.curr]){e.curr++;for(var c=e.curr;e.curr<u&&" "!==r[e.curr];)e.curr++;var l=r.slice(c,e.curr).split(":"),f=vn(l[0],o.fill_data),p=l[1]?vn(l[1],o.fill_data):null;(l[0].startsWith("@")||l[1]&&l[1].startsWith("@"))&&(o.has_var=!0);var v={a:R,b:C,m:B};a.push({type:v[s],value:"!u".concat(s),unit:f,input_unit:p})}else{var _={a:R,b:C,m:B};a.push({type:_[s],value:"!u".concat(s),unit:null,input_unit:null,use_default:!0})}e.prev=e.curr,o.state=E}else if("h"===s){if(e.curr++,":"===r[e.curr]){e.curr++;for(var m=e.curr;e.curr<u&&" "!==r[e.curr];)e.curr++;var w=r.slice(m,e.curr).split(":"),y=vn(w[0],o.fill_data),x=w[1]?vn(w[1],o.fill_data):null;(w[0].startsWith("@")||w[1]&&w[1].startsWith("@"))&&(o.has_var=!0),a.push({type:L,value:"!uh",unit:y,input_unit:x})}else{var b=Tn("_unit_default_out");if(b){var S=Array.isArray(b)?b[0]:b;a.push({type:L,value:"!uh",unit:S,input_unit:null})}else a.push({type:D,value:"!uh"})}e.prev=e.curr,o.state=E}else if(":"===r[e.curr]){e.curr++;for(var N=e.curr;e.curr<u&&" "!==r[e.curr];)e.curr++;var O=r.slice(N,e.curr).split(":"),k=vn(O[0],o.fill_data),Z=O[1]?vn(O[1],o.fill_data):null;(O[0].startsWith("@")||O[1]&&O[1].startsWith("@"))&&(o.has_var=!0),a.push({type:H,value:"!u",unit:k,input_unit:Z}),e.prev=e.curr,o.state=E}else{var J=Tn("_unit_default_out");if(J){var Q=Array.isArray(J)?J[0]:J;a.push({type:H,value:"!u",unit:Q,input_unit:null}),e.prev=e.curr,o.state=E}else _n(a,D,"!u",e,o)}}else if("e"===r[e.curr])e.curr++,_n(a,j,"!e",e,o);else if("c"===r[e.curr]){e.curr++;var X=null;if(":"===r[e.curr]){e.curr++;for(var rr=e.curr;e.curr<u&&/[a-zA-Z0-9_]/.test(r[e.curr]);)e.curr++;X=r.slice(rr,e.curr)}a.push({type:U,value:"!c",preset:X}),e.prev=e.curr,o.state=E}else if("i"===r[e.curr]){if(e.curr++,":"!==r[e.curr])throw new Error("!i 语法需要指定位数,格式: !i:n");e.curr++;var nr=e.curr;if("@"===r[e.curr]){for(e.curr++;e.curr<u&&g.includes(r[e.curr]);)e.curr++;var tr=r.slice(nr+1,e.curr),er=cn(o.fill_data,tr);o.has_var=!0,a.push({type:$,value:tr,real_value:er})}else{for(;e.curr<u&&d.includes(r[e.curr]);)e.curr++;var ir=r.slice(nr,e.curr);a.push({type:$,value:ir})}e.prev=e.curr,o.state=E}else if("t"===r[e.curr])if(e.curr++,":"!==r[e.curr])a.push({type:G,value:"!t",preset:"default"}),e.prev=e.curr,o.state=E;else{e.curr++;var ur=e.curr;if("@"===r[e.curr]){for(e.curr++;e.curr<u&&g.includes(r[e.curr]);)e.curr++;var or=r.slice(ur+1,e.curr),ar=cn(o.fill_data,or);o.has_var=!0,a.push({type:G,value:"!t",preset:ar,preset_var:or})}else{for(;e.curr<u&&/[a-zA-Z0-9_]/.test(r[e.curr]);)e.curr++;var sr=r.slice(ur,e.curr);a.push({type:G,value:"!t",preset:sr})}e.prev=e.curr,o.state=E}else{if("g"!==r[e.curr])throw new Error("无法识别的!模式字符:".concat(r[e.curr]));if(e.curr++,":"!==r[e.curr])throw new Error("!g 语法需要指定分组名称,格式: !g:name");if(e.curr++,"@"===r[e.curr]){e.curr++;for(var cr=e.curr;e.curr<u&&g.includes(r[e.curr]);)e.curr++;var lr=r.slice(cr,e.curr),fr=cn(o.fill_data,lr);o.has_var=!0,a.push({type:V,value:"!g",group_name:fr,var_path:lr})}else{for(var pr=e.curr;e.curr<u&&/[a-zA-Z0-9_]/.test(r[e.curr]);)e.curr++;var vr=r.slice(pr,e.curr);a.push({type:V,value:"!g",group_name:vr})}e.prev=e.curr,o.state=E}else if("#"===t)if(e.curr++,"@"===r[e.curr]){e.curr++;for(var _r=e.curr;e.curr<u&&g.includes(r[e.curr]);)e.curr++;var dr=r.slice(_r,e.curr),hr=cn(o.fill_data,dr);o.has_var=!0,a.push({type:V,value:"#",group_name:hr,var_path:dr}),e.prev=e.curr,o.state=E}else{for(var gr=e.curr;e.curr<u&&/[a-zA-Z0-9_]/.test(r[e.curr]);)e.curr++;var mr=r.slice(gr,e.curr);mr?(a.push({type:V,value:"#",group_name:mr}),e.prev=e.curr,o.state=E):(e.prev=e.curr,o.state=E)}else if("["===t){for(e.curr++;e.curr<u&&" "===r[e.curr];)e.curr++;var wr=e.curr,yr=void 0;if("@"===r[e.curr]){for(e.curr++;e.curr<u&&/[a-zA-Z0-9_$.]/.test(r[e.curr]);)e.curr++;var xr=r.slice(wr+1,e.curr);yr=cn(o.fill_data,xr),o.has_var=!0}else{for("-"!==r[e.curr]&&"+"!==r[e.curr]||e.curr++;e.curr<u&&(d.includes(r[e.curr])||"."===r[e.curr]);)e.curr++;yr=r.slice(wr,e.curr)}for(;e.curr<u&&" "===r[e.curr];)e.curr++;for(","===r[e.curr]&&e.curr++;e.curr<u&&" "===r[e.curr];)e.curr++;var br=e.curr,Sr=void 0;if("@"===r[e.curr]){for(e.curr++;e.curr<u&&/[a-zA-Z0-9_$.]/.test(r[e.curr]);)e.curr++;var Nr=r.slice(br+1,e.curr);Sr=cn(o.fill_data,Nr),o.has_var=!0}else{for("-"!==r[e.curr]&&"+"!==r[e.curr]||e.curr++;e.curr<u&&(d.includes(r[e.curr])||"."===r[e.curr]);)e.curr++;Sr=r.slice(br,e.curr)}for(;e.curr<u&&" "===r[e.curr];)e.curr++;"]"===r[e.curr]&&e.curr++,a.push({type:Y,min:""===yr?null:yr,max:""===Sr?null:Sr}),e.prev=e.curr,o.state=E}else":"===t?(o.state=K,e.curr++):(e.curr++,e.prev=e.curr);break;case q:"="===t&&e.curr++,_n(a,q,r.slice(e.prev,e.curr),e,o);break;case A:d.includes(t)?e.curr++:_n(a,A,r.slice(e.prev,e.curr),e,o);break;case F:g.includes(t)?e.curr++:_n(a,F,r.slice(e.prev,e.curr),e,o);break;case W:if(!("56+-".includes(t)&&e.curr-e.prev<2))throw new Error("错误的舍入语法:".concat(r.slice(e.prev,e.curr+1)));e.curr++,_n(a,W,r.slice(e.prev,e.curr),e,o);break;case $:if(d.includes(t))e.curr++;else if(g.includes(t))e.curr++;else{var Er=r.slice(e.prev,e.curr);h.includes(Er[0])?(o.has_var=!0,a.push({type:$,value:Er,real_value:cn(o.fill_data,Er)})):_n(a,$,Er,e,o),e.prev=e.curr,o.state=E}break;case K:for(var Ar=e.curr,jr=new Set([",","=","+","<",">","~","!","[","/","%","-"]);e.curr<u&&" "!==r[e.curr]&&!jr.has(r[e.curr]);)e.curr++;var Or=r.slice(Ar,e.curr);if(!Or){e.prev=e.curr,o.state=E;break}var kr,Fr=Tn("_shortcut_prefix")||"!u",qr=dn("".concat(Fr,":").concat(Or),o.fill_data),Mr=i(qr);try{for(Mr.s();!(kr=Mr.n()).done;){var Wr=kr.value;a.push(Wr)}}catch(r){Mr.e(r)}finally{Mr.f()}qr.has_var&&(o.has_var=!0),e.prev=e.curr,o.state=E;break;default:throw new Error("错误的fmt分词器状态")}return e.prev<e.curr&&_n(a,o.state,r.slice(e.prev,e.curr),e,o),a.has_var=o.has_var,a}var hn=new Set(["<",">","=",">=","<="]),gn=new Set(["~+","~-","~5","~6"]);function mn(r,n){return r&&r.startsWith("@")?cn(n,r.slice(1)):r}function wn(r,n,t){var e=function(r,n){var t=n.scope;if(","===r)return{type:z,value:","};if(hn.has(r))return{type:q,value:r};if(!Number.isNaN(Number(r)))return{type:A,value:r};if(m.includes(r[0]))return t.has_var=!0,{type:F,value:r,real_value:cn(t.fill_data,r)};if("%"===r)return{type:M,value:r};if("/"===r)return{type:I,value:r};if("+"===r)return{type:P,value:r};if(gn.has(r))return{type:W,value:r};if("!n"===r)return{type:T,value:r};if("!u"===r)return{type:D,value:r};if("!uh"===r)return{type:D,value:r};if(r.startsWith("!uh:")){var e=r.slice(4).split(":"),i=mn(e[0],t.fill_data),u=e[1]?mn(e[1],t.fill_data):null;return(e[0].startsWith("@")||e[1]&&e[1].startsWith("@"))&&(t.has_var=!0),{type:L,value:"!uh",unit:i,input_unit:u}}if(r.startsWith("!u:")){var o=r.slice(3).split(":"),a=mn(o[0],t.fill_data),s=o[1]?mn(o[1],t.fill_data):null;return(o[0].startsWith("@")||o[1]&&o[1].startsWith("@"))&&(t.has_var=!0),{type:H,value:"!u",unit:a,input_unit:s}}if(r.startsWith("!ua:")||r.startsWith("!ub:")||r.startsWith("!um:")){var c=r[2],l=r.slice(4).split(":"),f=mn(l[0],t.fill_data),p=l[1]?mn(l[1],t.fill_data):null;return(l[0].startsWith("@")||l[1]&&l[1].startsWith("@"))&&(t.has_var=!0),{type:{a:R,b:C,m:B}[c],value:"!u".concat(c),unit:f,input_unit:p}}if("!ua"===r||"!ub"===r||"!um"===r){var v=r[2];return"b"===v?null:{type:{a:R,m:B}[v],value:"!u".concat(v),unit:null,input_unit:null,use_default:!0}}if("!e"===r)return{type:j,value:r};if("!c"===r||r.startsWith("!c:")){var _=r.startsWith("!c:")?r.slice(3):null;return{type:U,value:"!c",preset:_}}if(r.startsWith("!i:")){var d=r.slice(3);if(d.startsWith("@")){var h=d.slice(1),g=cn(t.fill_data,h);return t.has_var=!0,{type:$,value:h,real_value:g}}return{type:$,value:d}}if("!t"===r||r.startsWith("!t:")){if("!t"===r)return{type:G,value:"!t",preset:"default"};var w=r.slice(3);if(w.startsWith("@")){var y=w.slice(1),x=cn(t.fill_data,y);return t.has_var=!0,{type:G,value:"!t",preset:x,preset_var:y}}return{type:G,value:"!t",preset:w}}if(r.startsWith("!g:")){var b=r.slice(3);if(b.startsWith("@")){var S=b.slice(1),N=cn(t.fill_data,S);return t.has_var=!0,{type:V,value:"!g",group_name:N,var_path:S}}return{type:V,value:"!g",group_name:b}}if(r.startsWith("#")){var E=r.slice(1);if(E.startsWith("@")){var O=E.slice(1),k=cn(t.fill_data,O);return t.has_var=!0,"number"==typeof k||/^\d+$/.test(String(k))?{type:$,value:O,real_value:k}:{type:V,value:"#",group_name:k,var_path:O}}E.startsWith("=")&&(E=E.slice(1));var Z=/^\d+$/.test(E),K=m.includes(E[0]);return Z||K?K?(t.has_var=!0,{type:$,value:E,real_value:cn(t.fill_data,E)}):{type:$,value:E}:{type:V,value:"#",group_name:E}}if(r.startsWith("[")&&r.endsWith("]")){var J=r.slice(1,-1).split(","),Q=null,X=null;if(J[0]){var rr=J[0].trim();if(rr.startsWith("@")){var nr=rr.slice(1);Q=cn(t.fill_data,nr),t.has_var=!0}else Q=rr}if(J[1]){var tr=J[1].trim();if(tr.startsWith("@")){var er=tr.slice(1);X=cn(t.fill_data,er),t.has_var=!0}else X=tr}return{type:Y,min:Q,max:X}}throw new Error("无法识别的格式化字符: ".concat(r))}(n,{scope:t});e&&r.push(e)}function yn(r,n){for(var t,e=0,i=r.length,u={fill_data:n,has_var:!1},o=0,a=[];e<i;)" "===(t=r[e])?(e>o&&wn(a,r.slice(o,e),u),o=e+1):"<>=".includes(t)&&("="===r[e+1]?(a.push({type:q,value:t+"="}),o=1+ ++e):(a.push({type:q,value:t}),o=e+1)),e++;return o<e&&wn(a,r.slice(o,e),u),a.has_var=u.has_var,a}var xn={_debug_console:!0,_error:"-",_angle_unit:"deg",_builtin_functions:{},_compute_mode:"decimal",_div_precision:20,_default_round:void 0,_fmt:void 0,_fmt_parsed:void 0,_compact:{},_compact_default:void 0,_fmt_groups:{},_fmt_groups_parsed:{},_thousands:{},_thousands_default:void 0,_unit_convert_out:void 0,_unit_convert_in:void 0,_unit_default_out:void 0,_unit_default_in:void 0,_unit_position_map:void 0,_unit_default_position:void 0,_unit_thousands_map:void 0,_unit_compact_map:void 0,_shortcut_prefix:"!u",_empty_values:void 0,_empty_check:void 0};function bn(r){return Array.isArray(r)?r.map(bn):qn(r)?Object.fromEntries(Object.entries(r).map(function(r){var n=l(r,2);return[n[0],bn(n[1])]})):r}var Sn,Nn,En=Object.fromEntries(Object.entries(xn).map(function(r){var n=l(r,2);return[n[0],bn(n[1])]})),An={_unit_compact_map:{},_unit_thousands_map:{},_unit_position_map:{}},jn=!1,On=new Set(["decimal","bigint","wasm"]),kn={};function Fn(r,n){kn[r]||(kn[r]=[]),kn[r].push(n)}function qn(r){return null!==r&&"object"===p(r)&&!Array.isArray(r)}function Mn(r,n){if(r||n){for(var t={},e=0,i=[r,n];e<i.length;e++){var u=i[e];if(u)for(var o=0,s=Object.entries(u);o<s.length;o++){var c=l(s[o],2),f=c[0],p=c[1];qn(p)&&qn(t[f])?t[f]=a(a({},t[f]),p):qn(p)?t[f]=a({},p):t[f]=p}}return t}}function Wn(r,n){var t=a(a({},r),n);return Object.keys(t).length>0?t:void 0}function Pn(){var r=Mn(Sn,Nn),n=function(r){var n={},t={},e={};if(!r)return{thousands:n,positions:t,compacts:e};for(var i in r){var u=r[i];if("object"===p(u)&&null!==u)for(var o in u._thousands&&!n[i]&&(n[i]=u._thousands),u._position&&!t[i]&&(t[i]=u._position),u._compact&&!e[i]&&(e[i]=u._compact),u)if(!o.startsWith("_")){var a=u[o];"object"===p(a)&&null!==a&&(a._thousands&&!n[i]&&(n[i]=a._thousands),a._position&&!t[i]&&(t[i]=a._position),a._compact&&!e[i]&&(e[i]=a._compact))}}return{thousands:n,positions:t,compacts:e}}(r);En._unit_convert_out=r,En._unit_convert_in=void 0,En._unit_thousands_map=Wn(n.thousands,An._unit_thousands_map),En._unit_position_map=Wn(n.positions,An._unit_position_map),En._unit_compact_map=Wn(n.compacts,An._unit_compact_map)}var zn=new Set(["_unit_convert_out","_unit_convert_in","_builtin_functions","_compact","_thousands","_unit_compact_map","_unit_thousands_map","_unit_position_map","_fmt_groups"]);function In(r){if(r&&"object"===p(r))for(var n=function(){var n=e[t],i=r[n];if(zn.has(n)&&!qn(i))return console.warn('a-calc: 配置项 "'.concat(n,'" 需要普通对象,已忽略无效值')),0;if("_unit_convert_out"===n&&"object"===p(i))return Sn=i,Pn(),0;if("_unit_convert_in"===n&&"object"===p(i)&&null!==i){var u=function(r){if(!r)return null;var n={};for(var t in r){var e=r[t];for(var i in e){var u=e[i];if(n[i]||(n[i]={}),"object"===p(u)&&null!==u){u._thousands&&!n[i]._thousands&&(n[i]._thousands=u._thousands),u._position&&!n[i]._position&&(n[i]._position=u._position),u._compact&&!n[i]._compact&&(n[i]._compact=u._compact);for(var o={},a=0,s=["fn","mul","div","plus","minus","add","sub"];a<s.length;a++){var c=s[a];void 0!==u[c]&&(o[c]=u[c])}Object.keys(o).length>0&&(n[i][t]=o)}else n[i][t]=u}}return n}(i);return Nn=Mn(Nn,u),Pn(),0}if("_builtin_functions"===n&&"object"===p(i))jn||(xn._builtin_functions=bn(i),jn=!0),Object.assign(En._builtin_functions,i);else if("_compact"===n&&"object"===p(i))Object.assign(En._compact,i);else if("_thousands"===n&&"object"===p(i))Object.assign(En._thousands,i);else if("_unit_compact_map"===n&&"object"===p(i))Object.assign(An._unit_compact_map,i),Pn();else if("_unit_thousands_map"===n&&"object"===p(i))Object.assign(An._unit_thousands_map,i),Pn();else if("_unit_position_map"===n&&"object"===p(i))Object.assign(An._unit_position_map,i),Pn();else if("_fmt_groups"===n&&"object"===p(i)){Object.assign(En._fmt_groups,i);var o=En._fmt_groups;kn._fmt_groups&&kn._fmt_groups.forEach(function(r){return r(En._fmt_groups,o)})}else if("_fmt"===n){var a=En._fmt,s=i;a!==s&&(En._fmt=s,kn._fmt&&kn._fmt.forEach(function(r){return r(s,a)}))}else if("_compute_mode"===n){var c=i;if(!On.has(c))return console.warn("Unknown compute mode: ".concat(c,", available modes: ").concat(f(On).join(", "))),0;var l=En[n];l!==c&&(En[n]=c,kn[n]&&kn[n].forEach(function(r){return r(c,l)}))}else if("_shortcut_prefix"===n){var v=function(r){if("string"!=typeof r)return console.warn("_shortcut_prefix must be a string, got: ".concat(p(r))),null;if(!r.startsWith("!"))return console.warn("_shortcut_prefix must start with '!', got: ".concat(r)),null;var n=r;r.endsWith(":")&&(n=r.slice(0,-1));var t=["!u","!t","!c","!n","!e","!i","!g","!ua","!ub","!um","!uh"];return t.includes(n)?n:(console.warn("_shortcut_prefix must be one of: ".concat(t.join(", "),", got: ").concat(r)),null)}(i);if(!v)return 0;var _=En[n],d=v;_!==d&&(En[n]=d,kn[n]&&kn[n].forEach(function(r){return r(d,_)}))}else if(n in En){var h=En[n],g=i;h!==g&&(En[n]=g,kn[n]&&kn[n].forEach(function(r){return r(g,h)}))}},t=0,e=Object.keys(r);t<e.length;t++)n()}function Tn(r){return void 0===r?a({},En):En[r]}if(Fn("_fmt",function(r,n){if(null!=r&&""!==r){if("string"!=typeof r)return console.warn("_fmt must be a string, got: ".concat(p(r))),void(En._fmt_parsed=void 0);try{var t=dn(r,null);En._fmt_parsed=t}catch(n){console.warn('Failed to parse _fmt: "'.concat(r,'":'),n),En._fmt_parsed=void 0}}else En._fmt_parsed=void 0}),En._fmt)try{var Dn=dn(En._fmt,null);En._fmt_parsed=Dn}catch(r){console.warn('Failed to parse initial _fmt: "'.concat(En._fmt,'":'),r),En._fmt_parsed=void 0}function Zn(r){for(var n=0,t=null,e=!1,i=0;i<r.length;i++){var u=r[i];if(null===t)if('"'!==u&&"'"!==u){if("("===u)n++;else if(")"===u)n--;else if("|"===u&&0===n){if(i+1<r.length&&"|"===r[i+1]){i++;continue}return{expr:r.slice(0,i),fmt:r.slice(i+1).trim()}}}else t=u;else e?e=!1:"\\"===u?e=!0:u===t&&(t=null)}return{expr:r,fmt:""}}function $n(r,n){var t,e,i="",u={origin_expr:r,origin_fill_data:n,expr:"",fmt_expr:"",options:void 0,fill_data:void 0,_unit:void 0,_angle_unit:void 0,_empty_values:void 0,_empty_check:void 0,_compact_symbols:void 0,_compact_step:void 0,_thousands:void 0};if(null!=n&&(u.options=n,Array.isArray(n)?u.fill_data=n:u.fill_data=[n]),u._unit=un(n,"_unit",!1),u._angle_unit=un(n,"_angle_unit"),u._empty_values=null!==(t=un(n,"_empty_values"))&&void 0!==t?t:Tn("_empty_values"),u._empty_check=null!==(e=un(n,"_empty_check"))&&void 0!==e?e:Tn("_empty_check"),u._compact_symbols=un(n,"_compact_symbols"),u._compact_step=un(n,"_compact_step"),u._thousands=un(n,"_thousands"),"string"==typeof r){if(i=r,""===r.trim()||function(r){for(var n=null,t=!1,e=0;e<r.length;e++){var i=r[e];if(null===n)if('"'!==i&&"'"!==i){if(r.startsWith("NaN",e)){var u=r[e-1],o=r[e+3],a=function(r){return void 0!==r&&/[A-Za-z0-9_$]/.test(r)};if(!a(u)&&!a(o))return!0}}else n=i;else t?t=!1:"\\"===i?t=!0:i===n&&(n=null)}return!1}(r))throw new Error("非法的表达式:".concat(r))}else{if("number"!=typeof r)throw new Error("错误的第一个参数类型: ".concat(r," 类型为:").concat(p(r)));if(isNaN(r))throw new Error("传入了一个非法数字NaN");i=r.toString()}var o=Zn(i),a=o.expr,s=o.fmt;return u.expr=a,u.fmt_expr=s,u}function Un(r){for(var n=new Map,t=[],e=null,i=!1,u=0;u<r.length;u++){var o=r[u];if(null===e)if('"'!==o&&"'"!==o)if("("===o)t.push({start_index:u,pipe_indexes:[]});else if(")"===o){var a=t.pop();if(!a||0===a.pipe_indexes.length)continue;for(var s=[a.start_index].concat(f(a.pipe_indexes),[u]),c=[],l=0;l<s.length-1;l++)c.push(r.slice(s[l]+1,s[l+1]).trim());n.set(a.start_index,{paths:c,end_index:u})}else"|"===o&&t.length>0&&"|"!==r[u-1]&&"|"!==r[u+1]&&t[t.length-1].pipe_indexes.push(u);else e=o;else i?i=!1:"\\"===o?i=!0:o===e&&(e=null)}return n}function Rn(r,n){if("("!==r[n])return null;for(var t=1,e=[],i="",u=n+1,o=null,a=!1;u<r.length&&t>0;){var s=r[u];if(null===o)if('"'!==s&&"'"!==s){if("("===s)t++,i+=s;else if(")"===s){if(0===--t)return i.trim()&&e.push(i.trim()),{args:e,end_index:u};i+=s}else","===s&&1===t?(e.push(i.trim()),i=""):i+=s;u++}else o=s,i+=s,u++;else i+=s,a?a=!1:"\\"===s?a=!0:s===o&&(o=null),u++}return null}function Cn(r,n){if(n.curr_state===A||n.curr_state===j){var t=n.expr.slice(n.prev_index,n.cur_index);if("+"===t||"-"===t)return r.push({type:O,value:t}),n.curr_state=E,void(n.prev_index=n.cur_index);if("."===t[0]?t="0"+t:"-"!==t[0]&&"+"!==t[0]||"."!==t[1]||(t=t[0]+"0"+t.slice(1)),n._unit){var e,i=en(t),u=i.num,o=i.unit;if(void 0===o)r.push({type:A,value:u,real_value:u,has_unit:!1});else n.has_unit=!0,null!==(e=n.unit_str)&&void 0!==e||(n.unit_str=o),r.push({type:A,value:u,real_value:u,has_unit:!0,unit:o})}else r.push({type:A,value:t,real_value:t,has_unit:!1})}else if(n.curr_state===F){n.has_var=!0;var a=n.expr.slice(n.prev_index,n.cur_index);if("true"===a)r.push({type:"boolean",value:!0});else if("false"===a)r.push({type:"boolean",value:!1});else if(function(r,n){for(var t=n;t<r.length&&" "===r[t];)t++;return t<r.length&&"("===r[t]}(n.expr,n.cur_index)){for(var s=n.cur_index;s<n.expr.length&&" "===n.expr[s];)s++;var c=Rn(n.expr,s);if(c)return r.push({type:X,value:a,args:c.args}),n.cur_index=c.end_index+1,n.prev_index=n.cur_index,void(n.curr_state=E)}else{var l=cn(n.fill_data,a);if("function"==typeof l){for(var f=n.cur_index;f<n.expr.length&&" "===n.expr[f];)f++;if(f<n.expr.length&&"("===n.expr[f]){var p=Rn(n.expr,f);if(p)return r.push({type:X,value:a,args:p.args,fn:l}),n.cur_index=p.end_index+1,n.prev_index=n.cur_index,void(n.curr_state=E)}}if(n._unit){var v,_=en(l),d=_.num,h=_.unit;if(void 0===h)r.push({type:"var",value:a,real_value:d,has_unit:!1});else n.has_unit=!0,null!==(v=n.unit_str)&&void 0!==v||(n.unit_str=h),r.push({type:"var",value:a,real_value:d,has_unit:!0,unit:h})}else r.push({type:"var",value:a,real_value:l,has_unit:!1})}}else r.push({type:n.curr_state,value:n.expr.slice(n.prev_index,n.cur_index)});n.curr_state=E,n.prev_index=n.cur_index}function Bn(r,n,t,e){for(var i,u={has_var:!1,has_unit:!1,unit_str:void 0,fill_data:n,cur_index:0,prev_index:0,curr_state:E,expr:r,_unit:t},o=r.length,a=[],s=Un(r);u.cur_index<o;)switch(i=r[u.cur_index],u.curr_state){case E:if(w.has(i))u.curr_state=A,u.cur_index++;else if("."===i&&w.has(r[u.cur_index+1]))u.curr_state=A,u.cur_index++;else if(" "===i)u.cur_index++,u.prev_index=u.cur_index;else if("+-".includes(i)){var c=a.at(-1);0===u.cur_index||"operator"===(null==c?void 0:c.type)||"comparison"===(null==c?void 0:c.type)||"logical"===(null==c?void 0:c.type)||"logical_not"===(null==c?void 0:c.type)||"ternary_question"===(null==c?void 0:c.type)||"ternary_colon"===(null==c?void 0:c.type)||"("===(null==c?void 0:c.value)||"["===(null==c?void 0:c.value)||","===(null==c?void 0:c.value)?(u.curr_state=A,u.cur_index++):(u.cur_index++,a.push({type:O,value:r.slice(u.prev_index,u.cur_index)}),u.prev_index=u.cur_index)}else if("*/%".includes(i))u.curr_state=O,u.cur_index++;else if(">"===i)u.cur_index++,u.cur_index<o&&"="===r[u.cur_index]?(u.cur_index++,a.push({type:J,value:">="})):a.push({type:J,value:">"}),u.prev_index=u.cur_index;else if("<"===i)u.cur_index++,u.cur_index<o&&"="===r[u.cur_index]?(u.cur_index++,a.push({type:J,value:"<="})):a.push({type:J,value:"<"}),u.prev_index=u.cur_index;else if("="===i&&u.cur_index+1<o&&"="===r[u.cur_index+1])u.cur_index+=2,a.push({type:J,value:"=="}),u.prev_index=u.cur_index;else if("!"===i&&u.cur_index+1<o&&"="===r[u.cur_index+1])u.cur_index+=2,a.push({type:J,value:"!="}),u.prev_index=u.cur_index;else if("&"===i&&u.cur_index+1<o&&"&"===r[u.cur_index+1])u.cur_index+=2,a.push({type:Q,value:"&&"}),u.prev_index=u.cur_index;else if("|"===i&&u.cur_index+1<o&&"|"===r[u.cur_index+1])u.cur_index+=2,a.push({type:Q,value:"||"}),u.prev_index=u.cur_index;else if("!"===i)u.cur_index++,a.push({type:"logical_not",value:"!"}),u.prev_index=u.cur_index;else if("?"===i)u.cur_index++,a.push({type:"ternary_question",value:"?"}),u.prev_index=u.cur_index;else if(":"===i)u.cur_index++,a.push({type:"ternary_colon",value:":"}),u.prev_index=u.cur_index;else if("["===i)u.cur_index++,a.push({type:"range_start",value:"["}),u.prev_index=u.cur_index;else if("]"===i)u.cur_index++,a.push({type:"range_end",value:"]"}),u.prev_index=u.cur_index;else if(","===i)u.cur_index++,a.push({type:"comma",value:","}),u.prev_index=u.cur_index;else if(y.has(i))u.curr_state=F,u.cur_index++;else if('"'===i||"'"===i){var l=i;u.cur_index++;for(var f="";u.cur_index<o&&r[u.cur_index]!==l;)"\\"===r[u.cur_index]&&u.cur_index+1<o?(u.cur_index++,f+=r[u.cur_index]):f+=r[u.cur_index],u.cur_index++;u.cur_index++,a.push({type:"string",value:f}),u.prev_index=u.cur_index}else if("("===i){var p=s.get(u.cur_index);if(p){u.has_var=!0;var v=fn(n,p.paths,e),_=v.value,d=v.path;if(t){var h,g=en(_),m=g.num,b=g.unit;if(void 0!==b)u.has_unit=!0,null!==(h=u.unit_str)&&void 0!==h||(u.unit_str=b),a.push({type:Z,value:p.paths,real_value:m,matched_path:d,has_unit:!0,unit:b});else a.push({type:Z,value:p.paths,real_value:m,matched_path:d,has_unit:!1})}else a.push({type:Z,value:p.paths,real_value:_,matched_path:d,has_unit:!1});u.cur_index=p.end_index+1,u.prev_index=u.cur_index}else a.push({type:k,value:i}),u.curr_state=E,u.cur_index++,u.prev_index=u.cur_index}else")"===i?(a.push({type:k,value:i}),u.curr_state=E,u.cur_index++,u.prev_index=u.cur_index):(u.cur_index++,u.prev_index=u.cur_index);break;case A:if(w.has(i))u.cur_index++;else if("."===i){if(u.cur_index===u.prev_index||r.slice(u.prev_index,u.cur_index).includes("."))throw new Error("非法的小数部分".concat(r.slice(u.prev_index,u.cur_index)));u.cur_index++}else"e"===i?(u.curr_state=j,u.cur_index++):t?"*/+-() ".indexOf(i)>-1||">"===i||"<"===i||"="===i||"!"===i||"&"===i||"|"===i||"?"===i||":"===i||"["===i||"]"===i||","===i||"%"===i&&w.has(r[u.cur_index-1])&&S.has(pn(r,u.cur_index,o))?Cn(a,u):u.cur_index++:Cn(a,u);break;case O:var N=r[u.cur_index-1];"*"===i&&"*"===N?(u.cur_index++,a.push({type:O,value:"**"}),u.prev_index=u.cur_index):"/"===i&&"/"===N?(u.cur_index++,a.push({type:O,value:"//"}),u.prev_index=u.cur_index):(a.push({type:O,value:N}),u.prev_index=u.cur_index),u.curr_state=E;break;case F:x.has(i)?u.cur_index++:Cn(a,u);break;case j:if(w.has(i))u.cur_index++;else if("+-".includes(i)){var q=u.prev_index;"+-".includes(r[q])&&(q+=1);var M=r.slice(q,u.cur_index),W=M.at(-1);M.includes(i)||"e"!==W?Cn(a,u):u.cur_index++}else t&&-1==="*/+-() ".indexOf(i)&&">"!==i&&"<"!==i&&"="!==i&&"!"!==i&&"&"!==i&&"|"!==i&&"?"!==i&&":"!==i&&"["!==i&&"]"!==i&&","!==i?u.cur_index++:Cn(a,u);break;default:throw new Error("字符扫描状态错误")}return u.prev_index<u.cur_index&&Cn(a,u),a.has_var=u.has_var,a.has_unit=u.has_unit,a.unit=u.unit_str,a}
|
|
4
|
+
/*!
|
|
5
|
+
* decimal.js v10.6.0
|
|
6
|
+
* An arbitrary-precision Decimal type for JavaScript.
|
|
7
|
+
* https://github.com/MikeMcl/decimal.js
|
|
8
|
+
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
9
|
+
* MIT Licence
|
|
10
|
+
*/var Ln,Hn,Gn=9e15,Vn=1e9,Kn="0123456789abcdef",Jn="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",Qn="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Xn={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Gn,maxE:Gn,crypto:!1},Yn=!0,rt="[DecimalError] ",nt=rt+"Invalid argument: ",tt=rt+"Precision limit exceeded",et=rt+"crypto unavailable",it="[object Decimal]",ut=Math.floor,ot=Math.pow,at=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,st=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,ct=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,lt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ft=1e7,pt=Jn.length-1,vt=Qn.length-1,_t={toStringTag:it};function dt(r){var n,t,e,i=r.length-1,u="",o=r[0];if(i>0){for(u+=o,n=1;n<i;n++)(t=7-(e=r[n]+"").length)&&(u+=At(t)),u+=e;(t=7-(e=(o=r[n])+"").length)&&(u+=At(t))}else if(0===o)return"0";for(;o%10==0;)o/=10;return u+o}function ht(r,n,t){if(r!==~~r||r<n||r>t)throw Error(nt+r)}function gt(r,n,t,e){var i,u,o,a;for(u=r[0];u>=10;u/=10)--n;return--n<0?(n+=7,i=0):(i=Math.ceil((n+1)/7),n%=7),u=ot(10,7-n),a=r[i]%u|0,null==e?n<3?(0==n?a=a/100|0:1==n&&(a=a/10|0),o=t<4&&99999==a||t>3&&49999==a||5e4==a||0==a):o=(t<4&&a+1==u||t>3&&a+1==u/2)&&(r[i+1]/u/100|0)==ot(10,n-2)-1||(a==u/2||0==a)&&!(r[i+1]/u/100|0):n<4?(0==n?a=a/1e3|0:1==n?a=a/100|0:2==n&&(a=a/10|0),o=(e||t<4)&&9999==a||!e&&t>3&&4999==a):o=((e||t<4)&&a+1==u||!e&&t>3&&a+1==u/2)&&(r[i+1]/u/1e3|0)==ot(10,n-3)-1,o}function mt(r,n,t){for(var e,i,u=[0],o=0,a=r.length;o<a;){for(i=u.length;i--;)u[i]*=n;for(u[0]+=Kn.indexOf(r.charAt(o++)),e=0;e<u.length;e++)u[e]>t-1&&(void 0===u[e+1]&&(u[e+1]=0),u[e+1]+=u[e]/t|0,u[e]%=t)}return u.reverse()}_t.absoluteValue=_t.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),yt(r)},_t.ceil=function(){return yt(new this.constructor(this),this.e+1,2)},_t.clampedTo=_t.clamp=function(r,n){var t=this,e=t.constructor;if(r=new e(r),n=new e(n),!r.s||!n.s)return new e(NaN);if(r.gt(n))throw Error(nt+n);return t.cmp(r)<0?r:t.cmp(n)>0?n:new e(t)},_t.comparedTo=_t.cmp=function(r){var n,t,e,i,u=this,o=u.d,a=(r=new u.constructor(r)).d,s=u.s,c=r.s;if(!o||!a)return s&&c?s!==c?s:o===a?0:!o^s<0?1:-1:NaN;if(!o[0]||!a[0])return o[0]?s:a[0]?-c:0;if(s!==c)return s;if(u.e!==r.e)return u.e>r.e^s<0?1:-1;for(n=0,t=(e=o.length)<(i=a.length)?e:i;n<t;++n)if(o[n]!==a[n])return o[n]>a[n]^s<0?1:-1;return e===i?0:e>i^s<0?1:-1},_t.cosine=_t.cos=function(){var r,n,t=this,e=t.constructor;return t.d?t.d[0]?(r=e.precision,n=e.rounding,e.precision=r+Math.max(t.e,t.sd())+7,e.rounding=1,t=function(r,n){var t,e,i;if(n.isZero())return n;e=n.d.length,e<32?i=(1/It(4,t=Math.ceil(e/3))).toString():(t=16,i="2.3283064365386962890625e-10");r.precision+=t,n=zt(r,1,n.times(i),new r(1));for(var u=t;u--;){var o=n.times(n);n=o.times(o).minus(o).times(8).plus(1)}return r.precision-=t,n}(e,Tt(e,t)),e.precision=r,e.rounding=n,yt(2==Hn||3==Hn?t.neg():t,r,n,!0)):new e(1):new e(NaN)},_t.cubeRoot=_t.cbrt=function(){var r,n,t,e,i,u,o,a,s,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(Yn=!1,(u=l.s*ot(l.s*l,1/3))&&Math.abs(u)!=1/0?e=new f(u.toString()):(t=dt(l.d),(u=((r=l.e)-t.length+1)%3)&&(t+=1==u||-2==u?"0":"00"),u=ot(t,1/3),r=ut((r+1)/3)-(r%3==(r<0?-1:2)),(e=new f(t=u==1/0?"5e"+r:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+r)).s=l.s),o=(r=f.precision)+3;;)if(c=(s=(a=e).times(a).times(a)).plus(l),e=wt(c.plus(l).times(a),c.plus(s),o+2,1),dt(a.d).slice(0,o)===(t=dt(e.d)).slice(0,o)){if("9999"!=(t=t.slice(o-3,o+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(yt(e,r+1,1),n=!e.times(e).times(e).eq(l));break}if(!i&&(yt(a,r+1,0),a.times(a).times(a).eq(l))){e=a;break}o+=4,i=1}return Yn=!0,yt(e,r,f.rounding,n)},_t.decimalPlaces=_t.dp=function(){var r,n=this.d,t=NaN;if(n){if(t=7*((r=n.length-1)-ut(this.e/7)),r=n[r])for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t},_t.dividedBy=_t.div=function(r){return wt(this,new this.constructor(r))},_t.dividedToIntegerBy=_t.divToInt=function(r){var n=this.constructor;return yt(wt(this,new n(r),0,1,1),n.precision,n.rounding)},_t.equals=_t.eq=function(r){return 0===this.cmp(r)},_t.floor=function(){return yt(new this.constructor(this),this.e+1,3)},_t.greaterThan=_t.gt=function(r){return this.cmp(r)>0},_t.greaterThanOrEqualTo=_t.gte=function(r){var n=this.cmp(r);return 1==n||0===n},_t.hyperbolicCosine=_t.cosh=function(){var r,n,t,e,i,u=this,o=u.constructor,a=new o(1);if(!u.isFinite())return new o(u.s?1/0:NaN);if(u.isZero())return a;t=o.precision,e=o.rounding,o.precision=t+Math.max(u.e,u.sd())+4,o.rounding=1,(i=u.d.length)<32?n=(1/It(4,r=Math.ceil(i/3))).toString():(r=16,n="2.3283064365386962890625e-10"),u=zt(o,1,u.times(n),new o(1),!0);for(var s,c=r,l=new o(8);c--;)s=u.times(u),u=a.minus(s.times(l.minus(s.times(l))));return yt(u,o.precision=t,o.rounding=e,!0)},_t.hyperbolicSine=_t.sinh=function(){var r,n,t,e,i=this,u=i.constructor;if(!i.isFinite()||i.isZero())return new u(i);if(n=u.precision,t=u.rounding,u.precision=n+Math.max(i.e,i.sd())+4,u.rounding=1,(e=i.d.length)<3)i=zt(u,2,i,i,!0);else{r=(r=1.4*Math.sqrt(e))>16?16:0|r,i=zt(u,2,i=i.times(1/It(5,r)),i,!0);for(var o,a=new u(5),s=new u(16),c=new u(20);r--;)o=i.times(i),i=i.times(a.plus(o.times(s.times(o).plus(c))))}return u.precision=n,u.rounding=t,yt(i,n,t,!0)},_t.hyperbolicTangent=_t.tanh=function(){var r,n,t=this,e=t.constructor;return t.isFinite()?t.isZero()?new e(t):(r=e.precision,n=e.rounding,e.precision=r+7,e.rounding=1,wt(t.sinh(),t.cosh(),e.precision=r,e.rounding=n)):new e(t.s)},_t.inverseCosine=_t.acos=function(){var r=this,n=r.constructor,t=r.abs().cmp(1),e=n.precision,i=n.rounding;return-1!==t?0===t?r.isNeg()?Nt(n,e,i):new n(0):new n(NaN):r.isZero()?Nt(n,e+4,i).times(.5):(n.precision=e+6,n.rounding=1,r=new n(1).minus(r).div(r.plus(1)).sqrt().atan(),n.precision=e,n.rounding=i,r.times(2))},_t.inverseHyperbolicCosine=_t.acosh=function(){var r,n,t=this,e=t.constructor;return t.lte(1)?new e(t.eq(1)?0:NaN):t.isFinite()?(r=e.precision,n=e.rounding,e.precision=r+Math.max(Math.abs(t.e),t.sd())+4,e.rounding=1,Yn=!1,t=t.times(t).minus(1).sqrt().plus(t),Yn=!0,e.precision=r,e.rounding=n,t.ln()):new e(t)},_t.inverseHyperbolicSine=_t.asinh=function(){var r,n,t=this,e=t.constructor;return!t.isFinite()||t.isZero()?new e(t):(r=e.precision,n=e.rounding,e.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,e.rounding=1,Yn=!1,t=t.times(t).plus(1).sqrt().plus(t),Yn=!0,e.precision=r,e.rounding=n,t.ln())},_t.inverseHyperbolicTangent=_t.atanh=function(){var r,n,t,e,i=this,u=i.constructor;return i.isFinite()?i.e>=0?new u(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=u.precision,n=u.rounding,e=i.sd(),Math.max(e,r)<2*-i.e-1?yt(new u(i),r,n,!0):(u.precision=t=e-i.e,i=wt(i.plus(1),new u(1).minus(i),t+r,1),u.precision=r+4,u.rounding=1,i=i.ln(),u.precision=r,u.rounding=n,i.times(.5))):new u(NaN)},_t.inverseSine=_t.asin=function(){var r,n,t,e,i=this,u=i.constructor;return i.isZero()?new u(i):(n=i.abs().cmp(1),t=u.precision,e=u.rounding,-1!==n?0===n?((r=Nt(u,t+4,e).times(.5)).s=i.s,r):new u(NaN):(u.precision=t+6,u.rounding=1,i=i.div(new u(1).minus(i.times(i)).sqrt().plus(1)).atan(),u.precision=t,u.rounding=e,i.times(2)))},_t.inverseTangent=_t.atan=function(){var r,n,t,e,i,u,o,a,s,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=vt)return(o=Nt(l,f+4,p).times(.25)).s=c.s,o}else{if(!c.s)return new l(NaN);if(f+4<=vt)return(o=Nt(l,f+4,p).times(.5)).s=c.s,o}for(l.precision=a=f+10,l.rounding=1,r=t=Math.min(28,a/7+2|0);r;--r)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(Yn=!1,n=Math.ceil(a/7),e=1,s=c.times(c),o=new l(c),i=c;-1!==r;)if(i=i.times(s),u=o.minus(i.div(e+=2)),i=i.times(s),void 0!==(o=u.plus(i.div(e+=2))).d[n])for(r=n;o.d[r]===u.d[r]&&r--;);return t&&(o=o.times(2<<t-1)),Yn=!0,yt(o,l.precision=f,l.rounding=p,!0)},_t.isFinite=function(){return!!this.d},_t.isInteger=_t.isInt=function(){return!!this.d&&ut(this.e/7)>this.d.length-2},_t.isNaN=function(){return!this.s},_t.isNegative=_t.isNeg=function(){return this.s<0},_t.isPositive=_t.isPos=function(){return this.s>0},_t.isZero=function(){return!!this.d&&0===this.d[0]},_t.lessThan=_t.lt=function(r){return this.cmp(r)<0},_t.lessThanOrEqualTo=_t.lte=function(r){return this.cmp(r)<1},_t.logarithm=_t.log=function(r){var n,t,e,i,u,o,a,s,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(null==r)r=new l(10),n=!0;else{if(t=(r=new l(r)).d,r.s<0||!t||!t[0]||r.eq(1))return new l(NaN);n=r.eq(10)}if(t=c.d,c.s<0||!t||!t[0]||c.eq(1))return new l(t&&!t[0]?-1/0:1!=c.s?NaN:t?0:1/0);if(n)if(t.length>1)u=!0;else{for(i=t[0];i%10==0;)i/=10;u=1!==i}if(Yn=!1,o=qt(c,a=f+5),e=n?St(l,a+10):qt(r,a),gt((s=wt(o,e,a,1)).d,i=f,p))do{if(o=qt(c,a+=10),e=n?St(l,a+10):qt(r,a),s=wt(o,e,a,1),!u){+dt(s.d).slice(i+1,i+15)+1==1e14&&(s=yt(s,f+1,0));break}}while(gt(s.d,i+=10,p));return Yn=!0,yt(s,f,p)},_t.minus=_t.sub=function(r){var n,t,e,i,u,o,a,s,c,l,f,p,v=this,_=v.constructor;if(r=new _(r),!v.d||!r.d)return v.s&&r.s?v.d?r.s=-r.s:r=new _(r.d||v.s!==r.s?v:NaN):r=new _(NaN),r;if(v.s!=r.s)return r.s=-r.s,v.plus(r);if(c=v.d,p=r.d,a=_.precision,s=_.rounding,!c[0]||!p[0]){if(p[0])r.s=-r.s;else{if(!c[0])return new _(3===s?-0:0);r=new _(v)}return Yn?yt(r,a,s):r}if(t=ut(r.e/7),l=ut(v.e/7),c=c.slice(),u=l-t){for((f=u<0)?(n=c,u=-u,o=p.length):(n=p,t=l,o=c.length),u>(e=Math.max(Math.ceil(a/7),o)+2)&&(u=e,n.length=1),n.reverse(),e=u;e--;)n.push(0);n.reverse()}else{for((f=(e=c.length)<(o=p.length))&&(o=e),e=0;e<o;e++)if(c[e]!=p[e]){f=c[e]<p[e];break}u=0}for(f&&(n=c,c=p,p=n,r.s=-r.s),o=c.length,e=p.length-o;e>0;--e)c[o++]=0;for(e=p.length;e>u;){if(c[--e]<p[e]){for(i=e;i&&0===c[--i];)c[i]=ft-1;--c[i],c[e]+=ft}c[e]-=p[e]}for(;0===c[--o];)c.pop();for(;0===c[0];c.shift())--t;return c[0]?(r.d=c,r.e=bt(c,t),Yn?yt(r,a,s):r):new _(3===s?-0:0)},_t.modulo=_t.mod=function(r){var n,t=this,e=t.constructor;return r=new e(r),!t.d||!r.s||r.d&&!r.d[0]?new e(NaN):!r.d||t.d&&!t.d[0]?yt(new e(t),e.precision,e.rounding):(Yn=!1,9==e.modulo?(n=wt(t,r.abs(),0,3,1)).s*=r.s:n=wt(t,r,0,e.modulo,1),n=n.times(r),Yn=!0,t.minus(n))},_t.naturalExponential=_t.exp=function(){return Ft(this)},_t.naturalLogarithm=_t.ln=function(){return qt(this)},_t.negated=_t.neg=function(){var r=new this.constructor(this);return r.s=-r.s,yt(r)},_t.plus=_t.add=function(r){var n,t,e,i,u,o,a,s,c,l,f=this,p=f.constructor;if(r=new p(r),!f.d||!r.d)return f.s&&r.s?f.d||(r=new p(r.d||f.s===r.s?f:NaN)):r=new p(NaN),r;if(f.s!=r.s)return r.s=-r.s,f.minus(r);if(c=f.d,l=r.d,a=p.precision,s=p.rounding,!c[0]||!l[0])return l[0]||(r=new p(f)),Yn?yt(r,a,s):r;if(u=ut(f.e/7),e=ut(r.e/7),c=c.slice(),i=u-e){for(i<0?(t=c,i=-i,o=l.length):(t=l,e=u,o=c.length),i>(o=(u=Math.ceil(a/7))>o?u+1:o+1)&&(i=o,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for((o=c.length)-(i=l.length)<0&&(i=o,t=l,l=c,c=t),n=0;i;)n=(c[--i]=c[i]+l[i]+n)/ft|0,c[i]%=ft;for(n&&(c.unshift(n),++e),o=c.length;0==c[--o];)c.pop();return r.d=c,r.e=bt(c,e),Yn?yt(r,a,s):r},_t.precision=_t.sd=function(r){var n,t=this;if(void 0!==r&&r!==!!r&&1!==r&&0!==r)throw Error(nt+r);return t.d?(n=Et(t.d),r&&t.e+1>n&&(n=t.e+1)):n=NaN,n},_t.round=function(){var r=this,n=r.constructor;return yt(new n(r),r.e+1,n.rounding)},_t.sine=_t.sin=function(){var r,n,t=this,e=t.constructor;return t.isFinite()?t.isZero()?new e(t):(r=e.precision,n=e.rounding,e.precision=r+Math.max(t.e,t.sd())+7,e.rounding=1,t=function(r,n){var t,e=n.d.length;if(e<3)return n.isZero()?n:zt(r,2,n,n);t=(t=1.4*Math.sqrt(e))>16?16:0|t,n=n.times(1/It(5,t)),n=zt(r,2,n,n);for(var i,u=new r(5),o=new r(16),a=new r(20);t--;)i=n.times(n),n=n.times(u.plus(i.times(o.times(i).minus(a))));return n}(e,Tt(e,t)),e.precision=r,e.rounding=n,yt(Hn>2?t.neg():t,r,n,!0)):new e(NaN)},_t.squareRoot=_t.sqrt=function(){var r,n,t,e,i,u,o=this,a=o.d,s=o.e,c=o.s,l=o.constructor;if(1!==c||!a||!a[0])return new l(!c||c<0&&(!a||a[0])?NaN:a?o:1/0);for(Yn=!1,0==(c=Math.sqrt(+o))||c==1/0?(((n=dt(a)).length+s)%2==0&&(n+="0"),c=Math.sqrt(n),s=ut((s+1)/2)-(s<0||s%2),e=new l(n=c==1/0?"5e"+s:(n=c.toExponential()).slice(0,n.indexOf("e")+1)+s)):e=new l(c.toString()),t=(s=l.precision)+3;;)if(e=(u=e).plus(wt(o,u,t+2,1)).times(.5),dt(u.d).slice(0,t)===(n=dt(e.d)).slice(0,t)){if("9999"!=(n=n.slice(t-3,t+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(yt(e,s+1,1),r=!e.times(e).eq(o));break}if(!i&&(yt(u,s+1,0),u.times(u).eq(o))){e=u;break}t+=4,i=1}return Yn=!0,yt(e,s,l.rounding,r)},_t.tangent=_t.tan=function(){var r,n,t=this,e=t.constructor;return t.isFinite()?t.isZero()?new e(t):(r=e.precision,n=e.rounding,e.precision=r+10,e.rounding=1,(t=t.sin()).s=1,t=wt(t,new e(1).minus(t.times(t)).sqrt(),r+10,0),e.precision=r,e.rounding=n,yt(2==Hn||4==Hn?t.neg():t,r,n,!0)):new e(NaN)},_t.times=_t.mul=function(r){var n,t,e,i,u,o,a,s,c,l=this,f=l.constructor,p=l.d,v=(r=new f(r)).d;if(r.s*=l.s,!(p&&p[0]&&v&&v[0]))return new f(!r.s||p&&!p[0]&&!v||v&&!v[0]&&!p?NaN:p&&v?0*r.s:r.s/0);for(t=ut(l.e/7)+ut(r.e/7),(s=p.length)<(c=v.length)&&(u=p,p=v,v=u,o=s,s=c,c=o),u=[],e=o=s+c;e--;)u.push(0);for(e=c;--e>=0;){for(n=0,i=s+e;i>e;)a=u[i]+v[e]*p[i-e-1]+n,u[i--]=a%ft|0,n=a/ft|0;u[i]=(u[i]+n)%ft|0}for(;!u[--o];)u.pop();return n?++t:u.shift(),r.d=u,r.e=bt(u,t),Yn?yt(r,f.precision,f.rounding):r},_t.toBinary=function(r,n){return Dt(this,2,r,n)},_t.toDecimalPlaces=_t.toDP=function(r,n){var t=this,e=t.constructor;return t=new e(t),void 0===r?t:(ht(r,0,Vn),void 0===n?n=e.rounding:ht(n,0,8),yt(t,r+t.e+1,n))},_t.toExponential=function(r,n){var t,e=this,i=e.constructor;return void 0===r?t=xt(e,!0):(ht(r,0,Vn),void 0===n?n=i.rounding:ht(n,0,8),t=xt(e=yt(new i(e),r+1,n),!0,r+1)),e.isNeg()&&!e.isZero()?"-"+t:t},_t.toFixed=function(r,n){var t,e,i=this,u=i.constructor;return void 0===r?t=xt(i):(ht(r,0,Vn),void 0===n?n=u.rounding:ht(n,0,8),t=xt(e=yt(new u(i),r+i.e+1,n),!1,r+e.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t},_t.toFraction=function(r){var n,t,e,i,u,o,a,s,c,l,f,p,v=this,_=v.d,d=v.constructor;if(!_)return new d(v);if(c=t=new d(1),e=s=new d(0),o=(u=(n=new d(e)).e=Et(_)-v.e-1)%7,n.d[0]=ot(10,o<0?7+o:o),null==r)r=u>0?n:c;else{if(!(a=new d(r)).isInt()||a.lt(c))throw Error(nt+a);r=a.gt(n)?u>0?n:c:a}for(Yn=!1,a=new d(dt(_)),l=d.precision,d.precision=u=7*_.length*2;f=wt(a,n,0,1,1),1!=(i=t.plus(f.times(e))).cmp(r);)t=e,e=i,i=c,c=s.plus(f.times(i)),s=i,i=n,n=a.minus(f.times(i)),a=i;return i=wt(r.minus(t),e,0,1,1),s=s.plus(i.times(c)),t=t.plus(i.times(e)),s.s=c.s=v.s,p=wt(c,e,u,1).minus(v).abs().cmp(wt(s,t,u,1).minus(v).abs())<1?[c,e]:[s,t],d.precision=l,Yn=!0,p},_t.toHexadecimal=_t.toHex=function(r,n){return Dt(this,16,r,n)},_t.toNearest=function(r,n){var t=this,e=t.constructor;if(t=new e(t),null==r){if(!t.d)return t;r=new e(1),n=e.rounding}else{if(r=new e(r),void 0===n?n=e.rounding:ht(n,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(Yn=!1,t=wt(t,r,0,n,1).times(r),Yn=!0,yt(t)):(r.s=t.s,t=r),t},_t.toNumber=function(){return+this},_t.toOctal=function(r,n){return Dt(this,8,r,n)},_t.toPower=_t.pow=function(r){var n,t,e,i,u,o,a=this,s=a.constructor,c=+(r=new s(r));if(!(a.d&&r.d&&a.d[0]&&r.d[0]))return new s(ot(+a,c));if((a=new s(a)).eq(1))return a;if(e=s.precision,u=s.rounding,r.eq(1))return yt(a,e,u);if((n=ut(r.e/7))>=r.d.length-1&&(t=c<0?-c:c)<=9007199254740991)return i=jt(s,a,t,e),r.s<0?new s(1).div(i):yt(i,e,u);if((o=a.s)<0){if(n<r.d.length-1)return new s(NaN);if(1&r.d[n]||(o=1),0==a.e&&1==a.d[0]&&1==a.d.length)return a.s=o,a}return(n=0!=(t=ot(+a,c))&&isFinite(t)?new s(t+"").e:ut(c*(Math.log("0."+dt(a.d))/Math.LN10+a.e+1)))>s.maxE+1||n<s.minE-1?new s(n>0?o/0:0):(Yn=!1,s.rounding=a.s=1,t=Math.min(12,(n+"").length),(i=Ft(r.times(qt(a,e+t)),e)).d&>((i=yt(i,e+5,1)).d,e,u)&&(n=e+10,+dt((i=yt(Ft(r.times(qt(a,n+t)),n),n+5,1)).d).slice(e+1,e+15)+1==1e14&&(i=yt(i,e+1,0))),i.s=o,Yn=!0,s.rounding=u,yt(i,e,u))},_t.toPrecision=function(r,n){var t,e=this,i=e.constructor;return void 0===r?t=xt(e,e.e<=i.toExpNeg||e.e>=i.toExpPos):(ht(r,1,Vn),void 0===n?n=i.rounding:ht(n,0,8),t=xt(e=yt(new i(e),r,n),r<=e.e||e.e<=i.toExpNeg,r)),e.isNeg()&&!e.isZero()?"-"+t:t},_t.toSignificantDigits=_t.toSD=function(r,n){var t=this.constructor;return void 0===r?(r=t.precision,n=t.rounding):(ht(r,1,Vn),void 0===n?n=t.rounding:ht(n,0,8)),yt(new t(this),r,n)},_t.toString=function(){var r=this,n=r.constructor,t=xt(r,r.e<=n.toExpNeg||r.e>=n.toExpPos);return r.isNeg()&&!r.isZero()?"-"+t:t},_t.truncated=_t.trunc=function(){return yt(new this.constructor(this),this.e+1,1)},_t.valueOf=_t.toJSON=function(){var r=this,n=r.constructor,t=xt(r,r.e<=n.toExpNeg||r.e>=n.toExpPos);return r.isNeg()?"-"+t:t};var wt=function(){function r(r,n,t){var e,i=0,u=r.length;for(r=r.slice();u--;)e=r[u]*n+i,r[u]=e%t|0,i=e/t|0;return i&&r.unshift(i),r}function n(r,n,t,e){var i,u;if(t!=e)u=t>e?1:-1;else for(i=u=0;i<t;i++)if(r[i]!=n[i]){u=r[i]>n[i]?1:-1;break}return u}function t(r,n,t,e){for(var i=0;t--;)r[t]-=i,i=r[t]<n[t]?1:0,r[t]=i*e+r[t]-n[t];for(;!r[0]&&r.length>1;)r.shift()}return function(e,i,u,o,a,s){var c,l,f,p,v,_,d,h,g,m,w,y,x,b,S,N,E,A,j,O,k=e.constructor,F=e.s==i.s?1:-1,q=e.d,M=i.d;if(!(q&&q[0]&&M&&M[0]))return new k(e.s&&i.s&&(q?!M||q[0]!=M[0]:M)?q&&0==q[0]||!M?0*F:F/0:NaN);for(s?(v=1,l=e.e-i.e):(s=ft,v=7,l=ut(e.e/v)-ut(i.e/v)),j=M.length,E=q.length,m=(g=new k(F)).d=[],f=0;M[f]==(q[f]||0);f++);if(M[f]>(q[f]||0)&&l--,null==u?(b=u=k.precision,o=k.rounding):b=a?u+(e.e-i.e)+1:u,b<0)m.push(1),_=!0;else{if(b=b/v+2|0,f=0,1==j){for(p=0,M=M[0],b++;(f<E||p)&&b--;f++)S=p*s+(q[f]||0),m[f]=S/M|0,p=S%M|0;_=p||f<E}else{for((p=s/(M[0]+1)|0)>1&&(M=r(M,p,s),q=r(q,p,s),j=M.length,E=q.length),N=j,y=(w=q.slice(0,j)).length;y<j;)w[y++]=0;(O=M.slice()).unshift(0),A=M[0],M[1]>=s/2&&++A;do{p=0,(c=n(M,w,j,y))<0?(x=w[0],j!=y&&(x=x*s+(w[1]||0)),(p=x/A|0)>1?(p>=s&&(p=s-1),1==(c=n(d=r(M,p,s),w,h=d.length,y=w.length))&&(p--,t(d,j<h?O:M,h,s))):(0==p&&(c=p=1),d=M.slice()),(h=d.length)<y&&d.unshift(0),t(w,d,y,s),-1==c&&(c=n(M,w,j,y=w.length))<1&&(p++,t(w,j<y?O:M,y,s)),y=w.length):0===c&&(p++,w=[0]),m[f++]=p,c&&w[0]?w[y++]=q[N]||0:(w=[q[N]],y=1)}while((N++<E||void 0!==w[0])&&b--);_=void 0!==w[0]}m[0]||m.shift()}if(1==v)g.e=l,Ln=_;else{for(f=1,p=m[0];p>=10;p/=10)f++;g.e=f+l*v-1,yt(g,a?u+g.e+1:u,o,_)}return g}}();function yt(r,n,t,e){var i,u,o,a,s,c,l,f,p,v=r.constructor;r:if(null!=n){if(!(f=r.d))return r;for(i=1,a=f[0];a>=10;a/=10)i++;if((u=n-i)<0)u+=7,o=n,s=(l=f[p=0])/ot(10,i-o-1)%10|0;else if((p=Math.ceil((u+1)/7))>=(a=f.length)){if(!e)break r;for(;a++<=p;)f.push(0);l=s=0,i=1,o=(u%=7)-7+1}else{for(l=a=f[p],i=1;a>=10;a/=10)i++;s=(o=(u%=7)-7+i)<0?0:l/ot(10,i-o-1)%10|0}if(e=e||n<0||void 0!==f[p+1]||(o<0?l:l%ot(10,i-o-1)),c=t<4?(s||e)&&(0==t||t==(r.s<0?3:2)):s>5||5==s&&(4==t||e||6==t&&(u>0?o>0?l/ot(10,i-o):0:f[p-1])%10&1||t==(r.s<0?8:7)),n<1||!f[0])return f.length=0,c?(n-=r.e+1,f[0]=ot(10,(7-n%7)%7),r.e=-n||0):f[0]=r.e=0,r;if(0==u?(f.length=p,a=1,p--):(f.length=p+1,a=ot(10,7-u),f[p]=o>0?(l/ot(10,i-o)%ot(10,o)|0)*a:0),c)for(;;){if(0==p){for(u=1,o=f[0];o>=10;o/=10)u++;for(o=f[0]+=a,a=1;o>=10;o/=10)a++;u!=a&&(r.e++,f[0]==ft&&(f[0]=1));break}if(f[p]+=a,f[p]!=ft)break;f[p--]=0,a=1}for(u=f.length;0===f[--u];)f.pop()}return Yn&&(r.e>v.maxE?(r.d=null,r.e=NaN):r.e<v.minE&&(r.e=0,r.d=[0])),r}function xt(r,n,t){if(!r.isFinite())return Mt(r);var e,i=r.e,u=dt(r.d),o=u.length;return n?(t&&(e=t-o)>0?u=u.charAt(0)+"."+u.slice(1)+At(e):o>1&&(u=u.charAt(0)+"."+u.slice(1)),u=u+(r.e<0?"e":"e+")+r.e):i<0?(u="0."+At(-i-1)+u,t&&(e=t-o)>0&&(u+=At(e))):i>=o?(u+=At(i+1-o),t&&(e=t-i-1)>0&&(u=u+"."+At(e))):((e=i+1)<o&&(u=u.slice(0,e)+"."+u.slice(e)),t&&(e=t-o)>0&&(i+1===o&&(u+="."),u+=At(e))),u}function bt(r,n){var t=r[0];for(n*=7;t>=10;t/=10)n++;return n}function St(r,n,t){if(n>pt)throw Yn=!0,t&&(r.precision=t),Error(tt);return yt(new r(Jn),n,1,!0)}function Nt(r,n,t){if(n>vt)throw Error(tt);return yt(new r(Qn),n,t,!0)}function Et(r){var n=r.length-1,t=7*n+1;if(n=r[n]){for(;n%10==0;n/=10)t--;for(n=r[0];n>=10;n/=10)t++}return t}function At(r){for(var n="";r--;)n+="0";return n}function jt(r,n,t,e){var i,u=new r(1),o=Math.ceil(e/7+4);for(Yn=!1;;){if(t%2&&Zt((u=u.times(n)).d,o)&&(i=!0),0===(t=ut(t/2))){t=u.d.length-1,i&&0===u.d[t]&&++u.d[t];break}Zt((n=n.times(n)).d,o)}return Yn=!0,u}function Ot(r){return 1&r.d[r.d.length-1]}function kt(r,n,t){for(var e,i,u=new r(n[0]),o=0;++o<n.length;){if(!(i=new r(n[o])).s){u=i;break}((e=u.cmp(i))===t||0===e&&u.s===t)&&(u=i)}return u}function Ft(r,n){var t,e,i,u,o,a,s,c=0,l=0,f=0,p=r.constructor,v=p.rounding,_=p.precision;if(!r.d||!r.d[0]||r.e>17)return new p(r.d?r.d[0]?r.s<0?0:1/0:1:r.s?r.s<0?0:r:NaN);for(null==n?(Yn=!1,s=_):s=n,a=new p(.03125);r.e>-2;)r=r.times(a),f+=5;for(s+=e=Math.log(ot(2,f))/Math.LN10*2+5|0,t=u=o=new p(1),p.precision=s;;){if(u=yt(u.times(r),s,1),t=t.times(++l),dt((a=o.plus(wt(u,t,s,1))).d).slice(0,s)===dt(o.d).slice(0,s)){for(i=f;i--;)o=yt(o.times(o),s,1);if(null!=n)return p.precision=_,o;if(!(c<3&>(o.d,s-e,v,c)))return yt(o,p.precision=_,v,Yn=!0);p.precision=s+=10,t=u=a=new p(1),l=0,c++}o=a}}function qt(r,n){var t,e,i,u,o,a,s,c,l,f,p,v=1,_=r,d=_.d,h=_.constructor,g=h.rounding,m=h.precision;if(_.s<0||!d||!d[0]||!_.e&&1==d[0]&&1==d.length)return new h(d&&!d[0]?-1/0:1!=_.s?NaN:d?0:_);if(null==n?(Yn=!1,l=m):l=n,h.precision=l+=10,e=(t=dt(d)).charAt(0),!(Math.abs(u=_.e)<15e14))return c=St(h,l+2,m).times(u+""),_=qt(new h(e+"."+t.slice(1)),l-10).plus(c),h.precision=m,null==n?yt(_,m,g,Yn=!0):_;for(;e<7&&1!=e||1==e&&t.charAt(1)>3;)e=(t=dt((_=_.times(r)).d)).charAt(0),v++;for(u=_.e,e>1?(_=new h("0."+t),u++):_=new h(e+"."+t.slice(1)),f=_,s=o=_=wt(_.minus(1),_.plus(1),l,1),p=yt(_.times(_),l,1),i=3;;){if(o=yt(o.times(p),l,1),dt((c=s.plus(wt(o,new h(i),l,1))).d).slice(0,l)===dt(s.d).slice(0,l)){if(s=s.times(2),0!==u&&(s=s.plus(St(h,l+2,m).times(u+""))),s=wt(s,new h(v),l,1),null!=n)return h.precision=m,s;if(!gt(s.d,l-10,g,a))return yt(s,h.precision=m,g,Yn=!0);h.precision=l+=10,c=o=_=wt(f.minus(1),f.plus(1),l,1),p=yt(_.times(_),l,1),i=a=1}s=c,i+=2}}function Mt(r){return String(r.s*r.s/0)}function Wt(r,n){var t,e,i;for((t=n.indexOf("."))>-1&&(n=n.replace(".","")),(e=n.search(/e/i))>0?(t<0&&(t=e),t+=+n.slice(e+1),n=n.substring(0,e)):t<0&&(t=n.length),e=0;48===n.charCodeAt(e);e++);for(i=n.length;48===n.charCodeAt(i-1);--i);if(n=n.slice(e,i)){if(i-=e,r.e=t=t-e-1,r.d=[],e=(t+1)%7,t<0&&(e+=7),e<i){for(e&&r.d.push(+n.slice(0,e)),i-=7;e<i;)r.d.push(+n.slice(e,e+=7));e=7-(n=n.slice(e)).length}else e-=i;for(;e--;)n+="0";r.d.push(+n),Yn&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}function Pt(r,n){var t,e,i,u,o,a,s,c,l;if(n.indexOf("_")>-1){if(n=n.replace(/(\d)_(?=\d)/g,"$1"),lt.test(n))return Wt(r,n)}else if("Infinity"===n||"NaN"===n)return+n||(r.s=NaN),r.e=NaN,r.d=null,r;if(st.test(n))t=16,n=n.toLowerCase();else if(at.test(n))t=2;else{if(!ct.test(n))throw Error(nt+n);t=8}for((u=n.search(/p/i))>0?(s=+n.slice(u+1),n=n.substring(2,u)):n=n.slice(2),o=(u=n.indexOf("."))>=0,e=r.constructor,o&&(u=(a=(n=n.replace(".","")).length)-u,i=jt(e,new e(t),u,2*u)),u=l=(c=mt(n,t,ft)).length-1;0===c[u];--u)c.pop();return u<0?new e(0*r.s):(r.e=bt(c,l),r.d=c,Yn=!1,o&&(r=wt(r,i,4*a)),s&&(r=r.times(Math.abs(s)<54?ot(2,s):Ae.pow(2,s))),Yn=!0,r)}function zt(r,n,t,e,i){var u,o,a,s,c=r.precision,l=Math.ceil(c/7);for(Yn=!1,s=t.times(t),a=new r(e);;){if(o=wt(a.times(s),new r(n++*n++),c,1),a=i?e.plus(o):e.minus(o),e=wt(o.times(s),new r(n++*n++),c,1),void 0!==(o=a.plus(e)).d[l]){for(u=l;o.d[u]===a.d[u]&&u--;);if(-1==u)break}u=a,a=e,e=o,o=u}return Yn=!0,o.d.length=l+1,o}function It(r,n){for(var t=r;--n;)t*=r;return t}function Tt(r,n){var t,e=n.s<0,i=Nt(r,r.precision,1),u=i.times(.5);if((n=n.abs()).lte(u))return Hn=e?4:1,n;if((t=n.divToInt(i)).isZero())Hn=e?3:2;else{if((n=n.minus(t.times(i))).lte(u))return Hn=Ot(t)?e?2:3:e?4:1,n;Hn=Ot(t)?e?1:4:e?3:2}return n.minus(i).abs()}function Dt(r,n,t,e){var i,u,o,a,s,c,l,f,p,v=r.constructor,_=void 0!==t;if(_?(ht(t,1,Vn),void 0===e?e=v.rounding:ht(e,0,8)):(t=v.precision,e=v.rounding),r.isFinite()){for(_?(i=2,16==n?t=4*t-3:8==n&&(t=3*t-2)):i=n,(o=(l=xt(r)).indexOf("."))>=0&&(l=l.replace(".",""),(p=new v(1)).e=l.length-o,p.d=mt(xt(p),10,i),p.e=p.d.length),u=s=(f=mt(l,10,i)).length;0==f[--s];)f.pop();if(f[0]){if(o<0?u--:((r=new v(r)).d=f,r.e=u,f=(r=wt(r,p,t,e,0,i)).d,u=r.e,c=Ln),o=f[t],a=i/2,c=c||void 0!==f[t+1],c=e<4?(void 0!==o||c)&&(0===e||e===(r.s<0?3:2)):o>a||o===a&&(4===e||c||6===e&&1&f[t-1]||e===(r.s<0?8:7)),f.length=t,c)for(;++f[--t]>i-1;)f[t]=0,t||(++u,f.unshift(1));for(s=f.length;!f[s-1];--s);for(o=0,l="";o<s;o++)l+=Kn.charAt(f[o]);if(_){if(s>1)if(16==n||8==n){for(o=16==n?4:3,--s;s%o;s++)l+="0";for(s=(f=mt(l,i,n)).length;!f[s-1];--s);for(o=1,l="1.";o<s;o++)l+=Kn.charAt(f[o])}else l=l.charAt(0)+"."+l.slice(1);l=l+(u<0?"p":"p+")+u}else if(u<0){for(;++u;)l="0"+l;l="0."+l}else if(++u>s)for(u-=s;u--;)l+="0";else u<s&&(l=l.slice(0,u)+"."+l.slice(u))}else l=_?"0p+0":"0";l=(16==n?"0x":2==n?"0b":8==n?"0o":"")+l}else l=Mt(r);return r.s<0?"-"+l:l}function Zt(r,n){if(r.length>n)return r.length=n,!0}function $t(r){return new this(r).abs()}function Ut(r){return new this(r).acos()}function Rt(r){return new this(r).acosh()}function Ct(r,n){return new this(r).plus(n)}function Bt(r){return new this(r).asin()}function Lt(r){return new this(r).asinh()}function Ht(r){return new this(r).atan()}function Gt(r){return new this(r).atanh()}function Vt(r,n){r=new this(r),n=new this(n);var t,e=this.precision,i=this.rounding,u=e+4;return r.s&&n.s?r.d||n.d?!n.d||r.isZero()?(t=n.s<0?Nt(this,e,i):new this(0)).s=r.s:!r.d||n.isZero()?(t=Nt(this,u,1).times(.5)).s=r.s:n.s<0?(this.precision=u,this.rounding=1,t=this.atan(wt(r,n,u,1)),n=Nt(this,u,1),this.precision=e,this.rounding=i,t=r.s<0?t.minus(n):t.plus(n)):t=this.atan(wt(r,n,u,1)):(t=Nt(this,u,1).times(n.s>0?.25:.75)).s=r.s:t=new this(NaN),t}function Kt(r){return new this(r).cbrt()}function Jt(r){return yt(r=new this(r),r.e+1,2)}function Qt(r,n,t){return new this(r).clamp(n,t)}function Xt(r){if(!r||"object"!==p(r))throw Error(rt+"Object expected");var n,t,e,i=!0===r.defaults,u=["precision",1,Vn,"rounding",0,8,"toExpNeg",-Gn,0,"toExpPos",0,Gn,"maxE",0,Gn,"minE",-Gn,0,"modulo",0,9];for(n=0;n<u.length;n+=3)if(t=u[n],i&&(this[t]=Xn[t]),void 0!==(e=r[t])){if(!(ut(e)===e&&e>=u[n+1]&&e<=u[n+2]))throw Error(nt+t+": "+e);this[t]=e}if(t="crypto",i&&(this[t]=Xn[t]),void 0!==(e=r[t])){if(!0!==e&&!1!==e&&0!==e&&1!==e)throw Error(nt+t+": "+e);if(e){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(et);this[t]=!0}else this[t]=!1}return this}function Yt(r){return new this(r).cos()}function re(r){return new this(r).cosh()}function ne(r,n){return new this(r).div(n)}function te(r){return new this(r).exp()}function ee(r){return yt(r=new this(r),r.e+1,3)}function ie(){var r,n,t=new this(0);for(Yn=!1,r=0;r<arguments.length;)if((n=new this(arguments[r++])).d)t.d&&(t=t.plus(n.times(n)));else{if(n.s)return Yn=!0,new this(1/0);t=n}return Yn=!0,t.sqrt()}function ue(r){return r instanceof Ae||r&&r.toStringTag===it||!1}function oe(r){return new this(r).ln()}function ae(r,n){return new this(r).log(n)}function se(r){return new this(r).log(2)}function ce(r){return new this(r).log(10)}function le(){return kt(this,arguments,-1)}function fe(){return kt(this,arguments,1)}function pe(r,n){return new this(r).mod(n)}function ve(r,n){return new this(r).mul(n)}function _e(r,n){return new this(r).pow(n)}function de(r){var n,t,e,i,u=0,o=new this(1),a=[];if(void 0===r?r=this.precision:ht(r,1,Vn),e=Math.ceil(r/7),this.crypto)if(crypto.getRandomValues)for(n=crypto.getRandomValues(new Uint32Array(e));u<e;)(i=n[u])>=429e7?n[u]=crypto.getRandomValues(new Uint32Array(1))[0]:a[u++]=i%1e7;else{if(!crypto.randomBytes)throw Error(et);for(n=crypto.randomBytes(e*=4);u<e;)(i=n[u]+(n[u+1]<<8)+(n[u+2]<<16)+((127&n[u+3])<<24))>=214e7?crypto.randomBytes(4).copy(n,u):(a.push(i%1e7),u+=4);u=e/4}else for(;u<e;)a[u++]=1e7*Math.random()|0;for(r%=7,(e=a[--u])&&r&&(i=ot(10,7-r),a[u]=(e/i|0)*i);0===a[u];u--)a.pop();if(u<0)t=0,a=[0];else{for(t=-1;0===a[0];t-=7)a.shift();for(e=1,i=a[0];i>=10;i/=10)e++;e<7&&(t-=7-e)}return o.e=t,o.d=a,o}function he(r){return yt(r=new this(r),r.e+1,this.rounding)}function ge(r){return(r=new this(r)).d?r.d[0]?r.s:0*r.s:r.s||NaN}function me(r){return new this(r).sin()}function we(r){return new this(r).sinh()}function ye(r){return new this(r).sqrt()}function xe(r,n){return new this(r).sub(n)}function be(){var r=0,n=arguments,t=new this(n[r]);for(Yn=!1;t.s&&++r<n.length;)t=t.plus(n[r]);return Yn=!0,yt(t,this.precision,this.rounding)}function Se(r){return new this(r).tan()}function Ne(r){return new this(r).tanh()}function Ee(r){return yt(r=new this(r),r.e+1,1)}_t[Symbol.for("nodejs.util.inspect.custom")]=_t.toString,_t[Symbol.toStringTag]="Decimal";var Ae=_t.constructor=function r(n){var t,e,i;function u(r){var n,t,e,i=this;if(!(i instanceof u))return new u(r);if(i.constructor=u,ue(r))return i.s=r.s,void(Yn?!r.d||r.e>u.maxE?(i.e=NaN,i.d=null):r.e<u.minE?(i.e=0,i.d=[0]):(i.e=r.e,i.d=r.d.slice()):(i.e=r.e,i.d=r.d?r.d.slice():r.d));if("number"===(e=p(r))){if(0===r)return i.s=1/r<0?-1:1,i.e=0,void(i.d=[0]);if(r<0?(r=-r,i.s=-1):i.s=1,r===~~r&&r<1e7){for(n=0,t=r;t>=10;t/=10)n++;return void(Yn?n>u.maxE?(i.e=NaN,i.d=null):n<u.minE?(i.e=0,i.d=[0]):(i.e=n,i.d=[r]):(i.e=n,i.d=[r]))}return 0*r!=0?(r||(i.s=NaN),i.e=NaN,void(i.d=null)):Wt(i,r.toString())}if("string"===e)return 45===(t=r.charCodeAt(0))?(r=r.slice(1),i.s=-1):(43===t&&(r=r.slice(1)),i.s=1),lt.test(r)?Wt(i,r):Pt(i,r);if("bigint"===e)return r<0?(r=-r,i.s=-1):i.s=1,Wt(i,r.toString());throw Error(nt+r)}if(u.prototype=_t,u.ROUND_UP=0,u.ROUND_DOWN=1,u.ROUND_CEIL=2,u.ROUND_FLOOR=3,u.ROUND_HALF_UP=4,u.ROUND_HALF_DOWN=5,u.ROUND_HALF_EVEN=6,u.ROUND_HALF_CEIL=7,u.ROUND_HALF_FLOOR=8,u.EUCLID=9,u.config=u.set=Xt,u.clone=r,u.isDecimal=ue,u.abs=$t,u.acos=Ut,u.acosh=Rt,u.add=Ct,u.asin=Bt,u.asinh=Lt,u.atan=Ht,u.atanh=Gt,u.atan2=Vt,u.cbrt=Kt,u.ceil=Jt,u.clamp=Qt,u.cos=Yt,u.cosh=re,u.div=ne,u.exp=te,u.floor=ee,u.hypot=ie,u.ln=oe,u.log=ae,u.log10=ce,u.log2=se,u.max=le,u.min=fe,u.mod=pe,u.mul=ve,u.pow=_e,u.random=de,u.round=he,u.sign=ge,u.sin=me,u.sinh=we,u.sqrt=ye,u.sub=xe,u.sum=be,u.tan=Se,u.tanh=Ne,u.trunc=Ee,void 0===n&&(n={}),n&&!0!==n.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<i.length;)n.hasOwnProperty(e=i[t++])||(n[e]=this[e]);return u.config(n),u}(Xn);Jn=new Ae(Jn),Qn=new Ae(Qn);var je=new Map;function Oe(){je.clear();var r=Tn("_fmt_groups")||{};for(var n in r){var t=r[n];if("string"==typeof t)try{var e=dn(t,null);je.set(n,e)}catch(r){console.warn('Failed to parse format group "'.concat(n,'":'),r)}}}function ke(r,n){if(!r||0===r.length)return r;if(!r.some(function(r){return r.type===V}))return r;for(var t=[],e=r.has_var||!1,u=0;u<r.length;u++){var o,a=r[u];if(a.type===V){var s=a.group_name;if(s){var c=je.get(s);if(null!==(o=c)&&void 0!==o&&o.has_var){var l=(Tn("_fmt_groups")||{})[s];try{c=dn(l,n)}catch(r){console.warn('Failed to parse format group "'.concat(s,'":'),r);continue}}c?(t.push.apply(t,f(c)),c.has_var&&(e=!0)):"undefined"!=typeof console&&console.warn&&console.warn('Format group "'.concat(s,'" not found, ignoring.'))}}else t.push(a)}var p=function(r){if(!r||0===r.length)return[];var n={mantissa:["number","var"],round:["round"],thousands:["comma","thousands"],sign:["plus"],percent:["percent"],scientific:["scientific"],fraction:["fraction"],volume:["volume"],integer_padding:["integer_padding"],range_clamp:["range_clamp"],unit:["unit_after","unit_before","unit_middle","unit_hide","unit_default"]},t={};for(var e in n){var u,o=i(n[e]);try{for(o.s();!(u=o.n()).done;)t[u.value]=e}catch(r){o.e(r)}finally{o.f()}}var a=new Map,s=[],c={exact:null,min:null,max:null};function l(r,n){var t=r.length>0?[].concat(f(r),[n]):n,e=r.length>0?r[r.length-1].value:"=";if(">="===e||">"===e?(c.exact=null,c.min=t):"<="===e||"<"===e?(c.exact=null,c.max=t):(c.exact=t,c.min=null,c.max=null),c.exact)a.set("mantissa",c.exact);else{for(var i=[],u=0,o=[c.min,c.max];u<o.length;u++){var s=o[u];Array.isArray(s)?i.push.apply(i,f(s)):s&&i.push(s)}a.set("mantissa",i)}}for(var p=0;p<r.length;p++){var v=r[p],_=v.type;if("symbol"!==_)if(s.length>0&&("number"===_||"var"===_))l(s,v),s=[];else{if(s.length>0){var d,h=i(s);try{for(h.s();!(d=h.n()).done;){var g=d.value,m="symbol_".concat(a.size);a.set(m,g)}}catch(r){h.e(r)}finally{h.f()}s=[]}var w=t[_];if(w)"mantissa"===w?l([],v):a.set(w,v);else{var y="".concat(_,"_").concat(a.size);a.set(y,v)}}else s.push(v)}if(s.length>0){var x,b=i(s);try{for(b.s();!(x=b.n()).done;){var S=x.value,N="symbol_".concat(a.size);a.set(N,S)}}catch(r){b.e(r)}finally{b.f()}}var E,A=[],j=i(a.values());try{for(j.s();!(E=j.n()).done;){var O=E.value;Array.isArray(O)?A.push.apply(A,f(O)):A.push(O)}}catch(r){j.e(r)}finally{j.f()}return A}(t);return e&&(p.has_var=!0),p}Fn("_fmt_groups",function(){Oe()}),Oe();var Fe=["","K","M","B","T"],qe={sep:",",point:".",grouping:[3],min_len:0,point_group:!1,fn:null},Me={en:{sep:",",point:".",grouping:[3]},eu:{sep:".",point:",",grouping:[3]},swiss:{sep:"'",point:".",grouping:[3]},space:{sep:" ",point:".",grouping:[3]},fr:{sep:" ",point:",",grouping:[3]},indian:{sep:",",point:".",grouping:[3,2]},wan:{sep:",",point:".",grouping:[4]}};function We(r){if(!r)return null;var n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})._thousands||{};if(n[r])return a(a({},qe),n[r]);var t=Tn("_thousands")||{};return t[r]?a(a({},qe),t[r]):Me[r]?a(a({},qe),Me[r]):null}function Pe(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=a(a({},qe),n);if(t.fn&&"function"==typeof t.fn){var e=r.startsWith("-"),i=r.startsWith("+"),u="",o=r;(e||i)&&(u=r[0],o=r.slice(1));var s=o.split("."),c={int_part:s[0],dec_part:s[1]||null,sign:u,options:t._options||{}};return t.fn(r,c)}var l=r.replace(/^[+-]/,"").split(".")[0].length;if(t.min_len>0&&l<t.min_len)return"."!==t.point?r.replace(".",t.point):r;var f=r.startsWith("-"),p=r.startsWith("+"),v="",_=r;(f||p)&&(v=r[0],_=r.slice(1));var d=_.split("."),h=d[0],g=d[1];h=function(r,n,t){if(!r||0===r.length)return r;if(!Array.isArray(n)||0===n.length||n.some(function(r){return!Number.isInteger(r)||r<=0}))return r;var e=[],i=r.length,u=0;for(;i>0;){var o=n[Math.min(u,n.length-1)],a=Math.max(0,i-o);e.push(r.slice(a,i)),i=a,u++}return e.reverse().join(t)}(h,t.grouping,t.sep),g&&t.point_group&&(g=function(r,n,t){if(!r||0===r.length)return r;if(!Array.isArray(n)||0===n.length||n.some(function(r){return!Number.isInteger(r)||r<=0}))return r;var e=[],i=0,u=0;for(;i<r.length;){var o=n[Math.min(u,n.length-1)],a=Math.min(r.length,i+o);e.push(r.slice(i,a)),i=a,u++}return e.join(t)}(g,t.grouping,t.sep));var m=v+h;return void 0!==g?m+=t.point+g:t.point,m}var ze={en:{symbols:["","K","M","B","T"],step:1e3},cn:{symbols:["","千","百万","十亿","万亿"],step:1e3},wan:{symbols:["","万","亿","万亿"],step:1e4},storage:{symbols:["B","KB","MB","GB","TB"],step:1024},indian:{symbols:["","K","L","Cr"],step:[1e3,100,100]}};function Ie(r,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},e=t._compact_preset,i=t._current_unit,u=Fe,o=1e3,a=null;if(t._compact_symbols||t._compact_step)u=t._compact_symbols&&t._compact_symbols.length>0?t._compact_symbols:Fe,o=t._compact_step||1e3;else if(e){var s=(Tn("_compact")||{})[e]||ze[e];s&&("function"==typeof s?a=s:Array.isArray(s)?(u=s,o=1e3):(u=s.symbols||u,o=void 0!==s.step?s.step:o))}else if(i){var c=Tn("_unit_compact_map")||{},l=!1;if(c&&c[i]){var f=c[i],v=(Tn("_compact")||{})[f]||ze[f];v&&(l=!0,"function"==typeof v?a=v:Array.isArray(v)?(u=v,o=1e3):(u=v.symbols||u,o=void 0!==v.step?v.step:o))}if(!l){var _=Tn("_compact_default");if(_){var d=(Tn("_compact")||{})[_]||ze[_];d&&("function"==typeof d?a=d:Array.isArray(d)?(u=d,o=1e3):(u=d.symbols||u,o=void 0!==d.step?d.step:o))}}}else{var h=Tn("_compact_default");if(h){var g=(Tn("_compact")||{})[h]||ze[h];g&&("function"==typeof g?a=g:Array.isArray(g)?(u=g,o=1e3):(u=g.symbols||u,o=void 0!==g.step?g.step:o))}}if(a){var m=a(r,{decimals:n,options:t,current_unit:i});return"object"===p(m)&&null!==m?{sign:m.sign||"",number:m.number||"0",unit:m.unit||"",formatted:m.formatted||(m.sign||"")+(m.number||"0")+(m.unit||"")}:"string"==typeof m?{sign:"",number:m,unit:"",formatted:m}:{sign:"",number:r,unit:"",formatted:r}}var w,y=r.startsWith("-"),x=r.startsWith("+"),b="",S=r;(y||x)&&(b=r[0],S=r.slice(1));for(var N=new Ae(S),E=0,A=Array.isArray(o);E<u.length-1;){var j=A?o[E]||o[o.length-1]:o;if(!N.gte(j))break;N=N.div(j),E++}switch(t._round||"~-"){case"~5":w=Ae.ROUND_HALF_UP;break;case"~6":w=Ae.ROUND_HALF_EVEN;break;case"~+":w=Ae.ROUND_UP;break;default:w=Ae.ROUND_DOWN}var O=N.toFixed(n,w);return O.includes(".")&&(O=O.replace(/\.?0+$/,"")),{sign:b,number:O,unit:u[E],formatted:b+O+u[E]}}function Te(r,n){if(n<=0)return r;if(n>1e4)throw new Error("整数补零位数(".concat(n,")超出安全上限 ").concat(1e4));var t=r.startsWith("-"),e=r.startsWith("+"),i="",u=r;(t||e)&&(i=r[0],u=r.slice(1));var o=u.split("."),a=o[0],s=o[1];a.length<n&&(a="0".repeat(n-a.length)+a);var c=i+a;return void 0!==s&&(c+="."+s),c}function De(r,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=ke(n,t._fill_data||t);var e="";if("undefined"===(e=Ae.isDecimal(r)?r.toFixed():"string"==typeof r?r:r.toString())||"NaN"===e)return[void 0,{}];var u=function(r){return r._unit_convert_out||null}(t),o=Tn("_unit_position_map")||{},s=t._recognized_unit||null,c=function(r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!r)return null;var e,u=i(r);try{for(u.s();!(e=u.n()).done;){var o=e.value;if("unit_after"===o.type||"unit_before"===o.type||"unit_middle"===o.type){var a=o.unit;if(o.use_default&&!a&&!(a=t)){var s=Tn("_unit_default_out");a=Array.isArray(s)?s[0]:s}return{output_unit:a,input_unit:o.input_unit,position:"unit_after"===o.type?"after":"unit_before"===o.type?"before":"middle",show_unit:!0,keep_recognized:o.use_default}}if("unit_hide"===o.type)return{output_unit:o.unit,input_unit:o.input_unit,position:null,show_unit:!1};if("unit_default"===o.type){var c=n[o.unit]||Tn("_unit_default_position")||"after";return{output_unit:o.unit,input_unit:o.input_unit,position:c,show_unit:!0}}if("to-number-string"===o.type)return o.output_unit?{output_unit:o.output_unit,input_unit:o.input_unit,position:null,show_unit:!1}:{output_unit:null,input_unit:null,position:null,show_unit:!1,no_conversion:!0}}}catch(r){u.e(r)}finally{u.f()}return null}(n,t,o,s),l=null,f=null,v=!1,_=!1;if(c){var d=c.output_unit,h=c.input_unit,g=c.position,m=c.show_unit,w=c.no_conversion,y=c.keep_recognized;if(!w&&u){var x=y&&s?s:d||s||Tn("_unit_default_out");if(x){var b=function(r,n,t,e){if(!t||!r)return null;var u=t[r];if(!u)return null;if(n){var o=u[n];return void 0!==o?{rule:o,input_unit:n}:null}if(e){var a,s=i(Array.isArray(e)?e:[e]);try{for(s.s();!(a=s.n()).done;){var c=a.value;if(void 0!==u[c])return{rule:u[c],input_unit:c}}}catch(r){s.e(r)}finally{s.f()}}var l=Object.keys(u).filter(function(r){return!r.startsWith("_")});return 1===l.length?{rule:u[l[0]],input_unit:l[0]}:null}(x,h||s||null,u,Tn("_unit_default_in"));b&&(e=function(r,n,t,e){if(null==n)return r;var i=new Ae(r);return"number"==typeof n?i.times(n).toFixed():"function"==typeof n?String(n(Number(r),t,e)):"object"===p(n)?n.fn&&"function"==typeof n.fn?String(n.fn(Number(r),t,e)):(void 0!==n.mul?i=i.times(n.mul):void 0!==n.div&&(i=i.div(n.div)),void 0!==n.plus?i=i.plus(n.plus):void 0!==n.minus?i=i.minus(n.minus):void 0===n.mul&&void 0===n.div&&(void 0!==n.add?i=i.plus(n.add):void 0!==n.sub&&(i=i.minus(n.sub))),i.toFixed()):r}(e,b.rule,b.input_unit,x),l=x,_=!0)}}m?(y&&s?l=s:l||(l=d||s),f=g,v=!0,_=!0):w&&(_=!0)}else s&&(l=s,f=o[s]||Tn("_unit_default_position")||"after",v=!0,_=!0);var S={mantissa:null,mantissa_type:null,mantissa_min:null,mantissa_max:null,thousands:!1,thousands_preset:null,sign:!1,round:"~-",scientific:!1,fraction:!1,percent:!1,to_number:!1,to_number_string:!1,integer_padding:null,compact:!1,compact_preset:null,unit_format:null,unit_value:null,unit_input:null,range_clamp_min:null,range_clamp_max:null},N=[],E=[];n.forEach(function(r,n){"symbol"===r.type?N.push({value:r.value,index:n}):"number"!==r.type&&"var"!==r.type||E.push({value:"var"===r.type?r.real_value:r.value,index:n})});var A=N.find(function(r){return">="===r.value||">"===r.value}),j=N.find(function(r){return"<="===r.value||"<"===r.value});if(A&&j)for(var O=function(){var r=N[k],n=E.find(function(n){return n.index>r.index});n&&(">="===r.value||">"===r.value?S.mantissa_min=+n.value:"<="!==r.value&&"<"!==r.value||(S.mantissa_max=+n.value))},k=0;k<N.length;k++)O();if(n.forEach(function(r){var n=r.type;if("symbol"===n){if(![">=","<=","=","<",">"].includes(r.value))throw new Error("错误的格式化参数:",r.value);A&&j||(S.mantissa_type=r.value)}else if("to-number"===n)S.to_number=!0;else if("to-number-string"===n)S.to_number_string=!0;else if("comma"===n)S.thousands=!0;else if("number"===n)A&&j||(S.mantissa=r.value);else if("var"===n)A&&j||(S.mantissa=r.real_value);else if("plus"===n)S.sign=!0;else if("round"===n)S.round=r.value;else if("fraction"===n)S.fraction=!0;else if("scientific"===n)S.scientific=!0;else if("percent"===n)S.percent=!0;else if("integer_padding"===n)S.integer_padding=void 0!==r.real_value?+r.real_value:+r.value;else if("compact"===n)S.compact=!0,r.preset&&(S.compact_preset=r.preset);else if("unit_after"===n)S.unit_format="after",S.unit_value=r.unit,S.unit_input=r.input_unit;else if("unit_before"===n)S.unit_format="before",S.unit_value=r.unit,S.unit_input=r.input_unit;else if("unit_middle"===n)S.unit_format="middle",S.unit_value=r.unit,S.unit_input=r.input_unit;else if("unit_hide"===n)S.unit_format=null,S.unit_value=r.unit,S.unit_input=r.input_unit;else if("unit_default"===n){var t=Tn("_unit_default_position")||"after";S.unit_format=t,S.unit_value=r.unit,S.unit_input=r.input_unit}else if("thousands"===n)S.thousands=!0,S.thousands_preset=r.preset;else{if("range_clamp"!==n)throw new Error("错误的fmt Token");S.range_clamp_min=r.min,S.range_clamp_max=r.max}}),null!==S.range_clamp_min||null!==S.range_clamp_max){var F=new Ae(e);if(null!==S.range_clamp_min){var q=new Ae(S.range_clamp_min);F.lt(q)&&(F=q)}if(null!==S.range_clamp_max){var M=new Ae(S.range_clamp_max);F.gt(M)&&(F=M)}e=F.toFixed()}if(S.to_number){var W=on(e,S.mantissa_type,S.mantissa,S.round);return S.integer_padding&&(W=Te(W,S.integer_padding)),[+W,S]}if(S.scientific){var P=new Ae(e).toExponential();return[S.sign&&!P.startsWith("-")?"+"+P:P,S]}if(S.fraction){var z=new Ae(e).toFraction(),I=z[0].toString()+"/"+z[1].toString();return[S.sign&&!I.startsWith("-")?"+"+I:I,S]}if(S.compact){var T=Ie(e,null!==S.mantissa?+S.mantissa:2,a(a({},t),{},{_compact_preset:S.compact_preset,_current_unit:l,_round:S.round})),D=T.sign,Z=T.unit;e=T.number,S._compact_formatted=!0,S._compact_sign=D,S._compact_unit_suffix=Z}if(S.percent&&(e=new Ae(e).times(100).toFixed()),null!==S.mantissa_min&&null!==S.mantissa_max){var $=e.includes(".")?e.split(".")[1].length:0;$<S.mantissa_min?e=on(e,">=",S.mantissa_min,S.round):$>S.mantissa_max?e=on(e,"<=",S.mantissa_max,S.round):e.includes(".")&&(e=e.replace(/0*$/,"").replace(/\.$/,""))}else null===S.mantissa?e.includes(".")&&(e=e.replace(/0*$/,"")):S._compact_formatted||(e=on(e,S.mantissa_type,S.mantissa,S.round));if(S.integer_padding&&(e=Te(e,S.integer_padding)),S.thousands){var U=null;if(S.thousands_preset)U=We(S.thousands_preset,t);else if(l){var R=(Tn("_unit_thousands_map")||{})[l];R&&(U=We(R,t))}if(!U){var C=Tn("_thousands_default");C&&(U=We(C,t))}U?(U._options=t,e=Pe(e,U)):e=sn(e)}return S._compact_formatted&&(S.sign&&!S._compact_sign&&(e="+"+e),e=S._compact_sign+e+S._compact_unit_suffix),S.sign&&!S._compact_formatted&&(S.to_number=!1,e.startsWith("-")||(e="+"+e)),S.percent&&(e+="%"),v&&l&&f&&(e=function(r,n,t){if(!n)return r;var e=r.startsWith("-"),i=r.startsWith("+"),u="",o=r;switch((e||i)&&(u=r[0],o=r.slice(1)),t){case"after":default:return u+o+n;case"before":return n+u+o;case"middle":return u?u+n+o:n+o}}(e,l,f,S.sign)),S.unit_handled=_,[e,S]}var Ze=null;function $e(r){var n=String(r).match(/(\d+)\.(\d+)\.(\d+)/);return n?[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10)]:null}function Ue(r,n){var t=$e(r),e=$e(n);return!(!t||!e)&&(t[0]>e[0]||t[0]===e[0]&&t[1]>e[1]||t[0]===e[0]&&t[1]===e[1]&&t[2]>e[2])}function Re(r){return"string"!=typeof r?[]:(r.match(/["']\d+\.\d+\.\d+[^"']*["']/g)||[]).map(function(r){return r.slice(1,-1)})}function Ce(){return Be.apply(this,arguments)}function Be(){return(Be=e(s().m(function r(){var n,t,e,i,u;return s().w(function(r){for(;;)switch(r.p=r.n){case 0:n=["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"],t=0;case 1:if(!(t<n.length)){r.n=9;break}return r.p=2,r.n=3,fetch(n[t]);case 3:if((e=r.v)&&e.ok){r.n=4;break}return r.a(3,8);case 4:return r.n=5,e.text();case 5:if(i=r.v,!((u=Re(i)).length>0)){r.n=6;break}return r.a(2,u[u.length-1]);case 6:r.n=8;break;case 7:return r.p=7,r.v,r.a(3,8);case 8:t++,r.n=1;break;case 9:return r.a(2,null)}},r,null,[[2,7]])}))).apply(this,arguments)}function Le(){return(Le=e(s().m(function r(){var n;return s().w(function(r){for(;;)switch(r.n){case 0:if("function"==typeof fetch){r.n=1;break}return r.a(2);case 1:return r.n=2,Ce();case 2:if(n=r.v){r.n=3;break}return r.a(2);case 3:Ue(n,_)&&console.warn("a-calc has a new version:",n);case 4:return r.a(2)}},r)}))).apply(this,arguments)}var He=new Set(["+","-","*","/","%","**","//"]);function Ge(r,n,t){if(Number.isNaN(Number(n)))if("-"===n||"+"===n)r.push({type:"operator",value:n});else if(He.has(n))r.push({type:"operator",value:n});else if(t._unit&&/^[+-]?\d/.test(n)){var e,i=en(n),u=i.num,o=i.unit;if(void 0===o)r.push({type:"number",value:u,real_value:u,has_unit:!1});else t.has_unit=!0,null!==(e=t.unit_str)&&void 0!==e||(t.unit_str=o),r.push({type:"number",value:u,real_value:u,has_unit:!0,unit:o})}else if(b.has(n[0])){t.has_var=!0;var a=cn(t.fill_data,n);if(t._unit){var s,c=en(a),l=c.num,f=c.unit;if(void 0===f)r.push({type:"var",value:n,real_value:l,has_unit:!1});else t.has_unit=!0,null!==(s=t.unit_str)&&void 0!==s||(t.unit_str=f),r.push({type:"var",value:n,real_value:l,has_unit:!0,unit:f})}else r.push({type:"var",value:n,real_value:a,has_unit:!1})}else{if(!/^[+-]?\d/.test(n))throw new Error("无法识别的标识符:".concat(n));var p=n.indexOf("e");-1!==p&&/^\d+$/.test(n.slice(p+1))&&r.push({type:"number",value:n,real_value:n,has_unit:!1})}else r.push({type:"number",value:n,real_value:n,has_unit:!1})}function Ve(r){return r instanceof Ae?r:new Ae("boolean"==typeof r?r?1:0:r)}function Ke(r){return r instanceof Ae}function Je(r,n,t){if(void 0===r||void 0===n)throw new Error("无效的操作数对:v1:".concat(r,", v2:").concat(n));var e=Ve(r),i=Ve(n);switch(t){case">":return e.gt(i);case"<":return e.lt(i);case">=":return e.gte(i);case"<=":return e.lte(i);case"==":return e.eq(i);case"!=":return!e.eq(i);default:throw new Error("未知的比较运算符: ".concat(t))}}function Qe(r){if("boolean"==typeof r)return r;if(r instanceof Ae)return!r.isZero();if("number"==typeof r)return 0!==r;if("string"==typeof r){var n=r.trim();if(""===n)return!1;try{return!new Ae(n).isZero()}catch(r){return!0}}return Boolean(r)}function Xe(r){return!Qe(r)}var Ye=[];function ri(){return Ye.length>0?Ye[Ye.length-1]:Tn("_angle_unit")}function ni(r,n){Ye.push(null!=r?r:Tn("_angle_unit"));try{return n()}finally{Ye.pop()}}function ti(r){return"rad"===ri()?r:new Ae(r).times(Ae.acos(-1)).div(180)}function ei(r){return"rad"===ri()?r:new Ae(r).times(180).div(Ae.acos(-1))}var ii={0:new Ae(0),30:new Ae("0.5"),45:new Ae(2).sqrt().div(2),60:new Ae(3).sqrt().div(2),90:new Ae(1),180:new Ae(0),270:new Ae(-1),360:new Ae(0)},ui={0:new Ae(1),30:new Ae(3).sqrt().div(2),45:new Ae(2).sqrt().div(2),60:new Ae("0.5"),90:new Ae(0),180:new Ae(-1),270:new Ae(0),360:new Ae(1)},oi={0:new Ae(0),30:new Ae(3).sqrt().div(3),45:new Ae(1),60:new Ae(3).sqrt(),180:new Ae(0),360:new Ae(0)};function ai(r){var n=new Ae(r).mod(360);return n.isNegative()?n.plus(360):n}var si={sin:function(r){if("deg"===ri()){var n=ai(r).toNumber();if(void 0!==ii[n])return ii[n];if(n>180){var t=ii[360-n];if(void 0!==t)return t.negated()}if(n>90&&n<=180){var e=ii[180-n];if(void 0!==e)return e}}var i=ti(r);return Ae.sin(i)},cos:function(r){if("deg"===ri()){var n=ai(r).toNumber();if(void 0!==ui[n])return ui[n];if(n>180){var t=ui[360-n];if(void 0!==t)return t}if(n>90&&n<=180){var e=ui[180-n];if(void 0!==e)return e.negated()}}var i=ti(r);return Ae.cos(i)},tan:function(r){if("deg"===ri()){var n=ai(r).toNumber();if(90===n||270===n)throw new Error("tan() undefined at 90° and 270°");if(void 0!==oi[n])return oi[n]}var t=ti(r);return Ae.tan(t)},asin:function(r){return ei(Ae.asin(r))},acos:function(r){return ei(Ae.acos(r))},atan:function(r){return ei(Ae.atan(r))},atan2:function(r,n){return ei(Ae.atan2(r,n))},sinh:function(r){return Ae.sinh(r)},cosh:function(r){return Ae.cosh(r)},tanh:function(r){return Ae.tanh(r)},asinh:function(r){return Ae.asinh(r)},acosh:function(r){return Ae.acosh(r)},atanh:function(r){return Ae.atanh(r)},exp:function(r){return Ae.exp(r)},log:function(r){return Ae.ln(r)},ln:function(r){return Ae.ln(r)},log10:function(r){return Ae.log10(r)},log2:function(r){return Ae.log2(r)},sqrt:function(r){return new Ae(r).sqrt()},cbrt:function(r){return new Ae(r).cbrt()},pow:function(r,n){return new Ae(r).pow(n)},floor:function(r){return new Ae(r).floor()},ceil:function(r){return new Ae(r).ceil()},round:function(r){return new Ae(r).round()},trunc:function(r){return new Ae(r).trunc()},abs:function(r){return new Ae(r).abs()},sign:function(r){var n=new Ae(r);return n.isZero()?new Ae(0):n.isPositive()?new Ae(1):new Ae(-1)},max:function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];if(0===n.length)throw new Error("max() requires at least one argument");return n.reduce(function(r,n){var t=new Ae(n);return t.gt(r)?t:r},new Ae(n[0]))},min:function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];if(0===n.length)throw new Error("min() requires at least one argument");return n.reduce(function(r,n){var t=new Ae(n);return t.lt(r)?t:r},new Ae(n[0]))},clamp:function(r,n,t){var e=new Ae(r),i=new Ae(n),u=new Ae(t);return e.lt(i)?i:e.gt(u)?u:e},random:function(){return new Ae(Math.random())},pi:function(){return Ae.acos(-1)},e:function(){return Ae.exp(1)},if:function(r,n,t){return Qe(r)?n:t}};In({_builtin_functions:si});var ci=Object.prototype.hasOwnProperty;function li(r,n){return n in Object.prototype&&!ci.call(r,n)}function fi(r,n){if(n){var t,e=i(Array.isArray(n)?n:[n]);try{for(e.s();!(t=e.n()).done;){var u=t.value;if(u&&"function"==typeof u[r]&&!li(u,r))return u[r]}}catch(r){e.e(r)}finally{e.f()}}var o=Tn("_builtin_functions");return o&&ci.call(o,r)&&"function"==typeof o[r]?o[r]:null}function pi(r){return rr.has(r)}function vi(r){var n;return null!==(n=tr[r])&&void 0!==n?n:-1}function _i(r,n,t){if(pi(t))return Je(r,n,t);if(function(r){return nr.has(r)}(t))return function(r,n,t){var e=Qe(r);switch(t){case"&&":return!!e&&Qe(n);case"||":return!!e||Qe(n);default:throw new Error("未知的逻辑运算符: ".concat(t))}}(r,n,t);if(function(r){return["+","-","*","/","%","**","//"].includes(r)}(t))return function(r,n,t){if(void 0===r||void 0===n)throw new Error("无效的操作数对:v1:".concat(r,", v2:").concat(n));var e=Ve(r),i=Ve(n);switch(t){case"+":return e.plus(i);case"-":return e.minus(i);case"*":return e.times(i);case"/":return e.div(i);case"%":return e.mod(i);case"**":if(!e.isZero()&&!e.abs().eq(1)&&i.isFinite()&&!i.isZero()&&i.times(e.abs().log()).abs().gt(1e6))throw new Error("幂运算结果数量级过大,超出安全上限");return e.pow(i);case"//":return e.divToInt(i);default:throw new Error("未知的运算符: ".concat(t))}}(r,n,t);throw new Error("未知的运算符: ".concat(t))}function di(r,n,t){var e=r.slice(n,t);return e.has_var=r.has_var,e.has_unit=r.has_unit,e.unit=r.unit,e._fill_data=r._fill_data,e._unit=r._unit,e._options=r._options,e}function hi(r){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.length,e=n;e<t;e++){var i=r[e];if("logical"===i.type||"ternary_question"===i.type||"ternary_colon"===i.type)return!0}return!1}function gi(r,n){for(var t=0,e=n;e<r.length;e++)if("("===r[e].value)t++;else if(")"===r[e].value&&0===--t)return e;return-1}function mi(r,n){for(var t=0,e=0;e<r.length;e++)if("("===r[e].value)t++;else if(")"===r[e].value)t--;else if(0===t&&r[e].value===n)return e;return-1}function wi(r){return"boolean"==typeof r?{type:"boolean",value:r}:"string"==typeof r?{type:"string",value:r}:{type:"number",value:String(r),real_value:r,has_unit:!1}}function yi(r){if(r.length>1&&"("===r[0].value){var n=gi(r,0);if(n===r.length-1&&hi(r,1,n))return yi(di(r,1,n))}var t=function(r){for(var n=0,t=-1,e=0,i=0;i<r.length;i++){var u=r[i].value;if("("!==u)if(")"!==u){if(0===n)if("?"===u)-1===t?t=i:e++;else if(":"===u&&-1!==t){if(0===e)return{question_index:t,colon_index:i};e--}}else n--;else n++}return null}(r);if(t){var e=yi(di(r,0,t.question_index));return yi(di(r,Qe(e)?t.question_index+1:t.colon_index+1,Qe(e)?t.colon_index:r.length))}var i=mi(r,"||");if(-1!==i)return!!Qe(yi(di(r,0,i)))||Qe(yi(di(r,i+1,r.length)));var u=mi(r,"&&");if(-1!==u)return!!Qe(yi(di(r,0,u)))&&Qe(yi(di(r,u+1,r.length)));for(var o=0;o<r.length;o++)if("("===r[o].value){var a=gi(r,o);if(-1===a)break;if(hi(r,o+1,a)){var s=yi(di(r,o+1,a)),c=di(r,0,o);return c.push(wi(s)),c.push.apply(c,f(r.slice(a+1))),yi(c)}o=a}return function(r){if(1===r.length){var n=r[0];if("number"===n.type||"var"===n.type||"fallback_var"===n.type)return"boolean"==typeof n.real_value?n.real_value:new Ae(n.real_value);if("boolean"===n.type)return n.value;if("string"===n.type)return n.value;if("function"===n.type){var t=n.value,e=n.fn||fi(t,r._fill_data);if(!e)throw new Error("未知的函数: ".concat(t));var i=n.args.map(function(n){var t=Bn(n,r._fill_data,r._unit,r._options);return t._fill_data=r._fill_data,t._unit=r._unit,t._options=r._options,xi(t)});return e.apply(void 0,f(i))}throw new Error("错误的表达式:".concat(n.value))}var u,o=[],a=[],s={active:!1,failed:!1,lastValue:null};function c(r,n,t){return pi(t)&&s.failed?(s.failed=!1,!1):_i(r,n,t)}for(var l=0,p=r.length;l<p;l++)if("number"!==(u=r[l]).type&&"var"!==u.type&&"fallback_var"!==u.type)if("boolean"!==u.type)if("string"!==u.type)if("function"!==u.type)if("logical_not"!==u.type)if("ternary_question"!==u.type&&"?"!==u.value)if("ternary_colon"!==u.type&&":"!==u.value)if("operator"!==u.type&&"comparison"!==u.type&&"logical"!==u.type)if("("!==u.value)if(")"!==u.value)"function_result"!==u.type||a.push(u.value);else for(;o.length>0;){var v=o.pop();if("("===v){if(o.length>0&&("-"===o[o.length-1]||"+"===o[o.length-1])){var _=o[o.length-1],d=o.length>1?o[o.length-2]:null;if(null===d&&1===a.length||"("===d&&1===a.length||["+","-","*","/","%","**","//","?",":"].includes(d))if("-"===_){o.pop();var h=a.pop();Ke(h)?a.push(h.negated()):"number"==typeof h?a.push(-h):"boolean"==typeof h?a.push(!h):a.push(new Ae(h).negated())}else"+"===_&&o.pop()}else{var g=a[a.length-2];if("-"===g){var m=a.pop();a.pop(),Ke(m)?a.push(m.negated()):"number"==typeof m?a.push(-m):"boolean"==typeof m?a.push(!m):a.push(new Ae(m).negated())}else if("+"===g){var w=a.pop();a.pop(),a.push(w)}}break}if("!"===v){var y=a.pop();a.push(Xe(y))}else if(":"===v&&o.length>0&&"?"===o[o.length-1]){var x=a.pop();o.pop();var b=a.pop(),S=a.pop();a.push(Qe(S)?b:x)}else{if("?"===v){o.push("?");break}var N=a.pop(),E=a.pop();a.push(c(E,N,v))}}else o.push("(");else{var A=u.value,j=vi(A);if(pi(A)&&s.active)for(;o.length>0;){var O=o[o.length-1];if("("===O||"?"===O)break;if(vi(O)<j)break;if(pi(O)){o.pop();var k=a.pop(),F=a.pop(),q=!s.failed&&Je(F,k,O);s.lastValue=k,q||(s.failed=!0),a.push(k);break}o.pop();var M=a.pop(),W=a.pop();a.push(c(W,M,O))}pi(A)?s.active=!0:s.active=!1;var P=o[o.length-1];if("("===P){o.push(A);continue}if(!o.length){o.push(A);continue}if("**"===A){o.push(A);continue}for(;o.length>0&&"("!==(P=o[o.length-1])&&"?"!==P;){var z=vi(P);if(z<j)break;if(z===j&&"**"===A)break;if("!"!==P&&a.length<2)break;if(o.pop(),"!"===P){var I=a.pop();a.push(Xe(I))}else{var T=a.pop(),D=a.pop();void 0!==D||"-"!==P&&"+"!==P?a.push(c(D,T,P)):"-"===P?Ke(T)?a.push(T.negated()):"number"==typeof T?a.push(-T):a.push(new Ae(T).negated()):a.push(T)}}o.push(A)}else{for(;o.length>0;){var Z=o[o.length-1];if("?"===Z)break;if("("===Z)break;if(":"===Z){if(o.length>1&&"?"===o[o.length-2]){o.pop(),o.pop();var $=a.pop(),U=a.pop(),R=a.pop();a.push(Qe(R)?U:$);continue}break}o.pop();var C=a.pop(),B=a.pop();a.push(c(B,C,Z))}o.push(":")}else{for(;o.length>0;){var L=o[o.length-1];if("("===L||"?"===L)break;if(vi(L)<=vi("?"))break;o.pop();var H=a.pop(),G=a.pop();a.push(c(G,H,L))}o.push("?")}else o.push("!");else{var V=u.value,K=u.fn||fi(V,r._fill_data);if(!K)throw new Error("未知的函数: ".concat(V));var J=u.args.map(function(n){var t=Bn(n,r._fill_data,r._unit,r._options);return t._fill_data=r._fill_data,t._unit=r._unit,t._options=r._options,xi(t)}),Q=K.apply(void 0,f(J));a.push(Q)}else a.push(u.value);else a.push(u.value);else a.push(u.real_value);for(;o.length>0;){var X=o.pop();if("!"===X){var Y=a.pop();a.push(Xe(Y))}else if(":"===X&&o.length>0&&"?"===o[o.length-1]){var rr=a.pop();o.pop();var nr=a.pop(),tr=a.pop();a.push(Qe(tr)?nr:rr)}else{if("?"===X)continue;var er=a.pop(),ir=a.pop();void 0!==ir||"-"!==X&&"+"!==X?a.push(c(ir,er,X)):"-"===X?Ke(er)?a.push(er.negated()):"number"==typeof er?a.push(-er):a.push(new Ae(er).negated()):a.push(er)}}if(1!==a.length)throw new Error("可能出现了错误的计算式");r.has_var||(r.calc_result=a[0]);return a[0]}(r)}function xi(r){var n=yi(r);return r.has_var||(r.calc_result=n),n}var bi=null;function Si(){if(!bi)throw new Error("calc function not registered for calc_sum");return bi}function Ni(r,n){if(!n)return r;var t=dn(n,null);return l(De(new Ae(r),t,{}),1)[0]}function Ei(r){if("boolean"==typeof r)return null;try{return new Ae(r)}catch(r){return null}}function Ai(r){var n=Zn(r);return{inner_expr:n.expr,fmt_str:n.fmt||void 0}}function ji(r,n){return new Ae(r).plus(n).toFixed()}function Oi(r,n){return new Ae(r).minus(n).toFixed()}function ki(r,n){return new Ae(r).times(n).toFixed()}function Fi(r,n){var t=new Ae(n);if(t.isZero()){var e=Tn("_error");if(void 0!==e)return e;throw new Error("Division by zero")}return new Ae(r).div(t).toFixed()}function qi(r,n){var t=new Ae(n);if(t.isZero()){var e=Tn("_error");if(void 0!==e)return e;throw new Error("Modulo by zero")}return new Ae(r).mod(t).toFixed()}function Mi(r,n){return new Ae(r).pow(n).toFixed()}function Wi(r,n){var t=new Ae(n);if(t.isZero()){var e=Tn("_error");if(void 0!==e)return e;throw new Error("Division by zero")}return new Ae(r).divToInt(t).toFixed()}function Pi(r){return new Ae(r).abs().toFixed()}function zi(r){return new Ae(r).neg().toFixed()}function Ii(r){return new Ae(r).sqrt().toFixed()}function Ti(r){return new Ae(r).cbrt().toFixed()}function Di(r){return new Ae(r).exp().toFixed()}function Zi(r){return new Ae(r).ln().toFixed()}function $i(r,n){return new Ae(r).log(n).toFixed()}function Ui(r){return new Ae(r).log(2).toFixed()}function Ri(r){return new Ae(r).log(10).toFixed()}function Ci(r){return new Ae(r).sin().toFixed()}function Bi(r){return new Ae(r).cos().toFixed()}function Li(r){return new Ae(r).tan().toFixed()}function Hi(r){return new Ae(r).asin().toFixed()}function Gi(r){return new Ae(r).acos().toFixed()}function Vi(r){return new Ae(r).atan().toFixed()}function Ki(r){return new Ae(r).sinh().toFixed()}function Ji(r){return new Ae(r).cosh().toFixed()}function Qi(r){return new Ae(r).tanh().toFixed()}function Xi(r){return new Ae(r).asinh().toFixed()}function Yi(r){return new Ae(r).acosh().toFixed()}function ru(r){return new Ae(r).atanh().toFixed()}function nu(r){return new Ae(r).floor().toFixed()}function tu(r){return new Ae(r).ceil().toFixed()}function eu(r){return new Ae(r).trunc().toFixed()}function iu(r){return new Ae(r).round().toFixed()}function uu(r,n){return Ae.max(r,n).toFixed()}function ou(r,n){return Ae.min(r,n).toFixed()}function au(r,n){return new Ae(r).cmp(n)}function su(r,n){return new Ae(r).eq(n)}function cu(r,n){return new Ae(r).lt(n)}function lu(r,n){return new Ae(r).gt(n)}function fu(r,n){return new Ae(r).lte(n)}function pu(r,n){return new Ae(r).gte(n)}var vu={add:ji,sub:Oi,mul:ki,div:Fi,mod:qi,pow:Mi,idiv:Wi,abs:Pi,neg:zi,sqrt:Ii,cbrt:Ti,exp:Di,ln:Zi,log:$i,log2:Ui,log10:Ri,sin:Ci,cos:Bi,tan:Li,asin:Hi,acos:Gi,atan:Vi,sinh:Ki,cosh:Ji,tanh:Qi,asinh:Xi,acosh:Yi,atanh:ru,floor:nu,ceil:tu,trunc:eu,round:iu,max:uu,min:ou,compare:au,eq:su,lt:cu,gt:lu,lte:fu,gte:pu},_u=ji,du=Oi,hu=ki,gu=Fi,mu=qi,wu=Mi,yu=Wi,xu=Pi,bu=zi,Su=Ii,Nu=Ti,Eu=Di,Au=Zi,ju=$i,Ou=Ui,ku=Ri,Fu=Ci,qu=Bi,Mu=Li,Wu=Hi,Pu=Gi,zu=Vi,Iu=Ki,Tu=Ji,Du=Qi,Zu=Xi,$u=Yi,Uu=ru,Ru=nu,Cu=tu,Bu=eu,Lu=iu,Hu=uu,Gu=ou,Vu=au,Ku=su,Ju=cu,Qu=lu,Xu=fu,Yu=pu,ro=1e6;function no(r){if(!Number.isSafeInteger(r))throw new RangeError("BigInt power must be a safe integer");if(r<=0)return 1n;if(r>ro)throw new RangeError("BigInt power exceeds the safe limit ".concat(ro));return BigInt("1"+"0".repeat(r))}function to(r){var n=String(r);if(n.includes("e")||n.includes("E"))return function(r){var n=r.toLowerCase().split("e"),t=l(n,2),e=t[0],i=t[1],u=parseInt(i,10),o=to(e),a=o.value,s=o.scale,c=s-u;if(c<0)return{value:a*no(-c),scale:0};return{value:a,scale:c}}(n);var t=n.startsWith("-"),e=l((t?n.slice(1):n).split("."),2),i=e[0],u=void 0===i?"0":i,o=e[1],a=void 0===o?"":o,s=a.length,c=(u+a).replace(/^0+/,"")||"0";return{value:BigInt(t?"-"+c:c),scale:s}}function eo(r,n){var t=r<0n,e=(t?-r:r).toString();if(n<=0)return(t?"-":"")+e+"0".repeat(-n);for(;e.length<=n;)e="0"+e;var i=e.slice(0,-n),u=e.slice(-n).replace(/0+$/,""),o=u?"".concat(i,".").concat(u):i;return t?"-"+o:o}function io(r,n){if(0n===r)return{value:0n,scale:0};for(;n>0&&r%10n==0n;)r/=10n,n--;return{value:r,scale:n}}function uo(r,n,t,e){return n>e?{a_val:r,b_val:t*=no(n-e),scale:n}:e>n?{a_val:r*=no(e-n),b_val:t,scale:e}:{a_val:r,b_val:t,scale:n}}function oo(r,n){var t="string"==typeof r?to(r):r,e="string"==typeof n?to(n):n;return io(t.value*e.value,t.scale+e.scale)}function ao(r,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20,e="string"==typeof r?to(r):r,i="string"==typeof n?to(n):n;if(0n===i.value)throw new Error("Division by zero");var u=no(t);return io(e.value*u/i.value,e.scale-i.scale+t)}function so(r,n){var t="string"==typeof r?to(r):r,e="bigint"==typeof n?n:BigInt(Math.floor(Number(n)));if(e<0n)return ao({value:1n,scale:0},so(t,-e));if(0n===e)return{value:1n,scale:0};if(1n===e)return t;for(var i={value:1n,scale:0},u=t,o=e;o>0n;)o%2n==1n&&(i=oo(i,u)),(o/=2n)>0n&&(u=oo(u,u));return io(i.value,i.scale)}function co(r,n){var t="string"==typeof r?to(r):r,e="string"==typeof n?to(n):n,i=uo(t.value,t.scale,e.value,e.scale),u=i.a_val,o=i.b_val;return u<o?-1:u>o?1:0}function lo(r,n){return co(r,n)<0}function fo(r,n){return co(r,n)>0}function po(r){var n="string"==typeof r?to(r):r;if(n.scale<=0)return{value:n.value*no(-n.scale),scale:0};var t=no(n.scale);return{value:n.value/t,scale:0}}function vo(r,n){var t=function(r,n){var t="string"==typeof r?to(r):r,e="string"==typeof n?to(n):n,i=uo(t.value,t.scale,e.value,e.scale);return io(i.a_val+i.b_val,i.scale)}(r,n);return eo(t.value,t.scale)}function _o(r,n){var t=function(r,n){var t="string"==typeof r?to(r):r,e="string"==typeof n?to(n):n,i=uo(t.value,t.scale,e.value,e.scale);return io(i.a_val-i.b_val,i.scale)}(r,n);return eo(t.value,t.scale)}function ho(r,n){var t=oo(r,n);return eo(t.value,t.scale)}function go(r,n){if(0n===to(n).value){var t=Tn("_error");if(void 0!==t)return t;throw new Error("Division by zero")}var e=ao(r,n,Tn("_div_precision")||20);return eo(e.value,e.scale)}function mo(r,n){if(0n===to(n).value){var t=Tn("_error");if(void 0!==t)return t;throw new Error("Modulo by zero")}var e=function(r,n){var t="string"==typeof r?to(r):r,e="string"==typeof n?to(n):n;if(0n===e.value)throw new Error("Modulo by zero");var i=uo(t.value,t.scale,e.value,e.scale);return io(i.a_val%i.b_val,i.scale)}(r,n);return eo(e.value,e.scale)}function wo(r,n){var t=Number(n);if(!Number.isInteger(t))return Mi(r,n);var e=so(r,t);return eo(e.value,e.scale)}function yo(r,n){if(0n===to(n).value){var t=Tn("_error");if(void 0!==t)return t;throw new Error("Division by zero")}var e=ao(r,n,Tn("_div_precision")||20),i=po({value:e.value,scale:e.scale});return eo(i.value,i.scale)}function xo(r){var n=function(r){var n="string"==typeof r?to(r):r;return{value:n.value<0n?-n.value:n.value,scale:n.scale}}(r);return eo(n.value,n.scale)}function bo(r){var n=function(r){var n="string"==typeof r?to(r):r;return{value:-n.value,scale:n.scale}}(r);return eo(n.value,n.scale)}function So(r){var n=function(r){var n="string"==typeof r?to(r):r;if(n.scale<=0)return{value:n.value*no(-n.scale),scale:0};var t=no(n.scale),e=n.value/t;return n.value<0n&&n.value%t!==0n&&(e-=1n),{value:e,scale:0}}(r);return eo(n.value,n.scale)}function No(r){var n=function(r){var n="string"==typeof r?to(r):r;if(n.scale<=0)return{value:n.value*no(-n.scale),scale:0};var t=no(n.scale),e=n.value/t;return n.value>0n&&n.value%t!==0n&&(e+=1n),{value:e,scale:0}}(r);return eo(n.value,n.scale)}function Eo(r){var n=po(r);return eo(n.value,n.scale)}function Ao(r){var n=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t="string"==typeof r?to(r):r,e=n;if(t.scale<=e){var i=e-t.scale;return{value:t.value*no(i),scale:e}}var u=no(t.scale-e),o=u/2n,a=t.value/u,s=t.value%u;return t.value>=0n?s>=o&&(a+=1n):-s>=o&&(a-=1n),io(a,e)}(r,0);return eo(n.value,n.scale)}function jo(r,n){var t=function(r,n){return fo(r,n)?"string"==typeof r?to(r):r:"string"==typeof n?to(n):n}(r,n);return eo(t.value,t.scale)}function Oo(r,n){var t=function(r,n){return lo(r,n)?"string"==typeof r?to(r):r:"string"==typeof n?to(n):n}(r,n);return eo(t.value,t.scale)}function ko(r,n){return co(r,n)}function Fo(r,n){return function(r,n){return 0===co(r,n)}(r,n)}function qo(r,n){return lo(r,n)}function Mo(r,n){return fo(r,n)}function Wo(r,n){return function(r,n){return co(r,n)<=0}(r,n)}function Po(r,n){return function(r,n){return co(r,n)>=0}(r,n)}var zo={add:vo,sub:_o,mul:ho,div:go,mod:mo,pow:wo,idiv:yo,abs:xo,neg:bo,floor:So,ceil:No,trunc:Eo,round:Ao,max:jo,min:Oo,compare:ko,eq:Fo,lt:qo,gt:Mo,lte:Wo,gte:Po,sqrt:Ii,cbrt:Ti,exp:Di,ln:Zi,log:$i,log2:Ui,log10:Ri,sin:Ci,cos:Bi,tan:Li,asin:Hi,acos:Gi,atan:Vi,sinh:Ki,cosh:Ji,tanh:Qi,asinh:Xi,acosh:Yi,atanh:ru},Io=vo,To=_o,Do=ho,Zo=go,$o=mo,Uo=wo,Ro=yo,Co=xo,Bo=bo,Lo=So,Ho=No,Go=Eo,Vo=Ao,Ko=jo,Jo=Oo,Qo=ko,Xo=Fo,Yo=qo,ra=Mo,na=Wo,ta=Po,ea=Ii,ia=Ti,ua=Di,oa=Zi,aa=$i,sa=Ui,ca=Ri,la=Ci,fa=Bi,pa=Li,va=Hi,_a=Gi,da=Vi,ha=Ki,ga=Ji,ma=Qi,wa=Xi,ya=Yi,xa=ru,ba=null,Sa=!1,Na=!1,Ea=[],Aa=null;function ja(r){return Oa.apply(this,arguments)}function Oa(){return(Oa=e(s().m(function r(n){var t,e,i,u;return s().w(function(r){for(;;)switch(r.p=r.n){case 0:if(!Sa){r.n=1;break}return r.a(2,ba);case 1:if(!Na){r.n=2;break}return r.a(2,new Promise(function(r,n){Ea.push({resolve:r,reject:n})}));case 2:return Na=!0,r.p=3,r.n=4,Promise.resolve().then(function(){return require("./wasm_calc.js")});case 4:if(t=r.v,e="undefined"!=typeof window,i="undefined"!=typeof process&&process.versions&&process.versions.node,!e){r.n=8;break}if(!n){r.n=6;break}return r.n=5,t.default(n);case 5:r.n=7;break;case 6:return r.n=7,t.default();case 7:case 9:case 16:r.n=18;break;case 8:if(!i){r.n=10;break}return r.n=9,ka(t);case 10:if("function"!=typeof globalThis.fetch){r.n=17;break}if(r.p=11,!n){r.n=13;break}return r.n=12,t.default(n);case 12:r.n=14;break;case 13:return r.n=14,t.default();case 14:r.n=16;break;case 15:return r.p=15,r.v,r.n=16,ka(t);case 17:throw new Error("Unsupported environment for WASM loading");case 18:return ba=t,Sa=!0,Pa(),Ea.forEach(function(r){return r.resolve(t)}),Ea=[],r.a(2,t);case 19:throw r.p=19,u=r.v,Na=!1,Ea.forEach(function(r){return r.reject(u)}),Ea=[],console.warn("WASM module failed to load, using Decimal fallback:",u),u;case 20:return r.a(2)}},r,null,[[11,15],[3,19]])}))).apply(this,arguments)}function ka(r){return Fa.apply(this,arguments)}function Fa(){return(Fa=e(s().m(function n(t){var e,i,u,o,a,c,l,f,p,v,_,d,h,g,m,w;return s().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.n=1,import("fs");case 1:return e=n.v,i=e.readFileSync,n.n=2,import("url");case 2:return u=n.v,o=u.fileURLToPath,n.n=3,import("path");case 3:a=n.v,c=a.dirname,l=a.join,f=o("undefined"==typeof document?require("url").pathToFileURL(__filename).href:r&&"SCRIPT"===r.tagName.toUpperCase()&&r.src||new URL("chunks/calc.js",document.baseURI).href),p=c(f),v=[l(p,"../../src/wasm/wasm_calc_bg.wasm"),l(p,"../src/wasm/wasm_calc_bg.wasm"),l(p,"../src/wasm/wasm_calc_bg.wasm"),l(p,"../../wasm-calc/pkg/wasm_calc_bg.wasm"),l(p,"../wasm/wasm_calc_bg.wasm")],_=null,d=null,h=0,g=v;case 4:if(!(h<g.length)){n.n=8;break}return m=g[h],n.p=5,_=i(m),n.a(3,8);case 6:n.p=6,w=n.v,d=w;case 7:h++,n.n=4;break;case 8:if(_){n.n=9;break}throw d||new Error("WASM file not found");case 9:t.initSync({module:_});case 10:return n.a(2)}},n,null,[[5,6]])}))).apply(this,arguments)}function qa(){return Sa}var Ma={add:ji,sub:Oi,mul:ki,div:Fi,mod:qi,pow:Mi,idiv:Wi,abs:Pi,neg:zi,sqrt:Ii,exp:Di,ln:Zi,log10:Ri,sin:Ci,cos:Bi,tan:Li,floor:nu,ceil:tu,trunc:eu,round:iu,max:uu,min:ou,compare:au,eq:su,lt:cu,gt:lu,lte:fu,gte:pu,cbrt:Ti,log:$i,log2:Ui,asin:Hi,acos:Gi,atan:Vi,sinh:Ki,cosh:Ji,tanh:Qi,asinh:Xi,acosh:Yi,atanh:ru};var Wa=function(r){return Na||Sa||ja().catch(function(){}),Aa(r)};function Pa(){Ma.add=function(r,n){return ba.str_plus(String(r),String(n))},Ma.sub=function(r,n){return ba.str_sub(String(r),String(n))},Ma.mul=function(r,n){return ba.str_mul(String(r),String(n))},Ma.div=function(r,n){var t=ba.str_div(String(r),String(n));if("NaN"===t){var e=Tn("_error");if(void 0!==e)return e;throw new Error("Division by zero")}return t},Ma.mod=function(r,n){var t=ba.str_mod(String(r),String(n));if("NaN"===t){var e=Tn("_error");if(void 0!==e)return e;throw new Error("Modulo by zero")}return t},Ma.pow=function(r,n){var t=ba.str_powd(String(r),String(n));return"NaN"===t||"Overflow"===t?Mi(r,n):t},Ma.idiv=function(r,n){var t=ba.str_div(String(r),String(n));if("NaN"===t){var e=Tn("_error");if(void 0!==e)return e;throw new Error("Division by zero")}return ba.str_trunc(t)},Ma.abs=function(r){return ba.str_abs(String(r))},Ma.neg=function(r){return ba.str_neg(String(r))},Ma.sqrt=function(r){var n=ba.str_sqrt(String(r));return"NaN"===n?Ii(r):n},Ma.exp=function(r){return ba.str_exp(String(r))},Ma.ln=function(r){var n=ba.str_ln(String(r));return"NaN"===n?Zi(r):n},Ma.log10=function(r){var n=ba.str_log10(String(r));return"NaN"===n?Ri(r):n},Ma.sin=function(r){return ba.str_sin(String(r))},Ma.cos=function(r){return ba.str_cos(String(r))},Ma.tan=function(r){return ba.str_tan(String(r))},Ma.floor=function(r){return ba.str_floor(String(r))},Ma.ceil=function(r){return ba.str_ceil(String(r))},Ma.trunc=function(r){return ba.str_trunc(String(r))},Ma.round=function(r){return ba.str_round(String(r))},Ma.max=function(r,n){return ba.str_max(String(r),String(n))},Ma.min=function(r,n){return ba.str_min(String(r),String(n))},Ma.compare=function(r,n){return ba.str_compare(String(r),String(n))},Ma.eq=function(r,n){return ba.str_eq(String(r),String(n))},Ma.lt=function(r,n){return ba.str_lt(String(r),String(n))},Ma.gt=function(r,n){return ba.str_gt(String(r),String(n))},Ma.lte=function(r,n){return ba.str_lte(String(r),String(n))},Ma.gte=function(r,n){return ba.str_gte(String(r),String(n))},Wa=function(r){var n=ba.eval_expr(String(r));if(n.startsWith("Error:")){var t=Tn("_error");if(void 0!==t)return t;throw new Error(n)}return n},exports.wadd=function(r,n){return ba.str_plus(String(r),String(n))},exports.wsub=function(r,n){return ba.str_sub(String(r),String(n))},exports.wmul=function(r,n){return ba.str_mul(String(r),String(n))},exports.wdiv=function(r,n){var t=ba.str_div(String(r),String(n));if("NaN"===t){var e=Tn("_error");if(void 0!==e)return e;throw new Error("Division by zero")}return t},exports.wmod=function(r,n){var t=ba.str_mod(String(r),String(n));if("NaN"===t){var e=Tn("_error");if(void 0!==e)return e;throw new Error("Modulo by zero")}return t},exports.wpow=function(r,n){var t=ba.str_powd(String(r),String(n));return"NaN"===t||"Overflow"===t?Mi(r,n):t},exports.widiv=function(r,n){var t=ba.str_div(String(r),String(n));if("NaN"===t){var e=Tn("_error");if(void 0!==e)return e;throw new Error("Division by zero")}return ba.str_trunc(t)},exports.wabs=function(r){return ba.str_abs(String(r))},exports.wneg=function(r){return ba.str_neg(String(r))},exports.wsqrt=function(r){var n=ba.str_sqrt(String(r));return"NaN"===n?Ii(r):n},exports.wexp=function(r){return ba.str_exp(String(r))},exports.wln=function(r){var n=ba.str_ln(String(r));return"NaN"===n?Zi(r):n},exports.wlog10=function(r){var n=ba.str_log10(String(r));return"NaN"===n?Ri(r):n},exports.wsin=function(r){return ba.str_sin(String(r))},exports.wcos=function(r){return ba.str_cos(String(r))},exports.wtan=function(r){return ba.str_tan(String(r))},exports.wfloor=function(r){return ba.str_floor(String(r))},exports.wceil=function(r){return ba.str_ceil(String(r))},exports.wtrunc=function(r){return ba.str_trunc(String(r))},exports.wround=function(r){return ba.str_round(String(r))},exports.wmax=function(r,n){return ba.str_max(String(r),String(n))},exports.wmin=function(r,n){return ba.str_min(String(r),String(n))},exports.wcompare=function(r,n){return ba.str_compare(String(r),String(n))},exports.weq=function(r,n){return ba.str_eq(String(r),String(n))},exports.wlt=function(r,n){return ba.str_lt(String(r),String(n))},exports.wgt=function(r,n){return ba.str_gt(String(r),String(n))},exports.wlte=function(r,n){return ba.str_lte(String(r),String(n))},exports.wgte=function(r,n){return ba.str_gte(String(r),String(n))}}function za(){Na||Sa||ja().catch(function(){})}exports.wadd=function(r,n){return za(),ji(r,n)},exports.wsub=function(r,n){return za(),Oi(r,n)},exports.wmul=function(r,n){return za(),ki(r,n)},exports.wdiv=function(r,n){return za(),Fi(r,n)},exports.wmod=function(r,n){return za(),qi(r,n)},exports.wpow=function(r,n){return za(),Mi(r,n)},exports.widiv=function(r,n){return za(),Wi(r,n)},exports.wabs=function(r){return za(),Pi(r)},exports.wneg=function(r){return za(),zi(r)},exports.wsqrt=function(r){return za(),Ii(r)};exports.wexp=function(r){return za(),Di(r)},exports.wln=function(r){return za(),Zi(r)};exports.wlog10=function(r){return za(),Ri(r)},exports.wsin=function(r){return za(),Ci(r)},exports.wcos=function(r){return za(),Bi(r)},exports.wtan=function(r){return za(),Li(r)};exports.wfloor=function(r){return za(),nu(r)},exports.wceil=function(r){return za(),tu(r)},exports.wtrunc=function(r){return za(),eu(r)},exports.wround=function(r){return za(),iu(r)},exports.wmax=function(r,n){return za(),uu(r,n)},exports.wmin=function(r,n){return za(),ou(r,n)},exports.wcompare=function(r,n){return za(),au(r,n)},exports.weq=function(r,n){return za(),su(r,n)},exports.wlt=function(r,n){return za(),cu(r,n)},exports.wgt=function(r,n){return za(),lu(r,n)},exports.wlte=function(r,n){return za(),fu(r,n)},exports.wgte=function(r,n){return za(),pu(r,n)};var Ia={decimal:vu,bigint:zo,wasm:Ma},Ta=a({},vu);function Da(r){var n=Tn("_error");return void 0!==n&&r===n}function Za(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];var e=n.length>0&&"string"===n[n.length-1]?"string":"number",i="string"===e?n.slice(0,-1):n;if(0===i.length)return"number"===e?0:"0";for(var u=String(i[0]),o=1;o<i.length;o++)u=Ta.add(u,String(i[o]));return"number"===e?Number(u):u}function $a(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];var e=n.length>0&&"string"===n[n.length-1]?"string":"number",i="string"===e?n.slice(0,-1):n;if(0===i.length)return"number"===e?0:"0";if(1===i.length){var u=Ta.neg(Ta.neg(String(i[0])));return"number"===e?Number(u):u}for(var o=String(i[0]),a=1;a<i.length;a++)o=Ta.sub(o,String(i[a]));return"number"===e?Number(o):o}function Ua(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];var e=n.length>0&&"string"===n[n.length-1]?"string":"number",i="string"===e?n.slice(0,-1):n;if(0===i.length)return"number"===e?1:"1";for(var u=String(i[0]),o=1;o<i.length;o++)u=Ta.mul(u,String(i[o]));return"number"===e?Number(u):u}function Ra(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];var e=n.length>0&&"string"===n[n.length-1]?"string":"number",i="string"===e?n.slice(0,-1):n;if(0===i.length)return"number"===e?1:"1";if(1===i.length){var u=String(i[0]);return"number"===e?Number(u):u}for(var o=String(i[0]),a=1;a<i.length;a++)if(Da(o=Ta.div(o,String(i[a]))))return o;return"number"===e?Number(o):o}function Ca(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];var e=n.length>0&&"string"===n[n.length-1]?"string":"number",i="string"===e?n.slice(0,-1):n;if(0===i.length)return"number"===e?0:"0";if(1===i.length){var u=String(i[0]);return"number"===e?Number(u):u}for(var o=String(i[0]),a=1;a<i.length;a++)if(Da(o=Ta.mod(o,String(i[a]))))return o;return"number"===e?Number(o):o}function Ba(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];var e=n.length>0&&"string"===n[n.length-1]?"string":"number",i="string"===e?n.slice(0,-1):n;if(0===i.length)return"number"===e?1:"1";if(1===i.length){var u=String(i[0]);return"number"===e?Number(u):u}for(var o=String(i[i.length-1]),a=i.length-2;a>=0;a--)o=Ta.pow(String(i[a]),o);return"number"===e?Number(o):o}function La(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];var e=n.length>0&&"string"===n[n.length-1]?"string":"number",i="string"===e?n.slice(0,-1):n;if(0===i.length)return"number"===e?0:"0";if(1===i.length){var u=String(i[0]);return"number"===e?Number(u):u}for(var o=String(i[0]),a=1;a<i.length;a++)if(Da(o=Ta.idiv(o,String(i[a]))))return o;return"number"===e?Number(o):o}function Ha(r,n){if(!n)return r;var t=dn(n,null);return l(De(new Ae(r),t,{}),1)[0]}function Ga(r){if("function"==typeof r){var n=r();return Da(n),n}return r}function Va(r){var n=String(r),t=Da(r),e=function(r){return t?n:r?Ha(n,r):n};return e.add=function(){if(t)return e;for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];for(var o=0,a=i;o<a.length;o++){var s=Ga(a[o]);if(Da(n=Za(n,s,"string")))return t=!0,e}return e},e.sub=function(){if(t)return e;for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];for(var o=0,a=i;o<a.length;o++){var s=Ga(a[o]);if(Da(n=$a(n,s,"string")))return t=!0,e}return e},e.mul=function(){if(t)return e;for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];for(var o=0,a=i;o<a.length;o++){var s=Ga(a[o]);if(Da(n=Ua(n,s,"string")))return t=!0,e}return e},e.div=function(){if(t)return e;for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];for(var o=0,a=i;o<a.length;o++){var s=Ga(a[o]);if(Da(n=Ra(n,s,"string")))return t=!0,e}return e},e.mod=function(){if(t)return e;for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];for(var o=0,a=i;o<a.length;o++){var s=Ga(a[o]);if(Da(n=Ca(n,s,"string")))return t=!0,e}return e},e.pow=function(){if(t)return e;for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];for(var o=0,a=i;o<a.length;o++){var s=Ga(a[o]);if(Da(n=Ba(n,s,"string")))return t=!0,e}return e},e.idiv=function(){if(t)return e;for(var r=arguments.length,i=new Array(r),u=0;u<r;u++)i[u]=arguments[u];for(var o=0,a=i;o<a.length;o++){var s=Ga(a[o]);if(Da(n=La(n,s,"string")))return t=!0,e}return e},e}Fn("_compute_mode",function(r){var n;Ia[n=r]?(Object.assign(Ta,Ia[n]),"wasm"!==n||qa()||ja().catch(function(r){console.warn("Failed to load WASM module, using Decimal fallback:",r.message)})):console.warn("Unknown compute mode: ".concat(n,", available modes: ").concat(Object.keys(Ia).join(", ")))}),Ae.set({precision:50,rounding:Ae.ROUND_HALF_UP,toExpNeg:-50,toExpPos:50});var Ka=1e6;function Ja(r,n,t){var e=un(r,"_fmt");if(void 0!==e){if(""===e)return;if("string"!=typeof e)throw new TypeError("_fmt must be a string");return t(e,n)}var i=Tn("_fmt_parsed");return i&&i.has_var?t(Tn("_fmt"),n):i}function Qa(r,n){if(n)return n;var t=un(r,"_fmt");return void 0!==t?t:Tn("_fmt")}function Xa(r){var n=[],t=50,e="─".repeat(t);n.push("┌".concat(e,"┐")),n.push("│ [a-calc debug]".concat(" ".repeat(35),"│")),n.push("├".concat(e,"┤"));var i="│ 表达式: ".concat(r.expression);n.push(i+" ".repeat(Math.max(0,52-i.length))+"│"),n.push("│".concat(" ".repeat(t),"│")),n.push("│ 变量:".concat(" ".repeat(45),"│"));for(var u=0,o=Object.entries(r.variables);u<o.length;u++){var a=l(o[u],2),s=a[0],c=a[1],f="│ ".concat(s," = ").concat(c);n.push(f+" ".repeat(Math.max(0,52-f.length))+"│")}if(n.push("│".concat(" ".repeat(t),"│")),n.push("│ 步骤:".concat(" ".repeat(45),"│")),r.steps.forEach(function(r,t){var e="│ ".concat(t+1,". ").concat(r.expression);n.push(e+" ".repeat(Math.max(0,52-e.length))+"│");var i="│ → ".concat(r.substituted," = ").concat(r.result);n.push(i+" ".repeat(Math.max(0,52-i.length))+"│")}),n.push("│".concat(" ".repeat(t),"│")),r.format){var p="│ 格式化: | ".concat(r.format);n.push(p+" ".repeat(Math.max(0,52-p.length))+"│"),n.push("│".concat(" ".repeat(t),"│"))}var v='│ 结果: "'.concat(r.result,'"');n.push(v+" ".repeat(Math.max(0,52-v.length))+"│"),n.push("└".concat(e,"┘")),console.log(n.join("\n"))}function Ya(r,n){var t,e=Tn(),i=n?Array.isArray(n)?n:a(a({},e),n):e,u=null!==(t=un(i,"_error"))&&void 0!==t?t:Tn("_error"),o=un(i,"_debug"),s=un(i,"_on_debug"),c=null;o&&(c={expression:r,variables:{},steps:[],format:null,result:null});try{var v,_,d,h=$n(r,i),g=h._unit,m={_empty_values:h._empty_values,_empty_check:h._empty_check};if(o&&h.fill_data){var w=function(r){if(Array.isArray(r))r.forEach(function(r){return w(r)});else if(r&&"object"===p(r))for(var n=0,t=Object.entries(r);n<t.length;n++){var e=l(t[n],2),i=e[0],u=e[1];i.startsWith("_")||"function"==typeof u||(c.variables[i]=u)}};w(h.fill_data)}var y=Bn(h.expr,h.fill_data,g,m);if(y._fill_data=h.fill_data,y._unit=g,y._options=m,o){var x=y.map(function(r){return void 0!==r.real_value&&r.real_value!==r.value?r.real_value:r.value}).join(" ");c.steps.push({expression:h.expr,substituted:x,result:"..."})}var b=ni(h._angle_unit,function(){return xi(y)});if(o&&c.steps.length>0&&(c.steps[c.steps.length-1].result=String(b)),"boolean"==typeof b)return o&&(c.result=b,Tn("_debug_console")&&Xa(c),s&&s(c)),b;if("string"==typeof b&&!Ke(b)){if("Infinity"===b||"-Infinity"===b||"NaN"===b)throw new Error("计算错误可能是非法的计算式");return o&&(c.result=b,Tn("_debug_console")&&Xa(c),s&&s(c)),b}var S,N,E,A=Ke(b)?b:new Ae(b);if(Ke(A)&&!A.isFinite())throw new Error("计算错误可能是非法的计算式");if(Ke(A)&&Math.abs(A.e)>Ka)throw new Error("计算结果数量级过大,超出安全上限");N=""===h.fmt_expr||void 0===h.fmt_expr?void 0:dn(h.fmt_expr,h.fill_data),E=Ja(n,h.fill_data,dn),void 0===N?void 0!==E&&(N=E):void 0!==E&&(N=[].concat(f(E),f(N)));var j=Qa(n,h.fmt_expr);if(o&&j&&(c.format=j),void 0===N)A=A.toFixed();else{var O=l(De(A,N,{_compact_symbols:h._compact_symbols,_compact_step:h._compact_step,_unit_convert_out:Tn("_unit_convert_out"),_unit_default_in:Tn("_unit_default_in"),_unit_default_out:Tn("_unit_default_out"),_unit_default_position:Tn("_unit_default_position"),_unit_position_map:Tn("_unit_position_map"),_thousands:h._thousands,_unit_thousands_map:Tn("_unit_thousands_map"),_fill_data:h.fill_data,_recognized_unit:y.has_unit?y.unit:null}),2);A=O[0],S=O[1]}if("Infinity"===A||"NaN"===A||void 0===A)throw new Error("计算错误可能是非法的计算式");return!y.has_unit||null!==(v=S)&&void 0!==v&&v.to_number||null!==(_=S)&&void 0!==_&&_.to_number_string||null!==(d=S)&&void 0!==d&&d.unit_handled||(A+=y.unit),o&&(c.result=A,Tn("_debug_console")&&Xa(c),s&&s(c)),A}catch(r){if(o&&(c.result=null!=u?u:r.message,c.error=r.message,Tn("_debug_console")&&Xa(c),s&&s(c)),void 0===u)throw r;return u}}Aa=Ya,Ze=Ya,function(r){bi=r}(Ya);var rs={check_update:function(){(function(){return Le.apply(this,arguments)})().catch(function(){})},print_version:function(){console.log("%ca-calc:%c ".concat(_," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")},close_important_push:function(){},open_important_push:function(){}};exports._asyncToGenerator=e,exports._regenerator=s,exports.abs=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",t=Ta.abs(String(r));return"number"===n?Number(t):t},exports.add=Za,exports.babs=Co,exports.bacos=_a,exports.bacosh=ya,exports.badd=Io,exports.basin=va,exports.basinh=wa,exports.batan=da,exports.batanh=xa,exports.bcbrt=ia,exports.bceil=Ho,exports.bcompare=Qo,exports.bcos=fa,exports.bcosh=ga,exports.bdiv=Zo,exports.beq=Xo,exports.bexp=ua,exports.bfloor=Lo,exports.bgt=ra,exports.bgte=ta,exports.bidiv=Ro,exports.bln=oa,exports.blog=aa,exports.blog10=ca,exports.blog2=sa,exports.blt=Yo,exports.blte=na,exports.bmax=Ko,exports.bmin=Jo,exports.bmod=$o,exports.bmul=Do,exports.bneg=Bo,exports.bpow=Uo,exports.bround=Vo,exports.bsin=la,exports.bsinh=ha,exports.bsqrt=ea,exports.bsub=To,exports.btan=pa,exports.btanh=ma,exports.btrunc=Go,exports.cadd=function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];if(0===n.length)return Va(0);for(var e="0",i=0,u=n;i<u.length;i++){var o=Ga(u[i]);if(Da(o))return Va(o);if(Da(e=Za(e,o,"string")))return Va(e)}return Va(e)},exports.calc=Ya,exports.calc_avg=function(r,n){var t=Si(),e={_error:"-"},i=Ai(r),u=i.inner_expr,o=i.fmt_str;if(0===n.length)return Ni("0",o);for(var s=new Ae(0),c=0;c<n.length;c++){var l=t(u,a(a({},e),n[c]));if(l===e._error)return e._error;var f=Ei(l);if(null===f)return e._error;s=s.plus(f)}return Ni(s.div(n.length).toFixed(),o)},exports.calc_count=function(r,n){var t=Si(),e={_error:"-"},i=Ai(r).inner_expr;if(0===n.length)return"0";for(var u=0,o=0;o<n.length;o++){var s=t(i,a(a({},e),n[o]));if(s===e._error)return e._error;if(!0!==s&&"true"!==s){if(!1!==s&&"false"!==s){var c=Ei(s);if(null===c)return e._error;c.isZero()||u++}}else u++}return String(u)},exports.calc_max=function(r,n){var t=Si(),e={_error:"-"},i=Ai(r),u=i.inner_expr,o=i.fmt_str;if(0===n.length)return Ni("0",o);for(var s=null,c=0;c<n.length;c++){var l=t(u,a(a({},e),n[c]));if(l===e._error)return e._error;var f=Ei(l);if(null===f)return e._error;(null===s||f.gt(s))&&(s=f)}return Ni(s.toFixed(),o)},exports.calc_min=function(r,n){var t=Si(),e={_error:"-"},i=Ai(r),u=i.inner_expr,o=i.fmt_str;if(0===n.length)return Ni("0",o);for(var s=null,c=0;c<n.length;c++){var l=t(u,a(a({},e),n[c]));if(l===e._error)return e._error;var f=Ei(l);if(null===f)return e._error;(null===s||f.lt(s))&&(s=f)}return Ni(s.toFixed(),o)},exports.calc_space=function(r,n){var t,e=Tn(),i=n?Array.isArray(n)?n:a(a({},e),n):e,u=null!==(t=un(i,"_error"))&&void 0!==t?t:Tn("_error"),o=un(i,"_debug"),s=un(i,"_on_debug"),c=null;o&&(c={expression:r,variables:{},steps:[],format:null,result:null});try{var v,_,d,h=$n(r,i),g=h._unit,m={_empty_values:h._empty_values,_empty_check:h._empty_check};if(o&&h.fill_data){var w=function(r){if(Array.isArray(r))r.forEach(function(r){return w(r)});else if(r&&"object"===p(r))for(var n=0,t=Object.entries(r);n<t.length;n++){var e=l(t[n],2),i=e[0],u=e[1];i.startsWith("_")||"function"==typeof u||(c.variables[i]=u)}};w(h.fill_data)}var y=function(r,n,t,e){for(var i,u=0,o=0,a=r.length,s=[],c=Un(r),l={has_var:!1,has_unit:!1,unit_str:void 0,_unit:t,fill_data:n};o<a;){if(" "===(i=r[o]))o>u&&Ge(s,r.slice(u,o),l),u=o+1;else if("("===i){var f=c.get(o);if(f){o>u&&Ge(s,r.slice(u,o),l),l.has_var=!0;var p=fn(n,f.paths,e),v=p.value,_=p.path;if(t){var d,h=en(v),g=h.num,m=h.unit;void 0!==m?(l.has_unit=!0,null!==(d=l.unit_str)&&void 0!==d||(l.unit_str=m),s.push({type:Z,value:f.paths,real_value:g,matched_path:_,has_unit:!0,unit:m})):s.push({type:Z,value:f.paths,real_value:g,matched_path:_,has_unit:!1})}else s.push({type:Z,value:f.paths,real_value:v,matched_path:_,has_unit:!1});u=o=f.end_index+1;continue}s.push({type:k,value:"("}),u=o+1}else")"===i&&(o>u&&Ge(s,r.slice(u,o),l),s.push({type:k,value:")"}),u=o+1);o++}return o>u&&Ge(s,r.slice(u,o),l),s.has_var=l.has_var,s.has_unit=l.has_unit,s.unit=l.unit_str,s}(h.expr,h.fill_data,g,m);if(y._fill_data=h.fill_data,y._unit=g,y._options=m,o){var x=y.map(function(r){return void 0!==r.real_value&&r.real_value!==r.value?r.real_value:r.value}).join(" ");c.steps.push({expression:h.expr,substituted:x,result:"..."})}var b=ni(h._angle_unit,function(){return xi(y)});if(o&&c.steps.length>0&&(c.steps[c.steps.length-1].result=String(b)),"boolean"==typeof b)return o&&(c.result=b,Tn("_debug_console")&&Xa(c),s&&s(c)),b;if("string"==typeof b&&!Ke(b)){if("Infinity"===b||"-Infinity"===b||"NaN"===b)throw new Error("计算错误可能是非法的计算式");return o&&(c.result=b,Tn("_debug_console")&&Xa(c),s&&s(c)),b}var S,N,E,A=Ke(b)?b:new Ae(b);if(Ke(A)&&!A.isFinite())throw new Error("计算错误可能是非法的计算式");if(Ke(A)&&Math.abs(A.e)>Ka)throw new Error("计算结果数量级过大,超出安全上限");N=""===h.fmt_expr||void 0===h.fmt_expr?void 0:yn(h.fmt_expr,h.fill_data),E=Ja(n,h.fill_data,yn),void 0===N?void 0!==E&&(N=E):void 0!==E&&(N=[].concat(f(E),f(N)));var j=Qa(n,h.fmt_expr);if(o&&j&&(c.format=j),void 0===N)A=A.toFixed();else{var O=l(De(A,N,{_compact_symbols:h._compact_symbols,_compact_step:h._compact_step,_unit_convert_out:Tn("_unit_convert_out"),_unit_default_in:Tn("_unit_default_in"),_unit_default_out:Tn("_unit_default_out"),_unit_default_position:Tn("_unit_default_position"),_unit_position_map:Tn("_unit_position_map"),_thousands:h._thousands,_unit_thousands_map:Tn("_unit_thousands_map"),_fill_data:h.fill_data,_recognized_unit:y.has_unit?y.unit:null}),2);A=O[0],S=O[1]}if("Infinity"===A||"NaN"===A||void 0===A)throw new Error("计算错误可能是非法的计算式");return!y.has_unit||null!==(v=S)&&void 0!==v&&v.to_number||null!==(_=S)&&void 0!==_&&_.to_number_string||null!==(d=S)&&void 0!==d&&d.unit_handled||(A+=y.unit),o&&(c.result=A,Tn("_debug_console")&&Xa(c),s&&s(c)),A}catch(r){if(o&&(c.result=null!=u?u:r.message,c.error=r.message,Tn("_debug_console")&&Xa(c),s&&s(c)),void 0===u)throw r;return u}},exports.calc_sum=function(r,n){var t=Si(),e={_error:"-"},i=Ai(r),u=i.inner_expr,o=i.fmt_str;if(0===n.length)return t(r,e);for(var s=new Ae(0),c=0;c<n.length;c++){var l=t(u,a(a({},e),n[c]));if(l===e._error)return e._error;var f=Ei(l);if(null===f)return e._error;s=s.plus(f)}return Ni(s.toFixed(),o)},exports.calc_util=rs,exports.calc_wrap=function(r,n){var t=function(){if(!Ze)throw new Error("calc function not registered");return Ze}(),e={_error:"-"};return["string","number"].includes(p(r))?void 0===n?/[a-zA-Z$_]/.test(r.toString())?function(n){return n=Array.isArray(n)?[e].concat(f(n)):a(a({},e),n),t(r,n)}:t(r):(n=Array.isArray(n)?[e].concat(f(n)):a(a({},e),n),t(r,n)):(r=Array.isArray(r)?[e].concat(f(r)):a(a({},e),r),function(n){return t(n,r)})},exports.cdiv=function(r){if(void 0===r)return Va(1);for(var n=String(Ga(r)),t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];for(var u=0,o=e;u<o.length;u++){if(Da(n=Ra(n,Ga(o[u]),"string")))return Va(n)}return Va(n)},exports.cidiv=function(r){if(void 0===r)return Va(0);for(var n=String(Ga(r)),t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];for(var u=0,o=e;u<o.length;u++){if(Da(n=La(n,Ga(o[u]),"string")))return Va(n)}return Va(n)},exports.cmod=function(r){if(void 0===r)return Va(0);for(var n=String(Ga(r)),t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];for(var u=0,o=e;u<o.length;u++){if(Da(n=Ca(n,Ga(o[u]),"string")))return Va(n)}return Va(n)},exports.cmul=function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];if(0===n.length)return Va(1);for(var e="1",i=0,u=n;i<u.length;i++){var o=Ga(u[i]);if(Da(o))return Va(o);if(Da(e=Ua(e,o,"string")))return Va(e)}return Va(e)},exports.cpow=function(r){if(void 0===r)return Va(1);for(var n=String(Ga(r)),t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];for(var u=0,o=e;u<o.length;u++){if(Da(n=Ba(n,Ga(o[u]),"string")))return Va(n)}return Va(n)},exports.csub=function(r){if(void 0===r)return Va(0);for(var n=String(Ga(r)),t=arguments.length,e=new Array(t>1?t-1:0),i=1;i<t;i++)e[i-1]=arguments[i];for(var u=0,o=e;u<o.length;u++){if(Da(n=$a(n,Ga(o[u]),"string")))return Va(n)}return Va(n)},exports.dabs=xu,exports.dacos=Pu,exports.dacosh=$u,exports.dadd=_u,exports.dasin=Wu,exports.dasinh=Zu,exports.datan=zu,exports.datanh=Uu,exports.dcbrt=Nu,exports.dceil=Cu,exports.dcompare=Vu,exports.dcos=qu,exports.dcosh=Tu,exports.ddiv=gu,exports.deq=Ku,exports.dexp=Eu,exports.dfloor=Ru,exports.dgt=Qu,exports.dgte=Yu,exports.didiv=yu,exports.div=Ra,exports.dln=Au,exports.dlog=ju,exports.dlog10=ku,exports.dlog2=Ou,exports.dlt=Ju,exports.dlte=Xu,exports.dmax=Hu,exports.dmin=Gu,exports.dmod=mu,exports.dmul=hu,exports.dneg=bu,exports.dpow=wu,exports.dround=Lu,exports.dsin=Fu,exports.dsinh=Iu,exports.dsqrt=Su,exports.dsub=du,exports.dtan=Mu,exports.dtanh=Du,exports.dtrunc=Bu,exports.exp=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",t=Ta.exp(String(r));return"number"===n?Number(t):t},exports.fmt=function(r,n,t){return null!==n&&"object"===p(n)?Ya(r,n):Ya("string"==typeof n&&""!==n?"".concat(r," | ").concat(n):r,t)},exports.get_config=Tn,exports.idiv=La,exports.is_wasm_loaded=qa,exports.ln=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",t=Ta.ln(String(r));return"number"===n?Number(t):t},exports.load_wasm=ja,exports.mod=Ca,exports.mul=Ua,exports.neg=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",t=Ta.neg(String(r));return"number"===n?Number(t):t},exports.ops=Ta,exports.parse_thousands=sn,exports.pow=Ba,exports.rabs=function(){return Ta.abs.apply(Ta,arguments)},exports.racos=function(){return Ta.acos.apply(Ta,arguments)},exports.racosh=function(){return Ta.acosh.apply(Ta,arguments)},exports.radd=function(){return Ta.add.apply(Ta,arguments)},exports.rasin=function(){return Ta.asin.apply(Ta,arguments)},exports.rasinh=function(){return Ta.asinh.apply(Ta,arguments)},exports.ratan=function(){return Ta.atan.apply(Ta,arguments)},exports.ratanh=function(){return Ta.atanh.apply(Ta,arguments)},exports.rcbrt=function(){return Ta.cbrt.apply(Ta,arguments)},exports.rceil=function(){return Ta.ceil.apply(Ta,arguments)},exports.rcompare=function(){return Ta.compare.apply(Ta,arguments)},exports.rcos=function(){return Ta.cos.apply(Ta,arguments)},exports.rcosh=function(){return Ta.cosh.apply(Ta,arguments)},exports.rdiv=function(){return Ta.div.apply(Ta,arguments)},exports.req=function(){return Ta.eq.apply(Ta,arguments)},exports.reset_config=function(r){if(void 0===r){Sn=void 0,Nn=void 0;for(var n=0,t=Object.values(An);n<t.length;n++)for(var e=t[n],u=0,o=Object.keys(e);u<o.length;u++){delete e[o[u]]}for(var a=Object.keys(En),s=function(){var r=l[c],n=En[r];En[r]=bn(xn[r]),n!==En[r]&&kn[r]&&kn[r].forEach(function(t){return t(En[r],n)})},c=0,l=a;c<l.length;c++)s()}else{var f,p=i(Array.isArray(r)?r:[r]);try{var v=function(){var r=f.value;if(r in xn){var n=En[r];if("_unit_convert_out"===r)Sn=void 0,Pn();else if("_unit_convert_in"===r)Nn=void 0,Pn();else if(r in An){for(var t=An[r],e=0,i=Object.keys(t);e<i.length;e++){delete t[i[e]]}Pn()}else En[r]=bn(xn[r]);n!==En[r]&&kn[r]&&kn[r].forEach(function(t){return t(En[r],n)})}};for(p.s();!(f=p.n()).done;)v()}catch(r){p.e(r)}finally{p.f()}}},exports.rexp=function(){return Ta.exp.apply(Ta,arguments)},exports.rfloor=function(){return Ta.floor.apply(Ta,arguments)},exports.rgt=function(){return Ta.gt.apply(Ta,arguments)},exports.rgte=function(){return Ta.gte.apply(Ta,arguments)},exports.ridiv=function(){return Ta.idiv.apply(Ta,arguments)},exports.rln=function(){return Ta.ln.apply(Ta,arguments)},exports.rlog=function(){return Ta.log.apply(Ta,arguments)},exports.rlog10=function(){return Ta.log10.apply(Ta,arguments)},exports.rlog2=function(){return Ta.log2.apply(Ta,arguments)},exports.rlt=function(){return Ta.lt.apply(Ta,arguments)},exports.rlte=function(){return Ta.lte.apply(Ta,arguments)},exports.rmax=function(){return Ta.max.apply(Ta,arguments)},exports.rmin=function(){return Ta.min.apply(Ta,arguments)},exports.rmod=function(){return Ta.mod.apply(Ta,arguments)},exports.rmul=function(){return Ta.mul.apply(Ta,arguments)},exports.rneg=function(){return Ta.neg.apply(Ta,arguments)},exports.rpow=function(){return Ta.pow.apply(Ta,arguments)},exports.rround=function(){return Ta.round.apply(Ta,arguments)},exports.rsin=function(){return Ta.sin.apply(Ta,arguments)},exports.rsinh=function(){return Ta.sinh.apply(Ta,arguments)},exports.rsqrt=function(){return Ta.sqrt.apply(Ta,arguments)},exports.rsub=function(){return Ta.sub.apply(Ta,arguments)},exports.rtan=function(){return Ta.tan.apply(Ta,arguments)},exports.rtanh=function(){return Ta.tanh.apply(Ta,arguments)},exports.rtrunc=function(){return Ta.trunc.apply(Ta,arguments)},exports.set_config=In,exports.sqrt=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",t=Ta.sqrt(String(r));return"number"===n?Number(t):t},exports.sub=$a,exports.version=_,exports.wacos=function(r){return za(),Gi(r)},exports.wacosh=function(r){return za(),Yi(r)},exports.wasin=function(r){return za(),Hi(r)},exports.wasinh=function(r){return za(),Xi(r)},exports.watan=function(r){return za(),Vi(r)},exports.watanh=function(r){return za(),ru(r)},exports.wcalc=function(r){return Wa(r)},exports.wcbrt=function(r){return za(),Ti(r)},exports.wcosh=function(r){return za(),Ji(r)},exports.wlog=function(r,n){return za(),$i(r,n)},exports.wlog2=function(r){return za(),Ui(r)},exports.wsinh=function(r){return za(),Ki(r)},exports.wtanh=function(r){return za(),Qi(r)};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t,n=require("./calc.js"),_="undefined"!=typeof document?document.currentScript:null;var e=null;function r(){return(null===e||!0===e.buffer.detached||void 0===e.buffer.detached&&e.buffer!==t.memory.buffer)&&(e=new DataView(t.memory.buffer)),e}function o(t,n){return function(t,n){c+=n,c>=b&&((w=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0})).decode(),c=n);return w.decode(a().subarray(t,t+n))}(t>>>=0,n)}var i=null;function a(){return null!==i&&0!==i.byteLength||(i=new Uint8Array(t.memory.buffer)),i}var d=new Array(128).fill(void 0);d.push(void 0,null,!0,!1);var g=d.length;function s(t,n,_){if(void 0===_){var e=f.encode(t),r=n(e.length,1)>>>0;return a().subarray(r,r+e.length).set(e),u=e.length,r}for(var o=t.length,i=n(o,1)>>>0,d=a(),g=0;g<o;g++){var s=t.charCodeAt(g);if(s>127)break;d[i+g]=s}if(g!==o){0!==g&&(t=t.slice(g)),i=_(i,o,o=g+3*t.length,1)>>>0;var p=a().subarray(i+g,i+o);i=_(i,o,g+=f.encodeInto(t,p).written,1)>>>0}return u=g,i}function p(t){var n=function(t){return d[t]}(t);return function(t){t<132||(d[t]=g,g=t)}(t),n}var w=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});w.decode();var b=2146435072,c=0;var f=new TextEncoder;"encodeInto"in f||(f.encodeInto=function(t,n){var _=f.encode(t);return n.set(_),{read:t.length,written:_.length}});var u=0;var x=new Set(["basic","cors","default"]);function l(t,n){return v.apply(this,arguments)}function v(){return(v=n._asyncToGenerator(n._regenerator().m(function t(_,e){var r,o,i;return n._regenerator().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!("function"==typeof Response&&_ instanceof Response)){t.n=8;break}if("function"!=typeof WebAssembly.instantiateStreaming){t.n=5;break}return t.p=1,t.n=2,WebAssembly.instantiateStreaming(_,e);case 2:case 7:return t.a(2,t.v);case 3:if(t.p=3,i=t.v,!(_.ok&&x.has(_.type))||"application/wasm"===_.headers.get("Content-Type")){t.n=4;break}console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",i),t.n=5;break;case 4:throw i;case 5:return t.n=6,_.arrayBuffer();case 6:return r=t.v,t.n=7,WebAssembly.instantiate(r,e);case 8:return t.n=9,WebAssembly.instantiate(_,e);case 9:if(!((o=t.v)instanceof WebAssembly.Instance)){t.n=10;break}return t.a(2,{instance:o,module:_});case 10:return t.a(2,o);case 11:return t.a(2)}},t,null,[[1,3]])}))).apply(this,arguments)}function I(){var t={wbg:{}};return t.wbg.__wbindgen_cast_2241b6af4c4b2941=function(t,n){return function(t){g===d.length&&d.push(d.length+1);var n=g;return g=d[n],d[n]=t,n}(o(t,n))},t}function y(n,_){return t=n.exports,k.__wbindgen_wasm_module=_,e=null,i=null,t}function k(t){return h.apply(this,arguments)}function h(){return(h=n._asyncToGenerator(n._regenerator().m(function e(r){var o,i,a,d,g;return n._regenerator().w(function(n){for(;;)switch(n.n){case 0:if(void 0===t){n.n=1;break}return n.a(2,t);case 1:return void 0!==r&&(Object.getPrototypeOf(r)===Object.prototype?r=r.module_or_path:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===r&&(r=new URL("wasm_calc_bg.wasm","undefined"==typeof document?require("url").pathToFileURL(__filename).href:_&&"SCRIPT"===_.tagName.toUpperCase()&&_.src||new URL("chunks/wasm_calc.js",document.baseURI).href)),o=I(),("string"==typeof r||"function"==typeof Request&&r instanceof Request||"function"==typeof URL&&r instanceof URL)&&(r=fetch(r)),g=l,n.n=2,r;case 2:return n.n=3,g(n.v,o);case 3:return i=n.v,a=i.instance,d=i.module,n.a(2,y(a,d))}},e)}))).apply(this,arguments)}exports.default=k,exports.eval_expr=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.eval_expr(i,a,d);var g=r().getInt32(i+0,!0),p=r().getInt32(i+4,!0);return _=g,e=p,o(g,p)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.eval_expr_safe=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.eval_expr_safe(i,a,d);var g=r().getInt32(i+0,!0),p=r().getInt32(i+4,!0);return _=g,e=p,o(g,p)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.initSync=function(n){if(void 0!==t)return t;void 0!==n&&(Object.getPrototypeOf(n)===Object.prototype?n=n.module:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));var _=I();return n instanceof WebAssembly.Module||(n=new WebAssembly.Module(n)),y(new WebAssembly.Instance(n,_),n)},exports.str_abs=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_abs(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_ceil=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_ceil(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_compare=function(n,_){try{var e=t.__wbindgen_add_to_stack_pointer(-16),o=s(n,t.__wbindgen_export,t.__wbindgen_export2),i=u,a=s(_,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_compare(e,o,i,a,d);var g=r().getInt32(e+0,!0),w=r().getInt32(e+4,!0);if(r().getInt32(e+8,!0))throw p(w);return g}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_cos=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_cos(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_div=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u,w=s(_,t.__wbindgen_export,t.__wbindgen_export2),b=u;t.str_div(a,d,g,w,b);var c=r().getInt32(a+0,!0),f=r().getInt32(a+4,!0),x=r().getInt32(a+8,!0),l=r().getInt32(a+12,!0),v=c,I=f;if(l)throw v=0,I=0,p(x);return e=v,i=I,o(v,I)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_eq=function(n,_){try{var e=t.__wbindgen_add_to_stack_pointer(-16),o=s(n,t.__wbindgen_export,t.__wbindgen_export2),i=u,a=s(_,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_eq(e,o,i,a,d);var g=r().getInt32(e+0,!0),w=r().getInt32(e+4,!0);if(r().getInt32(e+8,!0))throw p(w);return 0!==g}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_exp=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_exp(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_floor=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_floor(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_fract=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_fract(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_gt=function(n,_){try{var e=t.__wbindgen_add_to_stack_pointer(-16),o=s(n,t.__wbindgen_export,t.__wbindgen_export2),i=u,a=s(_,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_gt(e,o,i,a,d);var g=r().getInt32(e+0,!0),w=r().getInt32(e+4,!0);if(r().getInt32(e+8,!0))throw p(w);return 0!==g}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_gte=function(n,_){try{var e=t.__wbindgen_add_to_stack_pointer(-16),o=s(n,t.__wbindgen_export,t.__wbindgen_export2),i=u,a=s(_,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_gte(e,o,i,a,d);var g=r().getInt32(e+0,!0),w=r().getInt32(e+4,!0);if(r().getInt32(e+8,!0))throw p(w);return 0!==g}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_is_integer=function(n){try{var _=t.__wbindgen_add_to_stack_pointer(-16),e=s(n,t.__wbindgen_export,t.__wbindgen_export2),o=u;t.str_is_integer(_,e,o);var i=r().getInt32(_+0,!0),a=r().getInt32(_+4,!0);if(r().getInt32(_+8,!0))throw p(a);return 0!==i}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_is_negative=function(n){try{var _=t.__wbindgen_add_to_stack_pointer(-16),e=s(n,t.__wbindgen_export,t.__wbindgen_export2),o=u;t.str_is_negative(_,e,o);var i=r().getInt32(_+0,!0),a=r().getInt32(_+4,!0);if(r().getInt32(_+8,!0))throw p(a);return 0!==i}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_is_positive=function(n){try{var _=t.__wbindgen_add_to_stack_pointer(-16),e=s(n,t.__wbindgen_export,t.__wbindgen_export2),o=u;t.str_is_positive(_,e,o);var i=r().getInt32(_+0,!0),a=r().getInt32(_+4,!0);if(r().getInt32(_+8,!0))throw p(a);return 0!==i}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_is_zero=function(n){try{var _=t.__wbindgen_add_to_stack_pointer(-16),e=s(n,t.__wbindgen_export,t.__wbindgen_export2),o=u;t.str_is_zero(_,e,o);var i=r().getInt32(_+0,!0),a=r().getInt32(_+4,!0);if(r().getInt32(_+8,!0))throw p(a);return 0!==i}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_ln=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_ln(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_log10=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_log10(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_lt=function(n,_){try{var e=t.__wbindgen_add_to_stack_pointer(-16),o=s(n,t.__wbindgen_export,t.__wbindgen_export2),i=u,a=s(_,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_lt(e,o,i,a,d);var g=r().getInt32(e+0,!0),w=r().getInt32(e+4,!0);if(r().getInt32(e+8,!0))throw p(w);return 0!==g}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_lte=function(n,_){try{var e=t.__wbindgen_add_to_stack_pointer(-16),o=s(n,t.__wbindgen_export,t.__wbindgen_export2),i=u,a=s(_,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_lte(e,o,i,a,d);var g=r().getInt32(e+0,!0),w=r().getInt32(e+4,!0);if(r().getInt32(e+8,!0))throw p(w);return 0!==g}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_max=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u,w=s(_,t.__wbindgen_export,t.__wbindgen_export2),b=u;t.str_max(a,d,g,w,b);var c=r().getInt32(a+0,!0),f=r().getInt32(a+4,!0),x=r().getInt32(a+8,!0),l=r().getInt32(a+12,!0),v=c,I=f;if(l)throw v=0,I=0,p(x);return e=v,i=I,o(v,I)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_min=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u,w=s(_,t.__wbindgen_export,t.__wbindgen_export2),b=u;t.str_min(a,d,g,w,b);var c=r().getInt32(a+0,!0),f=r().getInt32(a+4,!0),x=r().getInt32(a+8,!0),l=r().getInt32(a+12,!0),v=c,I=f;if(l)throw v=0,I=0,p(x);return e=v,i=I,o(v,I)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_mod=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u,w=s(_,t.__wbindgen_export,t.__wbindgen_export2),b=u;t.str_mod(a,d,g,w,b);var c=r().getInt32(a+0,!0),f=r().getInt32(a+4,!0),x=r().getInt32(a+8,!0),l=r().getInt32(a+12,!0),v=c,I=f;if(l)throw v=0,I=0,p(x);return e=v,i=I,o(v,I)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_mul=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u,w=s(_,t.__wbindgen_export,t.__wbindgen_export2),b=u;t.str_mul(a,d,g,w,b);var c=r().getInt32(a+0,!0),f=r().getInt32(a+4,!0),x=r().getInt32(a+8,!0),l=r().getInt32(a+12,!0),v=c,I=f;if(l)throw v=0,I=0,p(x);return e=v,i=I,o(v,I)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_neg=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_neg(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_normalize=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_normalize(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_plus=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u,w=s(_,t.__wbindgen_export,t.__wbindgen_export2),b=u;t.str_plus(a,d,g,w,b);var c=r().getInt32(a+0,!0),f=r().getInt32(a+4,!0),x=r().getInt32(a+8,!0),l=r().getInt32(a+12,!0),v=c,I=f;if(l)throw v=0,I=0,p(x);return e=v,i=I,o(v,I)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_pow=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u;t.str_pow(a,d,g,_);var w=r().getInt32(a+0,!0),b=r().getInt32(a+4,!0),c=r().getInt32(a+8,!0),f=r().getInt32(a+12,!0),x=w,l=b;if(f)throw x=0,l=0,p(c);return e=x,i=l,o(x,l)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_powd=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u,w=s(_,t.__wbindgen_export,t.__wbindgen_export2),b=u;t.str_powd(a,d,g,w,b);var c=r().getInt32(a+0,!0),f=r().getInt32(a+4,!0),x=r().getInt32(a+8,!0),l=r().getInt32(a+12,!0),v=c,I=f;if(l)throw v=0,I=0,p(x);return e=v,i=I,o(v,I)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_round=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_round(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_round_dp=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u;t.str_round_dp(a,d,g,_);var w=r().getInt32(a+0,!0),b=r().getInt32(a+4,!0),c=r().getInt32(a+8,!0),f=r().getInt32(a+12,!0),x=w,l=b;if(f)throw x=0,l=0,p(c);return e=x,i=l,o(x,l)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_round_dp_bankers=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u;t.str_round_dp_bankers(a,d,g,_);var w=r().getInt32(a+0,!0),b=r().getInt32(a+4,!0),c=r().getInt32(a+8,!0),f=r().getInt32(a+12,!0),x=w,l=b;if(f)throw x=0,l=0,p(c);return e=x,i=l,o(x,l)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_scale=function(n){try{var _=t.__wbindgen_add_to_stack_pointer(-16),e=s(n,t.__wbindgen_export,t.__wbindgen_export2),o=u;t.str_scale(_,e,o);var i=r().getInt32(_+0,!0),a=r().getInt32(_+4,!0);if(r().getInt32(_+8,!0))throw p(a);return i>>>0}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_sign=function(n){try{var _=t.__wbindgen_add_to_stack_pointer(-16),e=s(n,t.__wbindgen_export,t.__wbindgen_export2),o=u;t.str_sign(_,e,o);var i=r().getInt32(_+0,!0),a=r().getInt32(_+4,!0);if(r().getInt32(_+8,!0))throw p(a);return i}finally{t.__wbindgen_add_to_stack_pointer(16)}},exports.str_sin=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_sin(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_sqrt=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_sqrt(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_sub=function(n,_){var e,i;try{var a=t.__wbindgen_add_to_stack_pointer(-16),d=s(n,t.__wbindgen_export,t.__wbindgen_export2),g=u,w=s(_,t.__wbindgen_export,t.__wbindgen_export2),b=u;t.str_sub(a,d,g,w,b);var c=r().getInt32(a+0,!0),f=r().getInt32(a+4,!0),x=r().getInt32(a+8,!0),l=r().getInt32(a+12,!0),v=c,I=f;if(l)throw v=0,I=0,p(x);return e=v,i=I,o(v,I)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(e,i,1)}},exports.str_tan=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_tan(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}},exports.str_trunc=function(n){var _,e;try{var i=t.__wbindgen_add_to_stack_pointer(-16),a=s(n,t.__wbindgen_export,t.__wbindgen_export2),d=u;t.str_trunc(i,a,d);var g=r().getInt32(i+0,!0),w=r().getInt32(i+4,!0),b=r().getInt32(i+8,!0),c=r().getInt32(i+12,!0),f=g,x=w;if(c)throw f=0,x=0,p(b);return _=f,e=x,o(f,x)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export3(_,e,1)}};
|