a-calc 3.0.0-beta.20260105 → 3.0.0-beta.20260124.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/es/index.js CHANGED
@@ -1,8 +1,10 @@
1
- function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],_=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;_=!1}else for(;!(_=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);_=!0);}catch(e){u=!0,i=e}finally{try{if(!_&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function _(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{_({},"")}catch(e){_=function(e,t,r){return e[t]=r}}function u(e,t,r,i){var a=t&&t.prototype instanceof d?t:d,o=Object.create(a.prototype),s=new A(i||[]);return n(o,"_invoke",{value:y(e,r,s)}),o}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l={};function d(){}function f(){}function p(){}var m={};_(m,a,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(T([])));v&&v!==t&&r.call(v,a)&&(m=v);var h=p.prototype=d.prototype=Object.create(m);function w(e){["next","throw","return"].forEach((function(t){_(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,a,o,s){var _=c(e[n],e,a);if("throw"!==_.type){var u=_.arg,l=u.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){i("next",e,o,s)}),(function(e){i("throw",e,o,s)})):t.resolve(l).then((function(e){u.value=e,o(u)}),(function(e){return i("throw",e,o,s)}))}s(_.arg)}var a;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return a=a?a.then(n,n):n()}})}function y(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return D()}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=x(o,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var _=c(e,t,r);if("normal"===_.type){if(n=r.done?"completed":"suspendedYield",_.arg===l)continue;return{value:_.arg,done:r.done}}"throw"===_.type&&(n="completed",r.method="throw",r.arg=_.arg)}}}function x(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),l;var i=c(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,l;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function T(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:D}}function D(){return{value:void 0,done:!0}}return f.prototype=p,n(h,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=_(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,_(e,s,"GeneratorFunction")),e.prototype=Object.create(h),e},e.awrap=function(e){return{__await:e}},w(b.prototype),_(b.prototype,o,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new b(u(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},w(h),_(h,s,"Generator"),_(h,a,(function(){return this})),_(h,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=T,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),_=r.call(a,"finallyLoc");if(s&&_){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!_)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,l):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;E(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function asyncGeneratorStep(e,t,r,n,i,a,o){try{var s=e[a](o),_=s.value}catch(e){return void r(e)}s.done?t(_):Promise.resolve(_).then(n,i)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep(a,n,i,o,s,"throw",e)}o(void 0)}))}}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:String(t)}var version="3.0.0-beta.20260105";function decimal_round(e,t,r,n,i){var a=e.startsWith("-"),o=a?e.slice(1):e,s=o,_=t,u=t.length;function c(){s=(+s+1).toString()}var l={"~-":function(){var e="<"===r?n-1:n;_=t.slice(0,e)},"~+":function(){var e="<"===r?n-1:n;if(!(u<=e||0===u)){var i=t.slice(0,e);0==+t.slice(e,u)?_=i:(i=(+"9".concat(i)+1).toString().slice(1)).length>e?(_=i.slice(1,i.length),c()):_=i}},"~5":function(){if(0!==u){var e="<"===r?n-1:n;_=t.slice(0,e);var i=+t[e];Number.isNaN(i)||i>=5&&(_=(+"9".concat(_)+1).toString().slice(1)).length>e&&(_=_.slice(1,_.length),c())}},"~6":function(){if(0!==u){var e,i="<"===r?n-1:n,a=+t[i],s=t.slice(+i+1,t.length);s=""===s?0:parseInt(s),e=0===i?+o[o.length-1]:+t[i-1],_=t.slice(0,i),(a>=6||5===a&&s>0||5===a&&e%2!=0)&&(_=(+"9".concat(_)+1).toString().slice(1)).length>i&&(_=_.slice(1,_.length),c())}}};return"<="===r?u<=n?_=t.replace(/0*$/,""):(l[i]&&l[i](),_=_.replace(/0+$/,"")):"<"===r?u<n?_=t.replace(/0*$/,""):(l[i]&&l[i](),_=_.replace(/0+$/,"")):"="===r?u<n?_=t+"0".repeat(n-u):u>n&&l[i]&&l[i]():">="===r?u<n&&(_=t+"0".repeat(n-u)):">"===r&&u<=n&&(_=t+"0".repeat(n-u+1)),{int_part:a?"-".concat(s):s,dec_part:_}}var number_char="0123456789",var_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",number_first_char="0123456789-+",var_members_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$[].'\"",var_first_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",pure_number_var_first_char="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",empty_char=" \n\r\t",number_char_set=new Set(number_char),var_char_set=new Set(var_char),var_members_char_set=new Set(var_members_char),var_first_char_set=new Set(var_first_char);new Set(number_first_char);var pure_number_var_first_char_set=new Set(pure_number_var_first_char),empty_char_set=new Set(empty_char),state_initial="initial",state_number="number",state_scientific="scientific",state_operator="operator",state_bracket="bracket",state_var="var",state_symbol="symbol",state_percent="percent",state_round="round",state_plus="plus",state_comma="comma",state_fraction="fraction",state_to_number="to-number",state_to_number_string="to-number-string",state_fallback_var="fallback_var",state_integer_padding="integer_padding",state_volume="volume",state_unit_after="unit_after",state_unit_before="unit_before",state_unit_middle="unit_middle",state_unit_hide="unit_hide",state_unit_default="unit_default",state_thousands="thousands",state_comparison="comparison",state_logical="logical",state_logical_not="logical_not",state_ternary_question="ternary_question",state_ternary_colon="ternary_colon",state_function="function",state_range_start="range_start",state_range_end="range_end",state_range_clamp="range_clamp",comparison_operators=new Set([">","<",">=","<=","==","!="]),logical_operators=new Set(["&&","||"]),operator_precedence={"|":0,"?":1,":":1,"||":2,"&&":3,"==":4,"!=":4,">":5,"<":5,">=":5,"<=":5,"+":6,"-":6,"*":7,"/":7,"%":7,"//":7,"**":8,"!":9,"unary-":9,"unary+":9},isArray=Array.isArray,freeGlobal="object"==("undefined"==typeof global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),_Symbol=root.Symbol,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol?_Symbol.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty$3.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol?_Symbol.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return null!=e&&"object"==_typeof(e)}var symbolTag="[object Symbol]";function isSymbol(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag(e)==symbolTag}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray(e))return!1;var r=_typeof(e);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}function isObject(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var coreJsData=root["__core-js_shared__"],maskSrcKey=(uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||""),uid?"Symbol(src)_1."+uid:""),uid;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,t){return null==e?void 0:e[t]}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}var nativeCreate=getNative(Object,"create");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet(e){var t=this.__data__;if(nativeCreate){var r=t[e];return r===HASH_UNDEFINED$1?void 0:r}return hasOwnProperty$1.call(t,e)?t[e]:void 0}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas(e){var t=this.__data__;return nativeCreate?void 0!==t[e]:hasOwnProperty.call(t,e)}var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,t){return e===t||e!=e&&t!=t}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),--this.size,!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map=getNative(root,"Map");function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function isKeyable(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=t?1:0,t}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT="Expected a function";function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function r(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(memoize.Cache||MapCache),r}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize(e,(function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e})),r=t.cache;return t}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,(function(e,r,n,i){t.push(n?i.replace(reEscapeChar,"$1"):r||e)})),t}));function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var symbolProto=_Symbol?_Symbol.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function toString(e){return null==e?"":baseToString(e)}function castPath(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function baseGet(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function get(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}var REG_UNIT_NUM_SCIENTIFIC=/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,REG_UNIT_NUM_NORMAL=/^([+-]?[\d.]+)(.*)$/;function split_unit_num(e){var t,r,n=(e="string"!=typeof e?e.toString():e).match(REG_UNIT_NUM_SCIENTIFIC)||e.match(REG_UNIT_NUM_NORMAL);if(n){r=n[1];var i=n[2];""!==i.trim()&&(t=i)}return{num:r,unit:t}}function find_value(e,t,r){var n,i,a,o;return Array.isArray(e)?e.length>1?null!==(n=null!==(i=get(e[0],t))&&void 0!==i?i:get(e.at(-1),t))&&void 0!==n?n:r:1===e.length&&null!==(a=get(e[0],t))&&void 0!==a?a:r:null!==(o=get(e,t,r))&&void 0!==o?o:r}function parse_mantissa(e,t,r,n){var i=e.split("."),a=i[0],o=1===i.length?"":i[1],s=decimal_round(a,o,t,+r,n);return a=s.int_part,""===(o=s.dec_part)?a:"".concat(a,".").concat(o)}function integer_thousands(e){for(var t=e.length,r="";t>0;)r=e.substring(t-3,t)+(""!==r?",":"")+r,t-=3;return r}function parse_thousands(e){var t=e.split("."),r=t[0];return"-"===r[0]?t[0]="-"+integer_thousands(r.slice(1)):t[0]=integer_thousands(r),t.join(".")}function promise_queue(e){return _promise_queue.apply(this,arguments)}function _promise_queue(){return _promise_queue=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,a=arguments;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=a.length>1&&void 0!==a[1]?a[1]:5e3,n=0;case 2:if(!(n<t.length)){e.next=16;break}return e.prev=3,e.next=6,Promise.race([t[n],new Promise((function(e,t){setTimeout((function(){return t(new Error("promise queue timeout err"))}),r)}))]);case 6:i=e.sent,e.next=12;break;case 9:return e.prev=9,e.t0=e.catch(3),e.abrupt("continue",13);case 12:return e.abrupt("return",i);case 13:n++,e.next=2;break;case 16:return e.abrupt("return",Promise.reject("错误的 promise queue 调用"));case 17:case"end":return e.stop()}}),e,null,[[3,9]])}))),_promise_queue.apply(this,arguments)}function test_urls(e){return _test_urls.apply(this,arguments)}function _test_urls(){return(_test_urls=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=0;case 1:if(!(r<t.length)){e.next=16;break}return e.prev=2,e.next=5,fetch(t[r]);case 5:if(!e.sent.ok){e.next=8;break}return e.abrupt("return",t[r]);case 8:e.next=13;break;case 10:return e.prev=10,e.t0=e.catch(2),e.abrupt("continue",13);case 13:r++,e.next=1;break;case 16:return e.abrupt("return",null);case 17:case"end":return e.stop()}}),e,null,[[2,10]])})))).apply(this,arguments)}function get_real_value(e,t){if(Array.isArray(e)){for(var r,n=0,i=e.length;n<i;n++){var a;if(void 0!==(r=null!==(a=get(e[n],t))&&void 0!==a?a:void 0))break}if(void 0===r)throw new Error("填充变量".concat(t,"失败"));return r}var o;return null!==(o=get(e,t))&&void 0!==o?o:void 0}function is_empty_for_fallback(e,t,r){return r&&"function"==typeof r._empty_check?r._empty_check(e,t):r&&Array.isArray(r._empty_values)?r._empty_values.some((function(t){return!(!Number.isNaN(t)||!Number.isNaN(e))||e===t})):null==e}function get_fallback_value(e,t,r){for(var n=0;n<t.length;n++){var i=t[n].trim(),a=void 0;try{if(Array.isArray(e))for(var o=0;o<e.length;o++){var s=get(e[o],i);if(void 0!==s){a=s;break}}else a=get(e,i)}catch(e){continue}if(!is_empty_for_fallback(a,i,r))return{value:a,path:i}}throw new Error("多路取值失败,所有路径均为空值: ".concat(t.join(" | ")))}function get_next_nonempty_char(e,t,r){var n;for(t++;t<r;){if(n=e[t],!empty_char_set.has(n))return n;t++}}function split_expr_and_fmt(e){for(var t=0,r=0;r<e.length;r++){var n=e[r];if("("===n)t++;else if(")"===n)t--;else if("|"===n&&0===t){if(r+1<e.length&&"|"===e[r+1]){r++;continue}return{expr:e.slice(0,r),fmt:e.slice(r+1).trim()}}}return{expr:e,fmt:""}}function parse_args(e,t){var r,n,i="",a={origin_expr:e,origin_fill_data:t,expr:"",fmt_expr:"",options:void 0,fill_data:void 0,_unit:void 0,_mode:void 0,_fmt:void 0,_empty_values:void 0,_empty_check:void 0,_volume_units:void 0,_volume_step:void 0,_presets:void 0,_unit_to:void 0,_unit_from:void 0,_unit_default_to:void 0,_unit_default_from:void 0,_unit_position:void 0,_unit_positions:void 0,_thousands_presets:void 0,_unit_thousands:void 0};if(null!=t&&(a.options=t,Array.isArray(t)?a.fill_data=t:Array.isArray(t._fill_data)?a.fill_data=[t].concat(_toConsumableArray(t._fill_data)):void 0===t._fill_data?a.fill_data=[t]:a.fill_data=[t,t._fill_data]),a._mode=find_value(t,"_mode","normal"),a._unit=find_value(t,"_unit",!1),a._fmt=find_value(t,"_fmt"),a._empty_values=find_value(t,"_empty_values"),a._empty_check=find_value(t,"_empty_check"),a._volume_units=find_value(t,"_volume_units"),a._volume_step=find_value(t,"_volume_step"),a._presets=find_value(t,"_presets"),a._unit_to=null!==(r=find_value(t,"_unit_to"))&&void 0!==r?r:find_value(t,"_unit_out"),a._unit_from=find_value(t,"_unit_from"),a._unit_default_to=null!==(n=find_value(t,"_unit_default_to"))&&void 0!==n?n:find_value(t,"_unit_default_out"),a._unit_default_from=find_value(t,"_unit_default_from"),a._unit_position=find_value(t,"_unit_position"),a._unit_positions=find_value(t,"_unit_positions"),a._thousands_presets=find_value(t,"_thousands_presets"),a._unit_thousands=find_value(t,"_unit_thousands"),"string"==typeof e){if(i=e,""===e.trim()||e.includes("NaN"))throw new Error("非法的表达式:".concat(e))}else{if("number"!=typeof e)throw new Error("错误的第一个参数类型: ".concat(e," 类型为:").concat(_typeof(e)));if(isNaN(e))throw new Error("传入了一个非法数字NaN");i=e.toString()}var o=split_expr_and_fmt(i),s=o.expr,_=o.fmt;return a.expr=s,a.fmt_expr=_,a}function detect_fallback_var$1(e,t){if("("!==e[t])return null;for(var r=0,n=!1,i=[],a="",o=t;o<e.length;){var s=e[o];if("("===s){if(0===r){r++,o++;continue}r++,a+=s}else if(")"===s){if(0===--r)return n?(i.push(a.trim()),{paths:i,end_index:o}):null;a+=s}else"|"===s&&1===r?(n=!0,i.push(a.trim()),a=""):a+=s;o++}return null}function detect_function_call(e,t,r){for(var n=t;n<e.length&&" "===e[n];)n++;return n<e.length&&"("===e[n]}function parse_function_args(e,t){if("("!==e[t])return null;for(var r=1,n=[],i="",a=t+1;a<e.length&&r>0;){var o=e[a];if("("===o)r++,i+=o;else if(")"===o){if(0===--r)return i.trim()&&n.push(i.trim()),{args:n,end_index:a};i+=o}else","===o&&1===r?(n.push(i.trim()),i=""):i+=o;a++}return null}function push_token$3(e,t){if(t.curr_state===state_number||t.curr_state===state_scientific){var r=t.expr.slice(t.prev_index,t.cur_index);if("+"===r||"-"===r)return e.push({type:state_operator,value:r}),t.curr_state=state_initial,void(t.prev_index=t.cur_index);if(t._unit){var n,i=split_unit_num(r),a=i.num,o=i.unit;if(void 0===o)e.push({type:state_number,value:a,real_value:a,has_unit:!1});else t.has_unit=!0,null!==(n=t.unit_str)&&void 0!==n||(t.unit_str=o),e.push({type:state_number,value:a,real_value:a,has_unit:!0,unit:o})}else e.push({type:state_number,value:r,real_value:r,has_unit:!1})}else if(t.curr_state===state_var){t.has_var=!0;var s=t.expr.slice(t.prev_index,t.cur_index);if("true"===s)e.push({type:"boolean",value:!0});else if("false"===s)e.push({type:"boolean",value:!1});else if(detect_function_call(t.expr,t.cur_index)){for(var _=t.cur_index;_<t.expr.length&&" "===t.expr[_];)_++;var u=parse_function_args(t.expr,_);if(u)return e.push({type:state_function,value:s,args:u.args}),t.cur_index=u.end_index+1,t.prev_index=t.cur_index,void(t.curr_state=state_initial)}else{var c=get_real_value(t.fill_data,s);if("function"==typeof c){for(var l=t.cur_index;l<t.expr.length&&" "===t.expr[l];)l++;if(l<t.expr.length&&"("===t.expr[l]){var d=parse_function_args(t.expr,l);if(d)return e.push({type:state_function,value:s,args:d.args,fn:c}),t.cur_index=d.end_index+1,t.prev_index=t.cur_index,void(t.curr_state=state_initial)}}if(t._unit){var f,p=split_unit_num(c),m=p.num,g=p.unit;if(void 0===g)e.push({type:"var",value:s,real_value:m,has_unit:!1});else t.has_unit=!0,null!==(f=t.unit_str)&&void 0!==f||(t.unit_str=g),e.push({type:"var",value:s,real_value:m,has_unit:!0,unit:g})}else e.push({type:"var",value:s,real_value:c,has_unit:!1})}}else e.push({type:t.curr_state,value:t.expr.slice(t.prev_index,t.cur_index)});t.curr_state=state_initial,t.prev_index=t.cur_index}function tokenizer(e,t,r,n){for(var i,a={has_var:!1,has_unit:!1,unit_str:void 0,fill_data:t,cur_index:0,prev_index:0,curr_state:state_initial,expr:e,_unit:r},o=e.length,s=[];a.cur_index<o;)switch(i=e[a.cur_index],a.curr_state){case state_initial:if(number_char_set.has(i))a.curr_state=state_number,a.cur_index++;else if(" "===i)a.cur_index++,a.prev_index=a.cur_index;else if("+-".includes(i)){var _=s.at(-1);0===a.cur_index||"operator"===(null==_?void 0:_.type)||"comparison"===(null==_?void 0:_.type)||"logical"===(null==_?void 0:_.type)||"logical_not"===(null==_?void 0:_.type)||"ternary_question"===(null==_?void 0:_.type)||"ternary_colon"===(null==_?void 0:_.type)||"("===(null==_?void 0:_.value)||"["===(null==_?void 0:_.value)||","===(null==_?void 0:_.value)?(a.curr_state=state_number,a.cur_index++):(a.cur_index++,s.push({type:state_operator,value:e.slice(a.prev_index,a.cur_index)}),a.prev_index=a.cur_index)}else if("*/%".includes(i))a.curr_state=state_operator,a.cur_index++;else if(">"===i)a.cur_index++,a.cur_index<o&&"="===e[a.cur_index]?(a.cur_index++,s.push({type:state_comparison,value:">="})):s.push({type:state_comparison,value:">"}),a.prev_index=a.cur_index;else if("<"===i)a.cur_index++,a.cur_index<o&&"="===e[a.cur_index]?(a.cur_index++,s.push({type:state_comparison,value:"<="})):s.push({type:state_comparison,value:"<"}),a.prev_index=a.cur_index;else if("="===i&&a.cur_index+1<o&&"="===e[a.cur_index+1])a.cur_index+=2,s.push({type:state_comparison,value:"=="}),a.prev_index=a.cur_index;else if("!"===i&&a.cur_index+1<o&&"="===e[a.cur_index+1])a.cur_index+=2,s.push({type:state_comparison,value:"!="}),a.prev_index=a.cur_index;else if("&"===i&&a.cur_index+1<o&&"&"===e[a.cur_index+1])a.cur_index+=2,s.push({type:state_logical,value:"&&"}),a.prev_index=a.cur_index;else if("|"===i&&a.cur_index+1<o&&"|"===e[a.cur_index+1])a.cur_index+=2,s.push({type:state_logical,value:"||"}),a.prev_index=a.cur_index;else if("!"===i)a.cur_index++,s.push({type:state_logical_not,value:"!"}),a.prev_index=a.cur_index;else if("?"===i)a.cur_index++,s.push({type:state_ternary_question,value:"?"}),a.prev_index=a.cur_index;else if(":"===i)a.cur_index++,s.push({type:state_ternary_colon,value:":"}),a.prev_index=a.cur_index;else if("["===i)a.cur_index++,s.push({type:state_range_start,value:"["}),a.prev_index=a.cur_index;else if("]"===i)a.cur_index++,s.push({type:state_range_end,value:"]"}),a.prev_index=a.cur_index;else if(","===i)a.cur_index++,s.push({type:"comma",value:","}),a.prev_index=a.cur_index;else if(var_char_set.has(i))a.curr_state=state_var,a.cur_index++;else if('"'===i||"'"===i){var u=i;a.cur_index++;for(var c="";a.cur_index<o&&e[a.cur_index]!==u;)"\\"===e[a.cur_index]&&a.cur_index+1<o?(a.cur_index++,c+=e[a.cur_index]):c+=e[a.cur_index],a.cur_index++;a.cur_index++,s.push({type:"string",value:c}),a.prev_index=a.cur_index}else if("("===i){var l=detect_fallback_var$1(e,a.cur_index);if(l){a.has_var=!0;var d=get_fallback_value(t,l.paths,n),f=d.value,p=d.path;if(r){var m,g=split_unit_num(f),v=g.num,h=g.unit;if(void 0!==h)a.has_unit=!0,null!==(m=a.unit_str)&&void 0!==m||(a.unit_str=h),s.push({type:state_fallback_var,value:l.paths,real_value:v,matched_path:p,has_unit:!0,unit:h});else s.push({type:state_fallback_var,value:l.paths,real_value:v,matched_path:p,has_unit:!1})}else s.push({type:state_fallback_var,value:l.paths,real_value:f,matched_path:p,has_unit:!1});a.cur_index=l.end_index+1,a.prev_index=a.cur_index}else s.push({type:state_bracket,value:i}),a.curr_state=state_initial,a.cur_index++,a.prev_index=a.cur_index}else")"===i?(s.push({type:state_bracket,value:i}),a.curr_state=state_initial,a.cur_index++,a.prev_index=a.cur_index):(a.cur_index++,a.prev_index=a.cur_index);break;case state_number:if(number_char_set.has(i))a.cur_index++;else if("."===i){if(a.cur_index===a.prev_index||e.slice(a.prev_index,a.cur_index).includes("."))throw new Error("非法的小数部分".concat(e.slice(a.prev_index,a.cur_index)));a.cur_index++}else"e"===i?(a.curr_state=state_scientific,a.cur_index++):r?"*/+-() ".indexOf(i)>-1||">"===i||"<"===i||"="===i||"!"===i||"&"===i||"|"===i||"?"===i||":"===i||"["===i||"]"===i||","===i||"%"===i&&number_char_set.has(e[a.cur_index-1])&&pure_number_var_first_char_set.has(get_next_nonempty_char(e,a.cur_index,o))?push_token$3(s,a):a.cur_index++:push_token$3(s,a);break;case state_operator:var w=e[a.cur_index-1];"*"===i&&"*"===w?(a.cur_index++,s.push({type:state_operator,value:"**"}),a.prev_index=a.cur_index):"/"===i&&"/"===w?(a.cur_index++,s.push({type:state_operator,value:"//"}),a.prev_index=a.cur_index):(s.push({type:state_operator,value:w}),a.prev_index=a.cur_index),a.curr_state=state_initial;break;case state_var:var_members_char_set.has(i)?a.cur_index++:push_token$3(s,a);break;case state_scientific:if(number_char_set.has(i))a.cur_index++;else if("+-".includes(i)){var b=a.prev_index;"+-".includes(e[b])&&(b+=1);var y=e.slice(b,a.cur_index),x=y.at(-1);y.includes(i)||"e"!==x?push_token$3(s,a):a.cur_index++}else r&&-1==="*/+-() ".indexOf(i)&&">"!==i&&"<"!==i&&"="!==i&&"!"!==i&&"&"!==i&&"|"!==i&&"?"!==i&&":"!==i&&"["!==i&&"]"!==i&&","!==i?a.cur_index++:push_token$3(s,a);break;default:throw new Error("字符扫描状态错误")}return a.prev_index<a.cur_index&&push_token$3(s,a),s.has_var=a.has_var,s.has_unit=a.has_unit,s.unit=a.unit_str,s}
1
+ function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function asyncGeneratorStep(e,t,r,n,i,a,o){try{var s=e[a](o),_=s.value}catch(e){return void r(e)}s.done?t(_):Promise.resolve(_).then(n,i)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function o(e){asyncGeneratorStep(a,n,i,o,s,"next",e)}function s(e){asyncGeneratorStep(a,n,i,o,s,"throw",e)}o(void 0)})}}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterableToArrayLimit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a,o,s=[],_=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;_=!1}else for(;!(_=(n=a.call(r)).done)&&(s.push(n.value),s.length!==t);_=!0);}catch(e){u=!0,i=e}finally{try{if(!_&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function _regenerator(){
2
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
+ var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",i=r.toStringTag||"@@toStringTag";function a(r,n,i,a){var _=n&&n.prototype instanceof s?n:s,u=Object.create(_.prototype);return _regeneratorDefine(u,"_invoke",function(r,n,i){var a,s,_,u=0,c=i||[],l=!1,f={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return a=t,s=0,_=e,f.n=r,o}};function d(r,n){for(s=r,_=n,t=0;!l&&u&&!i&&t<c.length;t++){var i,a=c[t],d=f.p,p=a[2];r>3?(i=p===n)&&(_=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=d&&((i=r<2&&d<a[1])?(s=0,f.v=n,f.n=a[1]):d<p&&(i=r<3||a[0]>n||n>p)&&(a[4]=r,a[5]=n,f.n=p,s=0))}if(i||r>1)return o;throw l=!0,n}return function(i,c,p){if(u>1)throw TypeError("Generator is already running");for(l&&1===c&&d(c,p),s=c,_=p;(t=s<2?e:_)||!l;){a||(s?s<3?(s>1&&(f.n=-1),d(s,_)):f.n=_:f.v=_);try{if(u=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,_)))throw TypeError("iterator result is not an object");if(!t.done)return t;_=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(_=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(l=f.n<0)?_:r.call(n,f))!==o)break}catch(t){a=e,s=1,_=t}finally{u=1}}return{value:t,done:l}}}(r,i,a),!0),u}var o={};function s(){}function _(){}function u(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(_regeneratorDefine(t={},n,function(){return this}),t),l=u.prototype=s.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,_regeneratorDefine(e,i,"GeneratorFunction")),e.prototype=Object.create(l),e}return _.prototype=u,_regeneratorDefine(l,"constructor",u),_regeneratorDefine(u,"constructor",_),_.displayName="GeneratorFunction",_regeneratorDefine(u,i,"GeneratorFunction"),_regeneratorDefine(l),_regeneratorDefine(l,i,"Generator"),_regeneratorDefine(l,n,function(){return this}),_regeneratorDefine(l,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:a,m:f}})()}function _regeneratorDefine(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}_regeneratorDefine=function(e,t,r,n){function a(t,r){_regeneratorDefine(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},_regeneratorDefine(e,t,r,n)}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _toPrimitive(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:t+""}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}var version="3.0.0-beta.20260124.1";function decimal_round(e,t,r,n,i){var a=e.startsWith("-"),o=a?e.slice(1):e,s=o,_=t,u=t.length;function c(){s=(+s+1).toString()}var l={"~-":function(){var e="<"===r?n-1:n;_=t.slice(0,e)},"~+":function(){var e="<"===r?n-1:n;if(!(u<=e||0===u)){var i=t.slice(0,e);0===+t.slice(e,u)?_=i:(i=(+"9".concat(i)+1).toString().slice(1)).length>e?(_=i.slice(1,i.length),c()):_=i}},"~5":function(){if(0!==u){var e="<"===r?n-1:n;_=t.slice(0,e);var i=+t[e];Number.isNaN(i)||i>=5&&(_=(+"9".concat(_)+1).toString().slice(1)).length>e&&(_=_.slice(1,_.length),c())}},"~6":function(){if(0!==u){var e,i="<"===r?n-1:n,a=+t[i],s=t.slice(+i+1,t.length);s=""===s?0:parseInt(s),e=0===i?+o[o.length-1]:+t[i-1],_=t.slice(0,i),(a>=6||5===a&&s>0||5===a&&e%2!=0)&&(_=(+"9".concat(_)+1).toString().slice(1)).length>i&&(_=_.slice(1,_.length),c())}}};return"<="===r?u<=n?_=t.replace(/0*$/,""):(l[i]&&l[i](),_=_.replace(/0+$/,"")):"<"===r?u<n?_=t.replace(/0*$/,""):(l[i]&&l[i](),_=_.replace(/0+$/,"")):"="===r?u<n?_=t+"0".repeat(n-u):u>n&&l[i]&&l[i]():">="===r?u<n&&(_=t+"0".repeat(n-u)):">"===r&&u<=n&&(_=t+"0".repeat(n-u+1)),{int_part:a?"-".concat(s):s,dec_part:_}}var number_char="0123456789",var_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",number_first_char="0123456789-+",var_members_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$[].'\"",var_first_char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",pure_number_var_first_char="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$",empty_char=" \n\r\t",number_char_set=new Set(number_char),var_char_set=new Set(var_char),var_members_char_set=new Set(var_members_char),var_first_char_set=new Set(var_first_char);new Set(number_first_char);var pure_number_var_first_char_set=new Set(pure_number_var_first_char),empty_char_set=new Set(empty_char),state_initial="initial",state_number="number",state_scientific="scientific",state_operator="operator",state_bracket="bracket",state_var="var",state_symbol="symbol",state_percent="percent",state_round="round",state_plus="plus",state_comma="comma",state_fraction="fraction",state_to_number="to-number",state_to_number_string="to-number-string",state_fallback_var="fallback_var",state_integer_padding="integer_padding",state_compact="compact",state_unit_after="unit_after",state_unit_before="unit_before",state_unit_middle="unit_middle",state_unit_hide="unit_hide",state_unit_default="unit_default",state_thousands="thousands",state_fmt_group="fmt_group",state_shortcut="shortcut",state_comparison="comparison",state_logical="logical",state_logical_not="logical_not",state_ternary_question="ternary_question",state_ternary_colon="ternary_colon",state_function="function",state_range_start="range_start",state_range_end="range_end",state_range_clamp="range_clamp",comparison_operators=new Set([">","<",">=","<=","==","!="]),logical_operators=new Set(["&&","||"]),operator_precedence={"|":0,"?":1,":":1,"||":2,"&&":3,"==":4,"!=":4,">":5,"<":5,">=":5,"<=":5,"+":6,"-":6,"*":7,"/":7,"%":7,"//":7,"**":8,"!":9,"unary-":9,"unary+":9},isArray=Array.isArray,freeGlobal="object"==("undefined"==typeof global?"undefined":_typeof(global))&&global&&global.Object===Object&&global,freeSelf="object"==("undefined"==typeof self?"undefined":_typeof(self))&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),_Symbol=root.Symbol,objectProto$4=Object.prototype,hasOwnProperty$3=objectProto$4.hasOwnProperty,nativeObjectToString$1=objectProto$4.toString,symToStringTag$1=_Symbol?_Symbol.toStringTag:void 0;function getRawTag(e){var t=hasOwnProperty$3.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=void 0;var n=!0}catch(e){}var i=nativeObjectToString$1.call(e);return n&&(t?e[symToStringTag$1]=r:delete e[symToStringTag$1]),i}var objectProto$3=Object.prototype,nativeObjectToString=objectProto$3.toString;function objectToString(e){return nativeObjectToString.call(e)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=_Symbol?_Symbol.toStringTag:void 0;function baseGetTag(e){return null==e?void 0===e?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(e)?getRawTag(e):objectToString(e)}function isObjectLike(e){return null!=e&&"object"==_typeof(e)}var symbolTag="[object Symbol]";function isSymbol(e){return"symbol"==_typeof(e)||isObjectLike(e)&&baseGetTag(e)==symbolTag}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray(e))return!1;var r=_typeof(e);return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!isSymbol(e))||(reIsPlainProp.test(e)||!reIsDeepProp.test(e)||null!=t&&e in Object(t))}function isObject(e){var t=_typeof(e);return null!=e&&("object"==t||"function"==t)}var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(e){if(!isObject(e))return!1;var t=baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var coreJsData=root["__core-js_shared__"],maskSrcKey=(uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||""),uid?"Symbol(src)_1."+uid:""),uid;function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var funcProto$1=Function.prototype,funcToString$1=funcProto$1.toString;function toSource(e){if(null!=e){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto=Function.prototype,objectProto$2=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$2=objectProto$2.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$2).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){return!(!isObject(e)||isMasked(e))&&(isFunction(e)?reIsNative:reIsHostCtor).test(toSource(e))}function getValue(e,t){return null==e?void 0:e[t]}function getNative(e,t){var r=getValue(e,t);return baseIsNative(r)?r:void 0}var nativeCreate=getNative(Object,"create");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashGet(e){var t=this.__data__;if(nativeCreate){var r=t[e];return r===HASH_UNDEFINED$1?void 0:r}return hasOwnProperty$1.call(t,e)?t[e]:void 0}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function hashHas(e){var t=this.__data__;return nativeCreate?void 0!==t[e]:hasOwnProperty.call(t,e)}var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=nativeCreate&&void 0===t?HASH_UNDEFINED:t,this}function Hash(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function listCacheClear(){this.__data__=[],this.size=0}function eq(e,t){return e===t||e!=e&&t!=t}function assocIndexOf(e,t){for(var r=e.length;r--;)if(eq(e[r][0],t))return r;return-1}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=assocIndexOf(t,e);return!(r<0)&&(r==t.length-1?t.pop():splice.call(t,r,1),--this.size,!0)}function listCacheGet(e){var t=this.__data__,r=assocIndexOf(t,e);return r<0?void 0:t[r][1]}function listCacheHas(e){return assocIndexOf(this.__data__,e)>-1}function listCacheSet(e,t){var r=this.__data__,n=assocIndexOf(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function ListCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map$1=getNative(root,"Map");function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(e){var t=_typeof(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function getMapData(e,t){var r=e.__data__;return isKeyable(t)?r["string"==typeof t?"string":"hash"]:r.map}function mapCacheDelete(e){var t=getMapData(this,e).delete(e);return this.size-=t?1:0,t}function mapCacheGet(e){return getMapData(this,e).get(e)}function mapCacheHas(e){return getMapData(this,e).has(e)}function mapCacheSet(e,t){var r=getMapData(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function MapCache(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT="Expected a function";function memoize(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(FUNC_ERROR_TEXT);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(memoize.Cache||MapCache),r}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize(e,function(e){return r.size===MAX_MEMOIZE_SIZE&&r.clear(),e}),r=t.cache;return t}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(rePropName,function(e,r,n,i){t.push(n?i.replace(reEscapeChar,"$1"):r||e)}),t});function arrayMap(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var symbolProto=_Symbol?_Symbol.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(e){if("string"==typeof e)return e;if(isArray(e))return arrayMap(e,baseToString)+"";if(isSymbol(e))return symbolToString?symbolToString.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function toString(e){return null==e?"":baseToString(e)}function castPath(e,t){return isArray(e)?e:isKey(e,t)?[e]:stringToPath(toString(e))}function toKey(e){if("string"==typeof e||isSymbol(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function baseGet(e,t){for(var r=0,n=(t=castPath(t,e)).length;null!=e&&r<n;)e=e[toKey(t[r++])];return r&&r==n?e:void 0}function get(e,t,r){var n=null==e?void 0:baseGet(e,t);return void 0===n?r:n}var REG_UNIT_NUM_SCIENTIFIC=/^([+-]?[\d.]+(?:e|E)(?:\+|-)?\d+)(.*)$/,REG_UNIT_NUM_NORMAL=/^([+-]?[\d.]+)(.*)$/;function split_unit_num(e){var t,r,n=(e="string"!=typeof e?e.toString():e).match(REG_UNIT_NUM_SCIENTIFIC)||e.match(REG_UNIT_NUM_NORMAL);if(n){r=n[1];var i=n[2];""!==i.trim()&&(t=i)}return{num:r,unit:t}}function find_value(e,t,r){var n,i,a,o;return Array.isArray(e)?e.length>1?null!==(n=null!==(i=get(e[0],t))&&void 0!==i?i:get(e.at(-1),t))&&void 0!==n?n:r:1===e.length&&null!==(a=get(e[0],t))&&void 0!==a?a:r:null!==(o=get(e,t,r))&&void 0!==o?o:r}function parse_mantissa(e,t,r,n){var i=e.split("."),a=i[0],o=1===i.length?"":i[1],s=decimal_round(a,o,t,+r,n);return a=s.int_part,""===(o=s.dec_part)?a:"".concat(a,".").concat(o)}function integer_thousands(e){for(var t=e.length,r="";t>0;)r=e.substring(t-3,t)+(""!==r?",":"")+r,t-=3;return r}function parse_thousands(e){var t=e.split("."),r=t[0];return"-"===r[0]?t[0]="-"+integer_thousands(r.slice(1)):t[0]=integer_thousands(r),t.join(".")}function promise_queue(e){return _promise_queue.apply(this,arguments)}function _promise_queue(){return _promise_queue=_asyncToGenerator(_regenerator().m(function e(t){var r,n,i,a=arguments;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:r=a.length>1&&void 0!==a[1]?a[1]:5e3,n=0;case 1:if(!(n<t.length)){e.n=7;break}return e.p=2,e.n=3,Promise.race([t[n],new Promise(function(e,t){setTimeout(function(){return t(new Error("promise queue timeout err"))},r)})]);case 3:i=e.v,e.n=5;break;case 4:return e.p=4,e.v,e.a(3,6);case 5:return e.a(2,i);case 6:n++,e.n=1;break;case 7:return e.a(2,Promise.reject("错误的 promise queue 调用"))}},e,null,[[2,4]])})),_promise_queue.apply(this,arguments)}function test_urls(e){return _test_urls.apply(this,arguments)}function _test_urls(){return(_test_urls=_asyncToGenerator(_regenerator().m(function e(t){var r;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:r=0;case 1:if(!(r<t.length)){e.n=7;break}return e.p=2,e.n=3,fetch(t[r]);case 3:if(!e.v.ok){e.n=4;break}return e.a(2,t[r]);case 4:e.n=6;break;case 5:return e.p=5,e.v,e.a(3,6);case 6:r++,e.n=1;break;case 7:return e.a(2,null)}},e,null,[[2,5]])}))).apply(this,arguments)}function get_real_value(e,t){if(Array.isArray(e)){for(var r,n=0,i=e.length;n<i;n++){var a;if(void 0!==(r=null!==(a=get(e[n],t))&&void 0!==a?a:void 0))break}if(void 0===r)throw new Error("填充变量".concat(t,"失败"));return r}var o;return null!==(o=get(e,t))&&void 0!==o?o:void 0}function is_empty_for_fallback(e,t,r){return r&&"function"==typeof r._empty_check?r._empty_check(e,t):r&&Array.isArray(r._empty_values)?r._empty_values.some(function(t){return!(!Number.isNaN(t)||!Number.isNaN(e))||e===t}):null==e}function get_fallback_value(e,t,r){for(var n=0;n<t.length;n++){var i=t[n].trim(),a=void 0;try{if(Array.isArray(e))for(var o=0;o<e.length;o++){var s=get(e[o],i);if(void 0!==s){a=s;break}}else a=get(e,i)}catch(e){continue}if(!is_empty_for_fallback(a,i,r))return{value:a,path:i}}throw new Error("多路取值失败,所有路径均为空值: ".concat(t.join(" | ")))}function get_next_nonempty_char(e,t,r){var n;for(t++;t<r;){if(n=e[t],!empty_char_set.has(n))return n;t++}}function split_expr_and_fmt(e){for(var t=0,r=0;r<e.length;r++){var n=e[r];if("("===n)t++;else if(")"===n)t--;else if("|"===n&&0===t){if(r+1<e.length&&"|"===e[r+1]){r++;continue}return{expr:e.slice(0,r),fmt:e.slice(r+1).trim()}}}return{expr:e,fmt:""}}function parse_args(e,t){var r="",n={origin_expr:e,origin_fill_data:t,expr:"",fmt_expr:"",options:void 0,fill_data:void 0,_unit:void 0,_empty_values:void 0,_empty_check:void 0,_compact_units:void 0,_compact_step:void 0,_thousands:void 0};if(null!=t&&(n.options=t,Array.isArray(t)?n.fill_data=t:n.fill_data=[t]),n._unit=find_value(t,"_unit",!1),n._empty_values=find_value(t,"_empty_values"),n._empty_check=find_value(t,"_empty_check"),n._compact_units=find_value(t,"_compact_units"),n._compact_step=find_value(t,"_compact_step"),n._thousands=find_value(t,"_thousands"),"string"==typeof e){if(r=e,""===e.trim()||e.includes("NaN"))throw new Error("非法的表达式:".concat(e))}else{if("number"!=typeof e)throw new Error("错误的第一个参数类型: ".concat(e," 类型为:").concat(_typeof(e)));if(isNaN(e))throw new Error("传入了一个非法数字NaN");r=e.toString()}var i=split_expr_and_fmt(r),a=i.expr,o=i.fmt;return n.expr=a,n.fmt_expr=o,n}function detect_fallback_var$1(e,t){if("("!==e[t])return null;for(var r=0,n=!1,i=[],a="",o=t;o<e.length;){var s=e[o];if("("===s){if(0===r){r++,o++;continue}r++,a+=s}else if(")"===s){if(0===--r)return n?(i.push(a.trim()),{paths:i,end_index:o}):null;a+=s}else"|"===s&&1===r?(n=!0,i.push(a.trim()),a=""):a+=s;o++}return null}function detect_function_call(e,t,r){for(var n=t;n<e.length&&" "===e[n];)n++;return n<e.length&&"("===e[n]}function parse_function_args(e,t){if("("!==e[t])return null;for(var r=1,n=[],i="",a=t+1;a<e.length&&r>0;){var o=e[a];if("("===o)r++,i+=o;else if(")"===o){if(0===--r)return i.trim()&&n.push(i.trim()),{args:n,end_index:a};i+=o}else","===o&&1===r?(n.push(i.trim()),i=""):i+=o;a++}return null}function push_token$3(e,t){if(t.curr_state===state_number||t.curr_state===state_scientific){var r=t.expr.slice(t.prev_index,t.cur_index);if("+"===r||"-"===r)return e.push({type:state_operator,value:r}),t.curr_state=state_initial,void(t.prev_index=t.cur_index);if(t._unit){var n,i=split_unit_num(r),a=i.num,o=i.unit;if(void 0===o)e.push({type:state_number,value:a,real_value:a,has_unit:!1});else t.has_unit=!0,null!==(n=t.unit_str)&&void 0!==n||(t.unit_str=o),e.push({type:state_number,value:a,real_value:a,has_unit:!0,unit:o})}else e.push({type:state_number,value:r,real_value:r,has_unit:!1})}else if(t.curr_state===state_var){t.has_var=!0;var s=t.expr.slice(t.prev_index,t.cur_index);if("true"===s)e.push({type:"boolean",value:!0});else if("false"===s)e.push({type:"boolean",value:!1});else if(detect_function_call(t.expr,t.cur_index)){for(var _=t.cur_index;_<t.expr.length&&" "===t.expr[_];)_++;var u=parse_function_args(t.expr,_);if(u)return e.push({type:state_function,value:s,args:u.args}),t.cur_index=u.end_index+1,t.prev_index=t.cur_index,void(t.curr_state=state_initial)}else{var c=get_real_value(t.fill_data,s);if("function"==typeof c){for(var l=t.cur_index;l<t.expr.length&&" "===t.expr[l];)l++;if(l<t.expr.length&&"("===t.expr[l]){var f=parse_function_args(t.expr,l);if(f)return e.push({type:state_function,value:s,args:f.args,fn:c}),t.cur_index=f.end_index+1,t.prev_index=t.cur_index,void(t.curr_state=state_initial)}}if(t._unit){var d,p=split_unit_num(c),g=p.num,m=p.unit;if(void 0===m)e.push({type:"var",value:s,real_value:g,has_unit:!1});else t.has_unit=!0,null!==(d=t.unit_str)&&void 0!==d||(t.unit_str=m),e.push({type:"var",value:s,real_value:g,has_unit:!0,unit:m})}else e.push({type:"var",value:s,real_value:c,has_unit:!1})}}else e.push({type:t.curr_state,value:t.expr.slice(t.prev_index,t.cur_index)});t.curr_state=state_initial,t.prev_index=t.cur_index}function tokenizer(e,t,r,n){for(var i,a={has_var:!1,has_unit:!1,unit_str:void 0,fill_data:t,cur_index:0,prev_index:0,curr_state:state_initial,expr:e,_unit:r},o=e.length,s=[];a.cur_index<o;)switch(i=e[a.cur_index],a.curr_state){case state_initial:if(number_char_set.has(i))a.curr_state=state_number,a.cur_index++;else if(" "===i)a.cur_index++,a.prev_index=a.cur_index;else if("+-".includes(i)){var _=s.at(-1);0===a.cur_index||"operator"===(null==_?void 0:_.type)||"comparison"===(null==_?void 0:_.type)||"logical"===(null==_?void 0:_.type)||"logical_not"===(null==_?void 0:_.type)||"ternary_question"===(null==_?void 0:_.type)||"ternary_colon"===(null==_?void 0:_.type)||"("===(null==_?void 0:_.value)||"["===(null==_?void 0:_.value)||","===(null==_?void 0:_.value)?(a.curr_state=state_number,a.cur_index++):(a.cur_index++,s.push({type:state_operator,value:e.slice(a.prev_index,a.cur_index)}),a.prev_index=a.cur_index)}else if("*/%".includes(i))a.curr_state=state_operator,a.cur_index++;else if(">"===i)a.cur_index++,a.cur_index<o&&"="===e[a.cur_index]?(a.cur_index++,s.push({type:state_comparison,value:">="})):s.push({type:state_comparison,value:">"}),a.prev_index=a.cur_index;else if("<"===i)a.cur_index++,a.cur_index<o&&"="===e[a.cur_index]?(a.cur_index++,s.push({type:state_comparison,value:"<="})):s.push({type:state_comparison,value:"<"}),a.prev_index=a.cur_index;else if("="===i&&a.cur_index+1<o&&"="===e[a.cur_index+1])a.cur_index+=2,s.push({type:state_comparison,value:"=="}),a.prev_index=a.cur_index;else if("!"===i&&a.cur_index+1<o&&"="===e[a.cur_index+1])a.cur_index+=2,s.push({type:state_comparison,value:"!="}),a.prev_index=a.cur_index;else if("&"===i&&a.cur_index+1<o&&"&"===e[a.cur_index+1])a.cur_index+=2,s.push({type:state_logical,value:"&&"}),a.prev_index=a.cur_index;else if("|"===i&&a.cur_index+1<o&&"|"===e[a.cur_index+1])a.cur_index+=2,s.push({type:state_logical,value:"||"}),a.prev_index=a.cur_index;else if("!"===i)a.cur_index++,s.push({type:state_logical_not,value:"!"}),a.prev_index=a.cur_index;else if("?"===i)a.cur_index++,s.push({type:state_ternary_question,value:"?"}),a.prev_index=a.cur_index;else if(":"===i)a.cur_index++,s.push({type:state_ternary_colon,value:":"}),a.prev_index=a.cur_index;else if("["===i)a.cur_index++,s.push({type:state_range_start,value:"["}),a.prev_index=a.cur_index;else if("]"===i)a.cur_index++,s.push({type:state_range_end,value:"]"}),a.prev_index=a.cur_index;else if(","===i)a.cur_index++,s.push({type:"comma",value:","}),a.prev_index=a.cur_index;else if(var_char_set.has(i))a.curr_state=state_var,a.cur_index++;else if('"'===i||"'"===i){var u=i;a.cur_index++;for(var c="";a.cur_index<o&&e[a.cur_index]!==u;)"\\"===e[a.cur_index]&&a.cur_index+1<o?(a.cur_index++,c+=e[a.cur_index]):c+=e[a.cur_index],a.cur_index++;a.cur_index++,s.push({type:"string",value:c}),a.prev_index=a.cur_index}else if("("===i){var l=detect_fallback_var$1(e,a.cur_index);if(l){a.has_var=!0;var f=get_fallback_value(t,l.paths,n),d=f.value,p=f.path;if(r){var g,m=split_unit_num(d),v=m.num,h=m.unit;if(void 0!==h)a.has_unit=!0,null!==(g=a.unit_str)&&void 0!==g||(a.unit_str=h),s.push({type:state_fallback_var,value:l.paths,real_value:v,matched_path:p,has_unit:!0,unit:h});else s.push({type:state_fallback_var,value:l.paths,real_value:v,matched_path:p,has_unit:!1})}else s.push({type:state_fallback_var,value:l.paths,real_value:d,matched_path:p,has_unit:!1});a.cur_index=l.end_index+1,a.prev_index=a.cur_index}else s.push({type:state_bracket,value:i}),a.curr_state=state_initial,a.cur_index++,a.prev_index=a.cur_index}else")"===i?(s.push({type:state_bracket,value:i}),a.curr_state=state_initial,a.cur_index++,a.prev_index=a.cur_index):(a.cur_index++,a.prev_index=a.cur_index);break;case state_number:if(number_char_set.has(i))a.cur_index++;else if("."===i){if(a.cur_index===a.prev_index||e.slice(a.prev_index,a.cur_index).includes("."))throw new Error("非法的小数部分".concat(e.slice(a.prev_index,a.cur_index)));a.cur_index++}else"e"===i?(a.curr_state=state_scientific,a.cur_index++):r?"*/+-() ".indexOf(i)>-1||">"===i||"<"===i||"="===i||"!"===i||"&"===i||"|"===i||"?"===i||":"===i||"["===i||"]"===i||","===i||"%"===i&&number_char_set.has(e[a.cur_index-1])&&pure_number_var_first_char_set.has(get_next_nonempty_char(e,a.cur_index,o))?push_token$3(s,a):a.cur_index++:push_token$3(s,a);break;case state_operator:var w=e[a.cur_index-1];"*"===i&&"*"===w?(a.cur_index++,s.push({type:state_operator,value:"**"}),a.prev_index=a.cur_index):"/"===i&&"/"===w?(a.cur_index++,s.push({type:state_operator,value:"//"}),a.prev_index=a.cur_index):(s.push({type:state_operator,value:w}),a.prev_index=a.cur_index),a.curr_state=state_initial;break;case state_var:var_members_char_set.has(i)?a.cur_index++:push_token$3(s,a);break;case state_scientific:if(number_char_set.has(i))a.cur_index++;else if("+-".includes(i)){var b=a.prev_index;"+-".includes(e[b])&&(b+=1);var y=e.slice(b,a.cur_index),x=y.at(-1);y.includes(i)||"e"!==x?push_token$3(s,a):a.cur_index++}else r&&-1==="*/+-() ".indexOf(i)&&">"!==i&&"<"!==i&&"="!==i&&"!"!==i&&"&"!==i&&"|"!==i&&"?"!==i&&":"!==i&&"["!==i&&"]"!==i&&","!==i?a.cur_index++:push_token$3(s,a);break;default:throw new Error("字符扫描状态错误")}return a.prev_index<a.cur_index&&push_token$3(s,a),s.has_var=a.has_var,s.has_unit=a.has_unit,s.unit=a.unit_str,s}
2
4
  /*!
3
5
  * decimal.js v10.6.0
4
6
  * An arbitrary-precision Decimal type for JavaScript.
5
7
  * https://github.com/MikeMcl/decimal.js
6
8
  * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
7
9
  * MIT Licence
8
- */var EXP_LIMIT=9e15,MAX_DIGITS=1e9,NUMERALS="0123456789abcdef",LN10="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",PI="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",DEFAULTS={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-EXP_LIMIT,maxE:EXP_LIMIT,crypto:!1},inexact,quadrant,external=!0,decimalError="[DecimalError] ",invalidArgument=decimalError+"Invalid argument: ",precisionLimitExceeded=decimalError+"Precision limit exceeded",cryptoUnavailable=decimalError+"crypto unavailable",tag="[object Decimal]",mathfloor=Math.floor,mathpow=Math.pow,isBinary=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,isHex=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,isOctal=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,isDecimal=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,BASE=1e7,LOG_BASE=7,MAX_SAFE_INTEGER=9007199254740991,LN10_PRECISION=LN10.length-1,PI_PRECISION=PI.length-1,P={toStringTag:tag};function digitsToString(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)n=e[t]+"",(r=LOG_BASE-n.length)&&(a+=getZeroString(r)),a+=n;o=e[t],(r=LOG_BASE-(n=o+"").length)&&(a+=getZeroString(r))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}function checkInt32(e,t,r){if(e!==~~e||e<t||e>r)throw Error(invalidArgument+e)}function checkRoundingDigits(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=LOG_BASE,i=0):(i=Math.ceil((t+1)/LOG_BASE),t%=LOG_BASE),a=mathpow(10,LOG_BASE-t),s=e[i]%a|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),o=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(e[i+1]/a/100|0)==mathpow(10,t-2)-1||(s==a/2||0==s)&&0==(e[i+1]/a/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),o=(n||r<4)&&9999==s||!n&&r>3&&4999==s):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==mathpow(10,t-3)-1,o}function convertBase(e,t,r){for(var n,i,a=[0],o=0,s=e.length;o<s;){for(i=a.length;i--;)a[i]*=t;for(a[0]+=NUMERALS.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}function cosine(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/tinyPow(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=taylorSeries(e,1,t.times(i),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}P.absoluteValue=P.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),finalise(e)},P.ceil=function(){return finalise(new this.constructor(this),this.e+1,2)},P.clampedTo=P.clamp=function(e,t){var r=this,n=r.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(invalidArgument+t);return r.cmp(e)<0?e:r.cmp(t)>0?t:new n(r)},P.comparedTo=P.cmp=function(e){var t,r,n,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,_=a.s,u=e.s;if(!o||!s)return _&&u?_!==u?_:o===s?0:!o^_<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?_:s[0]?-u:0;if(_!==u)return _;if(a.e!==e.e)return a.e>e.e^_<0?1:-1;for(t=0,r=(n=o.length)<(i=s.length)?n:i;t<r;++t)if(o[t]!==s[t])return o[t]>s[t]^_<0?1:-1;return n===i?0:n>i^_<0?1:-1},P.cosine=P.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+LOG_BASE,n.rounding=1,r=cosine(n,toLessThanHalfPi(n,r)),n.precision=e,n.rounding=t,finalise(2==quadrant||3==quadrant?r.neg():r,e,t,!0)):new n(1):new n(NaN)},P.cubeRoot=P.cbrt=function(){var e,t,r,n,i,a,o,s,_,u,c=this,l=c.constructor;if(!c.isFinite()||c.isZero())return new l(c);for(external=!1,(a=c.s*mathpow(c.s*c,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=digitsToString(c.d),(a=((e=c.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=mathpow(r,1/3),e=mathfloor((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=c.s),o=(e=l.precision)+3;;)if(u=(_=(s=n).times(s).times(s)).plus(c),n=divide(u.plus(c).times(s),u.plus(_),o+2,1),digitsToString(s.d).slice(0,o)===(r=digitsToString(n.d)).slice(0,o)){if("9999"!=(r=r.slice(o-3,o+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(finalise(n,e+1,1),t=!n.times(n).times(n).eq(c));break}if(!i&&(finalise(s,e+1,0),s.times(s).times(s).eq(c))){n=s;break}o+=4,i=1}return external=!0,finalise(n,e,l.rounding,t)},P.decimalPlaces=P.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-mathfloor(this.e/LOG_BASE))*LOG_BASE,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},P.dividedBy=P.div=function(e){return divide(this,new this.constructor(e))},P.dividedToIntegerBy=P.divToInt=function(e){var t=this.constructor;return finalise(divide(this,new t(e),0,1,1),t.precision,t.rounding)},P.equals=P.eq=function(e){return 0===this.cmp(e)},P.floor=function(){return finalise(new this.constructor(this),this.e+1,3)},P.greaterThan=P.gt=function(e){return this.cmp(e)>0},P.greaterThanOrEqualTo=P.gte=function(e){var t=this.cmp(e);return 1==t||0===t},P.hyperbolicCosine=P.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?t=(1/tinyPow(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=taylorSeries(o,1,a.times(t),new o(1),!0);for(var _,u=e,c=new o(8);u--;)_=a.times(a),a=s.minus(_.times(c.minus(_.times(c))));return finalise(a,o.precision=r,o.rounding=n,!0)},P.hyperbolicSine=P.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=taylorSeries(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=taylorSeries(a,2,i=i.times(1/tinyPow(5,e)),i,!0);for(var o,s=new a(5),_=new a(16),u=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(_.times(o).plus(u))))}return a.precision=t,a.rounding=r,finalise(i,t,r,!0)},P.hyperbolicTangent=P.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,divide(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},P.inverseCosine=P.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return-1!==r?0===r?e.isNeg()?getPi(t,n,i):new t(0):new t(NaN):e.isZero()?getPi(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},P.inverseHyperbolicCosine=P.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,external=!1,r=r.times(r).minus(1).sqrt().plus(r),external=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},P.inverseHyperbolicSine=P.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,external=!1,r=r.times(r).plus(1).sqrt().plus(r),external=!0,n.precision=e,n.rounding=t,r.ln())},P.inverseHyperbolicTangent=P.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?finalise(new a(i),e,t,!0):(a.precision=r=n-i.e,i=divide(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},P.inverseSine=P.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==t?0===t?((e=getPi(a,r+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))},P.inverseTangent=P.atan=function(){var e,t,r,n,i,a,o,s,_,u=this,c=u.constructor,l=c.precision,d=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&l+4<=PI_PRECISION)return(o=getPi(c,l+4,d).times(.25)).s=u.s,o}else{if(!u.s)return new c(NaN);if(l+4<=PI_PRECISION)return(o=getPi(c,l+4,d).times(.5)).s=u.s,o}for(c.precision=s=l+10,c.rounding=1,e=r=Math.min(28,s/LOG_BASE+2|0);e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(external=!1,t=Math.ceil(s/LOG_BASE),n=1,_=u.times(u),o=new c(u),i=u;-1!==e;)if(i=i.times(_),a=o.minus(i.div(n+=2)),i=i.times(_),void 0!==(o=a.plus(i.div(n+=2))).d[t])for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),external=!0,finalise(o,c.precision=l,c.rounding=d,!0)},P.isFinite=function(){return!!this.d},P.isInteger=P.isInt=function(){return!!this.d&&mathfloor(this.e/LOG_BASE)>this.d.length-2},P.isNaN=function(){return!this.s},P.isNegative=P.isNeg=function(){return this.s<0},P.isPositive=P.isPos=function(){return this.s>0},P.isZero=function(){return!!this.d&&0===this.d[0]},P.lessThan=P.lt=function(e){return this.cmp(e)<0},P.lessThanOrEqualTo=P.lte=function(e){return this.cmp(e)<1},P.logarithm=P.log=function(e){var t,r,n,i,a,o,s,_,u=this,c=u.constructor,l=c.precision,d=c.rounding;if(null==e)e=new c(10),t=!0;else{if(r=(e=new c(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new c(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new c(r&&!r[0]?-1/0:1!=u.s?NaN:r?0:1/0);if(t)if(r.length>1)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}if(external=!1,o=naturalLogarithm(u,s=l+5),n=t?getLn10(c,s+10):naturalLogarithm(e,s),checkRoundingDigits((_=divide(o,n,s,1)).d,i=l,d))do{if(o=naturalLogarithm(u,s+=10),n=t?getLn10(c,s+10):naturalLogarithm(e,s),_=divide(o,n,s,1),!a){+digitsToString(_.d).slice(i+1,i+15)+1==1e14&&(_=finalise(_,l+1,0));break}}while(checkRoundingDigits(_.d,i+=10,d));return external=!0,finalise(_,l,d)},P.minus=P.sub=function(e){var t,r,n,i,a,o,s,_,u,c,l,d,f=this,p=f.constructor;if(e=new p(e),!f.d||!e.d)return f.s&&e.s?f.d?e.s=-e.s:e=new p(e.d||f.s!==e.s?f:NaN):e=new p(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.plus(e);if(u=f.d,d=e.d,s=p.precision,_=p.rounding,!u[0]||!d[0]){if(d[0])e.s=-e.s;else{if(!u[0])return new p(3===_?-0:0);e=new p(f)}return external?finalise(e,s,_):e}if(r=mathfloor(e.e/LOG_BASE),c=mathfloor(f.e/LOG_BASE),u=u.slice(),a=c-r){for((l=a<0)?(t=u,a=-a,o=d.length):(t=d,r=c,o=u.length),a>(n=Math.max(Math.ceil(s/LOG_BASE),o)+2)&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((l=(n=u.length)<(o=d.length))&&(o=n),n=0;n<o;n++)if(u[n]!=d[n]){l=u[n]<d[n];break}a=0}for(l&&(t=u,u=d,d=t,e.s=-e.s),o=u.length,n=d.length-o;n>0;--n)u[o++]=0;for(n=d.length;n>a;){if(u[--n]<d[n]){for(i=n;i&&0===u[--i];)u[i]=BASE-1;--u[i],u[n]+=BASE}u[n]-=d[n]}for(;0===u[--o];)u.pop();for(;0===u[0];u.shift())--r;return u[0]?(e.d=u,e.e=getBase10Exponent(u,r),external?finalise(e,s,_):e):new p(3===_?-0:0)},P.modulo=P.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?finalise(new n(r),n.precision,n.rounding):(external=!1,9==n.modulo?(t=divide(r,e.abs(),0,3,1)).s*=e.s:t=divide(r,e,0,n.modulo,1),t=t.times(e),external=!0,r.minus(t))},P.naturalExponential=P.exp=function(){return naturalExponential(this)},P.naturalLogarithm=P.ln=function(){return naturalLogarithm(this)},P.negated=P.neg=function(){var e=new this.constructor(this);return e.s=-e.s,finalise(e)},P.plus=P.add=function(e){var t,r,n,i,a,o,s,_,u,c,l=this,d=l.constructor;if(e=new d(e),!l.d||!e.d)return l.s&&e.s?l.d||(e=new d(e.d||l.s===e.s?l:NaN)):e=new d(NaN),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(u=l.d,c=e.d,s=d.precision,_=d.rounding,!u[0]||!c[0])return c[0]||(e=new d(l)),external?finalise(e,s,_):e;if(a=mathfloor(l.e/LOG_BASE),n=mathfloor(e.e/LOG_BASE),u=u.slice(),i=a-n){for(i<0?(r=u,i=-i,o=c.length):(r=c,n=a,o=u.length),i>(o=(a=Math.ceil(s/LOG_BASE))>o?a+1:o+1)&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((o=u.length)-(i=c.length)<0&&(i=o,r=c,c=u,u=r),t=0;i;)t=(u[--i]=u[i]+c[i]+t)/BASE|0,u[i]%=BASE;for(t&&(u.unshift(t),++n),o=u.length;0==u[--o];)u.pop();return e.d=u,e.e=getBase10Exponent(u,n),external?finalise(e,s,_):e},P.precision=P.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(invalidArgument+e);return r.d?(t=getPrecision(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},P.round=function(){var e=this,t=e.constructor;return finalise(new t(e),e.e+1,t.rounding)},P.sine=P.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+LOG_BASE,n.rounding=1,r=sine(n,toLessThanHalfPi(n,r)),n.precision=e,n.rounding=t,finalise(quadrant>2?r.neg():r,e,t,!0)):new n(NaN)},P.squareRoot=P.sqrt=function(){var e,t,r,n,i,a,o=this,s=o.d,_=o.e,u=o.s,c=o.constructor;if(1!==u||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);for(external=!1,0==(u=Math.sqrt(+o))||u==1/0?(((t=digitsToString(s)).length+_)%2==0&&(t+="0"),u=Math.sqrt(t),_=mathfloor((_+1)/2)-(_<0||_%2),n=new c(t=u==1/0?"5e"+_:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+_)):n=new c(u.toString()),r=(_=c.precision)+3;;)if(n=(a=n).plus(divide(o,a,r+2,1)).times(.5),digitsToString(a.d).slice(0,r)===(t=digitsToString(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(finalise(n,_+1,1),e=!n.times(n).eq(o));break}if(!i&&(finalise(a,_+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}return external=!0,finalise(n,_,c.rounding,e)},P.tangent=P.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=divide(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,finalise(2==quadrant||4==quadrant?r.neg():r,e,t,!0)):new n(NaN)},P.times=P.mul=function(e){var t,r,n,i,a,o,s,_,u,c=this,l=c.constructor,d=c.d,f=(e=new l(e)).d;if(e.s*=c.s,!(d&&d[0]&&f&&f[0]))return new l(!e.s||d&&!d[0]&&!f||f&&!f[0]&&!d?NaN:d&&f?0*e.s:e.s/0);for(r=mathfloor(c.e/LOG_BASE)+mathfloor(e.e/LOG_BASE),(_=d.length)<(u=f.length)&&(a=d,d=f,f=a,o=_,_=u,u=o),a=[],n=o=_+u;n--;)a.push(0);for(n=u;--n>=0;){for(t=0,i=_+n;i>n;)s=a[i]+f[n]*d[i-n-1]+t,a[i--]=s%BASE|0,t=s/BASE|0;a[i]=(a[i]+t)%BASE|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=getBase10Exponent(a,r),external?finalise(e,l.precision,l.rounding):e},P.toBinary=function(e,t){return toStringBinary(this,2,e,t)},P.toDecimalPlaces=P.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(checkInt32(e,0,MAX_DIGITS),void 0===t?t=n.rounding:checkInt32(t,0,8),finalise(r,e+r.e+1,t))},P.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=finiteToString(n,!0):(checkInt32(e,0,MAX_DIGITS),void 0===t?t=i.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},P.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return void 0===e?r=finiteToString(i):(checkInt32(e,0,MAX_DIGITS),void 0===t?t=a.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new a(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},P.toFraction=function(e){var t,r,n,i,a,o,s,_,u,c,l,d,f=this,p=f.d,m=f.constructor;if(!p)return new m(f);if(u=r=new m(1),n=_=new m(0),o=(a=(t=new m(n)).e=getPrecision(p)-f.e-1)%LOG_BASE,t.d[0]=mathpow(10,o<0?LOG_BASE+o:o),null==e)e=a>0?t:u;else{if(!(s=new m(e)).isInt()||s.lt(u))throw Error(invalidArgument+s);e=s.gt(t)?a>0?t:u:s}for(external=!1,s=new m(digitsToString(p)),c=m.precision,m.precision=a=p.length*LOG_BASE*2;l=divide(s,t,0,1,1),1!=(i=r.plus(l.times(n))).cmp(e);)r=n,n=i,i=u,u=_.plus(l.times(i)),_=i,i=t,t=s.minus(l.times(i)),s=i;return i=divide(e.minus(r),n,0,1,1),_=_.plus(i.times(u)),r=r.plus(i.times(n)),_.s=u.s=f.s,d=divide(u,n,a,1).minus(f).abs().cmp(divide(_,r,a,1).minus(f).abs())<1?[u,n]:[_,r],m.precision=c,external=!0,d},P.toHexadecimal=P.toHex=function(e,t){return toStringBinary(this,16,e,t)},P.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:checkInt32(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(external=!1,r=divide(r,e,0,t,1).times(e),external=!0,finalise(r)):(e.s=r.s,r=e),r},P.toNumber=function(){return+this},P.toOctal=function(e,t){return toStringBinary(this,8,e,t)},P.toPower=P.pow=function(e){var t,r,n,i,a,o,s=this,_=s.constructor,u=+(e=new _(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new _(mathpow(+s,u));if((s=new _(s)).eq(1))return s;if(n=_.precision,a=_.rounding,e.eq(1))return finalise(s,n,a);if((t=mathfloor(e.e/LOG_BASE))>=e.d.length-1&&(r=u<0?-u:u)<=MAX_SAFE_INTEGER)return i=intPow(_,s,r,n),e.s<0?new _(1).div(i):finalise(i,n,a);if((o=s.s)<0){if(t<e.d.length-1)return new _(NaN);if(0==(1&e.d[t])&&(o=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=o,s}return(t=0!=(r=mathpow(+s,u))&&isFinite(r)?new _(r+"").e:mathfloor(u*(Math.log("0."+digitsToString(s.d))/Math.LN10+s.e+1)))>_.maxE+1||t<_.minE-1?new _(t>0?o/0:0):(external=!1,_.rounding=s.s=1,r=Math.min(12,(t+"").length),(i=naturalExponential(e.times(naturalLogarithm(s,n+r)),n)).d&&checkRoundingDigits((i=finalise(i,n+5,1)).d,n,a)&&(t=n+10,+digitsToString((i=finalise(naturalExponential(e.times(naturalLogarithm(s,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=finalise(i,n+1,0))),i.s=o,external=!0,_.rounding=a,finalise(i,n,a))},P.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=finiteToString(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(checkInt32(e,1,MAX_DIGITS),void 0===t?t=i.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},P.toSignificantDigits=P.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(checkInt32(e,1,MAX_DIGITS),void 0===t?t=r.rounding:checkInt32(t,0,8)),finalise(new r(this),e,t)},P.toString=function(){var e=this,t=e.constructor,r=finiteToString(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},P.truncated=P.trunc=function(){return finalise(new this.constructor(this),this.e+1,1)},P.valueOf=P.toJSON=function(){var e=this,t=e.constructor,r=finiteToString(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var divide=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,o,s,_){var u,c,l,d,f,p,m,g,v,h,w,b,y,x,S,E,A,T,D,N,k=n.constructor,O=n.s==i.s?1:-1,P=n.d,M=i.d;if(!(P&&P[0]&&M&&M[0]))return new k(n.s&&i.s&&(P?!M||P[0]!=M[0]:M)?P&&0==P[0]||!M?0*O:O/0:NaN);for(_?(f=1,c=n.e-i.e):(_=BASE,f=LOG_BASE,c=mathfloor(n.e/f)-mathfloor(i.e/f)),D=M.length,A=P.length,h=(v=new k(O)).d=[],l=0;M[l]==(P[l]||0);l++);if(M[l]>(P[l]||0)&&c--,null==a?(x=a=k.precision,o=k.rounding):x=s?a+(n.e-i.e)+1:a,x<0)h.push(1),p=!0;else{if(x=x/f+2|0,l=0,1==D){for(d=0,M=M[0],x++;(l<A||d)&&x--;l++)S=d*_+(P[l]||0),h[l]=S/M|0,d=S%M|0;p=d||l<A}else{for((d=_/(M[0]+1)|0)>1&&(M=e(M,d,_),P=e(P,d,_),D=M.length,A=P.length),E=D,b=(w=P.slice(0,D)).length;b<D;)w[b++]=0;(N=M.slice()).unshift(0),T=M[0],M[1]>=_/2&&++T;do{d=0,(u=t(M,w,D,b))<0?(y=w[0],D!=b&&(y=y*_+(w[1]||0)),(d=y/T|0)>1?(d>=_&&(d=_-1),1==(u=t(m=e(M,d,_),w,g=m.length,b=w.length))&&(d--,r(m,D<g?N:M,g,_))):(0==d&&(u=d=1),m=M.slice()),(g=m.length)<b&&m.unshift(0),r(w,m,b,_),-1==u&&(u=t(M,w,D,b=w.length))<1&&(d++,r(w,D<b?N:M,b,_)),b=w.length):0===u&&(d++,w=[0]),h[l++]=d,u&&w[0]?w[b++]=P[E]||0:(w=[P[E]],b=1)}while((E++<A||void 0!==w[0])&&x--);p=void 0!==w[0]}h[0]||h.shift()}if(1==f)v.e=c,inexact=p;else{for(l=1,d=h[0];d>=10;d/=10)l++;v.e=l+c*f-1,finalise(v,s?a+v.e+1:a,o,p)}return v}}();function finalise(e,t,r,n){var i,a,o,s,_,u,c,l,d,f=e.constructor;e:if(null!=t){if(!(l=e.d))return e;for(i=1,s=l[0];s>=10;s/=10)i++;if((a=t-i)<0)a+=LOG_BASE,o=t,_=(c=l[d=0])/mathpow(10,i-o-1)%10|0;else if((d=Math.ceil((a+1)/LOG_BASE))>=(s=l.length)){if(!n)break e;for(;s++<=d;)l.push(0);c=_=0,i=1,o=(a%=LOG_BASE)-LOG_BASE+1}else{for(c=s=l[d],i=1;s>=10;s/=10)i++;_=(o=(a%=LOG_BASE)-LOG_BASE+i)<0?0:c/mathpow(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[d+1]||(o<0?c:c%mathpow(10,i-o-1)),u=r<4?(_||n)&&(0==r||r==(e.s<0?3:2)):_>5||5==_&&(4==r||n||6==r&&(a>0?o>0?c/mathpow(10,i-o):0:l[d-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,u?(t-=e.e+1,l[0]=mathpow(10,(LOG_BASE-t%LOG_BASE)%LOG_BASE),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=d,s=1,d--):(l.length=d+1,s=mathpow(10,LOG_BASE-a),l[d]=o>0?(c/mathpow(10,i-o)%mathpow(10,o)|0)*s:0),u)for(;;){if(0==d){for(a=1,o=l[0];o>=10;o/=10)a++;for(o=l[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,l[0]==BASE&&(l[0]=1));break}if(l[d]+=s,l[d]!=BASE)break;l[d--]=0,s=1}for(a=l.length;0===l[--a];)l.pop()}return external&&(e.e>f.maxE?(e.d=null,e.e=NaN):e.e<f.minE&&(e.e=0,e.d=[0])),e}function finiteToString(e,t,r){if(!e.isFinite())return nonFiniteToString(e);var n,i=e.e,a=digitsToString(e.d),o=a.length;return t?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+getZeroString(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+getZeroString(-i-1)+a,r&&(n=r-o)>0&&(a+=getZeroString(n))):i>=o?(a+=getZeroString(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+getZeroString(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=getZeroString(n))),a}function getBase10Exponent(e,t){var r=e[0];for(t*=LOG_BASE;r>=10;r/=10)t++;return t}function getLn10(e,t,r){if(t>LN10_PRECISION)throw external=!0,r&&(e.precision=r),Error(precisionLimitExceeded);return finalise(new e(LN10),t,1,!0)}function getPi(e,t,r){if(t>PI_PRECISION)throw Error(precisionLimitExceeded);return finalise(new e(PI),t,r,!0)}function getPrecision(e){var t=e.length-1,r=t*LOG_BASE+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function getZeroString(e){for(var t="";e--;)t+="0";return t}function intPow(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/LOG_BASE+4);for(external=!1;;){if(r%2&&truncate((a=a.times(t)).d,o)&&(i=!0),0===(r=mathfloor(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}truncate((t=t.times(t)).d,o)}return external=!0,a}function isOdd(e){return 1&e.d[e.d.length-1]}function maxOrMin(e,t,r){for(var n,i,a=new e(t[0]),o=0;++o<t.length;){if(!(i=new e(t[o])).s){a=i;break}((n=a.cmp(i))===r||0===n&&a.s===r)&&(a=i)}return a}function naturalExponential(e,t){var r,n,i,a,o,s,_,u=0,c=0,l=0,d=e.constructor,f=d.rounding,p=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(external=!1,_=p):_=t,s=new d(.03125);e.e>-2;)e=e.times(s),l+=5;for(_+=n=Math.log(mathpow(2,l))/Math.LN10*2+5|0,r=a=o=new d(1),d.precision=_;;){if(a=finalise(a.times(e),_,1),r=r.times(++c),digitsToString((s=o.plus(divide(a,r,_,1))).d).slice(0,_)===digitsToString(o.d).slice(0,_)){for(i=l;i--;)o=finalise(o.times(o),_,1);if(null!=t)return d.precision=p,o;if(!(u<3&&checkRoundingDigits(o.d,_-n,f,u)))return finalise(o,d.precision=p,f,external=!0);d.precision=_+=10,r=a=s=new d(1),c=0,u++}o=s}}function naturalLogarithm(e,t){var r,n,i,a,o,s,_,u,c,l,d,f=1,p=e,m=p.d,g=p.constructor,v=g.rounding,h=g.precision;if(p.s<0||!m||!m[0]||!p.e&&1==m[0]&&1==m.length)return new g(m&&!m[0]?-1/0:1!=p.s?NaN:m?0:p);if(null==t?(external=!1,c=h):c=t,g.precision=c+=10,n=(r=digitsToString(m)).charAt(0),!(Math.abs(a=p.e)<15e14))return u=getLn10(g,c+2,h).times(a+""),p=naturalLogarithm(new g(n+"."+r.slice(1)),c-10).plus(u),g.precision=h,null==t?finalise(p,h,v,external=!0):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=digitsToString((p=p.times(e)).d)).charAt(0),f++;for(a=p.e,n>1?(p=new g("0."+r),a++):p=new g(n+"."+r.slice(1)),l=p,_=o=p=divide(p.minus(1),p.plus(1),c,1),d=finalise(p.times(p),c,1),i=3;;){if(o=finalise(o.times(d),c,1),digitsToString((u=_.plus(divide(o,new g(i),c,1))).d).slice(0,c)===digitsToString(_.d).slice(0,c)){if(_=_.times(2),0!==a&&(_=_.plus(getLn10(g,c+2,h).times(a+""))),_=divide(_,new g(f),c,1),null!=t)return g.precision=h,_;if(!checkRoundingDigits(_.d,c-10,v,s))return finalise(_,g.precision=h,v,external=!0);g.precision=c+=10,u=o=p=divide(l.minus(1),l.plus(1),c,1),d=finalise(p.times(p),c,1),i=s=1}_=u,i+=2}}function nonFiniteToString(e){return String(e.s*e.s/0)}function parseDecimal(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%LOG_BASE,r<0&&(n+=LOG_BASE),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=LOG_BASE;n<i;)e.d.push(+t.slice(n,n+=LOG_BASE));t=t.slice(n),n=LOG_BASE-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),external&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function parseOther(e,t){var r,n,i,a,o,s,_,u,c;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),isDecimal.test(t))return parseDecimal(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(isHex.test(t))r=16,t=t.toLowerCase();else if(isBinary.test(t))r=2;else{if(!isOctal.test(t))throw Error(invalidArgument+t);r=8}for((a=t.search(/p/i))>0?(_=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),o=(a=t.indexOf("."))>=0,n=e.constructor,o&&(a=(s=(t=t.replace(".","")).length)-a,i=intPow(n,new n(r),a,2*a)),a=c=(u=convertBase(t,r,BASE)).length-1;0===u[a];--a)u.pop();return a<0?new n(0*e.s):(e.e=getBase10Exponent(u,c),e.d=u,external=!1,o&&(e=divide(e,i,4*s)),_&&(e=e.times(Math.abs(_)<54?mathpow(2,_):Decimal.pow(2,_))),external=!0,e)}function sine(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:taylorSeries(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=taylorSeries(e,2,t=t.times(1/tinyPow(5,r)),t);for(var i,a=new e(5),o=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function taylorSeries(e,t,r,n,i){var a,o,s,_,u=e.precision,c=Math.ceil(u/LOG_BASE);for(external=!1,_=r.times(r),s=new e(n);;){if(o=divide(s.times(_),new e(t++*t++),u,1),s=i?n.plus(o):n.minus(o),n=divide(o.times(_),new e(t++*t++),u,1),void 0!==(o=s.plus(n)).d[c]){for(a=c;o.d[a]===s.d[a]&&a--;);if(-1==a)break}a=s,s=n,n=o,o=a}return external=!0,o.d.length=c+1,o}function tinyPow(e,t){for(var r=e;--t;)r*=e;return r}function toLessThanHalfPi(e,t){var r,n=t.s<0,i=getPi(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return quadrant=n?4:1,t;if((r=t.divToInt(i)).isZero())quadrant=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return quadrant=isOdd(r)?n?2:3:n?4:1,t;quadrant=isOdd(r)?n?1:4:n?3:2}return t.minus(i).abs()}function toStringBinary(e,t,r,n){var i,a,o,s,_,u,c,l,d,f=e.constructor,p=void 0!==r;if(p?(checkInt32(r,1,MAX_DIGITS),void 0===n?n=f.rounding:checkInt32(n,0,8)):(r=f.precision,n=f.rounding),e.isFinite()){for(p?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,(o=(c=finiteToString(e)).indexOf("."))>=0&&(c=c.replace(".",""),(d=new f(1)).e=c.length-o,d.d=convertBase(finiteToString(d),10,i),d.e=d.d.length),a=_=(l=convertBase(c,10,i)).length;0==l[--_];)l.pop();if(l[0]){if(o<0?a--:((e=new f(e)).d=l,e.e=a,l=(e=divide(e,d,r,n,0,i)).d,a=e.e,u=inexact),o=l[r],s=i/2,u=u||void 0!==l[r+1],u=n<4?(void 0!==o||u)&&(0===n||n===(e.s<0?3:2)):o>s||o===s&&(4===n||u||6===n&&1&l[r-1]||n===(e.s<0?8:7)),l.length=r,u)for(;++l[--r]>i-1;)l[r]=0,r||(++a,l.unshift(1));for(_=l.length;!l[_-1];--_);for(o=0,c="";o<_;o++)c+=NUMERALS.charAt(l[o]);if(p){if(_>1)if(16==t||8==t){for(o=16==t?4:3,--_;_%o;_++)c+="0";for(_=(l=convertBase(c,i,t)).length;!l[_-1];--_);for(o=1,c="1.";o<_;o++)c+=NUMERALS.charAt(l[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>_)for(a-=_;a--;)c+="0";else a<_&&(c=c.slice(0,a)+"."+c.slice(a))}else c=p?"0p+0":"0";c=(16==t?"0x":2==t?"0b":8==t?"0o":"")+c}else c=nonFiniteToString(e);return e.s<0?"-"+c:c}function truncate(e,t){if(e.length>t)return e.length=t,!0}function abs$1(e){return new this(e).abs()}function acos(e){return new this(e).acos()}function acosh(e){return new this(e).acosh()}function add$1(e,t){return new this(e).plus(t)}function asin(e){return new this(e).asin()}function asinh(e){return new this(e).asinh()}function atan(e){return new this(e).atan()}function atanh(e){return new this(e).atanh()}function atan2(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?getPi(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=getPi(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(divide(e,t,a,1)),t=getPi(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(divide(e,t,a,1)):(r=getPi(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function cbrt(e){return new this(e).cbrt()}function ceil(e){return finalise(e=new this(e),e.e+1,2)}function clamp(e,t,r){return new this(e).clamp(t,r)}function config(e){if(!e||"object"!==_typeof(e))throw Error(decimalError+"Object expected");var t,r,n,i=!0===e.defaults,a=["precision",1,MAX_DIGITS,"rounding",0,8,"toExpNeg",-EXP_LIMIT,0,"toExpPos",0,EXP_LIMIT,"maxE",0,EXP_LIMIT,"minE",-EXP_LIMIT,0,"modulo",0,9];for(t=0;t<a.length;t+=3)if(r=a[t],i&&(this[r]=DEFAULTS[r]),void 0!==(n=e[r])){if(!(mathfloor(n)===n&&n>=a[t+1]&&n<=a[t+2]))throw Error(invalidArgument+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=DEFAULTS[r]),void 0!==(n=e[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(invalidArgument+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(cryptoUnavailable);this[r]=!0}else this[r]=!1}return this}function cos(e){return new this(e).cos()}function cosh(e){return new this(e).cosh()}function clone(e){var t,r,n;function i(e){var t,r,n,a=this;if(!(a instanceof i))return new i(e);if(a.constructor=i,isDecimalInstance(e))return a.s=e.s,void(external?!e.d||e.e>i.maxE?(a.e=NaN,a.d=null):e.e<i.minE?(a.e=0,a.d=[0]):(a.e=e.e,a.d=e.d.slice()):(a.e=e.e,a.d=e.d?e.d.slice():e.d));if("number"===(n=_typeof(e))){if(0===e)return a.s=1/e<0?-1:1,a.e=0,void(a.d=[0]);if(e<0?(e=-e,a.s=-1):a.s=1,e===~~e&&e<1e7){for(t=0,r=e;r>=10;r/=10)t++;return void(external?t>i.maxE?(a.e=NaN,a.d=null):t<i.minE?(a.e=0,a.d=[0]):(a.e=t,a.d=[e]):(a.e=t,a.d=[e]))}return 0*e!=0?(e||(a.s=NaN),a.e=NaN,void(a.d=null)):parseDecimal(a,e.toString())}if("string"===n)return 45===(r=e.charCodeAt(0))?(e=e.slice(1),a.s=-1):(43===r&&(e=e.slice(1)),a.s=1),isDecimal.test(e)?parseDecimal(a,e):parseOther(a,e);if("bigint"===n)return e<0?(e=-e,a.s=-1):a.s=1,parseDecimal(a,e.toString());throw Error(invalidArgument+e)}if(i.prototype=P,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=config,i.clone=clone,i.isDecimal=isDecimalInstance,i.abs=abs$1,i.acos=acos,i.acosh=acosh,i.add=add$1,i.asin=asin,i.asinh=asinh,i.atan=atan,i.atanh=atanh,i.atan2=atan2,i.cbrt=cbrt,i.ceil=ceil,i.clamp=clamp,i.cos=cos,i.cosh=cosh,i.div=div$1,i.exp=exp$1,i.floor=floor,i.hypot=hypot,i.ln=ln$1,i.log=log,i.log10=log10,i.log2=log2,i.max=max,i.min=min,i.mod=mod$1,i.mul=mul$1,i.pow=pow$1,i.random=random,i.round=round,i.sign=sign,i.sin=sin,i.sinh=sinh,i.sqrt=sqrt$1,i.sub=sub$1,i.sum=sum,i.tan=tan,i.tanh=tanh,i.trunc=trunc,void 0===e&&(e={}),e&&!0!==e.defaults)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function div$1(e,t){return new this(e).div(t)}function exp$1(e){return new this(e).exp()}function floor(e){return finalise(e=new this(e),e.e+1,3)}function hypot(){var e,t,r=new this(0);for(external=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return external=!0,new this(1/0);r=t}return external=!0,r.sqrt()}function isDecimalInstance(e){return e instanceof Decimal||e&&e.toStringTag===tag||!1}function ln$1(e){return new this(e).ln()}function log(e,t){return new this(e).log(t)}function log2(e){return new this(e).log(2)}function log10(e){return new this(e).log(10)}function max(){return maxOrMin(this,arguments,-1)}function min(){return maxOrMin(this,arguments,1)}function mod$1(e,t){return new this(e).mod(t)}function mul$1(e,t){return new this(e).mul(t)}function pow$1(e,t){return new this(e).pow(t)}function random(e){var t,r,n,i,a=0,o=new this(1),s=[];if(void 0===e?e=this.precision:checkInt32(e,1,MAX_DIGITS),n=Math.ceil(e/LOG_BASE),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));a<n;)(i=t[a])>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(cryptoUnavailable);for(t=crypto.randomBytes(n*=4);a<n;)(i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((127&t[a+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=n/4}else for(;a<n;)s[a++]=1e7*Math.random()|0;for(n=s[--a],e%=LOG_BASE,n&&e&&(i=mathpow(10,LOG_BASE-e),s[a]=(n/i|0)*i);0===s[a];a--)s.pop();if(a<0)r=0,s=[0];else{for(r=-1;0===s[0];r-=LOG_BASE)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<LOG_BASE&&(r-=LOG_BASE-n)}return o.e=r,o.d=s,o}function round(e){return finalise(e=new this(e),e.e+1,this.rounding)}function sign(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function sin(e){return new this(e).sin()}function sinh(e){return new this(e).sinh()}function sqrt$1(e){return new this(e).sqrt()}function sub$1(e,t){return new this(e).sub(t)}function sum(){var e=0,t=arguments,r=new this(t[e]);for(external=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return external=!0,finalise(r,this.precision,this.rounding)}function tan(e){return new this(e).tan()}function tanh(e){return new this(e).tanh()}function trunc(e){return finalise(e=new this(e),e.e+1,1)}P[Symbol.for("nodejs.util.inspect.custom")]=P.toString,P[Symbol.toStringTag]="Decimal";var Decimal=P.constructor=clone(DEFAULTS);LN10=new Decimal(LN10),PI=new Decimal(PI);var DEFAULT_VOLUME_UNITS=["","K","M","B","T"],DEFAULT_THOUSANDS_CONFIG={sep:",",point:".",grouping:[3],min_len:0,point_group:!1,fn:null},THOUSANDS_PRESETS={default:{sep:",",point:".",grouping:[3],min_len:0,point_group:!1,fn:null},us:{sep:",",point:".",grouping:[3]},eu:{sep:".",point:",",grouping:[3]},swiss:{sep:"'",point:".",grouping:[3]},space:{sep:" ",point:".",grouping:[3]},indian:{sep:",",point:".",grouping:[3,2]},cn4:{sep:",",point:".",grouping:[4]}};function get_thousands_preset(e){if(!e)return null;var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})._thousands_presets||{};return t[e]?_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),t[e]):THOUSANDS_PRESETS[e]?_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),THOUSANDS_PRESETS[e]):null}function extract_unit_thousands(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._thousands&&!t[r]&&(t[r]=n._thousands),n)if(!i.startsWith("_")){var a=n[i];"object"===_typeof(a)&&a._thousands&&!t[i]&&(t[i]=a._thousands)}}return t}function get_unit_thousands_map(e){var t=extract_unit_thousands(get_unit_mapping(e));return e._unit_thousands?_objectSpread2(_objectSpread2({},t),e._unit_thousands):t}function format_thousands(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),t);if(r.fn&&"function"==typeof r.fn){var n=e.startsWith("-"),i=e.startsWith("+"),a="",o=e;(n||i)&&(a=e[0],o=e.slice(1));var s=o.split("."),_={int_part:s[0],dec_part:s[1]||null,sign:a,options:r._options||{}};return r.fn(e,_)}var u=e.replace(/^[+-]/,"").split(".")[0].length;if(r.min_len>0&&u<r.min_len)return"."!==r.point?e.replace(".",r.point):e;var c=e.startsWith("-"),l=e.startsWith("+"),d="",f=e;(c||l)&&(d=e[0],f=e.slice(1));var p=f.split("."),m=p[0],g=p[1];m=apply_grouping(m,r.grouping,r.sep),g&&r.point_group&&(g=apply_grouping_decimal(g,r.grouping,r.sep));var v=d+m;return void 0!==g&&(v+=r.point+g),v}function apply_grouping(e,t,r){if(!e||0===e.length)return e;for(var n=[],i=e,a=0;i.length>0;){var o=t[Math.min(a,t.length-1)];if(i.length<=o){n.unshift(i);break}n.unshift(i.slice(-o)),i=i.slice(0,-o),a++}return n.join(r)}function apply_grouping_decimal(e,t,r){if(!e||0===e.length)return e;for(var n=[],i=e,a=0;i.length>0;){var o=t[Math.min(a,t.length-1)];if(i.length<=o){n.push(i);break}n.push(i.slice(0,o)),i=i.slice(o),a++}return n.join(r)}var BUILTIN_PRESETS={default:{units:["","K","M","B","T"],step:1e3},cn:{units:["","千","百万","十亿","万亿"],step:1e3},wan:{units:["","万","亿","万亿"],step:1e4},storage:{units:["B","KB","MB","GB","TB"],step:1024}};function convert_unit_from_to_out(e){if(!e)return null;var t={};for(var r in e){var n=e[r];for(var i in n)t[i]||(t[i]={}),t[i][r]=n[i]}return t}function get_unit_mapping(e){return e._unit_to?e._unit_to:e._unit_from?convert_unit_from_to_out(e._unit_from):null}function extract_unit_positions(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._position&&!t[r]&&(t[r]=n._position),n)if("_position"!==i){var a=n[i];"object"===_typeof(a)&&a._position&&!t[i]&&(t[i]=a._position)}}return t}function get_unit_position_map(e){var t=extract_unit_positions(get_unit_mapping(e));return e._unit_positions?_objectSpread2(_objectSpread2({},t),e._unit_positions):t}function find_conversion_rule(e,t,r,n){if(!r||!e)return null;var i=r[e];if(!i)return null;if(t){var a=i[t];return void 0!==a?{rule:a,input_unit:t}:null}if(n){var o,s=_createForOfIteratorHelper(Array.isArray(n)?n:[n]);try{for(s.s();!(o=s.n()).done;){var _=o.value;if(void 0!==i[_])return{rule:i[_],input_unit:_}}}catch(e){s.e(e)}finally{s.f()}}var u=Object.keys(i);return 1===u.length?{rule:i[u[0]],input_unit:u[0]}:null}function apply_conversion_rule(e,t,r,n){if(null==t)return e;var i=new Decimal(e);return"number"==typeof t?i.times(t).toFixed():"function"==typeof t?String(t(Number(e),r,n)):"object"===_typeof(t)?t.fn&&"function"==typeof t.fn?String(t.fn(Number(e),r,n)):(void 0!==t.mul&&(i=i.times(t.mul)),void 0!==t.div&&(i=i.div(t.div)),void 0!==t.plus&&(i=i.plus(t.plus)),void 0!==t.minus&&(i=i.minus(t.minus)),i.toFixed()):e}function get_unit_info_from_tokens(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var n,i=_createForOfIteratorHelper(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;if("unit_after"===a.type||"unit_before"===a.type||"unit_middle"===a.type)return{output_unit:a.unit,input_unit:a.input_unit,position:"unit_after"===a.type?"after":"unit_before"===a.type?"before":"middle",show_unit:!0};if("unit_hide"===a.type)return{output_unit:a.unit,input_unit:a.input_unit,position:null,show_unit:!1};if("unit_default"===a.type){var o=r[a.unit]||t._unit_position||"after";return{output_unit:a.unit,input_unit:a.input_unit,position:o,show_unit:!0}}if("to-number-string"===a.type&&a.output_unit)return{output_unit:a.output_unit,input_unit:a.input_unit,position:null,show_unit:!1}}}catch(e){i.e(e)}finally{i.f()}return null}function apply_unit(e,t,r,n){if(!t)return e;var i=e.startsWith("-"),a=e.startsWith("+"),o="",s=e;switch((i||a)&&(o=e[0],s=e.slice(1)),r){case"after":default:return o+s+t;case"before":return t+o+s;case"middle":return o?o+t+s:t+s}}function format_volume(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r._volume_preset,i=r._volume_units||DEFAULT_VOLUME_UNITS,a=r._volume_step||1e3;if(n){var o=(r._presets||{})[n]||BUILTIN_PRESETS[n];o&&(Array.isArray(o)?(i=o,a=1e3):(i=o.units||i,a=void 0!==o.step?o.step:a))}var s=e.startsWith("-"),_=e.startsWith("+"),u="",c=e;(s||_)&&(u=e[0],c=e.slice(1));for(var l=new Decimal(c),d=0,f=Array.isArray(a);d<i.length-1;){var p=f?a[d]||a[a.length-1]:a;if(!l.gte(p))break;l=l.div(p),d++}var m=l.toFixed(t,Decimal.ROUND_DOWN);return m.includes(".")&&(m=m.replace(/\.?0+$/,"")),u+m+i[d]}function pad_integer(e,t){if(t<=0)return e;var r=e.startsWith("-"),n=e.startsWith("+"),i="",a=e;(r||n)&&(i=e[0],a=e.slice(1));var o=a.split("."),s=o[0],_=o[1];s.length<t&&(s="0".repeat(t-s.length)+s);var u=i+s;return void 0!==_&&(u+="."+_),u}function format(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="";if("undefined"===(n=Decimal.isDecimal(e)?e.toFixed():"string"==typeof e?e:e.toString())||"NaN"===n)return[void 0,{}];var i=get_unit_mapping(r),a=get_unit_position_map(r),o=get_unit_info_from_tokens(t,r,a),s=null,_=null,u=!1;if(o){var c=o.output_unit,l=o.input_unit,d=o.position,f=o.show_unit;if(i&&c){var p=find_conversion_rule(c,l,i,r._unit_default_from);p&&(n=apply_conversion_rule(n,p.rule,p.input_unit,c))}f&&(s=c,_=d,u=!0)}else if(i&&r._unit_default_to&&r._unit_position){var m,g=_createForOfIteratorHelper(Array.isArray(r._unit_default_to)?r._unit_default_to:[r._unit_default_to]);try{for(g.s();!(m=g.n()).done;){var v=m.value,h=find_conversion_rule(v,null,i,r._unit_default_from);if(h){n=apply_conversion_rule(n,h.rule,h.input_unit,v),s=v,_=a[v]||r._unit_position,u=!0;break}}}catch(e){g.e(e)}finally{g.f()}}var w={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,volume:!1,volume_preset:null,unit_format:null,unit_value:null,unit_input:null,range_clamp_min:null,range_clamp_max:null},b=[],y=[];t.forEach((function(e,t){"symbol"===e.type?b.push({value:e.value,index:t}):"number"!==e.type&&"var"!==e.type||y.push({value:"var"===e.type?e.real_value:e.value,index:t})}));var x=b.find((function(e){return">="===e.value||">"===e.value})),S=b.find((function(e){return"<="===e.value||"<"===e.value}));if(x&&S)for(var E=function(){var e=b[A],t=y.find((function(t){return t.index>e.index}));t&&(">="===e.value||">"===e.value?w.mantissa_min=+t.value:"<="!==e.value&&"<"!==e.value||(w.mantissa_max=+t.value))},A=0;A<b.length;A++)E();if(t.forEach((function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);x&&S||(w.mantissa_type=e.value)}else if("to-number"===t)w.to_number=!0;else if("to-number-string"===t)w.to_number_string=!0;else if("comma"===t)w.thousands=!0;else if("number"===t)x&&S||(w.mantissa=e.value);else if("var"===t)x&&S||(w.mantissa=e.real_value);else if("plus"===t)w.sign=!0;else if("round"===t)w.round=e.value;else if("fraction"===t)w.fraction=!0;else if("scientific"===t)w.scientific=!0;else if("percent"===t)w.percent=!0;else if("integer_padding"===t)w.integer_padding=void 0!==e.real_value?+e.real_value:+e.value;else if("volume"===t)w.volume=!0,e.preset&&(w.volume_preset=e.preset);else if("unit_after"===t)w.unit_format="after",w.unit_value=e.unit,w.unit_input=e.input_unit;else if("unit_before"===t)w.unit_format="before",w.unit_value=e.unit,w.unit_input=e.input_unit;else if("unit_middle"===t)w.unit_format="middle",w.unit_value=e.unit,w.unit_input=e.input_unit;else if("unit_hide"===t)w.unit_format=null,w.unit_value=e.unit,w.unit_input=e.input_unit;else if("unit_default"===t)w.unit_format=r._unit_position||"after",w.unit_value=e.unit,w.unit_input=e.input_unit;else if("thousands"===t)w.thousands=!0,w.thousands_preset=e.preset;else{if("range_clamp"!==t)throw new Error("错误的fmt Token");w.range_clamp_min=e.min,w.range_clamp_max=e.max}})),null!==w.range_clamp_min||null!==w.range_clamp_max){var T=new Decimal(n);if(null!==w.range_clamp_min){var D=new Decimal(w.range_clamp_min);T.lt(D)&&(T=D)}if(null!==w.range_clamp_max){var N=new Decimal(w.range_clamp_max);T.gt(N)&&(T=N)}n=T.toFixed()}if(w.to_number){var k=parse_mantissa(n,w.mantissa_type,w.mantissa,w.round);return w.integer_padding&&(k=pad_integer(k,w.integer_padding)),[+k,w]}if(w.scientific){var O=new Decimal(n).toExponential();return[w.sign&&!O.startsWith("-")?"+"+O:O,w]}if(w.fraction){var P=new Decimal(n).toFraction(),M=P[0].toString()+"/"+P[1].toString();return[w.sign&&!M.startsWith("-")?"+"+M:M,w]}if(w.volume)return n=format_volume(n,null!==w.mantissa?+w.mantissa:2,_objectSpread2(_objectSpread2({},r),{},{_volume_preset:w.volume_preset})),w.sign&&!n.startsWith("-")&&(n="+"+n),u&&s&&_&&(n=apply_unit(n,s,_,w.sign)),[n,w];if(w.percent&&(n=new Decimal(n).times(100).toFixed()),null!==w.mantissa_min&&null!==w.mantissa_max){var L=n.includes(".")?n.split(".")[1].length:0;L<w.mantissa_min?n=parse_mantissa(n,">=",w.mantissa_min,w.round):L>w.mantissa_max?n=parse_mantissa(n,"<=",w.mantissa_max,w.round):n.includes(".")&&(n=n.replace(/0*$/,"").replace(/\.$/,""))}else null===w.mantissa?n.includes(".")&&(n=n.replace(/0*$/,"")):n=parse_mantissa(n,w.mantissa_type,w.mantissa,w.round);if(w.integer_padding&&(n=pad_integer(n,w.integer_padding)),w.thousands){var I=null;if(w.thousands_preset)I=get_thousands_preset(w.thousands_preset,r);else if(s){var W=get_unit_thousands_map(r)[s];W&&(I=get_thousands_preset(W,r))}I?(I._options=r,n=format_thousands(n,I)):n=parse_thousands(n)}return w.sign&&(w.to_number=!1,n.startsWith("-")||(n="+"+n)),w.percent&&(n+="%"),u&&s&&_&&(n=apply_unit(n,s,_,w.sign)),[n,w]}var _global_config={_debug_console:!0,_error:"-",_angle_unit:"deg",_builtin_functions:{},_compute_mode:"decimal",_div_precision:20},VALID_COMPUTE_MODES=new Set(["decimal","bigint","wasm"]),config_listeners={};function on_config_change(e,t){config_listeners[e]||(config_listeners[e]=[]),config_listeners[e].push(t)}function set_config(e){if(e&&"object"===_typeof(e))for(var t=function(){var t=n[r];if("_builtin_functions"===t&&"object"===_typeof(e[t]))Object.assign(_global_config._builtin_functions,e[t]);else if("_compute_mode"===t){var i=e[t];if(!VALID_COMPUTE_MODES.has(i))return console.warn("Unknown compute mode: ".concat(i,", available modes: ").concat(_toConsumableArray(VALID_COMPUTE_MODES).join(", "))),"continue";var a=_global_config[t];a!==i&&(_global_config[t]=i,config_listeners[t]&&config_listeners[t].forEach((function(e){return e(i,a)})))}else if(t in _global_config){var o=_global_config[t],s=e[t];o!==s&&(_global_config[t]=s,config_listeners[t]&&config_listeners[t].forEach((function(e){return e(s,o)})))}},r=0,n=Object.keys(e);r<n.length;r++)t()}function get_config(e){return void 0===e?_objectSpread2({},_global_config):_global_config[e]}function close_important_push(){}function open_important_push(){}var _calc$1=null;function register_calc(e){_calc$1=e}function get_calc$1(){if(!_calc$1)throw new Error("calc function not registered");return _calc$1}function calc_wrap(e,t){var r=get_calc$1(),n={_error:"-"};return["string","number"].includes(_typeof(e))?void 0===t?/[a-zA-Z$_]/.test(e.toString())?function(t){return Array.isArray(t)?t.unshift(n):t=_objectSpread2(_objectSpread2({},n),t),r(e,t)}:r(e):(Array.isArray(t)?t.unshift(n):t=_objectSpread2(_objectSpread2({},n),t),r(e,t)):(Array.isArray(e)?e.unshift(n):e=_objectSpread2(_objectSpread2({},n),e),function(t){return r(t,e)})}function check_version(){return _check_version.apply(this,arguments)}function _check_version(){return _check_version=_asyncToGenerator(_regeneratorRuntime().mark((function _callee(){var res,code,versions,last_version,larr,varr,script,url;return _regeneratorRuntime().wrap((function _callee$(_context){for(;;)switch(_context.prev=_context.next){case 0:if("undefined"==typeof process||"node"!==process.release.name){_context.next=19;break}if(!(parseInt(process.versions.node)>=17)){_context.next=17;break}return _context.next=4,promise_queue([fetch("https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js"),fetch("https://unpkg.com/a-calc@latest/a-calc.versions.js")]);case 4:return res=_context.sent,_context.next=7,res.text();case 7:code=_context.sent,versions=eval(code),last_version=versions.at(-1),larr=last_version.match(/(\d+)\.(\d+)\.(\d+)/),larr.shift(),larr=larr.map((function(e){return parseInt(e)})),varr=version.match(/(\d+)\.(\d+)\.(\d+)/),varr.shift(),varr=varr.map((function(e){return parseInt(e)})),(larr[0]>varr[0]||larr[0]===varr[0]&&larr[1]>varr[1]||larr[0]===varr[0]&&larr[1]===varr[1]&&larr[2]>varr[2])&&console.warn("a-calc has a new version:",last_version);case 17:_context.next=25;break;case 19:return script=document.createElement("script"),script.onload=function(){var e=a_calc_versions;if(Array.isArray(e)){var t=e.at(-1),r=t.match(/(\d+)\.(\d+)\.(\d+)/);r.shift(),r=r.map((function(e){return parseInt(e)}));var n=version.match(/(\d+)\.(\d+)\.(\d+)/);n.shift(),n=n.map((function(e){return parseInt(e)})),(r[0]>n[0]||r[0]===n[0]&&r[1]>n[1]||r[0]===n[0]&&r[1]===n[1]&&r[2]>n[2])&&console.log("%c↑↑↑ a-calc has a new version: %s ↑↑↑","color: #67C23A;",t)}},_context.next=23,test_urls(["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"]);case 23:url=_context.sent,url?(script.src=url,document.body.appendChild(script)):script=null;case 25:case"end":return _context.stop()}}),_callee)}))),_check_version.apply(this,arguments)}var operator=new Set(["+","-","*","/","%","**","//"]);function detect_fallback_var(e,t){if("("!==e[t])return null;for(var r=0,n=!1,i=[],a="",o=t;o<e.length;){var s=e[o];if("("===s){if(0===r){r++,o++;continue}r++,a+=s}else if(")"===s){if(0===--r)return n?(i.push(a.trim()),{paths:i,end_index:o}):null;a+=s}else"|"===s&&1===r?(n=!0,i.push(a.trim()),a=""):a+=s;o++}return null}function push_token$2(e,t,r){if(Number.isNaN(Number(t)))if("-"===t||"+"===t)e.push({type:"operator",value:t});else if(operator.has(t))e.push({type:"operator",value:t});else if(r._unit&&/^[+-]?\d/.test(t)){var n,i=split_unit_num(t),a=i.num,o=i.unit;if(void 0===o)e.push({type:"number",value:a,real_value:a,has_unit:!1});else r.has_unit=!0,null!==(n=r.unit_str)&&void 0!==n||(r.unit_str=o),e.push({type:"number",value:a,real_value:a,has_unit:!0,unit:o})}else if(var_first_char_set.has(t[0])){r.has_var=!0;var s=get_real_value(r.fill_data,t);if(r._unit){var _,u=split_unit_num(s),c=u.num,l=u.unit;if(void 0===l)e.push({type:"var",value:t,real_value:c,has_unit:!1});else r.has_unit=!0,null!==(_=r.unit_str)&&void 0!==_||(r.unit_str=l),e.push({type:"var",value:t,real_value:c,has_unit:!0,unit:l})}else e.push({type:"var",value:t,real_value:s,has_unit:!1})}else{if(!/^[+-]?\d/.test(t))throw new Error("无法识别的标识符:".concat(t));var d=t.indexOf("e");-1!==d&&/^\d+$/.test(t.slice(d+1))&&e.push({type:"number",value:t,real_value:t,has_unit:!1})}else e.push({type:"number",value:t,real_value:t,has_unit:!1})}function tokenizer_space(e,t,r,n){for(var i,a=0,o=0,s=e.length,_=[],u={has_var:!1,has_unit:!1,unit_str:void 0,_unit:r,fill_data:t};o<s;){if(" "===(i=e[o]))o>a&&push_token$2(_,e.slice(a,o),u),a=o+1;else if("("===i){var c=detect_fallback_var(e,o);if(c){o>a&&push_token$2(_,e.slice(a,o),u),u.has_var=!0;var l=get_fallback_value(t,c.paths,n),d=l.value,f=l.path;if(r){var p,m=split_unit_num(d),g=m.num,v=m.unit;if(void 0!==v)u.has_unit=!0,null!==(p=u.unit_str)&&void 0!==p||(u.unit_str=v),_.push({type:state_fallback_var,value:c.paths,real_value:g,matched_path:f,has_unit:!0,unit:v});else _.push({type:state_fallback_var,value:c.paths,real_value:g,matched_path:f,has_unit:!1})}else _.push({type:state_fallback_var,value:c.paths,real_value:d,matched_path:f,has_unit:!1});a=o=c.end_index+1;continue}_.push({type:state_bracket,value:"("}),a=o+1}else")"===i&&(o>a&&push_token$2(_,e.slice(a,o),u),_.push({type:state_bracket,value:")"}),a=o+1);o++}return o>a&&push_token$2(_,e.slice(a,o),u),_.has_var=u.has_var,_.has_unit=u.has_unit,_.unit=u.unit_str,_}function to_decimal(e){return e instanceof Decimal?e:new Decimal("boolean"==typeof e?e?1:0:e)}function is_decimal(e){return e instanceof Decimal}function compute(e,t,r){if(void 0===e||void 0===t)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(t));var n=to_decimal(e),i=to_decimal(t);switch(r){case"+":return n.plus(i);case"-":return n.minus(i);case"*":return n.times(i);case"/":return n.div(i);case"%":return n.mod(i);case"**":return n.pow(i);case"//":return n.divToInt(i);default:throw new Error("未知的运算符: ".concat(r))}}function compare(e,t,r){if(void 0===e||void 0===t)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(t));var n=to_decimal(e),i=to_decimal(t);switch(r){case">":return n.gt(i);case"<":return n.lt(i);case">=":return n.gte(i);case"<=":return n.lte(i);case"==":return n.eq(i);case"!=":return!n.eq(i);default:throw new Error("未知的比较运算符: ".concat(r))}}function logical(e,t,r){var n=function(e){return"boolean"==typeof e?e:e instanceof Decimal?!e.isZero():"number"==typeof e?0!==e:"string"==typeof e?""!==e&&"0"!==e:Boolean(e)},i=n(e);switch(r){case"&&":return!!i&&n(t);case"||":return!!i||n(t);default:throw new Error("未知的逻辑运算符: ".concat(r))}}function logical_not(e){var t;return!("boolean"==typeof(t=e)?t:t instanceof Decimal?!t.isZero():"number"==typeof t?0!==t:"string"==typeof t?""!==t&&"0"!==t:Boolean(t))}function _to_rad(e){return"rad"===get_config("_angle_unit")?e:new Decimal(e).times(Decimal.acos(-1)).div(180)}function _to_deg(e){return"rad"===get_config("_angle_unit")?e:new Decimal(e).times(180).div(Decimal.acos(-1))}var _SIN_TABLE={0:new Decimal(0),30:new Decimal("0.5"),45:new Decimal(2).sqrt().div(2),60:new Decimal(3).sqrt().div(2),90:new Decimal(1),180:new Decimal(0),270:new Decimal(-1),360:new Decimal(0)},_COS_TABLE={0:new Decimal(1),30:new Decimal(3).sqrt().div(2),45:new Decimal(2).sqrt().div(2),60:new Decimal("0.5"),90:new Decimal(0),180:new Decimal(-1),270:new Decimal(0),360:new Decimal(1)},_TAN_TABLE={0:new Decimal(0),30:new Decimal(3).sqrt().div(3),45:new Decimal(1),60:new Decimal(3).sqrt(),180:new Decimal(0),360:new Decimal(0)};function _normalize_angle(e){var t=new Decimal(e).mod(360);return t.isNegative()?t.plus(360):t}var _builtin_functions={sin:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(void 0!==_SIN_TABLE[t])return _SIN_TABLE[t];if(t>180){var r=_SIN_TABLE[360-t];if(void 0!==r)return r.negated()}if(t>90&&t<=180){var n=_SIN_TABLE[180-t];if(void 0!==n)return n}}var i=_to_rad(e);return Decimal.sin(i)},cos:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(void 0!==_COS_TABLE[t])return _COS_TABLE[t];if(t>180){var r=_COS_TABLE[360-t];if(void 0!==r)return r}if(t>90&&t<=180){var n=_COS_TABLE[180-t];if(void 0!==n)return n.negated()}}var i=_to_rad(e);return Decimal.cos(i)},tan:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(90===t||270===t)throw new Error("tan() undefined at 90° and 270°");if(void 0!==_TAN_TABLE[t])return _TAN_TABLE[t]}var r=_to_rad(e);return Decimal.tan(r)},asin:function(e){return _to_deg(Decimal.asin(e))},acos:function(e){return _to_deg(Decimal.acos(e))},atan:function(e){return _to_deg(Decimal.atan(e))},atan2:function(e,t){return _to_deg(Decimal.atan2(e,t))},sinh:function(e){return Decimal.sinh(e)},cosh:function(e){return Decimal.cosh(e)},tanh:function(e){return Decimal.tanh(e)},asinh:function(e){return Decimal.asinh(e)},acosh:function(e){return Decimal.acosh(e)},atanh:function(e){return Decimal.atanh(e)},exp:function(e){return Decimal.exp(e)},log:function(e){return Decimal.ln(e)},ln:function(e){return Decimal.ln(e)},log10:function(e){return Decimal.log10(e)},log2:function(e){return Decimal.log2(e)},sqrt:function(e){return new Decimal(e).sqrt()},cbrt:function(e){return new Decimal(e).cbrt()},pow:function(e,t){return new Decimal(e).pow(t)},floor:function(e){return new Decimal(e).floor()},ceil:function(e){return new Decimal(e).ceil()},round:function(e){return new Decimal(e).round()},trunc:function(e){return new Decimal(e).trunc()},abs:function(e){return new Decimal(e).abs()},sign:function(e){return new Decimal(e).isPositive()?new Decimal(1):new Decimal(e).isNegative()?new Decimal(-1):new Decimal(0)},max:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)throw new Error("max() requires at least one argument");return t.reduce((function(e,t){var r=new Decimal(t);return r.gt(e)?r:e}),new Decimal(t[0]))},min:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)throw new Error("min() requires at least one argument");return t.reduce((function(e,t){var r=new Decimal(t);return r.lt(e)?r:e}),new Decimal(t[0]))},clamp:function(e,t,r){var n=new Decimal(e),i=new Decimal(t),a=new Decimal(r);return n.lt(i)?i:n.gt(a)?a:n},random:function(){return new Decimal(Math.random())},pi:function(){return Decimal.acos(-1)},e:function(){return Decimal.exp(1)},if:function(e,t,r){var n;return("boolean"==typeof(n=e)?n:n instanceof Decimal?!n.isZero():"number"==typeof n?0!==n:Boolean(n))?t:r}};function get_function(e,t){if(t){var r,n=_createForOfIteratorHelper(Array.isArray(t)?t:[t]);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(i&&"function"==typeof i[e])return i[e]}}catch(e){n.e(e)}finally{n.f()}}var a=get_config("_builtin_functions");return a&&a[e]?a[e]:null}function is_comparison_op(e){return comparison_operators.has(e)}function is_logical_op(e){return logical_operators.has(e)}function is_arithmetic_op(e){return["+","-","*","/","%","**","//"].includes(e)}function get_precedence(e){var t;return null!==(t=operator_precedence[e])&&void 0!==t?t:-1}function execute_op(e,t,r){if(is_comparison_op(r))return compare(e,t,r);if(is_logical_op(r))return logical(e,t,r);if(is_arithmetic_op(r))return compute(e,t,r);throw new Error("未知的运算符: ".concat(r))}function eval_tokens(e){if(1===e.length){var t=e[0];if("number"===t.type||"var"===t.type||"fallback_var"===t.type)return new Decimal(t.real_value);if("boolean"===t.type)return t.value;if("string"===t.type)return t.value;if("function"===t.type){var r=t.value,n=t.fn||get_function(r,e._fill_data);if(!n)throw new Error("未知的函数: ".concat(r));var i=t.args.map((function(t){var r=tokenizer(t,e._fill_data,e._unit,e._options);return r._fill_data=e._fill_data,r._unit=e._unit,r._options=e._options,eval_tokens(r)}));return n.apply(void 0,_toConsumableArray(i))}throw new Error("错误的表达式:".concat(t.value))}for(var a,o=[],s=[],_={active:!1,lastValue:null},u=0,c=e.length;u<c;u++)if("number"!==(a=e[u]).type&&"var"!==a.type&&"fallback_var"!==a.type)if("boolean"!==a.type)if("string"!==a.type)if("function"!==a.type)if("logical_not"!==a.type)if("ternary_question"!==a.type&&"?"!==a.value)if("ternary_colon"!==a.type&&":"!==a.value)if("operator"!==a.type&&"comparison"!==a.type&&"logical"!==a.type)if("("!==a.value)if(")"!==a.value)"function_result"!==a.type||s.push(a.value);else for(;o.length>0;){var l=o.pop();if("("===l){if(o.length>0&&("-"===o[o.length-1]||"+"===o[o.length-1])){var d=o[o.length-1],f=o.length>1?o[o.length-2]:null;if(null===f&&1===s.length||"("===f&&1===s.length||["+","-","*","/","%","**","//","?",":"].includes(f))if("-"===d){o.pop();var p=s.pop();is_decimal(p)?s.push(p.negated()):"number"==typeof p?s.push(-p):"boolean"==typeof p?s.push(!p):s.push(new Decimal(p).negated())}else"+"===d&&o.pop()}else{var m=s[s.length-2];if("-"===m){var g=s.pop();s.pop(),is_decimal(g)?s.push(g.negated()):"number"==typeof g?s.push(-g):"boolean"==typeof g?s.push(!g):s.push(new Decimal(g).negated())}else if("+"===m){var v=s.pop();s.pop(),s.push(v)}}break}if("!"===l){var h=s.pop();s.push(logical_not(h))}else if(":"===l&&o.length>0&&"?"===o[o.length-1]){var w=s.pop();o.pop();var b=s.pop(),y=s.pop(),x=void 0;x="boolean"==typeof y?y:is_decimal(y)?!y.isZero():Boolean(y),s.push(x?b:w)}else{if("?"===l){o.push("?");break}var S=s.pop(),E=s.pop();s.push(execute_op(E,S,l))}}else o.push("(");else{var A=a.value,T=get_precedence(A);if(is_comparison_op(A)&&_.active)for(;o.length>0;){var D=o[o.length-1];if("("===D||"?"===D)break;if(get_precedence(D)<T)break;if(is_comparison_op(D)){o.pop();var N=s.pop(),k=compare(s.pop(),N,D);_.lastValue=N,k?s.push(N):(s.push(!1),_.active=!1);break}o.pop();var O=s.pop(),P=s.pop();s.push(execute_op(P,O,D))}is_comparison_op(A)?_.active=!0:_.active=!1;var M=o[o.length-1];if("("===M){o.push(A);continue}if(!o.length){o.push(A);continue}if("**"===A){o.push(A);continue}for(;o.length>0&&"("!==(M=o[o.length-1])&&"?"!==M;){var L=get_precedence(M);if(L<T)break;if(L===T&&"**"===A)break;if("!"!==M&&s.length<2)break;if(o.pop(),"!"===M){var I=s.pop();s.push(logical_not(I))}else{var W=s.pop(),C=s.pop();void 0!==C||"-"!==M&&"+"!==M?s.push(execute_op(C,W,M)):"-"===M?is_decimal(W)?s.push(W.negated()):"number"==typeof W?s.push(-W):s.push(new Decimal(W).negated()):s.push(W)}}o.push(A)}else{for(;o.length>0;){var j=o[o.length-1];if("?"===j)break;if("("===j)break;o.pop();var F=s.pop(),R=s.pop();s.push(execute_op(R,F,j))}o.push(":")}else{for(;o.length>0;){var V=o[o.length-1];if("("===V||"?"===V)break;if(get_precedence(V)<=get_precedence("?"))break;o.pop();var q=s.pop(),$=s.pop();s.push(execute_op($,q,V))}o.push("?")}else o.push("!");else{var B=a.value,G=a.fn||get_function(B,e._fill_data);if(!G)throw new Error("未知的函数: ".concat(B));var z=a.args.map((function(t){var r=tokenizer(t,e._fill_data,e._unit,e._options);return r._fill_data=e._fill_data,r._unit=e._unit,r._options=e._options,eval_tokens(r)})),U=G.apply(void 0,_toConsumableArray(z));s.push(U)}else s.push(a.value);else s.push(a.value);else s.push(a.real_value);for(;o.length>0;){var H=o.pop();if("!"===H){var Z=s.pop();s.push(logical_not(Z))}else if(":"===H&&o.length>0&&"?"===o[o.length-1]){var X=s.pop();o.pop();var K=s.pop(),Y=s.pop(),J=void 0;J="boolean"==typeof Y?Y:is_decimal(Y)?!Y.isZero():Boolean(Y),s.push(J?K:X)}else{if("?"===H)continue;var Q=s.pop(),ee=s.pop();void 0!==ee||"-"!==H&&"+"!==H?s.push(execute_op(ee,Q,H)):"-"===H?is_decimal(Q)?s.push(Q.negated()):"number"==typeof Q?s.push(-Q):s.push(new Decimal(Q).negated()):s.push(Q)}}if(1!==s.length)throw new Error("可能出现了错误的计算式");return e.has_var||(e.calc_result=s[0]),s[0]}function resolve_unit_value$1(e,t){return e&&e.startsWith("@")?get_real_value(t,e.slice(1)):e}function push_token$1(e,t,r,n,i){t===state_var||t===state_integer_padding&&var_char.includes(r[0])?(i.has_var=!0,e.push({type:t,value:r,real_value:get_real_value(i.fill_data,r)})):e.push({type:t,value:r}),n.prev=n.curr,i.state=state_initial}function fmt_tokenizer(e,t){for(var r,n={prev:0,curr:0},i=e.length,a={state:state_initial,fill_data:t,has_var:!1},o=[];n.curr<i;)switch(r=e[n.curr],a.state){case state_initial:if(" "===r)n.curr++,n.prev=n.curr;else if("<>=".includes(r))a.state=state_symbol,n.curr++;else if(","===r)n.curr++,push_token$1(o,state_comma,",",n,a);else if(var_char.includes(r))a.state=state_var,n.curr++;else if(number_char.includes(r))a.state=state_number,n.curr++;else if("+"===r)n.curr++,push_token$1(o,state_plus,"+",n,a);else if("~"===r)n.curr++,a.state=state_round;else if("%"===r)n.curr++,push_token$1(o,state_percent,"%",n,a);else if("/"===r)n.curr++,push_token$1(o,state_fraction,"/",n,a);else if("!"===r)if(a.state=state_initial,n.curr++,"n"===e[n.curr])n.curr++,push_token$1(o,state_to_number,"!n",n,a);else if("u"===e[n.curr]){n.curr++;var s=e[n.curr];if("a"===s||"b"===s||"m"===s){if(n.curr++,":"!==e[n.curr])throw new Error("!u".concat(s," 语法需要指定单位,格式: !u").concat(s,":单位"));n.curr++;for(var _=n.curr;n.curr<i&&" "!==e[n.curr];)n.curr++;var u=e.slice(_,n.curr).split(":"),c=resolve_unit_value$1(u[0],a.fill_data),l=u[1]?resolve_unit_value$1(u[1],a.fill_data):null;(u[0].startsWith("@")||u[1]&&u[1].startsWith("@"))&&(a.has_var=!0);var d={a:state_unit_after,b:state_unit_before,m:state_unit_middle};o.push({type:d[s],value:"!u".concat(s),unit:c,input_unit:l}),n.prev=n.curr,a.state=state_initial}else if("h"===s){if(n.curr++,":"===e[n.curr]){n.curr++;for(var f=n.curr;n.curr<i&&" "!==e[n.curr];)n.curr++;var p=e.slice(f,n.curr).split(":"),m=resolve_unit_value$1(p[0],a.fill_data),g=p[1]?resolve_unit_value$1(p[1],a.fill_data):null;(p[0].startsWith("@")||p[1]&&p[1].startsWith("@"))&&(a.has_var=!0),o.push({type:state_unit_hide,value:"!uh",unit:m,input_unit:g})}else o.push({type:state_to_number_string,value:"!uh"});n.prev=n.curr,a.state=state_initial}else if(":"===e[n.curr]){n.curr++;for(var v=n.curr;n.curr<i&&" "!==e[n.curr];)n.curr++;var h=e.slice(v,n.curr).split(":"),w=resolve_unit_value$1(h[0],a.fill_data),b=h[1]?resolve_unit_value$1(h[1],a.fill_data):null;(h[0].startsWith("@")||h[1]&&h[1].startsWith("@"))&&(a.has_var=!0),o.push({type:state_unit_default,value:"!u",unit:w,input_unit:b}),n.prev=n.curr,a.state=state_initial}else push_token$1(o,state_to_number_string,"!u",n,a)}else if("e"===e[n.curr])n.curr++,push_token$1(o,state_scientific,"!e",n,a);else if("v"===e[n.curr]){n.curr++;var y=null;if(":"===e[n.curr]){n.curr++;for(var x=n.curr;n.curr<i&&/[a-zA-Z0-9_]/.test(e[n.curr]);)n.curr++;y=e.slice(x,n.curr)}o.push({type:state_volume,value:"!v",preset:y}),n.prev=n.curr,a.state=state_initial}else if("i"===e[n.curr]){if(n.curr++,":"!==e[n.curr])throw new Error("!i 语法需要指定位数,格式: !i:n");n.curr++;var S=n.curr;if("@"===e[n.curr]){for(n.curr++;n.curr<i&&var_members_char.includes(e[n.curr]);)n.curr++;var E=e.slice(S+1,n.curr),A=get_real_value(a.fill_data,E);a.has_var=!0,o.push({type:state_integer_padding,value:E,real_value:A})}else{for(;n.curr<i&&number_char.includes(e[n.curr]);)n.curr++;var T=e.slice(S,n.curr);o.push({type:state_integer_padding,value:T})}n.prev=n.curr,a.state=state_initial}else{if("t"!==e[n.curr])throw new Error("无法识别的!模式字符:".concat(e[n.curr]));if(n.curr++,":"!==e[n.curr])o.push({type:state_thousands,value:"!t",preset:"default"}),n.prev=n.curr,a.state=state_initial;else{n.curr++;var D=n.curr;if("@"===e[n.curr]){for(n.curr++;n.curr<i&&var_members_char.includes(e[n.curr]);)n.curr++;var N=e.slice(D+1,n.curr),k=get_real_value(a.fill_data,N);a.has_var=!0,o.push({type:state_thousands,value:"!t",preset:k,preset_var:N})}else{for(;n.curr<i&&/[a-zA-Z0-9_]/.test(e[n.curr]);)n.curr++;var O=e.slice(D,n.curr);o.push({type:state_thousands,value:"!t",preset:O})}n.prev=n.curr,a.state=state_initial}}else if("#"===r)n.curr++,n.prev=n.curr,"="===e[n.curr]&&(n.curr++,n.prev=n.curr),a.state=state_integer_padding;else if("["===r){for(n.curr++;n.curr<i&&" "===e[n.curr];)n.curr++;var P=n.curr,M=void 0;if("@"===e[n.curr]){for(n.curr++;n.curr<i&&/[a-zA-Z0-9_$.]/.test(e[n.curr]);)n.curr++;var L=e.slice(P+1,n.curr);M=get_real_value(a.fill_data,L),a.has_var=!0}else{for("-"!==e[n.curr]&&"+"!==e[n.curr]||n.curr++;n.curr<i&&(number_char.includes(e[n.curr])||"."===e[n.curr]);)n.curr++;M=e.slice(P,n.curr)}for(;n.curr<i&&" "===e[n.curr];)n.curr++;for(","===e[n.curr]&&n.curr++;n.curr<i&&" "===e[n.curr];)n.curr++;var I=n.curr,W=void 0;if("@"===e[n.curr]){for(n.curr++;n.curr<i&&/[a-zA-Z0-9_$.]/.test(e[n.curr]);)n.curr++;var C=e.slice(I+1,n.curr);W=get_real_value(a.fill_data,C),a.has_var=!0}else{for("-"!==e[n.curr]&&"+"!==e[n.curr]||n.curr++;n.curr<i&&(number_char.includes(e[n.curr])||"."===e[n.curr]);)n.curr++;W=e.slice(I,n.curr)}for(;n.curr<i&&" "===e[n.curr];)n.curr++;"]"===e[n.curr]&&n.curr++,o.push({type:state_range_clamp,min:""===M?null:M,max:""===W?null:W}),n.prev=n.curr,a.state=state_initial}else n.curr++,n.prev=n.curr;break;case state_symbol:"="===r&&n.curr++,push_token$1(o,state_symbol,e.slice(n.prev,n.curr),n,a);break;case state_number:number_char.includes(r)?n.curr++:push_token$1(o,state_number,e.slice(n.prev,n.curr),n,a);break;case state_var:var_members_char.includes(r)?n.curr++:push_token$1(o,state_var,e.slice(n.prev,n.curr),n,a);break;case state_round:if(!("56+-".includes(r)&&n.curr-n.prev<2))throw new Error("错误的舍入语法:".concat(e.slice(n.prev,n.curr+1)));n.curr++,push_token$1(o,state_round,e.slice(n.prev,n.curr),n,a);break;case state_integer_padding:if(number_char.includes(r))n.curr++;else if(var_members_char.includes(r))n.curr++;else{var j=e.slice(n.prev,n.curr);var_char.includes(j[0])?(a.has_var=!0,o.push({type:state_integer_padding,value:j,real_value:get_real_value(a.fill_data,j)})):push_token$1(o,state_integer_padding,j,n,a),n.prev=n.curr,a.state=state_initial}break;default:throw new Error("错误的fmt分词器状态")}return n.prev<n.curr&&push_token$1(o,a.state,e.slice(n.prev,n.curr),n,a),o.has_var=a.has_var,o}set_config({_builtin_functions:_builtin_functions});var symbol_set=new Set(["<",">","=",">=","<="]),rand_set=new Set(["~+","~-","~5","~6"]);function resolve_unit_value(e,t){return e&&e.startsWith("@")?get_real_value(t,e.slice(1)):e}function push_token(e,t,r){if(","===t)e.push({type:state_comma,value:","});else if(symbol_set.has(t))e.push({type:state_symbol,value:t});else if(Number.isNaN(Number(t)))if(var_first_char.includes(t[0]))r.has_var=!0,e.push({type:state_var,value:t,real_value:get_real_value(r.fill_data,t)});else if("%"===t)e.push({type:state_percent,value:t});else if("/"===t)e.push({type:state_fraction,value:t});else if("+"===t)e.push({type:state_plus,value:t});else if(rand_set.has(t))e.push({type:state_round,value:t});else if("!n"===t)e.push({type:state_to_number,value:t});else if("!u"===t)e.push({type:state_to_number_string,value:t});else if("!uh"===t)e.push({type:state_to_number_string,value:t});else if(t.startsWith("!uh:")){var n=t.slice(4).split(":"),i=resolve_unit_value(n[0],r.fill_data),a=n[1]?resolve_unit_value(n[1],r.fill_data):null;(n[0].startsWith("@")||n[1]&&n[1].startsWith("@"))&&(r.has_var=!0),e.push({type:state_unit_hide,value:"!uh",unit:i,input_unit:a})}else if(t.startsWith("!u:")){var o=t.slice(3).split(":"),s=resolve_unit_value(o[0],r.fill_data),_=o[1]?resolve_unit_value(o[1],r.fill_data):null;(o[0].startsWith("@")||o[1]&&o[1].startsWith("@"))&&(r.has_var=!0),e.push({type:state_unit_default,value:"!u",unit:s,input_unit:_})}else if(t.startsWith("!ua:")||t.startsWith("!ub:")||t.startsWith("!um:")){var u=t[2],c=t.slice(4).split(":"),l=resolve_unit_value(c[0],r.fill_data),d=c[1]?resolve_unit_value(c[1],r.fill_data):null;(c[0].startsWith("@")||c[1]&&c[1].startsWith("@"))&&(r.has_var=!0);var f={a:state_unit_after,b:state_unit_before,m:state_unit_middle};e.push({type:f[u],value:"!u".concat(u),unit:l,input_unit:d})}else if("!e"===t)e.push({type:state_scientific,value:t});else if("!v"===t||t.startsWith("!v:")){var p=null;t.startsWith("!v:")&&(p=t.slice(3)),e.push({type:state_volume,value:"!v",preset:p})}else if(t.startsWith("!i:")){var m=t.slice(3);if(m.startsWith("@")){var g=m.slice(1),v=get_real_value(r.fill_data,g);r.has_var=!0,e.push({type:state_integer_padding,value:g,real_value:v})}else e.push({type:state_integer_padding,value:m})}else{if(!t.startsWith("#"))throw new Error("无法识别的格式化字符: ".concat(t));var h=t.slice(1);h.startsWith("=")&&(h=h.slice(1)),var_first_char.includes(h[0])?(r.has_var=!0,e.push({type:state_integer_padding,value:h,real_value:get_real_value(r.fill_data,h)})):e.push({type:state_integer_padding,value:h})}else e.push({type:state_number,value:t})}function fmt_tokenizer_space(e,t){for(var r,n=0,i=e.length,a={fill_data:t,has_var:!1},o=0,s=[];n<i;)" "===(r=e[n])?(n>o&&push_token(s,e.slice(o,n),a),o=n+1):"<>=".includes(r)&&("="===e[n+1]?(s.push({type:state_symbol,value:r+"="}),o=1+ ++n):(s.push({type:state_symbol,value:r}),o=n+1)),n++;return o<n&&push_token(s,e.slice(o,n),a),s.has_var=a.has_var,s}var _calc=null;function register_calc_for_sum(e){_calc=e}function get_calc(){if(!_calc)throw new Error("calc function not registered for calc_sum");return _calc}function internal_format$1(e,t){if(!t)return e;var r=fmt_tokenizer(t,null);return _slicedToArray(format(new Decimal(e),r,{}),1)[0]}function calc_sum(e,t){var r=get_calc(),n={_error:"-"},i=e.split("|"),a=i[0];if(0===t.length)return r(e,n);for(var o=new Decimal(0),s=0;s<t.length;s++){var _=r(a,_objectSpread2(_objectSpread2({},n),t[s]));if(_===n._error)return n._error;o=o.plus(_)}var u=2===i.length?i[1].trim():void 0;return internal_format$1(o.toFixed(),u)}function _d_add(e,t){return new Decimal(e).plus(t).toFixed()}function _d_sub(e,t){return new Decimal(e).minus(t).toFixed()}function _d_mul(e,t){return new Decimal(e).times(t).toFixed()}function _d_div(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return new Decimal(e).div(r).toFixed()}function _d_mod(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return new Decimal(e).mod(r).toFixed()}function _d_pow(e,t){return new Decimal(e).pow(t).toFixed()}function _d_idiv(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return new Decimal(e).divToInt(r).toFixed()}function _d_abs(e){return new Decimal(e).abs().toFixed()}function _d_neg(e){return new Decimal(e).neg().toFixed()}function _d_sqrt(e){return new Decimal(e).sqrt().toFixed()}function _d_cbrt(e){return new Decimal(e).cbrt().toFixed()}function _d_exp(e){return new Decimal(e).exp().toFixed()}function _d_ln(e){return new Decimal(e).ln().toFixed()}function _d_log(e,t){return new Decimal(e).log(t).toFixed()}function _d_log2(e){return new Decimal(e).log(2).toFixed()}function _d_log10(e){return new Decimal(e).log(10).toFixed()}function _d_sin(e){return new Decimal(e).sin().toFixed()}function _d_cos(e){return new Decimal(e).cos().toFixed()}function _d_tan(e){return new Decimal(e).tan().toFixed()}function _d_asin(e){return new Decimal(e).asin().toFixed()}function _d_acos(e){return new Decimal(e).acos().toFixed()}function _d_atan(e){return new Decimal(e).atan().toFixed()}function _d_sinh(e){return new Decimal(e).sinh().toFixed()}function _d_cosh(e){return new Decimal(e).cosh().toFixed()}function _d_tanh(e){return new Decimal(e).tanh().toFixed()}function _d_asinh(e){return new Decimal(e).asinh().toFixed()}function _d_acosh(e){return new Decimal(e).acosh().toFixed()}function _d_atanh(e){return new Decimal(e).atanh().toFixed()}function _d_floor(e){return new Decimal(e).floor().toFixed()}function _d_ceil(e){return new Decimal(e).ceil().toFixed()}function _d_trunc(e){return new Decimal(e).trunc().toFixed()}function _d_round(e){return new Decimal(e).round().toFixed()}function _d_max(e,t){return Decimal.max(e,t).toFixed()}function _d_min(e,t){return Decimal.min(e,t).toFixed()}function _d_compare(e,t){return new Decimal(e).cmp(t)}function _d_eq(e,t){return new Decimal(e).eq(t)}function _d_lt(e,t){return new Decimal(e).lt(t)}function _d_gt(e,t){return new Decimal(e).gt(t)}function _d_lte(e,t){return new Decimal(e).lte(t)}function _d_gte(e,t){return new Decimal(e).gte(t)}var decimal_ops={add:_d_add,sub:_d_sub,mul:_d_mul,div:_d_div,mod:_d_mod,pow:_d_pow,idiv:_d_idiv,abs:_d_abs,neg:_d_neg,sqrt:_d_sqrt,cbrt:_d_cbrt,exp:_d_exp,ln:_d_ln,log:_d_log,log2:_d_log2,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh,floor:_d_floor,ceil:_d_ceil,trunc:_d_trunc,round:_d_round,max:_d_max,min:_d_min,compare:_d_compare,eq:_d_eq,lt:_d_lt,gt:_d_gt,lte:_d_lte,gte:_d_gte},dadd=_d_add,dsub=_d_sub,dmul=_d_mul,ddiv=_d_div,dmod=_d_mod,dpow=_d_pow,didiv=_d_idiv,dabs=_d_abs,dneg=_d_neg,dsqrt=_d_sqrt,dcbrt=_d_cbrt,dexp=_d_exp,dln=_d_ln,dlog=_d_log,dlog2=_d_log2,dlog10=_d_log10,dsin=_d_sin,dcos=_d_cos,dtan=_d_tan,dasin=_d_asin,dacos=_d_acos,datan=_d_atan,dsinh=_d_sinh,dcosh=_d_cosh,dtanh=_d_tanh,dasinh=_d_asinh,dacosh=_d_acosh,datanh=_d_atanh,dfloor=_d_floor,dceil=_d_ceil,dtrunc=_d_trunc,dround=_d_round,dmax=_d_max,dmin=_d_min,dcompare=_d_compare,deq=_d_eq,dlt=_d_lt,dgt=_d_gt,dlte=_d_lte,dgte=_d_gte;function bigint_pow10(e){if(e<=0)return 1n;for(var t=1n,r=0;r<e;r++)t*=10n;return t}function to_fixed_point(e){var t=String(e);if(t.includes("e")||t.includes("E"))return to_fixed_point_from_scientific(t);var r=t.startsWith("-"),n=_slicedToArray((r?t.slice(1):t).split("."),2),i=n[0],a=void 0===i?"0":i,o=n[1],s=void 0===o?"":o,_=s.length,u=(a+s).replace(/^0+/,"")||"0";return{value:BigInt(r?"-"+u:u),scale:_}}function to_fixed_point_from_scientific(e){var t=_slicedToArray(e.toLowerCase().split("e"),2),r=t[0],n=t[1],i=parseInt(n,10),a=to_fixed_point(r),o=a.value,s=a.scale-i;return s<0?{value:o*bigint_pow10(-s),scale:0}:{value:o,scale:s}}function from_fixed_point(e,t){var r=e<0n,n=(r?-e:e).toString();if(t<=0)return(r?"-":"")+n+"0".repeat(-t);for(;n.length<=t;)n="0"+n;var i=n.slice(0,-t),a=n.slice(-t).replace(/0+$/,""),o=a?"".concat(i,".").concat(a):i;return r?"-"+o:o}function normalize(e,t){if(0n===e)return{value:0n,scale:0};for(;t>0&&e%10n===0n;)e/=10n,t--;return{value:e,scale:t}}function align_scale(e,t,r,n){return t>n?{a_val:e,b_val:r*=bigint_pow10(t-n),scale:t}:n>t?{a_val:e*=bigint_pow10(n-t),b_val:r,scale:n}:{a_val:e,b_val:r,scale:t}}function _add(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val+i.b_val,i.scale)}function _minus(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val-i.b_val,i.scale)}function _mul(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t;return normalize(r.value*n.value,r.scale+n.scale)}function _div(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20,n="string"==typeof e?to_fixed_point(e):e,i="string"==typeof t?to_fixed_point(t):t;if(0n===i.value)throw new Error("Division by zero");var a=bigint_pow10(r);return normalize(n.value*a/i.value,n.scale-i.scale+r)}function _mod(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t;if(0n===n.value)throw new Error("Modulo by zero");var i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val%i.b_val,i.scale)}function _pow(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="bigint"==typeof t?t:BigInt(Math.floor(Number(t)));if(n<0n)return _div({value:1n,scale:0},_pow(r,-n));if(0n===n)return{value:1n,scale:0};if(1n===n)return r;for(var i={value:1n,scale:0},a=r,o=n;o>0n;)o%2n===1n&&(i=_mul(i,a)),a=_mul(a,a),o/=2n;return normalize(i.value,i.scale)}function _compare(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale),a=i.a_val,o=i.b_val;return a<o?-1:a>o?1:0}function _eq(e,t){return 0===_compare(e,t)}function _lt(e,t){return _compare(e,t)<0}function _gt(e,t){return _compare(e,t)>0}function _lte(e,t){return _compare(e,t)<=0}function _gte(e,t){return _compare(e,t)>=0}function _abs(e){var t="string"==typeof e?to_fixed_point(e):e;return{value:t.value<0n?-t.value:t.value,scale:t.scale}}function _neg(e){var t="string"==typeof e?to_fixed_point(e):e;return{value:-t.value,scale:t.scale}}function _floor(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale),n=t.value/r;return t.value<0n&&t.value%r!==0n&&(n-=1n),{value:n,scale:0}}function _ceil(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale),n=t.value/r;return t.value>0n&&t.value%r!==0n&&(n+=1n),{value:n,scale:0}}function _trunc(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale);return{value:t.value/r,scale:0}}function _round(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r="string"==typeof e?to_fixed_point(e):e,n=t;if(r.scale<=n){var i=n-r.scale;return{value:r.value*bigint_pow10(i),scale:n}}var a=bigint_pow10(r.scale-n),o=a/2n,s=r.value/a,_=r.value%a;return r.value>=0n?_>=o&&(s+=1n):-_>=o&&(s-=1n),normalize(s,n)}function _max(e,t){return _gt(e,t)?"string"==typeof e?to_fixed_point(e):e:"string"==typeof t?to_fixed_point(t):t}function _min(e,t){return _lt(e,t)?"string"==typeof e?to_fixed_point(e):e:"string"==typeof t?to_fixed_point(t):t}function _b_add(e,t){var r=_add(e,t);return from_fixed_point(r.value,r.scale)}function _b_sub(e,t){var r=_minus(e,t);return from_fixed_point(r.value,r.scale)}function _b_mul(e,t){var r=_mul(e,t);return from_fixed_point(r.value,r.scale)}function _b_div(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Division by zero")}var n=_div(e,t,get_config("_div_precision")||20);return from_fixed_point(n.value,n.scale)}function _b_mod(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Modulo by zero")}var n=_mod(e,t);return from_fixed_point(n.value,n.scale)}function _b_pow(e,t){var r=Number(t);if(!Number.isInteger(r))return _d_pow(e,t);var n=_pow(e,r);return from_fixed_point(n.value,n.scale)}function _b_idiv(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Division by zero")}var n=_div(e,t,get_config("_div_precision")||20),i=_trunc({value:n.value,scale:n.scale});return from_fixed_point(i.value,i.scale)}function _b_abs(e){var t=_abs(e);return from_fixed_point(t.value,t.scale)}function _b_neg(e){var t=_neg(e);return from_fixed_point(t.value,t.scale)}function _b_floor(e){var t=_floor(e);return from_fixed_point(t.value,t.scale)}function _b_ceil(e){var t=_ceil(e);return from_fixed_point(t.value,t.scale)}function _b_trunc(e){var t=_trunc(e);return from_fixed_point(t.value,t.scale)}function _b_round(e){var t=_round(e,0);return from_fixed_point(t.value,t.scale)}function _b_max(e,t){var r=_max(e,t);return from_fixed_point(r.value,r.scale)}function _b_min(e,t){var r=_min(e,t);return from_fixed_point(r.value,r.scale)}function _b_compare(e,t){return _compare(e,t)}function _b_eq(e,t){return _eq(e,t)}function _b_lt(e,t){return _lt(e,t)}function _b_gt(e,t){return _gt(e,t)}function _b_lte(e,t){return _lte(e,t)}function _b_gte(e,t){return _gte(e,t)}var bigint_ops={add:_b_add,sub:_b_sub,mul:_b_mul,div:_b_div,mod:_b_mod,pow:_b_pow,idiv:_b_idiv,abs:_b_abs,neg:_b_neg,floor:_b_floor,ceil:_b_ceil,trunc:_b_trunc,round:_b_round,max:_b_max,min:_b_min,compare:_b_compare,eq:_b_eq,lt:_b_lt,gt:_b_gt,lte:_b_lte,gte:_b_gte,sqrt:_d_sqrt,cbrt:_d_cbrt,exp:_d_exp,ln:_d_ln,log:_d_log,log2:_d_log2,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh},badd=_b_add,bsub=_b_sub,bmul=_b_mul,bdiv=_b_div,bmod=_b_mod,bpow=_b_pow,bidiv=_b_idiv,babs=_b_abs,bneg=_b_neg,bfloor=_b_floor,bceil=_b_ceil,btrunc=_b_trunc,bround=_b_round,bmax=_b_max,bmin=_b_min,bcompare=_b_compare,beq=_b_eq,blt=_b_lt,bgt=_b_gt,blte=_b_lte,bgte=_b_gte,bsqrt=_d_sqrt,bcbrt=_d_cbrt,bexp=_d_exp,bln=_d_ln,blog=_d_log,blog2=_d_log2,blog10=_d_log10,bsin=_d_sin,bcos=_d_cos,btan=_d_tan,basin=_d_asin,bacos=_d_acos,batan=_d_atan,bsinh=_d_sinh,bcosh=_d_cosh,btanh=_d_tanh,basinh=_d_asinh,bacosh=_d_acosh,batanh=_d_atanh,wasm_module=null,wasm_loaded=!1,wasm_loading=!1,wasm_load_callbacks=[],_calc_fallback=null;function register_calc_fallback(e){_calc_fallback=e}function load_wasm(e){return _load_wasm.apply(this,arguments)}function _load_wasm(){return(_load_wasm=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!wasm_loaded){e.next=2;break}return e.abrupt("return",wasm_module);case 2:if(!wasm_loading){e.next=4;break}return e.abrupt("return",new Promise((function(e,t){wasm_load_callbacks.push({resolve:e,reject:t})})));case 4:return wasm_loading=!0,e.prev=5,e.next=8,Promise.resolve().then((function(){return wasm_calc}));case 8:if(r=e.sent,n="undefined"!=typeof window,i="undefined"!=typeof process&&process.versions&&process.versions.node,!n){e.next=21;break}if(!t){e.next=17;break}return e.next=15,r.default(t);case 15:e.next=19;break;case 17:return e.next=19,r.default();case 19:case 24:case 41:e.next=44;break;case 21:if(!i){e.next=26;break}return e.next=24,init_wasm_node(r);case 26:if("function"!=typeof globalThis.fetch){e.next=43;break}if(e.prev=27,!t){e.next=33;break}return e.next=31,r.default(t);case 31:e.next=35;break;case 33:return e.next=35,r.default();case 35:e.next=41;break;case 37:return e.prev=37,e.t0=e.catch(27),e.next=41,init_wasm_node(r);case 43:throw new Error("Unsupported environment for WASM loading");case 44:return wasm_module=r,wasm_loaded=!0,update_wasm_ops(),wasm_load_callbacks.forEach((function(e){return e.resolve(r)})),wasm_load_callbacks=[],e.abrupt("return",r);case 52:throw e.prev=52,e.t1=e.catch(5),wasm_loading=!1,wasm_load_callbacks.forEach((function(t){return t.reject(e.t1)})),wasm_load_callbacks=[],console.warn("WASM module failed to load, using Decimal fallback:",e.t1),e.t1;case 59:case"end":return e.stop()}}),e,null,[[5,52],[27,37]])})))).apply(this,arguments)}function init_wasm_node(e){return _init_wasm_node.apply(this,arguments)}function _init_wasm_node(){return(_init_wasm_node=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,a,o,s,_,u,c,l,d,f,p,m,g;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,import("fs");case 2:return r=e.sent,n=r.readFileSync,e.next=6,import("url");case 6:return i=e.sent,a=i.fileURLToPath,e.next=10,import("path");case 10:o=e.sent,s=o.dirname,_=o.join,u=a(import.meta.url),c=s(u),l=[_(c,"../../wasm-calc/pkg/wasm_calc_bg.wasm"),_(c,"../wasm-calc/pkg/wasm_calc_bg.wasm"),_(c,"../../wasm-calc/pkg/wasm_calc_bg.wasm")],d=null,f=null,p=0,m=l;case 19:if(!(p<m.length)){e.next=32;break}return g=m[p],e.prev=21,d=n(g),e.abrupt("break",32);case 26:e.prev=26,e.t0=e.catch(21),f=e.t0;case 29:p++,e.next=19;break;case 32:if(d){e.next=34;break}throw f||new Error("WASM file not found");case 34:t.initSync({module:d});case 35:case"end":return e.stop()}}),e,null,[[21,26]])})))).apply(this,arguments)}function is_wasm_loaded(){return wasm_loaded}var wasm_ops={add:_d_add,sub:_d_sub,mul:_d_mul,div:_d_div,mod:_d_mod,pow:_d_pow,idiv:_d_idiv,abs:_d_abs,neg:_d_neg,sqrt:_d_sqrt,exp:_d_exp,ln:_d_ln,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,floor:_d_floor,ceil:_d_ceil,trunc:_d_trunc,round:_d_round,max:_d_max,min:_d_min,compare:_d_compare,eq:_d_eq,lt:_d_lt,gt:_d_gt,lte:_d_lte,gte:_d_gte,cbrt:_d_cbrt,log:_d_log,log2:_d_log2,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh};function trigger_wcalc_load(){wasm_loading||wasm_loaded||load_wasm().catch((function(){}))}var _wcalc_impl=function(e){return trigger_wcalc_load(),_calc_fallback(e)};function wcalc(e){return _wcalc_impl(e)}function update_wasm_ops(){wasm_ops.add=function(e,t){return wasm_module.str_plus(String(e),String(t))},wasm_ops.sub=function(e,t){return wasm_module.str_sub(String(e),String(t))},wasm_ops.mul=function(e,t){return wasm_module.str_mul(String(e),String(t))},wasm_ops.div=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return r},wasm_ops.mod=function(e,t){var r=wasm_module.str_mod(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return r},wasm_ops.pow=function(e,t){var r=wasm_module.str_powd(String(e),String(t));return"NaN"===r||"Overflow"===r?_d_pow(e,t):r},wasm_ops.idiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return wasm_module.str_trunc(r)},wasm_ops.abs=function(e){return wasm_module.str_abs(String(e))},wasm_ops.neg=function(e){return wasm_module.str_neg(String(e))},wasm_ops.sqrt=function(e){var t=wasm_module.str_sqrt(String(e));return"NaN"===t?_d_sqrt(e):t},wasm_ops.exp=function(e){return wasm_module.str_exp(String(e))},wasm_ops.ln=function(e){var t=wasm_module.str_ln(String(e));return"NaN"===t?_d_ln(e):t},wasm_ops.log10=function(e){var t=wasm_module.str_log10(String(e));return"NaN"===t?_d_log10(e):t},wasm_ops.sin=function(e){return wasm_module.str_sin(String(e))},wasm_ops.cos=function(e){return wasm_module.str_cos(String(e))},wasm_ops.tan=function(e){return wasm_module.str_tan(String(e))},wasm_ops.floor=function(e){return wasm_module.str_floor(String(e))},wasm_ops.ceil=function(e){return wasm_module.str_ceil(String(e))},wasm_ops.trunc=function(e){return wasm_module.str_trunc(String(e))},wasm_ops.round=function(e){return wasm_module.str_round(String(e))},wasm_ops.max=function(e,t){return wasm_module.str_max(String(e),String(t))},wasm_ops.min=function(e,t){return wasm_module.str_min(String(e),String(t))},wasm_ops.compare=function(e,t){return wasm_module.str_compare(String(e),String(t))},wasm_ops.eq=function(e,t){return wasm_module.str_eq(String(e),String(t))},wasm_ops.lt=function(e,t){return wasm_module.str_lt(String(e),String(t))},wasm_ops.gt=function(e,t){return wasm_module.str_gt(String(e),String(t))},wasm_ops.lte=function(e,t){return wasm_module.str_lte(String(e),String(t))},wasm_ops.gte=function(e,t){return wasm_module.str_gte(String(e),String(t))},_wcalc_impl=function(e){var t=wasm_module.eval_expr(String(e));if(t.startsWith("Error:")){var r=get_config("_error");if(void 0!==r)return r;throw new Error(t)}return t},update_wasm_raw_functions()}function trigger_wasm_load(){wasm_loading||wasm_loaded||load_wasm().catch((function(){}))}var wadd=function(e,t){return trigger_wasm_load(),_d_add(e,t)},wsub=function(e,t){return trigger_wasm_load(),_d_sub(e,t)},wmul=function(e,t){return trigger_wasm_load(),_d_mul(e,t)},wdiv=function(e,t){return trigger_wasm_load(),_d_div(e,t)},wmod=function(e,t){return trigger_wasm_load(),_d_mod(e,t)},wpow=function(e,t){return trigger_wasm_load(),_d_pow(e,t)},widiv=function(e,t){return trigger_wasm_load(),_d_idiv(e,t)},wabs=function(e){return trigger_wasm_load(),_d_abs(e)},wneg=function(e){return trigger_wasm_load(),_d_neg(e)},wsqrt=function(e){return trigger_wasm_load(),_d_sqrt(e)},wcbrt=function(e){return trigger_wasm_load(),_d_cbrt(e)},wexp=function(e){return trigger_wasm_load(),_d_exp(e)},wln=function(e){return trigger_wasm_load(),_d_ln(e)},wlog=function(e,t){return trigger_wasm_load(),_d_log(e,t)},wlog2=function(e){return trigger_wasm_load(),_d_log2(e)},wlog10=function(e){return trigger_wasm_load(),_d_log10(e)},wsin=function(e){return trigger_wasm_load(),_d_sin(e)},wcos=function(e){return trigger_wasm_load(),_d_cos(e)},wtan=function(e){return trigger_wasm_load(),_d_tan(e)},wasin=function(e){return trigger_wasm_load(),_d_asin(e)},wacos=function(e){return trigger_wasm_load(),_d_acos(e)},watan=function(e){return trigger_wasm_load(),_d_atan(e)},wsinh=function(e){return trigger_wasm_load(),_d_sinh(e)},wcosh=function(e){return trigger_wasm_load(),_d_cosh(e)},wtanh=function(e){return trigger_wasm_load(),_d_tanh(e)},wasinh=function(e){return trigger_wasm_load(),_d_asinh(e)},wacosh=function(e){return trigger_wasm_load(),_d_acosh(e)},watanh=function(e){return trigger_wasm_load(),_d_atanh(e)},wfloor=function(e){return trigger_wasm_load(),_d_floor(e)},wceil=function(e){return trigger_wasm_load(),_d_ceil(e)},wtrunc=function(e){return trigger_wasm_load(),_d_trunc(e)},wround=function(e){return trigger_wasm_load(),_d_round(e)},wmax=function(e,t){return trigger_wasm_load(),_d_max(e,t)},wmin=function(e,t){return trigger_wasm_load(),_d_min(e,t)},wcompare=function(e,t){return trigger_wasm_load(),_d_compare(e,t)},weq=function(e,t){return trigger_wasm_load(),_d_eq(e,t)},wlt=function(e,t){return trigger_wasm_load(),_d_lt(e,t)},wgt=function(e,t){return trigger_wasm_load(),_d_gt(e,t)},wlte=function(e,t){return trigger_wasm_load(),_d_lte(e,t)},wgte=function(e,t){return trigger_wasm_load(),_d_gte(e,t)};function update_wasm_raw_functions(){wadd=function(e,t){return wasm_module.str_plus(String(e),String(t))},wsub=function(e,t){return wasm_module.str_sub(String(e),String(t))},wmul=function(e,t){return wasm_module.str_mul(String(e),String(t))},wdiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return r},wmod=function(e,t){var r=wasm_module.str_mod(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return r},wpow=function(e,t){var r=wasm_module.str_powd(String(e),String(t));return"NaN"===r||"Overflow"===r?_d_pow(e,t):r},widiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return wasm_module.str_trunc(r)},wabs=function(e){return wasm_module.str_abs(String(e))},wneg=function(e){return wasm_module.str_neg(String(e))},wsqrt=function(e){var t=wasm_module.str_sqrt(String(e));return"NaN"===t?_d_sqrt(e):t},wexp=function(e){return wasm_module.str_exp(String(e))},wln=function(e){var t=wasm_module.str_ln(String(e));return"NaN"===t?_d_ln(e):t},wlog10=function(e){var t=wasm_module.str_log10(String(e));return"NaN"===t?_d_log10(e):t},wsin=function(e){return wasm_module.str_sin(String(e))},wcos=function(e){return wasm_module.str_cos(String(e))},wtan=function(e){return wasm_module.str_tan(String(e))},wfloor=function(e){return wasm_module.str_floor(String(e))},wceil=function(e){return wasm_module.str_ceil(String(e))},wtrunc=function(e){return wasm_module.str_trunc(String(e))},wround=function(e){return wasm_module.str_round(String(e))},wmax=function(e,t){return wasm_module.str_max(String(e),String(t))},wmin=function(e,t){return wasm_module.str_min(String(e),String(t))},wcompare=function(e,t){return wasm_module.str_compare(String(e),String(t))},weq=function(e,t){return wasm_module.str_eq(String(e),String(t))},wlt=function(e,t){return wasm_module.str_lt(String(e),String(t))},wgt=function(e,t){return wasm_module.str_gt(String(e),String(t))},wlte=function(e,t){return wasm_module.str_lte(String(e),String(t))},wgte=function(e,t){return wasm_module.str_gte(String(e),String(t))}}var modes={decimal:decimal_ops,bigint:bigint_ops,wasm:wasm_ops},ops=_objectSpread2({},decimal_ops);function set_compute_mode(e){return modes[e]?(Object.assign(ops,modes[e]),"wasm"!==e||is_wasm_loaded()||load_wasm().catch((function(e){console.warn("Failed to load WASM module, using Decimal fallback:",e.message)})),!0):(console.warn("Unknown compute mode: ".concat(e,", available modes: ").concat(Object.keys(modes).join(", "))),!1)}function is_error_value(e){var t=get_config("_error");return void 0!==t&&e===t}function add(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";for(var a=String(i[0]),o=1;o<i.length;o++)a=ops.add(a,String(i[o]));return"number"===n?Number(a):a}function sub(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=ops.neg(ops.neg(String(i[0])));return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)o=ops.sub(o,String(i[s]));return"number"===n?Number(o):o}function mul(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";for(var a=String(i[0]),o=1;o<i.length;o++)a=ops.mul(a,String(i[o]));return"number"===n?Number(a):a}function div(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.div(o,String(i[s]))))return o;return"number"===n?Number(o):o}function mod(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.mod(o,String(i[s]))))return o;return"number"===n?Number(o):o}function pow(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[i.length-1]),s=i.length-2;s>=0;s--)o=ops.pow(String(i[s]),o);return"number"===n?Number(o):o}function idiv(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.idiv(o,String(i[s]))))return o;return"number"===n?Number(o):o}function abs(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.abs(String(e));return"number"===t?Number(r):r}function neg(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.neg(String(e));return"number"===t?Number(r):r}function sqrt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.sqrt(String(e));return"number"===t?Number(r):r}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.ln(String(e));return"number"===t?Number(r):r}function exp(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.exp(String(e));return"number"===t?Number(r):r}function internal_format(e,t){if(!t)return e;var r=fmt_tokenizer(t,null);return _slicedToArray(format(new Decimal(e),r,{}),1)[0]}function create_chain(e){var t=String(e),r=is_error_value(e),n=function(e){return r?t:e?internal_format(t,e):t};return n.add=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=s[o];if(is_error_value(t=add(t,_,"string")))return r=!0,n}return n},n.sub=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=s[o];if(is_error_value(t=sub(t,_,"string")))return r=!0,n}return n},n.mul=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=s[o];if(is_error_value(t=mul(t,_,"string")))return r=!0,n}return n},n.div=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=s[o];if(is_error_value(t=div(t,_,"string")))return r=!0,n}return n},n.mod=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=s[o];if(is_error_value(t=mod(t,_,"string")))return r=!0,n}return n},n.pow=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=s[o];if(is_error_value(t=pow(t,_,"string")))return r=!0,n}return n},n.idiv=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=s[o];if(is_error_value(t=idiv(t,_,"string")))return r=!0,n}return n},n}function cadd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)return create_chain(0);for(var n="0",i=0,a=t;i<a.length;i++){if(is_error_value(n=add(n,a[i],"string")))return create_chain(n)}return create_chain(n)}function csub(e){if(void 0===e)return create_chain(0);for(var t=String(e),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=sub(t,o[a],"string")))return create_chain(t)}return create_chain(t)}function cmul(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)return create_chain(1);for(var n="1",i=0,a=t;i<a.length;i++){if(is_error_value(n=mul(n,a[i],"string")))return create_chain(n)}return create_chain(n)}function cdiv(e){if(void 0===e)return create_chain(1);for(var t=String(e),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=div(t,o[a],"string")))return create_chain(t)}return create_chain(t)}function cmod(e){if(void 0===e)return create_chain(0);for(var t=String(e),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=mod(t,o[a],"string")))return create_chain(t)}return create_chain(t)}function cpow(e){if(void 0===e)return create_chain(1);for(var t=String(e),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=pow(t,o[a],"string")))return create_chain(t)}return create_chain(t)}function cidiv(e){if(void 0===e)return create_chain(0);for(var t=String(e),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=idiv(t,o[a],"string")))return create_chain(t)}return create_chain(t)}function compile(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e||""===e.trim())throw new Error("Expression must be a non-empty string");for(var r,n=split_expr_and_fmt(e),i=n.expr,a=n.fmt,o=t._mode||"normal",s=t._unit||!1,_=/\b([a-zA-Z_$][a-zA-Z0-9_$.]*)\b/g,u=new Set;null!==(r=_.exec(i));){var c=r[1];/^\d/.test(c)||["true","false","null","undefined","NaN","Infinity"].includes(c)||u.add(c.split(".")[0])}var l={expression:e,expr:i,fmt_expr:a,mode:o,has_unit:s,variables:Array.from(u),defaultOptions:t};function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=_objectSpread2(_objectSpread2({},t),r),s=find_value(n,"_error");try{var _;_=Array.isArray(e)?e:Array.isArray(n._fill_data)?[e].concat(_toConsumableArray(n._fill_data)):void 0!==n._fill_data?[e,n._fill_data]:[e];var u,c=find_value(n,"_unit",!1),l=find_value(n,"_mode",o),d=find_value(n,"_fmt"),f="space"===l||"space-all"===l,p={_empty_values:find_value(n,"_empty_values"),_empty_check:find_value(n,"_empty_check")};(u=f?tokenizer_space(i,_,c,p):tokenizer(i,_,c,p))._fill_data=_,u._unit=c,u._options=p;var m=eval_tokens(u);if("boolean"==typeof m)return m;if("string"==typeof m&&!Decimal.isDecimal(m))return m;var g=(Decimal.isDecimal(m)?m:new Decimal(m)).toFixed(),v=a||d;if(v){var h,w,b=_slicedToArray(format(g,"space-all"===l?fmt_tokenizer_space(v,_):fmt_tokenizer(v,_),{_volume_units:find_value(n,"_volume_units"),_volume_step:find_value(n,"_volume_step"),_presets:find_value(n,"_presets"),_unit_to:null!==(h=find_value(n,"_unit_to"))&&void 0!==h?h:find_value(n,"_unit_out"),_unit_from:find_value(n,"_unit_from"),_unit_default_to:null!==(w=find_value(n,"_unit_default_to"))&&void 0!==w?w:find_value(n,"_unit_default_out"),_unit_default_from:find_value(n,"_unit_default_from"),_unit_position:find_value(n,"_unit_position"),_unit_positions:find_value(n,"_unit_positions"),_thousands_presets:find_value(n,"_thousands_presets"),_unit_thousands:find_value(n,"_unit_thousands")}),2),y=b[0],x=b[1];if(g=y,null!=x&&x.to_number)return+g}if("Infinity"===g||"NaN"===g||void 0===g)throw new Error("Invalid calculation result");return u.has_unit&&u.unit&&(g+=u.unit),g}catch(e){if(void 0!==s)return s;throw e}}return d.meta=l,d.expression=e,d.variables=l.variables,d.with=function(r){return compile(e,_objectSpread2(_objectSpread2({},t),r))},d}function compile_all(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},n=0,i=Object.entries(e);n<i.length;n++){var a=_slicedToArray(i[n],2),o=a[0],s=a[1];r[o]=compile(s,t)}return r}function print_debug_info(e){var t=[],r=50,n="─".repeat(r);t.push("┌".concat(n,"┐")),t.push("│ [a-calc debug]".concat(" ".repeat(35),"│")),t.push("├".concat(n,"┤"));var i="│ 表达式: ".concat(e.expression);t.push(i+" ".repeat(Math.max(0,52-i.length))+"│"),t.push("│".concat(" ".repeat(r),"│")),t.push("│ 变量:".concat(" ".repeat(45),"│"));for(var a=0,o=Object.entries(e.variables);a<o.length;a++){var s=_slicedToArray(o[a],2),_=s[0],u=s[1],c="│ ".concat(_," = ").concat(u);t.push(c+" ".repeat(Math.max(0,52-c.length))+"│")}if(t.push("│".concat(" ".repeat(r),"│")),t.push("│ 步骤:".concat(" ".repeat(45),"│")),e.steps.forEach((function(e,r){var n="│ ".concat(r+1,". ").concat(e.expression);t.push(n+" ".repeat(Math.max(0,52-n.length))+"│");var i="│ → ".concat(e.substituted," = ").concat(e.result);t.push(i+" ".repeat(Math.max(0,52-i.length))+"│")})),t.push("│".concat(" ".repeat(r),"│")),e.format){var l="│ 格式化: | ".concat(e.format);t.push(l+" ".repeat(Math.max(0,52-l.length))+"│"),t.push("│".concat(" ".repeat(r),"│"))}var d='│ 结果: "'.concat(e.result,'"');t.push(d+" ".repeat(Math.max(0,52-d.length))+"│"),t.push("└".concat(n,"┘")),console.log(t.join("\n"))}function calc(e,t){var r,n=null!==(r=find_value(t,"_error"))&&void 0!==r?r:get_config("_error"),i=find_value(t,"_debug"),a=find_value(t,"_on_debug"),o=null;i&&(o={expression:e,variables:{},steps:[],format:null,result:null});try{var s,_,u=parse_args(e,t),c=u._unit,l=u._mode;u._angle_unit&&set_config({_angle_unit:u._angle_unit});var d={_empty_values:u._empty_values,_empty_check:u._empty_check};if(i&&u.fill_data){!function e(t){if(Array.isArray(t))t.forEach((function(t){return e(t)}));else if(t&&"object"===_typeof(t))for(var r=0,n=Object.entries(t);r<n.length;r++){var i=_slicedToArray(n[r],2),a=i[0],s=i[1];a.startsWith("_")||"function"==typeof s||(o.variables[a]=s)}}(u.fill_data)}var f="space"===l||"space-all"===l?tokenizer_space(u.expr,u.fill_data,c,d):tokenizer(u.expr,u.fill_data,c,d);if(f._fill_data=u.fill_data,f._unit=c,f._options=d,i){var p=f.map((function(e){return void 0!==e.real_value&&e.real_value!==e.value?e.real_value:e.value})).join(" ");o.steps.push({expression:u.expr,substituted:p,result:"..."})}var m=eval_tokens(f);if(i&&o.steps.length>0&&(o.steps[o.steps.length-1].result=String(m)),"boolean"==typeof m)return i&&(o.result=m,get_config("_debug_console")&&print_debug_info(o),a&&a(o)),m;if("string"==typeof m&&!is_decimal(m))return i&&(o.result=m,get_config("_debug_console")&&print_debug_info(o),a&&a(o)),m;var g,v,h,w=is_decimal(m)?m:new Decimal(m);if("space-all"===l?(v=""===u.fmt_expr||void 0===u.fmt_expr?void 0:fmt_tokenizer_space(u.fmt_expr,u.fill_data),h=""===u._fmt||void 0===u._fmt?void 0:fmt_tokenizer_space(u._fmt,u.fill_data)):(v=""===u.fmt_expr||void 0===u.fmt_expr?void 0:fmt_tokenizer(u.fmt_expr,u.fill_data),h=""===u._fmt||void 0===u._fmt?void 0:fmt_tokenizer(u._fmt,u.fill_data)),void 0===v?void 0!==h&&(v=h):void 0!==h&&(v=[].concat(_toConsumableArray(h),_toConsumableArray(v))),i&&(u.fmt_expr||u._fmt)&&(o.format=u.fmt_expr||u._fmt),void 0===v)w=w.toFixed();else{var b=_slicedToArray(format(w,v,{_volume_units:u._volume_units,_volume_step:u._volume_step,_presets:u._presets,_unit_to:u._unit_to,_unit_from:u._unit_from,_unit_default_to:u._unit_default_to,_unit_default_from:u._unit_default_from,_unit_position:u._unit_position,_unit_positions:u._unit_positions,_thousands_presets:u._thousands_presets,_unit_thousands:u._unit_thousands}),2);w=b[0],g=b[1]}if("Infinity"===w||"NaN"===w||void 0===w)throw new Error("计算错误可能是非法的计算式");return!f.has_unit||null!==(s=g)&&void 0!==s&&s.to_number||null!==(_=g)&&void 0!==_&&_.to_number_string||(w+=f.unit),i&&(o.result=w,get_config("_debug_console")&&print_debug_info(o),a&&a(o)),w}catch(e){if(i&&(o.result=null!=n?n:e.message,o.error=e.message,get_config("_debug_console")&&print_debug_info(o),a&&a(o)),void 0===n)throw e;return n}}function fmt(e,t,r){return calc(t?"".concat(e," | ").concat(t):"".concat(e),r)}function check_update(){check_version().catch((function(){}))}function print_version(){console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")}on_config_change("_compute_mode",(function(e){set_compute_mode(e)})),Decimal.set({precision:50,rounding:Decimal.ROUND_HALF_UP,toExpNeg:-50,toExpPos:50}),register_calc_fallback(calc),register_calc(calc),register_calc_for_sum(calc);var calc_util={check_update:check_update,print_version:print_version,close_important_push:close_important_push,open_important_push:open_important_push},wasm;function radd(){return ops.add.apply(ops,arguments)}function rsub(){return ops.sub.apply(ops,arguments)}function rmul(){return ops.mul.apply(ops,arguments)}function rdiv(){return ops.div.apply(ops,arguments)}function rmod(){return ops.mod.apply(ops,arguments)}function rpow(){return ops.pow.apply(ops,arguments)}function ridiv(){return ops.idiv.apply(ops,arguments)}function rabs(){return ops.abs.apply(ops,arguments)}function rneg(){return ops.neg.apply(ops,arguments)}function rsqrt(){return ops.sqrt.apply(ops,arguments)}function rln(){return ops.ln.apply(ops,arguments)}function rexp(){return ops.exp.apply(ops,arguments)}function rsin(){return ops.sin.apply(ops,arguments)}function rcos(){return ops.cos.apply(ops,arguments)}function rtan(){return ops.tan.apply(ops,arguments)}function rasin(){return ops.asin.apply(ops,arguments)}function racos(){return ops.acos.apply(ops,arguments)}function ratan(){return ops.atan.apply(ops,arguments)}function rsinh(){return ops.sinh.apply(ops,arguments)}function rcosh(){return ops.cosh.apply(ops,arguments)}function rtanh(){return ops.tanh.apply(ops,arguments)}function rasinh(){return ops.asinh.apply(ops,arguments)}function racosh(){return ops.acosh.apply(ops,arguments)}function ratanh(){return ops.atanh.apply(ops,arguments)}function rfloor(){return ops.floor.apply(ops,arguments)}function rceil(){return ops.ceil.apply(ops,arguments)}function rtrunc(){return ops.trunc.apply(ops,arguments)}function rround(){return ops.round.apply(ops,arguments)}function rmax(){return ops.max.apply(ops,arguments)}function rmin(){return ops.min.apply(ops,arguments)}function rcompare(){return ops.compare.apply(ops,arguments)}function req(){return ops.eq.apply(ops,arguments)}function rlt(){return ops.lt.apply(ops,arguments)}function rgt(){return ops.gt.apply(ops,arguments)}function rlte(){return ops.lte.apply(ops,arguments)}function rgte(){return ops.gte.apply(ops,arguments)}function rlog(){return ops.log.apply(ops,arguments)}function rlog2(){return ops.log2.apply(ops,arguments)}function rlog10(){return ops.log10.apply(ops,arguments)}function rcbrt(){return ops.cbrt.apply(ops,arguments)}var cachedDataViewMemory0=null;function getDataViewMemory0(){return(null===cachedDataViewMemory0||!0===cachedDataViewMemory0.buffer.detached||void 0===cachedDataViewMemory0.buffer.detached&&cachedDataViewMemory0.buffer!==wasm.memory.buffer)&&(cachedDataViewMemory0=new DataView(wasm.memory.buffer)),cachedDataViewMemory0}function getStringFromWasm0(e,t){return decodeText(e>>>=0,t)}var cachedUint8ArrayMemory0=null;function getUint8ArrayMemory0(){return null!==cachedUint8ArrayMemory0&&0!==cachedUint8ArrayMemory0.byteLength||(cachedUint8ArrayMemory0=new Uint8Array(wasm.memory.buffer)),cachedUint8ArrayMemory0}function passStringToWasm0(e,t,r){if(void 0===r){var n=cachedTextEncoder.encode(e),i=t(n.length,1)>>>0;return getUint8ArrayMemory0().subarray(i,i+n.length).set(n),WASM_VECTOR_LEN=n.length,i}for(var a=e.length,o=t(a,1)>>>0,s=getUint8ArrayMemory0(),_=0;_<a;_++){var u=e.charCodeAt(_);if(u>127)break;s[o+_]=u}if(_!==a){0!==_&&(e=e.slice(_)),o=r(o,a,a=_+3*e.length,1)>>>0;var c=getUint8ArrayMemory0().subarray(o+_,o+a);o=r(o,a,_+=cachedTextEncoder.encodeInto(e,c).written,1)>>>0}return WASM_VECTOR_LEN=_,o}var cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});cachedTextDecoder.decode();var MAX_SAFARI_DECODE_BYTES=2146435072,numBytesDecoded=0;function decodeText(e,t){return(numBytesDecoded+=t)>=MAX_SAFARI_DECODE_BYTES&&((cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0})).decode(),numBytesDecoded=t),cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(e,e+t))}var cachedTextEncoder=new TextEncoder;"encodeInto"in cachedTextEncoder||(cachedTextEncoder.encodeInto=function(e,t){var r=cachedTextEncoder.encode(e);return t.set(r),{read:e.length,written:r.length}});var WASM_VECTOR_LEN=0;function eval_expr(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.eval_expr(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function eval_expr_safe(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.eval_expr_safe(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_abs(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_abs(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_ceil(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_ceil(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_compare(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return wasm.str_compare(r,n,i,a)}function str_cos(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_cos(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_div(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_div(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_eq(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_eq(r,n,i,a)}function str_exp(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_exp(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_floor(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_floor(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_fract(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_fract(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_gt(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_gt(r,n,i,a)}function str_gte(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_gte(r,n,i,a)}function str_is_integer(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_integer(t,r)}function str_is_negative(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_negative(t,r)}function str_is_positive(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_positive(t,r)}function str_is_zero(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_zero(t,r)}function str_ln(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_ln(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_log10(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_log10(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_lt(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_lt(r,n,i,a)}function str_lte(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_lte(r,n,i,a)}function str_max(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_max(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_min(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_min(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_mod(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_mod(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_mul(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_mul(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_neg(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_neg(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_normalize(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_normalize(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_plus(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_plus(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_pow(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_pow(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_powd(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_powd(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_round(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_round(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_round_dp(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_round_dp(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_round_dp_bankers(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_round_dp_bankers(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_scale(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return wasm.str_scale(t,r)>>>0}function str_sign(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return wasm.str_sign(t,r)}function str_sin(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_sin(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_sqrt(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_sqrt(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_sub(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_sub(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_tan(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_tan(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_trunc(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_trunc(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}var EXPECTED_RESPONSE_TYPES=new Set(["basic","cors","default"]);function __wbg_load(e,t){return _wbg_load.apply(this,arguments)}function _wbg_load(){return(_wbg_load=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,r){var n,i;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("function"==typeof Response&&t instanceof Response)){e.next=24;break}if("function"!=typeof WebAssembly.instantiateStreaming){e.next=16;break}return e.prev=2,e.next=5,WebAssembly.instantiateStreaming(t,r);case 5:case 21:return e.abrupt("return",e.sent);case 8:if(e.prev=8,e.t0=e.catch(2),!(t.ok&&EXPECTED_RESPONSE_TYPES.has(t.type))||"application/wasm"===t.headers.get("Content-Type")){e.next=15;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",e.t0),e.next=16;break;case 15:throw e.t0;case 16:return e.next=18,t.arrayBuffer();case 18:return n=e.sent,e.next=21,WebAssembly.instantiate(n,r);case 24:return e.next=26,WebAssembly.instantiate(t,r);case 26:if(!((i=e.sent)instanceof WebAssembly.Instance)){e.next=31;break}return e.abrupt("return",{instance:i,module:t});case 31:return e.abrupt("return",i);case 32:case"end":return e.stop()}}),e,null,[[2,8]])})))).apply(this,arguments)}function __wbg_get_imports(){var e={wbg:{}};return e}function __wbg_finalize_init(e,t){return wasm=e.exports,__wbg_init.__wbindgen_wasm_module=t,cachedDataViewMemory0=null,cachedUint8ArrayMemory0=null,wasm}function initSync(e){if(void 0!==wasm)return wasm;void 0!==e&&(Object.getPrototypeOf(e)===Object.prototype?e=e.module:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));var t=__wbg_get_imports();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),__wbg_finalize_init(new WebAssembly.Instance(e,t),e)}function __wbg_init(e){return _wbg_init.apply(this,arguments)}function _wbg_init(){return(_wbg_init=_asyncToGenerator(_regeneratorRuntime().mark((function e(t){var r,n,i,a;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===wasm){e.next=2;break}return e.abrupt("return",wasm);case 2:return void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?t=t.module_or_path:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===t&&(t=new URL("wasm_calc_bg.wasm",import.meta.url)),r=__wbg_get_imports(),("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t)),e.t0=__wbg_load,e.next=9,t;case 9:return e.t1=e.sent,e.t2=r,e.next=13,(0,e.t0)(e.t1,e.t2);case 13:return n=e.sent,i=n.instance,a=n.module,e.abrupt("return",__wbg_finalize_init(i,a));case 17:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var wasm_calc=Object.freeze({__proto__:null,default:__wbg_init,eval_expr:eval_expr,eval_expr_safe:eval_expr_safe,initSync:initSync,str_abs:str_abs,str_ceil:str_ceil,str_compare:str_compare,str_cos:str_cos,str_div:str_div,str_eq:str_eq,str_exp:str_exp,str_floor:str_floor,str_fract:str_fract,str_gt:str_gt,str_gte:str_gte,str_is_integer:str_is_integer,str_is_negative:str_is_negative,str_is_positive:str_is_positive,str_is_zero:str_is_zero,str_ln:str_ln,str_log10:str_log10,str_lt:str_lt,str_lte:str_lte,str_max:str_max,str_min:str_min,str_mod:str_mod,str_mul:str_mul,str_neg:str_neg,str_normalize:str_normalize,str_plus:str_plus,str_pow:str_pow,str_powd:str_powd,str_round:str_round,str_round_dp:str_round_dp,str_round_dp_bankers:str_round_dp_bankers,str_scale:str_scale,str_sign:str_sign,str_sin:str_sin,str_sqrt:str_sqrt,str_sub:str_sub,str_tan:str_tan,str_trunc:str_trunc});export{abs,add,babs,bacos,bacosh,badd,basin,basinh,batan,batanh,bcbrt,bceil,bcompare,bcos,bcosh,bdiv,beq,bexp,bfloor,bgt,bgte,bidiv,bln,blog,blog10,blog2,blt,blte,bmax,bmin,bmod,bmul,bneg,bpow,bround,bsin,bsinh,bsqrt,bsub,btan,btanh,btrunc,cadd,calc,calc_sum,calc_util,calc_wrap,cdiv,cidiv,cmod,cmul,compile,compile_all,cpow,csub,dabs,dacos,dacosh,dadd,dasin,dasinh,datan,datanh,dcbrt,dceil,dcompare,dcos,dcosh,ddiv,deq,dexp,dfloor,dgt,dgte,didiv,div,dln,dlog,dlog10,dlog2,dlt,dlte,dmax,dmin,dmod,dmul,dneg,dpow,dround,dsin,dsinh,dsqrt,dsub,dtan,dtanh,dtrunc,exp,fmt,get_config,idiv,is_wasm_loaded,ln,load_wasm,mod,mul,neg,parse_thousands,pow,rabs,racos,racosh,radd,rasin,rasinh,ratan,ratanh,rcbrt,rceil,rcompare,rcos,rcosh,rdiv,req,rexp,rfloor,rgt,rgte,ridiv,rln,rlog,rlog10,rlog2,rlt,rlte,rmax,rmin,rmod,rmul,rneg,rpow,rround,rsin,rsinh,rsqrt,rsub,rtan,rtanh,rtrunc,set_config,sqrt,sub,version,wabs,wacos,wacosh,wadd,wasin,wasinh,watan,watanh,wcalc,wcbrt,wceil,wcompare,wcos,wcosh,wdiv,weq,wexp,wfloor,wgt,wgte,widiv,wln,wlog,wlog10,wlog2,wlt,wlte,wmax,wmin,wmod,wmul,wneg,wpow,wround,wsin,wsinh,wsqrt,wsub,wtan,wtanh,wtrunc};
10
+ */var EXP_LIMIT=9e15,MAX_DIGITS=1e9,NUMERALS="0123456789abcdef",LN10="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",PI="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",DEFAULTS={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-EXP_LIMIT,maxE:EXP_LIMIT,crypto:!1},inexact,quadrant,external=!0,decimalError="[DecimalError] ",invalidArgument=decimalError+"Invalid argument: ",precisionLimitExceeded=decimalError+"Precision limit exceeded",cryptoUnavailable=decimalError+"crypto unavailable",tag="[object Decimal]",mathfloor=Math.floor,mathpow=Math.pow,isBinary=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,isHex=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,isOctal=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,isDecimal=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,BASE=1e7,LOG_BASE=7,MAX_SAFE_INTEGER=9007199254740991,LN10_PRECISION=LN10.length-1,PI_PRECISION=PI.length-1,P={toStringTag:tag};function digitsToString(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;t<i;t++)n=e[t]+"",(r=LOG_BASE-n.length)&&(a+=getZeroString(r)),a+=n;o=e[t],(r=LOG_BASE-(n=o+"").length)&&(a+=getZeroString(r))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}function checkInt32(e,t,r){if(e!==~~e||e<t||e>r)throw Error(invalidArgument+e)}function checkRoundingDigits(e,t,r,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=LOG_BASE,i=0):(i=Math.ceil((t+1)/LOG_BASE),t%=LOG_BASE),a=mathpow(10,LOG_BASE-t),s=e[i]%a|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),o=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):o=(r<4&&s+1==a||r>3&&s+1==a/2)&&(e[i+1]/a/100|0)==mathpow(10,t-2)-1||(s==a/2||0==s)&&!(e[i+1]/a/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),o=(n||r<4)&&9999==s||!n&&r>3&&4999==s):o=((n||r<4)&&s+1==a||!n&&r>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==mathpow(10,t-3)-1,o}function convertBase(e,t,r){for(var n,i,a=[0],o=0,s=e.length;o<s;){for(i=a.length;i--;)a[i]*=t;for(a[0]+=NUMERALS.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>r-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}function cosine(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/tinyPow(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=taylorSeries(e,1,t.times(i),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}P.absoluteValue=P.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),finalise(e)},P.ceil=function(){return finalise(new this.constructor(this),this.e+1,2)},P.clampedTo=P.clamp=function(e,t){var r=this,n=r.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(invalidArgument+t);return r.cmp(e)<0?e:r.cmp(t)>0?t:new n(r)},P.comparedTo=P.cmp=function(e){var t,r,n,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,_=a.s,u=e.s;if(!o||!s)return _&&u?_!==u?_:o===s?0:!o^_<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?_:s[0]?-u:0;if(_!==u)return _;if(a.e!==e.e)return a.e>e.e^_<0?1:-1;for(t=0,r=(n=o.length)<(i=s.length)?n:i;t<r;++t)if(o[t]!==s[t])return o[t]>s[t]^_<0?1:-1;return n===i?0:n>i^_<0?1:-1},P.cosine=P.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+LOG_BASE,n.rounding=1,r=cosine(n,toLessThanHalfPi(n,r)),n.precision=e,n.rounding=t,finalise(2==quadrant||3==quadrant?r.neg():r,e,t,!0)):new n(1):new n(NaN)},P.cubeRoot=P.cbrt=function(){var e,t,r,n,i,a,o,s,_,u,c=this,l=c.constructor;if(!c.isFinite()||c.isZero())return new l(c);for(external=!1,(a=c.s*mathpow(c.s*c,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=digitsToString(c.d),(a=((e=c.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=mathpow(r,1/3),e=mathfloor((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=c.s),o=(e=l.precision)+3;;)if(u=(_=(s=n).times(s).times(s)).plus(c),n=divide(u.plus(c).times(s),u.plus(_),o+2,1),digitsToString(s.d).slice(0,o)===(r=digitsToString(n.d)).slice(0,o)){if("9999"!=(r=r.slice(o-3,o+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(finalise(n,e+1,1),t=!n.times(n).times(n).eq(c));break}if(!i&&(finalise(s,e+1,0),s.times(s).times(s).eq(c))){n=s;break}o+=4,i=1}return external=!0,finalise(n,e,l.rounding,t)},P.decimalPlaces=P.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-mathfloor(this.e/LOG_BASE))*LOG_BASE,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},P.dividedBy=P.div=function(e){return divide(this,new this.constructor(e))},P.dividedToIntegerBy=P.divToInt=function(e){var t=this.constructor;return finalise(divide(this,new t(e),0,1,1),t.precision,t.rounding)},P.equals=P.eq=function(e){return 0===this.cmp(e)},P.floor=function(){return finalise(new this.constructor(this),this.e+1,3)},P.greaterThan=P.gt=function(e){return this.cmp(e)>0},P.greaterThanOrEqualTo=P.gte=function(e){var t=this.cmp(e);return 1==t||0===t},P.hyperbolicCosine=P.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?t=(1/tinyPow(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=taylorSeries(o,1,a.times(t),new o(1),!0);for(var _,u=e,c=new o(8);u--;)_=a.times(a),a=s.minus(_.times(c.minus(_.times(c))));return finalise(a,o.precision=r,o.rounding=n,!0)},P.hyperbolicSine=P.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=taylorSeries(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=taylorSeries(a,2,i=i.times(1/tinyPow(5,e)),i,!0);for(var o,s=new a(5),_=new a(16),u=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(_.times(o).plus(u))))}return a.precision=t,a.rounding=r,finalise(i,t,r,!0)},P.hyperbolicTangent=P.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,divide(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},P.inverseCosine=P.acos=function(){var e=this,t=e.constructor,r=e.abs().cmp(1),n=t.precision,i=t.rounding;return-1!==r?0===r?e.isNeg()?getPi(t,n,i):new t(0):new t(NaN):e.isZero()?getPi(t,n+4,i).times(.5):(t.precision=n+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=n,t.rounding=i,e.times(2))},P.inverseHyperbolicCosine=P.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,external=!1,r=r.times(r).minus(1).sqrt().plus(r),external=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},P.inverseHyperbolicSine=P.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,external=!1,r=r.times(r).plus(1).sqrt().plus(r),external=!0,n.precision=e,n.rounding=t,r.ln())},P.inverseHyperbolicTangent=P.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?finalise(new a(i),e,t,!0):(a.precision=r=n-i.e,i=divide(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},P.inverseSine=P.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==t?0===t?((e=getPi(a,r+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))},P.inverseTangent=P.atan=function(){var e,t,r,n,i,a,o,s,_,u=this,c=u.constructor,l=c.precision,f=c.rounding;if(u.isFinite()){if(u.isZero())return new c(u);if(u.abs().eq(1)&&l+4<=PI_PRECISION)return(o=getPi(c,l+4,f).times(.25)).s=u.s,o}else{if(!u.s)return new c(NaN);if(l+4<=PI_PRECISION)return(o=getPi(c,l+4,f).times(.5)).s=u.s,o}for(c.precision=s=l+10,c.rounding=1,e=r=Math.min(28,s/LOG_BASE+2|0);e;--e)u=u.div(u.times(u).plus(1).sqrt().plus(1));for(external=!1,t=Math.ceil(s/LOG_BASE),n=1,_=u.times(u),o=new c(u),i=u;-1!==e;)if(i=i.times(_),a=o.minus(i.div(n+=2)),i=i.times(_),void 0!==(o=a.plus(i.div(n+=2))).d[t])for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),external=!0,finalise(o,c.precision=l,c.rounding=f,!0)},P.isFinite=function(){return!!this.d},P.isInteger=P.isInt=function(){return!!this.d&&mathfloor(this.e/LOG_BASE)>this.d.length-2},P.isNaN=function(){return!this.s},P.isNegative=P.isNeg=function(){return this.s<0},P.isPositive=P.isPos=function(){return this.s>0},P.isZero=function(){return!!this.d&&0===this.d[0]},P.lessThan=P.lt=function(e){return this.cmp(e)<0},P.lessThanOrEqualTo=P.lte=function(e){return this.cmp(e)<1},P.logarithm=P.log=function(e){var t,r,n,i,a,o,s,_,u=this,c=u.constructor,l=c.precision,f=c.rounding;if(null==e)e=new c(10),t=!0;else{if(r=(e=new c(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new c(NaN);t=e.eq(10)}if(r=u.d,u.s<0||!r||!r[0]||u.eq(1))return new c(r&&!r[0]?-1/0:1!=u.s?NaN:r?0:1/0);if(t)if(r.length>1)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}if(external=!1,o=naturalLogarithm(u,s=l+5),n=t?getLn10(c,s+10):naturalLogarithm(e,s),checkRoundingDigits((_=divide(o,n,s,1)).d,i=l,f))do{if(o=naturalLogarithm(u,s+=10),n=t?getLn10(c,s+10):naturalLogarithm(e,s),_=divide(o,n,s,1),!a){+digitsToString(_.d).slice(i+1,i+15)+1==1e14&&(_=finalise(_,l+1,0));break}}while(checkRoundingDigits(_.d,i+=10,f));return external=!0,finalise(_,l,f)},P.minus=P.sub=function(e){var t,r,n,i,a,o,s,_,u,c,l,f,d=this,p=d.constructor;if(e=new p(e),!d.d||!e.d)return d.s&&e.s?d.d?e.s=-e.s:e=new p(e.d||d.s!==e.s?d:NaN):e=new p(NaN),e;if(d.s!=e.s)return e.s=-e.s,d.plus(e);if(u=d.d,f=e.d,s=p.precision,_=p.rounding,!u[0]||!f[0]){if(f[0])e.s=-e.s;else{if(!u[0])return new p(3===_?-0:0);e=new p(d)}return external?finalise(e,s,_):e}if(r=mathfloor(e.e/LOG_BASE),c=mathfloor(d.e/LOG_BASE),u=u.slice(),a=c-r){for((l=a<0)?(t=u,a=-a,o=f.length):(t=f,r=c,o=u.length),a>(n=Math.max(Math.ceil(s/LOG_BASE),o)+2)&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((l=(n=u.length)<(o=f.length))&&(o=n),n=0;n<o;n++)if(u[n]!=f[n]){l=u[n]<f[n];break}a=0}for(l&&(t=u,u=f,f=t,e.s=-e.s),o=u.length,n=f.length-o;n>0;--n)u[o++]=0;for(n=f.length;n>a;){if(u[--n]<f[n]){for(i=n;i&&0===u[--i];)u[i]=BASE-1;--u[i],u[n]+=BASE}u[n]-=f[n]}for(;0===u[--o];)u.pop();for(;0===u[0];u.shift())--r;return u[0]?(e.d=u,e.e=getBase10Exponent(u,r),external?finalise(e,s,_):e):new p(3===_?-0:0)},P.modulo=P.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?finalise(new n(r),n.precision,n.rounding):(external=!1,9==n.modulo?(t=divide(r,e.abs(),0,3,1)).s*=e.s:t=divide(r,e,0,n.modulo,1),t=t.times(e),external=!0,r.minus(t))},P.naturalExponential=P.exp=function(){return naturalExponential(this)},P.naturalLogarithm=P.ln=function(){return naturalLogarithm(this)},P.negated=P.neg=function(){var e=new this.constructor(this);return e.s=-e.s,finalise(e)},P.plus=P.add=function(e){var t,r,n,i,a,o,s,_,u,c,l=this,f=l.constructor;if(e=new f(e),!l.d||!e.d)return l.s&&e.s?l.d||(e=new f(e.d||l.s===e.s?l:NaN)):e=new f(NaN),e;if(l.s!=e.s)return e.s=-e.s,l.minus(e);if(u=l.d,c=e.d,s=f.precision,_=f.rounding,!u[0]||!c[0])return c[0]||(e=new f(l)),external?finalise(e,s,_):e;if(a=mathfloor(l.e/LOG_BASE),n=mathfloor(e.e/LOG_BASE),u=u.slice(),i=a-n){for(i<0?(r=u,i=-i,o=c.length):(r=c,n=a,o=u.length),i>(o=(a=Math.ceil(s/LOG_BASE))>o?a+1:o+1)&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((o=u.length)-(i=c.length)<0&&(i=o,r=c,c=u,u=r),t=0;i;)t=(u[--i]=u[i]+c[i]+t)/BASE|0,u[i]%=BASE;for(t&&(u.unshift(t),++n),o=u.length;0==u[--o];)u.pop();return e.d=u,e.e=getBase10Exponent(u,n),external?finalise(e,s,_):e},P.precision=P.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(invalidArgument+e);return r.d?(t=getPrecision(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},P.round=function(){var e=this,t=e.constructor;return finalise(new t(e),e.e+1,t.rounding)},P.sine=P.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+LOG_BASE,n.rounding=1,r=sine(n,toLessThanHalfPi(n,r)),n.precision=e,n.rounding=t,finalise(quadrant>2?r.neg():r,e,t,!0)):new n(NaN)},P.squareRoot=P.sqrt=function(){var e,t,r,n,i,a,o=this,s=o.d,_=o.e,u=o.s,c=o.constructor;if(1!==u||!s||!s[0])return new c(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);for(external=!1,0==(u=Math.sqrt(+o))||u==1/0?(((t=digitsToString(s)).length+_)%2==0&&(t+="0"),u=Math.sqrt(t),_=mathfloor((_+1)/2)-(_<0||_%2),n=new c(t=u==1/0?"5e"+_:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+_)):n=new c(u.toString()),r=(_=c.precision)+3;;)if(n=(a=n).plus(divide(o,a,r+2,1)).times(.5),digitsToString(a.d).slice(0,r)===(t=digitsToString(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(finalise(n,_+1,1),e=!n.times(n).eq(o));break}if(!i&&(finalise(a,_+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}return external=!0,finalise(n,_,c.rounding,e)},P.tangent=P.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=divide(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,finalise(2==quadrant||4==quadrant?r.neg():r,e,t,!0)):new n(NaN)},P.times=P.mul=function(e){var t,r,n,i,a,o,s,_,u,c=this,l=c.constructor,f=c.d,d=(e=new l(e)).d;if(e.s*=c.s,!(f&&f[0]&&d&&d[0]))return new l(!e.s||f&&!f[0]&&!d||d&&!d[0]&&!f?NaN:f&&d?0*e.s:e.s/0);for(r=mathfloor(c.e/LOG_BASE)+mathfloor(e.e/LOG_BASE),(_=f.length)<(u=d.length)&&(a=f,f=d,d=a,o=_,_=u,u=o),a=[],n=o=_+u;n--;)a.push(0);for(n=u;--n>=0;){for(t=0,i=_+n;i>n;)s=a[i]+d[n]*f[i-n-1]+t,a[i--]=s%BASE|0,t=s/BASE|0;a[i]=(a[i]+t)%BASE|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=getBase10Exponent(a,r),external?finalise(e,l.precision,l.rounding):e},P.toBinary=function(e,t){return toStringBinary(this,2,e,t)},P.toDecimalPlaces=P.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(checkInt32(e,0,MAX_DIGITS),void 0===t?t=n.rounding:checkInt32(t,0,8),finalise(r,e+r.e+1,t))},P.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=finiteToString(n,!0):(checkInt32(e,0,MAX_DIGITS),void 0===t?t=i.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},P.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return void 0===e?r=finiteToString(i):(checkInt32(e,0,MAX_DIGITS),void 0===t?t=a.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new a(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},P.toFraction=function(e){var t,r,n,i,a,o,s,_,u,c,l,f,d=this,p=d.d,g=d.constructor;if(!p)return new g(d);if(u=r=new g(1),n=_=new g(0),o=(a=(t=new g(n)).e=getPrecision(p)-d.e-1)%LOG_BASE,t.d[0]=mathpow(10,o<0?LOG_BASE+o:o),null==e)e=a>0?t:u;else{if(!(s=new g(e)).isInt()||s.lt(u))throw Error(invalidArgument+s);e=s.gt(t)?a>0?t:u:s}for(external=!1,s=new g(digitsToString(p)),c=g.precision,g.precision=a=p.length*LOG_BASE*2;l=divide(s,t,0,1,1),1!=(i=r.plus(l.times(n))).cmp(e);)r=n,n=i,i=u,u=_.plus(l.times(i)),_=i,i=t,t=s.minus(l.times(i)),s=i;return i=divide(e.minus(r),n,0,1,1),_=_.plus(i.times(u)),r=r.plus(i.times(n)),_.s=u.s=d.s,f=divide(u,n,a,1).minus(d).abs().cmp(divide(_,r,a,1).minus(d).abs())<1?[u,n]:[_,r],g.precision=c,external=!0,f},P.toHexadecimal=P.toHex=function(e,t){return toStringBinary(this,16,e,t)},P.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:checkInt32(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(external=!1,r=divide(r,e,0,t,1).times(e),external=!0,finalise(r)):(e.s=r.s,r=e),r},P.toNumber=function(){return+this},P.toOctal=function(e,t){return toStringBinary(this,8,e,t)},P.toPower=P.pow=function(e){var t,r,n,i,a,o,s=this,_=s.constructor,u=+(e=new _(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new _(mathpow(+s,u));if((s=new _(s)).eq(1))return s;if(n=_.precision,a=_.rounding,e.eq(1))return finalise(s,n,a);if((t=mathfloor(e.e/LOG_BASE))>=e.d.length-1&&(r=u<0?-u:u)<=MAX_SAFE_INTEGER)return i=intPow(_,s,r,n),e.s<0?new _(1).div(i):finalise(i,n,a);if((o=s.s)<0){if(t<e.d.length-1)return new _(NaN);if(1&e.d[t]||(o=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=o,s}return(t=0!=(r=mathpow(+s,u))&&isFinite(r)?new _(r+"").e:mathfloor(u*(Math.log("0."+digitsToString(s.d))/Math.LN10+s.e+1)))>_.maxE+1||t<_.minE-1?new _(t>0?o/0:0):(external=!1,_.rounding=s.s=1,r=Math.min(12,(t+"").length),(i=naturalExponential(e.times(naturalLogarithm(s,n+r)),n)).d&&checkRoundingDigits((i=finalise(i,n+5,1)).d,n,a)&&(t=n+10,+digitsToString((i=finalise(naturalExponential(e.times(naturalLogarithm(s,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=finalise(i,n+1,0))),i.s=o,external=!0,_.rounding=a,finalise(i,n,a))},P.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=finiteToString(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(checkInt32(e,1,MAX_DIGITS),void 0===t?t=i.rounding:checkInt32(t,0,8),r=finiteToString(n=finalise(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},P.toSignificantDigits=P.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(checkInt32(e,1,MAX_DIGITS),void 0===t?t=r.rounding:checkInt32(t,0,8)),finalise(new r(this),e,t)},P.toString=function(){var e=this,t=e.constructor,r=finiteToString(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},P.truncated=P.trunc=function(){return finalise(new this.constructor(this),this.e+1,1)},P.valueOf=P.toJSON=function(){var e=this,t=e.constructor,r=finiteToString(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var divide=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,o,s,_){var u,c,l,f,d,p,g,m,v,h,w,b,y,x,S,E,A,T,D,N,k=n.constructor,O=n.s==i.s?1:-1,P=n.d,M=i.d;if(!(P&&P[0]&&M&&M[0]))return new k(n.s&&i.s&&(P?!M||P[0]!=M[0]:M)?P&&0==P[0]||!M?0*O:O/0:NaN);for(_?(d=1,c=n.e-i.e):(_=BASE,d=LOG_BASE,c=mathfloor(n.e/d)-mathfloor(i.e/d)),D=M.length,A=P.length,h=(v=new k(O)).d=[],l=0;M[l]==(P[l]||0);l++);if(M[l]>(P[l]||0)&&c--,null==a?(x=a=k.precision,o=k.rounding):x=s?a+(n.e-i.e)+1:a,x<0)h.push(1),p=!0;else{if(x=x/d+2|0,l=0,1==D){for(f=0,M=M[0],x++;(l<A||f)&&x--;l++)S=f*_+(P[l]||0),h[l]=S/M|0,f=S%M|0;p=f||l<A}else{for((f=_/(M[0]+1)|0)>1&&(M=e(M,f,_),P=e(P,f,_),D=M.length,A=P.length),E=D,b=(w=P.slice(0,D)).length;b<D;)w[b++]=0;(N=M.slice()).unshift(0),T=M[0],M[1]>=_/2&&++T;do{f=0,(u=t(M,w,D,b))<0?(y=w[0],D!=b&&(y=y*_+(w[1]||0)),(f=y/T|0)>1?(f>=_&&(f=_-1),1==(u=t(g=e(M,f,_),w,m=g.length,b=w.length))&&(f--,r(g,D<m?N:M,m,_))):(0==f&&(u=f=1),g=M.slice()),(m=g.length)<b&&g.unshift(0),r(w,g,b,_),-1==u&&(u=t(M,w,D,b=w.length))<1&&(f++,r(w,D<b?N:M,b,_)),b=w.length):0===u&&(f++,w=[0]),h[l++]=f,u&&w[0]?w[b++]=P[E]||0:(w=[P[E]],b=1)}while((E++<A||void 0!==w[0])&&x--);p=void 0!==w[0]}h[0]||h.shift()}if(1==d)v.e=c,inexact=p;else{for(l=1,f=h[0];f>=10;f/=10)l++;v.e=l+c*d-1,finalise(v,s?a+v.e+1:a,o,p)}return v}}();function finalise(e,t,r,n){var i,a,o,s,_,u,c,l,f,d=e.constructor;e:if(null!=t){if(!(l=e.d))return e;for(i=1,s=l[0];s>=10;s/=10)i++;if((a=t-i)<0)a+=LOG_BASE,o=t,_=(c=l[f=0])/mathpow(10,i-o-1)%10|0;else if((f=Math.ceil((a+1)/LOG_BASE))>=(s=l.length)){if(!n)break e;for(;s++<=f;)l.push(0);c=_=0,i=1,o=(a%=LOG_BASE)-LOG_BASE+1}else{for(c=s=l[f],i=1;s>=10;s/=10)i++;_=(o=(a%=LOG_BASE)-LOG_BASE+i)<0?0:c/mathpow(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[f+1]||(o<0?c:c%mathpow(10,i-o-1)),u=r<4?(_||n)&&(0==r||r==(e.s<0?3:2)):_>5||5==_&&(4==r||n||6==r&&(a>0?o>0?c/mathpow(10,i-o):0:l[f-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,u?(t-=e.e+1,l[0]=mathpow(10,(LOG_BASE-t%LOG_BASE)%LOG_BASE),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=f,s=1,f--):(l.length=f+1,s=mathpow(10,LOG_BASE-a),l[f]=o>0?(c/mathpow(10,i-o)%mathpow(10,o)|0)*s:0),u)for(;;){if(0==f){for(a=1,o=l[0];o>=10;o/=10)a++;for(o=l[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,l[0]==BASE&&(l[0]=1));break}if(l[f]+=s,l[f]!=BASE)break;l[f--]=0,s=1}for(a=l.length;0===l[--a];)l.pop()}return external&&(e.e>d.maxE?(e.d=null,e.e=NaN):e.e<d.minE&&(e.e=0,e.d=[0])),e}function finiteToString(e,t,r){if(!e.isFinite())return nonFiniteToString(e);var n,i=e.e,a=digitsToString(e.d),o=a.length;return t?(r&&(n=r-o)>0?a=a.charAt(0)+"."+a.slice(1)+getZeroString(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+getZeroString(-i-1)+a,r&&(n=r-o)>0&&(a+=getZeroString(n))):i>=o?(a+=getZeroString(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+getZeroString(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(a+="."),a+=getZeroString(n))),a}function getBase10Exponent(e,t){var r=e[0];for(t*=LOG_BASE;r>=10;r/=10)t++;return t}function getLn10(e,t,r){if(t>LN10_PRECISION)throw external=!0,r&&(e.precision=r),Error(precisionLimitExceeded);return finalise(new e(LN10),t,1,!0)}function getPi(e,t,r){if(t>PI_PRECISION)throw Error(precisionLimitExceeded);return finalise(new e(PI),t,r,!0)}function getPrecision(e){var t=e.length-1,r=t*LOG_BASE+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function getZeroString(e){for(var t="";e--;)t+="0";return t}function intPow(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/LOG_BASE+4);for(external=!1;;){if(r%2&&truncate((a=a.times(t)).d,o)&&(i=!0),0===(r=mathfloor(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}truncate((t=t.times(t)).d,o)}return external=!0,a}function isOdd(e){return 1&e.d[e.d.length-1]}function maxOrMin(e,t,r){for(var n,i,a=new e(t[0]),o=0;++o<t.length;){if(!(i=new e(t[o])).s){a=i;break}((n=a.cmp(i))===r||0===n&&a.s===r)&&(a=i)}return a}function naturalExponential(e,t){var r,n,i,a,o,s,_,u=0,c=0,l=0,f=e.constructor,d=f.rounding,p=f.precision;if(!e.d||!e.d[0]||e.e>17)return new f(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(external=!1,_=p):_=t,s=new f(.03125);e.e>-2;)e=e.times(s),l+=5;for(_+=n=Math.log(mathpow(2,l))/Math.LN10*2+5|0,r=a=o=new f(1),f.precision=_;;){if(a=finalise(a.times(e),_,1),r=r.times(++c),digitsToString((s=o.plus(divide(a,r,_,1))).d).slice(0,_)===digitsToString(o.d).slice(0,_)){for(i=l;i--;)o=finalise(o.times(o),_,1);if(null!=t)return f.precision=p,o;if(!(u<3&&checkRoundingDigits(o.d,_-n,d,u)))return finalise(o,f.precision=p,d,external=!0);f.precision=_+=10,r=a=s=new f(1),c=0,u++}o=s}}function naturalLogarithm(e,t){var r,n,i,a,o,s,_,u,c,l,f,d=1,p=e,g=p.d,m=p.constructor,v=m.rounding,h=m.precision;if(p.s<0||!g||!g[0]||!p.e&&1==g[0]&&1==g.length)return new m(g&&!g[0]?-1/0:1!=p.s?NaN:g?0:p);if(null==t?(external=!1,c=h):c=t,m.precision=c+=10,n=(r=digitsToString(g)).charAt(0),!(Math.abs(a=p.e)<15e14))return u=getLn10(m,c+2,h).times(a+""),p=naturalLogarithm(new m(n+"."+r.slice(1)),c-10).plus(u),m.precision=h,null==t?finalise(p,h,v,external=!0):p;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=digitsToString((p=p.times(e)).d)).charAt(0),d++;for(a=p.e,n>1?(p=new m("0."+r),a++):p=new m(n+"."+r.slice(1)),l=p,_=o=p=divide(p.minus(1),p.plus(1),c,1),f=finalise(p.times(p),c,1),i=3;;){if(o=finalise(o.times(f),c,1),digitsToString((u=_.plus(divide(o,new m(i),c,1))).d).slice(0,c)===digitsToString(_.d).slice(0,c)){if(_=_.times(2),0!==a&&(_=_.plus(getLn10(m,c+2,h).times(a+""))),_=divide(_,new m(d),c,1),null!=t)return m.precision=h,_;if(!checkRoundingDigits(_.d,c-10,v,s))return finalise(_,m.precision=h,v,external=!0);m.precision=c+=10,u=o=p=divide(l.minus(1),l.plus(1),c,1),f=finalise(p.times(p),c,1),i=s=1}_=u,i+=2}}function nonFiniteToString(e){return String(e.s*e.s/0)}function parseDecimal(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%LOG_BASE,r<0&&(n+=LOG_BASE),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=LOG_BASE;n<i;)e.d.push(+t.slice(n,n+=LOG_BASE));t=t.slice(n),n=LOG_BASE-t.length}else n-=i;for(;n--;)t+="0";e.d.push(+t),external&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function parseOther(e,t){var r,n,i,a,o,s,_,u,c;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),isDecimal.test(t))return parseDecimal(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(isHex.test(t))r=16,t=t.toLowerCase();else if(isBinary.test(t))r=2;else{if(!isOctal.test(t))throw Error(invalidArgument+t);r=8}for((a=t.search(/p/i))>0?(_=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),o=(a=t.indexOf("."))>=0,n=e.constructor,o&&(a=(s=(t=t.replace(".","")).length)-a,i=intPow(n,new n(r),a,2*a)),a=c=(u=convertBase(t,r,BASE)).length-1;0===u[a];--a)u.pop();return a<0?new n(0*e.s):(e.e=getBase10Exponent(u,c),e.d=u,external=!1,o&&(e=divide(e,i,4*s)),_&&(e=e.times(Math.abs(_)<54?mathpow(2,_):Decimal.pow(2,_))),external=!0,e)}function sine(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:taylorSeries(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=taylorSeries(e,2,t=t.times(1/tinyPow(5,r)),t);for(var i,a=new e(5),o=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(s))));return t}function taylorSeries(e,t,r,n,i){var a,o,s,_,u=e.precision,c=Math.ceil(u/LOG_BASE);for(external=!1,_=r.times(r),s=new e(n);;){if(o=divide(s.times(_),new e(t++*t++),u,1),s=i?n.plus(o):n.minus(o),n=divide(o.times(_),new e(t++*t++),u,1),void 0!==(o=s.plus(n)).d[c]){for(a=c;o.d[a]===s.d[a]&&a--;);if(-1==a)break}a=s,s=n,n=o,o=a}return external=!0,o.d.length=c+1,o}function tinyPow(e,t){for(var r=e;--t;)r*=e;return r}function toLessThanHalfPi(e,t){var r,n=t.s<0,i=getPi(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return quadrant=n?4:1,t;if((r=t.divToInt(i)).isZero())quadrant=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return quadrant=isOdd(r)?n?2:3:n?4:1,t;quadrant=isOdd(r)?n?1:4:n?3:2}return t.minus(i).abs()}function toStringBinary(e,t,r,n){var i,a,o,s,_,u,c,l,f,d=e.constructor,p=void 0!==r;if(p?(checkInt32(r,1,MAX_DIGITS),void 0===n?n=d.rounding:checkInt32(n,0,8)):(r=d.precision,n=d.rounding),e.isFinite()){for(p?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,(o=(c=finiteToString(e)).indexOf("."))>=0&&(c=c.replace(".",""),(f=new d(1)).e=c.length-o,f.d=convertBase(finiteToString(f),10,i),f.e=f.d.length),a=_=(l=convertBase(c,10,i)).length;0==l[--_];)l.pop();if(l[0]){if(o<0?a--:((e=new d(e)).d=l,e.e=a,l=(e=divide(e,f,r,n,0,i)).d,a=e.e,u=inexact),o=l[r],s=i/2,u=u||void 0!==l[r+1],u=n<4?(void 0!==o||u)&&(0===n||n===(e.s<0?3:2)):o>s||o===s&&(4===n||u||6===n&&1&l[r-1]||n===(e.s<0?8:7)),l.length=r,u)for(;++l[--r]>i-1;)l[r]=0,r||(++a,l.unshift(1));for(_=l.length;!l[_-1];--_);for(o=0,c="";o<_;o++)c+=NUMERALS.charAt(l[o]);if(p){if(_>1)if(16==t||8==t){for(o=16==t?4:3,--_;_%o;_++)c+="0";for(_=(l=convertBase(c,i,t)).length;!l[_-1];--_);for(o=1,c="1.";o<_;o++)c+=NUMERALS.charAt(l[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>_)for(a-=_;a--;)c+="0";else a<_&&(c=c.slice(0,a)+"."+c.slice(a))}else c=p?"0p+0":"0";c=(16==t?"0x":2==t?"0b":8==t?"0o":"")+c}else c=nonFiniteToString(e);return e.s<0?"-"+c:c}function truncate(e,t){if(e.length>t)return e.length=t,!0}function abs$1(e){return new this(e).abs()}function acos(e){return new this(e).acos()}function acosh(e){return new this(e).acosh()}function add$1(e,t){return new this(e).plus(t)}function asin(e){return new this(e).asin()}function asinh(e){return new this(e).asinh()}function atan(e){return new this(e).atan()}function atanh(e){return new this(e).atanh()}function atan2(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?getPi(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=getPi(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(divide(e,t,a,1)),t=getPi(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(divide(e,t,a,1)):(r=getPi(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function cbrt(e){return new this(e).cbrt()}function ceil(e){return finalise(e=new this(e),e.e+1,2)}function clamp(e,t,r){return new this(e).clamp(t,r)}function config(e){if(!e||"object"!==_typeof(e))throw Error(decimalError+"Object expected");var t,r,n,i=!0===e.defaults,a=["precision",1,MAX_DIGITS,"rounding",0,8,"toExpNeg",-EXP_LIMIT,0,"toExpPos",0,EXP_LIMIT,"maxE",0,EXP_LIMIT,"minE",-EXP_LIMIT,0,"modulo",0,9];for(t=0;t<a.length;t+=3)if(r=a[t],i&&(this[r]=DEFAULTS[r]),void 0!==(n=e[r])){if(!(mathfloor(n)===n&&n>=a[t+1]&&n<=a[t+2]))throw Error(invalidArgument+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=DEFAULTS[r]),void 0!==(n=e[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(invalidArgument+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(cryptoUnavailable);this[r]=!0}else this[r]=!1}return this}function cos(e){return new this(e).cos()}function cosh(e){return new this(e).cosh()}function clone(e){var t,r,n;function i(e){var t,r,n,a=this;if(!(a instanceof i))return new i(e);if(a.constructor=i,isDecimalInstance(e))return a.s=e.s,void(external?!e.d||e.e>i.maxE?(a.e=NaN,a.d=null):e.e<i.minE?(a.e=0,a.d=[0]):(a.e=e.e,a.d=e.d.slice()):(a.e=e.e,a.d=e.d?e.d.slice():e.d));if("number"===(n=_typeof(e))){if(0===e)return a.s=1/e<0?-1:1,a.e=0,void(a.d=[0]);if(e<0?(e=-e,a.s=-1):a.s=1,e===~~e&&e<1e7){for(t=0,r=e;r>=10;r/=10)t++;return void(external?t>i.maxE?(a.e=NaN,a.d=null):t<i.minE?(a.e=0,a.d=[0]):(a.e=t,a.d=[e]):(a.e=t,a.d=[e]))}return 0*e!=0?(e||(a.s=NaN),a.e=NaN,void(a.d=null)):parseDecimal(a,e.toString())}if("string"===n)return 45===(r=e.charCodeAt(0))?(e=e.slice(1),a.s=-1):(43===r&&(e=e.slice(1)),a.s=1),isDecimal.test(e)?parseDecimal(a,e):parseOther(a,e);if("bigint"===n)return e<0?(e=-e,a.s=-1):a.s=1,parseDecimal(a,e.toString());throw Error(invalidArgument+e)}if(i.prototype=P,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.EUCLID=9,i.config=i.set=config,i.clone=clone,i.isDecimal=isDecimalInstance,i.abs=abs$1,i.acos=acos,i.acosh=acosh,i.add=add$1,i.asin=asin,i.asinh=asinh,i.atan=atan,i.atanh=atanh,i.atan2=atan2,i.cbrt=cbrt,i.ceil=ceil,i.clamp=clamp,i.cos=cos,i.cosh=cosh,i.div=div$1,i.exp=exp$1,i.floor=floor,i.hypot=hypot,i.ln=ln$1,i.log=log,i.log10=log10,i.log2=log2,i.max=max,i.min=min,i.mod=mod$1,i.mul=mul$1,i.pow=pow$1,i.random=random,i.round=round,i.sign=sign,i.sin=sin,i.sinh=sinh,i.sqrt=sqrt$1,i.sub=sub$1,i.sum=sum,i.tan=tan,i.tanh=tanh,i.trunc=trunc,void 0===e&&(e={}),e&&!0!==e.defaults)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return i.config(e),i}function div$1(e,t){return new this(e).div(t)}function exp$1(e){return new this(e).exp()}function floor(e){return finalise(e=new this(e),e.e+1,3)}function hypot(){var e,t,r=new this(0);for(external=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return external=!0,new this(1/0);r=t}return external=!0,r.sqrt()}function isDecimalInstance(e){return e instanceof Decimal||e&&e.toStringTag===tag||!1}function ln$1(e){return new this(e).ln()}function log(e,t){return new this(e).log(t)}function log2(e){return new this(e).log(2)}function log10(e){return new this(e).log(10)}function max(){return maxOrMin(this,arguments,-1)}function min(){return maxOrMin(this,arguments,1)}function mod$1(e,t){return new this(e).mod(t)}function mul$1(e,t){return new this(e).mul(t)}function pow$1(e,t){return new this(e).pow(t)}function random(e){var t,r,n,i,a=0,o=new this(1),s=[];if(void 0===e?e=this.precision:checkInt32(e,1,MAX_DIGITS),n=Math.ceil(e/LOG_BASE),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));a<n;)(i=t[a])>=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(cryptoUnavailable);for(t=crypto.randomBytes(n*=4);a<n;)(i=t[a]+(t[a+1]<<8)+(t[a+2]<<16)+((127&t[a+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,a):(s.push(i%1e7),a+=4);a=n/4}else for(;a<n;)s[a++]=1e7*Math.random()|0;for(n=s[--a],e%=LOG_BASE,n&&e&&(i=mathpow(10,LOG_BASE-e),s[a]=(n/i|0)*i);0===s[a];a--)s.pop();if(a<0)r=0,s=[0];else{for(r=-1;0===s[0];r-=LOG_BASE)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<LOG_BASE&&(r-=LOG_BASE-n)}return o.e=r,o.d=s,o}function round(e){return finalise(e=new this(e),e.e+1,this.rounding)}function sign(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function sin(e){return new this(e).sin()}function sinh(e){return new this(e).sinh()}function sqrt$1(e){return new this(e).sqrt()}function sub$1(e,t){return new this(e).sub(t)}function sum(){var e=0,t=arguments,r=new this(t[e]);for(external=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return external=!0,finalise(r,this.precision,this.rounding)}function tan(e){return new this(e).tan()}function tanh(e){return new this(e).tanh()}function trunc(e){return finalise(e=new this(e),e.e+1,1)}P[Symbol.for("nodejs.util.inspect.custom")]=P.toString,P[Symbol.toStringTag]="Decimal";var Decimal=P.constructor=clone(DEFAULTS);function resolve_unit_value$1(e,t){return e&&e.startsWith("@")?get_real_value(t,e.slice(1)):e}function push_token$2(e,t,r,n,i){t===state_var||t===state_integer_padding&&var_char.includes(r[0])?(i.has_var=!0,e.push({type:t,value:r,real_value:get_real_value(i.fill_data,r)})):e.push({type:t,value:r}),n.prev=n.curr,i.state=state_initial}function fmt_tokenizer(e,t){for(var r,n={prev:0,curr:0},i=e.length,a={state:state_initial,fill_data:t,has_var:!1},o=[];n.curr<i;)switch(r=e[n.curr],a.state){case state_initial:if(" "===r)n.curr++,n.prev=n.curr;else if("<>=".includes(r))a.state=state_symbol,n.curr++;else if(","===r)n.curr++,push_token$2(o,state_comma,",",n,a);else if(var_char.includes(r))a.state=state_var,n.curr++;else if(number_char.includes(r))a.state=state_number,n.curr++;else if("+"===r)n.curr++,push_token$2(o,state_plus,"+",n,a);else if("~"===r)n.curr++,a.state=state_round;else if("%"===r)n.curr++,push_token$2(o,state_percent,"%",n,a);else if("/"===r)n.curr++,push_token$2(o,state_fraction,"/",n,a);else if("!"===r)if(a.state=state_initial,n.curr++,"n"===e[n.curr])n.curr++,push_token$2(o,state_to_number,"!n",n,a);else if("u"===e[n.curr]){n.curr++;var s=e[n.curr];if("a"===s||"b"===s||"m"===s){if(n.curr++,":"===e[n.curr]){n.curr++;for(var _=n.curr;n.curr<i&&" "!==e[n.curr];)n.curr++;var u=e.slice(_,n.curr).split(":"),c=resolve_unit_value$1(u[0],a.fill_data),l=u[1]?resolve_unit_value$1(u[1],a.fill_data):null;(u[0].startsWith("@")||u[1]&&u[1].startsWith("@"))&&(a.has_var=!0);var f={a:state_unit_after,b:state_unit_before,m:state_unit_middle};o.push({type:f[s],value:"!u".concat(s),unit:c,input_unit:l})}else{var d={a:state_unit_after,b:state_unit_before,m:state_unit_middle};o.push({type:d[s],value:"!u".concat(s),unit:null,input_unit:null,use_default:!0})}n.prev=n.curr,a.state=state_initial}else if("h"===s){if(n.curr++,":"===e[n.curr]){n.curr++;for(var p=n.curr;n.curr<i&&" "!==e[n.curr];)n.curr++;var g=e.slice(p,n.curr).split(":"),m=resolve_unit_value$1(g[0],a.fill_data),v=g[1]?resolve_unit_value$1(g[1],a.fill_data):null;(g[0].startsWith("@")||g[1]&&g[1].startsWith("@"))&&(a.has_var=!0),o.push({type:state_unit_hide,value:"!uh",unit:m,input_unit:v})}else{var h=get_config("_unit_default_out");if(h){var w=Array.isArray(h)?h[0]:h;o.push({type:state_unit_hide,value:"!uh",unit:w,input_unit:null})}else o.push({type:state_to_number_string,value:"!uh"})}n.prev=n.curr,a.state=state_initial}else if(":"===e[n.curr]){n.curr++;for(var b=n.curr;n.curr<i&&" "!==e[n.curr];)n.curr++;var y=e.slice(b,n.curr).split(":"),x=resolve_unit_value$1(y[0],a.fill_data),S=y[1]?resolve_unit_value$1(y[1],a.fill_data):null;(y[0].startsWith("@")||y[1]&&y[1].startsWith("@"))&&(a.has_var=!0),o.push({type:state_unit_default,value:"!u",unit:x,input_unit:S}),n.prev=n.curr,a.state=state_initial}else{var E=get_config("_unit_default_out");if(E){var A=Array.isArray(E)?E[0]:E;o.push({type:state_unit_default,value:"!u",unit:A,input_unit:null}),n.prev=n.curr,a.state=state_initial}else push_token$2(o,state_to_number_string,"!u",n,a)}}else if("e"===e[n.curr])n.curr++,push_token$2(o,state_scientific,"!e",n,a);else if("c"===e[n.curr]){n.curr++;var T=null;if(":"===e[n.curr]){n.curr++;for(var D=n.curr;n.curr<i&&/[a-zA-Z0-9_]/.test(e[n.curr]);)n.curr++;T=e.slice(D,n.curr)}o.push({type:state_compact,value:"!c",preset:T}),n.prev=n.curr,a.state=state_initial}else if("i"===e[n.curr]){if(n.curr++,":"!==e[n.curr])throw new Error("!i 语法需要指定位数,格式: !i:n");n.curr++;var N=n.curr;if("@"===e[n.curr]){for(n.curr++;n.curr<i&&var_members_char.includes(e[n.curr]);)n.curr++;var k=e.slice(N+1,n.curr),O=get_real_value(a.fill_data,k);a.has_var=!0,o.push({type:state_integer_padding,value:k,real_value:O})}else{for(;n.curr<i&&number_char.includes(e[n.curr]);)n.curr++;var P=e.slice(N,n.curr);o.push({type:state_integer_padding,value:P})}n.prev=n.curr,a.state=state_initial}else if("t"===e[n.curr])if(n.curr++,":"!==e[n.curr])o.push({type:state_thousands,value:"!t",preset:"default"}),n.prev=n.curr,a.state=state_initial;else{n.curr++;var M=n.curr;if("@"===e[n.curr]){for(n.curr++;n.curr<i&&var_members_char.includes(e[n.curr]);)n.curr++;var I=e.slice(M+1,n.curr),W=get_real_value(a.fill_data,I);a.has_var=!0,o.push({type:state_thousands,value:"!t",preset:W,preset_var:I})}else{for(;n.curr<i&&/[a-zA-Z0-9_]/.test(e[n.curr]);)n.curr++;var L=e.slice(M,n.curr);o.push({type:state_thousands,value:"!t",preset:L})}n.prev=n.curr,a.state=state_initial}else{if("g"!==e[n.curr])throw new Error("无法识别的!模式字符:".concat(e[n.curr]));if(n.curr++,":"!==e[n.curr])throw new Error("!g 语法需要指定分组名称,格式: !g:name");if(n.curr++,"@"===e[n.curr]){n.curr++;for(var C=n.curr;n.curr<i&&var_members_char.includes(e[n.curr]);)n.curr++;var j=e.slice(C,n.curr),F=get_real_value(a.fill_data,j);a.has_var=!0,o.push({type:state_fmt_group,value:"!g",group_name:F,var_path:j})}else{for(var q=n.curr;n.curr<i&&/[a-zA-Z0-9_]/.test(e[n.curr]);)n.curr++;var V=e.slice(q,n.curr);o.push({type:state_fmt_group,value:"!g",group_name:V})}n.prev=n.curr,a.state=state_initial}else if("#"===r)if(n.curr++,"@"===e[n.curr]){n.curr++;for(var R=n.curr;n.curr<i&&var_members_char.includes(e[n.curr]);)n.curr++;var B=e.slice(R,n.curr),$=get_real_value(a.fill_data,B);a.has_var=!0,o.push({type:state_fmt_group,value:"#",group_name:$,var_path:B}),n.prev=n.curr,a.state=state_initial}else{for(var G=n.curr;n.curr<i&&/[a-zA-Z0-9_]/.test(e[n.curr]);)n.curr++;var z=e.slice(G,n.curr);z?(o.push({type:state_fmt_group,value:"#",group_name:z}),n.prev=n.curr,a.state=state_initial):(n.prev=n.curr,a.state=state_initial)}else if("["===r){for(n.curr++;n.curr<i&&" "===e[n.curr];)n.curr++;var U=n.curr,H=void 0;if("@"===e[n.curr]){for(n.curr++;n.curr<i&&/[a-zA-Z0-9_$.]/.test(e[n.curr]);)n.curr++;var Z=e.slice(U+1,n.curr);H=get_real_value(a.fill_data,Z),a.has_var=!0}else{for("-"!==e[n.curr]&&"+"!==e[n.curr]||n.curr++;n.curr<i&&(number_char.includes(e[n.curr])||"."===e[n.curr]);)n.curr++;H=e.slice(U,n.curr)}for(;n.curr<i&&" "===e[n.curr];)n.curr++;for(","===e[n.curr]&&n.curr++;n.curr<i&&" "===e[n.curr];)n.curr++;var X=n.curr,K=void 0;if("@"===e[n.curr]){for(n.curr++;n.curr<i&&/[a-zA-Z0-9_$.]/.test(e[n.curr]);)n.curr++;var J=e.slice(X+1,n.curr);K=get_real_value(a.fill_data,J),a.has_var=!0}else{for("-"!==e[n.curr]&&"+"!==e[n.curr]||n.curr++;n.curr<i&&(number_char.includes(e[n.curr])||"."===e[n.curr]);)n.curr++;K=e.slice(X,n.curr)}for(;n.curr<i&&" "===e[n.curr];)n.curr++;"]"===e[n.curr]&&n.curr++,o.push({type:state_range_clamp,min:""===H?null:H,max:""===K?null:K}),n.prev=n.curr,a.state=state_initial}else":"===r?(a.state=state_shortcut,n.curr++):(n.curr++,n.prev=n.curr);break;case state_symbol:"="===r&&n.curr++,push_token$2(o,state_symbol,e.slice(n.prev,n.curr),n,a);break;case state_number:number_char.includes(r)?n.curr++:push_token$2(o,state_number,e.slice(n.prev,n.curr),n,a);break;case state_var:var_members_char.includes(r)?n.curr++:push_token$2(o,state_var,e.slice(n.prev,n.curr),n,a);break;case state_round:if(!("56+-".includes(r)&&n.curr-n.prev<2))throw new Error("错误的舍入语法:".concat(e.slice(n.prev,n.curr+1)));n.curr++,push_token$2(o,state_round,e.slice(n.prev,n.curr),n,a);break;case state_integer_padding:if(number_char.includes(r))n.curr++;else if(var_members_char.includes(r))n.curr++;else{var Y=e.slice(n.prev,n.curr);var_char.includes(Y[0])?(a.has_var=!0,o.push({type:state_integer_padding,value:Y,real_value:get_real_value(a.fill_data,Y)})):push_token$2(o,state_integer_padding,Y,n,a),n.prev=n.curr,a.state=state_initial}break;case state_shortcut:for(var Q=n.curr,ee=new Set([",","=","+","<",">","~","!","[","/","%","-"]);n.curr<i&&" "!==e[n.curr]&&!ee.has(e[n.curr]);)n.curr++;var te=e.slice(Q,n.curr);if(!te){n.prev=n.curr,a.state=state_initial;break}var re,ne=get_config("_shortcut_prefix")||"!u",ie=fmt_tokenizer("".concat(ne,":").concat(te),a.fill_data),ae=_createForOfIteratorHelper(ie);try{for(ae.s();!(re=ae.n()).done;){var oe=re.value;o.push(oe)}}catch(e){ae.e(e)}finally{ae.f()}ie.has_var&&(a.has_var=!0),n.prev=n.curr,a.state=state_initial;break;default:throw new Error("错误的fmt分词器状态")}return n.prev<n.curr&&push_token$2(o,a.state,e.slice(n.prev,n.curr),n,a),o.has_var=a.has_var,o}LN10=new Decimal(LN10),PI=new Decimal(PI);var symbol_set=new Set(["<",">","=",">=","<="]),round_set=new Set(["~+","~-","~5","~6"]);function resolve_unit_value(e,t){return e&&e.startsWith("@")?get_real_value(t,e.slice(1)):e}function create_token_from_string(e,t){var r=t.scope;if(","===e)return{type:state_comma,value:","};if(symbol_set.has(e))return{type:state_symbol,value:e};if(!Number.isNaN(Number(e)))return{type:state_number,value:e};if(var_first_char.includes(e[0]))return r.has_var=!0,{type:state_var,value:e,real_value:get_real_value(r.fill_data,e)};if("%"===e)return{type:state_percent,value:e};if("/"===e)return{type:state_fraction,value:e};if("+"===e)return{type:state_plus,value:e};if(round_set.has(e))return{type:state_round,value:e};if("!n"===e)return{type:state_to_number,value:e};if("!u"===e)return{type:state_to_number_string,value:e};if("!uh"===e)return{type:state_to_number_string,value:e};if(e.startsWith("!uh:")){var n=e.slice(4).split(":"),i=resolve_unit_value(n[0],r.fill_data),a=n[1]?resolve_unit_value(n[1],r.fill_data):null;return(n[0].startsWith("@")||n[1]&&n[1].startsWith("@"))&&(r.has_var=!0),{type:state_unit_hide,value:"!uh",unit:i,input_unit:a}}if(e.startsWith("!u:")){var o=e.slice(3).split(":"),s=resolve_unit_value(o[0],r.fill_data),_=o[1]?resolve_unit_value(o[1],r.fill_data):null;return(o[0].startsWith("@")||o[1]&&o[1].startsWith("@"))&&(r.has_var=!0),{type:state_unit_default,value:"!u",unit:s,input_unit:_}}if(e.startsWith("!ua:")||e.startsWith("!ub:")||e.startsWith("!um:")){var u=e[2],c=e.slice(4).split(":"),l=resolve_unit_value(c[0],r.fill_data),f=c[1]?resolve_unit_value(c[1],r.fill_data):null;return(c[0].startsWith("@")||c[1]&&c[1].startsWith("@"))&&(r.has_var=!0),{type:{a:state_unit_after,b:state_unit_before,m:state_unit_middle}[u],value:"!u".concat(u),unit:l,input_unit:f}}if("!ua"===e||"!ub"===e||"!um"===e){var d=e[2];return"b"===d?null:{type:{a:state_unit_after,m:state_unit_middle}[d],value:"!u".concat(d),unit:null,input_unit:null,use_default:!0}}if("!e"===e)return{type:state_scientific,value:e};if("!c"===e||e.startsWith("!c:")){var p=e.startsWith("!c:")?e.slice(3):null;return{type:state_compact,value:"!c",preset:p}}if(e.startsWith("!i:")){var g=e.slice(3);if(g.startsWith("@")){var m=g.slice(1),v=get_real_value(r.fill_data,m);return r.has_var=!0,{type:state_integer_padding,value:m,real_value:v}}return{type:state_integer_padding,value:g}}if("!t"===e||e.startsWith("!t:")){if("!t"===e)return{type:state_thousands,value:"!t",preset:"default"};var h=e.slice(3);if(h.startsWith("@")){var w=h.slice(1),b=get_real_value(r.fill_data,w);return r.has_var=!0,{type:state_thousands,value:"!t",preset:b,preset_var:w}}return{type:state_thousands,value:"!t",preset:h}}if(e.startsWith("!g:")){var y=e.slice(3);if(y.startsWith("@")){var x=y.slice(1),S=get_real_value(r.fill_data,x);return r.has_var=!0,{type:state_fmt_group,value:"!g",group_name:S,var_path:x}}return{type:state_fmt_group,value:"!g",group_name:y}}if(e.startsWith("#")){var E=e.slice(1);if(E.startsWith("@")){var A=E.slice(1),T=get_real_value(r.fill_data,A);return r.has_var=!0,"number"==typeof T||/^\d+$/.test(String(T))?{type:state_integer_padding,value:A,real_value:T}:{type:state_fmt_group,value:"#",group_name:T,var_path:A}}E.startsWith("=")&&(E=E.slice(1));var D=/^\d+$/.test(E),N=var_first_char.includes(E[0]);return D||N?N?(r.has_var=!0,{type:state_integer_padding,value:E,real_value:get_real_value(r.fill_data,E)}):{type:state_integer_padding,value:E}:{type:state_fmt_group,value:"#",group_name:E}}if(e.startsWith("[")&&e.endsWith("]")){var k=e.slice(1,-1).split(","),O=null,P=null;if(k[0]){var M=k[0].trim();if(M.startsWith("@")){var I=M.slice(1);O=get_real_value(r.fill_data,I),r.has_var=!0}else O=M}if(k[1]){var W=k[1].trim();if(W.startsWith("@")){var L=W.slice(1);P=get_real_value(r.fill_data,L),r.has_var=!0}else P=W}return{type:state_range_clamp,min:O,max:P}}throw new Error("无法识别的格式化字符: ".concat(e))}function push_token$1(e,t,r){var n=create_token_from_string(t,{scope:r});n&&e.push(n)}function fmt_tokenizer_space(e,t){for(var r,n=0,i=e.length,a={fill_data:t,has_var:!1},o=0,s=[];n<i;)" "===(r=e[n])?(n>o&&push_token$1(s,e.slice(o,n),a),o=n+1):"<>=".includes(r)&&("="===e[n+1]?(s.push({type:state_symbol,value:r+"="}),o=1+ ++n):(s.push({type:state_symbol,value:r}),o=n+1)),n++;return o<n&&push_token$1(s,e.slice(o,n),a),s.has_var=a.has_var,s}var _default_config={_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"},_global_config=_objectSpread2({},_default_config),VALID_COMPUTE_MODES=new Set(["decimal","bigint","wasm"]),config_listeners={};function on_config_change(e,t){config_listeners[e]||(config_listeners[e]=[]),config_listeners[e].push(t)}function convert_unit_in_to_out(e){if(!e)return null;var t={};for(var r in e){var n=e[r];for(var i in n)t[i]||(t[i]={}),t[i][r]=n[i]}return t}function validate_shortcut_prefix(e){if("string"!=typeof e)return console.warn("_shortcut_prefix must be a string, got: ".concat(_typeof(e))),null;if(!e.startsWith("!"))return console.warn("_shortcut_prefix must start with '!', got: ".concat(e)),null;var t=e;e.endsWith(":")&&(t=e.slice(0,-1));var r=["!u","!t","!c","!n","!e","!i","!g","!ua","!ub","!um","!uh"];return r.includes(t)?t:(console.warn("_shortcut_prefix must be one of: ".concat(r.join(", "),", got: ").concat(e)),null)}function set_config(e){if(e&&"object"===_typeof(e))for(var t=function(){var t=n[r],i=e[t];if("_unit_convert_in"===t&&"object"===_typeof(i)&&null!==i){var a=convert_unit_in_to_out(i);if(_global_config._unit_convert_out)for(var o in a)_global_config._unit_convert_out[o]?_global_config._unit_convert_out[o]=_objectSpread2(_objectSpread2({},_global_config._unit_convert_out[o]),a[o]):_global_config._unit_convert_out[o]=a[o];else _global_config._unit_convert_out=a;return _global_config._unit_convert_in=void 0,0}if("_builtin_functions"===t&&"object"===_typeof(i))Object.assign(_global_config._builtin_functions,i);else if("_compact"===t&&"object"===_typeof(i))Object.assign(_global_config._compact,i);else if("_thousands"===t&&"object"===_typeof(i))Object.assign(_global_config._thousands,i);else if("_fmt_groups"===t&&"object"===_typeof(i)){Object.assign(_global_config._fmt_groups,i);var s=_global_config._fmt_groups;config_listeners._fmt_groups&&config_listeners._fmt_groups.forEach(function(e){return e(_global_config._fmt_groups,s)})}else if("_fmt"===t){var _=_global_config._fmt,u=i;_!==u&&(_global_config._fmt=u,config_listeners._fmt&&config_listeners._fmt.forEach(function(e){return e(u,_)}))}else if("_compute_mode"===t){var c=i;if(!VALID_COMPUTE_MODES.has(c))return console.warn("Unknown compute mode: ".concat(c,", available modes: ").concat(_toConsumableArray(VALID_COMPUTE_MODES).join(", "))),0;var l=_global_config[t];l!==c&&(_global_config[t]=c,config_listeners[t]&&config_listeners[t].forEach(function(e){return e(c,l)}))}else if("_shortcut_prefix"===t){var f=validate_shortcut_prefix(i);if(!f)return 0;var d=_global_config[t],p=f;d!==p&&(_global_config[t]=p,config_listeners[t]&&config_listeners[t].forEach(function(e){return e(p,d)}))}else if(t in _global_config){var g=_global_config[t],m=i;g!==m&&(_global_config[t]=m,config_listeners[t]&&config_listeners[t].forEach(function(e){return e(m,g)}))}},r=0,n=Object.keys(e);r<n.length;r++)t()}function get_config(e){return void 0===e?_objectSpread2({},_global_config):_global_config[e]}function reset_config(e){if(void 0===e)for(var t=Object.keys(_global_config),r=function(){var e=i[n],t=_global_config[e],r=_default_config[e];"object"===_typeof(r)&&null!==r?_global_config[e]=Array.isArray(r)?_toConsumableArray(r):_objectSpread2({},r):_global_config[e]=r,t!==_global_config[e]&&config_listeners[e]&&config_listeners[e].forEach(function(r){return r(_global_config[e],t)})},n=0,i=t;n<i.length;n++)r();else{var a,o=_createForOfIteratorHelper(Array.isArray(e)?e:[e]);try{var s=function(){var e=a.value;if(e in _default_config){var t=_global_config[e],r=_default_config[e];"object"===_typeof(r)&&null!==r?_global_config[e]=Array.isArray(r)?_toConsumableArray(r):_objectSpread2({},r):_global_config[e]=r,t!==_global_config[e]&&config_listeners[e]&&config_listeners[e].forEach(function(r){return r(_global_config[e],t)})}};for(o.s();!(a=o.n()).done;)s()}catch(e){o.e(e)}finally{o.f()}}}function close_important_push(){}function open_important_push(){}if(on_config_change("_fmt",function(e,t){if(null!=e&&""!==e){if("string"!=typeof e)return console.warn("_fmt must be a string, got: ".concat(_typeof(e))),void(_global_config._fmt_parsed=void 0);try{var r=fmt_tokenizer(e,null);_global_config._fmt_parsed=r}catch(t){console.warn('Failed to parse _fmt: "'.concat(e,'":'),t),_global_config._fmt_parsed=void 0}}else _global_config._fmt_parsed=void 0}),_global_config._fmt)try{var tokens_standard=fmt_tokenizer(_global_config._fmt,null);_global_config._fmt_parsed=tokens_standard}catch(e){console.warn('Failed to parse initial _fmt: "'.concat(_global_config._fmt,'":'),e),_global_config._fmt_parsed=void 0}var fmt_group_parsed_cache=new Map;function parse_all_fmt_groups(){fmt_group_parsed_cache.clear();var e=get_config("_fmt_groups")||{};for(var t in e){var r=e[t];if("string"==typeof r)try{var n=fmt_tokenizer(r,null);fmt_group_parsed_cache.set(t,n)}catch(e){console.warn('Failed to parse format group "'.concat(t,'":'),e)}}}function merge_tokens(e){if(!e||0===e.length)return[];var t={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"]},r={};for(var n in t){var i,a=_createForOfIteratorHelper(t[n]);try{for(a.s();!(i=a.n()).done;){r[i.value]=n}}catch(e){a.e(e)}finally{a.f()}}for(var o=new Map,s=[],_=0;_<e.length;_++){var u=e[_],c=u.type;if("symbol"!==c)if(s.length>0&&("number"===c||"var"===c))o.set("mantissa",[].concat(_toConsumableArray(s),[u])),s=[];else{if(s.length>0){var l,f=_createForOfIteratorHelper(s);try{for(f.s();!(l=f.n()).done;){var d=l.value,p="symbol_".concat(o.size);o.set(p,d)}}catch(e){f.e(e)}finally{f.f()}s=[]}var g=r[c];if(g)o.set(g,u);else{var m="".concat(c,"_").concat(o.size);o.set(m,u)}}else s.push(u)}if(s.length>0){var v,h=_createForOfIteratorHelper(s);try{for(h.s();!(v=h.n()).done;){var w=v.value,b="symbol_".concat(o.size);o.set(b,w)}}catch(e){h.e(e)}finally{h.f()}}var y,x=[],S=_createForOfIteratorHelper(o.values());try{for(S.s();!(y=S.n()).done;){var E=y.value;Array.isArray(E)?x.push.apply(x,_toConsumableArray(E)):x.push(E)}}catch(e){S.e(e)}finally{S.f()}return x}function expand_fmt_groups(e,t){if(!e||0===e.length)return e;if(!e.some(function(e){return e.type===state_fmt_group}))return e;for(var r=[],n=e.has_var||!1,i=0;i<e.length;i++){var a=e[i];if(a.type===state_fmt_group){var o=a.group_name;if(o){var s=fmt_group_parsed_cache.get(o);s?(r.push.apply(r,_toConsumableArray(s)),s.has_var&&(n=!0)):"undefined"!=typeof console&&console.warn&&console.warn('Format group "'.concat(o,'" not found, ignoring.'))}}else r.push(a)}var _=merge_tokens(r);return n&&(_.has_var=!0),_}on_config_change("_fmt_groups",function(){parse_all_fmt_groups()}),parse_all_fmt_groups();var DEFAULT_COMPACT_UNITS=["","K","M","B","T"],DEFAULT_THOUSANDS_CONFIG={sep:",",point:".",grouping:[3],min_len:0,point_group:!1,fn:null},THOUSANDS_PRESETS={default:{sep:",",point:".",grouping:[3],min_len:0,point_group:!1,fn:null},us:{sep:",",point:".",grouping:[3]},eu:{sep:".",point:",",grouping:[3]},swiss:{sep:"'",point:".",grouping:[3]},space:{sep:" ",point:".",grouping:[3]},indian:{sep:",",point:".",grouping:[3,2]},cn4:{sep:",",point:".",grouping:[4]}};function get_thousands_preset(e){if(!e)return null;var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})._thousands||{};if(t[e])return _objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),t[e]);var r=get_config("_thousands")||{};return r[e]?_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),r[e]):THOUSANDS_PRESETS[e]?_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),THOUSANDS_PRESETS[e]):null}function extract_unit_thousands(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._thousands&&!t[r]&&(t[r]=n._thousands),n)if(!i.startsWith("_")){var a=n[i];"object"===_typeof(a)&&a._thousands&&!t[i]&&(t[i]=a._thousands)}}return t}function get_unit_thousands_map(e){var t=extract_unit_thousands(get_unit_mapping(e));return e._unit_thousands_map?_objectSpread2(_objectSpread2({},t),e._unit_thousands_map):t}function extract_unit_compacts(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._compact&&!t[r]&&(t[r]=n._compact),n)if(!i.startsWith("_")){var a=n[i];"object"===_typeof(a)&&a._compact&&!t[r]&&(t[r]=a._compact)}}return t}function get_unit_compact_map(){var e=extract_unit_compacts(get_config("_unit_convert_out")),t=get_config("_unit_compact_map");return t?_objectSpread2(_objectSpread2({},e),t):e}function format_thousands(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=_objectSpread2(_objectSpread2({},DEFAULT_THOUSANDS_CONFIG),t);if(r.fn&&"function"==typeof r.fn){var n=e.startsWith("-"),i=e.startsWith("+"),a="",o=e;(n||i)&&(a=e[0],o=e.slice(1));var s=o.split("."),_={int_part:s[0],dec_part:s[1]||null,sign:a,options:r._options||{}};return r.fn(e,_)}var u=e.replace(/^[+-]/,"").split(".")[0].length;if(r.min_len>0&&u<r.min_len)return"."!==r.point?e.replace(".",r.point):e;var c=e.startsWith("-"),l=e.startsWith("+"),f="",d=e;(c||l)&&(f=e[0],d=e.slice(1));var p=d.split("."),g=p[0],m=p[1];g=apply_grouping(g,r.grouping,r.sep),m&&r.point_group&&(m=apply_grouping_decimal(m,r.grouping,r.sep));var v=f+g;return void 0!==m?v+=r.point+m:r.point,v}function apply_grouping(e,t,r){if(!e||0===e.length)return e;for(var n=[],i=e,a=0;i.length>0;){var o=t[Math.min(a,t.length-1)];if(i.length<=o){n.unshift(i);break}n.unshift(i.slice(-o)),i=i.slice(0,-o),a++}return n.join(r)}function apply_grouping_decimal(e,t,r){if(!e||0===e.length)return e;for(var n=[],i=e,a=0;i.length>0;){var o=t[Math.min(a,t.length-1)];if(i.length<=o){n.push(i);break}n.push(i.slice(0,o)),i=i.slice(o),a++}return n.join(r)}var BUILTIN_PRESETS={default:{units:["","K","M","B","T"],step:1e3},cn:{units:["","千","百万","十亿","万亿"],step:1e3},wan:{units:["","万","亿","万亿"],step:1e4},storage:{units:["B","KB","MB","GB","TB"],step:1024},indian:{units:["","K","L","Cr"],step:[1e3,100,100]}};function get_unit_mapping(e){return e._unit_convert_out&&Object.keys(e._unit_convert_out).length>0?e._unit_convert_out:null}function extract_unit_positions(e){if(!e)return{};var t={};for(var r in e){var n=e[r];if("object"===_typeof(n))for(var i in n._position&&!t[r]&&(t[r]=n._position),n)if("_position"!==i){var a=n[i];"object"===_typeof(a)&&a._position&&!t[i]&&(t[i]=a._position)}}return t}function get_unit_position_map(e){var t=extract_unit_positions(get_unit_mapping(e));return e._unit_position_map?_objectSpread2(_objectSpread2({},t),e._unit_position_map):t}function find_conversion_rule(e,t,r,n){if(!r||!e)return null;var i=r[e];if(!i)return null;if(t){var a=i[t];return void 0!==a?{rule:a,input_unit:t}:null}if(n){var o,s=_createForOfIteratorHelper(Array.isArray(n)?n:[n]);try{for(s.s();!(o=s.n()).done;){var _=o.value;if(void 0!==i[_])return{rule:i[_],input_unit:_}}}catch(e){s.e(e)}finally{s.f()}}var u=Object.keys(i).filter(function(e){return!e.startsWith("_")});return 1===u.length?{rule:i[u[0]],input_unit:u[0]}:null}function apply_conversion_rule(e,t,r,n){if(null==t)return e;var i=new Decimal(e);return"number"==typeof t?i.times(t).toFixed():"function"==typeof t?String(t(Number(e),r,n)):"object"===_typeof(t)?t.fn&&"function"==typeof t.fn?String(t.fn(Number(e),r,n)):(void 0!==t.mul?i=i.times(t.mul):void 0!==t.div?i=i.div(t.div):void 0!==t.add?i=i.plus(t.add):void 0!==t.sub&&(i=i.minus(t.sub)),i.toFixed()):e}function get_unit_info_from_tokens(e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!e)return null;var n,i=_createForOfIteratorHelper(e);try{for(i.s();!(n=i.n()).done;){var a=n.value;if("unit_after"===a.type||"unit_before"===a.type||"unit_middle"===a.type){var o=a.unit;if(a.use_default&&!o&&!(o=r)){var s=get_config("_unit_default_out");o=Array.isArray(s)?s[0]:s}return{output_unit:o,input_unit:a.input_unit,position:"unit_after"===a.type?"after":"unit_before"===a.type?"before":"middle",show_unit:!0,keep_recognized:a.use_default}}if("unit_hide"===a.type)return{output_unit:a.unit,input_unit:a.input_unit,position:null,show_unit:!1};if("unit_default"===a.type){var _=t[a.unit]||get_config("_unit_default_position")||"after";return{output_unit:a.unit,input_unit:a.input_unit,position:_,show_unit:!0}}if("to-number-string"===a.type)return a.output_unit?{output_unit:a.output_unit,input_unit:a.input_unit,position:null,show_unit:!1}:{output_unit:null,input_unit:null,position:null,show_unit:!1,no_conversion:!0}}}catch(e){i.e(e)}finally{i.f()}return null}function apply_unit(e,t,r,n){if(!t)return e;var i=e.startsWith("-"),a=e.startsWith("+"),o="",s=e;switch((i||a)&&(o=e[0],s=e.slice(1)),r){case"after":default:return o+s+t;case"before":return t+o+s;case"middle":return o?o+t+s:t+s}}function format_compact(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r._compact_preset,i=r._current_unit,a=DEFAULT_COMPACT_UNITS,o=1e3,s=null;if(r._compact_units||r._compact_step)a=r._compact_units&&r._compact_units.length>0?r._compact_units:DEFAULT_COMPACT_UNITS,o=r._compact_step||1e3;else if(n){var _=(get_config("_compact")||{})[n]||BUILTIN_PRESETS[n];_&&("function"==typeof _?s=_:Array.isArray(_)?(a=_,o=1e3):(a=_.units||a,o=void 0!==_.step?_.step:o))}else if(i){var u=get_unit_compact_map(),c=!1;if(u&&u[i]){var l=u[i],f=(get_config("_compact")||{})[l]||BUILTIN_PRESETS[l];f&&(c=!0,"function"==typeof f?s=f:Array.isArray(f)?(a=f,o=1e3):(a=f.units||a,o=void 0!==f.step?f.step:o))}if(!c){var d=get_config("_compact_default");if(d){var p=(get_config("_compact")||{})[d]||BUILTIN_PRESETS[d];p&&("function"==typeof p?s=p:Array.isArray(p)?(a=p,o=1e3):(a=p.units||a,o=void 0!==p.step?p.step:o))}}}else{var g=get_config("_compact_default");if(g){var m=(get_config("_compact")||{})[g]||BUILTIN_PRESETS[g];m&&("function"==typeof m?s=m:Array.isArray(m)?(a=m,o=1e3):(a=m.units||a,o=void 0!==m.step?m.step:o))}}if(s){var v=s(e,{decimals:t,options:r,current_unit:i});return"object"===_typeof(v)&&null!==v?{sign:v.sign||"",number:v.number||"0",unit:v.unit||"",formatted:v.formatted||(v.sign||"")+(v.number||"0")+(v.unit||"")}:"string"==typeof v?{sign:"",number:v,unit:"",formatted:v}:{sign:"",number:e,unit:"",formatted:e}}var h=e.startsWith("-"),w=e.startsWith("+"),b="",y=e;(h||w)&&(b=e[0],y=e.slice(1));for(var x=new Decimal(y),S=0,E=Array.isArray(o);S<a.length-1;){var A=E?o[S]||o[o.length-1]:o;if(!x.gte(A))break;x=x.div(A),S++}var T=x.toFixed(t,Decimal.ROUND_DOWN);return T.includes(".")&&(T=T.replace(/\.?0+$/,"")),{sign:b,number:T,unit:a[S],formatted:b+T+a[S]}}function pad_integer(e,t){if(t<=0)return e;var r=e.startsWith("-"),n=e.startsWith("+"),i="",a=e;(r||n)&&(i=e[0],a=e.slice(1));var o=a.split("."),s=o[0],_=o[1];s.length<t&&(s="0".repeat(t-s.length)+s);var u=i+s;return void 0!==_&&(u+="."+_),u}function format(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=expand_fmt_groups(t,r._fill_data||r);var n="";if("undefined"===(n=Decimal.isDecimal(e)?e.toFixed():"string"==typeof e?e:e.toString())||"NaN"===n)return[void 0,{}];var i=get_unit_mapping(r),a=get_unit_position_map(r),o=r._recognized_unit||null,s=get_unit_info_from_tokens(t,r,a,o),_=null,u=null,c=!1,l=!1;if(s){var f=s.output_unit,d=s.input_unit,p=s.position,g=s.show_unit,m=s.no_conversion,v=s.keep_recognized;if(!m&&i){var h=v&&o?o:f||o||get_config("_unit_default_out");if(h){var w=find_conversion_rule(h,d||o||null,i,get_config("_unit_default_in"));w&&(n=apply_conversion_rule(n,w.rule,w.input_unit,h),_=h,l=!0)}}g?(v&&o?_=o:_||(_=f||o),u=p,c=!0,l=!0):m&&(l=!0)}else o&&(_=o,u=a[o]||get_config("_unit_default_position")||"after",c=!0,l=!0);var b={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},y=[],x=[];t.forEach(function(e,t){"symbol"===e.type?y.push({value:e.value,index:t}):"number"!==e.type&&"var"!==e.type||x.push({value:"var"===e.type?e.real_value:e.value,index:t})});var S=y.find(function(e){return">="===e.value||">"===e.value}),E=y.find(function(e){return"<="===e.value||"<"===e.value});if(S&&E)for(var A=function(){var e=y[T],t=x.find(function(t){return t.index>e.index});t&&(">="===e.value||">"===e.value?b.mantissa_min=+t.value:"<="!==e.value&&"<"!==e.value||(b.mantissa_max=+t.value))},T=0;T<y.length;T++)A();if(t.forEach(function(e){var t=e.type;if("symbol"===t){if(![">=","<=","=","<",">"].includes(e.value))throw new Error("错误的格式化参数:",e.value);S&&E||(b.mantissa_type=e.value)}else if("to-number"===t)b.to_number=!0;else if("to-number-string"===t)b.to_number_string=!0;else if("comma"===t)b.thousands=!0;else if("number"===t)S&&E||(b.mantissa=e.value);else if("var"===t)S&&E||(b.mantissa=e.real_value);else if("plus"===t)b.sign=!0;else if("round"===t)b.round=e.value;else if("fraction"===t)b.fraction=!0;else if("scientific"===t)b.scientific=!0;else if("percent"===t)b.percent=!0;else if("integer_padding"===t)b.integer_padding=void 0!==e.real_value?+e.real_value:+e.value;else if("compact"===t)b.compact=!0,e.preset&&(b.compact_preset=e.preset);else if("unit_after"===t)b.unit_format="after",b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_before"===t)b.unit_format="before",b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_middle"===t)b.unit_format="middle",b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_hide"===t)b.unit_format=null,b.unit_value=e.unit,b.unit_input=e.input_unit;else if("unit_default"===t){var r=get_config("_unit_default_position")||"after";b.unit_format=r,b.unit_value=e.unit,b.unit_input=e.input_unit}else if("thousands"===t)b.thousands=!0,b.thousands_preset=e.preset;else{if("range_clamp"!==t)throw new Error("错误的fmt Token");b.range_clamp_min=e.min,b.range_clamp_max=e.max}}),null!==b.range_clamp_min||null!==b.range_clamp_max){var D=new Decimal(n);if(null!==b.range_clamp_min){var N=new Decimal(b.range_clamp_min);D.lt(N)&&(D=N)}if(null!==b.range_clamp_max){var k=new Decimal(b.range_clamp_max);D.gt(k)&&(D=k)}n=D.toFixed()}if(b.to_number){var O=parse_mantissa(n,b.mantissa_type,b.mantissa,b.round);return b.integer_padding&&(O=pad_integer(O,b.integer_padding)),[+O,b]}if(b.scientific){var P=new Decimal(n).toExponential();return[b.sign&&!P.startsWith("-")?"+"+P:P,b]}if(b.fraction){var M=new Decimal(n).toFraction(),I=M[0].toString()+"/"+M[1].toString();return[b.sign&&!I.startsWith("-")?"+"+I:I,b]}if(b.compact){var W=format_compact(n,null!==b.mantissa?+b.mantissa:2,_objectSpread2(_objectSpread2({},r),{},{_compact_preset:b.compact_preset,_current_unit:_})),L=W.sign,C=W.unit;n=W.number,b._compact_formatted=!0,b._compact_sign=L,b._compact_unit_suffix=C}if(b.percent&&(n=new Decimal(n).times(100).toFixed()),null!==b.mantissa_min&&null!==b.mantissa_max){var j=n.includes(".")?n.split(".")[1].length:0;j<b.mantissa_min?n=parse_mantissa(n,">=",b.mantissa_min,b.round):j>b.mantissa_max?n=parse_mantissa(n,"<=",b.mantissa_max,b.round):n.includes(".")&&(n=n.replace(/0*$/,"").replace(/\.$/,""))}else null===b.mantissa?n.includes(".")&&(n=n.replace(/0*$/,"")):n=parse_mantissa(n,b.mantissa_type,b.mantissa,b.round);if(b.integer_padding&&(n=pad_integer(n,b.integer_padding)),b.thousands){var F=null;if(b.thousands_preset)F=get_thousands_preset(b.thousands_preset,r);else if(_){var q=get_unit_thousands_map(r)[_];q&&(F=get_thousands_preset(q,r))}if(!F){var V=get_config("_thousands_default");V&&(F=get_thousands_preset(V,r))}F?(F._options=r,n=format_thousands(n,F)):n=parse_thousands(n)}return b._compact_formatted&&(b.sign&&!b._compact_sign&&(n="+"+n),n=b._compact_sign+n+b._compact_unit_suffix),b.sign&&!b._compact_formatted&&(b.to_number=!1,n.startsWith("-")||(n="+"+n)),b.percent&&(n+="%"),c&&_&&u&&(n=apply_unit(n,_,u,b.sign)),b.unit_handled=l,[n,b]}var _calc$1=null;function register_calc(e){_calc$1=e}function get_calc$1(){if(!_calc$1)throw new Error("calc function not registered");return _calc$1}function calc_wrap(e,t){var r=get_calc$1(),n={_error:"-"};return["string","number"].includes(_typeof(e))?void 0===t?/[a-zA-Z$_]/.test(e.toString())?function(t){return Array.isArray(t)?t.unshift(n):t=_objectSpread2(_objectSpread2({},n),t),r(e,t)}:r(e):(Array.isArray(t)?t.unshift(n):t=_objectSpread2(_objectSpread2({},n),t),r(e,t)):(Array.isArray(e)?e.unshift(n):e=_objectSpread2(_objectSpread2({},n),e),function(t){return r(t,e)})}function check_version(){return _check_version.apply(this,arguments)}function _check_version(){return _check_version=_asyncToGenerator(_regenerator().m(function _callee(){var res,code,versions,last_version,larr,varr,script,url;return _regenerator().w(function(_context){for(;;)switch(_context.n){case 0:if("undefined"==typeof process||"node"!==process.release.name){_context.n=4;break}if(!(parseInt(process.versions.node)>=17)){_context.n=3;break}return _context.n=1,promise_queue([fetch("https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js"),fetch("https://unpkg.com/a-calc@latest/a-calc.versions.js")]);case 1:return res=_context.v,_context.n=2,res.text();case 2:code=_context.v,versions=eval(code),last_version=versions.at(-1),larr=last_version.match(/(\d+)\.(\d+)\.(\d+)/),larr.shift(),larr=larr.map(function(e){return parseInt(e)}),varr=version.match(/(\d+)\.(\d+)\.(\d+)/),varr.shift(),varr=varr.map(function(e){return parseInt(e)}),(larr[0]>varr[0]||larr[0]===varr[0]&&larr[1]>varr[1]||larr[0]===varr[0]&&larr[1]===varr[1]&&larr[2]>varr[2])&&console.warn("a-calc has a new version:",last_version);case 3:_context.n=6;break;case 4:return script=document.createElement("script"),script.onload=function(){var e=a_calc_versions;if(Array.isArray(e)){var t=e.at(-1),r=t.match(/(\d+)\.(\d+)\.(\d+)/);r.shift(),r=r.map(function(e){return parseInt(e)});var n=version.match(/(\d+)\.(\d+)\.(\d+)/);n.shift(),n=n.map(function(e){return parseInt(e)}),(r[0]>n[0]||r[0]===n[0]&&r[1]>n[1]||r[0]===n[0]&&r[1]===n[1]&&r[2]>n[2])&&console.log("%c↑↑↑ a-calc has a new version: %s ↑↑↑","color: #67C23A;",t)}},_context.n=5,test_urls(["https://cdn.jsdelivr.net/npm/a-calc@latest/a-calc.versions.js","https://unpkg.com/a-calc@latest/a-calc.versions.js"]);case 5:url=_context.v,url?(script.src=url,document.body.appendChild(script)):script=null;case 6:return _context.a(2)}},_callee)})),_check_version.apply(this,arguments)}var operator=new Set(["+","-","*","/","%","**","//"]);function detect_fallback_var(e,t){if("("!==e[t])return null;for(var r=0,n=!1,i=[],a="",o=t;o<e.length;){var s=e[o];if("("===s){if(0===r){r++,o++;continue}r++,a+=s}else if(")"===s){if(0===--r)return n?(i.push(a.trim()),{paths:i,end_index:o}):null;a+=s}else"|"===s&&1===r?(n=!0,i.push(a.trim()),a=""):a+=s;o++}return null}function push_token(e,t,r){if(Number.isNaN(Number(t)))if("-"===t||"+"===t)e.push({type:"operator",value:t});else if(operator.has(t))e.push({type:"operator",value:t});else if(r._unit&&/^[+-]?\d/.test(t)){var n,i=split_unit_num(t),a=i.num,o=i.unit;if(void 0===o)e.push({type:"number",value:a,real_value:a,has_unit:!1});else r.has_unit=!0,null!==(n=r.unit_str)&&void 0!==n||(r.unit_str=o),e.push({type:"number",value:a,real_value:a,has_unit:!0,unit:o})}else if(var_first_char_set.has(t[0])){r.has_var=!0;var s=get_real_value(r.fill_data,t);if(r._unit){var _,u=split_unit_num(s),c=u.num,l=u.unit;if(void 0===l)e.push({type:"var",value:t,real_value:c,has_unit:!1});else r.has_unit=!0,null!==(_=r.unit_str)&&void 0!==_||(r.unit_str=l),e.push({type:"var",value:t,real_value:c,has_unit:!0,unit:l})}else e.push({type:"var",value:t,real_value:s,has_unit:!1})}else{if(!/^[+-]?\d/.test(t))throw new Error("无法识别的标识符:".concat(t));var f=t.indexOf("e");-1!==f&&/^\d+$/.test(t.slice(f+1))&&e.push({type:"number",value:t,real_value:t,has_unit:!1})}else e.push({type:"number",value:t,real_value:t,has_unit:!1})}function tokenizer_space(e,t,r,n){for(var i,a=0,o=0,s=e.length,_=[],u={has_var:!1,has_unit:!1,unit_str:void 0,_unit:r,fill_data:t};o<s;){if(" "===(i=e[o]))o>a&&push_token(_,e.slice(a,o),u),a=o+1;else if("("===i){var c=detect_fallback_var(e,o);if(c){o>a&&push_token(_,e.slice(a,o),u),u.has_var=!0;var l=get_fallback_value(t,c.paths,n),f=l.value,d=l.path;if(r){var p,g=split_unit_num(f),m=g.num,v=g.unit;if(void 0!==v)u.has_unit=!0,null!==(p=u.unit_str)&&void 0!==p||(u.unit_str=v),_.push({type:state_fallback_var,value:c.paths,real_value:m,matched_path:d,has_unit:!0,unit:v});else _.push({type:state_fallback_var,value:c.paths,real_value:m,matched_path:d,has_unit:!1})}else _.push({type:state_fallback_var,value:c.paths,real_value:f,matched_path:d,has_unit:!1});a=o=c.end_index+1;continue}_.push({type:state_bracket,value:"("}),a=o+1}else")"===i&&(o>a&&push_token(_,e.slice(a,o),u),_.push({type:state_bracket,value:")"}),a=o+1);o++}return o>a&&push_token(_,e.slice(a,o),u),_.has_var=u.has_var,_.has_unit=u.has_unit,_.unit=u.unit_str,_}function to_decimal(e){return e instanceof Decimal?e:new Decimal("boolean"==typeof e?e?1:0:e)}function is_decimal(e){return e instanceof Decimal}function compute(e,t,r){if(void 0===e||void 0===t)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(t));var n=to_decimal(e),i=to_decimal(t);switch(r){case"+":return n.plus(i);case"-":return n.minus(i);case"*":return n.times(i);case"/":return n.div(i);case"%":return n.mod(i);case"**":return n.pow(i);case"//":return n.divToInt(i);default:throw new Error("未知的运算符: ".concat(r))}}function compare(e,t,r){if(void 0===e||void 0===t)throw new Error("无效的操作数对:v1:".concat(e,", v2:").concat(t));var n=to_decimal(e),i=to_decimal(t);switch(r){case">":return n.gt(i);case"<":return n.lt(i);case">=":return n.gte(i);case"<=":return n.lte(i);case"==":return n.eq(i);case"!=":return!n.eq(i);default:throw new Error("未知的比较运算符: ".concat(r))}}function logical(e,t,r){var n=function(e){return"boolean"==typeof e?e:e instanceof Decimal?!e.isZero():"number"==typeof e?0!==e:"string"==typeof e?""!==e&&"0"!==e:Boolean(e)},i=n(e);switch(r){case"&&":return!!i&&n(t);case"||":return!!i||n(t);default:throw new Error("未知的逻辑运算符: ".concat(r))}}function logical_not(e){var t;return!("boolean"==typeof(t=e)?t:t instanceof Decimal?!t.isZero():"number"==typeof t?0!==t:"string"==typeof t?""!==t&&"0"!==t:Boolean(t))}function _to_rad(e){return"rad"===get_config("_angle_unit")?e:new Decimal(e).times(Decimal.acos(-1)).div(180)}function _to_deg(e){return"rad"===get_config("_angle_unit")?e:new Decimal(e).times(180).div(Decimal.acos(-1))}var _SIN_TABLE={0:new Decimal(0),30:new Decimal("0.5"),45:new Decimal(2).sqrt().div(2),60:new Decimal(3).sqrt().div(2),90:new Decimal(1),180:new Decimal(0),270:new Decimal(-1),360:new Decimal(0)},_COS_TABLE={0:new Decimal(1),30:new Decimal(3).sqrt().div(2),45:new Decimal(2).sqrt().div(2),60:new Decimal("0.5"),90:new Decimal(0),180:new Decimal(-1),270:new Decimal(0),360:new Decimal(1)},_TAN_TABLE={0:new Decimal(0),30:new Decimal(3).sqrt().div(3),45:new Decimal(1),60:new Decimal(3).sqrt(),180:new Decimal(0),360:new Decimal(0)};function _normalize_angle(e){var t=new Decimal(e).mod(360);return t.isNegative()?t.plus(360):t}var _builtin_functions={sin:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(void 0!==_SIN_TABLE[t])return _SIN_TABLE[t];if(t>180){var r=_SIN_TABLE[360-t];if(void 0!==r)return r.negated()}if(t>90&&t<=180){var n=_SIN_TABLE[180-t];if(void 0!==n)return n}}var i=_to_rad(e);return Decimal.sin(i)},cos:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(void 0!==_COS_TABLE[t])return _COS_TABLE[t];if(t>180){var r=_COS_TABLE[360-t];if(void 0!==r)return r}if(t>90&&t<=180){var n=_COS_TABLE[180-t];if(void 0!==n)return n.negated()}}var i=_to_rad(e);return Decimal.cos(i)},tan:function(e){if("deg"===get_config("_angle_unit")){var t=_normalize_angle(e).toNumber();if(90===t||270===t)throw new Error("tan() undefined at 90° and 270°");if(void 0!==_TAN_TABLE[t])return _TAN_TABLE[t]}var r=_to_rad(e);return Decimal.tan(r)},asin:function(e){return _to_deg(Decimal.asin(e))},acos:function(e){return _to_deg(Decimal.acos(e))},atan:function(e){return _to_deg(Decimal.atan(e))},atan2:function(e,t){return _to_deg(Decimal.atan2(e,t))},sinh:function(e){return Decimal.sinh(e)},cosh:function(e){return Decimal.cosh(e)},tanh:function(e){return Decimal.tanh(e)},asinh:function(e){return Decimal.asinh(e)},acosh:function(e){return Decimal.acosh(e)},atanh:function(e){return Decimal.atanh(e)},exp:function(e){return Decimal.exp(e)},log:function(e){return Decimal.ln(e)},ln:function(e){return Decimal.ln(e)},log10:function(e){return Decimal.log10(e)},log2:function(e){return Decimal.log2(e)},sqrt:function(e){return new Decimal(e).sqrt()},cbrt:function(e){return new Decimal(e).cbrt()},pow:function(e,t){return new Decimal(e).pow(t)},floor:function(e){return new Decimal(e).floor()},ceil:function(e){return new Decimal(e).ceil()},round:function(e){return new Decimal(e).round()},trunc:function(e){return new Decimal(e).trunc()},abs:function(e){return new Decimal(e).abs()},sign:function(e){return new Decimal(e).isPositive()?new Decimal(1):new Decimal(e).isNegative()?new Decimal(-1):new Decimal(0)},max:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)throw new Error("max() requires at least one argument");return t.reduce(function(e,t){var r=new Decimal(t);return r.gt(e)?r:e},new Decimal(t[0]))},min:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)throw new Error("min() requires at least one argument");return t.reduce(function(e,t){var r=new Decimal(t);return r.lt(e)?r:e},new Decimal(t[0]))},clamp:function(e,t,r){var n=new Decimal(e),i=new Decimal(t),a=new Decimal(r);return n.lt(i)?i:n.gt(a)?a:n},random:function(){return new Decimal(Math.random())},pi:function(){return Decimal.acos(-1)},e:function(){return Decimal.exp(1)},if:function(e,t,r){var n;return("boolean"==typeof(n=e)?n:n instanceof Decimal?!n.isZero():"number"==typeof n?0!==n:Boolean(n))?t:r}};function get_function(e,t){if(t){var r,n=_createForOfIteratorHelper(Array.isArray(t)?t:[t]);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(i&&"function"==typeof i[e])return i[e]}}catch(e){n.e(e)}finally{n.f()}}var a=get_config("_builtin_functions");return a&&a[e]?a[e]:null}function is_comparison_op(e){return comparison_operators.has(e)}function is_logical_op(e){return logical_operators.has(e)}function is_arithmetic_op(e){return["+","-","*","/","%","**","//"].includes(e)}function get_precedence(e){var t;return null!==(t=operator_precedence[e])&&void 0!==t?t:-1}function execute_op(e,t,r){if(is_comparison_op(r))return compare(e,t,r);if(is_logical_op(r))return logical(e,t,r);if(is_arithmetic_op(r))return compute(e,t,r);throw new Error("未知的运算符: ".concat(r))}function eval_tokens(e){if(1===e.length){var t=e[0];if("number"===t.type||"var"===t.type||"fallback_var"===t.type)return new Decimal(t.real_value);if("boolean"===t.type)return t.value;if("string"===t.type)return t.value;if("function"===t.type){var r=t.value,n=t.fn||get_function(r,e._fill_data);if(!n)throw new Error("未知的函数: ".concat(r));var i=t.args.map(function(t){var r=tokenizer(t,e._fill_data,e._unit,e._options);return r._fill_data=e._fill_data,r._unit=e._unit,r._options=e._options,eval_tokens(r)});return n.apply(void 0,_toConsumableArray(i))}throw new Error("错误的表达式:".concat(t.value))}for(var a,o=[],s=[],_={active:!1,lastValue:null},u=0,c=e.length;u<c;u++)if("number"!==(a=e[u]).type&&"var"!==a.type&&"fallback_var"!==a.type)if("boolean"!==a.type)if("string"!==a.type)if("function"!==a.type)if("logical_not"!==a.type)if("ternary_question"!==a.type&&"?"!==a.value)if("ternary_colon"!==a.type&&":"!==a.value)if("operator"!==a.type&&"comparison"!==a.type&&"logical"!==a.type)if("("!==a.value)if(")"!==a.value)"function_result"!==a.type||s.push(a.value);else for(;o.length>0;){var l=o.pop();if("("===l){if(o.length>0&&("-"===o[o.length-1]||"+"===o[o.length-1])){var f=o[o.length-1],d=o.length>1?o[o.length-2]:null;if(null===d&&1===s.length||"("===d&&1===s.length||["+","-","*","/","%","**","//","?",":"].includes(d))if("-"===f){o.pop();var p=s.pop();is_decimal(p)?s.push(p.negated()):"number"==typeof p?s.push(-p):"boolean"==typeof p?s.push(!p):s.push(new Decimal(p).negated())}else"+"===f&&o.pop()}else{var g=s[s.length-2];if("-"===g){var m=s.pop();s.pop(),is_decimal(m)?s.push(m.negated()):"number"==typeof m?s.push(-m):"boolean"==typeof m?s.push(!m):s.push(new Decimal(m).negated())}else if("+"===g){var v=s.pop();s.pop(),s.push(v)}}break}if("!"===l){var h=s.pop();s.push(logical_not(h))}else if(":"===l&&o.length>0&&"?"===o[o.length-1]){var w=s.pop();o.pop();var b=s.pop(),y=s.pop(),x=void 0;x="boolean"==typeof y?y:is_decimal(y)?!y.isZero():Boolean(y),s.push(x?b:w)}else{if("?"===l){o.push("?");break}var S=s.pop(),E=s.pop();s.push(execute_op(E,S,l))}}else o.push("(");else{var A=a.value,T=get_precedence(A);if(is_comparison_op(A)&&_.active)for(;o.length>0;){var D=o[o.length-1];if("("===D||"?"===D)break;if(get_precedence(D)<T)break;if(is_comparison_op(D)){o.pop();var N=s.pop(),k=compare(s.pop(),N,D);_.lastValue=N,k?s.push(N):(s.push(!1),_.active=!1);break}o.pop();var O=s.pop(),P=s.pop();s.push(execute_op(P,O,D))}is_comparison_op(A)?_.active=!0:_.active=!1;var M=o[o.length-1];if("("===M){o.push(A);continue}if(!o.length){o.push(A);continue}if("**"===A){o.push(A);continue}for(;o.length>0&&"("!==(M=o[o.length-1])&&"?"!==M;){var I=get_precedence(M);if(I<T)break;if(I===T&&"**"===A)break;if("!"!==M&&s.length<2)break;if(o.pop(),"!"===M){var W=s.pop();s.push(logical_not(W))}else{var L=s.pop(),C=s.pop();void 0!==C||"-"!==M&&"+"!==M?s.push(execute_op(C,L,M)):"-"===M?is_decimal(L)?s.push(L.negated()):"number"==typeof L?s.push(-L):s.push(new Decimal(L).negated()):s.push(L)}}o.push(A)}else{for(;o.length>0;){var j=o[o.length-1];if("?"===j)break;if("("===j)break;o.pop();var F=s.pop(),q=s.pop();s.push(execute_op(q,F,j))}o.push(":")}else{for(;o.length>0;){var V=o[o.length-1];if("("===V||"?"===V)break;if(get_precedence(V)<=get_precedence("?"))break;o.pop();var R=s.pop(),B=s.pop();s.push(execute_op(B,R,V))}o.push("?")}else o.push("!");else{var $=a.value,G=a.fn||get_function($,e._fill_data);if(!G)throw new Error("未知的函数: ".concat($));var z=a.args.map(function(t){var r=tokenizer(t,e._fill_data,e._unit,e._options);return r._fill_data=e._fill_data,r._unit=e._unit,r._options=e._options,eval_tokens(r)}),U=G.apply(void 0,_toConsumableArray(z));s.push(U)}else s.push(a.value);else s.push(a.value);else s.push(a.real_value);for(;o.length>0;){var H=o.pop();if("!"===H){var Z=s.pop();s.push(logical_not(Z))}else if(":"===H&&o.length>0&&"?"===o[o.length-1]){var X=s.pop();o.pop();var K=s.pop(),J=s.pop(),Y=void 0;Y="boolean"==typeof J?J:is_decimal(J)?!J.isZero():Boolean(J),s.push(Y?K:X)}else{if("?"===H)continue;var Q=s.pop(),ee=s.pop();void 0!==ee||"-"!==H&&"+"!==H?s.push(execute_op(ee,Q,H)):"-"===H?is_decimal(Q)?s.push(Q.negated()):"number"==typeof Q?s.push(-Q):s.push(new Decimal(Q).negated()):s.push(Q)}}if(1!==s.length)throw new Error("可能出现了错误的计算式");return e.has_var||(e.calc_result=s[0]),s[0]}set_config({_builtin_functions:_builtin_functions});var _calc=null;function register_calc_for_sum(e){_calc=e}function get_calc(){if(!_calc)throw new Error("calc function not registered for calc_sum");return _calc}function internal_format$1(e,t){if(!t)return e;var r=fmt_tokenizer(t,null);return _slicedToArray(format(new Decimal(e),r,{}),1)[0]}function calc_sum(e,t){var r=get_calc(),n={_error:"-"},i=e.split("|"),a=i[0];if(0===t.length)return r(e,n);for(var o=new Decimal(0),s=0;s<t.length;s++){var _=r(a,_objectSpread2(_objectSpread2({},n),t[s]));if(_===n._error)return n._error;o=o.plus(_)}var u=2===i.length?i[1].trim():void 0;return internal_format$1(o.toFixed(),u)}function _d_add(e,t){return new Decimal(e).plus(t).toFixed()}function _d_sub(e,t){return new Decimal(e).minus(t).toFixed()}function _d_mul(e,t){return new Decimal(e).times(t).toFixed()}function _d_div(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return new Decimal(e).div(r).toFixed()}function _d_mod(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return new Decimal(e).mod(r).toFixed()}function _d_pow(e,t){return new Decimal(e).pow(t).toFixed()}function _d_idiv(e,t){var r=new Decimal(t);if(r.isZero()){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return new Decimal(e).divToInt(r).toFixed()}function _d_abs(e){return new Decimal(e).abs().toFixed()}function _d_neg(e){return new Decimal(e).neg().toFixed()}function _d_sqrt(e){return new Decimal(e).sqrt().toFixed()}function _d_cbrt(e){return new Decimal(e).cbrt().toFixed()}function _d_exp(e){return new Decimal(e).exp().toFixed()}function _d_ln(e){return new Decimal(e).ln().toFixed()}function _d_log(e,t){return new Decimal(e).log(t).toFixed()}function _d_log2(e){return new Decimal(e).log(2).toFixed()}function _d_log10(e){return new Decimal(e).log(10).toFixed()}function _d_sin(e){return new Decimal(e).sin().toFixed()}function _d_cos(e){return new Decimal(e).cos().toFixed()}function _d_tan(e){return new Decimal(e).tan().toFixed()}function _d_asin(e){return new Decimal(e).asin().toFixed()}function _d_acos(e){return new Decimal(e).acos().toFixed()}function _d_atan(e){return new Decimal(e).atan().toFixed()}function _d_sinh(e){return new Decimal(e).sinh().toFixed()}function _d_cosh(e){return new Decimal(e).cosh().toFixed()}function _d_tanh(e){return new Decimal(e).tanh().toFixed()}function _d_asinh(e){return new Decimal(e).asinh().toFixed()}function _d_acosh(e){return new Decimal(e).acosh().toFixed()}function _d_atanh(e){return new Decimal(e).atanh().toFixed()}function _d_floor(e){return new Decimal(e).floor().toFixed()}function _d_ceil(e){return new Decimal(e).ceil().toFixed()}function _d_trunc(e){return new Decimal(e).trunc().toFixed()}function _d_round(e){return new Decimal(e).round().toFixed()}function _d_max(e,t){return Decimal.max(e,t).toFixed()}function _d_min(e,t){return Decimal.min(e,t).toFixed()}function _d_compare(e,t){return new Decimal(e).cmp(t)}function _d_eq(e,t){return new Decimal(e).eq(t)}function _d_lt(e,t){return new Decimal(e).lt(t)}function _d_gt(e,t){return new Decimal(e).gt(t)}function _d_lte(e,t){return new Decimal(e).lte(t)}function _d_gte(e,t){return new Decimal(e).gte(t)}var decimal_ops={add:_d_add,sub:_d_sub,mul:_d_mul,div:_d_div,mod:_d_mod,pow:_d_pow,idiv:_d_idiv,abs:_d_abs,neg:_d_neg,sqrt:_d_sqrt,cbrt:_d_cbrt,exp:_d_exp,ln:_d_ln,log:_d_log,log2:_d_log2,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh,floor:_d_floor,ceil:_d_ceil,trunc:_d_trunc,round:_d_round,max:_d_max,min:_d_min,compare:_d_compare,eq:_d_eq,lt:_d_lt,gt:_d_gt,lte:_d_lte,gte:_d_gte},dadd=_d_add,dsub=_d_sub,dmul=_d_mul,ddiv=_d_div,dmod=_d_mod,dpow=_d_pow,didiv=_d_idiv,dabs=_d_abs,dneg=_d_neg,dsqrt=_d_sqrt,dcbrt=_d_cbrt,dexp=_d_exp,dln=_d_ln,dlog=_d_log,dlog2=_d_log2,dlog10=_d_log10,dsin=_d_sin,dcos=_d_cos,dtan=_d_tan,dasin=_d_asin,dacos=_d_acos,datan=_d_atan,dsinh=_d_sinh,dcosh=_d_cosh,dtanh=_d_tanh,dasinh=_d_asinh,dacosh=_d_acosh,datanh=_d_atanh,dfloor=_d_floor,dceil=_d_ceil,dtrunc=_d_trunc,dround=_d_round,dmax=_d_max,dmin=_d_min,dcompare=_d_compare,deq=_d_eq,dlt=_d_lt,dgt=_d_gt,dlte=_d_lte,dgte=_d_gte;function bigint_pow10(e){if(e<=0)return 1n;for(var t=1n,r=0;r<e;r++)t*=10n;return t}function to_fixed_point(e){var t=String(e);if(t.includes("e")||t.includes("E"))return to_fixed_point_from_scientific(t);var r=t.startsWith("-"),n=_slicedToArray((r?t.slice(1):t).split("."),2),i=n[0],a=void 0===i?"0":i,o=n[1],s=void 0===o?"":o,_=s.length,u=(a+s).replace(/^0+/,"")||"0";return{value:BigInt(r?"-"+u:u),scale:_}}function to_fixed_point_from_scientific(e){var t=_slicedToArray(e.toLowerCase().split("e"),2),r=t[0],n=t[1],i=parseInt(n,10),a=to_fixed_point(r),o=a.value,s=a.scale-i;return s<0?{value:o*bigint_pow10(-s),scale:0}:{value:o,scale:s}}function from_fixed_point(e,t){var r=e<0n,n=(r?-e:e).toString();if(t<=0)return(r?"-":"")+n+"0".repeat(-t);for(;n.length<=t;)n="0"+n;var i=n.slice(0,-t),a=n.slice(-t).replace(/0+$/,""),o=a?"".concat(i,".").concat(a):i;return r?"-"+o:o}function normalize(e,t){if(0n===e)return{value:0n,scale:0};for(;t>0&&e%10n==0n;)e/=10n,t--;return{value:e,scale:t}}function align_scale(e,t,r,n){return t>n?{a_val:e,b_val:r*=bigint_pow10(t-n),scale:t}:n>t?{a_val:e*=bigint_pow10(n-t),b_val:r,scale:n}:{a_val:e,b_val:r,scale:t}}function _add(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val+i.b_val,i.scale)}function _minus(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val-i.b_val,i.scale)}function _mul(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t;return normalize(r.value*n.value,r.scale+n.scale)}function _div(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:20,n="string"==typeof e?to_fixed_point(e):e,i="string"==typeof t?to_fixed_point(t):t;if(0n===i.value)throw new Error("Division by zero");var a=bigint_pow10(r);return normalize(n.value*a/i.value,n.scale-i.scale+r)}function _mod(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t;if(0n===n.value)throw new Error("Modulo by zero");var i=align_scale(r.value,r.scale,n.value,n.scale);return normalize(i.a_val%i.b_val,i.scale)}function _pow(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="bigint"==typeof t?t:BigInt(Math.floor(Number(t)));if(n<0n)return _div({value:1n,scale:0},_pow(r,-n));if(0n===n)return{value:1n,scale:0};if(1n===n)return r;for(var i={value:1n,scale:0},a=r,o=n;o>0n;)o%2n==1n&&(i=_mul(i,a)),a=_mul(a,a),o/=2n;return normalize(i.value,i.scale)}function _compare(e,t){var r="string"==typeof e?to_fixed_point(e):e,n="string"==typeof t?to_fixed_point(t):t,i=align_scale(r.value,r.scale,n.value,n.scale),a=i.a_val,o=i.b_val;return a<o?-1:a>o?1:0}function _eq(e,t){return 0===_compare(e,t)}function _lt(e,t){return _compare(e,t)<0}function _gt(e,t){return _compare(e,t)>0}function _lte(e,t){return _compare(e,t)<=0}function _gte(e,t){return _compare(e,t)>=0}function _abs(e){var t="string"==typeof e?to_fixed_point(e):e;return{value:t.value<0n?-t.value:t.value,scale:t.scale}}function _neg(e){var t="string"==typeof e?to_fixed_point(e):e;return{value:-t.value,scale:t.scale}}function _floor(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale),n=t.value/r;return t.value<0n&&t.value%r!==0n&&(n-=1n),{value:n,scale:0}}function _ceil(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale),n=t.value/r;return t.value>0n&&t.value%r!==0n&&(n+=1n),{value:n,scale:0}}function _trunc(e){var t="string"==typeof e?to_fixed_point(e):e;if(t.scale<=0)return{value:t.value*bigint_pow10(-t.scale),scale:0};var r=bigint_pow10(t.scale);return{value:t.value/r,scale:0}}function _round(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r="string"==typeof e?to_fixed_point(e):e,n=t;if(r.scale<=n){var i=n-r.scale;return{value:r.value*bigint_pow10(i),scale:n}}var a=bigint_pow10(r.scale-n),o=a/2n,s=r.value/a,_=r.value%a;return r.value>=0n?_>=o&&(s+=1n):-_>=o&&(s-=1n),normalize(s,n)}function _max(e,t){return _gt(e,t)?"string"==typeof e?to_fixed_point(e):e:"string"==typeof t?to_fixed_point(t):t}function _min(e,t){return _lt(e,t)?"string"==typeof e?to_fixed_point(e):e:"string"==typeof t?to_fixed_point(t):t}function _b_add(e,t){var r=_add(e,t);return from_fixed_point(r.value,r.scale)}function _b_sub(e,t){var r=_minus(e,t);return from_fixed_point(r.value,r.scale)}function _b_mul(e,t){var r=_mul(e,t);return from_fixed_point(r.value,r.scale)}function _b_div(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Division by zero")}var n=_div(e,t,get_config("_div_precision")||20);return from_fixed_point(n.value,n.scale)}function _b_mod(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Modulo by zero")}var n=_mod(e,t);return from_fixed_point(n.value,n.scale)}function _b_pow(e,t){var r=Number(t);if(!Number.isInteger(r))return _d_pow(e,t);var n=_pow(e,r);return from_fixed_point(n.value,n.scale)}function _b_idiv(e,t){if(0n===to_fixed_point(t).value){var r=get_config("_error");if(void 0!==r)return r;throw new Error("Division by zero")}var n=_div(e,t,get_config("_div_precision")||20),i=_trunc({value:n.value,scale:n.scale});return from_fixed_point(i.value,i.scale)}function _b_abs(e){var t=_abs(e);return from_fixed_point(t.value,t.scale)}function _b_neg(e){var t=_neg(e);return from_fixed_point(t.value,t.scale)}function _b_floor(e){var t=_floor(e);return from_fixed_point(t.value,t.scale)}function _b_ceil(e){var t=_ceil(e);return from_fixed_point(t.value,t.scale)}function _b_trunc(e){var t=_trunc(e);return from_fixed_point(t.value,t.scale)}function _b_round(e){var t=_round(e,0);return from_fixed_point(t.value,t.scale)}function _b_max(e,t){var r=_max(e,t);return from_fixed_point(r.value,r.scale)}function _b_min(e,t){var r=_min(e,t);return from_fixed_point(r.value,r.scale)}function _b_compare(e,t){return _compare(e,t)}function _b_eq(e,t){return _eq(e,t)}function _b_lt(e,t){return _lt(e,t)}function _b_gt(e,t){return _gt(e,t)}function _b_lte(e,t){return _lte(e,t)}function _b_gte(e,t){return _gte(e,t)}var bigint_ops={add:_b_add,sub:_b_sub,mul:_b_mul,div:_b_div,mod:_b_mod,pow:_b_pow,idiv:_b_idiv,abs:_b_abs,neg:_b_neg,floor:_b_floor,ceil:_b_ceil,trunc:_b_trunc,round:_b_round,max:_b_max,min:_b_min,compare:_b_compare,eq:_b_eq,lt:_b_lt,gt:_b_gt,lte:_b_lte,gte:_b_gte,sqrt:_d_sqrt,cbrt:_d_cbrt,exp:_d_exp,ln:_d_ln,log:_d_log,log2:_d_log2,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh},badd=_b_add,bsub=_b_sub,bmul=_b_mul,bdiv=_b_div,bmod=_b_mod,bpow=_b_pow,bidiv=_b_idiv,babs=_b_abs,bneg=_b_neg,bfloor=_b_floor,bceil=_b_ceil,btrunc=_b_trunc,bround=_b_round,bmax=_b_max,bmin=_b_min,bcompare=_b_compare,beq=_b_eq,blt=_b_lt,bgt=_b_gt,blte=_b_lte,bgte=_b_gte,bsqrt=_d_sqrt,bcbrt=_d_cbrt,bexp=_d_exp,bln=_d_ln,blog=_d_log,blog2=_d_log2,blog10=_d_log10,bsin=_d_sin,bcos=_d_cos,btan=_d_tan,basin=_d_asin,bacos=_d_acos,batan=_d_atan,bsinh=_d_sinh,bcosh=_d_cosh,btanh=_d_tanh,basinh=_d_asinh,bacosh=_d_acosh,batanh=_d_atanh,wasm_module=null,wasm_loaded=!1,wasm_loading=!1,wasm_load_callbacks=[],_calc_fallback=null;function register_calc_fallback(e){_calc_fallback=e}function load_wasm(e){return _load_wasm.apply(this,arguments)}function _load_wasm(){return(_load_wasm=_asyncToGenerator(_regenerator().m(function e(t){var r,n,i,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!wasm_loaded){e.n=1;break}return e.a(2,wasm_module);case 1:if(!wasm_loading){e.n=2;break}return e.a(2,new Promise(function(e,t){wasm_load_callbacks.push({resolve:e,reject:t})}));case 2:return wasm_loading=!0,e.p=3,e.n=4,Promise.resolve().then(function(){return wasm_calc});case 4:if(r=e.v,n="undefined"!=typeof window,i="undefined"!=typeof process&&process.versions&&process.versions.node,!n){e.n=8;break}if(!t){e.n=6;break}return e.n=5,r.default(t);case 5:e.n=7;break;case 6:return e.n=7,r.default();case 7:case 9:case 16:e.n=18;break;case 8:if(!i){e.n=10;break}return e.n=9,init_wasm_node(r);case 10:if("function"!=typeof globalThis.fetch){e.n=17;break}if(e.p=11,!t){e.n=13;break}return e.n=12,r.default(t);case 12:e.n=14;break;case 13:return e.n=14,r.default();case 14:e.n=16;break;case 15:return e.p=15,e.v,e.n=16,init_wasm_node(r);case 17:throw new Error("Unsupported environment for WASM loading");case 18:return wasm_module=r,wasm_loaded=!0,update_wasm_ops(),wasm_load_callbacks.forEach(function(e){return e.resolve(r)}),wasm_load_callbacks=[],e.a(2,r);case 19:throw e.p=19,a=e.v,wasm_loading=!1,wasm_load_callbacks.forEach(function(e){return e.reject(a)}),wasm_load_callbacks=[],console.warn("WASM module failed to load, using Decimal fallback:",a),a;case 20:return e.a(2)}},e,null,[[11,15],[3,19]])}))).apply(this,arguments)}function init_wasm_node(e){return _init_wasm_node.apply(this,arguments)}function _init_wasm_node(){return(_init_wasm_node=_asyncToGenerator(_regenerator().m(function e(t){var r,n,i,a,o,s,_,u,c,l,f,d,p,g,m,v;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.n=1,import("fs");case 1:return r=e.v,n=r.readFileSync,e.n=2,import("url");case 2:return i=e.v,a=i.fileURLToPath,e.n=3,import("path");case 3:o=e.v,s=o.dirname,_=o.join,u=a(import.meta.url),c=s(u),l=[_(c,"../../wasm-calc/pkg/wasm_calc_bg.wasm"),_(c,"../wasm-calc/pkg/wasm_calc_bg.wasm"),_(c,"../../wasm-calc/pkg/wasm_calc_bg.wasm")],f=null,d=null,p=0,g=l;case 4:if(!(p<g.length)){e.n=8;break}return m=g[p],e.p=5,f=n(m),e.a(3,8);case 6:e.p=6,v=e.v,d=v;case 7:p++,e.n=4;break;case 8:if(f){e.n=9;break}throw d||new Error("WASM file not found");case 9:t.initSync({module:f});case 10:return e.a(2)}},e,null,[[5,6]])}))).apply(this,arguments)}function is_wasm_loaded(){return wasm_loaded}var wasm_ops={add:_d_add,sub:_d_sub,mul:_d_mul,div:_d_div,mod:_d_mod,pow:_d_pow,idiv:_d_idiv,abs:_d_abs,neg:_d_neg,sqrt:_d_sqrt,exp:_d_exp,ln:_d_ln,log10:_d_log10,sin:_d_sin,cos:_d_cos,tan:_d_tan,floor:_d_floor,ceil:_d_ceil,trunc:_d_trunc,round:_d_round,max:_d_max,min:_d_min,compare:_d_compare,eq:_d_eq,lt:_d_lt,gt:_d_gt,lte:_d_lte,gte:_d_gte,cbrt:_d_cbrt,log:_d_log,log2:_d_log2,asin:_d_asin,acos:_d_acos,atan:_d_atan,sinh:_d_sinh,cosh:_d_cosh,tanh:_d_tanh,asinh:_d_asinh,acosh:_d_acosh,atanh:_d_atanh};function trigger_wcalc_load(){wasm_loading||wasm_loaded||load_wasm().catch(function(){})}var _wcalc_impl=function(e){return trigger_wcalc_load(),_calc_fallback(e)};function wcalc(e){return _wcalc_impl(e)}function update_wasm_ops(){wasm_ops.add=function(e,t){return wasm_module.str_plus(String(e),String(t))},wasm_ops.sub=function(e,t){return wasm_module.str_sub(String(e),String(t))},wasm_ops.mul=function(e,t){return wasm_module.str_mul(String(e),String(t))},wasm_ops.div=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return r},wasm_ops.mod=function(e,t){var r=wasm_module.str_mod(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return r},wasm_ops.pow=function(e,t){var r=wasm_module.str_powd(String(e),String(t));return"NaN"===r||"Overflow"===r?_d_pow(e,t):r},wasm_ops.idiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return wasm_module.str_trunc(r)},wasm_ops.abs=function(e){return wasm_module.str_abs(String(e))},wasm_ops.neg=function(e){return wasm_module.str_neg(String(e))},wasm_ops.sqrt=function(e){var t=wasm_module.str_sqrt(String(e));return"NaN"===t?_d_sqrt(e):t},wasm_ops.exp=function(e){return wasm_module.str_exp(String(e))},wasm_ops.ln=function(e){var t=wasm_module.str_ln(String(e));return"NaN"===t?_d_ln(e):t},wasm_ops.log10=function(e){var t=wasm_module.str_log10(String(e));return"NaN"===t?_d_log10(e):t},wasm_ops.sin=function(e){return wasm_module.str_sin(String(e))},wasm_ops.cos=function(e){return wasm_module.str_cos(String(e))},wasm_ops.tan=function(e){return wasm_module.str_tan(String(e))},wasm_ops.floor=function(e){return wasm_module.str_floor(String(e))},wasm_ops.ceil=function(e){return wasm_module.str_ceil(String(e))},wasm_ops.trunc=function(e){return wasm_module.str_trunc(String(e))},wasm_ops.round=function(e){return wasm_module.str_round(String(e))},wasm_ops.max=function(e,t){return wasm_module.str_max(String(e),String(t))},wasm_ops.min=function(e,t){return wasm_module.str_min(String(e),String(t))},wasm_ops.compare=function(e,t){return wasm_module.str_compare(String(e),String(t))},wasm_ops.eq=function(e,t){return wasm_module.str_eq(String(e),String(t))},wasm_ops.lt=function(e,t){return wasm_module.str_lt(String(e),String(t))},wasm_ops.gt=function(e,t){return wasm_module.str_gt(String(e),String(t))},wasm_ops.lte=function(e,t){return wasm_module.str_lte(String(e),String(t))},wasm_ops.gte=function(e,t){return wasm_module.str_gte(String(e),String(t))},_wcalc_impl=function(e){var t=wasm_module.eval_expr(String(e));if(t.startsWith("Error:")){var r=get_config("_error");if(void 0!==r)return r;throw new Error(t)}return t},update_wasm_raw_functions()}function trigger_wasm_load(){wasm_loading||wasm_loaded||load_wasm().catch(function(){})}var wadd=function(e,t){return trigger_wasm_load(),_d_add(e,t)},wsub=function(e,t){return trigger_wasm_load(),_d_sub(e,t)},wmul=function(e,t){return trigger_wasm_load(),_d_mul(e,t)},wdiv=function(e,t){return trigger_wasm_load(),_d_div(e,t)},wmod=function(e,t){return trigger_wasm_load(),_d_mod(e,t)},wpow=function(e,t){return trigger_wasm_load(),_d_pow(e,t)},widiv=function(e,t){return trigger_wasm_load(),_d_idiv(e,t)},wabs=function(e){return trigger_wasm_load(),_d_abs(e)},wneg=function(e){return trigger_wasm_load(),_d_neg(e)},wsqrt=function(e){return trigger_wasm_load(),_d_sqrt(e)},wcbrt=function(e){return trigger_wasm_load(),_d_cbrt(e)},wexp=function(e){return trigger_wasm_load(),_d_exp(e)},wln=function(e){return trigger_wasm_load(),_d_ln(e)},wlog=function(e,t){return trigger_wasm_load(),_d_log(e,t)},wlog2=function(e){return trigger_wasm_load(),_d_log2(e)},wlog10=function(e){return trigger_wasm_load(),_d_log10(e)},wsin=function(e){return trigger_wasm_load(),_d_sin(e)},wcos=function(e){return trigger_wasm_load(),_d_cos(e)},wtan=function(e){return trigger_wasm_load(),_d_tan(e)},wasin=function(e){return trigger_wasm_load(),_d_asin(e)},wacos=function(e){return trigger_wasm_load(),_d_acos(e)},watan=function(e){return trigger_wasm_load(),_d_atan(e)},wsinh=function(e){return trigger_wasm_load(),_d_sinh(e)},wcosh=function(e){return trigger_wasm_load(),_d_cosh(e)},wtanh=function(e){return trigger_wasm_load(),_d_tanh(e)},wasinh=function(e){return trigger_wasm_load(),_d_asinh(e)},wacosh=function(e){return trigger_wasm_load(),_d_acosh(e)},watanh=function(e){return trigger_wasm_load(),_d_atanh(e)},wfloor=function(e){return trigger_wasm_load(),_d_floor(e)},wceil=function(e){return trigger_wasm_load(),_d_ceil(e)},wtrunc=function(e){return trigger_wasm_load(),_d_trunc(e)},wround=function(e){return trigger_wasm_load(),_d_round(e)},wmax=function(e,t){return trigger_wasm_load(),_d_max(e,t)},wmin=function(e,t){return trigger_wasm_load(),_d_min(e,t)},wcompare=function(e,t){return trigger_wasm_load(),_d_compare(e,t)},weq=function(e,t){return trigger_wasm_load(),_d_eq(e,t)},wlt=function(e,t){return trigger_wasm_load(),_d_lt(e,t)},wgt=function(e,t){return trigger_wasm_load(),_d_gt(e,t)},wlte=function(e,t){return trigger_wasm_load(),_d_lte(e,t)},wgte=function(e,t){return trigger_wasm_load(),_d_gte(e,t)};function update_wasm_raw_functions(){wadd=function(e,t){return wasm_module.str_plus(String(e),String(t))},wsub=function(e,t){return wasm_module.str_sub(String(e),String(t))},wmul=function(e,t){return wasm_module.str_mul(String(e),String(t))},wdiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return r},wmod=function(e,t){var r=wasm_module.str_mod(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Modulo by zero")}return r},wpow=function(e,t){var r=wasm_module.str_powd(String(e),String(t));return"NaN"===r||"Overflow"===r?_d_pow(e,t):r},widiv=function(e,t){var r=wasm_module.str_div(String(e),String(t));if("NaN"===r){var n=get_config("_error");if(void 0!==n)return n;throw new Error("Division by zero")}return wasm_module.str_trunc(r)},wabs=function(e){return wasm_module.str_abs(String(e))},wneg=function(e){return wasm_module.str_neg(String(e))},wsqrt=function(e){var t=wasm_module.str_sqrt(String(e));return"NaN"===t?_d_sqrt(e):t},wexp=function(e){return wasm_module.str_exp(String(e))},wln=function(e){var t=wasm_module.str_ln(String(e));return"NaN"===t?_d_ln(e):t},wlog10=function(e){var t=wasm_module.str_log10(String(e));return"NaN"===t?_d_log10(e):t},wsin=function(e){return wasm_module.str_sin(String(e))},wcos=function(e){return wasm_module.str_cos(String(e))},wtan=function(e){return wasm_module.str_tan(String(e))},wfloor=function(e){return wasm_module.str_floor(String(e))},wceil=function(e){return wasm_module.str_ceil(String(e))},wtrunc=function(e){return wasm_module.str_trunc(String(e))},wround=function(e){return wasm_module.str_round(String(e))},wmax=function(e,t){return wasm_module.str_max(String(e),String(t))},wmin=function(e,t){return wasm_module.str_min(String(e),String(t))},wcompare=function(e,t){return wasm_module.str_compare(String(e),String(t))},weq=function(e,t){return wasm_module.str_eq(String(e),String(t))},wlt=function(e,t){return wasm_module.str_lt(String(e),String(t))},wgt=function(e,t){return wasm_module.str_gt(String(e),String(t))},wlte=function(e,t){return wasm_module.str_lte(String(e),String(t))},wgte=function(e,t){return wasm_module.str_gte(String(e),String(t))}}var modes={decimal:decimal_ops,bigint:bigint_ops,wasm:wasm_ops},ops=_objectSpread2({},decimal_ops);function set_compute_mode(e){return modes[e]?(Object.assign(ops,modes[e]),"wasm"!==e||is_wasm_loaded()||load_wasm().catch(function(e){console.warn("Failed to load WASM module, using Decimal fallback:",e.message)}),!0):(console.warn("Unknown compute mode: ".concat(e,", available modes: ").concat(Object.keys(modes).join(", "))),!1)}function is_error_value(e){var t=get_config("_error");return void 0!==t&&e===t}function add(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";for(var a=String(i[0]),o=1;o<i.length;o++)a=ops.add(a,String(i[o]));return"number"===n?Number(a):a}function sub(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=ops.neg(ops.neg(String(i[0])));return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)o=ops.sub(o,String(i[s]));return"number"===n?Number(o):o}function mul(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";for(var a=String(i[0]),o=1;o<i.length;o++)a=ops.mul(a,String(i[o]));return"number"===n?Number(a):a}function div(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.div(o,String(i[s]))))return o;return"number"===n?Number(o):o}function mod(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.mod(o,String(i[s]))))return o;return"number"===n?Number(o):o}function pow(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?1:"1";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[i.length-1]),s=i.length-2;s>=0;s--)o=ops.pow(String(i[s]),o);return"number"===n?Number(o):o}function idiv(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.length>0&&"string"===t[t.length-1]?"string":"number",i="string"===n?t.slice(0,-1):t;if(0===i.length)return"number"===n?0:"0";if(1===i.length){var a=String(i[0]);return"number"===n?Number(a):a}for(var o=String(i[0]),s=1;s<i.length;s++)if(is_error_value(o=ops.idiv(o,String(i[s]))))return o;return"number"===n?Number(o):o}function abs(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.abs(String(e));return"number"===t?Number(r):r}function neg(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.neg(String(e));return"number"===t?Number(r):r}function sqrt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.sqrt(String(e));return"number"===t?Number(r):r}function ln(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.ln(String(e));return"number"===t?Number(r):r}function exp(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",r=ops.exp(String(e));return"number"===t?Number(r):r}function internal_format(e,t){if(!t)return e;var r=fmt_tokenizer(t,null);return _slicedToArray(format(new Decimal(e),r,{}),1)[0]}function resolve_value(e){if("function"==typeof e){var t=e();return is_error_value(t),t}return e}function create_chain(e){var t=String(e),r=is_error_value(e),n=function(e){return r?t:e?internal_format(t,e):t};return n.add=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=add(t,_,"string")))return r=!0,n}return n},n.sub=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=sub(t,_,"string")))return r=!0,n}return n},n.mul=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=mul(t,_,"string")))return r=!0,n}return n},n.div=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=div(t,_,"string")))return r=!0,n}return n},n.mod=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=mod(t,_,"string")))return r=!0,n}return n},n.pow=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=pow(t,_,"string")))return r=!0,n}return n},n.idiv=function(){if(r)return n;for(var e=arguments.length,i=new Array(e),a=0;a<e;a++)i[a]=arguments[a];for(var o=0,s=i;o<s.length;o++){var _=resolve_value(s[o]);if(is_error_value(t=idiv(t,_,"string")))return r=!0,n}return n},n}function cadd(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)return create_chain(0);for(var n="0",i=0,a=t;i<a.length;i++){var o=resolve_value(a[i]);if(is_error_value(o))return create_chain(o);if(is_error_value(n=add(n,o,"string")))return create_chain(n)}return create_chain(n)}function csub(e){if(void 0===e)return create_chain(0);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=sub(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cmul(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(0===t.length)return create_chain(1);for(var n="1",i=0,a=t;i<a.length;i++){var o=resolve_value(a[i]);if(is_error_value(o))return create_chain(o);if(is_error_value(n=mul(n,o,"string")))return create_chain(n)}return create_chain(n)}function cdiv(e){if(void 0===e)return create_chain(1);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=div(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cmod(e){if(void 0===e)return create_chain(0);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=mod(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cpow(e){if(void 0===e)return create_chain(1);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=pow(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function cidiv(e){if(void 0===e)return create_chain(0);for(var t=String(resolve_value(e)),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){if(is_error_value(t=idiv(t,resolve_value(o[a]),"string")))return create_chain(t)}return create_chain(t)}function print_debug_info(e){var t=[],r=50,n="─".repeat(r);t.push("┌".concat(n,"┐")),t.push("│ [a-calc debug]".concat(" ".repeat(35),"│")),t.push("├".concat(n,"┤"));var i="│ 表达式: ".concat(e.expression);t.push(i+" ".repeat(Math.max(0,52-i.length))+"│"),t.push("│".concat(" ".repeat(r),"│")),t.push("│ 变量:".concat(" ".repeat(45),"│"));for(var a=0,o=Object.entries(e.variables);a<o.length;a++){var s=_slicedToArray(o[a],2),_=s[0],u=s[1],c="│ ".concat(_," = ").concat(u);t.push(c+" ".repeat(Math.max(0,52-c.length))+"│")}if(t.push("│".concat(" ".repeat(r),"│")),t.push("│ 步骤:".concat(" ".repeat(45),"│")),e.steps.forEach(function(e,r){var n="│ ".concat(r+1,". ").concat(e.expression);t.push(n+" ".repeat(Math.max(0,52-n.length))+"│");var i="│ → ".concat(e.substituted," = ").concat(e.result);t.push(i+" ".repeat(Math.max(0,52-i.length))+"│")}),t.push("│".concat(" ".repeat(r),"│")),e.format){var l="│ 格式化: | ".concat(e.format);t.push(l+" ".repeat(Math.max(0,52-l.length))+"│"),t.push("│".concat(" ".repeat(r),"│"))}var f='│ 结果: "'.concat(e.result,'"');t.push(f+" ".repeat(Math.max(0,52-f.length))+"│"),t.push("└".concat(n,"┘")),console.log(t.join("\n"))}function calc(e,t){var r,n=get_config(),i=t?Array.isArray(t)?t:_objectSpread2(_objectSpread2({},n),t):n,a=null!==(r=find_value(i,"_error"))&&void 0!==r?r:get_config("_error"),o=find_value(i,"_debug"),s=find_value(i,"_on_debug"),_=null;o&&(_={expression:e,variables:{},steps:[],format:null,result:null});try{var u,c,l,f=parse_args(e,i),d=f._unit;f._angle_unit&&set_config({_angle_unit:f._angle_unit});var p={_empty_values:f._empty_values,_empty_check:f._empty_check};if(o&&f.fill_data){var g=function(e){if(Array.isArray(e))e.forEach(function(e){return g(e)});else if(e&&"object"===_typeof(e))for(var t=0,r=Object.entries(e);t<r.length;t++){var n=_slicedToArray(r[t],2),i=n[0],a=n[1];i.startsWith("_")||"function"==typeof a||(_.variables[i]=a)}};g(f.fill_data)}var m=tokenizer(f.expr,f.fill_data,d,p);if(m._fill_data=f.fill_data,m._unit=d,m._options=p,o){var v=m.map(function(e){return void 0!==e.real_value&&e.real_value!==e.value?e.real_value:e.value}).join(" ");_.steps.push({expression:f.expr,substituted:v,result:"..."})}var h=eval_tokens(m);if(o&&_.steps.length>0&&(_.steps[_.steps.length-1].result=String(h)),"boolean"==typeof h)return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;if("string"==typeof h&&!is_decimal(h))return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;var w,b,y,x=is_decimal(h)?h:new Decimal(h);b=""===f.fmt_expr||void 0===f.fmt_expr?void 0:fmt_tokenizer(f.fmt_expr,f.fill_data);var S=get_config("_fmt_parsed");if(S&&S.has_var)y=fmt_tokenizer(get_config("_fmt"),f.fill_data);else y=S;if(void 0===b?void 0!==y&&(b=y):void 0!==y&&(b=[].concat(_toConsumableArray(y),_toConsumableArray(b))),o&&(f.fmt_expr||get_config("_fmt"))&&(_.format=f.fmt_expr||get_config("_fmt")),void 0===b)x=x.toFixed();else{var E=_slicedToArray(format(x,b,{_compact_units:f._compact_units,_compact_step:f._compact_step,_unit_convert_out:get_config("_unit_convert_out"),_unit_default_in:get_config("_unit_default_in"),_unit_default_out:get_config("_unit_default_out"),_unit_default_position:get_config("_unit_default_position"),_unit_position_map:get_config("_unit_position_map"),_thousands:f._thousands,_unit_thousands_map:get_config("_unit_thousands_map"),_recognized_unit:m.has_unit?m.unit:null}),2);x=E[0],w=E[1]}if("Infinity"===x||"NaN"===x||void 0===x)throw new Error("计算错误可能是非法的计算式");return!m.has_unit||null!==(u=w)&&void 0!==u&&u.to_number||null!==(c=w)&&void 0!==c&&c.to_number_string||null!==(l=w)&&void 0!==l&&l.unit_handled||(x+=m.unit),o&&(_.result=x,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),x}catch(e){if(o&&(_.result=null!=a?a:e.message,_.error=e.message,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),void 0===a)throw e;return a}}function calc_space(e,t){var r,n=get_config(),i=t?Array.isArray(t)?t:_objectSpread2(_objectSpread2({},n),t):n,a=null!==(r=find_value(i,"_error"))&&void 0!==r?r:get_config("_error"),o=find_value(i,"_debug"),s=find_value(i,"_on_debug"),_=null;o&&(_={expression:e,variables:{},steps:[],format:null,result:null});try{var u,c,l,f=parse_args(e,i),d=f._unit;f._angle_unit&&set_config({_angle_unit:f._angle_unit});var p={_empty_values:f._empty_values,_empty_check:f._empty_check};if(o&&f.fill_data){var g=function(e){if(Array.isArray(e))e.forEach(function(e){return g(e)});else if(e&&"object"===_typeof(e))for(var t=0,r=Object.entries(e);t<r.length;t++){var n=_slicedToArray(r[t],2),i=n[0],a=n[1];i.startsWith("_")||"function"==typeof a||(_.variables[i]=a)}};g(f.fill_data)}var m=tokenizer_space(f.expr,f.fill_data,d,p);if(m._fill_data=f.fill_data,m._unit=d,m._options=p,o){var v=m.map(function(e){return void 0!==e.real_value&&e.real_value!==e.value?e.real_value:e.value}).join(" ");_.steps.push({expression:f.expr,substituted:v,result:"..."})}var h=eval_tokens(m);if(o&&_.steps.length>0&&(_.steps[_.steps.length-1].result=String(h)),"boolean"==typeof h)return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;if("string"==typeof h&&!is_decimal(h))return o&&(_.result=h,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),h;var w,b,y,x=is_decimal(h)?h:new Decimal(h);b=""===f.fmt_expr||void 0===f.fmt_expr?void 0:fmt_tokenizer_space(f.fmt_expr,f.fill_data);var S=get_config("_fmt_parsed");if(S&&S.has_var)y=fmt_tokenizer_space(get_config("_fmt"),f.fill_data);else y=S;if(void 0===b?void 0!==y&&(b=y):void 0!==y&&(b=[].concat(_toConsumableArray(y),_toConsumableArray(b))),o&&(f.fmt_expr||get_config("_fmt"))&&(_.format=f.fmt_expr||get_config("_fmt")),void 0===b)x=x.toFixed();else{var E=_slicedToArray(format(x,b,{_compact_units:f._compact_units,_compact_step:f._compact_step,_unit_convert_out:get_config("_unit_convert_out"),_unit_default_in:get_config("_unit_default_in"),_unit_default_out:get_config("_unit_default_out"),_unit_default_position:get_config("_unit_default_position"),_unit_position_map:get_config("_unit_position_map"),_thousands:f._thousands,_unit_thousands_map:get_config("_unit_thousands_map"),_recognized_unit:m.has_unit?m.unit:null}),2);x=E[0],w=E[1]}if("Infinity"===x||"NaN"===x||void 0===x)throw new Error("计算错误可能是非法的计算式");return!m.has_unit||null!==(u=w)&&void 0!==u&&u.to_number||null!==(c=w)&&void 0!==c&&c.to_number_string||null!==(l=w)&&void 0!==l&&l.unit_handled||(x+=m.unit),o&&(_.result=x,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),x}catch(e){if(o&&(_.result=null!=a?a:e.message,_.error=e.message,get_config("_debug_console")&&print_debug_info(_),s&&s(_)),void 0===a)throw e;return a}}function fmt(e,t,r){return calc(t?"".concat(e," | ").concat(t):"".concat(e),r)}function check_update(){check_version().catch(function(){})}function print_version(){console.log("%ca-calc:%c ".concat(version," %c=> %curl:%c https://www.npmjs.com/package/a-calc"),"color: #fff;background: #67C23A;padding: 2px 5px;border-radius:4px;font-size: 14px;","color: #67C23A;font-size:14px;","color: #67C23A;font-size:14px;","background: #67C23A;font-size:14px; padding: 2px 5px; border-radius: 4px; color: #fff;","font-size:14px;")}on_config_change("_compute_mode",function(e){set_compute_mode(e)}),Decimal.set({precision:50,rounding:Decimal.ROUND_HALF_UP,toExpNeg:-50,toExpPos:50}),register_calc_fallback(calc),register_calc(calc),register_calc_for_sum(calc);var calc_util={check_update:check_update,print_version:print_version,close_important_push:close_important_push,open_important_push:open_important_push},wasm;function radd(){return ops.add.apply(ops,arguments)}function rsub(){return ops.sub.apply(ops,arguments)}function rmul(){return ops.mul.apply(ops,arguments)}function rdiv(){return ops.div.apply(ops,arguments)}function rmod(){return ops.mod.apply(ops,arguments)}function rpow(){return ops.pow.apply(ops,arguments)}function ridiv(){return ops.idiv.apply(ops,arguments)}function rabs(){return ops.abs.apply(ops,arguments)}function rneg(){return ops.neg.apply(ops,arguments)}function rsqrt(){return ops.sqrt.apply(ops,arguments)}function rln(){return ops.ln.apply(ops,arguments)}function rexp(){return ops.exp.apply(ops,arguments)}function rsin(){return ops.sin.apply(ops,arguments)}function rcos(){return ops.cos.apply(ops,arguments)}function rtan(){return ops.tan.apply(ops,arguments)}function rasin(){return ops.asin.apply(ops,arguments)}function racos(){return ops.acos.apply(ops,arguments)}function ratan(){return ops.atan.apply(ops,arguments)}function rsinh(){return ops.sinh.apply(ops,arguments)}function rcosh(){return ops.cosh.apply(ops,arguments)}function rtanh(){return ops.tanh.apply(ops,arguments)}function rasinh(){return ops.asinh.apply(ops,arguments)}function racosh(){return ops.acosh.apply(ops,arguments)}function ratanh(){return ops.atanh.apply(ops,arguments)}function rfloor(){return ops.floor.apply(ops,arguments)}function rceil(){return ops.ceil.apply(ops,arguments)}function rtrunc(){return ops.trunc.apply(ops,arguments)}function rround(){return ops.round.apply(ops,arguments)}function rmax(){return ops.max.apply(ops,arguments)}function rmin(){return ops.min.apply(ops,arguments)}function rcompare(){return ops.compare.apply(ops,arguments)}function req(){return ops.eq.apply(ops,arguments)}function rlt(){return ops.lt.apply(ops,arguments)}function rgt(){return ops.gt.apply(ops,arguments)}function rlte(){return ops.lte.apply(ops,arguments)}function rgte(){return ops.gte.apply(ops,arguments)}function rlog(){return ops.log.apply(ops,arguments)}function rlog2(){return ops.log2.apply(ops,arguments)}function rlog10(){return ops.log10.apply(ops,arguments)}function rcbrt(){return ops.cbrt.apply(ops,arguments)}var cachedDataViewMemory0=null;function getDataViewMemory0(){return(null===cachedDataViewMemory0||!0===cachedDataViewMemory0.buffer.detached||void 0===cachedDataViewMemory0.buffer.detached&&cachedDataViewMemory0.buffer!==wasm.memory.buffer)&&(cachedDataViewMemory0=new DataView(wasm.memory.buffer)),cachedDataViewMemory0}function getStringFromWasm0(e,t){return decodeText(e>>>=0,t)}var cachedUint8ArrayMemory0=null;function getUint8ArrayMemory0(){return null!==cachedUint8ArrayMemory0&&0!==cachedUint8ArrayMemory0.byteLength||(cachedUint8ArrayMemory0=new Uint8Array(wasm.memory.buffer)),cachedUint8ArrayMemory0}function passStringToWasm0(e,t,r){if(void 0===r){var n=cachedTextEncoder.encode(e),i=t(n.length,1)>>>0;return getUint8ArrayMemory0().subarray(i,i+n.length).set(n),WASM_VECTOR_LEN=n.length,i}for(var a=e.length,o=t(a,1)>>>0,s=getUint8ArrayMemory0(),_=0;_<a;_++){var u=e.charCodeAt(_);if(u>127)break;s[o+_]=u}if(_!==a){0!==_&&(e=e.slice(_)),o=r(o,a,a=_+3*e.length,1)>>>0;var c=getUint8ArrayMemory0().subarray(o+_,o+a);o=r(o,a,_+=cachedTextEncoder.encodeInto(e,c).written,1)>>>0}return WASM_VECTOR_LEN=_,o}var cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});cachedTextDecoder.decode();var MAX_SAFARI_DECODE_BYTES=2146435072,numBytesDecoded=0;function decodeText(e,t){return(numBytesDecoded+=t)>=MAX_SAFARI_DECODE_BYTES&&((cachedTextDecoder=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0})).decode(),numBytesDecoded=t),cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(e,e+t))}var cachedTextEncoder=new TextEncoder;"encodeInto"in cachedTextEncoder||(cachedTextEncoder.encodeInto=function(e,t){var r=cachedTextEncoder.encode(e);return t.set(r),{read:e.length,written:r.length}});var WASM_VECTOR_LEN=0;function eval_expr(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.eval_expr(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function eval_expr_safe(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.eval_expr_safe(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_abs(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_abs(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_ceil(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_ceil(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_compare(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return wasm.str_compare(r,n,i,a)}function str_cos(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_cos(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_div(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_div(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_eq(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_eq(r,n,i,a)}function str_exp(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_exp(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_floor(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_floor(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_fract(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_fract(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_gt(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_gt(r,n,i,a)}function str_gte(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_gte(r,n,i,a)}function str_is_integer(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_integer(t,r)}function str_is_negative(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_negative(t,r)}function str_is_positive(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_positive(t,r)}function str_is_zero(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return 0!==wasm.str_is_zero(t,r)}function str_ln(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_ln(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_log10(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_log10(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_lt(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_lt(r,n,i,a)}function str_lte(e,t){var r=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),n=WASM_VECTOR_LEN,i=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;return 0!==wasm.str_lte(r,n,i,a)}function str_max(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_max(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_min(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_min(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_mod(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_mod(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_mul(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_mul(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_neg(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_neg(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_normalize(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_normalize(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_plus(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_plus(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_pow(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_pow(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_powd(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_powd(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_round(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_round(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_round_dp(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_round_dp(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_round_dp_bankers(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN;wasm.str_round_dp_bankers(i,a,o,t);var s=getDataViewMemory0().getInt32(i+0,!0),_=getDataViewMemory0().getInt32(i+4,!0);return r=s,n=_,getStringFromWasm0(s,_)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_scale(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return wasm.str_scale(t,r)>>>0}function str_sign(e){var t=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),r=WASM_VECTOR_LEN;return wasm.str_sign(t,r)}function str_sin(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_sin(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_sqrt(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_sqrt(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_sub(e,t){var r,n;try{var i=wasm.__wbindgen_add_to_stack_pointer(-16),a=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),o=WASM_VECTOR_LEN,s=passStringToWasm0(t,wasm.__wbindgen_export,wasm.__wbindgen_export2),_=WASM_VECTOR_LEN;wasm.str_sub(i,a,o,s,_);var u=getDataViewMemory0().getInt32(i+0,!0),c=getDataViewMemory0().getInt32(i+4,!0);return r=u,n=c,getStringFromWasm0(u,c)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(r,n,1)}}function str_tan(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_tan(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}function str_trunc(e){var t,r;try{var n=wasm.__wbindgen_add_to_stack_pointer(-16),i=passStringToWasm0(e,wasm.__wbindgen_export,wasm.__wbindgen_export2),a=WASM_VECTOR_LEN;wasm.str_trunc(n,i,a);var o=getDataViewMemory0().getInt32(n+0,!0),s=getDataViewMemory0().getInt32(n+4,!0);return t=o,r=s,getStringFromWasm0(o,s)}finally{wasm.__wbindgen_add_to_stack_pointer(16),wasm.__wbindgen_export3(t,r,1)}}var EXPECTED_RESPONSE_TYPES=new Set(["basic","cors","default"]);function __wbg_load(e,t){return _wbg_load.apply(this,arguments)}function _wbg_load(){return(_wbg_load=_asyncToGenerator(_regenerator().m(function e(t,r){var n,i,a;return _regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!("function"==typeof Response&&t instanceof Response)){e.n=8;break}if("function"!=typeof WebAssembly.instantiateStreaming){e.n=5;break}return e.p=1,e.n=2,WebAssembly.instantiateStreaming(t,r);case 2:case 7:return e.a(2,e.v);case 3:if(e.p=3,a=e.v,!(t.ok&&EXPECTED_RESPONSE_TYPES.has(t.type))||"application/wasm"===t.headers.get("Content-Type")){e.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",a),e.n=5;break;case 4:throw a;case 5:return e.n=6,t.arrayBuffer();case 6:return n=e.v,e.n=7,WebAssembly.instantiate(n,r);case 8:return e.n=9,WebAssembly.instantiate(t,r);case 9:if(!((i=e.v)instanceof WebAssembly.Instance)){e.n=10;break}return e.a(2,{instance:i,module:t});case 10:return e.a(2,i);case 11:return e.a(2)}},e,null,[[1,3]])}))).apply(this,arguments)}function __wbg_get_imports(){var e={wbg:{}};return e}function __wbg_finalize_init(e,t){return wasm=e.exports,__wbg_init.__wbindgen_wasm_module=t,cachedDataViewMemory0=null,cachedUint8ArrayMemory0=null,wasm}function initSync(e){if(void 0!==wasm)return wasm;void 0!==e&&(Object.getPrototypeOf(e)===Object.prototype?e=e.module:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));var t=__wbg_get_imports();return e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e)),__wbg_finalize_init(new WebAssembly.Instance(e,t),e)}function __wbg_init(e){return _wbg_init.apply(this,arguments)}function _wbg_init(){return(_wbg_init=_asyncToGenerator(_regenerator().m(function e(t){var r,n,i,a,o;return _regenerator().w(function(e){for(;;)switch(e.n){case 0:if(void 0===wasm){e.n=1;break}return e.a(2,wasm);case 1:return void 0!==t&&(Object.getPrototypeOf(t)===Object.prototype?t=t.module_or_path:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),void 0===t&&(t=new URL("wasm_calc_bg.wasm",import.meta.url)),r=__wbg_get_imports(),("string"==typeof t||"function"==typeof Request&&t instanceof Request||"function"==typeof URL&&t instanceof URL)&&(t=fetch(t)),o=__wbg_load,e.n=2,t;case 2:return e.n=3,o(e.v,r);case 3:return n=e.v,i=n.instance,a=n.module,e.a(2,__wbg_finalize_init(i,a))}},e)}))).apply(this,arguments)}var wasm_calc=Object.freeze({__proto__:null,default:__wbg_init,eval_expr:eval_expr,eval_expr_safe:eval_expr_safe,initSync:initSync,str_abs:str_abs,str_ceil:str_ceil,str_compare:str_compare,str_cos:str_cos,str_div:str_div,str_eq:str_eq,str_exp:str_exp,str_floor:str_floor,str_fract:str_fract,str_gt:str_gt,str_gte:str_gte,str_is_integer:str_is_integer,str_is_negative:str_is_negative,str_is_positive:str_is_positive,str_is_zero:str_is_zero,str_ln:str_ln,str_log10:str_log10,str_lt:str_lt,str_lte:str_lte,str_max:str_max,str_min:str_min,str_mod:str_mod,str_mul:str_mul,str_neg:str_neg,str_normalize:str_normalize,str_plus:str_plus,str_pow:str_pow,str_powd:str_powd,str_round:str_round,str_round_dp:str_round_dp,str_round_dp_bankers:str_round_dp_bankers,str_scale:str_scale,str_sign:str_sign,str_sin:str_sin,str_sqrt:str_sqrt,str_sub:str_sub,str_tan:str_tan,str_trunc:str_trunc});export{abs,add,babs,bacos,bacosh,badd,basin,basinh,batan,batanh,bcbrt,bceil,bcompare,bcos,bcosh,bdiv,beq,bexp,bfloor,bgt,bgte,bidiv,bln,blog,blog10,blog2,blt,blte,bmax,bmin,bmod,bmul,bneg,bpow,bround,bsin,bsinh,bsqrt,bsub,btan,btanh,btrunc,cadd,calc,calc_space,calc_sum,calc_util,calc_wrap,cdiv,cidiv,cmod,cmul,cpow,csub,dabs,dacos,dacosh,dadd,dasin,dasinh,datan,datanh,dcbrt,dceil,dcompare,dcos,dcosh,ddiv,deq,dexp,dfloor,dgt,dgte,didiv,div,dln,dlog,dlog10,dlog2,dlt,dlte,dmax,dmin,dmod,dmul,dneg,dpow,dround,dsin,dsinh,dsqrt,dsub,dtan,dtanh,dtrunc,exp,fmt,get_config,idiv,is_wasm_loaded,ln,load_wasm,mod,mul,neg,parse_thousands,pow,rabs,racos,racosh,radd,rasin,rasinh,ratan,ratanh,rcbrt,rceil,rcompare,rcos,rcosh,rdiv,req,reset_config,rexp,rfloor,rgt,rgte,ridiv,rln,rlog,rlog10,rlog2,rlt,rlte,rmax,rmin,rmod,rmul,rneg,rpow,rround,rsin,rsinh,rsqrt,rsub,rtan,rtanh,rtrunc,set_config,sqrt,sub,version,wabs,wacos,wacosh,wadd,wasin,wasinh,watan,watanh,wcalc,wcbrt,wceil,wcompare,wcos,wcosh,wdiv,weq,wexp,wfloor,wgt,wgte,widiv,wln,wlog,wlog10,wlog2,wlt,wlte,wmax,wmin,wmod,wmul,wneg,wpow,wround,wsin,wsinh,wsqrt,wsub,wtan,wtanh,wtrunc};