forked from cyruzzo/AboveVTT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpg-dice-roller.bundle.min.js
10 lines (9 loc) · 173 KB
/
rpg-dice-roller.bundle.min.js
1
2
3
4
5
6
7
8
9
10
/**
* rpg-dice-roller - An advanced JS based dice roller that can roll various types of dice and modifiers, along with mathematical equations.
*
* @version 4.5.2
* @license MIT
* @author GreenImp <[email protected]> (http://greenimp.co.uk)
* @link https://github.com/GreenImp/rpg-dice-roller
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).rpgDiceRoller={})}(this,(function(t){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&u(t,e)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function f(t,e,n){return(f=c()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&u(o,n.prototype),o}).apply(null,arguments)}function p(t){var e="function"==typeof Map?new Map:void 0;return(p=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return f(t,arguments,s(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),u(r,t)})(t)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?l(t):e}function m(t){var e=c();return function(){var n,r=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return h(this,n)}}function y(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}function d(t,e,n){return(d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=y(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}function g(t,e,n,r){return(g="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,n,r){var o,a=y(t,e);if(a){if((o=Object.getOwnPropertyDescriptor(a,e)).set)return o.set.call(r,n),!0;if(!o.writable)return!1}if(o=Object.getOwnPropertyDescriptor(r,e)){if(!o.writable)return!1;o.value=n,Object.defineProperty(r,e,o)}else i(r,e,n);return!0})(t,e,n,r)}function v(t,e,n,r,o){if(!g(t,e,n,r||t)&&o)throw new Error("failed to set property");return n}function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}(t,e)||x(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t){return function(t){if(Array.isArray(t))return N(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||x(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){if(t){if("string"==typeof t)return N(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?N(t,e):void 0}}function N(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var E=function(t){a(r,t);var e=m(r);function r(t){var o;return n(this,r),o=e.call(this,'Operator "'.concat(t,'" is invalid')),TypeError.captureStackTrace&&TypeError.captureStackTrace(l(o),r),o.name="CompareOperatorError",o.operator=t,o}return r}(p(TypeError)),S=function(t){a(r,t);var e=m(r);function r(t){var o;return n(this,r),o=e.call(this,"Invalid data format: ".concat(t)),Error.captureStackTrace&&Error.captureStackTrace(l(o),r),o.name="ImportError",o.data=t,o}return r}(p(Error)),k=function(t){a(r,t);var e=m(r);function r(t){var o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return n(this,r),o=e.call(this,'Die "'.concat(t,'" must have more than 1 possible value to ').concat(i||"do this action")),Error.captureStackTrace&&Error.captureStackTrace(l(o),r),o.name="DieActionValueError",o.action=i,o.die=t,o}return r}(p(Error)),O=function(t){a(r,t);var e=m(r);function r(t){var o;return n(this,r),o=e.call(this,'Notation "'.concat(t,'" is invalid')),Error.captureStackTrace&&Error.captureStackTrace(l(o),r),o.name="NotationError",o.notation=t,o}return r}(p(Error)),A=function(t){a(r,t);var e=m(r);function r(){var t,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return n(this,r),t=e.call(this,"Missing argument".concat(o?' "'.concat(o,'"'):"")),Error.captureStackTrace&&Error.captureStackTrace(l(t),r),t.argumentName=o,t}return r}(p(Error)),T=Object.freeze({__proto__:null,CompareOperatorError:E,DataFormatError:S,DieActionValueError:k,NotationError:O,RequiredArgumentError:A});Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isNaN=Number.isNaN||function(t){return t!=t};var j=Object.freeze({__proto__:null});"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function P(t,e){return t(e={exports:{}},e.exports),e.exports}var C=function(t){return t&&t.constructor.prototype.isBigNumber||!1},M=P((function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}e.clone=function t(r){var o=n(r);if("number"===o||"string"===o||"boolean"===o||null==r)return r;if("function"==typeof r.clone)return r.clone();if(Array.isArray(r))return r.map((function(e){return t(e)}));if(r instanceof Date)return new Date(r.valueOf());if(C(r))return r;if(r instanceof RegExp)throw new TypeError("Cannot clone "+r);return e.map(r,t)},e.map=function(t,n){var r={};for(var o in t)e.hasOwnProperty(t,o)&&(r[o]=n(t[o]));return r},e.extend=function(t,n){for(var r in n)e.hasOwnProperty(n,r)&&(t[r]=n[r]);return t},e.deepExtend=function t(n,r){if(Array.isArray(r))throw new TypeError("Arrays are not supported by deepExtend");for(var o in r)if(e.hasOwnProperty(r,o))if(r[o]&&r[o].constructor===Object)void 0===n[o]&&(n[o]={}),n[o].constructor===Object?t(n[o],r[o]):n[o]=r[o];else{if(Array.isArray(r[o]))throw new TypeError("Arrays are not supported by deepExtend");n[o]=r[o]}return n},e.deepEqual=function(t,n){var r,o,i;if(Array.isArray(t)){if(!Array.isArray(n))return!1;if(t.length!==n.length)return!1;for(o=0,i=t.length;o<i;o++)if(!e.deepEqual(t[o],n[o]))return!1;return!0}if(t instanceof Object){if(Array.isArray(n)||!(n instanceof Object))return!1;for(r in t)if(!e.deepEqual(t[r],n[r]))return!1;for(r in n)if(!e.deepEqual(t[r],n[r]))return!1;return!0}return t===n},e.canDefineProperty=function(){try{if(Object.defineProperty)return Object.defineProperty({},"x",{get:function(){}}),!0}catch(t){}return!1},e.lazy=function(t,n,r){if(e.canDefineProperty()){var o,i=!0;Object.defineProperty(t,n,{get:function(){return i&&(o=r(),i=!1),o},set:function(t){o=t,i=!1},configurable:!0,enumerable:!0})}else t[n]=r()},e.traverse=function(t,e){var n=t;if(e)for(var r=e.split("."),o=0;o<r.length;o++){var i=r[o];i in n||(n[i]={}),n=n[i]}return n},e.hasOwnProperty=function(t,e){return t&&Object.hasOwnProperty.call(t,e)},e.isFactory=function(t){return t&&"function"==typeof t.factory}})),F=(M.clone,M.map,M.extend,M.deepExtend,M.deepEqual,M.canDefineProperty,M.lazy,M.traverse,M.isFactory,P((function(t,e){t.exports=function(){function t(){return!0}function e(){return!1}function n(){}return function r(){var o=[{name:"number",test:function(t){return"number"==typeof t}},{name:"string",test:function(t){return"string"==typeof t}},{name:"boolean",test:function(t){return"boolean"==typeof t}},{name:"Function",test:function(t){return"function"==typeof t}},{name:"Array",test:Array.isArray},{name:"Date",test:function(t){return t instanceof Date}},{name:"RegExp",test:function(t){return t instanceof RegExp}},{name:"Object",test:function(t){return"object"==typeof t&&t.constructor===Object}},{name:"null",test:function(t){return null===t}},{name:"undefined",test:function(t){return void 0===t}}],i={name:"any",test:t},a=[],s=[],u={types:o,conversions:s,ignore:a};function c(t){var e=q(u.types,(function(e){return e.name===t}));if(e)return e;if("any"===t)return i;var n=q(u.types,(function(e){return e.name.toLowerCase()===t.toLowerCase()}));throw new TypeError('Unknown type "'+t+'"'+(n?'. Did you mean "'+n.name+'"?':""))}function f(t){return t===i?999:u.types.indexOf(t)}function p(t){var e=q(u.types,(function(e){return e.test(t)}));if(e)return e.name;throw new TypeError("Value has unknown type. Value: "+t)}function l(t){return t.map((function(t){var e=t.types.map(b);return(t.restParam?"...":"")+e.join("|")})).join(",")}function h(t,e){var n=0===t.indexOf("..."),r=(n?t.length>3?t.slice(3):"any":t).split("|").map(M).filter(F).filter(C),o=function(t,e){var n={};return t.forEach((function(t){-1!==e.indexOf(t.from)||-1===e.indexOf(t.to)||n[t.from]||(n[t.from]=t)})),Object.keys(n).map((function(t){return n[t]}))}(e,r),i=r.map((function(t){var e=c(t);return{name:t,typeIndex:f(e),test:e.test,conversion:null,conversionIndex:-1}})),a=o.map((function(t){var n=c(t.from);return{name:t.from,typeIndex:f(n),test:n.test,conversion:t,conversionIndex:e.indexOf(t)}}));return{types:i.concat(a),restParam:n}}function m(t){var e=R(t);return!!e&&e.restParam}function y(t){return t.types.some((function(t){return null!=t.conversion}))}function d(e){if(e&&0!==e.types.length){if(1===e.types.length)return c(e.types[0].name).test;if(2===e.types.length){var n=c(e.types[0].name).test,r=c(e.types[1].name).test;return function(t){return n(t)||r(t)}}var o=e.types.map((function(t){return c(t.name).test}));return function(t){for(var e=0;e<o.length;e++)if(o[e](t))return!0;return!1}}return t}function g(t){var e,n,r,o;if(m(t)){var i=(e=(o=t,o.slice(0,o.length-1)).map(d)).length,a=d(R(t));return function(t){for(var n=0;n<e.length;n++)if(!e[n](t[n]))return!1;return function(t){for(var e=i;e<t.length;e++)if(!a(t[e]))return!1;return!0}(t)&&t.length>=i+1}}return 0===t.length?function(t){return 0===t.length}:1===t.length?(n=d(t[0]),function(t){return n(t[0])&&1===t.length}):2===t.length?(n=d(t[0]),r=d(t[1]),function(t){return n(t[0])&&r(t[1])&&2===t.length}):(e=t.map(d),function(t){for(var n=0;n<e.length;n++)if(!e[n](t[n]))return!1;return t.length===e.length})}function v(t,e){return e<t.params.length?t.params[e]:m(t.params)?R(t.params):null}function w(t,e,n){var r=v(t,e);return(r?n?r.types.filter(x):r.types:[]).map(b)}function b(t){return t.name}function x(t){return null===t.conversion||void 0===t.conversion}function N(t,e){var n=function(t){for(var e={},n=0;n<t.length;n++)e[t[n]]=!0;return Object.keys(e)}(B(t,(function(t){return w(t,e,!1)})));return-1!==n.indexOf("any")?["any"]:n}function E(t,e,n){var r,o,i,a=t||"unnamed",s=n;for(i=0;i<e.length;i++){var u=s.filter((function(t){var n=d(v(t,i));return(i<t.params.length||m(t.params))&&n(e[i])}));if(0===u.length){if((o=N(s,i)).length>0){var c=p(e[i]);return(r=new TypeError("Unexpected type of argument in function "+a+" (expected: "+o.join(" or ")+", actual: "+c+", index: "+i+")")).data={category:"wrongType",fn:a,index:i,actual:c,expected:o},r}}else s=u}var f=s.map((function(t){return m(t.params)?1/0:t.params.length}));if(e.length<Math.min.apply(null,f))return o=N(s,i),(r=new TypeError("Too few arguments in function "+a+" (expected: "+o.join(" or ")+", index: "+e.length+")")).data={category:"tooFewArgs",fn:a,index:e.length,expected:o},r;var l=Math.max.apply(null,f);return e.length>l?((r=new TypeError("Too many arguments in function "+a+" (expected: "+l+", actual: "+e.length+")")).data={category:"tooManyArgs",fn:a,index:e.length,expectedLength:l},r):((r=new TypeError('Arguments of type "'+e.join(", ")+'" do not match any of the defined signatures of function '+a+".")).data={category:"mismatch",actual:e.map(p)},r)}function S(t){for(var e=999,n=0;n<t.types.length;n++)x(t.types[n])&&(e=Math.min(e,t.types[n].typeIndex));return e}function k(t){for(var e=999,n=0;n<t.types.length;n++)x(t.types[n])||(e=Math.min(e,t.types[n].conversionIndex));return e}function O(t,e){var n;return 0!=(n=t.restParam-e.restParam)||0!=(n=y(t)-y(e))||0!=(n=S(t)-S(e))?n:k(t)-k(e)}function A(t,e){var n,r,o=Math.min(t.params.length,e.params.length);if(0!=(r=t.params.some(y)-e.params.some(y)))return r;for(n=0;n<o;n++)if(0!=(r=y(t.params[n])-y(e.params[n])))return r;for(n=0;n<o;n++)if(0!==(r=O(t.params[n],e.params[n])))return r;return t.params.length-e.params.length}function T(t){var e,n,r,o,i=[],a=[];switch(t.types.forEach((function(t){t.conversion&&(i.push(c(t.conversion.from).test),a.push(t.conversion.convert))})),a.length){case 0:return function(t){return t};case 1:return e=i[0],r=a[0],function(t){return e(t)?r(t):t};case 2:return e=i[0],n=i[1],r=a[0],o=a[1],function(t){return e(t)?r(t):n(t)?o(t):t};default:return function(t){for(var e=0;e<a.length;e++)if(i[e](t))return a[e](t);return t}}}function j(t,e){return function t(n,r,o){if(r<n.length){var i,a=n[r],s=e?a.types.filter(x):a.types;if(a.restParam){var u=s.filter(x);i=u.length<s.length?[u,s]:[s]}else i=s.map((function(t){return[t]}));return B(i,(function(e){return t(n,r+1,o.concat([e]))}))}return[o.map((function(t,e){return{types:t,restParam:e===n.length-1&&m(n)}}))]}(t,0,[])}function P(t,r){if(0===Object.keys(r).length)throw new SyntaxError("No signatures provided");var o=[];Object.keys(r).map((function(t){return function(t,e,n){var r=[];return""!==t.trim()&&(r=t.split(",").map(M).map((function(t,e,r){var o=h(t,n);if(o.restParam&&e!==r.length-1)throw new SyntaxError('Unexpected rest parameter "'+t+'": only allowed for the last parameter');return o}))),r.some(I)?null:{params:r,fn:e}}(t,r[t],u.conversions)})).filter(_).forEach((function(t){var e=q(o,(function(e){return function(t,e){for(var n=Math.max(t.params.length,e.params.length),r=0;r<n;r++)if(!L(w(t,r,!0),w(e,r,!0)))return!1;var o=t.params.length,i=e.params.length,a=m(t.params),s=m(e.params);return a?s?o===i:i>=o:s?o>=i:o===i}(e,t)}));if(e)throw new TypeError('Conflicting signatures "'+l(e.params)+'" and "'+l(t.params)+'".');o.push(t)}));var i=B(o,(function(t){return(t?j(t.params,!1):[]).map((function(e){return{params:e,fn:t.fn}}))})).filter(_);i.sort(A);var a=i[0]&&i[0].params.length<=2&&!m(i[0].params),s=i[1]&&i[1].params.length<=2&&!m(i[1].params),c=i[2]&&i[2].params.length<=2&&!m(i[2].params),f=i[3]&&i[3].params.length<=2&&!m(i[3].params),p=i[4]&&i[4].params.length<=2&&!m(i[4].params),v=i[5]&&i[5].params.length<=2&&!m(i[5].params),b=a&&s&&c&&f&&p&&v,x=i.map((function(t){return g(t.params)})),N=a?d(i[0].params[0]):e,S=s?d(i[1].params[0]):e,k=c?d(i[2].params[0]):e,O=f?d(i[3].params[0]):e,P=p?d(i[4].params[0]):e,C=v?d(i[5].params[0]):e,F=a?d(i[0].params[1]):e,R=s?d(i[1].params[1]):e,J=c?d(i[2].params[1]):e,W=f?d(i[3].params[1]):e,z=p?d(i[4].params[1]):e,H=v?d(i[5].params[1]):e,U=i.map((function(t){return function(t,e){var n=e;if(t.some(y)){var r=m(t),o=t.map(T);n=function(){for(var t=[],n=r?arguments.length-1:arguments.length,i=0;i<n;i++)t[i]=o[i](arguments[i]);return r&&(t[n]=arguments[n].map(o[n])),e.apply(null,t)}}var i=n;if(m(t)){var a=t.length-1;i=function(){return n.apply(null,D(arguments,0,a).concat([D(arguments,a)]))}}return i}(t.params,t.fn)})),V=a?U[0]:n,$=s?U[1]:n,G=c?U[2]:n,X=f?U[3]:n,Z=p?U[4]:n,K=v?U[5]:n,Q=a?i[0].params.length:-1,Y=s?i[1].params.length:-1,tt=c?i[2].params.length:-1,et=f?i[3].params.length:-1,nt=p?i[4].params.length:-1,rt=v?i[5].params.length:-1,ot=b?6:0,it=i.length,at=function(){for(var e=ot;e<it;e++)if(x[e](arguments))return U[e].apply(null,arguments);throw E(t,arguments,i)},st=function(t,e){return arguments.length===Q&&N(t)&&F(e)?V.apply(null,arguments):arguments.length===Y&&S(t)&&R(e)?$.apply(null,arguments):arguments.length===tt&&k(t)&&J(e)?G.apply(null,arguments):arguments.length===et&&O(t)&&W(e)?X.apply(null,arguments):arguments.length===nt&&P(t)&&z(e)?Z.apply(null,arguments):arguments.length===rt&&C(t)&&H(e)?K.apply(null,arguments):at.apply(null,arguments)};try{Object.defineProperty(st,"name",{value:t})}catch(t){}return st.signatures=function(t){var e={};return t.forEach((function(t){t.params.some(y)||j(t.params,!0).forEach((function(n){e[l(n)]=t.fn}))})),e}(i),st}function C(t){return-1===u.ignore.indexOf(t)}function M(t){return t.trim()}function F(t){return!!t}function _(t){return null!==t}function I(t){return 0===t.types.length}function R(t){return t[t.length-1]}function D(t,e,n){return Array.prototype.slice.call(t,e,n)}function J(t,e){return-1!==t.indexOf(e)}function L(t,e){for(var n=0;n<t.length;n++)if(J(e,t[n]))return!0;return!1}function q(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return t[n]}function B(t,e){return Array.prototype.concat.apply([],t.map(e))}function W(t){for(var e="",n=0;n<t.length;n++){var r=t[n];if(("object"==typeof r.signatures||"string"==typeof r.signature)&&""!==r.name)if(""===e)e=r.name;else if(e!==r.name){var o=new Error("Function names do not match (expected: "+e+", actual: "+r.name+")");throw o.data={actual:r.name,expected:e},o}}return e}function z(t){var e,n={};function r(t,r){if(n.hasOwnProperty(t)&&r!==n[t])throw(e=new Error('Signature "'+t+'" is defined twice')).data={signature:t},e}for(var o=0;o<t.length;o++){var i=t[o];if("object"==typeof i.signatures)for(var a in i.signatures)i.signatures.hasOwnProperty(a)&&(r(a,i.signatures[a]),n[a]=i.signatures[a]);else{if("string"!=typeof i.signature)throw(e=new TypeError("Function is no typed-function (index: "+o+")")).data={index:o},e;r(i.signature,i),n[i.signature]=i}}return n}return(u=P("typed",{"string, Object":P,Object:function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(t[n]);return P(W(e),t)},"...Function":function(t){return P(W(t),z(t))},"string, ...Function":function(t,e){return P(t,z(e))}})).create=r,u.types=o,u.conversions=s,u.ignore=a,u.convert=function(t,e){var n=p(t);if(e===n)return t;for(var r=0;r<u.conversions.length;r++){var o=u.conversions[r];if(o.from===n&&o.to===e)return o.convert(t)}throw new Error("Cannot convert from "+n+" to "+e)},u.find=function(t,e){if(!t.signatures)throw new TypeError("Function is no typed-function");var n;if("string"==typeof e){n=e.split(",");for(var r=0;r<n.length;r++)n[r]=n[r].trim()}else{if(!Array.isArray(e))throw new TypeError("String array or a comma separated string expected");n=e}var o=n.join(","),i=t.signatures[o];if(i)return i;throw new TypeError("Signature not found (signature: "+(t.name||"unnamed")+"("+n.join(", ")+"))")},u.addType=function(t,e){if(!t||"string"!=typeof t.name||"function"!=typeof t.test)throw new TypeError("Object with properties {name: string, test: function} expected");if(!1!==e)for(var n=0;n<u.types.length;n++)if("Object"===u.types[n].name)return void u.types.splice(n,0,t);u.types.push(t)},u.addConversion=function(t){if(!t||"string"!=typeof t.from||"string"!=typeof t.to||"function"!=typeof t.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");u.conversions.push(t)},u}()}()}))),_=P((function(t,e){function n(t){for(var e=[],n=0;n<t;n++)e.push(0);return e}e.isNumber=function(t){return"number"==typeof t},e.isInteger=function(t){return"boolean"==typeof t||!!isFinite(t)&&t===Math.round(t)},e.sign=Math.sign||function(t){return t>0?1:t<0?-1:0},e.format=function(t,n){if("function"==typeof n)return n(t);if(t===1/0)return"Infinity";if(t===-1/0)return"-Infinity";if(isNaN(t))return"NaN";var r,o="auto";switch(n&&(n.notation&&(o=n.notation),e.isNumber(n)?r=n:e.isNumber(n.precision)&&(r=n.precision)),o){case"fixed":return e.toFixed(t,r);case"exponential":return e.toExponential(t,r);case"engineering":return e.toEngineering(t,r);case"auto":if(n&&n.exponential&&(void 0!==n.exponential.lower||void 0!==n.exponential.upper)){var i=M.map(n,(function(t){return t}));return i.exponential=void 0,void 0!==n.exponential.lower&&(i.lowerExp=Math.round(Math.log(n.exponential.lower)/Math.LN10)),void 0!==n.exponential.upper&&(i.upperExp=Math.round(Math.log(n.exponential.upper)/Math.LN10)),console.warn("Deprecation warning: Formatting options exponential.lower and exponential.upper (minimum and maximum value) are replaced with exponential.lowerExp and exponential.upperExp (minimum and maximum exponent) since version 4.0.0. Replace "+JSON.stringify(n)+" with "+JSON.stringify(i)),e.toPrecision(t,r,i)}return e.toPrecision(t,r,n&&n).replace(/((\.\d*?)(0+))($|e)/,(function(){var t=arguments[2],e=arguments[4];return"."!==t?t+e:e}));default:throw new Error('Unknown notation "'+o+'". Choose "auto", "exponential", or "fixed".')}},e.splitNumber=function(t){var e=String(t).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw new SyntaxError("Invalid number "+t);var n=e[1],r=e[2],o=parseFloat(e[4]||"0"),i=r.indexOf(".");o+=-1!==i?i-1:r.length-1;var a=r.replace(".","").replace(/^0*/,(function(t){return o-=t.length,""})).replace(/0*$/,"").split("").map((function(t){return parseInt(t)}));return 0===a.length&&(a.push(0),o++),{sign:n,coefficients:a,exponent:o}},e.toEngineering=function(t,n){if(isNaN(t)||!isFinite(t))return String(t);var r=e.roundDigits(e.splitNumber(t),n),o=r.exponent,i=r.coefficients,a=o%3==0?o:o<0?o-3-o%3:o-o%3;if(e.isNumber(n))for(;n>i.length||o-a+1>i.length;)i.push(0);else for(var s=o>=0?o:Math.abs(a);i.length-1<s;)i.push(0);for(var u=Math.abs(o-a),c=1;u>0;)c++,u--;var f=i.slice(c).join(""),p=e.isNumber(n)&&f.length||f.match(/[1-9]/)?"."+f:"",l=i.slice(0,c).join("")+p+"e"+(o>=0?"+":"")+a.toString();return r.sign+l},e.toFixed=function(t,r){if(isNaN(t)||!isFinite(t))return String(t);var o=e.splitNumber(t),i="number"==typeof r?e.roundDigits(o,o.exponent+1+r):o,a=i.coefficients,s=i.exponent+1,u=s+(r||0);return a.length<u&&(a=a.concat(n(u-a.length))),s<0&&(a=n(1-s).concat(a),s=1),s<a.length&&a.splice(s,0,0===s?"0.":"."),i.sign+a.join("")},e.toExponential=function(t,r){if(isNaN(t)||!isFinite(t))return String(t);var o=e.splitNumber(t),i=r?e.roundDigits(o,r):o,a=i.coefficients,s=i.exponent;a.length<r&&(a=a.concat(n(r-a.length)));var u=a.shift();return i.sign+u+(a.length>0?"."+a.join(""):"")+"e"+(s>=0?"+":"")+s},e.toPrecision=function(t,r,o){if(isNaN(t)||!isFinite(t))return String(t);var i=o&&void 0!==o.lowerExp?o.lowerExp:-3,a=o&&void 0!==o.upperExp?o.upperExp:5,s=e.splitNumber(t);if(s.exponent<i||s.exponent>=a)return e.toExponential(t,r);var u=r?e.roundDigits(s,r):s,c=u.coefficients,f=u.exponent;c.length<r&&(c=c.concat(n(r-c.length))),c=c.concat(n(f-c.length+1+(c.length<r?r-c.length:0)));var p=f>0?f:0;return p<(c=n(-f).concat(c)).length-1&&c.splice(p+1,0,"."),u.sign+c.join("")},e.roundDigits=function(t,e){for(var n={sign:t.sign,coefficients:t.coefficients,exponent:t.exponent},r=n.coefficients;e<=0;)r.unshift(0),n.exponent++,e++;if(r.length>e&&r.splice(e,r.length-e)[0]>=5){var o=e-1;for(r[o]++;10===r[o];)r.pop(),0===o&&(r.unshift(0),n.exponent++,o++),r[--o]++}return n},e.digits=function(t){return t.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length},e.DBL_EPSILON=Number.EPSILON||2220446049250313e-31,e.nearlyEqual=function(t,n,r){if(null==r)return t===n;if(t===n)return!0;if(isNaN(t)||isNaN(n))return!1;if(isFinite(t)&&isFinite(n)){var o=Math.abs(t-n);return o<e.DBL_EPSILON||o<=Math.max(Math.abs(t),Math.abs(n))*r}return!1}})),I=(_.isNumber,_.isInteger,_.sign,_.format,_.splitNumber,_.toEngineering,_.toFixed,_.toExponential,_.toPrecision,_.roundDigits,_.digits,_.DBL_EPSILON,_.nearlyEqual,function(t){return t&&t.constructor.prototype.isMatrix||!1});function R(t){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var D=_.digits,J=function(){return J=F.create,F},L=function(t){t.isNumber=function(t){return"number"==typeof t},t.isComplex=function(e){return t.Complex&&e instanceof t.Complex||!1},t.isBigNumber=C,t.isFraction=function(e){return t.Fraction&&e instanceof t.Fraction||!1},t.isUnit=function(t){return t&&t.constructor.prototype.isUnit||!1},t.isString=function(t){return"string"==typeof t},t.isArray=Array.isArray,t.isMatrix=I,t.isDenseMatrix=function(t){return t&&t.isDenseMatrix&&t.constructor.prototype.isMatrix||!1},t.isSparseMatrix=function(t){return t&&t.isSparseMatrix&&t.constructor.prototype.isMatrix||!1},t.isRange=function(t){return t&&t.constructor.prototype.isRange||!1},t.isIndex=function(t){return t&&t.constructor.prototype.isIndex||!1},t.isBoolean=function(t){return"boolean"==typeof t},t.isResultSet=function(t){return t&&t.constructor.prototype.isResultSet||!1},t.isHelp=function(t){return t&&t.constructor.prototype.isHelp||!1},t.isFunction=function(t){return"function"==typeof t},t.isDate=function(t){return t instanceof Date},t.isRegExp=function(t){return t instanceof RegExp},t.isObject=function(e){return"object"===R(e)&&e.constructor===Object&&!t.isComplex(e)&&!t.isFraction(e)},t.isNull=function(t){return null===t},t.isUndefined=function(t){return void 0===t},t.isAccessorNode=function(t){return t&&t.isAccessorNode&&t.constructor.prototype.isNode||!1},t.isArrayNode=function(t){return t&&t.isArrayNode&&t.constructor.prototype.isNode||!1},t.isAssignmentNode=function(t){return t&&t.isAssignmentNode&&t.constructor.prototype.isNode||!1},t.isBlockNode=function(t){return t&&t.isBlockNode&&t.constructor.prototype.isNode||!1},t.isConditionalNode=function(t){return t&&t.isConditionalNode&&t.constructor.prototype.isNode||!1},t.isConstantNode=function(t){return t&&t.isConstantNode&&t.constructor.prototype.isNode||!1},t.isFunctionAssignmentNode=function(t){return t&&t.isFunctionAssignmentNode&&t.constructor.prototype.isNode||!1},t.isFunctionNode=function(t){return t&&t.isFunctionNode&&t.constructor.prototype.isNode||!1},t.isIndexNode=function(t){return t&&t.isIndexNode&&t.constructor.prototype.isNode||!1},t.isNode=function(t){return t&&t.isNode&&t.constructor.prototype.isNode||!1},t.isObjectNode=function(t){return t&&t.isObjectNode&&t.constructor.prototype.isNode||!1},t.isOperatorNode=function(t){return t&&t.isOperatorNode&&t.constructor.prototype.isNode||!1},t.isParenthesisNode=function(t){return t&&t.isParenthesisNode&&t.constructor.prototype.isNode||!1},t.isRangeNode=function(t){return t&&t.isRangeNode&&t.constructor.prototype.isNode||!1},t.isSymbolNode=function(t){return t&&t.isSymbolNode&&t.constructor.prototype.isNode||!1},t.isChain=function(t){return t&&t.constructor.prototype.isChain||!1};var e=J();return e.types=[{name:"number",test:t.isNumber},{name:"Complex",test:t.isComplex},{name:"BigNumber",test:t.isBigNumber},{name:"Fraction",test:t.isFraction},{name:"Unit",test:t.isUnit},{name:"string",test:t.isString},{name:"Array",test:t.isArray},{name:"Matrix",test:t.isMatrix},{name:"DenseMatrix",test:t.isDenseMatrix},{name:"SparseMatrix",test:t.isSparseMatrix},{name:"Range",test:t.isRange},{name:"Index",test:t.isIndex},{name:"boolean",test:t.isBoolean},{name:"ResultSet",test:t.isResultSet},{name:"Help",test:t.isHelp},{name:"function",test:t.isFunction},{name:"Date",test:t.isDate},{name:"RegExp",test:t.isRegExp},{name:"null",test:t.isNull},{name:"undefined",test:t.isUndefined},{name:"OperatorNode",test:t.isOperatorNode},{name:"ConstantNode",test:t.isConstantNode},{name:"SymbolNode",test:t.isSymbolNode},{name:"ParenthesisNode",test:t.isParenthesisNode},{name:"FunctionNode",test:t.isFunctionNode},{name:"FunctionAssignmentNode",test:t.isFunctionAssignmentNode},{name:"ArrayNode",test:t.isArrayNode},{name:"AssignmentNode",test:t.isAssignmentNode},{name:"BlockNode",test:t.isBlockNode},{name:"ConditionalNode",test:t.isConditionalNode},{name:"IndexNode",test:t.isIndexNode},{name:"RangeNode",test:t.isRangeNode},{name:"Node",test:t.isNode},{name:"Object",test:t.isObject}],e.conversions=[{from:"number",to:"BigNumber",convert:function(e){if(D(e)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t.BigNumber(e)}},{from:"number",to:"Complex",convert:function(e){return new t.Complex(e,0)}},{from:"number",to:"string",convert:function(t){return t+""}},{from:"BigNumber",to:"Complex",convert:function(e){return new t.Complex(e.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(t){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return new t.Complex(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){if(new t.Fraction(e).valueOf()!==e)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return new t.Fraction(e)}},{from:"string",to:"number",convert:function(t){var e=Number(t);if(isNaN(e))throw new Error('Cannot convert "'+t+'" to a number');return e}},{from:"string",to:"BigNumber",convert:function(e){try{return new t.BigNumber(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){try{return new t.Fraction(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){try{return new t.Complex(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(t){return+t}},{from:"boolean",to:"BigNumber",convert:function(e){return new t.BigNumber(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return new t.Fraction(+e)}},{from:"boolean",to:"string",convert:function(t){return+t}},{from:"Array",to:"Matrix",convert:function(e){return new t.DenseMatrix(e)}},{from:"Matrix",to:"Array",convert:function(t){return t.valueOf()}}],e};function q(){}q.prototype={on:function(t,e,n){var r=this.e||(this.e={});return(r[t]||(r[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var r=this;function o(){r.off(t,o),e.apply(n,arguments)}return o._=e,this.on(t,o,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),r=0,o=n.length;r<o;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;i<a;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}};var B=q,W=q;B.TinyEmitter=W;var z=function(t){var e=new B;return t.on=e.on.bind(e),t.off=e.off.bind(e),t.once=e.once.bind(e),t.emit=e.emit.bind(e),t};function H(t,e,n,r){if(!(this instanceof H))throw new SyntaxError("Constructor must be called with the new operator");this.fn=t,this.count=e,this.min=n,this.max=r,this.message="Wrong number of arguments in function "+t+" ("+e+" provided, "+n+(null!=r?"-"+r:"")+" expected)",this.stack=(new Error).stack}H.prototype=new Error,H.prototype.constructor=Error,H.prototype.name="ArgumentsError",H.prototype.isArgumentsError=!0;var U=H;function V(t){return(V="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var $=M.lazy,G=M.isFactory,X=M.traverse;var Z={math:!0,name:"import",factory:function(t,e,n,r,o){function i(t,e,n){if(n.wrap&&"function"==typeof e&&(e=function(t){var e=function(){for(var e=[],n=0,r=arguments.length;n<r;n++){var i=arguments[n];e[n]=i&&i.valueOf()}return t.apply(o,e)};t.transform&&(e.transform=t.transform);return e}(e)),f(o[t])&&f(e))return e=n.override?r(t,e.signatures):r(o[t],e),o[t]=e,a(t,e),void o.emit("import",t,(function(){return e}));if(void 0===o[t]||n.override)return o[t]=e,a(t,e),void o.emit("import",t,(function(){return e}));if(!n.silent)throw new Error('Cannot import "'+t+'": already exists')}function a(t,e){e&&"function"==typeof e.transform?(o.expression.transform[t]=e.transform,p(t)&&(o.expression.mathWithTransform[t]=e.transform)):(delete o.expression.transform[t],p(t)&&(o.expression.mathWithTransform[t]=e))}function s(t){delete o.expression.transform[t],p(t)?o.expression.mathWithTransform[t]=o[t]:delete o.expression.mathWithTransform[t]}function u(t,e){if("string"==typeof t.name){var i=t.name,a=i in o.expression.transform,u=t.path?X(o,t.path):o,c=u.hasOwnProperty(i)?u[i]:void 0,p=function(){var o=n(t);if(o&&"function"==typeof o.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(f(c)&&f(o))return e.override||(o=r(c,o)),o;if(void 0===c||e.override)return o;if(!e.silent)throw new Error('Cannot import "'+i+'": already exists')};!1!==t.lazy?($(u,i,p),a?s(i):("expression.transform"===t.path||l(t))&&$(o.expression.mathWithTransform,i,p)):(u[i]=p(),a?s(i):("expression.transform"===t.path||l(t))&&(o.expression.mathWithTransform[i]=p())),o.emit("import",i,p,t.path)}else n(t)}function c(e){return"function"==typeof e||"number"==typeof e||"string"==typeof e||"boolean"==typeof e||null===e||e&&t.isUnit(e)||e&&t.isComplex(e)||e&&t.isBigNumber(e)||e&&t.isFraction(e)||e&&t.isMatrix(e)||e&&Array.isArray(e)}function f(t){return"function"==typeof t&&"object"===V(t.signatures)}function p(t){return!h.hasOwnProperty(t)}function l(t){return void 0===t.path&&!h.hasOwnProperty(t.name)}var h={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function t(e,n){var r=arguments.length;if(1!==r&&2!==r)throw new U("import",r,1,2);if(n||(n={}),G(e))u(e,n);else if(Array.isArray(e))e.forEach((function(e){t(e,n)}));else if("object"===V(e)){for(var o in e)if(e.hasOwnProperty(o)){var a=e[o];c(a)?i(o,a,n):G(e)?u(e,n):t(a,n)}}else if(!n.silent)throw new TypeError("Factory, Object, or Array expected")}},lazy:!0};function K(t,e,n){if(void 0!==t[e]&&!function(t,e){return-1!==t.indexOf(e)}(n,t[e])){var r=function(t,e){return t.map((function(t){return t.toLowerCase()})).indexOf(e.toLowerCase())}(n,t[e]);-1!==r?(console.warn('Warning: Wrong casing for configuration option "'+e+'", should be "'+n[r]+'" instead of "'+t[e]+'".'),t[e]=n[r]):console.warn('Warning: Unknown value "'+t[e]+'" for configuration option "'+e+'". Available options: '+n.map(JSON.stringify).join(", ")+".")}}var Q,Y={name:"config",math:!0,factory:function(t,e,n,r,o){var i=["Matrix","Array"],a=["number","BigNumber","Fraction"];function s(t){if(t){var n=M.map(e,M.clone);K(t,"matrix",i),K(t,"number",a),M.deepExtend(e,t);var r=M.map(e,M.clone),s=M.map(t,M.clone);return o.emit("config",r,n,s),r}return M.map(e,M.clone)}return s.MATRIX=i,s.NUMBER=a,s}};(Q=j)&&Q.default;var tt=M.isFactory,et={create:function(t){if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var e=[],n=[],r=z({});r.type={},r.expression={transform:{},mathWithTransform:{}},r.typed=L(r.type);var o={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function i(t){if(!tt(t))throw new Error("Factory object with properties `type`, `name`, and `factory` expected");var a,s=e.indexOf(t);return-1===s?(a=!0===t.math?t.factory(r.type,o,i,r.typed,r):t.factory(r.type,o,i,r.typed),e.push(t),n.push(a)):a=n[s],a}return r.import=i(Z),r.config=i(Y),r.expression.mathWithTransform.config=r.config,t&&r.config(t),r}},nt=function t(e,n,r){return e&&"function"==typeof e.map?e.map((function(e){return t(e,n)})):n(e)};function rt(t){return(rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var ot={name:"typeof",factory:function(t,e,n,r){var o=r("_typeof",{any:function(e){var n=rt(e);return"object"===n?null===e?"null":Array.isArray(e)?"Array":e instanceof Date?"Date":e instanceof RegExp?"RegExp":t.isBigNumber(e)?"BigNumber":t.isComplex(e)?"Complex":t.isFraction(e)?"Fraction":t.isMatrix(e)?"Matrix":t.isUnit(e)?"Unit":t.isIndex(e)?"Index":t.isRange(e)?"Range":t.isResultSet(e)?"ResultSet":t.isNode(e)?e.type:t.isChain(e)?"Chain":t.isHelp(e)?"Help":"Object":"function"===n?"Function":n}});return o.toTex=void 0,o}};var it={name:"number",factory:function(t,e,n,r){var o=r("number",{"":function(){return 0},number:function(t){return t},string:function(t){if("NaN"===t)return NaN;var e=Number(t);if(isNaN(e))throw new SyntaxError('String "'+t+'" is no valid number');return e},BigNumber:function(t){return t.toNumber()},Fraction:function(t){return t.valueOf()},Unit:function(t){throw new Error("Second argument with valueless unit expected")},null:function(t){return 0},"Unit, string | Unit":function(t,e){return t.toNumber(e)},"Array | Matrix":function(t){return nt(t,o)}});return o.toTex={0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},o}};var at={name:"bignumber",factory:function(t,e,n,r){var o=r("bignumber",{"":function(){return new t.BigNumber(0)},number:function(e){return new t.BigNumber(e+"")},string:function(e){return new t.BigNumber(e)},BigNumber:function(t){return t},Fraction:function(e){return new t.BigNumber(e.n).div(e.d).times(e.s)},null:function(e){return new t.BigNumber(0)},"Array | Matrix":function(t){return nt(t,o)}});return o.toTex={0:"0",1:"\\left(${args[0]}\\right)"},o}};var st={name:"fraction",factory:function(t,e,n,r){var o=r("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new t.Fraction(e)},string:function(e){return new t.Fraction(e)},"number, number":function(e,n){return new t.Fraction(e,n)},null:function(e){return new t.Fraction(0)},BigNumber:function(e){return new t.Fraction(e.toString())},Fraction:function(t){return t},Object:function(e){return new t.Fraction(e)},"Array | Matrix":function(t){return nt(t,o)}});return o}};var ut={path:"type",name:"_numeric",factory:function(t,e,n,r){var o=n(ot),i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:n(it),BigNumber:n(at),Fraction:n(st)},s=function(t,e){var n=o(t);if(!(n in i))throw new TypeError("Cannot convert "+t+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(e in a))throw new TypeError("Cannot convert "+t+' to type "'+e+'"; valid output types are '+Object.keys(a).join(", "));return e===n?t:a[e](t)};return s.toTex=function(t,e){return t.args[0].toTex()},s}};function ct(t){return(ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var ft=M.hasOwnProperty;function pt(t,e){return!(!t||"object"!==ct(t))&&(!!ft(mt,e)||!(e in Object.prototype)&&!(e in Function.prototype))}function lt(t,e){return!(!t||"function"!=typeof t[e])&&(!(ft(t,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(t))&&(!!ft(yt,e)||!(e in Object.prototype)&&!(e in Function.prototype)))}function ht(t){return"object"===ct(t)&&t&&t.constructor===Object}var mt={length:!0,name:!0},yt={toString:!0,valueOf:!0,toLocaleString:!0},dt={getSafeProperty:function(t,e){if(ht(t)&&pt(t,e))return t[e];if("function"==typeof t[e]&<(t,e))throw new Error('Cannot access method "'+e+'" as a property');throw new Error('No access to property "'+e+'"')},setSafeProperty:function(t,e,n){if(ht(t)&&pt(t,e))return t[e]=n,n;throw new Error('No access to property "'+e+'"')},isSafeProperty:pt,validateSafeMethod:function(t,e){if(!lt(t,e))throw new Error('No access to method "'+e+'"')},isSafeMethod:lt,isPlainObject:ht},gt={end:!0};function vt(t){return(vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var wt=M.deepEqual,bt=M.hasOwnProperty;var xt={name:"Node",path:"expression.node",math:!0,factory:function(t,e,n,r,o){function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator")}return i.prototype.eval=function(t){return this.compile().eval(t)},i.prototype.type="Node",i.prototype.isNode=!0,i.prototype.comment="",i.prototype.compile=function(){var t=this._compile(o.expression.mathWithTransform,{}),e={};return{eval:function(n){var r=n||{};return function(t){for(var e in t)if(bt(t,e)&&e in gt)throw new Error('Scope contains an illegal symbol, "'+e+'" is a reserved keyword')}(r),t(r,e,null)}}},i.prototype._compile=function(t,e){throw new Error("Method _compile should be implemented by type "+this.type)},i.prototype.forEach=function(t){throw new Error("Cannot run forEach on a Node interface")},i.prototype.map=function(t){throw new Error("Cannot run map on a Node interface")},i.prototype._ifNode=function(e){if(!t.isNode(e))throw new TypeError("Callback function must return a Node");return e},i.prototype.traverse=function(t){t(this,null,null),function t(e,n){e.forEach((function(e,r,o){n(e,r,o),t(e,n)}))}(this,t)},i.prototype.transform=function(t){return function t(e,n){return e.map((function(e,r,o){return t(n(e,r,o),n)}))}(t(this,null,null),t)},i.prototype.filter=function(t){var e=[];return this.traverse((function(n,r,o){t(n,r,o)&&e.push(n)})),e},i.prototype.find=function(){throw new Error("Function Node.find is deprecated. Use Node.filter instead.")},i.prototype.match=function(){throw new Error("Function Node.match is deprecated. See functions Node.filter, Node.transform, Node.traverse.")},i.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},i.prototype.cloneDeep=function(){return this.map((function(t){return t.cloneDeep()}))},i.prototype.equals=function(t){return!!t&&wt(this,t)},i.prototype.toString=function(t){var e;if(t&&"object"===vt(t))switch(vt(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this._toString(t)},i.prototype.toJSON=function(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)},i.prototype.toHTML=function(t){var e;if(t&&"object"===vt(t))switch(vt(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this.toHTML(t)},i.prototype._toString=function(){throw new Error("_toString not implemented for "+this.type)},i.prototype.toTex=function(t){var e;if(t&&"object"===vt(t))switch(vt(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this._toTex(t)},i.prototype._toTex=function(t){throw new Error("_toTex not implemented for "+this.type)},i.prototype.getIdentifier=function(){return this.type},i.prototype.getContent=function(){return this},i}};function Nt(t,e,n){if(!(this instanceof Nt))throw new SyntaxError("Constructor must be called with the new operator");this.index=t,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=n),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=(new Error).stack}Nt.prototype=new RangeError,Nt.prototype.constructor=RangeError,Nt.prototype.name="IndexError",Nt.prototype.isIndexError=!0;var Et=Nt,St=function(t){return t&&t.isIndexError?new Et(t.index+1,t.min+1,void 0!==t.max?t.max+1:void 0):t},kt=P((function(t,e){e.format=function(t,n){if("function"==typeof n)return n(t);if(!t.isFinite())return t.isNaN()?"NaN":t.gt(0)?"Infinity":"-Infinity";var r,o="auto";switch(void 0!==n&&(n.notation&&(o=n.notation),"number"==typeof n?r=n:n.precision&&(r=n.precision)),o){case"fixed":return e.toFixed(t,r);case"exponential":return e.toExponential(t,r);case"engineering":return e.toEngineering(t,r);case"auto":if(n&&n.exponential&&(void 0!==n.exponential.lower||void 0!==n.exponential.upper)){var i=M.map(n,(function(t){return t}));return i.exponential=void 0,void 0!==n.exponential.lower&&(i.lowerExp=Math.round(Math.log(n.exponential.lower)/Math.LN10)),void 0!==n.exponential.upper&&(i.upperExp=Math.round(Math.log(n.exponential.upper)/Math.LN10)),console.warn("Deprecation warning: Formatting options exponential.lower and exponential.upper (minimum and maximum value) are replaced with exponential.lowerExp and exponential.upperExp (minimum and maximum exponent) since version 4.0.0. Replace "+JSON.stringify(n)+" with "+JSON.stringify(i)),e.format(t,i)}var a=n&&void 0!==n.lowerExp?n.lowerExp:-3,s=n&&void 0!==n.upperExp?n.upperExp:5;if(t.isZero())return"0";var u=t.e;return(u>=a&&u<s?t.toSignificantDigits(r).toFixed():e.toExponential(t,r)).replace(/((\.\d*?)(0+))($|e)/,(function(){var t=arguments[2],e=arguments[4];return"."!==t?t+e:e}));default:throw new Error('Unknown notation "'+o+'". Choose "auto", "exponential", or "fixed".')}},e.toEngineering=function(t,e){var n=t.e,r=n%3==0?n:n<0?n-3-n%3:n-n%3,o=t.mul(Math.pow(10,-r)),i=o.toPrecision(e);return-1!==i.indexOf("e")&&(i=o.toString()),i+"e"+(n>=0?"+":"")+r.toString()},e.toExponential=function(t,e){return void 0!==e?t.toExponential(e-1):t.toExponential()},e.toFixed=function(t,e){return t.toFixed(e)}})),Ot=(kt.format,kt.toEngineering,kt.toExponential,kt.toFixed,P((function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r=_.format,o=kt.format;e.isString=function(t){return"string"==typeof t},e.endsWith=function(t,e){var n=t.length-e.length,r=t.length;return t.substring(n,r)===e},e.format=function(t,i){if("number"==typeof t)return r(t,i);if(C(t))return o(t,i);if(function(t){return t&&"object"===n(t)&&"number"==typeof t.s&&"number"==typeof t.n&&"number"==typeof t.d||!1}(t))return i&&"decimal"===i.fraction?t.toString():t.s*t.n+"/"+t.d;if(Array.isArray(t))return function t(n,r){if(Array.isArray(n)){for(var o="[",i=n.length,a=0;a<i;a++)0!==a&&(o+=", "),o+=t(n[a],r);return o+="]"}return e.format(n,r)}(t,i);if(e.isString(t))return'"'+t+'"';if("function"==typeof t)return t.syntax?String(t.syntax):"function";if(t&&"object"===n(t)){if("function"==typeof t.format)return t.format(i);if(t&&t.toString()!=={}.toString())return t.toString();var a=[];for(var s in t)t.hasOwnProperty(s)&&a.push('"'+s+'": '+e.format(t[s],i));return"{"+a.join(", ")+"}"}return String(t)},e.stringify=function(t){for(var e=String(t),n="",r=0;r<e.length;){var o=e.charAt(r);"\\"===o?(n+=o,r++,""!==(o=e.charAt(r))&&-1!=='"\\/bfnrtu'.indexOf(o)||(n+="\\"),n+=o):n+='"'===o?'\\"':o,r++}return'"'+n+'"'},e.escape=function(t){var e=String(t);return e=e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}})));Ot.isString,Ot.endsWith,Ot.format,Ot.stringify,Ot.escape;function At(t,e,n){if(!(this instanceof At))throw new SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=e,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=(new Error).stack}At.prototype=new RangeError,At.prototype.constructor=RangeError,At.prototype.name="DimensionError",At.prototype.isDimensionError=!0;var Tt,jt=At,Pt=P((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.size=s,e.validate=function(t,e){if(0===e.length){if(Array.isArray(t))throw new o.default(t.length,0)}else!function t(e,n,r){var i,a=e.length;if(a!==n[r])throw new o.default(a,n[r]);if(r<n.length-1){var s=r+1;for(i=0;i<a;i++){var u=e[i];if(!Array.isArray(u))throw new o.default(n.length-1,n.length,"<");t(e[i],n,s)}}else for(i=0;i<a;i++)if(Array.isArray(e[i]))throw new o.default(n.length+1,n.length,">")}(t,e,0)},e.validateIndex=function(t,e){if(!n.default.isNumber(t)||!n.default.isInteger(t))throw new TypeError("Index must be an integer (value: "+t+")");if(t<0||"number"==typeof e&&t>=e)throw new i.default(t,e)},e.resize=function(t,e,o){if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Array expected");if(0===e.length)throw new Error("Resizing to scalar is not supported");e.forEach((function(t){if(!n.default.isNumber(t)||!n.default.isInteger(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+r.default.format(e)+")")}));var i=void 0!==o?o:0;return function t(e,n,r,o){var i,a,s=e.length,u=n[r],c=Math.min(s,u);if(e.length=u,r<n.length-1){var f=r+1;for(i=0;i<c;i++)a=e[i],Array.isArray(a)||(a=[a],e[i]=a),t(a,n,f,o);for(i=c;i<u;i++)a=[],e[i]=a,t(a,n,f,o)}else{for(i=0;i<c;i++)for(;Array.isArray(e[i]);)e[i]=e[i][0];for(i=c;i<u;i++)e[i]=o}}(t,e,0,i),t},e.reshape=function(t,e){var n,r=u(t);function i(t){return t.reduce((function(t,e){return t*e}))}if(!Array.isArray(t)||!Array.isArray(e))throw new TypeError("Array expected");if(0===e.length)throw new o.default(0,i(s(t)),"!=");for(var a=1,c=0;c<e.length;c++)a*=e[c];if(r.length!==a)throw new o.default(i(e),i(s(t)),"!=");try{n=function(t,e){for(var n,r=t,o=e.length-1;o>0;o--){var i=e[o];n=[];for(var a=r.length/i,s=0;s<a;s++)n.push(r.slice(s*i,(s+1)*i));r=n}return r}(r,e)}catch(n){if(n instanceof o.default)throw new o.default(i(e),i(s(t)),"!=");throw n}return n},e.squeeze=function(t,e){var n=e||s(t);for(;Array.isArray(t)&&1===t.length;)t=t[0],n.shift();var r=n.length;for(;1===n[r-1];)r--;r<n.length&&(t=function t(e,n,r){var o,i;if(r<n){var a=r+1;for(o=0,i=e.length;o<i;o++)e[o]=t(e[o],n,a)}else for(;Array.isArray(e);)e=e[0];return e}(t,r,0),n.length=r);return t},e.unsqueeze=function(t,e,n,r){var o=r||s(t);if(n)for(var i=0;i<n;i++)t=[t],o.unshift(1);t=function t(e,n,r){var o,i;if(Array.isArray(e)){var a=r+1;for(o=0,i=e.length;o<i;o++)e[o]=t(e[o],n,a)}else for(var s=r;s<n;s++)e=[e];return e}(t,e,0);for(;o.length<e;)o.push(1);return t},e.flatten=u,e.map=function(t,e){return Array.prototype.map.call(t,e)},e.forEach=function(t,e){Array.prototype.forEach.call(t,e)},e.filter=function(t,e){if(1!==s(t).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,e)},e.filterRegExp=function(t,e){if(1!==s(t).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(t,(function(t){return e.test(t)}))},e.join=function(t,e){return Array.prototype.join.call(t,e)},e.identify=function(t){if(!Array.isArray(t))throw new TypeError("Array input expected");if(0===t.length)return t;var e=[],n=0;e[0]={value:t[0],identifier:0};for(var r=1;r<t.length;r++)t[r]===t[r-1]?n++:n=0,e.push({value:t[r],identifier:n});return e},e.generalize=function(t){if(!Array.isArray(t))throw new TypeError("Array input expected");if(0===t.length)return t;for(var e=[],n=0;n<t.length;n++)e.push(t[n].value);return e};var n=a(_),r=a(Ot),o=a(jt),i=a(Et);function a(t){return t&&t.__esModule?t:{default:t}}function s(t){for(var e=[];Array.isArray(t);)e.push(t.length),t=t[0];return e}function u(t){if(!Array.isArray(t))return t;var e=[];return t.forEach((function t(n){Array.isArray(n)?n.forEach(t):e.push(n)})),e}}));(Tt=Pt)&&Tt.__esModule&&Object.prototype.hasOwnProperty.call(Tt,"default")&&Tt.default;Pt.size,Pt.validate,Pt.validateIndex,Pt.resize,Pt.reshape,Pt.squeeze,Pt.unsqueeze,Pt.flatten,Pt.map,Pt.forEach,Pt.filter,Pt.filterRegExp,Pt.join,Pt.identify,Pt.generalize;var Ct={name:"matrix",factory:function(t,e,n,r){var o=r("matrix",{"":function(){return i([])},string:function(t){return i([],t)},"string, string":function(t,e){return i([],t,e)},Array:function(t){return i(t)},Matrix:function(t){return i(t,t.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});return o.toTex={0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},o;function i(e,n,r){return new(t.Matrix.storage(n||"default"))(e,r)}}},Mt=M.clone,Ft=Pt.validateIndex,_t=dt.getSafeProperty,It=dt.setSafeProperty;function Rt(t,e){if(1!==e.size().length)throw new jt(e.size(),1);var n=e.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");return _t(t,n)}function Dt(t,e,n){if(1!==e.size().length)throw new jt(e.size(),1);var r=e.dimension(0);if("string"!=typeof r)throw new TypeError("String expected as index to retrieve an object property");var o=Mt(t);return It(o,r,n),o}var Jt={name:"subset",factory:function(t,e,n,r){var o=n(Ct),i=r("subset",{"Array, Index":function(t,e){var n=o(t).subset(e);return e.isScalar()?n:n.valueOf()},"Matrix, Index":function(t,e){return t.subset(e)},"Object, Index":Rt,"string, Index":function(e,n){if(!t.isIndex(n))throw new TypeError("Index expected");if(1!==n.size().length)throw new jt(n.size().length,1);var r=e.length;Ft(n.min()[0],r),Ft(n.max()[0],r);var o=n.dimension(0),i="";return o.forEach((function(t){i+=e.charAt(t)})),i},"Array, Index, any":function(t,e,n){return o(Mt(t)).subset(e,n,void 0).valueOf()},"Array, Index, any, any":function(t,e,n,r){return o(Mt(t)).subset(e,n,r).valueOf()},"Matrix, Index, any":function(t,e,n){return t.clone().subset(e,n)},"Matrix, Index, any, any":function(t,e,n,r){return t.clone().subset(e,n,r)},"string, Index, string":a,"string, Index, string, string":a,"Object, Index, any":Dt});return i.toTex=void 0,i;function a(t,e,n,r){if(!e||!0!==e.isIndex)throw new TypeError("Index expected");if(1!==e.size().length)throw new jt(e.size().length,1);if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";var o=e.dimension(0);if(o.size()[0]!==n.length)throw new jt(o.size()[0],n.length);var i=t.length;Ft(e.min()[0]),Ft(e.max()[0]);for(var a=[],s=0;s<i;s++)a[s]=t.charAt(s);if(o.forEach((function(t,e){a[t]=n.charAt(e[0])})),a.length>i)for(var u=i-1,c=a.length;u<c;u++)a[u]||(a[u]=r);return a.join("")}}};function Lt(t){return(Lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var qt=St,Bt=dt.getSafeProperty;var Wt={factory:function(t,e,n,r){var o=n(Jt);return function(t,e){try{if(Array.isArray(t))return o(t,e);if(t&&"function"==typeof t.subset)return t.subset(e);if("string"==typeof t)return o(t,e);if("object"===Lt(t)){if(!e.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return Bt(t,e.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(t){throw qt(t)}}}},zt=dt.getSafeProperty;var Ht={name:"AccessorNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt),i=n(Wt);function a(e,n){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(!t.isNode(e))throw new TypeError('Node expected for parameter "object"');if(!t.isIndexNode(n))throw new TypeError('IndexNode expected for parameter "index"');this.object=e||null,this.index=n,Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function s(e){return!(t.isAccessorNode(e)||t.isArrayNode(e)||t.isConstantNode(e)||t.isFunctionNode(e)||t.isObjectNode(e)||t.isParenthesisNode(e)||t.isSymbolNode(e))}return a.prototype=new o,a.prototype.type="AccessorNode",a.prototype.isAccessorNode=!0,a.prototype._compile=function(t,e){var n=this.object._compile(t,e),r=this.index._compile(t,e);if(this.index.isObjectProperty()){var o=this.index.getObjectProperty();return function(t,e,r){return zt(n(t,e,r),o)}}return function(t,e,o){var a=n(t,e,o),s=r(t,e,a);return i(a,s)}},a.prototype.forEach=function(t){t(this.object,"object",this),t(this.index,"index",this)},a.prototype.map=function(t){return new a(this._ifNode(t(this.object,"object",this)),this._ifNode(t(this.index,"index",this)))},a.prototype.clone=function(){return new a(this.object,this.index)},a.prototype._toString=function(t){var e=this.object.toString(t);return s(this.object)&&(e="("+e+")"),e+this.index.toString(t)},a.prototype.toHTML=function(t){var e=this.object.toHTML(t);return s(this.object)&&(e='<span class="math-parenthesis math-round-parenthesis">(</span>'+e+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e+this.index.toHTML(t)},a.prototype._toTex=function(t){var e=this.object.toTex(t);return s(this.object)&&(e="\\left(' + object + '\\right)"),e+this.index.toTex(t)},a.prototype.toJSON=function(){return{mathjs:"AccessorNode",object:this.object,index:this.index}},a.fromJSON=function(t){return new a(t.object,t.index)},a}},Ut=Pt.map;var Vt={name:"ArrayNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt);function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(this.items=e||[],!Array.isArray(this.items)||!this.items.every(t.isNode))throw new TypeError("Array containing Nodes expected");var n=function(){throw new Error("Property `ArrayNode.nodes` is deprecated, use `ArrayNode.items` instead")};Object.defineProperty(this,"nodes",{get:n,set:n})}return i.prototype=new o,i.prototype.type="ArrayNode",i.prototype.isArrayNode=!0,i.prototype._compile=function(t,e){var n=Ut(this.items,(function(n){return n._compile(t,e)}));if("Array"!==t.config().matrix){var r=t.matrix;return function(t,e,o){return r(Ut(n,(function(n){return n(t,e,o)})))}}return function(t,e,r){return Ut(n,(function(n){return n(t,e,r)}))}},i.prototype.forEach=function(t){for(var e=0;e<this.items.length;e++){t(this.items[e],"items["+e+"]",this)}},i.prototype.map=function(t){for(var e=[],n=0;n<this.items.length;n++)e[n]=this._ifNode(t(this.items[n],"items["+n+"]",this));return new i(e)},i.prototype.clone=function(){return new i(this.items.slice(0))},i.prototype._toString=function(t){return"["+this.items.map((function(e){return e.toString(t)})).join(", ")+"]"},i.prototype.toJSON=function(){return{mathjs:"ArrayNode",items:this.items}},i.fromJSON=function(t){return new i(t.items)},i.prototype.toHTML=function(t){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map((function(e){return e.toHTML(t)})).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},i.prototype._toTex=function(t){var e="\\begin{bmatrix}";return this.items.forEach((function(n){n.items?e+=n.items.map((function(e){return e.toTex(t)})).join("&"):e+=n.toTex(t),e+="\\\\"})),e+="\\end{bmatrix}"},i}};function $t(t){return($t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Gt=St,Xt=dt.setSafeProperty;var Zt={factory:function(t,e,n,r){var o=n(Jt),i=n(Ct);return function(t,e,n){try{if(Array.isArray(t))return i(t).subset(e,n).valueOf();if(t&&"function"==typeof t.subset)return t.subset(e,n);if("string"==typeof t)return o(t,e,n);if("object"===$t(t)){if(!e.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return Xt(t,e.getObjectProperty(),n),t}throw new TypeError("Cannot apply index: unsupported type of object")}catch(t){throw Gt(t)}}}},Kt=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{associativity:"left",associativeWith:[]}},{"OperatorNode:and":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{associativity:"left",associativeWith:[]},"OperatorNode:unequal":{associativity:"left",associativeWith:[]},"OperatorNode:smaller":{associativity:"left",associativeWith:[]},"OperatorNode:larger":{associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{associativity:"left",associativeWith:[]}},{"OperatorNode:to":{associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{associativity:"left",associativeWith:[]},"OperatorNode:mod":{associativity:"left",associativeWith:[]}},{"OperatorNode:unaryPlus":{associativity:"right"},"OperatorNode:unaryMinus":{associativity:"right"},"OperatorNode:bitNot":{associativity:"right"},"OperatorNode:not":{associativity:"right"}},{"OperatorNode:pow":{associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{associativity:"left"}},{"OperatorNode:transpose":{associativity:"left"}}];function Qt(t,e){var n=t;"keep"!==e&&(n=t.getContent());for(var r=n.getIdentifier(),o=0;o<Kt.length;o++)if(r in Kt[o])return o;return null}var Yt={properties:Kt,getPrecedence:Qt,getAssociativity:function(t,e){var n=t;"keep"!==e&&(n=t.getContent());var r=n.getIdentifier(),o=Qt(n,e);if(null===o)return null;var i=Kt[o][r];if(i.hasOwnProperty("associativity")){if("left"===i.associativity)return"left";if("right"===i.associativity)return"right";throw Error("'"+r+"' has the invalid associativity '"+i.associativity+"'.")}return null},isAssociativeWith:function(t,e,n){var r="keep"!==n?t.getContent():t,o="keep"!==n?t.getContent():e,i=r.getIdentifier(),a=o.getIdentifier(),s=Qt(r,n);if(null===s)return null;var u=Kt[s][i];if(u.hasOwnProperty("associativeWith")&&u.associativeWith instanceof Array){for(var c=0;c<u.associativeWith.length;c++)if(u.associativeWith[c]===a)return!0;return!1}return null}},te=dt.getSafeProperty,ee=dt.setSafeProperty;var ne={name:"AssignmentNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt),i=n(Zt),a=n(Wt),s=Yt;function u(e,n,r){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");if(this.object=e,this.index=r?n:null,this.value=r||n,!t.isSymbolNode(e)&&!t.isAccessorNode(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(t.isSymbolNode(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!t.isIndexNode(this.index))throw new TypeError('IndexNode expected as "index"');if(!t.isNode(this.value))throw new TypeError('Node expected as "value"');Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function c(t,e){e||(e="keep");var n=s.getPrecedence(t,e),r=s.getPrecedence(t.value,e);return"all"===e||null!==r&&r<=n}return u.prototype=new o,u.prototype.type="AssignmentNode",u.prototype.isAssignmentNode=!0,u.prototype._compile=function(e,n){var r=this.object._compile(e,n),o=this.index?this.index._compile(e,n):null,s=this.value._compile(e,n),u=this.object.name;if(this.index){if(this.index.isObjectProperty()){var c=this.index.getObjectProperty();return function(t,e,n){var o=r(t,e,n),i=s(t,e,n);return ee(o,c,i)}}if(t.isSymbolNode(this.object))return function(t,e,n){var a=r(t,e,n),c=s(t,e,n),f=o(t,e,a);return ee(t,u,i(a,f,c)),c};var f=this.object.object._compile(e,n);if(this.object.index.isObjectProperty()){var p=this.object.index.getObjectProperty();return function(t,e,n){var r=f(t,e,n),a=te(r,p),u=o(t,e,a),c=s(t,e,n);return ee(r,p,i(a,u,c)),c}}var l=this.object.index._compile(e,n);return function(t,e,n){var r=f(t,e,n),u=l(t,e,r),c=a(r,u),p=o(t,e,c),h=s(t,e,n);return i(r,u,i(c,p,h)),h}}if(!t.isSymbolNode(this.object))throw new TypeError("SymbolNode expected as object");return function(t,e,n){return ee(t,u,s(t,e,n))}},u.prototype.forEach=function(t){t(this.object,"object",this),this.index&&t(this.index,"index",this),t(this.value,"value",this)},u.prototype.map=function(t){return new u(this._ifNode(t(this.object,"object",this)),this.index?this._ifNode(t(this.index,"index",this)):null,this._ifNode(t(this.value,"value",this)))},u.prototype.clone=function(){return new u(this.object,this.index,this.value)},u.prototype._toString=function(t){var e=this.object.toString(t),n=this.index?this.index.toString(t):"",r=this.value.toString(t);return c(this,t&&t.parenthesis)&&(r="("+r+")"),e+n+" = "+r},u.prototype.toJSON=function(){return{mathjs:"AssignmentNode",object:this.object,index:this.index,value:this.value}},u.fromJSON=function(t){return new u(t.object,t.index,t.value)},u.prototype.toHTML=function(t){var e=this.object.toHTML(t),n=this.index?this.index.toHTML(t):"",r=this.value.toHTML(t);return c(this,t&&t.parenthesis)&&(r='<span class="math-paranthesis math-round-parenthesis">(</span>'+r+'<span class="math-paranthesis math-round-parenthesis">)</span>'),e+n+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+r},u.prototype._toTex=function(t){var e=this.object.toTex(t),n=this.index?this.index.toTex(t):"",r=this.value.toTex(t);return c(this,t&&t.parenthesis)&&(r="\\left(".concat(r,"\\right)")),e+n+":="+r},u}};var re={name:"ResultSet",path:"type",factory:function(t,e,n,r){function o(t){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}return o.prototype.type="ResultSet",o.prototype.isResultSet=!0,o.prototype.valueOf=function(){return this.entries},o.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},o.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},o.fromJSON=function(t){return new o(t.entries)},o}},oe=Pt.forEach,ie=Pt.map;var ae={name:"BlockNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt),i=n(re);function a(e){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map((function(e){var n=e&&e.node,r=!e||void 0===e.visible||e.visible;if(!t.isNode(n))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof r)throw new TypeError('Property "visible" must be a boolean');return{node:n,visible:r}}))}return a.prototype=new o,a.prototype.type="BlockNode",a.prototype.isBlockNode=!0,a.prototype._compile=function(t,e){var n=ie(this.blocks,(function(n){return{eval:n.node._compile(t,e),visible:n.visible}}));return function(t,e,r){var o=[];return oe(n,(function(n){var i=n.eval(t,e,r);n.visible&&o.push(i)})),new i(o)}},a.prototype.forEach=function(t){for(var e=0;e<this.blocks.length;e++)t(this.blocks[e].node,"blocks["+e+"].node",this)},a.prototype.map=function(t){for(var e=[],n=0;n<this.blocks.length;n++){var r=this.blocks[n],o=this._ifNode(t(r.node,"blocks["+n+"].node",this));e[n]={node:o,visible:r.visible}}return new a(e)},a.prototype.clone=function(){return new a(this.blocks.map((function(t){return{node:t.node,visible:t.visible}})))},a.prototype._toString=function(t){return this.blocks.map((function(e){return e.node.toString(t)+(e.visible?"":";")})).join("\n")},a.prototype.toJSON=function(){return{mathjs:"BlockNode",blocks:this.blocks}},a.fromJSON=function(t){return new a(t.blocks)},a.prototype.toHTML=function(t){return this.blocks.map((function(e){return e.node.toHTML(t)+(e.visible?"":'<span class="math-separator">;</span>')})).join('<span class="math-separator"><br /></span>')},a.prototype._toTex=function(t){return this.blocks.map((function(e){return e.node.toTex(t)+(e.visible?"":";")})).join("\\;\\;\n")},a}};var se={name:"ConditionalNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt),i=n(ot);function a(e,n,r){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(!t.isNode(e))throw new TypeError("Parameter condition must be a Node");if(!t.isNode(n))throw new TypeError("Parameter trueExpr must be a Node");if(!t.isNode(r))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=n,this.falseExpr=r}return a.prototype=new o,a.prototype.type="ConditionalNode",a.prototype.isConditionalNode=!0,a.prototype._compile=function(e,n){var r=this.condition._compile(e,n),o=this.trueExpr._compile(e,n),a=this.falseExpr._compile(e,n);return function(e,n,s){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(t.isBigNumber(e))return!e.isZero();if(t.isComplex(e))return!(!e.re&&!e.im);if(t.isUnit(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+i(e)+'"')}(r(e,n,s))?o(e,n,s):a(e,n,s)}},a.prototype.forEach=function(t){t(this.condition,"condition",this),t(this.trueExpr,"trueExpr",this),t(this.falseExpr,"falseExpr",this)},a.prototype.map=function(t){return new a(this._ifNode(t(this.condition,"condition",this)),this._ifNode(t(this.trueExpr,"trueExpr",this)),this._ifNode(t(this.falseExpr,"falseExpr",this)))},a.prototype.clone=function(){return new a(this.condition,this.trueExpr,this.falseExpr)},a.prototype._toString=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=Yt.getPrecedence(this,e),r=this.condition.toString(t),o=Yt.getPrecedence(this.condition,e);("all"===e||"OperatorNode"===this.condition.type||null!==o&&o<=n)&&(r="("+r+")");var i=this.trueExpr.toString(t),a=Yt.getPrecedence(this.trueExpr,e);("all"===e||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(i="("+i+")");var s=this.falseExpr.toString(t),u=Yt.getPrecedence(this.falseExpr,e);return("all"===e||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s="("+s+")"),r+" ? "+i+" : "+s},a.prototype.toJSON=function(){return{mathjs:"ConditionalNode",condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}},a.fromJSON=function(t){return new a(t.condition,t.trueExpr,t.falseExpr)},a.prototype.toHTML=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=Yt.getPrecedence(this,e),r=this.condition.toHTML(t),o=Yt.getPrecedence(this.condition,e);("all"===e||"OperatorNode"===this.condition.type||null!==o&&o<=n)&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>');var i=this.trueExpr.toHTML(t),a=Yt.getPrecedence(this.trueExpr,e);("all"===e||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>');var s=this.falseExpr.toHTML(t),u=Yt.getPrecedence(this.falseExpr,e);return("all"===e||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+'<span class="math-operator math-conditional-operator">?</span>'+i+'<span class="math-operator math-conditional-operator">:</span>'+s},a.prototype._toTex=function(t){return"\\begin{cases} {"+this.trueExpr.toTex(t)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(t)+"}\\\\{"+this.falseExpr.toTex(t)+"}, &\\quad{\\text{otherwise}}\\end{cases}"},a}},ue=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ce={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},fe={"–":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},pe=function(t,e){return ue({},t,e)},le=P((function(t,e){e.symbols={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},e.operators={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},e.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var n={deg:"^\\circ"};e.escape=function(t){return function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.preserveFormatting,r=void 0!==n&&n,o=e.escapeMapFn,i=void 0===o?pe:o,a=String(t),s="",u=i(ue({},ce),r?ue({},fe):{}),c=Object.keys(u),f=function(){var t=!1;c.forEach((function(e,n){t||a.length>=e.length&&a.slice(0,e.length)===e&&(s+=u[c[n]],a=a.slice(e.length,a.length),t=!0)})),t||(s+=a.slice(0,1),a=a.slice(1,a.length))};a;)f();return s}(t,{preserveFormatting:!0})},e.toSymbol=function(t,r){return(r=void 0!==r&&r)?n.hasOwnProperty(t)?n[t]:"\\mathrm{"+e.escape(t)+"}":e.symbols.hasOwnProperty(t)?e.symbols[t]:e.escape(t)}})),he=(le.symbols,le.operators,le.defaultTemplate,le.escape,le.toSymbol,Ot.format),me=le.escape;var ye={name:"ConstantNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt),i=n(ot);function a(t){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(2===arguments.length)throw new SyntaxError("new ConstantNode(valueStr, valueType) is not supported anymore since math v4.0.0. Use new ConstantNode(value) instead, where value is a non-stringified value.");this.value=t}return a.prototype=new o,a.prototype.type="ConstantNode",a.prototype.isConstantNode=!0,a.prototype._compile=function(t,e){var n=this.value;return function(){return n}},a.prototype.forEach=function(t){},a.prototype.map=function(t){return this.clone()},a.prototype.clone=function(){return new a(this.value)},a.prototype._toString=function(t){return he(this.value,t)},a.prototype.toHTML=function(t){var e=this._toString(t);switch(i(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+e+"</span>";case"string":return'<span class="math-string">'+e+"</span>";case"boolean":return'<span class="math-boolean">'+e+"</span>";case"null":return'<span class="math-null-symbol">'+e+"</span>";case"undefined":return'<span class="math-undefined">'+e+"</span>";default:return'<span class="math-symbol">'+e+"</span>"}},a.prototype.toJSON=function(){return{mathjs:"ConstantNode",value:this.value}},a.fromJSON=function(t){return new a(t.value)},a.prototype._toTex=function(t){var e=this._toString(t);switch(i(this.value)){case"string":return"\\mathtt{"+me(e)+"}";case"number":case"BigNumber":var n=e.toLowerCase().indexOf("e");return-1!==n?e.substring(0,n)+"\\cdot10^{"+e.substring(n+1)+"}":e;case"Fraction":return this.value.toLatex();default:return e}},a}},de=Ot.escape,ge=Pt.forEach,ve=Pt.join,we=dt.setSafeProperty;var be={name:"FunctionAssignmentNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt);function i(e,n,r){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(n))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!t.isNode(r))throw new TypeError('Node expected for parameter "expr"');if(e in gt)throw new Error('Illegal function name, "'+e+'" is a reserved keyword');this.name=e,this.params=n.map((function(t){return t&&t.name||t})),this.types=n.map((function(t){return t&&t.type||"any"})),this.expr=r}function a(t,e){var n=Yt.getPrecedence(t,e),r=Yt.getPrecedence(t.expr,e);return"all"===e||null!==r&&r<=n}return i.prototype=new o,i.prototype.type="FunctionAssignmentNode",i.prototype.isFunctionAssignmentNode=!0,i.prototype._compile=function(t,e){var n=Object.create(e);ge(this.params,(function(t){n[t]=!0}));var o=this.expr._compile(t,n),i=this.name,a=this.params,s=ve(this.types,","),u=i+"("+ve(this.params,", ")+")";return function(t,e,n){var c={};c[s]=function(){for(var r=Object.create(e),i=0;i<a.length;i++)r[a[i]]=arguments[i];return o(t,r,n)};var f=r(i,c);return f.syntax=u,we(t,i,f),f}},i.prototype.forEach=function(t){t(this.expr,"expr",this)},i.prototype.map=function(t){var e=this._ifNode(t(this.expr,"expr",this));return new i(this.name,this.params.slice(0),e)},i.prototype.clone=function(){return new i(this.name,this.params.slice(0),this.expr)},i.prototype._toString=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=this.expr.toString(t);return a(this,e)&&(n="("+n+")"),this.name+"("+this.params.join(", ")+") = "+n},i.prototype.toJSON=function(){var t=this.types;return{mathjs:"FunctionAssignmentNode",name:this.name,params:this.params.map((function(e,n){return{name:e,type:t[n]}})),expr:this.expr}},i.fromJSON=function(t){return new i(t.name,t.params,t.expr)},i.prototype.toHTML=function(t){for(var e=t&&t.parenthesis?t.parenthesis:"keep",n=[],r=0;r<this.params.length;r++)n.push('<span class="math-symbol math-parameter">'+de(this.params[r])+"</span>");var o=this.expr.toHTML(t);return a(this,e)&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+de(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+n.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+o},i.prototype._toTex=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=this.expr.toTex(t);return a(this,e)&&(n="\\left(".concat(n,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(le.toSymbol).join(",")+"\\right):="+n},i}};var xe={name:"Range",path:"type",factory:function(t,e,n,r){function o(e,n,r){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");var i=null!=e,a=null!=n,s=null!=r;if(i)if(t.isBigNumber(e))e=e.toNumber();else if("number"!=typeof e)throw new TypeError("Parameter start must be a number");if(a)if(t.isBigNumber(n))n=n.toNumber();else if("number"!=typeof n)throw new TypeError("Parameter end must be a number");if(s)if(t.isBigNumber(r))r=r.toNumber();else if("number"!=typeof r)throw new TypeError("Parameter step must be a number");this.start=i?parseFloat(e):0,this.end=a?parseFloat(n):0,this.step=s?parseFloat(r):1}return o.prototype.type="Range",o.prototype.isRange=!0,o.parse=function(t){if("string"!=typeof t)return null;var e=t.split(":").map((function(t){return parseFloat(t)}));if(e.some((function(t){return isNaN(t)})))return null;switch(e.length){case 2:return new o(e[0],e[1]);case 3:return new o(e[0],e[2],e[1]);default:return null}},o.prototype.clone=function(){return new o(this.start,this.end,this.step)},o.prototype.size=function(){var t=0,e=this.start,n=this.step,r=this.end-e;return _.sign(n)===_.sign(r)?t=Math.ceil(r/n):0===r&&(t=0),isNaN(t)&&(t=0),[t]},o.prototype.min=function(){var t=this.size()[0];return t>0?this.step>0?this.start:this.start+(t-1)*this.step:void 0},o.prototype.max=function(){var t=this.size()[0];return t>0?this.step>0?this.start+(t-1)*this.step:this.start:void 0},o.prototype.forEach=function(t){var e=this.start,n=this.step,r=this.end,o=0;if(n>0)for(;e<r;)t(e,[o],this),e+=n,o++;else if(n<0)for(;e>r;)t(e,[o],this),e+=n,o++},o.prototype.map=function(t){var e=[];return this.forEach((function(n,r,o){e[r[0]]=t(n,r,o)})),e},o.prototype.toArray=function(){var t=[];return this.forEach((function(e,n){t[n[0]]=e})),t},o.prototype.valueOf=function(){return this.toArray()},o.prototype.format=function(t){var e=_.format(this.start,t);return 1!==this.step&&(e+=":"+_.format(this.step,t)),e+=":"+_.format(this.end,t)},o.prototype.toString=function(){return this.format()},o.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},o.fromJSON=function(t){return new o(t.start,t.end,t.step)},o}},Ne=Pt.map,Ee=Ot.escape;var Se={name:"IndexNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt),i=n(xe),a=Array.isArray;function s(e,n){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if(this.dimensions=e,this.dotNotation=n||!1,!a(e)||!e.every(t.isNode))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties");var r=function(){throw new Error("Property `IndexNode.object` is deprecated, use `IndexNode.fn` instead")};Object.defineProperty(this,"object",{get:r,set:r})}function u(e,n,r){return new i(t.isBigNumber(e)?e.toNumber():e,t.isBigNumber(n)?n.toNumber():n,t.isBigNumber(r)?r.toNumber():r)}return s.prototype=new o,s.prototype.type="IndexNode",s.prototype.isIndexNode=!0,s.prototype._compile=function(e,n){var r=Ne(this.dimensions,(function(r,o){if(t.isRangeNode(r)){if(r.needsEnd()){var i=Object.create(n);i.end=!0;var a=r.start._compile(e,i),s=r.end._compile(e,i),c=r.step?r.step._compile(e,i):function(){return 1};return function(t,n,r){var i=e.size(r).valueOf(),f=Object.create(n);return f.end=i[o],u(a(t,f,r),s(t,f,r),c(t,f,r))}}var f=r.start._compile(e,n),p=r.end._compile(e,n),l=r.step?r.step._compile(e,n):function(){return 1};return function(t,e,n){return u(f(t,e,n),p(t,e,n),l(t,e,n))}}if(t.isSymbolNode(r)&&"end"===r.name){var h=Object.create(n);h.end=!0;var m=r._compile(e,h);return function(t,n,r){var i=e.size(r).valueOf(),a=Object.create(n);return a.end=i[o],m(t,a,r)}}var y=r._compile(e,n);return function(t,e,n){return y(t,e,n)}}));return function(t,n,o){var i=Ne(r,(function(e){return e(t,n,o)}));return e.index.apply(e,i)}},s.prototype.forEach=function(t){for(var e=0;e<this.dimensions.length;e++)t(this.dimensions[e],"dimensions["+e+"]",this)},s.prototype.map=function(t){for(var e=[],n=0;n<this.dimensions.length;n++)e[n]=this._ifNode(t(this.dimensions[n],"dimensions["+n+"]",this));return new s(e)},s.prototype.clone=function(){return new s(this.dimensions.slice(0))},s.prototype.isObjectProperty=function(){return 1===this.dimensions.length&&t.isConstantNode(this.dimensions[0])&&"string"==typeof this.dimensions[0].value},s.prototype.getObjectProperty=function(){return this.isObjectProperty()?this.dimensions[0].value:null},s.prototype._toString=function(t){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"},s.prototype.toJSON=function(){return{mathjs:"IndexNode",dimensions:this.dimensions,dotNotation:this.dotNotation}},s.fromJSON=function(t){return new s(t.dimensions,t.dotNotation)},s.prototype.toHTML=function(t){for(var e=[],n=0;n<this.dimensions.length;n++)e[n]=this.dimensions[n].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Ee(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+e.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},s.prototype._toTex=function(t){var e=this.dimensions.map((function(e){return e.toTex(t)}));return this.dotNotation?"."+this.getObjectProperty():"_{"+e.join(",")+"}"},s}};function ke(t){return(ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var Oe=Ot.stringify,Ae=Ot.escape,Te=dt.isSafeProperty,je=M.hasOwnProperty;var Pe={name:"ObjectNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt);function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(this.properties=e||{},e&&("object"!==ke(e)||!Object.keys(e).every((function(n){return t.isNode(e[n])}))))throw new TypeError("Object containing Nodes expected")}return i.prototype=new o,i.prototype.type="ObjectNode",i.prototype.isObjectNode=!0,i.prototype._compile=function(t,e){var n={};for(var r in this.properties)if(je(this.properties,r)){var o=Oe(r),i=JSON.parse(o);if(!Te(this.properties,i))throw new Error('No access to property "'+i+'"');n[i]=this.properties[r]._compile(t,e)}return function(t,e,r){var o={};for(var i in n)je(n,i)&&(o[i]=n[i](t,e,r));return o}},i.prototype.forEach=function(t){for(var e in this.properties)this.properties.hasOwnProperty(e)&&t(this.properties[e],"properties["+Oe(e)+"]",this)},i.prototype.map=function(t){var e={};for(var n in this.properties)this.properties.hasOwnProperty(n)&&(e[n]=this._ifNode(t(this.properties[n],"properties["+Oe(n)+"]",this)));return new i(e)},i.prototype.clone=function(){var t={};for(var e in this.properties)this.properties.hasOwnProperty(e)&&(t[e]=this.properties[e]);return new i(t)},i.prototype._toString=function(t){var e=[];for(var n in this.properties)this.properties.hasOwnProperty(n)&&e.push(Oe(n)+": "+this.properties[n].toString(t));return"{"+e.join(", ")+"}"},i.prototype.toJSON=function(){return{mathjs:"ObjectNode",properties:this.properties}},i.fromJSON=function(t){return new i(t.properties)},i.prototype.toHTML=function(t){var e=[];for(var n in this.properties)this.properties.hasOwnProperty(n)&&e.push('<span class="math-symbol math-property">'+Ae(n)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[n].toHTML(t));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+e.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'},i.prototype._toTex=function(t){var e=[];for(var n in this.properties)this.properties.hasOwnProperty(n)&&e.push("\\mathbf{"+n+":} & "+this.properties[n].toTex(t)+"\\\\");return"\\left\\{\\begin{array}{ll}".concat(e.join("\n"),"\\end{array}\\right\\}")},i}},Ce=Pt.map,Me=Ot.escape,Fe=dt.isSafeMethod,_e=dt.getSafeProperty;var Ie={name:"OperatorNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt);function i(e,n,r,o){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof e)throw new TypeError('string expected for parameter "op"');if("string"!=typeof n)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(r)||!r.every(t.isNode))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===o,this.op=e,this.fn=n,this.args=r||[]}function a(t,e,n,r,o){var i,a=Yt.getPrecedence(t,e),s=Yt.getAssociativity(t,e);if("all"===e||r.length>2&&"OperatorNode:add"!==t.getIdentifier()&&"OperatorNode:multiply"!==t.getIdentifier())return r.map((function(t){switch(t.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}}));switch(r.length){case 0:i=[];break;case 1:var u=Yt.getPrecedence(r[0],e);if(o&&null!==u){var c,f;if("keep"===e?(c=r[0].getIdentifier(),f=t.getIdentifier()):(c=r[0].getContent().getIdentifier(),f=t.getContent().getIdentifier()),!1===Yt.properties[a][f].latexLeftParens){i=[!1];break}if(!1===Yt.properties[u][c].latexParens){i=[!1];break}}if(null===u){i=[!1];break}if(u<=a){i=[!0];break}i=[!1];break;case 2:var p,l,h=Yt.getPrecedence(r[0],e),m=Yt.isAssociativeWith(t,r[0],e);p=null!==h&&(h===a&&"right"===s&&!m||h<a);var y,d,g,v=Yt.getPrecedence(r[1],e),w=Yt.isAssociativeWith(t,r[1],e);if(l=null!==v&&(v===a&&"left"===s&&!w||v<a),o)"keep"===e?(y=t.getIdentifier(),d=t.args[0].getIdentifier(),g=t.args[1].getIdentifier()):(y=t.getContent().getIdentifier(),d=t.args[0].getContent().getIdentifier(),g=t.args[1].getContent().getIdentifier()),null!==h&&(!1===Yt.properties[a][y].latexLeftParens&&(p=!1),!1===Yt.properties[h][d].latexParens&&(p=!1)),null!==v&&(!1===Yt.properties[a][y].latexRightParens&&(l=!1),!1===Yt.properties[v][g].latexParens&&(l=!1));i=[p,l];break;default:"OperatorNode:add"!==t.getIdentifier()&&"OperatorNode:multiply"!==t.getIdentifier()||(i=r.map((function(n){var r=Yt.getPrecedence(n,e),o=Yt.isAssociativeWith(t,n,e),i=Yt.getAssociativity(n,e);return null!==r&&(a===r&&s===i&&!o||r<a)})))}return r.length>=2&&"OperatorNode:multiply"===t.getIdentifier()&&t.implicit&&"auto"===e&&"hide"===n&&(i=r.map((function(t,e){var n="ParenthesisNode"===t.getIdentifier();return!(!i[e]&&!n)}))),i}return i.prototype=new o,i.prototype.type="OperatorNode",i.prototype.isOperatorNode=!0,i.prototype._compile=function(t,e){if("string"!=typeof this.fn||!Fe(t,this.fn))throw t[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var n=_e(t,this.fn),r=Ce(this.args,(function(n){return n._compile(t,e)}));if(1===r.length){var o=r[0];return function(t,e,r){return n(o(t,e,r))}}if(2===r.length){var i=r[0],a=r[1];return function(t,e,r){return n(i(t,e,r),a(t,e,r))}}return function(t,e,o){return n.apply(null,Ce(r,(function(n){return n(t,e,o)})))}},i.prototype.forEach=function(t){for(var e=0;e<this.args.length;e++)t(this.args[e],"args["+e+"]",this)},i.prototype.map=function(t){for(var e=[],n=0;n<this.args.length;n++)e[n]=this._ifNode(t(this.args[n],"args["+n+"]",this));return new i(this.op,this.fn,e,this.implicit)},i.prototype.clone=function(){return new i(this.op,this.fn,this.args.slice(0),this.implicit)},i.prototype.isUnary=function(){return 1===this.args.length},i.prototype.isBinary=function(){return 2===this.args.length},i.prototype._toString=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=t&&t.implicit?t.implicit:"hide",r=this.args,o=a(this,e,n,r,!1);if(1===r.length){var i=Yt.getAssociativity(this,e),s=r[0].toString(t);o[0]&&(s="("+s+")");var u=/[a-zA-Z]+/.test(this.op);return"right"===i?this.op+(u?" ":"")+s:"left"===i?s+(u?" ":"")+this.op:s+this.op}if(2===r.length){var c=r[0].toString(t),f=r[1].toString(t);return o[0]&&(c="("+c+")"),o[1]&&(f="("+f+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?c+" "+f:c+" "+this.op+" "+f}if(r.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var p=r.map((function(e,n){return e=e.toString(t),o[n]&&(e="("+e+")"),e}));return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?p.join(" "):p.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"},i.prototype.toJSON=function(){return{mathjs:"OperatorNode",op:this.op,fn:this.fn,args:this.args,implicit:this.implicit}},i.fromJSON=function(t){return new i(t.op,t.fn,t.args,t.implicit)},i.prototype.toHTML=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=t&&t.implicit?t.implicit:"hide",r=this.args,o=a(this,e,n,r,!1);if(1===r.length){var i=Yt.getAssociativity(this,e),s=r[0].toHTML(t);return o[0]&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===i?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Me(this.op)+"</span>"+s:s+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Me(this.op)+"</span>"}if(2===r.length){var u=r[0].toHTML(t),c=r[1].toHTML(t);return o[0]&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),o[1]&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?u+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+c:u+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Me(this.op)+"</span>"+c}var f=r.map((function(e,n){return e=e.toHTML(t),o[n]&&(e='<span class="math-parenthesis math-round-parenthesis">(</span>'+e+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e}));return r.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?f.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):f.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Me(this.op)+"</span>"):'<span class="math-function">'+Me(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+f.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'},i.prototype._toTex=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",n=t&&t.implicit?t.implicit:"hide",r=this.args,o=a(this,e,n,r,!0),i=le.operators[this.fn];if(i=void 0===i?this.op:i,1===r.length){var s=Yt.getAssociativity(this,e),u=r[0].toTex(t);return o[0]&&(u="\\left(".concat(u,"\\right)")),"right"===s?i+u:u+i}if(2===r.length){var c=r[0],f=c.toTex(t);o[0]&&(f="\\left(".concat(f,"\\right)"));var p,l=r[1].toTex(t);switch(o[1]&&(l="\\left(".concat(l,"\\right)")),p="keep"===e?c.getIdentifier():c.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return i+"{"+f+"}{"+l+"}";case"OperatorNode:pow":switch(f="{"+f+"}",l="{"+l+"}",p){case"ConditionalNode":case"OperatorNode:divide":f="\\left(".concat(f,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===n)return f+"~"+l}return f+i+l}if(r.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var h=r.map((function(e,n){return e=e.toTex(t),o[n]&&(e="\\left(".concat(e,"\\right)")),e}));return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit?h.join("~"):h.join(i)}return"\\mathrm{"+this.fn+"}\\left("+r.map((function(e){return e.toTex(t)})).join(",")+"\\right)"},i.prototype.getIdentifier=function(){return this.type+":"+this.fn},i}};var Re={name:"ParenthesisNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt);function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!t.isNode(e))throw new TypeError('Node expected for parameter "content"');this.content=e}return i.prototype=new o,i.prototype.type="ParenthesisNode",i.prototype.isParenthesisNode=!0,i.prototype._compile=function(t,e){return this.content._compile(t,e)},i.prototype.getContent=function(){return this.content.getContent()},i.prototype.forEach=function(t){t(this.content,"content",this)},i.prototype.map=function(t){return new i(t(this.content,"content",this))},i.prototype.clone=function(){return new i(this.content)},i.prototype._toString=function(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?"("+this.content.toString(t)+")":this.content.toString(t)},i.prototype.toJSON=function(){return{mathjs:"ParenthesisNode",content:this.content}},i.fromJSON=function(t){return new i(t.content)},i.prototype.toHTML=function(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(t)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(t)},i.prototype._toTex=function(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?"\\left(".concat(this.content.toTex(t),"\\right)"):this.content.toTex(t)},i}},De=Ot.escape,Je=M.hasOwnProperty,Le=dt.getSafeProperty;var qe={name:"SymbolNode",path:"expression.node",math:!0,factory:function(t,e,n,r,o){var i=n(xt);function a(e){return!!t.Unit&&t.Unit.isValuelessUnit(e)}function s(t){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof t)throw new TypeError('String expected for parameter "name"');this.name=t}return s.prototype=new i,s.prototype.type="SymbolNode",s.prototype.isSymbolNode=!0,s.prototype._compile=function(e,n){var r=this.name;if(Je(n,r))return function(t,e,n){return e[r]};if(r in e)return function(t,n,o){return Le(r in t?t:e,r)};var o=a(r);return function(e,n,i){return r in e?Le(e,r):o?new t.Unit(null,r):function(t){throw new Error("Undefined symbol "+t)}(r)}},s.prototype.forEach=function(t){},s.prototype.map=function(t){return this.clone()},s.prototype.clone=function(){return new s(this.name)},s.prototype._toString=function(t){return this.name},s.prototype.toHTML=function(t){var e=De(this.name);return"true"===e||"false"===e?'<span class="math-symbol math-boolean">'+e+"</span>":"i"===e?'<span class="math-symbol math-imaginary-symbol">'+e+"</span>":"Infinity"===e?'<span class="math-symbol math-infinity-symbol">'+e+"</span>":"NaN"===e?'<span class="math-symbol math-nan-symbol">'+e+"</span>":"null"===e?'<span class="math-symbol math-null-symbol">'+e+"</span>":"undefined"===e?'<span class="math-symbol math-undefined-symbol">'+e+"</span>":'<span class="math-symbol">'+e+"</span>"},s.prototype.toJSON=function(){return{mathjs:"SymbolNode",name:this.name}},s.fromJSON=function(t){return new s(t.name)},s.prototype._toTex=function(t){var e=!1;void 0===o[this.name]&&a(this.name)&&(e=!0);var n=le.toSymbol(this.name,e);return"\\"===n[0]?n:" "+n},s}};function Be(t){return(Be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function We(){return(We=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var ze=le,He=Ot.escape,Ue=M.hasOwnProperty,Ve=Pt.map,$e=dt.validateSafeMethod,Ge=dt.getSafeProperty;var Xe={name:"FunctionNode",path:"expression.node",math:!0,factory:function(t,e,n,r,o){var i=n(xt),a=n(qe);function s(e,n){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if("string"==typeof e&&(e=new a(e)),!t.isNode(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(n)||!n.every(t.isNode))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=n||[],Object.defineProperty(this,"name",{get:function(){return this.fn.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}});var r=function(){throw new Error("Property `FunctionNode.object` is deprecated, use `FunctionNode.fn` instead")};Object.defineProperty(this,"object",{get:r,set:r})}s.prototype=new i,s.prototype.type="FunctionNode",s.prototype.isFunctionNode=!0,s.prototype._compile=function(e,n){if(!(this instanceof s))throw new TypeError("No valid FunctionNode");var r=Ve(this.args,(function(t){return t._compile(e,n)}));if(t.isSymbolNode(this.fn)){var o=this.fn.name,i=o in e?Ge(e,o):void 0;if("function"==typeof i&&!0===i.rawArgs){var a=this.args;return function(t,n,r){return(o in t?Ge(t,o):i)(a,e,We({},t,n))}}if(1===r.length){var u=r[0];return function(t,e,n){return(o in t?Ge(t,o):i)(u(t,e,n))}}if(2===r.length){var c=r[0],f=r[1];return function(t,e,n){return(o in t?Ge(t,o):i)(c(t,e,n),f(t,e,n))}}return function(t,e,n){return(o in t?Ge(t,o):i).apply(null,Ve(r,(function(r){return r(t,e,n)})))}}if(t.isAccessorNode(this.fn)&&t.isIndexNode(this.fn.index)&&this.fn.index.isObjectProperty()){var p=this.fn.object._compile(e,n),l=this.fn.index.getObjectProperty(),h=this.args;return function(t,n,o){var i=p(t,n,o);return $e(i,l),i[l]&&i[l].rawArgs?i[l](h,e,We({},t,n)):i[l].apply(i,Ve(r,(function(e){return e(t,n,o)})))}}var m=this.fn._compile(e,n),y=this.args;return function(t,n,o){var i=m(t,n,o);return i&&i.rawArgs?i(y,e,We({},t,n)):i.apply(i,Ve(r,(function(e){return e(t,n,o)})))}},s.prototype.forEach=function(t){t(this.fn,"fn",this);for(var e=0;e<this.args.length;e++)t(this.args[e],"args["+e+"]",this)},s.prototype.map=function(t){for(var e=this._ifNode(t(this.fn,"fn",this)),n=[],r=0;r<this.args.length;r++)n[r]=this._ifNode(t(this.args[r],"args["+r+"]",this));return new s(e,n)},s.prototype.clone=function(){return new s(this.fn,this.args.slice(0))};var u=s.prototype.toString;function c(e,n,r){for(var o,i="",a=new RegExp("\\$(?:\\{([a-z_][a-z_0-9]*)(?:\\[([0-9]+)\\])?\\}|\\$)","ig"),s=0;null!==(o=a.exec(e));)if(i+=e.substring(s,o.index),s=o.index,"$$"===o[0])i+="$",s++;else{s+=o[0].length;var u=n[o[1]];if(!u)throw new ReferenceError("Template: Property "+o[1]+" does not exist.");if(void 0===o[2])switch(Be(u)){case"string":i+=u;break;case"object":if(t.isNode(u))i+=u.toTex(r);else{if(!Array.isArray(u))throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes");i+=u.map((function(e,n){if(t.isNode(e))return e.toTex(r);throw new TypeError("Template: "+o[1]+"["+n+"] is not a Node.")})).join(",")}break;default:throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes")}else{if(!t.isNode(u[o[2]]&&u[o[2]]))throw new TypeError("Template: "+o[1]+"["+o[2]+"] is not a Node.");i+=u[o[2]].toTex(r)}}return i+=e.slice(s)}s.prototype.toString=function(t){var e,n=this.fn.toString(t);return t&&"object"===Be(t.handler)&&Ue(t.handler,n)&&(e=t.handler[n](this,t)),void 0!==e?e:u.call(this,t)},s.prototype._toString=function(e){var n=this.args.map((function(t){return t.toString(e)}));return(t.isFunctionAssignmentNode(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+n.join(", ")+")"},s.prototype.toJSON=function(){return{mathjs:"FunctionNode",fn:this.fn,args:this.args}},s.fromJSON=function(t){return new s(t.fn,t.args)},s.prototype.toHTML=function(t){var e=this.args.map((function(e){return e.toHTML(t)}));return'<span class="math-function">'+He(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+e.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'};var f=s.prototype.toTex;return s.prototype.toTex=function(t){var e;return t&&"object"===Be(t.handler)&&Ue(t.handler,this.name)&&(e=t.handler[this.name](this,t)),void 0!==e?e:f.call(this,t)},s.prototype._toTex=function(t){var e,n,r=this.args.map((function(e){return e.toTex(t)}));switch(!o[this.name]||"function"!=typeof o[this.name].toTex&&"object"!==Be(o[this.name].toTex)&&"string"!=typeof o[this.name].toTex||(e=o[this.name].toTex),Be(e)){case"function":n=e(this,t);break;case"string":n=c(e,this,t);break;case"object":switch(Be(e[r.length])){case"function":n=e[r.length](this,t);break;case"string":n=c(e[r.length],this,t)}}return void 0!==n?n:c(ze.defaultTemplate,this,t)},s.prototype.getIdentifier=function(){return this.type+":"+this.name},s}};var Ze={name:"RangeNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt);function i(e,n,r){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!t.isNode(e))throw new TypeError("Node expected");if(!t.isNode(n))throw new TypeError("Node expected");if(r&&!t.isNode(r))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=n,this.step=r||null}function a(t,e){var n=Yt.getPrecedence(t,e),r={},o=Yt.getPrecedence(t.start,e);if(r.start=null!==o&&o<=n||"all"===e,t.step){var i=Yt.getPrecedence(t.step,e);r.step=null!==i&&i<=n||"all"===e}var a=Yt.getPrecedence(t.end,e);return r.end=null!==a&&a<=n||"all"===e,r}return i.prototype=new o,i.prototype.type="RangeNode",i.prototype.isRangeNode=!0,i.prototype.needsEnd=function(){return this.filter((function(e){return t.isSymbolNode(e)&&"end"===e.name})).length>0},i.prototype._compile=function(t,e){var n=t.range,r=this.start._compile(t,e),o=this.end._compile(t,e);if(this.step){var i=this.step._compile(t,e);return function(t,e,a){return n(r(t,e,a),o(t,e,a),i(t,e,a))}}return function(t,e,i){return n(r(t,e,i),o(t,e,i))}},i.prototype.forEach=function(t){t(this.start,"start",this),t(this.end,"end",this),this.step&&t(this.step,"step",this)},i.prototype.map=function(t){return new i(this._ifNode(t(this.start,"start",this)),this._ifNode(t(this.end,"end",this)),this.step&&this._ifNode(t(this.step,"step",this)))},i.prototype.clone=function(){return new i(this.start,this.end,this.step&&this.step)},i.prototype._toString=function(t){var e,n=a(this,t&&t.parenthesis?t.parenthesis:"keep"),r=this.start.toString(t);if(n.start&&(r="("+r+")"),e=r,this.step){var o=this.step.toString(t);n.step&&(o="("+o+")"),e+=":"+o}var i=this.end.toString(t);return n.end&&(i="("+i+")"),e+=":"+i},i.prototype.toJSON=function(){return{mathjs:"RangeNode",start:this.start,end:this.end,step:this.step}},i.fromJSON=function(t){return new i(t.start,t.end,t.step)},i.prototype.toHTML=function(t){var e,n=a(this,t&&t.parenthesis?t.parenthesis:"keep"),r=this.start.toHTML(t);if(n.start&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e=r,this.step){var o=this.step.toHTML(t);n.step&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e+='<span class="math-operator math-range-operator">:</span>'+o}var i=this.end.toHTML(t);return n.end&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e+='<span class="math-operator math-range-operator">:</span>'+i},i.prototype._toTex=function(t){var e=a(this,t&&t.parenthesis?t.parenthesis:"keep"),n=this.start.toTex(t);if(e.start&&(n="\\left(".concat(n,"\\right)")),this.step){var r=this.step.toTex(t);e.step&&(r="\\left(".concat(r,"\\right)")),n+=":"+r}var o=this.end.toTex(t);return e.end&&(o="\\left(".concat(o,"\\right)")),n+=":"+o},i}},Ke=Ot.escape;var Qe={name:"RelationalNode",path:"expression.node",factory:function(t,e,n,r){var o=n(xt),i=dt.getSafeProperty;function a(t,e){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(t))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(e))throw new TypeError("Parameter params must be an array");if(t.length!==e.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=t,this.params=e}return a.prototype=new o,a.prototype.type="RelationalNode",a.prototype.isRelationalNode=!0,a.prototype._compile=function(t,e){var n=this,r=this.params.map((function(n){return n._compile(t,e)}));return function(e,o,a){for(var s,u=r[0](e,o,a),c=0;c<n.conditionals.length;c++){if(s=u,u=r[c+1](e,o,a),!i(t,n.conditionals[c])(s,u))return!1}return!0}},a.prototype.forEach=function(t){var e=this;this.params.forEach((function(n,r){return t(n,"params["+r+"]",e)}),this)},a.prototype.map=function(t){var e=this;return new a(this.conditionals.slice(),this.params.map((function(n,r){return e._ifNode(t(n,"params["+r+"]",e))}),this))},a.prototype.clone=function(){return new a(this.conditionals,this.params)},a.prototype._toString=function(t){for(var e=t&&t.parenthesis?t.parenthesis:"keep",n=Yt.getPrecedence(this,e),r=this.params.map((function(r,o){var i=Yt.getPrecedence(r,e);return"all"===e||null!==i&&i<=n?"("+r.toString(t)+")":r.toString(t)})),o={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},i=r[0],a=0;a<this.conditionals.length;a++)i+=" "+o[this.conditionals[a]]+" "+r[a+1];return i},a.prototype.toJSON=function(){return{mathjs:"RelationalNode",conditionals:this.conditionals,params:this.params}},a.fromJSON=function(t){return new a(t.conditionals,t.params)},a.prototype.toHTML=function(t){for(var e=t&&t.parenthesis?t.parenthesis:"keep",n=Yt.getPrecedence(this,e),r=this.params.map((function(r,o){var i=Yt.getPrecedence(r,e);return"all"===e||null!==i&&i<=n?'<span class="math-parenthesis math-round-parenthesis">(</span>'+r.toHTML(t)+'<span class="math-parenthesis math-round-parenthesis">)</span>':r.toHTML(t)})),o={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},i=r[0],a=0;a<this.conditionals.length;a++)i+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Ke(o[this.conditionals[a]])+"</span>"+r[a+1];return i},a.prototype._toTex=function(t){for(var e=t&&t.parenthesis?t.parenthesis:"keep",n=Yt.getPrecedence(this,e),r=this.params.map((function(r,o){var i=Yt.getPrecedence(r,e);return"all"===e||null!==i&&i<=n?"\\left("+r.toTex(t)+"\right)":r.toTex(t)})),o=r[0],i=0;i<this.conditionals.length;i++)o+=le.operators[this.conditionals[i]]+r[i+1];return o},a}};function Ye(){return(Ye=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var tn={name:"parse",path:"expression",factory:function(t,e,n,r){var o=n(ut),i=n(Ht),a=n(Vt),s=n(ne),u=n(ae),c=n(se),f=n(ye),p=n(be),l=n(Se),h=n(Pe),m=n(Ie),y=n(Re),d=n(Xe),g=n(Ze),v=n(Qe),w=n(qe);function b(e,n){if(1!==arguments.length&&2!==arguments.length)throw new U("parse",arguments.length,1,2);var r=n&&n.nodes?n.nodes:{};if("string"==typeof e)return L(e,r);if(Array.isArray(e)||e instanceof t.Matrix)return nt(e,(function(t){if("string"!=typeof t)throw new TypeError("String expected");return L(t,r)}));throw new TypeError("String or matrix expected")}var x=0,N=1,E=2,S=3,k=4,O={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},A={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},T={true:!0,false:!1,null:null,undefined:void 0},j=["NaN","Infinity"];function P(t,e){return t.expression.substr(t.index,e)}function C(t){return P(t,1)}function M(t){t.index++}function F(t){return t.expression.charAt(t.index-1)}function _(t){return t.expression.charAt(t.index+1)}function I(t){for(t.tokenType=x,t.token="",t.comment="";b.isWhitespace(C(t),t.nestingLevel);)M(t);if("#"===C(t))for(;"\n"!==C(t)&&""!==C(t);)t.comment+=C(t),M(t);if(""!==C(t)){if("\n"===C(t)&&!t.nestingLevel)return t.tokenType=N,t.token=C(t),void M(t);var e=C(t),n=P(t,2),r=P(t,3);if(3===r.length&&O[r])return t.tokenType=N,t.token=r,M(t),M(t),void M(t);if(2===n.length&&O[n])return t.tokenType=N,t.token=n,M(t),void M(t);if(O[e])return t.tokenType=N,t.token=e,void M(t);if(b.isDigitDot(e)){if(t.tokenType=E,"."===C(t))t.token+=C(t),M(t),b.isDigit(C(t))||(t.tokenType=N);else{for(;b.isDigit(C(t));)t.token+=C(t),M(t);b.isDecimalMark(C(t),_(t))&&(t.token+=C(t),M(t))}for(;b.isDigit(C(t));)t.token+=C(t),M(t);if("E"===C(t)||"e"===C(t))if(b.isDigit(_(t))||"-"===_(t)||"+"===_(t)){if(t.token+=C(t),M(t),"+"!==C(t)&&"-"!==C(t)||(t.token+=C(t),M(t)),!b.isDigit(C(t)))throw ct(t,'Digit expected, got "'+C(t)+'"');for(;b.isDigit(C(t));)t.token+=C(t),M(t);if(b.isDecimalMark(C(t),_(t)))throw ct(t,'Digit expected, got "'+C(t)+'"')}else if("."===_(t))throw M(t),ct(t,'Digit expected, got "'+C(t)+'"')}else{if(!b.isAlpha(C(t),F(t),_(t))){for(t.tokenType=k;""!==C(t);)t.token+=C(t),M(t);throw ct(t,'Syntax error in part "'+t.token+'"')}for(;b.isAlpha(C(t),F(t),_(t))||b.isDigit(C(t));)t.token+=C(t),M(t);A.hasOwnProperty(t.token)?t.tokenType=N:t.tokenType=S}}else t.tokenType=N}function R(t){do{I(t)}while("\n"===t.token)}function D(t){t.nestingLevel++}function J(t){t.nestingLevel--}function L(t,e){var n={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:x,nestingLevel:0,conditionalLevel:null};Ye(n,{expression:t,extraNodes:e}),I(n);var r=function(t){var e,n,r=[];""!==t.token&&"\n"!==t.token&&";"!==t.token&&((e=q(t)).comment=t.comment);for(;"\n"===t.token||";"===t.token;)0===r.length&&e&&(n=";"!==t.token,r.push({node:e,visible:n})),I(t),"\n"!==t.token&&";"!==t.token&&""!==t.token&&((e=q(t)).comment=t.comment,n=";"!==t.token,r.push({node:e,visible:n}));return r.length>0?new u(r):(e||((e=new f(void 0)).comment=t.comment),e)}(n);if(""!==n.token)throw n.tokenType===N?ft(n,"Unexpected operator "+n.token):ct(n,'Unexpected part "'+n.token+'"');return r}function q(e){var n,r,o,i,a=function(t){var e=function(t){var e=B(t);for(;"or"===t.token;)R(t),e=new m("or","or",[e,B(t)]);return e}(t);for(;"?"===t.token;){var n=t.conditionalLevel;t.conditionalLevel=t.nestingLevel,R(t);var r=e,o=q(t);if(":"!==t.token)throw ct(t,"False part of conditional expression expected");t.conditionalLevel=null,R(t);var i=q(t);e=new c(r,o,i),t.conditionalLevel=n}return e}(e);if("="===e.token){if(t.isSymbolNode(a))return n=a.name,R(e),o=q(e),new s(new w(n),o);if(t.isAccessorNode(a))return R(e),o=q(e),new s(a.object,a.index,o);if(t.isFunctionNode(a)&&t.isSymbolNode(a.fn)&&(i=!0,r=[],n=a.name,a.args.forEach((function(e,n){t.isSymbolNode(e)?r[n]=e.name:i=!1})),i))return R(e),o=q(e),new p(n,r,o);throw ct(e,"Invalid left hand side of assignment operator =")}return a}function B(t){for(var e=W(t);"xor"===t.token;)R(t),e=new m("xor","xor",[e,W(t)]);return e}function W(t){for(var e=z(t);"and"===t.token;)R(t),e=new m("and","and",[e,z(t)]);return e}function z(t){for(var e=H(t);"|"===t.token;)R(t),e=new m("|","bitOr",[e,H(t)]);return e}function H(t){for(var e=V(t);"^|"===t.token;)R(t),e=new m("^|","bitXor",[e,V(t)]);return e}function V(t){for(var e=$(t);"&"===t.token;)R(t),e=new m("&","bitAnd",[e,$(t)]);return e}function $(t){for(var e=[G(t)],n=[],r={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};r.hasOwnProperty(t.token);){var o={name:t.token,fn:r[t.token]};n.push(o),R(t),e.push(G(t))}return 1===e.length?e[0]:2===e.length?new m(n[0].name,n[0].fn,e):new v(n.map((function(t){return t.fn})),e)}function G(t){var e,n,r,o,i;for(e=X(t),n={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};n.hasOwnProperty(t.token);)o=n[r=t.token],R(t),i=[e,X(t)],e=new m(r,o,i);return e}function X(t){var e,n,r,o,i;for(e=Z(t),n={to:"to",in:"to"};n.hasOwnProperty(t.token);)o=n[r=t.token],R(t),"in"===r&&""===t.token?e=new m("*","multiply",[e,new w("in")],!0):(i=[e,Z(t)],e=new m(r,o,i));return e}function Z(t){var e,n=[];if(e=":"===t.token?new f(1):K(t),":"===t.token&&t.conditionalLevel!==t.nestingLevel){for(n.push(e);":"===t.token&&n.length<3;)R(t),")"===t.token||"]"===t.token||","===t.token||""===t.token?n.push(new w("end")):n.push(K(t));e=3===n.length?new g(n[0],n[2],n[1]):new g(n[0],n[1])}return e}function K(t){var e,n,r,o,i;for(e=Q(t),n={"+":"add","-":"subtract"};n.hasOwnProperty(t.token);)o=n[r=t.token],R(t),i=[e,Q(t)],e=new m(r,o,i);return e}function Q(t){var e,n,r,o,i;for(n=e=Y(t),r={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};r.hasOwnProperty(t.token);)i=r[o=t.token],R(t),n=Y(t),e=new m(o,i,[e,n]);return e}function Y(e){var n,r;for(r=n=tt(e);e.tokenType===S||"in"===e.token&&t.isConstantNode(n)||!(e.tokenType!==E||t.isConstantNode(r)||t.isOperatorNode(r)&&"!"!==r.op)||"("===e.token;)r=tt(e),n=new m("*","multiply",[n,r],!0);return n}function tt(e){for(var n=et(e),r=n,o=[];"/"===e.token&&t.isConstantNode(r);){if(o.push(Ye({},e)),R(e),e.tokenType!==E){Ye(e,o.pop());break}if(o.push(Ye({},e)),R(e),e.tokenType!==S&&"("!==e.token){o.pop(),Ye(e,o.pop());break}Ye(e,o.pop()),o.pop(),r=et(e),n=new m("/","divide",[n,r])}return n}function et(t){var n,r,i,s={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return s.hasOwnProperty(t.token)?(i=s[t.token],n=t.token,R(t),r=[et(t)],new m(n,i,r)):function(t){var n,r,i,s;n=function(t){var n,r,i,s;n=function(t){var n=[];if(t.tokenType===S&&t.extraNodes.hasOwnProperty(t.token)){var r=t.extraNodes[t.token];if(I(t),"("===t.token){if(n=[],D(t),I(t),")"!==t.token)for(n.push(q(t));","===t.token;)I(t),n.push(q(t));if(")"!==t.token)throw ct(t,"Parenthesis ) expected");J(t),I(t)}return new r(n)}return function(t){var n,r;if(t.tokenType===S||t.tokenType===N&&t.token in A)return r=t.token,I(t),n=T.hasOwnProperty(r)?new f(T[r]):-1!==j.indexOf(r)?new f(o(r,"number")):new w(r),n=rt(t,n);return function(t){var n,r;if('"'===t.token)return r=ot(t),n=new f(r),n=rt(t,n);return function(t){var n,r;if("'"===t.token)return r=it(t),n=new f(r),n=rt(t,n);return function(t){var n,r,i,s;if("["===t.token){if(D(t),I(t),"]"!==t.token){var u=at(t);if(";"===t.token){for(i=1,r=[u];";"===t.token;)I(t),r[i]=at(t),i++;if("]"!==t.token)throw ct(t,"End of matrix ] expected");J(t),I(t),s=r[0].items.length;for(var c=1;c<i;c++)if(r[c].items.length!==s)throw ft(t,"Column dimensions mismatch ("+r[c].items.length+" !== "+s+")");n=new a(r)}else{if("]"!==t.token)throw ct(t,"End of matrix ] expected");J(t),I(t),n=u}}else J(t),I(t),n=new a([]);return rt(t,n)}return function(t){if("{"===t.token){var n;D(t);var r={};do{if(I(t),"}"!==t.token){if('"'===t.token)n=ot(t);else if("'"===t.token)n=it(t);else{if(t.tokenType!==S)throw ct(t,"Symbol or string expected as object key");n=t.token,I(t)}if(":"!==t.token)throw ct(t,"Colon : expected after object key");I(t),r[n]=q(t)}}while(","===t.token);if("}"!==t.token)throw ct(t,"Comma , or bracket } expected after object value");J(t),I(t);var i=new h(r);return i=rt(t,i)}return function(t){var n;if(t.tokenType===E)return n=t.token,I(t),new f(o(n,e.number));return function(t){var e;if("("===t.token){if(D(t),I(t),e=q(t),")"!==t.token)throw ct(t,"Parenthesis ) expected");return J(t),I(t),e=new y(e),e=rt(t,e)}return function(t){throw""===t.token?ct(t,"Unexpected end of expression"):ct(t,"Value expected")}(t)}(t)}(t)}(t)}(t)}(t)}(t)}(t)}(t),r={"!":"factorial","'":"ctranspose"};for(;r.hasOwnProperty(t.token);)i=t.token,s=r[i],I(t),n=new m(i,s,[n]),n=rt(t,n);return n}(t),("^"===t.token||".^"===t.token)&&(r=t.token,i="^"===r?"pow":"dotPow",R(t),s=[n,et(t)],n=new m(r,i,s));return n}(t)}function rt(e,n,r){for(var o;!("("!==e.token&&"["!==e.token&&"."!==e.token||r&&-1===r.indexOf(e.token));)if(o=[],"("===e.token){if(!t.isSymbolNode(n)&&!t.isAccessorNode(n))return n;if(D(e),I(e),")"!==e.token)for(o.push(q(e));","===e.token;)I(e),o.push(q(e));if(")"!==e.token)throw ct(e,"Parenthesis ) expected");J(e),I(e),n=new d(n,o)}else if("["===e.token){if(D(e),I(e),"]"!==e.token)for(o.push(q(e));","===e.token;)I(e),o.push(q(e));if("]"!==e.token)throw ct(e,"Parenthesis ] expected");J(e),I(e),n=new i(n,new l(o))}else{if(I(e),e.tokenType!==S)throw ct(e,"Property name expected after dot");o.push(new f(e.token)),I(e);n=new i(n,new l(o,!0))}return n}function ot(t){for(var e="";""!==C(t)&&'"'!==C(t);)"\\"===C(t)&&(e+=C(t),M(t)),e+=C(t),M(t);if(I(t),'"'!==t.token)throw ct(t,'End of string " expected');return I(t),JSON.parse('"'+e+'"')}function it(t){for(var e="";""!==C(t)&&"'"!==C(t);)"\\"===C(t)&&(e+=C(t),M(t)),e+=C(t),M(t);if(I(t),"'"!==t.token)throw ct(t,"End of string ' expected");return I(t),JSON.parse('"'+e+'"')}function at(t){for(var e=[q(t)],n=1;","===t.token;)I(t),e[n]=q(t),n++;return new a(e)}function st(t){return t.index-t.token.length+1}function ct(t,e){var n=st(t),r=new SyntaxError(e+" (char "+n+")");return r.char=n,r}function ft(t,e){var n=st(t),r=new SyntaxError(e+" (char "+n+")");return r.char=n,r}return b.isAlpha=function(t,e,n){return b.isValidLatinOrGreek(t)||b.isValidMathSymbol(t,n)||b.isValidMathSymbol(e,t)},b.isValidLatinOrGreek=function(t){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(t)},b.isValidMathSymbol=function(t,e){return/^[\uD835]$/.test(t)&&/^[\uDC00-\uDFFF]$/.test(e)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(e)},b.isWhitespace=function(t,e){return" "===t||"\t"===t||"\n"===t&&e>0},b.isDecimalMark=function(t,e){return"."===t&&"/"!==e&&"*"!==e&&"^"!==e},b.isDigitDot=function(t){return t>="0"&&t<="9"||"."===t},b.isDigit=function(t){return t>="0"&&t<="9"},b}};var en={name:"parse",factory:function(t,e,n,r){var o=n(tn);return r("parse",{"string | Array | Matrix":o,"string | Array | Matrix, Object":o})}};var nn={name:"compile",factory:function(t,e,n,r){var o=n(tn);return r("compile",{string:function(t){return o(t).compile()},"Array | Matrix":function(t){return nt(t,(function(t){return o(t).compile()}))}})}};var rn={name:"eval",factory:function(t,e,n,r){var o=n(tn);return r("compile",{string:function(t){return o(t).compile().eval({})},"string, Object":function(t,e){return o(t).compile().eval(e)},"Array | Matrix":function(t){var e={};return nt(t,(function(t){return o(t).compile().eval(e)}))},"Array | Matrix, Object":function(t,e){return nt(t,(function(t){return o(t).compile().eval(e)}))}})}};var on={name:"format",factory:function(t,e,n,r){var o=r("format",{any:Ot.format,"any, Object | function | number":Ot.format});return o.toTex=void 0,o}},an=et.create();an.import(en),an.import(nn),an.import(rn),an.import(on),an.import({add:function(t,e){return t+e},subtract:function(t,e){return t-e},multiply:function(t,e){return t*e},divide:function(t,e){return t/e},mod:function(t,e){return t%e},unaryPlus:function(t){return t},unaryMinus:function(t){return-t},bitOr:function(t,e){return t|e},bitXor:function(t,e){return t^e},bitAnd:function(t,e){return t&e},bitNot:function(t){return~t},leftShift:function(t,e){return t<<e},rightArithShift:function(t,e){return t>>e},rightLogShift:function(t,e){return t>>>e},or:function(t,e){return!(!t&&!e)},xor:function(t,e){return!!t!=!!e},and:function(t,e){return!(!t||!e)},not:function(t){return!t},equal:function(t,e){return t==e},unequal:function(t,e){return t!=e},smaller:function(t,e){return t<e},larger:function(t,e){return t>e},smallerEq:function(t,e){return t<=e},largerEq:function(t,e){return t>=e},matrix:function(){throw new Error("Matrices not supported")},index:function(){throw new Error("Matrix indexes not supported")},pi:Math.PI,e:Math.E,true:!0,false:!1,null:null});var sn={};Object.getOwnPropertyNames(Math).forEach((function(t){Object.prototype.hasOwnProperty(t)||(sn[t]=Math[t])})),an.import(sn);var un=an,cn=function(t){return un.eval(t)},fn=function(t){return("number"==typeof t||"string"==typeof t)&&(!Number.isNaN(t)&&Number.isFinite(Number(t)))},pn=function(t){if(!fn(t))return!1;var e=Number(t);return e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER};function ln(t){return 0|t.next()}function hn(t,e){return 0===e?t:n=>t(n)+e}function mn(t){const e=0|t.next();return 4294967296*(2097151&e)+(t.next()>>>0)+(e&1<<21?-9007199254740992:0)}function yn(t){for(;;){const e=0|t.next();if(!(4194304&e)){return 4294967296*(2097151&e)+(t.next()>>>0)+(e&1<<21?-9007199254740992:0)}if(4194304==(8388607&e)&&0==(0|t.next()))return 9007199254740992}}function dn(t){return t.next()>>>0}function gn(t){return 4294967296*(2097151&t.next())+(t.next()>>>0)}function vn(t){for(;;){const e=0|t.next();if(!(e&1<<21)){return 4294967296*(2097151&e)+(t.next()>>>0)}if(0==(2097151&e)&&0==(0|t.next()))return 9007199254740992}}function wn(t){return 0==(t+1&t)}function bn(t){return wn(t)?(e=t,t=>t.next()&e):function(t){const e=t+1,n=e*Math.floor(4294967296/e);return t=>{let r=0;do{r=t.next()>>>0}while(r>=n);return r%e}}(t);var e}function xn(t){const e=t+1;if(0==(0|e)){const t=(e/4294967296|0)-1;if(wn(t))return n=t,t=>4294967296*(t.next()&n)+(t.next()>>>0)}var n;return function(t){const e=t*Math.floor(9007199254740992/t);return n=>{let r=0;do{r=4294967296*(2097151&n.next())+(n.next()>>>0)}while(r>=e);return r%t}}(e)}function Nn(t,e){return n=>{let r=0;do{const t=0|n.next();r=4294967296*(2097151&t)+(n.next()>>>0)+(t&1<<21?-9007199254740992:0)}while(r<t||r>e);return r}}function En(t,e){if(t=Math.floor(t),e=Math.floor(e),t<-9007199254740992||!isFinite(t))throw new RangeError("Expected min to be at least -9007199254740992");if(e>9007199254740992||!isFinite(e))throw new RangeError("Expected max to be at most 9007199254740992");const n=e-t;return n<=0||!isFinite(n)?()=>t:n===-1>>>0?0===t?dn:hn(ln,t+2147483648):n<-1>>>0?hn(bn(n),t):9007199254740991===n?hn(gn,t):n<9007199254740991?hn(xn(n),t):e-1-t==9007199254740991?hn(vn,t):-9007199254740992===t&&9007199254740992===e?yn:-9007199254740992===t&&9007199254740991===e?mn:-9007199254740991===t&&9007199254740992===e?hn(mn,1):9007199254740992===e?hn(Nn(t-1,e-1),1):Nn(t,e)}function Sn(t){return 1==(1&t.next())}function kn(t,e){return n=>t(n)<e}function On(t,e){return null==e?null==t?Sn:function(t){if(t<=0)return()=>!1;if(t>=1)return()=>!0;{const e=4294967296*t;return e%1==0?kn(ln,e-2147483648|0):kn(gn,Math.round(9007199254740992*t))}}(t):t<=0?()=>!1:t>=e?()=>!0:kn(En(0,e-1),t)}function An(t){return En(1,t)}function Tn(t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"){const e=t.length;if(!e)throw new Error("Expected pool not to be an empty string");const n=En(0,e-1);return(e,r)=>{let o="";for(let i=0;i<r;++i){const r=n(e);o+=t.charAt(r)}return o}}const jn=Tn("0123456789abcdef"),Pn=Tn("0123456789abcdef".toUpperCase());function Cn(t,e){return t<0?Math.max(t+e,0):Math.min(t,e)}function Mn(t){const e=+t;return e<0?Math.ceil(e):Math.floor(e)}function Fn(t){return gn(t)/9007199254740992}function _n(t){return vn(t)/9007199254740992}const In=Array.prototype.slice;function Rn(t,e,n=0){const r=e.length;if(r)for(let o=r-1>>>0;o>n;--o){const n=En(0,o)(t);if(o!==n){const t=e[o];e[o]=e[n],e[n]=t}}return e}const Dn=(()=>{try{if("xxx"==="x".repeat(3))return(t,e)=>t.repeat(e)}catch(t){}return(t,e)=>{let n="";for(;e>0;)1&e&&(n+=t),e>>=1,t+=t;return n}})();function Jn(t,e){return Dn("0",e-t.length)+t}const Ln={next:()=>4294967296*Math.random()|0};class Random{constructor(t=Ln){this.engine=t}int32(){return ln(this.engine)}uint32(){return dn(this.engine)}uint53(){return gn(this.engine)}uint53Full(){return vn(this.engine)}int53(){return mn(this.engine)}int53Full(){return yn(this.engine)}integer(t,e){return En(t,e)(this.engine)}realZeroToOneInclusive(){return _n(this.engine)}realZeroToOneExclusive(){return Fn(this.engine)}real(t,e,n=!1){return function(t,e,n=!1){if(!isFinite(t))throw new RangeError("Expected min to be a finite number");if(!isFinite(e))throw new RangeError("Expected max to be a finite number");return hn((r=n?_n:Fn,1===(o=e-t)?r:0===o?()=>0:t=>r(t)*o),t);var r,o}(t,e,n)(this.engine)}bool(t,e){return On(t,e)(this.engine)}pick(t,e,n){return function(t,e,n,r){const o=e.length;if(0===o)throw new RangeError("Cannot pick from an empty array");const i=null==n?0:Cn(Mn(n),o),a=void 0===r?o:Cn(Mn(r),o);if(i>=a)throw new RangeError(`Cannot pick between bounds ${i} and ${a}`);return e[En(i,a-1)(t)]}(this.engine,t,e,n)}shuffle(t){return Rn(this.engine,t)}sample(t,e){return function(t,e,n){if(n<0||n>e.length||!isFinite(n))throw new RangeError("Expected sampleSize to be within 0 and the length of the population");if(0===n)return[];const r=In.call(e),o=r.length;if(o===n)return Rn(t,r,0);const i=o-n;return Rn(t,r,i-1).slice(i)}(this.engine,t,e)}die(t){return An(t)(this.engine)}dice(t,e){return function(t,e){const n=An(t);return t=>{const r=[];for(let o=0;o<e;++o)r.push(n(t));return r}}(t,e)(this.engine)}uuid4(){return function(t){const e=t.next()>>>0,n=0|t.next(),r=0|t.next(),o=t.next()>>>0;return Jn(e.toString(16),8)+"-"+Jn((65535&n).toString(16),4)+"-"+Jn((n>>4&4095|16384).toString(16),4)+"-"+Jn((16383&r|32768).toString(16),4)+"-"+Jn((r>>4&65535).toString(16),4)+Jn(o.toString(16),8)}(this.engine)}string(t,e){return Tn(e)(this.engine,t)}hex(t,e){return function(t){return t?Pn:jn}(e)(this.engine,t)}date(t,e){return function(t,e){const n=En(+t,+e);return t=>new Date(n(t))}(t,e)(this.engine)}}const qn=(()=>{try{const t=new ArrayBuffer(4),e=new Int32Array(t);if(e[0]=2147483648,-2147483648===e[0])return Int32Array}catch(t){}return Array})();let Bn=null;let Wn=128;const zn={next:()=>(Wn>=128&&(null===Bn&&(Bn=new qn(128)),crypto.getRandomValues(Bn),Wn=0),0|Bn[Wn++])};const Hn=(()=>{try{if(-5===Math.imul(-1>>>0,5))return Math.imul}catch(t){}return(t,e)=>{const n=65535&t,r=65535&e;return n*r+((t>>>16&65535)*r+n*(e>>>16&65535)<<16>>>0)|0}})(),Un=2567483615;class MersenneTwister19937{constructor(){this.data=new qn(624),this.index=0,this.uses=0}static seed(t){return(new MersenneTwister19937).seed(t)}static seedWithArray(t){return(new MersenneTwister19937).seedWithArray(t)}static autoSeed(){return MersenneTwister19937.seedWithArray(function(t=Ln,e=16){const n=[];n.push(0|(new Date).getTime());for(let r=1;r<e;++r)n[r]=0|t.next();return n}())}next(){(0|this.index)>=624&&(Vn(this.data),this.index=0);const t=this.data[this.index];return this.index=this.index+1|0,this.uses+=1,0|function(t){return t^=t>>>11,t^=t<<7&2636928640,(t^=t<<15&4022730752)^t>>>18}(t)}getUseCount(){return this.uses}discard(t){if(t<=0)return this;for(this.uses+=t,(0|this.index)>=624&&(Vn(this.data),this.index=0);t+this.index>624;)t-=624-this.index,Vn(this.data),this.index=0;return this.index=this.index+t|0,this}seed(t){let e=0;this.data[0]=e=0|t;for(let t=1;t<624;t=t+1|0)this.data[t]=e=Hn(e^e>>>30,1812433253)+t|0;return this.index=624,this.uses=0,this}seedWithArray(t){return this.seed(19650218),function(t,e){let n=1,r=0;const o=e.length;let i=0|Math.max(o,624),a=0|t[0];for(;(0|i)>0;--i)t[n]=a=(t[n]^Hn(a^a>>>30,1664525))+(0|e[r])+(0|r)|0,n=n+1|0,++r,(0|n)>623&&(t[0]=t[623],n=1),r>=o&&(r=0);for(i=623;(0|i)>0;--i)t[n]=a=(t[n]^Hn(a^a>>>30,1566083941))-n|0,n=n+1|0,(0|n)>623&&(t[0]=t[623],n=1);t[0]=2147483648}(this.data,t),this}}function Vn(t){let e=0,n=0;for(;(0|e)<227;e=e+1|0)n=2147483648&t[e]|2147483647&t[e+1|0],t[e]=t[e+397|0]^n>>>1^(1&n?Un:0);for(;(0|e)<623;e=e+1|0)n=2147483648&t[e]|2147483647&t[e+1|0],t[e]=t[e-227|0]^n>>>1^(1&n?Un:0);n=2147483648&t[623]|2147483647&t[0],t[623]=t[396]^n>>>1^(1&n?Un:0)}let $n=null;let Gn=128;const Xn={next:()=>(Gn>=128&&($n=new Int32Array(new Int8Array(require("crypto").randomBytes(512)).buffer),Gn=0),0|$n[Gn++])};var Zn=Symbol("engine"),Kn=Symbol("random"),Qn={browserCrypto:zn,nodeCrypto:Xn,MersenneTwister19937:MersenneTwister19937,nativeMath:Ln,min:{next:function(){return 0}},max:{range:[],next:function(){return this.range[1]-this.range[0]}}},Yn=new(function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ln;n(this,t),this.engine=e||Ln}return o(t,[{key:"integer",value:function(t,e){return this[Zn].range=[t,e],this[Kn].integer(t,e)}},{key:"real",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this[Zn].range=[t,e],this[Kn].real(t,e,n)}},{key:"engine",get:function(){return this[Zn]},set:function(t){if(t&&"function"!=typeof t.next)throw new TypeError("engine must have function `next()`");this[Zn]=t||Ln,this[Kn]=new Random(this[Zn])}}]),t}()),tr=Object.freeze({__proto__:null,engines:Qn,generator:Yn}),er=Symbol("operator"),nr=Symbol("value"),rr=function(){function t(e,r){if(n(this,t),!e)throw new A("operator");if(!r&&0!==r)throw new A("value");this.operator=e,this.value=r}return o(t,[{key:"isMatch",value:function(t){return function(t,e,n){var r,o=Number(t),i=Number(e);if(Number.isNaN(o)||Number.isNaN(i))return!1;switch(n){case"=":case"==":r=o===i;break;case"<":r=o<i;break;case">":r=o>i;break;case"<=":r=o<=i;break;case">=":r=o>=i;break;case"!":case"!=":r=o!==i;break;default:r=!1}return r}(t,this.value,this.operator)}},{key:"toJSON",value:function(){return{operator:this.operator,type:"compare-point",value:this.value}}},{key:"toString",value:function(){return"".concat(this.operator).concat(this.value)}},{key:"operator",set:function(t){if(!this.constructor.isValidOperator(t))throw new E(t);this[er]=t},get:function(){return this[er]}},{key:"value",set:function(t){if(!fn(t))throw new TypeError("value must be a finite number");this[nr]=Number(t)},get:function(){return this[nr]}}],[{key:"isValidOperator",value:function(t){return"string"==typeof t&&/^(?:[<>!]?=|[<>])$/.test(t)}}]),t}(),or=function(){function t(){n(this,t),this.order=999}return o(t,[{key:"run",value:function(t,e){return t}},{key:"toJSON",value:function(){var t=this.notation;return{name:this.name,notation:t,type:"modifier"}}},{key:"toString",value:function(){return this.notation}},{key:"name",get:function(){return"modifier"}},{key:"notation",get:function(){return""}},{key:"maxIterations",get:function(){return 1e3}}]),t}(),ir=Symbol("compare-point"),ar=function(t){a(r,t);var e=m(r);function r(t){var o;return n(this,r),o=e.call(this),t&&(o.comparePoint=t),o}return o(r,[{key:"isComparePoint",value:function(t){return!!this.comparePoint&&this.comparePoint.isMatch(t)}},{key:"toJSON",value:function(){var t=this.comparePoint;return Object.assign(d(s(r.prototype),"toJSON",this).call(this),{comparePoint:t})}},{key:"comparePoint",get:function(){return this[ir]},set:function(t){if(!(t instanceof rr))throw new TypeError("comparePoint must be instance of ComparePoint");this[ir]=t}},{key:"name",get:function(){return"comparison"}},{key:"notation",get:function(){return"".concat(this.comparePoint||"")}}]),r}(or),sr=Symbol("compound"),ur=Symbol("penetrate"),cr=function(t){a(r,t);var e=m(r);function r(){var t,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n(this,r),(t=e.call(this,o))[sr]=!!i,t[ur]=!!a,t.order=3,t}return o(r,[{key:"run",value:function(t,e){var n=this;if(e.min===e.max)throw new k(e,"explode");var r=t;return r.rolls=t.rolls.map((function(t){for(var r,o=[t],i=t.value,a=0;a<n.maxIterations&&n.isComparePoint(i);a++){var s=o[o.length-1],u=e.rollOnce();i=u.value,s.modifiers.add("explode"),n.penetrate&&(s.modifiers.add("penetrate"),u.value-=1),o.push(u)}return n.compound&&o.length>1?(t.value=(r=o.map((function(t){return t.value})),Array.isArray(r)?r.reduce((function(t,e){return t+(fn(e)?parseFloat("".concat(e)):0)}),0):0),t.modifiers=["explode","compound"],n.penetrate&&t.modifiers.add("penetrate"),t):o})).flat(),r}},{key:"toJSON",value:function(){var t=this.compound,e=this.penetrate;return Object.assign(d(s(r.prototype),"toJSON",this).call(this),{compound:t,penetrate:e})}},{key:"compound",get:function(){return this[sr]}},{key:"name",get:function(){return"explode"}},{key:"notation",get:function(){return"!".concat(this.compound?"!":"").concat(this.penetrate?"p":"").concat(d(s(r.prototype),"notation",this))}},{key:"penetrate",get:function(){return this[ur]}}]),r}(ar),fr={compound:"!",explode:"!","critical-failure":"__","critical-success":"**",drop:"d",max:"v",min:"^",penetrate:"p","re-roll":"r","re-roll-once":"ro","target-failure":"_","target-success":"*"},pr=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return[].concat(e).reduce((function(t,e){var n;return n=e instanceof or?e.name:e,t+(fr[n]||n)}),"")},lr=Symbol("calculation-value"),hr=Symbol("modifiers"),mr=Symbol("initial-value"),yr=Symbol("use-in-total"),dr=Symbol("value"),gr=function(){function t(r){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(n(this,t),fn(r))this[mr]=Number(r),this.modifiers=o||[],this.useInTotal=i;else{if(!r||"object"!==e(r)||Array.isArray(r))throw r===1/0?new RangeError("Result value must be a finite number"):new TypeError("Result value is invalid: ".concat(r));var a=fn(r.initialValue)?r.initialValue:r.value;if(!fn(a))throw new TypeError("Result value is invalid: ".concat(a));this[mr]=Number(a),fn(r.value)&&Number(r.value)!==this[mr]&&(this.value=r.value),fn(r.calculationValue)&&parseFloat("".concat(r.calculationValue))!==this.value&&(this.calculationValue=r.calculationValue),this.modifiers=r.modifiers||o||[],this.useInTotal="boolean"==typeof r.useInTotal?r.useInTotal:i||!1}}return o(t,[{key:"toJSON",value:function(){var t=this.calculationValue,e=this.initialValue,n=this.modifierFlags,r=this.modifiers,o=this.useInTotal,i=this.value;return{calculationValue:t,initialValue:e,modifierFlags:n,modifiers:b(r),type:"result",useInTotal:o,value:i}}},{key:"toString",value:function(){return this.value+this.modifierFlags}},{key:"calculationValue",get:function(){return fn(this[lr])?parseFloat(this[lr]):this.value},set:function(t){var e=fn(t);if(t===1/0)throw new RangeError("Result calculation value must be a finite number");if(t&&!e)throw new TypeError("Result calculation value is invalid: ".concat(t));this[lr]=e?parseFloat("".concat(t)):null}},{key:"initialValue",get:function(){return this[mr]}},{key:"modifierFlags",get:function(){return pr.apply(void 0,b(this.modifiers))}},{key:"modifiers",get:function(){return this[hr]},set:function(t){if((Array.isArray(t)||t instanceof Set)&&b(t).every((function(t){return"string"==typeof t})))this[hr]=new Set(b(t));else{if(t||0===t)throw new TypeError("modifiers must be a Set or array of modifier names: ".concat(t));this[hr]=new Set}}},{key:"useInTotal",get:function(){return!!this[yr]},set:function(t){this[yr]=!!t}},{key:"value",get:function(){return fn(this[dr])?this[dr]:this[mr]},set:function(t){if(t===1/0)throw new RangeError("Result value must be a finite number");if(!fn(t))throw new TypeError("Result value is invalid: ".concat(t));this[dr]=Number(t)}}]),t}(),vr=Symbol("rolls"),wr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];n(this,t),this.rolls=e}return o(t,[{key:"addRoll",value:function(t){var e=t instanceof gr?t:new gr(t);this[vr].push(e)}},{key:"toJSON",value:function(){return{rolls:this.rolls,type:"roll-results",value:this.value}}},{key:"toString",value:function(){return"[".concat(this.rolls.join(", "),"]")}},{key:"length",get:function(){return this.rolls.length||0}},{key:"rolls",get:function(){return b(this[vr])},set:function(t){var e=this;if(!t||!Array.isArray(t))throw new TypeError("rolls must be an array: ".concat(t));this[vr]=[],t.forEach((function(t){e.addRoll(t)}))}},{key:"value",get:function(){return this.rolls.reduce((function(t,e){return t+(e.useInTotal?e.calculationValue:0)}),0)}}]),t}(),br=Symbol("once"),xr=function(t){a(r,t);var e=m(r);function r(){var t,o=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return n(this,r),(t=e.call(this,i)).once=!!o,t.order=4,t}return o(r,[{key:"run",value:function(t,e){var n=this;if(e.min===e.max)throw new k(e,"re-roll");return t.rolls.map((function(t){for(var r=0;r<n.maxIterations&&n.isComparePoint(t.value);r++){var o=e.rollOnce();if(t.value=o.value,t.modifiers.add("re-roll".concat(n.once?"-once":"")),n.once)break}return t})),t}},{key:"toJSON",value:function(){var t=this.once;return Object.assign(d(s(r.prototype),"toJSON",this).call(this),{once:t})}},{key:"name",get:function(){return"re-roll"}},{key:"notation",get:function(){return"r".concat(this.once?"o":"").concat(d(s(r.prototype),"notation",this))}},{key:"once",get:function(){return!!this[br]},set:function(t){this[br]=!!t}}]),r}(ar),Nr=Symbol("modifiers"),Er=Symbol("qty"),Sr=Symbol("sides"),kr=Symbol("min-value"),Or=Symbol("max-value"),Ar=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(n(this,t),!e&&0!==e)throw new A("sides");if(e===1/0)throw new RangeError("numerical sides must be finite number");if(fn(e)){if(e<1||!pn(e))throw new RangeError("numerical sides must be a positive finite number")}else if("string"!=typeof e)throw new TypeError("non-numerical sides must be a string");if(!fn(r))throw new TypeError("qty must be a positive finite integer");if(r<1||r>999)throw new RangeError("qty must be between 1 and 999");if(!fn(i))throw new TypeError("min must a finite number");if(!pn(i))throw new RangeError("min must a finite number");if(a&&!fn(a))throw new TypeError("max must a finite number");if(a&&!pn(a))throw new RangeError("max must a finite number");this[Er]=parseInt("".concat(r),10),this[Sr]=e,o&&(this.modifiers=o),this[kr]=parseInt(i,10),this[Or]=a?parseInt("".concat(a),10):e}return o(t,[{key:"roll",value:function(){for(var t=this,e=new wr,n=0;n<this.qty;n++)e.addRoll(this.rollOnce());return(this.modifiers||[]).forEach((function(n){n.run(e,t)})),e}},{key:"rollOnce",value:function(){return new gr(Yn.integer(this.min,this.max))}},{key:"toJSON",value:function(){return{average:this.average,max:this.max,min:this.min,modifiers:this.modifiers,name:this.name,notation:this.notation,qty:this.qty,sides:this.sides,type:"die"}}},{key:"toString",value:function(){return this.notation}},{key:"average",get:function(){return(this.min+this.max)/2}},{key:"modifiers",get:function(){return this[Nr]?new Map(b(this[Nr]).sort((function(t,e){return t[1].order-e[1].order}))):null},set:function(t){var n,r=this;if(t instanceof Map)n=t;else if(Array.isArray(t))n=new Map(t.map((function(t){return[t.name,t]})));else{if("object"!==e(t))throw new TypeError("modifiers should be a Map, array, or an Object containing Modifiers");n=new Map(Object.entries(t))}if(n.size&&b(n.entries()).some((function(t){return!(t[1]instanceof or)})))throw new TypeError("modifiers must only contain Modifier instances");this[Nr]=n,this[Nr].forEach((function(t){t instanceof cr&&!t.comparePoint?t.comparePoint=new rr("=",r.max):t instanceof xr&&!t.comparePoint&&(t.comparePoint=new rr("=",r.min))}))}},{key:"max",get:function(){return this[Or]}},{key:"min",get:function(){return this[kr]}},{key:"name",get:function(){return"standard"}},{key:"notation",get:function(){var t="".concat(this.qty,"d").concat(this.sides);return this.modifiers&&this.modifiers.size&&(t+=b(this.modifiers.values()).reduce((function(t,e){return t+e.notation}),"")),t}},{key:"qty",get:function(){return this[Er]}},{key:"sides",get:function(){return this[Sr]}}]),t}(),Tr=function(t){a(r,t);var e=m(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;n(this,r);var a=t;if(a||0===a){if(1!==a&&2!==a)throw new RangeError("nonBlanks must be 1 or 2")}else a=2;return e.call(this,a,o,i,-1,1)}return o(r,[{key:"rollOnce",value:function(){var t=0;if(2===this.nonBlanks)t=Yn.integer(1,3)-2;else if(1===this.nonBlanks){var e=Yn.integer(1,6);1===e?t=-1:6===e&&(t=1)}return new gr(t)}},{key:"name",get:function(){return"fudge"}},{key:"nonBlanks",get:function(){return d(s(r.prototype),"sides",this)}},{key:"sides",get:function(){return"F.".concat(this.nonBlanks)}}]),r}(Ar),jr=function(t){a(r,t);var e=m(r);function r(){var t,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n(this,r),(t=e.call(this,100,o,i)).sidesAsNumber=!!a,t}return o(r,[{key:"name",get:function(){return"percentile"}},{key:"sides",get:function(){return this.sidesAsNumber?d(s(r.prototype),"sides",this):"%"}}]),r}(Ar),Pr=Object.freeze({__proto__:null,FudgeDice:Tr,PercentileDice:jr,StandardDice:Ar}),Cr=function(t){a(r,t);var e=m(r);function r(t){var o;return n(this,r),(o=e.call(this,t)).order=9,o}return o(r,[{key:"run",value:function(t,e){var n=this;return t.rolls.forEach((function(t){return n.isComparePoint(t.value)&&t.modifiers.add("critical-failure"),t})),t}},{key:"name",get:function(){return"critical-failure"}},{key:"notation",get:function(){return"cf".concat(d(s(r.prototype),"notation",this))}}]),r}(ar),Mr=function(t){a(r,t);var e=m(r);function r(t){var o;return n(this,r),(o=e.call(this,t)).order=8,o}return o(r,[{key:"run",value:function(t,e){var n=this;return t.rolls.forEach((function(t){return n.isComparePoint(t.value)&&t.modifiers.add("critical-success"),t})),t}},{key:"name",get:function(){return"critical-success"}},{key:"notation",get:function(){return"cs".concat(d(s(r.prototype),"notation",this))}}]),r}(ar),Fr=Symbol("calculation-value"),_r=Symbol("is-roll-group"),Ir=Symbol("modifiers"),Rr=Symbol("results"),Dr=Symbol("use-in-total"),Jr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];n(this,t),this.isRollGroup=o,this.modifiers=r,this.results=e,this.useInTotal=i}return o(t,[{key:"addResult",value:function(e){var n;if(e instanceof t||e instanceof wr)n=e;else{if("string"!=typeof e&&!fn(e))throw new TypeError("value must be one of ResultGroup, RollResults, string, or number");n=e}this[Rr].push(n)}},{key:"toJSON",value:function(){var t=this.calculationValue,e=this.isRollGroup,n=this.modifierFlags,r=this.modifiers,o=this.results,i=this.useInTotal,a=this.value;return{calculationValue:t,isRollGroup:e,modifierFlags:n,modifiers:b(r),results:o,type:"result-group",useInTotal:i,value:a}}},{key:"toString",value:function(){var t;return t=this.isRollGroup?"{".concat(this.results.join(", "),"}"):this.results.join(""),this.modifierFlags&&(t="(".concat(t,")").concat(this.modifierFlags)),t}},{key:"calculationValue",get:function(){return fn(this[Fr])?parseFloat(this[Fr]):this.value},set:function(t){var e=fn(t);if(t===1/0)throw new RangeError("Results calculation value must be a finite number");if(t&&!e)throw new TypeError("Results calculation value is invalid: ".concat(t));this[Fr]=e?parseFloat("".concat(t)):null}},{key:"isRollGroup",get:function(){return this[_r]},set:function(t){this[_r]=!!t}},{key:"length",get:function(){return this.results.length||0}},{key:"modifierFlags",get:function(){return pr.apply(void 0,b(this.modifiers))}},{key:"modifiers",get:function(){return this[Ir]},set:function(t){if((Array.isArray(t)||t instanceof Set)&&b(t).every((function(t){return"string"==typeof t})))this[Ir]=new Set(b(t));else{if(t||0===t)throw new TypeError("modifiers must be a Set or array of modifier names: ".concat(t));this[Ir]=new Set}}},{key:"results",get:function(){return b(this[Rr])},set:function(t){var e=this;if(!t||!Array.isArray(t))throw new TypeError("results must be an array: ".concat(t));this[Rr]=[],t.forEach((function(t){e.addResult(t)}))}},{key:"useInTotal",get:function(){return!!this[Dr]},set:function(t){this[Dr]=!!t}},{key:"value",get:function(){if(!this.results.length)return 0;var e=this.results.reduce((function(e,n){var r=n;return n instanceof t?r=n.useInTotal?n.calculationValue:0:n instanceof wr&&(r=n.value),e+r}),"string"==typeof this.results[0]?"":0);return"string"==typeof e?cn(e):e}}]),t}(),Lr=Symbol("end"),qr=Symbol("qty"),Br=function(t){a(r,t);var e=m(r);function r(){var t,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"h",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return n(this,r),(t=e.call(this)).end=o,t.qty=i,t.order=5,t}return o(r,[{key:"rangeToDrop",value:function(t){return"h"===this.end?[0,t.length-this.qty]:[this.qty,t.length]}},{key:"run",value:function(t,e){var n,r,o;return(o=(n=(o=t instanceof Jr?1===(r=t.results).length&&r[0]instanceof Jr?r[0].results.map((function(t,e){return t instanceof wr?t.rolls.map((function(t,n){return{value:t.value,index:[e,n]}})):null})).flat().filter(Boolean):b(r).map((function(t,e){return{value:t.value,index:e}})):b(r=t.rolls).map((function(t,e){return{value:t.value,index:e}}))).sort((function(t,e){return t.value-e.value})).map((function(t){return t.index}))).slice.apply(n,b(this.rangeToDrop(o)))).forEach((function(t){var e;(e=Array.isArray(t)?r[0].results[t[0]].rolls[t[1]]:r[t]).modifiers.add("drop"),e.useInTotal=!1})),t}},{key:"toJSON",value:function(){var t=this.end,e=this.qty;return Object.assign(d(s(r.prototype),"toJSON",this).call(this),{end:t,qty:e})}},{key:"end",get:function(){return this[Lr]},set:function(t){if("h"!==t&&"l"!==t)throw new RangeError('End must be "h" or "l"');this[Lr]=t}},{key:"name",get:function(){return"keep-".concat(this.end)}},{key:"notation",get:function(){return"k".concat(this.end).concat(this.qty)}},{key:"qty",get:function(){return this[qr]},set:function(t){if(t===1/0)throw new RangeError("qty must be a finite number");if(!fn(t)||t<1)throw new TypeError("qty must be a positive finite integer");this[qr]=Math.floor(t)}}]),r}(or),Wr=function(t){a(r,t);var e=m(r);function r(){var t,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"l",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return n(this,r),(t=e.call(this,o,i)).order=6,t}return o(r,[{key:"rangeToDrop",value:function(t){return"h"===this.end?[t.length-this.qty,t.length]:[0,this.qty]}},{key:"name",get:function(){return"drop-".concat(this.end)}},{key:"notation",get:function(){return"d".concat(this.end).concat(this.qty)}}]),r}(Br),zr=Symbol("max"),Hr=function(t){a(r,t);var e=m(r);function r(t){var o;return n(this,r),(o=e.call(this)).max=t,o.order=2,o}return o(r,[{key:"run",value:function(t,e){var n=this,r=t;return r.rolls=t.rolls.map((function(t){var e=t;return t.value>n.max&&(e.value=n.max,e.modifiers.add("max")),e})),r}},{key:"toJSON",value:function(){var t=this.max;return Object.assign(d(s(r.prototype),"toJSON",this).call(this),{max:t})}},{key:"max",get:function(){return this[zr]},set:function(t){if(!fn(t))throw new TypeError("max must be a number");this[zr]=parseFloat("".concat(t))}},{key:"name",get:function(){return"max"}},{key:"notation",get:function(){return"max".concat(this.max)}}]),r}(or),Ur=Symbol("min"),Vr=function(t){a(r,t);var e=m(r);function r(t){var o;return n(this,r),(o=e.call(this)).min=t,o.order=1,o}return o(r,[{key:"run",value:function(t,e){var n=this,r=t;return r.rolls=t.rolls.map((function(t){var e=t;return t.value<n.min&&(e.value=n.min,e.modifiers.add("min")),e})),r}},{key:"toJSON",value:function(){var t=this.min;return Object.assign(d(s(r.prototype),"toJSON",this).call(this),{min:t})}},{key:"min",get:function(){return this[Ur]},set:function(t){if(!fn(t))throw new TypeError("min must be a number");this[Ur]=parseFloat("".concat(t))}},{key:"name",get:function(){return"min"}},{key:"notation",get:function(){return"min".concat(this.min)}}]),r}(or),$r=Symbol("direction"),Gr=function(t){a(r,t);var e=m(r);function r(){var t,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"a";return n(this,r),(t=e.call(this)).direction=o,t.order=10,t}return o(r,[{key:"run",value:function(t,e){var n,r=this;return t[n=t instanceof Jr?"results":"rolls"]=t[n].sort((function(t,e){return"d"===r.direction?e.value-t.value:t.value-e.value})),t instanceof Jr&&(t[n]=t[n].map((function(t){return t instanceof Jr||t instanceof wr?r.run(t,e):t}))),t}},{key:"toJSON",value:function(){var t=this.direction;return Object.assign(d(s(r.prototype),"toJSON",this).call(this),{direction:t})}},{key:"direction",get:function(){return this[$r]},set:function(t){if("a"!==t&&"d"!==t)throw new RangeError('Direction must be "a" (Ascending) or "d" (Descending)');this[$r]=t}},{key:"name",get:function(){return"sorting"}},{key:"notation",get:function(){return"s".concat(this.direction)}}]),r}(or),Xr=Symbol("failure-cp"),Zr=function(t){a(r,t);var e=m(r);function r(t){var o,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return n(this,r),(o=e.call(this,t)).failureComparePoint=i,o.order=7,o}return o(r,[{key:"getStateValue",value:function(t){return this.isSuccess(t)?1:this.isFailure(t)?-1:0}},{key:"isFailure",value:function(t){return!!this.failureComparePoint&&this.failureComparePoint.isMatch(t)}},{key:"isNeutral",value:function(t){return!this.isSuccess(t)&&!this.isFailure(t)}},{key:"isSuccess",value:function(t){return this.isComparePoint(t)}},{key:"run",value:function(t,e){var n=this;return(t instanceof Jr?t.results:t.rolls).forEach((function(t){n.isSuccess(t.value)?t.modifiers.add("target-success"):n.isFailure(t.value)&&t.modifiers.add("target-failure"),t.calculationValue=n.getStateValue(t.value)})),t}},{key:"toJSON",value:function(){var t=this.failureComparePoint,e=this.successComparePoint,n=d(s(r.prototype),"toJSON",this).call(this);return delete n.comparePoint,Object.assign(n,{failureComparePoint:t,successComparePoint:e})}},{key:"failureComparePoint",get:function(){return this[Xr]},set:function(t){if(t&&!(t instanceof rr))throw new TypeError("failure comparePoint must be instance of ComparePoint or null");this[Xr]=t||null}},{key:"name",get:function(){return"target"}},{key:"notation",get:function(){return"".concat(d(s(r.prototype),"notation",this)).concat(this.failureComparePoint?"f".concat(this.failureComparePoint):"")}},{key:"successComparePoint",get:function(){return this.comparePoint},set:function(t){v(s(r.prototype),"comparePoint",t,this,!0)}}]),r}(ar),Kr=Object.freeze({__proto__:null,ComparisonModifier:ar,CriticalFailureModifier:Cr,CriticalSuccessModifier:Mr,DropModifier:Wr,ExplodeModifier:cr,KeepModifier:Br,MaxModifier:Hr,MinModifier:Vr,Modifier:or,ReRollModifier:xr,SortingModifier:Gr,TargetModifier:Zr}),Qr=Object.freeze({__proto__:null,ResultGroup:Jr,RollResult:gr,RollResults:wr}),Yr=function(t){try{return!(!t||btoa(atob(t))!==t)}catch(t){return!1}},to=function(t){try{var n=!!t&&JSON.parse(t);return!(!n||"object"!==e(n))}catch(t){return!1}},eo=Symbol("modifiers"),no=Symbol("expressions"),ro=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];n(this,t),this.expressions=e,this.modifiers=r}return o(t,[{key:"roll",value:function(){var t=this,e=new Jr(this.expressions.map((function(t){var e=t.map((function(t){return t instanceof Ar?t.roll():t}));return new Jr(e)})));return e.isRollGroup=!0,(this.modifiers||[]).forEach((function(n){n.run(e,t)})),e}},{key:"toJSON",value:function(){var t=this.modifiers,e=this.notation;return{expressions:this.expressions,modifiers:t,notation:e,type:"group"}}},{key:"toString",value:function(){return this.notation}},{key:"expressions",get:function(){return b(this[no]||[])},set:function(t){var e=this;if(!t)throw new A("expressions");if(!Array.isArray(t))throw new TypeError("expressions must be an array: ".concat(t));this[no]=[],t.forEach((function(n){if(!n||!Array.isArray(n))throw new TypeError("Expressions must be an array of arrays: ".concat(t));if(0===n.length)throw new TypeError("Sub expressions cannot be empty: ".concat(t));if(!n.every((function(t){return t instanceof Ar||"string"==typeof t||"number"==typeof t})))throw new TypeError("Sub expression items must be Dice, numbers, or strings");e[no].push(n)}))}},{key:"modifiers",get:function(){return this[eo]?new Map(b(this[eo]).sort((function(t,e){return t[1].order-e[1].order}))):null},set:function(t){var n;if(t instanceof Map)n=t;else if(Array.isArray(t))n=new Map(t.map((function(t){return[t.name,t]})));else{if("object"!==e(t))throw new TypeError("modifiers should be a Map, array, or an Object containing Modifiers");n=new Map(Object.entries(t))}if(n.size&&b(n.entries()).some((function(t){return!(t[1]instanceof or)})))throw new TypeError("modifiers must only contain Modifier instances");this[eo]=n}},{key:"notation",get:function(){var t=this.expressions.map((function(t){return t.reduce((function(t,e){return t+e}),"")})).join(", ");return t="{".concat(t,"}"),this.modifiers&&this.modifiers.size&&(t+=b(this.modifiers.values()).reduce((function(t,e){return t+e.notation}),"")),t}}]),t}();function oo(t,e,n,r){this.message=t,this.expected=e,this.found=n,this.location=r,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,oo)}function io(t,e){e=void 0!==e?e:{};var n,r,o,a,s={},u={Main:Pt},c=Pt,f=kt("{",!1),p=kt(",",!1),l=kt("}",!1),h=kt("d",!1),m=kt("d%",!1),y=kt("dF",!1),d=kt(".",!1),g=/^[12]/,v=Ot(["1","2"],!1,!1),x=kt("!",!1),N=kt("p",!1),E=/^[lh]/,S=Ot(["l","h"],!1,!1),k=kt("k",!1),O=kt("max",!1),A=kt("min",!1),T=kt("r",!1),j=kt("o",!1),P=kt("cs",!1),C=kt("cf",!1),M=kt("s",!1),F=kt("a",!1),_=kt("f",!1),I=kt("!=",!1),R=kt("<=",!1),D=kt(">=",!1),J=kt("=",!1),L=kt(">",!1),q=kt("<",!1),B=kt("(",!1),W=kt(")",!1),z=kt("abs",!1),H=kt("ceil",!1),U=kt("cos",!1),V=kt("exp",!1),$=kt("floor",!1),G=kt("log",!1),X=kt("round",!1),Z=kt("sign",!1),K=kt("sin",!1),Q=kt("sqrt",!1),Y=kt("tan",!1),tt=kt("pow",!1),et=kt("-",!1),nt=/^[.]/,rt=Ot(["."],!1,!1),ot=/^[1-9]/,it=Ot([["1","9"]],!1,!1),at=/^[0-9]/,st=Ot([["0","9"]],!1,!1),ut=function(){return parseInt(St(),10)},ct=kt("**",!1),ft=kt("*",!1),pt=kt("^",!1),lt=kt("%",!1),ht=kt("/",!1),mt=kt("+",!1),yt={type:"other",description:"whitespace"},dt=/^[ \t\n\r]/,gt=Ot([" ","\t","\n","\r"],!1,!1),vt=0,wt=0,bt=[{line:1,column:1}],xt=0,Nt=[],Et=0;if("startRule"in e){if(!(e.startRule in u))throw new Error("Can't start parsing from rule \""+e.startRule+'".');c=u[e.startRule]}function St(){return t.substring(wt,vt)}function kt(t,e){return{type:"literal",text:t,ignoreCase:e}}function Ot(t,e,n){return{type:"class",parts:t,inverted:e,ignoreCase:n}}function At(e){var n,r=bt[e];if(r)return r;for(n=e-1;!bt[n];)n--;for(r={line:(r=bt[n]).line,column:r.column};n<e;)10===t.charCodeAt(n)?(r.line++,r.column=1):r.column++,n++;return bt[e]=r,r}function Tt(t,e){var n=At(t),r=At(e);return{start:{offset:t,line:n.line,column:n.column},end:{offset:e,line:r.line,column:r.column}}}function jt(t){vt<xt||(vt>xt&&(xt=vt,Nt=[]),Nt.push(t))}function Pt(){return Rt()}function Ct(){var e,n,r,o,a,u,c,h,m,y;if(e=vt,123===t.charCodeAt(vt)?(n="{",vt++):(n=s,0===Et&&jt(f)),n!==s)if(Wt()!==s)if((r=Rt())!==s){for(o=[],a=vt,(u=Wt())!==s?(44===t.charCodeAt(vt)?(c=",",vt++):(c=s,0===Et&&jt(p)),c!==s&&(h=Wt())!==s&&(m=Rt())!==s?a=u=[u,c,h,m]:(vt=a,a=s)):(vt=a,a=s);a!==s;)o.push(a),a=vt,(u=Wt())!==s?(44===t.charCodeAt(vt)?(c=",",vt++):(c=s,0===Et&&jt(p)),c!==s&&(h=Wt())!==s&&(m=Rt())!==s?a=u=[u,c,h,m]:(vt=a,a=s)):(vt=a,a=s);if(o!==s)if((a=Wt())!==s)if(125===t.charCodeAt(vt)?(u="}",vt++):(u=s,0===Et&&jt(l)),u!==s){for(c=[],h=Ft();h!==s;)c.push(h),h=Ft();c!==s?(wt=e,y=c,e=n=new ro([r].concat(b(o.map((function(t){return t[3]})))),Object.assign.apply(Object,[{}].concat(b(y.map((function(t){return i({},t.name,t)}))))))):(vt=e,e=s)}else vt=e,e=s;else vt=e,e=s;else vt=e,e=s}else vt=e,e=s;else vt=e,e=s;else vt=e,e=s;return e}function Mt(){var e,n,r,o;if(e=vt,(n=function(){var e,n,r,o;e=vt,(n=It())===s&&(n=null);n!==s?(100===t.charCodeAt(vt)?(r="d",vt++):(r=s,0===Et&&jt(h)),r!==s&&(o=It())!==s?(wt=e,n=new Ar(o,n||1),e=n):(vt=e,e=s)):(vt=e,e=s);return e}())===s&&(n=function(){var e,n,r;e=vt,(n=It())===s&&(n=null);n!==s?("d%"===t.substr(vt,2)?(r="d%",vt+=2):(r=s,0===Et&&jt(m)),r!==s?(wt=e,n=new jr(n||1),e=n):(vt=e,e=s)):(vt=e,e=s);return e}())===s&&(n=function(){var e,n,r,o,i,a;e=vt,(n=It())===s&&(n=null);n!==s?("dF"===t.substr(vt,2)?(r="dF",vt+=2):(r=s,0===Et&&jt(y)),r!==s?(o=vt,46===t.charCodeAt(vt)?(i=".",vt++):(i=s,0===Et&&jt(d)),i!==s?(g.test(t.charAt(vt))?(a=t.charAt(vt),vt++):(a=s,0===Et&&jt(v)),a!==s?o=i=[i,a]:(vt=o,o=s)):(vt=o,o=s),o===s&&(o=null),o!==s?(wt=e,u=n,n=new Tr((c=o)?parseInt(c[1],10):2,u||1),e=n):(vt=e,e=s)):(vt=e,e=s)):(vt=e,e=s);var u,c;return e}()),n!==s){for(r=[],o=Ft();o!==s;)r.push(o),o=Ft();r!==s?(wt=e,e=n=function(t,e){return t.modifiers=Object.assign.apply(Object,[{}].concat(b(e.map((function(t){return i({},t.name,t)}))))),t}(n,r)):(vt=e,e=s)}else vt=e,e=s;return e}function Ft(){var e;return(e=function(){var e,n,r,o,i;e=vt,33===t.charCodeAt(vt)?(n="!",vt++):(n=s,0===Et&&jt(x));n!==s?(33===t.charCodeAt(vt)?(r="!",vt++):(r=s,0===Et&&jt(x)),r===s&&(r=null),r!==s?(112===t.charCodeAt(vt)?(o="p",vt++):(o=s,0===Et&&jt(N)),o===s&&(o=null),o!==s?((i=_t())===s&&(i=null),i!==s?(wt=e,n=new cr(i,!!r,!!o),e=n):(vt=e,e=s)):(vt=e,e=s)):(vt=e,e=s)):(vt=e,e=s);return e}())===s&&(e=function(){var e,n,r;e=vt,(n=_t())!==s?((r=function(){var e,n,r;e=vt,102===t.charCodeAt(vt)?(n="f",vt++):(n=s,0===Et&&jt(_));n!==s&&(r=_t())!==s?(wt=e,e=n=r):(vt=e,e=s);return e}())===s&&(r=null),r!==s?(wt=e,n=new Zr(n,r),e=n):(vt=e,e=s)):(vt=e,e=s);return e}())===s&&(e=function(){var e,n,r,o;e=vt,100===t.charCodeAt(vt)?(n="d",vt++):(n=s,0===Et&&jt(h));n!==s?(E.test(t.charAt(vt))?(r=t.charAt(vt),vt++):(r=s,0===Et&&jt(S)),r===s&&(r=null),r!==s&&(o=Lt())!==s?(wt=e,n=new Wr(r||"l",o),e=n):(vt=e,e=s)):(vt=e,e=s);return e}())===s&&(e=function(){var e,n,r,o;e=vt,107===t.charCodeAt(vt)?(n="k",vt++):(n=s,0===Et&&jt(k));n!==s?(E.test(t.charAt(vt))?(r=t.charAt(vt),vt++):(r=s,0===Et&&jt(S)),r===s&&(r=null),r!==s&&(o=Lt())!==s?(wt=e,n=new Br(r||"h",o),e=n):(vt=e,e=s)):(vt=e,e=s);return e}())===s&&(e=function(){var e,n,r,o;e=vt,114===t.charCodeAt(vt)?(n="r",vt++):(n=s,0===Et&&jt(T));n!==s?(111===t.charCodeAt(vt)?(r="o",vt++):(r=s,0===Et&&jt(j)),r===s&&(r=null),r!==s?((o=_t())===s&&(o=null),o!==s?(wt=e,n=new xr(!!r,o),e=n):(vt=e,e=s)):(vt=e,e=s)):(vt=e,e=s);return e}())===s&&(e=function(){var e,n,r;e=vt,"cs"===t.substr(vt,2)?(n="cs",vt+=2):(n=s,0===Et&&jt(P));n!==s&&(r=_t())!==s?(wt=e,n=new Mr(r),e=n):(vt=e,e=s);return e}())===s&&(e=function(){var e,n,r;e=vt,"cf"===t.substr(vt,2)?(n="cf",vt+=2):(n=s,0===Et&&jt(C));n!==s&&(r=_t())!==s?(wt=e,n=new Cr(r),e=n):(vt=e,e=s);return e}())===s&&(e=function(){var e,n,r;e=vt,115===t.charCodeAt(vt)?(n="s",vt++):(n=s,0===Et&&jt(M));n!==s?(97===t.charCodeAt(vt)?(r="a",vt++):(r=s,0===Et&&jt(F)),r===s&&(100===t.charCodeAt(vt)?(r="d",vt++):(r=s,0===Et&&jt(h))),r===s&&(r=null),r!==s?(wt=e,n=new Gr(r||"a"),e=n):(vt=e,e=s)):(vt=e,e=s);return e}())===s&&(e=function(){var e,n,r;e=vt,"max"===t.substr(vt,3)?(n="max",vt+=3):(n=s,0===Et&&jt(O));n!==s&&(r=Jt())!==s?(wt=e,n=new Hr(r),e=n):(vt=e,e=s);return e}())===s&&(e=function(){var e,n,r;e=vt,"min"===t.substr(vt,3)?(n="min",vt+=3):(n=s,0===Et&&jt(A));n!==s&&(r=Jt())!==s?(wt=e,n=new Vr(r),e=n):(vt=e,e=s);return e}()),e}function _t(){var e,n,r;return e=vt,(n=function(){var e;"!="===t.substr(vt,2)?(e="!=",vt+=2):(e=s,0===Et&&jt(I));e===s&&("<="===t.substr(vt,2)?(e="<=",vt+=2):(e=s,0===Et&&jt(R)),e===s&&(">="===t.substr(vt,2)?(e=">=",vt+=2):(e=s,0===Et&&jt(D)),e===s&&(61===t.charCodeAt(vt)?(e="=",vt++):(e=s,0===Et&&jt(J)),e===s&&(62===t.charCodeAt(vt)?(e=">",vt++):(e=s,0===Et&&jt(L)),e===s&&(60===t.charCodeAt(vt)?(e="<",vt++):(e=s,0===Et&&jt(q)))))));return e}())!==s&&(r=Jt())!==s?(wt=e,e=n=new rr(n,r)):(vt=e,e=s),e}function It(){var e,n,r,o,i,a,u,c,f,p;if((e=Lt())===s)if(e=vt,40===t.charCodeAt(vt)?(n="(",vt++):(n=s,0===Et&&jt(B)),n!==s)if(Wt()!==s){if(r=vt,(o=Jt())!==s){if(i=[],a=vt,(u=Wt())!==s&&(c=Bt())!==s&&(f=Wt())!==s&&(p=Jt())!==s?a=u=[u,c,f,p]:(vt=a,a=s),a!==s)for(;a!==s;)i.push(a),a=vt,(u=Wt())!==s&&(c=Bt())!==s&&(f=Wt())!==s&&(p=Jt())!==s?a=u=[u,c,f,p]:(vt=a,a=s);else i=s;i!==s?r=o=[o,i]:(vt=r,r=s)}else vt=r,r=s;r!==s&&(o=Wt())!==s?(41===t.charCodeAt(vt)?(i=")",vt++):(i=s,0===Et&&jt(W)),i!==s?(wt=e,e=n=cn(St())):(vt=e,e=s)):(vt=e,e=s)}else vt=e,e=s;else vt=e,e=s;return e}function Rt(){var t,e,n,r,o,i,a,u,c,f;if(t=vt,(e=Dt())!==s){for(n=[],r=vt,(o=Wt())!==s&&(i=Bt())!==s&&(a=Wt())!==s&&(u=Dt())!==s?r=o=[o,i,a,u]:(vt=r,r=s);r!==s;)n.push(r),r=vt,(o=Wt())!==s&&(i=Bt())!==s&&(a=Wt())!==s&&(u=Dt())!==s?r=o=[o,i,a,u]:(vt=r,r=s);n!==s?(wt=t,c=e,f=n,c=Array.isArray(c)?c:[c],t=e=[].concat(b(c),b(f.map((function(t){var e=w(t,4);return[e[1],e[3]]})).flat(2)))):(vt=t,t=s)}else vt=t,t=s;return t}function Dt(){var e,n,r,o,i;return(e=function(){var e,n,r,o,i,a,u;e=vt,"abs"===t.substr(vt,3)?(n="abs",vt+=3):(n=s,0===Et&&jt(z));n===s&&("ceil"===t.substr(vt,4)?(n="ceil",vt+=4):(n=s,0===Et&&jt(H)),n===s&&("cos"===t.substr(vt,3)?(n="cos",vt+=3):(n=s,0===Et&&jt(U)),n===s&&("exp"===t.substr(vt,3)?(n="exp",vt+=3):(n=s,0===Et&&jt(V)),n===s&&("floor"===t.substr(vt,5)?(n="floor",vt+=5):(n=s,0===Et&&jt($)),n===s&&("log"===t.substr(vt,3)?(n="log",vt+=3):(n=s,0===Et&&jt(G)),n===s&&("round"===t.substr(vt,5)?(n="round",vt+=5):(n=s,0===Et&&jt(X)),n===s&&("sign"===t.substr(vt,4)?(n="sign",vt+=4):(n=s,0===Et&&jt(Z)),n===s&&("sin"===t.substr(vt,3)?(n="sin",vt+=3):(n=s,0===Et&&jt(K)),n===s&&("sqrt"===t.substr(vt,4)?(n="sqrt",vt+=4):(n=s,0===Et&&jt(Q)),n===s&&("tan"===t.substr(vt,3)?(n="tan",vt+=3):(n=s,0===Et&&jt(Y))))))))))));n!==s?(40===t.charCodeAt(vt)?(r="(",vt++):(r=s,0===Et&&jt(B)),r!==s&&Wt()!==s&&(o=Rt())!==s&&Wt()!==s?(41===t.charCodeAt(vt)?(i=")",vt++):(i=s,0===Et&&jt(W)),i!==s?(wt=e,c=o,n=["".concat(n,"(")].concat(b(c),[")"]),e=n):(vt=e,e=s)):(vt=e,e=s)):(vt=e,e=s);var c;e===s&&(e=vt,"pow"===t.substr(vt,3)?(n="pow",vt+=3):(n=s,0===Et&&jt(tt)),n===s&&("max"===t.substr(vt,3)?(n="max",vt+=3):(n=s,0===Et&&jt(O)),n===s&&("min"===t.substr(vt,3)?(n="min",vt+=3):(n=s,0===Et&&jt(A)))),n!==s?(40===t.charCodeAt(vt)?(r="(",vt++):(r=s,0===Et&&jt(B)),r!==s&&Wt()!==s&&(o=Rt())!==s&&Wt()!==s?(44===t.charCodeAt(vt)?(i=",",vt++):(i=s,0===Et&&jt(p)),i!==s&&Wt()!==s&&(a=Rt())!==s&&Wt()!==s?(41===t.charCodeAt(vt)?(u=")",vt++):(u=s,0===Et&&jt(W)),u!==s?(wt=e,n=function(t,e,n){return["".concat(t,"(")].concat(b(e),[","],b(n),[")"])}(n,o,a),e=n):(vt=e,e=s)):(vt=e,e=s)):(vt=e,e=s)):(vt=e,e=s));return e}())===s&&(e=Mt())===s&&(e=Jt())===s&&(e=vt,40===t.charCodeAt(vt)?(n="(",vt++):(n=s,0===Et&&jt(B)),n!==s&&Wt()!==s&&(r=Rt())!==s&&Wt()!==s?(41===t.charCodeAt(vt)?(o=")",vt++):(o=s,0===Et&&jt(W)),o!==s?(wt=e,i=o,e=n=[n].concat(b(r),[i])):(vt=e,e=s)):(vt=e,e=s),e===s&&(e=Ct())),e}function Jt(){var e,n,r,o,i;return e=vt,45===t.charCodeAt(vt)?(n="-",vt++):(n=s,0===Et&&jt(et)),n===s&&(n=null),n!==s&&qt()!==s?(r=vt,nt.test(t.charAt(vt))?(o=t.charAt(vt),vt++):(o=s,0===Et&&jt(rt)),o!==s&&(i=qt())!==s?r=o=[o,i]:(vt=r,r=s),r===s&&(r=null),r!==s?(wt=e,e=n=parseFloat(St())):(vt=e,e=s)):(vt=e,e=s),e}function Lt(){var e,n,r,o;if(e=vt,ot.test(t.charAt(vt))?(n=t.charAt(vt),vt++):(n=s,0===Et&&jt(it)),n!==s){for(r=[],at.test(t.charAt(vt))?(o=t.charAt(vt),vt++):(o=s,0===Et&&jt(st));o!==s;)r.push(o),at.test(t.charAt(vt))?(o=t.charAt(vt),vt++):(o=s,0===Et&&jt(st));r!==s?(wt=e,e=n=ut()):(vt=e,e=s)}else vt=e,e=s;return e}function qt(){var e,n,r;if(e=vt,n=[],at.test(t.charAt(vt))?(r=t.charAt(vt),vt++):(r=s,0===Et&&jt(st)),r!==s)for(;r!==s;)n.push(r),at.test(t.charAt(vt))?(r=t.charAt(vt),vt++):(r=s,0===Et&&jt(st));else n=s;return n!==s&&(wt=e,n=ut()),e=n}function Bt(){var e,n;return e=vt,"**"===t.substr(vt,2)?(n="**",vt+=2):(n=s,0===Et&&jt(ct)),n!==s&&(wt=e,n="^"),(e=n)===s&&(42===t.charCodeAt(vt)?(e="*",vt++):(e=s,0===Et&&jt(ft)),e===s&&(94===t.charCodeAt(vt)?(e="^",vt++):(e=s,0===Et&&jt(pt)),e===s&&(37===t.charCodeAt(vt)?(e="%",vt++):(e=s,0===Et&&jt(lt)),e===s&&(47===t.charCodeAt(vt)?(e="/",vt++):(e=s,0===Et&&jt(ht)),e===s&&(43===t.charCodeAt(vt)?(e="+",vt++):(e=s,0===Et&&jt(mt)),e===s&&(45===t.charCodeAt(vt)?(e="-",vt++):(e=s,0===Et&&jt(et)))))))),e}function Wt(){var e,n;for(Et++,e=[],dt.test(t.charAt(vt))?(n=t.charAt(vt),vt++):(n=s,0===Et&&jt(gt));n!==s;)e.push(n),dt.test(t.charAt(vt))?(n=t.charAt(vt),vt++):(n=s,0===Et&&jt(gt));return Et--,e===s&&(n=s,0===Et&&jt(yt)),e}if((n=c())!==s&&vt===t.length)return n;throw n!==s&&vt<t.length&&jt({type:"end"}),r=Nt,o=xt<t.length?t.charAt(xt):null,a=xt<t.length?Tt(xt,xt+1):Tt(xt,xt),new oo(oo.buildMessage(r,o),r,o,a)}!function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n}(oo,Error),oo.buildMessage=function(t,e){var n={literal:function(t){return'"'+o(t.text)+'"'},class:function(t){var e,n="";for(e=0;e<t.parts.length;e++)n+=t.parts[e]instanceof Array?i(t.parts[e][0])+"-"+i(t.parts[e][1]):i(t.parts[e]);return"["+(t.inverted?"^":"")+n+"]"},any:function(t){return"any character"},end:function(t){return"end of input"},other:function(t){return t.description}};function r(t){return t.charCodeAt(0).toString(16).toUpperCase()}function o(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+r(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+r(t)}))}function i(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(t){return"\\x0"+r(t)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(t){return"\\x"+r(t)}))}return"Expected "+function(t){var e,r,o,i=new Array(t.length);for(e=0;e<t.length;e++)i[e]=(o=t[e],n[o.type](o));if(i.sort(),i.length>0){for(e=1,r=1;e<i.length;e++)i[e-1]!==i[e]&&(i[r]=i[e],r++);i.length=r}switch(i.length){case 1:return i[0];case 2:return i[0]+" or "+i[1];default:return i.slice(0,-1).join(", ")+", or "+i[i.length-1]}}(t)+" but "+function(t){return t?'"'+o(t)+'"':"end of input"}(e)+" found."};var ao=function(){function t(){n(this,t)}return o(t,null,[{key:"parse",value:function(t){if(!t)throw new A("notation");if("string"!=typeof t)throw new TypeError("Notation must be a string");return io(t)}}]),t}(),so=Object.freeze({BASE_64:1,JSON:0,OBJECT:2}),uo=Symbol("notation"),co=Symbol("maxTotal"),fo=Symbol("minTotal"),po=Symbol("expressions"),lo=Symbol("roll-method"),ho=Symbol("rolls"),mo=Symbol("set-rolls"),yo=Symbol("total"),go=function(t){return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return parseFloat(parseFloat("".concat(t)).toFixed(e||0))}(t.calculationValue,2)},vo=function(){function t(e){if(n(this,t),!e)throw new A("notation");if(this[po]=[],e instanceof Object&&!Array.isArray(e)){if(!e.notation)throw new A("notation");if("string"!=typeof e.notation)throw new O(e.notation);e.rolls&&this[mo](e.rolls),this[uo]=e.notation,this[po]=ao.parse(this.notation),this.hasRolls()||this.roll()}else{if("string"!=typeof e)throw new O(e);this[uo]=e,this[po]=ao.parse(this.notation),this.roll()}}return o(t,[{key:"export",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:so.JSON;switch(t){case so.BASE_64:return btoa(this.export(so.JSON));case so.JSON:return JSON.stringify(this);case so.OBJECT:return JSON.parse(this.export(so.JSON));default:throw new TypeError('Invalid export format "'.concat(t,'"'))}}},{key:"hasExpressions",value:function(){return this[po]&&this[po].length>0}},{key:"hasRolls",value:function(){return this.hasExpressions()&&this.rolls.length>0}},{key:"roll",value:function(){return this[yo]=0,this[ho]=this[lo](),this.rolls}},{key:"toJSON",value:function(){return{averageTotal:this.averageTotal,maxTotal:this.maxTotal,minTotal:this.minTotal,notation:this.notation,output:this.output,rolls:this.rolls,total:this.total,type:"dice-roll"}}},{key:"toString",value:function(){return this.output}},{key:lo,value:function(t){var e;t&&(e=Yn.engine,Yn.engine=t);var n=new Jr(this[po].map((function(t){return t instanceof Ar||t instanceof ro?t.roll():t})).filter((function(t){return!!t||0===t})));return t&&(Yn.engine=e),n}},{key:mo,value:function(t){if(t instanceof Jr)this[ho]=t;else if(t instanceof wr)this[ho]=new Jr([t]);else{if(!Array.isArray(t))throw new TypeError("Rolls must be a valid result object, or an array");this[ho]=new Jr(t.map((function(t){if(t instanceof Jr||t instanceof wr)return t;if(Array.isArray(t))return new wr(t);if("object"===e(t)){if(Array.isArray(t.results))return new Jr(t.results,t.modifiers||[],t.isRollGroup||!1,"boolean"!=typeof t.useInTotal||t.useInTotal);if(Array.isArray(t.rolls))return new wr(t.rolls)}return t})))}}},{key:"averageTotal",get:function(){return(this.maxTotal+this.minTotal)/2}},{key:"maxTotal",get:function(){if(!this.hasExpressions())return 0;if(!this[co]){var t=this[lo](Qn.max);this[co]=go(t)}return this[co]}},{key:"minTotal",get:function(){if(!this.hasExpressions())return 0;if(!this[fo]){var t=this[lo](Qn.min);this[fo]=go(t)}return this[fo]}},{key:"notation",get:function(){return this[uo]}},{key:"output",get:function(){var t="".concat(this.notation,": ");return this.hasRolls()?t+="".concat(this[ho]," = ").concat(this.total):t+="No dice rolled",t}},{key:"rolls",get:function(){return this[ho]?this[ho].results:[]}},{key:"total",get:function(){return!this[yo]&&this.hasRolls()&&(this[yo]=go(this[ho])),this[yo]||0}}],[{key:"import",value:function(n){if(n){if(to(n))return t.import(JSON.parse(n));if(Yr(n))return t.import(atob(n));if("object"===e(n))return new t(n);throw new S(n)}throw new A("data")}}]),t}(),wo=Symbol("log"),bo=function(){function t(e){n(this,t),this[wo]=[],e&&this.import(e)}return o(t,[{key:"clearLog",value:function(){this[wo].length=0}},{key:"export",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:so.JSON;switch(t){case so.BASE_64:return btoa(this.export(so.JSON));case so.JSON:return JSON.stringify(this);case so.OBJECT:return JSON.parse(this.export(so.JSON));default:throw new TypeError('Invalid export format "'.concat(t,'"'))}}},{key:"import",value:function(t){var n=this;if(t){if(to(t))return this.import(JSON.parse(t));if(Yr(t))return this.import(atob(t));if("object"===e(t)){var r=t.log||null;if(!t.log&&Array.isArray(t)&&t.length&&(r=t),r&&Array.isArray(r))r.forEach((function(t){n[wo].push(vo.import(t))}));else if(r)throw new TypeError("log must be an array");return this.log}throw new S(t)}throw new A("data")}},{key:"roll",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var o=n.filter(Boolean);if(0===o.length)throw new A("notations");var i=o.map((function(e){var n=new vo(e);return t[wo].push(n),n}));return i.length>1?i:i[0]}},{key:"toJSON",value:function(){return{log:this.log,output:this.output,total:this.total,type:"dice-roller"}}},{key:"toString",value:function(){return this.output}},{key:"log",get:function(){return this[wo]||[]}},{key:"output",get:function(){return this.log.join("; ")}},{key:"total",get:function(){return this.log.reduce((function(t,e){return t+e.total}),0)}}],[{key:"import",value:function(e){var n=new t;return n.import(e),n}}]),t}();t.ComparePoint=rr,t.Dice=Pr,t.DiceRoll=vo,t.DiceRoller=bo,t.Exceptions=T,t.Modifiers=Kr,t.NumberGenerator=tr,t.Parser=ao,t.Results=Qr,t.RollGroup=ro,t.exportFormats=so,Object.defineProperty(t,"__esModule",{value:!0})}));